@neo4j-ndl/react 0.2.0 → 0.3.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.
Files changed (51) hide show
  1. package/lib/cjs/index.js +1 -0
  2. package/lib/cjs/index.js.map +1 -1
  3. package/lib/cjs/progress-bar/ProgressBar.js +2 -2
  4. package/lib/cjs/progress-bar/ProgressBar.js.map +1 -1
  5. package/lib/cjs/table/Table.js +124 -0
  6. package/lib/cjs/table/Table.js.map +1 -0
  7. package/lib/cjs/table/TableNavigation.js +51 -0
  8. package/lib/cjs/table/TableNavigation.js.map +1 -0
  9. package/lib/cjs/table/helpers.js +119 -0
  10. package/lib/cjs/table/helpers.js.map +1 -0
  11. package/lib/cjs/table/hooks/hookCallbackTypes.js +23 -0
  12. package/lib/cjs/table/hooks/hookCallbackTypes.js.map +1 -0
  13. package/lib/cjs/table/hooks/index.js +40 -0
  14. package/lib/cjs/table/hooks/index.js.map +1 -0
  15. package/lib/cjs/table/hooks/useMultiRowSelect.js +84 -0
  16. package/lib/cjs/table/hooks/useMultiRowSelect.js.map +1 -0
  17. package/lib/cjs/table/hooks/useSingleRowSelect.js +61 -0
  18. package/lib/cjs/table/hooks/useSingleRowSelect.js.map +1 -0
  19. package/lib/cjs/table/index.js +44 -0
  20. package/lib/cjs/table/index.js.map +1 -0
  21. package/lib/esm/index.js +1 -0
  22. package/lib/esm/index.js.map +1 -1
  23. package/lib/esm/progress-bar/ProgressBar.js +2 -2
  24. package/lib/esm/progress-bar/ProgressBar.js.map +1 -1
  25. package/lib/esm/table/Table.js +117 -0
  26. package/lib/esm/table/Table.js.map +1 -0
  27. package/lib/esm/table/TableNavigation.js +44 -0
  28. package/lib/esm/table/TableNavigation.js.map +1 -0
  29. package/lib/esm/table/helpers.js +112 -0
  30. package/lib/esm/table/helpers.js.map +1 -0
  31. package/lib/esm/table/hooks/hookCallbackTypes.js +22 -0
  32. package/lib/esm/table/hooks/hookCallbackTypes.js.map +1 -0
  33. package/lib/esm/table/hooks/index.js +24 -0
  34. package/lib/esm/table/hooks/index.js.map +1 -0
  35. package/lib/esm/table/hooks/useMultiRowSelect.js +82 -0
  36. package/lib/esm/table/hooks/useMultiRowSelect.js.map +1 -0
  37. package/lib/esm/table/hooks/useSingleRowSelect.js +57 -0
  38. package/lib/esm/table/hooks/useSingleRowSelect.js.map +1 -0
  39. package/lib/esm/table/index.js +23 -0
  40. package/lib/esm/table/index.js.map +1 -0
  41. package/lib/types/index.d.ts +1 -0
  42. package/lib/types/progress-bar/ProgressBar.d.ts +2 -3
  43. package/lib/types/table/Table.d.ts +78 -0
  44. package/lib/types/table/TableNavigation.d.ts +39 -0
  45. package/lib/types/table/helpers.d.ts +51 -0
  46. package/lib/types/table/hooks/hookCallbackTypes.d.ts +27 -0
  47. package/lib/types/table/hooks/index.d.ts +23 -0
  48. package/lib/types/table/hooks/useMultiRowSelect.d.ts +42 -0
  49. package/lib/types/table/hooks/useSingleRowSelect.d.ts +37 -0
  50. package/lib/types/table/index.d.ts +22 -0
  51. package/package.json +6 -4
@@ -20,11 +20,10 @@
20
20
  */
21
21
  import React from 'react';
22
22
  export interface ProgressBarProps extends React.HTMLProps<HTMLDivElement> {
23
- heading: string;
24
- estimatedTime?: string;
23
+ heading?: string;
25
24
  value: number;
26
25
  barSize: 'small' | 'large';
27
26
  className?: string;
28
27
  }
29
- declare const ProgressBar: React.ForwardRefExoticComponent<Pick<ProgressBarProps, "size" | "className" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "heading" | "list" | "children" | "role" | "as" | "selected" | "onChange" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "estimatedTime" | "barSize"> & React.RefAttributes<HTMLDivElement>>;
28
+ declare const ProgressBar: React.ForwardRefExoticComponent<Pick<ProgressBarProps, "size" | "className" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "heading" | "list" | "children" | "role" | "as" | "selected" | "onChange" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "barSize"> & React.RefAttributes<HTMLDivElement>>;
30
29
  export default ProgressBar;
