@helsenorge/designsystem-react 14.10.0 → 14.11.1

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.
Files changed (152) hide show
  1. package/lib/BabyMobileMedium.js +1 -1
  2. package/lib/CHANGELOG.md +16 -0
  3. package/lib/Checkbox.js +25 -48
  4. package/lib/Checkbox.js.map +1 -1
  5. package/lib/CheckboxMarker.js +60 -0
  6. package/lib/CheckboxMarker.js.map +1 -0
  7. package/lib/ChildMedium.js +1 -1
  8. package/lib/EyeContactMedium.js +79 -0
  9. package/lib/EyeContactMedium.js.map +1 -0
  10. package/lib/FacialRecognitionFingerprintMedium.js +1 -1
  11. package/lib/Filter.js +12 -12
  12. package/lib/Filter.js.map +1 -1
  13. package/lib/FormGroup.js +5 -5
  14. package/lib/FormGroup.js.map +1 -1
  15. package/lib/GiveBabyFoodMedium.js +1 -1
  16. package/lib/Illustration.js +1 -1
  17. package/lib/IllustrationNames.js +4 -0
  18. package/lib/IllustrationNames.js.map +1 -1
  19. package/lib/LazyIllustration.js +5 -1
  20. package/lib/LazyIllustration.js.map +1 -1
  21. package/lib/Radio.js +73 -0
  22. package/lib/Radio.js.map +1 -0
  23. package/lib/RadioButton.js +81 -3
  24. package/lib/RadioButton.js.map +1 -1
  25. package/lib/RadioButton2.js +3 -73
  26. package/lib/RadioButton2.js.map +1 -1
  27. package/lib/RadioMarker.js +31 -0
  28. package/lib/RadioMarker.js.map +1 -0
  29. package/lib/ReadLettersMedium.js +1 -1
  30. package/lib/Search.js +4 -4
  31. package/lib/Search.js.map +1 -1
  32. package/lib/SkinToSkinMedium.js +106 -0
  33. package/lib/SkinToSkinMedium.js.map +1 -0
  34. package/lib/StorkMedium.js +1 -1
  35. package/lib/StrollerMedium.js +1 -1
  36. package/lib/Support2Medium.js +1 -1
  37. package/lib/TableBody.js +1 -1
  38. package/lib/TableHead.js +1 -1
  39. package/lib/TableRow.js +1 -1
  40. package/lib/ThinkingMedium.js +1 -1
  41. package/lib/VisualCheckbox.js +77 -0
  42. package/lib/VisualCheckbox.js.map +1 -0
  43. package/lib/VisualRadio.js +62 -0
  44. package/lib/VisualRadio.js.map +1 -0
  45. package/lib/__mocks__/matchMedia.js +3 -2
  46. package/lib/__mocks__/matchMedia.js.map +1 -1
  47. package/lib/components/Checkbox/CheckboxMarker/CheckboxMarker.d.ts +20 -0
  48. package/lib/components/Checkbox/CheckboxMarker/styles.module.scss +309 -0
  49. package/lib/components/Checkbox/CheckboxMarker/styles.module.scss.d.ts +25 -0
  50. package/lib/components/Checkbox/styles.module.scss +9 -269
  51. package/lib/components/Checkbox/styles.module.scss.d.ts +1 -17
  52. package/lib/components/Icons/Sort.js +12 -12
  53. package/lib/components/Icons/Sort.js.map +1 -1
  54. package/lib/components/Illustration/index.js +1 -1
  55. package/lib/components/Illustrations/BabyMobile.js +1 -1
  56. package/lib/components/Illustrations/Child.js +1 -1
  57. package/lib/components/Illustrations/Doctor.js +1 -1
  58. package/lib/components/Illustrations/EyeContact.d.ts +8 -0
  59. package/lib/components/Illustrations/EyeContact.js +16 -0
  60. package/lib/components/Illustrations/EyeContact.js.map +1 -0
  61. package/lib/components/Illustrations/EyeContactMedium.d.ts +3 -0
  62. package/lib/components/Illustrations/EyeContactMedium.js +2 -0
  63. package/lib/components/Illustrations/FacialRecognitionFingerprint.js +1 -1
  64. package/lib/components/Illustrations/GiveBabyFood.js +1 -1
  65. package/lib/components/Illustrations/HealthcarePersonnel.js +1 -1
  66. package/lib/components/Illustrations/IllustrationNames.d.ts +1 -1
  67. package/lib/components/Illustrations/ReadLetters.js +1 -1
  68. package/lib/components/Illustrations/SkinToSkin.d.ts +8 -0
  69. package/lib/components/Illustrations/SkinToSkin.js +16 -0
  70. package/lib/components/Illustrations/SkinToSkin.js.map +1 -0
  71. package/lib/components/Illustrations/SkinToSkinMedium.d.ts +3 -0
  72. package/lib/components/Illustrations/SkinToSkinMedium.js +2 -0
  73. package/lib/components/Illustrations/Stork.js +1 -1
  74. package/lib/components/Illustrations/Stroller.js +1 -1
  75. package/lib/components/Illustrations/Support2.js +1 -1
  76. package/lib/components/Illustrations/Thinking.js +1 -1
  77. package/lib/components/Panel/index.js +1 -1
  78. package/lib/components/PanelList/index.js +1 -1
  79. package/lib/components/RadioButton/RadioMarker/RadioMarker.d.ts +20 -0
  80. package/lib/components/RadioButton/RadioMarker/styles.module.scss +288 -0
  81. package/lib/components/RadioButton/RadioMarker/styles.module.scss.d.ts +20 -0
  82. package/lib/components/RadioButton/index.d.ts +0 -1
  83. package/lib/components/RadioButton/index.js +3 -3
  84. package/lib/components/RadioButton/styles.module.scss +13 -275
  85. package/lib/components/RadioButton/styles.module.scss.d.ts +2 -12
  86. package/lib/components/Table/index.js +1 -1
  87. package/lib/components/Validation/index.js +1 -1
  88. package/lib/components/VisualCheckboxCloud/Checkbox/styles.module.scss +5 -128
  89. package/lib/components/VisualCheckboxCloud/styles.module.scss +2 -9
  90. package/lib/components/VisualCheckboxGroup/VisualCheckbox/VisualCheckbox.d.ts +26 -0
  91. package/lib/components/VisualCheckboxGroup/VisualCheckbox/VisualContent.d.ts +10 -0
  92. package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.d.ts +3 -0
  93. package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.js +5 -0
  94. package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.js.map +1 -0
  95. package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss +7 -0
  96. package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss.d.ts +18 -0
  97. package/lib/components/VisualCheckboxGroup/VisualCheckboxGroup.d.ts +33 -0
  98. package/lib/components/VisualCheckboxGroup/index.d.ts +3 -0
  99. package/lib/components/VisualCheckboxGroup/index.js +43 -0
  100. package/lib/components/VisualCheckboxGroup/index.js.map +1 -0
  101. package/lib/components/VisualCheckboxGroup/styles.module.scss +6 -0
  102. package/lib/components/VisualCheckboxGroup/styles.module.scss.d.ts +10 -0
  103. package/lib/components/{VisualRadioButtonCloud/RadioButton/RadioButton.d.ts → VisualRadioCloud/Radio/Radio.d.ts} +3 -3
  104. package/lib/components/VisualRadioCloud/Radio/index.d.ts +3 -0
  105. package/lib/components/VisualRadioCloud/Radio/index.js +5 -0
  106. package/lib/components/VisualRadioCloud/Radio/index.js.map +1 -0
  107. package/lib/components/VisualRadioCloud/Radio/styles.module.scss +7 -0
  108. package/lib/components/VisualRadioCloud/Radio/styles.module.scss.d.ts +15 -0
  109. package/lib/components/{VisualRadioButtonCloud/VisualRadioButtonCloud.d.ts → VisualRadioCloud/VisualRadioCloud.d.ts} +8 -8
  110. package/lib/components/VisualRadioCloud/index.d.ts +3 -0
  111. package/lib/components/{VisualRadioButtonCloud → VisualRadioCloud}/index.js +7 -7
  112. package/lib/components/VisualRadioCloud/index.js.map +1 -0
  113. package/lib/components/VisualRadioCloud/styles.module.scss +6 -0
  114. package/lib/components/{VisualRadioButtonCloud → VisualRadioCloud}/styles.module.scss.d.ts +1 -1
  115. package/lib/components/VisualRadioGroup/VisualRadio/VisualContent.d.ts +10 -0
  116. package/lib/components/VisualRadioGroup/VisualRadio/VisualRadio.d.ts +26 -0
  117. package/lib/components/VisualRadioGroup/VisualRadio/index.d.ts +3 -0
  118. package/lib/components/VisualRadioGroup/VisualRadio/index.js +5 -0
  119. package/lib/components/VisualRadioGroup/VisualRadio/index.js.map +1 -0
  120. package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss +7 -0
  121. package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss.d.ts +18 -0
  122. package/lib/components/VisualRadioGroup/VisualRadioGroup.d.ts +39 -0
  123. package/lib/components/VisualRadioGroup/index.d.ts +3 -0
  124. package/lib/components/VisualRadioGroup/index.js +63 -0
  125. package/lib/components/VisualRadioGroup/index.js.map +1 -0
  126. package/lib/components/VisualRadioGroup/styles.module.scss +6 -0
  127. package/lib/components/VisualRadioGroup/styles.module.scss.d.ts +10 -0
  128. package/lib/resourceHelper.js +10 -6
  129. package/lib/resourceHelper.js.map +1 -1
  130. package/lib/resources/HN.Designsystem.Filter.en-GB.json.d.ts +5 -3
  131. package/lib/resources/HN.Designsystem.Filter.nb-NO.json.d.ts +5 -3
  132. package/lib/resources/Resources.d.ts +10 -2
  133. package/lib/scss/_visual-form.scss +357 -0
  134. package/lib/utils3.js +10 -98
  135. package/lib/utils3.js.map +1 -1
  136. package/lib/utils4.js +28 -11
  137. package/lib/utils4.js.map +1 -1
  138. package/lib/utils5.js +58 -28
  139. package/lib/utils5.js.map +1 -1
  140. package/package.json +115 -1
  141. package/scss/_visual-form.scss +357 -0
  142. package/lib/components/RadioButton/utils.d.ts +0 -2
  143. package/lib/components/VisualRadioButtonCloud/RadioButton/index.d.ts +0 -3
  144. package/lib/components/VisualRadioButtonCloud/RadioButton/index.js +0 -5
  145. package/lib/components/VisualRadioButtonCloud/RadioButton/index.js.map +0 -1
  146. package/lib/components/VisualRadioButtonCloud/RadioButton/styles.module.scss +0 -133
  147. package/lib/components/VisualRadioButtonCloud/RadioButton/styles.module.scss.d.ts +0 -15
  148. package/lib/components/VisualRadioButtonCloud/index.d.ts +0 -3
  149. package/lib/components/VisualRadioButtonCloud/index.js.map +0 -1
  150. package/lib/components/VisualRadioButtonCloud/styles.module.scss +0 -13
  151. package/lib/utils6.js +0 -60
  152. package/lib/utils6.js.map +0 -1
