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

Commit

Permalink
Move CheckboxList and create new blocksComponents package (#11214)
Browse files Browse the repository at this point in the history
  • Loading branch information
opr authored Oct 17, 2023
1 parent da37a27 commit d113815
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ module.exports = {
'import/core-modules': [
'@woocommerce/block-data',
'@woocommerce/blocks-checkout',
'@woocommerce/blocks-components',
'@woocommerce/price-format',
'@woocommerce/settings',
'@woocommerce/shared-context',
Expand Down
1 change: 0 additions & 1 deletion assets/js/base/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './block-error-boundary';
export * from './button';
export * from './cart-checkout';
export * from './checkbox-list';
export * from './chip';
export * from './combobox';
export * from './country-input';
Expand Down
3 changes: 2 additions & 1 deletion assets/js/blocks/attribute-filter/checkbox-filter.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* External dependencies
*/
import CheckboxList from '@woocommerce/base-components/checkbox-list';
import { CheckboxList } from '@woocommerce/blocks-components';

/**
* Internal dependencies
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/rating-filter/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getSettingWithCoercion } from '@woocommerce/settings';
import { isBoolean, isObject, objectHasProp } from '@woocommerce/types';
import isShallowEqual from '@wordpress/is-shallow-equal';
import { useState, useCallback, useMemo, useEffect } from '@wordpress/element';
import CheckboxList from '@woocommerce/base-components/checkbox-list';
import { CheckboxList } from '@woocommerce/blocks-components';
import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
import FilterResetButton from '@woocommerce/base-components/filter-reset-button';
import FormTokenField from '@woocommerce/base-components/form-token-field';
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/stock-filter/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
useMemo,
useRef,
} from '@wordpress/element';
import CheckboxList from '@woocommerce/base-components/checkbox-list';
import { CheckboxList } from '@woocommerce/blocks-components';
import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
import FilterResetButton from '@woocommerce/base-components/filter-reset-button';
import FilterTitlePlaceholder from '@woocommerce/base-components/filter-placeholder';
Expand Down
1 change: 1 addition & 0 deletions bin/webpack-entries.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ const entries = {
wcBlocksSharedHocs: './assets/js/shared/hocs/index.js',
priceFormat: './packages/prices/index.js',
blocksCheckout: './packages/checkout/index.js',
blocksComponents: './packages/components/index.js',
},
main: {
// Shared blocks code
Expand Down
2 changes: 2 additions & 0 deletions bin/webpack-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const wcDepMap = {
'@woocommerce/shared-hocs': [ 'wc', 'wcBlocksSharedHocs' ],
'@woocommerce/price-format': [ 'wc', 'priceFormat' ],
'@woocommerce/blocks-checkout': [ 'wc', 'blocksCheckout' ],
'@woocommerce/blocks-components': [ 'wc', 'blocksComponents' ],
'@woocommerce/interactivity': [ 'wc', '__experimentalInteractivity' ],
};

Expand All @@ -29,6 +30,7 @@ const wcHandleMap = {
'@woocommerce/shared-hocs': 'wc-blocks-shared-hocs',
'@woocommerce/price-format': 'wc-price-format',
'@woocommerce/blocks-checkout': 'wc-blocks-checkout',
'@woocommerce/blocks-components': 'wc-blocks-components',
'@woocommerce/interactivity': 'wc-interactivity',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ interface CheckboxListOptions {
}

interface CheckboxListProps {
className?: string;
isLoading?: boolean;
isDisabled?: boolean;
limit?: number;
checked?: string[];
onChange: ( value: string ) => void;
options?: CheckboxListOptions[];
className?: string | undefined;
isLoading?: boolean | undefined;
isDisabled?: boolean | undefined;
limit?: number | undefined;
checked?: string[] | undefined;
onChange: ( value: string ) => void | undefined;
options?: CheckboxListOptions[] | undefined;
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as CheckboxList } from './checkbox-list';
1 change: 1 addition & 0 deletions src/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function register_assets() {
$this->api->register_script( 'wc-price-format', 'build/price-format.js', [], false );

$this->api->register_script( 'wc-blocks-checkout', 'build/blocks-checkout.js', [] );
$this->api->register_script( 'wc-blocks-components', 'build/blocks-components.js', [] );

wp_add_inline_script(
'wc-blocks-middleware',
Expand Down
1 change: 1 addition & 0 deletions tests/js/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@woocommerce/editor-components(.*)$": "assets/js/editor-components/$1",
"@woocommerce/blocks-registry": "assets/js/blocks-registry",
"@woocommerce/blocks-checkout": "packages/checkout",
"@woocommerce/blocks-components": "packages/components",
"@woocommerce/price-format": "packages/prices",
"@woocommerce/block-hocs(.*)$": "assets/js/hocs/$1",
"@woocommerce/base-components(.*)$": "assets/js/base/components/$1",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@woocommerce/block-hocs": [ "assets/js/hocs" ],
"@woocommerce/blocks-registry": [ "assets/js/blocks-registry" ],
"@woocommerce/blocks-checkout": [ "packages/checkout" ],
"@woocommerce/blocks-components": [ "packages/components" ],
"@woocommerce/price-format": [ "packages/prices" ],
"@woocommerce/block-settings": [ "assets/js/settings/blocks" ],
"@woocommerce/icons": [ "assets/js/icons" ],
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": [
"./assets/js/**/*",
"./packages/checkout/**/*",
"./packages/components/**/*",
"./assets/js/blocks/**/block.json",
"./assets/js/atomic/blocks/**/block.json",
"./assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/**/block.json",
Expand Down

0 comments on commit d113815

Please sign in to comment.