@blaze-cms/react-page-builder 0.123.0-alpha.18 → 0.123.0-alpha.19
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/CHANGELOG.md +11 -0
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +15 -50
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +10 -40
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/package.json +2 -2
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +113 -148
- package/tests/unit/src/components/Menu/Menu.test.js +2 -0
- package/tests/unit/src/components/Menu/__snapshots__/Menu.test.js.snap +3 -0
- package/tests/unit/src/components/SearchFilter/SearchFilter/SearchFilter.test.js +64 -86
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +133 -61
- package/coverage/clover.xml +0 -3149
- package/coverage/coverage-final.json +0 -257
- package/coverage/lcov-report/HOC/index.html +0 -141
- package/coverage/lcov-report/HOC/index.js.html +0 -89
- package/coverage/lcov-report/HOC/withInfiniteScroll.js.html +0 -311
- package/coverage/lcov-report/HOC/withTitle.js.html +0 -185
- package/coverage/lcov-report/PBContext/index.html +0 -111
- package/coverage/lcov-report/PBContext/index.js.html +0 -95
- package/coverage/lcov-report/application/query/index.html +0 -111
- package/coverage/lcov-report/application/query/index.js.html +0 -482
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/components/Banner/Banner.js.html +0 -260
- package/coverage/lcov-report/components/Banner/BannerRender.js.html +0 -464
- package/coverage/lcov-report/components/Banner/helpers.js.html +0 -515
- package/coverage/lcov-report/components/Banner/index.html +0 -156
- package/coverage/lcov-report/components/Banner/index.js.html +0 -89
- package/coverage/lcov-report/components/BlazeLink.js.html +0 -197
- package/coverage/lcov-report/components/Button.js.html +0 -353
- package/coverage/lcov-report/components/Card/Card.js.html +0 -548
- package/coverage/lcov-report/components/Card/CardContainer.js.html +0 -407
- package/coverage/lcov-report/components/Card/CardFactory.js.html +0 -218
- package/coverage/lcov-report/components/Card/CardRender.js.html +0 -806
- package/coverage/lcov-report/components/Card/constants.js.html +0 -89
- package/coverage/lcov-report/components/Card/helpers/get-dynamic-grid-classes.js.html +0 -137
- package/coverage/lcov-report/components/Card/helpers/get-published-listing-url.js.html +0 -92
- package/coverage/lcov-report/components/Card/helpers/index.html +0 -156
- package/coverage/lcov-report/components/Card/helpers/index.js.html +0 -89
- package/coverage/lcov-report/components/Card/helpers/use-dynamic-size-key.js.html +0 -98
- package/coverage/lcov-report/components/Card/index.html +0 -186
- package/coverage/lcov-report/components/Card/index.js.html +0 -89
- package/coverage/lcov-report/components/Carousel/Carousel.js.html +0 -185
- package/coverage/lcov-report/components/Carousel/CarouselImage/CarouselImage.js.html +0 -224
- package/coverage/lcov-report/components/Carousel/CarouselImage/index.html +0 -126
- package/coverage/lcov-report/components/Carousel/CarouselImage/index.js.html +0 -89
- package/coverage/lcov-report/components/Carousel/CarouselRender/CarouselRender.js.html +0 -335
- package/coverage/lcov-report/components/Carousel/CarouselRender/index.html +0 -126
- package/coverage/lcov-report/components/Carousel/CarouselRender/index.js.html +0 -89
- package/coverage/lcov-report/components/Carousel/index.html +0 -126
- package/coverage/lcov-report/components/Carousel/index.js.html +0 -89
- package/coverage/lcov-report/components/ClickWrapper.js.html +0 -191
- package/coverage/lcov-report/components/Code.js.html +0 -155
- package/coverage/lcov-report/components/DataSummary/DataSummaryFactory.js.html +0 -293
- package/coverage/lcov-report/components/DataSummary/DataSummaryRender.js.html +0 -272
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummary.js.html +0 -149
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js.html +0 -134
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/index.html +0 -141
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/index.js.html +0 -89
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummary.js.html +0 -140
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.html +0 -161
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/index.html +0 -141
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/index.js.html +0 -89
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummary.js.html +0 -140
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js.html +0 -188
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/LargeSummary/index.html +0 -141
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/LargeSummary/index.js.html +0 -89
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ListSummary/ListSummary.js.html +0 -140
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js.html +0 -185
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ListSummary/index.html +0 -141
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/ListSummary/index.js.html +0 -89
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/TextSummary/TextSummary.js.html +0 -140
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js.html +0 -182
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/TextSummary/index.html +0 -141
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/TextSummary/index.js.html +0 -89
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/index.html +0 -111
- package/coverage/lcov-report/components/DataSummary/DataSummaryTypes/index.js.html +0 -137
- package/coverage/lcov-report/components/DataSummary/helpers/build-props-to-display-with-content.js.html +0 -188
- package/coverage/lcov-report/components/DataSummary/helpers/get-data-summary-query.js.html +0 -131
- package/coverage/lcov-report/components/DataSummary/helpers/get-link-to-published-content.js.html +0 -110
- package/coverage/lcov-report/components/DataSummary/helpers/get-prop-value.js.html +0 -152
- package/coverage/lcov-report/components/DataSummary/helpers/get-value-from-array.js.html +0 -131
- package/coverage/lcov-report/components/DataSummary/helpers/index.html +0 -201
- package/coverage/lcov-report/components/DataSummary/helpers/index.js.html +0 -113
- package/coverage/lcov-report/components/DataSummary/helpers/strip-summary-props-content.js.html +0 -137
- package/coverage/lcov-report/components/DataSummary/index.html +0 -141
- package/coverage/lcov-report/components/DataSummary/index.js.html +0 -89
- package/coverage/lcov-report/components/Image/GlobalLightbox/GlobalLightbox.js.html +0 -674
- package/coverage/lcov-report/components/Image/GlobalLightbox/NavButton.js.html +0 -158
- package/coverage/lcov-report/components/Image/GlobalLightbox/index.html +0 -141
- package/coverage/lcov-report/components/Image/GlobalLightbox/index.js.html +0 -95
- package/coverage/lcov-report/components/Image/Image.js.html +0 -542
- package/coverage/lcov-report/components/Image/ImageDetails.js.html +0 -149
- package/coverage/lcov-report/components/Image/ImageFactory.js.html +0 -260
- package/coverage/lcov-report/components/Image/ImageRender.js.html +0 -299
- package/coverage/lcov-report/components/Image/Lightbox/Lightbox.js.html +0 -311
- package/coverage/lcov-report/components/Image/Lightbox/index.html +0 -126
- package/coverage/lcov-report/components/Image/Lightbox/index.js.html +0 -89
- package/coverage/lcov-report/components/Image/index.html +0 -171
- package/coverage/lcov-report/components/Image/index.js.html +0 -89
- package/coverage/lcov-report/components/Layout/Layout.js.html +0 -227
- package/coverage/lcov-report/components/Layout/constants.js.html +0 -98
- package/coverage/lcov-report/components/Layout/helpers/check-if-row-has-columns.js.html +0 -143
- package/coverage/lcov-report/components/Layout/helpers/get-styles-to-update.js.html +0 -107
- package/coverage/lcov-report/components/Layout/helpers/index.html +0 -141
- package/coverage/lcov-report/components/Layout/helpers/index.js.html +0 -92
- package/coverage/lcov-report/components/Layout/index.html +0 -141
- package/coverage/lcov-report/components/Layout/index.js.html +0 -89
- package/coverage/lcov-report/components/LazyImage/LazyImage.js.html +0 -161
- package/coverage/lcov-report/components/LazyImage/index.html +0 -126
- package/coverage/lcov-report/components/LazyImage/index.js.html +0 -89
- package/coverage/lcov-report/components/List/ListBuilder.js.html +0 -551
- package/coverage/lcov-report/components/List/ListFactory.js.html +0 -569
- package/coverage/lcov-report/components/List/ListRender.js.html +0 -356
- package/coverage/lcov-report/components/List/components/Cards/CardsRender.js.html +0 -305
- package/coverage/lcov-report/components/List/components/Cards/CardsRenderItem.js.html +0 -389
- package/coverage/lcov-report/components/List/components/Cards/CardsRenderWrapper.js.html +0 -173
- package/coverage/lcov-report/components/List/components/Cards/index.html +0 -156
- package/coverage/lcov-report/components/List/components/Cards/index.js.html +0 -89
- package/coverage/lcov-report/components/List/components/Full/FullRender.js.html +0 -242
- package/coverage/lcov-report/components/List/components/Full/FullRenderItem.js.html +0 -344
- package/coverage/lcov-report/components/List/components/Full/index.html +0 -141
- package/coverage/lcov-report/components/List/components/Full/index.js.html +0 -89
- package/coverage/lcov-report/components/List/components/Pagination/Classic.js.html +0 -206
- package/coverage/lcov-report/components/List/components/Pagination/ListPagination.js.html +0 -266
- package/coverage/lcov-report/components/List/components/Pagination/LoadMore.js.html +0 -182
- package/coverage/lcov-report/components/List/components/Pagination/index.html +0 -156
- package/coverage/lcov-report/components/List/components/Pagination/index.js.html +0 -89
- package/coverage/lcov-report/components/List/components/helpers/check-if-should-render-banner.js.html +0 -116
- package/coverage/lcov-report/components/List/components/helpers/check-if-should-render-gtm.js.html +0 -125
- package/coverage/lcov-report/components/List/components/helpers/index.html +0 -141
- package/coverage/lcov-report/components/List/components/helpers/index.js.html +0 -86
- package/coverage/lcov-report/components/List/components/index.html +0 -111
- package/coverage/lcov-report/components/List/components/index.js.html +0 -92
- package/coverage/lcov-report/components/List/constants.js.html +0 -95
- package/coverage/lcov-report/components/List/helpers/build-pagination-items.js.html +0 -182
- package/coverage/lcov-report/components/List/helpers/build-pagination-url.js.html +0 -113
- package/coverage/lcov-report/components/List/helpers/index.html +0 -141
- package/coverage/lcov-report/components/List/helpers/index.js.html +0 -83
- package/coverage/lcov-report/components/List/index.html +0 -171
- package/coverage/lcov-report/components/List/index.js.html +0 -89
- package/coverage/lcov-report/components/Login/Login.js.html +0 -359
- package/coverage/lcov-report/components/Login/index.html +0 -141
- package/coverage/lcov-report/components/Login/index.js.html +0 -89
- package/coverage/lcov-report/components/Login/loginMutation.js.html +0 -113
- package/coverage/lcov-report/components/Modal/Modal.js.html +0 -167
- package/coverage/lcov-report/components/Modal/index.html +0 -126
- package/coverage/lcov-report/components/Modal/index.js.html +0 -89
- package/coverage/lcov-report/components/SearchFilter/SearchFilter/FiltersList.js.html +0 -371
- package/coverage/lcov-report/components/SearchFilter/SearchFilter/MobileBottom.js.html +0 -218
- package/coverage/lcov-report/components/SearchFilter/SearchFilter/MobileTop.js.html +0 -146
- package/coverage/lcov-report/components/SearchFilter/SearchFilter/SearchFilter.js.html +0 -455
- package/coverage/lcov-report/components/SearchFilter/SearchFilter/index.html +0 -171
- package/coverage/lcov-report/components/SearchFilter/SearchFilter/index.js.html +0 -89
- package/coverage/lcov-report/components/SearchFilter/SearchFilterContainer.js.html +0 -398
- package/coverage/lcov-report/components/SearchFilter/components/Checkbox.js.html +0 -368
- package/coverage/lcov-report/components/SearchFilter/components/Range.js.html +0 -401
- package/coverage/lcov-report/components/SearchFilter/components/Select.js.html +0 -245
- package/coverage/lcov-report/components/SearchFilter/components/TextSearch.js.html +0 -206
- package/coverage/lcov-report/components/SearchFilter/components/index.html +0 -171
- package/coverage/lcov-report/components/SearchFilter/components/index.js.html +0 -98
- package/coverage/lcov-report/components/SearchFilter/constants.js.html +0 -239
- package/coverage/lcov-report/components/SearchFilter/helpers/build-new-query.js.html +0 -98
- package/coverage/lcov-report/components/SearchFilter/helpers/build-query-params.js.html +0 -155
- package/coverage/lcov-report/components/SearchFilter/helpers/build-raw-query-stringified.js.html +0 -221
- package/coverage/lcov-report/components/SearchFilter/helpers/calculate-min-max.js.html +0 -119
- package/coverage/lcov-report/components/SearchFilter/helpers/calculate-step.js.html +0 -92
- package/coverage/lcov-report/components/SearchFilter/helpers/check-if-range-updated.js.html +0 -104
- package/coverage/lcov-report/components/SearchFilter/helpers/decode-encode.js.html +0 -95
- package/coverage/lcov-report/components/SearchFilter/helpers/get-display-value.js.html +0 -98
- package/coverage/lcov-report/components/SearchFilter/helpers/get-intersected-prop.js.html +0 -98
- package/coverage/lcov-report/components/SearchFilter/helpers/get-range-value.js.html +0 -155
- package/coverage/lcov-report/components/SearchFilter/helpers/get-search-values.js.html +0 -308
- package/coverage/lcov-report/components/SearchFilter/helpers/get-select-options.js.html +0 -134
- package/coverage/lcov-report/components/SearchFilter/helpers/get-updated-ranges.js.html +0 -101
- package/coverage/lcov-report/components/SearchFilter/helpers/index.html +0 -381
- package/coverage/lcov-report/components/SearchFilter/helpers/index.js.html +0 -200
- package/coverage/lcov-report/components/SearchFilter/helpers/is-device-desktop.js.html +0 -95
- package/coverage/lcov-report/components/SearchFilter/helpers/remove-props-from-updated-ranges.js.html +0 -116
- package/coverage/lcov-report/components/SearchFilter/helpers/remove-updated-ranges.js.html +0 -98
- package/coverage/lcov-report/components/SearchFilter/helpers/set-updated-ranges-in-storage.js.html +0 -113
- package/coverage/lcov-report/components/SearchFilter/helpers/set-updated-ranges.js.html +0 -116
- package/coverage/lcov-report/components/SearchFilter/index.html +0 -141
- package/coverage/lcov-report/components/SearchFilter/index.js.html +0 -89
- package/coverage/lcov-report/components/SearchFilterSort/SearchFilterSort.js.html +0 -233
- package/coverage/lcov-report/components/SearchFilterSort/constants.js.html +0 -98
- package/coverage/lcov-report/components/SearchFilterSort/helpers/handle-sort-update.js.html +0 -158
- package/coverage/lcov-report/components/SearchFilterSort/helpers/index.html +0 -141
- package/coverage/lcov-report/components/SearchFilterSort/helpers/index.js.html +0 -86
- package/coverage/lcov-report/components/SearchFilterSort/helpers/update-sort.js.html +0 -110
- package/coverage/lcov-report/components/SearchFilterSort/index.html +0 -141
- package/coverage/lcov-report/components/SearchFilterSort/index.js.html +0 -89
- package/coverage/lcov-report/components/SocialFollow/SFItem.js.html +0 -152
- package/coverage/lcov-report/components/SocialFollow/SocialFollow.js.html +0 -179
- package/coverage/lcov-report/components/SocialFollow/SocialFollowRender.js.html +0 -182
- package/coverage/lcov-report/components/SocialFollow/index.html +0 -171
- package/coverage/lcov-report/components/SocialFollow/index.js.html +0 -89
- package/coverage/lcov-report/components/SocialFollow/sf.config.js.html +0 -206
- package/coverage/lcov-report/components/TextBlock/TextBlockRender.js.html +0 -113
- package/coverage/lcov-report/components/TextBlock/index.html +0 -126
- package/coverage/lcov-report/components/TextBlock/index.js.html +0 -188
- package/coverage/lcov-report/components/Video/Video.js.html +0 -266
- package/coverage/lcov-report/components/Video/VideoRender.js.html +0 -137
- package/coverage/lcov-report/components/Video/index.html +0 -141
- package/coverage/lcov-report/components/Video/index.js.html +0 -89
- package/coverage/lcov-report/components/Video/providers/Default.js.html +0 -149
- package/coverage/lcov-report/components/Video/providers/JWPlayer/JWPlayerController.js.html +0 -212
- package/coverage/lcov-report/components/Video/providers/JWPlayer/JWPlayerProvider.js.html +0 -311
- package/coverage/lcov-report/components/Video/providers/JWPlayer/index.html +0 -126
- package/coverage/lcov-report/components/Video/providers/YouTube/YouTubeProvider.js.html +0 -179
- package/coverage/lcov-report/components/Video/providers/YouTube/helpers/index.html +0 -111
- package/coverage/lcov-report/components/Video/providers/YouTube/helpers/index.js.html +0 -116
- package/coverage/lcov-report/components/Video/providers/YouTube/index.html +0 -111
- package/coverage/lcov-report/components/Video/providers/get-provider.js.html +0 -131
- package/coverage/lcov-report/components/Video/providers/index.html +0 -141
- package/coverage/lcov-report/components/Video/providers/index.js.html +0 -89
- package/coverage/lcov-report/components/Wrapper.js.html +0 -161
- package/coverage/lcov-report/components/index.html +0 -186
- package/coverage/lcov-report/components/index.js.html +0 -167
- package/coverage/lcov-report/constants/componentsDefaultValues.js.html +0 -143
- package/coverage/lcov-report/constants/index.html +0 -126
- package/coverage/lcov-report/constants/index.js.html +0 -671
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helpers/build-image-properties.js.html +0 -137
- package/coverage/lcov-report/helpers/build-inherited-filters.js.html +0 -350
- package/coverage/lcov-report/helpers/build-link-extra-props.js.html +0 -119
- package/coverage/lcov-report/helpers/build-props-query.js.html +0 -263
- package/coverage/lcov-report/helpers/build-query-fields.js.html +0 -119
- package/coverage/lcov-report/helpers/build-raw-query-base.js.html +0 -353
- package/coverage/lcov-report/helpers/build-raw-query.js.html +0 -323
- package/coverage/lcov-report/helpers/build-search-values-checkbox-select.js.html +0 -278
- package/coverage/lcov-report/helpers/build-search-values-text.js.html +0 -125
- package/coverage/lcov-report/helpers/build-set-filters.js.html +0 -197
- package/coverage/lcov-report/helpers/check-for-error.js.html +0 -110
- package/coverage/lcov-report/helpers/check-props-to-use.js.html +0 -110
- package/coverage/lcov-report/helpers/check-sort-by.js.html +0 -92
- package/coverage/lcov-report/helpers/entities/constants.js.html +0 -116
- package/coverage/lcov-report/helpers/entities/index.html +0 -111
- package/coverage/lcov-report/helpers/get-banner-data.js.html +0 -92
- package/coverage/lcov-report/helpers/get-click-wrapper-options.js.html +0 -170
- package/coverage/lcov-report/helpers/get-current-offset.js.html +0 -101
- package/coverage/lcov-report/helpers/get-dictionary-match.js.html +0 -116
- package/coverage/lcov-report/helpers/get-display-count-data.js.html +0 -119
- package/coverage/lcov-report/helpers/get-elasticsearch-operator.js.html +0 -95
- package/coverage/lcov-report/helpers/get-entities-with-banner.js.html +0 -107
- package/coverage/lcov-report/helpers/get-entity-data.js.html +0 -113
- package/coverage/lcov-report/helpers/get-entity-render-props.js.html +0 -128
- package/coverage/lcov-report/helpers/get-filter-props.js.html +0 -242
- package/coverage/lcov-report/helpers/get-filter-relation-keys.js.html +0 -107
- package/coverage/lcov-report/helpers/get-generic-props.js.html +0 -113
- package/coverage/lcov-report/helpers/get-generic-render-variables.js.html +0 -200
- package/coverage/lcov-report/helpers/get-image-ids.js.html +0 -185
- package/coverage/lcov-report/helpers/get-inherited-filters.js.html +0 -122
- package/coverage/lcov-report/helpers/get-items-to-display-ids.js.html +0 -110
- package/coverage/lcov-report/helpers/get-modifiers.js.html +0 -137
- package/coverage/lcov-report/helpers/get-not-equal-query.js.html +0 -107
- package/coverage/lcov-report/helpers/get-pagination-index.js.html +0 -107
- package/coverage/lcov-report/helpers/get-parsed-prop-values.js.html +0 -197
- package/coverage/lcov-report/helpers/get-parsed-summary-value.js.html +0 -128
- package/coverage/lcov-report/helpers/get-prop-values.js.html +0 -143
- package/coverage/lcov-report/helpers/get-query-filters.js.html +0 -149
- package/coverage/lcov-report/helpers/get-query-props.js.html +0 -182
- package/coverage/lcov-report/helpers/get-required-schemas.js.html +0 -164
- package/coverage/lcov-report/helpers/get-sanitized-prop-values.js.html +0 -92
- package/coverage/lcov-report/helpers/get-search-filter-type.js.html +0 -101
- package/coverage/lcov-report/helpers/get-sort-by-field-name.js.html +0 -146
- package/coverage/lcov-report/helpers/get-unpublished-entity-name.js.html +0 -113
- package/coverage/lcov-report/helpers/get-updated-filter-by.js.html +0 -158
- package/coverage/lcov-report/helpers/get-wrapped-value-with-link.js.html +0 -155
- package/coverage/lcov-report/helpers/group-entities.js.html +0 -113
- package/coverage/lcov-report/helpers/has-children.js.html +0 -125
- package/coverage/lcov-report/helpers/index.html +0 -1041
- package/coverage/lcov-report/helpers/index.js.html +0 -233
- package/coverage/lcov-report/helpers/inject-banner.js.html +0 -125
- package/coverage/lcov-report/helpers/inject-banners-to-entities.js.html +0 -128
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js.html +0 -128
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-entities/index.html +0 -126
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-entities/index.js.html +0 -89
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js.html +0 -131
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-nodes/helpers/group-node-entities.js.html +0 -179
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-nodes/helpers/index.html +0 -126
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-nodes/helpers/index.js.html +0 -89
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-nodes/index.html +0 -126
- package/coverage/lcov-report/helpers/inject-multiple-banners/get-banners-for-nodes/index.js.html +0 -89
- package/coverage/lcov-report/helpers/inject-multiple-banners/index.html +0 -126
- package/coverage/lcov-report/helpers/inject-multiple-banners/index.js.html +0 -89
- package/coverage/lcov-report/helpers/inject-multiple-banners/inject-multiple-banners.js.html +0 -119
- package/coverage/lcov-report/helpers/is-browser.js.html +0 -89
- package/coverage/lcov-report/helpers/is-filter-entitys-id.js.html +0 -122
- package/coverage/lcov-report/helpers/is-object.js.html +0 -89
- package/coverage/lcov-report/helpers/is-using-relation-image.js.html +0 -92
- package/coverage/lcov-report/helpers/parse-interval.js.html +0 -89
- package/coverage/lcov-report/helpers/parse-props-to-display.js.html +0 -194
- package/coverage/lcov-report/helpers/remove-extra-items.js.html +0 -119
- package/coverage/lcov-report/helpers/remove-unwanted-characters.js.html +0 -140
- package/coverage/lcov-report/helpers/render-children.js.html +0 -152
- package/coverage/lcov-report/helpers/should-render-waypoint.js.html +0 -92
- package/coverage/lcov-report/helpers/should-show-property.js.html +0 -89
- package/coverage/lcov-report/helpers/sort-response-data.js.html +0 -107
- package/coverage/lcov-report/helpers/split-children.js.html +0 -233
- package/coverage/lcov-report/helpers/update-childrens-parent.js.html +0 -140
- package/coverage/lcov-report/hooks/helpers/RenderList.js.html +0 -233
- package/coverage/lcov-report/hooks/helpers/StoreImages.js.html +0 -215
- package/coverage/lcov-report/hooks/helpers/append-gtm-classname.js.html +0 -188
- package/coverage/lcov-report/hooks/helpers/buildPBComponents.js.html +0 -329
- package/coverage/lcov-report/hooks/helpers/check-banner-insertion-set.js.html +0 -125
- package/coverage/lcov-report/hooks/helpers/constants.js.html +0 -98
- package/coverage/lcov-report/hooks/helpers/get-banner-index.js.html +0 -92
- package/coverage/lcov-report/hooks/helpers/get-lightbox-images.js.html +0 -242
- package/coverage/lcov-report/hooks/helpers/getComponent.js.html +0 -95
- package/coverage/lcov-report/hooks/helpers/index.html +0 -261
- package/coverage/lcov-report/hooks/helpers/index.js.html +0 -89
- package/coverage/lcov-report/hooks/helpers/insert-banners.js.html +0 -362
- package/coverage/lcov-report/hooks/index.html +0 -201
- package/coverage/lcov-report/hooks/index.js.html +0 -98
- package/coverage/lcov-report/hooks/use-get-entity-schema.js.html +0 -167
- package/coverage/lcov-report/hooks/use-get-entity-schemas-as-obj.js.html +0 -113
- package/coverage/lcov-report/hooks/use-get-image-id-from-relation.js.html +0 -143
- package/coverage/lcov-report/hooks/use-get-images.js.html +0 -143
- package/coverage/lcov-report/hooks/use-get-single-entity-schema.js.html +0 -125
- package/coverage/lcov-report/hooks/use-page-builder.js.html +0 -155
- package/coverage/lcov-report/index.html +0 -936
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -170
- package/coverage/lcov-report/utils/component-map.js.html +0 -182
- package/coverage/lcov-report/utils/get-class-modifiers.js.html +0 -287
- package/coverage/lcov-report/utils/get-image-data.js.html +0 -137
- package/coverage/lcov-report/utils/get-props-to-display-modifiers.js.html +0 -92
- package/coverage/lcov-report/utils/index.html +0 -186
- package/coverage/lcov-report/utils/index.js.html +0 -101
- package/coverage/lcov-report/utils/is-object-empty.js.html +0 -89
- package/coverage/lcov.info +0 -7222
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.123.0-alpha.19](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.18...v0.123.0-alpha.19) (2022-03-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* handle search filter with css ([#3395](https://github.com/thebyte9/blaze/issues/3395)) ([41cef02](https://github.com/thebyte9/blaze/commit/41cef02add747256cb813b0d2985f54ec92a4061))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.123.0-alpha.18](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.17...v0.123.0-alpha.18) (2022-03-31)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
@@ -117,23 +117,13 @@ var SearchFilter = function SearchFilter(_ref) {
|
|
|
117
117
|
|
|
118
118
|
var _useState = (0, _react.useState)(true),
|
|
119
119
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
moreFiltersMobileCollapsed = _useState2[0],
|
|
121
|
+
setMoreFiltersMobileCollapsed = _useState2[1];
|
|
122
122
|
|
|
123
|
-
var _useState3 = (0, _react.useState)(
|
|
123
|
+
var _useState3 = (0, _react.useState)(true),
|
|
124
124
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var _useState5 = (0, _react.useState)(true),
|
|
129
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
130
|
-
moreFiltersMobileCollapsed = _useState6[0],
|
|
131
|
-
setMoreFiltersMobileCollapsed = _useState6[1];
|
|
132
|
-
|
|
133
|
-
var _useState7 = (0, _react.useState)(true),
|
|
134
|
-
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
135
|
-
moreFiltersDesktopCollapsed = _useState8[0],
|
|
136
|
-
setMoreFiltersDesktopCollapsed = _useState8[1];
|
|
125
|
+
moreFiltersDesktopCollapsed = _useState4[0],
|
|
126
|
+
setMoreFiltersDesktopCollapsed = _useState4[1];
|
|
137
127
|
|
|
138
128
|
var _useReducer = (0, _react.useReducer)(reducer, initialFilterValues),
|
|
139
129
|
_useReducer2 = (0, _slicedToArray2["default"])(_useReducer, 2),
|
|
@@ -144,24 +134,6 @@ var SearchFilter = function SearchFilter(_ref) {
|
|
|
144
134
|
var newQuery = (0, _helpers.buildQuery)(newValues, filters);
|
|
145
135
|
handleSearch(newQuery);
|
|
146
136
|
}, 200);
|
|
147
|
-
(0, _react.useEffect)(function () {
|
|
148
|
-
if (window && !pageWidth) {
|
|
149
|
-
setPageWidth(window.innerWidth);
|
|
150
|
-
setIsDesktop((0, _helpers.isDeviceDesktop)());
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
var handleResize = function handleResize(_ref2) {
|
|
154
|
-
var innerWidth = _ref2.target.innerWidth;
|
|
155
|
-
setIsDesktop((0, _helpers.isDeviceDesktop)());
|
|
156
|
-
setPageWidth(innerWidth);
|
|
157
|
-
if (isDesktop) setDisplaySearchFilter(false);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
window.addEventListener('resize', handleResize);
|
|
161
|
-
return function () {
|
|
162
|
-
window.removeEventListener('resize', handleResize);
|
|
163
|
-
};
|
|
164
|
-
}, [isDesktop, pageWidth, setDisplaySearchFilter]);
|
|
165
137
|
(0, _react.useEffect)(function () {
|
|
166
138
|
if (filterValues.shouldSearch) {
|
|
167
139
|
handleSubmit(filterValues);
|
|
@@ -170,16 +142,9 @@ var SearchFilter = function SearchFilter(_ref) {
|
|
|
170
142
|
});
|
|
171
143
|
}
|
|
172
144
|
}, [filterValues, handleSubmit]);
|
|
173
|
-
var
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (!isDesktop && isCollapsedOnResponsive) {
|
|
177
|
-
isMobileFormDisplayed = displaySearchFilter;
|
|
178
|
-
isDesktopFormDisplayed = false;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
var formClass = (0, _classnames["default"])({
|
|
182
|
-
'filter__form filter__form--mobile': isMobileFormDisplayed
|
|
145
|
+
var formClass = (0, _classnames["default"])('filter__form filter__form--initial', {
|
|
146
|
+
'filter__form--mobile': isCollapsedOnResponsive && displaySearchFilter,
|
|
147
|
+
'filter__form--collapsible': isCollapsedOnResponsive
|
|
183
148
|
});
|
|
184
149
|
|
|
185
150
|
var _getResponsiveFilterC = (0, _helpers.getResponsiveFilterClassnames)(moreFiltersDesktopCollapsed, moreFiltersMobileCollapsed),
|
|
@@ -208,7 +173,7 @@ var SearchFilter = function SearchFilter(_ref) {
|
|
|
208
173
|
|
|
209
174
|
var shouldGroup = !!(groupAfterDesktop || groupAfterMobile);
|
|
210
175
|
var shouldSearch = !hasUrl;
|
|
211
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null,
|
|
176
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("form", {
|
|
212
177
|
ref: searchFilterRef,
|
|
213
178
|
className: formClass,
|
|
214
179
|
"data-testid": formId,
|
|
@@ -218,13 +183,13 @@ var SearchFilter = function SearchFilter(_ref) {
|
|
|
218
183
|
var newQuery = (0, _helpers.buildQuery)(filterValues, filters);
|
|
219
184
|
handleSearch(newQuery);
|
|
220
185
|
}
|
|
221
|
-
},
|
|
186
|
+
}, displaySearchFilter && /*#__PURE__*/_react["default"].createElement(_CloseMobileForm["default"], {
|
|
222
187
|
handleClose: function handleClose() {
|
|
223
188
|
return setDisplaySearchFilter(false);
|
|
224
189
|
}
|
|
225
190
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
226
191
|
className: "filter filter--search-refine"
|
|
227
|
-
},
|
|
192
|
+
}, /*#__PURE__*/_react["default"].createElement(_ResetDesktopForm["default"], {
|
|
228
193
|
handleReset: handleReset
|
|
229
194
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
230
195
|
className: "filter__wrapper filter__wrapper--search-refine"
|
|
@@ -294,13 +259,13 @@ var SearchFilter = function SearchFilter(_ref) {
|
|
|
294
259
|
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
295
260
|
className: "button button--full-width",
|
|
296
261
|
type: "submit"
|
|
297
|
-
}, _constants.SEARCH)))), /*#__PURE__*/_react["default"].createElement("br", null),
|
|
262
|
+
}, _constants.SEARCH)))), /*#__PURE__*/_react["default"].createElement("br", null), !displaySearchFilter && /*#__PURE__*/_react["default"].createElement("button", {
|
|
298
263
|
className: "button button--full-width",
|
|
299
264
|
type: "submit"
|
|
300
|
-
}, _constants.SEARCH))),
|
|
265
|
+
}, _constants.SEARCH))), displaySearchFilter && /*#__PURE__*/_react["default"].createElement(_MobileFormToolbar["default"], {
|
|
301
266
|
formId: formId,
|
|
302
267
|
handleReset: handleReset
|
|
303
|
-
}))
|
|
268
|
+
})), isCollapsedOnResponsive && !displaySearchFilter && /*#__PURE__*/_react["default"].createElement("div", {
|
|
304
269
|
className: "filter__refine filter__refine--mobile-close",
|
|
305
270
|
"data-testid": "refine-mobile"
|
|
306
271
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -308,7 +273,7 @@ var SearchFilter = function SearchFilter(_ref) {
|
|
|
308
273
|
onClick: function onClick() {
|
|
309
274
|
return setDisplaySearchFilter(true);
|
|
310
275
|
}
|
|
311
|
-
}, _constants.REFINE)))
|
|
276
|
+
}, _constants.REFINE)));
|
|
312
277
|
};
|
|
313
278
|
|
|
314
279
|
SearchFilter.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/SearchFilter/SearchFilter/SearchFilter.js"],"names":["reducer","state","action","newValues","type","shouldSearch","Error","SearchFilter","searchFilterRef","data","filters","hasUrl","entity","handleSearch","name","isCollapsedOnResponsive","displaySearchFilter","setDisplaySearchFilter","initialFilterValues","groupAfterDesktop","groupAfterMobile","isDesktop","setIsDesktop","pageWidth","setPageWidth","moreFiltersMobileCollapsed","setMoreFiltersMobileCollapsed","moreFiltersDesktopCollapsed","setMoreFiltersDesktopCollapsed","filterValues","dispatch","handleSubmit","newQuery","window","innerWidth","handleResize","target","addEventListener","removeEventListener","isDesktopFormDisplayed","isMobileFormDisplayed","formClass","moreFiltersMobileWrapperClass","moreFiltersMobileTogglerClass","moreFiltersDesktopWrapperClass","moreFiltersDesktopTogglerClass","formId","handleReset","updateFilterValues","shouldSubmit","shouldGroup","e","preventDefault","slice","MORE_FILTERS_CLASSES","MOBILE_CONTENT","DESKTOP_CONTENT","DESKTOP_BUTTONS","SEARCH","MOBILE_BUTTONS","REFINE","propTypes","PropTypes","object","isRequired","array","bool","string","func","number"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAQC,MAAR,EAAmB;AACjC,MAAQC,SAAR,GAAiDD,MAAjD,CAAQC,SAAR;AAAA,MAAmBC,IAAnB,GAAiDF,MAAjD,CAAmBE,IAAnB;AAAA,6BAAiDF,MAAjD,CAAyBG,YAAzB;AAAA,MAAyBA,YAAzB,qCAAwC,IAAxC;;AAEA,UAAQD,IAAR;AACE,SAAK,QAAL;AACE,2DAAYH,KAAZ,GAAsBE,SAAtB;AAAiCE,QAAAA,YAAY,EAAZA;AAAjC;;AACF,SAAK,aAAL;AACE,6CAAYJ,KAAZ;AAAmBI,QAAAA,YAAY,EAAE;AAAjC;;AACF,SAAK,OAAL;AACE,6CAAYF,SAAZ;AAAuBE,QAAAA,YAAY,EAAZA;AAAvB;;AACF;AACE,YAAM,IAAIC,KAAJ,EAAN;AARJ;AAUD,CAbD;;AAeA,IAAMC,YAAY,GAAG,SAAfA,Y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AS,EAAC,6CADZ;AAEE,mBAAY;AAFd,kBAGE;AAAK,IAAA,IAAI,EAAC,QAAV;AAAmB,IAAA,OAAO,EAAE;AAAA,aAAME,sBAAsB,CAAC,IAAD,CAA5B;AAAA;AAA5B,KACG2C,iBADH,CAHF,CAFJ,CA9HJ,CADF;AA6ID,CAxOD;;AA0OArD,YAAY,CAACsD,SAAb,GAAyB;AACvBpD,EAAAA,IAAI,EAAEqD,sBAAUC,MAAV,CAAiBC,UADA;AAEvBtD,EAAAA,OAAO,EAAEoD,sBAAUG,KAAV,CAAgBD,UAFF;AAGvBxD,EAAAA,eAAe,EAAEsD,sBAAUC,MAAV,CAAiBC,UAHX;AAIvBrD,EAAAA,MAAM,EAAEmD,sBAAUI,IAAV,CAAeF,UAJA;AAKvBpD,EAAAA,MAAM,EAAEkD,sBAAUK,MAAV,CAAiBH,UALF;AAMvBnD,EAAAA,YAAY,EAAEiD,sBAAUM,IAAV,CAAeJ,UANN;AAOvBlD,EAAAA,IAAI,EAAEgD,sBAAUK,MAAV,CAAiBH,UAPA;AAQvBhD,EAAAA,mBAAmB,EAAE8C,sBAAUI,IAAV,CAAeF,UARb;AASvB/C,EAAAA,sBAAsB,EAAE6C,sBAAUM,IAAV,CAAeJ,UAThB;AAUvBjD,EAAAA,uBAAuB,EAAE+C,sBAAUI,IAAV,CAAeF,UAVjB;AAWvB7C,EAAAA,iBAAiB,EAAE2C,sBAAUO,MAAV,CAAiBL,UAXb;AAYvB5C,EAAAA,gBAAgB,EAAE0C,sBAAUO,MAAV,CAAiBL,UAZZ;AAavB9C,EAAAA,mBAAmB,EAAE4C,sBAAUC,MAAV,CAAiBC;AAbf,CAAzB;eAgBezD,Y","sourcesContent":["import React, { useState, useEffect, useReducer } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport debounce from 'lodash.debounce';\nimport FiltersList from './FiltersList';\nimport {\n isDeviceDesktop,\n buildQuery,\n getInitialFilterValues,\n getResponsiveFilterClassnames\n} from '../helpers';\nimport CloseMobileForm from './CloseMobileForm';\nimport ResetDesktopForm from './ResetDesktopForm';\nimport MobileFormToolbar from './MobileFormToolbar';\nimport { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilter = ({\n searchFilterRef,\n data,\n filters,\n hasUrl,\n entity,\n handleSearch,\n name,\n isCollapsedOnResponsive,\n displaySearchFilter,\n setDisplaySearchFilter,\n initialFilterValues,\n groupAfterDesktop,\n groupAfterMobile\n}) => {\n const [isDesktop, setIsDesktop] = useState(true);\n const [pageWidth, setPageWidth] = useState(null);\n const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);\n const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);\n const [filterValues, dispatch] = useReducer(reducer, initialFilterValues);\n\n const handleSubmit = debounce(newValues => {\n const newQuery = buildQuery(newValues, filters);\n handleSearch(newQuery);\n }, 200);\n\n useEffect(\n () => {\n if (window && !pageWidth) {\n setPageWidth(window.innerWidth);\n setIsDesktop(isDeviceDesktop());\n }\n\n const handleResize = ({ target: { innerWidth } }) => {\n setIsDesktop(isDeviceDesktop());\n setPageWidth(innerWidth);\n if (isDesktop) setDisplaySearchFilter(false);\n };\n\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n },\n [isDesktop, pageWidth, setDisplaySearchFilter]\n );\n\n useEffect(\n () => {\n if (filterValues.shouldSearch) {\n handleSubmit(filterValues);\n dispatch({ type: 'resetSearch' });\n }\n },\n [filterValues, handleSubmit]\n );\n\n let isDesktopFormDisplayed = true;\n let isMobileFormDisplayed = false;\n\n if (!isDesktop && isCollapsedOnResponsive) {\n isMobileFormDisplayed = displaySearchFilter;\n isDesktopFormDisplayed = false;\n }\n\n const formClass = classnames({\n 'filter__form filter__form--mobile': isMobileFormDisplayed\n });\n\n const {\n moreFiltersMobileWrapperClass,\n moreFiltersMobileTogglerClass,\n moreFiltersDesktopWrapperClass,\n moreFiltersDesktopTogglerClass\n } = getResponsiveFilterClassnames(moreFiltersDesktopCollapsed, moreFiltersMobileCollapsed);\n\n const formId = `filter-${name}-form`;\n\n const handleReset = () => {\n const newValues = getInitialFilterValues(data, filters, {});\n\n dispatch({ newValues, type: 'reset' });\n };\n\n const updateFilterValues = (newValues, shouldSubmit) => {\n dispatch({ newValues, shouldSearch: shouldSubmit, type: 'update' });\n };\n\n const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);\n const shouldSearch = !hasUrl;\n\n return (\n <>\n {isDesktopFormDisplayed || isMobileFormDisplayed ? (\n <form\n ref={searchFilterRef}\n className={formClass}\n data-testid={formId}\n id={formId}\n onSubmit={e => {\n e.preventDefault();\n const newQuery = buildQuery(filterValues, filters);\n handleSearch(newQuery);\n }}>\n {isMobileFormDisplayed && (\n <CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />\n )}\n\n <div className=\"filter filter--search-refine\">\n {isDesktopFormDisplayed && <ResetDesktopForm handleReset={handleReset} />}\n\n <div className=\"filter__wrapper filter__wrapper--search-refine\">\n {!shouldGroup && (\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n )}\n\n {shouldGroup && (\n <>\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters.slice(0, groupAfterMobile)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterMobile && (\n <button\n className={moreFiltersMobileTogglerClass}\n type=\"button\"\n onClick={() => setMoreFiltersMobileCollapsed(!moreFiltersMobileCollapsed)}>\n Filters\n </button>\n )}\n\n <div className={moreFiltersMobileWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>\n <FiltersList\n shouldSearch={shouldSearch && isDeviceDesktop()}\n data={data}\n filters={filters.slice(\n groupAfterMobile,\n groupAfterDesktop ? groupAfterDesktop - 1 : 0\n )}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterDesktop && (\n <button\n className={moreFiltersDesktopTogglerClass}\n type=\"button\"\n onClick={() =>\n setMoreFiltersDesktopCollapsed(!moreFiltersDesktopCollapsed)\n }>\n More filters\n </button>\n )}\n\n <div className={moreFiltersDesktopWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.DESKTOP_CONTENT}>\n <FiltersList\n shouldSearch={false}\n data={data}\n filters={filters.slice(groupAfterDesktop)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n </div>\n\n <div className={MORE_FILTERS_CLASSES.DESKTOP_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </div>\n\n <div className={MORE_FILTERS_CLASSES.MOBILE_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </>\n )}\n\n <br />\n\n {isDesktopFormDisplayed && (\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n )}\n </div>\n </div>\n\n {isMobileFormDisplayed && <MobileFormToolbar formId={formId} handleReset={handleReset} />}\n </form>\n ) : (\n <>\n {isCollapsedOnResponsive && (\n <div\n className=\"filter__refine filter__refine--mobile-close\"\n data-testid=\"refine-mobile\">\n <div role=\"button\" onClick={() => setDisplaySearchFilter(true)}>\n {REFINE}\n </div>\n </div>\n )}\n </>\n )}\n </>\n );\n};\n\nSearchFilter.propTypes = {\n data: PropTypes.object.isRequired,\n filters: PropTypes.array.isRequired,\n searchFilterRef: PropTypes.object.isRequired,\n hasUrl: PropTypes.bool.isRequired,\n entity: PropTypes.string.isRequired,\n handleSearch: PropTypes.func.isRequired,\n name: PropTypes.string.isRequired,\n displaySearchFilter: PropTypes.bool.isRequired,\n setDisplaySearchFilter: PropTypes.func.isRequired,\n isCollapsedOnResponsive: PropTypes.bool.isRequired,\n groupAfterDesktop: PropTypes.number.isRequired,\n groupAfterMobile: PropTypes.number.isRequired,\n initialFilterValues: PropTypes.object.isRequired\n};\n\nexport default SearchFilter;\n"],"file":"SearchFilter.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/SearchFilter/SearchFilter/SearchFilter.js"],"names":["reducer","state","action","newValues","type","shouldSearch","Error","SearchFilter","searchFilterRef","data","filters","hasUrl","entity","handleSearch","name","isCollapsedOnResponsive","displaySearchFilter","setDisplaySearchFilter","initialFilterValues","groupAfterDesktop","groupAfterMobile","moreFiltersMobileCollapsed","setMoreFiltersMobileCollapsed","moreFiltersDesktopCollapsed","setMoreFiltersDesktopCollapsed","filterValues","dispatch","handleSubmit","newQuery","formClass","moreFiltersMobileWrapperClass","moreFiltersMobileTogglerClass","moreFiltersDesktopWrapperClass","moreFiltersDesktopTogglerClass","formId","handleReset","updateFilterValues","shouldSubmit","shouldGroup","e","preventDefault","slice","MORE_FILTERS_CLASSES","MOBILE_CONTENT","DESKTOP_CONTENT","DESKTOP_BUTTONS","SEARCH","MOBILE_BUTTONS","REFINE","propTypes","PropTypes","object","isRequired","array","bool","string","func","number"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAQC,MAAR,EAAmB;AACjC,MAAQC,SAAR,GAAiDD,MAAjD,CAAQC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UALF;AAMvBvC,EAAAA,YAAY,EAAEqC,sBAAUM,IAAV,CAAeJ,UANN;AAOvBtC,EAAAA,IAAI,EAAEoC,sBAAUK,MAAV,CAAiBH,UAPA;AAQvBpC,EAAAA,mBAAmB,EAAEkC,sBAAUI,IAAV,CAAeF,UARb;AASvBnC,EAAAA,sBAAsB,EAAEiC,sBAAUM,IAAV,CAAeJ,UAThB;AAUvBrC,EAAAA,uBAAuB,EAAEmC,sBAAUI,IAAV,CAAeF,UAVjB;AAWvBjC,EAAAA,iBAAiB,EAAE+B,sBAAUO,MAAV,CAAiBL,UAXb;AAYvBhC,EAAAA,gBAAgB,EAAE8B,sBAAUO,MAAV,CAAiBL,UAZZ;AAavBlC,EAAAA,mBAAmB,EAAEgC,sBAAUC,MAAV,CAAiBC;AAbf,CAAzB;eAgBe7C,Y","sourcesContent":["import React, { useState, useEffect, useReducer } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport debounce from 'lodash.debounce';\nimport FiltersList from './FiltersList';\nimport {\n isDeviceDesktop,\n buildQuery,\n getInitialFilterValues,\n getResponsiveFilterClassnames\n} from '../helpers';\nimport CloseMobileForm from './CloseMobileForm';\nimport ResetDesktopForm from './ResetDesktopForm';\nimport MobileFormToolbar from './MobileFormToolbar';\nimport { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilter = ({\n searchFilterRef,\n data,\n filters,\n hasUrl,\n entity,\n handleSearch,\n name,\n isCollapsedOnResponsive,\n displaySearchFilter,\n setDisplaySearchFilter,\n initialFilterValues,\n groupAfterDesktop,\n groupAfterMobile\n}) => {\n const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);\n const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);\n const [filterValues, dispatch] = useReducer(reducer, initialFilterValues);\n\n const handleSubmit = debounce(newValues => {\n const newQuery = buildQuery(newValues, filters);\n handleSearch(newQuery);\n }, 200);\n\n useEffect(\n () => {\n if (filterValues.shouldSearch) {\n handleSubmit(filterValues);\n dispatch({ type: 'resetSearch' });\n }\n },\n [filterValues, handleSubmit]\n );\n\n const formClass = classnames('filter__form filter__form--initial', {\n 'filter__form--mobile': isCollapsedOnResponsive && displaySearchFilter,\n 'filter__form--collapsible': isCollapsedOnResponsive\n });\n\n const {\n moreFiltersMobileWrapperClass,\n moreFiltersMobileTogglerClass,\n moreFiltersDesktopWrapperClass,\n moreFiltersDesktopTogglerClass\n } = getResponsiveFilterClassnames(moreFiltersDesktopCollapsed, moreFiltersMobileCollapsed);\n\n const formId = `filter-${name}-form`;\n\n const handleReset = () => {\n const newValues = getInitialFilterValues(data, filters, {});\n\n dispatch({ newValues, type: 'reset' });\n };\n\n const updateFilterValues = (newValues, shouldSubmit) => {\n dispatch({ newValues, shouldSearch: shouldSubmit, type: 'update' });\n };\n\n const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);\n const shouldSearch = !hasUrl;\n\n return (\n <>\n <form\n ref={searchFilterRef}\n className={formClass}\n data-testid={formId}\n id={formId}\n onSubmit={e => {\n e.preventDefault();\n const newQuery = buildQuery(filterValues, filters);\n handleSearch(newQuery);\n }}>\n {displaySearchFilter && (\n <CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />\n )}\n\n <div className=\"filter filter--search-refine\">\n <ResetDesktopForm handleReset={handleReset} />\n\n <div className=\"filter__wrapper filter__wrapper--search-refine\">\n {!shouldGroup && (\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n )}\n\n {shouldGroup && (\n <>\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters.slice(0, groupAfterMobile)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterMobile && (\n <button\n className={moreFiltersMobileTogglerClass}\n type=\"button\"\n onClick={() => setMoreFiltersMobileCollapsed(!moreFiltersMobileCollapsed)}>\n Filters\n </button>\n )}\n\n <div className={moreFiltersMobileWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>\n <FiltersList\n shouldSearch={shouldSearch && isDeviceDesktop()}\n data={data}\n filters={filters.slice(\n groupAfterMobile,\n groupAfterDesktop ? groupAfterDesktop - 1 : 0\n )}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterDesktop && (\n <button\n className={moreFiltersDesktopTogglerClass}\n type=\"button\"\n onClick={() =>\n setMoreFiltersDesktopCollapsed(!moreFiltersDesktopCollapsed)\n }>\n More filters\n </button>\n )}\n\n <div className={moreFiltersDesktopWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.DESKTOP_CONTENT}>\n <FiltersList\n shouldSearch={false}\n data={data}\n filters={filters.slice(groupAfterDesktop)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n </div>\n\n <div className={MORE_FILTERS_CLASSES.DESKTOP_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </div>\n\n <div className={MORE_FILTERS_CLASSES.MOBILE_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </>\n )}\n\n <br />\n\n {!displaySearchFilter && (\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n )}\n </div>\n </div>\n\n {displaySearchFilter && <MobileFormToolbar formId={formId} handleReset={handleReset} />}\n </form>\n\n {isCollapsedOnResponsive &&\n !displaySearchFilter && (\n <div className=\"filter__refine filter__refine--mobile-close\" data-testid=\"refine-mobile\">\n <div role=\"button\" onClick={() => setDisplaySearchFilter(true)}>\n {REFINE}\n </div>\n </div>\n )}\n </>\n );\n};\n\nSearchFilter.propTypes = {\n data: PropTypes.object.isRequired,\n filters: PropTypes.array.isRequired,\n searchFilterRef: PropTypes.object.isRequired,\n hasUrl: PropTypes.bool.isRequired,\n entity: PropTypes.string.isRequired,\n handleSearch: PropTypes.func.isRequired,\n name: PropTypes.string.isRequired,\n displaySearchFilter: PropTypes.bool.isRequired,\n setDisplaySearchFilter: PropTypes.func.isRequired,\n isCollapsedOnResponsive: PropTypes.bool.isRequired,\n groupAfterDesktop: PropTypes.number.isRequired,\n groupAfterMobile: PropTypes.number.isRequired,\n initialFilterValues: PropTypes.object.isRequired\n};\n\nexport default SearchFilter;\n"],"file":"SearchFilter.js"}
|
|
@@ -58,8 +58,6 @@ const SearchFilter = ({
|
|
|
58
58
|
groupAfterDesktop,
|
|
59
59
|
groupAfterMobile
|
|
60
60
|
}) => {
|
|
61
|
-
const [isDesktop, setIsDesktop] = useState(true);
|
|
62
|
-
const [pageWidth, setPageWidth] = useState(null);
|
|
63
61
|
const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);
|
|
64
62
|
const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);
|
|
65
63
|
const [filterValues, dispatch] = useReducer(reducer, initialFilterValues);
|
|
@@ -67,27 +65,6 @@ const SearchFilter = ({
|
|
|
67
65
|
const newQuery = buildQuery(newValues, filters);
|
|
68
66
|
handleSearch(newQuery);
|
|
69
67
|
}, 200);
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (window && !pageWidth) {
|
|
72
|
-
setPageWidth(window.innerWidth);
|
|
73
|
-
setIsDesktop(isDeviceDesktop());
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const handleResize = ({
|
|
77
|
-
target: {
|
|
78
|
-
innerWidth
|
|
79
|
-
}
|
|
80
|
-
}) => {
|
|
81
|
-
setIsDesktop(isDeviceDesktop());
|
|
82
|
-
setPageWidth(innerWidth);
|
|
83
|
-
if (isDesktop) setDisplaySearchFilter(false);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
window.addEventListener('resize', handleResize);
|
|
87
|
-
return () => {
|
|
88
|
-
window.removeEventListener('resize', handleResize);
|
|
89
|
-
};
|
|
90
|
-
}, [isDesktop, pageWidth, setDisplaySearchFilter]);
|
|
91
68
|
useEffect(() => {
|
|
92
69
|
if (filterValues.shouldSearch) {
|
|
93
70
|
handleSubmit(filterValues);
|
|
@@ -96,16 +73,9 @@ const SearchFilter = ({
|
|
|
96
73
|
});
|
|
97
74
|
}
|
|
98
75
|
}, [filterValues, handleSubmit]);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!isDesktop && isCollapsedOnResponsive) {
|
|
103
|
-
isMobileFormDisplayed = displaySearchFilter;
|
|
104
|
-
isDesktopFormDisplayed = false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const formClass = classnames({
|
|
108
|
-
'filter__form filter__form--mobile': isMobileFormDisplayed
|
|
76
|
+
const formClass = classnames('filter__form filter__form--initial', {
|
|
77
|
+
'filter__form--mobile': isCollapsedOnResponsive && displaySearchFilter,
|
|
78
|
+
'filter__form--collapsible': isCollapsedOnResponsive
|
|
109
79
|
});
|
|
110
80
|
const {
|
|
111
81
|
moreFiltersMobileWrapperClass,
|
|
@@ -133,7 +103,7 @@ const SearchFilter = ({
|
|
|
133
103
|
|
|
134
104
|
const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);
|
|
135
105
|
const shouldSearch = !hasUrl;
|
|
136
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
106
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
|
|
137
107
|
ref: searchFilterRef,
|
|
138
108
|
className: formClass,
|
|
139
109
|
"data-testid": formId,
|
|
@@ -143,11 +113,11 @@ const SearchFilter = ({
|
|
|
143
113
|
const newQuery = buildQuery(filterValues, filters);
|
|
144
114
|
handleSearch(newQuery);
|
|
145
115
|
}
|
|
146
|
-
},
|
|
116
|
+
}, displaySearchFilter && /*#__PURE__*/React.createElement(CloseMobileForm, {
|
|
147
117
|
handleClose: () => setDisplaySearchFilter(false)
|
|
148
118
|
}), /*#__PURE__*/React.createElement("div", {
|
|
149
119
|
className: "filter filter--search-refine"
|
|
150
|
-
},
|
|
120
|
+
}, /*#__PURE__*/React.createElement(ResetDesktopForm, {
|
|
151
121
|
handleReset: handleReset
|
|
152
122
|
}), /*#__PURE__*/React.createElement("div", {
|
|
153
123
|
className: "filter__wrapper filter__wrapper--search-refine"
|
|
@@ -213,19 +183,19 @@ const SearchFilter = ({
|
|
|
213
183
|
}), /*#__PURE__*/React.createElement("button", {
|
|
214
184
|
className: "button button--full-width",
|
|
215
185
|
type: "submit"
|
|
216
|
-
}, SEARCH)))), /*#__PURE__*/React.createElement("br", null),
|
|
186
|
+
}, SEARCH)))), /*#__PURE__*/React.createElement("br", null), !displaySearchFilter && /*#__PURE__*/React.createElement("button", {
|
|
217
187
|
className: "button button--full-width",
|
|
218
188
|
type: "submit"
|
|
219
|
-
}, SEARCH))),
|
|
189
|
+
}, SEARCH))), displaySearchFilter && /*#__PURE__*/React.createElement(MobileFormToolbar, {
|
|
220
190
|
formId: formId,
|
|
221
191
|
handleReset: handleReset
|
|
222
|
-
}))
|
|
192
|
+
})), isCollapsedOnResponsive && !displaySearchFilter && /*#__PURE__*/React.createElement("div", {
|
|
223
193
|
className: "filter__refine filter__refine--mobile-close",
|
|
224
194
|
"data-testid": "refine-mobile"
|
|
225
195
|
}, /*#__PURE__*/React.createElement("div", {
|
|
226
196
|
role: "button",
|
|
227
197
|
onClick: () => setDisplaySearchFilter(true)
|
|
228
|
-
}, REFINE)))
|
|
198
|
+
}, REFINE)));
|
|
229
199
|
};
|
|
230
200
|
|
|
231
201
|
SearchFilter.propTypes = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/SearchFilter/SearchFilter/SearchFilter.js"],"names":["React","useState","useEffect","useReducer","PropTypes","classnames","debounce","FiltersList","isDeviceDesktop","buildQuery","getInitialFilterValues","getResponsiveFilterClassnames","CloseMobileForm","ResetDesktopForm","MobileFormToolbar","SEARCH","REFINE","MORE_FILTERS_CLASSES","reducer","state","action","newValues","type","shouldSearch","Error","SearchFilter","searchFilterRef","data","filters","hasUrl","entity","handleSearch","name","isCollapsedOnResponsive","displaySearchFilter","setDisplaySearchFilter","initialFilterValues","groupAfterDesktop","groupAfterMobile","isDesktop","setIsDesktop","pageWidth","setPageWidth","moreFiltersMobileCollapsed","setMoreFiltersMobileCollapsed","moreFiltersDesktopCollapsed","setMoreFiltersDesktopCollapsed","filterValues","dispatch","handleSubmit","newQuery","window","innerWidth","handleResize","target","addEventListener","removeEventListener","isDesktopFormDisplayed","isMobileFormDisplayed","formClass","moreFiltersMobileWrapperClass","moreFiltersMobileTogglerClass","moreFiltersDesktopWrapperClass","moreFiltersDesktopTogglerClass","formId","handleReset","updateFilterValues","shouldSubmit","shouldGroup","e","preventDefault","slice","MOBILE_CONTENT","DESKTOP_CONTENT","DESKTOP_BUTTONS","MOBILE_BUTTONS","propTypes","object","isRequired","array","bool","string","func","number"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,UAArC,QAAuD,OAAvD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,SACEC,eADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,6BAJF,QAKO,YALP;AAMA,OAAOC,eAAP,MAA4B,mBAA5B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uBAAuB,EAAE7B,SAAS,CAAC4E,IAAV,CAAeF,UAVjB;AAWvBzC,EAAAA,iBAAiB,EAAEjC,SAAS,CAAC+E,MAAV,CAAiBL,UAXb;AAYvBxC,EAAAA,gBAAgB,EAAElC,SAAS,CAAC+E,MAAV,CAAiBL,UAZZ;AAavB1C,EAAAA,mBAAmB,EAAEhC,SAAS,CAACyE,MAAV,CAAiBC;AAbf,CAAzB;AAgBA,eAAerD,YAAf","sourcesContent":["import React, { useState, useEffect, useReducer } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport debounce from 'lodash.debounce';\nimport FiltersList from './FiltersList';\nimport {\n isDeviceDesktop,\n buildQuery,\n getInitialFilterValues,\n getResponsiveFilterClassnames\n} from '../helpers';\nimport CloseMobileForm from './CloseMobileForm';\nimport ResetDesktopForm from './ResetDesktopForm';\nimport MobileFormToolbar from './MobileFormToolbar';\nimport { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilter = ({\n searchFilterRef,\n data,\n filters,\n hasUrl,\n entity,\n handleSearch,\n name,\n isCollapsedOnResponsive,\n displaySearchFilter,\n setDisplaySearchFilter,\n initialFilterValues,\n groupAfterDesktop,\n groupAfterMobile\n}) => {\n const [isDesktop, setIsDesktop] = useState(true);\n const [pageWidth, setPageWidth] = useState(null);\n const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);\n const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);\n const [filterValues, dispatch] = useReducer(reducer, initialFilterValues);\n\n const handleSubmit = debounce(newValues => {\n const newQuery = buildQuery(newValues, filters);\n handleSearch(newQuery);\n }, 200);\n\n useEffect(\n () => {\n if (window && !pageWidth) {\n setPageWidth(window.innerWidth);\n setIsDesktop(isDeviceDesktop());\n }\n\n const handleResize = ({ target: { innerWidth } }) => {\n setIsDesktop(isDeviceDesktop());\n setPageWidth(innerWidth);\n if (isDesktop) setDisplaySearchFilter(false);\n };\n\n window.addEventListener('resize', handleResize);\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n },\n [isDesktop, pageWidth, setDisplaySearchFilter]\n );\n\n useEffect(\n () => {\n if (filterValues.shouldSearch) {\n handleSubmit(filterValues);\n dispatch({ type: 'resetSearch' });\n }\n },\n [filterValues, handleSubmit]\n );\n\n let isDesktopFormDisplayed = true;\n let isMobileFormDisplayed = false;\n\n if (!isDesktop && isCollapsedOnResponsive) {\n isMobileFormDisplayed = displaySearchFilter;\n isDesktopFormDisplayed = false;\n }\n\n const formClass = classnames({\n 'filter__form filter__form--mobile': isMobileFormDisplayed\n });\n\n const {\n moreFiltersMobileWrapperClass,\n moreFiltersMobileTogglerClass,\n moreFiltersDesktopWrapperClass,\n moreFiltersDesktopTogglerClass\n } = getResponsiveFilterClassnames(moreFiltersDesktopCollapsed, moreFiltersMobileCollapsed);\n\n const formId = `filter-${name}-form`;\n\n const handleReset = () => {\n const newValues = getInitialFilterValues(data, filters, {});\n\n dispatch({ newValues, type: 'reset' });\n };\n\n const updateFilterValues = (newValues, shouldSubmit) => {\n dispatch({ newValues, shouldSearch: shouldSubmit, type: 'update' });\n };\n\n const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);\n const shouldSearch = !hasUrl;\n\n return (\n <>\n {isDesktopFormDisplayed || isMobileFormDisplayed ? (\n <form\n ref={searchFilterRef}\n className={formClass}\n data-testid={formId}\n id={formId}\n onSubmit={e => {\n e.preventDefault();\n const newQuery = buildQuery(filterValues, filters);\n handleSearch(newQuery);\n }}>\n {isMobileFormDisplayed && (\n <CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />\n )}\n\n <div className=\"filter filter--search-refine\">\n {isDesktopFormDisplayed && <ResetDesktopForm handleReset={handleReset} />}\n\n <div className=\"filter__wrapper filter__wrapper--search-refine\">\n {!shouldGroup && (\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n )}\n\n {shouldGroup && (\n <>\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters.slice(0, groupAfterMobile)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterMobile && (\n <button\n className={moreFiltersMobileTogglerClass}\n type=\"button\"\n onClick={() => setMoreFiltersMobileCollapsed(!moreFiltersMobileCollapsed)}>\n Filters\n </button>\n )}\n\n <div className={moreFiltersMobileWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>\n <FiltersList\n shouldSearch={shouldSearch && isDeviceDesktop()}\n data={data}\n filters={filters.slice(\n groupAfterMobile,\n groupAfterDesktop ? groupAfterDesktop - 1 : 0\n )}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterDesktop && (\n <button\n className={moreFiltersDesktopTogglerClass}\n type=\"button\"\n onClick={() =>\n setMoreFiltersDesktopCollapsed(!moreFiltersDesktopCollapsed)\n }>\n More filters\n </button>\n )}\n\n <div className={moreFiltersDesktopWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.DESKTOP_CONTENT}>\n <FiltersList\n shouldSearch={false}\n data={data}\n filters={filters.slice(groupAfterDesktop)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n </div>\n\n <div className={MORE_FILTERS_CLASSES.DESKTOP_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </div>\n\n <div className={MORE_FILTERS_CLASSES.MOBILE_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </>\n )}\n\n <br />\n\n {isDesktopFormDisplayed && (\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n )}\n </div>\n </div>\n\n {isMobileFormDisplayed && <MobileFormToolbar formId={formId} handleReset={handleReset} />}\n </form>\n ) : (\n <>\n {isCollapsedOnResponsive && (\n <div\n className=\"filter__refine filter__refine--mobile-close\"\n data-testid=\"refine-mobile\">\n <div role=\"button\" onClick={() => setDisplaySearchFilter(true)}>\n {REFINE}\n </div>\n </div>\n )}\n </>\n )}\n </>\n );\n};\n\nSearchFilter.propTypes = {\n data: PropTypes.object.isRequired,\n filters: PropTypes.array.isRequired,\n searchFilterRef: PropTypes.object.isRequired,\n hasUrl: PropTypes.bool.isRequired,\n entity: PropTypes.string.isRequired,\n handleSearch: PropTypes.func.isRequired,\n name: PropTypes.string.isRequired,\n displaySearchFilter: PropTypes.bool.isRequired,\n setDisplaySearchFilter: PropTypes.func.isRequired,\n isCollapsedOnResponsive: PropTypes.bool.isRequired,\n groupAfterDesktop: PropTypes.number.isRequired,\n groupAfterMobile: PropTypes.number.isRequired,\n initialFilterValues: PropTypes.object.isRequired\n};\n\nexport default SearchFilter;\n"],"file":"SearchFilter.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/SearchFilter/SearchFilter/SearchFilter.js"],"names":["React","useState","useEffect","useReducer","PropTypes","classnames","debounce","FiltersList","isDeviceDesktop","buildQuery","getInitialFilterValues","getResponsiveFilterClassnames","CloseMobileForm","ResetDesktopForm","MobileFormToolbar","SEARCH","REFINE","MORE_FILTERS_CLASSES","reducer","state","action","newValues","type","shouldSearch","Error","SearchFilter","searchFilterRef","data","filters","hasUrl","entity","handleSearch","name","isCollapsedOnResponsive","displaySearchFilter","setDisplaySearchFilter","initialFilterValues","groupAfterDesktop","groupAfterMobile","moreFiltersMobileCollapsed","setMoreFiltersMobileCollapsed","moreFiltersDesktopCollapsed","setMoreFiltersDesktopCollapsed","filterValues","dispatch","handleSubmit","newQuery","formClass","moreFiltersMobileWrapperClass","moreFiltersMobileTogglerClass","moreFiltersDesktopWrapperClass","moreFiltersDesktopTogglerClass","formId","handleReset","updateFilterValues","shouldSubmit","shouldGroup","e","preventDefault","slice","MOBILE_CONTENT","DESKTOP_CONTENT","DESKTOP_BUTTONS","MOBILE_BUTTONS","propTypes","object","isRequired","array","bool","string","func","number"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,UAArC,QAAuD,OAAvD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,SACEC,eADF,EAEEC,UAFF,EAGEC,sBAHF,EAIEC,6BAJF,QAKO,YALP;AAMA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,SAASC,MAAT,EAAiBC,MAAjB,EAAyBC,oBAAzB,QAAqD,cAArD;;AAEA,MAAMC,OAAO,GAAG,CAACC,KAAD,EAAQC,MAAR,KAAmB;AACjC,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,IAAb;AAAmBC,IAAAA,YAAY,GAAG;AAAlC,MAA2CH,MAAjD;;AAEA,UAAQE,IAAR;AACE,SAAK,QAAL;AACE,2DAAYH,KAAZ,GAAsBE,SAAtB;AAAiCE,QAAAA;AAAjC;;AACF,SAAK,aAAL;AACE,6CAAYJ,KAAZ;AAAmBI,QAAAA,YAAY,EAAE;AAAjC;;AACF,SAAK,OAAL;AACE,6CAAYF,SAAZ;AAAuBE,QAAAA;AAAvB;;AACF;AACE,YAAM,IAAIC,KAAJ,EAAN;AARJ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CAACC,mBADF,iBAEG;AAAK,IAAA,SAAS,EAAC,6CAAf;AAA6D,mBAAY;AAAzE,kBACE;AAAK,IAAA,IAAI,EAAC,QAAV;AAAmB,IAAA,OAAO,EAAE,MAAMC,sBAAsB,CAAC,IAAD;AAAxD,KACGnB,MADH,CADF,CA/HN,CADF;AAwID,CArMD;;AAuMAS,YAAY,CAACuC,SAAb,GAAyB;AACvBrC,EAAAA,IAAI,EAAEvB,SAAS,CAAC6D,MAAV,CAAiBC,UADA;AAEvBtC,EAAAA,OAAO,EAAExB,SAAS,CAAC+D,KAAV,CAAgBD,UAFF;AAGvBxC,EAAAA,eAAe,EAAEtB,SAAS,CAAC6D,MAAV,CAAiBC,UAHX;AAIvBrC,EAAAA,MAAM,EAAEzB,SAAS,CAACgE,IAAV,CAAeF,UAJA;AAKvBpC,EAAAA,MAAM,EAAE1B,SAAS,CAACiE,MAAV,CAAiBH,UALF;AAMvBnC,EAAAA,YAAY,EAAE3B,SAAS,CAACkE,IAAV,CAAeJ,UANN;AAOvBlC,EAAAA,IAAI,EAAE5B,SAAS,CAACiE,MAAV,CAAiBH,UAPA;AAQvBhC,EAAAA,mBAAmB,EAAE9B,SAAS,CAACgE,IAAV,CAAeF,UARb;AASvB/B,EAAAA,sBAAsB,EAAE/B,SAAS,CAACkE,IAAV,CAAeJ,UAThB;AAUvBjC,EAAAA,uBAAuB,EAAE7B,SAAS,CAACgE,IAAV,CAAeF,UAVjB;AAWvB7B,EAAAA,iBAAiB,EAAEjC,SAAS,CAACmE,MAAV,CAAiBL,UAXb;AAYvB5B,EAAAA,gBAAgB,EAAElC,SAAS,CAACmE,MAAV,CAAiBL,UAZZ;AAavB9B,EAAAA,mBAAmB,EAAEhC,SAAS,CAAC6D,MAAV,CAAiBC;AAbf,CAAzB;AAgBA,eAAezC,YAAf","sourcesContent":["import React, { useState, useEffect, useReducer } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport debounce from 'lodash.debounce';\nimport FiltersList from './FiltersList';\nimport {\n isDeviceDesktop,\n buildQuery,\n getInitialFilterValues,\n getResponsiveFilterClassnames\n} from '../helpers';\nimport CloseMobileForm from './CloseMobileForm';\nimport ResetDesktopForm from './ResetDesktopForm';\nimport MobileFormToolbar from './MobileFormToolbar';\nimport { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';\n\nconst reducer = (state, action) => {\n const { newValues, type, shouldSearch = true } = action;\n\n switch (type) {\n case 'update':\n return { ...state, ...newValues, shouldSearch };\n case 'resetSearch':\n return { ...state, shouldSearch: false };\n case 'reset':\n return { ...newValues, shouldSearch };\n default:\n throw new Error();\n }\n};\n\nconst SearchFilter = ({\n searchFilterRef,\n data,\n filters,\n hasUrl,\n entity,\n handleSearch,\n name,\n isCollapsedOnResponsive,\n displaySearchFilter,\n setDisplaySearchFilter,\n initialFilterValues,\n groupAfterDesktop,\n groupAfterMobile\n}) => {\n const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);\n const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);\n const [filterValues, dispatch] = useReducer(reducer, initialFilterValues);\n\n const handleSubmit = debounce(newValues => {\n const newQuery = buildQuery(newValues, filters);\n handleSearch(newQuery);\n }, 200);\n\n useEffect(\n () => {\n if (filterValues.shouldSearch) {\n handleSubmit(filterValues);\n dispatch({ type: 'resetSearch' });\n }\n },\n [filterValues, handleSubmit]\n );\n\n const formClass = classnames('filter__form filter__form--initial', {\n 'filter__form--mobile': isCollapsedOnResponsive && displaySearchFilter,\n 'filter__form--collapsible': isCollapsedOnResponsive\n });\n\n const {\n moreFiltersMobileWrapperClass,\n moreFiltersMobileTogglerClass,\n moreFiltersDesktopWrapperClass,\n moreFiltersDesktopTogglerClass\n } = getResponsiveFilterClassnames(moreFiltersDesktopCollapsed, moreFiltersMobileCollapsed);\n\n const formId = `filter-${name}-form`;\n\n const handleReset = () => {\n const newValues = getInitialFilterValues(data, filters, {});\n\n dispatch({ newValues, type: 'reset' });\n };\n\n const updateFilterValues = (newValues, shouldSubmit) => {\n dispatch({ newValues, shouldSearch: shouldSubmit, type: 'update' });\n };\n\n const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);\n const shouldSearch = !hasUrl;\n\n return (\n <>\n <form\n ref={searchFilterRef}\n className={formClass}\n data-testid={formId}\n id={formId}\n onSubmit={e => {\n e.preventDefault();\n const newQuery = buildQuery(filterValues, filters);\n handleSearch(newQuery);\n }}>\n {displaySearchFilter && (\n <CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />\n )}\n\n <div className=\"filter filter--search-refine\">\n <ResetDesktopForm handleReset={handleReset} />\n\n <div className=\"filter__wrapper filter__wrapper--search-refine\">\n {!shouldGroup && (\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n )}\n\n {shouldGroup && (\n <>\n <FiltersList\n shouldSearch={shouldSearch}\n data={data}\n filters={filters.slice(0, groupAfterMobile)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterMobile && (\n <button\n className={moreFiltersMobileTogglerClass}\n type=\"button\"\n onClick={() => setMoreFiltersMobileCollapsed(!moreFiltersMobileCollapsed)}>\n Filters\n </button>\n )}\n\n <div className={moreFiltersMobileWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.MOBILE_CONTENT}>\n <FiltersList\n shouldSearch={shouldSearch && isDeviceDesktop()}\n data={data}\n filters={filters.slice(\n groupAfterMobile,\n groupAfterDesktop ? groupAfterDesktop - 1 : 0\n )}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n\n {!!groupAfterDesktop && (\n <button\n className={moreFiltersDesktopTogglerClass}\n type=\"button\"\n onClick={() =>\n setMoreFiltersDesktopCollapsed(!moreFiltersDesktopCollapsed)\n }>\n More filters\n </button>\n )}\n\n <div className={moreFiltersDesktopWrapperClass}>\n <div className={MORE_FILTERS_CLASSES.DESKTOP_CONTENT}>\n <FiltersList\n shouldSearch={false}\n data={data}\n filters={filters.slice(groupAfterDesktop)}\n hasUrl={hasUrl}\n entity={entity}\n filterValues={filterValues}\n updateFilterValues={updateFilterValues}\n />\n </div>\n\n <div className={MORE_FILTERS_CLASSES.DESKTOP_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </div>\n\n <div className={MORE_FILTERS_CLASSES.MOBILE_BUTTONS}>\n <ResetDesktopForm handleReset={handleReset} />\n\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n </div>\n </div>\n </>\n )}\n\n <br />\n\n {!displaySearchFilter && (\n <button className=\"button button--full-width\" type=\"submit\">\n {SEARCH}\n </button>\n )}\n </div>\n </div>\n\n {displaySearchFilter && <MobileFormToolbar formId={formId} handleReset={handleReset} />}\n </form>\n\n {isCollapsedOnResponsive &&\n !displaySearchFilter && (\n <div className=\"filter__refine filter__refine--mobile-close\" data-testid=\"refine-mobile\">\n <div role=\"button\" onClick={() => setDisplaySearchFilter(true)}>\n {REFINE}\n </div>\n </div>\n )}\n </>\n );\n};\n\nSearchFilter.propTypes = {\n data: PropTypes.object.isRequired,\n filters: PropTypes.array.isRequired,\n searchFilterRef: PropTypes.object.isRequired,\n hasUrl: PropTypes.bool.isRequired,\n entity: PropTypes.string.isRequired,\n handleSearch: PropTypes.func.isRequired,\n name: PropTypes.string.isRequired,\n displaySearchFilter: PropTypes.bool.isRequired,\n setDisplaySearchFilter: PropTypes.func.isRequired,\n isCollapsedOnResponsive: PropTypes.bool.isRequired,\n groupAfterDesktop: PropTypes.number.isRequired,\n groupAfterMobile: PropTypes.number.isRequired,\n initialFilterValues: PropTypes.object.isRequired\n};\n\nexport default SearchFilter;\n"],"file":"SearchFilter.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.123.0-alpha.
|
|
3
|
+
"version": "0.123.0-alpha.19",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"lib/*",
|
|
85
85
|
"lib-es/*"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "a7fbbb7f751a30ee42a8057feda7f676ab769a9f"
|
|
88
88
|
}
|