@@ -0,0 +1,43 @@
1
+ import { t as isComponent } from "../../component.js";
2
+ import { t as useIsMobileBreakpoint } from "../../useIsMobileBreakpoint.js";
3
+ import { t as useIdWithFallback } from "../../useIdWithFallback.js";
4
+ import { t as ErrorWrapper_default } from "../../ErrorWrapper.js";
5
+ import { t as VisualCheckbox_default } from "../../VisualCheckbox.js";
6
+ import classNames from "classnames";
7
+ import React from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import styles from "./styles.module.scss";
10
+ const VisualCheckboxGroup = (props) => {
11
+ const { children, name, variant = "rectangle", mobileLineVariantLimit, error, errorTextId: errorTextIdProp, renderError = true, errorMessageRef, className, errorWrapperClassName, testId, errorWrapperTestId } = props;
12
+ const errorTextId = useIdWithFallback(errorTextIdProp);
13
+ const isMobile = useIsMobileBreakpoint();
14
+ const visualCheckboxCount = React.Children.toArray(children).filter((child) => isComponent(child, VisualCheckbox_default)).length;
15
+ const effectiveVariant = isMobile && mobileLineVariantLimit !== void 0 && visualCheckboxCount > mobileLineVariantLimit ? "line" : variant;
16
+ const mapChild = (child) => {
17
+ if (isComponent(child, VisualCheckbox_default)) return React.cloneElement(child, {
18
+ name: child.props.name ?? name,
19
+ variant: child.props.variant ?? effectiveVariant,
20
+ error: !!error || child.props.error,
21
+ errorTextId: child.props.errorTextId ?? errorTextId
22
+ });
23
+ return child;
24
+ };
25
+ return /* @__PURE__ */ jsx(ErrorWrapper_default, {
26
+ className: classNames(errorWrapperClassName, className),
27
+ errorText: error,
28
+ errorTextId,
29
+ renderError,
30
+ errorMessageRef,
31
+ testId: errorWrapperTestId,
32
+ children: /* @__PURE__ */ jsx("div", {
33
+ className: classNames(styles["visual-checkbox-group"], { [styles["visual-checkbox-group--variant-line"]]: effectiveVariant === "line" }),
34
+ "data-testid": testId,
35
+ children: React.Children.map(children, mapChild)
36
+ })
37
+ });
38
+ };
39
+ VisualCheckboxGroup.VisualCheckbox = VisualCheckbox_default;
40
+ var VisualCheckboxGroup_default = VisualCheckboxGroup;
41
+ export { VisualCheckboxGroup, VisualCheckboxGroup_default as default };
42
+
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["VisualCheckboxGroup: VisualCheckboxGroupComponent","effectiveVariant: VisualCheckboxVariant | undefined"],"sources":["../../../src/components/VisualCheckboxGroup/VisualCheckboxGroup.tsx","../../../src/components/VisualCheckboxGroup/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { VisualCheckboxProps, VisualCheckboxVariant } from './VisualCheckbox/VisualCheckbox';\n\nimport VisualCheckbox from './VisualCheckbox/VisualCheckbox';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { isComponent } from '../../utils/component';\nimport ErrorWrapper from '../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualCheckboxGroupProps {\n /** Items in the group. Should be VisualCheckboxGroup.VisualCheckbox elements. */\n children?: React.ReactNode;\n /** Name shared by all child VisualCheckbox elements (overridable per child) */\n name?: string;\n /** Variant applied to all child VisualCheckbox elements (overridable per child). */\n variant?: VisualCheckboxVariant;\n /** When set and the number of VisualCheckbox children exceeds this limit on the mobile breakpoint, the variant is forced to `line`. */\n mobileLineVariantLimit?: number;\n /** Error message shown above the group */\n error?: string;\n /** Error text id (auto-generated if omitted) */\n errorTextId?: string;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n /** Ref passed to the error message element */\n errorMessageRef?: React.Ref<HTMLDivElement | null>;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Adds custom classes to the errorWrapper */\n errorWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the data-testid attribute for the error wrapper */\n errorWrapperTestId?: string;\n}\n\ninterface VisualCheckboxGroupComponent extends React.FC<VisualCheckboxGroupProps> {\n VisualCheckbox: typeof VisualCheckbox;\n}\n\nexport const VisualCheckboxGroup: VisualCheckboxGroupComponent = props => {\n const {\n children,\n name,\n variant = 'rectangle',\n mobileLineVariantLimit,\n error,\n errorTextId: errorTextIdProp,\n renderError = true,\n errorMessageRef,\n className,\n errorWrapperClassName,\n testId,\n errorWrapperTestId,\n } = props;\n\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const isMobile = useIsMobileBreakpoint();\n\n const visualCheckboxCount = React.Children.toArray(children).filter(child =>\n isComponent<VisualCheckboxProps>(child, VisualCheckbox)\n ).length;\n\n const effectiveVariant: VisualCheckboxVariant | undefined =\n isMobile && mobileLineVariantLimit !== undefined && visualCheckboxCount > mobileLineVariantLimit ? 'line' : variant;\n\n const mapChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<VisualCheckboxProps>(child, VisualCheckbox)) {\n return React.cloneElement(child, {\n name: child.props.name ?? name,\n variant: child.props.variant ?? effectiveVariant,\n error: !!error || child.props.error,\n errorTextId: child.props.errorTextId ?? errorTextId,\n });\n }\n return child;\n };\n\n return (\n <ErrorWrapper\n className={classNames(errorWrapperClassName, className)}\n errorText={error}\n errorTextId={errorTextId}\n renderError={renderError}\n errorMessageRef={errorMessageRef}\n testId={errorWrapperTestId}\n >\n <div\n className={classNames(styles['visual-checkbox-group'], {\n [styles['visual-checkbox-group--variant-line']]: effectiveVariant === 'line',\n })}\n data-testid={testId}\n >\n {React.Children.map(children, mapChild)}\n </div>\n </ErrorWrapper>\n );\n};\n\nVisualCheckboxGroup.VisualCheckbox = VisualCheckbox;\n\nexport default VisualCheckboxGroup;\n","import VisualCheckboxGroup from './VisualCheckboxGroup';\nexport * from './VisualCheckboxGroup';\nexport default VisualCheckboxGroup;\n"],"mappings":";;;;;;;;;AA6CA,MAAaA,uBAAoD,UAAS;CACxE,MAAM,EACJ,UACA,MACA,UAAU,aACV,wBACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,gBAAgB;CACtD,MAAM,WAAW,uBAAuB;CAExC,MAAM,sBAAsB,MAAM,SAAS,QAAQ,SAAS,CAAC,QAAO,UAClE,YAAiC,OAAO,uBAAe,CACxD,CAAC;CAEF,MAAMC,mBACJ,YAAY,2BAA2B,KAAA,KAAa,sBAAsB,yBAAyB,SAAS;CAE9G,MAAM,YAAY,UAA4C;AAC5D,MAAI,YAAiC,OAAO,uBAAe,CACzD,QAAO,MAAM,aAAa,OAAO;GAC/B,MAAM,MAAM,MAAM,QAAQ;GAC1B,SAAS,MAAM,MAAM,WAAW;GAChC,OAAO,CAAC,CAAC,SAAS,MAAM,MAAM;GAC9B,aAAa,MAAM,MAAM,eAAe;GACzC,CAAC;AAEJ,SAAO;;AAGT,QACE,oBAAC,sBAAA;EACC,WAAW,WAAW,uBAAuB,UAAU;EACvD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;YAER,oBAAC,OAAA;GACC,WAAW,WAAW,OAAO,0BAA0B,GACpD,OAAO,yCAAyC,qBAAqB,QACvE,CAAC;GACF,eAAa;aAEZ,MAAM,SAAS,IAAI,UAAU,SAAS;IACnC;GACO;;AAInB,oBAAoB,iBAAiB;ACtGrC,IAAA,8BDwGe"}
@@ -0,0 +1,6 @@
1
+ @use '../../scss/visual-form' as visual-form;
2
+ @import '../../scss/supernova/styles/spacers.css';
3
+
4
+ .visual-checkbox-group {
5
+ @include visual-form.visual-form-group;
6
+ }
@@ -0,0 +1,10 @@
1
+ export type Styles = {
2
+ 'visual-checkbox-group': string;
3
+ 'visual-checkbox-group--variant-line': string;
4
+ };
5
+
6
+ export type ClassNames = keyof Styles;
7
+
8
+ declare const styles: Styles;
9
+
10
+ export default styles;
@@ -1,5 +1,5 @@
1
1
  import { ErrorWrapperClassNameProps } from '../../ErrorWrapper';
