@dxos/react-ui 0.8.4-main.84f28bd → 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 (198) hide show
  1. package/dist/lib/browser/{chunk-T6YPS45E.mjs → chunk-LBCJC75U.mjs} +186 -103
  2. package/dist/lib/browser/chunk-LBCJC75U.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +5 -1
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +21 -22
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/{chunk-TYVQJ4KW.mjs → chunk-QTUGGUCB.mjs} +186 -103
  9. package/dist/lib/node-esm/chunk-QTUGGUCB.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +5 -1
  11. package/dist/lib/node-esm/index.mjs.map +1 -1
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +21 -22
  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/playground/Controls.stories.d.ts +5 -9
  121. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  122. package/dist/types/src/playground/Custom.stories.d.ts +12 -4
  123. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  124. package/dist/types/src/playground/Typography.stories.d.ts +5 -11
  125. package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
  126. package/dist/types/src/testing/decorators/withTheme.d.ts +3 -0
  127. package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
  128. package/dist/types/src/util/domino.d.ts +18 -0
  129. package/dist/types/src/util/domino.d.ts.map +1 -0
  130. package/dist/types/src/util/index.d.ts +2 -1
  131. package/dist/types/src/util/index.d.ts.map +1 -1
  132. package/dist/types/tsconfig.tsbuildinfo +1 -1
  133. package/package.json +22 -22
  134. package/src/components/Avatars/Avatar.stories.tsx +19 -10
  135. package/src/components/Avatars/Avatar.tsx +3 -3
  136. package/src/components/Avatars/AvatarGroup.stories.tsx +10 -6
  137. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +16 -11
  138. package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
  139. package/src/components/Buttons/Button.stories.tsx +10 -11
  140. package/src/components/Buttons/IconButton.stories.tsx +11 -8
  141. package/src/components/Buttons/IconButton.tsx +4 -3
  142. package/src/components/Buttons/Toggle.stories.tsx +12 -9
  143. package/src/components/Buttons/ToggleGroup.stories.tsx +13 -10
  144. package/src/components/Buttons/ToggleGroup.tsx +17 -4
  145. package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
  146. package/src/components/Clipboard/CopyButton.tsx +3 -2
  147. package/src/components/DensityProvider/DensityProvider.tsx +1 -1
  148. package/src/components/Dialogs/AlertDialog.stories.tsx +14 -11
  149. package/src/components/Dialogs/AlertDialog.tsx +13 -13
  150. package/src/components/Dialogs/Dialog.stories.tsx +16 -14
  151. package/src/components/Dialogs/Dialog.tsx +13 -13
  152. package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
  153. package/src/components/Input/Input.stories.tsx +12 -14
  154. package/src/components/Input/Input.tsx +16 -16
  155. package/src/components/Link/Link.stories.tsx +10 -6
  156. package/src/components/Lists/List.stories.tsx +22 -20
  157. package/src/components/Lists/List.tsx +15 -16
  158. package/src/components/Lists/Tree.stories.tsx +11 -8
  159. package/src/components/Lists/Tree.tsx +4 -3
  160. package/src/components/Lists/TreeDropIndicator.tsx +1 -1
  161. package/src/components/Lists/Treegrid.stories.tsx +12 -6
  162. package/src/components/Lists/Treegrid.tsx +2 -2
  163. package/src/components/Main/Main.stories.tsx +16 -8
  164. package/src/components/Main/Main.tsx +16 -10
  165. package/src/components/Menus/ContextMenu.stories.tsx +11 -8
  166. package/src/components/Menus/ContextMenu.tsx +1 -0
  167. package/src/components/Menus/DropdownMenu.stories.tsx +11 -8
  168. package/src/components/Menus/DropdownMenu.tsx +23 -13
  169. package/src/components/Message/Message.stories.tsx +11 -7
  170. package/src/components/Message/Message.tsx +1 -1
  171. package/src/components/Popover/Popover.stories.tsx +11 -8
  172. package/src/components/Popover/Popover.tsx +9 -9
  173. package/src/components/ScrollArea/ScrollArea.stories.tsx +11 -8
  174. package/src/components/ScrollArea/ScrollArea.tsx +4 -4
  175. package/src/components/Select/Select.stories.tsx +15 -12
  176. package/src/components/Select/Select.tsx +5 -5
  177. package/src/components/Status/Status.stories.tsx +9 -6
  178. package/src/components/Tag/Tag.stories.tsx +18 -9
  179. package/src/components/ThemeProvider/ThemeProvider.tsx +3 -2
  180. package/src/components/ThemeProvider/TranslationsProvider.tsx +3 -3
  181. package/src/components/Toast/Toast.stories.tsx +11 -8
  182. package/src/components/Toast/Toast.tsx +9 -9
  183. package/src/components/Toolbar/Toolbar.stories.tsx +20 -16
  184. package/src/components/Toolbar/Toolbar.tsx +3 -2
  185. package/src/components/Tooltip/Tooltip.stories.tsx +15 -11
  186. package/src/components/Tooltip/Tooltip.tsx +5 -4
  187. package/src/hooks/useSafeArea.ts +1 -0
  188. package/src/hooks/useSafeCollisionPadding.ts +1 -1
  189. package/src/hooks/useVisualViewport.ts +3 -3
  190. package/src/playground/Controls.stories.tsx +20 -17
  191. package/src/playground/Custom.stories.tsx +7 -16
  192. package/src/playground/Typography.stories.tsx +8 -6
  193. package/src/testing/decorators/withTheme.tsx +31 -0
  194. package/src/util/domino.ts +51 -0
  195. package/src/util/index.ts +2 -1
  196. package/dist/lib/browser/chunk-T6YPS45E.mjs.map +0 -7
  197. package/dist/lib/node-esm/chunk-TYVQJ4KW.mjs.map +0 -7
  198. package/src/testing/decorators/withTheme.ts +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui",
3
- "version": "0.8.4-main.84f28bd",
3
+ "version": "0.8.4-main.a4bbb77",
4
4
  "description": "Low-level React components for DXOS, applying a theme to a core group of primitives",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,11 +10,13 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
13
14
  "types": "./dist/types/src/index.d.ts",
14
15
  "browser": "./dist/lib/browser/index.mjs",
15
16
  "node": "./dist/lib/node-esm/index.mjs"
16
17
  },
17
18
  "./testing": {
19
+ "source": "./src/testing/index.ts",
18
20
  "types": "./dist/types/src/testing/index.d.ts",
19
21
  "browser": "./dist/lib/browser/testing/index.mjs",
20
22
  "node": "./dist/lib/node-esm/testing/index.mjs"
@@ -72,34 +74,32 @@
72
74
  "keyborg": "^2.5.0",
73
75
  "react-i18next": "^11.18.6",
74
76
  "react-remove-scroll": "^2.6.0",
75
- "@dxos/debug": "0.8.4-main.84f28bd",
76
- "@dxos/lit-ui": "0.8.4-main.84f28bd",
77
- "@dxos/log": "0.8.4-main.84f28bd",
78
- "@dxos/react-hooks": "0.8.4-main.84f28bd",
79
- "@dxos/react-input": "0.8.4-main.84f28bd",
80
- "@dxos/react-list": "0.8.4-main.84f28bd",
81
- "@dxos/react-ui-types": "0.8.4-main.84f28bd",
82
- "@dxos/util": "0.8.4-main.84f28bd"
77
+ "@dxos/debug": "0.8.4-main.a4bbb77",
78
+ "@dxos/lit-ui": "0.8.4-main.a4bbb77",
79
+ "@dxos/log": "0.8.4-main.a4bbb77",
80
+ "@dxos/react-hooks": "0.8.4-main.a4bbb77",
81
+ "@dxos/react-input": "0.8.4-main.a4bbb77",
82
+ "@dxos/react-list": "0.8.4-main.a4bbb77",
83
+ "@dxos/react-ui-types": "0.8.4-main.a4bbb77",
84
+ "@dxos/util": "0.8.4-main.a4bbb77"
83
85
  },
