@dxos/react-ui 0.8.4-main.937b3ca → 0.8.4-main.9735255
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/index.mjs +130 -34
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +130 -34
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Main/Main.d.ts +36 -11
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +2 -1
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -15
- package/src/components/Main/Main.stories.tsx +127 -20
- package/src/components/Main/Main.tsx +254 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.9735255",
|
|
4
4
|
"description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -78,16 +78,16 @@
|
|
|
78
78
|
"keyborg": "^2.5.0",
|
|
79
79
|
"react-i18next": "^11.18.6",
|
|
80
80
|
"react-remove-scroll": "^2.6.0",
|
|
81
|
-
"@dxos/debug": "0.8.4-main.
|
|
82
|
-
"@dxos/invariant": "0.8.4-main.
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/
|
|
86
|
-
"@dxos/
|
|
87
|
-
"@dxos/react-
|
|
88
|
-
"@dxos/
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/util": "0.8.4-main.
|
|
81
|
+
"@dxos/debug": "0.8.4-main.9735255",
|
|
82
|
+
"@dxos/invariant": "0.8.4-main.9735255",
|
|
83
|
+
"@dxos/async": "0.8.4-main.9735255",
|
|
84
|
+
"@dxos/log": "0.8.4-main.9735255",
|
|
85
|
+
"@dxos/lit-ui": "0.8.4-main.9735255",
|
|
86
|
+
"@dxos/react-hooks": "0.8.4-main.9735255",
|
|
87
|
+
"@dxos/react-list": "0.8.4-main.9735255",
|
|
88
|
+
"@dxos/react-input": "0.8.4-main.9735255",
|
|
89
|
+
"@dxos/ui-types": "0.8.4-main.9735255",
|
|
90
|
+
"@dxos/util": "0.8.4-main.9735255"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@dnd-kit/core": "^6.0.5",
|
|
@@ -100,14 +100,14 @@
|
|
|
100
100
|
"react-dom": "~19.2.3",
|
|
101
101
|
"tabster": "^8.5.5",
|
|
102
102
|
"vite": "7.1.9",
|
|
103
|
-
"@dxos/random": "0.8.4-main.
|
|
104
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
105
|
-
"@dxos/util": "0.8.4-main.
|
|
103
|
+
"@dxos/random": "0.8.4-main.9735255",
|
|
104
|
+
"@dxos/ui-theme": "0.8.4-main.9735255",
|
|
105
|
+
"@dxos/util": "0.8.4-main.9735255"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
108
|
"react": "~19.2.3",
|
|
109
109
|
"react-dom": "~19.2.3",
|
|
110
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
110
|
+
"@dxos/ui-theme": "0.8.4-main.9735255"
|
|
111
111
|
},
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
@@ -5,41 +5,86 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '../../testing';
|
|
9
|
-
import {
|
|
8
|
+
import { withLayout, withTheme } from '../../testing';
|
|
9
|
+
import { IconButton } from '../Button';
|
|
10
|
+
import { Input } from '../Input';
|
|
11
|
+
import { Toolbar } from '../Toolbar';
|
|
10
12
|
|
|
11
|
-
import { Main, useSidebars } from './Main';
|
|
13
|
+
import { Main, useDynamicDrawer, useSidebars } from './Main';
|
|
12
14
|
|
|
13
15
|
type StoryMainArgs = {};
|
|
14
16
|
|
|
15
|
-
const NavigationSidebarToggle = () => {
|
|
17
|
+
const NavigationSidebarToggle = ({ close }: { close?: boolean }) => {
|
|
16
18
|
const { toggleNavigationSidebar } = useSidebars('StoryMain__SidebarToggle');
|
|
17
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
<IconButton
|
|
21
|
+
icon={close ? 'ph--caret-left--regular' : 'ph--caret-right--regular'}
|
|
22
|
+
iconOnly
|
|
23
|
+
label='Toggle navigation sidebar'
|
|
24
|
+
onClick={toggleNavigationSidebar}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
18
27
|
};
|
|
19
28
|
|
|
20
|
-
const ComplementarySidebarToggle = () => {
|
|
29
|
+
const ComplementarySidebarToggle = ({ close }: { close?: boolean }) => {
|
|
21
30
|
const { toggleComplementarySidebar } = useSidebars('StoryMain__SidebarToggle');
|
|
22
|
-
return
|
|
31
|
+
return (
|
|
32
|
+
<IconButton
|
|
33
|
+
icon={close ? 'ph--caret-right--regular' : 'ph--caret-left--regular'}
|
|
34
|
+
iconOnly
|
|
35
|
+
label='Toggle complementary sidebar'
|
|
36
|
+
onClick={toggleComplementarySidebar}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const DrawerToggle = ({ close }: { close?: boolean }) => {
|
|
42
|
+
const { toggleDrawer } = useSidebars('StoryMain__DrawerToggle');
|
|
43
|
+
return (
|
|
44
|
+
<IconButton
|
|
45
|
+
icon={close ? 'ph--caret-down--regular' : 'ph--caret-up--regular'}
|
|
46
|
+
iconOnly
|
|
47
|
+
label='Toggle drawer'
|
|
48
|
+
onClick={toggleDrawer}
|
|
49
|
+
/>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const DrawerState = () => {
|
|
54
|
+
const { drawerState } = useSidebars('StoryMain__DrawerStateDisplay');
|
|
55
|
+
return (
|
|
56
|
+
<div className='flex items-center gap-2'>
|
|
57
|
+
<span>Drawer</span>
|
|
58
|
+
<span>({drawerState})</span>
|
|
59
|
+
<span>[{window.innerHeight}]</span>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
23
62
|
};
|
|
24
63
|
|
|
25
64
|
const DefaultStory = (_args: StoryMainArgs) => {
|
|
26
65
|
return (
|
|
27
|
-
<Main.Root>
|
|
66
|
+
<Main.Root defaultComplementarySidebarState='closed' defaultNavigationSidebarState='closed'>
|
|
28
67
|
<Main.Overlay />
|
|
29
|
-
<Main.NavigationSidebar label='Navigation'
|
|
30
|
-
<
|
|
31
|
-
|
|
68
|
+
<Main.NavigationSidebar label='Navigation'>
|
|
69
|
+
<Toolbar.Root>
|
|
70
|
+
<h1>Navigation</h1>
|
|
71
|
+
<Toolbar.Separator variant='gap' classNames='grow' />
|
|
72
|
+
<NavigationSidebarToggle close />
|
|
73
|
+
</Toolbar.Root>
|
|
32
74
|
</Main.NavigationSidebar>
|
|
33
|
-
<Main.Content>
|
|
34
|
-
<
|
|
35
|
-
<ComplementarySidebarToggle />
|
|
36
|
-
<p>Main content, hello!</p>
|
|
75
|
+
<Main.Content classNames='is-full'>
|
|
76
|
+
<Toolbar.Root>
|
|
37
77
|
<NavigationSidebarToggle />
|
|
38
|
-
|
|
78
|
+
<div className='flex items-center grow justify-center'>Main</div>
|
|
79
|
+
<ComplementarySidebarToggle />
|
|
80
|
+
</Toolbar.Root>
|
|
39
81
|
</Main.Content>
|
|
40
|
-
<Main.ComplementarySidebar label='Complementary
|
|
41
|
-
<
|
|
42
|
-
|
|
82
|
+
<Main.ComplementarySidebar label='Complementary'>
|
|
83
|
+
<Toolbar.Root>
|
|
84
|
+
<ComplementarySidebarToggle close />
|
|
85
|
+
<Toolbar.Separator variant='gap' classNames='grow' />
|
|
86
|
+
<h1>Complementary</h1>
|
|
87
|
+
</Toolbar.Root>
|
|
43
88
|
</Main.ComplementarySidebar>
|
|
44
89
|
</Main.Root>
|
|
45
90
|
);
|
|
@@ -49,7 +94,7 @@ const meta = {
|
|
|
49
94
|
title: 'ui/react-ui-core/Main',
|
|
50
95
|
component: Main.Root,
|
|
51
96
|
render: DefaultStory,
|
|
52
|
-
decorators: [withTheme],
|
|
97
|
+
decorators: [withTheme, withLayout({ layout: 'fullscreen' })],
|
|
53
98
|
parameters: {
|
|
54
99
|
layout: 'fullscreen',
|
|
55
100
|
chromatic: {
|
|
@@ -65,3 +110,65 @@ type Story = StoryObj<typeof meta>;
|
|
|
65
110
|
export const Default: Story = {
|
|
66
111
|
args: {},
|
|
67
112
|
};
|
|
113
|
+
|
|
114
|
+
const DrawerStory = (_args: StoryMainArgs) => {
|
|
115
|
+
return (
|
|
116
|
+
<Main.Root>
|
|
117
|
+
<Main.Overlay />
|
|
118
|
+
<DrawerStoryInner />
|
|
119
|
+
</Main.Root>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const DrawerStoryInner = () => {
|
|
124
|
+
useDynamicDrawer('DrawerStoryInner');
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<Main.Content classNames='flex flex-col is-full overflow-hidden'>
|
|
129
|
+
<Toolbar.Root classNames='pli-2'>
|
|
130
|
+
<h1>Main Content</h1>
|
|
131
|
+
<Toolbar.Separator variant='gap' classNames='grow' />
|
|
132
|
+
<DrawerToggle />
|
|
133
|
+
</Toolbar.Root>
|
|
134
|
+
<div className='flex flex-col bs-full overflow-y-auto p-2'>
|
|
135
|
+
<p className='text-sm text-description'>
|
|
136
|
+
The drawer is mutually exclusive with sidebars and is intended for mobile apps.
|
|
137
|
+
</p>
|
|
138
|
+
<div className='plb-2 space-y-2'>
|
|
139
|
+
{Array.from({ length: 50 }).map((_, i) => (
|
|
140
|
+
<p key={i}>Line {i + 1}</p>
|
|
141
|
+
))}
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</Main.Content>
|
|
145
|
+
<Main.Drawer label='Drawer' classNames='grid grid-rows-[min-content_1fr_min-content]'>
|
|
146
|
+
<Toolbar.Root classNames='pli-2'>
|
|
147
|
+
<DrawerState />
|
|
148
|
+
<Toolbar.Separator variant='gap' classNames='grow' />
|
|
149
|
+
<DrawerToggle close />
|
|
150
|
+
</Toolbar.Root>
|
|
151
|
+
<div className='p-2 overflow-y-auto'>
|
|
152
|
+
<p className='text-sm text-description'>
|
|
153
|
+
On mobile devices, the drawer automatically switches to fullscreenwhen the keyboard appears.
|
|
154
|
+
</p>
|
|
155
|
+
<div className='plb-2 space-y-2'>
|
|
156
|
+
{Array.from({ length: 50 }).map((_, i) => (
|
|
157
|
+
<p key={i}>Line {i + 1}</p>
|
|
158
|
+
))}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
<div className='p-2 border-bs border-separator'>
|
|
162
|
+
<Input.Root>
|
|
163
|
+
<Input.TextInput autoFocus placeholder='Search' />
|
|
164
|
+
</Input.Root>
|
|
165
|
+
</div>
|
|
166
|
+
</Main.Drawer>
|
|
167
|
+
</>
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export const WithDrawer: Story = {
|
|
172
|
+
render: DrawerStory,
|
|
173
|
+
args: {},
|
|
174
|
+
};
|