@pega/cosmos-react-core 9.45.0 → 9.46.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 (198) hide show
  1. package/lib/components/Checkbox/Checkbox.d.ts +1 -1
  2. package/lib/components/Checkbox/Checkbox.test-ids.d.ts +1 -1
  3. package/lib/components/Checkbox/Checkbox.test-ids.d.ts.map +1 -1
  4. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  5. package/lib/components/ColorPicker/ColorPicker.d.ts +1 -1
  6. package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts +1 -1
  7. package/lib/components/ColorPicker/ColorPicker.test-ids.d.ts.map +1 -1
  8. package/lib/components/ComboBox/ComboBox.d.ts +1 -1
  9. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  10. package/lib/components/ComboBox/ComboBox.js +2 -2
  11. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  12. package/lib/components/ComboBox/ComboBox.types.d.ts +2 -0
  13. package/lib/components/ComboBox/ComboBox.types.d.ts.map +1 -1
  14. package/lib/components/ComboBox/ComboBox.types.js.map +1 -1
  15. package/lib/components/ComboBox/ComboxBox.test-ids.d.ts +1 -1
  16. package/lib/components/ComboBox/ComboxBox.test-ids.d.ts.map +1 -1
  17. package/lib/components/CompositeInput/CompositeInput.d.ts +1 -1
  18. package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts +1 -1
  19. package/lib/components/CompositeInput/CompositeInput.test-ids.d.ts.map +1 -1
  20. package/lib/components/Currency/Currency.test-ids.d.ts +1 -1
  21. package/lib/components/Currency/Currency.test-ids.d.ts.map +1 -1
  22. package/lib/components/Currency/CurrencyInput.d.ts +1 -1
  23. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  24. package/lib/components/Currency/CurrencyInput.js +2 -2
  25. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  26. package/lib/components/Currency/CurrencyInput.styles.d.ts +1 -1
  27. package/lib/components/DateTime/DateTime.test-ids.d.ts +10 -10
  28. package/lib/components/DateTime/DateTime.test-ids.d.ts.map +1 -1
  29. package/lib/components/DateTime/Input/DateInput.d.ts +3 -1
  30. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  31. package/lib/components/DateTime/Input/DateInput.js +2 -2
  32. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  33. package/lib/components/DateTime/Input/DateRangeInput.d.ts +1 -1
  34. package/lib/components/DateTime/Input/DateTimeInput.d.ts +3 -1
  35. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  36. package/lib/components/DateTime/Input/DateTimeInput.js +2 -2
  37. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  38. package/lib/components/DateTime/Input/DayOfWeekInput.d.ts +1 -1
  39. package/lib/components/DateTime/Input/Duration/DurationInput.d.ts +1 -1
  40. package/lib/components/DateTime/Input/MonthInput.d.ts +1 -1
  41. package/lib/components/DateTime/Input/QuarterInput.d.ts +1 -1
  42. package/lib/components/DateTime/Input/TimeInput.d.ts +3 -1
  43. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  44. package/lib/components/DateTime/Input/TimeInput.js +2 -2
  45. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  46. package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -1
  47. package/lib/components/DateTime/Input/WeekInput.d.ts +1 -1
  48. package/lib/components/FieldGroup/FieldGroup.d.ts +4 -0
  49. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  50. package/lib/components/FieldGroup/FieldGroup.js +5 -4
  51. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  52. package/lib/components/File/File.test-ids.d.ts +1 -1
  53. package/lib/components/File/File.test-ids.d.ts.map +1 -1
  54. package/lib/components/File/FileInput.d.ts +3 -1
  55. package/lib/components/File/FileInput.d.ts.map +1 -1
  56. package/lib/components/File/FileInput.js +4 -4
  57. package/lib/components/File/FileInput.js.map +1 -1
  58. package/lib/components/File/FileInput.styles.d.ts +1 -1
  59. package/lib/components/FormControl/FormControl.d.ts +3 -0
  60. package/lib/components/FormControl/FormControl.d.ts.map +1 -1
  61. package/lib/components/FormControl/FormControl.js.map +1 -1
  62. package/lib/components/FormField/FormField.d.ts +1 -1
  63. package/lib/components/FormField/FormField.d.ts.map +1 -1
  64. package/lib/components/FormField/FormField.js +14 -9
  65. package/lib/components/FormField/FormField.js.map +1 -1
  66. package/lib/components/FormField/FormField.test-ids.d.ts +2 -2
  67. package/lib/components/FormField/FormField.test-ids.d.ts.map +1 -1
  68. package/lib/components/FormField/FormField.test-ids.js +1 -0
  69. package/lib/components/FormField/FormField.test-ids.js.map +1 -1
  70. package/lib/components/Icon/iconNames.d.ts +1 -1
  71. package/lib/components/Icon/iconNames.d.ts.map +1 -1
  72. package/lib/components/Icon/iconNames.js +1 -0
  73. package/lib/components/Icon/iconNames.js.map +1 -1
  74. package/lib/components/Icon/icons/related-content.icon.d.ts +5 -0
  75. package/lib/components/Icon/icons/related-content.icon.d.ts.map +1 -0
  76. package/lib/components/Icon/icons/related-content.icon.js +7 -0
  77. package/lib/components/Icon/icons/related-content.icon.js.map +1 -0
  78. package/lib/components/Icon/streamline-icons/related-content.icon.d.ts +5 -0
  79. package/lib/components/Icon/streamline-icons/related-content.icon.d.ts.map +1 -0
  80. package/lib/components/Icon/streamline-icons/related-content.icon.js +7 -0
  81. package/lib/components/Icon/streamline-icons/related-content.icon.js.map +1 -0
  82. package/lib/components/Icon/streamlineIconNames.d.ts +1 -1
  83. package/lib/components/Icon/streamlineIconNames.d.ts.map +1 -1
  84. package/lib/components/Icon/streamlineIconNames.js +1 -0
  85. package/lib/components/Icon/streamlineIconNames.js.map +1 -1
  86. package/lib/components/Input/Input.d.ts +1 -1
  87. package/lib/components/Input/Input.d.ts.map +1 -1
  88. package/lib/components/Input/Input.js +2 -2
  89. package/lib/components/Input/Input.js.map +1 -1
  90. package/lib/components/Input/Input.test-ids.d.ts +1 -1
  91. package/lib/components/Input/Input.test-ids.d.ts.map +1 -1
  92. package/lib/components/Lightbox/Lightbox.d.ts.map +1 -1
  93. package/lib/components/Lightbox/Lightbox.js +17 -3
  94. package/lib/components/Lightbox/Lightbox.js.map +1 -1
  95. package/lib/components/Lightbox/Lightbox.styles.d.ts.map +1 -1
  96. package/lib/components/Lightbox/Lightbox.styles.js +104 -1
  97. package/lib/components/Lightbox/Lightbox.styles.js.map +1 -1
  98. package/lib/components/Lightbox/Lightbox.types.d.ts +11 -1
  99. package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
  100. package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
  101. package/lib/components/Lightbox/LightboxPdfViewer.js +1 -1
  102. package/lib/components/Lightbox/LightboxPdfViewer.js.map +1 -1
  103. package/lib/components/Location/Location.test-ids.d.ts +1 -1
  104. package/lib/components/Location/Location.test-ids.d.ts.map +1 -1
  105. package/lib/components/Location/LocationInput.d.ts +1 -1
  106. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  107. package/lib/components/Location/LocationInput.js +2 -2
  108. package/lib/components/Location/LocationInput.js.map +1 -1
  109. package/lib/components/Number/Number.test-ids.d.ts +2 -2
  110. package/lib/components/Number/Number.test-ids.d.ts.map +1 -1
  111. package/lib/components/Number/NumberInput.d.ts +1 -1
  112. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  113. package/lib/components/Number/NumberInput.js +2 -2
  114. package/lib/components/Number/NumberInput.js.map +1 -1
  115. package/lib/components/Number/NumberInput.types.d.ts +2 -0
  116. package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
  117. package/lib/components/Number/NumberInput.types.js.map +1 -1
  118. package/lib/components/Number/NumberRangeInput.d.ts +1 -1
  119. package/lib/components/Phone/Phone.test-ids.d.ts +1 -1
  120. package/lib/components/Phone/Phone.test-ids.d.ts.map +1 -1
  121. package/lib/components/Phone/PhoneInput.d.ts +1 -1
  122. package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
  123. package/lib/components/Phone/PhoneInput.js +2 -2
  124. package/lib/components/Phone/PhoneInput.js.map +1 -1
  125. package/lib/components/RadioButton/RadioButton.d.ts +1 -1
  126. package/lib/components/RadioButton/RadioButton.test-ids.d.ts +1 -1
  127. package/lib/components/RadioButton/RadioButton.test-ids.d.ts.map +1 -1
  128. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
  129. package/lib/components/RadioCheck/RadioCheck.d.ts +3 -1
  130. package/lib/components/RadioCheck/RadioCheck.d.ts.map +1 -1
  131. package/lib/components/RadioCheck/RadioCheck.js +2 -2
  132. package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
  133. package/lib/components/RadioCheck/RadioCheck.test-ids.d.ts +1 -1
  134. package/lib/components/RadioCheck/RadioCheck.test-ids.d.ts.map +1 -1
  135. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts +3 -1
  136. package/lib/components/RadioCheckGroup/RadioCheckGroup.d.ts.map +1 -1
  137. package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
  138. package/lib/components/RadioCheckGroup/RadioCheckGroup.test-ids.d.ts +1 -1
  139. package/lib/components/RadioCheckGroup/RadioCheckGroup.test-ids.d.ts.map +1 -1
  140. package/lib/components/RelatedContent/RelatedContentButton.d.ts +17 -0
  141. package/lib/components/RelatedContent/RelatedContentButton.d.ts.map +1 -0
  142. package/lib/components/RelatedContent/RelatedContentButton.js +18 -0
  143. package/lib/components/RelatedContent/RelatedContentButton.js.map +1 -0
  144. package/lib/components/RelatedContent/RelatedContentPanel.d.ts +7 -0
  145. package/lib/components/RelatedContent/RelatedContentPanel.d.ts.map +1 -0
  146. package/lib/components/RelatedContent/RelatedContentPanel.js +136 -0
  147. package/lib/components/RelatedContent/RelatedContentPanel.js.map +1 -0
  148. package/lib/components/RelatedContent/RelatedContentPanel.styles.d.ts +34 -0
  149. package/lib/components/RelatedContent/RelatedContentPanel.styles.d.ts.map +1 -0
  150. package/lib/components/RelatedContent/RelatedContentPanel.styles.js +180 -0
  151. package/lib/components/RelatedContent/RelatedContentPanel.styles.js.map +1 -0
  152. package/lib/components/RelatedContent/RelatedContentPanel.test-ids.d.ts +2 -0
  153. package/lib/components/RelatedContent/RelatedContentPanel.test-ids.d.ts.map +1 -0
  154. package/lib/components/RelatedContent/RelatedContentPanel.test-ids.js +9 -0
  155. package/lib/components/RelatedContent/RelatedContentPanel.test-ids.js.map +1 -0
  156. package/lib/components/RelatedContent/RelatedContentPanel.types.d.ts +21 -0
  157. package/lib/components/RelatedContent/RelatedContentPanel.types.d.ts.map +1 -0
  158. package/lib/components/RelatedContent/RelatedContentPanel.types.js +2 -0
  159. package/lib/components/RelatedContent/RelatedContentPanel.types.js.map +1 -0
  160. package/lib/components/RelatedContent/index.d.ts +7 -0
  161. package/lib/components/RelatedContent/index.d.ts.map +1 -0
  162. package/lib/components/RelatedContent/index.js +5 -0
  163. package/lib/components/RelatedContent/index.js.map +1 -0
  164. package/lib/components/SearchInput/SearchInput.styles.d.ts +1 -1
  165. package/lib/components/Select/Select.d.ts +3 -1
  166. package/lib/components/Select/Select.d.ts.map +1 -1
  167. package/lib/components/Select/Select.js +2 -2
  168. package/lib/components/Select/Select.js.map +1 -1
  169. package/lib/components/Select/Select.test-ids.d.ts +1 -1
  170. package/lib/components/Select/Select.test-ids.d.ts.map +1 -1
  171. package/lib/components/Slider/Slider.d.ts +1 -1
  172. package/lib/components/Slider/Slider.d.ts.map +1 -1
  173. package/lib/components/Slider/Slider.js +2 -2
  174. package/lib/components/Slider/Slider.js.map +1 -1
  175. package/lib/components/Slider/Slider.test-ids.d.ts +1 -1
  176. package/lib/components/Slider/Slider.test-ids.d.ts.map +1 -1
  177. package/lib/components/Slider/Slider.types.d.ts +2 -0
  178. package/lib/components/Slider/Slider.types.d.ts.map +1 -1
  179. package/lib/components/Slider/Slider.types.js.map +1 -1
  180. package/lib/components/TextArea/TextArea.d.ts +1 -1
  181. package/lib/components/TextArea/TextArea.d.ts.map +1 -1
  182. package/lib/components/TextArea/TextArea.js +2 -2
  183. package/lib/components/TextArea/TextArea.js.map +1 -1
  184. package/lib/components/TextArea/TextArea.test-ids.d.ts +1 -1
  185. package/lib/components/TextArea/TextArea.test-ids.d.ts.map +1 -1
  186. package/lib/hooks/useI18n.d.ts +4 -0
  187. package/lib/hooks/useI18n.d.ts.map +1 -1
  188. package/lib/i18n/default.d.ts +4 -0
  189. package/lib/i18n/default.d.ts.map +1 -1
  190. package/lib/i18n/default.js +5 -0
  191. package/lib/i18n/default.js.map +1 -1
  192. package/lib/i18n/i18n.d.ts +4 -0
  193. package/lib/i18n/i18n.d.ts.map +1 -1
  194. package/lib/index.d.ts +1 -0
  195. package/lib/index.d.ts.map +1 -1
  196. package/lib/index.js +1 -0
  197. package/lib/index.js.map +1 -1
  198. package/package.json +1 -1
