@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
@@ -1,20 +1,20 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Box, Typography } from "@mui/material";
3
- import VerifiedIcon from "@mui/icons-material/Verified";
4
- export default function UserInfoItem({ data, verified, ...rest }) {
5
- return /* @__PURE__ */ jsxs(
6
- Box,
1
+ import { jsxs as t, jsx as i } from "react/jsx-runtime";
2
+ import { Box as n, Typography as o } from "@mui/material";
3
+ import { Verified as l } from "@mui/icons-material";
4
+ function x({ data: e, verified: s, ...r }) {
5
+ return /* @__PURE__ */ t(
6
+ n,
7
7
  {
8
- ...rest,
8
+ ...r,
9
9
  sx: {
10
10
  display: "flex",
11
11
  alignItems: "center",
12
12
  justifyContent: "space-between",
13
- ...rest.sx
13
+ ...r.sx
14
14
  },
15
15
  children: [
16
- /* @__PURE__ */ jsxs(
17
- Typography,
16
+ /* @__PURE__ */ t(
17
+ o,
18
18
  {
19
19
  sx: {
20
20
  display: "flex",
@@ -25,26 +25,39 @@ export default function UserInfoItem({ data, verified, ...rest }) {
25
25
  fontWeight: 500
26
26
  },
27
27
  children: [
28
- data.icon,
29
- data.title
28
+ e.icon,
29
+ e.title
30
30
  ]
31
31
  }
32
32
  ),
33
- /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "row", alignItems: "center", children: [
34
- /* @__PURE__ */ jsx(
35
- Typography,
36
- {
37
- sx: {
38
- color: "text.secondary",
39
- whiteSpace: "pre-wrap",
40
- fontSize: "14px"
41
- },
42
- children: data.content
43
- }
44
- ),
45
- verified && /* @__PURE__ */ jsx(VerifiedIcon, { color: "success", style: { fontSize: 16, marginLeft: 4 } })
46
- ] })
33
+ /* @__PURE__ */ t(
34
+ n,
35
+ {
36
+ sx: {
37
+ display: "flex",
38
+ flexDirection: "row",
39
+ alignItems: "center"
40
+ },
41
+ children: [
42
+ /* @__PURE__ */ i(
43
+ o,
44
+ {
45
+ sx: {
46
+ color: "text.secondary",
47
+ whiteSpace: "pre-wrap",
48
+ fontSize: "14px"
49
+ },
50
+ children: e.content
51
+ }
52
+ ),
53
+ s && /* @__PURE__ */ i(l, { color: "success", style: { fontSize: 16, marginLeft: 4 } })
54
+ ]
55
+ }
56
+ )
47
57
  ]
48
58
  }
49
59
  );
50
60
  }
61
+ export {
62
+ x as default
63
+ };
@@ -1,78 +1,63 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Box } from "@mui/material";
3
- import { Icon } from "@iconify/react";
4
- import { useMemoizedFn, useCreation } from "ahooks";
5
- import DID from "@arcblock/ux/lib/DID";
6
- import ScheduleOutlineRoundedIcon from "@iconify-icons/material-symbols/schedule-outline-rounded";
7
- import MoreTimeRoundedIcon from "@iconify-icons/material-symbols/more-time-rounded";
8
- import CaptivePortalRoundedIcon from "@iconify-icons/material-symbols/captive-portal-rounded";
9
- import SettingsInputAntennaRoundedIcon from "@iconify-icons/material-symbols/settings-input-antenna-rounded";
10
- import RelativeTime from "@arcblock/ux/lib/RelativeTime";
11
- import { translate } from "@arcblock/ux/lib/Locale/util";
12
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
13
- import { LOGIN_PROVIDER_NAME } from "@arcblock/ux/lib/Util/constant";
14
- import ShortenLabel from "@arcblock/ux/lib/UserCard/Content/shorten-label";
15
- import { translations } from "../../libs/locales.js";
16
- import UserInfoItem from "./user-info-item.js";
17
- export default function UserInfo({
18
- user,
19
- isMySelf = false,
20
- ...rest
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Box as I } from "@mui/material";
3
+ import { Icon as e } from "@iconify/react";
4
+ import { useMemoizedFn as v, useCreation as h } from "ahooks";
5
+ import x from "@arcblock/ux/lib/DID";
6
+ import g from "@iconify-icons/material-symbols/schedule-outline-rounded";
7
+ import L from "@iconify-icons/material-symbols/more-time-rounded";
8
+ import p from "@iconify-icons/material-symbols/captive-portal-rounded";
9
+ import A from "@iconify-icons/material-symbols/settings-input-antenna-rounded";
10
+ import f from "@arcblock/ux/lib/RelativeTime";
11
+ import { translate as R } from "@arcblock/ux/lib/Locale/util";
12
+ import { useLocaleContext as S } from "@arcblock/ux/lib/Locale/context";
13
+ import { LOGIN_PROVIDER_NAME as z } from "@arcblock/ux/lib/Util/constant";
14
+ import P from "@arcblock/ux/lib/UserCard/Content/shorten-label";
15
+ import { translations as w } from "../../libs/locales.js";
16
+ import D from "./user-info-item.js";
17
+ function V({
18
+ user: o,
19
+ isMySelf: l = !1,
20
+ ...c
21
21
  }) {
22
- const { locale } = useLocaleContext();
23
- const t = useMemoizedFn((key, data = {}) => {
24
- return translate(translations, key, locale, "en", data);
25
- });
26
- const readableProvider = useCreation(() => {
27
- return user?.sourceProvider && LOGIN_PROVIDER_NAME[user.sourceProvider] || t("unknown");
28
- }, [user?.sourceProvider]);
29
- const userInfoListData = [];
30
- if (isMySelf) {
31
- userInfoListData.push({
32
- icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: ScheduleOutlineRoundedIcon }),
33
- title: t("lastLoginAt"),
34
- content: user?.lastLoginAt ? (
35
- // @ts-ignore
36
- /* @__PURE__ */ jsx(RelativeTime, { locale, value: user?.lastLoginAt, relativeRange: 3 * 86400 * 1e3 })
37
- ) : t("unknown")
38
- });
39
- userInfoListData.push({
40
- icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: SettingsInputAntennaRoundedIcon }),
41
- title: t("lastLoginIp"),
42
- content: user?.lastLoginIp ? /* @__PURE__ */ jsx(ShortenLabel, { maxLength: 20, children: user?.lastLoginIp }) : t("unknown")
43
- });
44
- }
45
- userInfoListData.push({
46
- icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: MoreTimeRoundedIcon }),
47
- title: t("createdAt"),
22
+ const { locale: a } = S(), n = v((m, r = {}) => R(w, m, a, "en", r)), d = h(() => (o == null ? void 0 : o.sourceProvider) && z[o.sourceProvider] || n("unknown"), [o == null ? void 0 : o.sourceProvider]), i = [];
23
+ return l && (i.push({
24
+ icon: /* @__PURE__ */ t(e, { fontSize: 16, icon: g }),
25
+ title: n("lastLoginAt"),
26
+ content: o != null && o.lastLoginAt ? (
27
+ // @ts-ignore
28
+ /* @__PURE__ */ t(f, { locale: a, value: o == null ? void 0 : o.lastLoginAt, relativeRange: 3 * 86400 * 1e3 })
29
+ ) : n("unknown")
30
+ }), i.push({
31
+ icon: /* @__PURE__ */ t(e, { fontSize: 16, icon: A }),
32
+ title: n("lastLoginIp"),
33
+ content: o != null && o.lastLoginIp ? /* @__PURE__ */ t(P, { maxLength: 20, children: o == null ? void 0 : o.lastLoginIp }) : n("unknown")
34
+ })), i.push({
35
+ icon: /* @__PURE__ */ t(e, { fontSize: 16, icon: L }),
36
+ title: n("createdAt"),
48
37
  // @ts-ignore
49
- content: user?.createdAt ? /* @__PURE__ */ jsx(RelativeTime, { locale, value: user?.createdAt }) : t("unknown")
50
- });
51
- if (isMySelf) {
52
- userInfoListData.push({
53
- icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: CaptivePortalRoundedIcon }),
54
- title: t("registerFrom"),
55
- content: readableProvider
56
- });
57
- if (user?.inviter) {
58
- userInfoListData.push({
59
- icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: CaptivePortalRoundedIcon }),
60
- title: t("invitedBy"),
61
- content: /* @__PURE__ */ jsx(DID, { style: { maxWidth: 260 }, did: user.inviter, showQrcode: true, copyable: true, compact: true, responsive: true, locale })
62
- });
63
- }
64
- }
65
- return /* @__PURE__ */ jsx(
66
- Box,
38
+ content: o != null && o.createdAt ? /* @__PURE__ */ t(f, { locale: a, value: o == null ? void 0 : o.createdAt }) : n("unknown")
39
+ }), l && (i.push({
40
+ icon: /* @__PURE__ */ t(e, { fontSize: 16, icon: p }),
41
+ title: n("registerFrom"),
42
+ content: d
43
+ }), o != null && o.inviter && i.push({
44
+ icon: /* @__PURE__ */ t(e, { fontSize: 16, icon: p }),
45
+ title: n("invitedBy"),
46
+ content: /* @__PURE__ */ t(x, { style: { maxWidth: 260 }, did: o.inviter, showQrcode: !0, copyable: !0, compact: !0, responsive: !0, locale: a })
47
+ })), /* @__PURE__ */ t(
48
+ I,
67
49
  {
68
- ...rest,
50
+ ...c,
69
51
  sx: {
70
52
  display: "flex",
71
53
  flexDirection: "column",
72
54
  gap: 1.5,
73
- ...rest?.sx
55
+ ...c == null ? void 0 : c.sx
74
56
  },
75
- children: userInfoListData.map((item) => /* @__PURE__ */ jsx(UserInfoItem, { data: item, sx: { flex: 1 } }, item.title))
57
+ children: i.map((m) => /* @__PURE__ */ t(D, { data: m, sx: { flex: 1 } }, m.title))
76
58
  }
77
59
  );