@@ -0,0 +1,78 @@
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
+ import { Row, UseColumnOrderState, UseExpandedState, UseFiltersState, UsePaginationState, UseGlobalFiltersState, UsePaginationInstanceProps, UseSortByInstanceProps, UseTableInstanceProps } from 'react-table';
23
+ import { ElementBase } from '../helpers/types';
24
+ declare type Sections = Record<'controls' | 'header' | 'body' | 'navigation', JSX.Element | JSX.Element[]>;
25
+ /**
26
+ *
27
+ * Small Utilities
28
+ * for table styling and functionality
29
+ *
30
+ */
31
+ /** For fixed row height tables, we should have a fixed body size */
32
+ export declare const fixedHeight: (items: number, height: number) => {
33
+ style: {
34
+ height: string;
35
+ };
36
+ };
37
+ /** Should make this more specific like RTuseTable type */
38
+ export declare type RTControls = {
39
+ styling?: {
40
+ /** If so, the left corner will not be rounded */
41
+ tabed: boolean;
42
+ };
43
+ };
44
+ declare type DefaultHeaderProps<T extends object> = Pick<UseTableInstanceProps<T>, 'headerGroups'> & UseSortByInstanceProps<T>;
45
+ declare type DefaultBodyProps<T extends object> = {
46
+ actionsButtons?: (row: Row<T>) => JSX.Element | JSX.Element[];
47
+ } & UseTableInstanceProps<T> & Partial<UsePaginationInstanceProps<T>>;
48
+ export interface PaginationTableState<T extends object> extends UseColumnOrderState<T>, UseExpandedState<T>, UseFiltersState<T>, UsePaginationState<T>, UseGlobalFiltersState<T> {
49
+ }
50
+ export declare type DefaultNavigationProps<T extends object> = {
51
+ state: Partial<PaginationTableState<T>>;
52
+ rows: Row<T>[];
53
+ } & UsePaginationInstanceProps<T>;
54
+ /**
55
+ * Table Skeleton to keep most section logic DRY
56
+ *
57
+ * How the table component is divided into sections:
58
+ *
59
+ * @example
60
+ * +----------------+
61
+ * | Table Controls |
62
+ * | (ex: Search) |
63
+ * +----------------+
64
+ * | Header |
65
+ * +----------------+
66
+ * | Body (data) |
67
+ * +----------------+
68
+ * | Navigation |
69
+ * +----------------+
70
+ *
71
+ */
72
+ declare const Table: <T extends object>(props: Partial<Sections> & Partial<{
73
+ actionsButtons?: ((row: Row<T>) => JSX.Element | JSX.Element[]) | undefined;
74
+ } & UseTableInstanceProps<T> & Partial<UsePaginationInstanceProps<T>> & {
75
+ state: Partial<PaginationTableState<T>>;
76
+ rows: Row<T>[];
77
+ } & UsePaginationInstanceProps<T> & Pick<UseTableInstanceProps<T>, "headerGroups"> & UseSortByInstanceProps<T>> & Pick<RTControls, "styling"> & Omit<ElementBase<HTMLDivElement>, "data" | "controls" | "headers" | "rows">) => JSX.Element;
78
+ export default Table;
@@ -0,0 +1,39 @@
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 TableNavigationProps {
23
+ /** If there is a previous page available */
24
+ canPreviousPage: boolean;
25
+ /** If there is a next page available */
26
+ canNextPage: boolean;
27
+ /** On page click */
28
+ onPageClick: (pageNumber: number) => void;
29
+ /** Go to previous page if applicable */
30
+ previousPage: () => void;
31
+ /** Go to next page if applicable */
32
+ nextPage: () => void;
33
+ /** React Table page options */
34
+ pageOptions: any;
35
+ /** React Table current index */
36
+ pageIndex: number;
37
+ }
38
+ export declare const TableNavigation: ({ canPreviousPage, canNextPage, onPageClick, previousPage, nextPage, pageIndex, pageOptions, }: TableNavigationProps) => JSX.Element;
39
+ export default TableNavigation;
@@ -0,0 +1,51 @@
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
+ import { TableResizerProps } from 'react-table';
23
+ /**
24
+ *
25
+ * React Table helper to display sorting icon
26
+ * Source:
27
+ * https://react-table.tanstack.com/docs/api/useSortBy#column-properties
28
+ *
29
+ */
30
+ export declare const SortIcon: ({ isSortedDesc, ...props }: {
31
+ isSortedDesc: boolean | undefined;
32
+ }) => JSX.Element;
33
+ export declare const ResizingBar: import("react").NamedExoticComponent<TableResizerProps>;
34
+ /**
35
+ * The left section of the bottom navigation
36
+ * that is showing the current page and how many results we can see
37
+ */
38
+ export declare const TableResults: ({ pageIndex, pageLength, rowsLength, }: Record<'pageIndex' | 'pageLength' | 'rowsLength', number>) => JSX.Element;
39
+ /**
40
+ * Modified from here: https://gist.github.com/kottenator/9d936eb3e4e3c3e02598
41
+ *
42
+ * @param current Current Index
43
+ * @param max Max Index
44
+ * @returns
45
+ */
46
+ export declare const userFriendlyPagination: (current: number, max: number) => (string | number)[];
47
+ /**
48
+ * Small helper to get handle the Checkbox
49
+ * functionality in tables
50
+ */
51
+ export declare const toggleRowSelection: (list: number[], idx: number) => number[];
@@ -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
+ import { TableInstance } from 'react-table';
22
+ export declare type RowInstance<T extends Record<string, unknown>> = {
23
+ onAllRowSelect: onAllRowSelectType;
24
+ onRowSelect: onRowSelectType<T>;
25
+ } & TableInstance<T>;
26
+ export declare type onAllRowSelectType = () => void;
27
+ export declare type onRowSelectType<T extends Record<string, unknown>> = (originalDataRow: T, index: number) => void;
@@ -0,0 +1,23 @@
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 './useMultiRowSelect';
22
+ export * from './useSingleRowSelect';
23
+ export * from './hookCallbackTypes';
@@ -0,0 +1,42 @@
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 { Hooks, UseGroupByCellProps, UseTableCellProps, UseRowStateCellProps, UseRowSelectRowProps } from 'react-table';
22
+ export interface CustomCell<D extends Record<string, unknown> = Record<string, unknown>, V = any> extends UseTableCellProps<D, V>, UseGroupByCellProps<D>, UseRowSelectRowProps<D>, UseRowStateCellProps<D> {
23
+ }
24
+ /**
25
+ * A react-table plugin to support controlled selected row state for multiple rows
26
+ *
27
+ * Required options provided to useTable:
28
+ *
29
+ * `onAllRowSelect`: A callback that is called when the all rows checkbox is toggled
30
+ * `onRowSelect`: A callback that is called when a rows checkbox is toggled
31
+ *
32
+ * Required fields on `data` provided to useTable:
33
+ *
34
+ * `isSelected`: a boolean that indicates if the row is selected. This key can be changed
35
+ * from `isSelected` to something else by setting the `manualRowSelectedKey` option
36
+ * in the useTable options. See the useRowSelect plugin docs for more details.
37
+ */
38
+ declare const useMultiRowSelect: {
39
+ <T extends Record<string, unknown>>(hooks: Hooks<T>): void;
40
+ pluginName: string;
41
+ };
42
+ export default useMultiRowSelect;
@@ -0,0 +1,37 @@
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 { Hooks } from 'react-table';
22
+ /**
23
+ * A react-table plugin to support controlled selected row state for a single row
24
+ *
25
+ * Required options provided to useTable:
26
+ *
27
+ * `onRowSelect`: A callback that is called when a rows checkbox is toggled
28
+ *
29
+ * Required fields on `data` provided to useTable:
30
+ *
31
+ * `isSelected`: a boolean that indicates if the row is selected. This key can be changed
32
+ * from `isSelected` to something else by setting the `manualRowSelectedKey` option
33
+ * in the useTable options. See the useRowSelect plugin docs for more details.
34
+ * There should only ever be 1 data entry with isSelected set to true
35
+ */
36
+ export declare const useSingleRowSelect: <T extends Record<string, unknown>>(hooks: Hooks<T>) => void;
37
+ export default useSingleRowSelect;
@@ -0,0 +1,22 @@
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 { default as Table } from './Table';
22
+ export * from './hooks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "React implementation of Neo4j Design System",
5
5
  "keywords": [
6
6
  "button",
@@ -47,6 +47,7 @@
47
47
  "@testing-library/react": "^12.1.2",
48
48
  "@types/jest-axe": "^3.5.3",
49
49
  "@types/react-dom": "^17.0.11",
50
+ "@types/react-table": "^7.7.10",
50
51
  "@typescript-eslint/eslint-plugin": "^5.5.0",
51
52
  "@typescript-eslint/parser": "^5.5.0",
52
53
  "babel-jest": "^27.3.1",
@@ -66,9 +67,10 @@
66
67
  },
67
68
  "dependencies": {
68
69
  "@heroicons/react": "^1.0.5",
69
- "@neo4j-ndl/base": "^0.2.0",
70
+ "@neo4j-ndl/base": "^0.3.0",
70
71
  "classnames": "^2.3.1",
71
- "react-dropzone": "^12.0.4"
72
+ "react-dropzone": "^12.0.4",
73
+ "react-table": "^7.7.0"
72
74
  },
73
- "gitHead": "07cac27edcc59c0e790668795cc14cdf4768269c"
75
+ "gitHead": "40d840bea97d8d42c563808e27b57f4f0c9b7011"
74
76
  }