@gnist/design-system 7.10.3 → 7.10.4

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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.10.4](https://github.com/mollerdigital/design-system/compare/%40gnist%2Fdesign-system%407.10.3...%40gnist%2Fdesign-system%407.10.4) (2026-11-25)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **checkbox:** support helperText instead of leaking it to the DOM input ([b4633b5](https://github.com/mollerdigital/design-system/commit/b4633b55461b8d0c68df09a82c785790841e1a9b))
11
+
6
12
  ## [7.10.3](https://github.com/mollerdigital/design-system/compare/%40gnist%2Fdesign-system%407.10.2...%40gnist%2Fdesign-system%407.10.3) (2026-11-24)
7
13
 
8
14
  ### Bug Fixes
@@ -36,12 +36,13 @@ var defaultRender = (checkbox, description) => (0, react_jsx_runtime.jsxs)(react
36
36
 
37
37
  Documentation: [Checkbox](https://gnist.moller.no/developers/components/latest/?path=/docs/components-actions-selectioncontrols-checkbox--docs)
38
38
  */
39
- function Checkbox({ label, description, value, onChange, disabled, validity, id = require_index$1.createValidHtmlId(label), hideLabel = false, canShowErrorMessage = false, className, render = defaultRender, onBlur, ref, ...rest }) {
39
+ function Checkbox({ label, description, value, onChange, disabled, validity, helperText, id = require_index$1.createValidHtmlId(label), hideLabel = false, canShowErrorMessage = false, className, render = defaultRender, onBlur, ref, ...rest }) {
40
40
  const inputId = id;
41
41
  const labelId = `${id}-label`;
42
42
  const helperId = `${id}-helper`;
43
43
  const { helperTextProps, inputAriaProps } = require_InputHelperText.useInputHelperText({
44
44
  id: helperId,
45
+ helperText,
45
46
  validity,
46
47
  reserveSpaceForMessage: canShowErrorMessage
47
48
  });
@@ -1,6 +1,7 @@
1
1
  import { Ref } from "react";
2
+ import { HelperText } from "../../inputs/textFields/shared.js";
2
3
  import { SelectionControlProps } from "./shared.js";
3
- export type CheckboxProps = SelectionControlProps<boolean | "indeterminate"> & {
4
+ export type CheckboxProps = SelectionControlProps<boolean | "indeterminate"> & HelperText & {
4
5
  ref?: Ref<HTMLSpanElement>;
5
6
  };
6
7
  /**
@@ -11,5 +12,5 @@ export type CheckboxProps = SelectionControlProps<boolean | "indeterminate"> & {
11
12
 
12
13
  Documentation: [Checkbox](https://gnist.moller.no/developers/components/latest/?path=/docs/components-actions-selectioncontrols-checkbox--docs)
13
14
  */
14
- export declare function Checkbox({ label, description, value, onChange, disabled, validity, id, hideLabel, canShowErrorMessage, className, render, onBlur, ref, ...rest }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function Checkbox({ label, description, value, onChange, disabled, validity, helperText, id, hideLabel, canShowErrorMessage, className, render, onBlur, ref, ...rest }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
15
16
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/Checkbox.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAU5B,OAAO,EAEH,qBAAqB,EAExB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC,OAAO,GAAG,eAAe,CAAC,GAAG;IAC3E,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC9B,CAAC;AA+BF;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EACrB,KAAK,EACL,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,EAA6B,EAC7B,SAAiB,EACjB,mBAA2B,EAC3B,SAAS,EACT,MAAsB,EAEtB,MAAM,EACN,GAAG,EACH,GAAG,IAAI,EACV,EAAE,aAAa,2CA0Df"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/actions/selectionControls/Checkbox.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAU/D,OAAO,EAEH,qBAAqB,EAExB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC,OAAO,GAAG,eAAe,CAAC,GACxE,UAAU,GAAG;IACT,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC9B,CAAC;AA+BN;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EACrB,KAAK,EACL,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,EAA6B,EAC7B,SAAiB,EACjB,mBAA2B,EAC3B,SAAS,EACT,MAAsB,EAEtB,MAAM,EACN,GAAG,EACH,GAAG,IAAI,EACV,EAAE,aAAa,2CA2Df"}
@@ -36,12 +36,13 @@ var defaultRender = (checkbox, description) => jsxs(Fragment, { children: [check
36
36
 
37
37
  Documentation: [Checkbox](https://gnist.moller.no/developers/components/latest/?path=/docs/components-actions-selectioncontrols-checkbox--docs)
38
38
  */
39
- function Checkbox({ label, description, value, onChange, disabled, validity, id = createValidHtmlId(label), hideLabel = false, canShowErrorMessage = false, className, render = defaultRender, onBlur, ref, ...rest }) {
39
+ function Checkbox({ label, description, value, onChange, disabled, validity, helperText, id = createValidHtmlId(label), hideLabel = false, canShowErrorMessage = false, className, render = defaultRender, onBlur, ref, ...rest }) {
40
40
  const inputId = id;
41
41
  const labelId = `${id}-label`;
42
42
  const helperId = `${id}-helper`;
43
43
  const { helperTextProps, inputAriaProps } = useInputHelperText({
44
44
  id: helperId,
45
+ helperText,
45
46
  validity,
46
47
  reserveSpaceForMessage: canShowErrorMessage
47
48
  });
@@ -32,10 +32,32 @@ var validRegistrationNumber = require_validation.validation({
32
32
  preValidation: (x) => require_validation.stripWhitespace(x).toUpperCase(),
33
33
  showMessageImmediately: (x) => x.length > 7
34
34
  });
35
+ /**
36
+ * Validates that a checkbox is checked, e.g. for accepting terms.
37
+ *
38
+ * Note: this does not make the field required. Wrap it in `required(...)`, otherwise the field is
39
+ * treated as optional and forms with mixed necessity will show it as "Valgfritt".
40
+ *
41
+ * @param message Validation message when the checkbox is not checked
42
+ *
43
+ * @example
44
+ * acceptedTerms: required(mustBeChecked("You must accept the terms")),
45
+ */
35
46
  var mustBeChecked = (message) => require_validation.validation({ steps: [(isChecked) => ({
36
47
  isValid: isChecked,
37
48
  errorMessage: message
38
49
  })] });
50
+ /**
51
+ * Validates that at least one option is selected.
52
+ *
53
+ * Note: this does not make the field required. Wrap it in `required(...)`, otherwise the field is
54
+ * treated as optional and forms with mixed necessity will show it as "Valgfritt".
55
+ *
56
+ * @param message Validation message when nothing is selected
57
+ *
58
+ * @example
59
+ * channels: required(atLeastOneMustBeChecked("Select at least one")),
60
+ */
39
61
  var atLeastOneMustBeChecked = (message) => require_validation.validation({ steps: [(selected) => ({
40
62
  isValid: selected.length > 0,
41
63
  errorMessage: message
@@ -5,6 +5,28 @@ export declare const validEmail: import("./validation.js").ValidatorConfig<strin
5
5
  export declare const validName: import("./validation.js").ValidatorConfig<string, unknown>;
6
6
  export declare const validCellPhoneNumber: import("./validation.js").ValidatorConfig<string, unknown>;
7
7
  export declare const validRegistrationNumber: import("./validation.js").ValidatorConfig<string, unknown>;
8
+ /**
9
+ * Validates that a checkbox is checked, e.g. for accepting terms.
10
+ *
11
+ * Note: this does not make the field required. Wrap it in `required(...)`, otherwise the field is
12
+ * treated as optional and forms with mixed necessity will show it as "Valgfritt".
13
+ *
14
+ * @param message Validation message when the checkbox is not checked
15
+ *
16
+ * @example
17
+ * acceptedTerms: required(mustBeChecked("You must accept the terms")),
18
+ */
8
19
  export declare const mustBeChecked: <T>(message: string) => import("./validation.js").ValidatorConfig<boolean, T>;
20
+ /**
21
+ * Validates that at least one option is selected.
22
+ *
23
+ * Note: this does not make the field required. Wrap it in `required(...)`, otherwise the field is
24
+ * treated as optional and forms with mixed necessity will show it as "Valgfritt".
25
+ *
26
+ * @param message Validation message when nothing is selected
27
+ *
28
+ * @example
29
+ * channels: required(atLeastOneMustBeChecked("Select at least one")),
30
+ */
9
31
  export declare const atLeastOneMustBeChecked: <T, TVal>(message: string) => import("./validation.js").ValidatorConfig<TVal[], T>;
10
32
  //# sourceMappingURL=validators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/utilities/validation/validators.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,IAAI,yDAA4B,CAAC;AAEjE,eAAO,MAAM,YAAY,4DAOvB,CAAC;AAEH,eAAO,MAAM,YAAY,4DASvB,CAAC;AAEH,eAAO,MAAM,UAAU,4DAOrB,CAAC;AAEH,eAAO,MAAM,SAAS,4DAUpB,CAAC;AAEH,eAAO,MAAM,oBAAoB,4DAgB/B,CAAC;AAEH,eAAO,MAAM,uBAAuB,4DASlC,CAAC;AAEH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,SAAS,MAAM,0DAQ1C,CAAC;AAEP,eAAO,MAAM,uBAAuB,GAAI,CAAC,EAAE,IAAI,EAAE,SAAS,MAAM,yDAQ1D,CAAC"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/utilities/validation/validators.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,IAAI,yDAA4B,CAAC;AAEjE,eAAO,MAAM,YAAY,4DAOvB,CAAC;AAEH,eAAO,MAAM,YAAY,4DASvB,CAAC;AAEH,eAAO,MAAM,UAAU,4DAOrB,CAAC;AAEH,eAAO,MAAM,SAAS,4DAUpB,CAAC;AAEH,eAAO,MAAM,oBAAoB,4DAgB/B,CAAC;AAEH,eAAO,MAAM,uBAAuB,4DASlC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,SAAS,MAAM,0DAQ1C,CAAC;AAEP;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,EAAE,IAAI,EAAE,SAAS,MAAM,yDAQ1D,CAAC"}
@@ -32,10 +32,32 @@ var validRegistrationNumber = validation({
32
32
  preValidation: (x) => stripWhitespace(x).toUpperCase(),
33
33
  showMessageImmediately: (x) => x.length > 7
34
34
  });
35
+ /**
36
+ * Validates that a checkbox is checked, e.g. for accepting terms.
37
+ *
38
+ * Note: this does not make the field required. Wrap it in `required(...)`, otherwise the field is
39
+ * treated as optional and forms with mixed necessity will show it as "Valgfritt".
40
+ *
41
+ * @param message Validation message when the checkbox is not checked
42
+ *
43
+ * @example
44
+ * acceptedTerms: required(mustBeChecked("You must accept the terms")),
45
+ */
35
46
  var mustBeChecked = (message) => validation({ steps: [(isChecked) => ({
36
47
  isValid: isChecked,
37
48
  errorMessage: message
38
49
  })] });
50
+ /**
51
+ * Validates that at least one option is selected.
52
+ *
53
+ * Note: this does not make the field required. Wrap it in `required(...)`, otherwise the field is
54
+ * treated as optional and forms with mixed necessity will show it as "Valgfritt".
55
+ *
56
+ * @param message Validation message when nothing is selected
57
+ *
58
+ * @example
59
+ * channels: required(atLeastOneMustBeChecked("Select at least one")),
60
+ */
39
61
  var atLeastOneMustBeChecked = (message) => validation({ steps: [(selected) => ({
40
62
  isValid: selected.length > 0,
41
63
  errorMessage: message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gnist/design-system",
3
- "version": "7.10.3",
3
+ "version": "7.10.4",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -111,5 +111,5 @@
111
111
  "optional": true
112
112
  }
113
113
  },
114
- "gitHead": "11b301a363c00272c3781e2d595b471fe0390b8d"
114
+ "gitHead": "b7cc89d095b994c4b13eaabd160c8cbb7adf1674"
115
115
  }