@chayns-components/core 5.5.30 → 5.5.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/lib/cjs/components/accordion/Accordion.js +10 -0
  2. package/lib/cjs/components/accordion/Accordion.js.map +1 -1
  3. package/lib/cjs/components/accordion/Accordion.styles.js +0 -2
  4. package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
  5. package/lib/cjs/components/amount-control/AmountControl.js +14 -3
  6. package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
  7. package/lib/cjs/components/amount-control/AmountControl.styles.js +0 -17
  8. package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
  9. package/lib/cjs/components/button/Button.js +6 -1
  10. package/lib/cjs/components/button/Button.js.map +1 -1
  11. package/lib/cjs/components/button/Button.styles.js +0 -10
  12. package/lib/cjs/components/button/Button.styles.js.map +1 -1
  13. package/lib/cjs/components/checkbox/Checkbox.js +8 -1
  14. package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
  15. package/lib/cjs/components/checkbox/Checkbox.styles.js +0 -10
  16. package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
  17. package/lib/cjs/components/combobox/ComboBox.js +7 -1
  18. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  19. package/lib/cjs/components/combobox/ComboBox.styles.js +3 -10
  20. package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
  21. package/lib/cjs/components/context-menu/ContextMenu.js +12 -0
  22. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  23. package/lib/cjs/components/context-menu/ContextMenu.styles.js +7 -35
  24. package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
  25. package/lib/cjs/components/file-list/file-item/FileItem.js +7 -0
  26. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  27. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +1 -11
  28. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  29. package/lib/cjs/components/file-select/FileSelect.js +12 -3
  30. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  31. package/lib/cjs/components/file-select/FileSelect.styles.js +3 -9
  32. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  33. package/lib/cjs/components/filter/Filter.js +44 -16
  34. package/lib/cjs/components/filter/Filter.js.map +1 -1
  35. package/lib/cjs/components/filter/Filter.styles.js +2 -2
  36. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  37. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +9 -1
  38. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  39. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
  40. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  41. package/lib/cjs/components/grid-image/GridImage.js +7 -1
  42. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  43. package/lib/cjs/components/grid-image/GridImage.styles.js +5 -10
  44. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  45. package/lib/cjs/components/grouped-image/GroupedImage.js +8 -2
  46. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  47. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +3 -8
  48. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  49. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +7 -2
  50. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  51. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +5 -10
  52. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  53. package/lib/cjs/components/icon/Icon.js +10 -2
  54. package/lib/cjs/components/icon/Icon.js.map +1 -1
  55. package/lib/cjs/components/icon/Icon.styles.js +6 -32
  56. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  57. package/lib/cjs/components/input/Input.js +14 -2
  58. package/lib/cjs/components/input/Input.js.map +1 -1
  59. package/lib/cjs/components/input/Input.styles.js +0 -3
  60. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  61. package/lib/cjs/components/list/List.utils.js +3 -9
  62. package/lib/cjs/components/list/List.utils.js.map +1 -1
  63. package/lib/cjs/components/list/list-item/ListItem.js +13 -2
  64. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  65. package/lib/cjs/components/list/list-item/ListItem.styles.js +9 -2
  66. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  67. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -4
  68. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  69. package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
  70. package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
  71. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +8 -2
  72. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  73. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
  74. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  75. package/lib/cjs/components/radio-button/RadioButton.js +7 -1
  76. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  77. package/lib/cjs/components/radio-button/RadioButton.styles.js +0 -10
  78. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  79. package/lib/cjs/components/search-input/SearchInput.js +9 -10
  80. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  81. package/lib/cjs/components/search-input/SearchInput.styles.js +5 -15
  82. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  83. package/lib/cjs/components/sharing-bar/SharingBar.js +13 -0
  84. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  85. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +1 -5
  86. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  87. package/lib/cjs/components/slider/Slider.js +13 -6
  88. package/lib/cjs/components/slider/Slider.js.map +1 -1
  89. package/lib/cjs/components/slider/Slider.styles.js +2 -9
  90. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  91. package/lib/cjs/components/slider-button/SliderButton.js +6 -2
  92. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  93. package/lib/cjs/components/slider-button/SliderButton.styles.js +2 -15
  94. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  95. package/lib/cjs/components/tag-input/TagInput.js +8 -1
  96. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  97. package/lib/cjs/components/tag-input/TagInput.styles.js +1 -3
  98. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  99. package/lib/cjs/components/text-area/TextArea.js +68 -56
  100. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  101. package/lib/cjs/components/text-area/TextArea.styles.js +0 -2
  102. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  103. package/lib/cjs/components/truncation/Truncation.js +9 -5
  104. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  105. package/lib/cjs/components/truncation/Truncation.styles.js +0 -11
  106. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  107. package/lib/cjs/hooks/useFocusRingPortal.js +197 -0
  108. package/lib/cjs/hooks/useFocusRingPortal.js.map +1 -0
  109. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +9 -3
  110. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -1
  111. package/lib/cjs/index.js +14 -0
  112. package/lib/cjs/index.js.map +1 -1
  113. package/lib/esm/components/accordion/Accordion.js +10 -0
  114. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  115. package/lib/esm/components/accordion/Accordion.styles.js +0 -2
  116. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  117. package/lib/esm/components/amount-control/AmountControl.js +14 -3
  118. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  119. package/lib/esm/components/amount-control/AmountControl.styles.js +0 -17
  120. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  121. package/lib/esm/components/button/Button.js +7 -2
  122. package/lib/esm/components/button/Button.js.map +1 -1
  123. package/lib/esm/components/button/Button.styles.js +0 -10
  124. package/lib/esm/components/button/Button.styles.js.map +1 -1
  125. package/lib/esm/components/checkbox/Checkbox.js +8 -1
  126. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  127. package/lib/esm/components/checkbox/Checkbox.styles.js +0 -10
  128. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  129. package/lib/esm/components/combobox/ComboBox.js +7 -1
  130. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  131. package/lib/esm/components/combobox/ComboBox.styles.js +3 -10
  132. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  133. package/lib/esm/components/context-menu/ContextMenu.js +11 -0
  134. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  135. package/lib/esm/components/context-menu/ContextMenu.styles.js +7 -35
  136. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  137. package/lib/esm/components/file-list/file-item/FileItem.js +8 -1
  138. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  139. package/lib/esm/components/file-list/file-item/FileItem.styles.js +1 -11
  140. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  141. package/lib/esm/components/file-select/FileSelect.js +13 -4
  142. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  143. package/lib/esm/components/file-select/FileSelect.styles.js +3 -9
  144. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  145. package/lib/esm/components/filter/Filter.js +43 -16
  146. package/lib/esm/components/filter/Filter.js.map +1 -1
  147. package/lib/esm/components/filter/Filter.styles.js +2 -2
  148. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  149. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +10 -2
  150. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  151. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
  152. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  153. package/lib/esm/components/grid-image/GridImage.js +8 -2
  154. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  155. package/lib/esm/components/grid-image/GridImage.styles.js +4 -9
  156. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  157. package/lib/esm/components/grouped-image/GroupedImage.js +9 -3
  158. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  159. package/lib/esm/components/grouped-image/GroupedImage.styles.js +3 -8
  160. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  161. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +8 -3
  162. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  163. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +4 -9
  164. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  165. package/lib/esm/components/icon/Icon.js +9 -2
  166. package/lib/esm/components/icon/Icon.js.map +1 -1
  167. package/lib/esm/components/icon/Icon.styles.js +5 -31
  168. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  169. package/lib/esm/components/input/Input.js +14 -2
  170. package/lib/esm/components/input/Input.js.map +1 -1
  171. package/lib/esm/components/input/Input.styles.js +0 -3
  172. package/lib/esm/components/input/Input.styles.js.map +1 -1
  173. package/lib/esm/components/list/List.utils.js +1 -6
  174. package/lib/esm/components/list/List.utils.js.map +1 -1
  175. package/lib/esm/components/list/list-item/ListItem.js +13 -2
  176. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  177. package/lib/esm/components/list/list-item/ListItem.styles.js +9 -2
  178. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  179. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +5 -4
  180. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  181. package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
  182. package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
  183. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -2
  184. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  185. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
  186. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  187. package/lib/esm/components/radio-button/RadioButton.js +7 -1
  188. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  189. package/lib/esm/components/radio-button/RadioButton.styles.js +0 -10
  190. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  191. package/lib/esm/components/search-input/SearchInput.js +9 -10
  192. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  193. package/lib/esm/components/search-input/SearchInput.styles.js +5 -15
  194. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  195. package/lib/esm/components/sharing-bar/SharingBar.js +12 -0
  196. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  197. package/lib/esm/components/sharing-bar/SharingBar.styles.js +1 -5
  198. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  199. package/lib/esm/components/slider/Slider.js +13 -6
  200. package/lib/esm/components/slider/Slider.js.map +1 -1
  201. package/lib/esm/components/slider/Slider.styles.js +1 -8
  202. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  203. package/lib/esm/components/slider-button/SliderButton.js +6 -2
  204. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  205. package/lib/esm/components/slider-button/SliderButton.styles.js +1 -14
  206. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  207. package/lib/esm/components/tag-input/TagInput.js +8 -1
  208. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  209. package/lib/esm/components/tag-input/TagInput.styles.js +1 -3
  210. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  211. package/lib/esm/components/text-area/TextArea.js +68 -56
  212. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  213. package/lib/esm/components/text-area/TextArea.styles.js +0 -2
  214. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  215. package/lib/esm/components/truncation/Truncation.js +9 -5
  216. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  217. package/lib/esm/components/truncation/Truncation.styles.js +0 -11
  218. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  219. package/lib/esm/hooks/useFocusRingPortal.js +188 -0
  220. package/lib/esm/hooks/useFocusRingPortal.js.map +1 -0
  221. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +7 -2
  222. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -1
  223. package/lib/esm/index.js +2 -0
  224. package/lib/esm/index.js.map +1 -1
  225. package/lib/types/components/amount-control/AmountControl.styles.d.ts +4 -8
  226. package/lib/types/components/button/Button.styles.d.ts +2 -4
  227. package/lib/types/components/checkbox/Checkbox.styles.d.ts +1 -5
  228. package/lib/types/components/combobox/ComboBox.styles.d.ts +2 -4
  229. package/lib/types/components/file-select/FileSelect.styles.d.ts +2 -4
  230. package/lib/types/components/grid-image/GridImage.styles.d.ts +2 -4
  231. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +2 -4
  232. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +1 -5
  233. package/lib/types/components/icon/Icon.styles.d.ts +0 -1
  234. package/lib/types/components/input/Input.styles.d.ts +4 -4
  235. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +2 -4
  236. package/lib/types/components/radio-button/RadioButton.styles.d.ts +2 -4
  237. package/lib/types/components/search-input/SearchInput.styles.d.ts +6 -13
  238. package/lib/types/components/slider/Slider.styles.d.ts +8 -12
  239. package/lib/types/components/slider-button/SliderButton.styles.d.ts +2 -4
  240. package/lib/types/components/truncation/Truncation.styles.d.ts +1 -5
  241. package/lib/types/hooks/useFocusRingPortal.d.ts +18 -0
  242. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +1 -0
  243. package/lib/types/index.d.ts +2 -0
  244. package/package.json +4 -4
  245. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +0 -29
  246. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  247. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +0 -24
  248. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  249. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"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,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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
