@semcore/skeleton 16.0.11 → 17.0.0-prerelease.18
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/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/lib/cjs/Charts/Area.js +28 -28
- package/lib/cjs/Charts/Area.js.map +1 -1
- package/lib/cjs/Charts/Bar.js +37 -37
- package/lib/cjs/Charts/Bar.js.map +1 -1
- package/lib/cjs/Charts/Bubble.js +24 -23
- package/lib/cjs/Charts/Bubble.js.map +1 -1
- package/lib/cjs/Charts/CompactHorizontalBar.js +24 -23
- package/lib/cjs/Charts/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Charts/Donut.js +33 -33
- package/lib/cjs/Charts/Donut.js.map +1 -1
- package/lib/cjs/Charts/Histogram.js +37 -37
- package/lib/cjs/Charts/Histogram.js.map +1 -1
- package/lib/cjs/Charts/Line.js +28 -28
- package/lib/cjs/Charts/Line.js.map +1 -1
- package/lib/cjs/Charts/RadialTree.js +24 -23
- package/lib/cjs/Charts/RadialTree.js.map +1 -1
- package/lib/cjs/Charts/ScatterPlot.js +24 -23
- package/lib/cjs/Charts/ScatterPlot.js.map +1 -1
- package/lib/cjs/Charts/Venn.js +24 -23
- package/lib/cjs/Charts/Venn.js.map +1 -1
- package/lib/cjs/Charts/index.js +21 -21
- package/lib/cjs/Skeleton.js +118 -145
- package/lib/cjs/Skeleton.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +4 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/Charts/Area.js +25 -25
- package/lib/es6/Charts/Area.js.map +1 -1
- package/lib/es6/Charts/Bar.js +34 -34
- package/lib/es6/Charts/Bar.js.map +1 -1
- package/lib/es6/Charts/Bubble.js +21 -20
- package/lib/es6/Charts/Bubble.js.map +1 -1
- package/lib/es6/Charts/CompactHorizontalBar.js +21 -20
- package/lib/es6/Charts/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Charts/Donut.js +30 -30
- package/lib/es6/Charts/Donut.js.map +1 -1
- package/lib/es6/Charts/Histogram.js +34 -34
- package/lib/es6/Charts/Histogram.js.map +1 -1
- package/lib/es6/Charts/Line.js +25 -25
- package/lib/es6/Charts/Line.js.map +1 -1
- package/lib/es6/Charts/RadialTree.js +21 -20
- package/lib/es6/Charts/RadialTree.js.map +1 -1
- package/lib/es6/Charts/ScatterPlot.js +21 -20
- package/lib/es6/Charts/ScatterPlot.js.map +1 -1
- package/lib/es6/Charts/Venn.js +21 -20
- package/lib/es6/Charts/Venn.js.map +1 -1
- package/lib/es6/Skeleton.js +106 -133
- package/lib/es6/Skeleton.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/Charts/Area.mjs +27 -26
- package/lib/esm/Charts/Bar.mjs +36 -35
- package/lib/esm/Charts/Bubble.mjs +23 -22
- package/lib/esm/Charts/CompactHorizontalBar.mjs +23 -22
- package/lib/esm/Charts/Donut.mjs +32 -31
- package/lib/esm/Charts/Histogram.mjs +36 -35
- package/lib/esm/Charts/Line.mjs +27 -26
- package/lib/esm/Charts/RadialTree.mjs +23 -22
- package/lib/esm/Charts/ScatterPlot.mjs +23 -22
- package/lib/esm/Charts/Venn.mjs +23 -22
- package/lib/esm/Skeleton.mjs +110 -116
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/index.d.ts +2 -8
- package/package.json +5 -7
package/lib/esm/Skeleton.mjs
CHANGED
|
@@ -1,63 +1,54 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
-
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
import { createComponent, sstyled,
|
|
2
|
+
import { createComponent, sstyled, Component, assignProps } from "@semcore/core";
|
|
3
|
+
import { Box } from "@semcore/base-components";
|
|
10
4
|
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
11
5
|
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
12
6
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
13
|
-
import { Box } from "@semcore/flex-box";
|
|
14
7
|
import React from "react";
|
|
15
8
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
16
|
-
var _excluded = ["y", "x", "amount", "width", "styles", "forwardRef"];
|
|
17
9
|
/*!__reshadow-styles__:"./style/skeleton.shadow.css"*/
|
|
18
|
-
|
|
10
|
+
const style = (
|
|
19
11
|
/*__reshadow_css_start__*/
|
|
20
12
|
(sstyled.insert(
|
|
21
13
|
/*__inner_css_start__*/
|
|
22
|
-
"@keyframes
|
|
14
|
+
"@keyframes pulse_17nle{0%,to{opacity:1}50%{opacity:.4}}.___SSkeleton_17nle_gg_{animation-name:pulse_17nle;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:var(--durationAnim_17nle);will-change:opacity}.___SSkeletonSVG_17nle_gg_._theme_invert_17nle_gg_{fill:var(--intergalactic-skeleton-bg, rgba(224, 225, 233, 0.8))}.___SSkeletonSVG_17nle_gg_._theme_dark_17nle_gg_{fill:var(--intergalactic-skeleton-bg-invert, rgba(255, 255, 255, 0.3))}.___SText_17nle_gg_{box-sizing:border-box}@media (prefers-reduced-motion){.___SSkeleton_17nle_gg_{animation-name:none}}",
|
|
23
15
|
/*__inner_css_end__*/
|
|
24
|
-
"
|
|
16
|
+
"17nle_gg_"
|
|
25
17
|
), /*__reshadow_css_end__*/
|
|
26
18
|
{
|
|
27
|
-
"__SSkeleton": "
|
|
28
|
-
"--durationAnim": "--
|
|
29
|
-
"@pulse": "
|
|
30
|
-
"__SSkeletonSVG": "
|
|
31
|
-
"_theme_invert": "
|
|
32
|
-
"_theme_dark": "
|
|
33
|
-
"__SText": "
|
|
19
|
+
"__SSkeleton": "___SSkeleton_17nle_gg_",
|
|
20
|
+
"--durationAnim": "--durationAnim_17nle",
|
|
21
|
+
"@pulse": "pulse_17nle",
|
|
22
|
+
"__SSkeletonSVG": "___SSkeletonSVG_17nle_gg_",
|
|
23
|
+
"_theme_invert": "_theme_invert_17nle_gg_",
|
|
24
|
+
"_theme_dark": "_theme_dark_17nle_gg_",
|
|
25
|
+
"__SText": "___SText_17nle_gg_"
|
|
34
26
|
})
|
|
35
27
|
);
|
|
36
|
-
|
|
28
|
+
const MAP_COLOR_THEME = {
|
|
37
29
|
dark: "rgba(255, 255, 255, 0.3)",
|
|
38
30
|
invert: "rgba(224, 225, 233, 0.8)"
|
|
39
31
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"durationAnim": "".concat(duration, "ms"),
|
|
32
|
+
class SkeletonRoot extends Component {
|
|
33
|
+
render() {
|
|
34
|
+
var _ref = this.asProps, _ref3;
|
|
35
|
+
const SSkeleton = Box;
|
|
36
|
+
const {
|
|
37
|
+
styles,
|
|
38
|
+
duration,
|
|
39
|
+
hidden,
|
|
40
|
+
getI18nText
|
|
41
|
+
} = this.asProps;
|
|
42
|
+
if (hidden) return null;
|
|
43
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SSkeleton, _ref3.cn("SSkeleton", {
|
|
44
|
+
...assignProps({
|
|
45
|
+
"durationAnim": `${duration}ms`,
|
|
55
46
|
"role": "img",
|
|
56
47
|
"aria-label": getI18nText("loading")
|
|
57
|
-
}, _ref)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
48
|
+
}, _ref)
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
61
52
|
_defineProperty(SkeletonRoot, "displayName", "Skeleton");
|
|
62
53
|
_defineProperty(SkeletonRoot, "style", style);
|
|
63
54
|
_defineProperty(SkeletonRoot, "enhance", [i18nEnhance(localizedMessages)]);
|
|
@@ -66,71 +57,66 @@ _defineProperty(SkeletonRoot, "defaultProps", {
|
|
|
66
57
|
height: "100%",
|
|
67
58
|
duration: 2e3
|
|
68
59
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
_this = _callSuper(this, SkeletonSVG2, [props]);
|
|
74
|
-
_defineProperty(_this, "svgRef", /* @__PURE__ */ React.createRef());
|
|
60
|
+
class SkeletonSVG extends Component {
|
|
61
|
+
constructor(props) {
|
|
62
|
+
super(props);
|
|
63
|
+
_defineProperty(this, "svgRef", /* @__PURE__ */ React.createRef());
|
|
75
64
|
if (canUseDOM() && props.observeParentSize) {
|
|
76
|
-
|
|
65
|
+
this.observer = new ResizeObserver(this.handleResize.bind(this));
|
|
77
66
|
}
|
|
78
|
-
return _this;
|
|
79
67
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}, {
|
|
94
|
-
key: "handleResize",
|
|
95
|
-
value: function handleResize(data) {
|
|
96
|
-
var target = data[0].target;
|
|
97
|
-
var svg = this.svgRef.current;
|
|
98
|
-
if (target && svg) {
|
|
99
|
-
svg.setAttribute("width", "100%");
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}, {
|
|
103
|
-
key: "setContext",
|
|
104
|
-
value: function setContext() {
|
|
105
|
-
var theme = this.asProps.theme;
|
|
106
|
-
return {
|
|
107
|
-
gradientUrl: MAP_COLOR_THEME[theme]
|
|
108
|
-
};
|
|
68
|
+
componentDidMount() {
|
|
69
|
+
var _a, _b;
|
|
70
|
+
(_b = this.observer) == null ? void 0 : _b.observe((_a = this.svgRef.current) == null ? void 0 : _a.parentElement);
|
|
71
|
+
}
|
|
72
|
+
componentWillUnmount() {
|
|
73
|
+
var _a;
|
|
74
|
+
(_a = this.observer) == null ? void 0 : _a.disconnect();
|
|
75
|
+
}
|
|
76
|
+
handleResize(data) {
|
|
77
|
+
const target = data[0].target;
|
|
78
|
+
const svg = this.svgRef.current;
|
|
79
|
+
if (target && svg) {
|
|
80
|
+
svg.setAttribute("width", "100%");
|
|
109
81
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
82
|
+
}
|
|
83
|
+
setContext() {
|
|
84
|
+
const {
|
|
85
|
+
theme
|
|
86
|
+
} = this.asProps;
|
|
87
|
+
return {
|
|
88
|
+
gradientUrl: MAP_COLOR_THEME[theme]
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
var _ref2 = this.asProps, _ref4;
|
|
93
|
+
const {
|
|
94
|
+
Children,
|
|
95
|
+
styles,
|
|
96
|
+
uid,
|
|
97
|
+
theme,
|
|
98
|
+
duration
|
|
99
|
+
} = this.asProps;
|
|
100
|
+
const SSkeletonSVG = Skeleton;
|
|
101
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SSkeletonSVG, _ref4.cn("SSkeletonSVG", {
|
|
102
|
+
...assignProps({
|
|
117
103
|
"tag": "svg",
|
|
118
104
|
"ref": this.svgRef,
|
|
119
105
|
"preserveAspectRatio": "none",
|
|
120
106
|
"theme": theme,
|
|
121
|
-
"durationAnim":
|
|
122
|
-
}, _ref2)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
107
|
+
"durationAnim": `${duration}ms`
|
|
108
|
+
}, _ref2)
|
|
109
|
+
}), /* @__PURE__ */ React.createElement("defs", _ref4.cn("defs", {}), /* @__PURE__ */ React.createElement("mask", _ref4.cn("mask", {
|
|
110
|
+
"id": uid
|
|
111
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {})))), /* @__PURE__ */ React.createElement("rect", _ref4.cn("rect", {
|
|
112
|
+
"x": "0",
|
|
113
|
+
"y": "0",
|
|
114
|
+
"width": "100%",
|
|
115
|
+
"height": "100%",
|
|
116
|
+
"mask": `url(#${uid})`
|
|
117
|
+
})));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
134
120
|
_defineProperty(SkeletonSVG, "displayName", "SkeletonSVG");
|
|
135
121
|
_defineProperty(SkeletonSVG, "enhance", [uniqueIDEnhancement()]);
|
|
136
122
|
_defineProperty(SkeletonSVG, "style", style);
|
|
@@ -139,33 +125,41 @@ _defineProperty(SkeletonSVG, "defaultProps", {
|
|
|
139
125
|
duration: 2e3
|
|
140
126
|
});
|
|
141
127
|
function Text(props) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
128
|
+
const SText = Box;
|
|
129
|
+
const {
|
|
130
|
+
y = 0,
|
|
131
|
+
x = 0,
|
|
132
|
+
amount = 1,
|
|
133
|
+
width = "100%",
|
|
134
|
+
styles,
|
|
135
|
+
forwardRef,
|
|
136
|
+
...other
|
|
137
|
+
} = props;
|
|
138
|
+
const amountLine = Number(amount);
|
|
139
|
+
const renderRect = (props2) => {
|
|
146
140
|
var _ref5;
|
|
147
|
-
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref5.cn("SText",
|
|
141
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref5.cn("SText", {
|
|
148
142
|
"tag": "rect",
|
|
149
143
|
"rx": "4",
|
|
150
144
|
"ry": "4",
|
|
151
|
-
"height": "8"
|
|
152
|
-
|
|
145
|
+
"height": "8",
|
|
146
|
+
...props2
|
|
147
|
+
}));
|
|
153
148
|
};
|
|
154
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}));
|
|
149
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, [...Array(amountLine)].map((_el, index) => renderRect({
|
|
150
|
+
key: index,
|
|
151
|
+
y: y || 20 * index,
|
|
152
|
+
x,
|
|
153
|
+
ref: forwardRef,
|
|
154
|
+
width,
|
|
155
|
+
...other
|
|
156
|
+
})));
|
|
163
157
|
}
|
|
164
|
-
|
|
165
|
-
const
|
|
158
|
+
const Skeleton = createComponent(SkeletonRoot);
|
|
159
|
+
const Skeleton_default = createComponent(SkeletonSVG, {
|
|
166
160
|
Text
|
|
167
161
|
});
|
|
168
162
|
export {
|
|
169
163
|
Skeleton,
|
|
170
|
-
|
|
164
|
+
Skeleton_default as default
|
|
171
165
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BoxProps } from '@semcore/base-components';
|
|
2
|
+
import type { Intergalactic } from '@semcore/core';
|
|
2
3
|
import type { UniqueIDProps } from '@semcore/core/lib/utils/uniqueID';
|
|
3
|
-
import type { BoxProps } from '@semcore/flex-box';
|
|
4
4
|
|
|
5
|
-
/** @deprecated */
|
|
6
|
-
export interface ISkeletonProps extends SkeletonProps, UnknownProperties {}
|
|
7
5
|
export type SkeletonProps = BoxProps &
|
|
8
6
|
UniqueIDProps & {
|
|
9
7
|
/**
|
|
@@ -29,14 +27,10 @@ export type SkeletonProps = BoxProps &
|
|
|
29
27
|
observeParentSize?: boolean;
|
|
30
28
|
};
|
|
31
29
|
|
|
32
|
-
/** @deprecated */
|
|
33
|
-
export interface ISkeletonCtx extends SkeletonCtx, UnknownProperties {}
|
|
34
30
|
export type SkeletonCtx = {
|
|
35
31
|
gradientUrl: 'string';
|
|
36
32
|
};
|
|
37
33
|
|
|
38
|
-
/** @deprecated */
|
|
39
|
-
export interface ISkeletonTextProps extends SkeletonTextProps, UnknownProperties {}
|
|
40
34
|
export type SkeletonTextProps = BoxProps & {
|
|
41
35
|
/**
|
|
42
36
|
* Number of items to be returned
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/skeleton",
|
|
3
3
|
"description": "Semrush Skeleton Component",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "17.0.0-prerelease.18",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"types": "lib/types/index.d.ts",
|
|
@@ -13,11 +13,8 @@
|
|
|
13
13
|
"import": "./lib/esm/index.mjs",
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "16.0.11"
|
|
18
|
-
},
|
|
19
16
|
"peerDependencies": {
|
|
20
|
-
"@semcore/base-components": "^
|
|
17
|
+
"@semcore/base-components": "^17.0.0-prerelease.18"
|
|
21
18
|
},
|
|
22
19
|
"repository": {
|
|
23
20
|
"type": "git",
|
|
@@ -25,8 +22,9 @@
|
|
|
25
22
|
"directory": "semcore/skeleton"
|
|
26
23
|
},
|
|
27
24
|
"devDependencies": {
|
|
28
|
-
"@semcore/core": "
|
|
29
|
-
"@semcore/testing-utils": "1.0.0"
|
|
25
|
+
"@semcore/core": "17.0.0-prerelease.18",
|
|
26
|
+
"@semcore/testing-utils": "1.0.0",
|
|
27
|
+
"@semcore/base-components": "17.0.0-prerelease.18"
|
|
30
28
|
},
|
|
31
29
|
"scripts": {
|
|
32
30
|
"build": "pnpm semcore-builder --source=js && pnpm vite build"
|