@dxos/react-ui 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77

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 (200) hide show
  1. package/dist/lib/browser/{chunk-2COVUP44.mjs → chunk-LBCJC75U.mjs} +121 -35
  2. package/dist/lib/browser/chunk-LBCJC75U.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +6 -1
  4. package/dist/lib/browser/index.mjs.map +2 -2
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +21 -21
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/{chunk-GHXHND5V.mjs → chunk-QTUGGUCB.mjs} +121 -35
  9. package/dist/lib/node-esm/chunk-QTUGGUCB.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +6 -1
  11. package/dist/lib/node-esm/index.mjs.map +2 -2
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +21 -21
  14. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  15. package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
  16. package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
  17. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +5 -31
  18. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  19. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +5 -11
  20. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  21. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  22. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  23. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +8 -20
  24. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/Buttons/Button.d.ts +1 -1
  26. package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
  27. package/dist/types/src/components/Buttons/Button.stories.d.ts +9 -4
  28. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/Buttons/IconButton.d.ts +2 -2
  30. package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
  31. package/dist/types/src/components/Buttons/IconButton.stories.d.ts +6 -15
  32. package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
  33. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +5 -11
  34. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
  35. package/dist/types/src/components/Buttons/ToggleGroup.d.ts +7 -8
  36. package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +1 -1
  37. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +7 -19
  38. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
  39. package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
  40. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
  41. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  42. package/dist/types/src/components/Dialogs/AlertDialog.d.ts +1 -1
  43. package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +1 -1
  44. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +7 -39
  45. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
  46. package/dist/types/src/components/Dialogs/Dialog.d.ts +1 -1
  47. package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
  48. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +6 -29
  49. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
  50. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
  51. package/dist/types/src/components/Icon/Icon.d.ts +1 -1
  52. package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
  53. package/dist/types/src/components/Input/Input.d.ts +2 -4
  54. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  55. package/dist/types/src/components/Input/Input.stories.d.ts +10 -11
  56. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  57. package/dist/types/src/components/Link/Link.stories.d.ts +8 -8
  58. package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
  59. package/dist/types/src/components/Lists/List.d.ts +2 -2
  60. package/dist/types/src/components/Lists/List.d.ts.map +1 -1
  61. package/dist/types/src/components/Lists/List.stories.d.ts +8 -31
  62. package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
  63. package/dist/types/src/components/Lists/Tree.d.ts +1 -1
  64. package/dist/types/src/components/Lists/Tree.d.ts.map +1 -1
  65. package/dist/types/src/components/Lists/Tree.stories.d.ts +6 -32
  66. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
  67. package/dist/types/src/components/Lists/Treegrid.d.ts +1 -1
  68. package/dist/types/src/components/Lists/Treegrid.d.ts.map +1 -1
  69. package/dist/types/src/components/Lists/Treegrid.stories.d.ts +6 -4
  70. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +1 -1
  71. package/dist/types/src/components/Main/Main.d.ts +1 -1
  72. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  73. package/dist/types/src/components/Main/Main.stories.d.ts +6 -7
  74. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  75. package/dist/types/src/components/Menus/ContextMenu.d.ts.map +1 -1
  76. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +6 -44
  77. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
  78. package/dist/types/src/components/Menus/DropdownMenu.d.ts +6 -5
  79. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
  80. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +6 -41
  81. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
  82. package/dist/types/src/components/Message/Message.d.ts +1 -1
  83. package/dist/types/src/components/Message/Message.d.ts.map +1 -1
  84. package/dist/types/src/components/Message/Message.stories.d.ts +7 -16
  85. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  86. package/dist/types/src/components/Popover/Popover.d.ts +2 -2
  87. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  88. package/dist/types/src/components/Popover/Popover.stories.d.ts +6 -34
  89. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  90. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +1 -1
  91. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  92. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +6 -32
  93. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  94. package/dist/types/src/components/Select/Select.d.ts.map +1 -1
  95. package/dist/types/src/components/Select/Select.stories.d.ts +4 -9
  96. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  97. package/dist/types/src/components/Status/Status.stories.d.ts +2 -8
  98. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  99. package/dist/types/src/components/Tag/Tag.stories.d.ts +12 -12
  100. package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
  101. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -1
  102. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  103. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -1
  104. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
  105. package/dist/types/src/components/Toast/Toast.d.ts +1 -1
  106. package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
  107. package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -44
  108. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  109. package/dist/types/src/components/Toolbar/Toolbar.d.ts +3 -7
  110. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  111. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -50
  112. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  113. package/dist/types/src/components/Tooltip/Tooltip.d.ts +2 -4
  114. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  115. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +8 -61
  116. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  117. package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
  118. package/dist/types/src/hooks/useVisualViewport.d.ts +2 -2
  119. package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
  120. package/dist/types/src/index.d.ts +1 -1
  121. package/dist/types/src/index.d.ts.map +1 -1
  122. package/dist/types/src/playground/Controls.stories.d.ts +5 -9
  123. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  124. package/dist/types/src/playground/Custom.stories.d.ts +12 -4
  125. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  126. package/dist/types/src/playground/Typography.stories.d.ts +5 -11
  127. package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
  128. package/dist/types/src/testing/decorators/withTheme.d.ts +3 -0
  129. package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
  130. package/dist/types/src/util/domino.d.ts +18 -0
  131. package/dist/types/src/util/domino.d.ts.map +1 -0
  132. package/dist/types/src/util/index.d.ts +1 -0
  133. package/dist/types/src/util/index.d.ts.map +1 -1
  134. package/dist/types/tsconfig.tsbuildinfo +1 -1
  135. package/package.json +24 -26
  136. package/src/components/Avatars/Avatar.stories.tsx +19 -10
  137. package/src/components/Avatars/Avatar.tsx +3 -3
  138. package/src/components/Avatars/AvatarGroup.stories.tsx +10 -6
  139. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +16 -11
  140. package/src/components/Breadcrumb/Breadcrumb.tsx +1 -1
  141. package/src/components/Buttons/Button.stories.tsx +8 -9
  142. package/src/components/Buttons/IconButton.stories.tsx +11 -8
  143. package/src/components/Buttons/IconButton.tsx +4 -3
  144. package/src/components/Buttons/Toggle.stories.tsx +10 -7
  145. package/src/components/Buttons/ToggleGroup.stories.tsx +10 -7
  146. package/src/components/Buttons/ToggleGroup.tsx +17 -4
  147. package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
  148. package/src/components/Clipboard/CopyButton.tsx +2 -1
  149. package/src/components/DensityProvider/DensityProvider.tsx +1 -1
  150. package/src/components/Dialogs/AlertDialog.stories.tsx +14 -11
  151. package/src/components/Dialogs/AlertDialog.tsx +13 -13
  152. package/src/components/Dialogs/Dialog.stories.tsx +16 -14
  153. package/src/components/Dialogs/Dialog.tsx +13 -13
  154. package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
  155. package/src/components/Input/Input.stories.tsx +12 -14
  156. package/src/components/Input/Input.tsx +16 -16
  157. package/src/components/Link/Link.stories.tsx +10 -6
  158. package/src/components/Lists/List.stories.tsx +16 -14
  159. package/src/components/Lists/List.tsx +16 -12
  160. package/src/components/Lists/Tree.stories.tsx +11 -8
  161. package/src/components/Lists/Tree.tsx +4 -3
  162. package/src/components/Lists/TreeDropIndicator.tsx +1 -1
  163. package/src/components/Lists/Treegrid.stories.tsx +12 -6
  164. package/src/components/Lists/Treegrid.tsx +2 -2
  165. package/src/components/Main/Main.stories.tsx +16 -8
  166. package/src/components/Main/Main.tsx +16 -10
  167. package/src/components/Menus/ContextMenu.stories.tsx +11 -8
  168. package/src/components/Menus/ContextMenu.tsx +1 -0
  169. package/src/components/Menus/DropdownMenu.stories.tsx +11 -8
  170. package/src/components/Menus/DropdownMenu.tsx +23 -13
  171. package/src/components/Message/Message.stories.tsx +11 -7
  172. package/src/components/Message/Message.tsx +1 -1
  173. package/src/components/Popover/Popover.stories.tsx +11 -8
  174. package/src/components/Popover/Popover.tsx +9 -9
  175. package/src/components/ScrollArea/ScrollArea.stories.tsx +11 -8
  176. package/src/components/ScrollArea/ScrollArea.tsx +4 -4
  177. package/src/components/Select/Select.stories.tsx +15 -12
  178. package/src/components/Select/Select.tsx +5 -4
  179. package/src/components/Status/Status.stories.tsx +9 -6
  180. package/src/components/Tag/Tag.stories.tsx +18 -9
  181. package/src/components/ThemeProvider/ThemeProvider.tsx +3 -2
  182. package/src/components/ThemeProvider/TranslationsProvider.tsx +3 -3
  183. package/src/components/Toast/Toast.stories.tsx +11 -8
  184. package/src/components/Toast/Toast.tsx +9 -9
  185. package/src/components/Toolbar/Toolbar.stories.tsx +12 -8
  186. package/src/components/Toolbar/Toolbar.tsx +3 -2
  187. package/src/components/Tooltip/Tooltip.stories.tsx +15 -11
  188. package/src/components/Tooltip/Tooltip.tsx +5 -4
  189. package/src/hooks/useSafeArea.ts +1 -0
  190. package/src/hooks/useVisualViewport.ts +3 -3
  191. package/src/index.ts +1 -1
  192. package/src/playground/Controls.stories.tsx +12 -8
  193. package/src/playground/Custom.stories.tsx +7 -16
  194. package/src/playground/Typography.stories.tsx +8 -6
  195. package/src/testing/decorators/withTheme.tsx +31 -0
  196. package/src/util/domino.ts +51 -0
  197. package/src/util/index.ts +1 -0
  198. package/dist/lib/browser/chunk-2COVUP44.mjs.map +0 -7
  199. package/dist/lib/node-esm/chunk-GHXHND5V.mjs.map +0 -7
  200. package/src/testing/decorators/withTheme.ts +0 -25
