@cypress-design/react-checkbox 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/Checkbox.tsx +19 -18
- package/CheckboxReact.cy.tsx +19 -1
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/index.es.mjs +21 -18
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +21 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @cypress-design/react-checkbox
|
|
2
2
|
|
|
3
|
+
## 0.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#101](https://github.com/cypress-io/cypress-design/pull/101) [`1630e4c`](https://github.com/cypress-io/cypress-design/commit/1630e4c4200944cf6414cee9e92dcce6b4d8a576) Thanks [@mapsandapps](https://github.com/mapsandapps)! - Fix styles for Checkbox
|
|
8
|
+
|
|
9
|
+
## 0.4.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#71](https://github.com/cypress-io/cypress-design/pull/71) [`379079e`](https://github.com/cypress-io/cypress-design/commit/379079e08802b6c3fae243925e3b9e8881e8ef54) Thanks [@elevatebart](https://github.com/elevatebart)! - allow users to click the checkbox instead of the label
|
|
14
|
+
|
|
3
15
|
## 0.4.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/Checkbox.tsx
CHANGED
|
@@ -71,24 +71,25 @@ export const Checkbox: FunctionComponent<CheckboxProps> = ({
|
|
|
71
71
|
disabled={disabled}
|
|
72
72
|
checked={localChecked}
|
|
73
73
|
/>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
<label className="flex items-center" htmlFor={id}>
|
|
75
|
+
{localChecked && (
|
|
76
|
+
// <windi-keep strokeColor="white"/>
|
|
77
|
+
<IconCheckmarkSmall strokeColor="white" className="absolute" />
|
|
78
|
+
)}
|
|
79
|
+
<span
|
|
80
|
+
className={clsx([
|
|
81
|
+
`block border-1 border-solid rounded h-16px w-16px flex items-center text-white`,
|
|
82
|
+
disabled
|
|
83
|
+
? 'border-gray-200 bg-gray-100'
|
|
84
|
+
: localChecked
|
|
85
|
+
? {
|
|
86
|
+
'border-indigo-500 bg-indigo-400': color === 'indigo',
|
|
87
|
+
'border-jade-500 bg-jade-400': color === 'jade',
|
|
88
|
+
'border-red-500 bg-red-400': color === 'red',
|
|
89
|
+
}
|
|
90
|
+
: 'border-gray-200 bg-white',
|
|
91
|
+
])}
|
|
92
|
+
/>
|
|
92
93
|
{label && (
|
|
93
94
|
<span
|
|
94
95
|
className={clsx([
|
package/CheckboxReact.cy.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { mount } from 'cypress/react'
|
|
|
3
3
|
import { Checkbox } from './Checkbox'
|
|
4
4
|
|
|
5
5
|
describe('Checkbox', () => {
|
|
6
|
-
it('
|
|
6
|
+
it('changes when the label is clicked', () => {
|
|
7
7
|
let isChecked = true
|
|
8
8
|
|
|
9
9
|
mount(
|
|
@@ -20,4 +20,22 @@ describe('Checkbox', () => {
|
|
|
20
20
|
cy.contains('Welcome guide settings').click()
|
|
21
21
|
cy.get('input[type="checkbox"]').should('not.be.checked')
|
|
22
22
|
})
|
|
23
|
+
|
|
24
|
+
it('changes when checkbox is clicked', () => {
|
|
25
|
+
let isChecked = true
|
|
26
|
+
|
|
27
|
+
mount(
|
|
28
|
+
<Checkbox
|
|
29
|
+
label="Welcome guide settings"
|
|
30
|
+
id="welcome-opt-out"
|
|
31
|
+
checked={isChecked}
|
|
32
|
+
onChange={() => (isChecked = !isChecked)}
|
|
33
|
+
className="m-2 px-2 py-1 border-1 border-gray-300 rounded"
|
|
34
|
+
/>
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
cy.get('input[type="checkbox"]').should('be.checked')
|
|
38
|
+
cy.get('svg').click()
|
|
39
|
+
cy.get('input[type="checkbox"]').should('not.be.checked')
|
|
40
|
+
})
|
|
23
41
|
})
|
package/dist/Checkbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../Checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGpE,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IACtE;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;CAC/D;AAQD,eAAO,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../Checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGpE,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IACtE;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;CAC/D;AAQD,eAAO,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,CA8DrD,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
package/dist/index.es.mjs
CHANGED
|
@@ -125,26 +125,29 @@ var Checkbox = function (_a) {
|
|
|
125
125
|
}
|
|
126
126
|
return (React.createElement("div", __assign$1({ className: clsx(className, 'relative flex items-center') }, rest),
|
|
127
127
|
React.createElement("input", { id: id, className: "absolute inset-0 w-0 h-0 opacity-0", "aria-describedby": id + "-description", name: name || id, type: "checkbox", onChange: onChangeInput, disabled: disabled, checked: localChecked }),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
React.createElement("label", { className: "flex items-center", htmlFor: id },
|
|
129
|
+
localChecked && (
|
|
130
|
+
// <windi-keep strokeColor="white"/>
|
|
131
|
+
React.createElement(IconCheckmarkSmall, { strokeColor: "white", className: "absolute" })),
|
|
132
|
+
React.createElement("span", { className: clsx([
|
|
133
|
+
"block border-1 border-solid rounded h-16px w-16px flex items-center text-white",
|
|
134
|
+
disabled
|
|
135
|
+
? 'border-gray-200 bg-gray-100'
|
|
136
|
+
: localChecked
|
|
137
|
+
? {
|
|
138
|
+
'border-indigo-500 bg-indigo-400': color === 'indigo',
|
|
139
|
+
'border-jade-500 bg-jade-400': color === 'jade',
|
|
140
|
+
'border-red-500 bg-red-400': color === 'red'
|
|
141
|
+
}
|
|
142
|
+
: 'border-gray-200 bg-white',
|
|
143
|
+
]) }),
|
|
144
|
+
label && (React.createElement("span", { className: clsx([
|
|
145
|
+
disabled ? 'text-gray-500' : 'text-gray-800',
|
|
146
|
+
'block ml-2 text-16px leading-normal font-light select-none',
|
|
147
|
+
]) }, label)))));
|
|
145
148
|
};
|
|
146
149
|
|
|
147
150
|
export { Checkbox as default };
|
|
148
151
|
|
|
149
|
-
/* <windicss-keep class="relative flex items-center absolute inset-0 w-0 h-0 opacity-0 block border-1 rounded h-16px w-16px text-white border-gray-200 bg-gray-100 border-indigo-500 bg-indigo-400 border-jade-500 bg-jade-400 border-red-500 bg-red-400 bg-white text-gray-500 text-gray-800 ml-2 text-16px leading-normal font-light select-none"> */
|
|
152
|
+
/* <windicss-keep class="relative flex items-center absolute inset-0 w-0 h-0 opacity-0 block border-1 border-solid rounded h-16px w-16px text-white border-gray-200 bg-gray-100 border-indigo-500 bg-indigo-400 border-jade-500 bg-jade-400 border-red-500 bg-red-400 bg-white text-gray-500 text-gray-800 ml-2 text-16px leading-normal font-light select-none icon-dark-white"> */
|
|
150
153
|
//# sourceMappingURL=index.es.mjs.map
|