@blocklet/ui-react 2.13.70 → 3.0.1

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 (381) hide show
  1. package/lib/@types/index.js +5 -18
  2. package/lib/BlockletStudio/index.js +75 -89
  3. package/lib/ComponentInstaller/index.js +153 -190
  4. package/lib/ComponentInstaller/installer-item.js +56 -55
  5. package/lib/ComponentInstaller/locales.js +19 -18
  6. package/lib/ComponentInstaller/use-component-installed.js +49 -80
  7. package/lib/ComponentManager/components/add-component.js +68 -89
  8. package/lib/ComponentManager/components/check-component.js +4 -2
  9. package/lib/ComponentManager/components/publish-component.js +48 -57
  10. package/lib/ComponentManager/components/resource-dialog.js +41 -55
  11. package/lib/ComponentManager/index.js +8 -3
  12. package/lib/ComponentManager/libs/locales.js +8 -5
  13. package/lib/Dashboard/index.js +88 -124
  14. package/lib/Footer/brand.js +25 -28
  15. package/lib/Footer/copyright.js +15 -16
  16. package/lib/Footer/index.js +55 -65
  17. package/lib/Footer/internal-footer.js +93 -95
  18. package/lib/Footer/layout/plain.js +26 -24
  19. package/lib/Footer/layout/row.js +16 -20
  20. package/lib/Footer/layout/standard.js +73 -59
  21. package/lib/Footer/links.js +100 -120
  22. package/lib/Footer/social-media.js +28 -33
  23. package/lib/Header/index.js +108 -130
  24. package/lib/Icon/index.js +43 -59
  25. package/lib/Notifications/Snackbar.js +114 -151
  26. package/lib/Notifications/hooks/use-title.js +85 -126
  27. package/lib/Notifications/hooks/use-width.js +10 -9
  28. package/lib/Notifications/utils.js +74 -114
  29. package/lib/UserCenter/components/config-inviter.js +21 -31
  30. package/lib/UserCenter/components/config-profile.js +41 -47
  31. package/lib/UserCenter/components/danger-zone.js +88 -93
  32. package/lib/UserCenter/components/editable-field.js +149 -167
  33. package/lib/UserCenter/components/nft.js +91 -81
  34. package/lib/UserCenter/components/notification.js +206 -195
  35. package/lib/UserCenter/components/passport.js +37 -53
  36. package/lib/UserCenter/components/privacy.js +53 -64
  37. package/lib/UserCenter/components/settings.js +117 -128
  38. package/lib/UserCenter/components/status-dialog/date-picker.js +35 -36
  39. package/lib/UserCenter/components/status-dialog/index.js +132 -144
  40. package/lib/UserCenter/components/status-selector/duration-menu.js +53 -48
  41. package/lib/UserCenter/components/status-selector/index.js +37 -36
  42. package/lib/UserCenter/components/status-selector/menu-item.js +13 -9
  43. package/lib/UserCenter/components/storage/action.js +27 -25
  44. package/lib/UserCenter/components/storage/connected.js +59 -30
  45. package/lib/UserCenter/components/storage/delete.js +32 -39
  46. package/lib/UserCenter/components/storage/disconnect.js +43 -25
  47. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.js +7 -0
  48. package/lib/UserCenter/components/storage/index.js +24 -18
  49. package/lib/UserCenter/components/storage/preview-nft.js +35 -36
  50. package/lib/UserCenter/components/third-party-login/index.js +73 -143
  51. package/lib/UserCenter/components/third-party-login/third-party-item.js +132 -153
  52. package/lib/UserCenter/components/user-center.js +345 -461
  53. package/lib/UserCenter/components/user-info/address.js +120 -100
  54. package/lib/UserCenter/components/user-info/index.js +10 -4
  55. package/lib/UserCenter/components/user-info/link-preview-input.js +148 -159
  56. package/lib/UserCenter/components/user-info/metadata.js +290 -385
  57. package/lib/UserCenter/components/user-info/switch-role.js +24 -18
  58. package/lib/UserCenter/components/user-info/timezone-select.js +37 -45
  59. package/lib/UserCenter/components/user-info/user-basic-info.js +213 -207
  60. package/lib/UserCenter/components/user-info/user-info-item.js +39 -26
  61. package/lib/UserCenter/components/user-info/user-info.js +52 -67
  62. package/lib/UserCenter/components/user-info/user-status.js +111 -154
  63. package/lib/UserCenter/components/user-info/utils.js +96 -93
  64. package/lib/UserCenter/components/webhook-item.js +95 -143
  65. package/lib/UserCenter/index.js +4 -1
  66. package/lib/UserCenter/libs/locales.js +132 -129
  67. package/lib/UserCenter/libs/utils.js +17 -22
  68. package/lib/UserSessions/components/user-session-info.js +30 -26
  69. package/lib/UserSessions/components/user-sessions.js +222 -268
  70. package/lib/UserSessions/index.js +4 -1
  71. package/lib/UserSessions/libs/locales.js +31 -28
  72. package/lib/UserSessions/libs/utils.js +30 -56
  73. package/lib/blocklets.js +75 -156
  74. package/lib/common/domain-warning.js +64 -104
  75. package/lib/common/header-addons.js +59 -80
  76. package/lib/common/link-blocker.js +10 -16
  77. package/lib/common/notification-addon.js +56 -89
  78. package/lib/common/overridable-theme-provider.js +12 -12
  79. package/lib/common/wallet-hidden-topbar.js +11 -13
  80. package/lib/common/ws.js +23 -34
  81. package/lib/contexts/config-user-space.js +34 -43
  82. package/lib/hooks/use-mobile.js +7 -4
  83. package/lib/index.js +25 -10
  84. package/lib/libs/client.js +5 -2
  85. package/lib/libs/constant.js +4 -1
  86. package/lib/libs/spaces.js +11 -11
  87. package/lib/libs/with-hide-when-embed.js +13 -15
  88. package/lib/packages/blocklet-ui-react/build.config.d.ts +2 -0
  89. package/lib/packages/blocklet-ui-react/jest.config.d.ts +8 -0
  90. package/lib/packages/blocklet-ui-react/lib/@types/index.d.ts +3 -0
  91. package/lib/packages/blocklet-ui-react/lib/BlockletStudio/index.d.ts +26 -0
  92. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/index.d.ts +18 -0
  93. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/installer-item.d.ts +18 -0
  94. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/locales.d.ts +28 -0
  95. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/use-component-installed.d.ts +12 -0
  96. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/add-component.d.ts +13 -0
  97. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/check-component.d.ts +2 -0
  98. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/publish-component.d.ts +7 -0
  99. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/resource-dialog.d.ts +11 -0
  100. package/lib/packages/blocklet-ui-react/lib/ComponentManager/index.d.ts +4 -0
  101. package/lib/packages/blocklet-ui-react/lib/ComponentManager/libs/locales.d.ts +19 -0
  102. package/lib/packages/blocklet-ui-react/lib/Dashboard/index.d.ts +27 -0
  103. package/lib/packages/blocklet-ui-react/lib/Footer/brand.d.ts +15 -0
  104. package/lib/packages/blocklet-ui-react/lib/Footer/copyright.d.ts +13 -0
  105. package/lib/packages/blocklet-ui-react/lib/Footer/index.d.ts +2 -0
  106. package/lib/packages/blocklet-ui-react/lib/Footer/internal-footer.d.ts +29 -0
  107. package/lib/packages/blocklet-ui-react/lib/Footer/layout/plain.d.ts +19 -0
  108. package/lib/packages/blocklet-ui-react/lib/Footer/layout/row.d.ts +13 -0
  109. package/lib/packages/blocklet-ui-react/lib/Footer/layout/standard.d.ts +21 -0
  110. package/lib/packages/blocklet-ui-react/lib/Footer/links.d.ts +20 -0
  111. package/lib/packages/blocklet-ui-react/lib/Footer/social-media.d.ts +14 -0
  112. package/lib/packages/blocklet-ui-react/lib/Header/index.d.ts +2 -0
  113. package/lib/packages/blocklet-ui-react/lib/Icon/index.d.ts +7 -0
  114. package/lib/packages/blocklet-ui-react/lib/Notifications/Snackbar.d.ts +8 -0
  115. package/lib/packages/blocklet-ui-react/lib/Notifications/hooks/use-title.d.ts +9 -0
  116. package/lib/packages/blocklet-ui-react/lib/Notifications/hooks/use-width.d.ts +2 -0
  117. package/lib/packages/blocklet-ui-react/lib/Notifications/utils.d.ts +10 -0
  118. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/config-inviter.d.ts +4 -0
  119. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/config-profile.d.ts +5 -0
  120. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/danger-zone.d.ts +2 -0
  121. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/editable-field.d.ts +50 -0
  122. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/nft.d.ts +4 -0
  123. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/notification.d.ts +5 -0
  124. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/passport.d.ts +5 -0
  125. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/privacy.d.ts +5 -0
  126. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/settings.d.ts +8 -0
  127. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-dialog/date-picker.d.ts +9 -0
  128. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-dialog/index.d.ts +9 -0
  129. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/duration-menu.d.ts +7 -0
  130. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/index.d.ts +8 -0
  131. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/menu-item.d.ts +9 -0
  132. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/action.d.ts +7 -0
  133. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/connected.d.ts +4 -0
  134. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/delete.d.ts +5 -0
  135. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/disconnect.d.ts +2 -0
  136. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.d.ts +3 -0
  137. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/index.d.ts +2 -0
  138. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/preview-nft.d.ts +5 -0
  139. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/third-party-login/index.d.ts +4 -0
  140. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/third-party-login/third-party-item.d.ts +4 -0
  141. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-center.d.ts +15 -0
  142. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/address.d.ts +7 -0
  143. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/index.d.ts +5 -0
  144. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/link-preview-input.d.ts +6 -0
  145. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/metadata.d.ts +7 -0
  146. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/switch-role.d.ts +6 -0
  147. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/timezone-select.d.ts +7 -0
  148. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-basic-info.d.ts +12 -0
  149. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-info-item.d.ts +6 -0
  150. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-info.d.ts +6 -0
  151. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-status.d.ts +9 -0
  152. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/utils.d.ts +33 -0
  153. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/webhook-item.d.ts +10 -0
  154. package/lib/packages/blocklet-ui-react/lib/UserCenter/index.d.ts +2 -0
  155. package/lib/packages/blocklet-ui-react/lib/UserCenter/libs/locales.d.ts +513 -0
  156. package/lib/packages/blocklet-ui-react/lib/UserCenter/libs/utils.d.ts +3 -0
  157. package/lib/packages/blocklet-ui-react/lib/UserSessions/components/user-session-info.d.ts +5 -0
  158. package/lib/packages/blocklet-ui-react/lib/UserSessions/components/user-sessions.d.ts +8 -0
  159. package/lib/packages/blocklet-ui-react/lib/UserSessions/index.d.ts +2 -0
  160. package/lib/packages/blocklet-ui-react/lib/UserSessions/libs/locales.d.ts +88 -0
  161. package/lib/packages/blocklet-ui-react/lib/UserSessions/libs/utils.d.ts +3 -0
  162. package/lib/packages/blocklet-ui-react/lib/blocklets.d.ts +18 -0
  163. package/lib/packages/blocklet-ui-react/lib/common/domain-warning.d.ts +12 -0
  164. package/lib/packages/blocklet-ui-react/lib/common/header-addons.d.ts +19 -0
  165. package/lib/packages/blocklet-ui-react/lib/common/link-blocker.d.ts +4 -0
  166. package/lib/packages/blocklet-ui-react/lib/common/notification-addon.d.ts +10 -0
  167. package/lib/packages/blocklet-ui-react/lib/common/overridable-theme-provider.d.ts +12 -0
  168. package/lib/packages/blocklet-ui-react/lib/common/wallet-hidden-topbar.d.ts +2 -0
  169. package/lib/packages/blocklet-ui-react/lib/common/ws.d.ts +4 -0
  170. package/lib/packages/blocklet-ui-react/lib/contexts/config-user-space.d.ts +7 -0
  171. package/lib/packages/blocklet-ui-react/lib/hooks/use-mobile.d.ts +4 -0
  172. package/lib/packages/blocklet-ui-react/lib/index.d.ts +12 -0
  173. package/lib/packages/blocklet-ui-react/lib/libs/client.d.ts +3 -0
  174. package/lib/packages/blocklet-ui-react/lib/libs/constant.d.ts +2 -0
  175. package/lib/packages/blocklet-ui-react/lib/libs/spaces.d.ts +3 -0
  176. package/lib/packages/blocklet-ui-react/lib/libs/with-hide-when-embed.d.ts +5 -0
  177. package/lib/packages/blocklet-ui-react/lib/types.d.ts +37 -0
  178. package/lib/packages/blocklet-ui-react/lib/utils.d.ts +11 -0
  179. package/lib/{@types → packages/blocklet-ui-react/src/@types}/index.d.ts +3 -3
  180. package/lib/{BlockletStudio → packages/blocklet-ui-react/src/BlockletStudio}/index.d.ts +1 -1
  181. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/ComponentInstaller.stories.d.ts +9 -0
  182. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/demo/basic.d.ts +29 -0
  183. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/demo/mock-optional-components.d.ts +2 -0
  184. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/index.d.ts +18 -0
  185. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/installer-item.d.ts +18 -0
  186. package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/use-component-installed.d.ts +1 -1
  187. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/add-component.d.ts +2 -2
  188. package/lib/packages/blocklet-ui-react/src/ComponentManager/components/check-component.d.ts +2 -0
  189. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/publish-component.d.ts +2 -2
  190. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/resource-dialog.d.ts +2 -2
  191. package/lib/packages/blocklet-ui-react/src/Dashboard/Dashboard.stories.d.ts +13 -0
  192. package/lib/packages/blocklet-ui-react/src/Dashboard/demo/basic.d.ts +29 -0
  193. package/lib/packages/blocklet-ui-react/src/Dashboard/index.d.ts +30 -0
  194. package/lib/packages/blocklet-ui-react/src/Footer/Footer.stories.d.ts +19 -0
  195. package/lib/packages/blocklet-ui-react/src/Footer/brand.d.ts +15 -0
  196. package/lib/packages/blocklet-ui-react/src/Footer/copyright.d.ts +13 -0
  197. package/lib/packages/blocklet-ui-react/src/Footer/demo/arcblock-site.d.ts +31 -0
  198. package/lib/packages/blocklet-ui-react/src/Footer/demo/brand.d.ts +1 -0
  199. package/lib/packages/blocklet-ui-react/src/Footer/demo/copyright.d.ts +1 -0
  200. package/lib/packages/blocklet-ui-react/src/Footer/demo/footer.d.ts +10 -0
  201. package/lib/packages/blocklet-ui-react/src/Footer/demo/links.d.ts +1 -0
  202. package/lib/packages/blocklet-ui-react/src/Footer/demo/social-media-icons.d.ts +1 -0
  203. package/lib/packages/blocklet-ui-react/src/Footer/index.d.ts +6 -0
  204. package/lib/packages/blocklet-ui-react/src/Footer/internal-footer.d.ts +32 -0
  205. package/lib/packages/blocklet-ui-react/src/Footer/layout/plain.d.ts +22 -0
  206. package/lib/packages/blocklet-ui-react/src/Footer/layout/row.d.ts +13 -0
  207. package/lib/packages/blocklet-ui-react/src/Footer/layout/standard.d.ts +24 -0
  208. package/lib/packages/blocklet-ui-react/src/Footer/links.d.ts +23 -0
  209. package/lib/packages/blocklet-ui-react/src/Footer/social-media.d.ts +14 -0
  210. package/lib/packages/blocklet-ui-react/src/Header/Header.stories.d.ts +26 -0
  211. package/lib/packages/blocklet-ui-react/src/Header/demo/addons-customization.d.ts +11 -0
  212. package/lib/packages/blocklet-ui-react/src/Header/demo/basic.d.ts +1 -0
  213. package/lib/packages/blocklet-ui-react/src/Header/demo/fixtures/index.d.ts +49 -0
  214. package/lib/packages/blocklet-ui-react/src/Header/demo/with-enable-connect-enable-locale.d.ts +1 -0
  215. package/lib/{Header → packages/blocklet-ui-react/src/Header}/index.d.ts +3 -2
  216. package/lib/packages/blocklet-ui-react/src/Icon/Icon.stories.d.ts +12 -0
  217. package/lib/packages/blocklet-ui-react/src/Icon/demo/basic.d.ts +1 -0
  218. package/lib/{Icon → packages/blocklet-ui-react/src/Icon}/index.d.ts +2 -3
  219. package/lib/packages/blocklet-ui-react/src/Notifications/Snackbar.d.ts +16 -0
  220. package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-title.d.ts +1 -1
  221. package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/utils.d.ts +2 -2
  222. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/config-inviter.d.ts +1 -1
  223. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/config-profile.d.ts +1 -1
  224. package/lib/packages/blocklet-ui-react/src/UserCenter/components/danger-zone.d.ts +1 -0
  225. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/editable-field.d.ts +3 -3
  226. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/nft.d.ts +1 -1
  227. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/notification.d.ts +1 -1
  228. package/lib/packages/blocklet-ui-react/src/UserCenter/components/passport.d.ts +5 -0
  229. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/privacy.d.ts +1 -1
  230. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/settings.d.ts +2 -2
  231. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-dialog/date-picker.d.ts +1 -1
  232. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-dialog/index.d.ts +1 -1
  233. package/lib/packages/blocklet-ui-react/src/UserCenter/components/status-selector/duration-menu.d.ts +7 -0
  234. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-selector/index.d.ts +1 -1
  235. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-selector/menu-item.d.ts +4 -4
  236. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/action.d.ts +1 -1
  237. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/connected.d.ts +1 -1
  238. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/delete.d.ts +1 -1
  239. package/lib/packages/blocklet-ui-react/src/UserCenter/components/storage/disconnect.d.ts +2 -0
  240. package/lib/packages/blocklet-ui-react/src/UserCenter/components/storage/index.d.ts +2 -0
  241. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/preview-nft.d.ts +1 -1
  242. package/lib/packages/blocklet-ui-react/src/UserCenter/components/third-party-login/index.d.ts +4 -0
  243. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/third-party-login/third-party-item.d.ts +2 -2
  244. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-center.d.ts +2 -2
  245. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/address.d.ts +2 -2
  246. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/link-preview-input.d.ts +1 -1
  247. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/metadata.d.ts +2 -2
  248. package/lib/packages/blocklet-ui-react/src/UserCenter/components/user-info/switch-role.d.ts +7 -0
  249. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/timezone-select.d.ts +1 -1
  250. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-basic-info.d.ts +3 -3
  251. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-info-item.d.ts +1 -1
  252. package/lib/packages/blocklet-ui-react/src/UserCenter/components/user-info/user-info.d.ts +6 -0
  253. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-status.d.ts +2 -2
  254. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/utils.d.ts +8 -5
  255. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/webhook-item.d.ts +1 -1
  256. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/utils.d.ts +1 -1
  257. package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/components/user-session-info.d.ts +1 -1
  258. package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/components/user-sessions.d.ts +1 -1
  259. package/lib/packages/blocklet-ui-react/src/common/domain-warning.d.ts +12 -0
  260. package/lib/packages/blocklet-ui-react/src/common/header-addons.d.ts +19 -0
  261. package/lib/{common → packages/blocklet-ui-react/src/common}/link-blocker.d.ts +1 -1
  262. package/lib/{common → packages/blocklet-ui-react/src/common}/notification-addon.d.ts +3 -6
  263. package/lib/{common → packages/blocklet-ui-react/src/common}/overridable-theme-provider.d.ts +5 -8
  264. package/lib/{contexts → packages/blocklet-ui-react/src/contexts}/config-user-space.d.ts +3 -3
  265. package/lib/{libs → packages/blocklet-ui-react/src/libs}/with-hide-when-embed.d.ts +1 -1
  266. package/lib/packages/blocklet-ui-react/src/types.d.ts +36 -0
  267. package/lib/packages/blocklet-ui-react/tools/auto-exports.d.ts +1 -0
  268. package/lib/packages/blocklet-ui-react/tools/jest.d.ts +1 -0
  269. package/lib/packages/blocklet-ui-react/vite.config.d.mts +2 -0
  270. package/lib/types.js +39 -39
  271. package/lib/utils.js +61 -175
  272. package/package.json +28 -34
  273. package/src/ComponentInstaller/ComponentInstaller.stories.jsx +16 -0
  274. package/src/ComponentInstaller/index.jsx +11 -27
  275. package/src/ComponentInstaller/installer-item.jsx +1 -5
  276. package/src/ComponentManager/components/add-component.tsx +3 -3
  277. package/src/ComponentManager/components/publish-component.tsx +3 -3
  278. package/src/Dashboard/Dashboard.stories.jsx +20 -0
  279. package/src/Dashboard/index.jsx +16 -27
  280. package/src/Footer/Footer.stories.jsx +32 -0
  281. package/src/Footer/brand.jsx +1 -7
  282. package/src/Footer/copyright.jsx +1 -6
  283. package/src/Footer/index.jsx +1 -6
  284. package/src/Footer/internal-footer.jsx +26 -16
  285. package/src/Footer/layout/row.jsx +2 -7
  286. package/src/Footer/layout/standard.jsx +12 -2
  287. package/src/Footer/links.jsx +2 -7
  288. package/src/Footer/social-media.jsx +1 -5
  289. package/src/Header/Header.stories.jsx +30 -0
  290. package/src/Header/index.tsx +1 -1
  291. package/src/Icon/Icon.stories.jsx +12 -0
  292. package/src/Notifications/Snackbar.tsx +119 -126
  293. package/src/Notifications/hooks/use-title.tsx +5 -2
  294. package/src/Notifications/hooks/use-width.tsx +1 -1
  295. package/src/UserCenter/components/config-profile.tsx +0 -1
  296. package/src/UserCenter/components/danger-zone.tsx +7 -3
  297. package/src/UserCenter/components/editable-field.tsx +45 -44
  298. package/src/UserCenter/components/nft.tsx +21 -9
  299. package/src/UserCenter/components/notification.tsx +22 -6
  300. package/src/UserCenter/components/privacy.tsx +1 -1
  301. package/src/UserCenter/components/settings.tsx +6 -1
  302. package/src/UserCenter/components/status-dialog/date-picker.tsx +10 -7
  303. package/src/UserCenter/components/status-dialog/index.tsx +11 -4
  304. package/src/UserCenter/components/status-selector/duration-menu.tsx +7 -2
  305. package/src/UserCenter/components/status-selector/index.tsx +7 -1
  306. package/src/UserCenter/components/status-selector/menu-item.tsx +1 -2
  307. package/src/UserCenter/components/storage/action.tsx +1 -2
  308. package/src/UserCenter/components/storage/connected.tsx +18 -5
  309. package/src/UserCenter/components/storage/delete.tsx +1 -1
  310. package/src/UserCenter/components/storage/disconnect.tsx +10 -2
  311. package/src/UserCenter/components/storage/index.tsx +6 -1
  312. package/src/UserCenter/components/storage/preview-nft.tsx +1 -1
  313. package/src/UserCenter/components/third-party-login/index.tsx +2 -2
  314. package/src/UserCenter/components/third-party-login/third-party-item.tsx +11 -7
  315. package/src/UserCenter/components/user-center.tsx +10 -5
  316. package/src/UserCenter/components/user-info/address.tsx +12 -6
  317. package/src/UserCenter/components/user-info/link-preview-input.tsx +36 -51
  318. package/src/UserCenter/components/user-info/metadata.tsx +45 -39
  319. package/src/UserCenter/components/user-info/timezone-select.tsx +2 -5
  320. package/src/UserCenter/components/user-info/user-basic-info.tsx +24 -8
  321. package/src/UserCenter/components/user-info/user-info-item.tsx +7 -2
  322. package/src/UserCenter/components/user-info/user-status.tsx +7 -9
  323. package/src/UserCenter/components/user-info/utils.ts +77 -11
  324. package/src/UserCenter/components/webhook-item.tsx +4 -2
  325. package/src/UserSessions/components/user-sessions.tsx +1 -1
  326. package/src/common/domain-warning.jsx +2 -14
  327. package/src/common/header-addons.jsx +8 -11
  328. package/src/common/notification-addon.jsx +1 -7
  329. package/src/common/overridable-theme-provider.jsx +1 -5
  330. package/src/common/ws.js +2 -2
  331. package/src/contexts/config-user-space.tsx +3 -3
  332. package/vite.config.mjs +31 -0
  333. package/lib/@types/shims.d.ts +0 -18
  334. package/lib/ComponentInstaller/index.d.ts +0 -37
  335. package/lib/ComponentInstaller/installer-item.d.ts +0 -21
  336. package/lib/ComponentManager/components/check-component.d.ts +0 -2
  337. package/lib/Dashboard/index.d.ts +0 -44
  338. package/lib/Footer/brand.d.ts +0 -22
  339. package/lib/Footer/copyright.d.ts +0 -18
  340. package/lib/Footer/index.d.ts +0 -6
  341. package/lib/Footer/internal-footer.d.ts +0 -29
  342. package/lib/Footer/layout/plain.d.ts +0 -15
  343. package/lib/Footer/layout/row.d.ts +0 -18
  344. package/lib/Footer/layout/standard.d.ts +0 -17
  345. package/lib/Footer/links.d.ts +0 -23
  346. package/lib/Footer/social-media.d.ts +0 -14
  347. package/lib/Notifications/Snackbar.d.ts +0 -14
  348. package/lib/UserCenter/components/danger-zone.d.ts +0 -1
  349. package/lib/UserCenter/components/passport.d.ts +0 -5
  350. package/lib/UserCenter/components/status-selector/duration-menu.d.ts +0 -7
  351. package/lib/UserCenter/components/storage/disconnect.d.ts +0 -2
  352. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
  353. package/lib/UserCenter/components/storage/icons/long-arrow.svg +0 -5
  354. package/lib/UserCenter/components/storage/icons/space-connected.svg +0 -3
  355. package/lib/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
  356. package/lib/UserCenter/components/storage/index.d.ts +0 -2
  357. package/lib/UserCenter/components/third-party-login/index.d.ts +0 -4
  358. package/lib/UserCenter/components/user-info/switch-role.d.ts +0 -7
  359. package/lib/UserCenter/components/user-info/user-info.d.ts +0 -6
  360. package/lib/common/domain-warning.d.ts +0 -17
  361. package/lib/common/header-addons.d.ts +0 -27
  362. package/lib/types.d.ts +0 -2
  363. /package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/locales.d.ts +0 -0
  364. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/index.d.ts +0 -0
  365. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/libs/locales.d.ts +0 -0
  366. /package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-width.d.ts +0 -0
  367. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/index.d.ts +0 -0
  368. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/index.d.ts +0 -0
  369. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/locales.d.ts +0 -0
  370. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/index.d.ts +0 -0
  371. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/locales.d.ts +0 -0
  372. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/utils.d.ts +0 -0
  373. /package/lib/{blocklets.d.ts → packages/blocklet-ui-react/src/blocklets.d.ts} +0 -0
  374. /package/lib/{common → packages/blocklet-ui-react/src/common}/wallet-hidden-topbar.d.ts +0 -0
  375. /package/lib/{common → packages/blocklet-ui-react/src/common}/ws.d.ts +0 -0
  376. /package/lib/{hooks → packages/blocklet-ui-react/src/hooks}/use-mobile.d.ts +0 -0
  377. /package/lib/{index.d.ts → packages/blocklet-ui-react/src/index.d.ts} +0 -0
  378. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/client.d.ts +0 -0
  379. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/constant.d.ts +0 -0
  380. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/spaces.d.ts +0 -0
  381. /package/lib/{utils.d.ts → packages/blocklet-ui-react/src/utils.d.ts} +0 -0
