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,101 @@
|
|
|
1
|
+
import { Text, View } from '@tarojs/components';
|
|
2
|
+
import { noop } from '../utils';
|
|
3
|
+
class AnimatedInterpolation {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
void config;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class AnimatedValue {
|
|
9
|
+
constructor(value, config) {
|
|
10
|
+
void value;
|
|
11
|
+
void config;
|
|
12
|
+
}
|
|
13
|
+
setValue(value) {
|
|
14
|
+
void value;
|
|
15
|
+
}
|
|
16
|
+
setOffset(offset) {
|
|
17
|
+
void offset;
|
|
18
|
+
}
|
|
19
|
+
flattenOffset() {
|
|
20
|
+
void null;
|
|
21
|
+
}
|
|
22
|
+
extractOffset() {
|
|
23
|
+
void null;
|
|
24
|
+
}
|
|
25
|
+
interpolate(config) {
|
|
26
|
+
return new AnimatedInterpolation(config);
|
|
27
|
+
}
|
|
28
|
+
stopAnimation() {
|
|
29
|
+
void null;
|
|
30
|
+
}
|
|
31
|
+
addListener(callback) {
|
|
32
|
+
void callback;
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
removeListener(id) {
|
|
36
|
+
void id;
|
|
37
|
+
}
|
|
38
|
+
removeAllListeners() {
|
|
39
|
+
void null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class CompositeAnimation {
|
|
43
|
+
constructor(value, config) {
|
|
44
|
+
void value;
|
|
45
|
+
void config;
|
|
46
|
+
}
|
|
47
|
+
start(callback) {
|
|
48
|
+
void callback;
|
|
49
|
+
}
|
|
50
|
+
stop() {
|
|
51
|
+
void null;
|
|
52
|
+
}
|
|
53
|
+
reset() {
|
|
54
|
+
void null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function timing(value, config) {
|
|
58
|
+
return new CompositeAnimation(value, config);
|
|
59
|
+
}
|
|
60
|
+
function loop(animation, config) {
|
|
61
|
+
return new CompositeAnimation(animation, config);
|
|
62
|
+
}
|
|
63
|
+
function parallel(animations, config) {
|
|
64
|
+
return new CompositeAnimation(animations, config);
|
|
65
|
+
}
|
|
66
|
+
function sequence(animations) {
|
|
67
|
+
return new CompositeAnimation(animations);
|
|
68
|
+
}
|
|
69
|
+
function delay(time) {
|
|
70
|
+
return new CompositeAnimation(time);
|
|
71
|
+
}
|
|
72
|
+
class Animated {
|
|
73
|
+
static View = View;
|
|
74
|
+
static Text = Text;
|
|
75
|
+
static Value = AnimatedValue;
|
|
76
|
+
static timing = timing;
|
|
77
|
+
static loop = loop;
|
|
78
|
+
static parallel = parallel;
|
|
79
|
+
static sequence = sequence;
|
|
80
|
+
static delay = delay;
|
|
81
|
+
}
|
|
82
|
+
class Easing {
|
|
83
|
+
static step0 = noop;
|
|
84
|
+
static step1 = noop;
|
|
85
|
+
static linear = noop;
|
|
86
|
+
static ease = noop;
|
|
87
|
+
static quad = noop;
|
|
88
|
+
static cubic = noop;
|
|
89
|
+
static poly = noop;
|
|
90
|
+
static sin = noop;
|
|
91
|
+
static circle = noop;
|
|
92
|
+
static exp = noop;
|
|
93
|
+
static elastic = noop;
|
|
94
|
+
static back = noop;
|
|
95
|
+
static bounce = noop;
|
|
96
|
+
static bezier = noop;
|
|
97
|
+
static in = noop;
|
|
98
|
+
static out = noop;
|
|
99
|
+
static inOut = noop;
|
|
100
|
+
}
|
|
101
|
+
export { Easing, Animated };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo, useRef } from 'react';
|
|
3
|
+
import { Animated, Easing, PanResponder } from 'react-native';
|
|
4
|
+
const AnimatedView = Animated.View;
|
|
5
|
+
const _Animated = { ...Animated };
|
|
6
|
+
const maxDistance = 10;
|
|
7
|
+
const maxDuration = 800;
|
|
8
|
+
_Animated.View = forwardRef((props, ref) => {
|
|
9
|
+
const { onClick, ...restProps } = props;
|
|
10
|
+
const downTimestamp = useRef(0);
|
|
11
|
+
const panResponder = useMemo(() => {
|
|
12
|
+
return onClick
|
|
13
|
+
? PanResponder.create({
|
|
14
|
+
onStartShouldSetPanResponder: () => true,
|
|
15
|
+
onPanResponderGrant: () => {
|
|
16
|
+
downTimestamp.current = Date.now();
|
|
17
|
+
},
|
|
18
|
+
onPanResponderRelease: (evt, gestureState) => {
|
|
19
|
+
const { dx, dy } = gestureState;
|
|
20
|
+
const timestamp = Date.now();
|
|
21
|
+
if (Math.abs(dx) < maxDistance &&
|
|
22
|
+
Math.abs(dy) < maxDistance &&
|
|
23
|
+
timestamp - downTimestamp.current < maxDuration) {
|
|
24
|
+
onClick?.(evt);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
: {
|
|
29
|
+
panHandlers: null,
|
|
30
|
+
};
|
|
31
|
+
}, [onClick]);
|
|
32
|
+
return (_jsx(AnimatedView, { ...restProps, ...panResponder.panHandlers, ref: ref }));
|
|
33
|
+
});
|
|
34
|
+
export { _Animated as Animated, Easing };
|
|
35
|
+
export default _Animated;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface AvatarGroupProps extends BaseProps {
|
|
4
|
+
gap?: string | number;
|
|
5
|
+
direction?: 'left' | 'right';
|
|
6
|
+
maxCount?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const AvatarGroup: FC<AvatarGroupProps>;
|
|
9
|
+
export default AvatarGroup;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement } from 'react';
|
|
3
|
+
import { View } from '@tarojs/components';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { Avatar } from './index';
|
|
6
|
+
import { useBem } from '../use';
|
|
7
|
+
import { filterNullish } from '../utils';
|
|
8
|
+
export const AvatarGroup = (props) => {
|
|
9
|
+
const { className, style, children, gap, direction = 'right', maxCount = 5, ...restProps } = props;
|
|
10
|
+
const [bem] = useBem('avatar');
|
|
11
|
+
const count = Children.count(children);
|
|
12
|
+
return (_jsxs(View, { ...restProps, className: classNames(bem.e('group'), className), style: style, children: [Children.map(children, (item, index) => {
|
|
13
|
+
return index > maxCount - 1
|
|
14
|
+
? null
|
|
15
|
+
: cloneElement(item, {
|
|
16
|
+
className: classNames(bem.m('in-group'), bem.m('later', index > 0)),
|
|
17
|
+
style: filterNullish({
|
|
18
|
+
marginLeft: index === 0 ? 0 : gap,
|
|
19
|
+
zIndex: direction === 'left' ? count - index : undefined,
|
|
20
|
+
}),
|
|
21
|
+
});
|
|
22
|
+
}), count > maxCount && (_jsx(Avatar, { className: bem.m('rest'), style: filterNullish({
|
|
23
|
+
marginLeft: gap,
|
|
24
|
+
zIndex: direction === 'left' ? 0 : undefined,
|
|
25
|
+
}), children: '+' + (count - maxCount) }))] }));
|
|
26
|
+
};
|
|
27
|
+
export default AvatarGroup;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { IconProps } from '../icon';
|
|
3
|
+
import { AvatarGroup } from './Group';
|
|
4
|
+
import { BaseProps } from '../base';
|
|
5
|
+
export * from './Group';
|
|
6
|
+
export interface AvatarProps extends BaseProps {
|
|
7
|
+
shape?: 'circle' | 'square';
|
|
8
|
+
size?: number;
|
|
9
|
+
src?: string;
|
|
10
|
+
iconProps?: IconProps;
|
|
11
|
+
extra?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface AvatarFC extends FC<AvatarProps> {
|
|
14
|
+
Group: typeof AvatarGroup;
|
|
15
|
+
}
|
|
16
|
+
export declare const Avatar: AvatarFC;
|
|
17
|
+
export default Avatar;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Image, View } from '@tarojs/components';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Icon } from '../icon';
|
|
5
|
+
import { AvatarGroup } from './Group';
|
|
6
|
+
import { useBem } from '../use';
|
|
7
|
+
import { filterNullish } from '../utils';
|
|
8
|
+
export * from './Group';
|
|
9
|
+
export const Avatar = (props) => {
|
|
10
|
+
const { className, style, children, shape = 'circle', size, src, iconProps, extra, ...restProps } = props;
|
|
11
|
+
const [bem] = useBem('avatar');
|
|
12
|
+
return (_jsxs(View, { ...restProps, className: classNames(bem.b(), bem.m(shape), className), style: {
|
|
13
|
+
...style,
|
|
14
|
+
...filterNullish({
|
|
15
|
+
width: size,
|
|
16
|
+
height: size,
|
|
17
|
+
}),
|
|
18
|
+
}, children: [children ??
|
|
19
|
+
(src ? (_jsx(Image, { src: src, mode: "aspectFill", className: classNames(bem.e('image'), bem.m(shape)) })) : (_jsx(Icon, { name: "person", className: bem.e('icon'), ...iconProps }))), extra] }));
|
|
20
|
+
};
|
|
21
|
+
Avatar.Group = AvatarGroup;
|
|
22
|
+
export default Avatar;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@import '../style/base.scss';
|
|
2
|
+
// #variables
|
|
3
|
+
$sar-avatar-width: 64px !default;
|
|
4
|
+
$sar-avatar-height: 64px !default;
|
|
5
|
+
$sar-avatar-font-size: 32px !default;
|
|
6
|
+
$sar-avatar-color: $sar-secondary-color !default;
|
|
7
|
+
$sar-avatar-bg-color: $sar-secondary-bg-color !default;
|
|
8
|
+
|
|
9
|
+
$sar-avatar-square-border-radius: $sar-rounded !default;
|
|
10
|
+
|
|
11
|
+
$sar-avatar-group-avatar-border-color: $sar-emphasis-bg-color !default;
|
|
12
|
+
$sar-avatar-group-avatar-gap: -16px !default;
|
|
13
|
+
|
|
14
|
+
// 暗黑模式
|
|
15
|
+
$sar-avatar-dark-color: $sar-dark-secondary-color !default;
|
|
16
|
+
$sar-avatar-dark-bg-color: $sar-dark-secondary-bg-color !default;
|
|
17
|
+
$sar-avatar-group-avatar-border-dark-color: $sar-dark-emphasis-bg-color !default;
|
|
18
|
+
// #endvariables
|
|
19
|
+
|
|
20
|
+
@include bem(avatar) {
|
|
21
|
+
@include b() {
|
|
22
|
+
@include universal;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
flex-grow: 0;
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
width: $sar-avatar-width;
|
|
28
|
+
height: $sar-avatar-height;
|
|
29
|
+
font-size: $sar-avatar-font-size;
|
|
30
|
+
color: $sar-avatar-color;
|
|
31
|
+
background-color: $sar-avatar-bg-color;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include e(group) {
|
|
35
|
+
@include universal;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@include e(image) {
|
|
40
|
+
@include universal;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include e(icon) {
|
|
46
|
+
font-size: $sar-avatar-font-size;
|
|
47
|
+
color: $sar-avatar-color;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include m(circle) {
|
|
51
|
+
border-radius: $sar-rounded-full;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@include m(square) {
|
|
55
|
+
border-radius: $sar-avatar-square-border-radius;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@include m(in-group, rest) {
|
|
59
|
+
border: 1px solid $sar-avatar-group-avatar-border-color;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@include m(later) {
|
|
63
|
+
margin-left: $sar-avatar-group-avatar-gap;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@include theme(dark) {
|
|
68
|
+
@include bem(avatar) {
|
|
69
|
+
@include b() {
|
|
70
|
+
color: $sar-avatar-dark-color;
|
|
71
|
+
background-color: $sar-avatar-dark-bg-color;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@include m(in-group, rest) {
|
|
75
|
+
border-color: $sar-avatar-group-avatar-border-dark-color;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@include e(icon) {
|
|
79
|
+
color: $sar-avatar-dark-color;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode, NamedExoticComponent } from 'react';
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface BadgeProps extends BaseProps {
|
|
4
|
+
value?: ReactNode;
|
|
5
|
+
max?: number;
|
|
6
|
+
showZero?: boolean;
|
|
7
|
+
color?: string;
|
|
8
|
+
textColor?: string;
|
|
9
|
+
isDot?: boolean;
|
|
10
|
+
fixed?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const Badge: NamedExoticComponent<BadgeProps>;
|
|
13
|
+
export default Badge;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from '@tarojs/components';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { filterNullish, isNullish, isNumber } from '../utils';
|
|
6
|
+
import { useBem } from '../use';
|
|
7
|
+
export const Badge = memo((props) => {
|
|
8
|
+
const { className, style, children, value = 0, max = 99, showZero = false, color, textColor, isDot, fixed, ...restProps } = props;
|
|
9
|
+
const [bem] = useBem('badge');
|
|
10
|
+
const zeroHide = !isDot && value === 0 && !showZero;
|
|
11
|
+
return (_jsxs(View, { ...restProps, className: classNames(bem.b(), bem.m('fixed', fixed), className), style: style, children: [children, _jsx(View, { className: classNames(bem.e('content-wrapper'), bem.m('fixed', !fixed && !isNullish(children)), bem.m('zero-hide', zeroHide)), children: _jsx(View, { className: classNames(bem.e('content'), bem.em('content', 'fixed', fixed || !isNullish(children)), bem.m('is-dot', isDot)), style: filterNullish({
|
|
12
|
+
backgroundColor: color,
|
|
13
|
+
color: textColor,
|
|
14
|
+
}), children: isDot ? '' : isNumber(value) && value > max ? `${max}+` : value }) })] }));
|
|
15
|
+
});
|
|
16
|
+
export default Badge;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@import '../style/base.scss';
|
|
3
|
+
// #variables
|
|
4
|
+
$sar-badge-content-padding-x: 4px !default;
|
|
5
|
+
$sar-badge-content-padding-y: 2px !default;
|
|
6
|
+
$sar-badge-content-font-size: 12px !default;
|
|
7
|
+
$sar-badge-content-height: $sar-badge-content-padding-y * 2 +
|
|
8
|
+
$sar-badge-content-font-size + 2px !default;
|
|
9
|
+
$sar-badge-content-min-width: $sar-badge-content-padding-y * 2 +
|
|
10
|
+
$sar-badge-content-font-size + 2px !default;
|
|
11
|
+
$sar-badge-content-bg-color: $sar-danger !default;
|
|
12
|
+
$sar-badge-content-color: $sar-white !default;
|
|
13
|
+
$sar-badge-content-border-color: $sar-white !default;
|
|
14
|
+
$sar-badge-content-dot-size: 8px !default;
|
|
15
|
+
|
|
16
|
+
// 暗黑模式
|
|
17
|
+
$sar-badge-content-border-dark-color: $sar-gray-200 !default;
|
|
18
|
+
// #endvariables
|
|
19
|
+
|
|
20
|
+
@include bem(badge) {
|
|
21
|
+
@include b() {
|
|
22
|
+
@include universal;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@include e(content-wrapper) {
|
|
27
|
+
@include universal;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include e(content) {
|
|
31
|
+
@include universal;
|
|
32
|
+
flex: none;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-self: center;
|
|
35
|
+
min-width: $sar-badge-content-min-width;
|
|
36
|
+
height: $sar-badge-content-height;
|
|
37
|
+
padding-top: $sar-badge-content-padding-y;
|
|
38
|
+
padding-bottom: $sar-badge-content-padding-y;
|
|
39
|
+
padding-left: $sar-badge-content-padding-x;
|
|
40
|
+
padding-right: $sar-badge-content-padding-x;
|
|
41
|
+
font-size: $sar-badge-content-font-size;
|
|
42
|
+
line-height: $sar-badge-content-font-size * $sar-leading-none;
|
|
43
|
+
text-align: center;
|
|
44
|
+
border: 1px solid $sar-badge-content-border-color;
|
|
45
|
+
border-radius: $sar-rounded-full;
|
|
46
|
+
color: $sar-badge-content-color;
|
|
47
|
+
background-color: $sar-badge-content-bg-color;
|
|
48
|
+
|
|
49
|
+
@include m(fixed) {
|
|
50
|
+
top: math.div(-$sar-badge-content-height, 2);
|
|
51
|
+
left: 50%;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@include m(fixed) {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 0;
|
|
58
|
+
right: 0;
|
|
59
|
+
z-index: 10;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@include m(zero-hide) {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@include m(is-dot) {
|
|
67
|
+
width: $sar-badge-content-dot-size;
|
|
68
|
+
height: $sar-badge-content-dot-size;
|
|
69
|
+
min-width: $sar-badge-content-dot-size;
|
|
70
|
+
padding: 0;
|
|
71
|
+
border-radius: $sar-rounded-full;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include theme(dark) {
|
|
76
|
+
@include bem(badge) {
|
|
77
|
+
@include e(content) {
|
|
78
|
+
border-color: $sar-badge-content-border-dark-color;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export interface BaseProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: CSSProperties | {
|
|
5
|
+
[varName: string]: string | number | null | undefined;
|
|
6
|
+
};
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export type PrimitiveType = number | string | boolean | null | undefined | symbol | bigint;
|
|
11
|
+
export type AnyFunction = (...args: any[]) => any;
|
package/dist/base.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface CustomButtonProps extends BaseProps {
|
|
4
|
+
formType?: 'submit' | 'reset';
|
|
5
|
+
onClick?: (event: any) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const CustomButton: import("react").ForwardRefExoticComponent<CustomButtonProps & import("react").RefAttributes<any>>;
|
|
9
|
+
export default CustomButton;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
|
+
import { View } from '@tarojs/components';
|
|
4
|
+
import { CustomFormContext } from '../form/CustomForm';
|
|
5
|
+
import { useEvent } from '../use';
|
|
6
|
+
import { isRN } from '../utils';
|
|
7
|
+
export const CustomButton = forwardRef((props, ref) => {
|
|
8
|
+
const { className, style, children, formType, onClick, disabled, ...restProps } = props;
|
|
9
|
+
const formContext = useContext(CustomFormContext);
|
|
10
|
+
const handleClick = useEvent((event) => {
|
|
11
|
+
if (!disabled) {
|
|
12
|
+
if (formType === 'submit') {
|
|
13
|
+
formContext.submit();
|
|
14
|
+
}
|
|
15
|
+
else if (formType === 'reset') {
|
|
16
|
+
formContext.reset();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
onClick?.(event);
|
|
20
|
+
});
|
|
21
|
+
return (_jsx(View, { ...restProps, ref: ref, className: className, style: style, onClick: handleClick, ...(!isRN ? { disabled: disabled } : null), children: children }));
|
|
22
|
+
});
|
|
23
|
+
export default CustomButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LoadingProps } from '../loading';
|
|
3
|
+
import { ITouchEvent } from '@tarojs/components';
|
|
4
|
+
import { BaseProps } from '../base';
|
|
5
|
+
import { IconProps } from '../icon';
|
|
6
|
+
export interface ButtonProps extends BaseProps {
|
|
7
|
+
type?: 'default' | 'pale' | 'mild' | 'outline' | 'text' | 'pale-text';
|
|
8
|
+
theme?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger';
|
|
9
|
+
size?: 'mini' | 'small' | 'medium' | 'large';
|
|
10
|
+
round?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
loadingProps?: LoadingProps;
|
|
14
|
+
iconProps?: IconProps;
|
|
15
|
+
before?: ReactNode;
|
|
16
|
+
color?: string;
|
|
17
|
+
onClick?: (event: ITouchEvent) => void;
|
|
18
|
+
[key: PropertyKey]: any;
|
|
19
|
+
}
|
|
20
|
+
export declare const Button: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<any>>;
|
|
21
|
+
export default Button;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Loading } from '../loading';
|
|
5
|
+
import { Button as TaroButton, Text, View, } from '@tarojs/components';
|
|
6
|
+
import { filterNullish, isNullish, isPC, isRN, isVisibleEmpty } from '../utils';
|
|
7
|
+
import { useBem, useEvent } from '../use';
|
|
8
|
+
import CustomButton from './CustomButton';
|
|
9
|
+
import Pressable from '../pressable';
|
|
10
|
+
import Halfline from '../halfline';
|
|
11
|
+
import Icon from '../icon';
|
|
12
|
+
const ButtonElement = isRN || isPC ? CustomButton : TaroButton;
|
|
13
|
+
const mapIconSize = {
|
|
14
|
+
mini: 14,
|
|
15
|
+
small: 16,
|
|
16
|
+
medium: 18,
|
|
17
|
+
large: 20,
|
|
18
|
+
};
|
|
19
|
+
export const Button = forwardRef((props, ref) => {
|
|
20
|
+
const { className, style, children, type = 'default', theme = 'primary', size = 'medium', round = false, disabled, loading, loadingProps, iconProps, before, color, onClick, ...restProps } = props;
|
|
21
|
+
const [bem] = useBem('button');
|
|
22
|
+
const handleClick = useEvent((event) => {
|
|
23
|
+
if (disabled || loading) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
onClick?.(event);
|
|
27
|
+
});
|
|
28
|
+
return (_jsx(Pressable, { disabled: disabled || loading, children: ({ pressed }) => (_jsxs(ButtonElement, { ...restProps, ref: ref, className: classNames(bem.b(), bem.m(type), bem.m(`${type}-${theme}`), bem.m(size), bem.m('round', round), bem.m('disabled', disabled), bem.m('loading', loading), bem.m('pressed', pressed && type === 'pale-text'), bem.m('is-icon', !isNullish(iconProps)), bem.m(`${type}-disabled`, disabled), className), style: style, disabled: disabled || loading || undefined, hoverClass: "", onClick: handleClick, children: [before, _jsx(View, { className: bem.e('loading-wrapper'), children: loading && (_jsx(Loading, { ...loadingProps, className: classNames(bem.e('loading'), bem.em('loading', `${type}-${theme}`), bem.em('loading', `${type}-disabled`, disabled)), size: mapIconSize[size], color: color })) }), _jsx(Text, { className: classNames(bem.e('content'), bem.em('content', `${type}-${theme}`), bem.em('content', size), bem.em('content', `${type}-disabled`, disabled), bem.em('content', `gap-${size}`, loading && !isVisibleEmpty(children))), style: filterNullish({
|
|
29
|
+
color,
|
|
30
|
+
}), children: isNullish(iconProps) ? children : _jsx(Icon, { ...iconProps }) }), type === 'outline' && (_jsx(View, { className: bem.e('halfline-wrapper'), children: _jsx(Halfline, { className: classNames(bem.e('halfline'), bem.em('halfline', theme), bem.em('halfline', size), bem.em('halfline', 'round', round), bem.em('halfline', 'disabled', disabled)), style: filterNullish({
|
|
31
|
+
borderColor: color,
|
|
32
|
+
}) }) })), type !== 'pale-text' && (_jsx(View, { className: classNames(bem.e('shade'), bem.em('shade', 'pressed', pressed), bem.em('shade', type)) }))] })) }));
|
|
33
|
+
});
|
|
34
|
+
export default Button;
|