@faststore/components 3.14.2 → 3.15.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/dist/cjs/molecules/CheckboxField/CheckboxField.d.ts +8 -0
- package/dist/cjs/molecules/CheckboxField/CheckboxField.js +7 -4
- package/dist/cjs/molecules/CheckboxField/CheckboxField.js.map +1 -1
- package/dist/cjs/molecules/Rating/Rating.d.ts +4 -0
- package/dist/cjs/molecules/Rating/Rating.js +2 -2
- package/dist/cjs/molecules/Rating/Rating.js.map +1 -1
- package/dist/esm/molecules/CheckboxField/CheckboxField.d.ts +8 -0
- package/dist/esm/molecules/CheckboxField/CheckboxField.js +7 -4
- package/dist/esm/molecules/CheckboxField/CheckboxField.js.map +1 -1
- package/dist/esm/molecules/Rating/Rating.d.ts +4 -0
- package/dist/esm/molecules/Rating/Rating.js +2 -2
- package/dist/esm/molecules/Rating/Rating.js.map +1 -1
- package/package.json +12 -3
- package/src/molecules/CheckboxField/CheckboxField.tsx +30 -2
- package/src/molecules/Rating/Rating.tsx +6 -0
|
@@ -5,6 +5,14 @@ export interface CheckboxFieldProps extends CheckboxProps {
|
|
|
5
5
|
* The text displayed to identify the input checkbox.
|
|
6
6
|
*/
|
|
7
7
|
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The error message is displayed when an error occurs.
|
|
10
|
+
*/
|
|
11
|
+
error?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Control the vertical alignment of the checkbox in relation to the label (center, top, bottom).
|
|
14
|
+
*/
|
|
15
|
+
alignment?: 'center' | 'top' | 'bottom';
|
|
8
16
|
}
|
|
9
17
|
declare const CheckboxField: React.ForwardRefExoticComponent<CheckboxFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
18
|
export default CheckboxField;
|
|
@@ -4,10 +4,13 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const Checkbox_1 = tslib_1.__importDefault(require("../../atoms/Checkbox"));
|
|
6
6
|
const Label_1 = tslib_1.__importDefault(require("../../atoms/Label"));
|
|
7
|
-
const CheckboxField = (0, react_1.forwardRef)(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, checked, ...otherProps }, ref) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
react_1.default.createElement(
|
|
7
|
+
const CheckboxField = (0, react_1.forwardRef)(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, checked, error, disabled, alignment = 'center', ...otherProps }, ref) {
|
|
8
|
+
const shouldDisplayError = !disabled && error && error !== '';
|
|
9
|
+
return (react_1.default.createElement("div", { ref: ref, "data-testid": testId, "data-fs-checkbox-field": true, "data-fs-checkbox-field-error": error && error !== '', "data-fs-checkbox-field-alignment": alignment },
|
|
10
|
+
react_1.default.createElement(Checkbox_1.default, { id: id, value: value ?? label, name: name, defaultChecked: checked, disabled: disabled, ...otherProps }),
|
|
11
|
+
react_1.default.createElement("div", { "data-fs-checkbox-field-content": true },
|
|
12
|
+
react_1.default.createElement(Label_1.default, { "data-fs-checkbox-field-label": true, htmlFor: id }, label),
|
|
13
|
+
shouldDisplayError && (react_1.default.createElement("span", { "data-fs-checkbox-field-error-message": true }, error)))));
|
|
11
14
|
});
|
|
12
15
|
exports.default = CheckboxField;
|
|
13
16
|
//# sourceMappingURL=CheckboxField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":";;;AAAA,uDAAyC;AACzC,4EAAmE;AACnE,sEAAqC;
|
|
1
|
+
{"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":";;;AAAA,uDAAyC;AACzC,4EAAmE;AACnE,sEAAqC;AAiBrC,MAAM,aAAa,GAAG,IAAA,kBAAU,EAC9B,SAAS,aAAa,CACpB,EACE,MAAM,GAAG,mBAAmB,EAC5B,EAAE,EACF,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,kBAAkB,GAAG,CAAC,QAAQ,IAAI,KAAK,IAAI,KAAK,KAAK,EAAE,CAAA;IAE7D,OAAO,CACL,uCACE,GAAG,EAAE,GAAG,iBACK,MAAM,kEAEW,KAAK,IAAI,KAAK,KAAK,EAAE,sCACjB,SAAS;QAE3C,8BAAC,kBAAQ,IACP,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,IAAI,KAAK,EACrB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,QAAQ,KACd,UAAU,GACd;QACF;YACE,8BAAC,eAAK,0CAA8B,OAAO,EAAE,EAAE,IAC5C,KAAK,CACA;YAEP,kBAAkB,IAAI,CACrB,wFAA4C,KAAK,CAAQ,CAC1D,CACG,CACF,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -20,6 +20,10 @@ export interface RatingProps extends Omit<HTMLAttributes<HTMLUListElement>, 'onC
|
|
|
20
20
|
* Function to be triggered when Rating option change. This should only be used if you and an actionable rating list.
|
|
21
21
|
*/
|
|
22
22
|
onChange?: (value: number) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Specifies that the actionable rating should be disabled.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
23
27
|
}
|
|
24
28
|
export interface RatingItemProps {
|
|
25
29
|
'data-fs-rating-item'?: 'full' | 'partial' | 'empty';
|
|
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const __1 = require("../..");
|
|
6
6
|
const List_1 = tslib_1.__importDefault(require("../../atoms/List"));
|
|
7
|
-
const Rating = (0, react_1.forwardRef)(function Rating({ children, testId = 'fs-rating', length = 5, value = 0, icon, onChange, ...otherProps }, ref) {
|
|
7
|
+
const Rating = (0, react_1.forwardRef)(function Rating({ children, testId = 'fs-rating', length = 5, value = 0, icon, onChange, disabled, ...otherProps }, ref) {
|
|
8
8
|
const [hover, setHover] = (0, react_1.useState)(0);
|
|
9
9
|
const outlineProps = { 'data-fs-rating-icon-outline': true };
|
|
10
10
|
const ratingIcon = react_1.default.isValidElement(icon) ? icon : react_1.default.createElement(__1.Icon, { name: "Star" });
|
|
@@ -21,7 +21,7 @@ const Rating = (0, react_1.forwardRef)(function Rating({ children, testId = 'fs-
|
|
|
21
21
|
};
|
|
22
22
|
return (react_1.default.createElement("li", { key: `rating-${index}`, "data-fs-rating-item": fillCheck(), "data-testid": `${testId}-item` }, onChange ? (react_1.default.createElement(__1.IconButton, { "data-fs-rating-button": true, icon: ratingIcon, size: "small", "aria-label": "rate", onClick: () => {
|
|
23
23
|
onChange(tempIndex);
|
|
24
|
-
}, onMouseEnter: () => setHover(tempIndex), onMouseLeave: () => setHover(value) })) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
24
|
+
}, onMouseEnter: () => setHover(tempIndex), onMouseLeave: () => setHover(value), disabled: disabled })) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
25
25
|
react_1.default.createElement("div", { "data-fs-rating-icon-wrapper": true }, ratingIcon),
|
|
26
26
|
react_1.default.isValidElement(icon) ? (react_1.default.cloneElement(icon, outlineProps)) : (react_1.default.createElement(__1.Icon, { name: "Star", "data-fs-rating-icon-outline": true }))))));
|
|
27
27
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rating.js","sourceRoot":"","sources":["../../../../src/molecules/Rating/Rating.tsx"],"names":[],"mappings":";;;AAAA,uDAKc;AAEd,6BAAwC;AACxC,oEAAmC;
|
|
1
|
+
{"version":3,"file":"Rating.js","sourceRoot":"","sources":["../../../../src/molecules/Rating/Rating.tsx"],"names":[],"m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M,OAAO,IAE5B,QAAQ,CAAC,CAAC,CAAC,CACV,8BAAC,cAAU,mCAET,IAAI,EAAE,UAAU,EAChB,IAAI,EAAC,OAAO,gBACD,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;gBACZ,QAAQ,CAAC,SAAS,CAAC,CAAA;YACrB,CAAC,EACD,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,EACvC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EACnC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,CACF;YACE,8EAAkC,UAAU,CAAO;YAClD,eAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAC5B,eAAK,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CACvC,CAAC,CAAC,CAAC,CACF,8BAAC,QAAI,IAAC,IAAI,EAAC,MAAM,wCAA+B,CACjD,CACA,CACJ,CACE,CACN,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,kBAAe,MAAM,CAAA"}
|
|
@@ -5,6 +5,14 @@ export interface CheckboxFieldProps extends CheckboxProps {
|
|
|
5
5
|
* The text displayed to identify the input checkbox.
|
|
6
6
|
*/
|
|
7
7
|
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The error message is displayed when an error occurs.
|
|
10
|
+
*/
|
|
11
|
+
error?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Control the vertical alignment of the checkbox in relation to the label (center, top, bottom).
|
|
14
|
+
*/
|
|
15
|
+
alignment?: 'center' | 'top' | 'bottom';
|
|
8
16
|
}
|
|
9
17
|
declare const CheckboxField: React.ForwardRefExoticComponent<CheckboxFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
18
|
export default CheckboxField;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import Checkbox from '../../atoms/Checkbox';
|
|
3
3
|
import Label from '../../atoms/Label';
|
|
4
|
-
const CheckboxField = forwardRef(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, checked, ...otherProps }, ref) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
React.createElement(
|
|
4
|
+
const CheckboxField = forwardRef(function CheckboxField({ testId = 'fs-checkbox-field', id, label, value, name, checked, error, disabled, alignment = 'center', ...otherProps }, ref) {
|
|
5
|
+
const shouldDisplayError = !disabled && error && error !== '';
|
|
6
|
+
return (React.createElement("div", { ref: ref, "data-testid": testId, "data-fs-checkbox-field": true, "data-fs-checkbox-field-error": error && error !== '', "data-fs-checkbox-field-alignment": alignment },
|
|
7
|
+
React.createElement(Checkbox, { id: id, value: value ?? label, name: name, defaultChecked: checked, disabled: disabled, ...otherProps }),
|
|
8
|
+
React.createElement("div", { "data-fs-checkbox-field-content": true },
|
|
9
|
+
React.createElement(Label, { "data-fs-checkbox-field-label": true, htmlFor: id }, label),
|
|
10
|
+
shouldDisplayError && (React.createElement("span", { "data-fs-checkbox-field-error-message": true }, error)))));
|
|
8
11
|
});
|
|
9
12
|
export default CheckboxField;
|
|
10
13
|
//# sourceMappingURL=CheckboxField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,QAAgC,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../../../src/molecules/CheckboxField/CheckboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,QAAgC,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,MAAM,mBAAmB,CAAA;AAiBrC,MAAM,aAAa,GAAG,UAAU,CAC9B,SAAS,aAAa,CACpB,EACE,MAAM,GAAG,mBAAmB,EAC5B,EAAE,EACF,KAAK,EACL,KAAK,EACL,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,kBAAkB,GAAG,CAAC,QAAQ,IAAI,KAAK,IAAI,KAAK,KAAK,EAAE,CAAA;IAE7D,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,iBACK,MAAM,kEAEW,KAAK,IAAI,KAAK,KAAK,EAAE,sCACjB,SAAS;QAE3C,oBAAC,QAAQ,IACP,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,IAAI,KAAK,EACrB,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,QAAQ,KACd,UAAU,GACd;QACF;YACE,oBAAC,KAAK,0CAA8B,OAAO,EAAE,EAAE,IAC5C,KAAK,CACA;YAEP,kBAAkB,IAAI,CACrB,8EAA4C,KAAK,CAAQ,CAC1D,CACG,CACF,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -20,6 +20,10 @@ export interface RatingProps extends Omit<HTMLAttributes<HTMLUListElement>, 'onC
|
|
|
20
20
|
* Function to be triggered when Rating option change. This should only be used if you and an actionable rating list.
|
|
21
21
|
*/
|
|
22
22
|
onChange?: (value: number) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Specifies that the actionable rating should be disabled.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
23
27
|
}
|
|
24
28
|
export interface RatingItemProps {
|
|
25
29
|
'data-fs-rating-item'?: 'full' | 'partial' | 'empty';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, useState, } from 'react';
|
|
2
2
|
import { Icon, IconButton } from '../..';
|
|
3
3
|
import List from '../../atoms/List';
|
|
4
|
-
const Rating = forwardRef(function Rating({ children, testId = 'fs-rating', length = 5, value = 0, icon, onChange, ...otherProps }, ref) {
|
|
4
|
+
const Rating = forwardRef(function Rating({ children, testId = 'fs-rating', length = 5, value = 0, icon, onChange, disabled, ...otherProps }, ref) {
|
|
5
5
|
const [hover, setHover] = useState(0);
|
|
6
6
|
const outlineProps = { 'data-fs-rating-icon-outline': true };
|
|
7
7
|
const ratingIcon = React.isValidElement(icon) ? icon : React.createElement(Icon, { name: "Star" });
|
|
@@ -18,7 +18,7 @@ const Rating = forwardRef(function Rating({ children, testId = 'fs-rating', leng
|
|
|
18
18
|
};
|
|
19
19
|
return (React.createElement("li", { key: `rating-${index}`, "data-fs-rating-item": fillCheck(), "data-testid": `${testId}-item` }, onChange ? (React.createElement(IconButton, { "data-fs-rating-button": true, icon: ratingIcon, size: "small", "aria-label": "rate", onClick: () => {
|
|
20
20
|
onChange(tempIndex);
|
|
21
|
-
}, onMouseEnter: () => setHover(tempIndex), onMouseLeave: () => setHover(value) })) : (React.createElement(React.Fragment, null,
|
|
21
|
+
}, onMouseEnter: () => setHover(tempIndex), onMouseLeave: () => setHover(value), disabled: disabled })) : (React.createElement(React.Fragment, null,
|
|
22
22
|
React.createElement("div", { "data-fs-rating-icon-wrapper": true }, ratingIcon),
|
|
23
23
|
React.isValidElement(icon) ? (React.cloneElement(icon, outlineProps)) : (React.createElement(Icon, { name: "Star", "data-fs-rating-icon-outline": true }))))));
|
|
24
24
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rating.js","sourceRoot":"","sources":["../../../../src/molecules/Rating/Rating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,UAAU,EAGV,QAAQ,GACT,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,IAAI,MAAM,kBAAkB,CAAA;
|
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AK,GAAG,CAAC,EAAE,CAAC;gBACnD,OAAO,SAAS,CAAA;YAClB,CAAC;YAED,OAAO,OAAO,CAAA;QAChB,CAAC,CAAA;QAED,OAAO,CACL,4BACE,GAAG,EAAE,UAAU,KAAK,EAAE,yBACD,SAAS,EAAE,iBACnB,GAAG,MAAM,OAAO,IAE5B,QAAQ,CAAC,CAAC,CAAC,CACV,oBAAC,UAAU,mCAET,IAAI,EAAE,UAAU,EAChB,IAAI,EAAC,OAAO,gBACD,MAAM,EACjB,OAAO,EAAE,GAAG,EAAE;gBACZ,QAAQ,CAAC,SAAS,CAAC,CAAA;YACrB,CAAC,EACD,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,EACvC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EACnC,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,CACF;YACE,oEAAkC,UAAU,CAAO;YAClD,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAC5B,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CACvC,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,IAAC,IAAI,EAAC,MAAM,wCAA+B,CACjD,CACA,CACJ,CACE,CACN,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.3",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"typings": "dist/esm/index.d.ts",
|
|
@@ -33,19 +33,28 @@
|
|
|
33
33
|
"react": "^18.2.0",
|
|
34
34
|
"react-dom": "^18.2.0"
|
|
35
35
|
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"react-intersection-observer": "^8.32.5",
|
|
38
|
+
"react-swipeable": "^7.0.0",
|
|
39
|
+
"tabbable": "^5.2.1"
|
|
40
|
+
},
|
|
36
41
|
"devDependencies": {
|
|
42
|
+
"@jest/globals": "29.7.0",
|
|
37
43
|
"@testing-library/jest-dom": "^6.5.0",
|
|
38
44
|
"@testing-library/react": "^14.3.0",
|
|
45
|
+
"@types/jest": "29.1.0",
|
|
39
46
|
"@types/jest-axe": "^3.5.9",
|
|
40
47
|
"@types/react": "^18.2.42",
|
|
41
48
|
"@types/react-dom": "^18.2.17",
|
|
49
|
+
"@types/tabbable": "^3.1.1",
|
|
42
50
|
"jest": "^29.7.0",
|
|
43
51
|
"jest-axe": "^9.0.0",
|
|
44
52
|
"jest-environment-jsdom": "^29.7.0",
|
|
45
|
-
"ts-jest": "^29.1.2"
|
|
53
|
+
"ts-jest": "^29.1.2",
|
|
54
|
+
"tslib": "^2.3.1"
|
|
46
55
|
},
|
|
47
56
|
"volta": {
|
|
48
57
|
"extends": "../../package.json"
|
|
49
58
|
},
|
|
50
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "d1e33c64330a0fc7b25930d7e86382efb9bd56ef"
|
|
51
60
|
}
|
|
@@ -7,6 +7,14 @@ export interface CheckboxFieldProps extends CheckboxProps {
|
|
|
7
7
|
* The text displayed to identify the input checkbox.
|
|
8
8
|
*/
|
|
9
9
|
label: string
|
|
10
|
+
/**
|
|
11
|
+
* The error message is displayed when an error occurs.
|
|
12
|
+
*/
|
|
13
|
+
error?: string
|
|
14
|
+
/**
|
|
15
|
+
* Control the vertical alignment of the checkbox in relation to the label (center, top, bottom).
|
|
16
|
+
*/
|
|
17
|
+
alignment?: 'center' | 'top' | 'bottom'
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
const CheckboxField = forwardRef<HTMLDivElement, CheckboxFieldProps>(
|
|
@@ -18,20 +26,40 @@ const CheckboxField = forwardRef<HTMLDivElement, CheckboxFieldProps>(
|
|
|
18
26
|
value,
|
|
19
27
|
name,
|
|
20
28
|
checked,
|
|
29
|
+
error,
|
|
30
|
+
disabled,
|
|
31
|
+
alignment = 'center',
|
|
21
32
|
...otherProps
|
|
22
33
|
},
|
|
23
34
|
ref
|
|
24
35
|
) {
|
|
36
|
+
const shouldDisplayError = !disabled && error && error !== ''
|
|
37
|
+
|
|
25
38
|
return (
|
|
26
|
-
<div
|
|
39
|
+
<div
|
|
40
|
+
ref={ref}
|
|
41
|
+
data-testid={testId}
|
|
42
|
+
data-fs-checkbox-field
|
|
43
|
+
data-fs-checkbox-field-error={error && error !== ''}
|
|
44
|
+
data-fs-checkbox-field-alignment={alignment}
|
|
45
|
+
>
|
|
27
46
|
<Checkbox
|
|
28
47
|
id={id}
|
|
29
48
|
value={value ?? label}
|
|
30
49
|
name={name}
|
|
31
50
|
defaultChecked={checked}
|
|
51
|
+
disabled={disabled}
|
|
32
52
|
{...otherProps}
|
|
33
53
|
/>
|
|
34
|
-
<
|
|
54
|
+
<div data-fs-checkbox-field-content>
|
|
55
|
+
<Label data-fs-checkbox-field-label htmlFor={id}>
|
|
56
|
+
{label}
|
|
57
|
+
</Label>
|
|
58
|
+
|
|
59
|
+
{shouldDisplayError && (
|
|
60
|
+
<span data-fs-checkbox-field-error-message>{error}</span>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
35
63
|
</div>
|
|
36
64
|
)
|
|
37
65
|
}
|
|
@@ -30,6 +30,10 @@ export interface RatingProps
|
|
|
30
30
|
* Function to be triggered when Rating option change. This should only be used if you and an actionable rating list.
|
|
31
31
|
*/
|
|
32
32
|
onChange?: (value: number) => void
|
|
33
|
+
/**
|
|
34
|
+
* Specifies that the actionable rating should be disabled.
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
export interface RatingItemProps {
|
|
@@ -45,6 +49,7 @@ const Rating = forwardRef<HTMLUListElement, RatingProps>(function Rating(
|
|
|
45
49
|
value = 0,
|
|
46
50
|
icon,
|
|
47
51
|
onChange,
|
|
52
|
+
disabled,
|
|
48
53
|
...otherProps
|
|
49
54
|
},
|
|
50
55
|
ref
|
|
@@ -94,6 +99,7 @@ const Rating = forwardRef<HTMLUListElement, RatingProps>(function Rating(
|
|
|
94
99
|
}}
|
|
95
100
|
onMouseEnter={() => setHover(tempIndex)}
|
|
96
101
|
onMouseLeave={() => setHover(value)}
|
|
102
|
+
disabled={disabled}
|
|
97
103
|
/>
|
|
98
104
|
) : (
|
|
99
105
|
<>
|