78
60
  }
61
+ export {
62
+ V as default
63
+ };
@@ -1,185 +1,139 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import Badge from "@mui/material/Badge";
3
- import Box from "@mui/material/Box";
4
- import styled from "@emotion/styled";
5
- import { lazy, Suspense, useCallback, useEffect, useMemo, useState } from "react";
6
- import { useCreation, useMemoizedFn, useInterval, useUnmount } from "ahooks";
7
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
8
- import Tooltip from "@mui/material/Tooltip";
9
- import { translate } from "@arcblock/ux/lib/Locale/util";
10
- import { formatToDatetime } from "@arcblock/ux/lib/Util";
11
- import { DurationEnum, StatusEnum } from "../../../@types/index.js";
12
- import StatusDialog from "../status-dialog/index.js";
13
- import { translations } from "../../libs/locales.js";
14
- import { getTimeRemaining, isNotClear, isWithinTimeRange } from "./utils.js";
15
- const MeetingIcon = lazy(() => import("@arcblock/icons/lib/Meeting"));
16
- const CommunityIcon = lazy(() => import("@arcblock/icons/lib/Community"));
17
- const HolidayIcon = lazy(() => import("@arcblock/icons/lib/Holiday"));
18
- const OffSickIcon = lazy(() => import("@arcblock/icons/lib/OffSick"));
19
- const WorkingRemotelyIcon = lazy(() => import("@arcblock/icons/lib/WorkingRemotely"));
20
- const StatusIconMap = {
21
- [StatusEnum.Meeting]: MeetingIcon,
22
- [StatusEnum.Community]: CommunityIcon,
23
- [StatusEnum.Holiday]: HolidayIcon,
24
- [StatusEnum.OffSick]: OffSickIcon,
25
- [StatusEnum.WorkingRemotely]: WorkingRemotelyIcon
26
- };
27
- const QuickSettings = {
28
- [StatusEnum.Meeting]: {
29
- duration: DurationEnum.OneHour,
1
+ import { jsxs as E, jsx as l } from "react/jsx-runtime";
2
+ import { Tooltip as H, Box as z, Badge as B } from "@mui/material";
3
+ import U from "@emotion/styled";
4
+ import { lazy as m, useState as C, useEffect as q, useCallback as A, useMemo as F, Suspense as L } from "react";
5
+ import { useMemoizedFn as T, useInterval as Q, useUnmount as G, useCreation as J } from "ahooks";
6
+ import { useLocaleContext as K } from "@arcblock/ux/lib/Locale/context";
7
+ import { translate as P } from "@arcblock/ux/lib/Locale/util";
8
+ import { formatToDatetime as V } from "@arcblock/ux/lib/Util";
9
+ import { StatusEnum as t, DurationEnum as c } from "../../../@types/index.js";
10
+ import X from "../status-dialog/index.js";
11
+ import { translations as Y } from "../../libs/locales.js";
12
+ import { isNotClear as $, isWithinTimeRange as Z, getTimeRemaining as _ } from "./utils.js";
13
+ const ee = m(() => import("@arcblock/icons/lib/Meeting")), oe = m(() => import("@arcblock/icons/lib/Community")), ne = m(() => import("@arcblock/icons/lib/Holiday")), te = m(() => import("@arcblock/icons/lib/OffSick")), ie = m(() => import("@arcblock/icons/lib/WorkingRemotely")), I = {
14
+ [t.Meeting]: ee,
15
+ [t.Community]: oe,
16
+ [t.Holiday]: ne,
17
+ [t.OffSick]: te,
18
+ [t.WorkingRemotely]: ie
19
+ }, re = {
20
+ [t.Meeting]: {
21
+ duration: c.OneHour,
30
22
  durationName: "userStatus.duration.OneHour"
31
23
  },
32
- [StatusEnum.Community]: {
33
- duration: DurationEnum.ThirtyMinutes,
24
+ [t.Community]: {
25
+ duration: c.ThirtyMinutes,
34
26
  durationName: "userStatus.duration.ThirtyMinutes"
35
27
  },
36
- [StatusEnum.Holiday]: {
37
- duration: DurationEnum.ThisWeek,
28
+ [t.Holiday]: {
29
+ duration: c.ThisWeek,
38
30
  durationName: "userStatus.duration.ThisWeek"
39
31
  },
40
- [StatusEnum.OffSick]: {
41
- duration: DurationEnum.Today,
32
+ [t.OffSick]: {
33
+ duration: c.Today,
42
34
  durationName: "userStatus.duration.Today"
43
35
  },
44
- [StatusEnum.WorkingRemotely]: {
45
- duration: DurationEnum.ThisWeek,
36
+ [t.WorkingRemotely]: {
37
+ duration: c.ThisWeek,
46
38
  durationName: "userStatus.duration.ThisWeek"
47
39
  }
48
40
  };
49
- export default function UserStatus({
50
- isMobile,
51
- size,
52
- isMyself,
53
- status,
54
- onChange,
55
- timezone
41
+ function ke({
42
+ isMobile: o,
43
+ size: R,
44
+ isMyself: g,
45
+ status: e,
46
+ onChange: s,
47
+ timezone: W
56
48
  }) {
57
- const { locale } = useLocaleContext();
58
- const t = useMemoizedFn((key, data = {}) => {
59
- return translate(translations, key, locale, "en", data);
60
- });
61
- const [interval, setInterval] = useState(void 0);
62
- const pauseInterval = useMemoizedFn(() => {
63
- setInterval(void 0);
49
+ const { locale: d } = K(), u = T((n, i = {}) => P(Y, n, d, "en", i)), [b, p] = C(void 0), f = T(() => {
50
+ p(void 0);
64
51
  });
65
- useEffect(() => {
66
- setInterval(1e3);
67
- }, [status]);
68
- const clear = useInterval(() => {
69
- if (status?.value && status?.dateRange?.length === 2) {
70
- const notClear = isNotClear(status);
71
- if (notClear) {
52
+ q(() => {
53
+ p(1e3);
54
+ }, [e]);
55
+ const N = Q(() => {
56
+ var n;
57
+ if (e != null && e.value && ((n = e == null ? void 0 : e.dateRange) == null ? void 0 : n.length) === 2) {
58
+ if ($(e))
72
59
  return;
60
+ if (!Z(e.dateRange))
61
+ f(), s(void 0);
62
+ else {
63
+ const a = _(e.dateRange[1]);
64
+ a > 0 ? p(a) : (f(), s(void 0));
73
65
  }
74
- const isWithin = isWithinTimeRange(status.dateRange);
75
- if (!isWithin) {
76
- pauseInterval();
77
- onChange(void 0);
78
- } else {
79
- const timeRemaining = getTimeRemaining(status.dateRange[1]);
80
- if (timeRemaining > 0) {
81
- setInterval(timeRemaining);
82
- } else {
83
- pauseInterval();
84
- onChange(void 0);
85
- }
86
- }
87
- } else {
88
- pauseInterval();
89
- }
90
- }, interval);
91
- useUnmount(() => {
92
- clear();
66
+ } else
67
+ f();
68
+ }, b);
69
+ G(() => {
70
+ N();
93
71
  });
94
- const [anchorEl, setAnchorEl] = useState(null);
95
- const getDurationData = useCallback(() => {
96
- const data = Object.keys(DurationEnum).map((key) => ({
97
- id: DurationEnum[key],
98
- name: t(`userStatus.duration.${key}`)
99
- }));
100
- return data;
101
- }, [t]);
102
- const statusData = useCreation(() => {
103
- const durationData = getDurationData();
104
- return Object.keys(StatusEnum).map((key) => {
105
- const quickSetting = QuickSettings[StatusEnum[key]];
72
+ const [O, S] = C(null), x = A(() => Object.keys(c).map((i) => ({
73
+ id: c[i],
74
+ name: u(`userStatus.duration.${i}`)
75
+ })), [u]), h = J(() => {
76
+ const n = x();
77
+ return Object.keys(t).map((i) => {
78
+ const r = re[t[i]];
106
79
  return {
107
- id: StatusEnum[key],
108
- name: t(`userStatus.${key}`),
109
- icon: StatusIconMap[StatusEnum[key]],
110
- ...quickSetting ? { duration: quickSetting.duration, durationName: t(quickSetting.durationName) } : {},
111
- children: durationData
80
+ id: t[i],
81
+ name: u(`userStatus.${i}`),
82
+ icon: I[t[i]],
83
+ ...r ? { duration: r.duration, durationName: u(r.durationName) } : {},
84
+ children: n
112
85
  };
113
86
  });
114
- }, [t, getDurationData, locale]);
115
- const onOpenStatusSelector = (event) => {
116
- if (!isMyself) {
117
- return;
118
- }
119
- setAnchorEl(event.currentTarget);
120
- };
121
- const onCloseStatusSelector = () => {
122
- setAnchorEl(null);
123
- };
124
- const onStatusChange = (v) => {
125
- if (!isMyself) {
126
- return;
127
- }
128
- onChange(v);
129
- onCloseStatusSelector();
130
- };
131
- const StatusIcon = StatusIconMap[status?.value];
132
- const tooltipTitle = useMemo(() => {
133
- const currentStatus = statusData.find((item) => item.id === status?.value);
134
- if (currentStatus) {
135
- const localeOption = locale === "zh" ? "zh-cn" : "en-us";
136
- let range;
137
- const notClear = isNotClear(status);
138
- if (!notClear) {
139
- range = status?.dateRange?.map((item) => {
140
- return formatToDatetime(item, { locale: localeOption });
141
- });
142
- }
143
- if (range && range.length > 0) {
144
- return `${currentStatus.name}: ${range.join("~")}`;
145
- }
146
- return currentStatus.name;
87
+ }, [u, x, d]), D = (n) => {
88
+ g && S(n.currentTarget);
89
+ }, y = () => {
90
+ S(null);
91
+ }, j = (n) => {
92
+ g && (s(n), y());
93
+ }, k = I[e == null ? void 0 : e.value], M = F(() => {
94
+ var i;
95
+ const n = h.find((r) => r.id === (e == null ? void 0 : e.value));
96
+ if (n) {
97
+ const r = d === "zh" ? "zh-cn" : "en-us";
98
+ let a;
99
+ return $(e) || (a = (i = e == null ? void 0 : e.dateRange) == null ? void 0 : i.map((w) => V(w, { locale: r }))), a && a.length > 0 ? `${n.name}: ${a.join("~")}` : n.name;
147
100
  }
148
101
  return null;
149
- }, [status, statusData, locale]);
150
- const open = Boolean(anchorEl);
151
- return /* @__PURE__ */ jsxs(StatusDiv, { size, isMobile, children: [
152
- /* @__PURE__ */ jsx(Tooltip, { title: tooltipTitle, children: /* @__PURE__ */ jsx(
153
- Box,
102
+ }, [e, h, d]), v = !!O;
103
+ return /* @__PURE__ */ E(ae, { size: R, isMobile: o, children: [
104
+ /* @__PURE__ */ l(H, { title: M, children: /* @__PURE__ */ l(
105
+ z,
154
106
  {
155
107
  className: "status-icon",
156
- display: "flex",
157
- alignItems: "center",
158
- justifyContent: "center",
159
- onClick: onOpenStatusSelector,
160
- children: StatusIcon ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(StatusIcon, { style: { width: 16, height: 16 } }) }) : /* @__PURE__ */ jsx(Badge, { color: "success", variant: "dot" })
108
+ onClick: D,
109
+ sx: {
110
+ display: "flex",
111
+ alignItems: "center",
112
+ justifyContent: "center"
113
+ },
114
+ children: k ? /* @__PURE__ */ l(L, { fallback: null, children: /* @__PURE__ */ l(k, { style: { width: 16, height: 16 } }) }) : /* @__PURE__ */ l(B, { color: "success", variant: "dot" })
161
115
  }
162
116
  ) }),
163
- open && /* @__PURE__ */ jsx(
164
- StatusDialog,
117
+ v && /* @__PURE__ */ l(
118
+ X,
165
119
  {
166
- selected: status,
167
- data: statusData,
168
- open,
169
- onSelect: onStatusChange,
170
- onClose: onCloseStatusSelector,
171
- timezone
120
+ selected: e,
121
+ data: h,
122
+ open: v,
123
+ onSelect: j,
124
+ onClose: y,
125
+ timezone: W
172
126
  }
173
127
  )
174
128
  ] });
175
129
  }
176
- const StatusDiv = styled("div")`
130
+ const ae = U("div")`
177
131
  position: absolute;
178
- left: ${({ size }) => `${size * 3 / 4}px`};
179
- top: ${({ size }) => `${size * 0.65}px`};
180
- width: ${({ isMobile }) => isMobile ? "22px" : "32px"};
181
- height: ${({ isMobile }) => isMobile ? "22px" : "32px"};
182
- border-radius: ${({ isMobile }) => isMobile ? "11px" : "16px"};
132
+ left: ${({ size: o }) => `${o * 3 / 4}px`};
133
+ top: ${({ size: o }) => `${o * 0.65}px`};
134
+ width: ${({ isMobile: o }) => o ? "22px" : "32px"};
135
+ height: ${({ isMobile: o }) => o ? "22px" : "32px"};
136
+ border-radius: ${({ isMobile: o }) => o ? "11px" : "16px"};
183
137
  display: flex;
184
138
  align-items: center;
185
139
  justify-content: center;
@@ -190,9 +144,12 @@ const StatusDiv = styled("div")`
190
144
 
191
145
  .status-icon {
192
146
  flex-shrink: 0;
193
- width: ${({ isMobile }) => isMobile ? "16px" : "26px"};
194
- height: ${({ isMobile }) => isMobile ? "16px" : "26px"};
195
- border-radius: ${({ isMobile }) => isMobile ? "8px" : "13px"};
147
+ width: ${({ isMobile: o }) => o ? "16px" : "26px"};
148
+ height: ${({ isMobile: o }) => o ? "16px" : "26px"};
149
+ border-radius: ${({ isMobile: o }) => o ? "8px" : "13px"};
196
150
  background-color: #eff1f5;
197
151
  }
198
152
  `;
153
+ export {
154
+ ke as default
155
+ };