@gnist/design-system 7.10.2 → 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 +12 -0
- package/dist/components/actions/selectionControls/Checkbox.cjs +2 -1
- package/dist/components/actions/selectionControls/Checkbox.d.ts +3 -2
- package/dist/components/actions/selectionControls/Checkbox.d.ts.map +1 -1
- package/dist/components/actions/selectionControls/Checkbox.js +2 -1
- package/dist/components/surfaces/cards/ActionCard.cjs +9 -1
- package/dist/components/surfaces/cards/ActionCard.d.ts +3 -1
- package/dist/components/surfaces/cards/ActionCard.d.ts.map +1 -1
- package/dist/components/surfaces/cards/ActionCard.js +9 -1
- package/dist/utilities/validation/validators.cjs +22 -0
- package/dist/utilities/validation/validators.d.ts +22 -0
- package/dist/utilities/validation/validators.d.ts.map +1 -1
- package/dist/utilities/validation/validators.js +22 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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
|
+
|
|
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)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **ActionCard:** render decorative skeleton as div while loading rather than button ([e82eb00](https://github.com/mollerdigital/design-system/commit/e82eb00d1860d153b7b50247d1c1642f30d63d0f))
|
|
17
|
+
|
|
6
18
|
## [7.10.2](https://github.com/mollerdigital/design-system/compare/%40gnist%2Fdesign-system%407.10.1...%40gnist%2Fdesign-system%407.10.2) (2026-11-24)
|
|
7
19
|
|
|
8
20
|
### 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;
|
|
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
|
});
|
|
@@ -15,6 +15,8 @@ Card layouts can vary to support the types of content they contain. Imagery, ico
|
|
|
15
15
|
|
|
16
16
|
`ActionCard` is meant for actions with an `onClick` attribute. If a link is desired, use `LinkCard` instead.
|
|
17
17
|
|
|
18
|
+
While loading, only a decorative skeleton is rendered.
|
|
19
|
+
|
|
18
20
|
Documentation: [ActionCard](https://gnist.moller.no/developers/components/latest/?path=/docs/components-surfaces-cards-actioncard--docs)
|
|
19
21
|
*/
|
|
20
22
|
function ActionCard({ $as, as, children, isLoading, density, ref, ...props }) {
|
|
@@ -27,6 +29,12 @@ function ActionCard({ $as, as, children, isLoading, density, ref, ...props }) {
|
|
|
27
29
|
density
|
|
28
30
|
}), props.className)
|
|
29
31
|
};
|
|
30
|
-
|
|
32
|
+
if (isLoading) return (0, react_jsx_runtime.jsx)("div", {
|
|
33
|
+
"aria-hidden": true,
|
|
34
|
+
className: cardProps.className,
|
|
35
|
+
style: cardProps.style,
|
|
36
|
+
children: (0, react_jsx_runtime.jsx)(require_SharedComponents.LoadingSkeleton, {})
|
|
37
|
+
});
|
|
38
|
+
return (0, react.createElement)($as ?? as ?? "button", cardProps, (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children }));
|
|
31
39
|
}
|
|
32
40
|
exports.ActionCard = ActionCard;
|
|
@@ -8,7 +8,9 @@ Card layouts can vary to support the types of content they contain. Imagery, ico
|
|
|
8
8
|
|
|
9
9
|
`ActionCard` is meant for actions with an `onClick` attribute. If a link is desired, use `LinkCard` instead.
|
|
10
10
|
|
|
11
|
+
While loading, only a decorative skeleton is rendered.
|
|
12
|
+
|
|
11
13
|
Documentation: [ActionCard](https://gnist.moller.no/developers/components/latest/?path=/docs/components-surfaces-cards-actioncard--docs)
|
|
12
14
|
*/
|
|
13
|
-
export declare function ActionCard<AsElement extends ElementType = "button">({ $as, as, children, isLoading, density, ref, ...props }: ActionCardProps<AsElement>): import("react").
|
|
15
|
+
export declare function ActionCard<AsElement extends ElementType = "button">({ $as, as, children, isLoading, density, ref, ...props }: ActionCardProps<AsElement>): import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
//# sourceMappingURL=ActionCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionCard.d.ts","sourceRoot":"","sources":["../../../../src/components/surfaces/cards/ActionCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwC,WAAW,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMjD
|
|
1
|
+
{"version":3,"file":"ActionCard.d.ts","sourceRoot":"","sources":["../../../../src/components/surfaces/cards/ActionCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwC,WAAW,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMjD;;;;;;;;;;;EAWE;AACF,wBAAgB,UAAU,CAAC,SAAS,SAAS,WAAW,GAAG,QAAQ,EAAE,EACjE,GAAG,EACH,EAAE,EACF,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,EACH,GAAG,KAAK,EACX,EAAE,eAAe,CAAC,SAAS,CAAC,2CA2B5B"}
|
|
@@ -13,6 +13,8 @@ Card layouts can vary to support the types of content they contain. Imagery, ico
|
|
|
13
13
|
|
|
14
14
|
`ActionCard` is meant for actions with an `onClick` attribute. If a link is desired, use `LinkCard` instead.
|
|
15
15
|
|
|
16
|
+
While loading, only a decorative skeleton is rendered.
|
|
17
|
+
|
|
16
18
|
Documentation: [ActionCard](https://gnist.moller.no/developers/components/latest/?path=/docs/components-surfaces-cards-actioncard--docs)
|
|
17
19
|
*/
|
|
18
20
|
function ActionCard({ $as, as, children, isLoading, density, ref, ...props }) {
|
|
@@ -25,6 +27,12 @@ function ActionCard({ $as, as, children, isLoading, density, ref, ...props }) {
|
|
|
25
27
|
density
|
|
26
28
|
}), props.className)
|
|
27
29
|
};
|
|
28
|
-
|
|
30
|
+
if (isLoading) return jsx("div", {
|
|
31
|
+
"aria-hidden": true,
|
|
32
|
+
className: cardProps.className,
|
|
33
|
+
style: cardProps.style,
|
|
34
|
+
children: jsx(LoadingSkeleton, {})
|
|
35
|
+
});
|
|
36
|
+
return createElement($as ?? as ?? "button", cardProps, jsx(Fragment, { children }));
|
|
29
37
|
}
|
|
30
38
|
export { ActionCard };
|
|
@@ -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
|
+
"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": "
|
|
114
|
+
"gitHead": "b7cc89d095b994c4b13eaabd160c8cbb7adf1674"
|
|
115
115
|
}
|