This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-83
lines changed
assets/js/blocks/checkout/inner-blocks
checkout-contact-information-block
checkout-shipping-address-block
packages/checkout/components/checkbox-control Expand file tree Collapse file tree 3 files changed +6
-83
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ import {
88 noticeContexts ,
99} from '@woocommerce/base-context' ;
1010import { getSetting } from '@woocommerce/settings' ;
11- import { CheckboxControl } from '@woocommerce/blocks-checkout' ;
1211import {
1312 StoreNoticesContainer ,
1413 ValidatedTextInput ,
14+ CheckboxControl ,
1515} from '@woocommerce/blocks-components' ;
1616import { useDispatch , useSelect } from '@wordpress/data' ;
1717import { CHECKOUT_STORE_KEY } from '@woocommerce/block-data' ;
Original file line number Diff line number Diff line change @@ -9,8 +9,10 @@ import {
99 useEditorContext ,
1010 noticeContexts ,
1111} from '@woocommerce/base-context' ;
12- import { CheckboxControl } from '@woocommerce/blocks-checkout' ;
13- import { StoreNoticesContainer } from '@woocommerce/blocks-components' ;
12+ import {
13+ StoreNoticesContainer ,
14+ CheckboxControl ,
15+ } from '@woocommerce/blocks-components' ;
1416import Noninteractive from '@woocommerce/base-components/noninteractive' ;
1517import type {
1618 BillingAddress ,
Original file line number Diff line number Diff line change 1- /**
2- * External dependencies
3- */
4- import classNames from 'classnames' ;
5- import { useInstanceId } from '@wordpress/compose' ;
6-
7- /**
8- * Internal dependencies
9- */
10- import './style.scss' ;
11-
12- export type CheckboxControlProps = {
13- className ?: string ;
14- label ?: string | React . ReactNode ;
15- id ?: string ;
16- onChange : ( value : boolean ) => void ;
17- children ?: React . ReactChildren ;
18- hasError ?: boolean ;
19- checked ?: boolean ;
20- disabled ?: boolean ;
21- } ;
22-
23- /**
24- * Component used to show a checkbox control with styles.
25- */
26- export const CheckboxControl = ( {
27- className,
28- label,
29- id,
30- onChange,
31- children,
32- hasError = false ,
33- checked = false ,
34- disabled = false ,
35- ...rest
36- } : CheckboxControlProps ) : JSX . Element => {
37- const instanceId = useInstanceId ( CheckboxControl ) ;
38- const checkboxId = id || `checkbox-control-${ instanceId } ` ;
39-
40- return (
41- < div
42- className = { classNames (
43- 'wc-block-components-checkbox' ,
44- {
45- 'has-error' : hasError ,
46- } ,
47- className
48- ) }
49- >
50- < label htmlFor = { checkboxId } >
51- < input
52- id = { checkboxId }
53- className = "wc-block-components-checkbox__input"
54- type = "checkbox"
55- onChange = { ( event ) => onChange ( event . target . checked ) }
56- aria-invalid = { hasError === true }
57- checked = { checked }
58- disabled = { disabled }
59- { ...rest }
60- />
61- < svg
62- className = "wc-block-components-checkbox__mark"
63- aria-hidden = "true"
64- xmlns = "http://www.w3.org/2000/svg"
65- viewBox = "0 0 24 20"
66- >
67- < path d = "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
68- </ svg >
69- { label && (
70- < span className = "wc-block-components-checkbox__label" >
71- { label }
72- </ span >
73- ) }
74- { children }
75- </ label >
76- </ div >
77- ) ;
78- } ;
79-
80- export default CheckboxControl ;
1+ export { CheckboxControl } from '@woocommerce/blocks-components' ;
You can’t perform that action at this time.
0 commit comments