@@ -32,7 +32,7 @@ export interface PhoneInputProps extends FormControlProps, BaseProps, NoChildren
32
32
  autoComplete?: AutoFillTel;
33
33
  }
34
34
  declare const _default: ForwardRefForwardPropsComponent<PhoneInputProps> & {
35
- getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "country-code", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
35
+ getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "country-code", "label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
36
36
  };
37
37
  export default _default;
38
38
  //# sourceMappingURL=PhoneInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,GAAG,EAAE,MAAM,OAAO,CAAC;AAa/D,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EAEd,UAAU,EACX,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgBvD,OA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GACZ,GAAG,mBAAmB,CAAC,eAAe,CAAC,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,KAAK,CAAC;AAEvI,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU;IAC9F;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,oDAAoD;IACpD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC5B,6CAA6C;IAC7C,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B;;;;AAiOD,wBAA6D"}
@@ -42,7 +42,7 @@ const StyledPhoneInput = styled.div(() => {
42
42
  });
43
43
  StyledPhoneInput.defaultProps = defaultThemeProp;
44
44
  const PhoneInput = forwardRef(function PhoneInput(props, ref) {
45
- const { testId, value, id, label, labelHidden, info, status, required, readOnly, disabled, showCountryCode = false, formattingVariant = 'international', callingCodesList = callingCodes, onChange, onBlur, onFocus, onResolveSuggestion, additionalInfo, className, autoComplete = '_off', ...restProps } = props;
45
+ const { testId, value, id, label, labelHidden, info, status, required, readOnly, disabled, showCountryCode = false, formattingVariant = 'international', callingCodesList = callingCodes, onChange, onBlur, onFocus, onResolveSuggestion, additionalInfo, relatedContent, className, autoComplete = '_off', ...restProps } = props;
46
46
  const testIds = useTestIds(testId, getPhoneInputTestIds);
47
47
  const [selectEl, setSelectEl] = useElement();
48
48
  const [inputEl, setInputEl] = useElement();
@@ -93,7 +93,7 @@ const PhoneInput = forwardRef(function PhoneInput(props, ref) {
93
93
  : autoComplete, ref: setSelectEl, hasSuggestion: status === 'pending' && !!onResolveSuggestion, children: codesOptions }), selectEl && (_jsx(Tooltip, { target: selectEl, describeTarget: false, showDelay: 'none', hideDelay: 'none', children: t('country_code') }))] })), _jsx(Input, { "data-testid": testIds.control, autoComplete: autoComplete && autoComplete.endsWith('tel')
94
94
  ? autoComplete.replace('tel', 'tel-national')
95
95
  : autoComplete, ...restProps, inputMode: 'tel', ref: inputRef, value: formatted, "aria-label": t('enter_a_number'), onChange: onInputChange, required: required, status: status, readOnly: readOnly, disabled: disabled, onResolveSuggestion: onResolveSuggestion, className: createClassName('phone-input', className) }), showCountryCode && inputEl && (_jsx(Tooltip, { target: inputEl, describeTarget: false, showDelay: 'none', hideDelay: 'none', children: t('phone_number') }))] }) }));
96
- return label ? (_jsx(FormField, { testId: testIds, as: 'fieldset', additionalInfo: additionalInfo, label: label, labelHidden: labelHidden, id: id, info: info, readOnly: readOnly, status: status, required: required, disabled: disabled, onResolveSuggestion: onResolveSuggestion, children: Comp })) : (Comp);
96
+ return label ? (_jsx(FormField, { testId: testIds, as: 'fieldset', additionalInfo: additionalInfo, relatedContent: relatedContent, label: label, labelHidden: labelHidden, id: id, info: info, readOnly: readOnly, status: status, required: required, disabled: disabled, onResolveSuggestion: onResolveSuggestion, children: Comp })) : (Comp);
97
97
  });
98
98
  export default withTestIds(PhoneInput, getPhoneInputTestIds);
99
99
  //# sourceMappingURL=PhoneInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneInput.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAA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AC;AAEH,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useRef } from 'react';\nimport type { ChangeEvent, PropsWithoutRef, Ref } from 'react';\nimport { isValidPhoneNumber } from 'libphonenumber-js';\nimport styled, { css } from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useElement,\n useFocusWithin,\n useI18n,\n useInputFormatter,\n useTestIds\n} from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp,\n PropsWithDefaults,\n TestIdProp\n} from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport StyledInput from '../Input/Input.styles';\nimport Select, { Option } from '../Select';\nimport Input from '../Input';\nimport { StyledSelect } from '../Select/Select';\nimport Flex from '../Flex';\nimport { withTestIds, createClassName } from '../../utils';\nimport Tooltip from '../Tooltip';\n\nimport callingCodes from './callingCodes';\nimport {\n convertToCallbackParameter,\n formatPhone,\n formatPhoneNumber,\n getPhoneNumberParts\n} from './utils';\nimport type { PhoneFormattingVariant } from './utils';\nimport { getPhoneInputTestIds } from './Phone.test-ids';\n\ntype AutoFillTel =\n | AutoFillBase\n | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken<AutoFillAddressKind>}${OptionalPrefixToken<AutoFillContactKind>}tel`;\n\nexport interface PhoneInputProps extends FormControlProps, BaseProps, NoChildrenProp, TestIdProp {\n /**\n * Display select with countries calling codes\n * @default false\n */\n showCountryCode?: boolean;\n /**\n * Defines how the subscriber number is formatted while typing when the country code is displayed.\n * When the country code is hidden, domestic formatting is used without the country code.\n * @default 'international'\n * @example international: '+1 123 456 7890'\n * @example domestic: '+1 (123) 456-7890'\n * @example without country code: '(123) 456-7890'\n */\n formattingVariant?: PhoneFormattingVariant;\n /** Changes lists of countries calling codes */\n callingCodesList?: string[];\n /** Callback fired on input value change */\n onChange?: (value: string) => void;\n /** Callback fired when the component loses focus */\n onBlur?: (value: string) => void;\n /** CCallback fired when the component gets focus */\n onFocus?: (value: string) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLInputElement>;\n /** Flag defining autocompletion behavior. */\n autoComplete?: AutoFillTel;\n}\n\ntype PhoneInputPropsWithDefaults = PropsWithDefaults<PhoneInputProps>;\n\nconst StyledPhoneInput = styled.div<PhoneInputPropsWithDefaults>(() => {\n return css`\n border: 0;\n\n > ${StyledSelect} {\n max-width: max-content;\n border-inline-end: none;\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n\n > ${StyledSelect} + ${StyledInput} {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n\n ${StyledSelect},\n ${StyledInput} {\n &:focus {\n z-index: 1;\n }\n }\n `;\n});\n\nStyledPhoneInput.defaultProps = defaultThemeProp;\n\nconst PhoneInput: ForwardRefForwardPropsComponent<PhoneInputProps> = forwardRef(function PhoneInput(\n props: PropsWithoutRef<PhoneInputProps>,\n ref: PhoneInputProps['ref']\n) {\n const {\n testId,\n value,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n showCountryCode = false,\n formattingVariant = 'international',\n callingCodesList = callingCodes,\n onChange,\n onBlur,\n onFocus,\n onResolveSuggestion,\n additionalInfo,\n className,\n autoComplete = '_off',\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getPhoneInputTestIds);\n const [selectEl, setSelectEl] = useElement<HTMLSelectElement>();\n const [inputEl, setInputEl] = useElement<HTMLInputElement>();\n\n const t = useI18n();\n\n const [valueCountryCode, subscriberNumber = ''] = value\n ? getPhoneNumberParts(value, callingCodesList)\n : [];\n const countryCode = valueCountryCode ?? callingCodesList[0];\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(countryCode, subscriberNumber);\n if (focused) onFocus?.(callbackParam);\n else onBlur?.(callbackParam);\n };\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(convertToCallbackParameter(countryCode, e.target.value));\n };\n\n const onSelectChange = (e: ChangeEvent<HTMLSelectElement>) => {\n onChange?.(convertToCallbackParameter(e.target.value, subscriberNumber));\n };\n\n const inputRef = useConsolidatedRef<HTMLInputElement>(ref, setInputEl);\n const containerRef = useRef<HTMLDivElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n const formatter = useCallback(\n (number: string) => {\n if (value && readOnly && showCountryCode) {\n if (isValidPhoneNumber(value)) {\n const formattedPhone = formatPhone(value, {\n nationalFormat: formattingVariant === 'domestic',\n showCountryCode: true\n });\n if (formattedPhone) return formattedPhone;\n }\n\n const formattedNumber = formatPhoneNumber(\n number,\n countryCode,\n formattingVariant === 'international',\n formattingVariant\n );\n const temp = valueCountryCode\n ? [valueCountryCode, formattedNumber].filter(Boolean).join(' ')\n : formattedNumber;\n if (temp) return temp;\n }\n return formatPhoneNumber(\n number,\n countryCode,\n false,\n showCountryCode ? formattingVariant : 'domestic'\n );\n },\n [value, valueCountryCode, readOnly, countryCode, showCountryCode, formattingVariant]\n );\n\n const formatted = useInputFormatter(inputRef, subscriberNumber, formatter);\n\n const codesOptions = (\n <>\n {callingCodesList.map(code => (\n <Option key={code} value={code}>\n {code}\n </Option>\n ))}\n </>\n );\n\n const Comp = (\n <StyledPhoneInput\n data-testid={testIds.root}\n as={StyledFormControl}\n forwardedAs={Flex}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n <>\n {showCountryCode && !readOnly && (\n <>\n <Select\n data-testid={testIds.countryCode}\n value={countryCode}\n aria-label={t('select_country_code')}\n onChange={onSelectChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n autoComplete={\n autoComplete && autoComplete.endsWith('tel')\n ? (autoComplete.replace('tel', 'tel-country-code') as AutoFillTel)\n : autoComplete\n }\n ref={setSelectEl}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n >\n {codesOptions}\n </Select>\n {selectEl && (\n <Tooltip target={selectEl} describeTarget={false} showDelay='none' hideDelay='none'>\n {t('country_code')}\n </Tooltip>\n )}\n </>\n )}\n <Input\n data-testid={testIds.control}\n autoComplete={\n autoComplete && autoComplete.endsWith('tel')\n ? (autoComplete.replace('tel', 'tel-national') as AutoFillTel)\n : autoComplete\n }\n {...restProps}\n inputMode='tel'\n ref={inputRef}\n value={formatted}\n aria-label={t('enter_a_number')}\n onChange={onInputChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n onResolveSuggestion={onResolveSuggestion}\n className={createClassName('phone-input', className)}\n />\n {showCountryCode && inputEl && (\n <Tooltip target={inputEl} describeTarget={false} showDelay='none' hideDelay='none'>\n {t('phone_number')}\n </Tooltip>\n )}\n </>\n </StyledPhoneInput>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n as='fieldset'\n additionalInfo={additionalInfo}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n readOnly={readOnly}\n status={status}\n required={required}\n disabled={disabled}\n onResolveSuggestion={onResolveSuggestion}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n});\n\nexport default withTestIds(PhoneInput, getPhoneInputTestIds);\n"]}
