@homecode/ui 4.18.16 → 4.18.17
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 +343 -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,286 @@
|
|
|
1
|
-
import{jsx,jsxs}from
|
|
2
|
-
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { createStore } from 'justorm/react';
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
import compare from 'compareq';
|
|
6
|
+
import pick from 'lodash.pick';
|
|
7
|
+
import omit from 'lodash.omit';
|
|
8
|
+
import { Input } from '../Input/Input.js';
|
|
9
|
+
import S from './Form.styl.js';
|
|
10
|
+
import { cloneValues, getNotEmpty, getInitialTouched, patchWithCustomMessages, dropFocusFromSubmit, getVal } from './Form.helpers.js';
|
|
11
|
+
import { Validator } from './Validator.js';
|
|
12
|
+
import '../Spinner/Spinner.styl.js';
|
|
13
|
+
import '../Button/Button.styl.js';
|
|
14
|
+
import './SubmitButtons/SubmitButtons.styl.js';
|
|
15
|
+
|
|
16
|
+
const STORE_FIELDS_EXPOSED = [
|
|
17
|
+
'isDirty',
|
|
18
|
+
'isEmpty',
|
|
19
|
+
'isValid',
|
|
20
|
+
'isLoading',
|
|
21
|
+
'values',
|
|
22
|
+
'errors',
|
|
23
|
+
'touched',
|
|
24
|
+
'changed',
|
|
25
|
+
'disabled',
|
|
26
|
+
];
|
|
27
|
+
function Field(props) {
|
|
28
|
+
const { value, error, markEdited, isChanged, isTouched, clearMargins, component: Control = Input, className, onChange, onBlur, handleChange, handleBlur, children, ...controlProps } = props;
|
|
29
|
+
const { name, isHidden } = controlProps;
|
|
30
|
+
const valField = typeof value === 'boolean' ? 'checked' : 'value';
|
|
31
|
+
const classes = cn(className, S.field, isHidden && S.hidden, clearMargins && S.clearMargins, markEdited && isChanged && S.changed);
|
|
32
|
+
function handleFieldChange(e, val) {
|
|
33
|
+
const v = getVal(e, val, valField);
|
|
34
|
+
if (onChange && onChange(e, v) === false)
|
|
35
|
+
return;
|
|
36
|
+
handleChange(name, v);
|
|
37
|
+
}
|
|
38
|
+
function handleFieldBlur(e) {
|
|
39
|
+
if (onBlur && onBlur(e) === false)
|
|
40
|
+
return;
|
|
41
|
+
handleBlur(name);
|
|
42
|
+
}
|
|
43
|
+
Object.assign(controlProps, {
|
|
44
|
+
name,
|
|
45
|
+
[valField]: value,
|
|
46
|
+
onChange: handleFieldChange,
|
|
47
|
+
onBlur: handleFieldBlur,
|
|
48
|
+
error: isTouched && error?.message,
|
|
49
|
+
});
|
|
50
|
+
return (jsxs("div", { className: classes, children: [jsx(Control, { ...controlProps }), children] }));
|
|
51
|
+
}
|
|
52
|
+
class Form extends Component {
|
|
53
|
+
store;
|
|
54
|
+
validationSchema;
|
|
55
|
+
defaultValues = {};
|
|
56
|
+
constructor(props) {
|
|
57
|
+
super(props);
|
|
58
|
+
const { initialValues, validationSchema, defaultDisabled } = props;
|
|
59
|
+
this.updateDefaultValues();
|
|
60
|
+
this.validationSchema = validationSchema;
|
|
61
|
+
const values = cloneValues(initialValues);
|
|
62
|
+
const notEmpty = getNotEmpty(this.defaultValues, initialValues);
|
|
63
|
+
const disabled = Object(defaultDisabled);
|
|
64
|
+
this.store = createStore(this, {
|
|
65
|
+
values,
|
|
66
|
+
touched: getInitialTouched(initialValues),
|
|
67
|
+
changed: {},
|
|
68
|
+
notEmpty,
|
|
69
|
+
disabled,
|
|
70
|
+
isLoading: false,
|
|
71
|
+
isDirty: false,
|
|
72
|
+
// TODO: do not validate here (only when Field is mounted)
|
|
73
|
+
...this.getValidationState({ values, disabled }),
|
|
74
|
+
isEmpty: Object.keys(notEmpty).length === 0,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
componentDidMount() {
|
|
78
|
+
this.calcChangedAll();
|
|
79
|
+
this.validate();
|
|
80
|
+
this.onInit();
|
|
81
|
+
}
|
|
82
|
+
shouldComponentUpdate({ defaultValues, initialValues, validationSchema, }) {
|
|
83
|
+
const validationChanged = !compare(validationSchema, this.props.validationSchema);
|
|
84
|
+
const initialValsChanged = !compare(initialValues, this.props.initialValues);
|
|
85
|
+
const defaultValsChanged = !compare(defaultValues, this.props.defaultValues);
|
|
86
|
+
this.validationSchema = validationSchema;
|
|
87
|
+
if (initialValsChanged) {
|
|
88
|
+
this.setInitialVals(initialValues);
|
|
89
|
+
}
|
|
90
|
+
if (defaultValsChanged)
|
|
91
|
+
this.updateDefaultValues();
|
|
92
|
+
if (initialValsChanged || defaultValsChanged) {
|
|
93
|
+
this.calcChangedAll(initialValues);
|
|
94
|
+
}
|
|
95
|
+
if (initialValsChanged || validationChanged) {
|
|
96
|
+
this.validate();
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
updateDefaultValues(props = this.props) {
|
|
101
|
+
const { defaultValues, initialValues } = props;
|
|
102
|
+
return defaultValues || cloneValues(initialValues);
|
|
103
|
+
}
|
|
104
|
+
setInitialVals(initialValues = {}) {
|
|
105
|
+
this.store.values = cloneValues(initialValues);
|
|
106
|
+
this.validate();
|
|
107
|
+
this.onInit();
|
|
108
|
+
}
|
|
109
|
+
setValue = (field, val) => {
|
|
110
|
+
const { values } = this.store;
|
|
111
|
+
values[field] = val;
|
|
112
|
+
this.calcChanged(field, val);
|
|
113
|
+
this.validate();
|
|
114
|
+
};
|
|
115
|
+
setValues = vals => {
|
|
116
|
+
const { values } = this.store;
|
|
117
|
+
Object.assign(values, vals);
|
|
118
|
+
this.calcChangedAll();
|
|
119
|
+
this.validate();
|
|
120
|
+
return values;
|
|
121
|
+
};
|
|
122
|
+
setDisabled = (name, isDisabled) => {
|
|
123
|
+
const { disabled } = this.store;
|
|
124
|
+
if (typeof name === 'object') {
|
|
125
|
+
Object.assign(disabled, name);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (isDisabled) {
|
|
129
|
+
disabled[name] = true;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
delete disabled[name];
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
reset = () => {
|
|
136
|
+
const { initialValues } = this.props;
|
|
137
|
+
this.setValues(initialValues);
|
|
138
|
+
this.store.touched = getInitialTouched(initialValues);
|
|
139
|
+
};
|
|
140
|
+
field = (props) => jsx(Field, { ...this.getFieldProps(props) });
|
|
141
|
+
getFieldProps(props) {
|
|
142
|
+
const { markEdited } = this.props;
|
|
143
|
+
const { name } = props;
|
|
144
|
+
const { values, changed, touched, errors } = this.store.originalObject;
|
|
145
|
+
const fieldProps = {
|
|
146
|
+
...props,
|
|
147
|
+
value: values[name],
|
|
148
|
+
markEdited,
|
|
149
|
+
isChanged: changed[name],
|
|
150
|
+
isTouched: touched[name],
|
|
151
|
+
error: errors?.[name],
|
|
152
|
+
handleChange: this.onChange,
|
|
153
|
+
handleBlur: this.onBlur,
|
|
154
|
+
};
|
|
155
|
+
if (this.validationSchema?.[name].empty === false)
|
|
156
|
+
fieldProps.required = true;
|
|
157
|
+
return fieldProps;
|
|
158
|
+
}
|
|
159
|
+
getFormAPI() {
|
|
160
|
+
return {
|
|
161
|
+
...pick(this.store.originalObject, STORE_FIELDS_EXPOSED),
|
|
162
|
+
Field: this.field,
|
|
163
|
+
setValue: this.setValue,
|
|
164
|
+
setValues: this.setValues,
|
|
165
|
+
setDisabled: this.setDisabled,
|
|
166
|
+
reset: this.reset,
|
|
167
|
+
submit: this.onSubmit,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
getValidationState(store) {
|
|
171
|
+
const errors = this.getValidationErrors(store);
|
|
172
|
+
const isValid = Object.keys(errors).length === 0;
|
|
173
|
+
return { isValid, errors };
|
|
174
|
+
}
|
|
175
|
+
getValidationErrors(store = this.store.originalObject) {
|
|
176
|
+
const { values, disabled } = store;
|
|
177
|
+
if (!this.validationSchema)
|
|
178
|
+
return {};
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
const schema = Object.entries(this.validationSchema).reduce((acc, [field, { ...rule }]) => {
|
|
181
|
+
const { type, check } = rule;
|
|
182
|
+
if (disabled[field])
|
|
183
|
+
return acc;
|
|
184
|
+
if (type === 'custom') {
|
|
185
|
+
// NOTE: pass all `values` to custom checker function
|
|
186
|
+
// to allow create validator for dependent fields
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
rule.check = function checkWrap(...args) {
|
|
189
|
+
// @ts-ignore
|
|
190
|
+
return check.call(this, ...args, values);
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return { ...acc, [field]: rule };
|
|
194
|
+
}, {});
|
|
195
|
+
const res = Validator.validate(values, schema);
|
|
196
|
+
if (typeof res === 'object')
|
|
197
|
+
return patchWithCustomMessages(res, schema);
|
|
198
|
+
return {};
|
|
199
|
+
}
|
|
200
|
+
calcChanged(field, val) {
|
|
201
|
+
const { initialValues } = this.props;
|
|
202
|
+
const { changed, notEmpty } = this.store;
|
|
203
|
+
if (compare(val, initialValues[field])) {
|
|
204
|
+
delete changed[field];
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
changed[field] = true;
|
|
208
|
+
}
|
|
209
|
+
if (compare(val, this.defaultValues[field])) {
|
|
210
|
+
delete notEmpty[field];
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
notEmpty[field] = true;
|
|
214
|
+
}
|
|
215
|
+
Object.assign(this.store, {
|
|
216
|
+
isDirty: Object.keys(changed).length > 0,
|
|
217
|
+
isEmpty: Object.keys(notEmpty).length === 0,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
calcChangedAll(initialValues = this.props.initialValues) {
|
|
221
|
+
const { values } = this.store.originalObject;
|
|
222
|
+
const notEmpty = getNotEmpty(this.defaultValues, values);
|
|
223
|
+
const changed = Object.entries(values).reduce((acc, [field, val]) => compare(initialValues[field], val) ? acc : { ...acc, [field]: true }, {});
|
|
224
|
+
Object.assign(this.store, {
|
|
225
|
+
changed,
|
|
226
|
+
isDirty: Object.keys(changed).length > 0,
|
|
227
|
+
isEmpty: Object.keys(notEmpty).length === 0,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
validate() {
|
|
231
|
+
Object.assign(this.store, this.getValidationState());
|
|
232
|
+
}
|
|
233
|
+
onInit() {
|
|
234
|
+
const { onInit } = this.props;
|
|
235
|
+
if (onInit)
|
|
236
|
+
onInit(this.getFormAPI());
|
|
237
|
+
}
|
|
238
|
+
onSubmit = async (e) => {
|
|
239
|
+
const { onSubmit } = this.props;
|
|
240
|
+
const { values } = this.store.originalObject;
|
|
241
|
+
e?.preventDefault();
|
|
242
|
+
dropFocusFromSubmit();
|
|
243
|
+
if (!onSubmit)
|
|
244
|
+
return;
|
|
245
|
+
this.store.isLoading = true;
|
|
246
|
+
await onSubmit({ ...values });
|
|
247
|
+
this.store.isLoading = false;
|
|
248
|
+
};
|
|
249
|
+
onChange = (field, val) => {
|
|
250
|
+
const { onChange } = this.props;
|
|
251
|
+
const { values, touched } = this.store;
|
|
252
|
+
if (values[field] === val)
|
|
253
|
+
return;
|
|
254
|
+
const newValues = { ...values.originalObject, [field]: val };
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
if (onChange && onChange(newValues) === false)
|
|
257
|
+
return;
|
|
258
|
+
values[field] = val;
|
|
259
|
+
touched[field] = true;
|
|
260
|
+
this.handleChange(field, val);
|
|
261
|
+
};
|
|
262
|
+
onBlur = (name) => {
|
|
263
|
+
this.store.touched[name] = true;
|
|
264
|
+
};
|
|
265
|
+
handleChange(field, val) {
|
|
266
|
+
this.calcChanged(field, val);
|
|
267
|
+
this.validate();
|
|
268
|
+
}
|
|
269
|
+
render() {
|
|
270
|
+
const { className, children, ...rest } = this.props;
|
|
271
|
+
const { isLoading } = this.store;
|
|
272
|
+
const classes = cn(S.root, className, isLoading && S.isLoading);
|
|
273
|
+
const formProps = omit(rest, [
|
|
274
|
+
'defaultValues',
|
|
275
|
+
'defaultDisabled',
|
|
276
|
+
'initialValues',
|
|
277
|
+
'validationSchema',
|
|
278
|
+
'onInit',
|
|
279
|
+
'onChange',
|
|
280
|
+
'onSubmit',
|
|
281
|
+
]);
|
|
282
|
+
return (jsx("form", { className: classes, ...formProps, onSubmit: this.onSubmit, children: children(this.getFormAPI()) }));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export { Form };
|
|
@@ -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 = ".Form_root__EzxOr{margin:0 auto;max-width:100%;width:100%}.Form_isLoading__D1sPp{opacity:.8;pointer-events:none;transition:opacity .2s ease-out}.Form_field__S50yT{position:relative}.Form_field__S50yT+.Form_field__S50yT{margin-top:10px}.Form_field__S50yT+.Form_field__S50yT.Form_clearMargins__-KvTS{margin-top:0}.Form_field__S50yT.Form_changed__j-elu:after{background-color:$primaryColor;border-radius:50%;box-shadow:0 0 0 1px hsla(0,0%,100%,.8);content:\"\";height:6px;pointer-events:none;position:absolute;right:-2px;top:-2px;width:6px;z-index:1}.Form_hidden__MId3H{display:none}.Form_error__J7BaB{color:#e91b20;font-size:80%;margin:5px}";
|
|
4
|
+
var S = {"root":"Form_root__EzxOr","isLoading":"Form_isLoading__D1sPp","field":"Form_field__S50yT","clearMargins":"Form_clearMargins__-KvTS","changed":"Form_changed__j-elu","hidden":"Form_hidden__MId3H","error":"Form_error__J7BaB"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import{jsx}from
|
|
2
|
-
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { Button } from '../../Button/Button.js';
|
|
4
|
+
import S from './SubmitButtons.styl.js';
|
|
5
|
+
|
|
6
|
+
const SubmitButtons = ({ buttons, className, ...props }) => (jsx("div", { className: cn(S.root, className), ...props, children: buttons.map(buttonProps => (jsx(Button, { className: cn(S.item, buttonProps.className), ...buttonProps }))) }));
|
|
7
|
+
|
|
8
|
+
export { SubmitButtons };
|
|
@@ -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 = ".SubmitButtons_root__sXP-n{display:flex;justify-content:flex-end;margin-top:15px}.SubmitButtons_item__f0l6w+.SubmitButtons_item__f0l6w{margin-left:10px}";
|
|
4
|
+
var S = {"root":"SubmitButtons_root__sXP-n","item":"SubmitButtons_item__f0l6w"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -1,18 +1,36 @@
|
|
|
1
|
-
import FastestValidator from
|
|
1
|
+
import FastestValidator from 'fastest-validator';
|
|
2
|
+
|
|
3
|
+
const Validator = new FastestValidator({
|
|
4
|
+
messages: {
|
|
5
|
+
momentDate: 'Invalid date',
|
|
6
|
+
momentRange: 'Invalid dates range',
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
Validator.add('momentDate', function momentDate({ messages }) {
|
|
10
|
+
return {
|
|
11
|
+
source: `
|
|
2
12
|
if (!value.isValid())
|
|
3
13
|
// @ts-ignore
|
|
4
|
-
${this.makeError({type:
|
|
14
|
+
${this.makeError({ type: 'momentDate', actual: 'value', messages })}
|
|
5
15
|
|
|
6
16
|
return value;
|
|
7
|
-
|
|
17
|
+
`,
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
Validator.add('momentRange', function momentRange({ messages }) {
|
|
21
|
+
return {
|
|
22
|
+
source: `
|
|
8
23
|
const isValid =
|
|
9
24
|
value.startDate && value.startDate.isValid() &&
|
|
10
25
|
value.endDate && value.endDate.isValid();
|
|
11
26
|
|
|
12
27
|
if (!isValid)
|
|
13
28
|
// @ts-ignore
|
|
14
|
-
${this.makeError({type:
|
|
29
|
+
${this.makeError({ type: 'momentRange', actual: 'value', messages })}
|
|
15
30
|
|
|
16
31
|
return value;
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
`,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export { Validator };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import{jsx}from
|
|
2
|
-
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import S from './Dots.styl.js';
|
|
4
|
+
|
|
5
|
+
function Dots({ index, count }) {
|
|
6
|
+
return (jsx("div", { className: S.root, children: jsx("div", { className: S.inner, children: Array.from({ length: count }).map((_, i) => (jsx("div", { className: cn(S.item, i === index && S.active) }, i))) }) }));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { Dots as default };
|
|
@@ -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 = ".Dots_root__dTavT{bottom:1%;display:flex;justify-content:center;-webkit-mask-image:linear-gradient(90deg,transparent,#000 3%,#000 97%,transparent);mask-image:linear-gradient(90deg,transparent,#000 3%,#000 97%,transparent);overflow:hidden;padding:0 10%;pointer-events:none;position:absolute;width:100%}.Dots_inner__0Nqa9{align-items:center;display:flex}.Dots_item__gEVuS{background-color:var(--accent-color-alpha-200);border-radius:50%;box-shadow:0 0 0 1px var(--decent-color-alpha-500);flex-shrink:0;height:8px;margin:3px;transition:.1s ease-out;transition-property:background-color,transform;width:8px}.Dots_item__gEVuS.Dots_active__gAUAj{background-color:var(--accent-color-alpha-500);transform:scale(1.2)}";
|
|
4
|
+
var S = {"root":"Dots_root__dTavT","inner":"Dots_inner__0Nqa9","item":"Dots_item__gEVuS","active":"Dots_active__gAUAj"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -1,2 +1,180 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Component, createRef } from 'react';
|
|
3
|
+
import { createStore } from 'justorm/react';
|
|
4
|
+
import Time from 'timen';
|
|
5
|
+
import compare from 'compareq';
|
|
6
|
+
import cn from 'classnames';
|
|
7
|
+
import omit from 'lodash.omit';
|
|
8
|
+
import { Button } from '../Button/Button.js';
|
|
9
|
+
import { Icon } from '../Icon/Icon.js';
|
|
10
|
+
import { Spinner } from '../Spinner/Spinner.js';
|
|
11
|
+
import throttle from '../../tools/throttle.js';
|
|
12
|
+
import { circularSlice } from '../../tools/array.js';
|
|
13
|
+
import S from './Gallery.styl.js';
|
|
14
|
+
import { Lazy } from '../Lazy/Lazy.js';
|
|
15
|
+
|
|
16
|
+
const THRESHOLD = 50;
|
|
17
|
+
const DURATION = 200;
|
|
18
|
+
const DIR_NAME = {
|
|
19
|
+
'1': 'left',
|
|
20
|
+
'-1': 'right',
|
|
21
|
+
};
|
|
22
|
+
function getInitialState(items, startIndex) {
|
|
23
|
+
return circularSlice(items, startIndex, 3);
|
|
24
|
+
}
|
|
25
|
+
function Arr({ className, size, icon, ...rest }) {
|
|
26
|
+
return (jsx(Button, { className: cn(S.arr, className), size: size, variant: "clear", ...rest, children: jsx(Icon, { type: icon, size: size }) }));
|
|
27
|
+
}
|
|
28
|
+
function Item({ src, size, isLoaded, isError, onLoad, onError }) {
|
|
29
|
+
const style = {};
|
|
30
|
+
if (isLoaded)
|
|
31
|
+
style.backgroundImage = `url(${src})`;
|
|
32
|
+
return (jsx("div", { className: S.item, style: style, children: !isLoaded &&
|
|
33
|
+
(isError ? (jsx(Icon, { type: "brokenImage", className: S.brokenImage })) : (jsxs(Fragment, { children: [jsx("img", { src: src, onLoad: onLoad, onError: onError }), jsx(Spinner, { size: size })] }))) }));
|
|
34
|
+
}
|
|
35
|
+
class Gallery extends Component {
|
|
36
|
+
store;
|
|
37
|
+
items;
|
|
38
|
+
index = 0;
|
|
39
|
+
timers = Time.create();
|
|
40
|
+
startX = null;
|
|
41
|
+
innerRef = createRef();
|
|
42
|
+
static defaultProps = {
|
|
43
|
+
size: 'm',
|
|
44
|
+
animation: true,
|
|
45
|
+
startIndex: 0,
|
|
46
|
+
};
|
|
47
|
+
constructor(props) {
|
|
48
|
+
super(props);
|
|
49
|
+
const { startIndex, items } = props;
|
|
50
|
+
this.recenter();
|
|
51
|
+
this.index = startIndex;
|
|
52
|
+
this.store = createStore(this, {
|
|
53
|
+
items: this.getStateItems(),
|
|
54
|
+
movingDirection: 0,
|
|
55
|
+
loading: {},
|
|
56
|
+
errors: {},
|
|
57
|
+
isDragging: false,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
componentDidMount() {
|
|
61
|
+
this.init();
|
|
62
|
+
}
|
|
63
|
+
componentWillUnmount() {
|
|
64
|
+
this.timers.clear();
|
|
65
|
+
}
|
|
66
|
+
componentDidUpdate(prevProps) {
|
|
67
|
+
const { items, startIndex } = this.props;
|
|
68
|
+
if (prevProps.startIndex !== startIndex ||
|
|
69
|
+
!compare(prevProps.items, items)) {
|
|
70
|
+
this.index = startIndex;
|
|
71
|
+
this.recenter();
|
|
72
|
+
this.store.items = this.getStateItems();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
getStateItems() {
|
|
76
|
+
return this.isSingle()
|
|
77
|
+
? [this.props.items[0]]
|
|
78
|
+
: getInitialState(this.items, this.index);
|
|
79
|
+
}
|
|
80
|
+
recenter() {
|
|
81
|
+
const [...items] = this.props.items;
|
|
82
|
+
this.items = [items.pop(), ...items];
|
|
83
|
+
}
|
|
84
|
+
init() {
|
|
85
|
+
const { items } = this.store;
|
|
86
|
+
if (items.length > 1)
|
|
87
|
+
this.subscribe();
|
|
88
|
+
}
|
|
89
|
+
subscribe() {
|
|
90
|
+
document.addEventListener('keydown', this.onKeyDown);
|
|
91
|
+
}
|
|
92
|
+
isSingle = () => this.props.items.length < 2;
|
|
93
|
+
onKeyDown = e => {
|
|
94
|
+
if (this.isSingle())
|
|
95
|
+
return;
|
|
96
|
+
if (e.key === 'ArrowRight') {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
return this.move(-1);
|
|
99
|
+
}
|
|
100
|
+
if (e.key === 'ArrowLeft') {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
return this.move(1);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
onPointerDown = e => {
|
|
106
|
+
this.startX = e.pageX;
|
|
107
|
+
};
|
|
108
|
+
onPointerMove = e => {
|
|
109
|
+
if (this.startX === null)
|
|
110
|
+
return;
|
|
111
|
+
const delta = this.getDelta(e);
|
|
112
|
+
if (Math.abs(delta) < THRESHOLD)
|
|
113
|
+
return;
|
|
114
|
+
this.store.isDragging = true;
|
|
115
|
+
this.setTransformDelta(delta);
|
|
116
|
+
};
|
|
117
|
+
onPointerUp = e => {
|
|
118
|
+
if (!this.startX)
|
|
119
|
+
return;
|
|
120
|
+
const delta = this.getDelta(e);
|
|
121
|
+
this.startX = null;
|
|
122
|
+
if (!this.store.isDragging || !delta)
|
|
123
|
+
return;
|
|
124
|
+
this.store.isDragging = false;
|
|
125
|
+
const dir = delta / Math.abs(delta);
|
|
126
|
+
this.move(dir);
|
|
127
|
+
};
|
|
128
|
+
getDelta = e => e.pageX - this.startX;
|
|
129
|
+
setTransformDelta = (delta) => {
|
|
130
|
+
this.innerRef.current.style.transform = `translateX(calc(-100% / 3 + ${delta}px))`;
|
|
131
|
+
};
|
|
132
|
+
removeTransformDelta = () => {
|
|
133
|
+
this.innerRef.current.style.transform = '';
|
|
134
|
+
};
|
|
135
|
+
move = throttle(function (direction) {
|
|
136
|
+
const { animation } = this.props;
|
|
137
|
+
this.store.isDragging = false;
|
|
138
|
+
this.startX = null;
|
|
139
|
+
if (!animation)
|
|
140
|
+
return this.switch(direction);
|
|
141
|
+
this.store.movingDirection = direction;
|
|
142
|
+
this.timers.clear();
|
|
143
|
+
this.timers.after(DURATION, () => this.switch(direction));
|
|
144
|
+
}, DURATION);
|
|
145
|
+
switch(direction) {
|
|
146
|
+
this.index += direction * -1;
|
|
147
|
+
this.store.items = circularSlice(this.items, this.index, 3);
|
|
148
|
+
this.store.movingDirection = 0;
|
|
149
|
+
this.removeTransformDelta();
|
|
150
|
+
const { onChange } = this.props;
|
|
151
|
+
const { items, loading } = this.store;
|
|
152
|
+
onChange?.(this.index, this.items[this.index]);
|
|
153
|
+
items.forEach(src => {
|
|
154
|
+
if (typeof loading[src] !== 'boolean')
|
|
155
|
+
loading[src] = false;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
render() {
|
|
159
|
+
const { className, size, showArrows, showDots, initialBounce, cover, ...rest } = this.props;
|
|
160
|
+
const { items, movingDirection, loading, errors, isDragging } = this.store;
|
|
161
|
+
const dirName = DIR_NAME[movingDirection];
|
|
162
|
+
const isSingle = this.isSingle();
|
|
163
|
+
const props = omit(rest, ['items', 'onChange', 'animation', 'startIndex']);
|
|
164
|
+
const classes = cn(S.root, isSingle && S.single, cover && S.cover, className);
|
|
165
|
+
const innerClasses = cn(S.inner, initialBounce && S.initialBounce, S[dirName]);
|
|
166
|
+
if (!isSingle) {
|
|
167
|
+
props.onPointerDown = this.onPointerDown;
|
|
168
|
+
props.onPointerMove = this.onPointerMove;
|
|
169
|
+
if (isDragging) {
|
|
170
|
+
props.onPointerUp = this.onPointerUp;
|
|
171
|
+
props.onPointerLeave = this.onPointerUp;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return (jsxs("div", { className: classes, ...props, children: [jsx("div", { className: innerClasses, ref: this.innerRef, children: items.map((src, i) => (jsx(Item, { src: src, size: size, isLoaded: loading[src], isError: errors[src], onLoad: () => (loading[src] = true), onError: () => (errors[src] = true) }, `${i}_${src}`))) }), !isSingle && showArrows && !isDragging && (jsxs(Fragment, { children: [jsx(Arr, { className: S.left, size: size, icon: "chevronLeft", onClick: () => this.move(1) }), jsx(Arr, { className: S.right, size: size, icon: "chevronRight", onClick: () => this.move(-1) })] })), showDots && (jsx(Lazy, { hideSpinner: true,
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
loader: () => import('./Dots/Dots.js'), index: this.index % items.length, count: items.length }))] }));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export { Gallery };
|
|
@@ -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 = ".Gallery_item__P4qTJ,.Gallery_root__-Crit{height:100%;width:100%}.Gallery_root__-Crit{overflow:hidden;position:relative}.Gallery_inner__4FAPt{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:flex;height:100%;position:absolute;touch-action:none;transform:translate3d(-33.33333%,0,0);width:calc(300% + 1px)}.Gallery_single__Wfd9h .Gallery_inner__4FAPt{transform:none;width:100%}.Gallery_single__Wfd9h .Gallery_item__P4qTJ{width:100%}.Gallery_inner__4FAPt.Gallery_left__zrrmv,.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transition:transform 0s ease-out;transition-duration:.2s}.Gallery_inner__4FAPt.Gallery_left__zrrmv{transform:translateZ(0)!important}.Gallery_inner__4FAPt.Gallery_right__dpZ-m{transform:translate3d(-66.66667%,0,0)!important}.Gallery_inner__4FAPt.Gallery_initialBounce__nZnKd{animation:Gallery_bounce__buqva 1s ease-out}.Gallery_item__P4qTJ{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:contain;display:flex;justify-content:center;width:33.33333%}.Gallery_cover__ZGx5X .Gallery_item__P4qTJ{background-size:cover}.Gallery_item__P4qTJ>img{opacity:0;pointer-events:none;position:absolute}.Gallery_brokenImage__Bj3O-{height:50%;opacity:.2;width:50%}.Gallery_arr__knicI{background:transparent!important;height:100%;min-height:100%;opacity:0;padding:10%;position:absolute;top:0;transition:opacity .1s ease-out}.Gallery_arr__knicI.Gallery_left__zrrmv{justify-content:flex-start;left:0}.Gallery_arr__knicI.Gallery_right__dpZ-m{justify-content:flex-end;right:0;width:77%}.Gallery_arr__knicI:hover{opacity:1}@keyframes Gallery_bounce__buqva{0%{left:0}50%{left:-20%}80%{left:10%}to{left:0}}";
|
|
4
|
+
var S = {"root":"Gallery_root__-Crit","item":"Gallery_item__P4qTJ","inner":"Gallery_inner__4FAPt","single":"Gallery_single__Wfd9h","left":"Gallery_left__zrrmv","right":"Gallery_right__dpZ-m","initialBounce":"Gallery_initialBounce__nZnKd","bounce":"Gallery_bounce__buqva","cover":"Gallery_cover__ZGx5X","brokenImage":"Gallery_brokenImage__Bj3O-","arr":"Gallery_arr__knicI"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
import{jsxs,jsx}from
|
|
2
|
-
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { memo, useEffect } from 'react';
|
|
3
|
+
import { scrollIntoView } from '../../tools/scroll.js';
|
|
4
|
+
import S from './Heading.styl.js';
|
|
5
|
+
|
|
6
|
+
let subscribersCount = 0;
|
|
7
|
+
function onClick(e) {
|
|
8
|
+
const href = e.target?.getAttribute('href');
|
|
9
|
+
if (!href || !/#/.test(href))
|
|
10
|
+
return;
|
|
11
|
+
const [path, hash] = href.split('#');
|
|
12
|
+
const heading = document.getElementById(hash);
|
|
13
|
+
if (heading) {
|
|
14
|
+
scrollIntoView(heading);
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function subscribe() {
|
|
19
|
+
if (subscribersCount === 0) {
|
|
20
|
+
window.addEventListener('click', onClick, true);
|
|
21
|
+
}
|
|
22
|
+
subscribersCount++;
|
|
23
|
+
}
|
|
24
|
+
function unsubscribe() {
|
|
25
|
+
if (--subscribersCount === 0) {
|
|
26
|
+
window.removeEventListener('click', onClick, true);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const Heading = memo(function Heading({ id, text }) {
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
subscribe();
|
|
32
|
+
return unsubscribe;
|
|
33
|
+
});
|
|
34
|
+
return (jsxs("h2", { className: S.root, id: id, children: [jsx("a", { href: `${location.pathname}#${id}`, className: S.link, children: "#" }), text] }));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { Heading };
|