@@ -2,14 +2,14 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
6
  import React from 'react';
8
7
 
9
- import { Dialog } from './Dialog';
10
8
  import { withTheme } from '../../testing';
11
9
  import { Button } from '../Buttons';
12
10
 
11
+ import { Dialog } from './Dialog';
12
+
13
13
  type StoryProps = Partial<{
14
14
  title: string;
15
15
  description: string;
@@ -39,15 +39,23 @@ const DefaultStory = ({ title, openTrigger, description, body, closeTrigger, blo
39
39
  );
40
40
  };
41
41
 
42
- export default {
42
+ const meta = {
43
43
  title: 'ui/react-ui-core/Dialog',
44
- component: Dialog,
44
+ component: Dialog as any,
45
45
  render: DefaultStory,
46
46
  decorators: [withTheme],
47
- parameters: { chromatic: { disableSnapshot: false } },
48
- };
47
+ parameters: {
48
+ chromatic: {
49
+ disableSnapshot: false,
50
+ },
51
+ },
52
+ } satisfies Meta<typeof DefaultStory>;
53
+
54
+ export default meta;
55
+
56
+ type Story = StoryObj<typeof meta>;
49
57
 
50
- export const Default = {
58
+ export const Default: Story = {
51
59
  args: {
52
60
  title: 'Dialog title',
53
61
  openTrigger: 'Open Dialog',
@@ -56,10 +64,4 @@ export const Default = {
56
64
  closeTrigger: 'Close trigger',
57
65
  blockAlign: 'center',
58
66
  },
59
- argTypes: {
60
- blockAlign: {
61
- type: 'select',
62
- options: ['center', 'start', 'end'],
63
- },
64
- },
65
67
  };
@@ -4,24 +4,24 @@
4
4
 
5
5
  import { createContext } from '@radix-ui/react-context';
6
6
  import {
7
- type DialogProps as DialogRootPrimitiveProps,
8
- Root as DialogRootPrimitive,
9
- DialogTrigger as DialogTriggerPrimitive,
10
- type DialogTriggerProps as DialogTriggerPrimitiveProps,
11
- DialogPortal as DialogPortalPrimitive,
12
- type DialogPortalProps as DialogPortalPrimitiveProps,
13
- DialogOverlay as DialogOverlayPrimitive,
14
- type DialogOverlayProps as DialogOverlayPrimitiveProps,
15
- DialogTitle as DialogTitlePrimitive,
16
- type DialogTitleProps as DialogTitlePrimitiveProps,
17
- DialogDescription as DialogDescriptionPrimitive,
18
- type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
19
7
  DialogClose as DialogClosePrimitive,
20
8
  type DialogCloseProps as DialogClosePrimitiveProps,
21
9
  DialogContent as DialogContentPrimitive,
22
10
  type DialogContentProps as DialogContentPrimitiveProps,
11
+ DialogDescription as DialogDescriptionPrimitive,
12
+ type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
13
+ DialogOverlay as DialogOverlayPrimitive,
14
+ type DialogOverlayProps as DialogOverlayPrimitiveProps,
15
+ DialogPortal as DialogPortalPrimitive,
16
+ type DialogPortalProps as DialogPortalPrimitiveProps,
17
+ Root as DialogRootPrimitive,
18
+ type DialogProps as DialogRootPrimitiveProps,
19
+ DialogTitle as DialogTitlePrimitive,
20
+ type DialogTitleProps as DialogTitlePrimitiveProps,
21
+ DialogTrigger as DialogTriggerPrimitive,
22
+ type DialogTriggerProps as DialogTriggerPrimitiveProps,
23
23
  } from '@radix-ui/react-dialog';
24
- import React, { forwardRef, type ForwardRefExoticComponent, type FunctionComponent } from 'react';
24
+ import React, { type ForwardRefExoticComponent, type FunctionComponent, forwardRef } from 'react';
25
25
 
26
26
  import { useThemeContext } from '../../hooks';
27
27
  import { type ThemedClassName } from '../../util';
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { createContext, type PropsWithChildren } from 'react';
5
+ import React, { type PropsWithChildren, createContext } from 'react';
6
6
 
7
7
  import { type Elevation } from '@dxos/react-ui-types';
8
8
 
@@ -2,23 +2,22 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { type StoryObj, type Meta } from '@storybook/react-vite';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
10
- import { baseSurface, modalSurface, activeSurface, mx, surfaceShadow } from '@dxos/react-ui-theme';
8
+ import { baseSurface, modalSurface, mx, surfaceShadow } from '@dxos/react-ui-theme';
11
9
  import { type MessageValence } from '@dxos/react-ui-types';
12
10
 
11
+ import { withTheme } from '../../testing';
12
+
13
13
  import {
14
14
  type CheckboxProps,
15
15
  Input,
16
16
  type PinInputProps,
17
17
  type SwitchProps,
18
- type TextInputProps,
19
18
  type TextAreaProps,
19
+ type TextInputProps,
20
20
  } from './Input';
21
- import { withTheme } from '../../testing';
22
21
 
23
22
  type VariantMap = {
24
23
  text: TextInputProps;
@@ -75,10 +74,10 @@ const Wrapper = ({
75
74
  const DefaultStory = (props: BaseProps) => {
76
75
  return (
77
76
  <div className='space-b-4'>
78
- <div className={mx(baseSurface, 'p-4')}>
77
+ <div className={mx(baseSurface, 'p-4 rounded-md')}>
79
78
  <Wrapper {...props} />
80
79
  </div>
81
- <div className={mx(activeSurface, 'p-4 rounded-md', surfaceShadow({ elevation: 'positioned' }))}>
80
+ <div className={mx('bg-cardSurface', 'p-4 rounded-md', surfaceShadow({ elevation: 'positioned' }))}>
82
81
  <Wrapper {...props} />
83
82
  </div>
84
83
  <div className={mx(modalSurface, 'p-4 rounded-md', surfaceShadow({ elevation: 'dialog' }))}>
@@ -88,13 +87,12 @@ const DefaultStory = (props: BaseProps) => {
88
87
  );
89
88
  };
90
89
 
91
- const meta: Meta<BaseProps> = {
90
+ const meta = {
92
91
  title: 'ui/react-ui-core/Input',
93
- component: Input.Root,
92
+ component: Input.Root as any,
94
93
  render: DefaultStory,
95
94
  decorators: [withTheme],
96
- parameters: { chromatic: { disableSnapshot: false } },
97
- };
95
+ } satisfies Meta<typeof DefaultStory>;
98
96
 
99
97
  export default meta;
100
98
 
@@ -221,10 +219,10 @@ export const Checkbox: Story = {
221
219
  },
222
220
  };
223
221
 
224
- export const Switch = {
222
+ export const Switch: Story = {
225
223
  args: {
226
224
  kind: 'switch',
227
225
  label: 'This is a switch',
228
- description: 'It’s either off... or on.',
226
+ description: "It's either off... or on.",
229
227
  },
230
228
  };
@@ -2,34 +2,33 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type IconWeight } from '@phosphor-icons/react';
6
5
  import { Root as CheckboxPrimitive, type CheckboxProps as CheckboxPrimitiveProps } from '@radix-ui/react-checkbox';
7
6
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
8
- import React, { type ComponentPropsWithRef, forwardRef, type ForwardRefExoticComponent, useCallback } from 'react';
7
+ import React, { type ComponentPropsWithRef, type ForwardRefExoticComponent, forwardRef, useCallback } from 'react';
9
8
 
10
9
  import {
10
+ DescriptionAndValidation as DescriptionAndValidationPrimitive,
11
+ type DescriptionAndValidationProps as DescriptionAndValidationPrimitiveProps,
12
+ Description as DescriptionPrimitive,
13
+ type DescriptionProps as DescriptionPrimitiveProps,
14
+ INPUT_NAME,
11
15
  InputRoot,
12
16
  type InputRootProps,
17
+ type InputScopedProps,
18
+ Label as LabelPrimitive,
19
+ type LabelProps as LabelPrimitiveProps,
13
20
  PinInput as PinInputPrimitive,
14
21
  type PinInputProps as PinInputPrimitiveProps,
15
- TextInput as TextInputPrimitive,
16
- type TextInputProps as TextInputPrimitiveProps,
17
22
  TextArea as TextAreaPrimitive,
18
23
  type TextAreaProps as TextAreaPrimitiveProps,
19
- useInputContext,
20
- INPUT_NAME,
21
- type InputScopedProps,
22
- Description as DescriptionPrimitive,
23
- DescriptionAndValidation as DescriptionAndValidationPrimitive,
24
- type DescriptionAndValidationProps as DescriptionAndValidationPrimitiveProps,
25
- type DescriptionProps as DescriptionPrimitiveProps,
26
- Label as LabelPrimitive,
27
- type LabelProps as LabelPrimitiveProps,
24
+ TextInput as TextInputPrimitive,
25
+ type TextInputProps as TextInputPrimitiveProps,
28
26
  Validation as ValidationPrimitive,
29
27
  type ValidationProps as ValidationPrimitiveProps,
28
+ useInputContext,
30
29
  } from '@dxos/react-input';
31
30
  import { mx } from '@dxos/react-ui-theme';
32
- import { type Density, type Elevation, type ClassNameValue, type Size } from '@dxos/react-ui-types';
31
+ import { type ClassNameValue, type Density, type Elevation, type Size } from '@dxos/react-ui-types';
33
32
 
34
33
  import { useDensityContext, useElevationContext, useThemeContext } from '../../hooks';
35
34
  import { type ThemedClassName } from '../../util';
@@ -230,7 +229,9 @@ const TextArea = forwardRef<HTMLTextAreaElement, InputScopedProps<TextAreaProps>
230
229
  },
231
230
  );
232
231
 
233
- type CheckboxProps = ThemedClassName<Omit<CheckboxPrimitiveProps, 'children'>> & { size?: Size; weight?: IconWeight };
232
+ type CheckboxProps = ThemedClassName<Omit<CheckboxPrimitiveProps, 'children'>> & {
233
+ size?: Size;
234
+ };
234
235
 
235
236
  const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
236
237
  HTMLButtonElement,
@@ -243,7 +244,6 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
243
244
  defaultChecked: propsDefaultChecked,
244
245
  onCheckedChange: propsOnCheckedChange,
245
246
  size,
246
- weight = 'bold',
247
247
  classNames,
248
248
  ...props
249
249
  },
@@ -2,16 +2,20 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
 
7
- import { Link } from './Link';
8
7
  import { withTheme } from '../../testing';
9
8
 
10
- export default {
9
+ import { Link } from './Link';
10
+
11
+ const meta = {
11
12
  title: 'ui/react-ui-core/Link',
12
13
  component: Link,
13
14
  decorators: [withTheme],
14
- parameters: { chromatic: { disableSnapshot: false } },
15
- } as any;
15
+ } satisfies Meta<typeof Link>;
16
+
17
+ export default meta;
18
+
19
+ type Story = StoryObj<typeof meta>;
16
20
 
17
- export const Default = { args: { children: 'Hello', href: '#' } };
21
+ export const Default: Story = { args: { children: 'Hello', href: '#' } };
@@ -2,12 +2,11 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { DndContext, type DragEndEvent, type DragStartEvent } from '@dnd-kit/core';
8
- import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
6
+ import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
9
7
  import { CSS } from '@dnd-kit/utilities';
10
8
  import { useArrowNavigationGroup } from '@fluentui/react-tabster';
9
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
11
10
  import React, { type ReactNode, useState } from 'react';
12
11
 
13
12
  import {
@@ -19,16 +18,20 @@ import {
19
18
  surfaceShadow,
20
19
  } from '@dxos/react-ui-theme';
21
20
 
22
- import { List, ListItem, type ListScopedProps } from './List';
23
21
  import { withTheme } from '../../testing';
24
22
  import { Icon } from '../Icon';
25
23
 
26
- export default {
24
+ import { List, ListItem, type ListScopedProps } from './List';
25
+
26
+ const meta = {
27
27
  title: 'ui/react-ui-core/List',
28
28
  component: List,
29
29
  decorators: [withTheme],
30
- parameters: { chromatic: { disableSnapshot: false } },
31
- };
30
+ } satisfies Meta<typeof List>;
31
+
32
+ export default meta;
33
+
34
+ type Story = StoryObj<typeof meta>;
32
35
 
33
36
  const UniformListItem = ({ id, text }: { id: string; text: string }) => {
34
37
  const { attributes, listeners, setNodeRef, transform } = useSortable({ id });
@@ -51,7 +54,7 @@ const UniformListItem = ({ id, text }: { id: string; text: string }) => {
51
54
  );
52
55
  };
53
56
 
54
- export const UniformSizeDraggable = {
57
+ export const UniformSizeDraggable: Story = {
55
58
  render: ({ ...args }) => {
56
59
  const [items, setItems] = useState(
57
60
  [...Array(12)].map((_, index) => ({
@@ -115,7 +118,7 @@ const ManySizesDraggableListItem = ({
115
118
  );
116
119
  };
117
120
 
118
- export const ManySizesDraggable = {
121
+ export const ManySizesDraggable: Story = {
119
122
  render: ({ ...args }) => {
120
123
  const [items, setItems] = useState(
121
124
  [...Array(12)].map((_, index) => ({
@@ -163,7 +166,7 @@ export const ManySizesDraggable = {
163
166
  args: {},
164
167
  };
165
168
 
166
- export const Collapsible = {
169
+ export const Collapsible: Story = {
167
170
  render: ({ ...args }) => {
168
171
  const [items, _setItems] = useState(
169
172
  [...Array(12)].map((_, index) => ({
@@ -192,11 +195,10 @@ export const Collapsible = {
192
195
  },
193
196
  args: {
194
197
  variant: 'unordered',
195
- // toggleOpenLabel: 'Open/close storybook list item', // TODO(burdon): ???
196
198
  },
197
199
  };
198
200
 
199
- export const SelectableListbox = {
201
+ export const SelectableListbox: Story = {
200
202
  render: () => {
201
203
  const [selectedId, setSelectedId] = useState<string>();
202
204
  const arrowNavigationAttrs = useArrowNavigationGroup({ axis: 'vertical' });
@@ -223,11 +225,11 @@ export const SelectableListbox = {
223
225
  key={id}
224
226
  tabIndex={0}
225
227
  selected={selectedId === id}
226
- classNames={mx('items-center', ghostHover, ghostSelected, ghostSelectedTrackingInterFromNormal)}
228
+ classNames={mx(ghostHover, ghostSelected, ghostSelectedTrackingInterFromNormal)}
227
229
  onClick={() => setSelectedId(id)}
228
230
  onKeyUp={(event) => handleKeyUp(event, id)}
229
231
  >
230
- <ListItem.Heading classNames='grow'>Lorem ipsum dolor sit amet</ListItem.Heading>
232
+ <ListItem.Heading classNames='flex pis-1 pie-1 items-center grow truncate'>{text}</ListItem.Heading>
231
233
  </ListItem.Root>
232
234
  ))}
233
235
  </List>
@@ -3,34 +3,35 @@
3
3
  //
4
4
 
5
5
  import { Slot } from '@radix-ui/react-slot';
6
- import React, { type ComponentPropsWithoutRef, type FC, forwardRef, type ForwardRefExoticComponent } from 'react';
6
+ import React, { type ComponentPropsWithoutRef, type FC, type ForwardRefExoticComponent, forwardRef } from 'react';
7
7
 
8
8
  import {
9
+ LIST_ITEM_NAME,
10
+ LIST_NAME,
11
+ ListItemCollapsibleContent,
12
+ type ListItemCollapsibleContentProps,
13
+ type ListItemScopedProps,
9
14
  List as ListPrimitive,
10
- type ListProps as ListPrimitiveProps,
11
- type ListScopedProps,
15
+ ListItem as ListPrimitiveItem,
12
16
  ListItemHeading as ListPrimitiveItemHeading,
13
17
  type ListItemHeadingProps as ListPrimitiveItemHeadingProps,
14
18
  ListItemOpenTrigger as ListPrimitiveItemOpenTrigger,
15
19
  type ListItemOpenTriggerProps as ListPrimitiveItemOpenTriggerProps,
16
- ListItemCollapsibleContent,
17
- type ListItemCollapsibleContentProps,
18
- ListItem as ListPrimitiveItem,
19
20
  type ListItemProps as ListPrimitiveItemProps,
20
- type ListItemScopedProps,
21
- LIST_NAME,
22
- LIST_ITEM_NAME,
21
+ type ListProps as ListPrimitiveProps,
22
+ type ListScopedProps,
23
23
  useListContext,
24
24
  useListItemContext,
25
25
  } from '@dxos/react-list';
26
26
  import { type Density } from '@dxos/react-ui-types';
27
27
 
28
- import { ListDropIndicator } from './ListDropIndicator';
29
28
  import { useDensityContext, useThemeContext } from '../../hooks';
30
29
  import { type ThemedClassName } from '../../util';
31
30
  import { DensityProvider } from '../DensityProvider';
32
31
  import { Icon } from '../Icon';
33
32
 
33
+ import { ListDropIndicator } from './ListDropIndicator';
34
+
34
35
  type ListProps = ThemedClassName<ListPrimitiveProps> & { density?: Density };
35
36
 
36
37
  const List = forwardRef<HTMLOListElement, ListProps>(({ classNames, children, ...props }, forwardedRef) => {
@@ -106,7 +107,6 @@ const ListItemOpenTrigger = forwardRef<HTMLButtonElement, ListItemOpenTriggerPro
106
107
  const { tx } = useThemeContext();
107
108
  const density = useDensityContext();
108
109
  const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
109
- const iconName = open ? 'ph--caret-down--bold' : 'ph--caret-right--bold';
110
110
  return (
111
111
  <ListPrimitiveItemOpenTrigger
112
112
  {...props}
@@ -114,7 +114,11 @@ const ListItemOpenTrigger = forwardRef<HTMLButtonElement, ListItemOpenTriggerPro
114
114
  ref={forwardedRef}
115
115
  >
116
116
  {children || (
117
- <Icon icon={iconName} classNames={tx('list.item.openTriggerIcon', 'list__listItem__openTrigger__icon', {})} />
117
+ <Icon
118
+ size={3}
119
+ icon={open ? 'ph--caret-down--bold' : 'ph--caret-right--bold'}
120
+ classNames={tx('list.item.openTriggerIcon', 'list__listItem__openTrigger__icon', {})}
121
+ />
118
122
  )}
119
123
  </ListPrimitiveItemOpenTrigger>
120
124
  );
@@ -2,13 +2,13 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
6
  import React from 'react';
8
7
 
9
- import { Tree, TreeItem } from './Tree';
10
8
  import { withTheme } from '../../testing';
11
9
 
10
+ import { Tree, TreeItem } from './Tree';
11
+
12
12
  type StorybookTreeProps = {
13
13
  data: any;
14
14
  };
@@ -55,15 +55,18 @@ const DefaultStory = ({ data }: StorybookTreeProps) => {
55
55
  return <StorybookTreeItem data={data} />;
56
56
  };
57
57
 
58
- export default {
58
+ const meta = {
59
59
  title: 'ui/react-ui-core/Tree',
60
- component: Tree,
60
+ component: Tree as any,
61
61
  render: DefaultStory,
62
62
  decorators: [withTheme],
63
- parameters: { chromatic: { disableSnapshot: false } },
64
- };
63
+ } satisfies Meta<typeof DefaultStory>;
64
+
65
+ export default meta;
66
+
67
+ type Story = StoryObj<typeof meta>;
65
68
 
66
- export const Default = {
69
+ export const Default: Story = {
67
70
  args: {
68
71
  data: {
69
72
  foo: 100,
@@ -2,9 +2,12 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { type ComponentPropsWithoutRef, type FC, forwardRef, type ForwardRefExoticComponent } from 'react';
5
+ import React, { type ComponentPropsWithoutRef, type FC, type ForwardRefExoticComponent, forwardRef } from 'react';
6
+
7
+ import { type ThemedClassName } from '../../util';
6
8
 
7
9
  import {
10
+ LIST_ITEM_NAME,
8
11
  List,
9
12
  ListItem,
10
13
  type ListItemCollapsibleContentProps,
@@ -13,11 +16,9 @@ import {
13
16
  type ListItemRootProps,
14
17
  type ListProps,
15
18
  type ListScopedProps,
16
- LIST_ITEM_NAME,
17
19
  useListItemContext,
18
20
  } from './List';
19
21
  import { TreeDropIndicator } from './TreeDropIndicator';
20
- import { type ThemedClassName } from '../../util';
21
22
 
22
23
  type TreeRootProps = ListProps;
23
24
 
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type Instruction } from '@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item';
6
- import React, { type HTMLAttributes, type CSSProperties } from 'react';
6
+ import React, { type CSSProperties, type HTMLAttributes } from 'react';
7
7
 
8
8
  // Tree item hitbox
9
9
  // https://github.com/atlassian/pragmatic-drag-and-drop/blob/main/packages/hitbox/constellation/index/about.mdx#tree-item
@@ -2,14 +2,16 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
5
6
  import React from 'react';
6
7
 
7
8
  import { faker } from '@dxos/random';
8
9
 
9
- import { Treegrid } from './Treegrid';
10
10
  import { withTheme } from '../../testing';
11
11
  import { Icon } from '../Icon';
12
12
 
13
+ import { Treegrid } from './Treegrid';
14
+
13
15
  faker.seed(1234);
14
16
 
15
17
  type StorybookNode = {
@@ -86,7 +88,7 @@ const content = {
86
88
  icon: 'ph--planet--regular',
87
89
  },
88
90
  ],
89
- } satisfies StorybookNode;
91
+ } as StorybookNode;
90
92
 
91
93
  function* visitor(node: StorybookNode, isOpen?: (node: StorybookNode) => boolean): Generator<StorybookIteratorNode> {
92
94
  const stack: StorybookIteratorNode[] = [
@@ -141,11 +143,15 @@ const DefaultStory = () => {
141
143
  );
142
144
  };
143
145
 
144
- export default {
146
+ const meta = {
145
147
  title: 'ui/react-ui-core/Treegrid',
146
- component: Treegrid.Root,
148
+ component: Treegrid.Root as any,
147
149
  render: DefaultStory,
148
150
  decorators: [withTheme],
149
- };
151
+ } satisfies Meta<typeof DefaultStory>;
152
+
153
+ export default meta;
154
+
155
+ type Story = StoryObj<typeof meta>;
150
156
 
151
- export const Default = {};
157
+ export const Default: Story = {};
@@ -3,11 +3,11 @@
3
3
  //
4
4
 
5
5
  import { useArrowNavigationGroup, useFocusableGroup } from '@fluentui/react-tabster';
6
- import { createContextScope, type Scope } from '@radix-ui/react-context';
6
+ import { type Scope, createContextScope } from '@radix-ui/react-context';
7
7
  import { Primitive } from '@radix-ui/react-primitive';
8
8
  import { Slot } from '@radix-ui/react-slot';
9
9
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
10
- import React, { type ComponentPropsWithRef, type CSSProperties, forwardRef } from 'react';
10
+ import React, { type CSSProperties, type ComponentPropsWithRef, forwardRef } from 'react';
11
11
 
12
12
  import { useThemeContext } from '../../hooks';
13
13
  import { type ThemedClassName } from '../../util';
@@ -2,14 +2,14 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
6
  import React from 'react';
8
7
 
9
- import { Main, useSidebars } from './Main';
10
8
  import { withTheme } from '../../testing';
11
9
  import { Button } from '../Buttons';
12
10
 
11
+ import { Main, useSidebars } from './Main';
12
+
13
13
  type StoryMainArgs = {};
14
14
 
15
15
  const NavigationSidebarToggle = () => {
@@ -45,15 +45,23 @@ const DefaultStory = (_args: StoryMainArgs) => {
45
45
  );
46
46
  };
47
47
 
48
- export default {
48
+ const meta = {
49
49
  title: 'ui/react-ui-core/Main',
50
50
  component: Main.Root,
51
51
  render: DefaultStory,
52
52
  decorators: [withTheme],
53
- parameters: { chromatic: { disableSnapshot: false } },
54
- };
53
+ parameters: {
54
+ layout: 'fullscreen',
55
+ chromatic: {
56
+ disableSnapshot: false,
57
+ },
58
+ },
59
+ } satisfies Meta<typeof DefaultStory>;
60
+
61
+ export default meta;
62
+
63
+ type Story = StoryObj<typeof meta>;
55
64
 
56
- export const Default = {
65
+ export const Default: Story = {
57
66
  args: {},
58
- layout: 'fullscreen',
59
67
  };