@dxos/react-ui 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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-OCVRIJCH.mjs → chunk-BDBC6H6V.mjs} +1 -1
- package/dist/lib/browser/{chunk-OCVRIJCH.mjs.map → chunk-BDBC6H6V.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +156 -156
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +2 -2
- 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-QUD5P3RU.mjs → chunk-3JSJK2ZY.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-QUD5P3RU.mjs.map → chunk-3JSJK2ZY.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +156 -156
- 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 +2 -2
- 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.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.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.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 +21 -12
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- 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 +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 +21 -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 +22 -20
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -1
- package/dist/types/src/components/Focus/Focus.d.ts +2 -2
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +1 -1
- 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.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 +2 -2
- package/dist/types/src/components/List/List.stories.d.ts +1 -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 +1 -1
- 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 +11 -3
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -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.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +10 -2
- 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 +2 -2
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +2 -2
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +11 -3
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- 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.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 +3 -3
- package/dist/types/src/components/Splitter/Splitter.stories.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.map +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 +5 -5
- 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 +2 -2
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -1
- 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.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 +11 -13
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.stories.d.ts +7 -7
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.d.ts +1 -1
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.d.ts +1 -1
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.d.ts +1 -1
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Panel/Panel.d.ts +4 -4
- 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.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 +26 -24
- package/src/components/Button/IconButton.tsx +3 -2
- package/src/components/Card/Card.tsx +20 -5
- package/src/components/Dialog/Dialog.stories.tsx +2 -2
- package/src/components/Dialog/Dialog.tsx +29 -29
- package/src/components/Image/Image.tsx +31 -8
- package/src/components/Input/Input.tsx +3 -3
- package/src/components/Message/Message.stories.tsx +1 -1
- package/src/components/Message/Message.tsx +24 -7
- package/src/components/ThemeProvider/index.ts +1 -1
- package/src/components/Toolbar/Toolbar.tsx +2 -1
- package/src/primitives/Column/AUDIT.md +105 -311
- package/src/primitives/Column/Column.stories.tsx +58 -60
- package/src/primitives/Column/Column.tsx +54 -58
- package/src/testing/decorators/withLayout.tsx +1 -1
|
@@ -7,10 +7,8 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Input, ScrollArea } from '../../components';
|
|
9
9
|
import { withLayout, withTheme } from '../../testing';
|
|
10
|
-
import { Flex } from '../Flex';
|
|
11
10
|
import { Column } from './Column';
|
|
12
11
|
|
|
13
|
-
// TODO(burdon): Content is clipped!
|
|
14
12
|
const List = () => {
|
|
15
13
|
return (
|
|
16
14
|
<ScrollArea.Root centered>
|
|
@@ -28,9 +26,9 @@ const List = () => {
|
|
|
28
26
|
const DefaultStory = () => {
|
|
29
27
|
return (
|
|
30
28
|
<Column.Root classNames='overflow-hidden' gutter='md'>
|
|
31
|
-
<Column.
|
|
29
|
+
<Column.Center>
|
|
32
30
|
<h1 className='p-1 bg-blue-500 text-black'>Header</h1>
|
|
33
|
-
</Column.
|
|
31
|
+
</Column.Center>
|
|
34
32
|
|
|
35
33
|
<Column.Row>
|
|
36
34
|
<div className='p-1 bg-blue-500'>A</div>
|
|
@@ -38,34 +36,36 @@ const DefaultStory = () => {
|
|
|
38
36
|
<div className='p-1 bg-blue-500'>C</div>
|
|
39
37
|
</Column.Row>
|
|
40
38
|
|
|
41
|
-
<Column.
|
|
42
|
-
<div
|
|
39
|
+
<Column.Center asChild>
|
|
40
|
+
<div>
|
|
43
41
|
<Input.Root>
|
|
44
42
|
<Input.TextInput placeholder='Search' />
|
|
45
43
|
</Input.Root>
|
|
46
44
|
</div>
|
|
47
|
-
</Column.
|
|
45
|
+
</Column.Center>
|
|
48
46
|
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<Input.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
<ScrollArea.Root orientation='vertical' padding>
|
|
48
|
+
<ScrollArea.Viewport>
|
|
49
|
+
<div className='flex flex-col gap-2'>
|
|
50
|
+
{Array.from({ length: 100 }).map((_, i) => (
|
|
51
|
+
<Input.Root key={i}>
|
|
52
|
+
<Input.TextInput value={`Item ${i}`} readOnly />
|
|
53
|
+
</Input.Root>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
</ScrollArea.Viewport>
|
|
57
|
+
</ScrollArea.Root>
|
|
58
58
|
|
|
59
|
-
<Column.
|
|
60
|
-
<
|
|
59
|
+
<Column.Center asChild>
|
|
60
|
+
<div className='flex flex-col'>
|
|
61
61
|
<h1 className='p-1 bg-red-500 text-black'>Section with overflow</h1>
|
|
62
62
|
<pre className='p-1 text-xs text-subdued overflow-auto'>{new Error().stack}</pre>
|
|
63
|
-
</
|
|
64
|
-
</Column.
|
|
63
|
+
</div>
|
|
64
|
+
</Column.Center>
|
|
65
65
|
|
|
66
|
-
<Column.
|
|
66
|
+
<Column.Center>
|
|
67
67
|
<div className='p-1 bg-green-500 text-black'>Footer</div>
|
|
68
|
-
</Column.
|
|
68
|
+
</Column.Center>
|
|
69
69
|
</Column.Root>
|
|
70
70
|
);
|
|
71
71
|
};
|
|
@@ -99,68 +99,66 @@ export const WithScrollArea = {
|
|
|
99
99
|
decorators: [withLayout({ layout: 'column' })],
|
|
100
100
|
render: () => (
|
|
101
101
|
<Column.Root classNames='overflow-hidden' gutter='md'>
|
|
102
|
-
<Column.
|
|
103
|
-
<h2
|
|
104
|
-
</Column.
|
|
105
|
-
<ScrollArea.Root padding centered orientation='vertical'
|
|
102
|
+
<Column.Center>
|
|
103
|
+
<h2>Header</h2>
|
|
104
|
+
</Column.Center>
|
|
105
|
+
<ScrollArea.Root padding centered orientation='vertical'>
|
|
106
106
|
<ScrollArea.Viewport>
|
|
107
107
|
<InputList items={30} />
|
|
108
108
|
</ScrollArea.Viewport>
|
|
109
109
|
</ScrollArea.Root>
|
|
110
|
-
<Column.
|
|
111
|
-
<h2
|
|
112
|
-
</Column.
|
|
110
|
+
<Column.Center>
|
|
111
|
+
<h2>Footer</h2>
|
|
112
|
+
</Column.Center>
|
|
113
113
|
</Column.Root>
|
|
114
114
|
),
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* Column.
|
|
119
|
-
*
|
|
118
|
+
* Column.Center places a single element in the center column of the parent grid.
|
|
119
|
+
* Preferred for centered content — safe to nest
|
|
120
|
+
* compound components (Form.Root, Editor.Root, etc.) that render `display: contents`.
|
|
120
121
|
*/
|
|
121
|
-
export const
|
|
122
|
-
decorators: [withLayout({
|
|
122
|
+
export const WithCenter: Story = {
|
|
123
|
+
decorators: [withLayout({ classNames: 'w-[25rem]' })],
|
|
123
124
|
render: () => (
|
|
124
|
-
<Column.Root
|
|
125
|
-
<Column.
|
|
126
|
-
<h2
|
|
127
|
-
</Column.
|
|
128
|
-
<Column.
|
|
129
|
-
<p
|
|
125
|
+
<Column.Root gutter='md'>
|
|
126
|
+
<Column.Center>
|
|
127
|
+
<h2>Header (Column.Center)</h2>
|
|
128
|
+
</Column.Center>
|
|
129
|
+
<Column.Center classNames='flex flex-col'>
|
|
130
|
+
<p>This text is inside Column.Center. It sits in the central column between the gutters.</p>
|
|
130
131
|
<Input.Root>
|
|
131
132
|
<Input.Label>Name</Input.Label>
|
|
132
133
|
<Input.TextInput placeholder='Enter name' />
|
|
133
134
|
</Input.Root>
|
|
134
|
-
</Column.
|
|
135
|
-
<Column.
|
|
136
|
-
<h2
|
|
137
|
-
</Column.
|
|
135
|
+
</Column.Center>
|
|
136
|
+
<Column.Center>
|
|
137
|
+
<h2>Footer (Column.Center)</h2>
|
|
138
|
+
</Column.Center>
|
|
138
139
|
</Column.Root>
|
|
139
140
|
),
|
|
140
141
|
};
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
|
-
* Column.
|
|
144
|
-
*
|
|
145
|
-
* and applies its own asymmetric padding (accounting for scrollbar width).
|
|
144
|
+
* ScrollArea auto-bleeds inside Column.Root (via [.dx-column_&]:col-span-full).
|
|
145
|
+
* No Column.Bleed wrapper needed.
|
|
146
146
|
*/
|
|
147
|
-
export const
|
|
147
|
+
export const WithScrollAreaAutoBleed: Story = {
|
|
148
148
|
decorators: [withLayout({ layout: 'column', classNames: 'w-[25rem]' })],
|
|
149
149
|
render: () => (
|
|
150
150
|
<Column.Root classNames='overflow-hidden' gutter='md'>
|
|
151
|
-
<Column.
|
|
152
|
-
<h2
|
|
153
|
-
</Column.
|
|
154
|
-
<
|
|
155
|
-
<ScrollArea.
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<h2 className='py-3'>Footer (Column.Row)</h2>
|
|
163
|
-
</Column.Row>
|
|
151
|
+
<Column.Center>
|
|
152
|
+
<h2>Header (Column.Center)</h2>
|
|
153
|
+
</Column.Center>
|
|
154
|
+
<ScrollArea.Root orientation='vertical' padding thin>
|
|
155
|
+
<ScrollArea.Viewport>
|
|
156
|
+
<InputList items={30} />
|
|
157
|
+
</ScrollArea.Viewport>
|
|
158
|
+
</ScrollArea.Root>
|
|
159
|
+
<Column.Center>
|
|
160
|
+
<h2>Footer (Column.Center)</h2>
|
|
161
|
+
</Column.Center>
|
|
164
162
|
</Column.Root>
|
|
165
163
|
),
|
|
166
164
|
};
|
|
@@ -6,10 +6,9 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import React, { type CSSProperties } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { composableProps, slottable } from '@dxos/ui-theme';
|
|
10
10
|
import { type SlottableProps } from '@dxos/ui-types';
|
|
11
11
|
|
|
12
|
-
import { ScrollArea, type ScrollAreaRootProps } from '../../components';
|
|
13
12
|
import { useThemeContext } from '../../hooks';
|
|
14
13
|
|
|
15
14
|
//
|
|
@@ -31,13 +30,18 @@ type ColumnRootProps = { gutter?: GutterSize };
|
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
32
|
* Creates a 3-column CSS grid with left/right gutter columns and a center content column.
|
|
34
|
-
* Sets
|
|
33
|
+
* Sets `--gutter` and `--dx-col` CSS variables for nested components.
|
|
35
34
|
*
|
|
36
|
-
*
|
|
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.
|
|
37
42
|
* - **Column.Row** — 3-col subgrid row (icons in gutters, content in center).
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* - **Column.Viewport** — spans full width; delegates gutters to ScrollArea.
|
|
43
|
+
*
|
|
44
|
+
* Use `withColumn.center()` / `withColumn.bleed()` helpers to apply placement on slotted elements.
|
|
41
45
|
*
|
|
42
46
|
* Gutter sizes: `'sm'` for compact layouts (Dialog); `'md'` (default); `'lg'` for wider spacing.
|
|
43
47
|
*/
|
|
@@ -54,6 +58,7 @@ const ColumnRoot = slottable<HTMLDivElement, ColumnRootProps>(
|
|
|
54
58
|
style={
|
|
55
59
|
{
|
|
56
60
|
'--gutter': gutterSize,
|
|
61
|
+
'--dx-col': '2 / span 1',
|
|
57
62
|
gridTemplateColumns: [gutterSize, 'minmax(0,1fr)', gutterSize].join(' '),
|
|
58
63
|
} as CSSProperties
|
|
59
64
|
}
|
|
@@ -74,86 +79,77 @@ ColumnRoot.displayName = COLUMN_ROOT_NAME;
|
|
|
74
79
|
|
|
75
80
|
const COLUMN_ROW_NAME = 'Column.Row';
|
|
76
81
|
|
|
77
|
-
type ColumnRowProps =
|
|
82
|
+
type ColumnRowProps = {};
|
|
78
83
|
|
|
79
84
|
/**
|
|
80
85
|
* Spans all 3 columns of the parent Column.Root and uses CSS subgrid to inherit their sizing.
|
|
81
86
|
* Children map to: [col-1: icon/slot] [col-2: content] [col-3: icon/action].
|
|
82
87
|
* Must be a direct child of Column.Root.
|
|
83
88
|
*/
|
|
84
|
-
const ColumnRow = slottable<HTMLDivElement, ColumnRowProps>(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
ref={forwardedRef}
|
|
95
|
-
>
|
|
96
|
-
{children}
|
|
97
|
-
</Comp>
|
|
98
|
-
);
|
|
99
|
-
},
|
|
100
|
-
);
|
|
89
|
+
const ColumnRow = slottable<HTMLDivElement, ColumnRowProps>(({ children, asChild, role, ...props }, forwardedRef) => {
|
|
90
|
+
const { className, ...rest } = composableProps(props);
|
|
91
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
92
|
+
const { tx } = useThemeContext();
|
|
93
|
+
return (
|
|
94
|
+
<Comp {...rest} role={role ?? 'none'} className={tx('column.row', {}, className)} ref={forwardedRef}>
|
|
95
|
+
{children}
|
|
96
|
+
</Comp>
|
|
97
|
+
);
|
|
98
|
+
});
|
|
101
99
|
|
|
102
100
|
ColumnRow.displayName = COLUMN_ROW_NAME;
|
|
103
101
|
|
|
104
102
|
//
|
|
105
|
-
//
|
|
103
|
+
// Bleed
|
|
106
104
|
//
|
|
107
105
|
|
|
108
|
-
const
|
|
106
|
+
const COLUMN_BLEED_NAME = 'Column.Bleed';
|
|
109
107
|
|
|
110
|
-
type
|
|
108
|
+
type ColumnBleedProps = SlottableProps;
|
|
111
109
|
|
|
112
110
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* ScrollArea
|
|
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.
|
|
116
114
|
*/
|
|
117
|
-
const
|
|
115
|
+
const ColumnBleed = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
118
116
|
const { tx } = useThemeContext();
|
|
119
117
|
const { className, ...rest } = composableProps(props);
|
|
120
118
|
const Comp = asChild ? Slot : Primitive.div;
|
|
121
119
|
return (
|
|
122
|
-
<Comp {...rest} className={tx('column.
|
|
120
|
+
<Comp {...rest} className={tx('column.bleed', {}, className)} ref={forwardedRef}>
|
|
123
121
|
{children}
|
|
124
122
|
</Comp>
|
|
125
123
|
);
|
|
126
124
|
});
|
|
127
125
|
|
|
128
|
-
|
|
126
|
+
ColumnBleed.displayName = COLUMN_BLEED_NAME;
|
|
129
127
|
|
|
130
128
|
//
|
|
131
|
-
//
|
|
129
|
+
// Center
|
|
132
130
|
//
|
|
133
131
|
|
|
134
|
-
const
|
|
132
|
+
const COLUMN_CENTER_NAME = 'Column.Center';
|
|
135
133
|
|
|
136
|
-
type
|
|
134
|
+
type ColumnCenterProps = SlottableProps;
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
);
|
|
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
|
+
});
|
|
155
151
|
|
|
156
|
-
|
|
152
|
+
ColumnCenter.displayName = COLUMN_CENTER_NAME;
|
|
157
153
|
|
|
158
154
|
//
|
|
159
155
|
// Column
|
|
@@ -161,9 +157,9 @@ ColumnViewport.displayName = COLUMN_VIEWPORT_NAME;
|
|
|
161
157
|
|
|
162
158
|
export const Column = {
|
|
163
159
|
Root: ColumnRoot,
|
|
164
|
-
Content: ColumnContent,
|
|
165
|
-
Viewport: ColumnViewport,
|
|
166
160
|
Row: ColumnRow,
|
|
161
|
+
Bleed: ColumnBleed,
|
|
162
|
+
Center: ColumnCenter,
|
|
167
163
|
};
|
|
168
164
|
|
|
169
|
-
export type { ColumnRootProps,
|
|
165
|
+
export type { ColumnRootProps, ColumnRowProps, ColumnBleedProps, ColumnCenterProps };
|
|
@@ -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
|
);
|