@blocklet/ui-react 2.9.13 → 2.9.14
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/build.config.ts +29 -0
- package/es/@types/index.d.ts +63 -0
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +12 -0
- package/es/Dashboard/index.d.ts +41 -0
- package/es/Dashboard/index.js +63 -97
- package/es/Footer/brand.d.ts +22 -0
- package/es/Footer/brand.js +20 -37
- package/es/Footer/copyright.d.ts +18 -0
- package/es/Footer/copyright.js +14 -16
- package/es/Footer/index.d.ts +6 -0
- package/es/Footer/index.js +30 -56
- package/es/Footer/internal-footer.d.ts +29 -0
- package/es/Footer/internal-footer.js +67 -94
- package/es/Footer/layout/plain.d.ts +15 -0
- package/es/Footer/layout/plain.js +19 -37
- package/es/Footer/layout/row.d.ts +18 -0
- package/es/Footer/layout/row.js +9 -19
- package/es/Footer/layout/standard.d.ts +15 -0
- package/es/Footer/layout/standard.js +29 -57
- package/es/Footer/links.d.ts +22 -0
- package/es/Footer/links.js +72 -104
- package/es/Footer/social-media.d.ts +14 -0
- package/es/Footer/social-media.js +35 -35
- package/es/Header/index.d.ts +9 -0
- package/es/Header/index.js +55 -100
- package/es/Icon/index.d.ts +23 -0
- package/es/Icon/index.js +23 -58
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.d.ts +5 -0
- package/es/UserCenter/components/notification.js +276 -0
- package/es/UserCenter/components/passport.d.ts +6 -0
- package/es/UserCenter/components/passport.js +69 -0
- package/es/UserCenter/components/privacy.d.ts +11 -0
- package/es/UserCenter/components/privacy.js +99 -0
- package/es/UserCenter/components/settings.d.ts +10 -0
- package/es/UserCenter/components/settings.js +68 -0
- package/es/UserCenter/components/user-basic-info.d.ts +8 -0
- package/es/UserCenter/components/user-basic-info.js +66 -0
- package/es/UserCenter/components/user-center.d.ts +9 -0
- package/es/UserCenter/components/user-center.js +397 -0
- package/es/UserCenter/components/user-info-item.d.ts +10 -0
- package/es/UserCenter/components/user-info-item.js +54 -0
- package/es/UserCenter/components/user-info.d.ts +6 -0
- package/es/UserCenter/components/user-info.js +68 -0
- package/es/UserCenter/components/webhook-item.d.ts +3 -0
- package/es/UserCenter/components/webhook-item.js +243 -0
- package/es/UserCenter/index.d.ts +1 -0
- package/es/UserCenter/index.js +1 -0
- package/es/UserCenter/libs/client.d.ts +2 -0
- package/es/UserCenter/libs/client.js +2 -0
- package/es/UserCenter/libs/locales.d.ts +72 -0
- package/es/UserCenter/libs/locales.js +72 -0
- package/es/UserCenter/libs/utils.d.ts +4 -0
- package/es/UserCenter/libs/utils.js +14 -0
- package/es/blocklets.d.ts +16 -0
- package/es/blocklets.js +56 -45
- package/es/common/header-addons.d.ts +22 -0
- package/es/common/header-addons.js +41 -59
- package/es/common/link-blocker.d.ts +7 -0
- package/es/common/link-blocker.js +10 -17
- package/es/common/overridable-theme-provider.d.ts +18 -0
- package/es/common/overridable-theme-provider.js +6 -16
- package/es/common/wallet-hidden-topbar.d.ts +1 -0
- package/es/common/wallet-hidden-topbar.js +12 -10
- package/es/index.d.ts +5 -0
- package/es/index.js +5 -0
- package/es/types.d.ts +2 -0
- package/es/types.js +17 -11
- package/es/utils.d.ts +8 -0
- package/es/utils.js +21 -26
- package/lib/@types/index.d.ts +63 -0
- package/lib/@types/index.js +1 -0
- package/lib/@types/shims.d.ts +12 -0
- package/lib/Dashboard/index.d.ts +41 -0
- package/lib/Dashboard/index.js +44 -71
- package/lib/Footer/brand.d.ts +22 -0
- package/lib/Footer/brand.js +65 -30
- package/lib/Footer/copyright.d.ts +18 -0
- package/lib/Footer/copyright.js +18 -23
- package/lib/Footer/index.d.ts +6 -0
- package/lib/Footer/index.js +33 -42
- package/lib/Footer/internal-footer.d.ts +29 -0
- package/lib/Footer/internal-footer.js +43 -59
- package/lib/Footer/layout/plain.d.ts +15 -0
- package/lib/Footer/layout/plain.js +25 -30
- package/lib/Footer/layout/row.d.ts +18 -0
- package/lib/Footer/layout/row.js +34 -23
- package/lib/Footer/layout/standard.d.ts +15 -0
- package/lib/Footer/layout/standard.js +35 -41
- package/lib/Footer/links.d.ts +22 -0
- package/lib/Footer/links.js +163 -60
- package/lib/Footer/social-media.d.ts +14 -0
- package/lib/Footer/social-media.js +31 -25
- package/lib/Header/index.d.ts +9 -0
- package/lib/Header/index.js +83 -76
- package/lib/Icon/index.d.ts +23 -0
- package/lib/Icon/index.js +37 -51
- package/lib/UserCenter/assets/banner.png +0 -0
- package/lib/UserCenter/components/notification.d.ts +5 -0
- package/lib/UserCenter/components/notification.js +261 -0
- package/lib/UserCenter/components/passport.d.ts +6 -0
- package/lib/UserCenter/components/passport.js +86 -0
- package/lib/UserCenter/components/privacy.d.ts +11 -0
- package/lib/UserCenter/components/privacy.js +101 -0
- package/lib/UserCenter/components/settings.d.ts +10 -0
- package/lib/UserCenter/components/settings.js +81 -0
- package/lib/UserCenter/components/user-basic-info.d.ts +8 -0
- package/lib/UserCenter/components/user-basic-info.js +67 -0
- package/lib/UserCenter/components/user-center.d.ts +9 -0
- package/lib/UserCenter/components/user-center.js +376 -0
- package/lib/UserCenter/components/user-info-item.d.ts +10 -0
- package/lib/UserCenter/components/user-info-item.js +46 -0
- package/lib/UserCenter/components/user-info.d.ts +6 -0
- package/lib/UserCenter/components/user-info.js +94 -0
- package/lib/UserCenter/components/webhook-item.d.ts +3 -0
- package/lib/UserCenter/components/webhook-item.js +236 -0
- package/lib/UserCenter/index.d.ts +1 -0
- package/lib/UserCenter/index.js +13 -0
- package/lib/UserCenter/libs/client.d.ts +2 -0
- package/lib/UserCenter/libs/client.js +8 -0
- package/lib/UserCenter/libs/locales.d.ts +72 -0
- package/lib/UserCenter/libs/locales.js +78 -0
- package/lib/UserCenter/libs/utils.d.ts +4 -0
- package/lib/UserCenter/libs/utils.js +25 -0
- package/lib/blocklets.d.ts +16 -0
- package/lib/blocklets.js +28 -36
- package/lib/common/header-addons.d.ts +22 -0
- package/lib/common/header-addons.js +24 -36
- package/lib/common/link-blocker.d.ts +7 -0
- package/lib/common/link-blocker.js +10 -18
- package/lib/common/overridable-theme-provider.d.ts +18 -0
- package/lib/common/overridable-theme-provider.js +9 -14
- package/lib/common/wallet-hidden-topbar.d.ts +1 -0
- package/lib/common/wallet-hidden-topbar.js +1 -3
- package/lib/index.d.ts +5 -0
- package/lib/index.js +52 -0
- package/lib/types.d.ts +2 -0
- package/lib/types.js +3 -5
- package/lib/utils.d.ts +8 -0
- package/lib/utils.js +16 -23
- package/package.json +17 -11
- package/src/@types/index.ts +70 -0
- package/src/@types/shims.d.ts +12 -0
- package/src/UserCenter/assets/banner.png +0 -0
- package/src/UserCenter/components/notification.tsx +275 -0
- package/src/UserCenter/components/passport.tsx +83 -0
- package/src/UserCenter/components/privacy.tsx +107 -0
- package/src/UserCenter/components/settings.tsx +78 -0
- package/src/UserCenter/components/user-basic-info.tsx +70 -0
- package/src/UserCenter/components/user-center.tsx +410 -0
- package/src/UserCenter/components/user-info-item.tsx +50 -0
- package/src/UserCenter/components/user-info.tsx +85 -0
- package/src/UserCenter/components/webhook-item.tsx +243 -0
- package/src/UserCenter/index.tsx +1 -0
- package/src/UserCenter/libs/client.ts +3 -0
- package/src/UserCenter/libs/locales.ts +72 -0
- package/src/UserCenter/libs/utils.ts +21 -0
- package/src/blocklets.js +2 -0
- package/src/index.ts +9 -0
- /package/src/common/{link-blocker.js → link-blocker.jsx} +0 -0
package/lib/Footer/links.js
CHANGED
|
@@ -3,53 +3,32 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
module.exports = Links;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
8
|
var _react = require("react");
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
var _Theme = require("@arcblock/ux/lib/Theme");
|
|
10
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
12
|
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
12
13
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _templateObject;
|
|
15
|
-
const _excluded = ["links", "flowLayout"];
|
|
16
|
-
/* eslint-disable react/no-array-index-key */
|
|
17
|
-
/**
|
|
18
|
-
* footer 中的 links (支持分组, 最多支持 2 级)
|
|
19
|
-
* TODO: dark/light theme
|
|
20
|
-
*/
|
|
21
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
29
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
30
|
-
function Links(_ref) {
|
|
31
|
-
let {
|
|
32
|
-
links,
|
|
33
|
-
flowLayout
|
|
34
|
-
} = _ref,
|
|
35
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
function Links({
|
|
16
|
+
links,
|
|
17
|
+
flowLayout,
|
|
18
|
+
...rest
|
|
19
|
+
}) {
|
|
36
20
|
const [activeIndex, setActiveIndex] = (0, _react.useState)(-1);
|
|
37
|
-
if (!
|
|
21
|
+
if (!links?.length) {
|
|
38
22
|
return null;
|
|
39
23
|
}
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
link,
|
|
49
|
-
icon,
|
|
50
|
-
render,
|
|
51
|
-
props
|
|
52
|
-
} = _ref2;
|
|
24
|
+
const isGroupMode = links.some(item => item.items?.length);
|
|
25
|
+
const renderItem = ({
|
|
26
|
+
label,
|
|
27
|
+
link,
|
|
28
|
+
icon,
|
|
29
|
+
render,
|
|
30
|
+
props
|
|
31
|
+
}) => {
|
|
53
32
|
let result = label;
|
|
54
33
|
if (render) {
|
|
55
34
|
result = render({
|
|
@@ -58,16 +37,16 @@ function Links(_ref) {
|
|
|
58
37
|
props
|
|
59
38
|
});
|
|
60
39
|
} else if (link) {
|
|
61
|
-
result =
|
|
40
|
+
result = /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
|
|
62
41
|
href: link,
|
|
63
|
-
"aria-label":
|
|
64
|
-
|
|
42
|
+
"aria-label": `Footer link for ${label}`,
|
|
43
|
+
...props,
|
|
65
44
|
children: label
|
|
66
|
-
})
|
|
45
|
+
});
|
|
67
46
|
}
|
|
68
|
-
return
|
|
69
|
-
children: [icon &&
|
|
70
|
-
icon
|
|
47
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
48
|
+
children: [icon && /* @__PURE__ */(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
49
|
+
icon,
|
|
71
50
|
size: 20,
|
|
72
51
|
sx: {
|
|
73
52
|
mr: 0.5
|
|
@@ -75,14 +54,15 @@ function Links(_ref) {
|
|
|
75
54
|
}), result]
|
|
76
55
|
});
|
|
77
56
|
};
|
|
78
|
-
return
|
|
57
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Root, {
|
|
58
|
+
...rest,
|
|
79
59
|
className: (0, _clsx.default)(rest.className, {
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
"footer-links--grouped": isGroupMode,
|
|
61
|
+
"footer-links--flow": flowLayout
|
|
82
62
|
}),
|
|
83
|
-
children:
|
|
63
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)("div", {
|
|
84
64
|
className: "footer-links-inner",
|
|
85
|
-
children: [flowLayout && links.map((item, i) =>
|
|
65
|
+
children: [flowLayout && links.map((item, i) => /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
|
|
86
66
|
className: "footer-links-item",
|
|
87
67
|
children: renderItem(item)
|
|
88
68
|
}, i)), !flowLayout && links.map((item, i) => {
|
|
@@ -90,24 +70,24 @@ function Links(_ref) {
|
|
|
90
70
|
items
|
|
91
71
|
} = item;
|
|
92
72
|
const isActive = i === activeIndex;
|
|
93
|
-
return
|
|
94
|
-
className: (0, _clsx.default)(
|
|
95
|
-
|
|
73
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsxs)("div", {
|
|
74
|
+
className: (0, _clsx.default)("footer-links-group", {
|
|
75
|
+
"footer-links-group--active": isActive
|
|
96
76
|
}),
|
|
97
77
|
onClick: () => setActiveIndex(activeIndex === i ? -1 : i),
|
|
98
|
-
children: [
|
|
78
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)("span", {
|
|
99
79
|
className: "footer-links-item",
|
|
100
|
-
children: [renderItem(item), !!
|
|
80
|
+
children: [renderItem(item), !!items?.length && /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
|
|
101
81
|
className: "footer-links-group-expand-icon",
|
|
102
|
-
children:
|
|
82
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
103
83
|
style: {
|
|
104
|
-
transform:
|
|
84
|
+
transform: `rotate(${isActive ? 180 : 0}deg)`
|
|
105
85
|
}
|
|
106
86
|
})
|
|
107
87
|
})]
|
|
108
|
-
}), !!
|
|
88
|
+
}), !!items?.length && /* @__PURE__ */(0, _jsxRuntime.jsx)("div", {
|
|
109
89
|
className: "footer-links-sub",
|
|
110
|
-
children: items.map((child, j) =>
|
|
90
|
+
children: items.map((child, j) => /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
|
|
111
91
|
className: "footer-links-item",
|
|
112
92
|
children: renderItem(child)
|
|
113
93
|
}, j))
|
|
@@ -115,7 +95,7 @@ function Links(_ref) {
|
|
|
115
95
|
}, i);
|
|
116
96
|
})]
|
|
117
97
|
})
|
|
118
|
-
})
|
|
98
|
+
});
|
|
119
99
|
}
|
|
120
100
|
Links.propTypes = {
|
|
121
101
|
links: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -131,4 +111,127 @@ Links.defaultProps = {
|
|
|
131
111
|
links: [],
|
|
132
112
|
flowLayout: false
|
|
133
113
|
};
|
|
134
|
-
const Root = (0, _Theme.styled)(
|
|
114
|
+
const Root = (0, _Theme.styled)("div")`
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
color: ${props => props.theme.palette.grey[600]};
|
|
117
|
+
.footer-links-inner {
|
|
118
|
+
display: flex;
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
margin: 0 -8px;
|
|
121
|
+
}
|
|
122
|
+
.footer-links-group,
|
|
123
|
+
.footer-links-sub {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
}
|
|
127
|
+
.footer-links-sub .footer-links-item {
|
|
128
|
+
color: ${props => props.theme.palette.grey[900]};
|
|
129
|
+
}
|
|
130
|
+
.footer-links-group-expand-icon {
|
|
131
|
+
display: none;
|
|
132
|
+
position: absolute;
|
|
133
|
+
right: 16px;
|
|
134
|
+
top: 50%;
|
|
135
|
+
transform: translate(0, -50%);
|
|
136
|
+
line-height: 1;
|
|
137
|
+
svg {
|
|
138
|
+
width: auto;
|
|
139
|
+
height: 0.75em;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
.footer-links-item {
|
|
143
|
+
display: inline-flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
position: relative;
|
|
146
|
+
padding: 4px 8px;
|
|
147
|
+
font-size: 14px;
|
|
148
|
+
}
|
|
149
|
+
&.footer-links--grouped {
|
|
150
|
+
.footer-links-group {
|
|
151
|
+
> .footer-links-item {
|
|
152
|
+
font-weight: bold;
|
|
153
|
+
}
|
|
154
|
+
.footer-links-sub {
|
|
155
|
+
margin-top: 8px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
a {
|
|
160
|
+
display: inline-block;
|
|
161
|
+
max-width: 150px;
|
|
162
|
+
color: inherit;
|
|
163
|
+
text-decoration: none;
|
|
164
|
+
&:hover {
|
|
165
|
+
text-decoration: underline;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&.footer-links--flow {
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
.footer-links-inner {
|
|
172
|
+
justify-content: center;
|
|
173
|
+
flex-wrap: wrap;
|
|
174
|
+
margin: 0 -8px;
|
|
175
|
+
.footer-links-item {
|
|
176
|
+
padding: 0 8px;
|
|
177
|
+
}
|
|
178
|
+
.footer-links-item + .footer-links-item::before {
|
|
179
|
+
content: '';
|
|
180
|
+
position: absolute;
|
|
181
|
+
left: 0;
|
|
182
|
+
top: 50%;
|
|
183
|
+
transform: translate(0, -50%);
|
|
184
|
+
height: 1em;
|
|
185
|
+
border-left: 1px solid ${props => props.theme.palette.grey[400]};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
${props => props.theme.breakpoints.down("md")} {
|
|
191
|
+
.footer-links-inner {
|
|
192
|
+
flex-direction: column;
|
|
193
|
+
margin: 0;
|
|
194
|
+
}
|
|
195
|
+
.footer-links-sub {
|
|
196
|
+
display: none;
|
|
197
|
+
}
|
|
198
|
+
.footer-links-group {
|
|
199
|
+
position: relative;
|
|
200
|
+
padding: 12px 0;
|
|
201
|
+
.footer-links-item .footer-links-group-expand-icon {
|
|
202
|
+
display: inline-block;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
.footer-links-group + .footer-links-group {
|
|
206
|
+
border-top: 1px solid ${props => props.theme.palette.grey[200]};
|
|
207
|
+
}
|
|
208
|
+
.footer-links-group--active {
|
|
209
|
+
.footer-links-sub {
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: row;
|
|
212
|
+
flex-wrap: wrap;
|
|
213
|
+
.footer-links-item {
|
|
214
|
+
flex: 0 0 50%;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
.footer-links-item {
|
|
219
|
+
padding-left: 0;
|
|
220
|
+
padding-right: 0;
|
|
221
|
+
font-size: 13px;
|
|
222
|
+
}
|
|
223
|
+
&.footer-links--grouped {
|
|
224
|
+
.footer-links-group {
|
|
225
|
+
> .footer-links-item {
|
|
226
|
+
font-size: 14px;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&.footer-links--flow {
|
|
232
|
+
.footer-links-inner {
|
|
233
|
+
flex-direction: row;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare function SocialMedia({ items, ...rest }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
items: any;
|
|
4
|
+
}): import("react").JSX.Element | null;
|
|
5
|
+
declare namespace SocialMedia {
|
|
6
|
+
namespace propTypes {
|
|
7
|
+
let items: any;
|
|
8
|
+
}
|
|
9
|
+
namespace defaultProps {
|
|
10
|
+
let items_1: null;
|
|
11
|
+
export { items_1 as items };
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export default SocialMedia;
|
|
@@ -3,50 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
module.exports = SocialMedia;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
9
|
var _Theme = require("@arcblock/ux/lib/Theme");
|
|
9
10
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
var _templateObject;
|
|
12
|
-
const _excluded = ["items"];
|
|
13
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
19
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
|
-
function SocialMedia(_ref) {
|
|
23
|
-
let {
|
|
24
|
-
items
|
|
25
|
-
} = _ref,
|
|
26
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
12
|
+
function SocialMedia({
|
|
13
|
+
items,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
27
16
|
const theme = (0, _Theme.useTheme)();
|
|
28
|
-
if (!
|
|
17
|
+
if (!items?.length) {
|
|
29
18
|
return null;
|
|
30
19
|
}
|
|
31
|
-
return
|
|
20
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Root, {
|
|
21
|
+
...rest,
|
|
32
22
|
children: items.map((item, i) => {
|
|
33
|
-
return
|
|
23
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
|
|
34
24
|
href: item.link,
|
|
35
25
|
target: "_blank",
|
|
36
|
-
"aria-label":
|
|
26
|
+
"aria-label": `Social media icon${item.title ? ` for ${item.title}` : ""}`,
|
|
37
27
|
rel: "noreferrer",
|
|
38
|
-
children:
|
|
28
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
39
29
|
icon: item.icon || item.title,
|
|
40
30
|
sx: {
|
|
41
31
|
bgcolor: theme.palette.grey[600],
|
|
42
|
-
color:
|
|
32
|
+
color: "#fff"
|
|
43
33
|
},
|
|
44
34
|
size: 24,
|
|
45
35
|
component: "span"
|
|
46
36
|
})
|
|
47
37
|
}, i);
|
|
48
38
|
})
|
|
49
|
-
})
|
|
39
|
+
});
|
|
50
40
|
}
|
|
51
41
|
SocialMedia.propTypes = {
|
|
52
42
|
items: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -58,4 +48,20 @@ SocialMedia.propTypes = {
|
|
|
58
48
|
SocialMedia.defaultProps = {
|
|
59
49
|
items: null
|
|
60
50
|
};
|
|
61
|
-
const Root = (0, _Theme.styled)(
|
|
51
|
+
const Root = (0, _Theme.styled)("div")`
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
gap: 20px;
|
|
57
|
+
a {
|
|
58
|
+
color: ${props => props.theme.palette.grey[400]};
|
|
59
|
+
text-decoration: none;
|
|
60
|
+
&:hover {
|
|
61
|
+
color: ${props => props.theme.palette.primary.light};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
${props => props.theme.breakpoints.down("md")} {
|
|
65
|
+
gap: 12px;
|
|
66
|
+
}
|
|
67
|
+
`;
|
package/lib/Header/index.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
8
|
var _react = require("react");
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
10
|
var _reactErrorBoundary = require("react-error-boundary");
|
|
@@ -19,20 +20,9 @@ var _utils = require("../utils");
|
|
|
19
20
|
var _blocklets = require("../blocklets");
|
|
20
21
|
var _headerAddons = _interopRequireDefault(require("../common/header-addons"));
|
|
21
22
|
var _walletHiddenTopbar = require("../common/wallet-hidden-topbar");
|
|
22
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
var _templateObject;
|
|
24
|
-
const _excluded = ["meta", "addons", "sessionManagerProps", "homeLink", "theme"];
|
|
25
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
27
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
28
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
33
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // blocklet meta 中的 navigation 数据 => NavMenu 组件的 items
|
|
34
24
|
const parseNavigation = navigation => {
|
|
35
|
-
if (!
|
|
25
|
+
if (!navigation?.length) {
|
|
36
26
|
return {
|
|
37
27
|
navItems: [],
|
|
38
28
|
activeId: null
|
|
@@ -40,37 +30,36 @@ const parseNavigation = navigation => {
|
|
|
40
30
|
}
|
|
41
31
|
let counter = 1;
|
|
42
32
|
const parseItem = item => {
|
|
43
|
-
|
|
44
|
-
const icon = item.icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
33
|
+
const icon = item.icon ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
45
34
|
icon: item.icon
|
|
46
35
|
}) : null;
|
|
47
36
|
if (item.items) {
|
|
48
37
|
return {
|
|
49
|
-
id:
|
|
38
|
+
id: `${counter++}`,
|
|
50
39
|
label: item.title,
|
|
51
40
|
icon,
|
|
52
41
|
children: item.items
|
|
53
42
|
};
|
|
54
43
|
}
|
|
55
44
|
let props = {};
|
|
56
|
-
if (
|
|
45
|
+
if (item.link?.startsWith("http://") || item.link?.startsWith("https://")) {
|
|
57
46
|
props = {
|
|
58
|
-
target:
|
|
59
|
-
rel:
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noreferrer"
|
|
60
49
|
};
|
|
61
50
|
}
|
|
62
51
|
return {
|
|
63
|
-
id:
|
|
64
|
-
label:
|
|
65
|
-
href: item.link
|
|
66
|
-
|
|
52
|
+
id: `${counter++}`,
|
|
53
|
+
label: /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
|
|
54
|
+
href: item.link,
|
|
55
|
+
...props,
|
|
67
56
|
children: item.title
|
|
68
|
-
})
|
|
57
|
+
}),
|
|
69
58
|
icon,
|
|
70
59
|
link: item.link
|
|
71
60
|
};
|
|
72
61
|
};
|
|
73
|
-
const navItems = (0, _utils.mapRecursive)(navigation, parseItem,
|
|
62
|
+
const navItems = (0, _utils.mapRecursive)(navigation, parseItem, "items");
|
|
74
63
|
const flattened = (0, _utils.flatRecursive)(navItems);
|
|
75
64
|
const matchedIndex = (0, _utils.matchPaths)(flattened.map(item => item.link));
|
|
76
65
|
return {
|
|
@@ -78,21 +67,14 @@ const parseNavigation = navigation => {
|
|
|
78
67
|
activeId: matchedIndex >= 0 ? flattened[matchedIndex].id : null
|
|
79
68
|
};
|
|
80
69
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
meta,
|
|
90
|
-
addons,
|
|
91
|
-
sessionManagerProps,
|
|
92
|
-
homeLink,
|
|
93
|
-
theme: themeOverrides
|
|
94
|
-
} = _ref,
|
|
95
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
70
|
+
function Header({
|
|
71
|
+
meta,
|
|
72
|
+
addons,
|
|
73
|
+
sessionManagerProps: sessionManagerProps2,
|
|
74
|
+
homeLink,
|
|
75
|
+
theme: themeOverrides,
|
|
76
|
+
...rest
|
|
77
|
+
}) {
|
|
96
78
|
(0, _walletHiddenTopbar.useWalletHiddenTopbar)();
|
|
97
79
|
const {
|
|
98
80
|
locale
|
|
@@ -102,7 +84,7 @@ function Header(_ref) {
|
|
|
102
84
|
try {
|
|
103
85
|
return (0, _blocklets.formatBlockletInfo)(blocklet);
|
|
104
86
|
} catch (e) {
|
|
105
|
-
console.error(
|
|
87
|
+
console.error("Failed to format blocklet info", e, blocklet);
|
|
106
88
|
return blocklet;
|
|
107
89
|
}
|
|
108
90
|
}, [meta]);
|
|
@@ -114,45 +96,42 @@ function Header(_ref) {
|
|
|
114
96
|
appLogoRect,
|
|
115
97
|
theme
|
|
116
98
|
} = formattedBlocklet;
|
|
117
|
-
const navigation = (0, _blocklets.getLocalizedNavigation)(formattedBlocklet
|
|
99
|
+
const navigation = (0, _blocklets.getLocalizedNavigation)(formattedBlocklet?.navigation?.header, locale);
|
|
118
100
|
const parsedNavigation = parseNavigation(navigation);
|
|
119
101
|
const {
|
|
120
102
|
navItems,
|
|
121
103
|
activeId
|
|
122
104
|
} = parsedNavigation;
|
|
123
|
-
const _addons = typeof addons ===
|
|
105
|
+
const _addons = typeof addons === "function" ? builtInAddons => addons(builtInAddons, {
|
|
124
106
|
navigation: parsedNavigation
|
|
125
107
|
}) : addons;
|
|
126
|
-
const headerAddons =
|
|
127
|
-
formattedBlocklet
|
|
108
|
+
const headerAddons = /* @__PURE__ */(0, _jsxRuntime.jsx)(_headerAddons.default, {
|
|
109
|
+
formattedBlocklet,
|
|
128
110
|
addons: _addons,
|
|
129
|
-
sessionManagerProps:
|
|
111
|
+
sessionManagerProps: sessionManagerProps2
|
|
130
112
|
});
|
|
131
|
-
return
|
|
113
|
+
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_overridableThemeProvider.default, {
|
|
132
114
|
theme: themeOverrides,
|
|
133
|
-
children:
|
|
134
|
-
homeLink
|
|
135
|
-
logo:
|
|
115
|
+
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(StyledUxHeader, {
|
|
116
|
+
homeLink,
|
|
117
|
+
logo: /* @__PURE__ */(0, _jsxRuntime.jsx)("img", {
|
|
136
118
|
src: appLogoRect || appLogo,
|
|
137
119
|
alt: "logo"
|
|
138
120
|
}),
|
|
139
|
-
addons: headerAddons
|
|
140
|
-
|
|
141
|
-
$bgcolor: theme
|
|
142
|
-
children: !
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}))
|
|
121
|
+
addons: headerAddons,
|
|
122
|
+
...rest,
|
|
123
|
+
$bgcolor: theme?.background?.header,
|
|
124
|
+
children: !navItems?.length ? null : ({
|
|
125
|
+
isMobile
|
|
126
|
+
}) => /* @__PURE__ */(0, _jsxRuntime.jsx)(_NavMenu.default, {
|
|
127
|
+
mode: isMobile ? "inline" : "horizontal",
|
|
128
|
+
activeId,
|
|
129
|
+
items: navItems,
|
|
130
|
+
className: "header-nav",
|
|
131
|
+
bgColor: "transparent",
|
|
132
|
+
textColor: "#777"
|
|
133
|
+
})
|
|
134
|
+
})
|
|
156
135
|
});
|
|
157
136
|
}
|
|
158
137
|
Header.propTypes = {
|
|
@@ -175,13 +154,41 @@ Header.defaultProps = {
|
|
|
175
154
|
homeLink: _blocklets.publicPath,
|
|
176
155
|
theme: null
|
|
177
156
|
};
|
|
178
|
-
const StyledUxHeader = (0, _Theme.styled)(_Header.ResponsiveHeader)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
157
|
+
const StyledUxHeader = (0, _Theme.styled)(_Header.ResponsiveHeader)`
|
|
158
|
+
${({
|
|
159
|
+
$bgcolor
|
|
160
|
+
}) => `background-color: ${$bgcolor || "#fff"};`}
|
|
161
|
+
font-family: Lato, Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
|
|
162
|
+
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
163
|
+
.header-logo {
|
|
164
|
+
min-width: 44px;
|
|
165
|
+
}
|
|
166
|
+
${props => props.theme.breakpoints.down("md")} {
|
|
167
|
+
.header-logo {
|
|
168
|
+
min-width: 32px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
.header-nav {
|
|
172
|
+
.navmenu-sub .navmenu-item {
|
|
173
|
+
min-width: 80px;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
.header-nav.navmenu--horizontal {
|
|
177
|
+
.navmenu-root > .navmenu-sub,
|
|
178
|
+
.navmenu-root > .navmenu-item {
|
|
179
|
+
padding: 16px 4px;
|
|
180
|
+
|
|
181
|
+
.navmenu-sub-container {
|
|
182
|
+
padding-top: 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
.navmenu-item-icon > .MuiAvatar-root,
|
|
186
|
+
.navmenu-sub-icon > .MuiAvatar-root {
|
|
187
|
+
width: 20px;
|
|
188
|
+
height: 20px;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
module.exports = (0, _reactErrorBoundary.withErrorBoundary)(Header, {
|
|
185
193
|
FallbackComponent: _ErrorBoundary.ErrorFallback
|
|
186
|
-
});
|
|
187
|
-
exports.default = _default;
|
|
194
|
+
});
|