@dxos/react-ui 0.8.3 → 0.8.4-main.1068cf700f

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 (382) hide show
  1. package/dist/lib/browser/chunk-6DTBPJE4.mjs +774 -0
  2. package/dist/lib/browser/chunk-6DTBPJE4.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +3203 -61
  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 +66 -50
  7. package/dist/lib/browser/testing/index.mjs.map +4 -4
  8. package/dist/lib/node-esm/chunk-JKHQSGNU.mjs +776 -0
  9. package/dist/lib/node-esm/chunk-JKHQSGNU.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +3203 -61
  11. package/dist/lib/node-esm/index.mjs.map +4 -4
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/testing/index.mjs +66 -50
  14. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  15. package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +7 -0
  16. package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +1 -1
  17. package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
  18. package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
  19. package/dist/types/src/components/Avatars/Avatar.stories.d.ts +5 -31
  20. package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
  21. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +5 -11
  22. package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
  23. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  24. package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  25. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +8 -20
  26. package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  27. package/dist/types/src/components/{Buttons → Button}/Button.d.ts +2 -2
  28. package/dist/types/src/components/Button/Button.d.ts.map +1 -0
  29. package/dist/types/src/components/Button/Button.stories.d.ts +17 -0
  30. package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
  31. package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +4 -4
  32. package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
  33. package/dist/types/src/components/Button/IconButton.stories.d.ts +13 -0
  34. package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -0
  35. package/dist/types/src/components/Button/Toggle.d.ts.map +1 -0
  36. package/dist/types/src/components/Button/Toggle.stories.d.ts +16 -0
  37. package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -0
  38. package/dist/types/src/components/Button/ToggleGroup.d.ts +27 -0
  39. package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
  40. package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +27 -0
  41. package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -0
  42. package/dist/types/src/components/Button/index.d.ts.map +1 -0
  43. package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
  44. package/dist/types/src/components/Clipboard/CopyButton.d.ts +5 -6
  45. package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
  46. package/dist/types/src/components/Clipboard/index.d.ts +2 -3
  47. package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
  48. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
  49. package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
  50. package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.d.ts +1 -1
  51. package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
  52. package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts +11 -0
  53. package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
  54. package/dist/types/src/components/Dialog/Dialog.d.ts +46 -0
  55. package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
  56. package/dist/types/src/components/Dialog/Dialog.stories.d.ts +27 -0
  57. package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
  58. package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
  59. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
  60. package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
  61. package/dist/types/src/components/Icon/Icon.d.ts +2 -2
  62. package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
  63. package/dist/types/src/components/Icon/Icon.stories.d.ts +17 -0
  64. package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
  65. package/dist/types/src/components/Input/Input.d.ts +6 -5
  66. package/dist/types/src/components/Input/Input.d.ts.map +1 -1
  67. package/dist/types/src/components/Input/Input.stories.d.ts +12 -13
  68. package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
  69. package/dist/types/src/components/Link/Link.stories.d.ts +8 -8
  70. package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
  71. package/dist/types/src/components/{Lists → List}/List.d.ts +3 -3
  72. package/dist/types/src/components/List/List.d.ts.map +1 -0
  73. package/dist/types/src/components/List/List.stories.d.ts +14 -0
  74. package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
  75. package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -0
  76. package/dist/types/src/components/{Lists → List}/Tree.d.ts +1 -1
  77. package/dist/types/src/components/List/Tree.d.ts.map +1 -0
  78. package/dist/types/src/components/List/Tree.stories.d.ts +15 -0
  79. package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
  80. package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -0
  81. package/dist/types/src/components/{Lists → List}/Treegrid.d.ts +1 -1
  82. package/dist/types/src/components/{Lists → List}/Treegrid.d.ts.map +1 -1
  83. package/dist/types/src/components/List/Treegrid.stories.d.ts +12 -0
  84. package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -0
  85. package/dist/types/src/components/List/index.d.ts.map +1 -0
  86. package/dist/types/src/components/Main/Main.d.ts +17 -27
  87. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  88. package/dist/types/src/components/Main/Main.stories.d.ts +6 -7
  89. package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
  90. package/dist/types/src/components/{Menus → Menu}/ContextMenu.d.ts +6 -6
  91. package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
  92. package/dist/types/src/components/Menu/ContextMenu.stories.d.ts +12 -0
  93. package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
  94. package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +8 -8
  95. package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
  96. package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +15 -0
  97. package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
  98. package/dist/types/src/components/Menu/index.d.ts.map +1 -0
  99. package/dist/types/src/components/Message/Message.d.ts +1 -1
  100. package/dist/types/src/components/Message/Message.d.ts.map +1 -1
  101. package/dist/types/src/components/Message/Message.stories.d.ts +8 -17
  102. package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/Popover/Popover.d.ts +4 -4
  104. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  105. package/dist/types/src/components/Popover/Popover.stories.d.ts +6 -34
  106. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
  107. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +25 -26
  108. package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  109. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +37 -25
  110. package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
  111. package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +39 -0
  112. package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -0
  113. package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +19 -0
  114. package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -0
  115. package/dist/types/src/components/ScrollContainer/index.d.ts +2 -0
  116. package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -0
  117. package/dist/types/src/components/Select/Select.d.ts +10 -10
  118. package/dist/types/src/components/Select/Select.d.ts.map +1 -1
  119. package/dist/types/src/components/Select/Select.stories.d.ts +5 -10
  120. package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
  121. package/dist/types/src/components/Separator/Separator.d.ts +1 -1
  122. package/dist/types/src/components/Skeleton/Skeleton.d.ts +12 -0
  123. package/dist/types/src/components/Skeleton/Skeleton.d.ts.map +1 -0
  124. package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts +17 -0
  125. package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -0
  126. package/dist/types/src/components/Skeleton/index.d.ts +2 -0
  127. package/dist/types/src/components/Skeleton/index.d.ts.map +1 -0
  128. package/dist/types/src/components/Splitter/Splitter.d.ts +26 -0
  129. package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -0
  130. package/dist/types/src/components/Splitter/Splitter.stories.d.ts +7 -0
  131. package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -0
  132. package/dist/types/src/components/Splitter/index.d.ts +2 -0
  133. package/dist/types/src/components/Splitter/index.d.ts.map +1 -0
  134. package/dist/types/src/components/Status/Status.stories.d.ts +2 -8
  135. package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
  136. package/dist/types/src/components/Tag/Tag.d.ts +1 -1
  137. package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
  138. package/dist/types/src/components/Tag/Tag.stories.d.ts +12 -12
  139. package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
  140. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +3 -3
  141. package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  142. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
  143. package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
  144. package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
  145. package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
  146. package/dist/types/src/components/Toast/Toast.d.ts +5 -5
  147. package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
  148. package/dist/types/src/components/Toast/Toast.stories.d.ts +6 -44
  149. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
  150. package/dist/types/src/components/Toolbar/Toolbar.d.ts +20 -19
  151. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  152. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +6 -50
  153. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  154. package/dist/types/src/components/Tooltip/Tooltip.d.ts +2 -4
  155. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  156. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +8 -61
  157. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  158. package/dist/types/src/components/index.d.ts +7 -4
  159. package/dist/types/src/components/index.d.ts.map +1 -1
  160. package/dist/types/src/exemplars/generics.stories.d.ts +17 -0
  161. package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -0
  162. package/dist/types/src/exemplars/slot.stories.d.ts +14 -0
  163. package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -0
  164. package/dist/types/src/exemplars/tabster.stories.d.ts +8 -0
  165. package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -0
  166. package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
  167. package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
  168. package/dist/types/src/hooks/useElevationContext.d.ts +1 -1
  169. package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
  170. package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
  171. package/dist/types/src/hooks/useVisualViewport.d.ts +2 -2
  172. package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
  173. package/dist/types/src/index.d.ts +3 -2
  174. package/dist/types/src/index.d.ts.map +1 -1
  175. package/dist/types/src/playground/Controls.stories.d.ts +5 -9
  176. package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
  177. package/dist/types/src/playground/Custom.stories.d.ts +12 -4
  178. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  179. package/dist/types/src/playground/Typography.stories.d.ts +5 -11
  180. package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
  181. package/dist/types/src/primitives/Container/Container.d.ts +23 -0
  182. package/dist/types/src/primitives/Container/Container.d.ts.map +1 -0
  183. package/dist/types/src/primitives/Container/Container.stories.d.ts +11 -0
  184. package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -0
  185. package/dist/types/src/primitives/Container/Layout.d.ts +18 -0
  186. package/dist/types/src/primitives/Container/Layout.d.ts.map +1 -0
  187. package/dist/types/src/primitives/Container/Layout.stories.d.ts +10 -0
  188. package/dist/types/src/primitives/Container/Layout.stories.d.ts.map +1 -0
  189. package/dist/types/src/primitives/Container/index.d.ts +3 -0
  190. package/dist/types/src/primitives/Container/index.d.ts.map +1 -0
  191. package/dist/types/src/primitives/Flex/Flex.d.ts +8 -0
  192. package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -0
  193. package/dist/types/src/primitives/Flex/index.d.ts +2 -0
  194. package/dist/types/src/primitives/Flex/index.d.ts.map +1 -0
  195. package/dist/types/src/primitives/index.d.ts +3 -0
  196. package/dist/types/src/primitives/index.d.ts.map +1 -0
  197. package/dist/types/src/testing/decorators/index.d.ts +2 -1
  198. package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
  199. package/dist/types/src/testing/decorators/withLayout.d.ts +15 -0
  200. package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -0
  201. package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +12 -0
  202. package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -0
  203. package/dist/types/src/testing/decorators/withTheme.d.ts +5 -1
  204. package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
  205. package/dist/types/src/util/index.d.ts +2 -1
  206. package/dist/types/src/util/index.d.ts.map +1 -1
  207. package/dist/types/src/util/usePx.d.ts +8 -0
  208. package/dist/types/src/util/usePx.d.ts.map +1 -0
  209. package/dist/types/tsconfig.tsbuildinfo +1 -1
  210. package/package.json +39 -31
  211. package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +10 -12
  212. package/src/components/Avatars/Avatar.stories.tsx +23 -14
  213. package/src/components/Avatars/Avatar.tsx +6 -13
  214. package/src/components/Avatars/AvatarGroup.stories.tsx +12 -8
  215. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +19 -14
  216. package/src/components/Breadcrumb/Breadcrumb.tsx +8 -34
  217. package/src/components/{Buttons → Button}/Button.stories.tsx +11 -12
  218. package/src/components/{Buttons → Button}/Button.tsx +3 -8
  219. package/src/components/{Buttons → Button}/IconButton.stories.tsx +13 -10
  220. package/src/components/{Buttons → Button}/IconButton.tsx +23 -16
  221. package/src/components/Button/Toggle.stories.tsx +37 -0
  222. package/src/components/{Buttons → Button}/ToggleGroup.stories.tsx +15 -12
  223. package/src/components/{Buttons → Button}/ToggleGroup.tsx +17 -4
  224. package/src/components/Clipboard/ClipboardProvider.tsx +1 -1
  225. package/src/components/Clipboard/CopyButton.tsx +17 -18
  226. package/src/components/DensityProvider/DensityProvider.tsx +2 -2
  227. package/src/components/{Dialogs → Dialog}/AlertDialog.stories.tsx +17 -14
  228. package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +16 -21
  229. package/src/components/Dialog/Dialog.stories.tsx +101 -0
  230. package/src/components/{Dialogs → Dialog}/Dialog.tsx +182 -57
  231. package/src/components/ElevationProvider/ElevationProvider.tsx +2 -2
  232. package/src/components/Icon/Icon.stories.tsx +113 -0
  233. package/src/components/Icon/Icon.tsx +3 -3
  234. package/src/components/Input/Input.stories.tsx +22 -23
  235. package/src/components/Input/Input.tsx +38 -44
  236. package/src/components/Link/Link.stories.tsx +12 -8
  237. package/src/components/Link/Link.tsx +1 -1
  238. package/src/components/{Lists → List}/List.stories.tsx +40 -34
  239. package/src/components/{Lists → List}/List.tsx +22 -29
  240. package/src/components/{Lists → List}/ListDropIndicator.tsx +1 -1
  241. package/src/components/{Lists → List}/Tree.stories.tsx +13 -10
  242. package/src/components/{Lists → List}/Tree.tsx +4 -3
  243. package/src/components/{Lists → List}/TreeDropIndicator.tsx +1 -1
  244. package/src/components/{Lists → List}/Treegrid.stories.tsx +14 -8
  245. package/src/components/{Lists → List}/Treegrid.tsx +61 -25
  246. package/src/components/Main/Main.stories.tsx +56 -27
  247. package/src/components/Main/Main.tsx +166 -94
  248. package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +13 -10
  249. package/src/components/{Menus → Menu}/ContextMenu.tsx +8 -31
  250. package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +14 -11
  251. package/src/components/{Menus → Menu}/DropdownMenu.tsx +109 -78
  252. package/src/components/Message/Message.stories.tsx +14 -10
  253. package/src/components/Message/Message.tsx +34 -23
  254. package/src/components/Popover/Popover.stories.tsx +14 -11
  255. package/src/components/Popover/Popover.tsx +68 -49
  256. package/src/components/ScrollArea/ScrollArea.stories.tsx +163 -34
  257. package/src/components/ScrollArea/ScrollArea.tsx +80 -82
  258. package/src/components/ScrollArea/index.ts +1 -1
  259. package/src/components/ScrollContainer/ScrollContainer.stories.tsx +70 -0
  260. package/src/components/ScrollContainer/ScrollContainer.tsx +238 -0
  261. package/src/components/ScrollContainer/index.ts +5 -0
  262. package/src/components/Select/Select.stories.tsx +15 -12
  263. package/src/components/Select/Select.tsx +18 -34
  264. package/src/components/Separator/Separator.tsx +1 -1
  265. package/src/components/Skeleton/Skeleton.stories.tsx +52 -0
  266. package/src/components/Skeleton/Skeleton.tsx +26 -0
  267. package/src/components/Skeleton/index.ts +5 -0
  268. package/src/components/Splitter/Splitter.stories.tsx +73 -0
  269. package/src/components/Splitter/Splitter.tsx +123 -0
  270. package/src/components/Splitter/index.ts +5 -0
  271. package/src/components/Status/Status.stories.tsx +11 -8
  272. package/src/components/Status/Status.tsx +2 -2
  273. package/src/components/Tag/Tag.stories.tsx +21 -12
  274. package/src/components/Tag/Tag.tsx +2 -7
  275. package/src/components/ThemeProvider/ThemeProvider.tsx +5 -6
  276. package/src/components/ThemeProvider/TranslationsProvider.tsx +4 -19
  277. package/src/components/ThemeProvider/index.ts +3 -1
  278. package/src/components/Toast/Toast.stories.tsx +14 -11
  279. package/src/components/Toast/Toast.tsx +15 -19
  280. package/src/components/Toolbar/Toolbar.stories.tsx +23 -21
  281. package/src/components/Toolbar/Toolbar.tsx +41 -10
  282. package/src/components/Tooltip/Tooltip.stories.tsx +18 -14
  283. package/src/components/Tooltip/Tooltip.tsx +29 -26
  284. package/src/components/index.ts +7 -4
  285. package/src/exemplars/generics.stories.tsx +44 -0
  286. package/src/exemplars/slot.stories.tsx +108 -0
  287. package/src/exemplars/tabster.stories.tsx +127 -0
  288. package/src/hooks/useDensityContext.ts +1 -1
  289. package/src/hooks/useElevationContext.ts +1 -1
  290. package/src/hooks/useSafeArea.ts +3 -2
  291. package/src/hooks/useSafeCollisionPadding.ts +1 -1
  292. package/src/hooks/useVisualViewport.ts +4 -4
  293. package/src/index.ts +3 -2
  294. package/src/playground/Controls.stories.tsx +20 -18
  295. package/src/playground/Custom.stories.tsx +15 -26
  296. package/src/playground/Typography.stories.tsx +10 -8
  297. package/src/primitives/Container/Container.stories.tsx +67 -0
  298. package/src/primitives/Container/Container.tsx +79 -0
  299. package/src/primitives/Container/Layout.stories.tsx +57 -0
  300. package/src/primitives/Container/Layout.tsx +61 -0
  301. package/src/primitives/Container/index.ts +6 -0
  302. package/src/primitives/Flex/Flex.tsx +26 -0
  303. package/src/primitives/Flex/index.ts +5 -0
  304. package/src/primitives/index.ts +6 -0
  305. package/src/testing/decorators/index.ts +2 -1
  306. package/src/testing/decorators/withLayout.tsx +63 -0
  307. package/src/testing/decorators/{withSurfaceVariantsLayout.tsx → withLayoutVariants.tsx} +4 -4
  308. package/src/testing/decorators/withTheme.tsx +34 -0
  309. package/src/util/index.ts +3 -1
  310. package/src/util/usePx.ts +61 -0
  311. package/README.yml +0 -1
  312. package/dist/lib/browser/chunk-WXW6KSRL.mjs +0 -4376
  313. package/dist/lib/browser/chunk-WXW6KSRL.mjs.map +0 -7
  314. package/dist/lib/node/chunk-3E3QKWX4.cjs +0 -4363
  315. package/dist/lib/node/chunk-3E3QKWX4.cjs.map +0 -7
  316. package/dist/lib/node/index.cjs +0 -175
  317. package/dist/lib/node/index.cjs.map +0 -7
  318. package/dist/lib/node/meta.json +0 -1
  319. package/dist/lib/node/testing/index.cjs +0 -114
  320. package/dist/lib/node/testing/index.cjs.map +0 -7
  321. package/dist/lib/node-esm/chunk-EQ7EG74H.mjs +0 -4378
  322. package/dist/lib/node-esm/chunk-EQ7EG74H.mjs.map +0 -7
  323. package/dist/types/src/components/Buttons/Button.d.ts.map +0 -1
  324. package/dist/types/src/components/Buttons/Button.stories.d.ts +0 -12
  325. package/dist/types/src/components/Buttons/Button.stories.d.ts.map +0 -1
  326. package/dist/types/src/components/Buttons/IconButton.d.ts.map +0 -1
  327. package/dist/types/src/components/Buttons/IconButton.stories.d.ts +0 -22
  328. package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +0 -1
  329. package/dist/types/src/components/Buttons/Toggle.d.ts.map +0 -1
  330. package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -19
  331. package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
  332. package/dist/types/src/components/Buttons/ToggleGroup.d.ts +0 -28
  333. package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
  334. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +0 -39
  335. package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +0 -1
  336. package/dist/types/src/components/Buttons/index.d.ts.map +0 -1
  337. package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +0 -1
  338. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +0 -43
  339. package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +0 -1
  340. package/dist/types/src/components/Dialogs/Dialog.d.ts +0 -31
  341. package/dist/types/src/components/Dialogs/Dialog.d.ts.map +0 -1
  342. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +0 -48
  343. package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +0 -1
  344. package/dist/types/src/components/Dialogs/index.d.ts.map +0 -1
  345. package/dist/types/src/components/Lists/List.d.ts.map +0 -1
  346. package/dist/types/src/components/Lists/List.stories.d.ts +0 -37
  347. package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
  348. package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +0 -1
  349. package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
  350. package/dist/types/src/components/Lists/Tree.stories.d.ts +0 -41
  351. package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
  352. package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +0 -1
  353. package/dist/types/src/components/Lists/Treegrid.stories.d.ts +0 -10
  354. package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +0 -1
  355. package/dist/types/src/components/Lists/index.d.ts.map +0 -1
  356. package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
  357. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +0 -50
  358. package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
  359. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
  360. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +0 -50
  361. package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
  362. package/dist/types/src/components/Menus/index.d.ts.map +0 -1
  363. package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts +0 -12
  364. package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +0 -1
  365. package/dist/types/src/util/ThemedClassName.d.ts +0 -5
  366. package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
  367. package/src/components/Buttons/Toggle.stories.tsx +0 -33
  368. package/src/components/Dialogs/Dialog.stories.tsx +0 -65
  369. package/src/testing/decorators/withTheme.ts +0 -22
  370. package/src/util/ThemedClassName.ts +0 -7
  371. /package/dist/types/src/components/{Buttons → Button}/Toggle.d.ts +0 -0
  372. /package/dist/types/src/components/{Buttons → Button}/index.d.ts +0 -0
  373. /package/dist/types/src/components/{Dialogs → Dialog}/index.d.ts +0 -0
  374. /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
  375. /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
  376. /package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
  377. /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
  378. /package/src/components/{Buttons → Button}/Toggle.tsx +0 -0
  379. /package/src/components/{Buttons → Button}/index.ts +0 -0
  380. /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
  381. /package/src/components/{Lists → List}/index.ts +0 -0
  382. /package/src/components/{Menus → Menu}/index.ts +0 -0
