Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add dropdown version of Filter by Rating #7771

Merged
merged 38 commits into from
Dec 13, 2022
Merged

Conversation

kmanijak
Copy link
Contributor

@kmanijak kmanijak commented Nov 28, 2022

Main changes:

  • add dropdown version to the Filter by Rating
  • add option for multiple or single choice to align with Filter by Attribute

Minor changes:

  • alignment between Filter by Attribute and Rating:
    • Editor settings options: wording and settings order
    • selected options have the same styling
  • Dropdown has rounder border, previously there was little gaps on the corners

Important notice: to be able to provide to the dropdown (FormTokenField component from Gutenberg) the options more complex than a string, a bit hacky solution has been introduced. displayTransform is a place where string value is transformed into what is presented to the user. In this PR JSX element is returned (check here). That solution may stop to work in case of Gutenberg update.

Also, seems like this may have a consequence on the built-int accessibility mechanism. There's messages prop passed to the FormTokenField, which includes messages that are read in case thee filter is added/removed. That seems to not work in here, which may be an obstacle to go with that solution.

Fixes #7769 #7882

Accessibility

  • I've tested using only a keyboard (no mouse)
  • I've tested using a screen reader

Known problem:

  • Screen Reader doesn't read when filter is added/removed.

Screenshots

Watch the video of Dropdown component usage:

filter-byrating.mov
Case Before After
Filter by Rating Editor settings Screen Shot 2022-12-02 at 14 39 20 PM Screen Shot 2022-12-02 at 14 36 25 PM
Dropdown borders Screen Shot 2022-12-02 at 14 39 05 PM Screen Shot 2022-12-02 at 14 37 22 PM

Testing

Automated Tests

  • Changes in this PR are covered by Automated Tests.
    • Unit tests
    • E2E tests - single one

User Facing Testing

Check out the video above which will help you go through the testing instructions

Prerequisites:

  1. Have at least few products with some ratings
  2. Go to Editor
  3. Add Filters pattern
  4. Add All Products
Dropdown component - single
  1. Change settings of Filter by Rating to: single / dropdown
  2. Open dropdown
  • Expected: dropdown has rating options to choose from
  1. Choose one option
  • Expected: page refreshes, filter is applied: visible in Active Filters and Products are filtered out
  1. Choose other option
  • Expected: previous filter is replaced by the new one, page refreshes, filter is applied: visible in Active Filters and Products are filtered out
Dropdown component - multiple
  1. Change settings of Filter by Rating to: multiple / dropdown
  2. Open dropdown
  • Expected: dropdown has rating options to choose from
  1. Choose one option
  • Expected: page refreshes, filter is applied: visible in Active Filters and Products are filtered out
  1. Choose other option
  • Expected: new filter is added to the new one, page refreshes, both filters ("or") is applied: visible in Active Filters and Products are filtered out
List component
  1. Change settings of Filter by Rating to: list
  2. Repeat the above for both: single and multiple
Apply button
  1. In the Editor choose multiple Dropdown again and enable "Show 'Apply filters' button" option
  2. In the frontend choose rating filters
  • Expected: filters are not applied until "Apply" button is clicked. Once clicked page refreshes and filters are applied
Other scenarios

Try to break it! 😉

WooCommerce Visibility

  • WooCommerce Core
  • Feature plugin
  • Experimental

Changelog

Filter by Rating: Add dropdown version.
Filter by Rating: Add option to choose multiple or single option.
Filters: Fix the little gaps on the border corners in the filters Dropdown version.

@github-actions
Copy link
Contributor

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-7771.zip

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2022

Size Change: +8.76 kB (+1%)

Total Size: 992 kB

Filename Size Change
build/active-filters-frontend.js 7.74 kB +4 B (0%)
build/active-filters-wrapper-frontend.js 6.02 kB +12 B (0%)
build/active-filters.js 7.32 kB +2 B (0%)
build/all-products-frontend.js 11.3 kB +13 B (0%)
build/all-products.js 33.2 kB +18 B (0%)
build/all-reviews.js 7.79 kB -3 B (0%)
build/attribute-filter-frontend.js 22.6 kB -27 B (0%)
build/attribute-filter-wrapper-frontend.js 7.2 kB +29 B (0%)
build/attribute-filter.js 12.3 kB +15 B (0%)
build/cart-blocks/cart-accepted-payment-methods-frontend.js 1.37 kB -2 B (0%)
build/cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 5.47 kB -7 B (0%)
build/cart-blocks/cart-cross-sells-products-frontend.js 4.78 kB +3 B (0%)
build/cart-blocks/cart-express-payment--checkout-blocks/express-payment-frontend.js 5.04 kB -1 B (0%)
build/cart-blocks/cart-express-payment-frontend.js 778 B -1 B (0%)
build/cart-blocks/cart-items-frontend.js 298 B -1 B (0%)
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js 5.28 kB -3 B (0%)
build/cart-blocks/cart-order-summary-frontend.js 1.23 kB +1 B (0%)
build/cart-blocks/cart-totals-frontend.js 320 B +1 B (0%)
build/cart-blocks/filled-cart-frontend.js 785 B +2 B (0%)
build/cart-blocks/order-summary-coupon-form-frontend.js 1.73 kB +2 B (0%)
build/cart-blocks/order-summary-discount-frontend.js 2.16 kB -1 B (0%)
build/cart-blocks/order-summary-fee-frontend.js 272 B -1 B (0%)
build/cart-blocks/order-summary-shipping-frontend.js 5.98 kB -2 B (0%)
build/cart-blocks/order-summary-subtotal-frontend.js 273 B -1 B (0%)
build/cart-blocks/order-summary-taxes-frontend.js 434 B -1 B (0%)
build/cart-blocks/proceed-to-checkout-frontend.js 1.19 kB -3 B (0%)
build/cart-frontend.js 46.2 kB -14 B (0%)
build/cart.js 46.4 kB -7 B (0%)
build/checkout-blocks/actions-frontend.js 1.77 kB -1 B (0%)
build/checkout-blocks/billing-address--checkout-blocks/shipping-address-frontend.js 3.89 kB -2 B (0%)
build/checkout-blocks/contact-information-frontend.js 1.86 kB -2 B (0%)
build/checkout-blocks/express-payment-frontend.js 1.13 kB +1 B (0%)
build/checkout-blocks/fields-frontend.js 344 B +1 B (0%)
build/checkout-blocks/order-summary-cart-items-frontend.js 3.67 kB +3 B (0%)
build/checkout-blocks/order-summary-coupon-form-frontend.js 1.89 kB +2 B (0%)
build/checkout-blocks/order-summary-discount-frontend.js 2.28 kB -1 B (0%)
build/checkout-blocks/order-summary-fee-frontend.js 275 B -1 B (0%)
build/checkout-blocks/order-summary-shipping-frontend.js 6.03 kB -6 B (0%)
build/checkout-blocks/order-summary-taxes-frontend.js 434 B -1 B (0%)
build/checkout-blocks/payment-frontend.js 8.32 kB +5 B (0%)
build/checkout-blocks/shipping-address-frontend.js 1.07 kB -1 B (0%)
build/checkout-blocks/shipping-methods-frontend.js 5.01 kB -5 B (0%)
build/checkout-blocks/terms-frontend.js 1.63 kB +1 B (0%)
build/checkout-blocks/totals-frontend.js 324 B -1 B (0%)
build/checkout-frontend.js 48.3 kB -21 B (0%)
build/checkout.js 40.6 kB -1 B (0%)
build/featured-category.js 13.2 kB -5 B (0%)
build/featured-product.js 13.4 kB -3 B (0%)
build/filter-wrapper-frontend.js 13.8 kB -8 B (0%)
build/filter-wrapper.js 2.4 kB -2 B (0%)
build/handpicked-products.js 7.29 kB +1 B (0%)
build/mini-cart-component-frontend.js 20 kB +16 B (0%)
build/mini-cart-contents-block/footer-frontend.js 2.95 kB +2 B (0%)
build/mini-cart-contents-block/items-frontend.js 238 B +1 B (0%)
build/mini-cart-contents-block/products-table-frontend.js 591 B +1 B (0%)
build/mini-cart-contents-block/shopping-button-frontend.js 289 B +1 B (0%)
build/mini-cart-contents-block/title-frontend.js 368 B +1 B (0%)
build/mini-cart-contents.js 17.1 kB -3 B (0%)
build/mini-cart-frontend.js 1.88 kB -1 B (0%)
build/mini-cart.js 4.29 kB +1 B (0%)
build/price-filter-wrapper-frontend.js 7.02 kB +4 B (0%)
build/price-filter.js 8.38 kB -10 B (0%)
build/product-add-to-cart-frontend.js 1.47 kB +6 B (0%)
build/product-add-to-cart.js 8.37 kB +1 B (0%)
build/product-best-sellers.js 7.62 kB -1 B (0%)
build/product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01.js 440 B +2 B (0%)
build/product-button-frontend.js 2.18 kB +8 B (0%)
build/product-button.js 3.85 kB +1 B (0%)
build/product-categories.js 2.36 kB -1 B (0%)
build/product-category-list-frontend.js 1.14 kB +2 B (0%)
build/product-category-list.js 502 B -1 B (0%)
build/product-image.js 3.93 kB +4 B (0%)
build/product-new.js 7.62 kB -3 B (0%)
build/product-on-sale.js 7.95 kB -5 B (0%)
build/product-price-frontend.js 2.17 kB +4 B (0%)
build/product-query.js 5.91 kB +3 B (0%)
build/product-rating-frontend.js 1.48 kB +5 B (0%)
build/product-sale-badge-frontend.js 1.39 kB +4 B (0%)
build/product-sale-badge.js 813 B +2 B (0%)
build/product-search.js 2.62 kB +4 B (0%)
build/product-sku.js 376 B -1 B (0%)
build/product-stock-indicator.js 646 B +2 B (0%)
build/product-summary-frontend.js 1.53 kB +5 B (0%)
build/product-summary.js 918 B -2 B (0%)
build/product-tag-list-frontend.js 1.14 kB +4 B (0%)
build/product-tag.js 8 kB +4 B (0%)
build/product-title-frontend.js 1.59 kB +9 B (+1%)
build/product-title.js 3.3 kB +2 B (0%)
build/product-top-rated.js 7.86 kB +1 B (0%)
build/products-by-attribute.js 8.54 kB -1 B (0%)
build/rating-filter-frontend.js 21.1 kB +7 kB (+50%) 🆘
build/rating-filter-wrapper-frontend.js 5.73 kB -307 B (-5%)
build/rating-filter.js 7.41 kB +1.43 kB (+24%) 🚨
build/reviews-by-category.js 11.2 kB +1 B (0%)
build/reviews-by-product.js 12.3 kB +5 B (0%)
build/reviews-frontend.js 7.01 kB -4 B (0%)
build/single-product-frontend.js 17.5 kB -3 B (0%)
build/single-product.js 10.1 kB -3 B (0%)
build/stock-filter-frontend.js 7.79 kB -6 B (0%)
build/stock-filter-wrapper-frontend.js 6.03 kB -4 B (0%)
build/stock-filter.js 6.71 kB -4 B (0%)
build/vendors--attribute-filter-wrapper--mini-cart-contents-block/footer--product-add-to-cart--rating-fil--b47816ec-frontend.js 6.86 kB -1 B (0%)
build/vendors--attribute-filter-wrapper-frontend.js 0 B -8.21 kB (removed) 🏆
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/order-summary-shipping--checkout-blocks--18f9376a-frontend.js 19.1 kB +2 B (0%)
build/vendors--cart-blocks/cart-cross-sells-products--product-add-to-cart-frontend.js 7.54 kB +2 B (0%)
build/vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542-frontend.js 3.14 kB +1 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b-frontend.js 4.85 kB -2 B (0%)
build/vendors--cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping--checkout-block--dda5866c-frontend.js 8.85 kB +2 B (0%)
build/wc-blocks-style-rtl.css 24.3 kB +100 B (0%)
build/wc-blocks-style.css 24.3 kB +100 B (0%)
build/wc-blocks-vendors.js 62.8 kB +406 B (+1%)
build/wc-blocks.js 2.63 kB -2 B (0%)
build/vendors--attribute-filter-wrapper--rating-filter-wrapper-frontend.js 8.21 kB +8.21 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size
build/blocks-checkout.js 27.3 kB
build/cart-blocks/cart-cross-sells-frontend.js 253 B
build/cart-blocks/cart-line-items-frontend.js 1.07 kB
build/cart-blocks/empty-cart-frontend.js 346 B
build/cart-blocks/order-summary-heading-frontend.js 455 B
build/checkout-blocks/billing-address-frontend.js 1.09 kB
build/checkout-blocks/order-note-frontend.js 1.14 kB
build/checkout-blocks/order-summary-frontend.js 1.24 kB
build/checkout-blocks/order-summary-subtotal-frontend.js 273 B
build/general-style-rtl.css 1.29 kB
build/general-style.css 1.29 kB
build/legacy-template.js 2.86 kB
build/mini-cart-contents-block/empty-cart-frontend.js 366 B
build/mini-cart-contents-block/filled-cart-frontend.js 230 B
build/price-filter-frontend.js 13.6 kB
build/price-format.js 1.19 kB
build/product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00.js 226 B
build/product-add-to-cart--product-button--product-image--product-rating--product-title.js 151 B
build/product-button--product-image--product-rating--product-sale-badge--product-title.js 301 B
build/product-category.js 8.61 kB
build/product-image-frontend.js 2.16 kB
build/product-price.js 1.54 kB
build/product-rating.js 816 B
build/product-sku-frontend.js 629 B
build/product-stock-indicator-frontend.js 1.26 kB
build/product-tag-list.js 497 B
build/vendors--cart-blocks/cart-cross-sells-products--cart-blocks/cart-line-items--cart-blocks/cart-order--671ca56f-frontend.js 5.26 kB
build/wc-blocks-data.js 18.8 kB
build/wc-blocks-editor-style-rtl.css 5.22 kB
build/wc-blocks-editor-style.css 5.23 kB
build/wc-blocks-google-analytics.js 1.56 kB
build/wc-blocks-middleware.js 934 B
build/wc-blocks-registry.js 2.92 kB
build/wc-blocks-shared-context.js 1.52 kB
build/wc-blocks-shared-hocs.js 1.72 kB
build/wc-blocks-vendors-style-rtl.css 1.95 kB
build/wc-blocks-vendors-style.css 1.95 kB
build/wc-payment-method-bacs.js 816 B
build/wc-payment-method-cheque.js 811 B
build/wc-payment-method-cod.js 909 B
build/wc-payment-method-paypal.js 837 B
build/wc-settings.js 2.6 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2022

