clxx 2.1.2 → 2.1.4

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 (89) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +768 -35
  3. package/build/Ago/index.d.ts +0 -1
  4. package/build/Alert/Wrapper.d.ts +0 -1
  5. package/build/Alert/Wrapper.js +12 -12
  6. package/build/Alert/index.js +2 -2
  7. package/build/AutoGrid/index.js +16 -21
  8. package/build/AutoGrid/style.d.ts +5 -5
  9. package/build/CarouselNotice/index.d.ts +0 -1
  10. package/build/CarouselNotice/index.js +6 -6
  11. package/build/CarouselNotice/style.d.ts +6 -1
  12. package/build/CarouselNotice/style.js +7 -7
  13. package/build/Clickable/index.d.ts +5 -5
  14. package/build/Clickable/index.js +11 -8
  15. package/build/Container/index.d.ts +2 -2
  16. package/build/Container/index.js +85 -60
  17. package/build/Countdowner/index.d.ts +3 -3
  18. package/build/Countdowner/index.js +18 -11
  19. package/build/Dialog/Wrapper.d.ts +0 -1
  20. package/build/Dialog/Wrapper.js +7 -10
  21. package/build/Dialog/style.d.ts +15 -10
  22. package/build/Dialog/style.js +88 -88
  23. package/build/Effect/useInterval.d.ts +1 -1
  24. package/build/Effect/useInterval.js +1 -1
  25. package/build/Effect/useUpdate.d.ts +1 -1
  26. package/build/Effect/useUpdate.js +1 -1
  27. package/build/Effect/useWindowResize.d.ts +4 -2
  28. package/build/Effect/useWindowResize.js +28 -11
  29. package/build/Flex/index.d.ts +0 -1
  30. package/build/Indicator/index.js +22 -23
  31. package/build/Indicator/style.d.ts +6 -1
  32. package/build/Indicator/style.js +7 -7
  33. package/build/Loading/Wrapper.js +2 -2
  34. package/build/Loading/style.d.ts +12 -2
  35. package/build/Loading/style.js +14 -14
  36. package/build/Overlay/index.d.ts +1 -1
  37. package/build/Overlay/index.js +41 -37
  38. package/build/SafeArea/index.d.ts +1 -2
  39. package/build/SafeArea/index.js +6 -6
  40. package/build/ScrollView/index.d.ts +1 -1
  41. package/build/ScrollView/index.js +111 -27
  42. package/build/Toast/Toast.js +4 -4
  43. package/build/Toast/style.d.ts +42 -12
  44. package/build/Toast/style.js +54 -54
  45. package/build/index.d.ts +3 -0
  46. package/build/index.js +3 -0
  47. package/build/utils/Countdown.d.ts +3 -1
  48. package/build/utils/Countdown.js +5 -2
  49. package/build/utils/createApp.d.ts +14 -13
  50. package/build/utils/createApp.js +58 -42
  51. package/build/utils/cssUtil.d.ts +2 -2
  52. package/build/utils/cssUtil.js +24 -13
  53. package/build/utils/defaultScroll.d.ts +0 -1
  54. package/build/utils/defaultScroll.js +8 -5
  55. package/build/utils/is.d.ts +23 -4
  56. package/build/utils/is.js +97 -15
  57. package/build/utils/jsonp.js +2 -2
  58. package/build/utils/request.js +12 -2
  59. package/package.json +15 -12
  60. package/test/README.md +16 -0
  61. package/test/eslint.config.js +29 -0
  62. package/test/index.html +13 -0
  63. package/test/jsconfig.json +8 -0
  64. package/test/package.json +27 -0
  65. package/test/public/vite.svg +1 -0
  66. package/test/src/ago/index.jsx +30 -0
  67. package/test/src/alert/index.jsx +111 -0
  68. package/test/src/autogrid/index.css +0 -0
  69. package/test/src/autogrid/index.jsx +26 -0
  70. package/test/src/carouse-notice/index.jsx +59 -0
  71. package/test/src/clickable/index.css +21 -0
  72. package/test/src/clickable/index.jsx +39 -0
  73. package/test/src/countdown/index.jsx +95 -0
  74. package/test/src/dialog/index.jsx +104 -0
  75. package/test/src/dialog/index.module.css +5 -0
  76. package/test/src/image-picker/index.css +0 -0
  77. package/test/src/image-picker/index.jsx +88 -0
  78. package/test/src/index/index.jsx +46 -0
  79. package/test/src/index.css +49 -0
  80. package/test/src/index.jsx +31 -0
  81. package/test/src/indicator/index.jsx +25 -0
  82. package/test/src/loading/index.jsx +36 -0
  83. package/test/src/overlay/index.jsx +31 -0
  84. package/test/src/privacy/index.css +13 -0
  85. package/test/src/privacy/index.jsx +34 -0
  86. package/test/src/scrollview/index.css +10 -0
  87. package/test/src/scrollview/index.jsx +52 -0
  88. package/test/src/toast/index.jsx +86 -0
  89. package/test/vite.config.js +15 -0
@@ -0,0 +1,10 @@
1
+ .ScrollView {
2
+ height: 400px;
3
+ background-color: #f4f5f6;
4
+ padding: 0 0.1rem;
5
+ border: 1px solid #000;
6
+ .content {
7
+ height: 500px;
8
+ background-image: linear-gradient(to top, #fff, green);
9
+ }
10
+ }
@@ -0,0 +1,52 @@
1
+ import "./index.css";
2
+ import React, { useRef, useState } from "react";
3
+ import { ScrollView } from "@";
4
+
5
+ export default function Index() {
6
+ const [list, setList] = useState([1]);
7
+ const isLoading = useRef(false);
8
+ const [showLoading, setShowLoading] = useState(true);
9
+
10
+ const loadMore = async () => {
11
+ if (!showLoading) return;
12
+
13
+ isLoading.current = true;
14
+ return new Promise((resolve) => {
15
+ window.setTimeout(() => {
16
+ const num = list.length + 1;
17
+ list.push(num);
18
+ setList([...list]);
19
+ resolve();
20
+ isLoading.current = false;
21
+ if (num > 5) {
22
+ setShowLoading(false);
23
+ }
24
+ }, 800);
25
+ });
26
+ };
27
+
28
+ return (
29
+ <div className="ScrollView">
30
+ <ScrollView
31
+ onReachTop={(e) => {
32
+ console.log("reachTop", e);
33
+ }}
34
+ onReachBottom={(e) => {
35
+ console.log("reachBottom", e);
36
+ if (!isLoading.current) {
37
+ loadMore();
38
+ }
39
+ }}
40
+ showLoading={showLoading}
41
+ >
42
+ {list.map((item, index) => {
43
+ return (
44
+ <div className="content" key={index}>
45
+ {item}
46
+ </div>
47
+ );
48
+ })}
49
+ </ScrollView>
50
+ </div>
51
+ );
52
+ }
@@ -0,0 +1,86 @@
1
+ import React from "react";
2
+ import { showToast, showUniqToast } from "@";
3
+
4
+ export default function Index () {
5
+ return (
6
+ <div>
7
+ <p>toast内容为纯文本</p>
8
+ <button
9
+ onClick={() => {
10
+ showToast("一个简单的Toast轻提示");
11
+ }}
12
+ >
13
+ 显示Toast,默认屏幕居中
14
+ </button>
15
+
16
+ <p>toast内容为可定制组件</p>
17
+ <button
18
+ onClick={() => {
19
+ showToast(
20
+ <div style={{ border: "1px solid red", background: "green" }}>
21
+ 一个简单的<span style={{ color: "red" }}>Toast</span>轻提示
22
+ </div>
23
+ );
24
+ }}
25
+ >
26
+ 显示Toast
27
+ </button>
28
+
29
+ <p>toast内容在顶部显示</p>
30
+ <button
31
+ onClick={() => {
32
+ showToast({
33
+ content: "抱歉,发生了很多错误",
34
+ position: "top",
35
+ });
36
+ }}
37
+ >
38
+ 显示Toast
39
+ </button>
40
+
41
+ <p>toast内容在底部显示</p>
42
+ <button
43
+ onClick={() => {
44
+ showToast({
45
+ content: "一个简单的Toast轻提示Toast轻提示Toast轻提示Toast轻提示",
46
+ position: "bottom",
47
+ });
48
+ }}
49
+ >
50
+ 显示Toast
51
+ </button>
52
+
53
+ <p>内容非常长的Toast</p>
54
+ <button
55
+ onClick={() => {
56
+ showToast(
57
+ "这是一个内容非常长的提示,你看看它的内容到底有多么的长,长度超出屏幕的宽度"
58
+ );
59
+ }}
60
+ >
61
+ 显示Toast
62
+ </button>
63
+
64
+ <p>全局唯一的Toast</p>
65
+ <button
66
+ onClick={() => {
67
+ showUniqToast("全局唯一的Toast");
68
+ }}
69
+ >
70
+ 显示Toast
71
+ </button>
72
+ <p>全局唯一的顶部Toast,永不消失</p>
73
+ <button
74
+ onClick={() => {
75
+ showUniqToast({
76
+ content: "全局唯一的Toast顶部",
77
+ position: "top",
78
+ duration: 10000000
79
+ });
80
+ }}
81
+ >
82
+ 显示Toast
83
+ </button>
84
+ </div>
85
+ );
86
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import path from "path";
4
+
5
+ // https://vite.dev/config/
6
+ export default defineConfig({
7
+ plugins: [react()],
8
+ resolve: {
9
+ alias: {
10
+ "@": path.resolve(__dirname, "../build/index"),
11
+ react: path.resolve(__dirname, "node_modules/react"),
12
+ "react-dom": path.resolve(__dirname, "node_modules/react-dom"),
13
+ },
14
+ },
15
+ });