@@ -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
- import { mx } from '@dxos/react-ui-theme';
32
- import { type Density, type Elevation, type ClassNameValue, type Size } from '@dxos/react-ui-types';
30
+ import { mx } from '@dxos/ui-theme';
31
+ import { type ClassNameValue, type Density, type Elevation, type Size } from '@dxos/ui-types';
33
32
 
34
33
  import { useDensityContext, useElevationContext, useThemeContext } from '../../hooks';
35
34
  import { type ThemedClassName } from '../../util';
@@ -44,7 +43,7 @@ type LabelProps = ThemedClassName<LabelPrimitiveProps> & { srOnly?: boolean };
44
43
  const Label = forwardRef<HTMLLabelElement, LabelProps>(({ srOnly, classNames, children, ...props }, forwardedRef) => {
45
44
  const { tx } = useThemeContext();
46
45
  return (
47
- <LabelPrimitive {...props} className={tx('input.label', 'input__label', { srOnly }, classNames)} ref={forwardedRef}>
46
+ <LabelPrimitive {...props} className={tx('input.label', { srOnly }, classNames)} ref={forwardedRef}>
48
47
  {children}
49
48
  </LabelPrimitive>
50
49
  );
@@ -56,11 +55,7 @@ const Description = forwardRef<HTMLSpanElement, DescriptionProps>(
56
55
  ({ srOnly, classNames, children, ...props }, forwardedRef) => {
57
56
  const { tx } = useThemeContext();
58
57
  return (
59
- <DescriptionPrimitive
60
- {...props}
61
- className={tx('input.description', 'input__description', { srOnly }, classNames)}
62
- ref={forwardedRef}
63
- >
58
+ <DescriptionPrimitive {...props} className={tx('input.description', { srOnly }, classNames)} ref={forwardedRef}>
64
59
  {children}
65
60
  </DescriptionPrimitive>
66
61
  );
@@ -76,12 +71,7 @@ const Validation = forwardRef<HTMLSpanElement, InputScopedProps<ValidationProps>
76
71
  return (
77
72
  <ValidationPrimitive
78
73
  {...props}
79
- className={tx(
80
- 'input.validation',
81
- `input__validation-message input__validation-message--${validationValence}`,
82
- { srOnly, validationValence },
83
- classNames,
84
- )}
74
+ className={tx('input.validation', { srOnly, validationValence }, classNames)}
85
75
  ref={forwardedRef}
86
76
  >
87
77
  {children}
@@ -98,7 +88,7 @@ const DescriptionAndValidation = forwardRef<HTMLParagraphElement, DescriptionAnd
98
88
  return (
99
89
  <DescriptionAndValidationPrimitive
100
90
  {...props}
101
- className={tx('input.descriptionAndValidation', 'input__description-and-validation', { srOnly }, classNames)}
91
+ className={tx('input.descriptionAndValidation', { srOnly }, classNames)}
102
92
  ref={forwardedRef}
103
93
  >
104
94
  {children}
@@ -120,7 +110,6 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
120
110
  elevation: propsElevation,
121
111
  segmentClassName: propsSegmentClassName,
122
112
  inputClassName,
123
- variant,
124
113
  ...props
125
114
  },
126
115
  forwardedRef,
@@ -129,12 +118,10 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
129
118
  const { tx } = useThemeContext();
130
119
  const density = useDensityContext(propsDensity);
131
120
  const elevation = useElevationContext(propsElevation);
132
-
133
121
  const segmentClassName = useCallback(
134
122
  ({ focused, validationValence }: Parameters<Exclude<PinInputPrimitiveProps['segmentClassName'], undefined>>[0]) =>
135
123
  tx(
136
124
  'input.input',
137
- 'input--pin-segment',
138
125
  {
139
126
  variant: 'static',
140
127
  focused,
@@ -144,9 +131,10 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
144
131
  validationValence,
145
132
  },
146
133
  propsSegmentClassName,
147
- ),
134
+ ) || '',
148
135
  [tx, props.disabled, elevation, propsElevation, density],
149
136
  );
137
+
150
138
  return (
151
139
  <PinInputPrimitive
152
140
  {...{
@@ -154,7 +142,7 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
154
142
  segmentClassName,
155
143
  ...(props.autoFocus && !hasIosKeyboard && { autoFocus: true }),
156
144
  }}
157
- inputClassName={tx('input.inputWithSegments', 'input input--pin', { disabled: props.disabled }, inputClassName)}
145
+ inputClassName={tx('input.inputWithSegments', { disabled: props.disabled }, inputClassName) || ''}
158
146
  ref={forwardedRef}
159
147
  />
160
148
  );
@@ -163,24 +151,30 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
163
151
 
164
152
  // TODO(burdon): Implement inline icon within button: e.g., https://www.radix-ui.com/themes/playground#text-field
165
153
 
166
- type TextInputProps = InputSharedProps & ThemedClassName<TextInputPrimitiveProps>;
154
+ type AutoFillProps = {
155
+ noAutoFill?: boolean;
156
+ };
157
+
158
+ type TextInputProps = InputSharedProps & ThemedClassName<TextInputPrimitiveProps> & AutoFillProps;
167
159
 
168
160
  const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>(
169
- ({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
161
+ (
162
+ { __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, noAutoFill, ...props },
163
+ forwardedRef,
164
+ ) => {
170
165
  const { hasIosKeyboard } = useThemeContext();
171
- const themeContextValue = useThemeContext();
166
+ const { tx } = useThemeContext();
172
167
  const density = useDensityContext(propsDensity);
173
168
  const elevation = useElevationContext(propsElevation);
174
169
  const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
175
170
 
176
- const { tx } = themeContextValue;
177
-
178
171
  return (
179
172
  <TextInputPrimitive
180
173
  {...props}
174
+ // TODO(wittjosiah): Factor out autofill properies.
175
+ {...{ 'data-1p-ignore': noAutoFill }}
181
176
  className={tx(
182
177
  'input.input',
183
- 'input',
184
178
  {
185
179
  variant,
186
180
  disabled: props.disabled,
@@ -212,7 +206,6 @@ const TextArea = forwardRef<HTMLTextAreaElement, InputScopedProps<TextAreaProps>
212
206
  {...props}
213
207
  className={tx(
214
208
  'input.input',
215
- 'input--text-area',
216
209
  {
217
210
  variant,
218
211
  disabled: props.disabled,
@@ -230,7 +223,9 @@ const TextArea = forwardRef<HTMLTextAreaElement, InputScopedProps<TextAreaProps>
230
223
  },
231
224
  );
232
225
 
233
- type CheckboxProps = ThemedClassName<Omit<CheckboxPrimitiveProps, 'children'>> & { size?: Size; weight?: IconWeight };
226
+ type CheckboxProps = ThemedClassName<Omit<CheckboxPrimitiveProps, 'children'>> & {
227
+ size?: Size;
228
+ };
234
229
 
235
230
  const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
236
231
  HTMLButtonElement,
@@ -243,7 +238,6 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
243
238
  defaultChecked: propsDefaultChecked,
244
239
  onCheckedChange: propsOnCheckedChange,
245
240
  size,
246
- weight = 'bold',
247
241
  classNames,
248
242
  ...props
249
243
  },
@@ -269,13 +263,13 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
269
263
  'aria-invalid': 'true' as const,
270
264
  'aria-errormessage': errorMessageId,
271
265
  }),
272
- className: tx('input.checkbox', 'input--checkbox', { size }, 'shrink-0', classNames),
266
+ className: tx('input.checkbox', { size }, 'shrink-0', classNames),
273
267
  }}
274
268
  ref={forwardedRef}
275
269
  >
276
270
  <Icon
277
271
  icon={checked === 'indeterminate' ? 'ph--minus--regular' : 'ph--check--regular'}
278
- classNames={tx('input.checkboxIndicator', 'input--checkbox__indicator', { size, checked })}
272
+ classNames={tx('input.checkboxIndicator', { size, checked })}
279
273
  />
280
274
  </CheckboxPrimitive>
281
275
  );
@@ -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 {
11
- title: 'ui/react-ui-core/Link',
9
+ import { Link } from './Link';
10
+
11
+ const meta = {
12
+ title: 'ui/react-ui-core/components/Link',
12
13
  component: Link,
13
- decorators: [withTheme],
14
- parameters: { chromatic: { disableSnapshot: false } },
15
- } as any;
14
+ decorators: [withTheme()],
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: '#' } };
@@ -19,6 +19,6 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
19
19
  ({ asChild, variant, classNames, ...props }, forwardedRef) => {
20
20
  const { tx } = useThemeContext();
21
21
  const Root = asChild ? Slot : Primitive.a;
22
- return <Root {...props} className={tx('link.root', 'link', { variant }, classNames)} ref={forwardedRef} />;
22
+ return <Root {...props} className={tx('link.root', { variant }, classNames)} ref={forwardedRef} />;
23
23
  },
24
24
  );
@@ -2,14 +2,12 @@
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';
11
- import { DotsSixVertical, PushPin } from '@phosphor-icons/react';
12
- import React, { type ReactNode, useState } from 'react';
9
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
10
+ import React, { type ReactNode, useCallback, useState } from 'react';
13
11
 
14
12
  import {
15
13
  getSize,
@@ -18,17 +16,22 @@ import {
18
16
  ghostSelectedTrackingInterFromNormal,
19
17
  mx,
20
18
  surfaceShadow,
21
- } from '@dxos/react-ui-theme';
19
+ } from '@dxos/ui-theme';
22
20
 
23
- import { List, ListItem, type ListScopedProps } from './List';
24
21
  import { withTheme } from '../../testing';
22
+ import { Icon } from '../Icon';
25
23
 
26
- export default {
27
- title: 'ui/react-ui-core/List',
24
+ import { List, ListItem, type ListScopedProps } from './List';
25
+
26
+ const meta = {
27
+ title: 'ui/react-ui-core/components/List',
28
28
  component: List,
29
- decorators: [withTheme],
30
- parameters: { chromatic: { disableSnapshot: false } },
31
- };
29
+ decorators: [withTheme()],
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 });
@@ -41,17 +44,17 @@ const UniformListItem = ({ id, text }: { id: string; text: string }) => {
41
44
  style={{ transform: CSS.Transform.toString(transform) }}
42
45
  >
43
46
  <ListItem.Endcap>
44
- <DotsSixVertical className={mx(getSize(5), 'mbs-2.5')} />
47
+ <Icon icon='ph--dots-six-vertical--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
45
48
  </ListItem.Endcap>
46
49
  <ListItem.Heading classNames='grow pbs-2'>{text}</ListItem.Heading>
47
50
  <ListItem.Endcap>
48
- <PushPin className={mx(getSize(5), 'mbs-2.5')} />
51
+ <Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
49
52
  </ListItem.Endcap>
50
53
  </ListItem.Root>
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) => ({
@@ -60,16 +63,20 @@ export const UniformSizeDraggable = {
60
63
  })),
61
64
  );
62
65
 
63
- const handleDragEnd = (event: DragEndEvent) => {
64
- const { active, over } = event;
65
- if (active.id !== over?.id) {
66
- setItems((items) => {
67
- const oldIndex = items.findIndex((item) => item.id === active.id);
68
- const newIndex = items.findIndex((item) => item.id === over?.id);
69
- return arrayMove(items, oldIndex, newIndex);
70
- });
71
- }
72
- };
66
+ const handleDragEnd = useCallback(
67
+ (event: DragEndEvent) => {
68
+ const { active, over } = event;
69
+ if (active.id !== over?.id) {
70
+ setItems((items) => {
71
+ const oldIndex = items.findIndex((item) => item.id === active.id);
72
+ const newIndex = items.findIndex((item) => item.id === over?.id);
73
+ return arrayMove(items, oldIndex, newIndex);
74
+ });
75
+ }
76
+ },
77
+ [items],
78
+ );
79
+
73
80
  return (
74
81
  <DndContext onDragEnd={handleDragEnd}>
75
82
  <SortableContext items={items.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
@@ -103,19 +110,19 @@ const ManySizesDraggableListItem = ({
103
110
  style={{ transform: CSS.Translate.toString(transform) }}
104
111
  >
105
112
  <ListItem.Endcap>
106
- <DotsSixVertical className={mx(getSize(5), 'mbs-2.5')} />
113
+ <Icon icon='ph--dots-six-vertical--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
107
114
  </ListItem.Endcap>
108
115
  <ListItem.Heading classNames='grow pbs-2' asChild>
109
116
  {text}
110
117
  </ListItem.Heading>
111
118
  <ListItem.Endcap>
112
- <PushPin className={mx(getSize(5), 'mbs-2.5')} />
119
+ <Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
113
120
  </ListItem.Endcap>
114
121
  </ListItem.Root>
115
122
  );
116
123
  };
117
124
 
118
- export const ManySizesDraggable = {
125
+ export const ManySizesDraggable: Story = {
119
126
  render: ({ ...args }) => {
120
127
  const [items, setItems] = useState(
121
128
  [...Array(12)].map((_, index) => ({
@@ -163,7 +170,7 @@ export const ManySizesDraggable = {
163
170
  args: {},
164
171
  };
165
172
 
166
- export const Collapsible = {
173
+ export const Collapsible: Story = {
167
174
  render: ({ ...args }) => {
168
175
  const [items, _setItems] = useState(
169
176
  [...Array(12)].map((_, index) => ({
@@ -181,7 +188,7 @@ export const Collapsible = {
181
188
  {index !== 2 ? <ListItem.OpenTrigger /> : <ListItem.MockOpenTrigger />}
182
189
  <ListItem.Heading classNames='grow pbs-2'>{text}</ListItem.Heading>
183
190
  <ListItem.Endcap>
184
- <PushPin className={mx(getSize(5), 'mbs-2.5')} />
191
+ <Icon icon='ph--push-pin--regular' classNames={mx(getSize(5), 'mbs-2.5')} />
185
192
  </ListItem.Endcap>
186
193
  </div>
187
194
  {index !== 2 && <ListItem.CollapsibleContent>{body}</ListItem.CollapsibleContent>}
@@ -192,11 +199,10 @@ export const Collapsible = {
192
199
  },
193
200
  args: {
194
201
  variant: 'unordered',
195
- // toggleOpenLabel: 'Open/close storybook list item', // TODO(burdon): ???
196
202
  },
197
203
  };
198
204
 
199
- export const SelectableListbox = {
205
+ export const SelectableListbox: Story = {
200
206
  render: () => {
201
207
  const [selectedId, setSelectedId] = useState<string>();
202
208
  const arrowNavigationAttrs = useArrowNavigationGroup({ axis: 'vertical' });
@@ -223,11 +229,11 @@ export const SelectableListbox = {
223
229
  key={id}
224
230
  tabIndex={0}
225
231
  selected={selectedId === id}
226
- classNames={mx('items-center', ghostHover, ghostSelected, ghostSelectedTrackingInterFromNormal)}
232
+ classNames={mx(ghostHover, ghostSelected, ghostSelectedTrackingInterFromNormal)}
227
233
  onClick={() => setSelectedId(id)}
228
234
  onKeyUp={(event) => handleKeyUp(event, id)}
229
235
  >
230
- <ListItem.Heading classNames='grow'>Lorem ipsum dolor sit amet</ListItem.Heading>
236
+ <ListItem.Heading classNames='flex pli-1 items-center grow truncate'>{text}</ListItem.Heading>
231
237
  </ListItem.Root>
232
238
  ))}
233
239
  </List>
@@ -2,34 +2,35 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { CaretDown, CaretRight } from '@phosphor-icons/react';
6
5
  import { Slot } from '@radix-ui/react-slot';
7
- import React, { type ComponentPropsWithoutRef, type FC, forwardRef, type ForwardRefExoticComponent } from 'react';
6
+ import React, { type ComponentPropsWithoutRef, type FC, type ForwardRefExoticComponent, forwardRef } from 'react';
8
7
 
9
8
  import {
9
+ LIST_ITEM_NAME,
10
+ LIST_NAME,
11
+ ListItemCollapsibleContent,
12
+ type ListItemCollapsibleContentProps,
13
+ type ListItemScopedProps,
10
14
  List as ListPrimitive,
11
- type ListProps as ListPrimitiveProps,
12
- type ListScopedProps,
15
+ ListItem as ListPrimitiveItem,
13
16
  ListItemHeading as ListPrimitiveItemHeading,
14
17
  type ListItemHeadingProps as ListPrimitiveItemHeadingProps,
15
18
  ListItemOpenTrigger as ListPrimitiveItemOpenTrigger,
16
19
  type ListItemOpenTriggerProps as ListPrimitiveItemOpenTriggerProps,
17
- ListItemCollapsibleContent,
18
- type ListItemCollapsibleContentProps,
19
- ListItem as ListPrimitiveItem,
20
20
  type ListItemProps as ListPrimitiveItemProps,
21
- type ListItemScopedProps,
22
- LIST_NAME,
23
- LIST_ITEM_NAME,
21
+ type ListProps as ListPrimitiveProps,
22
+ type ListScopedProps,
24
23
  useListContext,
25
24
  useListItemContext,
26
25
  } from '@dxos/react-list';
27
- import { type Density } from '@dxos/react-ui-types';
26
+ import { type Density } from '@dxos/ui-types';
28
27
 
29
- import { ListDropIndicator } from './ListDropIndicator';
30
28
  import { useDensityContext, useThemeContext } from '../../hooks';
31
29
  import { type ThemedClassName } from '../../util';
32
30
  import { DensityProvider } from '../DensityProvider';
31
+ import { Icon } from '../Icon';
32
+
33
+ import { ListDropIndicator } from './ListDropIndicator';
33
34
 
34
35
  type ListProps = ThemedClassName<ListPrimitiveProps> & { density?: Density };
35
36
 
@@ -39,7 +40,7 @@ const List = forwardRef<HTMLOListElement, ListProps>(({ classNames, children, ..
39
40
 
40
41
  return (
41
42
  <DensityProvider density={density}>
42
- <ListPrimitive {...props} className={tx('list.root', 'list', {}, classNames)} ref={forwardedRef}>
43
+ <ListPrimitive {...props} className={tx('list.root', {}, classNames)} ref={forwardedRef}>
43
44
  {children}
44
45
  </ListPrimitive>
45
46
  </DensityProvider>
@@ -57,7 +58,7 @@ const ListItemEndcap = forwardRef<HTMLDivElement, ListItemEndcapProps>(
57
58
  <Root
58
59
  {...(!asChild && { role: 'none' })}
59
60
  {...props}
60
- className={tx('list.item.endcap', 'list__listItem__endcap', { density }, classNames)}
61
+ className={tx('list.item.endcap', { density }, classNames)}
61
62
  ref={forwardedRef}
62
63
  >
63
64
  {children}
@@ -72,13 +73,7 @@ const MockListItemOpenTrigger = ({
72
73
  }: ThemedClassName<Omit<ComponentPropsWithoutRef<'div'>, 'children'>>) => {
73
74
  const density = useDensityContext();
74
75
  const { tx } = useThemeContext();
75
- return (
76
- <div
77
- role='none'
78
- {...props}
79
- className={tx('list.item.openTrigger', 'list__listItem__openTrigger--mock', { density }, classNames)}
80
- />
81
- );
76
+ return <div role='none' {...props} className={tx('list.item.openTrigger', { density }, classNames)} />;
82
77
  };
83
78
 
84
79
  type ListItemHeadingProps = ThemedClassName<ListPrimitiveItemHeadingProps>;
@@ -90,7 +85,7 @@ const ListItemHeading = forwardRef<HTMLParagraphElement, ListItemHeadingProps>(
90
85
  return (
91
86
  <ListPrimitiveItemHeading
92
87
  {...props}
93
- className={tx('list.item.heading', 'list__listItem__heading', { density }, classNames)}
88
+ className={tx('list.item.heading', { density }, classNames)}
94
89
  ref={forwardedRef}
95
90
  >
96
91
  {children}
@@ -106,19 +101,17 @@ const ListItemOpenTrigger = forwardRef<HTMLButtonElement, ListItemOpenTriggerPro
106
101
  const { tx } = useThemeContext();
107
102
  const density = useDensityContext();
108
103
  const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
109
- const Icon = open ? CaretDown : CaretRight;
110
104
  return (
111
105
  <ListPrimitiveItemOpenTrigger
112
106
  {...props}
113
- className={tx('list.item.openTrigger', 'list__listItem__openTrigger', { density }, classNames)}
107
+ className={tx('list.item.openTrigger', { density }, classNames)}
114
108
  ref={forwardedRef}
115
109
  >
116
110
  {children || (
117
111
  <Icon
118
- {...{
119
- weight: 'bold',
120
- className: tx('list.item.openTriggerIcon', 'list__listItem__openTrigger__icon', {}),
121
- }}
112
+ size={3}
113
+ icon={open ? 'ph--caret-down--bold' : 'ph--caret-right--bold'}
114
+ classNames={tx('list.item.openTriggerIcon', {})}
122
115
  />
123
116
  )}
124
117
  </ListPrimitiveItemOpenTrigger>
@@ -135,7 +128,7 @@ const ListItemRoot = forwardRef<HTMLLIElement, ListItemRootProps>(
135
128
  return (
136
129
  <ListPrimitiveItem
137
130
  {...props}
138
- className={tx('list.item.root', 'list__listItem', { density, collapsible: props.collapsible }, classNames)}
131
+ className={tx('list.item.root', { density, collapsible: props.collapsible }, classNames)}
139
132
  ref={forwardedRef}
140
133
  >
141
134
  {children}
@@ -18,7 +18,7 @@ const orientationStyles: Record<Orientation, HTMLAttributes<HTMLElement>['classN
18
18
  horizontal:
19
19
  'h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]',
20
20
  vertical:
21
- 'w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]',
21
+ 'is-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]',
22
22
  };
23
23
 
24
24
  const edgeStyles: Record<Edge, HTMLAttributes<HTMLElement>['className']> = {
@@ -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 {
59
- title: 'ui/react-ui-core/Tree',
60
- component: Tree,
58
+ const meta = {
59
+ title: 'ui/react-ui-core/components/Tree',
60
+ component: Tree as any,
61
61
  render: DefaultStory,
62
- decorators: [withTheme],
63
- parameters: { chromatic: { disableSnapshot: false } },
64
- };
62
+ decorators: [withTheme()],
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