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