@nice-digital/nds-input 3.0.2 → 4.0.0-alpha.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/es/Input.d.ts +15 -0
- package/es/Input.js +30 -60
- package/es/Input.test.d.ts +1 -0
- package/es/Input.test.js +45 -0
- package/package.json +12 -12
- package/es/Input.js.map +0 -1
- package/lib/Input.js +0 -109
- package/lib/Input.js.map +0 -1
- package/nds-input.d.ts +0 -34
package/es/Input.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./../scss/input.scss";
|
|
3
|
+
export interface InputProps {
|
|
4
|
+
[prop: string]: unknown;
|
|
5
|
+
className?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
error?: boolean;
|
|
8
|
+
errorMessage?: string;
|
|
9
|
+
hint?: string;
|
|
10
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
11
|
+
label: string | null;
|
|
12
|
+
name: string;
|
|
13
|
+
type?: "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "range" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
|
|
14
|
+
}
|
|
15
|
+
export declare const Input: React.FC<InputProps>;
|
package/es/Input.js
CHANGED
|
@@ -1,60 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, label && /*#__PURE__*/React.createElement("label", {
|
|
32
|
-
className: "input__label",
|
|
33
|
-
htmlFor: name
|
|
34
|
-
}, label), hint && /*#__PURE__*/React.createElement("p", {
|
|
35
|
-
className: "input__hint"
|
|
36
|
-
}, hint), error && /*#__PURE__*/React.createElement("p", {
|
|
37
|
-
className: "input__error"
|
|
38
|
-
}, errorMessage), /*#__PURE__*/React.createElement("input", _extends({
|
|
39
|
-
ref: inputRef,
|
|
40
|
-
name: name,
|
|
41
|
-
className: "input__input",
|
|
42
|
-
id: name,
|
|
43
|
-
type: type,
|
|
44
|
-
defaultValue: defaultValue
|
|
45
|
-
}, rest)));
|
|
46
|
-
};
|
|
47
|
-
Input.propTypes = {
|
|
48
|
-
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
49
|
-
current: PropTypes.object
|
|
50
|
-
})]),
|
|
51
|
-
className: PropTypes.string,
|
|
52
|
-
defaultValue: PropTypes.string,
|
|
53
|
-
error: PropTypes.bool,
|
|
54
|
-
errorMessage: PropTypes.string,
|
|
55
|
-
label: PropTypes.string,
|
|
56
|
-
hint: PropTypes.string,
|
|
57
|
-
type: PropTypes.oneOf(["color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "range", "password", "search", "tel", "text", "time", "url", "week"]),
|
|
58
|
-
name: PropTypes.string.isRequired
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=Input.js.map
|
|
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
|
+
exports.Input = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
require("./../scss/input.scss");
|
|
21
|
+
const Input = (props) => {
|
|
22
|
+
const { defaultValue, name, inputRef, error, errorMessage, label = "Label", hint, type = "text", className = "" } = props, rest = __rest(props, ["defaultValue", "name", "inputRef", "error", "errorMessage", "label", "hint", "type", "className"]);
|
|
23
|
+
const classNames = (0, classnames_1.default)({
|
|
24
|
+
input: true,
|
|
25
|
+
"input--error": error,
|
|
26
|
+
[`${className}`]: className
|
|
27
|
+
});
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: classNames }, { children: [label && ((0, jsx_runtime_1.jsx)("label", Object.assign({ className: "input__label", htmlFor: name }, { children: label }))), hint && (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "input__hint" }, { children: hint })), error && (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "input__error" }, { children: errorMessage })), (0, jsx_runtime_1.jsx)("input", Object.assign({ ref: inputRef, name: name, className: "input__input", id: name, type: type, defaultValue: defaultValue }, rest))] })));
|
|
29
|
+
};
|
|
30
|
+
exports.Input = Input;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/Input.test.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("@testing-library/react");
|
|
5
|
+
const Input_1 = require("./Input");
|
|
6
|
+
const props = {
|
|
7
|
+
name: "name",
|
|
8
|
+
label: "Label"
|
|
9
|
+
};
|
|
10
|
+
const extraProps = {
|
|
11
|
+
name: "name",
|
|
12
|
+
label: "Label",
|
|
13
|
+
error: true,
|
|
14
|
+
errorMessage: "Error",
|
|
15
|
+
hint: "Hint"
|
|
16
|
+
};
|
|
17
|
+
describe("@nice-digital/nds-input", () => {
|
|
18
|
+
it("should render a input tag", () => {
|
|
19
|
+
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Input_1.Input, Object.assign({}, props)));
|
|
20
|
+
expect(wrapper.getByRole("textbox")).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
it("should match snapshot", () => {
|
|
23
|
+
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Input_1.Input, Object.assign({}, extraProps)));
|
|
24
|
+
expect(wrapper).toMatchSnapshot();
|
|
25
|
+
});
|
|
26
|
+
it("should pass down a ref to the input", () => {
|
|
27
|
+
const mockRefFunction = jest.fn();
|
|
28
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(Input_1.Input, Object.assign({}, props, { inputRef: mockRefFunction })));
|
|
29
|
+
expect(mockRefFunction).toBeCalled();
|
|
30
|
+
});
|
|
31
|
+
it("should pass down additional props to the input", () => {
|
|
32
|
+
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Input_1.Input, Object.assign({}, props, { "data-track": "Monkey!" })));
|
|
33
|
+
expect(wrapper.getByRole("textbox").getAttribute("data-track")).toBe("Monkey!");
|
|
34
|
+
});
|
|
35
|
+
it("should merge supplied classNames supplied with internal classes", () => {
|
|
36
|
+
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(Input_1.Input, Object.assign({}, props, { className: "my-class" })));
|
|
37
|
+
const inputContainer = container.querySelector(".input");
|
|
38
|
+
expect(inputContainer).toBeInTheDocument();
|
|
39
|
+
expect(inputContainer).toHaveClass("my-class");
|
|
40
|
+
});
|
|
41
|
+
it("should exclude a label if null option is passed for label prop", () => {
|
|
42
|
+
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Input_1.Input, Object.assign({}, props, { label: null })));
|
|
43
|
+
expect(wrapper.queryByRole("label")).toBe(null);
|
|
44
|
+
});
|
|
45
|
+
});
|
package/package.json
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-digital/nds-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
4
|
"description": "Input component for the NICE Design System",
|
|
5
5
|
"author": "Warren Keith <warren.keith@nice.org.uk>",
|
|
6
6
|
"homepage": "https://nice-digital.github.io/nice-design-system/",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"main": "
|
|
9
|
-
"module": "es/Input.js",
|
|
8
|
+
"main": "es/Input.js",
|
|
10
9
|
"style": "scss/input.scss",
|
|
11
|
-
"types": "nds-input.d.ts",
|
|
12
10
|
"directories": {
|
|
13
|
-
"lib": "
|
|
14
|
-
"test": "__tests__"
|
|
11
|
+
"lib": "es"
|
|
15
12
|
},
|
|
16
13
|
"files": [
|
|
17
|
-
"lib",
|
|
18
14
|
"es",
|
|
19
15
|
"scss",
|
|
20
16
|
"*.d.ts"
|
|
@@ -34,16 +30,20 @@
|
|
|
34
30
|
"url": "https://github.com/nice-digital/nice-design-system/issues"
|
|
35
31
|
},
|
|
36
32
|
"dependencies": {
|
|
37
|
-
"@nice-digital/nds-core": "^
|
|
38
|
-
"classnames": "^2.2.6"
|
|
39
|
-
"prop-types": "^15.7.2"
|
|
33
|
+
"@nice-digital/nds-core": "^4.0.0-alpha.0",
|
|
34
|
+
"classnames": "^2.2.6"
|
|
40
35
|
},
|
|
41
36
|
"devDependencies": {
|
|
42
|
-
"@
|
|
37
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
38
|
+
"@testing-library/react": "^13.4.0",
|
|
39
|
+
"@testing-library/user-event": "^14.4.3",
|
|
40
|
+
"@types/jest": "^29.2.2",
|
|
41
|
+
"@types/node": "^18.11.9",
|
|
42
|
+
"typescript": "^4.8.4"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "^16 || ^17 || ^18",
|
|
46
46
|
"react-dom": "^16 || ^17 || ^18"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e225e0b15723013fb3df7309d197590a09cc2ea7"
|
|
49
49
|
}
|
package/es/Input.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["React","PropTypes","classnames","Input","props","defaultValue","name","inputRef","error","errorMessage","label","hint","type","className","rest","classNames","input","propTypes","oneOfType","func","shape","current","object","string","bool","oneOf","isRequired"],"sources":["../src/Input.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport classnames from \"classnames\";\n\nimport \"./../scss/input.scss\";\n\nexport const Input = (props) => {\n\tconst {\n\t\tdefaultValue,\n\t\tname,\n\t\tinputRef,\n\t\terror,\n\t\terrorMessage,\n\t\tlabel = \"Label\",\n\t\thint,\n\t\ttype = \"text\",\n\t\tclassName = \"\",\n\t\t...rest\n\t} = props;\n\tconst classNames = classnames({\n\t\tinput: true,\n\t\t\"input--error\": error,\n\t\t[className]: className\n\t});\n\treturn (\n\t\t<div className={classNames}>\n\t\t\t{label && (\n\t\t\t\t<label className=\"input__label\" htmlFor={name}>\n\t\t\t\t\t{label}\n\t\t\t\t</label>\n\t\t\t)}\n\t\t\t{hint && <p className=\"input__hint\">{hint}</p>}\n\t\t\t{error && <p className=\"input__error\">{errorMessage}</p>}\n\t\t\t<input\n\t\t\t\tref={inputRef}\n\t\t\t\tname={name}\n\t\t\t\tclassName=\"input__input\"\n\t\t\t\tid={name}\n\t\t\t\ttype={type}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nInput.propTypes = {\n\tinputRef: PropTypes.oneOfType([\n\t\tPropTypes.func,\n\t\tPropTypes.shape({ current: PropTypes.object })\n\t]),\n\tclassName: PropTypes.string,\n\tdefaultValue: PropTypes.string,\n\terror: PropTypes.bool,\n\terrorMessage: PropTypes.string,\n\tlabel: PropTypes.string,\n\thint: PropTypes.string,\n\ttype: PropTypes.oneOf([\n\t\t\"color\",\n\t\t\"date\",\n\t\t\"datetime-local\",\n\t\t\"email\",\n\t\t\"file\",\n\t\t\"hidden\",\n\t\t\"image\",\n\t\t\"month\",\n\t\t\"number\",\n\t\t\"range\",\n\t\t\"password\",\n\t\t\"search\",\n\t\t\"tel\",\n\t\t\"text\",\n\t\t\"time\",\n\t\t\"url\",\n\t\t\"week\"\n\t]),\n\tname: PropTypes.string.isRequired\n};\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,OAAO,sBAAP;AAEA,OAAO,IAAMC,KAAK,GAAG,SAARA,KAAQ,CAACC,KAAD,EAAW;EAAA;;EAC/B,IACCC,YADD,GAWID,KAXJ,CACCC,YADD;EAAA,IAECC,IAFD,GAWIF,KAXJ,CAECE,IAFD;EAAA,IAGCC,QAHD,GAWIH,KAXJ,CAGCG,QAHD;EAAA,IAICC,KAJD,GAWIJ,KAXJ,CAICI,KAJD;EAAA,IAKCC,YALD,GAWIL,KAXJ,CAKCK,YALD;EAAA,mBAWIL,KAXJ,CAMCM,KAND;EAAA,IAMCA,KAND,6BAMS,OANT;EAAA,IAOCC,IAPD,GAWIP,KAXJ,CAOCO,IAPD;EAAA,kBAWIP,KAXJ,CAQCQ,IARD;EAAA,IAQCA,IARD,4BAQQ,MARR;EAAA,uBAWIR,KAXJ,CASCS,SATD;EAAA,IASCA,SATD,iCASa,EATb;EAAA,IAUIC,IAVJ,iCAWIV,KAXJ;;EAYA,IAAMW,UAAU,GAAGb,UAAU;IAC5Bc,KAAK,EAAE,IADqB;IAE5B,gBAAgBR;EAFY,eAG3BK,SAH2B,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B,IAAI,EAAEL,SAAS,CAACsB,MAAV,CAAiBG;AA9BN,CAAlB"}
|
package/lib/Input.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.Input = void 0;
|
|
7
|
-
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
|
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
-
|
|
12
|
-
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
|
-
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
|
-
require("./../scss/input.scss");
|
|
19
|
-
|
|
20
|
-
var _excluded = ["defaultValue", "name", "inputRef", "error", "errorMessage", "label", "hint", "type", "className"];
|
|
21
|
-
|
|
22
|
-
var _jsxFileName = "C:\\dev\\nice-design-system\\components\\nds-input\\src\\Input.js",
|
|
23
|
-
_this = void 0;
|
|
24
|
-
|
|
25
|
-
var Input = function Input(props) {
|
|
26
|
-
var _classnames;
|
|
27
|
-
|
|
28
|
-
var defaultValue = props.defaultValue,
|
|
29
|
-
name = props.name,
|
|
30
|
-
inputRef = props.inputRef,
|
|
31
|
-
error = props.error,
|
|
32
|
-
errorMessage = props.errorMessage,
|
|
33
|
-
_props$label = props.label,
|
|
34
|
-
label = _props$label === void 0 ? "Label" : _props$label,
|
|
35
|
-
hint = props.hint,
|
|
36
|
-
_props$type = props.type,
|
|
37
|
-
type = _props$type === void 0 ? "text" : _props$type,
|
|
38
|
-
_props$className = props.className,
|
|
39
|
-
className = _props$className === void 0 ? "" : _props$className,
|
|
40
|
-
rest = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
|
|
41
|
-
var classNames = (0, _classnames2["default"])((_classnames = {
|
|
42
|
-
input: true,
|
|
43
|
-
"input--error": error
|
|
44
|
-
}, _classnames[className] = className, _classnames));
|
|
45
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
46
|
-
className: classNames,
|
|
47
|
-
__self: _this,
|
|
48
|
-
__source: {
|
|
49
|
-
fileName: _jsxFileName,
|
|
50
|
-
lineNumber: 26,
|
|
51
|
-
columnNumber: 3
|
|
52
|
-
}
|
|
53
|
-
}, label && /*#__PURE__*/_react["default"].createElement("label", {
|
|
54
|
-
className: "input__label",
|
|
55
|
-
htmlFor: name,
|
|
56
|
-
__self: _this,
|
|
57
|
-
__source: {
|
|
58
|
-
fileName: _jsxFileName,
|
|
59
|
-
lineNumber: 28,
|
|
60
|
-
columnNumber: 5
|
|
61
|
-
}
|
|
62
|
-
}, label), hint && /*#__PURE__*/_react["default"].createElement("p", {
|
|
63
|
-
className: "input__hint",
|
|
64
|
-
__self: _this,
|
|
65
|
-
__source: {
|
|
66
|
-
fileName: _jsxFileName,
|
|
67
|
-
lineNumber: 32,
|
|
68
|
-
columnNumber: 13
|
|
69
|
-
}
|
|
70
|
-
}, hint), error && /*#__PURE__*/_react["default"].createElement("p", {
|
|
71
|
-
className: "input__error",
|
|
72
|
-
__self: _this,
|
|
73
|
-
__source: {
|
|
74
|
-
fileName: _jsxFileName,
|
|
75
|
-
lineNumber: 33,
|
|
76
|
-
columnNumber: 14
|
|
77
|
-
}
|
|
78
|
-
}, errorMessage), /*#__PURE__*/_react["default"].createElement("input", (0, _extends2["default"])({
|
|
79
|
-
ref: inputRef,
|
|
80
|
-
name: name,
|
|
81
|
-
className: "input__input",
|
|
82
|
-
id: name,
|
|
83
|
-
type: type,
|
|
84
|
-
defaultValue: defaultValue
|
|
85
|
-
}, rest, {
|
|
86
|
-
__self: _this,
|
|
87
|
-
__source: {
|
|
88
|
-
fileName: _jsxFileName,
|
|
89
|
-
lineNumber: 34,
|
|
90
|
-
columnNumber: 4
|
|
91
|
-
}
|
|
92
|
-
})));
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
exports.Input = Input;
|
|
96
|
-
Input.propTypes = {
|
|
97
|
-
inputRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
|
|
98
|
-
current: _propTypes["default"].object
|
|
99
|
-
})]),
|
|
100
|
-
className: _propTypes["default"].string,
|
|
101
|
-
defaultValue: _propTypes["default"].string,
|
|
102
|
-
error: _propTypes["default"].bool,
|
|
103
|
-
errorMessage: _propTypes["default"].string,
|
|
104
|
-
label: _propTypes["default"].string,
|
|
105
|
-
hint: _propTypes["default"].string,
|
|
106
|
-
type: _propTypes["default"].oneOf(["color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "number", "range", "password", "search", "tel", "text", "time", "url", "week"]),
|
|
107
|
-
name: _propTypes["default"].string.isRequired
|
|
108
|
-
};
|
|
109
|
-
//# sourceMappingURL=Input.js.map
|
package/lib/Input.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","names":["Input","props","defaultValue","name","inputRef","error","errorMessage","label","hint","type","className","rest","classNames","classnames","input","propTypes","PropTypes","oneOfType","func","shape","current","object","string","bool","oneOf","isRequired"],"sources":["../src/Input.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport classnames from \"classnames\";\n\nimport \"./../scss/input.scss\";\n\nexport const Input = (props) => {\n\tconst {\n\t\tdefaultValue,\n\t\tname,\n\t\tinputRef,\n\t\terror,\n\t\terrorMessage,\n\t\tlabel = \"Label\",\n\t\thint,\n\t\ttype = \"text\",\n\t\tclassName = \"\",\n\t\t...rest\n\t} = props;\n\tconst classNames = classnames({\n\t\tinput: true,\n\t\t\"input--error\": error,\n\t\t[className]: className\n\t});\n\treturn (\n\t\t<div className={classNames}>\n\t\t\t{label && (\n\t\t\t\t<label className=\"input__label\" htmlFor={name}>\n\t\t\t\t\t{label}\n\t\t\t\t</label>\n\t\t\t)}\n\t\t\t{hint && <p className=\"input__hint\">{hint}</p>}\n\t\t\t{error && <p className=\"input__error\">{errorMessage}</p>}\n\t\t\t<input\n\t\t\t\tref={inputRef}\n\t\t\t\tname={name}\n\t\t\t\tclassName=\"input__input\"\n\t\t\t\tid={name}\n\t\t\t\ttype={type}\n\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nInput.propTypes = {\n\tinputRef: PropTypes.oneOfType([\n\t\tPropTypes.func,\n\t\tPropTypes.shape({ current: PropTypes.object })\n\t]),\n\tclassName: PropTypes.string,\n\tdefaultValue: PropTypes.string,\n\terror: PropTypes.bool,\n\terrorMessage: PropTypes.string,\n\tlabel: PropTypes.string,\n\thint: PropTypes.string,\n\ttype: PropTypes.oneOf([\n\t\t\"color\",\n\t\t\"date\",\n\t\t\"datetime-local\",\n\t\t\"email\",\n\t\t\"file\",\n\t\t\"hidden\",\n\t\t\"image\",\n\t\t\"month\",\n\t\t\"number\",\n\t\t\"range\",\n\t\t\"password\",\n\t\t\"search\",\n\t\t\"tel\",\n\t\t\"text\",\n\t\t\"time\",\n\t\t\"url\",\n\t\t\"week\"\n\t]),\n\tname: PropTypes.string.isRequired\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;;;;;;AAEO,IAAMA,KAAK,GAAG,SAARA,KAAQ,CAACC,KAAD,EAAW;EAAA;;EAC/B,IACCC,YADD,GAWID,KAXJ,CACCC,YADD;EAAA,IAECC,IAFD,GAWIF,KAXJ,CAECE,IAFD;EAAA,IAGCC,QAHD,GAWIH,KAXJ,CAGCG,QAHD;EAAA,IAICC,KAJD,GAWIJ,KAXJ,CAICI,KAJD;EAAA,IAKCC,YALD,GAWIL,KAXJ,CAKCK,YALD;EAAA,mBAWIL,KAXJ,CAMCM,KAND;EAAA,IAMCA,KAND,6BAMS,OANT;EAAA,IAOC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ALJ;EAMjBpB,YAAY,EAAEc,qBAAA,CAAUM,MANP;EAOjBjB,KAAK,EAAEW,qBAAA,CAAUO,IAPA;EAQjBjB,YAAY,EAAEU,qBAAA,CAAUM,MARP;EASjBf,KAAK,EAAES,qBAAA,CAAUM,MATA;EAUjBd,IAAI,EAAEQ,qBAAA,CAAUM,MAVC;EAWjBb,IAAI,EAAEO,qBAAA,CAAUQ,KAAV,CAAgB,CACrB,OADqB,EAErB,MAFqB,EAGrB,gBAHqB,EAIrB,OAJqB,EAKrB,MALqB,EAMrB,QANqB,EAOrB,OAPqB,EAQrB,OARqB,EASrB,QATqB,EAUrB,OAVqB,EAWrB,UAXqB,EAYrB,QAZqB,EAarB,KAbqB,EAcrB,MAdqB,EAerB,MAfqB,EAgBrB,KAhBqB,EAiBrB,MAjBqB,CAAhB,CAXW;EA8BjBrB,IAAI,EAAEa,qBAAA,CAAUM,MAAV,CAAiBG;AA9BN,CAAlB"}
|
package/nds-input.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
declare module "@nice-digital/nds-input" {
|
|
2
|
-
import React = require("react");
|
|
3
|
-
|
|
4
|
-
export interface InputProps {
|
|
5
|
-
[prop: string]: unknown;
|
|
6
|
-
defaultValue?: string;
|
|
7
|
-
error?: boolean;
|
|
8
|
-
errorMessage?: string;
|
|
9
|
-
hint?: string;
|
|
10
|
-
inputRef?: React.Ref<HTMLElement>;
|
|
11
|
-
label: string | null;
|
|
12
|
-
name: string;
|
|
13
|
-
type?:
|
|
14
|
-
| "color"
|
|
15
|
-
| "date"
|
|
16
|
-
| "datetime-local"
|
|
17
|
-
| "email"
|
|
18
|
-
| "file"
|
|
19
|
-
| "hidden"
|
|
20
|
-
| "image"
|
|
21
|
-
| "month"
|
|
22
|
-
| "number"
|
|
23
|
-
| "range"
|
|
24
|
-
| "password"
|
|
25
|
-
| "search"
|
|
26
|
-
| "tel"
|
|
27
|
-
| "text"
|
|
28
|
-
| "time"
|
|
29
|
-
| "url"
|
|
30
|
-
| "week";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const Input: React.FC<InputProps>;
|
|
34
|
-
}
|