@vkontakte/vkui 4.19.0 → 4.22.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/.cache/.eslintcache +1 -1
- package/.cache/.stylelintcache +1 -1
- package/.cache/.tsbuildinfo +493 -125
- package/.cache/ts/src/components/ActionSheet/types.d.ts +2 -2
- package/.cache/ts/src/components/Alert/Alert.d.ts +1 -0
- package/.cache/ts/src/components/AppRoot/AppRootContext.d.ts +1 -0
- 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 +8 -0
- 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/PullToRefresh/PullToRefresh.d.ts +0 -1
- 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/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 +4 -2
- package/.cache/ts/src/lib/is.d.ts +1 -0
- package/.cache/ts/src/lib/supportEvents.d.ts +3 -1
- package/.cache/ts/src/testing/utils.d.ts +2 -0
- package/.cache/ts/src/types.d.ts +3 -0
- package/dist/cjs/components/ActionSheet/ActionSheet.js +13 -12
- package/dist/cjs/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/cjs/components/ActionSheet/ActionSheetDropdown.js +3 -1
- package/dist/cjs/components/ActionSheet/ActionSheetDropdown.js.map +1 -1
- package/dist/cjs/components/ActionSheet/ActionSheetDropdownDesktop.js +10 -5
- package/dist/cjs/components/ActionSheet/ActionSheetDropdownDesktop.js.map +1 -1
- package/dist/cjs/components/ActionSheet/types.d.ts +2 -2
- package/dist/cjs/components/Alert/Alert.d.ts +1 -0
- package/dist/cjs/components/Alert/Alert.js +12 -3
- package/dist/cjs/components/Alert/Alert.js.map +1 -1
- package/dist/cjs/components/AppRoot/AppRoot.js +2 -1
- package/dist/cjs/components/AppRoot/AppRoot.js.map +1 -1
- package/dist/cjs/components/AppRoot/AppRootContext.d.ts +1 -0
- package/dist/cjs/components/AppRoot/AppRootContext.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/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 +140 -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 +6 -4
- package/dist/cjs/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.js +6 -4
- package/dist/cjs/components/DatePicker/DatePicker.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 +8 -0
- package/dist/cjs/components/FocusTrap/FocusTrap.js +165 -0
- package/dist/cjs/components/FocusTrap/FocusTrap.js.map +1 -0
- 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 +184 -368
- 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 +74 -244
- 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/PullToRefresh/PullToRefresh.d.ts +0 -1
- package/dist/cjs/components/PullToRefresh/PullToRefresh.js +34 -25
- package/dist/cjs/components/PullToRefresh/PullToRefresh.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/Root/Root.js +1 -0
- package/dist/cjs/components/Root/Root.js.map +1 -1
- package/dist/cjs/components/Search/Search.js +1 -1
- package/dist/cjs/components/Search/Search.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/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 +34 -14
- 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 +4 -2
- package/dist/cjs/lib/accessibility.js +8 -1
- package/dist/cjs/lib/accessibility.js.map +1 -1
- package/dist/cjs/lib/is.d.ts +1 -0
- package/dist/cjs/lib/is.js +13 -0
- package/dist/cjs/lib/is.js.map +1 -0
- 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 +12 -12
- package/dist/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/components/ActionSheet/ActionSheetDropdown.js +2 -1
- package/dist/components/ActionSheet/ActionSheetDropdown.js.map +1 -1
- package/dist/components/ActionSheet/ActionSheetDropdownDesktop.js +9 -5
- package/dist/components/ActionSheet/ActionSheetDropdownDesktop.js.map +1 -1
- package/dist/components/ActionSheet/types.d.ts +2 -2
- package/dist/components/Alert/Alert.d.ts +1 -0
- package/dist/components/Alert/Alert.js +11 -3
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/AppRoot/AppRoot.js +2 -1
- package/dist/components/AppRoot/AppRoot.js.map +1 -1
- package/dist/components/AppRoot/AppRootContext.d.ts +1 -0
- package/dist/components/AppRoot/AppRootContext.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/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 +125 -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 +6 -6
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +6 -4
- package/dist/components/DatePicker/DatePicker.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 +8 -0
- package/dist/components/FocusTrap/FocusTrap.js +138 -0
- package/dist/components/FocusTrap/FocusTrap.js.map +1 -0
- 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 +181 -371
- 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 +72 -248
- 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/PullToRefresh/PullToRefresh.d.ts +0 -1
- package/dist/components/PullToRefresh/PullToRefresh.js +35 -25
- package/dist/components/PullToRefresh/PullToRefresh.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/Root/Root.js +1 -0
- package/dist/components/Root/Root.js.map +1 -1
- package/dist/components/Search/Search.js +1 -1
- package/dist/components/Search/Search.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/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 +34 -14
- 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 +12 -12
- package/dist/cssm/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/cssm/components/ActionSheet/ActionSheetDropdown.js +2 -1
- package/dist/cssm/components/ActionSheet/ActionSheetDropdown.js.map +1 -1
- package/dist/cssm/components/ActionSheet/ActionSheetDropdownDesktop.js +9 -5
- package/dist/cssm/components/ActionSheet/ActionSheetDropdownDesktop.js.map +1 -1
- package/dist/cssm/components/Alert/Alert.js +11 -3
- package/dist/cssm/components/Alert/Alert.js.map +1 -1
- package/dist/cssm/components/AppRoot/AppRoot.js +2 -1
- package/dist/cssm/components/AppRoot/AppRoot.js.map +1 -1
- package/dist/cssm/components/AppRoot/AppRootContext.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/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 +125 -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 +6 -6
- package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cssm/components/DatePicker/DatePicker.js +6 -4
- package/dist/cssm/components/DatePicker/DatePicker.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 +138 -0
- package/dist/cssm/components/FocusTrap/FocusTrap.js.map +1 -0
- 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 +181 -371
- 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 +72 -248
- 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/PullToRefresh/PullToRefresh.js +35 -25
- package/dist/cssm/components/PullToRefresh/PullToRefresh.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/Root/Root.css +1 -1
- package/dist/cssm/components/Root/Root.js +1 -0
- package/dist/cssm/components/Root/Root.js.map +1 -1
- package/dist/cssm/components/Search/Search.css +1 -1
- package/dist/cssm/components/Search/Search.js +1 -1
- package/dist/cssm/components/Search/Search.js.map +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/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 +34 -14
- 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 +6 -0
- package/dist/cssm/lib/accessibility.js.map +1 -1
- package/dist/cssm/lib/is.js +6 -0
- package/dist/cssm/lib/is.js.map +1 -0
- 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 +4 -2
- package/dist/lib/accessibility.js +6 -0
- package/dist/lib/accessibility.js.map +1 -1
- package/dist/lib/is.d.ts +1 -0
- package/dist/lib/is.js +6 -0
- package/dist/lib/is.js.map +1 -0
- 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 +9 -7
- package/src/components/ActionSheet/ActionSheetDropdown.tsx +3 -2
- package/src/components/ActionSheet/ActionSheetDropdownDesktop.tsx +9 -5
- package/src/components/ActionSheet/Readme.md +18 -14
- package/src/components/ActionSheet/types.ts +2 -2
- package/src/components/Alert/Alert.tsx +11 -4
- package/src/components/Alert/Readme.md +15 -11
- package/src/components/AppRoot/AppRoot.tsx +1 -0
- package/src/components/AppRoot/AppRootContext.ts +1 -0
- 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/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 +6 -5
- package/src/components/DatePicker/DatePicker.tsx +5 -5
- package/src/components/DropdownIcon/DropdownIcon.css +3 -0
- package/src/components/DropdownIcon/DropdownIcon.tsx +20 -0
- package/src/components/Epic/Readme.md +1 -1
- package/src/components/FocusTrap/FocusTrap.tsx +125 -0
- 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 +170 -344
- package/src/components/ModalRoot/ModalRootContext.tsx +0 -1
- package/src/components/ModalRoot/ModalRootDesktop.tsx +62 -243
- 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/PullToRefresh/PullToRefresh.tsx +30 -25
- package/src/components/Removable/Removable.css +16 -63
- package/src/components/Removable/Removable.tsx +84 -64
- package/src/components/Root/Root.css +5 -0
- package/src/components/Root/Root.tsx +4 -1
- package/src/components/ScreenSpinner/Readme.md +13 -9
- package/src/components/Search/Search.css +1 -1
- package/src/components/Search/Search.tsx +3 -3
- 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/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 +51 -31
- 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 +22 -2
- package/src/lib/is.ts +10 -0
- 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 +41 -0
- 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";
|
|
@@ -28,6 +26,8 @@ import { MODAL_PAGE_DEFAULT_PERCENT_HEIGHT } from "./constants";
|
|
|
28
26
|
import { withDOM } from "../../lib/dom";
|
|
29
27
|
import { getNavId } from "../../lib/getNavId";
|
|
30
28
|
import { warnOnce } from "../../lib/warnOnce";
|
|
29
|
+
import { FocusTrap } from "../FocusTrap/FocusTrap";
|
|
30
|
+
import { withModalManager } from "./useModalManager";
|
|
31
31
|
import "./ModalRoot.css";
|
|
32
32
|
var warn = warnOnce('ModalRoot');
|
|
33
33
|
var IS_DEV = process.env.NODE_ENV === 'development';
|
|
@@ -52,12 +52,8 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
52
52
|
|
|
53
53
|
_this = _super.call(this, props);
|
|
54
54
|
|
|
55
|
-
_defineProperty(_assertThisInitialized(_this), "modalsState", void 0);
|
|
56
|
-
|
|
57
55
|
_defineProperty(_assertThisInitialized(_this), "documentScrolling", void 0);
|
|
58
56
|
|
|
59
|
-
_defineProperty(_assertThisInitialized(_this), "activeTransitions", void 0);
|
|
60
|
-
|
|
61
57
|
_defineProperty(_assertThisInitialized(_this), "maskElementRef", void 0);
|
|
62
58
|
|
|
63
59
|
_defineProperty(_assertThisInitialized(_this), "viewportRef", /*#__PURE__*/React.createRef());
|
|
@@ -68,6 +64,8 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
68
64
|
|
|
69
65
|
_defineProperty(_assertThisInitialized(_this), "frameIds", void 0);
|
|
70
66
|
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "restoreFocusTo", void 0);
|
|
68
|
+
|
|
71
69
|
_defineProperty(_assertThisInitialized(_this), "preventTouch", function (event) {
|
|
72
70
|
if (!event) {
|
|
73
71
|
return false;
|
|
@@ -85,26 +83,16 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
85
83
|
});
|
|
86
84
|
|
|
87
85
|
_defineProperty(_assertThisInitialized(_this), "updateModalTranslate", function () {
|
|
88
|
-
var
|
|
89
|
-
|
|
90
|
-
if (!activeModal) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var modalState = _this.modalsState[activeModal];
|
|
86
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
95
87
|
|
|
96
|
-
_this.animateTranslate(modalState, modalState.translateY);
|
|
88
|
+
modalState && _this.animateTranslate(modalState, modalState.translateY);
|
|
97
89
|
});
|
|
98
90
|
|
|
99
91
|
_defineProperty(_assertThisInitialized(_this), "updateModalHeight", function () {
|
|
100
|
-
var
|
|
101
|
-
activeModal = _this$state.activeModal,
|
|
102
|
-
nextModal = _this$state.nextModal;
|
|
103
|
-
var modalId = activeModal || nextModal;
|
|
104
|
-
var modalState = modalId ? _this.modalsState[modalId] : undefined;
|
|
92
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
105
93
|
|
|
106
94
|
if (modalState && modalState.type === ModalType.PAGE && modalState.dynamicContentHeight) {
|
|
107
|
-
if (_this.
|
|
95
|
+
if (_this.props.enteringModal) {
|
|
108
96
|
_this.waitTransitionFinish(modalState, function () {
|
|
109
97
|
requestAnimationFrame(function () {
|
|
110
98
|
return _this.checkPageContentHeight();
|
|
@@ -119,18 +107,16 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
119
107
|
});
|
|
120
108
|
|
|
121
109
|
_defineProperty(_assertThisInitialized(_this), "onTouchMove", function (e) {
|
|
122
|
-
if (_this.
|
|
110
|
+
if (_this.props.exitingModal) {
|
|
123
111
|
return;
|
|
124
112
|
}
|
|
125
113
|
|
|
126
|
-
var
|
|
114
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
127
115
|
|
|
128
|
-
if (!
|
|
116
|
+
if (!modalState) {
|
|
129
117
|
return;
|
|
130
118
|
}
|
|
131
119
|
|
|
132
|
-
var modalState = _this.modalsState[activeModal];
|
|
133
|
-
|
|
134
120
|
if (modalState.type === ModalType.PAGE) {
|
|
135
121
|
return _this.onPageTouchMove(e, modalState);
|
|
136
122
|
}
|
|
@@ -141,13 +127,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
141
127
|
});
|
|
142
128
|
|
|
143
129
|
_defineProperty(_assertThisInitialized(_this), "onTouchEnd", function (e) {
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
if (!activeModal) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var modalState = _this.modalsState[activeModal];
|
|
130
|
+
var modalState = _this.getModalState(_this.props.activeModal);
|
|
151
131
|
|
|
152
132
|
if (modalState.type === ModalType.PAGE) {
|
|
153
133
|
return _this.onPageTouchEnd(e, modalState);
|
|
@@ -159,14 +139,14 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
159
139
|
});
|
|
160
140
|
|
|
161
141
|
_defineProperty(_assertThisInitialized(_this), "onScroll", function (e) {
|
|
162
|
-
var activeModal = _this.
|
|
142
|
+
var activeModal = _this.props.activeModal;
|
|
163
143
|
var target = e.target;
|
|
164
144
|
|
|
165
145
|
if (!activeModal) {
|
|
166
146
|
return;
|
|
167
147
|
}
|
|
168
148
|
|
|
169
|
-
var modalState = _this.
|
|
149
|
+
var modalState = _this.getModalState(activeModal);
|
|
170
150
|
|
|
171
151
|
if (modalState.type === ModalType.PAGE && modalState.contentElement.contains(target)) {
|
|
172
152
|
modalState.contentScrolled = true;
|
|
@@ -179,82 +159,22 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
179
159
|
}
|
|
180
160
|
});
|
|
181
161
|
|
|
182
|
-
_defineProperty(_assertThisInitialized(_this), "prevNextSwitchEndHandler", function () {
|
|
183
|
-
_this.activeTransitions = Math.max(0, _this.activeTransitions - 1);
|
|
184
|
-
|
|
185
|
-
if (_this.activeTransitions > 0) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
var activeModal = _this.state.nextModal;
|
|
190
|
-
var newState = {
|
|
191
|
-
prevModal: null,
|
|
192
|
-
nextModal: null,
|
|
193
|
-
visibleModals: [activeModal],
|
|
194
|
-
activeModal: activeModal,
|
|
195
|
-
animated: false,
|
|
196
|
-
switching: false
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
if (!activeModal) {
|
|
200
|
-
newState.history = [];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
_this.setState(newState);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
_defineProperty(_assertThisInitialized(_this), "triggerActiveModalClose", function () {
|
|
207
|
-
var activeModalState = _this.modalsState[_this.state.activeModal];
|
|
208
|
-
|
|
209
|
-
if (activeModalState) {
|
|
210
|
-
_this.doCloseModal(activeModalState);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
_defineProperty(_assertThisInitialized(_this), "doCloseModal", function (modalState) {
|
|
215
|
-
// Сбрасываем состояния, которые могут помешать закрытию модального окна
|
|
216
|
-
_this.setState({
|
|
217
|
-
touchDown: false,
|
|
218
|
-
switching: false
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
if (isFunction(modalState.onClose)) {
|
|
222
|
-
modalState.onClose();
|
|
223
|
-
} else if (isFunction(_this.props.onClose)) {
|
|
224
|
-
_this.props.onClose(modalState.id);
|
|
225
|
-
} else if (IS_DEV) {
|
|
226
|
-
warn('onClose is undefined');
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
var _activeModal = props.activeModal;
|
|
231
162
|
_this.state = {
|
|
232
|
-
activeModal: null,
|
|
233
|
-
prevModal: null,
|
|
234
|
-
nextModal: _activeModal,
|
|
235
|
-
visibleModals: _activeModal ? [_activeModal] : [],
|
|
236
|
-
animated: !!_activeModal,
|
|
237
|
-
switching: false,
|
|
238
|
-
history: _activeModal ? [_activeModal] : [],
|
|
239
|
-
isBack: false,
|
|
240
|
-
inited: false,
|
|
241
163
|
touchDown: false,
|
|
242
164
|
dragging: false
|
|
243
165
|
};
|
|
244
|
-
_this.activeTransitions = 0;
|
|
245
166
|
_this.maskElementRef = /*#__PURE__*/React.createRef();
|
|
246
|
-
|
|
247
|
-
_this.initModalsState();
|
|
248
|
-
|
|
249
167
|
_this.modalRootContext = {
|
|
250
168
|
updateModalHeight: _this.updateModalHeight,
|
|
251
169
|
registerModal: function registerModal(_ref) {
|
|
252
170
|
var id = _ref.id,
|
|
253
171
|
data = _objectWithoutProperties(_ref, _excluded);
|
|
254
172
|
|
|
255
|
-
return Object.assign(_this.
|
|
173
|
+
return Object.assign(_this.getModalState(id), data);
|
|
174
|
+
},
|
|
175
|
+
onClose: function onClose() {
|
|
176
|
+
return _this.props.closeActiveModal();
|
|
256
177
|
},
|
|
257
|
-
onClose: _this.triggerActiveModalClose,
|
|
258
178
|
isInsideModal: true
|
|
259
179
|
};
|
|
260
180
|
_this.frameIds = {};
|
|
@@ -262,6 +182,11 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
262
182
|
}
|
|
263
183
|
|
|
264
184
|
_createClass(ModalRootTouchComponent, [{
|
|
185
|
+
key: "timeout",
|
|
186
|
+
get: function get() {
|
|
187
|
+
return this.props.platform === ANDROID || this.props.platform === VKCOM ? 320 : 400;
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
265
190
|
key: "document",
|
|
266
191
|
get: function get() {
|
|
267
192
|
return this.props.document;
|
|
@@ -271,100 +196,64 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
271
196
|
get: function get() {
|
|
272
197
|
return this.props.window;
|
|
273
198
|
}
|
|
199
|
+
}, {
|
|
200
|
+
key: "getModalState",
|
|
201
|
+
value: function getModalState(id) {
|
|
202
|
+
return this.props.getModalState(id);
|
|
203
|
+
}
|
|
274
204
|
}, {
|
|
275
205
|
key: "getModals",
|
|
276
206
|
value: function getModals() {
|
|
277
207
|
return React.Children.toArray(this.props.children);
|
|
278
208
|
}
|
|
279
|
-
}, {
|
|
280
|
-
key: "initModalsState",
|
|
281
|
-
value: function initModalsState() {
|
|
282
|
-
this.modalsState = this.getModals().reduce(function (acc, Modal) {
|
|
283
|
-
var modalProps = Modal.props;
|
|
284
|
-
var state = {
|
|
285
|
-
id: getNavId(modalProps, warn),
|
|
286
|
-
onClose: Modal.props.onClose,
|
|
287
|
-
dynamicContentHeight: !!modalProps.dynamicContentHeight
|
|
288
|
-
}; // ModalPage props
|
|
289
|
-
|
|
290
|
-
if (typeof modalProps.settlingHeight === 'number') {
|
|
291
|
-
state.settlingHeight = modalProps.settlingHeight;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
acc[state.id] = state;
|
|
295
|
-
return acc;
|
|
296
|
-
}, {});
|
|
297
|
-
}
|
|
298
209
|
}, {
|
|
299
210
|
key: "componentDidMount",
|
|
300
211
|
value: function componentDidMount() {
|
|
301
|
-
|
|
212
|
+
// Отслеживаем изменение размеров viewport (Необходимо для iOS)
|
|
213
|
+
if (this.props.platform === IOS) {
|
|
214
|
+
this.window.addEventListener('resize', this.updateModalTranslate, false);
|
|
215
|
+
}
|
|
302
216
|
}
|
|
303
217
|
}, {
|
|
304
218
|
key: "componentWillUnmount",
|
|
305
219
|
value: function componentWillUnmount() {
|
|
306
220
|
this.toggleDocumentScrolling(true);
|
|
307
|
-
|
|
308
|
-
if (this.props.platform === IOS) {
|
|
309
|
-
this.window.removeEventListener('resize', this.updateModalTranslate, false);
|
|
310
|
-
}
|
|
221
|
+
this.window.removeEventListener('resize', this.updateModalTranslate, false);
|
|
311
222
|
}
|
|
312
223
|
}, {
|
|
313
224
|
key: "componentDidUpdate",
|
|
314
|
-
value: function componentDidUpdate(prevProps
|
|
225
|
+
value: function componentDidUpdate(prevProps) {
|
|
315
226
|
var _this2 = this;
|
|
316
227
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
|
|
320
232
|
|
|
321
|
-
if (IS_DEV && nextModal !== null && !this.modalsState[nextModal]) {
|
|
322
|
-
return warn("[componentDidUpdate] nextModal ".concat(nextModal, " not found"));
|
|
323
|
-
}
|
|
324
233
|
|
|
325
|
-
|
|
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;
|
|
326
239
|
|
|
327
|
-
|
|
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
|
|
328
245
|
|
|
329
|
-
if (nextModal === null) {
|
|
330
|
-
history = [];
|
|
331
|
-
} else if (history.includes(nextModal)) {
|
|
332
|
-
history = history.splice(0, history.indexOf(nextModal) + 1);
|
|
333
|
-
isBack = true;
|
|
334
|
-
} else {
|
|
335
|
-
history.push(nextModal);
|
|
336
|
-
}
|
|
337
246
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
nextModal: nextModal,
|
|
341
|
-
prevModal: prevModal,
|
|
342
|
-
visibleModals: [nextModal, prevModal],
|
|
343
|
-
history: history,
|
|
344
|
-
isBack: isBack,
|
|
345
|
-
animated: true,
|
|
346
|
-
inited: false,
|
|
347
|
-
switching: false
|
|
348
|
-
}, function () {
|
|
349
|
-
if (nextModal === null) {
|
|
350
|
-
_this2.closeActiveModal();
|
|
351
|
-
} else {
|
|
352
|
-
_this2.initActiveModal();
|
|
353
|
-
}
|
|
354
|
-
});
|
|
247
|
+
if (this.props.activeModal && !prevProps.activeModal) {
|
|
248
|
+
this.restoreFocusTo = this.document.activeElement;
|
|
355
249
|
}
|
|
356
250
|
|
|
357
|
-
if (this.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
});
|
|
251
|
+
if (!this.props.activeModal && !this.props.exitingModal && this.restoreFocusTo) {
|
|
252
|
+
this.restoreFocusTo.focus();
|
|
253
|
+
this.restoreFocusTo = null;
|
|
361
254
|
}
|
|
362
255
|
|
|
363
|
-
|
|
364
|
-
this.toggleDocumentScrolling(true);
|
|
365
|
-
} else {
|
|
366
|
-
this.toggleDocumentScrolling(false);
|
|
367
|
-
}
|
|
256
|
+
this.toggleDocumentScrolling(!this.props.activeModal && !this.props.exitingModal);
|
|
368
257
|
}
|
|
369
258
|
/* Отключает скролл документа */
|
|
370
259
|
|
|
@@ -391,113 +280,15 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
391
280
|
});
|
|
392
281
|
}
|
|
393
282
|
}
|
|
394
|
-
}, {
|
|
395
|
-
key: "initActiveModal",
|
|
396
|
-
value:
|
|
397
|
-
/**
|
|
398
|
-
* Инициализирует модалку перед анимацией открытия
|
|
399
|
-
*/
|
|
400
|
-
function initActiveModal() {
|
|
401
|
-
var activeModal = this.state.activeModal || this.state.nextModal;
|
|
402
|
-
|
|
403
|
-
if (!activeModal) {
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
var modalState = this.modalsState[activeModal]; // Отслеживаем изменение размеров viewport (Необходимо для iOS)
|
|
408
|
-
|
|
409
|
-
if (this.props.platform === IOS) {
|
|
410
|
-
this.window.addEventListener('resize', this.updateModalTranslate, false);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
switch (modalState.type) {
|
|
414
|
-
case ModalType.PAGE:
|
|
415
|
-
modalState.settlingHeight = modalState.settlingHeight || MODAL_PAGE_DEFAULT_PERCENT_HEIGHT;
|
|
416
|
-
this.initPageModal(modalState);
|
|
417
|
-
break;
|
|
418
|
-
|
|
419
|
-
case ModalType.CARD:
|
|
420
|
-
this.initCardModal(modalState);
|
|
421
|
-
break;
|
|
422
|
-
|
|
423
|
-
default:
|
|
424
|
-
if (IS_DEV) {
|
|
425
|
-
warn('[initActiveModal] modalState.type is unknown');
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
this.setState({
|
|
431
|
-
inited: true,
|
|
432
|
-
switching: true
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
}, {
|
|
436
|
-
key: "initPageModal",
|
|
437
|
-
value: function initPageModal(modalState) {
|
|
438
|
-
var contentElement = modalState.contentElement;
|
|
439
|
-
var contentHeight = contentElement.firstElementChild.offsetHeight;
|
|
440
|
-
var prevTranslateY = modalState.translateY;
|
|
441
|
-
modalState.expandable = contentHeight > contentElement.clientHeight || modalState.settlingHeight === 100;
|
|
442
|
-
var collapsed = false;
|
|
443
|
-
var expanded = false;
|
|
444
|
-
var translateYFrom;
|
|
445
|
-
var translateY;
|
|
446
|
-
var expandedRange;
|
|
447
|
-
var collapsedRange;
|
|
448
|
-
var hiddenRange;
|
|
449
|
-
|
|
450
|
-
if (modalState.expandable) {
|
|
451
|
-
translateYFrom = 100 - modalState.settlingHeight;
|
|
452
|
-
var shiftHalf = translateYFrom / 2;
|
|
453
|
-
var visiblePart = 100 - translateYFrom;
|
|
454
|
-
expandedRange = [0, shiftHalf];
|
|
455
|
-
collapsedRange = [shiftHalf, translateYFrom + visiblePart / 4];
|
|
456
|
-
hiddenRange = [translateYFrom + visiblePart / 4, 100];
|
|
457
|
-
collapsed = translateYFrom > 0;
|
|
458
|
-
expanded = translateYFrom <= 0;
|
|
459
|
-
translateY = translateYFrom;
|
|
460
|
-
} else {
|
|
461
|
-
var headerHeight = modalState.headerElement.offsetHeight;
|
|
462
|
-
var height = contentHeight + headerHeight;
|
|
463
|
-
translateYFrom = 100 - height / modalState.innerElement.parentElement.offsetHeight * 100;
|
|
464
|
-
translateY = translateYFrom;
|
|
465
|
-
expandedRange = [translateY, translateY + 25];
|
|
466
|
-
collapsedRange = [translateY + 25, translateY + 25];
|
|
467
|
-
hiddenRange = [translateY + 25, translateY + 100];
|
|
468
|
-
} // Если модалка может открываться на весь экран, и новый сдвиг больше предыдущего, то откроем её на весь экран
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (modalState.expandable && translateY > prevTranslateY || modalState.settlingHeight === 100) {
|
|
472
|
-
translateY = 0;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
modalState.expandedRange = expandedRange;
|
|
476
|
-
modalState.collapsedRange = collapsedRange;
|
|
477
|
-
modalState.hiddenRange = hiddenRange;
|
|
478
|
-
modalState.translateY = translateY;
|
|
479
|
-
modalState.translateYFrom = translateYFrom;
|
|
480
|
-
modalState.collapsed = collapsed;
|
|
481
|
-
modalState.expanded = expanded;
|
|
482
|
-
}
|
|
483
|
-
}, {
|
|
484
|
-
key: "initCardModal",
|
|
485
|
-
value: function initCardModal(modalState) {
|
|
486
|
-
modalState.translateY = 0;
|
|
487
|
-
}
|
|
488
283
|
}, {
|
|
489
284
|
key: "checkPageContentHeight",
|
|
490
285
|
value: function checkPageContentHeight() {
|
|
491
|
-
var
|
|
492
|
-
activeModal = _this$state2.activeModal,
|
|
493
|
-
nextModal = _this$state2.nextModal;
|
|
494
|
-
var modalId = activeModal || nextModal;
|
|
495
|
-
var modalState = this.modalsState[modalId];
|
|
286
|
+
var modalState = this.getModalState(this.props.activeModal);
|
|
496
287
|
|
|
497
288
|
if ((modalState === null || modalState === void 0 ? void 0 : modalState.type) === ModalType.PAGE && modalState !== null && modalState !== void 0 && modalState.modalElement) {
|
|
498
289
|
var prevModalState = _objectSpread({}, modalState);
|
|
499
290
|
|
|
500
|
-
|
|
291
|
+
initPageModal(modalState);
|
|
501
292
|
|
|
502
293
|
var currentModalState = _objectSpread({}, modalState);
|
|
503
294
|
|
|
@@ -517,28 +308,34 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
517
308
|
}
|
|
518
309
|
}
|
|
519
310
|
}, {
|
|
520
|
-
key: "
|
|
521
|
-
value: function
|
|
311
|
+
key: "closeModal",
|
|
312
|
+
value: function closeModal(id) {
|
|
313
|
+
var _this3 = this;
|
|
314
|
+
|
|
522
315
|
// Сбрасываем состояния, которые могут помешать закрытию модального окна
|
|
523
316
|
this.setState({
|
|
524
|
-
touchDown: false
|
|
525
|
-
switching: false
|
|
317
|
+
touchDown: false
|
|
526
318
|
});
|
|
319
|
+
var prevModalState = this.getModalState(id);
|
|
527
320
|
|
|
528
|
-
if (
|
|
529
|
-
|
|
321
|
+
if (!prevModalState) {
|
|
322
|
+
id && warn("[closeActiveModal] Modal ".concat(id, " does not exist - not closing"));
|
|
323
|
+
return;
|
|
530
324
|
}
|
|
531
325
|
|
|
532
|
-
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);
|
|
533
334
|
|
|
534
|
-
if (!
|
|
535
|
-
|
|
335
|
+
if (!nextModalState) {
|
|
336
|
+
// NOTE: was only for clean exit
|
|
337
|
+
this.setMaskOpacity(prevModalState, 0);
|
|
536
338
|
}
|
|
537
|
-
|
|
538
|
-
var prevModalState = this.modalsState[prevModal];
|
|
539
|
-
this.waitTransitionFinish(prevModalState, this.prevNextSwitchEndHandler);
|
|
540
|
-
this.animateTranslate(prevModalState, 100);
|
|
541
|
-
this.setMaskOpacity(prevModalState, 0);
|
|
542
339
|
}
|
|
543
340
|
}, {
|
|
544
341
|
key: "onPageTouchMove",
|
|
@@ -624,7 +421,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
624
421
|
}, {
|
|
625
422
|
key: "onPageTouchEnd",
|
|
626
423
|
value: function onPageTouchEnd(event, modalState) {
|
|
627
|
-
var
|
|
424
|
+
var _this4 = this;
|
|
628
425
|
|
|
629
426
|
var startY = event.startY,
|
|
630
427
|
shiftY = event.shiftY;
|
|
@@ -667,15 +464,15 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
667
464
|
modalState.hidden = translateY === 100;
|
|
668
465
|
|
|
669
466
|
if (modalState.hidden) {
|
|
670
|
-
this.
|
|
467
|
+
this.props.closeActiveModal();
|
|
671
468
|
}
|
|
672
469
|
|
|
673
470
|
setStateCallback = function setStateCallback() {
|
|
674
471
|
if (!modalState.hidden) {
|
|
675
|
-
|
|
472
|
+
_this4.animateTranslate(modalState, modalState.translateY);
|
|
676
473
|
}
|
|
677
474
|
|
|
678
|
-
|
|
475
|
+
_this4.setMaskOpacity(modalState);
|
|
679
476
|
};
|
|
680
477
|
}
|
|
681
478
|
|
|
@@ -687,7 +484,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
687
484
|
}, {
|
|
688
485
|
key: "onCardTouchEnd",
|
|
689
486
|
value: function onCardTouchEnd(_ref2, modalState) {
|
|
690
|
-
var
|
|
487
|
+
var _this5 = this;
|
|
691
488
|
|
|
692
489
|
var duration = _ref2.duration;
|
|
693
490
|
var setStateCallback;
|
|
@@ -707,15 +504,15 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
707
504
|
modalState.hidden = translateY === 100;
|
|
708
505
|
|
|
709
506
|
if (modalState.hidden) {
|
|
710
|
-
this.
|
|
507
|
+
this.props.closeActiveModal();
|
|
711
508
|
}
|
|
712
509
|
|
|
713
510
|
setStateCallback = function setStateCallback() {
|
|
714
511
|
if (!modalState.hidden) {
|
|
715
|
-
|
|
512
|
+
_this5.animateTranslate(modalState, modalState.translateY);
|
|
716
513
|
}
|
|
717
514
|
|
|
718
|
-
|
|
515
|
+
_this5.setMaskOpacity(modalState);
|
|
719
516
|
};
|
|
720
517
|
}
|
|
721
518
|
|
|
@@ -735,75 +532,23 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
735
532
|
|
|
736
533
|
modalState.innerElement.addEventListener(transitionEvent.name, onceHandler);
|
|
737
534
|
} else {
|
|
738
|
-
setTimeout(eventHandler, this.
|
|
535
|
+
setTimeout(eventHandler, this.timeout);
|
|
739
536
|
}
|
|
740
537
|
}
|
|
741
|
-
}, {
|
|
742
|
-
key: "switchPrevNext",
|
|
743
|
-
value: function switchPrevNext() {
|
|
744
|
-
var _this5 = this;
|
|
745
|
-
|
|
746
|
-
var _this$state3 = this.state,
|
|
747
|
-
prevModal = _this$state3.prevModal,
|
|
748
|
-
nextModal = _this$state3.nextModal;
|
|
749
|
-
var prevModalState = this.modalsState[prevModal];
|
|
750
|
-
var nextModalState = this.modalsState[nextModal];
|
|
751
|
-
|
|
752
|
-
if (IS_DEV && !prevModalState && !nextModalState) {
|
|
753
|
-
return warn("[switchPrevNext] prevModal is ".concat(prevModal, ", nextModal is ").concat(nextModal));
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
var prevIsPage = !!prevModalState && prevModalState.type === ModalType.PAGE;
|
|
757
|
-
var prevIsCard = !!prevModalState && prevModalState.type === ModalType.CARD;
|
|
758
|
-
var nextIsPage = !!nextModalState && nextModalState.type === ModalType.PAGE;
|
|
759
|
-
var nextIsCard = !!nextModalState && nextModalState.type === ModalType.CARD; // Ждём полного скрытия предыдущей модалки
|
|
760
|
-
|
|
761
|
-
if (prevModalState && (nextIsCard || prevIsCard && nextIsPage)) {
|
|
762
|
-
this.waitTransitionFinish(prevModalState, function () {
|
|
763
|
-
_this5.activeTransitions += 1;
|
|
764
|
-
|
|
765
|
-
_this5.waitTransitionFinish(nextModalState, _this5.prevNextSwitchEndHandler);
|
|
766
|
-
|
|
767
|
-
_this5.animateTranslate(nextModalState, nextModalState.translateY);
|
|
768
|
-
});
|
|
769
|
-
return this.animateTranslate(prevModalState, 100);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
if (prevModalState && nextIsPage) {
|
|
773
|
-
this.activeTransitions += 1;
|
|
774
|
-
this.waitTransitionFinish(prevModalState, this.prevNextSwitchEndHandler);
|
|
775
|
-
|
|
776
|
-
if (prevIsPage && prevModalState.translateY <= nextModalState.translateYFrom && !this.state.isBack) {
|
|
777
|
-
this.animateTranslate(prevModalState, nextModalState.translateYFrom + 10);
|
|
778
|
-
} else {
|
|
779
|
-
this.animateTranslate(prevModalState, 100);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
this.activeTransitions += 1;
|
|
784
|
-
this.waitTransitionFinish(nextModalState, this.prevNextSwitchEndHandler);
|
|
785
|
-
this.animateTranslate(nextModalState, nextModalState.translateY);
|
|
786
|
-
}
|
|
787
|
-
}, {
|
|
788
|
-
key: "animateTranslate",
|
|
789
|
-
value:
|
|
790
538
|
/**
|
|
791
539
|
* Анимирует сдвиг модалки
|
|
792
540
|
*
|
|
793
541
|
* @param {ModalsStateEntry} modalState
|
|
794
542
|
* @param {number} percent Процент сдвига: 0 – полностью открыта, 100 – полностью закрыта
|
|
795
543
|
*/
|
|
796
|
-
|
|
544
|
+
|
|
545
|
+
}, {
|
|
546
|
+
key: "animateTranslate",
|
|
547
|
+
value: function animateTranslate(modalState, percent) {
|
|
797
548
|
var frameId = "animateTranslateFrame".concat(modalState.id);
|
|
798
549
|
cancelAnimationFrame(this.frameIds[frameId]);
|
|
799
550
|
this.frameIds[frameId] = requestAnimationFrame(function () {
|
|
800
551
|
setTransformStyle(modalState.innerElement, "translate3d(0, ".concat(percent, "%, 0)"));
|
|
801
|
-
|
|
802
|
-
if (modalState.type === ModalType.PAGE && modalState.footerElement) {
|
|
803
|
-
var footerHeight = modalState.footerElement.offsetHeight;
|
|
804
|
-
var factor = modalState.innerElement.offsetHeight * (percent / 100);
|
|
805
|
-
setTransformStyle(modalState.footerElement, "translateY(calc(".concat(footerHeight, "px * -").concat(factor / footerHeight, "))"));
|
|
806
|
-
}
|
|
807
552
|
});
|
|
808
553
|
}
|
|
809
554
|
/* Устанавливает прозрачность для полупрозрачной подложки */
|
|
@@ -815,7 +560,7 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
815
560
|
|
|
816
561
|
var forceOpacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
817
562
|
|
|
818
|
-
if (forceOpacity === null && this.
|
|
563
|
+
if (forceOpacity === null && this.props.history[0] !== modalState.id) {
|
|
819
564
|
return;
|
|
820
565
|
}
|
|
821
566
|
|
|
@@ -829,26 +574,20 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
829
574
|
}
|
|
830
575
|
});
|
|
831
576
|
}
|
|
832
|
-
/**
|
|
833
|
-
* Закрывает текущую модалку
|
|
834
|
-
*/
|
|
835
|
-
|
|
836
577
|
}, {
|
|
837
578
|
key: "render",
|
|
838
579
|
value: function render() {
|
|
839
580
|
var _this7 = this;
|
|
840
581
|
|
|
841
|
-
var _this$
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
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) {
|
|
852
591
|
return null;
|
|
853
592
|
}
|
|
854
593
|
|
|
@@ -860,14 +599,14 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
860
599
|
vkuiClass: classNames(getClassName('ModalRoot', this.props.platform), {
|
|
861
600
|
'ModalRoot--vkapps': this.props.configProvider.webviewType === WebviewType.VKAPPS,
|
|
862
601
|
'ModalRoot--touched': touchDown,
|
|
863
|
-
'ModalRoot--switching':
|
|
602
|
+
'ModalRoot--switching': !!(enteringModal || exitingModal)
|
|
864
603
|
}),
|
|
865
604
|
onMove: this.onTouchMove,
|
|
866
605
|
onEnd: this.onTouchEnd,
|
|
867
606
|
onScroll: this.onScroll
|
|
868
607
|
}, createScopedElement("div", {
|
|
869
608
|
vkuiClass: "ModalRoot__mask",
|
|
870
|
-
onClick: this.
|
|
609
|
+
onClick: this.props.closeActiveModal,
|
|
871
610
|
ref: this.maskElementRef
|
|
872
611
|
}), createScopedElement("div", {
|
|
873
612
|
vkuiClass: "ModalRoot__viewport",
|
|
@@ -875,28 +614,31 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
875
614
|
}, this.getModals().map(function (Modal) {
|
|
876
615
|
var modalId = getNavId(Modal.props, warn);
|
|
877
616
|
|
|
878
|
-
if (
|
|
617
|
+
if (modalId !== activeModal && modalId !== exitingModal) {
|
|
879
618
|
return null;
|
|
880
619
|
}
|
|
881
620
|
|
|
882
|
-
var modalState = _objectSpread({}, _this7.
|
|
621
|
+
var modalState = _objectSpread({}, _this7.getModalState(modalId));
|
|
883
622
|
|
|
884
623
|
var isPage = modalState.type === ModalType.PAGE;
|
|
885
624
|
var key = "modal-".concat(modalId);
|
|
886
|
-
return createScopedElement(
|
|
625
|
+
return createScopedElement(FocusTrap, {
|
|
887
626
|
key: key,
|
|
888
|
-
|
|
889
|
-
return _this7.
|
|
627
|
+
getRootRef: function getRootRef(e) {
|
|
628
|
+
return _this7.getModalState(modalId).modalElement = e;
|
|
890
629
|
},
|
|
630
|
+
onClose: _this7.props.closeActiveModal,
|
|
631
|
+
timeout: _this7.timeout,
|
|
891
632
|
vkuiClass: classNames('ModalRoot__modal', {
|
|
892
633
|
'ModalRoot__modal--active': modalId === activeModal,
|
|
893
|
-
'ModalRoot__modal--prev': modalId ===
|
|
894
|
-
'ModalRoot__modal--next': modalId ===
|
|
634
|
+
'ModalRoot__modal--prev': modalId === exitingModal,
|
|
635
|
+
'ModalRoot__modal--next': exitingModal && modalId === activeModal || modalId === enteringModal,
|
|
895
636
|
'ModalRoot__modal--dragging': dragging,
|
|
896
637
|
'ModalRoot__modal--expandable': isPage && modalState.expandable,
|
|
897
638
|
'ModalRoot__modal--expanded': isPage && modalState.expanded,
|
|
898
639
|
'ModalRoot__modal--collapsed': isPage && modalState.collapsed
|
|
899
|
-
})
|
|
640
|
+
}),
|
|
641
|
+
restoreFocus: false
|
|
900
642
|
}, Modal);
|
|
901
643
|
})))));
|
|
902
644
|
}
|
|
@@ -905,5 +647,73 @@ var ModalRootTouchComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
905
647
|
return ModalRootTouchComponent;
|
|
906
648
|
}(React.Component);
|
|
907
649
|
|
|
908
|
-
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
|
+
}
|
|
909
719
|
//# sourceMappingURL=ModalRoot.js.map
|