clxx 2.1.5 → 2.1.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.
Files changed (74) hide show
  1. package/AGENTS.md +2 -0
  2. package/README.md +827 -420
  3. package/build/Ago/index.js +14 -8
  4. package/build/Alert/Wrapper.js +13 -10
  5. package/build/Alert/index.js +17 -11
  6. package/build/Alert/style.js +44 -58
  7. package/build/AutoGrid/index.js +66 -48
  8. package/build/AutoGrid/style.d.ts +3 -4
  9. package/build/AutoGrid/style.js +13 -22
  10. package/build/CarouselNotice/index.js +22 -19
  11. package/build/CarouselNotice/style.js +12 -14
  12. package/build/CitySelect/data.d.ts +3 -0
  13. package/build/CitySelect/data.js +2355 -0
  14. package/build/CitySelect/index.d.ts +17 -0
  15. package/build/CitySelect/index.js +300 -0
  16. package/build/CitySelect/search.d.ts +2 -0
  17. package/build/CitySelect/search.js +70 -0
  18. package/build/CitySelect/style.d.ts +4 -0
  19. package/build/CitySelect/style.js +237 -0
  20. package/build/CitySelect/type.d.ts +17 -0
  21. package/build/CitySelect/type.js +2 -0
  22. package/build/Clickable/index.d.ts +1 -0
  23. package/build/Clickable/index.js +113 -31
  24. package/build/Container/index.js +62 -47
  25. package/build/Countdowner/index.js +50 -14
  26. package/build/Dialog/Wrapper.js +13 -10
  27. package/build/Dialog/index.js +18 -12
  28. package/build/Dialog/style.js +29 -25
  29. package/build/Effect/useInterval.js +7 -4
  30. package/build/Effect/useTick.js +9 -6
  31. package/build/Effect/useUpdate.js +6 -3
  32. package/build/Effect/useViewport.js +15 -8
  33. package/build/Effect/useWindowResize.js +7 -4
  34. package/build/Fixed/index.d.ts +5 -0
  35. package/build/Fixed/index.js +40 -0
  36. package/build/Flex/Col.js +23 -15
  37. package/build/Flex/Row.js +23 -15
  38. package/build/Flex/index.js +9 -5
  39. package/build/Indicator/index.js +24 -18
  40. package/build/Indicator/style.js +6 -3
  41. package/build/Loading/Wrapper.js +14 -11
  42. package/build/Loading/index.js +17 -10
  43. package/build/Loading/style.js +25 -23
  44. package/build/Overlay/index.js +15 -31
  45. package/build/SafeArea/index.js +8 -5
  46. package/build/ScrollView/index.js +24 -21
  47. package/build/ScrollView/style.js +16 -14
  48. package/build/Toast/Toast.js +53 -17
  49. package/build/Toast/index.js +21 -14
  50. package/build/Toast/style.js +31 -30
  51. package/build/index.d.ts +2 -2
  52. package/build/index.js +102 -36
  53. package/build/utils/Countdown.js +7 -3
  54. package/build/utils/ago.js +10 -4
  55. package/build/utils/calendarTable.js +9 -3
  56. package/build/utils/createApp.d.ts +1 -2
  57. package/build/utils/createApp.js +35 -31
  58. package/build/utils/cssUtil.d.ts +0 -9
  59. package/build/utils/cssUtil.js +10 -43
  60. package/build/utils/defaultScroll.js +4 -1
  61. package/build/utils/dom.js +6 -3
  62. package/build/utils/is.js +6 -2
  63. package/build/utils/jsonp.js +4 -1
  64. package/build/utils/request.js +40 -27
  65. package/build/utils/tick.js +4 -1
  66. package/build/utils/uniqKey.js +4 -1
  67. package/build/utils/wait.js +8 -4
  68. package/package.json +1 -1
  69. package/test/src/city-select/index.jsx +21 -0
  70. package/test/src/dialog/index.module.css +1 -1
  71. package/test/src/index/index.jsx +1 -0
  72. package/test/vite.config.js +6 -2
  73. package/build/context.d.ts +0 -15
  74. package/build/context.js +0 -24
