@alfalab/core-components-international-phone-input 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/Component-4cd3936b.d.ts +19 -0
- package/Component-63dec22f.d.ts +184 -0
- package/Component-8b2c2707.d.ts +71 -0
- package/Component-9211a437.d.ts +38 -0
- package/Component-bdb4c6b9.d.ts +12 -0
- package/Component-c76d6398.d.ts +5 -0
- package/Component-d078a845.d.ts +7 -0
- package/Component-dd8ca091.d.ts +72 -0
- package/Component-ebda875c.d.ts +12 -0
- package/Component.desktop-2e2b2125.d.ts +6 -0
- package/Component.desktop-785df74d.d.ts +6 -0
- package/Component.desktop-d078a845.d.ts +73 -0
- package/Component.desktop-d873d97d.d.ts +6 -0
- package/Component.desktop.d.ts +5 -0
- package/Component.desktop.js +47 -0
- package/Component.mobile-4cd3936b.d.ts +98 -0
- package/Component.mobile-755fbaa3.d.ts +6 -0
- package/Component.mobile-ade26e99.d.ts +41 -0
- package/Component.mobile-d7e9f69d.d.ts +6 -0
- package/Component.mobile-ebda875c.d.ts +6 -0
- package/Component.mobile-f1f15074.d.ts +34 -0
- package/Component.mobile.d.ts +5 -0
- package/Component.mobile.js +82 -0
- package/Component.modal.mobile-4cd3936b.d.ts +91 -0
- package/Component.modal.mobile-dd8ca091.d.ts +60 -0
- package/Component.responsive-785df74d.d.ts +26 -0
- package/Component.responsive.d.ts +46 -0
- package/Component.responsive.js +43 -0
- package/Context-bdb4c6b9.d.ts +4 -0
- package/ResponsiveContext-baf4875b.d.ts +5 -0
- package/components/base-international-phone-input/Component.d.ts +26 -0
- package/components/base-international-phone-input/Component.js +98 -0
- package/components/base-international-phone-input/index.css +5 -0
- package/components/base-international-phone-input/index.d.ts +1 -0
- package/components/base-international-phone-input/index.js +26 -0
- package/components/country-select/Component.d.ts +21 -0
- package/components/country-select/Component.js +60 -0
- package/components/country-select/index.css +47 -0
- package/components/country-select/index.d.ts +1 -0
- package/components/country-select/index.js +20 -0
- package/components/flag-icon/component.d.ts +16 -0
- package/components/flag-icon/component.js +27 -0
- package/components/flag-icon/flagSprite.d.ts +2 -0
- package/components/flag-icon/flagSprite.js +233 -0
- package/components/flag-icon/index.css +30 -0
- package/components/flag-icon/index.d.ts +1 -0
- package/components/flag-icon/index.js +12 -0
- package/components/select-field/component.d.ts +8 -0
- package/components/select-field/component.js +43 -0
- package/components/select-field/index.css +53 -0
- package/components/select-field/index.d.ts +1 -0
- package/components/select-field/index.js +18 -0
- package/consts-f777ba1a.d.ts +2 -0
- package/consts.d.ts +2 -0
- package/consts.js +7 -0
- package/cssm/Component-4cd3936b.d.ts +7 -0
- package/cssm/Component-8b2c2707.d.ts +71 -0
- package/cssm/Component-9211a437.d.ts +38 -0
- package/cssm/Component-96988a65.d.ts +9 -0
- package/cssm/Component-aed0af6e.d.ts +11 -0
- package/cssm/Component-bdb4c6b9.d.ts +12 -0
- package/cssm/Component-c76d6398.d.ts +5 -0
- package/cssm/Component-dd8ca091.d.ts +5 -0
- package/cssm/Component-ebda875c.d.ts +101 -0
- package/cssm/Component-f12ee135.d.ts +72 -0
- package/cssm/Component.desktop-2e2b2125.d.ts +6 -0
- package/cssm/Component.desktop-4cd3936b.d.ts +73 -0
- package/cssm/Component.desktop-785df74d.d.ts +6 -0
- package/cssm/Component.desktop-d873d97d.d.ts +6 -0
- package/cssm/Component.desktop-ebda875c.d.ts +18 -0
- package/cssm/Component.desktop.d.ts +5 -0
- package/cssm/Component.desktop.js +51 -0
- package/cssm/Component.mobile-755fbaa3.d.ts +6 -0
- package/cssm/Component.mobile-ade26e99.d.ts +41 -0
- package/cssm/Component.mobile-d7e9f69d.d.ts +6 -0
- package/cssm/Component.mobile-f1f15074.d.ts +34 -0
- package/cssm/Component.mobile.d.ts +5 -0
- package/cssm/Component.mobile.js +86 -0
- package/cssm/Component.responsive-d7e9f69d.d.ts +26 -0
- package/cssm/Component.responsive.d.ts +46 -0
- package/cssm/Component.responsive.js +47 -0
- package/cssm/Context-bdb4c6b9.d.ts +4 -0
- package/cssm/ResponsiveContext-baf4875b.d.ts +5 -0
- package/cssm/components/base-international-phone-input/Component.d.ts +26 -0
- package/cssm/components/base-international-phone-input/Component.js +100 -0
- package/cssm/components/base-international-phone-input/index.d.ts +1 -0
- package/cssm/components/base-international-phone-input/index.js +30 -0
- package/cssm/components/base-international-phone-input/index.module.css +4 -0
- package/cssm/components/country-select/Component.d.ts +21 -0
- package/cssm/components/country-select/Component.js +61 -0
- package/cssm/components/country-select/index.d.ts +1 -0
- package/cssm/components/country-select/index.js +23 -0
- package/cssm/components/country-select/index.module.css +47 -0
- package/cssm/components/flag-icon/component.d.ts +16 -0
- package/cssm/components/flag-icon/component.js +26 -0
- package/cssm/components/flag-icon/flagSprite.d.ts +2 -0
- package/cssm/components/flag-icon/flagSprite.js +233 -0
- package/cssm/components/flag-icon/index.d.ts +1 -0
- package/cssm/components/flag-icon/index.js +13 -0
- package/cssm/components/flag-icon/index.module.css +29 -0
- package/cssm/components/select-field/component.d.ts +8 -0
- package/cssm/components/select-field/component.js +43 -0
- package/cssm/components/select-field/index.d.ts +1 -0
- package/cssm/components/select-field/index.js +20 -0
- package/cssm/components/select-field/index.module.css +52 -0
- package/cssm/consts-f777ba1a.d.ts +2 -0
- package/cssm/consts.d.ts +2 -0
- package/cssm/consts.js +7 -0
- package/cssm/data/country-data.d.ts +3 -0
- package/cssm/data/country-data.js +587 -0
- package/cssm/desktop-232828f7.d.ts +2 -0
- package/cssm/desktop-2e2b2125.d.ts +2 -0
- package/cssm/desktop-63dec22f.d.ts +2 -0
- package/cssm/desktop-785df74d.d.ts +2 -0
- package/cssm/desktop.d.ts +2 -0
- package/cssm/desktop.js +34 -0
- package/cssm/hook-8abfea97.d.ts +90 -0
- package/cssm/hook-ebda875c.d.ts +48 -0
- package/cssm/index-136acbb1.d.ts +28 -0
- package/cssm/index-72dda473.d.ts +12 -0
- package/cssm/index-8b2c2707.d.ts +6 -0
- package/cssm/index-bdb4c6b9.d.ts +180 -0
- package/cssm/index-c76d6398.d.ts +319 -0
- package/cssm/index-ebda875c.d.ts +3 -0
- package/cssm/index-f12ee135.d.ts +52 -0
- package/cssm/index.d.ts +2 -0
- package/cssm/index.js +40 -0
- package/cssm/mobile-45dc17c6.d.ts +47 -0
- package/cssm/mobile-4c19bc40.d.ts +121 -0
- package/cssm/mobile-96988a65.d.ts +3 -0
- package/cssm/mobile.d.ts +2 -0
- package/cssm/mobile.js +34 -0
- package/cssm/shared-4cd3936b.d.ts +7 -0
- package/cssm/types-1b036d4b.d.ts +13 -0
- package/cssm/types-72dda473.d.ts +276 -0
- package/cssm/types.d.ts +100 -0
- package/cssm/types.js +2 -0
- package/cssm/typings-9211a437.d.ts +95 -0
- package/cssm/typings-bdb4c6b9.d.ts +52 -0
- package/cssm/typings-dd8ca091.d.ts +572 -0
- package/cssm/useSkeleton-1b036d4b.d.ts +12 -0
- package/cssm/utils/index.d.ts +18 -0
- package/cssm/utils/index.js +201 -0
- package/cssm/utils-dd8ca091.d.ts +41 -0
- package/data/country-data.d.ts +3 -0
- package/data/country-data.js +587 -0
- package/desktop-232828f7.d.ts +2 -0
- package/desktop-2e2b2125.d.ts +2 -0
- package/desktop-63dec22f.d.ts +2 -0
- package/desktop.d.ts +2 -0
- package/desktop.js +30 -0
- package/esm/Component-4cd3936b.d.ts +19 -0
- package/esm/Component-63dec22f.d.ts +184 -0
- package/esm/Component-8b2c2707.d.ts +71 -0
- package/esm/Component-9211a437.d.ts +38 -0
- package/esm/Component-bdb4c6b9.d.ts +12 -0
- package/esm/Component-c76d6398.d.ts +5 -0
- package/esm/Component-d078a845.d.ts +7 -0
- package/esm/Component-dd8ca091.d.ts +72 -0
- package/esm/Component-ebda875c.d.ts +12 -0
- package/esm/Component.desktop-2e2b2125.d.ts +6 -0
- package/esm/Component.desktop-785df74d.d.ts +6 -0
- package/esm/Component.desktop-d078a845.d.ts +73 -0
- package/esm/Component.desktop-d873d97d.d.ts +6 -0
- package/esm/Component.desktop.d.ts +5 -0
- package/esm/Component.desktop.js +39 -0
- package/esm/Component.mobile-4cd3936b.d.ts +98 -0
- package/esm/Component.mobile-755fbaa3.d.ts +6 -0
- package/esm/Component.mobile-ade26e99.d.ts +41 -0
- package/esm/Component.mobile-d7e9f69d.d.ts +6 -0
- package/esm/Component.mobile-ebda875c.d.ts +6 -0
- package/esm/Component.mobile-f1f15074.d.ts +34 -0
- package/esm/Component.mobile.d.ts +5 -0
- package/esm/Component.mobile.js +74 -0
- package/esm/Component.modal.mobile-4cd3936b.d.ts +91 -0
- package/esm/Component.modal.mobile-dd8ca091.d.ts +60 -0
- package/esm/Component.responsive-785df74d.d.ts +26 -0
- package/esm/Component.responsive.d.ts +46 -0
- package/esm/Component.responsive.js +35 -0
- package/esm/Context-bdb4c6b9.d.ts +4 -0
- package/esm/ResponsiveContext-baf4875b.d.ts +5 -0
- package/esm/components/base-international-phone-input/Component.d.ts +26 -0
- package/esm/components/base-international-phone-input/Component.js +89 -0
- package/esm/components/base-international-phone-input/index.css +5 -0
- package/esm/components/base-international-phone-input/index.d.ts +1 -0
- package/esm/components/base-international-phone-input/index.js +18 -0
- package/esm/components/country-select/Component.d.ts +21 -0
- package/esm/components/country-select/Component.js +52 -0
- package/esm/components/country-select/index.css +47 -0
- package/esm/components/country-select/index.d.ts +1 -0
- package/esm/components/country-select/index.js +12 -0
- package/esm/components/flag-icon/component.d.ts +16 -0
- package/esm/components/flag-icon/component.js +18 -0
- package/esm/components/flag-icon/flagSprite.d.ts +2 -0
- package/esm/components/flag-icon/flagSprite.js +229 -0
- package/esm/components/flag-icon/index.css +30 -0
- package/esm/components/flag-icon/index.d.ts +1 -0
- package/esm/components/flag-icon/index.js +4 -0
- package/esm/components/select-field/component.d.ts +8 -0
- package/esm/components/select-field/component.js +32 -0
- package/esm/components/select-field/index.css +53 -0
- package/esm/components/select-field/index.d.ts +1 -0
- package/esm/components/select-field/index.js +9 -0
- package/esm/consts-f777ba1a.d.ts +2 -0
- package/esm/consts.d.ts +2 -0
- package/esm/consts.js +3 -0
- package/esm/data/country-data.d.ts +3 -0
- package/esm/data/country-data.js +583 -0
- package/esm/desktop-232828f7.d.ts +2 -0
- package/esm/desktop-2e2b2125.d.ts +2 -0
- package/esm/desktop-63dec22f.d.ts +2 -0
- package/esm/desktop.d.ts +2 -0
- package/esm/desktop.js +22 -0
- package/esm/hook-8abfea97.d.ts +90 -0
- package/esm/index-136acbb1.d.ts +28 -0
- package/esm/index-72dda473.d.ts +12 -0
- package/esm/index-8b2c2707.d.ts +6 -0
- package/esm/index-bdb4c6b9.d.ts +2 -0
- package/esm/index-c76d6398.d.ts +141 -0
- package/esm/index-ebda875c.d.ts +3 -0
- package/esm/index-f12ee135.d.ts +52 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +28 -0
- package/esm/mobile-4c19bc40.d.ts +3 -0
- package/esm/mobile-755fbaa3.d.ts +2 -0
- package/esm/mobile-96988a65.d.ts +2 -0
- package/esm/mobile-ade26e99.d.ts +5 -0
- package/esm/mobile-d7e9f69d.d.ts +2 -0
- package/esm/mobile.d.ts +2 -0
- package/esm/mobile.js +22 -0
- package/esm/shared-4cd3936b.d.ts +65 -0
- package/esm/types-1b036d4b.d.ts +13 -0
- package/esm/types-72dda473.d.ts +276 -0
- package/esm/types.d.ts +100 -0
- package/esm/types.js +1 -0
- package/esm/typings-9211a437.d.ts +95 -0
- package/esm/typings-bdb4c6b9.d.ts +52 -0
- package/esm/typings-dd8ca091.d.ts +572 -0
- package/esm/useSkeleton-ebda875c.d.ts +12 -0
- package/esm/utils/index.d.ts +18 -0
- package/esm/utils/index.js +189 -0
- package/esm/utils-1574ad8b.d.ts +29 -0
- package/esm/utils-dd8ca091.d.ts +41 -0
- package/hook-8abfea97.d.ts +90 -0
- package/index-136acbb1.d.ts +28 -0
- package/index-72dda473.d.ts +12 -0
- package/index-8b2c2707.d.ts +6 -0
- package/index-bdb4c6b9.d.ts +2 -0
- package/index-c76d6398.d.ts +141 -0
- package/index-ebda875c.d.ts +3 -0
- package/index-f12ee135.d.ts +52 -0
- package/index.d.ts +2 -0
- package/index.js +36 -0
- package/mobile-4c19bc40.d.ts +3 -0
- package/mobile-755fbaa3.d.ts +2 -0
- package/mobile-96988a65.d.ts +2 -0
- package/mobile-ade26e99.d.ts +5 -0
- package/mobile-d7e9f69d.d.ts +2 -0
- package/mobile.d.ts +2 -0
- package/mobile.js +30 -0
- package/modern/Component-4cd3936b.d.ts +19 -0
- package/modern/Component-63dec22f.d.ts +184 -0
- package/modern/Component-8b2c2707.d.ts +71 -0
- package/modern/Component-9211a437.d.ts +38 -0
- package/modern/Component-bdb4c6b9.d.ts +12 -0
- package/modern/Component-c76d6398.d.ts +5 -0
- package/modern/Component-d078a845.d.ts +7 -0
- package/modern/Component-dd8ca091.d.ts +72 -0
- package/modern/Component-ebda875c.d.ts +12 -0
- package/modern/Component.desktop-2e2b2125.d.ts +6 -0
- package/modern/Component.desktop-785df74d.d.ts +6 -0
- package/modern/Component.desktop-d078a845.d.ts +73 -0
- package/modern/Component.desktop-d873d97d.d.ts +6 -0
- package/modern/Component.desktop.d.ts +5 -0
- package/modern/Component.desktop.js +35 -0
- package/modern/Component.mobile-4cd3936b.d.ts +98 -0
- package/modern/Component.mobile-755fbaa3.d.ts +6 -0
- package/modern/Component.mobile-ade26e99.d.ts +41 -0
- package/modern/Component.mobile-d7e9f69d.d.ts +6 -0
- package/modern/Component.mobile-ebda875c.d.ts +6 -0
- package/modern/Component.mobile-f1f15074.d.ts +34 -0
- package/modern/Component.mobile.d.ts +5 -0
- package/modern/Component.mobile.js +77 -0
- package/modern/Component.modal.mobile-4cd3936b.d.ts +91 -0
- package/modern/Component.modal.mobile-dd8ca091.d.ts +60 -0
- package/modern/Component.responsive-785df74d.d.ts +26 -0
- package/modern/Component.responsive.d.ts +46 -0
- package/modern/Component.responsive.js +33 -0
- package/modern/Context-bdb4c6b9.d.ts +4 -0
- package/modern/ResponsiveContext-baf4875b.d.ts +5 -0
- package/modern/components/base-international-phone-input/Component.d.ts +26 -0
- package/modern/components/base-international-phone-input/Component.js +91 -0
- package/modern/components/base-international-phone-input/index.css +5 -0
- package/modern/components/base-international-phone-input/index.d.ts +1 -0
- package/modern/components/base-international-phone-input/index.js +17 -0
- package/modern/components/country-select/Component.d.ts +21 -0
- package/modern/components/country-select/Component.js +47 -0
- package/modern/components/country-select/index.css +47 -0
- package/modern/components/country-select/index.d.ts +1 -0
- package/modern/components/country-select/index.js +11 -0
- package/modern/components/flag-icon/component.d.ts +16 -0
- package/modern/components/flag-icon/component.js +15 -0
- package/modern/components/flag-icon/flagSprite.d.ts +2 -0
- package/modern/components/flag-icon/flagSprite.js +229 -0
- package/modern/components/flag-icon/index.css +30 -0
- package/modern/components/flag-icon/index.d.ts +1 -0
- package/modern/components/flag-icon/index.js +4 -0
- package/modern/components/select-field/component.d.ts +8 -0
- package/modern/components/select-field/component.js +29 -0
- package/modern/components/select-field/index.css +53 -0
- package/modern/components/select-field/index.d.ts +1 -0
- package/modern/components/select-field/index.js +8 -0
- package/modern/consts-f777ba1a.d.ts +2 -0
- package/modern/consts.d.ts +2 -0
- package/modern/consts.js +3 -0
- package/modern/data/country-data.d.ts +3 -0
- package/modern/data/country-data.js +583 -0
- package/modern/desktop-232828f7.d.ts +2 -0
- package/modern/desktop-2e2b2125.d.ts +2 -0
- package/modern/desktop-63dec22f.d.ts +2 -0
- package/modern/desktop.d.ts +2 -0
- package/modern/desktop.js +21 -0
- package/modern/hook-8abfea97.d.ts +90 -0
- package/modern/index-136acbb1.d.ts +28 -0
- package/modern/index-72dda473.d.ts +12 -0
- package/modern/index-8b2c2707.d.ts +6 -0
- package/modern/index-bdb4c6b9.d.ts +2 -0
- package/modern/index-c76d6398.d.ts +141 -0
- package/modern/index-ebda875c.d.ts +3 -0
- package/modern/index-f12ee135.d.ts +52 -0
- package/modern/index.d.ts +2 -0
- package/modern/index.js +27 -0
- package/modern/mobile-4c19bc40.d.ts +3 -0
- package/modern/mobile-755fbaa3.d.ts +2 -0
- package/modern/mobile-96988a65.d.ts +2 -0
- package/modern/mobile-ade26e99.d.ts +5 -0
- package/modern/mobile-d7e9f69d.d.ts +2 -0
- package/modern/mobile.d.ts +2 -0
- package/modern/mobile.js +21 -0
- package/modern/shared-4cd3936b.d.ts +65 -0
- package/modern/types-1b036d4b.d.ts +13 -0
- package/modern/types-72dda473.d.ts +276 -0
- package/modern/types.d.ts +100 -0
- package/modern/types.js +1 -0
- package/modern/typings-9211a437.d.ts +95 -0
- package/modern/typings-bdb4c6b9.d.ts +52 -0
- package/modern/typings-dd8ca091.d.ts +572 -0
- package/modern/useSkeleton-ebda875c.d.ts +12 -0
- package/modern/utils/index.d.ts +18 -0
- package/modern/utils/index.js +183 -0
- package/modern/utils-1574ad8b.d.ts +29 -0
- package/modern/utils-dd8ca091.d.ts +41 -0
- package/package.json +30 -0
- package/shared-4cd3936b.d.ts +65 -0
- package/src/Component.desktop.tsx +68 -0
- package/src/Component.mobile.tsx +132 -0
- package/src/Component.responsive.tsx +20 -0
- package/src/components/base-international-phone-input/Component.tsx +174 -0
- package/src/components/base-international-phone-input/index.module.css +5 -0
- package/src/components/base-international-phone-input/index.ts +1 -0
- package/src/components/country-select/Component.tsx +120 -0
- package/src/components/country-select/index.module.css +40 -0
- package/src/components/country-select/index.ts +1 -0
- package/src/components/flag-icon/component.tsx +33 -0
- package/src/components/flag-icon/flagSprite.ts +228 -0
- package/src/components/flag-icon/index.module.css +15 -0
- package/src/components/flag-icon/index.ts +1 -0
- package/src/components/select-field/component.tsx +51 -0
- package/src/components/select-field/index.module.css +43 -0
- package/src/components/select-field/index.ts +1 -0
- package/src/consts.ts +1 -0
- package/src/data/country-data.ts +584 -0
- package/src/desktop.ts +2 -0
- package/src/index.ts +2 -0
- package/src/mobile.ts +2 -0
- package/src/types.ts +132 -0
- package/src/utils/index.ts +246 -0
- package/types-1b036d4b.d.ts +13 -0
- package/types-72dda473.d.ts +276 -0
- package/types.d.ts +100 -0
- package/types.js +2 -0
- package/typings-9211a437.d.ts +95 -0
- package/typings-bdb4c6b9.d.ts +52 -0
- package/typings-dd8ca091.d.ts +572 -0
- package/useSkeleton-ebda875c.d.ts +12 -0
- package/utils/index.d.ts +18 -0
- package/utils/index.js +201 -0
- package/utils-1574ad8b.d.ts +29 -0
- package/utils-dd8ca091.d.ts +41 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { ChangeEvent, ElementType, FC } from 'react';
|
|
2
|
+
import { FocusEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { InputProps } from '@alfalab/core-components-input';
|
|
5
|
+
import type { InputDesktopProps } from '@alfalab/core-components-input/desktop';
|
|
6
|
+
import type { InputMobileProps } from '@alfalab/core-components-input/mobile';
|
|
7
|
+
import type { InputAutocompleteProps } from '@alfalab/core-components-input-autocomplete';
|
|
8
|
+
import type { InputAutocompleteDesktopProps } from '@alfalab/core-components-input-autocomplete/desktop';
|
|
9
|
+
import type { InputAutocompleteMobileProps } from '@alfalab/core-components-input-autocomplete/mobile';
|
|
10
|
+
import { OptionShape } from '@alfalab/core-components-select/typings';
|
|
11
|
+
|
|
12
|
+
import type { SharedCountrySelectProps } from './components/country-select';
|
|
13
|
+
|
|
14
|
+
export type Country = {
|
|
15
|
+
name: string;
|
|
16
|
+
regions?: string[];
|
|
17
|
+
iso2: string;
|
|
18
|
+
countryCode: string;
|
|
19
|
+
dialCode: string;
|
|
20
|
+
format?: string;
|
|
21
|
+
priority: number;
|
|
22
|
+
mainCode?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type AreaItem = Country & {
|
|
26
|
+
isAreaCode: boolean;
|
|
27
|
+
areaCodeLength: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type CommonPhoneInputProps = {
|
|
31
|
+
/**
|
|
32
|
+
* Выбранная страна
|
|
33
|
+
*/
|
|
34
|
+
country?: Country;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Список необходимых iso2 стран
|
|
38
|
+
*/
|
|
39
|
+
countries?: string[];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Дефолтный код страны
|
|
43
|
+
*/
|
|
44
|
+
defaultIso2?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Возможность стереть код страны
|
|
48
|
+
*/
|
|
49
|
+
clearableCountryCode?: boolean;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Свойства селекта выбора стран
|
|
53
|
+
*/
|
|
54
|
+
countrySelectProps?: SharedCountrySelectProps;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
*Показывать крестик очистки
|
|
58
|
+
*/
|
|
59
|
+
clear?: boolean;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Функция фильтрации номеров для автокомплита
|
|
63
|
+
*/
|
|
64
|
+
filterFn?: (value: string | undefined, option: OptionShape) => boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Обработчик события изменения страны
|
|
68
|
+
*/
|
|
69
|
+
onCountryChange?: (country?: Country) => void;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Обработчик изменения номера
|
|
73
|
+
*/
|
|
74
|
+
onChange?: (e: ChangeEvent<HTMLInputElement> | null, { value }: { value: string }) => void;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Обработчик блюра поля
|
|
78
|
+
*/
|
|
79
|
+
onBlur?: (event: FocusEvent<HTMLDivElement | HTMLInputElement>) => void;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Обработчик фокуса поля
|
|
83
|
+
*/
|
|
84
|
+
onFocus?: (event: FocusEvent<HTMLDivElement | HTMLInputElement>) => void;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type BaseInternationalPhoneInputProps = CommonPhoneInputProps & {
|
|
88
|
+
Input: FC<InputProps>;
|
|
89
|
+
InputAutocomplete: FC<InputAutocompleteProps>;
|
|
90
|
+
SelectComponent: ElementType;
|
|
91
|
+
view: 'desktop' | 'mobile';
|
|
92
|
+
countriesData: Country[][];
|
|
93
|
+
} & Omit<InputProps, 'onFocus' | 'onBlur' | 'onScroll'> &
|
|
94
|
+
Partial<Omit<InputAutocompleteProps, 'onChange' | 'leftAddons' | 'onScroll'>>;
|
|
95
|
+
|
|
96
|
+
export type InternationalPhoneInputDesktopProps = CommonPhoneInputProps &
|
|
97
|
+
(
|
|
98
|
+
| ({ options?: never } & Omit<
|
|
99
|
+
InputDesktopProps,
|
|
100
|
+
'onFocus' | 'onBlur' | 'clear' | 'onClear' | 'onChange'
|
|
101
|
+
>)
|
|
102
|
+
| ({ options: InputAutocompleteDesktopProps['options'] } & Omit<
|
|
103
|
+
InputAutocompleteDesktopProps,
|
|
104
|
+
'onChange'
|
|
105
|
+
>)
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
export type InternationalPhoneInputMobileProps = CommonPhoneInputProps &
|
|
109
|
+
(
|
|
110
|
+
| ({ options?: never } & Omit<
|
|
111
|
+
InputMobileProps,
|
|
112
|
+
'onFocus' | 'onBlur' | 'clear' | 'onClear' | 'onChange'
|
|
113
|
+
>)
|
|
114
|
+
| ({ options: InputAutocompleteMobileProps['options'] } & Omit<
|
|
115
|
+
InputAutocompleteMobileProps,
|
|
116
|
+
'onChange' | 'onFilter' | 'filter' | 'onClearFilter'
|
|
117
|
+
>)
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export type InternationalPhoneInputProps = InternationalPhoneInputDesktopProps &
|
|
121
|
+
InternationalPhoneInputMobileProps & {
|
|
122
|
+
/**
|
|
123
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
124
|
+
* @default 1024
|
|
125
|
+
*/
|
|
126
|
+
breakpoint?: number;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Значение по-умолчанию для хука useMatchMedia
|
|
130
|
+
*/
|
|
131
|
+
defaultMatchMediaValue?: boolean | (() => boolean);
|
|
132
|
+
};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import type { MaskitoOptions } from '@maskito/core';
|
|
2
|
+
|
|
3
|
+
import type { InputAutocompleteDesktopProps } from '@alfalab/core-components-input-autocomplete/desktop';
|
|
4
|
+
import { GroupShape, isGroup, OptionShape } from '@alfalab/core-components-select/shared';
|
|
5
|
+
import { maskUtils } from '@alfalab/core-components-shared';
|
|
6
|
+
|
|
7
|
+
import { DEFAULT_PHONE_FORMAT } from '../consts';
|
|
8
|
+
import { countriesData } from '../data/country-data';
|
|
9
|
+
import type { AreaItem, Country } from '../types';
|
|
10
|
+
|
|
11
|
+
export function initCountries(iso2s?: string[]) {
|
|
12
|
+
const filteredCountriesData = Array.isArray(iso2s)
|
|
13
|
+
? countriesData.filter((country) => iso2s.includes(country[2]))
|
|
14
|
+
: countriesData;
|
|
15
|
+
|
|
16
|
+
return filteredCountriesData.map((country) => {
|
|
17
|
+
const countryItem: Country = {
|
|
18
|
+
name: country[0],
|
|
19
|
+
regions: country[1],
|
|
20
|
+
iso2: country[2],
|
|
21
|
+
countryCode: country[3],
|
|
22
|
+
dialCode: country[3],
|
|
23
|
+
format: country[4],
|
|
24
|
+
priority: country[5] || 0,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const areaItems: AreaItem[] = [];
|
|
28
|
+
|
|
29
|
+
if (country[6]) {
|
|
30
|
+
country[6]?.forEach((areaCode) => {
|
|
31
|
+
const areaItem: Partial<AreaItem> = { ...countryItem };
|
|
32
|
+
|
|
33
|
+
areaItem.dialCode = country[3] + areaCode;
|
|
34
|
+
areaItem.isAreaCode = true;
|
|
35
|
+
areaItem.areaCodeLength = areaCode.length;
|
|
36
|
+
|
|
37
|
+
areaItems.push(areaItem as AreaItem);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (areaItems.length > 0) {
|
|
42
|
+
countryItem.mainCode = true;
|
|
43
|
+
|
|
44
|
+
return [countryItem, ...areaItems];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return [countryItem];
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function findCountry(
|
|
52
|
+
countries: Country[][],
|
|
53
|
+
value?: string,
|
|
54
|
+
iso2?: string,
|
|
55
|
+
country?: Country,
|
|
56
|
+
) {
|
|
57
|
+
if (country) return country;
|
|
58
|
+
|
|
59
|
+
if (value) {
|
|
60
|
+
const inputNumber = clearMask(value);
|
|
61
|
+
const nextCountry = guessCountry(inputNumber, countries);
|
|
62
|
+
|
|
63
|
+
if (nextCountry) return nextCountry;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!iso2) return undefined;
|
|
67
|
+
|
|
68
|
+
return countries.find((c) => c[0].iso2 === iso2)?.[0];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function guessCountry(inputNumber: string, data: Country[][]) {
|
|
72
|
+
const inputNumberDialCode = inputNumber.slice(0, 6);
|
|
73
|
+
const result = data.reduce((selectedCountry, countryData) => {
|
|
74
|
+
let guess;
|
|
75
|
+
|
|
76
|
+
countryData.forEach((country) => {
|
|
77
|
+
if (inputNumberDialCode.startsWith(country.dialCode)) {
|
|
78
|
+
const selectedCountryDialCode = selectedCountry?.dialCode || '';
|
|
79
|
+
const selectedCountryPriority = selectedCountry?.priority || 100;
|
|
80
|
+
|
|
81
|
+
if (country.dialCode.length > selectedCountryDialCode.length) {
|
|
82
|
+
guess = country;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (
|
|
86
|
+
country.dialCode.length === selectedCountryDialCode.length &&
|
|
87
|
+
country.priority < selectedCountryPriority
|
|
88
|
+
) {
|
|
89
|
+
guess = country;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return guess || selectedCountry;
|
|
95
|
+
}, undefined as Country | undefined);
|
|
96
|
+
|
|
97
|
+
if (!result && inputNumber.length > 5 && inputNumber.startsWith('8'))
|
|
98
|
+
return data.find((countryData) => countryData[0].iso2 === 'ru')?.[0];
|
|
99
|
+
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function clearMask(value: string) {
|
|
104
|
+
return value.replace(/\D/g, '');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function itemToMask(item: string) {
|
|
108
|
+
return item === '.' ? /\d/ : item;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function prepareDefaultFormat(countryCode?: string, clearableCountryCode?: boolean) {
|
|
112
|
+
if (!countryCode) return ['+', ...DEFAULT_PHONE_FORMAT.split('').map(itemToMask)];
|
|
113
|
+
|
|
114
|
+
const removeDots = (count: number) => {
|
|
115
|
+
let removed = 0;
|
|
116
|
+
let res = DEFAULT_PHONE_FORMAT;
|
|
117
|
+
|
|
118
|
+
while (removed < count) {
|
|
119
|
+
res = res.replace(/\./, '');
|
|
120
|
+
removed += 1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return res.trim();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
if (clearableCountryCode) {
|
|
127
|
+
return [
|
|
128
|
+
'+',
|
|
129
|
+
...countryCode.split('').map(() => /\d/),
|
|
130
|
+
' ',
|
|
131
|
+
...removeDots(countryCode.length).split('').map(itemToMask).reverse(),
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return [
|
|
136
|
+
'+',
|
|
137
|
+
...countryCode.split(''),
|
|
138
|
+
' ',
|
|
139
|
+
...removeDots(countryCode.length).split('').map(itemToMask).reverse(),
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function createPhoneMaskExpression(
|
|
144
|
+
country?: Country,
|
|
145
|
+
clearableCountryCode?: boolean,
|
|
146
|
+
): Array<RegExp | string> {
|
|
147
|
+
const { countryCode, format } = country || {};
|
|
148
|
+
|
|
149
|
+
if (!countryCode || !format) {
|
|
150
|
+
return prepareDefaultFormat(countryCode, clearableCountryCode);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return [
|
|
154
|
+
'+',
|
|
155
|
+
...(clearableCountryCode ? countryCode.split('').map(() => /\d/) : countryCode.split('')),
|
|
156
|
+
' ',
|
|
157
|
+
...format.split('').map((item) => (item === '.' ? /\d/ : item)),
|
|
158
|
+
];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function createMaskOptions(
|
|
162
|
+
country?: Country,
|
|
163
|
+
clearableCountryCode?: boolean,
|
|
164
|
+
): MaskitoOptions {
|
|
165
|
+
const prefixLen =
|
|
166
|
+
!clearableCountryCode && country?.countryCode ? country.countryCode.length + 1 : 0;
|
|
167
|
+
|
|
168
|
+
const mask = createPhoneMaskExpression(country, clearableCountryCode);
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
mask,
|
|
172
|
+
preprocessors: [
|
|
173
|
+
maskUtils.insertionPhonePreprocessor(mask, country?.countryCode, clearableCountryCode),
|
|
174
|
+
],
|
|
175
|
+
postprocessors: [
|
|
176
|
+
maskUtils.prefixPostprocessor(prefixLen ? `+${country?.countryCode}` : ''),
|
|
177
|
+
],
|
|
178
|
+
plugins: [
|
|
179
|
+
maskUtils.caretGuard((value, [from, to]) => [
|
|
180
|
+
from === to ? prefixLen : 0,
|
|
181
|
+
value.length,
|
|
182
|
+
]),
|
|
183
|
+
],
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function defaultFilterFn(value = '', option: OptionShape) {
|
|
188
|
+
return clearMask(option.key).includes(clearMask(value));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export const filterPhones = (
|
|
192
|
+
value = '',
|
|
193
|
+
options?: InputAutocompleteDesktopProps['options'],
|
|
194
|
+
filterFn = defaultFilterFn,
|
|
195
|
+
) => {
|
|
196
|
+
if (!options || options.length === 0) return options;
|
|
197
|
+
|
|
198
|
+
const filteredOptions: InputAutocompleteDesktopProps['options'] = [];
|
|
199
|
+
|
|
200
|
+
options.forEach((option) => {
|
|
201
|
+
if (isGroup(option)) {
|
|
202
|
+
const group: GroupShape = {
|
|
203
|
+
...option,
|
|
204
|
+
options: [],
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
option.options.forEach((groupOption) => {
|
|
208
|
+
if (filterFn(value, groupOption)) group.options.push(groupOption);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
if (group.options.length) filteredOptions.push(group);
|
|
212
|
+
} else if (filterFn(value, option)) filteredOptions.push(option);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
return filteredOptions;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export function getPhoneData(phone: string, countries: Country[][], defaultIso2?: string) {
|
|
219
|
+
let nextPhone = phone;
|
|
220
|
+
const inputNumber = clearMask(nextPhone);
|
|
221
|
+
const nextCountry = findCountry(countries, phone, defaultIso2);
|
|
222
|
+
|
|
223
|
+
if (nextCountry?.iso2 === 'ru' && inputNumber.length > 5 && inputNumber.startsWith('8')) {
|
|
224
|
+
nextPhone = phone.replace(/\+?8/, '+7');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
nextPhone,
|
|
229
|
+
nextCountry,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function getClear(
|
|
234
|
+
clear?: boolean,
|
|
235
|
+
clearableCountryCode?: boolean,
|
|
236
|
+
value = '',
|
|
237
|
+
countryCode = '',
|
|
238
|
+
) {
|
|
239
|
+
if (!clear) return clear;
|
|
240
|
+
|
|
241
|
+
const trimmedValue = value.trim();
|
|
242
|
+
|
|
243
|
+
return clearableCountryCode
|
|
244
|
+
? trimmedValue !== '' && trimmedValue !== '+'
|
|
245
|
+
: trimmedValue.length > countryCode.length + 1;
|
|
246
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type TextElementType = HTMLParagraphElement | HTMLSpanElement | HTMLDivElement;
|
|
2
|
+
type WidthUnit = number | string;
|
|
3
|
+
type TextSkeletonProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Кол-во строк текста
|
|
6
|
+
*/
|
|
7
|
+
rows?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Ширина строки
|
|
10
|
+
*/
|
|
11
|
+
width?: WidthUnit | WidthUnit[];
|
|
12
|
+
};
|
|
13
|
+
export { TextElementType, TextSkeletonProps };
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/// <reference types="react-transition-group" />
|
|
2
|
+
import { HTMLAttributes, ReactElement, ReactNode, RefObject } from 'react';
|
|
3
|
+
import { HandledEvents } from 'react-swipeable/es/types';
|
|
4
|
+
import { TransitionProps } from 'react-transition-group/Transition';
|
|
5
|
+
import { BaseModalProps } from "./index-bdb4c6b9";
|
|
6
|
+
import { NavigationBarProps } from "./index-c76d6398";
|
|
7
|
+
import { BackgroundColorType } from "./index-72dda473";
|
|
8
|
+
type BottomSheetTitleAlign = 'center' | 'left';
|
|
9
|
+
type BottomSheetProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Контент
|
|
12
|
+
*/
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Управление видимостью
|
|
16
|
+
*/
|
|
17
|
+
open: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Заголовок
|
|
20
|
+
*/
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Размер заголовка
|
|
24
|
+
*/
|
|
25
|
+
titleSize?: NavigationBarProps['titleSize'];
|
|
26
|
+
/**
|
|
27
|
+
* Подзаголовок.
|
|
28
|
+
*/
|
|
29
|
+
subtitle?: NavigationBarProps['subtitle'];
|
|
30
|
+
/**
|
|
31
|
+
* Кнопка действия (обычно, это кнопка закрытия)
|
|
32
|
+
*/
|
|
33
|
+
actionButton?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Нода, компонент или функция возвращающая их
|
|
36
|
+
*
|
|
37
|
+
* Контейнер к которому будут добавляться порталы
|
|
38
|
+
*/
|
|
39
|
+
container?: BaseModalProps['container'];
|
|
40
|
+
/**
|
|
41
|
+
* Рендерить ли в контейнер через портал.
|
|
42
|
+
*/
|
|
43
|
+
usePortal?: BaseModalProps['usePortal'];
|
|
44
|
+
/**
|
|
45
|
+
* Дополнительный класс
|
|
46
|
+
*/
|
|
47
|
+
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Дополнительный класс
|
|
50
|
+
*/
|
|
51
|
+
contentClassName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Дополнительные пропсы на контейнер.
|
|
54
|
+
*/
|
|
55
|
+
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
56
|
+
/**
|
|
57
|
+
* Дополнительный класс
|
|
58
|
+
*/
|
|
59
|
+
containerClassName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Цвет фона
|
|
62
|
+
*/
|
|
63
|
+
backgroundColor?: Extract<BackgroundColorType, 'primary' | 'secondary'>;
|
|
64
|
+
/**
|
|
65
|
+
* Дополнительный класс шапки
|
|
66
|
+
*/
|
|
67
|
+
headerClassName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Дополнительный класс футера
|
|
70
|
+
*/
|
|
71
|
+
footerClassName?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Дополнительный класс для аддонов
|
|
74
|
+
*/
|
|
75
|
+
addonClassName?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Дополнительный класс для компонента крестика
|
|
78
|
+
*/
|
|
79
|
+
closerClassName?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Дополнительный класс для компонента стрелки назад
|
|
82
|
+
*/
|
|
83
|
+
backerClassName?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Дополнительный класс для компонента модального окна
|
|
86
|
+
*/
|
|
87
|
+
modalClassName?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Дополнительный класс для обертки модального окна
|
|
90
|
+
*/
|
|
91
|
+
modalWrapperClassName?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Дополнительный класс для маркера
|
|
94
|
+
*/
|
|
95
|
+
swipeableMarkerClassName?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Кастомный маркер
|
|
98
|
+
*/
|
|
99
|
+
swipeableMarker?: ReactElement;
|
|
100
|
+
/**
|
|
101
|
+
* TransitionProps, прокидываются в компонент CSSTransitionProps.
|
|
102
|
+
*/
|
|
103
|
+
transitionProps?: Partial<TransitionProps>;
|
|
104
|
+
/**
|
|
105
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
106
|
+
*/
|
|
107
|
+
dataTestId?: string;
|
|
108
|
+
/**
|
|
109
|
+
* z-index компонента
|
|
110
|
+
*/
|
|
111
|
+
zIndex?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Будет ли свайпаться шторка
|
|
114
|
+
* @default true
|
|
115
|
+
*/
|
|
116
|
+
swipeable?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Будет ли свайпаться контент
|
|
119
|
+
*/
|
|
120
|
+
swipeableContent?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Порог свайпа
|
|
123
|
+
*/
|
|
124
|
+
swipeThreshold?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Слот слева
|
|
127
|
+
*/
|
|
128
|
+
leftAddons?: ReactNode;
|
|
129
|
+
/**
|
|
130
|
+
* Слот справа
|
|
131
|
+
*/
|
|
132
|
+
rightAddons?: ReactNode;
|
|
133
|
+
/**
|
|
134
|
+
* Слот снизу
|
|
135
|
+
*/
|
|
136
|
+
bottomAddons?: ReactNode;
|
|
137
|
+
/**
|
|
138
|
+
* Наличие компонента крестика
|
|
139
|
+
*/
|
|
140
|
+
hasCloser?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Наличие компонента стрелки назад
|
|
143
|
+
*/
|
|
144
|
+
hasBacker?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Выравнивание заголовка
|
|
147
|
+
*/
|
|
148
|
+
titleAlign?: BottomSheetTitleAlign;
|
|
149
|
+
/**
|
|
150
|
+
* Фиксирует шапку
|
|
151
|
+
*/
|
|
152
|
+
stickyHeader?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Фиксирует футер
|
|
155
|
+
*/
|
|
156
|
+
stickyFooter?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Высота шторки
|
|
159
|
+
*/
|
|
160
|
+
initialHeight?: 'default' | 'full';
|
|
161
|
+
/**
|
|
162
|
+
* Будет ли виден оверлэй
|
|
163
|
+
*/
|
|
164
|
+
hideOverlay?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Будет ли видна шапка
|
|
167
|
+
*/
|
|
168
|
+
hideHeader?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Будет ли обрезан заголовок
|
|
171
|
+
*/
|
|
172
|
+
trimTitle?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Запретить закрытие шторки кликом на оверлэй
|
|
175
|
+
*/
|
|
176
|
+
disableOverlayClick?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Отключает блокировку скролла при открытии модального окна
|
|
179
|
+
*/
|
|
180
|
+
disableBlockingScroll?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Отключает ловушку фокуса
|
|
183
|
+
*/
|
|
184
|
+
disableFocusLock?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* @deprecated данный проп больше не используется, временно оставлен для обратной совместимости
|
|
187
|
+
* Не анимировать шторку при изменении размера вьюпорта
|
|
188
|
+
*/
|
|
189
|
+
ignoreScreenChange?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Свойства для Бэкдропа
|
|
192
|
+
*/
|
|
193
|
+
backdropProps?: BaseModalProps['backdropProps'];
|
|
194
|
+
/**
|
|
195
|
+
* Реф на контейнер, в котором происходит скролл
|
|
196
|
+
*/
|
|
197
|
+
scrollableContainerRef?: RefObject<HTMLElement>;
|
|
198
|
+
/**
|
|
199
|
+
* Реф для управления компонентом.
|
|
200
|
+
*/
|
|
201
|
+
bottomSheetInstanceRef?: RefObject<{
|
|
202
|
+
scrollToArea: (idx: number) => void;
|
|
203
|
+
}>;
|
|
204
|
+
/**
|
|
205
|
+
* Реф на контейнер, в котором находится шторка
|
|
206
|
+
*/
|
|
207
|
+
sheetContainerRef?: RefObject<HTMLElement>;
|
|
208
|
+
/**
|
|
209
|
+
* Магнитные области видимой высоты шторки.
|
|
210
|
+
* Можно использовать значения в пикселях - 10(число), либо в процентах - 10%(строка).
|
|
211
|
+
* По-умолчанию -[0, window.innerHeight - '24px']
|
|
212
|
+
* массив должен состоять минимум из 2 элементов
|
|
213
|
+
*/
|
|
214
|
+
magneticAreas?: Array<number | string>;
|
|
215
|
+
/**
|
|
216
|
+
* Индекс точки из magneticAreas, к которому нужно примагнититься при первом открытии шторки.
|
|
217
|
+
*/
|
|
218
|
+
initialActiveAreaIndex?: number;
|
|
219
|
+
/**
|
|
220
|
+
* Отключает скролл контентной области.
|
|
221
|
+
*/
|
|
222
|
+
scrollLocked?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Скрыть скроллбар внутри шторки
|
|
225
|
+
*/
|
|
226
|
+
hideScrollbar?: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Верхний отступ шторки, если она открыта на максимальную высоту
|
|
229
|
+
*/
|
|
230
|
+
headerOffset?: number;
|
|
231
|
+
/**
|
|
232
|
+
* Содержимое bottom-sheet всегда в DOM
|
|
233
|
+
*/
|
|
234
|
+
keepMounted?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Отключает автоматический перевод фокуса на bottom-sheet при открытии
|
|
237
|
+
*/
|
|
238
|
+
disableAutoFocus?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Отключает восстановление фокуса на предыдущем элементе после закрытия bottom-sheet
|
|
241
|
+
*/
|
|
242
|
+
disableRestoreFocus?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Отключает вызов `onClose` при нажатии Escape
|
|
245
|
+
*/
|
|
246
|
+
disableEscapeKeyDown?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Обработчик закрытия
|
|
249
|
+
*/
|
|
250
|
+
onClose: () => void;
|
|
251
|
+
/**
|
|
252
|
+
* Обработчик нажатия на стрелку назад
|
|
253
|
+
*/
|
|
254
|
+
onBack?: () => void;
|
|
255
|
+
/**
|
|
256
|
+
* Вызывается в начале анимации притягивания к одной из `magneticAreas`
|
|
257
|
+
*/
|
|
258
|
+
onMagnetize?: (index: number) => void;
|
|
259
|
+
/**
|
|
260
|
+
* Вызывается после окончания анимации притягивания
|
|
261
|
+
*/
|
|
262
|
+
onMagnetizeEnd?: () => void;
|
|
263
|
+
/**
|
|
264
|
+
* Вызывается при изменении положения шторки
|
|
265
|
+
*/
|
|
266
|
+
onOffsetChange?: (offset: number, percent: number) => void;
|
|
267
|
+
/**
|
|
268
|
+
* Вызывается в начале свайпа
|
|
269
|
+
*/
|
|
270
|
+
onSwipeStart?: (event: HandledEvents) => void;
|
|
271
|
+
/**
|
|
272
|
+
* Вызывается после окончания свайпа
|
|
273
|
+
*/
|
|
274
|
+
onSwipeEnd?: (event: HandledEvents | null) => void;
|
|
275
|
+
};
|
|
276
|
+
export { BottomSheetTitleAlign, BottomSheetProps };
|