@blocklet/launcher-layout 2.3.20 → 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.
@@ -1,28 +1,52 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _propTypes = _interopRequireDefault(require("prop-types"));
8
- var _styled = _interopRequireDefault(require("@emotion/styled"));
9
- var _material = require("@mui/material");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- var _templateObject;
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
14
- function MarkdownBody(_ref) {
15
- let {
16
- children
17
- } = _ref;
18
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, {
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, {
19
9
  children: children
20
10
  });
21
11
  }
22
12
  const codeFont = 'source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important';
23
- const Root = (0, _styled.default)(_material.Box)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .highlight pre,\n pre {\n border-radius: 5px;\n }\n code {\n font-family: ", ";\n }\n pre code {\n font-size: 14px;\n font-family: ", ";\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n font-weight: 700 !important;\n font-size: 1.2rem !important;\n line-height: 1.5 !important;\n margin-bottom: 16px;\n margin-top: 24px;\n border-bottom: initial !important;\n }\n\n .CodeMirror pre {\n background: #f6f8fa !important;\n }\n\n .anchor {\n display: none;\n }\n"])), codeFont, codeFont);
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
+ `;
24
48
  MarkdownBody.propTypes = {
25
- children: _propTypes.default.any.isRequired
49
+ children: PropTypes.any.isRequired
26
50
  };
27
51
  MarkdownBody.defaultProps = {};
28
- var _default = exports.default = MarkdownBody;
52
+ export default MarkdownBody;
package/lib/nav.js CHANGED
@@ -1,28 +1,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _styled = _interopRequireDefault(require("@emotion/styled"));
8
- var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
9
- var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
- var _step = require("./context/step");
12
- var _header = _interopRequireDefault(require("./header"));
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- var _templateObject, _templateObject2;
15
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
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
- } = (0, _step.useStepContext)();
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__*/(0, _jsxRuntime.jsxs)(Div, {
70
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_header.default, {
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__*/(0, _jsxRuntime.jsx)(StepContainer, {
77
- className: "".concat(showSkeleton ? 'hide-child-step-desc' : ''),
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__*/(0, _jsxRuntime.jsxs)("div", {
70
+ return /*#__PURE__*/_jsxs("div", {
81
71
  className: getNodeClassName(step, index),
82
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
72
+ children: [/*#__PURE__*/_jsx("div", {
83
73
  className: "step-icon",
84
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Check.default, {
74
+ children: /*#__PURE__*/_jsx(Check, {
85
75
  style: {
86
76
  fontSize: 16
87
77
  }
88
78
  })
89
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
79
+ }), /*#__PURE__*/_jsx("div", {
90
80
  className: "step-line"
91
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
81
+ }), /*#__PURE__*/_jsxs("div", {
92
82
  className: "step-content",
93
83
  title: step.name,
94
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
95
- className: "step-content-name ".concat(canBack ? ' step-clickable' : ''),
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__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
95
+ children: showSkeleton ? /*#__PURE__*/_jsx(Skeleton, {
106
96
  variant: "text",
107
97
  width: 100
108
98
  }) : step.name
109
- }), step.description && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
99
+ }), step.description && /*#__PURE__*/_jsx("div", {
110
100
  className: "step-desc",
111
101
  children: step.description
112
- }), step.children && step.children.length && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
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__*/(0, _jsxRuntime.jsx)("div", {
128
- className: "step-child-block ".concat(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 = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow-y: auto;\n ", " {\n padding: 24px;\n border-right: 1px solid ", ";\n flex: 0 0 280px;\n min-height: 48px;\n\n .MuiStepConnector-vertical {\n padding: 0;\n }\n }\n\n ", " {\n padding: 16px;\n\n .MuiStepConnector-lineVertical {\n border: none;\n }\n }\n\n .stepper {\n padding: 0 !important;\n background: transparent;\n\n ", " {\n margin-top: 100px;\n }\n\n ", " {\n margin-top: 40px;\n }\n\n .step {\n cursor: pointer;\n }\n }\n\n .always-step-child {\n .step-child-block {\n animation: none !important;\n }\n }\n"])), props => props.theme.breakpoints.up('md'), props => props.theme.palette.grey[100], props => props.theme.breakpoints.down('md'), props => props.theme.breakpoints.up('sm'), props => props.theme.breakpoints.down('md'));
140
- const StepContainer = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-top: 60px;\n\n @media (max-height: 900px) {\n margin-top: 32px;\n }\n\n ", " {\n margin-top: 30px;\n }\n .step-clickable {\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n .step-line {\n display: block;\n position: absolute;\n z-index: 1;\n left: 11px;\n top: 12px;\n width: 2px;\n height: 100%;\n opacity: 0.5;\n background-color: ", ";\n transition: all ease 0.2s;\n }\n .step-icon {\n position: relative;\n z-index: 2;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n align-items: center;\n width: 24px;\n height: 24px;\n border-radius: 13px;\n background-color: ", ";\n color: ", ";\n transition: all ease 0.3s;\n &:before {\n position: absolute;\n left: 4px;\n top: 4px;\n z-index: 3;\n display: block;\n background-color: ", ";\n width: 16px;\n height: 16px;\n border-radius: 10px;\n content: '';\n transform: scale(0);\n transition: all ease 0.3s;\n }\n & > * {\n transform: scale(0);\n transition: all ease 0.2s;\n }\n }\n .step-content {\n position: relative;\n flex: 1;\n padding-top: 1px;\n margin-left: 22px;\n font-size: 16px;\n color: ", ";\n white-space: nowrap;\n }\n .step-desc {\n margin-top: 24px;\n font-size: 12px;\n font-weight: 500;\n height: 17px;\n color: ", ";\n transition: all ease 0.3s;\n overflow: hidden;\n }\n ", " {\n .step-content-name {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n &.hide-child-step-desc {\n .step-desc {\n margin: 0;\n opacity: 0;\n height: 0;\n }\n }\n .step-block {\n position: relative;\n display: flex;\n min-height: 70px;\n opacity: 0.5;\n overflow: hidden;\n transition: all ease 0.2s;\n &:last-child {\n height: auto;\n min-height: auto;\n }\n &.step-optional {\n height: 0;\n opacity: 0;\n min-height: 0px;\n }\n\n &.step-checked,\n &.step-active {\n .step-desc {\n margin: 0;\n opacity: 0;\n height: 0;\n }\n }\n\n &.step-checked {\n opacity: 1;\n .step-icon {\n color: ", ";\n background-color: ", ";\n & > * {\n transform: scale(1);\n }\n }\n\n .step-line {\n background-color: ", ";\n opacity: 1;\n }\n }\n\n &.step-active {\n opacity: 1;\n .step-icon {\n background-color: ", ";\n }\n .step-icon:before {\n transform: scale(1);\n }\n .step-content {\n color: ", ";\n }\n }\n\n &:last-child {\n .step-line {\n display: none;\n }\n\n .step-child-block {\n &:last-child {\n padding-bottom: 0;\n }\n }\n }\n\n &.hide-step-child {\n .step-children {\n .step-child-block {\n margin-top: 0;\n height: 0;\n opacity: 0;\n &:last-child {\n padding-bottom: 0;\n }\n }\n }\n }\n }\n .step-children {\n padding-top: 20px;\n .step-child-block {\n margin-top: 4px;\n height: 24px;\n line-height: 24px;\n font-size: 14px;\n color: #9397a1;\n transition: all ease 0.3s;\n &:first-of-type {\n margin-top: 8px;\n }\n &:last-child {\n padding-bottom: 40px;\n }\n &.step-child-block-active {\n color: ", ";\n font-weight: 700;\n }\n &.step-child-block-checked {\n color: ", ";\n }\n }\n }\n\n .step-active {\n .step-child-block {\n animation: stepChildAnime ease 0.3s;\n }\n }\n\n @keyframes stepChildAnime {\n 0% {\n height: 0;\n }\n 100% {\n height: 24px;\n }\n }\n"])), props => props.theme.breakpoints.down('md'), props => props.theme.palette.primary.main, props => props.theme.palette.grey[400], props => props.theme.palette.grey[400], props => props.theme.palette.common.white, props => props.theme.palette.common.white, props => props.theme.palette.grey[700], props => props.theme.palette.grey[700], props => props.theme.breakpoints.up('md'), props => props.theme.palette.common.white, props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.theme.palette.common.black, props => props.theme.palette.common.black);
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: _propTypes.default.object.isRequired,
143
- logoUrl: _propTypes.default.string,
144
- locale: _propTypes.default.string,
145
- useOfSkeleton: _propTypes.default.bool,
146
- subTitle: _propTypes.default.string,
147
- loading: _propTypes.default.bool
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
- var _default = exports.default = Nav;
405
+ export default Nav;
@@ -1,50 +1,63 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _styled = _interopRequireDefault(require("@emotion/styled"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _ArrowBackIos = _interopRequireDefault(require("@mui/icons-material/ArrowBackIos"));
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- var _templateObject;
12
- const _excluded = ["title", "subTitle", "onClickBack"];
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
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(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
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__*/(0, _jsxRuntime.jsx)("div", {
16
+ }), /*#__PURE__*/_jsx("div", {
34
17
  className: "title",
35
18
  children: title
36
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
19
+ }), /*#__PURE__*/_jsx("div", {
37
20
  className: "sub-title",
38
21
  children: subTitle
39
22
  })]
40
- }));
23
+ });
41
24
  }
42
- const Content = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n text-align: center;\n\n .title {\n font-size: 24px;\n font-weight: 700;\n color: ", ";\n\n ", " {\n font-size: 20px;\n }\n }\n\n .sub-title {\n font-size: 14px;\n color: ", ";\n padding: 0 14px;\n font-weight: 400;\n }\n\n .back-btn {\n position: absolute;\n left: 0;\n top: 8px;\n color: #9397a1;\n font-size: 18px;\n cursor: pointer;\n }\n"])), props => props.theme.palette.common.black, props => props.theme.breakpoints.down('md'), props => props.theme.palette.grey[600]);
43
- var _default = exports.default = PageHeader;
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: _propTypes.default.string,
46
- subTitle: _propTypes.default.string,
47
- onClickBack: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string])
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: '',
@@ -1,49 +1,41 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ThemeProvider = exports.default = ThemeProvider;
7
- exports.useThemeContext = useThemeContext;
8
- var _react = require("react");
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _react2 = require("@emotion/react");
11
- var _Theme = require("@arcblock/ux/lib/Theme");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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__*/(0, _jsxRuntime.jsx)(ThemeContext.Provider, {
17
+ return /*#__PURE__*/_jsx(ThemeContext.Provider, {
27
18
  value: theme,
28
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeContext.Consumer, {
19
+ children: /*#__PURE__*/_jsx(ThemeContext.Consumer, {
29
20
  children: themeValue => {
30
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Theme.ThemeProvider, {
21
+ return /*#__PURE__*/_jsx(UxThemeProvider, {
31
22
  theme: themeValue,
32
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.ThemeProvider, {
23
+ children: /*#__PURE__*/_jsx(EmotionThemeProvider, {
33
24
  theme: themeValue,
34
- children: _children
25
+ children: children
35
26
  })
36
27
  });
37
28
  }
38
29
  })
39
30
  });
40
31
  }
41
- return _children;
32
+ return children;
42
33
  }
43
34
  ThemeProvider.propTypes = {
44
- children: _propTypes.default.any.isRequired,
45
- theme: _propTypes.default.object.isRequired
35
+ children: PropTypes.any.isRequired,
36
+ theme: PropTypes.object.isRequired
46
37
  };
47
38
  function useThemeContext() {
48
- return (0, _react.useContext)(ThemeContext);
49
- }
39
+ return useContext(ThemeContext);
40
+ }
41
+ export { ThemeProvider, useThemeContext };