@dxos/react-ui 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/chunk-A5QCIG5R.mjs +24 -0
- package/dist/lib/browser/chunk-A5QCIG5R.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EJSGYGYH.mjs → chunk-LY5XDQR5.mjs} +84 -12
- package/dist/lib/browser/chunk-LY5XDQR5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1322 -811
- 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 -24
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/translations.mjs +9 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-B7MXDDMJ.mjs → chunk-NGKLIKP3.mjs} +84 -12
- package/dist/lib/node-esm/chunk-NGKLIKP3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XCFLA74M.mjs +26 -0
- package/dist/lib/node-esm/chunk-XCFLA74M.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1322 -811
- 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 -24
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/translations.mjs +10 -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.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.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +2 -2
- 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 +59 -42
- 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/Carousel/Carousel.d.ts +106 -0
- package/dist/types/src/components/Carousel/Carousel.d.ts.map +1 -0
- package/dist/types/src/components/Carousel/index.d.ts +2 -0
- package/dist/types/src/components/Carousel/index.d.ts.map +1 -0
- 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 +1 -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 +34 -23
- 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 +38 -21
- 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 +4 -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 +12 -15
- 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.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/MediaPlayer/MediaPlayer.d.ts +46 -0
- package/dist/types/src/components/MediaPlayer/MediaPlayer.d.ts.map +1 -0
- package/dist/types/src/components/MediaPlayer/MediaPlayer.stories.d.ts +16 -0
- package/dist/types/src/components/MediaPlayer/MediaPlayer.stories.d.ts.map +1 -0
- package/dist/types/src/components/MediaPlayer/index.d.ts +2 -0
- package/dist/types/src/components/MediaPlayer/index.d.ts.map +1 -0
- 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 +13 -6
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +9 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts +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 +14 -3
- 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/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 +4 -4
- 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 -15
- 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 +8 -8
- 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 +3 -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/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 +8 -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 +29 -26
- 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 +3 -11
- package/src/components/Button/IconButton.stories.tsx +6 -4
- package/src/components/Button/IconButton.tsx +3 -3
- package/src/components/Button/Toggle.stories.tsx +0 -1
- package/src/components/Button/ToggleGroup.stories.tsx +0 -1
- package/src/components/Card/Card.stories.tsx +15 -15
- package/src/components/Card/Card.tsx +190 -66
- package/src/components/Carousel/Carousel.tsx +379 -0
- package/src/components/Carousel/index.ts +5 -0
- package/src/components/Clipboard/CopyButton.tsx +5 -6
- package/src/components/Dialog/AlertDialog.stories.tsx +5 -6
- package/src/components/Dialog/AlertDialog.tsx +51 -93
- package/src/components/Dialog/Dialog.stories.tsx +64 -9
- package/src/components/Dialog/Dialog.tsx +66 -56
- 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 +13 -3
- 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 +3 -3
- package/src/components/Link/Link.stories.tsx +0 -1
- package/src/components/Link/Link.tsx +10 -2
- package/src/components/List/List.stories.tsx +1 -2
- package/src/components/List/List.tsx +7 -6
- package/src/components/List/ListDropIndicator.tsx +0 -1
- package/src/components/List/Tree.stories.tsx +2 -3
- 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 +0 -1
- package/src/components/MediaPlayer/MediaPlayer.stories.tsx +50 -0
- package/src/components/MediaPlayer/MediaPlayer.tsx +153 -0
- package/src/components/MediaPlayer/index.ts +5 -0
- package/src/components/Menu/ContextMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.tsx +3 -3
- package/src/components/Message/Message.stories.tsx +7 -8
- package/src/components/Message/Message.tsx +23 -10
- package/src/components/Popover/Popover.stories.tsx +4 -5
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/ScrollArea/ScrollArea.stories.tsx +89 -30
- package/src/components/ScrollArea/ScrollArea.tsx +39 -23
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +19 -17
- package/src/components/ScrollContainer/ScrollContainer.tsx +199 -92
- package/src/components/Select/Select.stories.tsx +5 -6
- 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/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/components/Toolbar/Toolbar.tsx +19 -15
- package/src/components/Tooltip/Tooltip.stories.tsx +7 -8
- package/src/components/Tooltip/Tooltip.tsx +14 -13
- package/src/components/index.ts +3 -0
- package/src/exemplars/generics.stories.tsx +7 -15
- package/src/exemplars/slot.stories.tsx +65 -57
- package/src/exemplars/tabster.stories.tsx +1 -1
- package/src/exemplars/virtualizer.stories.tsx +4 -5
- 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 -41
- 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 +8 -7
- package/src/primitives/Panel/Panel.tsx +64 -63
- package/src/testing/Loading.tsx +25 -4
- package/src/testing/decorators/withLayout.tsx +7 -17
- package/src/testing/decorators/withTheme.tsx +10 -7
- package/src/translations.ts +8 -3
- package/src/util/usePx.ts +1 -0
- package/dist/lib/browser/chunk-EJSGYGYH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-B7MXDDMJ.mjs.map +0 -7
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
DensityProvider,
|
|
4
4
|
ElevationContext,
|
|
5
5
|
ElevationProvider,
|
|
6
|
+
ErrorStack,
|
|
6
7
|
ThemeContext,
|
|
7
8
|
ThemeProvider,
|
|
8
9
|
Tooltip,
|
|
@@ -10,12 +11,16 @@ import {
|
|
|
10
11
|
createTooltipScope,
|
|
11
12
|
hasIosKeyboard,
|
|
12
13
|
initialSafeArea,
|
|
14
|
+
parseCaptureOwnerStack,
|
|
13
15
|
useElevationContext,
|
|
14
16
|
useSafeArea,
|
|
15
17
|
useThemeContext,
|
|
16
18
|
useTooltipContext,
|
|
17
19
|
useTranslation
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LY5XDQR5.mjs";
|
|
21
|
+
import {
|
|
22
|
+
translationKey
|
|
23
|
+
} from "./chunk-A5QCIG5R.mjs";
|
|
19
24
|
|
|
20
25
|
// src/index.ts
|
|
21
26
|
import { Trans } from "react-i18next";
|
|
@@ -23,13 +28,13 @@ export * from "@dxos/react-hooks";
|
|
|
23
28
|
export * from "@dxos/ui-types";
|
|
24
29
|
|
|
25
30
|
// src/components/ThemeProvider/index.ts
|
|
26
|
-
import { isLabel, toLocalizedString } from "@dxos/ui-types";
|
|
31
|
+
import { isLabel, toLocalizedString } from "@dxos/ui-types/translations";
|
|
27
32
|
|
|
28
33
|
// src/hooks/useDensityContext.ts
|
|
29
34
|
import { useContext } from "react";
|
|
30
|
-
var useDensityContext = (
|
|
35
|
+
var useDensityContext = (densityProp) => {
|
|
31
36
|
const { density } = useContext(DensityContext);
|
|
32
|
-
return
|
|
37
|
+
return densityProp ?? density;
|
|
33
38
|
};
|
|
34
39
|
|
|
35
40
|
// src/hooks/useIconHref.ts
|
|
@@ -126,11 +131,11 @@ var usePx = (rem) => {
|
|
|
126
131
|
};
|
|
127
132
|
|
|
128
133
|
// src/components/Avatars/Avatar.tsx
|
|
129
|
-
import "@dxos/lit-ui/dx-avatar.pcss";
|
|
130
134
|
import { createContext } from "@radix-ui/react-context";
|
|
131
135
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
132
136
|
import { Slot } from "@radix-ui/react-slot";
|
|
133
137
|
import React, { forwardRef } from "react";
|
|
138
|
+
import "@dxos/lit-ui/dx-avatar.pcss";
|
|
134
139
|
import { DxAvatar } from "@dxos/lit-ui/react";
|
|
135
140
|
import { useId } from "@dxos/react-hooks";
|
|
136
141
|
import { mx } from "@dxos/ui-theme";
|
|
@@ -195,12 +200,19 @@ import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
|
195
200
|
import React4, { forwardRef as forwardRef4 } from "react";
|
|
196
201
|
|
|
197
202
|
// src/components/Icon/Icon.tsx
|
|
198
|
-
import React2, { forwardRef as forwardRef2, memo } from "react";
|
|
199
|
-
var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({
|
|
203
|
+
import React2, { forwardRef as forwardRef2, memo, useMemo as useMemo3 } from "react";
|
|
204
|
+
var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ classNames, icon, size, synchronized, style, ...props }, forwardedRef) => {
|
|
200
205
|
const { tx } = useThemeContext();
|
|
206
|
+
const spinDelay = useMemo3(() => synchronized ? `${-(Date.now() % 1e3)}ms` : void 0, [
|
|
207
|
+
synchronized
|
|
208
|
+
]);
|
|
201
209
|
const href = useIconHref(icon);
|
|
202
210
|
return /* @__PURE__ */ React2.createElement("svg", {
|
|
203
211
|
...props,
|
|
212
|
+
style: {
|
|
213
|
+
...style,
|
|
214
|
+
animationDelay: spinDelay
|
|
215
|
+
},
|
|
204
216
|
className: tx("icon.root", {
|
|
205
217
|
size
|
|
206
218
|
}, classNames),
|
|
@@ -214,11 +226,13 @@ var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ icon, classNames,
|
|
|
214
226
|
import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
|
|
215
227
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
216
228
|
import React3, { forwardRef as forwardRef3 } from "react";
|
|
217
|
-
var Link = /* @__PURE__ */ forwardRef3(({ asChild, variant,
|
|
229
|
+
var Link = /* @__PURE__ */ forwardRef3(({ classNames, asChild, variant, target = "_blank", rel = "noreferrer", ...props }, forwardedRef) => {
|
|
218
230
|
const { tx } = useThemeContext();
|
|
219
231
|
const Comp = asChild ? Slot2 : Primitive2.a;
|
|
220
232
|
return /* @__PURE__ */ React3.createElement(Comp, {
|
|
221
233
|
...props,
|
|
234
|
+
target,
|
|
235
|
+
rel,
|
|
222
236
|
className: tx("link.root", {
|
|
223
237
|
variant
|
|
224
238
|
}, classNames),
|
|
@@ -304,11 +318,11 @@ var BUTTON_NAME = "Button";
|
|
|
304
318
|
var [ButtonGroupProvider, useButtonGroupContext] = createContext2(BUTTON_GROUP_NAME, {
|
|
305
319
|
inGroup: false
|
|
306
320
|
});
|
|
307
|
-
var Button = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef5(({ classNames, children, density:
|
|
321
|
+
var Button = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef5(({ classNames, children, density: densityProp, elevation: elevationProp, variant = "default", asChild, ...props }, ref) => {
|
|
308
322
|
const { inGroup } = useButtonGroupContext(BUTTON_NAME);
|
|
309
323
|
const { tx } = useThemeContext();
|
|
310
|
-
const elevation = useElevationContext(
|
|
311
|
-
const density = useDensityContext(
|
|
324
|
+
const elevation = useElevationContext(elevationProp);
|
|
325
|
+
const density = useDensityContext(densityProp);
|
|
312
326
|
const Comp = asChild ? Slot4 : Primitive4.button;
|
|
313
327
|
return /* @__PURE__ */ React5.createElement(Comp, {
|
|
314
328
|
ref,
|
|
@@ -371,12 +385,13 @@ var IconOnlyButton = /* @__PURE__ */ forwardRef6(({ noTooltip, tooltipSide, ...p
|
|
|
371
385
|
ref: forwardedRef
|
|
372
386
|
}));
|
|
373
387
|
});
|
|
374
|
-
var LabelledIconButton = /* @__PURE__ */ forwardRef6(({ size, icon, iconOnly, iconEnd, iconClassNames, label, caretDown, noTooltip: _, classNames, ...props }, forwardedRef) => {
|
|
388
|
+
var LabelledIconButton = /* @__PURE__ */ forwardRef6(({ size, icon, iconOnly, square, iconEnd, iconClassNames, label, caretDown, noTooltip: _, classNames, ...props }, forwardedRef) => {
|
|
375
389
|
const { tx } = useThemeContext();
|
|
376
390
|
return /* @__PURE__ */ React6.createElement(Button, {
|
|
377
391
|
...props,
|
|
378
392
|
classNames: tx("iconButton.root", {
|
|
379
|
-
iconOnly
|
|
393
|
+
iconOnly,
|
|
394
|
+
square
|
|
380
395
|
}, classNames),
|
|
381
396
|
ref: forwardedRef
|
|
382
397
|
}, icon && !iconEnd && /* @__PURE__ */ React6.createElement(Icon, {
|
|
@@ -453,23 +468,25 @@ var ToggleGroupIconItem = /* @__PURE__ */ forwardRef8(({ variant, label, icon, s
|
|
|
453
468
|
});
|
|
454
469
|
|
|
455
470
|
// src/components/Card/Card.tsx
|
|
456
|
-
import { Primitive as
|
|
457
|
-
import { Slot as
|
|
458
|
-
import
|
|
459
|
-
import {
|
|
471
|
+
import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
472
|
+
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
473
|
+
import DOMPurify from "dompurify";
|
|
474
|
+
import React19, { createContext as createContext3, forwardRef as forwardRef13, useContext as useContext3, useMemo as useMemo5 } from "react";
|
|
475
|
+
import { composable as composable3, composableProps as composableProps7, iconSize, mx as mx6, slottable as slottable6 } from "@dxos/ui-theme";
|
|
460
476
|
|
|
461
477
|
// src/primitives/Column/Column.tsx
|
|
462
478
|
import { Primitive as Primitive5 } from "@radix-ui/react-primitive";
|
|
463
479
|
import { Slot as Slot5 } from "@radix-ui/react-slot";
|
|
464
|
-
import React9
|
|
465
|
-
import { composableProps } from "@dxos/ui-theme";
|
|
480
|
+
import React9 from "react";
|
|
481
|
+
import { composableProps, slottable } from "@dxos/ui-theme";
|
|
466
482
|
var COLUMN_ROOT_NAME = "Column.Root";
|
|
467
483
|
var gutterSizes = {
|
|
484
|
+
xs: "var(--dx-gutter-xs)",
|
|
468
485
|
sm: "var(--dx-gutter-sm)",
|
|
469
486
|
md: "var(--dx-gutter-md)",
|
|
470
487
|
lg: "var(--dx-gutter-lg)"
|
|
471
488
|
};
|
|
472
|
-
var
|
|
489
|
+
var ColumnRoot = slottable(({ children, asChild, role, gutter = "md", ...props }, forwardedRef) => {
|
|
473
490
|
const { className, ...rest } = composableProps(props);
|
|
474
491
|
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
475
492
|
const { tx } = useThemeContext();
|
|
@@ -479,6 +496,7 @@ var Root3 = /* @__PURE__ */ forwardRef9(({ children, asChild, role, gutter = "md
|
|
|
479
496
|
role: role ?? "none",
|
|
480
497
|
style: {
|
|
481
498
|
"--gutter": gutterSize,
|
|
499
|
+
"--dx-col": "2 / span 1",
|
|
482
500
|
gridTemplateColumns: [
|
|
483
501
|
gutterSize,
|
|
484
502
|
"minmax(0,1fr)",
|
|
@@ -491,9 +509,9 @@ var Root3 = /* @__PURE__ */ forwardRef9(({ children, asChild, role, gutter = "md
|
|
|
491
509
|
ref: forwardedRef
|
|
492
510
|
}, children);
|
|
493
511
|
});
|
|
494
|
-
|
|
512
|
+
ColumnRoot.displayName = COLUMN_ROOT_NAME;
|
|
495
513
|
var COLUMN_ROW_NAME = "Column.Row";
|
|
496
|
-
var
|
|
514
|
+
var ColumnRow = slottable(({ children, asChild, role, ...props }, forwardedRef) => {
|
|
497
515
|
const { className, ...rest } = composableProps(props);
|
|
498
516
|
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
499
517
|
const { tx } = useThemeContext();
|
|
@@ -504,37 +522,45 @@ var Row = /* @__PURE__ */ forwardRef9(({ children, asChild, role, ...props }, fo
|
|
|
504
522
|
ref: forwardedRef
|
|
505
523
|
}, children);
|
|
506
524
|
});
|
|
507
|
-
|
|
508
|
-
var
|
|
509
|
-
var
|
|
525
|
+
ColumnRow.displayName = COLUMN_ROW_NAME;
|
|
526
|
+
var COLUMN_BLEED_NAME = "Column.Bleed";
|
|
527
|
+
var ColumnBleed = slottable(({ children, asChild, ...props }, forwardedRef) => {
|
|
528
|
+
const { tx } = useThemeContext();
|
|
510
529
|
const { className, ...rest } = composableProps(props);
|
|
511
530
|
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
531
|
+
return /* @__PURE__ */ React9.createElement(Comp, {
|
|
532
|
+
...rest,
|
|
533
|
+
className: tx("column.bleed", {}, className),
|
|
534
|
+
ref: forwardedRef
|
|
535
|
+
}, children);
|
|
536
|
+
});
|
|
537
|
+
ColumnBleed.displayName = COLUMN_BLEED_NAME;
|
|
538
|
+
var COLUMN_CENTER_NAME = "Column.Center";
|
|
539
|
+
var ColumnCenter = slottable(({ children, asChild, ...props }, forwardedRef) => {
|
|
512
540
|
const { tx } = useThemeContext();
|
|
541
|
+
const { className, ...rest } = composableProps(props);
|
|
542
|
+
const Comp = asChild ? Slot5 : Primitive5.div;
|
|
513
543
|
return /* @__PURE__ */ React9.createElement(Comp, {
|
|
514
544
|
...rest,
|
|
515
|
-
|
|
516
|
-
className: tx("column.segment", {}, className),
|
|
545
|
+
className: tx("column.center", {}, className),
|
|
517
546
|
ref: forwardedRef
|
|
518
|
-
},
|
|
519
|
-
className: "contents"
|
|
520
|
-
}, children));
|
|
547
|
+
}, children);
|
|
521
548
|
});
|
|
522
|
-
|
|
549
|
+
ColumnCenter.displayName = COLUMN_CENTER_NAME;
|
|
523
550
|
var Column = {
|
|
524
|
-
Root:
|
|
525
|
-
Row,
|
|
526
|
-
|
|
551
|
+
Root: ColumnRoot,
|
|
552
|
+
Row: ColumnRow,
|
|
553
|
+
Bleed: ColumnBleed,
|
|
554
|
+
Center: ColumnCenter
|
|
527
555
|
};
|
|
528
556
|
|
|
529
557
|
// src/primitives/Container/Container.tsx
|
|
530
|
-
import React10, { forwardRef as forwardRef10 } from "react";
|
|
531
|
-
import { composableProps as composableProps2, mx as mx2 } from "@dxos/ui-theme";
|
|
532
|
-
import { Slot as Slot6 } from "@radix-ui/react-slot";
|
|
533
558
|
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
559
|
+
import { Slot as Slot6 } from "@radix-ui/react-slot";
|
|
560
|
+
import React10 from "react";
|
|
561
|
+
import { composableProps as composableProps2, mx as mx2, slottable as slottable2 } from "@dxos/ui-theme";
|
|
562
|
+
var Container = slottable2(({ children, asChild, ...props }, forwardedRef) => {
|
|
563
|
+
const { className, ...rest } = composableProps2(props);
|
|
538
564
|
const Comp = asChild ? Slot6 : Primitive6.div;
|
|
539
565
|
return /* @__PURE__ */ React10.createElement(Comp, {
|
|
540
566
|
...rest,
|
|
@@ -544,22 +570,24 @@ var Container = /* @__PURE__ */ forwardRef10(({ children, asChild, ...props }, f
|
|
|
544
570
|
});
|
|
545
571
|
|
|
546
572
|
// src/primitives/Flex/Flex.tsx
|
|
547
|
-
import
|
|
548
|
-
import {
|
|
549
|
-
|
|
573
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
574
|
+
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
575
|
+
import React11 from "react";
|
|
576
|
+
import { composableProps as composableProps3, mx as mx3, slottable as slottable3 } from "@dxos/ui-theme";
|
|
577
|
+
var Flex = slottable3(({ children, asChild, column, grow, ...props }, forwardedRef) => {
|
|
550
578
|
const { className, ...rest } = composableProps3(props);
|
|
551
|
-
|
|
579
|
+
const Comp = asChild ? Slot7 : Primitive7.div;
|
|
580
|
+
return /* @__PURE__ */ React11.createElement(Comp, {
|
|
552
581
|
ref: forwardedRef,
|
|
553
582
|
...rest,
|
|
554
|
-
role: role ?? "none",
|
|
555
583
|
className: mx3("flex", column && "flex-col", grow && "flex-1 overflow-hidden", className)
|
|
556
584
|
}, children);
|
|
557
585
|
});
|
|
558
586
|
|
|
559
587
|
// src/primitives/Grid/Grid.tsx
|
|
560
|
-
import React12
|
|
561
|
-
import { composableProps as composableProps4, mx as mx4 } from "@dxos/ui-theme";
|
|
562
|
-
var Grid =
|
|
588
|
+
import React12 from "react";
|
|
589
|
+
import { composable, composableProps as composableProps4, mx as mx4 } from "@dxos/ui-theme";
|
|
590
|
+
var Grid = composable(({ children, style, role, cols, rows, grow = true, ...props }, forwardedRef) => {
|
|
563
591
|
const { className, ...rest } = composableProps4(props);
|
|
564
592
|
return /* @__PURE__ */ React12.createElement("div", {
|
|
565
593
|
ref: forwardedRef,
|
|
@@ -575,15 +603,15 @@ var Grid = /* @__PURE__ */ forwardRef12(({ children, style, role, cols, rows, gr
|
|
|
575
603
|
});
|
|
576
604
|
|
|
577
605
|
// src/primitives/Panel/Panel.tsx
|
|
578
|
-
import { Primitive as
|
|
579
|
-
import { Slot as
|
|
580
|
-
import React13
|
|
581
|
-
import { composableProps as composableProps5 } from "@dxos/ui-theme";
|
|
606
|
+
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
607
|
+
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
608
|
+
import React13 from "react";
|
|
609
|
+
import { composableProps as composableProps5, slottable as slottable4 } from "@dxos/ui-theme";
|
|
582
610
|
var GRID_TEMPLATE_ROWS = "auto 1fr auto";
|
|
583
611
|
var GRID_TEMPLATE_AREAS = '"toolbar" "content" "statusbar"';
|
|
584
|
-
var
|
|
612
|
+
var PanelRoot = slottable4(({ children, asChild, role, style, ...props }, forwardedRef) => {
|
|
585
613
|
const { className, ...rest } = composableProps5(props);
|
|
586
|
-
const Comp = asChild ?
|
|
614
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
587
615
|
const { tx } = useThemeContext();
|
|
588
616
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
589
617
|
...rest,
|
|
@@ -597,22 +625,24 @@ var Root4 = /* @__PURE__ */ forwardRef13(({ children, asChild, role, style, ...p
|
|
|
597
625
|
ref: forwardedRef
|
|
598
626
|
}, children);
|
|
599
627
|
});
|
|
600
|
-
|
|
601
|
-
var
|
|
628
|
+
PanelRoot.displayName = "Panel.Root";
|
|
629
|
+
var PanelToolbar = slottable4(({ children, asChild, size, ...props }, forwardedRef) => {
|
|
602
630
|
const { className, ...rest } = composableProps5(props);
|
|
603
|
-
const Comp = asChild ?
|
|
631
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
604
632
|
const { tx } = useThemeContext();
|
|
605
633
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
606
634
|
...rest,
|
|
607
635
|
"data-slot": "toolbar",
|
|
608
|
-
className: tx("panel.toolbar", {
|
|
636
|
+
className: tx("panel.toolbar", {
|
|
637
|
+
size
|
|
638
|
+
}, className),
|
|
609
639
|
ref: forwardedRef
|
|
610
640
|
}, children);
|
|
611
641
|
});
|
|
612
|
-
|
|
613
|
-
var
|
|
642
|
+
PanelToolbar.displayName = "Panel.Toolbar";
|
|
643
|
+
var PanelContent = slottable4(({ children, asChild, ...props }, forwardedRef) => {
|
|
614
644
|
const { className, ...rest } = composableProps5(props);
|
|
615
|
-
const Comp = asChild ?
|
|
645
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
616
646
|
const { tx } = useThemeContext();
|
|
617
647
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
618
648
|
...rest,
|
|
@@ -621,31 +651,33 @@ var Content = /* @__PURE__ */ forwardRef13(({ children, asChild, ...props }, for
|
|
|
621
651
|
ref: forwardedRef
|
|
622
652
|
}, children);
|
|
623
653
|
});
|
|
624
|
-
|
|
625
|
-
var
|
|
654
|
+
PanelContent.displayName = "Panel.Content";
|
|
655
|
+
var PanelStatusbar = slottable4(({ children, asChild, size, ...props }, forwardedRef) => {
|
|
626
656
|
const { className, ...rest } = composableProps5(props);
|
|
627
|
-
const Comp = asChild ?
|
|
657
|
+
const Comp = asChild ? Slot8 : Primitive8.div;
|
|
628
658
|
const { tx } = useThemeContext();
|
|
629
659
|
return /* @__PURE__ */ React13.createElement(Comp, {
|
|
630
660
|
...rest,
|
|
631
661
|
"data-slot": "statusbar",
|
|
632
|
-
className: tx("panel.statusbar", {
|
|
662
|
+
className: tx("panel.statusbar", {
|
|
663
|
+
size
|
|
664
|
+
}, className),
|
|
633
665
|
ref: forwardedRef
|
|
634
666
|
}, children);
|
|
635
667
|
});
|
|
636
|
-
|
|
668
|
+
PanelStatusbar.displayName = "Panel.Statusbar";
|
|
637
669
|
var Panel = {
|
|
638
|
-
Root:
|
|
639
|
-
Toolbar,
|
|
640
|
-
Content,
|
|
641
|
-
Statusbar
|
|
670
|
+
Root: PanelRoot,
|
|
671
|
+
Toolbar: PanelToolbar,
|
|
672
|
+
Content: PanelContent,
|
|
673
|
+
Statusbar: PanelStatusbar
|
|
642
674
|
};
|
|
643
675
|
|
|
644
676
|
// src/components/Image/Image.tsx
|
|
645
677
|
import React14, { useCallback as useCallback3, useRef, useState as useState3 } from "react";
|
|
646
678
|
import { mx as mx5 } from "@dxos/ui-theme";
|
|
647
679
|
var cache = /* @__PURE__ */ new Map();
|
|
648
|
-
var Image = ({ classNames, src, alt = "", crossOrigin = "anonymous", sampleSize = 64, contrast = 0.9 }) => {
|
|
680
|
+
var Image = ({ classNames, src, alt = "", fit = "contain", crossOrigin = "anonymous", sampleSize = 64, contrast = 0.9 }) => {
|
|
649
681
|
const [crossOriginState, setCrossOriginState] = useState3(crossOrigin);
|
|
650
682
|
const [dominantColor, setDominantColor] = useState3(void 0);
|
|
651
683
|
const [imageLoaded, setImageLoaded] = useState3(false);
|
|
@@ -684,7 +716,13 @@ var Image = ({ classNames, src, alt = "", crossOrigin = "anonymous", sampleSize
|
|
|
684
716
|
src
|
|
685
717
|
]);
|
|
686
718
|
return /* @__PURE__ */ React14.createElement("div", {
|
|
687
|
-
|
|
719
|
+
// `isolate` (`isolation: isolate`) creates a new stacking context so
|
|
720
|
+
// the inner <img>'s `z-10` stays scoped to this wrapper. Without it
|
|
721
|
+
// the z-10 leaks into the parent's stacking context and elevates the
|
|
722
|
+
// image above any pseudo-element rings (e.g. Focus.Item's
|
|
723
|
+
// `dx-ring-pseudo` `::after`) painted on ancestors — most visibly,
|
|
724
|
+
// the focus ring on a Card containing a Card.Poster.
|
|
725
|
+
className: mx5(`relative flex w-full justify-center overflow-hidden transition-all duration-700 isolate`, classNames),
|
|
688
726
|
style: {
|
|
689
727
|
backgroundColor: dominantColor
|
|
690
728
|
}
|
|
@@ -707,7 +745,7 @@ var Image = ({ classNames, src, alt = "", crossOrigin = "anonymous", sampleSize
|
|
|
707
745
|
crossOrigin: crossOriginState,
|
|
708
746
|
onError: handleImageError,
|
|
709
747
|
onLoad: handleImageLoad,
|
|
710
|
-
className: "z-10
|
|
748
|
+
className: mx5("z-10 transition-opacity duration-500", fit === "cover" ? "w-full h-full object-cover" : "object-contain"),
|
|
711
749
|
style: {
|
|
712
750
|
opacity: imageLoaded ? 1 : 0
|
|
713
751
|
}
|
|
@@ -745,7 +783,9 @@ var extractDominantColor = (canvas, img, { sampleSize = 64, contrast = 0.95 }) =
|
|
|
745
783
|
const green = pixels[i + 1];
|
|
746
784
|
const blue = pixels[i + 2];
|
|
747
785
|
const alpha = pixels[i + 3];
|
|
748
|
-
if (alpha === 0)
|
|
786
|
+
if (alpha === 0) {
|
|
787
|
+
continue;
|
|
788
|
+
}
|
|
749
789
|
const max = Math.max(red, green, blue);
|
|
750
790
|
const min = Math.min(red, green, blue);
|
|
751
791
|
const saturation = max === 0 ? 0 : (max - min) / max;
|
|
@@ -773,50 +813,45 @@ var isTransparent = (pixels, sampleSize, threshold = 0.5) => {
|
|
|
773
813
|
const edgePixels = sampleSize * 4 - 4;
|
|
774
814
|
for (let x = 0; x < sampleSize; x++) {
|
|
775
815
|
const topIndex = x * 4;
|
|
776
|
-
if (pixels[topIndex + 3] === 0)
|
|
816
|
+
if (pixels[topIndex + 3] === 0) {
|
|
817
|
+
edgeTransparentPixels++;
|
|
818
|
+
}
|
|
777
819
|
const bottomIndex = ((sampleSize - 1) * sampleSize + x) * 4;
|
|
778
|
-
if (pixels[bottomIndex + 3] === 0)
|
|
820
|
+
if (pixels[bottomIndex + 3] === 0) {
|
|
821
|
+
edgeTransparentPixels++;
|
|
822
|
+
}
|
|
779
823
|
}
|
|
780
824
|
for (let y = 1; y < sampleSize - 1; y++) {
|
|
781
825
|
const leftIndex = y * sampleSize * 4;
|
|
782
|
-
if (pixels[leftIndex + 3] === 0)
|
|
826
|
+
if (pixels[leftIndex + 3] === 0) {
|
|
827
|
+
edgeTransparentPixels++;
|
|
828
|
+
}
|
|
783
829
|
const rightIndex = (y * sampleSize + sampleSize - 1) * 4;
|
|
784
|
-
if (pixels[rightIndex + 3] === 0)
|
|
830
|
+
if (pixels[rightIndex + 3] === 0) {
|
|
831
|
+
edgeTransparentPixels++;
|
|
832
|
+
}
|
|
785
833
|
}
|
|
786
834
|
return edgeTransparentPixels / edgePixels > threshold;
|
|
787
835
|
};
|
|
788
836
|
|
|
789
837
|
// src/components/Toolbar/Toolbar.tsx
|
|
790
|
-
import { Primitive as
|
|
791
|
-
import { Slot as
|
|
838
|
+
import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
|
|
839
|
+
import { Slot as Slot11 } from "@radix-ui/react-slot";
|
|
792
840
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
793
|
-
import React18, { forwardRef as
|
|
841
|
+
import React18, { forwardRef as forwardRef12 } from "react";
|
|
794
842
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
795
|
-
import { composableProps as composableProps6 } from "@dxos/ui-theme";
|
|
796
|
-
|
|
797
|
-
// src/translations.ts
|
|
798
|
-
var translationKey = "@dxos/react-ui";
|
|
799
|
-
var translations = [
|
|
800
|
-
{
|
|
801
|
-
"en-US": {
|
|
802
|
-
[translationKey]: {
|
|
803
|
-
"toolbar menu label": "Action menu",
|
|
804
|
-
"toolbar drag handle label": "Drag to rearrange",
|
|
805
|
-
"toolbar close label": "Close"
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
];
|
|
843
|
+
import { composable as composable2, composableProps as composableProps6, slottable as slottable5 } from "@dxos/ui-theme";
|
|
844
|
+
import { translationKey as translationKey2 } from "#translations";
|
|
810
845
|
|
|
811
846
|
// src/components/Menu/ContextMenu.tsx
|
|
812
847
|
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
813
|
-
import { Primitive as
|
|
814
|
-
import { Slot as
|
|
815
|
-
import React15, { forwardRef as
|
|
848
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
849
|
+
import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
850
|
+
import React15, { forwardRef as forwardRef9 } from "react";
|
|
816
851
|
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
817
852
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
818
853
|
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
819
|
-
var ContextMenuContent = /* @__PURE__ */
|
|
854
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef9(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
820
855
|
const { tx } = useThemeContext();
|
|
821
856
|
const elevation = useElevationContext();
|
|
822
857
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
@@ -830,16 +865,16 @@ var ContextMenuContent = /* @__PURE__ */ forwardRef14(({ classNames, children, c
|
|
|
830
865
|
ref: forwardedRef
|
|
831
866
|
}, children);
|
|
832
867
|
});
|
|
833
|
-
var ContextMenuViewport = /* @__PURE__ */
|
|
868
|
+
var ContextMenuViewport = /* @__PURE__ */ forwardRef9(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
834
869
|
const { tx } = useThemeContext();
|
|
835
|
-
const Comp = asChild ?
|
|
870
|
+
const Comp = asChild ? Slot9 : Primitive9.div;
|
|
836
871
|
return /* @__PURE__ */ React15.createElement(Comp, {
|
|
837
872
|
...props,
|
|
838
873
|
className: tx("menu.viewport", {}, classNames),
|
|
839
874
|
ref: forwardedRef
|
|
840
875
|
}, children);
|
|
841
876
|
});
|
|
842
|
-
var ContextMenuArrow = /* @__PURE__ */
|
|
877
|
+
var ContextMenuArrow = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
843
878
|
const { tx } = useThemeContext();
|
|
844
879
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Arrow, {
|
|
845
880
|
...props,
|
|
@@ -849,7 +884,7 @@ var ContextMenuArrow = /* @__PURE__ */ forwardRef14(({ classNames, ...props }, f
|
|
|
849
884
|
});
|
|
850
885
|
var ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
851
886
|
var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
|
|
852
|
-
var ContextMenuItem = /* @__PURE__ */
|
|
887
|
+
var ContextMenuItem = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
853
888
|
const { tx } = useThemeContext();
|
|
854
889
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Item, {
|
|
855
890
|
...props,
|
|
@@ -857,7 +892,7 @@ var ContextMenuItem = /* @__PURE__ */ forwardRef14(({ classNames, ...props }, fo
|
|
|
857
892
|
ref: forwardedRef
|
|
858
893
|
});
|
|
859
894
|
});
|
|
860
|
-
var ContextMenuCheckboxItem = /* @__PURE__ */
|
|
895
|
+
var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
861
896
|
const { tx } = useThemeContext();
|
|
862
897
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.CheckboxItem, {
|
|
863
898
|
...props,
|
|
@@ -865,7 +900,7 @@ var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef14(({ classNames, ...pro
|
|
|
865
900
|
ref: forwardedRef
|
|
866
901
|
});
|
|
867
902
|
});
|
|
868
|
-
var ContextMenuSeparator = /* @__PURE__ */
|
|
903
|
+
var ContextMenuSeparator = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
869
904
|
const { tx } = useThemeContext();
|
|
870
905
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Separator, {
|
|
871
906
|
...props,
|
|
@@ -873,7 +908,7 @@ var ContextMenuSeparator = /* @__PURE__ */ forwardRef14(({ classNames, ...props
|
|
|
873
908
|
ref: forwardedRef
|
|
874
909
|
});
|
|
875
910
|
});
|
|
876
|
-
var ContextMenuGroupLabel = /* @__PURE__ */
|
|
911
|
+
var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef9(({ classNames, ...props }, forwardedRef) => {
|
|
877
912
|
const { tx } = useThemeContext();
|
|
878
913
|
return /* @__PURE__ */ React15.createElement(ContextMenuPrimitive.Label, {
|
|
879
914
|
...props,
|
|
@@ -903,10 +938,10 @@ import { createContextScope } from "@radix-ui/react-context";
|
|
|
903
938
|
import { useId as useId2 } from "@radix-ui/react-id";
|
|
904
939
|
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
905
940
|
import { createMenuScope } from "@radix-ui/react-menu";
|
|
906
|
-
import { Primitive as
|
|
907
|
-
import { Slot as
|
|
941
|
+
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
|
942
|
+
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
908
943
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
909
|
-
import React16, { forwardRef as
|
|
944
|
+
import React16, { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2 } from "react";
|
|
910
945
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
911
946
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
912
947
|
createMenuScope
|
|
@@ -942,14 +977,14 @@ var DropdownMenuRoot = ({ __scopeDropdownMenu, children, dir, modal = true, open
|
|
|
942
977
|
};
|
|
943
978
|
DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
|
|
944
979
|
var TRIGGER_NAME = "DropdownMenuTrigger";
|
|
945
|
-
var DropdownMenuTrigger = /* @__PURE__ */
|
|
980
|
+
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
946
981
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
947
982
|
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
948
983
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
949
984
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.Anchor, {
|
|
950
985
|
asChild: true,
|
|
951
986
|
...menuScope
|
|
952
|
-
}, /* @__PURE__ */ React16.createElement(
|
|
987
|
+
}, /* @__PURE__ */ React16.createElement(Primitive10.button, {
|
|
953
988
|
type: "button",
|
|
954
989
|
id: context.triggerId,
|
|
955
990
|
"aria-haspopup": "menu",
|
|
@@ -1019,9 +1054,9 @@ var DropdownMenuPortal = (props) => {
|
|
|
1019
1054
|
});
|
|
1020
1055
|
};
|
|
1021
1056
|
DropdownMenuPortal.displayName = PORTAL_NAME;
|
|
1022
|
-
var DropdownMenuViewport = /* @__PURE__ */
|
|
1057
|
+
var DropdownMenuViewport = /* @__PURE__ */ forwardRef10(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1023
1058
|
const { tx } = useThemeContext();
|
|
1024
|
-
const Comp = asChild ?
|
|
1059
|
+
const Comp = asChild ? Slot10 : Primitive10.div;
|
|
1025
1060
|
return /* @__PURE__ */ React16.createElement(Comp, {
|
|
1026
1061
|
...props,
|
|
1027
1062
|
className: tx("menu.viewport", {}, classNames),
|
|
@@ -1029,7 +1064,7 @@ var DropdownMenuViewport = /* @__PURE__ */ forwardRef15(({ classNames, asChild,
|
|
|
1029
1064
|
}, children);
|
|
1030
1065
|
});
|
|
1031
1066
|
var CONTENT_NAME = "DropdownMenuContent";
|
|
1032
|
-
var DropdownMenuContent = /* @__PURE__ */
|
|
1067
|
+
var DropdownMenuContent = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1033
1068
|
const { __scopeDropdownMenu, classNames, collisionPadding = 8, collisionBoundary, ...contentProps } = props;
|
|
1034
1069
|
const { tx } = useThemeContext();
|
|
1035
1070
|
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
@@ -1037,7 +1072,7 @@ var DropdownMenuContent = /* @__PURE__ */ forwardRef15((props, forwardedRef) =>
|
|
|
1037
1072
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1038
1073
|
const hasInteractedOutsideRef = useRef2(false);
|
|
1039
1074
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1040
|
-
const computedCollisionBoundary =
|
|
1075
|
+
const computedCollisionBoundary = useMemo4(() => {
|
|
1041
1076
|
const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
|
|
1042
1077
|
return closestBoundary ? Array.isArray(collisionBoundary) ? [
|
|
1043
1078
|
closestBoundary,
|
|
@@ -1095,7 +1130,7 @@ var DropdownMenuContent = /* @__PURE__ */ forwardRef15((props, forwardedRef) =>
|
|
|
1095
1130
|
});
|
|
1096
1131
|
DropdownMenuContent.displayName = CONTENT_NAME;
|
|
1097
1132
|
var GROUP_NAME = "DropdownMenuGroup";
|
|
1098
|
-
var DropdownMenuGroup = /* @__PURE__ */
|
|
1133
|
+
var DropdownMenuGroup = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1099
1134
|
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
1100
1135
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1101
1136
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.Group, {
|
|
@@ -1106,7 +1141,7 @@ var DropdownMenuGroup = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
|
1106
1141
|
});
|
|
1107
1142
|
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
1108
1143
|
var LABEL_NAME = "DropdownMenuLabel";
|
|
1109
|
-
var DropdownMenuGroupLabel = /* @__PURE__ */
|
|
1144
|
+
var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1110
1145
|
const { __scopeDropdownMenu, classNames, ...labelProps } = props;
|
|
1111
1146
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1112
1147
|
const { tx } = useThemeContext();
|
|
@@ -1119,7 +1154,7 @@ var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef15((props, forwardedRef)
|
|
|
1119
1154
|
});
|
|
1120
1155
|
DropdownMenuGroupLabel.displayName = LABEL_NAME;
|
|
1121
1156
|
var ITEM_NAME = "DropdownMenuItem";
|
|
1122
|
-
var DropdownMenuItem = /* @__PURE__ */
|
|
1157
|
+
var DropdownMenuItem = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1123
1158
|
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
1124
1159
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1125
1160
|
const { tx } = useThemeContext();
|
|
@@ -1132,7 +1167,7 @@ var DropdownMenuItem = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
|
1132
1167
|
});
|
|
1133
1168
|
DropdownMenuItem.displayName = ITEM_NAME;
|
|
1134
1169
|
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
1135
|
-
var DropdownMenuCheckboxItem = /* @__PURE__ */
|
|
1170
|
+
var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1136
1171
|
const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
|
|
1137
1172
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1138
1173
|
const { tx } = useThemeContext();
|
|
@@ -1145,7 +1180,7 @@ var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef15((props, forwardedRef
|
|
|
1145
1180
|
});
|
|
1146
1181
|
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
1147
1182
|
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
1148
|
-
var DropdownMenuRadioGroup = /* @__PURE__ */
|
|
1183
|
+
var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1149
1184
|
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
1150
1185
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1151
1186
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.RadioGroup, {
|
|
@@ -1156,7 +1191,7 @@ var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef15((props, forwardedRef)
|
|
|
1156
1191
|
});
|
|
1157
1192
|
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
1158
1193
|
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
1159
|
-
var DropdownMenuRadioItem = /* @__PURE__ */
|
|
1194
|
+
var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1160
1195
|
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
1161
1196
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1162
1197
|
const { tx } = useThemeContext();
|
|
@@ -1169,7 +1204,7 @@ var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef15((props, forwardedRef) =
|
|
|
1169
1204
|
});
|
|
1170
1205
|
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
1171
1206
|
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
1172
|
-
var DropdownMenuItemIndicator = /* @__PURE__ */
|
|
1207
|
+
var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1173
1208
|
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
1174
1209
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1175
1210
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.ItemIndicator, {
|
|
@@ -1180,7 +1215,7 @@ var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef15((props, forwardedRe
|
|
|
1180
1215
|
});
|
|
1181
1216
|
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
1182
1217
|
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
1183
|
-
var DropdownMenuSeparator = /* @__PURE__ */
|
|
1218
|
+
var DropdownMenuSeparator = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1184
1219
|
const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
|
|
1185
1220
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1186
1221
|
const { tx } = useThemeContext();
|
|
@@ -1193,7 +1228,7 @@ var DropdownMenuSeparator = /* @__PURE__ */ forwardRef15((props, forwardedRef) =
|
|
|
1193
1228
|
});
|
|
1194
1229
|
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
1195
1230
|
var ARROW_NAME = "DropdownMenuArrow";
|
|
1196
|
-
var DropdownMenuArrow = /* @__PURE__ */
|
|
1231
|
+
var DropdownMenuArrow = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1197
1232
|
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
1198
1233
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1199
1234
|
const { tx } = useThemeContext();
|
|
@@ -1220,7 +1255,7 @@ var DropdownMenuSub = (props) => {
|
|
|
1220
1255
|
}, children);
|
|
1221
1256
|
};
|
|
1222
1257
|
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
1223
|
-
var DropdownMenuSubTrigger = /* @__PURE__ */
|
|
1258
|
+
var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1224
1259
|
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
1225
1260
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1226
1261
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.SubTrigger, {
|
|
@@ -1231,7 +1266,7 @@ var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef15((props, forwardedRef)
|
|
|
1231
1266
|
});
|
|
1232
1267
|
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
1233
1268
|
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
1234
|
-
var DropdownMenuSubContent = /* @__PURE__ */
|
|
1269
|
+
var DropdownMenuSubContent = /* @__PURE__ */ forwardRef10((props, forwardedRef) => {
|
|
1235
1270
|
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
1236
1271
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1237
1272
|
return /* @__PURE__ */ React16.createElement(MenuPrimitive.SubContent, {
|
|
@@ -1276,8 +1311,8 @@ var useDropdownMenuMenuScope = useMenuScope;
|
|
|
1276
1311
|
|
|
1277
1312
|
// src/components/Separator/Separator.tsx
|
|
1278
1313
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
1279
|
-
import React17, { forwardRef as
|
|
1280
|
-
var Separator3 = /* @__PURE__ */
|
|
1314
|
+
import React17, { forwardRef as forwardRef11 } from "react";
|
|
1315
|
+
var Separator3 = /* @__PURE__ */ forwardRef11(({ classNames, orientation = "horizontal", subdued, ...props }, forwardedRef) => {
|
|
1281
1316
|
const { tx } = useThemeContext();
|
|
1282
1317
|
return /* @__PURE__ */ React17.createElement(SeparatorPrimitive.Root, {
|
|
1283
1318
|
...props,
|
|
@@ -1291,11 +1326,14 @@ var Separator3 = /* @__PURE__ */ forwardRef16(({ classNames, orientation = "hori
|
|
|
1291
1326
|
});
|
|
1292
1327
|
|
|
1293
1328
|
// src/components/Toolbar/Toolbar.tsx
|
|
1294
|
-
var ToolbarRoot =
|
|
1295
|
-
const { className,
|
|
1329
|
+
var ToolbarRoot = composable2(({ children, density, disabled, layoutManaged, orientation, ...props }, forwardedRef) => {
|
|
1330
|
+
const { className, role, ...rest } = composableProps6(props);
|
|
1296
1331
|
const { tx } = useThemeContext();
|
|
1297
1332
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Root, {
|
|
1298
1333
|
...rest,
|
|
1334
|
+
...role !== "none" && {
|
|
1335
|
+
role
|
|
1336
|
+
},
|
|
1299
1337
|
orientation,
|
|
1300
1338
|
"data-arrow-keys": orientation === "vertical" ? "up down" : "left right",
|
|
1301
1339
|
className: tx("toolbar.root", {
|
|
@@ -1306,9 +1344,9 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef17(({ children, density, disabled, l
|
|
|
1306
1344
|
ref: forwardedRef
|
|
1307
1345
|
}, children);
|
|
1308
1346
|
});
|
|
1309
|
-
var ToolbarText =
|
|
1347
|
+
var ToolbarText = slottable5(({ children, asChild, ...props }, forwardedRef) => {
|
|
1310
1348
|
const { className, ...rest } = composableProps6(props);
|
|
1311
|
-
const Comp = asChild ?
|
|
1349
|
+
const Comp = asChild ? Slot11 : Primitive11.div;
|
|
1312
1350
|
const { tx } = useThemeContext();
|
|
1313
1351
|
return /* @__PURE__ */ React18.createElement(Comp, {
|
|
1314
1352
|
...rest,
|
|
@@ -1316,7 +1354,7 @@ var ToolbarText = /* @__PURE__ */ forwardRef17(({ children, asChild, ...props },
|
|
|
1316
1354
|
ref: forwardedRef
|
|
1317
1355
|
}, children);
|
|
1318
1356
|
});
|
|
1319
|
-
var ToolbarButton = /* @__PURE__ */
|
|
1357
|
+
var ToolbarButton = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1320
1358
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Button, {
|
|
1321
1359
|
asChild: true
|
|
1322
1360
|
}, /* @__PURE__ */ React18.createElement(Button, {
|
|
@@ -1324,7 +1362,7 @@ var ToolbarButton = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1324
1362
|
ref: forwardedRef
|
|
1325
1363
|
}));
|
|
1326
1364
|
});
|
|
1327
|
-
var ToolbarIconButton = /* @__PURE__ */
|
|
1365
|
+
var ToolbarIconButton = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1328
1366
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Button, {
|
|
1329
1367
|
asChild: true
|
|
1330
1368
|
}, /* @__PURE__ */ React18.createElement(IconButton, {
|
|
@@ -1333,7 +1371,7 @@ var ToolbarIconButton = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1333
1371
|
ref: forwardedRef
|
|
1334
1372
|
}));
|
|
1335
1373
|
});
|
|
1336
|
-
var ToolbarToggle = /* @__PURE__ */
|
|
1374
|
+
var ToolbarToggle = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1337
1375
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Button, {
|
|
1338
1376
|
asChild: true
|
|
1339
1377
|
}, /* @__PURE__ */ React18.createElement(Toggle, {
|
|
@@ -1341,7 +1379,7 @@ var ToolbarToggle = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1341
1379
|
ref: forwardedRef
|
|
1342
1380
|
}));
|
|
1343
1381
|
});
|
|
1344
|
-
var ToolbarLink = /* @__PURE__ */
|
|
1382
|
+
var ToolbarLink = /* @__PURE__ */ forwardRef12((props, forwardedRef) => {
|
|
1345
1383
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Link, {
|
|
1346
1384
|
asChild: true
|
|
1347
1385
|
}, /* @__PURE__ */ React18.createElement(Link, {
|
|
@@ -1349,7 +1387,7 @@ var ToolbarLink = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
|
1349
1387
|
ref: forwardedRef
|
|
1350
1388
|
}));
|
|
1351
1389
|
});
|
|
1352
|
-
var ToolbarToggleGroup2 = /* @__PURE__ */
|
|
1390
|
+
var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef12(({ classNames, children, elevation, ...props }, forwardedRef) => {
|
|
1353
1391
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.ToolbarToggleGroup, {
|
|
1354
1392
|
...props,
|
|
1355
1393
|
asChild: true
|
|
@@ -1360,7 +1398,7 @@ var ToolbarToggleGroup2 = /* @__PURE__ */ forwardRef17(({ classNames, children,
|
|
|
1360
1398
|
ref: forwardedRef
|
|
1361
1399
|
}));
|
|
1362
1400
|
});
|
|
1363
|
-
var ToolbarToggleGroupItem = /* @__PURE__ */
|
|
1401
|
+
var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef12(({ variant, density, elevation, classNames, children, ...props }, forwardedRef) => {
|
|
1364
1402
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
1365
1403
|
...props,
|
|
1366
1404
|
asChild: true
|
|
@@ -1373,7 +1411,7 @@ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef17(({ variant, density, e
|
|
|
1373
1411
|
ref: forwardedRef
|
|
1374
1412
|
}));
|
|
1375
1413
|
});
|
|
1376
|
-
var ToolbarToggleGroupIconItem = /* @__PURE__ */
|
|
1414
|
+
var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef12(({ variant, density, elevation, classNames, icon, label, iconOnly, iconClassNames, ...props }, forwardedRef) => {
|
|
1377
1415
|
return /* @__PURE__ */ React18.createElement(ToolbarPrimitive.ToolbarToggleItem, {
|
|
1378
1416
|
...props,
|
|
1379
1417
|
asChild: true
|
|
@@ -1385,13 +1423,15 @@ var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef17(({ variant, densit
|
|
|
1385
1423
|
icon,
|
|
1386
1424
|
label,
|
|
1387
1425
|
iconOnly,
|
|
1426
|
+
iconClassNames,
|
|
1388
1427
|
ref: forwardedRef
|
|
1389
1428
|
}));
|
|
1390
1429
|
});
|
|
1391
|
-
var ToolbarSeparator = /* @__PURE__ */
|
|
1430
|
+
var ToolbarSeparator = /* @__PURE__ */ forwardRef12(({ variant = "gap", ...props }, forwardedRef) => {
|
|
1392
1431
|
return variant === "line" ? /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Separator, {
|
|
1393
1432
|
asChild: true
|
|
1394
1433
|
}, /* @__PURE__ */ React18.createElement(Separator3, {
|
|
1434
|
+
orientation: "vertical",
|
|
1395
1435
|
...props,
|
|
1396
1436
|
ref: forwardedRef
|
|
1397
1437
|
})) : /* @__PURE__ */ React18.createElement(ToolbarPrimitive.Separator, {
|
|
@@ -1399,34 +1439,35 @@ var ToolbarSeparator = /* @__PURE__ */ forwardRef17(({ variant = "gap", ...props
|
|
|
1399
1439
|
ref: forwardedRef
|
|
1400
1440
|
});
|
|
1401
1441
|
});
|
|
1402
|
-
var ToolbarDragHandle = /* @__PURE__ */
|
|
1403
|
-
const { t } = useTranslation2(
|
|
1442
|
+
var ToolbarDragHandle = /* @__PURE__ */ forwardRef12(({ testId = "drag-handle", label }, forwardedRef) => {
|
|
1443
|
+
const { t } = useTranslation2(translationKey2);
|
|
1404
1444
|
return /* @__PURE__ */ React18.createElement(ToolbarIconButton, {
|
|
1405
1445
|
"data-testid": testId,
|
|
1446
|
+
tabIndex: -1,
|
|
1406
1447
|
noTooltip: true,
|
|
1407
1448
|
iconOnly: true,
|
|
1408
1449
|
icon: "ph--dots-six-vertical--regular",
|
|
1409
1450
|
variant: "ghost",
|
|
1410
|
-
label: label ?? t("toolbar
|
|
1411
|
-
classNames: "cursor-pointer",
|
|
1451
|
+
label: label ?? t("toolbar-drag-handle.label"),
|
|
1452
|
+
classNames: "dx-focus-ring-none cursor-pointer",
|
|
1412
1453
|
disabled: !forwardedRef,
|
|
1413
1454
|
ref: forwardedRef
|
|
1414
1455
|
});
|
|
1415
1456
|
});
|
|
1416
|
-
var ToolbarCloseIconButton = /* @__PURE__ */
|
|
1417
|
-
const { t } = useTranslation2(
|
|
1457
|
+
var ToolbarCloseIconButton = /* @__PURE__ */ forwardRef12(({ onClick, label }, forwardedRef) => {
|
|
1458
|
+
const { t } = useTranslation2(translationKey2);
|
|
1418
1459
|
return /* @__PURE__ */ React18.createElement(ToolbarIconButton, {
|
|
1419
1460
|
iconOnly: true,
|
|
1420
1461
|
icon: "ph--x--regular",
|
|
1421
1462
|
variant: "ghost",
|
|
1422
|
-
label: label ?? t("toolbar
|
|
1463
|
+
label: label ?? t("toolbar-close.label"),
|
|
1423
1464
|
classNames: "cursor-pointer",
|
|
1424
1465
|
onClick,
|
|
1425
1466
|
ref: forwardedRef
|
|
1426
1467
|
});
|
|
1427
1468
|
});
|
|
1428
1469
|
var ToolbarMenu = ({ context, items }) => {
|
|
1429
|
-
const { t } = useTranslation2(
|
|
1470
|
+
const { t } = useTranslation2(translationKey2);
|
|
1430
1471
|
return /* @__PURE__ */ React18.createElement(DropdownMenu.Root, null, /* @__PURE__ */ React18.createElement(DropdownMenu.Trigger, {
|
|
1431
1472
|
disabled: !items?.length,
|
|
1432
1473
|
asChild: true
|
|
@@ -1434,13 +1475,13 @@ var ToolbarMenu = ({ context, items }) => {
|
|
|
1434
1475
|
iconOnly: true,
|
|
1435
1476
|
variant: "ghost",
|
|
1436
1477
|
icon: "ph--dots-three-vertical--regular",
|
|
1437
|
-
label: t("toolbar
|
|
1478
|
+
label: t("toolbar-menu.label")
|
|
1438
1479
|
})), (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, {
|
|
1439
1480
|
key: index,
|
|
1440
1481
|
onSelect: () => onSelect(context)
|
|
1441
1482
|
}, label))), /* @__PURE__ */ React18.createElement(DropdownMenu.Arrow, null))));
|
|
1442
1483
|
};
|
|
1443
|
-
var
|
|
1484
|
+
var Toolbar = {
|
|
1444
1485
|
Root: ToolbarRoot,
|
|
1445
1486
|
Text: ToolbarText,
|
|
1446
1487
|
Button: ToolbarButton,
|
|
@@ -1458,30 +1499,33 @@ var Toolbar2 = {
|
|
|
1458
1499
|
|
|
1459
1500
|
// src/components/Card/Card.tsx
|
|
1460
1501
|
var CardContext = /* @__PURE__ */ createContext3({});
|
|
1461
|
-
var
|
|
1502
|
+
var CARD_ROOT_NAME = "Card.Root";
|
|
1503
|
+
var CardRoot = composable3(({ children, id, role, border = true, fullWidth, density, ...props }, forwardedRef) => {
|
|
1462
1504
|
const { className, ...rest } = composableProps7(props);
|
|
1463
|
-
const Comp = asChild ? Slot11 : Primitive11.div;
|
|
1464
1505
|
const { tx } = useThemeContext();
|
|
1465
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1506
|
+
return /* @__PURE__ */ React19.createElement(Column.Root, {
|
|
1507
|
+
asChild: true,
|
|
1508
|
+
gutter: density === "coarse" ? "lg" : "md",
|
|
1509
|
+
classNames: tx("card.root", {
|
|
1510
|
+
border,
|
|
1511
|
+
fullWidth
|
|
1512
|
+
}, className),
|
|
1513
|
+
role: role ?? "group"
|
|
1514
|
+
}, /* @__PURE__ */ React19.createElement("div", {
|
|
1466
1515
|
...rest,
|
|
1467
1516
|
...id && {
|
|
1468
1517
|
"data-object-id": id
|
|
1469
1518
|
},
|
|
1470
|
-
role: role ?? "group",
|
|
1471
|
-
className: tx("card.root", {
|
|
1472
|
-
border,
|
|
1473
|
-
fullWidth
|
|
1474
|
-
}, className),
|
|
1475
1519
|
ref: forwardedRef
|
|
1476
|
-
}, /* @__PURE__ */ React19.createElement(Column.Root, {
|
|
1477
|
-
gutter: density === "coarse" ? "lg" : "md"
|
|
1478
1520
|
}, children));
|
|
1479
1521
|
});
|
|
1480
|
-
|
|
1522
|
+
CardRoot.displayName = CARD_ROOT_NAME;
|
|
1523
|
+
var CARD_TOOLBAR_NAME = "Card.Toolbar";
|
|
1524
|
+
var CardToolbar = composable3(({ children, classNames, ...props }, forwardedRef) => {
|
|
1481
1525
|
const { tx } = useThemeContext();
|
|
1482
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1526
|
+
return /* @__PURE__ */ React19.createElement(Toolbar.Root, {
|
|
1483
1527
|
...props,
|
|
1484
|
-
style:
|
|
1528
|
+
style: iconSize(5),
|
|
1485
1529
|
classNames: [
|
|
1486
1530
|
tx("card.toolbar", {}),
|
|
1487
1531
|
classNames
|
|
@@ -1489,78 +1533,106 @@ var CardToolbar = /* @__PURE__ */ forwardRef18(({ children, classNames, ...props
|
|
|
1489
1533
|
ref: forwardedRef
|
|
1490
1534
|
}, children);
|
|
1491
1535
|
});
|
|
1492
|
-
|
|
1493
|
-
|
|
1536
|
+
CardToolbar.displayName = CARD_TOOLBAR_NAME;
|
|
1537
|
+
var CARD_DRAG_HANDLE_NAME = "Card.DragHandle";
|
|
1538
|
+
var CardDragHandle = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
|
|
1539
|
+
return /* @__PURE__ */ React19.createElement(CardIconBlock, {
|
|
1540
|
+
padding: true
|
|
1541
|
+
}, /* @__PURE__ */ React19.createElement(Toolbar.DragHandle, {
|
|
1494
1542
|
...props,
|
|
1495
|
-
testId: "card-drag-handle",
|
|
1496
1543
|
ref: forwardedRef
|
|
1497
1544
|
}));
|
|
1498
1545
|
});
|
|
1499
|
-
|
|
1500
|
-
|
|
1546
|
+
CardDragHandle.displayName = CARD_DRAG_HANDLE_NAME;
|
|
1547
|
+
var CARD_CLOSE_ICON_BUTTON_NAME = "Card.CloseIconButton";
|
|
1548
|
+
var CloseIconButton = /* @__PURE__ */ forwardRef13((props, forwardedRef) => {
|
|
1549
|
+
return /* @__PURE__ */ React19.createElement(CardIconBlock, {
|
|
1550
|
+
padding: true
|
|
1551
|
+
}, /* @__PURE__ */ React19.createElement(Toolbar.CloseIconButton, {
|
|
1501
1552
|
...props,
|
|
1502
1553
|
ref: forwardedRef
|
|
1503
1554
|
}));
|
|
1504
1555
|
});
|
|
1556
|
+
CloseIconButton.displayName = CARD_CLOSE_ICON_BUTTON_NAME;
|
|
1557
|
+
var CARD_MENU_NAME = "Card.Menu";
|
|
1505
1558
|
var CardMenu = ({ context, items, ...props }) => {
|
|
1506
1559
|
const { menuItems } = useContext3(CardContext) ?? {};
|
|
1507
1560
|
const combinedItems = [
|
|
1508
1561
|
...items ?? [],
|
|
1509
1562
|
...menuItems ?? []
|
|
1510
1563
|
];
|
|
1511
|
-
return /* @__PURE__ */ React19.createElement(CardIconBlock,
|
|
1564
|
+
return /* @__PURE__ */ React19.createElement(CardIconBlock, {
|
|
1565
|
+
padding: true
|
|
1566
|
+
}, /* @__PURE__ */ React19.createElement(Toolbar.Menu, {
|
|
1512
1567
|
...props,
|
|
1513
1568
|
context,
|
|
1514
1569
|
items: combinedItems
|
|
1515
1570
|
}));
|
|
1516
1571
|
};
|
|
1572
|
+
CardMenu.displayName = CARD_MENU_NAME;
|
|
1573
|
+
var CARD_ICON_NAME = "Card.Icon";
|
|
1517
1574
|
var CardIcon = (props) => {
|
|
1518
1575
|
return /* @__PURE__ */ React19.createElement(CardIconBlock, null, /* @__PURE__ */ React19.createElement(Icon, props));
|
|
1519
1576
|
};
|
|
1520
|
-
|
|
1577
|
+
CardIcon.displayName = CARD_ICON_NAME;
|
|
1578
|
+
var CARD_ICON_BLOCK_NAME = "Card.IconBlock";
|
|
1579
|
+
var CardIconBlock = /* @__PURE__ */ forwardRef13(({ classNames, children, padding, ...props }, forwardedRef) => {
|
|
1521
1580
|
const { tx } = useThemeContext();
|
|
1522
1581
|
return /* @__PURE__ */ React19.createElement("div", {
|
|
1523
1582
|
...props,
|
|
1524
|
-
|
|
1525
|
-
|
|
1583
|
+
className: tx("card.icon-block", {
|
|
1584
|
+
padding
|
|
1585
|
+
}, classNames),
|
|
1526
1586
|
ref: forwardedRef
|
|
1527
1587
|
}, children);
|
|
1528
1588
|
});
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1589
|
+
CardIconBlock.displayName = CARD_ICON_BLOCK_NAME;
|
|
1590
|
+
var CARD_TITLE_NAME = "Card.Title";
|
|
1591
|
+
var CardTitle = slottable6(({ children, asChild, ...props }, forwardedRef) => {
|
|
1532
1592
|
const { tx } = useThemeContext();
|
|
1593
|
+
const { className, ...rest } = composableProps7(props, {
|
|
1594
|
+
role: "heading"
|
|
1595
|
+
});
|
|
1596
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1533
1597
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1534
1598
|
...rest,
|
|
1535
|
-
role: role ?? "heading",
|
|
1536
1599
|
className: tx("card.title", {}, className),
|
|
1537
1600
|
ref: forwardedRef
|
|
1538
1601
|
}, children);
|
|
1539
1602
|
});
|
|
1540
|
-
|
|
1603
|
+
CardTitle.displayName = CARD_TITLE_NAME;
|
|
1604
|
+
var CARD_CONTENT_NAME = "Card.Content";
|
|
1605
|
+
var CardContent = slottable6(({ children, asChild, ...props }, forwardedRef) => {
|
|
1606
|
+
const { className, ...rest } = composableProps7(props);
|
|
1607
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1541
1608
|
const { tx } = useThemeContext();
|
|
1542
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1543
|
-
...
|
|
1544
|
-
|
|
1545
|
-
className: tx("card.content", {}),
|
|
1609
|
+
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1610
|
+
...rest,
|
|
1611
|
+
className: tx("card.content", {}, className),
|
|
1546
1612
|
ref: forwardedRef
|
|
1547
1613
|
}, children);
|
|
1548
1614
|
});
|
|
1549
|
-
|
|
1615
|
+
CardContent.displayName = CARD_CONTENT_NAME;
|
|
1616
|
+
var CARD_ROW_NAME = "Card.Row";
|
|
1617
|
+
var CardRow = slottable6(({ children, asChild, icon, ...props }, forwardedRef) => {
|
|
1550
1618
|
const { className, ...rest } = composableProps7(props);
|
|
1551
|
-
|
|
1619
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1620
|
+
const { tx } = useThemeContext();
|
|
1621
|
+
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1552
1622
|
...rest,
|
|
1553
|
-
|
|
1554
|
-
classNames: className,
|
|
1623
|
+
className: tx("card.row", {}, className),
|
|
1555
1624
|
ref: forwardedRef
|
|
1556
1625
|
}, icon && /* @__PURE__ */ React19.createElement(CardIcon, {
|
|
1557
1626
|
classNames: "text-subdued",
|
|
1558
|
-
icon
|
|
1559
|
-
|
|
1627
|
+
icon,
|
|
1628
|
+
size: 4
|
|
1629
|
+
}) || /* @__PURE__ */ React19.createElement("div", null), children);
|
|
1560
1630
|
});
|
|
1561
|
-
|
|
1631
|
+
CardRow.displayName = CARD_ROW_NAME;
|
|
1632
|
+
var CARD_SECTION_NAME = "Card.Section";
|
|
1633
|
+
var CardSection = slottable6(({ children, asChild, role, ...props }, forwardedRef) => {
|
|
1562
1634
|
const { className, ...rest } = composableProps7(props);
|
|
1563
|
-
const Comp = asChild ?
|
|
1635
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1564
1636
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1565
1637
|
...rest,
|
|
1566
1638
|
role: role ?? "none",
|
|
@@ -1568,9 +1640,11 @@ var CardSection = /* @__PURE__ */ forwardRef18(({ children, asChild, role, ...pr
|
|
|
1568
1640
|
ref: forwardedRef
|
|
1569
1641
|
}, children);
|
|
1570
1642
|
});
|
|
1571
|
-
|
|
1643
|
+
CardSection.displayName = CARD_SECTION_NAME;
|
|
1644
|
+
var CARD_HEADING_NAME = "Card.Heading";
|
|
1645
|
+
var CardHeading = slottable6(({ children, asChild, role, variant = "default", ...props }, forwardedRef) => {
|
|
1572
1646
|
const { className, ...rest } = composableProps7(props);
|
|
1573
|
-
const Comp = asChild ?
|
|
1647
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1574
1648
|
const { tx } = useThemeContext();
|
|
1575
1649
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1576
1650
|
...rest,
|
|
@@ -1581,9 +1655,11 @@ var CardHeading = /* @__PURE__ */ forwardRef18(({ children, asChild, role, varia
|
|
|
1581
1655
|
ref: forwardedRef
|
|
1582
1656
|
}, children);
|
|
1583
1657
|
});
|
|
1584
|
-
|
|
1658
|
+
CardHeading.displayName = CARD_HEADING_NAME;
|
|
1659
|
+
var CARD_TEXT_NAME = "Card.Text";
|
|
1660
|
+
var CardText = slottable6(({ children, asChild, role, truncate, variant = "default", ...props }, forwardedRef) => {
|
|
1585
1661
|
const { className, ...rest } = composableProps7(props);
|
|
1586
|
-
const Comp = asChild ?
|
|
1662
|
+
const Comp = asChild ? Slot12 : Primitive12.div;
|
|
1587
1663
|
const { tx } = useThemeContext();
|
|
1588
1664
|
return /* @__PURE__ */ React19.createElement(Comp, {
|
|
1589
1665
|
...rest,
|
|
@@ -1599,13 +1675,32 @@ var CardText = /* @__PURE__ */ forwardRef18(({ children, asChild, role, truncate
|
|
|
1599
1675
|
})
|
|
1600
1676
|
}, children));
|
|
1601
1677
|
});
|
|
1678
|
+
CardText.displayName = CARD_TEXT_NAME;
|
|
1679
|
+
var CARD_HTML_NAME = "Card.Html";
|
|
1680
|
+
var CardHtml = ({ html, variant = "default", ...props }) => {
|
|
1681
|
+
const { tx } = useThemeContext();
|
|
1682
|
+
const sanitized = useMemo5(() => DOMPurify.sanitize(html), [
|
|
1683
|
+
html
|
|
1684
|
+
]);
|
|
1685
|
+
return /* @__PURE__ */ React19.createElement("div", {
|
|
1686
|
+
...props,
|
|
1687
|
+
className: tx("card.text", {
|
|
1688
|
+
variant
|
|
1689
|
+
}),
|
|
1690
|
+
// eslint-disable-next-line react/no-danger
|
|
1691
|
+
dangerouslySetInnerHTML: {
|
|
1692
|
+
__html: sanitized
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
};
|
|
1696
|
+
CardHtml.displayName = CARD_HTML_NAME;
|
|
1697
|
+
var CARD_POSTER_NAME = "Card.Poster";
|
|
1602
1698
|
var CardPoster = (props) => {
|
|
1603
1699
|
const { tx } = useThemeContext();
|
|
1604
1700
|
const aspect = props.aspect === "auto" ? "aspect-auto" : "aspect-video";
|
|
1605
1701
|
if (props.image) {
|
|
1606
1702
|
return /* @__PURE__ */ React19.createElement("div", {
|
|
1607
|
-
|
|
1608
|
-
className: "col-span-full mb-1"
|
|
1703
|
+
className: "col-span-full"
|
|
1609
1704
|
}, /* @__PURE__ */ React19.createElement(Image, {
|
|
1610
1705
|
classNames: [
|
|
1611
1706
|
tx("card.poster", {}),
|
|
@@ -1613,7 +1708,8 @@ var CardPoster = (props) => {
|
|
|
1613
1708
|
props.classNames
|
|
1614
1709
|
],
|
|
1615
1710
|
src: props.image,
|
|
1616
|
-
alt: props.alt
|
|
1711
|
+
alt: props.alt,
|
|
1712
|
+
fit: props.fit
|
|
1617
1713
|
}));
|
|
1618
1714
|
}
|
|
1619
1715
|
if (props.icon) {
|
|
@@ -1630,6 +1726,8 @@ var CardPoster = (props) => {
|
|
|
1630
1726
|
}));
|
|
1631
1727
|
}
|
|
1632
1728
|
};
|
|
1729
|
+
CardPoster.displayName = CARD_POSTER_NAME;
|
|
1730
|
+
var CARD_ACTION_NAME = "Card.Action";
|
|
1633
1731
|
var CardAction = ({ icon, actionIcon = "ph--arrow-right--regular", label, onClick }) => {
|
|
1634
1732
|
const { tx } = useThemeContext();
|
|
1635
1733
|
return /* @__PURE__ */ React19.createElement(Button, {
|
|
@@ -1638,13 +1736,17 @@ var CardAction = ({ icon, actionIcon = "ph--arrow-right--regular", label, onClic
|
|
|
1638
1736
|
onClick
|
|
1639
1737
|
}, icon ? /* @__PURE__ */ React19.createElement(CardIcon, {
|
|
1640
1738
|
classNames: "text-subdued",
|
|
1641
|
-
icon
|
|
1739
|
+
icon,
|
|
1740
|
+
size: 4
|
|
1642
1741
|
}) : /* @__PURE__ */ React19.createElement("div", null), /* @__PURE__ */ React19.createElement("span", {
|
|
1643
1742
|
className: tx("card.action-label", {}, !actionIcon ? "col-span-2" : void 0)
|
|
1644
1743
|
}, label), actionIcon && /* @__PURE__ */ React19.createElement(CardIcon, {
|
|
1645
|
-
icon: actionIcon
|
|
1744
|
+
icon: actionIcon,
|
|
1745
|
+
size: 4
|
|
1646
1746
|
}));
|
|
1647
1747
|
};
|
|
1748
|
+
CardAction.displayName = CARD_ACTION_NAME;
|
|
1749
|
+
var CARD_LINK_NAME = "Card.Link";
|
|
1648
1750
|
var CardLink = ({ label, href }) => {
|
|
1649
1751
|
const { tx } = useThemeContext();
|
|
1650
1752
|
return /* @__PURE__ */ React19.createElement("a", {
|
|
@@ -1663,12 +1765,13 @@ var CardLink = ({ label, href }) => {
|
|
|
1663
1765
|
icon: "ph--arrow-square-out--regular"
|
|
1664
1766
|
}));
|
|
1665
1767
|
};
|
|
1768
|
+
CardLink.displayName = CARD_LINK_NAME;
|
|
1666
1769
|
var Card = {
|
|
1667
1770
|
Root: CardRoot,
|
|
1668
1771
|
// Toolbar
|
|
1669
1772
|
Toolbar: CardToolbar,
|
|
1670
|
-
ToolbarIconButton:
|
|
1671
|
-
ToolbarSeparator:
|
|
1773
|
+
ToolbarIconButton: Toolbar.IconButton,
|
|
1774
|
+
ToolbarSeparator: Toolbar.Separator,
|
|
1672
1775
|
// Toolbar blocks
|
|
1673
1776
|
IconBlock: CardIconBlock,
|
|
1674
1777
|
DragHandle: CardDragHandle,
|
|
@@ -1682,26 +1785,335 @@ var Card = {
|
|
|
1682
1785
|
Section: CardSection,
|
|
1683
1786
|
Heading: CardHeading,
|
|
1684
1787
|
Text: CardText,
|
|
1788
|
+
Html: CardHtml,
|
|
1685
1789
|
Poster: CardPoster,
|
|
1686
1790
|
Action: CardAction,
|
|
1687
1791
|
Link: CardLink
|
|
1688
1792
|
};
|
|
1689
1793
|
|
|
1794
|
+
// src/components/Carousel/Carousel.tsx
|
|
1795
|
+
import { useArrowNavigationGroup } from "@fluentui/react-tabster";
|
|
1796
|
+
import React21, { createContext as createContext4, useCallback as useCallback5, useContext as useContext4, useEffect as useEffect3, useMemo as useMemo6, useState as useState4 } from "react";
|
|
1797
|
+
import { mx as mx8 } from "@dxos/ui-theme";
|
|
1798
|
+
|
|
1799
|
+
// src/components/MediaPlayer/MediaPlayer.tsx
|
|
1800
|
+
import React20 from "react";
|
|
1801
|
+
import { mx as mx7 } from "@dxos/ui-theme";
|
|
1802
|
+
var VIDEO_EXTENSIONS = [
|
|
1803
|
+
".mp4",
|
|
1804
|
+
".webm",
|
|
1805
|
+
".ogv",
|
|
1806
|
+
".mov",
|
|
1807
|
+
".m4v"
|
|
1808
|
+
];
|
|
1809
|
+
var AUDIO_EXTENSIONS = [
|
|
1810
|
+
".mp3",
|
|
1811
|
+
".wav",
|
|
1812
|
+
".ogg",
|
|
1813
|
+
".m4a",
|
|
1814
|
+
".aac",
|
|
1815
|
+
".flac"
|
|
1816
|
+
];
|
|
1817
|
+
var DEFAULT_IFRAME_SANDBOX = "allow-scripts allow-same-origin allow-presentation";
|
|
1818
|
+
var detectMediaKind = (src) => {
|
|
1819
|
+
const pathname = src.split(/[?#]/, 1)[0];
|
|
1820
|
+
const lower = pathname.toLowerCase();
|
|
1821
|
+
if (VIDEO_EXTENSIONS.some((extension) => lower.endsWith(extension))) {
|
|
1822
|
+
return "video";
|
|
1823
|
+
}
|
|
1824
|
+
if (AUDIO_EXTENSIONS.some((extension) => lower.endsWith(extension))) {
|
|
1825
|
+
return "audio";
|
|
1826
|
+
}
|
|
1827
|
+
return void 0;
|
|
1828
|
+
};
|
|
1829
|
+
var isEmbedUrl = (src) => detectMediaKind(src) !== void 0;
|
|
1830
|
+
var LEGACY_IFRAME_PATH_PATTERN = /\/iframe(?:[/?#]|$)/i;
|
|
1831
|
+
var isLegacyIframeUrl = (src) => {
|
|
1832
|
+
const pathAndQuery = src.split("#", 1)[0];
|
|
1833
|
+
return LEGACY_IFRAME_PATH_PATTERN.test(pathAndQuery);
|
|
1834
|
+
};
|
|
1835
|
+
var MediaPlayer = ({ classNames, src, kind, controls = true, autoPlay = false, loop = false, muted = false, alt, crossOrigin = "anonymous", imgClassNames, mediaClassNames }) => {
|
|
1836
|
+
if (isEmbedUrl(src)) {
|
|
1837
|
+
const resolved = kind ?? detectMediaKind(src) ?? "video";
|
|
1838
|
+
if (resolved === "audio") {
|
|
1839
|
+
return /* @__PURE__ */ React20.createElement("audio", {
|
|
1840
|
+
className: mx7("w-full", classNames, mediaClassNames),
|
|
1841
|
+
src,
|
|
1842
|
+
controls,
|
|
1843
|
+
autoPlay,
|
|
1844
|
+
loop,
|
|
1845
|
+
muted,
|
|
1846
|
+
crossOrigin,
|
|
1847
|
+
"aria-label": alt
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
return /* @__PURE__ */ React20.createElement("video", {
|
|
1851
|
+
className: mx7("aspect-video max-w-full max-h-full", classNames, mediaClassNames),
|
|
1852
|
+
src,
|
|
1853
|
+
controls,
|
|
1854
|
+
autoPlay,
|
|
1855
|
+
loop,
|
|
1856
|
+
muted,
|
|
1857
|
+
crossOrigin,
|
|
1858
|
+
"aria-label": alt
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
if (isLegacyIframeUrl(src)) {
|
|
1862
|
+
return /* @__PURE__ */ React20.createElement("iframe", {
|
|
1863
|
+
src,
|
|
1864
|
+
title: alt ?? "Embedded media",
|
|
1865
|
+
loading: "lazy",
|
|
1866
|
+
className: mx7("border-none", classNames, mediaClassNames),
|
|
1867
|
+
sandbox: DEFAULT_IFRAME_SANDBOX,
|
|
1868
|
+
referrerPolicy: "no-referrer",
|
|
1869
|
+
allow: "accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;",
|
|
1870
|
+
allowFullScreen: true
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
return /* @__PURE__ */ React20.createElement("img", {
|
|
1874
|
+
src,
|
|
1875
|
+
alt: alt ?? "",
|
|
1876
|
+
loading: "lazy",
|
|
1877
|
+
className: mx7(classNames, imgClassNames),
|
|
1878
|
+
onError: (event) => {
|
|
1879
|
+
event.currentTarget.style.display = "none";
|
|
1880
|
+
}
|
|
1881
|
+
});
|
|
1882
|
+
};
|
|
1883
|
+
|
|
1884
|
+
// src/components/Carousel/Carousel.tsx
|
|
1885
|
+
var CarouselContext = /* @__PURE__ */ createContext4(null);
|
|
1886
|
+
var useCarousel = () => {
|
|
1887
|
+
const context = useContext4(CarouselContext);
|
|
1888
|
+
if (!context) {
|
|
1889
|
+
throw new Error("useCarousel must be used within Carousel.Root");
|
|
1890
|
+
}
|
|
1891
|
+
return context;
|
|
1892
|
+
};
|
|
1893
|
+
var CarouselRoot = ({ classNames, children, count, autorun = false, intervalMs = 5e3, defaultIndex = 0 }) => {
|
|
1894
|
+
const [index, setIndexState] = useState4(defaultIndex);
|
|
1895
|
+
const [autoAdvance, setAutoAdvance] = useState4(autorun);
|
|
1896
|
+
useEffect3(() => {
|
|
1897
|
+
if (index >= count) {
|
|
1898
|
+
setIndexState(0);
|
|
1899
|
+
}
|
|
1900
|
+
}, [
|
|
1901
|
+
count,
|
|
1902
|
+
index
|
|
1903
|
+
]);
|
|
1904
|
+
useEffect3(() => {
|
|
1905
|
+
if (!autoAdvance || count <= 1 || intervalMs <= 0) {
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
const handle = setInterval(() => setIndexState((i) => (i + 1) % count), intervalMs);
|
|
1909
|
+
return () => clearInterval(handle);
|
|
1910
|
+
}, [
|
|
1911
|
+
autoAdvance,
|
|
1912
|
+
count,
|
|
1913
|
+
intervalMs
|
|
1914
|
+
]);
|
|
1915
|
+
const setIndex = useCallback5((next2) => {
|
|
1916
|
+
setAutoAdvance(false);
|
|
1917
|
+
setIndexState(next2);
|
|
1918
|
+
}, []);
|
|
1919
|
+
const next = useCallback5(() => {
|
|
1920
|
+
setAutoAdvance(false);
|
|
1921
|
+
setIndexState((i) => (i + 1) % count);
|
|
1922
|
+
}, [
|
|
1923
|
+
count
|
|
1924
|
+
]);
|
|
1925
|
+
const prev = useCallback5(() => {
|
|
1926
|
+
setAutoAdvance(false);
|
|
1927
|
+
setIndexState((i) => (i - 1 + count) % count);
|
|
1928
|
+
}, [
|
|
1929
|
+
count
|
|
1930
|
+
]);
|
|
1931
|
+
const value = useMemo6(() => ({
|
|
1932
|
+
index,
|
|
1933
|
+
count,
|
|
1934
|
+
setIndex,
|
|
1935
|
+
next,
|
|
1936
|
+
prev
|
|
1937
|
+
}), [
|
|
1938
|
+
index,
|
|
1939
|
+
count,
|
|
1940
|
+
setIndex,
|
|
1941
|
+
next,
|
|
1942
|
+
prev
|
|
1943
|
+
]);
|
|
1944
|
+
if (count === 0) {
|
|
1945
|
+
return null;
|
|
1946
|
+
}
|
|
1947
|
+
return /* @__PURE__ */ React21.createElement(CarouselContext.Provider, {
|
|
1948
|
+
value
|
|
1949
|
+
}, /* @__PURE__ */ React21.createElement("div", {
|
|
1950
|
+
className: mx8("w-full grid grid-cols-[min-content_1fr_min-content] grid-rows-[minmax(0,1fr)_auto] gap-4 items-center", classNames)
|
|
1951
|
+
}, children));
|
|
1952
|
+
};
|
|
1953
|
+
CarouselRoot.displayName = "Carousel.Root";
|
|
1954
|
+
var CarouselViewport = ({ children, classNames }) => {
|
|
1955
|
+
const { t } = useTranslation(translationKey);
|
|
1956
|
+
const { count, next, prev } = useCarousel();
|
|
1957
|
+
const handleKeyDown = useCallback5((event) => {
|
|
1958
|
+
if (count <= 1) {
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
if (event.key === "ArrowLeft") {
|
|
1962
|
+
event.preventDefault();
|
|
1963
|
+
prev();
|
|
1964
|
+
} else if (event.key === "ArrowRight") {
|
|
1965
|
+
event.preventDefault();
|
|
1966
|
+
next();
|
|
1967
|
+
}
|
|
1968
|
+
}, [
|
|
1969
|
+
count,
|
|
1970
|
+
next,
|
|
1971
|
+
prev
|
|
1972
|
+
]);
|
|
1973
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
1974
|
+
// TODO(burdon): Move to ui-theme.
|
|
1975
|
+
className: mx8("relative w-full aspect-video overflow-hidden", "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500", classNames),
|
|
1976
|
+
tabIndex: 0,
|
|
1977
|
+
role: "region",
|
|
1978
|
+
"aria-roledescription": "carousel",
|
|
1979
|
+
"aria-label": t("carousel-viewport.label"),
|
|
1980
|
+
onKeyDown: handleKeyDown
|
|
1981
|
+
}, children);
|
|
1982
|
+
};
|
|
1983
|
+
CarouselViewport.displayName = "Carousel.Viewport";
|
|
1984
|
+
var CarouselSlide = ({ index, classNames, src, kind, alt, imgClassNames, mediaClassNames, controls, autoPlay, loop, muted, crossOrigin }) => {
|
|
1985
|
+
const { index: active } = useCarousel();
|
|
1986
|
+
if (active !== index) {
|
|
1987
|
+
return null;
|
|
1988
|
+
}
|
|
1989
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
1990
|
+
className: mx8("absolute inset-0 w-full h-full bg-baseSurface", classNames)
|
|
1991
|
+
}, /* @__PURE__ */ React21.createElement(MediaPlayer, {
|
|
1992
|
+
src,
|
|
1993
|
+
kind,
|
|
1994
|
+
alt,
|
|
1995
|
+
classNames: "w-full h-full",
|
|
1996
|
+
imgClassNames: mx8("object-cover", imgClassNames),
|
|
1997
|
+
mediaClassNames,
|
|
1998
|
+
controls,
|
|
1999
|
+
autoPlay,
|
|
2000
|
+
loop,
|
|
2001
|
+
muted,
|
|
2002
|
+
crossOrigin
|
|
2003
|
+
}));
|
|
2004
|
+
};
|
|
2005
|
+
CarouselSlide.displayName = "Carousel.Slide";
|
|
2006
|
+
var CarouselPrevious = ({ classNames }) => {
|
|
2007
|
+
const { t } = useTranslation(translationKey);
|
|
2008
|
+
const { count, prev } = useCarousel();
|
|
2009
|
+
if (count <= 1) {
|
|
2010
|
+
return /* @__PURE__ */ React21.createElement("div", null);
|
|
2011
|
+
}
|
|
2012
|
+
return /* @__PURE__ */ React21.createElement(IconButton, {
|
|
2013
|
+
classNames: mx8("self-center", classNames),
|
|
2014
|
+
square: true,
|
|
2015
|
+
variant: "ghost",
|
|
2016
|
+
icon: "ph--caret-left--regular",
|
|
2017
|
+
iconOnly: true,
|
|
2018
|
+
label: t("carousel-prev.label"),
|
|
2019
|
+
onClick: prev
|
|
2020
|
+
});
|
|
2021
|
+
};
|
|
2022
|
+
CarouselPrevious.displayName = "Carousel.Previous";
|
|
2023
|
+
var CarouselNext = ({ classNames }) => {
|
|
2024
|
+
const { t } = useTranslation(translationKey);
|
|
2025
|
+
const { count, next } = useCarousel();
|
|
2026
|
+
if (count <= 1) {
|
|
2027
|
+
return /* @__PURE__ */ React21.createElement("div", null);
|
|
2028
|
+
}
|
|
2029
|
+
return /* @__PURE__ */ React21.createElement(IconButton, {
|
|
2030
|
+
classNames: mx8("self-center", classNames),
|
|
2031
|
+
square: true,
|
|
2032
|
+
variant: "ghost",
|
|
2033
|
+
icon: "ph--caret-right--regular",
|
|
2034
|
+
iconOnly: true,
|
|
2035
|
+
label: t("carousel-next.label"),
|
|
2036
|
+
onClick: next
|
|
2037
|
+
});
|
|
2038
|
+
};
|
|
2039
|
+
CarouselNext.displayName = "Carousel.Next";
|
|
2040
|
+
var CarouselIndicators = ({ classNames }) => {
|
|
2041
|
+
const { t } = useTranslation(translationKey);
|
|
2042
|
+
const { count, index, setIndex } = useCarousel();
|
|
2043
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
2044
|
+
axis: "horizontal",
|
|
2045
|
+
memorizeCurrent: true
|
|
2046
|
+
});
|
|
2047
|
+
if (count <= 1) {
|
|
2048
|
+
return null;
|
|
2049
|
+
}
|
|
2050
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
2051
|
+
className: "col-start-2 overflow-hidden"
|
|
2052
|
+
}, /* @__PURE__ */ React21.createElement("div", {
|
|
2053
|
+
...arrowNavigationAttrs,
|
|
2054
|
+
className: mx8("flex items-center justify-center", classNames),
|
|
2055
|
+
role: "tablist",
|
|
2056
|
+
"aria-label": t("carousel-indicators.label")
|
|
2057
|
+
}, Array.from({
|
|
2058
|
+
length: count
|
|
2059
|
+
}).map((_, i) => /* @__PURE__ */ React21.createElement(IconButton, {
|
|
2060
|
+
key: i,
|
|
2061
|
+
role: "tab",
|
|
2062
|
+
"aria-selected": i === index,
|
|
2063
|
+
classNames: i === index ? "text-primary-500" : "text-description",
|
|
2064
|
+
icon: i === index ? "ph--circle--fill" : "ph--circle--regular",
|
|
2065
|
+
iconOnly: true,
|
|
2066
|
+
label: t("carousel-go-to.label", {
|
|
2067
|
+
index: i + 1
|
|
2068
|
+
}),
|
|
2069
|
+
onClick: () => setIndex(i),
|
|
2070
|
+
onFocus: () => setIndex(i),
|
|
2071
|
+
size: 3,
|
|
2072
|
+
variant: "ghost"
|
|
2073
|
+
}))));
|
|
2074
|
+
};
|
|
2075
|
+
CarouselIndicators.displayName = "Carousel.Indicators";
|
|
2076
|
+
var CarouselCaption = ({ children, classNames }) => {
|
|
2077
|
+
const { index } = useCarousel();
|
|
2078
|
+
const content = children(index);
|
|
2079
|
+
if (content == null || content === false || content === "") {
|
|
2080
|
+
return null;
|
|
2081
|
+
}
|
|
2082
|
+
return (
|
|
2083
|
+
// TODO(burdon): Move to ui-theme.
|
|
2084
|
+
/* @__PURE__ */ React21.createElement("div", {
|
|
2085
|
+
className: "col-start-2"
|
|
2086
|
+
}, /* @__PURE__ */ React21.createElement("p", {
|
|
2087
|
+
className: mx8("text-center text-description", classNames)
|
|
2088
|
+
}, content))
|
|
2089
|
+
);
|
|
2090
|
+
};
|
|
2091
|
+
CarouselCaption.displayName = "Carousel.Caption";
|
|
2092
|
+
var Carousel = {
|
|
2093
|
+
Root: CarouselRoot,
|
|
2094
|
+
Viewport: CarouselViewport,
|
|
2095
|
+
Slide: CarouselSlide,
|
|
2096
|
+
Previous: CarouselPrevious,
|
|
2097
|
+
Next: CarouselNext,
|
|
2098
|
+
Indicators: CarouselIndicators,
|
|
2099
|
+
Caption: CarouselCaption
|
|
2100
|
+
};
|
|
2101
|
+
|
|
1690
2102
|
// src/components/Clipboard/ClipboardProvider.tsx
|
|
1691
|
-
import
|
|
1692
|
-
var ClipboardContext = /* @__PURE__ */
|
|
2103
|
+
import React22, { createContext as createContext5, useCallback as useCallback6, useContext as useContext5, useState as useState5 } from "react";
|
|
2104
|
+
var ClipboardContext = /* @__PURE__ */ createContext5({
|
|
1693
2105
|
textValue: "",
|
|
1694
2106
|
setTextValue: async (_) => {
|
|
1695
2107
|
}
|
|
1696
2108
|
});
|
|
1697
|
-
var useClipboard = () =>
|
|
2109
|
+
var useClipboard = () => useContext5(ClipboardContext);
|
|
1698
2110
|
var ClipboardProvider = ({ children }) => {
|
|
1699
|
-
const [textValue, setInternalTextValue] =
|
|
1700
|
-
const setTextValue =
|
|
2111
|
+
const [textValue, setInternalTextValue] = useState5("");
|
|
2112
|
+
const setTextValue = useCallback6(async (nextValue) => {
|
|
1701
2113
|
await navigator.clipboard.writeText(nextValue);
|
|
1702
2114
|
return setInternalTextValue(nextValue);
|
|
1703
2115
|
}, []);
|
|
1704
|
-
return /* @__PURE__ */
|
|
2116
|
+
return /* @__PURE__ */ React22.createElement(ClipboardContext.Provider, {
|
|
1705
2117
|
value: {
|
|
1706
2118
|
textValue,
|
|
1707
2119
|
setTextValue
|
|
@@ -1710,14 +2122,14 @@ var ClipboardProvider = ({ children }) => {
|
|
|
1710
2122
|
};
|
|
1711
2123
|
|
|
1712
2124
|
// src/components/Clipboard/CopyButton.tsx
|
|
1713
|
-
import
|
|
1714
|
-
import { mx as
|
|
2125
|
+
import React23 from "react";
|
|
2126
|
+
import { mx as mx9, osTranslations } from "@dxos/ui-theme";
|
|
1715
2127
|
var inactiveLabelStyles = "invisible h-px -mb-px overflow-hidden";
|
|
1716
2128
|
var CopyButton = ({ classNames, value, size = 5, ...props }) => {
|
|
1717
2129
|
const { t } = useTranslation(osTranslations);
|
|
1718
2130
|
const { textValue, setTextValue } = useClipboard();
|
|
1719
2131
|
const isCopied = textValue === value;
|
|
1720
|
-
return /* @__PURE__ */
|
|
2132
|
+
return /* @__PURE__ */ React23.createElement(Button, {
|
|
1721
2133
|
...props,
|
|
1722
2134
|
classNames: [
|
|
1723
2135
|
"inline-flex flex-col justify-center",
|
|
@@ -1725,20 +2137,18 @@ var CopyButton = ({ classNames, value, size = 5, ...props }) => {
|
|
|
1725
2137
|
],
|
|
1726
2138
|
onClick: () => setTextValue(value),
|
|
1727
2139
|
"data-testid": "copy-invitation"
|
|
1728
|
-
}, /* @__PURE__ */
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
}, /* @__PURE__ */ React21.createElement("span", {
|
|
2140
|
+
}, /* @__PURE__ */ React23.createElement("div", {
|
|
2141
|
+
className: mx9("flex gap-1 items-center", isCopied && inactiveLabelStyles)
|
|
2142
|
+
}, /* @__PURE__ */ React23.createElement("span", {
|
|
1732
2143
|
className: "px-1"
|
|
1733
|
-
}, t("copy
|
|
2144
|
+
}, t("copy.label")), /* @__PURE__ */ React23.createElement(Icon, {
|
|
1734
2145
|
icon: "ph--copy--regular",
|
|
1735
2146
|
size
|
|
1736
|
-
})), /* @__PURE__ */
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
}, /* @__PURE__ */ React21.createElement("span", {
|
|
2147
|
+
})), /* @__PURE__ */ React23.createElement("div", {
|
|
2148
|
+
className: mx9("flex gap-1 items-center", !isCopied && inactiveLabelStyles)
|
|
2149
|
+
}, /* @__PURE__ */ React23.createElement("span", {
|
|
1740
2150
|
className: "px-1"
|
|
1741
|
-
}, t("copy
|
|
2151
|
+
}, t("copy-success.label")), /* @__PURE__ */ React23.createElement(Icon, {
|
|
1742
2152
|
icon: "ph--check--regular",
|
|
1743
2153
|
size
|
|
1744
2154
|
})));
|
|
@@ -1747,9 +2157,9 @@ var CopyButtonIconOnly = ({ __scopeTooltip, value, classNames, size, variant, ..
|
|
|
1747
2157
|
const { t } = useTranslation(osTranslations);
|
|
1748
2158
|
const { textValue, setTextValue } = useClipboard();
|
|
1749
2159
|
const isCopied = textValue === value;
|
|
1750
|
-
const label = isCopied ? t("copy
|
|
2160
|
+
const label = isCopied ? t("copy-success.label") : props.label ?? t("copy.label");
|
|
1751
2161
|
const { onOpen } = useTooltipContext("CopyButton", __scopeTooltip);
|
|
1752
|
-
return /* @__PURE__ */
|
|
2162
|
+
return /* @__PURE__ */ React23.createElement(IconButton, {
|
|
1753
2163
|
iconOnly: true,
|
|
1754
2164
|
label,
|
|
1755
2165
|
icon: "ph--copy--regular",
|
|
@@ -1772,91 +2182,92 @@ var Clipboard = {
|
|
|
1772
2182
|
};
|
|
1773
2183
|
|
|
1774
2184
|
// src/components/Dialog/Dialog.tsx
|
|
2185
|
+
import { createContext as createContext6 } from "@radix-ui/react-context";
|
|
1775
2186
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1776
|
-
import {
|
|
1777
|
-
import
|
|
2187
|
+
import { Primitive as Primitive13 } from "@radix-ui/react-primitive";
|
|
2188
|
+
import { Slot as Slot13 } from "@radix-ui/react-slot";
|
|
2189
|
+
import React24, { forwardRef as forwardRef14 } from "react";
|
|
1778
2190
|
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
1779
|
-
import { osTranslations as osTranslations2 } from "@dxos/ui-theme";
|
|
1780
|
-
var DialogRoot = (props) => /* @__PURE__ */
|
|
2191
|
+
import { composableProps as composableProps8, osTranslations as osTranslations2, slottable as slottable7 } from "@dxos/ui-theme";
|
|
2192
|
+
var DialogRoot = (props) => /* @__PURE__ */ React24.createElement(ElevationProvider, {
|
|
1781
2193
|
elevation: "dialog"
|
|
1782
|
-
}, /* @__PURE__ */
|
|
2194
|
+
}, /* @__PURE__ */ React24.createElement(DialogPrimitive.Root, {
|
|
2195
|
+
// NOTE: Radix warning unless set to undefined.
|
|
2196
|
+
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
2197
|
+
"aria-describedby": void 0,
|
|
2198
|
+
...props
|
|
2199
|
+
}));
|
|
1783
2200
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
1784
2201
|
var DialogPortal = DialogPrimitive.Portal;
|
|
1785
2202
|
var DIALOG_OVERLAY_NAME = "DialogOverlay";
|
|
1786
|
-
var [OverlayLayoutProvider, useOverlayLayoutContext] =
|
|
1787
|
-
var DialogOverlay = /* @__PURE__ */
|
|
2203
|
+
var [OverlayLayoutProvider, useOverlayLayoutContext] = createContext6(DIALOG_OVERLAY_NAME, {});
|
|
2204
|
+
var DialogOverlay = /* @__PURE__ */ forwardRef14(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
1788
2205
|
const { tx } = useThemeContext();
|
|
1789
|
-
return /* @__PURE__ */
|
|
2206
|
+
return /* @__PURE__ */ React24.createElement(DialogPrimitive.Overlay, {
|
|
1790
2207
|
...props,
|
|
1791
2208
|
"data-block-align": blockAlign,
|
|
1792
2209
|
className: tx("dialog.overlay", {}, classNames),
|
|
1793
2210
|
ref: forwardedRef
|
|
1794
|
-
}, /* @__PURE__ */
|
|
2211
|
+
}, /* @__PURE__ */ React24.createElement(OverlayLayoutProvider, {
|
|
1795
2212
|
inOverlayLayout: true
|
|
1796
2213
|
}, children));
|
|
1797
2214
|
});
|
|
1798
2215
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
1799
2216
|
var DIALOG_CONTENT_NAME = "DialogContent";
|
|
1800
|
-
var DialogContent = /* @__PURE__ */
|
|
2217
|
+
var DialogContent = /* @__PURE__ */ forwardRef14(({ classNames, children, size = "md", inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
1801
2218
|
const { tx } = useThemeContext();
|
|
1802
2219
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
1803
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ React24.createElement(DialogPrimitive.Content, {
|
|
1804
2221
|
...props,
|
|
1805
2222
|
// NOTE: Radix warning unless set to undefined.
|
|
1806
2223
|
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
1807
2224
|
"aria-describedby": void 0,
|
|
1808
2225
|
className: tx("dialog.content", {
|
|
1809
|
-
|
|
1810
|
-
|
|
2226
|
+
size,
|
|
2227
|
+
inOverlayLayout: propsInOverlayLayout || inOverlayLayout
|
|
1811
2228
|
}, classNames),
|
|
1812
2229
|
ref: forwardedRef
|
|
1813
|
-
}, /* @__PURE__ */
|
|
1814
|
-
|
|
2230
|
+
}, /* @__PURE__ */ React24.createElement(Column.Root, {
|
|
2231
|
+
classNames: "dx-expander",
|
|
2232
|
+
gutter: "sm"
|
|
1815
2233
|
}, children));
|
|
1816
2234
|
});
|
|
1817
2235
|
DialogContent.displayName = DIALOG_CONTENT_NAME;
|
|
1818
|
-
var DialogHeader =
|
|
2236
|
+
var DialogHeader = slottable7(({ children, asChild, ...props }, forwardedRef) => {
|
|
2237
|
+
const { className, ...rest } = composableProps8(props);
|
|
2238
|
+
const Comp = asChild ? Slot13 : Primitive13.div;
|
|
1819
2239
|
const { tx } = useThemeContext();
|
|
1820
|
-
return /* @__PURE__ */
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
role: "heading",
|
|
1824
|
-
...props,
|
|
1825
|
-
className: tx("dialog.header", {
|
|
1826
|
-
srOnly
|
|
1827
|
-
}, [
|
|
1828
|
-
classNames
|
|
1829
|
-
]),
|
|
2240
|
+
return /* @__PURE__ */ React24.createElement(Comp, {
|
|
2241
|
+
...rest,
|
|
2242
|
+
className: tx("dialog.header", {}, className),
|
|
1830
2243
|
ref: forwardedRef
|
|
1831
|
-
})
|
|
2244
|
+
}, children);
|
|
1832
2245
|
});
|
|
1833
|
-
var DialogCloseIconButton = /* @__PURE__ */
|
|
2246
|
+
var DialogCloseIconButton = /* @__PURE__ */ forwardRef14(({ label, ...props }, forwardedRef) => {
|
|
1834
2247
|
const { t } = useTranslation3(osTranslations2);
|
|
1835
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ React24.createElement(IconButton, {
|
|
1836
2249
|
...props,
|
|
1837
|
-
label: label ?? t("close
|
|
2250
|
+
label: label ?? t("close-dialog.label"),
|
|
1838
2251
|
icon: "ph--x--regular",
|
|
1839
2252
|
iconOnly: true,
|
|
1840
2253
|
size: 4,
|
|
1841
|
-
density: "fine",
|
|
1842
2254
|
variant: "ghost",
|
|
1843
2255
|
ref: forwardedRef
|
|
1844
2256
|
});
|
|
1845
2257
|
});
|
|
1846
|
-
var DialogBody =
|
|
2258
|
+
var DialogBody = slottable7(({ children, asChild, ...props }, forwardedRef) => {
|
|
2259
|
+
const { className, ...rest } = composableProps8(props);
|
|
2260
|
+
const Comp = asChild ? Slot13 : Primitive13.div;
|
|
1847
2261
|
const { tx } = useThemeContext();
|
|
1848
|
-
return /* @__PURE__ */
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
role: "none",
|
|
1852
|
-
...props,
|
|
1853
|
-
className: tx("dialog.body"),
|
|
2262
|
+
return /* @__PURE__ */ React24.createElement(Comp, {
|
|
2263
|
+
...rest,
|
|
2264
|
+
className: tx("dialog.body", {}, className),
|
|
1854
2265
|
ref: forwardedRef
|
|
1855
|
-
}, children)
|
|
2266
|
+
}, children);
|
|
1856
2267
|
});
|
|
1857
|
-
var DialogTitle = /* @__PURE__ */
|
|
2268
|
+
var DialogTitle = /* @__PURE__ */ forwardRef14(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1858
2269
|
const { tx } = useThemeContext();
|
|
1859
|
-
return /* @__PURE__ */
|
|
2270
|
+
return /* @__PURE__ */ React24.createElement(DialogPrimitive.Title, {
|
|
1860
2271
|
...props,
|
|
1861
2272
|
className: tx("dialog.title", {
|
|
1862
2273
|
srOnly
|
|
@@ -1864,9 +2275,9 @@ var DialogTitle = /* @__PURE__ */ forwardRef19(({ classNames, srOnly, ...props }
|
|
|
1864
2275
|
ref: forwardedRef
|
|
1865
2276
|
});
|
|
1866
2277
|
});
|
|
1867
|
-
var DialogDescription = /* @__PURE__ */
|
|
2278
|
+
var DialogDescription = /* @__PURE__ */ forwardRef14(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1868
2279
|
const { tx } = useThemeContext();
|
|
1869
|
-
return /* @__PURE__ */
|
|
2280
|
+
return /* @__PURE__ */ React24.createElement(DialogPrimitive.Description, {
|
|
1870
2281
|
...props,
|
|
1871
2282
|
className: tx("dialog.description", {
|
|
1872
2283
|
srOnly
|
|
@@ -1874,15 +2285,15 @@ var DialogDescription = /* @__PURE__ */ forwardRef19(({ classNames, srOnly, ...p
|
|
|
1874
2285
|
ref: forwardedRef
|
|
1875
2286
|
});
|
|
1876
2287
|
});
|
|
1877
|
-
var DialogActionBar =
|
|
2288
|
+
var DialogActionBar = slottable7(({ children, asChild, ...props }, forwardedRef) => {
|
|
2289
|
+
const { className: classNames, ...rest } = composableProps8(props);
|
|
2290
|
+
const Comp = asChild ? Slot13 : Primitive13.div;
|
|
1878
2291
|
const { tx } = useThemeContext();
|
|
1879
|
-
return /* @__PURE__ */
|
|
1880
|
-
|
|
1881
|
-
}, /* @__PURE__ */ React22.createElement("div", {
|
|
1882
|
-
...props,
|
|
2292
|
+
return /* @__PURE__ */ React24.createElement(Comp, {
|
|
2293
|
+
...rest,
|
|
1883
2294
|
className: tx("dialog.actionbar", {}, classNames),
|
|
1884
2295
|
ref: forwardedRef
|
|
1885
|
-
}, children)
|
|
2296
|
+
}, children);
|
|
1886
2297
|
});
|
|
1887
2298
|
var DialogClose = DialogPrimitive.Close;
|
|
1888
2299
|
var Dialog = {
|
|
@@ -1902,108 +2313,85 @@ var Dialog = {
|
|
|
1902
2313
|
|
|
1903
2314
|
// src/components/Dialog/AlertDialog.tsx
|
|
1904
2315
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
1905
|
-
import { createContext as
|
|
1906
|
-
import
|
|
1907
|
-
var AlertDialogRoot = (props) => /* @__PURE__ */
|
|
2316
|
+
import { createContext as createContext7 } from "@radix-ui/react-context";
|
|
2317
|
+
import React25, { forwardRef as forwardRef15 } from "react";
|
|
2318
|
+
var AlertDialogRoot = (props) => /* @__PURE__ */ React25.createElement(ElevationProvider, {
|
|
1908
2319
|
elevation: "dialog"
|
|
1909
|
-
}, /* @__PURE__ */
|
|
2320
|
+
}, /* @__PURE__ */ React25.createElement(AlertDialogPrimitive.Root, props));
|
|
1910
2321
|
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
1911
2322
|
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
1912
2323
|
var AlertDialogCancel = AlertDialogPrimitive.Cancel;
|
|
1913
2324
|
var AlertDialogAction = AlertDialogPrimitive.Action;
|
|
1914
|
-
var
|
|
2325
|
+
var ALERT_DIALOG_OVERLAY_NAME = "AlertDialogOverlay";
|
|
2326
|
+
var ALERT_DIALOG_CONTENT_NAME = "AlertDialogContent";
|
|
2327
|
+
var [OverlayLayoutProvider2, useOverlayLayoutContext2] = createContext7(ALERT_DIALOG_OVERLAY_NAME, {
|
|
2328
|
+
inOverlayLayout: false
|
|
2329
|
+
});
|
|
2330
|
+
var AlertDialogOverlay = /* @__PURE__ */ forwardRef15(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
1915
2331
|
const { tx } = useThemeContext();
|
|
1916
|
-
return /* @__PURE__ */
|
|
1917
|
-
...props,
|
|
1918
|
-
className: tx("dialog.title", {
|
|
1919
|
-
srOnly
|
|
1920
|
-
}, classNames),
|
|
1921
|
-
ref: forwardedRef
|
|
1922
|
-
});
|
|
1923
|
-
});
|
|
1924
|
-
var AlertDialogDescription = /* @__PURE__ */ forwardRef20(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1925
|
-
const { tx } = useThemeContext();
|
|
1926
|
-
return /* @__PURE__ */ React23.createElement(AlertDialogPrimitive.Description, {
|
|
1927
|
-
...props,
|
|
1928
|
-
className: tx("dialog.description", {
|
|
1929
|
-
srOnly
|
|
1930
|
-
}, classNames),
|
|
1931
|
-
ref: forwardedRef
|
|
1932
|
-
});
|
|
1933
|
-
});
|
|
1934
|
-
var ALERT_DIALOG_OVERLAY_NAME = "AlertDialogOverlay";
|
|
1935
|
-
var ALERT_DIALOG_CONTENT_NAME = "AlertDialogContent";
|
|
1936
|
-
var ALERT_DIALOG_BODY_NAME = "AlertDialogBody";
|
|
1937
|
-
var ALERT_DIALOG_ACTIONBAR_NAME = "AlertDialogActionBar";
|
|
1938
|
-
var [OverlayLayoutProvider2, useOverlayLayoutContext2] = createContext6(ALERT_DIALOG_OVERLAY_NAME, {
|
|
1939
|
-
inOverlayLayout: false
|
|
1940
|
-
});
|
|
1941
|
-
var AlertDialogOverlay = /* @__PURE__ */ forwardRef20(({ classNames, children, blockAlign, ...props }, forwardedRef) => {
|
|
1942
|
-
const { tx } = useThemeContext();
|
|
1943
|
-
return /* @__PURE__ */ React23.createElement(AlertDialogPrimitive.Overlay, {
|
|
2332
|
+
return /* @__PURE__ */ React25.createElement(AlertDialogPrimitive.Overlay, {
|
|
1944
2333
|
...props,
|
|
1945
2334
|
"data-block-align": blockAlign,
|
|
1946
|
-
className: tx(
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
classNames,
|
|
1950
|
-
// TODO(burdon): Move to dialog.ts.
|
|
1951
|
-
"data-[h-align=start]:justify-center",
|
|
1952
|
-
"data-[h-align=start]:items-start",
|
|
1953
|
-
"data-[h-align=center]:place-content-center"
|
|
1954
|
-
),
|
|
1955
|
-
ref: forwardedRef
|
|
1956
|
-
}, /* @__PURE__ */ React23.createElement(OverlayLayoutProvider2, {
|
|
2335
|
+
className: tx("dialog.overlay", {}, classNames),
|
|
2336
|
+
ref: forwardedRef
|
|
2337
|
+
}, /* @__PURE__ */ React25.createElement(OverlayLayoutProvider2, {
|
|
1957
2338
|
inOverlayLayout: true
|
|
1958
2339
|
}, children));
|
|
1959
2340
|
});
|
|
1960
2341
|
AlertDialogOverlay.displayName = ALERT_DIALOG_OVERLAY_NAME;
|
|
1961
|
-
var AlertDialogContent = /* @__PURE__ */
|
|
2342
|
+
var AlertDialogContent = /* @__PURE__ */ forwardRef15(({ classNames, children, size = "md", ...props }, forwardedRef) => {
|
|
1962
2343
|
const { tx } = useThemeContext();
|
|
1963
2344
|
const { inOverlayLayout } = useOverlayLayoutContext2(ALERT_DIALOG_CONTENT_NAME);
|
|
1964
|
-
return /* @__PURE__ */
|
|
2345
|
+
return /* @__PURE__ */ React25.createElement(AlertDialogPrimitive.Content, {
|
|
1965
2346
|
...props,
|
|
1966
2347
|
className: tx("dialog.content", {
|
|
1967
2348
|
inOverlayLayout,
|
|
1968
2349
|
size
|
|
1969
2350
|
}, classNames),
|
|
2351
|
+
// NOTE: Radix warning unless set to undefined.
|
|
2352
|
+
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
2353
|
+
"aria-describedby": void 0,
|
|
1970
2354
|
ref: forwardedRef
|
|
1971
|
-
}, /* @__PURE__ */
|
|
2355
|
+
}, /* @__PURE__ */ React25.createElement(Column.Root, {
|
|
2356
|
+
classNames: "dx-expander",
|
|
2357
|
+
gutter: "sm"
|
|
2358
|
+
}, children));
|
|
1972
2359
|
});
|
|
1973
2360
|
AlertDialogContent.displayName = ALERT_DIALOG_CONTENT_NAME;
|
|
1974
|
-
var
|
|
2361
|
+
var AlertDialogTitle = /* @__PURE__ */ forwardRef15(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1975
2362
|
const { tx } = useThemeContext();
|
|
1976
|
-
return /* @__PURE__ */
|
|
1977
|
-
asChild: true
|
|
1978
|
-
}, /* @__PURE__ */ React23.createElement("div", {
|
|
1979
|
-
role: "none",
|
|
2363
|
+
return /* @__PURE__ */ React25.createElement(AlertDialogPrimitive.Title, {
|
|
1980
2364
|
...props,
|
|
1981
|
-
className: tx("dialog.
|
|
2365
|
+
className: tx("dialog.title", {
|
|
2366
|
+
srOnly
|
|
2367
|
+
}, classNames),
|
|
1982
2368
|
ref: forwardedRef
|
|
1983
|
-
}
|
|
2369
|
+
});
|
|
1984
2370
|
});
|
|
1985
|
-
|
|
1986
|
-
var AlertDialogActionBar = /* @__PURE__ */ forwardRef20(({ children, classNames, ...props }, forwardedRef) => {
|
|
2371
|
+
var AlertDialogDescription = /* @__PURE__ */ forwardRef15(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
1987
2372
|
const { tx } = useThemeContext();
|
|
1988
|
-
return /* @__PURE__ */
|
|
1989
|
-
asChild: true
|
|
1990
|
-
}, /* @__PURE__ */ React23.createElement("div", {
|
|
2373
|
+
return /* @__PURE__ */ React25.createElement(AlertDialogPrimitive.Description, {
|
|
1991
2374
|
...props,
|
|
1992
|
-
className: tx("dialog.
|
|
2375
|
+
className: tx("dialog.description", {
|
|
2376
|
+
srOnly
|
|
2377
|
+
}, classNames),
|
|
1993
2378
|
ref: forwardedRef
|
|
1994
|
-
}
|
|
2379
|
+
});
|
|
1995
2380
|
});
|
|
1996
|
-
AlertDialogActionBar.displayName = ALERT_DIALOG_ACTIONBAR_NAME;
|
|
1997
2381
|
var AlertDialog = {
|
|
1998
2382
|
Root: AlertDialogRoot,
|
|
1999
2383
|
Trigger: AlertDialogTrigger,
|
|
2000
2384
|
Portal: AlertDialogPortal,
|
|
2001
2385
|
Overlay: AlertDialogOverlay,
|
|
2002
2386
|
Content: AlertDialogContent,
|
|
2003
|
-
|
|
2387
|
+
// Shared with Dialog.
|
|
2388
|
+
Header: Dialog.Header,
|
|
2389
|
+
Body: Dialog.Body,
|
|
2004
2390
|
Title: AlertDialogTitle,
|
|
2005
2391
|
Description: AlertDialogDescription,
|
|
2006
|
-
ActionBar:
|
|
2392
|
+
ActionBar: Dialog.ActionBar,
|
|
2393
|
+
CloseIconButton: Dialog.CloseIconButton,
|
|
2394
|
+
// AlertDialog-specific dismissal.
|
|
2007
2395
|
Cancel: AlertDialogCancel,
|
|
2008
2396
|
Action: AlertDialogAction
|
|
2009
2397
|
};
|
|
@@ -2012,103 +2400,52 @@ var AlertDialog = {
|
|
|
2012
2400
|
import { ErrorBoundary } from "@dxos/react-error-boundary";
|
|
2013
2401
|
|
|
2014
2402
|
// src/components/ErrorFallback/ErrorFallback.tsx
|
|
2015
|
-
import
|
|
2403
|
+
import React26 from "react";
|
|
2016
2404
|
import { safeStringify } from "@dxos/util";
|
|
2017
|
-
|
|
2018
|
-
// src/components/ErrorFallback/ErrorStack.tsx
|
|
2019
|
-
import ErrorStackParser from "error-stack-parser";
|
|
2020
|
-
import React24 from "react";
|
|
2021
|
-
import { mx as mx8 } from "@dxos/ui-theme";
|
|
2022
|
-
var ErrorStack = ({ error }) => {
|
|
2023
|
-
const frames = ErrorStackParser.parse(error);
|
|
2024
|
-
return /* @__PURE__ */ React24.createElement("div", {
|
|
2025
|
-
className: "font-mono text-sm"
|
|
2026
|
-
}, frames.map((frame, i) => {
|
|
2027
|
-
const isLast = i === frames.length - 1;
|
|
2028
|
-
const local = frame.fileName ? parseLocalFrame(frame.fileName, frame.lineNumber, frame.columnNumber) : void 0;
|
|
2029
|
-
const name = frame.functionName ?? "<anonymous>";
|
|
2030
|
-
return /* @__PURE__ */ React24.createElement("div", {
|
|
2031
|
-
key: i,
|
|
2032
|
-
className: mx8("grid grid-cols-[16px_1fr_auto_auto] items-stretch gap-x-2", local && "cursor-pointer hover:bg-hover-surface")
|
|
2033
|
-
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2034
|
-
className: "relative"
|
|
2035
|
-
}, /* @__PURE__ */ React24.createElement("div", {
|
|
2036
|
-
className: mx8("absolute left-1/2 -translate-x-1/2 w-px bg-neutral-500", isLast ? "top-0 h-1/2" : "inset-y-0")
|
|
2037
|
-
}), /* @__PURE__ */ React24.createElement("div", {
|
|
2038
|
-
className: "absolute top-1/2 -translate-y-1/2 left-1/2 right-0 h-px bg-neutral-500"
|
|
2039
|
-
})), local ? /* @__PURE__ */ React24.createElement("a", {
|
|
2040
|
-
href: local.href,
|
|
2041
|
-
className: "truncate self-center"
|
|
2042
|
-
}, name) : /* @__PURE__ */ React24.createElement("span", {
|
|
2043
|
-
className: "text-subdued truncate self-center"
|
|
2044
|
-
}, name), /* @__PURE__ */ React24.createElement("span", {
|
|
2045
|
-
className: "text-xs text-subdued truncate self-center"
|
|
2046
|
-
}, local?.fileName ?? ""), /* @__PURE__ */ React24.createElement("span", {
|
|
2047
|
-
className: "text-xs text-subdued text-right self-center"
|
|
2048
|
-
}, local ? `${frame.lineNumber}:${frame.columnNumber}` : ""));
|
|
2049
|
-
}));
|
|
2050
|
-
};
|
|
2051
|
-
var parseLocalFrame = (fileUrl, line, col) => {
|
|
2052
|
-
try {
|
|
2053
|
-
const { pathname } = new URL(fileUrl);
|
|
2054
|
-
if (!pathname.startsWith("/@fs/")) {
|
|
2055
|
-
return void 0;
|
|
2056
|
-
}
|
|
2057
|
-
const localPath = pathname.slice(4);
|
|
2058
|
-
return {
|
|
2059
|
-
href: `vscode://file/${localPath}:${line ?? 1}:${col ?? 1}`,
|
|
2060
|
-
fileName: pathname.split("/").pop() ?? localPath
|
|
2061
|
-
};
|
|
2062
|
-
} catch {
|
|
2063
|
-
return void 0;
|
|
2064
|
-
}
|
|
2065
|
-
};
|
|
2066
|
-
|
|
2067
|
-
// src/components/ErrorFallback/ErrorFallback.tsx
|
|
2068
2405
|
var ErrorFallback = ({ children, error, title, data }) => {
|
|
2069
2406
|
const isDev = true;
|
|
2070
2407
|
const message = error instanceof Error ? error.message : String(error);
|
|
2071
|
-
return /* @__PURE__ */
|
|
2408
|
+
return /* @__PURE__ */ React26.createElement("div", {
|
|
2072
2409
|
role: "alert",
|
|
2073
2410
|
"data-testid": "error-boundary-fallback",
|
|
2074
2411
|
className: "flex flex-col p-4 gap-4 overflow-auto"
|
|
2075
|
-
}, /* @__PURE__ */
|
|
2412
|
+
}, /* @__PURE__ */ React26.createElement("h1", {
|
|
2076
2413
|
className: "text-lg text-info-text"
|
|
2077
|
-
}, title ?? "Runtime Error"), /* @__PURE__ */
|
|
2414
|
+
}, title ?? "Runtime Error"), /* @__PURE__ */ React26.createElement("p", null, message), isDev && error instanceof Error && /* @__PURE__ */ React26.createElement(Section, {
|
|
2078
2415
|
title: "Stack",
|
|
2079
2416
|
onClick: () => {
|
|
2080
2417
|
const text = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
2081
2418
|
void navigator.clipboard.writeText(text);
|
|
2082
2419
|
}
|
|
2083
|
-
}, /* @__PURE__ */
|
|
2420
|
+
}, /* @__PURE__ */ React26.createElement(ErrorStack, {
|
|
2084
2421
|
error
|
|
2085
|
-
})), data && /* @__PURE__ */
|
|
2422
|
+
})), data && /* @__PURE__ */ React26.createElement(Section, {
|
|
2086
2423
|
title: "Data",
|
|
2087
2424
|
onClick: () => {
|
|
2088
2425
|
void navigator.clipboard.writeText(JSON.stringify(data, void 0, 2));
|
|
2089
2426
|
}
|
|
2090
|
-
}, /* @__PURE__ */
|
|
2427
|
+
}, /* @__PURE__ */ React26.createElement("pre", {
|
|
2091
2428
|
className: "overflow-x-auto text-xs"
|
|
2092
2429
|
}, safeStringify(data, void 0, 2))), children);
|
|
2093
2430
|
};
|
|
2094
2431
|
var Section = ({ children, title, onClick }) => {
|
|
2095
|
-
return /* @__PURE__ */
|
|
2432
|
+
return /* @__PURE__ */ React26.createElement("div", {
|
|
2096
2433
|
className: "flex flex-col gap-1"
|
|
2097
|
-
}, onClick && /* @__PURE__ */
|
|
2434
|
+
}, onClick && /* @__PURE__ */ React26.createElement("button", {
|
|
2098
2435
|
type: "button",
|
|
2099
2436
|
onClick,
|
|
2100
2437
|
className: "flex items-center gap-1 text-xs text-subdued hover:text-primary-500 transition-colors",
|
|
2101
2438
|
title: `Copy ${title}`
|
|
2102
|
-
}, /* @__PURE__ */
|
|
2439
|
+
}, /* @__PURE__ */ React26.createElement("h2", {
|
|
2103
2440
|
className: "text-xs uppercase text-subdued"
|
|
2104
2441
|
}, title)), children);
|
|
2105
2442
|
};
|
|
2106
2443
|
|
|
2107
2444
|
// src/components/ErrorFallback/ThrowError.tsx
|
|
2108
|
-
import { useEffect as
|
|
2445
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
2109
2446
|
var ThrowError = ({ delay = 1e3, ...props }) => {
|
|
2110
|
-
const [error, setError] =
|
|
2111
|
-
|
|
2447
|
+
const [error, setError] = useState6();
|
|
2448
|
+
useEffect4(() => {
|
|
2112
2449
|
if (delay < 0) {
|
|
2113
2450
|
return;
|
|
2114
2451
|
}
|
|
@@ -2132,15 +2469,124 @@ var generator = ({ error, delay }) => {
|
|
|
2132
2469
|
return error?.() ?? new Error(`Error generated after ${delay}ms`);
|
|
2133
2470
|
};
|
|
2134
2471
|
|
|
2472
|
+
// src/components/Focus/Focus.tsx
|
|
2473
|
+
import { useArrowNavigationGroup as useArrowNavigationGroup2, useFocusableGroup, useMergedTabsterAttributes_unstable } from "@fluentui/react-tabster";
|
|
2474
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
2475
|
+
import { Primitive as Primitive14 } from "@radix-ui/react-primitive";
|
|
2476
|
+
import { Slot as Slot14 } from "@radix-ui/react-slot";
|
|
2477
|
+
import React27, { createContext as createContext8, useCallback as useCallback7, useContext as useContext6, useRef as useRef3, useState as useState7 } from "react";
|
|
2478
|
+
import { composableProps as composableProps9, slottable as slottable8 } from "@dxos/ui-theme";
|
|
2479
|
+
var FOCUS_STATE_ATTR = "focus-state";
|
|
2480
|
+
var FocusContext = /* @__PURE__ */ createContext8({});
|
|
2481
|
+
var useFocus = () => useContext6(FocusContext);
|
|
2482
|
+
var Group3 = slottable8(({ children, asChild, orientation = "vertical", border = false, ...props }, forwardedRef) => {
|
|
2483
|
+
const Comp = asChild ? Slot14 : Primitive14.div;
|
|
2484
|
+
const { tx } = useThemeContext();
|
|
2485
|
+
const rootRef = useRef3(null);
|
|
2486
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
2487
|
+
tabBehavior: "limited-trap-focus"
|
|
2488
|
+
});
|
|
2489
|
+
const arrowNavigationAttrs = useArrowNavigationGroup2({
|
|
2490
|
+
axis: orientation,
|
|
2491
|
+
memorizeCurrent: true
|
|
2492
|
+
});
|
|
2493
|
+
const tabsterAttrs = useMergedTabsterAttributes_unstable(focusableGroupAttrs, arrowNavigationAttrs);
|
|
2494
|
+
const [state, setState] = useState7();
|
|
2495
|
+
const [groupHasFocus, setGroupHasFocus] = useState7(false);
|
|
2496
|
+
const handleFocusIn = useCallback7(() => setGroupHasFocus(true), []);
|
|
2497
|
+
const handleFocusOut = useCallback7((event) => {
|
|
2498
|
+
const related = event.relatedTarget;
|
|
2499
|
+
if (!related || !rootRef.current?.contains(related)) {
|
|
2500
|
+
setGroupHasFocus(false);
|
|
2501
|
+
}
|
|
2502
|
+
}, []);
|
|
2503
|
+
const { className, ...rest } = composableProps9(props);
|
|
2504
|
+
return /* @__PURE__ */ React27.createElement(FocusContext.Provider, {
|
|
2505
|
+
value: {
|
|
2506
|
+
setFocus: setState,
|
|
2507
|
+
groupHasFocus
|
|
2508
|
+
}
|
|
2509
|
+
}, /* @__PURE__ */ React27.createElement(Comp, {
|
|
2510
|
+
...rest,
|
|
2511
|
+
tabIndex: 0,
|
|
2512
|
+
className: tx("focus.group", {
|
|
2513
|
+
border
|
|
2514
|
+
}, className),
|
|
2515
|
+
...tabsterAttrs,
|
|
2516
|
+
...state && {
|
|
2517
|
+
[`data-${FOCUS_STATE_ATTR}`]: state
|
|
2518
|
+
},
|
|
2519
|
+
onBlur: handleFocusOut,
|
|
2520
|
+
onFocus: handleFocusIn,
|
|
2521
|
+
ref: useComposedRefs(rootRef, forwardedRef)
|
|
2522
|
+
}, children));
|
|
2523
|
+
});
|
|
2524
|
+
var Item4 = slottable8(({ children, asChild, current, border = false, onCurrentChange, onClick, onFocus, onBlur, ...props }, forwardedRef) => {
|
|
2525
|
+
const Comp = asChild ? Slot14 : Primitive14.div;
|
|
2526
|
+
const { tx } = useThemeContext();
|
|
2527
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
2528
|
+
ignoreDefaultKeydown: {
|
|
2529
|
+
Enter: true
|
|
2530
|
+
}
|
|
2531
|
+
});
|
|
2532
|
+
const [focused, setFocused] = useState7(false);
|
|
2533
|
+
const handleClick = useCallback7((event) => {
|
|
2534
|
+
onCurrentChange?.();
|
|
2535
|
+
onClick?.(event);
|
|
2536
|
+
}, [
|
|
2537
|
+
onCurrentChange,
|
|
2538
|
+
onClick
|
|
2539
|
+
]);
|
|
2540
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2541
|
+
if (event.key === "Enter") {
|
|
2542
|
+
onCurrentChange?.();
|
|
2543
|
+
}
|
|
2544
|
+
}, [
|
|
2545
|
+
onCurrentChange
|
|
2546
|
+
]);
|
|
2547
|
+
const handleFocus = useCallback7((event) => {
|
|
2548
|
+
setFocused(true);
|
|
2549
|
+
onFocus?.(event);
|
|
2550
|
+
}, [
|
|
2551
|
+
onFocus
|
|
2552
|
+
]);
|
|
2553
|
+
const handleBlur = useCallback7((event) => {
|
|
2554
|
+
setFocused(false);
|
|
2555
|
+
onBlur?.(event);
|
|
2556
|
+
}, [
|
|
2557
|
+
onBlur
|
|
2558
|
+
]);
|
|
2559
|
+
const isCurrent = current ?? focused;
|
|
2560
|
+
const { className, ...rest } = composableProps9(props);
|
|
2561
|
+
return /* @__PURE__ */ React27.createElement(Comp, {
|
|
2562
|
+
...rest,
|
|
2563
|
+
tabIndex: 0,
|
|
2564
|
+
className: tx("focus.item", {
|
|
2565
|
+
border
|
|
2566
|
+
}, className),
|
|
2567
|
+
...focusableGroupAttrs,
|
|
2568
|
+
"aria-current": isCurrent || void 0,
|
|
2569
|
+
onClick: handleClick,
|
|
2570
|
+
onKeyDown: handleKeyDown,
|
|
2571
|
+
onFocus: handleFocus,
|
|
2572
|
+
onBlur: handleBlur,
|
|
2573
|
+
ref: forwardedRef
|
|
2574
|
+
}, children);
|
|
2575
|
+
});
|
|
2576
|
+
var Focus = {
|
|
2577
|
+
Group: Group3,
|
|
2578
|
+
Item: Item4
|
|
2579
|
+
};
|
|
2580
|
+
|
|
2135
2581
|
// src/components/Input/Input.tsx
|
|
2136
2582
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
2137
2583
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
2138
|
-
import
|
|
2584
|
+
import React28, { forwardRef as forwardRef16 } from "react";
|
|
2139
2585
|
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";
|
|
2140
|
-
import { mx as
|
|
2141
|
-
var Label3 = /* @__PURE__ */
|
|
2586
|
+
import { mx as mx10 } from "@dxos/ui-theme";
|
|
2587
|
+
var Label3 = /* @__PURE__ */ forwardRef16(({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2142
2588
|
const { tx } = useThemeContext();
|
|
2143
|
-
return /* @__PURE__ */
|
|
2589
|
+
return /* @__PURE__ */ React28.createElement(LabelPrimitive, {
|
|
2144
2590
|
...props,
|
|
2145
2591
|
className: tx("input.label", {
|
|
2146
2592
|
srOnly
|
|
@@ -2148,9 +2594,9 @@ var Label3 = /* @__PURE__ */ forwardRef21(({ classNames, children, srOnly, ...pr
|
|
|
2148
2594
|
ref: forwardedRef
|
|
2149
2595
|
}, children);
|
|
2150
2596
|
});
|
|
2151
|
-
var Description3 = /* @__PURE__ */
|
|
2597
|
+
var Description3 = /* @__PURE__ */ forwardRef16(({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2152
2598
|
const { tx } = useThemeContext();
|
|
2153
|
-
return /* @__PURE__ */
|
|
2599
|
+
return /* @__PURE__ */ React28.createElement(DescriptionPrimitive, {
|
|
2154
2600
|
...props,
|
|
2155
2601
|
className: tx("input.description", {
|
|
2156
2602
|
srOnly
|
|
@@ -2158,10 +2604,10 @@ var Description3 = /* @__PURE__ */ forwardRef21(({ classNames, children, srOnly,
|
|
|
2158
2604
|
ref: forwardedRef
|
|
2159
2605
|
}, children);
|
|
2160
2606
|
});
|
|
2161
|
-
var Validation = /* @__PURE__ */
|
|
2607
|
+
var Validation = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2162
2608
|
const { tx } = useThemeContext();
|
|
2163
2609
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
2164
|
-
return /* @__PURE__ */
|
|
2610
|
+
return /* @__PURE__ */ React28.createElement(ValidationPrimitive, {
|
|
2165
2611
|
...props,
|
|
2166
2612
|
className: tx("input.validation", {
|
|
2167
2613
|
srOnly,
|
|
@@ -2170,9 +2616,9 @@ var Validation = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, child
|
|
|
2170
2616
|
ref: forwardedRef
|
|
2171
2617
|
}, children);
|
|
2172
2618
|
});
|
|
2173
|
-
var DescriptionAndValidation = /* @__PURE__ */
|
|
2619
|
+
var DescriptionAndValidation = /* @__PURE__ */ forwardRef16(({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
2174
2620
|
const { tx } = useThemeContext();
|
|
2175
|
-
return /* @__PURE__ */
|
|
2621
|
+
return /* @__PURE__ */ React28.createElement(DescriptionAndValidationPrimitive, {
|
|
2176
2622
|
...props,
|
|
2177
2623
|
className: tx("input.descriptionAndValidation", {
|
|
2178
2624
|
srOnly
|
|
@@ -2180,12 +2626,12 @@ var DescriptionAndValidation = /* @__PURE__ */ forwardRef21(({ classNames, child
|
|
|
2180
2626
|
ref: forwardedRef
|
|
2181
2627
|
}, children);
|
|
2182
2628
|
});
|
|
2183
|
-
var PinInput = /* @__PURE__ */
|
|
2629
|
+
var PinInput = /* @__PURE__ */ forwardRef16(({ classNames, density: propsDensity, elevation: propsElevation, ...props }, forwardedRef) => {
|
|
2184
2630
|
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
2185
2631
|
const { tx } = useThemeContext();
|
|
2186
2632
|
const density = useDensityContext(propsDensity);
|
|
2187
2633
|
const elevation = useElevationContext(propsElevation);
|
|
2188
|
-
return /* @__PURE__ */
|
|
2634
|
+
return /* @__PURE__ */ React28.createElement(PinInputPrimitive, {
|
|
2189
2635
|
...props,
|
|
2190
2636
|
...props.autoFocus && !hasIosKeyboard2 && {
|
|
2191
2637
|
autoFocus: true
|
|
@@ -2201,13 +2647,13 @@ var PinInput = /* @__PURE__ */ forwardRef21(({ classNames, density: propsDensity
|
|
|
2201
2647
|
ref: forwardedRef
|
|
2202
2648
|
});
|
|
2203
2649
|
});
|
|
2204
|
-
var TextInput = /* @__PURE__ */
|
|
2650
|
+
var TextInput = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, density: densityProp, elevation: elevationProp, variant, noAutoFill, ...props }, forwardedRef) => {
|
|
2205
2651
|
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
2206
2652
|
const { tx } = useThemeContext();
|
|
2207
|
-
const density = useDensityContext(
|
|
2208
|
-
const elevation = useElevationContext(
|
|
2653
|
+
const density = useDensityContext(densityProp);
|
|
2654
|
+
const elevation = useElevationContext(elevationProp);
|
|
2209
2655
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
2210
|
-
return /* @__PURE__ */
|
|
2656
|
+
return /* @__PURE__ */ React28.createElement(TextInputPrimitive, {
|
|
2211
2657
|
...props,
|
|
2212
2658
|
"data-1p-ignore": noAutoFill,
|
|
2213
2659
|
className: tx("input.input", {
|
|
@@ -2223,13 +2669,13 @@ var TextInput = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, densit
|
|
|
2223
2669
|
ref: forwardedRef
|
|
2224
2670
|
});
|
|
2225
2671
|
});
|
|
2226
|
-
var TextArea = /* @__PURE__ */
|
|
2672
|
+
var TextArea = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
2227
2673
|
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
2228
2674
|
const { tx } = useThemeContext();
|
|
2229
2675
|
const density = useDensityContext(propsDensity);
|
|
2230
2676
|
const elevation = useElevationContext(propsElevation);
|
|
2231
2677
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
2232
|
-
return /* @__PURE__ */
|
|
2678
|
+
return /* @__PURE__ */ React28.createElement(TextAreaPrimitive, {
|
|
2233
2679
|
...props,
|
|
2234
2680
|
className: tx("input.textArea", {
|
|
2235
2681
|
variant,
|
|
@@ -2244,7 +2690,7 @@ var TextArea = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, density
|
|
|
2244
2690
|
ref: forwardedRef
|
|
2245
2691
|
});
|
|
2246
2692
|
});
|
|
2247
|
-
var Checkbox = /* @__PURE__ */
|
|
2693
|
+
var Checkbox = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, ...props }, forwardedRef) => {
|
|
2248
2694
|
const [checked, onCheckedChange] = useControllableState2({
|
|
2249
2695
|
prop: propsChecked,
|
|
2250
2696
|
defaultProp: propsDefaultChecked,
|
|
@@ -2252,7 +2698,7 @@ var Checkbox = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, checked
|
|
|
2252
2698
|
});
|
|
2253
2699
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
2254
2700
|
const { tx } = useThemeContext();
|
|
2255
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ React28.createElement(CheckboxPrimitive.Root, {
|
|
2256
2702
|
...props,
|
|
2257
2703
|
checked,
|
|
2258
2704
|
onCheckedChange,
|
|
@@ -2266,7 +2712,7 @@ var Checkbox = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, checked
|
|
|
2266
2712
|
size
|
|
2267
2713
|
}, "shrink-0", classNames),
|
|
2268
2714
|
ref: forwardedRef
|
|
2269
|
-
}, /* @__PURE__ */
|
|
2715
|
+
}, /* @__PURE__ */ React28.createElement(Icon, {
|
|
2270
2716
|
icon: checked === "indeterminate" ? "ph--minus--regular" : "ph--check--regular",
|
|
2271
2717
|
classNames: tx("input.checkboxIndicator", {
|
|
2272
2718
|
size,
|
|
@@ -2274,16 +2720,16 @@ var Checkbox = /* @__PURE__ */ forwardRef21(({ __inputScope, classNames, checked
|
|
|
2274
2720
|
})
|
|
2275
2721
|
}));
|
|
2276
2722
|
});
|
|
2277
|
-
var Switch = /* @__PURE__ */
|
|
2723
|
+
var Switch = /* @__PURE__ */ forwardRef16(({ __inputScope, classNames, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, ...props }, forwardedRef) => {
|
|
2278
2724
|
const [checked, onCheckedChange] = useControllableState2({
|
|
2279
2725
|
prop: propsChecked,
|
|
2280
2726
|
defaultProp: propsDefaultChecked ?? false,
|
|
2281
2727
|
onChange: propsOnCheckedChange
|
|
2282
2728
|
});
|
|
2283
2729
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
2284
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ React28.createElement("input", {
|
|
2285
2731
|
type: "checkbox",
|
|
2286
|
-
className:
|
|
2732
|
+
className: mx10("dx-checkbox--switch dx-focus-ring", classNames),
|
|
2287
2733
|
checked,
|
|
2288
2734
|
onChange: (event) => {
|
|
2289
2735
|
onCheckedChange(event.target.checked);
|
|
@@ -2312,13 +2758,14 @@ var Input = {
|
|
|
2312
2758
|
};
|
|
2313
2759
|
|
|
2314
2760
|
// src/components/List/List.tsx
|
|
2315
|
-
import { Primitive as
|
|
2316
|
-
import { Slot as
|
|
2317
|
-
import
|
|
2761
|
+
import { Primitive as Primitive15 } from "@radix-ui/react-primitive";
|
|
2762
|
+
import { Slot as Slot15 } from "@radix-ui/react-slot";
|
|
2763
|
+
import React30, { forwardRef as forwardRef17 } from "react";
|
|
2318
2764
|
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";
|
|
2765
|
+
import { composable as composable4, composableProps as composableProps10 } from "@dxos/ui-theme";
|
|
2319
2766
|
|
|
2320
2767
|
// src/components/List/ListDropIndicator.tsx
|
|
2321
|
-
import
|
|
2768
|
+
import React29 from "react";
|
|
2322
2769
|
var edgeToOrientationMap = {
|
|
2323
2770
|
top: "horizontal",
|
|
2324
2771
|
bottom: "horizontal",
|
|
@@ -2340,8 +2787,7 @@ var terminalSize = 8;
|
|
|
2340
2787
|
var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
2341
2788
|
var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
|
|
2342
2789
|
const orientation = edgeToOrientationMap[edge];
|
|
2343
|
-
return /* @__PURE__ */
|
|
2344
|
-
role: "none",
|
|
2790
|
+
return /* @__PURE__ */ React29.createElement("div", {
|
|
2345
2791
|
style: {
|
|
2346
2792
|
"--line-thickness": `${strokeSize}px`,
|
|
2347
2793
|
"--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
@@ -2356,22 +2802,23 @@ var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineIns
|
|
|
2356
2802
|
};
|
|
2357
2803
|
|
|
2358
2804
|
// src/components/List/List.tsx
|
|
2359
|
-
var List =
|
|
2805
|
+
var List = composable4(({ children, ...props }, forwardedRef) => {
|
|
2360
2806
|
const { tx } = useThemeContext();
|
|
2361
2807
|
const density = useDensityContext(props.density);
|
|
2362
|
-
|
|
2808
|
+
const { className, ...rest } = composableProps10(props);
|
|
2809
|
+
return /* @__PURE__ */ React30.createElement(DensityProvider, {
|
|
2363
2810
|
density
|
|
2364
|
-
}, /* @__PURE__ */
|
|
2365
|
-
...
|
|
2366
|
-
className: tx("list.root", {},
|
|
2811
|
+
}, /* @__PURE__ */ React30.createElement(ListPrimitive, {
|
|
2812
|
+
...rest,
|
|
2813
|
+
className: tx("list.root", {}, className),
|
|
2367
2814
|
ref: forwardedRef
|
|
2368
2815
|
}, children));
|
|
2369
2816
|
});
|
|
2370
|
-
var ListItemEndcap = /* @__PURE__ */
|
|
2371
|
-
const Comp = asChild ?
|
|
2817
|
+
var ListItemEndcap = /* @__PURE__ */ forwardRef17(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
2818
|
+
const Comp = asChild ? Slot15 : Primitive15.div;
|
|
2372
2819
|
const density = useDensityContext();
|
|
2373
2820
|
const { tx } = useThemeContext();
|
|
2374
|
-
return /* @__PURE__ */
|
|
2821
|
+
return /* @__PURE__ */ React30.createElement(Comp, {
|
|
2375
2822
|
...!asChild && {
|
|
2376
2823
|
role: "none"
|
|
2377
2824
|
},
|
|
@@ -2385,45 +2832,44 @@ var ListItemEndcap = /* @__PURE__ */ forwardRef22(({ children, classNames, asChi
|
|
|
2385
2832
|
var MockListItemOpenTrigger = ({ classNames, ...props }) => {
|
|
2386
2833
|
const density = useDensityContext();
|
|
2387
2834
|
const { tx } = useThemeContext();
|
|
2388
|
-
return /* @__PURE__ */
|
|
2389
|
-
role: "none",
|
|
2835
|
+
return /* @__PURE__ */ React30.createElement("div", {
|
|
2390
2836
|
...props,
|
|
2391
2837
|
className: tx("list.item.openTrigger", {
|
|
2392
2838
|
density
|
|
2393
2839
|
}, classNames)
|
|
2394
2840
|
});
|
|
2395
2841
|
};
|
|
2396
|
-
var ListItemHeading = /* @__PURE__ */
|
|
2842
|
+
var ListItemHeading = /* @__PURE__ */ forwardRef17(({ children, classNames, ...props }, forwardedRef) => {
|
|
2397
2843
|
const { tx } = useThemeContext();
|
|
2398
2844
|
const density = useDensityContext();
|
|
2399
|
-
return /* @__PURE__ */
|
|
2845
|
+
return /* @__PURE__ */ React30.createElement(ListPrimitiveItemHeading, {
|
|
2400
2846
|
...props,
|
|
2401
2847
|
className: tx("list.item.heading", {
|
|
2402
2848
|
density
|
|
2403
2849
|
}, classNames),
|
|
2404
2850
|
ref: forwardedRef
|
|
2405
|
-
}, children);
|
|
2851
|
+
}, /* @__PURE__ */ React30.createElement("span", null, children));
|
|
2406
2852
|
});
|
|
2407
|
-
var ListItemOpenTrigger = /* @__PURE__ */
|
|
2853
|
+
var ListItemOpenTrigger = /* @__PURE__ */ forwardRef17(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
2408
2854
|
const { tx } = useThemeContext();
|
|
2409
2855
|
const density = useDensityContext();
|
|
2410
2856
|
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
2411
|
-
return /* @__PURE__ */
|
|
2857
|
+
return /* @__PURE__ */ React30.createElement(ListPrimitiveItemOpenTrigger, {
|
|
2412
2858
|
...props,
|
|
2413
2859
|
className: tx("list.item.openTrigger", {
|
|
2414
2860
|
density
|
|
2415
2861
|
}, classNames),
|
|
2416
2862
|
ref: forwardedRef
|
|
2417
|
-
}, children || /* @__PURE__ */
|
|
2863
|
+
}, children || /* @__PURE__ */ React30.createElement(Icon, {
|
|
2418
2864
|
size: 3,
|
|
2419
2865
|
icon: open ? "ph--caret-down--bold" : "ph--caret-right--bold",
|
|
2420
2866
|
classNames: tx("list.item.openTriggerIcon", {})
|
|
2421
2867
|
}));
|
|
2422
2868
|
});
|
|
2423
|
-
var ListItemRoot = /* @__PURE__ */
|
|
2869
|
+
var ListItemRoot = /* @__PURE__ */ forwardRef17(({ classNames, children, ...props }, forwardedRef) => {
|
|
2424
2870
|
const { tx } = useThemeContext();
|
|
2425
2871
|
const density = useDensityContext();
|
|
2426
|
-
return /* @__PURE__ */
|
|
2872
|
+
return /* @__PURE__ */ React30.createElement(ListPrimitiveItem, {
|
|
2427
2873
|
...props,
|
|
2428
2874
|
className: tx("list.item.root", {
|
|
2429
2875
|
density,
|
|
@@ -2443,10 +2889,10 @@ var ListItem = {
|
|
|
2443
2889
|
};
|
|
2444
2890
|
|
|
2445
2891
|
// src/components/List/Tree.tsx
|
|
2446
|
-
import
|
|
2892
|
+
import React32, { forwardRef as forwardRef18 } from "react";
|
|
2447
2893
|
|
|
2448
2894
|
// src/components/List/TreeDropIndicator.tsx
|
|
2449
|
-
import
|
|
2895
|
+
import React31 from "react";
|
|
2450
2896
|
var edgeToOrientationMap2 = {
|
|
2451
2897
|
"reorder-above": "sibling",
|
|
2452
2898
|
"reorder-below": "sibling",
|
|
@@ -2476,7 +2922,7 @@ var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
|
2476
2922
|
if (isBlocked) {
|
|
2477
2923
|
return null;
|
|
2478
2924
|
}
|
|
2479
|
-
return /* @__PURE__ */
|
|
2925
|
+
return /* @__PURE__ */ React31.createElement("div", {
|
|
2480
2926
|
style: {
|
|
2481
2927
|
"--line-thickness": `${strokeSize2}px`,
|
|
2482
2928
|
"--line-offset": `${lineOffset}`,
|
|
@@ -2491,22 +2937,22 @@ var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
|
2491
2937
|
};
|
|
2492
2938
|
|
|
2493
2939
|
// src/components/List/Tree.tsx
|
|
2494
|
-
var TreeRoot = /* @__PURE__ */
|
|
2495
|
-
return /* @__PURE__ */
|
|
2940
|
+
var TreeRoot = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
|
|
2941
|
+
return /* @__PURE__ */ React32.createElement(List, {
|
|
2496
2942
|
...props,
|
|
2497
2943
|
ref: forwardedRef
|
|
2498
2944
|
});
|
|
2499
2945
|
});
|
|
2500
|
-
var TreeBranch = /* @__PURE__ */
|
|
2946
|
+
var TreeBranch = /* @__PURE__ */ forwardRef18(({ __listScope, ...props }, forwardedRef) => {
|
|
2501
2947
|
const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
|
|
2502
|
-
return /* @__PURE__ */
|
|
2948
|
+
return /* @__PURE__ */ React32.createElement(List, {
|
|
2503
2949
|
...props,
|
|
2504
2950
|
"aria-labelledby": headingId,
|
|
2505
2951
|
ref: forwardedRef
|
|
2506
2952
|
});
|
|
2507
2953
|
});
|
|
2508
|
-
var TreeItemRoot = /* @__PURE__ */
|
|
2509
|
-
return /* @__PURE__ */
|
|
2954
|
+
var TreeItemRoot = /* @__PURE__ */ forwardRef18((props, forwardedRef) => {
|
|
2955
|
+
return /* @__PURE__ */ React32.createElement(ListItem.Root, {
|
|
2510
2956
|
role: "treeitem",
|
|
2511
2957
|
...props,
|
|
2512
2958
|
ref: forwardedRef
|
|
@@ -2532,20 +2978,24 @@ var TreeItem = {
|
|
|
2532
2978
|
// src/components/List/Treegrid.tsx
|
|
2533
2979
|
import { useFocusFinders } from "@fluentui/react-tabster";
|
|
2534
2980
|
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
2535
|
-
import { Primitive as
|
|
2536
|
-
import { Slot as
|
|
2981
|
+
import { Primitive as Primitive16 } from "@radix-ui/react-primitive";
|
|
2982
|
+
import { Slot as Slot16 } from "@radix-ui/react-slot";
|
|
2537
2983
|
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
2538
|
-
import
|
|
2984
|
+
import React33, { forwardRef as forwardRef19, useCallback as useCallback8 } from "react";
|
|
2985
|
+
import { composable as composable5, composableProps as composableProps11 } from "@dxos/ui-theme";
|
|
2539
2986
|
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
2540
2987
|
var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
|
|
2541
2988
|
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
2542
|
-
var
|
|
2543
|
-
var
|
|
2544
|
-
var TreegridRoot =
|
|
2989
|
+
var TREEGRID_PATH_SEPARATOR = "~";
|
|
2990
|
+
var TREEGRID_PARENT_OF_SEPARATOR = " ";
|
|
2991
|
+
var TreegridRoot = composable5(({ asChild, classNames, children, style, gridTemplateColumns, onKeyDown: onKeyDownProp, ...props }, forwardedRef) => {
|
|
2545
2992
|
const { tx } = useThemeContext();
|
|
2546
|
-
const
|
|
2993
|
+
const { className, role: _role, ...rest } = composableProps11(props, {
|
|
2994
|
+
classNames
|
|
2995
|
+
});
|
|
2996
|
+
const Comp = asChild ? Slot16 : Primitive16.div;
|
|
2547
2997
|
const { findFirstFocusable } = useFocusFinders();
|
|
2548
|
-
const handleKeyDown =
|
|
2998
|
+
const handleKeyDown = useCallback8((event) => {
|
|
2549
2999
|
switch (event.key) {
|
|
2550
3000
|
case "ArrowDown":
|
|
2551
3001
|
case "ArrowUp": {
|
|
@@ -2574,14 +3024,15 @@ var TreegridRoot = /* @__PURE__ */ forwardRef24(({ asChild, classNames, children
|
|
|
2574
3024
|
break;
|
|
2575
3025
|
}
|
|
2576
3026
|
}
|
|
2577
|
-
|
|
3027
|
+
onKeyDownProp?.(event);
|
|
2578
3028
|
}, [
|
|
2579
|
-
findFirstFocusable
|
|
3029
|
+
findFirstFocusable,
|
|
3030
|
+
onKeyDownProp
|
|
2580
3031
|
]);
|
|
2581
|
-
return /* @__PURE__ */
|
|
3032
|
+
return /* @__PURE__ */ React33.createElement(Comp, {
|
|
2582
3033
|
role: "treegrid",
|
|
2583
|
-
...
|
|
2584
|
-
className: tx("treegrid.root", {},
|
|
3034
|
+
...rest,
|
|
3035
|
+
className: tx("treegrid.root", {}, className),
|
|
2585
3036
|
style: {
|
|
2586
3037
|
...style,
|
|
2587
3038
|
gridTemplateColumns
|
|
@@ -2590,21 +3041,21 @@ var TreegridRoot = /* @__PURE__ */ forwardRef24(({ asChild, classNames, children
|
|
|
2590
3041
|
ref: forwardedRef
|
|
2591
3042
|
}, children);
|
|
2592
3043
|
});
|
|
2593
|
-
var TreegridRow = /* @__PURE__ */
|
|
3044
|
+
var TreegridRow = /* @__PURE__ */ forwardRef19(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
|
|
2594
3045
|
const { tx } = useThemeContext();
|
|
2595
|
-
const Comp = asChild ?
|
|
2596
|
-
const pathParts = id.split(
|
|
3046
|
+
const Comp = asChild ? Slot16 : Primitive16.div;
|
|
3047
|
+
const pathParts = id.split(TREEGRID_PATH_SEPARATOR);
|
|
2597
3048
|
const level = pathParts.length - 1;
|
|
2598
3049
|
const [open, onOpenChange] = useControllableState3({
|
|
2599
3050
|
prop: propsOpen,
|
|
2600
3051
|
onChange: propsOnOpenChange,
|
|
2601
3052
|
defaultProp: defaultOpen
|
|
2602
3053
|
});
|
|
2603
|
-
return /* @__PURE__ */
|
|
3054
|
+
return /* @__PURE__ */ React33.createElement(TreegridRowProvider, {
|
|
2604
3055
|
open,
|
|
2605
3056
|
onOpenChange,
|
|
2606
3057
|
scope: __treegridRowScope
|
|
2607
|
-
}, /* @__PURE__ */
|
|
3058
|
+
}, /* @__PURE__ */ React33.createElement(Comp, {
|
|
2608
3059
|
role: "row",
|
|
2609
3060
|
"aria-level": level,
|
|
2610
3061
|
className: tx("treegrid.row", {
|
|
@@ -2619,9 +3070,9 @@ var TreegridRow = /* @__PURE__ */ forwardRef24(({ __treegridRowScope, asChild, c
|
|
|
2619
3070
|
ref: forwardedRef
|
|
2620
3071
|
}, children));
|
|
2621
3072
|
});
|
|
2622
|
-
var TreegridCell = /* @__PURE__ */
|
|
3073
|
+
var TreegridCell = /* @__PURE__ */ forwardRef19(({ classNames, children, indent, ...props }, forwardedRef) => {
|
|
2623
3074
|
const { tx } = useThemeContext();
|
|
2624
|
-
return /* @__PURE__ */
|
|
3075
|
+
return /* @__PURE__ */ React33.createElement("div", {
|
|
2625
3076
|
role: "gridcell",
|
|
2626
3077
|
className: tx("treegrid.cell", {
|
|
2627
3078
|
indent
|
|
@@ -2633,28 +3084,24 @@ var TreegridCell = /* @__PURE__ */ forwardRef24(({ classNames, children, indent,
|
|
|
2633
3084
|
var Treegrid = {
|
|
2634
3085
|
Root: TreegridRoot,
|
|
2635
3086
|
Row: TreegridRow,
|
|
2636
|
-
Cell: TreegridCell
|
|
2637
|
-
PARENT_OF_SEPARATOR,
|
|
2638
|
-
PATH_SEPARATOR,
|
|
2639
|
-
createTreegridRowScope,
|
|
2640
|
-
useTreegridRowContext
|
|
3087
|
+
Cell: TreegridCell
|
|
2641
3088
|
};
|
|
2642
3089
|
|
|
2643
3090
|
// src/components/Main/Main.tsx
|
|
2644
|
-
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
2645
|
-
import { createContext as
|
|
3091
|
+
import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster";
|
|
3092
|
+
import { createContext as createContext9 } from "@radix-ui/react-context";
|
|
2646
3093
|
import { DialogContent as DialogContent2, Root as DialogRoot2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
2647
|
-
import { Primitive as
|
|
2648
|
-
import { Slot as
|
|
3094
|
+
import { Primitive as Primitive17 } from "@radix-ui/react-primitive";
|
|
3095
|
+
import { Slot as Slot17 } from "@radix-ui/react-slot";
|
|
2649
3096
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
2650
|
-
import
|
|
3097
|
+
import React34, { forwardRef as forwardRef20, useCallback as useCallback10, useEffect as useEffect6, useRef as useRef4, useState as useState9 } from "react";
|
|
2651
3098
|
import { addEventListener } from "@dxos/async";
|
|
2652
3099
|
import { log } from "@dxos/log";
|
|
2653
3100
|
import { useForwardedRef, useMediaQuery } from "@dxos/react-hooks";
|
|
2654
3101
|
import { osTranslations as osTranslations3 } from "@dxos/ui-theme";
|
|
2655
3102
|
|
|
2656
3103
|
// src/components/Main/useSwipeToDismiss.ts
|
|
2657
|
-
import { useCallback as
|
|
3104
|
+
import { useCallback as useCallback9, useEffect as useEffect5, useState as useState8 } from "react";
|
|
2658
3105
|
var useSwipeToDismiss = (ref, {
|
|
2659
3106
|
onDismiss,
|
|
2660
3107
|
dismissThreshold = 64,
|
|
@@ -2663,22 +3110,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
2663
3110
|
/* side = 'inline-start' */
|
|
2664
3111
|
}) => {
|
|
2665
3112
|
const $root = ref.current;
|
|
2666
|
-
const [motionState, setMotionState] =
|
|
2667
|
-
const [gestureStartX, setGestureStartX] =
|
|
2668
|
-
const setIdle =
|
|
3113
|
+
const [motionState, setMotionState] = useState8(0);
|
|
3114
|
+
const [gestureStartX, setGestureStartX] = useState8(0);
|
|
3115
|
+
const setIdle = useCallback9(() => {
|
|
2669
3116
|
setMotionState(0);
|
|
2670
3117
|
$root?.style.removeProperty("inset-inline-start");
|
|
2671
3118
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
2672
3119
|
}, [
|
|
2673
3120
|
$root
|
|
2674
3121
|
]);
|
|
2675
|
-
const setFollowing =
|
|
3122
|
+
const setFollowing = useCallback9(() => {
|
|
2676
3123
|
setMotionState(2);
|
|
2677
3124
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
2678
3125
|
}, [
|
|
2679
3126
|
$root
|
|
2680
3127
|
]);
|
|
2681
|
-
const handlePointerDown =
|
|
3128
|
+
const handlePointerDown = useCallback9(({ screenX }) => {
|
|
2682
3129
|
if (motionState === 0) {
|
|
2683
3130
|
setMotionState(1);
|
|
2684
3131
|
setGestureStartX(screenX);
|
|
@@ -2686,7 +3133,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2686
3133
|
}, [
|
|
2687
3134
|
motionState
|
|
2688
3135
|
]);
|
|
2689
|
-
const handlePointerMove =
|
|
3136
|
+
const handlePointerMove = useCallback9(({ screenX }) => {
|
|
2690
3137
|
if ($root) {
|
|
2691
3138
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
2692
3139
|
switch (motionState) {
|
|
@@ -2710,12 +3157,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
2710
3157
|
motionState,
|
|
2711
3158
|
gestureStartX
|
|
2712
3159
|
]);
|
|
2713
|
-
const handlePointerUp =
|
|
3160
|
+
const handlePointerUp = useCallback9(() => {
|
|
2714
3161
|
setIdle();
|
|
2715
3162
|
}, [
|
|
2716
3163
|
setIdle
|
|
2717
3164
|
]);
|
|
2718
|
-
|
|
3165
|
+
useEffect5(() => {
|
|
2719
3166
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
2720
3167
|
return () => {
|
|
2721
3168
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -2724,7 +3171,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2724
3171
|
$root,
|
|
2725
3172
|
handlePointerDown
|
|
2726
3173
|
]);
|
|
2727
|
-
|
|
3174
|
+
useEffect5(() => {
|
|
2728
3175
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
2729
3176
|
return () => {
|
|
2730
3177
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -2733,7 +3180,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2733
3180
|
$root,
|
|
2734
3181
|
handlePointerMove
|
|
2735
3182
|
]);
|
|
2736
|
-
|
|
3183
|
+
useEffect5(() => {
|
|
2737
3184
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
2738
3185
|
return () => {
|
|
2739
3186
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -2756,7 +3203,7 @@ var handleOpenAutoFocus = (event) => {
|
|
|
2756
3203
|
};
|
|
2757
3204
|
var landmarkAttr = "data-main-landmark";
|
|
2758
3205
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
2759
|
-
const handleKeyDown =
|
|
3206
|
+
const handleKeyDown = useCallback10((event) => {
|
|
2760
3207
|
const target = event.target;
|
|
2761
3208
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
2762
3209
|
event.preventDefault();
|
|
@@ -2770,7 +3217,7 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2770
3217
|
}, [
|
|
2771
3218
|
propsOnKeyDown
|
|
2772
3219
|
]);
|
|
2773
|
-
const focusableGroupAttrs =
|
|
3220
|
+
const focusableGroupAttrs = useFocusableGroup2({
|
|
2774
3221
|
tabBehavior: "limited",
|
|
2775
3222
|
ignoreDefaultKeydown: {
|
|
2776
3223
|
Tab: true
|
|
@@ -2783,25 +3230,15 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2783
3230
|
...focusableGroupAttrs
|
|
2784
3231
|
};
|
|
2785
3232
|
};
|
|
2786
|
-
var [MainProvider, useMainContext] =
|
|
3233
|
+
var [MainProvider, useMainContext] = createContext9(MAIN_NAME, {
|
|
2787
3234
|
resizing: false,
|
|
2788
3235
|
navigationSidebarState: "closed",
|
|
2789
3236
|
setNavigationSidebarState: (_nextState) => {
|
|
2790
|
-
log.warn("Not initialized", void 0, {
|
|
2791
|
-
F: __dxlog_file,
|
|
2792
|
-
L: 111,
|
|
2793
|
-
S: void 0,
|
|
2794
|
-
C: (f, a) => f(...a)
|
|
2795
|
-
});
|
|
3237
|
+
log.warn("Not initialized", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 67, S: void 0 });
|
|
2796
3238
|
},
|
|
2797
3239
|
complementarySidebarState: "closed",
|
|
2798
3240
|
setComplementarySidebarState: (_nextState) => {
|
|
2799
|
-
log.warn("Not initialized", void 0, {
|
|
2800
|
-
F: __dxlog_file,
|
|
2801
|
-
L: 116,
|
|
2802
|
-
S: void 0,
|
|
2803
|
-
C: (f, a) => f(...a)
|
|
2804
|
-
});
|
|
3241
|
+
log.warn("Not initialized", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 71, S: void 0 });
|
|
2805
3242
|
}
|
|
2806
3243
|
});
|
|
2807
3244
|
var useSidebars = (consumerName) => {
|
|
@@ -2809,22 +3246,22 @@ var useSidebars = (consumerName) => {
|
|
|
2809
3246
|
return {
|
|
2810
3247
|
navigationSidebarState,
|
|
2811
3248
|
setNavigationSidebarState,
|
|
2812
|
-
toggleNavigationSidebar:
|
|
3249
|
+
toggleNavigationSidebar: useCallback10(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2813
3250
|
navigationSidebarState,
|
|
2814
3251
|
setNavigationSidebarState
|
|
2815
3252
|
]),
|
|
2816
|
-
openNavigationSidebar:
|
|
2817
|
-
collapseNavigationSidebar:
|
|
2818
|
-
closeNavigationSidebar:
|
|
3253
|
+
openNavigationSidebar: useCallback10(() => setNavigationSidebarState("expanded"), []),
|
|
3254
|
+
collapseNavigationSidebar: useCallback10(() => setNavigationSidebarState("collapsed"), []),
|
|
3255
|
+
closeNavigationSidebar: useCallback10(() => setNavigationSidebarState("closed"), []),
|
|
2819
3256
|
complementarySidebarState,
|
|
2820
3257
|
setComplementarySidebarState,
|
|
2821
|
-
toggleComplementarySidebar:
|
|
3258
|
+
toggleComplementarySidebar: useCallback10(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2822
3259
|
complementarySidebarState,
|
|
2823
3260
|
setComplementarySidebarState
|
|
2824
3261
|
]),
|
|
2825
|
-
openComplementarySidebar:
|
|
2826
|
-
collapseComplementarySidebar:
|
|
2827
|
-
closeComplementarySidebar:
|
|
3262
|
+
openComplementarySidebar: useCallback10(() => setComplementarySidebarState("expanded"), []),
|
|
3263
|
+
collapseComplementarySidebar: useCallback10(() => setComplementarySidebarState("collapsed"), []),
|
|
3264
|
+
closeComplementarySidebar: useCallback10(() => setComplementarySidebarState("closed"), [])
|
|
2828
3265
|
};
|
|
2829
3266
|
};
|
|
2830
3267
|
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState = "closed", onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState = "closed", onComplementarySidebarStateChange, children, ...props }) => {
|
|
@@ -2839,9 +3276,9 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2839
3276
|
defaultProp: defaultComplementarySidebarState,
|
|
2840
3277
|
onChange: onComplementarySidebarStateChange
|
|
2841
3278
|
});
|
|
2842
|
-
const [resizing, setResizing] =
|
|
2843
|
-
const resizeInterval =
|
|
2844
|
-
|
|
3279
|
+
const [resizing, setResizing] = useState9(false);
|
|
3280
|
+
const resizeInterval = useRef4(null);
|
|
3281
|
+
useEffect6(() => addEventListener(window, "resize", () => {
|
|
2845
3282
|
setResizing(true);
|
|
2846
3283
|
if (resizeInterval.current) {
|
|
2847
3284
|
clearTimeout(resizeInterval.current);
|
|
@@ -2851,7 +3288,7 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2851
3288
|
resizeInterval.current = null;
|
|
2852
3289
|
}, 3e3);
|
|
2853
3290
|
}), []);
|
|
2854
|
-
return /* @__PURE__ */
|
|
3291
|
+
return /* @__PURE__ */ React34.createElement(MainProvider, {
|
|
2855
3292
|
...props,
|
|
2856
3293
|
navigationSidebarState,
|
|
2857
3294
|
setNavigationSidebarState,
|
|
@@ -2861,11 +3298,11 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2861
3298
|
}, children);
|
|
2862
3299
|
};
|
|
2863
3300
|
MainRoot.displayName = MAIN_ROOT_NAME;
|
|
2864
|
-
var MainOverlay = /* @__PURE__ */
|
|
3301
|
+
var MainOverlay = /* @__PURE__ */ forwardRef20(({ classNames, ...props }, forwardedRef) => {
|
|
2865
3302
|
const [isLg] = useMediaQuery("lg");
|
|
2866
3303
|
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_OVERLAY_NAME);
|
|
2867
3304
|
const { tx } = useThemeContext();
|
|
2868
|
-
return /* @__PURE__ */
|
|
3305
|
+
return /* @__PURE__ */ React34.createElement("div", {
|
|
2869
3306
|
...props,
|
|
2870
3307
|
onClick: () => {
|
|
2871
3308
|
setNavigationSidebarState("collapsed");
|
|
@@ -2882,16 +3319,16 @@ var MainOverlay = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwar
|
|
|
2882
3319
|
});
|
|
2883
3320
|
});
|
|
2884
3321
|
MainOverlay.displayName = MAIN_OVERLAY_NAME;
|
|
2885
|
-
var MainSidebar = /* @__PURE__ */
|
|
3322
|
+
var MainSidebar = /* @__PURE__ */ forwardRef20(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
2886
3323
|
const [isLg] = useMediaQuery("lg");
|
|
2887
3324
|
const { tx } = useThemeContext();
|
|
2888
3325
|
const { t } = useTranslation(osTranslations3);
|
|
2889
3326
|
const ref = useForwardedRef(forwardedRef);
|
|
2890
|
-
const noopRef =
|
|
3327
|
+
const noopRef = useRef4(null);
|
|
2891
3328
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2892
3329
|
onDismiss: () => onStateChange?.("closed")
|
|
2893
3330
|
});
|
|
2894
|
-
const handleKeyDown =
|
|
3331
|
+
const handleKeyDown = useCallback10((event) => {
|
|
2895
3332
|
const focusGroupParent = event.target.closest("[data-tabster]");
|
|
2896
3333
|
if (event.key === "Escape" && focusGroupParent) {
|
|
2897
3334
|
event.preventDefault();
|
|
@@ -2902,14 +3339,14 @@ var MainSidebar = /* @__PURE__ */ forwardRef25(({ classNames, children, swipeToD
|
|
|
2902
3339
|
}, [
|
|
2903
3340
|
props.onKeyDown
|
|
2904
3341
|
]);
|
|
2905
|
-
const
|
|
2906
|
-
return /* @__PURE__ */
|
|
3342
|
+
const Root14 = isLg ? Primitive17.div : DialogContent2;
|
|
3343
|
+
return /* @__PURE__ */ React34.createElement(DialogRoot2, {
|
|
2907
3344
|
open: state !== "closed",
|
|
2908
3345
|
"aria-label": toLocalizedString(label, t),
|
|
2909
3346
|
modal: false
|
|
2910
|
-
}, !isLg && /* @__PURE__ */
|
|
3347
|
+
}, !isLg && /* @__PURE__ */ React34.createElement(DialogTitle2, {
|
|
2911
3348
|
className: "sr-only"
|
|
2912
|
-
}, toLocalizedString(label, t)), /* @__PURE__ */
|
|
3349
|
+
}, toLocalizedString(label, t)), /* @__PURE__ */ React34.createElement(Root14, {
|
|
2913
3350
|
...!isLg && {
|
|
2914
3351
|
forceMount: true,
|
|
2915
3352
|
tabIndex: -1,
|
|
@@ -2927,10 +3364,10 @@ var MainSidebar = /* @__PURE__ */ forwardRef25(({ classNames, children, swipeToD
|
|
|
2927
3364
|
ref
|
|
2928
3365
|
}, children));
|
|
2929
3366
|
});
|
|
2930
|
-
var MainNavigationSidebar = /* @__PURE__ */
|
|
3367
|
+
var MainNavigationSidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2931
3368
|
const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
2932
3369
|
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
2933
|
-
return /* @__PURE__ */
|
|
3370
|
+
return /* @__PURE__ */ React34.createElement(MainSidebar, {
|
|
2934
3371
|
...mover,
|
|
2935
3372
|
...props,
|
|
2936
3373
|
state: navigationSidebarState,
|
|
@@ -2941,10 +3378,10 @@ var MainNavigationSidebar = /* @__PURE__ */ forwardRef25((props, forwardedRef) =
|
|
|
2941
3378
|
});
|
|
2942
3379
|
});
|
|
2943
3380
|
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
2944
|
-
var MainComplementarySidebar = /* @__PURE__ */
|
|
3381
|
+
var MainComplementarySidebar = /* @__PURE__ */ forwardRef20((props, forwardedRef) => {
|
|
2945
3382
|
const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
2946
3383
|
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
2947
|
-
return /* @__PURE__ */
|
|
3384
|
+
return /* @__PURE__ */ React34.createElement(MainSidebar, {
|
|
2948
3385
|
...mover,
|
|
2949
3386
|
...props,
|
|
2950
3387
|
state: complementarySidebarState,
|
|
@@ -2955,12 +3392,12 @@ var MainComplementarySidebar = /* @__PURE__ */ forwardRef25((props, forwardedRef
|
|
|
2955
3392
|
});
|
|
2956
3393
|
});
|
|
2957
3394
|
MainComplementarySidebar.displayName = COMPLEMENTARY_SIDEBAR_NAME;
|
|
2958
|
-
var MainContent = /* @__PURE__ */
|
|
3395
|
+
var MainContent = /* @__PURE__ */ forwardRef20(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
2959
3396
|
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2960
3397
|
const { tx } = useThemeContext();
|
|
2961
|
-
const Comp = asChild ?
|
|
3398
|
+
const Comp = asChild ? Slot17 : role ? Primitive17.div : "main";
|
|
2962
3399
|
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
2963
|
-
return /* @__PURE__ */
|
|
3400
|
+
return /* @__PURE__ */ React34.createElement(Comp, {
|
|
2964
3401
|
...handlesFocus && {
|
|
2965
3402
|
...mover
|
|
2966
3403
|
},
|
|
@@ -2986,11 +3423,13 @@ var Main = {
|
|
|
2986
3423
|
};
|
|
2987
3424
|
|
|
2988
3425
|
// src/components/Message/Message.tsx
|
|
2989
|
-
import { createContext as
|
|
2990
|
-
import { Primitive as
|
|
2991
|
-
import { Slot as
|
|
2992
|
-
import
|
|
3426
|
+
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
3427
|
+
import { Primitive as Primitive18 } from "@radix-ui/react-primitive";
|
|
3428
|
+
import { Slot as Slot18 } from "@radix-ui/react-slot";
|
|
3429
|
+
import React35, { forwardRef as forwardRef21 } from "react";
|
|
3430
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
2993
3431
|
import { useId as useId3 } from "@dxos/react-hooks";
|
|
3432
|
+
import { translationKey as translationKey3 } from "#translations";
|
|
2994
3433
|
var messageIcons = {
|
|
2995
3434
|
success: "ph--check-circle--duotone",
|
|
2996
3435
|
info: "ph--info--duotone",
|
|
@@ -2999,18 +3438,18 @@ var messageIcons = {
|
|
|
2999
3438
|
neutral: "ph--info--duotone"
|
|
3000
3439
|
};
|
|
3001
3440
|
var MESSAGE_NAME = "Message";
|
|
3002
|
-
var [MessageProvider, useMessageContext] =
|
|
3003
|
-
var MessageRoot = /* @__PURE__ */
|
|
3441
|
+
var [MessageProvider, useMessageContext] = createContext10(MESSAGE_NAME);
|
|
3442
|
+
var MessageRoot = /* @__PURE__ */ forwardRef21(({ asChild, valence = "neutral", elevation: propsElevation, classNames, titleId: propsTitleId, descriptionId: propsDescriptionId, children, ...props }, forwardedRef) => {
|
|
3004
3443
|
const { tx } = useThemeContext();
|
|
3005
3444
|
const titleId = useId3("message__title", propsTitleId);
|
|
3006
3445
|
const descriptionId = useId3("message__description", propsDescriptionId);
|
|
3007
3446
|
const elevation = useElevationContext(propsElevation);
|
|
3008
|
-
const Comp = asChild ?
|
|
3009
|
-
return /* @__PURE__ */
|
|
3447
|
+
const Comp = asChild ? Slot18 : Primitive18.div;
|
|
3448
|
+
return /* @__PURE__ */ React35.createElement(MessageProvider, {
|
|
3010
3449
|
titleId,
|
|
3011
3450
|
descriptionId,
|
|
3012
3451
|
valence
|
|
3013
|
-
}, /* @__PURE__ */
|
|
3452
|
+
}, /* @__PURE__ */ React35.createElement(Comp, {
|
|
3014
3453
|
role: valence === "neutral" ? "paragraph" : "alert",
|
|
3015
3454
|
...props,
|
|
3016
3455
|
className: tx("message.root", {
|
|
@@ -3024,33 +3463,38 @@ var MessageRoot = /* @__PURE__ */ forwardRef26(({ asChild, valence = "neutral",
|
|
|
3024
3463
|
});
|
|
3025
3464
|
MessageRoot.displayName = MESSAGE_NAME;
|
|
3026
3465
|
var MESSAGE_TITLE_NAME = "MessageTitle";
|
|
3027
|
-
var MessageTitle = /* @__PURE__ */
|
|
3466
|
+
var MessageTitle = /* @__PURE__ */ forwardRef21(({ classNames, children, icon: iconProp, onClose }, forwardedRef) => {
|
|
3467
|
+
const { t } = useTranslation4(translationKey3);
|
|
3028
3468
|
const { tx } = useThemeContext();
|
|
3029
3469
|
const { titleId, valence } = useMessageContext(MESSAGE_TITLE_NAME);
|
|
3030
|
-
const Comp = asChild ? Slot15 : Primitive15.h2;
|
|
3031
3470
|
const icon = iconProp ?? messageIcons[valence];
|
|
3032
|
-
return /* @__PURE__ */
|
|
3033
|
-
...props,
|
|
3471
|
+
return /* @__PURE__ */ React35.createElement("div", {
|
|
3034
3472
|
className: tx("message.header", {}, classNames),
|
|
3035
3473
|
id: titleId,
|
|
3036
3474
|
ref: forwardedRef
|
|
3037
|
-
},
|
|
3038
|
-
|
|
3039
|
-
icon,
|
|
3040
|
-
classNames: tx("message.icon", {
|
|
3475
|
+
}, icon && /* @__PURE__ */ React35.createElement("div", {
|
|
3476
|
+
className: tx("message.icon", {
|
|
3041
3477
|
valence
|
|
3042
3478
|
})
|
|
3043
|
-
}
|
|
3479
|
+
}, /* @__PURE__ */ React35.createElement(Icon, {
|
|
3480
|
+
icon
|
|
3481
|
+
})), /* @__PURE__ */ React35.createElement("h2", {
|
|
3044
3482
|
className: tx("message.title", {}, classNames)
|
|
3045
|
-
}, children)
|
|
3483
|
+
}, children), onClose && /* @__PURE__ */ React35.createElement(IconButton, {
|
|
3484
|
+
variant: "ghost",
|
|
3485
|
+
icon: "ph--x--regular",
|
|
3486
|
+
iconOnly: true,
|
|
3487
|
+
label: t("toolbar-close.label"),
|
|
3488
|
+
onClick: onClose
|
|
3489
|
+
}));
|
|
3046
3490
|
});
|
|
3047
3491
|
MessageTitle.displayName = MESSAGE_TITLE_NAME;
|
|
3048
3492
|
var MESSAGE_CONTENT_NAME = "MessageContent";
|
|
3049
|
-
var MessageContent = /* @__PURE__ */
|
|
3493
|
+
var MessageContent = /* @__PURE__ */ forwardRef21(({ asChild, classNames, children, ...props }, forwardedRef) => {
|
|
3050
3494
|
const { tx } = useThemeContext();
|
|
3051
3495
|
const { descriptionId } = useMessageContext(MESSAGE_CONTENT_NAME);
|
|
3052
|
-
const Comp = asChild ?
|
|
3053
|
-
return /* @__PURE__ */
|
|
3496
|
+
const Comp = asChild ? Slot18 : Primitive18.p;
|
|
3497
|
+
return /* @__PURE__ */ React35.createElement(Comp, {
|
|
3054
3498
|
...props,
|
|
3055
3499
|
className: tx("message.content", {}, classNames),
|
|
3056
3500
|
id: descriptionId,
|
|
@@ -3067,7 +3511,7 @@ var Callout = Message;
|
|
|
3067
3511
|
|
|
3068
3512
|
// src/components/Popover/Popover.tsx
|
|
3069
3513
|
import { composeEventHandlers as composeEventHandlers2 } from "@radix-ui/primitive";
|
|
3070
|
-
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
3514
|
+
import { useComposedRefs as useComposedRefs2 } from "@radix-ui/react-compose-refs";
|
|
3071
3515
|
import { createContextScope as createContextScope3 } from "@radix-ui/react-context";
|
|
3072
3516
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
3073
3517
|
import { useFocusGuards } from "@radix-ui/react-focus-guards";
|
|
@@ -3077,11 +3521,11 @@ import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
|
3077
3521
|
import { createPopperScope } from "@radix-ui/react-popper";
|
|
3078
3522
|
import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
|
|
3079
3523
|
import { Presence } from "@radix-ui/react-presence";
|
|
3080
|
-
import { Primitive as
|
|
3081
|
-
import { Slot as
|
|
3524
|
+
import { Primitive as Primitive19 } from "@radix-ui/react-primitive";
|
|
3525
|
+
import { Slot as Slot19 } from "@radix-ui/react-slot";
|
|
3082
3526
|
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
3083
3527
|
import { hideOthers } from "aria-hidden";
|
|
3084
|
-
import
|
|
3528
|
+
import React36, { forwardRef as forwardRef22, useCallback as useCallback11, useEffect as useEffect7, useMemo as useMemo7, useRef as useRef5, useState as useState10 } from "react";
|
|
3085
3529
|
import { RemoveScroll } from "react-remove-scroll";
|
|
3086
3530
|
var POPOVER_NAME = "Popover";
|
|
3087
3531
|
var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
|
|
@@ -3092,43 +3536,43 @@ var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
|
3092
3536
|
var PopoverRoot = (props) => {
|
|
3093
3537
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
3094
3538
|
const popperScope = usePopperScope(__scopePopover);
|
|
3095
|
-
const triggerRef =
|
|
3096
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
3539
|
+
const triggerRef = useRef5(null);
|
|
3540
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState10(false);
|
|
3097
3541
|
const [open = false, setOpen] = useControllableState5({
|
|
3098
3542
|
prop: openProp,
|
|
3099
3543
|
defaultProp: defaultOpen,
|
|
3100
3544
|
onChange: onOpenChange
|
|
3101
3545
|
});
|
|
3102
|
-
return /* @__PURE__ */
|
|
3546
|
+
return /* @__PURE__ */ React36.createElement(PopperPrimitive.Root, popperScope, /* @__PURE__ */ React36.createElement(PopoverProvider, {
|
|
3103
3547
|
scope: __scopePopover,
|
|
3104
3548
|
contentId: useId4(),
|
|
3105
3549
|
triggerRef,
|
|
3106
3550
|
open,
|
|
3107
3551
|
onOpenChange: setOpen,
|
|
3108
|
-
onOpenToggle:
|
|
3552
|
+
onOpenToggle: useCallback11(() => setOpen((prevOpen) => !prevOpen), [
|
|
3109
3553
|
setOpen
|
|
3110
3554
|
]),
|
|
3111
3555
|
hasCustomAnchor,
|
|
3112
|
-
onCustomAnchorAdd:
|
|
3113
|
-
onCustomAnchorRemove:
|
|
3556
|
+
onCustomAnchorAdd: useCallback11(() => setHasCustomAnchor(true), []),
|
|
3557
|
+
onCustomAnchorRemove: useCallback11(() => setHasCustomAnchor(false), []),
|
|
3114
3558
|
modal
|
|
3115
3559
|
}, children));
|
|
3116
3560
|
};
|
|
3117
3561
|
PopoverRoot.displayName = POPOVER_NAME;
|
|
3118
3562
|
var ANCHOR_NAME = "PopoverAnchor";
|
|
3119
|
-
var PopoverAnchor = /* @__PURE__ */
|
|
3563
|
+
var PopoverAnchor = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3120
3564
|
const { __scopePopover, ...anchorProps } = props;
|
|
3121
3565
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
3122
3566
|
const popperScope = usePopperScope(__scopePopover);
|
|
3123
3567
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
3124
|
-
|
|
3568
|
+
useEffect7(() => {
|
|
3125
3569
|
onCustomAnchorAdd();
|
|
3126
3570
|
return () => onCustomAnchorRemove();
|
|
3127
3571
|
}, [
|
|
3128
3572
|
onCustomAnchorAdd,
|
|
3129
3573
|
onCustomAnchorRemove
|
|
3130
3574
|
]);
|
|
3131
|
-
return /* @__PURE__ */
|
|
3575
|
+
return /* @__PURE__ */ React36.createElement(PopperPrimitive.Anchor, {
|
|
3132
3576
|
...popperScope,
|
|
3133
3577
|
...anchorProps,
|
|
3134
3578
|
ref: forwardedRef
|
|
@@ -3136,13 +3580,13 @@ var PopoverAnchor = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3136
3580
|
});
|
|
3137
3581
|
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
3138
3582
|
var TRIGGER_NAME2 = "PopoverTrigger";
|
|
3139
|
-
var PopoverTrigger = /* @__PURE__ */
|
|
3583
|
+
var PopoverTrigger = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3140
3584
|
const { __scopePopover, asChild, ...triggerProps } = props;
|
|
3141
3585
|
const context = usePopoverContext(TRIGGER_NAME2, __scopePopover);
|
|
3142
3586
|
const popperScope = usePopperScope(__scopePopover);
|
|
3143
|
-
const composedTriggerRef =
|
|
3144
|
-
const Comp = asChild ?
|
|
3145
|
-
const trigger = /* @__PURE__ */
|
|
3587
|
+
const composedTriggerRef = useComposedRefs2(forwardedRef, context.triggerRef);
|
|
3588
|
+
const Comp = asChild ? Slot19 : Primitive19.button;
|
|
3589
|
+
const trigger = /* @__PURE__ */ React36.createElement(Comp, {
|
|
3146
3590
|
type: "button",
|
|
3147
3591
|
"aria-haspopup": "dialog",
|
|
3148
3592
|
"aria-expanded": context.open,
|
|
@@ -3152,7 +3596,7 @@ var PopoverTrigger = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3152
3596
|
ref: composedTriggerRef,
|
|
3153
3597
|
onClick: composeEventHandlers2(props.onClick, context.onOpenToggle)
|
|
3154
3598
|
});
|
|
3155
|
-
return context.hasCustomAnchor ? trigger : /* @__PURE__ */
|
|
3599
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React36.createElement(PopperPrimitive.Anchor, {
|
|
3156
3600
|
asChild: true,
|
|
3157
3601
|
...popperScope
|
|
3158
3602
|
}, trigger);
|
|
@@ -3163,12 +3607,12 @@ var PopoverVirtualTrigger = (props) => {
|
|
|
3163
3607
|
const { __scopePopover, virtualRef } = props;
|
|
3164
3608
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
3165
3609
|
const popperScope = usePopperScope(__scopePopover);
|
|
3166
|
-
|
|
3610
|
+
useEffect7(() => {
|
|
3167
3611
|
if (virtualRef.current) {
|
|
3168
3612
|
context.triggerRef.current = virtualRef.current;
|
|
3169
3613
|
}
|
|
3170
3614
|
});
|
|
3171
|
-
return /* @__PURE__ */
|
|
3615
|
+
return /* @__PURE__ */ React36.createElement(PopperPrimitive.Anchor, {
|
|
3172
3616
|
...popperScope,
|
|
3173
3617
|
virtualRef
|
|
3174
3618
|
});
|
|
@@ -3181,48 +3625,48 @@ var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME2, {
|
|
|
3181
3625
|
var PopoverPortal = (props) => {
|
|
3182
3626
|
const { __scopePopover, forceMount, children, container } = props;
|
|
3183
3627
|
const context = usePopoverContext(PORTAL_NAME2, __scopePopover);
|
|
3184
|
-
return /* @__PURE__ */
|
|
3628
|
+
return /* @__PURE__ */ React36.createElement(PortalProvider, {
|
|
3185
3629
|
scope: __scopePopover,
|
|
3186
3630
|
forceMount
|
|
3187
|
-
}, /* @__PURE__ */
|
|
3631
|
+
}, /* @__PURE__ */ React36.createElement(Presence, {
|
|
3188
3632
|
present: forceMount || context.open
|
|
3189
|
-
}, /* @__PURE__ */
|
|
3633
|
+
}, /* @__PURE__ */ React36.createElement(PortalPrimitive, {
|
|
3190
3634
|
asChild: true,
|
|
3191
3635
|
container
|
|
3192
3636
|
}, children)));
|
|
3193
3637
|
};
|
|
3194
3638
|
PopoverPortal.displayName = PORTAL_NAME2;
|
|
3195
3639
|
var CONTENT_NAME2 = "PopoverContent";
|
|
3196
|
-
var PopoverContent = /* @__PURE__ */
|
|
3640
|
+
var PopoverContent = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3197
3641
|
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopePopover);
|
|
3198
3642
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
3199
3643
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
3200
|
-
return /* @__PURE__ */
|
|
3644
|
+
return /* @__PURE__ */ React36.createElement(Presence, {
|
|
3201
3645
|
present: forceMount || context.open
|
|
3202
|
-
}, context.modal ? /* @__PURE__ */
|
|
3646
|
+
}, context.modal ? /* @__PURE__ */ React36.createElement(PopoverContentModal, {
|
|
3203
3647
|
...contentProps,
|
|
3204
3648
|
ref: forwardedRef
|
|
3205
|
-
}) : /* @__PURE__ */
|
|
3649
|
+
}) : /* @__PURE__ */ React36.createElement(PopoverContentNonModal, {
|
|
3206
3650
|
...contentProps,
|
|
3207
3651
|
ref: forwardedRef
|
|
3208
3652
|
}));
|
|
3209
3653
|
});
|
|
3210
3654
|
PopoverContent.displayName = CONTENT_NAME2;
|
|
3211
|
-
var PopoverContentModal = /* @__PURE__ */
|
|
3655
|
+
var PopoverContentModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3212
3656
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
3213
|
-
const contentRef =
|
|
3214
|
-
const composedRefs =
|
|
3215
|
-
const isRightClickOutsideRef =
|
|
3216
|
-
|
|
3657
|
+
const contentRef = useRef5(null);
|
|
3658
|
+
const composedRefs = useComposedRefs2(forwardedRef, contentRef);
|
|
3659
|
+
const isRightClickOutsideRef = useRef5(false);
|
|
3660
|
+
useEffect7(() => {
|
|
3217
3661
|
const content = contentRef.current;
|
|
3218
3662
|
if (content) {
|
|
3219
3663
|
return hideOthers(content);
|
|
3220
3664
|
}
|
|
3221
3665
|
}, []);
|
|
3222
|
-
return /* @__PURE__ */
|
|
3223
|
-
as:
|
|
3666
|
+
return /* @__PURE__ */ React36.createElement(RemoveScroll, {
|
|
3667
|
+
as: Slot19,
|
|
3224
3668
|
allowPinchZoom: true
|
|
3225
|
-
}, /* @__PURE__ */
|
|
3669
|
+
}, /* @__PURE__ */ React36.createElement(PopoverContentImpl, {
|
|
3226
3670
|
...props,
|
|
3227
3671
|
ref: composedRefs,
|
|
3228
3672
|
// Make sure we're not trapping once it's been closed (closed !== unmounted when animating out).
|
|
@@ -3249,11 +3693,11 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef27((props, forwardedRef) =>
|
|
|
3249
3693
|
})
|
|
3250
3694
|
}));
|
|
3251
3695
|
});
|
|
3252
|
-
var PopoverContentNonModal = /* @__PURE__ */
|
|
3696
|
+
var PopoverContentNonModal = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3253
3697
|
const context = usePopoverContext(CONTENT_NAME2, props.__scopePopover);
|
|
3254
|
-
const hasInteractedOutsideRef =
|
|
3255
|
-
const hasPointerDownOutsideRef =
|
|
3256
|
-
return /* @__PURE__ */
|
|
3698
|
+
const hasInteractedOutsideRef = useRef5(false);
|
|
3699
|
+
const hasPointerDownOutsideRef = useRef5(false);
|
|
3700
|
+
return /* @__PURE__ */ React36.createElement(PopoverContentImpl, {
|
|
3257
3701
|
...props,
|
|
3258
3702
|
ref: forwardedRef,
|
|
3259
3703
|
trapFocus: false,
|
|
@@ -3288,7 +3732,7 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef27((props, forwardedRef)
|
|
|
3288
3732
|
}
|
|
3289
3733
|
});
|
|
3290
3734
|
});
|
|
3291
|
-
var PopoverContentImpl = /* @__PURE__ */
|
|
3735
|
+
var PopoverContentImpl = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3292
3736
|
const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, collisionBoundary, classNames, ...contentProps } = props;
|
|
3293
3737
|
const context = usePopoverContext(CONTENT_NAME2, __scopePopover);
|
|
3294
3738
|
const popperScope = usePopperScope(__scopePopover);
|
|
@@ -3296,7 +3740,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3296
3740
|
const elevation = useElevationContext();
|
|
3297
3741
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
3298
3742
|
useFocusGuards();
|
|
3299
|
-
const computedCollisionBoundary =
|
|
3743
|
+
const computedCollisionBoundary = useMemo7(() => {
|
|
3300
3744
|
const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
|
|
3301
3745
|
return closestBoundary ? Array.isArray(collisionBoundary) ? [
|
|
3302
3746
|
closestBoundary,
|
|
@@ -3312,13 +3756,13 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3312
3756
|
collisionBoundary,
|
|
3313
3757
|
context.triggerRef.current
|
|
3314
3758
|
]);
|
|
3315
|
-
return /* @__PURE__ */
|
|
3759
|
+
return /* @__PURE__ */ React36.createElement(FocusScope, {
|
|
3316
3760
|
asChild: true,
|
|
3317
3761
|
loop: true,
|
|
3318
3762
|
trapped: trapFocus,
|
|
3319
3763
|
onMountAutoFocus: onOpenAutoFocus,
|
|
3320
3764
|
onUnmountAutoFocus: onCloseAutoFocus
|
|
3321
|
-
}, /* @__PURE__ */
|
|
3765
|
+
}, /* @__PURE__ */ React36.createElement(DismissableLayer, {
|
|
3322
3766
|
asChild: true,
|
|
3323
3767
|
disableOutsidePointerEvents,
|
|
3324
3768
|
onInteractOutside,
|
|
@@ -3326,7 +3770,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3326
3770
|
onPointerDownOutside,
|
|
3327
3771
|
onFocusOutside,
|
|
3328
3772
|
onDismiss: () => context.onOpenChange(false)
|
|
3329
|
-
}, /* @__PURE__ */
|
|
3773
|
+
}, /* @__PURE__ */ React36.createElement(PopperPrimitive.Content, {
|
|
3330
3774
|
"data-state": getState(context.open),
|
|
3331
3775
|
role: "dialog",
|
|
3332
3776
|
id: context.contentId,
|
|
@@ -3352,10 +3796,10 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3352
3796
|
})));
|
|
3353
3797
|
});
|
|
3354
3798
|
var CLOSE_NAME = "PopoverClose";
|
|
3355
|
-
var PopoverClose = /* @__PURE__ */
|
|
3799
|
+
var PopoverClose = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3356
3800
|
const { __scopePopover, ...closeProps } = props;
|
|
3357
3801
|
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
|
|
3358
|
-
return /* @__PURE__ */
|
|
3802
|
+
return /* @__PURE__ */ React36.createElement(Primitive19.button, {
|
|
3359
3803
|
type: "button",
|
|
3360
3804
|
...closeProps,
|
|
3361
3805
|
ref: forwardedRef,
|
|
@@ -3364,11 +3808,11 @@ var PopoverClose = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3364
3808
|
});
|
|
3365
3809
|
PopoverClose.displayName = CLOSE_NAME;
|
|
3366
3810
|
var ARROW_NAME2 = "PopoverArrow";
|
|
3367
|
-
var PopoverArrow = /* @__PURE__ */
|
|
3811
|
+
var PopoverArrow = /* @__PURE__ */ forwardRef22((props, forwardedRef) => {
|
|
3368
3812
|
const { __scopePopover, classNames, ...arrowProps } = props;
|
|
3369
3813
|
const popperScope = usePopperScope(__scopePopover);
|
|
3370
3814
|
const { tx } = useThemeContext();
|
|
3371
|
-
return /* @__PURE__ */
|
|
3815
|
+
return /* @__PURE__ */ React36.createElement(PopperPrimitive.Arrow, {
|
|
3372
3816
|
...popperScope,
|
|
3373
3817
|
...arrowProps,
|
|
3374
3818
|
className: tx("popover.arrow", {}, classNames),
|
|
@@ -3376,10 +3820,10 @@ var PopoverArrow = /* @__PURE__ */ forwardRef27((props, forwardedRef) => {
|
|
|
3376
3820
|
});
|
|
3377
3821
|
});
|
|
3378
3822
|
PopoverArrow.displayName = ARROW_NAME2;
|
|
3379
|
-
var PopoverViewport = /* @__PURE__ */
|
|
3823
|
+
var PopoverViewport = /* @__PURE__ */ forwardRef22(({ classNames, asChild, constrainInline = true, constrainBlock = true, children, ...props }, forwardedRef) => {
|
|
3380
3824
|
const { tx } = useThemeContext();
|
|
3381
|
-
const Comp = asChild ?
|
|
3382
|
-
return /* @__PURE__ */
|
|
3825
|
+
const Comp = asChild ? Slot19 : Primitive19.div;
|
|
3826
|
+
return /* @__PURE__ */ React36.createElement(Comp, {
|
|
3383
3827
|
...props,
|
|
3384
3828
|
className: tx("popover.viewport", {
|
|
3385
3829
|
constrainInline,
|
|
@@ -3402,10 +3846,10 @@ var Popover = {
|
|
|
3402
3846
|
};
|
|
3403
3847
|
|
|
3404
3848
|
// src/components/Status/Status.tsx
|
|
3405
|
-
import
|
|
3406
|
-
var Status = /* @__PURE__ */
|
|
3849
|
+
import React37, { forwardRef as forwardRef23 } from "react";
|
|
3850
|
+
var Status = /* @__PURE__ */ forwardRef23(({ classNames, children, progress = 0, indeterminate, variant, ...props }, forwardedRef) => {
|
|
3407
3851
|
const { tx } = useThemeContext();
|
|
3408
|
-
return /* @__PURE__ */
|
|
3852
|
+
return /* @__PURE__ */ React37.createElement("span", {
|
|
3409
3853
|
role: "status",
|
|
3410
3854
|
...props,
|
|
3411
3855
|
className: tx("status.root", {
|
|
@@ -3413,7 +3857,7 @@ var Status = /* @__PURE__ */ forwardRef28(({ classNames, children, progress = 0,
|
|
|
3413
3857
|
variant
|
|
3414
3858
|
}, classNames),
|
|
3415
3859
|
ref: forwardedRef
|
|
3416
|
-
}, /* @__PURE__ */
|
|
3860
|
+
}, /* @__PURE__ */ React37.createElement("span", {
|
|
3417
3861
|
role: "none",
|
|
3418
3862
|
className: tx("status.bar", {
|
|
3419
3863
|
indeterminate,
|
|
@@ -3428,27 +3872,34 @@ var Status = /* @__PURE__ */ forwardRef28(({ classNames, children, progress = 0,
|
|
|
3428
3872
|
});
|
|
3429
3873
|
|
|
3430
3874
|
// src/components/ScrollArea/ScrollArea.tsx
|
|
3431
|
-
import { createContext as
|
|
3432
|
-
import { Primitive as
|
|
3433
|
-
import { Slot as
|
|
3434
|
-
import
|
|
3435
|
-
import { composableProps as
|
|
3875
|
+
import { createContext as createContext11 } from "@radix-ui/react-context";
|
|
3876
|
+
import { Primitive as Primitive20 } from "@radix-ui/react-primitive";
|
|
3877
|
+
import { Slot as Slot20 } from "@radix-ui/react-slot";
|
|
3878
|
+
import React38, { useMemo as useMemo8 } from "react";
|
|
3879
|
+
import { composableProps as composableProps12, scrollbar, slottable as slottable9 } from "@dxos/ui-theme";
|
|
3436
3880
|
var SCROLLAREA_NAME = "ScrollArea";
|
|
3437
|
-
var [ScrollAreaProvider, useScrollAreaContext] =
|
|
3881
|
+
var [ScrollAreaProvider, useScrollAreaContext] = createContext11(SCROLLAREA_NAME);
|
|
3438
3882
|
var SCROLLAREA_ROOT_NAME = "ScrollArea.Root";
|
|
3439
|
-
var ScrollAreaRoot =
|
|
3440
|
-
const { className, ...rest } = composableProps8(props);
|
|
3441
|
-
const Comp = asChild ? Slot17 : Primitive17.div;
|
|
3883
|
+
var ScrollAreaRoot = slottable9(({ children, asChild, orientation = "vertical", autoHide = true, centered = false, padding = false, thin = false, snap = false, ...props }, forwardedRef) => {
|
|
3442
3884
|
const { tx } = useThemeContext();
|
|
3443
|
-
const
|
|
3885
|
+
const { className, ...rest } = composableProps12(props);
|
|
3886
|
+
const Comp = asChild ? Slot20 : Primitive20.div;
|
|
3887
|
+
const options = useMemo8(() => ({
|
|
3444
3888
|
orientation,
|
|
3445
3889
|
autoHide,
|
|
3446
|
-
|
|
3890
|
+
centered,
|
|
3447
3891
|
padding,
|
|
3448
3892
|
thin,
|
|
3449
3893
|
snap
|
|
3450
|
-
}
|
|
3451
|
-
|
|
3894
|
+
}), [
|
|
3895
|
+
orientation,
|
|
3896
|
+
autoHide,
|
|
3897
|
+
centered,
|
|
3898
|
+
padding,
|
|
3899
|
+
thin,
|
|
3900
|
+
snap
|
|
3901
|
+
]);
|
|
3902
|
+
return /* @__PURE__ */ React38.createElement(ScrollAreaProvider, options, /* @__PURE__ */ React38.createElement(Comp, {
|
|
3452
3903
|
...rest,
|
|
3453
3904
|
className: tx("scrollArea.root", options, className),
|
|
3454
3905
|
ref: forwardedRef
|
|
@@ -3456,12 +3907,21 @@ var ScrollAreaRoot = /* @__PURE__ */ forwardRef29(({ children, asChild, orientat
|
|
|
3456
3907
|
});
|
|
3457
3908
|
ScrollAreaRoot.displayName = SCROLLAREA_ROOT_NAME;
|
|
3458
3909
|
var SCROLLAREA_VIEWPORT_NAME = "ScrollArea.Viewport";
|
|
3459
|
-
var ScrollAreaViewport =
|
|
3910
|
+
var ScrollAreaViewport = slottable9(({ children, asChild, ...props }, forwardedRef) => {
|
|
3460
3911
|
const { tx } = useThemeContext();
|
|
3461
3912
|
const options = useScrollAreaContext(SCROLLAREA_VIEWPORT_NAME);
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3913
|
+
const density = options.thin ? scrollbar.thin : scrollbar.coarse;
|
|
3914
|
+
const { className, ...rest } = composableProps12(props);
|
|
3915
|
+
const { style, ...restWithoutStyle } = rest;
|
|
3916
|
+
const Comp = asChild ? Slot20 : Primitive20.div;
|
|
3917
|
+
return /* @__PURE__ */ React38.createElement(Comp, {
|
|
3918
|
+
...restWithoutStyle,
|
|
3919
|
+
style: {
|
|
3920
|
+
"--scroll-width": `${density.size}px`,
|
|
3921
|
+
"--scroll-padding": `${density.padding}px`,
|
|
3922
|
+
...style
|
|
3923
|
+
},
|
|
3924
|
+
className: tx("scrollArea.viewport", options, className),
|
|
3465
3925
|
ref: forwardedRef
|
|
3466
3926
|
}, children);
|
|
3467
3927
|
});
|
|
@@ -3472,180 +3932,221 @@ var ScrollArea = {
|
|
|
3472
3932
|
};
|
|
3473
3933
|
|
|
3474
3934
|
// src/components/ScrollContainer/ScrollContainer.tsx
|
|
3475
|
-
import { createContext as
|
|
3476
|
-
import
|
|
3935
|
+
import { createContext as createContext12 } from "@radix-ui/react-context";
|
|
3936
|
+
import React39, { forwardRef as forwardRef24, useCallback as useCallback12, useEffect as useEffect8, useImperativeHandle, useMemo as useMemo9, useRef as useRef6, useState as useState11 } from "react";
|
|
3477
3937
|
import { addEventListener as addEventListener2, combine } from "@dxos/async";
|
|
3478
3938
|
import { invariant } from "@dxos/invariant";
|
|
3479
|
-
import {
|
|
3480
|
-
import {
|
|
3939
|
+
import { useMergeRefs } from "@dxos/react-hooks";
|
|
3940
|
+
import { composable as composable6, composableProps as composableProps13, slottable as slottable10 } from "@dxos/ui-theme";
|
|
3941
|
+
import { mx as mx11 } from "@dxos/ui-theme";
|
|
3481
3942
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/ui/react-ui/src/components/ScrollContainer/ScrollContainer.tsx";
|
|
3482
3943
|
var isBottom = (el) => {
|
|
3483
3944
|
return !!(el && el.scrollHeight - el.scrollTop === el.clientHeight);
|
|
3484
3945
|
};
|
|
3485
|
-
var [ScrollContainerProvider, useScrollContainerContext] =
|
|
3486
|
-
var
|
|
3487
|
-
const scrollerRef =
|
|
3488
|
-
const autoScrollRef =
|
|
3489
|
-
const [
|
|
3490
|
-
const [
|
|
3491
|
-
const timeoutRef =
|
|
3492
|
-
const scrollToBottom =
|
|
3946
|
+
var [ScrollContainerProvider, useScrollContainerContext] = createContext12("ScrollContainer");
|
|
3947
|
+
var Root10 = /* @__PURE__ */ forwardRef24(({ children, pin, behavior: behaviorProp = "smooth" }, forwardedRef) => {
|
|
3948
|
+
const scrollerRef = useRef6(null);
|
|
3949
|
+
const autoScrollRef = useRef6(false);
|
|
3950
|
+
const [pinned, setPinned] = useState11(pin);
|
|
3951
|
+
const [overflow, setOverflow] = useState11(false);
|
|
3952
|
+
const timeoutRef = useRef6(void 0);
|
|
3953
|
+
const scrollToBottom = useCallback12((behavior = behaviorProp) => {
|
|
3493
3954
|
if (scrollerRef.current) {
|
|
3494
|
-
autoScrollRef.current = true;
|
|
3495
|
-
scrollerRef.current.classList.add("scrollbar-none");
|
|
3496
|
-
scrollerRef.current.scrollTo({
|
|
3497
|
-
top: scrollerRef.current.scrollHeight,
|
|
3498
|
-
behavior
|
|
3499
|
-
});
|
|
3500
|
-
clearTimeout(timeoutRef.current);
|
|
3501
3955
|
if (behavior !== "instant") {
|
|
3956
|
+
autoScrollRef.current = true;
|
|
3957
|
+
scrollerRef.current.classList.add("scrollbar-none");
|
|
3958
|
+
clearTimeout(timeoutRef.current);
|
|
3502
3959
|
timeoutRef.current = setTimeout(() => {
|
|
3503
3960
|
scrollerRef.current?.classList.remove("scrollbar-none");
|
|
3504
3961
|
autoScrollRef.current = false;
|
|
3505
3962
|
}, 500);
|
|
3506
3963
|
}
|
|
3964
|
+
scrollerRef.current.scrollTo({
|
|
3965
|
+
top: scrollerRef.current.scrollHeight,
|
|
3966
|
+
behavior
|
|
3967
|
+
});
|
|
3507
3968
|
setPinned(true);
|
|
3508
3969
|
}
|
|
3509
|
-
}, [
|
|
3510
|
-
|
|
3511
|
-
|
|
3970
|
+
}, [
|
|
3971
|
+
behaviorProp
|
|
3972
|
+
]);
|
|
3973
|
+
const controller = useMemo9(() => ({
|
|
3974
|
+
get viewport() {
|
|
3975
|
+
return scrollerRef.current;
|
|
3976
|
+
},
|
|
3512
3977
|
scrollToTop: () => {
|
|
3513
|
-
invariant(scrollerRef.current, void 0, {
|
|
3514
|
-
F: __dxlog_file2,
|
|
3515
|
-
L: 95,
|
|
3516
|
-
S: void 0,
|
|
3517
|
-
A: [
|
|
3518
|
-
"scrollerRef.current",
|
|
3519
|
-
""
|
|
3520
|
-
]
|
|
3521
|
-
});
|
|
3978
|
+
invariant(scrollerRef.current, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 54, S: void 0, A: ["scrollerRef.current", ""] });
|
|
3522
3979
|
scrollerRef.current.scrollTo({
|
|
3523
3980
|
top: 0,
|
|
3524
3981
|
behavior: "smooth"
|
|
3525
3982
|
});
|
|
3526
3983
|
setPinned(false);
|
|
3527
3984
|
},
|
|
3528
|
-
scrollToBottom: () => {
|
|
3529
|
-
scrollToBottom(
|
|
3985
|
+
scrollToBottom: (behavior = "smooth") => {
|
|
3986
|
+
scrollToBottom(behavior);
|
|
3530
3987
|
}
|
|
3531
3988
|
}), [
|
|
3532
|
-
scrollToBottom
|
|
3533
|
-
scrollerRef.current
|
|
3989
|
+
scrollToBottom
|
|
3534
3990
|
]);
|
|
3535
3991
|
useImperativeHandle(forwardedRef, () => controller, [
|
|
3536
3992
|
controller
|
|
3537
3993
|
]);
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
return;
|
|
3541
|
-
}
|
|
3542
|
-
return combine(
|
|
3543
|
-
// Check if user scrolls.
|
|
3544
|
-
addEventListener2(scrollerRef.current, "wheel", () => {
|
|
3545
|
-
setPinned(isBottom(scrollerRef.current));
|
|
3546
|
-
}),
|
|
3547
|
-
// Check if scrolls.
|
|
3548
|
-
addEventListener2(scrollerRef.current, "scroll", () => {
|
|
3549
|
-
setOverflow((scrollerRef.current?.scrollTop ?? 0) > 0);
|
|
3550
|
-
})
|
|
3551
|
-
);
|
|
3994
|
+
const setViewport = useCallback12((el) => {
|
|
3995
|
+
scrollerRef.current = el;
|
|
3552
3996
|
}, []);
|
|
3553
|
-
return /* @__PURE__ */
|
|
3997
|
+
return /* @__PURE__ */ React39.createElement(ScrollContainerProvider, {
|
|
3554
3998
|
pinned,
|
|
3999
|
+
overflow,
|
|
3555
4000
|
controller,
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
},
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
},
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
});
|
|
3575
|
-
Root12.displayName = "ScrollContainer.Root";
|
|
4001
|
+
setViewport,
|
|
4002
|
+
setPinned,
|
|
4003
|
+
setOverflow
|
|
4004
|
+
}, children);
|
|
4005
|
+
});
|
|
4006
|
+
Root10.displayName = "ScrollContainer.Root";
|
|
4007
|
+
var Content6 = composable6(({ children, thin, padding, centered, ...props }, forwardedRef) => {
|
|
4008
|
+
return /* @__PURE__ */ React39.createElement(ScrollArea.Root, {
|
|
4009
|
+
...composableProps13(props, {
|
|
4010
|
+
classNames: "relative"
|
|
4011
|
+
}),
|
|
4012
|
+
thin,
|
|
4013
|
+
padding,
|
|
4014
|
+
centered,
|
|
4015
|
+
ref: forwardedRef
|
|
4016
|
+
}, children);
|
|
4017
|
+
});
|
|
4018
|
+
Content6.displayName = "ScrollContainer.Content";
|
|
3576
4019
|
var VIEWPORT_NAME = "ScrollContainer.Viewport";
|
|
3577
|
-
var Viewport =
|
|
3578
|
-
const
|
|
3579
|
-
const
|
|
3580
|
-
|
|
3581
|
-
|
|
4020
|
+
var Viewport = slottable10(({ children, asChild, ...props }, forwardedRef) => {
|
|
4021
|
+
const scrollerRef = useRef6(null);
|
|
4022
|
+
const mergedRef = useMergeRefs([
|
|
4023
|
+
forwardedRef,
|
|
4024
|
+
scrollerRef
|
|
4025
|
+
]);
|
|
4026
|
+
const { setViewport, setPinned, setOverflow } = useScrollContainerContext(VIEWPORT_NAME);
|
|
4027
|
+
useEffect8(() => {
|
|
4028
|
+
const el = scrollerRef.current;
|
|
4029
|
+
if (!el) {
|
|
3582
4030
|
return;
|
|
3583
4031
|
}
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
resizeObserver.observe(contentRef.current);
|
|
3587
|
-
return () => resizeObserver.disconnect();
|
|
4032
|
+
setViewport(el);
|
|
4033
|
+
return combine(addEventListener2(el, "wheel", () => setPinned(isBottom(el))), addEventListener2(el, "scroll", () => setOverflow((el.scrollTop ?? 0) > 0)), () => setViewport(null));
|
|
3588
4034
|
}, [
|
|
3589
|
-
|
|
3590
|
-
|
|
4035
|
+
setViewport,
|
|
4036
|
+
setPinned,
|
|
4037
|
+
setOverflow
|
|
3591
4038
|
]);
|
|
3592
|
-
return /* @__PURE__ */
|
|
3593
|
-
|
|
3594
|
-
...props,
|
|
3595
|
-
ref:
|
|
3596
|
-
}, children)
|
|
4039
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(ScrollArea.Viewport, {
|
|
4040
|
+
asChild,
|
|
4041
|
+
...composableProps13(props),
|
|
4042
|
+
ref: mergedRef
|
|
4043
|
+
}, children), /* @__PURE__ */ React39.createElement(PinEffect, {
|
|
4044
|
+
scrollerRef
|
|
4045
|
+
}));
|
|
3597
4046
|
});
|
|
3598
4047
|
Viewport.displayName = VIEWPORT_NAME;
|
|
4048
|
+
var PIN_EFFECT_NAME = "ScrollContainer.PinEffect";
|
|
4049
|
+
var PinEffect = ({ scrollerRef }) => {
|
|
4050
|
+
const { pinned, controller } = useScrollContainerContext(PIN_EFFECT_NAME);
|
|
4051
|
+
useEffect8(() => {
|
|
4052
|
+
const viewport = scrollerRef.current;
|
|
4053
|
+
if (!pinned || !viewport) {
|
|
4054
|
+
return;
|
|
4055
|
+
}
|
|
4056
|
+
controller?.scrollToBottom("instant");
|
|
4057
|
+
const resizeObserver = new ResizeObserver(() => controller?.scrollToBottom("smooth"));
|
|
4058
|
+
Array.from(viewport.children).forEach((child) => {
|
|
4059
|
+
resizeObserver.observe(child);
|
|
4060
|
+
});
|
|
4061
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
4062
|
+
mutations.forEach((mutation) => {
|
|
4063
|
+
mutation.addedNodes.forEach((node) => {
|
|
4064
|
+
if (node instanceof Element) {
|
|
4065
|
+
resizeObserver.observe(node);
|
|
4066
|
+
}
|
|
4067
|
+
});
|
|
4068
|
+
});
|
|
4069
|
+
controller?.scrollToBottom("smooth");
|
|
4070
|
+
});
|
|
4071
|
+
mutationObserver.observe(viewport, {
|
|
4072
|
+
childList: true
|
|
4073
|
+
});
|
|
4074
|
+
return () => {
|
|
4075
|
+
resizeObserver.disconnect();
|
|
4076
|
+
mutationObserver.disconnect();
|
|
4077
|
+
};
|
|
4078
|
+
}, [
|
|
4079
|
+
pinned,
|
|
4080
|
+
controller,
|
|
4081
|
+
scrollerRef
|
|
4082
|
+
]);
|
|
4083
|
+
return null;
|
|
4084
|
+
};
|
|
4085
|
+
var FADE_NAME = "ScrollContainer.Fade";
|
|
4086
|
+
var Fade = () => {
|
|
4087
|
+
const { overflow } = useScrollContainerContext(FADE_NAME);
|
|
4088
|
+
return /* @__PURE__ */ React39.createElement("div", {
|
|
4089
|
+
"data-visible": overflow,
|
|
4090
|
+
className: mx11(
|
|
4091
|
+
// NOTE: Gradients may not be visible with dark reader extensions.
|
|
4092
|
+
"z-10 absolute top-0 inset-x-0 h-24 w-full",
|
|
4093
|
+
'opacity-0 duration-200 transition-opacity data-[visible="true"]:opacity-100',
|
|
4094
|
+
"bg-gradient-to-b from-(--color-base-surface) to-transparent pointer-events-none"
|
|
4095
|
+
)
|
|
4096
|
+
});
|
|
4097
|
+
};
|
|
4098
|
+
Fade.displayName = FADE_NAME;
|
|
3599
4099
|
var SCROLL_DOWN_BUTTON_NAME = "ScrollContainer.ScrollDownButton";
|
|
3600
4100
|
var ScrollDownButton = ({ classNames }) => {
|
|
3601
|
-
const { pinned,
|
|
3602
|
-
return /* @__PURE__ */
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
}, /* @__PURE__ */ React37.createElement(IconButton, {
|
|
4101
|
+
const { pinned, controller } = useScrollContainerContext(SCROLL_DOWN_BUTTON_NAME);
|
|
4102
|
+
return /* @__PURE__ */ React39.createElement("div", {
|
|
4103
|
+
className: mx11("absolute bottom-2 right-4 opacity-100 transition-opacity duration-300", pinned && "opacity-0", classNames)
|
|
4104
|
+
}, /* @__PURE__ */ React39.createElement(IconButton, {
|
|
3606
4105
|
variant: "primary",
|
|
3607
4106
|
icon: "ph--arrow-down--regular",
|
|
3608
4107
|
iconOnly: true,
|
|
3609
4108
|
size: 4,
|
|
3610
4109
|
label: "Scroll down",
|
|
3611
|
-
onClick: () => scrollToBottom()
|
|
4110
|
+
onClick: () => controller?.scrollToBottom()
|
|
3612
4111
|
}));
|
|
3613
4112
|
};
|
|
3614
4113
|
ScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
3615
4114
|
var ScrollContainer = {
|
|
3616
|
-
Root:
|
|
4115
|
+
Root: Root10,
|
|
4116
|
+
Content: Content6,
|
|
3617
4117
|
Viewport,
|
|
4118
|
+
Fade,
|
|
3618
4119
|
ScrollDownButton
|
|
3619
4120
|
};
|
|
3620
4121
|
|
|
3621
4122
|
// src/components/Select/Select.tsx
|
|
3622
4123
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3623
|
-
import
|
|
4124
|
+
import React40, { forwardRef as forwardRef25 } from "react";
|
|
3624
4125
|
var SelectRoot = SelectPrimitive.Root;
|
|
3625
4126
|
var SelectTrigger = SelectPrimitive.Trigger;
|
|
3626
4127
|
var SelectValue = SelectPrimitive.Value;
|
|
3627
4128
|
var SelectIcon = SelectPrimitive.Icon;
|
|
3628
4129
|
var SelectPortal = SelectPrimitive.Portal;
|
|
3629
|
-
var SelectTriggerButton = /* @__PURE__ */
|
|
3630
|
-
return /* @__PURE__ */
|
|
4130
|
+
var SelectTriggerButton = /* @__PURE__ */ forwardRef25(({ children, placeholder, ...props }, forwardedRef) => {
|
|
4131
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.Trigger, {
|
|
3631
4132
|
asChild: true,
|
|
3632
4133
|
ref: forwardedRef
|
|
3633
|
-
}, /* @__PURE__ */
|
|
4134
|
+
}, /* @__PURE__ */ React40.createElement(Button, props, /* @__PURE__ */ React40.createElement(SelectPrimitive.Value, {
|
|
3634
4135
|
placeholder
|
|
3635
|
-
}, children), /* @__PURE__ */
|
|
4136
|
+
}, children), /* @__PURE__ */ React40.createElement("span", {
|
|
3636
4137
|
className: "w-1 flex-1"
|
|
3637
|
-
}), /* @__PURE__ */
|
|
4138
|
+
}), /* @__PURE__ */ React40.createElement(SelectPrimitive.Icon, {
|
|
3638
4139
|
asChild: true
|
|
3639
|
-
}, /* @__PURE__ */
|
|
4140
|
+
}, /* @__PURE__ */ React40.createElement(Icon, {
|
|
3640
4141
|
size: 3,
|
|
3641
4142
|
icon: "ph--caret-down--bold"
|
|
3642
4143
|
}))));
|
|
3643
4144
|
});
|
|
3644
|
-
var SelectContent = /* @__PURE__ */
|
|
4145
|
+
var SelectContent = /* @__PURE__ */ forwardRef25(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
3645
4146
|
const { tx } = useThemeContext();
|
|
3646
4147
|
const elevation = useElevationContext();
|
|
3647
4148
|
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
3648
|
-
return /* @__PURE__ */
|
|
4149
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.Content, {
|
|
3649
4150
|
...props,
|
|
3650
4151
|
"data-arrow-keys": "up down",
|
|
3651
4152
|
collisionPadding: safeCollisionPadding,
|
|
@@ -3656,78 +4157,78 @@ var SelectContent = /* @__PURE__ */ forwardRef31(({ classNames, children, collis
|
|
|
3656
4157
|
ref: forwardedRef
|
|
3657
4158
|
}, children);
|
|
3658
4159
|
});
|
|
3659
|
-
var SelectScrollUpButton2 = /* @__PURE__ */
|
|
4160
|
+
var SelectScrollUpButton2 = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3660
4161
|
const { tx } = useThemeContext();
|
|
3661
|
-
return /* @__PURE__ */
|
|
4162
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.SelectScrollUpButton, {
|
|
3662
4163
|
...props,
|
|
3663
4164
|
className: tx("select.scrollButton", {}, classNames),
|
|
3664
4165
|
ref: forwardedRef
|
|
3665
|
-
}, children ?? /* @__PURE__ */
|
|
4166
|
+
}, children ?? /* @__PURE__ */ React40.createElement(Icon, {
|
|
3666
4167
|
size: 3,
|
|
3667
4168
|
icon: "ph--caret-up--bold"
|
|
3668
4169
|
}));
|
|
3669
4170
|
});
|
|
3670
|
-
var SelectScrollDownButton2 = /* @__PURE__ */
|
|
4171
|
+
var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3671
4172
|
const { tx } = useThemeContext();
|
|
3672
|
-
return /* @__PURE__ */
|
|
4173
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.SelectScrollDownButton, {
|
|
3673
4174
|
...props,
|
|
3674
4175
|
className: tx("select.scrollButton", {}, classNames),
|
|
3675
4176
|
ref: forwardedRef
|
|
3676
|
-
}, children ?? /* @__PURE__ */
|
|
4177
|
+
}, children ?? /* @__PURE__ */ React40.createElement(Icon, {
|
|
3677
4178
|
size: 3,
|
|
3678
4179
|
icon: "ph--caret-down--bold"
|
|
3679
4180
|
}));
|
|
3680
4181
|
});
|
|
3681
|
-
var SelectViewport2 = /* @__PURE__ */
|
|
4182
|
+
var SelectViewport2 = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3682
4183
|
const { tx } = useThemeContext();
|
|
3683
|
-
return /* @__PURE__ */
|
|
4184
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.SelectViewport, {
|
|
3684
4185
|
...props,
|
|
3685
4186
|
className: tx("select.viewport", {}, classNames),
|
|
3686
4187
|
ref: forwardedRef
|
|
3687
4188
|
}, children);
|
|
3688
4189
|
});
|
|
3689
|
-
var SelectItem = /* @__PURE__ */
|
|
4190
|
+
var SelectItem = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
|
|
3690
4191
|
const { tx } = useThemeContext();
|
|
3691
|
-
return /* @__PURE__ */
|
|
4192
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.Item, {
|
|
3692
4193
|
...props,
|
|
3693
4194
|
className: tx("select.item", {}, classNames),
|
|
3694
4195
|
ref: forwardedRef
|
|
3695
4196
|
});
|
|
3696
4197
|
});
|
|
3697
4198
|
var SelectItemText = SelectPrimitive.ItemText;
|
|
3698
|
-
var SelectItemIndicator = /* @__PURE__ */
|
|
4199
|
+
var SelectItemIndicator = /* @__PURE__ */ forwardRef25(({ classNames, children, ...props }, forwardedRef) => {
|
|
3699
4200
|
const { tx } = useThemeContext();
|
|
3700
|
-
return /* @__PURE__ */
|
|
4201
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.ItemIndicator, {
|
|
3701
4202
|
...props,
|
|
3702
4203
|
className: tx("select.itemIndicator", {}, classNames),
|
|
3703
4204
|
ref: forwardedRef
|
|
3704
4205
|
}, children);
|
|
3705
4206
|
});
|
|
3706
|
-
var SelectOption = /* @__PURE__ */
|
|
4207
|
+
var SelectOption = /* @__PURE__ */ forwardRef25(({ children, classNames, ...props }, forwardedRef) => {
|
|
3707
4208
|
const { tx } = useThemeContext();
|
|
3708
|
-
return /* @__PURE__ */
|
|
4209
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.Item, {
|
|
3709
4210
|
...props,
|
|
3710
4211
|
className: tx("select.item", {}, classNames),
|
|
3711
4212
|
ref: forwardedRef
|
|
3712
|
-
}, /* @__PURE__ */
|
|
4213
|
+
}, /* @__PURE__ */ React40.createElement(SelectPrimitive.ItemText, null, children), /* @__PURE__ */ React40.createElement("span", {
|
|
3713
4214
|
className: "grow w-1"
|
|
3714
|
-
}), /* @__PURE__ */
|
|
4215
|
+
}), /* @__PURE__ */ React40.createElement(Icon, {
|
|
3715
4216
|
icon: "ph--check--regular"
|
|
3716
4217
|
}));
|
|
3717
4218
|
});
|
|
3718
4219
|
var SelectGroup = SelectPrimitive.Group;
|
|
3719
4220
|
var SelectLabel = SelectPrimitive.Label;
|
|
3720
|
-
var SelectSeparator = /* @__PURE__ */
|
|
4221
|
+
var SelectSeparator = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
|
|
3721
4222
|
const { tx } = useThemeContext();
|
|
3722
|
-
return /* @__PURE__ */
|
|
4223
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.Separator, {
|
|
3723
4224
|
...props,
|
|
3724
4225
|
className: tx("select.separator", {}, classNames),
|
|
3725
4226
|
ref: forwardedRef
|
|
3726
4227
|
});
|
|
3727
4228
|
});
|
|
3728
|
-
var SelectArrow = /* @__PURE__ */
|
|
4229
|
+
var SelectArrow = /* @__PURE__ */ forwardRef25(({ classNames, ...props }, forwardedRef) => {
|
|
3729
4230
|
const { tx } = useThemeContext();
|
|
3730
|
-
return /* @__PURE__ */
|
|
4231
|
+
return /* @__PURE__ */ React40.createElement(SelectPrimitive.Arrow, {
|
|
3731
4232
|
...props,
|
|
3732
4233
|
className: tx("select.arrow", {}, classNames),
|
|
3733
4234
|
ref: forwardedRef
|
|
@@ -3755,10 +4256,10 @@ var Select = {
|
|
|
3755
4256
|
};
|
|
3756
4257
|
|
|
3757
4258
|
// src/components/Skeleton/Skeleton.tsx
|
|
3758
|
-
import
|
|
3759
|
-
var Skeleton = /* @__PURE__ */
|
|
4259
|
+
import React41, { forwardRef as forwardRef26 } from "react";
|
|
4260
|
+
var Skeleton = /* @__PURE__ */ forwardRef26(({ classNames, variant = "default", ...props }, forwardedRef) => {
|
|
3760
4261
|
const { tx } = useThemeContext();
|
|
3761
|
-
return /* @__PURE__ */
|
|
4262
|
+
return /* @__PURE__ */ React41.createElement("div", {
|
|
3762
4263
|
...props,
|
|
3763
4264
|
className: tx("skeleton.root", {
|
|
3764
4265
|
variant
|
|
@@ -3769,47 +4270,47 @@ var Skeleton = /* @__PURE__ */ forwardRef32(({ classNames, variant = "default",
|
|
|
3769
4270
|
|
|
3770
4271
|
// src/components/Splitter/Splitter.tsx
|
|
3771
4272
|
import { createContextScope as createContextScope4 } from "@radix-ui/react-context";
|
|
3772
|
-
import { Primitive as
|
|
3773
|
-
import { Slot as
|
|
3774
|
-
import
|
|
3775
|
-
import { composableProps as
|
|
4273
|
+
import { Primitive as Primitive21 } from "@radix-ui/react-primitive";
|
|
4274
|
+
import { Slot as Slot21 } from "@radix-ui/react-slot";
|
|
4275
|
+
import React42 from "react";
|
|
4276
|
+
import { composableProps as composableProps14, slottable as slottable11 } from "@dxos/ui-theme";
|
|
3776
4277
|
var SPLITTER_NAME = "Splitter";
|
|
3777
4278
|
var [createSplitterContext, createSplitterScope] = createContextScope4(SPLITTER_NAME);
|
|
3778
4279
|
var [SplitterProvider, useSplitterContext] = createSplitterContext(SPLITTER_NAME);
|
|
3779
4280
|
var ROOT_NAME = "Splitter.Root";
|
|
3780
|
-
var
|
|
3781
|
-
const { className, ...rest } = composableProps9(props);
|
|
3782
|
-
const Comp = asChild ? Slot18 : Primitive18.div;
|
|
4281
|
+
var Root12 = slottable11(({ asChild, mode = "top", ratio = 0.5, transition = 250, children, ...props }, forwardedRef) => {
|
|
3783
4282
|
const { tx } = useThemeContext();
|
|
3784
|
-
|
|
4283
|
+
const { __scopeSplitter, ...rest } = props;
|
|
4284
|
+
const { className, ...restProps } = composableProps14(rest);
|
|
4285
|
+
const Comp = asChild ? Slot21 : Primitive21.div;
|
|
4286
|
+
return /* @__PURE__ */ React42.createElement(SplitterProvider, {
|
|
3785
4287
|
scope: __scopeSplitter,
|
|
3786
4288
|
mode,
|
|
3787
4289
|
ratio,
|
|
3788
4290
|
transition
|
|
3789
|
-
}, /* @__PURE__ */
|
|
3790
|
-
|
|
3791
|
-
...rest,
|
|
4291
|
+
}, /* @__PURE__ */ React42.createElement(Comp, {
|
|
4292
|
+
...restProps,
|
|
3792
4293
|
ref: forwardedRef,
|
|
3793
4294
|
className: tx("splitter.root", {}, className)
|
|
3794
4295
|
}, children));
|
|
3795
4296
|
});
|
|
3796
|
-
|
|
4297
|
+
Root12.displayName = ROOT_NAME;
|
|
3797
4298
|
var PANEL_NAME = "Splitter.Panel";
|
|
3798
|
-
var Panel2 =
|
|
3799
|
-
const { className, ...rest } = composableProps9(props);
|
|
3800
|
-
const Comp = asChild ? Slot18 : Primitive18.div;
|
|
3801
|
-
const { mode, ratio, transition } = useSplitterContext(PANEL_NAME, __scopeSplitter);
|
|
4299
|
+
var Panel2 = slottable11(({ classNames, asChild, children, position, style, ...props }, forwardedRef) => {
|
|
3802
4300
|
const { tx } = useThemeContext();
|
|
3803
|
-
const
|
|
3804
|
-
const
|
|
3805
|
-
const
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
4301
|
+
const { __scopeSplitter, ...rest } = props;
|
|
4302
|
+
const Comp = asChild ? Slot21 : Primitive21.div;
|
|
4303
|
+
const { mode, ratio = 0.5, transition } = useSplitterContext(PANEL_NAME, __scopeSplitter);
|
|
4304
|
+
const { className, ...restProps } = composableProps14(rest);
|
|
4305
|
+
const isTopPanel = position === "top";
|
|
4306
|
+
const topOffset = isTopPanel ? "0%" : mode === "top" ? "100%" : mode === "bottom" ? "0%" : `${ratio * 100}%`;
|
|
4307
|
+
const height = isTopPanel ? mode === "top" ? "100%" : mode === "bottom" ? "0%" : `${ratio * 100}%` : mode === "bottom" ? "100%" : mode === "top" ? "0%" : `${(1 - ratio) * 100}%`;
|
|
4308
|
+
return /* @__PURE__ */ React42.createElement(Comp, {
|
|
4309
|
+
...restProps,
|
|
3809
4310
|
ref: forwardedRef,
|
|
3810
4311
|
className: tx("splitter.panel", {}, className),
|
|
3811
4312
|
style: {
|
|
3812
|
-
top,
|
|
4313
|
+
top: topOffset,
|
|
3813
4314
|
height,
|
|
3814
4315
|
transition: `top ${transition}ms, height ${transition}ms ease-out`,
|
|
3815
4316
|
...style
|
|
@@ -3818,18 +4319,18 @@ var Panel2 = /* @__PURE__ */ forwardRef33(({ __scopeSplitter, asChild, children,
|
|
|
3818
4319
|
});
|
|
3819
4320
|
Panel2.displayName = PANEL_NAME;
|
|
3820
4321
|
var Splitter = {
|
|
3821
|
-
Root:
|
|
4322
|
+
Root: Root12,
|
|
3822
4323
|
Panel: Panel2
|
|
3823
4324
|
};
|
|
3824
4325
|
|
|
3825
4326
|
// src/components/Tag/Tag.tsx
|
|
3826
|
-
import { Primitive as
|
|
3827
|
-
import { Slot as
|
|
3828
|
-
import
|
|
3829
|
-
var Tag = /* @__PURE__ */
|
|
4327
|
+
import { Primitive as Primitive22 } from "@radix-ui/react-primitive";
|
|
4328
|
+
import { Slot as Slot22 } from "@radix-ui/react-slot";
|
|
4329
|
+
import React43, { forwardRef as forwardRef27 } from "react";
|
|
4330
|
+
var Tag = /* @__PURE__ */ forwardRef27(({ asChild, palette = "neutral", classNames, ...props }, forwardedRef) => {
|
|
3830
4331
|
const { tx } = useThemeContext();
|
|
3831
|
-
const Comp = asChild ?
|
|
3832
|
-
return /* @__PURE__ */
|
|
4332
|
+
const Comp = asChild ? Slot22 : Primitive22.span;
|
|
4333
|
+
return /* @__PURE__ */ React43.createElement(Comp, {
|
|
3833
4334
|
...props,
|
|
3834
4335
|
className: tx("tag.root", {
|
|
3835
4336
|
palette
|
|
@@ -3840,60 +4341,60 @@ var Tag = /* @__PURE__ */ forwardRef34(({ asChild, palette = "neutral", classNam
|
|
|
3840
4341
|
});
|
|
3841
4342
|
|
|
3842
4343
|
// src/components/Toast/Toast.tsx
|
|
3843
|
-
import { Primitive as
|
|
3844
|
-
import { Slot as
|
|
4344
|
+
import { Primitive as Primitive23 } from "@radix-ui/react-primitive";
|
|
4345
|
+
import { Slot as Slot23 } from "@radix-ui/react-slot";
|
|
3845
4346
|
import * as ToastPrimitive from "@radix-ui/react-toast";
|
|
3846
|
-
import
|
|
4347
|
+
import React44, { forwardRef as forwardRef28 } from "react";
|
|
3847
4348
|
var ToastProvider = ToastPrimitive.Provider;
|
|
3848
|
-
var ToastViewport = /* @__PURE__ */
|
|
4349
|
+
var ToastViewport = /* @__PURE__ */ forwardRef28(({ classNames, ...props }, forwardedRef) => {
|
|
3849
4350
|
const { tx } = useThemeContext();
|
|
3850
|
-
return /* @__PURE__ */
|
|
4351
|
+
return /* @__PURE__ */ React44.createElement(ToastPrimitive.Viewport, {
|
|
3851
4352
|
...props,
|
|
3852
4353
|
className: tx("toast.viewport", {}, classNames),
|
|
3853
4354
|
ref: forwardedRef
|
|
3854
4355
|
});
|
|
3855
4356
|
});
|
|
3856
|
-
var ToastRoot = /* @__PURE__ */
|
|
4357
|
+
var ToastRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, ...props }, forwardedRef) => {
|
|
3857
4358
|
const { tx } = useThemeContext();
|
|
3858
|
-
return /* @__PURE__ */
|
|
4359
|
+
return /* @__PURE__ */ React44.createElement(ToastPrimitive.Root, {
|
|
3859
4360
|
...props,
|
|
3860
4361
|
className: tx("toast.root", {}, classNames),
|
|
3861
4362
|
ref: forwardedRef
|
|
3862
|
-
}, /* @__PURE__ */
|
|
4363
|
+
}, /* @__PURE__ */ React44.createElement(ElevationProvider, {
|
|
3863
4364
|
elevation: "toast"
|
|
3864
4365
|
}, children));
|
|
3865
4366
|
});
|
|
3866
|
-
var ToastBody = /* @__PURE__ */
|
|
4367
|
+
var ToastBody = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3867
4368
|
const { tx } = useThemeContext();
|
|
3868
|
-
const Comp = asChild ?
|
|
3869
|
-
return /* @__PURE__ */
|
|
4369
|
+
const Comp = asChild ? Slot23 : Primitive23.div;
|
|
4370
|
+
return /* @__PURE__ */ React44.createElement(Comp, {
|
|
3870
4371
|
...props,
|
|
3871
4372
|
className: tx("toast.body", {}, classNames),
|
|
3872
4373
|
ref: forwardedRef
|
|
3873
4374
|
});
|
|
3874
4375
|
});
|
|
3875
|
-
var ToastTitle = /* @__PURE__ */
|
|
4376
|
+
var ToastTitle = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3876
4377
|
const { tx } = useThemeContext();
|
|
3877
|
-
const Comp = asChild ?
|
|
3878
|
-
return /* @__PURE__ */
|
|
4378
|
+
const Comp = asChild ? Slot23 : ToastPrimitive.Title;
|
|
4379
|
+
return /* @__PURE__ */ React44.createElement(Comp, {
|
|
3879
4380
|
...props,
|
|
3880
4381
|
className: tx("toast.title", {}, classNames),
|
|
3881
4382
|
ref: forwardedRef
|
|
3882
4383
|
});
|
|
3883
4384
|
});
|
|
3884
|
-
var ToastDescription = /* @__PURE__ */
|
|
4385
|
+
var ToastDescription = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3885
4386
|
const { tx } = useThemeContext();
|
|
3886
|
-
const Comp = asChild ?
|
|
3887
|
-
return /* @__PURE__ */
|
|
4387
|
+
const Comp = asChild ? Slot23 : ToastPrimitive.Description;
|
|
4388
|
+
return /* @__PURE__ */ React44.createElement(Comp, {
|
|
3888
4389
|
...props,
|
|
3889
4390
|
className: tx("toast.description", {}, classNames),
|
|
3890
4391
|
ref: forwardedRef
|
|
3891
4392
|
});
|
|
3892
4393
|
});
|
|
3893
|
-
var ToastActions = /* @__PURE__ */
|
|
4394
|
+
var ToastActions = /* @__PURE__ */ forwardRef28(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
3894
4395
|
const { tx } = useThemeContext();
|
|
3895
|
-
const Comp = asChild ?
|
|
3896
|
-
return /* @__PURE__ */
|
|
4396
|
+
const Comp = asChild ? Slot23 : Primitive23.div;
|
|
4397
|
+
return /* @__PURE__ */ React44.createElement(Comp, {
|
|
3897
4398
|
...props,
|
|
3898
4399
|
className: tx("toast.actions", {}, classNames),
|
|
3899
4400
|
ref: forwardedRef
|
|
@@ -3921,6 +4422,7 @@ export {
|
|
|
3921
4422
|
ButtonGroup,
|
|
3922
4423
|
Callout,
|
|
3923
4424
|
Card,
|
|
4425
|
+
Carousel,
|
|
3924
4426
|
Clipboard,
|
|
3925
4427
|
Column,
|
|
3926
4428
|
Container,
|
|
@@ -3935,6 +4437,7 @@ export {
|
|
|
3935
4437
|
ErrorFallback,
|
|
3936
4438
|
ErrorStack,
|
|
3937
4439
|
Flex,
|
|
4440
|
+
Focus,
|
|
3938
4441
|
Grid,
|
|
3939
4442
|
Icon,
|
|
3940
4443
|
IconButton,
|
|
@@ -3946,6 +4449,7 @@ export {
|
|
|
3946
4449
|
List,
|
|
3947
4450
|
ListItem,
|
|
3948
4451
|
Main,
|
|
4452
|
+
MediaPlayer,
|
|
3949
4453
|
Message,
|
|
3950
4454
|
Panel,
|
|
3951
4455
|
Popover,
|
|
@@ -3956,6 +4460,8 @@ export {
|
|
|
3956
4460
|
Skeleton,
|
|
3957
4461
|
Splitter,
|
|
3958
4462
|
Status,
|
|
4463
|
+
TREEGRID_PARENT_OF_SEPARATOR,
|
|
4464
|
+
TREEGRID_PATH_SEPARATOR,
|
|
3959
4465
|
Tag,
|
|
3960
4466
|
ThemeContext,
|
|
3961
4467
|
ThemeProvider,
|
|
@@ -3965,7 +4471,7 @@ export {
|
|
|
3965
4471
|
ToggleGroup,
|
|
3966
4472
|
ToggleGroupIconItem,
|
|
3967
4473
|
ToggleGroupItem,
|
|
3968
|
-
|
|
4474
|
+
Toolbar,
|
|
3969
4475
|
Tooltip,
|
|
3970
4476
|
Trans,
|
|
3971
4477
|
Tree,
|
|
@@ -3975,18 +4481,23 @@ export {
|
|
|
3975
4481
|
createPopoverScope,
|
|
3976
4482
|
createSplitterScope,
|
|
3977
4483
|
createTooltipScope,
|
|
4484
|
+
detectMediaKind,
|
|
3978
4485
|
hasIosKeyboard,
|
|
3979
4486
|
initialSafeArea,
|
|
4487
|
+
isEmbedUrl,
|
|
3980
4488
|
isLabel,
|
|
3981
4489
|
messageIcons,
|
|
4490
|
+
parseCaptureOwnerStack,
|
|
3982
4491
|
toLocalizedString,
|
|
3983
4492
|
useAvatarContext,
|
|
3984
4493
|
useButtonGroupContext,
|
|
4494
|
+
useCarousel,
|
|
3985
4495
|
useClipboard,
|
|
3986
4496
|
useDensityContext,
|
|
3987
4497
|
useDropdownMenuContext,
|
|
3988
4498
|
useDropdownMenuMenuScope,
|
|
3989
4499
|
useElevationContext,
|
|
4500
|
+
useFocus,
|
|
3990
4501
|
useIconHref,
|
|
3991
4502
|
useLandmarkMover,
|
|
3992
4503
|
useListContext,
|