@chayns-components/core 5.3.12-alpha.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) 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 -17
  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 +5 -52
  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 +6 -100
  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/file-input/FileInput.js +2 -4
  42. package/lib/cjs/components/file-input/FileInput.js.map +1 -1
  43. package/lib/cjs/components/file-list/file-item/FileItem.js +2 -23
  44. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  45. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +1 -19
  46. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  47. package/lib/cjs/components/file-select/FileSelect.js +4 -27
  48. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  49. package/lib/cjs/components/file-select/FileSelect.styles.js +0 -10
  50. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  51. package/lib/cjs/components/filter/Filter.js +16 -51
  52. package/lib/cjs/components/filter/Filter.js.map +1 -1
  53. package/lib/cjs/components/filter/Filter.styles.js +0 -9
  54. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  55. package/lib/cjs/components/filter/filter-content/FilterContent.js +5 -14
  56. package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
  57. package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -1
  58. package/lib/cjs/components/filter-buttons/FilterButtons.js +4 -69
  59. package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
  60. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +2 -40
  61. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  62. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +0 -11
  63. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  64. package/lib/cjs/components/grid-image/GridImage.js +2 -20
  65. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  66. package/lib/cjs/components/grid-image/GridImage.styles.js +2 -11
  67. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  68. package/lib/cjs/components/grouped-image/GroupedImage.js +4 -23
  69. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  70. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +0 -9
  71. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  72. package/lib/cjs/components/highlight-slider/HighlightSlider.js +3 -10
  73. package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
  74. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +4 -21
  75. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  76. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +2 -11
  77. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  78. package/lib/cjs/components/icon/Icon.js +5 -24
  79. package/lib/cjs/components/icon/Icon.js.map +1 -1
  80. package/lib/cjs/components/icon/Icon.styles.js +0 -23
  81. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  82. package/lib/cjs/components/input/Input.js +8 -29
  83. package/lib/cjs/components/input/Input.js.map +1 -1
  84. package/lib/cjs/components/input/Input.styles.js +3 -33
  85. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  86. package/lib/cjs/components/list/List.js +37 -124
  87. package/lib/cjs/components/list/List.js.map +1 -1
  88. package/lib/cjs/components/list/List.utils.js +1 -119
  89. package/lib/cjs/components/list/List.utils.js.map +1 -1
  90. package/lib/cjs/components/list/list-item/ListItem.js +3 -82
  91. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  92. package/lib/cjs/components/list/list-item/ListItem.styles.js +0 -9
  93. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  94. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -40
  95. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  96. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js +1 -5
  97. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  98. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +1 -32
  99. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  100. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +1 -32
  101. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  102. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -30
  103. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  104. package/lib/cjs/components/mention-finder/MentionFinder.js +2 -31
  105. package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
  106. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  107. package/lib/cjs/components/multi-action-button/MultiActionButton.js +3 -36
  108. package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
  109. package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  110. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +1 -7
  111. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  112. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +0 -12
  113. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  114. package/lib/cjs/components/number-input/NumberInput.js +10 -13
  115. package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
  116. package/lib/cjs/components/page-provider/PageProvider.js +2 -4
  117. package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
  118. package/lib/cjs/components/popup/Popup.js +1 -8
  119. package/lib/cjs/components/popup/Popup.js.map +1 -1
  120. package/lib/cjs/components/radio-button/RadioButton.js +15 -29
  121. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  122. package/lib/cjs/components/radio-button/RadioButton.styles.js +8 -19
  123. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  124. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +4 -7
  125. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  126. package/lib/cjs/components/search-box/SearchBox.js +2 -5
  127. package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
  128. package/lib/cjs/components/search-input/SearchInput.js +41 -40
  129. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  130. package/lib/cjs/components/search-input/SearchInput.styles.js +2 -25
  131. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  132. package/lib/cjs/components/select-button/SelectButton.js +2 -4
  133. package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
  134. package/lib/cjs/components/setup-wizard/SetupWizard.js +4 -7
  135. package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
  136. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +3 -5
  137. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  138. package/lib/cjs/components/sharing-bar/SharingBar.js +7 -32
  139. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  140. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +3 -7
  141. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  142. package/lib/cjs/components/sharing-button/SharingButton.js +2 -4
  143. package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
  144. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +1 -3
  145. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  146. package/lib/cjs/components/signature/Signature.js +3 -6
  147. package/lib/cjs/components/signature/Signature.js.map +1 -1
  148. package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js +2 -0
  149. package/lib/cjs/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
  150. package/lib/cjs/components/slider/Slider.js +7 -30
  151. package/lib/cjs/components/slider/Slider.js.map +1 -1
  152. package/lib/cjs/components/slider/Slider.styles.js +2 -9
  153. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  154. package/lib/cjs/components/slider-button/SliderButton.js +6 -63
  155. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  156. package/lib/cjs/components/slider-button/SliderButton.styles.js +2 -19
  157. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  158. package/lib/cjs/components/tag-input/TagInput.js +36 -91
  159. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  160. package/lib/cjs/components/tag-input/TagInput.styles.js +3 -31
  161. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  162. package/lib/cjs/components/text-area/TextArea.js +8 -17
  163. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  164. package/lib/cjs/components/text-area/TextArea.styles.js +1 -15
  165. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  166. package/lib/cjs/components/truncation/Truncation.js +3 -17
  167. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  168. package/lib/cjs/components/truncation/Truncation.styles.js +1 -19
  169. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  170. package/lib/cjs/index.js +6 -0
  171. package/lib/cjs/index.js.map +1 -1
  172. package/lib/cjs/utils/file.js.map +1 -1
  173. package/lib/esm/components/accordion/Accordion.js +12 -105
  174. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  175. package/lib/esm/components/accordion/Accordion.styles.js +3 -23
  176. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  177. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +1 -3
  178. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  179. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +19 -33
  180. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  181. package/lib/esm/components/accordion/accordion-head/AccordionHead.js +3 -6
  182. package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  183. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +0 -14
  184. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  185. package/lib/esm/components/amount-control/AmountControl.js +16 -30
  186. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  187. package/lib/esm/components/amount-control/AmountControl.styles.js +2 -18
  188. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  189. package/lib/esm/components/button/Button.js +1 -5
  190. package/lib/esm/components/button/Button.js.map +1 -1
  191. package/lib/esm/components/button/Button.styles.js +0 -17
  192. package/lib/esm/components/button/Button.styles.js.map +1 -1
  193. package/lib/esm/components/button/Button.types.js.map +1 -1
  194. package/lib/esm/components/checkbox/Checkbox.js +1 -5
  195. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  196. package/lib/esm/components/checkbox/Checkbox.styles.js +2 -29
  197. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  198. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +2 -7
  199. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  200. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +2 -8
  201. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  202. package/lib/esm/components/combobox/ComboBox.js +5 -50
  203. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  204. package/lib/esm/components/combobox/ComboBox.styles.js +0 -11
  205. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  206. package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
  207. package/lib/esm/components/context-menu/ContextMenu.js +5 -99
  208. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  209. package/lib/esm/components/context-menu/ContextMenu.styles.js +0 -38
  210. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  211. package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
  212. package/lib/esm/components/file-input/FileInput.js +2 -4
  213. package/lib/esm/components/file-input/FileInput.js.map +1 -1
  214. package/lib/esm/components/file-list/file-item/FileItem.js +3 -24
  215. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  216. package/lib/esm/components/file-list/file-item/FileItem.styles.js +0 -18
  217. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  218. package/lib/esm/components/file-select/FileSelect.js +4 -27
  219. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  220. package/lib/esm/components/file-select/FileSelect.styles.js +0 -10
  221. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  222. package/lib/esm/components/filter/Filter.js +16 -52
  223. package/lib/esm/components/filter/Filter.js.map +1 -1
  224. package/lib/esm/components/filter/Filter.styles.js +0 -9
  225. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  226. package/lib/esm/components/filter/filter-content/FilterContent.js +5 -15
  227. package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
  228. package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -1
  229. package/lib/esm/components/filter-buttons/FilterButtons.js +5 -69
  230. package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
  231. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +2 -40
  232. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  233. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +0 -11
  234. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  235. package/lib/esm/components/grid-image/GridImage.js +2 -20
  236. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  237. package/lib/esm/components/grid-image/GridImage.styles.js +1 -10
  238. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  239. package/lib/esm/components/grouped-image/GroupedImage.js +4 -22
  240. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  241. package/lib/esm/components/grouped-image/GroupedImage.styles.js +0 -9
  242. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  243. package/lib/esm/components/highlight-slider/HighlightSlider.js +3 -10
  244. package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
  245. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +3 -20
  246. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  247. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +1 -10
  248. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  249. package/lib/esm/components/icon/Icon.js +7 -26
  250. package/lib/esm/components/icon/Icon.js.map +1 -1
  251. package/lib/esm/components/icon/Icon.styles.js +0 -23
  252. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  253. package/lib/esm/components/input/Input.js +4 -24
  254. package/lib/esm/components/input/Input.js.map +1 -1
  255. package/lib/esm/components/input/Input.styles.js +3 -33
  256. package/lib/esm/components/input/Input.styles.js.map +1 -1
  257. package/lib/esm/components/list/List.js +37 -123
  258. package/lib/esm/components/list/List.js.map +1 -1
  259. package/lib/esm/components/list/List.utils.js +0 -111
  260. package/lib/esm/components/list/List.utils.js.map +1 -1
  261. package/lib/esm/components/list/list-item/ListItem.js +4 -83
  262. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  263. package/lib/esm/components/list/list-item/ListItem.styles.js +0 -9
  264. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  265. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +6 -41
  266. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  267. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js +0 -4
  268. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  269. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +2 -33
  270. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  271. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +2 -33
  272. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  273. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -30
  274. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  275. package/lib/esm/components/mention-finder/MentionFinder.js +2 -30
  276. package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
  277. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  278. package/lib/esm/components/multi-action-button/MultiActionButton.js +3 -36
  279. package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
  280. package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  281. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +1 -7
  282. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  283. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +0 -12
  284. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  285. package/lib/esm/components/number-input/NumberInput.js +10 -13
  286. package/lib/esm/components/number-input/NumberInput.js.map +1 -1
  287. package/lib/esm/components/page-provider/PageProvider.js +2 -4
  288. package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
  289. package/lib/esm/components/popup/Popup.js +1 -8
  290. package/lib/esm/components/popup/Popup.js.map +1 -1
  291. package/lib/esm/components/radio-button/RadioButton.js +15 -29
  292. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  293. package/lib/esm/components/radio-button/RadioButton.styles.js +8 -19
  294. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  295. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +4 -7
  296. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  297. package/lib/esm/components/search-box/SearchBox.js +2 -5
  298. package/lib/esm/components/search-box/SearchBox.js.map +1 -1
  299. package/lib/esm/components/search-input/SearchInput.js +42 -41
  300. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  301. package/lib/esm/components/search-input/SearchInput.styles.js +1 -24
  302. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  303. package/lib/esm/components/select-button/SelectButton.js +2 -4
  304. package/lib/esm/components/select-button/SelectButton.js.map +1 -1
  305. package/lib/esm/components/setup-wizard/SetupWizard.js +4 -7
  306. package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
  307. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +3 -5
  308. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  309. package/lib/esm/components/sharing-bar/SharingBar.js +6 -31
  310. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  311. package/lib/esm/components/sharing-bar/SharingBar.styles.js +3 -7
  312. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  313. package/lib/esm/components/sharing-button/SharingButton.js +2 -4
  314. package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
  315. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +1 -3
  316. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  317. package/lib/esm/components/signature/Signature.js +3 -6
  318. package/lib/esm/components/signature/Signature.js.map +1 -1
  319. package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js +2 -0
  320. package/lib/esm/components/skeleton/base-skeleton/BaseSkeleton.styles.js.map +1 -1
  321. package/lib/esm/components/slider/Slider.js +7 -30
  322. package/lib/esm/components/slider/Slider.js.map +1 -1
  323. package/lib/esm/components/slider/Slider.styles.js +1 -8
  324. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  325. package/lib/esm/components/slider-button/SliderButton.js +6 -62
  326. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  327. package/lib/esm/components/slider-button/SliderButton.styles.js +1 -18
  328. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  329. package/lib/esm/components/tag-input/TagInput.js +35 -85
  330. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  331. package/lib/esm/components/tag-input/TagInput.styles.js +1 -29
  332. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  333. package/lib/esm/components/text-area/TextArea.js +9 -18
  334. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  335. package/lib/esm/components/text-area/TextArea.styles.js +0 -14
  336. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  337. package/lib/esm/components/truncation/Truncation.js +4 -18
  338. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  339. package/lib/esm/components/truncation/Truncation.styles.js +0 -18
  340. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  341. package/lib/esm/index.js +1 -1
  342. package/lib/esm/index.js.map +1 -1
  343. package/lib/esm/utils/file.js.map +1 -1
  344. package/lib/types/components/accordion/Accordion.d.ts +0 -5
  345. package/lib/types/components/accordion/Accordion.styles.d.ts +4 -8
  346. package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
  347. package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +2 -7
  348. package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +0 -1
  349. package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
  350. package/lib/types/components/amount-control/AmountControl.d.ts +0 -5
  351. package/lib/types/components/amount-control/AmountControl.styles.d.ts +4 -8
  352. package/lib/types/components/button/Button.styles.d.ts +6 -8
  353. package/lib/types/components/button/Button.types.d.ts +0 -8
  354. package/lib/types/components/checkbox/Checkbox.d.ts +0 -4
  355. package/lib/types/components/checkbox/Checkbox.styles.d.ts +1 -5
  356. package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +0 -5
  357. package/lib/types/components/combobox/ComboBox.styles.d.ts +2 -4
  358. package/lib/types/components/combobox/ComboBox.types.d.ts +0 -5
  359. package/lib/types/components/context-menu/ContextMenu.styles.d.ts +2 -4
  360. package/lib/types/components/context-menu/ContextMenu.types.d.ts +0 -6
  361. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +2 -2
  362. package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +2 -2
  363. package/lib/types/components/expandable-content/ExpandableContent.styles.d.ts +2 -2
  364. package/lib/types/components/file-input/FileInput.d.ts +0 -4
  365. package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
  366. package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +0 -3
  367. package/lib/types/components/file-select/FileSelect.d.ts +0 -4
  368. package/lib/types/components/file-select/FileSelect.styles.d.ts +4 -6
  369. package/lib/types/components/filter/Filter.d.ts +0 -1
  370. package/lib/types/components/filter/Filter.styles.d.ts +4 -6
  371. package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +0 -4
  372. package/lib/types/components/filter-buttons/FilterButtons.d.ts +0 -4
  373. package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +0 -5
  374. package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +8 -12
  375. package/lib/types/components/grid-image/GridImage.d.ts +0 -4
  376. package/lib/types/components/grid-image/GridImage.styles.d.ts +2 -4
  377. package/lib/types/components/grouped-image/GroupedImage.d.ts +0 -4
  378. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +6 -8
  379. package/lib/types/components/highlight-slider/HighlightSlider.d.ts +0 -4
  380. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +0 -3
  381. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +5 -9
  382. package/lib/types/components/icon/Icon.d.ts +0 -4
  383. package/lib/types/components/icon/Icon.styles.d.ts +0 -1
  384. package/lib/types/components/input/Input.d.ts +0 -4
  385. package/lib/types/components/input/Input.styles.d.ts +9 -17
  386. package/lib/types/components/list/List.d.ts +0 -11
  387. package/lib/types/components/list/List.utils.d.ts +1 -16
  388. package/lib/types/components/list/list-item/ListItem.styles.d.ts +64 -64
  389. package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +2 -2
  390. package/lib/types/components/list/list-item/list-item-head/ListItemHead.d.ts +0 -1
  391. package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +194 -195
  392. package/lib/types/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.d.ts +0 -1
  393. package/lib/types/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.d.ts +0 -1
  394. package/lib/types/components/list/list-item/list-item-head/list-item-title/ListItemTitle.d.ts +0 -1
  395. package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +2 -2
  396. package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +4 -4
  397. package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +2 -2
  398. package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +0 -7
  399. package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +1 -4
  400. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +2 -4
  401. package/lib/types/components/number-input/NumberInput.d.ts +0 -4
  402. package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +2 -2
  403. package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +6 -6
  404. package/lib/types/components/radio-button/RadioButton.d.ts +0 -4
  405. package/lib/types/components/radio-button/RadioButton.styles.d.ts +9 -15
  406. package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +0 -5
  407. package/lib/types/components/search-box/SearchBox.d.ts +0 -4
  408. package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
  409. package/lib/types/components/search-input/SearchInput.d.ts +0 -4
  410. package/lib/types/components/search-input/SearchInput.styles.d.ts +9 -17
  411. package/lib/types/components/select-button/SelectButton.d.ts +0 -4
  412. package/lib/types/components/setup-wizard/SetupWizard.d.ts +0 -5
  413. package/lib/types/components/sharing-bar/SharingBar.d.ts +0 -4
  414. package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
  415. package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +2 -10
  416. package/lib/types/components/signature/Signature.d.ts +0 -4
  417. package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
  418. package/lib/types/components/slider/Slider.d.ts +0 -8
  419. package/lib/types/components/slider/Slider.styles.d.ts +14 -18
  420. package/lib/types/components/slider-button/SliderButton.d.ts +28 -1
  421. package/lib/types/components/slider-button/SliderButton.styles.d.ts +4 -6
  422. package/lib/types/components/tag-input/TagInput.d.ts +0 -4
  423. package/lib/types/components/tag-input/TagInput.styles.d.ts +2 -12
  424. package/lib/types/components/text-area/TextArea.d.ts +0 -4
  425. package/lib/types/components/text-area/TextArea.styles.d.ts +0 -1
  426. package/lib/types/components/truncation/Truncation.d.ts +0 -4
  427. package/lib/types/components/truncation/Truncation.styles.d.ts +2 -7
  428. package/lib/types/index.d.ts +1 -1
  429. package/lib/types/utils/file.d.ts +1 -1
  430. package/package.json +3 -3
  431. package/lib/cjs/components/list/list-item/useListItemFocus.js +0 -47
  432. package/lib/cjs/components/list/list-item/useListItemFocus.js.map +0 -1
  433. package/lib/cjs/components/slider-button/SliderButton.types.js +0 -6
  434. package/lib/cjs/components/slider-button/SliderButton.types.js.map +0 -1
  435. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +0 -66
  436. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +0 -1
  437. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +0 -47
  438. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +0 -1
  439. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +0 -68
  440. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +0 -1
  441. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +0 -30
  442. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  443. package/lib/esm/components/list/list-item/useListItemFocus.js +0 -40
  444. package/lib/esm/components/list/list-item/useListItemFocus.js.map +0 -1
  445. package/lib/esm/components/slider-button/SliderButton.types.js +0 -2
  446. package/lib/esm/components/slider-button/SliderButton.types.js.map +0 -1
  447. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +0 -56
  448. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +0 -1
  449. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +0 -38
  450. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +0 -1
  451. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +0 -61
  452. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +0 -1
  453. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +0 -25
  454. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  455. package/lib/types/components/list/list-item/useListItemFocus.d.ts +0 -13
  456. package/lib/types/components/slider-button/SliderButton.types.d.ts +0 -32
  457. package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +0 -17
  458. package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +0 -13
  459. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +0 -5
  460. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +0 -9
