@cypress-design/react-docmenu 0.2.3 → 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 17.1s
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,11 @@
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
+
3
9
  ## 0.2.3
4
10
 
5
11
  ### 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
@@ -68,7 +68,7 @@ var DocLink = function (_a) {
68
68
  'pl-[16px]': depth >= 0,
69
69
  }) },
70
70
  React.createElement("a", { className: clsx('group relative inline-block pl-[24px]', {
71
- 'text-indigo-500 dark:text-indigo-200': item.active,
71
+ 'text-indigo-500': item.active,
72
72
  'py-[8px] text-[16px] leading-[24px]': depth < 0,
73
73
  'py-[12px] leading-[20px] text-[14px]': depth >= 0,
74
74
  }), href: item.href },
@@ -121,7 +121,7 @@ function __rest(s, e) {
121
121
  }
122
122
 
123
123
  var compileReactIconProperties = function (_a) {
124
- 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"]);
125
125
  var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
126
126
  if (!ICON_COLOR_PROP_NAMES.includes(attrName) &&
127
127
  attrName !== 'name') {
@@ -132,6 +132,20 @@ var compileReactIconProperties = function (_a) {
132
132
  }
133
133
  return newAttributes;
134
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]);
135
149
  var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
136
150
  __html: body,
137
151
  }, className: undefined }, filteredAttributes);
@@ -143,21 +157,27 @@ var compileReactIconProperties = function (_a) {
143
157
  }
144
158
  return componentProps;
145
159
  };
146
- var IconChevronDownSmall = function (props) {
147
- var _a = iconsRegistry.getComponentAttributes(__assign(__assign({}, props), { availableSizes: ["8", "16"] })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
148
- var iconBodies = {
149
- "8": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m1 2.5 3 3 3-3\" class=\"icon-dark\"/>",
150
- "16": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m4 6 4 4 4-4\" class=\"icon-dark\"/>"
151
- };
152
- 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;
153
165
  if (!body) {
154
- 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));
155
167
  }
156
- return React.createElement('svg', compileReactIconProperties(__assign(__assign({}, props), { size: size, body: body, compiledClasses: compiledClasses })));
157
- };
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")); };
158
178
 
159
179
 
160
- /* <wind-keep class="filter"> */
180
+ /* <wind-keep class="filter icon-light-secondary icon-dark-secondary"> */
161
181
 
162
182
  const classes = {
163
183
  button: 'flex leading-[24px] py-[10px] items-center relative w-full',
@@ -195,7 +215,7 @@ var DocGroup = function (_a) {
195
215
  var Head = collapsible ? 'button' : group.href ? 'a' : 'div';
196
216
  return (React.createElement(React.Fragment, null,
197
217
  React.createElement(Head, { onClick: function () { return toggleMenu(!open); }, href: group.href, className: clsx(classes.button, (_b = {
198
- 'text-indigo-500 dark:text-indigo-200': group.active
218
+ 'text-indigo-500': group.active
199
219
  },
200
220
  _b[classes.topButton] = depth === 0,
201
221
  _b[classes.leafButton] = depth,
@@ -233,4 +253,4 @@ var DocMenu = function (_a) {
233
253
  export { DocMenu as default };
234
254
  //# sourceMappingURL=index.es.mjs.map
235
255
 
236
- /* <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 text-indigo-200 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]"> */