@cypress-design/react-docmenu 0.3.0 → 0.3.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +9 -0
- package/_DocGroup.tsx +6 -6
- package/_DocLink.tsx +3 -1
- package/dist/_DocLink.d.ts.map +1 -1
- package/dist/index.es.mjs +20 -7
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +20 -7
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -38,7 +38,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
38
38
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
39
|
PERFORMANCE OF THIS SOFTWARE.
|
|
40
40
|
***************************************************************************** */
|
|
41
|
-
/* global Reflect, Promise */
|
|
41
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
var __assign$1 = function() {
|
|
@@ -72,7 +72,12 @@ function __spreadArray(to, from, pack) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
78
|
+
var e = new Error(message);
|
|
79
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
80
|
+
};
|
|
76
81
|
|
|
77
82
|
var DocLink = function (_a) {
|
|
78
83
|
var item = _a.item, collapsible = _a.collapsible, _b = _a.depth, depth = _b === void 0 ? -1 : _b, onActive = _a.onActive;
|
|
@@ -84,6 +89,8 @@ var DocLink = function (_a) {
|
|
|
84
89
|
if (item.active) {
|
|
85
90
|
onActive === null || onActive === void 0 ? void 0 : onActive(((_a = activeLIRef === null || activeLIRef === void 0 ? void 0 : activeLIRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0);
|
|
86
91
|
}
|
|
92
|
+
// supposed to happen only on mount
|
|
93
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
87
94
|
}, []);
|
|
88
95
|
return (React__namespace.createElement("li", { ref: activeLIRef, className: clsx('list-none p-0', {
|
|
89
96
|
'pl-[16px]': depth >= 0,
|
|
@@ -115,7 +122,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
115
122
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
116
123
|
PERFORMANCE OF THIS SOFTWARE.
|
|
117
124
|
***************************************************************************** */
|
|
118
|
-
/* global Reflect, Promise */
|
|
125
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
119
126
|
|
|
120
127
|
|
|
121
128
|
var __assign = function() {
|
|
@@ -139,7 +146,12 @@ function __rest(s, e) {
|
|
|
139
146
|
t[p[i]] = s[p[i]];
|
|
140
147
|
}
|
|
141
148
|
return t;
|
|
142
|
-
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
152
|
+
var e = new Error(message);
|
|
153
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
154
|
+
};
|
|
143
155
|
|
|
144
156
|
var compileReactIconProperties = function (_a) {
|
|
145
157
|
var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name"]);
|
|
@@ -153,6 +165,7 @@ var compileReactIconProperties = function (_a) {
|
|
|
153
165
|
}
|
|
154
166
|
return newAttributes;
|
|
155
167
|
}, {});
|
|
168
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
156
169
|
React__namespace.useEffect(function () {
|
|
157
170
|
var iconFileId = "".concat(name, "_").concat(size);
|
|
158
171
|
if (defs) {
|
|
@@ -166,7 +179,7 @@ var compileReactIconProperties = function (_a) {
|
|
|
166
179
|
svgElement.innerHTML = defs;
|
|
167
180
|
document.body.appendChild(svgElement);
|
|
168
181
|
}
|
|
169
|
-
}, [defs]);
|
|
182
|
+
}, [defs, name, size]);
|
|
170
183
|
var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
|
|
171
184
|
__html: body,
|
|
172
185
|
}, className: undefined }, filteredAttributes);
|
|
@@ -213,14 +226,14 @@ var DocGroup = function (_a) {
|
|
|
213
226
|
var _e = React__namespace.useState(Array(group.items.length).fill(1)), itemsHeights = _e[0], setItemsHeights = _e[1];
|
|
214
227
|
React__namespace.useEffect(function () {
|
|
215
228
|
setHeight === null || setHeight === void 0 ? void 0 : setHeight(open ? itemsHeights.reduce(function (a, b) { return a + b; }, 1) : 1);
|
|
216
|
-
}, [itemsHeights, open]);
|
|
229
|
+
}, [itemsHeights, open, setHeight]);
|
|
217
230
|
var _f = React__namespace.useState(0), activeTop = _f[0], setActiveTop = _f[1];
|
|
218
231
|
React__namespace.useEffect(function () {
|
|
219
232
|
var activeItem = group.items.findIndex(function (item) { return 'href' in item && item.active; });
|
|
220
233
|
if (activeItem >= 0) {
|
|
221
234
|
setActiveTop(itemsHeights.slice(0, activeItem).reduce(function (a, b) { return a + b; }, 1) * 44);
|
|
222
235
|
}
|
|
223
|
-
}, [itemsHeights]);
|
|
236
|
+
}, [itemsHeights, group.items]);
|
|
224
237
|
function toggleMenu(open) {
|
|
225
238
|
if (!collapsible)
|
|
226
239
|
return;
|