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