grep-components 2.3.0-GREPF-2406.1 → 2.3.0-GREPF-2280.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.
@@ -12,7 +12,7 @@ export declare const dimensions: {
12
12
  toolbarMenuWidth: number;
13
13
  toolbarMenuHeight: number;
14
14
  };
15
- export declare const ToolbarTitle: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps<unknown> & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
15
+ export declare const ToolbarTitle: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
16
16
  export declare const EnvironmentTitle: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
17
17
  export declare const Toolbar: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
18
18
  export declare const ToolbarFixer: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -26,5 +26,5 @@ export declare const AccountName: import("@emotion/styled").StyledComponent<MUIS
26
26
  export declare const ToolbarMenu: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
27
27
  export declare const MobileToolbarMenu: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
28
28
  export declare const ToolbarMenuInner: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
29
- export declare const ToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps<unknown> & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
30
- export declare const MobileToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps<unknown> & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
29
+ export declare const ToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
30
+ export declare const MobileToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -1,10 +1,29 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
+ export declare const v0colors: {
3
+ primary: string;
4
+ secondary: string;
5
+ body: string;
6
+ headerBackgroundColor: string;
7
+ borderColor: string;
8
+ primaryFade: string;
9
+ greyText: string;
10
+ placeholderText: string;
11
+ textColor: string;
12
+ textColorFade: string;
13
+ textColorMoreFade: string;
14
+ white: string;
15
+ lightGrey: string;
16
+ };
2
17
  declare const _default: {
3
18
  title: string;
4
- render: () => React.JSX.Element;
19
+ excludeStories: string[];
5
20
  };
6
21
  export default _default;
7
22
  export declare const Default: {
8
23
  (): React.JSX.Element;
9
24
  storyName: string;
10
25
  };
26
+ export declare const WithAppBar: {
27
+ (): React.JSX.Element;
28
+ storyName: string;
29
+ };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare const _default: ({ children }: {
2
+ declare const scaffold: ({ children }: {
3
3
  children: React.ReactNode;
4
4
  }) => React.JSX.Element;
5
- export default _default;
5
+ export default scaffold;
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import ArrowDropdown from '@mui/icons-material/ArrowDropDown';
9
9
  import { Button, Box, Typography, Tabs, Tab, Collapse, MenuList, Tooltip, MenuItem as MenuItem$1, Menu as Menu$1, Container, List, ListItem, ListItemText, ListItemButton, CircularProgress, TextField, FormControl, InputLabel, Select, OutlinedInput, Input, Checkbox, FormHelperText, IconButton as IconButton$1, TableHead as TableHead$1, TableRow as TableRow$1, ToggleButtonGroup, AppBar as AppBar$1, Toolbar as Toolbar$1, Divider as Divider$1, Dialog as Dialog$1, DialogTitle as DialogTitle$1, DialogContent as DialogContent$1, DialogContentText as DialogContentText$1, DialogActions as DialogActions$1 } from '@mui/material';
10
10
  import { useTheme, styled } from '@mui/material/styles';
11
11
  import { __unsafe_useEmotionCache } from '@emotion/react';
12
- import { useHistory, NavLink, Prompt } from 'react-router-dom';
12
+ import { useNavigate, NavLink, useBlocker, useLocation } from 'react-router-dom';
13
13
  import MenuIcon from '@mui/icons-material/Menu';
14
14
  import Box$1 from '@mui/material/Box';
15
15
  import IconButton from '@mui/material/IconButton';
@@ -47,7 +47,7 @@ import Collapse$1 from '@mui/material/Collapse';
47
47
  import ExpandLess from '@mui/icons-material/ExpandLess';
48
48
  import Warning from '@mui/icons-material/Warning';
49
49
  import { compose, bindActionCreators, createStore as createStore$1, applyMiddleware } from 'redux';
50
- import { connect, Provider as Provider$1, useSelector } from 'react-redux';
50
+ import { connect, Provider as Provider$1 } from 'react-redux';
51
51
  import ReactDOM from 'react-dom';
52
52
  import DragIndicator from '@mui/icons-material/DragIndicator';
53
53
  import { ContentBlock, genKey, ContentState, CharacterMetadata, CompositeDecorator, EditorState, RichUtils, getVisibleSelectionRect, Editor, getDefaultKeyBinding, Modifier } from 'draft-js';
@@ -61,7 +61,6 @@ import DialogActions from '@mui/material/DialogActions';
61
61
  import DialogContent from '@mui/material/DialogContent';
62
62
  import DialogContentText from '@mui/material/DialogContentText';
63
63
  import DialogTitle from '@mui/material/DialogTitle';
64
- import { getHash, getLocation } from 'connected-react-router';
65
64
 
66
65
  dayjs.extend(isBetweenPlugin);
67
66
  dayjs.extend(LocalizedFormatPlugin);
@@ -1628,7 +1627,7 @@ const useMobileStyles = makeStyles()(({ palette, breakpoints }) => ({
1628
1627
 
1629
1628
  const MobileAppBarNavList = ({ pages, }) => {
1630
1629
  const { classes } = useMobileStyles();
1631
- const history = useHistory();
1630
+ const navigate = useNavigate();
1632
1631
  const [anchorElNav, setAnchorElNav] = React.useState(null);
1633
1632
  const openNav = Boolean(anchorElNav);
1634
1633
  const handleClickNav = (event) => {
@@ -1644,8 +1643,8 @@ const MobileAppBarNavList = ({ pages, }) => {
1644
1643
  'aria-labelledby': 'basic-button',
1645
1644
  } }, pages.map((page) => (React.createElement(MenuItem, { key: page.id, onClick: () => {
1646
1645
  handleCloseNav();
1647
- history.push(page?.toUrl || '');
1648
- }, onKeyDown: keyboard.onActivation(() => history.push(page?.toUrl || '')) }, page.label))))));
1646
+ navigate(page?.toUrl || '');
1647
+ }, onKeyDown: keyboard.onActivation(() => navigate(page?.toUrl || '')) }, page.label))))));
1649
1648
  };
