@dxos/react-ui 0.1.20 → 0.1.21

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 +158 -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 +19 -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,38 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- // Based upon the useIsFocused hook which is part of the `rci` project:
6
- /// https://github.com/leonardodino/rci/blob/main/packages/use-is-focused
7
-
8
- import { useEffect, useRef, useState, RefObject } from 'react';
9
-
10
- export const useIsFocused = (inputRef: RefObject<HTMLInputElement>) => {
11
- const [isFocused, setIsFocused] = useState<boolean | undefined>(undefined);
12
- const isFocusedRef = useRef<boolean | undefined>(isFocused);
13
-
14
- isFocusedRef.current = isFocused;
15
-
16
- useEffect(() => {
17
- const input = inputRef.current;
18
- if (!input) {
19
- return;
20
- }
21
-
22
- const onFocus = () => setIsFocused(true);
23
- const onBlur = () => setIsFocused(false);
24
- input.addEventListener('focus', onFocus);
25
- input.addEventListener('blur', onBlur);
26
-
27
- if (isFocusedRef.current === undefined) {
28
- setIsFocused(document.activeElement === input);
29
- }
30
-
31
- return () => {
32
- input.removeEventListener('focus', onFocus);
33
- input.removeEventListener('blur', onBlur);
34
- };
35
- }, [inputRef, setIsFocused]);
36
-
37
- return isFocused;
38
- };
package/src/plugin.ts DELETED
@@ -1,44 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import autoprefixer from 'autoprefixer';
6
- import { resolve } from 'node:path';
7
- import tailwindcss from 'tailwindcss';
8
- import { Plugin } from 'vite';
9
-
10
- import { tailwindConfig } from './config';
11
-
12
- export interface VitePluginTailwindOptions {
13
- jit?: boolean;
14
- cssPath?: string;
15
- virtualFileId?: string;
16
- content: string[];
17
- }
18
-
19
- export const ThemePlugin = (options: Pick<VitePluginTailwindOptions, 'content'>) => {
20
- const config: VitePluginTailwindOptions = {
21
- jit: true,
22
- cssPath: resolve(__dirname, './theme.css'),
23
- virtualFileId: '@dxosTheme',
24
- ...options
25
- };
26
-
27
- return {
28
- name: 'vite-plugin-dxos-ui-theme',
29
- config: ({ root }, env) => {
30
- return {
31
- css: {
32
- postcss: {
33
- plugins: [tailwindcss(tailwindConfig({ env: env.mode, root, content: options.content })), autoprefixer]
34
- }
35
- }
36
- };
37
- },
38
- resolveId: (id) => {
39
- if (id === config.virtualFileId) {
40
- return config.cssPath;
41
- }
42
- }
43
- } as Plugin;
44
- };
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export type Elevation = 0 | 1 | 2 | 3 | 4 | 5 | 6;
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export type MessageValence = 'success' | 'info' | 'warning' | 'error' | 'neutral';
package/src/props/Size.ts DELETED
@@ -1,40 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export type Size =
6
- | 0
7
- | 'px'
8
- | 0.5
9
- | 1
10
- | 1.5
11
- | 2
12
- | 2.5
13
- | 3
14
- | 3.5
15
- | 4
16
- | 5
17
- | 6
18
- | 7
19
- | 8
20
- | 9
21
- | 10
22
- | 11
23
- | 12
24
- | 14
25
- | 16
26
- | 20
27
- | 24
28
- | 28
29
- | 32
30
- | 36
31
- | 40
32
- | 44
33
- | 48
34
- | 52
35
- | 56
36
- | 60
37
- | 64
38
- | 72
39
- | 80
40
- | 96;
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export * from './Elevation';
6
- export * from './MessageValence';
7
- export * from './Size';
@@ -1,11 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { mx } from '../util';
6
-
7
- export const defaultActive = mx(
8
- 'radix-state-open:outline-2 radix-state-open:outline-offset-1 radix-state-open:outline-primary-300 radix-state-open:outline-offset-transparent dark:radix-state-open:outline-primary-400 dark:radix-state-open:outline-offset-transparent',
9
- 'radix-state-on:outline-2 radix-state-on:outline-offset-1 radix-state-on:outline-primary-300 radix-state-on:outline-offset-transparent dark:radix-state-on:outline-primary-400 dark:radix-state-on:outline-offset-transparent',
10
- 'radix-state-instant-open:outline-2 radix-state-instant-open:outline-offset-1 radix-state-instant-open:outline-primary-300 radix-state-instant-open:outline-offset-transparent dark:radix-state-instant-open:outline-primary-400 dark:radix-state-instant-open:outline-offset-transparent'
11
- );
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export const defaultDisabled = 'opacity-50 cursor-not-allowed shadow-none';
@@ -1,9 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export const defaultFocus =
6
- 'focus:outline-none focus-visible:z-[1] focus-visible:hover:outline-none dark:focus-visible:hover:outline-none focus-visible:ring focus-visible:ring-offset-1 focus-visible:ring-primary-500 focus-visible:ring-offset-white dark:focus-visible:ring-primary-200 dark:focus-visible:ring-offset-black';
7
-
8
- export const staticFocus =
9
- 'ring ring-offset-1 ring-primary-500 ring-offset-white dark:ring-primary-200 dark:ring-offset-black';
@@ -1,35 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { Elevation } from '../props';
6
- import { mx } from '../util';
7
-
8
- const elevationClassNameMap = new Map<number, string>([
9
- [0, 'shadow-none'],
10
- [1, 'shadow-sm'],
11
- [2, 'shadow'],
12
- [3, 'shadow-md'],
13
- [4, 'shadow-lg'],
14
- [5, 'shadow-xl'],
15
- [6, 'shadow-2xl']
16
- ]);
17
-
18
- export const defaultGroup = ({
19
- elevation,
20
- rounding,
21
- spacing
22
- }: {
23
- elevation: Elevation;
24
- rounding?: string;
25
- spacing?: string;
26
- }) => {
27
- return mx(
28
- rounding ?? 'rounded-lg',
29
- spacing ?? 'p-4',
30
- elevation === 0
31
- ? 'bg-transparent border border-neutral-200 dark:border-neutral-700'
32
- : 'bg-white dark:bg-neutral-800 elevated-buttons',
33
- elevationClassNameMap.get(elevation)
34
- );
35
- };
@@ -1,10 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export const defaultHover = ({ disabled }: { disabled?: boolean }) => {
6
- return (
7
- !disabled &&
8
- 'outline outline-3 outline-transparent hover:z-[1] hover:outline-primary-300 dark:hover:outline-primary-400 hover:focus:outline-primary-300 dark:hover:focus:outline-primary-400'
9
- );
10
- };
@@ -1,46 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { MessageValence } from '../props';
6
- import { mx } from '../util';
7
- import { defaultDisabled } from './disabled';
8
- import { defaultFocus, staticFocus } from './focus';
9
- import { defaultHover } from './hover';
10
- import { defaultPlaceholder } from './text';
11
- import { valenceInputBorder } from './valence';
12
-
13
- export const defaultInput = ({
14
- disabled,
15
- validationValence
16
- }: {
17
- disabled?: boolean;
18
- validationValence?: MessageValence;
19
- }) => {
20
- return mx(
21
- 'text-base border rounded bg-white/50 text-neutral-900 dark:bg-neutral-700/50 dark:text-white',
22
- defaultFocus,
23
- defaultPlaceholder,
24
- defaultHover({ disabled }),
25
- valenceInputBorder(validationValence),
26
- disabled && defaultDisabled
27
- );
28
- };
29
-
30
- export const staticInput = ({
31
- disabled,
32
- focused,
33
- validationValence
34
- }: {
35
- disabled?: boolean;
36
- focused?: boolean;
37
- validationValence?: MessageValence;
38
- }) => {
39
- return mx(
40
- defaultPlaceholder,
41
- 'text-base border rounded bg-white/50 text-neutral-900 dark:bg-neutral-700/50 dark:text-white',
42
- valenceInputBorder(validationValence),
43
- disabled && defaultDisabled,
44
- focused && staticFocus
45
- );
46
- };
@@ -1,6 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export const defaultInlineSeparator = 'border-is border-neutral-300 dark:border-neutral-700';
6
- export const defaultBlockSeparator = 'border-bs border-neutral-300 dark:border-neutral-700';
@@ -1,9 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export const defaultShimmer =
6
- 'relative before:absolute before:inset-0 before:-translate-x-full before:animate-shimmer before:bg-gradient-to-r before:from-transparent before:via-neutral-100/10 before:to-transparent isolate overflow-hidden';
7
-
8
- export const strongShimmer =
9
- 'relative before:absolute before:inset-0 before:-translate-x-full before:animate-shimmer before:bg-gradient-to-r before:from-transparent before:via-primary-100/80 before:to-transparent isolate overflow-hidden';
@@ -1,86 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { Size } from '../props';
6
- import { mx } from '../util';
7
-
8
- export const sizeWidthMap = new Map<Size, string>([
9
- [0, 'w-0'],
10
- ['px', 'w-px'],
11
- [0.5, 'w-0.5'],
12
- [1, 'w-1'],
13
- [1.5, 'w-1.5'],
14
- [2, 'w-2'],
15
- [2.5, 'w-2.5'],
16
- [3, 'w-3'],
17
- [3.5, 'w-3.5'],
18
- [4, 'w-4'],
19
- [5, 'w-5'],
20
- [6, 'w-6'],
21
- [7, 'w-7'],
22
- [8, 'w-8'],
23
- [9, 'w-9'],
24
- [10, 'w-10'],
25
- [11, 'w-11'],
26
- [12, 'w-12'],
27
- [14, 'w-14'],
28
- [16, 'w-16'],
29
- [20, 'w-20'],
30
- [24, 'w-24'],
31
- [28, 'w-28'],
32
- [32, 'w-32'],
33
- [36, 'w-36'],
34
- [40, 'w-40'],
35
- [44, 'w-44'],
36
- [48, 'w-48'],
37
- [52, 'w-52'],
38
- [56, 'w-56'],
39
- [60, 'w-60'],
40
- [64, 'w-64'],
41
- [72, 'w-72'],
42
- [80, 'w-80'],
43
- [96, 'w-96']
44
- ]);
45
-
46
- export const sizeHeightMap = new Map<Size, string>([
47
- [0, 'h-0'],
48
- ['px', 'h-px'],
49
- [0.5, 'h-0.5'],
50
- [1, 'h-1'],
51
- [1.5, 'h-1.5'],
52
- [2, 'h-2'],
53
- [2.5, 'h-2.5'],
54
- [3, 'h-3'],
55
- [3.5, 'h-3.5'],
56
- [4, 'h-4'],
57
- [5, 'h-5'],
58
- [6, 'h-6'],
59
- [7, 'h-7'],
60
- [8, 'h-8'],
61
- [9, 'h-9'],
62
- [10, 'h-10'],
63
- [11, 'h-11'],
64
- [12, 'h-12'],
65
- [14, 'h-14'],
66
- [16, 'h-16'],
67
- [20, 'h-20'],
68
- [24, 'h-24'],
69
- [28, 'h-28'],
70
- [32, 'h-32'],
71
- [36, 'h-36'],
72
- [40, 'h-40'],
73
- [44, 'h-44'],
74
- [48, 'h-48'],
75
- [52, 'h-52'],
76
- [56, 'h-56'],
77
- [60, 'h-60'],
78
- [64, 'h-64'],
79
- [72, 'h-72'],
80
- [80, 'h-80'],
81
- [96, 'h-96']
82
- ]);
83
-
84
- export const getSizeHeight = sizeHeightMap.get.bind(sizeHeightMap);
85
- export const getSizeWidth = sizeWidthMap.get.bind(sizeWidthMap);
86
- export const getSize = (size: Size) => mx(getSizeHeight(size), getSizeWidth(size));
@@ -1,10 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export const defaultPlaceholder = 'placeholder-neutral-500 dark:placeholder-neutral-400';
6
-
7
- export const defaultDescription = 'text-xs font-normal text-neutral-650 dark:text-neutral-300';
8
- export const primaryDescription = 'text-xs font-normal text-white/90';
9
-
10
- export const defaultTooltip = 'text-xs font-normal text-neutral-900 dark:text-neutral-50';
@@ -1,71 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { MessageValence } from '../props';
6
-
7
- export const successText = 'text-xs font-medium text-success-700 dark:text-success-300';
8
- export const infoText = 'text-xs font-medium text-info-700 dark:text-info-300';
9
- export const warningText = 'text-xs font-medium text-warning-700 dark:text-warning-300';
10
- export const errorText = 'text-xs font-medium text-error-700 dark:text-error-300';
11
-
12
- export const valenceColorText = (valence?: MessageValence) => {
13
- switch (valence) {
14
- case 'success':
15
- return successText;
16
- case 'info':
17
- return infoText;
18
- case 'warning':
19
- return warningText;
20
- case 'error':
21
- return errorText;
22
- default:
23
- return undefined;
24
- }
25
- };
26
-
27
- export const neutralInputBorder = 'border-neutral-500 dark:border-neutral-600';
28
- export const successInputBorder = 'border-success-500 dark:border-success-600';
29
- export const infoInputBorder = 'border-info-500 dark:border-info-600';
30
- export const warningInputBorder = 'border-warning-500 dark:border-warning-600';
31
- export const errorInputBorder = 'border-error-500 dark:border-error-600';
32
-
33
- export const valenceInputBorder = (valence?: MessageValence) => {
34
- switch (valence) {
35
- case 'success':
36
- return successInputBorder;
37
- case 'info':
38
- return infoInputBorder;
39
- case 'warning':
40
- return warningInputBorder;
41
- case 'error':
42
- return errorInputBorder;
43
- default:
44
- return neutralInputBorder;
45
- }
46
- };
47
-
48
- export const neutralAlertColors = 'border-neutral-500 dark:border-neutral-600';
49
- export const successAlertColors =
50
- 'border-success-500 dark:border-success-600 text-success-700 dark:text-success-100 bg-success-50 dark:bg-success-900';
51
- export const infoAlertColors =
52
- 'border-info-500 dark:border-info-600 text-info-700 dark:text-info-100 bg-info-50 dark:bg-info-900';
53
- export const warningAlertColors =
54
- 'border-warning-500 dark:border-warning-600 text-warning-700 dark:text-warning-100 bg-warning-50 dark:bg-warning-900';
55
- export const errorAlertColors =
56
- 'border-error-500 dark:border-error-600 text-error-700 dark:text-error-100 bg-error-50 dark:bg-error-900';
57
-
58
- export const valenceAlertColors = (valence?: MessageValence) => {
59
- switch (valence) {
60
- case 'success':
61
- return successAlertColors;
62
- case 'info':
63
- return infoAlertColors;
64
- case 'warning':
65
- return warningAlertColors;
66
- case 'error':
67
- return errorAlertColors;
68
- default:
69
- return neutralAlertColors;
70
- }
71
- };
@@ -1,16 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { ComponentStory, Story } from '@storybook/react';
6
- import React, { FC } from 'react';
7
-
8
- export const templateForComponent =
9
- <P extends {}>(Component: FC<P>) =>
10
- (props: P): Story<P> => {
11
- const template: ComponentStory<typeof Component> = (args) => <Component {...args} />;
12
-
13
- const story = template.bind({});
14
- story.args = props;
15
- return story;
16
- };
package/src/theme.css DELETED
@@ -1,65 +0,0 @@
1
- @import '@fontsource/roboto-flex/variable-full.css';
2
- @import '@fontsource/fira-code/variable.css';
3
- @import '@fontsource/space-grotesk/variable-full.css';
4
-
5
- @tailwind base;
6
- @tailwind utilities;
7
- @tailwind components;
8
-
9
- @layer utilities {
10
- /* Font weights */
11
- .font-thin {
12
- font-variation-settings: 'wght' 100;
13
- }
14
- .font-extralight {
15
- font-variation-settings: 'wght' 200;
16
- }
17
- .font-light {
18
- font-variation-settings: 'wght' 300;
19
- }
20
- .font-normal {
21
- font-variation-settings: 'wght' 400;
22
- }
23
- .font-medium {
24
- font-variation-settings: 'wght' 500;
25
- }
26
- .font-semibold {
27
- font-variation-settings: 'wght' 600;
28
- }
29
- .font-bold {
30
- font-variation-settings: 'wght' 700;
31
- }
32
- .font-extrabold {
33
- font-variation-settings: 'wght' 800;
34
- }
35
- .font-black {
36
- font-variation-settings: 'wght' 900;
37
- }
38
- /* Elevations */
39
- .button-elevation {
40
- box-shadow: var(--button-elevation)
41
- }
42
- .elevated-buttons {
43
- --button-elevation: theme(boxShadow.sm);
44
- }
45
- .grouped-buttons {
46
- --button-elevation: theme(boxShadow.none);
47
- }
48
- }
49
-
50
- :root {
51
- --surface-bg: theme(colors.neutral.50);
52
- --surface-text: theme(colors.neutral.900);
53
- --button-elevation: theme(boxShadow.md);
54
- }
55
-
56
- .dark {
57
- --surface-bg: theme(colors.neutral.900);
58
- --surface-text: theme(colors.neutral.50);
59
- --button-elevation: theme(boxShadow.lg);
60
- }
61
-
62
- html {
63
- background-color: var(--surface-bg);
64
- color: var(--surface-text);
65
- }
package/src/typings.d.ts DELETED
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- declare module 'tailwindcss/stubs/defaultConfig.stub.js';
6
- declare module 'tailwindcss-radix';
7
- declare module 'tailwindcss-logical';
package/src/util/index.ts DELETED
@@ -1,5 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- export * from './mx';
package/src/util/mx.ts DELETED
@@ -1,28 +0,0 @@
1
- //
2
- // Copyright 2022 DXOS.org
3
- //
4
-
5
- import { extendTailwindMerge, validators } from 'tailwind-merge';
6
-
7
- import { withLogical } from './withLogical';
8
-
9
- export const mx = extendTailwindMerge(
10
- {
11
- classGroups: {
12
- fontFamily: ['font-body', 'font-display', 'font-mono'],
13
- fontWeight: [
14
- 'font-thin',
15
- 'font-extralight',
16
- 'font-light',
17
- 'font-normal',
18
- 'font-medium',
19
- 'font-semibold',
20
- 'font-bold',
21
- 'font-extrabold',
22
- 'font-black',
23
- validators.isArbitraryNumber
24
- ]
25
- }
26
- },
27
- withLogical
28
- );