@arco-design/mobile-react 2.28.2 → 2.29.1

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/grid/style/css/index.css +4 -0
  5. package/cjs/grid/style/index.less +6 -0
  6. package/cjs/index.d.ts +1 -0
  7. package/cjs/index.js +5 -1
  8. package/cjs/input/hooks.js +33 -40
  9. package/cjs/input/props.d.ts +1 -1
  10. package/cjs/skeleton/demo/style/css/mobile.css +7 -0
  11. package/cjs/skeleton/demo/style/mobile.less +13 -0
  12. package/cjs/skeleton/elements.d.ts +7 -0
  13. package/cjs/skeleton/elements.js +302 -0
  14. package/cjs/skeleton/index.d.ts +18 -0
  15. package/cjs/skeleton/index.js +100 -0
  16. package/cjs/skeleton/skeleton-context.d.ts +3 -0
  17. package/cjs/skeleton/skeleton-context.js +15 -0
  18. package/cjs/skeleton/style/css/index.css +180 -0
  19. package/cjs/skeleton/style/css/index.d.ts +3 -0
  20. package/cjs/skeleton/style/css/index.js +7 -0
  21. package/cjs/skeleton/style/index.d.ts +3 -0
  22. package/cjs/skeleton/style/index.js +7 -0
  23. package/cjs/skeleton/style/index.less +147 -0
  24. package/cjs/skeleton/type.d.ts +104 -0
  25. package/cjs/skeleton/type.js +3 -0
  26. package/cjs/style.d.ts +1 -0
  27. package/cjs/style.js +2 -0
  28. package/dist/index.js +423 -76
  29. package/dist/index.min.js +5 -5
  30. package/dist/style.css +123 -0
  31. package/dist/style.min.css +1 -1
  32. package/esm/grid/style/css/index.css +4 -0
  33. package/esm/grid/style/index.less +6 -0
  34. package/esm/index.d.ts +1 -0
  35. package/esm/index.js +1 -0
  36. package/esm/input/hooks.js +32 -40
  37. package/esm/input/props.d.ts +1 -1
  38. package/esm/skeleton/demo/style/css/mobile.css +7 -0
  39. package/esm/skeleton/demo/style/mobile.less +13 -0
  40. package/esm/skeleton/elements.d.ts +7 -0
  41. package/esm/skeleton/elements.js +281 -0
  42. package/esm/skeleton/index.d.ts +18 -0
  43. package/esm/skeleton/index.js +82 -0
  44. package/esm/skeleton/skeleton-context.d.ts +3 -0
  45. package/esm/skeleton/skeleton-context.js +5 -0
  46. package/esm/skeleton/style/css/index.css +180 -0
  47. package/esm/skeleton/style/css/index.d.ts +3 -0
  48. package/esm/skeleton/style/css/index.js +3 -0
  49. package/esm/skeleton/style/index.d.ts +3 -0
  50. package/esm/skeleton/style/index.js +3 -0
  51. package/esm/skeleton/style/index.less +147 -0
  52. package/esm/skeleton/type.d.ts +104 -0
  53. package/esm/skeleton/type.js +1 -0
  54. package/esm/style.d.ts +1 -0
  55. package/esm/style.js +1 -0
  56. package/package.json +3 -3
  57. package/tokens/app/arcodesign/default/css-variables.less +16 -0
  58. package/tokens/app/arcodesign/default/index.d.ts +16 -0
  59. package/tokens/app/arcodesign/default/index.js +17 -1
  60. package/tokens/app/arcodesign/default/index.json +190 -0
  61. package/tokens/app/arcodesign/default/index.less +16 -0
  62. package/umd/grid/style/css/index.css +4 -0
  63. package/umd/grid/style/index.less +6 -0
  64. package/umd/index.d.ts +1 -0
  65. package/umd/index.js +7 -5
  66. package/umd/input/hooks.js +36 -44
  67. package/umd/input/props.d.ts +1 -1
  68. package/umd/skeleton/demo/style/css/mobile.css +7 -0
  69. package/umd/skeleton/demo/style/mobile.less +13 -0
  70. package/umd/skeleton/elements.d.ts +7 -0
  71. package/umd/skeleton/elements.js +306 -0
  72. package/umd/skeleton/index.d.ts +18 -0
  73. package/umd/skeleton/index.js +104 -0
  74. package/umd/skeleton/skeleton-context.d.ts +3 -0
  75. package/umd/skeleton/skeleton-context.js +28 -0
  76. package/umd/skeleton/style/css/index.css +180 -0
  77. package/umd/skeleton/style/css/index.d.ts +3 -0
  78. package/umd/skeleton/style/css/index.js +15 -0
  79. package/umd/skeleton/style/index.d.ts +3 -0
  80. package/umd/skeleton/style/index.js +15 -0
  81. package/umd/skeleton/style/index.less +147 -0
  82. package/umd/skeleton/type.d.ts +104 -0
  83. package/umd/skeleton/type.js +17 -0
  84. package/umd/style.d.ts +1 -0
  85. package/umd/style.js +4 -4
