@cypress-design/react-docmenu 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.
- package/.turbo/turbo-build.log +3 -1
- package/CHANGELOG.md +9 -0
- package/dist/index.es.mjs +9 -126
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +14 -131
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/rollup.config.mjs +5 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
$ yarn build:module && yarn build:types
|
|
2
2
|
$ rollup -c ./rollup.config.mjs
|
|
3
|
+
(node:4045) 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
|
[36m
|
|
4
6
|
[1m./index.ts[22m → [1m./dist/index.umd.js, ./dist/index.es.mjs[22m...[39m
|
|
5
|
-
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [
|
|
7
|
+
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [1m18.6s[22m[39m
|
|
6
8
|
$ tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @cypress-design/react-docmenu
|
|
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,52 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IconChevronDownSmall } from '@cypress-design/react-icon';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
|
-
import
|
|
4
|
-
import { ICON_COLOR_PROP_NAMES } from '@cypress-design/icon-registry';
|
|
5
|
-
|
|
6
|
-
/******************************************************************************
|
|
7
|
-
Copyright (c) Microsoft Corporation.
|
|
8
|
-
|
|
9
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
-
purpose with or without fee is hereby granted.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */
|
|
20
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var __assign$1 = function() {
|
|
24
|
-
__assign$1 = Object.assign || function __assign(t) {
|
|
25
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
26
|
-
s = arguments[i];
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
};
|
|
31
|
-
return __assign$1.apply(this, arguments);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
function __rest$1(s, e) {
|
|
35
|
-
var t = {};
|
|
36
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
37
|
-
t[p] = s[p];
|
|
38
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
41
|
-
t[p[i]] = s[p[i]];
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
47
|
-
var e = new Error(message);
|
|
48
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
49
|
-
};
|
|
4
|
+
import { classes } from '@cypress-design/constants-docmenu';
|
|
50
5
|
|
|
51
6
|
/******************************************************************************
|
|
52
7
|
Copyright (c) Microsoft Corporation.
|
|
@@ -93,84 +48,12 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
93
48
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
94
49
|
};
|
|
95
50
|
|
|
96
|
-
var compileReactIconProperties = function (_a) {
|
|
97
|
-
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"]);
|
|
98
|
-
var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
|
|
99
|
-
if (!ICON_COLOR_PROP_NAMES.includes(attrName) &&
|
|
100
|
-
attrName !== 'name') {
|
|
101
|
-
// @ts-expect-error the ky of React's SVGProps is too broad and
|
|
102
|
-
// breaks here. Since we do not need to check for it. We keep the expect error
|
|
103
|
-
newAttributes[attrName] =
|
|
104
|
-
attributes[attrName];
|
|
105
|
-
}
|
|
106
|
-
return newAttributes;
|
|
107
|
-
}, {});
|
|
108
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
109
|
-
React.useEffect(function () {
|
|
110
|
-
var iconFileId = "".concat(name, "_").concat(size);
|
|
111
|
-
if (defs) {
|
|
112
|
-
if (document.querySelector("[data-cy-svg-defs=\"".concat(iconFileId, "\"]"))) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
var svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
116
|
-
svgElement.setAttribute('data-cy-svg-defs', iconFileId);
|
|
117
|
-
svgElement.setAttribute('width', '0');
|
|
118
|
-
svgElement.setAttribute('height', '0');
|
|
119
|
-
svgElement.innerHTML = defs;
|
|
120
|
-
document.body.appendChild(svgElement);
|
|
121
|
-
}
|
|
122
|
-
}, [defs, name, size]);
|
|
123
|
-
var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
|
|
124
|
-
__html: alt
|
|
125
|
-
? "<title>".concat(alt.replace(/[><]/g, function (s) {
|
|
126
|
-
return s === '>' ? '>' : '<';
|
|
127
|
-
}), "</title>").concat(body)
|
|
128
|
-
: body,
|
|
129
|
-
}, className: undefined }, filteredAttributes);
|
|
130
|
-
if (attributes.className) {
|
|
131
|
-
compiledClasses.push(attributes.className);
|
|
132
|
-
}
|
|
133
|
-
if (compiledClasses.length) {
|
|
134
|
-
componentProps.className = compiledClasses.join(' ');
|
|
135
|
-
}
|
|
136
|
-
return componentProps;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
function useIconProps(props, iconBodiesAndDefs, availableSizes, name) {
|
|
140
|
-
var interactiveColorsOnGroup = props.interactiveColorsOnGroup, cleanProps = __rest(props, ["interactiveColorsOnGroup"]);
|
|
141
|
-
var _a = iconsRegistry.getComponentAttributes(__assign(__assign({}, cleanProps), { availableSizes: availableSizes, interactiveColorsOnGroup: interactiveColorsOnGroup })), size = _a.sizeWithDefault, compiledClasses = _a.compiledClasses;
|
|
142
|
-
var _b = iconBodiesAndDefs[size] || {}, body = _b.body, defs = _b.defs;
|
|
143
|
-
if (!body) {
|
|
144
|
-
throw Error("Icon \"".concat(name, "\" is not available in size ").concat(size));
|
|
145
|
-
}
|
|
146
|
-
return compileReactIconProperties(__assign(__assign({}, cleanProps), { name: name, size: size, body: body, defs: defs, compiledClasses: compiledClasses }));
|
|
147
|
-
}
|
|
148
|
-
var IconChevronDownSmall = function (props) { return React.createElement('svg', useIconProps(props, {
|
|
149
|
-
"8": {
|
|
150
|
-
"body": "<path d=\"m1 2.5 3 3 3-3\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
|
|
151
|
-
},
|
|
152
|
-
"16": {
|
|
153
|
-
"body": "<path d=\"m4 6 4 4 4-4\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
|
|
154
|
-
}
|
|
155
|
-
}, ["8", "16"], "chevron-down-small")); };
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/* <wind-keep class="filter icon-light-secondary icon-dark-secondary"> */
|
|
159
|
-
|
|
160
|
-
const classes = {
|
|
161
|
-
expandedIcon: 'absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700',
|
|
162
|
-
button: 'flex leading-[24px] py-[10px] items-center relative w-full text-start',
|
|
163
|
-
topButton: 'leading-[24px] text-[16px] pl-[24px] font-medium',
|
|
164
|
-
leafButton: 'leading-[20px] text-[14px] pl-[48px]',
|
|
165
|
-
openListBorderLeft: 'absolute left-[8px] top-0 w-[1px] h-full bg-gray-100 dark:bg-gray-900',
|
|
166
|
-
};
|
|
167
|
-
|
|
168
51
|
var DocLink = React.forwardRef(function (_a, ref) {
|
|
169
52
|
var item = _a.item, depth = _a.depth, markerIsMoving = _a.markerIsMoving, context = _a.context, onActive = _a.onActive, LinkComponent = _a.LinkComponent;
|
|
170
53
|
var activeLIRef = React.useRef(null);
|
|
171
54
|
var active = React.useMemo(function () { return item.href === context.activePath; }, [item.href, context.activePath]);
|
|
172
55
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
173
|
-
item.label; var itemRest = __rest
|
|
56
|
+
item.label; var itemRest = __rest(item, ["label"]);
|
|
174
57
|
var setActiveMarkerPosition = function () {
|
|
175
58
|
var _a;
|
|
176
59
|
if (active) {
|
|
@@ -208,7 +91,7 @@ var DocLink = React.forwardRef(function (_a, ref) {
|
|
|
208
91
|
setActiveMarkerPosition: setActiveMarkerPosition,
|
|
209
92
|
}); });
|
|
210
93
|
return (React.createElement("li", { ref: activeLIRef, className: "list-none p-0 scroll-my-10" },
|
|
211
|
-
React.createElement(LinkComponent, __assign
|
|
94
|
+
React.createElement(LinkComponent, __assign({}, itemRest, { className: clsx('group relative block w-full pl-[24px]', {
|
|
212
95
|
'text-indigo-500 dark:text-indigo-400': active,
|
|
213
96
|
'text-gray-700 dark:text-gray-500': !active,
|
|
214
97
|
'py-[8px] text-[16px] leading-[24px]': depth < 0,
|
|
@@ -339,7 +222,7 @@ var DocGroup = React.forwardRef(function (_a, ref) {
|
|
|
339
222
|
});
|
|
340
223
|
DocGroup.displayName = 'DocMenuDocGroup';
|
|
341
224
|
var DocGroupElements = React.forwardRef(function (_a, ref) {
|
|
342
|
-
var items = _a.items, _b = _a.depth, depth = _b === void 0 ? 0 : _b, onActivePosition = _a.onActivePosition, updateMarkerPosition = _a.updateMarkerPosition, markerIsMoving = _a.markerIsMoving, LinkComponent = _a.LinkComponent, className = _a.className, context = _a.context, rest = __rest
|
|
225
|
+
var items = _a.items, _b = _a.depth, depth = _b === void 0 ? 0 : _b, onActivePosition = _a.onActivePosition, updateMarkerPosition = _a.updateMarkerPosition, markerIsMoving = _a.markerIsMoving, LinkComponent = _a.LinkComponent, className = _a.className, context = _a.context, rest = __rest(_a, ["items", "depth", "onActivePosition", "updateMarkerPosition", "markerIsMoving", "LinkComponent", "className", "context"]);
|
|
343
226
|
var $groups = React.useRef([]);
|
|
344
227
|
var $items = React.useRef([]);
|
|
345
228
|
var reTriggerSetActiveGroup = React.useCallback(function (index) {
|
|
@@ -371,7 +254,7 @@ var DocGroupElements = React.forwardRef(function (_a, ref) {
|
|
|
371
254
|
updateMarkerPosition === null || updateMarkerPosition === void 0 ? void 0 : updateMarkerPosition();
|
|
372
255
|
}
|
|
373
256
|
}, [updateMarkerPosition, reTriggerSetActiveGroup, items, activePath]);
|
|
374
|
-
return (React.createElement("ul", __assign
|
|
257
|
+
return (React.createElement("ul", __assign({}, rest, { className: clsx('list-none p-0', className) }), items.map(function (item, index) {
|
|
375
258
|
return 'items' in item ? (React.createElement("li", { key: index, className: "relative list-none p-0" },
|
|
376
259
|
React.createElement(DocGroup, { ref: function (el) {
|
|
377
260
|
$groups.current[index] = el;
|
|
@@ -385,7 +268,7 @@ var DocGroupElements = React.forwardRef(function (_a, ref) {
|
|
|
385
268
|
DocGroupElements.displayName = 'DocMenuDocGroupElements';
|
|
386
269
|
|
|
387
270
|
var DocMenu = function (_a) {
|
|
388
|
-
var items = _a.items, _b = _a.activePath, activePath = _b === void 0 ? '<unknown>' : _b, _c = _a.collapsible, collapsible = _c === void 0 ? true : _c, _d = _a.LinkComponent, LinkComponent = _d === void 0 ? 'a' : _d, rest = __rest
|
|
271
|
+
var items = _a.items, _b = _a.activePath, activePath = _b === void 0 ? '<unknown>' : _b, _c = _a.collapsible, collapsible = _c === void 0 ? true : _c, _d = _a.LinkComponent, LinkComponent = _d === void 0 ? 'a' : _d, rest = __rest(_a, ["items", "activePath", "collapsible", "LinkComponent"]);
|
|
389
272
|
var _e = React.useState(0), activeTop = _e[0], setActiveTop = _e[1];
|
|
390
273
|
var _f = React.useState(36), activeHeight = _f[0], setActiveHeight = _f[1];
|
|
391
274
|
var _g = React.useState(false), showMarker = _g[0], setShowMarker = _g[1];
|
|
@@ -419,7 +302,7 @@ var DocMenu = function (_a) {
|
|
|
419
302
|
? 'height .3s ease-in-out, top .3s ease-in-out'
|
|
420
303
|
: 'none',
|
|
421
304
|
} })) : null,
|
|
422
|
-
React.createElement(DocGroupElements, __assign
|
|
305
|
+
React.createElement(DocGroupElements, __assign({}, rest, { items: items, depth: -1, markerIsMoving: markerIsMoving, onActivePosition: setActivePosition, LinkComponent: LinkComponent, context: {
|
|
423
306
|
setMarkerIsMoving: setMarkerIsMoving,
|
|
424
307
|
activePath: activePath,
|
|
425
308
|
collapsible: collapsible,
|
|
@@ -430,4 +313,4 @@ var DocMenu = function (_a) {
|
|
|
430
313
|
export { DocMenu as default };
|
|
431
314
|
//# sourceMappingURL=index.es.mjs.map
|
|
432
315
|
|
|
433
|
-
/* <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
|
|
316
|
+
/* <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"> */
|