@semcore/spin-container 16.0.0-prerelease.4 → 16.0.0-prerelease.7
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/esm/SpinContainer.mjs +117 -92
- package/lib/esm/index.mjs +2 -2
- package/package.json +5 -5
|
@@ -1,132 +1,157 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import { FadeInOut
|
|
11
|
-
import
|
|
12
|
-
import { Box
|
|
13
|
-
import
|
|
14
|
-
import { isAdvanceMode
|
|
15
|
-
var
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { FadeInOut } from "@semcore/animation";
|
|
11
|
+
import Spin from "@semcore/spin";
|
|
12
|
+
import { Box } from "@semcore/flex-box";
|
|
13
|
+
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
14
|
+
import { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
|
|
15
|
+
var style = (
|
|
16
16
|
/*__reshadow_css_start__*/
|
|
17
|
-
(
|
|
17
|
+
(sstyled.insert(
|
|
18
18
|
/*__inner_css_start__*/
|
|
19
19
|
".___SSpinContainer_quxrx_gg_{z-index:0;position:relative;display:block;overflow:hidden}.___SContent_quxrx_gg_{z-index:0;position:relative}.___SOverlay_quxrx_gg_{z-index:1;display:flex;width:100%;height:100%;justify-content:center;align-items:center;position:absolute;top:0;left:0}.___SOverlay_quxrx_gg_._theme_invert_quxrx_gg_{background-color:var(--intergalactic-overlay-secondary, rgba(25, 27, 35, 0.4))}.___SOverlay_quxrx_gg_._theme_dark_quxrx_gg_{background-color:var(--intergalactic-overlay-limitation-secondary, rgba(255, 255, 255, 0.85))}.___SOverlay_quxrx_gg_._theme_custom_quxrx_gg_{background-color:var(--background_quxrx)}",
|
|
20
20
|
"quxrx_gg_"
|
|
21
21
|
), {
|
|
22
|
-
__SSpinContainer: "___SSpinContainer_quxrx_gg_",
|
|
23
|
-
__SContent: "___SContent_quxrx_gg_",
|
|
24
|
-
__SOverlay: "___SOverlay_quxrx_gg_",
|
|
25
|
-
_theme_invert: "_theme_invert_quxrx_gg_",
|
|
26
|
-
_theme_dark: "_theme_dark_quxrx_gg_",
|
|
27
|
-
_theme_custom: "_theme_custom_quxrx_gg_",
|
|
22
|
+
"__SSpinContainer": "___SSpinContainer_quxrx_gg_",
|
|
23
|
+
"__SContent": "___SContent_quxrx_gg_",
|
|
24
|
+
"__SOverlay": "___SOverlay_quxrx_gg_",
|
|
25
|
+
"_theme_invert": "_theme_invert_quxrx_gg_",
|
|
26
|
+
"_theme_dark": "_theme_dark_quxrx_gg_",
|
|
27
|
+
"_theme_custom": "_theme_custom_quxrx_gg_",
|
|
28
28
|
"--background": "--background_quxrx"
|
|
29
29
|
})
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
);
|
|
31
|
+
var SpinContainerRoot = /* @__PURE__ */ function(_Component) {
|
|
32
|
+
_inherits(SpinContainerRoot2, _Component);
|
|
33
|
+
var _super = _createSuper(SpinContainerRoot2);
|
|
34
|
+
function SpinContainerRoot2() {
|
|
35
|
+
var _this;
|
|
36
|
+
_classCallCheck(this, SpinContainerRoot2);
|
|
37
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
|
+
args[_key] = arguments[_key];
|
|
39
|
+
}
|
|
40
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
42
|
+
inert: _this.props.loading
|
|
43
|
+
});
|
|
44
|
+
return _this;
|
|
41
45
|
}
|
|
42
|
-
|
|
46
|
+
_createClass(SpinContainerRoot2, [{
|
|
43
47
|
key: "componentDidUpdate",
|
|
44
|
-
value: function(
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
value: function componentDidUpdate(prevProps) {
|
|
49
|
+
var _this2 = this;
|
|
50
|
+
var loading = this.props.loading;
|
|
51
|
+
if (prevProps.loading !== loading) {
|
|
52
|
+
if (this.inertTimer) {
|
|
53
|
+
clearTimeout(this.inertTimer);
|
|
54
|
+
}
|
|
55
|
+
if (loading) {
|
|
56
|
+
this.setState({
|
|
57
|
+
inert: true
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
this.inertTimer = setTimeout(function() {
|
|
61
|
+
_this2.setState({
|
|
62
|
+
inert: false
|
|
63
|
+
});
|
|
64
|
+
}, this.asProps.duration + 50);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
53
67
|
}
|
|
54
68
|
}, {
|
|
55
69
|
key: "getOverlayProps",
|
|
56
|
-
value: function() {
|
|
57
|
-
var
|
|
70
|
+
value: function getOverlayProps() {
|
|
71
|
+
var _this$asProps = this.asProps, loading = _this$asProps.loading, background = _this$asProps.background, duration = _this$asProps.duration, size = _this$asProps.size, theme = _this$asProps.theme, resolveColor = _this$asProps.resolveColor;
|
|
58
72
|
return {
|
|
59
|
-
background
|
|
73
|
+
background,
|
|
60
74
|
// for Animated
|
|
61
|
-
loading
|
|
62
|
-
duration
|
|
75
|
+
loading,
|
|
76
|
+
duration,
|
|
63
77
|
// for Spin
|
|
64
|
-
size
|
|
65
|
-
theme
|
|
66
|
-
resolveColor
|
|
78
|
+
size,
|
|
79
|
+
theme,
|
|
80
|
+
resolveColor
|
|
67
81
|
};
|
|
68
82
|
}
|
|
69
83
|
}, {
|
|
70
84
|
key: "getContentProps",
|
|
71
|
-
value: function() {
|
|
72
|
-
var
|
|
85
|
+
value: function getContentProps() {
|
|
86
|
+
var inert = this.state.inert;
|
|
73
87
|
return {
|
|
74
|
-
inert:
|
|
88
|
+
inert: inert ? "" : void 0
|
|
75
89
|
};
|
|
76
90
|
}
|
|
77
91
|
}, {
|
|
78
92
|
key: "render",
|
|
79
|
-
value: function() {
|
|
80
|
-
var
|
|
81
|
-
|
|
93
|
+
value: function render() {
|
|
94
|
+
var _ref = this.asProps, _ref4;
|
|
95
|
+
var SSpinContainer = Box;
|
|
96
|
+
var _this$asProps2 = this.asProps, styles = _this$asProps2.styles, Children = _this$asProps2.Children, forcedAdvancedMode = _this$asProps2.forcedAdvancedMode;
|
|
97
|
+
var advancedMode = forcedAdvancedMode || isAdvanceMode(Children, [SpinContainer.Overlay.displayName]);
|
|
98
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SSpinContainer, _ref4.cn("SSpinContainer", _objectSpread({}, assignProps({}, _ref))), advancedMode ? /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {})) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SpinContainer.Content, null, /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {}))), /* @__PURE__ */ React.createElement(SpinContainer.Overlay, null)));
|
|
82
99
|
}
|
|
83
|
-
}])
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
100
|
+
}]);
|
|
101
|
+
return SpinContainerRoot2;
|
|
102
|
+
}(Component);
|
|
103
|
+
_defineProperty(SpinContainerRoot, "displayName", "SpinContainer");
|
|
104
|
+
_defineProperty(SpinContainerRoot, "style", style);
|
|
105
|
+
_defineProperty(SpinContainerRoot, "defaultProps", {
|
|
88
106
|
size: "xxl",
|
|
89
107
|
theme: "dark",
|
|
90
108
|
duration: 200
|
|
91
109
|
});
|
|
92
|
-
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
var
|
|
96
|
-
function
|
|
97
|
-
|
|
110
|
+
_defineProperty(SpinContainerRoot, "enhance", [resolveColorEnhance()]);
|
|
111
|
+
var Overlay = /* @__PURE__ */ function(_Component2) {
|
|
112
|
+
_inherits(Overlay2, _Component2);
|
|
113
|
+
var _super2 = _createSuper(Overlay2);
|
|
114
|
+
function Overlay2() {
|
|
115
|
+
_classCallCheck(this, Overlay2);
|
|
116
|
+
return _super2.apply(this, arguments);
|
|
98
117
|
}
|
|
99
|
-
|
|
118
|
+
_createClass(Overlay2, [{
|
|
100
119
|
key: "render",
|
|
101
|
-
value: function() {
|
|
102
|
-
var
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
},
|
|
120
|
+
value: function render() {
|
|
121
|
+
var _ref2 = this.asProps, _ref5;
|
|
122
|
+
var SOverlay = Box;
|
|
123
|
+
var _this$asProps3 = this.asProps, styles = _this$asProps3.styles, theme = _this$asProps3.theme, background = _this$asProps3.background, loading = _this$asProps3.loading, duration = _this$asProps3.duration, resolveColor = _this$asProps3.resolveColor;
|
|
124
|
+
var useTheme = background ? "custom" : theme;
|
|
125
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(FadeInOut, _ref5.cn("FadeInOut", {
|
|
126
|
+
"visible": loading,
|
|
127
|
+
"duration": duration
|
|
128
|
+
}), /* @__PURE__ */ React.createElement(SOverlay, _ref5.cn("SOverlay", _objectSpread({}, assignProps({
|
|
129
|
+
"use:theme": useTheme,
|
|
130
|
+
"use:background": resolveColor(background)
|
|
131
|
+
}, _ref2)))));
|
|
110
132
|
}
|
|
111
|
-
}])
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
133
|
+
}]);
|
|
134
|
+
return Overlay2;
|
|
135
|
+
}(Component);
|
|
136
|
+
_defineProperty(Overlay, "defaultProps", function(_ref7) {
|
|
137
|
+
var size = _ref7.size, theme = _ref7.theme;
|
|
115
138
|
return {
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
size
|
|
118
|
-
theme
|
|
139
|
+
children: /* @__PURE__ */ React.createElement(Spin, {
|
|
140
|
+
size,
|
|
141
|
+
theme
|
|
119
142
|
})
|
|
120
143
|
};
|
|
121
144
|
});
|
|
122
|
-
function
|
|
123
|
-
var
|
|
124
|
-
|
|
145
|
+
function Content(props) {
|
|
146
|
+
var _ref3 = arguments[0], _ref6;
|
|
147
|
+
var SContent = Box;
|
|
148
|
+
var styles = props.styles;
|
|
149
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SContent, _ref6.cn("SContent", _objectSpread({}, assignProps({}, _ref3))));
|
|
125
150
|
}
|
|
126
|
-
var
|
|
127
|
-
Overlay
|
|
128
|
-
Content
|
|
151
|
+
var SpinContainer = createComponent(SpinContainerRoot, {
|
|
152
|
+
Overlay,
|
|
153
|
+
Content
|
|
129
154
|
});
|
|
130
155
|
export {
|
|
131
|
-
|
|
156
|
+
SpinContainer as default
|
|
132
157
|
};
|
package/lib/esm/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/spin-container",
|
|
3
3
|
"description": "Semrush SpinContainer Component",
|
|
4
|
-
"version": "16.0.0-prerelease.
|
|
4
|
+
"version": "16.0.0-prerelease.7",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/spin": "16.0.0-prerelease.
|
|
18
|
-
"@semcore/flex-box": "16.0.0-prerelease.
|
|
19
|
-
"@semcore/animation": "16.0.0-prerelease.
|
|
17
|
+
"@semcore/spin": "16.0.0-prerelease.7",
|
|
18
|
+
"@semcore/flex-box": "16.0.0-prerelease.7",
|
|
19
|
+
"@semcore/animation": "16.0.0-prerelease.7"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@semcore/base-components": "^16.0.0-prerelease.
|
|
22
|
+
"@semcore/base-components": "^16.0.0-prerelease.7"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|