@cypress-design/react-accordion 1.0.0 → 1.0.1

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:4038) 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 13.8s
6
8
  $ tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @cypress-design/react-accordion
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ - Updated dependencies [[`927097f`](https://github.com/cypress-io/cypress-design/commit/927097f409235ac78c98b281c4d9b2ec70dfe01d), [`927097f`](https://github.com/cypress-io/cypress-design/commit/927097f409235ac78c98b281c4d9b2ec70dfe01d)]:
10
+ - @cypress-design/react-icon@1.1.0
11
+
3
12
  ## 1.0.0
4
13
 
5
14
  ### Major Changes
package/dist/index.es.mjs CHANGED
@@ -1,68 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import clsx from 'clsx';
3
+ import { CssClasses } from '@cypress-design/constants-accordion';
3
4
  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';
6
-
7
- /******************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise, SuppressedError, Symbol */
22
-
23
-
24
- var __assign$1 = function() {
25
- __assign$1 = Object.assign || function __assign(t) {
26
- for (var s, i = 1, n = arguments.length; i < n; i++) {
27
- s = arguments[i];
28
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
29
- }
30
- return t;
31
- };
32
- return __assign$1.apply(this, arguments);
33
- };
34
-
35
- function __rest$1(s, e) {
36
- var t = {};
37
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
- t[p] = s[p];
39
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
- t[p[i]] = s[p[i]];
43
- }
44
- return t;
45
- }
46
-
47
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
48
- var e = new Error(message);
49
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
50
- };
51
-
52
- const CssClasses = {
53
- summary: 'details-none card open:rounded-b-none',
54
- summaryDiv: 'flex flex-row py-[12px] px-[24px] flex-nowrap items-center min-h-[63px]',
55
- summaryColor: 'bg-white',
56
- summaryTitle: 'text-[18px] leading-[28px] font-medium',
57
- summaryTitleColor: 'text-indigo-500 block',
58
- summaryDescription: 'text-[14px] leading-[20px] font-normal block',
59
- summaryDescriptionColor: 'text-gray-700',
60
- icon: 'mr-[24px] flex-shrink-0',
61
- separator: 'w-[1px] h-[40px] bg-gray-100 mr-[16px]',
62
- chevron: 'flex-shrink-0 transition transform rotate-0 open:rotate-180',
63
- contentWrapper: 'border border-gray-100 rounded-b-md border-t-0',
64
- content: 'px-[24px] py-[16px]',
65
- };
5
+ import { IconChevronDownSmall } from '@cypress-design/react-icon';
66
6
 
67
7
  /******************************************************************************
68
8
  Copyright (c) Microsoft Corporation.
@@ -109,72 +49,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
109
49
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
110
50
  };
111
51
 
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
52
  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"]);
53
+ 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
54
  var details = React.useRef(null);
179
55
  var content = React.useRef(null);
180
56
  React.useEffect(function () {
@@ -182,7 +58,7 @@ var Accordion = function (_a) {
182
58
  new DetailsAnimation(details.current, content.current);
183
59
  }
184
60
  }, []);
185
- return (React.createElement("details", __assign$1({}, rest, { className: clsx(rest.className), ref: details }),
61
+ return (React.createElement("details", __assign({}, rest, { className: clsx(rest.className), ref: details }),
186
62
  React.createElement("summary", { className: clsx(CssClasses.summary, headingClassName !== null && headingClassName !== void 0 ? headingClassName : CssClasses.summaryColor) },
187
63
  React.createElement("span", { className: CssClasses.summaryDiv },
188
64
  Boolean(iconEl) && React.createElement("span", { className: CssClasses.icon }, iconEl),
@@ -198,4 +74,4 @@ var Accordion = function (_a) {
198
74
  export { Accordion as default };
199
75
  //# sourceMappingURL=index.es.mjs.map
200
76
 
201
- /* <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]"> */
77
+ /* <wind-keep class="flex-grow grow pr-[16px] open:icon-dark-gray-500"> */