@@ -0,0 +1,306 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../_helpers", "../context-provider", "./skeleton-context"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../_helpers"), require("../context-provider"), require("./skeleton-context"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global._extends, global.react, global.mobileUtils, global._helpers, global.contextProvider, global.skeletonContext);
11
+ global.elements = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _helpers, _contextProvider, _skeletonContext) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ _exports.SkeletonTitle = _exports.SkeletonParagraph = _exports.SkeletonNode = _exports.SkeletonGrid = _exports.SkeletonAvatar = void 0;
20
+ _extends2 = _interopRequireDefault(_extends2);
21
+ _react = _interopRequireWildcard(_react);
22
+
23
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
+
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
+
27
+ var calcOffset = function calcOffset(dom, useRtl) {
28
+ if (!dom) {
29
+ return 0;
30
+ }
31
+
32
+ if (useRtl) {
33
+ return dom.offsetLeft - dom.offsetTop;
34
+ }
35
+
36
+ return dom.offsetLeft + dom.offsetTop;
37
+ };
38
+
39
+ function useOffset(dom, useRtl) {
40
+ var _useState = (0, _react.useState)(),
41
+ offset = _useState[0],
42
+ setOffset = _useState[1];
43
+
44
+ var calcLayout = function calcLayout() {
45
+ var isList = Array.isArray(dom);
46
+
47
+ if (!(isList ? dom.length > 0 : dom == null ? void 0 : dom.current)) {
48
+ return;
49
+ }
50
+
51
+ setOffset(isList ? dom.map(function (item) {
52
+ return calcOffset(item, useRtl);
53
+ }) : calcOffset(dom.current, useRtl));
54
+ };
55
+
56
+ (0, _react.useEffect)(function () {
57
+ (0, _mobileUtils.nextTick)(function () {
58
+ calcLayout();
59
+ });
60
+ }, [dom, useRtl]);
61
+ (0, _helpers.useListenResize)(calcLayout);
62
+ return offset;
63
+ }
64
+
65
+ var SkeletonNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
66
+ var _props$className = props.className,
67
+ className = _props$className === void 0 ? '' : _props$className,
68
+ style = props.style,
69
+ children = props.children;
70
+
71
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
72
+ useRtl = _useContext.useRtl,
73
+ prefixCls = _useContext.prefixCls;
74
+
75
+ var _useContext2 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
76
+ backgroundColor = _useContext2.backgroundColor,
77
+ showAnimation = _useContext2.showAnimation,
78
+ animation = _useContext2.animation;
79
+
80
+ var domRef = (0, _react.useRef)(null);
81
+ var isGradientAnimation = showAnimation && animation === 'gradient';
82
+ var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
83
+ (0, _react.useImperativeHandle)(ref, function () {
84
+ return {
85
+ dom: domRef.current
86
+ };
87
+ });
88
+ return /*#__PURE__*/_react.default.createElement("div", {
89
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-node", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
90
+ style: (0, _extends2.default)({
91
+ backgroundColor: backgroundColor
92
+ }, style),
93
+ ref: domRef
94
+ }, children, isGradientAnimation && offset !== undefined && /*#__PURE__*/_react.default.createElement("div", {
95
+ className: prefixCls + "-skeleton-animation-item",
96
+ style: {
97
+ left: 0 - offset
98
+ }
99
+ }));
100
+ });
101
+ _exports.SkeletonNode = SkeletonNode;
102
+ var SkeletonTitle = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
103
+ var _props$className2 = props.className,
104
+ className = _props$className2 === void 0 ? '' : _props$className2,
105
+ style = props.style,
106
+ _props$width = props.width,
107
+ width = _props$width === void 0 ? '40%' : _props$width;
108
+
109
+ var _useContext3 = (0, _react.useContext)(_contextProvider.GlobalContext),
110
+ useRtl = _useContext3.useRtl,
111
+ prefixCls = _useContext3.prefixCls;
112
+
113
+ var _useContext4 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
114
+ backgroundColor = _useContext4.backgroundColor,
115
+ showAnimation = _useContext4.showAnimation,
116
+ animation = _useContext4.animation;
117
+
118
+ var domRef = (0, _react.useRef)(null);
119
+ var isGradientAnimation = showAnimation && animation === 'gradient';
120
+ var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
121
+ (0, _react.useImperativeHandle)(ref, function () {
122
+ return {
123
+ dom: domRef.current
124
+ };
125
+ });
126
+ return /*#__PURE__*/_react.default.createElement("div", {
127
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-title", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
128
+ style: (0, _extends2.default)({
129
+ width: width,
130
+ backgroundColor: backgroundColor
131
+ }, style),
132
+ ref: domRef
133
+ }, isGradientAnimation && offset !== undefined && /*#__PURE__*/_react.default.createElement("div", {
134
+ className: prefixCls + "-skeleton-animation-item",
135
+ style: {
136
+ left: 0 - offset
137
+ }
138
+ }));
139
+ });
140
+ _exports.SkeletonTitle = SkeletonTitle;
141
+ var SkeletonParagraph = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
142
+ var _props$className3 = props.className,
143
+ className = _props$className3 === void 0 ? '' : _props$className3,
144
+ style = props.style,
145
+ _props$rows = props.rows,
146
+ rows = _props$rows === void 0 ? 3 : _props$rows,
147
+ _props$width2 = props.width,
148
+ width = _props$width2 === void 0 ? '60%' : _props$width2;
149
+
150
+ var _useContext5 = (0, _react.useContext)(_contextProvider.GlobalContext),
151
+ useRtl = _useContext5.useRtl,
152
+ prefixCls = _useContext5.prefixCls;
153
+
154
+ var _useContext6 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
155
+ backgroundColor = _useContext6.backgroundColor,
156
+ showAnimation = _useContext6.showAnimation,
157
+ animation = _useContext6.animation;
158
+
159
+ var domRef = (0, _react.useRef)(null);
160
+ var lineDomRefs = (0, _react.useRef)([]);
161
+ var isGradientAnimation = showAnimation && animation === 'gradient';
162
+ var offsets = useOffset(isGradientAnimation ? lineDomRefs.current : undefined, useRtl);
163
+ (0, _react.useImperativeHandle)(ref, function () {
164
+ return {
165
+ dom: domRef.current
166
+ };
167
+ });
168
+
169
+ var getWidth = function getWidth(idx) {
170
+ if ((0, _mobileUtils.isArray)(width)) {
171
+ return width[idx];
172
+ }
173
+
174
+ if (rows - 1 === idx) {
175
+ return width;
176
+ }
177
+
178
+ return undefined;
179
+ };
180
+
181
+ return /*#__PURE__*/_react.default.createElement("div", {
182
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-paragraph", className),
183
+ style: style,
184
+ ref: domRef
185
+ }, Array.from(new Array(rows)).map(function (_, idx) {
186
+ return /*#__PURE__*/_react.default.createElement("div", {
187
+ key: idx,
188
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-paragraph-line", showAnimation && prefixCls + "-skeleton-animation-" + animation),
189
+ style: {
190
+ width: getWidth(idx),
191
+ backgroundColor: backgroundColor
192
+ },
193
+ ref: function ref(el) {
194
+ return el && (lineDomRefs.current[idx] = el);
195
+ }
196
+ }, isGradientAnimation && offsets !== undefined && /*#__PURE__*/_react.default.createElement("div", {
197
+ className: prefixCls + "-skeleton-animation-item",
198
+ style: {
199
+ left: 0 - (offsets[idx] || 0)
200
+ }
201
+ }));
202
+ }));
203
+ });
204
+ _exports.SkeletonParagraph = SkeletonParagraph;
205
+ var SkeletonAvatar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
206
+ var _props$className4 = props.className,
207
+ className = _props$className4 === void 0 ? '' : _props$className4,
208
+ style = props.style;
209
+
210
+ var _useContext7 = (0, _react.useContext)(_contextProvider.GlobalContext),
211
+ useRtl = _useContext7.useRtl,
212
+ prefixCls = _useContext7.prefixCls;
213
+
214
+ var _useContext8 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
215
+ backgroundColor = _useContext8.backgroundColor,
216
+ showAnimation = _useContext8.showAnimation,
217
+ animation = _useContext8.animation;
218
+
219
+ var domRef = (0, _react.useRef)(null);
220
+ var isGradientAnimation = showAnimation && animation === 'gradient';
221
+ var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
222
+ (0, _react.useImperativeHandle)(ref, function () {
223
+ return {
224
+ dom: domRef.current
225
+ };
226
+ });
227
+ return /*#__PURE__*/_react.default.createElement("div", {
228
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-avatar", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
229
+ style: (0, _extends2.default)({
230
+ backgroundColor: backgroundColor
231
+ }, style),
232
+ ref: domRef
233
+ }, isGradientAnimation && offset !== undefined && /*#__PURE__*/_react.default.createElement("div", {
234
+ className: prefixCls + "-skeleton-animation-item",
235
+ style: {
236
+ left: 0 - offset
237
+ }
238
+ }));
239
+ });
240
+ _exports.SkeletonAvatar = SkeletonAvatar;
241
+ var SkeletonGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
242
+ var _props$className5 = props.className,
243
+ className = _props$className5 === void 0 ? '' : _props$className5,
244
+ style = props.style,
245
+ _props$columns = props.columns,
246
+ columns = _props$columns === void 0 ? 4 : _props$columns;
247
+
248
+ var _useContext9 = (0, _react.useContext)(_contextProvider.GlobalContext),
249
+ useRtl = _useContext9.useRtl,
250
+ prefixCls = _useContext9.prefixCls;
251
+
252
+ var _useContext10 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
253
+ backgroundColor = _useContext10.backgroundColor,
254
+ showAnimation = _useContext10.showAnimation,
255
+ animation = _useContext10.animation;
256
+
257
+ var domRef = (0, _react.useRef)(null);
258
+ var iconDomRefs = (0, _react.useRef)([]);
259
+ var textDomRefs = (0, _react.useRef)([]);
260
+ var isGradientAnimation = showAnimation && animation === 'gradient';
261
+ var iconOffsets = useOffset(isGradientAnimation ? iconDomRefs.current : undefined, useRtl);
262
+ var textOffsets = useOffset(isGradientAnimation ? textDomRefs.current : undefined, useRtl);
263
+ (0, _react.useImperativeHandle)(ref, function () {
264
+ return {
265
+ dom: domRef.current
266
+ };
267
+ });
268
+ return /*#__PURE__*/_react.default.createElement("div", {
269
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-grid", className),
270
+ style: style,
271
+ ref: domRef
272
+ }, Array.from(new Array(columns)).map(function (_, idx) {
273
+ return /*#__PURE__*/_react.default.createElement("div", {
274
+ key: idx,
275
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-grid-item")
276
+ }, /*#__PURE__*/_react.default.createElement("div", {
277
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-grid-icon", showAnimation && prefixCls + "-skeleton-animation-" + animation),
278
+ style: {
279
+ backgroundColor: backgroundColor
280
+ },
281
+ ref: function ref(el) {
282
+ return el && (iconDomRefs.current[idx] = el);
283
+ }
284
+ }, isGradientAnimation && iconOffsets !== undefined && /*#__PURE__*/_react.default.createElement("div", {
285
+ className: prefixCls + "-skeleton-animation-item",
286
+ style: {
287
+ left: 0 - ((iconOffsets == null ? void 0 : iconOffsets[idx]) || 0)
288
+ }
289
+ })), /*#__PURE__*/_react.default.createElement("div", {
290
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-grid-text", showAnimation && prefixCls + "-skeleton-animation-" + animation),
291
+ style: {
292
+ backgroundColor: backgroundColor
293
+ },
294
+ ref: function ref(el) {
295
+ return el && (textDomRefs.current[idx] = el);
296
+ }
297
+ }, isGradientAnimation && textOffsets !== undefined && /*#__PURE__*/_react.default.createElement("div", {
298
+ className: prefixCls + "-skeleton-animation-item",
299
+ style: {
300
+ left: 0 - ((textOffsets == null ? void 0 : textOffsets[idx]) || 0)
301
+ }
302
+ })));
303
+ }));
304
+ });
305
+ _exports.SkeletonGrid = SkeletonGrid;
306
+ });
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { SkeletonProps, SkeletonRef } from './type';
3
+ declare const _default: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<SkeletonRef>> & {
4
+ Node: React.ForwardRefExoticComponent<import("./type").SkeletonNodeProps & React.RefAttributes<SkeletonRef>>;
5
+ Title: React.ForwardRefExoticComponent<import("./type").SkeletonTitleProps & React.RefAttributes<SkeletonRef>>;
6
+ Paragraph: React.ForwardRefExoticComponent<import("./type").SkeletonParagraphProps & React.RefAttributes<SkeletonRef>>;
7
+ Avatar: React.ForwardRefExoticComponent<import("./type").SkeletonAvatarProps & React.RefAttributes<SkeletonRef>>;
8
+ Grid: React.ForwardRefExoticComponent<import("./type").SkeletonGridProps & React.RefAttributes<SkeletonRef>>;
9
+ };
10
+ /**
11
+ * 在内容加载过程中展示一组占位图形。
12
+ * @en Display a set of placeholder graphics during content loading
13
+ * @type 信息展示
14
+ * @type_en Data Display
15
+ * @name 骨架屏
16
+ * @name_en Skeleton
17
+ */
18
+ export default _default;
@@ -0,0 +1,104 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "@babel/runtime/helpers/extends", "react", "@arco-design/mobile-utils", "../context-provider", "./elements", "./skeleton-context"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("@babel/runtime/helpers/extends"), require("react"), require("@arco-design/mobile-utils"), require("../context-provider"), require("./elements"), require("./skeleton-context"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global._extends, global.react, global.mobileUtils, global.contextProvider, global.elements, global.skeletonContext);
11
+ global.index = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends2, _react, _mobileUtils, _contextProvider, _elements, _skeletonContext) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ _exports.default = void 0;
20
+ _extends2 = _interopRequireDefault(_extends2);
21
+ _react = _interopRequireWildcard(_react);
22
+
23
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
24
+
25
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
+
27
+ function getComponentProps(prop) {
28
+ if (prop && typeof prop === 'object') {
29
+ return prop;
30
+ }
31
+
32
+ return {};
33
+ }
34
+
35
+ var Skeleton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
36
+ var _cls;
37
+
38
+ var _props$className = props.className,
39
+ className = _props$className === void 0 ? '' : _props$className,
40
+ style = props.style,
41
+ children = props.children,
42
+ _props$title = props.title,
43
+ title = _props$title === void 0 ? true : _props$title,
44
+ _props$paragraph = props.paragraph,
45
+ paragraph = _props$paragraph === void 0 ? true : _props$paragraph,
46
+ _props$avatar = props.avatar,
47
+ avatar = _props$avatar === void 0 ? false : _props$avatar,
48
+ grid = props.grid,
49
+ _props$showAnimation = props.showAnimation,
50
+ showAnimation = _props$showAnimation === void 0 ? true : _props$showAnimation,
51
+ _props$animation = props.animation,
52
+ animation = _props$animation === void 0 ? 'gradient' : _props$animation,
53
+ animationGradientColor = props.animationGradientColor,
54
+ backgroundColor = props.backgroundColor;
55
+ var domRef = (0, _react.useRef)(null);
56
+
57
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
58
+ prefixCls = _useContext.prefixCls;
59
+
60
+ (0, _react.useImperativeHandle)(ref, function () {
61
+ return {
62
+ dom: domRef.current
63
+ };
64
+ });
65
+ var isGrid = !!grid;
66
+ var hasTitle = !!title;
67
+ var hasParagraph = !!paragraph;
68
+ var hasAvatar = !!avatar;
69
+ var content = isGrid ? /*#__PURE__*/_react.default.createElement(_elements.SkeletonGrid, getComponentProps(grid)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, hasAvatar && /*#__PURE__*/_react.default.createElement(_elements.SkeletonAvatar, getComponentProps(avatar)), (hasTitle || hasParagraph) && /*#__PURE__*/_react.default.createElement("div", {
70
+ className: prefixCls + "-skeleton-content"
71
+ }, hasTitle && /*#__PURE__*/_react.default.createElement(_elements.SkeletonTitle, getComponentProps(title)), hasParagraph && /*#__PURE__*/_react.default.createElement(_elements.SkeletonParagraph, getComponentProps(paragraph))));
72
+ return /*#__PURE__*/_react.default.createElement("div", {
73
+ className: (0, _mobileUtils.cls)(prefixCls + "-skeleton", (_cls = {}, _cls[prefixCls + "-skeleton-with-avatar"] = hasAvatar, _cls), className),
74
+ style: (0, _extends2.default)({
75
+ color: animationGradientColor
76
+ }, style),
77
+ ref: domRef
78
+ }, /*#__PURE__*/_react.default.createElement(_skeletonContext.SkeletonContext.Provider, {
79
+ value: {
80
+ showAnimation: showAnimation,
81
+ animation: animation,
82
+ backgroundColor: backgroundColor
83
+ }
84
+ }, content, children));
85
+ });
86
+ /**
87
+ * 在内容加载过程中展示一组占位图形。
88
+ * @en Display a set of placeholder graphics during content loading
89
+ * @type 信息展示
90
+ * @type_en Data Display
91
+ * @name 骨架屏
92
+ * @name_en Skeleton
93
+ */
94
+
95
+ var _default = (0, _mobileUtils.componentWrapper)(Skeleton, {
96
+ Node: _elements.SkeletonNode,
97
+ Title: _elements.SkeletonTitle,
98
+ Paragraph: _elements.SkeletonParagraph,
99
+ Avatar: _elements.SkeletonAvatar,
100
+ Grid: _elements.SkeletonGrid
101
+ });
102
+
103
+ _exports.default = _default;
104
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { SkeletonContextParams } from './type';
3
+ export declare const SkeletonContext: React.Context<SkeletonContextParams>;
@@ -0,0 +1,28 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["exports", "react"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(exports, require("react"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(mod.exports, global.react);
11
+ global.skeletonContext = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react) {
14
+ "use strict";
15
+
16
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
+
18
+ _exports.__esModule = true;
19
+ _exports.SkeletonContext = void 0;
20
+ _react = _interopRequireDefault(_react);
21
+
22
+ var SkeletonContext = /*#__PURE__*/_react.default.createContext({
23
+ showAnimation: true,
24
+ animation: 'gradient'
25
+ });
26
+
27
+ _exports.SkeletonContext = SkeletonContext;
28
+ });
@@ -0,0 +1,180 @@
1
+ .arco-skeleton {
2
+ position: relative;
3
+ color: rgba(255, 255, 255, 0.6) ;
4
+ }
5
+ .arco-skeleton-title {
6
+ height: 0.32rem ;
7
+ }
8
+ .arco-skeleton-paragraph-line {
9
+ width: 100%;
10
+ height: 0.32rem ;
11
+ }
12
+ .arco-skeleton-paragraph-line + .arco-skeleton-paragraph-line {
13
+ margin-top: 0.24rem ;
14
+ }
15
+ .arco-skeleton-avatar.arco-skeleton-item {
16
+ width: 0.64rem ;
17
+ height: 0.64rem ;
18
+ border-radius: 100%;
19
+ -webkit-transform: translateZ(0);
20
+ transform: translateZ(0);
21
+ }
22
+ .arco-skeleton-content {
23
+ width: 100%;
24
+ }
25
+ .arco-skeleton-content .arco-skeleton-title + .arco-skeleton-paragraph {
26
+ margin-top: 0.4rem ;
27
+ }
28
+ .arco-skeleton-with-avatar {
29
+ display: -webkit-box;
30
+ display: -webkit-flex;
31
+ display: flex;
32
+ -webkit-box-align: start;
33
+ -webkit-align-items: flex-start;
34
+ align-items: flex-start;
35
+ }
36
+ .arco-skeleton-with-avatar .arco-skeleton-avatar {
37
+ -webkit-box-flex: 0;
38
+ -webkit-flex: none;
39
+ flex: none;
40
+ }
41
+ .arco-skeleton-with-avatar .arco-skeleton-content .arco-skeleton-title {
42
+ margin-top: 0.16rem ;
43
+ }
44
+ .arco-skeleton-with-avatar .arco-skeleton-avatar + .arco-skeleton-content {
45
+ margin-left: 0.16rem ;
46
+ }
47
+ [dir="rtl"] .arco-skeleton-with-avatar .arco-skeleton-avatar + .arco-skeleton-content {
48
+ margin-left: initial;
49
+ margin-right: 0.16rem ;
50
+ }
51
+ .arco-skeleton-grid {
52
+ display: -webkit-box;
53
+ display: -webkit-flex;
54
+ display: flex;
55
+ -webkit-box-pack: justify;
56
+ -webkit-justify-content: space-between;
57
+ justify-content: space-between;
58
+ width: 100%;
59
+ }
60
+ .arco-skeleton-grid-item {
61
+ display: -webkit-box;
62
+ display: -webkit-flex;
63
+ display: flex;
64
+ -webkit-box-orient: vertical;
65
+ -webkit-box-direction: normal;
66
+ -webkit-flex-direction: column;
67
+ flex-direction: column;
68
+ -webkit-box-align: center;
69
+ -webkit-align-items: center;
70
+ align-items: center;
71
+ }
72
+ .arco-skeleton-grid-icon {
73
+ width: 0.64rem ;
74
+ height: 0.64rem ;
75
+ }
76
+ .arco-skeleton-grid-text {
77
+ margin-top: 0.16rem ;
78
+ width: 1.28rem ;
79
+ height: 0.32rem ;
80
+ }
81
+ .arco-skeleton-node {
82
+ display: inline-block;
83
+ }
84
+ .arco-skeleton-item {
85
+ position: relative;
86
+ overflow: hidden;
87
+ border-radius: 0 ;
88
+ background-color: #F2F3F5 ;
89
+ }
90
+ .arco-skeleton-animation-item {
91
+ position: absolute;
92
+ width: 100vw;
93
+ height: 100%;
94
+ top: 0;
95
+ left: 0;
96
+ background-image: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 35%, currentColor 50%, rgba(255, 255, 255, 0) 65%);
97
+ background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 35%, currentColor 50%, rgba(255, 255, 255, 0) 65%);
98
+ -webkit-transform-origin: top left;
99
+ transform-origin: top left;
100
+ -webkit-animation-name: skeleton-gradient;
101
+ animation-name: skeleton-gradient;
102
+ -webkit-animation-iteration-count: infinite;
103
+ animation-iteration-count: infinite;
104
+ -webkit-animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1) ;
105
+ animation-timing-function: cubic-bezier(0.42, 0, 0.58, 1) ;
106
+ -webkit-animation-duration: 1.5s ;
107
+ animation-duration: 1.5s ;
108
+ }
109
+ [dir="rtl"] .arco-skeleton-animation-item {
110
+ -webkit-animation-name: skeleton-gradient-reverse;
111
+ animation-name: skeleton-gradient-reverse;
112
+ }
113
+ .arco-skeleton-animation-breath {
114
+ -webkit-animation: skeleton-breath linear infinite;
115
+ animation: skeleton-breath linear infinite;
116
+ -webkit-animation-duration: 1.5s ;
117
+ animation-duration: 1.5s ;
118
+ }
119
+ @-webkit-keyframes skeleton-gradient {
120
+ 0% {
121
+ -webkit-transform: translateX(-65%) skewX(-45deg);
122
+ transform: translateX(-65%) skewX(-45deg);
123
+ }
124
+ 100% {
125
+ -webkit-transform: translateX(135%) skewX(-45deg);
126
+ transform: translateX(135%) skewX(-45deg);
127
+ }
128
+ }
129
+ @keyframes skeleton-gradient {
130
+ 0% {
131
+ -webkit-transform: translateX(-65%) skewX(-45deg);
132
+ transform: translateX(-65%) skewX(-45deg);
133
+ }
134
+ 100% {
135
+ -webkit-transform: translateX(135%) skewX(-45deg);
136
+ transform: translateX(135%) skewX(-45deg);
137
+ }
138
+ }
139
+ @-webkit-keyframes skeleton-gradient-reverse {
140
+ 0% {
141
+ -webkit-transform: translateX(65%) skewX(45deg);
142
+ transform: translateX(65%) skewX(45deg);
143
+ }
144
+ 100% {
145
+ -webkit-transform: translateX(-135%) skewX(45deg);
146
+ transform: translateX(-135%) skewX(45deg);
147
+ }
148
+ }
149
+ @keyframes skeleton-gradient-reverse {
150
+ 0% {
151
+ -webkit-transform: translateX(65%) skewX(45deg);
152
+ transform: translateX(65%) skewX(45deg);
153
+ }
154
+ 100% {
155
+ -webkit-transform: translateX(-135%) skewX(45deg);
156
+ transform: translateX(-135%) skewX(45deg);
157
+ }
158
+ }
159
+ @-webkit-keyframes skeleton-breath {
160
+ 0% {
161
+ opacity: 1;
162
+ }
163
+ 50% {
164
+ opacity: 0.4 ;
165
+ }
166
+ 100% {
167
+ opacity: 1;
168
+ }
169
+ }
170
+ @keyframes skeleton-breath {
171
+ 0% {
172
+ opacity: 1;
173
+ }
174
+ 50% {
175
+ opacity: 0.4 ;
176
+ }
177
+ 100% {
178
+ opacity: 1;
179
+ }
180
+ }
@@ -0,0 +1,3 @@
1
+ import '../../../../style/css/public.css';
2
+ import '../../../avatar/style/css';
3
+ import './index.css';
@@ -0,0 +1,15 @@
1
+ (function (global, factory) {
2
+ if (typeof define === "function" && define.amd) {
3
+ define(["../../../../style/css/public.css", "../../../avatar/style/css", "./index.css"], factory);
4
+ } else if (typeof exports !== "undefined") {
5
+ factory(require("../../../../style/css/public.css"), require("../../../avatar/style/css"), require("./index.css"));
6
+ } else {
7
+ var mod = {
8
+ exports: {}
9
+ };
10
+ factory(global._public, global.style, global.index);
11
+ global.index = mod.exports;
12
+ }
13
+ })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_public, _style, _index) {
14
+ "use strict";
15
+ });
@@ -0,0 +1,3 @@
1
+ import '../../../style/public.less';
2
+ import '../../avatar/style';
3
+ import './index.less';