grep-components 2.9.0 → 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 +2 -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
|
@@ -3170,11 +3170,9 @@ const useContentElements = (container, selector, options) => {
|
|
|
3170
3170
|
});
|
|
3171
3171
|
// start observing
|
|
3172
3172
|
observer.observe(container, config);
|
|
3173
|
-
console.debug('observing container', container);
|
|
3174
3173
|
// stop observing when unmounted
|
|
3175
3174
|
return () => {
|
|
3176
3175
|
observer.disconnect();
|
|
3177
|
-
console.debug('observing disconnected', container);
|
|
3178
3176
|
};
|
|
3179
3177
|
}, [container, config, getElements]);
|
|
3180
3178
|
return elements;
|
|
@@ -12889,7 +12887,7 @@ var lodash_throttleExports = requireLodash_throttle();
|
|
|
12889
12887
|
var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
|
|
12890
12888
|
|
|
12891
12889
|
const generateElementId = (element) => {
|
|
12892
|
-
const tmpId = element.innerText
|
|
12890
|
+
const tmpId = element.innerText?.replace(/\s/g, '-').toLowerCase();
|
|
12893
12891
|
let id = tmpId, index = 1;
|
|
12894
12892
|
while (document.getElementById(id)) {
|
|
12895
12893
|
id = `${tmpId}-${++index}`;
|
|
@@ -12959,9 +12957,7 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12959
12957
|
setSelected(element);
|
|
12960
12958
|
}, 50);
|
|
12961
12959
|
target.addEventListener('scroll', onScroll, false);
|
|
12962
|
-
console.debug('scroll observer attached');
|
|
12963
12960
|
return () => {
|
|
12964
|
-
console.debug('scroll observer detached');
|
|
12965
12961
|
return target.removeEventListener('scroll', onScroll);
|
|
12966
12962
|
};
|
|
12967
12963
|
}, [scrollTarget, setSelected, offsetTop, getViewportElement]);
|
|
@@ -12972,13 +12968,11 @@ const GrepTableOfContentProvider = ({ ...props }) => {
|
|
|
12972
12968
|
// observe changes in hash
|
|
12973
12969
|
useEffect(() => {
|
|
12974
12970
|
if (hash && elements[hash]) {
|
|
12975
|
-
console.debug('anchor change, setting selected element');
|
|
12976
12971
|
setSelected(elements[hash], true);
|
|
12977
12972
|
}
|
|
12978
12973
|
}, [hash, setSelected]);
|
|
12979
12974
|
// set selected element on initial load
|
|
12980
12975
|
if (!initialized && elements && elements[hash]) {
|
|
12981
|
-
console.debug('setting initial selected element');
|
|
12982
12976
|
setSelected(elements[hash], true);
|
|
12983
12977
|
setInitialized(true);
|
|
12984
12978
|
}
|
|
@@ -13031,8 +13025,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13031
13025
|
useEffect(() => {
|
|
13032
13026
|
const link = linkRef.current;
|
|
13033
13027
|
if (isSelected) {
|
|
13034
|
-
link?.
|
|
13035
|
-
//setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
|
|
13028
|
+
link?.scrollIntoView({ block: 'nearest' });
|
|
13036
13029
|
}
|
|
13037
13030
|
else if (link === document.activeElement) {
|
|
13038
13031
|
link?.blur();
|
|
@@ -13057,7 +13050,6 @@ const GrepTableOfContentNavTreeNode = (props) => {
|
|
|
13057
13050
|
};
|
|
13058
13051
|
return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
|
|
13059
13052
|
React__default.createElement(Link, { ref: linkRef, className: clsx(styles.link, isSelected && `${styles.link}--selected`), href: url, tabIndex: tabIndex, onClick: (event) => {
|
|
13060
|
-
console.debug('node click', node);
|
|
13061
13053
|
event.preventDefault();
|
|
13062
13054
|
event.stopPropagation();
|
|
13063
13055
|
doSelect(true);
|