TypeScript Errors Report

Files with errors: 433
Total errors: 2093

⚠️ ⚠️ This PR introduces new TS errors on 3 files:

assets/js/blocks/rating-filter/block.tsx

assets/js/blocks/rating-filter/edit.tsx

assets/js/blocks/rating-filter/test/block.tsx

@github-actions
Copy link
Contributor

handle updateCheckedFilters function

handle updateCheckedFilters function


// TODO handle updateCheckedFilters function
const onChange = useCallback(
( checkedValue ) => {
const previouslyChecked = checked.includes( checkedValue );
let newChecked;
if ( ! multiple ) {
newChecked = previouslyChecked ? [] : [ checkedValue ];
} else {
newChecked = checked.filter(
( value ) => value !== checkedValue
);

🚀 This comment was generated by the automations bot based on a todo comment in c6712d4 in #7771. cc @kmanijak

@github-actions
Copy link
Contributor

github-actions bot commented Nov 29, 2022

Script Dependencies Report

The compare-assets action has detected some changed script dependencies between this branch and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Removed
rating-filter.js wp-keycodes ⚠️

This comment was automatically generated by the ./github/compare-assets action.

@kmanijak kmanijak force-pushed the add/filter-by-rating-dropdown branch from fbb5fa6 to 418a99f Compare December 2, 2022 12:49
@kmanijak kmanijak marked this pull request as ready for review December 2, 2022 14:00
@rubikuserbot rubikuserbot requested review from a team and Aljullu and removed request for a team December 2, 2022 14:00
Copy link
Contributor

@Aljullu Aljullu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm, thanks @kmanijak!

I'm pre-approving, but I left a couple of comments that I think should be adressed before merging:

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed for this PR, but I wonder if at some point we should create a filters directory under assets/js/blocks/. That would make it easier to share styles and logic between them, like this one. Similar to what was done with Featured Product and Featured Category, which have a common folder (featured-items).

Copy link
Contributor Author

@kmanijak kmanijak Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a assets/js/blocks/shared/styles/style.css file (and added a mixin dedicated to filters), but in the near future we should make a dedicated path (assets/js/blocks/filters/*) with shared JS and SCSS code. There's too much code overlap between three filters to not combine it 😆 The issue is already created: #7875 and that's definitely the direction we should follow.

Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then
…stead of sentence capitalization

Not knowing what may be attribute, there may be a case first capital letter will be expected
…ters

Instead of using direct classes, rewrite it to mixin and include in the filters
@kmanijak
Copy link
Contributor Author

kmanijak commented Dec 9, 2022

Thank you for a great review @Aljullu! 🎉

I'm pre-approving, but I left a couple of comments that I think should be adressed before merging:

Great, both comments addressed.

PS. Good catch with the capitalization!

ie: if the attribute is "CD style" we wouldn't want to lowercase it to Select "cd style"

@kmanijak
Copy link
Contributor Author

kmanijak commented Dec 9, 2022

Thank you for a great review @Aljullu! 🎉

I'm pre-approving, but I left a couple of comments that I think should be adressed before merging:

Great, both comments addressed.

PS. Good catch with the capitalization!

ie: if the attribute is "CD style" we wouldn't want to lowercase it to Select "cd style"

@Aljullu Aljullu added this to the 9.1.1 milestone Dec 12, 2022
Copy link
Contributor

@gigitux gigitux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested only the feature and I didn't review the code.

I didn't find any issue! Nice work! LGTM!

@github-actions
Copy link
Contributor

The release ZIP for this PR is accessible via:

https://wcblocks.wpcomstaging.com/wp-content/uploads/woocommerce-gutenberg-products-block-7771.zip

@kmanijak kmanijak merged commit 493766d into trunk Dec 13, 2022
@kmanijak kmanijak deleted the add/filter-by-rating-dropdown branch December 13, 2022 08:12
kmanijak added a commit that referenced this pull request Dec 13, 2022
… was set to single

The fix was provided with another PR #7771 and had to be resued here
@danieldudzic danieldudzic added block: filter by rating Issues related to the Filter by Rating block. type: enhancement The issue is a request for an enhancement. labels Dec 14, 2022
gigitux added a commit that referenced this pull request Dec 14, 2022
* Rename the setting section to match Filter by Attribute

* Add Display Style toggle to the block settings

* Set list as a default value of displayStyle for Filter by Rating

* Add dropdown variant of Filter by Rating

* Extend the Editor settings with selectType: single or multiple

* Adjust the styles of a FormTokenField to other dropdown

* Align Editor settings order and wording between Filter by Attribute and Rating

* Fix the issue with cut off corners of dropdown borders

* Provide translated screen reader messages and placeholder

* Revert the label property, which is necessary to display checkbox list

* Make classname for Rating component optional and remove styling in Filter by Rating

* Cover the case when filter with zero products needs string methods for comparison

* Handle Typescript errors and add ts-ignore annotations when necessary

* Remove explicit key prop assignment in Rating component

* Remove leftover property in type definition

* Refactor JSX element extension with custom properties to more robust way with object copy

* Filter by rating tests (#7845)

* Filter by Rating tests:
  - List single
  - List multiple
  - Dropdown single
  - Dropdown multiple

* Adjust the font-size of Filter by Rating dropdown to the rest of the filters

* Fix E2E tests after the Editor settings label has been changed

* Improve sorting in Filter by Rating dropdown

With this change the order of options is always descending: in the chips, suggestions, active filters and URL

* Change the name of the filter blocks in the test files

* Prevent single dropdown input to overflow the wrapper

The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css

* Remove the unused styles of active options in Filter by Rating

Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then

* Change the approach of shared styles to fix the dropdown issue in filters

Instead of using direct classes, rewrite it to mixin and include in the filters

* Fix the Filter by Rating with Products block

The problem was with the Products block, that there was incorrect initial value of product ratings query

* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock

Co-authored-by: Luigi Teschio <[email protected]>
gigitux added a commit that referenced this pull request Dec 15, 2022
* Empty commit for release pull request

* Update the readme file with 9.1.1 release changes

* Product Query: Add `Sorted by title` preset. (#7949)

* Add `Sort by title` preset.

* sorted, thanks @nerrad

* Update the readme file with #7949 changes

* 9.1.1 Release: Add testing docs

* Atomic Block: fix ancestor definition (#7947)

* Fix the incorrect layout of Rating and Price in Classic Template and Products block (#7932)

* Fix the incorrect layout of Rating and Price in Classic Template

There were styles required in Rating Filter that were added globally and influenced the layout of Rating in Products block as well as Classic template. The styles were moved to the Rating Filter block

* Add dropdown version of Filter by Stock Status (#7831)

* Extend Filter by Stock Editor options with dropdown and single/multiple choice

* Add dropdown implementation for Filter by Stock Status

* Adjust font-sizes to the rest of the filters

* Add tests to Filter by Stock: dropdown and list variants

* Change test file extension from .js to .tsx, so it handles types as well

* Add E2E test to Filter by Stock checking if display style can be toggled

* When typing in Filter by Stock dropdown, handle the space so it highlights the suggestions

* Change the name of the filter blocks in the test files

* Remove unnecessary waiting step in E2E test for Filter by Stock

toMatchElement waits for an element for 30s by itself, hence waitForSelector usage was removed

* Improve the STOCK_STATUS_OPTIONS type handling

* Extract onDropdownChange function instead of inline arrow function

* Fix overlaping dropdown content with the wrapper when Filter by Stock was set to single

* Product Query: Add patterns (#7857)

* Product Query: First attempt at adding patterns

* Product Query: Update patterns and the default block template

* Product Query: And new and update existing patterns

* Product Query: Adjust layout of the Minimal Product Row pattern

* Product Query: Update pattern names

* Product Query: Polish spaces between blocks inside the patterns

* Product Query patterns: Link product titles and improve spacing between product elements

* Product Query patterns: Button font-size update

* Product Query patterns: Center the pagination

* Product Query patterns: Center the pagination for the default pattern

* Product Query patterns: Remove an empty column

* Product Query patterns: Remove an empty column from the product list with 1:1 images pattern

* Add dropdown version of Filter by Rating (#7771)

* Rename the setting section to match Filter by Attribute

* Add Display Style toggle to the block settings

* Set list as a default value of displayStyle for Filter by Rating

* Add dropdown variant of Filter by Rating

* Extend the Editor settings with selectType: single or multiple

* Adjust the styles of a FormTokenField to other dropdown

* Align Editor settings order and wording between Filter by Attribute and Rating

* Fix the issue with cut off corners of dropdown borders

* Provide translated screen reader messages and placeholder

* Revert the label property, which is necessary to display checkbox list

* Make classname for Rating component optional and remove styling in Filter by Rating

* Cover the case when filter with zero products needs string methods for comparison

* Handle Typescript errors and add ts-ignore annotations when necessary

* Remove explicit key prop assignment in Rating component

* Remove leftover property in type definition

* Refactor JSX element extension with custom properties to more robust way with object copy

* Filter by rating tests (#7845)

* Filter by Rating tests:
  - List single
  - List multiple
  - Dropdown single
  - Dropdown multiple

* Adjust the font-size of Filter by Rating dropdown to the rest of the filters

* Fix E2E tests after the Editor settings label has been changed

* Improve sorting in Filter by Rating dropdown

With this change the order of options is always descending: in the chips, suggestions, active filters and URL

* Change the name of the filter blocks in the test files

* Prevent single dropdown input to overflow the wrapper

The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css

* Remove the unused styles of active options in Filter by Rating

Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then

* Change the approach of shared styles to fix the dropdown issue in filters

Instead of using direct classes, rewrite it to mixin and include in the filters

* Fix the Filter by Rating with Products block

The problem was with the Products block, that there was incorrect initial value of product ratings query

* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock

Co-authored-by: Luigi Teschio <[email protected]>

* Product Query - Enable "Inherit Query from template" option (#7641)

* Add Inherit Query from template option

* Update label

* Product Elements: Fix block settings (#7914)

* Product Elements: Fix block settings

* Rating: Fix inactive star color

* Product Rating: Fix color inheritance

* StyleAttributesUtils: Fix PHP notices and invalid CSS output (#7909)

* StyleAttributesUtils: Fix PHP notices and invalid CSS output. Closes #7899.

* StyleAttributesUtils: Fix border radius and width support

* StyleAttributesUtils: Fix border radius and border color support

* StyleAttributesUtils: Include additional checks to deal with PHP warnings

* StyleAttributesUtils: Improve the custom border array check

* Update MiniCart.php to fix price total amount on page load prices are including tax (#7832)

* Update MiniCart.php

Added an update to the '$cart_contents_total' variable on the 'get_cart_price_markup' function if $cart->display_prices_including_tax is active. Currently displaying wrong amount total on page load if items are already in the basket.

* Update MiniCart.php

Removed white spaces?

* Update MiniCart.php

Fixed IF statement

* Remove whitespace at end of line

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Product Query: implement compatibility with Filter by Rating block (#7792)

* Product Query: implement compatibility with Filter by Rating block #7631

Product Query: implement compatibility with Filter by Rating block

* address feedback

* address feedback

* add comment

* add new zip file link

* add missing class

* add testing instructions about #7947

* add new zip file link

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Bumping version strings to new version.

Co-authored-by: github-actions <[email protected]>
Co-authored-by: Daniel Dudzic <[email protected]>
Co-authored-by: Tung Du <[email protected]>
Co-authored-by: Luigi Teschio <[email protected]>
Co-authored-by: kmanijak <[email protected]>
Co-authored-by: Luke O'Regan <[email protected]>
Co-authored-by: Albert Juhé Lluveras <[email protected]>
gigitux added a commit that referenced this pull request Dec 21, 2022
* Empty commit for release pull request

* Update the readme file with 9.1.1 release changes

* Product Query: Add `Sorted by title` preset. (#7949)

* Add `Sort by title` preset.

* sorted, thanks @nerrad

* Update the readme file with #7949 changes

* 9.1.1 Release: Add testing docs

* Atomic Block: fix ancestor definition (#7947)

* Fix the incorrect layout of Rating and Price in Classic Template and Products block (#7932)

* Fix the incorrect layout of Rating and Price in Classic Template

There were styles required in Rating Filter that were added globally and influenced the layout of Rating in Products block as well as Classic template. The styles were moved to the Rating Filter block

* Add dropdown version of Filter by Stock Status (#7831)

* Extend Filter by Stock Editor options with dropdown and single/multiple choice

* Add dropdown implementation for Filter by Stock Status

* Adjust font-sizes to the rest of the filters

* Add tests to Filter by Stock: dropdown and list variants

* Change test file extension from .js to .tsx, so it handles types as well

* Add E2E test to Filter by Stock checking if display style can be toggled

* When typing in Filter by Stock dropdown, handle the space so it highlights the suggestions

* Change the name of the filter blocks in the test files

* Remove unnecessary waiting step in E2E test for Filter by Stock

toMatchElement waits for an element for 30s by itself, hence waitForSelector usage was removed

* Improve the STOCK_STATUS_OPTIONS type handling

* Extract onDropdownChange function instead of inline arrow function

* Fix overlaping dropdown content with the wrapper when Filter by Stock was set to single

* Product Query: Add patterns (#7857)

* Product Query: First attempt at adding patterns

* Product Query: Update patterns and the default block template

* Product Query: And new and update existing patterns

* Product Query: Adjust layout of the Minimal Product Row pattern

* Product Query: Update pattern names

* Product Query: Polish spaces between blocks inside the patterns

* Product Query patterns: Link product titles and improve spacing between product elements

* Product Query patterns: Button font-size update

* Product Query patterns: Center the pagination

* Product Query patterns: Center the pagination for the default pattern

* Product Query patterns: Remove an empty column

* Product Query patterns: Remove an empty column from the product list with 1:1 images pattern

* Add dropdown version of Filter by Rating (#7771)

* Rename the setting section to match Filter by Attribute

* Add Display Style toggle to the block settings

* Set list as a default value of displayStyle for Filter by Rating

* Add dropdown variant of Filter by Rating

* Extend the Editor settings with selectType: single or multiple

* Adjust the styles of a FormTokenField to other dropdown

* Align Editor settings order and wording between Filter by Attribute and Rating

* Fix the issue with cut off corners of dropdown borders

* Provide translated screen reader messages and placeholder

* Revert the label property, which is necessary to display checkbox list

* Make classname for Rating component optional and remove styling in Filter by Rating

* Cover the case when filter with zero products needs string methods for comparison

* Handle Typescript errors and add ts-ignore annotations when necessary

* Remove explicit key prop assignment in Rating component

* Remove leftover property in type definition

* Refactor JSX element extension with custom properties to more robust way with object copy

* Filter by rating tests (#7845)

* Filter by Rating tests:
  - List single
  - List multiple
  - Dropdown single
  - Dropdown multiple

* Adjust the font-size of Filter by Rating dropdown to the rest of the filters

* Fix E2E tests after the Editor settings label has been changed

* Improve sorting in Filter by Rating dropdown

With this change the order of options is always descending: in the chips, suggestions, active filters and URL

* Change the name of the filter blocks in the test files

* Prevent single dropdown input to overflow the wrapper

The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css

* Remove the unused styles of active options in Filter by Rating

Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then

* Change the approach of shared styles to fix the dropdown issue in filters

Instead of using direct classes, rewrite it to mixin and include in the filters

* Fix the Filter by Rating with Products block

The problem was with the Products block, that there was incorrect initial value of product ratings query

* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock

Co-authored-by: Luigi Teschio <[email protected]>

* Product Query - Enable "Inherit Query from template" option (#7641)

* Add Inherit Query from template option

* Update label

* Product Elements: Fix block settings (#7914)

* Product Elements: Fix block settings

* Rating: Fix inactive star color

* Product Rating: Fix color inheritance

* StyleAttributesUtils: Fix PHP notices and invalid CSS output (#7909)

* StyleAttributesUtils: Fix PHP notices and invalid CSS output. Closes #7899.

* StyleAttributesUtils: Fix border radius and width support

* StyleAttributesUtils: Fix border radius and border color support

* StyleAttributesUtils: Include additional checks to deal with PHP warnings

* StyleAttributesUtils: Improve the custom border array check

* Update MiniCart.php to fix price total amount on page load prices are including tax (#7832)

* Update MiniCart.php

Added an update to the '$cart_contents_total' variable on the 'get_cart_price_markup' function if $cart->display_prices_including_tax is active. Currently displaying wrong amount total on page load if items are already in the basket.

* Update MiniCart.php

Removed white spaces?

* Update MiniCart.php

Fixed IF statement

* Remove whitespace at end of line

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Product Query: implement compatibility with Filter by Rating block (#7792)

* Product Query: implement compatibility with Filter by Rating block #7631

Product Query: implement compatibility with Filter by Rating block

* address feedback

* address feedback

* add comment

* add new zip file link

* add missing class

* add testing instructions about #7947

* add new zip file link

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Bumping version strings to new version.

* Remove feature flag from Products block (#8001)

* Remove feature flag from Products block

* Remove Products block from feature flags documentation

* Empty commit for release pull request

* Update changelog

* Add zip file link

* Bumping version strings to new version.

Co-authored-by: github-actions <[email protected]>
Co-authored-by: Daniel Dudzic <[email protected]>
Co-authored-by: Tung Du <[email protected]>
Co-authored-by: Luigi Teschio <[email protected]>
Co-authored-by: kmanijak <[email protected]>
Co-authored-by: Luke O'Regan <[email protected]>
Co-authored-by: Albert Juhé Lluveras <[email protected]>
gigitux added a commit that referenced this pull request Dec 22, 2022
* Empty commit for release pull request

* Update the readme file with 9.1.1 release changes

* Product Query: Add `Sorted by title` preset. (#7949)

* Add `Sort by title` preset.

* sorted, thanks @nerrad

* Update the readme file with #7949 changes

* 9.1.1 Release: Add testing docs

* Atomic Block: fix ancestor definition (#7947)

* Fix the incorrect layout of Rating and Price in Classic Template and Products block (#7932)

* Fix the incorrect layout of Rating and Price in Classic Template

There were styles required in Rating Filter that were added globally and influenced the layout of Rating in Products block as well as Classic template. The styles were moved to the Rating Filter block

* Add dropdown version of Filter by Stock Status (#7831)

* Extend Filter by Stock Editor options with dropdown and single/multiple choice

* Add dropdown implementation for Filter by Stock Status

* Adjust font-sizes to the rest of the filters

* Add tests to Filter by Stock: dropdown and list variants

* Change test file extension from .js to .tsx, so it handles types as well

* Add E2E test to Filter by Stock checking if display style can be toggled

* When typing in Filter by Stock dropdown, handle the space so it highlights the suggestions

* Change the name of the filter blocks in the test files

* Remove unnecessary waiting step in E2E test for Filter by Stock

toMatchElement waits for an element for 30s by itself, hence waitForSelector usage was removed

* Improve the STOCK_STATUS_OPTIONS type handling

* Extract onDropdownChange function instead of inline arrow function

* Fix overlaping dropdown content with the wrapper when Filter by Stock was set to single

* Product Query: Add patterns (#7857)

* Product Query: First attempt at adding patterns

* Product Query: Update patterns and the default block template

* Product Query: And new and update existing patterns

* Product Query: Adjust layout of the Minimal Product Row pattern

* Product Query: Update pattern names

* Product Query: Polish spaces between blocks inside the patterns

* Product Query patterns: Link product titles and improve spacing between product elements

* Product Query patterns: Button font-size update

* Product Query patterns: Center the pagination

* Product Query patterns: Center the pagination for the default pattern

* Product Query patterns: Remove an empty column

* Product Query patterns: Remove an empty column from the product list with 1:1 images pattern

* Add dropdown version of Filter by Rating (#7771)

* Rename the setting section to match Filter by Attribute

* Add Display Style toggle to the block settings

* Set list as a default value of displayStyle for Filter by Rating

* Add dropdown variant of Filter by Rating

* Extend the Editor settings with selectType: single or multiple

* Adjust the styles of a FormTokenField to other dropdown

* Align Editor settings order and wording between Filter by Attribute and Rating

* Fix the issue with cut off corners of dropdown borders

* Provide translated screen reader messages and placeholder

* Revert the label property, which is necessary to display checkbox list

* Make classname for Rating component optional and remove styling in Filter by Rating

* Cover the case when filter with zero products needs string methods for comparison

* Handle Typescript errors and add ts-ignore annotations when necessary

* Remove explicit key prop assignment in Rating component

* Remove leftover property in type definition

* Refactor JSX element extension with custom properties to more robust way with object copy

* Filter by rating tests (#7845)

* Filter by Rating tests:
  - List single
  - List multiple
  - Dropdown single
  - Dropdown multiple

* Adjust the font-size of Filter by Rating dropdown to the rest of the filters

* Fix E2E tests after the Editor settings label has been changed

* Improve sorting in Filter by Rating dropdown

With this change the order of options is always descending: in the chips, suggestions, active filters and URL

* Change the name of the filter blocks in the test files

* Prevent single dropdown input to overflow the wrapper

The issue is fixed in three filters, hence a new shared styles file is created at the path assets/js/blocks/shared/styles/style.css

* Remove the unused styles of active options in Filter by Rating

Chosen options in Filter by Rating list have been bolded. That was the only filter that was doing it. Class was removed, but not the styles themselves which became obsolete. Removing the leftover styles then

* Change the approach of shared styles to fix the dropdown issue in filters

Instead of using direct classes, rewrite it to mixin and include in the filters

* Fix the Filter by Rating with Products block

The problem was with the Products block, that there was incorrect initial value of product ratings query

* Align the logic of getting the filters from URL for Filter by Rating with Filter by Stock

Co-authored-by: Luigi Teschio <[email protected]>

* Product Query - Enable "Inherit Query from template" option (#7641)

* Add Inherit Query from template option

* Update label

* Product Elements: Fix block settings (#7914)

* Product Elements: Fix block settings

* Rating: Fix inactive star color

* Product Rating: Fix color inheritance

* StyleAttributesUtils: Fix PHP notices and invalid CSS output (#7909)

* StyleAttributesUtils: Fix PHP notices and invalid CSS output. Closes #7899.

* StyleAttributesUtils: Fix border radius and width support

* StyleAttributesUtils: Fix border radius and border color support

* StyleAttributesUtils: Include additional checks to deal with PHP warnings

* StyleAttributesUtils: Improve the custom border array check

* Update MiniCart.php to fix price total amount on page load prices are including tax (#7832)

* Update MiniCart.php

Added an update to the '$cart_contents_total' variable on the 'get_cart_price_markup' function if $cart->display_prices_including_tax is active. Currently displaying wrong amount total on page load if items are already in the basket.

* Update MiniCart.php

Removed white spaces?

* Update MiniCart.php

Fixed IF statement

* Remove whitespace at end of line

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Product Query: implement compatibility with Filter by Rating block (#7792)

* Product Query: implement compatibility with Filter by Rating block #7631

Product Query: implement compatibility with Filter by Rating block

* address feedback

* address feedback

* add comment

* add new zip file link

* add missing class

* add testing instructions about #7947

* add new zip file link

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Update docs/internal-developers/testing/releases/911.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Bumping version strings to new version.

* Remove feature flag from Products block (#8001)

* Remove feature flag from Products block

* Remove Products block from feature flags documentation

* Empty commit for release pull request

* Update changelog

* Add zip file link

* Bumping version strings to new version.

* Enable Product SKU and Product Stock Indicator in Core (#8009)

* Update changelog

* Update changelog

* Empty commit for release pull request

* Bumping version strings to new version.

Co-authored-by: github-actions <[email protected]>
Co-authored-by: Daniel Dudzic <[email protected]>
Co-authored-by: Tung Du <[email protected]>
Co-authored-by: Luigi Teschio <[email protected]>
Co-authored-by: kmanijak <[email protected]>
Co-authored-by: Luke O'Regan <[email protected]>
Co-authored-by: Albert Juhé Lluveras <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: filter by rating Issues related to the Filter by Rating block. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter patterns: [Filters alignment] Add dropdown version to *Filter by Rating* block
4 participants