@@ -1,5 +1,9 @@
1
- import { css, keyframes } from "@emotion/react";
2
- const maskShow = keyframes `
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.style = exports.maskHide = void 0;
4
+ exports.getAnimation = getAnimation;
5
+ const react_1 = require("@emotion/react");
6
+ const maskShow = (0, react_1.keyframes) `
3
7
  from {
4
8
  opacity: 0;
5
9
  }
@@ -7,7 +11,7 @@ const maskShow = keyframes `
7
11
  opacity: 1;
8
12
  }
9
13
  `;
10
- export const maskHide = keyframes `
14
+ exports.maskHide = (0, react_1.keyframes) `
11
15
  from {
12
16
  opacity: 1;
13
17
  }
@@ -15,7 +19,7 @@ export const maskHide = keyframes `
15
19
  opacity: 0;
16
20
  }
17
21
  `;
18
- const pullUpShow = keyframes `
22
+ const pullUpShow = (0, react_1.keyframes) `
19
23
  from {
20
24
  transform: translateY(100%);
21
25
  }
@@ -23,7 +27,7 @@ const pullUpShow = keyframes `
23
27
  transform: translateY(0);
24
28
  }
25
29
  `;
26
- const pullUpHide = keyframes `
30
+ const pullUpHide = (0, react_1.keyframes) `
27
31
  from {
28
32
  transform: translateY(0);
29
33
  }
@@ -31,7 +35,7 @@ const pullUpHide = keyframes `
31
35
  transform: translateY(100%);
32
36
  }
33
37
  `;
34
- const pullDownShow = keyframes `
38
+ const pullDownShow = (0, react_1.keyframes) `
35
39
  from {
36
40
  transform: translateY(-100%);
37
41
  }
@@ -39,7 +43,7 @@ const pullDownShow = keyframes `
39
43
  transform: translateY(0);
40
44
  }
41
45
  `;
42
- const pullDownHide = keyframes `
46
+ const pullDownHide = (0, react_1.keyframes) `
43
47
  from {
44
48
  transform: translateY(0);
45
49
  }
@@ -47,7 +51,7 @@ const pullDownHide = keyframes `
47
51
  transform: translateY(-100%);
48
52
  }
49
53
  `;
50
- const pullLeftShow = keyframes `
54
+ const pullLeftShow = (0, react_1.keyframes) `
51
55
  from {
52
56
  transform: translateX(100%);
53
57
  }
@@ -55,7 +59,7 @@ const pullLeftShow = keyframes `
55
59
  transform: translateX(0);
56
60
  }
57
61
  `;
58
- const pullLeftHide = keyframes `
62
+ const pullLeftHide = (0, react_1.keyframes) `
59
63
  from {
60
64
  transform: translateX(0);
61
65
  }
@@ -63,7 +67,7 @@ const pullLeftHide = keyframes `
63
67
  transform: translateX(100%);
64
68
  }
65
69
  `;
66
- const pullRightShow = keyframes `
70
+ const pullRightShow = (0, react_1.keyframes) `
67
71
  from {
68
72
  transform: translateX(-100%);
69
73
  }
@@ -71,7 +75,7 @@ const pullRightShow = keyframes `
71
75
  transform: translateX(0);
72
76
  }
73
77
  `;
74
- const pullRightHide = keyframes `
78
+ const pullRightHide = (0, react_1.keyframes) `
75
79
  from {
76
80
  transform: translateX(0);
77
81
  }
@@ -79,7 +83,7 @@ const pullRightHide = keyframes `
79
83
  transform: translateX(-100%);
80
84
  }
81
85
  `;
