@seakoi/native-ui 1.1.3 → 1.3.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 +52 -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 +53 -9
- package/dist/commonjs/components/base/input/base-input.js +4 -2
- package/dist/commonjs/components/base/overflow/all-mode-overflow.js +49 -0
- package/dist/commonjs/components/base/overflow/fixed-count-overflow.js +70 -0
- package/dist/commonjs/components/base/overflow/index.js +16 -0
- package/dist/commonjs/components/base/overflow/overflow.js +72 -0
- package/dist/commonjs/components/base/overflow/responsive-overflow.js +280 -0
- package/dist/commonjs/components/base/overflow/style/index.js +39 -0
- package/dist/commonjs/components/base/overflow/types.js +5 -0
- package/dist/commonjs/components/base/picker/index.js +26 -4
- package/dist/commonjs/components/base/picker/picker-content.js +64 -0
- package/dist/commonjs/components/base/picker/picker-context.js +9 -0
- package/dist/commonjs/components/base/picker/picker-field.js +39 -0
- package/dist/commonjs/components/base/picker/picker.js +26 -95
- package/dist/commonjs/components/base/picker/style/index.js +8 -4
- 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/portal/portal-host.js +5 -3
- package/dist/commonjs/components/base/select/hooks/use-select-actions.js +155 -0
- package/dist/commonjs/components/base/select/hooks/use-select-options.js +169 -0
- package/dist/commonjs/components/base/select/hooks/use-selector.js +104 -0
- package/dist/commonjs/components/base/select/index.js +16 -0
- package/dist/commonjs/components/base/select/select-multiple-content.js +182 -0
- package/dist/commonjs/components/base/select/select-popup.js +233 -0
- package/dist/commonjs/components/base/select/select-single-content.js +100 -0
- package/dist/commonjs/components/base/select/select-suffix.js +67 -0
- package/dist/commonjs/components/base/select/select.js +285 -0
- package/dist/commonjs/components/base/select/style/index.js +40 -0
- package/dist/commonjs/components/base/select/style/select-multiple-content-styles.js +46 -0
- package/dist/commonjs/components/base/select/style/select-popup-styles.js +67 -0
- package/dist/commonjs/components/base/select/style/select-single-content-styles.js +28 -0
- package/dist/commonjs/components/base/select/style/select-styles.js +46 -0
- package/dist/commonjs/components/base/select/style/select-suffix-styles.js +21 -0
- package/dist/commonjs/components/base/select/types.js +5 -0
- package/dist/commonjs/components/base/tabs/style/index.js +37 -0
- package/dist/commonjs/components/base/tabs/tabs.js +90 -45
- 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/commonjs/native-provider/native-provider.js +5 -5
- package/dist/commonjs/shared/utils/index.js +11 -0
- package/dist/commonjs/shared/utils/object.js +39 -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 +4 -0
- package/dist/module/components/base/input/base-input.js +4 -2
- package/dist/module/components/base/overflow/all-mode-overflow.js +43 -0
- package/dist/module/components/base/overflow/fixed-count-overflow.js +64 -0
- package/dist/module/components/base/overflow/index.js +3 -0
- package/dist/module/components/base/overflow/overflow.js +66 -0
- package/dist/module/components/base/overflow/responsive-overflow.js +274 -0
- package/dist/module/components/base/overflow/style/index.js +36 -0
- package/dist/module/components/base/overflow/types.js +3 -0
- package/dist/module/components/base/picker/index.js +9 -1
- package/dist/module/components/base/picker/picker-content.js +58 -0
- package/dist/module/components/base/picker/picker-context.js +4 -0
- package/dist/module/components/base/picker/picker-field.js +34 -0
- package/dist/module/components/base/picker/picker.js +29 -98
- package/dist/module/components/base/picker/style/index.js +7 -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/portal/portal-host.js +4 -3
- package/dist/module/components/base/select/hooks/use-select-actions.js +151 -0
- package/dist/module/components/base/select/hooks/use-select-options.js +162 -0
- package/dist/module/components/base/select/hooks/use-selector.js +100 -0
- package/dist/module/components/base/select/index.js +3 -0
- package/dist/module/components/base/select/select-multiple-content.js +176 -0
- package/dist/module/components/base/select/select-popup.js +227 -0
- package/dist/module/components/base/select/select-single-content.js +94 -0
- package/dist/module/components/base/select/select-suffix.js +61 -0
- package/dist/module/components/base/select/select.js +279 -0
- package/dist/module/components/base/select/style/index.js +7 -0
- package/dist/module/components/base/select/style/select-multiple-content-styles.js +43 -0
- package/dist/module/components/base/select/style/select-popup-styles.js +64 -0
- package/dist/module/components/base/select/style/select-single-content-styles.js +25 -0
- package/dist/module/components/base/select/style/select-styles.js +43 -0
- package/dist/module/components/base/select/style/select-suffix-styles.js +18 -0
- package/dist/module/components/base/select/types.js +3 -0
- package/dist/module/components/base/tabs/style/index.js +33 -0
- package/dist/module/components/base/tabs/tabs.js +92 -47
- 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/module/native-provider/native-provider.js +5 -5
- package/dist/module/shared/utils/index.js +2 -1
- package/dist/module/shared/utils/object.js +35 -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 +4 -0
- package/dist/typescript/components/base/index.d.ts.map +1 -1
- package/dist/typescript/components/base/input/base-input.d.ts.map +1 -1
- package/dist/typescript/components/base/overflow/all-mode-overflow.d.ts +11 -0
- package/dist/typescript/components/base/overflow/all-mode-overflow.d.ts.map +1 -0
- package/dist/typescript/components/base/overflow/fixed-count-overflow.d.ts +11 -0
- package/dist/typescript/components/base/overflow/fixed-count-overflow.d.ts.map +1 -0
- package/dist/typescript/components/base/overflow/index.d.ts +3 -0
- package/dist/typescript/components/base/overflow/index.d.ts.map +1 -0
- package/dist/typescript/components/base/overflow/overflow.d.ts +13 -0
- package/dist/typescript/components/base/overflow/overflow.d.ts.map +1 -0
- package/dist/typescript/components/base/overflow/responsive-overflow.d.ts +12 -0
- package/dist/typescript/components/base/overflow/responsive-overflow.d.ts.map +1 -0
- package/dist/typescript/components/base/overflow/style/index.d.ts +31 -0
- package/dist/typescript/components/base/overflow/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/overflow/types.d.ts +77 -0
- package/dist/typescript/components/base/overflow/types.d.ts.map +1 -0
- 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 +27 -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 +22 -11
- package/dist/typescript/components/base/picker/picker.d.ts.map +1 -1
- package/dist/typescript/components/base/picker/style/index.d.ts +6 -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/portal/portal-host.d.ts +1 -0
- package/dist/typescript/components/base/portal/portal-host.d.ts.map +1 -1
- package/dist/typescript/components/base/portal/types.d.ts +2 -0
- package/dist/typescript/components/base/portal/types.d.ts.map +1 -1
- package/dist/typescript/components/base/select/hooks/use-select-actions.d.ts +144 -0
- package/dist/typescript/components/base/select/hooks/use-select-actions.d.ts.map +1 -0
- package/dist/typescript/components/base/select/hooks/use-select-options.d.ts +91 -0
- package/dist/typescript/components/base/select/hooks/use-select-options.d.ts.map +1 -0
- package/dist/typescript/components/base/select/hooks/use-selector.d.ts +90 -0
- package/dist/typescript/components/base/select/hooks/use-selector.d.ts.map +1 -0
- package/dist/typescript/components/base/select/index.d.ts +3 -0
- package/dist/typescript/components/base/select/index.d.ts.map +1 -0
- package/dist/typescript/components/base/select/select-multiple-content.d.ts +51 -0
- package/dist/typescript/components/base/select/select-multiple-content.d.ts.map +1 -0
- package/dist/typescript/components/base/select/select-popup.d.ts +107 -0
- package/dist/typescript/components/base/select/select-popup.d.ts.map +1 -0
- package/dist/typescript/components/base/select/select-single-content.d.ts +48 -0
- package/dist/typescript/components/base/select/select-single-content.d.ts.map +1 -0
- package/dist/typescript/components/base/select/select-suffix.d.ts +43 -0
- package/dist/typescript/components/base/select/select-suffix.d.ts.map +1 -0
- package/dist/typescript/components/base/select/select.d.ts +40 -0
- package/dist/typescript/components/base/select/select.d.ts.map +1 -0
- package/dist/typescript/components/base/select/style/index.d.ts +6 -0
- package/dist/typescript/components/base/select/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/select/style/select-multiple-content-styles.d.ts +40 -0
- package/dist/typescript/components/base/select/style/select-multiple-content-styles.d.ts.map +1 -0
- package/dist/typescript/components/base/select/style/select-popup-styles.d.ts +61 -0
- package/dist/typescript/components/base/select/style/select-popup-styles.d.ts.map +1 -0
- package/dist/typescript/components/base/select/style/select-single-content-styles.d.ts +22 -0
- package/dist/typescript/components/base/select/style/select-single-content-styles.d.ts.map +1 -0
- package/dist/typescript/components/base/select/style/select-styles.d.ts +40 -0
- package/dist/typescript/components/base/select/style/select-styles.d.ts.map +1 -0
- package/dist/typescript/components/base/select/style/select-suffix-styles.d.ts +15 -0
- package/dist/typescript/components/base/select/style/select-suffix-styles.d.ts.map +1 -0
- package/dist/typescript/components/base/select/types.d.ts +206 -0
- package/dist/typescript/components/base/select/types.d.ts.map +1 -0
- package/dist/typescript/components/base/tabs/style/index.d.ts +29 -0
- package/dist/typescript/components/base/tabs/style/index.d.ts.map +1 -0
- package/dist/typescript/components/base/tabs/tabs.d.ts +26 -5
- package/dist/typescript/components/base/tabs/tabs.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/dist/typescript/native-provider/native-provider.d.ts +2 -0
- package/dist/typescript/native-provider/native-provider.d.ts.map +1 -1
- package/dist/typescript/shared/utils/index.d.ts +1 -0
- package/dist/typescript/shared/utils/index.d.ts.map +1 -1
- package/dist/typescript/shared/utils/object.d.ts +21 -0
- package/dist/typescript/shared/utils/object.d.ts.map +1 -0
- package/package.json +1 -1
- 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 +4 -0
- package/src/components/base/input/base-input.tsx +4 -2
- package/src/components/base/overflow/all-mode-overflow.tsx +49 -0
- package/src/components/base/overflow/fixed-count-overflow.tsx +71 -0
- package/src/components/base/overflow/index.ts +2 -0
- package/src/components/base/overflow/overflow.tsx +60 -0
- package/src/components/base/overflow/responsive-overflow.tsx +349 -0
- package/src/components/base/overflow/style/index.ts +32 -0
- package/src/components/base/overflow/types.ts +75 -0
- package/src/components/base/picker/index.ts +11 -1
- package/src/components/base/picker/picker-content.tsx +90 -0
- package/src/components/base/picker/picker-context.ts +19 -0
- package/src/components/base/picker/picker-field.tsx +56 -0
- package/src/components/base/picker/picker.tsx +49 -116
- package/src/components/base/picker/style/index.ts +4 -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/portal/portal-host.tsx +13 -3
- package/src/components/base/portal/types.ts +2 -0
- package/src/components/base/select/hooks/use-select-actions.ts +263 -0
- package/src/components/base/select/hooks/use-select-options.ts +250 -0
- package/src/components/base/select/hooks/use-selector.ts +155 -0
- package/src/components/base/select/index.ts +2 -0
- package/src/components/base/select/select-multiple-content.tsx +292 -0
- package/src/components/base/select/select-popup.tsx +384 -0
- package/src/components/base/select/select-single-content.tsx +127 -0
- package/src/components/base/select/select-suffix.tsx +100 -0
- package/src/components/base/select/select.tsx +302 -0
- package/src/components/base/select/style/index.ts +5 -0
- package/src/components/base/select/style/select-multiple-content-styles.ts +41 -0
- package/src/components/base/select/style/select-popup-styles.ts +62 -0
- package/src/components/base/select/style/select-single-content-styles.ts +23 -0
- package/src/components/base/select/style/select-styles.ts +41 -0
- package/src/components/base/select/style/select-suffix-styles.ts +16 -0
- package/src/components/base/select/types.ts +261 -0
- package/src/components/base/tabs/style/index.ts +32 -0
- package/src/components/base/tabs/tabs.tsx +146 -55
- 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/src/native-provider/native-provider.tsx +4 -4
- package/src/shared/utils/index.ts +1 -0
- package/src/shared/utils/object.ts +37 -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
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { useControllableValue, useMemoizedFn } from 'ahooks';
|
|
3
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import { Animated, ScrollView, TouchableOpacity, View } from 'react-native';
|
|
5
|
-
import { Text } from "./../index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Badge, Text } from "./../index.js";
|
|
7
|
+
import { useTheme } from "../../../native-provider/index.js";
|
|
8
|
+
import { useTabsStyles } from "./style/index.js";
|
|
7
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
10
|
export const Tabs = ({
|
|
9
11
|
tabs,
|
|
10
|
-
|
|
12
|
+
equalWidth = false,
|
|
13
|
+
variant = 'underline',
|
|
14
|
+
...restProps
|
|
11
15
|
}) => {
|
|
12
|
-
const
|
|
16
|
+
const [activeValue, setActiveValue] = useControllableValue(restProps, {
|
|
17
|
+
trigger: 'onChange',
|
|
18
|
+
defaultValue: restProps.defaultValue ?? tabs[0]?.value
|
|
19
|
+
});
|
|
20
|
+
const styles = useTabsStyles();
|
|
13
21
|
const theme = useTheme();
|
|
14
22
|
const tabNum = tabs.length;
|
|
15
23
|
const scrollViewWidthRef = useRef(0);
|
|
@@ -37,27 +45,21 @@ export const Tabs = ({
|
|
|
37
45
|
};
|
|
38
46
|
initIndicator();
|
|
39
47
|
};
|
|
40
|
-
const normalizedTabs = tabs.map(tab => {
|
|
41
|
-
if (typeof tab === 'string') {
|
|
42
|
-
return {
|
|
43
|
-
label: tab,
|
|
44
|
-
value: tab
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
48
|
const navigateTo = index => {
|
|
49
49
|
const targetLayout = layouts.current[index];
|
|
50
50
|
const left = targetLayout.tab.x + (targetLayout.tab.width - targetLayout.text.width) / 2;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
if (variant === 'underline') {
|
|
52
|
+
const width = targetLayout.text.width;
|
|
53
|
+
Animated.parallel([Animated.timing(animatedIndicatorLeft.current, {
|
|
54
|
+
toValue: left,
|
|
55
|
+
useNativeDriver: false,
|
|
56
|
+
duration: 300
|
|
57
|
+
}), Animated.timing(animatedIndicatorWidth.current, {
|
|
58
|
+
toValue: width,
|
|
59
|
+
useNativeDriver: false,
|
|
60
|
+
duration: 300
|
|
61
|
+
})]).start();
|
|
62
|
+
}
|
|
61
63
|
const hh = scrollViewWidthRef.current / 2;
|
|
62
64
|
scrollViewRef.current?.scrollTo({
|
|
63
65
|
x: targetLayout.tab.x + targetLayout.tab.width / 2 - hh,
|
|
@@ -65,10 +67,10 @@ export const Tabs = ({
|
|
|
65
67
|
});
|
|
66
68
|
};
|
|
67
69
|
const genOnPress = (v, index) => {
|
|
68
|
-
|
|
70
|
+
setActiveValue?.(v.value);
|
|
69
71
|
navigateTo(index);
|
|
70
72
|
};
|
|
71
|
-
const initIndicator =
|
|
73
|
+
const initIndicator = useMemoizedFn(() => {
|
|
72
74
|
const layoutItems = layouts.current.filter(item => item.tab && item.text);
|
|
73
75
|
if (layoutItems.length === layouts.current.length) {
|
|
74
76
|
setState(s => ({
|
|
@@ -76,7 +78,7 @@ export const Tabs = ({
|
|
|
76
78
|
layoutFinish: true
|
|
77
79
|
}));
|
|
78
80
|
}
|
|
79
|
-
}
|
|
81
|
+
});
|
|
80
82
|
const indicatorJSX = useMemo(() => {
|
|
81
83
|
return /*#__PURE__*/_jsx(Animated.View, {
|
|
82
84
|
style: {
|
|
@@ -89,22 +91,72 @@ export const Tabs = ({
|
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
93
|
}, [theme]);
|
|
92
|
-
const
|
|
94
|
+
const renderTab = useMemoizedFn((tab, index) => {
|
|
95
|
+
const isActive = activeValue === tab.value;
|
|
96
|
+
const badgeCount = tab.badge !== undefined ? typeof tab.badge === 'number' ? tab.badge : undefined : undefined;
|
|
97
|
+
if (variant === 'label') {
|
|
98
|
+
return /*#__PURE__*/_jsx(View, {
|
|
99
|
+
onLayout: genOnLayoutTab(index),
|
|
100
|
+
style: [{
|
|
101
|
+
paddingVertical: 10,
|
|
102
|
+
zIndex: tabNum - index
|
|
103
|
+
}, equalWidth && {
|
|
104
|
+
flex: 1
|
|
105
|
+
}],
|
|
106
|
+
children: /*#__PURE__*/_jsx(Badge, {
|
|
107
|
+
count: badgeCount,
|
|
108
|
+
visible: tab.badge !== undefined,
|
|
109
|
+
size: "small",
|
|
110
|
+
children: /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
111
|
+
activeOpacity: 0.7,
|
|
112
|
+
onPress: () => genOnPress(tab, index),
|
|
113
|
+
style: [styles.labelTab, isActive && styles.labelTabActive, equalWidth && {
|
|
114
|
+
alignSelf: 'stretch',
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
alignItems: 'center'
|
|
117
|
+
}],
|
|
118
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
119
|
+
onLayout: genOnLayoutText(index),
|
|
120
|
+
style: [styles.labelText, isActive && styles.labelTextActive],
|
|
121
|
+
size: 14,
|
|
122
|
+
children: tab.label
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
}, tab.value);
|
|
127
|
+
}
|
|
93
128
|
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
94
|
-
style: styles.tabItem,
|
|
95
|
-
|
|
129
|
+
style: [styles.tabItem, {
|
|
130
|
+
zIndex: tabNum - index
|
|
131
|
+
}, equalWidth && {
|
|
132
|
+
flex: 1,
|
|
133
|
+
justifyContent: 'center',
|
|
134
|
+
alignItems: 'center'
|
|
135
|
+
}],
|
|
136
|
+
onPress: () => genOnPress(tab, index),
|
|
96
137
|
onLayout: genOnLayoutTab(index),
|
|
97
|
-
children: /*#__PURE__*/_jsx(
|
|
98
|
-
|
|
99
|
-
|
|
138
|
+
children: /*#__PURE__*/_jsx(Badge, {
|
|
139
|
+
count: badgeCount,
|
|
140
|
+
visible: tab.badge !== undefined,
|
|
141
|
+
size: "small",
|
|
142
|
+
offset: [-4, -4],
|
|
143
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
144
|
+
color: isActive ? theme.palette.fontGray1 : theme.palette.fontGray2,
|
|
145
|
+
font: isActive ? 'semiBold' : 'regular',
|
|
146
|
+
onLayout: genOnLayoutText(index),
|
|
147
|
+
size: 14,
|
|
148
|
+
children: tab?.label
|
|
149
|
+
})
|
|
100
150
|
})
|
|
101
|
-
},
|
|
151
|
+
}, tab?.value);
|
|
102
152
|
});
|
|
103
153
|
useEffect(() => {
|
|
104
154
|
if (state.layoutFinish) {
|
|
105
|
-
|
|
155
|
+
const index = tabs.findIndex(item => item.value === activeValue);
|
|
156
|
+
navigateTo(index === -1 ? 0 : index);
|
|
106
157
|
}
|
|
107
|
-
|
|
158
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
159
|
+
}, [state.layoutFinish, activeValue]);
|
|
108
160
|
return /*#__PURE__*/_jsx(View, {
|
|
109
161
|
style: styles.container,
|
|
110
162
|
children: /*#__PURE__*/_jsxs(ScrollView, {
|
|
@@ -112,21 +164,14 @@ export const Tabs = ({
|
|
|
112
164
|
horizontal: true,
|
|
113
165
|
showsHorizontalScrollIndicator: false,
|
|
114
166
|
onLayout: onLayoutScrollView,
|
|
167
|
+
scrollEnabled: !equalWidth,
|
|
115
168
|
contentContainerStyle: {
|
|
116
169
|
alignContent: 'center',
|
|
117
|
-
columnGap:
|
|
170
|
+
columnGap: 8,
|
|
171
|
+
flexGrow: equalWidth ? 1 : 0,
|
|
172
|
+
paddingHorizontal: 16
|
|
118
173
|
},
|
|
119
|
-
children: [
|
|
174
|
+
children: [tabs.map(renderTab), indicatorJSX]
|
|
120
175
|
})
|
|
121
176
|
});
|
|
122
|
-
};
|
|
123
|
-
const useStyles = createThemedStyles(() => {
|
|
124
|
-
return {
|
|
125
|
-
container: {
|
|
126
|
-
paddingHorizontal: 16
|
|
127
|
-
},
|
|
128
|
-
tabItem: {
|
|
129
|
-
paddingVertical: 16
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
});
|
|
177
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createThemedStyles } from "../../../../native-provider/index.js";
|
|
4
|
+
export const useTagStyles = createThemedStyles((theme, props) => {
|
|
5
|
+
const {
|
|
6
|
+
themeColor = 'primary'
|
|
7
|
+
} = props;
|
|
8
|
+
const BASE_COLOR_MAP = {
|
|
9
|
+
primary: {
|
|
10
|
+
baseColor: theme.palette.brand7,
|
|
11
|
+
lightColor: theme.palette.brand1
|
|
12
|
+
},
|
|
13
|
+
danger: {
|
|
14
|
+
baseColor: theme.palette.error6,
|
|
15
|
+
lightColor: theme.palette.error1
|
|
16
|
+
},
|
|
17
|
+
default: {
|
|
18
|
+
baseColor: theme.palette.gray6,
|
|
19
|
+
lightColor: theme.palette.gray2
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const Color = BASE_COLOR_MAP[themeColor];
|
|
23
|
+
return {
|
|
24
|
+
tag: {},
|
|
25
|
+
large: {
|
|
26
|
+
paddingHorizontal: 8,
|
|
27
|
+
paddingVertical: 4,
|
|
28
|
+
borderRadius: 4
|
|
29
|
+
},
|
|
30
|
+
medium: {
|
|
31
|
+
paddingHorizontal: 6,
|
|
32
|
+
paddingVertical: 2,
|
|
33
|
+
borderRadius: 2
|
|
34
|
+
},
|
|
35
|
+
small: {
|
|
36
|
+
paddingHorizontal: 4,
|
|
37
|
+
paddingVertical: 1.5,
|
|
38
|
+
borderRadius: 1.5
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
opacity: 0.5
|
|
42
|
+
},
|
|
43
|
+
'font-small': {
|
|
44
|
+
fontSize: 10
|
|
45
|
+
},
|
|
46
|
+
'font-medium': {
|
|
47
|
+
fontSize: 12
|
|
48
|
+
},
|
|
49
|
+
'font-large': {
|
|
50
|
+
fontSize: 14
|
|
51
|
+
},
|
|
52
|
+
filled: {
|
|
53
|
+
backgroundColor: Color.lightColor
|
|
54
|
+
},
|
|
55
|
+
'text-filled': {
|
|
56
|
+
color: Color.baseColor
|
|
57
|
+
},
|
|
58
|
+
outlined: {
|
|
59
|
+
borderColor: Color.baseColor,
|
|
60
|
+
borderWidth: 0.5
|
|
61
|
+
},
|
|
62
|
+
'text-outlined': {
|
|
63
|
+
color: Color.baseColor
|
|
64
|
+
},
|
|
65
|
+
solid: {
|
|
66
|
+
backgroundColor: Color.baseColor
|
|
67
|
+
},
|
|
68
|
+
'text-solid': {
|
|
69
|
+
color: '#fff'
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
export const useTagGroupStyles = createThemedStyles(() => {
|
|
74
|
+
return {
|
|
75
|
+
container: {
|
|
76
|
+
flexDirection: 'row',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
flexWrap: 'wrap'
|
|
79
|
+
},
|
|
80
|
+
vertical: {
|
|
81
|
+
flexDirection: 'column',
|
|
82
|
+
alignItems: 'stretch'
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { useTagGroupStyles } from "./style/index.js";
|
|
6
|
+
import { TagContext } from "./tag-context.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export const TagGroup = ({
|
|
9
|
+
children,
|
|
10
|
+
direction = 'horizontal',
|
|
11
|
+
gap = 16,
|
|
12
|
+
style,
|
|
13
|
+
size,
|
|
14
|
+
disabled
|
|
15
|
+
}) => {
|
|
16
|
+
const groupStyles = useTagGroupStyles();
|
|
17
|
+
return /*#__PURE__*/_jsx(TagContext.Provider, {
|
|
18
|
+
value: {
|
|
19
|
+
size,
|
|
20
|
+
disabled
|
|
21
|
+
},
|
|
22
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
23
|
+
style: [groupStyles.container, direction === 'vertical' && groupStyles.vertical, gap > 0 && {
|
|
24
|
+
gap
|
|
25
|
+
}, style],
|
|
26
|
+
children: children
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { use, useMemo } from 'react';
|
|
4
|
+
import { Pressable } from 'react-native';
|
|
5
|
+
import { Text } from "./../index.js";
|
|
6
|
+
import { useTagStyles } from "./style/index.js";
|
|
7
|
+
import { TagContext } from "./tag-context.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const Tag = ({
|
|
10
|
+
text,
|
|
11
|
+
variant = 'solid',
|
|
12
|
+
style,
|
|
13
|
+
theme = 'primary',
|
|
14
|
+
disabled: customDisabled,
|
|
15
|
+
size,
|
|
16
|
+
child,
|
|
17
|
+
textStyle,
|
|
18
|
+
onPress
|
|
19
|
+
}) => {
|
|
20
|
+
const context = use(TagContext);
|
|
21
|
+
const mergedDisabled = customDisabled ?? context.disabled ?? false;
|
|
22
|
+
const mergedSize = size ?? context.size ?? 'medium';
|
|
23
|
+
const styles = useTagStyles({
|
|
24
|
+
variant,
|
|
25
|
+
themeColor: theme,
|
|
26
|
+
mergedSize
|
|
27
|
+
});
|
|
28
|
+
const tagStyle = useMemo(() => {
|
|
29
|
+
return [styles.tag, styles[variant], styles[mergedSize], style];
|
|
30
|
+
}, [mergedSize, style, variant, styles]);
|
|
31
|
+
const tagNode = /*#__PURE__*/_jsx(Pressable, {
|
|
32
|
+
style: tagStyle,
|
|
33
|
+
onPress: mergedDisabled ? undefined : onPress,
|
|
34
|
+
disabled: mergedDisabled,
|
|
35
|
+
children: child ? child : /*#__PURE__*/_jsx(Text, {
|
|
36
|
+
style: [styles[`text-${variant}`], styles[`font-${mergedSize}`], textStyle],
|
|
37
|
+
children: text
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
return tagNode;
|
|
41
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
|
-
import { Platform } from 'react-native';
|
|
5
4
|
import { Portal } from "../components/base/index.js";
|
|
6
5
|
import { createTheme } from "../shared/theme/index.js";
|
|
7
6
|
import { ConfigContext, RequestContext } from "./contexts/index.js";
|
|
@@ -14,9 +13,9 @@ export const NativeProvider = ({
|
|
|
14
13
|
children,
|
|
15
14
|
navigators,
|
|
16
15
|
errorBoundary,
|
|
17
|
-
request = null
|
|
16
|
+
request = null,
|
|
17
|
+
portalHostProps
|
|
18
18
|
}) => {
|
|
19
|
-
const isNative = Platform.OS !== 'web';
|
|
20
19
|
const themeContextValue = useMemo(() => createTheme(theme), [theme]);
|
|
21
20
|
return /*#__PURE__*/_jsx(SafeAreaCompactProvider, {
|
|
22
21
|
children: /*#__PURE__*/_jsx(ConfigContext, {
|
|
@@ -29,9 +28,10 @@ export const NativeProvider = ({
|
|
|
29
28
|
value: themeContextValue,
|
|
30
29
|
children: /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
31
30
|
...errorBoundary,
|
|
32
|
-
children:
|
|
31
|
+
children: /*#__PURE__*/_jsx(Portal.Host, {
|
|
32
|
+
...portalHostProps,
|
|
33
33
|
children: children
|
|
34
|
-
})
|
|
34
|
+
})
|
|
35
35
|
})
|
|
36
36
|
})
|
|
37
37
|
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { isNil } from 'lodash-es';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 浅比较两个对象是否相等
|
|
7
|
+
*
|
|
8
|
+
* 仅比较对象的第一层属性,使用严格相等(===)进行比较。
|
|
9
|
+
* 不会递归比较嵌套对象或数组的内容。
|
|
10
|
+
*
|
|
11
|
+
* @param a - 第一个对象
|
|
12
|
+
* @param b - 第二个对象
|
|
13
|
+
* @returns 如果两个对象的所有第一层属性都相等则返回 true,否则返回 false。如果 a/b 有一个非对象,则直接比较二者
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2 }); // true
|
|
17
|
+
* shallowEqual({ a: 1 }, { a: 1, b: 2 }); // false
|
|
18
|
+
* shallowEqual({ a: { x: 1 } }, { a: { x: 1 } }); // false
|
|
19
|
+
* shallowEqual(null, null); // true
|
|
20
|
+
* shallowEqual(null, undefined); // false
|
|
21
|
+
* shallowEqual(1, 1); // true
|
|
22
|
+
* shallowEqual(1, '1'); // false
|
|
23
|
+
*/
|
|
24
|
+
export const shallowEqual = (a, b) => {
|
|
25
|
+
if (isNil(a) || isNil(b)) {
|
|
26
|
+
return a === b;
|
|
27
|
+
}
|
|
28
|
+
if (typeof a !== 'object' || typeof b !== 'object') {
|
|
29
|
+
return a === b;
|
|
30
|
+
}
|
|
31
|
+
const aKeys = Object.keys(a);
|
|
32
|
+
const bKeys = Object.keys(b);
|
|
33
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
34
|
+
return aKeys.every(key => a[key] === b[key]);
|
|
35
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native';
|
|
2
|
+
import type { CarouselProps } from './types';
|
|
3
|
+
interface CarouselIndicatorProps {
|
|
4
|
+
/** 指示器配置(false 表示不显示,函数表示自定义渲染) */
|
|
5
|
+
indicator: CarouselProps['indicator'];
|
|
6
|
+
/** 指示器属性配置(颜色、样式) */
|
|
7
|
+
indicatorProps: CarouselProps['indicatorProps'];
|
|
8
|
+
/** 轮播项总数 */
|
|
9
|
+
total: number;
|
|
10
|
+
/** 当前激活的索引 */
|
|
11
|
+
current: number;
|
|
12
|
+
/** 激活状态的指示器颜色 */
|
|
13
|
+
activeColor: string;
|
|
14
|
+
/** 非激活状态的指示器颜色 */
|
|
15
|
+
inactiveColor: string;
|
|
16
|
+
/** 指示器样式对象 */
|
|
17
|
+
styles: {
|
|
18
|
+
indicatorContainer: ViewStyle;
|
|
19
|
+
indicatorDot: ViewStyle;
|
|
20
|
+
indicatorDotActive: ViewStyle;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 轮播图指示器渲染组件
|
|
25
|
+
*
|
|
26
|
+
* 负责渲染轮播图底部的指示器(小圆点),支持自定义指示器或使用默认样式。
|
|
27
|
+
* 当轮播项总数小于等于 1 时,不显示指示器。
|
|
28
|
+
*
|
|
29
|
+
* @param props - 组件属性配置
|
|
30
|
+
* @param props.indicator - 指示器配置(false 表示不显示,函数表示自定义渲染)
|
|
31
|
+
* @param props.indicatorProps - 指示器属性配置(颜色、样式)
|
|
32
|
+
* @param props.total - 轮播项总数
|
|
33
|
+
* @param props.current - 当前激活的索引
|
|
34
|
+
* @param props.activeColor - 激活状态的指示器颜色
|
|
35
|
+
* @param props.inactiveColor - 非激活状态的指示器颜色
|
|
36
|
+
* @param props.styles - 指示器样式对象
|
|
37
|
+
*
|
|
38
|
+
* @returns 渲染的指示器内容或 null
|
|
39
|
+
*/
|
|
40
|
+
export declare const CarouselIndicator: (props: CarouselIndicatorProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=carousel-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-indicator.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel-indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,UAAU,sBAAsB;IAC9B,mCAAmC;IACnC,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACtC,qBAAqB;IACrB,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAChD,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc;IACd,MAAM,EAAE;QACN,kBAAkB,EAAE,SAAS,CAAC;QAC9B,YAAY,EAAE,SAAS,CAAC;QACxB,kBAAkB,EAAE,SAAS,CAAC;KAC/B,CAAC;CACH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,gWAqC9D,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
interface CarouselSlidesProps<Data = unknown> {
|
|
3
|
+
/** 数据源数组 */
|
|
4
|
+
data: Data[];
|
|
5
|
+
/** 渲染每一项的函数 */
|
|
6
|
+
renderItem: (item: Data, index: number) => ReactNode;
|
|
7
|
+
/** 轮播项总数 */
|
|
8
|
+
total: number;
|
|
9
|
+
/** 虚拟渲染范围(start、end、isVirtual) */
|
|
10
|
+
virtualRange: {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
isVirtual: boolean;
|
|
14
|
+
} | null;
|
|
15
|
+
/** 是否启用循环播放 */
|
|
16
|
+
loopEnabled: boolean;
|
|
17
|
+
/** 循环播放时前置克隆节点数量 */
|
|
18
|
+
clonesBefore: number;
|
|
19
|
+
/** 滑动方向 */
|
|
20
|
+
direction: 'horizontal' | 'vertical';
|
|
21
|
+
/** 单个滑块的像素大小 */
|
|
22
|
+
slidePixels: number;
|
|
23
|
+
/** 扩展后的总数(包含克隆节点) */
|
|
24
|
+
extTotal: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 轮播图滑块渲染组件
|
|
28
|
+
*
|
|
29
|
+
* 负责渲染轮播图的滑块内容,使用 data + renderItem 模式。
|
|
30
|
+
* 实现虚拟渲染优化,仅渲染可见范围内的滑块,并处理循环播放时的克隆逻辑。
|
|
31
|
+
* 为虚拟渲染添加前后占位空间,确保滚动位置正确。
|
|
32
|
+
*
|
|
33
|
+
* @template Data - 数据项类型
|
|
34
|
+
* @param props - 组件属性配置
|
|
35
|
+
* @param props.data - 数据源数组
|
|
36
|
+
* @param props.renderItem - 渲染每一项的函数
|
|
37
|
+
* @param props.total - 轮播项总数
|
|
38
|
+
* @param props.virtualRange - 虚拟渲染范围(start、end、isVirtual)
|
|
39
|
+
* @param props.loopEnabled - 是否启用循环播放
|
|
40
|
+
* @param props.clonesBefore - 循环播放时前置克隆节点数量
|
|
41
|
+
* @param props.direction - 滑动方向
|
|
42
|
+
* @param props.slidePixels - 单个滑块的像素大小
|
|
43
|
+
* @param props.extTotal - 扩展后的总数(包含克隆节点)
|
|
44
|
+
*
|
|
45
|
+
* @returns 渲染的滑块内容或 null
|
|
46
|
+
*/
|
|
47
|
+
export declare const CarouselSlides: <Data = unknown>(props: CarouselSlidesProps<Data>) => import("react").JSX.Element | null;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=carousel-slides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-slides.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel-slides.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAGhD,UAAU,mBAAmB,CAAC,IAAI,GAAG,OAAO;IAC1C,YAAY;IACZ,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,eAAe;IACf,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,SAAS,CAAC;IACrD,YAAY;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,OAAO,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,eAAe;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW;IACX,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IACrC,gBAAgB;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,GAAG,OAAO,EAC3C,OAAO,mBAAmB,CAAC,IAAI,CAAC,uCA4HjC,CAAC"}
|
|
@@ -8,24 +8,29 @@ import type { CarouselProps } from './types';
|
|
|
8
8
|
* @example
|
|
9
9
|
* ```tsx
|
|
10
10
|
* // 基础用法
|
|
11
|
-
* <Carousel
|
|
12
|
-
*
|
|
13
|
-
* <
|
|
14
|
-
*
|
|
11
|
+
* <Carousel
|
|
12
|
+
* data={[1, 2, 3]}
|
|
13
|
+
* renderItem={(item) => <View><Text>{item}</Text></View>}
|
|
14
|
+
* />
|
|
15
15
|
*
|
|
16
16
|
* // 循环播放和自动轮播
|
|
17
|
-
* <Carousel
|
|
18
|
-
* {items
|
|
19
|
-
* </
|
|
17
|
+
* <Carousel
|
|
18
|
+
* data={items}
|
|
19
|
+
* renderItem={(item) => <View>{item.content}</View>}
|
|
20
|
+
* loop
|
|
21
|
+
* autoplay
|
|
22
|
+
* autoplayInterval={3000}
|
|
23
|
+
* />
|
|
20
24
|
*
|
|
21
25
|
* // 虚拟渲染(大量数据)
|
|
22
|
-
* <Carousel
|
|
23
|
-
* {
|
|
24
|
-
* </
|
|
26
|
+
* <Carousel
|
|
27
|
+
* data={largeDataArray}
|
|
28
|
+
* renderItem={(item, index) => <View><Text>{index}: {item}</Text></View>}
|
|
29
|
+
* />
|
|
25
30
|
* ```
|
|
26
31
|
*
|
|
27
32
|
* @param props - 组件属性
|
|
28
33
|
* @returns 轮播图组件
|
|
29
34
|
*/
|
|
30
|
-
export declare const Carousel: (props: CarouselProps) => React.JSX.Element;
|
|
35
|
+
export declare const Carousel: <Data = unknown>(props: CarouselProps<Data>) => React.JSX.Element | null;
|
|
31
36
|
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../../../src/components/base/carousel/carousel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAsB9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,GAAG,OAAO,EAAG,OAAO,aAAa,CAAC,IAAI,CAAC,6BA0RnE,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { useCarouselAutoplay } from './use-carousel-autoplay';
|
|
2
2
|
export { useCarouselIndex } from './use-carousel-index';
|
|
3
|
-
export { useCarouselIndicator } from './use-carousel-indicator';
|
|
4
3
|
export { useCarouselLifecycle } from './use-carousel-lifecycle';
|
|
5
4
|
export { useCarouselPanResponder } from './use-carousel-pan-responder';
|
|
6
5
|
export { useCarouselPosition } from './use-carousel-position';
|
|
7
|
-
export { useCarouselSlides } from './use-carousel-slides';
|
|
8
6
|
export { useCarouselSwipe } from './use-carousel-swipe';
|
|
9
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel-index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-carousel-index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-index.ts"],"names":[],"mappings":"AASA,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,sBAAsB;;0BAkBpD,MAAM;;;;kCAeL,MAAM;qCAQH,MAAM;6CAcH,MAAM;;CAuDvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel-lifecycle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAElD,UAAU,0BAA0B;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,0BAA0B,
|
|
1
|
+
{"version":3,"file":"use-carousel-lifecycle.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-lifecycle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAElD,UAAU,0BAA0B;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,cAAc,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,oBAAoB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,0BAA0B,SAmDtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel-pan-responder.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-pan-responder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"use-carousel-pan-responder.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-pan-responder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAC;AACxD,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAYtB,UAAU,6BAA6B;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,GAAG,UAAU,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,gBAAgB,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACjD,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,6BAA6B,KACpC,oBAAoB,GAAG,IAiIzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-carousel-position.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-position.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAU,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"use-carousel-position.d.ts","sourceRoot":"","sources":["../../../../../../src/components/base/carousel/hooks/use-carousel-position.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAU,MAAM,cAAc,CAAC;AAOhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB;;;yBAIU,MAAM,eAAe,MAAM,IAAI;oCAkBpB,MAAM;CAY1D,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export * from './carousel';
|
|
2
|
-
export * from './carousel-item';
|
|
3
2
|
export type * from './types';
|
|
4
|
-
export declare const Carousel: (
|
|
5
|
-
Item: import("react").FC<import("react").PropsWithChildren<import("./types").CarouselItemProps>>;
|
|
6
|
-
};
|
|
3
|
+
export declare const Carousel: <Data = unknown>(props: import("./types").CarouselProps<Data>) => import("react").JSX.Element | null;
|
|
7
4
|
//# sourceMappingURL=index.d.ts.map
|