@neo4j-ndl/react 0.2.0 → 0.4.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.
- package/lib/cjs/{input/Input.js → _common/input/RadioAndCheckboxWrapper.js} +6 -6
- package/lib/cjs/_common/input/RadioAndCheckboxWrapper.js.map +1 -0
- package/lib/cjs/_common/input/types.js +3 -0
- package/lib/cjs/_common/input/types.js.map +1 -0
- package/lib/cjs/_common/utilts.js +31 -0
- package/lib/cjs/_common/utilts.js.map +1 -0
- package/lib/cjs/button/Button.js +18 -13
- package/lib/cjs/button/Button.js.map +1 -1
- package/lib/cjs/button/IconButton.js +85 -0
- package/lib/cjs/button/IconButton.js.map +1 -0
- package/lib/cjs/button/IconButtonArray.js +52 -0
- package/lib/cjs/button/IconButtonArray.js.map +1 -0
- package/lib/cjs/button/index.js +2 -0
- package/lib/cjs/button/index.js.map +1 -1
- package/lib/cjs/checkbox/Checkbox.js +2 -2
- package/lib/cjs/checkbox/Checkbox.js.map +1 -1
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/label/Label.js +3 -1
- package/lib/cjs/label/Label.js.map +1 -1
- package/lib/cjs/progress-bar/ProgressBar.js +2 -2
- package/lib/cjs/progress-bar/ProgressBar.js.map +1 -1
- package/lib/cjs/radio/Radio.js +2 -2
- package/lib/cjs/radio/Radio.js.map +1 -1
- package/lib/cjs/switch/Switch.js +2 -2
- package/lib/cjs/switch/Switch.js.map +1 -1
- package/lib/cjs/table/Table.js +124 -0
- package/lib/cjs/table/Table.js.map +1 -0
- package/lib/cjs/table/TableNavigation.js +51 -0
- package/lib/cjs/table/TableNavigation.js.map +1 -0
- package/lib/cjs/table/helpers.js +119 -0
- package/lib/cjs/table/helpers.js.map +1 -0
- package/lib/cjs/table/hooks/hookCallbackTypes.js +23 -0
- package/lib/cjs/table/hooks/hookCallbackTypes.js.map +1 -0
- package/lib/cjs/table/hooks/index.js +40 -0
- package/lib/cjs/table/hooks/index.js.map +1 -0
- package/lib/cjs/table/hooks/useMultiRowSelect.js +84 -0
- package/lib/cjs/table/hooks/useMultiRowSelect.js.map +1 -0
- package/lib/cjs/table/hooks/useSingleRowSelect.js +61 -0
- package/lib/cjs/table/hooks/useSingleRowSelect.js.map +1 -0
- package/lib/cjs/table/index.js +44 -0
- package/lib/cjs/table/index.js.map +1 -0
- package/lib/cjs/tabs/Tabs.js +4 -3
- package/lib/cjs/tabs/Tabs.js.map +1 -1
- package/lib/cjs/text-input/TextInput.js +72 -0
- package/lib/cjs/text-input/TextInput.js.map +1 -0
- package/lib/cjs/{input → text-input}/index.js +3 -3
- package/lib/cjs/text-input/index.js.map +1 -0
- package/lib/esm/{input/Input.js → _common/input/RadioAndCheckboxWrapper.js} +6 -6
- package/lib/esm/_common/input/RadioAndCheckboxWrapper.js.map +1 -0
- package/lib/esm/_common/input/types.js +2 -0
- package/lib/esm/_common/input/types.js.map +1 -0
- package/lib/esm/_common/utilts.js +25 -0
- package/lib/esm/_common/utilts.js.map +1 -0
- package/lib/esm/button/Button.js +16 -9
- package/lib/esm/button/Button.js.map +1 -1
- package/lib/esm/button/IconButton.js +79 -0
- package/lib/esm/button/IconButton.js.map +1 -0
- package/lib/esm/button/IconButtonArray.js +46 -0
- package/lib/esm/button/IconButtonArray.js.map +1 -0
- package/lib/esm/button/index.js +2 -0
- package/lib/esm/button/index.js.map +1 -1
- package/lib/esm/checkbox/Checkbox.js +2 -2
- package/lib/esm/checkbox/Checkbox.js.map +1 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/label/Label.js +3 -1
- package/lib/esm/label/Label.js.map +1 -1
- package/lib/esm/progress-bar/ProgressBar.js +2 -2
- package/lib/esm/progress-bar/ProgressBar.js.map +1 -1
- package/lib/esm/radio/Radio.js +2 -2
- package/lib/esm/radio/Radio.js.map +1 -1
- package/lib/esm/switch/Switch.js +2 -2
- package/lib/esm/switch/Switch.js.map +1 -1
- package/lib/esm/table/Table.js +117 -0
- package/lib/esm/table/Table.js.map +1 -0
- package/lib/esm/table/TableNavigation.js +44 -0
- package/lib/esm/table/TableNavigation.js.map +1 -0
- package/lib/esm/table/helpers.js +112 -0
- package/lib/esm/table/helpers.js.map +1 -0
- package/lib/esm/{input/index.js → table/hooks/hookCallbackTypes.js} +2 -2
- package/lib/esm/table/hooks/hookCallbackTypes.js.map +1 -0
- package/lib/esm/table/hooks/index.js +24 -0
- package/lib/esm/table/hooks/index.js.map +1 -0
- package/lib/esm/table/hooks/useMultiRowSelect.js +82 -0
- package/lib/esm/table/hooks/useMultiRowSelect.js.map +1 -0
- package/lib/esm/table/hooks/useSingleRowSelect.js +57 -0
- package/lib/esm/table/hooks/useSingleRowSelect.js.map +1 -0
- package/lib/esm/table/index.js +23 -0
- package/lib/esm/table/index.js.map +1 -0
- package/lib/esm/tabs/Tabs.js +4 -3
- package/lib/esm/tabs/Tabs.js.map +1 -1
- package/lib/esm/text-input/TextInput.js +67 -0
- package/lib/esm/text-input/TextInput.js.map +1 -0
- package/lib/esm/text-input/index.js +22 -0
- package/lib/esm/text-input/index.js.map +1 -0
- package/lib/types/_common/input/RadioAndCheckboxWrapper.d.ts +37 -0
- package/lib/types/_common/input/types.d.ts +31 -0
- package/lib/types/_common/utilts.d.ts +24 -0
- package/lib/types/alert/Alert.d.ts +1 -1
- package/lib/types/button/Button.d.ts +3 -4
- package/lib/types/button/IconButton.d.ts +47 -0
- package/lib/types/button/IconButtonArray.d.ts +37 -0
- package/lib/types/button/index.d.ts +2 -0
- package/lib/types/checkbox/Checkbox.d.ts +2 -2
- package/lib/types/index.d.ts +2 -0
- package/lib/types/progress-bar/ProgressBar.d.ts +2 -3
- package/lib/types/radio/Radio.d.ts +2 -2
- package/lib/types/switch/Switch.d.ts +2 -2
- package/lib/types/table/Table.d.ts +71 -0
- package/lib/types/table/TableNavigation.d.ts +39 -0
- package/lib/types/table/helpers.d.ts +51 -0
- package/lib/types/table/hooks/hookCallbackTypes.d.ts +27 -0
- package/lib/types/table/hooks/index.d.ts +23 -0
- package/lib/types/table/hooks/useMultiRowSelect.d.ts +42 -0
- package/lib/types/table/hooks/useSingleRowSelect.d.ts +37 -0
- package/lib/types/table/index.d.ts +22 -0
- package/lib/types/tabs/Tabs.d.ts +3 -4
- package/lib/types/text-input/TextInput.d.ts +55 -0
- package/lib/types/{input → text-input}/index.d.ts +1 -1
- package/package.json +6 -5
- package/lib/cjs/input/Input.js.map +0 -1
- package/lib/cjs/input/index.js.map +0 -1
- package/lib/esm/input/Input.js.map +0 -1
- package/lib/esm/input/index.js.map +0 -1
- package/lib/types/input/Input.d.ts +0 -44
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) "Neo4j"
|
|
16
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
17
|
+
*
|
|
18
|
+
* This file is part of Neo4j.
|
|
19
|
+
*
|
|
20
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
21
|
+
* it under the terms of the GNU General Public License as published by
|
|
22
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
+
* (at your option) any later version.
|
|
24
|
+
*
|
|
25
|
+
* This program is distributed in the hope that it will be useful,
|
|
26
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
+
* GNU General Public License for more details.
|
|
29
|
+
*
|
|
30
|
+
* You should have received a copy of the GNU General Public License
|
|
31
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
|
+
*/
|
|
33
|
+
import { HeroIcon } from '../icons';
|
|
34
|
+
import { memo } from 'react';
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* React Table helper to display sorting icon
|
|
38
|
+
* Source:
|
|
39
|
+
* https://react-table.tanstack.com/docs/api/useSortBy#column-properties
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export const SortIcon = (_a) => {
|
|
43
|
+
var { isSortedDesc } = _a, props = __rest(_a, ["isSortedDesc"]);
|
|
44
|
+
switch (true) {
|
|
45
|
+
case isSortedDesc === true:
|
|
46
|
+
return (_jsx(HeroIcon, Object.assign({}, props, { className: "n-w-4 n-h-4", type: "outline", iconName: "SortDescendingIcon" })));
|
|
47
|
+
case isSortedDesc === false:
|
|
48
|
+
return (_jsx(HeroIcon, Object.assign({}, props, { className: "n-w-4 n-h-4", type: "outline", iconName: "SortAscendingIcon" })));
|
|
49
|
+
default:
|
|
50
|
+
return (_jsx(HeroIcon, Object.assign({}, props, { className: "n-w-4 n-h-4", type: "outline", iconName: "MenuAlt1Icon" })));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export const ResizingBar = memo(function ResizingBarMemoed(props) {
|
|
54
|
+
return (_jsx("div", Object.assign({}, props, { className: "table-resizing-bar", style: {
|
|
55
|
+
width: '4px',
|
|
56
|
+
zIndex: 1,
|
|
57
|
+
// prevents from scrolling while dragging on touch devices
|
|
58
|
+
touchAction: 'none',
|
|
59
|
+
} })));
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* The left section of the bottom navigation
|
|
63
|
+
* that is showing the current page and how many results we can see
|
|
64
|
+
*/
|
|
65
|
+
export const TableResults = ({ pageIndex, pageLength, rowsLength, }) => (_jsx("span", Object.assign({ className: "n-text-light-neutral-text-weaker body-medium n-whitespace-nowrap" }, { children: _jsxs("span", { children: ["Showing", ' ', _jsxs("b", { children: [pageIndex * 10, "-", pageIndex * 10 + pageLength] }), ' ', "of ", _jsx("b", { children: rowsLength }), " results"] }) })));
|
|
66
|
+
/**
|
|
67
|
+
* Modified from here: https://gist.github.com/kottenator/9d936eb3e4e3c3e02598
|
|
68
|
+
*
|
|
69
|
+
* @param current Current Index
|
|
70
|
+
* @param max Max Index
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
export const userFriendlyPagination = (current, max) => {
|
|
74
|
+
const last = max;
|
|
75
|
+
const delta = 2;
|
|
76
|
+
const left = current - delta;
|
|
77
|
+
const right = current + delta + 1;
|
|
78
|
+
const range = [];
|
|
79
|
+
const rangeWithDots = [];
|
|
80
|
+
let l;
|
|
81
|
+
for (let i = 1; i <= last; i += 1) {
|
|
82
|
+
if (i === 1 || i === last || (i >= left && i < right)) {
|
|
83
|
+
range.push(i);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (let i = 0; i < range.length; i += 1) {
|
|
87
|
+
if (l) {
|
|
88
|
+
if (range[i] - l === 2) {
|
|
89
|
+
rangeWithDots.push(l + 1);
|
|
90
|
+
}
|
|
91
|
+
else if (range[i] - l !== 1) {
|
|
92
|
+
rangeWithDots.push('...');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
rangeWithDots.push(range[i]);
|
|
96
|
+
l = range[i];
|
|
97
|
+
}
|
|
98
|
+
return rangeWithDots;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Small helper to get handle the Checkbox
|
|
102
|
+
* functionality in tables
|
|
103
|
+
*/
|
|
104
|
+
export const toggleRowSelection = (list, idx) => {
|
|
105
|
+
// Removing from the list
|
|
106
|
+
if (list.includes(idx)) {
|
|
107
|
+
return list.filter((o) => o !== idx);
|
|
108
|
+
}
|
|
109
|
+
// Adding to the list
|
|
110
|
+
return [...list, idx];
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/table/helpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAKxB,EAAE,EAAE;QALoB,EACvB,YAAY,OAIb,EAHI,KAAK,cAFe,gBAGxB,CADS;IAIR,QAAQ,IAAI,EAAE;QACZ,KAAK,YAAY,KAAK,IAAI;YACxB,OAAO,CACL,KAAC,QAAQ,oBACH,KAAK,IACT,SAAS,EAAC,aAAa,EACvB,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,oBAAoB,IAC7B,CACH,CAAC;QACJ,KAAK,YAAY,KAAK,KAAK;YACzB,OAAO,CACL,KAAC,QAAQ,oBACH,KAAK,IACT,SAAS,EAAC,aAAa,EACvB,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,mBAAmB,IAC5B,CACH,CAAC;QACJ;YACE,OAAO,CACL,KAAC,QAAQ,oBACH,KAAK,IACT,SAAS,EAAC,aAAa,EACvB,IAAI,EAAC,SAAS,EACd,QAAQ,EAAC,cAAc,IACvB,CACH,CAAC;KACL;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,iBAAiB,CACxD,KAAwB;IAExB,OAAO,CACL,8BACM,KAAK,IACT,SAAS,EAAC,oBAAoB,EAC9B,KAAK,EAAE;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,CAAC;YACT,4DAA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AC,CAAC,GAAG,CAAC,CAAC,CAAC;aAC3B;iBAAM,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBAC7B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAC3B;SACF;QACD,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;KACd;IAED,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAc,EAAE,GAAW,EAAE,EAAE;IAChE,yBAAyB;IACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;KACtC;IACD,qBAAqB;IACrB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* You should have received a copy of the GNU General Public License
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
export {
|
|
22
|
-
//# sourceMappingURL=
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=hookCallbackTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hookCallbackTypes.js","sourceRoot":"","sources":["../../../../src/table/hooks/hookCallbackTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
23
|
+
import { useRowSelect, } from 'react-table';
|
|
24
|
+
import { Checkbox } from '../../checkbox';
|
|
25
|
+
/**
|
|
26
|
+
* A react-table plugin to support controlled selected row state for multiple rows
|
|
27
|
+
*
|
|
28
|
+
* Required options provided to useTable:
|
|
29
|
+
*
|
|
30
|
+
* `onAllRowSelect`: A callback that is called when the all rows checkbox is toggled
|
|
31
|
+
* `onRowSelect`: A callback that is called when a rows checkbox is toggled
|
|
32
|
+
*
|
|
33
|
+
* Required fields on `data` provided to useTable:
|
|
34
|
+
*
|
|
35
|
+
* `isSelected`: a boolean that indicates if the row is selected. This key can be changed
|
|
36
|
+
* from `isSelected` to something else by setting the `manualRowSelectedKey` option
|
|
37
|
+
* in the useTable options. See the useRowSelect plugin docs for more details.
|
|
38
|
+
*/
|
|
39
|
+
const useMultiRowSelect = (hooks) => {
|
|
40
|
+
useRowSelect(hooks);
|
|
41
|
+
/*
|
|
42
|
+
Used for the indeterminate
|
|
43
|
+
state of the checkbox
|
|
44
|
+
*/
|
|
45
|
+
hooks.useControlledState.push((state, { instance }) => {
|
|
46
|
+
const { data } = instance;
|
|
47
|
+
const isSelectedKey = 'isSelected';
|
|
48
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
49
|
+
const newState = useMemo(() => (Object.assign(Object.assign({}, state), { selectedRowIds: data.reduce((acc, curr, index) => {
|
|
50
|
+
if (curr[isSelectedKey]) {
|
|
51
|
+
return Object.assign(Object.assign({}, acc), { [index]: true });
|
|
52
|
+
}
|
|
53
|
+
return acc;
|
|
54
|
+
}, {}) })), [state, data, isSelectedKey]);
|
|
55
|
+
return newState;
|
|
56
|
+
});
|
|
57
|
+
hooks.visibleColumns.push((columns, { instance }) => [
|
|
58
|
+
// Let's make a column for selection
|
|
59
|
+
{
|
|
60
|
+
id: 'ndl-checkbox-selection',
|
|
61
|
+
// The header can use the table's getToggleAllRowsSelectedProps method
|
|
62
|
+
// to render a checkbox
|
|
63
|
+
Header: ({ getToggleAllRowsSelectedProps, }) => {
|
|
64
|
+
const checkboxRef = useRef(null);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (checkboxRef && checkboxRef.current) {
|
|
67
|
+
checkboxRef.current.indeterminate =
|
|
68
|
+
getToggleAllRowsSelectedProps().indeterminate || false;
|
|
69
|
+
}
|
|
70
|
+
}, [checkboxRef, getToggleAllRowsSelectedProps]);
|
|
71
|
+
return (_jsx(Checkbox, Object.assign({ "aria-label": "all-rows-select", onClick: () => instance.onAllRowSelect() }, getToggleAllRowsSelectedProps(), { ref: checkboxRef })));
|
|
72
|
+
},
|
|
73
|
+
// The cell can use the individual row's getToggleRowSelectedProps method
|
|
74
|
+
// to the render a checkbox
|
|
75
|
+
Cell: ({ row }) => (_jsx("div", { children: _jsx(Checkbox, Object.assign({ "aria-label": `row-${row.index}`, onClick: () => instance.onRowSelect(row.original, row.index) }, row.getToggleRowSelectedProps())) })),
|
|
76
|
+
},
|
|
77
|
+
...columns,
|
|
78
|
+
]);
|
|
79
|
+
};
|
|
80
|
+
useMultiRowSelect.pluginName = 'useMultiRowSelect';
|
|
81
|
+
export default useMultiRowSelect;
|
|
82
|
+
//# sourceMappingURL=useMultiRowSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMultiRowSelect.js","sourceRoot":"","sources":["../../../../src/table/hooks/useMultiRowSelect.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAI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C,aAAa;4BAC/B,6BAA6B,EAAE,CAAC,aAAa,IAAI,KAAK,CAAC;qBAC1D;gBACH,CAAC,EAAE,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC,CAAC;gBACjD,OAAO,CACL,KAAC,QAAQ,gCACI,iBAAiB,EAC5B,OAAO,EAAE,GAAG,EAAE,CAAE,QAA2B,CAAC,cAAc,EAAE,IACxD,6BAA6B,EAAE,IACnC,GAAG,EAAE,WAAW,IAChB,CACH,CAAC;YACJ,CAAC;YACD,yEAAyE;YACzE,2BAA2B;YAC3B,IAAI,EAAE,CAAC,EAAE,GAAG,EAAW,EAAE,EAAE,CAAC,CAC1B,wBACE,KAAC,QAAQ,gCACK,OAAO,GAAG,CAAC,KAAK,EAAE,EAC9B,OAAO,EAAE,GAAG,EAAE,CACX,QAA2B,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,IAE9D,GAAW,CAAC,yBAAyB,EAAE,EAC5C,GACE,CACP;SACF;QACD,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,iBAAiB,CAAC,UAAU,GAAG,mBAAmB,CAAC;AAEnD,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import { useRowSelect } from 'react-table';
|
|
23
|
+
import { Radio } from '../../radio';
|
|
24
|
+
/**
|
|
25
|
+
* A react-table plugin to support controlled selected row state for a single row
|
|
26
|
+
*
|
|
27
|
+
* Required options provided to useTable:
|
|
28
|
+
*
|
|
29
|
+
* `onRowSelect`: A callback that is called when a rows checkbox is toggled
|
|
30
|
+
*
|
|
31
|
+
* Required fields on `data` provided to useTable:
|
|
32
|
+
*
|
|
33
|
+
* `isSelected`: a boolean that indicates if the row is selected. This key can be changed
|
|
34
|
+
* from `isSelected` to something else by setting the `manualRowSelectedKey` option
|
|
35
|
+
* in the useTable options. See the useRowSelect plugin docs for more details.
|
|
36
|
+
* There should only ever be 1 data entry with isSelected set to true
|
|
37
|
+
*/
|
|
38
|
+
export const useSingleRowSelect = (hooks) => {
|
|
39
|
+
useRowSelect(hooks);
|
|
40
|
+
hooks.visibleColumns.push((columns, { instance }) => [
|
|
41
|
+
// Let's make a column for selection
|
|
42
|
+
// This should be definitely unique to avoid collision
|
|
43
|
+
{
|
|
44
|
+
id: 'ndl-radio-selection',
|
|
45
|
+
Header: () => null,
|
|
46
|
+
width: 20,
|
|
47
|
+
// The cell can use the individual row's getToggleRowSelectedProps method
|
|
48
|
+
// to the render a checkbox
|
|
49
|
+
Cell: ({ row }) => {
|
|
50
|
+
return (_jsx(Radio, Object.assign({}, row.getToggleRowSelectedProps(), { onChange: () => instance.onRowSelect(row.original, row.index) })));
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
...columns,
|
|
54
|
+
]);
|
|
55
|
+
};
|
|
56
|
+
export default useSingleRowSelect;
|
|
57
|
+
//# sourceMappingURL=useSingleRowSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSingleRowSelect.js","sourceRoot":"","sources":["../../../../src/table/hooks/useSingleRowSelect.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAe,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAe,EACf,EAAE;IACF,YAAY,CAAC,KAAK,CAAC,CAAC;IAEpB,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QACnD,oCAAoC;QACpC,sDAAsD;QACtD;YACE,EAAE,EAAE,qBAAqB;YACzB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,KAAK,EAAE,EAAE;YACT,yEAAyE;YACzE,2BAA2B;YAC3B,IAAI,EAAE,CAAC,EAAE,GAAG,EAAW,EAAE,EAAE;gBACzB,OAAO,CACL,KAAC,KAAK,oBACC,GAAW,CAAC,yBAAyB,EAAE,IAC5C,QAAQ,EAAE,GAAG,EAAE,CACZ,QAA2B,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,IAEnE,CACH,CAAC;YACJ,CAAC;SACF;QACD,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -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 { default as Table } from './Table';
|
|
22
|
+
export * from './hooks';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC"}
|
package/lib/esm/tabs/Tabs.js
CHANGED
|
@@ -32,6 +32,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
32
32
|
*/
|
|
33
33
|
import React, { useContext } from 'react';
|
|
34
34
|
import classnames from 'classnames';
|
|
35
|
+
import { forwardRef } from '../helpers';
|
|
35
36
|
const TabsContext = React.createContext(null);
|
|
36
37
|
const useTabsContext = () => {
|
|
37
38
|
const context = useContext(TabsContext);
|
|
@@ -45,11 +46,11 @@ const getGeneralTabClasses = (size, fill) => {
|
|
|
45
46
|
return {
|
|
46
47
|
large: size === 'large',
|
|
47
48
|
small: size === 'small',
|
|
48
|
-
filled: fill === 'filled',
|
|
49
|
-
underline: fill === 'underline',
|
|
49
|
+
'filled-tab': fill === 'filled',
|
|
50
|
+
'underline-tab': fill === 'underline',
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
|
-
export const Tabs =
|
|
53
|
+
export const Tabs = forwardRef(function Tabs(_a, ref) {
|
|
53
54
|
var { children, size = 'large', fill = 'underline', onChange, value, className, as = 'div' } = _a, rest = __rest(_a, ["children", "size", "fill", "onChange", "value", "className", "as"]);
|
|
54
55
|
const classes = classnames('ndl-tabs', getGeneralTabClasses(size, fill), className);
|
|
55
56
|
const Component = as;
|
package/lib/esm/tabs/Tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/tabs/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/tabs/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAoCxC,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAA8B,IAAI,CAAC,CAAC;AAE3E,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAExC,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;KAC7C;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,YAAY,KAAK,EAAE,CAAC;AAE5D,MAAM,oBAAoB,GAAG,CAAC,IAAU,EAAE,IAAU,EAAE,EAAE;IACtD,OAAO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.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) "Neo4j"
|
|
16
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
17
|
+
*
|
|
18
|
+
* This file is part of Neo4j.
|
|
19
|
+
*
|
|
20
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
21
|
+
* it under the terms of the GNU General Public License as published by
|
|
22
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
+
* (at your option) any later version.
|
|
24
|
+
*
|
|
25
|
+
* This program is distributed in the hope that it will be useful,
|
|
26
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
+
* GNU General Public License for more details.
|
|
29
|
+
*
|
|
30
|
+
* You should have received a copy of the GNU General Public License
|
|
31
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
|
+
*/
|
|
33
|
+
import React from 'react';
|
|
34
|
+
import classNames from 'classnames';
|
|
35
|
+
import { HeroIcon } from '../icons';
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* Helpers
|
|
40
|
+
*
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
/** Add any helper functions here. */
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*
|
|
47
|
+
* TextInput Component
|
|
48
|
+
*
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
const TextInput = React.forwardRef(function TextInput(props, ref) {
|
|
52
|
+
const { label, fluid, errorText, helpText, leftIcon, rightIcon, type = 'text', containerSize = 'small' } = props, otherInputProps = __rest(props, ["label", "fluid", "errorText", "helpText", "leftIcon", "rightIcon", "type", "containerSize"]);
|
|
53
|
+
const containerWrappingClass = classNames(`ndl-form-item ndl-type-text`, {
|
|
54
|
+
disabled: otherInputProps.disabled,
|
|
55
|
+
[containerSize]: containerSize,
|
|
56
|
+
'has-error': errorText,
|
|
57
|
+
'has-left-icon': leftIcon,
|
|
58
|
+
'has-right-icon': rightIcon || errorText,
|
|
59
|
+
'has-icon': leftIcon || rightIcon || errorText,
|
|
60
|
+
});
|
|
61
|
+
const labelWrappingClass = classNames(`form-item-label`, {
|
|
62
|
+
fluid,
|
|
63
|
+
});
|
|
64
|
+
return (_jsxs("div", Object.assign({ className: containerWrappingClass }, { children: [_jsxs("label", Object.assign({ className: labelWrappingClass }, { children: [_jsxs("div", Object.assign({ className: "input-wrapper" }, { children: [leftIcon && _jsx("div", Object.assign({ className: "icon left-icon" }, { children: leftIcon })), _jsx("input", Object.assign({}, otherInputProps, { type: type, ref: ref })), rightIcon && !errorText && (_jsx("div", Object.assign({ className: "icon right-icon" }, { children: rightIcon }))), errorText && (_jsx("div", Object.assign({ className: "icon right-icon error-icon" }, { children: _jsx(HeroIcon, { iconName: "ExclamationCircleIcon", type: "solid" }) })))] })), _jsx("span", Object.assign({ className: "form-label-text" }, { children: label }))] })), (errorText || helpText) && (_jsx("div", Object.assign({ className: "form-msg" }, { children: errorText || helpText })))] })));
|
|
65
|
+
});
|
|
66
|
+
export default TextInput;
|
|
67
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;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K,SAAS,EAAC,4BAA4B,gBACzC,KAAC,QAAQ,IAAC,QAAQ,EAAC,uBAAuB,EAAC,IAAI,EAAC,OAAO,GAAG,IACtD,CACP,KACG,EAEN,6BAAM,SAAS,EAAC,iBAAiB,gBAAE,KAAK,IAAQ,KAC1C,EACP,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,CAC1B,4BAAK,SAAS,EAAC,UAAU,gBAAE,SAAS,IAAI,QAAQ,IAAO,CACxD,KACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -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 TextInput } from './TextInput';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/text-input/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -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
|
+
/// <reference types="react" />
|
|
22
|
+
import { CommonInputProps } from './types';
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*
|
|
26
|
+
* Types
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export interface RadioAndCheckboxProps extends CommonInputProps {
|
|
31
|
+
/** Sets checked state */
|
|
32
|
+
checked?: boolean;
|
|
33
|
+
/** Displays label before */
|
|
34
|
+
labelBefore?: boolean;
|
|
35
|
+
}
|
|
36
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<RadioAndCheckboxProps, "size" | "className" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "list" | "children" | "role" | "onChange" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "placeholder" | "readOnly" | "required" | "src" | "step" | "type" | "value" | "width" | "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" | "enterKeyHint" | "labelBefore" | "fluid"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
export interface CommonInputProps extends React.ComponentPropsWithoutRef<'input'> {
|
|
23
|
+
/** Sets disabled state */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** Sets the label */
|
|
26
|
+
label?: string;
|
|
27
|
+
/** Displays with fluid width */
|
|
28
|
+
fluid?: boolean;
|
|
29
|
+
/** Ref to the `input` element */
|
|
30
|
+
ref?: React.RefObject<HTMLInputElement>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 declare const removeNewlines: (input: string) => string;
|
|
22
|
+
/** Remove extra spaces from sting */
|
|
23
|
+
export declare const removeSpaces: (input: string) => string;
|
|
24
|
+
export declare const needleWarningMessage: (message: string) => void;
|