84
86
  "devDependencies": {
85
87
  "@dnd-kit/core": "^6.0.5",
86
88
  "@dnd-kit/sortable": "^7.0.1",
87
89
  "@dnd-kit/utilities": "^3.2.0",
88
- "@phosphor-icons/react": "^2.1.5",
89
- "@types/react": "~18.2.0",
90
- "@types/react-dom": "~18.2.0",
91
- "react": "~18.2.0",
92
- "react-dom": "~18.2.0",
93
- "vite": "5.4.7",
94
- "@dxos/random": "0.8.4-main.84f28bd",
95
- "@dxos/react-ui-theme": "0.8.4-main.84f28bd",
96
- "@dxos/util": "0.8.4-main.84f28bd"
90
+ "@types/react": "~19.2.0",
91
+ "@types/react-dom": "~19.2.0",
92
+ "react": "~19.2.0",
93
+ "react-dom": "~19.2.0",
94
+ "vite": "7.1.9",
95
+ "@dxos/random": "0.8.4-main.a4bbb77",
96
+ "@dxos/react-ui-theme": "0.8.4-main.a4bbb77",
97
+ "@dxos/util": "0.8.4-main.a4bbb77"
97
98
  },
98
99
  "peerDependencies": {
99
- "@phosphor-icons/react": "^2.1.5",
100
- "react": "~18.2.0",
101
- "react-dom": "~18.2.0",
102
- "@dxos/react-ui-theme": "0.8.4-main.84f28bd"
100
+ "react": "^19.0.0",
101
+ "react-dom": "^19.0.0",
102
+ "@dxos/react-ui-theme": "0.8.4-main.a4bbb77"
103
103
  },