2
- export interface RadioButtonProps extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size' | 'value'> {
2
+ export interface RadioProps extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size' | 'value'> {
3
3
  /** Adds custom classes to the root element. */
4
4
  className?: string;
5
5
  /** Label text shown inside the pill. */
@@ -19,5 +19,5 @@ export interface RadioButtonProps extends ErrorWrapperClassNameProps, Omit<React
19
19
  /** Ref forwarded to the underlying input element. */
20
20
  ref?: React.Ref<HTMLInputElement | null>;
21
21
  }
22
- declare const RadioButton: React.FC<RadioButtonProps>;
23
- export default RadioButton;
22
+ declare const Radio: React.FC<RadioProps>;
23
+ export default Radio;
@@ -0,0 +1,3 @@
1
+ import { default as Radio } from './Radio';
2
+ export * from './Radio';
3
+ export default Radio;
@@ -0,0 +1,5 @@
1
+ import { t as Radio_default$1 } from "../../../Radio.js";
2
+ var Radio_default = Radio_default$1;
3
+ export { Radio_default as default };
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/VisualRadioCloud/Radio/index.ts"],"sourcesContent":["import Radio from './Radio';\nexport * from './Radio';\nexport default Radio;\n"],"mappings":";AAEA,IAAA,gBAAe"}
@@ -0,0 +1,7 @@
1
+ @use '../../../scss/visual-form' as visual-form;
2
+ @import '../../../scss/supernova/styles/colors.css';
3
+ @import '../../../scss/supernova/styles/spacers.css';
4
+
5
+ .visual-radio {
6
+ @include visual-form.visual-form-pill;
7
+ }
@@ -0,0 +1,15 @@
1
+ export type Styles = {
2
+ 'visual-radio': string;
3
+ 'visual-radio__icon': string;
4
+ 'visual-radio__input': string;
5
+ 'visual-radio__label': string;
6
+ 'visual-radio__pill': string;
7
+ 'visual-radio--checked': string;
8
+ 'visual-radio--invalid': string;
9
+ };
10
+
11
+ export type ClassNames = keyof Styles;
12
+
13
+ declare const styles: Styles;
14
+
15
+ export default styles;
@@ -1,9 +1,9 @@
1
1
  import { default as React } from 'react';
