@homecode/ui 4.18.16 → 4.18.18
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/dist/esm/index.js +83 -2
- package/dist/esm/node_modules/style-inject/dist/style-inject.es.js +28 -2
- package/dist/esm/src/components/AssistiveText/AssistiveText.js +10 -2
- package/dist/esm/src/components/AssistiveText/AssistiveText.styl.js +7 -2
- package/dist/esm/src/components/Button/Button.helpers.js +12 -2
- package/dist/esm/src/components/Button/Button.js +38 -2
- package/dist/esm/src/components/Button/Button.styl.js +7 -2
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.js +10 -2
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.styl.js +7 -2
- package/dist/esm/src/components/Calendar/Calendar.helpers.js +65 -2
- package/dist/esm/src/components/Calendar/Calendar.js +66 -2
- package/dist/esm/src/components/Calendar/Calendar.styl.js +7 -2
- package/dist/esm/src/components/Checkbox/Checkbox.js +48 -2
- package/dist/esm/src/components/Checkbox/Checkbox.styl.js +7 -2
- package/dist/esm/src/components/Container/Container.js +12 -2
- package/dist/esm/src/components/Container/Container.styl.js +7 -2
- package/dist/esm/src/components/DatePicker/DatePicker.helpers.js +31 -2
- package/dist/esm/src/components/DatePicker/DatePicker.js +47 -2
- package/dist/esm/src/components/DatePicker/DatePicker.styl.js +7 -2
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.js +20 -2
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.styl.js +7 -2
- package/dist/esm/src/components/DateTime/DateTime.js +17 -2
- package/dist/esm/src/components/Draggable/Draggable.js +136 -2
- package/dist/esm/src/components/Draggable/Draggable.styl.js +7 -2
- package/dist/esm/src/components/Expand/Expand.js +24 -2
- package/dist/esm/src/components/Expand/Expand.styl.js +7 -2
- package/dist/esm/src/components/Form/Form.helpers.js +42 -2
- package/dist/esm/src/components/Form/Form.js +286 -2
- package/dist/esm/src/components/Form/Form.styl.js +7 -2
- package/dist/esm/src/components/Form/Form.types.js +0 -1
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.js +8 -2
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.styl.js +7 -2
- package/dist/esm/src/components/Form/Validator.js +24 -6
- package/dist/esm/src/components/Gallery/Dots/Dots.js +9 -2
- package/dist/esm/src/components/Gallery/Dots/Dots.styl.js +7 -2
- package/dist/esm/src/components/Gallery/Gallery.js +180 -2
- package/dist/esm/src/components/Gallery/Gallery.styl.js +7 -2
- package/dist/esm/src/components/Heading/Heading.js +37 -2
- package/dist/esm/src/components/Heading/Heading.styl.js +7 -2
- package/dist/esm/src/components/Icon/Icon.js +27 -2
- package/dist/esm/src/components/Icon/Icon.styl.js +7 -2
- package/dist/esm/src/components/Icon/icons/avatar.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/brokenImage.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/check.svg.js +19 -2
- package/dist/esm/src/components/Icon/icons/chevronDown.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/chevronLeft.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/chevronRight.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/chevronUp.svg.js +20 -2
- package/dist/esm/src/components/Icon/icons/close.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/colors.svg.js +60 -2
- package/dist/esm/src/components/Icon/icons/copy.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/delete.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/draft.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/edit.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/email.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/externalLink.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/eye.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/fullscreen.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/fullscreenExit.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/function.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/gear.svg.js +21 -2
- package/dist/esm/src/components/Icon/icons/group.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/history.svg.js +17 -2
- package/dist/esm/src/components/Icon/icons/home.svg.js +19 -2
- package/dist/esm/src/components/Icon/icons/index.js +46 -2
- package/dist/esm/src/components/Icon/icons/instagram.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/link.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/loader.svg.js +45 -2
- package/dist/esm/src/components/Icon/icons/menu.svg.js +18 -2
- package/dist/esm/src/components/Icon/icons/mic.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/minus.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/moreHorizontal.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/moreVertical.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/output.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/plus.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/redo.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/requiredStar.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/save.svg.js +17 -2
- package/dist/esm/src/components/Icon/icons/send.svg.js +16 -2
- package/dist/esm/src/components/Icon/icons/settings.svg.js +52 -2
- package/dist/esm/src/components/Icon/icons/shoppingBag.svg.js +17 -2
- package/dist/esm/src/components/Icon/icons/table.svg.js +15 -2
- package/dist/esm/src/components/Icon/icons/telegram.svg.js +19 -2
- package/dist/esm/src/components/Icon/icons/undo.svg.js +15 -2
- package/dist/esm/src/components/Input/Input.js +345 -2
- package/dist/esm/src/components/Input/Input.styl.js +7 -2
- package/dist/esm/src/components/InputFile/InputFile.js +295 -2
- package/dist/esm/src/components/InputFile/InputFile.styl.js +7 -2
- package/dist/esm/src/components/InputFile/InputFile.types.js +0 -1
- package/dist/esm/src/components/InputFile/Item/Item.js +18 -2
- package/dist/esm/src/components/InputFile/Item/Item.styl.js +7 -2
- package/dist/esm/src/components/Label/Label.constants.json.js +8 -2
- package/dist/esm/src/components/Label/Label.helpers.js +35 -2
- package/dist/esm/src/components/Label/Label.js +58 -2
- package/dist/esm/src/components/Label/Label.styl.js +7 -2
- package/dist/esm/src/components/Lazy/Lazy.js +65 -2
- package/dist/esm/src/components/LightBox/LightBox.js +28 -2
- package/dist/esm/src/components/LightBox/LightBox.styl.js +7 -2
- package/dist/esm/src/components/Notifications/Notifications.constants.json.js +6 -2
- package/dist/esm/src/components/Notifications/Notifications.js +67 -2
- package/dist/esm/src/components/Notifications/Notifications.styl.js +7 -2
- package/dist/esm/src/components/Notifications/store.js +62 -2
- package/dist/esm/src/components/Paranja/Paranja.js +14 -2
- package/dist/esm/src/components/Paranja/Paranja.styl.js +7 -2
- package/dist/esm/src/components/Popup/Popup.helpers.js +31 -2
- package/dist/esm/src/components/Popup/Popup.js +397 -2
- package/dist/esm/src/components/Popup/Popup.styl.js +7 -2
- package/dist/esm/src/components/PopupMenu/PopupMenu.js +15 -2
- package/dist/esm/src/components/PopupMenu/PopupMenu.styl.js +7 -2
- package/dist/esm/src/components/Portal/Portal.js +19 -2
- package/dist/esm/src/components/RequiredStar/RequiredStar.js +12 -2
- package/dist/esm/src/components/RequiredStar/RequiredStar.styl.js +7 -2
- package/dist/esm/src/components/Router/Link/Link.js +61 -2
- package/dist/esm/src/components/Router/Link/Link.styl.js +7 -2
- package/dist/esm/src/components/Router/Redirect.js +12 -2
- package/dist/esm/src/components/Router/Route.js +4 -2
- package/dist/esm/src/components/Router/Router.helpers.js +33 -2
- package/dist/esm/src/components/Router/Router.js +68 -2
- package/dist/esm/src/components/Router/context.js +5 -2
- package/dist/esm/src/components/Router/store.js +55 -2
- package/dist/esm/src/components/Scroll/Scroll.js +274 -2
- package/dist/esm/src/components/Scroll/Scroll.styl.js +7 -2
- package/dist/esm/src/components/Select/Select.helpers.js +37 -2
- package/dist/esm/src/components/Select/Select.js +585 -2
- package/dist/esm/src/components/Select/Select.styl.js +7 -2
- package/dist/esm/src/components/Spinner/Spinner.js +11 -2
- package/dist/esm/src/components/Spinner/Spinner.styl.js +7 -2
- package/dist/esm/src/components/Spinner/spinner.svg.js +24 -2
- package/dist/esm/src/components/Table/Table.js +24 -2
- package/dist/esm/src/components/Table/Table.styl.js +7 -2
- package/dist/esm/src/components/Tabs/Tabs.js +43 -2
- package/dist/esm/src/components/Tabs/Tabs.styl.js +7 -2
- package/dist/esm/src/components/Text/Text.js +44 -2
- package/dist/esm/src/components/Text/Text.styl.js +7 -2
- package/dist/esm/src/components/Theme/Theme.defaults.js +50 -2
- package/dist/esm/src/components/Theme/Theme.helpers.js +67 -2
- package/dist/esm/src/components/Theme/Theme.js +13 -2
- package/dist/esm/src/components/VH/VH.js +33 -2
- package/dist/esm/src/components/Virtualized/List/List.js +124 -2
- package/dist/esm/src/components/Virtualized/List/List.styl.js +7 -2
- package/dist/esm/src/components/Virtualized/List/ListScroll.js +21 -2
- package/dist/esm/src/components/Virtualized/List/ListScroll.styl.js +7 -2
- package/dist/esm/src/components/Virtualized/Virtualized.helpers.js +14 -2
- package/dist/esm/src/components/Virtualized/Virtualized.js +200 -2
- package/dist/esm/src/components/Virtualized/Virtualized.styl.js +7 -2
- package/dist/esm/src/components/Virtualized/Virtualized.types.js +0 -1
- package/dist/esm/src/services/i18n.js +68 -2
- package/dist/esm/src/tools/array.js +60 -2
- package/dist/esm/src/tools/config.js +9 -2
- package/dist/esm/src/tools/date.js +11 -2
- package/dist/esm/src/tools/debounce.js +11 -2
- package/dist/esm/src/tools/dom.js +46 -2
- package/dist/esm/src/tools/env.js +3 -2
- package/dist/esm/src/tools/file.js +11 -2
- package/dist/esm/src/tools/localStorage.js +31 -2
- package/dist/esm/src/tools/number.js +27 -2
- package/dist/esm/src/tools/object.js +5 -2
- package/dist/esm/src/tools/queryParams.js +20 -2
- package/dist/esm/src/tools/rangeMap.js +3 -2
- package/dist/esm/src/tools/resizeObserver.js +68 -2
- package/dist/esm/src/tools/scroll.js +41 -2
- package/dist/esm/src/tools/string.js +7 -2
- package/dist/esm/src/tools/throttle.js +30 -2
- package/dist/esm/src/tools/uid.js +7 -2
- package/dist/esm/types/src/components/Icon/Icon.d.ts +3 -9
- package/dist/esm/types/src/components/Icon/Icon.example.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
- package/dist/esm/src/components/AssistiveText/AssistiveText.js.map +0 -1
- package/dist/esm/src/components/AssistiveText/AssistiveText.styl.js.map +0 -1
- package/dist/esm/src/components/Button/Button.helpers.js.map +0 -1
- package/dist/esm/src/components/Button/Button.js.map +0 -1
- package/dist/esm/src/components/Button/Button.styl.js.map +0 -1
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.js.map +0 -1
- package/dist/esm/src/components/ButtonGroup/ButtonGroup.styl.js.map +0 -1
- package/dist/esm/src/components/Calendar/Calendar.helpers.js.map +0 -1
- package/dist/esm/src/components/Calendar/Calendar.js.map +0 -1
- package/dist/esm/src/components/Calendar/Calendar.styl.js.map +0 -1
- package/dist/esm/src/components/Checkbox/Checkbox.js.map +0 -1
- package/dist/esm/src/components/Checkbox/Checkbox.styl.js.map +0 -1
- package/dist/esm/src/components/Container/Container.js.map +0 -1
- package/dist/esm/src/components/Container/Container.styl.js.map +0 -1
- package/dist/esm/src/components/DatePicker/DatePicker.helpers.js.map +0 -1
- package/dist/esm/src/components/DatePicker/DatePicker.js.map +0 -1
- package/dist/esm/src/components/DatePicker/DatePicker.styl.js.map +0 -1
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.js.map +0 -1
- package/dist/esm/src/components/DatePickerInput/DatePickerInput.styl.js.map +0 -1
- package/dist/esm/src/components/DateTime/DateTime.js.map +0 -1
- package/dist/esm/src/components/Draggable/Draggable.js.map +0 -1
- package/dist/esm/src/components/Draggable/Draggable.styl.js.map +0 -1
- package/dist/esm/src/components/Expand/Expand.js.map +0 -1
- package/dist/esm/src/components/Expand/Expand.styl.js.map +0 -1
- package/dist/esm/src/components/Form/Form.helpers.js.map +0 -1
- package/dist/esm/src/components/Form/Form.js.map +0 -1
- package/dist/esm/src/components/Form/Form.styl.js.map +0 -1
- package/dist/esm/src/components/Form/Form.types.js.map +0 -1
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.js.map +0 -1
- package/dist/esm/src/components/Form/SubmitButtons/SubmitButtons.styl.js.map +0 -1
- package/dist/esm/src/components/Form/Validator.js.map +0 -1
- package/dist/esm/src/components/Gallery/Dots/Dots.js.map +0 -1
- package/dist/esm/src/components/Gallery/Dots/Dots.styl.js.map +0 -1
- package/dist/esm/src/components/Gallery/Gallery.js.map +0 -1
- package/dist/esm/src/components/Gallery/Gallery.styl.js.map +0 -1
- package/dist/esm/src/components/Heading/Heading.js.map +0 -1
- package/dist/esm/src/components/Heading/Heading.styl.js.map +0 -1
- package/dist/esm/src/components/Icon/Icon.js.map +0 -1
- package/dist/esm/src/components/Icon/Icon.styl.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/avatar.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/brokenImage.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/check.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronDown.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronLeft.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronRight.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/chevronUp.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/close.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/colors.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/copy.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/delete.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/draft.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/edit.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/email.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/externalLink.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/eye.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/fullscreen.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/fullscreenExit.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/function.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/gear.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/group.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/history.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/home.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/index.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/instagram.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/link.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/loader.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/menu.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/mic.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/minus.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/moreHorizontal.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/moreVertical.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/output.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/plus.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/redo.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/requiredStar.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/save.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/send.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/settings.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/shoppingBag.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/table.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/telegram.svg.js.map +0 -1
- package/dist/esm/src/components/Icon/icons/undo.svg.js.map +0 -1
- package/dist/esm/src/components/Input/Input.js.map +0 -1
- package/dist/esm/src/components/Input/Input.styl.js.map +0 -1
- package/dist/esm/src/components/InputFile/InputFile.js.map +0 -1
- package/dist/esm/src/components/InputFile/InputFile.styl.js.map +0 -1
- package/dist/esm/src/components/InputFile/InputFile.types.js.map +0 -1
- package/dist/esm/src/components/InputFile/Item/Item.js.map +0 -1
- package/dist/esm/src/components/InputFile/Item/Item.styl.js.map +0 -1
- package/dist/esm/src/components/Label/Label.constants.json.js.map +0 -1
- package/dist/esm/src/components/Label/Label.helpers.js.map +0 -1
- package/dist/esm/src/components/Label/Label.js.map +0 -1
- package/dist/esm/src/components/Label/Label.styl.js.map +0 -1
- package/dist/esm/src/components/Lazy/Lazy.js.map +0 -1
- package/dist/esm/src/components/LightBox/LightBox.js.map +0 -1
- package/dist/esm/src/components/LightBox/LightBox.styl.js.map +0 -1
- package/dist/esm/src/components/Notifications/Notifications.constants.json.js.map +0 -1
- package/dist/esm/src/components/Notifications/Notifications.js.map +0 -1
- package/dist/esm/src/components/Notifications/Notifications.styl.js.map +0 -1
- package/dist/esm/src/components/Notifications/store.js.map +0 -1
- package/dist/esm/src/components/Paranja/Paranja.js.map +0 -1
- package/dist/esm/src/components/Paranja/Paranja.styl.js.map +0 -1
- package/dist/esm/src/components/Popup/Popup.helpers.js.map +0 -1
- package/dist/esm/src/components/Popup/Popup.js.map +0 -1
- package/dist/esm/src/components/Popup/Popup.styl.js.map +0 -1
- package/dist/esm/src/components/PopupMenu/PopupMenu.js.map +0 -1
- package/dist/esm/src/components/PopupMenu/PopupMenu.styl.js.map +0 -1
- package/dist/esm/src/components/Portal/Portal.js.map +0 -1
- package/dist/esm/src/components/RequiredStar/RequiredStar.js.map +0 -1
- package/dist/esm/src/components/RequiredStar/RequiredStar.styl.js.map +0 -1
- package/dist/esm/src/components/Router/Link/Link.js.map +0 -1
- package/dist/esm/src/components/Router/Link/Link.styl.js.map +0 -1
- package/dist/esm/src/components/Router/Redirect.js.map +0 -1
- package/dist/esm/src/components/Router/Route.js.map +0 -1
- package/dist/esm/src/components/Router/Router.helpers.js.map +0 -1
- package/dist/esm/src/components/Router/Router.js.map +0 -1
- package/dist/esm/src/components/Router/context.js.map +0 -1
- package/dist/esm/src/components/Router/store.js.map +0 -1
- package/dist/esm/src/components/Scroll/Scroll.js.map +0 -1
- package/dist/esm/src/components/Scroll/Scroll.styl.js.map +0 -1
- package/dist/esm/src/components/Select/Select.helpers.js.map +0 -1
- package/dist/esm/src/components/Select/Select.js.map +0 -1
- package/dist/esm/src/components/Select/Select.styl.js.map +0 -1
- package/dist/esm/src/components/Spinner/Spinner.js.map +0 -1
- package/dist/esm/src/components/Spinner/Spinner.styl.js.map +0 -1
- package/dist/esm/src/components/Spinner/spinner.svg.js.map +0 -1
- package/dist/esm/src/components/Table/Table.js.map +0 -1
- package/dist/esm/src/components/Table/Table.styl.js.map +0 -1
- package/dist/esm/src/components/Tabs/Tabs.js.map +0 -1
- package/dist/esm/src/components/Tabs/Tabs.styl.js.map +0 -1
- package/dist/esm/src/components/Text/Text.js.map +0 -1
- package/dist/esm/src/components/Text/Text.styl.js.map +0 -1
- package/dist/esm/src/components/Theme/Theme.defaults.js.map +0 -1
- package/dist/esm/src/components/Theme/Theme.helpers.js.map +0 -1
- package/dist/esm/src/components/Theme/Theme.js.map +0 -1
- package/dist/esm/src/components/VH/VH.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/List.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/List.styl.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/ListScroll.js.map +0 -1
- package/dist/esm/src/components/Virtualized/List/ListScroll.styl.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.helpers.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.styl.js.map +0 -1
- package/dist/esm/src/components/Virtualized/Virtualized.types.js.map +0 -1
- package/dist/esm/src/services/i18n.js.map +0 -1
- package/dist/esm/src/tools/array.js.map +0 -1
- package/dist/esm/src/tools/config.js.map +0 -1
- package/dist/esm/src/tools/date.js.map +0 -1
- package/dist/esm/src/tools/debounce.js.map +0 -1
- package/dist/esm/src/tools/dom.js.map +0 -1
- package/dist/esm/src/tools/env.js.map +0 -1
- package/dist/esm/src/tools/file.js.map +0 -1
- package/dist/esm/src/tools/localStorage.js.map +0 -1
- package/dist/esm/src/tools/number.js.map +0 -1
- package/dist/esm/src/tools/object.js.map +0 -1
- package/dist/esm/src/tools/queryParams.js.map +0 -1
- package/dist/esm/src/tools/rangeMap.js.map +0 -1
- package/dist/esm/src/tools/resizeObserver.js.map +0 -1
- package/dist/esm/src/tools/scroll.js.map +0 -1
- package/dist/esm/src/tools/string.js.map +0 -1
- package/dist/esm/src/tools/throttle.js.map +0 -1
- package/dist/esm/src/tools/uid.js.map +0 -1
|
@@ -1,2 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { createElement, Component } from 'react';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import { withStore } from 'justorm/react';
|
|
5
|
+
import { Icon } from '../Icon/Icon.js';
|
|
6
|
+
import { Button } from '../Button/Button.js';
|
|
7
|
+
import { Scroll } from '../Scroll/Scroll.js';
|
|
8
|
+
import STORE from './store.js';
|
|
9
|
+
import S from './Notifications.styl.js';
|
|
10
|
+
|
|
11
|
+
function getTouchPos(e) {
|
|
12
|
+
const { clientX: x, clientY: y } = e.targetTouches[0];
|
|
13
|
+
return { x, y };
|
|
14
|
+
}
|
|
15
|
+
function getDeltaPos(p1, p2) {
|
|
16
|
+
return {
|
|
17
|
+
x: Math.abs(p2.x - p1.x),
|
|
18
|
+
y: Math.abs(p2.y - p1.y),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const TOUCH_MOVE_TRESHOLD = 50;
|
|
22
|
+
class Item extends Component {
|
|
23
|
+
startPos = null;
|
|
24
|
+
onTouchStart = e => {
|
|
25
|
+
this.startPos = getTouchPos(e);
|
|
26
|
+
};
|
|
27
|
+
onTouchMove = e => {
|
|
28
|
+
const { unpause } = this.props;
|
|
29
|
+
if (!this.startPos)
|
|
30
|
+
return;
|
|
31
|
+
// e.preventDefault();
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
const pos = getTouchPos(e);
|
|
34
|
+
const delta = getDeltaPos(this.startPos, pos);
|
|
35
|
+
if (delta.x > delta.y && delta.x > TOUCH_MOVE_TRESHOLD) {
|
|
36
|
+
unpause();
|
|
37
|
+
this.closeMe();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
onTouchEnd = () => {
|
|
41
|
+
const { unpause } = this.props;
|
|
42
|
+
unpause();
|
|
43
|
+
this.startPos = null;
|
|
44
|
+
};
|
|
45
|
+
onTouchCancel = () => (this.startPos = null);
|
|
46
|
+
closeMe = () => {
|
|
47
|
+
const { id, close } = this.props;
|
|
48
|
+
close(id);
|
|
49
|
+
};
|
|
50
|
+
render() {
|
|
51
|
+
const { type = 'default', title, content, visible, pause, unpause, } = this.props;
|
|
52
|
+
const classes = cn(S.item, S[`type-${type}`], visible && S.visible);
|
|
53
|
+
return (jsx("div", { className: classes, onMouseOver: pause, onFocus: pause, onTouchStart: this.onTouchStart, onTouchMove: this.onTouchMove, onMouseOut: unpause, onBlur: unpause, onTouchEnd: this.onTouchEnd, onTouchCancel: this.onTouchCancel, children: jsxs("div", { className: S.itemInner, children: [(title || content) && (jsxs("div", { className: S.text, children: [title && jsx("div", { className: S.title, children: title }), content && jsx("div", { className: S.content, children: content })] })), jsx(Button, { className: S.close, variant: "clear", square: true, onClick: this.closeMe, children: jsx(Icon, { type: "close", size: "s" }) })] }) }));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const NotificationsStore = STORE;
|
|
57
|
+
const Notifications = withStore({
|
|
58
|
+
notifications: ['items', 'data'],
|
|
59
|
+
})(function Notifications({ store, ...rest }) {
|
|
60
|
+
const { notifications } = store;
|
|
61
|
+
const { items, data, pause, unpause, close } = notifications;
|
|
62
|
+
const api = { pause, unpause, close };
|
|
63
|
+
const classes = cn(S.root, items.length === 0 && S.empty);
|
|
64
|
+
return (jsx(Scroll, { ...rest, y: true, size: "s", className: classes, innerClassName: S.inner, offset: { y: { before: 22, after: 22 } }, children: items.map(id => (createElement(Item, { ...data[id], ...api, id: id, key: id }))) }));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export { Notifications, NotificationsStore };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import styleInject from
|
|
2
|
-
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".Notifications_root__S3ujN{max-height:calc(var(--vh)*100);overflow:hidden;position:fixed;right:0;top:0;transform:translateZ(0);transition:right .3s ease-out;width:320px;z-index:20}.Notifications_inner__6v9e3{padding:var(--indent-m)}.Notifications_empty__zCpOA{pointer-events:none}.Notifications_itemInner__nEYAl,.Notifications_item__I3Up4{border-radius:var(--border-radius-l)}.Notifications_item__I3Up4{-webkit-backface-visibility:hidden;backface-visibility:hidden;left:100%;max-height:0;max-width:100%;opacity:0;position:relative;transition:all .3s ease-out;width:300px}.Notifications_item__I3Up4+.Notifications_item__I3Up4{padding-top:10px}.Notifications_item__I3Up4:hover{transform:translateX(-2px)}.Notifications_visible__ln4-n{left:0;max-height:500px;opacity:1}.Notifications_itemInner__nEYAl{align-items:center;-webkit-backdrop-filter:blur(30px);backdrop-filter:blur(30px);background-color:var(--decent-color-alpha-500);box-shadow:inset 0 0 1px var(--accent-color-alpha-300),0 0 20px var(--decent-color);box-sizing:border-box;display:flex;padding:16px 32px 16px 20px;position:relative;transition:.3s ease-out;transition-property:transform}.Notifications_type-warning__Nxg6C .Notifications_itemInner__nEYAl{background-color:var(--warning-color-alpha-300)}.Notifications_type-danger__zeIMt .Notifications_itemInner__nEYAl{background-color:var(--danger-color-alpha-300)}.Notifications_icon__nKs-X{background:no-repeat 50%;height:24px;margin-right:10px;min-width:24px;width:24px}.Notifications_type-loading__N4EE5 .Notifications_icon__nKs-X{transform:translateY(-20px)}.Notifications_text__7QZL6{display:flex;flex-direction:column;flex-grow:1;z-index:1}.Notifications_title__Gu9bs{font-size:16px;font-weight:700}.Notifications_content__Zrvw2{font-size:12px;margin-top:calc(var(--indent-s)/2)}.Notifications_content__Zrvw2:first-child{margin-top:0}.Notifications_close__-IUH3{background-color:transparent;border-radius:50%;cursor:pointer;height:40px!important;max-height:40px!important;max-width:40px!important;opacity:0;position:absolute;right:-5px;top:-5px;transform:scale(.8);transition:.1s ease-out;transition-property:opacity,transform;width:40px!important}.Notifications_item__I3Up4:hover .Notifications_close__-IUH3{opacity:.8}.Notifications_close__-IUH3:hover{background-color:transparent;background-color:initial;opacity:1;transform:scale(1)}@media (max-width:700px){.Notifications_item__I3Up4,.Notifications_root__S3ujN{width:100%}.Notifications_title__Gu9bs{font-size:20px}.Notifications_content__Zrvw2{font-size:16px}.Notifications_close__-IUH3{transform:scale(1.2)}}";
|
|
4
|
+
var S = {"root":"Notifications_root__S3ujN","inner":"Notifications_inner__6v9e3","empty":"Notifications_empty__zCpOA","item":"Notifications_item__I3Up4","itemInner":"Notifications_itemInner__nEYAl","visible":"Notifications_visible__ln4-n","type-warning":"Notifications_type-warning__Nxg6C","type-danger":"Notifications_type-danger__zeIMt","icon":"Notifications_icon__nKs-X","type-loading":"Notifications_type-loading__N4EE5","text":"Notifications_text__7QZL6","title":"Notifications_title__Gu9bs","content":"Notifications_content__Zrvw2","close":"Notifications_close__-IUH3"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -1,2 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { createStore } from 'justorm/react';
|
|
2
|
+
import Time from 'timen';
|
|
3
|
+
import { spliceWhere } from '../../tools/array.js';
|
|
4
|
+
import { generateUID } from '../../tools/uid.js';
|
|
5
|
+
import C from './Notifications.constants.json.js';
|
|
6
|
+
|
|
7
|
+
const SHOW_TIME = 5000;
|
|
8
|
+
const STORE = createStore('notifications', {
|
|
9
|
+
items: [],
|
|
10
|
+
autohide: [],
|
|
11
|
+
data: {},
|
|
12
|
+
paused: false,
|
|
13
|
+
show(data) {
|
|
14
|
+
const id = generateUID();
|
|
15
|
+
this.items.push(id);
|
|
16
|
+
this.data[id] = {
|
|
17
|
+
...data,
|
|
18
|
+
createdAt: Date.now(),
|
|
19
|
+
};
|
|
20
|
+
Time.after(C.ANIMATION_DURATION, () => (this.data[id].visible = true));
|
|
21
|
+
if (data.autohide !== false) {
|
|
22
|
+
this.autohide.push(id);
|
|
23
|
+
}
|
|
24
|
+
return id;
|
|
25
|
+
},
|
|
26
|
+
pause() {
|
|
27
|
+
this.paused = true;
|
|
28
|
+
this.pausedAt = Date.now();
|
|
29
|
+
},
|
|
30
|
+
unpause() {
|
|
31
|
+
const pauseTime = Date.now() - this.pausedAt;
|
|
32
|
+
this.autohide.forEach(id => {
|
|
33
|
+
this.data[id].createdAt += pauseTime;
|
|
34
|
+
});
|
|
35
|
+
this.paused = false;
|
|
36
|
+
},
|
|
37
|
+
close(id) {
|
|
38
|
+
this.data[id].visible = false;
|
|
39
|
+
Time.after(C.ANIMATION_DURATION, () => this.remove(id));
|
|
40
|
+
},
|
|
41
|
+
remove(id) {
|
|
42
|
+
spliceWhere(this.autohide, id);
|
|
43
|
+
spliceWhere(this.items, id);
|
|
44
|
+
delete this.data[id];
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
// worker
|
|
48
|
+
Time.every(50, function tick() {
|
|
49
|
+
const { paused, autohide, data } = STORE;
|
|
50
|
+
if (paused || autohide.length === 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const id = autohide[0]; // TODO: move trough all autohide until some will !readyToHide
|
|
54
|
+
const item = data[id];
|
|
55
|
+
const readyToHide = Date.now() - item.createdAt > SHOW_TIME;
|
|
56
|
+
if (item.visible && readyToHide) {
|
|
57
|
+
item.visible = false;
|
|
58
|
+
Time.after(C.ANIMATION_DURATION, () => STORE.remove(id));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export { STORE as default };
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import{jsx}from
|
|
2
|
-
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { Portal } from '../Portal/Portal.js';
|
|
4
|
+
import S from './Paranja.styl.js';
|
|
5
|
+
|
|
6
|
+
const Paranja = ({ className, children, visible = true, inline = false, blur = false, }) => {
|
|
7
|
+
const classes = cn(S.root, visible && S.visible, blur && S.blur, className);
|
|
8
|
+
const node = jsx("div", { className: classes, children: children });
|
|
9
|
+
if (inline)
|
|
10
|
+
return node;
|
|
11
|
+
return jsx(Portal, { children: node });
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { Paranja };
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import styleInject from
|
|
2
|
-
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".Paranja_root__ddboV{align-items:center;background-color:var(--decent-color-alpha-900);bottom:0;display:flex;justify-content:center;left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0;transition:opacity .2s ease-out;z-index:10}.Paranja_visible__xZukG{opacity:1;pointer-events:all}.Paranja_visible__xZukG.Paranja_blur__Hg0SQ{-webkit-backdrop-filter:blur(50px);backdrop-filter:blur(50px);background-color:var(--decent-color-alpha-500)}";
|
|
4
|
+
var S = {"root":"Paranja_root__ddboV","visible":"Paranja_visible__xZukG","blur":"Paranja_blur__Hg0SQ"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
import{spliceWhere}from
|
|
2
|
-
|
|
1
|
+
import { spliceWhere } from '../../tools/array.js';
|
|
2
|
+
import 'nanoid';
|
|
3
|
+
import '../../tools/dom.js';
|
|
4
|
+
import 'timen';
|
|
5
|
+
import 'compareq';
|
|
6
|
+
import 'lodash.pick';
|
|
7
|
+
import '../../tools/queryParams.js';
|
|
8
|
+
|
|
9
|
+
const childs = {};
|
|
10
|
+
let popupIds = 0;
|
|
11
|
+
const getId = () => ++popupIds;
|
|
12
|
+
const getPopupId = (elem, attr = 'data-popup-id') => {
|
|
13
|
+
const id = elem.getAttribute(attr);
|
|
14
|
+
return id ? parseInt(id, 10) : null;
|
|
15
|
+
};
|
|
16
|
+
function isLastChild(rootId, id) {
|
|
17
|
+
const ids = childs[rootId];
|
|
18
|
+
return ids && ids[ids.length - 1] === id;
|
|
19
|
+
}
|
|
20
|
+
function setChild(rootId, id) {
|
|
21
|
+
if (!childs[rootId])
|
|
22
|
+
childs[rootId] = [];
|
|
23
|
+
childs[rootId].push(id);
|
|
24
|
+
}
|
|
25
|
+
function unsetChild(rootId, id) {
|
|
26
|
+
spliceWhere(childs[rootId], id);
|
|
27
|
+
if (!childs[rootId].length)
|
|
28
|
+
delete childs[rootId];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { childs, getId, getPopupId, isLastChild, setChild, unsetChild };
|
|
@@ -1,2 +1,397 @@
|
|
|
1
|
-
import{jsx,jsxs,Fragment
|
|
2
|
-
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Component, createRef } from 'react';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import { createStore } from 'justorm/react';
|
|
5
|
+
import Time from 'timen';
|
|
6
|
+
import { Paranja } from '../Paranja/Paranja.js';
|
|
7
|
+
import { Portal } from '../Portal/Portal.js';
|
|
8
|
+
import { getCoords } from '../../tools/dom.js';
|
|
9
|
+
import { observe, unobserve } from '../../tools/resizeObserver.js';
|
|
10
|
+
import { isBrowser } from '../../tools/env.js';
|
|
11
|
+
import debounce from '../../tools/debounce.js';
|
|
12
|
+
import throttle from '../../tools/throttle.js';
|
|
13
|
+
import S from './Popup.styl.js';
|
|
14
|
+
import { getId, getPopupId, isLastChild, unsetChild, childs, setChild } from './Popup.helpers.js';
|
|
15
|
+
|
|
16
|
+
const ANIMATION_DURATION = 100;
|
|
17
|
+
const OFFSET_GAP = 10;
|
|
18
|
+
const INITIAL_OFFSET = { top: 0, left: 0 };
|
|
19
|
+
class Popup extends Component {
|
|
20
|
+
rootElem = createRef();
|
|
21
|
+
triggerElem = createRef();
|
|
22
|
+
containerElem = null;
|
|
23
|
+
onContainerElemRef = elem => {
|
|
24
|
+
this.containerElem = elem;
|
|
25
|
+
// TODO: useElemResize(elem, callback)
|
|
26
|
+
if (elem) {
|
|
27
|
+
this.unsubscribeSizeChange();
|
|
28
|
+
this.subscribeSizeChange();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
focused = false;
|
|
32
|
+
pointerPressed = false;
|
|
33
|
+
subscribedHoverControl = false;
|
|
34
|
+
subscribedSizeChange = false;
|
|
35
|
+
pointerDownTarget = null;
|
|
36
|
+
isPointerPressedInside = false;
|
|
37
|
+
needDropOffset = false;
|
|
38
|
+
id;
|
|
39
|
+
parentPopupContent;
|
|
40
|
+
store;
|
|
41
|
+
timers = Time.create();
|
|
42
|
+
scrollParent;
|
|
43
|
+
offset = { ...INITIAL_OFFSET };
|
|
44
|
+
static defaultProps = {
|
|
45
|
+
size: 'm',
|
|
46
|
+
direction: '',
|
|
47
|
+
animated: true,
|
|
48
|
+
};
|
|
49
|
+
constructor(props) {
|
|
50
|
+
super(props);
|
|
51
|
+
const isOpen = Boolean(props.isOpen);
|
|
52
|
+
this.id = getId();
|
|
53
|
+
this.store = createStore(this, {
|
|
54
|
+
rootPopupId: null,
|
|
55
|
+
isOpen,
|
|
56
|
+
isContentVisible: isOpen,
|
|
57
|
+
animating: false,
|
|
58
|
+
direction: props.direction,
|
|
59
|
+
triggerBounds: null,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
componentDidMount() {
|
|
63
|
+
const { hoverControl, focusControl } = this.props;
|
|
64
|
+
const parentPopupContent = this.triggerElem.current.closest(`.${S.content}`);
|
|
65
|
+
document.addEventListener('pointerdown', this.onDocPointerDown, true);
|
|
66
|
+
document.addEventListener('pointerup', this.onDocPointerUp, true);
|
|
67
|
+
if (parentPopupContent) {
|
|
68
|
+
this.store.rootPopupId =
|
|
69
|
+
getPopupId(parentPopupContent, 'data-root-popup-id') ||
|
|
70
|
+
getPopupId(parentPopupContent, 'data-popup-id');
|
|
71
|
+
}
|
|
72
|
+
if (focusControl) {
|
|
73
|
+
document.addEventListener('keydown', this.onDocKeyDown, true);
|
|
74
|
+
document.addEventListener('keyup', this.onDocKeyUp);
|
|
75
|
+
}
|
|
76
|
+
if (hoverControl)
|
|
77
|
+
this.subscribeHoverControl();
|
|
78
|
+
this.subscribeScroll();
|
|
79
|
+
}
|
|
80
|
+
componentDidUpdate(prevProps) {
|
|
81
|
+
const { isOpen, disabled, hoverControl } = this.props;
|
|
82
|
+
if (disabled) {
|
|
83
|
+
this.store.isOpen = false; // close when receive disabled=true
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!prevProps.hoverControl && hoverControl)
|
|
87
|
+
this.subscribeHoverControl();
|
|
88
|
+
if (prevProps.hoverControl && !hoverControl)
|
|
89
|
+
this.unsubscribeHoverControl();
|
|
90
|
+
if (typeof isOpen === 'boolean' && isOpen !== prevProps.isOpen) {
|
|
91
|
+
isOpen ? this.open() : this.close();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
componentWillUnmount() {
|
|
95
|
+
this.timers.clear();
|
|
96
|
+
document.removeEventListener('keyup', this.onDocKeyUp, true);
|
|
97
|
+
if (this.scrollParent) {
|
|
98
|
+
this.scrollParent.removeEventListener('scroll', this.close);
|
|
99
|
+
}
|
|
100
|
+
this.unsubscribeHoverControl();
|
|
101
|
+
this.unsubscribeSizeChange();
|
|
102
|
+
this.unsubscribeScroll();
|
|
103
|
+
}
|
|
104
|
+
subscribeSizeChange() {
|
|
105
|
+
if (this.subscribedSizeChange)
|
|
106
|
+
return;
|
|
107
|
+
this.subscribedSizeChange = true;
|
|
108
|
+
observe(this.triggerElem.current, this.onTriggerResize);
|
|
109
|
+
observe(this.containerElem, this.onContainerResize);
|
|
110
|
+
}
|
|
111
|
+
subscribeScroll() {
|
|
112
|
+
if (isBrowser && !this.props.inline) {
|
|
113
|
+
document.addEventListener('scroll', this.onScroll, true);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
unsubscribeScroll() {
|
|
117
|
+
document.removeEventListener('scroll', this.onScroll, true);
|
|
118
|
+
}
|
|
119
|
+
unsubscribeSizeChange() {
|
|
120
|
+
this.subscribedSizeChange = false;
|
|
121
|
+
unobserve(this.triggerElem.current);
|
|
122
|
+
unobserve(this.containerElem);
|
|
123
|
+
}
|
|
124
|
+
subscribeHoverControl() {
|
|
125
|
+
if (this.subscribedHoverControl)
|
|
126
|
+
return;
|
|
127
|
+
this.subscribedHoverControl = true;
|
|
128
|
+
document.addEventListener('pointermove', this.checkHover);
|
|
129
|
+
document.addEventListener('pointerup', this.checkHover);
|
|
130
|
+
}
|
|
131
|
+
unsubscribeHoverControl() {
|
|
132
|
+
if (!this.subscribedHoverControl)
|
|
133
|
+
return;
|
|
134
|
+
this.subscribedHoverControl = false;
|
|
135
|
+
document.removeEventListener('pointermove', this.checkHover);
|
|
136
|
+
document.removeEventListener('pointerup', this.checkHover);
|
|
137
|
+
}
|
|
138
|
+
updateBounds() {
|
|
139
|
+
if (this.store.animating || !this.containerElem)
|
|
140
|
+
return;
|
|
141
|
+
if (!this.triggerElem.current)
|
|
142
|
+
return;
|
|
143
|
+
this.updateBoundsThrottled();
|
|
144
|
+
}
|
|
145
|
+
updateBoundsThrottled = throttle(() => {
|
|
146
|
+
const trigger = this.triggerElem.current;
|
|
147
|
+
const bounds = {
|
|
148
|
+
minHeight: trigger.offsetHeight,
|
|
149
|
+
minWidth: trigger.offsetWidth,
|
|
150
|
+
...getCoords(trigger),
|
|
151
|
+
};
|
|
152
|
+
Object.entries(bounds).forEach(([key, value]) => {
|
|
153
|
+
this.triggerElem.current.style[key] = value;
|
|
154
|
+
});
|
|
155
|
+
this.updateOffset();
|
|
156
|
+
this.store.triggerBounds = bounds;
|
|
157
|
+
}, 200, { trailing: true });
|
|
158
|
+
prevContentBounds = { width: 0, height: 0 };
|
|
159
|
+
updateOffset = () => {
|
|
160
|
+
const content = this.containerElem.getBoundingClientRect();
|
|
161
|
+
if (!content.height ||
|
|
162
|
+
!content.width ||
|
|
163
|
+
this.prevContentBounds.width !== content.width ||
|
|
164
|
+
this.prevContentBounds.height !== content.height) {
|
|
165
|
+
this.prevContentBounds = content;
|
|
166
|
+
Time.after(100, this.updateOffset);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const { offset } = this;
|
|
170
|
+
const { innerHeight, innerWidth } = window;
|
|
171
|
+
const bottom = content.top + content.height + OFFSET_GAP - offset.top;
|
|
172
|
+
const right = content.left + content.width + OFFSET_GAP - offset.left;
|
|
173
|
+
if (content.top < 0) {
|
|
174
|
+
offset.top = -content.top + OFFSET_GAP;
|
|
175
|
+
}
|
|
176
|
+
else if (bottom > innerHeight) {
|
|
177
|
+
offset.top = innerHeight - bottom;
|
|
178
|
+
}
|
|
179
|
+
if (content.left < 0) {
|
|
180
|
+
offset.left = -content.left + OFFSET_GAP;
|
|
181
|
+
}
|
|
182
|
+
else if (right > innerWidth) {
|
|
183
|
+
offset.left = innerWidth - right;
|
|
184
|
+
}
|
|
185
|
+
this.applyOffset();
|
|
186
|
+
};
|
|
187
|
+
applyOffset() {
|
|
188
|
+
const { left, top } = this.offset;
|
|
189
|
+
this.containerElem.style.marginTop = `${top}px`;
|
|
190
|
+
this.containerElem.style.marginLeft = `${left}px`;
|
|
191
|
+
}
|
|
192
|
+
checkHover = debounce((e) => {
|
|
193
|
+
if (this.isPointerPressedInside)
|
|
194
|
+
return;
|
|
195
|
+
const { isOpen, rootPopupId } = this.store;
|
|
196
|
+
const overTrigger = this.isPointerOver(e.target, S.trigger);
|
|
197
|
+
const overContent = this.isPointerOver(e.target, S.content);
|
|
198
|
+
if (!isOpen) {
|
|
199
|
+
if (overTrigger)
|
|
200
|
+
this.open();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
// isOpen
|
|
204
|
+
if (overTrigger || overContent)
|
|
205
|
+
return;
|
|
206
|
+
if (typeof rootPopupId === 'number') {
|
|
207
|
+
if (isLastChild(rootPopupId, this.id)) {
|
|
208
|
+
this.close();
|
|
209
|
+
unsetChild(rootPopupId, this.id);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
const isOverAnyPopupContent = e.target.closest(`.${S.content}`);
|
|
214
|
+
if (!isOverAnyPopupContent || !childs[this.id]?.length) {
|
|
215
|
+
this.close();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, 100);
|
|
219
|
+
isLastClickInside = () => this.pointerDownTarget &&
|
|
220
|
+
(this.pointerDownTarget.closest(`.${S.trigger}`) ||
|
|
221
|
+
this.pointerDownTarget.closest(`.${S.content}`));
|
|
222
|
+
onDocPointerDown = (e) => {
|
|
223
|
+
this.pointerDownTarget = e.target;
|
|
224
|
+
this.isPointerPressedInside = this.isLastClickInside();
|
|
225
|
+
this.timers.after(100, () => (this.pointerDownTarget = null));
|
|
226
|
+
};
|
|
227
|
+
onDocPointerUp = (e) => {
|
|
228
|
+
if (!this.isPointerPressedInside)
|
|
229
|
+
this.close();
|
|
230
|
+
this.isPointerPressedInside = false;
|
|
231
|
+
};
|
|
232
|
+
isPointerOver(target, elem) {
|
|
233
|
+
return target.closest(`.${elem}[data-popup-id="${this.id}"]`);
|
|
234
|
+
}
|
|
235
|
+
onScroll = throttle(e => {
|
|
236
|
+
if (!this.store.isOpen) {
|
|
237
|
+
const { top, left } = this.offset;
|
|
238
|
+
if (left || top) {
|
|
239
|
+
this.offset = { ...INITIAL_OFFSET };
|
|
240
|
+
this.applyOffset();
|
|
241
|
+
}
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
// if scrolling outside this popup - close it
|
|
245
|
+
if (!this.isPointerOver(e.target, S.content) &&
|
|
246
|
+
!childs[this.id]?.length) {
|
|
247
|
+
this.needDropOffset = true;
|
|
248
|
+
this.close();
|
|
249
|
+
}
|
|
250
|
+
}, 200);
|
|
251
|
+
onDocKeyDown = (e) => {
|
|
252
|
+
this.pointerDownTarget = null;
|
|
253
|
+
};
|
|
254
|
+
onDocKeyUp = (e) => {
|
|
255
|
+
if (this.store.isOpen && e.key === 'Escape') {
|
|
256
|
+
e.stopPropagation();
|
|
257
|
+
this.close();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (this.focused && /Enter| /.test(e.key)) {
|
|
261
|
+
e.stopPropagation();
|
|
262
|
+
this.toggle();
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
onTriggerPointerDown = e => {
|
|
266
|
+
this.pointerDownTarget = e.target;
|
|
267
|
+
this.pointerPressed = true;
|
|
268
|
+
};
|
|
269
|
+
onTriggerPointerUp = e => {
|
|
270
|
+
this.pointerPressed = false;
|
|
271
|
+
if (e.traget === this.pointerDownTarget)
|
|
272
|
+
this.toggle();
|
|
273
|
+
};
|
|
274
|
+
onFocus = e => {
|
|
275
|
+
this.focused = true;
|
|
276
|
+
this.props.triggerProps?.onFocus?.(e);
|
|
277
|
+
if (!this.pointerPressed)
|
|
278
|
+
this.open();
|
|
279
|
+
};
|
|
280
|
+
onBlur = e => {
|
|
281
|
+
this.focused = false;
|
|
282
|
+
this.props.triggerProps?.onBlur?.(e);
|
|
283
|
+
// give time to fire clicks inside popup
|
|
284
|
+
this.timers.after(60, () => {
|
|
285
|
+
if (!this.isLastClickInside())
|
|
286
|
+
this.close();
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
onTriggerResize = () => {
|
|
290
|
+
this.updateBounds();
|
|
291
|
+
};
|
|
292
|
+
onContainerResize = () => {
|
|
293
|
+
this.updateBounds();
|
|
294
|
+
};
|
|
295
|
+
open = throttle(() => {
|
|
296
|
+
const { rootPopupId } = this.store;
|
|
297
|
+
if (this.store.isOpen)
|
|
298
|
+
return;
|
|
299
|
+
this.updateBounds();
|
|
300
|
+
this.subscribeSizeChange();
|
|
301
|
+
this.subscribeScroll();
|
|
302
|
+
this.store.isContentVisible = true;
|
|
303
|
+
this.changeState(true, this.afterOpen);
|
|
304
|
+
if (rootPopupId)
|
|
305
|
+
setChild(rootPopupId, this.id);
|
|
306
|
+
}, 100);
|
|
307
|
+
close = () => {
|
|
308
|
+
if (!this.store.isOpen)
|
|
309
|
+
return;
|
|
310
|
+
this.unsubscribeSizeChange();
|
|
311
|
+
this.changeState(false, this.afterClose);
|
|
312
|
+
};
|
|
313
|
+
changeState(isOpen, callback) {
|
|
314
|
+
const { animated } = this.props;
|
|
315
|
+
this.timers.clear();
|
|
316
|
+
this.store.isOpen = isOpen;
|
|
317
|
+
if (animated) {
|
|
318
|
+
this.store.animating = true;
|
|
319
|
+
this.timers.after(ANIMATION_DURATION + 500, () => {
|
|
320
|
+
this.store.animating = false;
|
|
321
|
+
callback();
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
callback();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
afterOpen = () => {
|
|
329
|
+
this.props.onOpen?.();
|
|
330
|
+
};
|
|
331
|
+
afterClose = () => {
|
|
332
|
+
this.store.isContentVisible = false;
|
|
333
|
+
this.dropOffset();
|
|
334
|
+
this.props.onClose?.();
|
|
335
|
+
};
|
|
336
|
+
dropOffset() {
|
|
337
|
+
if (!this.needDropOffset)
|
|
338
|
+
return;
|
|
339
|
+
this.offset = { ...INITIAL_OFFSET };
|
|
340
|
+
this.applyOffset();
|
|
341
|
+
}
|
|
342
|
+
toggle = throttle(() => {
|
|
343
|
+
this.store.isOpen ? this.close() : this.open();
|
|
344
|
+
}, 100);
|
|
345
|
+
renderTrigger() {
|
|
346
|
+
const { trigger, content, disabled, focusControl, hoverControl, ...rest } = this.props;
|
|
347
|
+
const triggerProps = { ...rest.triggerProps };
|
|
348
|
+
const { isOpen } = this.store;
|
|
349
|
+
if (!trigger)
|
|
350
|
+
return null;
|
|
351
|
+
const disableTrigger = disabled || !content;
|
|
352
|
+
const classesTrigger = cn(S.trigger, isOpen && S.isOpen, disableTrigger && S.disabled, triggerProps.className);
|
|
353
|
+
if (!disableTrigger) {
|
|
354
|
+
triggerProps.role = 'button';
|
|
355
|
+
if (hoverControl) {
|
|
356
|
+
Object.assign(triggerProps, {
|
|
357
|
+
onPointerDown: this.onTriggerPointerDown,
|
|
358
|
+
onPointerUp: this.onTriggerPointerUp,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
if (focusControl) {
|
|
362
|
+
Object.assign(triggerProps, {
|
|
363
|
+
onFocus: this.onFocus,
|
|
364
|
+
onBlur: this.onBlur,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return (jsx("div", { className: classesTrigger, ...triggerProps, suppressHydrationWarning: true, "data-popup-id": this.id, ref: this.triggerElem, children: trigger }));
|
|
369
|
+
}
|
|
370
|
+
renderContent() {
|
|
371
|
+
const { content, contentProps = {}, wrapperProps = {}, size, disabled, inline, outlined, animated, paranja, blur, elevation, } = this.props;
|
|
372
|
+
const { isOpen, isContentVisible, animating, direction, triggerBounds, rootPopupId, } = this.store;
|
|
373
|
+
if (disabled)
|
|
374
|
+
return null;
|
|
375
|
+
const wrapperClasses = cn(S.contentWrapper, blur && S.blur, inline && S.inline, isOpen && S.isOpen, wrapperProps.className);
|
|
376
|
+
const trigger = this.triggerElem.current;
|
|
377
|
+
const [axis, float] = direction.split('-');
|
|
378
|
+
const classes = cn(S.content, outlined && S.outlined, animated && animating && S.animating, elevation && S[`elevation-${elevation}`], S[`size-${size}`], S[`axis-${axis}`], S[`float-${float || 'middle'}`], contentProps.className);
|
|
379
|
+
if (trigger && !inline && triggerBounds) {
|
|
380
|
+
wrapperProps.style = { ...triggerBounds };
|
|
381
|
+
}
|
|
382
|
+
const contentNode = (jsx("div", { ...wrapperProps, className: wrapperClasses, children: jsxs("div", { ...contentProps, ref: this.onContainerElemRef, className: classes, suppressHydrationWarning: true, "data-popup-id": this.id, "data-root-popup-id": rootPopupId, style: {
|
|
383
|
+
marginTop: this.offset.top,
|
|
384
|
+
marginLeft: this.offset.left,
|
|
385
|
+
}, children: [paranja && !rootPopupId && (jsx(Paranja, { visible: isContentVisible, blur: blur })), isContentVisible && jsx(Fragment, { children: content })] }) }));
|
|
386
|
+
if (inline)
|
|
387
|
+
return contentNode;
|
|
388
|
+
return jsx(Portal, { children: contentNode });
|
|
389
|
+
}
|
|
390
|
+
render() {
|
|
391
|
+
const { className } = this.props;
|
|
392
|
+
const classes = cn(S.root, className);
|
|
393
|
+
return (jsxs("div", { className: classes, ref: this.rootElem, children: [this.renderTrigger(), this.renderContent()] }));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export { ANIMATION_DURATION, Popup };
|