82
- const centerShow = keyframes `
86
+ const centerShow = (0, react_1.keyframes) `
83
87
  from {
84
88
  transform: scale(0.8);
85
89
  opacity: 0;
@@ -89,7 +93,7 @@ const centerShow = keyframes `
89
93
  opacity: 1;
90
94
  }
91
95
  `;
92
- const centerHide = keyframes `
96
+ const centerHide = (0, react_1.keyframes) `
93
97
  from {
94
98
  transform: scale(1);
95
99
  opacity: 1;
@@ -99,7 +103,7 @@ const centerHide = keyframes `
99
103
  opacity: 0;
100
104
  }
101
105
  `;
102
- export function getAnimation(type, status) {
106
+ function getAnimation(type, status) {
103
107
  const animation = {
104
108
  center: [centerShow, centerHide],
105
109
  pullUp: [pullUpShow, pullUpHide],
@@ -116,19 +120,19 @@ export function getAnimation(type, status) {
116
120
  }
117
121
  return {
118
122
  keyframes,
119
- animation: css({
123
+ animation: (0, react_1.css)({
120
124
  animation: `${keyframes} 300ms ease forwards`,
121
125
  }),
122
126
  };
123
127
  }
124
- export const style = {
125
- maskShow: css({
128
+ exports.style = {
129
+ maskShow: (0, react_1.css)({
126
130
  animation: `${maskShow} 300ms ease`,
127
131
  }),
128
- maskHide: css({
129
- animation: `${maskHide} 300ms ease forwards`,
132
+ maskHide: (0, react_1.css)({
133
+ animation: `${exports.maskHide} 300ms ease forwards`,
130
134
  }),
131
- mask: css({
135
+ mask: (0, react_1.css)({
132
136
  zIndex: 1,
133
137
  position: "absolute",
134
138
  left: 0,
@@ -137,28 +141,28 @@ export const style = {
137
141
  height: "100%",
138
142
  backgroundColor: "rgba(0, 0, 0, 0.6)",
139
143
  }),
140
- boxCss: css({
144
+ boxCss: (0, react_1.css)({
141
145
  zIndex: 2,
142
146
  }),
143
- pullUp: css({
147
+ pullUp: (0, react_1.css)({
144
148
  position: "absolute",
145
149
  left: 0,
146
150
  bottom: 0,
147
151
  width: "100%",
148
152
  }),
149
- pullDown: css({
153
+ pullDown: (0, react_1.css)({
150
154
  position: "absolute",
151
155
  left: 0,
152
156
  top: 0,
153
157
  width: "100%",
154
158
  }),
155
- pullLeft: css({
159
+ pullLeft: (0, react_1.css)({
156
160
  position: "absolute",
157
161
  right: 0,
158
162
  top: 0,
159
163
  height: "100%",
160
164
  }),
161
- pullRight: css({
165
+ pullRight: (0, react_1.css)({
162
166
  position: "absolute",
163
167
  left: 0,
164
168
  top: 0,
@@ -1,8 +1,11 @@
1
- import { useEffect, useRef } from "react";
2
- export function useInterval(callback, delay) {
3
- const savedCallback = useRef(callback);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useInterval = useInterval;
4
+ const react_1 = require("react");
5
+ function useInterval(callback, delay) {
6
+ const savedCallback = (0, react_1.useRef)(callback);
4
7
  savedCallback.current = callback;
5
- useEffect(() => {
8
+ (0, react_1.useEffect)(() => {
6
9
  if (delay !== null) {
7
10
  const interval = setInterval(() => savedCallback.current(), delay || 0);
8
11
  return () => clearInterval(interval);
@@ -1,15 +1,18 @@
1
- import { tick } from '../utils/tick';
2
- import { useEffect, useRef } from 'react';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTick = useTick;
4
+ const tick_1 = require("../utils/tick");
5
+ const react_1 = require("react");
3
6
  /**
4
7
  * 逐帧执行的ticker
5
8
  * @param frame 帧函数
6
9
  * @param interval 执行间隔
7
10
  */
8
- export function useTick(frame) {
9
- const framer = useRef(frame);
11
+ function useTick(frame) {
12
+ const framer = (0, react_1.useRef)(frame);
10
13
  framer.current = frame;
11
- useEffect(() => {
12
- const stop = tick(() => framer.current());
14
+ (0, react_1.useEffect)(() => {
15
+ const stop = (0, tick_1.tick)(() => framer.current());
13
16
  return () => stop();
14
17
  }, []);
15
18
  }
@@ -1,10 +1,13 @@
1
- import { useReducer } from "react";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useUpdate = useUpdate;
4
+ const react_1 = require("react");
2
5
  const updateReducer = (num) => (num + 1) % 1000000;
3
6
  /**
4
7
  * 返回一个函数,调用该函数,组件会刷新一次
5
8
  * @returns
6
9
  */
7
- export function useUpdate() {
8
- const [, update] = useReducer(updateReducer, 0);
10
+ function useUpdate() {
11
+ const [, update] = (0, react_1.useReducer)(updateReducer, 0);
9
12
  return update;
10
13
  }
@@ -1,6 +1,13 @@
1
- import { useEffect } from "react";
2
- import isPlainObject from "lodash/isPlainObject";
3
- export const metaContent = {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.metaContent = void 0;
7
+ exports.useViewport = useViewport;
8
+ const react_1 = require("react");
9
+ const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
10
+ exports.metaContent = {
4
11
  /**
5
12
  * 解析meta的content字段
6
13
  * @param content
@@ -32,17 +39,17 @@ export const metaContent = {
32
39
  return parts.join(", ");
33
40
  },
34
41
  };
35
- export function useViewport(attr) {
42
+ function useViewport(attr) {
36
43
  let config = {
37
44
  width: "device-width",
38
45
  initialScale: 1,
39
46
  userScalable: "no",
40
47
  viewportFit: "cover",
41
48
  };
42
- if (isPlainObject(attr)) {
49
+ if ((0, isPlainObject_1.default)(attr)) {
43
50
  config = Object.assign(Object.assign({}, config), attr);
44
51
  }
45
- useEffect(() => {
52
+ (0, react_1.useEffect)(() => {
46
53
  // 确保viewport的合法逻辑
47
54
  let meta = document.querySelector("meta[name='viewport']");
48
55
  if (!meta) {
@@ -50,7 +57,7 @@ export function useViewport(attr) {
50
57
  meta.name = "viewport";
51
58
  document.head.prepend(meta);
52
59
  }
53
- const content = metaContent.parse(meta.content || "");
60
+ const content = exports.metaContent.parse(meta.content || "");
54
61
  if (config.width) {
55
62
  content.width = config.width;
56
63
  }
@@ -72,7 +79,7 @@ export function useViewport(attr) {
72
79
  if (config.viewportFit) {
73
80
  content["viewport-fit"] = config.viewportFit;
74
81
  }
75
- meta.content = metaContent.stringify(content);
82
+ meta.content = exports.metaContent.stringify(content);
76
83
  }, [
77
84
  config.width,
78
85
  config.height,
@@ -1,15 +1,18 @@
1
- import { useEffect, useRef } from "react";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useWindowResize = useWindowResize;
4
+ const react_1 = require("react");
2
5
  /**
3
6
  * 窗口尺寸变化时触发(包括屏幕旋转)
4
7
  * 注意:移动端 resize 事件通常只在旋转屏幕时触发,频率很低,不需要防抖
5
8
  *
6
9
  * @param onResize 窗口尺寸变化时的回调函数
7
10
  */
8
- export function useWindowResize(onResize) {
9
- const callbackRef = useRef(onResize);
11
+ function useWindowResize(onResize) {
12
+ const callbackRef = (0, react_1.useRef)(onResize);
10
13
  // 每次渲染都更新回调引用,避免闭包陈旧
11
14
  callbackRef.current = onResize;
12
- useEffect(() => {
15
+ (0, react_1.useEffect)(() => {
13
16
  const callback = () => callbackRef.current();
14
17
  // 监听窗口大小变化
15
18
  window.addEventListener("resize", callback);
@@ -0,0 +1,5 @@
1
+ export interface FixedProps extends React.HTMLProps<HTMLDivElement> {
2
+ children?: React.ReactNode;
3
+ position?: "top" | "bottom" | "left" | "right";
4
+ }
5
+ export declare function Fixed(props: FixedProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Fixed = Fixed;
15
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
16
+ function Fixed(props) {
17
+ const { children, position = "bottom" } = props, extra = __rest(props, ["children", "position"]);
18
+ const styles = {
19
+ position: "fixed",
20
+ };
21
+ if (position === "top") {
22
+ styles.top = 0;
23
+ styles.width = "100%";
24
+ styles.left = 0;
25
+ }
26
+ else if (position === "bottom") {
27
+ styles.bottom = 0;
28
+ styles.width = "100%";
29
+ styles.left = 0;
30
+ }
31
+ else if (position === "left") {
32
+ styles.left = 0;
33
+ styles.height = "100%";
34
+ }
35
+ else if (position === "right") {
36
+ styles.right = 0;
37
+ styles.height = "100%";
38
+ }
39
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { css: styles }, extra, { children: props.children })));
40
+ }
package/build/Flex/Col.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,30 +10,37 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { Flex } from '.';
14
- export function ColStart(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.ColStart = ColStart;
15
+ exports.Col = ColStart;
16
+ exports.ColEnd = ColEnd;
17
+ exports.ColCenter = ColCenter;
18
+ exports.ColBetween = ColBetween;
19
+ exports.ColAround = ColAround;
20
+ exports.ColEvenly = ColEvenly;
21
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
22
+ const _1 = require(".");
23
+ function ColStart(props) {
15
24
  const { flexDirection = 'column', justifyContent = 'flex-start' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
16
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
17
26
  }
18
- export function ColEnd(props) {
27
+ function ColEnd(props) {
19
28
  const { flexDirection = 'column', justifyContent = 'flex-end' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
20
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
21
30
  }
22
- export function ColCenter(props) {
31
+ function ColCenter(props) {
23
32
  const { flexDirection = 'column', justifyContent = 'center' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
24
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
34
  }
26
- export function ColBetween(props) {
35
+ function ColBetween(props) {
27
36
  const { flexDirection = 'column', justifyContent = 'space-between' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
28
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
38
  }
30
- export function ColAround(props) {
39
+ function ColAround(props) {
31
40
  const { flexDirection = 'column', justifyContent = 'space-around' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
32
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
41
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
42
  }
34
- export function ColEvenly(props) {
43
+ function ColEvenly(props) {
35
44
  const { flexDirection = 'column', justifyContent = 'space-evenly' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
36
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
45
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
46
  }
38
- export { ColStart as Col };
package/build/Flex/Row.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,30 +10,37 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { Flex } from '.';
14
- export function RowStart(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.RowStart = RowStart;
15
+ exports.Row = RowStart;
16
+ exports.RowEnd = RowEnd;
17
+ exports.RowCenter = RowCenter;
18
+ exports.RowBetween = RowBetween;
19
+ exports.RowAround = RowAround;
20
+ exports.RowEvenly = RowEvenly;
21
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
22
+ const _1 = require(".");
23
+ function RowStart(props) {
15
24
  const { flexDirection = 'row', justifyContent = 'flex-start' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
16
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
17
26
  }
18
- export function RowEnd(props) {
27
+ function RowEnd(props) {
19
28
  const { flexDirection = 'row', justifyContent = 'flex-end' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
20
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
21
30
  }
22
- export function RowCenter(props) {
31
+ function RowCenter(props) {
23
32
  const { flexDirection = 'row', justifyContent = 'center' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
24
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
25
34
  }
26
- export function RowBetween(props) {
35
+ function RowBetween(props) {
27
36
  const { flexDirection = 'row', justifyContent = 'space-between' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
28
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
29
38
  }
30
- export function RowAround(props) {
39
+ function RowAround(props) {
31
40
  const { flexDirection = 'row', justifyContent = 'space-around' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
32
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
41
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
33
42
  }
34
- export function RowEvenly(props) {
43
+ function RowEvenly(props) {
35
44
  const { flexDirection = 'row', justifyContent = 'space-evenly' } = props, extra = __rest(props, ["flexDirection", "justifyContent"]);
36
- return (_jsx(Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
45
+ return ((0, jsx_runtime_1.jsx)(_1.Flex, Object.assign({ flexDirection: flexDirection, justifyContent: justifyContent }, extra)));
37
46
  }
38
- export { RowStart as Row };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,10 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- export function Flex(props) {
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Flex = Flex;
15
+ exports.FlexItem = FlexItem;
16
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
17
+ function Flex(props) {
14
18
  const { children, alignItems = 'center', alignContent, justifyContent, flexFlow, flexWrap, flexDirection } = props, extra = __rest(props, ["children", "alignItems", "alignContent", "justifyContent", "flexFlow", "flexWrap", "flexDirection"]);
15
- return (_jsx("div", Object.assign({ css: {
19
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
16
20
  display: 'flex',
17
21
  alignItems,
18
22
  alignContent,
@@ -22,9 +26,9 @@ export function Flex(props) {
22
26
  flexDirection,
23
27
  } }, extra, { children: children })));
24
28
  }
25
- export function FlexItem(props) {
29
+ function FlexItem(props) {
26
30
  const { children, alignSelf, order, flex, flexGrow, flexShrink, flexBasis } = props, extra = __rest(props, ["children", "alignSelf", "order", "flex", "flexGrow", "flexShrink", "flexBasis"]);
27
- return (_jsx("div", Object.assign({ css: {
31
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: {
28
32
  alignSelf,
29
33
  order,
30
34
  flex,
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,51 +10,56 @@ var __rest = (this && this.__rest) || function (s, e) {
9
10
  }
10
11
  return t;
11
12
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import { css } from '@emotion/react';
14
- import React from 'react';
15
- import { adaptive, normalizeUnit } from '../utils/cssUtil';
16
- import { getBarChangeKeyFrames } from './style';
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Indicator = Indicator;
18
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
+ const react_1 = require("@emotion/react");
20
+ const react_2 = __importDefault(require("react"));
21
+ const cssUtil_1 = require("../utils/cssUtil");
22
+ const style_1 = require("./style");
17
23
  /**
18
24
  * SVG转圈指示器,一般用作loading效果
19
25
  * @param props
20
26
  */
21
- export function Indicator(props) {
27
+ function Indicator(props) {
22
28
  const { size, rounded = true, barWidth = 7, barHeight = 28, barColor = '#fff', barCount = 12, duration = 600, containerStyle } = props, attributes = __rest(props, ["size", "rounded", "barWidth", "barHeight", "barColor", "barCount", "duration", "containerStyle"]);
23
29
  const radius = rounded ? barWidth / 2 : 0;
24
30
  // 使用 useMemo 缓存 barList,避免每次渲染都重新生成
25
- const barList = React.useMemo(() => {
31
+ const barList = react_2.default.useMemo(() => {
26
32
  const bars = [];
27
33
  for (let i = 0; i < barCount; i++) {
28
- bars.push(_jsx("rect", { x: (100 - barWidth) / 2, y: "0", rx: radius, ry: radius, width: barWidth, height: barHeight, transform: `rotate(${(360 / barCount) * i}, 50, 50)`, css: {
34
+ bars.push((0, jsx_runtime_1.jsx)("rect", { x: (100 - barWidth) / 2, y: "0", rx: radius, ry: radius, width: barWidth, height: barHeight, transform: `rotate(${(360 / barCount) * i}, 50, 50)`, css: {
29
35
  animationDelay: `${-(duration * (barCount - i)) / barCount}ms`,
30
36
  } }, i));
31
37
  }
32
38
  return bars;
33
39
  }, [barCount, barWidth, barHeight, radius, duration]);
34
40
  // 使用 useMemo 缓存样式,避免每次都重新计算
35
- const style = React.useMemo(() => [
41
+ const style = react_2.default.useMemo(() => [
36
42
  {
37
43
  fontSize: 0,
38
44
  },
39
45
  typeof size !== 'undefined' ? {
40
- width: normalizeUnit(size),
41
- height: normalizeUnit(size),
42
- } : adaptive({
43
- width: 60,
44
- height: 60,
45
- })
46
+ width: (0, cssUtil_1.normalizeUnit)(size),
47
+ height: (0, cssUtil_1.normalizeUnit)(size),
48
+ } : {
49
+ width: '.6rem',
50
+ height: '.6rem',
51
+ }
46
52
  ], [size]);
47
- const svgStyle = React.useMemo(() => css({
53
+ const svgStyle = react_2.default.useMemo(() => (0, react_1.css)({
48
54
  width: '100%',
49
55
  height: '100%',
50
56
  rect: {
51
57
  fill: 'transparent',
52
- animationName: getBarChangeKeyFrames(barColor),
58
+ animationName: (0, style_1.getBarChangeKeyFrames)(barColor),
53
59
  animationDuration: `${duration}ms`,
54
60
  animationTimingFunction: 'linear',
55
61
  animationIterationCount: 'infinite',
56
62
  },
57
63
  }), [barColor, duration]);
58
- return (_jsx("div", Object.assign({ css: [style, containerStyle] }, attributes, { children: _jsx("svg", { viewBox: "0 0 100 100", css: svgStyle, children: barList }) })));
64
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ css: [style, containerStyle] }, attributes, { children: (0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 100 100", css: svgStyle, children: barList }) })));
59
65
  }
@@ -1,10 +1,13 @@
1
- import { keyframes } from '@emotion/react';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBarChangeKeyFrames = getBarChangeKeyFrames;
4
+ const react_1 = require("@emotion/react");
2
5
  /**
3
6
  * 获取转圈每一条bar的过渡动画
4
7
  * @param color
5
8
  */
6
- export function getBarChangeKeyFrames(color) {
7
- return keyframes `
9
+ function getBarChangeKeyFrames(color) {
10
+ return (0, react_1.keyframes) `
8
11
  from {
9
12
  fill: ${color};
10
13
  }
@@ -1,9 +1,12 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- import { style, LoadingHide } from './style';
3
- import { Indicator } from '../Indicator';
4
- import { RowCenter } from '../Flex/Row';
5
- import { Overlay } from '../Overlay';
6
- export function Wrapper(props) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Wrapper = Wrapper;
4
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
+ const style_1 = require("./style");
6
+ const Indicator_1 = require("../Indicator");
7
+ const Row_1 = require("../Flex/Row");
8
+ const Overlay_1 = require("../Overlay");
9
+ function Wrapper(props) {
7
10
  const { status = 'show', hint, overlay, indicator, onHide, containerStyle, } = props;
8
11
  // 覆盖层样式
9
12
  let overlayProps = {
@@ -24,19 +27,19 @@ export function Wrapper(props) {
24
27
  indicatorProps = Object.assign(Object.assign({}, indicatorProps), indicator);
25
28
  }
26
29
  // 根据状态设置动画
27
- const animation = status === 'show' ? style.boxShow : style.boxHide;
30
+ const animation = status === 'show' ? style_1.style.boxShow : style_1.style.boxHide;
28
31
  // 动画结束时触发的函数逻辑
29
32
  const animationEnd = (event) => {
30
- if (event.animationName === LoadingHide.name) {
33
+ if (event.animationName === style_1.LoadingHide.name) {
31
34
  onHide === null || onHide === void 0 ? void 0 : onHide();
32
35
  }
33
36
  };
34
37
  let box;
35
38
  if (hint && typeof hint === 'string') {
36
- box = (_jsxs(RowCenter, { css: [style.boxCommon, style.boxWithExtra, animation, containerStyle], onAnimationEnd: animationEnd, children: [_jsx(Indicator, Object.assign({}, indicatorProps)), _jsx("div", { css: style.hint, children: hint })] }));
39
+ box = ((0, jsx_runtime_1.jsxs)(Row_1.RowCenter, { css: [style_1.style.boxCommon, style_1.style.boxWithExtra, animation, containerStyle], onAnimationEnd: animationEnd, children: [(0, jsx_runtime_1.jsx)(Indicator_1.Indicator, Object.assign({}, indicatorProps)), (0, jsx_runtime_1.jsx)("div", { css: style_1.style.hint, children: hint })] }));
37
40
  }
38
41
  else {
39
- box = (_jsx(RowCenter, { css: [style.boxCommon, style.box, animation, containerStyle], onAnimationEnd: animationEnd, children: _jsx(Indicator, Object.assign({}, indicatorProps)) }));
42
+ box = ((0, jsx_runtime_1.jsx)(Row_1.RowCenter, { css: [style_1.style.boxCommon, style_1.style.box, animation, containerStyle], onAnimationEnd: animationEnd, children: (0, jsx_runtime_1.jsx)(Indicator_1.Indicator, Object.assign({}, indicatorProps)) }));
40
43
  }
41
- return _jsx(Overlay, Object.assign({}, overlayProps, { children: box }));
44
+ return (0, jsx_runtime_1.jsx)(Overlay_1.Overlay, Object.assign({}, overlayProps, { children: box }));
42
45
  }