@chayns-components/core 5.4.13 → 5.4.14-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 +57 -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 +49 -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
@@ -1,5 +1,6 @@
1
- import styled from 'styled-components';
1
+ import styled, { css } from 'styled-components';
2
2
  import { motion } from 'motion/react';
3
+ import { keyboardFocusHighlightingRingCss } from '../../../utils/keyboardFocusHighlighting.styles';
3
4
  export const StyledHighlightSliderItem = styled.div`
4
5
  overflow: hidden;
5
6
  position: relative;
@@ -7,6 +8,14 @@ export const StyledHighlightSliderItem = styled.div`
7
8
  height: 4px;
8
9
  border-radius: 4px;
9
10
  cursor: pointer;
11
+
12
+ ${({
13
+ $shouldShowKeyboardHighlighting
14
+ }) => $shouldShowKeyboardHighlighting && css`
15
+ &:focus-visible {
16
+ ${keyboardFocusHighlightingRingCss}
17
+ }
18
+ `}
10
19
  `;
11
20
  export const StyledHighlightSliderItemProgress = styled(motion.div)`
12
21
  height: 4px;
@@ -1 +1 @@
1
- {"version":3,"file":"HighlightSliderItem.styles.js","names":["styled","motion","StyledHighlightSliderItem","div","StyledHighlightSliderItemProgress","$backgroundColor","StyledHighlightSliderItemBackground"],"sources":["../../../../../src/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { motion } from 'motion/react';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledHighlightSliderItem = styled.div`\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 4px;\n border-radius: 4px;\n cursor: pointer;\n`;\ntype StyledHighlightSliderItemProgressProps = WithTheme<{ $backgroundColor: string }>;\n\nexport const StyledHighlightSliderItemProgress = styled(\n motion.div,\n)<StyledHighlightSliderItemProgressProps>`\n height: 4px;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n background-color: ${({ $backgroundColor }: StyledHighlightSliderItemProgressProps) =>\n $backgroundColor};\n`;\n\ntype StyledHighlightSliderItemBackgroundProps = WithTheme<{ $backgroundColor: string }>;\n\nexport const StyledHighlightSliderItemBackground = styled(\n motion.div,\n)<StyledHighlightSliderItemBackgroundProps>`\n height: 4px;\n width: 100%;\n border-radius: 2px;\n background-color: ${({ $backgroundColor }: StyledHighlightSliderItemBackgroundProps) =>\n $backgroundColor};\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,MAAM,QAAQ,cAAc;AAGrC,OAAO,MAAMC,yBAAyB,GAAGF,MAAM,CAACG,GAAG;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAGD,OAAO,MAAMC,iCAAiC,GAAGJ,MAAM,CACnDC,MAAM,CAACE,GACX,CAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEE;AAAyD,CAAC,KAC7EA,gBAAgB;AACxB,CAAC;AAID,OAAO,MAAMC,mCAAmC,GAAGN,MAAM,CACrDC,MAAM,CAACE,GACX,CAA2C;AAC3C;AACA;AACA;AACA,wBAAwB,CAAC;EAAEE;AAA2D,CAAC,KAC/EA,gBAAgB;AACxB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"HighlightSliderItem.styles.js","names":["styled","css","motion","keyboardFocusHighlightingRingCss","StyledHighlightSliderItem","div","$shouldShowKeyboardHighlighting","StyledHighlightSliderItemProgress","$backgroundColor","StyledHighlightSliderItemBackground"],"sources":["../../../../../src/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { motion } from 'motion/react';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingRingCss } from '../../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledHighlightSliderItemProps = {\n $shouldShowKeyboardHighlighting?: boolean;\n};\n\nexport const StyledHighlightSliderItem = styled.div<StyledHighlightSliderItemProps>`\n overflow: hidden;\n position: relative;\n width: 100%;\n height: 4px;\n border-radius: 4px;\n cursor: pointer;\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n`;\ntype StyledHighlightSliderItemProgressProps = WithTheme<{ $backgroundColor: string }>;\n\nexport const StyledHighlightSliderItemProgress = styled(\n motion.div,\n)<StyledHighlightSliderItemProgressProps>`\n height: 4px;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 2;\n background-color: ${({ $backgroundColor }: StyledHighlightSliderItemProgressProps) =>\n $backgroundColor};\n`;\n\ntype StyledHighlightSliderItemBackgroundProps = WithTheme<{ $backgroundColor: string }>;\n\nexport const StyledHighlightSliderItemBackground = styled(\n motion.div,\n)<StyledHighlightSliderItemBackgroundProps>`\n height: 4px;\n width: 100%;\n border-radius: 2px;\n background-color: ${({ $backgroundColor }: StyledHighlightSliderItemBackgroundProps) =>\n $backgroundColor};\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,cAAc;AAErC,SAASC,gCAAgC,QAAQ,iDAAiD;AAMlG,OAAO,MAAMC,yBAAyB,GAAGJ,MAAM,CAACK,GAAmC;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAgC,CAAC,KAClCA,+BAA+B,IAC/BL,GAAG;AACX;AACA,kBAAkBE,gCAAgC;AAClD;AACA,SAAS;AACT,CAAC;AAGD,OAAO,MAAMI,iCAAiC,GAAGP,MAAM,CACnDE,MAAM,CAACG,GACX,CAAyC;AACzC;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEG;AAAyD,CAAC,KAC7EA,gBAAgB;AACxB,CAAC;AAID,OAAO,MAAMC,mCAAmC,GAAGT,MAAM,CACrDE,MAAM,CAACG,GACX,CAA2C;AAC3C;AACA;AACA;AACA,wBAAwB,CAAC;EAAEG;AAA2D,CAAC,KAC/EA,gBAAgB;AACxB,CAAC","ignoreList":[]}
@@ -1,7 +1,9 @@
1
1
  import clsx from 'clsx';
2
2
  import React from 'react';
3
3
  import { getStackSizeFactor } from '../../utils/icon';
4
- import { StyledIcon, StyledIconWrapper } from './Icon.styles';
4
+ import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
5
+ import { useColorScheme } from '../color-scheme-provider/ColorSchemeProvider';
6
+ import { StyledIcon as StyledIconElement, StyledIconWrapper } from './Icon.styles';
5
7
  import { useTheme } from 'styled-components';
6
8
  const Icon = ({
7
9
  className,
@@ -13,9 +15,14 @@ const Icon = ({
13
15
  onMouseDown,
14
16
  tabIndex,
15
17
  size = 15,
16
- shouldStopPropagation
18
+ shouldStopPropagation,
19
+ shouldEnableKeyboardHighlighting
17
20
  }) => {
18
21
  const theme = useTheme();
22
+ const colorScheme = useColorScheme();
23
+ const shouldEnableKeyboardHighlightingEffective = shouldEnableKeyboardHighlighting ?? colorScheme?.shouldEnableKeyboardHighlighting ?? false;
24
+ const isClickable = typeof onClick === 'function' && !isDisabled;
25
+ const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlightingEffective && isClickable);
19
26
  const handleClick = event => {
20
27
  if (shouldStopPropagation) {
21
28
  event.stopPropagation();
@@ -32,6 +39,15 @@ const Icon = ({
32
39
  onDoubleClick(event);
33
40
  }
34
41
  };
42
+ const handleKeyDown = event => {
43
+ if (!isClickable) {
44
+ return;
45
+ }
46
+ if (event.key === 'Enter' || event.key === ' ') {
47
+ event.preventDefault();
48
+ handleClick(event);
49
+ }
50
+ };
35
51
  let maxStackSizeFactor = 1;
36
52
  icons.forEach(icon => {
37
53
  const stackSizeFactor = getStackSizeFactor(icon);
@@ -42,14 +58,17 @@ const Icon = ({
42
58
  const shouldUseStackedIcon = icons.length > 1;
43
59
  const wrapperClasses = clsx('beta-chayns-icon', shouldUseStackedIcon ? 'fa-stack' : '', className);
44
60
  return /*#__PURE__*/React.createElement(StyledIconWrapper, {
45
- tabIndex: tabIndex,
61
+ tabIndex: shouldEnableKeyboardHighlightingEffective && isClickable ? tabIndex ?? 0 : tabIndex,
46
62
  className: wrapperClasses,
47
63
  $isDisabled: isDisabled,
48
- onClick: typeof onClick === 'function' && !isDisabled ? handleClick : undefined,
49
- $isOnClick: typeof onClick === 'function' && !isDisabled,
64
+ onClick: isClickable ? handleClick : undefined,
65
+ $isOnClick: isClickable,
50
66
  onDoubleClick: typeof onDoubleClick === 'function' && !isDisabled ? handleDoubleClick : undefined,
51
67
  onMouseDown: typeof onMouseDown === 'function' && !isDisabled ? onMouseDown : undefined,
52
- $size: size
68
+ onKeyDown: shouldEnableKeyboardHighlightingEffective ? handleKeyDown : undefined,
69
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
70
+ $size: size,
71
+ role: isClickable ? 'button' : undefined
53
72
  }, icons.map(icon => {
54
73
  const stackSizeFactor = getStackSizeFactor(icon);
55
74
  const iconStyle = `${theme?.iconStyle ?? 'fa-regular'} `;
@@ -57,7 +76,7 @@ const Icon = ({
57
76
  const iconClasses = clsx(themedIcon, {
58
77
  'fa-stack-1x': shouldUseStackedIcon && stackSizeFactor === undefined
59
78
  });
60
- return /*#__PURE__*/React.createElement(StyledIcon, {
79
+ return /*#__PURE__*/React.createElement(StyledIconElement, {
61
80
  className: iconClasses,
62
81
  $color: icon.includes('fa-inverse') ? 'white' : color,
63
82
  $fontSize: (stackSizeFactor || 1) / maxStackSizeFactor * size,
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","names":["clsx","React","getStackSizeFactor","StyledIcon","StyledIconWrapper","useTheme","Icon","className","color","icons","isDisabled","onClick","onDoubleClick","onMouseDown","tabIndex","size","shouldStopPropagation","theme","handleClick","event","stopPropagation","handleDoubleClick","maxStackSizeFactor","forEach","icon","stackSizeFactor","shouldUseStackedIcon","length","wrapperClasses","createElement","$isDisabled","undefined","$isOnClick","$size","map","iconStyle","themedIcon","replace","iconClasses","$color","includes","$fontSize","$isStacked","key","displayName"],"sources":["../../../../src/components/icon/Icon.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React, { FC, MouseEventHandler } from 'react';\nimport { getStackSizeFactor } from '../../utils/icon';\nimport { StyledIcon, StyledIconWrapper } from './Icon.styles';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport type IconProps = {\n /**\n * Additional class name for the icon wrapper element.\n * @description\n * This class name is applied to the wrapper element that contains the icon. It can be used to\n * style the icon wrapper element.\n * @example\n * <Icon className=\"my-custom-class\" icons={['fa-user']} />\n * @optional\n */\n className?: string;\n /**\n * The color of the icon.\n * @description\n * This property can be used to set the color of the icon. The color is only used for icons that\n * don't have a predefined color (e.g., 'fa-inverse' icons will always be white). If no color is\n * specified, the icon color of the theme or the text color will be used.\n * @example\n * <Icon color=\"red\" icons={['fa-user']} />\n * @optional\n */\n color?: string;\n /**\n * The icon(s) to be displayed.\n * @description\n * This property can be used to set the icon(s) to be displayed. The icon(s) must be specified as\n * an array of strings. Each string must be a valid icon name.\n * @example\n * <Icon icons={['fa-user']} />\n * <Icon icons={['fa fa-circle fa-stack-2x', 'fa fa-french-fries fa-inverse']} />\n */\n icons: string[];\n /**\n * Whether the icon should be disabled.\n * @description\n * This property can be used to disable the icon. When the icon is disabled, it will not be\n * clickable, and it will not emit any events.\n * @example\n * <Icon icons={['fa-user']} isDisabled />\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Function to be executed when the icon is clicked.\n * @description\n * This function is executed when the icon is clicked. It can be used to handle the click event.\n * @example\n * <Icon icons={['fa-user']} onClick={() => console.log('Icon clicked')} />\n * @optional\n */\n onClick?: MouseEventHandler<HTMLSpanElement>;\n /**\n * Function to be executed when the icon is double-clicked.\n * @description\n * This function is executed when the icon is double-clicked. It can be used to handle the\n * double-click event.\n * @example\n * <Icon icons={['fa-user']} onDoubleClick={() => console.log('Icon double-clicked')} />\n * @optional\n */\n onDoubleClick?: MouseEventHandler<HTMLSpanElement>;\n /**\n * Function to be executed when the icon is pressed.\n * @description\n * This function is executed when the icon is pressed. It can be used to handle the mouse down event.\n * @example\n * <Icon icons={['fa-user']} onMouseDown={() => console.log('Icon pressed')} />\n * @optional\n */\n onMouseDown?: MouseEventHandler<HTMLSpanElement>;\n /**\n * The size of the icon.\n * @description\n * This property can be used to set the size of the icon. The size must be specified as a number\n * in pixels.\n * @default 15\n * @example\n * <Icon icons={['fa-user']} size={20} />\n * @optional\n */\n size?: number;\n /**\n * Stops event propagation on click.\n * @description\n * This property can be used to prevent the icon from propagating the click event to its parent\n * elements.\n * @example\n * <Icon icons={['fa-user']} shouldStopPropagation />\n * @optional\n */\n shouldStopPropagation?: boolean;\n /**\n * Optional tab index for the icon.\n */\n tabIndex?: number;\n};\n\nconst Icon: FC<IconProps> = ({\n className,\n color,\n icons,\n isDisabled,\n onClick,\n onDoubleClick,\n onMouseDown,\n tabIndex,\n size = 15,\n shouldStopPropagation,\n}) => {\n const theme = useTheme() as Theme;\n\n const handleClick: MouseEventHandler<HTMLSpanElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n const handleDoubleClick: MouseEventHandler<HTMLSpanElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n if (typeof onDoubleClick === 'function') {\n onDoubleClick(event);\n }\n };\n\n let maxStackSizeFactor = 1;\n\n icons.forEach((icon) => {\n const stackSizeFactor = getStackSizeFactor(icon);\n\n if (stackSizeFactor && stackSizeFactor > maxStackSizeFactor) {\n maxStackSizeFactor = stackSizeFactor;\n }\n });\n\n const shouldUseStackedIcon = icons.length > 1;\n\n const wrapperClasses = clsx(\n 'beta-chayns-icon',\n shouldUseStackedIcon ? 'fa-stack' : '',\n className,\n );\n\n return (\n <StyledIconWrapper\n tabIndex={tabIndex}\n className={wrapperClasses}\n $isDisabled={isDisabled}\n onClick={typeof onClick === 'function' && !isDisabled ? handleClick : undefined}\n $isOnClick={typeof onClick === 'function' && !isDisabled}\n onDoubleClick={\n typeof onDoubleClick === 'function' && !isDisabled ? handleDoubleClick : undefined\n }\n onMouseDown={typeof onMouseDown === 'function' && !isDisabled ? onMouseDown : undefined}\n $size={size}\n >\n {icons.map((icon) => {\n const stackSizeFactor = getStackSizeFactor(icon);\n\n const iconStyle = `${(theme?.iconStyle as string) ?? 'fa-regular'} `;\n const themedIcon = icon?.replace(/^fa\\s/, iconStyle);\n\n const iconClasses = clsx(themedIcon, {\n 'fa-stack-1x': shouldUseStackedIcon && stackSizeFactor === undefined,\n });\n\n return (\n <StyledIcon\n className={iconClasses}\n $color={icon.includes('fa-inverse') ? 'white' : color}\n $fontSize={((stackSizeFactor || 1) / maxStackSizeFactor) * size}\n $isStacked={shouldUseStackedIcon}\n key={icon}\n $size={size}\n />\n );\n })}\n </StyledIconWrapper>\n );\n};\n\nIcon.displayName = 'Icon';\n\nexport default Icon;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,KAAK,MAAiC,OAAO;AACpD,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,eAAe;AAC7D,SAASC,QAAQ,QAAQ,mBAAmB;AAoG5C,MAAMC,IAAmB,GAAGA,CAAC;EACzBC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC,UAAU;EACVC,OAAO;EACPC,aAAa;EACbC,WAAW;EACXC,QAAQ;EACRC,IAAI,GAAG,EAAE;EACTC;AACJ,CAAC,KAAK;EACF,MAAMC,KAAK,GAAGZ,QAAQ,CAAC,CAAU;EAEjC,MAAMa,WAA+C,GAAIC,KAAK,IAAK;IAC/D,IAAIH,qBAAq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;IACxFE,KAAK,EAAElB;EAAK,GAEXN,KAAK,CAACyB,GAAG,CAAEV,IAAI,IAAK;IACjB,MAAMC,eAAe,GAAGvB,kBAAkB,CAACsB,IAAI,CAAC;IAEhD,MAAMW,SAAS,GAAG,GAAIlB,KAAK,EAAEkB,SAAS,IAAe,YAAY,GAAG;IACpE,MAAMC,UAAU,GAAGZ,IAAI,EAAEa,OAAO,CAAC,OAAO,EAAEF,SAAS,CAAC;IAEpD,MAAMG,WAAW,GAAGtC,IAAI,CAACoC,UAAU,EAAE;MACjC,aAAa,EAAEV,oBAAoB,IAAID,eAAe,KAAKM;IAC/D,CAAC,CAAC;IAEF,oBACI9B,KAAA,CAAA4B,aAAA,CAAC1B,UAAU;MACPI,SAAS,EAAE+B,WAAY;MACvBC,MAAM,EAAEf,IAAI,CAACgB,QAAQ,CAAC,YAAY,CAAC,GAAG,OAAO,GAAGhC,KAAM;MACtDiC,SAAS,EAAG,CAAChB,eAAe,IAAI,CAAC,IAAIH,kBAAkB,GAAIP,IAAK;MAChE2B,UAAU,EAAEhB,oBAAqB;MACjCiB,GAAG,EAAEnB,IAAK;MACVS,KAAK,EAAElB;IAAK,CACf,CAAC;EAEV,CAAC,CACc,CAAC;AAE5B,CAAC;AAEDT,IAAI,CAACsC,WAAW,GAAG,MAAM;AAEzB,eAAetC,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Icon.js","names":["clsx","React","getStackSizeFactor","useKeyboardFocusHighlighting","useColorScheme","StyledIcon","StyledIconElement","StyledIconWrapper","useTheme","Icon","className","color","icons","isDisabled","onClick","onDoubleClick","onMouseDown","tabIndex","size","shouldStopPropagation","shouldEnableKeyboardHighlighting","theme","colorScheme","shouldEnableKeyboardHighlightingEffective","isClickable","shouldShowKeyboardHighlighting","handleClick","event","stopPropagation","handleDoubleClick","handleKeyDown","key","preventDefault","maxStackSizeFactor","forEach","icon","stackSizeFactor","shouldUseStackedIcon","length","wrapperClasses","createElement","$isDisabled","undefined","$isOnClick","onKeyDown","$shouldShowKeyboardHighlighting","$size","role","map","iconStyle","themedIcon","replace","iconClasses","$color","includes","$fontSize","$isStacked","displayName"],"sources":["../../../../src/components/icon/Icon.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React, { FC, KeyboardEventHandler, MouseEventHandler } from 'react';\nimport { getStackSizeFactor } from '../../utils/icon';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport { useColorScheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { StyledIcon as StyledIconElement, StyledIconWrapper } from './Icon.styles';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport type IconProps = {\n /**\n * Additional class name for the icon wrapper element.\n * @description\n * This class name is applied to the wrapper element that contains the icon. It can be used to\n * style the icon wrapper element.\n * @example\n * <Icon className=\"my-custom-class\" icons={['fa-user']} />\n * @optional\n */\n className?: string;\n /**\n * The color of the icon.\n * @description\n * This property can be used to set the color of the icon. The color is only used for icons that\n * don't have a predefined color (e.g., 'fa-inverse' icons will always be white). If no color is\n * specified, the icon color of the theme or the text color will be used.\n * @example\n * <Icon color=\"red\" icons={['fa-user']} />\n * @optional\n */\n color?: string;\n /**\n * The icon(s) to be displayed.\n * @description\n * This property can be used to set the icon(s) to be displayed. The icon(s) must be specified as\n * an array of strings. Each string must be a valid icon name.\n * @example\n * <Icon icons={['fa-user']} />\n * <Icon icons={['fa fa-circle fa-stack-2x', 'fa fa-french-fries fa-inverse']} />\n */\n icons: string[];\n /**\n * Whether the icon should be disabled.\n * @description\n * This property can be used to disable the icon. When the icon is disabled, it will not be\n * clickable, and it will not emit any events.\n * @example\n * <Icon icons={['fa-user']} isDisabled />\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Function to be executed when the icon is clicked.\n * @description\n * This function is executed when the icon is clicked. It can be used to handle the click event.\n * @example\n * <Icon icons={['fa-user']} onClick={() => console.log('Icon clicked')} />\n * @optional\n */\n onClick?: MouseEventHandler<HTMLSpanElement>;\n /**\n * Function to be executed when the icon is double-clicked.\n * @description\n * This function is executed when the icon is double-clicked. It can be used to handle the\n * double-click event.\n * @example\n * <Icon icons={['fa-user']} onDoubleClick={() => console.log('Icon double-clicked')} />\n * @optional\n */\n onDoubleClick?: MouseEventHandler<HTMLSpanElement>;\n /**\n * Function to be executed when the icon is pressed.\n * @description\n * This function is executed when the icon is pressed. It can be used to handle the mouse down event.\n * @example\n * <Icon icons={['fa-user']} onMouseDown={() => console.log('Icon pressed')} />\n * @optional\n */\n onMouseDown?: MouseEventHandler<HTMLSpanElement>;\n /**\n * The size of the icon.\n * @description\n * This property can be used to set the size of the icon. The size must be specified as a number\n * in pixels.\n * @default 15\n * @example\n * <Icon icons={['fa-user']} size={20} />\n * @optional\n */\n size?: number;\n /**\n * Stops event propagation on click.\n * @description\n * This property can be used to prevent the icon from propagating the click event to its parent\n * elements.\n * @example\n * <Icon icons={['fa-user']} shouldStopPropagation />\n * @optional\n */\n shouldStopPropagation?: boolean;\n /**\n * Optional tab index for the icon.\n */\n tabIndex?: number;\n /**\n * Enables keyboard-only focus highlighting for clickable icons.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nconst Icon: FC<IconProps> = ({\n className,\n color,\n icons,\n isDisabled,\n onClick,\n onDoubleClick,\n onMouseDown,\n tabIndex,\n size = 15,\n shouldStopPropagation,\n shouldEnableKeyboardHighlighting,\n}) => {\n const theme = useTheme() as Theme;\n const colorScheme = useColorScheme();\n const shouldEnableKeyboardHighlightingEffective =\n shouldEnableKeyboardHighlighting ?? colorScheme?.shouldEnableKeyboardHighlighting ?? false;\n\n const isClickable = typeof onClick === 'function' && !isDisabled;\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlightingEffective && isClickable,\n );\n\n const handleClick: MouseEventHandler<HTMLSpanElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n };\n\n const handleDoubleClick: MouseEventHandler<HTMLSpanElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n if (typeof onDoubleClick === 'function') {\n onDoubleClick(event);\n }\n };\n\n const handleKeyDown: KeyboardEventHandler<HTMLSpanElement> = (event) => {\n if (!isClickable) {\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClick(event as unknown as React.MouseEvent<HTMLSpanElement>);\n }\n };\n\n let maxStackSizeFactor = 1;\n\n icons.forEach((icon) => {\n const stackSizeFactor = getStackSizeFactor(icon);\n\n if (stackSizeFactor && stackSizeFactor > maxStackSizeFactor) {\n maxStackSizeFactor = stackSizeFactor;\n }\n });\n\n const shouldUseStackedIcon = icons.length > 1;\n\n const wrapperClasses = clsx(\n 'beta-chayns-icon',\n shouldUseStackedIcon ? 'fa-stack' : '',\n className,\n );\n\n return (\n <StyledIconWrapper\n tabIndex={\n shouldEnableKeyboardHighlightingEffective && isClickable\n ? (tabIndex ?? 0)\n : tabIndex\n }\n className={wrapperClasses}\n $isDisabled={isDisabled}\n onClick={isClickable ? handleClick : undefined}\n $isOnClick={isClickable}\n onDoubleClick={\n typeof onDoubleClick === 'function' && !isDisabled ? handleDoubleClick : undefined\n }\n onMouseDown={typeof onMouseDown === 'function' && !isDisabled ? onMouseDown : undefined}\n onKeyDown={shouldEnableKeyboardHighlightingEffective ? handleKeyDown : undefined}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n $size={size}\n role={isClickable ? 'button' : undefined}\n >\n {icons.map((icon) => {\n const stackSizeFactor = getStackSizeFactor(icon);\n\n const iconStyle = `${(theme?.iconStyle as string) ?? 'fa-regular'} `;\n const themedIcon = icon?.replace(/^fa\\s/, iconStyle);\n\n const iconClasses = clsx(themedIcon, {\n 'fa-stack-1x': shouldUseStackedIcon && stackSizeFactor === undefined,\n });\n\n return (\n <StyledIconElement\n className={iconClasses}\n $color={icon.includes('fa-inverse') ? 'white' : color}\n $fontSize={((stackSizeFactor || 1) / maxStackSizeFactor) * size}\n $isStacked={shouldUseStackedIcon}\n key={icon}\n $size={size}\n />\n );\n })}\n </StyledIconWrapper>\n );\n};\n\nIcon.displayName = 'Icon';\n\nexport default Icon;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,KAAK,MAAuD,OAAO;AAC1E,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SAASC,4BAA4B,QAAQ,0CAA0C;AACvF,SAASC,cAAc,QAAQ,8CAA8C;AAC7E,SAASC,UAAU,IAAIC,iBAAiB,EAAEC,iBAAiB,QAAQ,eAAe;AAClF,SAASC,QAAQ,QAAQ,mBAAmB;AAwG5C,MAAMC,IAAmB,GAAGA,CAAC;EACzBC,SAAS;EACTC,KAAK;EACLC,KAAK;EACLC,UAAU;EACVC,OAAO;EACPC,aAAa;EACbC,WAAW;EACXC,QAAQ;EACRC,IAAI,GAAG,EAAE;EACTC,qBAAqB;EACrBC;AACJ,CAAC,KAAK;EACF,MAAMC,KAAK,GAAGb,QAAQ,CAAC,CAAU;EACjC,MAAMc,WAAW,GAAGlB,cAAc,CAAC,CAAC;EACpC,MAAMmB,yCAAyC,GAC3CH,gCAAgC,IAAIE,WAAW,EAAEF,gCAAgC,IAAI,KAAK;EAE9F,MAAMI,WAAW,GAAG,OAAOV,OAAO,KAAK,UAAU,IAAI,CAACD,UAAU;EAChE,MAAMY,8BAA8B,GAAGtB,4BAA4B,CAC/DoB,yCAAyC,IAAIC,WACjD,CAAC;EAED,MAAME,WAA+C,GAAIC,KAAK,IAAK;IAC/D,IAAIR,qBAAqB,EAAE;MACvBQ,KAAK,CAACC,eAAe,CAAC,CAAC;IAC3B;IAEA,IAAI,OAAOd,OAAO,KAAK,UAAU,EAAE;MAC/BA,OAAO,CAACa,KAAK,CAAC;IAClB;EACJ,CAAC;EAED,MAAME,iBAAqD,GAAIF,KAAK,IAAK;IACrE,IAAIR,qBAAqB,EAAE;MACvBQ,KAAK,CAACC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0B,SAAU;IACxFE,SAAS,EAAErB,yCAAyC,GAAGO,aAAa,GAAGY,SAAU;IACjFG,+BAA+B,EAAEpB,8BAA+B;IAChEqB,KAAK,EAAE5B,IAAK;IACZ6B,IAAI,EAAEvB,WAAW,GAAG,QAAQ,GAAGkB;EAAU,GAExC9B,KAAK,CAACoC,GAAG,CAAEb,IAAI,IAAK;IACjB,MAAMC,eAAe,GAAGlC,kBAAkB,CAACiC,IAAI,CAAC;IAEhD,MAAMc,SAAS,GAAG,GAAI5B,KAAK,EAAE4B,SAAS,IAAe,YAAY,GAAG;IACpE,MAAMC,UAAU,GAAGf,IAAI,EAAEgB,OAAO,CAAC,OAAO,EAAEF,SAAS,CAAC;IAEpD,MAAMG,WAAW,GAAGpD,IAAI,CAACkD,UAAU,EAAE;MACjC,aAAa,EAAEb,oBAAoB,IAAID,eAAe,KAAKM;IAC/D,CAAC,CAAC;IAEF,oBACIzC,KAAA,CAAAuC,aAAA,CAAClC,iBAAiB;MACdI,SAAS,EAAE0C,WAAY;MACvBC,MAAM,EAAElB,IAAI,CAACmB,QAAQ,CAAC,YAAY,CAAC,GAAG,OAAO,GAAG3C,KAAM;MACtD4C,SAAS,EAAG,CAACnB,eAAe,IAAI,CAAC,IAAIH,kBAAkB,GAAIf,IAAK;MAChEsC,UAAU,EAAEnB,oBAAqB;MACjCN,GAAG,EAAEI,IAAK;MACVW,KAAK,EAAE5B;IAAK,CACf,CAAC;EAEV,CAAC,CACc,CAAC;AAE5B,CAAC;AAEDT,IAAI,CAACgD,WAAW,GAAG,MAAM;AAEzB,eAAehD,IAAI","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
+ import { keyboardFocusHighlightingCircleRingCss } from '../../utils/keyboardFocusHighlighting.styles';
2
3
  export const StyledIconWrapper = styled.span`
3
4
  align-items: center;
4
5
  cursor: ${({
@@ -19,6 +20,28 @@ export const StyledIconWrapper = styled.span`
19
20
  $size
20
21
  }) => `${$size}px`};
21
22
 
23
+ ${({
24
+ $shouldShowKeyboardHighlighting,
25
+ $size
26
+ }) => $shouldShowKeyboardHighlighting && css`
27
+ &:focus-visible {
28
+ outline: none;
29
+ color: inherit;
30
+ }
31
+
32
+ &:focus-visible::after {
33
+ ${keyboardFocusHighlightingCircleRingCss};
34
+ content: '';
35
+ position: absolute;
36
+ top: 50%;
37
+ left: 50%;
38
+ width: ${$size + 14}px;
39
+ height: ${$size + 14}px;
40
+ transform: translate(-50%, -50%);
41
+ pointer-events: none;
42
+ }
43
+ `}
44
+
22
45
  // To insure that stacked icons have the same size as normal icons.
23
46
  &&.fa-stack {
24
47
  height: fit-content;
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.styles.js","names":["styled","css","StyledIconWrapper","span","$isDisabled","$isOnClick","$size","StyledIcon","i","$color","theme","iconColor","text","$isStacked","undefined","$fontSize","StyledUnicodeIcon","headline","$icon","iconStyle"],"sources":["../../../../src/components/icon/Icon.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledIconWrapperProps = {\n $isDisabled?: boolean;\n $isOnClick: boolean;\n $size: number;\n};\n\nexport const StyledIconWrapper = styled.span<StyledIconWrapperProps>`\n align-items: center;\n cursor: ${({ $isDisabled, $isOnClick }) =>\n $isOnClick && !$isDisabled ? 'pointer' : 'inherit'};\n display: inline-flex;\n min-height: ${({ $size }) => `${$size}px`};\n justify-content: center;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n position: relative;\n transition: opacity 0.3s ease;\n min-width: ${({ $size }) => `${$size}px`};\n\n // To insure that stacked icons have the same size as normal icons.\n &&.fa-stack {\n height: fit-content;\n width: fit-content;\n line-height: ${({ $size }) => $size}px;\n }\n`;\n\ntype StyledIconProps = WithTheme<{\n $fontSize: number;\n $isStacked?: boolean;\n $color?: string;\n $size: number;\n}>;\n\nexport const StyledIcon = styled.i<StyledIconProps>`\n color: ${({ $color, theme }: StyledIconProps) => $color || theme.iconColor || theme.text};\n display: ${({ $isStacked }) => ($isStacked ? undefined : 'inline-flex')};\n font-size: ${({ $fontSize }) => `${$fontSize}px`};\n\n ${({ $fontSize, $size }) =>\n $fontSize !== $size &&\n css`\n top: 50%;\n transform: translateY(-50%);\n `}\n`;\n\ntype StyledUnicodeIconProps = WithTheme<{ $icon: string }>;\n\nexport const StyledUnicodeIcon = styled.i<StyledUnicodeIconProps>`\n align-items: center;\n justify-content: center;\n display: flex;\n color: ${({ theme }: StyledUnicodeIconProps) => theme.iconColor || theme.headline};\n\n &:before {\n content: ${({ $icon }) => `\"\\\\${$icon}\" !important`};\n }\n &:after {\n content: ${({ theme, $icon }) => {\n if (theme.iconStyle === 'fa-duotone') {\n return `\"\\\\${$icon}\" !important`;\n }\n return '';\n }};\n }\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAS/C,OAAO,MAAMC,iBAAiB,GAAGF,MAAM,CAACG,IAA4B;AACpE;AACA,cAAc,CAAC;EAAEC,WAAW;EAAEC;AAAW,CAAC,KAClCA,UAAU,IAAI,CAACD,WAAW,GAAG,SAAS,GAAG,SAAS;AAC1D;AACA,kBAAkB,CAAC;EAAEE;AAAM,CAAC,KAAK,GAAGA,KAAK,IAAI;AAC7C;AACA,eAAe,CAAC;EAAEF;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA,iBAAiB,CAAC;EAAEE;AAAM,CAAC,KAAK,GAAGA,KAAK,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA,uBAAuB,CAAC;EAAEA;AAAM,CAAC,KAAKA,KAAK;AAC3C;AACA,CAAC;AASD,OAAO,MAAMC,UAAU,GAAGP,MAAM,CAACQ,CAAkB;AACnD,aAAa,CAAC;EAAEC,MAAM;EAAEC;AAAuB,CAAC,KAAKD,MAAM,IAAIC,KAAK,CAACC,SAAS,IAAID,KAAK,CAACE,IAAI;AAC5F,eAAe,CAAC;EAAEC;AAAW,CAAC,KAAMA,UAAU,GAAGC,SAAS,GAAG,aAAc;AAC3E,iBAAiB,CAAC;EAAEC;AAAU,CAAC,KAAK,GAAGA,SAAS,IAAI;AACpD;AACA,MAAM,CAAC;EAAEA,SAAS;EAAET;AAAM,CAAC,KACnBS,SAAS,KAAKT,KAAK,IACnBL,GAAG;AACX;AACA;AACA,SAAS;AACT,CAAC;AAID,OAAO,MAAMe,iBAAiB,GAAGhB,MAAM,CAACQ,CAAyB;AACjE;AACA;AACA;AACA,aAAa,CAAC;EAAEE;AAA8B,CAAC,KAAKA,KAAK,CAACC,SAAS,IAAID,KAAK,CAACO,QAAQ;AACrF;AACA;AACA,mBAAmB,CAAC;EAAEC;AAAM,CAAC,KAAK,MAAMA,KAAK,cAAc;AAC3D;AACA;AACA,mBAAmB,CAAC;EAAER,KAAK;EAAEQ;AAAM,CAAC,KAAK;EAC7B,IAAIR,KAAK,CAACS,SAAS,KAAK,YAAY,EAAE;IAClC,OAAO,MAAMD,KAAK,cAAc;EACpC;EACA,OAAO,EAAE;AACb,CAAC;AACT;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Icon.styles.js","names":["styled","css","keyboardFocusHighlightingCircleRingCss","StyledIconWrapper","span","$isDisabled","$isOnClick","$size","$shouldShowKeyboardHighlighting","StyledIcon","i","$color","theme","iconColor","text","$isStacked","undefined","$fontSize","StyledUnicodeIcon","headline","$icon","iconStyle"],"sources":["../../../../src/components/icon/Icon.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingCircleRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledIconWrapperProps = {\n $isDisabled?: boolean;\n $isOnClick: boolean;\n $size: number;\n $shouldShowKeyboardHighlighting?: boolean;\n};\n\nexport const StyledIconWrapper = styled.span<StyledIconWrapperProps>`\n align-items: center;\n cursor: ${({ $isDisabled, $isOnClick }) =>\n $isOnClick && !$isDisabled ? 'pointer' : 'inherit'};\n display: inline-flex;\n min-height: ${({ $size }) => `${$size}px`};\n justify-content: center;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n position: relative;\n transition: opacity 0.3s ease;\n min-width: ${({ $size }) => `${$size}px`};\n\n ${({ $shouldShowKeyboardHighlighting, $size }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n outline: none;\n color: inherit;\n }\n\n &:focus-visible::after {\n ${keyboardFocusHighlightingCircleRingCss};\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: ${$size + 14}px;\n height: ${$size + 14}px;\n transform: translate(-50%, -50%);\n pointer-events: none;\n }\n `}\n\n // To insure that stacked icons have the same size as normal icons.\n &&.fa-stack {\n height: fit-content;\n width: fit-content;\n line-height: ${({ $size }) => $size}px;\n }\n`;\n\ntype StyledIconProps = WithTheme<{\n $fontSize: number;\n $isStacked?: boolean;\n $color?: string;\n $size: number;\n}>;\n\nexport const StyledIcon = styled.i<StyledIconProps>`\n color: ${({ $color, theme }: StyledIconProps) => $color || theme.iconColor || theme.text};\n display: ${({ $isStacked }) => ($isStacked ? undefined : 'inline-flex')};\n font-size: ${({ $fontSize }) => `${$fontSize}px`};\n\n ${({ $fontSize, $size }) =>\n $fontSize !== $size &&\n css`\n top: 50%;\n transform: translateY(-50%);\n `}\n`;\n\ntype StyledUnicodeIconProps = WithTheme<{ $icon: string }>;\n\nexport const StyledUnicodeIcon = styled.i<StyledUnicodeIconProps>`\n align-items: center;\n justify-content: center;\n display: flex;\n color: ${({ theme }: StyledUnicodeIconProps) => theme.iconColor || theme.headline};\n\n &:before {\n content: ${({ $icon }) => `\"\\\\${$icon}\" !important`};\n }\n &:after {\n content: ${({ theme, $icon }) => {\n if (theme.iconStyle === 'fa-duotone') {\n return `\"\\\\${$icon}\" !important`;\n }\n return '';\n }};\n }\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,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AID,OAAO,MAAMiB,iBAAiB,GAAGlB,MAAM,CAACU,CAAyB;AACjE;AACA;AACA;AACA,aAAa,CAAC;EAAEE;AAA8B,CAAC,KAAKA,KAAK,CAACC,SAAS,IAAID,KAAK,CAACO,QAAQ;AACrF;AACA;AACA,mBAAmB,CAAC;EAAEC;AAAM,CAAC,KAAK,MAAMA,KAAK,cAAc;AAC3D;AACA;AACA,mBAAmB,CAAC;EAAER,KAAK;EAAEQ;AAAM,CAAC,KAAK;EAC7B,IAAIR,KAAK,CAACS,SAAS,KAAK,YAAY,EAAE;IAClC,OAAO,MAAMD,KAAK,cAAc;EACpC;EACA,OAAO,EAAE;AACb,CAAC;AACT;AACA,CAAC","ignoreList":[]}
@@ -7,6 +7,7 @@ import { StyledInput, StyledInputContent, StyledInputContentWrapper, StyledInput
7
7
  import { ContentCardType } from '../../types/contentCard';
8
8
  import { useCursorRepaint } from '../../hooks/resize';
9
9
  import Tooltip from '../tooltip/Tooltip';
10
+ import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
10
11
  export let InputSize = /*#__PURE__*/function (InputSize) {
11
12
  InputSize["Small"] = "small";
12
13
  InputSize["Medium"] = "medium";
@@ -37,7 +38,8 @@ const Input = /*#__PURE__*/forwardRef(({
37
38
  shouldPreventPlaceholderAnimation = false,
38
39
  id,
39
40
  shouldShowTransparentBackground = false,
40
- autoComplete
41
+ autoComplete,
42
+ shouldEnableKeyboardHighlighting
41
43
  }, ref) => {
42
44
  const [hasValue, setHasValue] = useState(typeof value === 'string' && value !== '');
43
45
  const [placeholderWidth, setPlaceholderWidth] = useState(0);
@@ -63,6 +65,13 @@ const Input = /*#__PURE__*/forwardRef(({
63
65
  }
64
66
  }
65
67
  }, [onChange]);
68
+ const handleClearIconKeyDown = useCallback(event => {
69
+ if (event.key === 'Enter' || event.key === ' ') {
70
+ event.preventDefault();
71
+ handleClearIconClick();
72
+ inputRef.current?.focus();
73
+ }
74
+ }, [handleClearIconClick]);
66
75
 
67
76
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
68
77
  const shouldShowBorder = rightElement?.props?.style?.backgroundColor === undefined;
@@ -91,6 +100,9 @@ const Input = /*#__PURE__*/forwardRef(({
91
100
  } else if (areaProvider.shouldChangeColor) {
92
101
  backgroundColor = theme['000'];
93
102
  }
103
+ const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
104
+ const borderColor = color?.border;
105
+ const placeholderColor = color?.placeholder;
94
106
  const labelPosition = useMemo(() => {
95
107
  if (hasValue && !shouldRemainPlaceholder && !shouldPreventPlaceholderAnimation) {
96
108
  return shouldShowOnlyBottomBorder ? {
@@ -116,7 +128,8 @@ const Input = /*#__PURE__*/forwardRef(({
116
128
  $shouldRoundRightCorners: shouldShowBorder,
117
129
  $shouldShowOnlyBottomBorder: shouldShowOnlyBottomBorder,
118
130
  $size: size,
119
- $borderColor: color?.border
131
+ $borderColor: borderColor,
132
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
120
133
  }, leftElement && /*#__PURE__*/React.createElement(StyledInputIconWrapper, null, leftElement), /*#__PURE__*/React.createElement(StyledInputContent, {
121
134
  $shouldShowOnlyBottomBorder: shouldShowOnlyBottomBorder
122
135
  }, /*#__PURE__*/React.createElement(StyledInputField, {
@@ -158,23 +171,30 @@ const Input = /*#__PURE__*/forwardRef(({
158
171
  duration: shouldPreventPlaceholderAnimation ? 0 : 0.1
159
172
  }
160
173
  }, /*#__PURE__*/React.createElement(StyledInputLabel, {
161
- $color: color?.placeholder,
174
+ $color: placeholderColor,
162
175
  $isInvalid: isInvalid
163
176
  }, placeholder))), shouldShowClearIcon && /*#__PURE__*/React.createElement(StyledMotionInputClearIcon, {
164
177
  $shouldShowOnlyBottomBorder: shouldShowOnlyBottomBorder,
165
178
  $size: size,
179
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
166
180
  animate: {
167
181
  opacity: hasValue ? 1 : 0
168
182
  },
169
183
  initial: false,
170
184
  onClick: handleClearIconClick,
185
+ onKeyDown: handleClearIconKeyDown,
186
+ tabIndex: shouldShowKeyboardHighlighting && hasValue && !isDisabled ? 0 : -1,
187
+ role: shouldShowKeyboardHighlighting ? 'button' : undefined,
188
+ "aria-hidden": !hasValue,
171
189
  transition: {
172
190
  type: 'tween'
173
191
  }
174
192
  }, /*#__PURE__*/React.createElement(Icon, {
175
193
  icons: ['fa fa-times'],
176
194
  color: isInvalid ? theme.wrong : undefined
177
- })), rightElement && shouldShowBorder && rightElement), rightElement && !shouldShowBorder && /*#__PURE__*/React.createElement(StyledInputRightElement, null, rightElement)), [isDisabled, shouldShowTransparentBackground, backgroundColor, isInvalid, shouldShowBorder, shouldShowOnlyBottomBorder, size, leftElement, internalColor, placeholderWidth, id, onBlur, handleInputFieldChange, onFocus, onKeyDown, onPaste, type, value, shouldUseAutoFocus, inputMode, autoComplete, shouldShowCenteredContent, shouldPreventPlaceholderAnimation, hasValue, shouldRemainPlaceholder, theme.fontSize, theme.wrong, labelPosition, color?.placeholder, placeholder, shouldShowClearIcon, handleClearIconClick, rightElement]);
195
+ })), rightElement && shouldShowBorder && /*#__PURE__*/React.createElement(StyledInputRightElement, {
196
+ $isInline: true
197
+ }, rightElement)), rightElement && !shouldShowBorder && /*#__PURE__*/React.createElement(StyledInputRightElement, null, rightElement)), [isDisabled, shouldShowTransparentBackground, backgroundColor, isInvalid, shouldShowBorder, shouldShowOnlyBottomBorder, size, leftElement, internalColor, placeholderWidth, id, onBlur, handleInputFieldChange, onFocus, onKeyDown, onPaste, type, value, shouldUseAutoFocus, inputMode, autoComplete, shouldShowCenteredContent, shouldPreventPlaceholderAnimation, hasValue, shouldRemainPlaceholder, theme.fontSize, theme.wrong, labelPosition, borderColor, placeholderColor, placeholder, shouldShowClearIcon, handleClearIconClick, handleClearIconKeyDown, rightElement, shouldEnableKeyboardHighlighting, shouldShowKeyboardHighlighting]);
178
198
  if (isDisabled && typeof disabledHint === 'string') {
179
199
  return /*#__PURE__*/React.createElement(Tooltip, {
180
200
  item: {
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","names":["React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","useTheme","useElementSize","AreaContext","Icon","StyledInput","StyledInputContent","StyledInputContentWrapper","StyledInputField","StyledInputIconWrapper","StyledInputLabel","StyledInputRightElement","StyledMotionInputClearIcon","StyledMotionInputLabelWrapper","ContentCardType","useCursorRepaint","Tooltip","InputSize","Input","leftElement","inputMode","isDisabled","onBlur","onChange","onFocus","onKeyDown","onPaste","placeholder","color","rightElement","shouldShowOnlyBottomBorder","shouldRemainPlaceholder","shouldShowClearIcon","shouldShowCenteredContent","size","Medium","type","value","disabledHint","shouldUseAutoFocus","isInvalid","shouldPreventPlaceholderAnimation","id","shouldShowTransparentBackground","autoComplete","ref","hasValue","setHasValue","placeholderWidth","setPlaceholderWidth","areaProvider","theme","inputRef","placeholderRef","placeholderSize","width","handleClearIconClick","current","target","shouldShowBorder","props","style","backgroundColor","undefined","handleInputFieldChange","event","focus","blur","internalColor","contentCardType","Error","Success","Warning","includes","shouldChangeColor","labelPosition","right","top","bottom","Small","left","inputElement","createElement","className","$isDisabled","$shouldShowTransparentBackground","$backgroundColor","$isInvalid","$shouldRoundRightCorners","$shouldShowOnlyBottomBorder","$size","$borderColor","border","$color","$placeholderWidth","disabled","onClick","preventDefault","stopPropagation","autoFocus","$shouldShowCenteredContent","animate","opacity","fontSize","Number","initial","layout","transition","duration","icons","wrong","item","text","shouldUseFullWidth","displayName"],"sources":["../../../../src/components/input/Input.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n CSSProperties,\n FocusEventHandler,\n forwardRef,\n HTMLInputTypeAttribute,\n KeyboardEventHandler,\n type ReactElement,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../hooks/element';\nimport { AreaContext } from '../area-provider/AreaContextProvider';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledInput,\n StyledInputContent,\n StyledInputContentWrapper,\n StyledInputField,\n StyledInputIconWrapper,\n StyledInputLabel,\n StyledInputRightElement,\n StyledMotionInputClearIcon,\n StyledMotionInputLabelWrapper,\n} from './Input.styles';\nimport { ContentCardType } from '../../types/contentCard';\nimport { useCursorRepaint } from '../../hooks/resize';\nimport Tooltip from '../tooltip/Tooltip';\n\nexport interface InputRef {\n focus: VoidFunction;\n blur: VoidFunction;\n}\n\ntype InputMode =\n | 'email'\n | 'search'\n | 'tel'\n | 'text'\n | 'url'\n | 'none'\n | 'numeric'\n | 'decimal'\n | undefined;\n\ntype AutoComplete =\n | 'on'\n | 'off'\n | 'name'\n | 'username'\n | 'email'\n | 'new-password'\n | 'current-password'\n | 'tel'\n | 'url'\n | 'street-address'\n | 'postal-code'\n | 'country'\n | undefined;\n\nexport enum InputSize {\n Small = 'small',\n Medium = 'medium',\n}\n\ninterface Color {\n placeholder?: CSSProperties['color'];\n border?: CSSProperties['borderColor'];\n}\n\nexport type InputProps = {\n /**\n * If set and the input is disabled, the input will display a tooltip with this message.\n */\n disabledHint?: string;\n /**\n * An element to be displayed on the left side of the input field\n */\n leftElement?: ReactNode;\n /**\n * The id of the input\n */\n id?: string;\n /**\n * Defines the input mode of the input\n */\n inputMode?: InputMode;\n /**\n * Defines the auto Complete of the input\n */\n autoComplete?: AutoComplete;\n /**\n * Disables the input so that it cannot be changed anymore\n */\n isDisabled?: boolean;\n /**\n * If true, the input field is marked as invalid\n */\n isInvalid?: boolean;\n /**\n * Function that is executed when the input field loses focus\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\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 the input field is focused\n */\n onFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when content is pasted into the input field\n */\n onPaste?: (event: React.ClipboardEvent<HTMLInputElement>) => void;\n /**\n * Function that is executed when a letter is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n /**\n * Placeholder for the input field\n */\n placeholder?: ReactNode;\n /**\n * Colors for different parts of the input. You can set the color of the placeholder and the border color.\n */\n color?: Color;\n /**\n * An element that should be displayed on the right side of the Input.\n */\n rightElement?: ReactElement;\n /**\n * Whether the placeholder animation should be prevented.\n */\n shouldPreventPlaceholderAnimation?: boolean;\n /**\n * Whether the placeholder should remain at its position if a value is typed.\n */\n shouldRemainPlaceholder?: boolean;\n /**\n * Whether the content should be displayed centered inside the input.\n */\n shouldShowCenteredContent?: boolean;\n /**\n * If true, a clear icon is displayed at the end of the input field\n */\n shouldShowClearIcon?: boolean;\n /**\n * Whether only the bottom border should be displayed\n */\n shouldShowOnlyBottomBorder?: boolean;\n /**\n * Whether the background should be transparent.\n */\n shouldShowTransparentBackground?: boolean;\n /**\n * If true, the input field is focused when the component is mounted\n */\n shouldUseAutoFocus?: boolean;\n /**\n * The size of the input field\n */\n size?: InputSize;\n /**\n * Input type set for an input element (e.g. 'text', 'number' or 'password')\n */\n type?: HTMLInputTypeAttribute;\n /**\n * Value if the input field should be controlled\n */\n value?: string;\n};\n\nconst Input = forwardRef<InputRef, InputProps>(\n (\n {\n leftElement,\n inputMode,\n isDisabled,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onPaste,\n placeholder,\n color,\n rightElement,\n shouldShowOnlyBottomBorder,\n shouldRemainPlaceholder = false,\n shouldShowClearIcon = false,\n shouldShowCenteredContent = false,\n size = InputSize.Medium,\n type = 'text',\n value,\n disabledHint,\n shouldUseAutoFocus = false,\n isInvalid = false,\n shouldPreventPlaceholderAnimation = false,\n id,\n shouldShowTransparentBackground = false,\n autoComplete,\n },\n ref,\n ) => {\n const [hasValue, setHasValue] = useState(typeof value === 'string' && value !== '');\n const [placeholderWidth, setPlaceholderWidth] = useState(0);\n\n const areaProvider = useContext(AreaContext);\n\n const theme = useTheme() as Theme;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const placeholderRef = useRef<HTMLLabelElement>(null);\n\n useCursorRepaint(inputRef);\n\n const placeholderSize = useElementSize(placeholderRef);\n\n useEffect(() => {\n if (placeholderSize && shouldShowOnlyBottomBorder) {\n setPlaceholderWidth(placeholderSize.width + 5);\n }\n }, [placeholderSize, shouldShowOnlyBottomBorder]);\n\n const handleClearIconClick = useCallback(() => {\n if (inputRef.current) {\n inputRef.current.value = '';\n\n setHasValue(false);\n\n if (typeof onChange === 'function') {\n onChange({ target: inputRef.current } as ChangeEvent<HTMLInputElement>);\n }\n }\n }, [onChange]);\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const shouldShowBorder = rightElement?.props?.style?.backgroundColor === undefined;\n\n const handleInputFieldChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setHasValue(event.target.value !== '');\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n }),\n [],\n );\n\n useEffect(() => {\n if (typeof value === 'string') {\n setHasValue(value !== '');\n }\n }, [value]);\n\n let backgroundColor: CSSProperties['backgroundColor'] | undefined;\n let internalColor: CSSProperties['color'] | undefined;\n\n if (shouldShowTransparentBackground) {\n backgroundColor = 'transparent';\n } else if (\n areaProvider.contentCardType &&\n [ContentCardType.Error, ContentCardType.Success, ContentCardType.Warning].includes(\n areaProvider.contentCardType,\n )\n ) {\n backgroundColor = 'white';\n internalColor = '#555';\n } else if (areaProvider.shouldChangeColor) {\n backgroundColor = theme['000'];\n }\n\n const labelPosition = useMemo(() => {\n if (hasValue && !shouldRemainPlaceholder && !shouldPreventPlaceholderAnimation) {\n return shouldShowOnlyBottomBorder\n ? { right: 3, top: -1.5 }\n : { bottom: size === InputSize.Small ? -4 : -10, right: -6 };\n }\n\n return { left: -1, top: -1.5 };\n }, [\n hasValue,\n shouldPreventPlaceholderAnimation,\n shouldRemainPlaceholder,\n shouldShowOnlyBottomBorder,\n size,\n ]);\n\n const inputElement = useMemo(\n () => (\n <StyledInput className=\"beta-chayns-input\" $isDisabled={isDisabled}>\n <StyledInputContentWrapper\n $shouldShowTransparentBackground={shouldShowTransparentBackground}\n $backgroundColor={backgroundColor}\n $isInvalid={isInvalid}\n $shouldRoundRightCorners={shouldShowBorder}\n $shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n $size={size}\n $borderColor={color?.border}\n >\n {leftElement && (\n <StyledInputIconWrapper>{leftElement}</StyledInputIconWrapper>\n )}\n <StyledInputContent\n $shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n >\n <StyledInputField\n $color={internalColor}\n $placeholderWidth={placeholderWidth}\n id={id}\n disabled={isDisabled}\n onBlur={onBlur}\n onChange={handleInputFieldChange}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n }}\n onPaste={onPaste}\n ref={inputRef}\n type={type}\n value={value}\n autoFocus={shouldUseAutoFocus}\n inputMode={inputMode}\n autoComplete={autoComplete}\n $isInvalid={isInvalid}\n $shouldShowCenteredContent={shouldShowCenteredContent}\n />\n <StyledMotionInputLabelWrapper\n animate={\n shouldPreventPlaceholderAnimation\n ? {\n opacity: hasValue ? 0 : 1,\n }\n : {\n fontSize:\n hasValue &&\n !shouldShowOnlyBottomBorder &&\n !shouldRemainPlaceholder\n ? '9px'\n : `${Number(theme.fontSize)}px`,\n }\n }\n initial={false}\n layout\n ref={placeholderRef}\n style={{ ...labelPosition }}\n transition={{\n type: 'tween',\n duration: shouldPreventPlaceholderAnimation ? 0 : 0.1,\n }}\n >\n <StyledInputLabel\n $color={color?.placeholder}\n $isInvalid={isInvalid}\n >\n {placeholder}\n </StyledInputLabel>\n </StyledMotionInputLabelWrapper>\n </StyledInputContent>\n {shouldShowClearIcon && (\n <StyledMotionInputClearIcon\n $shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n $size={size}\n animate={{ opacity: hasValue ? 1 : 0 }}\n initial={false}\n onClick={handleClearIconClick}\n transition={{ type: 'tween' }}\n >\n <Icon\n icons={['fa fa-times']}\n color={isInvalid ? theme.wrong : undefined}\n />\n </StyledMotionInputClearIcon>\n )}\n {rightElement && shouldShowBorder && rightElement}\n </StyledInputContentWrapper>\n {rightElement && !shouldShowBorder && (\n <StyledInputRightElement>{rightElement}</StyledInputRightElement>\n )}\n </StyledInput>\n ),\n [\n isDisabled,\n shouldShowTransparentBackground,\n backgroundColor,\n isInvalid,\n shouldShowBorder,\n shouldShowOnlyBottomBorder,\n size,\n leftElement,\n internalColor,\n placeholderWidth,\n id,\n onBlur,\n handleInputFieldChange,\n onFocus,\n onKeyDown,\n onPaste,\n type,\n value,\n shouldUseAutoFocus,\n inputMode,\n autoComplete,\n shouldShowCenteredContent,\n shouldPreventPlaceholderAnimation,\n hasValue,\n shouldRemainPlaceholder,\n theme.fontSize,\n theme.wrong,\n labelPosition,\n color?.placeholder,\n placeholder,\n shouldShowClearIcon,\n handleClearIconClick,\n rightElement,\n ],\n );\n\n if (isDisabled && typeof disabledHint === 'string') {\n return (\n <Tooltip item={{ text: disabledHint }} shouldUseFullWidth>\n {inputElement}\n </Tooltip>\n );\n }\n\n return inputElement;\n },\n);\n\nInput.displayName = 'Input';\n\nexport default Input;\n"],"mappings":"AAAA,OAAOA,KAAK,IAKRC,UAAU,EAKVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,WAAW,QAAQ,sCAAsC;AAElE,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,WAAW,EACXC,kBAAkB,EAClBC,yBAAyB,EACzBC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ACIR,UAAU,EACVsB,+BAA+B,EAC/BmB,eAAe,EACftB,SAAS,EACTmB,gBAAgB,EAChB7B,0BAA0B,EAC1BI,IAAI,EACJf,WAAW,EACXiD,aAAa,EACbpB,gBAAgB,EAChBN,EAAE,EACFpB,MAAM,EACN0C,sBAAsB,EACtBxC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPU,IAAI,EACJC,KAAK,EACLE,kBAAkB,EAClBnB,SAAS,EACTwB,YAAY,EACZX,yBAAyB,EACzBQ,iCAAiC,EACjCK,QAAQ,EACRf,uBAAuB,EACvBoB,KAAK,CAACoD,QAAQ,EACdpD,KAAK,CAAC2D,KAAK,EACXnC,aAAa,EACb/C,KAAK,EAAED,WAAW,EAClBA,WAAW,EACXK,mBAAmB,EACnBwB,oBAAoB,EACpB3B,YAAY,CAEpB,CAAC;EAED,IAAIR,UAAU,IAAI,OAAOiB,YAAY,KAAK,QAAQ,EAAE;IAChD,oBACI9C,KAAA,CAAA0F,aAAA,CAAClE,OAAO;MAAC+F,IAAI,EAAE;QAAEC,IAAI,EAAE1E;MAAa,CAAE;MAAC2E,kBAAkB;IAAA,GACpDhC,YACI,CAAC;EAElB;EAEA,OAAOA,YAAY;AACvB,CACJ,CAAC;AAED/D,KAAK,CAACgG,WAAW,GAAG,OAAO;AAE3B,eAAehG,KAAK","ignoreList":[]}
1
+ {"version":3,"file":"Input.js","names":["React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","useTheme","useElementSize","AreaContext","Icon","StyledInput","StyledInputContent","StyledInputContentWrapper","StyledInputField","StyledInputIconWrapper","StyledInputLabel","StyledInputRightElement","StyledMotionInputClearIcon","StyledMotionInputLabelWrapper","ContentCardType","useCursorRepaint","Tooltip","useKeyboardFocusHighlighting","InputSize","Input","leftElement","inputMode","isDisabled","onBlur","onChange","onFocus","onKeyDown","onPaste","placeholder","color","rightElement","shouldShowOnlyBottomBorder","shouldRemainPlaceholder","shouldShowClearIcon","shouldShowCenteredContent","size","Medium","type","value","disabledHint","shouldUseAutoFocus","isInvalid","shouldPreventPlaceholderAnimation","id","shouldShowTransparentBackground","autoComplete","shouldEnableKeyboardHighlighting","ref","hasValue","setHasValue","placeholderWidth","setPlaceholderWidth","areaProvider","theme","inputRef","placeholderRef","placeholderSize","width","handleClearIconClick","current","target","handleClearIconKeyDown","event","key","preventDefault","focus","shouldShowBorder","props","style","backgroundColor","undefined","handleInputFieldChange","blur","internalColor","contentCardType","Error","Success","Warning","includes","shouldChangeColor","shouldShowKeyboardHighlighting","borderColor","border","placeholderColor","labelPosition","right","top","bottom","Small","left","inputElement","createElement","className","$isDisabled","$shouldShowTransparentBackground","$backgroundColor","$isInvalid","$shouldRoundRightCorners","$shouldShowOnlyBottomBorder","$size","$borderColor","$shouldShowKeyboardHighlighting","$color","$placeholderWidth","disabled","onClick","stopPropagation","autoFocus","$shouldShowCenteredContent","animate","opacity","fontSize","Number","initial","layout","transition","duration","tabIndex","role","icons","wrong","$isInline","item","text","shouldUseFullWidth","displayName"],"sources":["../../../../src/components/input/Input.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n CSSProperties,\n FocusEventHandler,\n forwardRef,\n HTMLInputTypeAttribute,\n KeyboardEventHandler,\n type ReactElement,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../hooks/element';\nimport { AreaContext } from '../area-provider/AreaContextProvider';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledInput,\n StyledInputContent,\n StyledInputContentWrapper,\n StyledInputField,\n StyledInputIconWrapper,\n StyledInputLabel,\n StyledInputRightElement,\n StyledMotionInputClearIcon,\n StyledMotionInputLabelWrapper,\n} from './Input.styles';\nimport { ContentCardType } from '../../types/contentCard';\nimport { useCursorRepaint } from '../../hooks/resize';\nimport Tooltip from '../tooltip/Tooltip';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport interface InputRef {\n focus: VoidFunction;\n blur: VoidFunction;\n}\n\ntype InputMode =\n | 'email'\n | 'search'\n | 'tel'\n | 'text'\n | 'url'\n | 'none'\n | 'numeric'\n | 'decimal'\n | undefined;\n\ntype AutoComplete =\n | 'on'\n | 'off'\n | 'name'\n | 'username'\n | 'email'\n | 'new-password'\n | 'current-password'\n | 'tel'\n | 'url'\n | 'street-address'\n | 'postal-code'\n | 'country'\n | undefined;\n\nexport enum InputSize {\n Small = 'small',\n Medium = 'medium',\n}\n\ninterface Color {\n placeholder?: CSSProperties['color'];\n border?: CSSProperties['borderColor'];\n}\n\nexport type InputProps = {\n /**\n * If set and the input is disabled, the input will display a tooltip with this message.\n */\n disabledHint?: string;\n /**\n * An element to be displayed on the left side of the input field\n */\n leftElement?: ReactNode;\n /**\n * The id of the input\n */\n id?: string;\n /**\n * Defines the input mode of the input\n */\n inputMode?: InputMode;\n /**\n * Defines the auto Complete of the input\n */\n autoComplete?: AutoComplete;\n /**\n * Disables the input so that it cannot be changed anymore\n */\n isDisabled?: boolean;\n /**\n * If true, the input field is marked as invalid\n */\n isInvalid?: boolean;\n /**\n * Function that is executed when the input field loses focus\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\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 the input field is focused\n */\n onFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when content is pasted into the input field\n */\n onPaste?: (event: React.ClipboardEvent<HTMLInputElement>) => void;\n /**\n * Function that is executed when a letter is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n /**\n * Placeholder for the input field\n */\n placeholder?: ReactNode;\n /**\n * Colors for different parts of the input. You can set the color of the placeholder and the border color.\n */\n color?: Color;\n /**\n * An element that should be displayed on the right side of the Input.\n */\n rightElement?: ReactElement;\n /**\n * Whether the placeholder animation should be prevented.\n */\n shouldPreventPlaceholderAnimation?: boolean;\n /**\n * Whether the placeholder should remain at its position if a value is typed.\n */\n shouldRemainPlaceholder?: boolean;\n /**\n * Whether the content should be displayed centered inside the input.\n */\n shouldShowCenteredContent?: boolean;\n /**\n * If true, a clear icon is displayed at the end of the input field\n */\n shouldShowClearIcon?: boolean;\n /**\n * Whether only the bottom border should be displayed\n */\n shouldShowOnlyBottomBorder?: boolean;\n /**\n * Whether the background should be transparent.\n */\n shouldShowTransparentBackground?: boolean;\n /**\n * If true, the input field is focused when the component is mounted\n */\n shouldUseAutoFocus?: boolean;\n /**\n * The size of the input field\n */\n size?: InputSize;\n /**\n * Input type set for an input element (e.g. 'text', 'number' or 'password')\n */\n type?: HTMLInputTypeAttribute;\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\nconst Input = forwardRef<InputRef, InputProps>(\n (\n {\n leftElement,\n inputMode,\n isDisabled,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onPaste,\n placeholder,\n color,\n rightElement,\n shouldShowOnlyBottomBorder,\n shouldRemainPlaceholder = false,\n shouldShowClearIcon = false,\n shouldShowCenteredContent = false,\n size = InputSize.Medium,\n type = 'text',\n value,\n disabledHint,\n shouldUseAutoFocus = false,\n isInvalid = false,\n shouldPreventPlaceholderAnimation = false,\n id,\n shouldShowTransparentBackground = false,\n autoComplete,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const [hasValue, setHasValue] = useState(typeof value === 'string' && value !== '');\n const [placeholderWidth, setPlaceholderWidth] = useState(0);\n\n const areaProvider = useContext(AreaContext);\n\n const theme = useTheme() as Theme;\n\n const inputRef = useRef<HTMLInputElement>(null);\n const placeholderRef = useRef<HTMLLabelElement>(null);\n\n useCursorRepaint(inputRef);\n\n const placeholderSize = useElementSize(placeholderRef);\n\n useEffect(() => {\n if (placeholderSize && shouldShowOnlyBottomBorder) {\n setPlaceholderWidth(placeholderSize.width + 5);\n }\n }, [placeholderSize, shouldShowOnlyBottomBorder]);\n\n const handleClearIconClick = useCallback(() => {\n if (inputRef.current) {\n inputRef.current.value = '';\n\n setHasValue(false);\n\n if (typeof onChange === 'function') {\n onChange({ target: inputRef.current } as ChangeEvent<HTMLInputElement>);\n }\n }\n }, [onChange]);\n\n const handleClearIconKeyDown = useCallback<KeyboardEventHandler<HTMLDivElement>>(\n (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClearIconClick();\n inputRef.current?.focus();\n }\n },\n [handleClearIconClick],\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const shouldShowBorder = rightElement?.props?.style?.backgroundColor === undefined;\n\n const handleInputFieldChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setHasValue(event.target.value !== '');\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n }),\n [],\n );\n\n useEffect(() => {\n if (typeof value === 'string') {\n setHasValue(value !== '');\n }\n }, [value]);\n\n let backgroundColor: CSSProperties['backgroundColor'] | undefined;\n let internalColor: CSSProperties['color'] | undefined;\n\n if (shouldShowTransparentBackground) {\n backgroundColor = 'transparent';\n } else if (\n areaProvider.contentCardType &&\n [ContentCardType.Error, ContentCardType.Success, ContentCardType.Warning].includes(\n areaProvider.contentCardType,\n )\n ) {\n backgroundColor = 'white';\n internalColor = '#555';\n } else if (areaProvider.shouldChangeColor) {\n backgroundColor = theme['000'];\n }\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n const borderColor = color?.border;\n const placeholderColor = color?.placeholder;\n\n const labelPosition = useMemo(() => {\n if (hasValue && !shouldRemainPlaceholder && !shouldPreventPlaceholderAnimation) {\n return shouldShowOnlyBottomBorder\n ? { right: 3, top: -1.5 }\n : { bottom: size === InputSize.Small ? -4 : -10, right: -6 };\n }\n\n return { left: -1, top: -1.5 };\n }, [\n hasValue,\n shouldPreventPlaceholderAnimation,\n shouldRemainPlaceholder,\n shouldShowOnlyBottomBorder,\n size,\n ]);\n\n const inputElement = useMemo(\n () => (\n <StyledInput className=\"beta-chayns-input\" $isDisabled={isDisabled}>\n <StyledInputContentWrapper\n $shouldShowTransparentBackground={shouldShowTransparentBackground}\n $backgroundColor={backgroundColor}\n $isInvalid={isInvalid}\n $shouldRoundRightCorners={shouldShowBorder}\n $shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n $size={size}\n $borderColor={borderColor}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n {leftElement && (\n <StyledInputIconWrapper>{leftElement}</StyledInputIconWrapper>\n )}\n <StyledInputContent\n $shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n >\n <StyledInputField\n $color={internalColor}\n $placeholderWidth={placeholderWidth}\n id={id}\n disabled={isDisabled}\n onBlur={onBlur}\n onChange={handleInputFieldChange}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n }}\n onPaste={onPaste}\n ref={inputRef}\n type={type}\n value={value}\n autoFocus={shouldUseAutoFocus}\n inputMode={inputMode}\n autoComplete={autoComplete}\n $isInvalid={isInvalid}\n $shouldShowCenteredContent={shouldShowCenteredContent}\n />\n <StyledMotionInputLabelWrapper\n animate={\n shouldPreventPlaceholderAnimation\n ? {\n opacity: hasValue ? 0 : 1,\n }\n : {\n fontSize:\n hasValue &&\n !shouldShowOnlyBottomBorder &&\n !shouldRemainPlaceholder\n ? '9px'\n : `${Number(theme.fontSize)}px`,\n }\n }\n initial={false}\n layout\n ref={placeholderRef}\n style={{ ...labelPosition }}\n transition={{\n type: 'tween',\n duration: shouldPreventPlaceholderAnimation ? 0 : 0.1,\n }}\n >\n <StyledInputLabel $color={placeholderColor} $isInvalid={isInvalid}>\n {placeholder}\n </StyledInputLabel>\n </StyledMotionInputLabelWrapper>\n </StyledInputContent>\n {shouldShowClearIcon && (\n <StyledMotionInputClearIcon\n $shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n $size={size}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n animate={{ opacity: hasValue ? 1 : 0 }}\n initial={false}\n onClick={handleClearIconClick}\n onKeyDown={handleClearIconKeyDown}\n tabIndex={\n shouldShowKeyboardHighlighting && hasValue && !isDisabled\n ? 0\n : -1\n }\n role={shouldShowKeyboardHighlighting ? 'button' : undefined}\n aria-hidden={!hasValue}\n transition={{ type: 'tween' }}\n >\n <Icon\n icons={['fa fa-times']}\n color={isInvalid ? theme.wrong : undefined}\n />\n </StyledMotionInputClearIcon>\n )}\n {rightElement && shouldShowBorder && (\n <StyledInputRightElement $isInline>\n {rightElement}\n </StyledInputRightElement>\n )}\n </StyledInputContentWrapper>\n {rightElement && !shouldShowBorder && (\n <StyledInputRightElement>{rightElement}</StyledInputRightElement>\n )}\n </StyledInput>\n ),\n [\n isDisabled,\n shouldShowTransparentBackground,\n backgroundColor,\n isInvalid,\n shouldShowBorder,\n shouldShowOnlyBottomBorder,\n size,\n leftElement,\n internalColor,\n placeholderWidth,\n id,\n onBlur,\n handleInputFieldChange,\n onFocus,\n onKeyDown,\n onPaste,\n type,\n value,\n shouldUseAutoFocus,\n inputMode,\n autoComplete,\n shouldShowCenteredContent,\n shouldPreventPlaceholderAnimation,\n hasValue,\n shouldRemainPlaceholder,\n theme.fontSize,\n theme.wrong,\n labelPosition,\n borderColor,\n placeholderColor,\n placeholder,\n shouldShowClearIcon,\n handleClearIconClick,\n handleClearIconKeyDown,\n rightElement,\n shouldEnableKeyboardHighlighting,\n shouldShowKeyboardHighlighting,\n ],\n );\n\n if (isDisabled && typeof disabledHint === 'string') {\n return (\n <Tooltip item={{ text: disabledHint }} shouldUseFullWidth>\n {inputElement}\n </Tooltip>\n );\n }\n\n return inputElement;\n },\n);\n\nInput.displayName = 'Input';\n\nexport default Input;\n"],"mappings":"AAAA,OAAOA,KAAK,IAKRC,UAAU,EAKVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,WAAW,QAAQ,sCAAsC;AAElE,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,WAAW,EACXC,kBAAkB,EAClBC,yBAAyB,EACzBC,gBAAgB,EAChBC,sBAAsB,EACtBC,gBAAgB,EAChBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,6BAA6B,QAC1B,gBAAgB;AACvB,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SAASC,4BAA4B,QAAQ,0CAA0C;AAiCvF,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAqHrB,MAAMC,KAAK,gBAAG1B,UAAU,CACpB,CACI;EACI2B,WAAW;EACXC,SAAS;EACTC,UAAU;EACVC,MAAM;EACNC,QAAQ;EACRC,OAAO;EACPC,SAAS;EACTC,OAAO;EACPC,WAAW;EACXC,KAAK;EACLC,YAAY;EACZC,0BAA0B;EAC1BC,uBAAuB,GAAG,KAAK;EAC/BC,mBAAmB,GAAG,KAAK;EAC3BC,yBAAyB,GAAG,KAAK;EACjCC,IAAI,GAAGjB,SAAS,CAACkB,MAAM;EACvBC,IAAI,GAAG,MAAM;EACbC,KAAK;EACLC,YAAY;EACZC,kBAAkB,GAAG,KAAK;EAC1BC,SAAS,GAAG,KAAK;EACjBC,iCAAiC,GAAG,KAAK;EACzCC,EAAE;EACFC,+BAA+B,GAAG,KAAK;EACv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AAuB,QAAEmB,YAAsC,CAE3D,CAChB,EACD,CACIR,UAAU,EACVsB,+BAA+B,EAC/ByB,eAAe,EACf5B,SAAS,EACTyB,gBAAgB,EAChBnC,0BAA0B,EAC1BI,IAAI,EACJf,WAAW,EACXqD,aAAa,EACbvB,gBAAgB,EAChBP,EAAE,EACFpB,MAAM,EACNgD,sBAAsB,EACtB9C,OAAO,EACPC,SAAS,EACTC,OAAO,EACPU,IAAI,EACJC,KAAK,EACLE,kBAAkB,EAClBnB,SAAS,EACTwB,YAAY,EACZX,yBAAyB,EACzBQ,iCAAiC,EACjCM,QAAQ,EACRhB,uBAAuB,EACvBqB,KAAK,CAAC0D,QAAQ,EACd1D,KAAK,CAACmE,KAAK,EACXpC,aAAa,EACbH,WAAW,EACXE,gBAAgB,EAChBvD,WAAW,EACXK,mBAAmB,EACnByB,oBAAoB,EACpBG,sBAAsB,EACtB/B,YAAY,EACZgB,gCAAgC,EAChCkC,8BAA8B,CAEtC,CAAC;EAED,IAAI1D,UAAU,IAAI,OAAOiB,YAAY,KAAK,QAAQ,EAAE;IAChD,oBACI/C,KAAA,CAAAmG,aAAA,CAAC3E,OAAO;MAAC0G,IAAI,EAAE;QAAEC,IAAI,EAAEpF;MAAa,CAAE;MAACqF,kBAAkB;IAAA,GACpDlC,YACI,CAAC;EAElB;EAEA,OAAOA,YAAY;AACvB,CACJ,CAAC;AAEDvE,KAAK,CAAC0G,WAAW,GAAG,OAAO;AAE3B,eAAe1G,KAAK","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { motion } from 'motion/react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
3
4
  export const StyledInput = styled.div`
4
5
  opacity: ${({
5
6
  $isDisabled
@@ -89,6 +90,16 @@ export const StyledInputContentWrapper = styled.div`
89
90
  border-right: none;
90
91
  `;
91
92
  }}
93
+
94
+ ${({
95
+ $shouldShowKeyboardHighlighting
96
+ }) => $shouldShowKeyboardHighlighting && css`
97
+ /* Show highlighting when the input field is focused */
98
+ &:has(input:focus-visible) {
99
+ transition: none;
100
+ ${keyboardFocusHighlightingRingCss}
101
+ }
102
+ `}
92
103
  `;
93
104
  export const StyledInputContent = styled.div`
94
105
  display: flex;
@@ -161,6 +172,15 @@ export const StyledMotionInputClearIcon = styled(motion.div)`
161
172
  width: ${({
162
173
  $size
163
174
  }) => $size === 'medium' ? '40px' : '30px'};
175
+
176
+ ${({
177
+ $shouldShowKeyboardHighlighting
178
+ }) => $shouldShowKeyboardHighlighting && css`
179
+ &:focus-visible {
180
+ transition: none;
181
+ ${keyboardFocusHighlightingRingCss}
182
+ }
183
+ `}
164
184
  `;
165
185
  export const StyledInputIconWrapper = styled.div`
166
186
  align-items: baseline;
@@ -170,9 +190,24 @@ export const StyledInputIconWrapper = styled.div`
170
190
  margin-left: 10px;
171
191
  `;
172
192
  export const StyledInputRightElement = styled.div`
173
- border-bottom-right-radius: 3px;
174
- border-top-right-radius: 3px;
175
- overflow: hidden;
176
193
  flex: 0 0 auto;
194
+ overflow: hidden;
195
+ min-width: 28px;
196
+ text-align: center;
197
+
198
+ ${({
199
+ $isInline
200
+ }) => !$isInline && css`
201
+ border-bottom-right-radius: 3px;
202
+ border-top-right-radius: 3px;
203
+ `}
204
+
205
+ &:has(*:focus-visible) {
206
+ overflow: visible;
207
+ }
208
+
209
+ .beta-chayns-icon:focus-visible::after {
210
+ transform: translate(-50%, -50%) scale(0.78);
211
+ }
177
212
  `;
178
213
  //# sourceMappingURL=Input.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.styles.js","names":["motion","styled","css","StyledInput","div","$isDisabled","StyledInputContentWrapper","theme","$backgroundColor","$isInvalid","$shouldShowTransparentBackground","$borderColor","wrong","colorMode","$size","$shouldShowOnlyBottomBorder","$shouldRoundRightCorners","StyledInputContent","StyledInputField","input","$color","text","$placeholderWidth","$shouldShowCenteredContent","StyledMotionInputLabelWrapper","label","StyledMotionInputElement","StyledInputLabel","StyledMotionInputClearIcon","StyledInputIconWrapper","StyledInputRightElement"],"sources":["../../../../src/components/input/Input.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';\nimport { CSSProperties } from 'react';\n\ntype StyledInputProps = WithTheme<{ $isDisabled?: boolean }>;\n\nexport const StyledInput = styled.div<StyledInputProps>`\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n display: flex;\n width: 100%;\n`;\n\ntype StyledInputContentWrapperProps = WithTheme<{\n $backgroundColor?: CSSProperties['backgroundColor'];\n $shouldRoundRightCorners: boolean;\n $shouldShowOnlyBottomBorder?: boolean;\n $isInvalid?: boolean;\n $size: InputSize;\n $shouldShowTransparentBackground: boolean;\n $borderColor?: CSSProperties['borderColor'];\n}>;\n\nexport const StyledInputContentWrapper = styled.div<StyledInputContentWrapperProps>`\n align-items: center;\n background-color: ${({ theme, $backgroundColor }: StyledInputContentWrapperProps) =>\n $backgroundColor ?? theme['100']};\n border: 1px solid transparent;\n color: ${({ theme }: StyledInputContentWrapperProps) => theme['006']};\n display: flex;\n justify-content: space-between;\n width: 100%;\n transition: opacity 0.3s ease;\n\n ${({ theme, $isInvalid, $shouldShowTransparentBackground, $borderColor }) => {\n if ($borderColor)\n return css`\n border-color: ${$borderColor};\n `;\n if ($isInvalid) {\n return css`\n border-color: ${theme.wrong};\n `;\n }\n\n if ($shouldShowTransparentBackground) {\n if (theme.colorMode === 'dark') {\n return css`\n border-color: rgba(255, 255, 255, 0.5);\n `;\n }\n\n return css`\n border-color: rgba(0, 0, 0, 0.5);\n `;\n }\n\n return css`\n border-color: rgba(160, 160, 160, 0.3);\n `;\n }}\n\n ${({ $size }) =>\n $size === 'small' &&\n css`\n height: 32px;\n `}\n\n ${({ $shouldShowOnlyBottomBorder, $size }) =>\n !$shouldShowOnlyBottomBorder &&\n css`\n min-height: ${$size === 'medium' ? '42px' : '32px'};\n `}\n\n ${({ $shouldRoundRightCorners, $shouldShowOnlyBottomBorder, theme }) => {\n if ($shouldShowOnlyBottomBorder) {\n return css`\n border-top: none;\n border-right: none;\n border-left: none;\n background-color: transparent;\n border-color: ${theme['408']};\n `;\n }\n\n if ($shouldRoundRightCorners) {\n return css`\n border-radius: 3px;\n `;\n }\n\n return css`\n border-bottom-left-radius: 3px;\n border-top-left-radius: 3px;\n border-right: none;\n `;\n }}\n`;\n\ntype StyledInputContentProps = WithTheme<{ $shouldShowOnlyBottomBorder?: boolean }>;\n\nexport const StyledInputContent = styled.div<StyledInputContentProps>`\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n margin: ${({ $shouldShowOnlyBottomBorder }) =>\n !$shouldShowOnlyBottomBorder ? '8px 10px' : '4px 0'};\n position: relative;\n`;\n\ntype StyledInputFieldProps = WithTheme<{\n $color?: CSSProperties['color'];\n $isInvalid?: boolean;\n $placeholderWidth: number;\n $shouldShowCenteredContent: boolean;\n}>;\n\nexport const StyledInputField = styled.input<StyledInputFieldProps>`\n background: none;\n border: none;\n color: ${({ theme, $color, $isInvalid }: StyledInputFieldProps) =>\n $color ?? ($isInvalid ? theme.wrong : theme.text)};\n padding: 0;\n width: ${({ $placeholderWidth }) => `calc(100% - ${$placeholderWidth}px)`};\n line-height: 1em;\n\n ${({ $shouldShowCenteredContent }) =>\n $shouldShowCenteredContent &&\n css`\n text-align: center;\n `}\n`;\n\nexport const StyledMotionInputLabelWrapper = styled(motion.label)`\n align-items: center;\n display: flex;\n flex: 0 0 auto;\n gap: 4px;\n line-height: 1.3;\n pointer-events: none;\n position: absolute;\n user-select: none;\n max-width: 100%;\n`;\n\nexport const StyledMotionInputElement = styled(motion.div)`\n display: flex;\n`;\n\ntype StyledInputLabelProps = WithTheme<{\n $color?: CSSProperties['color'];\n $isInvalid?: boolean;\n}>;\n\nexport const StyledInputLabel = styled.label<StyledInputLabelProps>`\n line-height: 1.3;\n pointer-events: none;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: ${({ theme, $color, $isInvalid }: StyledInputLabelProps) =>\n $color ?? ($isInvalid ? theme.wrong : `rgba(${theme['text-rgb'] ?? ''}, 0.45)`)};\n`;\n\ntype StyledMotionInputClearIconProps = WithTheme<{\n $shouldShowOnlyBottomBorder?: boolean;\n $size: InputSize;\n}>;\n\nexport const StyledMotionInputClearIcon = styled(motion.div)<StyledMotionInputClearIconProps>`\n align-items: center;\n border-left: ${({ $shouldShowOnlyBottomBorder }) =>\n $shouldShowOnlyBottomBorder ? 'none' : '1px solid rgba(160, 160, 160, 0.3)'};\n cursor: pointer;\n display: flex;\n flex: 0 0 auto;\n height: ${({ $size }) => ($size === 'medium' ? '40px' : '30px')};\n justify-content: center;\n width: ${({ $size }) => ($size === 'medium' ? '40px' : '30px')};\n`;\n\nexport const StyledInputIconWrapper = styled.div`\n align-items: baseline;\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n margin-left: 10px;\n`;\n\nexport const StyledInputRightElement = styled.div`\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n overflow: hidden;\n flex: 0 0 auto;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAO/C,OAAO,MAAMC,WAAW,GAAGF,MAAM,CAACG,GAAqB;AACvD,eAAe,CAAC;EAAEC;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA,CAAC;AAYD,OAAO,MAAMC,yBAAyB,GAAGL,MAAM,CAACG,GAAmC;AACnF;AACA,wBAAwB,CAAC;EAAEG,KAAK;EAAEC;AAAiD,CAAC,KAC5EA,gBAAgB,IAAID,KAAK,CAAC,KAAK,CAAC;AACxC;AACA,aAAa,CAAC;EAAEA;AAAsC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACxE;AACA;AACA;AACA;AAC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AAM,GAAG,MAAO;AAClE,CAAC;AAED,OAAO,MAAMe,sBAAsB,GAAG5B,MAAM,CAACG,GAAG;AAChD;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAM0B,uBAAuB,GAAG7B,MAAM,CAACG,GAAG;AACjD;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Input.styles.js","names":["motion","styled","css","keyboardFocusHighlightingRingCss","StyledInput","div","$isDisabled","StyledInputContentWrapper","theme","$backgroundColor","$isInvalid","$shouldShowTransparentBackground","$borderColor","wrong","colorMode","$size","$shouldShowOnlyBottomBorder","$shouldRoundRightCorners","$shouldShowKeyboardHighlighting","StyledInputContent","StyledInputField","input","$color","text","$placeholderWidth","$shouldShowCenteredContent","StyledMotionInputLabelWrapper","label","StyledMotionInputElement","StyledInputLabel","StyledMotionInputClearIcon","StyledInputIconWrapper","StyledInputRightElement","$isInline"],"sources":["../../../../src/components/input/Input.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';\nimport { CSSProperties } from 'react';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledInputProps = WithTheme<{ $isDisabled?: boolean }>;\n\nexport const StyledInput = styled.div<StyledInputProps>`\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n display: flex;\n width: 100%;\n`;\n\ntype StyledInputContentWrapperProps = WithTheme<{\n $backgroundColor?: CSSProperties['backgroundColor'];\n $shouldRoundRightCorners: boolean;\n $shouldShowOnlyBottomBorder?: boolean;\n $isInvalid?: boolean;\n $size: InputSize;\n $shouldShowTransparentBackground: boolean;\n $borderColor?: CSSProperties['borderColor'];\n $shouldShowKeyboardHighlighting: boolean;\n}>;\n\nexport const StyledInputContentWrapper = styled.div<StyledInputContentWrapperProps>`\n align-items: center;\n background-color: ${({ theme, $backgroundColor }: StyledInputContentWrapperProps) =>\n $backgroundColor ?? theme['100']};\n border: 1px solid transparent;\n color: ${({ theme }: StyledInputContentWrapperProps) => theme['006']};\n display: flex;\n justify-content: space-between;\n width: 100%;\n transition: opacity 0.3s ease;\n\n ${({ theme, $isInvalid, $shouldShowTransparentBackground, $borderColor }) => {\n if ($borderColor)\n return css`\n border-color: ${$borderColor};\n `;\n if ($isInvalid) {\n return css`\n border-color: ${theme.wrong};\n `;\n }\n\n if ($shouldShowTransparentBackground) {\n if (theme.colorMode === 'dark') {\n return css`\n border-color: rgba(255, 255, 255, 0.5);\n `;\n }\n\n return css`\n border-color: rgba(0, 0, 0, 0.5);\n `;\n }\n\n return css`\n border-color: rgba(160, 160, 160, 0.3);\n `;\n }}\n\n ${({ $size }) =>\n $size === 'small' &&\n css`\n height: 32px;\n `}\n\n ${({ $shouldShowOnlyBottomBorder, $size }) =>\n !$shouldShowOnlyBottomBorder &&\n css`\n min-height: ${$size === 'medium' ? '42px' : '32px'};\n `}\n\n ${({ $shouldRoundRightCorners, $shouldShowOnlyBottomBorder, theme }) => {\n if ($shouldShowOnlyBottomBorder) {\n return css`\n border-top: none;\n border-right: none;\n border-left: none;\n background-color: transparent;\n border-color: ${theme['408']};\n `;\n }\n\n if ($shouldRoundRightCorners) {\n return css`\n border-radius: 3px;\n `;\n }\n\n return css`\n border-bottom-left-radius: 3px;\n border-top-left-radius: 3px;\n border-right: none;\n `;\n }}\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n /* Show highlighting when the input field is focused */\n &:has(input:focus-visible) {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n`;\n\ntype StyledInputContentProps = WithTheme<{ $shouldShowOnlyBottomBorder?: boolean }>;\n\nexport const StyledInputContent = styled.div<StyledInputContentProps>`\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n margin: ${({ $shouldShowOnlyBottomBorder }) =>\n !$shouldShowOnlyBottomBorder ? '8px 10px' : '4px 0'};\n position: relative;\n`;\n\ntype StyledInputFieldProps = WithTheme<{\n $color?: CSSProperties['color'];\n $isInvalid?: boolean;\n $placeholderWidth: number;\n $shouldShowCenteredContent: boolean;\n}>;\n\nexport const StyledInputField = styled.input<StyledInputFieldProps>`\n background: none;\n border: none;\n color: ${({ theme, $color, $isInvalid }: StyledInputFieldProps) =>\n $color ?? ($isInvalid ? theme.wrong : theme.text)};\n padding: 0;\n width: ${({ $placeholderWidth }) => `calc(100% - ${$placeholderWidth}px)`};\n line-height: 1em;\n\n ${({ $shouldShowCenteredContent }) =>\n $shouldShowCenteredContent &&\n css`\n text-align: center;\n `}\n`;\n\nexport const StyledMotionInputLabelWrapper = styled(motion.label)`\n align-items: center;\n display: flex;\n flex: 0 0 auto;\n gap: 4px;\n line-height: 1.3;\n pointer-events: none;\n position: absolute;\n user-select: none;\n max-width: 100%;\n`;\n\nexport const StyledMotionInputElement = styled(motion.div)`\n display: flex;\n`;\n\ntype StyledInputLabelProps = WithTheme<{\n $color?: CSSProperties['color'];\n $isInvalid?: boolean;\n}>;\n\nexport const StyledInputLabel = styled.label<StyledInputLabelProps>`\n line-height: 1.3;\n pointer-events: none;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n color: ${({ theme, $color, $isInvalid }: StyledInputLabelProps) =>\n $color ?? ($isInvalid ? theme.wrong : `rgba(${theme['text-rgb'] ?? ''}, 0.45)`)};\n`;\n\ntype StyledMotionInputClearIconProps = WithTheme<{\n $shouldShowOnlyBottomBorder?: boolean;\n $size: InputSize;\n $shouldShowKeyboardHighlighting: boolean;\n}>;\n\nexport const StyledMotionInputClearIcon = styled(motion.div)<StyledMotionInputClearIconProps>`\n align-items: center;\n border-left: ${({ $shouldShowOnlyBottomBorder }) =>\n $shouldShowOnlyBottomBorder ? 'none' : '1px solid rgba(160, 160, 160, 0.3)'};\n cursor: pointer;\n display: flex;\n flex: 0 0 auto;\n height: ${({ $size }) => ($size === 'medium' ? '40px' : '30px')};\n justify-content: center;\n width: ${({ $size }) => ($size === 'medium' ? '40px' : '30px')};\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n`;\n\nexport const StyledInputIconWrapper = styled.div`\n align-items: baseline;\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n margin-left: 10px;\n`;\n\ntype StyledInputRightElementProps = {\n $isInline?: boolean;\n};\n\nexport const StyledInputRightElement = styled.div<StyledInputRightElementProps>`\n flex: 0 0 auto;\n overflow: hidden;\n min-width: 28px;\n text-align: center;\n\n ${({ $isInline }) =>\n !$isInline &&\n css`\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n `}\n\n &:has(*:focus-visible) {\n overflow: visible;\n }\n\n .beta-chayns-icon:focus-visible::after {\n transform: translate(-50%, -50%) scale(0.78);\n }\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAI/C,SAASC,gCAAgC,QAAQ,8CAA8C;AAI/F,OAAO,MAAMC,WAAW,GAAGH,MAAM,CAACI,GAAqB;AACvD,eAAe,CAAC;EAAEC;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA,CAAC;AAaD,OAAO,MAAMC,yBAAyB,GAAGN,MAAM,CAACI,GAAmC;AACnF;AACA,wBAAwB,CAAC;EAAEG,KAAK;EAAEC;AAAiD,CAAC,KAC5EA,gBAAgB,IAAID,KAAK,CAAC,KAAK,CAAC;AACxC;AACA,aAAa,CAAC;EAAEA;AAAsC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACxE;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEA,KAAK;EAAEE,UAAU;EAAEC,gCAAgC;EAAEC;AAAa,CAAC,KAAK;EACzE,IAAI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