@blocklet/ui-react 2.13.70 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) 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 +90 -66
  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 +159 -156
  56. package/lib/UserCenter/components/user-info/metadata.js +291 -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 +52 -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 +29 -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 +23 -5
  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 +31 -13
  318. package/src/UserCenter/components/user-info/metadata.tsx +44 -37
  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/webhook-item.tsx +4 -2
  324. package/src/UserSessions/components/user-sessions.tsx +1 -1
  325. package/src/common/domain-warning.jsx +2 -14
  326. package/src/common/header-addons.jsx +8 -11
  327. package/src/common/notification-addon.jsx +1 -7
  328. package/src/common/overridable-theme-provider.jsx +1 -5
  329. package/src/common/ws.js +2 -2
  330. package/src/contexts/config-user-space.tsx +3 -3
  331. package/vite.config.mjs +31 -0
  332. package/lib/@types/shims.d.ts +0 -18
  333. package/lib/ComponentInstaller/index.d.ts +0 -37
  334. package/lib/ComponentInstaller/installer-item.d.ts +0 -21
  335. package/lib/ComponentManager/components/check-component.d.ts +0 -2
  336. package/lib/Dashboard/index.d.ts +0 -44
  337. package/lib/Footer/brand.d.ts +0 -22
  338. package/lib/Footer/copyright.d.ts +0 -18
  339. package/lib/Footer/index.d.ts +0 -6
  340. package/lib/Footer/internal-footer.d.ts +0 -29
  341. package/lib/Footer/layout/plain.d.ts +0 -15
  342. package/lib/Footer/layout/row.d.ts +0 -18
  343. package/lib/Footer/layout/standard.d.ts +0 -17
  344. package/lib/Footer/links.d.ts +0 -23
  345. package/lib/Footer/social-media.d.ts +0 -14
  346. package/lib/Notifications/Snackbar.d.ts +0 -14
  347. package/lib/UserCenter/components/danger-zone.d.ts +0 -1
  348. package/lib/UserCenter/components/passport.d.ts +0 -5
  349. package/lib/UserCenter/components/status-selector/duration-menu.d.ts +0 -7
  350. package/lib/UserCenter/components/storage/disconnect.d.ts +0 -2
  351. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
  352. package/lib/UserCenter/components/storage/icons/long-arrow.svg +0 -5
  353. package/lib/UserCenter/components/storage/icons/space-connected.svg +0 -3
  354. package/lib/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
  355. package/lib/UserCenter/components/storage/index.d.ts +0 -2
  356. package/lib/UserCenter/components/third-party-login/index.d.ts +0 -4
  357. package/lib/UserCenter/components/user-info/switch-role.d.ts +0 -7
  358. package/lib/UserCenter/components/user-info/user-info.d.ts +0 -6
  359. package/lib/common/domain-warning.d.ts +0 -17
  360. package/lib/common/header-addons.d.ts +0 -27
  361. package/lib/types.d.ts +0 -2
  362. /package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/locales.d.ts +0 -0
  363. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/index.d.ts +0 -0
  364. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/libs/locales.d.ts +0 -0
  365. /package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-width.d.ts +0 -0
  366. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/index.d.ts +0 -0
  367. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/index.d.ts +0 -0
  368. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/locales.d.ts +0 -0
  369. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/index.d.ts +0 -0
  370. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/locales.d.ts +0 -0
  371. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/utils.d.ts +0 -0
  372. /package/lib/{blocklets.d.ts → packages/blocklet-ui-react/src/blocklets.d.ts} +0 -0
  373. /package/lib/{common → packages/blocklet-ui-react/src/common}/wallet-hidden-topbar.d.ts +0 -0
  374. /package/lib/{common → packages/blocklet-ui-react/src/common}/ws.d.ts +0 -0
  375. /package/lib/{hooks → packages/blocklet-ui-react/src/hooks}/use-mobile.d.ts +0 -0
  376. /package/lib/{index.d.ts → packages/blocklet-ui-react/src/index.d.ts} +0 -0
  377. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/client.d.ts +0 -0
  378. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/constant.d.ts +0 -0
  379. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/spaces.d.ts +0 -0
  380. /package/lib/{utils.d.ts → packages/blocklet-ui-react/src/utils.d.ts} +0 -0
