@dxos/react-ui 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446
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 +1081 -1616
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1404 -1941
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1081 -1616
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +2 -2
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +3 -3
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +1 -0
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +44 -10
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts +5 -4
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +6 -7
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +4 -1
- package/dist/types/src/components/Buttons/ToggleGroup.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 +1 -2
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +2 -2
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +2 -2
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +1 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +159 -33
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts +1 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
- 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/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 +6 -15
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +1 -5
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +2 -2
- package/dist/types/src/components/Toast/Toast.stories.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 +20 -94
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +17 -41
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.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/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 +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withVariants.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -14
- package/src/components/Avatars/Avatar.stories.tsx +27 -27
- package/src/components/Avatars/Avatar.tsx +13 -17
- package/src/components/Avatars/AvatarGroup.stories.tsx +5 -4
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -2
- package/src/components/Buttons/Button.stories.tsx +14 -19
- package/src/components/Buttons/IconButton.stories.tsx +10 -9
- package/src/components/Buttons/IconButton.tsx +33 -8
- package/src/components/Buttons/Toggle.stories.tsx +2 -2
- package/src/components/Buttons/ToggleGroup.stories.tsx +7 -3
- package/src/components/Clipboard/CopyButton.tsx +24 -22
- package/src/components/Dialogs/AlertDialog.stories.tsx +11 -4
- package/src/components/Dialogs/Dialog.stories.tsx +3 -3
- package/src/components/Dialogs/Dialog.tsx +4 -8
- package/src/components/Input/Input.stories.tsx +56 -67
- package/src/components/Input/Input.tsx +0 -1
- package/src/components/Lists/Tree.stories.tsx +2 -2
- package/src/components/Lists/Treegrid.stories.tsx +12 -12
- package/src/components/Main/Main.stories.tsx +2 -2
- package/src/components/Menus/ContextMenu.stories.tsx +2 -2
- package/src/components/Menus/DropdownMenu.stories.tsx +2 -2
- package/src/components/Message/Message.stories.tsx +3 -3
- package/src/components/Popover/Popover.stories.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -8
- package/src/components/ScrollArea/ScrollArea.stories.tsx +2 -2
- package/src/components/ScrollArea/ScrollArea.tsx +0 -3
- package/src/components/Toast/Toast.stories.tsx +10 -15
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +18 -43
- package/src/components/Tooltip/Tooltip.tsx +58 -748
- package/src/components/index.ts +1 -1
- package/src/playground/Controls.stories.tsx +2 -2
- package/src/playground/Typography.stories.tsx +2 -2
- package/dist/types/src/playground/Custom.stories.d.ts +0 -8
- package/dist/types/src/playground/Custom.stories.d.ts.map +0 -1
- package/src/playground/Custom.stories.tsx +0 -137
|
@@ -4,44 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react';
|
|
8
7
|
import React from 'react';
|
|
9
8
|
|
|
10
9
|
import { baseSurface, modalSurface, groupSurface, mx, surfaceShadow } from '@dxos/react-ui-theme';
|
|
11
10
|
import { type MessageValence } from '@dxos/react-ui-types';
|
|
12
11
|
|
|
13
|
-
import {
|
|
14
|
-
type CheckboxProps,
|
|
15
|
-
Input,
|
|
16
|
-
type PinInputProps,
|
|
17
|
-
type SwitchProps,
|
|
18
|
-
type TextInputProps,
|
|
19
|
-
type TextAreaProps,
|
|
20
|
-
} from './Input';
|
|
12
|
+
import { Input } from './Input';
|
|
21
13
|
import { withTheme } from '../../testing';
|
|
22
14
|
|
|
23
|
-
type
|
|
24
|
-
text: TextInputProps;
|
|
25
|
-
pin: PinInputProps;
|
|
26
|
-
textarea: TextAreaProps;
|
|
27
|
-
checkbox: CheckboxProps;
|
|
28
|
-
switch: SwitchProps;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type Variant = { [K in keyof VariantMap]: { type: K } & VariantMap[K] }[keyof VariantMap];
|
|
32
|
-
|
|
33
|
-
type BaseProps = Partial<{
|
|
34
|
-
kind: keyof VariantMap;
|
|
15
|
+
type StoryInputProps = Partial<{
|
|
35
16
|
label: string;
|
|
36
|
-
|
|
17
|
+
placeholder: string;
|
|
18
|
+
disabled: boolean;
|
|
37
19
|
description: string;
|
|
20
|
+
labelVisuallyHidden: boolean;
|
|
38
21
|
descriptionVisuallyHidden: boolean;
|
|
39
|
-
|
|
22
|
+
type: 'default' | 'pin' | 'textarea' | 'checkbox' | 'switch';
|
|
40
23
|
validationMessage: string;
|
|
24
|
+
validationValence: MessageValence;
|
|
41
25
|
}>;
|
|
42
26
|
|
|
43
|
-
const
|
|
44
|
-
|
|
27
|
+
const StoryInputContent = ({
|
|
28
|
+
type = 'default',
|
|
45
29
|
label,
|
|
46
30
|
description,
|
|
47
31
|
labelVisuallyHidden,
|
|
@@ -49,17 +33,15 @@ const Wrapper = ({
|
|
|
49
33
|
validationValence,
|
|
50
34
|
validationMessage,
|
|
51
35
|
...props
|
|
52
|
-
}:
|
|
36
|
+
}: StoryInputProps) => {
|
|
53
37
|
return (
|
|
54
38
|
<Input.Root {...{ validationValence }}>
|
|
55
39
|
<Input.Label srOnly={labelVisuallyHidden}>{label}</Input.Label>
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
{
|
|
59
|
-
{
|
|
60
|
-
{
|
|
61
|
-
{kind === 'switch' && <Input.Switch {...props} />}
|
|
62
|
-
|
|
40
|
+
{type === 'pin' && <Input.PinInput {...props} />}
|
|
41
|
+
{type === 'textarea' && <Input.TextArea {...props} />}
|
|
42
|
+
{type === 'checkbox' && <Input.Checkbox {...props} />}
|
|
43
|
+
{type === 'switch' && <Input.Switch {...props} />}
|
|
44
|
+
{type === 'default' && <Input.TextInput {...props} />}
|
|
63
45
|
<Input.DescriptionAndValidation srOnly={descriptionVisuallyHidden}>
|
|
64
46
|
{validationMessage && (
|
|
65
47
|
<>
|
|
@@ -72,37 +54,47 @@ const Wrapper = ({
|
|
|
72
54
|
);
|
|
73
55
|
};
|
|
74
56
|
|
|
75
|
-
const
|
|
57
|
+
const StoryInput = (props: StoryInputProps) => {
|
|
58
|
+
// TODO(thure): Implement
|
|
76
59
|
return (
|
|
77
60
|
<div className='space-b-4'>
|
|
78
61
|
<div className={mx(baseSurface, 'p-4')}>
|
|
79
|
-
<
|
|
62
|
+
<StoryInputContent {...props} />
|
|
80
63
|
</div>
|
|
81
64
|
<div className={mx(groupSurface, 'p-4 rounded-lg', surfaceShadow({ elevation: 'positioned' }))}>
|
|
82
|
-
<
|
|
65
|
+
<StoryInputContent {...props} />
|
|
83
66
|
</div>
|
|
84
67
|
<div className={mx(modalSurface, 'p-4 rounded-lg', surfaceShadow({ elevation: 'dialog' }))}>
|
|
85
|
-
<
|
|
68
|
+
<StoryInputContent {...props} />
|
|
86
69
|
</div>
|
|
87
70
|
</div>
|
|
88
71
|
);
|
|
89
72
|
};
|
|
90
73
|
|
|
91
|
-
|
|
74
|
+
export default {
|
|
92
75
|
title: 'ui/react-ui-core/Input',
|
|
93
|
-
component: Input
|
|
94
|
-
render:
|
|
76
|
+
component: Input,
|
|
77
|
+
render: StoryInput,
|
|
78
|
+
// TODO(thure): Refactor.
|
|
79
|
+
argTypes: {
|
|
80
|
+
label: { control: 'text' },
|
|
81
|
+
description: { control: 'text' },
|
|
82
|
+
validationMessage: { control: 'text' },
|
|
83
|
+
validationValence: {
|
|
84
|
+
control: 'select',
|
|
85
|
+
options: ['success', 'info', 'warning', 'error'],
|
|
86
|
+
},
|
|
87
|
+
type: {
|
|
88
|
+
control: 'select',
|
|
89
|
+
options: ['default', 'textarea', 'pin'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
95
92
|
decorators: [withTheme],
|
|
96
93
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
97
94
|
};
|
|
98
95
|
|
|
99
|
-
export
|
|
100
|
-
|
|
101
|
-
type Story = StoryObj<BaseProps & Variant>;
|
|
102
|
-
|
|
103
|
-
export const Default: Story = {
|
|
96
|
+
export const Default = {
|
|
104
97
|
args: {
|
|
105
|
-
kind: 'text',
|
|
106
98
|
label: 'Hello',
|
|
107
99
|
placeholder: 'This is an input',
|
|
108
100
|
disabled: false,
|
|
@@ -111,12 +103,12 @@ export const Default: Story = {
|
|
|
111
103
|
descriptionVisuallyHidden: false,
|
|
112
104
|
validationMessage: '',
|
|
113
105
|
validationValence: undefined,
|
|
106
|
+
length: 6,
|
|
114
107
|
},
|
|
115
108
|
};
|
|
116
109
|
|
|
117
|
-
export const DensityFine
|
|
110
|
+
export const DensityFine = {
|
|
118
111
|
args: {
|
|
119
|
-
kind: 'text',
|
|
120
112
|
label: 'This is an Input with a density value of ‘fine’',
|
|
121
113
|
placeholder: 'This is a density:fine input',
|
|
122
114
|
disabled: false,
|
|
@@ -125,13 +117,13 @@ export const DensityFine: Story = {
|
|
|
125
117
|
descriptionVisuallyHidden: false,
|
|
126
118
|
validationMessage: '',
|
|
127
119
|
validationValence: undefined,
|
|
120
|
+
length: 6,
|
|
128
121
|
density: 'fine',
|
|
129
122
|
},
|
|
130
123
|
};
|
|
131
124
|
|
|
132
|
-
export const Subdued
|
|
125
|
+
export const Subdued = {
|
|
133
126
|
args: {
|
|
134
|
-
kind: 'text',
|
|
135
127
|
label: 'Hello',
|
|
136
128
|
placeholder: 'This is a subdued input',
|
|
137
129
|
disabled: false,
|
|
@@ -140,40 +132,37 @@ export const Subdued: Story = {
|
|
|
140
132
|
descriptionVisuallyHidden: false,
|
|
141
133
|
validationMessage: '',
|
|
142
134
|
validationValence: undefined,
|
|
135
|
+
length: 6,
|
|
143
136
|
variant: 'subdued',
|
|
144
137
|
},
|
|
145
138
|
};
|
|
146
139
|
|
|
147
|
-
export const Disabled
|
|
140
|
+
export const Disabled = {
|
|
148
141
|
args: {
|
|
149
|
-
kind: 'text',
|
|
150
142
|
label: 'Disabled',
|
|
151
143
|
placeholder: 'This is a disabled input',
|
|
152
144
|
disabled: true,
|
|
153
145
|
},
|
|
154
146
|
};
|
|
155
147
|
|
|
156
|
-
export const LabelVisuallyHidden
|
|
148
|
+
export const LabelVisuallyHidden = {
|
|
157
149
|
args: {
|
|
158
|
-
kind: 'text',
|
|
159
150
|
label: 'The label is for screen readers',
|
|
160
151
|
labelVisuallyHidden: true,
|
|
161
152
|
placeholder: 'The label for this input exists but is only read by screen readers',
|
|
162
153
|
},
|
|
163
154
|
};
|
|
164
155
|
|
|
165
|
-
export const InputWithDescription
|
|
156
|
+
export const InputWithDescription = {
|
|
166
157
|
args: {
|
|
167
|
-
kind: 'text',
|
|
168
158
|
label: 'Described input',
|
|
169
159
|
placeholder: 'This input has an accessible description',
|
|
170
160
|
description: 'This helper text is accessibly associated with the input.',
|
|
171
161
|
},
|
|
172
162
|
};
|
|
173
163
|
|
|
174
|
-
export const InputWithErrorAndDescription
|
|
164
|
+
export const InputWithErrorAndDescription = {
|
|
175
165
|
args: {
|
|
176
|
-
kind: 'text',
|
|
177
166
|
label: 'Described invalid input',
|
|
178
167
|
placeholder: 'This input has both an accessible description and a validation error',
|
|
179
168
|
description: 'This description is identified separately in the accessibility tree.',
|
|
@@ -182,9 +171,8 @@ export const InputWithErrorAndDescription: Story = {
|
|
|
182
171
|
},
|
|
183
172
|
};
|
|
184
173
|
|
|
185
|
-
export const InputWithValidationAndDescription
|
|
174
|
+
export const InputWithValidationAndDescription = {
|
|
186
175
|
args: {
|
|
187
|
-
kind: 'text',
|
|
188
176
|
label: 'Described input with validation message',
|
|
189
177
|
placeholder: 'This input is styled to express a validation valence',
|
|
190
178
|
description: 'This description is extra.',
|
|
@@ -193,38 +181,39 @@ export const InputWithValidationAndDescription: Story = {
|
|
|
193
181
|
},
|
|
194
182
|
};
|
|
195
183
|
|
|
196
|
-
export const TextArea
|
|
184
|
+
export const TextArea = {
|
|
197
185
|
args: {
|
|
198
|
-
kind: 'textarea',
|
|
199
186
|
label: 'This input is a text area input',
|
|
187
|
+
type: 'textarea',
|
|
200
188
|
description: 'Type a long paragraph',
|
|
201
189
|
placeholder: 'Lorem ipsum dolor sit amet',
|
|
202
190
|
},
|
|
203
191
|
};
|
|
204
192
|
|
|
205
|
-
export const PinInput
|
|
193
|
+
export const PinInput = {
|
|
206
194
|
args: {
|
|
207
|
-
kind: 'pin',
|
|
208
195
|
label: 'This input is a PIN-style input',
|
|
196
|
+
type: 'pin',
|
|
209
197
|
length: 6,
|
|
210
198
|
description: 'Type in secret you received',
|
|
211
199
|
placeholder: '••••••',
|
|
212
200
|
},
|
|
213
201
|
};
|
|
214
202
|
|
|
215
|
-
export const Checkbox
|
|
203
|
+
export const Checkbox = {
|
|
216
204
|
args: {
|
|
217
|
-
kind: 'checkbox',
|
|
218
205
|
label: 'This is a checkbox',
|
|
206
|
+
type: 'checkbox',
|
|
219
207
|
description: 'It’s checked, indeterminate, or unchecked',
|
|
220
208
|
size: 5,
|
|
209
|
+
weight: 'bold',
|
|
221
210
|
},
|
|
222
211
|
};
|
|
223
212
|
|
|
224
213
|
export const Switch = {
|
|
225
214
|
args: {
|
|
226
|
-
kind: 'switch',
|
|
227
215
|
label: 'This is a switch',
|
|
216
|
+
type: 'switch',
|
|
228
217
|
description: 'It’s either off... or on.',
|
|
229
218
|
},
|
|
230
219
|
};
|
|
@@ -51,14 +51,14 @@ const StorybookTreeItem = ({ data, prefix }: StorybookTreeItemProps) => {
|
|
|
51
51
|
);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
const
|
|
54
|
+
const StorybookTree = ({ data }: StorybookTreeProps) => {
|
|
55
55
|
return <StorybookTreeItem data={data} />;
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export default {
|
|
59
59
|
title: 'ui/react-ui-core/Tree',
|
|
60
60
|
component: Tree,
|
|
61
|
-
render:
|
|
61
|
+
render: StorybookTree,
|
|
62
62
|
decorators: [withTheme],
|
|
63
63
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
64
64
|
};
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { faker } from '@dxos/random';
|
|
8
8
|
|
|
9
|
-
import { Treegrid } from './Treegrid';
|
|
9
|
+
import { Treegrid as Tg } from './Treegrid';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Icon } from '../Icon';
|
|
12
12
|
|
|
@@ -122,30 +122,30 @@ const flattenedContent = Array.from(visitor(content, () => true));
|
|
|
122
122
|
|
|
123
123
|
const DefaultStory = () => {
|
|
124
124
|
return (
|
|
125
|
-
<
|
|
125
|
+
<Tg.Root gridTemplateColumns='1fr'>
|
|
126
126
|
{flattenedContent.map(({ node, parentOf, path }) => {
|
|
127
127
|
return (
|
|
128
|
-
<
|
|
128
|
+
<Tg.Row
|
|
129
129
|
key={node.id}
|
|
130
|
-
id={path.join(
|
|
131
|
-
{...(parentOf && { parentOf: parentOf.join(
|
|
130
|
+
id={path.join(Tg.PATH_SEPARATOR)}
|
|
131
|
+
{...(parentOf && { parentOf: parentOf.join(Tg.PARENT_OF_SEPARATOR) })}
|
|
132
132
|
>
|
|
133
|
-
<
|
|
133
|
+
<Tg.Cell indent classNames='flex items-center'>
|
|
134
134
|
{node.icon && <Icon icon={node.icon} classNames='is-[1em] bs-[1em] mlb-1' />}
|
|
135
135
|
{node.title}
|
|
136
|
-
</
|
|
137
|
-
</
|
|
136
|
+
</Tg.Cell>
|
|
137
|
+
</Tg.Row>
|
|
138
138
|
);
|
|
139
139
|
})}
|
|
140
|
-
</
|
|
140
|
+
</Tg.Root>
|
|
141
141
|
);
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
+
export const Default = {};
|
|
145
|
+
|
|
144
146
|
export default {
|
|
145
147
|
title: 'ui/react-ui-core/Treegrid',
|
|
146
|
-
component:
|
|
148
|
+
component: Tg.Root,
|
|
147
149
|
render: DefaultStory,
|
|
148
150
|
decorators: [withTheme],
|
|
149
151
|
};
|
|
150
|
-
|
|
151
|
-
export const Default = {};
|
|
@@ -22,7 +22,7 @@ const ComplementarySidebarToggle = () => {
|
|
|
22
22
|
return <Button onClick={toggleComplementarySidebar}>Toggle complementary sidebar</Button>;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const StoryMain = (_args: StoryMainArgs) => {
|
|
26
26
|
return (
|
|
27
27
|
<Main.Root>
|
|
28
28
|
<Main.Overlay />
|
|
@@ -48,7 +48,7 @@ const DefaultStory = (_args: StoryMainArgs) => {
|
|
|
48
48
|
export default {
|
|
49
49
|
title: 'ui/react-ui-core/Main',
|
|
50
50
|
component: Main.Root,
|
|
51
|
-
render:
|
|
51
|
+
render: StoryMain,
|
|
52
52
|
decorators: [withTheme],
|
|
53
53
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
54
54
|
};
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import { ContextMenu } from './ContextMenu';
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const StorybookContextMenu = () => {
|
|
13
13
|
// NOTE(thure): Since long-tap will select text in some OSs, apply `select-none` to `ContextMenu.Trigger` where possible.
|
|
14
14
|
return (
|
|
15
15
|
<ContextMenu.Root>
|
|
@@ -94,7 +94,7 @@ const DefaultStory = () => {
|
|
|
94
94
|
export default {
|
|
95
95
|
title: 'ui/react-ui-core/ContextMenu',
|
|
96
96
|
component: ContextMenu,
|
|
97
|
-
render:
|
|
97
|
+
render: StorybookContextMenu,
|
|
98
98
|
decorators: [withTheme],
|
|
99
99
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
100
100
|
};
|
|
@@ -10,7 +10,7 @@ import { DropdownMenu } from './DropdownMenu';
|
|
|
10
10
|
import { withTheme } from '../../testing';
|
|
11
11
|
import { Button } from '../Buttons';
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const StorybookDropdownMenu = () => {
|
|
14
14
|
return (
|
|
15
15
|
<DropdownMenu.Root defaultOpen>
|
|
16
16
|
<DropdownMenu.Trigger asChild>
|
|
@@ -94,7 +94,7 @@ const DefaultStory = () => {
|
|
|
94
94
|
export default {
|
|
95
95
|
title: 'ui/react-ui-core/DropdownMenu',
|
|
96
96
|
component: DropdownMenu,
|
|
97
|
-
render:
|
|
97
|
+
render: StorybookDropdownMenu,
|
|
98
98
|
decorators: [withTheme],
|
|
99
99
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
100
100
|
};
|
|
@@ -12,13 +12,13 @@ import { type MessageValence } from '@dxos/react-ui-types';
|
|
|
12
12
|
import { Message } from './Message';
|
|
13
13
|
import { withTheme } from '../../testing';
|
|
14
14
|
|
|
15
|
-
type
|
|
15
|
+
type StoryMessageProps = {
|
|
16
16
|
valence: MessageValence;
|
|
17
17
|
title: string;
|
|
18
18
|
body: string;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const StoryMessage = ({ valence, title, body }: StoryMessageProps) => (
|
|
22
22
|
<Message.Root valence={valence}>
|
|
23
23
|
<Message.Title>
|
|
24
24
|
<Info className='inline w-5 h-5 mb-1' weight='duotone' /> {title}
|
|
@@ -30,7 +30,7 @@ const DefaultStory = ({ valence, title, body }: StoryProps) => (
|
|
|
30
30
|
export default {
|
|
31
31
|
title: 'ui/react-ui-core/Message',
|
|
32
32
|
component: Message,
|
|
33
|
-
render:
|
|
33
|
+
render: StoryMessage,
|
|
34
34
|
decorators: [withTheme],
|
|
35
35
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
36
36
|
};
|
|
@@ -14,7 +14,7 @@ import { Button } from '../Buttons';
|
|
|
14
14
|
|
|
15
15
|
faker.seed(1234);
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const StorybookPopover = ({ openTrigger, children }: PropsWithChildren<{ openTrigger: ReactNode }>) => {
|
|
18
18
|
return (
|
|
19
19
|
<Popover.Root defaultOpen>
|
|
20
20
|
<Popover.Trigger asChild>{openTrigger}</Popover.Trigger>
|
|
@@ -31,7 +31,7 @@ const DefaultStory = ({ openTrigger, children }: PropsWithChildren<{ openTrigger
|
|
|
31
31
|
export default {
|
|
32
32
|
title: 'ui/react-ui-core/Popover',
|
|
33
33
|
component: Popover,
|
|
34
|
-
render:
|
|
34
|
+
render: StorybookPopover,
|
|
35
35
|
decorators: [withTheme],
|
|
36
36
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
37
37
|
};
|
|
@@ -246,13 +246,13 @@ PopoverPortal.displayName = PORTAL_NAME;
|
|
|
246
246
|
|
|
247
247
|
const CONTENT_NAME = 'PopoverContent';
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
interface PopoverContentProps extends PopoverContentTypeProps {
|
|
250
250
|
/**
|
|
251
251
|
* Used to force mounting when more control is needed. Useful when
|
|
252
252
|
* controlling animation with React animation libraries.
|
|
253
253
|
*/
|
|
254
|
-
forceMount?:
|
|
255
|
-
}
|
|
254
|
+
forceMount?: true;
|
|
255
|
+
}
|
|
256
256
|
|
|
257
257
|
const PopoverContent = forwardRef<PopoverContentTypeElement, PopoverContentProps>(
|
|
258
258
|
(props: ScopedProps<PopoverContentProps>, forwardedRef) => {
|
|
@@ -277,8 +277,7 @@ PopoverContent.displayName = CONTENT_NAME;
|
|
|
277
277
|
/* ----------------------------------------------------------------------------------------------- */
|
|
278
278
|
|
|
279
279
|
type PopoverContentTypeElement = PopoverContentImplElement;
|
|
280
|
-
|
|
281
|
-
extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}
|
|
280
|
+
interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}
|
|
282
281
|
|
|
283
282
|
const PopoverContentModal = forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(
|
|
284
283
|
(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {
|
|
@@ -572,8 +571,6 @@ const PopoverViewport = forwardRef<HTMLDivElement, PopoverViewportProps>(
|
|
|
572
571
|
|
|
573
572
|
const getState = (open: boolean) => (open ? 'open' : 'closed');
|
|
574
573
|
|
|
575
|
-
type PopoverContentInteractOutsideEvent = Parameters<NonNullable<PopoverContentProps['onInteractOutside']>>[0];
|
|
576
|
-
|
|
577
574
|
export const Popover = {
|
|
578
575
|
Root: PopoverRoot,
|
|
579
576
|
Anchor: PopoverAnchor,
|
|
@@ -598,5 +595,4 @@ export type {
|
|
|
598
595
|
PopoverCloseProps,
|
|
599
596
|
PopoverArrowProps,
|
|
600
597
|
PopoverViewportProps,
|
|
601
|
-
PopoverContentInteractOutsideEvent,
|
|
602
598
|
};
|
|
@@ -14,7 +14,7 @@ import { withTheme } from '../../testing';
|
|
|
14
14
|
|
|
15
15
|
faker.seed(1234);
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const StorybookScrollArea = ({ children }: PropsWithChildren<{}>) => {
|
|
18
18
|
return (
|
|
19
19
|
<ScrollArea.Root
|
|
20
20
|
classNames={['is-[300px] bs-[400px] rounded', groupSurface, surfaceShadow({ elevation: 'positioned' })]}
|
|
@@ -36,7 +36,7 @@ const DefaultStory = ({ children }: PropsWithChildren<{}>) => {
|
|
|
36
36
|
export default {
|
|
37
37
|
title: 'ui/react-ui-core/Scroll area',
|
|
38
38
|
component: ScrollArea,
|
|
39
|
-
render:
|
|
39
|
+
render: StorybookScrollArea,
|
|
40
40
|
decorators: [withTheme],
|
|
41
41
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
42
42
|
};
|
|
@@ -23,9 +23,6 @@ type ScrollAreaVariant = 'coarse' | 'fine';
|
|
|
23
23
|
|
|
24
24
|
type ScrollAreaRootProps = ThemedClassName<ScrollAreaPrimitiveRootProps>;
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated
|
|
28
|
-
*/
|
|
29
26
|
const ScrollAreaRoot = forwardRef<HTMLDivElement, ScrollAreaRootProps>(({ classNames, ...props }, forwardedRef) => {
|
|
30
27
|
const { tx } = useThemeContext();
|
|
31
28
|
return (
|
|
@@ -13,27 +13,27 @@ import { Button } from '../Buttons';
|
|
|
13
13
|
type ActionTriggerProps = { altText: string; trigger: ReactNode };
|
|
14
14
|
|
|
15
15
|
type StorybookToastProps = Partial<{
|
|
16
|
+
openTrigger: string;
|
|
16
17
|
title: string;
|
|
17
18
|
description: string;
|
|
18
19
|
actionTriggers: ActionTriggerProps[];
|
|
19
|
-
openTrigger: string;
|
|
20
20
|
closeTrigger: ReactNode;
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const StorybookToast = (props: StorybookToastProps) => {
|
|
24
24
|
const [open, setOpen] = useState(true);
|
|
25
25
|
return (
|
|
26
26
|
<Toast.Provider>
|
|
27
|
-
<Button onClick={() => setOpen(true)}>{openTrigger}</Button>
|
|
27
|
+
<Button onClick={() => setOpen(true)}>{props.openTrigger}</Button>
|
|
28
28
|
<Toast.Viewport />
|
|
29
29
|
<Toast.Root open={open} onOpenChange={setOpen}>
|
|
30
30
|
<Toast.Body>
|
|
31
|
-
<Toast.Title>{title}</Toast.Title>
|
|
32
|
-
<Toast.Description>{description}</Toast.Description>
|
|
31
|
+
<Toast.Title>{props.title}</Toast.Title>
|
|
32
|
+
<Toast.Description>{props.description}</Toast.Description>
|
|
33
33
|
</Toast.Body>
|
|
34
34
|
<Toast.Actions>
|
|
35
|
-
<Toast.Close asChild={typeof closeTrigger !== 'string'}>{closeTrigger}</Toast.Close>
|
|
36
|
-
{(actionTriggers || []).map(({ altText, trigger }: ActionTriggerProps, index: number) => (
|
|
35
|
+
<Toast.Close asChild={typeof props.closeTrigger !== 'string'}>{props.closeTrigger}</Toast.Close>
|
|
36
|
+
{(props.actionTriggers || []).map(({ altText, trigger }: ActionTriggerProps, index: number) => (
|
|
37
37
|
<Toast.Action key={index} altText={altText} asChild={typeof trigger !== 'string'}>
|
|
38
38
|
{trigger}
|
|
39
39
|
</Toast.Action>
|
|
@@ -47,7 +47,7 @@ const DefaultStory = ({ title, description, actionTriggers, openTrigger, closeTr
|
|
|
47
47
|
export default {
|
|
48
48
|
title: 'ui/react-ui-core/Toast',
|
|
49
49
|
component: Toast,
|
|
50
|
-
render:
|
|
50
|
+
render: StorybookToast,
|
|
51
51
|
decorators: [withTheme],
|
|
52
52
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
53
53
|
};
|
|
@@ -55,14 +55,9 @@ export default {
|
|
|
55
55
|
export const Default = {
|
|
56
56
|
args: {
|
|
57
57
|
openTrigger: 'Open toast',
|
|
58
|
-
title: '
|
|
58
|
+
title: 'Hi, this is a toast',
|
|
59
59
|
description: 'This goes away on its own with a timer.',
|
|
60
|
-
actionTriggers: [
|
|
61
|
-
{
|
|
62
|
-
altText: 'Press F5 to reload the page',
|
|
63
|
-
trigger: <Button variant='primary'>Reload</Button>,
|
|
64
|
-
},
|
|
65
|
-
],
|
|
60
|
+
actionTriggers: [{ altText: 'Press F5 to reload the page', trigger: <Button variant='primary'>Reload</Button> }],
|
|
66
61
|
closeTrigger: <Button>Close</Button>,
|
|
67
62
|
},
|
|
68
63
|
parameters: {
|
|
@@ -14,7 +14,7 @@ import { Select } from '../Select';
|
|
|
14
14
|
|
|
15
15
|
type StorybookToolbarProps = {};
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const StorybookToolbar = (props: StorybookToolbarProps) => {
|
|
18
18
|
return (
|
|
19
19
|
<Toolbar.Root>
|
|
20
20
|
{/* TODO(burdon): Should be fixed width (regardless of selection). */}
|
|
@@ -72,7 +72,7 @@ const DefaultStory = (props: StorybookToolbarProps) => {
|
|
|
72
72
|
export default {
|
|
73
73
|
title: 'ui/react-ui-core/Toolbar',
|
|
74
74
|
component: Toolbar,
|
|
75
|
-
render:
|
|
75
|
+
render: StorybookToolbar,
|
|
76
76
|
decorators: [withTheme],
|
|
77
77
|
parameters: { chromatic: { disableSnapshot: false } },
|
|
78
78
|
};
|