@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,18 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _styled = _interopRequireDefault(require("@emotion/styled"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
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 CompactLayout(_ref) {
15
- let {
16
- children,
17
- bottom,
18
- onBottomFix
19
- } = _ref;
20
- const mainCon = (0, _react.useRef)(null);
21
- const childsCon = (0, _react.useRef)(null);
22
- const compactCon = (0, _react.useRef)(null);
23
- const isFix = (0, _react.useRef)(null);
24
- const [scrollMode, setScrollMode] = (0, _react.useState)(false);
25
- (0, _react.useEffect)(() => {
1
+ import { useState, useEffect, useRef } from 'react';
2
+ import styled from '@emotion/styled';
3
+ import PropTypes from 'prop-types';
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ function CompactLayout({
6
+ children,
7
+ bottom,
8
+ onBottomFix
9
+ }) {
10
+ const mainCon = useRef(null);
11
+ const childsCon = useRef(null);
12
+ const compactCon = useRef(null);
13
+ const isFix = useRef(null);
14
+ const [scrollMode, setScrollMode] = useState(false);
15
+ useEffect(() => {
26
16
  let inTimer;
27
17
  const fixSize = () => {
28
18
  if (inTimer) {
@@ -66,28 +56,59 @@ function CompactLayout(_ref) {
66
56
  }
67
57
  };
68
58
  }, [onBottomFix]);
69
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
59
+ return /*#__PURE__*/_jsxs(Container, {
70
60
  ref: mainCon,
71
- className: "".concat(scrollMode ? 'scroll-mode' : ''),
72
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
+ className: `${scrollMode ? 'scroll-mode' : ''}`,
62
+ children: [/*#__PURE__*/_jsx("div", {
73
63
  className: "compact-context",
74
64
  ref: childsCon,
75
65
  children: children
76
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
66
+ }), /*#__PURE__*/_jsx("div", {
77
67
  className: "fix-container",
78
68
  ref: compactCon,
79
69
  children: bottom
80
70
  })]
81
71
  });
82
72
  }
83
- const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n animation: fadein ease 0.5s;\n\n .fix-container {\n margin-top: auto;\n width: 100%;\n }\n\n &.scroll-mode {\n .compact-context {\n flex: 1;\n overflow-y: auto;\n }\n .fix-container {\n margin-top: auto;\n flex-shrink: 0;\n }\n }\n\n @keyframes fadein {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n"])));
73
+ const Container = styled.div`
74
+ display: flex;
75
+ flex-direction: column;
76
+ width: 100%;
77
+ height: 100%;
78
+ animation: fadein ease 0.5s;
79
+
80
+ .fix-container {
81
+ margin-top: auto;
82
+ width: 100%;
83
+ }
84
+
85
+ &.scroll-mode {
86
+ .compact-context {
87
+ flex: 1;
88
+ overflow-y: auto;
89
+ }
90
+ .fix-container {
91
+ margin-top: auto;
92
+ flex-shrink: 0;
93
+ }
94
+ }
95
+
96
+ @keyframes fadein {
97
+ 0% {
98
+ opacity: 0;
99
+ }
100
+ 100% {
101
+ opacity: 1;
102
+ }
103
+ }
104
+ `;
84
105
  CompactLayout.propTypes = {
85
- children: _propTypes.default.any,
86
- bottom: _propTypes.default.element.isRequired,
87
- onBottomFix: _propTypes.default.func
106
+ children: PropTypes.any,
107
+ bottom: PropTypes.element.isRequired,
108
+ onBottomFix: PropTypes.func
88
109
  };
89
110
  CompactLayout.defaultProps = {
90
111
  children: [],
91
112
  onBottomFix: () => {}
92
113
  };
93
- var _default = exports.default = CompactLayout;
114
+ export default CompactLayout;
package/lib/content.js CHANGED
@@ -1,25 +1,72 @@
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 _jsxRuntime = require("react/jsx-runtime");
10
- var _templateObject;
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
13
- function Content(_ref) {
14
- let {
15
- children
16
- } = _ref;
17
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, {
1
+ import styled from '@emotion/styled';
2
+ import PropTypes from 'prop-types';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ function Content({
5
+ children
6
+ }) {
7
+ return /*#__PURE__*/_jsx(Container, {
18
8
  children: children
19
9
  });
20
10
  }
21
11
  Content.propTypes = {
22
- children: _propTypes.default.any.isRequired
12
+ children: PropTypes.any.isRequired
23
13
  };
24
- var _default = exports.default = Content;
25
- const Container = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n\n .center {\n display: flex;\n justify-content: center;\n }\n\n .page-title {\n text-align: center;\n }\n\n .toolbar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n .toolbar_title {\n color: ", ";\n font-size: 16px;\n }\n }\n\n .page-footer {\n display: flex;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n background: ", ";\n\n .create-button {\n margin-right: 32px;\n }\n\n & > button,\n .button {\n margin: 0 8px;\n }\n\n ", " {\n padding: 24px;\n & > button,\n .button {\n margin: 0 12px;\n min-width: 200px;\n }\n }\n\n ", " {\n margin-top: auto;\n padding: 16px;\n }\n }\n"])), props => props.theme.palette.grey['900'], props => props.theme.palette.common.white, props => props.theme.breakpoints.up('md'), props => props.theme.breakpoints.down('md'));
14
+ export default Content;
15
+ const Container = styled.div`
16
+ display: flex;
17
+ flex-direction: column;
18
+ height: 100%;
19
+ width: 100%;
20
+
21
+ .center {
22
+ display: flex;
23
+ justify-content: center;
24
+ }
25
+
26
+ .page-title {
27
+ text-align: center;
28
+ }
29
+
30
+ .toolbar {
31
+ display: flex;
32
+ justify-content: space-between;
33
+ align-items: center;
34
+
35
+ .toolbar_title {
36
+ color: ${props => props.theme.palette.grey['900']};
37
+ font-size: 16px;
38
+ }
39
+ }
40
+
41
+ .page-footer {
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+
46
+ width: 100%;
47
+ background: ${props => props.theme.palette.common.white};
48
+
49
+ .create-button {
50
+ margin-right: 32px;
51
+ }
52
+
53
+ & > button,
54
+ .button {
55
+ margin: 0 8px;
56
+ }
57
+
58
+ ${props => props.theme.breakpoints.up('md')} {
59
+ padding: 24px;
60
+ & > button,
61
+ .button {
62
+ margin: 0 12px;
63
+ min-width: 200px;
64
+ }
65
+ }
66
+
67
+ ${props => props.theme.breakpoints.down('md')} {
68
+ margin-top: auto;
69
+ padding: 16px;
70
+ }
71
+ }
72
+ `;
@@ -1,20 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StepProvider = StepProvider;
7
- exports.useStepContext = useStepContext;
8
- var _react = require("react");
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- const StepContext = /*#__PURE__*/(0, _react.createContext)();
1
+ import { createContext, useContext, useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const StepContext = /*#__PURE__*/createContext();
13
5
  const {
14
6
  Provider
15
7
  } = StepContext;
16
- const matchPath = function matchPath(path, exact) {
17
- let currentPathname = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : window.location.pathname.replace(/\/$/, '/');
8
+ const matchPath = (path, exact, currentPathname = window.location.pathname.replace(/\/$/, '/')) => {
18
9
  if (!path) {
19
10
  return false;
20
11
  }
@@ -23,13 +14,12 @@ const matchPath = function matchPath(path, exact) {
23
14
  }
24
15
  return new RegExp(path).test(currentPathname);
25
16
  };
26
- function StepProvider(_ref) {
27
- let {
28
- children,
29
- steps,
30
- mode
31
- } = _ref;
32
- const [activeStepKey, setActiveStepKey] = (0, _react.useState)('');
17
+ function StepProvider({
18
+ children,
19
+ steps,
20
+ mode
21
+ }) {
22
+ const [activeStepKey, setActiveStepKey] = useState('');
33
23
  if (!activeStepKey && steps.length) {
34
24
  setActiveStepKey(steps[0].key);
35
25
  }
@@ -91,7 +81,7 @@ function StepProvider(_ref) {
91
81
  }
92
82
  }
93
83
  const activeStep = totalSteps.findIndex(e => e.key === activeStepKey);
94
- (0, _react.useEffect)(() => {
84
+ useEffect(() => {
95
85
  if (mode === 'history') {
96
86
  let stepKey = '';
97
87
  steps.some(step => {
@@ -128,19 +118,20 @@ function StepProvider(_ref) {
128
118
  return mode === 'memory' && activeStep !== 0 && nodeIndex < activeStep;
129
119
  }
130
120
  };
131
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
121
+ return /*#__PURE__*/_jsx(Provider, {
132
122
  value: value,
133
123
  children: children
134
124
  });
135
125
  }
136
126
  function useStepContext() {
137
- return (0, _react.useContext)(StepContext);
127
+ return useContext(StepContext);
138
128
  }
139
129
  StepProvider.propTypes = {
140
- children: _propTypes.default.any.isRequired,
141
- steps: _propTypes.default.array.isRequired,
142
- mode: _propTypes.default.string
130
+ children: PropTypes.any.isRequired,
131
+ steps: PropTypes.array.isRequired,
132
+ mode: PropTypes.string
143
133
  };
144
134
  StepProvider.defaultProps = {
145
135
  mode: 'history'
146
- };
136
+ };
137
+ export { StepProvider, useStepContext };