@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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +18 -0
- package/DocMenuReact.cy.tsx +3 -2
- package/_DocGroup.tsx +1 -0
- package/_DocLink.tsx +22 -18
- package/dist/_DocGroup.d.ts.map +1 -1
- package/dist/_DocLink.d.ts.map +1 -1
- package/dist/index.es.mjs +27 -20
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +27 -20
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -2,5 +2,5 @@ $ yarn build:module && yarn build:types
|
|
|
2
2
|
$ rollup -c ./rollup.config.mjs
|
|
3
3
|
[36m
|
|
4
4
|
[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 [1m17.
|
|
5
|
+
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [1m17.7s[22m[39m
|
|
6
6
|
$ tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @cypress-design/react-docmenu
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`63fb4d9`](https://github.com/cypress-io/cypress-design/commit/63fb4d9e60f6c56c563d17e3b983d0ebd25e0e87) Thanks [@elevatebart](https://github.com/elevatebart)! - Create 1.0
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`63fb4d9`](https://github.com/cypress-io/cypress-design/commit/63fb4d9e60f6c56c563d17e3b983d0ebd25e0e87)]:
|
|
12
|
+
- @cypress-design/constants-docmenu@1.0.0
|
|
13
|
+
- @cypress-design/react-icon@1.0.0
|
|
14
|
+
|
|
15
|
+
## 0.7.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`ad32042`](https://github.com/cypress-io/cypress-design/commit/ad3204289730de696c9728b1343e06ce68382561) Thanks [@elevatebart](https://github.com/elevatebart)! - only skip scrolling if both dimension are in view
|
|
20
|
+
|
|
3
21
|
## 0.7.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/DocMenuReact.cy.tsx
CHANGED
|
@@ -150,7 +150,7 @@ describe('<DocMenu/>', () => {
|
|
|
150
150
|
const SUT = () => {
|
|
151
151
|
const [pathState, setPathState] = React.useState<string>('/foo')
|
|
152
152
|
return (
|
|
153
|
-
|
|
153
|
+
<div className="p-4">
|
|
154
154
|
<button
|
|
155
155
|
onClick={() => setPathState('/faa6')}
|
|
156
156
|
className="p-2 m-2 rounded bg-gray-100 border border-gray-300"
|
|
@@ -171,13 +171,14 @@ describe('<DocMenu/>', () => {
|
|
|
171
171
|
activePath={pathState}
|
|
172
172
|
collapsible
|
|
173
173
|
/>
|
|
174
|
-
|
|
174
|
+
</div>
|
|
175
175
|
)
|
|
176
176
|
}
|
|
177
177
|
mount(<SUT />)
|
|
178
178
|
|
|
179
179
|
cy.findByText('Code').click()
|
|
180
180
|
cy.contains('Set path to').click()
|
|
181
|
+
cy.wait(200)
|
|
181
182
|
cy.contains('Quisquam, quos').then(($el) => {
|
|
182
183
|
const windowInnerHeight = Cypress.config(`viewportHeight`)
|
|
183
184
|
|
package/_DocGroup.tsx
CHANGED
package/_DocLink.tsx
CHANGED
|
@@ -57,24 +57,28 @@ export const DocLink = React.forwardRef<DocLinkForward, DocLinkProps>(
|
|
|
57
57
|
React.useEffect(setActiveMarkerPosition, [onActive, active])
|
|
58
58
|
|
|
59
59
|
React.useEffect(() => {
|
|
60
|
-
if
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
// if active check if the item is visible in the
|
|
61
|
+
// viewport and scrollIntoView if not
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
// give it time tp render and expand
|
|
64
|
+
if (active && activeLIRef.current) {
|
|
65
|
+
const rect = activeLIRef.current.getBoundingClientRect()
|
|
66
|
+
|
|
67
|
+
if (
|
|
68
|
+
rect.top > 0 &&
|
|
69
|
+
rect.bottom < window.innerHeight &&
|
|
70
|
+
rect.left > 0 &&
|
|
71
|
+
rect.right < window.innerWidth
|
|
72
|
+
) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
activeLIRef.current.scrollIntoView({
|
|
77
|
+
block: 'nearest',
|
|
78
|
+
inline: 'nearest',
|
|
79
|
+
})
|
|
71
80
|
}
|
|
72
|
-
|
|
73
|
-
activeLIRef.current.scrollIntoView({
|
|
74
|
-
block: 'nearest',
|
|
75
|
-
inline: 'nearest',
|
|
76
|
-
})
|
|
77
|
-
}
|
|
81
|
+
}, 200)
|
|
78
82
|
}, [active])
|
|
79
83
|
|
|
80
84
|
React.useImperativeHandle(ref, () => ({
|
|
@@ -82,7 +86,7 @@ export const DocLink = React.forwardRef<DocLinkForward, DocLinkProps>(
|
|
|
82
86
|
}))
|
|
83
87
|
|
|
84
88
|
return (
|
|
85
|
-
<li ref={activeLIRef} className="list-none p-0">
|
|
89
|
+
<li ref={activeLIRef} className="list-none p-0 scroll-my-10">
|
|
86
90
|
<LinkComponent
|
|
87
91
|
{...itemRest}
|
|
88
92
|
className={clsx('group relative block w-full pl-[24px]', {
|
package/dist/_DocGroup.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_DocGroup.d.ts","sourceRoot":"./","sources":["_DocGroup.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_DocGroup.d.ts","sourceRoot":"./","sources":["_DocGroup.tsx"],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ClD;AAED,eAAO,MAAM,gBAAgB,uGAkG5B,CAAA"}
|
package/dist/_DocLink.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_DocLink.d.ts","sourceRoot":"./","sources":["_DocLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAE/D,MAAM,WAAW,OAAO;IACtB,iBAAiB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAA;IACpD,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,KAAK,CAAC,aAAa,CAAA;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAC,CAAA;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACzD,aAAa,EAAE,iBAAiB,CAAA;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,uBAAuB,EAAE,MAAM,IAAI,CAAA;CACpC;AAED,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"_DocLink.d.ts","sourceRoot":"./","sources":["_DocLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAE/D,MAAM,WAAW,OAAO;IACtB,iBAAiB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAA;IACpD,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,KAAK,CAAC,aAAa,CAAA;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAC,CAAA;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,OAAO,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACzD,aAAa,EAAE,iBAAiB,CAAA;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,uBAAuB,EAAE,MAAM,IAAI,CAAA;CACpC;AAED,eAAO,MAAM,OAAO,qFAwFnB,CAAA"}
|
package/dist/index.es.mjs
CHANGED
|
@@ -94,7 +94,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
var compileReactIconProperties = function (_a) {
|
|
97
|
-
var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name"]);
|
|
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
98
|
var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
|
|
99
99
|
if (!ICON_COLOR_PROP_NAMES.includes(attrName) &&
|
|
100
100
|
attrName !== 'name') {
|
|
@@ -121,7 +121,11 @@ var compileReactIconProperties = function (_a) {
|
|
|
121
121
|
}
|
|
122
122
|
}, [defs, name, size]);
|
|
123
123
|
var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
|
|
124
|
-
__html:
|
|
124
|
+
__html: alt
|
|
125
|
+
? "<title>".concat(alt.replace(/[><]/g, function (s) {
|
|
126
|
+
return s === '>' ? '>' : '<';
|
|
127
|
+
}), "</title>").concat(body)
|
|
128
|
+
: body,
|
|
125
129
|
}, className: undefined }, filteredAttributes);
|
|
126
130
|
if (attributes.className) {
|
|
127
131
|
compiledClasses.push(attributes.className);
|
|
@@ -143,10 +147,10 @@ function useIconProps(props, iconBodiesAndDefs, availableSizes, name) {
|
|
|
143
147
|
}
|
|
144
148
|
var IconChevronDownSmall = function (props) { return React.createElement('svg', useIconProps(props, {
|
|
145
149
|
"8": {
|
|
146
|
-
"body": "<path
|
|
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\"/>"
|
|
147
151
|
},
|
|
148
152
|
"16": {
|
|
149
|
-
"body": "<path
|
|
153
|
+
"body": "<path d=\"m4 6 4 4 4-4\" stroke=\"currentColor\" class=\"icon-dark\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"
|
|
150
154
|
}
|
|
151
155
|
}, ["8", "16"], "chevron-down-small")); };
|
|
152
156
|
|
|
@@ -181,26 +185,29 @@ var DocLink = React.forwardRef(function (_a, ref) {
|
|
|
181
185
|
// send the top position to the parent
|
|
182
186
|
React.useEffect(setActiveMarkerPosition, [onActive, active]);
|
|
183
187
|
React.useEffect(function () {
|
|
184
|
-
if
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
// if active check if the item is visible in the
|
|
189
|
+
// viewport and scrollIntoView if not
|
|
190
|
+
setTimeout(function () {
|
|
191
|
+
// give it time tp render and expand
|
|
192
|
+
if (active && activeLIRef.current) {
|
|
193
|
+
var rect = activeLIRef.current.getBoundingClientRect();
|
|
194
|
+
if (rect.top > 0 &&
|
|
195
|
+
rect.bottom < window.innerHeight &&
|
|
196
|
+
rect.left > 0 &&
|
|
197
|
+
rect.right < window.innerWidth) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
activeLIRef.current.scrollIntoView({
|
|
201
|
+
block: 'nearest',
|
|
202
|
+
inline: 'nearest',
|
|
203
|
+
});
|
|
193
204
|
}
|
|
194
|
-
|
|
195
|
-
block: 'nearest',
|
|
196
|
-
inline: 'nearest',
|
|
197
|
-
});
|
|
198
|
-
}
|
|
205
|
+
}, 200);
|
|
199
206
|
}, [active]);
|
|
200
207
|
React.useImperativeHandle(ref, function () { return ({
|
|
201
208
|
setActiveMarkerPosition: setActiveMarkerPosition,
|
|
202
209
|
}); });
|
|
203
|
-
return (React.createElement("li", { ref: activeLIRef, className: "list-none p-0" },
|
|
210
|
+
return (React.createElement("li", { ref: activeLIRef, className: "list-none p-0 scroll-my-10" },
|
|
204
211
|
React.createElement(LinkComponent, __assign$1({}, itemRest, { className: clsx('group relative block w-full pl-[24px]', {
|
|
205
212
|
'text-indigo-500 dark:text-indigo-400': active,
|
|
206
213
|
'text-gray-700 dark:text-gray-500': !active,
|
|
@@ -423,4 +430,4 @@ var DocMenu = function (_a) {
|
|
|
423
430
|
export { DocMenu as default };
|
|
424
431
|
//# sourceMappingURL=index.es.mjs.map
|
|
425
432
|
|
|
426
|
-
/* <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"> */
|
|
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 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"> */
|