104
104
  "publishConfig": {
105
105
  "access": "public"
@@ -2,17 +2,18 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
5
+ import { type Meta } from '@storybook/react-vite';
6
6
  import React, { type PropsWithChildren } from 'react';
7
7
 
8
8
  import { type HuePalette } from '@dxos/react-ui-theme';
9
9
  import { type Size } from '@dxos/react-ui-types';
10
10
  import { hexToFallback } from '@dxos/util';
11
11
 
12
- import { Avatar, type AvatarVariant, type AvatarStatus, type AvatarAnimation } from './Avatar';
13
12
  import { withTheme } from '../../testing';
14
13
 
15
- type StoryProps = {
14
+ import { Avatar, type AvatarAnimation, type AvatarStatus, type AvatarVariant } from './Avatar';
15
+
16
+ type StoryProps = PropsWithChildren<{
16
17
  id?: string;
17
18
  imgSrc?: string;
18
19
  fallbackText?: string;
@@ -23,9 +24,9 @@ type StoryProps = {
23
24
  animation?: AvatarAnimation;
24
25
  size?: Size;
25
26
  hue?: HuePalette;
26
- };
27
+ }>;
27
28
 
28
- const DefaultStory = (props: PropsWithChildren<StoryProps>) => {
29
+ const DefaultStory = (props: StoryProps) => {
29
30
  const {
30
31
  id = '20970b563fc49b5bb194a6ffdff376031a3a11f9481360c071c3fed87874106b',
31
32
  status,
@@ -55,17 +56,19 @@ const DefaultStory = (props: PropsWithChildren<StoryProps>) => {
55
56
  );
56
57
  };
57
58
 
58
- export default {
59
+ const meta = {
59
60
  title: 'ui/react-ui-core/Avatar',
60
- component: Avatar,
61
- render: DefaultStory,
61
+ component: Avatar.Root,
62
62
  decorators: [withTheme],
63
- parameters: { chromatic: { disableSnapshot: false } },
64
- };
63
+ } satisfies Meta<typeof Avatar.Root>;
64
+
65
+ export default meta;
65
66
 
66
67
  const sampleImage =
67
68
  'https://png.pngtree.com/thumb_back/fh260/background/20230614/pngtree-the-photo-of-a-woman-with-red-sunglasses-is-surrounded-by-image_2931163.jpg';
68
69
 
70
+ const brokenImage = 'https://png.pngtree.com/potato_squirrel.png';
71
+
69
72
  const row = (size: Size) => (
70
73
  <>
71
74
  <DefaultStory size={size} status='inactive' description='Offline' />
@@ -97,6 +100,12 @@ export const Image = () => (
97
100
  </div>
98
101
  );
99
102
 
103
+ export const BrokenImage = () => (
104
+ <div>
105
+ <DefaultStory variant='circle' imgSrc={brokenImage} />
106
+ </div>
107
+ );
108
+
100
109
  export const Square = () => (
101
110
  <div className='flex flex-row gap-4'>
102
111
  <DefaultStory variant='square' status='inactive' description='Offline' />
@@ -7,12 +7,12 @@ import '@dxos/lit-ui/dx-avatar.pcss';
7
7
  import { createContext } from '@radix-ui/react-context';
8
8
  import { Primitive } from '@radix-ui/react-primitive';
9
9
  import { Slot } from '@radix-ui/react-slot';
10
- import React, { type ComponentProps, type ComponentPropsWithRef, forwardRef, type PropsWithChildren } from 'react';
10
+ import React, { type ComponentProps, type ComponentPropsWithRef, type PropsWithChildren, forwardRef } from 'react';
11
11
 
12
12
  import {
13
- type AvatarVariant,
14
- type AvatarStatus,
15
13
  type AvatarAnimation,
14
+ type AvatarStatus,
15
+ type AvatarVariant,
16
16
  type DxAvatar as NaturalDxAvatar,
17
17
  } from '@dxos/lit-ui';
18
18
  import { DxAvatar } from '@dxos/lit-ui/react';
@@ -2,15 +2,16 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React from 'react';
7
7
 
8
8
  import { useId } from '@dxos/react-hooks';
9
9
  import { toEmoji } from '@dxos/util';
10
10
 
11
- import { Avatar } from './Avatar';
12
11
  import { withTheme } from '../../testing';
13
12
 
13
+ import { Avatar } from './Avatar';
14
+
14
15
  const hues = ['lime', 'teal', 'purple', 'pink'];
15
16
 
16
17
  const AvatarItem = ({ n }: { n: number }) => {
@@ -36,13 +37,16 @@ const DefaultStory = () => {
36
37
  );
37
38
  };
38
39
 
39
- export default {
40
+ const meta = {
40
41
  title: 'ui/react-ui-core/AvatarGroup',
41
42
  render: DefaultStory,
42
43
  decorators: [withTheme],
43
- parameters: { chromatic: { disableSnapshot: false } },
44
- };
44
+ } satisfies Meta<typeof DefaultStory>;
45
+
46
+ export default meta;
47
+
48
+ type Story = StoryObj<typeof meta>;
45
49
 
46
- export const Default = {
50
+ export const Default: Story = {
47
51
  args: {},
48
52
  };
@@ -2,17 +2,17 @@
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 { Breadcrumb } from './Breadcrumb';
10
8
  import { withTheme } from '../../testing';
11
9
  import { Button } from '../Buttons';
12
10
 
13
- const DefaultStory = () => {
11
+ import { Breadcrumb, type BreadcrumbRootProps } from './Breadcrumb';
12
+
13
+ const DefaultStory = (props: BreadcrumbRootProps) => {
14
14
  return (
15
- <Breadcrumb.Root aria-label='Breadcrumb'>
15
+ <Breadcrumb.Root {...props}>
16
16
  <Breadcrumb.List>
17
17
  <Breadcrumb.ListItem>
18
18
  <Breadcrumb.Link asChild>
@@ -38,14 +38,19 @@ const DefaultStory = () => {
38
38
  );
39
39
  };
40
40
 
41
- export default {
41
+ const meta = {
42
42
  title: 'ui/react-ui-core/Breadcrumb',
43
- component: Breadcrumb,
43
+ component: Breadcrumb.Root as any,
44
44
  render: DefaultStory,
45
45
  decorators: [withTheme],
46
- parameters: { chromatic: { disableSnapshot: false } },
47
- };
46
+ } satisfies Meta<typeof DefaultStory>;
47
+
48
+ export default meta;
49
+
50
+ type Story = StoryObj<typeof meta>;
48
51
 
49
- export const Default = {
50
- args: {},
52
+ export const Default: Story = {
53
+ args: {
54
+ 'aria-label': 'Breadcrumb',
55
+ },
51
56
  };
@@ -2,13 +2,13 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Dot } from '@phosphor-icons/react';
6
5
  import { Primitive } from '@radix-ui/react-primitive';
7
6
  import { Slot } from '@radix-ui/react-slot';
8
- import React, { type ComponentPropsWithoutRef, type ComponentPropsWithRef, forwardRef } from 'react';
7
+ import React, { type ComponentPropsWithRef, type ComponentPropsWithoutRef, forwardRef } from 'react';
9
8
 
10
9
  import { useThemeContext } from '../../hooks';
11
10
  import { type ThemedClassName } from '../../util';
11
+ import { Icon } from '../Icon';
12
12
  import { Link, type LinkProps } from '../Link';
13
13
 
14
14
  type BreadcrumbRootProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div>> & {
@@ -100,7 +100,7 @@ const BreadcrumbSeparator = ({ children, classNames, ...props }: BreadcrumbSepar
100
100
  {...props}
101
101
  className={tx('breadcrumb.separator', 'breadcrumb__separator', {}, classNames)}
102
102
  >
103
- {children ?? <Dot weight='bold' />}
103
+ {children ?? <Icon icon='ph--dot--bold' />}
104
104
  </Primitive.span>
105
105
  );
106
106
  };
@@ -2,14 +2,14 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { CaretLeft, CaretRight } from '@phosphor-icons/react';
8
- import { type StoryObj, type Meta } from '@storybook/react-vite';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
9
6
  import React from 'react';
10
7
 
8
+ import { withTheme } from '../../testing';
9
+ import { withSurfaceVariantsLayout } from '../../testing';
10
+ import { Icon } from '../Icon';
11
+
11
12
  import { Button, ButtonGroup, type ButtonProps } from './Button';
12
- import { withSurfaceVariantsLayout, withTheme } from '../../testing';
13
13
 
14
14
  const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
15
15
  return (
@@ -21,10 +21,10 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
21
21
  {(args.variant === 'default' || args.variant === 'primary') && (
22
22
  <ButtonGroup>
23
23
  <Button {...args}>
24
- <CaretLeft />
24
+ <Icon icon='ph--caret-left--regular' />
25
25
  </Button>
26
26
  <Button {...args}>
27
- <CaretRight />
27
+ <Icon icon='ph--caret-right--regular' />
28
28
  </Button>
29
29
  </ButtonGroup>
30
30
  )}
@@ -32,13 +32,12 @@ const DefaultStory = ({ children, ...args }: Omit<ButtonProps, 'ref'>) => {
32
32
  );
33
33
  };
34
34
 
35
- const meta: Meta<typeof Button> = {
35
+ const meta = {
36
36
  title: 'ui/react-ui-core/Button',
37
37
  component: Button,
38
38
  render: DefaultStory,
39
- decorators: [withSurfaceVariantsLayout(), withTheme],
40
- parameters: { chromatic: { disableSnapshot: false } },
41
- };
39
+ decorators: [withTheme, withSurfaceVariantsLayout()],
40
+ } satisfies Meta<typeof Button>;
42
41
 
43
42
  export default meta;
44
43
 
@@ -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 { IconButton, type IconButtonProps } from './IconButton';
10
8
  import { withTheme } from '../../testing';
11
9
  import { Tooltip } from '../Tooltip';
12
10
 
11
+ import { IconButton, type IconButtonProps } from './IconButton';
12
+
13
13
  const DefaultStory = (props: IconButtonProps) => {
14
14
  return (
15
15
  <Tooltip.Provider>
@@ -23,15 +23,18 @@ const DefaultStory = (props: IconButtonProps) => {
23
23
  );
24
24
  };
25
25
 
26
- export default {
26
+ const meta = {
27
27
  title: 'ui/react-ui-core/IconButton',
28
28
  component: IconButton,
29
- render: DefaultStory,
29
+ render: DefaultStory as any,
30
30
  decorators: [withTheme],
31
- parameters: { chromatic: { disableSnapshot: false } },
32
- };
31
+ } satisfies Meta<typeof IconButton>;
32
+
33
+ export default meta;
34
+
35
+ type Story = StoryObj<typeof meta>;
33
36
 
34
- export const Default = {
37
+ export const Default: Story = {
35
38
  args: {
36
39
  label: 'Bold',
37
40
  icon: 'ph--text-b--regular',
@@ -4,14 +4,15 @@
4
4
 
5
5
  import React, { forwardRef } from 'react';
6
6
 
7
- import { Button, type ButtonProps } from './Button';
8
7
  import { useThemeContext } from '../../hooks';
9
8
  import { type ThemedClassName } from '../../util';
10
9
  import { Icon, type IconProps } from '../Icon';
11
10
  import { Tooltip, type TooltipSide } from '../Tooltip';
12
11
 
12
+ import { Button, type ButtonProps } from './Button';
13
+
13
14
  type IconButtonProps = Omit<ButtonProps, 'children'> &
14
- Pick<IconProps, 'icon' | 'size'> & {
15
+ Partial<Pick<IconProps, 'icon' | 'size'>> & {
15
16
  label: string;
16
17
  iconOnly?: boolean;
17
18
  noTooltip?: boolean;
@@ -39,7 +40,7 @@ const LabelledIconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
39
40
  const { tx } = useThemeContext();
40
41
  return (
41
42
  <Button {...props} classNames={tx('iconButton.root', 'iconButton', { iconOnly }, classNames)} ref={forwardedRef}>
42
- <Icon icon={icon} size={size} classNames={iconClassNames} />
43
+ {icon && <Icon icon={icon} size={size} classNames={iconClassNames} />}
43
44
  <span className={iconOnly ? 'sr-only' : undefined}>{label}</span>
44
45
  {caretDown && <Icon size={3} icon='ph--caret-down--bold' />}
45
46
  </Button>
@@ -2,32 +2,35 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { TextB } from '@phosphor-icons/react';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
10
- import { Toggle } from './Toggle';
11
8
  import { withTheme } from '../../testing';
9
+ import { Icon } from '../Icon';
10
+
11
+ import { Toggle } from './Toggle';
12
12
 
13
13
  type StorybookToggleProps = {};
14
14
 
15
15
  const DefaultStory = (props: StorybookToggleProps) => {
16
16
  return (
17
17
  <Toggle {...props}>
18
- <TextB />
18
+ <Icon icon='ph--text-b--regular' />
19
19
  </Toggle>
20
20
  );
21
21
  };
22
22
 
23
- export default {
23
+ const meta = {
24
24
  title: 'ui/react-ui-core/Toggle',
25
25
  component: Toggle,
26
26
  render: DefaultStory,
27
27
  decorators: [withTheme],
28
- parameters: { chromatic: { disableSnapshot: false } },
29
- };
28
+ } satisfies Meta<typeof Toggle>;
29
+
30
+ export default meta;
31
+
32
+ type Story = StoryObj<typeof meta>;
30
33
 
31
- export const Default = {
34
+ export const Default: Story = {
32
35
  args: {},
33
36
  };
@@ -2,37 +2,40 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { TextB, TextItalic } from '@phosphor-icons/react';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
10
- import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
11
8
  import { withTheme } from '../../testing';
9
+ import { Icon } from '../Icon';
10
+
11
+ import { ToggleGroup, ToggleGroupItem, type ToggleGroupProps } from './ToggleGroup';
12
12
 
13
13
  // TODO(burdon): Create Radix-style Root, Item, etc?
14
14
  const DefaultStory = (props: ToggleGroupProps) => {
15
15
  return (
16
16
  <ToggleGroup {...props}>
17
17
  <ToggleGroupItem value='textb'>
18
- <TextB />
18
+ <Icon icon='ph--text-b--regular' />
19
19
  </ToggleGroupItem>
20
20
  <ToggleGroupItem value='texti'>
21
- <TextItalic />
21
+ <Icon icon='ph--text-italic--regular' />
22
22
  </ToggleGroupItem>
23
23
  </ToggleGroup>
24
24
  );
25
25
  };
26
26
 
27
- export default {
27
+ const meta = {
28
28
  title: 'ui/react-ui-core/ToggleGroup',
29
29
  component: ToggleGroup,
30
30
  render: DefaultStory,
31
31
  decorators: [withTheme],
32
- parameters: { chromatic: { disableSnapshot: false } },
33
- };
32
+ } satisfies Meta<typeof ToggleGroup>;
33
+
34
+ export default meta;
35
+
36
+ type Story = StoryObj<typeof meta>;
34
37
 
35
- export const Default = {
38
+ export const Default: Story = {
36
39
  args: {
37
40
  type: 'single',
38
41
  },
@@ -3,15 +3,16 @@
3
3
  //
4
4
 
5
5
  import {
6
+ ToggleGroupItem as ToggleGroupItemPrimitive,
7
+ type ToggleGroupItemProps as ToggleGroupItemPrimitiveProps,
8
+ type ToggleGroupMultipleProps,
6
9
  ToggleGroup as ToggleGroupPrimitive,
7
10
  type ToggleGroupSingleProps,
8
- type ToggleGroupMultipleProps,
9
- type ToggleGroupItemProps as ToggleGroupItemPrimitiveProps,
10
- ToggleGroupItem as ToggleGroupItemPrimitive,
11
11
  } from '@radix-ui/react-toggle-group';
12
12
  import React, { forwardRef } from 'react';
13
13
 
14
14
  import { Button, ButtonGroup, type ButtonGroupProps, type ButtonProps } from './Button';
15
+ import { IconButton, type IconButtonProps } from './IconButton';
15
16
 
16
17
  type ToggleGroupProps = Omit<ToggleGroupSingleProps, 'className'> | Omit<ToggleGroupMultipleProps, 'className'>;
17
18
 
@@ -37,5 +38,17 @@ const ToggleGroupItem = forwardRef<HTMLButtonElement, ToggleGroupItemProps>(
37
38
  },
38
39
  );
39
40
 
40
- export { ToggleGroup, ToggleGroupItem };
41
+ type ToggleGroupIconItemProps = Omit<ToggleGroupItemPrimitiveProps, 'className'> & IconButtonProps;
42
+
43
+ const ToggleGroupIconItem = forwardRef<HTMLButtonElement, ToggleGroupIconItemProps>(
44
+ ({ variant, label, icon, size, elevation, density, classNames, ...props }, forwardedRef) => {
45
+ return (
46
+ <ToggleGroupItemPrimitive {...props} asChild>
47
+ <IconButton {...{ variant, elevation, density, classNames, label, icon, size }} ref={forwardedRef} />
48
+ </ToggleGroupItemPrimitive>
49
+ );
50
+ },
51
+ );
52
+
53
+ export { ToggleGroup, ToggleGroupItem, ToggleGroupIconItem };
41
54
  export type { ToggleGroupProps, ToggleGroupItemProps };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { createContext, type PropsWithChildren, useCallback, useContext, useState } from 'react';
5
+ import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
6
6
 
7
7
  export type ClipboardContextValue = {
8
8
  textValue: string;
@@ -6,12 +6,13 @@ import React from 'react';
6
6
 
7
7
  import { mx } from '@dxos/react-ui-theme';
8
8
 
9
- import { useClipboard } from './ClipboardProvider';
10
9
  import { Button, type ButtonProps, IconButton } from '../Buttons';
11
10
  import { Icon, type IconProps } from '../Icon';
12
11
  import { useTranslation } from '../ThemeProvider';
13
12
  import { type TooltipScopedProps, useTooltipContext } from '../Tooltip';
14
13
 
14
+ import { useClipboard } from './ClipboardProvider';
15
+
15
16
  export type CopyButtonProps = ButtonProps &
16
17
  Pick<IconProps, 'size'> & {
17
18
  value: string;
@@ -57,7 +58,7 @@ export const CopyButtonIconOnly = ({
57
58
  const { t } = useTranslation('os');
58
59
  const { textValue, setTextValue } = useClipboard();
59
60
  const isCopied = textValue === value;
60
- const label = isCopied ? t('copy success label') : props.label ?? t('copy label');
61
+ const label = isCopied ? t('copy success label') : (props.label ?? t('copy label'));
61
62
  const { onOpen } = useTooltipContext('CopyButton', __scopeTooltip);
62
63
  return (
63
64
  <IconButton
@@ -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 Density } from '@dxos/react-ui-types';
8
8
 
@@ -2,25 +2,25 @@
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 { AlertDialog } from './AlertDialog';
10
8
  import { withTheme } from '../../testing';
11
9
  import { Button } from '../Buttons';
12
10
  import { Toolbar } from '../Toolbar';
13
11
 
12
+ import { AlertDialog } from './AlertDialog';
13
+
14
14
  type StoryProps = Partial<{
15
15
  title: string;
16
16
  description: string;
17
17
  body: string;
18
+ openTrigger: string;
18
19
  cancelTrigger: string;
19
20
  actionTrigger: string;
20
- openTrigger: string;
21
21
  }>;
22
22
 
23
- const DefaultStory = ({ title, openTrigger, description, body, cancelTrigger, actionTrigger }: StoryProps) => {
23
+ const DefaultStory = ({ title, description, body, openTrigger, cancelTrigger, actionTrigger }: StoryProps) => {
24
24
  return (
25
25
  <AlertDialog.Root defaultOpen>
26
26
  <AlertDialog.Trigger asChild>
@@ -46,15 +46,18 @@ const DefaultStory = ({ title, openTrigger, description, body, cancelTrigger, ac
46
46
  );
47
47
  };
48
48
 
49
- export default {
49
+ const meta = {
50
50
  title: 'ui/react-ui-core/AlertDialog',
51
- component: AlertDialog,
52
- render: DefaultStory,
51
+ component: AlertDialog.Root as any,
52
+ render: DefaultStory as any,
53
53
  decorators: [withTheme],
54
- parameters: { chromatic: { disableSnapshot: false } },
55
- };
54
+ } satisfies Meta<typeof DefaultStory>;
55
+
56
+ export default meta;
57
+
58
+ type Story = StoryObj<typeof meta>;
56
59
 
57
- export const Default = {
60
+ export const Default: Story = {
58
61
  args: {
59
62
  title: 'AlertDialog title',
60
63
  openTrigger: 'Open AlertDialog',