@chayns-components/core 5.5.30 → 5.5.34

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 (249) hide show
  1. package/lib/cjs/components/accordion/Accordion.js +10 -0
  2. package/lib/cjs/components/accordion/Accordion.js.map +1 -1
  3. package/lib/cjs/components/accordion/Accordion.styles.js +0 -2
  4. package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
  5. package/lib/cjs/components/amount-control/AmountControl.js +14 -3
  6. package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
  7. package/lib/cjs/components/amount-control/AmountControl.styles.js +0 -17
  8. package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
  9. package/lib/cjs/components/button/Button.js +6 -1
  10. package/lib/cjs/components/button/Button.js.map +1 -1
  11. package/lib/cjs/components/button/Button.styles.js +0 -10
  12. package/lib/cjs/components/button/Button.styles.js.map +1 -1
  13. package/lib/cjs/components/checkbox/Checkbox.js +8 -1
  14. package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
  15. package/lib/cjs/components/checkbox/Checkbox.styles.js +0 -10
  16. package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
  17. package/lib/cjs/components/combobox/ComboBox.js +7 -1
  18. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  19. package/lib/cjs/components/combobox/ComboBox.styles.js +3 -10
  20. package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
  21. package/lib/cjs/components/context-menu/ContextMenu.js +12 -0
  22. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  23. package/lib/cjs/components/context-menu/ContextMenu.styles.js +7 -35
  24. package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
  25. package/lib/cjs/components/file-list/file-item/FileItem.js +7 -0
  26. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  27. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +1 -11
  28. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  29. package/lib/cjs/components/file-select/FileSelect.js +12 -3
  30. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  31. package/lib/cjs/components/file-select/FileSelect.styles.js +3 -9
  32. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  33. package/lib/cjs/components/filter/Filter.js +44 -16
  34. package/lib/cjs/components/filter/Filter.js.map +1 -1
  35. package/lib/cjs/components/filter/Filter.styles.js +2 -2
  36. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  37. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +9 -1
  38. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  39. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
  40. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  41. package/lib/cjs/components/grid-image/GridImage.js +7 -1
  42. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  43. package/lib/cjs/components/grid-image/GridImage.styles.js +5 -10
  44. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  45. package/lib/cjs/components/grouped-image/GroupedImage.js +8 -2
  46. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  47. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +3 -8
  48. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  49. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +7 -2
  50. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  51. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +5 -10
  52. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  53. package/lib/cjs/components/icon/Icon.js +10 -2
  54. package/lib/cjs/components/icon/Icon.js.map +1 -1
  55. package/lib/cjs/components/icon/Icon.styles.js +6 -32
  56. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  57. package/lib/cjs/components/input/Input.js +14 -2
  58. package/lib/cjs/components/input/Input.js.map +1 -1
  59. package/lib/cjs/components/input/Input.styles.js +0 -3
  60. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  61. package/lib/cjs/components/list/List.utils.js +3 -9
  62. package/lib/cjs/components/list/List.utils.js.map +1 -1
  63. package/lib/cjs/components/list/list-item/ListItem.js +13 -2
  64. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  65. package/lib/cjs/components/list/list-item/ListItem.styles.js +9 -2
  66. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  67. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -4
  68. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  69. package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
  70. package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
  71. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +8 -2
  72. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  73. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
  74. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  75. package/lib/cjs/components/radio-button/RadioButton.js +7 -1
  76. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  77. package/lib/cjs/components/radio-button/RadioButton.styles.js +0 -10
  78. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  79. package/lib/cjs/components/search-input/SearchInput.js +9 -10
  80. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  81. package/lib/cjs/components/search-input/SearchInput.styles.js +5 -15
  82. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  83. package/lib/cjs/components/sharing-bar/SharingBar.js +13 -0
  84. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  85. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +1 -5
  86. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  87. package/lib/cjs/components/slider/Slider.js +13 -6
  88. package/lib/cjs/components/slider/Slider.js.map +1 -1
  89. package/lib/cjs/components/slider/Slider.styles.js +2 -9
  90. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  91. package/lib/cjs/components/slider-button/SliderButton.js +6 -2
  92. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  93. package/lib/cjs/components/slider-button/SliderButton.styles.js +2 -15
  94. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  95. package/lib/cjs/components/tag-input/TagInput.js +8 -1
  96. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  97. package/lib/cjs/components/tag-input/TagInput.styles.js +1 -3
  98. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  99. package/lib/cjs/components/text-area/TextArea.js +68 -56
  100. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  101. package/lib/cjs/components/text-area/TextArea.styles.js +0 -2
  102. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  103. package/lib/cjs/components/truncation/Truncation.js +9 -5
  104. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  105. package/lib/cjs/components/truncation/Truncation.styles.js +0 -11
  106. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  107. package/lib/cjs/hooks/useFocusRingPortal.js +197 -0
  108. package/lib/cjs/hooks/useFocusRingPortal.js.map +1 -0
  109. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +9 -3
  110. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -1
  111. package/lib/cjs/index.js +14 -0
  112. package/lib/cjs/index.js.map +1 -1
  113. package/lib/esm/components/accordion/Accordion.js +10 -0
  114. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  115. package/lib/esm/components/accordion/Accordion.styles.js +0 -2
  116. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  117. package/lib/esm/components/amount-control/AmountControl.js +14 -3
  118. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  119. package/lib/esm/components/amount-control/AmountControl.styles.js +0 -17
  120. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  121. package/lib/esm/components/button/Button.js +7 -2
  122. package/lib/esm/components/button/Button.js.map +1 -1
  123. package/lib/esm/components/button/Button.styles.js +0 -10
  124. package/lib/esm/components/button/Button.styles.js.map +1 -1
  125. package/lib/esm/components/checkbox/Checkbox.js +8 -1
  126. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  127. package/lib/esm/components/checkbox/Checkbox.styles.js +0 -10
  128. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  129. package/lib/esm/components/combobox/ComboBox.js +7 -1
  130. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  131. package/lib/esm/components/combobox/ComboBox.styles.js +3 -10
  132. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  133. package/lib/esm/components/context-menu/ContextMenu.js +11 -0
  134. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  135. package/lib/esm/components/context-menu/ContextMenu.styles.js +7 -35
  136. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  137. package/lib/esm/components/file-list/file-item/FileItem.js +8 -1
  138. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  139. package/lib/esm/components/file-list/file-item/FileItem.styles.js +1 -11
  140. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  141. package/lib/esm/components/file-select/FileSelect.js +13 -4
  142. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  143. package/lib/esm/components/file-select/FileSelect.styles.js +3 -9
  144. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  145. package/lib/esm/components/filter/Filter.js +43 -16
  146. package/lib/esm/components/filter/Filter.js.map +1 -1
  147. package/lib/esm/components/filter/Filter.styles.js +2 -2
  148. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  149. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +10 -2
  150. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  151. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
  152. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  153. package/lib/esm/components/grid-image/GridImage.js +8 -2
  154. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  155. package/lib/esm/components/grid-image/GridImage.styles.js +4 -9
  156. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  157. package/lib/esm/components/grouped-image/GroupedImage.js +9 -3
  158. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  159. package/lib/esm/components/grouped-image/GroupedImage.styles.js +3 -8
  160. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  161. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +8 -3
  162. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  163. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +4 -9
  164. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  165. package/lib/esm/components/icon/Icon.js +9 -2
  166. package/lib/esm/components/icon/Icon.js.map +1 -1
  167. package/lib/esm/components/icon/Icon.styles.js +5 -31
  168. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  169. package/lib/esm/components/input/Input.js +14 -2
  170. package/lib/esm/components/input/Input.js.map +1 -1
  171. package/lib/esm/components/input/Input.styles.js +0 -3
  172. package/lib/esm/components/input/Input.styles.js.map +1 -1
  173. package/lib/esm/components/list/List.utils.js +1 -6
  174. package/lib/esm/components/list/List.utils.js.map +1 -1
  175. package/lib/esm/components/list/list-item/ListItem.js +13 -2
  176. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  177. package/lib/esm/components/list/list-item/ListItem.styles.js +9 -2
  178. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  179. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +5 -4
  180. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  181. package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
  182. package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
  183. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -2
  184. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  185. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
  186. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  187. package/lib/esm/components/radio-button/RadioButton.js +7 -1
  188. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  189. package/lib/esm/components/radio-button/RadioButton.styles.js +0 -10
  190. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  191. package/lib/esm/components/search-input/SearchInput.js +9 -10
  192. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  193. package/lib/esm/components/search-input/SearchInput.styles.js +5 -15
  194. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  195. package/lib/esm/components/sharing-bar/SharingBar.js +12 -0
  196. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  197. package/lib/esm/components/sharing-bar/SharingBar.styles.js +1 -5
  198. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  199. package/lib/esm/components/slider/Slider.js +13 -6
  200. package/lib/esm/components/slider/Slider.js.map +1 -1
  201. package/lib/esm/components/slider/Slider.styles.js +1 -8
  202. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  203. package/lib/esm/components/slider-button/SliderButton.js +6 -2
  204. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  205. package/lib/esm/components/slider-button/SliderButton.styles.js +1 -14
  206. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  207. package/lib/esm/components/tag-input/TagInput.js +8 -1
  208. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  209. package/lib/esm/components/tag-input/TagInput.styles.js +1 -3
  210. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  211. package/lib/esm/components/text-area/TextArea.js +68 -56
  212. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  213. package/lib/esm/components/text-area/TextArea.styles.js +0 -2
  214. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  215. package/lib/esm/components/truncation/Truncation.js +9 -5
  216. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  217. package/lib/esm/components/truncation/Truncation.styles.js +0 -11
  218. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  219. package/lib/esm/hooks/useFocusRingPortal.js +188 -0
  220. package/lib/esm/hooks/useFocusRingPortal.js.map +1 -0
  221. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +7 -2
  222. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -1
  223. package/lib/esm/index.js +2 -0
  224. package/lib/esm/index.js.map +1 -1
  225. package/lib/types/components/amount-control/AmountControl.styles.d.ts +4 -8
  226. package/lib/types/components/button/Button.styles.d.ts +2 -4
  227. package/lib/types/components/checkbox/Checkbox.styles.d.ts +1 -5
  228. package/lib/types/components/combobox/ComboBox.styles.d.ts +2 -4
  229. package/lib/types/components/file-select/FileSelect.styles.d.ts +2 -4
  230. package/lib/types/components/grid-image/GridImage.styles.d.ts +2 -4
  231. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +2 -4
  232. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +1 -5
  233. package/lib/types/components/icon/Icon.styles.d.ts +0 -1
  234. package/lib/types/components/input/Input.styles.d.ts +4 -4
  235. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +2 -4
  236. package/lib/types/components/radio-button/RadioButton.styles.d.ts +2 -4
  237. package/lib/types/components/search-input/SearchInput.styles.d.ts +6 -13
  238. package/lib/types/components/slider/Slider.styles.d.ts +8 -12
  239. package/lib/types/components/slider-button/SliderButton.styles.d.ts +2 -4
  240. package/lib/types/components/truncation/Truncation.styles.d.ts +1 -5
  241. package/lib/types/hooks/useFocusRingPortal.d.ts +18 -0
  242. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +1 -0
  243. package/lib/types/index.d.ts +2 -0
  244. package/package.json +4 -4
  245. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +0 -29
  246. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  247. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +0 -24
  248. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  249. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +0 -9
