@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/index.js CHANGED
@@ -1,42 +1,43 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
8
- var _Theme = require("@arcblock/ux/lib/Theme");
9
- var _smallCircleProgress = _interopRequireDefault(require("@blocklet/launcher-ux/lib/small-circle-progress"));
10
- var _styled = _interopRequireDefault(require("@emotion/styled"));
11
- var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
12
- var _Hidden = _interopRequireDefault(require("@mui/material/Hidden"));
13
- var _react = require("@emotion/react");
14
- var _styles = require("@mui/material/styles");
15
- var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
16
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
17
- var _isObject = _interopRequireDefault(require("lodash/isObject"));
18
- var _propTypes = _interopRequireDefault(require("prop-types"));
19
- var _react2 = require("react");
20
- var _step = require("./context/step");
21
- var _header = _interopRequireDefault(require("./header"));
22
- var _locale = require("./locale");
23
- var _nav = _interopRequireDefault(require("./nav"));
24
- var _jsxRuntime = require("react/jsx-runtime");
25
- const _excluded = ["blockletMeta", "loading", "children", "logoUrl", "locale", "header", "headerEndAddons", "pcWidth", "pcHeight", "navLogo", "useOfSkeleton", "stepTip", "navSubTitle", "contentMaxWidth", "theme"];
26
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
- 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; }
29
- 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; }
30
- 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; }
31
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
32
- 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); }
33
- 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; }
34
- 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; }
35
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
1
+ import Center from '@arcblock/ux/lib/Center';
2
+ import { create } from '@arcblock/ux/lib/Theme';
3
+ import SmallCircleProgress from '@blocklet/launcher-ux/lib/small-circle-progress';
4
+ import styled from '@emotion/styled';
5
+ import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
6
+ import { Typography, useMediaQuery, StyledEngineProvider, ThemeProvider, Hidden, CircularProgress } from '@mui/material';
7
+ import isObject from 'lodash/isObject';
8
+ import PropTypes from 'prop-types';
9
+ import { Suspense, isValidElement } from 'react';
10
+ import { useStepContext } from './context/step';
11
+ import AppHeader from './header';
12
+ import { getTranslations } from './locale';
13
+ import Nav from './nav';
14
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
36
15
  const HEADER_HEIGHT_MD = '72px';