1650
1649
 
1651
1650
  const AppBarNavList = ({ selectedPage, pages, onChange, }) => {
@@ -2433,7 +2432,7 @@ const useStyles$b = makeStyles()({
2433
2432
  const isOverflowing = (e) => e.offsetWidth < e.scrollWidth;
2434
2433
  const GrepCrumbs = ({ style, onClick, breadcrumbs, }) => {
2435
2434
  const { classes } = useStyles$b();
2436
- const history = useHistory();
2435
+ const navigate = useNavigate();
2437
2436
  const ref = React__default.useRef(null);
2438
2437
  const [showTooltip, setShowTooltip] = React__default.useState(false);
2439
2438
  React__default.useEffect(() => {
@@ -2445,7 +2444,7 @@ const GrepCrumbs = ({ style, onClick, breadcrumbs, }) => {
2445
2444
  onClick(crumb);
2446
2445
  }
2447
2446
  else {
2448
- crumb.path && history.push(crumb.path);
2447
+ crumb.path && navigate(crumb.path);
2449
2448
  }
2450
2449
  };
2451
2450
  return (React__default.createElement("div", { className: classes.container, style: style }, breadcrumbs.map((crumb, index) => crumb.path ? (React__default.createElement(Box$1, { key: index, display: "flex" },
@@ -3340,24 +3339,33 @@ const ServiceMessage = ({ id, message, isPublic, onDismiss }) => {
3340
3339
  React.createElement(Close, { className: classes.close })))));
3341
3340
  };
3342
3341
 
3343
- function _setPrototypeOf(t, e) {
3344
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
3345
- return t.__proto__ = e, t;
3346
- }, _setPrototypeOf(t, e);
3342
+ function _setPrototypeOf(o, p) {
3343
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
3344
+ o.__proto__ = p;
3345
+ return o;
3346
+ };
3347
+ return _setPrototypeOf(o, p);
3347
3348
  }
3348
3349
 
3349
- function _inheritsLoose(t, o) {
3350
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
3350
+ function _inheritsLoose(subClass, superClass) {
3351
+ subClass.prototype = Object.create(superClass.prototype);
3352
+ subClass.prototype.constructor = subClass;
3353
+ _setPrototypeOf(subClass, superClass);
3351
3354
  }
3352
3355
 
3353
3356
  function _extends() {
3354
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
3355
- for (var e = 1; e < arguments.length; e++) {
3356
- var t = arguments[e];
3357
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
3357
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
3358
+ for (var i = 1; i < arguments.length; i++) {
3359
+ var source = arguments[i];
3360
+ for (var key in source) {
3361
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3362
+ target[key] = source[key];
3363
+ }
3364
+ }
3358
3365
  }
3359
- return n;
3360
- }, _extends.apply(null, arguments);
3366
+ return target;
3367
+ };
3368
+ return _extends.apply(this, arguments);
3361
3369
  }
3362
3370
 
3363
3371
  function areInputsEqual$1(newInputs, lastInputs) {
@@ -19566,43 +19574,34 @@ const AppBar = ({ username, currentPath, isProd, appTitle, userMenuItems, menuIt
19566
19574
 
19567
19575
  const NavGuard = ({ when, title, txt, txtSave, txtCancel, txtDiscard, onSave, onCancel, onDiscard, }) => {
19568
19576
  const [open, setOpen] = React.useState(false);
19569
- const [leave, setLeave] = React.useState(false);
19570
- const [lastLocation, setLastLocation] = React.useState();
19571
- const history = useHistory();
19572
19577
  const handleCancel = () => {
19573
- setLeave(false);
19574
19578
  setOpen(false);
19575
19579
  onCancel && onCancel();
19576
19580
  };
19577
19581
  const handleDiscard = () => {
19578
- setLeave(true);
19579
19582
  setOpen(false);
19580
19583
  onDiscard && onDiscard();
19581
- lastLocation &&
19582
- window.requestAnimationFrame(() => history.push(lastLocation));
19584
+ blocker.proceed ? blocker.proceed() : null;
19583
19585
  };
19584
19586
  const handleSave = () => {
19585
19587
  onSave && onSave();
19586
- setLeave(true);
19587
19588
  setOpen(false);
19588
- lastLocation &&
19589
- window.requestAnimationFrame(() => history.push(lastLocation));
19589
+ blocker.proceed ? blocker.proceed() : null;
19590
19590
  };
19591
- const handleLeave = (location) => {
19592
- setLastLocation(location);
19593
- setOpen(!leave);
19594
- return !!leave;
19595
- };
19596
- return (React.createElement(React.Fragment, null,
19597
- React.createElement(Prompt, { when: when, message: handleLeave }),
19598
- React.createElement(Dialog, { open: open, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" },
19599
- React.createElement(DialogTitle, { id: "alert-dialog-title" }, title),
19600
- React.createElement(DialogContent, null,
19601
- React.createElement(DialogContentText, { id: "alert-dialog-description" }, txt)),
19602
- React.createElement(DialogActions, null,
19603
- React.createElement(Button$1, { onClick: handleCancel, autoFocus: true, color: "inherit" }, txtCancel),
19604
- React.createElement(Button$1, { onClick: handleDiscard, color: "error" }, txtDiscard),
19605
- onSave && (React.createElement(Button$1, { onClick: handleSave, color: "primary" }, txtSave))))));
19591
+ const blocker = useBlocker(({ currentLocation, nextLocation }) => when && currentLocation.pathname !== nextLocation.pathname);
19592
+ React.useEffect(() => {
19593
+ if (blocker.state === 'blocked') {
19594
+ setOpen(true);
19595
+ }
19596
+ }, [blocker]);
19597
+ return (React.createElement(React.Fragment, null, blocker.state === 'blocked' ? (React.createElement(Dialog, { open: open, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" },
19598
+ React.createElement(DialogTitle, { id: "alert-dialog-title" }, title),
19599
+ React.createElement(DialogContent, null,
19600
+ React.createElement(DialogContentText, { id: "alert-dialog-description" }, txt)),
19601
+ React.createElement(DialogActions, null,
19602
+ React.createElement(Button$1, { onClick: handleCancel, autoFocus: true, color: "inherit" }, txtCancel),
19603
+ React.createElement(Button$1, { onClick: handleDiscard, color: "error" }, txtDiscard),
19604
+ onSave && (React.createElement(Button$1, { onClick: handleSave, color: "primary" }, txtSave))))) : null));
19606
19605
  };
19607
19606
 
19608
19607
  const useStyles$3 = makeStyles()(({ palette }) => ({
@@ -20150,7 +20149,7 @@ const GrepTableOfContentProvider = ({ ...props }) => {
20150
20149
  const { container, identifier, onSelected, classes, scrollTarget, children, offsetTop = -10, identifyElementFn = identifyElement, } = props;
20151
20150
  const [selected, _setSelected] = useState();
20152
20151
  const [initialized, setInitialized] = useState();
20153
- const hash = useSelector((s) => decodeURI(getHash(s))).substring(1);
20152
+ const hash = useLocation().hash;
20154
20153
  const scrollToElement = useCallback$1((element) => {
20155
20154
  const target = scrollTarget || window;
20156
20155
  const elementBounds = element.getBoundingClientRect();
@@ -20256,7 +20255,7 @@ const GrepTableOfContentNavTreeNode = (props) => {
20256
20255
  const className = clsx('grep-toc__nav-tree-node', isSelected && 'grep-toc__nav-tree-node--selected', styles.root, classes?.node, props.className);
20257
20256
  const [awaitingRender, setAwaitingRender] = useState(false);
20258
20257
  const txt = el.innerText;
20259
- const location = useSelector((s) => getLocation(s));
20258
+ const location = useLocation();
20260
20259
  const url = `${location.pathname}${location.search}#${node.id}`;
20261
20260
  useEffect(() => {
20262
20261
  const link = linkRef.current;