@cypress-design/react-docmenu 1.0.0 → 1.0.2
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 +2 -0
- package/CHANGELOG.md +15 -0
- package/dist/index.es.mjs +7 -117
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +8 -118
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
- package/rollup.config.mjs +5 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
$ yarn build:module && yarn build:types
|
|
2
2
|
$ rollup -c ./rollup.config.mjs
|
|
3
|
+
(node:4121) 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
7
|
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [1m17.7s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @cypress-design/react-docmenu
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#454](https://github.com/cypress-io/cypress-design/pull/454) [`48a3f6c`](https://github.com/cypress-io/cypress-design/commit/48a3f6cc5957844de2a5164137a8cedc31abe673) Thanks [@elevatebart](https://github.com/elevatebart)! - make sure the constant packages roll up in the react components for tailwind class detection
|
|
8
|
+
|
|
9
|
+
## 1.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#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
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`927097f`](https://github.com/cypress-io/cypress-design/commit/927097f409235ac78c98b281c4d9b2ec70dfe01d), [`927097f`](https://github.com/cypress-io/cypress-design/commit/927097f409235ac78c98b281c4d9b2ec70dfe01d)]:
|
|
16
|
+
- @cypress-design/react-icon@1.1.0
|
|
17
|
+
|
|
3
18
|
## 1.0.0
|
|
4
19
|
|
|
5
20
|
### Major Changes
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,52 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IconChevronDownSmall } from '@cypress-design/react-icon';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
|
-
import * as iconsRegistry from '@cypress-design/icon-registry';
|
|
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
|
-
};
|
|
50
4
|
|
|
51
5
|
/******************************************************************************
|
|
52
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -93,70 +47,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
93
47
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
94
48
|
};
|
|
95
49
|
|
|
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
50
|
const classes = {
|
|
161
51
|
expandedIcon: 'absolute left-0 transform transition-transform text-gray-400 dark:text-gray-700',
|
|
162
52
|
button: 'flex leading-[24px] py-[10px] items-center relative w-full text-start',
|
|
@@ -170,7 +60,7 @@ var DocLink = React.forwardRef(function (_a, ref) {
|
|
|
170
60
|
var activeLIRef = React.useRef(null);
|
|
171
61
|
var active = React.useMemo(function () { return item.href === context.activePath; }, [item.href, context.activePath]);
|
|
172
62
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
173
|
-
item.label; var itemRest = __rest
|
|
63
|
+
item.label; var itemRest = __rest(item, ["label"]);
|
|
174
64
|
var setActiveMarkerPosition = function () {
|
|
175
65
|
var _a;
|
|
176
66
|
if (active) {
|
|
@@ -208,7 +98,7 @@ var DocLink = React.forwardRef(function (_a, ref) {
|
|
|
208
98
|
setActiveMarkerPosition: setActiveMarkerPosition,
|
|
209
99
|
}); });
|
|
210
100
|
return (React.createElement("li", { ref: activeLIRef, className: "list-none p-0 scroll-my-10" },
|
|
211
|
-
React.createElement(LinkComponent, __assign
|
|
101
|
+
React.createElement(LinkComponent, __assign({}, itemRest, { className: clsx('group relative block w-full pl-[24px]', {
|
|
212
102
|
'text-indigo-500 dark:text-indigo-400': active,
|
|
213
103
|
'text-gray-700 dark:text-gray-500': !active,
|
|
214
104
|
'py-[8px] text-[16px] leading-[24px]': depth < 0,
|
|
@@ -339,7 +229,7 @@ var DocGroup = React.forwardRef(function (_a, ref) {
|
|
|
339
229
|
});
|
|
340
230
|
DocGroup.displayName = 'DocMenuDocGroup';
|
|
341
231
|
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
|
|
232
|
+
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
233
|
var $groups = React.useRef([]);
|
|
344
234
|
var $items = React.useRef([]);
|
|
345
235
|
var reTriggerSetActiveGroup = React.useCallback(function (index) {
|
|
@@ -371,7 +261,7 @@ var DocGroupElements = React.forwardRef(function (_a, ref) {
|
|
|
371
261
|
updateMarkerPosition === null || updateMarkerPosition === void 0 ? void 0 : updateMarkerPosition();
|
|
372
262
|
}
|
|
373
263
|
}, [updateMarkerPosition, reTriggerSetActiveGroup, items, activePath]);
|
|
374
|
-
return (React.createElement("ul", __assign
|
|
264
|
+
return (React.createElement("ul", __assign({}, rest, { className: clsx('list-none p-0', className) }), items.map(function (item, index) {
|
|
375
265
|
return 'items' in item ? (React.createElement("li", { key: index, className: "relative list-none p-0" },
|
|
376
266
|
React.createElement(DocGroup, { ref: function (el) {
|
|
377
267
|
$groups.current[index] = el;
|
|
@@ -385,7 +275,7 @@ var DocGroupElements = React.forwardRef(function (_a, ref) {
|
|
|
385
275
|
DocGroupElements.displayName = 'DocMenuDocGroupElements';
|
|
386
276
|
|
|
387
277
|
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
|
|
278
|
+
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
279
|
var _e = React.useState(0), activeTop = _e[0], setActiveTop = _e[1];
|
|
390
280
|
var _f = React.useState(36), activeHeight = _f[0], setActiveHeight = _f[1];
|
|
391
281
|
var _g = React.useState(false), showMarker = _g[0], setShowMarker = _g[1];
|
|
@@ -419,7 +309,7 @@ var DocMenu = function (_a) {
|
|
|
419
309
|
? 'height .3s ease-in-out, top .3s ease-in-out'
|
|
420
310
|
: 'none',
|
|
421
311
|
} })) : null,
|
|
422
|
-
React.createElement(DocGroupElements, __assign
|
|
312
|
+
React.createElement(DocGroupElements, __assign({}, rest, { items: items, depth: -1, markerIsMoving: markerIsMoving, onActivePosition: setActivePosition, LinkComponent: LinkComponent, context: {
|
|
423
313
|
setMarkerIsMoving: setMarkerIsMoving,
|
|
424
314
|
activePath: activePath,
|
|
425
315
|
collapsible: collapsible,
|