@dxos/react-ui 0.8.4-main.d05673bc65 → 0.8.4-main.e00bdcdb52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-2FKSMWNY.mjs → chunk-BDBC6H6V.mjs} +79 -5
- package/dist/lib/browser/chunk-BDBC6H6V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +921 -736
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +30 -18
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/translations.mjs +18 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZNBLTSHI.mjs → chunk-3JSJK2ZY.mjs} +79 -5
- package/dist/lib/node-esm/chunk-3JSJK2ZY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +921 -736
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +30 -18
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/translations.mjs +20 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +2 -2
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts +1 -1
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.d.ts +1 -0
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.stories.d.ts +3 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.d.ts +2 -2
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -1
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +6 -6
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +2 -2
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +70 -50
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +2 -2
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +10 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +42 -31
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +47 -30
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +3 -2
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +14 -3
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -1
- package/dist/types/src/components/Focus/Focus.d.ts +36 -0
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts +9 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +2 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -0
- package/dist/types/src/components/Icon/Icon.d.ts +3 -0
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +11 -3
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.d.ts +2 -1
- package/dist/types/src/components/Image/Image.d.ts.map +1 -1
- package/dist/types/src/components/Image/Image.stories.d.ts +3 -2
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +14 -17
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +3 -3
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +5 -3
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +3 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.d.ts +2 -2
- package/dist/types/src/components/List/Tree.d.ts.map +1 -1
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.d.ts +5 -9
- package/dist/types/src/components/List/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +7 -3
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/useSwipeToDismiss.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +58 -49
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +14 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +2 -2
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +38 -22
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +12 -9
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +18 -5
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +42 -13
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +5 -6
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -2
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +3 -3
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.d.ts +19 -17
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.d.ts +3 -4
- package/dist/types/src/components/Status/Status.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +54 -55
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +16 -16
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +11 -19
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +10 -10
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +2 -2
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +6 -5
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/slot.stories.d.ts +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useIconHref.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.d.ts +21 -14
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.stories.d.ts +19 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.d.ts +4 -5
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.d.ts +5 -7
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.d.ts +3 -8
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Panel/Panel.d.ts +24 -15
- package/dist/types/src/primitives/Panel/Panel.d.ts.map +1 -1
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts.map +1 -1
- package/dist/types/src/testing/Loading.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts +1 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -3
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/usePx.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +28 -25
- package/src/components/Avatars/Avatar.stories.tsx +2 -3
- package/src/components/Avatars/Avatar.tsx +1 -2
- package/src/components/Avatars/AvatarGroup.stories.tsx +0 -1
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +1 -2
- package/src/components/Button/Button.stories.tsx +0 -1
- package/src/components/Button/Button.tsx +5 -13
- package/src/components/Button/IconButton.stories.tsx +6 -4
- package/src/components/Button/IconButton.tsx +3 -4
- package/src/components/Button/Toggle.stories.tsx +0 -1
- package/src/components/Button/Toggle.tsx +4 -4
- package/src/components/Button/ToggleGroup.stories.tsx +0 -1
- package/src/components/Button/ToggleGroup.tsx +12 -16
- package/src/components/Card/Card.stories.tsx +12 -12
- package/src/components/Card/Card.tsx +266 -108
- package/src/components/Clipboard/CopyButton.tsx +3 -4
- package/src/components/Dialog/AlertDialog.stories.tsx +5 -6
- package/src/components/Dialog/AlertDialog.tsx +67 -126
- package/src/components/Dialog/Dialog.stories.tsx +64 -9
- package/src/components/Dialog/Dialog.tsx +84 -88
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +3 -8
- package/src/components/ErrorFallback/ErrorStack.tsx +36 -2
- package/src/components/Focus/AUDIT.md +43 -0
- package/src/components/Focus/Focus.stories.tsx +230 -0
- package/src/components/Focus/Focus.tsx +201 -0
- package/src/components/Focus/index.ts +5 -0
- package/src/components/Icon/Icon.stories.tsx +43 -13
- package/src/components/Icon/Icon.tsx +5 -1
- package/src/components/Image/Image.stories.tsx +3 -3
- package/src/components/Image/Image.tsx +31 -8
- package/src/components/Input/Input.stories.tsx +3 -4
- package/src/components/Input/Input.tsx +7 -7
- package/src/components/Link/Link.stories.tsx +0 -1
- package/src/components/List/List.stories.tsx +0 -1
- package/src/components/List/List.tsx +6 -5
- package/src/components/List/Tree.stories.tsx +1 -2
- package/src/components/List/Tree.tsx +0 -1
- package/src/components/List/Treegrid.stories.tsx +26 -27
- package/src/components/List/Treegrid.tsx +14 -14
- package/src/components/Main/Main.stories.tsx +0 -1
- package/src/components/Main/Main.tsx +1 -2
- package/src/components/Menu/ContextMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.stories.tsx +0 -1
- package/src/components/Menu/DropdownMenu.tsx +48 -42
- package/src/components/Message/Message.stories.tsx +6 -7
- package/src/components/Message/Message.tsx +1 -5
- package/src/components/Popover/Popover.stories.tsx +4 -5
- package/src/components/Popover/Popover.tsx +42 -42
- package/src/components/ScrollArea/ScrollArea.stories.tsx +93 -30
- package/src/components/ScrollArea/ScrollArea.tsx +39 -23
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +20 -18
- package/src/components/ScrollContainer/ScrollContainer.tsx +200 -91
- package/src/components/Select/Select.stories.tsx +5 -6
- package/src/components/Separator/Separator.tsx +4 -7
- package/src/components/Skeleton/Skeleton.stories.tsx +0 -1
- package/src/components/Splitter/Splitter.stories.tsx +29 -29
- package/src/components/Splitter/Splitter.tsx +35 -34
- package/src/components/Status/Status.stories.tsx +0 -1
- package/src/components/Status/Status.tsx +8 -5
- package/src/components/Tag/Tag.stories.tsx +0 -1
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +0 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +5 -4
- package/src/components/ThemeProvider/index.ts +1 -1
- package/src/components/Toast/Toast.stories.tsx +0 -1
- package/src/components/Toast/Toast.tsx +16 -31
- package/src/components/Toolbar/Toolbar.stories.tsx +0 -1
- package/src/components/Toolbar/Toolbar.tsx +21 -35
- package/src/components/Tooltip/Tooltip.stories.tsx +6 -7
- package/src/components/Tooltip/Tooltip.tsx +15 -16
- package/src/components/index.ts +1 -0
- package/src/exemplars/generics.stories.tsx +7 -15
- package/src/exemplars/slot.stories.tsx +67 -57
- package/src/exemplars/tabster.stories.tsx +1 -1
- package/src/exemplars/virtualizer.stories.tsx +4 -4
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDensityContext.ts +2 -2
- package/src/playground/Custom.stories.tsx +6 -9
- package/src/primitives/Column/AUDIT.md +148 -0
- package/src/primitives/Column/Column.stories.tsx +122 -19
- package/src/primitives/Column/Column.tsx +73 -42
- package/src/primitives/Container/Container.stories.tsx +0 -1
- package/src/primitives/Container/Container.tsx +5 -8
- package/src/primitives/Flex/Flex.stories.tsx +0 -1
- package/src/primitives/Flex/Flex.tsx +10 -12
- package/src/primitives/Grid/Grid.stories.tsx +0 -1
- package/src/primitives/Grid/Grid.tsx +4 -9
- package/src/primitives/Panel/Panel.stories.tsx +9 -8
- package/src/primitives/Panel/Panel.tsx +64 -63
- package/src/testing/Loading.tsx +25 -4
- package/src/testing/decorators/withLayout.tsx +6 -6
- package/src/testing/decorators/withTheme.tsx +10 -7
- package/src/translations.ts +3 -3
- package/src/util/usePx.ts +1 -0
- package/dist/lib/browser/chunk-2FKSMWNY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZNBLTSHI.mjs.map +0 -7
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import React, { type CSSProperties
|
|
7
|
+
import React, { type CSSProperties } from 'react';
|
|
8
8
|
|
|
9
|
-
import { composableProps } from '@dxos/ui-theme';
|
|
9
|
+
import { composableProps, slottable } from '@dxos/ui-theme';
|
|
10
10
|
import { type SlottableProps } from '@dxos/ui-types';
|
|
11
11
|
|
|
12
12
|
import { useThemeContext } from '../../hooks';
|
|
@@ -17,29 +17,35 @@ import { useThemeContext } from '../../hooks';
|
|
|
17
17
|
|
|
18
18
|
const COLUMN_ROOT_NAME = 'Column.Root';
|
|
19
19
|
|
|
20
|
-
type GutterSize = '
|
|
20
|
+
type GutterSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
21
21
|
|
|
22
22
|
const gutterSizes: Record<GutterSize, string> = {
|
|
23
|
+
xs: 'var(--dx-gutter-xs)',
|
|
23
24
|
sm: 'var(--dx-gutter-sm)',
|
|
24
25
|
md: 'var(--dx-gutter-md)',
|
|
25
26
|
lg: 'var(--dx-gutter-lg)',
|
|
26
|
-
rail: 'var(--dx-rail-item)',
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
type ColumnRootProps =
|
|
29
|
+
type ColumnRootProps = { gutter?: GutterSize };
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Creates a
|
|
33
|
-
*
|
|
34
|
-
* Use `gutter='rail'` for icon-slot row layouts (Card); `gutter='md'` for whitespace layouts (Dialog).
|
|
35
|
-
* Direct children must use Column.Row (spans all 3 cols) or Column.Segment (center col only).
|
|
32
|
+
* Creates a 3-column CSS grid with left/right gutter columns and a center content column.
|
|
33
|
+
* Sets `--gutter` and `--dx-col` CSS variables for nested components.
|
|
36
34
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* `--dx-col` defaults to `2 / span 1` (center column),
|
|
36
|
+
* enabling `withColumn` utilities to cascade the correct grid placement to slotted children.
|
|
37
|
+
*
|
|
38
|
+
* Direct children participate in the grid in one of several ways:
|
|
39
|
+
* - **Column.Center** — places element in the center column (col 2). Preferred for plain content.
|
|
40
|
+
* - **Column.Bleed** — spans all 3 columns gutter-to-gutter. Preferred for `ScrollArea` and
|
|
41
|
+
* other content that should ignore the gutters.
|
|
42
|
+
* - **Column.Row** — 3-col subgrid row (icons in gutters, content in center).
|
|
43
|
+
*
|
|
44
|
+
* Use `withColumn.center()` / `withColumn.bleed()` helpers to apply placement on slotted elements.
|
|
45
|
+
*
|
|
46
|
+
* Gutter sizes: `'sm'` for compact layouts (Dialog); `'md'` (default); `'lg'` for wider spacing.
|
|
41
47
|
*/
|
|
42
|
-
const
|
|
48
|
+
const ColumnRoot = slottable<HTMLDivElement, ColumnRootProps>(
|
|
43
49
|
({ children, asChild, role, gutter = 'md', ...props }, forwardedRef) => {
|
|
44
50
|
const { className, ...rest } = composableProps(props);
|
|
45
51
|
const Comp = asChild ? Slot : Primitive.div;
|
|
@@ -52,6 +58,7 @@ const Root = forwardRef<HTMLDivElement, ColumnRootProps>(
|
|
|
52
58
|
style={
|
|
53
59
|
{
|
|
54
60
|
'--gutter': gutterSize,
|
|
61
|
+
'--dx-col': '2 / span 1',
|
|
55
62
|
gridTemplateColumns: [gutterSize, 'minmax(0,1fr)', gutterSize].join(' '),
|
|
56
63
|
} as CSSProperties
|
|
57
64
|
}
|
|
@@ -64,7 +71,7 @@ const Root = forwardRef<HTMLDivElement, ColumnRootProps>(
|
|
|
64
71
|
},
|
|
65
72
|
);
|
|
66
73
|
|
|
67
|
-
|
|
74
|
+
ColumnRoot.displayName = COLUMN_ROOT_NAME;
|
|
68
75
|
|
|
69
76
|
//
|
|
70
77
|
// Row
|
|
@@ -72,14 +79,14 @@ Root.displayName = COLUMN_ROOT_NAME;
|
|
|
72
79
|
|
|
73
80
|
const COLUMN_ROW_NAME = 'Column.Row';
|
|
74
81
|
|
|
75
|
-
type ColumnRowProps =
|
|
82
|
+
type ColumnRowProps = {};
|
|
76
83
|
|
|
77
84
|
/**
|
|
78
85
|
* Spans all 3 columns of the parent Column.Root and uses CSS subgrid to inherit their sizing.
|
|
79
86
|
* Children map to: [col-1: icon/slot] [col-2: content] [col-3: icon/action].
|
|
80
87
|
* Must be a direct child of Column.Root.
|
|
81
88
|
*/
|
|
82
|
-
const
|
|
89
|
+
const ColumnRow = slottable<HTMLDivElement, ColumnRowProps>(({ children, asChild, role, ...props }, forwardedRef) => {
|
|
83
90
|
const { className, ...rest } = composableProps(props);
|
|
84
91
|
const Comp = asChild ? Slot : Primitive.div;
|
|
85
92
|
const { tx } = useThemeContext();
|
|
@@ -90,45 +97,69 @@ const Row = forwardRef<HTMLDivElement, ColumnRowProps>(({ children, asChild, rol
|
|
|
90
97
|
);
|
|
91
98
|
});
|
|
92
99
|
|
|
93
|
-
|
|
100
|
+
ColumnRow.displayName = COLUMN_ROW_NAME;
|
|
94
101
|
|
|
95
102
|
//
|
|
96
|
-
//
|
|
103
|
+
// Bleed
|
|
97
104
|
//
|
|
98
105
|
|
|
99
|
-
const
|
|
106
|
+
const COLUMN_BLEED_NAME = 'Column.Bleed';
|
|
100
107
|
|
|
101
|
-
type
|
|
108
|
+
type ColumnBleedProps = SlottableProps;
|
|
102
109
|
|
|
103
110
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
111
|
+
* Spans all 3 columns of the parent Column.Root (gutter-to-gutter).
|
|
112
|
+
* Establishes a CSS subgrid so that grandchildren can participate in the parent column tracks.
|
|
113
|
+
* Use for `ScrollArea`, full-width dividers, tables, or any content that should ignore the gutters.
|
|
107
114
|
*/
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
const ColumnBleed = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
116
|
+
const { tx } = useThemeContext();
|
|
117
|
+
const { className, ...rest } = composableProps(props);
|
|
118
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
119
|
+
return (
|
|
120
|
+
<Comp {...rest} className={tx('column.bleed', {}, className)} ref={forwardedRef}>
|
|
121
|
+
{children}
|
|
122
|
+
</Comp>
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
ColumnBleed.displayName = COLUMN_BLEED_NAME;
|
|
127
|
+
|
|
128
|
+
//
|
|
129
|
+
// Center
|
|
130
|
+
//
|
|
131
|
+
|
|
132
|
+
const COLUMN_CENTER_NAME = 'Column.Center';
|
|
133
|
+
|
|
134
|
+
type ColumnCenterProps = SlottableProps;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Places its element in column 2 (the center track between gutters) of the parent Column.Root.
|
|
138
|
+
* Does NOT use subgrid — placement is explicit on this element only, so it is safe to nest
|
|
139
|
+
* arbitrary compound components (including ones that render `display: contents` wrappers).
|
|
140
|
+
*/
|
|
141
|
+
const ColumnCenter = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
142
|
+
const { tx } = useThemeContext();
|
|
143
|
+
const { className, ...rest } = composableProps(props);
|
|
144
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
145
|
+
return (
|
|
146
|
+
<Comp {...rest} className={tx('column.center', {}, className)} ref={forwardedRef}>
|
|
147
|
+
{children}
|
|
148
|
+
</Comp>
|
|
149
|
+
);
|
|
150
|
+
});
|
|
121
151
|
|
|
122
|
-
|
|
152
|
+
ColumnCenter.displayName = COLUMN_CENTER_NAME;
|
|
123
153
|
|
|
124
154
|
//
|
|
125
155
|
// Column
|
|
126
156
|
//
|
|
127
157
|
|
|
128
158
|
export const Column = {
|
|
129
|
-
Root,
|
|
130
|
-
Row,
|
|
131
|
-
|
|
159
|
+
Root: ColumnRoot,
|
|
160
|
+
Row: ColumnRow,
|
|
161
|
+
Bleed: ColumnBleed,
|
|
162
|
+
Center: ColumnCenter,
|
|
132
163
|
};
|
|
133
164
|
|
|
134
|
-
export type { ColumnRootProps, ColumnRowProps,
|
|
165
|
+
export type { ColumnRootProps, ColumnRowProps, ColumnBleedProps, ColumnCenterProps };
|
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { forwardRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { composableProps, mx } from '@dxos/ui-theme';
|
|
8
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
9
|
-
import { SlottableProps } from '@dxos/ui-types';
|
|
10
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import React from 'react';
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
import { composableProps, mx, slottable } from '@dxos/ui-theme';
|
|
13
10
|
|
|
14
|
-
export const Container =
|
|
15
|
-
const { className, ...rest } = composableProps<HTMLDivElement>(props
|
|
11
|
+
export const Container = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
12
|
+
const { className, ...rest } = composableProps<HTMLDivElement>(props);
|
|
16
13
|
const Comp = asChild ? Slot : Primitive.div;
|
|
17
14
|
return (
|
|
18
15
|
<Comp {...rest} className={mx('dx-container', className)} ref={forwardedRef}>
|
|
@@ -2,28 +2,26 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import React from 'react';
|
|
6
8
|
|
|
7
|
-
import { composableProps, mx } from '@dxos/ui-theme';
|
|
8
|
-
import { type ComposableProps } from '@dxos/ui-types';
|
|
9
|
+
import { composableProps, mx, slottable } from '@dxos/ui-theme';
|
|
9
10
|
|
|
10
|
-
export type FlexProps =
|
|
11
|
-
column?: boolean;
|
|
12
|
-
grow?: boolean;
|
|
13
|
-
};
|
|
11
|
+
export type FlexProps = { column?: boolean; grow?: boolean };
|
|
14
12
|
|
|
15
|
-
export const Flex =
|
|
16
|
-
({ children,
|
|
13
|
+
export const Flex = slottable<HTMLDivElement, FlexProps>(
|
|
14
|
+
({ children, asChild, column, grow, ...props }, forwardedRef) => {
|
|
17
15
|
const { className, ...rest } = composableProps(props);
|
|
16
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
18
17
|
return (
|
|
19
|
-
<
|
|
18
|
+
<Comp
|
|
20
19
|
ref={forwardedRef}
|
|
21
20
|
{...rest}
|
|
22
|
-
role={role ?? 'none'}
|
|
23
21
|
className={mx('flex', column && 'flex-col', grow && 'flex-1 overflow-hidden', className)}
|
|
24
22
|
>
|
|
25
23
|
{children}
|
|
26
|
-
</
|
|
24
|
+
</Comp>
|
|
27
25
|
);
|
|
28
26
|
},
|
|
29
27
|
);
|
|
@@ -2,18 +2,13 @@
|
|
|
2
2
|
// Copyright 2026 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React
|
|
5
|
+
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { composableProps, mx } from '@dxos/ui-theme';
|
|
8
|
-
import { type ComposableProps } from '@dxos/ui-types';
|
|
7
|
+
import { composable, composableProps, mx } from '@dxos/ui-theme';
|
|
9
8
|
|
|
10
|
-
export type GridProps =
|
|
11
|
-
cols?: number;
|
|
12
|
-
rows?: number;
|
|
13
|
-
grow?: boolean;
|
|
14
|
-
};
|
|
9
|
+
export type GridProps = { cols?: number; rows?: number; grow?: boolean };
|
|
15
10
|
|
|
16
|
-
export const Grid =
|
|
11
|
+
export const Grid = composable<HTMLDivElement, GridProps>(
|
|
17
12
|
({ children, style, role, cols, rows, grow = true, ...props }, forwardedRef) => {
|
|
18
13
|
const { className, ...rest } = composableProps(props);
|
|
19
14
|
return (
|
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { withLayout, withTheme } from '../../testing';
|
|
8
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
10
9
|
|
|
10
|
+
import { Input, ScrollArea, ScrollAreaRootProps, Toolbar } from '../../components';
|
|
11
|
+
import { withLayout, withTheme } from '../../testing';
|
|
11
12
|
import { Panel } from './Panel';
|
|
12
13
|
|
|
13
|
-
const List = () => {
|
|
14
|
+
const List = composable<HTMLDivElement, ScrollAreaRootProps>((props, forwardedRef) => {
|
|
14
15
|
return (
|
|
15
|
-
<ScrollArea.Root
|
|
16
|
+
<ScrollArea.Root centered {...composableProps(props, { role: 'list' })} ref={forwardedRef}>
|
|
16
17
|
<ScrollArea.Viewport>
|
|
17
18
|
{Array.from({ length: 100 }).map((_, i) => (
|
|
18
19
|
<div key={i} role='listitem' className='p-1 hover:bg-hover-surface'>
|
|
@@ -22,11 +23,11 @@ const List = () => {
|
|
|
22
23
|
</ScrollArea.Viewport>
|
|
23
24
|
</ScrollArea.Root>
|
|
24
25
|
);
|
|
25
|
-
};
|
|
26
|
+
});
|
|
26
27
|
|
|
27
28
|
const DefaultStory = () => {
|
|
28
29
|
return (
|
|
29
|
-
<Panel.Root className='dx-
|
|
30
|
+
<Panel.Root className='dx-document'>
|
|
30
31
|
<Panel.Toolbar asChild>
|
|
31
32
|
<Toolbar.Root classNames='gap-2'>
|
|
32
33
|
<Toolbar.IconButton icon='ph--plus--regular' variant='primary' label='Add' />
|
|
@@ -43,8 +44,8 @@ const DefaultStory = () => {
|
|
|
43
44
|
|
|
44
45
|
<Panel.Statusbar asChild>
|
|
45
46
|
<Toolbar.Root classNames='justify-between'>
|
|
46
|
-
<Toolbar.IconButton variant='ghost' icon='ph--house--regular' iconOnly label='Add'
|
|
47
|
-
<Toolbar.IconButton variant='ghost' icon='ph--alarm--regular' iconOnly label='Status'
|
|
47
|
+
<Toolbar.IconButton variant='ghost' icon='ph--house--regular' iconOnly label='Add' />
|
|
48
|
+
<Toolbar.IconButton variant='ghost' icon='ph--alarm--regular' iconOnly label='Status' />
|
|
48
49
|
</Toolbar.Root>
|
|
49
50
|
</Panel.Statusbar>
|
|
50
51
|
</Panel.Root>
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import React, {
|
|
7
|
+
import React, { type CSSProperties } from 'react';
|
|
8
8
|
|
|
9
|
-
import { composableProps } from '@dxos/ui-theme';
|
|
9
|
+
import { composableProps, PanelStyleProps, slottable } from '@dxos/ui-theme';
|
|
10
10
|
import { type SlottableProps } from '@dxos/ui-types';
|
|
11
11
|
|
|
12
12
|
import { useThemeContext } from '../../hooks';
|
|
@@ -18,57 +18,61 @@ import { useThemeContext } from '../../hooks';
|
|
|
18
18
|
const GRID_TEMPLATE_ROWS = 'auto 1fr auto';
|
|
19
19
|
const GRID_TEMPLATE_AREAS = '"toolbar" "content" "statusbar"';
|
|
20
20
|
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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';
|
|
45
47
|
|
|
46
48
|
//
|
|
47
49
|
// Toolbar
|
|
48
50
|
//
|
|
49
51
|
|
|
50
|
-
type
|
|
52
|
+
type PanelToolbarProps = SlottableProps & Pick<PanelStyleProps, 'size'>;
|
|
51
53
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
+
);
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
PanelToolbar.displayName = 'Panel.Toolbar';
|
|
64
68
|
|
|
65
69
|
//
|
|
66
70
|
// Content
|
|
67
71
|
//
|
|
68
72
|
|
|
69
|
-
type
|
|
73
|
+
type PanelContentProps = SlottableProps;
|
|
70
74
|
|
|
71
|
-
const
|
|
75
|
+
const PanelContent = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
72
76
|
const { className, ...rest } = composableProps(props);
|
|
73
77
|
const Comp = asChild ? Slot : Primitive.div;
|
|
74
78
|
const { tx } = useThemeContext();
|
|
@@ -79,41 +83,38 @@ const Content = forwardRef<HTMLDivElement, ContentProps>(({ children, asChild, .
|
|
|
79
83
|
);
|
|
80
84
|
});
|
|
81
85
|
|
|
82
|
-
|
|
86
|
+
PanelContent.displayName = 'Panel.Content';
|
|
83
87
|
|
|
84
88
|
//
|
|
85
89
|
// Statusbar
|
|
86
90
|
//
|
|
87
91
|
|
|
88
|
-
type
|
|
92
|
+
type PanelStatusbarProps = SlottableProps & Pick<PanelStyleProps, 'size'>;
|
|
89
93
|
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
+
);
|
|
100
106
|
|
|
101
|
-
|
|
107
|
+
PanelStatusbar.displayName = 'Panel.Statusbar';
|
|
102
108
|
|
|
103
109
|
//
|
|
104
110
|
// Panel
|
|
105
111
|
//
|
|
106
112
|
|
|
107
113
|
export const Panel = {
|
|
108
|
-
Root,
|
|
109
|
-
Toolbar,
|
|
110
|
-
Content,
|
|
111
|
-
Statusbar,
|
|
114
|
+
Root: PanelRoot,
|
|
115
|
+
Toolbar: PanelToolbar,
|
|
116
|
+
Content: PanelContent,
|
|
117
|
+
Statusbar: PanelStatusbar,
|
|
112
118
|
};
|
|
113
119
|
|
|
114
|
-
export type {
|
|
115
|
-
RootProps as PanelRootProps,
|
|
116
|
-
ToolbarProps as PanelToolbarProps,
|
|
117
|
-
ContentProps as PanelContentProps,
|
|
118
|
-
StatusbarProps as PanelStatusbarProps,
|
|
119
|
-
};
|
|
120
|
+
export type { PanelRootProps, PanelToolbarProps, PanelContentProps, PanelStatusbarProps };
|
package/src/testing/Loading.tsx
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import React, { captureOwnerStack, useEffect, useState } from 'react';
|
|
6
|
+
|
|
5
7
|
import { mx } from '@dxos/ui-theme';
|
|
6
8
|
import { safeStringify } from '@dxos/util';
|
|
7
|
-
|
|
9
|
+
|
|
10
|
+
import { ErrorStack, parseCaptureOwnerStack } from '../components';
|
|
8
11
|
|
|
9
12
|
export type LoadingProps = { data?: any };
|
|
10
13
|
|
|
@@ -13,14 +16,32 @@ export type LoadingProps = { data?: any };
|
|
|
13
16
|
*/
|
|
14
17
|
export const Loading = ({ data }: LoadingProps) => {
|
|
15
18
|
const [visible, setVisible] = useState(false);
|
|
19
|
+
const ownerFrames = parseCaptureOwnerStack(captureOwnerStack());
|
|
20
|
+
|
|
16
21
|
useEffect(() => {
|
|
17
22
|
const t = setTimeout(() => setVisible(true), 500);
|
|
18
23
|
return () => clearTimeout(t);
|
|
19
24
|
}, []);
|
|
25
|
+
|
|
20
26
|
return (
|
|
21
|
-
<div className=
|
|
22
|
-
<
|
|
23
|
-
|
|
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>
|
|
24
45
|
</div>
|
|
25
46
|
);
|
|
26
47
|
};
|
|
@@ -39,7 +39,7 @@ export const withLayout =
|
|
|
39
39
|
const { layout = 'default', classNames, scroll } = props;
|
|
40
40
|
const Container = layouts[layout] ?? layouts.fullscreen;
|
|
41
41
|
return (
|
|
42
|
-
<Container classNames={mx(
|
|
42
|
+
<Container classNames={mx(scroll ? 'overflow-y-auto' : 'overflow-hidden', classNames)}>
|
|
43
43
|
<MemoizedStory />
|
|
44
44
|
</Container>
|
|
45
45
|
);
|
|
@@ -54,22 +54,22 @@ const layouts: Record<ContainerType, FC<ContainerProps>> = {
|
|
|
54
54
|
),
|
|
55
55
|
|
|
56
56
|
fullscreen: ({ classNames, children }: ContainerProps) => (
|
|
57
|
-
<div role='none' className={mx('fixed inset-0 flex overflow-hidden bg-
|
|
57
|
+
<div role='none' className={mx('fixed inset-0 flex overflow-hidden bg-black', classNames)}>
|
|
58
58
|
{children}
|
|
59
59
|
</div>
|
|
60
60
|
),
|
|
61
61
|
|
|
62
62
|
centered: ({ classNames, children }: ContainerProps) => (
|
|
63
|
-
<div role='none' className={mx('fixed inset-0 grid overflow-hidden place-items-center bg-
|
|
64
|
-
<div role='none' className={mx('flex flex-col
|
|
63
|
+
<div role='none' className={mx('fixed inset-0 grid overflow-hidden place-items-center bg-black')}>
|
|
64
|
+
<div role='none' className={mx('flex flex-col bg-base-surface', classNames)}>
|
|
65
65
|
{children}
|
|
66
66
|
</div>
|
|
67
67
|
</div>
|
|
68
68
|
),
|
|
69
69
|
|
|
70
70
|
column: ({ classNames, children }: ContainerProps) => (
|
|
71
|
-
<div role='none' className='fixed inset-0 flex overflow-hidden justify-center bg-
|
|
72
|
-
<div role='none' className={mx('flex flex-col w-[40rem] bg-
|
|
71
|
+
<div role='none' className='fixed inset-0 flex overflow-hidden justify-center bg-black'>
|
|
72
|
+
<div role='none' className={mx('flex flex-col w-[40rem] bg-base-surface', classNames)}>
|
|
73
73
|
{children}
|
|
74
74
|
</div>
|
|
75
75
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Decorator } from '@storybook/react';
|
|
6
|
-
import React
|
|
6
|
+
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { defaultTx } from '@dxos/ui-theme';
|
|
9
9
|
import { type ThemeMode } from '@dxos/ui-types';
|
|
@@ -14,20 +14,23 @@ import { type ThemeContextValue, ThemeProvider, Tooltip } from '../../components
|
|
|
14
14
|
* Adds theme decorator.
|
|
15
15
|
*/
|
|
16
16
|
export const withTheme =
|
|
17
|
-
({ tx = defaultTx,
|
|
17
|
+
({ tx = defaultTx, noCache, platform }: Partial<ThemeContextValue> = {}): Decorator =>
|
|
18
18
|
(Story, context) => {
|
|
19
19
|
const {
|
|
20
20
|
globals: { theme },
|
|
21
21
|
parameters: { translations },
|
|
22
22
|
} = context;
|
|
23
23
|
|
|
24
|
-
// Prevent re-rendering of the story.
|
|
25
|
-
const MemoizedStory = memo(Story);
|
|
26
|
-
|
|
27
24
|
return (
|
|
28
|
-
<ThemeProvider
|
|
25
|
+
<ThemeProvider
|
|
26
|
+
tx={tx}
|
|
27
|
+
themeMode={theme as ThemeMode}
|
|
28
|
+
resourceExtensions={translations}
|
|
29
|
+
noCache={noCache}
|
|
30
|
+
platform={platform}
|
|
31
|
+
>
|
|
29
32
|
<Tooltip.Provider>
|
|
30
|
-
<
|
|
33
|
+
<Story />
|
|
31
34
|
</Tooltip.Provider>
|
|
32
35
|
</ThemeProvider>
|
|
33
36
|
);
|