@@ -0,0 +1,20 @@
1
+ import Basic from './demo/basic';
2
+
3
+ export default {
4
+ title: 'Blocklet-UI-React/Dashboard',
5
+
6
+ parameters: {
7
+ layout: 'fullscreen',
8
+ design: {
9
+ type: 'figma',
10
+ url: 'https://www.figma.com/file/E8TSBWCOyXzETmVOjzbqvw/ArcBlock-UI-Kit?node-id=1504%3A5211',
11
+ },
12
+ },
13
+ };
14
+
15
+ Basic.argTypes = {
16
+ userRole: { control: 'select', options: [null, 'owner', 'developer'] },
17
+ };
18
+ Basic.storyName = 'Dashboard';
19
+
20
+ export { Basic };
@@ -1,7 +1,7 @@
1
1
  import 'iconify-icon';
2
2
 
3
3
  /* eslint-disable no-shadow */
4
- import { useMemo, useLayoutEffect, useContext } from 'react';
4
+ import { useMemo, useLayoutEffect, use } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { SessionContext } from '@arcblock/did-connect/lib/Session';
7
7
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
@@ -17,19 +17,25 @@ import { useWalletHiddenTopbar } from '../common/wallet-hidden-topbar';
17
17
  /**
18
18
  * 专门用于 (composable) blocklet 的 Dashboard 组件, 解析 blocklet meta 中 section 为 dashboard 的 navigation 数据, 渲染一个 UX Dashboard
19
19
  */
