@cypress-design/react-accordion 0.4.4 → 1.0.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/.turbo/turbo-build.log +1 -1
- package/Accordion.tsx +3 -3
- package/AccordionReact.cy.tsx +3 -3
- package/CHANGELOG.md +13 -0
- package/dist/index.es.mjs +53 -18
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +53 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
package/dist/index.umd.js
CHANGED
|
@@ -39,7 +39,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
39
39
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
40
40
|
PERFORMANCE OF THIS SOFTWARE.
|
|
41
41
|
***************************************************************************** */
|
|
42
|
-
/* global Reflect, Promise */
|
|
42
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
var __assign$1 = function() {
|
|
@@ -63,7 +63,12 @@ function __rest$1(s, e) {
|
|
|
63
63
|
t[p[i]] = s[p[i]];
|
|
64
64
|
}
|
|
65
65
|
return t;
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
69
|
+
var e = new Error(message);
|
|
70
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
71
|
+
};
|
|
67
72
|
|
|
68
73
|
const CssClasses = {
|
|
69
74
|
summary: 'details-none card open:rounded-b-none',
|
|
@@ -94,7 +99,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
94
99
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
95
100
|
PERFORMANCE OF THIS SOFTWARE.
|
|
96
101
|
***************************************************************************** */
|
|
97
|
-
/* global Reflect, Promise */
|
|
102
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
98
103
|
|
|
99
104
|
|
|
100
105
|
var __assign = function() {
|
|
@@ -118,10 +123,15 @@ function __rest(s, e) {
|
|
|
118
123
|
t[p[i]] = s[p[i]];
|
|
119
124
|
}
|
|
120
125
|
return t;
|
|
121
|
-
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
129
|
+
var e = new Error(message);
|
|
130
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
131
|
+
};
|
|
122
132
|
|
|
123
133
|
var compileReactIconProperties = function (_a) {
|
|
124
|
-
var body = _a.body, compiledClasses = _a.compiledClasses, size = _a.size, attributes = __rest(_a, ["body", "compiledClasses", "size"]);
|
|
134
|
+
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"]);
|
|
125
135
|
var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
|
|
126
136
|
if (!iconsRegistry.ICON_COLOR_PROP_NAMES.includes(attrName) &&
|
|
127
137
|
attrName !== 'name') {
|
|
@@ -132,8 +142,27 @@ var compileReactIconProperties = function (_a) {
|
|
|
132
142
|
}
|
|
133
143
|
return newAttributes;
|
|
134
144
|
}, {});
|
|
145
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
146
|
+
React__namespace.useEffect(function () {
|
|
147
|
+
var iconFileId = "".concat(name, "_").concat(size);
|
|
148
|
+
if (defs) {
|
|
149
|
+
if (document.querySelector("[data-cy-svg-defs=\"".concat(iconFileId, "\"]"))) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
var svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
153
|
+
svgElement.setAttribute('data-cy-svg-defs', iconFileId);
|
|
154
|
+
svgElement.setAttribute('width', '0');
|
|
155
|
+
svgElement.setAttribute('height', '0');
|
|
156
|
+
svgElement.innerHTML = defs;
|
|
157
|
+
document.body.appendChild(svgElement);
|
|
158
|
+
}
|
|
159
|
+
}, [defs, name, size]);
|
|
135
160
|
var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
|
|
136
|
-
__html:
|
|
161
|
+
__html: alt
|
|
162
|
+
? "<title>".concat(alt.replace(/[><]/g, function (s) {
|
|
163
|
+
return s === '>' ? '>' : '<';
|
|
164
|
+
}), "</title>").concat(body)
|
|
165
|
+
: body,
|
|
137
166
|
}, className: undefined }, filteredAttributes);
|
|
138
167
|
if (attributes.className) {
|
|
139
168
|
compiledClasses.push(attributes.className);
|
|
@@ -143,21 +172,27 @@ var compileReactIconProperties = function (_a) {
|
|
|
143
172
|
}
|
|
144
173
|
return componentProps;
|
|
145
174
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
};
|
|
152
|
-
var body = iconBodies[size];
|
|
175
|
+
|
|
176
|
+
function useIconProps(props, iconBodiesAndDefs, availableSizes, name) {
|
|
177
|
+
var interactiveColorsOnGroup = props.interactiveColorsOnGroup, cleanProps = __rest(props, ["interactiveColorsOnGroup"]);
|
|
178
|
+
var _a = iconsRegistry__namespace.getComponentAttributes(__assign(__assign({}, cleanProps), { availableSizes: availableSizes, interactiveColorsOnGroup: interactiveColorsOnGroup })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
|
|
179
|
+
var _b = iconBodiesAndDefs[size] || {}, body = _b.body, defs = _b.defs;
|
|
153
180
|
if (!body) {
|
|
154
|
-
throw Error("Icon \"
|
|
181
|
+
throw Error("Icon \"".concat(name, "\" is not available in size ").concat(size));
|
|
155
182
|
}
|
|
156
|
-
return
|
|
157
|
-
}
|
|
183
|
+
return compileReactIconProperties(__assign(__assign({}, cleanProps), { name: name, size: size, body: body, defs: defs, compiledClasses: compiledClasses }));
|
|
184
|
+
}
|
|
185
|
+
var IconChevronDownSmall = function (props) { return React__namespace.createElement('svg', useIconProps(props, {
|
|
186
|
+
"8": {
|
|
187
|
+
"body": "<path d=\"m1 2.5 3 3 3-3\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
|
|
188
|
+
},
|
|
189
|
+
"16": {
|
|
190
|
+
"body": "<path d=\"m4 6 4 4 4-4\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
|
|
191
|
+
}
|
|
192
|
+
}, ["8", "16"], "chevron-down-small")); };
|
|
158
193
|
|
|
159
194
|
|
|
160
|
-
/* <wind-keep class="filter"> */
|
|
195
|
+
/* <wind-keep class="filter icon-light-secondary icon-dark-secondary"> */
|
|
161
196
|
|
|
162
197
|
var Accordion = function (_a) {
|
|
163
198
|
var title = _a.title, description = _a.description, Icon = _a.icon, iconEl = _a.iconEl, _b = _a.separator, separator = _b === void 0 ? false : _b, children = _a.children, headingClassName = _a.headingClassName, titleClassName = _a.titleClassName, descriptionClassName = _a.descriptionClassName, fullWidthContent = _a.fullWidthContent, rest = __rest$1(_a, ["title", "description", "icon", "iconEl", "separator", "children", "headingClassName", "titleClassName", "descriptionClassName", "fullWidthContent"]);
|
|
@@ -184,4 +219,4 @@ var Accordion = function (_a) {
|
|
|
184
219
|
module.exports = Accordion;
|
|
185
220
|
//# sourceMappingURL=index.umd.js.map
|
|
186
221
|
|
|
187
|
-
/* <wind-keep class="flex-grow grow pr-[16px] open:rounded-b-none flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px] bg-white text-[18px] leading-[28px] font-medium text-indigo-500 block text-[14px] leading-[20px] font-normal text-gray-700 mr-[24px] flex-shrink-0 w-[1px] h-[40px] bg-gray-100 mr-[16px] transition transform rotate-0 open:rotate-180 border border-gray-100 rounded-b-md border-t-0 py-[16px]"> */
|
|
222
|
+
/* <wind-keep class="flex-grow grow pr-[16px] open:icon-dark-gray-500 details-none card open:rounded-b-none flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px] bg-white text-[18px] leading-[28px] font-medium text-indigo-500 block text-[14px] leading-[20px] font-normal text-gray-700 mr-[24px] flex-shrink-0 w-[1px] h-[40px] bg-gray-100 mr-[16px] transition transform rotate-0 open:rotate-180 border border-gray-100 rounded-b-md border-t-0 py-[16px]"> */
|