@@ -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":"AA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}
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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AqC,aAAA,CAAC7B,UAAU;IAACyB,KAAK,EAAEL,SAAS,IAAI,OAAQ;IAACkC,oBAAoB;EAAA,CAAE,CACpC,CAClC,EACA,CAAC9C,oBAAoB,IAAIN,QAAQ,iBAC9BV,KAAA,CAAAqC,aAAA,CAAC/B,2BAA2B;IACxB4C,OAAO,EAAE;MAAEf,OAAO,EAAE,CAAC;MAAEuB,KAAK,EAAE;IAAO,CAAE;IACvCC,IAAI,EAAE;MAAExB,OAAO,EAAE,CAAC;MAAEuB,KAAK,EAAE;IAAE,CAAE;IAC/BT,OAAO,EAAE;MAAEd,OAAO,EAAE,CAAC;MAAEuB,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC;IACJ;IAAA;IACAT,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B1C,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDD,MAAM,CAACsD,WAAW,GAAG,QAAQ;AAE7B,eAAetD,MAAM","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 StyledMotionButton = styled(motion.button)`
5
4
  ${({
6
5
  $shouldShowTextAsRobotoMedium,
@@ -58,22 +57,6 @@ export const StyledMotionButton = styled(motion.button)`
58
57
  user-select: none;
59
58
  width: fit-content;
60
59
 
