@neo4j-ndl/react 0.4.0 → 0.5.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.
Files changed (80) hide show
  1. package/lib/cjs/_common/utils.js +59 -0
  2. package/lib/cjs/_common/utils.js.map +1 -0
  3. package/lib/cjs/button/Button.js +2 -2
  4. package/lib/cjs/button/Button.js.map +1 -1
  5. package/lib/cjs/button/IconButton.js +3 -3
  6. package/lib/cjs/button/IconButton.js.map +1 -1
  7. package/lib/cjs/context-menu/ContextMenu.js +7 -13
  8. package/lib/cjs/context-menu/ContextMenu.js.map +1 -1
  9. package/lib/cjs/dialog/Dialog.js +161 -0
  10. package/lib/cjs/dialog/Dialog.js.map +1 -0
  11. package/lib/cjs/dialog/index.js +38 -0
  12. package/lib/cjs/dialog/index.js.map +1 -0
  13. package/lib/cjs/drag-and-drop/DragAndDrop.js +8 -3
  14. package/lib/cjs/drag-and-drop/DragAndDrop.js.map +1 -1
  15. package/lib/cjs/index.js +2 -0
  16. package/lib/cjs/index.js.map +1 -1
  17. package/lib/cjs/modal/Modal.js +105 -0
  18. package/lib/cjs/modal/Modal.js.map +1 -0
  19. package/lib/cjs/modal/index.js +38 -0
  20. package/lib/cjs/modal/index.js.map +1 -0
  21. package/lib/cjs/popover/Popover.js +30 -52
  22. package/lib/cjs/popover/Popover.js.map +1 -1
  23. package/lib/cjs/portal/Portal.js +52 -0
  24. package/lib/cjs/portal/Portal.js.map +1 -0
  25. package/lib/cjs/portal/index.js +38 -0
  26. package/lib/cjs/portal/index.js.map +1 -0
  27. package/lib/cjs/table/Table.js +1 -1
  28. package/lib/cjs/table/Table.js.map +1 -1
  29. package/lib/cjs/trap-focus/TrapFocus.js +310 -0
  30. package/lib/cjs/trap-focus/TrapFocus.js.map +1 -0
  31. package/lib/cjs/trap-focus/index.js +38 -0
  32. package/lib/cjs/trap-focus/index.js.map +1 -0
  33. package/lib/esm/_common/utils.js +52 -0
  34. package/lib/esm/_common/utils.js.map +1 -0
  35. package/lib/esm/button/Button.js +1 -1
  36. package/lib/esm/button/Button.js.map +1 -1
  37. package/lib/esm/button/IconButton.js +2 -2
  38. package/lib/esm/button/IconButton.js.map +1 -1
  39. package/lib/esm/context-menu/ContextMenu.js +7 -13
  40. package/lib/esm/context-menu/ContextMenu.js.map +1 -1
  41. package/lib/esm/dialog/Dialog.js +131 -0
  42. package/lib/esm/dialog/Dialog.js.map +1 -0
  43. package/lib/esm/{_common/utilts.js → dialog/index.js} +2 -5
  44. package/lib/esm/dialog/index.js.map +1 -0
  45. package/lib/esm/drag-and-drop/DragAndDrop.js +9 -4
  46. package/lib/esm/drag-and-drop/DragAndDrop.js.map +1 -1
  47. package/lib/esm/index.js +2 -0
  48. package/lib/esm/index.js.map +1 -1
  49. package/lib/esm/modal/Modal.js +75 -0
  50. package/lib/esm/modal/Modal.js.map +1 -0
  51. package/lib/{cjs/_common/utilts.js → esm/modal/index.js} +2 -11
  52. package/lib/esm/modal/index.js.map +1 -0
  53. package/lib/esm/popover/Popover.js +30 -29
  54. package/lib/esm/popover/Popover.js.map +1 -1
  55. package/lib/esm/portal/Portal.js +25 -0
  56. package/lib/esm/portal/Portal.js.map +1 -0
  57. package/lib/esm/portal/index.js +22 -0
  58. package/lib/esm/portal/index.js.map +1 -0
  59. package/lib/esm/table/Table.js +1 -1
  60. package/lib/esm/table/Table.js.map +1 -1
  61. package/lib/esm/trap-focus/TrapFocus.js +283 -0
  62. package/lib/esm/trap-focus/TrapFocus.js.map +1 -0
  63. package/lib/esm/trap-focus/index.js +22 -0
  64. package/lib/esm/trap-focus/index.js.map +1 -0
  65. package/lib/types/_common/{utilts.d.ts → utils.d.ts} +5 -0
  66. package/lib/types/context-menu/ContextMenu.d.ts +4 -1
  67. package/lib/types/dialog/Dialog.d.ts +55 -0
  68. package/lib/types/dialog/index.d.ts +21 -0
  69. package/lib/types/drag-and-drop/DragAndDrop.d.ts +5 -3
  70. package/lib/types/index.d.ts +2 -0
  71. package/lib/types/modal/Modal.d.ts +34 -0
  72. package/lib/types/modal/index.d.ts +21 -0
  73. package/lib/types/popover/Popover.d.ts +5 -3
  74. package/lib/types/portal/Portal.d.ts +27 -0
  75. package/lib/types/portal/index.d.ts +21 -0
  76. package/lib/types/trap-focus/TrapFocus.d.ts +35 -0
  77. package/lib/types/trap-focus/index.d.ts +21 -0
  78. package/package.json +4 -3
  79. package/lib/cjs/_common/utilts.js.map +0 -1
  80. package/lib/esm/_common/utilts.js.map +0 -1
