@trionesdev/antd-mobile-base-react 0.0.2-beta.16 → 0.0.2-beta.17

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 (110) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +23 -23
  3. package/dist/Alert/style.scss +69 -69
  4. package/dist/Avatar/avatar.d.ts +2 -2
  5. package/dist/Avatar/avatar.js +1 -1
  6. package/dist/Avatar/style.scss +17 -17
  7. package/dist/Badge/style.scss +100 -100
  8. package/dist/Card/style.scss +35 -35
  9. package/dist/CascaderView/style.scss +22 -22
  10. package/dist/Cell/CellGroup.js +25 -8
  11. package/dist/Cell/cell.js +20 -37
  12. package/dist/Cell/context.d.ts +4 -2
  13. package/dist/Cell/styles.scss +81 -52
  14. package/dist/Cell/types.d.ts +6 -4
  15. package/dist/Checkbox/checkbox-group.js +1 -2
  16. package/dist/Checkbox/index.scss +165 -165
  17. package/dist/ConfigProvider/config-provider.d.ts +1 -0
  18. package/dist/DemoBlock/index.scss +20 -20
  19. package/dist/DemoDescription/index.scss +3 -3
  20. package/dist/Descriptions/style.scss +65 -65
  21. package/dist/Divider/divider.d.ts +1 -1
  22. package/dist/Divider/divider.js +5 -3
  23. package/dist/Divider/style.scss +62 -62
  24. package/dist/Ellipsis/style.scss +13 -13
  25. package/dist/Empty/style.scss +29 -29
  26. package/dist/ErrorBlock/demo/base.js +2 -2
  27. package/dist/ErrorBlock/style.scss +62 -62
  28. package/dist/Footer/style.scss +55 -55
  29. package/dist/Form/ErrorList.d.ts +4 -0
  30. package/dist/Form/ErrorList.js +9 -0
  31. package/dist/Form/context.d.ts +4 -2
  32. package/dist/Form/context.js +2 -1
  33. package/dist/Form/form.d.ts +24 -6
  34. package/dist/Form/form.js +22 -11
  35. package/dist/Form/hooks/useForm.js +1 -8
  36. package/dist/Form/hooks/useFormContext.js +1 -2
  37. package/dist/Form/index.d.ts +6 -3
  38. package/dist/Form/index.js +4 -1
  39. package/dist/Form/styles.scss +11 -0
  40. package/dist/Form/types.d.ts +2 -1
  41. package/dist/FormCell/FormCell.d.ts +21 -0
  42. package/dist/FormCell/FormCell.js +56 -0
  43. package/dist/FormCell/index.d.ts +4 -0
  44. package/dist/FormCell/index.js +3 -0
  45. package/dist/FormCell/styles.scss +103 -0
  46. package/dist/Grid/style.scss +17 -17
  47. package/dist/Icon/demo/base.js +2 -2
  48. package/dist/InputNumber/style.scss +100 -100
  49. package/dist/Loading/DotLoading.d.ts +8 -0
  50. package/dist/Loading/DotLoading.js +33 -0
  51. package/dist/Loading/SpinLoading.js +70 -0
  52. package/dist/Loading/dot-loading.scss +72 -0
  53. package/dist/Loading/index.d.ts +5 -0
  54. package/dist/Loading/index.js +3 -0
  55. package/dist/{SpinLoading → Loading}/spin-loading.scss +39 -40
  56. package/dist/NavBar/style.scss +64 -64
  57. package/dist/NoticeBar/style.scss +130 -130
  58. package/dist/PageIndicator/style.scss +59 -59
  59. package/dist/Progress/Progress.js +1 -1
  60. package/dist/Progress/ProgressCircle.js +5 -2
  61. package/dist/Progress/ProgressLine.js +2 -2
  62. package/dist/Progress/style.scss +33 -33
  63. package/dist/Progress/types.d.ts +2 -2
  64. package/dist/Radio/style.scss +154 -141
  65. package/dist/Rate/style.scss +37 -37
  66. package/dist/Result/demo/base.js +2 -2
  67. package/dist/Result/style.scss +73 -73
  68. package/dist/SafeArea/style.scss +20 -20
  69. package/dist/Scaffold/style.scss +17 -17
  70. package/dist/Segmented/style.scss +75 -75
  71. package/dist/Skeleton/Skeleton.d.ts +80 -21
  72. package/dist/Skeleton/Skeleton.js +248 -57
  73. package/dist/Skeleton/index.d.ts +3 -1
  74. package/dist/Skeleton/index.js +2 -1
  75. package/dist/Skeleton/style.scss +215 -48
  76. package/dist/Space/space.js +12 -9
  77. package/dist/Space/style.scss +101 -80
  78. package/dist/Stepper/stepper.js +2 -1
  79. package/dist/Stepper/style.scss +100 -100
  80. package/dist/Steps/HorizontalSteps.js +5 -2
  81. package/dist/Steps/VerticalSteps.js +5 -2
  82. package/dist/Steps/style.scss +153 -153
  83. package/dist/Steps/types.d.ts +2 -0
  84. package/dist/Switch/style.scss +127 -128
  85. package/dist/Switch/switch.d.ts +2 -0
  86. package/dist/Switch/switch.js +6 -5
  87. package/dist/TabBar/demo/base.js +2 -2
  88. package/dist/TabBar/index.scss +37 -37
  89. package/dist/Tabs/style.scss +108 -108
  90. package/dist/Tag/style.scss +110 -109
  91. package/dist/Tag/tag.d.ts +1 -1
  92. package/dist/Tag/tag.js +1 -1
  93. package/dist/WaterMark/style.scss +17 -17
  94. package/dist/index.d.ts +9 -4
  95. package/dist/index.js +4 -2
  96. package/dist/style/css-variable.scss +6 -6
  97. package/dist/style/style.scss +52 -52
  98. package/dist/style/theme-dark.scss +24 -24
  99. package/dist/style/theme-default.scss +54 -54
  100. package/dist/style/variable.scss +180 -173
  101. package/dist/types.d.ts +6 -1
  102. package/dist/utils/type.js +36 -36
  103. package/dist/utils/with-default-props.js +4 -4
  104. package/package.json +4 -7
  105. package/dist/SpinLoading/index.d.ts +0 -3
  106. package/dist/SpinLoading/index.js +0 -2
  107. package/dist/SpinLoading/spin-loading.js +0 -59
  108. package/dist/Tabs/demo/base.d.ts +0 -3
  109. package/dist/Tabs/demo/base.js +0 -59
  110. /package/dist/{SpinLoading/spin-loading.d.ts → Loading/SpinLoading.d.ts} +0 -0
