@dxos/react-ui 0.1.0

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 (364) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -0
  3. package/dist/src/components/Alert/Alert.d.ts +10 -0
  4. package/dist/src/components/Alert/Alert.d.ts.map +1 -0
  5. package/dist/src/components/Alert/Alert.js +21 -0
  6. package/dist/src/components/Alert/Alert.js.map +1 -0
  7. package/dist/src/components/Alert/Alert.stories.d.ts +9 -0
  8. package/dist/src/components/Alert/Alert.stories.d.ts.map +1 -0
  9. package/dist/src/components/Alert/Alert.stories.js +30 -0
  10. package/dist/src/components/Alert/Alert.stories.js.map +1 -0
  11. package/dist/src/components/Alert/index.d.ts +2 -0
  12. package/dist/src/components/Alert/index.d.ts.map +1 -0
  13. package/dist/src/components/Alert/index.js +21 -0
  14. package/dist/src/components/Alert/index.js.map +1 -0
  15. package/dist/src/components/AlertDialog/AlertDialog.d.ts +17 -0
  16. package/dist/src/components/AlertDialog/AlertDialog.d.ts.map +1 -0
  17. package/dist/src/components/AlertDialog/AlertDialog.js +65 -0
  18. package/dist/src/components/AlertDialog/AlertDialog.js.map +1 -0
  19. package/dist/src/components/AlertDialog/AlertDialog.stories.d.ts +9 -0
  20. package/dist/src/components/AlertDialog/AlertDialog.stories.d.ts.map +1 -0
  21. package/dist/src/components/AlertDialog/AlertDialog.stories.js +37 -0
  22. package/dist/src/components/AlertDialog/AlertDialog.stories.js.map +1 -0
  23. package/dist/src/components/AlertDialog/index.d.ts +2 -0
  24. package/dist/src/components/AlertDialog/index.d.ts.map +1 -0
  25. package/dist/src/components/AlertDialog/index.js +21 -0
  26. package/dist/src/components/AlertDialog/index.js.map +1 -0
  27. package/dist/src/components/Avatar/Avatar.d.ts +13 -0
  28. package/dist/src/components/Avatar/Avatar.d.ts.map +1 -0
  29. package/dist/src/components/Avatar/Avatar.js +53 -0
  30. package/dist/src/components/Avatar/Avatar.js.map +1 -0
  31. package/dist/src/components/Avatar/Avatar.stories.d.ts +10 -0
  32. package/dist/src/components/Avatar/Avatar.stories.d.ts.map +1 -0
  33. package/dist/src/components/Avatar/Avatar.stories.js +30 -0
  34. package/dist/src/components/Avatar/Avatar.stories.js.map +1 -0
  35. package/dist/src/components/Avatar/index.d.ts +2 -0
  36. package/dist/src/components/Avatar/index.d.ts.map +1 -0
  37. package/dist/src/components/Avatar/index.js +21 -0
  38. package/dist/src/components/Avatar/index.js.map +1 -0
  39. package/dist/src/components/Button/Button.d.ts +4 -0
  40. package/dist/src/components/Button/Button.d.ts.map +1 -0
  41. package/dist/src/components/Button/Button.js +37 -0
  42. package/dist/src/components/Button/Button.js.map +1 -0
  43. package/dist/src/components/Button/Button.stories.d.ts +12 -0
  44. package/dist/src/components/Button/Button.stories.d.ts.map +1 -0
  45. package/dist/src/components/Button/Button.stories.js +31 -0
  46. package/dist/src/components/Button/Button.stories.js.map +1 -0
  47. package/dist/src/components/Button/ButtonProps.d.ts +8 -0
  48. package/dist/src/components/Button/ButtonProps.d.ts.map +1 -0
  49. package/dist/src/components/Button/ButtonProps.js +6 -0
  50. package/dist/src/components/Button/ButtonProps.js.map +1 -0
  51. package/dist/src/components/Button/buttonStyles.d.ts +5 -0
  52. package/dist/src/components/Button/buttonStyles.d.ts.map +1 -0
  53. package/dist/src/components/Button/buttonStyles.js +24 -0
  54. package/dist/src/components/Button/buttonStyles.js.map +1 -0
  55. package/dist/src/components/Button/index.d.ts +4 -0
  56. package/dist/src/components/Button/index.d.ts.map +1 -0
  57. package/dist/src/components/Button/index.js +23 -0
  58. package/dist/src/components/Button/index.js.map +1 -0
  59. package/dist/src/components/CompoundButton/CompoundButton.d.ts +10 -0
  60. package/dist/src/components/CompoundButton/CompoundButton.d.ts.map +1 -0
  61. package/dist/src/components/CompoundButton/CompoundButton.js +27 -0
  62. package/dist/src/components/CompoundButton/CompoundButton.js.map +1 -0
  63. package/dist/src/components/CompoundButton/CompoundButton.stories.d.ts +10 -0
  64. package/dist/src/components/CompoundButton/CompoundButton.stories.d.ts.map +1 -0
  65. package/dist/src/components/CompoundButton/CompoundButton.stories.js +40 -0
  66. package/dist/src/components/CompoundButton/CompoundButton.stories.js.map +1 -0
  67. package/dist/src/components/CompoundButton/index.d.ts +2 -0
  68. package/dist/src/components/CompoundButton/index.d.ts.map +1 -0
  69. package/dist/src/components/CompoundButton/index.js +21 -0
  70. package/dist/src/components/CompoundButton/index.js.map +1 -0
  71. package/dist/src/components/Dialog/Dialog.d.ts +14 -0
  72. package/dist/src/components/Dialog/Dialog.d.ts.map +1 -0
  73. package/dist/src/components/Dialog/Dialog.js +59 -0
  74. package/dist/src/components/Dialog/Dialog.js.map +1 -0
  75. package/dist/src/components/Dialog/Dialog.stories.d.ts +9 -0
  76. package/dist/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
  77. package/dist/src/components/Dialog/Dialog.stories.js +37 -0
  78. package/dist/src/components/Dialog/Dialog.stories.js.map +1 -0
  79. package/dist/src/components/Dialog/index.d.ts +2 -0
  80. package/dist/src/components/Dialog/index.d.ts.map +1 -0
  81. package/dist/src/components/Dialog/index.js +21 -0
  82. package/dist/src/components/Dialog/index.js.map +1 -0
  83. package/dist/src/components/Group/Group.d.ts +10 -0
  84. package/dist/src/components/Group/Group.d.ts.map +1 -0
  85. package/dist/src/components/Group/Group.js +22 -0
  86. package/dist/src/components/Group/Group.js.map +1 -0
  87. package/dist/src/components/Group/Group.stories.d.ts +9 -0
  88. package/dist/src/components/Group/Group.stories.d.ts.map +1 -0
  89. package/dist/src/components/Group/Group.stories.js +27 -0
  90. package/dist/src/components/Group/Group.stories.js.map +1 -0
  91. package/dist/src/components/Group/index.d.ts +2 -0
  92. package/dist/src/components/Group/index.d.ts.map +1 -0
  93. package/dist/src/components/Group/index.js +21 -0
  94. package/dist/src/components/Group/index.js.map +1 -0
  95. package/dist/src/components/Heading/Heading.d.ts +266 -0
  96. package/dist/src/components/Heading/Heading.d.ts.map +1 -0
  97. package/dist/src/components/Heading/Heading.js +28 -0
  98. package/dist/src/components/Heading/Heading.js.map +1 -0
  99. package/dist/src/components/Heading/Heading.stories.d.ts +274 -0
  100. package/dist/src/components/Heading/Heading.stories.d.ts.map +1 -0
  101. package/dist/src/components/Heading/Heading.stories.js +34 -0
  102. package/dist/src/components/Heading/Heading.stories.js.map +1 -0
  103. package/dist/src/components/Heading/index.d.ts +2 -0
  104. package/dist/src/components/Heading/index.d.ts.map +1 -0
  105. package/dist/src/components/Heading/index.js +21 -0
  106. package/dist/src/components/Heading/index.js.map +1 -0
  107. package/dist/src/components/Input/Input.d.ts +17 -0
  108. package/dist/src/components/Input/Input.d.ts.map +1 -0
  109. package/dist/src/components/Input/Input.js +70 -0
  110. package/dist/src/components/Input/Input.js.map +1 -0
  111. package/dist/src/components/Input/Input.stories.d.ts +23 -0
  112. package/dist/src/components/Input/Input.stories.d.ts.map +1 -0
  113. package/dist/src/components/Input/Input.stories.js +73 -0
  114. package/dist/src/components/Input/Input.stories.js.map +1 -0
  115. package/dist/src/components/Input/index.d.ts +2 -0
  116. package/dist/src/components/Input/index.d.ts.map +1 -0
  117. package/dist/src/components/Input/index.js +21 -0
  118. package/dist/src/components/Input/index.js.map +1 -0
  119. package/dist/src/components/Loading/Loading.d.ts +12 -0
  120. package/dist/src/components/Loading/Loading.d.ts.map +1 -0
  121. package/dist/src/components/Loading/Loading.js +29 -0
  122. package/dist/src/components/Loading/Loading.js.map +1 -0
  123. package/dist/src/components/Loading/Loading.stories.d.ts +25 -0
  124. package/dist/src/components/Loading/Loading.stories.d.ts.map +1 -0
  125. package/dist/src/components/Loading/Loading.stories.js +39 -0
  126. package/dist/src/components/Loading/Loading.stories.js.map +1 -0
  127. package/dist/src/components/Loading/index.d.ts +2 -0
  128. package/dist/src/components/Loading/index.d.ts.map +1 -0
  129. package/dist/src/components/Loading/index.js +21 -0
  130. package/dist/src/components/Loading/index.js.map +1 -0
  131. package/dist/src/components/NavMenu/NavMenu.d.ts +31 -0
  132. package/dist/src/components/NavMenu/NavMenu.d.ts.map +1 -0
  133. package/dist/src/components/NavMenu/NavMenu.js +71 -0
  134. package/dist/src/components/NavMenu/NavMenu.js.map +1 -0
  135. package/dist/src/components/NavMenu/NavMenu.stories.d.ts +9 -0
  136. package/dist/src/components/NavMenu/NavMenu.stories.d.ts.map +1 -0
  137. package/dist/src/components/NavMenu/NavMenu.stories.js +50 -0
  138. package/dist/src/components/NavMenu/NavMenu.stories.js.map +1 -0
  139. package/dist/src/components/NavMenu/index.d.ts +2 -0
  140. package/dist/src/components/NavMenu/index.d.ts.map +1 -0
  141. package/dist/src/components/NavMenu/index.js +21 -0
  142. package/dist/src/components/NavMenu/index.js.map +1 -0
  143. package/dist/src/components/Popover/Popover.d.ts +11 -0
  144. package/dist/src/components/Popover/Popover.d.ts.map +1 -0
  145. package/dist/src/components/Popover/Popover.js +56 -0
  146. package/dist/src/components/Popover/Popover.js.map +1 -0
  147. package/dist/src/components/Popover/Popover.stories.d.ts +10 -0
  148. package/dist/src/components/Popover/Popover.stories.d.ts.map +1 -0
  149. package/dist/src/components/Popover/Popover.stories.js +39 -0
  150. package/dist/src/components/Popover/Popover.stories.js.map +1 -0
  151. package/dist/src/components/Popover/index.d.ts +2 -0
  152. package/dist/src/components/Popover/index.d.ts.map +1 -0
  153. package/dist/src/components/Popover/index.js +21 -0
  154. package/dist/src/components/Popover/index.js.map +1 -0
  155. package/dist/src/components/QrCode/QrCode.d.ts +11 -0
  156. package/dist/src/components/QrCode/QrCode.d.ts.map +1 -0
  157. package/dist/src/components/QrCode/QrCode.js +51 -0
  158. package/dist/src/components/QrCode/QrCode.js.map +1 -0
  159. package/dist/src/components/QrCode/QrCode.stories.d.ts +9 -0
  160. package/dist/src/components/QrCode/QrCode.stories.d.ts.map +1 -0
  161. package/dist/src/components/QrCode/QrCode.stories.js +29 -0
  162. package/dist/src/components/QrCode/QrCode.stories.js.map +1 -0
  163. package/dist/src/components/QrCode/index.d.ts +2 -0
  164. package/dist/src/components/QrCode/index.d.ts.map +1 -0
  165. package/dist/src/components/QrCode/index.js +21 -0
  166. package/dist/src/components/QrCode/index.js.map +1 -0
  167. package/dist/src/components/Tag/Tag.d.ts +8 -0
  168. package/dist/src/components/Tag/Tag.d.ts.map +1 -0
  169. package/dist/src/components/Tag/Tag.js +23 -0
  170. package/dist/src/components/Tag/Tag.js.map +1 -0
  171. package/dist/src/components/Tag/Tag.stories.d.ts +10 -0
  172. package/dist/src/components/Tag/Tag.stories.d.ts.map +1 -0
  173. package/dist/src/components/Tag/Tag.stories.js +24 -0
  174. package/dist/src/components/Tag/Tag.stories.js.map +1 -0
  175. package/dist/src/components/Tag/index.d.ts +2 -0
  176. package/dist/src/components/Tag/index.d.ts.map +1 -0
  177. package/dist/src/components/Tag/index.js +21 -0
  178. package/dist/src/components/Tag/index.js.map +1 -0
  179. package/dist/src/components/Toast/Toast.d.ts +16 -0
  180. package/dist/src/components/Toast/Toast.d.ts.map +1 -0
  181. package/dist/src/components/Toast/Toast.js +54 -0
  182. package/dist/src/components/Toast/Toast.js.map +1 -0
  183. package/dist/src/components/Toast/Toast.stories.d.ts +9 -0
  184. package/dist/src/components/Toast/Toast.stories.d.ts.map +1 -0
  185. package/dist/src/components/Toast/Toast.stories.js +32 -0
  186. package/dist/src/components/Toast/Toast.stories.js.map +1 -0
  187. package/dist/src/components/Toast/index.d.ts +2 -0
  188. package/dist/src/components/Toast/index.d.ts.map +1 -0
  189. package/dist/src/components/Toast/index.js +21 -0
  190. package/dist/src/components/Toast/index.js.map +1 -0
  191. package/dist/src/components/Tooltip/Tooltip.d.ts +10 -0
  192. package/dist/src/components/Tooltip/Tooltip.d.ts.map +1 -0
  193. package/dist/src/components/Tooltip/Tooltip.js +50 -0
  194. package/dist/src/components/Tooltip/Tooltip.js.map +1 -0
  195. package/dist/src/components/Tooltip/Tooltip.stories.d.ts +9 -0
  196. package/dist/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -0
  197. package/dist/src/components/Tooltip/Tooltip.stories.js +30 -0
  198. package/dist/src/components/Tooltip/Tooltip.stories.js.map +1 -0
  199. package/dist/src/components/Tooltip/index.d.ts +2 -0
  200. package/dist/src/components/Tooltip/index.d.ts.map +1 -0
  201. package/dist/src/components/Tooltip/index.js +21 -0
  202. package/dist/src/components/Tooltip/index.js.map +1 -0
  203. package/dist/src/components/UiProvider/UiProvider.d.ts +10 -0
  204. package/dist/src/components/UiProvider/UiProvider.d.ts.map +1 -0
  205. package/dist/src/components/UiProvider/UiProvider.js +21 -0
  206. package/dist/src/components/UiProvider/UiProvider.js.map +1 -0
  207. package/dist/src/components/UiProvider/index.d.ts +2 -0
  208. package/dist/src/components/UiProvider/index.d.ts.map +1 -0
  209. package/dist/src/components/UiProvider/index.js +21 -0
  210. package/dist/src/components/UiProvider/index.js.map +1 -0
  211. package/dist/src/components/index.d.ts +18 -0
  212. package/dist/src/components/index.d.ts.map +1 -0
  213. package/dist/src/components/index.js +37 -0
  214. package/dist/src/components/index.js.map +1 -0
  215. package/dist/src/hooks/index.d.ts +2 -0
  216. package/dist/src/hooks/index.d.ts.map +1 -0
  217. package/dist/src/hooks/index.js +21 -0
  218. package/dist/src/hooks/index.js.map +1 -0
  219. package/dist/src/hooks/useId.d.ts +2 -0
  220. package/dist/src/hooks/useId.d.ts.map +1 -0
  221. package/dist/src/hooks/useId.js +19 -0
  222. package/dist/src/hooks/useId.js.map +1 -0
  223. package/dist/src/index.d.ts +5 -0
  224. package/dist/src/index.d.ts.map +1 -0
  225. package/dist/src/index.js +24 -0
  226. package/dist/src/index.js.map +1 -0
  227. package/dist/src/plugin.d.ts +9 -0
  228. package/dist/src/plugin.d.ts.map +1 -0
  229. package/dist/src/plugin.js +268 -0
  230. package/dist/src/plugin.js.map +1 -0
  231. package/dist/src/props/Elevation.d.ts +2 -0
  232. package/dist/src/props/Elevation.d.ts.map +1 -0
  233. package/dist/src/props/Elevation.js +6 -0
  234. package/dist/src/props/Elevation.js.map +1 -0
  235. package/dist/src/props/MessageValence.d.ts +2 -0
  236. package/dist/src/props/MessageValence.d.ts.map +1 -0
  237. package/dist/src/props/MessageValence.js +6 -0
  238. package/dist/src/props/MessageValence.js.map +1 -0
  239. package/dist/src/props/Size.d.ts +2 -0
  240. package/dist/src/props/Size.d.ts.map +1 -0
  241. package/dist/src/props/Size.js +6 -0
  242. package/dist/src/props/Size.js.map +1 -0
  243. package/dist/src/props/index.d.ts +4 -0
  244. package/dist/src/props/index.d.ts.map +1 -0
  245. package/dist/src/props/index.js +23 -0
  246. package/dist/src/props/index.js.map +1 -0
  247. package/dist/src/styles/active.d.ts +2 -0
  248. package/dist/src/styles/active.d.ts.map +1 -0
  249. package/dist/src/styles/active.js +12 -0
  250. package/dist/src/styles/active.js.map +1 -0
  251. package/dist/src/styles/disabled.d.ts +2 -0
  252. package/dist/src/styles/disabled.d.ts.map +1 -0
  253. package/dist/src/styles/disabled.js +8 -0
  254. package/dist/src/styles/disabled.js.map +1 -0
  255. package/dist/src/styles/focus.d.ts +2 -0
  256. package/dist/src/styles/focus.d.ts.map +1 -0
  257. package/dist/src/styles/focus.js +8 -0
  258. package/dist/src/styles/focus.js.map +1 -0
  259. package/dist/src/styles/group.d.ts +5 -0
  260. package/dist/src/styles/group.d.ts.map +1 -0
  261. package/dist/src/styles/group.js +26 -0
  262. package/dist/src/styles/group.js.map +1 -0
  263. package/dist/src/styles/hover.d.ts +4 -0
  264. package/dist/src/styles/hover.d.ts.map +1 -0
  265. package/dist/src/styles/hover.js +12 -0
  266. package/dist/src/styles/hover.js.map +1 -0
  267. package/dist/src/styles/index.d.ts +10 -0
  268. package/dist/src/styles/index.d.ts.map +1 -0
  269. package/dist/src/styles/index.js +29 -0
  270. package/dist/src/styles/index.js.map +1 -0
  271. package/dist/src/styles/ornament.d.ts +3 -0
  272. package/dist/src/styles/ornament.d.ts.map +1 -0
  273. package/dist/src/styles/ornament.js +9 -0
  274. package/dist/src/styles/ornament.js.map +1 -0
  275. package/dist/src/styles/size.d.ts +7 -0
  276. package/dist/src/styles/size.d.ts.map +1 -0
  277. package/dist/src/styles/size.js +89 -0
  278. package/dist/src/styles/size.js.map +1 -0
  279. package/dist/src/styles/text.d.ts +5 -0
  280. package/dist/src/styles/text.d.ts.map +1 -0
  281. package/dist/src/styles/text.js +11 -0
  282. package/dist/src/styles/text.js.map +1 -0
  283. package/dist/src/styles/valence.d.ts +19 -0
  284. package/dist/src/styles/valence.d.ts.map +1 -0
  285. package/dist/src/styles/valence.js +66 -0
  286. package/dist/src/styles/valence.js.map +1 -0
  287. package/dist/src/testing/index.d.ts +2 -0
  288. package/dist/src/testing/index.d.ts.map +1 -0
  289. package/dist/src/testing/index.js +21 -0
  290. package/dist/src/testing/index.js.map +1 -0
  291. package/dist/src/testing/templateForComponent.d.ts +4 -0
  292. package/dist/src/testing/templateForComponent.d.ts.map +1 -0
  293. package/dist/src/testing/templateForComponent.js +18 -0
  294. package/dist/src/testing/templateForComponent.js.map +1 -0
  295. package/dist/src/theme.css +62 -0
  296. package/package.json +55 -0
  297. package/src/components/Alert/Alert.stories.tsx +31 -0
  298. package/src/components/Alert/Alert.tsx +34 -0
  299. package/src/components/Alert/index.ts +5 -0
  300. package/src/components/Avatar/Avatar.stories.tsx +29 -0
  301. package/src/components/Avatar/Avatar.tsx +82 -0
  302. package/src/components/Avatar/index.ts +5 -0
  303. package/src/components/Button/Button.stories.tsx +43 -0
  304. package/src/components/Button/Button.tsx +20 -0
  305. package/src/components/Button/ButtonProps.ts +10 -0
  306. package/src/components/Button/buttonStyles.ts +32 -0
  307. package/src/components/Button/index.ts +7 -0
  308. package/src/components/CompoundButton/CompoundButton.stories.tsx +46 -0
  309. package/src/components/CompoundButton/CompoundButton.tsx +53 -0
  310. package/src/components/CompoundButton/index.ts +5 -0
  311. package/src/components/Dialog/Dialog.stories.tsx +37 -0
  312. package/src/components/Dialog/Dialog.tsx +124 -0
  313. package/src/components/Dialog/index.ts +5 -0
  314. package/src/components/Group/Group.stories.tsx +25 -0
  315. package/src/components/Group/Group.tsx +48 -0
  316. package/src/components/Group/index.ts +5 -0
  317. package/src/components/Heading/Heading.stories.tsx +29 -0
  318. package/src/components/Heading/Heading.tsx +28 -0
  319. package/src/components/Heading/index.ts +5 -0
  320. package/src/components/Input/Input.stories.tsx +91 -0
  321. package/src/components/Input/Input.tsx +132 -0
  322. package/src/components/Input/index.ts +5 -0
  323. package/src/components/Loading/Loading.stories.tsx +34 -0
  324. package/src/components/Loading/Loading.tsx +59 -0
  325. package/src/components/Loading/index.ts +5 -0
  326. package/src/components/Main/Main.tsx +14 -0
  327. package/src/components/Main/index.ts +5 -0
  328. package/src/components/NavMenu/NavMenu.stories.tsx +54 -0
  329. package/src/components/NavMenu/NavMenu.tsx +180 -0
  330. package/src/components/NavMenu/index.ts +5 -0
  331. package/src/components/Popover/Popover.stories.tsx +45 -0
  332. package/src/components/Popover/Popover.tsx +76 -0
  333. package/src/components/Popover/index.ts +5 -0
  334. package/src/components/QrCode/QrCode.stories.tsx +27 -0
  335. package/src/components/QrCode/QrCode.tsx +42 -0
  336. package/src/components/QrCode/index.ts +5 -0
  337. package/src/components/Toast/Toast.stories.tsx +31 -0
  338. package/src/components/Toast/Toast.tsx +84 -0
  339. package/src/components/Toast/index.ts +5 -0
  340. package/src/components/Tooltip/Tooltip.stories.tsx +28 -0
  341. package/src/components/Tooltip/Tooltip.tsx +57 -0
  342. package/src/components/Tooltip/index.ts +5 -0
  343. package/src/components/UiProvider/UiProvider.tsx +44 -0
  344. package/src/components/UiProvider/index.ts +5 -0
  345. package/src/components/index.ts +20 -0
  346. package/src/hooks/index.ts +5 -0
  347. package/src/hooks/useId.ts +21 -0
  348. package/src/index.ts +8 -0
  349. package/src/plugin.ts +270 -0
  350. package/src/props/MessageValence.ts +5 -0
  351. package/src/props/Size.ts +40 -0
  352. package/src/props/index.ts +6 -0
  353. package/src/styles/active.ts +11 -0
  354. package/src/styles/disabled.ts +5 -0
  355. package/src/styles/focus.ts +6 -0
  356. package/src/styles/hover.ts +10 -0
  357. package/src/styles/index.ts +11 -0
  358. package/src/styles/size.ts +87 -0
  359. package/src/styles/text.ts +10 -0
  360. package/src/styles/valence.ts +71 -0
  361. package/src/testing/index.ts +5 -0
  362. package/src/testing/templateForComponent.tsx +16 -0
  363. package/src/theme.css +62 -0
  364. package/src/typings.d.ts +7 -0
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import cx from 'classnames';
6
+ import React, { createElement, PropsWithChildren, ReactNode } from 'react';
7
+
8
+ export interface HeadingProps extends React.ComponentProps<'h1'> {
9
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
10
+ children?: ReactNode;
11
+ }
12
+
13
+ const levelClassNameMap = new Map<number, string>([
14
+ [1, 'text-5xl'],
15
+ [2, 'text-4xl'],
16
+ [3, 'text-3xl'],
17
+ [4, 'text-2xl'],
18
+ [5, 'text-xl'],
19
+ [6, 'text-lg']
20
+ ]);
21
+
22
+ export const Heading = ({ level, ...props }: PropsWithChildren<HeadingProps>) => {
23
+ const resolvedLevel = level || 1;
24
+ return createElement(`h${resolvedLevel}`, {
25
+ ...props,
26
+ className: cx('font-bold font-display', levelClassNameMap.get(resolvedLevel), props.className)
27
+ });
28
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export * from './Heading';
@@ -0,0 +1,91 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import '@dxosTheme';
6
+ import React from 'react';
7
+
8
+ import { templateForComponent } from '../../testing';
9
+ import { Input, InputProps } from './Input';
10
+
11
+ export default {
12
+ title: 'react-ui/Input',
13
+ component: Input,
14
+ argTypes: {
15
+ description: { control: 'text' },
16
+ validationValence: {
17
+ control: 'select',
18
+ options: ['success', 'info', 'warning', 'error']
19
+ }
20
+ }
21
+ };
22
+
23
+ const Template = (props: InputProps) => {
24
+ return <Input {...props} />;
25
+ };
26
+
27
+ export const Default = templateForComponent(Template)({ label: '' });
28
+ Default.args = {
29
+ label: 'Hello',
30
+ placeholder: 'This is an input',
31
+ disabled: false,
32
+ description: undefined,
33
+ labelVisuallyHidden: false,
34
+ descriptionVisuallyHidden: false,
35
+ validationMessage: '',
36
+ validationValence: undefined
37
+ };
38
+
39
+ export const Disabled = () => (
40
+ <Template
41
+ {...{
42
+ label: 'Disabled',
43
+ placeholder: 'This is a disabled input',
44
+ disabled: true
45
+ }}
46
+ />
47
+ );
48
+
49
+ export const LabelVisuallyHidden = () => (
50
+ <Template
51
+ {...{
52
+ label: 'The label is for screen readers',
53
+ labelVisuallyHidden: true,
54
+ placeholder: 'The label for this input exists but is only read by screen readers'
55
+ }}
56
+ />
57
+ );
58
+
59
+ export const InputWithDescription = () => (
60
+ <Template
61
+ {...{
62
+ label: 'Described input',
63
+ placeholder: 'This input has an accessible description',
64
+ description: 'This helper text is accessibly associated with the input.'
65
+ }}
66
+ />
67
+ );
68
+
69
+ export const InputWithErrorAndDescription = () => (
70
+ <Template
71
+ {...{
72
+ label: 'Described invalid input',
73
+ placeholder: 'This input has both an accessible description and a validation error',
74
+ description: 'This description is identified separately in the accessibility tree.',
75
+ validationValence: 'error',
76
+ validationMessage: 'The input has an error.'
77
+ }}
78
+ />
79
+ );
80
+
81
+ export const InputWithValidationAndDescription = () => (
82
+ <Template
83
+ {...{
84
+ label: 'Described input with validation message',
85
+ placeholder: 'This input is styled to express a validation valence',
86
+ description: 'This description is extra.',
87
+ validationValence: 'success',
88
+ validationMessage: 'This validation message is really part of the description.'
89
+ }}
90
+ />
91
+ );
@@ -0,0 +1,132 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import cx from 'classnames';
6
+ import React, { ChangeEvent, ComponentProps, ReactNode, useCallback, useState, useTransition } from 'react';
7
+
8
+ import { useId } from '../../hooks';
9
+ import { MessageValence } from '../../props';
10
+ import {
11
+ defaultDescription,
12
+ defaultDisabled,
13
+ defaultFocus,
14
+ defaultHover,
15
+ defaultPlaceholder,
16
+ valenceColorText,
17
+ valenceInputBorder
18
+ } from '../../styles';
19
+
20
+ export type InputSize = 'md' | 'lg';
21
+
22
+ export interface InputProps extends Omit<ComponentProps<'input'>, 'value' | 'onChange' | 'size'> {
23
+ label: ReactNode;
24
+ labelVisuallyHidden?: boolean;
25
+ description?: ReactNode;
26
+ descriptionVisuallyHidden?: boolean;
27
+ initialValue?: string;
28
+ onChange?: (value: string) => void;
29
+ disabled?: boolean;
30
+ size?: InputSize;
31
+ validationMessage?: ReactNode;
32
+ validationValence?: MessageValence;
33
+ }
34
+
35
+ const sizeMap = new Map<InputSize, string>([
36
+ ['md', ''],
37
+ ['lg', 'text-base']
38
+ ]);
39
+
40
+ export const Input = ({
41
+ label,
42
+ labelVisuallyHidden,
43
+ placeholder,
44
+ description,
45
+ descriptionVisuallyHidden,
46
+ required,
47
+ initialValue,
48
+ onChange,
49
+ disabled,
50
+ className,
51
+ size,
52
+ validationMessage,
53
+ validationValence,
54
+ ...inputProps
55
+ }: InputProps) => {
56
+ const inputId = inputProps.id || useId('input');
57
+ const descriptionId = useId('input-description');
58
+ const validationId = useId('input-validation');
59
+
60
+ const [_isPending, startTransition] = useTransition();
61
+
62
+ const [internalValue, setInternalValue] = useState<string>(initialValue?.toString() || '');
63
+
64
+ const onInternalChange = useCallback(
65
+ (e: ChangeEvent<HTMLInputElement>) => {
66
+ const nextValue = e.target?.value || '';
67
+ setInternalValue(nextValue);
68
+ onChange &&
69
+ startTransition(() => {
70
+ onChange(nextValue);
71
+ });
72
+ },
73
+ [onChange]
74
+ );
75
+
76
+ const isInvalid = !!validationMessage && validationValence === 'error';
77
+
78
+ return (
79
+ <div className={cx('my-4', className)} role='none'>
80
+ <label
81
+ htmlFor={inputId}
82
+ className={cx(
83
+ 'block mb-1 text-sm font-medium text-neutral-900 dark:text-neutral-100',
84
+ labelVisuallyHidden && 'sr-only'
85
+ )}
86
+ >
87
+ {label}
88
+ </label>
89
+ <input
90
+ id={inputId}
91
+ {...inputProps}
92
+ className={cx(
93
+ defaultFocus,
94
+ defaultPlaceholder,
95
+ defaultHover({ disabled }),
96
+ sizeMap.get(size ?? 'md'),
97
+ 'bg-white/50 border text-neutral-900 text-sm rounded-lg block w-full px-2.5 py-2 dark:bg-neutral-700/50 dark:text-white',
98
+ valenceInputBorder(validationMessage ? validationValence : undefined),
99
+ disabled && defaultDisabled
100
+ )}
101
+ {...(required && { required: true })}
102
+ {...(disabled && { disabled: true })}
103
+ {...(placeholder && { placeholder })}
104
+ {...(description && { 'aria-describedby': descriptionId })}
105
+ {...(isInvalid && {
106
+ 'aria-invalid': 'true',
107
+ 'aria-errormessage': validationId
108
+ })}
109
+ value={internalValue}
110
+ onChange={onInternalChange}
111
+ />
112
+ {(description || validationMessage) && (
113
+ <p
114
+ {...(!isInvalid && { id: descriptionId })}
115
+ className={cx(descriptionVisuallyHidden && !isInvalid && 'sr-only')}
116
+ >
117
+ {validationMessage && (
118
+ <span id={validationId} className={valenceColorText(validationValence)}>
119
+ {validationMessage}{' '}
120
+ </span>
121
+ )}
122
+ <span
123
+ {...(isInvalid && { id: descriptionId })}
124
+ className={cx(defaultDescription, descriptionVisuallyHidden && 'sr-only')}
125
+ >
126
+ {description}
127
+ </span>
128
+ </p>
129
+ )}
130
+ </div>
131
+ );
132
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export * from './Input';
@@ -0,0 +1,34 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import '@dxosTheme';
6
+ import React from 'react';
7
+
8
+ import { templateForComponent } from '../../testing';
9
+ import { Loading, LoadingProps } from './Loading';
10
+
11
+ export default {
12
+ title: 'react-ui/Loading',
13
+ component: Loading,
14
+ argTypes: {
15
+ size: {
16
+ control: 'select',
17
+ options: ['sm', 'md', 'lg', 'xl']
18
+ },
19
+ color: {
20
+ control: 'select',
21
+ options: ['primary', 'neutral']
22
+ }
23
+ }
24
+ };
25
+
26
+ const Template = (props: LoadingProps) => <Loading {...props} />;
27
+
28
+ export const Default = templateForComponent(Template)({ label: 'Loading' });
29
+ Default.args = { label: 'Loading', size: 'md', color: 'primary' };
30
+
31
+ export const Small = () => <Template label='Loading' size={'sm'} />;
32
+ export const Neutral = () => <Template label='Loading' color={'neutral'} />;
33
+ export const Large = () => <Template label='Loading' size={'lg'} />;
34
+ export const ExtraLarge = () => <Template label='Loading' size={'xl'} />;
@@ -0,0 +1,59 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import cx from 'classnames';
6
+ import React from 'react';
7
+
8
+ import { useId } from '../../hooks';
9
+
10
+ export type LoadingSize = 'sm' | 'md' | 'lg' | 'xl';
11
+
12
+ export type LoadingColor = 'primary' | 'neutral';
13
+
14
+ export interface LoadingProps {
15
+ label: string;
16
+ size?: LoadingSize;
17
+ color?: LoadingColor;
18
+ className?: string;
19
+ }
20
+
21
+ const sizeMap = new Map<LoadingSize, string>([
22
+ ['sm', 'w-4 h-4'],
23
+ ['md', 'w-8 h-8'],
24
+ ['lg', 'w-12 h-12'],
25
+ ['xl', 'w-16 h-16']
26
+ ]);
27
+
28
+ export const Loading = ({ size, color, className, label }: LoadingProps & { label: string }) => {
29
+ const labelId = useId('loading-label');
30
+ const sizeClassName = sizeMap.get(size ?? 'md');
31
+ return (
32
+ <div role='status' className={cx('flex justify-center p-4', className)} aria-labelledby={labelId}>
33
+ <svg
34
+ role='none'
35
+ aria-hidden='true'
36
+ className={cx(
37
+ sizeClassName,
38
+ 'text-neutral-200/50 animate-spin dark:text-neutral-600/50',
39
+ color === 'neutral' ? 'fill-neutral-400' : 'fill-primary-400'
40
+ )}
41
+ viewBox='0 0 100 101'
42
+ fill='none'
43
+ xmlns='http://www.w3.org/2000/svg'
44
+ >
45
+ <path
46
+ d='M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z'
47
+ fill='currentColor'
48
+ />
49
+ <path
50
+ d='M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z'
51
+ fill='currentFill'
52
+ />
53
+ </svg>
54
+ <span className='sr-only' id={labelId}>
55
+ {label}
56
+ </span>
57
+ </div>
58
+ );
59
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export * from './Loading';
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import cx from 'classnames';
6
+ import React, { ComponentProps, PropsWithChildren } from 'react';
7
+
8
+ export const Main = ({ children, className, ...mainProps }: PropsWithChildren<ComponentProps<'main'>>) => {
9
+ return (
10
+ <main {...mainProps} className={cx('mt-8 px-8 space-y-4', className)}>
11
+ {children}
12
+ </main>
13
+ );
14
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export * from './Main';
@@ -0,0 +1,54 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import '@dxosTheme';
6
+ import React from 'react';
7
+
8
+ import { templateForComponent } from '../../testing';
9
+ import { NavMenu, NavMenuProps } from './NavMenu';
10
+
11
+ export default {
12
+ title: 'react-ui/NavMenu',
13
+ component: NavMenu
14
+ };
15
+
16
+ const Template = (props: NavMenuProps) => {
17
+ return <NavMenu {...props} />;
18
+ };
19
+
20
+ export const Default = templateForComponent(Template)({ items: [] });
21
+ Default.args = {
22
+ items: [
23
+ {
24
+ triggerLinkProps: { href: '#Hello' },
25
+ children: 'Hello',
26
+ active: true
27
+ },
28
+ {
29
+ children: 'How’s it going?',
30
+ content: (
31
+ <div className='w-[21rem] lg:w-[23rem] p-3'>
32
+ <div className='grid grid-cols-6 gap-4'>
33
+ <div className='col-span-2 w-full bg-gray-100 dark:bg-gray-900 p-4 rounded-md'></div>
34
+
35
+ <div className='col-span-4 w-full flex flex-col space-y-3 bg-gray-100 dark:bg-gray-900 p-4 rounded-md'>
36
+ <div className='w-full bg-white dark:bg-gray-700 h-12 rounded-md'></div>
37
+ <div className='w-full bg-white dark:bg-gray-700 h-12 rounded-md'></div>
38
+ <div className='w-full bg-white dark:bg-gray-700 h-12 rounded-md'></div>
39
+ <div className='w-full bg-white dark:bg-gray-700 h-12 rounded-md'></div>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ )
44
+ },
45
+ {
46
+ triggerLinkProps: { href: '#Goodbye' },
47
+ tooltip: {
48
+ content: 'More info about Goodbye',
49
+ sideOffset: 8
50
+ },
51
+ children: 'Goodbye'
52
+ }
53
+ ]
54
+ };
@@ -0,0 +1,180 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
6
+ import cx from 'classnames';
7
+ import React, { ComponentProps, ForwardedRef, forwardRef, ReactNode } from 'react';
8
+
9
+ import { defaultFocus, defaultHover } from '../../styles';
10
+ import { defaultButtonColors, primaryButtonColors } from '../Button';
11
+ import { Tooltip, TooltipProps } from '../Tooltip';
12
+
13
+ interface NavMenuItemSharedProps {
14
+ children: ReactNode;
15
+ active?: boolean;
16
+ separator?: false;
17
+ }
18
+
19
+ export interface NavMenuLinkItemProps extends NavMenuItemSharedProps {
20
+ triggerLinkProps: Omit<ComponentProps<typeof NavigationMenuPrimitive.Link>, 'children'>;
21
+ children: ReactNode;
22
+ }
23
+
24
+ export interface NavMenuTooltipLinkItemProps extends NavMenuLinkItemProps {
25
+ tooltip: Omit<TooltipProps, 'children'>;
26
+ }
27
+
28
+ export interface NavMenuInvokerItemProps extends NavMenuItemSharedProps {
29
+ content: ReactNode;
30
+ children: ReactNode;
31
+ }
32
+
33
+ export interface NavMenuSeparatorProps {
34
+ separator: true;
35
+ }
36
+
37
+ export type NavMenuItem =
38
+ | NavMenuTooltipLinkItemProps
39
+ | NavMenuLinkItemProps
40
+ | NavMenuInvokerItemProps
41
+ | NavMenuSeparatorProps;
42
+
43
+ export interface NavMenuProps extends ComponentProps<typeof NavigationMenuPrimitive.Root> {
44
+ items: NavMenuItem[];
45
+ }
46
+
47
+ const NavMenuInvokerItem = forwardRef(
48
+ ({ content, children, active }: NavMenuInvokerItemProps, ref: ForwardedRef<HTMLLIElement>) => {
49
+ return (
50
+ <NavigationMenuPrimitive.Item ref={ref}>
51
+ <NavigationMenuPrimitive.Trigger
52
+ className={cx(
53
+ 'px-3 py-2 text-sm rounded-md text-sm font-medium transition-color',
54
+ active ? primaryButtonColors : defaultButtonColors,
55
+ defaultFocus,
56
+ defaultHover({})
57
+ )}
58
+ >
59
+ {children}
60
+ </NavigationMenuPrimitive.Trigger>
61
+ <NavigationMenuPrimitive.Content
62
+ className={cx(
63
+ 'absolute w-auto top-0 left-0 rounded-lg',
64
+ 'radix-motion-from-start:animate-enter-from-left',
65
+ 'radix-motion-from-end:animate-enter-from-right',
66
+ 'radix-motion-to-start:animate-exit-to-left',
67
+ 'radix-motion-to-end:animate-exit-to-right'
68
+ )}
69
+ >
70
+ {content}
71
+ </NavigationMenuPrimitive.Content>
72
+ </NavigationMenuPrimitive.Item>
73
+ );
74
+ }
75
+ );
76
+
77
+ const NavMenuLinkItem = forwardRef(
78
+ ({ triggerLinkProps, children, active }: NavMenuLinkItemProps, ref: ForwardedRef<HTMLLIElement>) => (
79
+ <NavigationMenuPrimitive.Item asChild ref={ref}>
80
+ <NavigationMenuPrimitive.Link
81
+ {...triggerLinkProps}
82
+ active={active}
83
+ className={cx(
84
+ 'px-3 py-2 text-sm rounded-md transition-color',
85
+ active ? primaryButtonColors : defaultButtonColors,
86
+ active ? 'font-medium' : 'font-normal',
87
+ defaultFocus,
88
+ defaultHover({}),
89
+ triggerLinkProps.className
90
+ )}
91
+ >
92
+ {children}
93
+ </NavigationMenuPrimitive.Link>
94
+ </NavigationMenuPrimitive.Item>
95
+ )
96
+ );
97
+
98
+ const NavMenuTooltipLinkItem = forwardRef(
99
+ ({ tooltip, triggerLinkProps, active, children }: NavMenuTooltipLinkItemProps, ref: ForwardedRef<HTMLLIElement>) => (
100
+ <Tooltip {...tooltip}>
101
+ {/* todo: why does the Tooltip not show if you use <NavMenuLinkItem {…}/> here? */}
102
+ <NavigationMenuPrimitive.Item asChild ref={ref}>
103
+ <NavigationMenuPrimitive.Link
104
+ {...triggerLinkProps}
105
+ active={active}
106
+ className={cx(
107
+ 'px-3 py-2 text-sm rounded-md transition-color',
108
+ active ? primaryButtonColors : defaultButtonColors,
109
+ active ? 'font-medium' : 'font-normal',
110
+ defaultFocus,
111
+ defaultHover({}),
112
+ triggerLinkProps.className
113
+ )}
114
+ >
115
+ {children}
116
+ </NavigationMenuPrimitive.Link>
117
+ </NavigationMenuPrimitive.Item>
118
+ </Tooltip>
119
+ )
120
+ );
121
+
122
+ export const NavMenuLink = NavigationMenuPrimitive.Link;
123
+
124
+ export const NavMenuSeparatorItem = (_props: NavMenuSeparatorProps) => {
125
+ return <span role='none' className='h-5 border-l border-neutral-300 dark:border-neutral-700' />;
126
+ };
127
+
128
+ const isTooltipLinkItem = (o: any): o is NavMenuTooltipLinkItemProps => 'tooltip' in o;
129
+ const isLinkItem = (o: any): o is NavMenuLinkItemProps => 'triggerLinkProps' in o;
130
+ const isSeparator = (o: any): o is NavMenuSeparatorProps => 'separator' in o;
131
+
132
+ export const NavMenu = ({ items, ...rootProps }: NavMenuProps) => {
133
+ return (
134
+ <NavigationMenuPrimitive.Root {...rootProps} className={cx('flex justify-center', rootProps.className)}>
135
+ <NavigationMenuPrimitive.List className='relative flex flex-row items-center gap-2 rounded-lg bg-white dark:bg-neutral-800 p-2 button-elevation overflow-x-auto'>
136
+ {items.map((item: NavMenuItem, i) => {
137
+ return isTooltipLinkItem(item) ? (
138
+ <NavMenuTooltipLinkItem key={i} {...item} />
139
+ ) : isLinkItem(item) ? (
140
+ <NavMenuLinkItem key={i} {...item} />
141
+ ) : isSeparator(item) ? (
142
+ <NavMenuSeparatorItem key={i} {...item} />
143
+ ) : (
144
+ <NavMenuInvokerItem key={i} {...item} />
145
+ );
146
+ })}
147
+
148
+ <NavigationMenuPrimitive.Indicator
149
+ className={cx(
150
+ 'z-10',
151
+ 'top-[100%] flex items-end justify-center h-2 overflow-hidden',
152
+ 'radix-state-visible:animate-fade-in',
153
+ 'radix-state-hidden:animate-fade-out',
154
+ 'transition-[width_transform] duration-[250ms] ease-[ease]'
155
+ )}
156
+ >
157
+ <div className='top-1 relative bg-white dark:bg-neutral-800 w-2 h-2 rotate-45' />
158
+ </NavigationMenuPrimitive.Indicator>
159
+ </NavigationMenuPrimitive.List>
160
+
161
+ <div
162
+ className={cx('absolute flex justify-center', 'w-[140%] left-[-20%] top-[100%]')}
163
+ style={{
164
+ perspective: '2000px'
165
+ }}
166
+ >
167
+ <NavigationMenuPrimitive.Viewport
168
+ className={cx(
169
+ 'relative mt-2 shadow-lg rounded-md bg-white dark:bg-neutral-800 overflow-hidden',
170
+ 'w-radix-navigation-menu-viewport',
171
+ 'h-radix-navigation-menu-viewport',
172
+ 'radix-state-open:animate-scale-in-content',
173
+ 'radix-state-closed:animate-scale-out-content',
174
+ 'origin-[top_center] transition-[width_height] duration-300 ease-[ease]'
175
+ )}
176
+ />
177
+ </div>
178
+ </NavigationMenuPrimitive.Root>
179
+ );
180
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ export * from './NavMenu';
@@ -0,0 +1,45 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import '@dxosTheme';
6
+ import cx from 'classnames';
7
+ import React from 'react';
8
+
9
+ import { defaultFocus, defaultHover, defaultActive } from '../../styles';
10
+ import { templateForComponent } from '../../testing';
11
+ import { Avatar } from '../Avatar';
12
+ import { Button } from '../Button';
13
+ import { Popover, PopoverProps } from './Popover';
14
+
15
+ export default {
16
+ title: 'react-ui/Popover',
17
+ component: Popover
18
+ };
19
+
20
+ const Template = ({ children, ...props }: PopoverProps) => {
21
+ return <Popover {...props}>{children}</Popover>;
22
+ };
23
+
24
+ export const Default = templateForComponent(Template)({
25
+ openTrigger: '',
26
+ closeLabel: '',
27
+ children: ''
28
+ });
29
+ Default.args = {
30
+ openTrigger: <Button>Open popover</Button>,
31
+ children: 'Popover content'
32
+ };
33
+
34
+ export const AvatarTrigger = templateForComponent(Template)({
35
+ openTrigger: (
36
+ <Avatar
37
+ tabIndex={0}
38
+ label={<span className='sr-only'>Open popover</span>}
39
+ fallbackValue='open popover'
40
+ className={cx('button-elevation cursor-pointer rounded-md', defaultHover({}), defaultFocus, defaultActive)}
41
+ />
42
+ ),
43
+ closeLabel: 'Close',
44
+ children: 'Popover content'
45
+ });