@nice-digital/nds-input 4.0.2-alpha.0 → 4.0.3

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.js CHANGED
@@ -25,6 +25,6 @@ const Input = (props) => {
25
25
  "input--error": error,
26
26
  [`${className}`]: className
27
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))] })));
28
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: classNames, "data-component": "input" }, { 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
29
  };
30
30
  exports.Input = Input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-digital/nds-input",
3
- "version": "4.0.2-alpha.0",
3
+ "version": "4.0.3",
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/",
@@ -30,7 +30,7 @@
30
30
  "url": "https://github.com/nice-digital/nice-design-system/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@nice-digital/nds-core": "^4.0.2-alpha.0",
33
+ "@nice-digital/nds-core": "^4.0.3",
34
34
  "classnames": "^2.2.6"
35
35
  },
36
36
  "devDependencies": {
@@ -45,5 +45,5 @@
45
45
  "react": "^16 || ^17 || ^18",
46
46
  "react-dom": "^16 || ^17 || ^18"
47
47
  },
48
- "gitHead": "4e9cad8a2b94cdf4af05b18a6610835883bedf0e"
48
+ "gitHead": "ae51389ba2e51dbe9ee3849e71d44fd567fb2822"
49
49
  }
@@ -1 +0,0 @@
1
- export {};
package/es/Input.test.js DELETED
@@ -1,45 +0,0 @@
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
- });