@cypress-design/react-docmenu 0.2.2 → 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.
@@ -2,5 +2,5 @@ $ yarn build:module && yarn build:types
2
2
  $ rollup -c ./rollup.config.mjs
3
3
  
4
4
  ./index.ts → ./dist/index.umd.js, ./dist/index.es.mjs...
5
- created ./dist/index.umd.js, ./dist/index.es.mjs in 20.5s
5
+ created ./dist/index.umd.js, ./dist/index.es.mjs in 22.3s
6
6
  $ tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @cypress-design/react-docmenu
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#272](https://github.com/cypress-io/cypress-design/pull/272) [`9a3e358`](https://github.com/cypress-io/cypress-design/commit/9a3e3582b8ca2dfdadd9198054042c9f0083be01) Thanks [@elevatebart](https://github.com/elevatebart)! - remove dark mode implementation to avoid wrong side effects
8
+
9
+ ## 0.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#245](https://github.com/cypress-io/cypress-design/pull/245) [`d52d023`](https://github.com/cypress-io/cypress-design/commit/d52d02301bb851d514661a8c258d0c4ae5baf171) Thanks [@elevatebart](https://github.com/elevatebart)! - use tailwind to rollup classes in the final package
14
+
15
+ - Updated dependencies [[`d52d023`](https://github.com/cypress-io/cypress-design/commit/d52d02301bb851d514661a8c258d0c4ae5baf171)]:
16
+ - @cypress-design/react-icon@0.22.1
17
+
3
18
  ## 0.2.2
4
19
 
5
20
  ### Patch Changes
package/_DocGroup.tsx CHANGED
@@ -60,7 +60,7 @@ export const DocGroup: React.FC<DocGroupProps> = ({
60
60
  onClick={() => toggleMenu(!open)}
61
61
  href={group.href}
62
62
  className={clsx(classes.button, {
63
- 'text-indigo-500 dark:text-indigo-200': group.active,
63
+ 'text-indigo-500': group.active,
64
64
  [classes.topButton]: depth === 0,
65
65
  [classes.leafButton]: depth,
66
66
  })}
package/_DocLink.tsx CHANGED
@@ -34,7 +34,7 @@ export const DocLink: React.FC<DocLinkProps> = ({
34
34
  >
35
35
  <a
36
36
  className={clsx('group relative inline-block pl-[24px]', {
37
- 'text-indigo-500 dark:text-indigo-200': item.active,
37
+ 'text-indigo-500': item.active,
38
38
  'py-[8px] text-[16px] leading-[24px]': depth < 0,
39
39
  'py-[12px] leading-[20px] text-[14px]': depth >= 0,
40
40
  })}
package/dist/index.es.mjs CHANGED
@@ -17,6 +17,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
17
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
18
  PERFORMANCE OF THIS SOFTWARE.
19
19
  ***************************************************************************** */
20
+ /* global Reflect, Promise */
21
+
20
22
 
21
23
  var __assign$1 = function() {
22
24
  __assign$1 = Object.assign || function __assign(t) {
@@ -66,7 +68,7 @@ var DocLink = function (_a) {
66
68
  'pl-[16px]': depth >= 0,
67
69
  }) },
68
70
  React.createElement("a", { className: clsx('group relative inline-block pl-[24px]', {
69
- 'text-indigo-500 dark:text-indigo-200': item.active,
71
+ 'text-indigo-500': item.active,
70
72
  'py-[8px] text-[16px] leading-[24px]': depth < 0,
71
73
  'py-[12px] leading-[20px] text-[14px]': depth >= 0,
72
74
  }), href: item.href },
@@ -92,6 +94,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
92
94
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
93
95
  PERFORMANCE OF THIS SOFTWARE.
94
96
  ***************************************************************************** */
97
+ /* global Reflect, Promise */
98
+
95
99
 
96
100
  var __assign = function() {
97
101
  __assign = Object.assign || function __assign(t) {
@@ -117,17 +121,34 @@ function __rest(s, e) {
117
121
  }
118
122
 
119
123
  var compileReactIconProperties = function (_a) {
120
- var body = _a.body, compiledClasses = _a.compiledClasses, size = _a.size, attributes = __rest(_a, ["body", "compiledClasses", "size"]);
124
+ var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name"]);
121
125
  var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
122
- if (!ICON_COLOR_PROP_NAMES.includes(attrName) && attrName !== 'name') {
126
+ if (!ICON_COLOR_PROP_NAMES.includes(attrName) &&
127
+ attrName !== 'name') {
128
+ // @ts-expect-error the ky of React's SVGProps is too broad and
129
+ // breaks here. Since we do not need to check for it. We keep the expect error
123
130
  newAttributes[attrName] =
124
131
  attributes[attrName];
125
132
  }
126
133
  return newAttributes;
127
134
  }, {});
135
+ React.useEffect(function () {
136
+ var iconFileId = "".concat(name, "_").concat(size);
137
+ if (defs) {
138
+ if (document.querySelector("[data-cy-svg-defs=\"".concat(iconFileId, "\"]"))) {
139
+ return;
140
+ }
141
+ var svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
142
+ svgElement.setAttribute('data-cy-svg-defs', iconFileId);
143
+ svgElement.setAttribute('width', '0');
144
+ svgElement.setAttribute('height', '0');
145
+ svgElement.innerHTML = defs;
146
+ document.body.appendChild(svgElement);
147
+ }
148
+ }, [defs]);
128
149
  var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
129
150
  __html: body,
130
- } }, filteredAttributes);
151
+ }, className: undefined }, filteredAttributes);
131
152
  if (attributes.className) {
132
153
  compiledClasses.push(attributes.className);
133
154
  }
@@ -136,21 +157,27 @@ var compileReactIconProperties = function (_a) {
136
157
  }
137
158
  return componentProps;
138
159
  };
139
- var IconChevronDownSmall = function (props) {
140
- var _a = iconsRegistry.getComponentAttributes(__assign(__assign({}, props), { availableSizes: ["8", "16"] })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
141
- var iconBodies = {
142
- "8": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m1 2.5 3 3 3-3\" class=\"icon-dark\"/>",
143
- "16": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m4 6 4 4 4-4\" class=\"icon-dark\"/>"
144
- };
145
- var body = iconBodies[size];
160
+
161
+ function useIconProps(props, iconBodiesAndDefs, availableSizes, name) {
162
+ var interactiveColorsOnGroup = props.interactiveColorsOnGroup, cleanProps = __rest(props, ["interactiveColorsOnGroup"]);
163
+ var _a = iconsRegistry.getComponentAttributes(__assign(__assign({}, cleanProps), { availableSizes: availableSizes, interactiveColorsOnGroup: interactiveColorsOnGroup })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
164
+ var _b = iconBodiesAndDefs[size] || {}, body = _b.body, defs = _b.defs;
146
165
  if (!body) {
147
- throw Error("Icon \"chevron-down-small\" is not available in size ".concat(size));
166
+ throw Error("Icon \"".concat(name, "\" is not available in size ").concat(size));
148
167
  }
149
- return React.createElement('svg', compileReactIconProperties(__assign(__assign({}, props), { size: size, body: body, compiledClasses: compiledClasses })));
150
- };
168
+ return compileReactIconProperties(__assign(__assign({}, cleanProps), { name: name, size: size, body: body, defs: defs, compiledClasses: compiledClasses }));
169
+ }
170
+ var IconChevronDownSmall = function (props) { return React.createElement('svg', useIconProps(props, {
171
+ "8": {
172
+ "body": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m1 2.5 3 3 3-3\" class=\"icon-dark\"/>"
173
+ },
174
+ "16": {
175
+ "body": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m4 6 4 4 4-4\" class=\"icon-dark\"/>"
176
+ }
177
+ }, ["8", "16"], "chevron-down-small")); };
151
178
 
152
179
 
153
- /* <wind-keep class=""> */
180
+ /* <wind-keep class="filter icon-light-secondary icon-dark-secondary"> */
154
181
 
155
182
  const classes = {
156
183
  button: 'flex leading-[24px] py-[10px] items-center relative w-full',
@@ -188,7 +215,7 @@ var DocGroup = function (_a) {
188
215
  var Head = collapsible ? 'button' : group.href ? 'a' : 'div';
189
216
  return (React.createElement(React.Fragment, null,
190
217
  React.createElement(Head, { onClick: function () { return toggleMenu(!open); }, href: group.href, className: clsx(classes.button, (_b = {
191
- 'text-indigo-500 dark:text-indigo-200': group.active
218
+ 'text-indigo-500': group.active
192
219
  },
193
220
  _b[classes.topButton] = depth === 0,
194
221
  _b[classes.leafButton] = depth,
@@ -226,4 +253,4 @@ var DocMenu = function (_a) {
226
253
  export { DocMenu as default };
227
254
  //# sourceMappingURL=index.es.mjs.map
228
255
 
229
- /* <wind-keep class="list-none p-0 relative pl-[16px] inline-block pl-[24px] text-indigo-500 dark:text-indigo-200 py-[8px] text-[16px] leading-[24px] py-[12px] leading-[20px] text-[14px] absolute w-[4px] z-10 top-[10%] h-[80%] rounded-full hidden group-hover:block bg-gray-300 transform transition-transform left-0 rotate-0 -rotate-90 ml-[16px] h-[36px] bg-indigo-500 transition-all duration-300 ml-[6px] mt-[4px] ml-[8px] border-l border-gray-100 flex py-[10px] items-center w-full font-medium pl-[40px]"> */
256
+ /* <wind-keep class="list-none p-0 relative pl-[16px] inline-block pl-[24px] text-indigo-500 py-[8px] text-[16px] leading-[24px] py-[12px] leading-[20px] text-[14px] absolute w-[4px] z-10 top-[10%] h-[80%] rounded-full hidden group-hover:block bg-gray-300 transform transition-transform left-0 rotate-0 -rotate-90 ml-[16px] h-[36px] bg-indigo-500 transition-all duration-300 ml-[6px] mt-[4px] ml-[8px] border-l border-gray-100 flex py-[10px] items-center w-full font-medium pl-[40px]"> */