61
- ${({
62
- $shouldShowKeyboardHighlighting,
63
- $shouldShowAsSelectButton,
64
- $isSecondary
65
- }) => $shouldShowKeyboardHighlighting && css`
66
- &:focus-visible {
67
- transition: none;
68
- ${keyboardFocusHighlightingRingCss}
69
-
70
- ${($shouldShowAsSelectButton || $isSecondary) && css`
71
- color: var(--chayns-color--text);
72
- outline: solid 2px color-mix(in srgb, white 70%, transparent);
73
- `}
74
- }
75
- `}
76
-
77
60
  ${({
78
61
  $hasIcon,
79
62
  $hasChildren,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.styles.js","names":["motion","styled","css","keyboardFocusHighlightingRingCss","StyledMotionButton","button","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","$isSecondary","$effectiveButtonDesign","theme","text","buttonColor","buttonBackgroundColor","$isDisabled","$shouldShowKeyboardHighlighting","$hasIcon","$hasChildren","$shouldShowWaitCursor","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../../src/components/button/Button.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';\n\ntype StyledButtonProps = WithTheme<{\n $hasIcon: boolean;\n $hasChildren: boolean;\n $isDisabled?: boolean;\n $isSecondary?: boolean;\n $shouldShowTextAsRobotoMedium: boolean;\n $shouldShowAsSelectButton: boolean;\n $shouldShowWaitCursor?: boolean;\n $effectiveButtonDesign: number;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nexport const StyledMotionButton = styled(motion.button)<StyledButtonProps>`\n ${({ $shouldShowTextAsRobotoMedium, $shouldShowAsSelectButton }) =>\n $shouldShowTextAsRobotoMedium &&\n !$shouldShowAsSelectButton &&\n css`\n font-size: 110%;\n font-family: 'Roboto Medium', serif;\n `}\n\n align-items: center;\n\n ${({\n $isSecondary,\n $shouldShowAsSelectButton,\n $effectiveButtonDesign,\n theme,\n }: StyledButtonProps) => {\n if ($isSecondary || $shouldShowAsSelectButton) {\n return css`\n color: ${theme.text};\n `;\n }\n\n return css`\n color: ${$effectiveButtonDesign === 2\n ? (theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white')\n : (theme.buttonColor ?? 'white')};\n `;\n }}\n\n ${({\n theme,\n $isSecondary,\n $shouldShowAsSelectButton,\n $effectiveButtonDesign,\n }: StyledButtonProps) => {\n if ($effectiveButtonDesign === 2 && !$shouldShowAsSelectButton) {\n return css`\n border: 1px solid ${$isSecondary ? theme['202'] : theme.buttonBackgroundColor};\n box-shadow: none;\n `;\n }\n\n return css`\n border: none;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n `;\n }}\n\n border-radius: 3px;\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n display: inline-flex;\n flex: 0 0 auto;\n line-height: 22px;\n min-height: 32px;\n position: relative;\n user-select: none;\n width: fit-content;\n\n ${({ $shouldShowKeyboardHighlighting, $shouldShowAsSelectButton, $isSecondary }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n\n ${($shouldShowAsSelectButton || $isSecondary) &&\n css`\n color: var(--chayns-color--text);\n outline: solid 2px color-mix(in srgb, white 70%, transparent);\n `}\n }\n `}\n\n ${({ $hasIcon, $hasChildren, $shouldShowWaitCursor }) => {\n if ($shouldShowWaitCursor) {\n return css`\n padding: 4px 12px;\n `;\n }\n\n if ($hasIcon) {\n if ($hasChildren) {\n return css`\n padding: 6px 12px 6px 42px;\n `;\n }\n return css`\n padding: 6px 12px 6px 18px;\n `;\n }\n return css`\n padding: 6px 12px 6px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)`\n will-change: unset !important;\n`;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,gCAAgC,QAAQ,8CAA8C;AAc/F,OAAO,MAAMC,kBAAkB,GAAGH,MAAM,CAACD,MAAM,CAACK,MAAM,C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,QAAQ;EAAEC,YAAY;EAAEC;AAAsB,CAAC,KAAK;EACrD,IAAIA,qBAAqB,EAAE;IACvB,OAAOhB,GAAG;AACtB;AACA,aAAa;EACL;EAEA,IAAIc,QAAQ,EAAE;IACV,IAAIC,YAAY,EAAE;MACd,OAAOf,GAAG;AAC1B;AACA,iBAAiB;IACL;IACA,OAAOA,GAAG;AACtB;AACA,aAAa;EACL;EACA,OAAOA,GAAG;AAClB;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAED,OAAO,MAAMiB,iBAAiB,GAAGlB,MAAM,CAACmB,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAGpB,MAAM,CAACD,MAAM,CAACsB,GAAG,CAAC;AAC7D;AACA,CAAC;AAED,OAAO,MAAMC,6BAA6B,GAAGtB,MAAM,CAACD,MAAM,CAACsB,GAAG,CAAC;AAC/D;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Button.styles.js","names":["motion","styled","css","StyledMotionButton","button","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","$isSecondary","$effectiveButtonDesign","theme","text","buttonColor","buttonBackgroundColor","$isDisabled","$hasIcon","$hasChildren","$shouldShowWaitCursor","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledButtonProps = WithTheme<{\n $hasIcon: boolean;\n $hasChildren: boolean;\n $isDisabled?: boolean;\n $isSecondary?: boolean;\n $shouldShowTextAsRobotoMedium: boolean;\n $shouldShowAsSelectButton: boolean;\n $shouldShowWaitCursor?: boolean;\n $effectiveButtonDesign: number;\n}>;\n\nexport const StyledMotionButton = styled(motion.button)<StyledButtonProps>`\n ${({ $shouldShowTextAsRobotoMedium, $shouldShowAsSelectButton }) =>\n $shouldShowTextAsRobotoMedium &&\n !$shouldShowAsSelectButton &&\n css`\n font-size: 110%;\n font-family: 'Roboto Medium', serif;\n `}\n\n align-items: center;\n\n ${({\n $isSecondary,\n $shouldShowAsSelectButton,\n $effectiveButtonDesign,\n theme,\n }: StyledButtonProps) => {\n if ($isSecondary || $shouldShowAsSelectButton) {\n return css`\n color: ${theme.text};\n `;\n }\n\n return css`\n color: ${$effectiveButtonDesign === 2\n ? (theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white')\n : (theme.buttonColor ?? 'white')};\n `;\n }}\n\n ${({\n theme,\n $isSecondary,\n $shouldShowAsSelectButton,\n $effectiveButtonDesign,\n }: StyledButtonProps) => {\n if ($effectiveButtonDesign === 2 && !$shouldShowAsSelectButton) {\n return css`\n border: 1px solid ${$isSecondary ? theme['202'] : theme.buttonBackgroundColor};\n box-shadow: none;\n `;\n }\n\n return css`\n border: none;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n `;\n }}\n\n border-radius: 3px;\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n display: inline-flex;\n flex: 0 0 auto;\n line-height: 22px;\n min-height: 32px;\n position: relative;\n user-select: none;\n width: fit-content;\n\n ${({ $hasIcon, $hasChildren, $shouldShowWaitCursor }) => {\n if ($shouldShowWaitCursor) {\n return css`\n padding: 4px 12px;\n `;\n }\n\n if ($hasIcon) {\n if ($hasChildren) {\n return css`\n padding: 6px 12px 6px 42px;\n `;\n }\n return css`\n padding: 6px 12px 6px 18px;\n `;\n }\n return css`\n padding: 6px 12px 6px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)`\n will-change: unset !important;\n`;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAc/C,OAAO,MAAMC,kBAAkB,GAAGF,MAAM,CAACD,MAAM,CAACI,MAAM,CAAoB;AAC1E,MAAM,CAAC;EAAEC,6BAA6B;EAAEC;AAA0B,CAAC,KAC3DD,6BAA6B,IAC7B,CAACC,yBAAyB,IAC1BJ,GAAG;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,MAAM,CAAC;EACCK,YAAY;EACZD,yBAAyB;EACzBE,sBAAsB;EACtBC;AACe,CAAC,KAAK;EACrB,IAAIF,YAAY,IAAID,yBAAyB,EAAE;IAC3C,OAAOJ,GAAG;AACtB,yBAAyBO,KAAK,CAACC,IAAI;AACnC,aAAa;EACL;EAEA,OAAOR,GAAG;AAClB,qBAAqBM,sBAAsB,KAAK,CAAC,GAC9BC,KAAK,CAACE,WAAW,IAAIF,KAAK,CAACG,qBAAqB,IAAI,OAAO,GAC3DH,KAAK,CAACE,WAAW,IAAI,OAAQ;AAChD,SAAS;AACL,CAAC;AACL;AACA,MAAM,CAAC;EACCF,KAAK;EACLF,YAAY;EACZD,yBAAyB;EACzBE;AACe,CAAC,KAAK;EACrB,IAAIA,sBAAsB,KAAK,CAAC,IAAI,CAACF,yBAAyB,EAAE;IAC5D,OAAOJ,GAAG;AACtB,oCAAoCK,YAAY,GAAGE,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAACG,qBAAqB;AAC7F;AACA,aAAa;EACL;EAEA,OAAOV,GAAG;AAClB;AACA;AACA,SAAS;AACL,CAAC;AACL;AACA;AACA,cAAc,CAAC;EAAEW;AAAY,CAAC,KAAMA,WAAW,GAAG,SAAS,GAAG,SAAU;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC,QAAQ;EAAEC,YAAY;EAAEC;AAAsB,CAAC,KAAK;EACrD,IAAIA,qBAAqB,EAAE;IACvB,OAAOd,GAAG;AACtB;AACA,aAAa;EACL;EAEA,IAAIY,QAAQ,EAAE;IACV,IAAIC,YAAY,EAAE;MACd,OAAOb,GAAG;AAC1B;AACA,iBAAiB;IACL;IACA,OAAOA,GAAG;AACtB;AACA,aAAa;EACL;EACA,OAAOA,GAAG;AAClB;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAED,OAAO,MAAMe,iBAAiB,GAAGhB,MAAM,CAACiB,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAGlB,MAAM,CAACD,MAAM,CAACoB,GAAG,CAAC;AAC7D;AACA,CAAC;AAED,OAAO,MAAMC,6BAA6B,GAAGpB,MAAM,CAACD,MAAM,CAACoB,GAAG,CAAC;AAC/D;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.types.js","names":[],"sources":["../../../../src/components/button/Button.types.ts"],"sourcesContent":["import type { MouseEventHandler, ReactNode } from 'react';\n\nexport type ButtonProps = {\n /**\n * The label of the button.\n * @description\n * The content to be displayed inside the button. This can be text, icons, or any React node.\n * It serves as the primary label for the button's action.\n * @optional\n */\n children?: ReactNode;\n /**\n * Additional class names for the button element.\n * @description\n * Allows adding custom CSS classes to the button for further styling or integration with CSS frameworks.\n * Multiple classes can be provided as a space-separated string.\n * @optional\n */\n className?: string;\n /**\n * An icon that is displayed on the left-hand side of the button text.\n * @description\n * Specifies an icon to be shown alongside the button text. The icon is positioned to the left of the text.\n * This enhances the visual representation of the button's function.\n * @optional\n */\n icon?: string;\n /**\n * Whether the button is disabled and cannot be clicked anymore.\n * @description\n * When set to true, the button becomes non-interactive, preventing user clicks and often changing its appearance to indicate the disabled state.\n * This is useful for scenarios where the action is temporarily unavailable.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Displays the button in the secondary style.\n * @description\n * Applies a secondary visual style to the button, typically with a different background color or border.\n * This is used to differentiate less prominent actions from primary ones.\n * @optional\n */\n isSecondary?: boolean;\n /**\n * Function to be executed when the button is clicked.\n * @description\n * A callback function that is triggered when the user clicks on the button. This can be used to handle interactions,\n * such as submitting forms, navigating to pages, or performing any custom action.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether the button should be displayed as a selectButton.\n * @description\n * Modifies the button's appearance to resemble a select button, often used in dropdowns or selection interfaces.\n * This changes the styling to indicate a selection state.\n * @optional\n * @default false\n */\n shouldShowAsSelectButton?: boolean;\n /**\n * Whether the text should be 'Roboto Medium'.\n * @description\n * Controls the font weight of the button text. When true, applies 'Roboto Medium' font weight for emphasis.\n * This can improve readability or match design guidelines.\n * @optional\n * @default true\n */\n shouldShowTextAsRobotoMedium?: boolean;\n /**\n * Shows a wait cursor instead of button text.\n * @description\n * Replaces the button content with a wait cursor animation, indicating that an action is in progress.\n * This provides visual feedback during loading or processing states.\n * @optional\n */\n shouldShowWaitCursor?: boolean;\n /**\n * Stops event propagation on click.\n * @description\n * Prevents the click event from bubbling up to parent elements, isolating the button's interaction.\n * Useful in complex UI structures where event handling needs to be contained.\n * @optional\n */\n shouldStopPropagation?: boolean;\n /**\n * Optional button design override.\n * @description\n * Allows overriding the default button design with a specific numeric value, corresponding to different visual themes or styles.\n * This provides flexibility for custom theming.\n * @optional\n */\n buttonDesign?: number;\n /**\n * Duration in seconds for the tap animation.\n * @description\n * Overrides how long the pressed state animation should take when the button is tapped.\n * Set this to `0` for an immediate press effect.\n * @optional\n */\n tapDuration?: number;\n /**\n * Enables keyboard-only focus highlighting.\n * @description\n * Focus styles are only shown while navigating with the keyboard and are reset on mouse interaction.\n * @optional\n * @default false\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"Button.types.js","names":[],"sources":["../../../../src/components/button/Button.types.ts"],"sourcesContent":["import type { MouseEventHandler, ReactNode } from 'react';\n\nexport type ButtonProps = {\n /**\n * The label of the button.\n * @description\n * The content to be displayed inside the button. This can be text, icons, or any React node.\n * It serves as the primary label for the button's action.\n * @optional\n */\n children?: ReactNode;\n /**\n * Additional class names for the button element.\n * @description\n * Allows adding custom CSS classes to the button for further styling or integration with CSS frameworks.\n * Multiple classes can be provided as a space-separated string.\n * @optional\n */\n className?: string;\n /**\n * An icon that is displayed on the left-hand side of the button text.\n * @description\n * Specifies an icon to be shown alongside the button text. The icon is positioned to the left of the text.\n * This enhances the visual representation of the button's function.\n * @optional\n */\n icon?: string;\n /**\n * Whether the button is disabled and cannot be clicked anymore.\n * @description\n * When set to true, the button becomes non-interactive, preventing user clicks and often changing its appearance to indicate the disabled state.\n * This is useful for scenarios where the action is temporarily unavailable.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Displays the button in the secondary style.\n * @description\n * Applies a secondary visual style to the button, typically with a different background color or border.\n * This is used to differentiate less prominent actions from primary ones.\n * @optional\n */\n isSecondary?: boolean;\n /**\n * Function to be executed when the button is clicked.\n * @description\n * A callback function that is triggered when the user clicks on the button. This can be used to handle interactions,\n * such as submitting forms, navigating to pages, or performing any custom action.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether the button should be displayed as a selectButton.\n * @description\n * Modifies the button's appearance to resemble a select button, often used in dropdowns or selection interfaces.\n * This changes the styling to indicate a selection state.\n * @optional\n * @default false\n */\n shouldShowAsSelectButton?: boolean;\n /**\n * Whether the text should be 'Roboto Medium'.\n * @description\n * Controls the font weight of the button text. When true, applies 'Roboto Medium' font weight for emphasis.\n * This can improve readability or match design guidelines.\n * @optional\n * @default true\n */\n shouldShowTextAsRobotoMedium?: boolean;\n /**\n * Shows a wait cursor instead of button text.\n * @description\n * Replaces the button content with a wait cursor animation, indicating that an action is in progress.\n * This provides visual feedback during loading or processing states.\n * @optional\n */\n shouldShowWaitCursor?: boolean;\n /**\n * Stops event propagation on click.\n * @description\n * Prevents the click event from bubbling up to parent elements, isolating the button's interaction.\n * Useful in complex UI structures where event handling needs to be contained.\n * @optional\n */\n shouldStopPropagation?: boolean;\n /**\n * Optional button design override.\n * @description\n * Allows overriding the default button design with a specific numeric value, corresponding to different visual themes or styles.\n * This provides flexibility for custom theming.\n * @optional\n */\n buttonDesign?: number;\n /**\n * Duration in seconds for the tap animation.\n * @description\n * Overrides how long the pressed state animation should take when the button is tapped.\n * Set this to `0` for an immediate press effect.\n * @optional\n */\n tapDuration?: number;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,4 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
3
2
  import { useUuid } from '../../hooks/uuid';
4
3
  import { getHeightOfSingleTextLine } from '../../utils/calculate';
5
4
  import { StyledCheckbox, StyledCheckboxBox, StyledCheckboxBoxWrapper, StyledCheckboxInput, StyledCheckboxLabel } from './Checkbox.styles';
@@ -13,8 +12,7 @@ const Checkbox = ({
13
12
  borderRadius,
14
13
  colors,
15
14
  shouldShowCentered = false,
16
- shouldChangeOnLabelClick = true,
17
- shouldEnableKeyboardHighlighting
15
+ shouldChangeOnLabelClick = true
18
16
  }) => {
19
17
  const [isActive, setIsActive] = useState(isChecked ?? false);
20
18
  const [checkboxTop, setCheckboxTop] = useState(undefined);
@@ -36,11 +34,9 @@ const Checkbox = ({
36
34
  setCheckboxTop((singleLineHeight - boxHeight) / 2);
37
35
  }
38
36
  }, [shouldShowCentered]);
39
- const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
40
37
  return /*#__PURE__*/React.createElement(StyledCheckbox, {
41
38
  ref: checkboxRootRef
42
39
  }, /*#__PURE__*/React.createElement(StyledCheckboxInput, {
43
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
44
40
  checked: isChecked,
45
41
  disabled: isDisabled,
46
42
  id: uuid,
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":["React","useCallback","useEffect","useRef","useState","useKeyboardFocusHighlighting","useUuid","getHeightOfSingleTextLine","StyledCheckbox","StyledCheckboxBox","StyledCheckboxBoxWrapper","StyledCheckboxInput","StyledCheckboxLabel","Checkbox","children","isChecked","isDisabled","labelClassName","onChange","shouldShowAsSwitch","borderRadius","colors","shouldShowCentered","shouldChangeOnLabelClick","shouldEnableKeyboardHighlighting","isActive","setIsActive","checkboxTop","setCheckboxTop","undefined","checkboxBoxRef","checkboxRootRef","handleChange","event","target","checked","uuid","current","singleLineHeight","container","boxHeight","getBoundingClientRect","height","shouldShowKeyboardHighlighting","createElement","ref","$shouldShowKeyboardHighlighting","disabled","id","type","$shouldShowAsSwitch","style","top","transform","htmlFor","$isChecked","$isDisabled","$checkedBackgroundColor","checkedBackgroundColor","$uncheckedBackgroundColor","uncheckedBackgroundColor","$borderRadius","$borderColor","borderColor","className","$shouldChangeOnLabelClick","displayName"],"sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n CSSProperties,\n FC,\n KeyboardEvent,\n ReactElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport { useUuid } from '../../hooks/uuid';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport {\n StyledCheckbox,\n StyledCheckboxBox,\n StyledCheckboxBoxWrapper,\n StyledCheckboxInput,\n StyledCheckboxLabel,\n} from './Checkbox.styles';\n\ntype CheckboxColors = {\n /**\n * Background color for the checked state.\n */\n checkedBackgroundColor?: CSSProperties['backgroundColor'];\n /**\n * Background color for the unchecked state.\n */\n uncheckedBackgroundColor?: CSSProperties['backgroundColor'];\n\n /**\n * Border color for the checkbox or switch indicator.\n */\n borderColor?: CSSProperties['borderColor'];\n};\n\nexport type CheckboxProps = {\n /**\n * Text for checkbox or switch\n */\n children?: ReactElement | string;\n /**\n * Indicates whether the checkbox or switch is selected\n */\n isChecked?: boolean;\n /**\n * Disables the checkbox or switch so it cannot be toggled\n */\n isDisabled?: boolean;\n /**\n * Classname for the label\n */\n labelClassName?: string;\n /**\n * Function to be executed if the checked value changes\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Whether the label should change the state of the checkbox\n */\n shouldChangeOnLabelClick?: boolean;\n /**\n * Changes the design to use switch instead of checkbox\n */\n shouldShowAsSwitch?: boolean;\n /**\n * Border radius for the checkbox or switch indicator.\n */\n borderRadius?: CSSProperties['borderRadius'];\n colors?: CheckboxColors;\n /**\n * Whether the Checkbox should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nconst Checkbox: FC<CheckboxProps> = ({\n children,\n isChecked,\n isDisabled,\n labelClassName,\n onChange,\n shouldShowAsSwitch,\n borderRadius,\n colors,\n shouldShowCentered = false,\n shouldChangeOnLabelClick = true,\n shouldEnableKeyboardHighlighting,\n}) => {\n const [isActive, setIsActive] = useState(isChecked ?? false);\n const [checkboxTop, setCheckboxTop] = useState<number | undefined>(undefined);\n\n const checkboxBoxRef = useRef<HTMLLabelElement>(null);\n const checkboxRootRef = useRef<HTMLDivElement>(null);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setIsActive(event.target.checked);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange],\n );\n\n const uuid = useUuid();\n\n useEffect(() => {\n if (checkboxRootRef.current && !shouldShowCentered) {\n const singleLineHeight = getHeightOfSingleTextLine({\n container: checkboxRootRef.current,\n });\n\n const boxHeight = checkboxBoxRef.current?.getBoundingClientRect().height ?? 0;\n\n setCheckboxTop((singleLineHeight - boxHeight) / 2);\n }\n }, [shouldShowCentered]);\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n return (\n <StyledCheckbox ref={checkboxRootRef}>\n <StyledCheckboxInput\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n checked={isChecked}\n disabled={isDisabled}\n id={uuid}\n onChange={handleChange}\n type=\"checkbox\"\n />\n\n <StyledCheckboxBoxWrapper\n $shouldShowAsSwitch={shouldShowAsSwitch}\n style={{\n top: shouldShowCentered ? '50%' : checkboxTop,\n transform: shouldShowCentered ? 'translateY(-50%)' : undefined,\n }}\n >\n <StyledCheckboxBox\n htmlFor={uuid}\n ref={checkboxBoxRef}\n $isChecked={isChecked ?? isActive}\n $isDisabled={isDisabled}\n $shouldShowAsSwitch={shouldShowAsSwitch}\n $checkedBackgroundColor={colors?.checkedBackgroundColor}\n $uncheckedBackgroundColor={colors?.uncheckedBackgroundColor}\n $borderRadius={borderRadius}\n $borderColor={colors?.borderColor}\n />\n </StyledCheckboxBoxWrapper>\n <StyledCheckboxLabel\n className={labelClassName}\n $isDisabled={isDisabled}\n $shouldChangeOnLabelClick={shouldChangeOnLabelClick}\n $shouldShowAsSwitch={shouldShowAsSwitch}\n htmlFor={shouldChangeOnLabelClick ? uuid : undefined}\n >\n {children}\n </StyledCheckboxLabel>\n </StyledCheckbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":"AAAA,OAAOA,KAAK,IAORC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,4BAA4B,QAAQ,0CAA0C;AACvF,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,yBAAyB,QAAQ,uBAAuB;AACjE,SACIC,cAAc,EACdC,iBAAiB,EACjBC,wBAAwB,EACxBC,mBAAmB,EACnBC,mBAAmB,QAChB,mBAAmB;AA8D1B,MAAMC,QAA2B,GAAGA,CAAC;EACjCC,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVC,cAAc;EACdC,QAAQ;EACRC,kBAAkB;EAClBC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KAAA,CAAA4C,aAAA,CAACjC,mBAAmB;IAChBmC,+BAA+B,EAAEH,8BAA+B;IAChER,OAAO,EAAEpB,SAAU;IACnBgC,QAAQ,EAAE/B,UAAW;IACrBgC,EAAE,EAAEZ,IAAK;IACTlB,QAAQ,EAAEc,YAAa;IACvBiB,IAAI,EAAC;EAAU,CAClB,CAAC,eAEFjD,KAAA,CAAA4C,aAAA,CAAClC,wBAAwB;IACrBwC,mBAAmB,EAAE/B,kBAAmB;IACxCgC,KAAK,EAAE;MACHC,GAAG,EAAE9B,kBAAkB,GAAG,KAAK,GAAGK,WAAW;MAC7C0B,SAAS,EAAE/B,kBAAkB,GAAG,kBAAkB,GAAGO;IACzD;EAAE,gBAEF7B,KAAA,CAAA4C,aAAA,CAACnC,iBAAiB;IACd6C,OAAO,EAAElB,IAAK;IACdS,GAAG,EAAEf,cAAe;IACpByB,UAAU,EAAExC,SAAS,IAAIU,QAAS;IAClC+B,WAAW,EAAExC,UAAW;IACxBkC,mBAAmB,EAAE/B,kBAAmB;IACxCsC,uBAAuB,EAAEpC,MAAM,EAAEqC,sBAAuB;IACxDC,yBAAyB,EAAEtC,MAAM,EAAEuC,wBAAyB;IAC5DC,aAAa,EAAEzC,YAAa;IAC5B0C,YAAY,EAAEzC,MAAM,EAAE0C;EAAY,CACrC,CACqB,CAAC,eAC3B/D,KAAA,CAAA4C,aAAA,CAAChC,mBAAmB;IAChBoD,SAAS,EAAE/C,cAAe;IAC1BuC,WAAW,EAAExC,UAAW;IACxBiD,yBAAyB,EAAE1C,wBAAyB;IACpD2B,mBAAmB,EAAE/B,kBAAmB;IACxCmC,OAAO,EAAE/B,wBAAwB,GAAGa,IAAI,GAAGP;EAAU,GAEpDf,QACgB,CACT,CAAC;AAEzB,CAAC;AAEDD,QAAQ,CAACqD,WAAW,GAAG,UAAU;AAEjC,eAAerD,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"Checkbox.js","names":["React","useCallback","useEffect","useRef","useState","useUuid","getHeightOfSingleTextLine","StyledCheckbox","StyledCheckboxBox","StyledCheckboxBoxWrapper","StyledCheckboxInput","StyledCheckboxLabel","Checkbox","children","isChecked","isDisabled","labelClassName","onChange","shouldShowAsSwitch","borderRadius","colors","shouldShowCentered","shouldChangeOnLabelClick","isActive","setIsActive","checkboxTop","setCheckboxTop","undefined","checkboxBoxRef","checkboxRootRef","handleChange","event","target","checked","uuid","current","singleLineHeight","container","boxHeight","getBoundingClientRect","height","createElement","ref","disabled","id","type","$shouldShowAsSwitch","style","top","transform","htmlFor","$isChecked","$isDisabled","$checkedBackgroundColor","checkedBackgroundColor","$uncheckedBackgroundColor","uncheckedBackgroundColor","$borderRadius","$borderColor","borderColor","className","$shouldChangeOnLabelClick","displayName"],"sources":["../../../../src/components/checkbox/Checkbox.tsx"],"sourcesContent":["import React, {\n ChangeEvent,\n ChangeEventHandler,\n CSSProperties,\n FC,\n ReactElement,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { useUuid } from '../../hooks/uuid';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport {\n StyledCheckbox,\n StyledCheckboxBox,\n StyledCheckboxBoxWrapper,\n StyledCheckboxInput,\n StyledCheckboxLabel,\n} from './Checkbox.styles';\n\ntype CheckboxColors = {\n /**\n * Background color for the checked state.\n */\n checkedBackgroundColor?: CSSProperties['backgroundColor'];\n /**\n * Background color for the unchecked state.\n */\n uncheckedBackgroundColor?: CSSProperties['backgroundColor'];\n\n /**\n * Border color for the checkbox or switch indicator.\n */\n borderColor?: CSSProperties['borderColor'];\n};\n\nexport type CheckboxProps = {\n /**\n * Text for checkbox or switch\n */\n children?: ReactElement | string;\n /**\n * Indicates whether the checkbox or switch is selected\n */\n isChecked?: boolean;\n /**\n * Disables the checkbox or switch so it cannot be toggled\n */\n isDisabled?: boolean;\n /**\n * Classname for the label\n */\n labelClassName?: string;\n /**\n * Function to be executed if the checked value changes\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Whether the label should change the state of the checkbox\n */\n shouldChangeOnLabelClick?: boolean;\n /**\n * Changes the design to use switch instead of checkbox\n */\n shouldShowAsSwitch?: boolean;\n /**\n * Border radius for the checkbox or switch indicator.\n */\n borderRadius?: CSSProperties['borderRadius'];\n colors?: CheckboxColors;\n /**\n * Whether the Checkbox should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n};\n\nconst Checkbox: FC<CheckboxProps> = ({\n children,\n isChecked,\n isDisabled,\n labelClassName,\n onChange,\n shouldShowAsSwitch,\n borderRadius,\n colors,\n shouldShowCentered = false,\n shouldChangeOnLabelClick = true,\n}) => {\n const [isActive, setIsActive] = useState(isChecked ?? false);\n const [checkboxTop, setCheckboxTop] = useState<number | undefined>(undefined);\n\n const checkboxBoxRef = useRef<HTMLLabelElement>(null);\n const checkboxRootRef = useRef<HTMLDivElement>(null);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n setIsActive(event.target.checked);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n },\n [onChange],\n );\n\n const uuid = useUuid();\n\n useEffect(() => {\n if (checkboxRootRef.current && !shouldShowCentered) {\n const singleLineHeight = getHeightOfSingleTextLine({\n container: checkboxRootRef.current,\n });\n\n const boxHeight = checkboxBoxRef.current?.getBoundingClientRect().height ?? 0;\n\n setCheckboxTop((singleLineHeight - boxHeight) / 2);\n }\n }, [shouldShowCentered]);\n\n return (\n <StyledCheckbox ref={checkboxRootRef}>\n <StyledCheckboxInput\n checked={isChecked}\n disabled={isDisabled}\n id={uuid}\n onChange={handleChange}\n type=\"checkbox\"\n />\n\n <StyledCheckboxBoxWrapper\n $shouldShowAsSwitch={shouldShowAsSwitch}\n style={{\n top: shouldShowCentered ? '50%' : checkboxTop,\n transform: shouldShowCentered ? 'translateY(-50%)' : undefined,\n }}\n >\n <StyledCheckboxBox\n htmlFor={uuid}\n ref={checkboxBoxRef}\n $isChecked={isChecked ?? isActive}\n $isDisabled={isDisabled}\n $shouldShowAsSwitch={shouldShowAsSwitch}\n $checkedBackgroundColor={colors?.checkedBackgroundColor}\n $uncheckedBackgroundColor={colors?.uncheckedBackgroundColor}\n $borderRadius={borderRadius}\n $borderColor={colors?.borderColor}\n />\n </StyledCheckboxBoxWrapper>\n <StyledCheckboxLabel\n className={labelClassName}\n $isDisabled={isDisabled}\n $shouldChangeOnLabelClick={shouldChangeOnLabelClick}\n $shouldShowAsSwitch={shouldShowAsSwitch}\n htmlFor={shouldChangeOnLabelClick ? uuid : undefined}\n >\n {children}\n </StyledCheckboxLabel>\n </StyledCheckbox>\n );\n};\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":"AAAA,OAAOA,KAAK,IAMRC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,yBAAyB,QAAQ,uBAAuB;AACjE,SACIC,cAAc,EACdC,iBAAiB,EACjBC,wBAAwB,EACxBC,mBAAmB,EACnBC,mBAAmB,QAChB,mBAAmB;AA0D1B,MAAMC,QAA2B,GAAGA,CAAC;EACjCC,QAAQ;EACRC,SAAS;EACTC,UAAU;EACVC,cAAc;EACdC,QAAQ;EACRC,kBAAkB;EAClBC,YAAY;EACZC,MAAM;EACNC,kBAAkB,GAAG,KAAK;EAC1BC,wBAAwB,GAAG;AAC/B,CAAC,KAAK;EACF,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGpB,QAAQ,CAACU,SAAS,IAAI,KAAK,CAAC;EAC5D,MAAM,CAACW,WAAW,EAAEC,cAAc,CAAC,GAAGtB,QAAQ,CAAqBuB,SAAS,CAAC;EAE7E,MAAMC,cAAc,GAAGzB,MAAM,CAAmB,IAAI,CAAC;EACrD,MAAM0B,eAAe,GAAG1B,MAAM,CAAiB,IAAI,CAAC;EAEpD,MAAM2B,YAAY,GAAG7B,WAAW,CAC3B8B,KAAoC,IAAK;IACtCP,WAAW,CAACO,KAAK,CA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IAClC6B,WAAW,EAAErC,UAAW;IACxB+B,mBAAmB,EAAE5B,kBAAmB;IACxCmC,uBAAuB,EAAEjC,MAAM,EAAEkC,sBAAuB;IACxDC,yBAAyB,EAAEnC,MAAM,EAAEoC,wBAAyB;IAC5DC,aAAa,EAAEtC,YAAa;IAC5BuC,YAAY,EAAEtC,MAAM,EAAEuC;EAAY,CACrC,CACqB,CAAC,eAC3B3D,KAAA,CAAAyC,aAAA,CAAC9B,mBAAmB;IAChBiD,SAAS,EAAE5C,cAAe;IAC1BoC,WAAW,EAAErC,UAAW;IACxB8C,yBAAyB,EAAEvC,wBAAyB;IACpDwB,mBAAmB,EAAE5B,kBAAmB;IACxCgC,OAAO,EAAE5B,wBAAwB,GAAGY,IAAI,GAAGP;EAAU,GAEpDd,QACgB,CACT,CAAC;AAEzB,CAAC;AAEDD,QAAQ,CAACkD,WAAW,GAAG,UAAU;AAEjC,eAAelD,QAAQ","ignoreList":[]}
@@ -1,5 +1,4 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
3
2
  export const StyledCheckbox = styled.div`
4
3
  align-items: center;
5
4
  display: flex;
@@ -8,28 +7,7 @@ export const StyledCheckbox = styled.div`
8
7
  min-height: 20px;
9
8
  `;
10
9
  export const StyledCheckboxInput = styled.input`
11
- border: 0;
12
- clip: rect(0 0 0 0);
13
- clip-path: inset(50%);
14
- height: 1px;
15
- left: 0;
16
- margin: 0;
17
- opacity: 0;
18
- overflow: hidden;
19
- padding: 0;
20
- position: absolute;
21
- top: 0;
22
- white-space: nowrap;
23
- width: 1px;
24
-
25
- ${({
26
- $shouldShowKeyboardHighlighting
27
- }) => $shouldShowKeyboardHighlighting && css`
28
- &:focus-visible + div > label {
29
- transition: none;
30
- ${keyboardFocusHighlightingRingCss}
31
- }
32
- `}
10
+ display: none;
33
11
  `;
34
12
  export const StyledCheckboxBoxWrapper = styled.div`
35
13
  display: flex;
@@ -54,10 +32,6 @@ export const StyledCheckboxBox = styled.label`
54
32
  $isDisabled
55
33
  }) => $isDisabled ? 0.5 : 1};
56
34
  position: relative;
57
- display: inline-block;
58
- width: ${({
59
- $shouldShowAsSwitch
60
- }) => $shouldShowAsSwitch ? '44px' : '16px'};
61
35
  transition: opacity 0.2s ease;
62
36
  user-select: none;
63
37
  height: 16px;
@@ -116,8 +90,7 @@ export const StyledCheckboxBox = styled.label`
116
90
  if ($shouldShowAsSwitch) {
117
91
  return 'none';
118
92
  }
119
- const fallbackBorderColor = theme['409-rgb'] ? `rgba(${theme['409-rgb']}, 0.5)` : theme.text;
120
- return `1px solid ${$borderColor ?? fallbackBorderColor}`;
93
+ return `1px solid ${$borderColor ?? `rgba(${theme['409-rgb']}, 0.5)`}`;
121
94
  }};
122
95
 
123
96
  border-radius: ${({
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.styles.js","names":["styled","css","keyboardFocusHighlightingRingCss","StyledCheckbox","div","StyledCheckboxInput","input","$shouldShowKeyboardHighlighting","StyledCheckboxBoxWrapper","$shouldShowAsSwitch","StyledCheckboxBox","label","theme","text","$isDisabled","$isChecked","$checkedBackgroundColor","$uncheckedBackgroundColor","activeBackgroundColor","green","inactiveBackgroundColor","red","$borderColor","fallbackBorderColor","$borderRadius","StyledCheckboxLabel","$shouldChangeOnLabelClick"],"sources":["../../../../src/components/checkbox/Checkbox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { CSSProperties } from 'react';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\nimport type { CheckboxProps } from './Checkbox';\n\nexport const StyledCheckbox = styled.div`\n align-items: center;\n display: flex;\n position: relative;\n width: 100%;\n min-height: 20px;\n`;\n\ntype StyledCheckboxInputProps = {\n $shouldShowKeyboardHighlighting?: boolean;\n};\n\nexport const StyledCheckboxInput = styled.input<StyledCheckboxInputProps>`\n border: 0;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n left: 0;\n margin: 0;\n opacity: 0;\n overflow: hidden;\n padding: 0;\n position: absolute;\n top: 0;\n white-space: nowrap;\n width: 1px;\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible + div > label {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n`;\n\ntype StyledCheckboxBoxWrapperProps = WithTheme<{\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n}>;\n\nexport const StyledCheckboxBoxWrapper = styled.div<StyledCheckboxBoxWrapperProps>`\n display: flex;\n flex-shrink: 0;\n height: 16px;\n position: absolute;\n\n ${({ $shouldShowAsSwitch }) =>\n $shouldShowAsSwitch &&\n css`\n right: 42px;\n `}\n`;\n\ntype StyledCheckboxBoxProps = WithTheme<{\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n $isDisabled?: CheckboxProps['isDisabled'];\n $isChecked?: CheckboxProps['isChecked'];\n $checkedBackgroundColor?: CSSProperties['backgroundColor'];\n $uncheckedBackgroundColor?: CSSProperties['backgroundColor'];\n $borderRadius?: CSSProperties['borderRadius'];\n $borderColor?: CSSProperties['borderColor'];\n}>;\n\nexport const StyledCheckboxBox = styled.label<StyledCheckboxBoxProps>`\n color: ${({ theme }: StyledCheckboxBoxProps) => theme.text};\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n position: relative;\n display: inline-block;\n width: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '44px' : '16px')};\n transition: opacity 0.2s ease;\n user-select: none;\n height: 16px;\n\n &:after {\n ${({ $isChecked, $shouldShowAsSwitch }: StyledCheckboxBoxProps) =>\n $shouldShowAsSwitch\n ? css`\n background-color: white;\n border-radius: 50%;\n box-shadow: 0 1px 4px rgb(0 0 0 / 35%);\n height: 16px;\n left: 7px;\n top: 50%;\n transform: translateX(${$isChecked ? '18px' : 0}) translateY(-50%);\n transition: transform 0.2s ease;\n width: 16px;\n `\n : css`\n border-right: 2px solid #fff;\n border-bottom: 2px solid #fff;\n height: 10px;\n left: 2px;\n opacity: ${$isChecked ? 1 : 0};\n top: calc(50% - 2px);\n transform: rotateZ(37deg) translateY(-50%);\n transition: opacity 0.2s ease;\n width: 5px;\n `}\n\n content: ' ';\n position: absolute;\n }\n\n &:before {\n background-color: ${({\n $isChecked,\n $shouldShowAsSwitch,\n $checkedBackgroundColor,\n $uncheckedBackgroundColor,\n theme,\n }: StyledCheckboxBoxProps) => {\n const activeBackgroundColor =\n $checkedBackgroundColor ?? ($shouldShowAsSwitch ? theme.green : theme['408']);\n const inactiveBackgroundColor =\n $uncheckedBackgroundColor ?? ($shouldShowAsSwitch ? theme.red : theme['403']);\n\n if ($shouldShowAsSwitch) {\n return $isChecked ? activeBackgroundColor : inactiveBackgroundColor;\n }\n\n return $isChecked ? activeBackgroundColor : inactiveBackgroundColor;\n }};\n\n border: ${({ $borderColor, $shouldShowAsSwitch, theme }: StyledCheckboxBoxProps) => {\n if ($shouldShowAsSwitch) {\n return 'none';\n }\n\n const fallbackBorderColor = theme['409-rgb']\n ? `rgba(${theme['409-rgb']}, 0.5)`\n : theme.text;\n\n return `1px solid ${$borderColor ?? fallbackBorderColor}`;\n }};\n\n border-radius: ${({ $shouldShowAsSwitch, $borderRadius }) =>\n $borderRadius ?? ($shouldShowAsSwitch ? '100px' : 0)};\n content: ' ';\n height: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '13px' : '15px')};\n left: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '10px' : 0)};\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n transition: background-color 0.2s ease;\n width: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '28px' : '15px')};\n }\n}\n`;\n\ntype StyledCheckboxLabelProps = WithTheme<{\n $isDisabled?: CheckboxProps['isDisabled'];\n $shouldChangeOnLabelClick?: CheckboxProps['shouldChangeOnLabelClick'];\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n}>;\n\nexport const StyledCheckboxLabel = styled.label<StyledCheckboxLabelProps>`\n color: ${({ theme }: StyledCheckboxLabelProps) => theme.text};\n cursor: ${({ $shouldChangeOnLabelClick }) =>\n !$shouldChangeOnLabelClick ? 'default' : 'pointer'};\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n user-select: none;\n ${({ $shouldShowAsSwitch }) =>\n $shouldShowAsSwitch\n ? css`\n padding-right: 48px;\n `\n : css`\n padding-left: 20px;\n `}\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,gCAAgC,QAAQ,8CAA8C;AAG/F,OAAO,MAAMC,cAAc,GAAGH,MAAM,CAACI,GAAG;AACxC;AACA;AACA;AACA;AACA;AACA,CAAC;AAMD,OAAO,MAAMC,mBAAmB,GAAGL,MAAM,CAACM,KAA+B;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAgC,CAAC,KAClCA,+BAA+B,IAC/BN,GAAG;AACX;AACA;AACA,kBAAkBC,gCAAgC;AAClD;AACA,SAAS;AACT,CAAC;AAMD,OAAO,MAAMM,wBAAwB,GAAGR,MAAM,CAACI,GAAkC;AACjF;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEK;AAAoB,CAAC,KACtBA,mBAAmB,IACnBR,GAAG;AACX;AACA,SAAS;AACT,CAAC;AAYD,OAAO,MAAMS,iBAAiB,GAAGV,MAAM,CAACW,KAA6B;AACrE,aAAa,CAAC;EAAEC;AAA8B,CAAC,KAAKA,KAAK,CAACC,IAAI;AAC9D,cAAc,CAAC;EAAEC;AAAY,CAAC,KAAMA,WAAW,GAAG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C,QAAQ,GAChCA,KAAK,CAACC,IAAI;EAEhB,OAAO,aAAaS,YAAY,IAAIC,mBAAmB,EAAE;AAC7D,CAAC;AACT;AACA,yBAAyB,CAAC;EAAEd,mBAAmB;EAAEe;AAAc,CAAC,KACpDA,aAAa,KAAKf,mBAAmB,GAAG,OAAO,GAAG,CAAC,CAAC;AAChE;AACA,kBAAkB,CAAC;EAAEA;AAAoB,CAAC,KAAMA,mBAAmB,GAAG,MAAM,GAAG,MAAO;AACtF,gBAAgB,CAAC;EAAEA;AAAoB,CAAC,KAAMA,mBAAmB,GAAG,MAAM,GAAG,CAAE;AAC/E;AACA;AACA;AACA;AACA,iBAAiB,CAAC;EAAEA;AAAoB,CAAC,KAAMA,mBAAmB,GAAG,MAAM,GAAG,MAAO;AACrF;AACA;AACA,CAAC;AAQD,OAAO,MAAMgB,mBAAmB,GAAGzB,MAAM,CAACW,KAA+B;AACzE,aAAa,CAAC;EAAEC;AAAgC,CAAC,KAAKA,KAAK,CAACC,IAAI;AAChE,cAAc,CAAC;EAAEa;AAA0B,CAAC,KACpC,CAACA,yBAAyB,GAAG,SAAS,GAAG,SAAS;AAC1D,eAAe,CAAC;EAAEZ;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA,MAAM,CAAC;EAAEL;AAAoB,CAAC,KACtBA,mBAAmB,GACbR,GAAG;AACjB;AACA,eAAe,GACDA,GAAG;AACjB;AACA,eAAe;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Checkbox.styles.js","names":["styled","css","StyledCheckbox","div","StyledCheckboxInput","input","StyledCheckboxBoxWrapper","$shouldShowAsSwitch","StyledCheckboxBox","label","theme","text","$isDisabled","$isChecked","$checkedBackgroundColor","$uncheckedBackgroundColor","activeBackgroundColor","green","inactiveBackgroundColor","red","$borderColor","$borderRadius","StyledCheckboxLabel","$shouldChangeOnLabelClick"],"sources":["../../../../src/components/checkbox/Checkbox.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { CSSProperties } from 'react';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { CheckboxProps } from './Checkbox';\n\nexport const StyledCheckbox = styled.div`\n align-items: center;\n display: flex;\n position: relative;\n width: 100%;\n min-height: 20px;\n`;\n\nexport const StyledCheckboxInput = styled.input`\n display: none;\n`;\n\ntype StyledCheckboxBoxWrapperProps = WithTheme<{\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n}>;\n\nexport const StyledCheckboxBoxWrapper = styled.div<StyledCheckboxBoxWrapperProps>`\n display: flex;\n flex-shrink: 0;\n height: 16px;\n position: absolute;\n\n ${({ $shouldShowAsSwitch }) =>\n $shouldShowAsSwitch &&\n css`\n right: 42px;\n `}\n`;\n\ntype StyledCheckboxBoxProps = WithTheme<{\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n $isDisabled?: CheckboxProps['isDisabled'];\n $isChecked?: CheckboxProps['isChecked'];\n $checkedBackgroundColor?: CSSProperties['backgroundColor'];\n $uncheckedBackgroundColor?: CSSProperties['backgroundColor'];\n $borderRadius?: CSSProperties['borderRadius'];\n $borderColor?: CSSProperties['borderColor'];\n}>;\n\nexport const StyledCheckboxBox = styled.label<StyledCheckboxBoxProps>`\n color: ${({ theme }: StyledCheckboxBoxProps) => theme.text};\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n position: relative;\n transition: opacity 0.2s ease;\n user-select: none;\n height: 16px;\n\n &:after {\n ${({ $isChecked, $shouldShowAsSwitch }: StyledCheckboxBoxProps) =>\n $shouldShowAsSwitch\n ? css`\n background-color: white;\n border-radius: 50%;\n box-shadow: 0 1px 4px rgb(0 0 0 / 35%);\n height: 16px;\n left: 7px;\n top: 50%;\n transform: translateX(${$isChecked ? '18px' : 0}) translateY(-50%);\n transition: transform 0.2s ease;\n width: 16px;\n `\n : css`\n border-right: 2px solid #fff;\n border-bottom: 2px solid #fff;\n height: 10px;\n left: 2px;\n opacity: ${$isChecked ? 1 : 0};\n top: calc(50% - 2px);\n transform: rotateZ(37deg) translateY(-50%);\n transition: opacity 0.2s ease;\n width: 5px;\n `}\n\n content: ' ';\n position: absolute;\n }\n\n &:before {\n background-color: ${({\n $isChecked,\n $shouldShowAsSwitch,\n $checkedBackgroundColor,\n $uncheckedBackgroundColor,\n theme,\n }: StyledCheckboxBoxProps) => {\n const activeBackgroundColor =\n $checkedBackgroundColor ?? ($shouldShowAsSwitch ? theme.green : theme['408']);\n const inactiveBackgroundColor =\n $uncheckedBackgroundColor ?? ($shouldShowAsSwitch ? theme.red : theme['403']);\n\n if ($shouldShowAsSwitch) {\n return $isChecked ? activeBackgroundColor : inactiveBackgroundColor;\n }\n\n return $isChecked ? activeBackgroundColor : inactiveBackgroundColor;\n }};\n\n border: ${({ $borderColor, $shouldShowAsSwitch, theme }: StyledCheckboxBoxProps) => {\n if ($shouldShowAsSwitch) {\n return 'none';\n }\n\n return `1px solid ${$borderColor ?? `rgba(${theme['409-rgb']}, 0.5)`}`;\n }};\n\n border-radius: ${({ $shouldShowAsSwitch, $borderRadius }) =>\n $borderRadius ?? ($shouldShowAsSwitch ? '100px' : 0)};\n content: ' ';\n height: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '13px' : '15px')};\n left: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '10px' : 0)};\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n transition: background-color 0.2s ease;\n width: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '28px' : '15px')};\n }\n}\n`;\n\ntype StyledCheckboxLabelProps = WithTheme<{\n $isDisabled?: CheckboxProps['isDisabled'];\n $shouldChangeOnLabelClick?: CheckboxProps['shouldChangeOnLabelClick'];\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n}>;\n\nexport const StyledCheckboxLabel = styled.label<StyledCheckboxLabelProps>`\n color: ${({ theme }: StyledCheckboxLabelProps) => theme.text};\n cursor: ${({ $shouldChangeOnLabelClick }) =>\n !$shouldChangeOnLabelClick ? 'default' : 'pointer'};\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n user-select: none;\n ${({ $shouldShowAsSwitch }) =>\n $shouldShowAsSwitch\n ? css`\n padding-right: 48px;\n `\n : css`\n padding-left: 20px;\n `}\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAK/C,OAAO,MAAMC,cAAc,GAAGF,MAAM,CAACG,GAAG;AACxC;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAGJ,MAAM,CAACK,KAAK;AAC/C;AACA,CAAC;AAMD,OAAO,MAAMC,wBAAwB,GAAGN,MAAM,CAACG,GAAkC;AACjF;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEI;AAAoB,CAAC,KACtBA,mBAAmB,IACnBN,GAAG;AACX;AACA,SAAS;AACT,CAAC;AAYD,OAAO,MAAMO,iBAAiB,GAAGR,MAAM,CAACS,KAA6B;AACrE,aAAa,CAAC;EAAEC;AAA8B,CAAC,KAAKA,KAAK,CAACC,IAAI;AAC9D,cAAc,CAAC;EAAEC;AAAY,CAAC,KAAMA,WAAW,GAAG,SAAS,GAAG,SAAU;AACxE,eAAe,CAAC;EAAEA;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC;EAAEC,UAAU;EAAEN;AAA4C,CAAC,KAC1DA,mBAAmB,GACbN,GAAG;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8CY,UAAU,GAAG,MAAM,GAAG,CAAC;AACrE;AACA;AACA,mBAAmB,GACDZ,GAAG;AACrB;AACA;AACA;AACA;AACA,iCAAiCY,UAAU,GAAG,CAAC,GAAG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AA+B;AACzE,aAAa,CAAC;EAAEC;AAAgC,CAAC,KAAKA,KAAK,CAACC,IAAI;AAChE,cAAc,CAAC;EAAEY;AAA0B,CAAC,KACpC,CAACA,yBAAyB,GAAG,SAAS,GAAG,SAAS;AAC1D,eAAe,CAAC;EAAEX;AAAY,CAAC,KAAMA,WAAW,GAAG,GAAG,GAAG,CAAE;AAC3D;AACA;AACA,MAAM,CAAC;EAAEL;AAAoB,CAAC,KACtBA,mBAAmB,GACbN,GAAG;AACjB;AACA,eAAe,GACDA,GAAG;AACjB;AACA,eAAe;AACf,CAAC","ignoreList":[]}
@@ -73,8 +73,7 @@ const ColorSchemeProvider = ({
73
73
  siteId,
74
74
  style = {},
75
75
  iconColor,
76
- customVariables,
77
- shouldEnableKeyboardHighlighting
76
+ customVariables
78
77
  }) => {
79
78
  const context = useContext(ColorSchemeContext);
80
79
  const {
@@ -85,7 +84,6 @@ const ColorSchemeProvider = ({
85
84
  const colorMode = colorModeProp ?? context?.designSettings?.colorMode ?? internalColorMode;
86
85
  const overrideParagraphFormat = color && color !== internalColor || colorMode !== internalColorMode;
87
86
  const paragraphFormat = useMemo(() => overrideParagraphFormat ? [] : undefined, [overrideParagraphFormat]);
88
- const resolvedShouldEnableKeyboardHighlighting = shouldEnableKeyboardHighlighting ?? context?.shouldEnableKeyboardHighlighting ?? false;
89
87
  const contextValue = useChaynsTheme({
90
88
  color,
91
89
  iconColor,
@@ -99,10 +97,7 @@ const ColorSchemeProvider = ({
99
97
  return /*#__PURE__*/React.createElement(ThemeProvider, {
100
98
  theme: contextValue.theme
101
99
  }, /*#__PURE__*/React.createElement(ColorSchemeContext.Provider, {
102
- value: {
103
- ...contextValue,
104
- shouldEnableKeyboardHighlighting: resolvedShouldEnableKeyboardHighlighting
105
- }
100
+ value: contextValue
106
101
  }, /*#__PURE__*/React.createElement(StyledColorSchemeProvider, {
107
102
  className: "color-scheme-provider",
108
103
  style: style
@@ -1 +1 @@
1
- {"version":3,"file":"ColorSchemeProvider.js","names":["useSite","React","createContext","useContext","useMemo","createGlobalStyle","css","ThemeProvider","StyledColorSchemeProvider","useChaynsTheme","GlobalStyle","theme","textRgb","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","children","color","colorProp","colorMode","colorModeProp","secondaryColor","siteId","style","iconColor","customVariables","shouldEnableKeyboardHighlighting","context","internalColor","internalColorMode","designSettings","overrideParagraphFormat","paragraphFormat","resolvedShouldEnableKeyboardHighlighting","contextValue","createElement","Provider","value","className","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { ChaynsDesignSettings, ChaynsParagraphFormat, ColorMode, useSite } from 'chayns-api';\nimport React, { createContext, FC, ReactNode, useContext, useMemo } from 'react';\nimport { createGlobalStyle, css, ThemeProvider } from 'styled-components';\nimport { StyledColorSchemeProvider } from './ColorSchemeProvider.styles';\nimport { useChaynsTheme } from './hooks/useChaynsTheme';\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n /**\n * Additional variables to extend the theme\n */\n customVariables?: Record<string, string>;\n /**\n * An optional color for all icons\n */\n iconColor?: string;\n /**\n * Enables keyboard-only focus highlighting globally for child components.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n footer {\n font-size: 0.85rem;\n color: #888;\n margin: 10px 0 0;\n\n & a {\n color: #888;\n letter-spacing: -0.3px;\n }\n }\n\n .chayns-scrollbar {\n ${({ theme }: WithTheme<unknown>) => {\n const textRgb = theme['text-rgb'] ?? '';\n\n return css`\n @supports selector(::-webkit-scrollbar-button) {\n &::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: rgba(${textRgb}, 0.15);\n border-radius: 20px;\n background-clip: padding-box;\n border: solid 3px transparent;\n }\n\n &::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-corner {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-button {\n background-color: transparent;\n height: 5px;\n width: 5px;\n }\n }\n\n @supports not selector(::-webkit-scrollbar-button) {\n scrollbar-color: rgba(${textRgb}, 0.15) transparent;\n scrollbar-width: thin;\n }\n `;\n }}\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings?: ChaynsDesignSettings;\n paragraphFormat: ChaynsParagraphFormat[];\n theme: Theme;\n shouldEnableKeyboardHighlighting: boolean;\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = (): ColorSchemeContextProps | undefined =>\n useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color: colorProp,\n colorMode: colorModeProp,\n secondaryColor,\n siteId,\n style = {},\n iconColor,\n customVariables,\n shouldEnableKeyboardHighlighting,\n}) => {\n const context = useContext(ColorSchemeContext);\n\n const { color: internalColor, colorMode: internalColorMode } = useSite();\n\n const color = colorProp ?? context?.designSettings?.color ?? internalColor;\n const colorMode = colorModeProp ?? context?.designSettings?.colorMode ?? internalColorMode;\n\n const overrideParagraphFormat =\n (color && color !== internalColor) || colorMode !== internalColorMode;\n\n const paragraphFormat = useMemo(\n () => (overrideParagraphFormat ? [] : undefined),\n [overrideParagraphFormat],\n );\n\n const resolvedShouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlighting ?? context?.shouldEnableKeyboardHighlighting ?? false;\n\n const contextValue = useChaynsTheme({\n color,\n iconColor,\n colorMode,\n secondaryColor,\n siteId,\n customVariables,\n // Overrides the paragraphFormat on changed color or colorMode\n paragraphFormat,\n });\n\n return (\n <ThemeProvider theme={contextValue.theme}>\n <ColorSchemeContext.Provider\n value={{\n ...contextValue,\n shouldEnableKeyboardHighlighting: resolvedShouldEnableKeyboardHighlighting,\n }}\n >\n <StyledColorSchemeProvider className=\"color-scheme-provider\" style={style}>\n {children}\n </StyledColorSchemeProvider>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":"AAAA,SAAiEA,OAAO,QAAQ,YAAY;AAC5F,OAAOC,KAAK,IAAIC,aAAa,EAAiBC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAChF,SAASC,iBAAiB,EAAEC,GAAG,EAAEC,aAAa,QAAQ,mBAAmB;AACzE,SAASC,yBAAyB,QAAQ,8BAA8B;AACxE,SAASC,cAAc,QAAQ,wBAAwB;AAiDvD,MAAMC,WAAW,GAAGL,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC;EAAEM;AAA0B,CAAC,KAAK;EACjC,MAAMC,OAAO,GAAGD,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE;EAEvC,OAAOL,GAAG;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiDM,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4CA,OAAO;AACnD;AACA;AACA,aAAa;AACL,CAAC;AACT;AACA,CAAC;AASD,OAAO,MAAMC,kBAAkB,gBAAGX,aAAa,CAAsCY,SAAS,CAAC;AAE/F,OAAO,MAAMC,cAA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,gBAEFjC,KAAA,CAAAmC,aAAA,CAAC5B,yBAAyB;IAAC+B,SAAS,EAAC,uBAAuB;IAACf,KAAK,EAAEA;EAAM,GACrEP,QACsB,CAAC,eAC5BhB,KAAA,CAAAmC,aAAA,CAAC1B,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDM,mBAAmB,CAACwB,WAAW,GAAG,qBAAqB;AAEvD,eAAexB,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"ColorSchemeProvider.js","names":["useSite","React","createContext","useContext","useMemo","createGlobalStyle","css","ThemeProvider","StyledColorSchemeProvider","useChaynsTheme","GlobalStyle","theme","textRgb","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","children","color","colorProp","colorMode","colorModeProp","secondaryColor","siteId","style","iconColor","customVariables","context","internalColor","internalColorMode","designSettings","overrideParagraphFormat","paragraphFormat","contextValue","createElement","Provider","value","className","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { ChaynsDesignSettings, ChaynsParagraphFormat, ColorMode, useSite } from 'chayns-api';\nimport React, { createContext, FC, ReactNode, useContext, useMemo } from 'react';\nimport { createGlobalStyle, css, ThemeProvider } from 'styled-components';\nimport { StyledColorSchemeProvider } from './ColorSchemeProvider.styles';\nimport { useChaynsTheme } from './hooks/useChaynsTheme';\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n /**\n * Additional variables to extend the theme\n */\n customVariables?: Record<string, string>;\n /**\n * An optional color for all icons\n */\n iconColor?: string;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n footer {\n font-size: 0.85rem;\n color: #888;\n margin: 10px 0 0;\n\n & a {\n color: #888;\n letter-spacing: -0.3px;\n }\n }\n\n .chayns-scrollbar {\n ${({ theme }: WithTheme<unknown>) => {\n const textRgb = theme['text-rgb'] ?? '';\n\n return css`\n @supports selector(::-webkit-scrollbar-button) {\n &::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: rgba(${textRgb}, 0.15);\n border-radius: 20px;\n background-clip: padding-box;\n border: solid 3px transparent;\n }\n\n &::-webkit-scrollbar-track {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-corner {\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-button {\n background-color: transparent;\n height: 5px;\n width: 5px;\n }\n }\n\n @supports not selector(::-webkit-scrollbar-button) {\n scrollbar-color: rgba(${textRgb}, 0.15) transparent;\n scrollbar-width: thin;\n }\n `;\n }}\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings?: ChaynsDesignSettings;\n paragraphFormat: ChaynsParagraphFormat[];\n theme: Theme;\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color: colorProp,\n colorMode: colorModeProp,\n secondaryColor,\n siteId,\n style = {},\n iconColor,\n customVariables,\n}) => {\n const context = useContext(ColorSchemeContext);\n\n const { color: internalColor, colorMode: internalColorMode } = useSite();\n\n const color = colorProp ?? context?.designSettings?.color ?? internalColor;\n const colorMode = colorModeProp ?? context?.designSettings?.colorMode ?? internalColorMode;\n\n const overrideParagraphFormat =\n (color && color !== internalColor) || colorMode !== internalColorMode;\n\n const paragraphFormat = useMemo(\n () => (overrideParagraphFormat ? [] : undefined),\n [overrideParagraphFormat],\n );\n\n const contextValue = useChaynsTheme({\n color,\n iconColor,\n colorMode,\n secondaryColor,\n siteId,\n customVariables,\n // Overrides the paragraphFormat on changed color or colorMode\n paragraphFormat,\n });\n\n return (\n <ThemeProvider theme={contextValue.theme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <StyledColorSchemeProvider className=\"color-scheme-provider\" style={style}>\n {children}\n </StyledColorSchemeProvider>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":"AAAA,SAAiEA,OAAO,QAAQ,YAAY;AAC5F,OAAOC,KAAK,IAAIC,aAAa,EAAiBC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAChF,SAASC,iBAAiB,EAAEC,GAAG,EAAEC,aAAa,QAAQ,mBAAmB;AACzE,SAASC,yBAAyB,QAAQ,8BAA8B;AACxE,SAASC,cAAc,QAAQ,wBAAwB;AA6CvD,MAAMC,WAAW,GAAGL,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC;EAAEM;AAA0B,CAAC,KAAK;EACjC,MAAMC,OAAO,GAAGD,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE;EAEvC,OAAOL,GAAG;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiDM,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4CA,OAAO;AACnD;AACA;AACA,aAAa;AACL,CAAC;AACT;AACA,CAAC;AAQD,OAAO,MAAMC,kBAAkB,gBAAGX,aAAa,CAAsCY,SAAS,CAAC;AAE/F,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAMZ,U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W,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDM,mBAAmB,CAACsB,WAAW,GAAG,qBAAqB;AAEvD,eAAetB,mBAAmB","ignoreList":[]}
@@ -4,23 +4,17 @@ import { styled } from 'styled-components';
4
4
  export const StyledColorSchemeProvider = styled.div`
5
5
  color: var(--chayns-color--text);
6
6
 
7
- --focus-color: color-mix(in srgb, currentColor 70%, transparent);
8
- --focus-outline: var(--focus-color) solid 2px;
9
- --focus-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);
10
- --focus-border-radius-circle: 50%;
11
- --focus-border-radius: 3px;
12
-
13
7
  ${({
14
8
  theme
15
9
  }) => getAvailableColorList().map(colorName => {
16
10
  const colorNameRgb = `${colorName}-rgb`;
17
- return [`--chayns-color--${colorName}: ${theme[colorName] ?? ''};`, `--chayns-color-rgb--${colorName}: ${theme[colorNameRgb] ?? ''};`];
11
+ return [`--chayns-color--${colorName}: ${theme[colorName]};`, `--chayns-color-rgb--${colorName}: ${theme[colorNameRgb]};`];
18
12
  })}
19
13
 
20
14
  ${({
21
15
  theme
22
16
  }) => `
23
- --chayns-color--header-bar: ${theme['header-bar'] ?? theme.primary ?? ''};
17
+ --chayns-color--header-bar: ${theme['header-bar'] ?? theme.primary};
24
18
  `}
25
19
 
26
20
  // ToDo: Remove .h1...
@@ -1 +1 @@
1
- {"version":3,"file":"ColorSchemeProvider.styles.js","names":["getAvailableColorList","styled","StyledColorSchemeProvider","div","theme","map","colorName","colorNameRgb","primary"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.styles.ts"],"sourcesContent":["import { getAvailableColorList } from '@chayns/colors';\nimport { styled } from 'styled-components';\nimport type { WithTheme } from './ColorSchemeProvider';\n\ntype ColorSchemeProviderProps = WithTheme<unknown>;\n\n// noinspection CssUnresolvedCustomProperty\nexport const StyledColorSchemeProvider = styled.div<ColorSchemeProviderProps>`\n color: var(--chayns-color--text);\n\n --focus-color: color-mix(in srgb, currentColor 70%, transparent);\n --focus-outline: var(--focus-color) solid 2px;\n --focus-shadow: 0 0 0 3px rgba(0, 102, 204, 0.3);\n --focus-border-radius-circle: 50%;\n --focus-border-radius: 3px;\n\n ${({ theme }: ColorSchemeProviderProps) =>\n getAvailableColorList().map((colorName: string) => {\n const colorNameRgb = `${colorName}-rgb`;\n return [\n `--chayns-color--${colorName}: ${theme[colorName] ?? ''};`,\n `--chayns-color-rgb--${colorName}: ${theme[colorNameRgb] ?? ''};`,\n ];\n })}\n\n ${({ theme }: ColorSchemeProviderProps) =>\n `\n --chayns-color--header-bar: ${theme['header-bar'] ?? theme.primary ?? ''};\n `}\n\n // ToDo: Remove .h1...\n .color-scheme-provider :is(h1,.h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6):first-child {\n margin-top: 0;\n }\n`;\n"],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,MAAM,QAAQ,mBAAmB;AAK1C;AACA,OAAO,MAAMC,yBAAyB,GAAGD,MAAM,CAACE,GAA6B;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAgC,CAAC,KAClCJ,qBAAqB,CAAC,CAAC,CAACK,GAAG,CAAEC,SAAiB,IAAK;EAC/C,MAAMC,YAAY,GAAG,GAAGD,SAAS,MAAM;EACvC,OAAO,CACH,mBAAmBA,SAAS,KAAKF,KAAK,CAACE,SAAS,CAAC,IAAI,EAAE,GAAG,EAC1D,uBAAuBA,SAAS,KAAKF,KAAK,CAACG,YAAY,CAAC,IAAI,EAAE,GAAG,CACpE;AACL,CAAC,CAAC;AACV;AACA,MAAM,CAAC;EAAEH;AAAgC,CAAC,KAClC;AACR,sCAAsCA,KAAK,CAAC,YAAY,CAAC,IAAIA,KAAK,CAACI,OAAO,IAAI,EAAE;AAChF,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ColorSchemeProvider.styles.js","names":["getAvailableColorList","styled","StyledColorSchemeProvider","div","theme","map","colorName","colorNameRgb","primary"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.styles.ts"],"sourcesContent":["import { getAvailableColorList } from '@chayns/colors';\nimport { styled } from 'styled-components';\nimport type { WithTheme } from './ColorSchemeProvider';\n\ntype ColorSchemeProviderProps = WithTheme<unknown>;\n\n// noinspection CssUnresolvedCustomProperty\nexport const StyledColorSchemeProvider = styled.div<ColorSchemeProviderProps>`\n color: var(--chayns-color--text);\n\n ${({ theme }: ColorSchemeProviderProps) =>\n getAvailableColorList().map((colorName: string) => {\n const colorNameRgb = `${colorName}-rgb`;\n return [\n `--chayns-color--${colorName}: ${theme[colorName]};`,\n `--chayns-color-rgb--${colorName}: ${theme[colorNameRgb]};`,\n ];\n })}\n\n ${({ theme }: ColorSchemeProviderProps) =>\n `\n --chayns-color--header-bar: ${theme['header-bar'] ?? theme.primary};\n `}\n\n // ToDo: Remove .h1...\n .color-scheme-provider :is(h1,.h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6):first-child {\n margin-top: 0;\n }\n`;\n"],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,MAAM,QAAQ,mBAAmB;AAK1C;AACA,OAAO,MAAMC,yBAAyB,GAAGD,MAAM,CAACE,GAA6B;AAC7E;AACA;AACA,MAAM,CAAC;EAAEC;AAAgC,CAAC,KAClCJ,qBAAqB,CAAC,CAAC,CAACK,GAAG,CAAEC,SAAiB,IAAK;EAC/C,MAAMC,YAAY,GAAG,GAAGD,SAAS,MAAM;EACvC,OAAO,CACH,mBAAmBA,SAAS,KAAKF,KAAK,CAACE,SAAS,CAAC,GAAG,EACpD,uBAAuBA,SAAS,KAAKF,KAAK,CAACG,YAAY,CAAC,GAAG,CAC9D;AACL,CAAC,CAAC;AACV;AACA,MAAM,CAAC;EAAEH;AAAgC,CAAC,KAClC;AACR,sCAAsCA,KAAK,CAAC,YAAY,CAAC,IAAIA,KAAK,CAACI,OAAO;AAC1E,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -10,7 +10,6 @@ import { DropdownDirection } from '../../types/dropdown';
10
10
  import { useElementSize } from '../../hooks/element';
11
11
  import { ComboBoxSize } from './ComboBox.types';
12
12
  import { getComboBoxWidthResult } from './ComboBox.utils';
13
- import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
14
13
  const ComboBox = /*#__PURE__*/forwardRef(({
15
14
  bodyWidth,
16
15
  direction = DropdownDirection.RIGHT,
@@ -37,8 +36,7 @@ const ComboBox = /*#__PURE__*/forwardRef(({
37
36
  onInputBlur,
38
37
  shouldShowTransparentBackground = false,
39
38
  inputValue,
40
- shouldDropDownUseMaxItemWidth = false,
41
- shouldEnableKeyboardHighlighting
39
+ shouldDropDownUseMaxItemWidth = false
42
40
  }, ref) => {
43
41
  const [internalSelectedItem, setInternalSelectedItem] = useState();
44
42
  const [isAnimating, setIsAnimating] = useState(false);
@@ -47,8 +45,6 @@ const ComboBox = /*#__PURE__*/forwardRef(({
47
45
  const [focusedIndex, setFocusedIndex] = useState(null);
48
46
  const isInputFocused = useRef(false);
49
47
  const styledComboBoxElementRef = useRef(null);
50
- const comboBoxHeaderRef = useRef(null);
51
- const comboBoxInputRef = useRef(null);
52
48
  const contentRef = useRef(null);
53
49
  const parentSize = useElementSize(styledComboBoxElementRef, {
54
50
  shouldUseParentElement: true
@@ -84,7 +80,6 @@ const ComboBox = /*#__PURE__*/forwardRef(({
84
80
  setBodyMinWidth(calculatedBodyMinWidth);
85
81
  }, [functions, internalSelectedItem, lists, parentSize, placeholder, prefix, prefixMinWidth, selectedItem, shouldDropDownUseMaxItemWidth, shouldShowBigImage, shouldShowClearIcon, shouldUseCurrentItemWidth, shouldUseFullWidth, values]);
86
82
  const shouldChangeColor = useMemo(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]);
87
- const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
88
83
  const shouldDisableActions = useMemo(() => {
89
84
  if (!selectedItem) {
90
85
  return false;
@@ -126,16 +121,6 @@ const ComboBox = /*#__PURE__*/forwardRef(({
126
121
  }
127
122
  setIsAnimating(false);
128
123
  }, [onHide]);
129
- const restoreTriggerFocus = useCallback(() => {
130
- // Delay is needed so focus happens after dropdown close/render cycle.
131
- requestAnimationFrame(() => {
132
- if (typeof inputValue === 'string') {
133
- comboBoxInputRef.current?.focus();
134
- return;
135
- }
136
- comboBoxHeaderRef.current?.focus();
137
- });
138
- }, [inputValue]);
139
124
 
140
125
  /**
141
126
  * This function sets the selected item
@@ -151,15 +136,13 @@ const ComboBox = /*#__PURE__*/forwardRef(({
151
136
  if (shouldPreventSelection) return;
152
137
  setInternalSelectedItem(itemToSelect);
153
138
  handleClose();
154
- restoreTriggerFocus();
155
139
  });
156
140
  return;
157
141
  }
158
142
  }
159
143
  setInternalSelectedItem(itemToSelect);
160
144
  handleClose();
161
- restoreTriggerFocus();
162
- }, [handleClose, onSelect, restoreTriggerFocus]);
145
+ }, [handleClose, onSelect]);
163
146
  const handleClear = useCallback(event => {
164
147
  event.preventDefault();
165
148
  event.stopPropagation();
@@ -168,12 +151,6 @@ const ComboBox = /*#__PURE__*/forwardRef(({
168
151
  useEffect(() => {
169
152
  const handleKeyDown = e => {
170
153
  if (!isAnimating) return;
171
- if (e.key === 'Escape') {
172
- e.preventDefault();
173
- handleClose();
174
- restoreTriggerFocus();
175
- return;
176
- }
177
154
  if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
178
155
  e.preventDefault();
179
156
  const children = contentRef.current?.children;
@@ -219,7 +196,7 @@ const ComboBox = /*#__PURE__*/forwardRef(({
219
196
  };
220
197
  document.addEventListener('keydown', handleKeyDown);
221
198
  return () => document.removeEventListener('keydown', handleKeyDown);
222
- }, [focusedIndex, handleClose, handleSetSelectedItem, isAnimating, lists, restoreTriggerFocus]);
199
+ }, [focusedIndex, handleSetSelectedItem, isAnimating, lists]);
223
200
 
224
201
  /**
225
202
  * This function sets the external selected item
@@ -278,21 +255,6 @@ const ComboBox = /*#__PURE__*/forwardRef(({
278
255
  }
279
256
  }
280
257
  }, [handleClose, handleOpen, isAnimating, isDisabled]);
281
- const handleHeaderKeyDown = useCallback(event => {
282
- if (isDisabled || typeof inputValue === 'string') {
283
- return;
284
- }
285
- if (event.key === 'Escape' && isAnimating) {
286
- event.preventDefault();
287
- handleClose();
288
- restoreTriggerFocus();
289
- return;
290
- }
291
- if (event.key === 'Enter' || event.key === ' ') {
292
- event.preventDefault();
293
- handleHeaderClick();
294
- }
295
- }, [handleClose, handleHeaderClick, inputValue, isAnimating, isDisabled, restoreTriggerFocus]);
296
258
  useImperativeHandle(ref, () => ({
297
259
  hide: handleClose,
298
260
  show: handleOpen
@@ -314,7 +276,6 @@ const ComboBox = /*#__PURE__*/forwardRef(({
314
276
  $minWidth: minWidth,
315
277
  $shouldUseFullWidth: shouldUseFullWidth
316
278
  }, /*#__PURE__*/React.createElement(StyledComboBoxHeader, {
317
- ref: comboBoxHeaderRef,
318
279
  $direction: direction,
319
280
  onClick: handleHeaderClick,
320
281
  $isOpen: isAnimating,
@@ -323,12 +284,7 @@ const ComboBox = /*#__PURE__*/forwardRef(({
323
284
  $shouldShowTransparentBackground: shouldShowTransparentBackground,
324
285
  $isDisabled: isDisabled,
325
286
  $shouldChangeColor: shouldChangeColor,
326
- $shouldShowBigImage: shouldShowBigImage,
327
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
328
- onKeyDown: handleHeaderKeyDown,
329
- tabIndex: !isDisabled && typeof inputValue !== 'string' ? 0 : undefined,
330
- role: !isDisabled && typeof inputValue !== 'string' ? 'button' : undefined,
331
- "aria-expanded": !isDisabled && typeof inputValue !== 'string' ? isAnimating : undefined
287
+ $shouldShowBigImage: shouldShowBigImage
332
288
  }, /*#__PURE__*/React.createElement(StyledComboBoxPrefixAndPlaceholderWrapper, null, prefix && /*#__PURE__*/React.createElement(StyledComboBoxPrefix, {
333
289
  $prefixMinWidth: prefixMinWidth
334
290
  }, prefix), /*#__PURE__*/React.createElement(StyledComboBoxPlaceholder, {
@@ -340,7 +296,6 @@ const ComboBox = /*#__PURE__*/forwardRef(({
340
296
  }), placeholderIcon && /*#__PURE__*/React.createElement(Icon, {
341
297
  icons: placeholderIcon
342
298
  }), typeof inputValue === 'string' ? /*#__PURE__*/React.createElement(StyledComboBoxInput, {
343
- ref: comboBoxInputRef,
344
299
  disabled: isDisabled,
345
300
  value: inputValue,
346
301
  onChange: onInputChange,
@@ -375,7 +330,7 @@ const ComboBox = /*#__PURE__*/forwardRef(({
375
330
  className: "chayns-scrollbar",
376
331
  ref: contentRef,
377
332
  tabIndex: 0
378
- }, comboBoxGroups))), [bodyMinWidth, bodyWidth, comboBoxGroups, container, contentHeight, direction, handleClear, handleClose, handleHeaderClick, handleHeaderKeyDown, handleInputBlur, handleInputFocus, inputValue, internalSelectedItem, isAnimating, isDisabled, isTouch, maxHeight, minWidth, onInputChange, placeholderIcon, placeholderImageUrl, placeholderText, prefix, prefixMinWidth, selectedItem, shouldChangeColor, shouldDisableActions, shouldCaptureEvents, shouldShowKeyboardHighlighting, shouldShowBigImage, shouldShowClearIcon, shouldShowRoundPlaceholderImage, shouldShowTransparentBackground, shouldUseFullWidth, size]);
333
+ }, comboBoxGroups))), [bodyMinWidth, bodyWidth, comboBoxGroups, container, contentHeight, direction, handleClear, handleClose, handleHeaderClick, handleInputBlur, handleInputFocus, inputValue, internalSelectedItem, isAnimating, isDisabled, isTouch, maxHeight, minWidth, onInputChange, placeholderIcon, placeholderImageUrl, placeholderText, prefix, prefixMinWidth, selectedItem, shouldChangeColor, shouldDisableActions, shouldCaptureEvents, shouldShowBigImage, shouldShowClearIcon, shouldShowRoundPlaceholderImage, shouldShowTransparentBackground, shouldUseFullWidth, size]);
379
334
  });
380
335
  ComboBox.displayName = 'ComboBox';
381
336
  export default ComboBox;