@dxos/react-ui 0.8.4-main.9735255 → 0.8.4-main.9be5663bfe
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-CEKVHJ27.mjs → chunk-OCVRIJCH.mjs} +184 -110
- package/dist/lib/browser/chunk-OCVRIJCH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3025 -2078
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +73 -37
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-2NHEX4AD.mjs → chunk-QUD5P3RU.mjs} +184 -110
- package/dist/lib/node-esm/chunk-QUD5P3RU.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3025 -2078
- 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 +73 -37
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +2 -2
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.stories.d.ts +3 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.d.ts +2 -2
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +6 -6
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +118 -0
- package/dist/types/src/components/Card/Card.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.stories.d.ts +21 -0
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -0
- package/dist/types/src/components/Card/index.d.ts +2 -0
- package/dist/types/src/components/Card/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +10 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +37 -19
- 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 +44 -22
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +6 -8
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts +11 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts +7 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +19 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts +9 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts +5 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.d.ts +36 -0
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts +9 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +2 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -0
- package/dist/types/src/components/Icon/Icon.d.ts +3 -0
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +11 -3
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.d.ts +14 -0
- package/dist/types/src/components/Image/Image.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.stories.d.ts +33 -0
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -0
- package/dist/types/src/components/Image/index.d.ts +2 -0
- package/dist/types/src/components/Image/index.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +4 -7
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +7 -7
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +5 -3
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +3 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/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/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 +6 -32
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +1 -5
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +51 -50
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +14 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +4 -5
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +32 -23
- 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 +26 -28
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +54 -9
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +34 -13
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +9 -5
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -2
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +3 -3
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Skeleton/Skeleton.d.ts +12 -0
- package/dist/types/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts +17 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/index.d.ts +2 -0
- package/dist/types/src/components/Skeleton/index.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts +34 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts +7 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/index.d.ts +2 -0
- package/dist/types/src/components/Splitter/index.d.ts.map +1 -0
- 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 +4 -2
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +0 -5
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts +12 -0
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts.map +1 -0
- package/dist/types/src/components/Toast/Toast.d.ts +15 -15
- 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 +30 -12
- 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 +9 -9
- 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 +9 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +19 -0
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts +15 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts +8 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts +11 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.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.map +1 -1
- package/dist/types/src/primitives/Column/Column.d.ts +35 -0
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts +25 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/index.d.ts +2 -0
- package/dist/types/src/primitives/Column/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.d.ts +7 -0
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts +6 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/index.d.ts +2 -0
- package/dist/types/src/primitives/Container/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts +11 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts +8 -0
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/index.d.ts +2 -0
- package/dist/types/src/primitives/Flex/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts +10 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts +8 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/index.d.ts +2 -0
- package/dist/types/src/primitives/Grid/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts +35 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts +6 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/index.d.ts +2 -0
- package/dist/types/src/primitives/Panel/index.d.ts.map +1 -0
- package/dist/types/src/primitives/index.d.ts +6 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -0
- package/dist/types/src/testing/Loading.d.ts +9 -0
- package/dist/types/src/testing/Loading.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withLayout.d.ts +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 +3 -2
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +11 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/util/usePx.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -22
- package/src/components/Avatars/Avatar.stories.tsx +7 -9
- package/src/components/Avatars/Avatar.tsx +6 -14
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -3
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +3 -4
- package/src/components/Breadcrumb/Breadcrumb.tsx +11 -37
- package/src/components/Button/Button.stories.tsx +3 -4
- package/src/components/Button/Button.tsx +11 -25
- package/src/components/Button/IconButton.stories.tsx +8 -6
- package/src/components/Button/IconButton.tsx +2 -4
- package/src/components/Button/Toggle.stories.tsx +2 -3
- package/src/components/Button/Toggle.tsx +4 -4
- package/src/components/Button/ToggleGroup.stories.tsx +2 -3
- package/src/components/Button/ToggleGroup.tsx +12 -16
- package/src/components/Card/Card.stories.tsx +151 -0
- package/src/components/Card/Card.tsx +492 -0
- package/src/components/Card/index.ts +5 -0
- package/src/components/Clipboard/CopyButton.tsx +4 -5
- package/src/components/Dialog/AlertDialog.stories.tsx +16 -17
- package/src/components/Dialog/AlertDialog.tsx +123 -82
- package/src/components/Dialog/Dialog.stories.tsx +100 -20
- package/src/components/Dialog/Dialog.tsx +113 -87
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +45 -0
- package/src/components/ErrorFallback/ErrorFallback.tsx +70 -0
- package/src/components/ErrorFallback/ErrorStack.tsx +114 -0
- package/src/components/ErrorFallback/ThrowError.tsx +37 -0
- package/src/components/ErrorFallback/index.ts +9 -0
- 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 +45 -15
- package/src/components/Icon/Icon.tsx +6 -2
- package/src/components/Image/Image.stories.tsx +86 -0
- package/src/components/Image/Image.tsx +223 -0
- package/src/components/Image/index.ts +5 -0
- package/src/components/Input/Input.stories.tsx +20 -40
- package/src/components/Input/Input.tsx +24 -69
- package/src/components/Link/Link.stories.tsx +2 -3
- package/src/components/Link/Link.tsx +2 -2
- package/src/components/List/List.stories.tsx +15 -23
- package/src/components/List/List.tsx +16 -20
- package/src/components/List/ListDropIndicator.tsx +7 -7
- package/src/components/List/Tree.stories.tsx +5 -6
- package/src/components/List/Tree.tsx +0 -1
- package/src/components/List/TreeDropIndicator.tsx +6 -6
- package/src/components/List/Treegrid.stories.tsx +29 -30
- package/src/components/List/Treegrid.tsx +23 -28
- package/src/components/Main/Main.stories.tsx +6 -96
- package/src/components/Main/Main.tsx +61 -212
- package/src/components/Menu/ContextMenu.stories.tsx +2 -3
- package/src/components/Menu/ContextMenu.tsx +9 -33
- package/src/components/Menu/DropdownMenu.stories.tsx +2 -3
- package/src/components/Menu/DropdownMenu.tsx +58 -52
- package/src/components/Message/Message.stories.tsx +26 -12
- package/src/components/Message/Message.tsx +14 -30
- package/src/components/Popover/Popover.stories.tsx +7 -8
- package/src/components/Popover/Popover.tsx +62 -59
- package/src/components/ScrollArea/ScrollArea.stories.tsx +214 -75
- package/src/components/ScrollArea/ScrollArea.tsx +85 -113
- package/src/components/ScrollArea/index.ts +1 -1
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +47 -26
- package/src/components/ScrollContainer/ScrollContainer.tsx +206 -92
- package/src/components/Select/Select.stories.tsx +7 -8
- package/src/components/Select/Select.tsx +11 -27
- package/src/components/Separator/Separator.tsx +5 -8
- package/src/components/Skeleton/Skeleton.stories.tsx +51 -0
- package/src/components/Skeleton/Skeleton.tsx +26 -0
- package/src/components/Skeleton/index.ts +5 -0
- package/src/components/Splitter/Splitter.stories.tsx +83 -0
- package/src/components/Splitter/Splitter.tsx +127 -0
- package/src/components/Splitter/index.ts +5 -0
- package/src/components/Status/Status.stories.tsx +21 -18
- package/src/components/Status/Status.tsx +10 -7
- package/src/components/Tag/Tag.stories.tsx +4 -10
- package/src/components/Tag/Tag.tsx +2 -7
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +31 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +9 -7
- package/src/components/Toast/Toast.stories.tsx +2 -3
- package/src/components/Toast/Toast.tsx +22 -41
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -3
- package/src/components/Toolbar/Toolbar.tsx +173 -26
- package/src/components/Tooltip/Tooltip.stories.tsx +20 -19
- package/src/components/Tooltip/Tooltip.tsx +18 -18
- package/src/components/index.ts +10 -5
- package/src/exemplars/generics.stories.tsx +41 -0
- package/src/exemplars/slot.stories.tsx +117 -0
- package/src/exemplars/tabster.stories.tsx +127 -0
- package/src/exemplars/virtualizer.stories.tsx +137 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDensityContext.ts +2 -2
- package/src/index.ts +1 -0
- package/src/playground/Controls.stories.tsx +3 -10
- package/src/playground/Custom.stories.tsx +15 -18
- package/src/playground/Typography.stories.tsx +3 -3
- package/src/primitives/Column/AUDIT.md +354 -0
- package/src/primitives/Column/Column.stories.tsx +183 -0
- package/src/primitives/Column/Column.tsx +169 -0
- package/src/primitives/Column/index.ts +5 -0
- package/src/primitives/Container/Container.stories.tsx +29 -0
- package/src/primitives/Container/Container.tsx +19 -0
- package/src/primitives/Container/index.ts +5 -0
- package/src/primitives/Flex/Flex.stories.tsx +57 -0
- package/src/primitives/Flex/Flex.tsx +27 -0
- package/src/primitives/Flex/index.ts +5 -0
- package/src/primitives/Grid/Grid.stories.tsx +56 -0
- package/src/primitives/Grid/Grid.tsx +30 -0
- package/src/primitives/Grid/index.ts +5 -0
- package/src/primitives/Panel/Panel.stories.tsx +68 -0
- package/src/primitives/Panel/Panel.tsx +120 -0
- package/src/primitives/Panel/index.ts +5 -0
- package/src/primitives/index.ts +9 -0
- package/src/testing/Loading.tsx +47 -0
- package/src/testing/decorators/withLayout.tsx +21 -7
- package/src/testing/decorators/withLayoutVariants.tsx +18 -21
- package/src/testing/decorators/withTheme.tsx +24 -19
- package/src/testing/index.ts +2 -0
- package/src/translations.ts +19 -0
- package/src/util/usePx.ts +1 -0
- package/dist/lib/browser/chunk-CEKVHJ27.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2NHEX4AD.mjs.map +0 -7
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +0 -15
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +0 -1
- package/dist/types/src/components/AnchoredOverflow/index.d.ts +0 -2
- package/dist/types/src/components/AnchoredOverflow/index.d.ts.map +0 -1
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +0 -59
- package/src/components/AnchoredOverflow/index.ts +0 -5
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import React, { type CSSProperties } from 'react';
|
|
8
|
+
|
|
9
|
+
import { type ColumnStyleProps, composableProps, slottable } from '@dxos/ui-theme';
|
|
10
|
+
import { type SlottableProps } from '@dxos/ui-types';
|
|
11
|
+
|
|
12
|
+
import { ScrollArea, type ScrollAreaRootProps } from '../../components';
|
|
13
|
+
import { useThemeContext } from '../../hooks';
|
|
14
|
+
|
|
15
|
+
//
|
|
16
|
+
// Root
|
|
17
|
+
//
|
|
18
|
+
|
|
19
|
+
const COLUMN_ROOT_NAME = 'Column.Root';
|
|
20
|
+
|
|
21
|
+
type GutterSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
22
|
+
|
|
23
|
+
const gutterSizes: Record<GutterSize, string> = {
|
|
24
|
+
xs: 'var(--dx-gutter-xs)',
|
|
25
|
+
sm: 'var(--dx-gutter-sm)',
|
|
26
|
+
md: 'var(--dx-gutter-md)',
|
|
27
|
+
lg: 'var(--dx-gutter-lg)',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type ColumnRootProps = { gutter?: GutterSize };
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates a 3-column CSS grid with left/right gutter columns and a center content column.
|
|
34
|
+
* Sets the `--gutter` CSS variable for nested components.
|
|
35
|
+
*
|
|
36
|
+
* Direct children participate in the grid in one of three ways:
|
|
37
|
+
* - **Column.Row** — 3-col subgrid row (icons in gutters, content in center).
|
|
38
|
+
* - **Column.Content** — spans full width; re-applies gutters as `px-[var(--gutter)]` padding.
|
|
39
|
+
* Sets `--gutter-offset` so nested ScrollAreas can break out of the padding.
|
|
40
|
+
* - **Column.Viewport** — spans full width; delegates gutters to ScrollArea.
|
|
41
|
+
*
|
|
42
|
+
* Gutter sizes: `'sm'` for compact layouts (Dialog); `'md'` (default); `'lg'` for wider spacing.
|
|
43
|
+
*/
|
|
44
|
+
const ColumnRoot = slottable<HTMLDivElement, ColumnRootProps>(
|
|
45
|
+
({ children, asChild, role, gutter = 'md', ...props }, forwardedRef) => {
|
|
46
|
+
const { className, ...rest } = composableProps(props);
|
|
47
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
48
|
+
const { tx } = useThemeContext();
|
|
49
|
+
const gutterSize = gutterSizes[gutter];
|
|
50
|
+
return (
|
|
51
|
+
<Comp
|
|
52
|
+
{...rest}
|
|
53
|
+
role={role ?? 'none'}
|
|
54
|
+
style={
|
|
55
|
+
{
|
|
56
|
+
'--gutter': gutterSize,
|
|
57
|
+
gridTemplateColumns: [gutterSize, 'minmax(0,1fr)', gutterSize].join(' '),
|
|
58
|
+
} as CSSProperties
|
|
59
|
+
}
|
|
60
|
+
className={tx('column.root', { gutter }, className)}
|
|
61
|
+
ref={forwardedRef}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</Comp>
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
ColumnRoot.displayName = COLUMN_ROOT_NAME;
|
|
70
|
+
|
|
71
|
+
//
|
|
72
|
+
// Row
|
|
73
|
+
//
|
|
74
|
+
|
|
75
|
+
const COLUMN_ROW_NAME = 'Column.Row';
|
|
76
|
+
|
|
77
|
+
type ColumnRowProps = ColumnStyleProps;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Spans all 3 columns of the parent Column.Root and uses CSS subgrid to inherit their sizing.
|
|
81
|
+
* Children map to: [col-1: icon/slot] [col-2: content] [col-3: icon/action].
|
|
82
|
+
* Must be a direct child of Column.Root.
|
|
83
|
+
*/
|
|
84
|
+
const ColumnRow = slottable<HTMLDivElement, ColumnRowProps>(
|
|
85
|
+
({ children, asChild, role, fullWidth, center, ...props }, forwardedRef) => {
|
|
86
|
+
const { className, ...rest } = composableProps(props);
|
|
87
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
88
|
+
const { tx } = useThemeContext();
|
|
89
|
+
return (
|
|
90
|
+
<Comp
|
|
91
|
+
{...rest}
|
|
92
|
+
role={role ?? 'none'}
|
|
93
|
+
className={tx('column.row', { fullWidth, center }, className)}
|
|
94
|
+
ref={forwardedRef}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
</Comp>
|
|
98
|
+
);
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
ColumnRow.displayName = COLUMN_ROW_NAME;
|
|
103
|
+
|
|
104
|
+
//
|
|
105
|
+
// Content
|
|
106
|
+
//
|
|
107
|
+
|
|
108
|
+
const COLUMN_CONTENT_NAME = 'Column.Content';
|
|
109
|
+
|
|
110
|
+
type ColumnContentProps = SlottableProps;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Full-width content area that inherits Column.Root's 3-column grid via CSS subgrid.
|
|
114
|
+
* Non-scrolling children default to the center column (between gutters).
|
|
115
|
+
* ScrollArea children span all 3 columns via `[.dx-column_&]:col-span-full`.
|
|
116
|
+
*/
|
|
117
|
+
const ColumnContent = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
118
|
+
const { tx } = useThemeContext();
|
|
119
|
+
const { className, ...rest } = composableProps(props);
|
|
120
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
121
|
+
return (
|
|
122
|
+
<Comp {...rest} className={tx('column.content', {}, className)} ref={forwardedRef}>
|
|
123
|
+
{children}
|
|
124
|
+
</Comp>
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
ColumnContent.displayName = COLUMN_CONTENT_NAME;
|
|
129
|
+
|
|
130
|
+
//
|
|
131
|
+
// Viewport
|
|
132
|
+
//
|
|
133
|
+
|
|
134
|
+
const COLUMN_VIEWPORT_NAME = 'Column.Viewport';
|
|
135
|
+
|
|
136
|
+
type ColumnViewportProps = Pick<ScrollAreaRootProps, 'thin'>;
|
|
137
|
+
|
|
138
|
+
const ColumnViewport = slottable<HTMLDivElement, ColumnViewportProps>(
|
|
139
|
+
({ children, asChild, role, ...props }, forwardedRef) => {
|
|
140
|
+
const { tx } = useThemeContext();
|
|
141
|
+
const { className, ...rest } = composableProps(props);
|
|
142
|
+
return (
|
|
143
|
+
<ScrollArea.Root
|
|
144
|
+
{...rest}
|
|
145
|
+
className={tx('column.viewport', {}, className)}
|
|
146
|
+
orientation='vertical'
|
|
147
|
+
padding
|
|
148
|
+
ref={forwardedRef}
|
|
149
|
+
>
|
|
150
|
+
<ScrollArea.Viewport>{children}</ScrollArea.Viewport>
|
|
151
|
+
</ScrollArea.Root>
|
|
152
|
+
);
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
ColumnViewport.displayName = COLUMN_VIEWPORT_NAME;
|
|
157
|
+
|
|
158
|
+
//
|
|
159
|
+
// Column
|
|
160
|
+
//
|
|
161
|
+
|
|
162
|
+
export const Column = {
|
|
163
|
+
Root: ColumnRoot,
|
|
164
|
+
Content: ColumnContent,
|
|
165
|
+
Viewport: ColumnViewport,
|
|
166
|
+
Row: ColumnRow,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type { ColumnRootProps, ColumnContentProps, ColumnViewportProps, ColumnRowProps };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { withLayout, withTheme } from '../../testing';
|
|
9
|
+
import { Container } from './Container';
|
|
10
|
+
|
|
11
|
+
const DefaultStory = () => (
|
|
12
|
+
<Container asChild>
|
|
13
|
+
<div className='grid place-items-center border border-red-500'>Hello</div>
|
|
14
|
+
</Container>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const meta: Meta = {
|
|
18
|
+
title: 'ui/react-ui-core/primitives/Container',
|
|
19
|
+
component: Container,
|
|
20
|
+
render: DefaultStory,
|
|
21
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
22
|
+
parameters: { layout: 'fullscreen' },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
type Story = StoryObj<typeof meta>;
|
|
28
|
+
|
|
29
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { composableProps, mx, slottable } from '@dxos/ui-theme';
|
|
10
|
+
|
|
11
|
+
export const Container = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
12
|
+
const { className, ...rest } = composableProps<HTMLDivElement>(props);
|
|
13
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
14
|
+
return (
|
|
15
|
+
<Comp {...rest} className={mx('dx-container', className)} ref={forwardedRef}>
|
|
16
|
+
{children}
|
|
17
|
+
</Comp>
|
|
18
|
+
);
|
|
19
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { type ChromaticPalette } from '@dxos/ui-types';
|
|
9
|
+
|
|
10
|
+
import { withLayout, withTheme } from '../../testing';
|
|
11
|
+
import { Flex } from './Flex';
|
|
12
|
+
|
|
13
|
+
const Cell = ({ label, hue }: { label: string; hue: ChromaticPalette }) => (
|
|
14
|
+
<div data-hue={hue} className='flex w-full dx-panel p-2 text-sm font-mono border rounded-sm'>
|
|
15
|
+
{label}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const RowStory = () => (
|
|
20
|
+
<Flex classNames='gap-2 p-2'>
|
|
21
|
+
<Cell label='A' hue='red' />
|
|
22
|
+
<Cell label='B' hue='green' />
|
|
23
|
+
<Cell label='C' hue='blue' />
|
|
24
|
+
</Flex>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const ColumnStory = () => (
|
|
28
|
+
<Flex column classNames='gap-2 p-2'>
|
|
29
|
+
<Cell label='A' hue='red' />
|
|
30
|
+
<Cell label='B' hue='green' />
|
|
31
|
+
<Cell label='C' hue='blue' />
|
|
32
|
+
</Flex>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const GrowStory = () => (
|
|
36
|
+
<Flex column grow classNames='gap-2 p-2'>
|
|
37
|
+
<Cell label='Header' hue='yellow' />
|
|
38
|
+
<Flex grow>
|
|
39
|
+
<Cell label='Content (grows)' hue='blue' />
|
|
40
|
+
</Flex>
|
|
41
|
+
<Cell label='Footer' hue='orange' />
|
|
42
|
+
</Flex>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const meta: Meta = {
|
|
46
|
+
title: 'ui/react-ui-core/primitives/Flex',
|
|
47
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
48
|
+
parameters: { layout: 'fullscreen' },
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default meta;
|
|
52
|
+
|
|
53
|
+
type Story = StoryObj<typeof meta>;
|
|
54
|
+
|
|
55
|
+
export const Row: Story = { render: RowStory };
|
|
56
|
+
export const Column: Story = { render: ColumnStory };
|
|
57
|
+
export const Grow: Story = { render: GrowStory };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { composableProps, mx, slottable } from '@dxos/ui-theme';
|
|
10
|
+
|
|
11
|
+
export type FlexProps = { column?: boolean; grow?: boolean };
|
|
12
|
+
|
|
13
|
+
export const Flex = slottable<HTMLDivElement, FlexProps>(
|
|
14
|
+
({ children, asChild, column, grow, ...props }, forwardedRef) => {
|
|
15
|
+
const { className, ...rest } = composableProps(props);
|
|
16
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
17
|
+
return (
|
|
18
|
+
<Comp
|
|
19
|
+
ref={forwardedRef}
|
|
20
|
+
{...rest}
|
|
21
|
+
className={mx('flex', column && 'flex-col', grow && 'flex-1 overflow-hidden', className)}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</Comp>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { type ChromaticPalette } from '@dxos/ui-types';
|
|
9
|
+
|
|
10
|
+
import { withLayout, withTheme } from '../../testing';
|
|
11
|
+
import { Grid } from './Grid';
|
|
12
|
+
|
|
13
|
+
const Cell = ({ label, hue }: { label: string; hue: ChromaticPalette }) => (
|
|
14
|
+
<div data-hue={hue} className='dx-panel p-2 text-sm font-mono border rounded-sm'>
|
|
15
|
+
{label}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const ColsStory = () => (
|
|
20
|
+
<Grid cols={3} classNames='gap-2 p-2'>
|
|
21
|
+
<Cell label='Row 1' hue='red' />
|
|
22
|
+
<Cell label='Row 2' hue='green' />
|
|
23
|
+
<Cell label='Row 3' hue='blue' />
|
|
24
|
+
</Grid>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const RowsStory = () => (
|
|
28
|
+
<Grid rows={3} classNames='gap-2 p-2'>
|
|
29
|
+
<Cell label='Row 1' hue='red' />
|
|
30
|
+
<Cell label='Row 2' hue='green' />
|
|
31
|
+
<Cell label='Row 3' hue='blue' />
|
|
32
|
+
</Grid>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const MixedStory = () => (
|
|
36
|
+
<Grid cols={2} rows={2} classNames='gap-2 p-2'>
|
|
37
|
+
<Cell label='A' hue='red' />
|
|
38
|
+
<Cell label='B' hue='green' />
|
|
39
|
+
<Cell label='C' hue='blue' />
|
|
40
|
+
<Cell label='D' hue='yellow' />
|
|
41
|
+
</Grid>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const meta: Meta = {
|
|
45
|
+
title: 'ui/react-ui-core/primitives/Grid',
|
|
46
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
47
|
+
parameters: { layout: 'fullscreen' },
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default meta;
|
|
51
|
+
|
|
52
|
+
type Story = StoryObj<typeof meta>;
|
|
53
|
+
|
|
54
|
+
export const Cols: Story = { render: ColsStory };
|
|
55
|
+
export const Rows: Story = { render: RowsStory };
|
|
56
|
+
export const Mixed: Story = { render: MixedStory };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { composable, composableProps, mx } from '@dxos/ui-theme';
|
|
8
|
+
|
|
9
|
+
export type GridProps = { cols?: number; rows?: number; grow?: boolean };
|
|
10
|
+
|
|
11
|
+
export const Grid = composable<HTMLDivElement, GridProps>(
|
|
12
|
+
({ children, style, role, cols, rows, grow = true, ...props }, forwardedRef) => {
|
|
13
|
+
const { className, ...rest } = composableProps(props);
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
ref={forwardedRef}
|
|
17
|
+
{...rest}
|
|
18
|
+
role={role ?? 'none'}
|
|
19
|
+
className={mx('grid overflow-hidden', grow && 'dx-container', className)}
|
|
20
|
+
style={{
|
|
21
|
+
gridTemplateColumns: cols ? `repeat(${cols}, 1fr)` : undefined,
|
|
22
|
+
gridTemplateRows: rows ? `repeat(${rows}, 1fr)` : undefined,
|
|
23
|
+
...style,
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
9
|
+
|
|
10
|
+
import { Input, ScrollArea, ScrollAreaRootProps, Toolbar } from '../../components';
|
|
11
|
+
import { withLayout, withTheme } from '../../testing';
|
|
12
|
+
import { Panel } from './Panel';
|
|
13
|
+
|
|
14
|
+
const List = composable<HTMLDivElement, ScrollAreaRootProps>((props, forwardedRef) => {
|
|
15
|
+
return (
|
|
16
|
+
<ScrollArea.Root centered {...composableProps(props, { role: 'list' })} ref={forwardedRef}>
|
|
17
|
+
<ScrollArea.Viewport>
|
|
18
|
+
{Array.from({ length: 100 }).map((_, i) => (
|
|
19
|
+
<div key={i} role='listitem' className='p-1 hover:bg-hover-surface'>
|
|
20
|
+
Item {i}
|
|
21
|
+
</div>
|
|
22
|
+
))}
|
|
23
|
+
</ScrollArea.Viewport>
|
|
24
|
+
</ScrollArea.Root>
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const DefaultStory = () => {
|
|
29
|
+
return (
|
|
30
|
+
<Panel.Root className='dx-document'>
|
|
31
|
+
<Panel.Toolbar asChild>
|
|
32
|
+
<Toolbar.Root classNames='gap-2'>
|
|
33
|
+
<Toolbar.IconButton icon='ph--plus--regular' variant='primary' label='Add' />
|
|
34
|
+
<Input.Root>
|
|
35
|
+
<Input.TextInput placeholder='Search' />
|
|
36
|
+
</Input.Root>
|
|
37
|
+
<Toolbar.IconButton icon='ph--dots-three-vertical--regular' iconOnly label='Menu' />
|
|
38
|
+
</Toolbar.Root>
|
|
39
|
+
</Panel.Toolbar>
|
|
40
|
+
|
|
41
|
+
<Panel.Content asChild>
|
|
42
|
+
<List />
|
|
43
|
+
</Panel.Content>
|
|
44
|
+
|
|
45
|
+
<Panel.Statusbar asChild>
|
|
46
|
+
<Toolbar.Root classNames='justify-between'>
|
|
47
|
+
<Toolbar.IconButton variant='ghost' icon='ph--house--regular' iconOnly label='Add' />
|
|
48
|
+
<Toolbar.IconButton variant='ghost' icon='ph--alarm--regular' iconOnly label='Status' />
|
|
49
|
+
</Toolbar.Root>
|
|
50
|
+
</Panel.Statusbar>
|
|
51
|
+
</Panel.Root>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const meta: Meta = {
|
|
56
|
+
title: 'ui/react-ui-core/primitives/Panel',
|
|
57
|
+
render: DefaultStory,
|
|
58
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
59
|
+
parameters: {
|
|
60
|
+
layout: 'fullscreen',
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default meta;
|
|
65
|
+
|
|
66
|
+
type Story = StoryObj<typeof meta>;
|
|
67
|
+
|
|
68
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import React, { type CSSProperties } from 'react';
|
|
8
|
+
|
|
9
|
+
import { composableProps, PanelStyleProps, slottable } from '@dxos/ui-theme';
|
|
10
|
+
import { type SlottableProps } from '@dxos/ui-types';
|
|
11
|
+
|
|
12
|
+
import { useThemeContext } from '../../hooks';
|
|
13
|
+
|
|
14
|
+
//
|
|
15
|
+
// Root
|
|
16
|
+
//
|
|
17
|
+
|
|
18
|
+
const GRID_TEMPLATE_ROWS = 'auto 1fr auto';
|
|
19
|
+
const GRID_TEMPLATE_AREAS = '"toolbar" "content" "statusbar"';
|
|
20
|
+
|
|
21
|
+
type PanelRootProps = SlottableProps<{ style?: CSSProperties }>;
|
|
22
|
+
|
|
23
|
+
const PanelRoot = slottable<HTMLDivElement, { style?: CSSProperties }>(
|
|
24
|
+
({ children, asChild, role, style, ...props }, forwardedRef) => {
|
|
25
|
+
const { className, ...rest } = composableProps(props);
|
|
26
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
27
|
+
const { tx } = useThemeContext();
|
|
28
|
+
return (
|
|
29
|
+
<Comp
|
|
30
|
+
{...rest}
|
|
31
|
+
role={role ?? 'none'}
|
|
32
|
+
style={{
|
|
33
|
+
gridTemplateRows: GRID_TEMPLATE_ROWS,
|
|
34
|
+
gridTemplateAreas: GRID_TEMPLATE_AREAS,
|
|
35
|
+
...style,
|
|
36
|
+
}}
|
|
37
|
+
className={tx('panel.root', {}, className)}
|
|
38
|
+
ref={forwardedRef}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</Comp>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
PanelRoot.displayName = 'Panel.Root';
|
|
47
|
+
|
|
48
|
+
//
|
|
49
|
+
// Toolbar
|
|
50
|
+
//
|
|
51
|
+
|
|
52
|
+
type PanelToolbarProps = SlottableProps & Pick<PanelStyleProps, 'size'>;
|
|
53
|
+
|
|
54
|
+
const PanelToolbar = slottable<HTMLDivElement, Pick<PanelStyleProps, 'size'>>(
|
|
55
|
+
({ children, asChild, size, ...props }, forwardedRef) => {
|
|
56
|
+
const { className, ...rest } = composableProps(props);
|
|
57
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
58
|
+
const { tx } = useThemeContext();
|
|
59
|
+
return (
|
|
60
|
+
<Comp {...rest} data-slot='toolbar' className={tx('panel.toolbar', { size }, className)} ref={forwardedRef}>
|
|
61
|
+
{children}
|
|
62
|
+
</Comp>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
PanelToolbar.displayName = 'Panel.Toolbar';
|
|
68
|
+
|
|
69
|
+
//
|
|
70
|
+
// Content
|
|
71
|
+
//
|
|
72
|
+
|
|
73
|
+
type PanelContentProps = SlottableProps;
|
|
74
|
+
|
|
75
|
+
const PanelContent = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
76
|
+
const { className, ...rest } = composableProps(props);
|
|
77
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
78
|
+
const { tx } = useThemeContext();
|
|
79
|
+
return (
|
|
80
|
+
<Comp {...rest} data-slot='content' className={tx('panel.content', {}, className)} ref={forwardedRef}>
|
|
81
|
+
{children}
|
|
82
|
+
</Comp>
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
PanelContent.displayName = 'Panel.Content';
|
|
87
|
+
|
|
88
|
+
//
|
|
89
|
+
// Statusbar
|
|
90
|
+
//
|
|
91
|
+
|
|
92
|
+
type PanelStatusbarProps = SlottableProps & Pick<PanelStyleProps, 'size'>;
|
|
93
|
+
|
|
94
|
+
const PanelStatusbar = slottable<HTMLDivElement, Pick<PanelStyleProps, 'size'>>(
|
|
95
|
+
({ children, asChild, size, ...props }, forwardedRef) => {
|
|
96
|
+
const { className, ...rest } = composableProps(props);
|
|
97
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
98
|
+
const { tx } = useThemeContext();
|
|
99
|
+
return (
|
|
100
|
+
<Comp {...rest} data-slot='statusbar' className={tx('panel.statusbar', { size }, className)} ref={forwardedRef}>
|
|
101
|
+
{children}
|
|
102
|
+
</Comp>
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
PanelStatusbar.displayName = 'Panel.Statusbar';
|
|
108
|
+
|
|
109
|
+
//
|
|
110
|
+
// Panel
|
|
111
|
+
//
|
|
112
|
+
|
|
113
|
+
export const Panel = {
|
|
114
|
+
Root: PanelRoot,
|
|
115
|
+
Toolbar: PanelToolbar,
|
|
116
|
+
Content: PanelContent,
|
|
117
|
+
Statusbar: PanelStatusbar,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export type { PanelRootProps, PanelToolbarProps, PanelContentProps, PanelStatusbarProps };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { captureOwnerStack, useEffect, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { mx } from '@dxos/ui-theme';
|
|
8
|
+
import { safeStringify } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
import { ErrorStack, parseCaptureOwnerStack } from '../components';
|
|
11
|
+
|
|
12
|
+
export type LoadingProps = { data?: any };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Storybook loading component.
|
|
16
|
+
*/
|
|
17
|
+
export const Loading = ({ data }: LoadingProps) => {
|
|
18
|
+
const [visible, setVisible] = useState(false);
|
|
19
|
+
const ownerFrames = parseCaptureOwnerStack(captureOwnerStack());
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const t = setTimeout(() => setVisible(true), 500);
|
|
23
|
+
return () => clearTimeout(t);
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className='w-full p-2'>
|
|
28
|
+
<div
|
|
29
|
+
className={mx(
|
|
30
|
+
'flex flex-col w-full p-2 border-2 border-teal-500 rounded-md',
|
|
31
|
+
'opacity-0 transition delay-1000 duration-1000',
|
|
32
|
+
visible && 'opacity-100',
|
|
33
|
+
)}
|
|
34
|
+
>
|
|
35
|
+
<h2 className='uppercase capitalize text-xs'>Loading State</h2>
|
|
36
|
+
<pre className='text-sm text-description'>{safeStringify(data, undefined, 2)}</pre>
|
|
37
|
+
|
|
38
|
+
<h3 className='uppercase capitalize text-xs mt-2'>Owner stack</h3>
|
|
39
|
+
{ownerFrames && ownerFrames.length > 0 ? (
|
|
40
|
+
<ErrorStack frames={ownerFrames} />
|
|
41
|
+
) : (
|
|
42
|
+
<p className='text-xs text-subdued'>No owner stack (production build or unsupported context).</p>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|