@helsenorge/designsystem-react 15.5.0 → 15.6.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.
Files changed (225) hide show
  1. package/lib/AnchorLink.js.map +1 -1
  2. package/lib/Avatar.js.map +1 -1
  3. package/lib/Button.js.map +1 -1
  4. package/lib/CHANGELOG.md +21 -0
  5. package/lib/Checkbox.js +5 -3
  6. package/lib/Checkbox.js.map +1 -1
  7. package/lib/Checkbox2.js.map +1 -1
  8. package/lib/CheckboxMarker.js.map +1 -1
  9. package/lib/Chip.js.map +1 -1
  10. package/lib/Close.js.map +1 -1
  11. package/lib/Drawer.js.map +1 -1
  12. package/lib/DrawerNavigation.js.map +1 -1
  13. package/lib/Duolist.js.map +1 -1
  14. package/lib/ElementHeader.js.map +1 -1
  15. package/lib/ElementHeaderText.js.map +1 -1
  16. package/lib/ErrorWrapper.js +2 -1
  17. package/lib/ErrorWrapper.js.map +1 -1
  18. package/lib/Expander.js +2 -1
  19. package/lib/Expander.js.map +1 -1
  20. package/lib/FilterButton.js.map +1 -1
  21. package/lib/FilterButtonAndChipsWrapper.js.map +1 -1
  22. package/lib/FilterDrawer.js.map +1 -1
  23. package/lib/FilterLinkList.js +2 -1
  24. package/lib/FilterLinkList.js.map +1 -1
  25. package/lib/FilterOverviewSearch.js.map +1 -1
  26. package/lib/FilterResultCountAndSortWrapper.js.map +1 -1
  27. package/lib/FilterSearch.js.map +1 -1
  28. package/lib/FormFieldTag.js.map +1 -1
  29. package/lib/FormGroup.js +9 -2
  30. package/lib/FormGroup.js.map +1 -1
  31. package/lib/FormLayout.js +9 -1
  32. package/lib/FormLayout.js.map +1 -1
  33. package/lib/HelpDetails.js.map +1 -1
  34. package/lib/HelpTriggerIcon.js.map +1 -1
  35. package/lib/HelpTriggerStandalone.js.map +1 -1
  36. package/lib/Highlighter.js.map +1 -1
  37. package/lib/HorizontalScroll.js.map +1 -1
  38. package/lib/Icon.js.map +1 -1
  39. package/lib/Illustration.js.map +1 -1
  40. package/lib/Input.js.map +1 -1
  41. package/lib/LazyIcon.js.map +1 -1
  42. package/lib/LazyIllustration.js.map +1 -1
  43. package/lib/LinkList.js +31 -28
  44. package/lib/LinkList.js.map +1 -1
  45. package/lib/List.js +4 -2
  46. package/lib/List.js.map +1 -1
  47. package/lib/ListEditMode.js +5 -4
  48. package/lib/ListEditMode.js.map +1 -1
  49. package/lib/LoaderSpinner.js.map +1 -1
  50. package/lib/MaxCharacters.js.map +1 -1
  51. package/lib/PanelTitle.js.map +1 -1
  52. package/lib/PopOver.js +5 -2
  53. package/lib/PopOver.js.map +1 -1
  54. package/lib/Radio.js.map +1 -1
  55. package/lib/RadioButton.js.map +1 -1
  56. package/lib/RadioMarker.js +11 -10
  57. package/lib/RadioMarker.js.map +1 -1
  58. package/lib/Select.js.map +1 -1
  59. package/lib/SingleSelectItem.js.map +1 -1
  60. package/lib/Slider.js +0 -2
  61. package/lib/Slider.js.map +1 -1
  62. package/lib/Spacer.js +16 -15
  63. package/lib/Spacer.js.map +1 -1
  64. package/lib/StatusDot.js.map +1 -1
  65. package/lib/StatusDotList.js.map +1 -1
  66. package/lib/StepButtons.js.map +1 -1
  67. package/lib/TabList.js.map +1 -1
  68. package/lib/TabPanel.js +2 -1
  69. package/lib/TabPanel.js.map +1 -1
  70. package/lib/TableBody.js +2 -1
  71. package/lib/TableBody.js.map +1 -1
  72. package/lib/TableCell.js +2 -1
  73. package/lib/TableCell.js.map +1 -1
  74. package/lib/TableExpandedRow.js +6 -3
  75. package/lib/TableExpandedRow.js.map +1 -1
  76. package/lib/TableExpanderCell.js +2 -1
  77. package/lib/TableExpanderCell.js.map +1 -1
  78. package/lib/TableHead.js +7 -6
  79. package/lib/TableHead.js.map +1 -1
  80. package/lib/TableHeadCell.js.map +1 -1
  81. package/lib/TableRow.js +7 -5
  82. package/lib/TableRow.js.map +1 -1
  83. package/lib/Textarea.js.map +1 -1
  84. package/lib/Title.js +20 -17
  85. package/lib/Title.js.map +1 -1
  86. package/lib/Toast.js.map +1 -1
  87. package/lib/Toggle.js +176 -0
  88. package/lib/Toggle.js.map +1 -0
  89. package/lib/VisualCheckbox.js.map +1 -1
  90. package/lib/VisualRadio.js.map +1 -1
  91. package/lib/components/ArticleTeaser/index.js.map +1 -1
  92. package/lib/components/Close/styles.module.scss +2 -2
  93. package/lib/components/Dropdown/index.js.map +1 -1
  94. package/lib/components/DropdownOld/index.js.map +1 -1
  95. package/lib/components/EmptyState/index.js +1 -3
  96. package/lib/components/EmptyState/index.js.map +1 -1
  97. package/lib/components/ExpanderHierarchy/index.js +2 -1
  98. package/lib/components/ExpanderHierarchy/index.js.map +1 -1
  99. package/lib/components/ExpanderList/index.js +7 -6
  100. package/lib/components/ExpanderList/index.js.map +1 -1
  101. package/lib/components/EyebrowHeader/index.js.map +1 -1
  102. package/lib/components/FavoriteButton/index.js +9 -7
  103. package/lib/components/FavoriteButton/index.js.map +1 -1
  104. package/lib/components/FormGroup/styles.module.scss +15 -3
  105. package/lib/components/FormGroup/styles.module.scss.d.ts +2 -0
  106. package/lib/components/FormLayout/styles.module.scss +9 -1
  107. package/lib/components/FormLayout/styles.module.scss.d.ts +2 -0
  108. package/lib/components/HelpBubble/index.js.map +1 -1
  109. package/lib/components/HelpExpanderInline/index.js.map +1 -1
  110. package/lib/components/HelpExpanderStandalone/index.js.map +1 -1
  111. package/lib/components/HelpPanel/HelpPanel.d.ts +2 -2
  112. package/lib/components/HelpPanel/index.js +49 -9
  113. package/lib/components/HelpPanel/index.js.map +1 -1
  114. package/lib/components/HelpPanel/styles.module.scss +66 -2
  115. package/lib/components/HelpPanel/styles.module.scss.d.ts +8 -0
  116. package/lib/components/HelpTeaser/HelpTeaser.d.ts +5 -2
  117. package/lib/components/HelpTeaser/index.js +59 -14
  118. package/lib/components/HelpTeaser/index.js.map +1 -1
  119. package/lib/components/HelpTeaser/styles.module.scss +105 -2
  120. package/lib/components/HelpTeaser/styles.module.scss.d.ts +6 -0
  121. package/lib/components/HelpTooltip/index.js +6 -3
  122. package/lib/components/HelpTooltip/index.js.map +1 -1
  123. package/lib/components/HelpTriggerInline/index.js.map +1 -1
  124. package/lib/components/HighlightPanel/index.js +79 -1
  125. package/lib/components/HighlightPanel/index.js.map +1 -0
  126. package/lib/components/Icons/AlarmClock.js.map +1 -1
  127. package/lib/components/Icons/Bus.js.map +1 -1
  128. package/lib/components/Illustrations/BabyMobile.js +5 -4
  129. package/lib/components/Illustrations/BabyMobile.js.map +1 -1
  130. package/lib/components/Illustrations/BabyMobileMedium.js.map +1 -1
  131. package/lib/components/Illustrations/Child.js +5 -4
  132. package/lib/components/Illustrations/Child.js.map +1 -1
  133. package/lib/components/Illustrations/ChildMedium.js.map +1 -1
  134. package/lib/components/Illustrations/Doctor.js +10 -8
  135. package/lib/components/Illustrations/Doctor.js.map +1 -1
  136. package/lib/components/Illustrations/DoctorMedium.js.map +1 -1
  137. package/lib/components/Illustrations/DoctorSmall.js.map +1 -1
  138. package/lib/components/Illustrations/EyeContact.js +5 -4
  139. package/lib/components/Illustrations/EyeContact.js.map +1 -1
  140. package/lib/components/Illustrations/EyeContactMedium.js.map +1 -1
  141. package/lib/components/Illustrations/FacialRecognitionFingerprint.js +5 -4
  142. package/lib/components/Illustrations/FacialRecognitionFingerprint.js.map +1 -1
  143. package/lib/components/Illustrations/FacialRecognitionFingerprintMedium.js.map +1 -1
  144. package/lib/components/Illustrations/GiveBabyFood.js +5 -4
  145. package/lib/components/Illustrations/GiveBabyFood.js.map +1 -1
  146. package/lib/components/Illustrations/GiveBabyFoodMedium.js.map +1 -1
  147. package/lib/components/Illustrations/HealthcarePersonnel.js +10 -8
  148. package/lib/components/Illustrations/HealthcarePersonnel.js.map +1 -1
  149. package/lib/components/Illustrations/HealthcarePersonnelMedium.js.map +1 -1
  150. package/lib/components/Illustrations/HealthcarePersonnelSmall.js.map +1 -1
  151. package/lib/components/Illustrations/ReadLetters.js +5 -4
  152. package/lib/components/Illustrations/ReadLetters.js.map +1 -1
  153. package/lib/components/Illustrations/ReadLettersMedium.js.map +1 -1
  154. package/lib/components/Illustrations/SkinToSkin.js +5 -4
  155. package/lib/components/Illustrations/SkinToSkin.js.map +1 -1
  156. package/lib/components/Illustrations/SkinToSkinMedium.js.map +1 -1
  157. package/lib/components/Illustrations/Stork.js +5 -4
  158. package/lib/components/Illustrations/Stork.js.map +1 -1
  159. package/lib/components/Illustrations/StorkMedium.js.map +1 -1
  160. package/lib/components/Illustrations/Stroller.js +5 -4
  161. package/lib/components/Illustrations/Stroller.js.map +1 -1
  162. package/lib/components/Illustrations/StrollerMedium.js.map +1 -1
  163. package/lib/components/Illustrations/Support2.js +5 -4
  164. package/lib/components/Illustrations/Support2.js.map +1 -1
  165. package/lib/components/Illustrations/Support2Medium.js.map +1 -1
  166. package/lib/components/Illustrations/Thinking.js +5 -4
  167. package/lib/components/Illustrations/Thinking.js.map +1 -1
  168. package/lib/components/Illustrations/ThinkingMedium.js.map +1 -1
  169. package/lib/components/InfoTeaser/index.js +71 -1
  170. package/lib/components/InfoTeaser/index.js.map +1 -0
  171. package/lib/components/Loader/index.js +14 -13
  172. package/lib/components/Loader/index.js.map +1 -1
  173. package/lib/components/Logo/index.js.map +1 -1
  174. package/lib/components/Modal/index.js.map +1 -1
  175. package/lib/components/NotificationPanel/index.js +7 -4
  176. package/lib/components/NotificationPanel/index.js.map +1 -1
  177. package/lib/components/Panel/index.js +17 -16
  178. package/lib/components/Panel/index.js.map +1 -1
  179. package/lib/components/PanelList/index.js.map +1 -1
  180. package/lib/components/PopMenu/index.js.map +1 -1
  181. package/lib/components/Progressbar/index.js +6 -5
  182. package/lib/components/Progressbar/index.js.map +1 -1
  183. package/lib/components/PromoPanel/index.js.map +1 -1
  184. package/lib/components/RadioButton/styles.module.scss +6 -6
  185. package/lib/components/ServiceMessage/index.js +2 -1
  186. package/lib/components/ServiceMessage/index.js.map +1 -1
  187. package/lib/components/SharingStatus/index.js.map +1 -1
  188. package/lib/components/Step/index.js.map +1 -1
  189. package/lib/components/Stepper/index.js +4 -2
  190. package/lib/components/Stepper/index.js.map +1 -1
  191. package/lib/components/StickyNote/index.js.map +1 -1
  192. package/lib/components/Table/index.js +2 -5
  193. package/lib/components/Table/index.js.map +1 -1
  194. package/lib/components/Tabs/index.js.map +1 -1
  195. package/lib/components/Tag/index.js +2 -1
  196. package/lib/components/Tag/index.js.map +1 -1
  197. package/lib/components/TagList/index.js.map +1 -1
  198. package/lib/components/Tile/index.js +5 -4
  199. package/lib/components/Tile/index.js.map +1 -1
  200. package/lib/components/ToastList/index.js +2 -1
  201. package/lib/components/ToastList/index.js.map +1 -1
  202. package/lib/components/Toggle/index.js +1 -172
  203. package/lib/components/Validation/index.js.map +1 -1
  204. package/lib/components/VisualCheckboxCloud/index.js.map +1 -1
  205. package/lib/components/VisualCheckboxGroup/index.js.map +1 -1
  206. package/lib/components/VisualContentgroupWithImage/index.js.map +1 -1
  207. package/lib/components/VisualRadioCloud/index.js.map +1 -1
  208. package/lib/components/VisualRadioGroup/index.js.map +1 -1
  209. package/lib/floating-ui.react.js +91 -111
  210. package/lib/floating-ui.react.js.map +1 -1
  211. package/lib/getFilterChips.js.map +1 -1
  212. package/lib/resourceHelper2.js +22 -0
  213. package/lib/resourceHelper2.js.map +1 -0
  214. package/lib/theme/spacers.js +2 -2
  215. package/lib/theme/spacers.js.map +1 -1
  216. package/lib/utils/formSpacing.d.ts +3 -0
  217. package/lib/utils/formSpacing.js +16 -0
  218. package/lib/utils/formSpacing.js.map +1 -0
  219. package/lib/utils2.js.map +1 -1
  220. package/package.json +1 -1
  221. package/lib/HighlightPanel.js +0 -80
  222. package/lib/HighlightPanel.js.map +0 -1
  223. package/lib/InfoTeaser.js +0 -89
  224. package/lib/InfoTeaser.js.map +0 -1
  225. package/lib/components/Toggle/index.js.map +0 -1
