@cypress-design/react-accordion 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.
@@ -1,6 +1,8 @@
1
1
  $ yarn build:module && yarn build:types
2
2
  $ rollup -c ./rollup.config.mjs
3
+ (node:4114) 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
  
4
6
  ./index.ts → ./dist/index.umd.js, ./dist/index.es.mjs...
5
- created ./dist/index.umd.js, ./dist/index.es.mjs in 14.2s
7
+ created ./dist/index.umd.js, ./dist/index.es.mjs in 14.5s
6
8
  $ tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @cypress-design/react-accordion
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,8 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { DetailsAnimation } from '@cypress-design/details-animation';
4
- import * as iconsRegistry from '@cypress-design/icon-registry';
5
- import { ICON_COLOR_PROP_NAMES } from '@cypress-design/icon-registry';
4
+ import { IconChevronDownSmall } from '@cypress-design/react-icon';
6
5
 
7
6
  /******************************************************************************
8
7
  Copyright (c) Microsoft Corporation.
@@ -21,18 +20,18 @@ PERFORMANCE OF THIS SOFTWARE.
21
20
  /* global Reflect, Promise, SuppressedError, Symbol */
22
21
 
23
22
 
24
- var __assign$1 = function() {
25
- __assign$1 = Object.assign || function __assign(t) {
23
+ var __assign = function() {
24
+ __assign = Object.assign || function __assign(t) {
26
25
  for (var s, i = 1, n = arguments.length; i < n; i++) {
27
26
  s = arguments[i];
28
27
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
29
28
  }
30
29
  return t;
31
30
  };
32
- return __assign$1.apply(this, arguments);
31
+ return __assign.apply(this, arguments);
33
32
  };
34
33
 
35
- function __rest$1(s, e) {
34
+ function __rest(s, e) {
36
35
  var t = {};
37
36
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
37
  t[p] = s[p];
@@ -64,117 +63,8 @@ const CssClasses = {
64
63
  content: 'px-[24px] py-[16px]',
65
64
  };
66
65
 
67
- /******************************************************************************
68
- Copyright (c) Microsoft Corporation.
69
-
70
- Permission to use, copy, modify, and/or distribute this software for any
71
- purpose with or without fee is hereby granted.
72
-
73
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
74
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
75
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
76
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
77
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
78
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
79
- PERFORMANCE OF THIS SOFTWARE.
80
- ***************************************************************************** */
81
- /* global Reflect, Promise, SuppressedError, Symbol */
82
-
83
-
84
- var __assign = function() {
85
- __assign = Object.assign || function __assign(t) {
86
- for (var s, i = 1, n = arguments.length; i < n; i++) {
87
- s = arguments[i];
88
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
89
- }
90
- return t;
91
- };
92
- return __assign.apply(this, arguments);
93
- };
94
-
95
- function __rest(s, e) {
96
- var t = {};
97
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
98
- t[p] = s[p];
99
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
100
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
101
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
102
- t[p[i]] = s[p[i]];
103
- }
104
- return t;
105
- }
106
-
107
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
108
- var e = new Error(message);
109
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
110
- };
111
-
112
- var compileReactIconProperties = function (_a) {
113
- 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"]);
114
- var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
115
- if (!ICON_COLOR_PROP_NAMES.includes(attrName) &&
116
- attrName !== 'name') {
117
- // @ts-expect-error the ky of React's SVGProps is too broad and
118
- // breaks here. Since we do not need to check for it. We keep the expect error
119
- newAttributes[attrName] =
120
- attributes[attrName];
121
- }
122
- return newAttributes;
123
- }, {});
124
- // eslint-disable-next-line react-hooks/rules-of-hooks
125
- React.useEffect(function () {
126
- var iconFileId = "".concat(name, "_").concat(size);
127
- if (defs) {
128
- if (document.querySelector("[data-cy-svg-defs=\"".concat(iconFileId, "\"]"))) {
129
- return;
130
- }
131
- var svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
132
- svgElement.setAttribute('data-cy-svg-defs', iconFileId);
133
- svgElement.setAttribute('width', '0');
134
- svgElement.setAttribute('height', '0');
135
- svgElement.innerHTML = defs;
136
- document.body.appendChild(svgElement);
137
- }
138
- }, [defs, name, size]);
139
- var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
140
- __html: alt
141
- ? "<title>".concat(alt.replace(/[><]/g, function (s) {
142
- return s === '>' ? '&gt;' : '&lt;';
143
- }), "</title>").concat(body)
144
- : body,
145
- }, className: undefined }, filteredAttributes);
146
- if (attributes.className) {
147
- compiledClasses.push(attributes.className);
148
- }
149
- if (compiledClasses.length) {
150
- componentProps.className = compiledClasses.join(' ');
151
- }
152
- return componentProps;
153
- };
154
-
155
- function useIconProps(props, iconBodiesAndDefs, availableSizes, name) {
156
- var interactiveColorsOnGroup = props.interactiveColorsOnGroup, cleanProps = __rest(props, ["interactiveColorsOnGroup"]);
157
- var _a = iconsRegistry.getComponentAttributes(__assign(__assign({}, cleanProps), { availableSizes: availableSizes, interactiveColorsOnGroup: interactiveColorsOnGroup })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
158
- var _b = iconBodiesAndDefs[size] || {}, body = _b.body, defs = _b.defs;
159
- if (!body) {
160
- throw Error("Icon \"".concat(name, "\" is not available in size ").concat(size));
161
- }
162
- return compileReactIconProperties(__assign(__assign({}, cleanProps), { name: name, size: size, body: body, defs: defs, compiledClasses: compiledClasses }));
163
- }
164
- var IconChevronDownSmall = function (props) { return React.createElement('svg', useIconProps(props, {
165
- "8": {
166
- "body": "<path d=\"m1 2.5 3 3 3-3\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
167
- },
168
- "16": {
169
- "body": "<path d=\"m4 6 4 4 4-4\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
170
- }
171
- }, ["8", "16"], "chevron-down-small")); };
172
-
173
-
174
- /* <wind-keep class="filter icon-light-secondary icon-dark-secondary"> */
175
-
176
66
  var Accordion = function (_a) {
177
- 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"]);
67
+ 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(_a, ["title", "description", "icon", "iconEl", "separator", "children", "headingClassName", "titleClassName", "descriptionClassName", "fullWidthContent"]);
178
68
  var details = React.useRef(null);
179
69
  var content = React.useRef(null);
180
70
  React.useEffect(function () {
@@ -182,7 +72,7 @@ var Accordion = function (_a) {
182
72
  new DetailsAnimation(details.current, content.current);
183
73
  }
184
74
  }, []);
185
- return (React.createElement("details", __assign$1({}, rest, { className: clsx(rest.className), ref: details }),
75
+ return (React.createElement("details", __assign({}, rest, { className: clsx(rest.className), ref: details }),
186
76
  React.createElement("summary", { className: clsx(CssClasses.summary, headingClassName !== null && headingClassName !== void 0 ? headingClassName : CssClasses.summaryColor) },
187
77
  React.createElement("span", { className: CssClasses.summaryDiv },
188
78
  Boolean(iconEl) && React.createElement("span", { className: CssClasses.icon }, iconEl),