@chayns-components/core 5.4.7 → 5.4.8-alpha.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 (462) hide show
  1. package/AGENTS.md +12 -0
  2. package/lib/cjs/components/accordion/Accordion.js +107 -12
  3. package/lib/cjs/components/accordion/Accordion.js.map +1 -1
  4. package/lib/cjs/components/accordion/Accordion.styles.js +23 -3
  5. package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
  6. package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
  7. package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  8. package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js +36 -19
  9. package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  10. package/lib/cjs/components/accordion/accordion-head/AccordionHead.js +6 -3
  11. package/lib/cjs/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  12. package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
  13. package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  14. package/lib/cjs/components/amount-control/AmountControl.js +31 -17
  15. package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
  16. package/lib/cjs/components/amount-control/AmountControl.styles.js +18 -2
  17. package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
  18. package/lib/cjs/components/button/Button.js +5 -1
  19. package/lib/cjs/components/button/Button.js.map +1 -1
  20. package/lib/cjs/components/button/Button.styles.js +10 -0
  21. package/lib/cjs/components/button/Button.styles.js.map +1 -1
  22. package/lib/cjs/components/button/Button.types.js.map +1 -1
  23. package/lib/cjs/components/checkbox/Checkbox.js +5 -1
  24. package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
  25. package/lib/cjs/components/checkbox/Checkbox.styles.js +29 -2
  26. package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
  27. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
  28. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  29. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
  30. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  31. package/lib/cjs/components/combobox/ComboBox.js +68 -11
  32. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  33. package/lib/cjs/components/combobox/ComboBox.styles.js +11 -0
  34. package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
  35. package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -1
  36. package/lib/cjs/components/context-menu/ContextMenu.js +146 -42
  37. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  38. package/lib/cjs/components/context-menu/ContextMenu.styles.js +38 -0
  39. package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
  40. package/lib/cjs/components/context-menu/ContextMenu.types.js.map +1 -1
  41. package/lib/cjs/components/context-menu/ContextMenu.utils.js +27 -1
  42. package/lib/cjs/components/context-menu/ContextMenu.utils.js.map +1 -1
  43. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js +3 -8
  44. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  45. package/lib/cjs/components/file-input/FileInput.js +4 -2
  46. package/lib/cjs/components/file-input/FileInput.js.map +1 -1
  47. package/lib/cjs/components/file-list/file-item/FileItem.js +48 -25
  48. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  49. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +25 -1
  50. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  51. package/lib/cjs/components/file-select/FileSelect.js +27 -4
  52. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  53. package/lib/cjs/components/file-select/FileSelect.styles.js +10 -0
  54. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  55. package/lib/cjs/components/filter/Filter.js +51 -16
  56. package/lib/cjs/components/filter/Filter.js.map +1 -1
  57. package/lib/cjs/components/filter/Filter.styles.js +9 -0
  58. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  59. package/lib/cjs/components/filter/filter-content/FilterContent.js +14 -5
  60. package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
  61. package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -1
  62. package/lib/cjs/components/filter-buttons/FilterButtons.js +69 -4
  63. package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
  64. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +40 -2
  65. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  66. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
  67. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  68. package/lib/cjs/components/grid-image/GridImage.js +20 -2
  69. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  70. package/lib/cjs/components/grid-image/GridImage.styles.js +11 -2
  71. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  72. package/lib/cjs/components/grouped-image/GroupedImage.js +23 -4
  73. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  74. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +9 -0
  75. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  76. package/lib/cjs/components/highlight-slider/HighlightSlider.js +13 -3
  77. package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
  78. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +21 -4
  79. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  80. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +11 -2
  81. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  82. package/lib/cjs/components/icon/Icon.js +24 -5
  83. package/lib/cjs/components/icon/Icon.js.map +1 -1
  84. package/lib/cjs/components/icon/Icon.styles.js +23 -0
  85. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  86. package/lib/cjs/components/input/Input.js +29 -8
  87. package/lib/cjs/components/input/Input.js.map +1 -1
  88. package/lib/cjs/components/input/Input.styles.js +38 -3
  89. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  90. package/lib/cjs/components/list/List.js +124 -37
  91. package/lib/cjs/components/list/List.js.map +1 -1
  92. package/lib/cjs/components/list/List.utils.js +213 -1
  93. package/lib/cjs/components/list/List.utils.js.map +1 -1
  94. package/lib/cjs/components/list/list-item/ListItem.js +84 -3
  95. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  96. package/lib/cjs/components/list/list-item/ListItem.styles.js +7 -0
  97. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  98. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -1
  99. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  100. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js +5 -1
  101. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  102. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +1 -0
  103. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  104. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +3 -0
  105. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  106. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -0
  107. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  108. package/lib/cjs/components/list/list-item/useListItemFocus.js +47 -0
  109. package/lib/cjs/components/list/list-item/useListItemFocus.js.map +1 -0
  110. package/lib/cjs/components/mention-finder/MentionFinder.js +43 -5
  111. package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
  112. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  113. package/lib/cjs/components/multi-action-button/MultiActionButton.js +36 -3
  114. package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
  115. package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js +6 -0
  116. package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
  117. package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  118. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +7 -1
  119. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  120. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
  121. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  122. package/lib/cjs/components/number-input/NumberInput.js +13 -10
  123. package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
  124. package/lib/cjs/components/page-provider/PageProvider.js +4 -2
  125. package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
  126. package/lib/cjs/components/popup/Popup.js +8 -1
  127. package/lib/cjs/components/popup/Popup.js.map +1 -1
  128. package/lib/cjs/components/radio-button/RadioButton.js +29 -15
  129. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  130. package/lib/cjs/components/radio-button/RadioButton.styles.js +19 -8
  131. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  132. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
  133. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  134. package/lib/cjs/components/search-box/SearchBox.js +21 -6
  135. package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
  136. package/lib/cjs/components/search-input/SearchInput.js +56 -43
  137. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  138. package/lib/cjs/components/search-input/SearchInput.styles.js +26 -2
  139. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  140. package/lib/cjs/components/select-button/SelectButton.js +4 -2
  141. package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
  142. package/lib/cjs/components/setup-wizard/SetupWizard.js +10 -4
  143. package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
  144. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
  145. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  146. package/lib/cjs/components/sharing-bar/SharingBar.js +31 -6
  147. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  148. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +5 -0
  149. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  150. package/lib/cjs/components/sharing-button/SharingButton.js +4 -2
  151. package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
  152. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +3 -1
  153. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  154. package/lib/cjs/components/signature/Signature.js +6 -3
  155. package/lib/cjs/components/signature/Signature.js.map +1 -1
  156. package/lib/cjs/components/slider/Slider.js +30 -7
  157. package/lib/cjs/components/slider/Slider.js.map +1 -1
  158. package/lib/cjs/components/slider/Slider.styles.js +9 -2
  159. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  160. package/lib/cjs/components/slider-button/SliderButton.js +63 -6
  161. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  162. package/lib/cjs/components/slider-button/SliderButton.styles.js +15 -2
  163. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  164. package/lib/cjs/components/slider-button/SliderButton.types.js +6 -0
  165. package/lib/cjs/components/slider-button/SliderButton.types.js.map +1 -0
  166. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +66 -0
  167. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
  168. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +47 -0
  169. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
  170. package/lib/cjs/components/tag-input/TagInput.js +92 -36
  171. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  172. package/lib/cjs/components/tag-input/TagInput.styles.js +29 -3
  173. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  174. package/lib/cjs/components/text-area/TextArea.js +17 -8
  175. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  176. package/lib/cjs/components/text-area/TextArea.styles.js +15 -1
  177. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  178. package/lib/cjs/components/truncation/Truncation.js +17 -3
  179. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  180. package/lib/cjs/components/truncation/Truncation.styles.js +18 -1
  181. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  182. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +68 -0
  183. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -0
  184. package/lib/cjs/utils/file.js.map +1 -1
  185. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +29 -0
  186. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +1 -0
  187. package/lib/esm/components/accordion/Accordion.js +105 -12
  188. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  189. package/lib/esm/components/accordion/Accordion.styles.js +23 -3
  190. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  191. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
  192. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  193. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +33 -19
  194. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  195. package/lib/esm/components/accordion/accordion-head/AccordionHead.js +6 -3
  196. package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  197. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
  198. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  199. package/lib/esm/components/amount-control/AmountControl.js +30 -16
  200. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  201. package/lib/esm/components/amount-control/AmountControl.styles.js +18 -2
  202. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  203. package/lib/esm/components/button/Button.js +5 -1
  204. package/lib/esm/components/button/Button.js.map +1 -1
  205. package/lib/esm/components/button/Button.styles.js +10 -0
  206. package/lib/esm/components/button/Button.styles.js.map +1 -1
  207. package/lib/esm/components/button/Button.types.js.map +1 -1
  208. package/lib/esm/components/checkbox/Checkbox.js +5 -1
  209. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  210. package/lib/esm/components/checkbox/Checkbox.styles.js +29 -2
  211. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  212. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
  213. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  214. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
  215. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  216. package/lib/esm/components/combobox/ComboBox.js +61 -7
  217. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  218. package/lib/esm/components/combobox/ComboBox.styles.js +11 -0
  219. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  220. package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
  221. package/lib/esm/components/context-menu/ContextMenu.js +145 -42
  222. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  223. package/lib/esm/components/context-menu/ContextMenu.styles.js +38 -0
  224. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  225. package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
  226. package/lib/esm/components/context-menu/ContextMenu.utils.js +24 -0
  227. package/lib/esm/components/context-menu/ContextMenu.utils.js.map +1 -1
  228. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js +3 -8
  229. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  230. package/lib/esm/components/file-input/FileInput.js +4 -2
  231. package/lib/esm/components/file-input/FileInput.js.map +1 -1
  232. package/lib/esm/components/file-list/file-item/FileItem.js +49 -26
  233. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  234. package/lib/esm/components/file-list/file-item/FileItem.styles.js +24 -0
  235. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  236. package/lib/esm/components/file-select/FileSelect.js +27 -4
  237. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  238. package/lib/esm/components/file-select/FileSelect.styles.js +10 -0
  239. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  240. package/lib/esm/components/filter/Filter.js +52 -16
  241. package/lib/esm/components/filter/Filter.js.map +1 -1
  242. package/lib/esm/components/filter/Filter.styles.js +9 -0
  243. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  244. package/lib/esm/components/filter/filter-content/FilterContent.js +15 -5
  245. package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
  246. package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -1
  247. package/lib/esm/components/filter-buttons/FilterButtons.js +69 -5
  248. package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
  249. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +40 -2
  250. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  251. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
  252. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  253. package/lib/esm/components/grid-image/GridImage.js +20 -2
  254. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  255. package/lib/esm/components/grid-image/GridImage.styles.js +10 -1
  256. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  257. package/lib/esm/components/grouped-image/GroupedImage.js +22 -4
  258. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  259. package/lib/esm/components/grouped-image/GroupedImage.styles.js +9 -0
  260. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  261. package/lib/esm/components/highlight-slider/HighlightSlider.js +13 -3
  262. package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
  263. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +20 -3
  264. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  265. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +10 -1
  266. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  267. package/lib/esm/components/icon/Icon.js +26 -7
  268. package/lib/esm/components/icon/Icon.js.map +1 -1
  269. package/lib/esm/components/icon/Icon.styles.js +23 -0
  270. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  271. package/lib/esm/components/input/Input.js +24 -4
  272. package/lib/esm/components/input/Input.js.map +1 -1
  273. package/lib/esm/components/input/Input.styles.js +38 -3
  274. package/lib/esm/components/input/Input.styles.js.map +1 -1
  275. package/lib/esm/components/list/List.js +123 -37
  276. package/lib/esm/components/list/List.js.map +1 -1
  277. package/lib/esm/components/list/List.utils.js +202 -0
  278. package/lib/esm/components/list/List.utils.js.map +1 -1
  279. package/lib/esm/components/list/list-item/ListItem.js +85 -4
  280. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  281. package/lib/esm/components/list/list-item/ListItem.styles.js +7 -0
  282. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  283. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +6 -2
  284. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  285. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js +4 -0
  286. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  287. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +1 -0
  288. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  289. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +4 -1
  290. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  291. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -0
  292. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  293. package/lib/esm/components/list/list-item/useListItemFocus.js +40 -0
  294. package/lib/esm/components/list/list-item/useListItemFocus.js.map +1 -0
  295. package/lib/esm/components/mention-finder/MentionFinder.js +39 -3
  296. package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
  297. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  298. package/lib/esm/components/multi-action-button/MultiActionButton.js +36 -3
  299. package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
  300. package/lib/esm/components/multi-action-button/MultiActionButton.styles.js +6 -0
  301. package/lib/esm/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
  302. package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  303. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -1
  304. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  305. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
  306. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  307. package/lib/esm/components/number-input/NumberInput.js +13 -10
  308. package/lib/esm/components/number-input/NumberInput.js.map +1 -1
  309. package/lib/esm/components/page-provider/PageProvider.js +4 -2
  310. package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
  311. package/lib/esm/components/popup/Popup.js +8 -1
  312. package/lib/esm/components/popup/Popup.js.map +1 -1
  313. package/lib/esm/components/radio-button/RadioButton.js +29 -15
  314. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  315. package/lib/esm/components/radio-button/RadioButton.styles.js +19 -8
  316. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  317. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
  318. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  319. package/lib/esm/components/search-box/SearchBox.js +18 -4
  320. package/lib/esm/components/search-box/SearchBox.js.map +1 -1
  321. package/lib/esm/components/search-input/SearchInput.js +56 -44
  322. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  323. package/lib/esm/components/search-input/SearchInput.styles.js +25 -1
  324. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  325. package/lib/esm/components/select-button/SelectButton.js +4 -2
  326. package/lib/esm/components/select-button/SelectButton.js.map +1 -1
  327. package/lib/esm/components/setup-wizard/SetupWizard.js +10 -4
  328. package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
  329. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
  330. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  331. package/lib/esm/components/sharing-bar/SharingBar.js +30 -5
  332. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  333. package/lib/esm/components/sharing-bar/SharingBar.styles.js +5 -0
  334. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  335. package/lib/esm/components/sharing-button/SharingButton.js +4 -2
  336. package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
  337. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +3 -1
  338. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  339. package/lib/esm/components/signature/Signature.js +6 -3
  340. package/lib/esm/components/signature/Signature.js.map +1 -1
  341. package/lib/esm/components/slider/Slider.js +30 -7
  342. package/lib/esm/components/slider/Slider.js.map +1 -1
  343. package/lib/esm/components/slider/Slider.styles.js +8 -1
  344. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  345. package/lib/esm/components/slider-button/SliderButton.js +62 -6
  346. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  347. package/lib/esm/components/slider-button/SliderButton.styles.js +14 -1
  348. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  349. package/lib/esm/components/slider-button/SliderButton.types.js +2 -0
  350. package/lib/esm/components/slider-button/SliderButton.types.js.map +1 -0
  351. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +56 -0
  352. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
  353. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +38 -0
  354. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
  355. package/lib/esm/components/tag-input/TagInput.js +86 -35
  356. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  357. package/lib/esm/components/tag-input/TagInput.styles.js +27 -1
  358. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  359. package/lib/esm/components/text-area/TextArea.js +18 -9
  360. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  361. package/lib/esm/components/text-area/TextArea.styles.js +14 -0
  362. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  363. package/lib/esm/components/truncation/Truncation.js +18 -4
  364. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  365. package/lib/esm/components/truncation/Truncation.styles.js +17 -0
  366. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  367. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +61 -0
  368. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -0
  369. package/lib/esm/utils/file.js.map +1 -1
  370. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +24 -0
  371. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +1 -0
  372. package/lib/types/components/accordion/Accordion.d.ts +5 -0
  373. package/lib/types/components/accordion/Accordion.styles.d.ts +8 -4
  374. package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
  375. package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +7 -2
  376. package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +1 -0
  377. package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
  378. package/lib/types/components/amount-control/AmountControl.d.ts +5 -0
  379. package/lib/types/components/amount-control/AmountControl.styles.d.ts +8 -4
  380. package/lib/types/components/button/Button.styles.d.ts +8 -6
  381. package/lib/types/components/button/Button.types.d.ts +8 -0
  382. package/lib/types/components/checkbox/Checkbox.d.ts +4 -0
  383. package/lib/types/components/checkbox/Checkbox.styles.d.ts +5 -1
  384. package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +5 -0
  385. package/lib/types/components/combobox/ComboBox.styles.d.ts +4 -2
  386. package/lib/types/components/combobox/ComboBox.types.d.ts +5 -0
  387. package/lib/types/components/context-menu/ContextMenu.styles.d.ts +4 -2
  388. package/lib/types/components/context-menu/ContextMenu.types.d.ts +6 -0
  389. package/lib/types/components/context-menu/ContextMenu.utils.d.ts +10 -0
  390. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -1
  391. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +2 -2
  392. package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +2 -2
  393. package/lib/types/components/expandable-content/ExpandableContent.styles.d.ts +2 -2
  394. package/lib/types/components/file-input/FileInput.d.ts +4 -0
  395. package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
  396. package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +3 -0
  397. package/lib/types/components/file-select/FileSelect.d.ts +4 -0
  398. package/lib/types/components/file-select/FileSelect.styles.d.ts +6 -4
  399. package/lib/types/components/filter/Filter.d.ts +1 -0
  400. package/lib/types/components/filter/Filter.styles.d.ts +6 -4
  401. package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +4 -0
  402. package/lib/types/components/filter-buttons/FilterButtons.d.ts +4 -0
  403. package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +5 -0
  404. package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +12 -8
  405. package/lib/types/components/grid-image/GridImage.d.ts +4 -0
  406. package/lib/types/components/grid-image/GridImage.styles.d.ts +4 -2
  407. package/lib/types/components/grouped-image/GroupedImage.d.ts +4 -0
  408. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +8 -6
  409. package/lib/types/components/highlight-slider/HighlightSlider.d.ts +4 -0
  410. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +3 -0
  411. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +9 -5
  412. package/lib/types/components/icon/Icon.d.ts +4 -0
  413. package/lib/types/components/icon/Icon.styles.d.ts +1 -0
  414. package/lib/types/components/input/Input.d.ts +4 -0
  415. package/lib/types/components/input/Input.styles.d.ts +17 -9
  416. package/lib/types/components/list/List.d.ts +11 -0
  417. package/lib/types/components/list/List.utils.d.ts +32 -1
  418. package/lib/types/components/list/list-item/ListItem.d.ts +4 -0
  419. package/lib/types/components/list/list-item/ListItem.styles.d.ts +64 -64
  420. package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +2 -2
  421. package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +195 -194
  422. package/lib/types/components/list/list-item/useListItemFocus.d.ts +13 -0
  423. package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +2 -2
  424. package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +4 -4
  425. package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +2 -2
  426. package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +7 -0
  427. package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +4 -1
  428. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +4 -2
  429. package/lib/types/components/number-input/NumberInput.d.ts +4 -0
  430. package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +2 -2
  431. package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +6 -6
  432. package/lib/types/components/radio-button/RadioButton.d.ts +4 -0
  433. package/lib/types/components/radio-button/RadioButton.styles.d.ts +15 -9
  434. package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +5 -0
  435. package/lib/types/components/search-box/SearchBox.d.ts +4 -0
  436. package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
  437. package/lib/types/components/search-input/SearchInput.d.ts +4 -0
  438. package/lib/types/components/search-input/SearchInput.styles.d.ts +17 -9
  439. package/lib/types/components/select-button/SelectButton.d.ts +4 -0
  440. package/lib/types/components/setup-wizard/SetupWizard.d.ts +5 -0
  441. package/lib/types/components/sharing-bar/SharingBar.d.ts +4 -0
  442. package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
  443. package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +10 -2
  444. package/lib/types/components/signature/Signature.d.ts +4 -0
  445. package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
  446. package/lib/types/components/slider/Slider.d.ts +8 -0
  447. package/lib/types/components/slider/Slider.styles.d.ts +18 -14
  448. package/lib/types/components/slider-button/SliderButton.d.ts +1 -28
  449. package/lib/types/components/slider-button/SliderButton.styles.d.ts +6 -4
  450. package/lib/types/components/slider-button/SliderButton.types.d.ts +32 -0
  451. package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +17 -0
  452. package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +13 -0
  453. package/lib/types/components/tag-input/TagInput.d.ts +4 -0
  454. package/lib/types/components/tag-input/TagInput.styles.d.ts +12 -2
  455. package/lib/types/components/text-area/TextArea.d.ts +4 -0
  456. package/lib/types/components/text-area/TextArea.styles.d.ts +1 -0
  457. package/lib/types/components/truncation/Truncation.d.ts +4 -0
  458. package/lib/types/components/truncation/Truncation.styles.d.ts +7 -2
  459. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +5 -0
  460. package/lib/types/utils/file.d.ts +1 -1
  461. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +9 -0
  462. package/package.json +3 -3