1
+ {"version":3,"file":"PhoneInput.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,OAAO,EACP,iBAAiB,EACjB,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQ/C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC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Ed,SAAS,EACb,SAAS,EAAC,KAAK,EACf,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,SAAS,gBACJ,CAAC,CAAC,gBAAgB,CAAC,EAC/B,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,EAAE,mBAAmB,EACxC,SAAS,EAAE,eAAe,CAAC,aAAa,EAAE,SAAS,CAAC,GACpD,EACD,eAAe,IAAI,OAAO,IAAI,CAC7B,KAAC,OAAO,IAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,YAC/E,CAAC,CAAC,cAAc,CAAC,GACV,CACX,IACA,GACc,CACpB,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,MAAM,EAAE,OAAO,EACf,EAAE,EAAC,UAAU,EACb,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,EAAE,mBAAmB,YAEvC,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useCallback, useRef } from 'react';\nimport type { ChangeEvent, PropsWithoutRef, Ref } from 'react';\nimport { isValidPhoneNumber } from 'libphonenumber-js';\nimport styled, { css } from 'styled-components';\n\nimport {\n useConsolidatedRef,\n useElement,\n useFocusWithin,\n useI18n,\n useInputFormatter,\n useTestIds\n} from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp,\n PropsWithDefaults,\n TestIdProp\n} from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport StyledInput from '../Input/Input.styles';\nimport Select, { Option } from '../Select';\nimport Input from '../Input';\nimport { StyledSelect } from '../Select/Select';\nimport Flex from '../Flex';\nimport { withTestIds, createClassName } from '../../utils';\nimport Tooltip from '../Tooltip';\n\nimport callingCodes from './callingCodes';\nimport {\n convertToCallbackParameter,\n formatPhone,\n formatPhoneNumber,\n getPhoneNumberParts\n} from './utils';\nimport type { PhoneFormattingVariant } from './utils';\nimport { getPhoneInputTestIds } from './Phone.test-ids';\n\ntype AutoFillTel =\n | AutoFillBase\n | `${OptionalPrefixToken<AutoFillSection>}${OptionalPrefixToken<AutoFillAddressKind>}${OptionalPrefixToken<AutoFillContactKind>}tel`;\n\nexport interface PhoneInputProps extends FormControlProps, BaseProps, NoChildrenProp, TestIdProp {\n /**\n * Display select with countries calling codes\n * @default false\n */\n showCountryCode?: boolean;\n /**\n * Defines how the subscriber number is formatted while typing when the country code is displayed.\n * When the country code is hidden, domestic formatting is used without the country code.\n * @default 'international'\n * @example international: '+1 123 456 7890'\n * @example domestic: '+1 (123) 456-7890'\n * @example without country code: '(123) 456-7890'\n */\n formattingVariant?: PhoneFormattingVariant;\n /** Changes lists of countries calling codes */\n callingCodesList?: string[];\n /** Callback fired on input value change */\n onChange?: (value: string) => void;\n /** Callback fired when the component loses focus */\n onBlur?: (value: string) => void;\n /** CCallback fired when the component gets focus */\n onFocus?: (value: string) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLInputElement>;\n /** Flag defining autocompletion behavior. */\n autoComplete?: AutoFillTel;\n}\n\ntype PhoneInputPropsWithDefaults = PropsWithDefaults<PhoneInputProps>;\n\nconst StyledPhoneInput = styled.div<PhoneInputPropsWithDefaults>(() => {\n return css`\n border: 0;\n\n > ${StyledSelect} {\n max-width: max-content;\n border-inline-end: none;\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n\n > ${StyledSelect} + ${StyledInput} {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n\n ${StyledSelect},\n ${StyledInput} {\n &:focus {\n z-index: 1;\n }\n }\n `;\n});\n\nStyledPhoneInput.defaultProps = defaultThemeProp;\n\nconst PhoneInput: ForwardRefForwardPropsComponent<PhoneInputProps> = forwardRef(function PhoneInput(\n props: PropsWithoutRef<PhoneInputProps>,\n ref: PhoneInputProps['ref']\n) {\n const {\n testId,\n value,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n showCountryCode = false,\n formattingVariant = 'international',\n callingCodesList = callingCodes,\n onChange,\n onBlur,\n onFocus,\n onResolveSuggestion,\n additionalInfo,\n relatedContent,\n className,\n autoComplete = '_off',\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getPhoneInputTestIds);\n const [selectEl, setSelectEl] = useElement<HTMLSelectElement>();\n const [inputEl, setInputEl] = useElement<HTMLInputElement>();\n\n const t = useI18n();\n\n const [valueCountryCode, subscriberNumber = ''] = value\n ? getPhoneNumberParts(value, callingCodesList)\n : [];\n const countryCode = valueCountryCode ?? callingCodesList[0];\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(countryCode, subscriberNumber);\n if (focused) onFocus?.(callbackParam);\n else onBlur?.(callbackParam);\n };\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(convertToCallbackParameter(countryCode, e.target.value));\n };\n\n const onSelectChange = (e: ChangeEvent<HTMLSelectElement>) => {\n onChange?.(convertToCallbackParameter(e.target.value, subscriberNumber));\n };\n\n const inputRef = useConsolidatedRef<HTMLInputElement>(ref, setInputEl);\n const containerRef = useRef<HTMLDivElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n const formatter = useCallback(\n (number: string) => {\n if (value && readOnly && showCountryCode) {\n if (isValidPhoneNumber(value)) {\n const formattedPhone = formatPhone(value, {\n nationalFormat: formattingVariant === 'domestic',\n showCountryCode: true\n });\n if (formattedPhone) return formattedPhone;\n }\n\n const formattedNumber = formatPhoneNumber(\n number,\n countryCode,\n formattingVariant === 'international',\n formattingVariant\n );\n const temp = valueCountryCode\n ? [valueCountryCode, formattedNumber].filter(Boolean).join(' ')\n : formattedNumber;\n if (temp) return temp;\n }\n return formatPhoneNumber(\n number,\n countryCode,\n false,\n showCountryCode ? formattingVariant : 'domestic'\n );\n },\n [value, valueCountryCode, readOnly, countryCode, showCountryCode, formattingVariant]\n );\n\n const formatted = useInputFormatter(inputRef, subscriberNumber, formatter);\n\n const codesOptions = (\n <>\n {callingCodesList.map(code => (\n <Option key={code} value={code}>\n {code}\n </Option>\n ))}\n </>\n );\n\n const Comp = (\n <StyledPhoneInput\n data-testid={testIds.root}\n as={StyledFormControl}\n forwardedAs={Flex}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n <>\n {showCountryCode && !readOnly && (\n <>\n <Select\n data-testid={testIds.countryCode}\n value={countryCode}\n aria-label={t('select_country_code')}\n onChange={onSelectChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n autoComplete={\n autoComplete && autoComplete.endsWith('tel')\n ? (autoComplete.replace('tel', 'tel-country-code') as AutoFillTel)\n : autoComplete\n }\n ref={setSelectEl}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n >\n {codesOptions}\n </Select>\n {selectEl && (\n <Tooltip target={selectEl} describeTarget={false} showDelay='none' hideDelay='none'>\n {t('country_code')}\n </Tooltip>\n )}\n </>\n )}\n <Input\n data-testid={testIds.control}\n autoComplete={\n autoComplete && autoComplete.endsWith('tel')\n ? (autoComplete.replace('tel', 'tel-national') as AutoFillTel)\n : autoComplete\n }\n {...restProps}\n inputMode='tel'\n ref={inputRef}\n value={formatted}\n aria-label={t('enter_a_number')}\n onChange={onInputChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n onResolveSuggestion={onResolveSuggestion}\n className={createClassName('phone-input', className)}\n />\n {showCountryCode && inputEl && (\n <Tooltip target={inputEl} describeTarget={false} showDelay='none' hideDelay='none'>\n {t('phone_number')}\n </Tooltip>\n )}\n </>\n </StyledPhoneInput>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n as='fieldset'\n additionalInfo={additionalInfo}\n relatedContent={relatedContent}\n label={label}\n labelHidden={labelHidden}\n id={id}\n info={info}\n readOnly={readOnly}\n status={status}\n required={required}\n disabled={disabled}\n onResolveSuggestion={onResolveSuggestion}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n});\n\nexport default withTestIds(PhoneInput, getPhoneInputTestIds);\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { RadioCheckProps } from '../RadioCheck';
2
2
  export type RadioButtonProps = Omit<RadioCheckProps, 'type'>;
3
3
  declare const _default: import("react").ForwardRefExoticComponent<Omit<RadioButtonProps, "ref"> & import("react").RefAttributes<HTMLInputElement>> & {
4
- getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
4
+ getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
5
5
  };
6
6
  export default _default;
7
7
  //# sourceMappingURL=RadioButton.d.ts.map
@@ -1,3 +1,3 @@
1
- export declare const getRadioButtonTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
1
+ export declare const getRadioButtonTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
2
2
  export declare const getRadioButtonCardTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "content", "image", "label", "actions"]>;
3
3
  //# sourceMappingURL=RadioButton.test-ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButton.test-ids.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,0LAGvB,CAAC;AAEZ,eAAO,MAAM,yBAAyB,oJAG3B,CAAC"}
