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