@@ -3,6 +3,7 @@ import React, { useCallback, useContext, useEffect, useMemo, useState, useRef }
3
3
  import { RadioButtonGroupContext } from './radio-button-group/RadioButtonGroup';
4
4
  import { StyledLabelWrapper, StyledMotionRadioButtonChildren, StyledRadioButton, StyledRadioButtonCheckBox, StyledRadioButtonCheckBoxMark, StyledRadioButtonLabel, StyledRadioButtonPseudoCheckBox, StyledRadioButtonWrapper } from './RadioButton.styles';
5
5
  import { getHeightOfSingleTextLine } from '../../utils/calculate';
6
+ import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
6
7
  const RadioButton = ({
7
8
  children,
8
9
  shouldShowRightElementOnlyOnChecked = false,
@@ -10,14 +11,16 @@ const RadioButton = ({
10
11
  id,
11
12
  rightElement,
12
13
  shouldShowCentered = true,
13
- isDisabled = false
14
+ isDisabled = false,
15
+ shouldEnableKeyboardHighlighting
14
16
  }) => {
15
17
  const {
16
18
  selectedRadioButtonId,
17
19
  updateSelectedRadioButtonId,
18
20
  radioButtonRightElements,
19
21
  updateHasRightElement,
20
- radioButtonsCanBeUnchecked
22
+ radioButtonsCanBeUnchecked,
23
+ shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingFromGroup
21
24
  } = useContext(RadioButtonGroupContext);
22
25
  const [internalIsChecked, setInternalIsChecked] = useState(false);
23
26
  const [isHovered, setIsHovered] = useState(false);
@@ -27,6 +30,8 @@ const RadioButton = ({
27
30
  const isInGroup = typeof updateSelectedRadioButtonId === 'function';
28
31
  const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;
29
32
  const uncheckable = radioButtonsCanBeUnchecked;
33
+ const effectiveShouldEnableKeyboardHighlighting = shouldEnableKeyboardHighlightingFromGroup ?? shouldEnableKeyboardHighlighting;
34
+ const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(effectiveShouldEnableKeyboardHighlighting && !isDisabled);
30
35
  useEffect(() => {
31
36
  if (radioButtonRootRef.current && !shouldShowCentered) {
32
37
  const singleLineHeight = getHeightOfSingleTextLine({
@@ -60,6 +65,12 @@ const RadioButton = ({
60
65
  const handleMouseLeave = () => {
61
66
  setIsHovered(false);
62
67
  };
68
+ const handleKeyDown = useCallback(event => {
69
+ if (event.key === 'Enter' || event.key === ' ') {
70
+ event.preventDefault();
71
+ handleClick();
72
+ }
73
+ }, [handleClick]);
63
74
  const radioButtonRightElementMargin = useMemo(() => {
64
75
  if (!radioButtonRightElements) {
65
76
  return 'NONE';
@@ -105,8 +116,20 @@ const RadioButton = ({
105
116
  $isDisabled: isDisabled,
106
117
  $radioButtonRightElementMargin: radioButtonRightElementMargin
107
118
  }, /*#__PURE__*/React.createElement(StyledRadioButtonWrapper, {
108
- ref: radioButtonRootRef
109
- }, /*#__PURE__*/React.createElement(StyledRadioButtonPseudoCheckBox, {
119
+ ref: radioButtonRootRef,
120
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
121
+ }, /*#__PURE__*/React.createElement(StyledRadioButtonCheckBox, {
122
+ onClick: handleClick,
123
+ onMouseEnter: handleMouseEnter,
124
+ onMouseLeave: handleMouseLeave,
125
+ onKeyDown: handleKeyDown,
126
+ disabled: isDisabled,
127
+ $isDisabled: isDisabled,
128
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
129
+ type: "radio",
130
+ checked: isMarked,
131
+ onChange: () => {}
132
+ }), /*#__PURE__*/React.createElement(StyledRadioButtonPseudoCheckBox, {
110
133
  $isDisabled: isDisabled,
111
134
  $isChecked: isMarked,
112
135
  ref: radioButtonBoxRef,
@@ -121,16 +144,7 @@ const RadioButton = ({
121
144
  $isHovered: isHovered,
122
145
  $isSelected: isMarked,
123
146
  $isDisabled: isDisabled
124
- })), /*#__PURE__*/React.createElement(StyledRadioButtonCheckBox, {
125
- onClick: handleClick,
126
- onMouseEnter: handleMouseEnter,
127
- onMouseLeave: handleMouseLeave,
128
- disabled: isDisabled,
129
- $isDisabled: isDisabled,
130
- type: "radio",
131
- checked: isMarked,
132
- onChange: () => {}
133
- }), /*#__PURE__*/React.createElement(StyledLabelWrapper, null, label && /*#__PURE__*/React.createElement(StyledRadioButtonLabel, {
147
+ })), /*#__PURE__*/React.createElement(StyledLabelWrapper, null, label && /*#__PURE__*/React.createElement(StyledRadioButtonLabel, {
134
148
  $isDisabled: isDisabled,
135
149
  onClick: handleClick,
136
150
  onMouseEnter: handleMouseEnter,
@@ -148,7 +162,7 @@ const RadioButton = ({
148
162
  transition: {
149
163
  duration: 0.2
150
164
  }
151
- }, children))), [children, handleClick, handleMouseEnter, isDisabled, isHovered, isMarked, label, radioButtonRightElementMargin, radioButtonTop, rightElement, shouldShowCentered, shouldShowRightElement]);
165
+ }, children))), [children, handleClick, handleKeyDown, handleMouseEnter, isDisabled, isHovered, isMarked, label, radioButtonRightElementMargin, radioButtonTop, rightElement, shouldShowCentered, shouldShowKeyboardHighlighting, shouldShowRightElement]);
152
166
  };
153
167
  RadioButton.displayName = 'RadioButton';
154
168
  export default RadioButton;
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","names":["AnimatePresence","React","useCallback","useContext","useEffect","useMemo","useState","useRef","RadioButtonGroupContext","StyledLabelWrapper","StyledMotionRadioButtonChildren","StyledRadioButton","StyledRadioButtonCheckBox","StyledRadioButtonCheckBoxMark","StyledRadioButtonLabel","StyledRadioButtonPseudoCheckBox","StyledRadioButtonWrapper","getHeightOfSingleTextLine","RadioButton","children","shouldShowRightElementOnlyOnChecked","label","id","rightElement","shouldShowCentered","isDisabled","selectedRadioButtonId","updateSelectedRadioButtonId","radioButtonRightElements","updateHasRightElement","radioButtonsCanBeUnchecked","internalIsChecked","setInternalIsChecked","isHovered","setIsHovered","radioButtonTop","setRadioButtonTop","undefined","radioButtonBoxRef","radioButtonRootRef","isInGroup","isMarked","uncheckable","current","singleLineHeight","container","boxHeight","getBoundingClientRect","height","handleClick","prev","handleMouseEnter","handleMouseLeave","radioButtonRightElementMargin","index","findIndex","element","prevButton","currentButton","nextButton","hasRightElement","shouldShowRightElement","window","setTimeout","createElement","$isDisabled","$radioButtonRightElementMargin","ref","$isChecked","onClick","style","top","transform","onMouseEnter","onMouseLeave","$isHovered","$isSelected","disabled","type","checked","onChange","initial","animate","opacity","transition","duration","displayName"],"sources":["../../../../src/components/radio-button/RadioButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n FC,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n useRef,\n} from 'react';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport { RadioButtonGroupContext } from './radio-button-group/RadioButtonGroup';\nimport {\n StyledLabelWrapper,\n StyledMotionRadioButtonChildren,\n StyledRadioButton,\n StyledRadioButtonCheckBox,\n StyledRadioButtonCheckBoxMark,\n StyledRadioButtonLabel,\n StyledRadioButtonPseudoCheckBox,\n StyledRadioButtonWrapper,\n} from './RadioButton.styles';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\n\nexport type RadioButtonProps = {\n /**\n * The children that should be displayed after the RadioButton is checked.\n */\n children?: ReactNode;\n /**\n * whether the RadioButton should be shown.\n */\n isDisabled?: boolean;\n /**\n * The id of the radio button.\n */\n id: string;\n /**\n * The label that should be displayed next to the radio button.\n */\n label?: ReactNode;\n /**\n * An element that should be displayed on the right side of the label.\n */\n rightElement?: ReactNode;\n /**\n * Whether the rightElement should only be displayed when the RadioButton is checked\n */\n shouldShowRightElementOnlyOnChecked?: boolean;\n /**\n * Whether the RadioButton should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n};\n\nconst RadioButton: FC<RadioButtonProps> = ({\n children,\n shouldShowRightElementOnlyOnChecked = false,\n label,\n id,\n rightElement,\n shouldShowCentered = true,\n isDisabled = false,\n}) => {\n const {\n selectedRadioButtonId,\n updateSelectedRadioButtonId,\n radioButtonRightElements,\n updateHasRightElement,\n radioButtonsCanBeUnchecked,\n } = useContext(RadioButtonGroupContext);\n\n const [internalIsChecked, setInternalIsChecked] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [radioButtonTop, setRadioButtonTop] = useState<number | undefined>(undefined);\n\n const radioButtonBoxRef = useRef<HTMLDivElement>(null);\n const radioButtonRootRef = useRef<HTMLDivElement>(null);\n\n const isInGroup = typeof updateSelectedRadioButtonId === 'function';\n\n const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;\n\n const uncheckable = radioButtonsCanBeUnchecked;\n\n useEffect(() => {\n if (radioButtonRootRef.current && !shouldShowCentered) {\n const singleLineHeight = getHeightOfSingleTextLine({\n container: radioButtonRootRef.current,\n });\n\n const boxHeight = radioButtonBoxRef.current?.getBoundingClientRect().height ?? 0;\n\n setRadioButtonTop((singleLineHeight - boxHeight) / 2);\n }\n }, [shouldShowCentered]);\n\n const handleClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (uncheckable) {\n if (updateSelectedRadioButtonId) {\n updateSelectedRadioButtonId(id === selectedRadioButtonId ? undefined : id);\n }\n setInternalIsChecked((prev) => !prev);\n return;\n }\n if (typeof updateSelectedRadioButtonId === 'function') {\n updateSelectedRadioButtonId(id);\n }\n setInternalIsChecked(true);\n }, [id, isDisabled, uncheckable, selectedRadioButtonId, updateSelectedRadioButtonId]);\n\n const handleMouseEnter = useCallback(() => {\n if (!isDisabled) {\n setIsHovered(true);\n }\n }, [isDisabled]);\n\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n const radioButtonRightElementMargin: RadioButtonRightElementMargin = useMemo(() => {\n if (!radioButtonRightElements) {\n return 'NONE';\n }\n\n const index = radioButtonRightElements.findIndex((element) => element.id === id);\n\n if (index < 0) {\n return 'NONE';\n }\n\n const prevButton = radioButtonRightElements[index - 1];\n const currentButton = radioButtonRightElements[index];\n const nextButton = radioButtonRightElements[index + 1];\n\n if (!currentButton?.hasRightElement) {\n return 'NONE';\n }\n\n switch (true) {\n case prevButton?.hasRightElement && !nextButton?.hasRightElement:\n return 'TOP';\n case !prevButton?.hasRightElement && nextButton?.hasRightElement:\n return 'BOTTOM';\n case currentButton?.hasRightElement &&\n !nextButton?.hasRightElement &&\n !prevButton?.hasRightElement:\n return 'NONE';\n default:\n return 'BOTH';\n }\n }, [id, radioButtonRightElements]);\n\n const shouldShowRightElement = useMemo(() => {\n if (rightElement) {\n if (shouldShowRightElementOnlyOnChecked) {\n return isMarked;\n }\n\n return true;\n }\n\n return false;\n }, [isMarked, rightElement, shouldShowRightElementOnlyOnChecked]);\n\n useEffect(() => {\n if (typeof updateHasRightElement === 'function') {\n window.setTimeout(() => {\n updateHasRightElement(id, shouldShowRightElement);\n }, 10);\n }\n }, [id, shouldShowRightElement, updateHasRightElement]);\n\n return useMemo(\n () => (\n <StyledRadioButton\n $isDisabled={isDisabled}\n $radioButtonRightElementMargin={radioButtonRightElementMargin}\n >\n <StyledRadioButtonWrapper ref={radioButtonRootRef}>\n <StyledRadioButtonPseudoCheckBox\n $isDisabled={isDisabled}\n $isChecked={isMarked}\n ref={radioButtonBoxRef}\n onClick={handleClick}\n style={{\n top: shouldShowCentered ? '50%' : radioButtonTop,\n transform: shouldShowCentered ? 'translateY(-50%)' : undefined,\n }}\n >\n <StyledRadioButtonCheckBoxMark\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n $isHovered={isHovered}\n $isSelected={isMarked}\n $isDisabled={isDisabled}\n />\n </StyledRadioButtonPseudoCheckBox>\n <StyledRadioButtonCheckBox\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n type=\"radio\"\n checked={isMarked}\n onChange={() => {}}\n />\n <StyledLabelWrapper>\n {label && (\n <StyledRadioButtonLabel\n $isDisabled={isDisabled}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {label}\n </StyledRadioButtonLabel>\n )}\n {shouldShowRightElement && rightElement}\n </StyledLabelWrapper>\n </StyledRadioButtonWrapper>\n {children && (\n <AnimatePresence initial={false}>\n <StyledMotionRadioButtonChildren\n animate={\n isMarked\n ? { opacity: 1, height: 'auto' }\n : { opacity: 0, height: 0 }\n }\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionRadioButtonChildren>\n </AnimatePresence>\n )}\n </StyledRadioButton>\n ),\n [\n children,\n handleClick,\n handleMouseEnter,\n isDisabled,\n isHovered,\n isMarked,\n label,\n radioButtonRightElementMargin,\n radioButtonTop,\n rightElement,\n shouldShowCentered,\n shouldShowRightElement,\n ],\n );\n};\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAERC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,EAERC,MAAM,QACH,OAAO;AAEd,SAASC,uBAAuB,QAAQ,uCAAuC;AAC/E,SACIC,kBAAkB,EAClBC,+BAA+B,EAC/BC,iBAAiB,EACjBC,yBAAyB,EACzBC,6BAA6B,EAC7BC,sBAAsB,EACtBC,+BAA+B,EAC/BC,wBAAwB,QACrB,sBAAsB;AAC7B,SAASC,yBAAyB,QAAQ,uBAAuB;AAiCjE,MAAMC,WAAiC,GAAGA,CAAC;EACvCC,QAAQ;EACRC,mCAAmC,GAAG,KAAK;EAC3CC,KAAK;EACLC,EAAE;EACFC,YAAY;EACZC,kBAAkB,GAAG,IAAI;EACzBC,UAAU,GAAG;AACjB,CAAC,KAAK;EACF,MAAM;IACFC,qBAAqB;IACrBC,2BAA2B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,CACtB,EACD,CACIA,QAAQ,EACR8B,WAAW,EACXE,gBAAgB,EAChB1B,UAAU,EACVQ,SAAS,EACTQ,QAAQ,EACRpB,KAAK,EACLgC,6BAA6B,EAC7BlB,cAAc,EACdZ,YAAY,EACZC,kBAAkB,EAClBqC,sBAAsB,CAE9B,CAAC;AACL,CAAC;AAED3C,WAAW,CAACoE,WAAW,GAAG,aAAa;AAEvC,eAAepE,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"RadioButton.js","names":["AnimatePresence","React","useCallback","useContext","useEffect","useMemo","useState","useRef","RadioButtonGroupContext","StyledLabelWrapper","StyledMotionRadioButtonChildren","StyledRadioButton","StyledRadioButtonCheckBox","StyledRadioButtonCheckBoxMark","StyledRadioButtonLabel","StyledRadioButtonPseudoCheckBox","StyledRadioButtonWrapper","getHeightOfSingleTextLine","useKeyboardFocusHighlighting","RadioButton","children","shouldShowRightElementOnlyOnChecked","label","id","rightElement","shouldShowCentered","isDisabled","shouldEnableKeyboardHighlighting","selectedRadioButtonId","updateSelectedRadioButtonId","radioButtonRightElements","updateHasRightElement","radioButtonsCanBeUnchecked","shouldEnableKeyboardHighlightingFromGroup","internalIsChecked","setInternalIsChecked","isHovered","setIsHovered","radioButtonTop","setRadioButtonTop","undefined","radioButtonBoxRef","radioButtonRootRef","isInGroup","isMarked","uncheckable","effectiveShouldEnableKeyboardHighlighting","shouldShowKeyboardHighlighting","current","singleLineHeight","container","boxHeight","getBoundingClientRect","height","handleClick","prev","handleMouseEnter","handleMouseLeave","handleKeyDown","event","key","preventDefault","radioButtonRightElementMargin","index","findIndex","element","prevButton","currentButton","nextButton","hasRightElement","shouldShowRightElement","window","setTimeout","createElement","$isDisabled","$radioButtonRightElementMargin","ref","$shouldShowKeyboardHighlighting","onClick","onMouseEnter","onMouseLeave","onKeyDown","disabled","type","checked","onChange","$isChecked","style","top","transform","$isHovered","$isSelected","initial","animate","opacity","transition","duration","displayName"],"sources":["../../../../src/components/radio-button/RadioButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n FC,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n useRef,\n} from 'react';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport { RadioButtonGroupContext } from './radio-button-group/RadioButtonGroup';\nimport {\n StyledLabelWrapper,\n StyledMotionRadioButtonChildren,\n StyledRadioButton,\n StyledRadioButtonCheckBox,\n StyledRadioButtonCheckBoxMark,\n StyledRadioButtonLabel,\n StyledRadioButtonPseudoCheckBox,\n StyledRadioButtonWrapper,\n} from './RadioButton.styles';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport type RadioButtonProps = {\n /**\n * The children that should be displayed after the RadioButton is checked.\n */\n children?: ReactNode;\n /**\n * whether the RadioButton should be shown.\n */\n isDisabled?: boolean;\n /**\n * The id of the radio button.\n */\n id: string;\n /**\n * The label that should be displayed next to the radio button.\n */\n label?: ReactNode;\n /**\n * An element that should be displayed on the right side of the label.\n */\n rightElement?: ReactNode;\n /**\n * Whether the rightElement should only be displayed when the RadioButton is checked\n */\n shouldShowRightElementOnlyOnChecked?: boolean;\n /**\n * Whether the RadioButton should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nconst RadioButton: FC<RadioButtonProps> = ({\n children,\n shouldShowRightElementOnlyOnChecked = false,\n label,\n id,\n rightElement,\n shouldShowCentered = true,\n isDisabled = false,\n shouldEnableKeyboardHighlighting,\n}) => {\n const {\n selectedRadioButtonId,\n updateSelectedRadioButtonId,\n radioButtonRightElements,\n updateHasRightElement,\n radioButtonsCanBeUnchecked,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingFromGroup,\n } = useContext(RadioButtonGroupContext);\n\n const [internalIsChecked, setInternalIsChecked] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [radioButtonTop, setRadioButtonTop] = useState<number | undefined>(undefined);\n\n const radioButtonBoxRef = useRef<HTMLDivElement>(null);\n const radioButtonRootRef = useRef<HTMLDivElement>(null);\n\n const isInGroup = typeof updateSelectedRadioButtonId === 'function';\n\n const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;\n\n const uncheckable = radioButtonsCanBeUnchecked;\n\n const effectiveShouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlightingFromGroup ?? shouldEnableKeyboardHighlighting;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n effectiveShouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n useEffect(() => {\n if (radioButtonRootRef.current && !shouldShowCentered) {\n const singleLineHeight = getHeightOfSingleTextLine({\n container: radioButtonRootRef.current,\n });\n\n const boxHeight = radioButtonBoxRef.current?.getBoundingClientRect().height ?? 0;\n\n setRadioButtonTop((singleLineHeight - boxHeight) / 2);\n }\n }, [shouldShowCentered]);\n\n const handleClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (uncheckable) {\n if (updateSelectedRadioButtonId) {\n updateSelectedRadioButtonId(id === selectedRadioButtonId ? undefined : id);\n }\n setInternalIsChecked((prev) => !prev);\n return;\n }\n if (typeof updateSelectedRadioButtonId === 'function') {\n updateSelectedRadioButtonId(id);\n }\n setInternalIsChecked(true);\n }, [id, isDisabled, uncheckable, selectedRadioButtonId, updateSelectedRadioButtonId]);\n\n const handleMouseEnter = useCallback(() => {\n if (!isDisabled) {\n setIsHovered(true);\n }\n }, [isDisabled]);\n\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClick();\n }\n },\n [handleClick],\n );\n\n const radioButtonRightElementMargin: RadioButtonRightElementMargin = useMemo(() => {\n if (!radioButtonRightElements) {\n return 'NONE';\n }\n\n const index = radioButtonRightElements.findIndex((element) => element.id === id);\n\n if (index < 0) {\n return 'NONE';\n }\n\n const prevButton = radioButtonRightElements[index - 1];\n const currentButton = radioButtonRightElements[index];\n const nextButton = radioButtonRightElements[index + 1];\n\n if (!currentButton?.hasRightElement) {\n return 'NONE';\n }\n\n switch (true) {\n case prevButton?.hasRightElement && !nextButton?.hasRightElement:\n return 'TOP';\n case !prevButton?.hasRightElement && nextButton?.hasRightElement:\n return 'BOTTOM';\n case currentButton?.hasRightElement &&\n !nextButton?.hasRightElement &&\n !prevButton?.hasRightElement:\n return 'NONE';\n default:\n return 'BOTH';\n }\n }, [id, radioButtonRightElements]);\n\n const shouldShowRightElement = useMemo(() => {\n if (rightElement) {\n if (shouldShowRightElementOnlyOnChecked) {\n return isMarked;\n }\n\n return true;\n }\n\n return false;\n }, [isMarked, rightElement, shouldShowRightElementOnlyOnChecked]);\n\n useEffect(() => {\n if (typeof updateHasRightElement === 'function') {\n window.setTimeout(() => {\n updateHasRightElement(id, shouldShowRightElement);\n }, 10);\n }\n }, [id, shouldShowRightElement, updateHasRightElement]);\n\n return useMemo(\n () => (\n <StyledRadioButton\n $isDisabled={isDisabled}\n $radioButtonRightElementMargin={radioButtonRightElementMargin}\n >\n <StyledRadioButtonWrapper\n ref={radioButtonRootRef}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n <StyledRadioButtonCheckBox\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onKeyDown={handleKeyDown}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n type=\"radio\"\n checked={isMarked}\n onChange={() => {}}\n />\n <StyledRadioButtonPseudoCheckBox\n $isDisabled={isDisabled}\n $isChecked={isMarked}\n ref={radioButtonBoxRef}\n onClick={handleClick}\n style={{\n top: shouldShowCentered ? '50%' : radioButtonTop,\n transform: shouldShowCentered ? 'translateY(-50%)' : undefined,\n }}\n >\n <StyledRadioButtonCheckBoxMark\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n $isHovered={isHovered}\n $isSelected={isMarked}\n $isDisabled={isDisabled}\n />\n </StyledRadioButtonPseudoCheckBox>\n <StyledLabelWrapper>\n {label && (\n <StyledRadioButtonLabel\n $isDisabled={isDisabled}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {label}\n </StyledRadioButtonLabel>\n )}\n {shouldShowRightElement && rightElement}\n </StyledLabelWrapper>\n </StyledRadioButtonWrapper>\n {children && (\n <AnimatePresence initial={false}>\n <StyledMotionRadioButtonChildren\n animate={\n isMarked\n ? { opacity: 1, height: 'auto' }\n : { opacity: 0, height: 0 }\n }\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionRadioButtonChildren>\n </AnimatePresence>\n )}\n </StyledRadioButton>\n ),\n [\n children,\n handleClick,\n handleKeyDown,\n handleMouseEnter,\n isDisabled,\n isHovered,\n isMarked,\n label,\n radioButtonRightElementMargin,\n radioButtonTop,\n rightElement,\n shouldShowCentered,\n shouldShowKeyboardHighlighting,\n shouldShowRightElement,\n ],\n );\n};\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAERC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,EAERC,MAAM,QACH,OAAO;AAEd,SAASC,uBAAuB,QAAQ,uCAAuC;AAC/E,SACIC,kBAAkB,EAClBC,+BAA+B,EAC/BC,iBAAiB,EACjBC,yBAAyB,EACzBC,6BAA6B,EAC7BC,sBAAsB,EACtBC,+BAA+B,EAC/BC,wBAAwB,QACrB,sBAAsB;AAC7B,SAASC,yBAAyB,QAAQ,uBAAuB;AACjE,SAASC,4BAA4B,QAAQ,0CAA0C;AAqCvF,MAAMC,WAAiC,GAAGA,CAA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,WAAW,EAAE/C,QAAS;IACtB8B,WAAW,EAAEhD;EAAW,CAC3B,CAC4B,CAAC,eAClCzB,KAAA,CAAAwE,aAAA,CAAChE,kBAAkB,QACda,KAAK,iBACFrB,KAAA,CAAAwE,aAAA,CAAC3D,sBAAsB;IACnB4D,WAAW,EAAEhD,UAAW;IACxBoD,OAAO,EAAExB,WAAY;IACrByB,YAAY,EAAEvB,gBAAiB;IAC/BwB,YAAY,EAAEvB;EAAiB,GAE9BnC,KACmB,CAC3B,EACAgD,sBAAsB,IAAI9C,YACX,CACE,CAAC,EAC1BJ,QAAQ,iBACLnB,KAAA,CAAAwE,aAAA,CAACzE,eAAe;IAAC4F,OAAO,EAAE;EAAM,gBAC5B3F,KAAA,CAAAwE,aAAA,CAAC/D,+BAA+B;IAC5BmF,OAAO,EACHjD,QAAQ,GACF;MAAEkD,OAAO,EAAE,CAAC;MAAEzC,MAAM,EAAE;IAAO,CAAC,GAC9B;MAAEyC,OAAO,EAAE,CAAC;MAAEzC,MAAM,EAAE;IAAE,CACjC;IACD0C,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B5E,QAC4B,CACpB,CAEN,CACtB,EACD,CACIA,QAAQ,EACRkC,WAAW,EACXI,aAAa,EACbF,gBAAgB,EAChB9B,UAAU,EACVU,SAAS,EACTQ,QAAQ,EACRtB,KAAK,EACLwC,6BAA6B,EAC7BxB,cAAc,EACdd,YAAY,EACZC,kBAAkB,EAClBsB,8BAA8B,EAC9BuB,sBAAsB,CAE9B,CAAC;AACL,CAAC;AAEDnD,WAAW,CAAC8E,WAAW,GAAG,aAAa;AAEvC,eAAe9E,WAAW","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { motion } from 'motion/react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { keyboardFocusHighlightingCircleRingCss } from '../../utils/keyboardFocusHighlighting.styles';
3
4
  export const StyledRadioButton = styled.span`
4
5
  display: flex;
5
6
  flex-direction: column;
@@ -41,14 +42,6 @@ export const StyledRadioButtonWrapper = styled.div`
41
42
  gap: 5px;
42
43
  user-select: none;
43
44
  `;
44
- export const StyledRadioButtonCheckBox = styled.input`
45
- opacity: 0;
46
- height: 15px;
47
- width: 15px;
48
- cursor: ${({
49
- $isDisabled
50
- }) => $isDisabled ? 'default !important' : 'pointer !important'};
51
- `;
52
45
  export const StyledRadioButtonPseudoCheckBox = styled.div`
53
46
  background-color: ${({
54
47
  theme,
@@ -63,9 +56,27 @@ export const StyledRadioButtonPseudoCheckBox = styled.div`
63
56
  height: 15px;
64
57
  position: absolute;
65
58
  border-radius: 100%;
59
+ z-index: 1;
60
+ cursor: ${({
61
+ $isDisabled
62
+ }) => $isDisabled ? 'default !important' : 'pointer !important'};
63
+ `;
64
+ export const StyledRadioButtonCheckBox = styled.input`
65
+ opacity: 0;
66
+ height: 15px;
67
+ width: 15px;
66
68
  cursor: ${({
67
69
  $isDisabled
68
70
  }) => $isDisabled ? 'default !important' : 'pointer !important'};
71
+
72
+ ${({
73
+ $shouldShowKeyboardHighlighting
74
+ }) => $shouldShowKeyboardHighlighting && css`
75
+ &:focus-visible + ${StyledRadioButtonPseudoCheckBox} {
76
+ transition: none;
77
+ ${keyboardFocusHighlightingCircleRingCss}
78
+ }
79
+ `}
69
80
  `;
70
81
  export const StyledRadioButtonCheckBoxMark = styled.span`
71
82
  background-color: transparent;
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.styles.js","names":["motion","styled","css","StyledRadioButton","span","$isDisabled","$radioButtonRightElementMargin","StyledRadioButtonWrapper","div","StyledRadioButtonCheckBox","input","StyledRadioButtonPseudoCheckBox","theme","$isChecked","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledRadioButtonLabel","p","text","StyledLabelWrapper","StyledMotionRadioButtonChildren"],"sources":["../../../../src/components/radio-button/RadioButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledRadioButtonProps = WithTheme<{\n $isDisabled: boolean;\n $radioButtonRightElementMargin: RadioButtonRightElementMargin;\n}>;\n\nexport const StyledRadioButton = styled.span<StyledRadioButtonProps>`\n display: flex;\n flex-direction: column;\n\n position: relative;\n\n opacity: ${({ $isDisabled }: StyledRadioButtonProps) => ($isDisabled ? 0.5 : 1)};\n\n ${({ $radioButtonRightElementMargin }: StyledRadioButtonProps) => {\n switch ($radioButtonRightElementMargin) {\n case 'BOTH':\n return css`\n margin: 6px 0;\n `;\n case 'TOP':\n return css`\n margin-top: 6px;\n `;\n case 'BOTTOM':\n return css`\n margin-bottom: 6px;\n `;\n case 'NONE':\n default:\n return css`\n margin: 0;\n `;\n }\n }}\n`;\n\nexport const StyledRadioButtonWrapper = styled.div`\n display: flex;\n align-items: center;\n position: relative;\n gap: 5px;\n user-select: none;\n`;\n\ntype StyledRadioButtonCheckBoxProps = WithTheme<{ $isDisabled: boolean }>;\n\nexport const StyledRadioButtonCheckBox = styled.input<StyledRadioButtonCheckBoxProps>`\n opacity: 0;\n height: 15px;\n width: 15px;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\ntype StyledRadioButtonPseudoCheckBoxProps = WithTheme<{\n $isChecked: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonPseudoCheckBox = styled.div<StyledRadioButtonPseudoCheckBoxProps>`\n background-color: ${({ theme, $isChecked }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isChecked ? theme['secondary-408'] : theme['secondary-403']};\n opacity: 1;\n border: 1px solid\n rgba(${({ theme }: StyledRadioButtonPseudoCheckBoxProps) => theme['409-rgb']}, 0.5);\n width: 15px;\n height: 15px;\n position: absolute;\n border-radius: 100%;\n cursor: ${({ $isDisabled }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\ntype StyledRadioButtonCheckBoxMarkProps = WithTheme<{\n $isHovered: boolean;\n $isSelected: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBoxMark = styled.span<StyledRadioButtonCheckBoxMarkProps>`\n background-color: transparent;\n position: absolute;\n top: 1px;\n left: 3.925px;\n display: inline-block;\n transform: rotate(35deg);\n height: 9px;\n width: 5px;\n border-bottom: 2px solid white;\n border-right: 2px solid white;\n border-top: transparent;\n border-left: transparent;\n z-index: 2;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxMarkProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n\n ${({ $isHovered, $isSelected }) => {\n if ($isSelected) {\n return css`\n opacity: 1;\n `;\n }\n\n if ($isHovered) {\n return css`\n opacity: 0.5;\n `;\n }\n\n return css`\n opacity: 0;\n `;\n }}\n`;\n\ntype StyledRadioButtonLabelProps = WithTheme<{ $isDisabled: boolean }>;\n\nexport const StyledRadioButtonLabel = styled.p<StyledRadioButtonLabelProps>`\n color: ${({ theme }: StyledRadioButtonLabelProps) => theme.text};\n margin: 0;\n cursor: ${({ $isDisabled }: StyledRadioButtonLabelProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\nexport const StyledLabelWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n gap: 12px;\n`;\n\ntype StyledMotionRadioButtonChildrenProps = WithTheme<unknown>;\n\nexport const StyledMotionRadioButtonChildren = styled(\n motion.div,\n)<StyledMotionRadioButtonChildrenProps>`\n margin-left: 20px;\n cursor: text;\n overflow: hidden;\n color: ${({ theme }: StyledMotionRadioButtonChildrenProps) => theme.text};\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAS/C,OAAO,MAAMC,iBAAiB,GAAGF,MAAM,CAACG,IAA4B;AACpE;AACA;AACA;AACA;AACA;AACA,eAAe,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AAM,CAAC;EAAEU,UAAU;EAAEC;AAAY,CAAC,KAAK;EAC/B,IAAIA,WAAW,EAAE;IACb,OAAOd,GAAG;AACtB;AACA,aAAa;EACL;EAEA,IAAIa,UAAU,EAAE;IACZ,OAAOb,GAAG;AACtB;AACA,aAAa;EACL;EAEA,OAAOA,GAAG;AAClB;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAID,OAAO,MAAMe,sBAAsB,GAAGhB,MAAM,CAACiB,CAA8B;AAC3E,aAAa,CAAC;EAAEN;AAAmC,CAAC,KAAKA,KAAK,CAACO,IAAI;AACnE;AACA,cAAc,CAAC;EAAEd;AAAyC,CAAC,KACnDA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE,CAAC;AAED,OAAO,MAAMe,kBAAkB,GAAGnB,MAAM,CAACO,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMa,+BAA+B,GAAGpB,MAAM,CACjDD,MAAM,CAACQ,GACX,CAAuC;AACvC;AACA;AACA;AACA,aAAa,CAAC;EAAEI;AAA4C,CAAC,KAAKA,KAAK,CAACO,IAAI;AAC5E,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"RadioButton.styles.js","names":["motion","styled","css","keyboardFocusHighlightingCircleRingCss","StyledRadioButton","span","$isDisabled","$radioButtonRightElementMargin","StyledRadioButtonWrapper","div","StyledRadioButtonPseudoCheckBox","theme","$isChecked","StyledRadioButtonCheckBox","input","$shouldShowKeyboardHighlighting","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledRadioButtonLabel","p","text","StyledLabelWrapper","StyledMotionRadioButtonChildren"],"sources":["../../../../src/components/radio-button/RadioButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingCircleRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledRadioButtonProps = WithTheme<{\n $isDisabled: boolean;\n $radioButtonRightElementMargin: RadioButtonRightElementMargin;\n}>;\n\nexport const StyledRadioButton = styled.span<StyledRadioButtonProps>`\n display: flex;\n flex-direction: column;\n\n position: relative;\n\n opacity: ${({ $isDisabled }: StyledRadioButtonProps) => ($isDisabled ? 0.5 : 1)};\n\n ${({ $radioButtonRightElementMargin }: StyledRadioButtonProps) => {\n switch ($radioButtonRightElementMargin) {\n case 'BOTH':\n return css`\n margin: 6px 0;\n `;\n case 'TOP':\n return css`\n margin-top: 6px;\n `;\n case 'BOTTOM':\n return css`\n margin-bottom: 6px;\n `;\n case 'NONE':\n default:\n return css`\n margin: 0;\n `;\n }\n }}\n`;\n\ntype StyledRadioButtonWrapperProps = {\n $shouldShowKeyboardHighlighting: boolean;\n};\n\nexport const StyledRadioButtonWrapper = styled.div<StyledRadioButtonWrapperProps>`\n display: flex;\n align-items: center;\n position: relative;\n gap: 5px;\n user-select: none;\n`;\n\ntype StyledRadioButtonPseudoCheckBoxProps = WithTheme<{\n $isChecked: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonPseudoCheckBox = styled.div<StyledRadioButtonPseudoCheckBoxProps>`\n background-color: ${({ theme, $isChecked }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isChecked ? theme['secondary-408'] : theme['secondary-403']};\n opacity: 1;\n border: 1px solid\n rgba(${({ theme }: StyledRadioButtonPseudoCheckBoxProps) => theme['409-rgb']}, 0.5);\n width: 15px;\n height: 15px;\n position: absolute;\n border-radius: 100%;\n z-index: 1;\n cursor: ${({ $isDisabled }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\ntype StyledRadioButtonCheckBoxProps = WithTheme<{\n $isDisabled: boolean;\n $shouldShowKeyboardHighlighting: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBox = styled.input<StyledRadioButtonCheckBoxProps>`\n opacity: 0;\n height: 15px;\n width: 15px;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible + ${StyledRadioButtonPseudoCheckBox} {\n transition: none;\n ${keyboardFocusHighlightingCircleRingCss}\n }\n `}\n`;\n\ntype StyledRadioButtonCheckBoxMarkProps = WithTheme<{\n $isHovered: boolean;\n $isSelected: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBoxMark = styled.span<StyledRadioButtonCheckBoxMarkProps>`\n background-color: transparent;\n position: absolute;\n top: 1px;\n left: 3.925px;\n display: inline-block;\n transform: rotate(35deg);\n height: 9px;\n width: 5px;\n border-bottom: 2px solid white;\n border-right: 2px solid white;\n border-top: transparent;\n border-left: transparent;\n z-index: 2;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxMarkProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n\n ${({ $isHovered, $isSelected }) => {\n if ($isSelected) {\n return css`\n opacity: 1;\n `;\n }\n\n if ($isHovered) {\n return css`\n opacity: 0.5;\n `;\n }\n\n return css`\n opacity: 0;\n `;\n }}\n`;\n\ntype StyledRadioButtonLabelProps = WithTheme<{ $isDisabled: boolean }>;\n\nexport const StyledRadioButtonLabel = styled.p<StyledRadioButtonLabelProps>`\n color: ${({ theme }: StyledRadioButtonLabelProps) => theme.text};\n margin: 0;\n cursor: ${({ $isDisabled }: StyledRadioButtonLabelProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\nexport const StyledLabelWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n gap: 12px;\n`;\n\ntype StyledMotionRadioButtonChildrenProps = WithTheme<unknown>;\n\nexport const StyledMotionRadioButtonChildren = styled(\n motion.div,\n)<StyledMotionRadioButtonChildrenProps>`\n margin-left: 20px;\n cursor: text;\n overflow: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AAER;AAA4C,CAAC,KACtDA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE;AACA,MAAM,CAAC;EAAES;AAAgC,CAAC,KAClCA,+BAA+B,IAC/Bb,GAAG;AACX,gCAAgCQ,+BAA+B;AAC/D;AACA,kBAAkBP,sCAAsC;AACxD;AACA,SAAS;AACT,CAAC;AAQD,OAAO,MAAMa,6BAA6B,GAAGf,MAAM,CAACI,IAAwC;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,CAAC;EAAEC;AAAgD,CAAC,KAC1DA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE;AACA,MAAM,CAAC;EAAEW,UAAU;EAAEC;AAAY,CAAC,KAAK;EAC/B,IAAIA,WAAW,EAAE;IACb,OAAOhB,GAAG;AACtB;AACA,aAAa;EACL;EAEA,IAAIe,UAAU,EAAE;IACZ,OAAOf,GAAG;AACtB;AACA,aAAa;EACL;EAEA,OAAOA,GAAG;AAClB;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAID,OAAO,MAAMiB,sBAAsB,GAAGlB,MAAM,CAACmB,CAA8B;AAC3E,aAAa,CAAC;EAAET;AAAmC,CAAC,KAAKA,KAAK,CAACU,IAAI;AACnE;AACA,cAAc,CAAC;EAAEf;AAAyC,CAAC,KACnDA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE,CAAC;AAED,OAAO,MAAMgB,kBAAkB,GAAGrB,MAAM,CAACQ,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMc,+BAA+B,GAAGtB,MAAM,CACjDD,MAAM,CAACS,GACX,CAAuC;AACvC;AACA;AACA;AACA,aAAa,CAAC;EAAEE;AAA4C,CAAC,KAAKA,KAAK,CAACU,IAAI;AAC5E,CAAC","ignoreList":[]}
@@ -5,14 +5,16 @@ export const RadioButtonGroupContext = /*#__PURE__*/React.createContext({
5
5
  updateSelectedRadioButtonId: undefined,
6
6
  radioButtonsCanBeUnchecked: false,
7
7
  radioButtonRightElements: [],
8
- updateHasRightElement: undefined
8
+ updateHasRightElement: undefined,
9
+ shouldEnableKeyboardHighlighting: undefined
9
10
  });
10
11
  RadioButtonGroupContext.displayName = 'RadioButtonGroupContext';
11
12
  const RadioButtonGroup = /*#__PURE__*/forwardRef(({
12
13
  children,
13
14
  canUncheckRadioButtons,
14
15
  selectedId,
15
- onSelect
16
+ onSelect,
17
+ shouldEnableKeyboardHighlighting
16
18
  }, ref) => {
17
19
  const [selectedRadioButtonId, setSelectedRadioButtonId] = useState(undefined);
18
20
  const [radioButtonRightElements, setRadioButtonRightElements] = useState([]);
@@ -50,8 +52,9 @@ const RadioButtonGroup = /*#__PURE__*/forwardRef(({
50
52
  updateSelectedRadioButtonId,
51
53
  radioButtonsCanBeUnchecked: canUncheckRadioButtons,
52
54
  updateHasRightElement,
53
- radioButtonRightElements
54
- }), [canUncheckRadioButtons, radioButtonRightElements, selectedRadioButtonId, updateHasRightElement, updateSelectedRadioButtonId]);
55
+ radioButtonRightElements,
56
+ shouldEnableKeyboardHighlighting
57
+ }), [canUncheckRadioButtons, radioButtonRightElements, selectedRadioButtonId, shouldEnableKeyboardHighlighting, updateHasRightElement, updateSelectedRadioButtonId]);
55
58
  return /*#__PURE__*/React.createElement(RadioButtonGroupContext.Provider, {
56
59
  value: providerValue
57
60
  }, children);
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtonGroup.js","names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useState","getRadioButtonOrder","RadioButtonGroupContext","createContext","selectedRadioButtonId","undefined","updateSelectedRadioButtonId","radioButtonsCanBeUnchecked","radioButtonRightElements","updateHasRightElement","displayName","RadioButtonGroup","children","canUncheckRadioButtons","selectedId","onSelect","ref","setSelectedRadioButtonId","setRadioButtonRightElements","isControlled","id","hasRightElement","prevState","map","prev","ids","rightElements","providerValue","createElement","Provider","value"],"sources":["../../../../../src/components/radio-button/radio-button-group/RadioButtonGroup.tsx"],"sourcesContent":["import React, {\n forwardRef,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react';\nimport { getRadioButtonOrder } from '../../../utils/radioButton';\n\ntype IUpdateSelectedRadioButtonId = (id: string | undefined) => void;\n\ntype IUpdateHasRightElement = (id: string, hasRightElement: boolean) => void;\n\ntype IRadioButtonRightElements = { id: string; hasRightElement: boolean }[];\n\ninterface IRadioButtonGroupContext {\n selectedRadioButtonId: string | undefined;\n updateSelectedRadioButtonId?: IUpdateSelectedRadioButtonId;\n radioButtonRightElements: IRadioButtonRightElements;\n updateHasRightElement?: IUpdateHasRightElement;\n radioButtonsCanBeUnchecked?: boolean;\n}\n\nexport const RadioButtonGroupContext = React.createContext<IRadioButtonGroupContext>({\n selectedRadioButtonId: undefined,\n updateSelectedRadioButtonId: undefined,\n radioButtonsCanBeUnchecked: false,\n radioButtonRightElements: [],\n updateHasRightElement: undefined,\n});\n\nRadioButtonGroupContext.displayName = 'RadioButtonGroupContext';\n\nexport interface RadioButtonGroupRef {\n updateSelectedRadioButtonId: IUpdateSelectedRadioButtonId;\n}\n\nexport type RadioButtonGroupProps = {\n /**\n * Whether the RadioButtons can be unchecked.\n */\n canUncheckRadioButtons?: boolean;\n /**\n * The RadioButtons that should be grouped. Radio buttons with the same group are\n * automatically unchecked when an `RadioButton` of the group is checked.\n */\n children: ReactNode;\n /**\n * Function to be executed when an id is selected.\n */\n onSelect?: (id?: string) => void;\n /**\n * The id of the current selected RadioButton.\n */\n selectedId?: string;\n};\n\nconst RadioButtonGroup = forwardRef<RadioButtonGroupRef, RadioButtonGroupProps>(\n ({ children, canUncheckRadioButtons, selectedId, onSelect }, ref) => {\n const [selectedRadioButtonId, setSelectedRadioButtonId] =\n useState<IRadioButtonGroupContext['selectedRadioButtonId']>(undefined);\n const [radioButtonRightElements, setRadioButtonRightElements] =\n useState<IRadioButtonRightElements>([]);\n\n const isControlled = typeof selectedId === 'string';\n\n useEffect(() => {\n setSelectedRadioButtonId(selectedId);\n }, [selectedId]);\n\n const updateSelectedRadioButtonId = useCallback<IUpdateSelectedRadioButtonId>(\n (id) => {\n if (typeof onSelect === 'function') {\n onSelect(id);\n }\n\n if (!isControlled) {\n setSelectedRadioButtonId(id);\n }\n },\n [isControlled, onSelect],\n );\n\n const updateHasRightElement = useCallback<IUpdateHasRightElement>((id, hasRightElement) => {\n setRadioButtonRightElements((prevState) =>\n prevState.map((prev) => (id === prev.id ? { id, hasRightElement } : prev)),\n );\n }, []);\n\n useEffect(() => {\n const ids = getRadioButtonOrder(children);\n\n const rightElements = ids.map((id) => ({ id, hasRightElement: false }));\n\n setRadioButtonRightElements(rightElements);\n }, [children]);\n\n useImperativeHandle(\n ref,\n () => ({\n updateSelectedRadioButtonId,\n }),\n [updateSelectedRadioButtonId],\n );\n\n const providerValue = useMemo<IRadioButtonGroupContext>(\n () => ({\n selectedRadioButtonId,\n updateSelectedRadioButtonId,\n radioButtonsCanBeUnchecked: canUncheckRadioButtons,\n updateHasRightElement,\n radioButtonRightElements,\n }),\n [\n canUncheckRadioButtons,\n radioButtonRightElements,\n selectedRadioButtonId,\n updateHasRightElement,\n updateSelectedRadioButtonId,\n ],\n );\n\n return (\n <RadioButtonGroupContext.Provider value={providerValue}>\n {children}\n </RadioButtonGroupContext.Provider>\n );\n },\n);\n\nRadioButtonGroup.displayName = 'RadioButtonGroup';\n\nexport default RadioButtonGroup;\n"],"mappings":"AAAA,OAAOA,KAAK,IACRC,UAAU,EAEVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SAASC,mBAAmB,QAAQ,4BAA4B;AAgBhE,OAAO,MAAMC,uBAAuB,gBAAGR,KAAK,CAACS,aAAa,CAA2B;EACjFC,qBAAqB,EAAEC,SAAS;EAChCC,2BAA2B,EAAED,SAAS;EACtCE,0BAA0B,EAAE,KAAK;EACjCC,wBAAwB,EAAE,EAAE;EAC5BC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AM;MAAEA,EAAE;MAAEC,eAAe,EAAE;IAAM,CAAC,CAAC,CAAC;IAEvEH,2BAA2B,CAACQ,aAAa,CAAC;EAC9C,CAAC,EAAE,CAACd,QAAQ,CAAC,CAAC;EAEdd,mBAAmB,CACfkB,GAAG,EACH,OAAO;IACHV;EACJ,CAAC,CAAC,EACF,CAACA,2BAA2B,CAChC,CAAC;EAED,MAAMqB,aAAa,GAAG5B,OAAO,CACzB,OAAO;IACHK,qBAAqB;IACrBE,2BAA2B;IAC3BC,0BAA0B,EAAEM,sBAAsB;IAClDJ,qBAAqB;IACrBD;EACJ,CAAC,CAAC,EACF,CACIK,sBAAsB,EACtBL,wBAAwB,EACxBJ,qBAAqB,EACrBK,qBAAqB,EACrBH,2BAA2B,CAEnC,CAAC;EAED,oBACIZ,KAAA,CAAAkC,aAAA,CAAC1B,uBAAuB,CAAC2B,QAAQ;IAACC,KAAK,EAAEH;EAAc,GAClDf,QAC6B,CAAC;AAE3C,CACJ,CAAC;AAEDD,gBAAgB,CAACD,WAAW,GAAG,kBAAkB;AAEjD,eAAeC,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"RadioButtonGroup.js","names":["React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useState","getRadioButtonOrder","RadioButtonGroupContext","createContext","selectedRadioButtonId","undefined","updateSelectedRadioButtonId","radioButtonsCanBeUnchecked","radioButtonRightElements","updateHasRightElement","shouldEnableKeyboardHighlighting","displayName","RadioButtonGroup","children","canUncheckRadioButtons","selectedId","onSelect","ref","setSelectedRadioButtonId","setRadioButtonRightElements","isControlled","id","hasRightElement","prevState","map","prev","ids","rightElements","providerValue","createElement","Provider","value"],"sources":["../../../../../src/components/radio-button/radio-button-group/RadioButtonGroup.tsx"],"sourcesContent":["import React, {\n forwardRef,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} from 'react';\nimport { getRadioButtonOrder } from '../../../utils/radioButton';\n\ntype IUpdateSelectedRadioButtonId = (id: string | undefined) => void;\n\ntype IUpdateHasRightElement = (id: string, hasRightElement: boolean) => void;\n\ntype IRadioButtonRightElements = { id: string; hasRightElement: boolean }[];\n\ninterface IRadioButtonGroupContext {\n selectedRadioButtonId: string | undefined;\n updateSelectedRadioButtonId?: IUpdateSelectedRadioButtonId;\n radioButtonRightElements: IRadioButtonRightElements;\n updateHasRightElement?: IUpdateHasRightElement;\n radioButtonsCanBeUnchecked?: boolean;\n shouldEnableKeyboardHighlighting?: boolean;\n}\n\nexport const RadioButtonGroupContext = React.createContext<IRadioButtonGroupContext>({\n selectedRadioButtonId: undefined,\n updateSelectedRadioButtonId: undefined,\n radioButtonsCanBeUnchecked: false,\n radioButtonRightElements: [],\n updateHasRightElement: undefined,\n shouldEnableKeyboardHighlighting: undefined,\n});\n\nRadioButtonGroupContext.displayName = 'RadioButtonGroupContext';\n\nexport interface RadioButtonGroupRef {\n updateSelectedRadioButtonId: IUpdateSelectedRadioButtonId;\n}\n\nexport type RadioButtonGroupProps = {\n /**\n * Whether the RadioButtons can be unchecked.\n */\n canUncheckRadioButtons?: boolean;\n /**\n * Enables keyboard-only focus highlighting for all RadioButtons in this group.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * The RadioButtons that should be grouped. Radio buttons with the same group are\n * automatically unchecked when an `RadioButton` of the group is checked.\n */\n children: ReactNode;\n /**\n * Function to be executed when an id is selected.\n */\n onSelect?: (id?: string) => void;\n /**\n * The id of the current selected RadioButton.\n */\n selectedId?: string;\n};\n\nconst RadioButtonGroup = forwardRef<RadioButtonGroupRef, RadioButtonGroupProps>(\n (\n {\n children,\n canUncheckRadioButtons,\n selectedId,\n onSelect,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const [selectedRadioButtonId, setSelectedRadioButtonId] =\n useState<IRadioButtonGroupContext['selectedRadioButtonId']>(undefined);\n const [radioButtonRightElements, setRadioButtonRightElements] =\n useState<IRadioButtonRightElements>([]);\n\n const isControlled = typeof selectedId === 'string';\n\n useEffect(() => {\n setSelectedRadioButtonId(selectedId);\n }, [selectedId]);\n\n const updateSelectedRadioButtonId = useCallback<IUpdateSelectedRadioButtonId>(\n (id) => {\n if (typeof onSelect === 'function') {\n onSelect(id);\n }\n\n if (!isControlled) {\n setSelectedRadioButtonId(id);\n }\n },\n [isControlled, onSelect],\n );\n\n const updateHasRightElement = useCallback<IUpdateHasRightElement>((id, hasRightElement) => {\n setRadioButtonRightElements((prevState) =>\n prevState.map((prev) => (id === prev.id ? { id, hasRightElement } : prev)),\n );\n }, []);\n\n useEffect(() => {\n const ids = getRadioButtonOrder(children);\n\n const rightElements = ids.map((id) => ({ id, hasRightElement: false }));\n\n setRadioButtonRightElements(rightElements);\n }, [children]);\n\n useImperativeHandle(\n ref,\n () => ({\n updateSelectedRadioButtonId,\n }),\n [updateSelectedRadioButtonId],\n );\n\n const providerValue = useMemo<IRadioButtonGroupContext>(\n () => ({\n selectedRadioButtonId,\n updateSelectedRadioButtonId,\n radioButtonsCanBeUnchecked: canUncheckRadioButtons,\n updateHasRightElement,\n radioButtonRightElements,\n shouldEnableKeyboardHighlighting,\n }),\n [\n canUncheckRadioButtons,\n radioButtonRightElements,\n selectedRadioButtonId,\n shouldEnableKeyboardHighlighting,\n updateHasRightElement,\n updateSelectedRadioButtonId,\n ],\n );\n\n return (\n <RadioButtonGroupContext.Provider value={providerValue}>\n {children}\n </RadioButtonGroupContext.Provider>\n );\n },\n);\n\nRadioButtonGroup.displayName = 'RadioButtonGroup';\n\nexport default RadioButtonGroup;\n"],"mappings":"AAAA,OAAOA,KAAK,IACRC,UAAU,EAEVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SAASC,mBAAmB,QAAQ,4BAA4B;AAiBhE,OAAO,MAAMC,uBAAuB,gBAAGR,KAAK,CAACS,aAAa,CAA2B;EACjFC,qBAAqB,EAAEC,SAAS;EAChCC,2BAA2B,EAAED,SAAS;EACtCE,0BAA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CAACY,QAAQ,CAAC;IAEzC,MAAMc,aAAa,GAAGD,GAAG,CAACF,GAAG,CAAEH,EAAE,KAAM;MAAEA,EAAE;MAAEC,eAAe,EAAE;IAAM,CAAC,CAAC,CAAC;IAEvEH,2BAA2B,CAACQ,aAAa,CAAC;EAC9C,CAAC,EAAE,CAACd,QAAQ,CAAC,CAAC;EAEdf,mBAAmB,CACfmB,GAAG,EACH,OAAO;IACHX;EACJ,CAAC,CAAC,EACF,CAACA,2BAA2B,CAChC,CAAC;EAED,MAAMsB,aAAa,GAAG7B,OAAO,CACzB,OAAO;IACHK,qBAAqB;IACrBE,2BAA2B;IAC3BC,0BAA0B,EAAEO,sBAAsB;IAClDL,qBAAqB;IACrBD,wBAAwB;IACxBE;EACJ,CAAC,CAAC,EACF,CACII,sBAAsB,EACtBN,wBAAwB,EACxBJ,qBAAqB,EACrBM,gCAAgC,EAChCD,qBAAqB,EACrBH,2BAA2B,CAEnC,CAAC;EAED,oBACIZ,KAAA,CAAAmC,aAAA,CAAC3B,uBAAuB,CAAC4B,QAAQ;IAACC,KAAK,EAAEH;EAAc,GAClDf,QAC6B,CAAC;AAE3C,CACJ,CAAC;AAEDD,gBAAgB,CAACD,WAAW,GAAG,kBAAkB;AAEjD,eAAeC,gBAAgB","ignoreList":[]}
@@ -33,7 +33,8 @@ const SearchBox = /*#__PURE__*/forwardRef(({
33
33
  shouldShowContentOnEmptyInput = true,
34
34
  shouldShowRoundImage,
35
35
  shouldShowToggleIcon = false,
36
- tagInputSettings
36
+ tagInputSettings,
37
+ shouldEnableKeyboardHighlighting
37
38
  }, ref) => {
38
39
  const [matchingListsItems, setMatchingListsItems] = useState(lists);
39
40
  const [selectedImage, setSelectedImage] = useState();
@@ -371,6 +372,16 @@ const SearchBox = /*#__PURE__*/forwardRef(({
371
372
  tagInputRef.current?.blur();
372
373
  return hasFocusRef.current && isTouch;
373
374
  }, [isTouch]);
375
+ const handleContainerBlur = useCallback(event => {
376
+ const nextFocusedElement = event.relatedTarget;
377
+ const currentContainer = event.currentTarget;
378
+
379
+ // Check if focus is moving outside the SearchBox container
380
+ // Also check the dropdown content (contentRef) since it's rendered in a portal
381
+ if (!nextFocusedElement || !currentContainer.contains(nextFocusedElement) && !contentRef.current?.contains(nextFocusedElement)) {
382
+ handleClose();
383
+ }
384
+ }, [handleClose]);
374
385
 
375
386
  /**
376
387
  * This function handles the item selection
@@ -472,7 +483,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
472
483
  const newElement = filteredChildren[newIndex];
473
484
  newElement.tabIndex = 0;
474
485
  }
475
- } else if (e.key === 'Enter') {
486
+ } else if (e.key === 'Enter' || e.key === ' ') {
476
487
  e.preventDefault();
477
488
  e.stopPropagation();
478
489
  if (filteredChildren) {
@@ -535,7 +546,8 @@ const SearchBox = /*#__PURE__*/forwardRef(({
535
546
  const shouldShowDropdown = shouldShowBody && (matchingListsItems.length !== 0 || !!hintText) && (value.trim() !== '' || shouldShowContentOnEmptyInput);
536
547
  return useMemo(() => /*#__PURE__*/React.createElement(StyledSearchBox, {
537
548
  ref: boxRef,
538
- key: `search-box-${uuid}`
549
+ key: `search-box-${uuid}`,
550
+ onBlur: handleContainerBlur
539
551
  }, /*#__PURE__*/React.createElement("div", {
540
552
  id: `search_box_input${uuid}`
541
553
  }, tagInputSettings ? /*#__PURE__*/React.createElement(TagInput, {
@@ -548,6 +560,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
548
560
  placeholder: placeholder,
549
561
  ref: tagInputRef,
550
562
  shouldAllowMultiple: tagInputSettings.shouldAllowMultiple,
563
+ shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlighting,
551
564
  shouldPreventEnter: true,
552
565
  tags: tagInputSettings.tags
553
566
  }) : /*#__PURE__*/React.createElement(Input, {
@@ -560,6 +573,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
560
573
  placeholder: placeholder,
561
574
  ref: inputRef,
562
575
  rightElement: rightElement,
576
+ shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlighting,
563
577
  value: value
564
578
  })), boxRef.current && /*#__PURE__*/React.createElement(DropdownBodyWrapper, {
565
579
  anchorElement: boxRef.current,
@@ -577,7 +591,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
577
591
  ref: contentRef,
578
592
  selectedGroups: groups,
579
593
  shouldHideFilterButtons: shouldHideFilterButtons
580
- }, content))), [container, content, dropdownDirection, filterButtons, groups, handleBlur, handleChange, handleClose, handleDropdownOutsideClick, handleFocus, height, isInvalid, leftElement, onKeyDown, placeholder, rightElement, shouldHideFilterButtons, shouldShowDropdown, tagInputSettings, uuid, value]);
594
+ }, content))), [container, content, dropdownDirection, filterButtons, groups, handleBlur, handleChange, handleClose, handleDropdownOutsideClick, handleFocus, height, isInvalid, leftElement, onKeyDown, placeholder, rightElement, shouldHideFilterButtons, shouldShowDropdown, shouldEnableKeyboardHighlighting, tagInputSettings, uuid, value]);
581
595
  });
582
596
  SearchBox.displayName = 'SearchBox';
583
597
  export default SearchBox;