@dxos/react-ui 0.8.1 → 0.8.2-main.10c050d

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.
Files changed (135) hide show
  1. package/dist/lib/browser/chunk-5Y5JI6KC.mjs +4355 -0
  2. package/dist/lib/browser/chunk-5Y5JI6KC.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +75 -2986
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +85 -0
  7. package/dist/lib/browser/testing/index.mjs.map +7 -0
  8. package/dist/lib/node/chunk-KMS7RFL7.cjs +4340 -0
  9. package/dist/lib/node/chunk-KMS7RFL7.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +71 -2946
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +114 -0
  14. package/dist/lib/node/testing/index.cjs.map +7 -0
  15. package/dist/lib/node-esm/chunk-ANVE7WX5.mjs +4357 -0
  16. package/dist/lib/node-esm/chunk-ANVE7WX5.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +74 -2986
  18. package/dist/lib/node-esm/index.mjs.map +4 -4
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +86 -0
  21. package/dist/lib/node-esm/testing/index.mjs.map +7 -0
  22. package/dist/types/src/components/Avatars/Avatar.d.ts +4 -4
  23. package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
  24. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +3 -3
  25. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  26. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +0 -1
  27. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  28. package/dist/types/src/components/Buttons/Button.stories.d.ts +10 -44
  29. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/Buttons/IconButton.d.ts +4 -6
  31. package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
  32. package/dist/types/src/components/Buttons/IconButton.stories.d.ts +7 -6
  33. package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
  35. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +1 -4
  36. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
  37. package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
  38. package/dist/types/src/components/Clipboard/CopyButton.d.ts +2 -1
  39. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
  40. package/dist/types/src/components/Clipboard/index.d.ts +2 -2
  41. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  42. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +2 -2
  43. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
  44. package/dist/types/src/components/Dialogs/Dialog.d.ts +2 -2
  45. package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
  46. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +2 -2
  47. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
  48. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
  49. package/dist/types/src/components/Input/Input.d.ts +1 -1
  50. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  51. package/dist/types/src/components/Input/Input.stories.d.ts +33 -159
  52. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +1 -1
  54. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
  55. package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +1 -1
  56. package/dist/types/src/components/Lists/Treegrid.stories.d.ts +1 -1
  57. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
  58. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  59. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  60. package/dist/types/src/components/Main/useSwipeToDismiss.d.ts.map +1 -1
  61. package/dist/types/src/components/Message/Message.stories.d.ts +8 -2
  62. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  63. package/dist/types/src/components/Popover/Popover.d.ts +15 -6
  64. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  65. package/dist/types/src/components/Popover/Popover.stories.d.ts +5 -1
  66. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  67. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  68. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  69. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  70. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  71. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
  72. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
  73. package/dist/types/src/components/Toast/Toast.stories.d.ts +2 -2
  74. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  75. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  76. package/dist/types/src/components/Tooltip/Tooltip.d.ts +92 -20
  77. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  78. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +40 -17
  79. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  80. package/dist/types/src/components/index.d.ts +1 -1
  81. package/dist/types/src/components/index.d.ts.map +1 -1
  82. package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
  83. package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
  84. package/dist/types/src/hooks/useIconHref.d.ts.map +1 -1
  85. package/dist/types/src/hooks/useSafeCollisionPadding.d.ts.map +1 -1
  86. package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
  87. package/dist/types/src/playground/Controls.stories.d.ts +1 -1
  88. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  89. package/dist/types/src/playground/Custom.stories.d.ts +8 -0
  90. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -0
  91. package/dist/types/src/testing/decorators/index.d.ts +1 -1
  92. package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
  93. package/dist/types/src/testing/decorators/{withVariants.d.ts → withSurfaceVariantsLayout.d.ts} +2 -3
  94. package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +1 -0
  95. package/dist/types/tsconfig.tsbuildinfo +1 -1
  96. package/package.json +25 -15
  97. package/src/components/Avatars/Avatar.stories.tsx +27 -27
  98. package/src/components/Avatars/Avatar.tsx +24 -21
  99. package/src/components/Avatars/AvatarGroup.stories.tsx +4 -5
  100. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -2
  101. package/src/components/Buttons/Button.stories.tsx +20 -15
  102. package/src/components/Buttons/IconButton.stories.tsx +9 -10
  103. package/src/components/Buttons/IconButton.tsx +9 -38
  104. package/src/components/Buttons/Toggle.stories.tsx +2 -2
  105. package/src/components/Buttons/ToggleGroup.stories.tsx +3 -7
  106. package/src/components/Clipboard/CopyButton.tsx +22 -24
  107. package/src/components/Dialogs/AlertDialog.stories.tsx +4 -11
  108. package/src/components/Dialogs/Dialog.stories.tsx +3 -3
  109. package/src/components/Dialogs/Dialog.tsx +8 -4
  110. package/src/components/Input/Input.stories.tsx +69 -58
  111. package/src/components/Input/Input.tsx +1 -0
  112. package/src/components/Lists/Tree.stories.tsx +2 -2
  113. package/src/components/Lists/Treegrid.stories.tsx +12 -12
  114. package/src/components/Main/Main.stories.tsx +2 -2
  115. package/src/components/Main/Main.tsx +1 -0
  116. package/src/components/Menus/ContextMenu.stories.tsx +2 -2
  117. package/src/components/Menus/DropdownMenu.stories.tsx +2 -2
  118. package/src/components/Message/Message.stories.tsx +10 -4
  119. package/src/components/Popover/Popover.stories.tsx +2 -2
  120. package/src/components/Popover/Popover.tsx +8 -4
  121. package/src/components/ScrollArea/ScrollArea.stories.tsx +4 -4
  122. package/src/components/ScrollArea/ScrollArea.tsx +3 -0
  123. package/src/components/Select/Select.stories.tsx +2 -2
  124. package/src/components/Toast/Toast.stories.tsx +15 -10
  125. package/src/components/Toolbar/Toolbar.stories.tsx +2 -2
  126. package/src/components/Tooltip/Tooltip.stories.tsx +43 -18
  127. package/src/components/Tooltip/Tooltip.tsx +733 -58
  128. package/src/components/index.ts +1 -1
  129. package/src/playground/Controls.stories.tsx +4 -4
  130. package/src/playground/Custom.stories.tsx +137 -0
  131. package/src/playground/Typography.stories.tsx +2 -2
  132. package/src/testing/decorators/index.ts +1 -1
  133. package/src/testing/decorators/withSurfaceVariantsLayout.tsx +53 -0
  134. package/dist/types/src/testing/decorators/withVariants.d.ts.map +0 -1
  135. package/src/testing/decorators/withVariants.tsx +0 -45
