sard 1.0.0-canary.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/dist/accordion/Item.d.ts +17 -0
- package/dist/accordion/Item.js +25 -0
- package/dist/accordion/index.d.ts +26 -0
- package/dist/accordion/index.js +27 -0
- package/dist/accordion/index.scss +49 -0
- package/dist/action-sheet/ActionSheet.d.ts +24 -0
- package/dist/action-sheet/ActionSheet.js +79 -0
- package/dist/action-sheet/Agent.d.ts +6 -0
- package/dist/action-sheet/Agent.js +7 -0
- package/dist/action-sheet/Item.d.ts +16 -0
- package/dist/action-sheet/Item.js +22 -0
- package/dist/action-sheet/imperative.d.ts +10 -0
- package/dist/action-sheet/imperative.js +22 -0
- package/dist/action-sheet/index.d.ts +12 -0
- package/dist/action-sheet/index.js +10 -0
- package/dist/action-sheet/index.scss +148 -0
- package/dist/animated/index.d.ts +62 -0
- package/dist/animated/index.js +101 -0
- package/dist/animated/index.rn.d.ts +4 -0
- package/dist/animated/index.rn.js +35 -0
- package/dist/avatar/Group.d.ts +9 -0
- package/dist/avatar/Group.js +27 -0
- package/dist/avatar/index.d.ts +17 -0
- package/dist/avatar/index.js +22 -0
- package/dist/avatar/index.scss +82 -0
- package/dist/badge/index.d.ts +13 -0
- package/dist/badge/index.js +16 -0
- package/dist/badge/index.scss +81 -0
- package/dist/base.d.ts +11 -0
- package/dist/base.js +1 -0
- package/dist/button/CustomButton.d.ts +9 -0
- package/dist/button/CustomButton.js +23 -0
- package/dist/button/index.d.ts +21 -0
- package/dist/button/index.js +34 -0
- package/dist/button/index.scss +346 -0
- package/dist/calendar/Day.d.ts +23 -0
- package/dist/calendar/Day.js +70 -0
- package/dist/calendar/MonthPicker.d.ts +13 -0
- package/dist/calendar/MonthPicker.js +22 -0
- package/dist/calendar/Toolbar.d.ts +11 -0
- package/dist/calendar/Toolbar.js +18 -0
- package/dist/calendar/Weeks.d.ts +6 -0
- package/dist/calendar/Weeks.js +18 -0
- package/dist/calendar/index.d.ts +48 -0
- package/dist/calendar/index.js +193 -0
- package/dist/calendar/index.scss +210 -0
- package/dist/card/index.d.ts +15 -0
- package/dist/card/index.js +14 -0
- package/dist/card/index.scss +64 -0
- package/dist/cascader/index.d.ts +43 -0
- package/dist/cascader/index.js +216 -0
- package/dist/cascader/index.scss +130 -0
- package/dist/checkbox/Group.d.ts +5 -0
- package/dist/checkbox/Group.js +5 -0
- package/dist/checkbox/index.d.ts +10 -0
- package/dist/checkbox/index.js +8 -0
- package/dist/checkbox/index.scss +78 -0
- package/dist/collapse/index.d.ts +14 -0
- package/dist/collapse/index.js +61 -0
- package/dist/collapse/index.rn.d.ts +14 -0
- package/dist/collapse/index.rn.js +76 -0
- package/dist/collapse/index.scss +31 -0
- package/dist/components.d.ts +66 -0
- package/dist/components.js +66 -0
- package/dist/components.scss +65 -0
- package/dist/config-provider/index.d.ts +21 -0
- package/dist/config-provider/index.js +20 -0
- package/dist/count-down/index.d.ts +26 -0
- package/dist/count-down/index.js +95 -0
- package/dist/datetime-picker/index.d.ts +36 -0
- package/dist/datetime-picker/index.js +230 -0
- package/dist/dialog/Agent.d.ts +6 -0
- package/dist/dialog/Agent.js +7 -0
- package/dist/dialog/Dialog.d.ts +31 -0
- package/dist/dialog/Dialog.js +103 -0
- package/dist/dialog/imperative.d.ts +17 -0
- package/dist/dialog/imperative.js +35 -0
- package/dist/dialog/index.d.ts +14 -0
- package/dist/dialog/index.js +12 -0
- package/dist/dialog/index.scss +156 -0
- package/dist/dropdown/Item.d.ts +33 -0
- package/dist/dropdown/Item.js +164 -0
- package/dist/dropdown/Option.d.ts +10 -0
- package/dist/dropdown/Option.js +12 -0
- package/dist/dropdown/index.d.ts +20 -0
- package/dist/dropdown/index.js +59 -0
- package/dist/dropdown/index.scss +236 -0
- package/dist/ellipsis/index.d.ts +8 -0
- package/dist/ellipsis/index.js +18 -0
- package/dist/ellipsis/index.scss +23 -0
- package/dist/empty/index.d.ts +10 -0
- package/dist/empty/index.js +14 -0
- package/dist/empty/index.scss +59 -0
- package/dist/footer-bar/index.d.ts +8 -0
- package/dist/footer-bar/index.js +15 -0
- package/dist/footer-bar/index.scss +29 -0
- package/dist/form/CustomForm.d.ts +13 -0
- package/dist/form/CustomForm.js +26 -0
- package/dist/form/ErrorList.d.ts +6 -0
- package/dist/form/ErrorList.js +15 -0
- package/dist/form/Field.d.ts +41 -0
- package/dist/form/Field.js +124 -0
- package/dist/form/FieldContext.d.ts +18 -0
- package/dist/form/FieldContext.js +8 -0
- package/dist/form/List.d.ts +31 -0
- package/dist/form/List.js +87 -0
- package/dist/form/Map.d.ts +17 -0
- package/dist/form/Map.js +24 -0
- package/dist/form/NodeContext.d.ts +12 -0
- package/dist/form/NodeContext.js +14 -0
- package/dist/form/Validator.d.ts +88 -0
- package/dist/form/Validator.js +268 -0
- package/dist/form/createFormStore.d.ts +36 -0
- package/dist/form/createFormStore.js +249 -0
- package/dist/form/index.d.ts +43 -0
- package/dist/form/index.js +109 -0
- package/dist/form/index.scss +200 -0
- package/dist/form/store/Context.d.ts +4 -0
- package/dist/form/store/Context.js +3 -0
- package/dist/form/store/createStore.d.ts +6 -0
- package/dist/form/store/createStore.js +28 -0
- package/dist/form/store/useDispatch.d.ts +2 -0
- package/dist/form/store/useDispatch.js +10 -0
- package/dist/form/store/useSelector.d.ts +7 -0
- package/dist/form/store/useSelector.js +35 -0
- package/dist/form/type.d.ts +20 -0
- package/dist/form/type.js +1 -0
- package/dist/form/useForm.d.ts +27 -0
- package/dist/form/useForm.js +14 -0
- package/dist/form/useInternalWatch.d.ts +3 -0
- package/dist/form/useInternalWatch.js +27 -0
- package/dist/form/useNode.d.ts +49 -0
- package/dist/form/useNode.js +284 -0
- package/dist/form/useValidator.d.ts +23 -0
- package/dist/form/useValidator.js +74 -0
- package/dist/form/useWatch.d.ts +4 -0
- package/dist/form/useWatch.js +24 -0
- package/dist/grid/Col.d.ts +9 -0
- package/dist/grid/Col.js +20 -0
- package/dist/grid/Row.d.ts +11 -0
- package/dist/grid/Row.js +34 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +2 -0
- package/dist/grid/index.scss +56 -0
- package/dist/halfline/index.d.ts +10 -0
- package/dist/halfline/index.js +27 -0
- package/dist/halfline/index.scss +80 -0
- package/dist/icon/common.d.ts +15 -0
- package/dist/icon/common.js +1 -0
- package/dist/icon/font/iconfont.json +275 -0
- package/dist/icon/font/iconfont.rn.scss +0 -0
- package/dist/icon/font/iconfont.scss +164 -0
- package/dist/icon/font/iconfont.ttf +0 -0
- package/dist/icon/fontLoader.d.ts +7 -0
- package/dist/icon/fontLoader.js +14 -0
- package/dist/icon/fontLoader.rn.d.ts +6 -0
- package/dist/icon/fontLoader.rn.js +52 -0
- package/dist/icon/index.d.ts +21 -0
- package/dist/icon/index.js +41 -0
- package/dist/icon/index.scss +23 -0
- package/dist/index-bar/Item.d.ts +9 -0
- package/dist/index-bar/Item.js +11 -0
- package/dist/index-bar/Nav.d.ts +13 -0
- package/dist/index-bar/Nav.js +75 -0
- package/dist/index-bar/index.d.ts +19 -0
- package/dist/index-bar/index.js +142 -0
- package/dist/index-bar/index.scss +153 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.scss +1 -0
- package/dist/input/index.d.ts +37 -0
- package/dist/input/index.js +116 -0
- package/dist/input/index.scss +249 -0
- package/dist/linear-gradient/index.d.ts +14 -0
- package/dist/linear-gradient/index.js +30 -0
- package/dist/linear-gradient/index.rn.d.ts +3 -0
- package/dist/linear-gradient/index.rn.js +3 -0
- package/dist/list/Item.d.ts +22 -0
- package/dist/list/Item.js +26 -0
- package/dist/list/ListContext.d.ts +9 -0
- package/dist/list/ListContext.js +2 -0
- package/dist/list/OrderContext.d.ts +8 -0
- package/dist/list/OrderContext.js +6 -0
- package/dist/list/index.d.ts +19 -0
- package/dist/list/index.js +29 -0
- package/dist/list/index.scss +257 -0
- package/dist/loading/index.d.ts +10 -0
- package/dist/loading/index.js +47 -0
- package/dist/loading/index.scss +25 -0
- package/dist/locale/index.d.ts +199 -0
- package/dist/locale/index.js +36 -0
- package/dist/locale/lang/en-US.d.ts +92 -0
- package/dist/locale/lang/en-US.js +92 -0
- package/dist/locale/lang/zh-CN.d.ts +92 -0
- package/dist/locale/lang/zh-CN.js +92 -0
- package/dist/locale/useTranslate.d.ts +7 -0
- package/dist/locale/useTranslate.js +41 -0
- package/dist/mask/index.d.ts +13 -0
- package/dist/mask/index.js +26 -0
- package/dist/mask/index.scss +24 -0
- package/dist/menu/Item.d.ts +15 -0
- package/dist/menu/Item.js +17 -0
- package/dist/menu/index.d.ts +17 -0
- package/dist/menu/index.js +15 -0
- package/dist/menu/index.scss +128 -0
- package/dist/mesh/Item.d.ts +16 -0
- package/dist/mesh/Item.js +16 -0
- package/dist/mesh/index.d.ts +14 -0
- package/dist/mesh/index.js +69 -0
- package/dist/mesh/index.scss +131 -0
- package/dist/mesh/type.d.ts +9 -0
- package/dist/mesh/type.js +1 -0
- package/dist/modal/index.d.ts +8 -0
- package/dist/modal/index.js +9 -0
- package/dist/modal/index.rn.d.ts +8 -0
- package/dist/modal/index.rn.js +8 -0
- package/dist/navbar/Item.d.ts +8 -0
- package/dist/navbar/Item.js +11 -0
- package/dist/navbar/index.d.ts +15 -0
- package/dist/navbar/index.js +16 -0
- package/dist/navbar/index.scss +128 -0
- package/dist/notice-bar/index.d.ts +28 -0
- package/dist/notice-bar/index.js +135 -0
- package/dist/notice-bar/index.scss +109 -0
- package/dist/notify/Agent.d.ts +6 -0
- package/dist/notify/Agent.js +7 -0
- package/dist/notify/Notify.d.ts +22 -0
- package/dist/notify/Notify.js +48 -0
- package/dist/notify/imperative.d.ts +18 -0
- package/dist/notify/imperative.js +35 -0
- package/dist/notify/index.d.ts +15 -0
- package/dist/notify/index.js +13 -0
- package/dist/notify/index.scss +65 -0
- package/dist/number-keyboard/index.d.ts +10 -0
- package/dist/number-keyboard/index.js +51 -0
- package/dist/number-keyboard/index.scss +93 -0
- package/dist/pagination/index.d.ts +20 -0
- package/dist/pagination/index.js +65 -0
- package/dist/pagination/index.scss +131 -0
- package/dist/pan-gesture-detector/index.d.ts +8 -0
- package/dist/pan-gesture-detector/index.js +11 -0
- package/dist/pan-gesture-detector/index.rn.d.ts +8 -0
- package/dist/pan-gesture-detector/index.rn.js +23 -0
- package/dist/pan-gesture-detector/usePan.d.ts +47 -0
- package/dist/pan-gesture-detector/usePan.js +146 -0
- package/dist/password-input/index.d.ts +22 -0
- package/dist/password-input/index.js +91 -0
- package/dist/password-input/index.scss +189 -0
- package/dist/picker/InertialMotion.d.ts +20 -0
- package/dist/picker/InertialMotion.js +141 -0
- package/dist/picker/PickerView.d.ts +1 -0
- package/dist/picker/PickerView.h5.d.ts +17 -0
- package/dist/picker/PickerView.h5.js +36 -0
- package/dist/picker/PickerView.js +1 -0
- package/dist/picker/PickerViewColumn copy.d.ts +9 -0
- package/dist/picker/PickerViewColumn copy.js +143 -0
- package/dist/picker/PickerViewColumn.d.ts +12 -0
- package/dist/picker/PickerViewColumn.js +238 -0
- package/dist/picker/index.d.ts +38 -0
- package/dist/picker/index.js +224 -0
- package/dist/picker/index.rn.scss +0 -0
- package/dist/picker/index.scss +138 -0
- package/dist/popout/index.d.ts +25 -0
- package/dist/popout/index.js +87 -0
- package/dist/popout/index.scss +136 -0
- package/dist/popout-input/index.d.ts +29 -0
- package/dist/popout-input/index.js +91 -0
- package/dist/popout-input/index.scss +53 -0
- package/dist/popover/index.d.ts +35 -0
- package/dist/popover/index.js +193 -0
- package/dist/popover/index.scss +94 -0
- package/dist/popover/utils.d.ts +23 -0
- package/dist/popover/utils.js +124 -0
- package/dist/popup/index.d.ts +29 -0
- package/dist/popup/index.js +60 -0
- package/dist/popup/index.scss +60 -0
- package/dist/pressable/index.d.ts +13 -0
- package/dist/pressable/index.js +58 -0
- package/dist/pressable/index.rn.d.ts +13 -0
- package/dist/pressable/index.rn.js +50 -0
- package/dist/progress-bar/index.d.ts +10 -0
- package/dist/progress-bar/index.js +22 -0
- package/dist/progress-bar/index.scss +45 -0
- package/dist/progress-circle/index.d.ts +11 -0
- package/dist/progress-circle/index.js +54 -0
- package/dist/progress-circle/index.scss +141 -0
- package/dist/radio/Group.d.ts +5 -0
- package/dist/radio/Group.js +5 -0
- package/dist/radio/index.d.ts +10 -0
- package/dist/radio/index.js +8 -0
- package/dist/radio/index.scss +77 -0
- package/dist/rate/index.d.ts +23 -0
- package/dist/rate/index.js +116 -0
- package/dist/rate/index.scss +99 -0
- package/dist/result/index.d.ts +12 -0
- package/dist/result/index.js +19 -0
- package/dist/result/index.scss +88 -0
- package/dist/safe-area/index.d.ts +7 -0
- package/dist/safe-area/index.js +35 -0
- package/dist/safe-area/index.scss +24 -0
- package/dist/scroll-view/index.d.ts +24 -0
- package/dist/scroll-view/index.js +72 -0
- package/dist/scroll-view/index.rn.d.ts +21 -0
- package/dist/scroll-view/index.rn.js +51 -0
- package/dist/search/index.d.ts +26 -0
- package/dist/search/index.js +35 -0
- package/dist/search/index.scss +75 -0
- package/dist/share-sheet/Item.d.ts +15 -0
- package/dist/share-sheet/Item.js +26 -0
- package/dist/share-sheet/Row.d.ts +10 -0
- package/dist/share-sheet/Row.js +26 -0
- package/dist/share-sheet/index.d.ts +26 -0
- package/dist/share-sheet/index.js +76 -0
- package/dist/share-sheet/index.scss +230 -0
- package/dist/skeleton/Avatar.d.ts +7 -0
- package/dist/skeleton/Avatar.js +17 -0
- package/dist/skeleton/Block.d.ts +8 -0
- package/dist/skeleton/Block.js +44 -0
- package/dist/skeleton/Paragraph.d.ts +7 -0
- package/dist/skeleton/Paragraph.js +13 -0
- package/dist/skeleton/Title.d.ts +7 -0
- package/dist/skeleton/Title.js +16 -0
- package/dist/skeleton/index.d.ts +28 -0
- package/dist/skeleton/index.js +22 -0
- package/dist/skeleton/index.scss +108 -0
- package/dist/slider/index.d.ts +36 -0
- package/dist/slider/index.js +187 -0
- package/dist/slider/index.scss +138 -0
- package/dist/space/index.d.ts +13 -0
- package/dist/space/index.js +33 -0
- package/dist/space/index.scss +36 -0
- package/dist/stepper/index.d.ts +26 -0
- package/dist/stepper/index.js +138 -0
- package/dist/stepper/index.scss +106 -0
- package/dist/steps/Step.d.ts +23 -0
- package/dist/steps/Step.js +41 -0
- package/dist/steps/index.d.ts +23 -0
- package/dist/steps/index.js +38 -0
- package/dist/steps/index.scss +300 -0
- package/dist/style/base.scss +3 -0
- package/dist/style/functions.scss +54 -0
- package/dist/style/index.d.ts +2 -0
- package/dist/style/index.js +2 -0
- package/dist/style/index.scss +0 -0
- package/dist/style/mixins/bem.scss +63 -0
- package/dist/style/mixins/border.scss +80 -0
- package/dist/style/mixins/disabled.scss +9 -0
- package/dist/style/mixins/env.rn.scss +11 -0
- package/dist/style/mixins/env.scss +11 -0
- package/dist/style/mixins/fixed.rn.scss +3 -0
- package/dist/style/mixins/fixed.scss +3 -0
- package/dist/style/mixins/sticky.rn.scss +3 -0
- package/dist/style/mixins/sticky.scss +3 -0
- package/dist/style/mixins/theme.scss +11 -0
- package/dist/style/mixins/universal.rn.scss +2 -0
- package/dist/style/mixins/universal.scss +6 -0
- package/dist/style/mixins.scss +8 -0
- package/dist/style/utils.scss +130 -0
- package/dist/style/variables.scss +422 -0
- package/dist/swiper/Item.d.ts +8 -0
- package/dist/swiper/Item.js +10 -0
- package/dist/swiper/index.d.ts +12 -0
- package/dist/swiper/index.js +13 -0
- package/dist/swiper/index.scss +10 -0
- package/dist/switch/index.d.ts +19 -0
- package/dist/switch/index.js +78 -0
- package/dist/switch/index.scss +106 -0
- package/dist/tabbar/Item.d.ts +17 -0
- package/dist/tabbar/Item.js +24 -0
- package/dist/tabbar/index.d.ts +17 -0
- package/dist/tabbar/index.js +33 -0
- package/dist/tabbar/index.scss +89 -0
- package/dist/tabs/Tab.d.ts +12 -0
- package/dist/tabs/Tab.js +17 -0
- package/dist/tabs/index.d.ts +23 -0
- package/dist/tabs/index.js +258 -0
- package/dist/tabs/index.scss +113 -0
- package/dist/tag/index.d.ts +17 -0
- package/dist/tag/index.js +21 -0
- package/dist/tag/index.scss +93 -0
- package/dist/template/index.d.ts +6 -0
- package/dist/template/index.js +10 -0
- package/dist/template/index.scss +16 -0
- package/dist/toast/Agent.d.ts +6 -0
- package/dist/toast/Agent.js +7 -0
- package/dist/toast/Toast.d.ts +24 -0
- package/dist/toast/Toast.js +43 -0
- package/dist/toast/imperative.d.ts +18 -0
- package/dist/toast/imperative.js +35 -0
- package/dist/toast/index.d.ts +15 -0
- package/dist/toast/index.js +13 -0
- package/dist/toast/index.scss +96 -0
- package/dist/transition/CSSTransition.d.ts +7 -0
- package/dist/transition/CSSTransition.js +49 -0
- package/dist/transition/CSSTransition.rn.d.ts +7 -0
- package/dist/transition/CSSTransition.rn.js +312 -0
- package/dist/transition/index.d.ts +43 -0
- package/dist/transition/index.js +156 -0
- package/dist/transition/index.rn.scss +0 -0
- package/dist/transition/index.scss +158 -0
- package/dist/upload/Preview.d.ts +35 -0
- package/dist/upload/Preview.js +41 -0
- package/dist/upload/PreviewVideo.d.ts +7 -0
- package/dist/upload/PreviewVideo.js +38 -0
- package/dist/upload/PreviewVideo.rn.d.ts +6 -0
- package/dist/upload/PreviewVideo.rn.js +24 -0
- package/dist/upload/chooseMedia.d.ts +26 -0
- package/dist/upload/chooseMedia.h5.d.ts +25 -0
- package/dist/upload/chooseMedia.h5.js +117 -0
- package/dist/upload/chooseMedia.js +55 -0
- package/dist/upload/index.d.ts +37 -0
- package/dist/upload/index.js +167 -0
- package/dist/upload/index.scss +247 -0
- package/dist/use/index.d.ts +20 -0
- package/dist/use/index.js +20 -0
- package/dist/use/useAutoplay.d.ts +1 -0
- package/dist/use/useAutoplay.js +34 -0
- package/dist/use/useBem.d.ts +9 -0
- package/dist/use/useBem.js +52 -0
- package/dist/use/useBrush.d.ts +23 -0
- package/dist/use/useBrush.js +61 -0
- package/dist/use/useControllableValue.d.ts +12 -0
- package/dist/use/useControllableValue.js +59 -0
- package/dist/use/useEvent.d.ts +4 -0
- package/dist/use/useEvent.js +12 -0
- package/dist/use/useForceRender.d.ts +5 -0
- package/dist/use/useForceRender.js +8 -0
- package/dist/use/useIndexableMap.d.ts +21 -0
- package/dist/use/useIndexableMap.js +65 -0
- package/dist/use/useInertRef.d.ts +7 -0
- package/dist/use/useInertRef.js +15 -0
- package/dist/use/useInternalSelect.d.ts +42 -0
- package/dist/use/useInternalSelect.js +64 -0
- package/dist/use/useLayoutUpdateEffect.d.ts +5 -0
- package/dist/use/useLayoutUpdateEffect.js +18 -0
- package/dist/use/usePropRef.d.ts +5 -0
- package/dist/use/usePropRef.js +9 -0
- package/dist/use/useResize.d.ts +2 -0
- package/dist/use/useResize.js +14 -0
- package/dist/use/useResizeObserver.d.ts +5 -0
- package/dist/use/useResizeObserver.js +38 -0
- package/dist/use/useSelect.d.ts +15 -0
- package/dist/use/useSelect.js +56 -0
- package/dist/use/useSelectorId.d.ts +1 -0
- package/dist/use/useSelectorId.js +5 -0
- package/dist/use/useSetTimeout.d.ts +10 -0
- package/dist/use/useSetTimeout.js +34 -0
- package/dist/use/useStopMovePropagate.d.ts +5 -0
- package/dist/use/useStopMovePropagate.js +28 -0
- package/dist/use/useThrottle.d.ts +8 -0
- package/dist/use/useThrottle.js +11 -0
- package/dist/use/useUpdateEffect.d.ts +5 -0
- package/dist/use/useUpdateEffect.js +18 -0
- package/dist/use/useUpdateWatchSync.d.ts +5 -0
- package/dist/use/useUpdateWatchSync.js +18 -0
- package/dist/use/useWatchStateSync.d.ts +4 -0
- package/dist/use/useWatchStateSync.js +18 -0
- package/dist/utils/animate.d.ts +28 -0
- package/dist/utils/animate.js +81 -0
- package/dist/utils/createPubSub.d.ts +8 -0
- package/dist/utils/createPubSub.js +53 -0
- package/dist/utils/date.d.ts +13 -0
- package/dist/utils/date.js +87 -0
- package/dist/utils/dom.d.ts +149 -0
- package/dist/utils/dom.js +297 -0
- package/dist/utils/file.d.ts +18 -0
- package/dist/utils/file.js +57 -0
- package/dist/utils/imperative.d.ts +20 -0
- package/dist/utils/imperative.js +37 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/is.d.ts +16 -0
- package/dist/utils/is.js +57 -0
- package/dist/utils/measure.d.ts +8 -0
- package/dist/utils/measure.js +13 -0
- package/dist/utils/measure.rn.d.ts +8 -0
- package/dist/utils/measure.rn.js +15 -0
- package/dist/utils/platform.android.d.ts +2 -0
- package/dist/utils/platform.android.js +2 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.ios.d.ts +2 -0
- package/dist/utils/platform.ios.js +2 -0
- package/dist/utils/platform.js +2 -0
- package/dist/utils/style.d.ts +10 -0
- package/dist/utils/style.js +34 -0
- package/dist/utils/utils.d.ts +199 -0
- package/dist/utils/utils.js +639 -0
- package/package.json +30 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect, useState } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { CustomWrapper, View } from '@tarojs/components';
|
|
5
|
+
import { useControllableValue, useEvent, useSelectorId, useBem } from '../use';
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
import { addPxInWeb, filterNullish, getRectByElement, isRN } from '../utils';
|
|
8
|
+
import { usePan } from '../pan-gesture-detector/usePan';
|
|
9
|
+
import PanGestureDetector from '../pan-gesture-detector';
|
|
10
|
+
export const Rate = (props) => {
|
|
11
|
+
const { className, style, value, defaultValue, allowHalf, clearable, count = 5, size = 20, gap = 10, icon, iconProps, voidIcon, voidIconProps, color, voidColor, readOnly, disabled, onChange, ...restProps } = props;
|
|
12
|
+
const [bem] = useBem('rate');
|
|
13
|
+
const [innerValue, setInnerValue] = useControllableValue({
|
|
14
|
+
value,
|
|
15
|
+
defaultValue,
|
|
16
|
+
trigger: onChange,
|
|
17
|
+
initialValue: 0,
|
|
18
|
+
});
|
|
19
|
+
const [tempValue, setTempValue] = useState(innerValue);
|
|
20
|
+
const rateStartLeft = useRef(0);
|
|
21
|
+
const contextId = useSelectorId();
|
|
22
|
+
const rateRef = useRef();
|
|
23
|
+
const handleClick = useEvent(async (event, index) => {
|
|
24
|
+
if (readOnly || disabled) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let nextValue;
|
|
28
|
+
if (allowHalf) {
|
|
29
|
+
const { left: rateLeft } = await getRectByElement(rateRef.current, contextId);
|
|
30
|
+
let clientX;
|
|
31
|
+
if (isRN) {
|
|
32
|
+
clientX = event.changedTouches[0].pageX;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
clientX = event.touches ? event.touches[0].clientX : event.clientX;
|
|
36
|
+
}
|
|
37
|
+
const offsetX = clientX - rateLeft;
|
|
38
|
+
const itemOffsetLeft = index * (size + gap);
|
|
39
|
+
const isHalf = offsetX - itemOffsetLeft <= size / 2;
|
|
40
|
+
nextValue = index + (isHalf ? 0.5 : 1);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
nextValue = index + 1;
|
|
44
|
+
}
|
|
45
|
+
if (clearable && nextValue === innerValue) {
|
|
46
|
+
nextValue = 0;
|
|
47
|
+
}
|
|
48
|
+
setTempValue(nextValue);
|
|
49
|
+
setInnerValue(nextValue);
|
|
50
|
+
});
|
|
51
|
+
const handlers = usePan({
|
|
52
|
+
start() {
|
|
53
|
+
if (readOnly || disabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
getRectByElement(rateRef.current, contextId).then((res) => {
|
|
57
|
+
rateStartLeft.current = res.left;
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
move(event) {
|
|
61
|
+
if (readOnly || disabled) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (event.axis === 'vertical') {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const offsetX = event.moveX - rateStartLeft.current;
|
|
68
|
+
if (offsetX < 0) {
|
|
69
|
+
setTempValue(0);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
for (let i = count - 1; i >= 0; i--) {
|
|
73
|
+
const left = i * (gap + size);
|
|
74
|
+
if (offsetX >= left) {
|
|
75
|
+
const index = i + (allowHalf && offsetX <= left + size / 2 ? 0.5 : 1);
|
|
76
|
+
setTempValue(index);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
end() {
|
|
82
|
+
if (readOnly || disabled) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
setInnerValue(tempValue);
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
setTempValue(innerValue);
|
|
90
|
+
}, [innerValue]);
|
|
91
|
+
const lineHeight = addPxInWeb(size ? size * 1.15 : size);
|
|
92
|
+
const fontSize = size;
|
|
93
|
+
return (_jsx(CustomWrapper, { id: contextId, children: _jsx(PanGestureDetector, { handlers: handlers, children: _jsx(View, { ...restProps, ref: rateRef, className: classNames(bem.b(), bem.m('disabled', disabled), bem.m('readonly', readOnly), className), style: {
|
|
94
|
+
...style,
|
|
95
|
+
...filterNullish({
|
|
96
|
+
gap,
|
|
97
|
+
}),
|
|
98
|
+
}, children: Array(count)
|
|
99
|
+
.fill(0)
|
|
100
|
+
.map((_, index) => {
|
|
101
|
+
const itemValue = index + 1;
|
|
102
|
+
const diff = index + 1 - tempValue;
|
|
103
|
+
const width = (diff <= 0 ? 1 : diff > 1 ? 0 : tempValue % 1) * 100 + '%';
|
|
104
|
+
return (_jsxs(View, { className: classNames(bem.e('item'), bem.em('item', 'readonly', readOnly), bem.em('item', 'disabled', disabled)), onClick: (event) => handleClick(event, index), children: [_jsx(View, { className: bem.e('star-void'), style: {
|
|
105
|
+
fontSize,
|
|
106
|
+
lineHeight,
|
|
107
|
+
...filterNullish({ color: voidColor }),
|
|
108
|
+
}, children: voidIcon ?? (_jsx(Icon, { name: "star", color: disabled ? undefined : voidColor, ...voidIconProps, className: bem.e('star-void-icon'), style: { fontSize, lineHeight } })) }), _jsx(View, { className: classNames(bem.e('star'), bem.em('star', 'disabled', disabled)), style: {
|
|
109
|
+
width,
|
|
110
|
+
fontSize,
|
|
111
|
+
lineHeight,
|
|
112
|
+
...filterNullish({ color }),
|
|
113
|
+
}, children: icon ?? (_jsx(Icon, { name: "star-fill", color: disabled ? undefined : color, ...iconProps, className: classNames(bem.e('star-icon'), bem.em('star-icon', 'disabled', disabled)), style: { fontSize, lineHeight } })) })] }, itemValue));
|
|
114
|
+
}) }) }) }));
|
|
115
|
+
};
|
|
116
|
+
export default Rate;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
@import '../style/base.scss';
|
|
2
|
+
// #variables
|
|
3
|
+
$sar-rate-star-void-color: $sar-quaternary-color !default;
|
|
4
|
+
$sar-rate-star-color: $sar-warning !default;
|
|
5
|
+
|
|
6
|
+
// 暗黑模式
|
|
7
|
+
$sar-rate-star-void-dark-color: $sar-dark-quaternary-color !default;
|
|
8
|
+
$sar-rate-star-dark-color: $sar-warning !default;
|
|
9
|
+
// #endvariables
|
|
10
|
+
|
|
11
|
+
@include bem(rate) {
|
|
12
|
+
@include b() {
|
|
13
|
+
@include universal;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
@include ifweb {
|
|
16
|
+
touch-action: pan-y;
|
|
17
|
+
|
|
18
|
+
@include m(readonly, disabled) {
|
|
19
|
+
touch-action: auto;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include e(item) {
|
|
25
|
+
@include universal;
|
|
26
|
+
|
|
27
|
+
@include ifweb {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
|
|
30
|
+
@include m(readonly) {
|
|
31
|
+
cursor: default;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include m(disabled) {
|
|
35
|
+
cursor: not-allowed;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include e(star-void) {
|
|
41
|
+
@include universal;
|
|
42
|
+
color: $sar-rate-star-void-color;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include e(star-void-icon) {
|
|
46
|
+
color: $sar-rate-star-void-color;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@include e(star) {
|
|
50
|
+
@include universal;
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
align-items: flex-start;
|
|
55
|
+
width: 0;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
color: $sar-rate-star-color;
|
|
58
|
+
|
|
59
|
+
@include m(disabled) {
|
|
60
|
+
color: $sar-disabled-deep-bg-color;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@include e(star-icon) {
|
|
65
|
+
color: $sar-rate-star-color;
|
|
66
|
+
|
|
67
|
+
@include m(disabled) {
|
|
68
|
+
color: $sar-disabled-deep-bg-color;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include theme(dark) {
|
|
74
|
+
@include bem(rate) {
|
|
75
|
+
@include e(star-void) {
|
|
76
|
+
color: $sar-rate-star-void-color;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@include e(star-void-icon) {
|
|
80
|
+
color: $sar-rate-star-void-color;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@include e(star) {
|
|
84
|
+
color: $sar-rate-star-color;
|
|
85
|
+
|
|
86
|
+
@include m(disabled) {
|
|
87
|
+
color: $sar-dark-disabled-deep-bg-color;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@include e(star-icon) {
|
|
92
|
+
color: $sar-rate-star-color;
|
|
93
|
+
|
|
94
|
+
@include m(disabled) {
|
|
95
|
+
color: $sar-dark-disabled-deep-bg-color;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { IconProps } from '../icon';
|
|
3
|
+
import { BaseProps } from '../base';
|
|
4
|
+
export interface ResultProps extends BaseProps {
|
|
5
|
+
status?: 'success' | 'info' | 'warning' | 'error' | 'question';
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
iconProps?: IconProps;
|
|
8
|
+
title?: ReactNode;
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const Result: FC<ResultProps>;
|
|
12
|
+
export default Result;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from '@tarojs/components';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Icon } from '../icon';
|
|
5
|
+
import { isNullish } from '../utils';
|
|
6
|
+
import { useBem } from '../use';
|
|
7
|
+
const mapStatusIcon = {
|
|
8
|
+
success: 'check-circle-fill',
|
|
9
|
+
info: 'info-circle-fill',
|
|
10
|
+
warning: 'warning-fill',
|
|
11
|
+
error: 'x-octagon-fill',
|
|
12
|
+
question: 'question-circle-fill',
|
|
13
|
+
};
|
|
14
|
+
export const Result = (props) => {
|
|
15
|
+
const { className, style, children, status = 'info', icon, iconProps, title, description, ...restProps } = props;
|
|
16
|
+
const [bem] = useBem('result');
|
|
17
|
+
return (_jsxs(View, { ...restProps, className: classNames(bem.b(), className), style: style, children: [icon ?? (_jsx(Icon, { name: mapStatusIcon[status], ...iconProps, className: classNames(bem.e('icon'), bem.em('icon', status)) })), !isNullish(title) && _jsx(View, { className: bem.e('title'), children: title }), !isNullish(description) && (_jsx(View, { className: bem.e('description'), children: description })), !isNullish(children) && (_jsx(View, { className: bem.e('extra'), children: children }))] }));
|
|
18
|
+
};
|
|
19
|
+
export default Result;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@import '../style/base.scss';
|
|
2
|
+
// #variables
|
|
3
|
+
$sar-result-icon-font-size: 48px !default;
|
|
4
|
+
|
|
5
|
+
$sar-result-success-color: $sar-success !default;
|
|
6
|
+
$sar-result-info-color: $sar-info !default;
|
|
7
|
+
$sar-result-warning-color: $sar-warning !default;
|
|
8
|
+
$sar-result-error-color: $sar-danger !default;
|
|
9
|
+
$sar-result-question-color: $sar-primary !default;
|
|
10
|
+
|
|
11
|
+
$sar-result-title-margin-top: 16px !default;
|
|
12
|
+
$sar-result-title-font-size: $sar-text-xl !default;
|
|
13
|
+
|
|
14
|
+
$sar-result-description-margin-top: 4px !default;
|
|
15
|
+
$sar-result-description-font-size: $sar-text-base !default;
|
|
16
|
+
$sar-result-description-color: $sar-tertiary-color !default;
|
|
17
|
+
|
|
18
|
+
$sar-result-extra-margin-top: 16px !default;
|
|
19
|
+
|
|
20
|
+
// 暗黑模式
|
|
21
|
+
$sar-result-description-dark-color: $sar-dark-tertiary-color !default;
|
|
22
|
+
// #endvariables
|
|
23
|
+
|
|
24
|
+
@include bem(result) {
|
|
25
|
+
@include b() {
|
|
26
|
+
@include universal;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-items: center;
|
|
29
|
+
text-align: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@include e(icon) {
|
|
33
|
+
@include universal;
|
|
34
|
+
font-size: $sar-result-icon-font-size;
|
|
35
|
+
line-height: $sar-result-icon-font-size * $sar-leading-none;
|
|
36
|
+
text-align: center;
|
|
37
|
+
|
|
38
|
+
@include m(success) {
|
|
39
|
+
color: $sar-result-success-color;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@include m(info) {
|
|
43
|
+
color: $sar-result-info-color;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include m(warning) {
|
|
47
|
+
color: $sar-result-warning-color;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include m(error) {
|
|
51
|
+
color: $sar-result-error-color;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include m(question) {
|
|
55
|
+
color: $sar-result-question-color;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@include e(title) {
|
|
60
|
+
@include universal;
|
|
61
|
+
margin-top: $sar-result-title-margin-top;
|
|
62
|
+
font-size: $sar-result-title-font-size;
|
|
63
|
+
|
|
64
|
+
text-align: center;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@include e(description) {
|
|
68
|
+
@include universal;
|
|
69
|
+
margin-top: $sar-result-description-margin-top;
|
|
70
|
+
font-size: $sar-result-description-font-size;
|
|
71
|
+
color: $sar-result-description-color;
|
|
72
|
+
text-align: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include e(extra) {
|
|
76
|
+
@include universal;
|
|
77
|
+
margin-top: $sar-result-extra-margin-top;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@include theme(dark) {
|
|
82
|
+
@include bem(result) {
|
|
83
|
+
@include e(description) {
|
|
84
|
+
@include universal;
|
|
85
|
+
color: $sar-result-description-dark-color;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { View } from '@tarojs/components';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { useBem } from '../use';
|
|
6
|
+
import { isRN, systemInfo } from '../utils';
|
|
7
|
+
export const SafeArea = (props) => {
|
|
8
|
+
const { className, style, direction = 'bottom', } = props;
|
|
9
|
+
const safeAreaMargin = useMemo(() => {
|
|
10
|
+
// H5和小程序通过css环境变量设置
|
|
11
|
+
if (!isRN) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const { safeArea: { top = 0, right = 0, bottom = 0, left = 0 } = {}, windowWidth, windowHeight, } = systemInfo;
|
|
15
|
+
return {
|
|
16
|
+
top,
|
|
17
|
+
right: windowWidth - right,
|
|
18
|
+
bottom: windowHeight - bottom,
|
|
19
|
+
left,
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
const sizeStyle = useMemo(() => {
|
|
23
|
+
return safeAreaMargin
|
|
24
|
+
? {
|
|
25
|
+
[direction === 'top' || direction === 'bottom' ? 'height' : 'width']: safeAreaMargin[direction],
|
|
26
|
+
}
|
|
27
|
+
: null;
|
|
28
|
+
}, [direction]);
|
|
29
|
+
const [bem] = useBem('safe-area');
|
|
30
|
+
return (_jsx(View, { className: classNames(bem.b(), bem.m(direction), className), style: {
|
|
31
|
+
...style,
|
|
32
|
+
...sizeStyle,
|
|
33
|
+
} }));
|
|
34
|
+
};
|
|
35
|
+
export default SafeArea;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@import '../style/base.scss';
|
|
2
|
+
// #variables
|
|
3
|
+
// #endvariables
|
|
4
|
+
|
|
5
|
+
@include bem(safe-area) {
|
|
6
|
+
@include b() {
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
|
|
9
|
+
@include ifweb {
|
|
10
|
+
@include m(top) {
|
|
11
|
+
height: env(safe-area-inset-top);
|
|
12
|
+
}
|
|
13
|
+
@include m(right) {
|
|
14
|
+
width: env(safe-area-inset-right);
|
|
15
|
+
}
|
|
16
|
+
@include m(bottom) {
|
|
17
|
+
height: env(safe-area-inset-bottom);
|
|
18
|
+
}
|
|
19
|
+
@include m(left) {
|
|
20
|
+
width: env(safe-area-inset-left);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
import { ScrollIntoViewOptions } from '../utils';
|
|
4
|
+
export interface ScrollViewProps extends BaseProps {
|
|
5
|
+
contextId?: string;
|
|
6
|
+
scrollX?: boolean;
|
|
7
|
+
scrollY?: boolean;
|
|
8
|
+
showScrollbar?: boolean;
|
|
9
|
+
onScroll?: (event: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
scrollLeft?: number;
|
|
14
|
+
scrollTop?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ScrollViewRef {
|
|
17
|
+
scrollTop: (top: number) => void;
|
|
18
|
+
scrollLeft: (left: number) => void;
|
|
19
|
+
setScrollEnabled: (scrollEnabled: boolean) => void;
|
|
20
|
+
getElement: () => any;
|
|
21
|
+
scrollIntoView: (selector: string, object?: ScrollIntoViewOptions) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const ScrollView: import("react").ForwardRefExoticComponent<ScrollViewProps & import("react").RefAttributes<ScrollViewRef>>;
|
|
24
|
+
export default ScrollView;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
import { ScrollView as TaroScrollView } from '@tarojs/components';
|
|
4
|
+
import { getElementById, isH5 } from '../utils';
|
|
5
|
+
import Taro from '@tarojs/taro';
|
|
6
|
+
import { useEvent, useSelectorId } from '../use';
|
|
7
|
+
export const ScrollView = forwardRef((props, ref) => {
|
|
8
|
+
const { className, style, children, contextId, scrollX, scrollY, showScrollbar, onScroll, scrollLeft, scrollTop, } = props;
|
|
9
|
+
const scrollViewId = useSelectorId();
|
|
10
|
+
const scrollViewRef = useRef();
|
|
11
|
+
const scrollViewCtx = useRef();
|
|
12
|
+
const scrollCoord = useRef({
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0,
|
|
15
|
+
});
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
Taro.createSelectorQuery()
|
|
18
|
+
.in(getElementById(contextId)?.ctx)
|
|
19
|
+
.select(`#${scrollViewId}`)
|
|
20
|
+
.node((res) => {
|
|
21
|
+
scrollViewCtx.current = res.node;
|
|
22
|
+
})
|
|
23
|
+
.exec();
|
|
24
|
+
}, []);
|
|
25
|
+
const handleScroll = useEvent((event) => {
|
|
26
|
+
const x = event.detail.scrollLeft;
|
|
27
|
+
const y = event.detail.scrollTop;
|
|
28
|
+
scrollCoord.current = {
|
|
29
|
+
x,
|
|
30
|
+
y,
|
|
31
|
+
};
|
|
32
|
+
onScroll?.({
|
|
33
|
+
x,
|
|
34
|
+
y,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
useImperativeHandle(ref, () => ({
|
|
38
|
+
scrollTop(top) {
|
|
39
|
+
scrollViewCtx.current?.scrollTo({
|
|
40
|
+
top,
|
|
41
|
+
animated: false,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
scrollLeft(left) {
|
|
45
|
+
scrollViewCtx.current?.scrollTo({
|
|
46
|
+
left,
|
|
47
|
+
animated: false,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
setScrollEnabled(scrollEnabled) {
|
|
51
|
+
if (scrollViewCtx.current) {
|
|
52
|
+
scrollViewCtx.current.scrollEnabled = scrollEnabled;
|
|
53
|
+
if (isH5 && scrollViewRef.current) {
|
|
54
|
+
scrollViewRef.current.style.touchAction = scrollEnabled
|
|
55
|
+
? 'auto'
|
|
56
|
+
: 'none';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
getScrollCoord() {
|
|
61
|
+
return scrollCoord.current;
|
|
62
|
+
},
|
|
63
|
+
getElement() {
|
|
64
|
+
return scrollViewRef.current;
|
|
65
|
+
},
|
|
66
|
+
scrollIntoView(selector) {
|
|
67
|
+
scrollViewCtx.current?.scrollIntoView(selector);
|
|
68
|
+
},
|
|
69
|
+
}), []);
|
|
70
|
+
return (_jsx(TaroScrollView, { id: scrollViewId, ref: scrollViewRef, enhanced: true, enablePassive: "true", scrollWithAnimation: false, showScrollbar: showScrollbar, scrollX: scrollX, scrollY: scrollY, className: className, style: style, onScroll: handleScroll, scrollLeft: scrollLeft, scrollTop: scrollTop, children: children }));
|
|
71
|
+
});
|
|
72
|
+
export default ScrollView;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { BaseProps } from '../base';
|
|
4
|
+
export interface ScrollViewProps extends Omit<BaseProps, 'style'> {
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
scrollX?: boolean;
|
|
7
|
+
scrollY?: boolean;
|
|
8
|
+
showScrollbar?: boolean;
|
|
9
|
+
onScroll?: (event: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface ScrollViewRef {
|
|
15
|
+
scrollTop: (top: number) => void;
|
|
16
|
+
scrollLeft: (left: number) => void;
|
|
17
|
+
setScrollEnabled: (scrollEnabled: boolean) => void;
|
|
18
|
+
getElement: () => any;
|
|
19
|
+
}
|
|
20
|
+
export declare const ScrollView: import("react").ForwardRefExoticComponent<ScrollViewProps & import("react").RefAttributes<ScrollViewRef>>;
|
|
21
|
+
export default ScrollView;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
import { ScrollView as RNScrollView } from 'react-native';
|
|
4
|
+
import { useEvent } from '../use';
|
|
5
|
+
export const ScrollView = forwardRef((props, ref) => {
|
|
6
|
+
const { style, children, scrollX, showScrollbar, onScroll } = props;
|
|
7
|
+
const scrollViewRef = useRef(null);
|
|
8
|
+
const scrollCoord = useRef({
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0,
|
|
11
|
+
});
|
|
12
|
+
const handleScroll = useEvent((event) => {
|
|
13
|
+
const x = event.nativeEvent.contentOffset.x;
|
|
14
|
+
const y = event.nativeEvent.contentOffset.y;
|
|
15
|
+
scrollCoord.current = {
|
|
16
|
+
x,
|
|
17
|
+
y,
|
|
18
|
+
};
|
|
19
|
+
onScroll?.({
|
|
20
|
+
x,
|
|
21
|
+
y,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
useImperativeHandle(ref, () => ({
|
|
25
|
+
scrollTop(y) {
|
|
26
|
+
scrollViewRef.current?.scrollTo({
|
|
27
|
+
y,
|
|
28
|
+
animated: false,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
scrollLeft(x) {
|
|
32
|
+
scrollViewRef.current?.scrollTo({
|
|
33
|
+
x,
|
|
34
|
+
animated: false,
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
setScrollEnabled(scrollEnabled) {
|
|
38
|
+
scrollViewRef.current?.setNativeProps({
|
|
39
|
+
scrollEnabled,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
getScrollCoord() {
|
|
43
|
+
return scrollCoord.current;
|
|
44
|
+
},
|
|
45
|
+
getElement() {
|
|
46
|
+
return scrollViewRef.current;
|
|
47
|
+
},
|
|
48
|
+
}), []);
|
|
49
|
+
return (_jsx(RNScrollView, { ref: scrollViewRef, horizontal: scrollX, contentContainerStyle: { flexGrow: 1 }, scrollEventThrottle: 16, showsHorizontalScrollIndicator: showScrollbar, showsVerticalScrollIndicator: showScrollbar, style: style, onScroll: handleScroll, children: children }));
|
|
50
|
+
});
|
|
51
|
+
export default ScrollView;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface SearchProps extends BaseProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
shape?: 'round' | 'square';
|
|
9
|
+
background?: string;
|
|
10
|
+
inputBackground?: string;
|
|
11
|
+
inputColor?: string;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
align?: 'left' | 'center' | 'right';
|
|
15
|
+
cancel?: ReactNode;
|
|
16
|
+
onCancel?: () => void;
|
|
17
|
+
search?: ReactNode;
|
|
18
|
+
onSearch?: (value: string) => void;
|
|
19
|
+
prepend?: ReactNode;
|
|
20
|
+
append?: ReactNode;
|
|
21
|
+
inputPrepend?: ReactNode;
|
|
22
|
+
inputAppend?: ReactNode;
|
|
23
|
+
inputStyle?: CSSProperties;
|
|
24
|
+
}
|
|
25
|
+
export declare const Search: FC<SearchProps>;
|
|
26
|
+
export default Search;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from '@tarojs/components';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useBem, useControllableValue } from '../use';
|
|
5
|
+
import Input from '../input';
|
|
6
|
+
import Icon from '../icon';
|
|
7
|
+
import Button from '../button';
|
|
8
|
+
import { filterNullish, isNullish } from '../utils';
|
|
9
|
+
export const Search = (props) => {
|
|
10
|
+
const { className, style, value, defaultValue, onChange, placeholder, shape = 'square', background, inputBackground, inputColor, readOnly, disabled, align, cancel, onCancel, search, onSearch, prepend, append, inputPrepend, inputAppend, ...restProps } = props;
|
|
11
|
+
const [bem] = useBem('search');
|
|
12
|
+
const [innerValue, setInnerValue] = useControllableValue({
|
|
13
|
+
value,
|
|
14
|
+
defaultValue,
|
|
15
|
+
trigger: onChange,
|
|
16
|
+
});
|
|
17
|
+
const handleConfirm = () => {
|
|
18
|
+
onSearch?.(innerValue);
|
|
19
|
+
};
|
|
20
|
+
const handleCancel = () => {
|
|
21
|
+
setInnerValue('');
|
|
22
|
+
onCancel?.();
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs(View, { ...restProps, className: classNames(bem.b(), bem.m('show-action', !isNullish(cancel) || !isNullish(search)), className), style: {
|
|
25
|
+
...style,
|
|
26
|
+
...filterNullish({
|
|
27
|
+
backgroundColor: background,
|
|
28
|
+
}),
|
|
29
|
+
}, children: [prepend, _jsx(View, { className: bem.e('input-wrapper'), children: _jsx(Input, { value: innerValue, onChange: setInnerValue, clearable: true, confirmType: "search", showClearOnlyFocus: true, readOnly: readOnly, disabled: disabled, placeholder: placeholder, prepend: inputPrepend ?? _jsx(Icon, { name: "search", className: bem.e('icon') }), append: inputAppend, borderless: true, className: classNames(bem.e('input'), bem.em('input', shape), bem.em('input', 'disabled', disabled)), style: filterNullish({
|
|
30
|
+
textAlign: align,
|
|
31
|
+
color: inputColor,
|
|
32
|
+
backgroundColor: inputBackground,
|
|
33
|
+
}), onConfirm: handleConfirm }) }), !isNullish(cancel) && (_jsx(Button, { type: "pale-text", className: bem.e('button'), onClick: handleCancel, children: cancel })), !isNullish(search) && (_jsx(Button, { type: "pale-text", className: bem.e('button'), onClick: handleConfirm, children: search })), append] }));
|
|
34
|
+
};
|
|
35
|
+
export default Search;
|