2
- import { default as RadioButton } from './RadioButton/RadioButton';
3
- export interface VisualRadioButtonCloudProps {
4
- /** Items in the cloud. Should be VisualRadioButtonCloud.RadioButton elements. */
2
+ import { default as Radio } from './Radio/Radio';
3
+ export interface VisualRadioCloudProps {
4
+ /** Items in the cloud. Should be VisualRadioCloud.Radio elements. */
5
5
  children?: React.ReactNode;
6
- /** Name shared by all child RadioButton elements (overridable per child). Required for native form grouping. */
6
+ /** Name shared by all child Radio elements (overridable per child). Required for native form grouping. */
7
7
  name?: string;
8
8
  /** Selected value (controlled). */
9
9
  value?: string;
@@ -32,8 +32,8 @@ export interface VisualRadioButtonCloudProps {
32
32
  /** Id of element labelling the radiogroup (e.g. an external Title/legend). */
33
33
  'aria-labelledby'?: string;
34
34
  }
35
- interface VisualRadioButtonCloudComponent extends React.FC<VisualRadioButtonCloudProps> {
36
- RadioButton: typeof RadioButton;
35
+ interface VisualRadioCloudComponent extends React.FC<VisualRadioCloudProps> {
36
+ Radio: typeof Radio;
37
37
  }
38
- export declare const VisualRadioButtonCloud: VisualRadioButtonCloudComponent;
39
- export default VisualRadioButtonCloud;
38
+ export declare const VisualRadioCloud: VisualRadioCloudComponent;
39
+ export default VisualRadioCloud;
@@ -0,0 +1,3 @@
1
+ import { default as VisualRadioCloud } from './VisualRadioCloud';
2
+ export * from './VisualRadioCloud';
3
+ export default VisualRadioCloud;
@@ -1,12 +1,12 @@
1
1
  import { t as isComponent } from "../../component.js";
2
2
  import { t as useIdWithFallback } from "../../useIdWithFallback.js";
3
3
  import { t as ErrorWrapper_default } from "../../ErrorWrapper.js";
4
- import { t as RadioButton_default } from "../../RadioButton2.js";
4
+ import { t as Radio_default } from "../../Radio.js";
5
5
  import classNames from "classnames";
6
6
  import React, { useState } from "react";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
  import styles from "./styles.module.scss";
9
- const VisualRadioButtonCloud = (props) => {
9
+ const VisualRadioCloud = (props) => {
10
10
  const { children, name, value, defaultValue, onChange, error, errorTextId: errorTextIdProp, renderError = true, errorMessageRef, className, errorWrapperClassName, testId, errorWrapperTestId, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy } = props;
11
11
  const errorTextId = useIdWithFallback(errorTextIdProp);
12
12
  const [selectedValue, setSelectedValue] = useState(value ?? defaultValue);
@@ -16,7 +16,7 @@ const VisualRadioButtonCloud = (props) => {
16
16
  if (value !== void 0 && value !== selectedValue) setSelectedValue(value);
17
17
  }
18
18
  const mapChild = (child) => {
19
- if (isComponent(child, RadioButton_default)) {
19
+ if (isComponent(child, Radio_default)) {
20
20
  const isSelected = selectedValue !== void 0 && child.props.value === selectedValue;
21
21
  return React.cloneElement(child, {
22
22
  name: child.props.name ?? name,
@@ -45,14 +45,14 @@ const VisualRadioButtonCloud = (props) => {
45
45
  "aria-labelledby": ariaLabelledBy,
46
46
  "aria-invalid": error ? true : void 0,
47
47
  "aria-describedby": error ? errorTextId : void 0,
48
- className: styles["visual-radio-button-cloud"],
48
+ className: styles["visual-radio-cloud"],
49
49
  "data-testid": testId,
50
50
  children: React.Children.map(children, mapChild)
51
51
  })
52
52
  });
53
53
  };
54
- VisualRadioButtonCloud.RadioButton = RadioButton_default;
55
- var VisualRadioButtonCloud_default = VisualRadioButtonCloud;
56
- export { VisualRadioButtonCloud, VisualRadioButtonCloud_default as default };
54
+ VisualRadioCloud.Radio = Radio_default;
55
+ var VisualRadioCloud_default = VisualRadioCloud;
56
+ export { VisualRadioCloud, VisualRadioCloud_default as default };
57
57
 
58
58
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["VisualRadioCloud: VisualRadioCloudComponent"],"sources":["../../../src/components/VisualRadioCloud/VisualRadioCloud.tsx","../../../src/components/VisualRadioCloud/index.ts"],"sourcesContent":["import React, { useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { RadioProps } from './Radio/Radio';\n\nimport Radio from './Radio/Radio';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { isComponent } from '../../utils/component';\nimport ErrorWrapper from '../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualRadioCloudProps {\n /** Items in the cloud. Should be VisualRadioCloud.Radio elements. */\n children?: React.ReactNode;\n /** Name shared by all child Radio elements (overridable per child). Required for native form grouping. */\n name?: string;\n /** Selected value (controlled). */\n value?: string;\n /** Initial selected value (uncontrolled). */\n defaultValue?: string;\n /** Called when the selected value changes. */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n /** Error message shown above the cloud */\n error?: string;\n /** Error text id (auto-generated if omitted) */\n errorTextId?: string;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n /** Ref passed to the error message element */\n errorMessageRef?: React.Ref<HTMLDivElement | null>;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Adds custom classes to the errorWrapper */\n errorWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the data-testid attribute for the error wrapper */\n errorWrapperTestId?: string;\n /** Accessible label for the radiogroup. Use this or `aria-labelledby` when no external `<legend>` labels the group. */\n 'aria-label'?: string;\n /** Id of element labelling the radiogroup (e.g. an external Title/legend). */\n 'aria-labelledby'?: string;\n}\n\ninterface VisualRadioCloudComponent extends React.FC<VisualRadioCloudProps> {\n Radio: typeof Radio;\n}\n\nexport const VisualRadioCloud: VisualRadioCloudComponent = props => {\n const {\n children,\n name,\n value,\n defaultValue,\n onChange,\n error,\n errorTextId: errorTextIdProp,\n renderError = true,\n errorMessageRef,\n className,\n errorWrapperClassName,\n testId,\n errorWrapperTestId,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n } = props;\n\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const [selectedValue, setSelectedValue] = useState<string | undefined>(value ?? defaultValue);\n const [prevValue, setPrevValue] = useState<string | undefined>(value);\n if (prevValue !== value) {\n setPrevValue(value);\n if (value !== undefined && value !== selectedValue) {\n setSelectedValue(value);\n }\n }\n\n const mapChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<RadioProps>(child, Radio)) {\n const isSelected = selectedValue !== undefined && child.props.value === selectedValue;\n return React.cloneElement(child, {\n name: child.props.name ?? name,\n checked: isSelected,\n error: !!error || child.props.error,\n errorTextId: child.props.errorTextId ?? errorTextId,\n onChange: (e: React.ChangeEvent<HTMLInputElement>) => {\n setSelectedValue(child.props.value);\n child.props.onChange?.(e);\n onChange?.(e, child.props.value);\n },\n });\n }\n return child;\n };\n\n return (\n <ErrorWrapper\n className={classNames(errorWrapperClassName, className)}\n errorText={error}\n errorTextId={errorTextId}\n renderError={renderError}\n errorMessageRef={errorMessageRef}\n testId={errorWrapperTestId}\n >\n <div\n role=\"radiogroup\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? errorTextId : undefined}\n className={styles['visual-radio-cloud']}\n data-testid={testId}\n >\n {React.Children.map(children, mapChild)}\n </div>\n </ErrorWrapper>\n );\n};\n\nVisualRadioCloud.Radio = Radio;\n\nexport default VisualRadioCloud;\n","import VisualRadioCloud from './VisualRadioCloud';\nexport * from './VisualRadioCloud';\nexport default VisualRadioCloud;\n"],"mappings":";;;;;;;;AAkDA,MAAaA,oBAA8C,UAAS;CAClE,MAAM,EACJ,UACA,MACA,OACA,cACA,UACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,oBACA,cAAc,WACd,mBAAmB,mBACjB;CAEJ,MAAM,cAAc,kBAAkB,gBAAgB;CACtD,MAAM,CAAC,eAAe,oBAAoB,SAA6B,SAAS,aAAa;CAC7F,MAAM,CAAC,WAAW,gBAAgB,SAA6B,MAAM;AACrE,KAAI,cAAc,OAAO;AACvB,eAAa,MAAM;AACnB,MAAI,UAAU,KAAA,KAAa,UAAU,cACnC,kBAAiB,MAAM;;CAI3B,MAAM,YAAY,UAA4C;AAC5D,MAAI,YAAwB,OAAO,cAAM,EAAE;GACzC,MAAM,aAAa,kBAAkB,KAAA,KAAa,MAAM,MAAM,UAAU;AACxE,UAAO,MAAM,aAAa,OAAO;IAC/B,MAAM,MAAM,MAAM,QAAQ;IAC1B,SAAS;IACT,OAAO,CAAC,CAAC,SAAS,MAAM,MAAM;IAC9B,aAAa,MAAM,MAAM,eAAe;IACxC,WAAW,MAA2C;AACpD,sBAAiB,MAAM,MAAM,MAAM;AACnC,WAAM,MAAM,WAAW,EAAE;AACzB,gBAAW,GAAG,MAAM,MAAM,MAAM;;IAEnC,CAAC;;AAEJ,SAAO;;AAGT,QACE,oBAAC,sBAAA;EACC,WAAW,WAAW,uBAAuB,UAAU;EACvD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;YAER,oBAAC,OAAA;GACC,MAAK;GACL,cAAY;GACZ,mBAAiB;GACjB,gBAAc,QAAQ,OAAO,KAAA;GAC7B,oBAAkB,QAAQ,cAAc,KAAA;GACxC,WAAW,OAAO;GAClB,eAAa;aAEZ,MAAM,SAAS,IAAI,UAAU,SAAS;IACnC;GACO;;AAInB,iBAAiB,QAAQ;ACvHzB,IAAA,2BDyHe"}
@@ -0,0 +1,6 @@
1
+ @use '../../scss/visual-form' as visual-form;
2
+ @import '../../scss/supernova/styles/spacers.css';
3
+
4
+ .visual-radio-cloud {
5
+ @include visual-form.visual-form-cloud;
6
+ }
@@ -1,5 +1,5 @@
1
1
  export type Styles = {
2
- 'visual-radio-button-cloud': string;
2
+ 'visual-radio-cloud': string;
3
3
  };
4
4
 
5
5
  export type ClassNames = keyof Styles;
@@ -0,0 +1,10 @@
1
+ export interface VisualContentProps {
2
+ /** Content rendered inside the circular area – typically an <img> or illustration component. */
3
+ children: React.ReactNode;
4
+ /** Adds custom classes to the root element. */
5
+ className?: string;
6
+ /** Sets the data-testid attribute. */
7
+ testId?: string;
8
+ }
9
+ export declare const VisualContent: React.FC<VisualContentProps>;
10
+ export default VisualContent;
@@ -0,0 +1,26 @@
1
+ import { ErrorWrapperClassNameProps } from '../../ErrorWrapper';
2
+ export type VisualRadioVariant = 'line' | 'rectangle';
3
+ export interface VisualRadioProps extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size'> {
4
+ /** Adds custom classes to the root element. */
5
+ className?: string;
6
+ /** Label rendered inside the radio frame. */
7
+ children: string;
8
+ /** Content rendered inside the circular visual slot. */
9
+ visualContent?: React.ReactNode;
10
+ /** Layout variant. `line` is a thin horizontal pill, `rectangle` is a vertical card. */
11
+ variant?: VisualRadioVariant;
12
+ /** input id of the underlying radio */
13
+ inputId?: string;
14
+ /** Activates error styling. Can be true while errorText is empty (e.g. when used in a FormGroup). */
15
+ error?: boolean;
16
+ /** Error text to show above the component. */
17
+ errorText?: string;
18
+ /** Error text id */
19
+ errorTextId?: string;
20
+ /** Sets the data-testid attribute. */
21
+ testId?: string;
22
+ /** Ref forwarded to the underlying input element. */
23
+ ref?: React.Ref<HTMLInputElement | null>;
24
+ }
25
+ declare const VisualRadio: React.FC<VisualRadioProps>;
26
+ export default VisualRadio;
@@ -0,0 +1,3 @@
1
+ import { default as VisualRadio } from './VisualRadio';
2
+ export * from './VisualRadio';
3
+ export default VisualRadio;
@@ -0,0 +1,5 @@
1
+ import { t as VisualRadio_default$1 } from "../../../VisualRadio.js";
2
+ var VisualRadio_default = VisualRadio_default$1;
3
+ export { VisualRadio_default as default };
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/VisualRadioGroup/VisualRadio/index.ts"],"sourcesContent":["import VisualRadio from './VisualRadio';\nexport * from './VisualRadio';\nexport default VisualRadio;\n"],"mappings":";AAEA,IAAA,sBAAe"}
@@ -0,0 +1,7 @@
1
+ @use '../../../scss/visual-form' as visual-form;
2
+ @import '../../../scss/supernova/styles/colors.css';
3
+ @import '../../../scss/supernova/styles/spacers.css';
4
+
5
+ .visual-radio {
6
+ @include visual-form.visual-form-card;
7
+ }
@@ -0,0 +1,18 @@
1
+ export type Styles = {
2
+ 'visual-radio': string;
3
+ 'visual-radio__frame': string;
4
+ 'visual-radio__icon': string;
5
+ 'visual-radio__input': string;
6
+ 'visual-radio__label': string;
7
+ 'visual-radio__visual-content': string;
8
+ 'visual-radio--checked': string;
9
+ 'visual-radio--invalid': string;
10
+ 'visual-radio--variant-line': string;
11
+ 'visual-radio--variant-rectangle': string;
12
+ };
13
+
14
+ export type ClassNames = keyof Styles;
15
+
16
+ declare const styles: Styles;
17
+
18
+ export default styles;
@@ -0,0 +1,39 @@
1
+ import { default as React } from 'react';
2
+ import { VisualRadioVariant, default as VisualRadio } from './VisualRadio/VisualRadio';
3
+ export interface VisualRadioGroupProps {
4
+ /** Items in the group. Should be VisualRadioGroup.VisualRadio elements. */
5
+ children?: React.ReactNode;
6
+ /** Name shared by all child VisualRadio elements (overridable per child). Auto-generated if omitted. */
7
+ name?: string;
8
+ /** Selected value (controlled). */
9
+ value?: string;
10
+ /** Initial selected value (uncontrolled). */
11
+ defaultValue?: string;
12
+ /** Called when the selected value changes. */
13
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
14
+ /** Variant applied to all child VisualRadio elements (overridable per child). */
15
+ variant?: VisualRadioVariant;
16
+ /** When set and the number of VisualRadio children exceeds this limit on the mobile breakpoint, the variant is forced to `line`. */
17
+ mobileLineVariantLimit?: number;
18
+ /** Error message shown above the group */
19
+ error?: string;
20
+ /** Error text id (auto-generated if omitted) */
21
+ errorTextId?: string;
22
+ /** Renders the error component (Default: true) */
23
+ renderError?: boolean;
24
+ /** Ref passed to the error message element */
25
+ errorMessageRef?: React.Ref<HTMLDivElement | null>;
26
+ /** Adds custom classes to the root element. */
27
+ className?: string;
28
+ /** Adds custom classes to the errorWrapper */
29
+ errorWrapperClassName?: string;
30
+ /** Sets the data-testid attribute. */
31
+ testId?: string;
32
+ /** Sets the data-testid attribute for the error wrapper */
33
+ errorWrapperTestId?: string;
34
+ }
35
+ interface VisualRadioGroupComponent extends React.FC<VisualRadioGroupProps> {
36
+ VisualRadio: typeof VisualRadio;
37
+ }
38
+ export declare const VisualRadioGroup: VisualRadioGroupComponent;
39
+ export default VisualRadioGroup;
@@ -0,0 +1,3 @@
1
+ import { default as VisualRadioGroup } from './VisualRadioGroup';
2
+ export * from './VisualRadioGroup';
3
+ export default VisualRadioGroup;
@@ -0,0 +1,63 @@
1
+ import { t as isComponent } from "../../component.js";
2
+ import { t as useIsMobileBreakpoint } from "../../useIsMobileBreakpoint.js";
3
+ import { t as useIdWithFallback } from "../../useIdWithFallback.js";
4
+ import { t as ErrorWrapper_default } from "../../ErrorWrapper.js";
5
+ import { t as VisualRadio_default } from "../../VisualRadio.js";
6
+ import classNames from "classnames";
7
+ import React from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import styles from "./styles.module.scss";
10
+ const VisualRadioGroup = (props) => {
11
+ const { children, name: nameProp, value, defaultValue, onChange, variant = "rectangle", mobileLineVariantLimit, error, errorTextId: errorTextIdProp, renderError = true, errorMessageRef, className, errorWrapperClassName, testId, errorWrapperTestId } = props;
12
+ const errorTextId = useIdWithFallback(errorTextIdProp);
13
+ const name = useIdWithFallback(nameProp);
14
+ const isMobile = useIsMobileBreakpoint();
15
+ const radioChildren = React.Children.toArray(children).filter((child) => isComponent(child, VisualRadio_default));
16
+ const initialSelected = value ?? defaultValue ?? radioChildren.find((child) => child.props.defaultChecked || child.props.checked)?.props.value?.toString();
17
+ const [selectedValue, setSelectedValue] = React.useState(initialSelected);
18
+ const [prevValue, setPrevValue] = React.useState(value);
19
+ if (prevValue !== value) {
20
+ setPrevValue(value);
21
+ if (value !== void 0 && value !== selectedValue) setSelectedValue(value);
22
+ }
23
+ const effectiveVariant = isMobile && mobileLineVariantLimit !== void 0 && radioChildren.length > mobileLineVariantLimit ? "line" : variant;
24
+ const mapChild = (child) => {
25
+ if (isComponent(child, VisualRadio_default)) {
26
+ const childValue = child.props.value?.toString();
27
+ const isSelected = selectedValue !== void 0 && childValue !== void 0 && childValue === selectedValue;
28
+ const childOnChange = child.props.onChange;
29
+ return React.cloneElement(child, {
30
+ name: child.props.name ?? name,
31
+ variant: child.props.variant ?? effectiveVariant,
32
+ error: !!error || child.props.error,
33
+ errorTextId: child.props.errorTextId ?? errorTextId,
34
+ checked: isSelected,
35
+ onChange: (e) => {
36
+ if (childValue !== void 0) setSelectedValue(childValue);
37
+ childOnChange?.(e);
38
+ if (childValue !== void 0) onChange?.(e, childValue);
39
+ }
40
+ });
41
+ }
42
+ return child;
43
+ };
44
+ return /* @__PURE__ */ jsx(ErrorWrapper_default, {
45
+ className: classNames(errorWrapperClassName, className),
46
+ errorText: error,
47
+ errorTextId,
48
+ renderError,
49
+ errorMessageRef,
50
+ testId: errorWrapperTestId,
51
+ children: /* @__PURE__ */ jsx("div", {
52
+ className: classNames(styles["visual-radio-group"], { [styles["visual-radio-group--variant-line"]]: effectiveVariant === "line" }),
53
+ "data-testid": testId,
54
+ role: "radiogroup",
55
+ children: React.Children.map(children, mapChild)
56
+ })
57
+ });
58
+ };
59
+ VisualRadioGroup.VisualRadio = VisualRadio_default;
60
+ var VisualRadioGroup_default = VisualRadioGroup;
61
+ export { VisualRadioGroup, VisualRadioGroup_default as default };
62
+
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["VisualRadioGroup: VisualRadioGroupComponent","effectiveVariant: VisualRadioVariant | undefined"],"sources":["../../../src/components/VisualRadioGroup/VisualRadioGroup.tsx","../../../src/components/VisualRadioGroup/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { VisualRadioProps, VisualRadioVariant } from './VisualRadio/VisualRadio';\n\nimport VisualRadio from './VisualRadio/VisualRadio';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';\nimport { isComponent } from '../../utils/component';\nimport ErrorWrapper from '../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualRadioGroupProps {\n /** Items in the group. Should be VisualRadioGroup.VisualRadio elements. */\n children?: React.ReactNode;\n /** Name shared by all child VisualRadio elements (overridable per child). Auto-generated if omitted. */\n name?: string;\n /** Selected value (controlled). */\n value?: string;\n /** Initial selected value (uncontrolled). */\n defaultValue?: string;\n /** Called when the selected value changes. */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;\n /** Variant applied to all child VisualRadio elements (overridable per child). */\n variant?: VisualRadioVariant;\n /** When set and the number of VisualRadio children exceeds this limit on the mobile breakpoint, the variant is forced to `line`. */\n mobileLineVariantLimit?: number;\n /** Error message shown above the group */\n error?: string;\n /** Error text id (auto-generated if omitted) */\n errorTextId?: string;\n /** Renders the error component (Default: true) */\n renderError?: boolean;\n /** Ref passed to the error message element */\n errorMessageRef?: React.Ref<HTMLDivElement | null>;\n /** Adds custom classes to the root element. */\n className?: string;\n /** Adds custom classes to the errorWrapper */\n errorWrapperClassName?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the data-testid attribute for the error wrapper */\n errorWrapperTestId?: string;\n}\n\ninterface VisualRadioGroupComponent extends React.FC<VisualRadioGroupProps> {\n VisualRadio: typeof VisualRadio;\n}\n\nexport const VisualRadioGroup: VisualRadioGroupComponent = props => {\n const {\n children,\n name: nameProp,\n value,\n defaultValue,\n onChange,\n variant = 'rectangle',\n mobileLineVariantLimit,\n error,\n errorTextId: errorTextIdProp,\n renderError = true,\n errorMessageRef,\n className,\n errorWrapperClassName,\n testId,\n errorWrapperTestId,\n } = props;\n\n const errorTextId = useIdWithFallback(errorTextIdProp);\n const name = useIdWithFallback(nameProp);\n const isMobile = useIsMobileBreakpoint();\n\n const childArray = React.Children.toArray(children);\n const radioChildren = childArray.filter((child): child is React.ReactElement<VisualRadioProps> =>\n isComponent<VisualRadioProps>(child, VisualRadio)\n );\n\n const initialSelected =\n value ?? defaultValue ?? radioChildren.find(child => child.props.defaultChecked || child.props.checked)?.props.value?.toString();\n\n const [selectedValue, setSelectedValue] = React.useState<string | undefined>(initialSelected);\n const [prevValue, setPrevValue] = React.useState<string | undefined>(value);\n if (prevValue !== value) {\n setPrevValue(value);\n if (value !== undefined && value !== selectedValue) {\n setSelectedValue(value);\n }\n }\n\n const effectiveVariant: VisualRadioVariant | undefined =\n isMobile && mobileLineVariantLimit !== undefined && radioChildren.length > mobileLineVariantLimit ? 'line' : variant;\n\n const mapChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<VisualRadioProps>(child, VisualRadio)) {\n const childValue = child.props.value?.toString();\n const isSelected = selectedValue !== undefined && childValue !== undefined && childValue === selectedValue;\n const childOnChange = child.props.onChange;\n\n return React.cloneElement(child, {\n name: child.props.name ?? name,\n variant: child.props.variant ?? effectiveVariant,\n error: !!error || child.props.error,\n errorTextId: child.props.errorTextId ?? errorTextId,\n checked: isSelected,\n onChange: (e: React.ChangeEvent<HTMLInputElement>): void => {\n if (childValue !== undefined) {\n setSelectedValue(childValue);\n }\n childOnChange?.(e);\n if (childValue !== undefined) {\n onChange?.(e, childValue);\n }\n },\n });\n }\n return child;\n };\n\n return (\n <ErrorWrapper\n className={classNames(errorWrapperClassName, className)}\n errorText={error}\n errorTextId={errorTextId}\n renderError={renderError}\n errorMessageRef={errorMessageRef}\n testId={errorWrapperTestId}\n >\n <div\n className={classNames(styles['visual-radio-group'], {\n [styles['visual-radio-group--variant-line']]: effectiveVariant === 'line',\n })}\n data-testid={testId}\n role={'radiogroup'}\n >\n {React.Children.map(children, mapChild)}\n </div>\n </ErrorWrapper>\n );\n};\n\nVisualRadioGroup.VisualRadio = VisualRadio;\n\nexport default VisualRadioGroup;\n","import VisualRadioGroup from './VisualRadioGroup';\nexport * from './VisualRadioGroup';\nexport default VisualRadioGroup;\n"],"mappings":";;;;;;;;;AAmDA,MAAaA,oBAA8C,UAAS;CAClE,MAAM,EACJ,UACA,MAAM,UACN,OACA,cACA,UACA,UAAU,aACV,wBACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,gBAAgB;CACtD,MAAM,OAAO,kBAAkB,SAAS;CACxC,MAAM,WAAW,uBAAuB;CAGxC,MAAM,gBADa,MAAM,SAAS,QAAQ,SAAS,CAClB,QAAQ,UACvC,YAA8B,OAAO,oBAAY,CAClD;CAED,MAAM,kBACJ,SAAS,gBAAgB,cAAc,MAAK,UAAS,MAAM,MAAM,kBAAkB,MAAM,MAAM,QAAQ,EAAE,MAAM,OAAO,UAAU;CAElI,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAA6B,gBAAgB;CAC7F,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAA6B,MAAM;AAC3E,KAAI,cAAc,OAAO;AACvB,eAAa,MAAM;AACnB,MAAI,UAAU,KAAA,KAAa,UAAU,cACnC,kBAAiB,MAAM;;CAI3B,MAAMC,mBACJ,YAAY,2BAA2B,KAAA,KAAa,cAAc,SAAS,yBAAyB,SAAS;CAE/G,MAAM,YAAY,UAA4C;AAC5D,MAAI,YAA8B,OAAO,oBAAY,EAAE;GACrD,MAAM,aAAa,MAAM,MAAM,OAAO,UAAU;GAChD,MAAM,aAAa,kBAAkB,KAAA,KAAa,eAAe,KAAA,KAAa,eAAe;GAC7F,MAAM,gBAAgB,MAAM,MAAM;AAElC,UAAO,MAAM,aAAa,OAAO;IAC/B,MAAM,MAAM,MAAM,QAAQ;IAC1B,SAAS,MAAM,MAAM,WAAW;IAChC,OAAO,CAAC,CAAC,SAAS,MAAM,MAAM;IAC9B,aAAa,MAAM,MAAM,eAAe;IACxC,SAAS;IACT,WAAW,MAAiD;AAC1D,SAAI,eAAe,KAAA,EACjB,kBAAiB,WAAW;AAE9B,qBAAgB,EAAE;AAClB,SAAI,eAAe,KAAA,EACjB,YAAW,GAAG,WAAW;;IAG9B,CAAC;;AAEJ,SAAO;;AAGT,QACE,oBAAC,sBAAA;EACC,WAAW,WAAW,uBAAuB,UAAU;EACvD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;YAER,oBAAC,OAAA;GACC,WAAW,WAAW,OAAO,uBAAuB,GACjD,OAAO,sCAAsC,qBAAqB,QACpE,CAAC;GACF,eAAa;GACb,MAAM;aAEL,MAAM,SAAS,IAAI,UAAU,SAAS;IACnC;GACO;;AAInB,iBAAiB,cAAc;AC5I/B,IAAA,2BD8Ie"}
@@ -0,0 +1,6 @@
1
+ @use '../../scss/visual-form' as visual-form;
2
+ @import '../../scss/supernova/styles/spacers.css';
3
+
4
+ .visual-radio-group {
5
+ @include visual-form.visual-form-group;
6
+ }
@@ -0,0 +1,10 @@
1
+ export type Styles = {
2
+ 'visual-radio-group': string;
3
+ 'visual-radio-group--variant-line': string;
4
+ };
5
+
6
+ export type ClassNames = keyof Styles;
7
+
8
+ declare const styles: Styles;
9
+
10
+ export default styles;
@@ -1,23 +1,27 @@
1
1
  import { s as LanguageLocales } from "./constants2.js";
2
2
  var HN_Designsystem_Filter_en_GB_default = {
3
- filterButtonText: "Find...",
3
+ filterButtonText: "Find ...",
4
4
  sortLabel: "Sorting",
5
5
  resetButtonText: "Reset",
6
6
  showButtonText: "Show {0} results",
7
- filterOverviewTitle: "Find...",
7
+ filterOverviewTitle: "Find ...",
8
8
  searchPlaceholder: "Search the list",
9
9
  searchClearButtonAriaLabel: "Reset",
10
- searchButtonAriaLabel: "Search"
10
+ searchButtonAriaLabel: "Search",
11
+ loadingText: "Loading results",
12
+ resultsText: "{0} results"
11
13
  };
12
14
  var HN_Designsystem_Filter_nb_NO_default = {
13
- filterButtonText: "Finn...",
15
+ filterButtonText: "Finn ...",
14
16
  sortLabel: "Sortering",
15
17
  resetButtonText: "Nullstill",
16
18
  showButtonText: "Vis {0} treff",
17
- filterOverviewTitle: "Finn...",
19
+ filterOverviewTitle: "Finn ...",
18
20
  searchPlaceholder: "Søk i listen",
19
21
  searchClearButtonAriaLabel: "Nullstill",
20
- searchButtonAriaLabel: "Søk"
22
+ searchButtonAriaLabel: "Søk",
23
+ loadingText: "Henter treff",
24
+ resultsText: "{0} treff"
21
25
  };
22
26
  const getResources = (language) => {
23
27
  switch (language) {
@@ -1 +1 @@
1
- {"version":3,"file":"resourceHelper.js","names":[],"sources":["../src/resources/HN.Designsystem.Filter.en-GB.json","../src/resources/HN.Designsystem.Filter.nb-NO.json","../src/components/Filter/resourceHelper.ts"],"sourcesContent":["{\n \"filterButtonText\": \"Find...\",\n \"sortLabel\": \"Sorting\",\n \"resetButtonText\": \"Reset\",\n \"showButtonText\": \"Show {0} results\",\n \"filterOverviewTitle\": \"Find...\",\n \"searchPlaceholder\": \"Search the list\",\n \"searchClearButtonAriaLabel\": \"Reset\",\n \"searchButtonAriaLabel\": \"Search\"\n}\n","{\n \"filterButtonText\": \"Finn...\",\n \"sortLabel\": \"Sortering\",\n \"resetButtonText\": \"Nullstill\",\n \"showButtonText\": \"Vis {0} treff\",\n \"filterOverviewTitle\": \"Finn...\",\n \"searchPlaceholder\": \"Søk i listen\",\n \"searchClearButtonAriaLabel\": \"Nullstill\",\n \"searchButtonAriaLabel\": \"Søk\"\n}\n","import type { HNDesignsystemFilter } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Filter.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Filter.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFilter => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AEMA,MAAa,gBAAgB,aAAoD;AAC/E,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO"}
1
+ {"version":3,"file":"resourceHelper.js","names":[],"sources":["../src/resources/HN.Designsystem.Filter.en-GB.json","../src/resources/HN.Designsystem.Filter.nb-NO.json","../src/components/Filter/resourceHelper.ts"],"sourcesContent":["{\n \"filterButtonText\": \"Find ...\",\n \"sortLabel\": \"Sorting\",\n \"resetButtonText\": \"Reset\",\n \"showButtonText\": \"Show {0} results\",\n \"filterOverviewTitle\": \"Find ...\",\n \"searchPlaceholder\": \"Search the list\",\n \"searchClearButtonAriaLabel\": \"Reset\",\n \"searchButtonAriaLabel\": \"Search\",\n \"loadingText\": \"Loading results\",\n \"resultsText\": \"{0} results\"\n}\n","{\n \"filterButtonText\": \"Finn ...\",\n \"sortLabel\": \"Sortering\",\n \"resetButtonText\": \"Nullstill\",\n \"showButtonText\": \"Vis {0} treff\",\n \"filterOverviewTitle\": \"Finn ...\",\n \"searchPlaceholder\": \"Søk i listen\",\n \"searchClearButtonAriaLabel\": \"Nullstill\",\n \"searchButtonAriaLabel\": \"Søk\",\n \"loadingText\": \"Henter treff\",\n \"resultsText\": \"{0} treff\"\n}\n","import type { HNDesignsystemFilter } from '../../resources/Resources';\n\nimport { LanguageLocales } from '../../constants';\nimport enGB from '../../resources/HN.Designsystem.Filter.en-GB.json';\nimport nbNO from '../../resources/HN.Designsystem.Filter.nb-NO.json';\n\nexport const getResources = (language: LanguageLocales): HNDesignsystemFilter => {\n switch (language) {\n case LanguageLocales.ENGLISH:\n return enGB;\n case LanguageLocales.NORWEGIAN:\n default:\n return nbNO;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AEMA,MAAa,gBAAgB,aAAoD;AAC/E,SAAQ,UAAR;EACE,KAAK,gBAAgB,QACnB,QAAO;EACT,KAAK,gBAAgB;EACrB,QACE,QAAO"}
@@ -1,12 +1,14 @@
1
1
  declare const _default: {
2
- "filterButtonText": "Find...",
2
+ "filterButtonText": "Find ...",
3
3
  "sortLabel": "Sorting",
4
4
  "resetButtonText": "Reset",
5
5
  "showButtonText": "Show {0} results",
6
- "filterOverviewTitle": "Find...",
6
+ "filterOverviewTitle": "Find ...",
7
7
  "searchPlaceholder": "Search the list",
8
8
  "searchClearButtonAriaLabel": "Reset",
9
- "searchButtonAriaLabel": "Search"
9
+ "searchButtonAriaLabel": "Search",
10
+ "loadingText": "Loading results",
11
+ "resultsText": "{0} results"
10
12
  }
11
13
  ;
12
14
 
@@ -1,12 +1,14 @@
1
1
  declare const _default: {
2
- "filterButtonText": "Finn...",
2
+ "filterButtonText": "Finn ...",
3
3
  "sortLabel": "Sortering",
4
4
  "resetButtonText": "Nullstill",
5
5
  "showButtonText": "Vis {0} treff",
6
- "filterOverviewTitle": "Finn...",
6
+ "filterOverviewTitle": "Finn ...",
7
7
  "searchPlaceholder": "Søk i listen",
8
8
  "searchClearButtonAriaLabel": "Nullstill",
9
- "searchButtonAriaLabel": "Søk"
9
+ "searchButtonAriaLabel": "Søk",
10
+ "loadingText": "Henter treff",
11
+ "resultsText": "{0} treff"
10
12
  }
11
13
  ;
12
14
 
@@ -148,7 +148,7 @@ export type HNDesignsystemInput = {
148
148
 
149
149
  export type HNDesignsystemFilter = {
150
150
  /**
151
- * Finn...
151
+ * Finn ...
152
152
  */
153
153
  filterButtonText: string;
154
154
  /**
@@ -164,7 +164,7 @@ export type HNDesignsystemFilter = {
164
164
  */
165
165
  showButtonText: string;
166
166
  /**
167
- * Finn...
167
+ * Finn ...
168
168
  */
169
169
  filterOverviewTitle: string;
170
170
  /**
@@ -179,6 +179,14 @@ export type HNDesignsystemFilter = {
179
179
  * Søk
180
180
  */
181
181
  searchButtonAriaLabel: string;
182
+ /**
183
+ * Henter treff
184
+ */
185
+ loadingText: string;
186
+ /**
187
+ * {0} treff
188
+ */
189
+ resultsText: string;
182
190
  };
183
191
 
184
192
  export type HNDesignsystemChip = {