@chayns-components/core 5.4.13-alpha.0 → 5.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/AGENTS.md +0 -12
  2. package/lib/cjs/components/accordion/Accordion.js +12 -107
  3. package/lib/cjs/components/accordion/Accordion.js.map +1 -1
  4. package/lib/cjs/components/accordion/Accordion.styles.js +3 -23
  5. package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
  6. package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js +1 -3
  7. package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  8. package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js +19 -36
  9. package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  10. package/lib/cjs/components/accordion/accordion-head/AccordionHead.js +3 -6
  11. package/lib/cjs/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  12. package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js +0 -14
  13. package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  14. package/lib/cjs/components/amount-control/AmountControl.js +17 -31
  15. package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
  16. package/lib/cjs/components/amount-control/AmountControl.styles.js +2 -18
  17. package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
  18. package/lib/cjs/components/button/Button.js +1 -5
  19. package/lib/cjs/components/button/Button.js.map +1 -1
  20. package/lib/cjs/components/button/Button.styles.js +0 -10
  21. package/lib/cjs/components/button/Button.styles.js.map +1 -1
  22. package/lib/cjs/components/button/Button.types.js.map +1 -1
  23. package/lib/cjs/components/checkbox/Checkbox.js +1 -5
  24. package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
  25. package/lib/cjs/components/checkbox/Checkbox.styles.js +2 -29
  26. package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
  27. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +2 -7
  28. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  29. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +2 -8
  30. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  31. package/lib/cjs/components/combobox/ComboBox.js +11 -68
  32. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  33. package/lib/cjs/components/combobox/ComboBox.styles.js +0 -11
  34. package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
  35. package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -1
  36. package/lib/cjs/components/context-menu/ContextMenu.js +42 -146
  37. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  38. package/lib/cjs/components/context-menu/ContextMenu.styles.js +0 -38
  39. package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
  40. package/lib/cjs/components/context-menu/ContextMenu.types.js.map +1 -1
  41. package/lib/cjs/components/context-menu/ContextMenu.utils.js +1 -27
  42. package/lib/cjs/components/context-menu/ContextMenu.utils.js.map +1 -1
  43. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js +8 -3
  44. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  45. package/lib/cjs/components/file-input/FileInput.js +2 -4
  46. package/lib/cjs/components/file-input/FileInput.js.map +1 -1
  47. package/lib/cjs/components/file-list/file-item/FileItem.js +25 -48
  48. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  49. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +1 -25
  50. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  51. package/lib/cjs/components/file-select/FileSelect.js +4 -27
  52. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  53. package/lib/cjs/components/file-select/FileSelect.styles.js +0 -10
  54. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  55. package/lib/cjs/components/filter/Filter.js +16 -51
  56. package/lib/cjs/components/filter/Filter.js.map +1 -1
  57. package/lib/cjs/components/filter/Filter.styles.js +0 -9
  58. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  59. package/lib/cjs/components/filter/filter-content/FilterContent.js +5 -14
  60. package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
  61. package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -1
  62. package/lib/cjs/components/filter-buttons/FilterButtons.js +4 -69
  63. package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
  64. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +2 -40
  65. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  66. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +0 -11
  67. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  68. package/lib/cjs/components/grid-image/GridImage.js +2 -20
  69. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  70. package/lib/cjs/components/grid-image/GridImage.styles.js +2 -11
  71. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  72. package/lib/cjs/components/grouped-image/GroupedImage.js +4 -23
  73. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  74. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +0 -9
  75. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  76. package/lib/cjs/components/highlight-slider/HighlightSlider.js +3 -13
  77. package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
  78. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +4 -21
  79. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  80. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +2 -11
  81. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  82. package/lib/cjs/components/icon/Icon.js +5 -24
  83. package/lib/cjs/components/icon/Icon.js.map +1 -1
  84. package/lib/cjs/components/icon/Icon.styles.js +0 -23
  85. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  86. package/lib/cjs/components/input/Input.js +8 -29
  87. package/lib/cjs/components/input/Input.js.map +1 -1
  88. package/lib/cjs/components/input/Input.styles.js +3 -38
  89. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  90. package/lib/cjs/components/list/List.js +37 -124
  91. package/lib/cjs/components/list/List.js.map +1 -1
  92. package/lib/cjs/components/list/List.utils.js +1 -213
  93. package/lib/cjs/components/list/List.utils.js.map +1 -1
  94. package/lib/cjs/components/list/list-item/ListItem.js +3 -84
  95. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  96. package/lib/cjs/components/list/list-item/ListItem.styles.js +0 -7
  97. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  98. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +1 -5
  99. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  100. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js +1 -5
  101. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  102. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +0 -1
  103. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  104. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +0 -3
  105. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  106. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +0 -1
  107. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  108. package/lib/cjs/components/mention-finder/MentionFinder.js +5 -43
  109. package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
  110. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  111. package/lib/cjs/components/multi-action-button/MultiActionButton.js +3 -36
  112. package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
  113. package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js +0 -6
  114. package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
  115. package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  116. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +1 -7
  117. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  118. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +0 -12
  119. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  120. package/lib/cjs/components/number-input/NumberInput.js +10 -13
  121. package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
  122. package/lib/cjs/components/page-provider/PageProvider.js +3 -5
  123. package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
  124. package/lib/cjs/components/popup/Popup.js +1 -8
  125. package/lib/cjs/components/popup/Popup.js.map +1 -1
  126. package/lib/cjs/components/radio-button/RadioButton.js +15 -29
  127. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  128. package/lib/cjs/components/radio-button/RadioButton.styles.js +8 -19
  129. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  130. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +4 -7
  131. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  132. package/lib/cjs/components/search-box/SearchBox.js +6 -21
  133. package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
  134. package/lib/cjs/components/search-input/SearchInput.js +43 -56
  135. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  136. package/lib/cjs/components/search-input/SearchInput.styles.js +2 -26
  137. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  138. package/lib/cjs/components/select-button/SelectButton.js +2 -4
  139. package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
  140. package/lib/cjs/components/setup-wizard/SetupWizard.js +4 -10
  141. package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
  142. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +3 -5
  143. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  144. package/lib/cjs/components/sharing-bar/SharingBar.js +6 -31
  145. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  146. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +0 -5
  147. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  148. package/lib/cjs/components/sharing-button/SharingButton.js +2 -4
  149. package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
  150. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +1 -3
  151. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  152. package/lib/cjs/components/signature/Signature.js +3 -6
  153. package/lib/cjs/components/signature/Signature.js.map +1 -1
  154. package/lib/cjs/components/slider/Slider.js +7 -30
  155. package/lib/cjs/components/slider/Slider.js.map +1 -1
  156. package/lib/cjs/components/slider/Slider.styles.js +2 -9
  157. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  158. package/lib/cjs/components/slider-button/SliderButton.js +6 -63
  159. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  160. package/lib/cjs/components/slider-button/SliderButton.styles.js +2 -15
  161. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  162. package/lib/cjs/components/tag-input/TagInput.js +36 -92
  163. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  164. package/lib/cjs/components/tag-input/TagInput.styles.js +3 -29
  165. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  166. package/lib/cjs/components/text-area/TextArea.js +8 -17
  167. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  168. package/lib/cjs/components/text-area/TextArea.styles.js +1 -15
  169. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  170. package/lib/cjs/components/truncation/Truncation.js +3 -17
  171. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  172. package/lib/cjs/components/truncation/Truncation.styles.js +1 -18
  173. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  174. package/lib/cjs/utils/file.js.map +1 -1
  175. package/lib/esm/components/accordion/Accordion.js +12 -105
  176. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  177. package/lib/esm/components/accordion/Accordion.styles.js +3 -23
  178. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  179. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +1 -3
  180. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  181. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +19 -33
  182. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  183. package/lib/esm/components/accordion/accordion-head/AccordionHead.js +3 -6
  184. package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  185. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +0 -14
  186. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  187. package/lib/esm/components/amount-control/AmountControl.js +16 -30
  188. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  189. package/lib/esm/components/amount-control/AmountControl.styles.js +2 -18
  190. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  191. package/lib/esm/components/button/Button.js +1 -5
  192. package/lib/esm/components/button/Button.js.map +1 -1
  193. package/lib/esm/components/button/Button.styles.js +0 -10
  194. package/lib/esm/components/button/Button.styles.js.map +1 -1
  195. package/lib/esm/components/button/Button.types.js.map +1 -1
  196. package/lib/esm/components/checkbox/Checkbox.js +1 -5
  197. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  198. package/lib/esm/components/checkbox/Checkbox.styles.js +2 -29
  199. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  200. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +2 -7
  201. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  202. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +2 -8
  203. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  204. package/lib/esm/components/combobox/ComboBox.js +7 -61
  205. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  206. package/lib/esm/components/combobox/ComboBox.styles.js +0 -11
  207. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  208. package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
  209. package/lib/esm/components/context-menu/ContextMenu.js +42 -145
  210. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  211. package/lib/esm/components/context-menu/ContextMenu.styles.js +0 -38
  212. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  213. package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
  214. package/lib/esm/components/context-menu/ContextMenu.utils.js +0 -24
  215. package/lib/esm/components/context-menu/ContextMenu.utils.js.map +1 -1
  216. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js +8 -3
  217. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  218. package/lib/esm/components/file-input/FileInput.js +2 -4
  219. package/lib/esm/components/file-input/FileInput.js.map +1 -1
  220. package/lib/esm/components/file-list/file-item/FileItem.js +26 -49
  221. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  222. package/lib/esm/components/file-list/file-item/FileItem.styles.js +0 -24
  223. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  224. package/lib/esm/components/file-select/FileSelect.js +4 -27
  225. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  226. package/lib/esm/components/file-select/FileSelect.styles.js +0 -10
  227. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  228. package/lib/esm/components/filter/Filter.js +16 -52
  229. package/lib/esm/components/filter/Filter.js.map +1 -1
  230. package/lib/esm/components/filter/Filter.styles.js +0 -9
  231. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  232. package/lib/esm/components/filter/filter-content/FilterContent.js +5 -15
  233. package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
  234. package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -1
  235. package/lib/esm/components/filter-buttons/FilterButtons.js +5 -69
  236. package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
  237. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +2 -40
  238. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  239. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +0 -11
  240. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  241. package/lib/esm/components/grid-image/GridImage.js +2 -20
  242. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  243. package/lib/esm/components/grid-image/GridImage.styles.js +1 -10
  244. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  245. package/lib/esm/components/grouped-image/GroupedImage.js +4 -22
  246. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  247. package/lib/esm/components/grouped-image/GroupedImage.styles.js +0 -9
  248. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  249. package/lib/esm/components/highlight-slider/HighlightSlider.js +3 -13
  250. package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
  251. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +3 -20
  252. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  253. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +1 -10
  254. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  255. package/lib/esm/components/icon/Icon.js +7 -26
  256. package/lib/esm/components/icon/Icon.js.map +1 -1
  257. package/lib/esm/components/icon/Icon.styles.js +0 -23
  258. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  259. package/lib/esm/components/input/Input.js +4 -24
  260. package/lib/esm/components/input/Input.js.map +1 -1
  261. package/lib/esm/components/input/Input.styles.js +3 -38
  262. package/lib/esm/components/input/Input.styles.js.map +1 -1
  263. package/lib/esm/components/list/List.js +37 -123
  264. package/lib/esm/components/list/List.js.map +1 -1
  265. package/lib/esm/components/list/List.utils.js +0 -202
  266. package/lib/esm/components/list/List.utils.js.map +1 -1
  267. package/lib/esm/components/list/list-item/ListItem.js +4 -85
  268. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  269. package/lib/esm/components/list/list-item/ListItem.styles.js +0 -7
  270. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  271. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +2 -6
  272. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  273. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js +0 -4
  274. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  275. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +0 -1
  276. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  277. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +1 -4
  278. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  279. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +0 -1
  280. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  281. package/lib/esm/components/mention-finder/MentionFinder.js +3 -39
  282. package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
  283. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  284. package/lib/esm/components/multi-action-button/MultiActionButton.js +3 -36
  285. package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
  286. package/lib/esm/components/multi-action-button/MultiActionButton.styles.js +0 -6
  287. package/lib/esm/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
  288. package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  289. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +1 -7
  290. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  291. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +0 -12
  292. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  293. package/lib/esm/components/number-input/NumberInput.js +10 -13
  294. package/lib/esm/components/number-input/NumberInput.js.map +1 -1
  295. package/lib/esm/components/page-provider/PageProvider.js +3 -5
  296. package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
  297. package/lib/esm/components/popup/Popup.js +1 -8
  298. package/lib/esm/components/popup/Popup.js.map +1 -1
  299. package/lib/esm/components/radio-button/RadioButton.js +15 -29
  300. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  301. package/lib/esm/components/radio-button/RadioButton.styles.js +8 -19
  302. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  303. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +4 -7
  304. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  305. package/lib/esm/components/search-box/SearchBox.js +4 -18
  306. package/lib/esm/components/search-box/SearchBox.js.map +1 -1
  307. package/lib/esm/components/search-input/SearchInput.js +44 -56
  308. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  309. package/lib/esm/components/search-input/SearchInput.styles.js +1 -25
  310. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  311. package/lib/esm/components/select-button/SelectButton.js +2 -4
  312. package/lib/esm/components/select-button/SelectButton.js.map +1 -1
  313. package/lib/esm/components/setup-wizard/SetupWizard.js +4 -10
  314. package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
  315. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +3 -5
  316. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  317. package/lib/esm/components/sharing-bar/SharingBar.js +5 -30
  318. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  319. package/lib/esm/components/sharing-bar/SharingBar.styles.js +0 -5
  320. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  321. package/lib/esm/components/sharing-button/SharingButton.js +2 -4
  322. package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
  323. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +1 -3
  324. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  325. package/lib/esm/components/signature/Signature.js +3 -6
  326. package/lib/esm/components/signature/Signature.js.map +1 -1
  327. package/lib/esm/components/slider/Slider.js +7 -30
  328. package/lib/esm/components/slider/Slider.js.map +1 -1
  329. package/lib/esm/components/slider/Slider.styles.js +1 -8
  330. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  331. package/lib/esm/components/slider-button/SliderButton.js +6 -62
  332. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  333. package/lib/esm/components/slider-button/SliderButton.styles.js +1 -14
  334. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  335. package/lib/esm/components/tag-input/TagInput.js +35 -86
  336. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  337. package/lib/esm/components/tag-input/TagInput.styles.js +1 -27
  338. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  339. package/lib/esm/components/text-area/TextArea.js +9 -18
  340. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  341. package/lib/esm/components/text-area/TextArea.styles.js +0 -14
  342. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  343. package/lib/esm/components/truncation/Truncation.js +4 -18
  344. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  345. package/lib/esm/components/truncation/Truncation.styles.js +0 -17
  346. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  347. package/lib/esm/utils/file.js.map +1 -1
  348. package/lib/types/components/accordion/Accordion.d.ts +0 -5
  349. package/lib/types/components/accordion/Accordion.styles.d.ts +4 -8
  350. package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
  351. package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +2 -7
  352. package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +0 -1
  353. package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
  354. package/lib/types/components/amount-control/AmountControl.d.ts +0 -5
  355. package/lib/types/components/amount-control/AmountControl.styles.d.ts +4 -8
  356. package/lib/types/components/button/Button.styles.d.ts +6 -8
  357. package/lib/types/components/button/Button.types.d.ts +0 -8
  358. package/lib/types/components/checkbox/Checkbox.d.ts +0 -4
  359. package/lib/types/components/checkbox/Checkbox.styles.d.ts +1 -5
  360. package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +0 -5
  361. package/lib/types/components/combobox/ComboBox.styles.d.ts +2 -4
  362. package/lib/types/components/combobox/ComboBox.types.d.ts +0 -5
  363. package/lib/types/components/context-menu/ContextMenu.styles.d.ts +2 -4
  364. package/lib/types/components/context-menu/ContextMenu.types.d.ts +0 -6
  365. package/lib/types/components/context-menu/ContextMenu.utils.d.ts +0 -10
  366. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -1
  367. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +2 -2
  368. package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +2 -2
  369. package/lib/types/components/expandable-content/ExpandableContent.styles.d.ts +2 -2
  370. package/lib/types/components/file-input/FileInput.d.ts +0 -4
  371. package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
  372. package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +0 -3
  373. package/lib/types/components/file-select/FileSelect.d.ts +0 -4
  374. package/lib/types/components/file-select/FileSelect.styles.d.ts +4 -6
  375. package/lib/types/components/filter/Filter.d.ts +0 -1
  376. package/lib/types/components/filter/Filter.styles.d.ts +4 -6
  377. package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +0 -4
  378. package/lib/types/components/filter-buttons/FilterButtons.d.ts +0 -4
  379. package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +0 -5
  380. package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +8 -12
  381. package/lib/types/components/grid-image/GridImage.d.ts +0 -4
  382. package/lib/types/components/grid-image/GridImage.styles.d.ts +2 -4
  383. package/lib/types/components/grouped-image/GroupedImage.d.ts +0 -4
  384. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +6 -8
  385. package/lib/types/components/highlight-slider/HighlightSlider.d.ts +0 -4
  386. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +0 -3
  387. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +5 -9
  388. package/lib/types/components/icon/Icon.d.ts +0 -4
  389. package/lib/types/components/icon/Icon.styles.d.ts +0 -1
  390. package/lib/types/components/input/Input.d.ts +0 -4
  391. package/lib/types/components/input/Input.styles.d.ts +9 -17
  392. package/lib/types/components/list/List.d.ts +0 -11
  393. package/lib/types/components/list/List.utils.d.ts +1 -32
  394. package/lib/types/components/list/list-item/ListItem.d.ts +0 -4
  395. package/lib/types/components/list/list-item/ListItem.styles.d.ts +64 -64
  396. package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +2 -2
  397. package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +194 -195
  398. package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +2 -2
  399. package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +4 -4
  400. package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +2 -2
  401. package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +0 -7
  402. package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +1 -4
  403. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +2 -4
  404. package/lib/types/components/number-input/NumberInput.d.ts +0 -4
  405. package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +2 -2
  406. package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +6 -6
  407. package/lib/types/components/radio-button/RadioButton.d.ts +0 -4
  408. package/lib/types/components/radio-button/RadioButton.styles.d.ts +9 -15
  409. package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +0 -5
  410. package/lib/types/components/search-box/SearchBox.d.ts +0 -4
  411. package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
  412. package/lib/types/components/search-input/SearchInput.d.ts +0 -4
  413. package/lib/types/components/search-input/SearchInput.styles.d.ts +9 -17
  414. package/lib/types/components/select-button/SelectButton.d.ts +0 -4
  415. package/lib/types/components/setup-wizard/SetupWizard.d.ts +0 -5
  416. package/lib/types/components/sharing-bar/SharingBar.d.ts +0 -4
  417. package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
  418. package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +2 -10
  419. package/lib/types/components/signature/Signature.d.ts +0 -4
  420. package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
  421. package/lib/types/components/slider/Slider.d.ts +0 -8
  422. package/lib/types/components/slider/Slider.styles.d.ts +14 -18
  423. package/lib/types/components/slider-button/SliderButton.d.ts +28 -1
  424. package/lib/types/components/slider-button/SliderButton.styles.d.ts +4 -6
  425. package/lib/types/components/tag-input/TagInput.d.ts +0 -4
  426. package/lib/types/components/tag-input/TagInput.styles.d.ts +2 -12
  427. package/lib/types/components/text-area/TextArea.d.ts +0 -4
  428. package/lib/types/components/text-area/TextArea.styles.d.ts +0 -1
  429. package/lib/types/components/truncation/Truncation.d.ts +0 -4
  430. package/lib/types/components/truncation/Truncation.styles.d.ts +2 -7
  431. package/lib/types/utils/file.d.ts +1 -1
  432. package/package.json +3 -3
  433. package/lib/cjs/components/list/list-item/useListItemFocus.js +0 -47
  434. package/lib/cjs/components/list/list-item/useListItemFocus.js.map +0 -1
  435. package/lib/cjs/components/slider-button/SliderButton.types.js +0 -6
  436. package/lib/cjs/components/slider-button/SliderButton.types.js.map +0 -1
  437. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +0 -66
  438. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +0 -1
  439. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +0 -47
  440. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +0 -1
  441. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +0 -68
  442. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +0 -1
  443. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +0 -29
  444. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  445. package/lib/esm/components/list/list-item/useListItemFocus.js +0 -40
  446. package/lib/esm/components/list/list-item/useListItemFocus.js.map +0 -1
  447. package/lib/esm/components/slider-button/SliderButton.types.js +0 -2
  448. package/lib/esm/components/slider-button/SliderButton.types.js.map +0 -1
  449. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +0 -56
  450. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +0 -1
  451. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +0 -38
  452. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +0 -1
  453. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +0 -61
  454. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +0 -1
  455. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +0 -24
  456. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  457. package/lib/types/components/list/list-item/useListItemFocus.d.ts +0 -13
  458. package/lib/types/components/slider-button/SliderButton.types.d.ts +0 -32
  459. package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +0 -17
  460. package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +0 -13
  461. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +0 -5
  462. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionHead.js","names":["AnimatePresence","LayoutGroup","React","useEffect","useMemo","useRef","useState","useTheme","useElementSize","getAccordionHeadHeight","getElementClickEvent","AreaContext","Icon","Input","InputSize","SearchInput","StyledMotionAccordionHead","StyledMotionContentWrapper","StyledMotionIconWrapper","StyledMotionRightElementWrapper","StyledMotionSearchWrapper","StyledMotionTitle","StyledMotionTitleElementWrapper","StyledMotionTitleWrapper","StyledRightWrapper","StyledTitleInputWrapper","StyledUnicodeIcon","getIsExpandableIcon","AccordionHead","icon","isOpen","isFixed","isTitleGreyed","isWrapped","onClick","onSearchChange","rightElement","searchPlaceholder","searchValue","shouldRotateIcon","title","titleElement","shouldSkipAnimation","uuid","titleInputProps","onTitleInputChange","titleColor","shouldEnableKeyboardHighlighting","headHeight","setHeadHeight","closed","open","isSearchActive","setIsSearchActive","theme","titleElementWrapperRef","titleWrapperRef","internalSearchValue","setInternalSearchValue","handleOnSearchChance","event","target","value","titleElementChildrenSize","shouldUseChildElement","shouldPreventRightElementClick","window","setTimeout","width","current","clientWidth","hasSearch","fontSize","iconElement","createElement","icons","color","iconColor","headline","internalIcon","accordionIcon","className","iconStyle","$icon","accordionHeadHeight","height","animate","initial","key","transition","duration","rotate","undefined","opacity","ref","$isWrapped","Provider","shouldChangeColor","_extends","onChange","mode","style","display","alignItems","gap","scale","exit","transitionEnd","$isOpen","$color","$hasSearch","$isSearchActive","onActiveChange","isActive","placeholder","size","Small","displayName"],"sources":["../../../../../src/components/accordion/accordion-head/AccordionHead.tsx"],"sourcesContent":["import { AnimatePresence, LayoutGroup } from 'motion/react';\nimport React, {\n ChangeEvent,\n ChangeEventHandler,\n type CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../../hooks/element';\nimport { getAccordionHeadHeight, getElementClickEvent } from '../../../utils/accordion';\nimport { AreaContext } from '../../area-provider/AreaContextProvider';\nimport type { Theme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../../icon/Icon';\nimport Input, { type InputProps, InputSize } from '../../input/Input';\nimport SearchInput from '../../search-input/SearchInput';\nimport {\n StyledMotionAccordionHead,\n StyledMotionContentWrapper,\n StyledMotionIconWrapper,\n StyledMotionRightElementWrapper,\n StyledMotionSearchWrapper,\n StyledMotionTitle,\n StyledMotionTitleElementWrapper,\n StyledMotionTitleWrapper,\n StyledRightWrapper,\n StyledTitleInputWrapper,\n} from './AccordionHead.styles';\nimport { StyledUnicodeIcon } from '../../icon/Icon.styles';\nimport { getIsExpandableIcon } from '../../../utils/icon';\n\nexport type AccordionHeadProps = {\n icon?: string;\n isOpen: boolean;\n isFixed: boolean;\n isTitleGreyed: boolean;\n isWrapped: boolean;\n onClick: MouseEventHandler<HTMLDivElement>;\n onSearchChange?: ChangeEventHandler<HTMLInputElement>;\n rightElement?: ReactNode;\n searchPlaceholder?: string;\n searchValue?: string;\n shouldRotateIcon?: boolean;\n title?: string;\n titleElement?: ReactNode;\n uuid: string;\n onTitleInputChange?: ChangeEventHandler<HTMLInputElement>;\n titleInputProps?: InputProps;\n titleColor?: CSSProperties['color'];\n shouldSkipAnimation?: boolean;\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\nconst AccordionHead: FC<AccordionHeadProps> = ({\n icon,\n isOpen,\n isFixed,\n isTitleGreyed,\n isWrapped,\n onClick,\n onSearchChange,\n rightElement,\n searchPlaceholder,\n searchValue,\n shouldRotateIcon,\n title,\n titleElement,\n shouldSkipAnimation,\n uuid,\n titleInputProps,\n onTitleInputChange,\n titleColor,\n shouldEnableKeyboardHighlighting,\n}) => {\n const [headHeight, setHeadHeight] = useState<HeadHeight>({\n closed: isWrapped ? 40 : 32,\n open: isWrapped ? 40 : 42,\n });\n\n const [isSearchActive, setIsSearchActive] = useState(false);\n\n const theme = useTheme() as Theme;\n\n const titleElementWrapperRef = useRef<HTMLDivElement>(null);\n const titleWrapperRef = useRef<HTMLDivElement>(null);\n\n const [internalSearchValue, setInternalSearchValue] = useState<string>();\n\n useEffect(() => {\n setInternalSearchValue(searchValue);\n }, [searchValue]);\n\n useEffect(() => {\n if (typeof onSearchChange === 'function' && !isOpen) {\n setIsSearchActive(false);\n }\n }, [isOpen, onSearchChange]);\n\n const handleOnSearchChance = (event: ChangeEvent<HTMLInputElement>) => {\n setInternalSearchValue(event.target.value);\n if (typeof onSearchChange === 'function') {\n onSearchChange(event);\n }\n };\n\n const titleElementChildrenSize = useElementSize(titleElementWrapperRef, {\n shouldUseChildElement: true,\n });\n\n const shouldPreventRightElementClick = useMemo(\n () => getElementClickEvent(rightElement),\n [rightElement],\n );\n\n useEffect(() => {\n if (typeof onTitleInputChange === 'function') {\n setHeadHeight({ closed: 50, open: 50 });\n } else {\n // The timeout is needed because the width is incorrect on the first render\n window.setTimeout(() => {\n setHeadHeight(\n getAccordionHeadHeight({\n isWrapped,\n title,\n width: titleWrapperRef.current?.clientWidth ?? 0,\n hasSearch: typeof onSearchChange === 'function',\n }),\n );\n }, 1);\n }\n // The fontSize need to be included to trigger a new calculation.\n // After the size is increased, the Title is cut at the bottom.\n }, [isWrapped, onSearchChange, onTitleInputChange, theme.fontSize, title]);\n\n const iconElement = useMemo(() => {\n if (icon || isFixed) {\n return (\n <Icon\n icons={[isFixed ? 'fa fa-horizontal-rule' : (icon ?? 'fa fa-chevron-right')]}\n color={theme.iconColor || theme.headline}\n />\n );\n }\n\n const internalIcon = getIsExpandableIcon(theme.accordionIcon);\n return (\n <StyledUnicodeIcon className={theme.iconStyle ?? 'fa-regular'} $icon={internalIcon} />\n );\n }, [icon, isFixed, theme.accordionIcon, theme.headline, theme.iconColor, theme.iconStyle]);\n\n let accordionHeadHeight = isOpen ? headHeight.open : headHeight.closed;\n\n if (titleElementChildrenSize && titleElementChildrenSize.height > accordionHeadHeight) {\n // If the titleElement is bigger than the title, the height of the accordion head should be increased.\n // The height of the titleElement is increased by 8px because of the padding of the accordion head element.\n accordionHeadHeight = titleElementChildrenSize.height + 8;\n }\n\n return (\n <StyledMotionAccordionHead\n animate={{ height: accordionHeadHeight }}\n className=\"beta-chayns-accordion-head\"\n initial={false}\n key={`accordionHead--${uuid}`}\n transition={{ duration: shouldSkipAnimation ? 0 : 0.25 }}\n >\n <StyledMotionIconWrapper\n animate={{ rotate: (isOpen || isFixed) && shouldRotateIcon ? 90 : 0 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n key={`accordionHeadIcon--${uuid}`}\n transition={{ duration: shouldSkipAnimation ? 0 : 0.25 }}\n >\n {iconElement}\n </StyledMotionIconWrapper>\n <StyledMotionContentWrapper\n animate={{ opacity: isTitleGreyed ? 0.5 : 1 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n ref={titleWrapperRef}\n $isWrapped={isWrapped}\n key={`accordionHeadContentWrapper--${uuid}`}\n >\n {typeof onTitleInputChange === 'function' ? (\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n <AreaContext.Provider value={{ shouldChangeColor: true }}>\n <StyledTitleInputWrapper>\n <Input\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...titleInputProps}\n value={title}\n onChange={onTitleInputChange}\n shouldEnableKeyboardHighlighting={\n titleInputProps?.shouldEnableKeyboardHighlighting ??\n shouldEnableKeyboardHighlighting\n }\n />\n </StyledTitleInputWrapper>\n </AreaContext.Provider>\n ) : (\n <LayoutGroup key={`accordionHeadLayoutGroup--${uuid}`}>\n <AnimatePresence\n initial={false}\n mode=\"sync\"\n key={`accordionHeadTitleWrapper--${uuid}`}\n >\n <StyledMotionTitleWrapper\n key={`accordionHeadTitleWrapperWrapper--${uuid}`}\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '12px',\n width: typeof title !== 'string' ? '100%' : undefined,\n }}\n initial={\n !shouldSkipAnimation\n ? { scale: isOpen && !isWrapped ? 1 / 1.3 : 1.3 }\n : false\n }\n exit={\n shouldSkipAnimation\n ? {\n opacity: 0,\n transition: { duration: 0 },\n transitionEnd: { display: 'none' },\n }\n : { scale: 1, opacity: 0 }\n }\n animate={{ scale: 1, opacity: 1 }}\n transition={{\n duration: shouldSkipAnimation ? 0 : 0.25,\n opacity: { duration: 0 },\n }}\n >\n {title && (\n <StyledMotionTitle\n $isOpen={isOpen}\n $isWrapped={isWrapped}\n $color={titleColor}\n $hasSearch={typeof onSearchChange === 'function'}\n animate={{\n fontSize: isOpen && !isWrapped ? '1.3rem' : '1rem',\n }}\n initial={shouldSkipAnimation ? false : { fontSize: '1rem' }}\n transition={{ duration: shouldSkipAnimation ? 0 : 0.25 }}\n >\n {title}\n </StyledMotionTitle>\n )}\n\n {titleElement && (\n <StyledMotionTitleElementWrapper\n key={`accordionTitleElement--${uuid}`}\n ref={titleElementWrapperRef}\n >\n {titleElement}\n </StyledMotionTitleElementWrapper>\n )}\n </StyledMotionTitleWrapper>\n </AnimatePresence>\n </LayoutGroup>\n )}\n </StyledMotionContentWrapper>\n {(typeof onSearchChange === 'function' || rightElement) && (\n <StyledRightWrapper $isSearchActive={isSearchActive}>\n <AnimatePresence initial={false} key={`accordionRightWrapper--${uuid}`}>\n {typeof onSearchChange === 'function' && isOpen && (\n <StyledMotionSearchWrapper\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n initial={{ opacity: 0 }}\n key={`searchWrapper--${uuid}`}\n >\n <SearchInput\n onChange={handleOnSearchChance}\n onActiveChange={(isActive) => setIsSearchActive(isActive)}\n placeholder={searchPlaceholder}\n size={InputSize.Small}\n value={internalSearchValue}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n />\n </StyledMotionSearchWrapper>\n )}\n {rightElement && (\n <StyledMotionRightElementWrapper\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n initial={{ opacity: 0 }}\n key={`rightElementWrapper--${uuid}`}\n onClick={\n !isFixed && !shouldPreventRightElementClick\n ? onClick\n : undefined\n }\n >\n {rightElement}\n </StyledMotionRightElementWrapper>\n )}\n </AnimatePresence>\n </StyledRightWrapper>\n )}\n </StyledMotionAccordionHead>\n );\n};\n\nAccordionHead.displayName = 'AccordionHead';\n\nexport default AccordionHead;\n"],"mappings":";AAAA,SAASA,eAAe,EAAEC,WAAW,QAAQ,cAAc;AAC3D,OAAOC,KAAK,IAORC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,0BAA0B;AACvF,SAASC,WAAW,QAAQ,yCAAyC;AAErE,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,KAAK,IAAqBC,SAAS,QAAQ,mBAAmB;AACrE,OAAOC,WAAW,MAAM,gCAAgC;AACxD,SACIC,yBAAyB,EACzBC,0BAA0B,EAC1BC,uBAAuB,EACvBC,+BAA+B,EAC/BC,yBAAyB,EACzBC,iBAAiB,EACjBC,+BAA+B,EAC/BC,wBAAwB,EACxBC,kBAAkB,EAClBC,uBAAuB,QACpB,wBAAwB;AAC/B,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,mBAAmB,QAAQ,qBAAqB;AA6BzD,MAAMC,aAAqC,GAAGA,CAAC;EAC3CC,IAAI;EACJC,MAAM;EACNC,OAAO;EACPC,aAAa;EACbC,SAAS;EACTC,OAAO;EACPC,cAAc;EACdC,YAAY;EAC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M;IAACC,GAAG,EAAE,0BAA0B7C,IAAI;EAAG,GAClE,OAAOR,cAAc,KAAK,UAAU,IAAIL,MAAM,iBAC3C5B,KAAA,CAAAwE,aAAA,CAACtD,yBAAyB;IACtBkE,OAAO,EAAE;MAAEO,OAAO,EAAE;IAAE,CAAE;IACxBa,IAAI,EAAE;MAAEb,OAAO,EAAE;IAAE,CAAE;IACrBN,OAAO,EAAE;MAAEM,OAAO,EAAE;IAAE,CAAE;IACxBL,GAAG,EAAE,kBAAkB7C,IAAI;EAAG,gBAE9BzC,KAAA,CAAAwE,aAAA,CAAC3D,WAAW;IACRoF,QAAQ,EAAExC,oBAAqB;IAC/BqD,cAAc,EAAGC,QAAQ,IAAK5D,iBAAiB,CAAC4D,QAAQ,CAAE;IAC1DC,WAAW,EAAE7E,iBAAkB;IAC/B8E,IAAI,EAAErG,SAAS,CAACsG,KAAM;IACtBtD,KAAK,EAAEL,mBAAoB;IAC3BV,gCAAgC,EAC5BA;EACH,CACJ,CACsB,CAC9B,EACAX,YAAY,iBACTlC,KAAA,CAAAwE,aAAA,CAACvD,+BAA+B;IAC5BmE,OAAO,EAAE;MAAEO,OAAO,EAAE;IAAE,CAAE;IACxBa,IAAI,EAAE;MAAEb,OAAO,EAAE;IAAE,CAAE;IACrBN,OAAO,EAAE;MAAEM,OAAO,EAAE;IAAE,CAAE;IACxBL,GAAG,EAAE,wBAAwB7C,IAAI,EAAG;IACpCT,OAAO,EACH,CAACH,OAAO,IAAI,CAACkC,8BAA8B,GACrC/B,OAAO,GACP0D;EACT,GAEAxD,YAC4B,CAExB,CACD,CAED,CAAC;AAEpC,CAAC;AAEDR,aAAa,CAACyF,WAAW,GAAG,eAAe;AAE3C,eAAezF,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"AccordionHead.js","names":["AnimatePresence","LayoutGroup","React","useEffect","useMemo","useRef","useState","useTheme","useElementSize","getAccordionHeadHeight","getElementClickEvent","AreaContext","Icon","Input","InputSize","SearchInput","StyledMotionAccordionHead","StyledMotionContentWrapper","StyledMotionIconWrapper","StyledMotionRightElementWrapper","StyledMotionSearchWrapper","StyledMotionTitle","StyledMotionTitleElementWrapper","StyledMotionTitleWrapper","StyledRightWrapper","StyledTitleInputWrapper","StyledUnicodeIcon","getIsExpandableIcon","AccordionHead","icon","isOpen","isFixed","isTitleGreyed","isWrapped","onClick","onSearchChange","rightElement","searchPlaceholder","searchValue","shouldRotateIcon","title","titleElement","shouldSkipAnimation","uuid","titleInputProps","onTitleInputChange","titleColor","headHeight","setHeadHeight","closed","open","isSearchActive","setIsSearchActive","theme","titleElementWrapperRef","titleWrapperRef","internalSearchValue","setInternalSearchValue","handleOnSearchChance","event","target","value","titleElementChildrenSize","shouldUseChildElement","shouldPreventRightElementClick","window","setTimeout","width","current","clientWidth","hasSearch","fontSize","iconElement","createElement","icons","color","iconColor","headline","internalIcon","accordionIcon","className","iconStyle","$icon","accordionHeadHeight","height","animate","initial","key","transition","duration","rotate","undefined","opacity","ref","$isWrapped","Provider","shouldChangeColor","_extends","onChange","mode","style","display","alignItems","gap","scale","exit","transitionEnd","$isOpen","$color","$hasSearch","$isSearchActive","onActiveChange","isActive","placeholder","size","Small","displayName"],"sources":["../../../../../src/components/accordion/accordion-head/AccordionHead.tsx"],"sourcesContent":["import { AnimatePresence, LayoutGroup } from 'motion/react';\nimport React, {\n ChangeEvent,\n ChangeEventHandler,\n type CSSProperties,\n FC,\n MouseEventHandler,\n ReactNode,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useElementSize } from '../../../hooks/element';\nimport { getAccordionHeadHeight, getElementClickEvent } from '../../../utils/accordion';\nimport { AreaContext } from '../../area-provider/AreaContextProvider';\nimport type { Theme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../../icon/Icon';\nimport Input, { type InputProps, InputSize } from '../../input/Input';\nimport SearchInput from '../../search-input/SearchInput';\nimport {\n StyledMotionAccordionHead,\n StyledMotionContentWrapper,\n StyledMotionIconWrapper,\n StyledMotionRightElementWrapper,\n StyledMotionSearchWrapper,\n StyledMotionTitle,\n StyledMotionTitleElementWrapper,\n StyledMotionTitleWrapper,\n StyledRightWrapper,\n StyledTitleInputWrapper,\n} from './AccordionHead.styles';\nimport { StyledUnicodeIcon } from '../../icon/Icon.styles';\nimport { getIsExpandableIcon } from '../../../utils/icon';\n\nexport type AccordionHeadProps = {\n icon?: string;\n isOpen: boolean;\n isFixed: boolean;\n isTitleGreyed: boolean;\n isWrapped: boolean;\n onClick: MouseEventHandler<HTMLDivElement>;\n onSearchChange?: ChangeEventHandler<HTMLInputElement>;\n rightElement?: ReactNode;\n searchPlaceholder?: string;\n searchValue?: string;\n shouldRotateIcon?: boolean;\n title?: string;\n titleElement?: ReactNode;\n uuid: string;\n onTitleInputChange?: ChangeEventHandler<HTMLInputElement>;\n titleInputProps?: InputProps;\n titleColor?: CSSProperties['color'];\n shouldSkipAnimation?: boolean;\n};\n\ninterface HeadHeight {\n closed: number;\n open: number;\n}\n\nconst AccordionHead: FC<AccordionHeadProps> = ({\n icon,\n isOpen,\n isFixed,\n isTitleGreyed,\n isWrapped,\n onClick,\n onSearchChange,\n rightElement,\n searchPlaceholder,\n searchValue,\n shouldRotateIcon,\n title,\n titleElement,\n shouldSkipAnimation,\n uuid,\n titleInputProps,\n onTitleInputChange,\n titleColor,\n}) => {\n const [headHeight, setHeadHeight] = useState<HeadHeight>({\n closed: isWrapped ? 40 : 32,\n open: isWrapped ? 40 : 42,\n });\n\n const [isSearchActive, setIsSearchActive] = useState(false);\n\n const theme = useTheme() as Theme;\n\n const titleElementWrapperRef = useRef<HTMLDivElement>(null);\n const titleWrapperRef = useRef<HTMLDivElement>(null);\n\n const [internalSearchValue, setInternalSearchValue] = useState<string>();\n\n useEffect(() => {\n setInternalSearchValue(searchValue);\n }, [searchValue]);\n\n useEffect(() => {\n if (typeof onSearchChange === 'function' && !isOpen) {\n setIsSearchActive(false);\n }\n }, [isOpen, onSearchChange]);\n\n const handleOnSearchChance = (event: ChangeEvent<HTMLInputElement>) => {\n setInternalSearchValue(event.target.value);\n if (typeof onSearchChange === 'function') {\n onSearchChange(event);\n }\n };\n\n const titleElementChildrenSize = useElementSize(titleElementWrapperRef, {\n shouldUseChildElement: true,\n });\n\n const shouldPreventRightElementClick = useMemo(\n () => getElementClickEvent(rightElement),\n [rightElement],\n );\n\n useEffect(() => {\n if (typeof onTitleInputChange === 'function') {\n setHeadHeight({ closed: 50, open: 50 });\n } else {\n // The timeout is needed because the width is incorrect on the first render\n window.setTimeout(() => {\n setHeadHeight(\n getAccordionHeadHeight({\n isWrapped,\n title,\n width: titleWrapperRef.current?.clientWidth ?? 0,\n hasSearch: typeof onSearchChange === 'function',\n }),\n );\n }, 1);\n }\n // The fontSize need to be included to trigger a new calculation.\n // After the size is increased, the Title is cut at the bottom.\n }, [isWrapped, onSearchChange, onTitleInputChange, theme.fontSize, title]);\n\n const iconElement = useMemo(() => {\n if (icon || isFixed) {\n return (\n <Icon\n icons={[isFixed ? 'fa fa-horizontal-rule' : (icon ?? 'fa fa-chevron-right')]}\n color={theme.iconColor || theme.headline}\n />\n );\n }\n\n const internalIcon = getIsExpandableIcon(theme.accordionIcon);\n return (\n <StyledUnicodeIcon className={theme.iconStyle ?? 'fa-regular'} $icon={internalIcon} />\n );\n }, [icon, isFixed, theme.accordionIcon, theme.headline, theme.iconColor, theme.iconStyle]);\n\n let accordionHeadHeight = isOpen ? headHeight.open : headHeight.closed;\n\n if (titleElementChildrenSize && titleElementChildrenSize.height > accordionHeadHeight) {\n // If the titleElement is bigger than the title, the height of the accordion head should be increased.\n // The height of the titleElement is increased by 8px because of the padding of the accordion head element.\n accordionHeadHeight = titleElementChildrenSize.height + 8;\n }\n\n return (\n <StyledMotionAccordionHead\n animate={{ height: accordionHeadHeight }}\n className=\"beta-chayns-accordion-head\"\n initial={false}\n key={`accordionHead--${uuid}`}\n transition={{ duration: shouldSkipAnimation ? 0 : 0.25 }}\n >\n <StyledMotionIconWrapper\n animate={{ rotate: (isOpen || isFixed) && shouldRotateIcon ? 90 : 0 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n key={`accordionHeadIcon--${uuid}`}\n transition={{ duration: shouldSkipAnimation ? 0 : 0.25 }}\n >\n {iconElement}\n </StyledMotionIconWrapper>\n <StyledMotionContentWrapper\n animate={{ opacity: isTitleGreyed ? 0.5 : 1 }}\n initial={false}\n onClick={!isFixed ? onClick : undefined}\n ref={titleWrapperRef}\n $isWrapped={isWrapped}\n key={`accordionHeadContentWrapper--${uuid}`}\n >\n {typeof onTitleInputChange === 'function' ? (\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n <AreaContext.Provider value={{ shouldChangeColor: true }}>\n <StyledTitleInputWrapper>\n <Input\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...titleInputProps}\n value={title}\n onChange={onTitleInputChange}\n />\n </StyledTitleInputWrapper>\n </AreaContext.Provider>\n ) : (\n <LayoutGroup key={`accordionHeadLayoutGroup--${uuid}`}>\n <AnimatePresence\n initial={false}\n mode=\"sync\"\n key={`accordionHeadTitleWrapper--${uuid}`}\n >\n <StyledMotionTitleWrapper\n key={`accordionHeadTitleWrapperWrapper--${uuid}`}\n style={{\n display: 'flex',\n alignItems: 'center',\n gap: '12px',\n width: typeof title !== 'string' ? '100%' : undefined,\n }}\n initial={\n !shouldSkipAnimation\n ? { scale: isOpen && !isWrapped ? 1 / 1.3 : 1.3 }\n : false\n }\n exit={\n shouldSkipAnimation\n ? {\n opacity: 0,\n transition: { duration: 0 },\n transitionEnd: { display: 'none' },\n }\n : { scale: 1, opacity: 0 }\n }\n animate={{ scale: 1, opacity: 1 }}\n transition={{\n duration: shouldSkipAnimation ? 0 : 0.25,\n opacity: { duration: 0 },\n }}\n >\n {title && (\n <StyledMotionTitle\n $isOpen={isOpen}\n $isWrapped={isWrapped}\n $color={titleColor}\n $hasSearch={typeof onSearchChange === 'function'}\n animate={{\n fontSize: isOpen && !isWrapped ? '1.3rem' : '1rem',\n }}\n initial={shouldSkipAnimation ? false : { fontSize: '1rem' }}\n transition={{ duration: shouldSkipAnimation ? 0 : 0.25 }}\n >\n {title}\n </StyledMotionTitle>\n )}\n\n {titleElement && (\n <StyledMotionTitleElementWrapper\n key={`accordionTitleElement--${uuid}`}\n ref={titleElementWrapperRef}\n >\n {titleElement}\n </StyledMotionTitleElementWrapper>\n )}\n </StyledMotionTitleWrapper>\n </AnimatePresence>\n </LayoutGroup>\n )}\n </StyledMotionContentWrapper>\n {(typeof onSearchChange === 'function' || rightElement) && (\n <StyledRightWrapper $isSearchActive={isSearchActive}>\n <AnimatePresence initial={false} key={`accordionRightWrapper--${uuid}`}>\n {typeof onSearchChange === 'function' && isOpen && (\n <StyledMotionSearchWrapper\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n initial={{ opacity: 0 }}\n key={`searchWrapper--${uuid}`}\n >\n <SearchInput\n onChange={handleOnSearchChance}\n onActiveChange={(isActive) => setIsSearchActive(isActive)}\n placeholder={searchPlaceholder}\n size={InputSize.Small}\n value={internalSearchValue}\n />\n </StyledMotionSearchWrapper>\n )}\n {rightElement && (\n <StyledMotionRightElementWrapper\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n initial={{ opacity: 0 }}\n key={`rightElementWrapper--${uuid}`}\n onClick={\n !isFixed && !shouldPreventRightElementClick\n ? onClick\n : undefined\n }\n >\n {rightElement}\n </StyledMotionRightElementWrapper>\n )}\n </AnimatePresence>\n </StyledRightWrapper>\n )}\n </StyledMotionAccordionHead>\n );\n};\n\nAccordionHead.displayName = 'AccordionHead';\n\nexport default AccordionHead;\n"],"mappings":";AAAA,SAASA,eAAe,EAAEC,WAAW,QAAQ,cAAc;AAC3D,OAAOC,KAAK,IAORC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,sBAAsB,E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AEb,OAAO,EAAE;IAAE,CAAE;IACrBN,OAAO,EAAE;MAAEM,OAAO,EAAE;IAAE,CAAE;IACxBL,GAAG,EAAE,wBAAwB5C,IAAI,EAAG;IACpCT,OAAO,EACH,CAACH,OAAO,IAAI,CAACiC,8BAA8B,GACrC9B,OAAO,GACPyD;EACT,GAEAvD,YAC4B,CAExB,CACD,CAED,CAAC;AAEpC,CAAC;AAEDR,aAAa,CAACwF,WAAW,GAAG,eAAe;AAE3C,eAAexF,aAAa","ignoreList":[]}
@@ -8,12 +8,6 @@ export const StyledMotionAccordionHead = styled(motion.div)`
8
8
  display: flex;
9
9
  overflow: hidden;
10
10
  padding: 4px 0;
11
-
12
- &:focus-within {
13
- overflow: visible;
14
- position: relative;
15
- z-index: 1;
16
- }
17
11
  `;
18
12
  export const StyledMotionIconWrapper = styled(motion.div)`
19
13
  align-items: center;
@@ -37,10 +31,6 @@ export const StyledMotionContentWrapper = styled(motion.div)`
37
31
  overflow: hidden;
38
32
  margin-right: 10px;
39
33
 
40
- &:focus-within {
41
- overflow: visible;
42
- }
43
-
44
34
  ${({
45
35
  $isWrapped
46
36
  }) => $isWrapped && css`
@@ -104,10 +94,6 @@ export const StyledRightWrapper = styled.div`
104
94
  margin-right: 5px;
105
95
  overflow: hidden;
106
96
  position: relative;
107
-
108
- &:focus-within {
109
- overflow: visible;
110
- }
111
97
  `;
112
98
  export const StyledMotionSearchWrapper = styled(motion.div)`
113
99
  align-items: center;
@@ -1 +1 @@
1
- {"version":3,"file":"AccordionHead.styles.js","names":["motion","styled","css","StyledMotionAccordionHead","div","theme","text","StyledMotionIconWrapper","onClick","StyledMotionContentWrapper","$isWrapped","StyledMotionTitleWrapper","StyledTitleInputWrapper","StyledMotionTitle","$isOpen","undefined","$hasSearch","$color","StyledMotionTitleElementWrapper","StyledRightWrapper","StyledMotionSearchWrapper","StyledMotionRightElementWrapper","StyledMotionRightInput","input","$hasIcon","StyledMotionRightInputIconWrapper"],"sources":["../../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionAccordionHeadProps = WithTheme<unknown>;\n\nexport const StyledMotionAccordionHead = styled(motion.div)<StyledMotionAccordionHeadProps>`\n align-items: center;\n color: ${({ theme }: StyledMotionAccordionHeadProps) => theme.text};\n display: flex;\n overflow: hidden;\n padding: 4px 0;\n\n &:focus-within {\n overflow: visible;\n position: relative;\n z-index: 1;\n }\n`;\n\nexport const StyledMotionIconWrapper = styled(motion.div)`\n align-items: center;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'inherit')};\n display: flex;\n flex: 0 0 auto;\n height: 25px;\n justify-content: center;\n width: 25px;\n`;\n\ntype StyledMotionContentWrapperProps = WithTheme<{ $isWrapped: boolean }>;\n\nexport const StyledMotionContentWrapper = styled(motion.div)<StyledMotionContentWrapperProps>`\n align-self: flex-start;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'inherit')};\n display: flex;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n margin-right: 10px;\n\n &:focus-within {\n overflow: visible;\n }\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n align-items: center;\n `}\n`;\n\nexport const StyledMotionTitleWrapper = styled(motion.div)`\n display: grid;\n flex: 0 1 auto;\n grid-template-areas: 'header';\n`;\n\nexport const StyledTitleInputWrapper = styled.div`\n width: 100%;\n`;\n\ntype StyledMotionTitleProps = WithTheme<{\n $isOpen: boolean;\n $isWrapped: boolean;\n $color?: CSSProperties['color'];\n $hasSearch: boolean;\n}>;\n\nexport const StyledMotionTitle = styled(motion.div)<StyledMotionTitleProps>`\n font-size: ${({ $isOpen, $isWrapped }) => ($isOpen && !$isWrapped ? '1.3rem' : undefined)};\n font-weight: ${({ $isOpen, $isWrapped }) => ($isOpen && $isWrapped ? 700 : 'normal')};\n grid-area: header;\n height: ${({ $isWrapped, $hasSearch }) => ($isWrapped || $hasSearch ? '100%' : undefined)};\n overflow: hidden;\n text-overflow: ellipsis;\n transform-origin: top left;\n user-select: none;\n color: ${({ $color, theme }: StyledMotionTitleProps) => $color ?? theme.text};\n white-space: ${({ $isOpen, $isWrapped, $hasSearch }) =>\n $isOpen && !$isWrapped && !$hasSearch ? 'normal' : 'nowrap'};\n\n will-change: unset !important;\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n align-content: center;\n `}\n`;\n\nexport const StyledMotionTitleElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n`;\n\ntype StyledRightWrapperProps = {\n $isSearchActive: boolean;\n};\n\nexport const StyledRightWrapper = styled.div<StyledRightWrapperProps>`\n display: flex;\n flex: 0 0 auto;\n gap: 8px;\n margin-right: 5px;\n overflow: hidden;\n position: relative;\n\n &:focus-within {\n overflow: visible;\n }\n`;\n\nexport const StyledMotionSearchWrapper = styled(motion.div)`\n align-items: center;\n justify-content: end;\n position: relative;\n display: flex;\n width: 100%;\n`;\n\nexport const StyledMotionRightElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'inherit')};\n\n will-change: unset !important;\n`;\n\ntype StyledMotionRightInputProps = WithTheme<{\n $hasIcon: boolean;\n}>;\n\nexport const StyledMotionRightInput = styled(motion.input)<StyledMotionRightInputProps>`\n background-color: transparent;\n border: 1px solid transparent;\n border-bottom-color: rgba(\n ${({ theme }: StyledMotionRightInputProps) => theme['headline-rgb']},\n 0.45\n );\n color: ${({ theme }: StyledMotionRightInputProps) => theme.text};\n grid-area: header;\n padding: ${({ $hasIcon }) => ($hasIcon ? '5px 23px 5px 1px' : '5px 1px')};\n`;\n\nexport const StyledMotionRightInputIconWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n position: absolute;\n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AAC;EAAEA;AAAmC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACnE;AACA,eAAe,CAAC;EAAEkB;AAAS,CAAC,KAAMA,QAAQ,GAAG,kBAAkB,GAAG,SAAU;AAC5E,CAAC;AAED,OAAO,MAAMC,iCAAiC,GAAGxB,MAAM,CAACD,MAAM,CAACI,GAAG,CAAC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"AccordionHead.styles.js","names":["motion","styled","css","StyledMotionAccordionHead","div","theme","text","StyledMotionIconWrapper","onClick","StyledMotionContentWrapper","$isWrapped","StyledMotionTitleWrapper","StyledTitleInputWrapper","StyledMotionTitle","$isOpen","undefined","$hasSearch","$color","StyledMotionTitleElementWrapper","StyledRightWrapper","StyledMotionSearchWrapper","StyledMotionRightElementWrapper","StyledMotionRightInput","input","$hasIcon","StyledMotionRightInputIconWrapper"],"sources":["../../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionAccordionHeadProps = WithTheme<unknown>;\n\nexport const StyledMotionAccordionHead = styled(motion.div)<StyledMotionAccordionHeadProps>`\n align-items: center;\n color: ${({ theme }: StyledMotionAccordionHeadProps) => theme.text};\n display: flex;\n overflow: hidden;\n padding: 4px 0;\n`;\n\nexport const StyledMotionIconWrapper = styled(motion.div)`\n align-items: center;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'inherit')};\n display: flex;\n flex: 0 0 auto;\n height: 25px;\n justify-content: center;\n width: 25px;\n`;\n\ntype StyledMotionContentWrapperProps = WithTheme<{ $isWrapped: boolean }>;\n\nexport const StyledMotionContentWrapper = styled(motion.div)<StyledMotionContentWrapperProps>`\n align-self: flex-start;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'inherit')};\n display: flex;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n margin-right: 10px;\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n align-items: center;\n `}\n`;\n\nexport const StyledMotionTitleWrapper = styled(motion.div)`\n display: grid;\n flex: 0 1 auto;\n grid-template-areas: 'header';\n`;\n\nexport const StyledTitleInputWrapper = styled.div`\n width: 100%;\n`;\n\ntype StyledMotionTitleProps = WithTheme<{\n $isOpen: boolean;\n $isWrapped: boolean;\n $color?: CSSProperties['color'];\n $hasSearch: boolean;\n}>;\n\nexport const StyledMotionTitle = styled(motion.div)<StyledMotionTitleProps>`\n font-size: ${({ $isOpen, $isWrapped }) => ($isOpen && !$isWrapped ? '1.3rem' : undefined)};\n font-weight: ${({ $isOpen, $isWrapped }) => ($isOpen && $isWrapped ? 700 : 'normal')};\n grid-area: header;\n height: ${({ $isWrapped, $hasSearch }) => ($isWrapped || $hasSearch ? '100%' : undefined)};\n overflow: hidden;\n text-overflow: ellipsis;\n transform-origin: top left;\n user-select: none;\n color: ${({ $color, theme }: StyledMotionTitleProps) => $color ?? theme.text};\n white-space: ${({ $isOpen, $isWrapped, $hasSearch }) =>\n $isOpen && !$isWrapped && !$hasSearch ? 'normal' : 'nowrap'};\n\n will-change: unset !important;\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n align-content: center;\n `}\n`;\n\nexport const StyledMotionTitleElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n`;\n\ntype StyledRightWrapperProps = {\n $isSearchActive: boolean;\n};\n\nexport const StyledRightWrapper = styled.div<StyledRightWrapperProps>`\n display: flex;\n flex: 0 0 auto;\n gap: 8px;\n margin-right: 5px;\n overflow: hidden;\n position: relative;\n`;\n\nexport const StyledMotionSearchWrapper = styled(motion.div)`\n align-items: center;\n justify-content: end;\n position: relative;\n display: flex;\n width: 100%;\n`;\n\nexport const StyledMotionRightElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'inherit')};\n\n will-change: unset !important;\n`;\n\ntype StyledMotionRightInputProps = WithTheme<{\n $hasIcon: boolean;\n}>;\n\nexport const StyledMotionRightInput = styled(motion.input)<StyledMotionRightInputProps>`\n background-color: transparent;\n border: 1px solid transparent;\n border-bottom-color: rgba(\n ${({ theme }: StyledMotionRightInputProps) => theme['headline-rgb']},\n 0.45\n );\n color: ${({ theme }: StyledMotionRightInputProps) => theme.text};\n grid-area: header;\n padding: ${({ $hasIcon }) => ($hasIcon ? '5px 23px 5px 1px' : '5px 1px')};\n`;\n\nexport const StyledMotionRightInputIconWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n position: absolute;\n right: 4px;\n top: 0;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AAErC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAK/C,OAAO,MAAMC,yBAAyB,GAAGF,MAAM,CAACD,MAAM,CAACI,GAAG,CAAiC;AAC3F;AACA,aAAa,CAAC;EAAEC;AAAsC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACtE;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAAGN,MAAM,CAACD,MAAM,CAACI,GAAG,CAAC;AACzD;AACA,cAAc,CAAC;EAAEI;AAAQ,CAAC,KAAM,OAAOA,OAAO,KAAK,UAAU,GAAG,SAAS,GAAG,SAAU;AACtF;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMC,0BAA0B,GAAGR,MAAM,CAACD,MAAM,CAACI,GAAG,CAAkC;AAC7F;AACA,cAAc,CAAC;EAAEI;AAAQ,CAAC,KAAM,OAAOA,OAAO,KAAK,UAAU,GAAG,SAAS,GAAG,SAAU;AACtF;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEE;AAAW,CAAC,KACbA,UAAU,IACVR,G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AAC3D;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMiB,+BAA+B,GAAGpB,MAAM,CAACD,MAAM,CAACI,GAAG,CAAC;AACjE;AACA;AACA;AACA,cAAc,CAAC;EAAEI;AAAQ,CAAC,KAAM,OAAOA,OAAO,KAAK,UAAU,GAAG,SAAS,GAAG,SAAU;AACtF;AACA;AACA,CAAC;AAMD,OAAO,MAAMc,sBAAsB,GAAGrB,MAAM,CAACD,MAAM,CAACuB,KAAK,CAA8B;AACvF;AACA;AACA;AACA,UAAU,CAAC;EAAElB;AAAmC,CAAC,KAAKA,KAAK,CAAC,cAAc,CAAC;AAC3E;AACA;AACA,aAAa,CAAC;EAAEA;AAAmC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACnE;AACA,eAAe,CAAC;EAAEkB;AAAS,CAAC,KAAMA,QAAQ,GAAG,kBAAkB,GAAG,SAAU;AAC5E,CAAC;AAED,OAAO,MAAMC,iCAAiC,GAAGxB,MAAM,CAACD,MAAM,CAACI,GAAG,CAAC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  import { AnimatePresence } from 'motion/react';
2
2
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { checkForValidAmount } from '../../utils/amountControl';
4
- import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
5
4
  import Icon from '../icon/Icon';
6
5
  import { StyledAmountControl, StyledAmountControlInput, StyledAmountControlPseudoInput, StyledInputWrapper, StyledMotionAmountControlButton } from './AmountControl.styles';
7
6
  const AmountControl = ({
@@ -13,18 +12,15 @@ const AmountControl = ({
13
12
  maxAmount,
14
13
  minAmount = 0,
15
14
  onChange,
16
- shouldEnableKeyboardHighlighting,
17
15
  shouldForceLabel = false,
18
16
  shouldShowAddIconOnMinAmount = false,
19
17
  shouldShowIcon = true,
20
18
  shouldShowWideInput = false,
21
19
  step: stepProp = 1
22
20
  }) => {
23
- const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
24
21
  const [amountValue, setAmountValue] = useState(minAmount);
25
22
  const [inputValue, setInputValue] = useState(minAmount.toString());
26
23
  const [displayState, setDisplayState] = useState('default');
27
- const [isEditing, setIsEditing] = useState(false);
28
24
  const step = useMemo(() => Number.isSafeInteger(stepProp) && stepProp >= 1 ? stepProp : 1, [stepProp]);
29
25
  const inputRef = useRef(null);
30
26
 
@@ -106,9 +102,6 @@ const AmountControl = ({
106
102
  }).toString());
107
103
  }, [displayState, maxAmount, minAmount, onChange, step]);
108
104
  const handleFirstAmount = useCallback(() => {
109
- if (isDisabled) {
110
- return;
111
- }
112
105
  if (amountValue !== minAmount) {
113
106
  return;
114
107
  }
@@ -117,16 +110,16 @@ const AmountControl = ({
117
110
  }
118
111
  setAmountValue(minAmount + step);
119
112
  setInputValue((minAmount + step).toString());
120
- }, [amountValue, isDisabled, minAmount, onChange, step]);
121
- const handlePseudoInputClick = useCallback(() => {
122
- if (isDisabled) {
123
- return;
113
+ }, [amountValue, minAmount, onChange, step]);
114
+ const handleDeleteIconClick = useCallback(() => {
115
+ if (inputValue === '0') {
116
+ window.setTimeout(() => {
117
+ inputRef.current?.focus();
118
+ }, 500);
119
+ } else {
120
+ handleAmountRemove();
124
121
  }
125
- setIsEditing(true);
126
- window.requestAnimationFrame(() => {
127
- inputRef.current?.focus();
128
- });
129
- }, [isDisabled]);
122
+ }, [handleAmountRemove, inputValue]);
130
123
  const handleInputBlur = useCallback(() => {
131
124
  const checkedValue = checkForValidAmount({
132
125
  minAmount,
@@ -135,7 +128,6 @@ const AmountControl = ({
135
128
  });
136
129
  setAmountValue(checkedValue);
137
130
  setInputValue(checkedValue.toString());
138
- setIsEditing(false);
139
131
  if (typeof onChange === 'function') {
140
132
  onChange(checkedValue);
141
133
  }
@@ -158,14 +150,12 @@ const AmountControl = ({
158
150
  if (typeof label === 'string' && (displayState === 'default' || shouldForceLabel)) {
159
151
  inputLabel = label;
160
152
  }
161
- const shouldShowPseudoInput = !isEditing && (inputValue === '0' || shouldForceLabel && typeof label === 'string' || inputLabel === label);
162
153
  return useMemo(() => /*#__PURE__*/React.createElement(StyledAmountControl, {
163
154
  onClick: handleFirstAmount,
164
155
  $isDisabled: isDisabled
165
156
  }, /*#__PURE__*/React.createElement(AnimatePresence, {
166
157
  initial: false
167
158
  }, ['normal'].includes(displayState) && /*#__PURE__*/React.createElement(StyledMotionAmountControlButton, {
168
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
169
159
  key: "left_button",
170
160
  initial: {
171
161
  width: 0,
@@ -187,14 +177,14 @@ const AmountControl = ({
187
177
  type: 'tween'
188
178
  },
189
179
  onClick: handleAmountRemove,
190
- disabled: isDisabled || amountValue !== 0 && amountValue <= minAmount,
191
- $isDisabled: isDisabled || amountValue !== 0 && amountValue <= minAmount
180
+ disabled: amountValue !== 0 && amountValue <= minAmount,
181
+ $isDisabled: amountValue !== 0 && amountValue <= minAmount
192
182
  }, /*#__PURE__*/React.createElement(Icon, {
193
183
  icons: ['fa fa-minus'],
194
184
  size: 14,
195
185
  color: "white"
196
- }))), /*#__PURE__*/React.createElement(StyledInputWrapper, null, shouldShowPseudoInput ? /*#__PURE__*/React.createElement(StyledAmountControlPseudoInput, {
197
- onClick: handlePseudoInputClick,
186
+ }))), /*#__PURE__*/React.createElement(StyledInputWrapper, null, displayState === 'maxAmount' || inputValue === '0' || shouldForceLabel && typeof label === 'string' || inputLabel === label ? /*#__PURE__*/React.createElement(StyledAmountControlPseudoInput, {
187
+ onClick: handleDeleteIconClick,
198
188
  $shouldShowWideInput: shouldShowWideInput,
199
189
  $shouldShowRightIcon: !['maxAmount'].includes(displayState)
200
190
  }, inputLabel) : /*#__PURE__*/React.createElement(StyledAmountControlInput, {
@@ -203,16 +193,12 @@ const AmountControl = ({
203
193
  $shouldShowIcon: shouldShowIcon,
204
194
  $shouldShowWideInput: shouldShowWideInput,
205
195
  $hasFocus: hasFocus,
206
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
207
- disabled: isDisabled,
208
- onFocus: () => setIsEditing(true),
209
196
  onBlur: handleInputBlur,
210
197
  onChange: handleInputChange,
211
198
  value: inputLabel
212
199
  })), /*#__PURE__*/React.createElement(AnimatePresence, {
213
200
  initial: false
214
201
  }, /*#__PURE__*/React.createElement(StyledMotionAmountControlButton, {
215
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
216
202
  key: "right_button",
217
203
  initial: {
218
204
  width: 0,
@@ -235,13 +221,13 @@ const AmountControl = ({
235
221
  },
236
222
  $color: displayState === 'maxAmount' ? 'rgb(32, 198, 90)' : undefined,
237
223
  onClick: displayState === 'maxAmount' ? handleAmountRemove : handleAmountAdd,
238
- disabled: isDisabled || (maxAmount ? amountValue >= maxAmount : false),
239
- $isDisabled: isDisabled || (maxAmount ? amountValue >= maxAmount : false)
224
+ disabled: maxAmount ? amountValue >= maxAmount : false,
225
+ $isDisabled: maxAmount ? amountValue >= maxAmount : false
240
226
  }, /*#__PURE__*/React.createElement(Icon, {
241
227
  icons: !['normal'].includes(displayState) && icon ? [displayState === 'maxAmount' ? 'fa fa-check' : icon] : [displayState === 'maxAmount' ? 'fa fa-check' : 'fa fa-plus'],
242
228
  size: 14,
243
229
  color: iconColor ?? 'white'
244
- })))), [amountValue, displayState, handleAmountAdd, handleAmountRemove, handleFirstAmount, handleInputBlur, handleInputChange, handlePseudoInputClick, hasFocus, icon, iconColor, inputLabel, isDisabled, maxAmount, minAmount, shouldShowIcon, shouldShowKeyboardHighlighting, shouldShowPseudoInput, shouldShowWideInput]);
230
+ })))), [amountValue, displayState, handleAmountAdd, handleAmountRemove, handleDeleteIconClick, handleFirstAmount, handleInputBlur, handleInputChange, hasFocus, icon, iconColor, inputLabel, inputValue, isDisabled, label, maxAmount, minAmount, shouldForceLabel, shouldShowIcon, shouldShowWideInput]);
245
231
  };
246
232
  AmountControl.displayName = 'AmountControl';
247
233
  export default AmountControl;
@@ -1 +1 @@
1
- {"version":3,"file":"AmountControl.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","checkForValidAmount","useKeyboardFocusHighlighting","Icon","StyledAmountControl","StyledAmountControlInput","StyledAmountControlPseudoInput","StyledInputWrapper","StyledMotionAmountControlButton","AmountControl","amount","icon","iconColor","isDisabled","label","maxAmount","minAmount","onChange","shouldEnableKeyboardHighlighting","shouldForceLabel","shouldShowAddIconOnMinAmount","shouldShowIcon","shouldShowWideInput","step","stepProp","shouldShowKeyboardHighlighting","amountValue","setAmountValue","inputValue","setInputValue","toString","displayState","setDisplayState","isEditing","setIsEditing","Number","isSafeInteger","inputRef","hasFocus","handleAmountAdd","prevState","newAmount","handleAmountRemove","handleFirstAmount","handlePseudoInputClick","window","requestAnimationFrame","current","focus","handleInputBlur","checkedValue","Math","round","handleInputChange","event","value","target","valueBefore","replace","inputLabel","shouldShowPseudoInput","createElement","onClick","$isDisabled","initial","includes","$shouldShowKeyboardHighlighting","key","width","opacity","padding","animate","exit","transition","duration","type","disabled","icons","size","color","$shouldShowWideInput","$shouldShowRightIcon","ref","$displayState","$shouldShowIcon","$hasFocus","onFocus","onBlur","$color","undefined","displayName"],"sources":["../../../../src/components/amount-control/AmountControl.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { ChangeEvent, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { checkForValidAmount } from '../../utils/amountControl';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport Icon from '../icon/Icon';\nimport {\n StyledAmountControl,\n StyledAmountControlInput,\n StyledAmountControlPseudoInput,\n StyledInputWrapper,\n StyledMotionAmountControlButton,\n} from './AmountControl.styles';\n\nexport type DisplayState = 'default' | 'normal' | 'maxAmount' | 'minAmount';\n\nexport type AmountControlProps = {\n /**\n * The amount that should be displayed.\n */\n amount?: number;\n /**\n * The icon that should be displayed if no amount is selected.\n */\n icon?: string;\n /**\n * The color of the icon.\n */\n iconColor?: string;\n /**\n * Whether the control should be disabled\n */\n isDisabled?: boolean;\n /**\n * A Text that should be displayed if no amount is selected;\n */\n label?: string;\n /**\n * The maximum allowed amount. If the maxAmount is reached, a check icon is displayed on the left side.\n */\n maxAmount?: number;\n /**\n * The minimum allowed amount.\n */\n minAmount?: number;\n /**\n * A Function that is executed when the amount is changed\n */\n onChange?: (amount: number) => void;\n /**\n * Enables keyboard-only focus highlighting. The highlighting is only visible while the\n * user navigates with the keyboard and is reset on mouse movement or click.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Whether the label should be displayed even if an amount is selected.\n */\n shouldForceLabel?: boolean;\n /**\n * Whether the \"add\"-icon should be displayed if the minAmount is reached.\n */\n shouldShowAddIconOnMinAmount?: boolean;\n /**\n * Whether the icon should be displayed if no amount is selected\n */\n shouldShowIcon?: boolean;\n /**\n * Whether the input should be wider\n */\n shouldShowWideInput?: boolean;\n /**\n * Defines the amount that will change when adjusted\n */\n step?: number;\n};\n\nconst AmountControl: FC<AmountControlProps> = ({\n amount,\n icon,\n iconColor,\n isDisabled = false,\n label,\n maxAmount,\n minAmount = 0,\n onChange,\n shouldEnableKeyboardHighlighting,\n shouldForceLabel = false,\n shouldShowAddIconOnMinAmount = false,\n shouldShowIcon = true,\n shouldShowWideInput = false,\n step: stepProp = 1,\n}) => {\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n const [amountValue, setAmountValue] = useState(minAmount);\n const [inputValue, setInputValue] = useState(minAmount.toString());\n const [displayState, setDisplayState] = useState<DisplayState>('default');\n const [isEditing, setIsEditing] = useState(false);\n\n const step = useMemo(\n () => (Number.isSafeInteger(stepProp) && stepProp >= 1 ? stepProp : 1),\n [stepProp],\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n /**\n * This function controls the displayState\n */\n useEffect(() => {\n switch (true) {\n case maxAmount && amountValue >= maxAmount:\n setDisplayState('maxAmount');\n return;\n case amountValue > minAmount:\n setDisplayState('normal');\n return;\n case amountValue === minAmount && amountValue >= 0 && shouldShowAddIconOnMinAmount:\n setDisplayState('minAmount');\n return;\n default:\n setDisplayState('default');\n }\n }, [amountValue, maxAmount, minAmount, shouldShowAddIconOnMinAmount]);\n\n const hasFocus = useMemo(() => displayState !== 'default', [displayState]);\n\n /**\n * Function that sets the amountValue to the amount\n */\n useEffect(() => {\n if (typeof amount !== 'number') {\n return;\n }\n\n setAmountValue(checkForValidAmount({ amount, maxAmount, minAmount }));\n setInputValue(checkForValidAmount({ amount, maxAmount, minAmount }).toString());\n }, [amount, maxAmount, minAmount]);\n\n const handleAmountAdd = useCallback(() => {\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState + step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return typeof amount === 'number' ? prevState : newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) + step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [amount, maxAmount, minAmount, onChange, step]);\n\n const handleAmountRemove = useCallback(() => {\n if (displayState === 'default') {\n return;\n }\n\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState - step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) - step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [displayState, maxAmount, minAmount, onChange, step]);\n\n const handleFirstAmount = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (amountValue !== minAmount) {\n return;\n }\n\n if (typeof onChange === 'function') {\n onChange(minAmount + step);\n }\n\n setAmountValue(minAmount + step);\n setInputValue((minAmount + step).toString());\n }, [amountValue, isDisabled, minAmount, onChange, step]);\n\n const handlePseudoInputClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n setIsEditing(true);\n\n window.requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n }, [isDisabled]);\n\n const handleInputBlur = useCallback(() => {\n const checkedValue = checkForValidAmount({\n minAmount,\n maxAmount,\n amount: Math.round(Number(inputValue) / step) * step,\n });\n\n setAmountValue(checkedValue);\n setInputValue(checkedValue.toString());\n setIsEditing(false);\n\n if (typeof onChange === 'function') {\n onChange(checkedValue);\n }\n\n if (inputValue === '') {\n setInputValue(minAmount.toString());\n }\n }, [inputValue, maxAmount, minAmount, onChange, step]);\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const { value } = event.target;\n\n const valueBefore = Number(value.replace(/\\D/g, ''));\n\n if (valueBefore < minAmount && minAmount === 0) {\n setInputValue('0');\n\n return;\n }\n\n setInputValue(valueBefore === 0 ? '' : valueBefore.toString());\n },\n [minAmount],\n );\n\n let inputLabel = inputValue;\n\n if (typeof label === 'string' && (displayState === 'default' || shouldForceLabel)) {\n inputLabel = label;\n }\n\n const shouldShowPseudoInput =\n !isEditing &&\n (inputValue === '0' ||\n (shouldForceLabel && typeof label === 'string') ||\n inputLabel === label);\n\n return useMemo(\n () => (\n <StyledAmountControl onClick={handleFirstAmount} $isDisabled={isDisabled}>\n <AnimatePresence initial={false}>\n {['normal'].includes(displayState) && (\n <StyledMotionAmountControlButton\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n key=\"left_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n onClick={handleAmountRemove}\n disabled={isDisabled || (amountValue !== 0 && amountValue <= minAmount)}\n $isDisabled={\n isDisabled || (amountValue !== 0 && amountValue <= minAmount)\n }\n >\n <Icon icons={['fa fa-minus']} size={14} color=\"white\" />\n </StyledMotionAmountControlButton>\n )}\n </AnimatePresence>\n <StyledInputWrapper>\n {shouldShowPseudoInput ? (\n <StyledAmountControlPseudoInput\n onClick={handlePseudoInputClick}\n $shouldShowWideInput={shouldShowWideInput}\n $shouldShowRightIcon={!['maxAmount'].includes(displayState)}\n >\n {inputLabel}\n </StyledAmountControlPseudoInput>\n ) : (\n <StyledAmountControlInput\n ref={inputRef}\n $displayState={displayState}\n $shouldShowIcon={shouldShowIcon}\n $shouldShowWideInput={shouldShowWideInput}\n $hasFocus={hasFocus}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n disabled={isDisabled}\n onFocus={() => setIsEditing(true)}\n onBlur={handleInputBlur}\n onChange={handleInputChange}\n value={inputLabel}\n />\n )}\n </StyledInputWrapper>\n <AnimatePresence initial={false}>\n <StyledMotionAmountControlButton\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n key=\"right_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n $color={displayState === 'maxAmount' ? 'rgb(32, 198, 90)' : undefined}\n onClick={\n displayState === 'maxAmount' ? handleAmountRemove : handleAmountAdd\n }\n disabled={isDisabled || (maxAmount ? amountValue >= maxAmount : false)}\n $isDisabled={isDisabled || (maxAmount ? amountValue >= maxAmount : false)}\n >\n <Icon\n icons={\n !['normal'].includes(displayState) && icon\n ? [displayState === 'maxAmount' ? 'fa fa-check' : icon]\n : [displayState === 'maxAmount' ? 'fa fa-check' : 'fa fa-plus']\n }\n size={14}\n color={iconColor ?? 'white'}\n />\n </StyledMotionAmountControlButton>\n </AnimatePresence>\n </StyledAmountControl>\n ),\n [\n amountValue,\n displayState,\n handleAmountAdd,\n handleAmountRemove,\n handleFirstAmount,\n handleInputBlur,\n handleInputChange,\n handlePseudoInputClick,\n hasFocus,\n icon,\n iconColor,\n inputLabel,\n isDisabled,\n maxAmount,\n minAmount,\n shouldShowIcon,\n shouldShowKeyboardHighlighting,\n shouldShowPseudoInput,\n shouldShowWideInput,\n ],\n );\n};\n\nAmountControl.displayName = 'AmountControl';\n\nexport default AmountControl;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAAqBC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACjG,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,4BAA4B,QAAQ,0CAA0C;AACvF,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA8B,EAC9BC,kBAAkB,EAClBC,+BAA+B,QAC5B,wBAAwB;AAgE/B,MAAMC,aAAqC,GAAGA,CAAC;EAC3CC,MAAM;EACNC,IAAI;EACJC,SAAS;EACTC,UAAU,GAAG,KAAK;EAClBC,KAAK;EACLC,SAAS;EACTC,SAAS,GAAG,CAAC;EACbC,QAAQ;EACRC,gCAAgC;EAChCC,gBAAgB,GAAG,KAAK;EACxBC,4BAA4B,GAAG,KAAK;EACpCC,cAAc,GAAG,IAAI;EACrBC,mBAAmB,GAAG,KAAK;EAC3BC,IAAI,EAAEC,QAAQ,GAAG;AACrB,CAAC,KAAK;EACF,MAAMC,8BAA8B,GAAGvB,4BAA4B,CAC/DgB,gCAAgC,IAAI,CAACL,UACzC,CAAC;EAED,MAAM,CAACa,WAAW,EAAEC,cAAc,CAAC,GAAG3B,QAAQ,CAACgB,SAAS,CAAC;EACzD,MAAM,CAACY,UAAU,EAAEC,aAAa,CAAC,GAAG7B,QAAQ,CAACgB,SAAS,CAACc,QAAQ,CAAC,CAAC,CAAC;EAClE,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGhC,QAAQ,CAAe,SAAS,CAAC;EACzE,MAAM,CAACiC,SAAS,EAAEC,YAAY,CAAC,GAAGlC,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMuB,IAA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I,GACpC,CAACoB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAGpB,IAAI,CAAC,GACrD,CAACoB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAG,YAAY,CACrE;IACD+C,IAAI,EAAE,EAAG;IACTC,KAAK,EAAEnE,SAAS,IAAI;EAAQ,CAC/B,CAC4B,CACpB,CACA,CACxB,EACD,CACIc,WAAW,EACXK,YAAY,EACZQ,eAAe,EACfG,kBAAkB,EAClBC,iBAAiB,EACjBM,eAAe,EACfI,iBAAiB,EACjBT,sBAAsB,EACtBN,QAAQ,EACR3B,IAAI,EACJC,SAAS,EACT+C,UAAU,EACV9C,UAAU,EACVE,SAAS,EACTC,SAAS,EACTK,cAAc,EACdI,8BAA8B,EAC9BmC,qBAAqB,EACrBtC,mBAAmB,CAE3B,CAAC;AACL,CAAC;AAEDb,aAAa,CAACiF,WAAW,GAAG,eAAe;AAE3C,eAAejF,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"AmountControl.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","checkForValidAmount","Icon","StyledAmountControl","StyledAmountControlInput","StyledAmountControlPseudoInput","StyledInputWrapper","StyledMotionAmountControlButton","AmountControl","amount","icon","iconColor","isDisabled","label","maxAmount","minAmount","onChange","shouldForceLabel","shouldShowAddIconOnMinAmount","shouldShowIcon","shouldShowWideInput","step","stepProp","amountValue","setAmountValue","inputValue","setInputValue","toString","displayState","setDisplayState","Number","isSafeInteger","inputRef","hasFocus","handleAmountAdd","prevState","newAmount","handleAmountRemove","handleFirstAmount","handleDeleteIconClick","window","setTimeout","current","focus","handleInputBlur","checkedValue","Math","round","handleInputChange","event","value","target","valueBefore","replace","inputLabel","createElement","onClick","$isDisabled","initial","includes","key","width","opacity","padding","animate","exit","transition","duration","type","disabled","icons","size","color","$shouldShowWideInput","$shouldShowRightIcon","ref","$displayState","$shouldShowIcon","$hasFocus","onBlur","$color","undefined","displayName"],"sources":["../../../../src/components/amount-control/AmountControl.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEvent,\n FC,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { checkForValidAmount } from '../../utils/amountControl';\nimport Icon from '../icon/Icon';\nimport {\n StyledAmountControl,\n StyledAmountControlInput,\n StyledAmountControlPseudoInput,\n StyledInputWrapper,\n StyledMotionAmountControlButton,\n} from './AmountControl.styles';\n\nexport type DisplayState = 'default' | 'normal' | 'maxAmount' | 'minAmount';\n\nexport type AmountControlProps = {\n /**\n * The amount that should be displayed.\n */\n amount?: number;\n /**\n * The icon that should be displayed if no amount is selected.\n */\n icon?: string;\n /**\n * The color of the icon.\n */\n iconColor?: string;\n /**\n * Whether the control should be disabled\n */\n isDisabled?: boolean;\n /**\n * A Text that should be displayed if no amount is selected;\n */\n label?: string;\n /**\n * The maximum allowed amount. If the maxAmount is reached, a check icon is displayed on the left side.\n */\n maxAmount?: number;\n /**\n * The minimum allowed amount.\n */\n minAmount?: number;\n /**\n * A Function that is executed when the amount is changed\n */\n onChange?: (amount: number) => void;\n /**\n * Whether the label should be displayed even if an amount is selected.\n */\n shouldForceLabel?: boolean;\n /**\n * Whether the \"add\"-icon should be displayed if the minAmount is reached.\n */\n shouldShowAddIconOnMinAmount?: boolean;\n /**\n * Whether the icon should be displayed if no amount is selected\n */\n shouldShowIcon?: boolean;\n /**\n * Whether the input should be wider\n */\n shouldShowWideInput?: boolean;\n /**\n * Defines the amount that will change when adjusted\n */\n step?: number;\n};\n\nconst AmountControl: FC<AmountControlProps> = ({\n amount,\n icon,\n iconColor,\n isDisabled = false,\n label,\n maxAmount,\n minAmount = 0,\n onChange,\n shouldForceLabel = false,\n shouldShowAddIconOnMinAmount = false,\n shouldShowIcon = true,\n shouldShowWideInput = false,\n step: stepProp = 1,\n}) => {\n const [amountValue, setAmountValue] = useState(minAmount);\n const [inputValue, setInputValue] = useState(minAmount.toString());\n const [displayState, setDisplayState] = useState<DisplayState>('default');\n\n const step = useMemo(\n () => (Number.isSafeInteger(stepProp) && stepProp >= 1 ? stepProp : 1),\n [stepProp],\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n /**\n * This function controls the displayState\n */\n useEffect(() => {\n switch (true) {\n case maxAmount && amountValue >= maxAmount:\n setDisplayState('maxAmount');\n return;\n case amountValue > minAmount:\n setDisplayState('normal');\n return;\n case amountValue === minAmount && amountValue >= 0 && shouldShowAddIconOnMinAmount:\n setDisplayState('minAmount');\n return;\n default:\n setDisplayState('default');\n }\n }, [amountValue, maxAmount, minAmount, shouldShowAddIconOnMinAmount]);\n\n const hasFocus = useMemo(() => displayState !== 'default', [displayState]);\n\n /**\n * Function that sets the amountValue to the amount\n */\n useEffect(() => {\n if (typeof amount !== 'number') {\n return;\n }\n\n setAmountValue(checkForValidAmount({ amount, maxAmount, minAmount }));\n setInputValue(checkForValidAmount({ amount, maxAmount, minAmount }).toString());\n }, [amount, maxAmount, minAmount]);\n\n const handleAmountAdd = useCallback(() => {\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState + step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return typeof amount === 'number' ? prevState : newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) + step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [amount, maxAmount, minAmount, onChange, step]);\n\n const handleAmountRemove = useCallback(() => {\n if (displayState === 'default') {\n return;\n }\n\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState - step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) - step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [displayState, maxAmount, minAmount, onChange, step]);\n\n const handleFirstAmount = useCallback(() => {\n if (amountValue !== minAmount) {\n return;\n }\n\n if (typeof onChange === 'function') {\n onChange(minAmount + step);\n }\n\n setAmountValue(minAmount + step);\n setInputValue((minAmount + step).toString());\n }, [amountValue, minAmount, onChange, step]);\n\n const handleDeleteIconClick = useCallback(() => {\n if (inputValue === '0') {\n window.setTimeout(() => {\n inputRef.current?.focus();\n }, 500);\n } else {\n handleAmountRemove();\n }\n }, [handleAmountRemove, inputValue]);\n\n const handleInputBlur = useCallback(() => {\n const checkedValue = checkForValidAmount({\n minAmount,\n maxAmount,\n amount: Math.round(Number(inputValue) / step) * step,\n });\n\n setAmountValue(checkedValue);\n setInputValue(checkedValue.toString());\n\n if (typeof onChange === 'function') {\n onChange(checkedValue);\n }\n\n if (inputValue === '') {\n setInputValue(minAmount.toString());\n }\n }, [inputValue, maxAmount, minAmount, onChange, step]);\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const { value } = event.target;\n\n const valueBefore = Number(value.replace(/\\D/g, ''));\n\n if (valueBefore < minAmount && minAmount === 0) {\n setInputValue('0');\n\n return;\n }\n\n setInputValue(valueBefore === 0 ? '' : valueBefore.toString());\n },\n [minAmount],\n );\n\n let inputLabel = inputValue;\n\n if (typeof label === 'string' && (displayState === 'default' || shouldForceLabel)) {\n inputLabel = label;\n }\n\n return useMemo(\n () => (\n <StyledAmountControl onClick={handleFirstAmount} $isDisabled={isDisabled}>\n <AnimatePresence initial={false}>\n {['normal'].includes(displayState) && (\n <StyledMotionAmountControlButton\n key=\"left_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n onClick={handleAmountRemove}\n disabled={amountValue !== 0 && amountValue <= minAmount}\n $isDisabled={amountValue !== 0 && amountValue <= minAmount}\n >\n <Icon icons={['fa fa-minus']} size={14} color=\"white\" />\n </StyledMotionAmountControlButton>\n )}\n </AnimatePresence>\n <StyledInputWrapper>\n {displayState === 'maxAmount' ||\n inputValue === '0' ||\n (shouldForceLabel && typeof label === 'string') ||\n inputLabel === label ? (\n <StyledAmountControlPseudoInput\n onClick={handleDeleteIconClick}\n $shouldShowWideInput={shouldShowWideInput}\n $shouldShowRightIcon={!['maxAmount'].includes(displayState)}\n >\n {inputLabel}\n </StyledAmountControlPseudoInput>\n ) : (\n <StyledAmountControlInput\n ref={inputRef}\n $displayState={displayState}\n $shouldShowIcon={shouldShowIcon}\n $shouldShowWideInput={shouldShowWideInput}\n $hasFocus={hasFocus}\n onBlur={handleInputBlur}\n onChange={handleInputChange}\n value={inputLabel}\n />\n )}\n </StyledInputWrapper>\n <AnimatePresence initial={false}>\n <StyledMotionAmountControlButton\n key=\"right_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n $color={displayState === 'maxAmount' ? 'rgb(32, 198, 90)' : undefined}\n onClick={\n displayState === 'maxAmount' ? handleAmountRemove : handleAmountAdd\n }\n disabled={maxAmount ? amountValue >= maxAmount : false}\n $isDisabled={maxAmount ? amountValue >= maxAmount : false}\n >\n <Icon\n icons={\n !['normal'].includes(displayState) && icon\n ? [displayState === 'maxAmount' ? 'fa fa-check' : icon]\n : [displayState === 'maxAmount' ? 'fa fa-check' : 'fa fa-plus']\n }\n size={14}\n color={iconColor ?? 'white'}\n />\n </StyledMotionAmountControlButton>\n </AnimatePresence>\n </StyledAmountControl>\n ),\n [\n amountValue,\n displayState,\n handleAmountAdd,\n handleAmountRemove,\n handleDeleteIconClick,\n handleFirstAmount,\n handleInputBlur,\n handleInputChange,\n hasFocus,\n icon,\n iconColor,\n inputLabel,\n inputValue,\n isDisabled,\n label,\n maxAmount,\n minAmount,\n shouldForceLabel,\n shouldShowIcon,\n shouldShowWideInput,\n ],\n );\n};\n\nAmountControl.displayName = 'AmountControl';\n\nexport default AmountControl;\n"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AAK,EAAE,CAAC;MAAEC,OAAO,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAE,CAAE;IAC3CG,UAAU,EAAE;MAAEC,QAAQ,EAAE,GAAG;MAAEC,IAAI,EAAE;IAAQ,CAAE;IAC7CY,MAAM,EAAEpD,YAAY,KAAK,WAAW,GAAG,kBAAkB,GAAGqD,SAAU;IACtEzB,OAAO,EACH5B,YAAY,KAAK,WAAW,GAAGS,kBAAkB,GAAGH,eACvD;IACDmC,QAAQ,EAAEvD,SAAS,GAAGS,WAAW,IAAIT,SAAS,GAAG,KAAM;IACvD2C,WAAW,EAAE3C,SAAS,GAAGS,WAAW,IAAIT,SAAS,GAAG;EAAM,gBAE1DnB,KAAA,CAAA4D,aAAA,CAACrD,IAAI;IACDoE,KAAK,EACD,CAAC,CAAC,QAAQ,CAAC,CAACX,QAAQ,CAAC/B,YAAY,CAAC,IAAIlB,IAAI,GACpC,CAACkB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAGlB,IAAI,CAAC,GACrD,CAACkB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAG,YAAY,CACrE;IACD2C,IAAI,EAAE,EAAG;IACTC,KAAK,EAAE7D,SAAS,IAAI;EAAQ,CAC/B,CAC4B,CACpB,CACA,CACxB,EACD,CACIY,WAAW,EACXK,YAAY,EACZM,eAAe,EACfG,kBAAkB,EAClBE,qBAAqB,EACrBD,iBAAiB,EACjBM,eAAe,EACfI,iBAAiB,EACjBf,QAAQ,EACRvB,IAAI,EACJC,SAAS,EACT2C,UAAU,EACV7B,UAAU,EACVb,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTE,gBAAgB,EAChBE,cAAc,EACdC,mBAAmB,CAE3B,CAAC;AACL,CAAC;AAEDZ,aAAa,CAAC0E,WAAW,GAAG,eAAe;AAE3C,eAAe1E,aAAa","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 StyledAmountControl = styled.div`
5
4
  background-color: ${({
6
5
  theme
@@ -8,6 +7,7 @@ export const StyledAmountControl = styled.div`
8
7
  display: flex;
9
8
  width: fit-content;
10
9
  border-radius: 3px;
10
+ overflow: hidden;
11
11
  transition: opacity 0.2s ease;
12
12
  height: 28px;
13
13
 
@@ -36,14 +36,6 @@ export const StyledAmountControlInput = styled.input`
36
36
  $hasFocus
37
37
  }) => $hasFocus ? 'text' : 'pointer'};
38
38
 
39
- ${({
40
- $shouldShowKeyboardHighlighting
41
- }) => $shouldShowKeyboardHighlighting && css`
42
- &:focus-visible {
43
- ${keyboardFocusHighlightingRingCss}
44
- }
45
- `}
46
-
47
39
  ${({
48
40
  $displayState
49
41
  }) => $displayState === 'maxAmount' && css`
@@ -90,17 +82,9 @@ export const StyledMotionAmountControlButton = styled(motion.button)`
90
82
  }) => $color ?? theme['408']};
91
83
  display: flex;
92
84
  justify-content: center;
93
- //overflow: hidden;
85
+ overflow: hidden;
94
86
  transition: background-color 0.2s ease-in-out;
95
87
 
96
- ${({
97
- $shouldShowKeyboardHighlighting
98
- }) => $shouldShowKeyboardHighlighting && css`
99
- &:focus-visible {
100
- ${keyboardFocusHighlightingRingCss}
101
- }
102
- `};
103
-
104
88
  ${({
105
89
  $isDisabled
106
90
  }) => $isDisabled && css`
@@ -1 +1 @@
1
- {"version":3,"file":"AmountControl.styles.js","names":["motion","styled","css","keyboardFocusHighlightingRingCss","StyledAmountControl","div","theme","$isDisabled","StyledInputWrapper","StyledAmountControlInput","input","$shouldShowWideInput","$hasFocus","$shouldShowKeyboardHighlighting","$displayState","$shouldShowIcon","StyledAmountControlPseudoInput","$shouldShowRightIcon","StyledMotionAmountControlButton","button","$color"],"sources":["../../../../src/components/amount-control/AmountControl.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\nimport type { DisplayState } from './AmountControl';\n\ntype StyledAmountControlProps = WithTheme<{\n $isDisabled: boolean;\n}>;\n\nexport const StyledAmountControl = styled.div<StyledAmountControlProps>`\n background-color: ${({ theme }: StyledAmountControlProps) => theme['202']};\n display: flex;\n width: fit-content;\n border-radius: 3px;\n transition: opacity 0.2s ease;\n height: 28px;\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n pointer-events: none;\n `}\n`;\n\ntype StyledAmountControlInputProps = WithTheme<{\n $displayState: DisplayState;\n $shouldShowIcon: boolean;\n $hasFocus: boolean;\n $shouldShowWideInput: boolean;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nexport const StyledInputWrapper = styled.div<WithTheme<unknown>>`\n background-color: ${({ theme }) => theme['408']};\n`;\n\nexport const StyledAmountControlInput = styled.input<StyledAmountControlInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n text-align: center;\n cursor: ${({ $hasFocus }) => ($hasFocus ? 'text' : 'pointer')};\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n\n ${({ $displayState }) =>\n $displayState === 'maxAmount' &&\n css`\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n `}\n ${({ $displayState, $shouldShowIcon }) =>\n $displayState === 'default' &&\n !$shouldShowIcon &&\n css`\n border-bottom-left-radius: 3px;\n border-top-left-radius: 3px;\n `};\n`;\n\ntype StyledAmountControlPseudoInputProps = WithTheme<{\n $shouldShowWideInput: boolean;\n $shouldShowRightIcon: boolean;\n}>;\n\nexport const StyledAmountControlPseudoInput = styled.div<StyledAmountControlPseudoInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n min-width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n padding: 1px 8px;\n text-align: center;\n cursor: pointer;\n user-select: none;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n border-bottom-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n border-top-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n`;\n\ntype StyledAmountControlButtonProps = WithTheme<{\n $isDisabled: boolean;\n $color?: string;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nexport const StyledMotionAmountControlButton = styled(\n motion.button,\n)<StyledAmountControlButtonProps>`\n align-items: center;\n background-color: ${({ theme, $color }: StyledAmountControlButtonProps) =>\n $color ?? theme['408']};\n display: flex;\n justify-content: center;\n //overflow: hidden;\n transition: background-color 0.2s ease-in-out;\n\n ${({ $shouldShowKeyboardHighlighting }: StyledAmountControlButtonProps) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n ${keyboardFocusHighlightingRingCss}\n }\n `};\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n `}\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,gCAAgC,QAAQ,8CAA8C;AAO/F,OAAO,MAAMC,mBAAmB,GAAGH,MAAM,CAACI,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAgC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAY,CAAC,KACdA,WAAW,IACXL,GAAG;AACX;AACA;AACA,SAAS;AACT,CAAC;AAUD,OAAO,MAAMM,kBAAkB,GAAGP,MAAM,CAACI,GAAuB;AAChE,wBAAwB,CAAC;EAAEC;AAAM,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AAC;EAAEO;AAAgE,CAAC,KAClEA,+BAA+B,IAC/BX,GAAG;AACX;AACA,kBAAkBC,gCAAgC;AAClD;AACA,SAAS;AACT;AACA,MAAM,CAAC;EAAEI;AAAY,CAAC,KACdA,WAAW,IACXL,GAAG;AACX;AACA,SAAS;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"AmountControl.styles.js","names":["motion","styled","css","StyledAmountControl","div","theme","$isDisabled","StyledInputWrapper","StyledAmountControlInput","input","$shouldShowWideInput","$hasFocus","$displayState","$shouldShowIcon","StyledAmountControlPseudoInput","$shouldShowRightIcon","StyledMotionAmountControlButton","button","$color"],"sources":["../../../../src/components/amount-control/AmountControl.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { DisplayState } from './AmountControl';\n\ntype StyledAmountControlProps = WithTheme<{\n $isDisabled: boolean;\n}>;\n\nexport const StyledAmountControl = styled.div<StyledAmountControlProps>`\n background-color: ${({ theme }: StyledAmountControlProps) => theme['202']};\n display: flex;\n width: fit-content;\n border-radius: 3px;\n overflow: hidden;\n transition: opacity 0.2s ease;\n height: 28px;\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n pointer-events: none;\n `}\n`;\n\ntype StyledAmountControlInputProps = WithTheme<{\n $displayState: DisplayState;\n $shouldShowIcon: boolean;\n $hasFocus: boolean;\n $shouldShowWideInput: boolean;\n}>;\n\nexport const StyledInputWrapper = styled.div<WithTheme<unknown>>`\n background-color: ${({ theme }) => theme['408']};\n`;\n\nexport const StyledAmountControlInput = styled.input<StyledAmountControlInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n text-align: center;\n cursor: ${({ $hasFocus }) => ($hasFocus ? 'text' : 'pointer')};\n\n ${({ $displayState }) =>\n $displayState === 'maxAmount' &&\n css`\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n `}\n ${({ $displayState, $shouldShowIcon }) =>\n $displayState === 'default' &&\n !$shouldShowIcon &&\n css`\n border-bottom-left-radius: 3px;\n border-top-left-radius: 3px;\n `};\n`;\n\ntype StyledAmountControlPseudoInputProps = WithTheme<{\n $shouldShowWideInput: boolean;\n $shouldShowRightIcon: boolean;\n}>;\n\nexport const StyledAmountControlPseudoInput = styled.div<StyledAmountControlPseudoInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n min-width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n padding: 1px 8px;\n text-align: center;\n cursor: pointer;\n user-select: none;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n border-bottom-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n border-top-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n`;\n\ntype StyledAmountControlButtonProps = WithTheme<{\n $isDisabled: boolean;\n $color?: string;\n}>;\n\nexport const StyledMotionAmountControlButton = styled(\n motion.button,\n)<StyledAmountControlButtonProps>`\n align-items: center;\n background-color: ${({ theme, $color }: StyledAmountControlButtonProps) =>\n $color ?? theme['408']};\n display: flex;\n justify-content: center;\n overflow: hidden;\n transition: background-color 0.2s ease-in-out;\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n `}\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAQ/C,OAAO,MAAMC,mBAAmB,GAAGF,MAAM,CAACG,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAgC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;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;AAC9B;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAY,CAAC,KACdA,WAAW,IACXJ,GAAG;AACX;AACA,SAAS;AACT,CAAC","ignoreList":[]}
@@ -2,7 +2,6 @@ import clsx from 'clsx';
2
2
  import { AnimatePresence } from 'motion/react';
3
3
  import React, { useMemo } from 'react';
4
4
  import { useTheme } from 'styled-components';
5
- import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
6
5
  import Icon from '../icon/Icon';
7
6
  import { StyledIconWrapper, StyledMotionButton, StyledMotionChildrenWrapper, StyledMotionWaitCursorWrapper } from './Button.styles';
8
7
  import WaitCursor from './wait-cursor/WaitCursor';
@@ -18,8 +17,7 @@ const Button = ({
18
17
  shouldShowAsSelectButton = false,
19
18
  shouldShowTextAsRobotoMedium = true,
20
19
  buttonDesign,
21
- tapDuration = 0.5,
22
- shouldEnableKeyboardHighlighting
20
+ tapDuration = 0.5
23
21
  }) => {
24
22
  const handleClick = event => {
25
23
  if (shouldStopPropagation) {
@@ -30,7 +28,6 @@ const Button = ({
30
28
  const buttonClasses = clsx('beta-chayns-button ellipsis', className);
31
29
  const theme = useTheme();
32
30
  const effectiveButtonDesign = buttonDesign ?? theme.buttonDesign;
33
- const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
34
31
  const iconColor = useMemo(() => {
35
32
  if (isSecondary) {
36
33
  return theme.text;
@@ -73,7 +70,6 @@ const Button = ({
73
70
  $shouldShowTextAsRobotoMedium: shouldShowTextAsRobotoMedium,
74
71
  $shouldShowAsSelectButton: shouldShowAsSelectButton,
75
72
  $shouldShowWaitCursor: shouldShowWaitCursor,
76
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
77
73
  className: buttonClasses,
78
74
  disabled: isDisabled,
79
75
  $isDisabled: isDisabled,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["clsx","AnimatePresence","React","useMemo","useTheme","useKeyboardFocusHighlighting","Icon","StyledIconWrapper","StyledMotionButton","StyledMotionChildrenWrapper","StyledMotionWaitCursorWrapper","WaitCursor","Button","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","shouldShowAsSelectButton","shouldShowTextAsRobotoMedium","buttonDesign","tapDuration","shouldEnableKeyboardHighlighting","handleClick","event","stopPropagation","buttonClasses","theme","effectiveButtonDesign","shouldShowKeyboardHighlighting","iconColor","text","buttonColor","buttonBackgroundColor","backgroundColor","color","tapStyles","opacity","hoverStyles","createElement","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","$shouldShowWaitCursor","$shouldShowKeyboardHighlighting","disabled","$isDisabled","$hasChildren","$hasIcon","$isSecondary","$effectiveButtonDesign","style","visibility","initial","animate","transition","duration","ease","type","whileTap","whileHover","icons","width","exit","key","overflow","shouldHideBackground","displayName"],"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { AnimatePresence } from 'motion/react';\nimport React, { FC, MouseEventHandler, useMemo } from 'react';\nimport { useTheme } from 'styled-components';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledIconWrapper,\n StyledMotionButton,\n StyledMotionChildrenWrapper,\n StyledMotionWaitCursorWrapper,\n} from './Button.styles';\nimport type { ButtonProps } from './Button.types';\nimport WaitCursor from './wait-cursor/WaitCursor';\n\nconst Button: FC<ButtonProps> = ({\n children,\n className,\n icon,\n isDisabled,\n isSecondary,\n onClick,\n shouldShowWaitCursor,\n shouldStopPropagation,\n shouldShowAsSelectButton = false,\n shouldShowTextAsRobotoMedium = true,\n buttonDesign,\n tapDuration = 0.5,\n shouldEnableKeyboardHighlighting,\n}) => {\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n onClick(event);\n };\n\n const buttonClasses = clsx('beta-chayns-button ellipsis', className);\n\n const theme = useTheme() as Theme;\n\n const effectiveButtonDesign = (buttonDesign ?? theme.buttonDesign) as number;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n const iconColor = useMemo(() => {\n if (isSecondary) {\n return theme.text;\n }\n\n return effectiveButtonDesign === 2\n ? (theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white')\n : (theme.buttonColor ?? 'white');\n }, [\n isSecondary,\n theme.buttonBackgroundColor,\n theme.buttonColor,\n effectiveButtonDesign,\n theme.text,\n ]);\n\n const backgroundColor = useMemo(() => {\n let color;\n\n if (isSecondary || shouldShowAsSelectButton) {\n color = theme['202'];\n } else {\n color = theme.buttonBackgroundColor ?? theme['408'];\n }\n\n if (effectiveButtonDesign === 2) {\n color = `rgba(${theme['102-rgb'] ?? ''}, 0)`;\n }\n\n return color;\n }, [isSecondary, shouldShowAsSelectButton, theme, effectiveButtonDesign]);\n\n const tapStyles = useMemo(() => {\n if (effectiveButtonDesign === 2) {\n return {\n backgroundColor:\n isSecondary || shouldShowAsSelectButton\n ? `rgba(${theme['202-rgb'] ?? ''}, 0.7)`\n : `${theme.buttonBackgroundColor ?? ''}40`,\n };\n }\n\n return { opacity: 0.6 };\n }, [isSecondary, shouldShowAsSelectButton, theme, effectiveButtonDesign]);\n\n const hoverStyles = useMemo(() => {\n if (effectiveButtonDesign === 2) {\n return { backgroundColor: `rgba(${theme['102-rgb'] ?? ''}, 0.5)` };\n }\n\n return { opacity: 1 };\n }, [theme, effectiveButtonDesign]);\n\n return (\n <StyledMotionButton\n $shouldShowTextAsRobotoMedium={shouldShowTextAsRobotoMedium}\n $shouldShowAsSelectButton={shouldShowAsSelectButton}\n $shouldShowWaitCursor={shouldShowWaitCursor}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n className={buttonClasses}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n $hasChildren={!!children}\n $hasIcon={typeof icon === 'string' && icon !== ''}\n $isSecondary={isSecondary}\n $effectiveButtonDesign={effectiveButtonDesign}\n onClick={handleClick}\n style={{ visibility: !backgroundColor ? 'hidden' : 'visible', backgroundColor }}\n initial={{ opacity: 0.5 }}\n animate={{\n opacity: isDisabled ? 0.5 : 1,\n }}\n transition={{\n visibility: { duration: 0 },\n duration: tapDuration,\n ease: 'easeIn',\n type: 'tween',\n }}\n whileTap={isDisabled ? {} : { ...tapStyles, transition: { duration: 0 } }}\n whileHover={isDisabled ? {} : { ...hoverStyles }}\n >\n <AnimatePresence initial={false}>\n {icon && (\n <StyledIconWrapper>\n <Icon color={iconColor} icons={[icon]} />\n </StyledIconWrapper>\n )}\n {shouldShowWaitCursor && (\n <StyledMotionWaitCursorWrapper\n animate={{ opacity: 1, width: 40 }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"wait-cursor\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n <WaitCursor color={iconColor ?? 'white'} shouldHideBackground />\n </StyledMotionWaitCursorWrapper>\n )}\n {!shouldShowWaitCursor && children && (\n <StyledMotionChildrenWrapper\n animate={{ opacity: 1, width: 'auto' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"children\"\n // style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionChildrenWrapper>\n )}\n </AnimatePresence>\n </StyledMotionButton>\n );\n};\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAA2BC,OAAO,QAAQ,OAAO;AAC7D,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,4BAA4B,QAAQ,0CAA0C;AAEvF,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,iBAAiB,E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O,EAAE;MAAEhB,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAG,CAAE;IACnCC,IAAI,EAAE;MAAEzB,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAE,CAAE;IAC/BT,OAAO,EAAE;MAAEf,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC,aAAa;IACjBb,KAAK,EAAE;MAAEc,QAAQ,EAAE;IAAS,CAAE;IAC9BV,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,gBAE9BxD,KAAA,CAAAwC,aAAA,CAAC/B,UAAU;IAAC2B,KAAK,EAAEL,SAAS,IAAI,OAAQ;IAACmC,oBAAoB;EAAA,CAAE,CACpC,CAClC,EACA,CAACjD,oBAAoB,IAAIN,QAAQ,iBAC9BX,KAAA,CAAAwC,aAAA,CAACjC,2BAA2B;IACxB+C,OAAO,EAAE;MAAEhB,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAO,CAAE;IACvCC,IAAI,EAAE;MAAEzB,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAE,CAAE;IAC/BT,OAAO,EAAE;MAAEf,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC;IACJ;IAAA;IACAT,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B7C,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDD,MAAM,CAACyD,WAAW,GAAG,QAAQ;AAE7B,eAAezD,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Button.js","names":["clsx","AnimatePresence","React","useMemo","useTheme","Icon","StyledIconWrapper","StyledMotionButton","StyledMotionChildrenWrapper","StyledMotionWaitCursorWrapper","WaitCursor","Button","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","shouldShowAsSelectButton","shouldShowTextAsRobotoMedium","buttonDesign","tapDuration","handleClick","event","stopPropagation","buttonClasses","theme","effectiveButtonDesign","iconColor","text","buttonColor","buttonBackgroundColor","backgroundColor","color","tapStyles","opacity","hoverStyles","createElement","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","$shouldShowWaitCursor","disabled","$isDisabled","$hasChildren","$hasIcon","$isSecondary","$effectiveButtonDesign","style","visibility","initial","animate","transition","duration","ease","type","whileTap","whileHover","icons","width","exit","key","overflow","shouldHideBackground","displayName"],"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { AnimatePresence } from 'motion/react';\nimport React, { FC, MouseEventHandler, useMemo } from 'react';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledIconWrapper,\n StyledMotionButton,\n StyledMotionChildrenWrapper,\n StyledMotionWaitCursorWrapper,\n} from './Button.styles';\nimport type { ButtonProps } from './Button.types';\nimport WaitCursor from './wait-cursor/WaitCursor';\n\nconst Button: FC<ButtonProps> = ({\n children,\n className,\n icon,\n isDisabled,\n isSecondary,\n onClick,\n shouldShowWaitCursor,\n shouldStopPropagation,\n shouldShowAsSelectButton = false,\n shouldShowTextAsRobotoMedium = true,\n buttonDesign,\n tapDuration = 0.5,\n}) => {\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n onClick(event);\n };\n\n const buttonClasses = clsx('beta-chayns-button ellipsis', className);\n\n const theme = useTheme() as Theme;\n\n const effectiveButtonDesign = (buttonDesign ?? theme.buttonDesign) as number;\n\n const iconColor = useMemo(() => {\n if (isSecondary) {\n return theme.text;\n }\n\n return effectiveButtonDesign === 2\n ? (theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white')\n : (theme.buttonColor ?? 'white');\n }, [\n isSecondary,\n theme.buttonBackgroundColor,\n theme.buttonColor,\n effectiveButtonDesign,\n theme.text,\n ]);\n\n const backgroundColor = useMemo(() => {\n let color;\n\n if (isSecondary || shouldShowAsSelectButton) {\n color = theme['202'];\n } else {\n color = theme.buttonBackgroundColor ?? theme['408'];\n }\n\n if (effectiveButtonDesign === 2) {\n color = `rgba(${theme['102-rgb'] ?? ''}, 0)`;\n }\n\n return color;\n }, [isSecondary, shouldShowAsSelectButton, theme, effectiveButtonDesign]);\n\n const tapStyles = useMemo(() => {\n if (effectiveButtonDesign === 2) {\n return {\n backgroundColor:\n isSecondary || shouldShowAsSelectButton\n ? `rgba(${theme['202-rgb'] ?? ''}, 0.7)`\n : `${theme.buttonBackgroundColor ?? ''}40`,\n };\n }\n\n return { opacity: 0.6 };\n }, [isSecondary, shouldShowAsSelectButton, theme, effectiveButtonDesign]);\n\n const hoverStyles = useMemo(() => {\n if (effectiveButtonDesign === 2) {\n return { backgroundColor: `rgba(${theme['102-rgb'] ?? ''}, 0.5)` };\n }\n\n return { opacity: 1 };\n }, [theme, effectiveButtonDesign]);\n\n return (\n <StyledMotionButton\n $shouldShowTextAsRobotoMedium={shouldShowTextAsRobotoMedium}\n $shouldShowAsSelectButton={shouldShowAsSelectButton}\n $shouldShowWaitCursor={shouldShowWaitCursor}\n className={buttonClasses}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n $hasChildren={!!children}\n $hasIcon={typeof icon === 'string' && icon !== ''}\n $isSecondary={isSecondary}\n $effectiveButtonDesign={effectiveButtonDesign}\n onClick={handleClick}\n style={{ visibility: !backgroundColor ? 'hidden' : 'visible', backgroundColor }}\n initial={{ opacity: 0.5 }}\n animate={{\n opacity: isDisabled ? 0.5 : 1,\n }}\n transition={{\n visibility: { duration: 0 },\n duration: tapDuration,\n ease: 'easeIn',\n type: 'tween',\n }}\n whileTap={isDisabled ? {} : { ...tapStyles, transition: { duration: 0 } }}\n whileHover={isDisabled ? {} : { ...hoverStyles }}\n >\n <AnimatePresence initial={false}>\n {icon && (\n <StyledIconWrapper>\n <Icon color={iconColor} icons={[icon]} />\n </StyledIconWrapper>\n )}\n {shouldShowWaitCursor && (\n <StyledMotionWaitCursorWrapper\n animate={{ opacity: 1, width: 40 }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"wait-cursor\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n <WaitCursor color={iconColor ?? 'white'} shouldHideBackground />\n </StyledMotionWaitCursorWrapper>\n )}\n {!shouldShowWaitCursor && children && (\n <StyledMotionChildrenWrapper\n animate={{ opacity: 1, width: 'auto' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"children\"\n // style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionChildrenWrapper>\n )}\n </AnimatePresence>\n </StyledMotionButton>\n );\n};\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAA2BC,OAAO,QAAQ,OAAO;AAC7D,SAASC,QAAQ,QAAQ,mBAAmB;AAE5C,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,iBAAiB,EACjBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,6BAA6B,QAC1B,iBAAiB;AAExB,OAAOC,UAAU,MAAM,0BAA0B;AAEjD,MAAMC,MAAuB,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJC,UAAU;EACVC,WAAW;EACXC,OAAO;EACPC,oBAAoB;EACpBC,qBAAqB;EACrBC,wBAAwB,GAAG,KAAK;EAChCC,4BAA4B,GAAG,IAAI;EACnCC,YAAY;EACZC,WAAW,GAAG;AAClB,CAAC,KAAK;EACF,MAAMC,WAAiD,GAAIC,KAAK,IAAK;IACjE,IAAIN,qBAAqB,EAAE;MACvBM,KAAK,CAACC,eAAe,CAAC,CAAC;IAC3B;IAEAT,OAAO,CAACQ,KAAK,CAAC;EACl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