+ {"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","useFocusRingPortal","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","inputContentWrapperRef","clearIconRef","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","isEnabled","overlayRef","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 { useFocusRingPortal } from '../../hooks/useFocusRingPortal';\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 inputContentWrapperRef = useRef<HTMLDivElement>(null);\n const clearIconRef = useRef<HTMLDivElement>(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 useFocusRingPortal(inputRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n overlayRef: inputContentWrapperRef,\n });\n useFocusRingPortal(clearIconRef, {\n isEnabled: shouldShowKeyboardHighlighting && hasValue && !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 ref={inputContentWrapperRef}\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 ref={clearIconRef}\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={hasValue && !isDisabled ? 0 : -1}\n role={hasValue ? '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,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,4BAA4B,QAAQ,0CAA0C;AAiCvF,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAqHrB,MAAMC,KAAK,gBAAG3B,UAAU,CACpB,CACI;EACI4B,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,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AAI,EAAExF;MAAa,CAAE;MAACyF,kBAAkB;IAAA,GACpDlC,YACI,CAAC;EAElB;EAEA,OAAOA,YAAY;AACvB,CACJ,CAAC;AAED3E,KAAK,CAAC8G,WAAW,GAAG,OAAO;AAE3B,eAAe9G,KAAK","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  import { motion } from 'motion/react';
2
2
  import styled, { css } from 'styled-components';
3
- import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
4
3
  export const StyledInput = styled.div`
5
4
  opacity: ${({
6
5
  $isDisabled
@@ -97,7 +96,6 @@ export const StyledInputContentWrapper = styled.div`
97
96
  /* Show highlighting when the input field is focused */
98
97
  &:has(input:focus-visible) {
99
98
  transition: none;
100
- ${keyboardFocusHighlightingRingCss}
101
99
  }
102
100
  `}
103
101
  `;
@@ -178,7 +176,6 @@ export const StyledMotionInputClearIcon = styled(motion.div)`
178
176
  }) => $shouldShowKeyboardHighlighting && css`
179
177
  &:focus-visible {
180
178
  transition: none;
181
- ${keyboardFocusHighlightingRingCss}
182
179
  }
183
180
  `}
184
181
  `;
@@ -1 +1 @@
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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a,CAAC;EAAEnB,KAAK;EAAEc,MAAM;EAAEZ;AAAkC,CAAC,KAC1DY,MAAM,KAAKZ,UAAU,GAAGF,KAAK,CAACK,KAAK,GAAG,QAAQL,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC;AACvF,CAAC;AAQD,OAAO,MAAMsB,0BAA0B,GAAG7B,MAAM,CAACD,MAAM,CAACK,GAAG,CAAkC;AAC7F;AACA,mBAAmB,CAAC;EAAEW;AAA4B,CAAC,KAC3CA,2BAA2B,GAAG,MAAM,GAAG,oCAAoC;AACnF;AACA;AACA;AACA,cAAc,CAAC;EAAED;AAAM,CAAC,KAAMA,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAO;AACnE;AACA,aAAa,CAAC;EAAEA;AAAM,CAAC,KAAMA,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAO;AAClE;AACA,MAAM,CAAC;EAAEG;AAAgC,CAAC,KAClCA,+BAA+B,IAC/BhB,GAAG;AACX;AACA;AACA,kBAAkBC,gCAAgC;AAClD;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAM4B,sBAAsB,GAAG9B,MAAM,CAACI,GAAG;AAChD;AACA;AACA;AACA;AACA;AACA,CAAC;AAMD,OAAO,MAAM2B,uBAAuB,GAAG/B,MAAM,CAACI,GAAiC;AAC/E;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAE4B;AAAU,CAAC,KACZ,CAACA,SAAS,IACV/B,GAAG;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
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","$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';\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 }\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 }\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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1D;AACA,CAAC;AAOD,OAAO,MAAMwB,gBAAgB,GAAG3B,MAAM,CAACyB,KAA4B;AACnE;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,CAAC;EAAEnB,KAAK;EAAEc,MAAM;EAAEZ;AAAkC,CAAC,KAC1DY,MAAM,KAAKZ,UAAU,GAAGF,KAAK,CAACK,KAAK,GAAG,QAAQL,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC;AACvF,CAAC;AAQD,OAAO,MAAMsB,0BAA0B,GAAG5B,MAAM,CAACD,MAAM,CAACI,GAAG,CAAkC;AAC7F;AACA,mBAAmB,CAAC;EAAEW;AAA4B,CAAC,KAC3CA,2BAA2B,GAAG,MAAM,GAAG,oCAAoC;AACnF;AACA;AACA;AACA,cAAc,CAAC;EAAED;AAAM,CAAC,KAAMA,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAO;AACnE;AACA,aAAa,CAAC;EAAEA;AAAM,CAAC,KAAMA,KAAK,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAO;AAClE;AACA,MAAM,CAAC;EAAEG;AAAgC,CAAC,KAClCA,+BAA+B,IAC/Bf,GAAG;AACX;AACA;AACA;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAM4B,sBAAsB,GAAG7B,MAAM,CAACG,GAAG;AAChD;AACA;AACA;AACA;AACA;AACA,CAAC;AAMD,OAAO,MAAM2B,uBAAuB,GAAG9B,MAAM,CAACG,GAAiC;AAC/E;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAE4B;AAAU,CAAC,KACZ,CAACA,SAAS,IACV9B,GAAG;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -107,11 +107,6 @@ export const handleHorizontalArrowNavigation = ({
107
107
  focusableLeftElements[focusableLeftElements.length - 1]?.focus();
108
108
  return true;
109
109
  }
110
- if (event.key === 'ArrowRight' && focusableRightElements.length > 0) {
111
- event.preventDefault();
112
- focusableRightElements[0]?.focus();
113
- return true;
114
- }
115
110
  }
116
111
  return false;
117
112
  };
