taro-react-uilib 1.1.0 → 1.2.0
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.
- package/CHANGELOG.md +38 -0
- package/dist/components/Checkbox/Group/index.js +2 -0
- package/dist/components/Checkbox/Group/index.js.map +1 -0
- package/dist/components/Checkbox/index.js +2 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Picker/Picker.js +1 -1
- package/dist/components/Picker/Picker.js.map +1 -1
- package/dist/components/Picker/index.js +1 -1
- package/dist/components/Picker/index.js.map +1 -1
- package/dist/components/PickerSlot/index.js +2 -0
- package/dist/components/PickerSlot/index.js.map +1 -0
- package/dist/components/Radio/Group/index.js +2 -0
- package/dist/components/Radio/Group/index.js.map +1 -0
- package/dist/components/Radio/index.js +2 -0
- package/dist/components/Radio/index.js.map +1 -0
- package/dist/components/Space/Item.js +2 -0
- package/dist/components/Space/Item.js.map +1 -0
- package/dist/components/Space/config-provider.js +2 -0
- package/dist/components/Space/config-provider.js.map +1 -0
- package/dist/components/Space/index.js +2 -0
- package/dist/components/Space/index.js.map +1 -0
- package/dist/components/Step/Steps/index.js +2 -0
- package/dist/components/Step/Steps/index.js.map +1 -0
- package/dist/components/Step/index.js +2 -0
- package/dist/components/Step/index.js.map +1 -0
- package/dist/components/ThemeProvider/index.js +1 -1
- package/dist/components/ThemeProvider/index.js.map +1 -1
- package/dist/components/node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js +172 -0
- package/dist/components/node_modules/css-vars-ponyfill/dist/css-vars-ponyfill.esm.js.map +1 -0
- package/dist/components/src/hooks/index.js +1 -1
- package/dist/components/src/hooks/index.js.map +1 -1
- package/dist/components/src/hooks/useFlexGapSupport.js +2 -0
- package/dist/components/src/hooks/useFlexGapSupport.js.map +1 -0
- package/dist/components/src/hooks/useGenerateId.js +2 -0
- package/dist/components/src/hooks/useGenerateId.js.map +1 -0
- package/dist/components/src/hooks/useRefs.js +2 -0
- package/dist/components/src/hooks/useRefs.js.map +1 -0
- package/dist/components/src/hooks/useTouch.js +2 -0
- package/dist/components/src/hooks/useTouch.js.map +1 -0
- package/dist/components/src/index.js +1 -1
- package/dist/components/src/utils/index.js +1 -1
- package/dist/components/src/utils/index.js.map +1 -1
- package/dist/index.js +173 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +173 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/styles/components/checkbox.scss +117 -0
- package/dist/styles/components/dialog.scss +2 -0
- package/dist/styles/components/font/.DS_Store +0 -0
- package/dist/styles/components/index.scss +5 -0
- package/dist/styles/components/numberkeyboard.scss +1 -3
- package/dist/styles/components/picker.scss +7 -112
- package/dist/styles/components/pickerslot.scss +98 -0
- package/dist/styles/components/radio.scss +102 -0
- package/dist/styles/components/space.scss +37 -0
- package/dist/styles/components/step.scss +173 -0
- package/dist/styles/components/themeprovider.scss +3 -0
- package/dist/styles/components/toast.scss +1 -1
- package/dist/styles/index.scss +1 -1
- package/dist/styles/themes/default.scss +13 -13
- package/dist/styles/themes/variable.scss +2 -0
- package/lib/components/Checkbox/Group/index.js +49 -0
- package/lib/components/Checkbox/Group/index.js.map +1 -0
- package/lib/components/Checkbox/index.js +43 -0
- package/lib/components/Checkbox/index.js.map +1 -0
- package/lib/components/Picker/Picker.js +192 -96
- package/lib/components/Picker/Picker.js.map +1 -1
- package/lib/components/Picker/index.js +2 -5
- package/lib/components/Picker/index.js.map +1 -1
- package/lib/components/PickerSlot/index.js +226 -0
- package/lib/components/PickerSlot/index.js.map +1 -0
- package/lib/components/Radio/Group/index.js +56 -0
- package/lib/components/Radio/Group/index.js.map +1 -0
- package/lib/components/Radio/index.js +43 -0
- package/lib/components/Radio/index.js.map +1 -0
- package/lib/components/Space/Item.js +25 -0
- package/lib/components/Space/Item.js.map +1 -0
- package/lib/components/Space/config-provider.js +8 -0
- package/lib/components/Space/config-provider.js.map +1 -0
- package/lib/components/Space/index.js +77 -0
- package/lib/components/Space/index.js.map +1 -0
- package/lib/components/Step/Steps/index.js +31 -0
- package/lib/components/Step/Steps/index.js.map +1 -0
- package/lib/components/Step/index.js +19 -0
- package/lib/components/Step/index.js.map +1 -0
- package/lib/components/ThemeProvider/index.js +4 -0
- package/lib/components/ThemeProvider/index.js.map +1 -1
- package/lib/hooks/index.js +0 -34
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useFlexGapSupport.js +10 -0
- package/lib/hooks/useFlexGapSupport.js.map +1 -0
- package/lib/hooks/useGenerateId.js +12 -0
- package/lib/hooks/useGenerateId.js.map +1 -0
- package/lib/hooks/useRefs.js +13 -0
- package/lib/hooks/useRefs.js.map +1 -0
- package/lib/hooks/useTouch.js +67 -0
- package/lib/hooks/useTouch.js.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +39 -2
- package/lib/utils/index.js.map +1 -1
- package/package.json +2 -1
- package/types/components/Checkbox/Group/index.d.ts +23 -0
- package/types/components/Checkbox/index.d.ts +29 -0
- package/types/components/Picker/Picker.d.ts +21 -20
- package/types/components/Picker/index.d.ts +6 -7
- package/types/components/PickerSlot/index.d.ts +24 -0
- package/types/components/Radio/Group/index.d.ts +26 -0
- package/types/components/Radio/index.d.ts +29 -0
- package/types/components/Space/Item.d.ts +11 -0
- package/types/components/Space/config-provider.d.ts +12 -0
- package/types/components/Space/index.d.ts +21 -0
- package/types/components/Step/Steps/index.d.ts +13 -0
- package/types/components/Step/index.d.ts +18 -0
- package/types/hooks/index.d.ts +0 -22
- package/types/hooks/useFlexGapSupport.d.ts +2 -0
- package/types/hooks/useGenerateId.d.ts +1 -0
- package/types/hooks/useRefs.d.ts +1 -0
- package/types/hooks/useTouch.d.ts +18 -0
- package/types/index.d.ts +4 -0
- package/types/utils/index.d.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFlexGapSupport.js","sourceRoot":"","sources":["../../src/hooks/useFlexGapSupport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAe,GAAG,EAAE;IAClB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,WAAW,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACxC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
export default function (id, prefix) {
|
|
3
|
+
const [finalId, setId] = useState(id);
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
setId(`${prefix}${(Math.random() * 1000)
|
|
6
|
+
.toString()
|
|
7
|
+
.replace(".", "")
|
|
8
|
+
.slice(0, 20)}`);
|
|
9
|
+
}, []);
|
|
10
|
+
return finalId;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=useGenerateId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGenerateId.js","sourceRoot":"","sources":["../../src/hooks/useGenerateId.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,MAAe;IAC1C,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACtC,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,CACH,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;aAC/B,QAAQ,EAAE;aACV,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;aAChB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAClB,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export default function useRefs() {
|
|
3
|
+
const refs = React.useRef([]);
|
|
4
|
+
const setRefs = React.useCallback((index) => (el) => {
|
|
5
|
+
if (el)
|
|
6
|
+
refs.current[index] = el;
|
|
7
|
+
}, []);
|
|
8
|
+
const reset = React.useCallback(() => {
|
|
9
|
+
refs.current = [];
|
|
10
|
+
}, []);
|
|
11
|
+
return [refs.current, setRefs, reset];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=useRefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRefs.js","sourceRoot":"","sources":["../../src/hooks/useRefs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAmB,EAAE,CAAC,CAAC;IAEhD,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAC/B,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,EAAkB,EAAE,EAAE;QACxC,IAAI,EAAE;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACnC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAc,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
const MIN_DISTANCE = 10;
|
|
3
|
+
function getDirection(x, y) {
|
|
4
|
+
if (x > y && x > MIN_DISTANCE) {
|
|
5
|
+
return "horizontal";
|
|
6
|
+
}
|
|
7
|
+
if (y > x && y > MIN_DISTANCE) {
|
|
8
|
+
return "vertical";
|
|
9
|
+
}
|
|
10
|
+
return "";
|
|
11
|
+
}
|
|
12
|
+
export function useTouch() {
|
|
13
|
+
const [startX, SetStartX] = useState(0);
|
|
14
|
+
const [startY, SetStartY] = useState(0);
|
|
15
|
+
const [moveX, SetMoveX] = useState(0);
|
|
16
|
+
const [moveY, SetMoveY] = useState(0);
|
|
17
|
+
const [deltaX, SetDeltaX] = useState(0);
|
|
18
|
+
const [deltaY, SetDeltaY] = useState(0);
|
|
19
|
+
const [offsetX, SetOffsetX] = useState(0);
|
|
20
|
+
const [offsetY, SetOffsetY] = useState(0);
|
|
21
|
+
const [direction, SetDirection] = useState("");
|
|
22
|
+
const isVertical = () => direction === "vertical";
|
|
23
|
+
const isHorizontal = () => direction === "horizontal";
|
|
24
|
+
const reset = () => {
|
|
25
|
+
SetDeltaX(0);
|
|
26
|
+
SetDeltaY(0);
|
|
27
|
+
SetOffsetX(0);
|
|
28
|
+
SetOffsetY(0);
|
|
29
|
+
SetDirection("");
|
|
30
|
+
};
|
|
31
|
+
const start = ((event) => {
|
|
32
|
+
reset();
|
|
33
|
+
SetStartX(event.touches[0].clientX);
|
|
34
|
+
SetStartY(event.touches[0].clientY);
|
|
35
|
+
});
|
|
36
|
+
const move = ((event) => {
|
|
37
|
+
const touch = event.touches[0];
|
|
38
|
+
const dX = touch.clientX - startX;
|
|
39
|
+
const dY = touch.clientY - startY;
|
|
40
|
+
SetDeltaX(dX);
|
|
41
|
+
SetDeltaY(dY);
|
|
42
|
+
SetMoveX(touch.clientX);
|
|
43
|
+
SetMoveY(touch.clientY);
|
|
44
|
+
SetOffsetX(Math.abs(dX));
|
|
45
|
+
SetOffsetY(Math.abs(dY));
|
|
46
|
+
if (!direction) {
|
|
47
|
+
SetDirection(getDirection(offsetX, offsetY));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
move,
|
|
52
|
+
start,
|
|
53
|
+
reset,
|
|
54
|
+
startX,
|
|
55
|
+
startY,
|
|
56
|
+
moveX,
|
|
57
|
+
moveY,
|
|
58
|
+
deltaX,
|
|
59
|
+
deltaY,
|
|
60
|
+
offsetX,
|
|
61
|
+
offsetY,
|
|
62
|
+
direction,
|
|
63
|
+
isVertical,
|
|
64
|
+
isHorizontal,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=useTouch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTouch.js","sourceRoot":"","sources":["../../src/hooks/useTouch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,YAAY,GAAG,EAAE,CAAC;AAIxB,SAAS,YAAY,CAAC,CAAS,EAAE,CAAS;IACxC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,EAAE;QAC7B,OAAO,YAAY,CAAC;KACrB;IACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,EAAE;QAC7B,OAAO,UAAU,CAAC;KACnB;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CA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,SAAS,CAAC,EAAE,CAAC,CAAC;QACd,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxB,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACzB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,SAAS,EAAE;YACd,YAAY,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;SAC9C;IACH,CAAC,CAAkB,CAAC;IAEpB,OAAO;QACL,IAAI;QACJ,KAAK;QACL,KAAK;QACL,MAAM;QACN,MAAM;QACN,KAAK;QACL,KAAK;QACL,MAAM;QACN,MAAM;QACN,OAAO;QACP,OAAO;QACP,SAAS;QACT,UAAU;QACV,YAAY;KACb,CAAC;AACJ,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -16,5 +16,9 @@ export { default as XHDialogRef } from "./components/DialogRef";
|
|
|
16
16
|
export { default as XHTabbar } from "./components/Tabbar";
|
|
17
17
|
export { default as XHPopup } from "./components/Popup";
|
|
18
18
|
export { default as XHPicker } from "./components/Picker";
|
|
19
|
+
export { default as XHSpace } from "./components/Space";
|
|
19
20
|
export { default as ThemeProvider } from "./components/ThemeProvider";
|
|
21
|
+
export { default as XHCheckbox } from "./components/Checkbox";
|
|
22
|
+
export { default as XHRadio } from "./components/Radio";
|
|
23
|
+
export { default as XHStep } from "./components/Step";
|
|
20
24
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OA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uB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @param {string} val - 输入内容
|
|
4
4
|
* @returns {boolean} - 校验结果 返回 true || false
|
|
5
5
|
*/
|
|
6
|
+
import React from "react";
|
|
6
7
|
export const inputRange = (val) => {
|
|
7
8
|
let iconRule1 = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi;
|
|
8
9
|
return val.replace(iconRule1, "");
|
|
@@ -54,8 +55,6 @@ export const throtte = (fn, delay = 1500) => {
|
|
|
54
55
|
return function (arg) {
|
|
55
56
|
if (canCall) {
|
|
56
57
|
canCall = false;
|
|
57
|
-
console.log(arg);
|
|
58
|
-
console.log("arg");
|
|
59
58
|
fn(arg);
|
|
60
59
|
}
|
|
61
60
|
timer = setTimeout(() => {
|
|
@@ -78,4 +77,42 @@ export function pxTransform(size, designWidth = 750) {
|
|
|
78
77
|
"rem");
|
|
79
78
|
return `${size / deviceRatio[designWidth]}rpx`;
|
|
80
79
|
}
|
|
80
|
+
let flexGapSupported;
|
|
81
|
+
export const detectFlexGapSupported = () => {
|
|
82
|
+
if (flexGapSupported !== undefined) {
|
|
83
|
+
return flexGapSupported;
|
|
84
|
+
}
|
|
85
|
+
const flex = document.createElement("div");
|
|
86
|
+
flex.style.display = "flex";
|
|
87
|
+
flex.style.flexDirection = "column";
|
|
88
|
+
flex.style.rowGap = "1px";
|
|
89
|
+
flex.appendChild(document.createElement("div"));
|
|
90
|
+
flex.appendChild(document.createElement("div"));
|
|
91
|
+
document.body.appendChild(flex);
|
|
92
|
+
flexGapSupported = flex.scrollHeight === 1;
|
|
93
|
+
document.body.removeChild(flex);
|
|
94
|
+
return flexGapSupported;
|
|
95
|
+
};
|
|
96
|
+
export function toArray(children, option = {}) {
|
|
97
|
+
let ret = [];
|
|
98
|
+
React.Children.forEach(children, (child) => {
|
|
99
|
+
if ((child === undefined || child === null) && !option.keepEmpty) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (Array.isArray(child)) {
|
|
103
|
+
ret = ret.concat(toArray(child));
|
|
104
|
+
}
|
|
105
|
+
else if (isFragment(child) && child.props) {
|
|
106
|
+
ret = ret.concat(toArray(child.props.children, option));
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
ret.push(child);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return ret;
|
|
113
|
+
}
|
|
114
|
+
function isFragment(object) {
|
|
115
|
+
return (object.$$typeof === Symbol.for("react.element") &&
|
|
116
|
+
object.type === Symbol.for("react.fragment"));
|
|
117
|
+
}
|
|
81
118
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE;IAChD,IAAI,SAAS,GACX,4OAA4O,CAAC;IAC/O,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,yBAAyB;AACzB,uBAAuB;AACvB,sBAAsB;AACtB,IAAI;AAEJ,oDAAoD;AACpD,mBAAmB;AACnB,cAAc;AACd,KAAK;AAEL,gDAAgD;AAChD,qDAAqD;AACrD,YAAY;AACZ,gBAAgB;AAChB,kBAAkB;AAClB,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aAAM,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE;YAC3C,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;SACzD;aAAM;YACL,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,UAAU,CAAC,MAAM;IACxB,OAAO,CACL,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC;QAC/C,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAC7C,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taro-react-uilib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "基于taro的跨端组件库",
|
|
5
5
|
"templateInfo": {
|
|
6
6
|
"name": "default",
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
|
+
"css-vars-ponyfill": "^2.4.8",
|
|
135
136
|
"react-transition-group": "^4.4.2"
|
|
136
137
|
}
|
|
137
138
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export declare type CheckBoxItemType = {
|
|
3
|
+
label: string | ReactNode;
|
|
4
|
+
value: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare type CheckBoxItem = Omit<CheckBoxItemType, "checked"> | string;
|
|
9
|
+
export declare type CheckboxGroupProps = {
|
|
10
|
+
option: CheckBoxItem[];
|
|
11
|
+
onChange?: (value: string[]) => void;
|
|
12
|
+
defaultChecked?: string[] | string;
|
|
13
|
+
padding?: true;
|
|
14
|
+
border?: boolean;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
checkboxStyle?: React.CSSProperties;
|
|
17
|
+
align?: "center" | "end";
|
|
18
|
+
direction?: "rtl";
|
|
19
|
+
justify?: "around" | "between";
|
|
20
|
+
color?: string;
|
|
21
|
+
};
|
|
22
|
+
declare const CheckboxGroup: React.FC<CheckboxGroupProps>;
|
|
23
|
+
export default CheckboxGroup;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { XHComponentCommonProps } from "@/types";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import Group from "./Group";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
declare type CompoundedComponent = React.ForwardRefExoticComponent<XHCheckboxProps & React.RefAttributes<HTMLInputElement>> & {
|
|
6
|
+
Group: typeof Group;
|
|
7
|
+
};
|
|
8
|
+
export declare type XHCheckboxProps = {
|
|
9
|
+
onChange?: (check: boolean, value: string) => void;
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
label: string | ReactNode;
|
|
13
|
+
size?: number;
|
|
14
|
+
circle?: boolean;
|
|
15
|
+
align?: "center" | "end";
|
|
16
|
+
direction?: "rtl";
|
|
17
|
+
justify?: "around" | "between";
|
|
18
|
+
value?: string | number;
|
|
19
|
+
id?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
/**
|
|
23
|
+
* 抖音不支持属性选择器
|
|
24
|
+
* @description 主要为抖音支持颜色
|
|
25
|
+
*/
|
|
26
|
+
color?: string;
|
|
27
|
+
} & XHComponentCommonProps;
|
|
28
|
+
declare const CheckBox: CompoundedComponent;
|
|
29
|
+
export default CheckBox;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface
|
|
3
|
-
|
|
4
|
-
title?: string | ReactNode;
|
|
5
|
-
data: T[];
|
|
6
|
-
ItemComponent?: (props: {
|
|
7
|
-
data: T;
|
|
8
|
-
}) => ReactNode;
|
|
9
|
-
Footer?: ReactNode;
|
|
10
|
-
onConfirm?: (value: T, index: number) => void;
|
|
11
|
-
onCancel?: MouseEventHandler;
|
|
12
|
-
onClose?: MouseEventHandler;
|
|
13
|
-
cancelText?: string;
|
|
14
|
-
confirmText?: string;
|
|
15
|
-
}
|
|
16
|
-
interface PickerObjectValue {
|
|
17
|
-
text: string;
|
|
1
|
+
import React, { RefObject, ReactNode } from "react";
|
|
2
|
+
export interface PickerOption {
|
|
3
|
+
text: string | number;
|
|
18
4
|
value: string | number;
|
|
19
|
-
[
|
|
5
|
+
children?: PickerOption[];
|
|
6
|
+
}
|
|
7
|
+
export declare type PickerValue = string | PickerOption;
|
|
8
|
+
export interface PickerProps<T extends PickerValue = PickerValue> {
|
|
9
|
+
visible: boolean;
|
|
10
|
+
title?: ReactNode | string;
|
|
11
|
+
data: (T | T[])[];
|
|
12
|
+
defaultValueData?: (number | string)[];
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
mode?: "normal" | "3D";
|
|
16
|
+
swipeDuration: number | string;
|
|
17
|
+
onConfirm?: (selectedValue: T[], index: number) => void;
|
|
18
|
+
onCancel?: () => void;
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
onCloseUpdate?: (selectedValue: (string | number)[], list: PickerOption[], pickerRef: RefObject<HTMLDivElement>) => void;
|
|
21
|
+
onChange?: (index: number, value: (string | number)[], selectedOptions: PickerValue[]) => void;
|
|
20
22
|
}
|
|
21
|
-
|
|
22
|
-
declare const Picker: <T extends PickerValue>(props: PickerProps<T>) => ReactElement;
|
|
23
|
+
declare const Picker: React.ForwardRefExoticComponent<Partial<PickerProps<PickerValue>> & React.RefAttributes<unknown>>;
|
|
23
24
|
export default Picker;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { PropsWithChildren, ReactElement, ReactNode } from "react";
|
|
2
|
-
import { PickerValue } from "./Picker";
|
|
2
|
+
import type { PickerValue } from "./Picker";
|
|
3
3
|
import "./index.scss";
|
|
4
|
+
export declare type PickerData = PickerValue;
|
|
4
5
|
export interface PickerFieldProps<T extends PickerValue> extends PropsWithChildren<{}> {
|
|
5
|
-
title?: ReactNode;
|
|
6
|
-
data: T[];
|
|
7
|
-
ItemComponent?: (props: {
|
|
8
|
-
data: T;
|
|
9
|
-
}) => ReactNode;
|
|
6
|
+
title?: ReactNode | string;
|
|
7
|
+
data: T[] | T[][];
|
|
10
8
|
className?: string;
|
|
11
|
-
onConfirm?: (value: T, index: number) => void;
|
|
9
|
+
onConfirm?: (value: T[], index: number) => void;
|
|
12
10
|
onCancel?: () => void;
|
|
11
|
+
mode?: "normal" | "3D";
|
|
13
12
|
}
|
|
14
13
|
declare const PickerField: <T extends PickerValue>(props: PickerFieldProps<T>) => ReactElement;
|
|
15
14
|
export default PickerField;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { MouseEventHandler } from "react";
|
|
2
|
+
import "./index.scss";
|
|
3
|
+
interface PickerObjectValue {
|
|
4
|
+
text: string | number;
|
|
5
|
+
value: string | number;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export declare type PickerValue = string | PickerObjectValue;
|
|
9
|
+
interface PickerSlotProps<T extends PickerValue = PickerObjectValue> {
|
|
10
|
+
defaultValue?: string | number;
|
|
11
|
+
data: T[];
|
|
12
|
+
mode?: "normal" | "3D";
|
|
13
|
+
swipeDuration?: number | string;
|
|
14
|
+
onConfirm?: (value: T, index: number) => void;
|
|
15
|
+
onCancel?: MouseEventHandler;
|
|
16
|
+
onClose?: MouseEventHandler;
|
|
17
|
+
keyIndex: number;
|
|
18
|
+
visible: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const PickerSlot: React.ForwardRefExoticComponent<Partial<PickerSlotProps<PickerObjectValue>> & React.RefAttributes<{
|
|
21
|
+
stopMomentum: () => void;
|
|
22
|
+
moving: boolean;
|
|
23
|
+
}>>;
|
|
24
|
+
export default PickerSlot;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export declare type RadioItemType = {
|
|
3
|
+
label: string | ReactNode;
|
|
4
|
+
value: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare type RadioItem = RadioItemType | string;
|
|
9
|
+
export declare type RadioGroupProps = {
|
|
10
|
+
option: RadioItem[];
|
|
11
|
+
onChange?: (value: string | number) => void;
|
|
12
|
+
name: string;
|
|
13
|
+
circle?: boolean;
|
|
14
|
+
align?: "center" | "end";
|
|
15
|
+
direction?: "rtl";
|
|
16
|
+
justify?: "around" | "between";
|
|
17
|
+
id?: string;
|
|
18
|
+
padding?: true;
|
|
19
|
+
border?: boolean;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
radioStyle?: React.CSSProperties;
|
|
22
|
+
defaultChecked?: string;
|
|
23
|
+
color?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const RadioGroup: React.FC<RadioGroupProps>;
|
|
26
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { XHComponentCommonProps } from "@/types";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import Group from "./Group";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
declare type CompoundedComponent = React.ForwardRefExoticComponent<XHRadioProps & React.RefAttributes<HTMLInputElement>> & {
|
|
6
|
+
Group: typeof Group;
|
|
7
|
+
};
|
|
8
|
+
export declare type XHRadioProps = {
|
|
9
|
+
onChange?: (check: boolean, value: string) => void;
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
label: string | ReactNode;
|
|
13
|
+
size?: number;
|
|
14
|
+
circle?: boolean;
|
|
15
|
+
align?: "center" | "end";
|
|
16
|
+
direction?: "rtl";
|
|
17
|
+
justify?: "around" | "between";
|
|
18
|
+
value?: string | number;
|
|
19
|
+
id?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
/**
|
|
23
|
+
* 抖音不支持属性选择器
|
|
24
|
+
* @description 主要为抖音支持颜色
|
|
25
|
+
*/
|
|
26
|
+
color?: string;
|
|
27
|
+
} & XHComponentCommonProps;
|
|
28
|
+
declare const Radio: CompoundedComponent;
|
|
29
|
+
export default Radio;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ItemProps {
|
|
3
|
+
className: string;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
index: number;
|
|
6
|
+
direction?: "horizontal" | "vertical";
|
|
7
|
+
marginDirection: "marginLeft" | "marginRight";
|
|
8
|
+
split?: string | React.ReactNode;
|
|
9
|
+
wrap?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export default function Item({ className, direction, index, marginDirection, children, split, wrap, }: ItemProps): JSX.Element | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type DirectionType = "ltr" | "rtl" | undefined;
|
|
3
|
+
export declare type SizeType = "small" | "normal" | "large" | undefined;
|
|
4
|
+
export interface ConfigConsumerProps {
|
|
5
|
+
getPrefixCls: (suffixCls?: string) => string;
|
|
6
|
+
direction?: DirectionType;
|
|
7
|
+
space?: {
|
|
8
|
+
size?: SizeType | number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const defaultGetPrefixCls: (suffixCls?: string) => string;
|
|
12
|
+
export declare const ConfigContext: React.Context<ConfigConsumerProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "@/types";
|
|
3
|
+
import { SizeType } from "./config-provider";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
export declare const SpaceConfigContext: React.Context<import("./config-provider").ConfigConsumerProps>;
|
|
6
|
+
export declare type SpaceProps = {
|
|
7
|
+
direction?: "horizontal" | "vertical";
|
|
8
|
+
align?: "start" | "end" | "center" | "baseline";
|
|
9
|
+
size?: SizeType | [SizeType, SizeType];
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
split?: React.ReactNode;
|
|
12
|
+
wrap?: boolean;
|
|
13
|
+
} & XHComponentCommonProps;
|
|
14
|
+
export declare const SpaceContext: React.Context<{
|
|
15
|
+
latestIndex: number;
|
|
16
|
+
horizontalSize: number;
|
|
17
|
+
verticalSize: number;
|
|
18
|
+
supportFlexGap: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
declare const XHSpace: React.FC<SpaceProps>;
|
|
21
|
+
export default XHSpace;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { FC } from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "@/types";
|
|
3
|
+
export declare type StepsProps = {
|
|
4
|
+
current?: number;
|
|
5
|
+
direction?: "horizontal" | "vertical";
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
style?: React.CSSProperties & {
|
|
8
|
+
"--line-to-next-color"?: string;
|
|
9
|
+
"--color-primary"?: string;
|
|
10
|
+
};
|
|
11
|
+
} & XHComponentCommonProps;
|
|
12
|
+
declare const Steps: FC<StepsProps>;
|
|
13
|
+
export default Steps;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { ReactNode, ForwardRefExoticComponent } from "react";
|
|
2
|
+
import { XHComponentCommonProps } from "@/types";
|
|
3
|
+
import Steps from "./Steps";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
export declare type StepProps = {
|
|
6
|
+
icon?: string | ReactNode;
|
|
7
|
+
title: string | ReactNode;
|
|
8
|
+
description?: string | ReactNode;
|
|
9
|
+
direction?: "horizontal" | "vertical";
|
|
10
|
+
status?: "wait" | "process" | "finish" | "error";
|
|
11
|
+
fancy?: boolean;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
} & XHComponentCommonProps;
|
|
14
|
+
export declare type HybridComponent = ForwardRefExoticComponent<StepProps> & {
|
|
15
|
+
Steps: typeof Steps;
|
|
16
|
+
};
|
|
17
|
+
declare const XHStep: HybridComponent;
|
|
18
|
+
export default XHStep;
|
package/types/hooks/index.d.ts
CHANGED
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
import { ITouchEvent } from "@tarojs/components";
|
|
2
1
|
export declare const useTaroEnv: () => string;
|
|
3
|
-
export declare type hooksProps = {
|
|
4
|
-
direction: "X" | "Y";
|
|
5
|
-
threshold: number;
|
|
6
|
-
};
|
|
7
|
-
export declare const useTouch: () => {
|
|
8
|
-
touchstart: (e: ITouchEvent) => void;
|
|
9
|
-
touchend: (e: ITouchEvent) => void;
|
|
10
|
-
touchmove: (e: ITouchEvent) => void;
|
|
11
|
-
startPoint: {
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
};
|
|
15
|
-
touchMoveDistance: {
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
};
|
|
19
|
-
touchEndPoint: {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
2
|
export declare const useAsyncEffect: (fn: any, deps: any) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (id: any, prefix?: string): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useRefs(): any[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare type Direction = "" | "vertical" | "horizontal";
|
|
2
|
+
export declare function useTouch(): {
|
|
3
|
+
move: EventListener;
|
|
4
|
+
start: EventListener;
|
|
5
|
+
reset: () => void;
|
|
6
|
+
startX: number;
|
|
7
|
+
startY: number;
|
|
8
|
+
moveX: number;
|
|
9
|
+
moveY: number;
|
|
10
|
+
deltaX: number;
|
|
11
|
+
deltaY: number;
|
|
12
|
+
offsetX: number;
|
|
13
|
+
offsetY: number;
|
|
14
|
+
direction: Direction;
|
|
15
|
+
isVertical: () => boolean;
|
|
16
|
+
isHorizontal: () => boolean;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -16,4 +16,8 @@ export { default as XHDialogRef } from "./components/DialogRef";
|
|
|
16
16
|
export { default as XHTabbar } from "./components/Tabbar";
|
|
17
17
|
export { default as XHPopup } from "./components/Popup";
|
|
18
18
|
export { default as XHPicker } from "./components/Picker";
|
|
19
|
+
export { default as XHSpace } from "./components/Space";
|
|
19
20
|
export { default as ThemeProvider } from "./components/ThemeProvider";
|
|
21
|
+
export { default as XHCheckbox } from "./components/Checkbox";
|
|
22
|
+
export { default as XHRadio } from "./components/Radio";
|
|
23
|
+
export { default as XHStep } from "./components/Step";
|
package/types/utils/index.d.ts
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
* @param {string} val - 输入内容
|
|
4
4
|
* @returns {boolean} - 校验结果 返回 true || false
|
|
5
5
|
*/
|
|
6
|
+
import React from "react";
|
|
6
7
|
export declare const inputRange: (val: string) => string;
|
|
7
8
|
export declare const throtte: (fn: Function, delay?: number) => (arg: any) => void;
|
|
8
9
|
export declare function pxTransform(size: number, designWidth?: number): string;
|
|
10
|
+
export declare const detectFlexGapSupported: () => boolean;
|
|
11
|
+
export interface Option {
|
|
12
|
+
keepEmpty?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function toArray(children: React.ReactNode, option?: Option): React.ReactElement[];
|