@neo4j-ndl/react 0.3.0 → 0.5.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/utils.js +59 -0
- package/lib/cjs/_common/utils.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/context-menu/ContextMenu.js +7 -13
- package/lib/cjs/context-menu/ContextMenu.js.map +1 -1
- package/lib/cjs/dialog/Dialog.js +161 -0
- package/lib/cjs/dialog/Dialog.js.map +1 -0
- package/lib/cjs/dialog/index.js +38 -0
- package/lib/cjs/dialog/index.js.map +1 -0
- package/lib/cjs/index.js +3 -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/modal/Modal.js +105 -0
- package/lib/cjs/modal/Modal.js.map +1 -0
- package/lib/cjs/modal/index.js +38 -0
- package/lib/cjs/modal/index.js.map +1 -0
- package/lib/cjs/popover/Popover.js +11 -47
- package/lib/cjs/popover/Popover.js.map +1 -1
- package/lib/cjs/portal/Portal.js +52 -0
- package/lib/cjs/portal/Portal.js.map +1 -0
- package/lib/cjs/portal/index.js +38 -0
- package/lib/cjs/portal/index.js.map +1 -0
- 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 +5 -5
- package/lib/cjs/table/Table.js.map +1 -1
- 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/cjs/trap-focus/TrapFocus.js +310 -0
- package/lib/cjs/trap-focus/TrapFocus.js.map +1 -0
- package/lib/cjs/trap-focus/index.js +38 -0
- package/lib/cjs/trap-focus/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/utils.js +52 -0
- package/lib/esm/_common/utils.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/context-menu/ContextMenu.js +7 -13
- package/lib/esm/context-menu/ContextMenu.js.map +1 -1
- package/lib/esm/dialog/Dialog.js +131 -0
- package/lib/esm/dialog/Dialog.js.map +1 -0
- package/lib/esm/{input → dialog}/index.js +1 -1
- package/lib/esm/dialog/index.js.map +1 -0
- package/lib/esm/index.js +3 -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/modal/Modal.js +75 -0
- package/lib/esm/modal/Modal.js.map +1 -0
- package/lib/esm/modal/index.js +22 -0
- package/lib/esm/modal/index.js.map +1 -0
- package/lib/esm/popover/Popover.js +11 -24
- package/lib/esm/popover/Popover.js.map +1 -1
- package/lib/esm/portal/Portal.js +25 -0
- package/lib/esm/portal/Portal.js.map +1 -0
- package/lib/esm/portal/index.js +22 -0
- package/lib/esm/portal/index.js.map +1 -0
- 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 +5 -5
- package/lib/esm/table/Table.js.map +1 -1
- 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/esm/trap-focus/TrapFocus.js +283 -0
- package/lib/esm/trap-focus/TrapFocus.js.map +1 -0
- package/lib/esm/trap-focus/index.js +22 -0
- package/lib/esm/trap-focus/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/utils.d.ts +29 -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/context-menu/ContextMenu.d.ts +4 -1
- package/lib/types/dialog/Dialog.d.ts +55 -0
- package/lib/types/{input → dialog}/index.d.ts +1 -1
- package/lib/types/index.d.ts +3 -0
- package/lib/types/modal/Modal.d.ts +34 -0
- package/lib/types/modal/index.d.ts +21 -0
- package/lib/types/popover/Popover.d.ts +4 -2
- package/lib/types/portal/Portal.d.ts +27 -0
- package/lib/types/portal/index.d.ts +21 -0
- 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 +1 -8
- package/lib/types/tabs/Tabs.d.ts +3 -4
- package/lib/types/text-input/TextInput.d.ts +55 -0
- package/lib/types/text-input/index.d.ts +21 -0
- package/lib/types/trap-focus/TrapFocus.d.ts +35 -0
- package/lib/types/trap-focus/index.d.ts +21 -0
- package/package.json +3 -4
- 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
package/lib/cjs/tabs/Tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/tabs/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+CAA0C;AAC1C,4DAAoC;
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/tabs/Tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+CAA0C;AAC1C,4DAAoC;AACpC,wCAAwC;AAoCxC,MAAM,WAAW,GAAG,eAAK,CAAC,aAAa,CAA8B,IAAI,CAAC,CAAC;AAE3E,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,WAAW,CAAC,CAAC;IAExC,IAAI,OAAO,KAAK,IAAI,EAAE;QACp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AAE,aAAa,CAAC,KAAK,CAAC,IACpB,IAAI,IACR,GAAG,EAAE,GAAG,gBAEP,QAAQ,IACC,CACb,GACA,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) "Neo4j"
|
|
21
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
22
|
+
*
|
|
23
|
+
* This file is part of Neo4j.
|
|
24
|
+
*
|
|
25
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
26
|
+
* it under the terms of the GNU General Public License as published by
|
|
27
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
28
|
+
* (at your option) any later version.
|
|
29
|
+
*
|
|
30
|
+
* This program is distributed in the hope that it will be useful,
|
|
31
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
32
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
33
|
+
* GNU General Public License for more details.
|
|
34
|
+
*
|
|
35
|
+
* You should have received a copy of the GNU General Public License
|
|
36
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
37
|
+
*/
|
|
38
|
+
const react_1 = __importDefault(require("react"));
|
|
39
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
40
|
+
const icons_1 = require("../icons");
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* Helpers
|
|
45
|
+
*
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
/** Add any helper functions here. */
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* TextInput Component
|
|
53
|
+
*
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
const TextInput = react_1.default.forwardRef(function TextInput(props, ref) {
|
|
57
|
+
const { label, fluid, errorText, helpText, leftIcon, rightIcon, type = 'text', containerSize = 'small' } = props, otherInputProps = __rest(props, ["label", "fluid", "errorText", "helpText", "leftIcon", "rightIcon", "type", "containerSize"]);
|
|
58
|
+
const containerWrappingClass = (0, classnames_1.default)(`ndl-form-item ndl-type-text`, {
|
|
59
|
+
disabled: otherInputProps.disabled,
|
|
60
|
+
[containerSize]: containerSize,
|
|
61
|
+
'has-error': errorText,
|
|
62
|
+
'has-left-icon': leftIcon,
|
|
63
|
+
'has-right-icon': rightIcon || errorText,
|
|
64
|
+
'has-icon': leftIcon || rightIcon || errorText,
|
|
65
|
+
});
|
|
66
|
+
const labelWrappingClass = (0, classnames_1.default)(`form-item-label`, {
|
|
67
|
+
fluid,
|
|
68
|
+
});
|
|
69
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: containerWrappingClass }, { children: [(0, jsx_runtime_1.jsxs)("label", Object.assign({ className: labelWrappingClass }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "input-wrapper" }, { children: [leftIcon && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "icon left-icon" }, { children: leftIcon })), (0, jsx_runtime_1.jsx)("input", Object.assign({}, otherInputProps, { type: type, ref: ref })), rightIcon && !errorText && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "icon right-icon" }, { children: rightIcon }))), errorText && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "icon right-icon error-icon" }, { children: (0, jsx_runtime_1.jsx)(icons_1.HeroIcon, { iconName: "ExclamationCircleIcon", type: "solid" }) })))] })), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: "form-label-text" }, { children: label }))] })), (errorText || helpText) && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "form-msg" }, { children: errorText || helpText })))] })));
|
|
70
|
+
});
|
|
71
|
+
exports.default = TextInput;
|
|
72
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/text-input/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAA4C;AAC5C,4DAAoC;AAEpC,oCAAoC;AAyBpC;;;;;;GAMG;AAEH,qCAAqC;AAErC;;;;;;GAMG;AAEH,MAAM,SAAS,GAAG,eAAK,CAAC,UAAU,CAAC,SAAS,SAAS,CACnD,KAA0B,EAC1B,GAAmC;IAEnC,MAAM,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,MAAM,EACb,aAAa,GAAG,OAAO,KAErB,KAAK,EADJ,eAAe,UAChB,KAAK,EAVH,6FAUL,CAAQ,CAAC;IAEV,MAAM,sBAAsB,GAAG,IAAA,oBAAU,EAAC,6BAA6B,EAAE;QACvE,QAAQ,EAAE,eAAe,CAAC,QAAQ;QAClC,CAAC,aAAa,CAAC,EAAE,aAAa;QAC9B,WAAW,EAAE,SAAS;QACtB,eAAe,EAAE,QAAQ;QACzB,gBAAgB,EAAE,SAAS,IAAI,SAAS;QACxC,UAAU,EAAE,QAAQ,IAAI,SAAS,IAAI,SAAS;KAC/C,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,IAAA,oBAAU,EAAC,iBAAiB,EAAE;QACvD,KAAK;KACN,CAAC,CAAC;IAEH,OAAO,CACL,+CAAK,SAAS,EAAE,sBAAsB,iBAGpC,iDAAO,SAAS,EAAE,kBAAkB,iBAClC,+CAAK,SAAS,EAAC,eAAe,iBAC3B,QAAQ,IAAI,8CAAK,SAAS,EAAC,gBAAgB,gBAAE,QAAQ,IAAO,EAC7D,kDAAW,eAAe,IAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,IAAU,EACzD,SAAS,IAAI,CAAC,SAAS,IAAI,CAC1B,8CAAK,SAAS,EAAC,iBAAiB,gBAAE,SAAS,IAAO,CACnD,EACA,SAAS,IAAI,CACZ,8CAAK,SAAS,EAAC,4BAA4B,gBACzC,uBAAC,gBAAQ,IAAC,QAAQ,EAAC,uBAAuB,EAAC,IAAI,EAAC,OAAO,GAAG,IACtD,CACP,KACG,EAEN,+CAAM,SAAS,EAAC,iBAAiB,gBAAE,KAAK,IAAQ,KAC1C,EACP,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,CAC1B,8CAAK,SAAS,EAAC,UAAU,gBAAE,SAAS,IAAI,QAAQ,IAAO,CACxD,KACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAe,SAAS,CAAC"}
|
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
var
|
|
28
|
-
Object.defineProperty(exports, "
|
|
26
|
+
exports.TextInput = void 0;
|
|
27
|
+
var TextInput_1 = require("./TextInput");
|
|
28
|
+
Object.defineProperty(exports, "TextInput", { enumerable: true, get: function () { return __importDefault(TextInput_1).default; } });
|
|
29
29
|
//# 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,yCAAmD;AAA1C,uHAAA,OAAO,OAAa"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TrapFocus = void 0;
|
|
27
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) "Neo4j"
|
|
31
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
32
|
+
*
|
|
33
|
+
* This file is part of Neo4j.
|
|
34
|
+
*
|
|
35
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
36
|
+
* it under the terms of the GNU General Public License as published by
|
|
37
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
38
|
+
* (at your option) any later version.
|
|
39
|
+
*
|
|
40
|
+
* This program is distributed in the hope that it will be useful,
|
|
41
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
42
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
43
|
+
* GNU General Public License for more details.
|
|
44
|
+
*
|
|
45
|
+
* You should have received a copy of the GNU General Public License
|
|
46
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
47
|
+
*/
|
|
48
|
+
/* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex */
|
|
49
|
+
const React = __importStar(require("react"));
|
|
50
|
+
/**
|
|
51
|
+
* A modified version of the Material UI (@mui/material) TrapFocus component.
|
|
52
|
+
* We use a modified/slimmed version for easier maintenance.
|
|
53
|
+
*
|
|
54
|
+
* See the LICENSES.txt file for license for @mui/material
|
|
55
|
+
*/
|
|
56
|
+
function setRef(ref, value) {
|
|
57
|
+
if (typeof ref === 'function') {
|
|
58
|
+
ref(value);
|
|
59
|
+
}
|
|
60
|
+
else if (ref) {
|
|
61
|
+
ref.current = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function useForkRef(refA, refB) {
|
|
65
|
+
/**
|
|
66
|
+
* This will create a new function if the ref props change and are defined.
|
|
67
|
+
* This means react will call the old forkRef with `null` and the new forkRef
|
|
68
|
+
* with the ref. Cleanup naturally emerges from this behavior.
|
|
69
|
+
*/
|
|
70
|
+
return React.useMemo(() => {
|
|
71
|
+
if (refA == null && refB == null) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return (refValue) => {
|
|
75
|
+
setRef(refA, refValue);
|
|
76
|
+
setRef(refB, refValue);
|
|
77
|
+
};
|
|
78
|
+
}, [refA, refB]);
|
|
79
|
+
}
|
|
80
|
+
function ownerDocument(node) {
|
|
81
|
+
return (node && node.ownerDocument) || document;
|
|
82
|
+
}
|
|
83
|
+
// Inspired by https://github.com/focus-trap/tabbable
|
|
84
|
+
const candidatesSelector = [
|
|
85
|
+
'input',
|
|
86
|
+
'select',
|
|
87
|
+
'textarea',
|
|
88
|
+
'a[href]',
|
|
89
|
+
'button',
|
|
90
|
+
'[tabindex]',
|
|
91
|
+
'audio[controls]',
|
|
92
|
+
'video[controls]',
|
|
93
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
94
|
+
].join(',');
|
|
95
|
+
function getTabIndex(node) {
|
|
96
|
+
const tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
|
|
97
|
+
if (!Number.isNaN(tabindexAttr)) {
|
|
98
|
+
return tabindexAttr;
|
|
99
|
+
}
|
|
100
|
+
// Browsers do not return `tabIndex` correctly for contentEditable nodes;
|
|
101
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=661108&q=contenteditable%20tabindex&can=2
|
|
102
|
+
// so if they don't have a tabindex attribute specifically set, assume it's 0.
|
|
103
|
+
// in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
|
|
104
|
+
// `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
|
|
105
|
+
// yet they are still part of the regular tab order; in FF, they get a default
|
|
106
|
+
// `tabIndex` of 0; since Chrome still puts those elements in the regular tab
|
|
107
|
+
// order, consider their tab index to be 0.
|
|
108
|
+
if (node.contentEditable === 'true' ||
|
|
109
|
+
((node.nodeName === 'AUDIO' ||
|
|
110
|
+
node.nodeName === 'VIDEO' ||
|
|
111
|
+
node.nodeName === 'DETAILS') &&
|
|
112
|
+
node.getAttribute('tabindex') === null)) {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
return node.tabIndex;
|
|
116
|
+
}
|
|
117
|
+
function isNonTabbableRadio(node) {
|
|
118
|
+
if (node.tagName !== 'INPUT' || node.type !== 'radio') {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (!node.name) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
const getRadio = (selector) => node.ownerDocument.querySelector(`input[type="radio"]${selector}`);
|
|
125
|
+
let roving = getRadio(`[name="${node.name}"]:checked`);
|
|
126
|
+
if (!roving) {
|
|
127
|
+
roving = getRadio(`[name="${node.name}"]`);
|
|
128
|
+
}
|
|
129
|
+
return roving !== node;
|
|
130
|
+
}
|
|
131
|
+
function isNodeMatchingSelectorFocusable(node) {
|
|
132
|
+
if (node.disabled ||
|
|
133
|
+
(node.tagName === 'INPUT' && node.type === 'hidden') ||
|
|
134
|
+
isNonTabbableRadio(node)) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
function defaultGetTabbable(root) {
|
|
140
|
+
const regularTabNodes = [];
|
|
141
|
+
const orderedTabNodes = [];
|
|
142
|
+
Array.from(root.querySelectorAll(candidatesSelector)).forEach((node, i) => {
|
|
143
|
+
const nodeTabIndex = getTabIndex(node);
|
|
144
|
+
if (nodeTabIndex === -1 || !isNodeMatchingSelectorFocusable(node)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (nodeTabIndex === 0) {
|
|
148
|
+
regularTabNodes.push(node);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
orderedTabNodes.push({
|
|
152
|
+
documentOrder: i,
|
|
153
|
+
tabIndex: nodeTabIndex,
|
|
154
|
+
node,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return orderedTabNodes
|
|
159
|
+
.sort((a, b) => a.tabIndex === b.tabIndex
|
|
160
|
+
? a.documentOrder - b.documentOrder
|
|
161
|
+
: a.tabIndex - b.tabIndex)
|
|
162
|
+
.map((a) => a.node)
|
|
163
|
+
.concat(regularTabNodes);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Utility component that locks focus inside the component.
|
|
167
|
+
*/
|
|
168
|
+
function TrapFocus(props) {
|
|
169
|
+
const { children, disableRestoreFocus = false, getTabbable = defaultGetTabbable, open, } = props;
|
|
170
|
+
const ignoreNextEnforceFocus = React.useRef();
|
|
171
|
+
const sentinelStart = React.useRef(null);
|
|
172
|
+
const sentinelEnd = React.useRef(null);
|
|
173
|
+
const nodeToRestore = React.useRef(null);
|
|
174
|
+
const reactFocusEventTarget = React.useRef(null);
|
|
175
|
+
const rootRef = React.useRef(null);
|
|
176
|
+
const handleRef = useForkRef(children.ref, rootRef);
|
|
177
|
+
const lastKeydown = React.useRef(null);
|
|
178
|
+
React.useEffect(() => {
|
|
179
|
+
// We might render an empty child.
|
|
180
|
+
if (!open || !rootRef.current) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
const doc = ownerDocument(rootRef.current);
|
|
184
|
+
if (!rootRef.current.contains(doc.activeElement)) {
|
|
185
|
+
if (!rootRef.current.hasAttribute('tabIndex')) {
|
|
186
|
+
rootRef.current.setAttribute('tabIndex', '-1');
|
|
187
|
+
}
|
|
188
|
+
rootRef.current.focus();
|
|
189
|
+
}
|
|
190
|
+
return () => {
|
|
191
|
+
// restoreLastFocus()
|
|
192
|
+
if (!disableRestoreFocus) {
|
|
193
|
+
// In IE11 it is possible for document.activeElement to be null resulting
|
|
194
|
+
// in nodeToRestore.current being null.
|
|
195
|
+
// Not all elements in IE11 have a focus method.
|
|
196
|
+
// Once IE11 support is dropped the focus() call can be unconditional.
|
|
197
|
+
if (nodeToRestore.current && nodeToRestore.current.focus) {
|
|
198
|
+
ignoreNextEnforceFocus.current = true;
|
|
199
|
+
nodeToRestore.current.focus();
|
|
200
|
+
}
|
|
201
|
+
nodeToRestore.current = null;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
// Missing `disableRestoreFocus` which is fine.
|
|
205
|
+
// We don't support changing that prop on an open TrapFocus
|
|
206
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
207
|
+
}, [open]);
|
|
208
|
+
React.useEffect(() => {
|
|
209
|
+
// We might render an empty child.
|
|
210
|
+
if (!open || !rootRef.current) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const doc = ownerDocument(rootRef.current);
|
|
214
|
+
const contain = (nativeEvent) => {
|
|
215
|
+
var _a, _b;
|
|
216
|
+
const { current: rootElement } = rootRef;
|
|
217
|
+
// Cleanup functions are executed lazily in React 17.
|
|
218
|
+
// Contain can be called between the component being unmounted and its cleanup function being run.
|
|
219
|
+
if (rootElement === null) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (!doc.hasFocus() || ignoreNextEnforceFocus.current) {
|
|
223
|
+
ignoreNextEnforceFocus.current = false;
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (!rootElement.contains(doc.activeElement)) {
|
|
227
|
+
// if the focus event is not coming from inside the children's react tree, reset the refs
|
|
228
|
+
if ((nativeEvent &&
|
|
229
|
+
reactFocusEventTarget.current !== nativeEvent.target) ||
|
|
230
|
+
doc.activeElement !== reactFocusEventTarget.current) {
|
|
231
|
+
reactFocusEventTarget.current = null;
|
|
232
|
+
}
|
|
233
|
+
else if (reactFocusEventTarget.current !== null) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
let tabbable = [];
|
|
237
|
+
if (doc.activeElement === sentinelStart.current ||
|
|
238
|
+
doc.activeElement === sentinelEnd.current) {
|
|
239
|
+
tabbable = getTabbable(rootRef.current);
|
|
240
|
+
}
|
|
241
|
+
if (tabbable.length > 0) {
|
|
242
|
+
const isShiftTab = Boolean(((_a = lastKeydown.current) === null || _a === void 0 ? void 0 : _a.shiftKey) && ((_b = lastKeydown.current) === null || _b === void 0 ? void 0 : _b.key) === 'Tab');
|
|
243
|
+
const focusNext = tabbable[0];
|
|
244
|
+
const focusPrevious = tabbable[tabbable.length - 1];
|
|
245
|
+
if (isShiftTab) {
|
|
246
|
+
focusPrevious.focus();
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
focusNext.focus();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
rootElement.focus();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
const loopFocus = (nativeEvent) => {
|
|
258
|
+
var _a;
|
|
259
|
+
lastKeydown.current = nativeEvent;
|
|
260
|
+
if (nativeEvent.key !== 'Tab') {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// Make sure the next tab starts from the right place.
|
|
264
|
+
// doc.activeElement referes to the origin.
|
|
265
|
+
if (doc.activeElement === rootRef.current && nativeEvent.shiftKey) {
|
|
266
|
+
// We need to ignore the next contain as
|
|
267
|
+
// it will try to move the focus back to the rootRef element.
|
|
268
|
+
ignoreNextEnforceFocus.current = true;
|
|
269
|
+
(_a = sentinelEnd.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
doc.addEventListener('focusin', contain);
|
|
273
|
+
doc.addEventListener('keydown', loopFocus, true);
|
|
274
|
+
// With Edge, Safari and Firefox, no focus related events are fired when the focused area stops being a focused area.
|
|
275
|
+
// e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=559561.
|
|
276
|
+
// Instead, we can look if the active element was restored on the BODY element.
|
|
277
|
+
//
|
|
278
|
+
// The whatwg spec defines how the browser should behave but does not explicitly mention any events:
|
|
279
|
+
// https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.
|
|
280
|
+
const interval = setInterval(() => {
|
|
281
|
+
var _a;
|
|
282
|
+
if (((_a = doc.activeElement) === null || _a === void 0 ? void 0 : _a.tagName) === 'BODY') {
|
|
283
|
+
contain();
|
|
284
|
+
}
|
|
285
|
+
}, 50);
|
|
286
|
+
return () => {
|
|
287
|
+
clearInterval(interval);
|
|
288
|
+
doc.removeEventListener('focusin', contain);
|
|
289
|
+
doc.removeEventListener('keydown', loopFocus, true);
|
|
290
|
+
};
|
|
291
|
+
}, [disableRestoreFocus, open, getTabbable]);
|
|
292
|
+
const onFocus = (event) => {
|
|
293
|
+
if (nodeToRestore.current === null) {
|
|
294
|
+
nodeToRestore.current = event.relatedTarget;
|
|
295
|
+
}
|
|
296
|
+
reactFocusEventTarget.current = event.target;
|
|
297
|
+
const childrenPropsHandler = children.props.onFocus;
|
|
298
|
+
if (childrenPropsHandler) {
|
|
299
|
+
childrenPropsHandler(event);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
const handleFocusSentinel = (event) => {
|
|
303
|
+
if (nodeToRestore.current === null) {
|
|
304
|
+
nodeToRestore.current = event.relatedTarget;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
return ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { tabIndex: 0, onFocus: handleFocusSentinel, ref: sentinelStart, "data-test": "sentinelStart" }), React.cloneElement(children, { ref: handleRef, onFocus }), (0, jsx_runtime_1.jsx)("div", { tabIndex: 0, onFocus: handleFocusSentinel, ref: sentinelEnd, "data-test": "sentinelEnd" })] }));
|
|
308
|
+
}
|
|
309
|
+
exports.TrapFocus = TrapFocus;
|
|
310
|
+
//# sourceMappingURL=TrapFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrapFocus.js","sourceRoot":"","sources":["../../../src/trap-focus/TrapFocus.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,2EAA2E;AAC3E,6CAA+B;AAE/B;;;;;GAKG;AAEH,SAAS,MAAM,CACb,GAIa,EACb,KAAe;IAEf,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;QAC7B,GAAG,CAAC,KAAK,CAA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AAa,GACvB,IACa,CAClB,CAAC;AACJ,CAAC;AA3LD,8BA2LC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
34
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
__exportStar(require("./TrapFocus"), exports);
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/trap-focus/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,8CAA4B"}
|
|
@@ -40,16 +40,16 @@ import classnames from 'classnames';
|
|
|
40
40
|
*
|
|
41
41
|
*
|
|
42
42
|
*/
|
|
43
|
-
const
|
|
44
|
-
const { label, fluid, labelBefore } = props, otherInputProps = __rest(props, ["label", "fluid", "labelBefore"]);
|
|
45
|
-
const containerWrappingClass = classnames(
|
|
43
|
+
const RadioAndCheckboxWrapper = (props, ref) => {
|
|
44
|
+
const { label, fluid, labelBefore, type = 'text' } = props, otherInputProps = __rest(props, ["label", "fluid", "labelBefore", "type"]);
|
|
45
|
+
const containerWrappingClass = classnames(`ndl-form-item ndl-type-${type}`, {
|
|
46
46
|
disabled: otherInputProps.disabled,
|
|
47
47
|
});
|
|
48
48
|
const labelWrappingClass = classnames(`form-item-label`, {
|
|
49
49
|
fluid,
|
|
50
50
|
'label-before': labelBefore,
|
|
51
51
|
});
|
|
52
|
-
return (_jsx("div", Object.assign({ className: containerWrappingClass }, { children: _jsxs("label", Object.assign({ className: labelWrappingClass }, { children: [_jsx("input", Object.assign({}, otherInputProps, { ref: ref })), label] })) })));
|
|
52
|
+
return (_jsx("div", Object.assign({ className: containerWrappingClass }, { children: _jsxs("label", Object.assign({ className: labelWrappingClass }, { children: [_jsx("input", Object.assign({}, otherInputProps, { ref: ref, type: type })), _jsx("span", Object.assign({ className: "form-label-text" }, { children: label }))] })) })));
|
|
53
53
|
};
|
|
54
|
-
export default forwardRef(
|
|
55
|
-
//# sourceMappingURL=
|
|
54
|
+
export default forwardRef(RadioAndCheckboxWrapper);
|
|
55
|
+
//# sourceMappingURL=RadioAndCheckboxWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioAndCheckboxWrapper.js","sourceRoot":"","sources":["../../../../src/_common/input/RadioAndCheckboxWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,UAAU,MAAM,YAAY,CAAC;AAmBpC,qCAAqC;AAErC;;;;;;GAMG;AAEH,MAAM,uBAAuB,GAAG,CAC9B,KAA4B,EAC5B,GAAmC,EACnC,EAAE;IACF,MAAM,EACJ,KAAK,EACL,KAAK,EACL,WAAW,EACX,IAAI,GAAG,MAAM,KAEX,KAAK,EADJ,eAAe,UAChB,KAAK,EANH,yCAML,CAAQ,CAAC;IAEV,MAAM,sBAAsB,GAAG,UAAU,CAAC,0BAA0B,IAAI,EAAE,EAAE;QAC1E,QAAQ,EAAE,eAAe,CAAC,QAAQ;KACnC,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,UAAU,CAAC,iBAAiB,EAAE;QACvD,KAAK;QACL,cAAc,EAAE,WAAW;KAC5B,CAAC,CAAC;IAEH,OAAO,CACL,4BAAK,SAAS,EAAE,sBAAsB,gBAGpC,+BAAO,SAAS,EAAE,kBAAkB,iBAClC,gCAAW,eAAe,IAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,IAAI,EACpD,6BAAM,SAAS,EAAC,iBAAiB,gBAAE,KAAK,IAAQ,KAC1C,IACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/_common/input/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { useCallback, useRef } from 'react';
|
|
22
|
+
export const removeNewlines = (input) => input.replace(/(\r\n|\n|\r)/gm, '');
|
|
23
|
+
/** Remove extra spaces from sting */
|
|
24
|
+
export const removeSpaces = (input) => input.replace(/\s+/g, ' ').trim();
|
|
25
|
+
export const needleWarningMessage = (message) => console.warn(`[🪡 Needle]: ${message}`);
|
|
26
|
+
const getScrollbarSize = (doc) => {
|
|
27
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
|
|
28
|
+
const documentWidth = doc.documentElement.clientWidth;
|
|
29
|
+
return Math.abs(window.innerWidth - documentWidth);
|
|
30
|
+
};
|
|
31
|
+
const getPaddingRight = (element) => parseInt(window.getComputedStyle(element).paddingRight, 10) || 0;
|
|
32
|
+
/**
|
|
33
|
+
* Toggles scroll on the provided document.
|
|
34
|
+
* Useful for disabling scroll when a popup is open (ie ContextMenu/Modal)
|
|
35
|
+
*/
|
|
36
|
+
export const useDocumentScrollToggle = () => {
|
|
37
|
+
const bodyPadding = useRef(0);
|
|
38
|
+
return useCallback((disable, doc = document) => {
|
|
39
|
+
if (disable) {
|
|
40
|
+
const existingPaddingRight = getPaddingRight(doc.body);
|
|
41
|
+
bodyPadding.current = existingPaddingRight;
|
|
42
|
+
const newPaddingRight = existingPaddingRight + getScrollbarSize(doc);
|
|
43
|
+
doc.body.style.overflow = 'hidden';
|
|
44
|
+
doc.body.style.paddingRight = `${newPaddingRight}px`;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
doc.body.style.overflow = '';
|
|
48
|
+
doc.body.style.paddingRight = `${bodyPadding.current}px`;
|
|
49
|
+
}
|
|
50
|
+
}, []);
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE5C,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;AAE3C,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAU,EAAE;IACjD,iFAAiF;IACjF,MAAM,aAAa,GAAG,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAU,EAAE,CACnD,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,MAAM,WAAW,GAAG,MAAM,CAAS,CAAC,CAAC,CAAC;IAEtC,OAAO,WAAW,CAAC,CAAC,OAAgB,EAAE,MAAgB,QAAQ,EAAE,EAAE;QAChE,IAAI,OAAO,EAAE;YACX,MAAM,oBAAoB,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACvD,WAAW,CAAC,OAAO,GAAG,oBAAoB,CAAC;YAC3C,MAAM,eAAe,GAAG,oBAAoB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACrE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACnC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,GAAG,eAAe,IAAI,CAAC;SACtD;aAAM;YACL,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;YAC7B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,GAAG,WAAW,CAAC,OAAO,IAAI,CAAC;SAC1D;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC"}
|
package/lib/esm/button/Button.js
CHANGED
|
@@ -33,11 +33,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import React from 'react';
|
|
34
34
|
import classnames from 'classnames';
|
|
35
35
|
import { LoadingSpinner } from '../loading-spinner';
|
|
36
|
-
|
|
37
|
-
/** Remove extra spaces from sting */
|
|
38
|
-
export const removeSpaces = (input) => input.replace(/\s+/g, ' ').trim();
|
|
36
|
+
import { removeNewlines, removeSpaces } from '../_common/utils';
|
|
39
37
|
export const Button = React.forwardRef(function Button(_a, ref) {
|
|
40
|
-
var { children, as, type = 'button', loading = false, color = 'primary', disabled = false, fill = 'filled', rectangle = false, buttonSize = '
|
|
38
|
+
var { children, as, type = 'button', loading = false, color = 'primary', disabled = false, fill = 'filled', rectangle = false, buttonSize = 'medium', className, onClick, floating = false, tabIndex = 0 } = _a, props = __rest(_a, ["children", "as", "type", "loading", "color", "disabled", "fill", "rectangle", "buttonSize", "className", "onClick", "floating", "tabIndex"]);
|
|
41
39
|
let Component = as || 'button';
|
|
42
40
|
if (!as && props.href) {
|
|
43
41
|
Component = 'a';
|
|
@@ -47,6 +45,7 @@ export const Button = React.forwardRef(function Button(_a, ref) {
|
|
|
47
45
|
disabled: disabled,
|
|
48
46
|
loading: loading,
|
|
49
47
|
rectangle: rectangle,
|
|
48
|
+
'floating-btn': floating,
|
|
50
49
|
/** Now check button is outlined or filled */
|
|
51
50
|
/**
|
|
52
51
|
* Notice:
|
|
@@ -57,11 +56,15 @@ export const Button = React.forwardRef(function Button(_a, ref) {
|
|
|
57
56
|
${color === 'neutral'
|
|
58
57
|
? `n-bg-light-${color}-bg-strongest`
|
|
59
58
|
: `n-bg-light-${color}-bg-strong`}
|
|
60
|
-
${interactable &&
|
|
59
|
+
${interactable &&
|
|
60
|
+
`hover:n-bg-light-${color}-hover-strong
|
|
61
|
+
active:n-bg-light-${color}-pressed-strong`}
|
|
61
62
|
`]: fill === 'filled',
|
|
62
63
|
[`
|
|
63
64
|
n-text-light-${color}-text
|
|
64
|
-
${interactable &&
|
|
65
|
+
${interactable &&
|
|
66
|
+
`hover:n-bg-light-${color}-hover-weak
|
|
67
|
+
active:n-bg-light-${color}-pressed-weak`}
|
|
65
68
|
n-border-light-${color}-bg-strong
|
|
66
69
|
`]: fill === 'outlined' && color !== 'neutral',
|
|
67
70
|
/**
|
|
@@ -69,14 +72,18 @@ export const Button = React.forwardRef(function Button(_a, ref) {
|
|
|
69
72
|
* the same principles with colored variations
|
|
70
73
|
*/
|
|
71
74
|
[`
|
|
72
|
-
|
|
75
|
+
n-text-light-neutral-text-weak
|
|
73
76
|
n-bg-${color}-10
|
|
74
77
|
${interactable && `hover:n-bg-${color}-20`}
|
|
75
|
-
n-border
|
|
78
|
+
n-border-light-neutral-border-strong
|
|
79
|
+
active:n-bg-light-neutral-pressed
|
|
76
80
|
`]: fill === 'outlined' && color === 'neutral',
|
|
77
81
|
[`
|
|
78
82
|
n-text-${color}-50
|
|
79
|
-
${interactable &&
|
|
83
|
+
${interactable &&
|
|
84
|
+
`hover:n-bg-${color}-10
|
|
85
|
+
active:n-bg-light-${color}-pressed-weak
|
|
86
|
+
`}
|
|
80
87
|
`]: fill === 'text' && color !== 'neutral',
|
|
81
88
|
[`
|
|
82
89
|
n-text-light-neutral-text-weak
|