@cypress-design/react-docmenu 0.7.0 → 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/dist/index.umd.js CHANGED
@@ -115,7 +115,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
115
115
  };
116
116
 
117
117
  var compileReactIconProperties = function (_a) {
118
- var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name"]);
118
+ 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"]);
119
119
  var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
120
120
  if (!iconsRegistry.ICON_COLOR_PROP_NAMES.includes(attrName) &&
121
121
  attrName !== 'name') {
@@ -142,7 +142,11 @@ var compileReactIconProperties = function (_a) {
142
142
  }
143
143
  }, [defs, name, size]);
144
144
  var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
145
- __html: body,
145
+ __html: alt
146
+ ? "<title>".concat(alt.replace(/[><]/g, function (s) {
147
+ return s === '>' ? '&gt;' : '&lt;';
148
+ }), "</title>").concat(body)
149
+ : body,
146
150
  }, className: undefined }, filteredAttributes);
147
151
  if (attributes.className) {
148
152
  compiledClasses.push(attributes.className);
@@ -164,10 +168,10 @@ function useIconProps(props, iconBodiesAndDefs, availableSizes, name) {
164
168
  }
165
169
  var IconChevronDownSmall = function (props) { return React__namespace.createElement('svg', useIconProps(props, {
166
170
  "8": {
167
- "body": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m1 2.5 3 3 3-3\" class=\"icon-dark\"/>"
171
+ "body": "<path d=\"m1 2.5 3 3 3-3\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
168
172
  },
169
173
  "16": {
170
- "body": "<path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m4 6 4 4 4-4\" class=\"icon-dark\"/>"
174
+ "body": "<path d=\"m4 6 4 4 4-4\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
171
175
  }
172
176
  }, ["8", "16"], "chevron-down-small")); };
173
177
 
@@ -202,26 +206,29 @@ var DocLink = React__namespace.forwardRef(function (_a, ref) {
202
206
  // send the top position to the parent
203
207
  React__namespace.useEffect(setActiveMarkerPosition, [onActive, active]);
204
208
  React__namespace.useEffect(function () {
205
- if (active && activeLIRef.current) {
206
- // if active check if the item is visible in the
207
- // viewport and scrollIntoView if not
208
- var rect = activeLIRef.current.getBoundingClientRect();
209
- if (rect.top > 0 && rect.bottom < window.innerHeight) {
210
- return;
211
- }
212
- if (rect.left > 0 && rect.right < window.innerWidth) {
213
- return;
209
+ // if active check if the item is visible in the
210
+ // viewport and scrollIntoView if not
211
+ setTimeout(function () {
212
+ // give it time tp render and expand
213
+ if (active && activeLIRef.current) {
214
+ var rect = activeLIRef.current.getBoundingClientRect();
215
+ if (rect.top > 0 &&
216
+ rect.bottom < window.innerHeight &&
217
+ rect.left > 0 &&
218
+ rect.right < window.innerWidth) {
219
+ return;
220
+ }
221
+ activeLIRef.current.scrollIntoView({
222
+ block: 'nearest',
223
+ inline: 'nearest',
224
+ });
214
225
  }
215
- activeLIRef.current.scrollIntoView({
216
- block: 'nearest',
217
- inline: 'nearest',
218
- });
219
- }
226
+ }, 200);
220
227
  }, [active]);
221
228
  React__namespace.useImperativeHandle(ref, function () { return ({
222
229
  setActiveMarkerPosition: setActiveMarkerPosition,
223
230
  }); });
224
- return (React__namespace.createElement("li", { ref: activeLIRef, className: "list-none p-0" },
231
+ return (React__namespace.createElement("li", { ref: activeLIRef, className: "list-none p-0 scroll-my-10" },
225
232
  React__namespace.createElement(LinkComponent, __assign$1({}, itemRest, { className: clsx('group relative block w-full pl-[24px]', {
226
233
  'text-indigo-500 dark:text-indigo-400': active,
227
234
  'text-gray-700 dark:text-gray-500': !active,
@@ -444,4 +451,4 @@ var DocMenu = function (_a) {
444
451
  module.exports = DocMenu;
445
452
  //# sourceMappingURL=index.umd.js.map
446
453
 
447
- /* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 dark:bg-indigo-400 ml-[6.5px] mt-[4px] transition ease-in-out text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 transition-all grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden filter list-none p-0 visible block inline w-full pl-[24px] text-gray-700 dark:text-gray-500 py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 text-indigo-400 text-gray-500 bg-indigo-400 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */
454
+ /* <wind-keep class="container relative absolute h-[36px] w-[4px] z-50 rounded-full bg-indigo-500 dark:bg-indigo-400 ml-[6.5px] mt-[4px] transition ease-in-out text-indigo-500 dark:text-indigo-400 text-gray-900 dark:text-gray-100 text-gray-800 dark:text-gray-200 rotate-0 -rotate-90 transition-all grid grid-rows-[0fr] grid-rows-[1fr] overflow-hidden filter list-none p-0 visible block inline scroll-my-10 w-full pl-[24px] text-gray-700 dark:text-gray-500 py-[8px] text-[16px] leading-[24px] leading-[20px] text-[14px] py-[12px] left-[6.5px] top-[4px] bottom-[4px] z-10 hidden group-hover:block bg-gray-300 text-indigo-400 text-gray-500 bg-indigo-400 left-0 transform transition-transform text-gray-400 dark:text-gray-700 flex py-[10px] items-center text-start font-medium pl-[48px] left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900"> */