@@ -1,173 +1,2 @@
1
- import { AnalyticsId } from "../../constants.js";
2
- import { usePseudoClasses } from "../../hooks/usePseudoClasses.js";
3
- import classNames from "classnames";
4
- import React, { useEffect, useId, useState } from "react";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { useAnimate } from "motion/react";
7
- import styles from "./styles.module.scss";
8
- //#region src/components/Toggle/constants.ts
9
- var TogglePosition = /* @__PURE__ */ function(TogglePosition) {
10
- TogglePosition["left"] = "left";
11
- TogglePosition["right"] = "right";
12
- return TogglePosition;
13
- }({});
14
- var ToggleOnColor = /* @__PURE__ */ function(ToggleOnColor) {
15
- ToggleOnColor["onwhite"] = "onwhite";
16
- ToggleOnColor["onneutral"] = "onneutral";
17
- ToggleOnColor["onblueberry"] = "onblueberry";
18
- return ToggleOnColor;
19
- }({});
20
- //#endregion
21
- //#region src/components/Toggle/Toggle.tsx
22
- var Toggle = ({ checked = false, disabled, label, onChange, onColor = ToggleOnColor.onwhite, statusText, subLabel, togglePosition = TogglePosition.left, testId }) => {
23
- const [checkedState, setCheckedState] = useState(checked);
24
- const [showToggleAnimation, setShowToggleAnimation] = useState(false);
25
- const [scope, animate] = useAnimate();
26
- const baseId = useId();
27
- const toggleId = "toggle-" + baseId;
28
- const inputId = "input-" + baseId;
29
- const labelId = "label-" + baseId;
30
- const subLabelId = "sublabel-" + baseId;
31
- const toggleRef = React.useRef(null);
32
- const toggleDotRef = React.useRef(null);
33
- const { refObject, isHovered, isActive } = usePseudoClasses(scope);
34
- const showHoveredStyling = isHovered && !showToggleAnimation;
35
- const isOnWhite = onColor === ToggleOnColor.onwhite;
36
- const animationDuration = disabled ? 0 : .2;
37
- const dotBackgroundColor = disabled ? "var(--color-disabled-graphics)" : checkedState ? "var(--color-action-graphics-ondark)" : "var(--core-color-neutral-700)";
38
- const getBackgroundColor = () => {
39
- if (disabled) return "transparent";
40
- else if (checkedState && isActive) return "var(--core-color-blueberry-800)";
41
- else if (checkedState) return showHoveredStyling ? "var(--color-action-graphics-onlight-hover)" : "var(--color-action-graphics-onlight)";
42
- else if (isOnWhite && isActive) return "var(--core-color-neutral-400)";
43
- else if (isOnWhite) return showHoveredStyling ? "var(--core-color-neutral-200)" : "var(--core-color-neutral-50)";
44
- else if (isActive) return "var(--core-color-neutral-200)";
45
- else return showHoveredStyling ? "var(--core-color-neutral-50)" : "var(--core-color-white)";
46
- };
47
- useEffect(() => {
48
- if (showToggleAnimation) {
49
- const timer = setTimeout(() => setShowToggleAnimation(false), 300);
50
- return () => clearTimeout(timer);
51
- }
52
- }, [showToggleAnimation]);
53
- useEffect(() => {
54
- setCheckedState(checked);
55
- }, [checked]);
56
- useEffect(() => {
57
- if (!toggleRef.current || !toggleDotRef.current) return;
58
- animate(toggleRef.current, { background: getBackgroundColor() }, {
59
- duration: animationDuration,
60
- ease: "easeInOut"
61
- });
62
- animate(toggleDotRef.current, { background: dotBackgroundColor }, {
63
- duration: animationDuration,
64
- ease: "easeInOut"
65
- });
66
- animate(toggleDotRef.current, { x: checkedState ? 16 : 0 }, {
67
- duration: animationDuration,
68
- ease: "easeInOut"
69
- });
70
- animate("svg", { opacity: checkedState ? 1 : 0 }, {
71
- duration: animationDuration,
72
- ease: "easeInOut"
73
- });
74
- }, [
75
- checkedState,
76
- showHoveredStyling,
77
- isActive,
78
- disabled
79
- ]);
80
- const handleChange = (event) => {
81
- setCheckedState(event.target.checked);
82
- setShowToggleAnimation(true);
83
- onChange?.(event);
84
- };
85
- const toggleContainerClassNames = classNames(styles["toggle-container"], {
86
- [styles["toggle-container--position-right"]]: togglePosition === TogglePosition.right,
87
- [styles["toggle-container--with-status"]]: statusText !== void 0 && statusText !== null,
88
- [styles["toggle-container--disabled"]]: disabled
89
- });
90
- const subLabelClassNames = classNames(styles["toggle-container__sublabel"]);
91
- const statusTextClassNames = classNames(styles["toggle-container__status"], { [styles["toggle-container__status--checked"]]: checkedState });
92
- const toggleClassNames = classNames(styles["toggle-container__toggle"], {
93
- [styles["toggle-container__toggle--ignore-hover"]]: showToggleAnimation,
94
- [styles["toggle-container__toggle--on-white"]]: onColor === ToggleOnColor.onwhite
95
- });
96
- const toggleDotClassNames = classNames(styles["toggle-container__toggle__dot"], { [styles["toggle-container__toggle__dot--ignore-hover"]]: showToggleAnimation });
97
- const renderToggle = () => /* @__PURE__ */ jsxs("div", {
98
- className: styles["toggle-container__outer-toggle"],
99
- children: [/* @__PURE__ */ jsxs("label", {
100
- ref: refObject,
101
- className: styles["toggle-container__toggle-group"],
102
- children: [/* @__PURE__ */ jsx("input", {
103
- disabled,
104
- id: inputId,
105
- type: "checkbox",
106
- checked: checkedState,
107
- onChange: handleChange,
108
- className: styles["toggle-container__input"],
109
- "aria-label": label.map((l) => l.text).join(" "),
110
- "aria-describedby": [subLabel ? subLabelId : null, statusText ? toggleId + "-status" : null].filter(Boolean).join(" ") || void 0,
111
- role: "switch"
112
- }), /* @__PURE__ */ jsx("span", {
113
- id: toggleId,
114
- ref: toggleRef,
115
- className: toggleClassNames,
116
- "aria-hidden": "true",
117
- children: /* @__PURE__ */ jsx("span", {
118
- ref: toggleDotRef,
119
- className: toggleDotClassNames,
120
- "aria-hidden": "true",
121
- children: /* @__PURE__ */ jsx("svg", {
122
- width: "12",
123
- height: "12",
124
- viewBox: "0 0 12 12",
125
- fill: "none",
126
- xmlns: "http://www.w3.org/2000/svg",
127
- className: styles["toggle-container__toggle__dot__icon"],
128
- children: /* @__PURE__ */ jsx("path", {
129
- d: "M11 2.65247L4.69877 9.34741L1 5.41836",
130
- strokeWidth: "2.2"
131
- })
132
- })
133
- })
134
- })]
135
- }), statusText && /* @__PURE__ */ jsx("span", {
136
- className: statusTextClassNames,
137
- id: toggleId + "-status",
138
- children: checkedState ? statusText.checked : statusText.unchecked
139
- })]
140
- });
141
- const renderLabelText = () => {
142
- return /* @__PURE__ */ jsxs("div", {
143
- className: styles["toggle-container__outer-label"],
144
- children: [/* @__PURE__ */ jsx("span", {
145
- id: labelId,
146
- className: styles["toggle-container__label"],
147
- children: label.map((labelText) => {
148
- return /* @__PURE__ */ jsx("span", {
149
- className: classNames({ [styles["toggle-container__label__text--subdued"]]: labelText.type === "subdued" }),
150
- children: labelText.text
151
- }, labelId + labelText.text);
152
- })
153
- }), subLabel && /* @__PURE__ */ jsx("div", {
154
- id: subLabelId,
155
- className: subLabelClassNames,
156
- children: subLabel
157
- })]
158
- });
159
- };
160
- return /* @__PURE__ */ jsxs("div", {
161
- className: toggleContainerClassNames,
162
- "data-testid": testId,
163
- "data-analyticsid": AnalyticsId.Toggle,
164
- children: [togglePosition === TogglePosition.left && /* @__PURE__ */ jsxs(Fragment, { children: [renderToggle(), renderLabelText()] }), togglePosition === TogglePosition.right && /* @__PURE__ */ jsxs(Fragment, { children: [renderLabelText(), renderToggle()] })]
165
- });
166
- };
167
- //#endregion
168
- //#region src/components/Toggle/index.ts
169
- var Toggle_default = Toggle;
170
- //#endregion
1
+ import { n as ToggleOnColor, r as TogglePosition, t as Toggle_default } from "../../Toggle.js";
171
2
  export { ToggleOnColor, TogglePosition, Toggle_default as default };
