@neo4j-ndl/react 1.6.0 → 1.7.1
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/CHANGELOG.md +18 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/textarea/Textarea.js +85 -0
- package/lib/cjs/textarea/Textarea.js.map +1 -0
- package/lib/cjs/textarea/index.js +29 -0
- package/lib/cjs/textarea/index.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/textarea/Textarea.js +80 -0
- package/lib/esm/textarea/Textarea.js.map +1 -0
- package/lib/esm/textarea/index.js +22 -0
- package/lib/esm/textarea/index.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/textarea/Textarea.d.ts +56 -0
- package/lib/types/textarea/index.d.ts +21 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 1.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [630ce6f]
|
|
8
|
+
- @neo4j-ndl/base@1.7.1
|
|
9
|
+
|
|
10
|
+
## 1.7.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 5b5e1e2: Added Textarea component
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [5b5e1e2]
|
|
19
|
+
- @neo4j-ndl/base@1.7.0
|
|
20
|
+
|
|
3
21
|
## 1.6.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/lib/cjs/index.js
CHANGED
|
@@ -53,6 +53,7 @@ __exportStar(require("./table-deprecated"), exports);
|
|
|
53
53
|
__exportStar(require("./table"), exports);
|
|
54
54
|
__exportStar(require("./drag-and-drop"), exports);
|
|
55
55
|
__exportStar(require("./text-input"), exports);
|
|
56
|
+
__exportStar(require("./textarea"), exports);
|
|
56
57
|
__exportStar(require("./text-link"), exports);
|
|
57
58
|
__exportStar(require("./dropdown"), exports);
|
|
58
59
|
__exportStar(require("./tag"), exports);
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,iDAA+B;AAC/B,qDAAmC;AACnC,0CAAwB;AACxB,kDAAgC;AAChC,+CAA6B;AAC7B,8CAA4B;AAC5B,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,qDAAmC;AACnC,oDAAkC;AAClC,+CAA6B;AAC7B,2CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,2CAAyB;AACzB,0CAAwB;AACxB,iDAA+B;AAC/B,2CAAyB;AACzB,0CAAwB;AACxB,oDAAkC;AAClC,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,iDAA+B;AAC/B,qDAAmC;AACnC,0CAAwB;AACxB,kDAAgC;AAChC,+CAA6B;AAC7B,6CAA2B;AAC3B,8CAA4B;AAC5B,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,qDAAmC;AACnC,oDAAkC;AAClC,+CAA6B;AAC7B,2CAAyB"}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 = require("react");
|
|
39
|
+
const SmartTooltip_1 = __importDefault(require("../tooltip/SmartTooltip"));
|
|
40
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
41
|
+
const utils_1 = require("../_common/utils");
|
|
42
|
+
const messages_1 = require("../_common/messages");
|
|
43
|
+
const icons_1 = require("../icons");
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*
|
|
47
|
+
* Textarea Component
|
|
48
|
+
*
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
const Textarea = (0, react_1.forwardRef)(function Textarea(props, ref) {
|
|
52
|
+
const { label, fluid, errorText, helpText, isOptional = false, informationIconText, size = 'small', 'aria-label': ariaLabel, smartTooltipProps } = props, customProps = __rest(props, ["label", "fluid", "errorText", "helpText", "isOptional", "informationIconText", "size", 'aria-label', "smartTooltipProps"]);
|
|
53
|
+
const containerWrappingClass = (0, classnames_1.default)(`ndl-textarea ndl-type-text`, customProps.className, {
|
|
54
|
+
'ndl-disabled': customProps.disabled,
|
|
55
|
+
'ndl-small': size === 'small',
|
|
56
|
+
'ndl-large': size === 'large',
|
|
57
|
+
'ndl-has-error': errorText,
|
|
58
|
+
'ndl-has-right-icon': errorText,
|
|
59
|
+
'ndl-has-icon': errorText,
|
|
60
|
+
});
|
|
61
|
+
const hasEmptyLabelValue = !label || label === '';
|
|
62
|
+
const labelWrappingClass = (0, classnames_1.default)('ndl-textarea-label', {
|
|
63
|
+
'ndl-fluid': fluid,
|
|
64
|
+
'ndl-textarea-no-label': hasEmptyLabelValue,
|
|
65
|
+
});
|
|
66
|
+
const isCustomLabel = label && typeof label !== 'string';
|
|
67
|
+
const hasCustomLabelAndNoAriaLabel = isCustomLabel && !ariaLabel;
|
|
68
|
+
(0, react_1.useMemo)(() => {
|
|
69
|
+
if (!label && !ariaLabel) {
|
|
70
|
+
(0, utils_1.needleWarningMessage)('A Textarea without a label does not have an aria label, be sure to include an aria label for screen readers link: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI');
|
|
71
|
+
}
|
|
72
|
+
if (hasCustomLabelAndNoAriaLabel) {
|
|
73
|
+
(0, utils_1.needleWarningMessage)(messages_1.customLabelAndNoAriaLabelWarningMessage);
|
|
74
|
+
}
|
|
75
|
+
}, [label, ariaLabel, hasCustomLabelAndNoAriaLabel]);
|
|
76
|
+
const customPropsClassNameStripped = Object.assign(Object.assign({}, customProps), { className: undefined });
|
|
77
|
+
const informationIconClass = (0, classnames_1.default)({
|
|
78
|
+
'ndl-information-icon-small': size === 'small',
|
|
79
|
+
'ndl-information-icon-large': size === 'large',
|
|
80
|
+
});
|
|
81
|
+
const informationRef = (0, react_1.useRef)(null);
|
|
82
|
+
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.jsx)("div", Object.assign({ className: "ndl-textarea-wrapper" }, { children: (0, jsx_runtime_1.jsx)("textarea", Object.assign({}, customPropsClassNameStripped, { ref: ref, "aria-label": ariaLabel })) })), !hasEmptyLabelValue && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-textarea-wrapper" }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ className: "ndl-textarea-label-text" }, { children: label })), informationIconText && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: informationIconClass, "data-testid": "information-icon", ref: informationRef }, { children: [(0, jsx_runtime_1.jsx)(icons_1.InformationCircleIconOutline, {}), (0, jsx_runtime_1.jsx)(SmartTooltip_1.default, Object.assign({}, smartTooltipProps, { ref: informationRef }, { children: informationIconText }))] }))), isOptional && ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: "ndl-textarea-optional" }, { children: "Optional" })))] })))] })), helpText && !errorText && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ndl-textarea-msg" }, { children: helpText }))), errorText && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "ndl-textarea-msg" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ndl-error-icon" }, { children: (0, jsx_runtime_1.jsx)(icons_1.ExclamationCircleIconSolid, {}) })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ndl-error-text" }, { children: errorText }))] })))] })));
|
|
83
|
+
});
|
|
84
|
+
exports.default = Textarea;
|
|
85
|
+
//# sourceMappingURL=Textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../src/textarea/Textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAOe;AACf,2EAA0E;AAC1E,4DAAoC;AACpC,4CAAwD;AACxD,kDAA8E;AAC9E,oCAGkB;AAwClB;;;;;;GAMG;AAEH,MAAM,QAAQ,GAAG,IAAA,kBAAU,EAAC,SAAS,QAAQ,CAC3C,KAAoB,EACpB,GAAsC;IAEtC,MAAM,EACJ,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,mBAAmB,EACnB,IAAI,GAAG,OAAO,EACd,YAAY,EAAE,SAAS,EACvB,iBAAiB,KAEf,KAAK,EADJ,WAAW,UACZ,KAAK,EAXH,2HAWL,CAAQ,CAAC;IAEV,MAAM,sBAAsB,GAAG,IAAA,oBAAU,EACvC,4BAA4B,EAC5B,WAAW,CAAC,SAAS,EACrB;QACE,cAAc,EAAE,WAAW,CAAC,QAAQ;QACpC,WAAW,EAAE,IAAI,KAAK,OAAO;QAC7B,WAAW,EAAE,IAAI,KAAK,OAAO;QAC7B,eAAe,EAAE,SAAS;QAC1B,oBAAoB,EAAE,SAAS;QAC/B,cAAc,EAAE,SAAS;KAC1B,CACF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AAS,EAAE,oBAAoB,iBACnB,kBAAkB,EAC9B,GAAG,EAAE,cAAc,iBAEnB,uBAAC,oCAA4B,KAAG,EAChC,uBAAC,sBAAY,oBAAK,iBAAiB,IAAE,GAAG,EAAE,cAAc,gBACrD,mBAAmB,IACP,KACX,CACP,EACA,UAAU,IAAI,CACb,+CAAM,SAAS,EAAC,uBAAuB,8BAAgB,CACxD,KACG,CACP,KACK,EACP,QAAQ,IAAI,CAAC,SAAS,IAAI,CACzB,8CAAK,SAAS,EAAC,kBAAkB,gBAAE,QAAQ,IAAO,CACnD,EACA,SAAS,IAAI,CACZ,+CAAK,SAAS,EAAC,kBAAkB,iBAC/B,8CAAK,SAAS,EAAC,gBAAgB,gBAC7B,uBAAC,kCAA0B,KAAG,IAC1B,EACN,8CAAK,SAAS,EAAC,gBAAgB,gBAAE,SAAS,IAAO,KAC7C,CACP,KACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Textarea = void 0;
|
|
27
|
+
var Textarea_1 = require("./Textarea");
|
|
28
|
+
Object.defineProperty(exports, "Textarea", { enumerable: true, get: function () { return __importDefault(Textarea_1).default; } });
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/textarea/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,uCAAiD;AAAxC,qHAAA,OAAO,OAAY"}
|
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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 { forwardRef, useMemo, useRef, } from 'react';
|
|
34
|
+
import SmartTooltip from '../tooltip/SmartTooltip';
|
|
35
|
+
import classNames from 'classnames';
|
|
36
|
+
import { needleWarningMessage } from '../_common/utils';
|
|
37
|
+
import { customLabelAndNoAriaLabelWarningMessage } from '../_common/messages';
|
|
38
|
+
import { ExclamationCircleIconSolid, InformationCircleIconOutline, } from '../icons';
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
*
|
|
42
|
+
* Textarea Component
|
|
43
|
+
*
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
const Textarea = forwardRef(function Textarea(props, ref) {
|
|
47
|
+
const { label, fluid, errorText, helpText, isOptional = false, informationIconText, size = 'small', 'aria-label': ariaLabel, smartTooltipProps } = props, customProps = __rest(props, ["label", "fluid", "errorText", "helpText", "isOptional", "informationIconText", "size", 'aria-label', "smartTooltipProps"]);
|
|
48
|
+
const containerWrappingClass = classNames(`ndl-textarea ndl-type-text`, customProps.className, {
|
|
49
|
+
'ndl-disabled': customProps.disabled,
|
|
50
|
+
'ndl-small': size === 'small',
|
|
51
|
+
'ndl-large': size === 'large',
|
|
52
|
+
'ndl-has-error': errorText,
|
|
53
|
+
'ndl-has-right-icon': errorText,
|
|
54
|
+
'ndl-has-icon': errorText,
|
|
55
|
+
});
|
|
56
|
+
const hasEmptyLabelValue = !label || label === '';
|
|
57
|
+
const labelWrappingClass = classNames('ndl-textarea-label', {
|
|
58
|
+
'ndl-fluid': fluid,
|
|
59
|
+
'ndl-textarea-no-label': hasEmptyLabelValue,
|
|
60
|
+
});
|
|
61
|
+
const isCustomLabel = label && typeof label !== 'string';
|
|
62
|
+
const hasCustomLabelAndNoAriaLabel = isCustomLabel && !ariaLabel;
|
|
63
|
+
useMemo(() => {
|
|
64
|
+
if (!label && !ariaLabel) {
|
|
65
|
+
needleWarningMessage('A Textarea without a label does not have an aria label, be sure to include an aria label for screen readers link: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI');
|
|
66
|
+
}
|
|
67
|
+
if (hasCustomLabelAndNoAriaLabel) {
|
|
68
|
+
needleWarningMessage(customLabelAndNoAriaLabelWarningMessage);
|
|
69
|
+
}
|
|
70
|
+
}, [label, ariaLabel, hasCustomLabelAndNoAriaLabel]);
|
|
71
|
+
const customPropsClassNameStripped = Object.assign(Object.assign({}, customProps), { className: undefined });
|
|
72
|
+
const informationIconClass = classNames({
|
|
73
|
+
'ndl-information-icon-small': size === 'small',
|
|
74
|
+
'ndl-information-icon-large': size === 'large',
|
|
75
|
+
});
|
|
76
|
+
const informationRef = useRef(null);
|
|
77
|
+
return (_jsxs("div", Object.assign({ className: containerWrappingClass }, { children: [_jsxs("label", Object.assign({ className: labelWrappingClass }, { children: [_jsx("div", Object.assign({ className: "ndl-textarea-wrapper" }, { children: _jsx("textarea", Object.assign({}, customPropsClassNameStripped, { ref: ref, "aria-label": ariaLabel })) })), !hasEmptyLabelValue && (_jsxs("div", Object.assign({ className: "ndl-textarea-wrapper" }, { children: [_jsx("span", Object.assign({ className: "ndl-textarea-label-text" }, { children: label })), informationIconText && (_jsxs("div", Object.assign({ className: informationIconClass, "data-testid": "information-icon", ref: informationRef }, { children: [_jsx(InformationCircleIconOutline, {}), _jsx(SmartTooltip, Object.assign({}, smartTooltipProps, { ref: informationRef }, { children: informationIconText }))] }))), isOptional && (_jsx("span", Object.assign({ className: "ndl-textarea-optional" }, { children: "Optional" })))] })))] })), helpText && !errorText && (_jsx("div", Object.assign({ className: "ndl-textarea-msg" }, { children: helpText }))), errorText && (_jsxs("div", Object.assign({ className: "ndl-textarea-msg" }, { children: [_jsx("div", Object.assign({ className: "ndl-error-icon" }, { children: _jsx(ExclamationCircleIconSolid, {}) })), _jsx("div", Object.assign({ className: "ndl-error-text" }, { children: errorText }))] })))] })));
|
|
78
|
+
});
|
|
79
|
+
export default Textarea;
|
|
80
|
+
//# sourceMappingURL=Textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../src/textarea/Textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAIL,UAAU,EACV,OAAO,EACP,MAAM,GACP,MAAM,OAAO,CAAC;AACf,OAAO,YAAmC,MAAM,yBAAyB,CAAC;AAC1E,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBA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P,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,QAAQ,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 Textarea } from './Textarea';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/textarea/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
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 { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
22
|
+
import { SmartTooltipProps } from '../tooltip/SmartTooltip';
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*
|
|
26
|
+
* Types
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export interface TextareaProps extends Omit<Omit<ComponentPropsWithoutRef<'textarea'>, 'nonce' | 'size'>, 'label'> {
|
|
31
|
+
/** Label text */
|
|
32
|
+
label?: ReactNode;
|
|
33
|
+
/** Displays with fluid width */
|
|
34
|
+
fluid?: boolean;
|
|
35
|
+
/** Help message */
|
|
36
|
+
helpText?: string;
|
|
37
|
+
/** Error message */
|
|
38
|
+
errorText?: string;
|
|
39
|
+
/** Size of the textarea */
|
|
40
|
+
size?: 'small' | 'large';
|
|
41
|
+
/** If the component is optional to fill in */
|
|
42
|
+
isOptional?: boolean;
|
|
43
|
+
/** Information to be displayed in the information tooltip */
|
|
44
|
+
informationIconText?: string;
|
|
45
|
+
/** Pass props to the underlaying SmartTooltip component */
|
|
46
|
+
smartTooltipProps?: SmartTooltipProps;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
*
|
|
51
|
+
* Textarea Component
|
|
52
|
+
*
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
56
|
+
export default Textarea;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
export { default as Textarea } from './Textarea';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@floating-ui/react": "^0.24.2",
|
|
93
93
|
"@heroicons/react": "2.0.13",
|
|
94
94
|
"@neo4j-cypher/react-codemirror": "^1.0.1",
|
|
95
|
-
"@neo4j-ndl/base": "^1.
|
|
95
|
+
"@neo4j-ndl/base": "^1.7.1",
|
|
96
96
|
"@tanstack/react-table": "^8.5.22",
|
|
97
97
|
"classnames": "^2.3.1",
|
|
98
98
|
"detect-browser": "^5.3.0",
|