@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,9 +1,19 @@
|
|
|
1
1
|
.Switch {
|
|
2
|
+
position: relative;
|
|
2
3
|
display: block;
|
|
4
|
+
cursor: pointer;
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
.Switch__self {
|
|
6
|
-
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 1px;
|
|
10
|
+
height: 1px;
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
border: 0;
|
|
14
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
opacity: 0;
|
|
7
17
|
}
|
|
8
18
|
|
|
9
19
|
.Switch__pseudo {
|
|
@@ -17,6 +27,8 @@
|
|
|
17
27
|
.Switch__pseudo::before {
|
|
18
28
|
position: absolute;
|
|
19
29
|
content: '';
|
|
30
|
+
top: -3px;
|
|
31
|
+
left: -3px;
|
|
20
32
|
border-radius: 50%;
|
|
21
33
|
box-sizing: border-box;
|
|
22
34
|
}
|
|
@@ -38,9 +50,6 @@
|
|
|
38
50
|
border: 2px solid transparent;
|
|
39
51
|
background: var(--placeholder_icon_background);
|
|
40
52
|
border-radius: 15px;
|
|
41
|
-
transition:
|
|
42
|
-
background-color .2s ease,
|
|
43
|
-
border-color .2s ease;
|
|
44
53
|
}
|
|
45
54
|
|
|
46
55
|
.Switch--ios.Switch--sizeY-compact .Switch__pseudo {
|
|
@@ -63,7 +72,6 @@
|
|
|
63
72
|
0 3px 8px rgba(0, 0, 0, .15),
|
|
64
73
|
0 3px 1px rgba(0, 0, 0, .06),
|
|
65
74
|
inset 0 0 0 .5px rgba(0, 0, 0, .04);
|
|
66
|
-
transition: transform .2s cubic-bezier(.36, -.24, .26, 1.32);
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
.Switch--ios.Switch--sizeY-compact .Switch__pseudo::before {
|
|
@@ -71,10 +79,6 @@
|
|
|
71
79
|
height: 23px;
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
.Switch--ios .Switch__self:checked + .Switch__pseudo::before {
|
|
75
|
-
transform: translateX(20px);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
82
|
/**
|
|
79
83
|
* Android & VKCOM
|
|
80
84
|
*/
|
|
@@ -89,7 +93,6 @@
|
|
|
89
93
|
display: block;
|
|
90
94
|
width: 100%;
|
|
91
95
|
height: 100%;
|
|
92
|
-
transition: background-color .1s ease;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
.Switch--android .Switch__self:checked + .Switch__pseudo::after,
|
|
@@ -121,13 +124,10 @@
|
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
.Switch--android .Switch__pseudo::before {
|
|
124
|
-
top: -3px;
|
|
125
|
-
left: -3px;
|
|
126
127
|
width: 20px;
|
|
127
128
|
height: 20px;
|
|
128
129
|
background: #f1f1f1; /* todo: 1077 replace w/ a proper variable */
|
|
129
130
|
box-shadow: 0 0 2px 0 rgba(0, 0, 0, .12), 0 2px 2px 0 rgba(0, 0, 0, .24);
|
|
130
|
-
transition: transform .1s ease;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
.Switch--android.Switch--sizeY-compact .Switch__pseudo::before {
|
|
@@ -158,13 +158,11 @@
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
.Switch--vkcom .Switch__pseudo::before {
|
|
161
|
-
top: -3px;
|
|
162
161
|
left: -2px;
|
|
163
162
|
width: 16px;
|
|
164
163
|
height: 16px;
|
|
165
164
|
background: var(--background_light);
|
|
166
165
|
border: 1px solid var(--icon_tertiary);
|
|
167
|
-
transition: transform .1s ease;
|
|
168
166
|
z-index: 1;
|
|
169
167
|
}
|
|
170
168
|
|
|
@@ -173,3 +171,36 @@
|
|
|
173
171
|
border: none;
|
|
174
172
|
transform: translateX(16px);
|
|
175
173
|
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* [a11y]
|
|
177
|
+
* add animation for browsers that support prefers-reduced-motion
|
|
178
|
+
* so that users with vestibular motion disorders have no problem
|
|
179
|
+
* navigating accessible vkui apps via keyboard
|
|
180
|
+
*/
|
|
181
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
182
|
+
.Switch__pseudo::before {
|
|
183
|
+
transition: transform .1s ease;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.Switch--ios .Switch__pseudo {
|
|
187
|
+
transition: background-color .2s ease, border-color .2s ease;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.Switch--ios .Switch__pseudo::before {
|
|
191
|
+
transition: transform .2s cubic-bezier(.36, -.24, .26, 1.32);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.Switch--android .Switch__pseudo::after,
|
|
195
|
+
.Switch--vkcom .Switch__pseudo::after {
|
|
196
|
+
transition: background-color .1s ease;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* CMP:
|
|
202
|
+
* SimpleCell
|
|
203
|
+
*/
|
|
204
|
+
.SimpleCell .Switch {
|
|
205
|
+
margin-left: 10px;
|
|
206
|
+
}
|
|
@@ -3,31 +3,39 @@ import { getClassName } from '../../helpers/getClassName';
|
|
|
3
3
|
import { classNames } from '../../lib/classNames';
|
|
4
4
|
import { usePlatform } from '../../hooks/usePlatform';
|
|
5
5
|
import { HasRef, HasRootRef } from '../../types';
|
|
6
|
-
import {
|
|
6
|
+
import { useAdaptivity } from '../../hooks/useAdaptivity';
|
|
7
7
|
import { useExternRef } from '../../hooks/useExternRef';
|
|
8
|
+
import { FocusVisible } from '../FocusVisible/FocusVisible';
|
|
8
9
|
import './Switch.css';
|
|
9
10
|
|
|
10
11
|
export interface SwitchProps extends
|
|
11
12
|
React.InputHTMLAttributes<HTMLInputElement>,
|
|
12
13
|
HasRootRef<HTMLLabelElement>,
|
|
13
|
-
HasRef<HTMLInputElement
|
|
14
|
-
AdaptivityProps { }
|
|
14
|
+
HasRef<HTMLInputElement> {};
|
|
15
15
|
|
|
16
|
-
export const Switch: React.
|
|
16
|
+
export const Switch: React.FC<SwitchProps> = ({
|
|
17
17
|
style,
|
|
18
18
|
className,
|
|
19
19
|
getRef,
|
|
20
20
|
getRootRef,
|
|
21
|
-
sizeY,
|
|
22
21
|
...restProps
|
|
23
22
|
}: SwitchProps) => {
|
|
24
23
|
const platform = usePlatform();
|
|
24
|
+
const { sizeY } = useAdaptivity();
|
|
25
|
+
|
|
25
26
|
const inputRef = useExternRef(getRef);
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<label
|
|
29
|
+
<label
|
|
30
|
+
vkuiClass={classNames(getClassName('Switch', platform), `Switch--sizeY-${sizeY}`)}
|
|
31
|
+
className={className}
|
|
32
|
+
style={style}
|
|
33
|
+
ref={getRootRef}
|
|
34
|
+
role="presentation"
|
|
35
|
+
>
|
|
29
36
|
<input {...restProps} type="checkbox" vkuiClass="Switch__self" ref={inputRef} />
|
|
30
|
-
<span vkuiClass="Switch__pseudo" />
|
|
37
|
+
<span role="presentation" vkuiClass="Switch__pseudo" />
|
|
38
|
+
<FocusVisible mode="outside" />
|
|
31
39
|
</label>
|
|
32
40
|
);
|
|
33
|
-
}
|
|
41
|
+
};
|
|
@@ -8,7 +8,7 @@ import { getClassName } from '../../helpers/getClassName';
|
|
|
8
8
|
import { ANDROID } from '../../lib/platform';
|
|
9
9
|
import { getOffsetRect } from '../../lib/offset';
|
|
10
10
|
import { coordX, coordY } from '../../lib/touch';
|
|
11
|
-
import { HasRootRef } from '../../types';
|
|
11
|
+
import { HasComponent, HasRootRef } from '../../types';
|
|
12
12
|
import { withAdaptivity, AdaptivityProps } from '../../hoc/withAdaptivity';
|
|
13
13
|
import { shouldTriggerClickOnEnterOrSpace } from '../../lib/accessibility';
|
|
14
14
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
@@ -18,8 +18,7 @@ import { useExternRef } from '../../hooks/useExternRef';
|
|
|
18
18
|
import { usePlatform } from '../../hooks/usePlatform';
|
|
19
19
|
import './Tappable.css';
|
|
20
20
|
|
|
21
|
-
export interface TappableProps extends React.AllHTMLAttributes<HTMLElement>, HasRootRef<HTMLElement>, AdaptivityProps {
|
|
22
|
-
Component?: React.ElementType;
|
|
21
|
+
export interface TappableProps extends React.AllHTMLAttributes<HTMLElement>, HasRootRef<HTMLElement>, AdaptivityProps, HasComponent {
|
|
23
22
|
/**
|
|
24
23
|
* Длительность показа active-состояния
|
|
25
24
|
*/
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
<FormItem top="Любимая музыка">
|
|
11
11
|
<Textarea placeholder="Группы, исполнители, продюсеры" />
|
|
12
12
|
</FormItem>
|
|
13
|
+
<FormItem top="Увлечения">
|
|
14
|
+
<Textarea cols={4} placeholder="Музыка, спорт" defaultValue="Музыка\nСпорт\nФотография\nПлавание\nПрограммирование" />
|
|
15
|
+
</FormItem>
|
|
13
16
|
<FormItem top="Прикидываемся Input">
|
|
14
17
|
<Textarea rows={1} placeholder="Once upon a time" />
|
|
15
18
|
</FormItem>
|
|
@@ -7,7 +7,6 @@ import { getClassName } from '../../helpers/getClassName';
|
|
|
7
7
|
import { useEnsuredControl } from '../../hooks/useEnsuredControl';
|
|
8
8
|
import { useExternRef } from '../../hooks/useExternRef';
|
|
9
9
|
import { usePlatform } from '../../hooks/usePlatform';
|
|
10
|
-
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
11
10
|
import './Textarea.css';
|
|
12
11
|
|
|
13
12
|
export interface TextareaProps extends
|
|
@@ -33,19 +32,24 @@ const Textarea: React.FC<TextareaProps> = React.memo(({
|
|
|
33
32
|
...restProps
|
|
34
33
|
}: TextareaProps) => {
|
|
35
34
|
const [value, onChange] = useEnsuredControl(restProps, { defaultValue });
|
|
35
|
+
const currentScrollHeight = React.useRef<number>();
|
|
36
36
|
const elementRef = useExternRef(getRef);
|
|
37
37
|
const platform = usePlatform();
|
|
38
38
|
|
|
39
39
|
// autosize input
|
|
40
|
-
|
|
40
|
+
React.useEffect(() => {
|
|
41
41
|
const el = elementRef.current;
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
if (grow && el.offsetParent) {
|
|
43
44
|
el.style.height = null;
|
|
44
45
|
el.style.height = `${el.scrollHeight}px`;
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
if (el.scrollHeight !== currentScrollHeight.current && onResize) {
|
|
48
|
+
onResize(el);
|
|
49
|
+
currentScrollHeight.current = el.scrollHeight;
|
|
50
|
+
}
|
|
47
51
|
}
|
|
48
|
-
}, [grow, value]);
|
|
52
|
+
}, [grow, value, sizeY]);
|
|
49
53
|
|
|
50
54
|
return (
|
|
51
55
|
<FormField
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { getSupportedEvents, coordX, coordY, touchEnabled, VKUITouchEvent } from '../../lib/touch';
|
|
3
|
-
import { HasRootRef } from '../../types';
|
|
3
|
+
import { HasComponent, HasRootRef } from '../../types';
|
|
4
4
|
import { useDOM } from '../../lib/dom';
|
|
5
5
|
import { useExternRef } from '../../hooks/useExternRef';
|
|
6
6
|
import { useEventListener } from '../../hooks/useEventListener';
|
|
7
7
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
8
8
|
|
|
9
|
-
export interface TouchProps extends React.AllHTMLAttributes<HTMLElement>, HasRootRef<HTMLElement
|
|
9
|
+
export interface TouchProps extends React.AllHTMLAttributes<HTMLElement>, HasRootRef<HTMLElement>, HasComponent {
|
|
10
10
|
/**
|
|
11
11
|
* Привязать onEnter и onLeave через pointer-events - работает на disabled-инпутах
|
|
12
12
|
*/
|
|
@@ -14,7 +14,6 @@ export interface TouchProps extends React.AllHTMLAttributes<HTMLElement>, HasRoo
|
|
|
14
14
|
useCapture?: boolean;
|
|
15
15
|
slideThreshold?: number;
|
|
16
16
|
noSlideClick?: boolean;
|
|
17
|
-
Component?: React.ElementType;
|
|
18
17
|
onEnter?: HoverHandler;
|
|
19
18
|
onLeave?: HoverHandler;
|
|
20
19
|
onStart?: TouchEventHandler;
|
|
@@ -30,20 +29,20 @@ export interface TouchProps extends React.AllHTMLAttributes<HTMLElement>, HasRoo
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
export interface Gesture {
|
|
33
|
-
startX
|
|
34
|
-
startY
|
|
35
|
-
startT
|
|
36
|
-
duration
|
|
37
|
-
isPressed
|
|
38
|
-
isY
|
|
39
|
-
isX
|
|
40
|
-
isSlideX
|
|
41
|
-
isSlideY
|
|
42
|
-
isSlide
|
|
43
|
-
shiftX
|
|
44
|
-
shiftY
|
|
45
|
-
shiftXAbs
|
|
46
|
-
shiftYAbs
|
|
32
|
+
startX: number;
|
|
33
|
+
startY: number;
|
|
34
|
+
startT: Date;
|
|
35
|
+
duration: number;
|
|
36
|
+
isPressed: boolean;
|
|
37
|
+
isY: boolean;
|
|
38
|
+
isX: boolean;
|
|
39
|
+
isSlideX: boolean;
|
|
40
|
+
isSlideY: boolean;
|
|
41
|
+
isSlide: boolean;
|
|
42
|
+
shiftX: number;
|
|
43
|
+
shiftY: number;
|
|
44
|
+
shiftXAbs: number;
|
|
45
|
+
shiftYAbs: number;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
export interface TouchEvent extends Gesture {
|
|
@@ -80,27 +79,30 @@ export const Touch: React.FC<TouchProps> = ({
|
|
|
80
79
|
const { document } = useDOM();
|
|
81
80
|
const events = React.useMemo(getSupportedEvents, []);
|
|
82
81
|
const didSlide = React.useRef(false);
|
|
83
|
-
const gesture = React.useRef<Partial<Gesture>>(
|
|
82
|
+
const gesture = React.useRef<Partial<Gesture>>(null);
|
|
84
83
|
const handle = (e: VKUITouchEvent, handers: TouchEventHandler[]) => {
|
|
85
84
|
stopPropagation && e.stopPropagation();
|
|
86
85
|
handers.forEach((cb) => {
|
|
87
86
|
const duration = Date.now() - gesture.current.startT.getTime();
|
|
88
|
-
cb && cb({ ...gesture.current, duration, originalEvent: e });
|
|
87
|
+
cb && cb({ ...gesture.current as Gesture, duration, originalEvent: e });
|
|
89
88
|
});
|
|
90
89
|
};
|
|
91
90
|
|
|
92
91
|
const enterHandler = useEventListener(usePointerHover ? 'pointerenter' : 'mouseenter', onEnter);
|
|
93
92
|
const leaveHandler = useEventListener(usePointerHover ? 'pointerleave' : 'mouseleave', onLeave);
|
|
94
93
|
const startHandler = useEventListener(events[0], (e: VKUITouchEvent) => {
|
|
95
|
-
gesture.current =
|
|
96
|
-
startX: coordX(e),
|
|
97
|
-
startY: coordY(e),
|
|
98
|
-
startT: new Date(),
|
|
99
|
-
isPressed: true,
|
|
100
|
-
};
|
|
94
|
+
gesture.current = initGesture(coordX(e), coordY(e));
|
|
101
95
|
|
|
102
96
|
handle(e, [onStart, onStartX, onStartY]);
|
|
103
|
-
|
|
97
|
+
// 1 line, 2 bad specs, 2 workarounds:
|
|
98
|
+
subscribe(touchEnabled()
|
|
99
|
+
// Touch events fire on initial target, and won't bubble if its removed
|
|
100
|
+
// see: #235, #1968, https://stackoverflow.com/a/45760014
|
|
101
|
+
? e.target as HTMLElement
|
|
102
|
+
// Mouse events fire on the element under pointer, so we lose move / end
|
|
103
|
+
// if pointer goes outside container.
|
|
104
|
+
// Can be fixed by PointerEvents' setPointerCapture later
|
|
105
|
+
: document);
|
|
104
106
|
}, { capture: useCapture, passive: false });
|
|
105
107
|
const containerRef = useExternRef(getRootRef);
|
|
106
108
|
|
|
@@ -109,7 +111,6 @@ export const Touch: React.FC<TouchProps> = ({
|
|
|
109
111
|
enterHandler.add(el);
|
|
110
112
|
leaveHandler.add(el);
|
|
111
113
|
startHandler.add(el);
|
|
112
|
-
touchEnabled() && subscribe(el);
|
|
113
114
|
}, [Component]);
|
|
114
115
|
|
|
115
116
|
function onMove(e: VKUITouchEvent) {
|
|
@@ -169,11 +170,10 @@ export const Touch: React.FC<TouchProps> = ({
|
|
|
169
170
|
gesture.current = {};
|
|
170
171
|
|
|
171
172
|
// Если это был тач-евент, симулируем отмену hover
|
|
172
|
-
if (
|
|
173
|
+
if (touchEnabled()) {
|
|
173
174
|
onLeave && onLeave(e);
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
-
!touchEnabled() && subscribe(null);
|
|
176
|
+
subscribe(null);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
const listenerParams = { capture: useCapture, passive: false };
|
|
@@ -205,7 +205,8 @@ export const Touch: React.FC<TouchProps> = ({
|
|
|
205
205
|
if (!didSlide.current) {
|
|
206
206
|
return onClickCapture && onClickCapture(e);
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
// eslint-disable-next-line no-restricted-properties
|
|
209
|
+
if ((e.target as HTMLElement).closest('a')) {
|
|
209
210
|
e.preventDefault();
|
|
210
211
|
}
|
|
211
212
|
if (noSlideClick) {
|
|
@@ -225,3 +226,22 @@ export const Touch: React.FC<TouchProps> = ({
|
|
|
225
226
|
/>
|
|
226
227
|
);
|
|
227
228
|
};
|
|
229
|
+
|
|
230
|
+
function initGesture(startX: number, startY: number): Gesture {
|
|
231
|
+
return {
|
|
232
|
+
startX,
|
|
233
|
+
startY,
|
|
234
|
+
startT: new Date(),
|
|
235
|
+
duration: 0,
|
|
236
|
+
isPressed: true,
|
|
237
|
+
isY: false,
|
|
238
|
+
isX: false,
|
|
239
|
+
isSlideX: false,
|
|
240
|
+
isSlideY: false,
|
|
241
|
+
isSlide: false,
|
|
242
|
+
shiftX: 0,
|
|
243
|
+
shiftY: 0,
|
|
244
|
+
shiftXAbs: 0,
|
|
245
|
+
shiftYAbs: 0,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { HasComponent } from '../../../types';
|
|
2
3
|
import { usePlatform } from '../../../hooks/usePlatform';
|
|
3
4
|
import { classNames } from '../../../lib/classNames';
|
|
4
5
|
import { getClassName } from '../../../helpers/getClassName';
|
|
5
6
|
import './Caption.css';
|
|
6
7
|
|
|
7
|
-
export interface CaptionProps extends React.AllHTMLAttributes<HTMLElement
|
|
8
|
+
export interface CaptionProps extends React.AllHTMLAttributes<HTMLElement>, HasComponent {
|
|
8
9
|
weight: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
9
10
|
level: '1' | '2' | '3' | '4';
|
|
10
11
|
caps?: boolean;
|
|
11
|
-
Component?: React.ElementType;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const Caption: React.FC<CaptionProps> = ({
|
|
15
15
|
children,
|
|
16
|
-
weight,
|
|
17
|
-
level,
|
|
16
|
+
weight = 'regular',
|
|
17
|
+
level = '1',
|
|
18
18
|
caps,
|
|
19
19
|
Component = 'span',
|
|
20
20
|
...restProps
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { HasComponent } from '../../../types';
|
|
2
3
|
import { usePlatform } from '../../../hooks/usePlatform';
|
|
3
4
|
import { classNames } from '../../../lib/classNames';
|
|
4
5
|
import { getClassName } from '../../../helpers/getClassName';
|
|
5
6
|
import './Headline.css';
|
|
6
7
|
|
|
7
|
-
export interface HeadlineProps extends React.AllHTMLAttributes<HTMLElement
|
|
8
|
+
export interface HeadlineProps extends React.AllHTMLAttributes<HTMLElement>, HasComponent {
|
|
8
9
|
weight: 'regular' | 'medium' | 'semibold';
|
|
9
|
-
Component?: React.ElementType;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const Headline: React.FC<HeadlineProps> = ({
|
|
13
13
|
children,
|
|
14
|
-
weight,
|
|
14
|
+
weight = 'regular',
|
|
15
15
|
Component = 'h3',
|
|
16
16
|
...restProps
|
|
17
17
|
}: HeadlineProps) => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { HasComponent } from '../../../types';
|
|
2
3
|
import { usePlatform } from '../../../hooks/usePlatform';
|
|
3
4
|
import { classNames } from '../../../lib/classNames';
|
|
4
5
|
import { getClassName } from '../../../helpers/getClassName';
|
|
5
6
|
import './Subhead.css';
|
|
6
7
|
|
|
7
|
-
export interface SubheadProps extends React.AllHTMLAttributes<HTMLElement
|
|
8
|
+
export interface SubheadProps extends React.AllHTMLAttributes<HTMLElement>, HasComponent {
|
|
8
9
|
weight: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
9
|
-
Component?: React.ElementType;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const Subhead: React.FC<SubheadProps> = ({
|
|
13
13
|
children,
|
|
14
|
-
weight,
|
|
14
|
+
weight = 'regular',
|
|
15
15
|
Component = 'h4',
|
|
16
16
|
...restProps
|
|
17
17
|
}: SubheadProps) => {
|
|
@@ -2,19 +2,18 @@ import * as React from 'react';
|
|
|
2
2
|
import { usePlatform } from '../../../hooks/usePlatform';
|
|
3
3
|
import { classNames } from '../../../lib/classNames';
|
|
4
4
|
import { getClassName } from '../../../helpers/getClassName';
|
|
5
|
-
import { HasRootRef } from '../../../types';
|
|
5
|
+
import { HasComponent, HasRootRef } from '../../../types';
|
|
6
6
|
import { warnOnce } from '../../../lib/warnOnce';
|
|
7
7
|
import './Text.css';
|
|
8
8
|
|
|
9
|
-
export interface TextProps extends React.AllHTMLAttributes<HTMLElement>, HasRootRef<
|
|
9
|
+
export interface TextProps extends React.AllHTMLAttributes<HTMLElement>, HasRootRef<HTMLElement>, HasComponent {
|
|
10
10
|
weight: 'regular' | 'medium' | 'semibold';
|
|
11
|
-
Component?: React.ElementType;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
const warn = warnOnce('Text');
|
|
15
14
|
const Text: React.FC<TextProps> = ({
|
|
16
15
|
children,
|
|
17
|
-
weight,
|
|
16
|
+
weight = 'regular',
|
|
18
17
|
Component = 'span',
|
|
19
18
|
getRootRef,
|
|
20
19
|
...restProps
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { HasComponent } from '../../../types';
|
|
2
3
|
import { usePlatform } from '../../../hooks/usePlatform';
|
|
3
4
|
import { classNames } from '../../../lib/classNames';
|
|
4
5
|
import { getClassName } from '../../../helpers/getClassName';
|
|
@@ -6,21 +7,24 @@ import { ANDROID } from '../../../lib/platform';
|
|
|
6
7
|
import Headline, { HeadlineProps } from '../Headline/Headline';
|
|
7
8
|
import './Title.css';
|
|
8
9
|
|
|
9
|
-
export interface TitleProps extends React.AllHTMLAttributes<HTMLElement
|
|
10
|
+
export interface TitleProps extends React.AllHTMLAttributes<HTMLElement>, HasComponent {
|
|
10
11
|
weight: 'heavy' | 'bold' | 'semibold' | 'medium' | 'regular';
|
|
11
12
|
level: '1' | '2' | '3';
|
|
12
|
-
Component?: React.ElementType;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const Title: React.FC<TitleProps> = ({
|
|
16
16
|
children,
|
|
17
|
-
weight,
|
|
18
|
-
level,
|
|
19
|
-
Component
|
|
17
|
+
weight = 'regular',
|
|
18
|
+
level = '1',
|
|
19
|
+
Component,
|
|
20
20
|
...restProps
|
|
21
21
|
}: TitleProps) => {
|
|
22
22
|
const platform = usePlatform();
|
|
23
23
|
|
|
24
|
+
if (!Component) {
|
|
25
|
+
Component = ('h' + level) as React.ElementType;
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
if (platform === ANDROID && level === '3') {
|
|
25
29
|
const headlineWeight: HeadlineProps['weight'] = weight === 'regular' ? weight : 'medium';
|
|
26
30
|
|
|
@@ -46,66 +46,52 @@ const [activePanel, setActivePanel] = useState('panel1');
|
|
|
46
46
|
В iOS есть возможность свайпнуть от левого края назад, чтобы перейти на предыдущую панель. Для того, чтобы
|
|
47
47
|
повторить такое поведение в VKUI нужно:
|
|
48
48
|
|
|
49
|
-
- Передать во `View`
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- Убедиться, что приложение открыто внутри webview (так как внутри обычного мобильного браузера
|
|
55
|
-
как правило есть свой swipe back). Для этого достаточно обернуть ваше приложение компонентом `ConfigProvider`.
|
|
56
|
-
Он внутри себя определяет, открыто приложение внутри webview или в мобильном браузере. Для тестов в браузере
|
|
57
|
-
можно явно передать в `СonfigProvider` свойство `isWebView={true}`.
|
|
58
|
-
- При попадании на первую панель слать `vk-bridge` событие `VKWebAppEnableSwipeBack`. При уходе с первой панели –
|
|
59
|
-
слать `VKWebAppDisableSwipeBack`. Таким образом VKUI свайп не будет конфликтовать со свайпом нативного клиента.
|
|
49
|
+
- Передать во `View` коллбек `onSwipeBack` — он сработает при завершении анимации свайпа. Поменяйте в нем `activePanel` и обновите `history`.
|
|
50
|
+
- Передать во `View` проп `history` — массив из id панелей в порядке открытия. Например, если пользователь из `main` перешел в `profile`, а оттуда попал в `education`, то `history=['main', 'profile', 'education']`.
|
|
51
|
+
- Обернуть ваше приложение в `ConfigProvider` — он определит, открыто приложение в webview клиента VK или в браузере (там есть свой swipe back, который будет конфликтовать с нашим). Для проверки в браузере форсируйте определение webview: `<СonfigProvider isWebView>`.
|
|
52
|
+
- На первой панели должен включаться свайпбек нативного клиента, чтобы пользователь смог выйти из приложения — для этого используют `vk-bridge`. __Если вы не из ВК,__ при переходах отправляйте [событие `VKWebAppSetSwipeSettings`](https://vk.com/dev.php?method=vk_bridge_events_10&f=Включение%20swipe%20как%20в%20браузере) с `history: true` на первой панели или `history: false` на других. __Если вы из ВК,__ при переходе на первую панель отправляйте событие `VKWebAppEnableSwipeBack`, на любую другую — `VKWebAppDisableSwipeBack`.
|
|
53
|
+
- Компоненты, которые сами обрабатывают жесты (например, карта), могут конфликтовать со свайпбеком — повесьте на них свойство `data-vkui-swipe-back={false}`
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```jsx static
|
|
64
|
-
import React from 'react';
|
|
65
|
-
import { View, Panel, ConfigProvider } from '@vkontakte/vkui';
|
|
55
|
+
```jsx
|
|
66
56
|
import vkBridge from '@vkontakte/vk-bridge';
|
|
67
57
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
activePanel: 'main',
|
|
72
|
-
history: ['main']
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
goBack = () => {
|
|
76
|
-
const history = [...this.state.history];
|
|
77
|
-
history.pop();
|
|
78
|
-
const activePanel = history[history.length - 1];
|
|
79
|
-
if (activePanel === 'main') {
|
|
80
|
-
vkBridge.send('VKWebAppEnableSwipeBack');
|
|
81
|
-
}
|
|
82
|
-
this.setState({ history, activePanel });
|
|
83
|
-
}
|
|
58
|
+
const [history, setHistory] = useState(['main']);
|
|
59
|
+
const activePanel = history[history.length - 1];
|
|
60
|
+
const isFirst = history.length === 1;
|
|
84
61
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
// Если вы из ВК, делайте так
|
|
64
|
+
vkBridge.send(isFirst
|
|
65
|
+
? 'VKWebAppEnableSwipeBack'
|
|
66
|
+
: 'VKWebAppDisableSwipeBack');
|
|
67
|
+
// Если вы не из ВК, то так:
|
|
68
|
+
vkBridge.send('VKWebAppSetSwipeSettings', { history: isFirst });
|
|
69
|
+
}, [isFirst]);
|
|
93
70
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<ConfigProvider isWebView={true}>
|
|
97
|
-
<View
|
|
98
|
-
onSwipeBack={this.goBack}
|
|
99
|
-
history={this.state.history}
|
|
100
|
-
activePanel={this.state.activePanel}
|
|
101
|
-
>
|
|
102
|
-
<Panel id="main"/>
|
|
103
|
-
<Panel id="profile"/>
|
|
104
|
-
<Panel id="education"/>
|
|
105
|
-
</View>
|
|
106
|
-
</ConfigProvider>
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
71
|
+
const goBack = () => setHistory(history.slice(0, -1));
|
|
72
|
+
const go = (panel) => setHistory([...history, panel]);
|
|
110
73
|
|
|
74
|
+
<ConfigProvider platform={IOS} isWebView>
|
|
75
|
+
<View
|
|
76
|
+
onSwipeBack={goBack}
|
|
77
|
+
history={history}
|
|
78
|
+
activePanel={activePanel}
|
|
79
|
+
>
|
|
80
|
+
<Panel id="main">
|
|
81
|
+
<PanelHeader>Main</PanelHeader>
|
|
82
|
+
<Group>
|
|
83
|
+
<CellButton onClick={() => go('profile')}>profile</CellButton>
|
|
84
|
+
</Group>
|
|
85
|
+
</Panel>
|
|
86
|
+
<Panel id="profile">
|
|
87
|
+
<PanelHeader>Профиль</PanelHeader>
|
|
88
|
+
<Group>
|
|
89
|
+
<Placeholder>Теперь свайпните от левого края направо, чтобы вернуться</Placeholder>
|
|
90
|
+
<Div style={{ height: 50, background: '#eee' }} data-vkui-swipe-back={false}>
|
|
91
|
+
Здесь свайпбек отключен
|
|
92
|
+
</Div>
|
|
93
|
+
</Group>
|
|
94
|
+
</Panel>
|
|
95
|
+
</View>
|
|
96
|
+
</ConfigProvider>
|
|
111
97
|
```
|