@cypress-design/react-checkbox 0.2.0 → 0.3.0
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 +23 -4
- package/dist/Checkbox.d.ts +22 -4
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/index.es.js +7 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +7 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -124,20 +124,24 @@ var IconCheckmarkSmall = function (props) {
|
|
|
124
124
|
};
|
|
125
125
|
var body = iconBodies[size];
|
|
126
126
|
if (!body) {
|
|
127
|
-
throw Error("Icon \"checkmark-small\" is not available in size "
|
|
127
|
+
throw Error("Icon \"checkmark-small\" is not available in size " + size);
|
|
128
128
|
}
|
|
129
129
|
return React__namespace.createElement('svg', compileReactIconProperties(__assign(__assign({}, props), { size: size, body: body, compiledClasses: compiledClasses })));
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
var Checkbox = function (_a) {
|
|
133
|
-
var
|
|
133
|
+
var
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
_b = _a.id,
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
id = _b === void 0 ? crypto.randomUUID() : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, onChange = _a.onChange, _d = _a.color, color = _d === void 0 ? 'indigo' : _d, label = _a.label, disabled = _a.disabled, rest = __rest$1(_a, ["id", "checked", "onChange", "color", "label", "disabled"]);
|
|
134
138
|
var _e = React__namespace.useState(checked), localChecked = _e[0], setChecked = _e[1];
|
|
135
139
|
function onChangeInput(event) {
|
|
136
140
|
setChecked(!localChecked);
|
|
137
141
|
onChange(event);
|
|
138
142
|
}
|
|
139
143
|
return (React__namespace.createElement("label", __assign$1({}, rest, { className: clsx__default["default"](rest.className, 'relative flex items-center') }),
|
|
140
|
-
React__namespace.createElement("input", { id: id, className: "absolute inset-0 w-0 h-0 opacity-0", "aria-describedby":
|
|
144
|
+
React__namespace.createElement("input", { id: id, className: "absolute inset-0 w-0 h-0 opacity-0", "aria-describedby": id + "-description", name: id, type: "checkbox", onChange: onChangeInput, disabled: disabled, checked: localChecked }),
|
|
141
145
|
localChecked && (React__namespace.createElement(IconCheckmarkSmall, { strokeColor: "white", className: "absolute" })),
|
|
142
146
|
React__namespace.createElement("span", { className: clsx__default["default"]([
|
|
143
147
|
"block border-1 rounded h-16px w-16px flex items-center text-white",
|