@dxos/react-ui 0.1.20 → 0.1.22

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 (331) hide show
  1. package/README.md +13 -137
  2. package/dist/lib/browser/index.mjs +160 -2022
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/types/src/components/IdentityListItem/IdentityListItem.d.ts +6 -0
  6. package/dist/types/src/components/IdentityListItem/IdentityListItem.d.ts.map +1 -0
  7. package/dist/types/src/components/IdentityListItem/IdentityListItem.stories.d.ts +20 -0
  8. package/dist/types/src/components/IdentityListItem/IdentityListItem.stories.d.ts.map +1 -0
  9. package/dist/types/src/composites/IdentityPopover/IdentityPopover.d.ts +9 -0
  10. package/dist/types/src/composites/IdentityPopover/IdentityPopover.d.ts.map +1 -0
  11. package/dist/types/src/composites/IdentityPopover/index.d.ts +2 -0
  12. package/dist/types/src/composites/IdentityPopover/index.d.ts.map +1 -0
  13. package/dist/types/src/composites/index.d.ts +2 -0
  14. package/dist/types/src/composites/index.d.ts.map +1 -0
  15. package/dist/types/src/index.d.ts +4 -4
  16. package/dist/types/src/index.d.ts.map +1 -1
  17. package/dist/types/src/layouts/PanelPopover/PanelPopover.d.ts +11 -0
  18. package/dist/types/src/layouts/PanelPopover/PanelPopover.d.ts.map +1 -0
  19. package/dist/types/src/layouts/PanelPopover/index.d.ts +2 -0
  20. package/dist/types/src/layouts/PanelPopover/index.d.ts.map +1 -0
  21. package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts +20 -0
  22. package/dist/types/src/layouts/PanelSidebar/PanelSidebar.d.ts.map +1 -0
  23. package/dist/types/src/layouts/PanelSidebar/index.d.ts +2 -0
  24. package/dist/types/src/layouts/PanelSidebar/index.d.ts.map +1 -0
  25. package/dist/types/src/layouts/index.d.ts +3 -0
  26. package/dist/types/src/layouts/index.d.ts.map +1 -0
  27. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts +6 -0
  28. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -0
  29. package/dist/types/src/panels/IdentityPanel/index.d.ts +2 -0
  30. package/dist/types/src/panels/IdentityPanel/index.d.ts.map +1 -0
  31. package/dist/types/src/panels/index.d.ts +2 -0
  32. package/dist/types/src/panels/index.d.ts.map +1 -0
  33. package/dist/types/src/styles/index.d.ts +1 -11
  34. package/dist/types/src/styles/index.d.ts.map +1 -1
  35. package/dist/types/src/styles/panelStyles.d.ts +3 -0
  36. package/dist/types/src/styles/panelStyles.d.ts.map +1 -0
  37. package/dist/types/src/testing/ClientProvider.d.ts +3 -0
  38. package/dist/types/src/testing/ClientProvider.d.ts.map +1 -0
  39. package/dist/types/src/testing/index.d.ts +1 -1
  40. package/dist/types/src/testing/index.d.ts.map +1 -1
  41. package/dist/types/src/translations/index.d.ts +5 -0
  42. package/dist/types/src/translations/index.d.ts.map +1 -0
  43. package/dist/types/src/translations/locales/en-US.d.ts +6 -0
  44. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -0
  45. package/package.json +16 -32
  46. package/src/components/IdentityListItem/IdentityListItem.stories.tsx +23 -0
  47. package/src/components/IdentityListItem/IdentityListItem.tsx +32 -0
  48. package/src/composites/IdentityPopover/IdentityPopover.tsx +54 -0
  49. package/src/composites/IdentityPopover/index.ts +5 -0
  50. package/src/composites/index.ts +4 -0
  51. package/src/index.ts +4 -4
  52. package/src/layouts/PanelPopover/PanelPopover.tsx +40 -0
  53. package/src/layouts/PanelPopover/index.ts +5 -0
  54. package/src/layouts/PanelSidebar/PanelSidebar.tsx +126 -0
  55. package/src/layouts/PanelSidebar/index.ts +5 -0
  56. package/src/layouts/index.ts +6 -0
  57. package/src/panels/IdentityPanel/IdentityPanel.tsx +39 -0
  58. package/src/panels/IdentityPanel/index.ts +5 -0
  59. package/src/panels/index.ts +5 -0
  60. package/src/styles/index.ts +2 -12
  61. package/src/styles/panelStyles.ts +6 -0
  62. package/src/testing/ClientProvider.tsx +18 -0
  63. package/src/testing/index.ts +1 -1
  64. package/src/translations/index.ts +7 -0
  65. package/src/translations/locales/en-US.ts +9 -0
  66. package/dist/plugin/node/esbuild-plugin.cjs +0 -469
  67. package/dist/plugin/node/esbuild-plugin.cjs.map +0 -7
  68. package/dist/plugin/node/meta.json +0 -1
  69. package/dist/plugin/node/plugin.cjs +0 -460
  70. package/dist/plugin/node/plugin.cjs.map +0 -7
  71. package/dist/plugin/node/theme.css +0 -61
  72. package/dist/plugin/node/theme.css.map +0 -7
  73. package/dist/types/src/components/Alert/Alert.d.ts +0 -15
  74. package/dist/types/src/components/Alert/Alert.d.ts.map +0 -1
  75. package/dist/types/src/components/Alert/Alert.stories.d.ts +0 -9
  76. package/dist/types/src/components/Alert/Alert.stories.d.ts.map +0 -1
  77. package/dist/types/src/components/Alert/index.d.ts +0 -2
  78. package/dist/types/src/components/Alert/index.d.ts.map +0 -1
  79. package/dist/types/src/components/AlertDialog/AlertDialog.d.ts +0 -26
  80. package/dist/types/src/components/AlertDialog/AlertDialog.d.ts.map +0 -1
  81. package/dist/types/src/components/AlertDialog/AlertDialog.stories.d.ts +0 -9
  82. package/dist/types/src/components/AlertDialog/AlertDialog.stories.d.ts.map +0 -1
  83. package/dist/types/src/components/AlertDialog/index.d.ts +0 -2
  84. package/dist/types/src/components/AlertDialog/index.d.ts.map +0 -1
  85. package/dist/types/src/components/Avatar/Avatar.d.ts +0 -22
  86. package/dist/types/src/components/Avatar/Avatar.d.ts.map +0 -1
  87. package/dist/types/src/components/Avatar/Avatar.stories.d.ts +0 -12
  88. package/dist/types/src/components/Avatar/Avatar.stories.d.ts.map +0 -1
  89. package/dist/types/src/components/Avatar/index.d.ts +0 -2
  90. package/dist/types/src/components/Avatar/index.d.ts.map +0 -1
  91. package/dist/types/src/components/Button/Button.d.ts +0 -4
  92. package/dist/types/src/components/Button/Button.d.ts.map +0 -1
  93. package/dist/types/src/components/Button/Button.stories.d.ts +0 -13
  94. package/dist/types/src/components/Button/Button.stories.d.ts.map +0 -1
  95. package/dist/types/src/components/Button/ButtonGroup.d.ts +0 -6
  96. package/dist/types/src/components/Button/ButtonGroup.d.ts.map +0 -1
  97. package/dist/types/src/components/Button/ButtonProps.d.ts +0 -7
  98. package/dist/types/src/components/Button/ButtonProps.d.ts.map +0 -1
  99. package/dist/types/src/components/Button/buttonStyles.d.ts +0 -6
  100. package/dist/types/src/components/Button/buttonStyles.d.ts.map +0 -1
  101. package/dist/types/src/components/Button/index.d.ts +0 -5
  102. package/dist/types/src/components/Button/index.d.ts.map +0 -1
  103. package/dist/types/src/components/CompoundButton/CompoundButton.d.ts +0 -10
  104. package/dist/types/src/components/CompoundButton/CompoundButton.d.ts.map +0 -1
  105. package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts +0 -10
  106. package/dist/types/src/components/CompoundButton/CompoundButton.stories.d.ts.map +0 -1
  107. package/dist/types/src/components/CompoundButton/index.d.ts +0 -2
  108. package/dist/types/src/components/CompoundButton/index.d.ts.map +0 -1
  109. package/dist/types/src/components/Dialog/Dialog.d.ts +0 -26
  110. package/dist/types/src/components/Dialog/Dialog.d.ts.map +0 -1
  111. package/dist/types/src/components/Dialog/Dialog.stories.d.ts +0 -9
  112. package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +0 -1
  113. package/dist/types/src/components/Dialog/index.d.ts +0 -2
  114. package/dist/types/src/components/Dialog/index.d.ts.map +0 -1
  115. package/dist/types/src/components/Group/Group.d.ts +0 -10
  116. package/dist/types/src/components/Group/Group.d.ts.map +0 -1
  117. package/dist/types/src/components/Group/Group.stories.d.ts +0 -9
  118. package/dist/types/src/components/Group/Group.stories.d.ts.map +0 -1
  119. package/dist/types/src/components/Group/index.d.ts +0 -2
  120. package/dist/types/src/components/Group/index.d.ts.map +0 -1
  121. package/dist/types/src/components/Heading/Heading.d.ts +0 -266
  122. package/dist/types/src/components/Heading/Heading.d.ts.map +0 -1
  123. package/dist/types/src/components/Heading/Heading.stories.d.ts +0 -274
  124. package/dist/types/src/components/Heading/Heading.stories.d.ts.map +0 -1
  125. package/dist/types/src/components/Heading/index.d.ts +0 -2
  126. package/dist/types/src/components/Heading/index.d.ts.map +0 -1
  127. package/dist/types/src/components/Input/BarePinInput.d.ts +0 -314
  128. package/dist/types/src/components/Input/BarePinInput.d.ts.map +0 -1
  129. package/dist/types/src/components/Input/BareTextInput.d.ts +0 -7
  130. package/dist/types/src/components/Input/BareTextInput.d.ts.map +0 -1
  131. package/dist/types/src/components/Input/BareTextareaInput.d.ts +0 -7
  132. package/dist/types/src/components/Input/BareTextareaInput.d.ts.map +0 -1
  133. package/dist/types/src/components/Input/Input.d.ts +0 -4
  134. package/dist/types/src/components/Input/Input.d.ts.map +0 -1
  135. package/dist/types/src/components/Input/Input.stories.d.ts +0 -27
  136. package/dist/types/src/components/Input/Input.stories.d.ts.map +0 -1
  137. package/dist/types/src/components/Input/InputProps.d.ts +0 -37
  138. package/dist/types/src/components/Input/InputProps.d.ts.map +0 -1
  139. package/dist/types/src/components/Input/index.d.ts +0 -2
  140. package/dist/types/src/components/Input/index.d.ts.map +0 -1
  141. package/dist/types/src/components/Loading/Loading.d.ts +0 -15
  142. package/dist/types/src/components/Loading/Loading.d.ts.map +0 -1
  143. package/dist/types/src/components/Loading/Loading.stories.d.ts +0 -23
  144. package/dist/types/src/components/Loading/Loading.stories.d.ts.map +0 -1
  145. package/dist/types/src/components/Loading/index.d.ts +0 -2
  146. package/dist/types/src/components/Loading/index.d.ts.map +0 -1
  147. package/dist/types/src/components/NavMenu/NavMenu.d.ts +0 -39
  148. package/dist/types/src/components/NavMenu/NavMenu.d.ts.map +0 -1
  149. package/dist/types/src/components/NavMenu/NavMenu.stories.d.ts +0 -9
  150. package/dist/types/src/components/NavMenu/NavMenu.stories.d.ts.map +0 -1
  151. package/dist/types/src/components/NavMenu/index.d.ts +0 -2
  152. package/dist/types/src/components/NavMenu/index.d.ts.map +0 -1
  153. package/dist/types/src/components/Popover/Popover.d.ts +0 -21
  154. package/dist/types/src/components/Popover/Popover.d.ts.map +0 -1
  155. package/dist/types/src/components/Popover/Popover.stories.d.ts +0 -10
  156. package/dist/types/src/components/Popover/Popover.stories.d.ts.map +0 -1
  157. package/dist/types/src/components/Popover/index.d.ts +0 -2
  158. package/dist/types/src/components/Popover/index.d.ts.map +0 -1
  159. package/dist/types/src/components/QrCode/QrCode.d.ts +0 -39
  160. package/dist/types/src/components/QrCode/QrCode.d.ts.map +0 -1
  161. package/dist/types/src/components/QrCode/QrCode.stories.d.ts +0 -10
  162. package/dist/types/src/components/QrCode/QrCode.stories.d.ts.map +0 -1
  163. package/dist/types/src/components/QrCode/index.d.ts +0 -2
  164. package/dist/types/src/components/QrCode/index.d.ts.map +0 -1
  165. package/dist/types/src/components/Tag/Tag.d.ts +0 -8
  166. package/dist/types/src/components/Tag/Tag.d.ts.map +0 -1
  167. package/dist/types/src/components/Tag/Tag.stories.d.ts +0 -10
  168. package/dist/types/src/components/Tag/Tag.stories.d.ts.map +0 -1
  169. package/dist/types/src/components/Tag/index.d.ts +0 -2
  170. package/dist/types/src/components/Tag/index.d.ts.map +0 -1
  171. package/dist/types/src/components/Toast/Toast.d.ts +0 -25
  172. package/dist/types/src/components/Toast/Toast.d.ts.map +0 -1
  173. package/dist/types/src/components/Toast/Toast.stories.d.ts +0 -9
  174. package/dist/types/src/components/Toast/Toast.stories.d.ts.map +0 -1
  175. package/dist/types/src/components/Toast/index.d.ts +0 -2
  176. package/dist/types/src/components/Toast/index.d.ts.map +0 -1
  177. package/dist/types/src/components/Tooltip/Tooltip.d.ts +0 -19
  178. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +0 -1
  179. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +0 -9
  180. package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +0 -1
  181. package/dist/types/src/components/Tooltip/index.d.ts +0 -2
  182. package/dist/types/src/components/Tooltip/index.d.ts.map +0 -1
  183. package/dist/types/src/components/UiProvider/UiProvider.d.ts +0 -10
  184. package/dist/types/src/components/UiProvider/UiProvider.d.ts.map +0 -1
  185. package/dist/types/src/components/UiProvider/index.d.ts +0 -2
  186. package/dist/types/src/components/UiProvider/index.d.ts.map +0 -1
  187. package/dist/types/src/components/index.d.ts +0 -18
  188. package/dist/types/src/components/index.d.ts.map +0 -1
  189. package/dist/types/src/config/index.d.ts +0 -2
  190. package/dist/types/src/config/index.d.ts.map +0 -1
  191. package/dist/types/src/config/tailwind.d.ts +0 -7
  192. package/dist/types/src/config/tailwind.d.ts.map +0 -1
  193. package/dist/types/src/esbuild-plugin.d.ts +0 -6
  194. package/dist/types/src/esbuild-plugin.d.ts.map +0 -1
  195. package/dist/types/src/hooks/index.d.ts +0 -4
  196. package/dist/types/src/hooks/index.d.ts.map +0 -1
  197. package/dist/types/src/hooks/useForwardedRef.d.ts +0 -2
  198. package/dist/types/src/hooks/useForwardedRef.d.ts.map +0 -1
  199. package/dist/types/src/hooks/useId.d.ts +0 -3
  200. package/dist/types/src/hooks/useId.d.ts.map +0 -1
  201. package/dist/types/src/hooks/useIsFocused.d.ts +0 -3
  202. package/dist/types/src/hooks/useIsFocused.d.ts.map +0 -1
  203. package/dist/types/src/plugin.d.ts +0 -9
  204. package/dist/types/src/plugin.d.ts.map +0 -1
  205. package/dist/types/src/props/Elevation.d.ts +0 -2
  206. package/dist/types/src/props/Elevation.d.ts.map +0 -1
  207. package/dist/types/src/props/MessageValence.d.ts +0 -2
  208. package/dist/types/src/props/MessageValence.d.ts.map +0 -1
  209. package/dist/types/src/props/Size.d.ts +0 -2
  210. package/dist/types/src/props/Size.d.ts.map +0 -1
  211. package/dist/types/src/props/index.d.ts +0 -4
  212. package/dist/types/src/props/index.d.ts.map +0 -1
  213. package/dist/types/src/styles/active.d.ts +0 -2
  214. package/dist/types/src/styles/active.d.ts.map +0 -1
  215. package/dist/types/src/styles/disabled.d.ts +0 -2
  216. package/dist/types/src/styles/disabled.d.ts.map +0 -1
  217. package/dist/types/src/styles/focus.d.ts +0 -3
  218. package/dist/types/src/styles/focus.d.ts.map +0 -1
  219. package/dist/types/src/styles/group.d.ts +0 -7
  220. package/dist/types/src/styles/group.d.ts.map +0 -1
  221. package/dist/types/src/styles/hover.d.ts +0 -4
  222. package/dist/types/src/styles/hover.d.ts.map +0 -1
  223. package/dist/types/src/styles/input.d.ts +0 -11
  224. package/dist/types/src/styles/input.d.ts.map +0 -1
  225. package/dist/types/src/styles/ornament.d.ts +0 -3
  226. package/dist/types/src/styles/ornament.d.ts.map +0 -1
  227. package/dist/types/src/styles/shimmer.d.ts +0 -3
  228. package/dist/types/src/styles/shimmer.d.ts.map +0 -1
  229. package/dist/types/src/styles/size.d.ts +0 -7
  230. package/dist/types/src/styles/size.d.ts.map +0 -1
  231. package/dist/types/src/styles/text.d.ts +0 -5
  232. package/dist/types/src/styles/text.d.ts.map +0 -1
  233. package/dist/types/src/styles/valence.d.ts +0 -19
  234. package/dist/types/src/styles/valence.d.ts.map +0 -1
  235. package/dist/types/src/testing/templateForComponent.d.ts +0 -4
  236. package/dist/types/src/testing/templateForComponent.d.ts.map +0 -1
  237. package/dist/types/src/util/index.d.ts +0 -2
  238. package/dist/types/src/util/index.d.ts.map +0 -1
  239. package/dist/types/src/util/mx.d.ts +0 -2
  240. package/dist/types/src/util/mx.d.ts.map +0 -1
  241. package/dist/types/src/util/withLogical.d.ts +0 -3
  242. package/dist/types/src/util/withLogical.d.ts.map +0 -1
  243. package/plugin.d.ts +0 -5
  244. package/plugin.js +0 -8
  245. package/src/components/Alert/Alert.stories.tsx +0 -31
  246. package/src/components/Alert/Alert.tsx +0 -40
  247. package/src/components/Alert/index.ts +0 -5
  248. package/src/components/AlertDialog/AlertDialog.stories.tsx +0 -35
  249. package/src/components/AlertDialog/AlertDialog.tsx +0 -147
  250. package/src/components/AlertDialog/index.ts +0 -5
  251. package/src/components/Avatar/Avatar.stories.tsx +0 -29
  252. package/src/components/Avatar/Avatar.tsx +0 -104
  253. package/src/components/Avatar/index.ts +0 -5
  254. package/src/components/Button/Button.stories.tsx +0 -45
  255. package/src/components/Button/Button.tsx +0 -20
  256. package/src/components/Button/ButtonGroup.tsx +0 -23
  257. package/src/components/Button/ButtonProps.ts +0 -11
  258. package/src/components/Button/buttonStyles.ts +0 -35
  259. package/src/components/Button/index.ts +0 -8
  260. package/src/components/CompoundButton/CompoundButton.stories.tsx +0 -46
  261. package/src/components/CompoundButton/CompoundButton.tsx +0 -53
  262. package/src/components/CompoundButton/index.ts +0 -5
  263. package/src/components/Dialog/Dialog.stories.tsx +0 -37
  264. package/src/components/Dialog/Dialog.tsx +0 -157
  265. package/src/components/Dialog/index.ts +0 -5
  266. package/src/components/Group/Group.stories.tsx +0 -25
  267. package/src/components/Group/Group.tsx +0 -32
  268. package/src/components/Group/index.ts +0 -5
  269. package/src/components/Heading/Heading.stories.tsx +0 -29
  270. package/src/components/Heading/Heading.tsx +0 -29
  271. package/src/components/Heading/index.ts +0 -5
  272. package/src/components/Input/BarePinInput.tsx +0 -67
  273. package/src/components/Input/BareTextInput.tsx +0 -48
  274. package/src/components/Input/BareTextareaInput.tsx +0 -39
  275. package/src/components/Input/Input.stories.tsx +0 -108
  276. package/src/components/Input/Input.tsx +0 -115
  277. package/src/components/Input/InputProps.ts +0 -47
  278. package/src/components/Input/index.ts +0 -5
  279. package/src/components/Loading/Loading.stories.tsx +0 -34
  280. package/src/components/Loading/Loading.tsx +0 -69
  281. package/src/components/Loading/index.ts +0 -5
  282. package/src/components/NavMenu/NavMenu.stories.tsx +0 -54
  283. package/src/components/NavMenu/NavMenu.tsx +0 -203
  284. package/src/components/NavMenu/index.ts +0 -5
  285. package/src/components/Popover/Popover.stories.tsx +0 -49
  286. package/src/components/Popover/Popover.tsx +0 -110
  287. package/src/components/Popover/index.ts +0 -5
  288. package/src/components/QrCode/QrCode.stories.tsx +0 -42
  289. package/src/components/QrCode/QrCode.tsx +0 -165
  290. package/src/components/QrCode/index.ts +0 -5
  291. package/src/components/Tag/Tag.stories.tsx +0 -23
  292. package/src/components/Tag/Tag.tsx +0 -32
  293. package/src/components/Tag/index.ts +0 -5
  294. package/src/components/Toast/Toast.stories.tsx +0 -31
  295. package/src/components/Toast/Toast.tsx +0 -106
  296. package/src/components/Toast/index.ts +0 -5
  297. package/src/components/Tooltip/Tooltip.stories.tsx +0 -28
  298. package/src/components/Tooltip/Tooltip.tsx +0 -88
  299. package/src/components/Tooltip/index.ts +0 -5
  300. package/src/components/UiProvider/UiProvider.tsx +0 -44
  301. package/src/components/UiProvider/index.ts +0 -5
  302. package/src/components/index.ts +0 -21
  303. package/src/config/index.ts +0 -5
  304. package/src/config/tailwind.ts +0 -250
  305. package/src/esbuild-plugin.ts +0 -42
  306. package/src/hooks/index.ts +0 -7
  307. package/src/hooks/useForwardedRef.ts +0 -22
  308. package/src/hooks/useId.ts +0 -21
  309. package/src/hooks/useIsFocused.ts +0 -38
  310. package/src/plugin.ts +0 -44
  311. package/src/props/Elevation.ts +0 -5
  312. package/src/props/MessageValence.ts +0 -5
  313. package/src/props/Size.ts +0 -40
  314. package/src/props/index.ts +0 -7
  315. package/src/styles/active.ts +0 -11
  316. package/src/styles/disabled.ts +0 -5
  317. package/src/styles/focus.ts +0 -9
  318. package/src/styles/group.ts +0 -35
  319. package/src/styles/hover.ts +0 -10
  320. package/src/styles/input.ts +0 -46
  321. package/src/styles/ornament.ts +0 -6
  322. package/src/styles/shimmer.ts +0 -9
  323. package/src/styles/size.ts +0 -86
  324. package/src/styles/text.ts +0 -10
  325. package/src/styles/valence.ts +0 -71
  326. package/src/testing/templateForComponent.tsx +0 -16
  327. package/src/theme.css +0 -65
  328. package/src/typings.d.ts +0 -7
  329. package/src/util/index.ts +0 -5
  330. package/src/util/mx.ts +0 -28
  331. package/src/util/withLogical.ts +0 -103
