From fc0eebe2a0701ea6c2706dba5e4e783ac689b13e Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 9 Nov 2021 16:47:46 +0000 Subject: [PATCH] Move checkbox control to checkout package (#5045) * Move checkbox control to checkout package * Revert import change in editor --- assets/js/blocks/cart-checkout/checkout/edit.tsx | 2 +- .../inner-blocks/checkout-contact-information-block/block.tsx | 2 +- .../inner-blocks/checkout-shipping-address-block/block.tsx | 2 +- .../checkout/inner-blocks/checkout-terms-block/edit.tsx | 2 +- .../checkout/inner-blocks/checkout-terms-block/frontend.tsx | 2 +- assets/js/blocks/cart-checkout/checkout/order-notes/index.js | 2 +- .../blocks/cart-checkout/payment-methods/payment-method-card.js | 2 +- .../checkout}/components/checkbox-control/index.tsx | 0 .../checkout}/components/checkbox-control/stories/index.js | 0 .../checkout}/components/checkbox-control/style.scss | 0 packages/checkout/components/index.js | 1 + 11 files changed, 8 insertions(+), 7 deletions(-) rename {assets/js/base => packages/checkout}/components/checkbox-control/index.tsx (100%) rename {assets/js/base => packages/checkout}/components/checkbox-control/stories/index.js (100%) rename {assets/js/base => packages/checkout}/components/checkbox-control/style.scss (100%) diff --git a/assets/js/blocks/cart-checkout/checkout/edit.tsx b/assets/js/blocks/cart-checkout/checkout/edit.tsx index 7c1337de603..b906718580c 100644 --- a/assets/js/blocks/cart-checkout/checkout/edit.tsx +++ b/assets/js/blocks/cart-checkout/checkout/edit.tsx @@ -21,8 +21,8 @@ import { import { PanelBody, ToggleControl, - CheckboxControl, Notice, + CheckboxControl, } from '@wordpress/components'; import { CartCheckoutFeedbackPrompt } from '@woocommerce/editor-components/feedback-prompt'; import { CHECKOUT_PAGE_ID } from '@woocommerce/block-settings'; diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/block.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/block.tsx index 6006f38f8e1..0aa104e07f1 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/block.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/block.tsx @@ -9,7 +9,7 @@ import { useStoreEvents, } from '@woocommerce/base-context'; import { getSetting } from '@woocommerce/settings'; -import CheckboxControl from '@woocommerce/base-components/checkbox-control'; +import { CheckboxControl } from '@woocommerce/blocks-checkout'; /** * Internal dependencies diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.tsx index b3813e77082..591dba05f0a 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.tsx @@ -10,7 +10,7 @@ import { useStoreEvents, useEditorContext, } from '@woocommerce/base-context'; -import CheckboxControl from '@woocommerce/base-components/checkbox-control'; +import { CheckboxControl } from '@woocommerce/blocks-checkout'; /** * Internal dependencies diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/edit.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/edit.tsx index ffe4539e3c8..d7752894cf9 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/edit.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/edit.tsx @@ -7,7 +7,7 @@ import { RichText, InspectorControls, } from '@wordpress/block-editor'; -import CheckboxControl from '@woocommerce/base-components/checkbox-control'; +import { CheckboxControl } from '@woocommerce/blocks-checkout'; import { PanelBody, ToggleControl, Notice } from '@wordpress/components'; import { PRIVACY_URL, TERMS_URL } from '@woocommerce/block-settings'; import { ADMIN_URL } from '@woocommerce/settings'; diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/frontend.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/frontend.tsx index b0879a72db6..098f68dc5ee 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/frontend.tsx @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; import { useState, useEffect } from '@wordpress/element'; -import CheckboxControl from '@woocommerce/base-components/checkbox-control'; +import { CheckboxControl } from '@woocommerce/blocks-checkout'; import { useCheckoutSubmit } from '@woocommerce/base-context/hooks'; import { withInstanceId } from '@wordpress/compose'; import type { ValidationData } from '@woocommerce/type-defs/contexts'; diff --git a/assets/js/blocks/cart-checkout/checkout/order-notes/index.js b/assets/js/blocks/cart-checkout/checkout/order-notes/index.js index 86a17801097..fea4097311f 100644 --- a/assets/js/blocks/cart-checkout/checkout/order-notes/index.js +++ b/assets/js/blocks/cart-checkout/checkout/order-notes/index.js @@ -3,7 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import { useState } from '@wordpress/element'; -import CheckboxControl from '@woocommerce/base-components/checkbox-control'; +import { CheckboxControl } from '@woocommerce/blocks-checkout'; import Textarea from '@woocommerce/base-components/textarea'; import PropTypes from 'prop-types'; diff --git a/assets/js/blocks/cart-checkout/payment-methods/payment-method-card.js b/assets/js/blocks/cart-checkout/payment-methods/payment-method-card.js index c5733cf3b8f..f9914c96cd0 100644 --- a/assets/js/blocks/cart-checkout/payment-methods/payment-method-card.js +++ b/assets/js/blocks/cart-checkout/payment-methods/payment-method-card.js @@ -7,7 +7,7 @@ import { useEditorContext, usePaymentMethodDataContext, } from '@woocommerce/base-context'; -import CheckboxControl from '@woocommerce/base-components/checkbox-control'; +import { CheckboxControl } from '@woocommerce/blocks-checkout'; import PropTypes from 'prop-types'; /** diff --git a/assets/js/base/components/checkbox-control/index.tsx b/packages/checkout/components/checkbox-control/index.tsx similarity index 100% rename from assets/js/base/components/checkbox-control/index.tsx rename to packages/checkout/components/checkbox-control/index.tsx diff --git a/assets/js/base/components/checkbox-control/stories/index.js b/packages/checkout/components/checkbox-control/stories/index.js similarity index 100% rename from assets/js/base/components/checkbox-control/stories/index.js rename to packages/checkout/components/checkbox-control/stories/index.js diff --git a/assets/js/base/components/checkbox-control/style.scss b/packages/checkout/components/checkbox-control/style.scss similarity index 100% rename from assets/js/base/components/checkbox-control/style.scss rename to packages/checkout/components/checkbox-control/style.scss diff --git a/packages/checkout/components/index.js b/packages/checkout/components/index.js index 95c78b43c0c..4449e80f8cc 100644 --- a/packages/checkout/components/index.js +++ b/packages/checkout/components/index.js @@ -6,3 +6,4 @@ export { default as ExperimentalOrderShippingPackages } from './order-shipping-p export { default as Panel } from './panel'; export { default as Button } from './button'; export { default as Label } from './label'; +export { default as CheckboxControl } from './checkbox-control';