woocommerce/plugins/woocommerce-blocks/assets/js/blocks/product-collection
Manish Menaria 890c5dbcac Transfer layout options from Toolbar to Inspector controls (https://github.com/woocommerce/woocommerce-blocks/pull/10922)
In this update, the layout options for the Product Collection block are transferred from the Toolbar to the Inspector controls. Below is the breakdown of the changes:

1. **Constants Update**
    - `LayoutOptions` enumeration has been imported into `constants.ts`, facilitating a more structured approach to managing layout types (grid and stack).
    - The default display layout type has been updated from 'flex' to reference `LayoutOptions.GRID`.
    - The `getDefaultQuery` function now uses the `getDefaultValueOfInheritQueryFromTemplate` utility to set the default `inherit` value. (This is mainly done to fix a bug)

2. **Display Layout Control Removal**
    - The `display-layout-control.tsx` file has been removed, discontinuing the previous method of layout management.

3. **New Layout Options Control**
    - A new component `LayoutOptionsControl` has been introduced in the `layout-options-control.tsx` file, utilizing the experimental `ToggleGroupControl` and `ToggleGroupControlOption` components from the WordPress package to provide a more intuitive layout selection experience.
    - The `types.ts` file has been updated to define the `LayoutOptions` enum, effectively mapping 'flex' to 'GRID' and 'list' to 'STACK'.

4. **Inspector Controls Update**
    - In `inspector-controls/index.tsx`, the obsolete `DisplayLayoutControl` has been replaced with the new `LayoutOptionsControl`, integrating it into the `ProductCollectionInspectorControls` component.
    - The `BlockControls` wrapper has been removed, and layout options have been relocated to the Inspector controls, presented as a toggle group within the ToolsPanel.

5. **Inherit Query Control Modification**
    - The `inherit-query-control.tsx` file sees a change in the reset value for the `inherit` query attribute to employ a default value which fix one bug.

These changes aim to streamline the user experience by relocating the layout options from the Toolbar to the Inspector controls, offering a centralized location for block settings. Leveraging an enum for layout options fosters code readability and maintainability.

Do note that the update uses experimental components, hence it would be prudent to keep an eye on potential alterations or deprecations in upcoming WordPress releases.
2023-09-15 15:38:48 +05:30
..
inspector-controls Transfer layout options from Toolbar to Inspector controls (https://github.com/woocommerce/woocommerce-blocks/pull/10922) 2023-09-15 15:38:48 +05:30
toolbar-controls Add pattern chooser in Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10876) 2023-09-14 14:19:16 +02:00
variations Enable Product Collection as a core feature (https://github.com/woocommerce/woocommerce-blocks/pull/10524) 2023-08-25 15:58:11 +02:00
block.json Enable Product Collection as a core feature (https://github.com/woocommerce/woocommerce-blocks/pull/10524) 2023-08-25 15:58:11 +02:00
constants.ts Transfer layout options from Toolbar to Inspector controls (https://github.com/woocommerce/woocommerce-blocks/pull/10922) 2023-09-15 15:38:48 +05:30
edit.tsx Add Display Settings Toolbar to the Product Collection Block (https://github.com/woocommerce/woocommerce-blocks/pull/9747) 2023-06-19 10:37:05 +05:30
editor.scss Add pattern chooser in Product Collection (https://github.com/woocommerce/woocommerce-blocks/pull/10876) 2023-09-14 14:19:16 +02:00
icon.tsx Foundation of New Product Collection Block (https://github.com/woocommerce/woocommerce-blocks/pull/9352) 2023-05-15 08:51:49 +00:00
index.tsx Enable Product Collection as a core feature (https://github.com/woocommerce/woocommerce-blocks/pull/10524) 2023-08-25 15:58:11 +02:00
save.tsx Foundation of New Product Collection Block (https://github.com/woocommerce/woocommerce-blocks/pull/9352) 2023-05-15 08:51:49 +00:00
types.ts Transfer layout options from Toolbar to Inspector controls (https://github.com/woocommerce/woocommerce-blocks/pull/10922) 2023-09-15 15:38:48 +05:30
utils.tsx Product Collection - Add Inherit query from template control (https://github.com/woocommerce/woocommerce-blocks/pull/9485) 2023-06-05 06:09:11 +00:00