@@ -1 +1 @@
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","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.div<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;AAG/C,SAASC,sCAAsC,QAAQ,8CAA8C;AAOrG,OAAO,MAAMC,iB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ACT,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,CAACQ,GAAgC;AAC7E,aAAa,CAAC;EAAEE;AAAmC,CAAC,KAAKA,KAAK,CAACS,IAAI;AACnE;AACA,cAAc,CAAC;EAAEd;AAAyC,CAAC,KACnDA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE,CAAC;AAED,OAAO,MAAMe,kBAAkB,GAAGpB,MAAM,CAACQ,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMa,+BAA+B,GAAGrB,MAAM,CACjDD,MAAM,CAACS,GACX,CAAuC;AACvC;AACA;AACA;AACA,aAAa,CAAC;EAAEE;AAA4C,CAAC,KAAKA,KAAK,CAACS,IAAI;AAC5E,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"RadioButton.styles.js","names":["motion","styled","css","StyledRadioButton","span","$isDisabled","$radioButtonRightElementMargin","StyledRadioButtonWrapper","div","StyledRadioButtonPseudoCheckBox","theme","$isChecked","StyledRadioButtonCheckBox","input","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledRadioButtonLabel","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\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}>;\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 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.div<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`;\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A6B,GAAGb,MAAM,CAACG,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;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,CAACO,GAAgC;AAC7E,aAAa,CAAC;EAAEE;AAAmC,CAAC,KAAKA,KAAK,CAACQ,IAAI;AACnE;AACA,cAAc,CAAC;EAAEb;AAAyC,CAAC,KACnDA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE,CAAC;AAED,OAAO,MAAMc,kBAAkB,GAAGlB,MAAM,CAACO,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMY,+BAA+B,GAAGnB,MAAM,CACjDD,MAAM,CAACQ,GACX,CAAuC;AACvC;AACA;AACA;AACA,aAAa,CAAC;EAAEE;AAA4C,CAAC,KAAKA,KAAK,CAACQ,IAAI;AAC5E,CAAC","ignoreList":[]}
@@ -5,6 +5,7 @@ import Input, { InputSize } from '../input/Input';
5
5
  import { StyledMotionSearchInputContentWrapper, StyledMotionSearchInputIconWrapper, StyledMotionSearchInputIconWrapperContent, StyledSearchInput, StyledSearchInputIconTrigger, StyledSearchInputPseudoElement } from './SearchInput.styles';
6
6
  import { useTheme } from 'styled-components';
7
7
  import { useElementSize } from '../../hooks/element';
8
+ import { useFocusRingPortal } from '../../hooks/useFocusRingPortal';
8
9
  import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