@@ -1,12 +1,12 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Box } from "@mui/material";
3
- import { useMemoizedFn } from "ahooks";
4
- import { translate } from "@arcblock/ux/lib/Locale/util";
5
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
6
- import CountrySelect from "@arcblock/ux/lib/PhoneInput/country-select";
7
- import { translations } from "../../libs/locales.js";
8
- import EditableField from "../editable-field.js";
9
- const selectStyle = {
1
+ import { jsxs as a, jsx as l } from "react/jsx-runtime";
2
+ import { Box as p } from "@mui/material";
3
+ import { useMemoizedFn as u } from "ahooks";
4
+ import { translate as f } from "@arcblock/ux/lib/Locale/util";
5
+ import { useLocaleContext as m } from "@arcblock/ux/lib/Locale/context";
6
+ import y from "@arcblock/ux/lib/PhoneInput/country-select";
7
+ import { translations as b } from "../../libs/locales.js";
8
+ import n from "../editable-field.js";
9
+ const v = {
10
10
  width: "100%",
11
11
  px: 2,
12
12
  py: 1,
@@ -26,100 +26,120 @@ const selectStyle = {
26
26
  alignItems: "center"
27
27
  }
28
28
  };
29
- export default function AddressEditor({
30
- address,
31
- errors,
32
- handleChange,
33
- defaultCountry
29
+ function I({
30
+ address: r,
31
+ errors: t,
32
+ handleChange: i,
33
+ defaultCountry: d
34
34
  }) {
35
- const { locale } = useLocaleContext();
36
- const t = useMemoizedFn((key, data = {}) => {
37
- return translate(translations, key, locale, "en", data);
38
- });
39
- return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: 2, mt: 2, children: [
40
- /* @__PURE__ */ jsx(
41
- EditableField,
42
- {
43
- placeholder: t("profile.address.country"),
44
- value: address.country || defaultCountry,
45
- editable: true,
46
- errorMsg: errors.country,
47
- label: t("profile.address.country"),
48
- children: /* @__PURE__ */ jsx(
49
- CountrySelect,
35
+ const { locale: s } = m(), o = u((e, c = {}) => f(b, e, s, "en", c));
36
+ return /* @__PURE__ */ a(
37
+ p,
38
+ {
39
+ sx: {
40
+ display: "flex",
41
+ flexDirection: "column",
42
+ gap: 2,
43
+ mt: 2
44
+ },
45
+ children: [
46
+ /* @__PURE__ */ l(
47
+ n,
50
48
  {
51
- value: address.country || defaultCountry,
52
- onChange: (v) => handleChange("country", v),
53
- displayEmpty: true,
54
- variant: "outlined",
55
- selectCountryProps: {
56
- hideDialCode: true
49
+ placeholder: o("profile.address.country"),
50
+ value: r.country || d,
51
+ editable: !0,
52
+ errorMsg: t.country,
53
+ label: o("profile.address.country"),
54
+ children: /* @__PURE__ */ l(
55
+ y,
56
+ {
57
+ value: r.country || d,
58
+ onChange: (e) => i("country", e),
59
+ displayEmpty: !0,
60
+ variant: "outlined",
61
+ selectCountryProps: {
62
+ hideDialCode: !0
63
+ },
64
+ sx: v
65
+ }
66
+ )
67
+ }
68
+ ),
69
+ /* @__PURE__ */ a(
70
+ p,
71
+ {
72
+ sx: {
73
+ display: "flex",
74
+ gap: 2
57
75
  },
58
- sx: selectStyle
76
+ children: [
77
+ /* @__PURE__ */ l(
78
+ n,
79
+ {
80
+ value: r.province || "",
81
+ onChange: (e) => i("province", e),
82
+ placeholder: o("profile.address.province"),
83
+ label: o("profile.address.province"),
84
+ editable: !0,
85
+ errorMsg: t.province
86
+ }
87
+ ),
88
+ /* @__PURE__ */ l(
89
+ n,
90
+ {
91
+ value: r.city || "",
92
+ onChange: (e) => i("city", e),
93
+ placeholder: o("profile.address.city"),
94
+ label: o("profile.address.city"),
95
+ editable: !0,
96
+ errorMsg: t.city
97
+ }
98
+ )
99
+ ]
100
+ }
101
+ ),
102
+ /* @__PURE__ */ l(
103
+ n,
104
+ {
105
+ value: r.line1 || "",
106
+ onChange: (e) => i("line1", e),
107
+ placeholder: o("profile.address.line1"),
108
+ label: o("profile.address.line1"),
109
+ component: "textarea",
110
+ editable: !0,
111
+ rows: 2,
112
+ errorMsg: t.line1
113
+ }
114
+ ),
115
+ /* @__PURE__ */ l(
116
+ n,
117
+ {
118
+ value: r.line2 || "",
119
+ onChange: (e) => i("line2", e),
120
+ placeholder: o("profile.address.line2"),
121
+ label: o("profile.address.line2"),
122
+ component: "textarea",
123
+ editable: !0,
124
+ rows: 2,
125
+ errorMsg: t.line2
126
+ }
127
+ ),
128
+ /* @__PURE__ */ l(
129
+ n,
130
+ {
131
+ value: r.postalCode || "",
132
+ onChange: (e) => i("postalCode", e),
133
+ placeholder: o("profile.address.postalCode"),
134
+ label: o("profile.address.postalCode"),
135
+ editable: !0,
136
+ errorMsg: t.postalCode
59
137
  }
60
138
  )
61
- }
62
- ),
63
- /* @__PURE__ */ jsxs(Box, { display: "flex", gap: 2, children: [
64
- /* @__PURE__ */ jsx(
65
- EditableField,
66
- {
67
- value: address.province || "",
68
- onChange: (value) => handleChange("province", value),
69
- placeholder: t("profile.address.province"),
70
- label: t("profile.address.province"),
71
- editable: true,
72
- errorMsg: errors.province
73
- }
74
- ),
75
- /* @__PURE__ */ jsx(
76
- EditableField,
77
- {
78
- value: address.city || "",
79
- onChange: (value) => handleChange("city", value),
80
- placeholder: t("profile.address.city"),
81
- label: t("profile.address.city"),
82
- editable: true,
83
- errorMsg: errors.city
84
- }
85
- )
86
- ] }),
87
- /* @__PURE__ */ jsx(
88
- EditableField,
89
- {
90
- value: address.line1 || "",
91
- onChange: (value) => handleChange("line1", value),
92
- placeholder: t("profile.address.line1"),
93
- label: t("profile.address.line1"),
94
- component: "textarea",
95
- editable: true,
96
- rows: 2,
97
- errorMsg: errors.line1
98
- }
99
- ),
100
- /* @__PURE__ */ jsx(
101
- EditableField,
102
- {
103
- value: address.line2 || "",
104
- onChange: (value) => handleChange("line2", value),
105
- placeholder: t("profile.address.line2"),
106
- label: t("profile.address.line2"),
107
- component: "textarea",
108
- editable: true,
109
- rows: 2,
110
- errorMsg: errors.line2
111
- }
112
- ),
113
- /* @__PURE__ */ jsx(
114
- EditableField,
115
- {
116
- value: address.postalCode || "",
117
- onChange: (value) => handleChange("postalCode", value),
118
- placeholder: t("profile.address.postalCode"),
119
- label: t("profile.address.postalCode"),
120
- editable: true,
121
- errorMsg: errors.postalCode
122
- }
123
- )
124
- ] });
139
+ ]
140
+ }
141
+ );
125
142
  }
143
+ export {
144
+ I as default
145
+ };
@@ -1,4 +1,10 @@
1
- export { default as UserBasicInfo } from "./user-basic-info.js";
2
- export { default as UserInfoItem } from "./user-info-item.js";
3
- export { default as UserInfo } from "./user-info.js";
4
- export { default as SwitchRole } from "./switch-role.js";
1
+ import { default as f } from "./user-basic-info.js";
2
+ import { default as t } from "./user-info-item.js";
3
+ import { default as s } from "./user-info.js";
4
+ import { default as m } from "./switch-role.js";
5
+ export {
6
+ m as SwitchRole,
7
+ f as UserBasicInfo,
8
+ s as UserInfo,
9
+ t as UserInfoItem
10
+ };
@@ -1,188 +1,188 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Box, Button, FormControl, IconButton, styled, TextField, Typography } from "@mui/material";
3
- import RemoveIcon from "@mui/icons-material/Remove";
4
- import AddIcon from "@mui/icons-material/Add";
5
- import useTheme from "@mui/material/styles/useTheme";
6
- import { useEffect, useMemo, useState } from "react";
7
- import { translate } from "@arcblock/ux/lib/Locale/util";
8
- import { useMemoizedFn } from "ahooks";
9
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
10
- import LinkIcon from "@arcblock/icons/lib/Link";
11
- import { mergeSx } from "@arcblock/ux/lib/Util/style";
12
- import { joinURL, withoutProtocol } from "ufo";
13
- import { isValidUrl } from "./utils.js";
14
- import { translations } from "../../libs/locales.js";
15
- import { commonInputStyle, inputFieldStyle } from "../editable-field.js";
16
- function formatLinkDisplay(link) {
17
- return withoutProtocol(link);
1
+ import { jsx as t, jsxs as g } from "react/jsx-runtime";
2
+ import { useState as y, useMemo as w, useEffect as L } from "react";
3
+ import { styled as b, Box as c, Typography as C, IconButton as I, Button as F, useTheme as E, FormControl as U, TextField as D } from "@mui/material";
4
+ import { Remove as S, Add as k } from "@mui/icons-material";
5
+ import { translate as R } from "@arcblock/ux/lib/Locale/util";
6
+ import { useMemoizedFn as j } from "ahooks";
7
+ import { useLocaleContext as B } from "@arcblock/ux/lib/Locale/context";
8
+ import T from "@arcblock/icons/lib/Link";
9
+ import { mergeSx as z } from "@arcblock/ux/lib/Util/style";
10
+ import { joinURL as M, withoutProtocol as P } from "ufo";
11
+ import { isValidUrl as v } from "./utils.js";
12
+ import { translations as W } from "../../libs/locales.js";
13
+ import { inputFieldStyle as _, commonInputStyle as A } from "../editable-field.js";
14
+ function V(e) {
15
+ return P(e);
18
16
  }
19
- function LinkInput({
20
- value,
21
- onChange,
22
- errorMsg
17
+ function $({
18
+ value: e,
19
+ onChange: n,
20
+ errorMsg: i
23
21
  }) {
24
- const handleUrlChange = (event) => {
25
- const inputValue = event.target.value;
26
- onChange(inputValue);
27
- };
28
- return /* @__PURE__ */ jsx(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx(
29
- TextField,
22
+ return /* @__PURE__ */ t(U, { fullWidth: !0, children: /* @__PURE__ */ t(
23
+ D,
30
24
  {
31
25
  variant: "outlined",
32
- value,
33
- onChange: handleUrlChange,
34
- fullWidth: true,
35
- error: !!errorMsg,
36
- helperText: errorMsg,
37
- sx: mergeSx(inputFieldStyle, !errorMsg ? commonInputStyle : {})
26
+ value: e,
27
+ onChange: (r) => {
28
+ const d = r.target.value;
29
+ n(d);
30
+ },
31
+ fullWidth: !0,
32
+ error: !!i,
33
+ helperText: i,
34
+ sx: z(_, i ? {} : A)
38
35
  }
39
36
  ) });
40
37
  }
41
- function DynamicLinkForm({ links = [], onChange }) {
42
- const { locale } = useLocaleContext();
43
- const t = useMemoizedFn((key, data = {}) => {
44
- return translate(translations, key, locale, "en", data);
45
- });
46
- const [errors, setErrors] = useState([false]);
47
- const isLastError = useMemo(() => {
48
- const lastLink = links[links.length - 1];
49
- return !isValidUrl(lastLink) || errors.length > 0 && errors[errors.length - 1];
50
- }, [errors, links]);
51
- const handleAddLink = () => {
52
- if (links.length < 5 || !isLastError) {
53
- onChange([...links, ""]);
54
- }
55
- };
56
- const handleRemoveLink = (index) => {
57
- const updatedLinks = links.filter((_, i) => i !== index);
58
- const updatedErrors = errors.filter((_, i) => i !== index);
59
- setErrors(updatedErrors);
60
- onChange(updatedLinks);
38
+ function q({ links: e = [], onChange: n }) {
39
+ const { locale: i } = B(), l = j((a, o = {}) => R(W, a, i, "en", o)), [r, d] = y([!1]), f = w(() => {
40
+ const a = e[e.length - 1];
41
+ return !v(a) || r.length > 0 && r[r.length - 1];
42
+ }, [r, e]), p = () => {
43
+ (e.length < 5 || !f) && n([...e, ""]);
44
+ }, u = (a) => {
45
+ const o = e.filter((h, x) => x !== a), s = r.filter((h, x) => x !== a);
46
+ d(s), n(o);
47
+ }, m = (a, o) => {
48
+ const s = [...e];
49
+ s[a] = o;
50
+ const h = [...r];
51
+ h[a] = !!(o && !v(o)), d(h), n(s);
61
52
  };
62
- const handleInputChange = (index, value) => {
63
- const updatedLinks = [...links];
64
- updatedLinks[index] = value;
65
- const updatedErrors = [...errors];
66
- updatedErrors[index] = !!(value && !isValidUrl(value));
67
- setErrors(updatedErrors);
68
- onChange(updatedLinks);
69
- };
70
- return /* @__PURE__ */ jsxs(Box, { width: "100%", children: [
71
- /* @__PURE__ */ jsx(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", gap: 1, children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", gutterBottom: true, sx: { mb: 0, fontSize: "12px", color: "text.primary" }, children: t("profile.socialMedia") }) }),
72
- links.map((link, index) => (
73
- // eslint-disable-next-line react/no-array-index-key
74
- /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "flex-start", mb: 1, children: [
75
- /* @__PURE__ */ jsx(
76
- LinkInput,
53
+ return /* @__PURE__ */ g(
54
+ c,
55
+ {
56
+ sx: {
57
+ width: "100%"
58
+ },
59
+ children: [
60
+ /* @__PURE__ */ t(
61
+ c,
77
62
  {
78
- value: link,
79
- onChange: (value) => handleInputChange(index, value),
80
- errorMsg: errors[index] ? t("profile.invalidURL") : ""
63
+ sx: {
64
+ display: "flex",
65
+ justifyContent: "space-between",
66
+ alignItems: "center",
67
+ gap: 1
68
+ },
69
+ children: /* @__PURE__ */ t(C, { variant: "subtitle1", gutterBottom: !0, sx: { mb: 0, fontSize: "12px", color: "text.primary" }, children: l("profile.socialMedia") })
81
70
  }
82
71
  ),
83
- /* @__PURE__ */ jsx(IconButton, { onClick: () => handleRemoveLink(index), children: /* @__PURE__ */ jsx(RemoveIcon, { sx: { color: "text.secondary" } }) })
84
- ] }, index)
85
- )),
86
- links.length < 5 && /* @__PURE__ */ jsxs(
87
- Button,
88
- {
89
- fullWidth: true,
90
- variant: "outlined",
91
- disabled: isLastError,
92
- onClick: handleAddLink,
93
- size: "small",
94
- sx: {
95
- height: "40px",
96
- border: "1px dashed",
97
- borderColor: "grey.100",
98
- color: "text.primary",
99
- "&:hover": {
100
- borderColor: "grey.100",
101
- backgroundColor: "action.hover"
72
+ e.map((a, o) => /* @__PURE__ */ g(
73
+ c,
74
+ {
75
+ sx: {
76
+ display: "flex",
77
+ alignItems: "flex-start",
78
+ mb: 1
79
+ },
80
+ children: [
81
+ /* @__PURE__ */ t(
82
+ $,
83
+ {
84
+ value: a,
85
+ onChange: (s) => m(o, s),
86
+ errorMsg: r[o] ? l("profile.invalidURL") : ""
87
+ }
88
+ ),
89
+ /* @__PURE__ */ t(I, { onClick: () => u(o), children: /* @__PURE__ */ t(S, { sx: { color: "text.secondary" } }) })
90
+ ]
102
91
  },
103
- "&.Mui-disabled": {
104
- borderStyle: "dashed"
92
+ o
93
+ )),
94
+ e.length < 5 && /* @__PURE__ */ g(
95
+ F,
96
+ {
97
+ fullWidth: !0,
98
+ variant: "outlined",
99
+ disabled: f,
100
+ onClick: p,
101
+ size: "small",
102
+ sx: {
103
+ height: "40px",
104
+ border: "1px dashed",
105
+ borderColor: "grey.100",
106
+ color: "text.primary",
107
+ "&:hover": {
108
+ borderColor: "grey.100",
109
+ backgroundColor: "action.hover"
110
+ },
111
+ "&.Mui-disabled": {
112
+ borderStyle: "dashed"
113
+ }
114
+ },
115
+ children: [
116
+ /* @__PURE__ */ t(k, {}),
117
+ " ",
118
+ /* @__PURE__ */ t("span", { children: l("profile.addLink") })
119
+ ]
105
120
  }
106
- },
107
- children: [
108
- /* @__PURE__ */ jsx(AddIcon, {}),
109
- " ",
110
- /* @__PURE__ */ jsx("span", { children: t("profile.addLink") })
111
- ]
112
- }
113
- )
114
- ] });
121
+ )
122
+ ]
123
+ }
124
+ );
115
125
  }
116
- function FaviconPreview({ link }) {
117
- const [favicon, setFavicon] = useState("");
118
- const [iconError, setIconError] = useState(false);
119
- const theme = useTheme();
120
- const isDark = theme.palette.mode === "dark";
121
- useEffect(() => {
126
+ function G({ link: e }) {
127
+ const [n, i] = y(""), [l, r] = y(!1), f = E().palette.mode === "dark";
128
+ return L(() => {
122
129
  try {
123
- if (link) {
124
- const url = new URL(link);
125
- const faviconUrl = joinURL(url.origin, "favicon.ico");
126
- const img = new Image();
127
- img.src = faviconUrl;
128
- img.onload = () => {
129
- setFavicon(faviconUrl);
130
- setIconError(false);
131
- };
132
- img.onerror = () => {
133
- setIconError(true);
134
- setFavicon("");
130
+ if (e) {
131
+ const p = new URL(e), u = M(p.origin, "favicon.ico"), m = new Image();
132
+ m.src = u, m.onload = () => {
133
+ i(u), r(!1);
134
+ }, m.onerror = () => {
135
+ r(!0), i("");
135
136
  };
136
- } else {
137
- setIconError(true);
138
- setFavicon("");
139
- }
140
- } catch (error) {
141
- setIconError(true);
137
+ } else
138
+ r(!0), i("");
139
+ } catch {
140
+ r(!0);
142
141
  }
143
- }, [link]);
144
- if (!link) {
145
- return null;
146
- }
147
- if (iconError || !favicon) {
148
- return /* @__PURE__ */ jsx(LinkIcon, { width: 20, height: 20, style: { filter: isDark ? "brightness(0) saturate(100%) invert(1)" : "none" } });
149
- }
150
- return /* @__PURE__ */ jsx("img", { src: favicon, alt: "Favicon", width: 20, height: 20 });
142
+ }, [e]), e ? l || !n ? /* @__PURE__ */ t(T, { width: 20, height: 20, style: { filter: f ? "brightness(0) saturate(100%) invert(1)" : "none" } }) : /* @__PURE__ */ t("img", { src: n, alt: "Favicon", width: 20, height: 20 }) : null;
151
143
  }
152
- export function LinkPreviewInput({
153
- editable = false,
154
- links = [],
155
- onChange
144
+ function ie({
145
+ editable: e = !1,
146
+ links: n = [],
147
+ onChange: i
156
148
  }) {
157
- if (editable) {
158
- return /* @__PURE__ */ jsx(DynamicLinkForm, { links, onChange });
159
- }
160
- return /* @__PURE__ */ jsx(Box, { width: "100%", display: "flex", flexDirection: "column", gap: 2, children: links.map((link) => /* @__PURE__ */ jsxs(
161
- Box,
149
+ return e ? /* @__PURE__ */ t(q, { links: n, onChange: i }) : /* @__PURE__ */ t(
150
+ c,
162
151
  {
163
- display: "flex",
164
- alignItems: "center",
165
- gap: 1,
166
152
  sx: {
167
- overflow: "hidden",
168
- width: "100%"
153
+ width: "100%",
154
+ display: "flex",
155
+ flexDirection: "column",
156
+ gap: 2
169
157
  },
170
- children: [
171
- /* @__PURE__ */ jsx(FaviconPreview, { link }),
172
- /* @__PURE__ */ jsx(LinkDiv, { children: /* @__PURE__ */ jsx(Box, { component: "a", href: link, style: { textDecoration: "none" }, target: "_blank", rel: "noopener noreferrer", children: formatLinkDisplay(link) }) })
173
- ]
174
- },
175
- link
176
- )) });
158
+ children: n.map((l) => /* @__PURE__ */ g(
159
+ c,
160
+ {
161
+ sx: {
162
+ display: "flex",
163
+ alignItems: "center",
164
+ gap: 1,
165
+ overflow: "hidden",
166
+ width: "100%"
167
+ },
168
+ children: [
169
+ /* @__PURE__ */ t(G, { link: l }),
170
+ /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(c, { component: "a", href: l, style: { textDecoration: "none" }, target: "_blank", rel: "noopener noreferrer", children: V(l) }) })
171
+ ]
172
+ },
173
+ l
174
+ ))
175
+ }
176
+ );
177
177
  }
178
- const LinkDiv = styled("span")`
178
+ const H = b("span")`
179
179
  flex: 1;
180
180
  white-space: nowrap;
181
181
  overflow: hidden;
182
182
  text-overflow: ellipsis;
183
183
  &,
184
184
  & > * {
185
- color: ${({ theme }) => theme.palette.text.primary};
185
+ color: ${({ theme: e }) => e.palette.text.primary};
186
186
  }
187
187
 
188
188
  & > * {
@@ -193,3 +193,6 @@ const LinkDiv = styled("span")`
193
193
  margin-left: 8px;
194
194
  }
195
195
  `;
196
+ export {
197
+ ie as LinkPreviewInput
198
+ };