@@ -1,48 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import React, { ComponentProps } from 'react';
6
-
7
- import { defaultInput } from '../../styles/input';
8
- import { mx } from '../../util';
9
- import { InputProps, InputSize, InputSlots } from './InputProps';
10
-
11
- const sizeMap: Record<InputSize, string> = {
12
- md: 'text-base',
13
- lg: 'text-lg',
14
- pin: '',
15
- textarea: ''
16
- };
17
-
18
- export type BareTextInputProps = Omit<InputProps, 'label' | 'initialValue' | 'onChange' | 'slots'> &
19
- Pick<ComponentProps<'input'>, 'onChange' | 'value'> & { inputSlot: InputSlots['input'] };
20
-
21
- export const BareTextInput = ({
22
- validationValence,
23
- validationMessage,
24
- size,
25
- disabled,
26
- placeholder,
27
- onChange,
28
- value,
29
- inputSlot
30
- }: BareTextInputProps) => {
31
- return (
32
- <input
33
- {...inputSlot}
34
- placeholder={placeholder}
35
- onChange={onChange}
36
- value={value}
37
- className={mx(
38
- defaultInput({
39
- disabled,
40
- ...(validationMessage && { validationValence })
41
- }),
42
- sizeMap[size ?? 'md'],
43
- 'block w-full px-2.5 py-2',
44
- inputSlot?.className
45
- )}
46
- />
47
- );
48
- };
@@ -1,39 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import React, { ComponentProps } from 'react';
6
-
7
- import { defaultInput } from '../../styles/input';
8
- import { mx } from '../../util';
9
- import { TextareaProps, TextareaSlots } from './InputProps';
10
-
11
- export type BareTextareaInputProps = Omit<TextareaProps, 'label' | 'initialValue' | 'onChange' | 'slots'> &
12
- Pick<ComponentProps<'textarea'>, 'onChange' | 'value'> & { inputSlot: TextareaSlots['input'] };
13
-
14
- export const BareTextareaInput = ({
15
- validationValence,
16
- validationMessage,
17
- onChange,
18
- value,
19
- disabled,
20
- placeholder,
21
- inputSlot
22
- }: BareTextareaInputProps) => {
23
- return (
24
- <textarea
25
- {...inputSlot}
26
- placeholder={placeholder}
27
- onChange={onChange}
28
- value={value}
29
- className={mx(
30
- defaultInput({
31
- disabled,
32
- ...(validationMessage && { validationValence })
33
- }),
34
- 'block w-full px-2.5 py-2',
35
- inputSlot?.className
36
- )}
37
- />
38
- );
39
- };
@@ -1,108 +0,0 @@
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
- size: {
21
- control: 'select',
22
- options: ['md', 'lg', 'pin']
23
- }
24
- }
25
- };
26
-
27
- const Template = (props: InputProps) => {
28
- return <Input {...props} />;
29
- };
30
-
31
- export const Default = templateForComponent(Template)({ label: '' });
32
- Default.args = {
33
- label: 'Hello',
34
- placeholder: 'This is an input',
35
- disabled: false,
36
- description: undefined,
37
- labelVisuallyHidden: false,
38
- descriptionVisuallyHidden: false,
39
- validationMessage: '',
40
- validationValence: undefined,
41
- length: 6
42
- };
43
-
44
- export const Disabled = () => (
45
- <Template
46
- {...{
47
- label: 'Disabled',
48
- placeholder: 'This is a disabled input',
49
- disabled: true
50
- }}
51
- />
52
- );
53
-
54
- export const LabelVisuallyHidden = () => (
55
- <Template
56
- {...{
57
- label: 'The label is for screen readers',
58
- labelVisuallyHidden: true,
59
- placeholder: 'The label for this input exists but is only read by screen readers'
60
- }}
61
- />
62
- );
63
-
64
- export const InputWithDescription = () => (
65
- <Template
66
- {...{
67
- label: 'Described input',
68
- placeholder: 'This input has an accessible description',
69
- description: 'This helper text is accessibly associated with the input.'
70
- }}
71
- />
72
- );
73
-
74
- export const InputWithErrorAndDescription = () => (
75
- <Template
76
- {...{
77
- label: 'Described invalid input',
78
- placeholder: 'This input has both an accessible description and a validation error',
79
- description: 'This description is identified separately in the accessibility tree.',
80
- validationValence: 'error',
81
- validationMessage: 'The input has an error.'
82
- }}
83
- />
84
- );
85
-
86
- export const InputWithValidationAndDescription = () => (
87
- <Template
88
- {...{
89
- label: 'Described input with validation message',
90
- placeholder: 'This input is styled to express a validation valence',
91
- description: 'This description is extra.',
92
- validationValence: 'success',
93
- validationMessage: 'This validation message is really part of the description.'
94
- }}
95
- />
96
- );
97
-
98
- export const PinInput = () => (
99
- <Template
100
- {...{
101
- label: 'This input is a PIN-style input',
102
- size: 'pin',
103
- length: 6,
104
- description: 'Type in secret you received',
105
- placeholder: '••••••'
106
- }}
107
- />
108
- );
@@ -1,115 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import React, { ChangeEvent, useCallback, useState, useTransition } from 'react';
6
-
7
- import { useId } from '../../hooks';
8
- import { defaultDescription, valenceColorText } from '../../styles';
9
- import { mx } from '../../util';
10
- import { BarePinInput } from './BarePinInput';
11
- import { BareTextInput } from './BareTextInput';
12
- import { BareTextareaInput, BareTextareaInputProps } from './BareTextareaInput';
13
- import { InputProps as NaturalInputProps } from './InputProps';
14
-
15
- export type InputProps = NaturalInputProps;
16
-
17
- export const Input = ({
18
- label,
19
- labelVisuallyHidden,
20
- description,
21
- descriptionVisuallyHidden,
22
- initialValue,
23
- onChange,
24
- disabled,
25
- placeholder,
26
- size,
27
- length = 6,
28
- validationMessage,
29
- validationValence,
30
- slots = {}
31
- }: InputProps) => {
32
- const inputId = slots.input?.id ?? useId('input');
33
- const descriptionId = useId('input-description');
34
- const validationId = useId('input-validation');
35
-
36
- const isInvalid = !!validationMessage && validationValence === 'error';
37
-
38
- const [_isPending, startTransition] = useTransition();
39
-
40
- const [internalValue, setInternalValue] = useState<string>(initialValue?.toString() || '');
41
-
42
- const onInternalChange = useCallback(
43
- (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
44
- const nextValue = e.target?.value || '';
45
- setInternalValue(nextValue);
46
- onChange &&
47
- startTransition(() => {
48
- onChange(nextValue);
49
- });
50
- },
51
- [onChange]
52
- );
53
-
54
- const bareInputBaseProps = {
55
- ...slots.input,
56
- id: inputId,
57
- ...(slots.input?.required && { required: true }),
58
- ...(disabled && { disabled: true }),
59
- ...(description && { 'aria-describedby': descriptionId }),
60
- ...(isInvalid && {
61
- 'aria-invalid': 'true' as const,
62
- 'aria-errormessage': validationId
63
- }),
64
- placeholder,
65
- value: internalValue,
66
- onChange: onInternalChange,
67
- inputSlot: slots.input,
68
- validationMessage,
69
- validationValence
70
- };
71
-
72
- const bareInput =
73
- size === 'pin' ? (
74
- <BarePinInput {...bareInputBaseProps} length={length} />
75
- ) : size === 'textarea' ? (
76
- <BareTextareaInput {...(bareInputBaseProps as BareTextareaInputProps)} />
77
- ) : (
78
- <BareTextInput {...bareInputBaseProps} size={size} />
79
- );
80
-
81
- return (
82
- <div role='none' className={mx('mlb-4', slots.root?.className)}>
83
- <label
84
- {...slots.label}
85
- htmlFor={inputId}
86
- className={mx(
87
- 'block pbe-1 text-sm font-medium text-neutral-900 dark:text-neutral-100',
88
- labelVisuallyHidden && 'sr-only',
89
- slots.label?.className
90
- )}
91
- >
92
- {label}
93
- </label>
94
- {bareInput}
95
- {(description || validationMessage) && (
96
- <p
97
- {...(!isInvalid && { id: descriptionId })}
98
- className={mx(descriptionVisuallyHidden && !isInvalid && 'sr-only')}
99
- >
100
- {validationMessage && (
101
- <span id={validationId} className={mx(valenceColorText(validationValence), slots.validation?.className)}>
102
- {validationMessage}{' '}
103
- </span>
104
- )}
105
- <span
106
- {...(isInvalid && { id: descriptionId })}
107
- className={mx(defaultDescription, descriptionVisuallyHidden && 'sr-only', slots.description?.className)}
108
- >
109
- {description}
110
- </span>
111
- </p>
112
- )}
113
- </div>
114
- );
115
- };
@@ -1,47 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { ComponentProps, ReactNode } from 'react';
6
-
7
- import { MessageValence } from '../../props';
8
-
9
- export type InputSize = 'md' | 'lg' | 'pin' | 'textarea';
10
-
11
- interface SharedTextInputProps {
12
- label: ReactNode;
13
- placeholder?: string;
14
- labelVisuallyHidden?: boolean;
15
- description?: ReactNode;
16
- descriptionVisuallyHidden?: boolean;
17
- initialValue?: string;
18
- onChange?: (value: string) => void;
19
- disabled?: boolean;
20
- size?: InputSize;
21
- validationMessage?: ReactNode;
22
- validationValence?: MessageValence;
23
- length?: number;
24
- }
25
-
26
- interface SharedSlots {
27
- root?: Omit<ComponentProps<'div'>, 'children'>;
28
- label?: Omit<ComponentProps<'label'>, 'children'>;
29
- description?: Pick<ComponentProps<'span'>, 'className'>;
30
- validation?: Pick<ComponentProps<'span'>, 'className'>;
31
- }
32
-
33
- export interface InputSlots extends SharedSlots {
34
- input?: Omit<ComponentProps<'input'>, 'value' | 'onChange' | 'size' | 'ref' | 'disabled' | 'placeholder'>;
35
- }
36
-
37
- export interface TextareaSlots extends SharedSlots {
38
- input?: Omit<ComponentProps<'textarea'>, 'value' | 'onChange' | 'size' | 'ref' | 'disabled' | 'placeholder'>;
39
- }
40
-
41
- export interface InputProps extends SharedTextInputProps {
42
- slots?: InputSlots;
43
- }
44
-
45
- export interface TextareaProps extends SharedTextInputProps {
46
- slots?: TextareaSlots;
47
- }
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export * from './Input';
@@ -1,34 +0,0 @@
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'} />;
@@ -1,69 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import React, { ComponentProps } from 'react';
6
-
7
- import { useId } from '../../hooks';
8
- import { mx } from '../../util';
9
-
10
- export type LoadingSize = 'sm' | 'md' | 'lg' | 'xl';
11
-
12
- export type LoadingColor = 'primary' | 'neutral';
13
-
14
- export interface LoadingSlots {
15
- root?: Omit<ComponentProps<'div'>, 'children'>;
16
- svg?: Pick<ComponentProps<'svg'>, 'className'>;
17
- }
18
-
19
- export interface LoadingProps {
20
- label: string;
21
- size?: LoadingSize;
22
- color?: LoadingColor;
23
- slots?: LoadingSlots;
24
- }
25
-
26
- const sizeMap = new Map<LoadingSize, string>([
27
- ['sm', 'w-4 h-4'],
28
- ['md', 'w-8 h-8'],
29
- ['lg', 'w-12 h-12'],
30
- ['xl', 'w-16 h-16']
31
- ]);
32
-
33
- export const Loading = ({ size, color, label, slots = {} }: LoadingProps) => {
34
- const labelId = useId('loading-label');
35
- const sizeClassName = sizeMap.get(size ?? 'md');
36
- return (
37
- <div
38
- {...slots.root}
39
- className={mx('flex justify-center p-4', slots.root?.className)}
40
- role='status'
41
- aria-labelledby={labelId}
42
- >
43
- <svg
44
- role='none'
45
- className={mx(
46
- sizeClassName,
47
- 'text-neutral-200/50 animate-spin dark:text-neutral-600/50',
48
- color === 'neutral' ? 'fill-neutral-400' : 'fill-primary-400',
49
- slots.svg?.className
50
- )}
51
- viewBox='0 0 100 101'
52
- fill='none'
53
- xmlns='http://www.w3.org/2000/svg'
54
- >
55
- <path
56
- 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'
57
- fill='currentColor'
58
- />
59
- <path
60
- 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'
61
- fill='currentFill'
62
- />
63
- </svg>
64
- <span className='sr-only' id={labelId}>
65
- {label}
66
- </span>
67
- </div>
68
- );
69
- };
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export * from './Loading';
@@ -1,54 +0,0 @@
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
- slots: { content: { sideOffset: 8 } }
50
- },
51
- children: 'Goodbye'
52
- }
53
- ]
54
- };