grep-components 2.3.0-GREPF-2280.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.
@@ -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
+ };
package/dist/index.js CHANGED
@@ -19574,36 +19574,26 @@ const AppBar = ({ username, currentPath, isProd, appTitle, userMenuItems, menuIt
19574
19574
 
19575
19575
  const NavGuard = ({ when, title, txt, txtSave, txtCancel, txtDiscard, onSave, onCancel, onDiscard, }) => {
19576
19576
  const [open, setOpen] = React.useState(false);
19577
- const [leave, setLeave] = React.useState(false);
19578
- const [lastLocation, setLastLocation] = React.useState();
19579
- const navigate = useNavigate();
19580
19577
  const handleCancel = () => {
19581
- setLeave(false);
19582
19578
  setOpen(false);
19583
19579
  onCancel && onCancel();
19584
19580
  };
19585
19581
  const handleDiscard = () => {
19586
- setLeave(true);
19587
19582
  setOpen(false);
19588
19583
  onDiscard && onDiscard();
19589
- lastLocation && window.requestAnimationFrame(() => navigate(lastLocation));
19584
+ blocker.proceed ? blocker.proceed() : null;
19590
19585
  };
19591
19586
  const handleSave = () => {
19592
19587
  onSave && onSave();
19593
- setLeave(true);
19594
19588
  setOpen(false);
19595
- lastLocation && window.requestAnimationFrame(() => navigate(lastLocation));
19596
- };
19597
- const handleLeave = (location) => {
19598
- setLastLocation(location);
19599
- setOpen(!leave);
19600
- return !!leave;
19589
+ blocker.proceed ? blocker.proceed() : null;
19601
19590
  };
19602
- const blocker = useBlocker(({ currentLocation, nextLocation }) => {
19603
- if (when && currentLocation.pathname !== nextLocation.pathname)
19604
- handleLeave(nextLocation);
19605
- return currentLocation.pathname !== nextLocation.pathname;
19606
- });
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]);
19607
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" },
19608
19598
  React.createElement(DialogTitle, { id: "alert-dialog-title" }, title),
19609
19599
  React.createElement(DialogContent, null,