@@ -1,72 +1,263 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ import classNames from 'classnames';
7
9
  import React from 'react';
8
10
  import "./style.scss";
9
- export var Skeleton = function Skeleton(_ref) {
10
- var _ref$loading = _ref.loading,
11
- loading = _ref$loading === void 0 ? true : _ref$loading,
12
- _ref$type = _ref.type,
13
- type = _ref$type === void 0 ? 'text' : _ref$type,
14
- width = _ref.width,
15
- height = _ref.height,
16
- radius = _ref.radius,
17
- _ref$rows = _ref.rows,
18
- rows = _ref$rows === void 0 ? 1 : _ref$rows,
19
- _ref$animated = _ref.animated,
20
- animated = _ref$animated === void 0 ? true : _ref$animated,
21
- _ref$className = _ref.className,
22
- className = _ref$className === void 0 ? '' : _ref$className,
11
+ var prefixCls = 'triones-antm-skeleton';
12
+
13
+ /** 简单块模式:与历史 API 兼容 */
14
+
15
+ /** 使用 px,保证 H5 / 文档站点可渲染(浏览器不支持 rpx) */
16
+ var sizeToPx = {
17
+ small: 32,
18
+ medium: 44,
19
+ large: 56
20
+ };
21
+ var inputHeightPx = {
22
+ small: 24,
23
+ medium: 32,
24
+ large: 40
25
+ };
26
+ var buttonSizePx = {
27
+ small: 28,
28
+ medium: 32,
29
+ large: 36
30
+ };
31
+ function toCssSize(v) {
32
+ if (v === undefined) return undefined;
33
+ return typeof v === 'number' ? "".concat(v, "px") : v;
34
+ }
35
+ function normalizeActive(active, animated) {
36
+ if (active !== undefined) return active;
37
+ if (animated !== undefined) return animated;
38
+ return true;
39
+ }
40
+ export var SkeletonAvatar = function SkeletonAvatar(_ref) {
41
+ var className = _ref.className,
23
42
  style = _ref.style,
24
- children = _ref.children,
25
- _ref$round = _ref.round,
26
- round = _ref$round === void 0 ? false : _ref$round;
27
- if (!loading || children) {
28
- return /*#__PURE__*/React.createElement(React.Fragment, null, children);
29
- }
30
- var getSkeletonStyle = function getSkeletonStyle() {
31
- var style = {};
32
- if (width !== undefined) {
33
- style.width = typeof width === 'number' ? "".concat(width, "px") : width;
43
+ _ref$shape = _ref.shape,
44
+ shape = _ref$shape === void 0 ? 'circle' : _ref$shape,
45
+ _ref$size = _ref.size,
46
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
47
+ _ref$active = _ref.active,
48
+ active = _ref$active === void 0 ? true : _ref$active;
49
+ var dim = typeof size === 'number' ? "".concat(size, "px") : "".concat(sizeToPx[size], "px");
50
+ return /*#__PURE__*/React.createElement("div", {
51
+ className: classNames("".concat(prefixCls, "-avatar"), "".concat(prefixCls, "-avatar-").concat(shape), _defineProperty({}, "".concat(prefixCls, "-element-active"), active), className),
52
+ style: _objectSpread({
53
+ width: dim,
54
+ height: dim
55
+ }, style)
56
+ });
57
+ };
58
+ export var SkeletonTitle = function SkeletonTitle(_ref2) {
59
+ var className = _ref2.className,
60
+ style = _ref2.style,
61
+ width = _ref2.width,
62
+ _ref2$active = _ref2.active,
63
+ active = _ref2$active === void 0 ? true : _ref2$active;
64
+ return /*#__PURE__*/React.createElement("div", {
65
+ className: classNames("".concat(prefixCls, "-title"), _defineProperty({}, "".concat(prefixCls, "-element-active"), active), className),
66
+ style: _objectSpread({
67
+ width: width !== undefined ? toCssSize(width) : undefined
68
+ }, style)
69
+ });
70
+ };
71
+ export var SkeletonParagraph = function SkeletonParagraph(_ref3) {
72
+ var className = _ref3.className,
73
+ style = _ref3.style,
74
+ _ref3$rows = _ref3.rows,
75
+ rows = _ref3$rows === void 0 ? 3 : _ref3$rows,
76
+ width = _ref3.width,
77
+ _ref3$active = _ref3.active,
78
+ active = _ref3$active === void 0 ? true : _ref3$active;
79
+ var list = Array.from({
80
+ length: rows
81
+ }, function (_, i) {
82
+ var w;
83
+ if (Array.isArray(width)) {
84
+ var _width$i;
85
+ var raw = (_width$i = width[i]) !== null && _width$i !== void 0 ? _width$i : width[width.length - 1];
86
+ w = raw !== undefined ? toCssSize(raw) : undefined;
87
+ } else if (width !== undefined && i === rows - 1) {
88
+ w = toCssSize(width);
34
89
  }
35
- if (height !== undefined) {
36
- style.height = typeof height === 'number' ? "".concat(height, "px") : height;
90
+ if (w === undefined && i === rows - 1) {
91
+ w = '62%';
37
92
  }
38
- if (type === 'circle') {
39
- style.borderRadius = '50%';
40
- if (radius !== undefined) {
41
- style.width = typeof radius === 'number' ? "".concat(radius, "px") : radius;
42
- style.height = typeof radius === 'number' ? "".concat(radius, "px") : radius;
43
- }
44
- } else if (round) {
45
- style.borderRadius = '8px';
46
- } else if (radius !== undefined) {
47
- style.borderRadius = typeof radius === 'number' ? "".concat(radius, "px") : radius;
93
+ return /*#__PURE__*/React.createElement("div", {
94
+ key: i,
95
+ className: classNames("".concat(prefixCls, "-paragraph-line"), _defineProperty({}, "".concat(prefixCls, "-element-active"), active)),
96
+ style: w ? {
97
+ width: w
98
+ } : undefined
99
+ });
100
+ });
101
+ return /*#__PURE__*/React.createElement("div", {
102
+ className: classNames("".concat(prefixCls, "-paragraph"), className),
103
+ style: style
104
+ }, list);
105
+ };
106
+ export var SkeletonInput = function SkeletonInput(_ref4) {
107
+ var className = _ref4.className,
108
+ style = _ref4.style,
109
+ _ref4$size = _ref4.size,
110
+ size = _ref4$size === void 0 ? 'medium' : _ref4$size,
111
+ _ref4$active = _ref4.active,
112
+ active = _ref4$active === void 0 ? true : _ref4$active;
113
+ return /*#__PURE__*/React.createElement("div", {
114
+ className: classNames("".concat(prefixCls, "-input"), _defineProperty({}, "".concat(prefixCls, "-element-active"), active), className),
115
+ style: _objectSpread({
116
+ height: "".concat(inputHeightPx[size], "px")
117
+ }, style)
118
+ });
119
+ };
120
+ export var SkeletonButton = function SkeletonButton(_ref5) {
121
+ var className = _ref5.className,
122
+ style = _ref5.style,
123
+ _ref5$size = _ref5.size,
124
+ size = _ref5$size === void 0 ? 'medium' : _ref5$size,
125
+ _ref5$shape = _ref5.shape,
126
+ shape = _ref5$shape === void 0 ? 'default' : _ref5$shape,
127
+ _ref5$block = _ref5.block,
128
+ block = _ref5$block === void 0 ? false : _ref5$block,
129
+ _ref5$active = _ref5.active,
130
+ active = _ref5$active === void 0 ? true : _ref5$active;
131
+ return /*#__PURE__*/React.createElement("div", {
132
+ className: classNames("".concat(prefixCls, "-button"), "".concat(prefixCls, "-button-").concat(shape), _defineProperty(_defineProperty({}, "".concat(prefixCls, "-button-block"), block), "".concat(prefixCls, "-element-active"), active), className),
133
+ style: _objectSpread({
134
+ width: shape === 'circle' ? "".concat(buttonSizePx[size], "px") : undefined,
135
+ height: "".concat(buttonSizePx[size], "px")
136
+ }, style)
137
+ });
138
+ };
139
+ function renderComposed(props, showActive, round) {
140
+ var _props$avatar = props.avatar,
141
+ avatarProp = _props$avatar === void 0 ? false : _props$avatar,
142
+ _props$title = props.title,
143
+ titleProp = _props$title === void 0 ? true : _props$title,
144
+ _props$paragraph = props.paragraph,
145
+ paragraphProp = _props$paragraph === void 0 ? true : _props$paragraph,
146
+ className = props.className,
147
+ style = props.style;
148
+ var avatarCfg = avatarProp === true ? {} : avatarProp === false ? null : avatarProp;
149
+ var titleCfg = titleProp === true ? {} : titleProp === false ? null : titleProp;
150
+ var paragraphCfg = paragraphProp === true ? {
151
+ rows: 3
152
+ } : paragraphProp === false ? null : paragraphProp;
153
+ var hasAvatar = Boolean(avatarCfg);
154
+ var hasTitle = Boolean(titleCfg);
155
+ var hasParagraph = Boolean(paragraphCfg);
156
+ if (!hasAvatar && !hasTitle && !hasParagraph) {
157
+ return null;
158
+ }
159
+ var titleProps = titleCfg && _typeof(titleCfg) === 'object' ? titleCfg : {};
160
+ var paragraphProps = paragraphCfg && _typeof(paragraphCfg) === 'object' ? paragraphCfg : {};
161
+ var avatarProps = avatarCfg && _typeof(avatarCfg) === 'object' ? avatarCfg : {};
162
+ var titleActive = titleProps.active === false ? false : showActive;
163
+ var paragraphActive = paragraphProps.active === false ? false : showActive;
164
+ var avatarActive = avatarProps.active === false ? false : showActive;
165
+ var section = hasTitle || hasParagraph ? /*#__PURE__*/React.createElement("div", {
166
+ className: "".concat(prefixCls, "-section")
167
+ }, hasTitle && /*#__PURE__*/React.createElement(SkeletonTitle, _extends({}, titleProps, {
168
+ active: titleActive
169
+ })), hasParagraph && /*#__PURE__*/React.createElement(SkeletonParagraph, _extends({}, paragraphProps, {
170
+ active: paragraphActive
171
+ }))) : null;
172
+ if (hasAvatar) {
173
+ return /*#__PURE__*/React.createElement("div", {
174
+ className: classNames("".concat(prefixCls), "".concat(prefixCls, "-with-avatar"), _defineProperty({}, "".concat(prefixCls, "-round"), round), className),
175
+ style: style
176
+ }, /*#__PURE__*/React.createElement("div", {
177
+ className: "".concat(prefixCls, "-header")
178
+ }, /*#__PURE__*/React.createElement(SkeletonAvatar, _extends({}, avatarProps, {
179
+ active: avatarActive
180
+ }))), section);
181
+ }
182
+ return /*#__PURE__*/React.createElement("div", {
183
+ className: classNames(prefixCls, _defineProperty({}, "".concat(prefixCls, "-round"), round), className),
184
+ style: style
185
+ }, section);
186
+ }
187
+ function renderBlock(props, showActive) {
188
+ var _props$type = props.type,
189
+ type = _props$type === void 0 ? 'text' : _props$type,
190
+ width = props.width,
191
+ height = props.height,
192
+ radius = props.radius,
193
+ _props$rows = props.rows,
194
+ rows = _props$rows === void 0 ? 1 : _props$rows,
195
+ round = props.round,
196
+ className = props.className,
197
+ style = props.style;
198
+ var baseStyle = {};
199
+ if (width !== undefined) baseStyle.width = toCssSize(width);
200
+ if (height !== undefined) baseStyle.height = toCssSize(height);
201
+ if (type === 'circle') {
202
+ var d = radius !== undefined ? toCssSize(radius) : undefined;
203
+ if (d) {
204
+ baseStyle.width = d;
205
+ baseStyle.height = d;
48
206
  }
49
- return style;
50
- };
51
- var renderSkeletonItems = function renderSkeletonItems() {
52
- if (type === 'text') {
53
- return Array.from({
54
- length: rows
55
- }).map(function (_, index) {
56
- return /*#__PURE__*/React.createElement("div", {
57
- key: index,
58
- className: "skeleton-item skeleton-text ".concat(animated ? 'skeleton-animated' : '', " ").concat(className),
59
- style: _objectSpread(_objectSpread({}, getSkeletonStyle()), style)
60
- });
61
- });
62
- } else {
207
+ baseStyle.borderRadius = '50%';
208
+ } else if (round) {
209
+ baseStyle.borderRadius = '8px';
210
+ } else if (radius !== undefined) {
211
+ baseStyle.borderRadius = toCssSize(radius);
212
+ }
213
+ if (type === 'text') {
214
+ return /*#__PURE__*/React.createElement("div", {
215
+ className: classNames("".concat(prefixCls, "-block-root"), className),
216
+ style: style
217
+ }, Array.from({
218
+ length: rows
219
+ }).map(function (_, index) {
220
+ var _baseStyle$width;
63
221
  return /*#__PURE__*/React.createElement("div", {
64
- className: "skeleton-item skeleton-".concat(type, " ").concat(animated ? 'skeleton-animated' : '', " ").concat(className),
65
- style: _objectSpread(_objectSpread({}, getSkeletonStyle()), style)
222
+ key: index,
223
+ className: classNames("".concat(prefixCls, "-block"), "".concat(prefixCls, "-block-text"), _defineProperty({}, "".concat(prefixCls, "-element-active"), showActive)),
224
+ style: _objectSpread(_objectSpread({}, baseStyle), index === rows - 1 ? {
225
+ width: (_baseStyle$width = baseStyle.width) !== null && _baseStyle$width !== void 0 ? _baseStyle$width : '70%'
226
+ } : {})
66
227
  });
67
- }
68
- };
228
+ }));
229
+ }
69
230
  return /*#__PURE__*/React.createElement("div", {
70
- className: "skeleton-container"
71
- }, renderSkeletonItems());
72
- };
231
+ className: classNames("".concat(prefixCls, "-block-root"), className),
232
+ style: style
233
+ }, /*#__PURE__*/React.createElement("div", {
234
+ className: classNames("".concat(prefixCls, "-block"), "".concat(prefixCls, "-block-").concat(type), _defineProperty({}, "".concat(prefixCls, "-element-active"), showActive)),
235
+ style: baseStyle
236
+ }));
237
+ }
238
+ var SkeletonImpl = function SkeletonImpl(props) {
239
+ var _props$loading = props.loading,
240
+ loading = _props$loading === void 0 ? true : _props$loading,
241
+ children = props.children,
242
+ _props$mode = props.mode,
243
+ mode = _props$mode === void 0 ? 'composed' : _props$mode,
244
+ _props$round = props.round,
245
+ round = _props$round === void 0 ? false : _props$round,
246
+ active = props.active,
247
+ animated = props.animated;
248
+ if (!loading) {
249
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
250
+ }
251
+ var showActive = normalizeActive(active, animated);
252
+ if (mode === 'block') {
253
+ return renderBlock(props, showActive);
254
+ }
255
+ return renderComposed(props, showActive, round);
256
+ };
257
+ export var Skeleton = Object.assign(SkeletonImpl, {
258
+ Avatar: SkeletonAvatar,
259
+ Title: SkeletonTitle,
260
+ Paragraph: SkeletonParagraph,
261
+ Input: SkeletonInput,
262
+ Button: SkeletonButton
263
+ });
@@ -1 +1,3 @@
1
- export { Skeleton } from './Skeleton';
1
+ import { Skeleton } from './Skeleton';
2
+ export type { SkeletonProps, SkeletonAvatarProps, SkeletonTitleProps, SkeletonParagraphProps, SkeletonInputProps, SkeletonButtonProps, SkeletonBlockType, SkeletonAvatarShape, SkeletonAvatarSize, SkeletonButtonShape, } from './Skeleton';
3
+ export default Skeleton;
@@ -1 +1,2 @@
1
- export { Skeleton } from "./Skeleton";
1
+ import { Skeleton } from "./Skeleton";
2
+ export default Skeleton;
@@ -1,48 +1,215 @@
1
- .skeleton-container {
2
- display: flex;
3
- flex-direction: column;
4
- gap: 12rpx;
5
-
6
- .skeleton-item {
7
- background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
8
- background-size: 200% 100%;
9
- background-position: 100% 0;
10
- animation: skeleton-loading 1.5s infinite linear;
11
-
12
- &.skeleton-animated {
13
- animation: skeleton-loading 1.5s infinite linear;
14
- }
15
- }
16
-
17
- .skeleton-text {
18
- width: 100%;
19
- height: 32rpx;
20
- border-radius: 8rpx;
21
- margin-bottom: 12rpx;
22
- &:last-child {
23
- margin-bottom: 0;
24
- width: 70%;
25
- }
26
- }
27
-
28
- .skeleton-circle {
29
- width: 64rpx;
30
- height: 64rpx;
31
- border-radius: 50%;
32
- }
33
-
34
- .skeleton-rect {
35
- width: 100%;
36
- height: 128rpx;
37
- border-radius: 16rpx;
38
- }
39
- }
40
-
41
- @keyframes skeleton-loading {
42
- 0% {
43
- background-position: 100% 0;
44
- }
45
- 100% {
46
- background-position: -100% 0;
47
- }
48
- }
1
+ $prefix: triones-antm-skeleton;
2
+
3
+ @mixin skeleton-fill {
4
+ background: rgba(0, 0, 0, 0.06);
5
+ }
6
+
7
+ .#{$prefix} {
8
+ width: 100%;
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .#{$prefix}-element-active {
13
+ background: linear-gradient(
14
+ 90deg,
15
+ rgba(0, 0, 0, 0.06) 25%,
16
+ rgba(0, 0, 0, 0.12) 50%,
17
+ rgba(0, 0, 0, 0.06) 75%
18
+ );
19
+ background-size: 200% 100%;
20
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
21
+ }
22
+
23
+ .#{$prefix}-with-avatar {
24
+ display: flex;
25
+ align-items: flex-start;
26
+ gap: 12px;
27
+ }
28
+
29
+ .#{$prefix}-header {
30
+ flex-shrink: 0;
31
+ }
32
+
33
+ .#{$prefix}-section {
34
+ flex: 1;
35
+ min-width: 0;
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: 12px;
39
+ padding-top: 4px;
40
+ }
41
+
42
+ .#{$prefix}-avatar {
43
+ @include skeleton-fill;
44
+ flex-shrink: 0;
45
+
46
+ &.#{$prefix}-element-active {
47
+ @include skeleton-fill;
48
+ background: linear-gradient(
49
+ 90deg,
50
+ rgba(0, 0, 0, 0.06) 25%,
51
+ rgba(0, 0, 0, 0.12) 50%,
52
+ rgba(0, 0, 0, 0.06) 75%
53
+ );
54
+ background-size: 200% 100%;
55
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
56
+ }
57
+ }
58
+
59
+ .#{$prefix}-avatar-circle {
60
+ border-radius: 50%;
61
+ }
62
+
63
+ .#{$prefix}-avatar-square {
64
+ border-radius: 8px;
65
+ }
66
+
67
+ .#{$prefix}-title {
68
+ height: 16px;
69
+ max-width: 100%;
70
+ border-radius: 4px;
71
+ @include skeleton-fill;
72
+
73
+ &.#{$prefix}-element-active {
74
+ background: linear-gradient(
75
+ 90deg,
76
+ rgba(0, 0, 0, 0.06) 25%,
77
+ rgba(0, 0, 0, 0.12) 50%,
78
+ rgba(0, 0, 0, 0.06) 75%
79
+ );
80
+ background-size: 200% 100%;
81
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
82
+ }
83
+ }
84
+
85
+ .#{$prefix}-round .#{$prefix}-title,
86
+ .#{$prefix}-round .#{$prefix}-paragraph-line {
87
+ border-radius: 9999px;
88
+ }
89
+
90
+ .#{$prefix}-paragraph {
91
+ display: flex;
92
+ flex-direction: column;
93
+ gap: 8px;
94
+ }
95
+
96
+ .#{$prefix}-paragraph-line {
97
+ height: 14px;
98
+ max-width: 100%;
99
+ border-radius: 4px;
100
+ @include skeleton-fill;
101
+
102
+ &.#{$prefix}-element-active {
103
+ background: linear-gradient(
104
+ 90deg,
105
+ rgba(0, 0, 0, 0.06) 25%,
106
+ rgba(0, 0, 0, 0.12) 50%,
107
+ rgba(0, 0, 0, 0.06) 75%
108
+ );
109
+ background-size: 200% 100%;
110
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
111
+ }
112
+ }
113
+
114
+ .#{$prefix}-input {
115
+ width: 100%;
116
+ border-radius: 6px;
117
+ @include skeleton-fill;
118
+
119
+ &.#{$prefix}-element-active {
120
+ background: linear-gradient(
121
+ 90deg,
122
+ rgba(0, 0, 0, 0.06) 25%,
123
+ rgba(0, 0, 0, 0.12) 50%,
124
+ rgba(0, 0, 0, 0.06) 75%
125
+ );
126
+ background-size: 200% 100%;
127
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
128
+ }
129
+ }
130
+
131
+ .#{$prefix}-button {
132
+ display: inline-block;
133
+ min-width: 60px;
134
+ border-radius: 6px;
135
+ @include skeleton-fill;
136
+
137
+ &.#{$prefix}-element-active {
138
+ background: linear-gradient(
139
+ 90deg,
140
+ rgba(0, 0, 0, 0.06) 25%,
141
+ rgba(0, 0, 0, 0.12) 50%,
142
+ rgba(0, 0, 0, 0.06) 75%
143
+ );
144
+ background-size: 200% 100%;
145
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
146
+ }
147
+ }
148
+
149
+ .#{$prefix}-button-block {
150
+ display: block;
151
+ width: 100%;
152
+ }
153
+
154
+ .#{$prefix}-button-square {
155
+ border-radius: 4px;
156
+ }
157
+
158
+ .#{$prefix}-button-round {
159
+ border-radius: 9999px;
160
+ }
161
+
162
+ .#{$prefix}-button-circle {
163
+ min-width: unset;
164
+ border-radius: 50%;
165
+ }
166
+
167
+ .#{$prefix}-block-root {
168
+ display: flex;
169
+ flex-direction: column;
170
+ gap: 8px;
171
+ width: 100%;
172
+ }
173
+
174
+ .#{$prefix}-block {
175
+ @include skeleton-fill;
176
+ box-sizing: border-box;
177
+
178
+ &.#{$prefix}-element-active {
179
+ background: linear-gradient(
180
+ 90deg,
181
+ rgba(0, 0, 0, 0.06) 25%,
182
+ rgba(0, 0, 0, 0.12) 50%,
183
+ rgba(0, 0, 0, 0.06) 75%
184
+ );
185
+ background-size: 200% 100%;
186
+ animation: #{$prefix}-shimmer 1.4s ease infinite;
187
+ }
188
+ }
189
+
190
+ .#{$prefix}-block-text {
191
+ width: 100%;
192
+ height: 16px;
193
+ border-radius: 4px;
194
+ }
195
+
196
+ .#{$prefix}-block-rect {
197
+ width: 100%;
198
+ height: 64px;
199
+ border-radius: 8px;
200
+ }
201
+
202
+ .#{$prefix}-block-circle {
203
+ width: 32px;
204
+ height: 32px;
205
+ border-radius: 50%;
206
+ }
207
+
208
+ @keyframes #{$prefix}-shimmer {
209
+ 0% {
210
+ background-position: 100% 0;
211
+ }
212
+ 100% {
213
+ background-position: -100% 0;
214
+ }
215
+ }
@@ -55,16 +55,19 @@ export var Space = function Space(_ref) {
55
55
  }),
56
56
  onClick: onClick
57
57
  }, function () {
58
+ var validChildren = React.Children.toArray(children).filter(function (child) {
59
+ return child !== null && child !== undefined;
60
+ });
58
61
  var items = [];
59
- React.Children.map(children, function (child, index) {
60
- if (child !== null && child !== undefined) {
61
- items.push( /*#__PURE__*/React.createElement("div", {
62
- key: "space-item-".concat(index),
63
- className: "".concat(classPrefix, "-item")
64
- }, child));
65
- if (separator && index < React.Children.count(children) - 1) {
66
- items.push(separator);
67
- }
62
+ validChildren.forEach(function (child, index) {
63
+ items.push( /*#__PURE__*/React.createElement("div", {
64
+ key: "space-item-".concat(index),
65
+ className: "".concat(classPrefix, "-item")
66
+ }, child));
67
+ if (separator && index < validChildren.length - 1) {
68
+ items.push( /*#__PURE__*/React.createElement(React.Fragment, {
69
+ key: "space-separator-".concat(index)
70
+ }, separator));
68
71
  }
69
72
  });
70
73
  return items;