@salla.sa/twilight-components 2.14.548 → 2.14.550
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/cjs/{Helper-6RI07gZo.js → Helper-D1YsoJud.js} +46 -0
- package/dist/cjs/{filepond-CGA4aTUA.js → filepond-B-8syvXC.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-DyVz7vP9.js → filepond-plugin-file-poster-DxfU_d7d.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-CgzYDBcU.js → filepond-plugin-file-validate-size-C0XIW0bl.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-Dx2CbMZ9.js → filepond-plugin-file-validate-type-BHyBHLOg.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-D3aTsFmD.js → filepond-plugin-image-edit-Dnni9gl-.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-BW3usWts.js → filepond-plugin-image-exif-orientation-C7pHXy9M.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-Bb7_UNPY.js → filepond-plugin-image-preview-CFttWV9E.js} +1 -1
- package/dist/cjs/{index-BssNhL-x.js → index-CHvvKGJc.js} +7 -3
- package/dist/cjs/{intlTelInput-B7QYiZ0d.js → intlTelInput--yv-lZaU.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-applied-filters.cjs.entry.js +175 -0
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
- package/dist/cjs/salla-badge.cjs.entry.js +1 -1
- package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
- package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
- package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +10 -11
- package/dist/cjs/salla-filters.cjs.entry.js +14 -79
- package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +2 -2
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
- package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
- package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +2 -2
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-H1di5S1s.js → vanilla-picker-D-X0hQ7w.js} +1 -1
- package/dist/collection/Helpers/Helper.js +28 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-applied-filters/salla-applied-filters.css +115 -0
- package/dist/collection/components/salla-applied-filters/salla-applied-filters.js +185 -0
- package/dist/collection/components/salla-filters/salla-filters.css +0 -119
- package/dist/collection/components/salla-filters/salla-filters.js +27 -73
- package/dist/components/Helper.js +47 -1
- package/dist/components/index.js +3 -3
- package/dist/components/salla-applied-filters.d.ts +11 -0
- package/dist/components/salla-applied-filters.js +195 -0
- package/dist/components/salla-filters-widget2.js +2 -21
- package/dist/components/salla-filters.js +10 -76
- package/dist/esm/{Helper-CBmYxrzX.js → Helper-DsjZ6kte.js} +47 -1
- package/dist/esm/{filepond-plugin-file-poster-DrmkMK37.js → filepond-plugin-file-poster-bfSOezL4.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-fRXLDtKY.js → filepond-plugin-file-validate-size-DagZiT3e.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-9x4CtZKy.js → filepond-plugin-file-validate-type-Cf4JwDq-.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-BTjvSjn9.js → filepond-plugin-image-edit-DWZ8nbdr.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-CnSOx2Lm.js → filepond-plugin-image-exif-orientation-NHp2unXf.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-Cy0Nd8Xr.js → filepond-plugin-image-preview-BSi_AIFs.js} +1 -1
- package/dist/esm/{filepond-CXmbiROU.js → filepond-rGVsy4ep.js} +1 -1
- package/dist/esm/{index-B64o_70M.js → index-Bf2Z6A1M.js} +7 -3
- package/dist/esm/{intlTelInput-FF2eKbuC.js → intlTelInput-DLtsxnoY.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_2.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +2 -2
- package/dist/esm/salla-add-product-button_5.entry.js +2 -2
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-applied-filters.entry.js +173 -0
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-attachment-view_9.entry.js +11 -11
- package/dist/esm/salla-badge.entry.js +1 -1
- package/dist/esm/salla-basket-gap.entry.js +1 -1
- package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
- package/dist/esm/salla-cart-coupons.entry.js +1 -1
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-cart-summary-card.entry.js +1 -1
- package/dist/esm/salla-cashback-banner.entry.js +1 -1
- package/dist/esm/salla-comment-factors.entry.js +1 -1
- package/dist/esm/salla-comment-form_9.entry.js +2 -2
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-cookies-bar.entry.js +1 -1
- package/dist/esm/salla-count-down.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-delivery-promise.entry.js +1 -1
- package/dist/esm/salla-edit-order-button.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +2 -3
- package/dist/esm/salla-filters.entry.js +8 -73
- package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +2 -2
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
- package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
- package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-map_2.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-next-order-coupon.entry.js +1 -1
- package/dist/esm/salla-notification-item_2.entry.js +2 -2
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-branch.entry.js +1 -1
- package/dist/esm/salla-order-cancel.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-edit-item.entry.js +1 -1
- package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
- package/dist/esm/salla-order-edit.entry.js +1 -1
- package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-order-shipments.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +2 -2
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-card-embed.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +2 -2
- package/dist/esm/salla-products-slider.entry.js +2 -2
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
- package/dist/esm/salla-rating-modal.entry.js +2 -2
- package/dist/esm/salla-review-factors-tags.entry.js +1 -1
- package/dist/esm/salla-review-order-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +2 -2
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +1 -1
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/salla-wishlist-actions.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-DMNociUd.js → vanilla-picker-AjTapsL5.js} +1 -1
- package/dist/twilight/{p-fa0467a7.entry.js → p-018456c8.entry.js} +1 -1
- package/dist/twilight/{p-441ee14a.entry.js → p-03db1fe6.entry.js} +1 -1
- package/dist/twilight/p-0739e769.entry.js +4 -0
- package/dist/twilight/{p-5273dbb2.entry.js → p-09c1d9c8.entry.js} +1 -1
- package/dist/twilight/{p-b8cd26a7.entry.js → p-0c4c4419.entry.js} +1 -1
- package/dist/twilight/{p-3b7cbf05.entry.js → p-0ccba871.entry.js} +1 -1
- package/dist/twilight/{p-cacf3c75.entry.js → p-0d199866.entry.js} +1 -1
- package/dist/twilight/{p-5f9b8ada.entry.js → p-0da8a64f.entry.js} +1 -1
- package/dist/twilight/{p-2f64c3b3.entry.js → p-0dc61077.entry.js} +1 -1
- package/dist/twilight/{p-0dfd760b.entry.js → p-0e12c9ca.entry.js} +1 -1
- package/dist/twilight/{p-522fb030.entry.js → p-0fb44a3c.entry.js} +1 -1
- package/dist/twilight/{p-1edbb249.entry.js → p-12d74e96.entry.js} +1 -1
- package/dist/twilight/{p-55cbacd7.entry.js → p-13fb9b74.entry.js} +1 -1
- package/dist/twilight/{p-440687a4.entry.js → p-1653256e.entry.js} +1 -1
- package/dist/twilight/{p-f12f8db3.entry.js → p-17c30aa6.entry.js} +1 -1
- package/dist/twilight/{p-f99550d8.entry.js → p-1c662f1d.entry.js} +1 -1
- package/dist/twilight/{p-233b9115.entry.js → p-2607ac8e.entry.js} +1 -1
- package/dist/twilight/{p-63a2ee05.entry.js → p-27396f6f.entry.js} +1 -1
- package/dist/twilight/{p-c9b1ad01.entry.js → p-277f3a46.entry.js} +1 -1
- package/dist/twilight/{p-6cd863b9.entry.js → p-2c212d54.entry.js} +1 -1
- package/dist/twilight/p-2f2771de.entry.js +4 -0
- package/dist/twilight/{p-309f771b.entry.js → p-33842645.entry.js} +1 -1
- package/dist/twilight/{p-be916b5f.entry.js → p-34240222.entry.js} +1 -1
- package/dist/twilight/{p-5c9e4502.entry.js → p-3615a99b.entry.js} +1 -1
- package/dist/twilight/{p-647832d9.entry.js → p-3627d945.entry.js} +1 -1
- package/dist/twilight/{p-b4fda5f4.entry.js → p-38b4dfa9.entry.js} +1 -1
- package/dist/twilight/{p-5ab11313.entry.js → p-3a4160c2.entry.js} +1 -1
- package/dist/twilight/{p-74a1a32f.entry.js → p-434f3557.entry.js} +1 -1
- package/dist/twilight/{p-63acbca7.entry.js → p-44ee3af8.entry.js} +1 -1
- package/dist/twilight/{p-6451e759.entry.js → p-4d3e018b.entry.js} +1 -1
- package/dist/twilight/{p-569ad58b.entry.js → p-4df5f9a0.entry.js} +1 -1
- package/dist/twilight/{p-b17c6f84.entry.js → p-4f1102f8.entry.js} +1 -1
- package/dist/twilight/{p-52607d64.entry.js → p-5256180e.entry.js} +1 -1
- package/dist/twilight/{p-9dbf3ff4.entry.js → p-5383a324.entry.js} +1 -1
- package/dist/twilight/{p-c26f1183.entry.js → p-57b7cd9f.entry.js} +1 -1
- package/dist/twilight/{p-77fa0f9f.entry.js → p-581eeaf8.entry.js} +1 -1
- package/dist/twilight/{p-8e293878.entry.js → p-5a4f7313.entry.js} +1 -1
- package/dist/twilight/{p-b16264a3.entry.js → p-649ced48.entry.js} +1 -1
- package/dist/twilight/{p-897b8824.entry.js → p-69d75b45.entry.js} +1 -1
- package/dist/twilight/{p-e0f3e985.entry.js → p-6e78cc02.entry.js} +1 -1
- package/dist/twilight/{p-c8dae54b.entry.js → p-785cee9b.entry.js} +1 -1
- package/dist/twilight/{p-e354292f.entry.js → p-7b6fa77f.entry.js} +1 -1
- package/dist/twilight/{p-2ddabee9.entry.js → p-7e101885.entry.js} +1 -1
- package/dist/twilight/{p-971b8ff5.entry.js → p-7e9d98c3.entry.js} +1 -1
- package/dist/twilight/{p-13978ff2.entry.js → p-8838ad5c.entry.js} +1 -1
- package/dist/twilight/{p-db4dc7cc.entry.js → p-8cf65dbf.entry.js} +1 -1
- package/dist/twilight/{p-40d4ccbb.entry.js → p-8e0bdbbc.entry.js} +1 -1
- package/dist/twilight/{p-991fa4ad.entry.js → p-95a3b9b9.entry.js} +1 -1
- package/dist/twilight/{p-c5d1b2e4.entry.js → p-97136699.entry.js} +1 -1
- package/dist/twilight/{p-1485dedd.entry.js → p-9ae3a15c.entry.js} +1 -1
- package/dist/twilight/{p-b4f2f280.entry.js → p-9cbc4733.entry.js} +1 -1
- package/dist/twilight/{p-8e631629.entry.js → p-9e702ebb.entry.js} +1 -1
- package/dist/twilight/p-9ee1e01c.entry.js +4 -0
- package/dist/twilight/{p-66ece3d6.entry.js → p-9f1d1b76.entry.js} +1 -1
- package/dist/twilight/{p-b4d47e7c.entry.js → p-9fdb6380.entry.js} +1 -1
- package/dist/twilight/{p-UxfFm_QX.js → p-B-Q5WD6p.js} +1 -1
- package/dist/twilight/{p-DBnECOny.js → p-B59qdBmY.js} +2 -2
- package/dist/twilight/{p-GwasjFLA.js → p-BdsgfewR.js} +1 -1
- package/dist/twilight/{p-B64o_70M.js → p-Bf2Z6A1M.js} +1 -1
- package/dist/twilight/{p-Bh11vKua.js → p-BlDax_46.js} +1 -1
- package/dist/twilight/{p-0MyCcOKI.js → p-CG1Rwy3q.js} +1 -1
- package/dist/twilight/{p-BK166pHQ.js → p-CMQ7Gxqu.js} +1 -1
- package/dist/twilight/{p-DWqu98fW.js → p-CPqpCDCi.js} +1 -1
- package/dist/twilight/p-D6rFREuQ.js +4 -0
- package/dist/twilight/{p-DrJZdc5M.js → p-DfIHi_xi.js} +1 -1
- package/dist/twilight/{p-87227eb2.entry.js → p-a3eb15e4.entry.js} +1 -1
- package/dist/twilight/{p-ba32a9d2.entry.js → p-a818352a.entry.js} +1 -1
- package/dist/twilight/{p-63cebaef.entry.js → p-a8d6804c.entry.js} +1 -1
- package/dist/twilight/{p-b0a87a8d.entry.js → p-aa71f393.entry.js} +1 -1
- package/dist/twilight/{p-7c2a0a8b.entry.js → p-b017b72e.entry.js} +1 -1
- package/dist/twilight/{p-9a617c41.entry.js → p-b19102f6.entry.js} +1 -1
- package/dist/twilight/{p-5f860460.entry.js → p-b2380c6b.entry.js} +1 -1
- package/dist/twilight/{p-9ae25175.entry.js → p-b452c8a0.entry.js} +1 -1
- package/dist/twilight/{p-7eca6506.entry.js → p-b603a180.entry.js} +1 -1
- package/dist/twilight/{p-ace041b9.entry.js → p-b7b4231f.entry.js} +1 -1
- package/dist/twilight/{p-0c7bdda5.entry.js → p-bc595ee3.entry.js} +1 -1
- package/dist/twilight/{p-56e553e4.entry.js → p-bd3fef37.entry.js} +1 -1
- package/dist/twilight/{p-e4db462b.entry.js → p-bded58cb.entry.js} +1 -1
- package/dist/twilight/{p-26c750c8.entry.js → p-be95b40b.entry.js} +1 -1
- package/dist/twilight/{p-1ad71324.entry.js → p-c0c561b9.entry.js} +1 -1
- package/dist/twilight/{p-1628c63c.entry.js → p-c24f6325.entry.js} +1 -1
- package/dist/twilight/{p-d0847af9.entry.js → p-c31b966f.entry.js} +1 -1
- package/dist/twilight/{p-3eb853f9.entry.js → p-c56725b9.entry.js} +1 -1
- package/dist/twilight/{p-1ce848ab.entry.js → p-c818e0eb.entry.js} +1 -1
- package/dist/twilight/{p-840dd411.entry.js → p-cd51e722.entry.js} +1 -1
- package/dist/twilight/{p-923a35da.entry.js → p-cf21323d.entry.js} +1 -1
- package/dist/twilight/{p-660a552a.entry.js → p-cfac0aa1.entry.js} +1 -1
- package/dist/twilight/{p-a5199e7d.entry.js → p-cfbf287b.entry.js} +1 -1
- package/dist/twilight/{p-49c7dc56.entry.js → p-d2556680.entry.js} +1 -1
- package/dist/twilight/{p-04cc5898.entry.js → p-d2c204f4.entry.js} +1 -1
- package/dist/twilight/{p-177e9071.entry.js → p-d63ca8bb.entry.js} +1 -1
- package/dist/twilight/{p-37b73a97.entry.js → p-d65a6462.entry.js} +1 -1
- package/dist/twilight/{p-b0500232.entry.js → p-dfaf0617.entry.js} +1 -1
- package/dist/twilight/{p-cb02e6db.entry.js → p-e284728d.entry.js} +1 -1
- package/dist/twilight/{p-7ce5c2cd.entry.js → p-e54cc4f8.entry.js} +1 -1
- package/dist/twilight/{p-19b03612.entry.js → p-e8a1c501.entry.js} +1 -1
- package/dist/twilight/{p-e826d3aa.entry.js → p-e8b220e1.entry.js} +1 -1
- package/dist/twilight/{p-a867beee.entry.js → p-ebb73bcc.entry.js} +1 -1
- package/dist/twilight/{p-003648b5.entry.js → p-efa79191.entry.js} +1 -1
- package/dist/twilight/{p-d7e4f0f8.entry.js → p-f1322c8e.entry.js} +1 -1
- package/dist/twilight/{p-a0e8ca67.entry.js → p-f2e5f1fd.entry.js} +1 -1
- package/dist/twilight/{p-602e632c.entry.js → p-f586c239.entry.js} +1 -1
- package/dist/twilight/{p-74c7cc02.entry.js → p-fc587040.entry.js} +1 -1
- package/dist/twilight/{p-BcGXp0zm.js → p-uOF6Cufg.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +10 -0
- package/dist/types/components/salla-applied-filters/salla-applied-filters.d.ts +37 -0
- package/dist/types/components/salla-filters/salla-filters.d.ts +3 -11
- package/dist/types/components.d.ts +17 -0
- package/package.json +5 -5
- package/dist/cjs/interfaces-DZDQwN6-.js +0 -23
- package/dist/esm/interfaces-DL4h2bc3.js +0 -23
- package/dist/twilight/p-3f460184.entry.js +0 -4
- package/dist/twilight/p-DL4h2bc3.js +0 -4
- package/dist/twilight/p-DOBDDG4K.js +0 -4
- package/dist/twilight/p-a7fccb9c.entry.js +0 -4
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { h, Host } from "@stencil/core";
|
|
5
|
+
import { FilterOptionTypes } from "../salla-filters/interfaces";
|
|
6
|
+
import Helper from "../../Helpers/Helper";
|
|
7
|
+
export class SallaAppliedFilters {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.filters = [];
|
|
10
|
+
this.filtersData = {};
|
|
11
|
+
this.clearAllLabel = '';
|
|
12
|
+
this.removeLabel = '';
|
|
13
|
+
this.translationDefaults = {
|
|
14
|
+
'pages.categories.clear_all_filters': { ar: 'إزالة التصفية', en: 'Clear All' },
|
|
15
|
+
'common.elements.delete': { ar: 'حذف', en: 'Delete' },
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async componentWillLoad() {
|
|
19
|
+
salla.event.on('filters::fetched', ({ filters }) => {
|
|
20
|
+
this.filters = Helper.resolveFilterLabels(filters);
|
|
21
|
+
this.syncFiltersDataFromFiltersElement();
|
|
22
|
+
});
|
|
23
|
+
salla.event.on('filters::hidden', () => {
|
|
24
|
+
this.filters = [];
|
|
25
|
+
});
|
|
26
|
+
// The current selections, kept in sync with salla-filters' own state.
|
|
27
|
+
salla.event.on('salla-filters::changed', (filtersData) => {
|
|
28
|
+
this.filtersData = { ...filtersData };
|
|
29
|
+
});
|
|
30
|
+
salla.event.on('salla-filters::reset', () => {
|
|
31
|
+
this.filtersData = {};
|
|
32
|
+
});
|
|
33
|
+
salla.lang.onLoaded(() => {
|
|
34
|
+
this.registerTranslationDefaults();
|
|
35
|
+
this.loadTranslations();
|
|
36
|
+
});
|
|
37
|
+
this.getInitialFiltersData();
|
|
38
|
+
}
|
|
39
|
+
getInitialFiltersData() {
|
|
40
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
41
|
+
this.filtersData = Helper.extractFiltersFromUrl(searchParams);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* salla-filters reconciles its own filtersData synchronously in its `filters::fetched`
|
|
45
|
+
* handler, dropping any key whose filter group no longer exists in the fresh backend
|
|
46
|
+
* response (e.g. a disabled category). Pull that reconciled state instead of keeping our
|
|
47
|
+
* own copy sourced from the raw URL, which would otherwise go stale forever — it's only
|
|
48
|
+
* ever updated by user-driven `salla-filters::changed`/`reset` events, never by a fetch.
|
|
49
|
+
* Deferred a tick so it runs after salla-filters' own (synchronous) listener, regardless
|
|
50
|
+
* of which component happened to register its `filters::fetched` listener first.
|
|
51
|
+
*/
|
|
52
|
+
syncFiltersDataFromFiltersElement() {
|
|
53
|
+
setTimeout(async () => {
|
|
54
|
+
const filtersData = await this.getFiltersElement()?.getFilters();
|
|
55
|
+
if (filtersData) {
|
|
56
|
+
this.filtersData = { ...filtersData };
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Register bilingual (ar/en) defaults for our keys, without overriding any
|
|
62
|
+
* translation that already exists in the store/central translations.
|
|
63
|
+
*/
|
|
64
|
+
registerTranslationDefaults() {
|
|
65
|
+
const missing = Object.entries(this.translationDefaults).reduce((acc, [key, value]) => {
|
|
66
|
+
// `get` returns the key itself when no translation is found.
|
|
67
|
+
if (salla.lang.get(key) === key) {
|
|
68
|
+
acc[key] = value;
|
|
69
|
+
}
|
|
70
|
+
return acc;
|
|
71
|
+
}, {});
|
|
72
|
+
if (Object.keys(missing).length) {
|
|
73
|
+
salla.lang.addBulk(missing);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
loadTranslations() {
|
|
77
|
+
this.clearAllLabel = salla.lang.get('pages.categories.clear_all_filters');
|
|
78
|
+
this.removeLabel = salla.lang.get('common.elements.delete');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Flatten the selected filtersData into displayable chips, resolving the
|
|
82
|
+
* human label for each group + option from `this.filters`. Selections that
|
|
83
|
+
* can't be resolved to a known option (e.g. the auto-added base category)
|
|
84
|
+
* are skipped. Ported from salla-filters, which no longer renders this UI.
|
|
85
|
+
*/
|
|
86
|
+
getAppliedFilters() {
|
|
87
|
+
const chips = [];
|
|
88
|
+
const data = this.filtersData || {};
|
|
89
|
+
for (const key of Object.keys(data)) {
|
|
90
|
+
if (key === 'variants') {
|
|
91
|
+
const variantFilter = this.filters?.find(f => f.type === FilterOptionTypes.VARIANTS);
|
|
92
|
+
for (const variantKey of Object.keys(data.variants || {})) {
|
|
93
|
+
const value = data.variants[variantKey];
|
|
94
|
+
const opt = variantFilter?.values?.find(o => (o.key || o.value) == value);
|
|
95
|
+
if (!opt)
|
|
96
|
+
continue;
|
|
97
|
+
chips.push({
|
|
98
|
+
key,
|
|
99
|
+
variantKey,
|
|
100
|
+
value,
|
|
101
|
+
type: FilterOptionTypes.VARIANTS,
|
|
102
|
+
groupLabel: variantFilter?.label,
|
|
103
|
+
optionLabel: opt.value,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const group = this.filters?.find(f => f.key === key);
|
|
109
|
+
if (!group)
|
|
110
|
+
continue;
|
|
111
|
+
const raw = data[key];
|
|
112
|
+
// RANGE (e.g. price) is stored as a { min, max } object
|
|
113
|
+
if (group.type === FilterOptionTypes.RANGE ||
|
|
114
|
+
(raw && typeof raw === 'object' && !Array.isArray(raw))) {
|
|
115
|
+
const min = raw.min;
|
|
116
|
+
const max = raw.max;
|
|
117
|
+
chips.push({
|
|
118
|
+
key,
|
|
119
|
+
value: raw,
|
|
120
|
+
type: FilterOptionTypes.RANGE,
|
|
121
|
+
groupLabel: group.label,
|
|
122
|
+
optionLabel: `${min} - ${max}`,
|
|
123
|
+
});
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
// the auto-appended base category (see filters::fetched) is page scoping, not a user
|
|
127
|
+
// selection — skip it. It's stored as a scalar; user selections are always arrays.
|
|
128
|
+
if (key === 'category_id' &&
|
|
129
|
+
!Array.isArray(raw) &&
|
|
130
|
+
salla.config.get('page.slug') == 'product.index' &&
|
|
131
|
+
raw == salla.config.get('page.id')) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const values = Array.isArray(raw) ? raw : [raw];
|
|
135
|
+
for (const value of values) {
|
|
136
|
+
// rating values are bare numbers; everything else maps key -> value label
|
|
137
|
+
const opt = group.values?.find(o => (typeof o === 'number' ? o : o.key || o.value) == value);
|
|
138
|
+
const optionLabel = group.key === 'rating'
|
|
139
|
+
? `${value}`
|
|
140
|
+
: opt && typeof opt !== 'number'
|
|
141
|
+
? opt.value
|
|
142
|
+
: undefined;
|
|
143
|
+
if (optionLabel == null)
|
|
144
|
+
continue;
|
|
145
|
+
chips.push({ key, value, type: group.type, groupLabel: group.label, optionLabel });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return chips;
|
|
149
|
+
}
|
|
150
|
+
getFiltersElement() {
|
|
151
|
+
return document.querySelector('salla-filters');
|
|
152
|
+
}
|
|
153
|
+
removeFilter(chip) {
|
|
154
|
+
this.getFiltersElement()?.removeFilter(chip);
|
|
155
|
+
}
|
|
156
|
+
clearAll() {
|
|
157
|
+
this.getFiltersElement()?.resetFilters();
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
const chips = this.getAppliedFilters();
|
|
161
|
+
if (!chips.length) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
return (h(Host, { class: "s-applied-filters-wrapper" }, h("div", { class: "s-applied-filters-tags" }, chips.map(chip => (h("div", { class: "s-applied-filters-tag" }, h("span", { class: "s-applied-filters-tag-name" }, chip.groupLabel, ": ", chip.optionLabel), h("button", { type: "button", class: "s-applied-filters-tag-remove", "aria-label": `${this.removeLabel} ${chip.groupLabel}: ${chip.optionLabel}`, onClick: () => this.removeFilter(chip) }, h("i", { class: "sicon-cancel", "aria-hidden": "true" }))))), h("button", { type: "button", class: "s-applied-filters-clear-tag", onClick: () => this.clearAll() }, h("span", null, this.clearAllLabel)))));
|
|
165
|
+
}
|
|
166
|
+
static get is() { return "salla-applied-filters"; }
|
|
167
|
+
static get originalStyleUrls() {
|
|
168
|
+
return {
|
|
169
|
+
"$": ["salla-applied-filters.scss"]
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
static get styleUrls() {
|
|
173
|
+
return {
|
|
174
|
+
"$": ["salla-applied-filters.css"]
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
static get states() {
|
|
178
|
+
return {
|
|
179
|
+
"filters": {},
|
|
180
|
+
"filtersData": {},
|
|
181
|
+
"clearAllLabel": {},
|
|
182
|
+
"removeLabel": {}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -9,14 +9,6 @@
|
|
|
9
9
|
.s-filters-radio {
|
|
10
10
|
background-image: none !important;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
.s-filters-applied-remove {
|
|
14
|
-
pointer-events: auto !important;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
}
|
|
17
|
-
.outline {
|
|
18
|
-
outline-style: solid;
|
|
19
|
-
}
|
|
20
12
|
.filter {
|
|
21
13
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
|
22
14
|
}
|
|
@@ -100,114 +92,3 @@
|
|
|
100
92
|
.s-filters-footer salla-button button {
|
|
101
93
|
width: 100%;
|
|
102
94
|
}
|
|
103
|
-
.s-filters-applied-item {
|
|
104
|
-
justify-content: space-between;
|
|
105
|
-
}
|
|
106
|
-
.s-filters-applied-remove {
|
|
107
|
-
cursor: pointer;
|
|
108
|
-
border-width: 0px;
|
|
109
|
-
background-color: transparent;
|
|
110
|
-
padding: 0px;
|
|
111
|
-
color: inherit;
|
|
112
|
-
}
|
|
113
|
-
.s-filters-widget-container {
|
|
114
|
-
display: block;
|
|
115
|
-
overflow: hidden;
|
|
116
|
-
border-radius: var(--s-radius, 0.25rem);
|
|
117
|
-
--tw-bg-opacity: 1;
|
|
118
|
-
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
119
|
-
padding-left: 1rem;
|
|
120
|
-
padding-right: 1rem;
|
|
121
|
-
padding-top: 1.25rem;
|
|
122
|
-
padding-bottom: 0.5rem;
|
|
123
|
-
}
|
|
124
|
-
@media (min-width: 768px) {
|
|
125
|
-
|
|
126
|
-
.s-filters-widget-container {
|
|
127
|
-
margin-bottom: 1.25rem;
|
|
128
|
-
padding-bottom: 1.25rem;
|
|
129
|
-
padding-top: 1.25rem;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
.s-filters-widget-content {
|
|
133
|
-
transition-property: all;
|
|
134
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
135
|
-
transition-duration: 300ms;
|
|
136
|
-
}
|
|
137
|
-
.s-filters-widget-opened {
|
|
138
|
-
visibility: visible;
|
|
139
|
-
opacity: 1;
|
|
140
|
-
}
|
|
141
|
-
.s-filters-widget-closed {
|
|
142
|
-
visibility: hidden;
|
|
143
|
-
height: 0px !important;
|
|
144
|
-
padding: 0px;
|
|
145
|
-
opacity: 0;
|
|
146
|
-
}
|
|
147
|
-
.s-filters-widget-title {
|
|
148
|
-
display: flex;
|
|
149
|
-
cursor: pointer;
|
|
150
|
-
align-items: center;
|
|
151
|
-
justify-content: space-between;
|
|
152
|
-
font-size: 1rem;
|
|
153
|
-
line-height: 1.5rem;
|
|
154
|
-
font-weight: 700;
|
|
155
|
-
}
|
|
156
|
-
.s-filters-widget-values {
|
|
157
|
-
overflow: hidden;
|
|
158
|
-
padding-top: 1rem;
|
|
159
|
-
transition-property: all;
|
|
160
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
161
|
-
transition-duration: 300ms;
|
|
162
|
-
}
|
|
163
|
-
.s-filters-widget-plusminus {
|
|
164
|
-
position: relative;
|
|
165
|
-
height: 0.75rem;
|
|
166
|
-
width: 0.75rem;
|
|
167
|
-
--tw-rotate: 90deg;
|
|
168
|
-
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
169
|
-
}
|
|
170
|
-
.s-filters-widget-plusminus::before {
|
|
171
|
-
position: absolute;
|
|
172
|
-
left: 0px;
|
|
173
|
-
top: 50%;
|
|
174
|
-
display: block;
|
|
175
|
-
height: 0.125rem;
|
|
176
|
-
width: 100%;
|
|
177
|
-
--tw-bg-opacity: 1;
|
|
178
|
-
background-color: rgb(153 153 153 / var(--tw-bg-opacity, 1));
|
|
179
|
-
transition-property: 0.35s;
|
|
180
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
181
|
-
transition-duration: 150ms;
|
|
182
|
-
--tw-content: '';
|
|
183
|
-
content: var(--tw-content);
|
|
184
|
-
}
|
|
185
|
-
.s-filters-widget-plusminus::after {
|
|
186
|
-
position: absolute;
|
|
187
|
-
left: 0px;
|
|
188
|
-
top: 50%;
|
|
189
|
-
display: block;
|
|
190
|
-
height: 0.125rem;
|
|
191
|
-
width: 100%;
|
|
192
|
-
--tw-bg-opacity: 1;
|
|
193
|
-
background-color: rgb(153 153 153 / var(--tw-bg-opacity, 1));
|
|
194
|
-
transition-property: 0.35s;
|
|
195
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
196
|
-
transition-duration: 150ms;
|
|
197
|
-
--tw-content: '';
|
|
198
|
-
content: var(--tw-content);
|
|
199
|
-
}
|
|
200
|
-
.s-filters-widget-plusminus-active:before {
|
|
201
|
-
transform: translatey(-50%) rotate(-90deg);
|
|
202
|
-
opacity: 0;
|
|
203
|
-
}
|
|
204
|
-
.s-filters-widget-plusminus-active:after {
|
|
205
|
-
transform: translatey(-50%) rotate(0);
|
|
206
|
-
background-color: var(--color-primary);
|
|
207
|
-
}
|
|
208
|
-
.s-filters-widget-plusminus:before {
|
|
209
|
-
transform: translatey(-50%);
|
|
210
|
-
}
|
|
211
|
-
.s-filters-widget-plusminus:after {
|
|
212
|
-
transform: translatey(-50%) rotate(90deg);
|
|
213
|
-
}
|
|
@@ -9,32 +9,15 @@ export class SallaFilters {
|
|
|
9
9
|
this.isReady = false; //to avoid triggering the changed event
|
|
10
10
|
this.isInitialFetch = true; //the base-category auto-append may only run on the first filters::fetched
|
|
11
11
|
this.filtersData = {};
|
|
12
|
-
this.appliedOpen = true;
|
|
13
12
|
salla.event.on('filters::hidden', () => this.host.style.display = 'none');
|
|
14
13
|
salla.lang.onLoaded(() => {
|
|
15
14
|
this.apply = salla.lang.get('pages.checkout.apply');
|
|
16
|
-
this.reset = salla.lang.get('pages.categories.filters_reset');
|
|
17
|
-
this.selectedTitle = salla.lang.getWithDefault('pages.categories.selected_filters', 'لقد اخترت');
|
|
18
15
|
});
|
|
19
16
|
salla.event.on('filters::fetched', ({ filters }) => {
|
|
20
17
|
this.host.style.display = '';
|
|
21
18
|
let freshFilterData = {};
|
|
22
|
-
this.filters = filters
|
|
19
|
+
this.filters = Helper.resolveFilterLabels(filters)
|
|
23
20
|
.map((filter) => {
|
|
24
|
-
filter.label = {
|
|
25
|
-
category_id: salla.lang.get('common.titles.categories'),
|
|
26
|
-
brand_id: salla.lang.get('common.titles.brands'),
|
|
27
|
-
rating: salla.lang.get('pages.categories.filter_rating'),
|
|
28
|
-
price: salla.lang.get('pages.categories.filter_price'),
|
|
29
|
-
}[filter.key] || filter.label;
|
|
30
|
-
// filter.type = FilterOptionTypes.VALUES;
|
|
31
|
-
if (filter.key == 'rating') {
|
|
32
|
-
filter.type = FilterOptionTypes.VALUES;
|
|
33
|
-
//@ts-ignore
|
|
34
|
-
let { max, min } = filter.values;
|
|
35
|
-
//@ts-ignore
|
|
36
|
-
filter.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max);
|
|
37
|
-
}
|
|
38
21
|
if (this.filtersData.variants && filter.type == FilterOptionTypes.VARIANTS) {
|
|
39
22
|
freshFilterData.variants = this.filtersData.variants;
|
|
40
23
|
}
|
|
@@ -197,57 +180,12 @@ export class SallaFilters {
|
|
|
197
180
|
this.filtersData = { ...this.filtersData }; // reassign so @State re-renders the applied chips
|
|
198
181
|
this.applyFilters();
|
|
199
182
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Flatten the selected filtersData into displayable chips, resolving the
|
|
202
|
-
* human label for each group + option from `this.filters`. Selections that
|
|
203
|
-
* can't be resolved to a known option (e.g. the auto-added base category)
|
|
204
|
-
* are skipped.
|
|
205
|
-
*/
|
|
206
|
-
getAppliedFilters() {
|
|
207
|
-
const chips = [];
|
|
208
|
-
const data = this.filtersData || {};
|
|
209
|
-
for (const key of Object.keys(data)) {
|
|
210
|
-
if (key === 'variants') {
|
|
211
|
-
const variantFilter = this.filters?.find(f => f.type === FilterOptionTypes.VARIANTS);
|
|
212
|
-
for (const variantKey of Object.keys(data.variants || {})) {
|
|
213
|
-
const value = data.variants[variantKey];
|
|
214
|
-
const opt = variantFilter?.values?.find(o => (o.key || o.value) == value);
|
|
215
|
-
if (!opt)
|
|
216
|
-
continue;
|
|
217
|
-
chips.push({ key, variantKey, value, type: FilterOptionTypes.VARIANTS, groupLabel: variantFilter?.label, optionLabel: opt.value });
|
|
218
|
-
}
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
const group = this.filters?.find(f => f.key === key);
|
|
222
|
-
if (!group)
|
|
223
|
-
continue;
|
|
224
|
-
const raw = data[key];
|
|
225
|
-
// RANGE (e.g. price) is stored as a { min, max } object
|
|
226
|
-
if (group.type === FilterOptionTypes.RANGE || (raw && typeof raw === 'object' && !Array.isArray(raw))) {
|
|
227
|
-
chips.push({ key, value: raw, type: FilterOptionTypes.RANGE, groupLabel: group.label, optionLabel: `${raw.min} - ${raw.max}` });
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
// the auto-appended base category (see filters::fetched) is page scoping, not a user
|
|
231
|
-
// selection — skip it. It's stored as a scalar; user selections are always arrays.
|
|
232
|
-
if (key === 'category_id' && !Array.isArray(raw) && salla.config.get('page.slug') == 'product.index' && raw == salla.config.get('page.id')) {
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
const values = Array.isArray(raw) ? raw : [raw];
|
|
236
|
-
for (const value of values) {
|
|
237
|
-
// rating values are bare numbers; everything else maps key -> value label
|
|
238
|
-
const opt = group.values?.find(o => (typeof o === 'number' ? o : (o.key || o.value)) == value);
|
|
239
|
-
const optionLabel = group.key === 'rating' ? `${value}` : (opt && typeof opt !== 'number' ? opt.value : undefined);
|
|
240
|
-
if (optionLabel == null)
|
|
241
|
-
continue;
|
|
242
|
-
chips.push({ key, value, type: group.type, groupLabel: group.label, optionLabel });
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return chips;
|
|
246
|
-
}
|
|
247
183
|
/**
|
|
248
184
|
* Remove a single applied filter — the direct inverse of handleOptionChange.
|
|
185
|
+
* Public so salla-applied-filters (which owns the applied-chips UI) can
|
|
186
|
+
* drive removal on the live salla-filters element it reads chips from.
|
|
249
187
|
*/
|
|
250
|
-
removeFilter(chip) {
|
|
188
|
+
async removeFilter(chip) {
|
|
251
189
|
if (chip.type === FilterOptionTypes.VARIANTS) {
|
|
252
190
|
if (this.filtersData.variants) {
|
|
253
191
|
delete this.filtersData.variants[chip.variantKey];
|
|
@@ -273,9 +211,7 @@ export class SallaFilters {
|
|
|
273
211
|
this.applyFilters();
|
|
274
212
|
}
|
|
275
213
|
render() {
|
|
276
|
-
|
|
277
|
-
const removeText = salla.lang.getWithDefault('common.elements.delete', 'Remove');
|
|
278
|
-
return h(Host, { key: 'f0493d0e85ebb9e6612a1edc6cd7f45e7473017e' }, appliedFilters.length ? h("div", { class: "s-filters-applied s-filters-widget-container" }, h("h3", { class: "s-filters-widget-title", onClick: () => this.appliedOpen = !this.appliedOpen }, h("span", null, this.selectedTitle), h("span", { class: `s-filters-widget-plusminus ${this.appliedOpen ? 's-filters-widget-plusminus-active' : ''}` })), h("div", { class: `s-filters-widget-content ${this.appliedOpen ? 's-filters-widget-opened' : 's-filters-widget-closed'}` }, h("div", { class: "s-filters-widget-values" }, appliedFilters.map(chip => h("div", { class: "s-filters-label s-filters-applied-item" }, h("span", { class: "s-filters-option-name" }, chip.groupLabel, ": ", chip.optionLabel), h("button", { type: "button", class: "s-filters-applied-remove", "aria-label": `${removeText} ${chip.groupLabel}: ${chip.optionLabel}`, onClick: () => this.removeFilter(chip) }, h("i", { class: "sicon-cancel", "aria-hidden": "true" }))))), h("div", { class: "s-filters-footer" }, h("salla-button", { color: 'gray', fill: 'outline', onClick: () => this.resetFilters() }, this.reset)))) : '', this.filters?.map(option => h("salla-filters-widget", { option: option, filtersData: this.filtersData, onChanged: ({ detail: { event, option, value } }) => {
|
|
214
|
+
return h(Host, { key: '32ede23f7fb3d9c7fbcd136ad2773e3212c2f5b8' }, this.filters?.map(option => h("salla-filters-widget", { option: option, filtersData: this.filtersData, onChanged: ({ detail: { event, option, value } }) => {
|
|
279
215
|
this.handleOptionChange(event, option, value);
|
|
280
216
|
} })));
|
|
281
217
|
}
|
|
@@ -325,10 +261,7 @@ export class SallaFilters {
|
|
|
325
261
|
return {
|
|
326
262
|
"isSidebarOpen": {},
|
|
327
263
|
"filtersData": {},
|
|
328
|
-
"apply": {}
|
|
329
|
-
"reset": {},
|
|
330
|
-
"selectedTitle": {},
|
|
331
|
-
"appliedOpen": {}
|
|
264
|
+
"apply": {}
|
|
332
265
|
};
|
|
333
266
|
}
|
|
334
267
|
static get events() {
|
|
@@ -405,6 +338,27 @@ export class SallaFilters {
|
|
|
405
338
|
"text": "Reset selected filters.",
|
|
406
339
|
"tags": []
|
|
407
340
|
}
|
|
341
|
+
},
|
|
342
|
+
"removeFilter": {
|
|
343
|
+
"complexType": {
|
|
344
|
+
"signature": "(chip: any) => Promise<void>",
|
|
345
|
+
"parameters": [{
|
|
346
|
+
"name": "chip",
|
|
347
|
+
"type": "any",
|
|
348
|
+
"docs": ""
|
|
349
|
+
}],
|
|
350
|
+
"references": {
|
|
351
|
+
"Promise": {
|
|
352
|
+
"location": "global",
|
|
353
|
+
"id": "global::Promise"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"return": "Promise<void>"
|
|
357
|
+
},
|
|
358
|
+
"docs": {
|
|
359
|
+
"text": "Remove a single applied filter \u2014 the direct inverse of handleOptionChange.\nPublic so salla-applied-filters (which owns the applied-chips UI) can\ndrive removal on the live salla-filters element it reads chips from.",
|
|
360
|
+
"tags": []
|
|
361
|
+
}
|
|
408
362
|
}
|
|
409
363
|
};
|
|
410
364
|
}
|
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { a as anime } from './anime.es.js';
|
|
5
5
|
|
|
6
|
+
var FilterOptionTypes;
|
|
7
|
+
(function (FilterOptionTypes) {
|
|
8
|
+
// CATEGORIES = "categories",
|
|
9
|
+
// BRANDs = "brands",
|
|
10
|
+
// RATING = "rating",
|
|
11
|
+
// PRICE = "price",
|
|
12
|
+
// RADIO = "radio",
|
|
13
|
+
FilterOptionTypes["VALUES"] = "values";
|
|
14
|
+
FilterOptionTypes["VARIANTS"] = "variants";
|
|
15
|
+
FilterOptionTypes["MINIMUM"] = "minimum";
|
|
16
|
+
FilterOptionTypes["RANGE"] = "range";
|
|
17
|
+
})(FilterOptionTypes || (FilterOptionTypes = {}));
|
|
18
|
+
var FilterOptionInputType;
|
|
19
|
+
(function (FilterOptionInputType) {
|
|
20
|
+
FilterOptionInputType["VALUES"] = "values";
|
|
21
|
+
FilterOptionInputType["VARIANT"] = "variants";
|
|
22
|
+
FilterOptionInputType["RANGE"] = "range";
|
|
23
|
+
})(FilterOptionInputType || (FilterOptionInputType = {}));
|
|
24
|
+
|
|
6
25
|
//TODO::reduce it to 10
|
|
7
26
|
salla.event.setMaxListeners(100);
|
|
8
27
|
class Helper {
|
|
@@ -139,6 +158,33 @@ class Helper {
|
|
|
139
158
|
});
|
|
140
159
|
return filters;
|
|
141
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Resolve i18n labels for the known filter groups (category/brand/rating/price)
|
|
163
|
+
* and normalize the `rating` group's `{min,max}` values into a plain 1-5 star
|
|
164
|
+
* array. Shared by salla-filters (the filter panel) and salla-applied-filters
|
|
165
|
+
* (the applied chips) so both agree on the same group labels. Returns shallow
|
|
166
|
+
* copies rather than mutating in place, since both components receive the
|
|
167
|
+
* same `filters::fetched` payload by reference.
|
|
168
|
+
*/
|
|
169
|
+
resolveFilterLabels(filters) {
|
|
170
|
+
return filters.map((filter) => {
|
|
171
|
+
const resolved = { ...filter };
|
|
172
|
+
resolved.label = {
|
|
173
|
+
category_id: salla.lang.get('common.titles.categories'),
|
|
174
|
+
brand_id: salla.lang.get('common.titles.brands'),
|
|
175
|
+
rating: salla.lang.get('pages.categories.filter_rating'),
|
|
176
|
+
price: salla.lang.get('pages.categories.filter_price'),
|
|
177
|
+
}[resolved.key] || resolved.label;
|
|
178
|
+
if (resolved.key == 'rating') {
|
|
179
|
+
resolved.type = FilterOptionTypes.VALUES;
|
|
180
|
+
//@ts-ignore
|
|
181
|
+
const { max, min } = filter.values;
|
|
182
|
+
//@ts-ignore
|
|
183
|
+
resolved.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max);
|
|
184
|
+
}
|
|
185
|
+
return resolved;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
142
188
|
async injectExtraFieldsToResponse(response) {
|
|
143
189
|
if (!response || !this.includes)
|
|
144
190
|
return response;
|
|
@@ -472,4 +518,4 @@ class Helper {
|
|
|
472
518
|
}
|
|
473
519
|
var Helper$1 = new Helper;
|
|
474
520
|
|
|
475
|
-
export { Helper$1 as H };
|
|
521
|
+
export { FilterOptionTypes as F, Helper$1 as H };
|