@cypress-design/react-checkbox 0.4.0 → 0.4.3
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 +21 -0
- package/Checkbox.tsx +18 -18
- package/CheckboxReact.cy.tsx +19 -1
- package/dist/{index.es.js → index.es.mjs} +21 -19
- package/dist/index.es.mjs.map +1 -0
- package/dist/index.umd.js +20 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/dist/index.es.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @cypress-design/react-checkbox
|
|
2
2
|
|
|
3
|
+
## 0.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
## 0.4.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#68](https://github.com/cypress-io/cypress-design/pull/68) [`8c577fb`](https://github.com/cypress-io/cypress-design/commit/8c577fb0c6a0411cf8218dfe78281834df3d6f13) Thanks [@elevatebart](https://github.com/elevatebart)! - feat: publish `.mjs` files for esm intead of `.js`
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`8c577fb`](https://github.com/cypress-io/cypress-design/commit/8c577fb0c6a0411cf8218dfe78281834df3d6f13)]:
|
|
16
|
+
- @cypress-design/react-icon@0.4.2
|
|
17
|
+
|
|
18
|
+
## 0.4.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`2afa4d5`](https://github.com/cypress-io/cypress-design/commit/2afa4d54a2373692f82bee35ae40446bc9bb3f91) Thanks [@elevatebart](https://github.com/elevatebart)! - avoid duplicate ids in checkboxes
|
|
23
|
+
|
|
3
24
|
## 0.4.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
package/Checkbox.tsx
CHANGED
|
@@ -71,24 +71,24 @@ 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
|
+
<IconCheckmarkSmall strokeColor="white" className="absolute" />
|
|
77
|
+
)}
|
|
78
|
+
<span
|
|
79
|
+
className={clsx([
|
|
80
|
+
`block border-1 rounded h-16px w-16px flex items-center text-white`,
|
|
81
|
+
disabled
|
|
82
|
+
? 'border-gray-200 bg-gray-100'
|
|
83
|
+
: localChecked
|
|
84
|
+
? {
|
|
85
|
+
'border-indigo-500 bg-indigo-400': color === 'indigo',
|
|
86
|
+
'border-jade-500 bg-jade-400': color === 'jade',
|
|
87
|
+
'border-red-500 bg-red-400': color === 'red',
|
|
88
|
+
}
|
|
89
|
+
: 'border-gray-200 bg-white',
|
|
90
|
+
])}
|
|
91
|
+
/>
|
|
92
92
|
{label && (
|
|
93
93
|
<span
|
|
94
94
|
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
|
})
|
|
@@ -110,6 +110,7 @@ var IconCheckmarkSmall = function (props) {
|
|
|
110
110
|
}
|
|
111
111
|
return React.createElement('svg', compileReactIconProperties(__assign(__assign({}, props), { size: size, body: body, compiledClasses: compiledClasses })));
|
|
112
112
|
};
|
|
113
|
+
|
|
113
114
|
/* <windicss-keep class=""> */
|
|
114
115
|
|
|
115
116
|
var uid = function () {
|
|
@@ -124,26 +125,27 @@ var Checkbox = function (_a) {
|
|
|
124
125
|
}
|
|
125
126
|
return (React.createElement("div", __assign$1({ className: clsx(className, 'relative flex items-center') }, rest),
|
|
126
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 }),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
128
|
+
React.createElement("label", { className: "flex items-center", htmlFor: id },
|
|
129
|
+
localChecked && (React.createElement(IconCheckmarkSmall, { strokeColor: "white", className: "absolute" })),
|
|
130
|
+
React.createElement("span", { className: clsx([
|
|
131
|
+
"block border-1 rounded h-16px w-16px flex items-center text-white",
|
|
132
|
+
disabled
|
|
133
|
+
? 'border-gray-200 bg-gray-100'
|
|
134
|
+
: localChecked
|
|
135
|
+
? {
|
|
136
|
+
'border-indigo-500 bg-indigo-400': color === 'indigo',
|
|
137
|
+
'border-jade-500 bg-jade-400': color === 'jade',
|
|
138
|
+
'border-red-500 bg-red-400': color === 'red'
|
|
139
|
+
}
|
|
140
|
+
: 'border-gray-200 bg-white',
|
|
141
|
+
]) }),
|
|
142
|
+
label && (React.createElement("span", { className: clsx([
|
|
143
|
+
disabled ? 'text-gray-500' : 'text-gray-800',
|
|
144
|
+
'block ml-2 text-16px leading-normal font-light select-none',
|
|
145
|
+
]) }, label)))));
|
|
144
146
|
};
|
|
145
147
|
|
|
146
148
|
export { Checkbox as default };
|
|
147
|
-
/* <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"> */
|
|
148
149
|
|
|
149
|
-
|
|
150
|
+
/* <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"> */
|
|
151
|
+
//# sourceMappingURL=index.es.mjs.map
|