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

Move Label component to components package #11275

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import classnames from 'classnames';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';
import {
useInnerBlockLayoutContext,
useProductDataContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import classnames from 'classnames';
import { sprintf, _n } from '@wordpress/i18n';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';
import ProductPrice from '@woocommerce/base-components/product-price';
import ProductName from '@woocommerce/base-components/product-name';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'classnames';
import { _n, sprintf } from '@wordpress/i18n';
import { decodeEntities } from '@wordpress/html-entities';
import { Panel } from '@woocommerce/blocks-checkout';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';
import { useCallback } from '@wordpress/element';
import { useShippingData } from '@woocommerce/base-context/hooks';
import { sanitizeHTML } from '@woocommerce/utils';
Expand Down
2 changes: 1 addition & 1 deletion assets/js/base/components/filter-element-label/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { _n, sprintf } from '@wordpress/i18n';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion assets/js/base/components/filter-reset-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import classNames from 'classnames';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion assets/js/base/components/filter-submit-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import classNames from 'classnames';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion assets/js/base/components/load-more-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import Label from '@woocommerce/base-components/label';
import type { MouseEventHandler } from 'react';

/**
* Internal dependencies
*/
import './style.scss';
import Label from '../../../../../packages/components/label'; // Imported like this because importing from the components package loads the data stores unnecessarily - not a problem in the front end but would require a lot of unit test rewrites to prevent breaking tests due to incorrect mocks.

interface LoadMoreButtonProps {
onClick: MouseEventHandler;
Expand Down
2 changes: 1 addition & 1 deletion assets/js/base/components/pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __, sprintf } from '@wordpress/i18n';
import classNames from 'classnames';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion assets/js/base/components/sort-select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* External dependencies
*/
import classNames from 'classnames';
import Label from '@woocommerce/base-components/label';
import { withInstanceId } from '@wordpress/compose';
import type { ChangeEventHandler } from 'react';

/**
* Internal dependencies
*/
import './style.scss';
import Label from '../../../../../packages/components/label'; // Imported like this because importing from the components package loads the data stores unnecessarily - not a problem in the front end but would require a lot of unit test rewrites to prevent breaking tests due to incorrect mocks.

interface SortSelectProps {
/**
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/active-filters/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useQueryStateByKey } from '@woocommerce/base-context/hooks';
import { getSetting, getSettingWithCoercion } from '@woocommerce/settings';
import { useMemo, useEffect, useState } from '@wordpress/element';
import classnames from 'classnames';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';
import {
isAttributeQueryCollection,
isBoolean,
Expand Down
3 changes: 1 addition & 2 deletions assets/js/blocks/active-filters/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
*/
import { __, sprintf } from '@wordpress/i18n';
import { formatPrice } from '@woocommerce/price-format';
import { RemovableChip } from '@woocommerce/blocks-components';
import Label from '@woocommerce/base-components/label';
import { Label, RemovableChip } from '@woocommerce/blocks-components';
import { getQueryArgs, addQueryArgs, removeQueryArgs } from '@wordpress/url';
import { changeUrl } from '@woocommerce/utils';
import { Icon, closeSmall } from '@wordpress/icons';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import Label from '@woocommerce/base-components/label';
import { Label } from '@woocommerce/blocks-components';
import { useSelect } from '@wordpress/data';
import { PAYMENT_STORE_KEY } from '@woocommerce/block-data';

Expand Down
4 changes: 2 additions & 2 deletions packages/checkout/components/label/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* External dependencies
* Internal dependencies
*/
import Label from '@woocommerce/base-components/label';
import Label from '../../../components/label';

export default Label;
1 change: 1 addition & 0 deletions packages/components/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as CheckboxList } from './checkbox-list';
export { default as Label } from './label';
export { default as FormattedMonetaryAmount } from './formatted-monetary-amount';
export { Chip, RemovableChip } from './chip';
Loading