@seakoi/native-ui 1.1.2 → 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 +24 -0
- package/dist/commonjs/components/base/carousel/carousel-indicator.js +56 -0
- package/dist/commonjs/components/base/carousel/carousel-slides.js +140 -0
- package/dist/commonjs/components/base/carousel/carousel.js +114 -122
- package/dist/commonjs/components/base/carousel/hooks/index.js +0 -14
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-index.js +16 -13
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-lifecycle.js +6 -2
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-pan-responder.js +40 -12
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-position.js +6 -2
- package/dist/commonjs/components/base/carousel/index.js +1 -15
- package/dist/commonjs/components/base/carousel/style/index.js +12 -0
- package/dist/commonjs/components/base/date-picker/date-picker.js +56 -44
- package/dist/commonjs/components/base/date-picker/date-range-picker.js +142 -50
- package/dist/commonjs/components/base/date-picker/style/index.js +15 -0
- package/dist/commonjs/components/base/date-picker-view/date-picker-view.js +19 -53
- package/dist/commonjs/components/base/date-picker-view/index.js +0 -22
- package/dist/commonjs/components/base/index.js +30 -8
- package/dist/commonjs/components/base/picker/index.js +26 -4
- package/dist/commonjs/components/base/picker/picker-content.js +60 -0
- package/dist/commonjs/components/base/picker/picker-context.js +9 -0
- package/dist/commonjs/components/base/picker/picker-field.js +37 -0
- package/dist/commonjs/components/base/picker/picker.js +22 -96
- package/dist/commonjs/components/base/picker/style/index.js +1 -3
- package/dist/commonjs/components/base/picker-backup/base-picker-container.js +50 -0
- package/dist/commonjs/components/base/picker-backup/index.js +27 -0
- package/dist/commonjs/components/base/picker-backup/picker-backup.js +75 -0
- package/dist/commonjs/components/base/picker-backup/picker-copy.js +106 -0
- package/dist/commonjs/components/base/{picker → picker-backup}/picker-trigger.js +5 -5
- package/dist/commonjs/components/base/picker-backup/style/index.js +19 -0
- package/dist/commonjs/components/base/picker-backup/utils.js +53 -0
- package/dist/commonjs/components/base/picker-view/picker-view-column.js +15 -0
- package/dist/commonjs/components/base/picker-view/picker-view.js +4 -4
- package/dist/commonjs/components/base/tag/index.js +20 -0
- package/dist/commonjs/components/base/tag/style/index.js +89 -0
- package/dist/commonjs/components/base/tag/tag-context.js +12 -0
- package/dist/commonjs/components/base/tag/tag-group.js +35 -0
- package/dist/commonjs/components/base/tag/tag.js +47 -0
- package/dist/commonjs/components/base/tag/types.js +5 -0
- package/dist/module/components/base/carousel/carousel-indicator.js +51 -0
- package/dist/module/components/base/carousel/carousel-slides.js +135 -0
- package/dist/module/components/base/carousel/carousel.js +116 -124
- package/dist/module/components/base/carousel/hooks/index.js +0 -2
- package/dist/module/components/base/carousel/hooks/use-carousel-index.js +15 -11
- package/dist/module/components/base/carousel/hooks/use-carousel-lifecycle.js +6 -2
- package/dist/module/components/base/carousel/hooks/use-carousel-pan-responder.js +40 -11
- package/dist/module/components/base/carousel/hooks/use-carousel-position.js +5 -1
- package/dist/module/components/base/carousel/index.js +1 -5
- package/dist/module/components/base/carousel/style/index.js +12 -0
- package/dist/module/components/base/date-picker/date-picker.js +60 -48
- package/dist/module/components/base/date-picker/date-range-picker.js +146 -54
- package/dist/module/components/base/date-picker/style/index.js +11 -0
- package/dist/module/components/base/date-picker-view/date-picker-view.js +23 -57
- package/dist/module/components/base/date-picker-view/index.js +1 -3
- package/dist/module/components/base/index.js +2 -0
- package/dist/module/components/base/picker/index.js +9 -1
- package/dist/module/components/base/picker/picker-content.js +54 -0
- package/dist/module/components/base/picker/picker-context.js +4 -0
- package/dist/module/components/base/picker/picker-field.js +32 -0
- package/dist/module/components/base/picker/picker.js +25 -99
- package/dist/module/components/base/picker/style/index.js +1 -3
- package/dist/module/components/base/picker-backup/base-picker-container.js +44 -0
- package/dist/module/components/base/picker-backup/index.js +4 -0
- package/dist/module/components/base/picker-backup/picker-backup.js +69 -0
- package/dist/module/components/base/picker-backup/picker-copy.js +101 -0
- package/dist/module/components/base/{picker → picker-backup}/picker-trigger.js +2 -2
- package/dist/module/components/base/picker-backup/style/index.js +15 -0
- package/dist/module/components/base/picker-backup/utils.js +48 -0
- package/dist/module/components/base/picker-view/picker-view-column.js +15 -0
- package/dist/module/components/base/picker-view/picker-view.js +4 -4
- package/dist/module/components/base/tag/index.js +5 -0
- package/dist/module/components/base/tag/style/index.js +85 -0
- package/dist/module/components/base/tag/tag-context.js +8 -0
- package/dist/module/components/base/tag/tag-group.js +29 -0
- package/dist/module/components/base/tag/tag.js +41 -0
- package/dist/module/components/base/tag/types.js +3 -0
- package/dist/typescript/components/base/carousel/carousel-indicator.d.ts +42 -0
- package/dist/typescript/components/base/carousel/carousel-indicator.d.ts.map +1 -0
- package/dist/typescript/components/base/carousel/carousel-slides.d.ts +49 -0
- package/dist/typescript/components/base/carousel/carousel-slides.d.ts.map +1 -0
- package/dist/typescript/components/base/carousel/carousel.d.ts +16 -11
- package/dist/typescript/components/base/carousel/carousel.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/index.d.ts +0 -2
- package/dist/typescript/components/base/carousel/hooks/index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-lifecycle.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-pan-responder.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-position.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/index.d.ts +1 -4
- package/dist/typescript/components/base/carousel/index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/style/index.d.ts +12 -0
- package/dist/typescript/components/base/carousel/style/index.d.ts.map +1 -1
- package/dist/typescript/components/base/carousel/types.d.ts +8 -17
- package/dist/typescript/components/base/carousel/types.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker/date-picker.d.ts +4 -2
- package/dist/typescript/components/base/date-picker/date-picker.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker/date-range-picker.d.ts +12 -3
- package/dist/typescript/components/base/date-picker/date-range-picker.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker/style/index.d.ts +9 -0
- package/dist/typescript/components/base/date-picker/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/date-picker-view/date-picker-view.d.ts +1 -6
- package/dist/typescript/components/base/date-picker-view/date-picker-view.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker-view/index.d.ts +0 -2
- package/dist/typescript/components/base/date-picker-view/index.d.ts.map +1 -1
- package/dist/typescript/components/base/date-picker-view/types.d.ts +1 -1
- package/dist/typescript/components/base/index.d.ts +2 -0
- package/dist/typescript/components/base/index.d.ts.map +1 -1
- package/dist/typescript/components/base/picker/index.d.ts +7 -1
- package/dist/typescript/components/base/picker/index.d.ts.map +1 -1
- package/dist/typescript/components/base/picker/picker-content.d.ts +15 -0
- package/dist/typescript/components/base/picker/picker-content.d.ts.map +1 -0
- package/dist/typescript/components/base/picker/picker-context.d.ts +18 -0
- package/dist/typescript/components/base/picker/picker-context.d.ts.map +1 -0
- package/dist/typescript/components/base/picker/picker-field.d.ts +10 -0
- package/dist/typescript/components/base/picker/picker-field.d.ts.map +1 -0
- package/dist/typescript/components/base/picker/picker.d.ts +13 -11
- package/dist/typescript/components/base/picker/picker.d.ts.map +1 -1
- package/dist/typescript/components/base/picker/style/index.d.ts +0 -2
- package/dist/typescript/components/base/picker/style/index.d.ts.map +1 -1
- package/dist/typescript/components/base/picker-backup/base-picker-container.d.ts +15 -0
- package/dist/typescript/components/base/picker-backup/base-picker-container.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/index.d.ts +3 -0
- package/dist/typescript/components/base/picker-backup/index.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/picker-backup.d.ts +26 -0
- package/dist/typescript/components/base/picker-backup/picker-backup.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/picker-copy.d.ts +13 -0
- package/dist/typescript/components/base/picker-backup/picker-copy.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/picker-trigger.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/style/index.d.ts +13 -0
- package/dist/typescript/components/base/picker-backup/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-backup/utils.d.ts +8 -0
- package/dist/typescript/components/base/picker-backup/utils.d.ts.map +1 -0
- package/dist/typescript/components/base/picker-view/picker-view-column.d.ts.map +1 -1
- package/dist/typescript/components/base/picker-view/utils/picker.d.ts +3 -3
- package/dist/typescript/components/base/picker-view/utils/picker.d.ts.map +1 -1
- package/dist/typescript/components/base/tag/index.d.ts +5 -0
- package/dist/typescript/components/base/tag/index.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/style/index.d.ts +61 -0
- package/dist/typescript/components/base/tag/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/tag-context.d.ts +3 -0
- package/dist/typescript/components/base/tag/tag-context.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/tag-group.d.ts +4 -0
- package/dist/typescript/components/base/tag/tag-group.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/tag.d.ts +4 -0
- package/dist/typescript/components/base/tag/tag.d.ts.map +1 -0
- package/dist/typescript/components/base/tag/types.d.ts +48 -0
- package/dist/typescript/components/base/tag/types.d.ts.map +1 -0
- package/package.json +12 -4
- package/src/components/base/carousel/carousel-indicator.tsx +80 -0
- package/src/components/base/carousel/carousel-slides.tsx +177 -0
- package/src/components/base/carousel/carousel.tsx +108 -118
- package/src/components/base/carousel/hooks/index.ts +0 -2
- package/src/components/base/carousel/hooks/use-carousel-index.ts +13 -9
- package/src/components/base/carousel/hooks/use-carousel-lifecycle.ts +4 -3
- package/src/components/base/carousel/hooks/use-carousel-pan-responder.ts +40 -16
- package/src/components/base/carousel/hooks/use-carousel-position.ts +4 -1
- package/src/components/base/carousel/index.ts +1 -3
- package/src/components/base/carousel/style/index.ts +12 -0
- package/src/components/base/carousel/types.ts +8 -21
- package/src/components/base/date-picker/date-picker.tsx +64 -61
- package/src/components/base/date-picker/date-range-picker.tsx +178 -70
- package/src/components/base/date-picker/style/index.ts +10 -0
- package/src/components/base/date-picker-view/date-picker-view.tsx +21 -68
- package/src/components/base/date-picker-view/index.ts +0 -2
- package/src/components/base/date-picker-view/types.ts +1 -1
- package/src/components/base/index.ts +2 -0
- package/src/components/base/picker/index.ts +11 -1
- package/src/components/base/picker/picker-content.tsx +75 -0
- package/src/components/base/picker/picker-context.ts +19 -0
- package/src/components/base/picker/picker-field.tsx +50 -0
- package/src/components/base/picker/picker.tsx +38 -114
- package/src/components/base/picker/style/index.ts +0 -2
- package/src/components/base/picker-backup/base-picker-container.tsx +55 -0
- package/src/components/base/picker-backup/index.ts +2 -0
- package/src/components/base/picker-backup/picker-backup.tsx +110 -0
- package/src/components/base/picker-backup/picker-copy.tsx +125 -0
- package/src/components/base/{picker → picker-backup}/picker-trigger.tsx +2 -2
- package/src/components/base/picker-backup/style/index.ts +14 -0
- package/src/components/base/picker-backup/utils.ts +62 -0
- package/src/components/base/picker-view/picker-view-column.tsx +20 -0
- package/src/components/base/picker-view/picker-view.tsx +4 -4
- package/src/components/base/picker-view/utils/picker.ts +3 -5
- package/src/components/base/tag/index.ts +5 -0
- package/src/components/base/tag/style/index.tsx +84 -0
- package/src/components/base/tag/tag-context.ts +9 -0
- package/src/components/base/tag/tag-group.tsx +31 -0
- package/src/components/base/tag/tag.tsx +50 -0
- package/src/components/base/tag/types.ts +71 -0
- package/dist/commonjs/components/base/carousel/carousel-item.js +0 -45
- package/dist/commonjs/components/base/carousel/constants.js +0 -25
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-indicator.js +0 -63
- package/dist/commonjs/components/base/carousel/hooks/use-carousel-slides.js +0 -95
- package/dist/commonjs/components/base/carousel/utils.js +0 -63
- package/dist/commonjs/components/base/date-picker-view/date-range-picker-view.js +0 -145
- package/dist/commonjs/components/base/date-picker-view/date-time-picker.js +0 -39
- package/dist/module/components/base/carousel/carousel-item.js +0 -40
- package/dist/module/components/base/carousel/constants.js +0 -21
- package/dist/module/components/base/carousel/hooks/use-carousel-indicator.js +0 -58
- package/dist/module/components/base/carousel/hooks/use-carousel-slides.js +0 -90
- package/dist/module/components/base/carousel/utils.js +0 -55
- package/dist/module/components/base/date-picker-view/date-range-picker-view.js +0 -138
- package/dist/module/components/base/date-picker-view/date-time-picker.js +0 -34
- package/dist/typescript/components/base/carousel/carousel-item.d.ts +0 -26
- package/dist/typescript/components/base/carousel/carousel-item.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/constants.d.ts +0 -17
- package/dist/typescript/components/base/carousel/constants.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-indicator.d.ts +0 -37
- package/dist/typescript/components/base/carousel/hooks/use-carousel-indicator.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/hooks/use-carousel-slides.d.ts +0 -51
- package/dist/typescript/components/base/carousel/hooks/use-carousel-slides.d.ts.map +0 -1
- package/dist/typescript/components/base/carousel/utils.d.ts +0 -25
- package/dist/typescript/components/base/carousel/utils.d.ts.map +0 -1
- package/dist/typescript/components/base/date-picker-view/date-range-picker-view.d.ts +0 -26
- package/dist/typescript/components/base/date-picker-view/date-range-picker-view.d.ts.map +0 -1
- package/dist/typescript/components/base/date-picker-view/date-time-picker.d.ts +0 -3
- package/dist/typescript/components/base/date-picker-view/date-time-picker.d.ts.map +0 -1
- package/dist/typescript/components/base/picker/picker-trigger.d.ts.map +0 -1
- package/src/components/base/carousel/carousel-item.tsx +0 -35
- package/src/components/base/carousel/constants.ts +0 -19
- package/src/components/base/carousel/hooks/use-carousel-indicator.tsx +0 -84
- package/src/components/base/carousel/hooks/use-carousel-slides.tsx +0 -131
- package/src/components/base/carousel/utils.ts +0 -55
- package/src/components/base/date-picker-view/date-range-picker-view.tsx +0 -191
- package/src/components/base/date-picker-view/date-time-picker.tsx +0 -34
- /package/dist/typescript/components/base/{picker → picker-backup}/picker-trigger.d.ts +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare const useTagStyles: (options?: import("../../../../shared/utils").AnyObject | undefined) => {
|
|
2
|
+
tag: {};
|
|
3
|
+
large: {
|
|
4
|
+
paddingHorizontal: number;
|
|
5
|
+
paddingVertical: number;
|
|
6
|
+
borderRadius: number;
|
|
7
|
+
};
|
|
8
|
+
medium: {
|
|
9
|
+
paddingHorizontal: number;
|
|
10
|
+
paddingVertical: number;
|
|
11
|
+
borderRadius: number;
|
|
12
|
+
};
|
|
13
|
+
small: {
|
|
14
|
+
paddingHorizontal: number;
|
|
15
|
+
paddingVertical: number;
|
|
16
|
+
borderRadius: number;
|
|
17
|
+
};
|
|
18
|
+
disabled: {
|
|
19
|
+
opacity: number;
|
|
20
|
+
};
|
|
21
|
+
'font-small': {
|
|
22
|
+
fontSize: number;
|
|
23
|
+
};
|
|
24
|
+
'font-medium': {
|
|
25
|
+
fontSize: number;
|
|
26
|
+
};
|
|
27
|
+
'font-large': {
|
|
28
|
+
fontSize: number;
|
|
29
|
+
};
|
|
30
|
+
filled: {
|
|
31
|
+
backgroundColor: any;
|
|
32
|
+
};
|
|
33
|
+
'text-filled': {
|
|
34
|
+
color: any;
|
|
35
|
+
};
|
|
36
|
+
outlined: {
|
|
37
|
+
borderColor: any;
|
|
38
|
+
borderWidth: number;
|
|
39
|
+
};
|
|
40
|
+
'text-outlined': {
|
|
41
|
+
color: any;
|
|
42
|
+
};
|
|
43
|
+
solid: {
|
|
44
|
+
backgroundColor: any;
|
|
45
|
+
};
|
|
46
|
+
'text-solid': {
|
|
47
|
+
color: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export declare const useTagGroupStyles: (options?: import("../../../../shared/utils").AnyObject | undefined) => {
|
|
51
|
+
container: {
|
|
52
|
+
flexDirection: "row";
|
|
53
|
+
alignItems: "center";
|
|
54
|
+
flexWrap: "wrap";
|
|
55
|
+
};
|
|
56
|
+
vertical: {
|
|
57
|
+
flexDirection: "column";
|
|
58
|
+
alignItems: "stretch";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/tag/style/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;CAY5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-context.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/tag/tag-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,UAAU,0CAGrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-group.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/tag/tag-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAuB5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/tag/tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAO5C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAyClC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { GestureResponderEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
|
+
import type { AnyObject } from '#shared/utils/types';
|
|
4
|
+
export interface TagProps {
|
|
5
|
+
/** 标签文本 */
|
|
6
|
+
text?: string;
|
|
7
|
+
/** 标签主题色 */
|
|
8
|
+
color?: string;
|
|
9
|
+
/** 结构形态 */
|
|
10
|
+
variant?: 'filled' | 'solid' | 'outlined';
|
|
11
|
+
/** 标签样式 */
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
/** 标签内容样式 */
|
|
14
|
+
textStyle?: StyleProp<TextStyle>;
|
|
15
|
+
/** 标签主题色 */
|
|
16
|
+
theme?: 'primary' | 'default' | 'danger';
|
|
17
|
+
/** 标签尺寸 */
|
|
18
|
+
size?: 'small' | 'medium' | 'large';
|
|
19
|
+
/** 标签是否可关闭 */
|
|
20
|
+
closable?: boolean;
|
|
21
|
+
/** 标签图标 */
|
|
22
|
+
icon?: React.ReactElement<AnyObject>;
|
|
23
|
+
/** 标签内容 */
|
|
24
|
+
child?: React.ReactNode;
|
|
25
|
+
/** 标签跳转链接 */
|
|
26
|
+
href?: string;
|
|
27
|
+
/** 标签是否禁用 */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** 标签跳转链接目标 */
|
|
30
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
31
|
+
/** 标签点击 事件 */
|
|
32
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface TagGroupProps extends PropsWithChildren, TagContextValue {
|
|
35
|
+
/** 容器样式 */
|
|
36
|
+
style?: StyleProp<ViewStyle>;
|
|
37
|
+
/** 容器样式 */
|
|
38
|
+
gap?: number;
|
|
39
|
+
/** 容器样式 */
|
|
40
|
+
direction?: 'horizontal' | 'vertical';
|
|
41
|
+
}
|
|
42
|
+
export interface TagContextValue {
|
|
43
|
+
/** 按钮标签的尺寸 */
|
|
44
|
+
size?: 'small' | 'medium' | 'large';
|
|
45
|
+
/** 按钮标签的禁用状态 */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/tag/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,QAAQ;IACvB,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,YAAY;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW;IACX,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;IAE1C,WAAW;IACX,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,aAAa;IACb,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAEjC,YAAY;IACZ,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAEzC,WAAW;IACX,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEpC,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,WAAW;IACX,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAErC,WAAW;IACX,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAExB,aAAa;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,aAAa;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,eAAe;IACf,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAEjD,cAAc;IACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB,EAAE,eAAe;IACvE,WAAW;IACX,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,WAAW;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,WAAW;IACX,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACvC;AAED,MAAM,WAAW,eAAe;IAC9B,cAAc;IACd,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,gBAAgB;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seakoi/native-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-design",
|
|
@@ -30,15 +30,23 @@
|
|
|
30
30
|
"dayjs": "^1.11.19",
|
|
31
31
|
"deepmerge": "^4.3.1",
|
|
32
32
|
"lodash-es": "^4.17.22",
|
|
33
|
-
"
|
|
34
|
-
"rc-field-form": "^2.7.1",
|
|
35
|
-
"react-native-linear-gradient": "^2.8.3"
|
|
33
|
+
"rc-field-form": "^2.7.1"
|
|
36
34
|
},
|
|
37
35
|
"peerDependencies": {
|
|
36
|
+
"lottie-react-native": "^7.3.5",
|
|
38
37
|
"react": ">=19",
|
|
39
38
|
"react-native": ">=0.81",
|
|
39
|
+
"react-native-linear-gradient": "^2.8.3",
|
|
40
40
|
"react-native-safe-area-context": "*"
|
|
41
41
|
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"lottie-react-native": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"react-native-linear-gradient": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
42
50
|
"publishConfig": {
|
|
43
51
|
"access": "public",
|
|
44
52
|
"registry": "https://registry.npmjs.org",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { View, type ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { CarouselProps } from './types';
|
|
4
|
+
|
|
5
|
+
interface CarouselIndicatorProps {
|
|
6
|
+
/** 指示器配置(false 表示不显示,函数表示自定义渲染) */
|
|
7
|
+
indicator: CarouselProps['indicator'];
|
|
8
|
+
/** 指示器属性配置(颜色、样式) */
|
|
9
|
+
indicatorProps: CarouselProps['indicatorProps'];
|
|
10
|
+
/** 轮播项总数 */
|
|
11
|
+
total: number;
|
|
12
|
+
/** 当前激活的索引 */
|
|
13
|
+
current: number;
|
|
14
|
+
/** 激活状态的指示器颜色 */
|
|
15
|
+
activeColor: string;
|
|
16
|
+
/** 非激活状态的指示器颜色 */
|
|
17
|
+
inactiveColor: string;
|
|
18
|
+
/** 指示器样式对象 */
|
|
19
|
+
styles: {
|
|
20
|
+
indicatorContainer: ViewStyle;
|
|
21
|
+
indicatorDot: ViewStyle;
|
|
22
|
+
indicatorDotActive: ViewStyle;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 轮播图指示器渲染组件
|
|
28
|
+
*
|
|
29
|
+
* 负责渲染轮播图底部的指示器(小圆点),支持自定义指示器或使用默认样式。
|
|
30
|
+
* 当轮播项总数小于等于 1 时,不显示指示器。
|
|
31
|
+
*
|
|
32
|
+
* @param props - 组件属性配置
|
|
33
|
+
* @param props.indicator - 指示器配置(false 表示不显示,函数表示自定义渲染)
|
|
34
|
+
* @param props.indicatorProps - 指示器属性配置(颜色、样式)
|
|
35
|
+
* @param props.total - 轮播项总数
|
|
36
|
+
* @param props.current - 当前激活的索引
|
|
37
|
+
* @param props.activeColor - 激活状态的指示器颜色
|
|
38
|
+
* @param props.inactiveColor - 非激活状态的指示器颜色
|
|
39
|
+
* @param props.styles - 指示器样式对象
|
|
40
|
+
*
|
|
41
|
+
* @returns 渲染的指示器内容或 null
|
|
42
|
+
*/
|
|
43
|
+
export const CarouselIndicator = (props: CarouselIndicatorProps) => {
|
|
44
|
+
const {
|
|
45
|
+
indicator,
|
|
46
|
+
indicatorProps,
|
|
47
|
+
total,
|
|
48
|
+
current,
|
|
49
|
+
activeColor,
|
|
50
|
+
inactiveColor,
|
|
51
|
+
styles,
|
|
52
|
+
} = props;
|
|
53
|
+
|
|
54
|
+
if (indicator === false) return null;
|
|
55
|
+
if (total <= 1) return null;
|
|
56
|
+
|
|
57
|
+
if (typeof indicator === 'function') {
|
|
58
|
+
return indicator(total, current);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const dotActiveColor = indicatorProps?.color ?? activeColor;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<View style={[styles.indicatorContainer, indicatorProps?.style]}>
|
|
65
|
+
{Array.from({ length: total }, (_, i) => {
|
|
66
|
+
const isActive = i === current;
|
|
67
|
+
return (
|
|
68
|
+
<View
|
|
69
|
+
key={i}
|
|
70
|
+
style={[
|
|
71
|
+
styles.indicatorDot,
|
|
72
|
+
{ backgroundColor: isActive ? dotActiveColor : inactiveColor },
|
|
73
|
+
isActive && styles.indicatorDotActive,
|
|
74
|
+
]}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
})}
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { useMemoizedFn } from 'ahooks';
|
|
2
|
+
import { clamp } from 'lodash-es';
|
|
3
|
+
import { type ReactNode, useMemo } from 'react';
|
|
4
|
+
import { View, type ViewStyle } from 'react-native';
|
|
5
|
+
|
|
6
|
+
interface CarouselSlidesProps<Data = unknown> {
|
|
7
|
+
/** 数据源数组 */
|
|
8
|
+
data: Data[];
|
|
9
|
+
/** 渲染每一项的函数 */
|
|
10
|
+
renderItem: (item: Data, index: number) => ReactNode;
|
|
11
|
+
/** 轮播项总数 */
|
|
12
|
+
total: number;
|
|
13
|
+
/** 虚拟渲染范围(start、end、isVirtual) */
|
|
14
|
+
virtualRange: {
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
isVirtual: boolean;
|
|
18
|
+
} | null;
|
|
19
|
+
/** 是否启用循环播放 */
|
|
20
|
+
loopEnabled: boolean;
|
|
21
|
+
/** 循环播放时前置克隆节点数量 */
|
|
22
|
+
clonesBefore: number;
|
|
23
|
+
/** 滑动方向 */
|
|
24
|
+
direction: 'horizontal' | 'vertical';
|
|
25
|
+
/** 单个滑块的像素大小 */
|
|
26
|
+
slidePixels: number;
|
|
27
|
+
/** 扩展后的总数(包含克隆节点) */
|
|
28
|
+
extTotal: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 轮播图滑块渲染组件
|
|
33
|
+
*
|
|
34
|
+
* 负责渲染轮播图的滑块内容,使用 data + renderItem 模式。
|
|
35
|
+
* 实现虚拟渲染优化,仅渲染可见范围内的滑块,并处理循环播放时的克隆逻辑。
|
|
36
|
+
* 为虚拟渲染添加前后占位空间,确保滚动位置正确。
|
|
37
|
+
*
|
|
38
|
+
* @template Data - 数据项类型
|
|
39
|
+
* @param props - 组件属性配置
|
|
40
|
+
* @param props.data - 数据源数组
|
|
41
|
+
* @param props.renderItem - 渲染每一项的函数
|
|
42
|
+
* @param props.total - 轮播项总数
|
|
43
|
+
* @param props.virtualRange - 虚拟渲染范围(start、end、isVirtual)
|
|
44
|
+
* @param props.loopEnabled - 是否启用循环播放
|
|
45
|
+
* @param props.clonesBefore - 循环播放时前置克隆节点数量
|
|
46
|
+
* @param props.direction - 滑动方向
|
|
47
|
+
* @param props.slidePixels - 单个滑块的像素大小
|
|
48
|
+
* @param props.extTotal - 扩展后的总数(包含克隆节点)
|
|
49
|
+
*
|
|
50
|
+
* @returns 渲染的滑块内容或 null
|
|
51
|
+
*/
|
|
52
|
+
export const CarouselSlides = <Data = unknown,>(
|
|
53
|
+
props: CarouselSlidesProps<Data>,
|
|
54
|
+
) => {
|
|
55
|
+
const {
|
|
56
|
+
data,
|
|
57
|
+
renderItem,
|
|
58
|
+
total,
|
|
59
|
+
virtualRange,
|
|
60
|
+
loopEnabled,
|
|
61
|
+
clonesBefore,
|
|
62
|
+
direction,
|
|
63
|
+
slidePixels,
|
|
64
|
+
extTotal,
|
|
65
|
+
} = props;
|
|
66
|
+
|
|
67
|
+
// 计算滑块包装器样式
|
|
68
|
+
const slideWrapperStyle: ViewStyle = useMemo(() => {
|
|
69
|
+
return direction === 'horizontal'
|
|
70
|
+
? { width: slidePixels, height: '100%' }
|
|
71
|
+
: { height: slidePixels, width: '100%' };
|
|
72
|
+
}, [direction, slidePixels]);
|
|
73
|
+
|
|
74
|
+
// 计算虚拟渲染的占位空间样式
|
|
75
|
+
const spacerStyles = useMemo(() => {
|
|
76
|
+
if (!virtualRange) return null;
|
|
77
|
+
|
|
78
|
+
const { start, end } = virtualRange;
|
|
79
|
+
const leadingSize = start * slidePixels;
|
|
80
|
+
const trailingSize = (extTotal - end - 1) * slidePixels;
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
leading:
|
|
84
|
+
direction === 'horizontal'
|
|
85
|
+
? { width: leadingSize }
|
|
86
|
+
: { height: leadingSize },
|
|
87
|
+
trailing:
|
|
88
|
+
direction === 'horizontal'
|
|
89
|
+
? { width: trailingSize }
|
|
90
|
+
: { height: trailingSize },
|
|
91
|
+
leadingSize,
|
|
92
|
+
trailingSize,
|
|
93
|
+
};
|
|
94
|
+
}, [virtualRange, slidePixels, extTotal, direction]);
|
|
95
|
+
|
|
96
|
+
const getIndexFromExtIndex = useMemoizedFn((extIndex: number) => {
|
|
97
|
+
if (!loopEnabled) return clamp(extIndex, 0, total - 1);
|
|
98
|
+
if (extIndex < clonesBefore) {
|
|
99
|
+
return (((extIndex - clonesBefore) % total) + total) % total;
|
|
100
|
+
}
|
|
101
|
+
if (extIndex >= clonesBefore + total) {
|
|
102
|
+
return (extIndex - clonesBefore - total) % total;
|
|
103
|
+
}
|
|
104
|
+
return extIndex - clonesBefore;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// 渲染滑块元素
|
|
108
|
+
const slideElements = useMemo(() => {
|
|
109
|
+
if (!virtualRange) return null;
|
|
110
|
+
|
|
111
|
+
const { start, end } = virtualRange;
|
|
112
|
+
const elements: ReactNode[] = [];
|
|
113
|
+
|
|
114
|
+
const getElementForExtIndex = (extIndex: number) => {
|
|
115
|
+
const logicalIndex = loopEnabled
|
|
116
|
+
? getIndexFromExtIndex(extIndex)
|
|
117
|
+
: clamp(extIndex, 0, total - 1);
|
|
118
|
+
|
|
119
|
+
const item = data[logicalIndex];
|
|
120
|
+
return renderItem(item, logicalIndex);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
for (let extIndex = start; extIndex <= end; extIndex += 1) {
|
|
124
|
+
const element = getElementForExtIndex(extIndex);
|
|
125
|
+
if (!element) continue;
|
|
126
|
+
elements.push(
|
|
127
|
+
<View key={extIndex} style={slideWrapperStyle}>
|
|
128
|
+
{element}
|
|
129
|
+
</View>,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return elements;
|
|
134
|
+
}, [
|
|
135
|
+
virtualRange,
|
|
136
|
+
loopEnabled,
|
|
137
|
+
total,
|
|
138
|
+
data,
|
|
139
|
+
renderItem,
|
|
140
|
+
slideWrapperStyle,
|
|
141
|
+
getIndexFromExtIndex,
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
// 前置占位空间
|
|
145
|
+
const leadSpacer = useMemo(() => {
|
|
146
|
+
if (
|
|
147
|
+
!virtualRange?.isVirtual ||
|
|
148
|
+
!spacerStyles ||
|
|
149
|
+
spacerStyles.leadingSize <= 0
|
|
150
|
+
) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return <View style={spacerStyles.leading} />;
|
|
154
|
+
}, [virtualRange?.isVirtual, spacerStyles]);
|
|
155
|
+
|
|
156
|
+
// 后置占位空间
|
|
157
|
+
const trailSpacer = useMemo(() => {
|
|
158
|
+
if (
|
|
159
|
+
!virtualRange?.isVirtual ||
|
|
160
|
+
!spacerStyles ||
|
|
161
|
+
spacerStyles.trailingSize <= 0
|
|
162
|
+
) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return <View style={spacerStyles.trailing} />;
|
|
166
|
+
}, [virtualRange?.isVirtual, spacerStyles]);
|
|
167
|
+
|
|
168
|
+
if (!virtualRange) return null;
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<>
|
|
172
|
+
{leadSpacer}
|
|
173
|
+
{slideElements}
|
|
174
|
+
{trailSpacer}
|
|
175
|
+
</>
|
|
176
|
+
);
|
|
177
|
+
};
|