@blocklet/ui-react 2.1.36 → 2.1.39

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.
@@ -78,4 +78,4 @@ Brand.defaultProps = {
78
78
  const Root = _styledComponents.default.div.withConfig({
79
79
  displayName: "brand__Root",
80
80
  componentId: "sc-6z2c3k-0"
81
- })(["display:flex;flex-direction:column;width:240px;font-size:14px;a{text-decoration:none;color:inherit;}> div:first-child{display:flex;align-items:center;}.footer-brand-logo{display:flex;align-items:center;margin-right:16px;line-height:1;img,svg{max-height:44px;min-height:32px;}}.footer-brand-name{font-size:16px;font-weight:bold;}.footer-brand-desc{margin-top:16px;}", "{width:auto;}"], props => props.$theme.breakpoints.down('sm'));
81
+ })(["display:flex;flex-direction:column;width:240px;font-size:14px;a{text-decoration:none;color:inherit;}> div:first-child{display:flex;align-items:center;}.footer-brand-logo{display:flex;align-items:center;margin-right:16px;line-height:1;img,svg{width:auto;height:44px;max-height:44px;}}.footer-brand-name{font-size:16px;font-weight:bold;}.footer-brand-desc{margin-top:16px;}", "{width:auto;}", "{.footer-brand-logo{img,svg{height:32px;max-height:32px;}}}"], props => props.$theme.breakpoints.down('sm'), props => props.$theme.breakpoints.down('md'));
@@ -31,6 +31,10 @@ var _selector = _interopRequireDefault(require("@arcblock/ux/lib/Locale/selector
31
31
 
32
32
  var _context = require("@arcblock/ux/lib/Locale/context");
33
33
 
34
+ var _Address = _interopRequireDefault(require("@arcblock/did-connect/lib/Address"));
35
+
36
+ var _Avatar = _interopRequireDefault(require("@arcblock/did-connect/lib/Avatar"));
37
+
34
38
  require("@iconify/iconify");
35
39
 
36
40
  var _types = require("../types");
@@ -136,6 +140,7 @@ function Header(_ref) {
136
140
  }
137
141
 
138
142
  const {
143
+ did,
139
144
  appLogo,
140
145
  appName,
141
146
  theme,
@@ -189,9 +194,23 @@ function Header(_ref) {
189
194
  })
190
195
  }),
191
196
  brand: appName,
197
+ description: did ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Address.default, {
198
+ compact: true,
199
+ responsive: false,
200
+ copyable: false,
201
+ prepend: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
202
+ did: did,
203
+ size: 16,
204
+ style: {
205
+ marginRight: 4
206
+ }
207
+ }),
208
+ children: did
209
+ }) : null,
192
210
  addons: renderAddons()
