grep-components 2.10.0-GREPF-2675.1 → 2.10.0-GREPF-2677.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/dist/components/AppBar/stories/AppBarStory.stories.d.ts +2 -0
- package/dist/components/GrepDialog/stories/dialog.stories.d.ts +8 -1
- package/dist/components/ToC/components/nav-tree-node.d.ts +0 -9
- package/dist/index.js +3 -10
- package/dist/index.js.map +1 -1
- package/dist/setupTests.d.ts +1 -0
- package/package.json +4 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { IAuthorizedPage } from '../types';
|
|
2
3
|
export declare const v0colors: {
|
|
3
4
|
primary: string;
|
|
4
5
|
secondary: string;
|
|
@@ -14,6 +15,7 @@ export declare const v0colors: {
|
|
|
14
15
|
white: string;
|
|
15
16
|
lightGrey: string;
|
|
16
17
|
};
|
|
18
|
+
export declare const navbarPages: IAuthorizedPage[];
|
|
17
19
|
declare const _default: {
|
|
18
20
|
title: string;
|
|
19
21
|
excludeStories: string[];
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { JSX } from 'react';
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
export declare const content = "Some content";
|
|
3
|
+
export declare const openText = "Open dialog";
|
|
4
|
+
export declare const title = "Title text";
|
|
5
|
+
export declare const Component: React.FC<{
|
|
6
|
+
actions?: JSX.Element[];
|
|
7
|
+
}>;
|
|
2
8
|
declare const _default: {
|
|
3
9
|
title: string;
|
|
4
10
|
decorators: ((storyFn: any) => JSX.Element)[];
|
|
11
|
+
excludeStories: string[];
|
|
5
12
|
};
|
|
6
13
|
export default _default;
|
|
7
14
|
export declare const Standard: {
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { ContextTreeElement, ContextTree } from '../utils/tree-builder';
|
|
3
|
-
/**
|
|
4
|
-
* @TODO fix later
|
|
5
|
-
* cheat, https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded
|
|
6
|
-
*/
|
|
7
|
-
declare global {
|
|
8
|
-
interface HTMLElement {
|
|
9
|
-
scrollIntoViewIfNeeded: VoidFunction;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
3
|
export interface GrepTableOfContentNavTreeNodeProps {
|
|
13
4
|
node: ContextTreeElement;
|
|
14
5
|
className?: string;
|
package/dist/index.js
CHANGED
|
@@ -1788,6 +1788,7 @@ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tool
|
|
|
1788
1788
|
const event = onStatusChange('collapse');
|
|
1789
1789
|
if (!event.defaultPrevented) {
|
|
1790
1790
|
setOpen(false);
|
|
1791
|
+
requestAnimationFrame(() => listItemRef.current?.focus());
|
|
1791
1792
|
}
|
|
1792
1793
|
return !event.defaultPrevented;
|
|
1793
1794
|
}, [onStatusChange, setOpen, listItemRef]);
|
|
@@ -3169,11 +3170,9 @@ const useContentElements = (container, selector, options) => {
|
|
|
3169
3170
|
});
|
|
3170
3171
|
// start observing
|
|
3171
3172
|
observer.observe(container, config);
|
|
3172
|
-
console.debug('observing container', container);
|
|
3173
3173
|
// stop observing when unmounted
|
|
3174
3174
|
return () => {
|
|
3175
3175
|
observer.disconnect();
|
|
3176
|
-
console.debug('observing disconnected', container);
|
|
3177
3176
|
};
|
|
3178
3177
|
}, [container, config, getElements]);
|
|
3179
3178
|
return elements;
|
|
@@ -12888,7 +12887,7 @@ var lodash_throttleExports = requireLodash_throttle();
|
|
|
12888
12887
|
var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
|
|
12889
12888
|
|
|
12890
12889
|
const generateElementId = (element) => {
|
|
12891
|
-
const tmpId = element.innerText
|
|
12890
|
+
const tmpId = element.innerText?.replace(/\s/g, '-').toLowerCase();
|
|
12892
12891
|
let id = tmpId, index = 1;
|
|
12893
12892
|
while (document.getElementById(id)) {
|
|
12894
12893
|
id = `${tmpId}-${++index}`;
|
|
@@ -12958,9 +12957,7 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12958
12957
|
setSelected(element);
|
|
12959
12958
|
}, 50);
|
|
12960
12959
|
target.addEventListener('scroll', onScroll, false);
|
|
12961
|
-
console.debug('scroll observer attached');
|
|
12962
12960
|
return () => {
|
|
12963
|
-
console.debug('scroll observer detached');
|
|
12964
12961
|
return target.removeEventListener('scroll', onScroll);
|
|
12965
12962
|
};
|
|
12966
12963
|
}, [scrollTarget, setSelected, offsetTop, getViewportElement]);
|
|
@@ -12971,13 +12968,11 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12971
12968
|
// observe changes in hash
|
|
12972
12969
|
useEffect(() => {
|
|
12973
12970
|
if (hash && elements[hash]) {
|
|
12974
|
-
console.debug('anchor change, setting selected element');
|
|
12975
12971
|
setSelected(elements[hash], true);
|
|
12976
12972
|
}
|
|
12977
12973
|
}, [hash, setSelected]);
|
|
12978
12974
|
// set selected element on initial load
|
|
12979
12975
|
if (!initialized && elements && elements[hash]) {
|
|
12980
|
-
console.debug('setting initial selected element');
|
|
12981
12976
|
setSelected(elements[hash], true);
|
|
12982
12977
|
setInitialized(true);
|
|
12983
12978
|
}
|
|
@@ -13030,8 +13025,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13030
13025
|
useEffect(() => {
|
|
13031
13026
|
const link = linkRef.current;
|
|
13032
13027
|
if (isSelected) {
|
|
13033
|
-
link?.
|
|
13034
|
-
//setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
|
|
13028
|
+
link?.scrollIntoView({ block: 'nearest' });
|
|
13035
13029
|
}
|
|
13036
13030
|
else if (link === document.activeElement) {
|
|
13037
13031
|
link?.blur();
|
|
@@ -13056,7 +13050,6 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13056
13050
|
};
|
|
13057
13051
|
return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
|
|
13058
13052
|
React__default.createElement(Link, { ref: linkRef, className: clsx(styles.link, isSelected && `${styles.link}--selected`), href: url, tabIndex: tabIndex, onClick: (event) => {
|
|
13059
|
-
console.debug('node click', node);
|
|
13060
13053
|
event.preventDefault();
|
|
13061
13054
|
event.stopPropagation();
|
|
13062
13055
|
doSelect(true);
|