@vkontakte/vkui 4.20.0 → 4.22.1
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/.cache/.eslintcache +1 -1
- package/.cache/.stylelintcache +1 -1
- package/.cache/.tsbuildinfo +414 -116
- package/.cache/ts/src/components/Avatar/Avatar.d.ts +2 -0
- package/.cache/ts/src/components/Cell/Cell.d.ts +11 -0
- package/.cache/ts/src/components/Cell/CellCheckbox/CellCheckbox.d.ts +5 -0
- package/.cache/ts/src/components/Cell/CellDragger/CellDragger.d.ts +6 -0
- package/.cache/ts/src/components/Cell/useDraggable.d.ts +13 -0
- package/.cache/ts/src/components/CustomSelect/CustomSelect.d.ts +0 -1
- package/.cache/ts/src/components/DropdownIcon/DropdownIcon.d.ts +3 -0
- package/.cache/ts/src/components/FocusTrap/FocusTrap.d.ts +2 -3
- package/.cache/ts/src/components/FormField/FormField.d.ts +2 -3
- package/.cache/ts/src/components/FormItem/FormItem.d.ts +2 -3
- package/.cache/ts/src/components/FormLayout/FormLayout.d.ts +2 -4
- package/.cache/ts/src/components/GridAvatar/GridAvatar.d.ts +9 -0
- package/.cache/ts/src/components/HorizontalCell/HorizontalCell.d.ts +2 -3
- package/.cache/ts/src/components/HorizontalScroll/HorizontalScroll.d.ts +3 -2
- package/.cache/ts/src/components/InitialsAvatar/InitialsAvatar.d.ts +33 -0
- package/.cache/ts/src/components/Link/Link.d.ts +1 -2
- package/.cache/ts/src/components/ModalRoot/types.d.ts +0 -1
- package/.cache/ts/src/components/ModalRoot/useModalManager.d.ts +37 -0
- package/.cache/ts/src/components/Removable/Removable.d.ts +2 -1
- package/.cache/ts/src/components/SimpleCell/SimpleCell.d.ts +2 -2
- package/.cache/ts/src/components/SplitCol/SplitCol.d.ts +3 -3
- package/.cache/ts/src/components/SubnavigationBar/SubnavigationBar.d.ts +2 -1
- package/.cache/ts/src/components/Switch/Switch.d.ts +2 -3
- package/.cache/ts/src/components/TabbarItem/TabbarItem.d.ts +3 -1
- package/.cache/ts/src/components/Tappable/Tappable.d.ts +2 -3
- package/.cache/ts/src/components/Touch/Touch.d.ts +16 -17
- package/.cache/ts/src/components/Typography/Caption/Caption.d.ts +2 -2
- package/.cache/ts/src/components/Typography/Headline/Headline.d.ts +2 -2
- package/.cache/ts/src/components/Typography/Subhead/Subhead.d.ts +2 -2
- package/.cache/ts/src/components/Typography/Text/Text.d.ts +2 -3
- package/.cache/ts/src/components/Typography/Title/Title.d.ts +2 -2
- package/.cache/ts/src/components/View/utils.d.ts +2 -0
- package/.cache/ts/src/index.d.ts +4 -0
- package/.cache/ts/src/lib/accessibility.d.ts +1 -1
- package/.cache/ts/src/lib/supportEvents.d.ts +3 -1
- package/.cache/ts/src/types.d.ts +3 -0
- package/dist/cjs/components/ActionSheet/ActionSheet.js +7 -9
- package/dist/cjs/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/cjs/components/Avatar/Avatar.d.ts +2 -0
- package/dist/cjs/components/Avatar/Avatar.js +7 -3
- package/dist/cjs/components/Avatar/Avatar.js.map +1 -1
- package/dist/cjs/components/Banner/Banner.js.map +1 -1
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/CardScroll/CardScroll.js +1 -1
- package/dist/cjs/components/CardScroll/CardScroll.js.map +1 -1
- package/dist/cjs/components/Cell/Cell.d.ts +11 -0
- package/dist/cjs/components/Cell/Cell.js +109 -182
- package/dist/cjs/components/Cell/Cell.js.map +1 -1
- package/dist/cjs/components/Cell/CellCheckbox/CellCheckbox.d.ts +5 -0
- package/dist/cjs/components/Cell/CellCheckbox/CellCheckbox.js +50 -0
- package/dist/cjs/components/Cell/CellCheckbox/CellCheckbox.js.map +1 -0
- package/dist/cjs/components/Cell/CellDragger/CellDragger.d.ts +6 -0
- package/dist/cjs/components/Cell/CellDragger/CellDragger.js +53 -0
- package/dist/cjs/components/Cell/CellDragger/CellDragger.js.map +1 -0
- package/dist/cjs/components/Cell/useDraggable.d.ts +13 -0
- package/dist/cjs/components/Cell/useDraggable.js +142 -0
- package/dist/cjs/components/Cell/useDraggable.js.map +1 -0
- package/dist/cjs/components/ChipsSelect/ChipsSelect.js +2 -2
- package/dist/cjs/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/cjs/components/Counter/Counter.js.map +1 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.d.ts +0 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.js +2 -3
- package/dist/cjs/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cjs/components/DropdownIcon/DropdownIcon.d.ts +3 -0
- package/dist/cjs/components/DropdownIcon/DropdownIcon.js +37 -0
- package/dist/cjs/components/DropdownIcon/DropdownIcon.js.map +1 -0
- package/dist/cjs/components/FocusTrap/FocusTrap.d.ts +2 -3
- package/dist/cjs/components/FocusTrap/FocusTrap.js +3 -5
- package/dist/cjs/components/FocusTrap/FocusTrap.js.map +1 -1
- package/dist/cjs/components/FormField/FormField.d.ts +2 -3
- package/dist/cjs/components/FormField/FormField.js.map +1 -1
- package/dist/cjs/components/FormItem/FormItem.d.ts +2 -3
- package/dist/cjs/components/FormItem/FormItem.js.map +1 -1
- package/dist/cjs/components/FormLayout/FormLayout.d.ts +2 -4
- package/dist/cjs/components/FormLayout/FormLayout.js.map +1 -1
- package/dist/cjs/components/FormLayoutGroup/FormLayoutGroup.js +1 -0
- package/dist/cjs/components/FormLayoutGroup/FormLayoutGroup.js.map +1 -1
- package/dist/cjs/components/GridAvatar/GridAvatar.d.ts +9 -0
- package/dist/cjs/components/GridAvatar/GridAvatar.js +61 -0
- package/dist/cjs/components/GridAvatar/GridAvatar.js.map +1 -0
- package/dist/cjs/components/Header/Header.js.map +1 -1
- package/dist/cjs/components/HorizontalCell/HorizontalCell.d.ts +2 -3
- package/dist/cjs/components/HorizontalCell/HorizontalCell.js.map +1 -1
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.d.ts +3 -2
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.js +10 -13
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/cjs/components/InitialsAvatar/InitialsAvatar.d.ts +33 -0
- package/dist/cjs/components/InitialsAvatar/InitialsAvatar.js +64 -0
- package/dist/cjs/components/InitialsAvatar/InitialsAvatar.js.map +1 -0
- package/dist/cjs/components/Link/Link.d.ts +1 -2
- package/dist/cjs/components/Link/Link.js.map +1 -1
- package/dist/cjs/components/ModalRoot/ModalRoot.js +170 -373
- package/dist/cjs/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cjs/components/ModalRoot/ModalRootContext.js +0 -3
- package/dist/cjs/components/ModalRoot/ModalRootContext.js.map +1 -1
- package/dist/cjs/components/ModalRoot/ModalRootDesktop.js +59 -241
- package/dist/cjs/components/ModalRoot/ModalRootDesktop.js.map +1 -1
- package/dist/cjs/components/ModalRoot/types.d.ts +0 -1
- package/dist/cjs/components/ModalRoot/types.js.map +1 -1
- package/dist/cjs/components/ModalRoot/useModalManager.d.ts +37 -0
- package/dist/cjs/components/ModalRoot/useModalManager.js +213 -0
- package/dist/cjs/components/ModalRoot/useModalManager.js.map +1 -0
- package/dist/cjs/components/NativeSelect/NativeSelect.js +2 -2
- package/dist/cjs/components/NativeSelect/NativeSelect.js.map +1 -1
- package/dist/cjs/components/Removable/Removable.d.ts +2 -1
- package/dist/cjs/components/Removable/Removable.js +75 -66
- package/dist/cjs/components/Removable/Removable.js.map +1 -1
- package/dist/cjs/components/SelectMimicry/SelectMimicry.js +2 -2
- package/dist/cjs/components/SelectMimicry/SelectMimicry.js.map +1 -1
- package/dist/cjs/components/SimpleCell/SimpleCell.d.ts +2 -2
- package/dist/cjs/components/SimpleCell/SimpleCell.js.map +1 -1
- package/dist/cjs/components/SplitCol/SplitCol.d.ts +3 -3
- package/dist/cjs/components/SplitCol/SplitCol.js +2 -4
- package/dist/cjs/components/SplitCol/SplitCol.js.map +1 -1
- package/dist/cjs/components/SubnavigationBar/SubnavigationBar.d.ts +2 -1
- package/dist/cjs/components/SubnavigationBar/SubnavigationBar.js +38 -11
- package/dist/cjs/components/SubnavigationBar/SubnavigationBar.js.map +1 -1
- package/dist/cjs/components/SubnavigationButton/SubnavigationButton.js.map +1 -1
- package/dist/cjs/components/Switch/Switch.d.ts +2 -3
- package/dist/cjs/components/Switch/Switch.js +18 -8
- package/dist/cjs/components/Switch/Switch.js.map +1 -1
- package/dist/cjs/components/Tabbar/Tabbar.js +3 -1
- package/dist/cjs/components/Tabbar/Tabbar.js.map +1 -1
- package/dist/cjs/components/TabbarItem/TabbarItem.d.ts +3 -1
- package/dist/cjs/components/TabbarItem/TabbarItem.js +29 -11
- package/dist/cjs/components/TabbarItem/TabbarItem.js.map +1 -1
- package/dist/cjs/components/Tappable/Tappable.d.ts +2 -3
- package/dist/cjs/components/Tappable/Tappable.js.map +1 -1
- package/dist/cjs/components/Textarea/Textarea.js +9 -7
- package/dist/cjs/components/Textarea/Textarea.js.map +1 -1
- package/dist/cjs/components/Touch/Touch.d.ts +16 -17
- package/dist/cjs/components/Touch/Touch.js +21 -7
- package/dist/cjs/components/Touch/Touch.js.map +1 -1
- package/dist/cjs/components/Typography/Caption/Caption.d.ts +2 -2
- package/dist/cjs/components/Typography/Caption/Caption.js +4 -2
- package/dist/cjs/components/Typography/Caption/Caption.js.map +1 -1
- package/dist/cjs/components/Typography/Headline/Headline.d.ts +2 -2
- package/dist/cjs/components/Typography/Headline/Headline.js +2 -1
- package/dist/cjs/components/Typography/Headline/Headline.js.map +1 -1
- package/dist/cjs/components/Typography/Subhead/Subhead.d.ts +2 -2
- package/dist/cjs/components/Typography/Subhead/Subhead.js +2 -1
- package/dist/cjs/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/cjs/components/Typography/Text/Text.d.ts +2 -3
- package/dist/cjs/components/Typography/Text/Text.js +2 -1
- package/dist/cjs/components/Typography/Text/Text.js.map +1 -1
- package/dist/cjs/components/Typography/Title/Title.d.ts +2 -2
- package/dist/cjs/components/Typography/Title/Title.js +9 -4
- package/dist/cjs/components/Typography/Title/Title.js.map +1 -1
- package/dist/cjs/components/View/View.js +68 -75
- package/dist/cjs/components/View/View.js.map +1 -1
- package/dist/cjs/components/View/ViewInfinite.js +78 -85
- package/dist/cjs/components/View/ViewInfinite.js.map +1 -1
- package/dist/cjs/components/View/utils.d.ts +2 -0
- package/dist/cjs/components/View/utils.js +13 -0
- package/dist/cjs/components/View/utils.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +16 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/accessibility.d.ts +1 -1
- package/dist/cjs/lib/accessibility.js.map +1 -1
- package/dist/cjs/lib/prefixClass.js +7 -6
- package/dist/cjs/lib/prefixClass.js.map +1 -1
- package/dist/cjs/lib/supportEvents.d.ts +3 -1
- package/dist/cjs/lib/supportEvents.js +1 -4
- package/dist/cjs/lib/supportEvents.js.map +1 -1
- package/dist/cjs/types.d.ts +3 -0
- package/dist/components/ActionSheet/ActionSheet.js +6 -9
- package/dist/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +2 -0
- package/dist/components/Avatar/Avatar.js +4 -2
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Banner/Banner.js.map +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/CardScroll/CardScroll.js +1 -1
- package/dist/components/CardScroll/CardScroll.js.map +1 -1
- package/dist/components/Cell/Cell.d.ts +11 -0
- package/dist/components/Cell/Cell.js +103 -177
- package/dist/components/Cell/Cell.js.map +1 -1
- package/dist/components/Cell/CellCheckbox/CellCheckbox.d.ts +5 -0
- package/dist/components/Cell/CellCheckbox/CellCheckbox.js +31 -0
- package/dist/components/Cell/CellCheckbox/CellCheckbox.js.map +1 -0
- package/dist/components/Cell/CellDragger/CellDragger.d.ts +6 -0
- package/dist/components/Cell/CellDragger/CellDragger.js +30 -0
- package/dist/components/Cell/CellDragger/CellDragger.js.map +1 -0
- package/dist/components/Cell/useDraggable.d.ts +13 -0
- package/dist/components/Cell/useDraggable.js +126 -0
- package/dist/components/Cell/useDraggable.js.map +1 -0
- package/dist/components/ChipsSelect/ChipsSelect.js +2 -2
- package/dist/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/components/Counter/Counter.js.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.d.ts +0 -1
- package/dist/components/CustomSelect/CustomSelect.js +3 -5
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components/DropdownIcon/DropdownIcon.d.ts +3 -0
- package/dist/components/DropdownIcon/DropdownIcon.js +19 -0
- package/dist/components/DropdownIcon/DropdownIcon.js.map +1 -0
- package/dist/components/FocusTrap/FocusTrap.d.ts +2 -3
- package/dist/components/FocusTrap/FocusTrap.js +3 -5
- package/dist/components/FocusTrap/FocusTrap.js.map +1 -1
- package/dist/components/FormField/FormField.d.ts +2 -3
- package/dist/components/FormField/FormField.js.map +1 -1
- package/dist/components/FormItem/FormItem.d.ts +2 -3
- package/dist/components/FormItem/FormItem.js.map +1 -1
- package/dist/components/FormLayout/FormLayout.d.ts +2 -4
- package/dist/components/FormLayout/FormLayout.js.map +1 -1
- package/dist/components/FormLayoutGroup/FormLayoutGroup.js +1 -0
- package/dist/components/FormLayoutGroup/FormLayoutGroup.js.map +1 -1
- package/dist/components/GridAvatar/GridAvatar.d.ts +9 -0
- package/dist/components/GridAvatar/GridAvatar.js +41 -0
- package/dist/components/GridAvatar/GridAvatar.js.map +1 -0
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/HorizontalCell/HorizontalCell.d.ts +2 -3
- package/dist/components/HorizontalCell/HorizontalCell.js.map +1 -1
- package/dist/components/HorizontalScroll/HorizontalScroll.d.ts +3 -2
- package/dist/components/HorizontalScroll/HorizontalScroll.js +10 -12
- package/dist/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/components/InitialsAvatar/InitialsAvatar.d.ts +33 -0
- package/dist/components/InitialsAvatar/InitialsAvatar.js +46 -0
- package/dist/components/InitialsAvatar/InitialsAvatar.js.map +1 -0
- package/dist/components/Link/Link.d.ts +1 -2
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/ModalRoot/ModalRoot.js +167 -376
- package/dist/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/components/ModalRoot/ModalRootContext.js +0 -3
- package/dist/components/ModalRoot/ModalRootContext.js.map +1 -1
- package/dist/components/ModalRoot/ModalRootDesktop.js +58 -244
- package/dist/components/ModalRoot/ModalRootDesktop.js.map +1 -1
- package/dist/components/ModalRoot/types.d.ts +0 -1
- package/dist/components/ModalRoot/types.js.map +1 -1
- package/dist/components/ModalRoot/useModalManager.d.ts +37 -0
- package/dist/components/ModalRoot/useModalManager.js +189 -0
- package/dist/components/ModalRoot/useModalManager.js.map +1 -0
- package/dist/components/NativeSelect/NativeSelect.js +2 -2
- package/dist/components/NativeSelect/NativeSelect.js.map +1 -1
- package/dist/components/Removable/Removable.d.ts +2 -1
- package/dist/components/Removable/Removable.js +73 -64
- package/dist/components/Removable/Removable.js.map +1 -1
- package/dist/components/SelectMimicry/SelectMimicry.js +2 -2
- package/dist/components/SelectMimicry/SelectMimicry.js.map +1 -1
- package/dist/components/SimpleCell/SimpleCell.d.ts +2 -2
- package/dist/components/SimpleCell/SimpleCell.js.map +1 -1
- package/dist/components/SplitCol/SplitCol.d.ts +3 -3
- package/dist/components/SplitCol/SplitCol.js +2 -4
- package/dist/components/SplitCol/SplitCol.js.map +1 -1
- package/dist/components/SubnavigationBar/SubnavigationBar.d.ts +2 -1
- package/dist/components/SubnavigationBar/SubnavigationBar.js +38 -11
- package/dist/components/SubnavigationBar/SubnavigationBar.js.map +1 -1
- package/dist/components/SubnavigationButton/SubnavigationButton.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +2 -3
- package/dist/components/Switch/Switch.js +15 -8
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Tabbar/Tabbar.js +3 -1
- package/dist/components/Tabbar/Tabbar.js.map +1 -1
- package/dist/components/TabbarItem/TabbarItem.d.ts +3 -1
- package/dist/components/TabbarItem/TabbarItem.js +26 -10
- package/dist/components/TabbarItem/TabbarItem.js.map +1 -1
- package/dist/components/Tappable/Tappable.d.ts +2 -3
- package/dist/components/Tappable/Tappable.js.map +1 -1
- package/dist/components/Textarea/Textarea.js +9 -6
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Touch/Touch.d.ts +16 -17
- package/dist/components/Touch/Touch.js +21 -7
- package/dist/components/Touch/Touch.js.map +1 -1
- package/dist/components/Typography/Caption/Caption.d.ts +2 -2
- package/dist/components/Typography/Caption/Caption.js +4 -2
- package/dist/components/Typography/Caption/Caption.js.map +1 -1
- package/dist/components/Typography/Headline/Headline.d.ts +2 -2
- package/dist/components/Typography/Headline/Headline.js +2 -1
- package/dist/components/Typography/Headline/Headline.js.map +1 -1
- package/dist/components/Typography/Subhead/Subhead.d.ts +2 -2
- package/dist/components/Typography/Subhead/Subhead.js +2 -1
- package/dist/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/components/Typography/Text/Text.d.ts +2 -3
- package/dist/components/Typography/Text/Text.js +2 -1
- package/dist/components/Typography/Text/Text.js.map +1 -1
- package/dist/components/Typography/Title/Title.d.ts +2 -2
- package/dist/components/Typography/Title/Title.js +9 -4
- package/dist/components/Typography/Title/Title.js.map +1 -1
- package/dist/components/View/View.js +67 -75
- package/dist/components/View/View.js.map +1 -1
- package/dist/components/View/ViewInfinite.js +79 -87
- package/dist/components/View/ViewInfinite.js.map +1 -1
- package/dist/components/View/utils.d.ts +2 -0
- package/dist/components/View/utils.js +6 -0
- package/dist/components/View/utils.js.map +1 -0
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/ActionSheet/ActionSheet.js +6 -9
- package/dist/cssm/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/cssm/components/Avatar/Avatar.js +4 -2
- package/dist/cssm/components/Avatar/Avatar.js.map +1 -1
- package/dist/cssm/components/Banner/Banner.js.map +1 -1
- package/dist/cssm/components/Button/Button.css +1 -1
- package/dist/cssm/components/Button/Button.js.map +1 -1
- package/dist/cssm/components/CardScroll/CardScroll.js +1 -1
- package/dist/cssm/components/CardScroll/CardScroll.js.map +1 -1
- package/dist/cssm/components/Cell/Cell.css +1 -1
- package/dist/cssm/components/Cell/Cell.js +103 -177
- package/dist/cssm/components/Cell/Cell.js.map +1 -1
- package/dist/cssm/components/Cell/CellCheckbox/CellCheckbox.css +1 -0
- package/dist/cssm/components/Cell/CellCheckbox/CellCheckbox.js +32 -0
- package/dist/cssm/components/Cell/CellCheckbox/CellCheckbox.js.map +1 -0
- package/dist/cssm/components/Cell/CellDragger/CellDragger.css +1 -0
- package/dist/cssm/components/Cell/CellDragger/CellDragger.js +31 -0
- package/dist/cssm/components/Cell/CellDragger/CellDragger.js.map +1 -0
- package/dist/cssm/components/Cell/useDraggable.js +126 -0
- package/dist/cssm/components/Cell/useDraggable.js.map +1 -0
- package/dist/cssm/components/ChipsSelect/ChipsSelect.js +2 -2
- package/dist/cssm/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/cssm/components/Counter/Counter.js.map +1 -1
- package/dist/cssm/components/CustomSelect/CustomSelect.js +3 -5
- package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cssm/components/DropdownIcon/DropdownIcon.css +1 -0
- package/dist/cssm/components/DropdownIcon/DropdownIcon.js +20 -0
- package/dist/cssm/components/DropdownIcon/DropdownIcon.js.map +1 -0
- package/dist/cssm/components/FocusTrap/FocusTrap.js +3 -5
- package/dist/cssm/components/FocusTrap/FocusTrap.js.map +1 -1
- package/dist/cssm/components/FocusVisible/FocusVisible.css +1 -1
- package/dist/cssm/components/FormField/FormField.css +1 -1
- package/dist/cssm/components/FormField/FormField.js.map +1 -1
- package/dist/cssm/components/FormItem/FormItem.css +1 -1
- package/dist/cssm/components/FormItem/FormItem.js.map +1 -1
- package/dist/cssm/components/FormLayout/FormLayout.js.map +1 -1
- package/dist/cssm/components/FormLayoutGroup/FormLayoutGroup.css +1 -1
- package/dist/cssm/components/FormLayoutGroup/FormLayoutGroup.js +1 -0
- package/dist/cssm/components/FormLayoutGroup/FormLayoutGroup.js.map +1 -1
- package/dist/cssm/components/Gallery/Gallery.css +1 -1
- package/dist/cssm/components/GridAvatar/GridAvatar.css +1 -0
- package/dist/cssm/components/GridAvatar/GridAvatar.js +42 -0
- package/dist/cssm/components/GridAvatar/GridAvatar.js.map +1 -0
- package/dist/cssm/components/Header/Header.js.map +1 -1
- package/dist/cssm/components/HorizontalCell/HorizontalCell.js.map +1 -1
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.js +10 -12
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/cssm/components/HorizontalScroll/HorizontalScrollArrow.css +1 -1
- package/dist/cssm/components/IconButton/IconButton.css +1 -1
- package/dist/cssm/components/InitialsAvatar/InitialsAvatar.css +1 -0
- package/dist/cssm/components/InitialsAvatar/InitialsAvatar.js +52 -0
- package/dist/cssm/components/InitialsAvatar/InitialsAvatar.js.map +1 -0
- package/dist/cssm/components/Link/Link.js.map +1 -1
- package/dist/cssm/components/ModalRoot/ModalRoot.js +167 -376
- package/dist/cssm/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cssm/components/ModalRoot/ModalRootContext.js +0 -3
- package/dist/cssm/components/ModalRoot/ModalRootContext.js.map +1 -1
- package/dist/cssm/components/ModalRoot/ModalRootDesktop.js +58 -244
- package/dist/cssm/components/ModalRoot/ModalRootDesktop.js.map +1 -1
- package/dist/cssm/components/ModalRoot/types.js.map +1 -1
- package/dist/cssm/components/ModalRoot/useModalManager.js +189 -0
- package/dist/cssm/components/ModalRoot/useModalManager.js.map +1 -0
- package/dist/cssm/components/NativeSelect/NativeSelect.js +2 -2
- package/dist/cssm/components/NativeSelect/NativeSelect.js.map +1 -1
- package/dist/cssm/components/Removable/Removable.css +1 -1
- package/dist/cssm/components/Removable/Removable.js +73 -64
- package/dist/cssm/components/Removable/Removable.js.map +1 -1
- package/dist/cssm/components/Search/Search.css +1 -1
- package/dist/cssm/components/Select/Select.css +1 -1
- package/dist/cssm/components/SelectMimicry/SelectMimicry.js +2 -2
- package/dist/cssm/components/SelectMimicry/SelectMimicry.js.map +1 -1
- package/dist/cssm/components/SimpleCell/SimpleCell.css +1 -1
- package/dist/cssm/components/SimpleCell/SimpleCell.js.map +1 -1
- package/dist/cssm/components/SplitCol/SplitCol.js +2 -4
- package/dist/cssm/components/SplitCol/SplitCol.js.map +1 -1
- package/dist/cssm/components/SubnavigationBar/SubnavigationBar.js +38 -11
- package/dist/cssm/components/SubnavigationBar/SubnavigationBar.js.map +1 -1
- package/dist/cssm/components/SubnavigationButton/SubnavigationButton.js.map +1 -1
- package/dist/cssm/components/Switch/Switch.css +1 -1
- package/dist/cssm/components/Switch/Switch.js +15 -8
- package/dist/cssm/components/Switch/Switch.js.map +1 -1
- package/dist/cssm/components/Tabbar/Tabbar.css +1 -1
- package/dist/cssm/components/Tabbar/Tabbar.js +3 -1
- package/dist/cssm/components/Tabbar/Tabbar.js.map +1 -1
- package/dist/cssm/components/TabbarItem/TabbarItem.css +1 -1
- package/dist/cssm/components/TabbarItem/TabbarItem.js +26 -10
- package/dist/cssm/components/TabbarItem/TabbarItem.js.map +1 -1
- package/dist/cssm/components/Tappable/Tappable.js.map +1 -1
- package/dist/cssm/components/Textarea/Textarea.js +9 -6
- package/dist/cssm/components/Textarea/Textarea.js.map +1 -1
- package/dist/cssm/components/Touch/Touch.js +21 -7
- package/dist/cssm/components/Touch/Touch.js.map +1 -1
- package/dist/cssm/components/Typography/Caption/Caption.js +4 -2
- package/dist/cssm/components/Typography/Caption/Caption.js.map +1 -1
- package/dist/cssm/components/Typography/Headline/Headline.js +2 -1
- package/dist/cssm/components/Typography/Headline/Headline.js.map +1 -1
- package/dist/cssm/components/Typography/Subhead/Subhead.js +2 -1
- package/dist/cssm/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/cssm/components/Typography/Text/Text.js +2 -1
- package/dist/cssm/components/Typography/Text/Text.js.map +1 -1
- package/dist/cssm/components/Typography/Title/Title.js +9 -4
- package/dist/cssm/components/Typography/Title/Title.js.map +1 -1
- package/dist/cssm/components/View/View.js +67 -75
- package/dist/cssm/components/View/View.js.map +1 -1
- package/dist/cssm/components/View/ViewInfinite.js +79 -87
- package/dist/cssm/components/View/ViewInfinite.js.map +1 -1
- package/dist/cssm/components/View/utils.js +6 -0
- package/dist/cssm/components/View/utils.js.map +1 -0
- package/dist/cssm/index.js +2 -0
- package/dist/cssm/index.js.map +1 -1
- package/dist/cssm/lib/accessibility.js.map +1 -1
- package/dist/cssm/lib/prefixClass.js +7 -6
- package/dist/cssm/lib/prefixClass.js.map +1 -1
- package/dist/cssm/lib/supportEvents.js +1 -4
- package/dist/cssm/lib/supportEvents.js.map +1 -1
- package/dist/cssm/styles/components.css +1 -1
- package/dist/cssm/styles/themes.css +1 -1
- package/dist/cssm/styles/vkcom_light.css +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/accessibility.d.ts +1 -1
- package/dist/lib/accessibility.js.map +1 -1
- package/dist/lib/prefixClass.js +7 -6
- package/dist/lib/prefixClass.js.map +1 -1
- package/dist/lib/supportEvents.d.ts +3 -1
- package/dist/lib/supportEvents.js +1 -4
- package/dist/lib/supportEvents.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/vkui.css +2 -2
- package/dist/vkui.css.map +1 -1
- package/package.json +8 -4
- package/src/components/ActionSheet/ActionSheet.tsx +4 -5
- package/src/components/ActionSheet/Readme.md +18 -14
- package/src/components/Alert/Readme.md +15 -11
- package/src/components/Avatar/Avatar.tsx +5 -2
- package/src/components/Banner/Banner.tsx +4 -5
- package/src/components/Button/Button.css +26 -53
- package/src/components/Button/Button.tsx +2 -3
- package/src/components/Card/Readme.md +6 -6
- package/src/components/CardScroll/CardScroll.tsx +4 -1
- package/src/components/Cell/Cell.css +21 -58
- package/src/components/Cell/Cell.tsx +101 -162
- package/src/components/Cell/CellCheckbox/CellCheckbox.css +17 -0
- package/src/components/Cell/CellCheckbox/CellCheckbox.tsx +42 -0
- package/src/components/Cell/CellDragger/CellDragger.css +4 -0
- package/src/components/Cell/CellDragger/CellDragger.tsx +40 -0
- package/src/components/Cell/Readme.md +89 -51
- package/src/components/Cell/useDraggable.tsx +112 -0
- package/src/components/ChipsSelect/ChipsSelect.tsx +2 -2
- package/src/components/Counter/Counter.tsx +2 -2
- package/src/components/CustomSelect/CustomSelect.tsx +3 -4
- package/src/components/DropdownIcon/DropdownIcon.css +3 -0
- package/src/components/DropdownIcon/DropdownIcon.tsx +20 -0
- package/src/components/Epic/Readme.md +2 -1
- package/src/components/FocusTrap/FocusTrap.tsx +13 -11
- package/src/components/FocusVisible/FocusVisible.css +12 -4
- package/src/components/FormField/FormField.css +0 -1
- package/src/components/FormField/FormField.tsx +2 -2
- package/src/components/FormItem/FormItem.css +13 -14
- package/src/components/FormItem/FormItem.tsx +2 -3
- package/src/components/FormLayout/FormLayout.tsx +2 -4
- package/src/components/FormLayoutGroup/FormLayoutGroup.css +11 -7
- package/src/components/FormLayoutGroup/FormLayoutGroup.tsx +10 -1
- package/src/components/Gallery/Gallery.css +2 -3
- package/src/components/Gallery/Readme.md +89 -109
- package/src/components/GridAvatar/GridAvatar.css +37 -0
- package/src/components/GridAvatar/GridAvatar.tsx +55 -0
- package/src/components/GridAvatar/Readme.md +12 -0
- package/src/components/Group/Readme.md +18 -14
- package/src/components/Header/Header.tsx +4 -4
- package/src/components/HorizontalCell/HorizontalCell.tsx +3 -3
- package/src/components/HorizontalScroll/HorizontalScroll.tsx +14 -18
- package/src/components/HorizontalScroll/HorizontalScrollArrow.css +2 -2
- package/src/components/IconButton/IconButton.css +7 -0
- package/src/components/InitialsAvatar/InitialsAvatar.css +53 -0
- package/src/components/InitialsAvatar/InitialsAvatar.tsx +90 -0
- package/src/components/InitialsAvatar/Readme.md +14 -0
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/MiniInfoCell/Readme.md +66 -62
- package/src/components/ModalDismissButton/Readme.md +13 -10
- package/src/components/ModalRoot/ModalRoot.tsx +159 -349
- package/src/components/ModalRoot/ModalRootContext.tsx +0 -1
- package/src/components/ModalRoot/ModalRootDesktop.tsx +54 -240
- package/src/components/ModalRoot/Readme.md +35 -27
- package/src/components/ModalRoot/types.ts +0 -1
- package/src/components/ModalRoot/useModalManager.tsx +174 -0
- package/src/components/NativeSelect/NativeSelect.tsx +2 -2
- package/src/components/Removable/Removable.css +16 -63
- package/src/components/Removable/Removable.tsx +84 -64
- package/src/components/ScreenSpinner/Readme.md +13 -9
- package/src/components/Search/Search.css +1 -1
- package/src/components/Select/Select.css +1 -1
- package/src/components/SelectMimicry/SelectMimicry.tsx +2 -2
- package/src/components/SimpleCell/SimpleCell.css +10 -18
- package/src/components/SimpleCell/SimpleCell.tsx +3 -5
- package/src/components/SplitCol/SplitCol.tsx +4 -8
- package/src/components/SplitLayout/Readme.md +2 -2
- package/src/components/SubnavigationBar/Readme.md +90 -86
- package/src/components/SubnavigationBar/SubnavigationBar.tsx +32 -14
- package/src/components/SubnavigationButton/SubnavigationButton.tsx +2 -3
- package/src/components/Switch/Readme.md +6 -6
- package/src/components/Switch/Switch.css +46 -15
- package/src/components/Switch/Switch.tsx +16 -8
- package/src/components/Tabbar/Tabbar.css +15 -4
- package/src/components/Tabbar/Tabbar.tsx +3 -1
- package/src/components/TabbarItem/Readme.md +72 -0
- package/src/components/TabbarItem/TabbarItem.css +65 -14
- package/src/components/TabbarItem/TabbarItem.tsx +46 -22
- package/src/components/Tappable/Tappable.tsx +2 -3
- package/src/components/Textarea/Readme.md +3 -0
- package/src/components/Textarea/Textarea.tsx +10 -6
- package/src/components/Touch/Touch.tsx +38 -25
- package/src/components/Typography/Caption/Caption.tsx +4 -4
- package/src/components/Typography/Headline/Headline.tsx +3 -3
- package/src/components/Typography/Subhead/Subhead.tsx +3 -3
- package/src/components/Typography/Text/Text.tsx +3 -4
- package/src/components/Typography/Title/Title.tsx +9 -5
- package/src/components/View/Readme.md +42 -56
- package/src/components/View/View.tsx +46 -61
- package/src/components/View/ViewInfinite.tsx +52 -67
- package/src/components/View/utils.ts +8 -0
- package/src/index.ts +4 -0
- package/src/lib/accessibility.ts +2 -2
- package/src/lib/prefixClass.ts +9 -6
- package/src/lib/supportEvents.ts +1 -4
- package/src/styles/components.css +4 -0
- package/src/styles/vkcom_light.css +3 -3
- package/src/testing/utils.tsx +34 -1
- package/src/types.ts +4 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -16,7 +15,6 @@ import { getClassName } from "../../helpers/getClassName";
|
|
|
16
15
|
import { classNames } from "../../lib/classNames";
|
|
17
16
|
import { setTransformStyle } from "../../lib/styles";
|
|
18
17
|
import { rubber } from "../../lib/touch";
|
|
19
|
-
import { isFunction } from "../../lib/utils";
|
|
20
18
|
import { ANDROID, IOS, VKCOM } from "../../lib/platform";
|
|
21
19
|
import { transitionEvent } from "../../lib/supportEvents";
|
|
22
20
|
import { withPlatform } from "../../hoc/withPlatform";
|
|
@@ -29,6 +27,7 @@ import { withDOM } from "../../lib/dom";
|
|
|
29
27
|
import { getNavId } from "../../lib/getNavId";
|
|
30
28
|
import { warnOnce } from "../../lib/warnOnce";
|
|
31
29
|
import { FocusTrap } from "../FocusTrap/FocusTrap";
|
|
30
|
+
import { withModalManager } from "./useModalManager";
|
|
32
31
|
import "./ModalRoot.css";
|
|
33
32
|
var warn = warnOnce('ModalRoot');
|
|
34
33
|
var IS_DEV = process.env.NODE_ENV === 'development';
|
|
@@ -53,12 +52,8 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
53
52
|
|
|
54
53
|
_this = _super.call(this, props);
|
|
55
54
|
|
|
56
|
-
_defineProperty(_assertThisInitialized(_this), "modalsState", void 0);
|
|
57
|
-
|
|
58
55
|
_defineProperty(_assertThisInitialized(_this), "documentScrolling", void 0);
|
|
59
56
|
|
|
60
|
-
_defineProperty(_assertThisInitialized(_this), "activeTransitions", void 0);
|
|
61
|
-
|
|
62
57
|
_defineProperty(_assertThisInitialized(_this), "maskElementRef", void 0);
|
|
63
58
|
|
|
64
59
|
_defineProperty(_assertThisInitialized(_this), "viewportRef", /*#__PURE__*/React.createRef());
|
|
@@ -88,26 +83,16 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
88
83
|
});
|
|
89
84
|
|
|
90
85
|
_defineProperty(_assertThisInitialized(_this), "updateModalTranslate", function () {
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
if (!activeModal) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
var modalState = _this.modalsState[activeModal];
|
|
86
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
98
87
|
|
|
99
|
-
_this.animateTranslate(modalState, modalState.translateY);
|
|
88
|
+
modalState && _this.animateTranslate(modalState, modalState.translateY);
|
|
100
89
|
});
|
|
101
90
|
|
|
102
91
|
_defineProperty(_assertThisInitialized(_this), "updateModalHeight", function () {
|
|
103
|
-
var
|
|
104
|
-
activeModal = _this$state.activeModal,
|
|
105
|
-
nextModal = _this$state.nextModal;
|
|
106
|
-
var modalId = activeModal || nextModal;
|
|
107
|
-
var modalState = modalId ? _this.modalsState[modalId] : undefined;
|
|
92
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
108
93
|
|
|
109
94
|
if (modalState && modalState.type === ModalType.PAGE && modalState.dynamicContentHeight) {
|
|
110
|
-
if (_this.
|
|
95
|
+
if (_this.props.enteringModal) {
|
|
111
96
|
_this.waitTransitionFinish(modalState, function () {
|
|
112
97
|
requestAnimationFrame(function () {
|
|
113
98
|
return _this.checkPageContentHeight();
|
|
@@ -122,18 +107,16 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
122
107
|
});
|
|
123
108
|
|
|
124
109
|
_defineProperty(_assertThisInitialized(_this), "onTouchMove", function (e) {
|
|
125
|
-
if (_this.
|
|
110
|
+
if (_this.props.exitingModal) {
|
|
126
111
|
return;
|
|
127
112
|
}
|
|
128
113
|
|
|
129
|
-
var
|
|
114
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
130
115
|
|
|
131
|
-
if (!
|
|
116
|
+
if (!modalState) {
|
|
132
117
|
return;
|
|
133
118
|
}
|
|
134
119
|
|
|
135
|
-
var modalState = _this.modalsState[activeModal];
|
|
136
|
-
|
|
137
120
|
if (modalState.type === ModalType.PAGE) {
|
|
138
121
|
return _this.onPageTouchMove(e, modalState);
|
|
139
122
|
}
|
|
@@ -144,13 +127,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
144
127
|
});
|
|
145
128
|
|
|
146
129
|
_defineProperty(_assertThisInitialized(_this), "onTouchEnd", function (e) {
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
if (!activeModal) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
var modalState = _this.modalsState[activeModal];
|
|
130
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
154
131
|
|
|
155
132
|
if (modalState.type === ModalType.PAGE) {
|
|
156
133
|
return _this.onPageTouchEnd(e, modalState);
|
|
@@ -162,14 +139,14 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
162
139
|
});
|
|
163
140
|
|
|
164
141
|
_defineProperty(_assertThisInitialized(_this), "onScroll", function (e) {
|
|
165
|
-
var activeModal = _this.
|
|
142
|
+
var activeModal = _this.props.activeModal;
|
|
166
143
|
var target = e.target;
|
|
167
144
|
|
|
168
145
|
if (!activeModal) {
|
|
169
146
|
return;
|
|
170
147
|
}
|
|
171
148
|
|
|
172
|
-
var modalState = _this.
|
|
149
|
+
var modalState = _this.getModalState(activeModal);
|
|
173
150
|
|
|
174
151
|
if (modalState.type === ModalType.PAGE && modalState.contentElement.contains(target)) {
|
|
175
152
|
modalState.contentScrolled = true;
|
|
@@ -182,86 +159,22 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
182
159
|
}
|
|
183
160
|
});
|
|
184
161
|
|
|
185
|
-
_defineProperty(_assertThisInitialized(_this), "prevNextSwitchEndHandler", function () {
|
|
186
|
-
_this.activeTransitions = Math.max(0, _this.activeTransitions - 1);
|
|
187
|
-
|
|
188
|
-
if (_this.activeTransitions > 0) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
var activeModal = _this.state.nextModal;
|
|
193
|
-
var newState = {
|
|
194
|
-
prevModal: null,
|
|
195
|
-
nextModal: null,
|
|
196
|
-
visibleModals: [activeModal],
|
|
197
|
-
activeModal: activeModal,
|
|
198
|
-
animated: false,
|
|
199
|
-
switching: false
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
if (!activeModal) {
|
|
203
|
-
newState.history = [];
|
|
204
|
-
|
|
205
|
-
if (_this.restoreFocusTo) {
|
|
206
|
-
_this.restoreFocusTo.focus();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
_this.setState(newState);
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
_defineProperty(_assertThisInitialized(_this), "triggerActiveModalClose", function () {
|
|
214
|
-
var activeModalState = _this.modalsState[_this.state.activeModal];
|
|
215
|
-
|
|
216
|
-
if (activeModalState) {
|
|
217
|
-
_this.doCloseModal(activeModalState);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
_defineProperty(_assertThisInitialized(_this), "doCloseModal", function (modalState) {
|
|
222
|
-
// Сбрасываем состояния, которые могут помешать закрытию модального окна
|
|
223
|
-
_this.setState({
|
|
224
|
-
touchDown: false,
|
|
225
|
-
switching: false
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
if (isFunction(modalState.onClose)) {
|
|
229
|
-
modalState.onClose();
|
|
230
|
-
} else if (isFunction(_this.props.onClose)) {
|
|
231
|
-
_this.props.onClose(modalState.id);
|
|
232
|
-
} else if (IS_DEV) {
|
|
233
|
-
warn('onClose is undefined');
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
var _activeModal = props.activeModal;
|
|
238
162
|
_this.state = {
|
|
239
|
-
activeModal: null,
|
|
240
|
-
prevModal: null,
|
|
241
|
-
nextModal: _activeModal,
|
|
242
|
-
visibleModals: _activeModal ? [_activeModal] : [],
|
|
243
|
-
animated: !!_activeModal,
|
|
244
|
-
switching: false,
|
|
245
|
-
history: _activeModal ? [_activeModal] : [],
|
|
246
|
-
isBack: false,
|
|
247
|
-
inited: false,
|
|
248
163
|
touchDown: false,
|
|
249
164
|
dragging: false
|
|
250
165
|
};
|
|
251
|
-
_this.activeTransitions = 0;
|
|
252
166
|
_this.maskElementRef = /*#__PURE__*/React.createRef();
|
|
253
|
-
|
|
254
|
-
_this.initModalsState();
|
|
255
|
-
|
|
256
167
|
_this.modalRootContext = {
|
|
257
168
|
updateModalHeight: _this.updateModalHeight,
|
|
258
169
|
registerModal: function registerModal(_ref) {
|
|
259
170
|
var id = _ref.id,
|
|
260
171
|
data = _objectWithoutProperties(_ref, _excluded);
|
|
261
172
|
|
|
262
|
-
return Object.assign(_this.
|
|
173
|
+
return Object.assign(_this.getModalState(id), data);
|
|
174
|
+
},
|
|
175
|
+
onClose: function onClose() {
|
|
176
|
+
return _this.props.closeActiveModal();
|
|
263
177
|
},
|
|
264
|
-
onClose: _this.triggerActiveModalClose,
|
|
265
178
|
isInsideModal: true
|
|
266
179
|
};
|
|
267
180
|
_this.frameIds = {};
|
|
@@ -283,100 +196,64 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
283
196
|
get: function get() {
|
|
284
197
|
return this.props.window;
|
|
285
198
|
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "getModalState",
|
|
201
|
+
value: function getModalState(id) {
|
|
202
|
+
return this.props.getModalState(id);
|
|
203
|
+
}
|
|
286
204
|
}, {
|
|
287
205
|
key: "getModals",
|
|
288
206
|
value: function getModals() {
|
|
289
207
|
return React.Children.toArray(this.props.children);
|
|
290
208
|
}
|
|
291
|
-
}, {
|
|
292
|
-
key: "initModalsState",
|
|
293
|
-
value: function initModalsState() {
|
|
294
|
-
this.modalsState = this.getModals().reduce(function (acc, Modal) {
|
|
295
|
-
var modalProps = Modal.props;
|
|
296
|
-
var state = {
|
|
297
|
-
id: getNavId(modalProps, warn),
|
|
298
|
-
onClose: Modal.props.onClose,
|
|
299
|
-
dynamicContentHeight: !!modalProps.dynamicContentHeight
|
|
300
|
-
}; // ModalPage props
|
|
301
|
-
|
|
302
|
-
if (typeof modalProps.settlingHeight === 'number') {
|
|
303
|
-
state.settlingHeight = modalProps.settlingHeight;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
acc[state.id] = state;
|
|
307
|
-
return acc;
|
|
308
|
-
}, {});
|
|
309
|
-
}
|
|
310
209
|
}, {
|
|
311
210
|
key: "componentDidMount",
|
|
312
211
|
value: function componentDidMount() {
|
|
313
|
-
|
|
212
|
+
// Отслеживаем изменение размеров viewport (Необходимо для iOS)
|
|
213
|
+
if (this.props.platform === IOS) {
|
|
214
|
+
this.window.addEventListener('resize', this.updateModalTranslate, false);
|
|
215
|
+
}
|
|
314
216
|
}
|
|
315
217
|
}, {
|
|
316
218
|
key: "componentWillUnmount",
|
|
317
219
|
value: function componentWillUnmount() {
|
|
318
220
|
this.toggleDocumentScrolling(true);
|
|
319
|
-
|
|
320
|
-
if (this.props.platform === IOS) {
|
|
321
|
-
this.window.removeEventListener('resize', this.updateModalTranslate, false);
|
|
322
|
-
}
|
|
221
|
+
this.window.removeEventListener('resize', this.updateModalTranslate, false);
|
|
323
222
|
}
|
|
324
223
|
}, {
|
|
325
224
|
key: "componentDidUpdate",
|
|
326
|
-
value: function componentDidUpdate(prevProps
|
|
225
|
+
value: function componentDidUpdate(prevProps) {
|
|
327
226
|
var _this2 = this;
|
|
328
227
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
228
|
+
// transition phase 2: animate exiting modal
|
|
229
|
+
if (this.props.exitingModal && this.props.exitingModal !== prevProps.exitingModal) {
|
|
230
|
+
this.closeModal(this.props.exitingModal);
|
|
231
|
+
} // transition phase 3: animate entering modal
|
|
332
232
|
|
|
333
|
-
if (IS_DEV && nextModal !== null && !this.modalsState[nextModal]) {
|
|
334
|
-
return warn("[componentDidUpdate] nextModal ".concat(nextModal, " not found"));
|
|
335
|
-
}
|
|
336
233
|
|
|
337
|
-
|
|
234
|
+
if (this.props.enteringModal && this.props.enteringModal !== prevProps.enteringModal) {
|
|
235
|
+
var enteringModal = this.props.enteringModal;
|
|
236
|
+
var enteringState = this.getModalState(enteringModal);
|
|
237
|
+
this.waitTransitionFinish(enteringState, function () {
|
|
238
|
+
enteringState.innerElement.style.transitionDelay = null;
|
|
338
239
|
|
|
339
|
-
|
|
240
|
+
_this2.props.onEnter(enteringModal);
|
|
241
|
+
});
|
|
242
|
+
enteringState.innerElement.style.transitionDelay = this.props.delayEnter ? "".concat(this.timeout, "ms") : null;
|
|
243
|
+
this.animateTranslate(enteringState, enteringState.translateY);
|
|
244
|
+
} // focus restoration
|
|
340
245
|
|
|
341
|
-
if (nextModal === null) {
|
|
342
|
-
history = [];
|
|
343
|
-
} else if (history.includes(nextModal)) {
|
|
344
|
-
history = history.splice(0, history.indexOf(nextModal) + 1);
|
|
345
|
-
isBack = true;
|
|
346
|
-
} else {
|
|
347
|
-
history.push(nextModal);
|
|
348
|
-
}
|
|
349
246
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
nextModal: nextModal,
|
|
353
|
-
prevModal: prevModal,
|
|
354
|
-
visibleModals: [nextModal, prevModal],
|
|
355
|
-
history: history,
|
|
356
|
-
isBack: isBack,
|
|
357
|
-
animated: true,
|
|
358
|
-
inited: false,
|
|
359
|
-
switching: false
|
|
360
|
-
}, function () {
|
|
361
|
-
if (nextModal === null) {
|
|
362
|
-
_this2.closeActiveModal();
|
|
363
|
-
} else {
|
|
364
|
-
_this2.initActiveModal();
|
|
365
|
-
}
|
|
366
|
-
});
|
|
247
|
+
if (this.props.activeModal && !prevProps.activeModal) {
|
|
248
|
+
this.restoreFocusTo = this.document.activeElement;
|
|
367
249
|
}
|
|
368
250
|
|
|
369
|
-
if (this.
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
});
|
|
251
|
+
if (!this.props.activeModal && !this.props.exitingModal && this.restoreFocusTo) {
|
|
252
|
+
this.restoreFocusTo.focus();
|
|
253
|
+
this.restoreFocusTo = null;
|
|
373
254
|
}
|
|
374
255
|
|
|
375
|
-
|
|
376
|
-
this.toggleDocumentScrolling(true);
|
|
377
|
-
} else {
|
|
378
|
-
this.toggleDocumentScrolling(false);
|
|
379
|
-
}
|
|
256
|
+
this.toggleDocumentScrolling(!this.props.activeModal && !this.props.exitingModal);
|
|
380
257
|
}
|
|
381
258
|
/* Отключает скролл документа */
|
|
382
259
|
|
|
@@ -403,113 +280,15 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
403
280
|
});
|
|
404
281
|
}
|
|
405
282
|
}
|
|
406
|
-
}, {
|
|
407
|
-
key: "initActiveModal",
|
|
408
|
-
value:
|
|
409
|
-
/**
|
|
410
|
-
* Инициализирует модалку перед анимацией открытия
|
|
411
|
-
*/
|
|
412
|
-
function initActiveModal() {
|
|
413
|
-
var activeModal = this.state.activeModal || this.state.nextModal;
|
|
414
|
-
|
|
415
|
-
if (!activeModal) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
var modalState = this.modalsState[activeModal]; // Отслеживаем изменение размеров viewport (Необходимо для iOS)
|
|
420
|
-
|
|
421
|
-
if (this.props.platform === IOS) {
|
|
422
|
-
this.window.addEventListener('resize', this.updateModalTranslate, false);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
switch (modalState.type) {
|
|
426
|
-
case ModalType.PAGE:
|
|
427
|
-
modalState.settlingHeight = modalState.settlingHeight || MODAL_PAGE_DEFAULT_PERCENT_HEIGHT;
|
|
428
|
-
this.initPageModal(modalState);
|
|
429
|
-
break;
|
|
430
|
-
|
|
431
|
-
case ModalType.CARD:
|
|
432
|
-
this.initCardModal(modalState);
|
|
433
|
-
break;
|
|
434
|
-
|
|
435
|
-
default:
|
|
436
|
-
if (IS_DEV) {
|
|
437
|
-
warn('[initActiveModal] modalState.type is unknown');
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
this.setState({
|
|
443
|
-
inited: true,
|
|
444
|
-
switching: true
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
}, {
|
|
448
|
-
key: "initPageModal",
|
|
449
|
-
value: function initPageModal(modalState) {
|
|
450
|
-
var contentElement = modalState.contentElement;
|
|
451
|
-
var contentHeight = contentElement.firstElementChild.offsetHeight;
|
|
452
|
-
var prevTranslateY = modalState.translateY;
|
|
453
|
-
modalState.expandable = contentHeight > contentElement.clientHeight || modalState.settlingHeight === 100;
|
|
454
|
-
var collapsed = false;
|
|
455
|
-
var expanded = false;
|
|
456
|
-
var translateYFrom;
|
|
457
|
-
var translateY;
|
|
458
|
-
var expandedRange;
|
|
459
|
-
var collapsedRange;
|
|
460
|
-
var hiddenRange;
|
|
461
|
-
|
|
462
|
-
if (modalState.expandable) {
|
|
463
|
-
translateYFrom = 100 - modalState.settlingHeight;
|
|
464
|
-
var shiftHalf = translateYFrom / 2;
|
|
465
|
-
var visiblePart = 100 - translateYFrom;
|
|
466
|
-
expandedRange = [0, shiftHalf];
|
|
467
|
-
collapsedRange = [shiftHalf, translateYFrom + visiblePart / 4];
|
|
468
|
-
hiddenRange = [translateYFrom + visiblePart / 4, 100];
|
|
469
|
-
collapsed = translateYFrom > 0;
|
|
470
|
-
expanded = translateYFrom <= 0;
|
|
471
|
-
translateY = translateYFrom;
|
|
472
|
-
} else {
|
|
473
|
-
var headerHeight = modalState.headerElement.offsetHeight;
|
|
474
|
-
var height = contentHeight + headerHeight;
|
|
475
|
-
translateYFrom = 100 - height / modalState.innerElement.parentElement.offsetHeight * 100;
|
|
476
|
-
translateY = translateYFrom;
|
|
477
|
-
expandedRange = [translateY, translateY + 25];
|
|
478
|
-
collapsedRange = [translateY + 25, translateY + 25];
|
|
479
|
-
hiddenRange = [translateY + 25, translateY + 100];
|
|
480
|
-
} // Если модалка может открываться на весь экран, и новый сдвиг больше предыдущего, то откроем её на весь экран
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
if (modalState.expandable && translateY > prevTranslateY || modalState.settlingHeight === 100) {
|
|
484
|
-
translateY = 0;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
modalState.expandedRange = expandedRange;
|
|
488
|
-
modalState.collapsedRange = collapsedRange;
|
|
489
|
-
modalState.hiddenRange = hiddenRange;
|
|
490
|
-
modalState.translateY = translateY;
|
|
491
|
-
modalState.translateYFrom = translateYFrom;
|
|
492
|
-
modalState.collapsed = collapsed;
|
|
493
|
-
modalState.expanded = expanded;
|
|
494
|
-
}
|
|
495
|
-
}, {
|
|
496
|
-
key: "initCardModal",
|
|
497
|
-
value: function initCardModal(modalState) {
|
|
498
|
-
modalState.translateY = 0;
|
|
499
|
-
}
|
|
500
283
|
}, {
|
|
501
284
|
key: "checkPageContentHeight",
|
|
502
285
|
value: function checkPageContentHeight() {
|
|
503
|
-
var
|
|
504
|
-
activeModal = _this$state2.activeModal,
|
|
505
|
-
nextModal = _this$state2.nextModal;
|
|
506
|
-
var modalId = activeModal || nextModal;
|
|
507
|
-
var modalState = this.modalsState[modalId];
|
|
286
|
+
var modalState = this.getModalState(this.props.activeModal);
|
|
508
287
|
|
|
509
288
|
if ((modalState === null || modalState === void 0 ? void 0 : modalState.type) === ModalType.PAGE && modalState !== null && modalState !== void 0 && modalState.modalElement) {
|
|
510
289
|
var prevModalState = _objectSpread({}, modalState);
|
|
511
290
|
|
|
512
|
-
|
|
291
|
+
initPageModal(modalState);
|
|
513
292
|
|
|
514
293
|
var currentModalState = _objectSpread({}, modalState);
|
|
515
294
|
|
|
@@ -529,28 +308,34 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
529
308
|
}
|
|
530
309
|
}
|
|
531
310
|
}, {
|
|
532
|
-
key: "
|
|
533
|
-
value: function
|
|
311
|
+
key: "closeModal",
|
|
312
|
+
value: function closeModal(id) {
|
|
313
|
+
var _this3 = this;
|
|
314
|
+
|
|
534
315
|
// Сбрасываем состояния, которые могут помешать закрытию модального окна
|
|
535
316
|
this.setState({
|
|
536
|
-
touchDown: false
|
|
537
|
-
switching: false
|
|
317
|
+
touchDown: false
|
|
538
318
|
});
|
|
319
|
+
var prevModalState = this.getModalState(id);
|
|
539
320
|
|
|
540
|
-
if (
|
|
541
|
-
|
|
321
|
+
if (!prevModalState) {
|
|
322
|
+
id && warn("[closeActiveModal] Modal ".concat(id, " does not exist - not closing"));
|
|
323
|
+
return;
|
|
542
324
|
}
|
|
543
325
|
|
|
544
|
-
var
|
|
326
|
+
var nextModalState = this.getModalState(this.props.activeModal);
|
|
327
|
+
var nextIsPage = !!nextModalState && nextModalState.type === ModalType.PAGE;
|
|
328
|
+
var prevIsPage = !!prevModalState && prevModalState.type === ModalType.PAGE;
|
|
329
|
+
this.waitTransitionFinish(prevModalState, function () {
|
|
330
|
+
return _this3.props.onExit(id);
|
|
331
|
+
});
|
|
332
|
+
var exitTranslate = prevIsPage && nextIsPage && prevModalState.translateY <= nextModalState.translateYFrom && !this.props.isBack ? nextModalState.translateYFrom + 10 : 100;
|
|
333
|
+
this.animateTranslate(prevModalState, exitTranslate);
|
|
545
334
|
|
|
546
|
-
if (!
|
|
547
|
-
|
|
335
|
+
if (!nextModalState) {
|
|
336
|
+
// NOTE: was only for clean exit
|
|
337
|
+
this.setMaskOpacity(prevModalState, 0);
|
|
548
338
|
}
|
|
549
|
-
|
|
550
|
-
var prevModalState = this.modalsState[prevModal];
|
|
551
|
-
this.waitTransitionFinish(prevModalState, this.prevNextSwitchEndHandler);
|
|
552
|
-
this.animateTranslate(prevModalState, 100);
|
|
553
|
-
this.setMaskOpacity(prevModalState, 0);
|
|
554
339
|
}
|
|
555
340
|
}, {
|
|
556
341
|
key: "onPageTouchMove",
|
|
@@ -636,7 +421,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
636
421
|
}, {
|
|
637
422
|
key: "onPageTouchEnd",
|
|
638
423
|
value: function onPageTouchEnd(event, modalState) {
|
|
639
|
-
var
|
|
424
|
+
var _this4 = this;
|
|
640
425
|
|
|
641
426
|
var startY = event.startY,
|
|
642
427
|
shiftY = event.shiftY;
|
|
@@ -679,15 +464,15 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
679
464
|
modalState.hidden = translateY === 100;
|
|
680
465
|
|
|
681
466
|
if (modalState.hidden) {
|
|
682
|
-
this.
|
|
467
|
+
this.props.closeActiveModal();
|
|
683
468
|
}
|
|
684
469
|
|
|
685
470
|
setStateCallback = function setStateCallback() {
|
|
686
471
|
if (!modalState.hidden) {
|
|
687
|
-
|
|
472
|
+
_this4.animateTranslate(modalState, modalState.translateY);
|
|
688
473
|
}
|
|
689
474
|
|
|
690
|
-
|
|
475
|
+
_this4.setMaskOpacity(modalState);
|
|
691
476
|
};
|
|
692
477
|
}
|
|
693
478
|
|
|
@@ -699,7 +484,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
699
484
|
}, {
|
|
700
485
|
key: "onCardTouchEnd",
|
|
701
486
|
value: function onCardTouchEnd(_ref2, modalState) {
|
|
702
|
-
var
|
|
487
|
+
var _this5 = this;
|
|
703
488
|
|
|
704
489
|
var duration = _ref2.duration;
|
|
705
490
|
var setStateCallback;
|
|
@@ -719,15 +504,15 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
719
504
|
modalState.hidden = translateY === 100;
|
|
720
505
|
|
|
721
506
|
if (modalState.hidden) {
|
|
722
|
-
this.
|
|
507
|
+
this.props.closeActiveModal();
|
|
723
508
|
}
|
|
724
509
|
|
|
725
510
|
setStateCallback = function setStateCallback() {
|
|
726
511
|
if (!modalState.hidden) {
|
|
727
|
-
|
|
512
|
+
_this5.animateTranslate(modalState, modalState.translateY);
|
|
728
513
|
}
|
|
729
514
|
|
|
730
|
-
|
|
515
|
+
_this5.setMaskOpacity(modalState);
|
|
731
516
|
};
|
|
732
517
|
}
|
|
733
518
|
|
|
@@ -750,76 +535,20 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
750
535
|
setTimeout(eventHandler, this.timeout);
|
|
751
536
|
}
|
|
752
537
|
}
|
|
753
|
-
}, {
|
|
754
|
-
key: "switchPrevNext",
|
|
755
|
-
value: function switchPrevNext() {
|
|
756
|
-
var _this5 = this;
|
|
757
|
-
|
|
758
|
-
var _this$state3 = this.state,
|
|
759
|
-
prevModal = _this$state3.prevModal,
|
|
760
|
-
nextModal = _this$state3.nextModal;
|
|
761
|
-
var prevModalState = this.modalsState[prevModal];
|
|
762
|
-
var nextModalState = this.modalsState[nextModal];
|
|
763
|
-
|
|
764
|
-
if (IS_DEV && !prevModalState && !nextModalState) {
|
|
765
|
-
return warn("[switchPrevNext] prevModal is ".concat(prevModal, ", nextModal is ").concat(nextModal));
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
var prevIsPage = !!prevModalState && prevModalState.type === ModalType.PAGE;
|
|
769
|
-
var prevIsCard = !!prevModalState && prevModalState.type === ModalType.CARD;
|
|
770
|
-
var nextIsPage = !!nextModalState && nextModalState.type === ModalType.PAGE;
|
|
771
|
-
var nextIsCard = !!nextModalState && nextModalState.type === ModalType.CARD; // Ждём полного скрытия предыдущей модалки
|
|
772
|
-
|
|
773
|
-
if (prevModalState && (nextIsCard || prevIsCard && nextIsPage)) {
|
|
774
|
-
this.waitTransitionFinish(prevModalState, function () {
|
|
775
|
-
_this5.activeTransitions += 1;
|
|
776
|
-
|
|
777
|
-
_this5.waitTransitionFinish(nextModalState, _this5.prevNextSwitchEndHandler);
|
|
778
|
-
|
|
779
|
-
_this5.animateTranslate(nextModalState, nextModalState.translateY);
|
|
780
|
-
});
|
|
781
|
-
return this.animateTranslate(prevModalState, 100);
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
if (prevModalState && nextIsPage) {
|
|
785
|
-
this.activeTransitions += 1;
|
|
786
|
-
this.waitTransitionFinish(prevModalState, this.prevNextSwitchEndHandler);
|
|
787
|
-
|
|
788
|
-
if (prevIsPage && prevModalState.translateY <= nextModalState.translateYFrom && !this.state.isBack) {
|
|
789
|
-
this.animateTranslate(prevModalState, nextModalState.translateYFrom + 10);
|
|
790
|
-
} else {
|
|
791
|
-
this.animateTranslate(prevModalState, 100);
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
if (!prevModal && this.document.activeElement) {
|
|
796
|
-
this.restoreFocusTo = this.document.activeElement;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
this.activeTransitions += 1;
|
|
800
|
-
this.waitTransitionFinish(nextModalState, this.prevNextSwitchEndHandler);
|
|
801
|
-
this.animateTranslate(nextModalState, nextModalState.translateY);
|
|
802
|
-
}
|
|
803
|
-
}, {
|
|
804
|
-
key: "animateTranslate",
|
|
805
|
-
value:
|
|
806
538
|
/**
|
|
807
539
|
* Анимирует сдвиг модалки
|
|
808
540
|
*
|
|
809
541
|
* @param {ModalsStateEntry} modalState
|
|
810
542
|
* @param {number} percent Процент сдвига: 0 – полностью открыта, 100 – полностью закрыта
|
|
811
543
|
*/
|
|
812
|
-
|
|
544
|
+
|
|
545
|
+
}, {
|
|
546
|
+
key: "animateTranslate",
|
|
547
|
+
value: function animateTranslate(modalState, percent) {
|
|
813
548
|
var frameId = "animateTranslateFrame".concat(modalState.id);
|
|
814
549
|
cancelAnimationFrame(this.frameIds[frameId]);
|
|
815
550
|
this.frameIds[frameId] = requestAnimationFrame(function () {
|
|
816
551
|
setTransformStyle(modalState.innerElement, "translate3d(0, ".concat(percent, "%, 0)"));
|
|
817
|
-
|
|
818
|
-
if (modalState.type === ModalType.PAGE && modalState.footerElement) {
|
|
819
|
-
var footerHeight = modalState.footerElement.offsetHeight;
|
|
820
|
-
var factor = modalState.innerElement.offsetHeight * (percent / 100);
|
|
821
|
-
setTransformStyle(modalState.footerElement, "translateY(calc(".concat(footerHeight, "px * -").concat(factor / footerHeight, "))"));
|
|
822
|
-
}
|
|
823
552
|
});
|
|
824
553
|
}
|
|
825
554
|
/* Устанавливает прозрачность для полупрозрачной подложки */
|
|
@@ -831,7 +560,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
831
560
|
|
|
832
561
|
var forceOpacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
833
562
|
|
|
834
|
-
if (forceOpacity === null && this.
|
|
563
|
+
if (forceOpacity === null && this.props.history[0] !== modalState.id) {
|
|
835
564
|
return;
|
|
836
565
|
}
|
|
837
566
|
|
|
@@ -845,26 +574,20 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
845
574
|
}
|
|
846
575
|
});
|
|
847
576
|
}
|
|
848
|
-
/**
|
|
849
|
-
* Закрывает текущую модалку
|
|
850
|
-
*/
|
|
851
|
-
|
|
852
577
|
}, {
|
|
853
578
|
key: "render",
|
|
854
579
|
value: function render() {
|
|
855
580
|
var _this7 = this;
|
|
856
581
|
|
|
857
|
-
var _this$
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
if (!activeModal && !prevModal && !nextModal && !animated) {
|
|
582
|
+
var _this$props = this.props,
|
|
583
|
+
activeModal = _this$props.activeModal,
|
|
584
|
+
exitingModal = _this$props.exitingModal,
|
|
585
|
+
enteringModal = _this$props.enteringModal;
|
|
586
|
+
var _this$state = this.state,
|
|
587
|
+
touchDown = _this$state.touchDown,
|
|
588
|
+
dragging = _this$state.dragging;
|
|
589
|
+
|
|
590
|
+
if (!activeModal && !exitingModal) {
|
|
868
591
|
return null;
|
|
869
592
|
}
|
|
870
593
|
|
|
@@ -876,14 +599,14 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
876
599
|
vkuiClass: classNames(getClassName('ModalRoot', this.props.platform), {
|
|
877
600
|
'ModalRoot--vkapps': this.props.configProvider.webviewType === WebviewType.VKAPPS,
|
|
878
601
|
'ModalRoot--touched': touchDown,
|
|
879
|
-
'ModalRoot--switching':
|
|
602
|
+
'ModalRoot--switching': !!(enteringModal || exitingModal)
|
|
880
603
|
}),
|
|
881
604
|
onMove: this.onTouchMove,
|
|
882
605
|
onEnd: this.onTouchEnd,
|
|
883
606
|
onScroll: this.onScroll
|
|
884
607
|
}, createScopedElement("div", {
|
|
885
608
|
vkuiClass: "ModalRoot__mask",
|
|
886
|
-
onClick: this.
|
|
609
|
+
onClick: this.props.closeActiveModal,
|
|
887
610
|
ref: this.maskElementRef
|
|
888
611
|
}), createScopedElement("div", {
|
|
889
612
|
vkuiClass: "ModalRoot__viewport",
|
|
@@ -891,25 +614,25 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
891
614
|
}, this.getModals().map(function (Modal) {
|
|
892
615
|
var modalId = getNavId(Modal.props, warn);
|
|
893
616
|
|
|
894
|
-
if (
|
|
617
|
+
if (modalId !== activeModal && modalId !== exitingModal) {
|
|
895
618
|
return null;
|
|
896
619
|
}
|
|
897
620
|
|
|
898
|
-
var modalState = _objectSpread({}, _this7.
|
|
621
|
+
var modalState = _objectSpread({}, _this7.getModalState(modalId));
|
|
899
622
|
|
|
900
623
|
var isPage = modalState.type === ModalType.PAGE;
|
|
901
624
|
var key = "modal-".concat(modalId);
|
|
902
625
|
return createScopedElement(FocusTrap, {
|
|
903
626
|
key: key,
|
|
904
627
|
getRootRef: function getRootRef(e) {
|
|
905
|
-
return _this7.
|
|
628
|
+
return _this7.getModalState(modalId).modalElement = e;
|
|
906
629
|
},
|
|
907
|
-
onClose: _this7.
|
|
630
|
+
onClose: _this7.props.closeActiveModal,
|
|
908
631
|
timeout: _this7.timeout,
|
|
909
632
|
vkuiClass: classNames('ModalRoot__modal', {
|
|
910
633
|
'ModalRoot__modal--active': modalId === activeModal,
|
|
911
|
-
'ModalRoot__modal--prev': modalId ===
|
|
912
|
-
'ModalRoot__modal--next': modalId ===
|
|
634
|
+
'ModalRoot__modal--prev': modalId === exitingModal,
|
|
635
|
+
'ModalRoot__modal--next': exitingModal && modalId === activeModal || modalId === enteringModal,
|
|
913
636
|
'ModalRoot__modal--dragging': dragging,
|
|
914
637
|
'ModalRoot__modal--expandable': isPage && modalState.expandable,
|
|
915
638
|
'ModalRoot__modal--expanded': isPage && modalState.expanded,
|
|
@@ -924,5 +647,73 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
924
647
|
return ModalRootTouchComponent;
|
|
925
648
|
}(React.Component);
|
|
926
649
|
|
|
927
|
-
export var ModalRootTouch = withContext(withPlatform(withDOM(ModalRootTouchComponent)), ConfigProviderContext, 'configProvider');
|
|
650
|
+
export var ModalRootTouch = withContext(withPlatform(withDOM(withModalManager(initModal)(ModalRootTouchComponent))), ConfigProviderContext, 'configProvider');
|
|
651
|
+
/**
|
|
652
|
+
* Инициализирует модалку перед анимацией открытия
|
|
653
|
+
*/
|
|
654
|
+
|
|
655
|
+
function initModal(modalState) {
|
|
656
|
+
switch (modalState.type) {
|
|
657
|
+
case ModalType.PAGE:
|
|
658
|
+
modalState.settlingHeight = modalState.settlingHeight || MODAL_PAGE_DEFAULT_PERCENT_HEIGHT;
|
|
659
|
+
return initPageModal(modalState);
|
|
660
|
+
|
|
661
|
+
case ModalType.CARD:
|
|
662
|
+
return initCardModal(modalState);
|
|
663
|
+
|
|
664
|
+
default:
|
|
665
|
+
IS_DEV && warn('[initActiveModal] modalState.type is unknown');
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function initPageModal(modalState) {
|
|
670
|
+
var contentElement = modalState.contentElement;
|
|
671
|
+
var contentHeight = contentElement.firstElementChild.offsetHeight;
|
|
672
|
+
var prevTranslateY = modalState.translateY;
|
|
673
|
+
modalState.expandable = contentHeight > contentElement.clientHeight || modalState.settlingHeight === 100;
|
|
674
|
+
var collapsed = false;
|
|
675
|
+
var expanded = false;
|
|
676
|
+
var translateYFrom;
|
|
677
|
+
var translateY;
|
|
678
|
+
var expandedRange;
|
|
679
|
+
var collapsedRange;
|
|
680
|
+
var hiddenRange;
|
|
681
|
+
|
|
682
|
+
if (modalState.expandable) {
|
|
683
|
+
translateYFrom = 100 - modalState.settlingHeight;
|
|
684
|
+
var shiftHalf = translateYFrom / 2;
|
|
685
|
+
var visiblePart = 100 - translateYFrom;
|
|
686
|
+
expandedRange = [0, shiftHalf];
|
|
687
|
+
collapsedRange = [shiftHalf, translateYFrom + visiblePart / 4];
|
|
688
|
+
hiddenRange = [translateYFrom + visiblePart / 4, 100];
|
|
689
|
+
collapsed = translateYFrom > 0;
|
|
690
|
+
expanded = translateYFrom <= 0;
|
|
691
|
+
translateY = translateYFrom;
|
|
692
|
+
} else {
|
|
693
|
+
var headerHeight = modalState.headerElement.offsetHeight;
|
|
694
|
+
var height = contentHeight + headerHeight;
|
|
695
|
+
translateYFrom = 100 - height / modalState.innerElement.parentElement.offsetHeight * 100;
|
|
696
|
+
translateY = translateYFrom;
|
|
697
|
+
expandedRange = [translateY, translateY + 25];
|
|
698
|
+
collapsedRange = [translateY + 25, translateY + 25];
|
|
699
|
+
hiddenRange = [translateY + 25, translateY + 100];
|
|
700
|
+
} // Если модалка может открываться на весь экран, и новый сдвиг больше предыдущего, то откроем её на весь экран
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
if (modalState.expandable && translateY > prevTranslateY || modalState.settlingHeight === 100) {
|
|
704
|
+
translateY = 0;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
modalState.expandedRange = expandedRange;
|
|
708
|
+
modalState.collapsedRange = collapsedRange;
|
|
709
|
+
modalState.hiddenRange = hiddenRange;
|
|
710
|
+
modalState.translateY = translateY;
|
|
711
|
+
modalState.translateYFrom = translateYFrom;
|
|
712
|
+
modalState.collapsed = collapsed;
|
|
713
|
+
modalState.expanded = expanded;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function initCardModal(modalState) {
|
|
717
|
+
modalState.translateY = 0;
|
|
718
|
+
}
|
|
928
719
|
//# sourceMappingURL=ModalRoot.js.map
|