193
211
  }, rest), {}, {
194
212
  $bgcolor: theme === null || theme === void 0 ? void 0 : theme.background,
213
+ $theme: muiTheme,
195
214
  children: !(navItems !== null && navItems !== void 0 && navItems.length) ? null : _ref2 => {
196
215
  let {
197
216
  isMobile
@@ -226,12 +245,12 @@ Header.defaultProps = {
226
245
  const StyledUxHeader = (0, _styledComponents.default)(_Header.ResponsiveHeader).withConfig({
227
246
  displayName: "Header__StyledUxHeader",
228
247
  componentId: "sc-kcf4st-0"
229
- })(["", " .header-logo{min-width:40px;}.header-nav{.navmenu-sub .navmenu-item{min-width:80px;}}"], _ref3 => {
248
+ })(["", " .header-logo{min-width:44px;}", "{.header-logo{min-width:32px;}}.header-nav{.navmenu-sub .navmenu-item{min-width:80px;}}"], _ref3 => {
230
249
  let {
231
250
  $bgcolor
232
251
  } = _ref3;
233
252
  return "background-color: ".concat($bgcolor || '#fff', ";");
234
- });
253
+ }, props => props.$theme.breakpoints.down('md'));
235
254
 
236
255
  var _default = (0, _reactErrorBoundary.withErrorBoundary)(Header, {
237
256
  FallbackComponent: _ErrorBoundary.ErrorFallback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.1.36",
3
+ "version": "2.1.39",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -34,8 +34,8 @@
34
34
  "url": "https://github.com/ArcBlock/ux/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@arcblock/did-connect": "^2.1.36",
38
- "@arcblock/ux": "^2.1.36",
37
+ "@arcblock/did-connect": "^2.1.39",
38
+ "@arcblock/ux": "^2.1.39",
39
39
  "@iconify/iconify": "^2.2.1",
40
40
  "@mui/material": "^5.6.4",
41
41
  "core-js": "^3.6.4",
@@ -57,5 +57,5 @@
57
57
  "eslint-plugin-react-hooks": "^4.2.0",
58
58
  "jest": "^24.1.0"
59
59
  },
60
- "gitHead": "fc0e64437926f532b89f8e027da4df083a705fec"
60
+ "gitHead": "ef7f78300191acb94bc9a2e590ac7a2c54193bde"
61
61
  }
@@ -54,8 +54,9 @@ const Root = styled.div`
54
54
  line-height: 1;
55
55
  img,
56
56
  svg {
57
+ width: auto;
58
+ height: 44px;
57
59
  max-height: 44px;
58
- min-height: 32px;
59
60
  }
60
61
  }
61
62
  .footer-brand-name {
@@ -69,4 +70,14 @@ const Root = styled.div`
69
70
  ${(props) => props.$theme.breakpoints.down('sm')} {
70
71
  width: auto;
71
72
  }
73
+
74
+ ${(props) => props.$theme.breakpoints.down('md')} {
75
+ .footer-brand-logo {
76
+ img,
77
+ svg {
78
+ height: 32px;
79
+ max-height: 32px;
80
+ }
81
+ }
82
+ }
72
83
  `;
@@ -11,6 +11,8 @@ import { SessionContext } from '@arcblock/did-connect/lib/Session';
11
11
  import SessionManager from '@arcblock/did-connect/lib/SessionManager';
12
12
  import LocaleSelector from '@arcblock/ux/lib/Locale/selector';
13
13
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
14
+ import DidAddress from '@arcblock/did-connect/lib/Address';
15
+ import DidAvatar from '@arcblock/did-connect/lib/Avatar';
14
16
  import '@iconify/iconify';
15
17
 
16
18
  import { blockletMetaProps, sessionManagerProps } from '../types';
@@ -70,7 +72,7 @@ function Header({ meta, addons, sessionManagerProps, ...rest }) {
70
72
  return null;
71
73
  }
72
74
 
73
- const { appLogo, appName, theme, navigation = [], enableConnect = true, enableLocale = true } = blocklet;
75
+ const { did, appLogo, appName, theme, navigation = [], enableConnect = true, enableLocale = true } = blocklet;
74
76
  const { navItems, activeId } = parseNavigation(navigation);
75
77
 
76
78
  const renderAddons = () => {
@@ -104,9 +106,21 @@ function Header({ meta, addons, sessionManagerProps, ...rest }) {
104
106
  </a>
105
107
  }
106
108
  brand={appName}
109
+ description={
110
+ did ? (
111
+ <DidAddress
112
+ compact
113
+ responsive={false}
114
+ copyable={false}
115
+ prepend={<DidAvatar did={did} size={16} style={{ marginRight: 4 }} />}>
116
+ {did}
117
+ </DidAddress>
118
+ ) : null
119
+ }
107
120
  addons={renderAddons()}
108
121
  {...rest}
109
- $bgcolor={theme?.background}>
122
+ $bgcolor={theme?.background}
123
+ $theme={muiTheme}>
110
124
  {/* blocklet.yml 没有配置 navigation 时, 则为 children 传入 null, 此时 ResponsiveHeader 会渲染普通的不带 menu 的 Header */}
111
125
  {!navItems?.length
112
126
  ? null
@@ -146,7 +160,12 @@ Header.defaultProps = {
146
160
  const StyledUxHeader = styled(ResponsiveHeader)`
147
161
  ${({ $bgcolor }) => `background-color: ${$bgcolor || '#fff'};`}
148
162
  .header-logo {
149
- min-width: 40px;
163
+ min-width: 44px;
164
+ }
165
+ ${(props) => props.$theme.breakpoints.down('md')} {
166
+ .header-logo {
167
+ min-width: 32px;
168
+ }
150
169
  }
151
170
  .header-nav {
152
171
  .navmenu-sub .navmenu-item {