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,52 @@
|
|
|
1
|
+
import { isLoading, loadAsync } from 'expo-font';
|
|
2
|
+
import { internalFamily, } from './common';
|
|
3
|
+
import iconfont from './font/iconfont.json';
|
|
4
|
+
import { useForceRender } from '../use';
|
|
5
|
+
import { useRef } from 'react';
|
|
6
|
+
const mapFamilyGlyph = {};
|
|
7
|
+
export function parseGlyphs(glyphs) {
|
|
8
|
+
const map = {};
|
|
9
|
+
glyphs.glyphs.forEach((item) => {
|
|
10
|
+
map[item.font_class] = item.unicode_decimal;
|
|
11
|
+
});
|
|
12
|
+
return map;
|
|
13
|
+
}
|
|
14
|
+
const loadPromises = {};
|
|
15
|
+
export function loadFont(mapFamily) {
|
|
16
|
+
return Promise.all(Object.keys(mapFamily).map((family) => {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
const { glyphs, font } = mapFamily[family];
|
|
19
|
+
loadPromises[family] = loadAsync({
|
|
20
|
+
[family]: font,
|
|
21
|
+
})
|
|
22
|
+
.then(resolve)
|
|
23
|
+
.catch(reject);
|
|
24
|
+
mapFamilyGlyph[family] = glyphs;
|
|
25
|
+
});
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function loadInternalFont() {
|
|
29
|
+
loadFont({
|
|
30
|
+
[internalFamily]: {
|
|
31
|
+
glyphs: parseGlyphs(iconfont),
|
|
32
|
+
font: require('./font/iconfont.ttf'),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
loadInternalFont();
|
|
37
|
+
export function useFonts(family, name = '') {
|
|
38
|
+
const forceRender = useForceRender();
|
|
39
|
+
const isListening = useRef(false);
|
|
40
|
+
if (isLoading(family) && !isListening.current) {
|
|
41
|
+
isListening.current = true;
|
|
42
|
+
loadPromises[family].then(() => {
|
|
43
|
+
forceRender();
|
|
44
|
+
});
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
const unicode = mapFamilyGlyph[family]?.[name];
|
|
48
|
+
if (!unicode) {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
return String.fromCharCode(unicode);
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentType, FC } from 'react';
|
|
2
|
+
import { ITouchEvent, ImageProps, TextProps } from '@tarojs/components';
|
|
3
|
+
import { BaseProps } from '../base';
|
|
4
|
+
import { loadFont, parseGlyphs } from './fontLoader';
|
|
5
|
+
export interface IconProps extends BaseProps {
|
|
6
|
+
name?: string;
|
|
7
|
+
family?: string;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
size?: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
imageMode?: ImageProps['mode'];
|
|
12
|
+
imageClass?: string;
|
|
13
|
+
onClick?: (event: ITouchEvent) => void;
|
|
14
|
+
_element?: ComponentType<TextProps>;
|
|
15
|
+
}
|
|
16
|
+
export interface IconFC extends FC<IconProps> {
|
|
17
|
+
loadFont: typeof loadFont;
|
|
18
|
+
parseGlyphs: typeof parseGlyphs;
|
|
19
|
+
}
|
|
20
|
+
export declare const Icon: IconFC;
|
|
21
|
+
export default Icon;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Image, Text, } from '@tarojs/components';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { addPxInWeb, filterNullish, isFileUrl, isNumber, isRN } from '../utils';
|
|
6
|
+
import { useBem } from '../use';
|
|
7
|
+
import { useFonts, loadFont, parseGlyphs } from './fontLoader';
|
|
8
|
+
import { internalFamily } from './common';
|
|
9
|
+
const internalPrefix = 'sari';
|
|
10
|
+
export const Icon = (props) => {
|
|
11
|
+
const { className, style, name = '', family = internalFamily, prefix, size, color, imageMode = 'aspectFill', imageClass, _element, ...restProps } = props;
|
|
12
|
+
const [bem] = useBem('icon');
|
|
13
|
+
const isImg = useMemo(() => {
|
|
14
|
+
// number表示react-native import导入的图片的对象的引入下标
|
|
15
|
+
return isNumber(name) || isFileUrl(String(name));
|
|
16
|
+
}, [name]);
|
|
17
|
+
const char = useFonts(family, name);
|
|
18
|
+
let mergedPrefix = prefix;
|
|
19
|
+
if (family === internalFamily) {
|
|
20
|
+
mergedPrefix = internalPrefix;
|
|
21
|
+
}
|
|
22
|
+
// 允许传递 Animated.Text 以便添加动画效果
|
|
23
|
+
const RootElement = _element ?? Text;
|
|
24
|
+
return (_jsx(RootElement, { ...restProps, className: classNames(bem.b(), {
|
|
25
|
+
[`${mergedPrefix || family}-${name}`]: !isRN && name && !isImg,
|
|
26
|
+
}, className), style: {
|
|
27
|
+
...style,
|
|
28
|
+
fontFamily: family,
|
|
29
|
+
...filterNullish({
|
|
30
|
+
fontSize: size,
|
|
31
|
+
lineHeight: size ? addPxInWeb(size * 1.25) : size,
|
|
32
|
+
color,
|
|
33
|
+
}),
|
|
34
|
+
}, children: isImg ? (_jsx(Image, { className: classNames(bem.e('image'), imageClass), src: name, mode: imageMode, style: filterNullish({
|
|
35
|
+
width: size,
|
|
36
|
+
height: size,
|
|
37
|
+
}) })) : (char) }));
|
|
38
|
+
};
|
|
39
|
+
Icon.loadFont = loadFont;
|
|
40
|
+
Icon.parseGlyphs = parseGlyphs;
|
|
41
|
+
export default Icon;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@import '../style/base.scss';
|
|
2
|
+
@import './font/iconfont.scss';
|
|
3
|
+
|
|
4
|
+
// #variables
|
|
5
|
+
$sar-icon-image-size: $sar-text-base !default;
|
|
6
|
+
// #endvariables
|
|
7
|
+
|
|
8
|
+
@include bem(icon) {
|
|
9
|
+
@include b() {
|
|
10
|
+
font-family: sard-icons;
|
|
11
|
+
@include ifweb {
|
|
12
|
+
vertical-align: middle;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@include e(image) {
|
|
17
|
+
@include universal;
|
|
18
|
+
width: $sar-icon-image-size;
|
|
19
|
+
height: $sar-icon-image-size;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface IndexBarItemProps extends BaseProps {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
anchorClass?: string;
|
|
6
|
+
anchorStyle?: CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
export declare const IndexBarItem: import("react").ForwardRefExoticComponent<IndexBarItemProps & import("react").RefAttributes<any>>;
|
|
9
|
+
export default IndexBarItem;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { View } from '@tarojs/components';
|
|
5
|
+
import { useBem } from '../use';
|
|
6
|
+
export const IndexBarItem = forwardRef((props, ref) => {
|
|
7
|
+
const { className, style, children, title, anchorClass, anchorStyle, ...restProps } = props;
|
|
8
|
+
const [bem] = useBem('index-bar');
|
|
9
|
+
return (_jsxs(View, { ...restProps, ref: ref, className: classNames(bem.e('item'), className), style: style, children: [_jsx(View, { className: classNames(bem.e('item-anchor'), anchorClass), style: anchorStyle, children: title }), _jsx(View, { className: bem.e('item-content'), children: children })] }));
|
|
10
|
+
});
|
|
11
|
+
export default IndexBarItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseProps } from '../base';
|
|
3
|
+
export interface IndexBarNavProps extends BaseProps {
|
|
4
|
+
items: (string | number)[];
|
|
5
|
+
panStart: () => void;
|
|
6
|
+
panEnd: () => void;
|
|
7
|
+
onChange: (key: string | number) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface NavRef {
|
|
10
|
+
switchTo: (key: number | string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const IndexBarNav: import("react").ForwardRefExoticComponent<IndexBarNavProps & import("react").RefAttributes<NavRef>>;
|
|
13
|
+
export default IndexBarNav;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState, } from 'react';
|
|
3
|
+
import { CustomWrapper, View } from '@tarojs/components';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { useBem, useEvent, useSelectorId, useThrottle } from '../use';
|
|
6
|
+
import PanGestureDetector from '../pan-gesture-detector';
|
|
7
|
+
import { usePan } from '../pan-gesture-detector/usePan';
|
|
8
|
+
import { getRectByElement, minmax } from '../utils';
|
|
9
|
+
import CSSTransition from '../transition/CSSTransition';
|
|
10
|
+
export const IndexBarNav = forwardRef((props, ref) => {
|
|
11
|
+
const { items, panStart, panEnd, onChange } = props;
|
|
12
|
+
const [bem] = useBem('index-bar');
|
|
13
|
+
const contextId = useSelectorId();
|
|
14
|
+
const [activeKey, setActiveKey] = useState(items[0]);
|
|
15
|
+
const navRef = useRef();
|
|
16
|
+
const downNavHeight = useRef(0);
|
|
17
|
+
const downNavTop = useRef(0);
|
|
18
|
+
const scrollByOffset = (offsetY) => {
|
|
19
|
+
const index = minmax(Math.floor((offsetY / downNavHeight.current) * items.length), 0, items.length - 1);
|
|
20
|
+
const key = items[index];
|
|
21
|
+
if (key !== activeKey) {
|
|
22
|
+
setActiveKey(key);
|
|
23
|
+
onChange(key);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const panThrottleHandler = useThrottle((offsetY) => {
|
|
27
|
+
scrollByOffset(offsetY);
|
|
28
|
+
}, 100, {
|
|
29
|
+
leading: false,
|
|
30
|
+
});
|
|
31
|
+
const handlers = usePan({
|
|
32
|
+
async start(event) {
|
|
33
|
+
panStart();
|
|
34
|
+
setHintVisible(true);
|
|
35
|
+
const rect = await getRectByElement(navRef.current, contextId);
|
|
36
|
+
downNavHeight.current = rect.height || 0;
|
|
37
|
+
downNavTop.current = rect.top;
|
|
38
|
+
scrollByOffset(event.y0 - rect.top);
|
|
39
|
+
},
|
|
40
|
+
move(event) {
|
|
41
|
+
panThrottleHandler(event.moveY - downNavTop.current);
|
|
42
|
+
},
|
|
43
|
+
end() {
|
|
44
|
+
panEnd();
|
|
45
|
+
setHintVisible(false);
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
// hint >>>
|
|
49
|
+
const [hintVisible, setHintVisible] = useState(false);
|
|
50
|
+
const [hintRealVisible, setHintRealVisible] = useState(false);
|
|
51
|
+
const [hintTop, setHintTop] = useState('0%');
|
|
52
|
+
const getTipsTop = (index) => {
|
|
53
|
+
return ((index + 0.5) / items.length) * 100 + '%';
|
|
54
|
+
};
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (activeKey) {
|
|
57
|
+
const index = items.indexOf(activeKey);
|
|
58
|
+
setHintTop(getTipsTop(index));
|
|
59
|
+
}
|
|
60
|
+
}, [activeKey]);
|
|
61
|
+
// <<< hint
|
|
62
|
+
const switchTo = useEvent((key) => {
|
|
63
|
+
setActiveKey(key);
|
|
64
|
+
});
|
|
65
|
+
useImperativeHandle(ref, () => ({
|
|
66
|
+
switchTo,
|
|
67
|
+
}), []);
|
|
68
|
+
return (_jsx(CustomWrapper, { id: contextId, children: _jsx(View, { className: bem.e('nav-container'), children: _jsx(View, { className: bem.e('nav-wrapper'), children: _jsx(PanGestureDetector, { handlers: handlers, children: _jsxs(View, { className: bem.e('nav'), ref: navRef, children: [items.map((item) => {
|
|
69
|
+
return (_jsx(View, { className: classNames(bem.e('nav-item'), bem.em('nav-item', 'active', item === activeKey)), children: item }, item));
|
|
70
|
+
}), _jsx(CSSTransition, { in: hintVisible, timeout: 300, effect: "fade", onEnter: () => setHintRealVisible(true), onExited: () => setHintRealVisible(false), className: bem.e('hint'), style: {
|
|
71
|
+
top: hintTop,
|
|
72
|
+
display: hintVisible || hintRealVisible ? 'flex' : 'none',
|
|
73
|
+
}, children: _jsx(View, { className: bem.e('hint-text'), children: activeKey }) })] }) }) }) }) }));
|
|
74
|
+
});
|
|
75
|
+
export default IndexBarNav;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CSSProperties, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
2
|
+
import { IndexBarItem } from './Item';
|
|
3
|
+
import { BaseProps } from '../base';
|
|
4
|
+
export * from './Item';
|
|
5
|
+
export interface IndexBarProps extends BaseProps {
|
|
6
|
+
defaultActiveKey?: number | string;
|
|
7
|
+
onChange?: (key: number | string) => void;
|
|
8
|
+
anchorClass?: string;
|
|
9
|
+
anchorStyle?: CSSProperties;
|
|
10
|
+
threshold?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface IndexBarRef {
|
|
13
|
+
scrollTo: (key: number | string) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface IndexBarFC extends ForwardRefExoticComponent<PropsWithoutRef<IndexBarProps> & RefAttributes<IndexBarRef>> {
|
|
16
|
+
Item: typeof IndexBarItem;
|
|
17
|
+
}
|
|
18
|
+
export declare const IndexBar: IndexBarFC;
|
|
19
|
+
export default IndexBar;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Children, cloneElement, useRef, forwardRef, useImperativeHandle, useEffect, useMemo, useCallback, } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { CustomWrapper, View } from '@tarojs/components';
|
|
5
|
+
import { IndexBarItem } from './Item';
|
|
6
|
+
import { useIndexableMap, useSetTimeout, useEvent, useBem, useThrottle, useSelectorId, } from '../use';
|
|
7
|
+
import { matchScrollVisible, getRectByElement, isRN } from '../utils';
|
|
8
|
+
import IndexBarNav from './Nav';
|
|
9
|
+
import ScrollView from '../scroll-view';
|
|
10
|
+
export * from './Item';
|
|
11
|
+
export const IndexBar = forwardRef((props, ref) => {
|
|
12
|
+
const { className, style, children, defaultActiveKey, onChange, anchorClass, anchorStyle, threshold = 150, ...restProps } = props;
|
|
13
|
+
const [bem] = useBem('index-bar');
|
|
14
|
+
const keyList = useMemo(() => {
|
|
15
|
+
return (Children.map(children, (element, index) => {
|
|
16
|
+
return element.key ?? index;
|
|
17
|
+
}) || []);
|
|
18
|
+
}, [children]);
|
|
19
|
+
// scroll >>>
|
|
20
|
+
const activeKey = useRef(defaultActiveKey ?? keyList[0]);
|
|
21
|
+
const contextId = useSelectorId();
|
|
22
|
+
const indexBarRef = useRef(null);
|
|
23
|
+
const scrollViewRef = useRef(null);
|
|
24
|
+
const scrollTop = useRef(0);
|
|
25
|
+
const setScrollTop = useCallback((top) => {
|
|
26
|
+
scrollTop.current = top;
|
|
27
|
+
scrollViewRef.current?.scrollTop(top);
|
|
28
|
+
}, []);
|
|
29
|
+
const scrollThrottleHandler = useThrottle(async () => {
|
|
30
|
+
if (lockScroll.current) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
matchScrollVisible(getCurrentItemsRect(), (index) => {
|
|
34
|
+
const key = keyList[index];
|
|
35
|
+
if (activeKey.current !== key) {
|
|
36
|
+
activeKey.current = key;
|
|
37
|
+
navRef.current?.switchTo(key);
|
|
38
|
+
onChange?.(key);
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
isRect: true,
|
|
42
|
+
});
|
|
43
|
+
}, threshold, {
|
|
44
|
+
leading: false,
|
|
45
|
+
});
|
|
46
|
+
const handleScroll = useEvent((event) => {
|
|
47
|
+
scrollTop.current = event.y;
|
|
48
|
+
scrollThrottleHandler();
|
|
49
|
+
});
|
|
50
|
+
const lockScroll = useRef(false);
|
|
51
|
+
const [unlockLater, cancelUnlock] = useSetTimeout(() => {
|
|
52
|
+
lockScroll.current = false;
|
|
53
|
+
}, 300);
|
|
54
|
+
const itemMap = useIndexableMap([]);
|
|
55
|
+
const scrollTo = useEvent(async (key) => {
|
|
56
|
+
const itemRect = initItemsRect.current[itemMap.getIndexByKey(key)];
|
|
57
|
+
if (itemRect) {
|
|
58
|
+
unlockLater();
|
|
59
|
+
lockScroll.current = true;
|
|
60
|
+
activeKey.current = key;
|
|
61
|
+
setScrollTop(itemRect.top);
|
|
62
|
+
navRef.current?.switchTo(key);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const initItemsRect = useRef([]);
|
|
66
|
+
const getInitItemsRect = async () => {
|
|
67
|
+
const indexBarRectTop = (await getRectByElement(indexBarRef.current, contextId)).top;
|
|
68
|
+
const elements = itemMap.data.map((item) => item[1][0]);
|
|
69
|
+
const rects = [];
|
|
70
|
+
for (let i = 0, l = elements.length; i < l; i++) {
|
|
71
|
+
const rect = await getRectByElement(elements[i], contextId);
|
|
72
|
+
rects.push({
|
|
73
|
+
...rect,
|
|
74
|
+
top: rect.top - indexBarRectTop,
|
|
75
|
+
bottom: rect.bottom - indexBarRectTop,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return rects;
|
|
79
|
+
};
|
|
80
|
+
const getCurrentItemsRect = () => {
|
|
81
|
+
return initItemsRect.current.map((item) => {
|
|
82
|
+
return {
|
|
83
|
+
...item,
|
|
84
|
+
top: item.top - scrollTop.current,
|
|
85
|
+
bottom: item.bottom - scrollTop.current,
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const [getRectsLater, cancelGetRects] = useSetTimeout(async () => {
|
|
90
|
+
initItemsRect.current = await getInitItemsRect();
|
|
91
|
+
scrollTo(activeKey.current);
|
|
92
|
+
}, 50);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
setScrollTop(0);
|
|
95
|
+
if (!isRN) {
|
|
96
|
+
getRectsLater();
|
|
97
|
+
}
|
|
98
|
+
return cancelGetRects;
|
|
99
|
+
}, [children]);
|
|
100
|
+
useImperativeHandle(ref, () => ({
|
|
101
|
+
scrollTo,
|
|
102
|
+
}), []);
|
|
103
|
+
// <<< scroll
|
|
104
|
+
// >>> nav
|
|
105
|
+
const navRef = useRef(null);
|
|
106
|
+
const handlePanStart = useEvent(() => {
|
|
107
|
+
cancelUnlock();
|
|
108
|
+
lockScroll.current = true;
|
|
109
|
+
});
|
|
110
|
+
const handlePanEnd = useEvent(() => {
|
|
111
|
+
unlockLater();
|
|
112
|
+
});
|
|
113
|
+
const handleNavChange = useEvent((key) => {
|
|
114
|
+
scrollTo(key);
|
|
115
|
+
onChange?.(key);
|
|
116
|
+
});
|
|
117
|
+
// <<< nav
|
|
118
|
+
return (_jsx(CustomWrapper, { id: contextId, children: _jsxs(View, { ...restProps, className: classNames(bem.b(), className), style: style, ref: indexBarRef, children: [_jsx(ScrollView, { contextId: contextId, ref: scrollViewRef, scrollY: true, onScroll: handleScroll, className: bem.e('scroll-view'), children: Children.map(children, (item, index) => {
|
|
119
|
+
const key = item.key ?? index;
|
|
120
|
+
return cloneElement(item, {
|
|
121
|
+
key,
|
|
122
|
+
anchorClass: classNames(anchorClass, item.props.anchorClass),
|
|
123
|
+
anchorStyle: { ...anchorStyle, ...item.props.anchorStyle },
|
|
124
|
+
ref: (element) => {
|
|
125
|
+
itemMap.set(key, [element, item.props.title]);
|
|
126
|
+
},
|
|
127
|
+
...(isRN
|
|
128
|
+
? {
|
|
129
|
+
onLayout: (event) => {
|
|
130
|
+
const layout = event.nativeEvent.layout;
|
|
131
|
+
initItemsRect.current[index] = {
|
|
132
|
+
top: layout.y,
|
|
133
|
+
bottom: layout.y + layout.height,
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
}
|
|
137
|
+
: null),
|
|
138
|
+
});
|
|
139
|
+
}) }), _jsx(IndexBarNav, { ref: navRef, items: keyList, panStart: handlePanStart, panEnd: handlePanEnd, onChange: handleNavChange })] }) }));
|
|
140
|
+
});
|
|
141
|
+
IndexBar.Item = IndexBarItem;
|
|
142
|
+
export default IndexBar;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@import '../style/base.scss';
|
|
3
|
+
// #variables
|
|
4
|
+
$sar-index-bar-anchor-padding: 0 16px !default;
|
|
5
|
+
$sar-index-bar-anchor-font-size: $sar-text-base !default;
|
|
6
|
+
$sar-index-bar-anchor-line-height: 32px !default;
|
|
7
|
+
$sar-index-bar-anchor-color: $sar-tertiary-color !default;
|
|
8
|
+
$sar-index-bar-anchor-bg-color: $sar-body-bg-color !default;
|
|
9
|
+
|
|
10
|
+
$sar-index-bar-nav-wrapper-right: 4px !default;
|
|
11
|
+
|
|
12
|
+
$sar-index-bar-nav-padding: 4px !default;
|
|
13
|
+
$sar-index-bar-nav-bg-color: $sar-body-bg-color !default;
|
|
14
|
+
|
|
15
|
+
$sar-index-bar-nav-item-font-size: 12px !default;
|
|
16
|
+
$sar-index-bar-nav-item-size: 20px !default;
|
|
17
|
+
$sar-index-bar-nav-item-color: $sar-body-color !default;
|
|
18
|
+
$sar-index-bar-nav-item-active-color: $sar-white !default;
|
|
19
|
+
$sar-index-bar-nav-item-active-bg-color: $sar-primary !default;
|
|
20
|
+
|
|
21
|
+
$sar-index-bar-hint-width: 50px !default;
|
|
22
|
+
$sar-index-bar-hint-height: 50px !default;
|
|
23
|
+
$sar-index-bar-hint-right: 36px !default;
|
|
24
|
+
$sar-index-bar-hint-border-radius: 100px 100px 0 100px !default;
|
|
25
|
+
$sar-index-bar-hint-bg-color: $sar-mask !default;
|
|
26
|
+
|
|
27
|
+
$sar-index-bar-hint-text-font-size: 24px !default;
|
|
28
|
+
$sar-index-bar-hint-text-color: $sar-white !default;
|
|
29
|
+
|
|
30
|
+
// 暗黑模式
|
|
31
|
+
$sar-index-bar-anchor-dark-color: $sar-dark-tertiary-color !default;
|
|
32
|
+
$sar-index-bar-anchor-dark-bg-color: $sar-dark-body-bg-color !default;
|
|
33
|
+
$sar-index-bar-nav-dark-bg-color: $sar-dark-body-bg-color !default;
|
|
34
|
+
$sar-index-bar-nav-item-dark-color: $sar-dark-body-color !default;
|
|
35
|
+
// #endvariables
|
|
36
|
+
|
|
37
|
+
@include bem(index-bar) {
|
|
38
|
+
@include b() {
|
|
39
|
+
@include universal;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@include e(scroll-view) {
|
|
43
|
+
height: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include e(nav-container) {
|
|
47
|
+
@include universal;
|
|
48
|
+
position: absolute;
|
|
49
|
+
right: $sar-index-bar-nav-wrapper-right;
|
|
50
|
+
top: 0;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
z-index: 10;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
@include ifweb {
|
|
55
|
+
touch-action: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@include e(nav-wrapper) {
|
|
60
|
+
@include universal;
|
|
61
|
+
padding: $sar-index-bar-nav-padding;
|
|
62
|
+
background-color: $sar-index-bar-nav-bg-color;
|
|
63
|
+
border-radius: $sar-rounded-full;
|
|
64
|
+
@include ifweb {
|
|
65
|
+
touch-action: none;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@include e(nav) {
|
|
70
|
+
@include universal;
|
|
71
|
+
|
|
72
|
+
@include ifweb {
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@include e(nav-item) {
|
|
78
|
+
@include universal;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
width: $sar-index-bar-nav-item-size;
|
|
82
|
+
height: $sar-index-bar-nav-item-size;
|
|
83
|
+
border-radius: $sar-rounded-full;
|
|
84
|
+
font-size: $sar-index-bar-nav-item-font-size;
|
|
85
|
+
color: $sar-index-bar-nav-item-color;
|
|
86
|
+
|
|
87
|
+
@include m(active) {
|
|
88
|
+
color: $sar-index-bar-nav-item-active-color;
|
|
89
|
+
background-color: $sar-index-bar-nav-item-active-bg-color;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include e(hint) {
|
|
94
|
+
@include universal;
|
|
95
|
+
position: absolute;
|
|
96
|
+
width: $sar-index-bar-hint-width;
|
|
97
|
+
height: $sar-index-bar-hint-height;
|
|
98
|
+
right: $sar-index-bar-hint-right;
|
|
99
|
+
top: 0;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
margin-top: math.div(-$sar-index-bar-hint-height, 2);
|
|
104
|
+
border-radius: $sar-index-bar-hint-border-radius;
|
|
105
|
+
background-color: $sar-index-bar-hint-bg-color;
|
|
106
|
+
transform: rotate(-45deg);
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@include e(hint-text) {
|
|
111
|
+
@include universal;
|
|
112
|
+
font-size: $sar-index-bar-hint-text-font-size;
|
|
113
|
+
line-height: $sar-index-bar-hint-text-font-size * $sar-leading-none;
|
|
114
|
+
font-weight: $sar-font-bold;
|
|
115
|
+
transform: rotate(45deg);
|
|
116
|
+
color: $sar-index-bar-hint-text-color;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@include e(item-anchor) {
|
|
120
|
+
@include universal;
|
|
121
|
+
@include sticky;
|
|
122
|
+
top: 0;
|
|
123
|
+
z-index: 1;
|
|
124
|
+
padding: $sar-index-bar-anchor-padding;
|
|
125
|
+
font-size: $sar-index-bar-anchor-font-size;
|
|
126
|
+
line-height: $sar-index-bar-anchor-line-height;
|
|
127
|
+
color: $sar-index-bar-anchor-color;
|
|
128
|
+
background-color: $sar-index-bar-anchor-bg-color;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@include e(item-content) {
|
|
132
|
+
@include universal;
|
|
133
|
+
z-index: 0;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@include theme(dark) {
|
|
138
|
+
@include bem(index-bar) {
|
|
139
|
+
@include e(item-anchor) {
|
|
140
|
+
color: $sar-index-bar-anchor-dark-color;
|
|
141
|
+
background-color: $sar-index-bar-anchor-dark-bg-color;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@include e(nav-wrapper) {
|
|
145
|
+
@include universal;
|
|
146
|
+
background-color: $sar-index-bar-nav-dark-bg-color;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@include e(nav-item) {
|
|
150
|
+
color: $sar-index-bar-nav-item-dark-color;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/index.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import './components.scss';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ITouchEvent, InputProps as TaroInputProps, TextareaProps } from '@tarojs/components';
|
|
3
|
+
import { BaseProps } from '../base';
|
|
4
|
+
interface InputBaseProps extends BaseProps {
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChange?: (value: string) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
showCount?: boolean;
|
|
12
|
+
count?: (currentCount: number, maxLength: number) => ReactNode;
|
|
13
|
+
autoHeight?: boolean;
|
|
14
|
+
borderless?: boolean;
|
|
15
|
+
inlaid?: boolean;
|
|
16
|
+
prepend?: ReactNode;
|
|
17
|
+
append?: ReactNode;
|
|
18
|
+
addon?: ReactNode;
|
|
19
|
+
clearable?: boolean;
|
|
20
|
+
showClearOnlyFocus?: boolean;
|
|
21
|
+
clear?: ReactNode;
|
|
22
|
+
onClear?: (value: '') => void;
|
|
23
|
+
onClick?: (event: ITouchEvent) => void;
|
|
24
|
+
focused?: boolean;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
}
|
|
27
|
+
interface InputInputProps extends InputBaseProps, Omit<TaroInputProps, 'style' | 'type' | 'ref'> {
|
|
28
|
+
type?: TaroInputProps['type'] | 'password';
|
|
29
|
+
confirmType?: TaroInputProps['confirmType'];
|
|
30
|
+
}
|
|
31
|
+
interface InputTextareaProps extends InputBaseProps, Omit<TextareaProps, 'style' | 'ref'> {
|
|
32
|
+
type: 'textarea';
|
|
33
|
+
confirmType?: TextareaProps['confirmType'];
|
|
34
|
+
}
|
|
35
|
+
export type InputProps = InputInputProps | InputTextareaProps;
|
|
36
|
+
export declare const Input: (props: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export default Input;
|