@ebscn/ui 0.0.10 → 1.0.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/README.md +44 -0
- package/cjs/components/alphabet-keyboard/alphabet-keyboard.css +143 -0
- package/cjs/components/alphabet-keyboard/alphabet-keyboard.d.ts +11 -0
- package/cjs/components/alphabet-keyboard/alphabet-keyboard.js +139 -0
- package/cjs/components/alphabet-keyboard/index.d.ts +4 -0
- package/cjs/components/alphabet-keyboard/index.js +9 -0
- package/cjs/components/button/button.css +152 -0
- package/cjs/components/button/button.d.ts +40 -0
- package/cjs/components/button/button.js +215 -0
- package/cjs/components/button/index.d.ts +4 -0
- package/cjs/components/button/index.js +9 -0
- package/cjs/components/card/card.css +37 -0
- package/cjs/components/card/card.d.ts +17 -0
- package/cjs/components/card/card.js +40 -0
- package/cjs/components/card/index.d.ts +4 -0
- package/cjs/components/card/index.js +10 -0
- package/cjs/components/checkbox/checkbox.css +92 -0
- package/cjs/components/checkbox/checkbox.d.ts +44 -0
- package/cjs/components/checkbox/checkbox.js +106 -0
- package/cjs/components/checkbox/group-context.d.ts +8 -0
- package/cjs/components/checkbox/group-context.js +8 -0
- package/cjs/components/checkbox/group.d.ts +10 -0
- package/cjs/components/checkbox/group.js +48 -0
- package/cjs/components/checkbox/index.d.ts +26 -0
- package/cjs/components/checkbox/index.js +14 -0
- package/cjs/components/checkbox/native-input.d.ts +10 -0
- package/cjs/components/checkbox/native-input.js +38 -0
- package/cjs/components/grid/grid.css +15 -0
- package/cjs/components/grid/grid.d.ts +15 -0
- package/cjs/components/grid/grid.js +45 -0
- package/cjs/components/grid/index.d.ts +7 -0
- package/cjs/components/grid/index.js +12 -0
- package/cjs/components/icons/check-icon.d.ts +4 -0
- package/cjs/components/icons/check-icon.js +30 -0
- package/cjs/components/icons/check-only-icon.d.ts +4 -0
- package/cjs/components/icons/check-only-icon.js +21 -0
- package/cjs/components/icons/clear-icon.d.ts +4 -0
- package/cjs/components/icons/clear-icon.js +41 -0
- package/cjs/components/icons/indeterminate-icon.d.ts +4 -0
- package/cjs/components/icons/indeterminate-icon.js +29 -0
- package/cjs/components/icons/index.d.ts +8 -0
- package/cjs/components/icons/index.js +62 -0
- package/cjs/components/icons/loading-icon.d.ts +4 -0
- package/cjs/components/icons/loading-icon.js +89 -0
- package/cjs/components/icons/search-icon.d.ts +4 -0
- package/cjs/components/icons/search-icon.js +43 -0
- package/cjs/components/icons/spin-icon.d.ts +4 -0
- package/cjs/components/icons/spin-icon.js +32 -0
- package/cjs/components/icons/uncheck-icon.d.ts +4 -0
- package/cjs/components/icons/uncheck-icon.js +26 -0
- package/cjs/components/imageViewer/imageViewer.d.ts +4 -0
- package/cjs/components/imageViewer/imageViewer.js +35 -0
- package/cjs/components/imageViewer/index.js +9 -0
- package/cjs/components/marketTag/index.d.ts +4 -0
- package/cjs/components/marketTag/index.js +9 -0
- package/cjs/components/marketTag/marketTag.css +14 -0
- package/cjs/components/marketTag/marketTag.d.ts +11 -0
- package/cjs/components/marketTag/marketTag.js +27 -0
- package/cjs/components/number-keyboard/index.d.ts +4 -0
- package/cjs/components/number-keyboard/index.js +9 -0
- package/cjs/components/number-keyboard/number-keyboard.css +77 -0
- package/cjs/components/number-keyboard/number-keyboard.d.ts +13 -0
- package/cjs/components/number-keyboard/number-keyboard.js +93 -0
- package/cjs/components/pdfLink/index.d.ts +3 -0
- package/cjs/components/pdfLink/index.js +10 -0
- package/cjs/components/pdfLink/pdfLink.css +11 -0
- package/cjs/components/pdfLink/pdfLink.d.ts +8 -0
- package/cjs/components/pdfLink/pdfLink.js +102 -0
- package/cjs/components/protocol/index.d.ts +3 -0
- package/cjs/components/protocol/index.js +10 -0
- package/cjs/components/protocol/protocol.css +46 -0
- package/cjs/components/protocol/protocol.d.ts +15 -0
- package/cjs/components/protocol/protocol.js +120 -0
- package/cjs/components/radio/group-context.d.ts +8 -0
- package/cjs/components/radio/group-context.js +8 -0
- package/cjs/components/radio/group.d.ts +10 -0
- package/cjs/components/radio/group.js +43 -0
- package/cjs/components/radio/index.d.ts +8 -0
- package/cjs/components/radio/index.js +13 -0
- package/cjs/components/radio/radio.css +92 -0
- package/cjs/components/radio/radio.d.ts +19 -0
- package/cjs/components/radio/radio.js +92 -0
- package/cjs/components/search/index.d.ts +3 -0
- package/cjs/components/search/index.js +10 -0
- package/cjs/components/search/search.css +53 -0
- package/cjs/components/search/search.d.ts +15 -0
- package/cjs/components/search/search.js +110 -0
- package/cjs/components/stock-count-keyboard/index.d.ts +4 -0
- package/cjs/components/stock-count-keyboard/index.js +9 -0
- package/cjs/components/stock-count-keyboard/stock-count-keyboard.css +74 -0
- package/cjs/components/stock-count-keyboard/stock-count-keyboard.d.ts +9 -0
- package/cjs/components/stock-count-keyboard/stock-count-keyboard.js +82 -0
- package/cjs/components/stock-keyboard/index.d.ts +4 -0
- package/cjs/components/stock-keyboard/index.js +9 -0
- package/cjs/components/stock-keyboard/stock-keyboard.css +111 -0
- package/cjs/components/stock-keyboard/stock-keyboard.d.ts +12 -0
- package/cjs/components/stock-keyboard/stock-keyboard.js +107 -0
- package/cjs/components/switch/index.d.ts +4 -0
- package/cjs/components/switch/index.js +10 -0
- package/cjs/components/switch/switch.css +104 -0
- package/cjs/components/switch/switch.d.ts +16 -0
- package/cjs/components/switch/switch.js +213 -0
- package/cjs/components/toastLoading/index.d.ts +4 -0
- package/cjs/components/toastLoading/index.js +9 -0
- package/cjs/components/toastLoading/toastLoading.css +27 -0
- package/cjs/components/toastLoading/toastLoading.d.ts +7 -0
- package/cjs/components/toastLoading/toastLoading.js +35 -0
- package/cjs/global/global.css +289 -0
- package/cjs/global/index.d.ts +1 -0
- package/cjs/global/index.js +11 -0
- package/cjs/global/theme-dark.css +18 -0
- package/cjs/global/theme-default.css +48 -0
- package/cjs/index.d.ts +18 -0
- package/cjs/index.js +149 -0
- package/cjs/utils/attach-properties-to-component.d.ts +1 -0
- package/cjs/utils/attach-properties-to-component.js +15 -0
- package/cjs/utils/bound.d.ts +1 -0
- package/cjs/utils/bound.js +16 -0
- package/cjs/utils/can-use-dom.d.ts +1 -0
- package/cjs/utils/can-use-dom.js +7 -0
- package/cjs/utils/convert-px.d.ts +1 -0
- package/cjs/utils/convert-px.js +33 -0
- package/cjs/utils/create-icon-component.d.ts +2 -0
- package/cjs/utils/create-icon-component.js +12 -0
- package/cjs/utils/dev-log.d.ts +3 -0
- package/cjs/utils/dev-log.js +45 -0
- package/cjs/utils/generate-int-array.d.ts +1 -0
- package/cjs/utils/generate-int-array.js +13 -0
- package/cjs/utils/get-container.d.ts +2 -0
- package/cjs/utils/get-container.js +10 -0
- package/cjs/utils/get-scroll-parent.d.ts +3 -0
- package/cjs/utils/get-scroll-parent.js +30 -0
- package/cjs/utils/is-dev.d.ts +1 -0
- package/cjs/utils/is-dev.js +7 -0
- package/cjs/utils/is-node-with-content.d.ts +4 -0
- package/cjs/utils/is-node-with-content.js +9 -0
- package/cjs/utils/matrix.d.ts +10 -0
- package/cjs/utils/matrix.js +47 -0
- package/cjs/utils/measure-css-length.d.ts +1 -0
- package/cjs/utils/measure-css-length.js +29 -0
- package/cjs/utils/merge-locale.d.ts +1 -0
- package/cjs/utils/merge-locale.js +21 -0
- package/cjs/utils/native-props.d.ts +8 -0
- package/cjs/utils/native-props.js +38 -0
- package/cjs/utils/nearest.d.ts +1 -0
- package/cjs/utils/nearest.js +11 -0
- package/cjs/utils/noop.d.ts +1 -0
- package/cjs/utils/noop.js +8 -0
- package/cjs/utils/reduce-and-restore-motion.d.ts +4 -0
- package/cjs/utils/reduce-and-restore-motion.js +44 -0
- package/cjs/utils/render-imperatively.d.ts +13 -0
- package/cjs/utils/render-imperatively.js +207 -0
- package/cjs/utils/render-to-body.d.ts +2 -0
- package/cjs/utils/render-to-body.js +19 -0
- package/cjs/utils/render-to-container.d.ts +3 -0
- package/cjs/utils/render-to-container.js +16 -0
- package/cjs/utils/render.d.ts +9 -0
- package/cjs/utils/render.js +196 -0
- package/cjs/utils/replace-message.d.ts +1 -0
- package/cjs/utils/replace-message.js +13 -0
- package/cjs/utils/rubberband.d.ts +2 -0
- package/cjs/utils/rubberband.js +20 -0
- package/cjs/utils/should-render.d.ts +10 -0
- package/cjs/utils/should-render.js +20 -0
- package/cjs/utils/shuffle.d.ts +6 -0
- package/cjs/utils/shuffle.js +29 -0
- package/cjs/utils/sleep.d.ts +1 -0
- package/cjs/utils/sleep.js +12 -0
- package/cjs/utils/supports-passive.d.ts +1 -0
- package/cjs/utils/supports-passive.js +19 -0
- package/cjs/utils/to-css-length.d.ts +1 -0
- package/cjs/utils/to-css-length.js +9 -0
- package/cjs/utils/traverse-react-node.d.ts +2 -0
- package/cjs/utils/traverse-react-node.js +23 -0
- package/cjs/utils/tree.d.ts +1 -0
- package/cjs/utils/tree.js +24 -0
- package/cjs/utils/undefined-fallback.d.ts +3 -0
- package/cjs/utils/undefined-fallback.js +17 -0
- package/cjs/utils/use-drag-and-pinch.d.ts +1 -0
- package/cjs/utils/use-drag-and-pinch.js +8 -0
- package/cjs/utils/use-initialized.d.ts +1 -0
- package/cjs/utils/use-initialized.js +14 -0
- package/cjs/utils/use-inner-visible.d.ts +1 -0
- package/cjs/utils/use-inner-visible.js +17 -0
- package/cjs/utils/use-isomorphic-update-layout-effect.d.ts +2 -0
- package/cjs/utils/use-isomorphic-update-layout-effect.js +8 -0
- package/cjs/utils/use-lock-scroll.d.ts +2 -0
- package/cjs/utils/use-lock-scroll.js +84 -0
- package/cjs/utils/use-mutation-effect.d.ts +2 -0
- package/cjs/utils/use-mutation-effect.js +21 -0
- package/cjs/utils/use-props-value.d.ts +8 -0
- package/cjs/utils/use-props-value.js +30 -0
- package/cjs/utils/use-ref-state.d.ts +2 -0
- package/cjs/utils/use-ref-state.js +17 -0
- package/cjs/utils/use-resize-effect.d.ts +2 -0
- package/cjs/utils/use-resize-effect.js +29 -0
- package/cjs/utils/use-tab-list-scroll.d.ts +5 -0
- package/cjs/utils/use-tab-list-scroll.js +67 -0
- package/cjs/utils/use-touch.d.ts +17 -0
- package/cjs/utils/use-touch.js +69 -0
- package/cjs/utils/validate.d.ts +8 -0
- package/cjs/utils/validate.js +39 -0
- package/cjs/utils/with-cache.d.ts +1 -0
- package/cjs/utils/with-cache.js +15 -0
- package/cjs/utils/with-default-props.d.ts +2 -0
- package/cjs/utils/with-default-props.js +32 -0
- package/cjs/utils/with-func-props.d.ts +5 -0
- package/cjs/utils/with-func-props.js +38 -0
- package/cjs/utils/with-stop-propagation.d.ts +4 -0
- package/cjs/utils/with-stop-propagation.js +37 -0
- package/es/components/alphabet-keyboard/alphabet-keyboard.css +143 -0
- package/es/components/alphabet-keyboard/alphabet-keyboard.d.ts +11 -0
- package/es/components/alphabet-keyboard/alphabet-keyboard.js +132 -0
- package/es/components/alphabet-keyboard/index.d.ts +4 -0
- package/es/components/alphabet-keyboard/index.js +3 -0
- package/es/components/button/button.css +152 -0
- package/es/components/button/button.d.ts +40 -0
- package/es/components/button/button.js +206 -0
- package/es/components/button/index.d.ts +4 -0
- package/es/components/button/index.js +3 -0
- package/es/components/card/card.css +37 -0
- package/es/components/card/card.d.ts +17 -0
- package/es/components/card/card.js +33 -0
- package/es/components/card/index.d.ts +4 -0
- package/es/components/card/index.js +3 -0
- package/es/components/checkbox/checkbox.css +92 -0
- package/es/components/checkbox/checkbox.d.ts +44 -0
- package/es/components/checkbox/checkbox.js +97 -0
- package/es/components/checkbox/group-context.d.ts +8 -0
- package/es/components/checkbox/group-context.js +2 -0
- package/es/components/checkbox/group.d.ts +10 -0
- package/es/components/checkbox/group.js +40 -0
- package/es/components/checkbox/index.d.ts +26 -0
- package/es/components/checkbox/index.js +7 -0
- package/es/components/checkbox/native-input.d.ts +10 -0
- package/es/components/checkbox/native-input.js +29 -0
- package/es/components/grid/grid.css +15 -0
- package/es/components/grid/grid.d.ts +15 -0
- package/es/components/grid/grid.js +36 -0
- package/es/components/grid/index.d.ts +7 -0
- package/es/components/grid/index.js +6 -0
- package/es/components/icons/check-icon.d.ts +4 -0
- package/es/components/icons/check-icon.js +22 -0
- package/es/components/icons/check-only-icon.d.ts +4 -0
- package/es/components/icons/check-only-icon.js +13 -0
- package/es/components/icons/clear-icon.d.ts +4 -0
- package/es/components/icons/clear-icon.js +33 -0
- package/es/components/icons/indeterminate-icon.d.ts +4 -0
- package/es/components/icons/indeterminate-icon.js +21 -0
- package/es/components/icons/index.d.ts +8 -0
- package/es/components/icons/index.js +8 -0
- package/es/components/icons/loading-icon.d.ts +4 -0
- package/es/components/icons/loading-icon.js +81 -0
- package/es/components/icons/search-icon.d.ts +4 -0
- package/es/components/icons/search-icon.js +35 -0
- package/es/components/icons/spin-icon.d.ts +4 -0
- package/es/components/icons/spin-icon.js +24 -0
- package/es/components/icons/uncheck-icon.d.ts +4 -0
- package/es/components/icons/uncheck-icon.js +18 -0
- package/es/components/imageViewer/imageViewer.d.ts +4 -0
- package/es/components/imageViewer/imageViewer.js +28 -0
- package/es/components/imageViewer/index.d.ts +7 -0
- package/es/components/imageViewer/index.js +2 -0
- package/es/components/marketTag/index.d.ts +4 -0
- package/es/components/marketTag/index.js +3 -0
- package/es/components/marketTag/marketTag.css +14 -0
- package/es/components/marketTag/marketTag.d.ts +11 -0
- package/es/components/marketTag/marketTag.js +19 -0
- package/es/components/number-keyboard/index.d.ts +4 -0
- package/es/components/number-keyboard/index.js +3 -0
- package/es/components/number-keyboard/number-keyboard.css +77 -0
- package/es/components/number-keyboard/number-keyboard.d.ts +13 -0
- package/es/components/number-keyboard/number-keyboard.js +85 -0
- package/es/components/pdfLink/index.d.ts +3 -0
- package/es/components/pdfLink/index.js +3 -0
- package/es/components/pdfLink/pdfLink.css +11 -0
- package/es/components/pdfLink/pdfLink.d.ts +8 -0
- package/es/components/pdfLink/pdfLink.js +94 -0
- package/es/components/protocol/index.d.ts +3 -0
- package/es/components/protocol/index.js +3 -0
- package/es/components/protocol/protocol.css +46 -0
- package/es/components/protocol/protocol.d.ts +15 -0
- package/es/components/protocol/protocol.js +112 -0
- package/es/components/radio/group-context.d.ts +8 -0
- package/es/components/radio/group-context.js +2 -0
- package/es/components/radio/group.d.ts +10 -0
- package/es/components/radio/group.js +35 -0
- package/es/components/radio/index.d.ts +8 -0
- package/es/components/radio/index.js +7 -0
- package/es/components/radio/radio.css +92 -0
- package/es/components/radio/radio.d.ts +19 -0
- package/es/components/radio/radio.js +82 -0
- package/es/components/search/index.d.ts +3 -0
- package/es/components/search/index.js +3 -0
- package/es/components/search/search.css +53 -0
- package/es/components/search/search.d.ts +15 -0
- package/es/components/search/search.js +102 -0
- package/es/components/stock-count-keyboard/index.d.ts +4 -0
- package/es/components/stock-count-keyboard/index.js +3 -0
- package/es/components/stock-count-keyboard/stock-count-keyboard.css +74 -0
- package/es/components/stock-count-keyboard/stock-count-keyboard.d.ts +9 -0
- package/es/components/stock-count-keyboard/stock-count-keyboard.js +74 -0
- package/es/components/stock-keyboard/index.d.ts +4 -0
- package/es/components/stock-keyboard/index.js +3 -0
- package/es/components/stock-keyboard/stock-keyboard.css +111 -0
- package/es/components/stock-keyboard/stock-keyboard.d.ts +12 -0
- package/es/components/stock-keyboard/stock-keyboard.js +99 -0
- package/es/components/switch/index.d.ts +4 -0
- package/es/components/switch/index.js +3 -0
- package/es/components/switch/switch.css +104 -0
- package/es/components/switch/switch.d.ts +16 -0
- package/es/components/switch/switch.js +204 -0
- package/es/components/toastLoading/index.d.ts +4 -0
- package/es/components/toastLoading/index.js +3 -0
- package/es/components/toastLoading/toastLoading.css +27 -0
- package/es/components/toastLoading/toastLoading.d.ts +7 -0
- package/es/components/toastLoading/toastLoading.js +27 -0
- package/es/global/global.css +289 -0
- package/es/global/index.d.ts +1 -0
- package/es/global/index.js +9 -0
- package/es/global/theme-dark.css +18 -0
- package/es/global/theme-default.css +48 -0
- package/es/index.d.ts +18 -0
- package/es/index.js +18 -0
- package/es/utils/attach-properties-to-component.d.ts +1 -0
- package/es/utils/attach-properties-to-component.js +9 -0
- package/es/utils/bound.d.ts +1 -0
- package/es/utils/bound.js +10 -0
- package/es/utils/can-use-dom.d.ts +1 -0
- package/es/utils/can-use-dom.js +1 -0
- package/es/utils/convert-px.d.ts +1 -0
- package/es/utils/convert-px.js +27 -0
- package/es/utils/create-icon-component.d.ts +2 -0
- package/es/utils/create-icon-component.js +6 -0
- package/es/utils/dev-log.d.ts +3 -0
- package/es/utils/dev-log.js +37 -0
- package/es/utils/generate-int-array.d.ts +1 -0
- package/es/utils/generate-int-array.js +7 -0
- package/es/utils/get-container.d.ts +2 -0
- package/es/utils/get-container.js +4 -0
- package/es/utils/get-scroll-parent.d.ts +3 -0
- package/es/utils/get-scroll-parent.js +24 -0
- package/es/utils/is-dev.d.ts +1 -0
- package/es/utils/is-dev.js +1 -0
- package/es/utils/is-node-with-content.d.ts +4 -0
- package/es/utils/is-node-with-content.js +3 -0
- package/es/utils/matrix.d.ts +10 -0
- package/es/utils/matrix.js +32 -0
- package/es/utils/measure-css-length.d.ts +1 -0
- package/es/utils/measure-css-length.js +23 -0
- package/es/utils/merge-locale.d.ts +1 -0
- package/es/utils/merge-locale.js +15 -0
- package/es/utils/native-props.d.ts +8 -0
- package/es/utils/native-props.js +31 -0
- package/es/utils/nearest.d.ts +1 -0
- package/es/utils/nearest.js +5 -0
- package/es/utils/noop.d.ts +1 -0
- package/es/utils/noop.js +1 -0
- package/es/utils/reduce-and-restore-motion.d.ts +4 -0
- package/es/utils/reduce-and-restore-motion.js +35 -0
- package/es/utils/render-imperatively.d.ts +13 -0
- package/es/utils/render-imperatively.js +199 -0
- package/es/utils/render-to-body.d.ts +2 -0
- package/es/utils/render-to-body.js +13 -0
- package/es/utils/render-to-container.d.ts +3 -0
- package/es/utils/render-to-container.js +10 -0
- package/es/utils/render.d.ts +9 -0
- package/es/utils/render.js +187 -0
- package/es/utils/replace-message.d.ts +1 -0
- package/es/utils/replace-message.js +7 -0
- package/es/utils/rubberband.d.ts +2 -0
- package/es/utils/rubberband.js +13 -0
- package/es/utils/should-render.d.ts +10 -0
- package/es/utils/should-render.js +12 -0
- package/es/utils/shuffle.d.ts +6 -0
- package/es/utils/shuffle.js +23 -0
- package/es/utils/sleep.d.ts +1 -0
- package/es/utils/sleep.js +5 -0
- package/es/utils/supports-passive.d.ts +1 -0
- package/es/utils/supports-passive.js +13 -0
- package/es/utils/to-css-length.d.ts +1 -0
- package/es/utils/to-css-length.js +3 -0
- package/es/utils/traverse-react-node.d.ts +2 -0
- package/es/utils/traverse-react-node.js +16 -0
- package/es/utils/tree.d.ts +1 -0
- package/es/utils/tree.js +18 -0
- package/es/utils/undefined-fallback.d.ts +3 -0
- package/es/utils/undefined-fallback.js +11 -0
- package/es/utils/use-drag-and-pinch.d.ts +1 -0
- package/es/utils/use-drag-and-pinch.js +2 -0
- package/es/utils/use-initialized.d.ts +1 -0
- package/es/utils/use-initialized.js +8 -0
- package/es/utils/use-inner-visible.d.ts +1 -0
- package/es/utils/use-inner-visible.js +11 -0
- package/es/utils/use-isomorphic-update-layout-effect.d.ts +2 -0
- package/es/utils/use-isomorphic-update-layout-effect.js +2 -0
- package/es/utils/use-lock-scroll.d.ts +2 -0
- package/es/utils/use-lock-scroll.js +78 -0
- package/es/utils/use-mutation-effect.d.ts +2 -0
- package/es/utils/use-mutation-effect.js +15 -0
- package/es/utils/use-props-value.d.ts +8 -0
- package/es/utils/use-props-value.js +24 -0
- package/es/utils/use-ref-state.d.ts +2 -0
- package/es/utils/use-ref-state.js +11 -0
- package/es/utils/use-resize-effect.d.ts +2 -0
- package/es/utils/use-resize-effect.js +23 -0
- package/es/utils/use-tab-list-scroll.d.ts +5 -0
- package/es/utils/use-tab-list-scroll.js +60 -0
- package/es/utils/use-touch.d.ts +17 -0
- package/es/utils/use-touch.js +63 -0
- package/es/utils/validate.d.ts +8 -0
- package/es/utils/validate.js +26 -0
- package/es/utils/with-cache.d.ts +1 -0
- package/es/utils/with-cache.js +9 -0
- package/es/utils/with-default-props.d.ts +2 -0
- package/es/utils/with-default-props.js +25 -0
- package/es/utils/with-func-props.d.ts +5 -0
- package/es/utils/with-func-props.js +32 -0
- package/es/utils/with-stop-propagation.d.ts +4 -0
- package/es/utils/with-stop-propagation.js +30 -0
- package/package.json +48 -20
- package/__vendor/__vendor.js +0 -1
- package/handRead/handRead.d.ts +0 -6
- package/handRead/handRead.js +0 -302
- package/handRead/index.d.ts +0 -25
- package/handRead/index.js +0 -11
- package/imageViewer/imageViewer.d.ts +0 -3
- package/imageViewer/imageViewer.js +0 -28
- package/imageViewer/index.js +0 -8
- package/index.d.ts +0 -6
- package/index.js +0 -14
- package/keyboard/index.d.ts +0 -13
- package/keyboard/index.js +0 -7
- package/keyboard/keyboard.d.ts +0 -2
- package/keyboard/keyboard.js +0 -87
- package/style.css +0 -1
- package/utils/isEqual.d.ts +0 -5
- /package/{imageViewer → cjs/components/imageViewer}/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function bound(position: number, min: number | undefined, max: number | undefined): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const canUseDom: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var canUseDom = !!(typeof window !== 'undefined' && typeof document !== 'undefined' && window.document && window.document.createElement);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function convertPx(px: number): number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { canUseDom } from './can-use-dom';
|
|
2
|
+
import { isDev } from './is-dev';
|
|
3
|
+
import { devError } from './dev-log';
|
|
4
|
+
var tenPxTester = null;
|
|
5
|
+
var tester = null;
|
|
6
|
+
if (canUseDom) {
|
|
7
|
+
tenPxTester = document.createElement('div');
|
|
8
|
+
tenPxTester.className = 'adm-px-tester';
|
|
9
|
+
tenPxTester.style.setProperty('--size', '10');
|
|
10
|
+
document.body.appendChild(tenPxTester);
|
|
11
|
+
tester = document.createElement('div');
|
|
12
|
+
tester.className = 'adm-px-tester';
|
|
13
|
+
document.body.appendChild(tester);
|
|
14
|
+
if (isDev) {
|
|
15
|
+
if (window.getComputedStyle(tester).position !== 'fixed') {
|
|
16
|
+
devError('Global', 'The px tester is not rendering properly. Please make sure you have imported `antd-mobile/es/global`.');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function convertPx(px) {
|
|
21
|
+
if (tenPxTester === null || tester === null) return px;
|
|
22
|
+
if (tenPxTester.getBoundingClientRect().height === 10) {
|
|
23
|
+
return px;
|
|
24
|
+
}
|
|
25
|
+
tester.style.setProperty('--size', px.toString());
|
|
26
|
+
return tester.getBoundingClientRect().height;
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isDev } from './is-dev';
|
|
2
|
+
export function devWarning(component, message) {
|
|
3
|
+
if (isDev) {
|
|
4
|
+
console.warn("[antd-mobile: ".concat(component, "] ").concat(message));
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export function devError(component, message) {
|
|
8
|
+
if (isDev) {
|
|
9
|
+
console.error("[antd-mobile: ".concat(component, "] ").concat(message));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
var infoBox;
|
|
13
|
+
export function devPrint() {
|
|
14
|
+
var message = [];
|
|
15
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
16
|
+
message[_i] = arguments[_i];
|
|
17
|
+
}
|
|
18
|
+
if (isDev) {
|
|
19
|
+
if (!infoBox) {
|
|
20
|
+
infoBox = document.createElement('textarea');
|
|
21
|
+
document.body.append(infoBox);
|
|
22
|
+
infoBox.style.position = 'fixed';
|
|
23
|
+
infoBox.style.top = '0';
|
|
24
|
+
infoBox.style.left = '0';
|
|
25
|
+
infoBox.style.width = '100vw';
|
|
26
|
+
infoBox.style.height = '100vh';
|
|
27
|
+
infoBox.style.zIndex = '999999';
|
|
28
|
+
infoBox.style.fontSize = '12px';
|
|
29
|
+
// infoBox.style.opacity = '0.85'
|
|
30
|
+
infoBox.style.pointerEvents = 'none';
|
|
31
|
+
infoBox.style.background = 'transparent';
|
|
32
|
+
infoBox.style.textShadow = '-1px -1px 0 #FFF, -1px 1px 0 #FFF, 1px -1px 0 #FFF, 1px 1px 0 #FFF';
|
|
33
|
+
}
|
|
34
|
+
infoBox.value = "".concat(infoBox.value, "\n").concat(message.join(' ')).trim();
|
|
35
|
+
infoBox.scrollTop = infoBox.scrollHeight;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateIntArray(from: number, to: number): number[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { canUseDom } from './can-use-dom';
|
|
2
|
+
var defaultRoot = canUseDom ? window : undefined;
|
|
3
|
+
var overflowStylePatterns = ['scroll', 'auto', 'overlay'];
|
|
4
|
+
function isElement(node) {
|
|
5
|
+
var ELEMENT_NODE_TYPE = 1;
|
|
6
|
+
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
7
|
+
}
|
|
8
|
+
export function getScrollParent(el, root) {
|
|
9
|
+
if (root === void 0) {
|
|
10
|
+
root = defaultRoot;
|
|
11
|
+
}
|
|
12
|
+
var node = el;
|
|
13
|
+
while (node && node !== root && isElement(node)) {
|
|
14
|
+
if (node === document.body) {
|
|
15
|
+
return root;
|
|
16
|
+
}
|
|
17
|
+
var overflowY = window.getComputedStyle(node).overflowY;
|
|
18
|
+
if (overflowStylePatterns.includes(overflowY) && node.scrollHeight > node.clientHeight) {
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
21
|
+
node = node.parentNode;
|
|
22
|
+
}
|
|
23
|
+
return root;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isDev: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var isDev = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Matrix = readonly [number, number, number, number, number, number];
|
|
2
|
+
export declare const create: () => Matrix;
|
|
3
|
+
export declare const getTranslateX: (m: Matrix) => number;
|
|
4
|
+
export declare const getTranslateY: (m: Matrix) => number;
|
|
5
|
+
export declare const getScaleX: (m: Matrix) => number;
|
|
6
|
+
export declare const getScaleY: (m: Matrix) => number;
|
|
7
|
+
export declare const translate: (m: Matrix, x: number, y: number) => Matrix;
|
|
8
|
+
export declare const scale: (m: Matrix, scaleX: number, scaleY?: number) => Matrix;
|
|
9
|
+
export declare const apply: (m: Matrix, [ox, oy]: [number, number]) => [number, number];
|
|
10
|
+
export declare const multiply: (m1: Matrix, m2: Matrix) => Matrix;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export var create = function () {
|
|
2
|
+
return [1, 0, 0, 1, 0, 0];
|
|
3
|
+
};
|
|
4
|
+
export var getTranslateX = function (m) {
|
|
5
|
+
return m[4];
|
|
6
|
+
};
|
|
7
|
+
export var getTranslateY = function (m) {
|
|
8
|
+
return m[5];
|
|
9
|
+
};
|
|
10
|
+
export var getScaleX = function (m) {
|
|
11
|
+
return m[0];
|
|
12
|
+
};
|
|
13
|
+
export var getScaleY = function (m) {
|
|
14
|
+
return m[3];
|
|
15
|
+
};
|
|
16
|
+
export var translate = function (m, x, y) {
|
|
17
|
+
return multiply([1, 0, 0, 1, x, y], m);
|
|
18
|
+
};
|
|
19
|
+
export var scale = function (m, scaleX, scaleY) {
|
|
20
|
+
if (scaleY === void 0) {
|
|
21
|
+
scaleY = scaleX;
|
|
22
|
+
}
|
|
23
|
+
return multiply([scaleX, 0, 0, scaleY, 0, 0], m);
|
|
24
|
+
};
|
|
25
|
+
export var apply = function (m, _a) {
|
|
26
|
+
var ox = _a[0],
|
|
27
|
+
oy = _a[1];
|
|
28
|
+
return [m[0] * ox + m[2] * oy + m[4], m[1] * ox + m[3] * oy + m[5]];
|
|
29
|
+
};
|
|
30
|
+
export var multiply = function (m1, m2) {
|
|
31
|
+
return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function measureCSSLength(raw: string | undefined | null): number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isDev } from './is-dev';
|
|
2
|
+
import { devError } from './dev-log';
|
|
3
|
+
export function measureCSSLength(raw) {
|
|
4
|
+
if (raw === null || raw === undefined || raw === '') {
|
|
5
|
+
if (isDev) {
|
|
6
|
+
devError('Global', 'Something went wrong when calculating CSS length. Please report an issue at https://github.com/ant-design/ant-design-mobile/issues/new/choose');
|
|
7
|
+
}
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
var withUnit = raw.trim();
|
|
11
|
+
if (withUnit.endsWith('px')) {
|
|
12
|
+
return parseFloat(withUnit);
|
|
13
|
+
} else if (withUnit.endsWith('rem')) {
|
|
14
|
+
return parseFloat(withUnit) * parseFloat(window.getComputedStyle(document.documentElement).fontSize);
|
|
15
|
+
} else if (withUnit.endsWith('vw')) {
|
|
16
|
+
return parseFloat(withUnit) * window.innerWidth / 100;
|
|
17
|
+
} else {
|
|
18
|
+
if (isDev) {
|
|
19
|
+
devError('Global', "You are using a not supported CSS unit in `".concat(raw, "`. Only `px` `rem` and `vw` are supported."));
|
|
20
|
+
}
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeLocale<T extends object, P extends object>(base: T, patch: P): T;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function mergeLocale(base, patch) {
|
|
2
|
+
function merge(a, b) {
|
|
3
|
+
if (typeof a !== 'object' || typeof b !== 'object' || Array.isArray(a) || Array.isArray(b)) {
|
|
4
|
+
return b !== undefined ? b : a;
|
|
5
|
+
}
|
|
6
|
+
var result = {};
|
|
7
|
+
for (var key in a) {
|
|
8
|
+
if (a.hasOwnProperty(key)) {
|
|
9
|
+
result[key] = merge(a[key], b[key]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
return merge(base, patch);
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { AriaAttributes } from 'react';
|
|
2
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
3
|
+
export type NativeProps<S extends string = never> = {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: CSSProperties & Partial<Record<S, string>>;
|
|
6
|
+
tabIndex?: number;
|
|
7
|
+
} & AriaAttributes;
|
|
8
|
+
export declare function withNativeProps<P extends NativeProps>(props: P, element: ReactElement): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
export function withNativeProps(props, element) {
|
|
14
|
+
var p = __assign({}, element.props);
|
|
15
|
+
if (props.className) {
|
|
16
|
+
p.className = classNames(element.props.className, props.className);
|
|
17
|
+
}
|
|
18
|
+
if (props.style) {
|
|
19
|
+
p.style = __assign(__assign({}, p.style), props.style);
|
|
20
|
+
}
|
|
21
|
+
if (props.tabIndex !== undefined) {
|
|
22
|
+
p.tabIndex = props.tabIndex;
|
|
23
|
+
}
|
|
24
|
+
for (var key in props) {
|
|
25
|
+
if (!props.hasOwnProperty(key)) continue;
|
|
26
|
+
if (key.startsWith('data-') || key.startsWith('aria-')) {
|
|
27
|
+
p[key] = props[key];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return React.cloneElement(element, p);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function nearest(arr: number[], target: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const noop: () => void;
|
package/es/utils/noop.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var noop = function () {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Globals } from '@react-spring/web';
|
|
2
|
+
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
3
|
+
var reduced = false;
|
|
4
|
+
var subscribers = new Set();
|
|
5
|
+
function notify() {
|
|
6
|
+
subscribers.forEach(function (subscriber) {
|
|
7
|
+
subscriber();
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export function reduceMotion() {
|
|
11
|
+
reduced = true;
|
|
12
|
+
notify();
|
|
13
|
+
Globals.assign({
|
|
14
|
+
skipAnimation: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function restoreMotion() {
|
|
18
|
+
reduced = false;
|
|
19
|
+
notify();
|
|
20
|
+
Globals.assign({
|
|
21
|
+
skipAnimation: false
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function isMotionReduced() {
|
|
25
|
+
return reduced;
|
|
26
|
+
}
|
|
27
|
+
function subscribe(onStoreChange) {
|
|
28
|
+
subscribers.add(onStoreChange);
|
|
29
|
+
return function () {
|
|
30
|
+
subscribers.delete(onStoreChange);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function useMotionReduced() {
|
|
34
|
+
return useSyncExternalStore(subscribe, isMotionReduced, isMotionReduced);
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
type ImperativeProps = {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
afterClose?: () => void;
|
|
6
|
+
};
|
|
7
|
+
type TargetElement = ReactElement<ImperativeProps>;
|
|
8
|
+
export type ImperativeHandler = {
|
|
9
|
+
close: () => void;
|
|
10
|
+
replace: (element: TargetElement) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function renderImperatively(element: TargetElement): ImperativeHandler;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
return t;
|
|
8
|
+
};
|
|
9
|
+
return __assign.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) {
|
|
13
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
14
|
+
resolve(value);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
18
|
+
function fulfilled(value) {
|
|
19
|
+
try {
|
|
20
|
+
step(generator.next(value));
|
|
21
|
+
} catch (e) {
|
|
22
|
+
reject(e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function rejected(value) {
|
|
26
|
+
try {
|
|
27
|
+
step(generator["throw"](value));
|
|
28
|
+
} catch (e) {
|
|
29
|
+
reject(e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function step(result) {
|
|
33
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
34
|
+
}
|
|
35
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var __generator = this && this.__generator || function (thisArg, body) {
|
|
39
|
+
var _ = {
|
|
40
|
+
label: 0,
|
|
41
|
+
sent: function () {
|
|
42
|
+
if (t[0] & 1) throw t[1];
|
|
43
|
+
return t[1];
|
|
44
|
+
},
|
|
45
|
+
trys: [],
|
|
46
|
+
ops: []
|
|
47
|
+
},
|
|
48
|
+
f,
|
|
49
|
+
y,
|
|
50
|
+
t,
|
|
51
|
+
g;
|
|
52
|
+
return g = {
|
|
53
|
+
next: verb(0),
|
|
54
|
+
"throw": verb(1),
|
|
55
|
+
"return": verb(2)
|
|
56
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
57
|
+
return this;
|
|
58
|
+
}), g;
|
|
59
|
+
function verb(n) {
|
|
60
|
+
return function (v) {
|
|
61
|
+
return step([n, v]);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function step(op) {
|
|
65
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
66
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
67
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
68
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
69
|
+
switch (op[0]) {
|
|
70
|
+
case 0:
|
|
71
|
+
case 1:
|
|
72
|
+
t = op;
|
|
73
|
+
break;
|
|
74
|
+
case 4:
|
|
75
|
+
_.label++;
|
|
76
|
+
return {
|
|
77
|
+
value: op[1],
|
|
78
|
+
done: false
|
|
79
|
+
};
|
|
80
|
+
case 5:
|
|
81
|
+
_.label++;
|
|
82
|
+
y = op[1];
|
|
83
|
+
op = [0];
|
|
84
|
+
continue;
|
|
85
|
+
case 7:
|
|
86
|
+
op = _.ops.pop();
|
|
87
|
+
_.trys.pop();
|
|
88
|
+
continue;
|
|
89
|
+
default:
|
|
90
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
91
|
+
_ = 0;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
95
|
+
_.label = op[1];
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
99
|
+
_.label = t[1];
|
|
100
|
+
t = op;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
if (t && _.label < t[2]) {
|
|
104
|
+
_.label = t[2];
|
|
105
|
+
_.ops.push(op);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
if (t[2]) _.ops.pop();
|
|
109
|
+
_.trys.pop();
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
op = body.call(thisArg, _);
|
|
113
|
+
} catch (e) {
|
|
114
|
+
op = [6, e];
|
|
115
|
+
y = 0;
|
|
116
|
+
} finally {
|
|
117
|
+
f = t = 0;
|
|
118
|
+
}
|
|
119
|
+
if (op[0] & 5) throw op[1];
|
|
120
|
+
return {
|
|
121
|
+
value: op[0] ? op[1] : void 0,
|
|
122
|
+
done: true
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
127
|
+
import { renderToBody } from './render-to-body';
|
|
128
|
+
export function renderImperatively(element) {
|
|
129
|
+
var _this = this;
|
|
130
|
+
var Wrapper = React.forwardRef(function (_, ref) {
|
|
131
|
+
var _a = useState(false),
|
|
132
|
+
visible = _a[0],
|
|
133
|
+
setVisible = _a[1];
|
|
134
|
+
var closedRef = useRef(false);
|
|
135
|
+
var _b = useState(element),
|
|
136
|
+
elementToRender = _b[0],
|
|
137
|
+
setElementToRender = _b[1];
|
|
138
|
+
var keyRef = useRef(0);
|
|
139
|
+
useEffect(function () {
|
|
140
|
+
if (!closedRef.current) {
|
|
141
|
+
setVisible(true);
|
|
142
|
+
} else {
|
|
143
|
+
afterClose();
|
|
144
|
+
}
|
|
145
|
+
}, []);
|
|
146
|
+
function onClose() {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
closedRef.current = true;
|
|
149
|
+
setVisible(false);
|
|
150
|
+
(_b = (_a = elementToRender.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
151
|
+
}
|
|
152
|
+
function afterClose() {
|
|
153
|
+
var _a, _b;
|
|
154
|
+
unmount();
|
|
155
|
+
(_b = (_a = elementToRender.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
156
|
+
}
|
|
157
|
+
useImperativeHandle(ref, function () {
|
|
158
|
+
return {
|
|
159
|
+
close: onClose,
|
|
160
|
+
replace: function (element) {
|
|
161
|
+
var _a, _b;
|
|
162
|
+
keyRef.current++;
|
|
163
|
+
(_b = (_a = elementToRender.props).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
164
|
+
setElementToRender(element);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
return React.cloneElement(elementToRender, __assign(__assign({}, elementToRender.props), {
|
|
169
|
+
key: keyRef.current,
|
|
170
|
+
visible: visible,
|
|
171
|
+
onClose: onClose,
|
|
172
|
+
afterClose: afterClose
|
|
173
|
+
}));
|
|
174
|
+
});
|
|
175
|
+
var wrapperRef = React.createRef();
|
|
176
|
+
var unmount = renderToBody(React.createElement(Wrapper, {
|
|
177
|
+
ref: wrapperRef
|
|
178
|
+
}));
|
|
179
|
+
return {
|
|
180
|
+
close: function () {
|
|
181
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
182
|
+
var _a;
|
|
183
|
+
return __generator(this, function (_b) {
|
|
184
|
+
if (!wrapperRef.current) {
|
|
185
|
+
// it means the wrapper is not mounted yet, call `unmount` directly
|
|
186
|
+
unmount();
|
|
187
|
+
} else {
|
|
188
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
189
|
+
}
|
|
190
|
+
return [2 /*return*/];
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
replace: function (element) {
|
|
195
|
+
var _a;
|
|
196
|
+
(_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.replace(element);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { render, unmount as reactUnmount } from './render';
|
|
2
|
+
export function renderToBody(element) {
|
|
3
|
+
var container = document.createElement('div');
|
|
4
|
+
document.body.appendChild(container);
|
|
5
|
+
function unmount() {
|
|
6
|
+
var unmountResult = reactUnmount(container);
|
|
7
|
+
if (unmountResult && container.parentNode) {
|
|
8
|
+
container.parentNode.removeChild(container);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
render(element, container);
|
|
12
|
+
return unmount;
|
|
13
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export type GetContainer = HTMLElement | (() => HTMLElement) | null;
|
|
3
|
+
export declare function renderToContainer(getContainer: GetContainer, node: ReactElement): ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createPortal } from 'react-dom';
|
|
2
|
+
import { resolveContainer } from './get-container';
|
|
3
|
+
import { canUseDom } from './can-use-dom';
|
|
4
|
+
export function renderToContainer(getContainer, node) {
|
|
5
|
+
if (canUseDom && getContainer) {
|
|
6
|
+
var container = resolveContainer(getContainer);
|
|
7
|
+
return createPortal(node, container);
|
|
8
|
+
}
|
|
9
|
+
return node;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { Root } from 'react-dom/client';
|
|
3
|
+
declare const MARK = "__antd_mobile_root__";
|
|
4
|
+
type ContainerType = (Element | DocumentFragment) & {
|
|
5
|
+
[MARK]?: Root;
|
|
6
|
+
};
|
|
7
|
+
export declare function render(node: ReactElement, container: ContainerType): void;
|
|
8
|
+
export declare function unmount(container: ContainerType): boolean | Promise<void>;
|
|
9
|
+
export {};
|