@arcblock/ux 2.8.26 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. package/es/Address/did-address.js +33 -21
  2. package/es/AnimationWaiter/index.js +2 -1
  3. package/es/Avatar/index.js +1 -1
  4. package/es/BlockletContext/index.js +1 -1
  5. package/es/CardSelector/index.js +2 -1
  6. package/es/Colors/index.js +2 -1
  7. package/es/Colors/themes/temp.js +17 -0
  8. package/es/Datatable/TableSearch.js +2 -1
  9. package/es/Img/index.js +7 -6
  10. package/es/Locale/selector.js +15 -13
  11. package/es/NFTDisplay/index.js +2 -1
  12. package/es/QRCode/index.js +2 -1
  13. package/es/SessionBlocklet/index.js +169 -0
  14. package/es/SessionManager/index.js +2 -381
  15. package/es/SessionPermission/index.js +28 -0
  16. package/es/SessionUser/components/logged-in.js +224 -0
  17. package/es/SessionUser/components/session-user-item.js +148 -0
  18. package/es/SessionUser/components/session-user-switch.js +213 -0
  19. package/es/SessionUser/components/un-login.js +64 -0
  20. package/es/SessionUser/components/user-info.js +163 -0
  21. package/es/SessionUser/index.js +49 -0
  22. package/es/SessionUser/libs/translation.js +19 -0
  23. package/es/SessionUser/libs/utils.js +4 -0
  24. package/es/SplitButton/index.js +2 -1
  25. package/es/Toast/index.js +1 -1
  26. package/es/Util/constant.js +10 -0
  27. package/es/Util/index.js +11 -0
  28. package/lib/Address/did-address.js +36 -22
  29. package/lib/AnimationWaiter/index.js +2 -1
  30. package/lib/Avatar/index.js +1 -1
  31. package/lib/BlockletContext/index.js +1 -1
  32. package/lib/CardSelector/index.js +2 -1
  33. package/lib/Colors/index.js +7 -0
  34. package/lib/Colors/themes/temp.js +24 -0
  35. package/lib/Datatable/TableSearch.js +2 -1
  36. package/lib/Img/index.js +7 -6
  37. package/lib/Locale/selector.js +14 -13
  38. package/lib/NFTDisplay/index.js +2 -1
  39. package/lib/QRCode/index.js +2 -1
  40. package/lib/SessionBlocklet/index.js +187 -0
  41. package/lib/SessionManager/index.js +2 -390
  42. package/lib/SessionPermission/index.js +38 -0
  43. package/lib/SessionUser/components/logged-in.js +243 -0
  44. package/lib/SessionUser/components/session-user-item.js +163 -0
  45. package/lib/SessionUser/components/session-user-switch.js +232 -0
  46. package/lib/SessionUser/components/un-login.js +72 -0
  47. package/lib/SessionUser/components/user-info.js +175 -0
  48. package/lib/SessionUser/index.js +57 -0
  49. package/lib/SessionUser/libs/translation.js +26 -0
  50. package/lib/{SessionManager → SessionUser}/libs/utils.js +8 -1
  51. package/lib/SplitButton/index.js +2 -1
  52. package/lib/Toast/index.js +5 -5
  53. package/lib/Util/constant.js +26 -0
  54. package/lib/Util/index.js +16 -3
  55. package/package.json +19 -7
  56. package/src/Address/did-address.jsx +34 -20
  57. package/src/AnimationWaiter/index.js +2 -1
  58. package/src/Avatar/index.jsx +1 -1
  59. package/src/BlockletContext/index.jsx +1 -1
  60. package/src/CardSelector/index.jsx +2 -1
  61. package/src/Colors/index.js +1 -0
  62. package/src/Colors/themes/temp.js +18 -0
  63. package/src/Datatable/TableSearch.js +3 -1
  64. package/src/Img/{index.js → index.jsx} +8 -6
  65. package/src/Locale/selector.jsx +11 -8
  66. package/src/NFTDisplay/index.js +2 -1
  67. package/src/QRCode/index.js +2 -1
  68. package/src/SessionBlocklet/index.jsx +181 -0
  69. package/src/SessionManager/index.jsx +2 -369
  70. package/src/SessionPermission/index.jsx +28 -0
  71. package/src/SessionUser/components/logged-in.jsx +194 -0
  72. package/src/SessionUser/components/session-user-item.jsx +96 -0
  73. package/src/SessionUser/components/session-user-switch.jsx +222 -0
  74. package/src/SessionUser/components/un-login.jsx +55 -0
  75. package/src/SessionUser/components/user-info.jsx +165 -0
  76. package/src/SessionUser/index.jsx +38 -0
  77. package/src/SessionUser/libs/translation.js +19 -0
  78. package/src/{SessionManager → SessionUser}/libs/utils.js +4 -0
  79. package/src/SplitButton/index.js +2 -1
  80. package/src/Toast/index.js +1 -1
  81. package/src/Util/constant.js +12 -0
  82. package/src/Util/index.js +13 -0
  83. package/es/SessionManager/components/account-item.js +0 -212
  84. package/es/SessionManager/components/add-account-item.js +0 -57
  85. package/es/SessionManager/components/federated-login-detecter.js +0 -183
  86. package/es/SessionManager/components/manage-accounts.js +0 -219
  87. package/es/SessionManager/components/manage-blocklet.js +0 -70
  88. package/es/SessionManager/components/menu-accordion.js +0 -103
  89. package/es/SessionManager/components/responsive-popper.js +0 -24
  90. package/es/SessionManager/components/user-drawer.js +0 -68
  91. package/es/SessionManager/components/user-info.js +0 -143
  92. package/es/SessionManager/components/user-popper.js +0 -110
  93. package/es/SessionManager/hooks/use-config.js +0 -34
  94. package/es/SessionManager/libs/translation.js +0 -52
  95. package/es/SessionManager/libs/utils.js +0 -2
  96. package/lib/SessionManager/components/account-item.js +0 -219
  97. package/lib/SessionManager/components/add-account-item.js +0 -66
  98. package/lib/SessionManager/components/federated-login-detecter.js +0 -193
  99. package/lib/SessionManager/components/manage-accounts.js +0 -232
  100. package/lib/SessionManager/components/manage-blocklet.js +0 -86
  101. package/lib/SessionManager/components/menu-accordion.js +0 -111
  102. package/lib/SessionManager/components/responsive-popper.js +0 -34
  103. package/lib/SessionManager/components/user-drawer.js +0 -75
  104. package/lib/SessionManager/components/user-info.js +0 -160
  105. package/lib/SessionManager/components/user-popper.js +0 -104
  106. package/lib/SessionManager/hooks/use-config.js +0 -41
  107. package/lib/SessionManager/libs/translation.js +0 -59
  108. package/src/SessionManager/components/account-item.jsx +0 -156
  109. package/src/SessionManager/components/add-account-item.jsx +0 -49
  110. package/src/SessionManager/components/federated-login-detecter.jsx +0 -167
  111. package/src/SessionManager/components/manage-accounts.jsx +0 -228
  112. package/src/SessionManager/components/manage-blocklet.jsx +0 -70
  113. package/src/SessionManager/components/menu-accordion.jsx +0 -93
  114. package/src/SessionManager/components/responsive-popper.jsx +0 -26
  115. package/src/SessionManager/components/user-drawer.jsx +0 -57
  116. package/src/SessionManager/components/user-info.jsx +0 -117
  117. package/src/SessionManager/components/user-popper.jsx +0 -95
  118. package/src/SessionManager/hooks/use-config.js +0 -33
  119. package/src/SessionManager/libs/translation.js +0 -52
