@cypress-design/react-checkbox 1.0.0 → 1.0.2
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/.turbo/turbo-build.log +3 -1
- package/CHANGELOG.md +15 -0
- package/dist/index.es.mjs +3 -110
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +4 -111
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/rollup.config.mjs +5 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
$ yarn build:module && yarn build:types
|
|
2
2
|
$ rollup -c ./rollup.config.mjs
|
|
3
|
+
(node:4216) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
|
4
|
+
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
3
5
|
[36m
|
|
4
6
|
[1m./index.ts[22m → [1m./dist/index.umd.js, ./dist/index.es.mjs[22m...[39m
|
|
5
|
-
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [
|
|
7
|
+
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [1m12.2s[22m[39m
|
|
6
8
|
$ tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @cypress-design/react-checkbox
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#454](https://github.com/cypress-io/cypress-design/pull/454) [`48a3f6c`](https://github.com/cypress-io/cypress-design/commit/48a3f6cc5957844de2a5164137a8cedc31abe673) Thanks [@elevatebart](https://github.com/elevatebart)! - make sure the constant packages roll up in the react components for tailwind class detection
|
|
8
|
+
|
|
9
|
+
## 1.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#450](https://github.com/cypress-io/cypress-design/pull/450) [`927097f`](https://github.com/cypress-io/cypress-design/commit/927097f409235ac78c98b281c4d9b2ec70dfe01d) Thanks [@elevatebart](https://github.com/elevatebart)! - optim: do not package dependencies
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`927097f`](https://github.com/cypress-io/cypress-design/commit/927097f409235ac78c98b281c4d9b2ec70dfe01d), [`927097f`](https://github.com/cypress-io/cypress-design/commit/927097f409235ac78c98b281c4d9b2ec70dfe01d)]:
|
|
16
|
+
- @cypress-design/react-icon@1.1.0
|
|
17
|
+
|
|
3
18
|
## 1.0.0
|
|
4
19
|
|
|
5
20
|
### Major Changes
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,52 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { ICON_COLOR_PROP_NAMES } from '@cypress-design/icon-registry';
|
|
5
|
-
|
|
6
|
-
/******************************************************************************
|
|
7
|
-
Copyright (c) Microsoft Corporation.
|
|
8
|
-
|
|
9
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
-
purpose with or without fee is hereby granted.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */
|
|
20
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var __assign$1 = function() {
|
|
24
|
-
__assign$1 = Object.assign || function __assign(t) {
|
|
25
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
26
|
-
s = arguments[i];
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
};
|
|
31
|
-
return __assign$1.apply(this, arguments);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function __rest$1(s, e) {
|
|
35
|
-
var t = {};
|
|
36
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
37
|
-
t[p] = s[p];
|
|
38
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
41
|
-
t[p[i]] = s[p[i]];
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
47
|
-
var e = new Error(message);
|
|
48
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
49
|
-
};
|
|
3
|
+
import { IconCheckmarkSmall } from '@cypress-design/react-icon';
|
|
50
4
|
|
|
51
5
|
/******************************************************************************
|
|
52
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -93,67 +47,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
93
47
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
94
48
|
};
|
|
95
49
|
|
|
96
|
-
var compileReactIconProperties = function (_a) {
|
|
97
|
-
var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, alt = _a.alt, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name", "alt"]);
|
|
98
|
-
var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
|
|
99
|
-
if (!ICON_COLOR_PROP_NAMES.includes(attrName) &&
|
|
100
|
-
attrName !== 'name') {
|
|
101
|
-
// @ts-expect-error the ky of React's SVGProps is too broad and
|
|
102
|
-
// breaks here. Since we do not need to check for it. We keep the expect error
|
|
103
|
-
newAttributes[attrName] =
|
|
104
|
-
attributes[attrName];
|
|
105
|
-
}
|
|
106
|
-
return newAttributes;
|
|
107
|
-
}, {});
|
|
108
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
109
|
-
React.useEffect(function () {
|
|
110
|
-
var iconFileId = "".concat(name, "_").concat(size);
|
|
111
|
-
if (defs) {
|
|
112
|
-
if (document.querySelector("[data-cy-svg-defs=\"".concat(iconFileId, "\"]"))) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
var svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
116
|
-
svgElement.setAttribute('data-cy-svg-defs', iconFileId);
|
|
117
|
-
svgElement.setAttribute('width', '0');
|
|
118
|
-
svgElement.setAttribute('height', '0');
|
|
119
|
-
svgElement.innerHTML = defs;
|
|
120
|
-
document.body.appendChild(svgElement);
|
|
121
|
-
}
|
|
122
|
-
}, [defs, name, size]);
|
|
123
|
-
var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
|
|
124
|
-
__html: alt
|
|
125
|
-
? "<title>".concat(alt.replace(/[><]/g, function (s) {
|
|
126
|
-
return s === '>' ? '>' : '<';
|
|
127
|
-
}), "</title>").concat(body)
|
|
128
|
-
: body,
|
|
129
|
-
}, className: undefined }, filteredAttributes);
|
|
130
|
-
if (attributes.className) {
|
|
131
|
-
compiledClasses.push(attributes.className);
|
|
132
|
-
}
|
|
133
|
-
if (compiledClasses.length) {
|
|
134
|
-
componentProps.className = compiledClasses.join(' ');
|
|
135
|
-
}
|
|
136
|
-
return componentProps;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
function useIconProps(props, iconBodiesAndDefs, availableSizes, name) {
|
|
140
|
-
var interactiveColorsOnGroup = props.interactiveColorsOnGroup, cleanProps = __rest(props, ["interactiveColorsOnGroup"]);
|
|
141
|
-
var _a = iconsRegistry.getComponentAttributes(__assign(__assign({}, cleanProps), { availableSizes: availableSizes, interactiveColorsOnGroup: interactiveColorsOnGroup })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
|
|
142
|
-
var _b = iconBodiesAndDefs[size] || {}, body = _b.body, defs = _b.defs;
|
|
143
|
-
if (!body) {
|
|
144
|
-
throw Error("Icon \"".concat(name, "\" is not available in size ").concat(size));
|
|
145
|
-
}
|
|
146
|
-
return compileReactIconProperties(__assign(__assign({}, cleanProps), { name: name, size: size, body: body, defs: defs, compiledClasses: compiledClasses }));
|
|
147
|
-
}
|
|
148
|
-
var IconCheckmarkSmall = function (props) { return React.createElement('svg', useIconProps(props, {
|
|
149
|
-
"16": {
|
|
150
|
-
"body": "<path d=\"M5 8.5 7.5 11 11 5\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
|
|
151
|
-
}
|
|
152
|
-
}, ["16"], "checkmark-small")); };
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
/* <wind-keep class="filter icon-light-secondary icon-dark-secondary"> */
|
|
156
|
-
|
|
157
50
|
const Classes = {
|
|
158
51
|
wrapper: 'relative flex items-center',
|
|
159
52
|
hiddenInput: 'absolute inset-0 w-0 h-0 opacity-0',
|
|
@@ -173,13 +66,13 @@ var uid = function () {
|
|
|
173
66
|
return String(Date.now().toString(32) + Math.random().toString(16)).replace(/\./g, '');
|
|
174
67
|
};
|
|
175
68
|
var Checkbox = function (_a) {
|
|
176
|
-
var _b = _a.id, id = _b === void 0 ? uid() : _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, className = _a.className, name = _a.name, rest = __rest
|
|
69
|
+
var _b = _a.id, id = _b === void 0 ? uid() : _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, className = _a.className, name = _a.name, rest = __rest(_a, ["id", "checked", "onChange", "color", "label", "disabled", "className", "name"]);
|
|
177
70
|
var _e = React.useState(checked), localChecked = _e[0], setChecked = _e[1];
|
|
178
71
|
function onChangeInput(event) {
|
|
179
72
|
setChecked(!localChecked);
|
|
180
73
|
onChange(event);
|
|
181
74
|
}
|
|
182
|
-
return (React.createElement("span", __assign
|
|
75
|
+
return (React.createElement("span", __assign({ className: clsx(className, Classes.wrapper) }, rest),
|
|
183
76
|
React.createElement("input", { id: id, className: Classes.hiddenInput, "aria-describedby": "".concat(id, "-description"), name: name || id, type: "checkbox", onChange: onChangeInput, disabled: disabled, checked: localChecked }),
|
|
184
77
|
React.createElement("label", { className: Classes.labelTag, htmlFor: id },
|
|
185
78
|
localChecked && (
|