20
- // eslint-disable-next-line no-shadow
21
20
  function Dashboard({
22
- meta,
23
- fallbackUrl,
24
- invalidPathFallback,
25
- headerAddons,
26
- sessionManagerProps,
27
- links,
28
- showDomainWarningDialog,
21
+ meta = {},
22
+ fallbackUrl = publicPath,
23
+ invalidPathFallback = null,
24
+ headerAddons = undefined,
25
+ sessionManagerProps = {
26
+ showRole: true,
27
+ // dashboard 默认退出登录行为: 跳转到 (root) blocklet 首页
28
+ onLogout: () => {
29
+ // 这里是安全的
30
+ window.location.href = publicPath;
31
+ },
32
+ },
33
+ links = [],
34
+ showDomainWarningDialog = true,
29
35
  ...rest
30
36
  }) {
31
37
  useWalletHiddenTopbar();
32
- const sessionCtx = useContext(SessionContext);
38
+ const sessionCtx = use(SessionContext);
33
39
  const user = sessionCtx?.session?.user;
34
40
  const userRole = user?.role;
35
41
  const { locale } = useLocaleContext() || {};
@@ -156,21 +162,4 @@ Dashboard.propTypes = {
156
162
  showDomainWarningDialog: PropTypes.bool,
157
163
  };
158
164
 
159
- Dashboard.defaultProps = {
160
- meta: {},
161
- fallbackUrl: publicPath,
162
- invalidPathFallback: null,
163
- headerAddons: undefined,
164
- sessionManagerProps: {
165
- showRole: true,
166
- // dashboard 默认退出登录行为: 跳转到 (root) blocklet 首页
167
- onLogout: () => {
168
- // 这里是安全的
169
- window.location.href = publicPath;
170
- },
171
- },
172
- links: [],
173
- showDomainWarningDialog: true,
174
- };
175
-
176
165
  export default Dashboard;
@@ -0,0 +1,32 @@
1
+ import Brand from './demo/brand';
2
+ import Links from './demo/links';
3
+ import SocialMediaIcons from './demo/social-media-icons';
4
+ import Copyright from './demo/copyright';
5
+ import Footer from './demo/footer';
6
+ import ArcblockSite from './demo/arcblock-site';
7
+
8
+ export default {
9
+ title: 'Blocklet-UI-React/Footer',
10
+
11
+ parameters: {
12
+ layout: 'fullscreen',
13
+ docs: {
14
+ description: {
15
+ component:
16
+ 'Used to render a page footer for Blocklet based on Blocklet runtime information. It requires a blocklet environment to work properly.',
17
+ },
18
+ },
19
+ },
20
+ };
21
+
22
+ Footer.argTypes = {
23
+ layout: { control: 'select', options: ['auto', 'standard', 'plain'] },
24
+ emptyNavData: { control: 'boolean', defaultValue: false },
25
+ overrideTheme: { control: 'boolean', defaultValue: false },
26
+ };
27
+
28
+ ArcblockSite.argTypes = {
29
+ locale: { control: 'select', options: ['en', 'zh'] },
30
+ };
31
+
32
+ export { Brand, Links, SocialMediaIcons, Copyright, Footer, ArcblockSite };
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { styled } from '@arcblock/ux/lib/Theme';
4
4
  import { Box } from '@mui/material';
5
5
 
6
- export default function Brand({ name, logo, description, ...rest }) {
6
+ export default function Brand({ name = '', logo = '', description = '', ...rest }) {
7
7
  if (!name && !logo && !description) {
8
8
  return null;
9
9
  }
@@ -31,12 +31,6 @@ Brand.propTypes = {
31
31
  description: PropTypes.string,
32
32
  };
33
33
 
34
- Brand.defaultProps = {
35
- name: '',
36
- logo: '',
37
- description: '',
38
- };
39
-
40
34
  const Root = styled('div')`
41
35
  display: flex;
42
36
  flex-direction: column;
@@ -1,7 +1,7 @@
1
1
  import { styled } from '@arcblock/ux/lib/Theme';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- export default function Copyright({ owner, year, ...rest }) {
4
+ export default function Copyright({ owner = 'ArcBlock', year = `${new Date().getFullYear()}`, ...rest }) {
5
5
  return (
6
6
  <Root {...rest}>
7
7
  Copyright © {year} {owner}
@@ -14,11 +14,6 @@ Copyright.propTypes = {
14
14
  year: PropTypes.string,
15
15
  };
16
16
 
17
- Copyright.defaultProps = {
18
- owner: 'ArcBlock',
19
- year: `${new Date().getFullYear()}`,
20
- };
21
-
22
17
  const Root = styled('p')`
23
18
  display: flex;
24
19
  align-items: center;
@@ -16,7 +16,7 @@ import withHideWhenEmbed from '../libs/with-hide-when-embed';
16
16
  /**
17
17
  * 专门用于 (composable) blocklet 的 Footer 组件, 基于 blocklet meta 中的数据渲染
18
18
  */
19
- function Footer({ meta, theme: themeOverrides, ...rest }) {
19
+ function Footer({ meta = {}, theme: themeOverrides = null, ...rest }) {
20
20
  const { locale } = useLocaleContext() || {};
21
21
  const parentTheme = useTheme();
22
22
  const formattedBlocklet = useMemo(() => {
@@ -82,11 +82,6 @@ Footer.propTypes = {
82
82
  theme: PropTypes.object,
83
83
  };
84
84
 
85
- Footer.defaultProps = {
86
- meta: {},
87
- theme: null,
88
- };
89
-
90
85
  const StyledInternalFooter = styled(InternalFooter)`
91
86
  ${({ $bordered, theme }) => `border-top: 1px solid ${$bordered && theme.palette.divider};`}
92
87
  color: ${({ theme }) => theme.palette.text.secondary};
@@ -30,7 +30,15 @@ const layoutsKeyByName = layouts.reduce((acc, cur) => ({ ...acc, [cur.name]: cur
30
30
  * 通用的内部 footer 组件, 定义并渲染常见的几种 footer 元素: brand/navigation/social medial 等
31
31
  */
32
32
  function InternalFooter(props) {
33
- const { brand, navigation, socialMedia, copyright, links, layout, ...rest } = props;
33
+ const {
34
+ brand = null,
35
+ navigation = null,
36
+ socialMedia = null,
37
+ copyright = null,
38
+ links = null,
39
+ layout = 'auto',
40
+ ...rest
41
+ } = props;
34
42
  const renderBrand = () => {
35
43
  return brand ? <Brand {...brand} /> : null;
36
44
  };
@@ -70,14 +78,25 @@ function InternalFooter(props) {
70
78
  }
71
79
 
72
80
  return (
73
- <Box position="relative" {...rest} className={clsx('blocklet__footer', rest.className)}>
81
+ <Box
82
+ {...rest}
83
+ className={clsx('blocklet__footer', rest.className)}
84
+ sx={[
85
+ {
86
+ position: 'relative',
87
+ },
88
+ ...(Array.isArray(rest.sx) ? rest.sx : [rest.sx]),
89
+ ]}>
74
90
  <LayoutComponent elements={elements} data={props} />
75
91
  <Box
76
- position="absolute"
77
- right={16}
78
- bottom={0}
79
- fontSize={12}
80
- sx={{ color: 'transparent', '::selection': { background: '#000', color: '#fff' } }}>
92
+ sx={{
93
+ position: 'absolute',
94
+ right: 16,
95
+ bottom: 0,
96
+ fontSize: 12,
97
+ color: 'transparent',
98
+ '::selection': { background: '#000', color: '#fff' },
99
+ }}>
81
100
  {window?.blocklet?.version}
82
101
  </Box>
83
102
  </Box>
@@ -117,13 +136,4 @@ InternalFooter.propTypes = {
117
136
  layout: PropTypes.oneOf(['auto', 'standard', 'plain']),
118
137
  };
119
138
 
120
- InternalFooter.defaultProps = {
121
- brand: null,
122
- navigation: null,
123
- copyright: null,
124
- socialMedia: null,
125
- links: null,
126
- layout: 'auto',
127
- };
128
-
129
139
  export default InternalFooter;
@@ -1,9 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
- import Box from '@mui/material/Box';
2
+ import { Box } from '@mui/material';
3
3
  import { styled } from '@arcblock/ux/lib/Theme';
4
4
  import clsx from 'clsx';
5
5
 
6
- export default function Row({ children, autoCenter, ...rest }) {
6
+ export default function Row({ children = null, autoCenter = false, ...rest }) {
7
7
  if (!children) {
8
8
  return null;
9
9
  }
@@ -19,11 +19,6 @@ Row.propTypes = {
19
19
  autoCenter: PropTypes.bool,
20
20
  };
21
21
 
22
- Row.defaultProps = {
23
- children: null,
24
- autoCenter: false,
25
- };
26
-
27
22
  const RowRoot = styled(Box)`
28
23
  display: flex;
29
24
  justify-content: space-between;
@@ -28,7 +28,12 @@ function StandardLayout({ elements, data, className, ...rest }) {
28
28
  pb: 3,
29
29
  }}>
30
30
  <Box>{elements.brand}</Box>
31
- <Box lineHeight={1}>{elements.socialMedia}</Box>
31
+ <Box
32
+ sx={{
33
+ lineHeight: 1,
34
+ }}>
35
+ {elements.socialMedia}
36
+ </Box>
32
37
  </Box>
33
38
  <Box sx={({ palette }) => ({ mb: 3, borderTop: { xs: `1px solid ${palette.grey[200]}`, md: 0 } })}>
34
39
  {elements.navigation}
@@ -48,7 +53,12 @@ function StandardLayout({ elements, data, className, ...rest }) {
48
53
  pb: 3,
49
54
  }}>
50
55
  <Box>{elements.brand}</Box>
51
- <Box lineHeight={1}>{elements.socialMedia}</Box>
56
+ <Box
57
+ sx={{
58
+ lineHeight: 1,
59
+ }}>
60
+ {elements.socialMedia}
61
+ </Box>
52
62
  </Container>
53
63
  );
54
64
  }
@@ -6,7 +6,7 @@ import isInteger from 'lodash/isInteger';
6
6
  import isString from 'lodash/isString';
7
7
  import { styled } from '@arcblock/ux/lib/Theme';
8
8
  import clsx from 'clsx';
9
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
9
+ import { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';
10
10
  import Icon from '../Icon';
11
11
  import useMobile from '../hooks/use-mobile';
12
12
  import { splitNavColumns } from '../utils';
@@ -14,7 +14,7 @@ import { splitNavColumns } from '../utils';
14
14
  /**
15
15
  * footer 中的 links (支持分组, 最多支持 2 级)
16
16
  */
17
- export default function Links({ links, flowLayout, columns, ...rest }) {
17
+ export default function Links({ links = [], flowLayout = false, columns, ...rest }) {
18
18
  const [activeIndex, setActiveIndex] = useState(-1);
19
19
  const isMobile = useMobile({ key: 'md' });
20
20
  // 只要发现一项元素有子元素, 就认为是分组 (大字号突出 group title)
@@ -162,11 +162,6 @@ Links.propTypes = {
162
162
  columns: PropTypes.number,
163
163
  };
164
164
 
165
- Links.defaultProps = {
166
- links: [],
167
- flowLayout: false,
168
- };
169
-
170
165
  const Root = styled('div')`
171
166
  overflow: hidden;
172
167
  color: ${({ theme }) => theme.palette.text.secondary};
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
2
2
  import { styled } from '@arcblock/ux/lib/Theme';
3
3
  import Icon from '../Icon';
4
4
 
5
- export default function SocialMedia({ items, ...rest }) {
5
+ export default function SocialMedia({ items = null, ...rest }) {
6
6
  if (!items?.length) {
7
7
  return null;
8
8
  }
@@ -35,10 +35,6 @@ SocialMedia.propTypes = {
35
35
  ),
36
36
  };
37
37
 
38
- SocialMedia.defaultProps = {
39
- items: null,
40
- };
41
-
42
38
  const Root = styled('div')`
43
39
  display: inline-flex;
44
40
  flex-wrap: wrap;
@@ -0,0 +1,30 @@
1
+ import Basic from './demo/basic';
2
+ import WithEnableConnectEnableLocale from './demo/with-enable-connect-enable-locale';
3
+ import AddonsCustomization from './demo/addons-customization';
4
+
5
+ export default {
6
+ title: 'Blocklet-UI-React/Header',
7
+
8
+ parameters: {
9
+ layout: 'fullscreen',
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'Used to render a page header for Blocklet based on Blocklet runtime information. It requires a blocklet environment to work properly.',
14
+ },
15
+ },
16
+ design: {
17
+ type: 'figma',
18
+ url: 'https://www.figma.com/file/E8TSBWCOyXzETmVOjzbqvw/ArcBlock-UI-Kit?node-id=1504%3A4630',
19
+ },
20
+ },
21
+ argTypes: {
22
+ maxWidth: { control: 'select', options: ['xs', 'sm', 'md', 'lg', 'xl', false] },
23
+ },
24
+ };
25
+
26
+ AddonsCustomization.argTypes = {
27
+ overrideTheme: { control: 'boolean', defaultValue: false },
28
+ };
29
+
30
+ export { Basic, WithEnableConnectEnableLocale, AddonsCustomization };
@@ -1,4 +1,4 @@
1
- import { useMemo } from 'react';
1
+ import { useMemo, type JSX } from 'react';
2
2
  import { useMemoizedFn } from 'ahooks';
3
3
  import { withErrorBoundary } from 'react-error-boundary';
4
4
  import { ErrorFallback } from '@arcblock/ux/lib/ErrorBoundary';
@@ -0,0 +1,12 @@
1
+ export { default as Icon } from './demo/basic';
2
+
3
+ export default {
4
+ title: 'Blocklet-UI-React/Icon',
5
+ parameters: {
6
+ docs: {
7
+ description: {
8
+ component: 'A wrapper for Material UI Avatar component that supports iconify icon.',
9
+ },
10
+ },
11
+ },
12
+ };
@@ -1,13 +1,10 @@
1
- import { forwardRef, useEffect, useState } from 'react';
2
- import PropTypes from 'prop-types';
1
+ import { useEffect, useState } from 'react';
3
2
  import styled from '@emotion/styled';
4
3
 
5
4
  import { amber, green, common } from '@mui/material/colors';
6
- import IconButton from '@mui/material/IconButton';
7
- import Box from '@mui/material/Box';
8
- import Typography from '@mui/material/Typography';
5
+ import { Box, IconButton, Typography } from '@mui/material';
9
6
  import { useCreation } from 'ahooks';
10
- import CloseIcon from '@mui/icons-material/Close';
7
+ import { Close as CloseIcon } from '@mui/icons-material';
11
8
  import { Icon, IconifyIcon } from '@iconify/react';
12
9
  import CheckIcon from '@iconify-icons/tabler/circle-check';
13
10
  import WarningIcon from '@iconify-icons/tabler/exclamation-circle';
@@ -24,18 +21,6 @@ import { isIncludeActivity, toClickableSpan, sanitize } from './utils';
24
21
  type BreakpointType = 'xl' | 'lg' | 'md' | 'sm';
25
22
 
26
23
  // Define types for notification component
27
- interface NotificationProps {
28
- keyId: number;
29
- notification: {
30
- severity?: string;
31
- title?: string;
32
- description?: string;
33
- activity?: any;
34
- actorInfo?: any;
35
- };
36
- viewAllUrl: string;
37
- content?: React.ReactNode;
38
- }
39
24
 
40
25
  const variants: Record<string, IconifyIcon> = {
41
26
  normal: InfoIcon,
@@ -151,118 +136,126 @@ const ClickableDiv = styled.div`
151
136
  }
152
137
  `;
153
138
 
154
- const NotificationComponent = forwardRef<HTMLDivElement, NotificationProps>(
155
- ({ keyId: key, notification = {}, viewAllUrl, content }, ref) => {
156
- const breakpoint = useWidth();
157
- const [description, setDescription] = useState(notification.description || '');
158
- const icon = variants[notification.severity || ''];
159
-
160
- const { closeSnackbar } = useSnackbar();
161
- const onClickDismiss = () => closeSnackbar(key);
162
-
163
- useEffect(() => {
164
- toClickableSpan(notification.description || '', 'en').then((res) => {
165
- setDescription(res);
166
- });
167
- }, [notification.description]);
168
-
169
- const onGoNotification = (e: any) => {
170
- e.stopPropagation();
171
- closeSnackbar(key);
172
-
173
- // 已确认 viewAllUrl都是本地的相对地址
174
- if (!e?.customPreventRedirect) {
175
- window.open(viewAllUrl, '_blank');
176
- }
177
- };
178
-
179
- const includeActivity = useCreation(() => {
180
- return isIncludeActivity(notification);
181
- }, [notification]);
182
- const activity = useCreation(() => {
183
- return notification?.activity;
184
- }, [notification]);
185
-
186
- const activityMeta = useCreation(() => {
187
- if (!activity || activity.type === 'tips') {
188
- return null;
189
- }
190
-
191
- return activity?.meta;
192
- }, [activity]);
139
+ interface NotificationComponentProps {
140
+ viewAllUrl: string;
141
+ keyId: number;
142
+ notification: {
143
+ severity?: string;
144
+ title?: string;
145
+ description?: string;
146
+ activity?: any;
147
+ actorInfo?: any;
148
+ };
149
+ // eslint-disable-next-line react/require-default-props
150
+ content?: React.ReactNode;
151
+ }
193
152
 
194
- const activityTitle = useActivityTitle({
195
- activity,
196
- users: [notification?.actorInfo],
197
- actors: [notification?.activity?.actor],
198
- extra: {
199
- linkColor: common.white,
200
- },
153
+ export default function NotificationComponent({
154
+ ref,
155
+ keyId: key,
156
+ notification = {},
157
+ viewAllUrl,
158
+ content = null,
159
+ }: NotificationComponentProps & {
160
+ ref?: React.Ref<unknown>;
161
+ }) {
162
+ const breakpoint = useWidth();
163
+ const [description, setDescription] = useState(notification.description || '');
164
+ const icon = variants[notification.severity || ''];
165
+
166
+ const { closeSnackbar } = useSnackbar();
167
+ const onClickDismiss = () => closeSnackbar(key);
168
+
169
+ useEffect(() => {
170
+ toClickableSpan(notification.description || '', 'en').then((res) => {
171
+ setDescription(res);
201
172
  });
173
+ }, [notification.description]);
202
174
 
203
- return (
204
- <StyledSnackbarContent ref={ref} severity={notification.severity} breakpoint={breakpoint}>
205
- <MessageDiv>
206
- {icon ? <Icon icon={icon} fontSize={24} /> : null}
207
- <ClickableDiv onClick={onGoNotification} style={{ width: 'calc(100% - 30px)' }}>
208
- <Box>
209
- {includeActivity ? (
210
- <>
211
- <span className="title">{activityTitle}</span>
212
- {activityMeta ? (
213
- <Typography
214
- variant="subtitle2"
215
- fontSize={16}
216
- component="p"
217
- sx={{
218
- display: '-webkit-box',
219
- overflow: 'hidden',
220
- textOverflow: 'ellipsis',
221
- WebkitLineClamp: 3,
222
- WebkitBoxOrient: 'vertical',
223
- color: common.white,
224
- lineHeight: 1.2,
225
- }}>
226
- {activityMeta?.content}
227
- </Typography>
228
- ) : null}
229
- </>
230
- ) : (
231
- <>
232
- <span className="title">{notification.title}</span>
233
- {content || (
234
- <Typography
235
- component="span"
236
- className="desc"
237
- dangerouslySetInnerHTML={{ __html: sanitize(description) }}
238
- />
239
- )}
240
- </>
241
- )}
242
- </Box>
243
- </ClickableDiv>
244
- </MessageDiv>
245
- <ActionDiv>
246
- <IconButton key="close" aria-label="close" color="inherit" onClick={onClickDismiss} size="large">
247
- <CloseIconStyled />
248
- </IconButton>
249
- </ActionDiv>
250
- </StyledSnackbarContent>
251
- );
252
- }
253
- );
175
+ const onGoNotification = (e: any) => {
176
+ e.stopPropagation();
177
+ closeSnackbar(key);
254
178
 
255
- NotificationComponent.displayName = 'NotificationComponent';
179
+ // 已确认 viewAllUrl都是本地的相对地址
180
+ if (!e?.customPreventRedirect) {
181
+ window.open(viewAllUrl, '_blank');
182
+ }
183
+ };
256
184
 
257
- NotificationComponent.propTypes = {
258
- viewAllUrl: PropTypes.string.isRequired,
259
- keyId: PropTypes.number.isRequired,
260
- notification: PropTypes.object.isRequired,
261
- content: PropTypes.node,
262
- };
185
+ const includeActivity = useCreation(() => {
186
+ return isIncludeActivity(notification);
187
+ }, [notification]);
188
+ const activity = useCreation(() => {
189
+ return notification?.activity;
190
+ }, [notification]);
263
191
 
264
- NotificationComponent.defaultProps = {
265
- content: null,
266
- };
192
+ const activityMeta = useCreation(() => {
193
+ if (!activity || activity.type === 'tips') {
194
+ return null;
195
+ }
267
196
 
268
- export default NotificationComponent;
197
+ return activity?.meta;
198
+ }, [activity]);
199
+
200
+ const activityTitle = useActivityTitle({
201
+ activity,
202
+ users: [notification?.actorInfo],
203
+ actors: [notification?.activity?.actor],
204
+ extra: {
205
+ linkColor: common.white,
206
+ },
207
+ });
208
+
209
+ return (
210
+ <StyledSnackbarContent
211
+ ref={ref as React.Ref<HTMLDivElement>}
212
+ severity={notification.severity}
213
+ breakpoint={breakpoint}>
214
+ <MessageDiv>
215
+ {icon ? <Icon icon={icon} fontSize={24} /> : null}
216
+ <ClickableDiv onClick={onGoNotification} style={{ width: 'calc(100% - 30px)' }}>
217
+ <Box>
218
+ {includeActivity ? (
219
+ <>
220
+ <span className="title">{activityTitle}</span>
221
+ {activityMeta ? (
222
+ <Typography
223
+ variant="subtitle2"
224
+ component="p"
225
+ sx={{
226
+ fontSize: 16,
227
+ display: '-webkit-box',
228
+ overflow: 'hidden',
229
+ textOverflow: 'ellipsis',
230
+ WebkitLineClamp: 3,
231
+ WebkitBoxOrient: 'vertical',
232
+ color: common.white,
233
+ lineHeight: 1.2,
234
+ }}>
235
+ {activityMeta?.content}
236
+ </Typography>
237
+ ) : null}
238
+ </>
239
+ ) : (
240
+ <>
241
+ <span className="title">{notification.title}</span>
242
+ {content || (
243
+ <Typography
244
+ component="span"
245
+ className="desc"
246
+ dangerouslySetInnerHTML={{ __html: sanitize(description) }}
247
+ />
248
+ )}
249
+ </>
250
+ )}
251
+ </Box>
252
+ </ClickableDiv>
253
+ </MessageDiv>
254
+ <ActionDiv>
255
+ <IconButton key="close" aria-label="close" color="inherit" onClick={onClickDismiss} size="large">
256
+ <CloseIconStyled />
257
+ </IconButton>
258
+ </ActionDiv>
259
+ </StyledSnackbarContent>
260
+ );
261
+ }