@@ -1,11 +1,11 @@
1
1
  import React, { useRef, useState, forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import '@fontsource/ubuntu-mono/400.css';
4
- import Tooltip from '@mui/material/Tooltip';
5
4
  import { green } from '@mui/material/colors';
5
+ import { Tooltip, Box } from '@mui/material';
6
6
  import copy from 'copy-to-clipboard';
7
- import CopyIcon from '@mui/icons-material/ContentCopy';
8
- import CheckIcon from '@mui/icons-material/Check';
7
+ import { ContentCopy as CopyIcon, Check as CheckIcon } from '@mui/icons-material';
8
+ import noop from 'lodash/noop';
9
9
  import { styled } from '../Theme';
10
10
  import { getFontSize } from '../Util';
11
11
  import CompactText from './compact-text';
@@ -96,21 +96,35 @@ const DidAddress = /*#__PURE__*/forwardRef(({
96
96
  size: size,
97
97
  ...rest,
98
98
  ref: ref,
99
- children: [prepend, /*#__PURE__*/_jsx("span", {
100
- ref: textRef,
101
- className: "did-address-text did-address-truncate",
102
- style: {
103
- display: compact ? 'none' : 'inline'
104
- },
105
- children: children
106
- }), compact && /*#__PURE__*/_jsx("span", {
107
- className: "did-address-text",
108
- children: /*#__PURE__*/_jsx(CompactText, {
109
- startChars: startChars,
110
- endChars: endChars,
111
- showCopyButtonInTooltip: showCopyButtonInTooltip,
99
+ children: [prepend, /*#__PURE__*/_jsxs(Tooltip, {
100
+ title: copyable ? '' : translations[locale].copied,
101
+ placement: "bottom",
102
+ arrow: true,
103
+ open: copied,
104
+ children: [/*#__PURE__*/_jsx(Box, {
105
+ ref: textRef,
106
+ component: "span",
107
+ className: "did-address-text did-address-truncate",
108
+ sx: {
109
+ display: compact ? 'none' : 'inline',
110
+ cursor: copyable ? 'text' : 'pointer'
111
+ },
112
+ onDoubleClick: copyable ? noop : onCopy,
112
113
  children: children
113
- })
114
+ }), compact && /*#__PURE__*/_jsx(Box, {
115
+ component: "span",
116
+ className: "did-address-text",
117
+ sx: {
118
+ cursor: copyable ? 'text' : 'pointer'
119
+ },
120
+ onDoubleClick: copyable ? noop : onCopy,
121
+ children: /*#__PURE__*/_jsx(CompactText, {
122
+ startChars: startChars,
123
+ endChars: endChars,
124
+ showCopyButtonInTooltip: showCopyButtonInTooltip,
125
+ children: children
126
+ })
127
+ })]
114
128
  }), copyElement, append]
115
129
  });
116
130
  });
@@ -147,7 +161,7 @@ DidAddress.defaultProps = {
147
161
  endChars: 6,
148
162
  locale: 'en'
149
163
  };
150
- const Root = styled('div', {
164
+ const Root = styled(Box, {
151
165
  shouldForwardProp: prop => prop !== 'inline'
152
166
  })`
153
167
  font-family: 'Ubuntu Mono', monospace;
@@ -177,9 +191,6 @@ const Root = styled('div', {
177
191
  text-overflow: ellipsis;
178
192
  }
179
193
 
180
- .did-address-copy {
181
- flex: 0 0 auto;
182
- }
183
194
  .did-address-copy-wrapper {
184
195
  display: flex;
185
196
  justify-content: center;
@@ -189,6 +200,7 @@ const Root = styled('div', {
189
200
  margin-left: 8px;
190
201
  }
191
202
  .did-address-copy {
203
+ flex: 0 0 auto;
192
204
  font-size: 1em;
193
205
  color: #999;
194
206
  cursor: pointer;
@@ -1,6 +1,7 @@
1
1
  import { useState, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Lottie from 'react-lottie-player';
4
+ import noop from 'lodash/noop';
4
5
  import lottieJson from './default-animation.json';
5
6
  import { styled } from '../Theme';
6
7
 
@@ -70,7 +71,7 @@ export default function AnimationWaiter({
70
71
  // tips
71
72
  useEffect(() => {
72
73
  if (!tips.length) {
73
- return () => {};
74
+ return noop;
74
75
  }
75
76
  const timer = setTimeout(() => {
76
77
  let nextId = tipsId + 1;
@@ -127,7 +127,7 @@ Avatar.defaultProps = {
127
127
  shape: '',
128
128
  responsive: false
129
129
  };
130
- const BlockyIconContainer = styled('div')`
130
+ const BlockyIconContainer = styled(Box)`
131
131
  display: flex;
132
132
  align-items: center;
133
133
  width: ${props => props.$size}px;
@@ -36,7 +36,7 @@ function BlockletProvider({
36
36
  setBlockletData(data);
37
37
  } catch {
38
38
  // NOTICE: 如果获取指定 blockletData 失败,则使用 window.blocklet
39
- const data = window.blocklet || window.env;
39
+ const data = globalThis.blocklet || globalThis.env;
40
40
  setBlockletData(data);
41
41
  }
42
42
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1,6 +1,7 @@
1
1
  import { useState, useEffect, useRef } from 'react';
2
2
  import styled from '@emotion/styled';
3
3
  import PropTypes from 'prop-types';
4
+ import noop from 'lodash/noop';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  export default function CardSelector({
6
7
  list,
@@ -143,6 +144,6 @@ CardSelector.defaultProps = {
143
144
  width: 300,
144
145
  height: 400,
145
146
  cardSpace: 40,
146
- onSelect: () => {},
147
+ onSelect: noop,
147
148
  defaultIndex: 0
148
149
  };
@@ -1,2 +1,3 @@
1
1
  // eslint-disable-next-line no-restricted-exports
2
- export { default } from './themes/default';
2
+ export { default } from './themes/default';
3
+ export { default as temp } from './themes/temp';
@@ -0,0 +1,17 @@
1
+ const colors = {
2
+ lineStep: 'rgba(18, 22, 24, 0.06)',
3
+ lineBorderStrong: 'rgba(18, 22, 24, 0.12)',
4
+ lineBorderBase: 'rgba(18, 22, 24, 0.06)',
5
+ borderBase: 'rgba(18, 22, 24, 0.06)',
6
+ textMuted: 'rgba(18, 22, 24, 0.36)',
7
+ textSubtitle: 'rgba(18, 22, 24, 0.6)',
8
+ textBase: 'rgba(18, 22, 24, 1)',
9
+ textPrimaryBase: 'rgba(18, 22, 24, 1)',
10
+ surfaceBgSubtitle: 'rgba(18, 22, 24, 0.03)',
11
+ surfacePrimarySubtitle: 'rgba(19, 125, 250, 0.06)',
12
+ surfaceSuccess: 'rgba(13, 202, 134, 1)',
13
+ primaryBase: 'rgba(19, 125, 250, 1)',
14
+ primary100: 'rgba(19, 125, 250, 1)',
15
+ gray6: 'rgba(17, 22, 24, 0.06)'
16
+ };
17
+ export default colors;
@@ -6,6 +6,7 @@ import SearchIcon from '@mui/icons-material/Search';
6
6
  import TextField from '@mui/material/TextField';
7
7
  import ClearIcon from '@mui/icons-material/Clear';
8
8
  import clsx from 'clsx';
9
+ import noop from 'lodash/noop';
9
10
  import { useDatatableContext } from './DatatableContext';
10
11
  import { styled } from '../Theme';
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -110,7 +111,7 @@ TableSearch.propTypes = {
110
111
  TableSearch.defaultProps = {
111
112
  search: '',
112
113
  searchText: '',
113
- onSearchOpen: () => {}
114
+ onSearchOpen: noop
114
115
  };
115
116
  const Container = styled('div')`
116
117
  display: flex;
package/es/Img/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { useEffect, useMemo, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useInView } from 'react-intersection-observer';
4
- import AlertIcon from '@iconify-icons/mdi/alert';
5
- import ImageIcon from '@iconify-icons/mdi/image';
4
+ import WarningRoundedIcon from '@iconify-icons/material-symbols/warning-rounded';
5
+ import ImageRoundedIcon from '@iconify-icons/material-symbols/image-rounded';
6
6
  import { Icon } from '@iconify/react';
7
+ import noop from 'lodash/noop';
7
8
  import { styled } from '../Theme';
8
9
 
9
10
  /**
@@ -162,14 +163,14 @@ function Img({
162
163
  className: "image--state",
163
164
  title: "loading image",
164
165
  children: /*#__PURE__*/_jsx(Icon, {
165
- icon: AlertIcon,
166
+ icon: WarningRoundedIcon,
166
167
  className: "image--icon"
167
168
  })
168
169
  }), !placeholder && imgState === 'loading' && /*#__PURE__*/_jsx("div", {
169
170
  className: "image--state",
170
171
  title: "Image load error",
171
172
  children: /*#__PURE__*/_jsx(Icon, {
172
- icon: ImageIcon,
173
+ icon: ImageRoundedIcon,
173
174
  className: "image--icon"
174
175
  })
175
176
  }), imgState === 'loaded' && /*#__PURE__*/_jsx("img", {
@@ -211,7 +212,7 @@ Img.defaultProps = {
211
212
  placeholder: null,
212
213
  fallback: null,
213
214
  className: '',
214
- onError: () => {},
215
- onSuccess: () => {}
215
+ onError: noop,
216
+ onSuccess: noop
216
217
  };
217
218
  export default Img;
@@ -2,9 +2,12 @@
2
2
  import { useState, useContext, useRef, useMemo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Button, Typography, IconButton, Popper, MenuItem, MenuList, Box, ClickAwayListener } from '@mui/material';
5
- import CheckIcon from '@mui/icons-material/Check';
6
- import GlobeIcon from '@arcblock/icons/lib/Globe';
5
+ import { Icon as IconifyIcon } from '@iconify/react';
6
+ import LanguageIcon from '@iconify-icons/material-symbols/language';
7
+ import CheckIcon from '@iconify-icons/material-symbols/check';
8
+ import noop from 'lodash/noop';
7
9
  import { getColor, getBackground } from '../Util';
10
+ import { temp as colors } from '../Colors';
8
11
  import { LocaleContext } from './context';
9
12
  import { styled, useTheme } from '../Theme';
10
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -57,12 +60,10 @@ export default function LocaleSelector(props) {
57
60
  if (Icon) {
58
61
  return /*#__PURE__*/_jsx(Icon, {});
59
62
  }
60
- return /*#__PURE__*/_jsx(GlobeIcon, {
61
- style: {
62
- width: 'auto',
63
- height: size,
64
- color: theme.palette.text.secondary
65
- }
63
+ return /*#__PURE__*/_jsx(IconifyIcon, {
64
+ icon: LanguageIcon,
65
+ fontSize: size,
66
+ color: theme.palette.text.secondary
66
67
  });
67
68
  }, [Icon, theme?.palette?.text?.secondary, size]);
68
69
  return /*#__PURE__*/_jsxs(Div, {
@@ -101,9 +102,9 @@ export default function LocaleSelector(props) {
101
102
  }) => /*#__PURE__*/_jsxs(MenuItem, {
102
103
  className: "locale-item",
103
104
  onClick: () => onSelect(code, name),
104
- children: [/*#__PURE__*/_jsx(CheckIcon, {
105
- className: code === locale ? 'check-icon check-icon-visible' : 'check-icon',
106
- fontSize: "small"
105
+ children: [/*#__PURE__*/_jsx(IconifyIcon, {
106
+ icon: CheckIcon,
107
+ className: code === locale ? 'check-icon check-icon-visible' : 'check-icon'
107
108
  }), name]
108
109
  }, code))
109
110
  })
@@ -124,7 +125,7 @@ LocaleSelector.defaultProps = {
124
125
  showText: true,
125
126
  size: 24,
126
127
  popperProps: {},
127
- onChange: () => {},
128
+ onChange: noop,
128
129
  popperType: 'click',
129
130
  icon: null
130
131
  };
@@ -149,7 +150,8 @@ const Div = styled('div', {
149
150
 
150
151
  .locales {
151
152
  background: ${props => getBackground(props)};
152
- box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
153
+ box-shadow: 0px 8px 16px 0px ${colors.gray6}, 0px 0px 0px 1px ${colors.gray6};
154
+ border-radius: 8px;
153
155
  }
154
156
 
155
157
  .locale-item {
@@ -8,6 +8,7 @@ import pako from 'pako';
8
8
  import base64 from 'base64-url';
9
9
  import isSvg from 'is-svg';
10
10
  import { ReactSVG } from 'react-svg';
11
+ import noop from 'lodash/noop';
11
12
  import AspectRatioContainer from './aspect-ratio-container';
12
13
  import ImgSvgEmbedder from './svg-embedder/img';
13
14
  import InlineSvgEmbedder from './svg-embedder/inline-svg';
@@ -266,7 +267,7 @@ NFTDisplay.defaultProps = {
266
267
  preferredSvgEmbedder: 'img',
267
268
  checkSvg: false,
268
269
  minimumLoadingTime: 0,
269
- onCompleted: () => {}
270
+ onCompleted: noop
270
271
  };
271
272
  const Root = styled('div')`
272
273
  display: flex;
@@ -1,6 +1,7 @@
1
1
  import { useRef, useEffect, useMemo, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import QRCodeStyling from '@solana/qr-code-styling';
4
+ import { Box } from '@mui/material';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const defaults = {
6
7
  margin: 0,
@@ -52,7 +53,7 @@ function QRCode({
52
53
  qrCode.update(options);
53
54
  // eslint-disable-next-line react-hooks/exhaustive-deps
54
55
  }, [data, size, image, config]);
55
- return /*#__PURE__*/_jsx("div", {
56
+ return /*#__PURE__*/_jsx(Box, {
56
57
  ref: ref,
57
58
  ...rest
58
59
  });
@@ -0,0 +1,169 @@
1
+ import { useRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Box, ClickAwayListener, Fade, IconButton, List, ListItem, ListItemButton, Paper, Popper, Typography } from '@mui/material';
4
+ import { Icon } from '@iconify/react';
5
+ import DashboardOutlineRoundedIcon from '@iconify-icons/material-symbols/dashboard-outline-rounded';
6
+ import WidgetsOutlineRoundedIcon from '@iconify-icons/material-symbols/widgets-outline-rounded';
7
+ import { useMemoizedFn, useReactive } from 'ahooks';
8
+ import Button from '../Button';
9
+ import { temp as colors } from '../Colors';
10
+ import { AUTH_SERVICE_PREFIX, NAVIGATION_URL } from '../Util/constant';
11
+ import SessionPermission from '../SessionPermission';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Fragment as _Fragment } from "react/jsx-runtime";
15
+ export default function SessionBlocklet({
16
+ session,
17
+ locale,
18
+ size
19
+ }) {
20
+ const blocklet = window?.blocklet || {};
21
+ const sessionMenuList = (blocklet.navigation || []
22
+ // HACK 过滤掉默认插入的 /sessionManager 菜单
23
+ ).filter(item => item.section === 'sessionManager' && !['/sessionManager'].includes(item.id)).filter(item => {
24
+ if ((item?.role || []).includes(session?.user?.role || 'guest')) {
25
+ return true;
26
+ }
27
+ return false;
28
+ }).map(item => {
29
+ const component = (blocklet?.componentMountPoints || []).find(x => item.component === x.name);
30
+ return {
31
+ ...item,
32
+ component
33
+ };
34
+ });
35
+ const popperAnchorRef = useRef(null);
36
+ const currentState = useReactive({
37
+ open: false
38
+ });
39
+ const onTogglePopper = useMemoizedFn((value = !currentState.open) => {
40
+ currentState.open = value;
41
+ });
42
+ if (sessionMenuList.length === 0) {
43
+ return null;
44
+ }
45
+ return /*#__PURE__*/_jsxs(_Fragment, {
46
+ children: [/*#__PURE__*/_jsx(IconButton, {
47
+ size: "medium",
48
+ ref: popperAnchorRef,
49
+ onClick: () => onTogglePopper(),
50
+ children: /*#__PURE__*/_jsx(Icon, {
51
+ icon: DashboardOutlineRoundedIcon,
52
+ fontSize: size
53
+ })
54
+ }), /*#__PURE__*/_jsx(Popper, {
55
+ open: currentState.open,
56
+ onClose: () => onTogglePopper(false),
57
+ anchorEl: popperAnchorRef.current,
58
+ transition: true,
59
+ placement: "bottom-end",
60
+ sx: {
61
+ zIndex: 1600
62
+ },
63
+ children: ({
64
+ TransitionProps
65
+ }) => /*#__PURE__*/_jsx(ClickAwayListener, {
66
+ onClickAway: e => {
67
+ e.preventDefault();
68
+ e.stopPropagation();
69
+ onTogglePopper(false);
70
+ },
71
+ children: /*#__PURE__*/_jsx(Fade, {
72
+ ...TransitionProps,
73
+ timeout: 350,
74
+ children: /*#__PURE__*/_jsxs(Paper, {
75
+ variant: "outlined",
76
+ sx: {
77
+ borderRadius: 3,
78
+ width: 350,
79
+ maxWidth: '90vw',
80
+ borderColor: colors.lineStep,
81
+ p: 2,
82
+ border: '0 !important',
83
+ boxShadow: `0px 8px 16px 0px ${colors.gray6}, 0px 0px 0px 1px ${colors.gray6}`
84
+ },
85
+ children: [/*#__PURE__*/_jsx(List, {
86
+ sx: {
87
+ display: 'grid',
88
+ gridTemplateColumns: 'repeat(auto-fill, 100px)',
89
+ gridAutoRows: 'minmax(100px, max-content)',
90
+ justifyContent: 'space-between',
91
+ maxHeight: 350,
92
+ overflowY: 'auto',
93
+ p: 0
94
+ },
95
+ children: sessionMenuList.map(item => /*#__PURE__*/_jsx(ListItem, {
96
+ disablePadding: true,
97
+ children: /*#__PURE__*/_jsxs(ListItemButton, {
98
+ href: item.link,
99
+ sx: {
100
+ p: 1,
101
+ display: 'flex',
102
+ flexDirection: 'column',
103
+ alignItems: 'center',
104
+ gap: 1,
105
+ width: '100%',
106
+ height: '100%',
107
+ borderRadius: 2,
108
+ '&:hover': {
109
+ backgroundColor: colors.surfacePrimarySubtitle
110
+ }
111
+ },
112
+ children: [item?.component?.did ? /*#__PURE__*/_jsx(Box, {
113
+ component: "img",
114
+ src: `${AUTH_SERVICE_PREFIX}/blocklet/logo-bundle/${item.component.did}`,
115
+ sx: {
116
+ borderRadius: 2,
117
+ width: 50,
118
+ height: 50,
119
+ objectFit: 'contain'
120
+ }
121
+ }) : /*#__PURE__*/_jsx(Icon, {
122
+ fontSize: 50,
123
+ icon: item.icon || WidgetsOutlineRoundedIcon,
124
+ color: colors.textSubtitle
125
+ }), /*#__PURE__*/_jsx(Typography, {
126
+ sx: {
127
+ fontSize: '12px',
128
+ color: colors.textBase,
129
+ textAlign: 'center',
130
+ lineHeight: 'normal'
131
+ },
132
+ children: item.title?.zh || item.title
133
+ })]
134
+ })
135
+ }, item.id))
136
+ }), /*#__PURE__*/_jsx(SessionPermission, {
137
+ session: session,
138
+ children: /*#__PURE__*/_jsx(Button, {
139
+ variant: "outlined",
140
+ fullWidth: true,
141
+ href: NAVIGATION_URL,
142
+ sx: {
143
+ mt: 1,
144
+ borderRadius: 2,
145
+ color: colors.textBase,
146
+ borderColor: colors.lineBorderStrong,
147
+ '&:hover': {
148
+ color: colors.primaryBase,
149
+ borderColor: colors.primaryBase
150
+ }
151
+ },
152
+ children: locale === 'zh' ? '管理' : 'Manage'
153
+ })
154
+ })]
155
+ })
156
+ })
157
+ })
158
+ })]
159
+ });
160
+ }
161
+ SessionBlocklet.propTypes = {
162
+ session: PropTypes.object.isRequired,
163
+ locale: PropTypes.string,
164
+ size: PropTypes.number
165
+ };
166
+ SessionBlocklet.defaultProps = {
167
+ locale: 'en',
168
+ size: 24
169
+ };