@@ -20,6 +20,7 @@
20
20
  */
21
21
  import React from 'react';
22
22
  import { DropzoneOptions } from 'react-dropzone';
23
+ import { ElementBase } from '../helpers';
23
24
  /**
24
25
  *
25
26
  *
@@ -27,7 +28,7 @@ import { DropzoneOptions } from 'react-dropzone';
27
28
  *
28
29
  *
29
30
  */
30
- export declare type DragAndDropProps = {
31
+ export interface DragAndDropProps extends ElementBase<HTMLDivElement> {
31
32
  /** See here - https://react-dropzone.js.org/#src */
32
33
  dropZoneOptions: DropzoneOptions;
33
34
  /** Supported file text in the footer */
@@ -36,12 +37,13 @@ export declare type DragAndDropProps = {
36
37
  loadingComponent?: string | React.ReactElement;
37
38
  /** To be used when want to test loadingComponent UI without actualy draging and uploading the files */
38
39
  isTesting?: boolean;
39
- };
40
+ }
40
41
  /**
41
42
  *
42
43
  *
43
44
  * DragAndDrop Component
44
45
  *
45
46
  *
46
- */ declare const DragAndDrop: (props: DragAndDropProps) => JSX.Element;
47
+ */
48
+ declare const DragAndDrop: (props: DragAndDropProps) => JSX.Element;
47
49
  export default DragAndDrop;
@@ -26,6 +26,8 @@ export * from './checkbox';
26
26
  export * from './switch';
27
27
  export * from './radio';
28
28
  export * from './context-menu';
29
+ export * from './dialog';
30
+ export * from './modal';
29
31
  export * from './loading-spinner';
30
32
  export * from './tabs';
31
33
  export * from './view-selector';
@@ -0,0 +1,34 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import React from 'react';
22
+ import { ElementBase } from '../helpers';
23
+ export declare enum ModalCloseReason {
24
+ BACKDROP_CLICK = "backdropClick",
25
+ ESCAPE_KEY_DOWN = "escapeKeyDown"
26
+ }
27
+ export interface ModalProps extends ElementBase {
28
+ open: boolean;
29
+ children: React.ReactNode;
30
+ size?: 'small' | 'medium' | 'large';
31
+ className?: string;
32
+ onClose?: (e: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, reason?: ModalCloseReason) => void;
33
+ }
34
+ export declare const Modal: ({ open, size, onClose, children, className, ...rest }: ModalProps) => JSX.Element | null;
@@ -0,0 +1,21 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export * from './Modal';
@@ -20,15 +20,17 @@
20
20
  */
21
21
  import React from 'react';
22
22
  /**
23
- * A Popover component. A significant portion of this code is a subset of the Material UI React Popover component
24
- * code, especially for positioning/sizing
23
+ * A modified version of the Material UI (@mui/material) Popover component.
24
+ * We use a modified/slimmed version for easier maintenance.
25
+ *
26
+ * See the LICENSES.txt file for license for @mui/material
25
27
  */
26
28
  declare type ElementBase = Omit<React.HTMLProps<HTMLElement>, 'as'> & {
27
29
  /** Override the root element rendered for the component */
28
30
  as?: string | React.ComponentType<any>;
29
31
  };
30
32
  declare type Vertical = 'top' | 'bottom';
31
- declare type Horizontal = 'left' | 'right';
33
+ declare type Horizontal = 'left' | 'right' | 'center';
32
34
  export interface PopoverProps extends ElementBase {
33
35
  open: boolean;
34
36
  children: React.ReactNode | string;
@@ -0,0 +1,27 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ /// <reference types="react" />
22
+ interface PortalProps {
23
+ children: React.ReactNode | null;
24
+ container?: Element;
25
+ }
26
+ export declare const Portal: ({ children, container, }: PortalProps) => import("react").ReactPortal;
27
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export * from './Portal';
@@ -0,0 +1,35 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ /// <reference types="react" />
22
+ interface TrapFocusProps {
23
+ /**
24
+ * Must take a ref
25
+ */
26
+ children: any;
27
+ open: boolean;
28
+ disableRestoreFocus?: boolean;
29
+ getTabbable?: (e: HTMLElement) => HTMLElement[];
30
+ }
31
+ /**
32
+ * Utility component that locks focus inside the component.
33
+ */
34
+ export declare function TrapFocus(props: TrapFocusProps): JSX.Element;
35
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export * from './TrapFocus';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "0.4.0",
3
+ "version": "0.5.2",
4
4
  "description": "React implementation of Neo4j Design System",
5
5
  "keywords": [
6
6
  "button",
@@ -67,9 +67,10 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@heroicons/react": "^1.0.5",
70
- "@neo4j-ndl/base": "^0.4.0",
70
+ "@neo4j-ndl/base": "^0.5.1",
71
71
  "classnames": "^2.3.1",
72
72
  "react-dropzone": "^12.0.4",
73
- "react-table": "^7.7.0"
73
+ "react-table": "^7.7.0",
74
+ "react-use": "^17.4.0"
74
75
  }
75
76
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"utilts.js","sourceRoot":"","sources":["../../../src/_common/utilts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEI,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AADzB,QAAA,cAAc,kBACW;AAEtC,qCAAqC;AAC9B,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAC5C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AADvB,QAAA,YAAY,gBACW;AAE7B,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CACtD,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;AAD9B,QAAA,oBAAoB,wBACU"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utilts.js","sourceRoot":"","sources":["../../../src/_common/utilts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEtC,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAC5C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CACtD,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC"}