9
10
  const SearchInput = /*#__PURE__*/forwardRef(({
10
11
  iconColor,
@@ -26,6 +27,10 @@ const SearchInput = /*#__PURE__*/forwardRef(({
26
27
  const parentWidth = useElementSize(pseudoRef);
27
28
  const theme = useTheme();
28
29
  const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting);
30
+ useFocusRingPortal(iconTriggerRef, {
31
+ isEnabled: shouldShowKeyboardHighlighting,
32
+ shape: 'circle'
33
+ });
29
34
  const handleBackIconClick = useCallback(() => setIsSearchInputActive(false), []);
30
35
  const handleSearchIconClick = useCallback(() => setIsSearchInputActive(true), []);
31
36
  const handleIconTriggerClick = useCallback(() => {
@@ -79,7 +84,6 @@ const SearchInput = /*#__PURE__*/forwardRef(({
79
84
  initial: false
80
85
  }, isSearchInputActive && /*#__PURE__*/React.createElement(StyledMotionSearchInputContentWrapper, {
81
86
  $shouldUseAbsolutePositioning: shouldUseAbsolutePositioning,
82
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
83
87
  animate: {
84
88
  opacity: 1,
85
89
  width
@@ -111,8 +115,7 @@ const SearchInput = /*#__PURE__*/forwardRef(({
111
115
  id: isSearchInputActive ? 'search-input-backIcon' : 'search-input-searchIcon',
112
116
  tabIndex: 0,
113
117
  onClick: handleIconTriggerClick,
114
- onKeyDown: handleIconTriggerKeyDown,
115
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
118
+ onKeyDown: handleIconTriggerKeyDown
116
119
  }, /*#__PURE__*/React.createElement(StyledMotionSearchInputIconWrapperContent, {
117
120
  animate: {
118
121
  opacity: 1
@@ -127,8 +130,7 @@ const SearchInput = /*#__PURE__*/forwardRef(({
127
130
  key: isSearchInputActive ? 'backIcon' : 'searchIcon',
128
131
  transition: {
129
132
  duration: 0.3
130
- },
131
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
133
+ }
132
134
  }, /*#__PURE__*/React.createElement(Icon, {
133
135
  key: "icon",
134
136
  color: iconColor,
@@ -141,8 +143,7 @@ const SearchInput = /*#__PURE__*/forwardRef(({
141
143
  id: isSearchInputActive ? 'search-input-backIcon' : 'search-input-searchIcon',
142
144
  tabIndex: 0,
143
145
  onClick: handleIconTriggerClick,
144
- onKeyDown: handleIconTriggerKeyDown,
145
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
146
+ onKeyDown: handleIconTriggerKeyDown
146
147
  }, /*#__PURE__*/React.createElement(StyledMotionSearchInputIconWrapperContent, {
147
148
  animate: {
148
149
  opacity: 1
@@ -157,8 +158,7 @@ const SearchInput = /*#__PURE__*/forwardRef(({
157
158
  key: isSearchInputActive ? 'backIcon' : 'searchIcon',
158
159
  transition: {
159
160
  duration: 0.3
160
- },
161
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
161
+ }
162
162
  }, /*#__PURE__*/React.createElement(Icon, {
163
163
  key: "icon",
164
164
  color: iconColor,
@@ -168,7 +168,6 @@ const SearchInput = /*#__PURE__*/forwardRef(({
168
168
  initial: false
169
169
  }, isSearchInputActive && /*#__PURE__*/React.createElement(StyledMotionSearchInputContentWrapper, {
170
170
  $shouldUseAbsolutePositioning: shouldUseAbsolutePositioning,
171
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
172
171
  animate: {
173
172
  opacity: 1,
174
173
  width: '100%'
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.js","names":["AnimatePresence","React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","Icon","Input","InputSize","StyledMotionSearchInputContentWrapper","StyledMotionSearchInputIconWrapper","StyledMotionSearchInputIconWrapperContent","StyledSearchInput","StyledSearchInputIconTrigger","StyledSearchInputPseudoElement","useTheme","useElementSize","useKeyboardFocusHighlighting","SearchInput","iconColor","isActive","onActiveChange","onChange","onKeyDown","placeholder","shouldUseAbsolutePositioning","size","Medium","value","shouldEnableKeyboardHighlighting","width","widthValue","ref","isSearchInputActive","setIsSearchInputActive","trim","inputRef","pseudoRef","iconTriggerRef","parentWidth","theme","shouldShowKeyboardHighlighting","handleBackIconClick","handleSearchIconClick","handleIconTriggerClick","handleIconTriggerKeyDown","event","key","preventDefault","handleInputKeyDown","current","focus","blur","createElement","Fragment","className","$size","$shouldUseAbsolutePositioning","initial","$shouldShowKeyboardHighlighting","animate","opacity","exit","transition","duration","type","shouldShowClearIcon","id","tabIndex","onClick","position","color","icons","leftElement","text","displayName"],"sources":["../../../../src/components/search-input/SearchInput.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport Icon from '../icon/Icon';\nimport Input, { InputRef, InputSize } from '../input/Input';\nimport {\n StyledMotionSearchInputContentWrapper,\n StyledMotionSearchInputIconWrapper,\n StyledMotionSearchInputIconWrapperContent,\n StyledSearchInput,\n StyledSearchInputIconTrigger,\n StyledSearchInputPseudoElement,\n} from './SearchInput.styles';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { useElementSize } from '../../hooks/element';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport type SearchInputProps = {\n /**\n * Color of the icon\n */\n iconColor?: CSSProperties['color'];\n /**\n * Force the active state of the input and override the internal state\n */\n isActive?: boolean;\n /**\n * Function that is executed when the active state of the input changes\n */\n onActiveChange?: (isActive: boolean) => void;\n /**\n * Function that is executed when the text of the input changes\n */\n onChange: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when a key is pressed\n */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Whether the SearchInput should be positioned absolute.\n */\n shouldUseAbsolutePositioning?: boolean;\n /**\n * The size of the input field\n */\n size?: InputSize;\n /**\n * Value if the input field should be controlled\n */\n value?: string;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * The width of the parent.\n */\n width?: number;\n};\n\nconst SearchInput = forwardRef<InputRef, SearchInputProps>(\n (\n {\n iconColor,\n isActive,\n onActiveChange,\n onChange,\n onKeyDown,\n placeholder,\n shouldUseAbsolutePositioning = false,\n size = InputSize.Medium,\n value,\n shouldEnableKeyboardHighlighting,\n width: widthValue,\n },\n ref,\n ) => {\n const [isSearchInputActive, setIsSearchInputActive] = useState(\n isActive ?? (typeof value === 'string' && value.trim() !== ''),\n );\n\n const inputRef = useRef<InputRef>(null);\n const pseudoRef = useRef<HTMLDivElement>(null);\n const iconTriggerRef = useRef<HTMLDivElement>(null);\n\n const parentWidth = useElementSize(pseudoRef);\n\n const theme = useTheme() as Theme;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n\n const handleBackIconClick = useCallback(() => setIsSearchInputActive(false), []);\n\n const handleSearchIconClick = useCallback(() => setIsSearchInputActive(true), []);\n\n const handleIconTriggerClick = useCallback(() => {\n if (isSearchInputActive) {\n handleBackIconClick();\n return;\n }\n\n handleSearchIconClick();\n }, [handleBackIconClick, handleSearchIconClick, isSearchInputActive]);\n\n const handleIconTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleIconTriggerClick();\n }\n },\n [handleIconTriggerClick],\n );\n\n const handleInputKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n setIsSearchInputActive(false);\n iconTriggerRef.current?.focus();\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n },\n [onActiveChange, onKeyDown],\n );\n\n useEffect(() => {\n if (typeof onActiveChange === 'function') {\n onActiveChange(isSearchInputActive);\n }\n }, [isSearchInputActive, onActiveChange]);\n\n useEffect(() => {\n if (isSearchInputActive) {\n inputRef.current?.focus();\n }\n }, [isSearchInputActive]);\n\n useEffect(() => {\n if (typeof isActive === 'boolean') {\n setIsSearchInputActive(isActive);\n }\n }, [isActive]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n }),\n [],\n );\n\n const width = useMemo(\n () => widthValue ?? parentWidth?.width,\n [parentWidth?.width, widthValue],\n );\n\n return (\n <>\n <StyledSearchInput\n className=\"beta-chayns-search-input\"\n $size={size}\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n >\n {shouldUseAbsolutePositioning ? (\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n animate={{ opacity: 1, width }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <Input\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive ? ['fa fa-xmark'] : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n ) : (\n <>\n <StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n $shouldShowKeyboardHighlighting={\n shouldShowKeyboardHighlighting\n }\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n $shouldShowKeyboardHighlighting={\n shouldShowKeyboardHighlighting\n }\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive\n ? ['fa fa-arrow-left']\n : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n </StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n $shouldShowKeyboardHighlighting={\n shouldShowKeyboardHighlighting\n }\n animate={{ opacity: 1, width: '100%' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.3 }}\n >\n <Input\n key=\"input\"\n leftElement={\n <Icon\n color={theme.text}\n icons={['far fa-search']}\n />\n }\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n </AnimatePresence>\n </>\n )}\n </StyledSearchInput>\n <StyledSearchInputPseudoElement ref={pseudoRef} />\n </>\n );\n },\n);\n\nSearchInput.displayName = 'SearchInput';\n\nexport default SearchInput;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAGRC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,KAAK,IAAcC,SAAS,QAAQ,gBAAgB;AAC3D,SACIC,qCAAqC,EACrCC,kCAAkC,EAClCC,yCAAyC,EACzCC,iBAAiB,EACjBC,4BAA4B,EAC5BC,8BAA8B,QAC3B,sBAAsB;AAC7B,SAASC,QAAQ,QAAQ,mBAAmB;AAE5C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,4BAA4B,QAAQ,0CAA0C;AAiDvF,MAAMC,WAAW,gBAAGnB,UAAU,CAC1B,CACI;EACIoB,SAAS;EACTC,QAAQ;EACRC,cAAc;EACdC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,4BAA4B,GAAG,KAAK;EACpCC,IAAI,GAAGlB,SAAS,CAACmB,MAAM;EACvBC,KAAK;EACLC,gCAAgC;EAChCC,KAAK,EAAEC;AACX,CAAC,EACDC,GAAG,KACF;EACD,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GAAG7B,QAAQ,CAC1De,QAAQ,KAAK,OAAOQ,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACO,IAAI,CAAC,CAAC,KAAK,EAAE,CACjE,CAAC;EAED,MAAMC,QAAQ,GAAGhC,MAAM,CAAW,IAAI,CAAC;EACvC,MAAMiC,SAAS,GAAGjC,MAAM,C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AAG,aAAa;AAEvC,eAAezD,WAAW","ignoreList":[]}
1
+ {"version":3,"file":"SearchInput.js","names":["AnimatePresence","React","forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","Icon","Input","InputSize","StyledMotionSearchInputContentWrapper","StyledMotionSearchInputIconWrapper","StyledMotionSearchInputIconWrapperContent","StyledSearchInput","StyledSearchInputIconTrigger","StyledSearchInputPseudoElement","useTheme","useElementSize","useFocusRingPortal","useKeyboardFocusHighlighting","SearchInput","iconColor","isActive","onActiveChange","onChange","onKeyDown","placeholder","shouldUseAbsolutePositioning","size","Medium","value","shouldEnableKeyboardHighlighting","width","widthValue","ref","isSearchInputActive","setIsSearchInputActive","trim","inputRef","pseudoRef","iconTriggerRef","parentWidth","theme","shouldShowKeyboardHighlighting","isEnabled","shape","handleBackIconClick","handleSearchIconClick","handleIconTriggerClick","handleIconTriggerKeyDown","event","key","preventDefault","handleInputKeyDown","current","focus","blur","createElement","Fragment","className","$size","$shouldUseAbsolutePositioning","initial","animate","opacity","exit","transition","duration","type","shouldShowClearIcon","id","tabIndex","onClick","position","color","icons","leftElement","text","displayName"],"sources":["../../../../src/components/search-input/SearchInput.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport Icon from '../icon/Icon';\nimport Input, { InputRef, InputSize } from '../input/Input';\nimport {\n StyledMotionSearchInputContentWrapper,\n StyledMotionSearchInputIconWrapper,\n StyledMotionSearchInputIconWrapperContent,\n StyledSearchInput,\n StyledSearchInputIconTrigger,\n StyledSearchInputPseudoElement,\n} from './SearchInput.styles';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { useElementSize } from '../../hooks/element';\nimport { useFocusRingPortal } from '../../hooks/useFocusRingPortal';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport type SearchInputProps = {\n /**\n * Color of the icon\n */\n iconColor?: CSSProperties['color'];\n /**\n * Force the active state of the input and override the internal state\n */\n isActive?: boolean;\n /**\n * Function that is executed when the active state of the input changes\n */\n onActiveChange?: (isActive: boolean) => void;\n /**\n * Function that is executed when the text of the input changes\n */\n onChange: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when a key is pressed\n */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Whether the SearchInput should be positioned absolute.\n */\n shouldUseAbsolutePositioning?: boolean;\n /**\n * The size of the input field\n */\n size?: InputSize;\n /**\n * Value if the input field should be controlled\n */\n value?: string;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * The width of the parent.\n */\n width?: number;\n};\n\nconst SearchInput = forwardRef<InputRef, SearchInputProps>(\n (\n {\n iconColor,\n isActive,\n onActiveChange,\n onChange,\n onKeyDown,\n placeholder,\n shouldUseAbsolutePositioning = false,\n size = InputSize.Medium,\n value,\n shouldEnableKeyboardHighlighting,\n width: widthValue,\n },\n ref,\n ) => {\n const [isSearchInputActive, setIsSearchInputActive] = useState(\n isActive ?? (typeof value === 'string' && value.trim() !== ''),\n );\n\n const inputRef = useRef<InputRef>(null);\n const pseudoRef = useRef<HTMLDivElement>(null);\n const iconTriggerRef = useRef<HTMLDivElement>(null);\n\n const parentWidth = useElementSize(pseudoRef);\n\n const theme = useTheme() as Theme;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(iconTriggerRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n shape: 'circle',\n });\n\n const handleBackIconClick = useCallback(() => setIsSearchInputActive(false), []);\n\n const handleSearchIconClick = useCallback(() => setIsSearchInputActive(true), []);\n\n const handleIconTriggerClick = useCallback(() => {\n if (isSearchInputActive) {\n handleBackIconClick();\n return;\n }\n\n handleSearchIconClick();\n }, [handleBackIconClick, handleSearchIconClick, isSearchInputActive]);\n\n const handleIconTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleIconTriggerClick();\n }\n },\n [handleIconTriggerClick],\n );\n\n const handleInputKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n setIsSearchInputActive(false);\n iconTriggerRef.current?.focus();\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n },\n [onActiveChange, onKeyDown],\n );\n\n useEffect(() => {\n if (typeof onActiveChange === 'function') {\n onActiveChange(isSearchInputActive);\n }\n }, [isSearchInputActive, onActiveChange]);\n\n useEffect(() => {\n if (isSearchInputActive) {\n inputRef.current?.focus();\n }\n }, [isSearchInputActive]);\n\n useEffect(() => {\n if (typeof isActive === 'boolean') {\n setIsSearchInputActive(isActive);\n }\n }, [isActive]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n }),\n [],\n );\n\n const width = useMemo(\n () => widthValue ?? parentWidth?.width,\n [parentWidth?.width, widthValue],\n );\n\n return (\n <>\n <StyledSearchInput\n className=\"beta-chayns-search-input\"\n $size={size}\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n >\n {shouldUseAbsolutePositioning ? (\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n animate={{ opacity: 1, width }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <Input\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive ? ['fa fa-xmark'] : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n ) : (\n <>\n <StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive\n ? ['fa fa-arrow-left']\n : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n </StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n animate={{ opacity: 1, width: '100%' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.3 }}\n >\n <Input\n key=\"input\"\n leftElement={\n <Icon\n color={theme.text}\n icons={['far fa-search']}\n />\n }\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n </AnimatePresence>\n </>\n )}\n </StyledSearchInput>\n <StyledSearchInputPseudoElement ref={pseudoRef} />\n </>\n );\n },\n);\n\nSearchInput.displayName = 'SearchInput';\n\nexport default SearchInput;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAGRC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,KAAK,IAAcC,SAAS,QAAQ,gBAAgB;AAC3D,SACIC,qCAAqC,EACrCC,kCAAkC,EAClCC,yCAAyC,EACzCC,iBAAiB,EACjBC,4BAA4B,EAC5BC,8BAA8B,QAC3B,sBAAsB;AAC7B,SAASC,QAAQ,QAAQ,mBAAmB;AAE5C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,4BAA4B,QAAQ,0CAA0C;AAiDvF,MAAMC,WAAW,gBAAGpB,UAAU,CAC1B,CACI;EACIqB,SAAS;EACTC,QAAQ;EACRC,cAAc;EACdC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,4BAA4B,GAAG,KAAK;EACpCC,IAAI,GAAGnB,SAAS,CAACoB,MAAM;EACvBC,KAAK;EACLC,gCAAgC;EAChCC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AAI,EAAEA,IAAK;IACXE,KAAK,EAAEA;EAAM,CAChB,CACkC,CAE9B,CACnB,CAES,CAAC,eACpB/B,KAAA,CAAA0D,aAAA,CAAC1C,8BAA8B;IAACmB,GAAG,EAAEK;EAAU,CAAE,CACnD,CAAC;AAEX,CACJ,CAAC;AAEDnB,WAAW,CAAC0D,WAAW,GAAG,aAAa;AAEvC,eAAe1D,WAAW","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  import { motion } from 'motion/react';
2
2
  import styled, { css } from 'styled-components';
3
- import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
4
3
  export const StyledSearchInput = styled.div`
5
4
  display: flex;
6
5
  align-items: center;
@@ -44,9 +43,7 @@ export const StyledMotionSearchInputContentWrapper = styled(motion.div)`
44
43
  right: 0;
45
44
  `}
46
45
 
47
- overflow: ${({
48
- $shouldShowKeyboardHighlighting
49
- }) => $shouldShowKeyboardHighlighting ? 'visible' : 'hidden'};
46
+ overflow: hidden;
50
47
  `;
51
48
  export const StyledMotionSearchInputIconWrapperContent = styled(motion.div)`
52
49
  display: flex;
@@ -61,17 +58,10 @@ export const StyledSearchInputIconTrigger = styled.div`
61
58
  border-radius: 6px;
62
59
  cursor: pointer;
63
60
 
64
- ${({
65
- $shouldShowKeyboardHighlighting
66
- }) => $shouldShowKeyboardHighlighting && css`
67
- &:focus-visible {
68
- transition: none;
69
- ${keyboardFocusHighlightingRingCss}
70
- border-radius: 50%;
71
- box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.35);
72
- outline-offset: 2px;
73
- }
74
- `}
61
+ &:focus-visible {
62
+ outline: none;
63
+ box-shadow: none;
64
+ }
75
65
  `;
76
66
  export const StyledMotionSearchInputIconWrapper = styled.div`
77
67
  width: 18px;
@@ -1 +1 @@
1
- {"version":3,"file":"SearchInput.styles.js","names":["motion","styled","css","keyboardFocusHighlightingRingCss","StyledSearchInput","div","$size","$shouldUseAbsolutePositioning","theme","StyledSearchInputPseudoElement","StyledMotionSearchInputContentWrapper","$shouldShowKeyboardHighlighting","StyledMotionSearchInputIconWrapperContent","StyledSearchInputIconTrigger","StyledMotionSearchInputIconWrapper"],"sources":["../../../../src/components/search-input/SearchInput.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { InputSize } from '../input/Input';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledSearchInputProps = WithTheme<{\n $size: InputSize;\n $shouldUseAbsolutePositioning: boolean;\n}>;\n\nexport const StyledSearchInput = styled.div<StyledSearchInputProps>`\n display: flex;\n align-items: center;\n\n height: ${({ $size }: StyledSearchInputProps) => ($size === 'medium' ? '42px' : '32px')};\n\n ${({ $shouldUseAbsolutePositioning, theme }: StyledSearchInputProps) =>\n $shouldUseAbsolutePositioning\n ? css`\n justify-content: center;\n aspect-ratio: 1;\n border-radius: 3px;\n position: relative;\n cursor: pointer;\n\n @media (pointer: fine) {\n &:hover {\n background-color: ${theme[201]};\n }\n }\n `\n : css`\n gap: 8px;\n justify-content: flex-end;\n width: 100%;\n `}\n`;\n\nexport const StyledSearchInputPseudoElement = styled.div`\n position: absolute;\n right: 0;\n left: 0;\n`;\n\ntype StyledMotionSearchInputContentWrapperProps = {\n $shouldUseAbsolutePositioning: boolean;\n $shouldShowKeyboardHighlighting: boolean;\n};\n\nexport const StyledMotionSearchInputContentWrapper = styled(\n motion.div,\n)<StyledMotionSearchInputContentWrapperProps>`\n ${({ $shouldUseAbsolutePositioning }) =>\n $shouldUseAbsolutePositioning &&\n css`\n position: absolute;\n top: 0;\n right: 0;\n `}\n\n overflow: ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting ? 'visible' : 'hidden'};\n`;\n\ntype StyledMotionSearchInputIconWrapperContentProps = {\n $shouldShowKeyboardHighlighting: boolean;\n};\n\nexport const StyledMotionSearchInputIconWrapperContent = styled(\n motion.div,\n)<StyledMotionSearchInputIconWrapperContentProps>`\n display: flex;\n cursor: pointer;\n`;\n\ntype StyledSearchInputIconTriggerProps = {\n $shouldShowKeyboardHighlighting: boolean;\n};\n\nexport const StyledSearchInputIconTrigger = styled.div<StyledSearchInputIconTriggerProps>`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 6px;\n cursor: pointer;\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n border-radius: 50%;\n box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.35);\n outline-offset: 2px;\n }\n `}\n`;\n\nexport const StyledMotionSearchInputIconWrapper = styled.div`\n width: 18px;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,gCAAgC,QAAQ,8CAA8C;AAO/F,OAAO,MAAMC,iBAAiB,GAAGH,MAAM,CAACI,GAA2B;AACnE;AACA;AACA;AACA,cAAc,CAAC;EAAEC;AAA8B,CAAC,KAAMA,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAO;AAC3F;AACA,MAAM,CAAC;EAAEC,6BAA6B;EAAEC;AAA8B,CAAC,KAC/DD,6BAA6B,GACvBL,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8CM,KAAK,CAAC,GAAG,CAAC;AACxD;AACA;AACA,eAAe,GACDN,GAAG;AACjB;AACA;AACA;AACA,eAAe;AACf,CAAC;AAED,OAAO,MAAMO,8BAA8B,GAAGR,MAAM,CAACI,GAAG;AACxD;AACA;AACA;AACA,CAAC;AAOD,OAAO,MAAMK,qCAAqC,GAAGT,MAAM,CACvDD,MAAM,CAACK,GACX,CAA6C;AAC7C,MAAM,CAAC;EAAEE;AAA8B,CAAC,KAChCA,6BAA6B,IAC7BL,GAAG;AACX;AACA;AACA;AACA,SAAS;AACT;AACA,gBAAgB,CAAC;EAAES;AAAgC,CAAC,KAC5CA,+BAA+B,GAAG,SAAS,GAAG,QAAQ;AAC9D,CAAC;AAMD,OAAO,MAAMC,yCAAyC,GAAGX,MAAM,CAC3DD,MAAM,CAACK,GACX,CAAiD;AACjD;AACA;AACA,CAAC;AAMD,OAAO,MAAMQ,4BAA4B,GAAGZ,MAAM,CAACI,GAAsC;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEM;AAAgC,CAAC,KAClCA,+BAA+B,IAC/BT,GAAG;AACX;AACA;AACA,kBAAkBC,gCAAgC;AAClD;AACA;AACA;AACA;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAMW,kCAAkC,GAAGb,MAAM,CAACI,GAAG;AAC5D;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SearchInput.styles.js","names":["motion","styled","css","StyledSearchInput","div","$size","$shouldUseAbsolutePositioning","theme","StyledSearchInputPseudoElement","StyledMotionSearchInputContentWrapper","StyledMotionSearchInputIconWrapperContent","StyledSearchInputIconTrigger","StyledMotionSearchInputIconWrapper"],"sources":["../../../../src/components/search-input/SearchInput.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { InputSize } from '../input/Input';\n\ntype StyledSearchInputProps = WithTheme<{\n $size: InputSize;\n $shouldUseAbsolutePositioning: boolean;\n}>;\n\nexport const StyledSearchInput = styled.div<StyledSearchInputProps>`\n display: flex;\n align-items: center;\n\n height: ${({ $size }: StyledSearchInputProps) => ($size === 'medium' ? '42px' : '32px')};\n\n ${({ $shouldUseAbsolutePositioning, theme }: StyledSearchInputProps) =>\n $shouldUseAbsolutePositioning\n ? css`\n justify-content: center;\n aspect-ratio: 1;\n border-radius: 3px;\n position: relative;\n cursor: pointer;\n\n @media (pointer: fine) {\n &:hover {\n background-color: ${theme[201]};\n }\n }\n `\n : css`\n gap: 8px;\n justify-content: flex-end;\n width: 100%;\n `}\n`;\n\nexport const StyledSearchInputPseudoElement = styled.div`\n position: absolute;\n right: 0;\n left: 0;\n`;\n\ntype StyledMotionSearchInputContentWrapperProps = {\n $shouldUseAbsolutePositioning: boolean;\n};\n\nexport const StyledMotionSearchInputContentWrapper = styled(\n motion.div,\n)<StyledMotionSearchInputContentWrapperProps>`\n ${({ $shouldUseAbsolutePositioning }) =>\n $shouldUseAbsolutePositioning &&\n css`\n position: absolute;\n top: 0;\n right: 0;\n `}\n\n overflow: hidden;\n`;\n\nexport const StyledMotionSearchInputIconWrapperContent = styled(motion.div)`\n display: flex;\n cursor: pointer;\n`;\n\nexport const StyledSearchInputIconTrigger = styled.div`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 6px;\n cursor: pointer;\n\n &:focus-visible {\n outline: none;\n box-shadow: none;\n }\n`;\n\nexport const StyledMotionSearchInputIconWrapper = styled.div`\n width: 18px;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAS/C,OAAO,MAAMC,iBAAiB,GAAGF,MAAM,CAACG,GAA2B;AACnE;AACA;AACA;AACA,cAAc,CAAC;EAAEC;AAA8B,CAAC,KAAMA,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAO;AAC3F;AACA,MAAM,CAAC;EAAEC,6BAA6B;EAAEC;AAA8B,CAAC,KAC/DD,6BAA6B,GACvBJ,GAAG;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8CK,KAAK,CAAC,GAAG,CAAC;AACxD;AACA;AACA,eAAe,GACDL,GAAG;AACjB;AACA;AACA;AACA,eAAe;AACf,CAAC;AAED,OAAO,MAAMM,8BAA8B,GAAGP,MAAM,CAACG,GAAG;AACxD;AACA;AACA;AACA,CAAC;AAMD,OAAO,MAAMK,qCAAqC,GAAGR,MAAM,CACvDD,MAAM,CAACI,GACX,CAA6C;AAC7C,MAAM,CAAC;EAAEE;AAA8B,CAAC,KAChCA,6BAA6B,IAC7BJ,GAAG;AACX;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AAED,OAAO,MAAMQ,yCAAyC,GAAGT,MAAM,CAACD,MAAM,CAACI,GAAG,CAAC;AAC3E;AACA;AACA,CAAC;AAED,OAAO,MAAMO,4BAA4B,GAAGV,MAAM,CAACG,GAAG;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMQ,kCAAkC,GAAGX,MAAM,CAACG,GAAG;AAC5D;AACA,CAAC","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import React, { useCallback, useRef } from 'react';
2
+ import { useFocusRingPortal } from '../../hooks/useFocusRingPortal';
2
3
  import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
3
4
  import { useColorScheme } from '../color-scheme-provider/ColorSchemeProvider';
4
5
  import Icon from '../icon/Icon';
@@ -14,7 +15,11 @@ const SharingBar = ({
14
15
  const colorScheme = useColorScheme();
15
16
  const shouldEnableKeyboardHighlightingEffective = shouldEnableKeyboardHighlighting ?? colorScheme?.shouldEnableKeyboardHighlighting ?? false;
16
17
  const contextMenuRef = useRef(null);
18
+ const sharingBarRef = useRef(null);
17
19
  const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlightingEffective);
20
+ useFocusRingPortal(sharingBarRef, {
21
+ isEnabled: shouldShowKeyboardHighlighting
22
+ });
18
23
  const showContextMenu = useCallback(() => {
19
24
  contextMenuRef.current?.show();
20
25
  }, []);
@@ -27,6 +32,12 @@ const SharingBar = ({
27
32
  if (event.currentTarget !== event.target) {
28
33
  return;
29
34
  }
35
+ if (event.key === 'Escape') {
36
+ event.preventDefault();
37
+ event.stopPropagation();
38
+ contextMenuRef.current?.hide();
39
+ return;
40
+ }
30
41
  if (event.key !== 'Enter' && event.key !== ' ') {
31
42
  return;
32
43
  }
@@ -35,6 +46,7 @@ const SharingBar = ({
35
46
  showContextMenu();
36
47
  }, [showContextMenu]);
37
48
  return /*#__PURE__*/React.createElement(StyledSharingBar, {
49
+ ref: sharingBarRef,
38
50
  onClick: handleSharingBarClick,
39
51
  onKeyDown: shouldEnableKeyboardHighlightingEffective ? handleKeyDown : undefined,
40
52
  tabIndex: shouldEnableKeyboardHighlightingEffective ? 0 : undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"SharingBar.js","names":["React","useCallback","useRef","useKeyboardFocusHighlighting","useColorScheme","Icon","StyledSharingBar","StyledSharingBarIconWrapper","StyledSharingBarText","SharingContextMenu","SharingBar","label","link","popupAlignment","container","shouldEnableKeyboardHighlighting","colorScheme","shouldEnableKeyboardHighlightingEffective","contextMenuRef","shouldShowKeyboardHighlighting","showContextMenu","current","show","handleSharingBarClick","event","preventDefault","stopPropagation","handleKeyDown","currentTarget","target","key","createElement","onClick","onKeyDown","undefined","tabIndex","role","icons","ref","alignment","shouldDisableClick","displayName"],"sources":["../../../../src/components/sharing-bar/SharingBar.tsx"],"sourcesContent":["import React, { FC, KeyboardEventHandler, MouseEventHandler, useCallback, useRef } from 'react';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport { useColorScheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledSharingBar,\n StyledSharingBarIconWrapper,\n StyledSharingBarText,\n} from './SharingBar.styles';\nimport type { ContextMenuAlignment } from '../context-menu/ContextMenu.types';\nimport SharingContextMenu from '../sharing-context-menu/SharingContextMenu';\n\nexport type SharingBarProps = {\n /**\n * The element where the content of the `SharingBar` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The label that should be displayed.\n */\n label: string;\n /**\n * The link that should be shared.\n */\n link: string;\n /**\n * The alignment of the sharing options.\n */\n popupAlignment: ContextMenuAlignment;\n /**\n * Enables keyboard-only focus highlighting and keyboard interaction.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nconst SharingBar: FC<SharingBarProps> = ({\n label,\n link,\n popupAlignment,\n container,\n shouldEnableKeyboardHighlighting,\n}) => {\n const colorScheme = useColorScheme();\n const shouldEnableKeyboardHighlightingEffective =\n shouldEnableKeyboardHighlighting ?? colorScheme?.shouldEnableKeyboardHighlighting ?? false;\n\n const contextMenuRef = useRef<{ hide: VoidFunction; show: VoidFunction }>(null);\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlightingEffective,\n );\n\n const showContextMenu = useCallback(() => {\n contextMenuRef.current?.show();\n }, []);\n\n const handleSharingBarClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n showContextMenu();\n },\n [showContextMenu],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLDivElement>>(\n (event) => {\n if (event.currentTarget !== event.target) {\n return;\n }\n\n if (event.key !== 'Enter' && event.key !== ' ') {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n showContextMenu();\n },\n [showContextMenu],\n );\n\n return (\n <StyledSharingBar\n onClick={handleSharingBarClick}\n onKeyDown={shouldEnableKeyboardHighlightingEffective ? handleKeyDown : undefined}\n tabIndex={shouldEnableKeyboardHighlightingEffective ? 0 : undefined}\n role={shouldEnableKeyboardHighlightingEffective ? 'button' : undefined}\n data-should-show-keyboard-highlighting={\n shouldShowKeyboardHighlighting ? 'true' : undefined\n }\n >\n <StyledSharingBarIconWrapper>\n <Icon icons={['fa fa-share-nodes']} />\n </StyledSharingBarIconWrapper>\n <SharingContextMenu\n link={link}\n ref={contextMenuRef}\n alignment={popupAlignment}\n container={container}\n shouldDisableClick\n >\n {null}\n </SharingContextMenu>\n <StyledSharingBarText>{label}</StyledSharingBarText>\n </StyledSharingBar>\n );\n};\n\nS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,CAACC,cAAc,CAAC,CAAC;IACtBD,KAAK,CAACE,eAAe,CAAC,CAAC;IACvBN,eAAe,CAAC,CAAC;EACrB,CAAC,EACD,CAACA,eAAe,CACpB,CAAC;EAED,oBACIpB,KAAA,CAAA+B,aAAA,CAACzB,gBAAgB;IACb0B,OAAO,EAAET,qBAAsB;IAC/BU,SAAS,EAAEhB,yCAAyC,GAAGU,aAAa,GAAGO,SAAU;IACjFC,QAAQ,EAAElB,yCAAyC,GAAG,CAAC,GAAGiB,SAAU;IACpEE,IAAI,EAAEnB,yCAAyC,GAAG,QAAQ,GAAGiB,SAAU;IACvE,0CACIf,8BAA8B,GAAG,MAAM,GAAGe;EAC7C,gBAEDlC,KAAA,CAAA+B,aAAA,CAACxB,2BAA2B,qBACxBP,KAAA,CAAA+B,aAAA,CAAC1B,IAAI;IAACgC,KAAK,EAAE,CAAC,mBAAmB;EAAE,CAAE,CACZ,CAAC,eAC9BrC,KAAA,CAAA+B,aAAA,CAACtB,kBAAkB;IACfG,IAAI,EAAEA,IAAK;IACX0B,GAAG,EAAEpB,cAAe;IACpBqB,SAAS,EAAE1B,cAAe;IAC1BC,SAAS,EAAEA,SAAU;IACrB0B,kBAAkB;EAAA,GAEjB,IACe,CAAC,eACrBxC,KAAA,CAAA+B,aAAA,CAACvB,oBAAoB,QAAEG,KAA4B,CACrC,CAAC;AAE3B,CAAC;AAEDD,UAAU,CAAC+B,WAAW,GAAG,YAAY;AAErC,eAAe/B,UAAU","ignoreList":[]}
1
+ {"version":3,"file":"SharingBar.js","names":["React","useCallback","useRef","useFocusRingPortal","useKeyboardFocusHighlighting","useColorScheme","Icon","StyledSharingBar","StyledSharingBarIconWrapper","StyledSharingBarText","SharingContextMenu","SharingBar","label","link","popupAlignment","container","shouldEnableKeyboardHighlighting","colorScheme","shouldEnableKeyboardHighlightingEffective","contextMenuRef","sharingBarRef","shouldShowKeyboardHighlighting","isEnabled","showContextMenu","current","show","handleSharingBarClick","event","preventDefault","stopPropagation","handleKeyDown","currentTarget","target","key","hide","createElement","ref","onClick","onKeyDown","undefined","tabIndex","role","icons","alignment","shouldDisableClick","displayName"],"sources":["../../../../src/components/sharing-bar/SharingBar.tsx"],"sourcesContent":["import React, { FC, KeyboardEventHandler, MouseEventHandler, useCallback, useRef } from 'react';\nimport { useFocusRingPortal } from '../../hooks/useFocusRingPortal';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport { useColorScheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledSharingBar,\n StyledSharingBarIconWrapper,\n StyledSharingBarText,\n} from './SharingBar.styles';\nimport type { ContextMenuAlignment } from '../context-menu/ContextMenu.types';\nimport SharingContextMenu from '../sharing-context-menu/SharingContextMenu';\n\nexport type SharingBarProps = {\n /**\n * The element where the content of the `SharingBar` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The label that should be displayed.\n */\n label: string;\n /**\n * The link that should be shared.\n */\n link: string;\n /**\n * The alignment of the sharing options.\n */\n popupAlignment: ContextMenuAlignment;\n /**\n * Enables keyboard-only focus highlighting and keyboard interaction.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nconst SharingBar: FC<SharingBarProps> = ({\n label,\n link,\n popupAlignment,\n container,\n shouldEnableKeyboardHighlighting,\n}) => {\n const colorScheme = useColorScheme();\n const shouldEnableKeyboardHighlightingEffective =\n shouldEnableKeyboardHighlighting ?? colorScheme?.shouldEnableKeyboardHighlighting ?? false;\n\n const contextMenuRef = useRef<{ hide: VoidFunction; show: VoidFunction }>(null);\n const sharingBarRef = useRef<HTMLDivElement>(null);\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlightingEffective,\n );\n useFocusRingPortal(sharingBarRef, { isEnabled: shouldShowKeyboardHighlighting });\n\n const showContextMenu = useCallback(() => {\n contextMenuRef.current?.show();\n }, []);\n\n const handleSharingBarClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n showContextMenu();\n },\n [showContextMenu],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLDivElement>>(\n (event) => {\n if (event.currentTarget !== event.target) {\n return;\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n contextMenuRef.current?.hide();\n return;\n }\n\n if (event.key !== 'Enter' && event.key !== ' ') {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n showContextMenu();\n },\n [showContextMenu],\n );\n\n return (\n <StyledSharingBar\n ref={sharingBarRef}\n onClick={handleSharingBarClick}\n onKeyDown={shouldEnableKeyboardHighlightingEffective ? handleKeyDown : undefined}\n tabIndex={shouldEnableKeyboardHighlightingEffective ? 0 : undefined}\n role={shouldEnableKeyboardHighlightingEffective ? 'button' : undefined}\n data-should-show-keyboard-highlighting={\n shouldShowKeyboardHighlighting ? 'true' : undefined\n }\n >\n <StyledSharingBarIconWrapper>\n <Icon icons={['fa fa-share-nodes']} />\n </StyledSharingBarIconWrapper>\n <SharingContextMenu\n link={link}\n ref={contextMenuRef}\n alignment={popupAlignment}\n container={container}\n shouldDisableClick\n >\n {null}\n </SharingContextMenu>\n <StyledSharingBarText>{label}</StyledSharingBarText>\n </StyledSharingBar>\n );\n};\n\nSharingBar.displayName = 'SharingBar';\n\nexport default SharingBar;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAiDC,WAAW,EAAEC,MAAM,QAAQ,OAAO;AAC/F,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,4BAA4B,QAAQ,0CAA0C;AACvF,SAASC,cAAc,QAAQ,8CAA8C;AAC7E,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,gBAAgB,EAChBC,2BAA2B,EAC3BC,oBAAoB,QACjB,qBAAqB;AAE5B,OAAOC,kBAAkB,MAAM,4CAA4C;AAyB3E,MAAMC,UAA+B,GAAGA,CAAC;EACrCC,KAAK;EACLC,IAAI;EACJC,cAAc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e,CAAC,CAAC;EACrB,CAAC,EACD,CAACA,eAAe,CACpB,CAAC;EAED,oBACIvB,KAAA,CAAAmC,aAAA,CAAC5B,gBAAgB;IACb6B,GAAG,EAAEhB,aAAc;IACnBiB,OAAO,EAAEX,qBAAsB;IAC/BY,SAAS,EAAEpB,yCAAyC,GAAGY,aAAa,GAAGS,SAAU;IACjFC,QAAQ,EAAEtB,yCAAyC,GAAG,CAAC,GAAGqB,SAAU;IACpEE,IAAI,EAAEvB,yCAAyC,GAAG,QAAQ,GAAGqB,SAAU;IACvE,0CACIlB,8BAA8B,GAAG,MAAM,GAAGkB;EAC7C,gBAEDvC,KAAA,CAAAmC,aAAA,CAAC3B,2BAA2B,qBACxBR,KAAA,CAAAmC,aAAA,CAAC7B,IAAI;IAACoC,KAAK,EAAE,CAAC,mBAAmB;EAAE,CAAE,CACZ,CAAC,eAC9B1C,KAAA,CAAAmC,aAAA,CAACzB,kBAAkB;IACfG,IAAI,EAAEA,IAAK;IACXuB,GAAG,EAAEjB,cAAe;IACpBwB,SAAS,EAAE7B,cAAe;IAC1BC,SAAS,EAAEA,SAAU;IACrB6B,kBAAkB;EAAA,GAEjB,IACe,CAAC,eACrB5C,KAAA,CAAAmC,aAAA,CAAC1B,oBAAoB,QAAEG,KAA4B,CACrC,CAAC;AAE3B,CAAC;AAEDD,UAAU,CAACkC,WAAW,GAAG,YAAY;AAErC,eAAelC,UAAU","ignoreList":[]}
@@ -1,14 +1,10 @@
1
1
  import styled from 'styled-components';
2
- import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
3
2
  export const StyledSharingBar = styled.div`
3
+ border-radius: 4px;
4
4
  cursor: pointer;
5
5
  display: flex;
6
6
  align-items: center;
7
7
  width: fit-content;
8
-
9
- &[data-should-show-keyboard-highlighting='true']:focus-visible {
10
- ${keyboardFocusHighlightingRingCss}
11
- }
12
8
  `;
13
9
  export const StyledSharingBarIconWrapper = styled.div`
14
10
  margin-right: -4px;
@@ -1 +1 @@
1
- {"version":3,"file":"SharingBar.styles.js","names":["styled","keyboardFocusHighlightingRingCss","StyledSharingBar","div","StyledSharingBarIconWrapper","StyledSharingBarText","p","theme","text"],"sources":["../../../../src/components/sharing-bar/SharingBar.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\nexport const StyledSharingBar = styled.div`\n cursor: pointer;\n display: flex;\n align-items: center;\n width: fit-content;\n\n &[data-should-show-keyboard-highlighting='true']:focus-visible {\n ${keyboardFocusHighlightingRingCss}\n }\n`;\n\nexport const StyledSharingBarIconWrapper = styled.div`\n margin-right: -4px;\n`;\n\ntype StyledSharingBarTextProps = WithTheme<unknown>;\n\nexport const StyledSharingBarText = styled.p<StyledSharingBarTextProps>`\n color: ${({ theme }: StyledSharingBarTextProps) => theme.text};\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,SAASC,gCAAgC,QAAQ,8CAA8C;AAE/F,OAAO,MAAMC,gBAAgB,GAAGF,MAAM,CAACG,GAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,UAAUF,gCAAgC;AAC1C;AACA,CAAC;AAED,OAAO,MAAMG,2BAA2B,GAAGJ,MAAM,CAACG,GAAG;AACrD;AACA,CAAC;AAID,OAAO,MAAME,oBAAoB,GAAGL,MAAM,CAACM,CAA4B;AACvE,aAAa,CAAC;EAAEC;AAAiC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACjE,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SharingBar.styles.js","names":["styled","StyledSharingBar","div","StyledSharingBarIconWrapper","StyledSharingBarText","p","theme","text"],"sources":["../../../../src/components/sharing-bar/SharingBar.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledSharingBar = styled.div`\n border-radius: 4px;\n cursor: pointer;\n display: flex;\n align-items: center;\n width: fit-content;\n`;\n\nexport const StyledSharingBarIconWrapper = styled.div`\n margin-right: -4px;\n`;\n\ntype StyledSharingBarTextProps = WithTheme<unknown>;\n\nexport const StyledSharingBarText = styled.p<StyledSharingBarTextProps>`\n color: ${({ theme }: StyledSharingBarTextProps) => theme.text};\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAGtC,OAAO,MAAMC,gBAAgB,GAAGD,MAAM,CAACE,GAAG;AAC1C;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAGH,MAAM,CAACE,GAAG;AACrD;AACA,CAAC;AAID,OAAO,MAAME,oBAAoB,GAAGJ,MAAM,CAACK,CAA4B;AACvE,aAAa,CAAC;EAAEC;AAAiC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACjE,CAAC","ignoreList":[]}
@@ -2,6 +2,7 @@ import { setRefreshScrollEnabled } from 'chayns-api';
2
2
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { useTheme } from 'styled-components';
4
4
  import { useElementSize } from '../../hooks/element';
5
+ import { useFocusRingPortal } from '../../hooks/useFocusRingPortal';
5
6
  import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
6
7
  import { calculateGradientOffset, calculatePopupPosition, fillSlider, getThumbMaxWidth } from '../../utils/slider';
7
8
  import { StyledHighlightedStep, StyledSlider, StyledSliderInput, StyledSliderThumb, StyledSliderThumbLabel } from './Slider.styles';
@@ -39,6 +40,16 @@ const Slider = ({
39
40
  const sliderWrapperSize = useElementSize(sliderWrapperRef);
40
41
  const theme = useTheme();
41
42
  const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
43
+ useFocusRingPortal(fromSliderRef, {
44
+ isEnabled: shouldShowKeyboardHighlighting && isFromThumbFocused,
45
+ overlayRef: fromSliderThumbRef,
46
+ shape: 'circle'
47
+ });
48
+ useFocusRingPortal(toSliderRef, {
49
+ isEnabled: shouldShowKeyboardHighlighting && isToThumbFocused,
50
+ overlayRef: toSliderThumbRef,
51
+ shape: 'circle'
52
+ });
42
53
  const updateFromValue = useCallback(nextValue => {
43
54
  previousFromValueRef.current = nextValue;
44
55
  setFromValue(nextValue);
@@ -320,7 +331,6 @@ const Slider = ({
320
331
  onChange: handleInputChange,
321
332
  onMouseUp: handleMouseUp,
322
333
  $background: fromInputBackground,
323
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
324
334
  onFocus: () => {
325
335
  setIsFromThumbFocused(true);
326
336
  setIsToThumbFocused(false);
@@ -331,8 +341,7 @@ const Slider = ({
331
341
  }), /*#__PURE__*/React.createElement(StyledSliderThumb, {
332
342
  ref: fromSliderThumbRef,
333
343
  $position: fromSliderThumbPosition,
334
- $isBigSlider: isBigSlider,
335
- $shouldShowFocusRing: shouldShowKeyboardHighlighting && isFromThumbFocused
344
+ $isBigSlider: isBigSlider
336
345
  }, shouldShowThumbLabel && /*#__PURE__*/React.createElement(StyledSliderThumbLabel, {
337
346
  $width: thumbWidth,
338
347
  $isBigSlider: isBigSlider,
@@ -341,8 +350,7 @@ const Slider = ({
341
350
  }, typeof thumbLabelFormatter === 'function' ? thumbLabelFormatter(fromValue) : fromValue)), interval && /*#__PURE__*/React.createElement(StyledSliderThumb, {
342
351
  ref: toSliderThumbRef,
343
352
  $position: toSliderThumbPosition,
344
- $isBigSlider: isBigSlider,
345
- $shouldShowFocusRing: shouldShowKeyboardHighlighting && isToThumbFocused
353
+ $isBigSlider: isBigSlider
346
354
  }, shouldShowThumbLabel && /*#__PURE__*/React.createElement(StyledSliderThumbLabel, {
347
355
  $width: thumbWidth,
348
356
  $isBigSlider: isBigSlider,
@@ -370,7 +378,6 @@ const Slider = ({
370
378
  onTouchEnd: handleTouchEnd,
371
379
  onChange: handleControlToSlider,
372
380
  onMouseUp: handleMouseUp,
373
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
374
381
  onFocus: () => {
375
382
  setIsToThumbFocused(true);
376
383
  setIsFromThumbFocused(false);