92eac565e5
* When the user selects a grouped product type, we show an additional Products in this group section in the General tab. * When the user selects a grouped product type, we hide the Pricing and Shipping tabs. * When empty, the grouped products card has an empty state with an illustration * When the user clicks Add products, we show a modal * When the user clicks the search field, we immediately display the list of all existing products. It is sorted alphabetically. Clicking an item closes the search and adds the product to the list. * Add remove button to the product list * When the user clicks Add, we close the modal and display the list of added products in the product form * Clicking the product name will open it in the editing view in a new tab * Clicking the arrow button will open the product's page in a new tab * Prevent adding already added products * If the name or SKU extends beyond this width, we truncate the text * Add changelog files * Fix linter errors |
||
---|---|---|
.. | ||
changelog | ||
src | ||
typings | ||
.eslintrc.js | ||
.gitignore | ||
.npmrc | ||
CHANGELOG.md | ||
PREVIOUS_CHANGELOG.md | ||
README.md | ||
babel.config.js | ||
composer.json | ||
composer.lock | ||
jest.config.json | ||
package.json | ||
tsconfig-cjs.json | ||
tsconfig.json | ||
webpack.config.js |
README.md
Components
This packages includes a library of components that can be used to create pages in the WooCommerce dashboard and reports pages.
Installation
Install the module
pnpm install @woocommerce/components --save
Usage
/**
* WooCommerce dependencies
*/
import { Card } from '@woocommerce/components';
export default function MyCard() {
return (
<Card title="Store Performance" description="Key performance metrics">
<p>Your stuff in a Card.</p>
</Card>
);
}
Many components include CSS to add style, you will need to add in order to appear correctly. Within WooCommerce, add the wc-components
stylesheet as a dependency of your plugin's stylesheet. See wp_enqueue_style documentation for how to specify dependencies.
In non-WordPress projects, link to the build-style/card/style.css
file directly, it is located at node_modules/@woocommerce/components/build-style/<component_name>/style.css
.
Usage with tests
If you are using these components in a project that uses Jest for testing, you may get an error that looks like this:
Cannot find module '@woocommerce/settings' from 'node_modules/@woocommerce/experimental/node_modules/@woocommerce/navigation/build/index.js'
To fix this, you will need to mock the @woocommerce/settings
because it's an alias that points to the window.wcSettings
, which in turn comes from and is maintained by the WC Blocks package, the front-end code for this is located here.
This can be done by adding the following to your Jest config:
module.exports = {
moduleNameMapper: {
'@woocommerce/settings': path.resolve(
__dirname,
'./mock/woocommerce-settings'
),
}
setupFiles: [
path.resolve( __dirname, 'build/setup-globals.js' ),
],
// ...other config
}
Then, you will need to create the following files: