@uktrade/react-component-library 0.16.0 → 0.17.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/dist/components/Inputs/CheckBoxesInput/CheckBoxGroupInput.d.ts +1 -0
- package/dist/components/Inputs/CheckBoxesInput/CheckBoxGroupInput.d.ts.map +1 -1
- package/dist/components/Inputs/CheckBoxesInput/CheckBoxGroupInput.js +1 -1
- package/package.json +1 -1
- package/src/components/Inputs/CheckBoxesInput/CheckBoxGroupInput.tsx +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBoxGroupInput.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/CheckBoxesInput/CheckBoxGroupInput.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,KAAK,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAEzC,UAAU,cAAc;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckBoxGroupInput.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/CheckBoxesInput/CheckBoxGroupInput.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,KAAK,UAAU,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAEzC,UAAU,cAAc;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,kBAAkB;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,aAAa,GAAI,uFAU3B,kBAAkB,4CA6EpB,CAAC"}
|
|
@@ -19,5 +19,5 @@ export const CheckboxGroup = ({ legend, hint, error, options, name, legendAs = "
|
|
|
19
19
|
[`govuk-fieldset__legend--${legendSize}`]: legendSize !== "m",
|
|
20
20
|
}), children: legendHeading }), hint && _jsx("div", { className: "govuk-hint", children: hint }), hasError && (_jsxs("p", { id: errorId, className: "govuk-error-message", children: [_jsx("span", { className: "govuk-visually-hidden", children: "Error:" }), " ", error] })), _jsx("div", { className: clsx("govuk-checkboxes", {
|
|
21
21
|
"govuk-checkboxes--small": checkboxSize === "small",
|
|
22
|
-
}), "data-module": "govuk-checkboxes", children: options.map((opt) => (_jsxs("div", { className: "govuk-checkboxes__item", children: [_jsx("input", { className: "govuk-checkboxes__input", id: opt.id, name: name, type: "checkbox", value: opt.value, defaultChecked: opt.checked, onChange: handleChange }), _jsx("label", { className: "govuk-label govuk-checkboxes__label", htmlFor: opt.id, children: opt.label })] }, opt.id))) })] }) }));
|
|
22
|
+
}), "data-module": "govuk-checkboxes", children: options.map((opt) => (_jsxs("div", { className: "govuk-checkboxes__item", children: [_jsx("input", { className: "govuk-checkboxes__input", id: opt.id, name: name, type: "checkbox", value: opt.value, defaultChecked: opt.checked, onChange: handleChange }), _jsx("label", { className: "govuk-label govuk-checkboxes__label", htmlFor: opt.id, children: opt.label }), opt.hint && (_jsx("div", { className: "govuk-hint govuk-checkboxes__hint", children: opt.hint }))] }, opt.id))) })] }) }));
|
|
23
23
|
};
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ interface CheckboxOption {
|
|
|
12
12
|
value: string;
|
|
13
13
|
label: ReactNode;
|
|
14
14
|
checked?: boolean;
|
|
15
|
+
hint?: string;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
interface CheckboxGroupProps {
|
|
@@ -102,6 +103,11 @@ export const CheckboxGroup = ({
|
|
|
102
103
|
>
|
|
103
104
|
{opt.label}
|
|
104
105
|
</label>
|
|
106
|
+
{opt.hint && (
|
|
107
|
+
<div className="govuk-hint govuk-checkboxes__hint">
|
|
108
|
+
{opt.hint}
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
105
111
|
</div>
|
|
106
112
|
))}
|
|
107
113
|
</div>
|