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,109 @@
|
|
|
1
|
+
@import '../style/base.scss';
|
|
2
|
+
// #variables
|
|
3
|
+
$sar-notice-bar-min-height: 40px !default;
|
|
4
|
+
$sar-notice-bar-padding-x: 16px !default;
|
|
5
|
+
$sar-notice-bar-padding-y: 10px !default;
|
|
6
|
+
$sar-notice-bar-font-size: $sar-text-base !default;
|
|
7
|
+
$sar-notice-bar-color: $sar-orange !default;
|
|
8
|
+
$sar-notice-bar-bg-color: $sar-orange-100 !default;
|
|
9
|
+
|
|
10
|
+
$sar-notice-bar-wrap-line-height: $sar-notice-bar-font-size * $sar-leading-snug !default;
|
|
11
|
+
|
|
12
|
+
$sar-notice-bar-left-icon-size: 20px !default;
|
|
13
|
+
$sar-notice-bar-left-icon-gap: 8px !default;
|
|
14
|
+
$sar-notice-bar-right-icon-gap: 8px !default;
|
|
15
|
+
// #endvariables
|
|
16
|
+
|
|
17
|
+
@include bem(notice-bar) {
|
|
18
|
+
@include b() {
|
|
19
|
+
@include universal;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
flex-wrap: nowrap;
|
|
22
|
+
align-items: center;
|
|
23
|
+
min-height: $sar-notice-bar-min-height;
|
|
24
|
+
padding: 0 $sar-notice-bar-padding-x;
|
|
25
|
+
background-color: $sar-notice-bar-bg-color;
|
|
26
|
+
|
|
27
|
+
@include m(wrap) {
|
|
28
|
+
padding-top: $sar-notice-bar-padding-y;
|
|
29
|
+
padding-bottom: $sar-notice-bar-padding-y;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@include m(linkable) {
|
|
33
|
+
@include ifweb {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@include e(left-icon) {
|
|
40
|
+
@include universal;
|
|
41
|
+
margin-right: $sar-notice-bar-left-icon-gap;
|
|
42
|
+
color: $sar-notice-bar-color;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include e(content) {
|
|
46
|
+
@include universal;
|
|
47
|
+
flex: 1;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@include e(container) {
|
|
52
|
+
@include universal;
|
|
53
|
+
flex: none;
|
|
54
|
+
flex-direction: row;
|
|
55
|
+
justify-content: flex-start;
|
|
56
|
+
width: 10000px;
|
|
57
|
+
|
|
58
|
+
@include m(wrap) {
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
width: 100%;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@include e(wrapper) {
|
|
65
|
+
@include universal;
|
|
66
|
+
|
|
67
|
+
@include m(scrollable) {
|
|
68
|
+
@include ifweb {
|
|
69
|
+
animation: #{bem-ns(notice-bar-scroll)} linear both running;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include m(infinite) {
|
|
74
|
+
@include ifweb {
|
|
75
|
+
animation: #{bem-ns(notice-bar-scroll-infinite)} linear both running infinite;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@include e(text) {
|
|
81
|
+
font-size: $sar-notice-bar-font-size;
|
|
82
|
+
color: $sar-notice-bar-color;
|
|
83
|
+
line-height: $sar-notice-bar-wrap-line-height;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@include e(right-icon) {
|
|
87
|
+
@include universal;
|
|
88
|
+
padding-left: $sar-notice-bar-right-icon-gap;
|
|
89
|
+
color: $sar-notice-bar-color;
|
|
90
|
+
|
|
91
|
+
@include ifweb {
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@include ifweb {
|
|
98
|
+
@keyframes #{bem-ns(notice-bar-scroll)} {
|
|
99
|
+
100% {
|
|
100
|
+
transform: translate3d(-100%, 0, 0);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@keyframes #{bem-ns(notice-bar-scroll-infinite)} {
|
|
105
|
+
100% {
|
|
106
|
+
transform: translate3d(-100%, 0, 0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NotifyProps, NotifyRef } from './Notify';
|
|
3
|
+
import { AgentProps, MapIdAgent } from '../utils/imperative';
|
|
4
|
+
export declare const mapIdAgent: MapIdAgent<NotifyProps, NotifyRef>;
|
|
5
|
+
export declare const NotifyAgent: (agentProps: AgentProps<NotifyProps>) => import("react").CElement<any, import("react").Component<any, any, any>>;
|
|
6
|
+
export default NotifyAgent;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
|
+
import { PopupProps } from '../popup';
|
|
3
|
+
export interface NotifyProps extends Omit<PopupProps, 'children'> {
|
|
4
|
+
type?: 'primary' | 'success' | 'warning' | 'error';
|
|
5
|
+
message?: ReactNode;
|
|
6
|
+
duration?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
background?: string;
|
|
9
|
+
onTimeout?: (visible: false) => void;
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
defaultVisible?: boolean;
|
|
12
|
+
onVisible?: (visible: boolean) => void;
|
|
13
|
+
placement?: 'top' | 'bottom';
|
|
14
|
+
popupProps?: PopupProps;
|
|
15
|
+
}
|
|
16
|
+
export interface NotifyRef {
|
|
17
|
+
cancelHide: () => void;
|
|
18
|
+
hideLater: () => void;
|
|
19
|
+
}
|
|
20
|
+
export type NotifyFC = ForwardRefExoticComponent<PropsWithoutRef<NotifyProps> & RefAttributes<NotifyRef>>;
|
|
21
|
+
export declare const Notify: NotifyFC;
|
|
22
|
+
export default Notify;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, forwardRef, useImperativeHandle, } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { Text, View } from '@tarojs/components';
|
|
5
|
+
import { Popup } from '../popup';
|
|
6
|
+
import { useBem, useControllableValue, useSetTimeout } from '../use';
|
|
7
|
+
import { filterNullish } from '../utils';
|
|
8
|
+
import SafeArea from '../safe-area';
|
|
9
|
+
const mapPlacementEffect = {
|
|
10
|
+
top: 'slide-top',
|
|
11
|
+
bottom: 'slide-bottom',
|
|
12
|
+
};
|
|
13
|
+
export const Notify = forwardRef((props, ref) => {
|
|
14
|
+
const { className, style, contentClass, contentStyle, type = 'primary', message, duration = 3000, color, background, onTimeout, visible, defaultVisible, onVisible, placement = 'top', mask = false, ...restProps } = props;
|
|
15
|
+
const [bem] = useBem('notify');
|
|
16
|
+
const [innerVisible, setInnerVisible] = useControllableValue({
|
|
17
|
+
value: visible,
|
|
18
|
+
defaultValue: defaultVisible,
|
|
19
|
+
trigger: onVisible,
|
|
20
|
+
initialValue: false,
|
|
21
|
+
});
|
|
22
|
+
const [hideLater, cancelHide] = useSetTimeout(() => {
|
|
23
|
+
onTimeout?.(false);
|
|
24
|
+
setInnerVisible?.(false);
|
|
25
|
+
}, duration, {
|
|
26
|
+
canDelay: () => duration !== 0,
|
|
27
|
+
});
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (innerVisible) {
|
|
30
|
+
hideLater();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
cancelHide();
|
|
34
|
+
}
|
|
35
|
+
}, [innerVisible, type, duration]);
|
|
36
|
+
useImperativeHandle(ref, () => ({
|
|
37
|
+
hideLater,
|
|
38
|
+
cancelHide,
|
|
39
|
+
}), []);
|
|
40
|
+
return (_jsxs(Popup, { ...restProps, mask: mask, visible: innerVisible, effect: mapPlacementEffect[placement], className: classNames(bem.e('popup'), className), style: style, contentClass: classNames(bem.b(), bem.m(placement), contentClass), contentStyle: {
|
|
41
|
+
...contentStyle,
|
|
42
|
+
}, onlyPopup: true, children: [placement === 'top' && (_jsx(SafeArea, { direction: "top", className: bem.e('safe-area') })), _jsx(View, { className: classNames(bem.e('content'), bem.em('content', type)), style: filterNullish({
|
|
43
|
+
backgroundColor: background,
|
|
44
|
+
}), children: _jsx(Text, { className: bem.e('text'), style: filterNullish({
|
|
45
|
+
color,
|
|
46
|
+
}), children: message }) }), placement === 'bottom' && (_jsx(SafeArea, { direction: "bottom", className: bem.e('safe-area') }))] }));
|
|
47
|
+
});
|
|
48
|
+
export default Notify;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NotifyProps } from './Notify';
|
|
3
|
+
export interface NotifyOptions extends NotifyProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface NotifyShow {
|
|
7
|
+
(options: NotifyOptions): void;
|
|
8
|
+
(message: ReactNode, options?: NotifyOptions): void;
|
|
9
|
+
}
|
|
10
|
+
export interface NotifyInternalShow {
|
|
11
|
+
(optionsOrMessage: ReactNode | NotifyOptions, options?: NotifyOptions, innerType?: NotifyOptions['type']): void;
|
|
12
|
+
}
|
|
13
|
+
export declare const show: NotifyShow;
|
|
14
|
+
export declare const success: NotifyShow;
|
|
15
|
+
export declare const warning: NotifyShow;
|
|
16
|
+
export declare const error: NotifyShow;
|
|
17
|
+
export declare const hide: (id?: string) => void;
|
|
18
|
+
export declare const hideAll: () => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mapIdAgent } from './Agent';
|
|
2
|
+
import { isNotReactNode } from '../utils';
|
|
3
|
+
const internalShow = (optionsOrMessage, options = {}, internalType) => {
|
|
4
|
+
if (isNotReactNode(optionsOrMessage)) {
|
|
5
|
+
options = optionsOrMessage;
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
options.message = optionsOrMessage;
|
|
9
|
+
}
|
|
10
|
+
options.type = internalType;
|
|
11
|
+
const { id = 'notify' } = options;
|
|
12
|
+
const ref = mapIdAgent[id];
|
|
13
|
+
if (ref) {
|
|
14
|
+
ref.current?.hideLater();
|
|
15
|
+
ref.current?.show(options);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const show = (optionsOrMessage, options) => {
|
|
19
|
+
internalShow(optionsOrMessage, options, 'primary');
|
|
20
|
+
};
|
|
21
|
+
export const success = (optionsOrMessage, options) => {
|
|
22
|
+
internalShow(optionsOrMessage, options, 'success');
|
|
23
|
+
};
|
|
24
|
+
export const warning = (optionsOrMessage, options) => {
|
|
25
|
+
internalShow(optionsOrMessage, options, 'warning');
|
|
26
|
+
};
|
|
27
|
+
export const error = (optionsOrMessage, options) => {
|
|
28
|
+
internalShow(optionsOrMessage, options, 'error');
|
|
29
|
+
};
|
|
30
|
+
export const hide = (id = 'notify') => {
|
|
31
|
+
mapIdAgent[id]?.current?.hide();
|
|
32
|
+
};
|
|
33
|
+
export const hideAll = () => {
|
|
34
|
+
Object.keys(mapIdAgent).forEach((key) => mapIdAgent[key]?.current?.hide());
|
|
35
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NotifyFC as NotifyOriginFC, NotifyProps, NotifyRef } from './Notify';
|
|
2
|
+
import { show, success, warning, error, hide, hideAll } from './imperative';
|
|
3
|
+
import { NotifyAgent } from './Agent';
|
|
4
|
+
export interface NotifyFC extends NotifyOriginFC {
|
|
5
|
+
show: typeof show;
|
|
6
|
+
success: typeof success;
|
|
7
|
+
warning: typeof warning;
|
|
8
|
+
error: typeof error;
|
|
9
|
+
hide: typeof hide;
|
|
10
|
+
hideAll: typeof hideAll;
|
|
11
|
+
Agent: typeof NotifyAgent;
|
|
12
|
+
}
|
|
13
|
+
declare const Notify: NotifyFC;
|
|
14
|
+
export { Notify, NotifyAgent, NotifyProps, NotifyRef };
|
|
15
|
+
export default Notify;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Notify as NotifyOrigin } from './Notify';
|
|
2
|
+
import { show, success, warning, error, hide, hideAll } from './imperative';
|
|
3
|
+
import { NotifyAgent } from './Agent';
|
|
4
|
+
const Notify = NotifyOrigin;
|
|
5
|
+
Notify.show = show;
|
|
6
|
+
Notify.success = success;
|
|
7
|
+
Notify.warning = warning;
|
|
8
|
+
Notify.error = error;
|
|
9
|
+
Notify.hide = hide;
|
|
10
|
+
Notify.hideAll = hideAll;
|
|
11
|
+
Notify.Agent = NotifyAgent;
|
|
12
|
+
export { Notify, NotifyAgent };
|
|
13
|
+
export default Notify;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@import '../style/base.scss';
|
|
2
|
+
// #variables
|
|
3
|
+
$sar-notify-z-index: 1190 !default;
|
|
4
|
+
|
|
5
|
+
$sar-notify-width: 90% !default;
|
|
6
|
+
$sar-notify-safe-area-min-height: 16px !default;
|
|
7
|
+
$sar-notify-paddding-x: 16px !default;
|
|
8
|
+
$sar-notify-paddding-y: 8px !default;
|
|
9
|
+
$sar-notify-border-radius: $sar-rounded !default;
|
|
10
|
+
$sar-notify-box-shadow: $sar-shadow-lg !default;
|
|
11
|
+
$sar-notify-font-size: $sar-text-base !default;
|
|
12
|
+
$sar-notify-color: $sar-white !default;
|
|
13
|
+
// #endvariables
|
|
14
|
+
|
|
15
|
+
@include bem(notify) {
|
|
16
|
+
@include b() {
|
|
17
|
+
@include universal;
|
|
18
|
+
width: $sar-notify-width;
|
|
19
|
+
pointer-events: box-none;
|
|
20
|
+
@include ifweb {
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@include e(popup) {
|
|
26
|
+
align-items: center;
|
|
27
|
+
z-index: $sar-notify-z-index;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include e(safe-area) {
|
|
31
|
+
min-height: $sar-notify-safe-area-min-height;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include e(content) {
|
|
35
|
+
@include universal;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
text-align: center;
|
|
39
|
+
padding: $sar-notify-paddding-y $sar-notify-paddding-x;
|
|
40
|
+
border-radius: $sar-notify-border-radius;
|
|
41
|
+
box-shadow: $sar-notify-box-shadow;
|
|
42
|
+
@include ifweb {
|
|
43
|
+
pointer-events: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@each $type,
|
|
47
|
+
$color
|
|
48
|
+
in (
|
|
49
|
+
primary: $sar-primary,
|
|
50
|
+
success: $sar-success,
|
|
51
|
+
warning: $sar-warning,
|
|
52
|
+
error: $sar-danger
|
|
53
|
+
)
|
|
54
|
+
{
|
|
55
|
+
@include m($type) {
|
|
56
|
+
background-color: $color;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@include e(text) {
|
|
62
|
+
font-size: $sar-notify-font-size;
|
|
63
|
+
color: $sar-white;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface NumberKeyboardProps extends BaseProps {
|
|
4
|
+
onInput?: (key: string) => void;
|
|
5
|
+
onDelete?: () => void;
|
|
6
|
+
extraKey?: string;
|
|
7
|
+
random?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const NumberKeyboard: import("react").MemoExoticComponent<(props: NumberKeyboardProps) => import("react/jsx-runtime").JSX.Element>;
|
|
10
|
+
export default NumberKeyboard;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { View } from '@tarojs/components';
|
|
5
|
+
import { Icon } from '../icon';
|
|
6
|
+
import { useBem, useEvent } from '../use';
|
|
7
|
+
import { shuffle } from '../utils';
|
|
8
|
+
import Pressable from '../pressable';
|
|
9
|
+
export const NumberKeyboard = memo((props) => {
|
|
10
|
+
const { className, style, onInput, onDelete, extraKey, random, ...restProps } = props;
|
|
11
|
+
const [bem] = useBem('number-keyboard');
|
|
12
|
+
const handleKeyClick = useEvent((key) => {
|
|
13
|
+
onInput?.(key);
|
|
14
|
+
});
|
|
15
|
+
const handleDelete = useEvent(() => {
|
|
16
|
+
onDelete?.();
|
|
17
|
+
});
|
|
18
|
+
const numArray = useMemo(() => {
|
|
19
|
+
const arr = Array(10)
|
|
20
|
+
.fill(0)
|
|
21
|
+
.map((_, i) => (i + 1) % 10);
|
|
22
|
+
if (random) {
|
|
23
|
+
shuffle(arr, true);
|
|
24
|
+
}
|
|
25
|
+
return arr;
|
|
26
|
+
}, [random]);
|
|
27
|
+
const keysElement = useMemo(() => {
|
|
28
|
+
const keys = [...numArray];
|
|
29
|
+
if (extraKey) {
|
|
30
|
+
keys.splice(keys.length - 1, 0, 'extra');
|
|
31
|
+
}
|
|
32
|
+
keys.push('backspace');
|
|
33
|
+
return keys.map((n) => {
|
|
34
|
+
return (_jsx(View, { className: classNames(bem.e(n), bem.e('key-wrapper')), children: _jsx(Pressable, { children: ({ pressed }) => (_jsx(View, { className: classNames(bem.e('key'), bem.em('key', 'pressed', pressed)), onClick: () => {
|
|
35
|
+
switch (n) {
|
|
36
|
+
case 'backspace':
|
|
37
|
+
handleDelete();
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
handleKeyClick(String(n));
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}, children: n === 'extra' ? (extraKey) : n === 'backspace' ? (_jsx(Icon, { name: "backspace", className: bem.e('backspace-icon') })) : (n) })) }) }, n));
|
|
44
|
+
});
|
|
45
|
+
}, [numArray, extraKey]);
|
|
46
|
+
const renderKeyboard = () => {
|
|
47
|
+
return (_jsx(View, { ...restProps, className: classNames(bem.b(), className), style: style, children: _jsx(View, { className: bem.e('body'), children: keysElement }) }));
|
|
48
|
+
};
|
|
49
|
+
return renderKeyboard();
|
|
50
|
+
});
|
|
51
|
+
export default NumberKeyboard;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@import '../style/base.scss';
|
|
3
|
+
// #variables
|
|
4
|
+
$sar-number-keyboard-bg-color: $sar-gray-200 !default;
|
|
5
|
+
|
|
6
|
+
$sar-number-keyboard-body-padding-x: 6px !default;
|
|
7
|
+
$sar-number-keyboard-body-padding-y: 6px !default;
|
|
8
|
+
|
|
9
|
+
$sar-number-keyboard-key-gap: 6px !default;
|
|
10
|
+
$sar-number-keyboard-key-height: 48px !default;
|
|
11
|
+
$sar-number-keyboard-key-border-radius: $sar-rounded !default;
|
|
12
|
+
$sar-number-keyboard-key-font-size: $sar-text-2xl !default;
|
|
13
|
+
$sar-number-keyboard-key-color: $sar-body-color !default;
|
|
14
|
+
$sar-number-keyboard-key-bg-color: $sar-white !default;
|
|
15
|
+
$sar-number-keyboard-key-active-bg-color: $sar-gray-200 !default;
|
|
16
|
+
|
|
17
|
+
// 暗黑模式
|
|
18
|
+
$sar-number-keyboard-dark-bg-color: $sar-gray-800 !default;
|
|
19
|
+
$sar-number-keyboard-key-dark-color: $sar-white !default;
|
|
20
|
+
$sar-number-keyboard-key-dark-bg-color: $sar-gray-700 !default;
|
|
21
|
+
$sar-number-keyboard-key-active-dark-bg-color: $sar-gray-600 !default;
|
|
22
|
+
// #endvariables
|
|
23
|
+
|
|
24
|
+
@include bem(number-keyboard) {
|
|
25
|
+
@include b() {
|
|
26
|
+
@include universal;
|
|
27
|
+
background-color: $sar-number-keyboard-bg-color;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include e(body) {
|
|
31
|
+
@include universal;
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
flex-wrap: wrap;
|
|
34
|
+
padding: $sar-number-keyboard-body-padding-y
|
|
35
|
+
$sar-number-keyboard-body-padding-x;
|
|
36
|
+
margin: math.div($sar-number-keyboard-key-gap, 2) * -1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@include e(key-wrapper) {
|
|
40
|
+
@include universal;
|
|
41
|
+
flex-grow: 1;
|
|
42
|
+
flex-shrink: 1;
|
|
43
|
+
flex-basis: 33.3333%;
|
|
44
|
+
width: 33.3333%;
|
|
45
|
+
padding: math.div($sar-number-keyboard-key-gap, 2);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@include e(backspace) {
|
|
49
|
+
@include universal;
|
|
50
|
+
max-width: 33.3333%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@include e(key) {
|
|
54
|
+
@include universal;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
|
|
58
|
+
height: $sar-number-keyboard-key-height;
|
|
59
|
+
border-radius: $sar-number-keyboard-key-border-radius;
|
|
60
|
+
font-size: $sar-number-keyboard-key-font-size;
|
|
61
|
+
color: $sar-number-keyboard-key-color;
|
|
62
|
+
background-color: $sar-number-keyboard-key-bg-color;
|
|
63
|
+
|
|
64
|
+
@include ifweb {
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@include m(pressed) {
|
|
69
|
+
background-color: $sar-number-keyboard-key-active-bg-color;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include e(backspace-icon) {
|
|
74
|
+
font-size: $sar-number-keyboard-key-font-size;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@include theme(dark) {
|
|
79
|
+
@include bem(number-keyboard) {
|
|
80
|
+
@include b() {
|
|
81
|
+
background-color: $sar-number-keyboard-dark-bg-color;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@include e(key) {
|
|
85
|
+
color: $sar-number-keyboard-key-dark-color;
|
|
86
|
+
background-color: $sar-number-keyboard-key-dark-bg-color;
|
|
87
|
+
|
|
88
|
+
@include m(pressed) {
|
|
89
|
+
background-color: $sar-number-keyboard-key-active-dark-bg-color;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface PaginationProps extends BaseProps {
|
|
4
|
+
total?: number;
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
current?: number;
|
|
7
|
+
defaultCurrent?: number;
|
|
8
|
+
onChange?: (page: number) => void;
|
|
9
|
+
pageCount?: number;
|
|
10
|
+
pageButtonCount?: number;
|
|
11
|
+
hideOnSinglePage?: boolean;
|
|
12
|
+
type?: 'simple' | 'multi';
|
|
13
|
+
ellipsis?: boolean;
|
|
14
|
+
multiCount?: number;
|
|
15
|
+
prev?: ReactNode;
|
|
16
|
+
next?: ReactNode;
|
|
17
|
+
page?: (page: number, active: boolean) => ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare const Pagination: FC<PaginationProps>;
|
|
20
|
+
export default Pagination;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Text, View } from '@tarojs/components';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useBem, useControllableValue } from '../use';
|
|
5
|
+
import { getPageRange, minmax } from '../utils';
|
|
6
|
+
import useTranslate from '../locale/useTranslate';
|
|
7
|
+
import Pressable from '../pressable';
|
|
8
|
+
import Halfline from '../halfline';
|
|
9
|
+
export const Pagination = (props) => {
|
|
10
|
+
const { t } = useTranslate('pagination');
|
|
11
|
+
const { className, style, total = 0, pageSize = 10, current, defaultCurrent, onChange, pageCount, pageButtonCount = 5, hideOnSinglePage = false, type = 'multi', ellipsis, multiCount = 5, prev, next, page: pageSlot, ...restProps } = props;
|
|
12
|
+
const [bem] = useBem('pagination');
|
|
13
|
+
const innerPageCount = (pageCount ?? Math.ceil(total / pageSize)) || 1;
|
|
14
|
+
const [innerCurrent, setInnerCurrent] = useControllableValue({
|
|
15
|
+
value: current,
|
|
16
|
+
defaultValue: defaultCurrent,
|
|
17
|
+
trigger: onChange,
|
|
18
|
+
initialValue: 1,
|
|
19
|
+
postValue: (value) => minmax(value, 1, innerPageCount),
|
|
20
|
+
});
|
|
21
|
+
const [min, max] = getPageRange(innerCurrent, innerPageCount, pageButtonCount);
|
|
22
|
+
const handlePrevClick = () => {
|
|
23
|
+
if (innerCurrent > 1) {
|
|
24
|
+
changeTo(innerCurrent - 1);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const handleNextClick = () => {
|
|
28
|
+
if (innerCurrent < innerPageCount) {
|
|
29
|
+
changeTo(innerCurrent + 1);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const handleItemClick = (page, type) => {
|
|
33
|
+
changeTo(type === 0
|
|
34
|
+
? page
|
|
35
|
+
: minmax(innerCurrent + type * multiCount, 1, innerPageCount));
|
|
36
|
+
};
|
|
37
|
+
const changeTo = (page) => {
|
|
38
|
+
if (page !== innerCurrent) {
|
|
39
|
+
setInnerCurrent(page);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const renderMulti = () => {
|
|
43
|
+
const length = max - min + 1;
|
|
44
|
+
return Array(length)
|
|
45
|
+
.fill(0)
|
|
46
|
+
.map((_, i) => {
|
|
47
|
+
const page = i + min;
|
|
48
|
+
const isPrevMulti = i === 0 && page !== 1;
|
|
49
|
+
const isNextMulti = i === length - 1 && page !== innerPageCount;
|
|
50
|
+
const type = isPrevMulti ? -1 : isNextMulti ? 1 : 0;
|
|
51
|
+
return (_jsx(Pressable, { disabled: innerCurrent === page, children: ({ pressed }) => (_jsxs(View, { className: classNames(bem.e('item'), bem.em('item', 'current', innerCurrent === page), bem.em('item', 'pressed', pressed)), onClick: () => handleItemClick(page, type), children: [_jsx(Halfline, { direction: "around", className: classNames(bem.e('halfline'), bem.em('halfline', 'current', innerCurrent === page)), style: { borderLeftWidth: 0 } }), _jsx(Text, { className: classNames(bem.e('item-text'), bem.em('item-text', 'current', innerCurrent === page)), children: ellipsis && (isPrevMulti || isNextMulti)
|
|
52
|
+
? '...'
|
|
53
|
+
: pageSlot
|
|
54
|
+
? pageSlot(page, innerCurrent === page)
|
|
55
|
+
: page })] })) }, page));
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const renderSimple = () => {
|
|
59
|
+
return (_jsxs(View, { className: bem.e('ratio'), children: [innerCurrent, "/", innerPageCount] }));
|
|
60
|
+
};
|
|
61
|
+
return (_jsx(_Fragment, { children: (!hideOnSinglePage || innerPageCount > 1) && (_jsxs(View, { ...restProps, className: classNames(bem.b(), bem.m(type), className), style: style, children: [_jsx(Pressable, { disabled: innerCurrent === 1, children: ({ pressed }) => (_jsxs(View, { className: classNames(bem.e('item'), bem.em('item', 'disabled', innerCurrent === 1), bem.em('item', 'pressed', pressed), bem.em('item', 'first'), bem.e('prev'), bem.em('prev', type)), onClick: handlePrevClick, children: [_jsx(Halfline, { direction: "around", className: classNames(bem.em('halfline', 'first'), bem.em('halfline', type)) }), _jsx(Text, { className: bem.e('item-text'), children: prev ?? t('previous') })] })) }), type === 'simple' ? renderSimple() : renderMulti(), _jsx(Pressable, { disabled: innerCurrent === innerPageCount, children: ({ pressed }) => (_jsxs(View, { className: classNames(bem.e('item'), bem.em('item', 'disabled', innerCurrent === innerPageCount), bem.em('item', 'pressed', pressed), bem.em('item', 'last'), bem.e('next'), bem.em('next', type)), onClick: handleNextClick, children: [_jsx(Halfline, { direction: "around", className: classNames(bem.em('halfline', 'last'), bem.em('halfline', type)), style: {
|
|
62
|
+
...(type === 'multi' ? { borderLeftWidth: 0 } : null),
|
|
63
|
+
} }), _jsx(Text, { className: bem.e('item-text'), children: next ?? t('next') })] })) })] })) }));
|
|
64
|
+
};
|
|
65
|
+
export default Pagination;
|