1
+ {"version":3,"file":"RadioButton.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButton.test-ids.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,6MAGvB,CAAC;AAEZ,eAAO,MAAM,yBAAyB,oJAG3B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { RadioCheckGroupProps } from '../RadioCheckGroup';
2
2
  export type RadioButtonGroupProps = Omit<RadioCheckGroupProps, 'arrowNavigation'>;
3
3
  declare const _default: import("react").ForwardRefExoticComponent<Omit<RadioButtonGroupProps, "ref"> & import("react").RefAttributes<HTMLElement>> & {
4
- getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
4
+ getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
5
5
  };
6
6
  export default _default;
7
7
  //# sourceMappingURL=RadioButtonGroup.d.ts.map
@@ -26,6 +26,8 @@ export type RadioCheckProps = WithAttributes<'input', NoChildrenProp & TestIdPro
26
26
  variant?: 'simple' | 'card';
27
27
  /** Pass a heading and content to show additional information on the field. */
28
28
  additionalInfo?: FormControlProps['additionalInfo'];
29
+ /** Button next to the label that shows the related content of the field. */
30
+ relatedContent?: FormControlProps['relatedContent'];
29
31
  /** info like error, success, warning messages */
30
32
  info?: FormControlProps['info'];
31
33
  /** Callback invoked when this particular radio button is selected. */
@@ -42,7 +44,7 @@ export declare const StyledRadioCheckInput: import("styled-components/dist/types
42
44
  export declare const StyledRadioCheck: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<RadioCheckProps, "disabled" | "readOnly">>> & string;
43
45
  export declare const StyledRadioCheckCard: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, Pick<RadioCheckProps, "disabled" | "readOnly" | "status">>> & string;
44
46
  declare const _default: import("react").ForwardRefExoticComponent<Omit<RadioCheckProps, "ref"> & import("react").RefAttributes<HTMLInputElement>> & {
45
- getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
47
+ getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
46
48
  };
47
49
  export default _default;
48
50
  //# sourceMappingURL=RadioCheck.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioCheck.d.ts","sourceRoot":"","sources":["../../../src/components/RadioCheck/RadioCheck.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA8C,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAK5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAK1F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,uBAAuB,CAAC,CAAC;CACjE,CACJ,CAAC;AAEF,eAAO,MAAM,sBAAsB;kBAC8B,OAAO;YAuCtE,CAAC;AAIH,eAAO,MAAM,qBAAqB,sOAuGhC,CAAC;AAIH,eAAO,MAAM,gBAAgB,mRA8C5B,CAAC;AAIF,eAAO,MAAM,oBAAoB,uSAyD/B,CAAC;;;;AAyIH,wBAA6D"}
@@ -206,7 +206,7 @@ StyledRadioCheckCard.defaultProps = defaultThemeProp;
206
206
  const RadioCheck = forwardRef(function RadioCheck(props, ref) {
207
207
  const uid = useUID();
208
208
  const t = useI18n();
209
- const { testId, type, id = uid, label, 'aria-labelledby': ariaLabelledBy, required = false, disabled = false, readOnly = false, indeterminate = false, checked, defaultChecked, variant = 'simple', onClick, onKeyDown, onChange, status, info, additionalInfo, ariaDescribedby, suppressAnnouncements, className, ...restProps } = props;
209
+ const { testId, type, id = uid, label, 'aria-labelledby': ariaLabelledBy, required = false, disabled = false, readOnly = false, indeterminate = false, checked, defaultChecked, variant = 'simple', onClick, onKeyDown, onChange, status, info, additionalInfo, relatedContent, ariaDescribedby, suppressAnnouncements, className, ...restProps } = props;
210
210
  const testIds = useTestIds(testId, getRadioCheckTestIds);
211
211
  const isRadio = type === 'radio';
212
212
  const card = variant === 'card';
@@ -234,7 +234,7 @@ const RadioCheck = forwardRef(function RadioCheck(props, ref) {
234
234
  };
235
235
  }, []);
236
236
  const labelEmpty = label === null || label === undefined || label === '';
237
- return (_jsx(FormField, { testId: testIds, as: card ? StyledRadioCheckCard : StyledRadioCheck, label: _jsxs(_Fragment, { children: [_jsx(StyledPseudoRadioCheck, { status: status, as: StyledFormControl, required: required, disabled: disabled, readOnly: readOnly, "$labelEmpty": labelEmpty }), label, readOnly && _jsx(HiddenText, { id: readonlyDescId, children: t('read_only') })] }), labelAs: card || ariaLabelledBy ? 'div' : undefined, id: id, required: required, disabled: disabled, readOnly: readOnly, status: status, info: info, isRadioCheck: true, inline: true, labelAfter: true, additionalInfo: additionalInfo, suppressAnnouncements: suppressAnnouncements, children: _jsx(StyledRadioCheckInput, { "data-testid": testIds.control, ...restProps, className: createClassName('radio-check', className, {
237
+ return (_jsx(FormField, { testId: testIds, as: card ? StyledRadioCheckCard : StyledRadioCheck, label: _jsxs(_Fragment, { children: [_jsx(StyledPseudoRadioCheck, { status: status, as: StyledFormControl, required: required, disabled: disabled, readOnly: readOnly, "$labelEmpty": labelEmpty }), label, readOnly && _jsx(HiddenText, { id: readonlyDescId, children: t('read_only') })] }), labelAs: card || ariaLabelledBy ? 'div' : undefined, id: id, required: required, disabled: disabled, readOnly: readOnly, status: status, info: info, isRadioCheck: true, inline: true, labelAfter: true, additionalInfo: additionalInfo, relatedContent: relatedContent, suppressAnnouncements: suppressAnnouncements, children: _jsx(StyledRadioCheckInput, { "data-testid": testIds.control, ...restProps, className: createClassName('radio-check', className, {
238
238
  variant,
239
239
  type
240
240
  }), id: id, "aria-labelledby": ariaLabelledBy, type: type, required: required, checked: checked, defaultChecked: defaultChecked, "aria-describedby": readOnly ? `${ariaDescribedby} ${readonlyDescId}` : ariaDescribedby, disabled: disabled, readOnly: readOnly, onChange: onChange, onClick: (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"RadioCheck.js","sourceRoot":"","sources":["../../../src/components/RadioCheck/RadioCheck.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,SAAS,EAAE,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,WAAW,EAAE,M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,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,sBACZ,QAAQ,CAAC,CAAC,CAAC,GAAG,eAAe,IAAI,cAAc,EAAE,CAAC,CAAC,CAAC,eAAe,EACrF,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAA+B,EAAE,EAAE;gBAC3C,IAAI,QAAQ;oBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;gBACjC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YACf,CAAC,EACD,SAAS,EAAE,CAAC,CAAkC,EAAE,EAAE;gBAChD,IAAI,IAAI,KAAK,UAAU,IAAI,QAAQ,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG;oBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;gBACzE,IAAI,IAAI,KAAK,OAAO,IAAI,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;oBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;gBAChF,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC,EACD,GAAG,EAAE,QAAQ,GACb,GACQ,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useEffect } from 'react';\nimport type { MouseEvent, KeyboardEvent, PropsWithoutRef, ChangeEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport FormField, { StyledFormFieldInfo } from '../FormField';\nimport type { FormFieldProps } from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { defaultThemeProp } from '../../theme';\nimport { createClassName, getActiveElement, tryCatch, withTestIds } from '../../utils';\nimport type { NoChildrenProp, WithAttributes, RefElement, TestIdProp } from '../../types';\nimport { useConsolidatedRef, useDirection, useI18n, useTestIds, useUID } from '../../hooks';\nimport { StyledLabel } from '../Label';\nimport { calculateFontSize, readableColor, getReadableStatusColor } from '../../styles';\nimport HiddenText from '../HiddenText';\nimport type { elements } from '../FormField/FormField.test-ids';\n\nimport { getRadioCheckTestIds } from './RadioCheck.test-ids';\n\nexport type RadioCheckProps = WithAttributes<\n 'input',\n NoChildrenProp &\n TestIdProp<typeof elements> & {\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Sets the type of input. */\n type: 'radio' | 'checkbox';\n /**\n * Sets control to an [indeterminate state](https://css-tricks.com/almanac/selectors/i/indeterminate/#indeterminate-checkboxes).\n * @default false\n */\n indeterminate?: boolean;\n /** Sets checked prop via onChange when using as controlled component. */\n checked?: boolean;\n /** Initialize checked prop when using as uncontrolled component. */\n defaultChecked?: boolean;\n /**\n * Controls the styling of the RadioCheck.\n * @default 'simple'\n */\n variant?: 'simple' | 'card';\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n /** info like error, success, warning messages */\n info?: FormControlProps['info'];\n /** Callback invoked when this particular radio button is selected. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Pass a string used as input's aria-describedby. */\n ariaDescribedby?: string;\n /** Suppresses announcements for status changes. */\n suppressAnnouncements?: FormFieldProps['suppressAnnouncements'];\n }\n>;\n\nexport const StyledPseudoRadioCheck = styled.div<\n Pick<RadioCheckProps, 'readOnly' | 'status'> & { $labelEmpty?: boolean }\n>(({ theme, status, $labelEmpty }) => {\n const {\n components: {\n 'radio-check': {\n size,\n 'touch-size': touchSize,\n 'background-color': backgroundColor,\n 'border-color': borderColor,\n 'border-width': borderWidth\n }\n }\n } = theme;\n\n let statusBorderColor = borderColor;\n if (status === 'error' || status === 'warning') {\n statusBorderColor = getReadableStatusColor(theme, status);\n }\n\n return css`\n display: flex;\n flex-shrink: 0;\n position: relative;\n width: ${size};\n height: ${size};\n margin-inline-end: ${$labelEmpty ? '0' : '1ch'};\n border: ${borderWidth} solid ${statusBorderColor};\n background-color: ${backgroundColor};\n\n @media (pointer: coarse) {\n width: ${touchSize};\n height: ${touchSize};\n }\n\n &::after {\n content: '';\n display: none;\n }\n `;\n});\n\nStyledPseudoRadioCheck.defaultProps = defaultThemeProp;\n\nexport const StyledRadioCheckInput = styled.input(({ theme, disabled, readOnly }) => {\n const {\n base: { 'border-radius': baseBorderRadius },\n components: {\n 'form-control': {\n ':focus': { 'box-shadow': shadow, 'border-color': focusBorderColor },\n ':read-only': { 'background-color': readOnlyBackgroundColor }\n },\n 'radio-check': {\n size,\n ':checked': {\n 'background-color': checkedBackgroundColor,\n 'border-color': checkedBorderColor\n }\n },\n checkbox: { 'border-radius': checkRadius },\n 'radio-button': { 'border-radius': radioRadius }\n }\n } = theme;\n\n const backgroundColor = readOnly ? readOnlyBackgroundColor : checkedBackgroundColor;\n const foreground = tryCatch(() => readableColor(backgroundColor));\n\n const prcSelector = `+ ${StyledLabel} ${StyledPseudoRadioCheck}`;\n const { ltr } = useDirection();\n\n return css`\n ${hideVisually}\n margin: 0;\n\n /* Sets rect size for JAWS focus outline */\n width: ${size};\n height: ${size};\n\n ${!disabled &&\n css`\n &:focus ${prcSelector} {\n box-shadow: ${shadow};\n border-color: ${focusBorderColor};\n }\n `}\n &:checked\n ${prcSelector},\n &:checked:disabled\n ${prcSelector},\n &[type='checkbox']:indeterminate\n ${prcSelector},\n &[type='checkbox']:indeterminate:disabled\n ${prcSelector} {\n border-color: ${readOnly ? 'inherit' : checkedBorderColor};\n background-color: ${backgroundColor};\n\n &::after {\n display: block;\n }\n }\n\n &[type='radio'] ${prcSelector}, &[type='radio'] ${prcSelector}::after {\n border-radius: ${radioRadius};\n }\n\n &[type='radio'] ${prcSelector}::after {\n content: '';\n position: absolute;\n inset: 0;\n margin: auto;\n width: calc(${size} * 0.3);\n height: calc(${size} * 0.3);\n border-radius: ${radioRadius};\n border: calc(${size} * 0.2) solid ${foreground};\n }\n\n &[type='checkbox'] ${prcSelector} {\n border-radius: min(calc(${baseBorderRadius} * ${checkRadius}), 0.25rem);\n }\n\n &[type='checkbox']:not(:indeterminate) ${prcSelector} {\n &::after {\n width: 40%;\n height: 75%;\n ${ltr\n ? css`\n transform: rotate(45deg) translate(50%, -30%);\n `\n : css`\n transform: rotate(45deg) translate(-50%, 30%);\n `}\n border-right: 0.15em solid ${foreground};\n border-bottom: 0.15em solid ${foreground};\n }\n }\n\n &[type='checkbox']:indeterminate ${prcSelector} {\n display: flex;\n\n &::after {\n width: 90%;\n height: 0.15em;\n margin: auto;\n background-color: ${foreground};\n }\n }\n `;\n});\n\nStyledRadioCheckInput.defaultProps = defaultThemeProp;\n\nexport const StyledRadioCheck = styled.div<Pick<RadioCheckProps, 'disabled' | 'readOnly'>>(\n ({ theme, disabled, readOnly }) => {\n const {\n base,\n components: {\n 'radio-check': {\n label: { color: labelColor, 'font-weight': labelFontWeight }\n },\n 'form-control': {\n ':hover': { 'border-color': hoverBorderColor }\n }\n }\n } = theme;\n\n const fontSize = calculateFontSize(base['font-size'], base['font-scale']);\n\n return css`\n > ${StyledLabel} {\n cursor: pointer;\n display: flex;\n align-items: center;\n font-weight: ${labelFontWeight};\n word-break: break-word;\n font-size: ${fontSize.s};\n color: ${labelColor};\n margin: 0;\n min-height: ${base['hit-area']['mouse-min']};\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n }\n\n > ${StyledFormFieldInfo} {\n margin: 0;\n padding-inline-start: calc(${base.spacing} / 4);\n }\n\n ${!(disabled || readOnly) &&\n css`\n &:not(:focus-within) > ${StyledLabel}:hover ${StyledPseudoRadioCheck} {\n border-color: ${hoverBorderColor};\n }\n `}\n `;\n }\n);\n\nStyledRadioCheck.defaultProps = defaultThemeProp;\n\nexport const StyledRadioCheckCard = styled.label<\n Pick<RadioCheckProps, 'disabled' | 'readOnly' | 'status'>\n>(({ theme, disabled, readOnly, status }) => {\n const {\n base: { palette, shadow, spacing },\n components: {\n card,\n 'radio-check': { label },\n 'form-control': {\n ':hover': { 'border-color': hoverBorderColor }\n }\n }\n } = theme;\n\n const useBorderColor =\n status === 'error' ? getReadableStatusColor(theme, 'error') : palette['border-line'];\n\n return css`\n min-width: min-content;\n cursor: pointer;\n background-color: ${card.background};\n border-radius: ${card['border-radius']};\n border: 0.0625rem solid ${useBorderColor};\n padding: ${spacing};\n\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n ${!(disabled || readOnly) &&\n css`\n :hover:not(:focus-within) {\n border-color: ${hoverBorderColor};\n\n ${StyledLabel} ${StyledPseudoRadioCheck} {\n border-color: ${hoverBorderColor};\n }\n }\n\n :focus-within {\n box-shadow: ${shadow.focus};\n border-color: transparent;\n }\n `}\n > ${StyledLabel} {\n display: flex;\n align-items: center;\n color: ${label.color};\n font-weight: ${label['font-weight']};\n margin: 0;\n }\n\n > ${StyledFormFieldInfo} {\n margin: 0;\n padding-inline-start: calc(${spacing} / 4);\n }\n `;\n});\n\nStyledRadioCheckCard.defaultProps = defaultThemeProp;\n\nconst RadioCheck = forwardRef<RefElement<RadioCheckProps>, PropsWithoutRef<RadioCheckProps>>(\n function RadioCheck(props, ref) {\n const uid = useUID();\n const t = useI18n();\n\n const {\n testId,\n type,\n id = uid,\n label,\n 'aria-labelledby': ariaLabelledBy,\n required = false,\n disabled = false,\n readOnly = false,\n indeterminate = false,\n checked,\n defaultChecked,\n variant = 'simple',\n onClick,\n onKeyDown,\n onChange,\n status,\n info,\n additionalInfo,\n ariaDescribedby,\n suppressAnnouncements,\n className,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getRadioCheckTestIds);\n const isRadio = type === 'radio';\n const card = variant === 'card';\n const inputRef = useConsolidatedRef(ref);\n const readonlyDescId = useUID();\n\n useEffect(() => {\n if (!isRadio && inputRef.current) inputRef.current.indeterminate = !!indeterminate;\n }, [inputRef, indeterminate, isRadio]);\n\n // Prevents blur when a user mouse clicks the label to select an input that is actively focused.\n useEffect(() => {\n if (!inputRef.current) return;\n\n const labelEl = inputRef.current.nextSibling;\n\n if (labelEl?.nodeName.toUpperCase() !== 'LABEL') return;\n\n const ac = new AbortController();\n\n labelEl.addEventListener(\n 'mousedown',\n e => {\n if (inputRef.current === getActiveElement()) {\n e.preventDefault();\n }\n },\n { signal: ac.signal }\n );\n\n return () => {\n ac.abort();\n };\n }, []);\n\n const labelEmpty = label === null || label === undefined || label === '';\n\n return (\n <FormField\n testId={testIds}\n as={card ? StyledRadioCheckCard : StyledRadioCheck}\n label={\n <>\n <StyledPseudoRadioCheck\n status={status}\n as={StyledFormControl}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n $labelEmpty={labelEmpty}\n />\n {label}\n {readOnly && <HiddenText id={readonlyDescId}>{t('read_only')}</HiddenText>}\n </>\n }\n labelAs={card || ariaLabelledBy ? 'div' : undefined}\n id={id}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n info={info}\n isRadioCheck\n inline\n labelAfter\n additionalInfo={additionalInfo}\n suppressAnnouncements={suppressAnnouncements}\n >\n <StyledRadioCheckInput\n data-testid={testIds.control}\n {...restProps}\n className={createClassName('radio-check', className, {\n variant,\n type\n })}\n id={id}\n aria-labelledby={ariaLabelledBy}\n type={type}\n required={required}\n checked={checked}\n defaultChecked={defaultChecked}\n aria-describedby={readOnly ? `${ariaDescribedby} ${readonlyDescId}` : ariaDescribedby}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onChange}\n onClick={(e: MouseEvent<HTMLInputElement>) => {\n if (readOnly) e.preventDefault();\n onClick?.(e);\n }}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (type === 'checkbox' && readOnly && e.key === ' ') e.preventDefault();\n if (type === 'radio' && readOnly && e.key.includes('Arrow')) e.preventDefault();\n onKeyDown?.(e);\n }}\n ref={inputRef}\n />\n </FormField>\n );\n }\n);\n\nexport default withTestIds(RadioCheck, getRadioCheckTestIds);\n"]}
1
+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,CAAC,CAAC,CAAC;YACjB,CAAC,EACD,GAAG,EAAE,QAAQ,GACb,GACQ,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { forwardRef, useEffect } from 'react';\nimport type { MouseEvent, KeyboardEvent, PropsWithoutRef, ChangeEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport FormField, { StyledFormFieldInfo } from '../FormField';\nimport type { FormFieldProps } from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { defaultThemeProp } from '../../theme';\nimport { createClassName, getActiveElement, tryCatch, withTestIds } from '../../utils';\nimport type { NoChildrenProp, WithAttributes, RefElement, TestIdProp } from '../../types';\nimport { useConsolidatedRef, useDirection, useI18n, useTestIds, useUID } from '../../hooks';\nimport { StyledLabel } from '../Label';\nimport { calculateFontSize, readableColor, getReadableStatusColor } from '../../styles';\nimport HiddenText from '../HiddenText';\nimport type { elements } from '../FormField/FormField.test-ids';\n\nimport { getRadioCheckTestIds } from './RadioCheck.test-ids';\n\nexport type RadioCheckProps = WithAttributes<\n 'input',\n NoChildrenProp &\n TestIdProp<typeof elements> & {\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Sets the type of input. */\n type: 'radio' | 'checkbox';\n /**\n * Sets control to an [indeterminate state](https://css-tricks.com/almanac/selectors/i/indeterminate/#indeterminate-checkboxes).\n * @default false\n */\n indeterminate?: boolean;\n /** Sets checked prop via onChange when using as controlled component. */\n checked?: boolean;\n /** Initialize checked prop when using as uncontrolled component. */\n defaultChecked?: boolean;\n /**\n * Controls the styling of the RadioCheck.\n * @default 'simple'\n */\n variant?: 'simple' | 'card';\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n /** Button next to the label that shows the related content of the field. */\n relatedContent?: FormControlProps['relatedContent'];\n /** info like error, success, warning messages */\n info?: FormControlProps['info'];\n /** Callback invoked when this particular radio button is selected. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Pass a string used as input's aria-describedby. */\n ariaDescribedby?: string;\n /** Suppresses announcements for status changes. */\n suppressAnnouncements?: FormFieldProps['suppressAnnouncements'];\n }\n>;\n\nexport const StyledPseudoRadioCheck = styled.div<\n Pick<RadioCheckProps, 'readOnly' | 'status'> & { $labelEmpty?: boolean }\n>(({ theme, status, $labelEmpty }) => {\n const {\n components: {\n 'radio-check': {\n size,\n 'touch-size': touchSize,\n 'background-color': backgroundColor,\n 'border-color': borderColor,\n 'border-width': borderWidth\n }\n }\n } = theme;\n\n let statusBorderColor = borderColor;\n if (status === 'error' || status === 'warning') {\n statusBorderColor = getReadableStatusColor(theme, status);\n }\n\n return css`\n display: flex;\n flex-shrink: 0;\n position: relative;\n width: ${size};\n height: ${size};\n margin-inline-end: ${$labelEmpty ? '0' : '1ch'};\n border: ${borderWidth} solid ${statusBorderColor};\n background-color: ${backgroundColor};\n\n @media (pointer: coarse) {\n width: ${touchSize};\n height: ${touchSize};\n }\n\n &::after {\n content: '';\n display: none;\n }\n `;\n});\n\nStyledPseudoRadioCheck.defaultProps = defaultThemeProp;\n\nexport const StyledRadioCheckInput = styled.input(({ theme, disabled, readOnly }) => {\n const {\n base: { 'border-radius': baseBorderRadius },\n components: {\n 'form-control': {\n ':focus': { 'box-shadow': shadow, 'border-color': focusBorderColor },\n ':read-only': { 'background-color': readOnlyBackgroundColor }\n },\n 'radio-check': {\n size,\n ':checked': {\n 'background-color': checkedBackgroundColor,\n 'border-color': checkedBorderColor\n }\n },\n checkbox: { 'border-radius': checkRadius },\n 'radio-button': { 'border-radius': radioRadius }\n }\n } = theme;\n\n const backgroundColor = readOnly ? readOnlyBackgroundColor : checkedBackgroundColor;\n const foreground = tryCatch(() => readableColor(backgroundColor));\n\n const prcSelector = `+ ${StyledLabel} ${StyledPseudoRadioCheck}`;\n const { ltr } = useDirection();\n\n return css`\n ${hideVisually}\n margin: 0;\n\n /* Sets rect size for JAWS focus outline */\n width: ${size};\n height: ${size};\n\n ${!disabled &&\n css`\n &:focus ${prcSelector} {\n box-shadow: ${shadow};\n border-color: ${focusBorderColor};\n }\n `}\n &:checked\n ${prcSelector},\n &:checked:disabled\n ${prcSelector},\n &[type='checkbox']:indeterminate\n ${prcSelector},\n &[type='checkbox']:indeterminate:disabled\n ${prcSelector} {\n border-color: ${readOnly ? 'inherit' : checkedBorderColor};\n background-color: ${backgroundColor};\n\n &::after {\n display: block;\n }\n }\n\n &[type='radio'] ${prcSelector}, &[type='radio'] ${prcSelector}::after {\n border-radius: ${radioRadius};\n }\n\n &[type='radio'] ${prcSelector}::after {\n content: '';\n position: absolute;\n inset: 0;\n margin: auto;\n width: calc(${size} * 0.3);\n height: calc(${size} * 0.3);\n border-radius: ${radioRadius};\n border: calc(${size} * 0.2) solid ${foreground};\n }\n\n &[type='checkbox'] ${prcSelector} {\n border-radius: min(calc(${baseBorderRadius} * ${checkRadius}), 0.25rem);\n }\n\n &[type='checkbox']:not(:indeterminate) ${prcSelector} {\n &::after {\n width: 40%;\n height: 75%;\n ${ltr\n ? css`\n transform: rotate(45deg) translate(50%, -30%);\n `\n : css`\n transform: rotate(45deg) translate(-50%, 30%);\n `}\n border-right: 0.15em solid ${foreground};\n border-bottom: 0.15em solid ${foreground};\n }\n }\n\n &[type='checkbox']:indeterminate ${prcSelector} {\n display: flex;\n\n &::after {\n width: 90%;\n height: 0.15em;\n margin: auto;\n background-color: ${foreground};\n }\n }\n `;\n});\n\nStyledRadioCheckInput.defaultProps = defaultThemeProp;\n\nexport const StyledRadioCheck = styled.div<Pick<RadioCheckProps, 'disabled' | 'readOnly'>>(\n ({ theme, disabled, readOnly }) => {\n const {\n base,\n components: {\n 'radio-check': {\n label: { color: labelColor, 'font-weight': labelFontWeight }\n },\n 'form-control': {\n ':hover': { 'border-color': hoverBorderColor }\n }\n }\n } = theme;\n\n const fontSize = calculateFontSize(base['font-size'], base['font-scale']);\n\n return css`\n > ${StyledLabel} {\n cursor: pointer;\n display: flex;\n align-items: center;\n font-weight: ${labelFontWeight};\n word-break: break-word;\n font-size: ${fontSize.s};\n color: ${labelColor};\n margin: 0;\n min-height: ${base['hit-area']['mouse-min']};\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n }\n\n > ${StyledFormFieldInfo} {\n margin: 0;\n padding-inline-start: calc(${base.spacing} / 4);\n }\n\n ${!(disabled || readOnly) &&\n css`\n &:not(:focus-within) > ${StyledLabel}:hover ${StyledPseudoRadioCheck} {\n border-color: ${hoverBorderColor};\n }\n `}\n `;\n }\n);\n\nStyledRadioCheck.defaultProps = defaultThemeProp;\n\nexport const StyledRadioCheckCard = styled.label<\n Pick<RadioCheckProps, 'disabled' | 'readOnly' | 'status'>\n>(({ theme, disabled, readOnly, status }) => {\n const {\n base: { palette, shadow, spacing },\n components: {\n card,\n 'radio-check': { label },\n 'form-control': {\n ':hover': { 'border-color': hoverBorderColor }\n }\n }\n } = theme;\n\n const useBorderColor =\n status === 'error' ? getReadableStatusColor(theme, 'error') : palette['border-line'];\n\n return css`\n min-width: min-content;\n cursor: pointer;\n background-color: ${card.background};\n border-radius: ${card['border-radius']};\n border: 0.0625rem solid ${useBorderColor};\n padding: ${spacing};\n\n ${disabled &&\n css`\n cursor: not-allowed;\n `}\n ${!(disabled || readOnly) &&\n css`\n :hover:not(:focus-within) {\n border-color: ${hoverBorderColor};\n\n ${StyledLabel} ${StyledPseudoRadioCheck} {\n border-color: ${hoverBorderColor};\n }\n }\n\n :focus-within {\n box-shadow: ${shadow.focus};\n border-color: transparent;\n }\n `}\n > ${StyledLabel} {\n display: flex;\n align-items: center;\n color: ${label.color};\n font-weight: ${label['font-weight']};\n margin: 0;\n }\n\n > ${StyledFormFieldInfo} {\n margin: 0;\n padding-inline-start: calc(${spacing} / 4);\n }\n `;\n});\n\nStyledRadioCheckCard.defaultProps = defaultThemeProp;\n\nconst RadioCheck = forwardRef<RefElement<RadioCheckProps>, PropsWithoutRef<RadioCheckProps>>(\n function RadioCheck(props, ref) {\n const uid = useUID();\n const t = useI18n();\n\n const {\n testId,\n type,\n id = uid,\n label,\n 'aria-labelledby': ariaLabelledBy,\n required = false,\n disabled = false,\n readOnly = false,\n indeterminate = false,\n checked,\n defaultChecked,\n variant = 'simple',\n onClick,\n onKeyDown,\n onChange,\n status,\n info,\n additionalInfo,\n relatedContent,\n ariaDescribedby,\n suppressAnnouncements,\n className,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getRadioCheckTestIds);\n const isRadio = type === 'radio';\n const card = variant === 'card';\n const inputRef = useConsolidatedRef(ref);\n const readonlyDescId = useUID();\n\n useEffect(() => {\n if (!isRadio && inputRef.current) inputRef.current.indeterminate = !!indeterminate;\n }, [inputRef, indeterminate, isRadio]);\n\n // Prevents blur when a user mouse clicks the label to select an input that is actively focused.\n useEffect(() => {\n if (!inputRef.current) return;\n\n const labelEl = inputRef.current.nextSibling;\n\n if (labelEl?.nodeName.toUpperCase() !== 'LABEL') return;\n\n const ac = new AbortController();\n\n labelEl.addEventListener(\n 'mousedown',\n e => {\n if (inputRef.current === getActiveElement()) {\n e.preventDefault();\n }\n },\n { signal: ac.signal }\n );\n\n return () => {\n ac.abort();\n };\n }, []);\n\n const labelEmpty = label === null || label === undefined || label === '';\n\n return (\n <FormField\n testId={testIds}\n as={card ? StyledRadioCheckCard : StyledRadioCheck}\n label={\n <>\n <StyledPseudoRadioCheck\n status={status}\n as={StyledFormControl}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n $labelEmpty={labelEmpty}\n />\n {label}\n {readOnly && <HiddenText id={readonlyDescId}>{t('read_only')}</HiddenText>}\n </>\n }\n labelAs={card || ariaLabelledBy ? 'div' : undefined}\n id={id}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n status={status}\n info={info}\n isRadioCheck\n inline\n labelAfter\n additionalInfo={additionalInfo}\n relatedContent={relatedContent}\n suppressAnnouncements={suppressAnnouncements}\n >\n <StyledRadioCheckInput\n data-testid={testIds.control}\n {...restProps}\n className={createClassName('radio-check', className, {\n variant,\n type\n })}\n id={id}\n aria-labelledby={ariaLabelledBy}\n type={type}\n required={required}\n checked={checked}\n defaultChecked={defaultChecked}\n aria-describedby={readOnly ? `${ariaDescribedby} ${readonlyDescId}` : ariaDescribedby}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onChange}\n onClick={(e: MouseEvent<HTMLInputElement>) => {\n if (readOnly) e.preventDefault();\n onClick?.(e);\n }}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (type === 'checkbox' && readOnly && e.key === ' ') e.preventDefault();\n if (type === 'radio' && readOnly && e.key.includes('Arrow')) e.preventDefault();\n onKeyDown?.(e);\n }}\n ref={inputRef}\n />\n </FormField>\n );\n }\n);\n\nexport default withTestIds(RadioCheck, getRadioCheckTestIds);\n"]}
@@ -1,2 +1,2 @@
1
- export declare const getRadioCheckTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
1
+ export declare const getRadioCheckTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["control", "label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
2
2
  //# sourceMappingURL=RadioCheck.test-ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioCheck.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/RadioCheck/RadioCheck.test-ids.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,0LAAkE,CAAC"}
1
+ {"version":3,"file":"RadioCheck.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/RadioCheck/RadioCheck.test-ids.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,6MAAkE,CAAC"}
@@ -47,6 +47,8 @@ export type RadioCheckGroupProps = WithAttributes<'fieldset', TestIdProp<typeof
47
47
  variant?: RadioCheckProps['variant'] | 'card-grid';
48
48
  /** Pass a heading and content to show additional information on the field. */
49
49
  additionalInfo?: FormControlProps['additionalInfo'];
50
+ /** Button next to the label that shows the related content of the field. */
51
+ relatedContent?: FormControlProps['relatedContent'];
50
52
  /**
51
53
  * Enables arrow key navigation between options in the group.
52
54
  * Disable for checkbox groups where each option is independently selectable.
@@ -58,7 +60,7 @@ export type RadioCheckGroupProps = WithAttributes<'fieldset', TestIdProp<typeof
58
60
  }>;
59
61
  export declare const StyledRadioCheckGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, never>> & string;
60
62
  declare const _default: import("react").ForwardRefExoticComponent<Omit<RadioCheckGroupProps, "ref"> & import("react").RefAttributes<HTMLElement>> & {
61
- getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
63
+ getTestIds: (testIdProp?: TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
62
64
  };
63
65
  export default _default;
64
66
  //# sourceMappingURL=RadioCheckGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioCheckGroup.d.ts","sourceRoot":"","sources":["../../../src/components/RadioCheckGroup/RadioCheckGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,GAAG,EAEH,YAAY,EACZ,WAAW,EAEZ,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAc,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAg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,OAAO;YAEzE,CAAC,CAAC,cAAc,EAAE,CAAC;QACrB,CAAC,YAEA,CAAC,GAAG,EAAE;YACL,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,OAAO,KAAC,UAAU,IAAC,OAAO,EAAC,UAAU,GAAG,CAAC;YAC3C,CAAC;YAED,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,CAC/B,KAAC,cAAc,IACb,GAAG,EAAE,YAAY,EACjB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAEnC,WAAW,GACG,CAClB,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IACH,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE;oBACT,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;oBAC1C,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBAC9B,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClC,IAAI,EAAE,MAAM;iBACb,YAEA,WAAW,GACP,CACR,CAAC;QACJ,CAAC,CAAC,EAAE,GACM,CACb,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { forwardRef, Children, cloneElement, useState, useEffect, useRef, useMemo } from 'react';\nimport type {\n Ref,\n PropsWithoutRef,\n ReactElement,\n ChangeEvent,\n MouseEvent as ReactMouseEvent\n} from 'react';\nimport styled, { css, type DefaultTheme } from 'styled-components';\n\nimport type { RefElement, TestIdProp, WithAttributes } from '../../types';\nimport FormField from '../FormField';\nimport type { FormFieldProps } from '../FormField';\nimport { StyledFormField, StyledFormFieldInfo } from '../FormField/FormField';\nimport type { FormControlProps } from '../FormControl';\nimport type { RadioCheckProps } from '../RadioCheck';\nimport Flex from '../Flex';\nimport { defaultThemeProp } from '../../theme';\nimport { useArrows, useConsolidatedRef, useElement, useTestIds, useUID } from '../../hooks';\nimport {\n StyledImageContainer,\n StyledSelectionCard,\n StyledSelectionCardInline\n} from '../SelectionCard/SelectionCard.styles';\nimport { getActiveElement, withTestIds } from '../../utils';\nimport type { elements } from '../FormField/FormField.test-ids';\nimport { StyledRadioCheck } from '../RadioCheck/RadioCheck';\nimport EmptyState, { StyledEmptyState } from '../EmptyState';\n\nimport { getRadioCheckGroupTestIds } from './RadioCheckGroup.test-ids';\n\nexport type RadioCheckGroupProps = WithAttributes<\n 'fieldset',\n TestIdProp<typeof elements> & {\n /** Accepts Checkboxes or RadioButtons as children. */\n children?: ReactElement | ReactElement[];\n /**\n * Conveniently pass an onChange handler to the group to be notified when any of the inputs change.\n * Additionally, onChange can be passed to individual children.\n * Both handlers will be called, child followed by group.\n */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Callback invoked when the clear button is clicked. If provided will render the clear button. */\n onClear?: FormFieldProps['onClear'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: FormFieldProps['inline'];\n /** Used to toggle the auto stacking feature of an inlined group.\n * @default true\n */\n autoStack?: boolean;\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /**\n * Controls the styling of the child RadioChecks.\n * @default 'simple'\n */\n variant?: RadioCheckProps['variant'] | 'card-grid';\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n /**\n * Enables arrow key navigation between options in the group.\n * Disable for checkbox groups where each option is independently selectable.\n * @default true\n */\n arrowNavigation?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLElement>;\n }\n>;\n\nexport const StyledRadioCheckGroup = styled.fieldset(({ theme }) => {\n return css`\n container-type: inline-size;\n flex-wrap: nowrap;\n\n &[disabled] {\n > ${StyledFormField} {\n opacity: unset;\n }\n }\n\n ${StyledSelectionCard} {\n max-width: 100%;\n }\n\n ${StyledSelectionCardInline} ${StyledImageContainer} {\n /* To enlarge the image containers to the size of the biggest one */\n min-height: 100%;\n }\n\n ${StyledRadioCheck} > ${StyledFormFieldInfo} {\n display: none;\n }\n\n ${StyledEmptyState} {\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-radius: ${theme.components.card['border-radius']};\n padding: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledRadioCheckGroup.defaultProps = defaultThemeProp;\n\nconst getCardGridColumns = (cardWidth: string) => css`\n @container (min-width: calc(2 * ${cardWidth})) {\n grid-template-columns: repeat(2, 1fr);\n }\n\n @container (min-width: calc(3 * ${cardWidth})) {\n grid-template-columns: repeat(3, 1fr);\n }\n\n @container (min-width: calc(4 * ${cardWidth})) {\n grid-template-columns: repeat(4, 1fr);\n }\n`;\n\nconst getCardGridContainerStyles = (theme: DefaultTheme) => {\n const defaultCardWidth = theme.base['content-width'].sm;\n const inlineImageCardWidth = theme.base['content-width'].md;\n return css`\n display: grid;\n gap: ${theme.base.spacing};\n grid-template-columns: 1fr;\n grid-auto-rows: 1fr;\n\n ${getCardGridColumns(defaultCardWidth)}\n\n &:has(${StyledSelectionCardInline}) {\n ${getCardGridColumns(inlineImageCardWidth)}\n }\n `;\n};\n\nconst StyledCardGrid = styled.div<{\n renderInline: boolean;\n autoStack: boolean;\n childCount: number;\n}>(({ theme, renderInline, autoStack, childCount }) => {\n if (!renderInline) {\n return css`\n display: grid;\n gap: ${theme.base.spacing};\n grid-template-columns: minmax(min-content, max-content);\n grid-auto-rows: 1fr;\n `;\n }\n\n return autoStack\n ? getCardGridContainerStyles(theme)\n : css`\n display: grid;\n gap: ${theme.base.spacing};\n grid-template-columns: repeat(${childCount}, 1fr);\n grid-auto-rows: 1fr;\n `;\n});\n\nStyledCardGrid.defaultProps = defaultThemeProp;\n\nconst RadioCheckGroup = forwardRef<\n RefElement<RadioCheckGroupProps>,\n PropsWithoutRef<RadioCheckGroupProps>\n>(function RadioCheckGroup(props, ref) {\n const uid = useUID();\n const {\n testId,\n children,\n name = uid,\n disabled = false,\n required = false,\n onChange,\n readOnly,\n inline = false,\n autoStack = true,\n variant = 'simple',\n arrowNavigation = true,\n onClear,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getRadioCheckGroupTestIds);\n const [optionsEl, setOptionsEl] = useElement<HTMLDivElement>();\n\n const [renderInline, setRenderInline] = useState(inline);\n const renderInlineRef = useRef(inline);\n const minInlineWidth = useRef(0);\n const containerRef = useConsolidatedRef(ref);\n const skipRef = useRef<HTMLElement>(null);\n\n useArrows(\n arrowNavigation ? containerRef : skipRef,\n {\n selector: '[data-main-focus]',\n cycle: false,\n dir: 'both'\n },\n [children]\n );\n\n useEffect(() => {\n setRenderInline(inline);\n if (inline && optionsEl && optionsEl.lastChild && autoStack) {\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (entries[0].intersectionRatio < 1) {\n if (entries[0].rootBounds) minInlineWidth.current = entries[0].rootBounds.width + 1;\n renderInlineRef.current = false;\n setRenderInline(false);\n }\n },\n { root: optionsEl, threshold: 1 }\n );\n\n const resizeObserver = new ResizeObserver(entries => {\n if (!renderInlineRef.current && entries[0].contentRect.width > minInlineWidth.current) {\n renderInlineRef.current = true;\n setRenderInline(true);\n }\n });\n\n intersectionObserver.observe(optionsEl.lastChild as Element);\n resizeObserver.observe(optionsEl);\n\n return () => {\n intersectionObserver.disconnect();\n resizeObserver.disconnect();\n };\n }\n }, [optionsEl, inline, autoStack]);\n\n const mapChildren = useMemo(() => {\n if (!children || Children.toArray(children).filter(Boolean).length === 0) return;\n\n return Children.map(children, child => {\n if (!child) return null;\n return cloneElement(child, {\n name,\n status: restProps.status,\n disabled: disabled || child.props.disabled,\n readOnly: readOnly || child.props.readOnly,\n variant: variant === 'card-grid' ? 'card' : variant,\n suppressAnnouncements: true,\n onChange: onChange\n ? (e: ChangeEvent<HTMLInputElement>) => {\n if (!(readOnly || child.props.readOnly)) {\n child.props.onChange?.(e);\n onChange(e);\n }\n }\n : child.props.onChange\n });\n });\n }, [children, name, disabled, readOnly, variant, onChange]);\n\n return (\n <FormField\n testId={testIds}\n as={StyledRadioCheckGroup}\n ref={containerRef}\n name={name}\n disabled={disabled}\n required={required}\n {...restProps}\n inline={false}\n isRadioCheck\n onClear={onClear}\n // Prevents blur when any input within the group is actively focused.\n onMouseDown={(e: ReactMouseEvent<HTMLFieldSetElement>) => {\n restProps.onMouseDown?.(e);\n\n if (!containerRef.current) return;\n\n if (!containerRef.current.contains(getActiveElement())) return;\n\n if (!(e.target instanceof Element) || !e.target.closest('label')) return;\n\n e.preventDefault();\n }}\n >\n {(() => {\n if (!mapChildren) {\n return <EmptyState variant='bordered' />;\n }\n\n return variant === 'card-grid' ? (\n <StyledCardGrid\n ref={setOptionsEl}\n renderInline={renderInline}\n autoStack={autoStack}\n childCount={Children.count(children)}\n >\n {mapChildren}\n </StyledCardGrid>\n ) : (\n <Flex\n ref={setOptionsEl}\n container={{\n direction: renderInline ? 'row' : 'column',\n colGap: renderInline ? 1.5 : 2,\n rowGap: variant === 'card' ? 1 : 0,\n wrap: 'wrap'\n }}\n >\n {mapChildren}\n </Flex>\n );\n })()}\n </FormField>\n );\n});\n\nexport default withTestIds(RadioCheckGroup, getRadioCheckGroupTestIds);\n"]}
1
+ {"version":3,"file":"RadioCheckGroup.js","sourceRoot":"","sources":["../../../src/components/RadioChe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QAAQ,CAAC,gBAAgB,EAAE,CAAC;gBAAE,OAAO;YAE/D,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;gBAAE,OAAO;YAEzE,CAAC,CAAC,cAAc,EAAE,CAAC;QACrB,CAAC,YAEA,CAAC,GAAG,EAAE;YACL,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,OAAO,KAAC,UAAU,IAAC,OAAO,EAAC,UAAU,GAAG,CAAC;YAC3C,CAAC;YAED,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,CAC/B,KAAC,cAAc,IACb,GAAG,EAAE,YAAY,EACjB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,YAEnC,WAAW,GACG,CAClB,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IACH,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE;oBACT,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;oBAC1C,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBAC9B,MAAM,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClC,IAAI,EAAE,MAAM;iBACb,YAEA,WAAW,GACP,CACR,CAAC;QACJ,CAAC,CAAC,EAAE,GACM,CACb,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { forwardRef, Children, cloneElement, useState, useEffect, useRef, useMemo } from 'react';\nimport type {\n Ref,\n PropsWithoutRef,\n ReactElement,\n ChangeEvent,\n MouseEvent as ReactMouseEvent\n} from 'react';\nimport styled, { css, type DefaultTheme } from 'styled-components';\n\nimport type { RefElement, TestIdProp, WithAttributes } from '../../types';\nimport FormField from '../FormField';\nimport type { FormFieldProps } from '../FormField';\nimport { StyledFormField, StyledFormFieldInfo } from '../FormField/FormField';\nimport type { FormControlProps } from '../FormControl';\nimport type { RadioCheckProps } from '../RadioCheck';\nimport Flex from '../Flex';\nimport { defaultThemeProp } from '../../theme';\nimport { useArrows, useConsolidatedRef, useElement, useTestIds, useUID } from '../../hooks';\nimport {\n StyledImageContainer,\n StyledSelectionCard,\n StyledSelectionCardInline\n} from '../SelectionCard/SelectionCard.styles';\nimport { getActiveElement, withTestIds } from '../../utils';\nimport type { elements } from '../FormField/FormField.test-ids';\nimport { StyledRadioCheck } from '../RadioCheck/RadioCheck';\nimport EmptyState, { StyledEmptyState } from '../EmptyState';\n\nimport { getRadioCheckGroupTestIds } from './RadioCheckGroup.test-ids';\n\nexport type RadioCheckGroupProps = WithAttributes<\n 'fieldset',\n TestIdProp<typeof elements> & {\n /** Accepts Checkboxes or RadioButtons as children. */\n children?: ReactElement | ReactElement[];\n /**\n * Conveniently pass an onChange handler to the group to be notified when any of the inputs change.\n * Additionally, onChange can be passed to individual children.\n * Both handlers will be called, child followed by group.\n */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Callback invoked when the clear button is clicked. If provided will render the clear button. */\n onClear?: FormFieldProps['onClear'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /**\n * Layout field elements inline in a row.\n * @default false\n */\n inline?: FormFieldProps['inline'];\n /** Used to toggle the auto stacking feature of an inlined group.\n * @default true\n */\n autoStack?: boolean;\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /**\n * Controls the styling of the child RadioChecks.\n * @default 'simple'\n */\n variant?: RadioCheckProps['variant'] | 'card-grid';\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n /** Button next to the label that shows the related content of the field. */\n relatedContent?: FormControlProps['relatedContent'];\n /**\n * Enables arrow key navigation between options in the group.\n * Disable for checkbox groups where each option is independently selectable.\n * @default true\n */\n arrowNavigation?: boolean;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLElement>;\n }\n>;\n\nexport const StyledRadioCheckGroup = styled.fieldset(({ theme }) => {\n return css`\n container-type: inline-size;\n flex-wrap: nowrap;\n\n &[disabled] {\n > ${StyledFormField} {\n opacity: unset;\n }\n }\n\n ${StyledSelectionCard} {\n max-width: 100%;\n }\n\n ${StyledSelectionCardInline} ${StyledImageContainer} {\n /* To enlarge the image containers to the size of the biggest one */\n min-height: 100%;\n }\n\n ${StyledRadioCheck} > ${StyledFormFieldInfo} {\n display: none;\n }\n\n ${StyledEmptyState} {\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-radius: ${theme.components.card['border-radius']};\n padding: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledRadioCheckGroup.defaultProps = defaultThemeProp;\n\nconst getCardGridColumns = (cardWidth: string) => css`\n @container (min-width: calc(2 * ${cardWidth})) {\n grid-template-columns: repeat(2, 1fr);\n }\n\n @container (min-width: calc(3 * ${cardWidth})) {\n grid-template-columns: repeat(3, 1fr);\n }\n\n @container (min-width: calc(4 * ${cardWidth})) {\n grid-template-columns: repeat(4, 1fr);\n }\n`;\n\nconst getCardGridContainerStyles = (theme: DefaultTheme) => {\n const defaultCardWidth = theme.base['content-width'].sm;\n const inlineImageCardWidth = theme.base['content-width'].md;\n return css`\n display: grid;\n gap: ${theme.base.spacing};\n grid-template-columns: 1fr;\n grid-auto-rows: 1fr;\n\n ${getCardGridColumns(defaultCardWidth)}\n\n &:has(${StyledSelectionCardInline}) {\n ${getCardGridColumns(inlineImageCardWidth)}\n }\n `;\n};\n\nconst StyledCardGrid = styled.div<{\n renderInline: boolean;\n autoStack: boolean;\n childCount: number;\n}>(({ theme, renderInline, autoStack, childCount }) => {\n if (!renderInline) {\n return css`\n display: grid;\n gap: ${theme.base.spacing};\n grid-template-columns: minmax(min-content, max-content);\n grid-auto-rows: 1fr;\n `;\n }\n\n return autoStack\n ? getCardGridContainerStyles(theme)\n : css`\n display: grid;\n gap: ${theme.base.spacing};\n grid-template-columns: repeat(${childCount}, 1fr);\n grid-auto-rows: 1fr;\n `;\n});\n\nStyledCardGrid.defaultProps = defaultThemeProp;\n\nconst RadioCheckGroup = forwardRef<\n RefElement<RadioCheckGroupProps>,\n PropsWithoutRef<RadioCheckGroupProps>\n>(function RadioCheckGroup(props, ref) {\n const uid = useUID();\n const {\n testId,\n children,\n name = uid,\n disabled = false,\n required = false,\n onChange,\n readOnly,\n inline = false,\n autoStack = true,\n variant = 'simple',\n arrowNavigation = true,\n onClear,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getRadioCheckGroupTestIds);\n const [optionsEl, setOptionsEl] = useElement<HTMLDivElement>();\n\n const [renderInline, setRenderInline] = useState(inline);\n const renderInlineRef = useRef(inline);\n const minInlineWidth = useRef(0);\n const containerRef = useConsolidatedRef(ref);\n const skipRef = useRef<HTMLElement>(null);\n\n useArrows(\n arrowNavigation ? containerRef : skipRef,\n {\n selector: '[data-main-focus]',\n cycle: false,\n dir: 'both'\n },\n [children]\n );\n\n useEffect(() => {\n setRenderInline(inline);\n if (inline && optionsEl && optionsEl.lastChild && autoStack) {\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (entries[0].intersectionRatio < 1) {\n if (entries[0].rootBounds) minInlineWidth.current = entries[0].rootBounds.width + 1;\n renderInlineRef.current = false;\n setRenderInline(false);\n }\n },\n { root: optionsEl, threshold: 1 }\n );\n\n const resizeObserver = new ResizeObserver(entries => {\n if (!renderInlineRef.current && entries[0].contentRect.width > minInlineWidth.current) {\n renderInlineRef.current = true;\n setRenderInline(true);\n }\n });\n\n intersectionObserver.observe(optionsEl.lastChild as Element);\n resizeObserver.observe(optionsEl);\n\n return () => {\n intersectionObserver.disconnect();\n resizeObserver.disconnect();\n };\n }\n }, [optionsEl, inline, autoStack]);\n\n const mapChildren = useMemo(() => {\n if (!children || Children.toArray(children).filter(Boolean).length === 0) return;\n\n return Children.map(children, child => {\n if (!child) return null;\n return cloneElement(child, {\n name,\n status: restProps.status,\n disabled: disabled || child.props.disabled,\n readOnly: readOnly || child.props.readOnly,\n variant: variant === 'card-grid' ? 'card' : variant,\n suppressAnnouncements: true,\n onChange: onChange\n ? (e: ChangeEvent<HTMLInputElement>) => {\n if (!(readOnly || child.props.readOnly)) {\n child.props.onChange?.(e);\n onChange(e);\n }\n }\n : child.props.onChange\n });\n });\n }, [children, name, disabled, readOnly, variant, onChange]);\n\n return (\n <FormField\n testId={testIds}\n as={StyledRadioCheckGroup}\n ref={containerRef}\n name={name}\n disabled={disabled}\n required={required}\n {...restProps}\n inline={false}\n isRadioCheck\n onClear={onClear}\n // Prevents blur when any input within the group is actively focused.\n onMouseDown={(e: ReactMouseEvent<HTMLFieldSetElement>) => {\n restProps.onMouseDown?.(e);\n\n if (!containerRef.current) return;\n\n if (!containerRef.current.contains(getActiveElement())) return;\n\n if (!(e.target instanceof Element) || !e.target.closest('label')) return;\n\n e.preventDefault();\n }}\n >\n {(() => {\n if (!mapChildren) {\n return <EmptyState variant='bordered' />;\n }\n\n return variant === 'card-grid' ? (\n <StyledCardGrid\n ref={setOptionsEl}\n renderInline={renderInline}\n autoStack={autoStack}\n childCount={Children.count(children)}\n >\n {mapChildren}\n </StyledCardGrid>\n ) : (\n <Flex\n ref={setOptionsEl}\n container={{\n direction: renderInline ? 'row' : 'column',\n colGap: renderInline ? 1.5 : 2,\n rowGap: variant === 'card' ? 1 : 0,\n wrap: 'wrap'\n }}\n >\n {mapChildren}\n </Flex>\n );\n })()}\n </FormField>\n );\n});\n\nexport default withTestIds(RadioCheckGroup, getRadioCheckGroupTestIds);\n"]}
@@ -1,2 +1,2 @@
1
- export declare const getRadioCheckGroupTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
1
+ export declare const getRadioCheckGroupTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["label", "info", "additional-info", "related-content", "suggestion-accept", "suggestion-reject"]>;
2
2
  //# sourceMappingURL=RadioCheckGroup.test-ids.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioCheckGroup.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/RadioCheckGroup/RadioCheckGroup.test-ids.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,+KAA6D,CAAC"}
1
+ {"version":3,"file":"RadioCheckGroup.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/RadioCheckGroup/RadioCheckGroup.test-ids.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,kMAA6D,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { WithAttributes } from '../../types';
2
+ export type RelatedContentButtonProps = WithAttributes<'button', {
3
+ onClick: () => void;
4
+ /**
5
+ * Used for the button tooltip and accessible label.
6
+ * @default the localized "Show content"
7
+ */
8
+ label?: string;
9
+ /** Used for the accessible button label. If not provided, `label` is used. */
10
+ contextualLabel?: string;
11
+ }>;
12
+ export declare const StyledRelatedContentButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("../Button").ButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("../..").ForwardProps, "ref"> & {
13
+ ref?: ((instance: HTMLAnchorElement | HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
14
+ }, never>> & string & Omit<import("../..").ForwardRefForwardPropsComponent<import("../Button").ButtonProps>, keyof import("react").Component<any, {}, any>>;
15
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<RelatedContentButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
16
+ export default _default;
17
+ //# sourceMappingURL=RelatedContentButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelatedContentButton.d.ts","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentButton.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ9D,MAAM,MAAM,yBAAyB,GAAG,cAAc,CACpD,QAAQ,EACR;IACE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CACF,CAAC;AAEF,eAAO,MAAM,0BAA0B;;2JAAmB,CAAC;;AAI3D,wBAsBG"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import styled from 'styled-components';
4
+ import Icon, { registerIcon } from '../Icon';
5
+ import { defaultThemeProp } from '../../theme';
6
+ import Button from '../Button';
7
+ import { useI18n } from '../../hooks';
8
+ import * as relatedContentIcon from '../Icon/icons/related-content.icon';
9
+ registerIcon(relatedContentIcon);
10
+ export const StyledRelatedContentButton = styled(Button) ``;
11
+ StyledRelatedContentButton.defaultProps = defaultThemeProp;
12
+ export default forwardRef(function RelatedContentButton(props, ref) {
13
+ const t = useI18n();
14
+ const { label = t('show_adjacent_content'), contextualLabel, onClick, ...restProps } = props;
15
+ const accessibleLabel = contextualLabel ? `${label} - ${contextualLabel}` : label;
16
+ return (_jsx(StyledRelatedContentButton, { ...restProps, ref: ref, variant: 'simple', label: label, compact: true, icon: true, onClick: onClick, "aria-label": accessibleLabel, children: _jsx(Icon, { name: 'related-content' }) }));
17
+ });
18
+ //# sourceMappingURL=RelatedContentButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelatedContentButton.js","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,kBAAkB,MAAM,oCAAoC,CAAC;AAEzE,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAgBjC,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA,EAAE,CAAC;AAE3D,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3D,eAAe,UAAU,CAGvB,SAAS,oBAAoB,CAAC,KAAK,EAAE,GAAG;IACxC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,KAAK,GAAG,CAAC,CAAC,uBAAuB,CAAC,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAC7F,MAAM,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,eAAe,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAElF,OAAO,CACL,KAAC,0BAA0B,OACrB,SAAS,EACb,GAAG,EAAE,GAAG,EACR,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,QACP,IAAI,QACJ,OAAO,EAAE,OAAO,gBACJ,eAAe,YAE3B,KAAC,IAAI,IAAC,IAAI,EAAC,iBAAiB,GAAG,GACJ,CAC9B,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport styled from 'styled-components';\n\nimport Icon, { registerIcon } from '../Icon';\nimport type { RefElement, WithAttributes } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Button from '../Button';\nimport { useI18n } from '../../hooks';\nimport * as relatedContentIcon from '../Icon/icons/related-content.icon';\n\nregisterIcon(relatedContentIcon);\n\nexport type RelatedContentButtonProps = WithAttributes<\n 'button',\n {\n onClick: () => void;\n /**\n * Used for the button tooltip and accessible label.\n * @default the localized \"Show content\"\n */\n label?: string;\n /** Used for the accessible button label. If not provided, `label` is used. */\n contextualLabel?: string;\n }\n>;\n\nexport const StyledRelatedContentButton = styled(Button)``;\n\nStyledRelatedContentButton.defaultProps = defaultThemeProp;\n\nexport default forwardRef<\n RefElement<RelatedContentButtonProps>,\n PropsWithoutRef<RelatedContentButtonProps>\n>(function RelatedContentButton(props, ref) {\n const t = useI18n();\n const { label = t('show_adjacent_content'), contextualLabel, onClick, ...restProps } = props;\n const accessibleLabel = contextualLabel ? `${label} - ${contextualLabel}` : label;\n\n return (\n <StyledRelatedContentButton\n {...restProps}\n ref={ref}\n variant='simple'\n label={label}\n compact\n icon\n onClick={onClick}\n aria-label={accessibleLabel}\n >\n <Icon name='related-content' />\n </StyledRelatedContentButton>\n );\n});\n"]}
@@ -0,0 +1,7 @@
1
+ import type { WithAttributes } from '../../types';
2
+ import type { RelatedContentPanelProps } from './RelatedContentPanel.types';
3
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<WithAttributes<"div", RelatedContentPanelProps>, "ref"> & import("react").RefAttributes<HTMLDivElement>> & {
4
+ getTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly ["header", "title", "metadata", "collapse-toggle", "secondary"]>;
5
+ };
6
+ export default _default;
7
+ //# sourceMappingURL=RelatedContentPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RelatedContentPanel.d.ts","sourceRoot":"","sources":["../../../src/components/RelatedContent/RelatedContentPanel.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;;;;AAiO5E,wBAA+E"}