@@ -10,7 +10,7 @@ import { Dialog } from './Dialog';
10
10
  import { withTheme } from '../../testing';
11
11
  import { Button } from '../Buttons';
12
12
 
13
- type StorybookDialogProps = Partial<{
13
+ type StoryProps = Partial<{
14
14
  title: string;
15
15
  description: string;
16
16
  body: string;
@@ -19,7 +19,7 @@ type StorybookDialogProps = Partial<{
19
19
  blockAlign: 'center' | 'start';
20
20
  }>;
21
21
 
22
- const StorybookDialog = ({ title, openTrigger, description, body, closeTrigger, blockAlign }: StorybookDialogProps) => {
22
+ const DefaultStory = ({ title, openTrigger, description, body, closeTrigger, blockAlign }: StoryProps) => {
23
23
  return (
24
24
  <Dialog.Root defaultOpen>
25
25
  <Dialog.Trigger asChild>
@@ -42,7 +42,7 @@ const StorybookDialog = ({ title, openTrigger, description, body, closeTrigger,
42
42
  export default {
43
43
  title: 'ui/react-ui-core/Dialog',
44
44
  component: Dialog,
45
- render: StorybookDialog,
45
+ render: DefaultStory,
46
46
  decorators: [withTheme],
47
47
  parameters: { chromatic: { disableSnapshot: false } },
48
48
  };
@@ -81,11 +81,12 @@ const DialogClose: FunctionComponent<DialogCloseProps> = DialogClosePrimitive;
81
81
  type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
82
82
  const DIALOG_OVERLAY_NAME = 'DialogOverlay';
83
83
  const DIALOG_CONTENT_NAME = 'DialogContent';
84
- const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(DIALOG_OVERLAY_NAME, {
85
- inOverlayLayout: false,
86
- });
84
+ const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(
85
+ DIALOG_OVERLAY_NAME,
86
+ {},
87
+ );
87
88
 
88
- type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps> & { blockAlign?: 'center' | 'start' | 'end' };
89
+ type DialogOverlayProps = ThemedClassName<DialogOverlayPrimitiveProps & { blockAlign?: 'center' | 'start' | 'end' }>;
89
90
 
90
91
  const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<HTMLDivElement, DialogOverlayProps>(
91
92
  ({ classNames, children, blockAlign, ...props }, forwardedRef) => {
@@ -115,6 +116,9 @@ const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<
115
116
 
116
117
  return (
117
118
  <DialogContentPrimitive
119
+ // NOTE: Radix warning unless set to undefined.
120
+ // https://www.radix-ui.com/primitives/docs/components/dialog#description
121
+ aria-describedby={undefined}
118
122
  {...props}
119
123
  className={tx(
120
124
  'dialog.content',
@@ -4,28 +4,44 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
+ import { type StoryObj, type Meta } from '@storybook/react';
7
8
  import React from 'react';
8
9
 
9
- import { baseSurface, modalSurface, groupSurface, mx, surfaceShadow } from '@dxos/react-ui-theme';
10
+ import { baseSurface, modalSurface, activeSurface, mx, surfaceShadow } from '@dxos/react-ui-theme';
10
11
  import { type MessageValence } from '@dxos/react-ui-types';
11
12
 
12
- import { Input } from './Input';
13
+ import {
14
+ type CheckboxProps,
15
+ Input,
16
+ type PinInputProps,
17
+ type SwitchProps,
18
+ type TextInputProps,
19
+ type TextAreaProps,
20
+ } from './Input';
13
21
  import { withTheme } from '../../testing';
14
22
 
15
- type StoryInputProps = Partial<{
23
+ type VariantMap = {
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;
16
35
  label: string;
17
- placeholder: string;
18
- disabled: boolean;
19
- description: string;
20
36
  labelVisuallyHidden: boolean;
37
+ description: string;
21
38
  descriptionVisuallyHidden: boolean;
22
- type: 'default' | 'pin' | 'textarea' | 'checkbox' | 'switch';
23
- validationMessage: string;
24
39
  validationValence: MessageValence;
40
+ validationMessage: string;
25
41
  }>;
26
42
 
27
- const StoryInputContent = ({
28
- type = 'default',
43
+ const Wrapper = ({
44
+ kind,
29
45
  label,
30
46
  description,
31
47
  labelVisuallyHidden,
@@ -33,15 +49,17 @@ const StoryInputContent = ({
33
49
  validationValence,
34
50
  validationMessage,
35
51
  ...props
36
- }: StoryInputProps) => {
52
+ }: BaseProps) => {
37
53
  return (
38
54
  <Input.Root {...{ validationValence }}>
39
55
  <Input.Label srOnly={labelVisuallyHidden}>{label}</Input.Label>
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} />}
56
+
57
+ {kind === 'text' && <Input.TextInput {...props} />}
58
+ {kind === 'pin' && <Input.PinInput {...props} />}
59
+ {kind === 'textarea' && <Input.TextArea {...props} />}
60
+ {kind === 'checkbox' && <Input.Checkbox {...props} />}
61
+ {kind === 'switch' && <Input.Switch {...props} />}
62
+
45
63
  <Input.DescriptionAndValidation srOnly={descriptionVisuallyHidden}>
46
64
  {validationMessage && (
47
65
  <>
@@ -54,47 +72,37 @@ const StoryInputContent = ({
54
72
  );
55
73
  };
56
74
 
57
- const StoryInput = (props: StoryInputProps) => {
58
- // TODO(thure): Implement
75
+ const DefaultStory = (props: BaseProps) => {
59
76
  return (
60
77
  <div className='space-b-4'>
61
78
  <div className={mx(baseSurface, 'p-4')}>
62
- <StoryInputContent {...props} />
79
+ <Wrapper {...props} />
63
80
  </div>
64
- <div className={mx(groupSurface, 'p-4 rounded-lg', surfaceShadow({ elevation: 'positioned' }))}>
65
- <StoryInputContent {...props} />
81
+ <div className={mx(activeSurface, 'p-4 rounded-lg', surfaceShadow({ elevation: 'positioned' }))}>
82
+ <Wrapper {...props} />
66
83
  </div>
67
84
  <div className={mx(modalSurface, 'p-4 rounded-lg', surfaceShadow({ elevation: 'dialog' }))}>
68
- <StoryInputContent {...props} />
85
+ <Wrapper {...props} />
69
86
  </div>
70
87
  </div>
71
88
  );
72
89
  };
73
90
 
74
- export default {
91
+ const meta: Meta<BaseProps> = {
75
92
  title: 'ui/react-ui-core/Input',
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
- },
93
+ component: Input.Root,
94
+ render: DefaultStory,
92
95
  decorators: [withTheme],
93
96
  parameters: { chromatic: { disableSnapshot: false } },
94
97
  };
95
98
 
96
- export const Default = {
99
+ export default meta;
100
+
101
+ type Story = StoryObj<BaseProps & Variant>;
102
+
103
+ export const Default: Story = {
97
104
  args: {
105
+ kind: 'text',
98
106
  label: 'Hello',
99
107
  placeholder: 'This is an input',
100
108
  disabled: false,
@@ -103,12 +111,12 @@ export const Default = {
103
111
  descriptionVisuallyHidden: false,
104
112
  validationMessage: '',
105
113
  validationValence: undefined,
106
- length: 6,
107
114
  },
108
115
  };
109
116
 
110
- export const DensityFine = {
117
+ export const DensityFine: Story = {
111
118
  args: {
119
+ kind: 'text',
112
120
  label: 'This is an Input with a density value of ‘fine’',
113
121
  placeholder: 'This is a density:fine input',
114
122
  disabled: false,
@@ -117,13 +125,13 @@ export const DensityFine = {
117
125
  descriptionVisuallyHidden: false,
118
126
  validationMessage: '',
119
127
  validationValence: undefined,
120
- length: 6,
121
128
  density: 'fine',
122
129
  },
123
130
  };
124
131
 
125
- export const Subdued = {
132
+ export const Subdued: Story = {
126
133
  args: {
134
+ kind: 'text',
127
135
  label: 'Hello',
128
136
  placeholder: 'This is a subdued input',
129
137
  disabled: false,
@@ -132,37 +140,40 @@ export const Subdued = {
132
140
  descriptionVisuallyHidden: false,
133
141
  validationMessage: '',
134
142
  validationValence: undefined,
135
- length: 6,
136
143
  variant: 'subdued',
137
144
  },
138
145
  };
139
146
 
140
- export const Disabled = {
147
+ export const Disabled: Story = {
141
148
  args: {
149
+ kind: 'text',
142
150
  label: 'Disabled',
143
151
  placeholder: 'This is a disabled input',
144
152
  disabled: true,
145
153
  },
146
154
  };
147
155
 
148
- export const LabelVisuallyHidden = {
156
+ export const LabelVisuallyHidden: Story = {
149
157
  args: {
158
+ kind: 'text',
150
159
  label: 'The label is for screen readers',
151
160
  labelVisuallyHidden: true,
152
161
  placeholder: 'The label for this input exists but is only read by screen readers',
153
162
  },
154
163
  };
155
164
 
156
- export const InputWithDescription = {
165
+ export const InputWithDescription: Story = {
157
166
  args: {
167
+ kind: 'text',
158
168
  label: 'Described input',
159
169
  placeholder: 'This input has an accessible description',
160
170
  description: 'This helper text is accessibly associated with the input.',
161
171
  },
162
172
  };
163
173
 
164
- export const InputWithErrorAndDescription = {
174
+ export const InputWithErrorAndDescription: Story = {
165
175
  args: {
176
+ kind: 'text',
166
177
  label: 'Described invalid input',
167
178
  placeholder: 'This input has both an accessible description and a validation error',
168
179
  description: 'This description is identified separately in the accessibility tree.',
@@ -171,8 +182,9 @@ export const InputWithErrorAndDescription = {
171
182
  },
172
183
  };
173
184
 
174
- export const InputWithValidationAndDescription = {
185
+ export const InputWithValidationAndDescription: Story = {
175
186
  args: {
187
+ kind: 'text',
176
188
  label: 'Described input with validation message',
177
189
  placeholder: 'This input is styled to express a validation valence',
178
190
  description: 'This description is extra.',
@@ -181,39 +193,38 @@ export const InputWithValidationAndDescription = {
181
193
  },
182
194
  };
183
195
 
184
- export const TextArea = {
196
+ export const TextArea: Story = {
185
197
  args: {
198
+ kind: 'textarea',
186
199
  label: 'This input is a text area input',
187
- type: 'textarea',
188
200
  description: 'Type a long paragraph',
189
201
  placeholder: 'Lorem ipsum dolor sit amet',
190
202
  },
191
203
  };
192
204
 
193
- export const PinInput = {
205
+ export const PinInput: Story = {
194
206
  args: {
207
+ kind: 'pin',
195
208
  label: 'This input is a PIN-style input',
196
- type: 'pin',
197
209
  length: 6,
198
210
  description: 'Type in secret you received',
199
211
  placeholder: '••••••',
200
212
  },
201
213
  };
202
214
 
203
- export const Checkbox = {
215
+ export const Checkbox: Story = {
204
216
  args: {
217
+ kind: 'checkbox',
205
218
  label: 'This is a checkbox',
206
- type: 'checkbox',
207
219
  description: 'It’s checked, indeterminate, or unchecked',
208
220
  size: 5,
209
- weight: 'bold',
210
221
  },
211
222
  };
212
223
 
213
224
  export const Switch = {
214
225
  args: {
226
+ kind: 'switch',
215
227
  label: 'This is a switch',
216
- type: 'switch',
217
228
  description: 'It’s either off... or on.',
218
229
  },
219
230
  };
@@ -342,6 +342,7 @@ export const Input = {
342
342
  export type {
343
343
  InputVariant,
344
344
  InputRootProps,
345
+ InputSharedProps,
345
346
  PinInputProps,
346
347
  TextInputProps,
347
348
  TextAreaProps,
@@ -51,14 +51,14 @@ const StorybookTreeItem = ({ data, prefix }: StorybookTreeItemProps) => {
51
51
  );
52
52
  };
53
53
 
54
- const StorybookTree = ({ data }: StorybookTreeProps) => {
54
+ const DefaultStory = ({ 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: StorybookTree,
61
+ render: DefaultStory,
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 as Tg } from './Treegrid';
9
+ import { Treegrid } 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
- <Tg.Root gridTemplateColumns='1fr'>
125
+ <Treegrid.Root gridTemplateColumns='1fr'>
126
126
  {flattenedContent.map(({ node, parentOf, path }) => {
127
127
  return (
128
- <Tg.Row
128
+ <Treegrid.Row
129
129
  key={node.id}
130
- id={path.join(Tg.PATH_SEPARATOR)}
131
- {...(parentOf && { parentOf: parentOf.join(Tg.PARENT_OF_SEPARATOR) })}
130
+ id={path.join(Treegrid.PATH_SEPARATOR)}
131
+ {...(parentOf && { parentOf: parentOf.join(Treegrid.PARENT_OF_SEPARATOR) })}
132
132
  >
133
- <Tg.Cell indent classNames='flex items-center'>
133
+ <Treegrid.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
- </Tg.Cell>
137
- </Tg.Row>
136
+ </Treegrid.Cell>
137
+ </Treegrid.Row>
138
138
  );
139
139
  })}
140
- </Tg.Root>
140
+ </Treegrid.Root>
141
141
  );
142
142
  };
143
143
 
144
- export const Default = {};
145
-
146
144
  export default {
147
145
  title: 'ui/react-ui-core/Treegrid',
148
- component: Tg.Root,
146
+ component: Treegrid.Root,
149
147
  render: DefaultStory,
150
148
  decorators: [withTheme],
151
149
  };
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 StoryMain = (_args: StoryMainArgs) => {
25
+ const DefaultStory = (_args: StoryMainArgs) => {
26
26
  return (
27
27
  <Main.Root>
28
28
  <Main.Overlay />
@@ -48,7 +48,7 @@ const StoryMain = (_args: StoryMainArgs) => {
48
48
  export default {
49
49
  title: 'ui/react-ui-core/Main',
50
50
  component: Main.Root,
51
- render: StoryMain,
51
+ render: DefaultStory,
52
52
  decorators: [withTheme],
53
53
  parameters: { chromatic: { disableSnapshot: false } },
54
54
  };
@@ -308,6 +308,7 @@ const MainContent = forwardRef<HTMLDivElement, MainProps>(
308
308
  {...props}
309
309
  data-sidebar-inline-start-state={navigationSidebarState}
310
310
  data-sidebar-inline-end-state={complementarySidebarState}
311
+ data-handles-focus={handlesFocus}
311
312
  className={tx('main.content', 'main', { bounce, handlesFocus }, classNames)}
312
313
  ref={forwardedRef}
313
314
  >
@@ -9,7 +9,7 @@ import React from 'react';
9
9
  import { ContextMenu } from './ContextMenu';
10
10
  import { withTheme } from '../../testing';
11
11
 
12
- const StorybookContextMenu = () => {
12
+ const DefaultStory = () => {
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 StorybookContextMenu = () => {
94
94
  export default {
95
95
  title: 'ui/react-ui-core/ContextMenu',
96
96
  component: ContextMenu,
97
- render: StorybookContextMenu,
97
+ render: DefaultStory,
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 StorybookDropdownMenu = () => {
13
+ const DefaultStory = () => {
14
14
  return (
15
15
  <DropdownMenu.Root defaultOpen>
16
16
  <DropdownMenu.Trigger asChild>
@@ -94,7 +94,7 @@ const StorybookDropdownMenu = () => {
94
94
  export default {
95
95
  title: 'ui/react-ui-core/DropdownMenu',
96
96
  component: DropdownMenu,
97
- render: StorybookDropdownMenu,
97
+ render: DefaultStory,
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 StoryMessageProps = {
15
+ type StoryProps = {
16
16
  valence: MessageValence;
17
17
  title: string;
18
18
  body: string;
19
19
  };
20
20
 
21
- const StoryMessage = ({ valence, title, body }: StoryMessageProps) => (
21
+ const DefaultStory = ({ valence, title, body }: StoryProps) => (
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,14 +30,20 @@ const StoryMessage = ({ valence, title, body }: StoryMessageProps) => (
30
30
  export default {
31
31
  title: 'ui/react-ui-core/Message',
32
32
  component: Message,
33
- render: StoryMessage,
33
+ render: DefaultStory,
34
34
  decorators: [withTheme],
35
35
  parameters: { chromatic: { disableSnapshot: false } },
36
+ argTypes: {
37
+ valence: {
38
+ control: 'select',
39
+ options: ['success', 'info', 'warning', 'error', 'neutral'],
40
+ },
41
+ },
36
42
  };
37
43
 
38
44
  export const Default = {
39
45
  args: {
40
- valence: 'error',
46
+ valence: 'neutral',
41
47
  title: 'Alert title',
42
48
  body: 'Alert content',
43
49
  },
@@ -14,7 +14,7 @@ import { Button } from '../Buttons';
14
14
 
15
15
  faker.seed(1234);
16
16
 
17
- const StorybookPopover = ({ openTrigger, children }: PropsWithChildren<{ openTrigger: ReactNode }>) => {
17
+ const DefaultStory = ({ 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 StorybookPopover = ({ openTrigger, children }: PropsWithChildren<{ openTri
31
31
  export default {
32
32
  title: 'ui/react-ui-core/Popover',
33
33
  component: Popover,
34
- render: StorybookPopover,
34
+ render: DefaultStory,
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
- interface PopoverContentProps extends PopoverContentTypeProps {
249
+ type PopoverContentProps = ThemedClassName<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?: true;
255
- }
254
+ forceMount?: boolean;
255
+ };
256
256
 
257
257
  const PopoverContent = forwardRef<PopoverContentTypeElement, PopoverContentProps>(
258
258
  (props: ScopedProps<PopoverContentProps>, forwardedRef) => {
@@ -277,7 +277,8 @@ PopoverContent.displayName = CONTENT_NAME;
277
277
  /* ----------------------------------------------------------------------------------------------- */
278
278
 
279
279
  type PopoverContentTypeElement = PopoverContentImplElement;
280
- interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}
280
+ export interface PopoverContentTypeProps
281
+ extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {}
281
282
 
282
283
  const PopoverContentModal = forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(
283
284
  (props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {
@@ -571,6 +572,8 @@ const PopoverViewport = forwardRef<HTMLDivElement, PopoverViewportProps>(
571
572
 
572
573
  const getState = (open: boolean) => (open ? 'open' : 'closed');
573
574
 
575
+ type PopoverContentInteractOutsideEvent = Parameters<NonNullable<PopoverContentProps['onInteractOutside']>>[0];
576
+
574
577
  export const Popover = {
575
578
  Root: PopoverRoot,
576
579
  Anchor: PopoverAnchor,
@@ -595,4 +598,5 @@ export type {
595
598
  PopoverCloseProps,
596
599
  PopoverArrowProps,
597
600
  PopoverViewportProps,
601
+ PopoverContentInteractOutsideEvent,
598
602
  };
@@ -7,17 +7,17 @@ import '@dxos-theme';
7
7
  import React, { type PropsWithChildren } from 'react';
8
8
 
9
9
  import { faker } from '@dxos/random';
10
- import { groupSurface, surfaceShadow } from '@dxos/react-ui-theme';
10
+ import { activeSurface, surfaceShadow } from '@dxos/react-ui-theme';
11
11
 
12
12
  import { ScrollArea } from './ScrollArea';
13
13
  import { withTheme } from '../../testing';
14
14
 
15
15
  faker.seed(1234);
16
16
 
17
- const StorybookScrollArea = ({ children }: PropsWithChildren<{}>) => {
17
+ const DefaultStory = ({ children }: PropsWithChildren<{}>) => {
18
18
  return (
19
19
  <ScrollArea.Root
20
- classNames={['is-[300px] bs-[400px] rounded', groupSurface, surfaceShadow({ elevation: 'positioned' })]}
20
+ classNames={['is-[300px] bs-[400px] rounded', activeSurface, surfaceShadow({ elevation: 'positioned' })]}
21
21
  >
22
22
  <ScrollArea.Viewport classNames='rounded p-4'>
23
23
  <p>{children}</p>
@@ -36,7 +36,7 @@ const StorybookScrollArea = ({ children }: PropsWithChildren<{}>) => {
36
36
  export default {
37
37
  title: 'ui/react-ui-core/Scroll area',
38
38
  component: ScrollArea,
39
- render: StorybookScrollArea,
39
+ render: DefaultStory,
40
40
  decorators: [withTheme],
41
41
  parameters: { chromatic: { disableSnapshot: false } },
42
42
  };
@@ -23,6 +23,9 @@ type ScrollAreaVariant = 'coarse' | 'fine';
23
23
 
24
24
  type ScrollAreaRootProps = ThemedClassName<ScrollAreaPrimitiveRootProps>;
25
25
 
26
+ /**
27
+ * @deprecated
28
+ */
26
29
  const ScrollAreaRoot = forwardRef<HTMLDivElement, ScrollAreaRootProps>(({ classNames, ...props }, forwardedRef) => {
27
30
  const { tx } = useThemeContext();
28
31
  return (
@@ -10,7 +10,7 @@ import React, { useState } from 'react';
10
10
  import { faker } from '@dxos/random';
11
11
 
12
12
  import { Select } from './Select';
13
- import { withVariants, withTheme } from '../../testing';
13
+ import { withSurfaceVariantsLayout, withTheme } from '../../testing';
14
14
 
15
15
  faker.seed(1234);
16
16
 
@@ -50,6 +50,6 @@ export const Default: StoryObj<StoryProps> = {
50
50
  export default {
51
51
  title: 'ui/react-ui-core/Select',
52
52
  render: DefaultStory,
53
- decorators: [withVariants(), withTheme],
53
+ decorators: [withSurfaceVariantsLayout(), withTheme],
54
54
  parameters: { chromatic: { disableSnapshot: false } },
55
55
  };