@blocklet/launcher-layout 2.3.19 → 2.3.21
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/compact-layout.js +55 -34
- package/lib/content.js +67 -20
- package/lib/context/step.js +19 -28
- package/lib/header.js +224 -91
- package/lib/index.js +198 -101
- package/lib/info-list.js +45 -0
- package/lib/launch-result-message.js +116 -55
- package/lib/locale.js +1 -8
- package/lib/markdown-body.js +52 -0
- package/lib/nav.js +300 -51
- package/lib/page-header.js +51 -38
- package/lib/theme-provider.js +24 -32
- package/lib/wizard/server-eula.js +60 -41
- package/lib/wizard/wizard-desc.js +187 -96
- package/package.json +19 -31
- package/es/assets/blocklet-default-logo.png +0 -0
- package/es/compact-layout.js +0 -114
- package/es/content.js +0 -72
- package/es/context/step.js +0 -137
- package/es/header.js +0 -337
- package/es/index.js +0 -307
- package/es/launch-result-message.js +0 -144
- package/es/locale.js +0 -13
- package/es/nav.js +0 -405
- package/es/page-header.js +0 -66
- package/es/theme-provider.js +0 -41
- package/es/wizard/server-eula.js +0 -96
- package/es/wizard/wizard-desc.js +0 -238
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
function MarkdownBody({
|
|
6
|
+
children
|
|
7
|
+
}) {
|
|
8
|
+
return /*#__PURE__*/_jsx(Root, {
|
|
9
|
+
children: children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
const codeFont = 'source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important';
|
|
13
|
+
const Root = styled(Box)`
|
|
14
|
+
.highlight pre,
|
|
15
|
+
pre {
|
|
16
|
+
border-radius: 5px;
|
|
17
|
+
}
|
|
18
|
+
code {
|
|
19
|
+
font-family: ${codeFont};
|
|
20
|
+
}
|
|
21
|
+
pre code {
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-family: ${codeFont};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
h1,
|
|
27
|
+
h2,
|
|
28
|
+
h3,
|
|
29
|
+
h4,
|
|
30
|
+
h5,
|
|
31
|
+
h6 {
|
|
32
|
+
font-weight: 700 !important;
|
|
33
|
+
font-size: 1.2rem !important;
|
|
34
|
+
line-height: 1.5 !important;
|
|
35
|
+
margin-bottom: 16px;
|
|
36
|
+
margin-top: 24px;
|
|
37
|
+
border-bottom: initial !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.CodeMirror pre {
|
|
41
|
+
background: #f6f8fa !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.anchor {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
MarkdownBody.propTypes = {
|
|
49
|
+
children: PropTypes.any.isRequired
|
|
50
|
+
};
|
|
51
|
+
MarkdownBody.defaultProps = {};
|
|
52
|
+
export default MarkdownBody;
|
package/lib/nav.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
17
|
-
function Nav(_ref) {
|
|
18
|
-
let {
|
|
19
|
-
blockletMeta,
|
|
20
|
-
logoUrl,
|
|
21
|
-
locale,
|
|
22
|
-
useOfSkeleton,
|
|
23
|
-
subTitle,
|
|
24
|
-
loading
|
|
25
|
-
} = _ref;
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import Check from '@mui/icons-material/Check';
|
|
3
|
+
import { Skeleton } from '@mui/material';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useStepContext } from './context/step';
|
|
6
|
+
import AppHeader from './header';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function Nav({
|
|
9
|
+
blockletMeta,
|
|
10
|
+
logoUrl,
|
|
11
|
+
locale,
|
|
12
|
+
useOfSkeleton,
|
|
13
|
+
subTitle,
|
|
14
|
+
loading
|
|
15
|
+
}) {
|
|
26
16
|
const {
|
|
27
17
|
steps,
|
|
28
18
|
activeStep,
|
|
@@ -30,7 +20,7 @@ function Nav(_ref) {
|
|
|
30
20
|
setActiveStepByIndex,
|
|
31
21
|
getStepStatus,
|
|
32
22
|
canBackToStep
|
|
33
|
-
} =
|
|
23
|
+
} = useStepContext();
|
|
34
24
|
const showSkeleton = useOfSkeleton ? loading : false;
|
|
35
25
|
const getNodeClassName = (step, index) => {
|
|
36
26
|
const classNameList = ['step-block'];
|
|
@@ -66,33 +56,33 @@ function Nav(_ref) {
|
|
|
66
56
|
}
|
|
67
57
|
return classNameList.join(' ');
|
|
68
58
|
};
|
|
69
|
-
return /*#__PURE__*/(
|
|
70
|
-
children: [/*#__PURE__*/(
|
|
59
|
+
return /*#__PURE__*/_jsxs(Div, {
|
|
60
|
+
children: [/*#__PURE__*/_jsx(AppHeader, {
|
|
71
61
|
blockletMeta: blockletMeta,
|
|
72
62
|
loading: loading,
|
|
73
63
|
logoUrl: logoUrl,
|
|
74
64
|
locale: locale,
|
|
75
65
|
subTitle: subTitle
|
|
76
|
-
}), /*#__PURE__*/(
|
|
77
|
-
className:
|
|
66
|
+
}), /*#__PURE__*/_jsx(StepContainer, {
|
|
67
|
+
className: `${showSkeleton ? 'hide-child-step-desc' : ''}`,
|
|
78
68
|
children: steps.map((step, index) => {
|
|
79
69
|
const canBack = !showSkeleton && canBackToStep(index);
|
|
80
|
-
return /*#__PURE__*/(
|
|
70
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
81
71
|
className: getNodeClassName(step, index),
|
|
82
|
-
children: [/*#__PURE__*/(
|
|
72
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
83
73
|
className: "step-icon",
|
|
84
|
-
children: /*#__PURE__*/(
|
|
74
|
+
children: /*#__PURE__*/_jsx(Check, {
|
|
85
75
|
style: {
|
|
86
76
|
fontSize: 16
|
|
87
77
|
}
|
|
88
78
|
})
|
|
89
|
-
}), /*#__PURE__*/(
|
|
79
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
90
80
|
className: "step-line"
|
|
91
|
-
}), /*#__PURE__*/(
|
|
81
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
92
82
|
className: "step-content",
|
|
93
83
|
title: step.name,
|
|
94
|
-
children: [/*#__PURE__*/(
|
|
95
|
-
className:
|
|
84
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
85
|
+
className: `step-content-name ${canBack ? ' step-clickable' : ''}`,
|
|
96
86
|
onClick: () => {
|
|
97
87
|
if (canBack) {
|
|
98
88
|
if (step.key) {
|
|
@@ -102,14 +92,14 @@ function Nav(_ref) {
|
|
|
102
92
|
setActiveStepByIndex(index);
|
|
103
93
|
}
|
|
104
94
|
},
|
|
105
|
-
children: showSkeleton ? /*#__PURE__*/(
|
|
95
|
+
children: showSkeleton ? /*#__PURE__*/_jsx(Skeleton, {
|
|
106
96
|
variant: "text",
|
|
107
97
|
width: 100
|
|
108
98
|
}) : step.name
|
|
109
|
-
}), step.description && /*#__PURE__*/(
|
|
99
|
+
}), step.description && /*#__PURE__*/_jsx("div", {
|
|
110
100
|
className: "step-desc",
|
|
111
101
|
children: step.description
|
|
112
|
-
}), step.children && step.children.length && /*#__PURE__*/(
|
|
102
|
+
}), step.children && step.children.length && /*#__PURE__*/_jsx("div", {
|
|
113
103
|
className: "step-children",
|
|
114
104
|
children: step.children.map(e => {
|
|
115
105
|
let className = '';
|
|
@@ -124,8 +114,8 @@ function Nav(_ref) {
|
|
|
124
114
|
case 'after':
|
|
125
115
|
default:
|
|
126
116
|
}
|
|
127
|
-
return /*#__PURE__*/(
|
|
128
|
-
className:
|
|
117
|
+
return /*#__PURE__*/_jsx("div", {
|
|
118
|
+
className: `step-child-block ${className}`,
|
|
129
119
|
children: e.name
|
|
130
120
|
}, e.key);
|
|
131
121
|
})
|
|
@@ -136,15 +126,274 @@ function Nav(_ref) {
|
|
|
136
126
|
})]
|
|
137
127
|
});
|
|
138
128
|
}
|
|
139
|
-
const Div =
|
|
140
|
-
|
|
129
|
+
const Div = styled.div`
|
|
130
|
+
overflow-y: auto;
|
|
131
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
132
|
+
padding: 24px;
|
|
133
|
+
border-right: 1px solid ${props => props.theme.palette.grey[100]};
|
|
134
|
+
flex: 0 0 280px;
|
|
135
|
+
min-height: 48px;
|
|
136
|
+
|
|
137
|
+
.MuiStepConnector-vertical {
|
|
138
|
+
padding: 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
143
|
+
padding: 16px;
|
|
144
|
+
|
|
145
|
+
.MuiStepConnector-lineVertical {
|
|
146
|
+
border: none;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.stepper {
|
|
151
|
+
padding: 0 !important;
|
|
152
|
+
background: transparent;
|
|
153
|
+
|
|
154
|
+
${props => props.theme.breakpoints.up('sm')} {
|
|
155
|
+
margin-top: 100px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
159
|
+
margin-top: 40px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.step {
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.always-step-child {
|
|
168
|
+
.step-child-block {
|
|
169
|
+
animation: none !important;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
const StepContainer = styled.div`
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
margin-top: 60px;
|
|
177
|
+
|
|
178
|
+
@media (max-height: 900px) {
|
|
179
|
+
margin-top: 32px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
183
|
+
margin-top: 30px;
|
|
184
|
+
}
|
|
185
|
+
.step-clickable {
|
|
186
|
+
cursor: pointer;
|
|
187
|
+
&:hover {
|
|
188
|
+
color: ${props => props.theme.palette.primary.main};
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
.step-line {
|
|
192
|
+
display: block;
|
|
193
|
+
position: absolute;
|
|
194
|
+
z-index: 1;
|
|
195
|
+
left: 11px;
|
|
196
|
+
top: 12px;
|
|
197
|
+
width: 2px;
|
|
198
|
+
height: 100%;
|
|
199
|
+
opacity: 0.5;
|
|
200
|
+
background-color: ${props => props.theme.palette.grey[400]};
|
|
201
|
+
transition: all ease 0.2s;
|
|
202
|
+
}
|
|
203
|
+
.step-icon {
|
|
204
|
+
position: relative;
|
|
205
|
+
z-index: 2;
|
|
206
|
+
display: flex;
|
|
207
|
+
flex-shrink: 0;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
align-items: center;
|
|
210
|
+
width: 24px;
|
|
211
|
+
height: 24px;
|
|
212
|
+
border-radius: 13px;
|
|
213
|
+
background-color: ${props => props.theme.palette.grey[400]};
|
|
214
|
+
color: ${props => props.theme.palette.common.white};
|
|
215
|
+
transition: all ease 0.3s;
|
|
216
|
+
&:before {
|
|
217
|
+
position: absolute;
|
|
218
|
+
left: 4px;
|
|
219
|
+
top: 4px;
|
|
220
|
+
z-index: 3;
|
|
221
|
+
display: block;
|
|
222
|
+
background-color: ${props => props.theme.palette.common.white};
|
|
223
|
+
width: 16px;
|
|
224
|
+
height: 16px;
|
|
225
|
+
border-radius: 10px;
|
|
226
|
+
content: '';
|
|
227
|
+
transform: scale(0);
|
|
228
|
+
transition: all ease 0.3s;
|
|
229
|
+
}
|
|
230
|
+
& > * {
|
|
231
|
+
transform: scale(0);
|
|
232
|
+
transition: all ease 0.2s;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
.step-content {
|
|
236
|
+
position: relative;
|
|
237
|
+
flex: 1;
|
|
238
|
+
padding-top: 1px;
|
|
239
|
+
margin-left: 22px;
|
|
240
|
+
font-size: 16px;
|
|
241
|
+
color: ${props => props.theme.palette.grey[700]};
|
|
242
|
+
white-space: nowrap;
|
|
243
|
+
}
|
|
244
|
+
.step-desc {
|
|
245
|
+
margin-top: 24px;
|
|
246
|
+
font-size: 12px;
|
|
247
|
+
font-weight: 500;
|
|
248
|
+
height: 17px;
|
|
249
|
+
color: ${props => props.theme.palette.grey[700]};
|
|
250
|
+
transition: all ease 0.3s;
|
|
251
|
+
overflow: hidden;
|
|
252
|
+
}
|
|
253
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
254
|
+
.step-content-name {
|
|
255
|
+
position: absolute;
|
|
256
|
+
left: 0;
|
|
257
|
+
top: 0;
|
|
258
|
+
width: 100%;
|
|
259
|
+
overflow: hidden;
|
|
260
|
+
text-overflow: ellipsis;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
&.hide-child-step-desc {
|
|
264
|
+
.step-desc {
|
|
265
|
+
margin: 0;
|
|
266
|
+
opacity: 0;
|
|
267
|
+
height: 0;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
.step-block {
|
|
271
|
+
position: relative;
|
|
272
|
+
display: flex;
|
|
273
|
+
min-height: 70px;
|
|
274
|
+
opacity: 0.5;
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
transition: all ease 0.2s;
|
|
277
|
+
&:last-child {
|
|
278
|
+
height: auto;
|
|
279
|
+
min-height: auto;
|
|
280
|
+
}
|
|
281
|
+
&.step-optional {
|
|
282
|
+
height: 0;
|
|
283
|
+
opacity: 0;
|
|
284
|
+
min-height: 0px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&.step-checked,
|
|
288
|
+
&.step-active {
|
|
289
|
+
.step-desc {
|
|
290
|
+
margin: 0;
|
|
291
|
+
opacity: 0;
|
|
292
|
+
height: 0;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
&.step-checked {
|
|
297
|
+
opacity: 1;
|
|
298
|
+
.step-icon {
|
|
299
|
+
color: ${props => props.theme.palette.common.white};
|
|
300
|
+
background-color: ${props => props.theme.palette.primary.main};
|
|
301
|
+
& > * {
|
|
302
|
+
transform: scale(1);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.step-line {
|
|
307
|
+
background-color: ${props => props.theme.palette.primary.main};
|
|
308
|
+
opacity: 1;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
&.step-active {
|
|
313
|
+
opacity: 1;
|
|
314
|
+
.step-icon {
|
|
315
|
+
background-color: ${props => props.theme.palette.primary.main};
|
|
316
|
+
}
|
|
317
|
+
.step-icon:before {
|
|
318
|
+
transform: scale(1);
|
|
319
|
+
}
|
|
320
|
+
.step-content {
|
|
321
|
+
color: ${props => props.theme.palette.primary.main};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
&:last-child {
|
|
326
|
+
.step-line {
|
|
327
|
+
display: none;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.step-child-block {
|
|
331
|
+
&:last-child {
|
|
332
|
+
padding-bottom: 0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
&.hide-step-child {
|
|
338
|
+
.step-children {
|
|
339
|
+
.step-child-block {
|
|
340
|
+
margin-top: 0;
|
|
341
|
+
height: 0;
|
|
342
|
+
opacity: 0;
|
|
343
|
+
&:last-child {
|
|
344
|
+
padding-bottom: 0;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
.step-children {
|
|
351
|
+
padding-top: 20px;
|
|
352
|
+
.step-child-block {
|
|
353
|
+
margin-top: 4px;
|
|
354
|
+
height: 24px;
|
|
355
|
+
line-height: 24px;
|
|
356
|
+
font-size: 14px;
|
|
357
|
+
color: #9397a1;
|
|
358
|
+
transition: all ease 0.3s;
|
|
359
|
+
&:first-of-type {
|
|
360
|
+
margin-top: 8px;
|
|
361
|
+
}
|
|
362
|
+
&:last-child {
|
|
363
|
+
padding-bottom: 40px;
|
|
364
|
+
}
|
|
365
|
+
&.step-child-block-active {
|
|
366
|
+
color: ${props => props.theme.palette.common.black};
|
|
367
|
+
font-weight: 700;
|
|
368
|
+
}
|
|
369
|
+
&.step-child-block-checked {
|
|
370
|
+
color: ${props => props.theme.palette.common.black};
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.step-active {
|
|
376
|
+
.step-child-block {
|
|
377
|
+
animation: stepChildAnime ease 0.3s;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
@keyframes stepChildAnime {
|
|
382
|
+
0% {
|
|
383
|
+
height: 0;
|
|
384
|
+
}
|
|
385
|
+
100% {
|
|
386
|
+
height: 24px;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
`;
|
|
141
390
|
Nav.propTypes = {
|
|
142
|
-
blockletMeta:
|
|
143
|
-
logoUrl:
|
|
144
|
-
locale:
|
|
145
|
-
useOfSkeleton:
|
|
146
|
-
subTitle:
|
|
147
|
-
loading:
|
|
391
|
+
blockletMeta: PropTypes.object.isRequired,
|
|
392
|
+
logoUrl: PropTypes.string,
|
|
393
|
+
locale: PropTypes.string,
|
|
394
|
+
useOfSkeleton: PropTypes.bool,
|
|
395
|
+
subTitle: PropTypes.string,
|
|
396
|
+
loading: PropTypes.bool
|
|
148
397
|
};
|
|
149
398
|
Nav.defaultProps = {
|
|
150
399
|
logoUrl: '',
|
|
@@ -153,4 +402,4 @@ Nav.defaultProps = {
|
|
|
153
402
|
subTitle: '',
|
|
154
403
|
loading: false
|
|
155
404
|
};
|
|
156
|
-
|
|
405
|
+
export default Nav;
|
package/lib/page-header.js
CHANGED
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
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; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
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 PageHeader(_ref) {
|
|
23
|
-
let {
|
|
24
|
-
title,
|
|
25
|
-
subTitle,
|
|
26
|
-
onClickBack
|
|
27
|
-
} = _ref,
|
|
28
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Content, _objectSpread(_objectSpread({}, rest), {}, {
|
|
30
|
-
children: [onClickBack && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowBackIos.default, {
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
function PageHeader({
|
|
6
|
+
title,
|
|
7
|
+
subTitle,
|
|
8
|
+
onClickBack,
|
|
9
|
+
...rest
|
|
10
|
+
}) {
|
|
11
|
+
return /*#__PURE__*/_jsxs(Content, {
|
|
12
|
+
...rest,
|
|
13
|
+
children: [onClickBack && /*#__PURE__*/_jsx(ArrowBackIosIcon, {
|
|
31
14
|
className: "back-btn",
|
|
32
15
|
onClick: onClickBack
|
|
33
|
-
}), /*#__PURE__*/(
|
|
16
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
34
17
|
className: "title",
|
|
35
18
|
children: title
|
|
36
|
-
}), /*#__PURE__*/(
|
|
19
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
37
20
|
className: "sub-title",
|
|
38
21
|
children: subTitle
|
|
39
22
|
})]
|
|
40
|
-
})
|
|
23
|
+
});
|
|
41
24
|
}
|
|
42
|
-
const Content =
|
|
43
|
-
|
|
25
|
+
const Content = styled.div`
|
|
26
|
+
position: relative;
|
|
27
|
+
width: 100%;
|
|
28
|
+
text-align: center;
|
|
29
|
+
|
|
30
|
+
.title {
|
|
31
|
+
font-size: 24px;
|
|
32
|
+
font-weight: 700;
|
|
33
|
+
color: ${props => props.theme.palette.common.black};
|
|
34
|
+
|
|
35
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
36
|
+
font-size: 20px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.sub-title {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
color: ${props => props.theme.palette.grey[600]};
|
|
43
|
+
padding: 0 14px;
|
|
44
|
+
font-weight: 400;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.back-btn {
|
|
48
|
+
position: absolute;
|
|
49
|
+
left: 0;
|
|
50
|
+
top: 8px;
|
|
51
|
+
color: #9397a1;
|
|
52
|
+
font-size: 18px;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
export default PageHeader;
|
|
44
57
|
PageHeader.propTypes = {
|
|
45
|
-
title:
|
|
46
|
-
subTitle:
|
|
47
|
-
onClickBack:
|
|
58
|
+
title: PropTypes.string,
|
|
59
|
+
subTitle: PropTypes.string,
|
|
60
|
+
onClickBack: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
|
|
48
61
|
};
|
|
49
62
|
PageHeader.defaultProps = {
|
|
50
63
|
title: '',
|
package/lib/theme-provider.js
CHANGED
|
@@ -1,49 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const defaultTheme = (0, _Theme.create)({});
|
|
15
|
-
const ThemeContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
16
|
-
function ThemeProvider() {
|
|
17
|
-
let {
|
|
18
|
-
children: _children,
|
|
19
|
-
theme: _theme
|
|
20
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
|
-
const [theme, setTheme] = (0, _react.useState)(defaultTheme);
|
|
22
|
-
(0, _react.useEffect)(() => {
|
|
1
|
+
import { createContext, useEffect, useState, useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
|
4
|
+
import { ThemeProvider as UxThemeProvider, create } from '@arcblock/ux/lib/Theme';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const defaultTheme = create({});
|
|
7
|
+
const ThemeContext = /*#__PURE__*/createContext({});
|
|
8
|
+
export default function ThemeProvider({
|
|
9
|
+
children,
|
|
10
|
+
theme: _theme
|
|
11
|
+
} = {}) {
|
|
12
|
+
const [theme, setTheme] = useState(defaultTheme);
|
|
13
|
+
useEffect(() => {
|
|
23
14
|
if (_theme && typeof _theme === 'object') setTheme(_theme);
|
|
24
15
|
}, [_theme]);
|
|
25
16
|
if (theme) {
|
|
26
|
-
return /*#__PURE__*/(
|
|
17
|
+
return /*#__PURE__*/_jsx(ThemeContext.Provider, {
|
|
27
18
|
value: theme,
|
|
28
|
-
children: /*#__PURE__*/(
|
|
19
|
+
children: /*#__PURE__*/_jsx(ThemeContext.Consumer, {
|
|
29
20
|
children: themeValue => {
|
|
30
|
-
return /*#__PURE__*/(
|
|
21
|
+
return /*#__PURE__*/_jsx(UxThemeProvider, {
|
|
31
22
|
theme: themeValue,
|
|
32
|
-
children: /*#__PURE__*/(
|
|
23
|
+
children: /*#__PURE__*/_jsx(EmotionThemeProvider, {
|
|
33
24
|
theme: themeValue,
|
|
34
|
-
children:
|
|
25
|
+
children: children
|
|
35
26
|
})
|
|
36
27
|
});
|
|
37
28
|
}
|
|
38
29
|
})
|
|
39
30
|
});
|
|
40
31
|
}
|
|
41
|
-
return
|
|
32
|
+
return children;
|
|
42
33
|
}
|
|
43
34
|
ThemeProvider.propTypes = {
|
|
44
|
-
children:
|
|
45
|
-
theme:
|
|
35
|
+
children: PropTypes.any.isRequired,
|
|
36
|
+
theme: PropTypes.object.isRequired
|
|
46
37
|
};
|
|
47
38
|
function useThemeContext() {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
39
|
+
return useContext(ThemeContext);
|
|
40
|
+
}
|
|
41
|
+
export { ThemeProvider, useThemeContext };
|