@@ -182,8 +177,8 @@ export const handleVerticalListGroupNavigation = ({
182
177
  if (currentIndex === -1) {
183
178
  return true;
184
179
  }
185
- const isBackward = event.key === 'ArrowUp';
186
180
  event.preventDefault();
181
+ const isBackward = event.key === 'ArrowUp';
187
182
  const nextIndex = isBackward ? (currentIndex - 1 + listItemUuids.length) % listItemUuids.length : (currentIndex + 1) % listItemUuids.length;
188
183
  const nextListItemUuid = listItemUuids[nextIndex];
189
184
  if (nextListItemUuid && nextListItemUuid !== currentUuid && typeof listGroupUuid === 'string' && typeof updateActiveListItemUuid === 'function') {
@@ -1 +1 @@
1
- {"version":3,"file":"List.utils.js","names":["Children","isValidElement","LIST_ITEM_MARKER","isDirectListItemElement","node","type","displayName","isMarkedListItemElement","$$listItem","shouldShowExpandIndicator","toArray","some","child","props","shouldHideIndicator","children","undefined","isExpandable","LEFT_ELEMENT_FOCUSABLE_SELECTOR","RIGHT_ELEMENT_FOCUSABLE_SELECTOR","getFocusableElements","root","selector","Array","from","querySelectorAll","filter","element","hasAttribute","getAttribute","getFocusedElementIndex","elements","targetElement","length","findIndex","contains","getListItemElementByIndex","index","listItemUuids","listGroupUuid","listItemUuid","document","querySelector","focusListItemByIndex","updateActiveListItemUuid","listItemElement","focus","handleHorizontalArrowNavigation","event","currentListItemElement","isCurrentListItemTarget","key","focusableLeftElements","focusableRightElements","focusedLeftElementIndex","preventDefault","previousLeftElement","nextLeftElement","focusedRightElementIndex","previousRightElement","handleListItemTabNavigation","isInKeyboardNavigationGroup","currentUuid","currentIndex","indexOf","shiftKey","nextRightElement","handleVerticalListGroupNavigation","isBackward","nextIndex","nextListItemUuid","nextListItemElement","handleListItemToggleKey","isItemOpen","shouldEnableKeyboardHighlighting","toggleItem","shouldOpen","shouldClose","shouldToggle"],"sources":["../../../../src/components/list/List.utils.ts"],"sourcesContent":["import {\n Children,\n isValidElement,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { LIST_ITEM_MARKER } from './list-item/ListItem.utils';\n\nexport interface ListItemMetaProps {\n isExpandable?: boolean;\n shouldHideIndicator?: boolean;\n children?: ReactNode;\n}\n\ntype ListItemMarkedType = {\n $$listItem?: typeof LIST_ITEM_MARKER;\n};\n\nexport const isDirectListItemElement = (node: ReactNode): node is ReactElement<ListItemMetaProps> =>\n isValidElement(node) && (node.type as { displayName?: string }).displayName === 'ListItem';\n\nexport const isMarkedListItemElement = (node: ReactNode): node is ReactElement<ListItemMetaProps> =>\n isValidElement(node) &&\n typeof node.type !== 'string' &&\n (node.type as ListItemMarkedType).$$listItem === LIST_ITEM_MARKER;\n\nexport const shouldShowExpandIndicator = (node: ReactNode): boolean =>\n Children.toArray(node).some((child) => {\n if (isDirectListItemElement(child)) {\n return child.props.shouldHideIndicator !== true && child.props.children !== undefined;\n }\n\n if (isMarkedListItemElement(child)) {\n return child.props.isExpandable === true && child.props.shouldHideIndicator !== true;\n }\n\n if (isValidElement<{ children?: ReactNode }>(child) && child.props.children !== undefined) {\n return shouldShowExpandIndicator(child.props.children);\n }\n\n return false;\n });\n\nconst LEFT_ELEMENT_FOCUSABLE_SELECTOR =\n '[data-left-element=\"true\"] a[href], [data-left-element=\"true\"] button, [data-left-element=\"true\"] input, [data-left-element=\"true\"] select, [data-left-element=\"true\"] textarea, [data-left-element=\"true\"] [tabindex], [data-left-element=\"true\"] [contenteditable=\"true\"]';\n\nconst RIGHT_ELEMENT_FOCUSABLE_SELECTOR =\n '[data-right-element=\"true\"] a[href], [data-right-element=\"true\"] button, [data-right-element=\"true\"] input, [data-right-element=\"true\"] select, [data-right-element=\"true\"] textarea, [data-right-element=\"true\"] [tabindex], [data-right-element=\"true\"] [contenteditable=\"true\"]';\n\nconst getFocusableElements = (root: HTMLElement, selector: string) =>\n Array.from(root.querySelectorAll<HTMLElement>(selector)).filter(\n (element) => !element.hasAttribute('disabled') && element.getAttribute('tabindex') !== '-1',\n );\n\nconst getFocusedElementIndex = (elements: HTMLElement[], targetElement: HTMLElement | null) => {\n if (!targetElement || elements.length === 0) {\n return -1;\n }\n\n return elements.findIndex(\n (element) => element === targetElement || element.contains(targetElement),\n );\n};\n\ntype ListGroupNavigationParams = {\n event: KeyboardEvent<HTMLDivElement>;\n isCurrentListItemTarget: boolean;\n isInKeyboardNavigationGroup: boolean;\n listItemUuids?: string[];\n currentUuid: string;\n listGroupUuid?: string;\n updateActiveListItemUuid?: (uuid?: string) => void;\n};\n\ntype ListItemTabNavigationParams = ListGroupNavigationParams & {\n currentListItemElement: HTMLDivElement;\n targetElement: HTMLElement | null;\n};\n\ntype ListItemToggleKeyParams = {\n event: KeyboardEvent<HTMLDivElement>;\n isCurrentListItemTarget: boolean;\n isExpandable: boolean;\n isItemOpen: boolean;\n shouldEnableKeyboardHighlighting: boolean;\n toggleItem: VoidFunction;\n};\n\nconst getListItemElementByIndex = ({\n index,\n listItemUuids,\n listGroupUuid,\n}: {\n index: number;\n listItemUuids: string[];\n listGroupUuid?: string;\n}) => {\n const listItemUuid = listItemUuids[index];\n\n if (!listItemUuid || typeof listGroupUuid !== 'string') {\n return undefined;\n }\n\n return document.querySelector<HTMLDivElement>(\n `[data-uuid=\"${listGroupUuid}---${listItemUuid}\"]`,\n );\n};\n\nconst focusListItemByIndex = ({\n index,\n listItemUuids,\n listGroupUuid,\n updateActiveListItemUuid,\n}: {\n index: number;\n listItemUuids: string[];\n listGroupUuid?: string;\n updateActiveListItemUuid?: (uuid?: string) => void;\n}) => {\n const listItemUuid = listItemUuids[index];\n const listItemElement = getListItemElementByIndex({ index, listItemUuids, listGroupUuid });\n\n if (!listItemUuid || !listItemElement || typeof updateActiveListItemUuid !== 'function') {\n return false;\n }\n\n updateActiveListItemUuid(listItemUuid);\n listItemElement.focus();\n return true;\n};\n\nexport const handleHorizontalArrowNavigation = ({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n}: {\n event: KeyboardEvent<HTMLDivElement>;\n currentListItemElement: HTMLDivElement;\n targetElement: HTMLElement | null;\n isCurrentListItemTarget: boolean;\n}) => {\n if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') {\n return false;\n }\n\n const focusableLeftElements = getFocusableElements(\n currentListItemElement,\n LEFT_ELEMENT_FOCUSABLE_SELECTOR,\n );\n\n const focusableRightElements = getFocusableElements(\n currentListItemElement,\n RIGHT_ELEMENT_FOCUSABLE_SELECTOR,\n );\n\n const focusedLeftElementIndex = getFocusedElementIndex(focusableLeftElements, targetElement);\n\n if (focusedLeftElementIndex !== -1) {\n event.preventDefault();\n\n if (event.key === 'ArrowLeft') {\n const previousLeftElement = focusableLeftElements[focusedLeftElementIndex - 1];\n\n if (previousLeftElement) {\n previousLeftElement.focus();\n } else {\n currentListItemElement.focus();\n }\n\n return true;\n }\n\n const nextLeftElement = focusableLeftElements[focusedLeftElementIndex + 1];\n\n if (nextLeftElement) {\n nextLeftElement.focus();\n } else if (focusableRightElements.length > 0) {\n focusableRightElements[0]?.focus();\n }\n\n return true;\n }\n\n const focusedRightElementIndex = getFocusedElementIndex(focusableRightElements, targetElement);\n\n if (focusedRightElementIndex !== -1) {\n event.preventDefault();\n\n if (event.key === 'ArrowRight') {\n focusableRightElements[focusedRightElementIndex + 1]?.focus();\n return true;\n }\n\n const previousRightElement = focusableRightElements[focusedRightElementIndex - 1];\n\n if (previousRightElement) {\n previousRightElement.focus();\n } else if (focusableLeftElements.length > 0) {\n focusableLeftElements[focusableLeftElements.length - 1]?.focus();\n } else {\n currentListItemElement.focus();\n }\n\n return true;\n }\n\n if (isCurrentListItemTarget) {\n if (event.key === 'ArrowLeft' && focusableLeftElements.length > 0) {\n event.preventDefault();\n focusableLeftElements[focusableLeftElements.length - 1]?.focus();\n return true;\n }\n\n if (event.key === 'ArrowRight' && focusableRightElements.length > 0) {\n event.preventDefault();\n focusableRightElements[0]?.focus();\n return true;\n }\n }\n\n return false;\n};\n\nexport const handleListItemTabNavigation = ({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid,\n listGroupUuid,\n updateActiveListItemUuid,\n}: ListItemTabNavigationParams) => {\n if (event.key !== 'Tab' || !isInKeyboardNavigationGroup || !listItemUuids?.length) {\n return false;\n }\n\n const currentIndex = listItemUuids.indexOf(currentUuid);\n\n if (currentIndex === -1) {\n return false;\n }\n\n const focusableRightElements = getFocusableElements(\n currentListItemElement,\n RIGHT_ELEMENT_FOCUSABLE_SELECTOR,\n );\n const focusedRightElementIndex = getFocusedElementIndex(focusableRightElements, targetElement);\n\n if (event.shiftKey) {\n return false;\n }\n\n if (isCurrentListItemTarget) {\n if (focusableRightElements.length > 0) {\n event.preventDefault();\n focusableRightElements[0]?.focus();\n return true;\n }\n\n return false;\n }\n\n if (focusedRightElementIndex === -1) {\n return false;\n }\n\n const nextRightElement = focusableRightElements[focusedRightElementIndex + 1];\n\n if (nextRightElement) {\n event.preventDefault();\n nextRightElement.focus();\n return true;\n }\n\n if (currentIndex < listItemUuids.length - 1) {\n event.preventDefault();\n return focusListItemByIndex({\n index: currentIndex + 1,\n listItemUuids,\n listGroupUuid,\n updateActiveListItemUuid,\n });\n }\n\n return false;\n};\n\nexport const handleVerticalListGroupNavigation = ({\n event,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid,\n listGroupUuid,\n updateActiveListItemUuid,\n}: ListGroupNavigationParams) => {\n if (\n !isCurrentListItemTarget ||\n !isInKeyboardNavigationGroup ||\n !listItemUuids?.length ||\n (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')\n ) {\n return false;\n }\n\n const currentIndex = listItemUuids.indexOf(currentUuid);\n\n if (currentIndex === -1) {\n return true;\n }\n\n const isBackward = event.key === 'ArrowUp';\n\n event.preventDefault();\n\n const nextIndex = isBackward\n ? (currentIndex - 1 + listItemUuids.length) % listItemUuids.length\n : (currentIndex + 1) % listItemUuids.length;\n\n const nextListItemUuid = listItemUuids[nextIndex];\n\n if (\n nextListItemUuid &&\n nextListItemUuid !== currentUuid &&\n typeof listGroupUuid === 'string' &&\n typeof updateActiveListItemUuid === 'function'\n ) {\n const nextListItemElement = document.querySelector<HTMLDivElement>(\n `[data-uuid=\"${listGroupUuid}---${nextListItemUuid}\"]`,\n );\n\n if (nextListItemElement) {\n updateActiveListItemUuid(nextListItemUuid);\n nextListItemElement.focus();\n }\n }\n\n return true;\n};\n\nexport const handleListItemToggleKey = ({\n event,\n isCurrentListItemTarget,\n isExpandable,\n isItemOpen,\n shouldEnableKeyboardHighlighting,\n toggleItem,\n}: ListItemToggleKeyParams) => {\n if (!isCurrentListItemTarget || !shouldEnableKeyboardHighlighting) {\n return false;\n }\n\n const shouldOpen = isExpandable && event.key === 'ArrowRight' && !isItemOpen;\n const shouldClose = isExpandable && event.key === 'ArrowLeft' && isItemOpen;\n const shouldToggle = event.key === 'Enter' || event.key === ' ';\n\n if (!shouldOpen && !shouldClose && !shouldToggle) {\n return false;\n }\n\n event.preventDefault();\n toggleItem();\n return true;\n};\n"],"mappings":"AAAA,SACIA,QAAQ,EACRC,cAAc,QAIX,OAAO;AACd,SAASC,gBAAgB,QAAQ,4BAA4B;AAY7D,OAAO,MAAMC,uBAAuB,GAAIC,IAAe,IACnD,aAAAH,cAAc,CAACG,IAAI,CAAC,IAAKA,IAAI,CAACC,IAAI,CAA8BC,WAAW,KAAK,UAAU;AAE9F,OAAO,MAAMC,uBAAuB,GAAIH,IAAe,IACnD,aAAAH,cAAc,CAACG,IAAI,CAAC,IACpB,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAC5BD,IAAI,CAACC,IAAI,CAAwBG,UAAU,KAAKN,gBAAgB;AAErE,OAAO,MAAMO,yBAAyB,GAAIL,IAAe,IACrDJ,QAAQ,CAACU,OAAO,CAACN,IAAI,CAAC,CAACO,IAAI,CAAEC,KAAK,IAAK;EACnC,IAAIT,uBAAuB,CAACS,KAAK,CAAC,EAA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c,CAAC,CAAC;EACtBoB,UAAU,CAAC,CAAC;EACZ,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"List.utils.js","names":["Children","isValidElement","LIST_ITEM_MARKER","isDirectListItemElement","node","type","displayName","isMarkedListItemElement","$$listItem","shouldShowExpandIndicator","toArray","some","child","props","shouldHideIndicator","children","undefined","isExpandable","LEFT_ELEMENT_FOCUSABLE_SELECTOR","RIGHT_ELEMENT_FOCUSABLE_SELECTOR","getFocusableElements","root","selector","Array","from","querySelectorAll","filter","element","hasAttribute","getAttribute","getFocusedElementIndex","elements","targetElement","length","findIndex","contains","getListItemElementByIndex","index","listItemUuids","listGroupUuid","listItemUuid","document","querySelector","focusListItemByIndex","updateActiveListItemUuid","listItemElement","focus","handleHorizontalArrowNavigation","event","currentListItemElement","isCurrentListItemTarget","key","focusableLeftElements","focusableRightElements","focusedLeftElementIndex","preventDefault","previousLeftElement","nextLeftElement","focusedRightElementIndex","previousRightElement","handleListItemTabNavigation","isInKeyboardNavigationGroup","currentUuid","currentIndex","indexOf","shiftKey","nextRightElement","handleVerticalListGroupNavigation","isBackward","nextIndex","nextListItemUuid","nextListItemElement","handleListItemToggleKey","isItemOpen","shouldEnableKeyboardHighlighting","toggleItem","shouldOpen","shouldClose","shouldToggle"],"sources":["../../../../src/components/list/List.utils.ts"],"sourcesContent":["import {\n Children,\n isValidElement,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { LIST_ITEM_MARKER } from './list-item/ListItem.utils';\n\nexport interface ListItemMetaProps {\n isExpandable?: boolean;\n shouldHideIndicator?: boolean;\n children?: ReactNode;\n}\n\ntype ListItemMarkedType = {\n $$listItem?: typeof LIST_ITEM_MARKER;\n};\n\nexport const isDirectListItemElement = (node: ReactNode): node is ReactElement<ListItemMetaProps> =>\n isValidElement(node) && (node.type as { displayName?: string }).displayName === 'ListItem';\n\nexport const isMarkedListItemElement = (node: ReactNode): node is ReactElement<ListItemMetaProps> =>\n isValidElement(node) &&\n typeof node.type !== 'string' &&\n (node.type as ListItemMarkedType).$$listItem === LIST_ITEM_MARKER;\n\nexport const shouldShowExpandIndicator = (node: ReactNode): boolean =>\n Children.toArray(node).some((child) => {\n if (isDirectListItemElement(child)) {\n return child.props.shouldHideIndicator !== true && child.props.children !== undefined;\n }\n\n if (isMarkedListItemElement(child)) {\n return child.props.isExpandable === true && child.props.shouldHideIndicator !== true;\n }\n\n if (isValidElement<{ children?: ReactNode }>(child) && child.props.children !== undefined) {\n return shouldShowExpandIndicator(child.props.children);\n }\n\n return false;\n });\n\nconst LEFT_ELEMENT_FOCUSABLE_SELECTOR =\n '[data-left-element=\"true\"] a[href], [data-left-element=\"true\"] button, [data-left-element=\"true\"] input, [data-left-element=\"true\"] select, [data-left-element=\"true\"] textarea, [data-left-element=\"true\"] [tabindex], [data-left-element=\"true\"] [contenteditable=\"true\"]';\n\nconst RIGHT_ELEMENT_FOCUSABLE_SELECTOR =\n '[data-right-element=\"true\"] a[href], [data-right-element=\"true\"] button, [data-right-element=\"true\"] input, [data-right-element=\"true\"] select, [data-right-element=\"true\"] textarea, [data-right-element=\"true\"] [tabindex], [data-right-element=\"true\"] [contenteditable=\"true\"]';\n\nconst getFocusableElements = (root: HTMLElement, selector: string) =>\n Array.from(root.querySelectorAll<HTMLElement>(selector)).filter(\n (element) => !element.hasAttribute('disabled') && element.getAttribute('tabindex') !== '-1',\n );\n\nconst getFocusedElementIndex = (elements: HTMLElement[], targetElement: HTMLElement | null) => {\n if (!targetElement || elements.length === 0) {\n return -1;\n }\n\n return elements.findIndex(\n (element) => element === targetElement || element.contains(targetElement),\n );\n};\n\ntype ListGroupNavigationParams = {\n event: KeyboardEvent<HTMLDivElement>;\n isCurrentListItemTarget: boolean;\n isInKeyboardNavigationGroup: boolean;\n listItemUuids?: string[];\n currentUuid: string;\n listGroupUuid?: string;\n updateActiveListItemUuid?: (uuid?: string) => void;\n};\n\ntype ListItemTabNavigationParams = ListGroupNavigationParams & {\n currentListItemElement: HTMLDivElement;\n targetElement: HTMLElement | null;\n};\n\ntype ListItemToggleKeyParams = {\n event: KeyboardEvent<HTMLDivElement>;\n isCurrentListItemTarget: boolean;\n isExpandable: boolean;\n isItemOpen: boolean;\n shouldEnableKeyboardHighlighting: boolean;\n toggleItem: VoidFunction;\n};\n\nconst getListItemElementByIndex = ({\n index,\n listItemUuids,\n listGroupUuid,\n}: {\n index: number;\n listItemUuids: string[];\n listGroupUuid?: string;\n}) => {\n const listItemUuid = listItemUuids[index];\n\n if (!listItemUuid || typeof listGroupUuid !== 'string') {\n return undefined;\n }\n\n return document.querySelector<HTMLDivElement>(\n `[data-uuid=\"${listGroupUuid}---${listItemUuid}\"]`,\n );\n};\n\nconst focusListItemByIndex = ({\n index,\n listItemUuids,\n listGroupUuid,\n updateActiveListItemUuid,\n}: {\n index: number;\n listItemUuids: string[];\n listGroupUuid?: string;\n updateActiveListItemUuid?: (uuid?: string) => void;\n}) => {\n const listItemUuid = listItemUuids[index];\n const listItemElement = getListItemElementByIndex({ index, listItemUuids, listGroupUuid });\n\n if (!listItemUuid || !listItemElement || typeof updateActiveListItemUuid !== 'function') {\n return false;\n }\n\n updateActiveListItemUuid(listItemUuid);\n listItemElement.focus();\n return true;\n};\n\nexport const handleHorizontalArrowNavigation = ({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n}: {\n event: KeyboardEvent<HTMLDivElement>;\n currentListItemElement: HTMLDivElement;\n targetElement: HTMLElement | null;\n isCurrentListItemTarget: boolean;\n}) => {\n if (event.key !== 'ArrowRight' && event.key !== 'ArrowLeft') {\n return false;\n }\n\n const focusableLeftElements = getFocusableElements(\n currentListItemElement,\n LEFT_ELEMENT_FOCUSABLE_SELECTOR,\n );\n\n const focusableRightElements = getFocusableElements(\n currentListItemElement,\n RIGHT_ELEMENT_FOCUSABLE_SELECTOR,\n );\n\n const focusedLeftElementIndex = getFocusedElementIndex(focusableLeftElements, targetElement);\n\n if (focusedLeftElementIndex !== -1) {\n event.preventDefault();\n\n if (event.key === 'ArrowLeft') {\n const previousLeftElement = focusableLeftElements[focusedLeftElementIndex - 1];\n\n if (previousLeftElement) {\n previousLeftElement.focus();\n } else {\n currentListItemElement.focus();\n }\n\n return true;\n }\n\n const nextLeftElement = focusableLeftElements[focusedLeftElementIndex + 1];\n\n if (nextLeftElement) {\n nextLeftElement.focus();\n } else if (focusableRightElements.length > 0) {\n focusableRightElements[0]?.focus();\n }\n\n return true;\n }\n\n const focusedRightElementIndex = getFocusedElementIndex(focusableRightElements, targetElement);\n\n if (focusedRightElementIndex !== -1) {\n event.preventDefault();\n\n if (event.key === 'ArrowRight') {\n focusableRightElements[focusedRightElementIndex + 1]?.focus();\n return true;\n }\n\n const previousRightElement = focusableRightElements[focusedRightElementIndex - 1];\n\n if (previousRightElement) {\n previousRightElement.focus();\n } else if (focusableLeftElements.length > 0) {\n focusableLeftElements[focusableLeftElements.length - 1]?.focus();\n } else {\n currentListItemElement.focus();\n }\n\n return true;\n }\n\n if (isCurrentListItemTarget) {\n if (event.key === 'ArrowLeft' && focusableLeftElements.length > 0) {\n event.preventDefault();\n focusableLeftElements[focusableLeftElements.length - 1]?.focus();\n return true;\n }\n }\n\n return false;\n};\n\nexport const handleListItemTabNavigation = ({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid,\n listGroupUuid,\n updateActiveListItemUuid,\n}: ListItemTabNavigationParams) => {\n if (event.key !== 'Tab' || !isInKeyboardNavigationGroup || !listItemUuids?.length) {\n return false;\n }\n\n const currentIndex = listItemUuids.indexOf(currentUuid);\n\n if (currentIndex === -1) {\n return false;\n }\n\n const focusableRightElements = getFocusableElements(\n currentListItemElement,\n RIGHT_ELEMENT_FOCUSABLE_SELECTOR,\n );\n const focusedRightElementIndex = getFocusedElementIndex(focusableRightElements, targetElement);\n\n if (event.shiftKey) {\n return false;\n }\n\n if (isCurrentListItemTarget) {\n if (focusableRightElements.length > 0) {\n event.preventDefault();\n focusableRightElements[0]?.focus();\n return true;\n }\n\n return false;\n }\n\n if (focusedRightElementIndex === -1) {\n return false;\n }\n\n const nextRightElement = focusableRightElements[focusedRightElementIndex + 1];\n\n if (nextRightElement) {\n event.preventDefault();\n nextRightElement.focus();\n return true;\n }\n\n if (currentIndex < listItemUuids.length - 1) {\n event.preventDefault();\n return focusListItemByIndex({\n index: currentIndex + 1,\n listItemUuids,\n listGroupUuid,\n updateActiveListItemUuid,\n });\n }\n\n return false;\n};\n\nexport const handleVerticalListGroupNavigation = ({\n event,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid,\n listGroupUuid,\n updateActiveListItemUuid,\n}: ListGroupNavigationParams) => {\n if (\n !isCurrentListItemTarget ||\n !isInKeyboardNavigationGroup ||\n !listItemUuids?.length ||\n (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')\n ) {\n return false;\n }\n\n const currentIndex = listItemUuids.indexOf(currentUuid);\n\n if (currentIndex === -1) {\n return true;\n }\n\n event.preventDefault();\n\n const isBackward = event.key === 'ArrowUp';\n\n const nextIndex = isBackward\n ? (currentIndex - 1 + listItemUuids.length) % listItemUuids.length\n : (currentIndex + 1) % listItemUuids.length;\n\n const nextListItemUuid = listItemUuids[nextIndex];\n\n if (\n nextListItemUuid &&\n nextListItemUuid !== currentUuid &&\n typeof listGroupUuid === 'string' &&\n typeof updateActiveListItemUuid === 'function'\n ) {\n const nextListItemElement = document.querySelector<HTMLDivElement>(\n `[data-uuid=\"${listGroupUuid}---${nextListItemUuid}\"]`,\n );\n\n if (nextListItemElement) {\n updateActiveListItemUuid(nextListItemUuid);\n nextListItemElement.focus();\n }\n }\n\n return true;\n};\n\nexport const handleListItemToggleKey = ({\n event,\n isCurrentListItemTarget,\n isExpandable,\n isItemOpen,\n shouldEnableKeyboardHighlighting,\n toggleItem,\n}: ListItemToggleKeyParams) => {\n if (!isCurrentListItemTarget || !shouldEnableKeyboardHighlighting) {\n return false;\n }\n\n const shouldOpen = isExpandable && event.key === 'ArrowRight' && !isItemOpen;\n const shouldClose = isExpandable && event.key === 'ArrowLeft' && isItemOpen;\n const shouldToggle = event.key === 'Enter' || event.key === ' ';\n\n if (!shouldOpen && !shouldClose && !shouldToggle) {\n return false;\n }\n\n event.preventDefault();\n toggleItem();\n return true;\n};\n"],"mappings":"AAAA,SACIA,QAAQ,EACRC,cAAc,QAIX,OAAO;AACd,SAASC,gBAAgB,QAAQ,4BAA4B;AAY7D,OAAO,MAAMC,uBAAuB,GAAIC,IAAe,IACnD,aAAAH,cAAc,CAACG,IAAI,CAAC,IAAKA,IAAI,CAACC,IAAI,CAA8BC,WAAW,KAAK,UAAU;AAE9F,OAAO,MAAMC,uBAAuB,GAAIH,IAAe,IACnD,aAAAH,cAAc,CAACG,IAAI,CAAC,IACpB,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAC5BD,IAAI,CAACC,IAAI,CAAwBG,UAAU,KAAKN,gBAAgB;AAErE,OAAO,MAAMO,yBAAyB,GAAIL,IAAe,IACrDJ,QAAQ,CAACU,OAAO,CAACN,IAAI,CAAC,CAACO,IAAI,CAAEC,KAAK,IAAK;EACnC,IAAIT,uBAAuB,CAACS,KAAK,CAAC,EAAE;IAChC,OAAOA,KAAK,CAACC,KAAK,CAACC,mBAAmB,KAAK,IAAI,IAAIF,KAAK,CAACC,KAAK,CAACE,QAAQ,KAAKC,SAAS;EACzF;EAEA,IAAIT,uBAAuB,CAACK,KAAK,CAAC,EAAE;IAChC,OAAOA,KAAK,CAACC,KAAK,CAACI,YAAY,KAAK,IAAI,IAAIL,KAAK,CAACC,KAAK,CAACC,mBAAmB,KAAK,IAAI;EACxF;EAEA,IAAI,aAAAb,cAAc,CAA2BW,KAAK,CAAC,IAAIA,KAAK,CAACC,KAAK,CAACE,QAAQ,KAAKC,SAAS,EAAE;IACvF,OAAOP,yBAAyB,CAACG,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC;EAC1D;E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EACpCxB,KAAK;EACLE,uBAAuB;EACvBjC,YAAY;EACZwD,UAAU;EACVC,gCAAgC;EAChCC;AACqB,CAAC,KAAK;EAC3B,IAAI,CAACzB,uBAAuB,IAAI,CAACwB,gCAAgC,EAAE;IAC/D,OAAO,KAAK;EAChB;EAEA,MAAME,UAAU,GAAG3D,YAAY,IAAI+B,KAAK,CAACG,GAAG,KAAK,YAAY,IAAI,CAACsB,UAAU;EAC5E,MAAMI,WAAW,GAAG5D,YAAY,IAAI+B,KAAK,CAACG,GAAG,KAAK,WAAW,IAAIsB,UAAU;EAC3E,MAAMK,YAAY,GAAG9B,KAAK,CAACG,GAAG,KAAK,OAAO,IAAIH,KAAK,CAACG,GAAG,KAAK,GAAG;EAE/D,IAAI,CAACyB,UAAU,IAAI,CAACC,WAAW,IAAI,CAACC,YAAY,EAAE;IAC9C,OAAO,KAAK;EAChB;EAEA9B,KAAK,CAACO,cAAc,CAAC,CAAC;EACtBoB,UAAU,CAAC,CAAC;EACZ,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
@@ -1,8 +1,10 @@
1
1
  import { AnimatePresence, motion } from 'motion/react';
2
2
  import React, { forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
3
+ import { useTheme } from 'styled-components';
3
4
  import { useUuid } from '../../../hooks/uuid';
4
5
  import { AccordionContext } from '../../accordion/Accordion';
5
6
  import AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';
7
+ import { useColorScheme } from '../../color-scheme-provider/ColorSchemeProvider';
6
8
  import { ListContext } from '../List';
7
9
  import { handleHorizontalArrowNavigation, handleListItemTabNavigation, handleListItemToggleKey, handleVerticalListGroupNavigation } from '../List.utils';
8
10
  import ListItemBody from './list-item-body/ListItemBody';
@@ -10,6 +12,7 @@ import ListItemHead from './list-item-head/ListItemHead';
10
12
  import { StyledListItem, StyledListItemTooltip } from './ListItem.styles';
11
13
  import Tooltip from '../../tooltip/Tooltip';
12
14
  import { useIsInsideDialog } from '../../../hooks/element';
15
+ import { useFocusRingPortal } from '../../../hooks/useFocusRingPortal';
13
16
  import { useKeyboardFocusHighlighting } from '../../../hooks/useKeyboardFocusHighlighting';
14
17
  import { useListItemFocus } from './useListItemFocus';
15
18
  const ListItem = /*#__PURE__*/forwardRef(({
@@ -67,7 +70,10 @@ const ListItem = /*#__PURE__*/forwardRef(({
67
70
  activeListItemUuid,
68
71
  updateActiveListItemUuid
69
72
  } = useContext(ListContext);
70
- const shouldEnableKeyboardHighlighting = shouldEnableKeyboardHighlightingProp ?? shouldEnableKeyboardHighlightingContext;
73
+ const colorScheme = useColorScheme();
74
+ const theme = useTheme();
75
+ const isInsideListContext = typeof listGroupUuid === 'string';
76
+ const shouldEnableKeyboardHighlighting = shouldEnableKeyboardHighlightingProp ?? (isInsideListContext ? shouldEnableKeyboardHighlightingContext : colorScheme?.shouldEnableKeyboardHighlighting ?? false);
71
77
  const {
72
78
  isWrapped: isParentAccordionWrapped
73
79
  } = useContext(AccordionContext);
@@ -131,6 +137,10 @@ const ListItem = /*#__PURE__*/forwardRef(({
131
137
  setTitleMaxWidth(maxWidth);
132
138
  }, []);
133
139
  const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting);
140
+ useFocusRingPortal(listItemRef, {
141
+ isEnabled: shouldShowKeyboardHighlighting,
142
+ borderRadius: `${theme.cardBorderRadius}px`
143
+ });
134
144
  const isInKeyboardNavigationGroup = shouldEnableKeyboardHighlighting && typeof listGroupUuid === 'string' && typeof updateActiveListItemUuid === 'function';
135
145
  useEffect(() => {
136
146
  if (shouldEnableKeyboardHighlighting && typeof registerListItemUuid === 'function' && typeof unregisterListItemUuid === 'function') {
@@ -188,6 +198,7 @@ const ListItem = /*#__PURE__*/forwardRef(({
188
198
  isInKeyboardNavigationGroup,
189
199
  updateActiveListItemUuid
190
200
  });
201
+ const shouldForceHoverItem = shouldForceHover || isFocusWithinListItem;
191
202
  useEffect(() => {
192
203
  if (isInKeyboardNavigationGroup && activeListItemUuid == null && typeof updateActiveListItemUuid === 'function' && listItemUuids?.[0] === uuid) {
193
204
  updateActiveListItemUuid(uuid);
@@ -254,7 +265,7 @@ const ListItem = /*#__PURE__*/forwardRef(({
254
265
  leftElements: leftElements,
255
266
  onClick: isClickable ? handleHeadClick : undefined,
256
267
  onLongPress: onLongPress,
257
- shouldForceHover: shouldForceHover,
268
+ shouldForceHover: shouldForceHoverItem,
258
269
  rightElements: rightElements,
259
270
  shouldHideImageOrIconBackground: shouldHideImageOrIconBackground,
260
271
  shouldHideIndicator: shouldHideIndicator,
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.js","names":["AnimatePresence","motion","React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","useUuid","AccordionContext","AreaContextProvider","AreaContext","ListContext","handleHorizontalArrowNavigation","handleListItemTabNavigation","handleListItemToggleKey","handleVerticalListGroupNavigation","ListItemBody","ListItemHead","StyledListItem","StyledListItemTooltip","Tooltip","useIsInsideDialog","useKeyboardFocusHighlighting","useListItemFocus","ListItem","backgroundColor","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","onImageError","onSizeChange","onTitleInputChange","titleElement","titleInputProps","shouldDisableAnimation","cornerElement","isSelected","shouldEnableKeyboardHighlighting","shouldEnableKeyboardHighlightingProp","ref","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","shouldEnableKeyboardHighlightingContext","listGroupUuid","listItemUuids","registerListItemUuid","unregisterListItemUuid","activeListItemUuid","updateActiveListItemUuid","isParentAccordionWrapped","areaProvider","isInitialRenderRef","listItemRef","isInDialog","uuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","titleWidth","setTitleWidth","titleMaxWidth","setTitleMaxWidth","current","handleHeadClick","event","shouldOnlyOpen","isClickable","handleTitleWidthChange","width","maxWidth","shouldShowKeyboardHighlighting","isInKeyboardNavigationGroup","tabIndex","handleKeyDown","isCurrentListItemTarget","currentTarget","target","currentListItemElement","targetElement","currentUuid","toggleItem","some","handleKey","isFocusWithinListItem","handleFocus","handleBlur","createElement","as","div","animate","height","opacity","className","exit","initial","key","layout","$backgroundColor","$isClickable","$isInAccordion","shouldDisableListItemPadding","$isOpen","$isWrapped","$isInDialog","$isSelected","$shouldChangeColor","shouldChangeColor","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","onKeyDown","onFocus","onBlur","shouldUseFullWidth","isDisabled","item","style","cursor","onTitleWidthChange","id","shouldHideBody","displayName"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence, motion } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n KeyboardEvent,\n MouseEventHandler,\n ReactNode,\n SyntheticEvent,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport type { InputProps } from '../../input/Input';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { ListContext } from '../List';\nimport {\n handleHorizontalArrowNavigation,\n handleListItemTabNavigation,\n handleListItemToggleKey,\n handleVerticalListGroupNavigation,\n} from '../List.utils';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItem, StyledListItemTooltip } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\nimport { useIsInsideDialog } from '../../../hooks/element';\nimport { useKeyboardFocusHighlighting } from '../../../hooks/useKeyboardFocusHighlighting';\nimport { useListItemFocus } from './useListItemFocus';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport interface ListItemSize {\n titleWidth: number;\n titleMaxWidth: number;\n}\n\nexport type ListItemProps = {\n /**\n * The background color of the `ListItem`.\n */\n backgroundColor?: CSSProperties['backgroundColor'];\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Whether the item is selected.\n */\n isSelected?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n /**\n * Whether the ListItem Animation should be disabled.\n */\n shouldDisableAnimation?: boolean;\n /**\n * Optional Element to display in the right corner of the image\n */\n cornerElement?: ReactNode;\n /**\n * Optional handler for image load errors.\n */\n onImageError?: (event: SyntheticEvent<HTMLImageElement, Event>, index: number) => void;\n /**\n * Function to be executed if the size are changed.\n */\n onSizeChange?: (sizes: ListItemSize) => void;\n /**\n * Enables keyboard-only focus highlighting. Overrides the value from the List context.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Function that is executed when the text of the title input changes.\n * When this function is given, the title is displayed as an input.\n */\n onTitleInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * The props of the title input.\n */\n titleInputProps?: InputProps;\n};\n\nexport type ListItemRef = ListItemSize;\n\nconst ListItem = forwardRef<ListItemRef, ListItemProps>(\n (\n {\n backgroundColor,\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n onImageError,\n onSizeChange,\n onTitleInputChange,\n titleElement,\n titleInputProps,\n shouldDisableAnimation = false,\n cornerElement,\n isSelected = false,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingProp,\n },\n ref,\n ) => {\n const {\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingContext,\n listGroupUuid,\n listItemUuids,\n registerListItemUuid,\n unregisterListItemUuid,\n activeListItemUuid,\n updateActiveListItemUuid,\n } = useContext(ListContext);\n\n const shouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlightingProp ?? shouldEnableKeyboardHighlightingContext;\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const listItemRef = useRef<HTMLDivElement>(null);\n\n const isInDialog = useIsInsideDialog<HTMLDivElement>(listItemRef);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n const [titleWidth, setTitleWidth] = useState(0);\n const [titleMaxWidth, setTitleMaxWidth] = useState(0);\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n useEffect(() => {\n if (typeof onSizeChange === 'function') {\n onSizeChange({\n titleWidth,\n titleMaxWidth,\n });\n }\n }, [onSizeChange, titleMaxWidth, titleWidth]);\n\n useImperativeHandle(\n ref,\n () => ({\n titleWidth,\n titleMaxWidth,\n }),\n [titleMaxWidth, titleWidth],\n );\n\n const handleTitleWidthChange = useCallback((width: number, maxWidth: number) => {\n setTitleWidth(width);\n setTitleMaxWidth(maxWidth);\n }, []);\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n\n const isInKeyboardNavigationGroup =\n shouldEnableKeyboardHighlighting &&\n typeof listGroupUuid === 'string' &&\n typeof updateActiveListItemUuid === 'function';\n\n useEffect(() => {\n if (\n shouldEnableKeyboardHighlighting &&\n typeof registerListItemUuid === 'function' &&\n typeof unregisterListItemUuid === 'function'\n ) {\n registerListItemUuid(uuid);\n\n return () => {\n unregisterListItemUuid(uuid);\n };\n }\n\n return undefined;\n }, [shouldEnableKeyboardHighlighting, registerListItemUuid, unregisterListItemUuid, uuid]);\n\n const tabIndex = useMemo(\n () => (shouldEnableKeyboardHighlighting ? 0 : -1),\n [shouldEnableKeyboardHighlighting],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const isCurrentListItemTarget = event.currentTarget === event.target;\n const currentListItemElement = event.currentTarget as HTMLDivElement;\n const targetElement = event.target as HTMLElement | null;\n\n [\n () =>\n shouldEnableKeyboardHighlighting &&\n handleHorizontalArrowNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n }),\n () =>\n handleListItemTabNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleVerticalListGroupNavigation({\n event,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleListItemToggleKey({\n event,\n isCurrentListItemTarget,\n isExpandable,\n isItemOpen,\n shouldEnableKeyboardHighlighting,\n toggleItem: () =>\n handleHeadClick(\n event as unknown as React.MouseEvent<HTMLDivElement>,\n ),\n }),\n ].some((handleKey) => handleKey());\n },\n [\n handleHeadClick,\n isExpandable,\n isInKeyboardNavigationGroup,\n isItemOpen,\n listGroupUuid,\n listItemUuids,\n shouldEnableKeyboardHighlighting,\n updateActiveListItemUuid,\n uuid,\n ],\n );\n\n const { isFocusWithinListItem, handleFocus, handleBlur } = useListItemFocus({\n uuid,\n listGroupUuid,\n isInKeyboardNavigationGroup,\n updateActiveListItemUuid,\n });\n\n useEffect(() => {\n if (\n isInKeyboardNavigationGroup &&\n activeListItemUuid == null &&\n typeof updateActiveListItemUuid === 'function' &&\n listItemUuids?.[0] === uuid\n ) {\n updateActiveListItemUuid(uuid);\n }\n }, [\n activeListItemUuid,\n isInKeyboardNavigationGroup,\n listItemUuids,\n updateActiveListItemUuid,\n uuid,\n ]);\n\n return (\n <StyledListItem\n as={shouldDisableAnimation ? undefined : motion.div}\n animate={shouldDisableAnimation ? undefined : { height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n initial={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n data-uuid={`${listGroupUuid ?? ''}---${uuid}`}\n layout={\n shouldPreventLayoutAnimation || shouldDisableAnimation ? undefined : 'position'\n }\n $backgroundColor={backgroundColor}\n $isClickable={isClickable}\n $isInAccordion={\n typeof isParentAccordionWrapped === 'boolean' &&\n !areaProvider.shouldDisableListItemPadding\n }\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $isInDialog={isInDialog}\n $isSelected={isSelected}\n $shouldChangeColor={areaProvider.shouldChangeColor}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n data-should-show-keyboard-highlighting={\n shouldShowKeyboardHighlighting ? 'true' : undefined\n }\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerElement={cornerElement}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHover}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n onTitleInputChange={onTitleInputChange}\n onTitleWidthChange={handleTitleWidthChange}\n titleInputProps={titleInputProps}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n shouldDisableAnimation={shouldDisableAnimation}\n onImageError={onImageError}\n />\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledListItem>\n );\n },\n);\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,MAAM,QAAQ,cAAc;AACtD,OAAOC,KAAK,IAGRC,UAAU,EAMVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC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eAAgB;IACjCD,YAAY,EAAEA,YAAa;IAC3B+B,sBAAsB,EAAEA,sBAAuB;IAC/C7B,sBAAsB,EAAEA,sBAAuB;IAC/CL,YAAY,EAAEA;EAAa,CAC9B,CACI,CAAC,eACV1D,KAAA,CAAAyH,aAAA,CAAC3H,eAAe;IAACmI,OAAO,EAAE;EAAM,GAC3B3C,YAAY,KAAKE,UAAU,IAAInC,kBAAkB,CAAC,iBAC/CrD,KAAA,CAAAyH,aAAA,CAACvG,YAAY;IACT0I,EAAE,EAAEvE,IAAK;IACT6C,GAAG,EAAE,gBAAgB7C,IAAI,EAAG;IAC5BwE,cAAc,EAAExG,kBAAkB,IAAI,CAACmC;EAAW,gBAElDxF,KAAA,CAAAyH,aAAA,CAAC9G,mBAAmB,QAAEkB,QAA8B,CAC1C,CAEL,CACL,CAAC;AAEzB,CACJ,CAAC;AAEDH,QAAQ,CAACoI,WAAW,GAAG,UAAU;AAEjC,eAAepI,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"ListItem.js","names":["AnimatePresence","motion","React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","useTheme","useUuid","AccordionContext","AreaContextProvider","AreaContext","useColorScheme","ListContext","handleHorizontalArrowNavigation","handleListItemTabNavigation","handleListItemToggleKey","handleVerticalListGroupNavigation","ListItemBody","ListItemHead","StyledListItem","StyledListItemTooltip","Tooltip","useIsInsideDialog","useFocusRingPortal","useKeyboardFocusHighlighting","useListItemFocus","ListItem","backgroundColor","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","onImageError","onSizeChange","onTitleInputChange","titleElement","titleInputProps","shouldDisableAnimation","cornerElement","isSelected","shouldEnableKeyboardHighlighting","shouldEnableKeyboardHighlightingProp","ref","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","shouldEnableKeyboardHighlightingContext","listGroupUuid","listItemUuids","registerListItemUuid","unregisterListItemUuid","activeListItemUuid","updateActiveListItemUuid","colorScheme","theme","isInsideListContext","isParentAccordionWrapped","areaProvider","isInitialRenderRef","listItemRef","isInDialog","uuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","titleWidth","setTitleWidth","titleMaxWidth","setTitleMaxWidth","current","handleHeadClick","event","shouldOnlyOpen","isClickable","handleTitleWidthChange","width","maxWidth","shouldShowKeyboardHighlighting","isEnabled","borderRadius","cardBorderRadius","isInKeyboardNavigationGroup","tabIndex","handleKeyDown","isCurrentListItemTarget","currentTarget","target","currentListItemElement","targetElement","currentUuid","toggleItem","some","handleKey","isFocusWithinListItem","handleFocus","handleBlur","shouldForceHoverItem","createElement","as","div","animate","height","opacity","className","exit","initial","key","layout","$backgroundColor","$isClickable","$isInAccordion","shouldDisableListItemPadding","$isOpen","$isWrapped","$isInDialog","$isSelected","$shouldChangeColor","shouldChangeColor","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","onKeyDown","onFocus","onBlur","shouldUseFullWidth","isDisabled","item","style","cursor","onTitleWidthChange","id","shouldHideBody","displayName"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence, motion } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n KeyboardEvent,\n MouseEventHandler,\n ReactNode,\n SyntheticEvent,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport type { InputProps } from '../../input/Input';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { type Theme, useColorScheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { ListContext } from '../List';\nimport {\n handleHorizontalArrowNavigation,\n handleListItemTabNavigation,\n handleListItemToggleKey,\n handleVerticalListGroupNavigation,\n} from '../List.utils';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItem, StyledListItemTooltip } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\nimport { useIsInsideDialog } from '../../../hooks/element';\nimport { useFocusRingPortal } from '../../../hooks/useFocusRingPortal';\nimport { useKeyboardFocusHighlighting } from '../../../hooks/useKeyboardFocusHighlighting';\nimport { useListItemFocus } from './useListItemFocus';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport interface ListItemSize {\n titleWidth: number;\n titleMaxWidth: number;\n}\n\nexport type ListItemProps = {\n /**\n * The background color of the `ListItem`.\n */\n backgroundColor?: CSSProperties['backgroundColor'];\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Whether the item is selected.\n */\n isSelected?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n /**\n * Whether the ListItem Animation should be disabled.\n */\n shouldDisableAnimation?: boolean;\n /**\n * Optional Element to display in the right corner of the image\n */\n cornerElement?: ReactNode;\n /**\n * Optional handler for image load errors.\n */\n onImageError?: (event: SyntheticEvent<HTMLImageElement, Event>, index: number) => void;\n /**\n * Function to be executed if the size are changed.\n */\n onSizeChange?: (sizes: ListItemSize) => void;\n /**\n * Enables keyboard-only focus highlighting. Overrides the value from the List context.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Function that is executed when the text of the title input changes.\n * When this function is given, the title is displayed as an input.\n */\n onTitleInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * The props of the title input.\n */\n titleInputProps?: InputProps;\n};\n\nexport type ListItemRef = ListItemSize;\n\nconst ListItem = forwardRef<ListItemRef, ListItemProps>(\n (\n {\n backgroundColor,\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n onImageError,\n onSizeChange,\n onTitleInputChange,\n titleElement,\n titleInputProps,\n shouldDisableAnimation = false,\n cornerElement,\n isSelected = false,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingProp,\n },\n ref,\n ) => {\n const {\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingContext,\n listGroupUuid,\n listItemUuids,\n registerListItemUuid,\n unregisterListItemUuid,\n activeListItemUuid,\n updateActiveListItemUuid,\n } = useContext(ListContext);\n const colorScheme = useColorScheme();\n const theme = useTheme() as Theme;\n const isInsideListContext = typeof listGroupUuid === 'string';\n\n const shouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlightingProp ??\n (isInsideListContext\n ? shouldEnableKeyboardHighlightingContext\n : (colorScheme?.shouldEnableKeyboardHighlighting ?? false));\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const listItemRef = useRef<HTMLDivElement>(null);\n\n const isInDialog = useIsInsideDialog<HTMLDivElement>(listItemRef);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n const [titleWidth, setTitleWidth] = useState(0);\n const [titleMaxWidth, setTitleMaxWidth] = useState(0);\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n useEffect(() => {\n if (typeof onSizeChange === 'function') {\n onSizeChange({\n titleWidth,\n titleMaxWidth,\n });\n }\n }, [onSizeChange, titleMaxWidth, titleWidth]);\n\n useImperativeHandle(\n ref,\n () => ({\n titleWidth,\n titleMaxWidth,\n }),\n [titleMaxWidth, titleWidth],\n );\n\n const handleTitleWidthChange = useCallback((width: number, maxWidth: number) => {\n setTitleWidth(width);\n setTitleMaxWidth(maxWidth);\n }, []);\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(listItemRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n borderRadius: `${theme.cardBorderRadius}px`,\n });\n\n const isInKeyboardNavigationGroup =\n shouldEnableKeyboardHighlighting &&\n typeof listGroupUuid === 'string' &&\n typeof updateActiveListItemUuid === 'function';\n\n useEffect(() => {\n if (\n shouldEnableKeyboardHighlighting &&\n typeof registerListItemUuid === 'function' &&\n typeof unregisterListItemUuid === 'function'\n ) {\n registerListItemUuid(uuid);\n\n return () => {\n unregisterListItemUuid(uuid);\n };\n }\n\n return undefined;\n }, [shouldEnableKeyboardHighlighting, registerListItemUuid, unregisterListItemUuid, uuid]);\n\n const tabIndex = useMemo(\n () => (shouldEnableKeyboardHighlighting ? 0 : -1),\n [shouldEnableKeyboardHighlighting],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const isCurrentListItemTarget = event.currentTarget === event.target;\n const currentListItemElement = event.currentTarget as HTMLDivElement;\n const targetElement = event.target as HTMLElement | null;\n\n [\n () =>\n shouldEnableKeyboardHighlighting &&\n handleHorizontalArrowNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n }),\n () =>\n handleListItemTabNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleVerticalListGroupNavigation({\n event,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleListItemToggleKey({\n event,\n isCurrentListItemTarget,\n isExpandable,\n isItemOpen,\n shouldEnableKeyboardHighlighting,\n toggleItem: () =>\n handleHeadClick(\n event as unknown as React.MouseEvent<HTMLDivElement>,\n ),\n }),\n ].some((handleKey) => handleKey());\n },\n [\n handleHeadClick,\n isExpandable,\n isInKeyboardNavigationGroup,\n isItemOpen,\n listGroupUuid,\n listItemUuids,\n shouldEnableKeyboardHighlighting,\n updateActiveListItemUuid,\n uuid,\n ],\n );\n\n const { isFocusWithinListItem, handleFocus, handleBlur } = useListItemFocus({\n uuid,\n listGroupUuid,\n isInKeyboardNavigationGroup,\n updateActiveListItemUuid,\n });\n const shouldForceHoverItem = shouldForceHover || isFocusWithinListItem;\n\n useEffect(() => {\n if (\n isInKeyboardNavigationGroup &&\n activeListItemUuid == null &&\n typeof updateActiveListItemUuid === 'function' &&\n listItemUuids?.[0] === uuid\n ) {\n updateActiveListItemUuid(uuid);\n }\n }, [\n activeListItemUuid,\n isInKeyboardNavigationGroup,\n listItemUuids,\n updateActiveListItemUuid,\n uuid,\n ]);\n\n return (\n <StyledListItem\n as={shouldDisableAnimation ? undefined : motion.div}\n animate={shouldDisableAnimation ? undefined : { height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n initial={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n data-uuid={`${listGroupUuid ?? ''}---${uuid}`}\n layout={\n shouldPreventLayoutAnimation || shouldDisableAnimation ? undefined : 'position'\n }\n $backgroundColor={backgroundColor}\n $isClickable={isClickable}\n $isInAccordion={\n typeof isParentAccordionWrapped === 'boolean' &&\n !areaProvider.shouldDisableListItemPadding\n }\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $isInDialog={isInDialog}\n $isSelected={isSelected}\n $shouldChangeColor={areaProvider.shouldChangeColor}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n data-should-show-keyboard-highlighting={\n shouldShowKeyboardHighlighting ? 'true' : undefined\n }\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerElement={cornerElement}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHoverItem}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n onTitleInputChange={onTitleInputChange}\n onTitleWidthChange={handleTitleWidthChange}\n titleInputProps={titleInputProps}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n shouldDisableAnimation={shouldDisableAnimation}\n onImageError={onImageError}\n />\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledListItem>\n );\n },\n);\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,MAAM,QAAQ,cAAc;AACtD,OAAOC,KAAK,IAGRC,UAAU,EAMVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,OAAO,QAAQ,qBAAqB;AAG7C,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,mBAAmB,IAAIC,WAAW,QAAQ,yCAAyC;AAC1F,SAAqBC,cAAc,QAAQ,iDAAiD;AAC5F,SAASC,WAAW,QAAQ,SAAS;AACrC,SACIC,+BAA+B,EAC/BC,2BAA2B,EAC3BC,uBAAuB,EACvBC,iCAAiC,QAC9B,eAAe;AACtB,OAAOC,YAAY,MAAM,+BAA+B;AACxD,OAAOC,YAAY,MAAM,+BAA+B;AACxD,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,mBAAmB;AACzE,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,SAASC,iBAAiB,QAAQ,wBAAw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AC3BkC,sBAAsB,EAAEA,sBAAuB;IAC/ChC,sBAAsB,EAAEA,sBAAuB;IAC/CL,YAAY,EAAEA;EAAa,CAC9B,CACI,CAAC,eACV7D,KAAA,CAAAmI,aAAA,CAACrI,eAAe;IAAC6I,OAAO,EAAE;EAAM,GAC3B/C,YAAY,KAAKE,UAAU,IAAItC,kBAAkB,CAAC,iBAC/CxD,KAAA,CAAAmI,aAAA,CAAC/G,YAAY;IACTkJ,EAAE,EAAE3E,IAAK;IACTiD,GAAG,EAAE,gBAAgBjD,IAAI,EAAG;IAC5B4E,cAAc,EAAE/G,kBAAkB,IAAI,CAACsC;EAAW,gBAElD9F,KAAA,CAAAmI,aAAA,CAACvH,mBAAmB,QAAEoB,QAA8B,CAC1C,CAEL,CACL,CAAC;AAEzB,CACJ,CAAC;AAEDH,QAAQ,CAAC2I,WAAW,GAAG,UAAU;AAEjC,eAAe3I,QAAQ","ignoreList":[]}
@@ -1,5 +1,4 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { keyboardFocusHighlightingRingCss } from '../../../utils/keyboardFocusHighlighting.styles';
3
2
  export const StyledListItem = styled.div`
4
3
  overflow: hidden;
5
4
  transition: background-color 0.3s ease;
@@ -84,8 +83,16 @@ export const StyledListItem = styled.div`
84
83
 
85
84
  &[data-should-show-keyboard-highlighting='true']:focus-visible {
86
85
  transition: none;
87
- ${keyboardFocusHighlightingRingCss};
86
+ outline: none;
88
87
  overflow: visible;
88
+ position: relative;
89
+ z-index: 5;
90
+ }
91
+
92
+ &[data-should-show-keyboard-highlighting='true']:focus-within {
93
+ overflow: visible;
94
+ position: relative;
95
+ z-index: 5;
89
96
  }
90
97
  `;
91
98
  export const StyledListItemTooltip = styled.div`