@nice-digital/nds-checkbox 4.0.15 → 4.0.17-alpha-node-update.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/Checkbox.d.ts +20 -20
- package/es/Checkbox.js +34 -34
- package/package.json +5 -5
package/es/Checkbox.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "../scss/checkbox.scss";
|
|
3
|
-
export interface CheckboxProps {
|
|
4
|
-
/** Allow any additional props to be passed and applied to the checkbox */
|
|
5
|
-
[prop: string]: unknown;
|
|
6
|
-
/** The name attribute for the checkbox */
|
|
7
|
-
name: string;
|
|
8
|
-
/** The label for the checkbox. If none supplied will use the value */
|
|
9
|
-
label?: React.ReactNode;
|
|
10
|
-
/** The value for the checkbox */
|
|
11
|
-
value: string;
|
|
12
|
-
/** Add to checkboxes that you would like to display inline, left to right */
|
|
13
|
-
inline?: boolean;
|
|
14
|
-
/** Option for putting the checkbox into a visual error state. Set to true for error styling or supply a string for error styling and addional error text*/
|
|
15
|
-
error?: boolean | string;
|
|
16
|
-
/** Add hint text for extra context to the checkbox */
|
|
17
|
-
hint?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const Checkbox: React.FC<CheckboxProps>;
|
|
20
|
-
export default Checkbox;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "../scss/checkbox.scss";
|
|
3
|
+
export interface CheckboxProps {
|
|
4
|
+
/** Allow any additional props to be passed and applied to the checkbox */
|
|
5
|
+
[prop: string]: unknown;
|
|
6
|
+
/** The name attribute for the checkbox */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The label for the checkbox. If none supplied will use the value */
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
/** The value for the checkbox */
|
|
11
|
+
value: string;
|
|
12
|
+
/** Add to checkboxes that you would like to display inline, left to right */
|
|
13
|
+
inline?: boolean;
|
|
14
|
+
/** Option for putting the checkbox into a visual error state. Set to true for error styling or supply a string for error styling and addional error text*/
|
|
15
|
+
error?: boolean | string;
|
|
16
|
+
/** Add hint text for extra context to the checkbox */
|
|
17
|
+
hint?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const Checkbox: React.FC<CheckboxProps>;
|
|
20
|
+
export default Checkbox;
|
package/es/Checkbox.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
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.Checkbox = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
-
require("../scss/checkbox.scss");
|
|
21
|
-
const Checkbox = (props) => {
|
|
22
|
-
const { error, inline, name, label, value, hint } = props, rest = __rest(props, ["error", "inline", "name", "label", "value", "hint"]);
|
|
23
|
-
if (!value)
|
|
24
|
-
return null;
|
|
25
|
-
const unique = name + "_" + value;
|
|
26
|
-
const classNames = (0, classnames_1.default)({
|
|
27
|
-
checkbox: true,
|
|
28
|
-
"checkbox--inline": inline,
|
|
29
|
-
"checkbox--error": error
|
|
30
|
-
});
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [error && error.toString().length && ((0, jsx_runtime_1.jsx)("p",
|
|
32
|
-
};
|
|
33
|
-
exports.Checkbox = Checkbox;
|
|
34
|
-
exports.default = exports.Checkbox;
|
|
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.Checkbox = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
require("../scss/checkbox.scss");
|
|
21
|
+
const Checkbox = (props) => {
|
|
22
|
+
const { error, inline, name, label, value, hint } = props, rest = __rest(props, ["error", "inline", "name", "label", "value", "hint"]);
|
|
23
|
+
if (!value)
|
|
24
|
+
return null;
|
|
25
|
+
const unique = name + "_" + value;
|
|
26
|
+
const classNames = (0, classnames_1.default)({
|
|
27
|
+
checkbox: true,
|
|
28
|
+
"checkbox--inline": inline,
|
|
29
|
+
"checkbox--error": error
|
|
30
|
+
});
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [error && error.toString().length && ((0, jsx_runtime_1.jsx)("p", { className: "checkbox__error-message", children: error })), (0, jsx_runtime_1.jsx)("div", { className: classNames, "data-component": "checkbox", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", Object.assign({ type: "checkbox", className: "checkbox__input", id: unique, name: name, value: value }, rest)), (0, jsx_runtime_1.jsx)("label", { className: "checkbox__label", htmlFor: unique, children: label ? label : value }), hint && (0, jsx_runtime_1.jsx)("span", { className: "checkbox__hint", children: hint })] }) })] }));
|
|
32
|
+
};
|
|
33
|
+
exports.Checkbox = Checkbox;
|
|
34
|
+
exports.default = exports.Checkbox;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-digital/nds-checkbox",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.17-alpha-node-update.0",
|
|
4
4
|
"description": "Checkbox component for the NICE Design System",
|
|
5
5
|
"author": "Warren Keith <warren.keith@nice.org.uk>",
|
|
6
6
|
"homepage": "https://design-system.nice.org.uk/",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"url": "https://github.com/nice-digital/nice-design-system/issues"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nice-digital/nds-core": "^4.0.
|
|
34
|
+
"@nice-digital/nds-core": "^4.0.17-alpha-node-update.0",
|
|
35
35
|
"classnames": "^2.2.6"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@testing-library/react": "^13.4.0",
|
|
44
44
|
"@testing-library/user-event": "^14.4.3",
|
|
45
45
|
"@types/jest": "^29.2.2",
|
|
46
|
-
"@types/node": "
|
|
47
|
-
"typescript": "^
|
|
46
|
+
"@types/node": "22.19.0",
|
|
47
|
+
"typescript": "^5.9.3"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1b7a4a13183120071b022adecd2fcf4eebefbb6c"
|
|
50
50
|
}
|