172
-
173
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Validation/ErrorListItem.tsx","../../../src/components/Validation/ErrorList.tsx","../../../src/components/Validation/ValidationSummary.tsx","../../../src/components/Validation/Validation.tsx","../../../src/components/Validation/index.ts"],"sourcesContent":["import type { ErrorDetails, FocusableElement } from './types';\nimport type { AnchorLinkOnClickEvent } from '../AnchorLink';\n\nimport AnchorLink from '../AnchorLink';\n\ninterface ErrorElementProps {\n name: string;\n error: ErrorDetails;\n}\n\nconst ErrorListItem: React.FC<ErrorElementProps> = props => {\n const handleClick = (event?: AnchorLinkOnClickEvent, element?: FocusableElement): void => {\n event?.preventDefault();\n if (element?.focus) element?.focus();\n };\n\n if (props.error.ref) {\n return (\n <AnchorLink href={`#${props.name}`} onClick={(e): void => handleClick(e, props.error.ref)}>\n {props.error.message}\n </AnchorLink>\n );\n }\n\n return <>{props.error.message}</>;\n};\n\nexport default ErrorListItem;\n","import type { ValidationErrors } from './types';\n\nimport ErrorListItem from './ErrorListItem';\nimport List from '../List';\n\ninterface ErrorListProps {\n errors: ValidationErrors;\n}\n\nconst ErrorList: React.FC<ErrorListProps> = props => (\n <List>\n {Object.entries(props.errors).map(([name, error]) => (\n <List.Item key={name}>\n <ErrorListItem name={name} error={error} />\n </List.Item>\n ))}\n </List>\n);\n\nexport default ErrorList;\n","import { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ValidationErrors } from './types';\nimport type { TitleTags } from '../Title';\n\nimport ErrorList from './ErrorList';\nimport Title from '../Title';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationSummaryProps {\n /** Error summary title */\n errorTitle?: string;\n /** Error list */\n errors?: ValidationErrors;\n /** Markup props for error summary title. Default: h2 */\n errorTitleHtmlMarkup?: TitleTags;\n /** Will be shown last */\n children?: React.ReactNode;\n /** Hides the list visually - summary is still announced by screen readers */\n visuallyHidden?: boolean;\n}\n\nconst ValidationSummary: React.FC<ValidationSummaryProps> = props => {\n const { errorTitleHtmlMarkup = 'h2' } = props;\n const titleId = useId();\n\n const hasErrors = !!props.errors && Object.entries(props.errors).length > 0;\n const visuallyHidden = props.visuallyHidden;\n\n const summaryClasses = classNames(styles['validation__summary'], {\n [styles['validation__summary--visible']]: hasErrors && !visuallyHidden,\n [styles['validation__summary--sr-only']]: visuallyHidden,\n });\n\n return (\n <div\n role={'status'}\n aria-atomic={'true'}\n aria-live={'polite'}\n aria-relevant={'all'}\n aria-labelledby={hasErrors && props.errorTitle ? titleId : undefined}\n className={summaryClasses}\n >\n {hasErrors && (\n <>\n {props.errorTitle && (\n <Title appearance=\"title4\" id={titleId} htmlMarkup={errorTitleHtmlMarkup} margin={{ marginTop: 0, marginBottom: 1 }}>\n {props.errorTitle}\n </Title>\n )}\n <ErrorList errors={props.errors!} />\n </>\n )}\n {props.children}\n </div>\n );\n};\n\nexport default ValidationSummary;\n","import React from 'react';\n\nimport type { ValidationErrors } from './types';\nimport type { FormSize } from '../../constants';\nimport type { CheckboxProps } from '../Checkbox';\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport type { FormGroupProps } from '../FormGroup/FormGroup';\nimport type { InputProps } from '../Input';\nimport type { RadioButtonProps } from '../RadioButton';\nimport type { SelectProps } from '../Select';\nimport type { SliderProps } from '../Slider';\nimport type { TextareaProps } from '../Textarea';\n\nimport ValidationSummary from './ValidationSummary';\nimport { AnalyticsId } from '../../constants';\nimport { isComponent, isComponentWithDisplayName } from '../../utils/component';\nimport Checkbox from '../Checkbox';\nimport FormGroup from '../FormGroup/FormGroup';\nimport Input from '../Input';\nimport RadioButton from '../RadioButton';\nimport Select from '../Select';\nimport Slider from '../Slider';\nimport Textarea from '../Textarea';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationProps {\n /** Error summary title */\n errorTitle?: string;\n /** Validation errors. If errors include references to HTML elements, the errors will be rendered as links with an onClick handler to focus the element. */\n errors?: ValidationErrors;\n /** Items in the Validation compontent */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Hides the ValidationSummary list visually - summary is still announced by screen readers */\n visuallyHiddenSummary?: boolean;\n /** Ref passed to the component */\n ref?: React.Ref<HTMLDivElement | null>;\n}\n\nexport const Validation: React.FC<ValidationProps> = (props: ValidationProps) => {\n const validationErrorClass = styles['validation__error-wrapper'];\n\n const cloneFormElement = <T extends ErrorWrapperClassNameProps>(child: React.ReactElement<T>): React.ReactElement<T> => {\n return React.cloneElement(child, {\n ...child.props,\n errorWrapperClassName: validationErrorClass,\n });\n };\n\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (\n isComponent<FormGroupProps>(child, FormGroup) ||\n isComponent<CheckboxProps>(child, Checkbox) ||\n isComponent<RadioButtonProps>(child, RadioButton) ||\n isComponent<TextareaProps>(child, Textarea) ||\n isComponent<InputProps>(child, Input) ||\n isComponent<SelectProps>(child, Select) ||\n isComponent<SliderProps>(child, Slider) ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTimePickerWrapper') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DatePicker') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTime')\n ) {\n return cloneFormElement<ErrorWrapperClassNameProps>(child);\n }\n if (isComponent<React.FragmentProps>(child, React.Fragment)) {\n return React.Children.map(child.props.children, (child: React.ReactNode) => {\n return renderChild(child);\n });\n }\n\n return child;\n };\n\n return (\n <>\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.Validation} className={props.className} ref={props.ref}>\n {React.Children.map(props.children, (child: React.ReactNode) => renderChild(child))}\n </div>\n <ValidationSummary errorTitle={props.errorTitle} errors={props.errors} visuallyHidden={props.visuallyHiddenSummary} />\n </>\n );\n};\n\nValidation.displayName = 'Validation';\n\nexport default Validation;\n","import Validation from './Validation';\nexport * from './Validation';\nexport default Validation;\n"],"mappings":";;;;;;;;;;;;;;;;;AAUA,IAAM,iBAA6C,UAAS;CAC1D,MAAM,eAAe,OAAgC,YAAqC;EACxF,OAAO,eAAe;EACtB,IAAI,SAAS,OAAO,SAAS,MAAM;CACrC;CAEA,IAAI,MAAM,MAAM,KACd,OACE,oBAAC,oBAAD;EAAY,MAAM,IAAI,MAAM;EAAQ,UAAU,MAAY,YAAY,GAAG,MAAM,MAAM,GAAG;YACrF,MAAM,MAAM;CACH,CAAA;CAIhB,OAAO,oBAAA,UAAA,EAAA,UAAG,MAAM,MAAM,QAAU,CAAA;AAClC;;;AChBA,IAAM,aAAsC,UAC1C,oBAAC,cAAD,EAAA,UACG,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,WACxC,oBAAC,aAAK,MAAN,EAAA,UACE,oBAAC,eAAD;CAAqB;CAAa;AAAQ,CAAA,EACjC,GAFK,IAEL,CACZ,EACG,CAAA;;;ACSR,IAAM,qBAAsD,UAAS;CACnE,MAAM,EAAE,uBAAuB,SAAS;CACxC,MAAM,UAAU,MAAM;CAEtB,MAAM,YAAY,CAAC,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC,SAAS;CAC1E,MAAM,iBAAiB,MAAM;CAE7B,MAAM,iBAAiB,WAAW,OAAO,wBAAwB;GAC9D,OAAO,kCAAkC,aAAa,CAAC;GACvD,OAAO,kCAAkC;CAC5C,CAAC;CAED,OACE,qBAAC,OAAD;EACE,MAAM;EACN,eAAa;EACb,aAAW;EACX,iBAAe;EACf,mBAAiB,aAAa,MAAM,aAAa,UAAU,KAAA;EAC3D,WAAW;YANb,CAQG,aACC,qBAAA,UAAA,EAAA,UAAA,CACG,MAAM,cACL,oBAAC,eAAD;GAAO,YAAW;GAAS,IAAI;GAAS,YAAY;GAAsB,QAAQ;IAAE,WAAW;IAAG,cAAc;GAAE;aAC/G,MAAM;EACF,CAAA,GAET,oBAAC,WAAD,EAAW,QAAQ,MAAM,OAAU,CAAA,CACnC,EAAA,CAAA,GAEH,MAAM,QACJ;;AAET;;;ACdA,IAAa,cAAyC,UAA2B;CAC/E,MAAM,uBAAuB,OAAO;CAEpC,MAAM,oBAA0D,UAAwD;EACtH,OAAO,MAAM,aAAa,OAAO;GAC/B,GAAG,MAAM;GACT,uBAAuB;EACzB,CAAC;CACH;CAEA,MAAM,eAAe,UAA4C;EAC/D,IACE,YAA4B,OAAO,SAAS,KAC5C,YAA2B,OAAO,gBAAQ,KAC1C,YAA8B,OAAO,mBAAW,KAChD,YAA2B,OAAO,gBAAQ,KAC1C,YAAwB,OAAO,aAAK,KACpC,YAAyB,OAAO,cAAM,KACtC,YAAyB,OAAO,cAAM,KACtC,2BAAuD,OAAO,uBAAuB,KACrF,2BAAuD,OAAO,YAAY,KAC1E,2BAAuD,OAAO,UAAU,GAExE,OAAO,iBAA6C,KAAK;EAE3D,IAAI,YAAiC,OAAO,MAAM,QAAQ,GACxD,OAAO,MAAM,SAAS,IAAI,MAAM,MAAM,WAAW,UAA2B;GAC1E,OAAO,YAAY,KAAK;EAC1B,CAAC;EAGH,OAAO;CACT;CAEA,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,OAAD;EAAK,eAAa,MAAM;EAAQ,oBAAkB,YAAY;EAAY,WAAW,MAAM;EAAW,KAAK,MAAM;YAC9G,MAAM,SAAS,IAAI,MAAM,WAAW,UAA2B,YAAY,KAAK,CAAC;CAC/E,CAAA,GACL,oBAAC,mBAAD;EAAmB,YAAY,MAAM;EAAY,QAAQ,MAAM;EAAQ,gBAAgB,MAAM;CAAwB,CAAA,CACrH,EAAA,CAAA;AAEN;AAEA,WAAW,cAAc;;;ACvFzB,IAAA,qBAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/Validation/ErrorListItem.tsx","../../../src/components/Validation/ErrorList.tsx","../../../src/components/Validation/ValidationSummary.tsx","../../../src/components/Validation/Validation.tsx","../../../src/components/Validation/index.ts"],"sourcesContent":["import type { ErrorDetails, FocusableElement } from './types';\nimport type { AnchorLinkOnClickEvent } from '../AnchorLink';\n\nimport AnchorLink from '../AnchorLink';\n\ninterface ErrorElementProps {\n name: string;\n error: ErrorDetails;\n}\n\nconst ErrorListItem: React.FC<ErrorElementProps> = props => {\n const handleClick = (event?: AnchorLinkOnClickEvent, element?: FocusableElement): void => {\n event?.preventDefault();\n if (element?.focus) element?.focus();\n };\n\n if (props.error.ref) {\n return (\n <AnchorLink href={`#${props.name}`} onClick={(e): void => handleClick(e, props.error.ref)}>\n {props.error.message}\n </AnchorLink>\n );\n }\n\n return <>{props.error.message}</>;\n};\n\nexport default ErrorListItem;\n","import type { ValidationErrors } from './types';\n\nimport ErrorListItem from './ErrorListItem';\nimport List from '../List';\n\ninterface ErrorListProps {\n errors: ValidationErrors;\n}\n\nconst ErrorList: React.FC<ErrorListProps> = props => (\n <List>\n {Object.entries(props.errors).map(([name, error]) => (\n <List.Item key={name}>\n <ErrorListItem name={name} error={error} />\n </List.Item>\n ))}\n </List>\n);\n\nexport default ErrorList;\n","import { useId } from 'react';\n\nimport classNames from 'classnames';\n\nimport type { ValidationErrors } from './types';\nimport type { TitleTags } from '../Title';\n\nimport ErrorList from './ErrorList';\nimport Title from '../Title';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationSummaryProps {\n /** Error summary title */\n errorTitle?: string;\n /** Error list */\n errors?: ValidationErrors;\n /** Markup props for error summary title. Default: h2 */\n errorTitleHtmlMarkup?: TitleTags;\n /** Will be shown last */\n children?: React.ReactNode;\n /** Hides the list visually - summary is still announced by screen readers */\n visuallyHidden?: boolean;\n}\n\nconst ValidationSummary: React.FC<ValidationSummaryProps> = props => {\n const { errorTitleHtmlMarkup = 'h2' } = props;\n const titleId = useId();\n\n const hasErrors = !!props.errors && Object.entries(props.errors).length > 0;\n const visuallyHidden = props.visuallyHidden;\n\n const summaryClasses = classNames(styles['validation__summary'], {\n [styles['validation__summary--visible']]: hasErrors && !visuallyHidden,\n [styles['validation__summary--sr-only']]: visuallyHidden,\n });\n\n return (\n <div\n role={'status'}\n aria-atomic={'true'}\n aria-live={'polite'}\n aria-relevant={'all'}\n aria-labelledby={hasErrors && props.errorTitle ? titleId : undefined}\n className={summaryClasses}\n >\n {hasErrors && (\n <>\n {props.errorTitle && (\n <Title appearance=\"title4\" id={titleId} htmlMarkup={errorTitleHtmlMarkup} margin={{ marginTop: 0, marginBottom: 1 }}>\n {props.errorTitle}\n </Title>\n )}\n <ErrorList errors={props.errors!} />\n </>\n )}\n {props.children}\n </div>\n );\n};\n\nexport default ValidationSummary;\n","import React from 'react';\n\nimport type { ValidationErrors } from './types';\nimport type { FormSize } from '../../constants';\nimport type { CheckboxProps } from '../Checkbox';\nimport type { ErrorWrapperClassNameProps } from '../ErrorWrapper';\nimport type { FormGroupProps } from '../FormGroup/FormGroup';\nimport type { InputProps } from '../Input';\nimport type { RadioButtonProps } from '../RadioButton';\nimport type { SelectProps } from '../Select';\nimport type { SliderProps } from '../Slider';\nimport type { TextareaProps } from '../Textarea';\n\nimport ValidationSummary from './ValidationSummary';\nimport { AnalyticsId } from '../../constants';\nimport { isComponent, isComponentWithDisplayName } from '../../utils/component';\nimport Checkbox from '../Checkbox';\nimport FormGroup from '../FormGroup/FormGroup';\nimport Input from '../Input';\nimport RadioButton from '../RadioButton';\nimport Select from '../Select';\nimport Slider from '../Slider';\nimport Textarea from '../Textarea';\n\nimport styles from './styles.module.scss';\n\ninterface ValidationProps {\n /** Error summary title */\n errorTitle?: string;\n /** Validation errors. If errors include references to HTML elements, the errors will be rendered as links with an onClick handler to focus the element. */\n errors?: ValidationErrors;\n /** Items in the Validation compontent */\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the formgroup */\n size?: keyof typeof FormSize;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Hides the ValidationSummary list visually - summary is still announced by screen readers */\n visuallyHiddenSummary?: boolean;\n /** Ref passed to the component */\n ref?: React.Ref<HTMLDivElement | null>;\n}\n\nexport const Validation: React.FC<ValidationProps> = (props: ValidationProps) => {\n const validationErrorClass = styles['validation__error-wrapper'];\n\n const cloneFormElement = <T extends ErrorWrapperClassNameProps>(child: React.ReactElement<T>): React.ReactElement<T> => {\n return React.cloneElement(child, {\n ...child.props,\n errorWrapperClassName: validationErrorClass,\n });\n };\n\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (\n isComponent<FormGroupProps>(child, FormGroup) ||\n isComponent<CheckboxProps>(child, Checkbox) ||\n isComponent<RadioButtonProps>(child, RadioButton) ||\n isComponent<TextareaProps>(child, Textarea) ||\n isComponent<InputProps>(child, Input) ||\n isComponent<SelectProps>(child, Select) ||\n isComponent<SliderProps>(child, Slider) ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTimePickerWrapper') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DatePicker') ||\n isComponentWithDisplayName<ErrorWrapperClassNameProps>(child, 'DateTime')\n ) {\n return cloneFormElement<ErrorWrapperClassNameProps>(child);\n }\n if (isComponent<React.FragmentProps>(child, React.Fragment)) {\n return React.Children.map(child.props.children, (child: React.ReactNode) => {\n return renderChild(child);\n });\n }\n\n return child;\n };\n\n return (\n <>\n <div data-testid={props.testId} data-analyticsid={AnalyticsId.Validation} className={props.className} ref={props.ref}>\n {React.Children.map(props.children, (child: React.ReactNode) => renderChild(child))}\n </div>\n <ValidationSummary errorTitle={props.errorTitle} errors={props.errors} visuallyHidden={props.visuallyHiddenSummary} />\n </>\n );\n};\n\nValidation.displayName = 'Validation';\n\nexport default Validation;\n","import Validation from './Validation';\nexport * from './Validation';\nexport default Validation;\n"],"mappings":";;;;;;;;;;;;;;;;;AAUA,IAAM,iBAA6C,UAAS;CAC1D,MAAM,eAAe,OAAgC,YAAqC;EACxF,OAAO,eAAe;EACtB,IAAI,SAAS,OAAO,SAAS,MAAM;CACrC;CAEA,IAAI,MAAM,MAAM,KACd,OACE,oBAAC,oBAAD;EAAY,MAAM,IAAI,MAAM;EAAQ,UAAU,MAAY,YAAY,GAAG,MAAM,MAAM,GAAG;EACrF,UAAA,MAAM,MAAM;CACH,CAAA;CAIhB,OAAO,oBAAA,UAAA,EAAA,UAAG,MAAM,MAAM,QAAU,CAAA;AAClC;;;AChBA,IAAM,aAAsC,UAC1C,oBAAC,cAAD,EAAA,UACG,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,WACxC,oBAAC,aAAK,MAAN,EAAA,UACE,oBAAC,eAAD;CAAqB;CAAa;AAAQ,CAAA,EACjC,GAFK,IAEL,CACZ,EACG,CAAA;;;ACSR,IAAM,qBAAsD,UAAS;CACnE,MAAM,EAAE,uBAAuB,SAAS;CACxC,MAAM,UAAU,MAAM;CAEtB,MAAM,YAAY,CAAC,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC,SAAS;CAC1E,MAAM,iBAAiB,MAAM;CAE7B,MAAM,iBAAiB,WAAW,OAAO,wBAAwB;GAC9D,OAAO,kCAAkC,aAAa,CAAC;GACvD,OAAO,kCAAkC;CAC5C,CAAC;CAED,OACE,qBAAC,OAAD;EACE,MAAM;EACN,eAAa;EACb,aAAW;EACX,iBAAe;EACf,mBAAiB,aAAa,MAAM,aAAa,UAAU,KAAA;EAC3D,WAAW;EANb,UAAA,CAQG,aACC,qBAAA,UAAA,EAAA,UAAA,CACG,MAAM,cACL,oBAAC,eAAD;GAAO,YAAW;GAAS,IAAI;GAAS,YAAY;GAAsB,QAAQ;IAAE,WAAW;IAAG,cAAc;GAAE;GAC/G,UAAA,MAAM;EACF,CAAA,GAET,oBAAC,WAAD,EAAW,QAAQ,MAAM,OAAU,CAAA,CACnC,EAAA,CAAA,GAEH,MAAM,QACJ;;AAET;;;ACdA,IAAa,cAAyC,UAA2B;CAC/E,MAAM,uBAAuB,OAAO;CAEpC,MAAM,oBAA0D,UAAwD;EACtH,OAAO,MAAM,aAAa,OAAO;GAC/B,GAAG,MAAM;GACT,uBAAuB;EACzB,CAAC;CACH;CAEA,MAAM,eAAe,UAA4C;EAC/D,IACE,YAA4B,OAAO,SAAS,KAC5C,YAA2B,OAAO,gBAAQ,KAC1C,YAA8B,OAAO,mBAAW,KAChD,YAA2B,OAAO,gBAAQ,KAC1C,YAAwB,OAAO,aAAK,KACpC,YAAyB,OAAO,cAAM,KACtC,YAAyB,OAAO,cAAM,KACtC,2BAAuD,OAAO,uBAAuB,KACrF,2BAAuD,OAAO,YAAY,KAC1E,2BAAuD,OAAO,UAAU,GAExE,OAAO,iBAA6C,KAAK;EAE3D,IAAI,YAAiC,OAAO,MAAM,QAAQ,GACxD,OAAO,MAAM,SAAS,IAAI,MAAM,MAAM,WAAW,UAA2B;GAC1E,OAAO,YAAY,KAAK;EAC1B,CAAC;EAGH,OAAO;CACT;CAEA,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,OAAD;EAAK,eAAa,MAAM;EAAQ,oBAAkB,YAAY;EAAY,WAAW,MAAM;EAAW,KAAK,MAAM;EAC9G,UAAA,MAAM,SAAS,IAAI,MAAM,WAAW,UAA2B,YAAY,KAAK,CAAC;CAC/E,CAAA,GACL,oBAAC,mBAAD;EAAmB,YAAY,MAAM;EAAY,QAAQ,MAAM;EAAQ,gBAAgB,MAAM;CAAwB,CAAA,CACrH,EAAA,CAAA;AAEN;AAEA,WAAW,cAAc;;;ACvFzB,IAAA,qBAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/VisualCheckboxCloud/VisualCheckboxCloud.tsx","../../../src/components/VisualCheckboxCloud/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { CheckboxProps } from './Checkbox/Checkbox';\n\nimport Checkbox from './Checkbox/Checkbox';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { isComponent } from '../../utils/component';\nimport ErrorWrapper from '../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualCheckboxCloudProps {\n /** Items in the cloud. Should be VisualCheckboxCloud.Checkbox elements. */\n children?: React.ReactNode;\n /** Name shared by all child Checkbox elements (overridable per child) */\n name?: string;\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}\n\ninterface VisualCheckboxCloudComponent extends React.FC<VisualCheckboxCloudProps> {\n Checkbox: typeof Checkbox;\n}\n\nexport const VisualCheckboxCloud: VisualCheckboxCloudComponent = props => {\n const {\n children,\n name,\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\n const mapChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<CheckboxProps>(child, Checkbox)) {\n return React.cloneElement(child, {\n name: child.props.name ?? name,\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 className={styles['visual-checkbox-cloud']} data-testid={testId}>\n {React.Children.map(children, mapChild)}\n </div>\n </ErrorWrapper>\n );\n};\n\nVisualCheckboxCloud.Checkbox = Checkbox;\n\nexport default VisualCheckboxCloud;\n","import VisualCheckboxCloud from './VisualCheckboxCloud';\nexport * from './VisualCheckboxCloud';\nexport default VisualCheckboxCloud;\n"],"mappings":";;;;;;;;;AAwCA,IAAa,uBAAoD,UAAS;CACxE,MAAM,EACJ,UACA,MACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,eAAe;CAErD,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAA2B,OAAO,QAAQ,GAC5C,OAAO,MAAM,aAAa,OAAO;GAC/B,MAAM,MAAM,MAAM,QAAQ;GAC1B,OAAO,CAAC,CAAC,SAAS,MAAM,MAAM;GAC9B,aAAa,MAAM,MAAM,eAAe;EAC1C,CAAC;EAEH,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;YAER,oBAAC,OAAD;GAAK,WAAW,OAAO;GAA0B,eAAa;aAC3D,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,oBAAoB,WAAW;;;ACjF/B,IAAA,8BAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/VisualCheckboxCloud/VisualCheckboxCloud.tsx","../../../src/components/VisualCheckboxCloud/index.ts"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport type { CheckboxProps } from './Checkbox/Checkbox';\n\nimport Checkbox from './Checkbox/Checkbox';\nimport { useIdWithFallback } from '../../hooks/useIdWithFallback';\nimport { isComponent } from '../../utils/component';\nimport ErrorWrapper from '../ErrorWrapper';\n\nimport styles from './styles.module.scss';\n\nexport interface VisualCheckboxCloudProps {\n /** Items in the cloud. Should be VisualCheckboxCloud.Checkbox elements. */\n children?: React.ReactNode;\n /** Name shared by all child Checkbox elements (overridable per child) */\n name?: string;\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}\n\ninterface VisualCheckboxCloudComponent extends React.FC<VisualCheckboxCloudProps> {\n Checkbox: typeof Checkbox;\n}\n\nexport const VisualCheckboxCloud: VisualCheckboxCloudComponent = props => {\n const {\n children,\n name,\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\n const mapChild = (child: React.ReactNode): React.ReactNode => {\n if (isComponent<CheckboxProps>(child, Checkbox)) {\n return React.cloneElement(child, {\n name: child.props.name ?? name,\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 className={styles['visual-checkbox-cloud']} data-testid={testId}>\n {React.Children.map(children, mapChild)}\n </div>\n </ErrorWrapper>\n );\n};\n\nVisualCheckboxCloud.Checkbox = Checkbox;\n\nexport default VisualCheckboxCloud;\n","import VisualCheckboxCloud from './VisualCheckboxCloud';\nexport * from './VisualCheckboxCloud';\nexport default VisualCheckboxCloud;\n"],"mappings":";;;;;;;;;AAwCA,IAAa,uBAAoD,UAAS;CACxE,MAAM,EACJ,UACA,MACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,eAAe;CAErD,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAA2B,OAAO,QAAQ,GAC5C,OAAO,MAAM,aAAa,OAAO;GAC/B,MAAM,MAAM,MAAM,QAAQ;GAC1B,OAAO,CAAC,CAAC,SAAS,MAAM,MAAM;GAC9B,aAAa,MAAM,MAAM,eAAe;EAC1C,CAAC;EAEH,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;EAER,UAAA,oBAAC,OAAD;GAAK,WAAW,OAAO;GAA0B,eAAa;GAC3D,UAAA,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,oBAAoB,WAAW;;;ACjF/B,IAAA,8BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"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,IAAa,uBAAoD,UAAS;CACxE,MAAM,EACJ,UACA,MACA,UAAU,aACV,wBACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,eAAe;CACrD,MAAM,WAAW,sBAAsB;CAEvC,MAAM,sBAAsB,MAAM,SAAS,QAAQ,QAAQ,CAAC,CAAC,QAAO,UAClE,YAAiC,OAAO,cAAc,CACxD,CAAC,CAAC;CAEF,MAAM,mBACJ,YAAY,2BAA2B,KAAA,KAAa,sBAAsB,yBAAyB,SAAS;CAE9G,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAAiC,OAAO,cAAc,GACxD,OAAO,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;EAC1C,CAAC;EAEH,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;YAER,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,0BAA0B,GACpD,OAAO,yCAAyC,qBAAqB,OACxE,CAAC;GACD,eAAa;aAEZ,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,oBAAoB,iBAAiB;;;ACtGrC,IAAA,8BAAe"}
1
+ {"version":3,"file":"index.js","names":[],"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,IAAa,uBAAoD,UAAS;CACxE,MAAM,EACJ,UACA,MACA,UAAU,aACV,wBACA,OACA,aAAa,iBACb,cAAc,MACd,iBACA,WACA,uBACA,QACA,uBACE;CAEJ,MAAM,cAAc,kBAAkB,eAAe;CACrD,MAAM,WAAW,sBAAsB;CAEvC,MAAM,sBAAsB,MAAM,SAAS,QAAQ,QAAQ,CAAC,CAAC,QAAO,UAClE,YAAiC,OAAO,cAAc,CACxD,CAAC,CAAC;CAEF,MAAM,mBACJ,YAAY,2BAA2B,KAAA,KAAa,sBAAsB,yBAAyB,SAAS;CAE9G,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAAiC,OAAO,cAAc,GACxD,OAAO,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;EAC1C,CAAC;EAEH,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;EAER,UAAA,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,0BAA0B,GACpD,OAAO,yCAAyC,qBAAqB,OACxE,CAAC;GACD,eAAa;GAEZ,UAAA,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,oBAAoB,iBAAiB;;;ACtGrC,IAAA,8BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/VisualContentgroupWithImage/VisualContentgroupWithImage.tsx","../../../src/components/VisualContentgroupWithImage/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport type ImageRatios = 'square' | 'landscape';\n\nexport interface VisualContentgroupWithImageProps {\n /** Set the ratio of the image. */\n imageRatio?: ImageRatios;\n /** Content rendered inside the visualcontent area. */\n visualContent: React.ReactNode;\n /** Content rendered inside the component */\n children: React.ReactNode;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst VisualContentgroupWithImage: React.FC<VisualContentgroupWithImageProps> = props => {\n const { imageRatio = 'square', visualContent, children, testId } = props;\n\n return (\n <div data-testid={testId} className={styles['visual-contentgroup-with-image']}>\n <div\n className={classNames(styles['visual-contentgroup-with-image__frame'], {\n [styles[`visual-contentgroup-with-image__frame--${imageRatio}`]]: imageRatio,\n })}\n >\n {visualContent}\n </div>\n {children}\n </div>\n );\n};\n\nexport default VisualContentgroupWithImage;\n","import VisualContentgroupWithImage from './VisualContentgroupWithImage';\nexport * from './VisualContentgroupWithImage';\nexport default VisualContentgroupWithImage;\n"],"mappings":";;;;AAiBA,IAAM,+BAA0E,UAAS;CACvF,MAAM,EAAE,aAAa,UAAU,eAAe,UAAU,WAAW;CAEnE,OACE,qBAAC,OAAD;EAAK,eAAa;EAAQ,WAAW,OAAO;YAA5C,CACE,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,0CAA0C,GACpE,OAAO,0CAA0C,gBAAgB,WACpE,CAAC;aAEA;EACE,CAAA,GACJ,QACE;;AAET;;;AC9BA,IAAA,sCAAe"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/components/VisualContentgroupWithImage/VisualContentgroupWithImage.tsx","../../../src/components/VisualContentgroupWithImage/index.ts"],"sourcesContent":["import classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nexport type ImageRatios = 'square' | 'landscape';\n\nexport interface VisualContentgroupWithImageProps {\n /** Set the ratio of the image. */\n imageRatio?: ImageRatios;\n /** Content rendered inside the visualcontent area. */\n visualContent: React.ReactNode;\n /** Content rendered inside the component */\n children: React.ReactNode;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst VisualContentgroupWithImage: React.FC<VisualContentgroupWithImageProps> = props => {\n const { imageRatio = 'square', visualContent, children, testId } = props;\n\n return (\n <div data-testid={testId} className={styles['visual-contentgroup-with-image']}>\n <div\n className={classNames(styles['visual-contentgroup-with-image__frame'], {\n [styles[`visual-contentgroup-with-image__frame--${imageRatio}`]]: imageRatio,\n })}\n >\n {visualContent}\n </div>\n {children}\n </div>\n );\n};\n\nexport default VisualContentgroupWithImage;\n","import VisualContentgroupWithImage from './VisualContentgroupWithImage';\nexport * from './VisualContentgroupWithImage';\nexport default VisualContentgroupWithImage;\n"],"mappings":";;;;AAiBA,IAAM,+BAA0E,UAAS;CACvF,MAAM,EAAE,aAAa,UAAU,eAAe,UAAU,WAAW;CAEnE,OACE,qBAAC,OAAD;EAAK,eAAa;EAAQ,WAAW,OAAO;EAA5C,UAAA,CACE,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,0CAA0C,GACpE,OAAO,0CAA0C,gBAAgB,WACpE,CAAC;GAEA,UAAA;EACE,CAAA,GACJ,QACE;;AAET;;;AC9BA,IAAA,sCAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"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,IAAa,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,eAAe;CACrD,MAAM,CAAC,eAAe,oBAAoB,SAA6B,SAAS,YAAY;CAC5F,MAAM,CAAC,WAAW,gBAAgB,SAA6B,KAAK;CACpE,IAAI,cAAc,OAAO;EACvB,aAAa,KAAK;EAClB,IAAI,UAAU,KAAA,KAAa,UAAU,eACnC,iBAAiB,KAAK;CAE1B;CAEA,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAAwB,OAAO,KAAK,GAAG;GACzC,MAAM,aAAa,kBAAkB,KAAA,KAAa,MAAM,MAAM,UAAU;GACxE,OAAO,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;KACpD,iBAAiB,MAAM,MAAM,KAAK;KAClC,MAAM,MAAM,WAAW,CAAC;KACxB,WAAW,GAAG,MAAM,MAAM,KAAK;IACjC;GACF,CAAC;EACH;EACA,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;YAER,oBAAC,OAAD;GACE,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,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,iBAAiB,QAAQ;;;ACvHzB,IAAA,2BAAe"}
1
+ {"version":3,"file":"index.js","names":[],"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,IAAa,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,eAAe;CACrD,MAAM,CAAC,eAAe,oBAAoB,SAA6B,SAAS,YAAY;CAC5F,MAAM,CAAC,WAAW,gBAAgB,SAA6B,KAAK;CACpE,IAAI,cAAc,OAAO;EACvB,aAAa,KAAK;EAClB,IAAI,UAAU,KAAA,KAAa,UAAU,eACnC,iBAAiB,KAAK;CAE1B;CAEA,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAAwB,OAAO,KAAK,GAAG;GACzC,MAAM,aAAa,kBAAkB,KAAA,KAAa,MAAM,MAAM,UAAU;GACxE,OAAO,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;KACpD,iBAAiB,MAAM,MAAM,KAAK;KAClC,MAAM,MAAM,WAAW,CAAC;KACxB,WAAW,GAAG,MAAM,MAAM,KAAK;IACjC;GACF,CAAC;EACH;EACA,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;EAER,UAAA,oBAAC,OAAD;GACE,MAAK;GACL,cAAY;GACZ,mBAAiB;GACjB,gBAAc,QAAQ,OAAO,KAAA;GAC7B,oBAAkB,QAAQ,cAAc,KAAA;GACxC,WAAW,OAAO;GAClB,eAAa;GAEZ,UAAA,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,iBAAiB,QAAQ;;;ACvHzB,IAAA,2BAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"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,IAAa,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,eAAe;CACrD,MAAM,OAAO,kBAAkB,QAAQ;CACvC,MAAM,WAAW,sBAAsB;CAGvC,MAAM,gBADa,MAAM,SAAS,QAAQ,QACpB,CAAA,CAAW,QAAQ,UACvC,YAA8B,OAAO,WAAW,CAClD;CAEA,MAAM,kBACJ,SAAS,gBAAgB,cAAc,MAAK,UAAS,MAAM,MAAM,kBAAkB,MAAM,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,SAAS;CAEjI,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAA6B,eAAe;CAC5F,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAA6B,KAAK;CAC1E,IAAI,cAAc,OAAO;EACvB,aAAa,KAAK;EAClB,IAAI,UAAU,KAAA,KAAa,UAAU,eACnC,iBAAiB,KAAK;CAE1B;CAEA,MAAM,mBACJ,YAAY,2BAA2B,KAAA,KAAa,cAAc,SAAS,yBAAyB,SAAS;CAE/G,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAA8B,OAAO,WAAW,GAAG;GACrD,MAAM,aAAa,MAAM,MAAM,OAAO,SAAS;GAC/C,MAAM,aAAa,kBAAkB,KAAA,KAAa,eAAe,KAAA,KAAa,eAAe;GAC7F,MAAM,gBAAgB,MAAM,MAAM;GAElC,OAAO,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;KAC1D,IAAI,eAAe,KAAA,GACjB,iBAAiB,UAAU;KAE7B,gBAAgB,CAAC;KACjB,IAAI,eAAe,KAAA,GACjB,WAAW,GAAG,UAAU;IAE5B;GACF,CAAC;EACH;EACA,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;YAER,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,uBAAuB,GACjD,OAAO,sCAAsC,qBAAqB,OACrE,CAAC;GACD,eAAa;GACb,MAAM;aAEL,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,iBAAiB,cAAc;;;AC5I/B,IAAA,2BAAe"}
1
+ {"version":3,"file":"index.js","names":[],"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,IAAa,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,eAAe;CACrD,MAAM,OAAO,kBAAkB,QAAQ;CACvC,MAAM,WAAW,sBAAsB;CAGvC,MAAM,gBADa,MAAM,SAAS,QAAQ,QACpB,CAAA,CAAW,QAAQ,UACvC,YAA8B,OAAO,WAAW,CAClD;CAEA,MAAM,kBACJ,SAAS,gBAAgB,cAAc,MAAK,UAAS,MAAM,MAAM,kBAAkB,MAAM,MAAM,OAAO,CAAC,EAAE,MAAM,OAAO,SAAS;CAEjI,MAAM,CAAC,eAAe,oBAAoB,MAAM,SAA6B,eAAe;CAC5F,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAA6B,KAAK;CAC1E,IAAI,cAAc,OAAO;EACvB,aAAa,KAAK;EAClB,IAAI,UAAU,KAAA,KAAa,UAAU,eACnC,iBAAiB,KAAK;CAE1B;CAEA,MAAM,mBACJ,YAAY,2BAA2B,KAAA,KAAa,cAAc,SAAS,yBAAyB,SAAS;CAE/G,MAAM,YAAY,UAA4C;EAC5D,IAAI,YAA8B,OAAO,WAAW,GAAG;GACrD,MAAM,aAAa,MAAM,MAAM,OAAO,SAAS;GAC/C,MAAM,aAAa,kBAAkB,KAAA,KAAa,eAAe,KAAA,KAAa,eAAe;GAC7F,MAAM,gBAAgB,MAAM,MAAM;GAElC,OAAO,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;KAC1D,IAAI,eAAe,KAAA,GACjB,iBAAiB,UAAU;KAE7B,gBAAgB,CAAC;KACjB,IAAI,eAAe,KAAA,GACjB,WAAW,GAAG,UAAU;IAE5B;GACF,CAAC;EACH;EACA,OAAO;CACT;CAEA,OACE,oBAAC,sBAAD;EACE,WAAW,WAAW,uBAAuB,SAAS;EACtD,WAAW;EACE;EACA;EACI;EACjB,QAAQ;EAER,UAAA,oBAAC,OAAD;GACE,WAAW,WAAW,OAAO,uBAAuB,GACjD,OAAO,sCAAsC,qBAAqB,OACrE,CAAC;GACD,eAAa;GACb,MAAM;GAEL,UAAA,MAAM,SAAS,IAAI,UAAU,QAAQ;EACnC,CAAA;CACO,CAAA;AAElB;AAEA,iBAAiB,cAAc;;;AC5I/B,IAAA,2BAAe"}