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,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,12 +10,17 @@ 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 dayjs from 'dayjs';
14
- import { ago } from '../utils/ago';
15
- export function Ago(props) {
16
- const { date = dayjs(), block = false, renderContent } = props, attrs = __rest(props, ["date", "block", "renderContent"]);
17
- const agoValue = ago(date);
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.Ago = Ago;
18
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
+ const dayjs_1 = __importDefault(require("dayjs"));
20
+ const ago_1 = require("../utils/ago");
21
+ function Ago(props) {
22
+ const { date = (0, dayjs_1.default)(), block = false, renderContent } = props, attrs = __rest(props, ["date", "block", "renderContent"]);
23
+ const agoValue = (0, ago_1.ago)(date);
18
24
  // 格式化内容
19
25
  let content = agoValue.format;
20
26
  if (typeof renderContent === 'function') {
@@ -22,8 +28,8 @@ export function Ago(props) {
22
28
  }
23
29
  // 是否显示为块元素
24
30
  if (block) {
25
- return _jsx("div", Object.assign({}, attrs, { children: content }));
31
+ return (0, jsx_runtime_1.jsx)("div", Object.assign({}, attrs, { children: content }));
26
32
  }
27
33
  // 默认显示行内元素
28
- return _jsx("span", Object.assign({}, attrs, { children: content }));
34
+ return (0, jsx_runtime_1.jsx)("span", Object.assign({}, attrs, { children: content }));
29
35
  }
@@ -1,25 +1,28 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- import { Clickable } from '../Clickable';
3
- import { Row } from '../Flex/Row';
4
- import { style } from './style';
5
- export function AlertWrapper(props) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlertWrapper = AlertWrapper;
4
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
+ const Clickable_1 = require("../Clickable");
6
+ const Row_1 = require("../Flex/Row");
7
+ const style_1 = require("./style");
8
+ function AlertWrapper(props) {
6
9
  const { title = '提示', description, confirm = '确定', confirmColor = '#007afe', cancel = '取消', cancelColor = '#666', showCancel = false, onConfirm, onCancel,
7
10
  // 可定制的样式
8
11
  titleStyle, descStyle, btnStyle, cancelStyle, confirmStyle, } = props;
9
12
  // 标题样式
10
13
  let titleCss = [
11
- style.title,
14
+ style_1.style.title,
12
15
  description ? { paddingBottom: 0 } : {},
13
16
  titleStyle
14
17
  ];
15
18
  // 展示按钮组
16
19
  let btnBoxCss = [
17
- style.btnBox,
18
- showCancel ? style.btnBoxWithCancel : {}
20
+ style_1.style.btnBox,
21
+ showCancel ? style_1.style.btnBoxWithCancel : {}
19
22
  ];
20
- return (_jsxs("div", { css: style.container, children: [_jsxs("div", { css: style.content, children: [_jsx("div", { css: titleCss, children: title }), description && _jsx("div", { css: [style.desc, descStyle], children: description })] }), _jsxs(Row, { alignItems: "stretch", css: btnBoxCss, children: [showCancel && (_jsx(Clickable, { css: [style.btn, btnStyle, cancelStyle, { color: cancelColor }], onClick: onCancel, activeStyle: {
23
+ return ((0, jsx_runtime_1.jsxs)("div", { css: style_1.style.container, children: [(0, jsx_runtime_1.jsxs)("div", { css: style_1.style.content, children: [(0, jsx_runtime_1.jsx)("div", { css: titleCss, children: title }), description && (0, jsx_runtime_1.jsx)("div", { css: [style_1.style.desc, descStyle], children: description })] }), (0, jsx_runtime_1.jsxs)(Row_1.Row, { alignItems: "stretch", css: btnBoxCss, children: [showCancel && ((0, jsx_runtime_1.jsx)(Clickable_1.Clickable, { css: [style_1.style.btn, btnStyle, cancelStyle, { color: cancelColor }], onClick: onCancel, activeStyle: {
21
24
  backgroundColor: `#c0c0c022`,
22
- }, children: cancel })), _jsx(Clickable, { css: [style.btn, btnStyle, confirmStyle, { color: confirmColor }], onClick: onConfirm, activeStyle: {
25
+ }, children: cancel })), (0, jsx_runtime_1.jsx)(Clickable_1.Clickable, { css: [style_1.style.btn, btnStyle, confirmStyle, { color: confirmColor }], onClick: onConfirm, activeStyle: {
23
26
  backgroundColor: `#c0c0c022`,
24
27
  }, children: confirm })] })] }));
25
28
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,19 +8,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
11
- import React from 'react';
12
- import { showDialog } from '../Dialog';
13
- import { AlertWrapper } from './Wrapper';
14
- import isPlainObject from 'lodash/isPlainObject';
15
- import omit from 'lodash/omit';
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.showAlert = showAlert;
16
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
17
+ const react_1 = __importDefault(require("react"));
18
+ const Dialog_1 = require("../Dialog");
19
+ const Wrapper_1 = require("./Wrapper");
20
+ const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
21
+ const omit_1 = __importDefault(require("lodash/omit"));
16
22
  /**
17
23
  * 显示弹框
18
24
  * @param option
19
25
  */
20
- export function showAlert(option) {
26
+ function showAlert(option) {
21
27
  let config;
22
- if (React.isValidElement(option) || !isPlainObject(option)) {
28
+ if (react_1.default.isValidElement(option) || !(0, isPlainObject_1.default)(option)) {
23
29
  config = {
24
30
  title: option,
25
31
  };
@@ -28,7 +34,7 @@ export function showAlert(option) {
28
34
  config = option;
29
35
  }
30
36
  // 组件选项
31
- const props = omit(config, ['showMask']);
37
+ const props = (0, omit_1.default)(config, ['showMask']);
32
38
  props.onCancel = () => __awaiter(this, void 0, void 0, function* () {
33
39
  var _a;
34
40
  yield closeDialog();
@@ -40,9 +46,9 @@ export function showAlert(option) {
40
46
  (_a = config.onConfirm) === null || _a === void 0 ? void 0 : _a.call(config);
41
47
  });
42
48
  // 创建对话框
43
- const closeDialog = showDialog({
49
+ const closeDialog = (0, Dialog_1.showDialog)({
44
50
  showMask: typeof config.showMask === 'undefined' ? true : !!config.showMask,
45
- content: _jsx(AlertWrapper, Object.assign({}, props)),
51
+ content: (0, jsx_runtime_1.jsx)(Wrapper_1.AlertWrapper, Object.assign({}, props)),
46
52
  });
47
53
  // 返回关闭逻辑
48
54
  return closeDialog;
@@ -1,17 +1,15 @@
1
- import { adaptive } from "../utils/cssUtil";
2
- export const style = {
3
- container: [
4
- {
5
- position: "relative",
6
- overflow: "hidden",
7
- backgroundColor: "#fff",
8
- boxShadow: "0 0 2px 0 #00000055",
9
- },
10
- adaptive({
11
- borderRadius: 16,
12
- width: 750 * 0.84,
13
- }),
14
- ],
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.style = void 0;
4
+ exports.style = {
5
+ container: {
6
+ position: "relative",
7
+ overflow: "hidden",
8
+ backgroundColor: "#fff",
9
+ boxShadow: "0 0 2px 0 #00000055",
10
+ borderRadius: '.16rem',
11
+ width: 750 * 0.84 / 100 + 'rem',
12
+ },
15
13
  content: {
16
14
  position: "relative",
17
15
  "&:after,&::after": {
@@ -25,38 +23,30 @@ export const style = {
25
23
  transform: `scale(1, ${1 / window.devicePixelRatio})`,
26
24
  },
27
25
  },
28
- title: [
29
- {
30
- textAlign: "center",
31
- lineHeight: 1.4,
32
- color: "#000",
33
- },
34
- adaptive({
35
- paddingTop: 50,
36
- paddingLeft: 40,
37
- paddingRight: 40,
38
- paddingBottom: 50,
39
- fontSize: 33,
40
- }),
41
- ],
42
- desc: [
43
- {
44
- textAlign: "center",
45
- lineHeight: 1.4,
46
- color: "#666",
47
- },
48
- adaptive({
49
- paddingTop: 20,
50
- paddingLeft: 40,
51
- paddingRight: 40,
52
- paddingBottom: 50,
53
- fontSize: 29,
54
- }),
55
- ],
56
- btnBox: adaptive({
26
+ title: {
27
+ textAlign: "center",
28
+ lineHeight: 1.4,
29
+ color: "#000",
30
+ paddingTop: '.5rem',
31
+ paddingLeft: '.4rem',
32
+ paddingRight: '.4rem',
33
+ paddingBottom: '.5rem',
34
+ fontSize: '.33rem',
35
+ },
36
+ desc: {
37
+ textAlign: "center",
38
+ lineHeight: 1.4,
39
+ color: "#666",
40
+ paddingTop: '.2rem',
41
+ paddingLeft: '.4rem',
42
+ paddingRight: '.4rem',
43
+ paddingBottom: '.5rem',
44
+ fontSize: '.29rem',
45
+ },
46
+ btnBox: {
57
47
  position: "relative",
58
- height: 90,
59
- }),
48
+ height: '.9rem',
49
+ },
60
50
  btnBoxWithCancel: {
61
51
  "&:after,&::after": {
62
52
  content: "''",
@@ -70,17 +60,13 @@ export const style = {
70
60
  transform: `scale(${1 / window.devicePixelRatio}, 1)`,
71
61
  },
72
62
  },
73
- btn: [
74
- {
75
- flex: 1,
76
- display: "flex",
77
- alignItems: "center",
78
- justifyContent: "center",
79
- userSelect: "none",
80
- letterSpacing: "1px",
81
- },
82
- adaptive({
83
- fontSize: 33,
84
- }),
85
- ],
63
+ btn: {
64
+ flex: 1,
65
+ display: "flex",
66
+ alignItems: "center",
67
+ justifyContent: "center",
68
+ userSelect: "none",
69
+ letterSpacing: "1px",
70
+ fontSize: '.33rem',
71
+ },
86
72
  };
@@ -1,3 +1,37 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
1
35
  var __rest = (this && this.__rest) || function (s, e) {
2
36
  var t = {};
3
37
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -9,24 +43,25 @@ var __rest = (this && this.__rest) || function (s, e) {
9
43
  }
10
44
  return t;
11
45
  };
12
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
- import React, { useCallback } from 'react';
14
- import { style } from './style';
15
- import { normalizeUnit } from '../utils/cssUtil';
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.AutoGrid = AutoGrid;
48
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
49
+ const react_1 = __importStar(require("react"));
50
+ const style_1 = require("./style");
51
+ const cssUtil_1 = require("../utils/cssUtil");
16
52
  /**
17
53
  * 自动化生成表格
18
54
  * @param props
19
55
  */
20
- export function AutoGrid(props) {
56
+ function AutoGrid(props) {
21
57
  const { children, cols: rawCols = 1, gap: rawGap = 0, isSquare = false, itemStyle, containerStyle } = props, extra = __rest(props, ["children", "cols", "gap", "isSquare", "itemStyle", "containerStyle"]);
22
- // 规范化数字单位
23
- const cols = +rawCols;
24
- const gap = normalizeUnit(rawGap);
25
- // 获取表格数据
26
- const getGridData = useCallback(() => {
27
- // 生成一个能创建表格的二维数组
28
- let list = [];
29
- React.Children.forEach(children, (child) => {
58
+ // 规范化,确保 cols >= 1
59
+ const cols = Math.max(1, Math.floor(+rawCols) || 1);
60
+ const gap = (0, cssUtil_1.normalizeUnit)(rawGap);
61
+ // 将 children 分组为二维数组
62
+ const gridData = (0, react_1.useMemo)(() => {
63
+ const list = [];
64
+ react_1.default.Children.forEach(children, (child) => {
30
65
  if (child !== null && child !== undefined) {
31
66
  if (list.length === 0 || list[list.length - 1].length >= cols) {
32
67
  list.push([]);
@@ -38,43 +73,26 @@ export function AutoGrid(props) {
38
73
  if (list.length > 0) {
39
74
  const lastRow = list[list.length - 1];
40
75
  while (lastRow.length < cols) {
41
- lastRow.push(_jsx("div", { style: { visibility: 'hidden' } }, `placeholder-${lastRow.length}`));
76
+ lastRow.push(null);
42
77
  }
43
78
  }
44
79
  return list;
45
80
  }, [children, cols]);
46
- // 元素的最终样式
47
- const finalItemBoxStyle = [
48
- style.itemBoxStyle,
49
- {
50
- marginRight: gap,
51
- width: `calc((100% - ${cols - 1} * ${gap}) / ${cols})`,
52
- },
53
- ];
54
- /**
55
- * 显示内容
56
- */
57
- const showContent = () => {
58
- const gridData = getGridData();
59
- return gridData.map((row, rowIndex) => {
60
- // 每行的槽样式,最后一行没有
61
- let finalRowStyle = [
62
- style.rowStyle,
63
- rowIndex !== gridData.length - 1 ? { marginBottom: gap } : {}
64
- ];
65
- return (_jsx("div", { css: finalRowStyle, children: row.map((item, colIndex) => {
66
- let finalCss = [
67
- ...finalItemBoxStyle,
68
- itemStyle
69
- ];
70
- if (isSquare) {
71
- return (_jsx("div", { css: [...finalCss, style.itemBoxSquare], children: _jsx("div", { css: style.itemInnerStyle, children: item }) }, colIndex));
72
- }
73
- else {
74
- return (_jsx("div", { css: finalCss, children: item }, colIndex));
75
- }
76
- }) }, rowIndex));
77
- });
78
- };
79
- return (_jsx("div", Object.assign({}, extra, { css: [containerStyle], children: showContent() })));
81
+ // 缓存 item 宽度计算
82
+ const itemWidth = (0, react_1.useMemo)(() => `calc((100% - ${cols - 1} * ${gap}) / ${cols})`, [cols, gap]);
83
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, extra, { css: containerStyle, children: gridData.map((row, rowIndex) => ((0, jsx_runtime_1.jsx)("div", { css: [
84
+ style_1.style.row,
85
+ { gap },
86
+ rowIndex !== gridData.length - 1 ? { marginBottom: gap } : undefined,
87
+ ], children: row.map((item, colIndex) => {
88
+ const isPlaceholder = item === null;
89
+ const boxCss = [
90
+ style_1.style.itemBox,
91
+ { width: itemWidth },
92
+ isPlaceholder ? { visibility: 'hidden' } : undefined,
93
+ isSquare ? style_1.style.itemBoxSquare : undefined,
94
+ itemStyle,
95
+ ];
96
+ return isSquare ? ((0, jsx_runtime_1.jsx)("div", { css: boxCss, children: (0, jsx_runtime_1.jsx)("div", { css: style_1.style.itemInner, children: item }) }, colIndex)) : ((0, jsx_runtime_1.jsx)("div", { css: boxCss, children: item }, colIndex));
97
+ }) }, rowIndex))) })));
80
98
  }
@@ -1,7 +1,6 @@
1
1
  export declare const style: {
2
- itemBoxStyle: import("@emotion/react").SerializedStyles;
2
+ row: import("@emotion/react").SerializedStyles;
3
+ itemBox: import("@emotion/react").SerializedStyles;
3
4
  itemBoxSquare: import("@emotion/react").SerializedStyles;
4
- itemNull: import("@emotion/react").SerializedStyles;
5
- itemInnerStyle: import("@emotion/react").SerializedStyles;
6
- rowStyle: import("@emotion/react").SerializedStyles;
5
+ itemInner: import("@emotion/react").SerializedStyles;
7
6
  };
@@ -1,13 +1,17 @@
1
- import { css } from "@emotion/react";
2
- export const style = {
3
- itemBoxStyle: css({
4
- float: "left",
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.style = void 0;
4
+ const react_1 = require("@emotion/react");
5
+ exports.style = {
6
+ row: (0, react_1.css)({
7
+ display: "flex",
8
+ width: "100%",
9
+ }),
10
+ itemBox: (0, react_1.css)({
5
11
  position: "relative",
6
- "&:last-child": {
7
- marginRight: 0,
8
- },
12
+ minWidth: 0,
9
13
  }),
10
- itemBoxSquare: css({
14
+ itemBoxSquare: (0, react_1.css)({
11
15
  "&:after,&::after": {
12
16
  content: "''",
13
17
  display: "block",
@@ -16,24 +20,11 @@ export const style = {
16
20
  paddingBottom: "100%",
17
21
  },
18
22
  }),
19
- itemNull: css({
20
- visibility: "hidden",
21
- }),
22
- itemInnerStyle: css({
23
+ itemInner: (0, react_1.css)({
23
24
  position: "absolute",
24
25
  left: 0,
25
26
  right: 0,
26
27
  bottom: 0,
27
28
  top: 0,
28
29
  }),
29
- // 行样式
30
- rowStyle: css({
31
- width: "100%",
32
- "&:after,&::after": {
33
- content: "''",
34
- display: "table",
35
- height: 0,
36
- clear: "both"
37
- }
38
- })
39
30
  };
@@ -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,32 @@ 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 { useState, useEffect } from 'react';
15
- import { useInterval } from '../Effect/useInterval';
16
- import { style, Bubble } from './style';
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.CarouselNotice = CarouselNotice;
15
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
16
+ const react_1 = require("@emotion/react");
17
+ const react_2 = require("react");
18
+ const useInterval_1 = require("../Effect/useInterval");
19
+ const style_1 = require("./style");
17
20
  /**
18
21
  * 滚动循环轮播公告
19
22
  * @param props
20
23
  */
21
- export function CarouselNotice(props) {
24
+ function CarouselNotice(props) {
22
25
  const { width, height, justify = 'center', interval = 3000, duration = 200, list = [], containerStyle, wrapperStyle, itemStyle } = props, attrs = __rest(props, ["width", "height", "justify", "interval", "duration", "list", "containerStyle", "wrapperStyle", "itemStyle"]);
23
- const [current, setCurrent] = useState(0);
24
- const [animation, setAnimation] = useState(false);
26
+ const [current, setCurrent] = (0, react_2.useState)(0);
27
+ const [animation, setAnimation] = (0, react_2.useState)(false);
25
28
  /**
26
29
  * 一旦列表发生更新时,触发的逻辑
27
30
  */
28
- useEffect(() => {
31
+ (0, react_2.useEffect)(() => {
29
32
  setCurrent(0);
30
33
  setAnimation(false);
31
34
  }, [list]);
32
35
  /**
33
36
  * 每隔多少秒更新一次动画
34
37
  */
35
- useInterval(() => {
38
+ (0, useInterval_1.useInterval)(() => {
36
39
  setAnimation(true);
37
40
  }, list.length > 1 ? interval : null);
38
41
  /**
@@ -52,18 +55,18 @@ export function CarouselNotice(props) {
52
55
  else {
53
56
  justifyStyle.justifyContent = 'center';
54
57
  }
55
- const itemCss = [style.item, justifyStyle];
58
+ const itemCss = [style_1.style.item, justifyStyle];
56
59
  if (list.length === 1) {
57
- return (_jsx("div", { css: [itemCss, itemStyle], children: list[0] }, 0));
60
+ return ((0, jsx_runtime_1.jsx)("div", { css: [itemCss, itemStyle], children: list[0] }, 0));
58
61
  }
59
62
  const showList = [];
60
63
  if (current === list.length - 1) {
61
- showList.push(_jsx("div", { css: [itemCss, itemStyle], children: list[list.length - 1] }, current));
62
- showList.push(_jsx("div", { css: [itemCss, itemStyle], children: list[0] }, 0));
64
+ showList.push((0, jsx_runtime_1.jsx)("div", { css: [itemCss, itemStyle], children: list[list.length - 1] }, current));
65
+ showList.push((0, jsx_runtime_1.jsx)("div", { css: [itemCss, itemStyle], children: list[0] }, 0));
63
66
  }
64
67
  else {
65
- showList.push(_jsx("div", { css: [itemCss, itemStyle], children: list[current] }, current));
66
- showList.push(_jsx("div", { css: [itemCss, itemStyle], children: list[current + 1] }, current + 1));
68
+ showList.push((0, jsx_runtime_1.jsx)("div", { css: [itemCss, itemStyle], children: list[current] }, current));
69
+ showList.push((0, jsx_runtime_1.jsx)("div", { css: [itemCss, itemStyle], children: list[current + 1] }, current + 1));
67
70
  }
68
71
  return showList;
69
72
  };
@@ -74,8 +77,8 @@ export function CarouselNotice(props) {
74
77
  if (!animation || list.length <= 1) {
75
78
  return null;
76
79
  }
77
- return css({
78
- animationName: Bubble,
80
+ return (0, react_1.css)({
81
+ animationName: style_1.Bubble,
79
82
  animationTimingFunction: 'linear',
80
83
  animationDuration: `${duration}ms`,
81
84
  });
@@ -92,5 +95,5 @@ export function CarouselNotice(props) {
92
95
  setAnimation(false);
93
96
  };
94
97
  return (Array.isArray(list) &&
95
- list.length > 0 && (_jsx("div", Object.assign({}, attrs, { css: [style.box, { width, height }, containerStyle], children: _jsx("div", { onAnimationEnd: animationEnd, css: [style.wrapper, getAnimation(), wrapperStyle], children: showContent() }) }))));
98
+ list.length > 0 && ((0, jsx_runtime_1.jsx)("div", Object.assign({}, attrs, { css: [style_1.style.box, { width, height }, containerStyle], children: (0, jsx_runtime_1.jsx)("div", { onAnimationEnd: animationEnd, css: [style_1.style.wrapper, getAnimation(), wrapperStyle], children: showContent() }) }))));
96
99
  }
@@ -1,6 +1,8 @@
1
- import { keyframes } from "@emotion/react";
2
- import { adaptive } from "../utils/cssUtil";
3
- export const Bubble = keyframes `
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.style = exports.Bubble = void 0;
4
+ const react_1 = require("@emotion/react");
5
+ exports.Bubble = (0, react_1.keyframes) `
4
6
  from {
5
7
  transform: translateY(0);
6
8
  }
@@ -8,17 +10,13 @@ export const Bubble = keyframes `
8
10
  transform: translateY(-50%);
9
11
  }
10
12
  `;
11
- export const style = {
12
- box: [
13
- {
14
- position: "relative",
15
- overflow: "hidden",
16
- transition: "all 200ms",
17
- },
18
- adaptive({
19
- height: 80,
20
- }),
21
- ],
13
+ exports.style = {
14
+ box: {
15
+ position: "relative",
16
+ overflow: "hidden",
17
+ transition: "all 200ms",
18
+ height: '.8rem',
19
+ },
22
20
  wrapper: {
23
21
  position: "absolute",
24
22
  left: 0,
@@ -0,0 +1,3 @@
1
+ import type { ProvinceData, CityData } from './type';
2
+ export declare const provinceData: ProvinceData;
3
+ export declare const cityData: CityData;