37
- const MobileContent = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n box-sizing: border-box;\n display: flex;\n overflow: hidden;\n width: 100%;\n height: 100%;\n padding-top: ", ";\n"])), HEADER_HEIGHT_MD);
38
- const PcContent = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n min-width: 900px;\n max-width: ", ";\n max-height: 880px;\n border-radius: 8px;\n background-color: #fff;\n width: ", ";\n height: ", ";\n\n @media (max-height: 1200px) {\n margin-top: ", ";\n height: 100%;\n max-height: 100%;\n }\n"])), props => props.contentMaxWidth, props => props.width || '80%', props => props.height || '80%', HEADER_HEIGHT_MD);
39
- const theme = (0, _Theme.create)({
16
+ const MobileContent = styled.div`
17
+ box-sizing: border-box;
18
+ display: flex;
19
+ overflow: hidden;
20
+ width: 100%;
21
+ height: 100%;
22
+ padding-top: ${HEADER_HEIGHT_MD};
23
+ `;
24
+ const PcContent = styled.div`
25
+ display: flex;
26
+ min-width: 900px;
27
+ max-width: ${props => props.contentMaxWidth};
28
+ max-height: 880px;
29
+ border-radius: 8px;
30
+ background-color: #fff;
31
+ width: ${props => props.width || '80%'};
32
+ height: ${props => props.height || '80%'};
33
+
34
+ @media (max-height: 1200px) {
35
+ margin-top: ${HEADER_HEIGHT_MD};
36
+ height: 100%;
37
+ max-height: 100%;
38
+ }
39
+ `;
40
+ const theme = create({
40
41
  typography: {
41
42
  fontSize: 14
42
43
  },
@@ -51,63 +52,63 @@ const theme = (0, _Theme.create)({
51
52
  }
52
53
  }
53
54
  });
54
- function Layout(_ref) {
55
- let {
56
- blockletMeta: tmpBlockletMeta,
57
- loading,
58
- children,
59
- logoUrl,
60
- locale,
61
- header,
62
- headerEndAddons,
63
- pcWidth,
64
- pcHeight,
65
- navLogo,
66
- useOfSkeleton,
67
- stepTip,
68
- navSubTitle,
69
- contentMaxWidth,
70
- theme: userTheme
71
- } = _ref,
72
- rest = _objectWithoutProperties(_ref, _excluded);
73
- const isMobile = (0, _useMediaQuery.default)(t => t.breakpoints.down('md'));
55
+ function Layout({
56
+ blockletMeta: tmpBlockletMeta,
57
+ loading,
58
+ children,
59
+ logoUrl,
60
+ locale,
61
+ header,
62
+ headerEndAddons,
63
+ pcWidth,
64
+ pcHeight,
65
+ navLogo,
66
+ useOfSkeleton,
67
+ stepTip,
68
+ navSubTitle,
69
+ contentMaxWidth,
70
+ theme: userTheme,
71
+ ...rest
72
+ }) {
73
+ const isMobile = useMediaQuery(t => t.breakpoints.down('md'));
74
74
  const {
75
75
  activeStep,
76
76
  totalStepsCount
77
- } = (0, _step.useStepContext)();
77
+ } = useStepContext();
78
78
  const blockletMeta = tmpBlockletMeta || {};
79
79
  const Container = isMobile ? MobileContent : PcContent;
80
- const translations = (0, _locale.getTranslations)(locale);
81
- if (navLogo && ! /*#__PURE__*/(0, _react2.isValidElement)(navLogo) && (0, _isObject.default)(navLogo)) {
80
+ const translations = getTranslations(locale);
81
+ if (navLogo && ! /*#__PURE__*/isValidElement(navLogo) && isObject(navLogo)) {
82
82
  if (isMobile) {
83
83
  // eslint-disable-next-line no-param-reassign
84
84
  navLogo = navLogo.mobile;
85
85
  } else {
86
86
  // eslint-disable-next-line no-param-reassign
87
- navLogo = /*#__PURE__*/(0, _jsxRuntime.jsx)(LogoContainer, {
87
+ navLogo = /*#__PURE__*/_jsx(LogoContainer, {
88
88
  children: navLogo.desktop
89
89
  });
90
90
  }
91
91
  }
92
92
  const tempTheme = Object.assign(theme, userTheme || {});
93
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledEngineProvider, {
93
+ return /*#__PURE__*/_jsx(StyledEngineProvider, {
94
94
  injectFirst: true,
95
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ThemeProvider, {
95
+ children: /*#__PURE__*/_jsx(ThemeProvider, {
96
96
  theme: tempTheme,
97
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.ThemeProvider, {
97
+ children: /*#__PURE__*/_jsx(EmotionThemeProvider, {
98
98
  theme: tempTheme,
99
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, _objectSpread(_objectSpread({}, rest), {}, {
100
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Header, {
99
+ children: /*#__PURE__*/_jsxs(Root, {
100
+ ...rest,
101
+ children: [/*#__PURE__*/_jsxs(Header, {
101
102
  maxWidth: contentMaxWidth,
102
103
  width: pcWidth,
103
- children: [header && header, !header && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
104
- children: [isMobile && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
104
+ children: [header && header, !header && /*#__PURE__*/_jsxs(_Fragment, {
105
+ children: [isMobile && /*#__PURE__*/_jsx("div", {
105
106
  className: "left",
106
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_header.default, {
107
+ children: /*#__PURE__*/_jsx(AppHeader, {
107
108
  blockletMeta: blockletMeta,
108
109
  navLogo: navLogo,
109
- subTitle: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
110
- children: ["".concat(navSubTitle || translations.defaultNavSubTitle, " ").concat(activeStep + 1, "/").concat(totalStepsCount), /*#__PURE__*/(0, _jsxRuntime.jsx)(_smallCircleProgress.default, {
110
+ subTitle: /*#__PURE__*/_jsxs("span", {
111
+ children: [`${navSubTitle || translations.defaultNavSubTitle} ${activeStep + 1}/${totalStepsCount}`, /*#__PURE__*/_jsx(SmallCircleProgress, {
111
112
  value: (activeStep + 1) / totalStepsCount * 100,
112
113
  style: {
113
114
  marginLeft: 3
@@ -118,20 +119,20 @@ function Layout(_ref) {
118
119
  locale: locale,
119
120
  loading: loading
120
121
  })
121
- }), navLogo && !isMobile && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
122
+ }), navLogo && !isMobile && /*#__PURE__*/_jsx("div", {
122
123
  className: "left",
123
124
  children: navLogo
124
- }), headerEndAddons && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
125
+ }), headerEndAddons && /*#__PURE__*/_jsx("div", {
125
126
  className: "right",
126
127
  children: headerEndAddons
127
128
  })]
128
129
  })]
129
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
130
+ }), /*#__PURE__*/_jsxs(Container, {
130
131
  contentMaxWidth: contentMaxWidth,
131
132
  className: "ll-container",
132
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Hidden.default, {
133
+ children: [/*#__PURE__*/_jsx(Hidden, {
133
134
  mdDown: true,
134
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_nav.default, {
135
+ children: /*#__PURE__*/_jsx(Nav, {
135
136
  locale: locale,
136
137
  blockletMeta: blockletMeta,
137
138
  logoUrl: logoUrl,
@@ -139,13 +140,13 @@ function Layout(_ref) {
139
140
  subTitle: navSubTitle,
140
141
  loading: loading
141
142
  })
142
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
143
+ }), /*#__PURE__*/_jsx(Typography, {
143
144
  component: "div",
144
145
  className: "layout-content",
145
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Suspense, {
146
- fallback: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Center.default, {
146
+ children: /*#__PURE__*/_jsx(Suspense, {
147
+ fallback: /*#__PURE__*/_jsx(Center, {
147
148
  relative: "parent",
148
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
149
+ children: /*#__PURE__*/_jsx(CircularProgress, {
149
150
  style: {
150
151
  marginTop: 36
151
152
  }
@@ -155,27 +156,27 @@ function Layout(_ref) {
155
156
  })
156
157
  })]
157
158
  })]
158
- }))
159
+ })
159
160
  })
160
161
  })
161
162
  });
162
163
  }
163
164
  Layout.propTypes = {
164
- loading: _propTypes.default.bool,
165
- blockletMeta: _propTypes.default.object,
166
- children: _propTypes.default.object.isRequired,
167
- logoUrl: _propTypes.default.string,
168
- locale: _propTypes.default.oneOf(['en', 'zh']),
169
- header: _propTypes.default.any,
170
- headerEndAddons: _propTypes.default.any,
171
- pcWidth: _propTypes.default.any,
172
- pcHeight: _propTypes.default.any,
173
- contentMaxWidth: _propTypes.default.string,
174
- navLogo: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.object]),
175
- useOfSkeleton: _propTypes.default.bool,
176
- stepTip: _propTypes.default.string,
177
- navSubTitle: _propTypes.default.string,
178
- theme: _propTypes.default.object
165
+ loading: PropTypes.bool,
166
+ blockletMeta: PropTypes.object,
167
+ children: PropTypes.object.isRequired,
168
+ logoUrl: PropTypes.string,
169
+ locale: PropTypes.oneOf(['en', 'zh']),
170
+ header: PropTypes.any,
171
+ headerEndAddons: PropTypes.any,
172
+ pcWidth: PropTypes.any,
173
+ pcHeight: PropTypes.any,
174
+ contentMaxWidth: PropTypes.string,
175
+ navLogo: PropTypes.oneOfType([PropTypes.node, PropTypes.object]),
176
+ useOfSkeleton: PropTypes.bool,
177
+ stepTip: PropTypes.string,
178
+ navSubTitle: PropTypes.string,
179
+ theme: PropTypes.object
179
180
  };
180
181
  Layout.defaultProps = {
181
182
  loading: false,
@@ -200,7 +201,103 @@ let injectStyle = '';
200
201
  if (ua.includes('iphone os') && ua.includes('crios')) {
201
202
  injectStyle = 'height: calc(100vh - 60px);';
202
203
  }
203
- const Header = _styled.default.header(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", ";\n min-width: 900px;\n box-sizing: border-box;\n position: absolute;\n z-index: 200;\n top: 0;\n display: flex;\n max-width: ", ";\n height: 68px;\n align-items: center;\n\n @media (max-height: 900px) {\n width: 100%;\n }\n\n ", " and (min-height: 900px) {\n justify-content: flex-end;\n }\n\n ", " {\n min-width: 360px;\n width: 100%;\n height: ", ";\n justify-content: space-between;\n background: #f6f8fa;\n }\n\n .left {\n flex: 1;\n display: flex;\n align-items: center;\n }\n\n .right {\n display: flex;\n align-items: center;\n ", " {\n button,\n a {\n padding-left: 8px;\n padding-right: 8px;\n }\n }\n }\n"])), props => props.width || '80%', props => props.maxWidth, props => props.theme.breakpoints.up('sm'), props => props.theme.breakpoints.down('md'), HEADER_HEIGHT_MD, props => props.theme.breakpoints.down('md'));
204
- const Root = _styled.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n letter-spacing: normal;\n ", "\n\n header:empty {\n display: none;\n }\n\n header:empty + div {\n margin-top: 0;\n padding-top: 0;\n }\n\n .circular {\n display: inline-block;\n position: relative;\n width: 15px;\n height: 12px;\n > * {\n position: absolute;\n left: 3px;\n top: 2px;\n width: 100%;\n height: 100%;\n }\n }\n\n .layout-content {\n width: 100%;\n height: 100%;\n padding: 32px;\n\n ", " {\n padding: 16px;\n }\n }\n\n ", " {\n background: #f6f8fa;\n }\n\n ", " {\n background: ", ";\n }\n"])), injectStyle, props => props.theme.breakpoints.down('md'), props => props.theme.breakpoints.up('sm'), props => props.theme.breakpoints.down('md'), props => props.theme.palette.common.white);
205
- const LogoContainer = _styled.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: block;\n margin-top: 4px;\n"])));
206
- var _default = exports.default = Layout;
204
+ const Header = styled.header`
205
+ width: ${props => props.width || '80%'};
206
+ min-width: 900px;
207
+ box-sizing: border-box;
208
+ position: absolute;
209
+ z-index: 200;
210
+ top: 0;
211
+ display: flex;
212
+ max-width: ${props => props.maxWidth};
213
+ height: 68px;
214
+ align-items: center;
215
+
216
+ @media (max-height: 900px) {
217
+ width: 100%;
218
+ }
219
+
220
+ ${props => props.theme.breakpoints.up('sm')} and (min-height: 900px) {
221
+ justify-content: flex-end;
222
+ }
223
+
224
+ ${props => props.theme.breakpoints.down('md')} {
225
+ min-width: 360px;
226
+ width: 100%;
227
+ height: ${HEADER_HEIGHT_MD};
228
+ justify-content: space-between;
229
+ background: #f6f8fa;
230
+ }
231
+
232
+ .left {
233
+ flex: 1;
234
+ display: flex;
235
+ align-items: center;
236
+ }
237
+
238
+ .right {
239
+ display: flex;
240
+ align-items: center;
241
+ ${props => props.theme.breakpoints.down('md')} {
242
+ button,
243
+ a {
244
+ padding-left: 8px;
245
+ padding-right: 8px;
246
+ }
247
+ }
248
+ }
249
+ `;
250
+ const Root = styled.div`
251
+ display: flex;
252
+ flex-direction: column;
253
+ justify-content: center;
254
+ align-items: center;
255
+ letter-spacing: normal;
256
+ ${injectStyle}
257
+
258
+ header:empty {
259
+ display: none;
260
+ }
261
+
262
+ header:empty + div {
263
+ margin-top: 0;
264
+ padding-top: 0;
265
+ }
266
+
267
+ .circular {
268
+ display: inline-block;
269
+ position: relative;
270
+ width: 15px;
271
+ height: 12px;
272
+ > * {
273
+ position: absolute;
274
+ left: 3px;
275
+ top: 2px;
276
+ width: 100%;
277
+ height: 100%;
278
+ }
279
+ }
280
+
281
+ .layout-content {
282
+ width: 100%;
283
+ height: 100%;
284
+ padding: 32px;
285
+
286
+ ${props => props.theme.breakpoints.down('md')} {
287
+ padding: 16px;
288
+ }
289
+ }
290
+
291
+ ${props => props.theme.breakpoints.up('sm')} {
292
+ background: #f6f8fa;
293
+ }
294
+
295
+ ${props => props.theme.breakpoints.down('md')} {
296
+ background: ${props => props.theme.palette.common.white};
297
+ }
298
+ `;
299
+ const LogoContainer = styled.div`
300
+ display: block;
301
+ margin-top: 4px;
302
+ `;
303
+ export default Layout;
@@ -0,0 +1,45 @@
1
+ import PropTypes from 'prop-types';
2
+ import { Box } from '@mui/material';
3
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
4
+ export default function InfoTable({
5
+ infoList = []
6
+ }) {
7
+ return /*#__PURE__*/_jsx(Box, {
8
+ className: "info-table",
9
+ sx: {
10
+ display: 'grid',
11
+ gridTemplateColumns: {
12
+ xs: '1fr',
13
+ md: 'max-content 1fr'
14
+ },
15
+ columnGap: 4,
16
+ rowGap: 1.5
17
+ },
18
+ children: infoList.map(item => /*#__PURE__*/_jsxs(_Fragment, {
19
+ children: [/*#__PURE__*/_jsx(Box, {
20
+ component: "span",
21
+ sx: {
22
+ fontWeight: 'bold',
23
+ whiteSpace: 'nowrap'
24
+ },
25
+ children: item.key
26
+ }), /*#__PURE__*/_jsx(Box, {
27
+ component: "span",
28
+ sx: {
29
+ marginTop: {
30
+ xs: -1,
31
+ md: 0
32
+ }
33
+ },
34
+ children: item.value
35
+ })]
36
+ }))
37
+ });
38
+ }
39
+ InfoTable.propTypes = {
40
+ // eslint-disable-next-line react/require-default-props
41
+ infoList: PropTypes.arrayOf(PropTypes.shape({
42
+ key: PropTypes.string,
43
+ value: PropTypes.string
44
+ }))
45
+ };
@@ -1,75 +1,55 @@
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 _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
10
- var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
11
- var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
12
- var _PriorityHigh = _interopRequireDefault(require("@mui/icons-material/PriorityHigh"));
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- var _templateObject;
15
- const _excluded = ["variant", "title", "subTitle", "footer"];
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
18
- 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; }
19
- 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; }
20
- 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; }
21
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
22
- 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); }
23
- 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; }
24
- 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; }
25
- function LaunchResultMessage(_ref) {
26
- let {
27
- variant,
28
- title,
29
- subTitle,
30
- footer
31
- } = _ref,
32
- props = _objectWithoutProperties(_ref, _excluded);
1
+ import PropTypes from 'prop-types';
2
+ import styled from '@emotion/styled';
3
+ import { Check, Close, PriorityHigh } from '@mui/icons-material';
4
+ import { CircularProgress } from '@mui/material';
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ function LaunchResultMessage({
7
+ variant,
8
+ title,
9
+ subTitle,
10
+ footer,
11
+ ...props
12
+ }) {
33
13
  let Icon;
34
14
  switch (variant) {
35
15
  case 'error':
36
- Icon = _Close.default;
16
+ Icon = Close;
37
17
  break;
38
18
  case 'info':
39
- Icon = _PriorityHigh.default;
19
+ Icon = PriorityHigh;
40
20
  break;
41
21
  case 'loading':
42
- Icon = _CircularProgress.default;
22
+ Icon = CircularProgress;
43
23
  break;
44
24
  default:
45
- Icon = _Check.default;
25
+ Icon = Check;
46
26
  }
47
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, _objectSpread(_objectSpread({
48
- variant: variant
49
- }, props), {}, {
50
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
27
+ return /*#__PURE__*/_jsx(Container, {
28
+ variant: variant,
29
+ ...props,
30
+ children: /*#__PURE__*/_jsxs("div", {
51
31
  className: "result-body",
52
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
53
- className: "result-icon color-".concat(variant),
54
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {})
55
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
- className: "result-title color-".concat(variant, " ").concat(title ? '' : 'ele-hide'),
32
+ children: [/*#__PURE__*/_jsx("span", {
33
+ className: `result-icon color-${variant}`,
34
+ children: /*#__PURE__*/_jsx(Icon, {})
35
+ }), /*#__PURE__*/_jsx("div", {
36
+ className: `result-title color-${variant} ${title ? '' : 'ele-hide'}`,
57
37
  children: title
58
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
59
- className: "result-sub-title ".concat(subTitle ? '' : 'ele-hide'),
38
+ }), /*#__PURE__*/_jsx("div", {
39
+ className: `result-sub-title ${subTitle ? '' : 'ele-hide'}`,
60
40
  children: subTitle
61
- }), footer && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
41
+ }), footer && /*#__PURE__*/_jsx("div", {
62
42
  className: "result-footer",
63
43
  children: footer
64
44
  })]
65
45
  })
66
- }));
46
+ });
67
47
  }
68
48
  LaunchResultMessage.propTypes = {
69
- variant: _propTypes.default.oneOf(['success', 'error', 'info', 'loading']),
70
- title: _propTypes.default.string,
71
- subTitle: _propTypes.default.any,
72
- footer: _propTypes.default.any
49
+ variant: PropTypes.oneOf(['success', 'error', 'info', 'loading']),
50
+ title: PropTypes.string,
51
+ subTitle: PropTypes.any,
52
+ footer: PropTypes.any
73
53
  };
74
54
  LaunchResultMessage.defaultProps = {
75
55
  variant: 'success',
@@ -77,5 +57,86 @@ LaunchResultMessage.defaultProps = {
77
57
  subTitle: '',
78
58
  footer: null
79
59
  };
80
- var _default = exports.default = LaunchResultMessage;
81
- const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n width: 100%;\n height: 100%;\n\n .result-body {\n padding: 0 14px;\n max-width: 500px;\n text-align: center;\n margin-top: -64px;\n }\n\n .result-icon {\n display: inline-flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 24px;\n width: 48px;\n height: 48px;\n border-radius: 100%;\n color: ", ";\n transition: all ease 0.3s;\n &.color-success {\n background-color: ", ";\n }\n &.color-error {\n background-color: ", ";\n }\n &.color-info {\n background-color: ", ";\n }\n }\n\n .result-title {\n height: 34px;\n font-size: 21px;\n margin-bottom: 8px;\n font-weight: bolder;\n transition: all ease 0.3s;\n transition-delay: 0.2s;\n &.color-success {\n color: ", ";\n }\n &.color-error {\n color: ", ";\n }\n &.color-info {\n color: ", ";\n }\n &.ele-hide {\n height: 0;\n opacity: 0;\n margin-bottom: 0;\n }\n }\n\n .result-sub-title {\n margin: 0 auto;\n min-height: 17px;\n color: ", ";\n font-size: 14px;\n line-height: 1.21em; // 0.01\u53EF\u4EE5\u89E3\u51B3\u89C6\u7F51\u819C\u5C4F\u8F7B\u5FAE\u504F\u79FB\u95EE\u9898\n transition: all ease 0.3s;\n transition-delay: 0.2s;\n word-break: break-word;\n &.ele-hide {\n line-height: 0;\n opacity: 0;\n min-height: 0;\n }\n }\n\n .result-footer {\n padding-top: 24px;\n transition: all ease 0.3s;\n transition-delay: 0.2s;\n }\n"])), props => props.theme.palette.common.white, props => props.theme.palette.success.main, props => props.theme.palette.error.main, props => props.theme.palette.primary.main, props => props.theme.palette.success.main, props => props.theme.palette.error.main, props => props.theme.palette.primary.main, props => props.theme.palette.grey[700]);
60
+ export default LaunchResultMessage;
61
+ const Container = styled.div`
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ justify-content: center;
66
+ text-align: center;
67
+ width: 100%;
68
+ height: 100%;
69
+
70
+ .result-body {
71
+ padding: 0 14px;
72
+ max-width: 500px;
73
+ text-align: center;
74
+ margin-top: -64px;
75
+ }
76
+
77
+ .result-icon {
78
+ display: inline-flex;
79
+ justify-content: center;
80
+ align-items: center;
81
+ margin-bottom: 24px;
82
+ width: 48px;
83
+ height: 48px;
84
+ border-radius: 100%;
85
+ color: ${props => props.theme.palette.common.white};
86
+ transition: all ease 0.3s;
87
+ &.color-success {
88
+ background-color: ${props => props.theme.palette.success.main};
89
+ }
90
+ &.color-error {
91
+ background-color: ${props => props.theme.palette.error.main};
92
+ }
93
+ &.color-info {
94
+ background-color: ${props => props.theme.palette.primary.main};
95
+ }
96
+ }
97
+
98
+ .result-title {
99
+ height: 34px;
100
+ font-size: 21px;
101
+ margin-bottom: 8px;
102
+ font-weight: bolder;
103
+ transition: all ease 0.3s;
104
+ transition-delay: 0.2s;
105
+ &.color-success {
106
+ color: ${props => props.theme.palette.success.main};
107
+ }
108
+ &.color-error {
109
+ color: ${props => props.theme.palette.error.main};
110
+ }
111
+ &.color-info {
112
+ color: ${props => props.theme.palette.primary.main};
113
+ }
114
+ &.ele-hide {
115
+ height: 0;
116
+ opacity: 0;
117
+ margin-bottom: 0;
118
+ }
119
+ }
120
+
121
+ .result-sub-title {
122
+ margin: 0 auto;
123
+ min-height: 17px;
124
+ color: ${props => props.theme.palette.grey[700]};
125
+ font-size: 14px;
126
+ line-height: 1.21em; // 0.01可以解决视网膜屏轻微偏移问题
127
+ transition: all ease 0.3s;
128
+ transition-delay: 0.2s;
129
+ word-break: break-word;
130
+ &.ele-hide {
131
+ line-height: 0;
132
+ opacity: 0;
133
+ min-height: 0;
134
+ }
135
+ }
136
+
137
+ .result-footer {
138
+ padding-top: 24px;
139
+ transition: all ease 0.3s;
140
+ transition-delay: 0.2s;
141
+ }
142
+ `;
package/lib/locale.js CHANGED
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTranslations = exports.getLaunchingText = void 0;
7
1
  const translations = {
8
2
  en: {
9
3
  optional: 'Optional',
@@ -15,6 +9,5 @@ const translations = {
15
9
  }
16
10
  };
17
11
  const getTranslations = locale => translations[locale] ? translations[locale] : translations.en;
18
- exports.getTranslations = getTranslations;
19
12
  const getLaunchingText = locale => locale === 'zh' ? '启动' : 'Launching';
20
- exports.getLaunchingText = getLaunchingText;
13
+ export { getTranslations, getLaunchingText };