grep-components 2.11.0-gREPF-2708.1 → 2.11.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.
@@ -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
@@ -1673,7 +1673,6 @@ const CollapsableMenuItem = ({ items, onClick, children, onClose: _onclose, tool
1673
1673
  const event = onStatusChange('collapse');
1674
1674
  if (!event.defaultPrevented) {
1675
1675
  setOpen(false);
1676
- requestAnimationFrame(() => listItemRef.current?.focus());
1677
1676
  }
1678
1677
  return !event.defaultPrevented;
1679
1678
  }, [onStatusChange, setOpen, listItemRef]);
@@ -3061,11 +3060,9 @@ const useContentElements = (container, selector, options) => {
3061
3060
  });
3062
3061
  // start observing
3063
3062
  observer.observe(container, config);
3064
- console.debug('observing container', container);
3065
3063
  // stop observing when unmounted
3066
3064
  return () => {
3067
3065
  observer.disconnect();
3068
- console.debug('observing disconnected', container);
3069
3066
  };
3070
3067
  }, [container, config, getElements]);
3071
3068
  return elements;
@@ -12780,7 +12777,7 @@ var lodash_throttleExports = requireLodash_throttle();
12780
12777
  var throttle = /*@__PURE__*/getDefaultExportFromCjs(lodash_throttleExports);
12781
12778
 
12782
12779
  const generateElementId = (element) => {
12783
- const tmpId = element.innerText.replace(/\s/g, '-').toLowerCase();
12780
+ const tmpId = element.innerText?.replace(/\s/g, '-').toLowerCase();
12784
12781
  let id = tmpId, index = 1;
12785
12782
  while (document.getElementById(id)) {
12786
12783
  id = `${tmpId}-${++index}`;
@@ -12850,9 +12847,7 @@ const GrepTableOfContentProvider = ({ ...props }) => {
12850
12847
  setSelected(element);
12851
12848
  }, 50);
12852
12849
  target.addEventListener('scroll', onScroll, false);
12853
- console.debug('scroll observer attached');
12854
12850
  return () => {
12855
- console.debug('scroll observer detached');
12856
12851
  return target.removeEventListener('scroll', onScroll);
12857
12852
  };
12858
12853
  }, [scrollTarget, setSelected, offsetTop, getViewportElement]);
@@ -12863,13 +12858,11 @@ const GrepTableOfContentProvider = ({ ...props }) => {
12863
12858
  // observe changes in hash
12864
12859
  useEffect(() => {
12865
12860
  if (hash && elements[hash]) {
12866
- console.debug('anchor change, setting selected element');
12867
12861
  setSelected(elements[hash], true);
12868
12862
  }
12869
12863
  }, [hash, setSelected]);
12870
12864
  // set selected element on initial load
12871
12865
  if (!initialized && elements && elements[hash]) {
12872
- console.debug('setting initial selected element');
12873
12866
  setSelected(elements[hash], true);
12874
12867
  setInitialized(true);
12875
12868
  }
@@ -12922,8 +12915,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
12922
12915
  useEffect(() => {
12923
12916
  const link = linkRef.current;
12924
12917
  if (isSelected) {
12925
- link?.scrollIntoViewIfNeeded();
12926
- //setTimeout(() => link?.scrollIntoViewIfNeeded(), 2000);
12918
+ link?.scrollIntoView({ block: 'nearest' });
12927
12919
  }
12928
12920
  else if (link === document.activeElement) {
12929
12921
  link?.blur();
@@ -12948,7 +12940,6 @@ const GrepTableOfContentNavTreeNode = (props) => {
12948
12940
  };
12949
12941
  return (React__default.createElement("li", { key: index, "data-lvl": lvl, className: className, style: style },
12950
12942
  React__default.createElement(Link, { ref: linkRef, className: clsx(styles.link, isSelected && `${styles.link}--selected`), href: url, tabIndex: tabIndex, onClick: (event) => {
12951
- console.debug('node click', node);
12952
12943
  event.preventDefault();
12953
12944
  event.stopPropagation();
12954
12945
  doSelect(true);