@chayns-components/core 5.4.7 → 5.4.8-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/AGENTS.md +12 -0
  2. package/lib/cjs/components/accordion/Accordion.js +107 -12
  3. package/lib/cjs/components/accordion/Accordion.js.map +1 -1
  4. package/lib/cjs/components/accordion/Accordion.styles.js +23 -3
  5. package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
  6. package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
  7. package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  8. package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js +36 -19
  9. package/lib/cjs/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  10. package/lib/cjs/components/accordion/accordion-head/AccordionHead.js +6 -3
  11. package/lib/cjs/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  12. package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
  13. package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  14. package/lib/cjs/components/amount-control/AmountControl.js +31 -17
  15. package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
  16. package/lib/cjs/components/amount-control/AmountControl.styles.js +18 -2
  17. package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
  18. package/lib/cjs/components/button/Button.js +5 -1
  19. package/lib/cjs/components/button/Button.js.map +1 -1
  20. package/lib/cjs/components/button/Button.styles.js +10 -0
  21. package/lib/cjs/components/button/Button.styles.js.map +1 -1
  22. package/lib/cjs/components/button/Button.types.js.map +1 -1
  23. package/lib/cjs/components/checkbox/Checkbox.js +5 -1
  24. package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
  25. package/lib/cjs/components/checkbox/Checkbox.styles.js +29 -2
  26. package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
  27. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
  28. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  29. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
  30. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  31. package/lib/cjs/components/combobox/ComboBox.js +68 -11
  32. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  33. package/lib/cjs/components/combobox/ComboBox.styles.js +11 -0
  34. package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
  35. package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -1
  36. package/lib/cjs/components/context-menu/ContextMenu.js +146 -42
  37. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  38. package/lib/cjs/components/context-menu/ContextMenu.styles.js +38 -0
  39. package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
  40. package/lib/cjs/components/context-menu/ContextMenu.types.js.map +1 -1
  41. package/lib/cjs/components/context-menu/ContextMenu.utils.js +27 -1
  42. package/lib/cjs/components/context-menu/ContextMenu.utils.js.map +1 -1
  43. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js +3 -8
  44. package/lib/cjs/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  45. package/lib/cjs/components/file-input/FileInput.js +4 -2
  46. package/lib/cjs/components/file-input/FileInput.js.map +1 -1
  47. package/lib/cjs/components/file-list/file-item/FileItem.js +48 -25
  48. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  49. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +25 -1
  50. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  51. package/lib/cjs/components/file-select/FileSelect.js +27 -4
  52. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  53. package/lib/cjs/components/file-select/FileSelect.styles.js +10 -0
  54. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  55. package/lib/cjs/components/filter/Filter.js +51 -16
  56. package/lib/cjs/components/filter/Filter.js.map +1 -1
  57. package/lib/cjs/components/filter/Filter.styles.js +9 -0
  58. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  59. package/lib/cjs/components/filter/filter-content/FilterContent.js +14 -5
  60. package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
  61. package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -1
  62. package/lib/cjs/components/filter-buttons/FilterButtons.js +69 -4
  63. package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
  64. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +40 -2
  65. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  66. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
  67. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  68. package/lib/cjs/components/grid-image/GridImage.js +20 -2
  69. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  70. package/lib/cjs/components/grid-image/GridImage.styles.js +11 -2
  71. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  72. package/lib/cjs/components/grouped-image/GroupedImage.js +23 -4
  73. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  74. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +9 -0
  75. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  76. package/lib/cjs/components/highlight-slider/HighlightSlider.js +13 -3
  77. package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
  78. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +21 -4
  79. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  80. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +11 -2
  81. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  82. package/lib/cjs/components/icon/Icon.js +24 -5
  83. package/lib/cjs/components/icon/Icon.js.map +1 -1
  84. package/lib/cjs/components/icon/Icon.styles.js +23 -0
  85. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  86. package/lib/cjs/components/input/Input.js +29 -8
  87. package/lib/cjs/components/input/Input.js.map +1 -1
  88. package/lib/cjs/components/input/Input.styles.js +38 -3
  89. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  90. package/lib/cjs/components/list/List.js +124 -37
  91. package/lib/cjs/components/list/List.js.map +1 -1
  92. package/lib/cjs/components/list/List.utils.js +213 -1
  93. package/lib/cjs/components/list/List.utils.js.map +1 -1
  94. package/lib/cjs/components/list/list-item/ListItem.js +84 -3
  95. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  96. package/lib/cjs/components/list/list-item/ListItem.styles.js +7 -0
  97. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  98. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -1
  99. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  100. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js +5 -1
  101. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  102. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +1 -0
  103. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  104. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +3 -0
  105. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  106. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -0
  107. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  108. package/lib/cjs/components/list/list-item/useListItemFocus.js +47 -0
  109. package/lib/cjs/components/list/list-item/useListItemFocus.js.map +1 -0
  110. package/lib/cjs/components/mention-finder/MentionFinder.js +43 -5
  111. package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
  112. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  113. package/lib/cjs/components/multi-action-button/MultiActionButton.js +36 -3
  114. package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
  115. package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js +6 -0
  116. package/lib/cjs/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
  117. package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  118. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +7 -1
  119. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  120. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
  121. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  122. package/lib/cjs/components/number-input/NumberInput.js +13 -10
  123. package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
  124. package/lib/cjs/components/page-provider/PageProvider.js +4 -2
  125. package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
  126. package/lib/cjs/components/popup/Popup.js +8 -1
  127. package/lib/cjs/components/popup/Popup.js.map +1 -1
  128. package/lib/cjs/components/radio-button/RadioButton.js +29 -15
  129. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  130. package/lib/cjs/components/radio-button/RadioButton.styles.js +19 -8
  131. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  132. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
  133. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  134. package/lib/cjs/components/search-box/SearchBox.js +21 -6
  135. package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
  136. package/lib/cjs/components/search-input/SearchInput.js +56 -43
  137. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  138. package/lib/cjs/components/search-input/SearchInput.styles.js +26 -2
  139. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  140. package/lib/cjs/components/select-button/SelectButton.js +4 -2
  141. package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
  142. package/lib/cjs/components/setup-wizard/SetupWizard.js +10 -4
  143. package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
  144. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
  145. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  146. package/lib/cjs/components/sharing-bar/SharingBar.js +31 -6
  147. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  148. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +5 -0
  149. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  150. package/lib/cjs/components/sharing-button/SharingButton.js +4 -2
  151. package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
  152. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +3 -1
  153. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  154. package/lib/cjs/components/signature/Signature.js +6 -3
  155. package/lib/cjs/components/signature/Signature.js.map +1 -1
  156. package/lib/cjs/components/slider/Slider.js +30 -7
  157. package/lib/cjs/components/slider/Slider.js.map +1 -1
  158. package/lib/cjs/components/slider/Slider.styles.js +9 -2
  159. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  160. package/lib/cjs/components/slider-button/SliderButton.js +63 -6
  161. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  162. package/lib/cjs/components/slider-button/SliderButton.styles.js +15 -2
  163. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  164. package/lib/cjs/components/slider-button/SliderButton.types.js +6 -0
  165. package/lib/cjs/components/slider-button/SliderButton.types.js.map +1 -0
  166. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +66 -0
  167. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
  168. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +47 -0
  169. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
  170. package/lib/cjs/components/tag-input/TagInput.js +92 -36
  171. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  172. package/lib/cjs/components/tag-input/TagInput.styles.js +29 -3
  173. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  174. package/lib/cjs/components/text-area/TextArea.js +17 -8
  175. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  176. package/lib/cjs/components/text-area/TextArea.styles.js +15 -1
  177. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  178. package/lib/cjs/components/truncation/Truncation.js +17 -3
  179. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  180. package/lib/cjs/components/truncation/Truncation.styles.js +18 -1
  181. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  182. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +68 -0
  183. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -0
  184. package/lib/cjs/utils/file.js.map +1 -1
  185. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +29 -0
  186. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +1 -0
  187. package/lib/esm/components/accordion/Accordion.js +105 -12
  188. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  189. package/lib/esm/components/accordion/Accordion.styles.js +23 -3
  190. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  191. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
  192. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  193. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +33 -19
  194. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  195. package/lib/esm/components/accordion/accordion-head/AccordionHead.js +6 -3
  196. package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  197. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
  198. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  199. package/lib/esm/components/amount-control/AmountControl.js +30 -16
  200. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  201. package/lib/esm/components/amount-control/AmountControl.styles.js +18 -2
  202. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  203. package/lib/esm/components/button/Button.js +5 -1
  204. package/lib/esm/components/button/Button.js.map +1 -1
  205. package/lib/esm/components/button/Button.styles.js +10 -0
  206. package/lib/esm/components/button/Button.styles.js.map +1 -1
  207. package/lib/esm/components/button/Button.types.js.map +1 -1
  208. package/lib/esm/components/checkbox/Checkbox.js +5 -1
  209. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  210. package/lib/esm/components/checkbox/Checkbox.styles.js +29 -2
  211. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  212. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
  213. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  214. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
  215. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  216. package/lib/esm/components/combobox/ComboBox.js +61 -7
  217. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  218. package/lib/esm/components/combobox/ComboBox.styles.js +11 -0
  219. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  220. package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
  221. package/lib/esm/components/context-menu/ContextMenu.js +145 -42
  222. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  223. package/lib/esm/components/context-menu/ContextMenu.styles.js +38 -0
  224. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  225. package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
  226. package/lib/esm/components/context-menu/ContextMenu.utils.js +24 -0
  227. package/lib/esm/components/context-menu/ContextMenu.utils.js.map +1 -1
  228. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js +3 -8
  229. package/lib/esm/components/context-menu/context-menu-content/ContextMenuContent.js.map +1 -1
  230. package/lib/esm/components/file-input/FileInput.js +4 -2
  231. package/lib/esm/components/file-input/FileInput.js.map +1 -1
  232. package/lib/esm/components/file-list/file-item/FileItem.js +49 -26
  233. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  234. package/lib/esm/components/file-list/file-item/FileItem.styles.js +24 -0
  235. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  236. package/lib/esm/components/file-select/FileSelect.js +27 -4
  237. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  238. package/lib/esm/components/file-select/FileSelect.styles.js +10 -0
  239. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  240. package/lib/esm/components/filter/Filter.js +52 -16
  241. package/lib/esm/components/filter/Filter.js.map +1 -1
  242. package/lib/esm/components/filter/Filter.styles.js +9 -0
  243. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  244. package/lib/esm/components/filter/filter-content/FilterContent.js +15 -5
  245. package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
  246. package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -1
  247. package/lib/esm/components/filter-buttons/FilterButtons.js +69 -5
  248. package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
  249. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +40 -2
  250. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  251. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
  252. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  253. package/lib/esm/components/grid-image/GridImage.js +20 -2
  254. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  255. package/lib/esm/components/grid-image/GridImage.styles.js +10 -1
  256. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  257. package/lib/esm/components/grouped-image/GroupedImage.js +22 -4
  258. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  259. package/lib/esm/components/grouped-image/GroupedImage.styles.js +9 -0
  260. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  261. package/lib/esm/components/highlight-slider/HighlightSlider.js +13 -3
  262. package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
  263. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +20 -3
  264. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  265. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +10 -1
  266. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  267. package/lib/esm/components/icon/Icon.js +26 -7
  268. package/lib/esm/components/icon/Icon.js.map +1 -1
  269. package/lib/esm/components/icon/Icon.styles.js +23 -0
  270. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  271. package/lib/esm/components/input/Input.js +24 -4
  272. package/lib/esm/components/input/Input.js.map +1 -1
  273. package/lib/esm/components/input/Input.styles.js +38 -3
  274. package/lib/esm/components/input/Input.styles.js.map +1 -1
  275. package/lib/esm/components/list/List.js +123 -37
  276. package/lib/esm/components/list/List.js.map +1 -1
  277. package/lib/esm/components/list/List.utils.js +202 -0
  278. package/lib/esm/components/list/List.utils.js.map +1 -1
  279. package/lib/esm/components/list/list-item/ListItem.js +85 -4
  280. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  281. package/lib/esm/components/list/list-item/ListItem.styles.js +7 -0
  282. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  283. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +6 -2
  284. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  285. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js +4 -0
  286. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  287. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +1 -0
  288. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  289. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +4 -1
  290. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  291. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +1 -0
  292. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  293. package/lib/esm/components/list/list-item/useListItemFocus.js +40 -0
  294. package/lib/esm/components/list/list-item/useListItemFocus.js.map +1 -0
  295. package/lib/esm/components/mention-finder/MentionFinder.js +39 -3
  296. package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
  297. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  298. package/lib/esm/components/multi-action-button/MultiActionButton.js +36 -3
  299. package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
  300. package/lib/esm/components/multi-action-button/MultiActionButton.styles.js +6 -0
  301. package/lib/esm/components/multi-action-button/MultiActionButton.styles.js.map +1 -1
  302. package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  303. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -1
  304. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  305. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
  306. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  307. package/lib/esm/components/number-input/NumberInput.js +13 -10
  308. package/lib/esm/components/number-input/NumberInput.js.map +1 -1
  309. package/lib/esm/components/page-provider/PageProvider.js +4 -2
  310. package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
  311. package/lib/esm/components/popup/Popup.js +8 -1
  312. package/lib/esm/components/popup/Popup.js.map +1 -1
  313. package/lib/esm/components/radio-button/RadioButton.js +29 -15
  314. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  315. package/lib/esm/components/radio-button/RadioButton.styles.js +19 -8
  316. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  317. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
  318. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  319. package/lib/esm/components/search-box/SearchBox.js +18 -4
  320. package/lib/esm/components/search-box/SearchBox.js.map +1 -1
  321. package/lib/esm/components/search-input/SearchInput.js +56 -44
  322. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  323. package/lib/esm/components/search-input/SearchInput.styles.js +25 -1
  324. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  325. package/lib/esm/components/select-button/SelectButton.js +4 -2
  326. package/lib/esm/components/select-button/SelectButton.js.map +1 -1
  327. package/lib/esm/components/setup-wizard/SetupWizard.js +10 -4
  328. package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
  329. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
  330. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  331. package/lib/esm/components/sharing-bar/SharingBar.js +30 -5
  332. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  333. package/lib/esm/components/sharing-bar/SharingBar.styles.js +5 -0
  334. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  335. package/lib/esm/components/sharing-button/SharingButton.js +4 -2
  336. package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
  337. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +3 -1
  338. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  339. package/lib/esm/components/signature/Signature.js +6 -3
  340. package/lib/esm/components/signature/Signature.js.map +1 -1
  341. package/lib/esm/components/slider/Slider.js +30 -7
  342. package/lib/esm/components/slider/Slider.js.map +1 -1
  343. package/lib/esm/components/slider/Slider.styles.js +8 -1
  344. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  345. package/lib/esm/components/slider-button/SliderButton.js +62 -6
  346. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  347. package/lib/esm/components/slider-button/SliderButton.styles.js +14 -1
  348. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  349. package/lib/esm/components/slider-button/SliderButton.types.js +2 -0
  350. package/lib/esm/components/slider-button/SliderButton.types.js.map +1 -0
  351. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +56 -0
  352. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
  353. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +38 -0
  354. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
  355. package/lib/esm/components/tag-input/TagInput.js +86 -35
  356. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  357. package/lib/esm/components/tag-input/TagInput.styles.js +27 -1
  358. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  359. package/lib/esm/components/text-area/TextArea.js +18 -9
  360. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  361. package/lib/esm/components/text-area/TextArea.styles.js +14 -0
  362. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  363. package/lib/esm/components/truncation/Truncation.js +18 -4
  364. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  365. package/lib/esm/components/truncation/Truncation.styles.js +17 -0
  366. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  367. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +61 -0
  368. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -0
  369. package/lib/esm/utils/file.js.map +1 -1
  370. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +24 -0
  371. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +1 -0
  372. package/lib/types/components/accordion/Accordion.d.ts +5 -0
  373. package/lib/types/components/accordion/Accordion.styles.d.ts +8 -4
  374. package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
  375. package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +7 -2
  376. package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +1 -0
  377. package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
  378. package/lib/types/components/amount-control/AmountControl.d.ts +5 -0
  379. package/lib/types/components/amount-control/AmountControl.styles.d.ts +8 -4
  380. package/lib/types/components/button/Button.styles.d.ts +8 -6
  381. package/lib/types/components/button/Button.types.d.ts +8 -0
  382. package/lib/types/components/checkbox/Checkbox.d.ts +4 -0
  383. package/lib/types/components/checkbox/Checkbox.styles.d.ts +5 -1
  384. package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +5 -0
  385. package/lib/types/components/combobox/ComboBox.styles.d.ts +4 -2
  386. package/lib/types/components/combobox/ComboBox.types.d.ts +5 -0
  387. package/lib/types/components/context-menu/ContextMenu.styles.d.ts +4 -2
  388. package/lib/types/components/context-menu/ContextMenu.types.d.ts +6 -0
  389. package/lib/types/components/context-menu/ContextMenu.utils.d.ts +10 -0
  390. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -1
  391. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +2 -2
  392. package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +2 -2
  393. package/lib/types/components/expandable-content/ExpandableContent.styles.d.ts +2 -2
  394. package/lib/types/components/file-input/FileInput.d.ts +4 -0
  395. package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
  396. package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +3 -0
  397. package/lib/types/components/file-select/FileSelect.d.ts +4 -0
  398. package/lib/types/components/file-select/FileSelect.styles.d.ts +6 -4
  399. package/lib/types/components/filter/Filter.d.ts +1 -0
  400. package/lib/types/components/filter/Filter.styles.d.ts +6 -4
  401. package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +4 -0
  402. package/lib/types/components/filter-buttons/FilterButtons.d.ts +4 -0
  403. package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +5 -0
  404. package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +12 -8
  405. package/lib/types/components/grid-image/GridImage.d.ts +4 -0
  406. package/lib/types/components/grid-image/GridImage.styles.d.ts +4 -2
  407. package/lib/types/components/grouped-image/GroupedImage.d.ts +4 -0
  408. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +8 -6
  409. package/lib/types/components/highlight-slider/HighlightSlider.d.ts +4 -0
  410. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +3 -0
  411. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +9 -5
  412. package/lib/types/components/icon/Icon.d.ts +4 -0
  413. package/lib/types/components/icon/Icon.styles.d.ts +1 -0
  414. package/lib/types/components/input/Input.d.ts +4 -0
  415. package/lib/types/components/input/Input.styles.d.ts +17 -9
  416. package/lib/types/components/list/List.d.ts +11 -0
  417. package/lib/types/components/list/List.utils.d.ts +32 -1
  418. package/lib/types/components/list/list-item/ListItem.d.ts +4 -0
  419. package/lib/types/components/list/list-item/ListItem.styles.d.ts +64 -64
  420. package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +2 -2
  421. package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +195 -194
  422. package/lib/types/components/list/list-item/useListItemFocus.d.ts +13 -0
  423. package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +2 -2
  424. package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +4 -4
  425. package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +2 -2
  426. package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +7 -0
  427. package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +4 -1
  428. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +4 -2
  429. package/lib/types/components/number-input/NumberInput.d.ts +4 -0
  430. package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +2 -2
  431. package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +6 -6
  432. package/lib/types/components/radio-button/RadioButton.d.ts +4 -0
  433. package/lib/types/components/radio-button/RadioButton.styles.d.ts +15 -9
  434. package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +5 -0
  435. package/lib/types/components/search-box/SearchBox.d.ts +4 -0
  436. package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
  437. package/lib/types/components/search-input/SearchInput.d.ts +4 -0
  438. package/lib/types/components/search-input/SearchInput.styles.d.ts +17 -9
  439. package/lib/types/components/select-button/SelectButton.d.ts +4 -0
  440. package/lib/types/components/setup-wizard/SetupWizard.d.ts +5 -0
  441. package/lib/types/components/sharing-bar/SharingBar.d.ts +4 -0
  442. package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
  443. package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +10 -2
  444. package/lib/types/components/signature/Signature.d.ts +4 -0
  445. package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
  446. package/lib/types/components/slider/Slider.d.ts +8 -0
  447. package/lib/types/components/slider/Slider.styles.d.ts +18 -14
  448. package/lib/types/components/slider-button/SliderButton.d.ts +1 -28
  449. package/lib/types/components/slider-button/SliderButton.styles.d.ts +6 -4
  450. package/lib/types/components/slider-button/SliderButton.types.d.ts +32 -0
  451. package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +17 -0
  452. package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +13 -0
  453. package/lib/types/components/tag-input/TagInput.d.ts +4 -0
  454. package/lib/types/components/tag-input/TagInput.styles.d.ts +12 -2
  455. package/lib/types/components/text-area/TextArea.d.ts +4 -0
  456. package/lib/types/components/text-area/TextArea.styles.d.ts +1 -0
  457. package/lib/types/components/truncation/Truncation.d.ts +4 -0
  458. package/lib/types/components/truncation/Truncation.styles.d.ts +7 -2
  459. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +5 -0
  460. package/lib/types/utils/file.d.ts +1 -1
  461. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +9 -0
  462. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"AmountControl.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","checkForValidAmount","Icon","StyledAmountControl","StyledAmountControlInput","StyledAmountControlPseudoInput","StyledInputWrapper","StyledMotionAmountControlButton","AmountControl","amount","icon","iconColor","isDisabled","label","maxAmount","minAmount","onChange","shouldForceLabel","shouldShowAddIconOnMinAmount","shouldShowIcon","shouldShowWideInput","step","stepProp","amountValue","setAmountValue","inputValue","setInputValue","toString","displayState","setDisplayState","Number","isSafeInteger","inputRef","hasFocus","handleAmountAdd","prevState","newAmount","handleAmountRemove","handleFirstAmount","handleDeleteIconClick","window","setTimeout","current","focus","handleInputBlur","checkedValue","Math","round","handleInputChange","event","value","target","valueBefore","replace","inputLabel","createElement","onClick","$isDisabled","initial","includes","key","width","opacity","padding","animate","exit","transition","duration","type","disabled","icons","size","color","$shouldShowWideInput","$shouldShowRightIcon","ref","$displayState","$shouldShowIcon","$hasFocus","onBlur","$color","undefined","displayName"],"sources":["../../../../src/components/amount-control/AmountControl.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEvent,\n FC,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { checkForValidAmount } from '../../utils/amountControl';\nimport Icon from '../icon/Icon';\nimport {\n StyledAmountControl,\n StyledAmountControlInput,\n StyledAmountControlPseudoInput,\n StyledInputWrapper,\n StyledMotionAmountControlButton,\n} from './AmountControl.styles';\n\nexport type DisplayState = 'default' | 'normal' | 'maxAmount' | 'minAmount';\n\nexport type AmountControlProps = {\n /**\n * The amount that should be displayed.\n */\n amount?: number;\n /**\n * The icon that should be displayed if no amount is selected.\n */\n icon?: string;\n /**\n * The color of the icon.\n */\n iconColor?: string;\n /**\n * Whether the control should be disabled\n */\n isDisabled?: boolean;\n /**\n * A Text that should be displayed if no amount is selected;\n */\n label?: string;\n /**\n * The maximum allowed amount. If the maxAmount is reached, a check icon is displayed on the left side.\n */\n maxAmount?: number;\n /**\n * The minimum allowed amount.\n */\n minAmount?: number;\n /**\n * A Function that is executed when the amount is changed\n */\n onChange?: (amount: number) => void;\n /**\n * Whether the label should be displayed even if an amount is selected.\n */\n shouldForceLabel?: boolean;\n /**\n * Whether the \"add\"-icon should be displayed if the minAmount is reached.\n */\n shouldShowAddIconOnMinAmount?: boolean;\n /**\n * Whether the icon should be displayed if no amount is selected\n */\n shouldShowIcon?: boolean;\n /**\n * Whether the input should be wider\n */\n shouldShowWideInput?: boolean;\n /**\n * Defines the amount that will change when adjusted\n */\n step?: number;\n};\n\nconst AmountControl: FC<AmountControlProps> = ({\n amount,\n icon,\n iconColor,\n isDisabled = false,\n label,\n maxAmount,\n minAmount = 0,\n onChange,\n shouldForceLabel = false,\n shouldShowAddIconOnMinAmount = false,\n shouldShowIcon = true,\n shouldShowWideInput = false,\n step: stepProp = 1,\n}) => {\n const [amountValue, setAmountValue] = useState(minAmount);\n const [inputValue, setInputValue] = useState(minAmount.toString());\n const [displayState, setDisplayState] = useState<DisplayState>('default');\n\n const step = useMemo(\n () => (Number.isSafeInteger(stepProp) && stepProp >= 1 ? stepProp : 1),\n [stepProp],\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n /**\n * This function controls the displayState\n */\n useEffect(() => {\n switch (true) {\n case maxAmount && amountValue >= maxAmount:\n setDisplayState('maxAmount');\n return;\n case amountValue > minAmount:\n setDisplayState('normal');\n return;\n case amountValue === minAmount && amountValue >= 0 && shouldShowAddIconOnMinAmount:\n setDisplayState('minAmount');\n return;\n default:\n setDisplayState('default');\n }\n }, [amountValue, maxAmount, minAmount, shouldShowAddIconOnMinAmount]);\n\n const hasFocus = useMemo(() => displayState !== 'default', [displayState]);\n\n /**\n * Function that sets the amountValue to the amount\n */\n useEffect(() => {\n if (typeof amount !== 'number') {\n return;\n }\n\n setAmountValue(checkForValidAmount({ amount, maxAmount, minAmount }));\n setInputValue(checkForValidAmount({ amount, maxAmount, minAmount }).toString());\n }, [amount, maxAmount, minAmount]);\n\n const handleAmountAdd = useCallback(() => {\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState + step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return typeof amount === 'number' ? prevState : newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) + step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [amount, maxAmount, minAmount, onChange, step]);\n\n const handleAmountRemove = useCallback(() => {\n if (displayState === 'default') {\n return;\n }\n\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState - step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) - step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [displayState, maxAmount, minAmount, onChange, step]);\n\n const handleFirstAmount = useCallback(() => {\n if (amountValue !== minAmount) {\n return;\n }\n\n if (typeof onChange === 'function') {\n onChange(minAmount + step);\n }\n\n setAmountValue(minAmount + step);\n setInputValue((minAmount + step).toString());\n }, [amountValue, minAmount, onChange, step]);\n\n const handleDeleteIconClick = useCallback(() => {\n if (inputValue === '0') {\n window.setTimeout(() => {\n inputRef.current?.focus();\n }, 500);\n } else {\n handleAmountRemove();\n }\n }, [handleAmountRemove, inputValue]);\n\n const handleInputBlur = useCallback(() => {\n const checkedValue = checkForValidAmount({\n minAmount,\n maxAmount,\n amount: Math.round(Number(inputValue) / step) * step,\n });\n\n setAmountValue(checkedValue);\n setInputValue(checkedValue.toString());\n\n if (typeof onChange === 'function') {\n onChange(checkedValue);\n }\n\n if (inputValue === '') {\n setInputValue(minAmount.toString());\n }\n }, [inputValue, maxAmount, minAmount, onChange, step]);\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const { value } = event.target;\n\n const valueBefore = Number(value.replace(/\\D/g, ''));\n\n if (valueBefore < minAmount && minAmount === 0) {\n setInputValue('0');\n\n return;\n }\n\n setInputValue(valueBefore === 0 ? '' : valueBefore.toString());\n },\n [minAmount],\n );\n\n let inputLabel = inputValue;\n\n if (typeof label === 'string' && (displayState === 'default' || shouldForceLabel)) {\n inputLabel = label;\n }\n\n return useMemo(\n () => (\n <StyledAmountControl onClick={handleFirstAmount} $isDisabled={isDisabled}>\n <AnimatePresence initial={false}>\n {['normal'].includes(displayState) && (\n <StyledMotionAmountControlButton\n key=\"left_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n onClick={handleAmountRemove}\n disabled={amountValue !== 0 && amountValue <= minAmount}\n $isDisabled={amountValue !== 0 && amountValue <= minAmount}\n >\n <Icon icons={['fa fa-minus']} size={14} color=\"white\" />\n </StyledMotionAmountControlButton>\n )}\n </AnimatePresence>\n <StyledInputWrapper>\n {displayState === 'maxAmount' ||\n inputValue === '0' ||\n (shouldForceLabel && typeof label === 'string') ||\n inputLabel === label ? (\n <StyledAmountControlPseudoInput\n onClick={handleDeleteIconClick}\n $shouldShowWideInput={shouldShowWideInput}\n $shouldShowRightIcon={!['maxAmount'].includes(displayState)}\n >\n {inputLabel}\n </StyledAmountControlPseudoInput>\n ) : (\n <StyledAmountControlInput\n ref={inputRef}\n $displayState={displayState}\n $shouldShowIcon={shouldShowIcon}\n $shouldShowWideInput={shouldShowWideInput}\n $hasFocus={hasFocus}\n onBlur={handleInputBlur}\n onChange={handleInputChange}\n value={inputLabel}\n />\n )}\n </StyledInputWrapper>\n <AnimatePresence initial={false}>\n <StyledMotionAmountControlButton\n key=\"right_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n $color={displayState === 'maxAmount' ? 'rgb(32, 198, 90)' : undefined}\n onClick={\n displayState === 'maxAmount' ? handleAmountRemove : handleAmountAdd\n }\n disabled={maxAmount ? amountValue >= maxAmount : false}\n $isDisabled={maxAmount ? amountValue >= maxAmount : false}\n >\n <Icon\n icons={\n !['normal'].includes(displayState) && icon\n ? [displayState === 'maxAmount' ? 'fa fa-check' : icon]\n : [displayState === 'maxAmount' ? 'fa fa-check' : 'fa fa-plus']\n }\n size={14}\n color={iconColor ?? 'white'}\n />\n </StyledMotionAmountControlButton>\n </AnimatePresence>\n </StyledAmountControl>\n ),\n [\n amountValue,\n displayState,\n handleAmountAdd,\n handleAmountRemove,\n handleDeleteIconClick,\n handleFirstAmount,\n handleInputBlur,\n handleInputChange,\n hasFocus,\n icon,\n iconColor,\n inputLabel,\n inputValue,\n isDisabled,\n label,\n maxAmount,\n minAmount,\n shouldForceLabel,\n shouldShowIcon,\n shouldShowWideInput,\n ],\n );\n};\n\nAmountControl.displayName = 'AmountControl';\n\nexport default AmountControl;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAGRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,mBAAmB,EACnBC,wBAAwB,EACxBC,8BAA8B,EAC9BC,kBAAkB,EAClBC,+B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AGH,eACvD;IACDmC,QAAQ,EAAEvD,SAAS,GAAGS,WAAW,IAAIT,SAAS,GAAG,KAAM;IACvD2C,WAAW,EAAE3C,SAAS,GAAGS,WAAW,IAAIT,SAAS,GAAG;EAAM,gBAE1DnB,KAAA,CAAA4D,aAAA,CAACrD,IAAI;IACDoE,KAAK,EACD,CAAC,CAAC,QAAQ,CAAC,CAACX,QAAQ,CAAC/B,YAAY,CAAC,IAAIlB,IAAI,GACpC,CAACkB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAGlB,IAAI,CAAC,GACrD,CAACkB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAG,YAAY,CACrE;IACD2C,IAAI,EAAE,EAAG;IACTC,KAAK,EAAE7D,SAAS,IAAI;EAAQ,CAC/B,CAC4B,CACpB,CACA,CACxB,EACD,CACIY,WAAW,EACXK,YAAY,EACZM,eAAe,EACfG,kBAAkB,EAClBE,qBAAqB,EACrBD,iBAAiB,EACjBM,eAAe,EACfI,iBAAiB,EACjBf,QAAQ,EACRvB,IAAI,EACJC,SAAS,EACT2C,UAAU,EACV7B,UAAU,EACVb,UAAU,EACVC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTE,gBAAgB,EAChBE,cAAc,EACdC,mBAAmB,CAE3B,CAAC;AACL,CAAC;AAEDZ,aAAa,CAAC0E,WAAW,GAAG,eAAe;AAE3C,eAAe1E,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"AmountControl.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","checkForValidAmount","useKeyboardFocusHighlighting","Icon","StyledAmountControl","StyledAmountControlInput","StyledAmountControlPseudoInput","StyledInputWrapper","StyledMotionAmountControlButton","AmountControl","amount","icon","iconColor","isDisabled","label","maxAmount","minAmount","onChange","shouldEnableKeyboardHighlighting","shouldForceLabel","shouldShowAddIconOnMinAmount","shouldShowIcon","shouldShowWideInput","step","stepProp","shouldShowKeyboardHighlighting","amountValue","setAmountValue","inputValue","setInputValue","toString","displayState","setDisplayState","isEditing","setIsEditing","Number","isSafeInteger","inputRef","hasFocus","handleAmountAdd","prevState","newAmount","handleAmountRemove","handleFirstAmount","handlePseudoInputClick","window","requestAnimationFrame","current","focus","handleInputBlur","checkedValue","Math","round","handleInputChange","event","value","target","valueBefore","replace","inputLabel","shouldShowPseudoInput","createElement","onClick","$isDisabled","initial","includes","$shouldShowKeyboardHighlighting","key","width","opacity","padding","animate","exit","transition","duration","type","disabled","icons","size","color","$shouldShowWideInput","$shouldShowRightIcon","ref","$displayState","$shouldShowIcon","$hasFocus","onFocus","onBlur","$color","undefined","displayName"],"sources":["../../../../src/components/amount-control/AmountControl.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { ChangeEvent, FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { checkForValidAmount } from '../../utils/amountControl';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport Icon from '../icon/Icon';\nimport {\n StyledAmountControl,\n StyledAmountControlInput,\n StyledAmountControlPseudoInput,\n StyledInputWrapper,\n StyledMotionAmountControlButton,\n} from './AmountControl.styles';\n\nexport type DisplayState = 'default' | 'normal' | 'maxAmount' | 'minAmount';\n\nexport type AmountControlProps = {\n /**\n * The amount that should be displayed.\n */\n amount?: number;\n /**\n * The icon that should be displayed if no amount is selected.\n */\n icon?: string;\n /**\n * The color of the icon.\n */\n iconColor?: string;\n /**\n * Whether the control should be disabled\n */\n isDisabled?: boolean;\n /**\n * A Text that should be displayed if no amount is selected;\n */\n label?: string;\n /**\n * The maximum allowed amount. If the maxAmount is reached, a check icon is displayed on the left side.\n */\n maxAmount?: number;\n /**\n * The minimum allowed amount.\n */\n minAmount?: number;\n /**\n * A Function that is executed when the amount is changed\n */\n onChange?: (amount: number) => void;\n /**\n * Enables keyboard-only focus highlighting. The highlighting is only visible while the\n * user navigates with the keyboard and is reset on mouse movement or click.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Whether the label should be displayed even if an amount is selected.\n */\n shouldForceLabel?: boolean;\n /**\n * Whether the \"add\"-icon should be displayed if the minAmount is reached.\n */\n shouldShowAddIconOnMinAmount?: boolean;\n /**\n * Whether the icon should be displayed if no amount is selected\n */\n shouldShowIcon?: boolean;\n /**\n * Whether the input should be wider\n */\n shouldShowWideInput?: boolean;\n /**\n * Defines the amount that will change when adjusted\n */\n step?: number;\n};\n\nconst AmountControl: FC<AmountControlProps> = ({\n amount,\n icon,\n iconColor,\n isDisabled = false,\n label,\n maxAmount,\n minAmount = 0,\n onChange,\n shouldEnableKeyboardHighlighting,\n shouldForceLabel = false,\n shouldShowAddIconOnMinAmount = false,\n shouldShowIcon = true,\n shouldShowWideInput = false,\n step: stepProp = 1,\n}) => {\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n const [amountValue, setAmountValue] = useState(minAmount);\n const [inputValue, setInputValue] = useState(minAmount.toString());\n const [displayState, setDisplayState] = useState<DisplayState>('default');\n const [isEditing, setIsEditing] = useState(false);\n\n const step = useMemo(\n () => (Number.isSafeInteger(stepProp) && stepProp >= 1 ? stepProp : 1),\n [stepProp],\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n /**\n * This function controls the displayState\n */\n useEffect(() => {\n switch (true) {\n case maxAmount && amountValue >= maxAmount:\n setDisplayState('maxAmount');\n return;\n case amountValue > minAmount:\n setDisplayState('normal');\n return;\n case amountValue === minAmount && amountValue >= 0 && shouldShowAddIconOnMinAmount:\n setDisplayState('minAmount');\n return;\n default:\n setDisplayState('default');\n }\n }, [amountValue, maxAmount, minAmount, shouldShowAddIconOnMinAmount]);\n\n const hasFocus = useMemo(() => displayState !== 'default', [displayState]);\n\n /**\n * Function that sets the amountValue to the amount\n */\n useEffect(() => {\n if (typeof amount !== 'number') {\n return;\n }\n\n setAmountValue(checkForValidAmount({ amount, maxAmount, minAmount }));\n setInputValue(checkForValidAmount({ amount, maxAmount, minAmount }).toString());\n }, [amount, maxAmount, minAmount]);\n\n const handleAmountAdd = useCallback(() => {\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState + step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return typeof amount === 'number' ? prevState : newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) + step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [amount, maxAmount, minAmount, onChange, step]);\n\n const handleAmountRemove = useCallback(() => {\n if (displayState === 'default') {\n return;\n }\n\n setAmountValue((prevState) => {\n const newAmount = checkForValidAmount({\n amount: prevState - step,\n minAmount,\n maxAmount,\n });\n\n if (typeof onChange === 'function') {\n onChange(newAmount);\n }\n\n return newAmount;\n });\n setInputValue((prevState) =>\n checkForValidAmount({\n amount: Number(prevState) - step,\n minAmount,\n maxAmount,\n }).toString(),\n );\n }, [displayState, maxAmount, minAmount, onChange, step]);\n\n const handleFirstAmount = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (amountValue !== minAmount) {\n return;\n }\n\n if (typeof onChange === 'function') {\n onChange(minAmount + step);\n }\n\n setAmountValue(minAmount + step);\n setInputValue((minAmount + step).toString());\n }, [amountValue, isDisabled, minAmount, onChange, step]);\n\n const handlePseudoInputClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n setIsEditing(true);\n\n window.requestAnimationFrame(() => {\n inputRef.current?.focus();\n });\n }, [isDisabled]);\n\n const handleInputBlur = useCallback(() => {\n const checkedValue = checkForValidAmount({\n minAmount,\n maxAmount,\n amount: Math.round(Number(inputValue) / step) * step,\n });\n\n setAmountValue(checkedValue);\n setInputValue(checkedValue.toString());\n setIsEditing(false);\n\n if (typeof onChange === 'function') {\n onChange(checkedValue);\n }\n\n if (inputValue === '') {\n setInputValue(minAmount.toString());\n }\n }, [inputValue, maxAmount, minAmount, onChange, step]);\n\n const handleInputChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const { value } = event.target;\n\n const valueBefore = Number(value.replace(/\\D/g, ''));\n\n if (valueBefore < minAmount && minAmount === 0) {\n setInputValue('0');\n\n return;\n }\n\n setInputValue(valueBefore === 0 ? '' : valueBefore.toString());\n },\n [minAmount],\n );\n\n let inputLabel = inputValue;\n\n if (typeof label === 'string' && (displayState === 'default' || shouldForceLabel)) {\n inputLabel = label;\n }\n\n const shouldShowPseudoInput =\n !isEditing &&\n (inputValue === '0' ||\n (shouldForceLabel && typeof label === 'string') ||\n inputLabel === label);\n\n return useMemo(\n () => (\n <StyledAmountControl onClick={handleFirstAmount} $isDisabled={isDisabled}>\n <AnimatePresence initial={false}>\n {['normal'].includes(displayState) && (\n <StyledMotionAmountControlButton\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n key=\"left_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n onClick={handleAmountRemove}\n disabled={isDisabled || (amountValue !== 0 && amountValue <= minAmount)}\n $isDisabled={\n isDisabled || (amountValue !== 0 && amountValue <= minAmount)\n }\n >\n <Icon icons={['fa fa-minus']} size={14} color=\"white\" />\n </StyledMotionAmountControlButton>\n )}\n </AnimatePresence>\n <StyledInputWrapper>\n {shouldShowPseudoInput ? (\n <StyledAmountControlPseudoInput\n onClick={handlePseudoInputClick}\n $shouldShowWideInput={shouldShowWideInput}\n $shouldShowRightIcon={!['maxAmount'].includes(displayState)}\n >\n {inputLabel}\n </StyledAmountControlPseudoInput>\n ) : (\n <StyledAmountControlInput\n ref={inputRef}\n $displayState={displayState}\n $shouldShowIcon={shouldShowIcon}\n $shouldShowWideInput={shouldShowWideInput}\n $hasFocus={hasFocus}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n disabled={isDisabled}\n onFocus={() => setIsEditing(true)}\n onBlur={handleInputBlur}\n onChange={handleInputChange}\n value={inputLabel}\n />\n )}\n </StyledInputWrapper>\n <AnimatePresence initial={false}>\n <StyledMotionAmountControlButton\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n key=\"right_button\"\n initial={{ width: 0, opacity: 0, padding: 0 }}\n animate={{\n width: 40,\n opacity: 1,\n padding: 0,\n }}\n exit={{ width: 0, opacity: 0, padding: 0 }}\n transition={{ duration: 0.2, type: 'tween' }}\n $color={displayState === 'maxAmount' ? 'rgb(32, 198, 90)' : undefined}\n onClick={\n displayState === 'maxAmount' ? handleAmountRemove : handleAmountAdd\n }\n disabled={isDisabled || (maxAmount ? amountValue >= maxAmount : false)}\n $isDisabled={isDisabled || (maxAmount ? amountValue >= maxAmount : false)}\n >\n <Icon\n icons={\n !['normal'].includes(displayState) && icon\n ? [displayState === 'maxAmount' ? 'fa fa-check' : icon]\n : [displayState === 'maxAmount' ? 'fa fa-check' : 'fa fa-plus']\n }\n size={14}\n color={iconColor ?? 'white'}\n />\n </StyledMotionAmountControlButton>\n </AnimatePresence>\n </StyledAmountControl>\n ),\n [\n amountValue,\n displayState,\n handleAmountAdd,\n handleAmountRemove,\n handleFirstAmount,\n handleInputBlur,\n handleInputChange,\n handlePseudoInputClick,\n hasFocus,\n icon,\n iconColor,\n inputLabel,\n isDisabled,\n maxAmount,\n minAmount,\n shouldShowIcon,\n shouldShowKeyboardHighlighting,\n shouldShowPseudoInput,\n shouldShowWideInput,\n ],\n );\n};\n\nAmountControl.displayName = 'AmountControl';\n\nexport default AmountControl;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAAqBC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACjG,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,4BAA4B,QAAQ,0CAA0C;AACvF,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,mBAAmB,EACnBC,wBA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EACV9C,UAAU,EACVE,SAAS,EACTC,SAAS,EACTK,cAAc,EACdI,8BAA8B,EAC9BmC,qBAAqB,EACrBtC,mBAAmB,CAE3B,CAAC;AACL,CAAC;AAEDb,aAAa,CAACiF,WAAW,GAAG,eAAe;AAE3C,eAAejF,aAAa","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { motion } from 'motion/react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
3
4
  export const StyledAmountControl = styled.div`
4
5
  background-color: ${({
5
6
  theme
@@ -7,7 +8,6 @@ export const StyledAmountControl = styled.div`
7
8
  display: flex;
8
9
  width: fit-content;
9
10
  border-radius: 3px;
10
- overflow: hidden;
11
11
  transition: opacity 0.2s ease;
12
12
  height: 28px;
13
13
 
@@ -36,6 +36,14 @@ export const StyledAmountControlInput = styled.input`
36
36
  $hasFocus
37
37
  }) => $hasFocus ? 'text' : 'pointer'};
38
38
 
39
+ ${({
40
+ $shouldShowKeyboardHighlighting
41
+ }) => $shouldShowKeyboardHighlighting && css`
42
+ &:focus-visible {
43
+ ${keyboardFocusHighlightingRingCss}
44
+ }
45
+ `}
46
+
39
47
  ${({
40
48
  $displayState
41
49
  }) => $displayState === 'maxAmount' && css`
@@ -82,9 +90,17 @@ export const StyledMotionAmountControlButton = styled(motion.button)`
82
90
  }) => $color ?? theme['408']};
83
91
  display: flex;
84
92
  justify-content: center;
85
- overflow: hidden;
93
+ //overflow: hidden;
86
94
  transition: background-color 0.2s ease-in-out;
87
95
 
96
+ ${({
97
+ $shouldShowKeyboardHighlighting
98
+ }) => $shouldShowKeyboardHighlighting && css`
99
+ &:focus-visible {
100
+ ${keyboardFocusHighlightingRingCss}
101
+ }
102
+ `};
103
+
88
104
  ${({
89
105
  $isDisabled
90
106
  }) => $isDisabled && css`
@@ -1 +1 @@
1
- {"version":3,"file":"AmountControl.styles.js","names":["motion","styled","css","StyledAmountControl","div","theme","$isDisabled","StyledInputWrapper","StyledAmountControlInput","input","$shouldShowWideInput","$hasFocus","$displayState","$shouldShowIcon","StyledAmountControlPseudoInput","$shouldShowRightIcon","StyledMotionAmountControlButton","button","$color"],"sources":["../../../../src/components/amount-control/AmountControl.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { DisplayState } from './AmountControl';\n\ntype StyledAmountControlProps = WithTheme<{\n $isDisabled: boolean;\n}>;\n\nexport const StyledAmountControl = styled.div<StyledAmountControlProps>`\n background-color: ${({ theme }: StyledAmountControlProps) => theme['202']};\n display: flex;\n width: fit-content;\n border-radius: 3px;\n overflow: hidden;\n transition: opacity 0.2s ease;\n height: 28px;\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n pointer-events: none;\n `}\n`;\n\ntype StyledAmountControlInputProps = WithTheme<{\n $displayState: DisplayState;\n $shouldShowIcon: boolean;\n $hasFocus: boolean;\n $shouldShowWideInput: boolean;\n}>;\n\nexport const StyledInputWrapper = styled.div<WithTheme<unknown>>`\n background-color: ${({ theme }) => theme['408']};\n`;\n\nexport const StyledAmountControlInput = styled.input<StyledAmountControlInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n text-align: center;\n cursor: ${({ $hasFocus }) => ($hasFocus ? 'text' : 'pointer')};\n\n ${({ $displayState }) =>\n $displayState === 'maxAmount' &&\n css`\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n `}\n ${({ $displayState, $shouldShowIcon }) =>\n $displayState === 'default' &&\n !$shouldShowIcon &&\n css`\n border-bottom-left-radius: 3px;\n border-top-left-radius: 3px;\n `};\n`;\n\ntype StyledAmountControlPseudoInputProps = WithTheme<{\n $shouldShowWideInput: boolean;\n $shouldShowRightIcon: boolean;\n}>;\n\nexport const StyledAmountControlPseudoInput = styled.div<StyledAmountControlPseudoInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n min-width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n padding: 1px 8px;\n text-align: center;\n cursor: pointer;\n user-select: none;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n border-bottom-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n border-top-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n`;\n\ntype StyledAmountControlButtonProps = WithTheme<{\n $isDisabled: boolean;\n $color?: string;\n}>;\n\nexport const StyledMotionAmountControlButton = styled(\n motion.button,\n)<StyledAmountControlButtonProps>`\n align-items: center;\n background-color: ${({ theme, $color }: StyledAmountControlButtonProps) =>\n $color ?? theme['408']};\n display: flex;\n justify-content: center;\n overflow: hidden;\n transition: background-color 0.2s ease-in-out;\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n `}\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAQ/C,OAAO,MAAMC,mBAAmB,GAAGF,MAAM,CAACG,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAgC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAY,CAAC,KACdA,WAAW,IACXJ,GAAG;AACX;AACA;AACA,SAAS;AACT,CAAC;AASD,OAAO,MAAMK,kBAAkB,GAAGN,MAAM,CAACG,GAAuB;AAChE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD,CAAC;AAED,OAAO,MAAMG,wBAAwB,GAAGP,MAAM,CAACQ,KAAoC;AACnF;AACA;AACA;AACA;AACA,aAAa,CAAC;EAAEC;AAAqB,CAAC,KAAMA,oBAAoB,GAAG,EAAE,GAAG,EAAG;AAC3E;AACA,cAAc,CAAC;EAAEC;AAAU,CAAC,KAAMA,SAAS,GAAG,MAAM,GAAG,SAAU;AACjE;AACA,MAAM,CAAC;EAAEC;AAAc,CAAC,KAChBA,aAAa,KAAK,WAAW,IAC7BV,GAAG;AACX;AACA;AACA,SAAS;AACT,MAAM,CAAC;EAAEU,aAAa;EAAEC;AAAgB,CAAC,KACjCD,aAAa,KAAK,SAAS,IAC3B,CAACC,eAAe,IAChBX,GAAG;AACX;AACA;AACA,SAAS;AACT,CAAC;AAOD,OAAO,MAAMY,8BAA8B,GAAGb,MAAM,CAACG,GAAwC;AAC7F;AACA;AACA;AACA;AACA,iBAAiB,CAAC;EAAEM;AAAqB,CAAC,KAAMA,oBAAoB,GAAG,EAAE,GAAG,EAAG;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,CAAC;EAAEK;AAAqB,CAAC,KAClDA,oBAAoB,GAAG,KAAK,GAAG,OAAO;AAC9C,8BAA8B,CAAC;EAAEA;AAAqB,CAAC,KAC/CA,oBAAoB,GAAG,KAAK,GAAG,OAAO;AAC9C,CAAC;AAOD,OAAO,MAAMC,+BAA+B,GAAGf,MAAM,CACjDD,MAAM,CAACiB,MACX,CAAiC;AACjC;AACA,wBAAwB,CAAC;EAAEZ,KAAK;EAAEa;AAAuC,CAAC,KAClEA,MAAM,IAAIb,KAAK,CAAC,KAAK,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAY,CAAC,KACdA,WAAW,IACXJ,GAAG;AACX;AACA,SAAS;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"AmountControl.styles.js","names":["motion","styled","css","keyboardFocusHighlightingRingCss","StyledAmountControl","div","theme","$isDisabled","StyledInputWrapper","StyledAmountControlInput","input","$shouldShowWideInput","$hasFocus","$shouldShowKeyboardHighlighting","$displayState","$shouldShowIcon","StyledAmountControlPseudoInput","$shouldShowRightIcon","StyledMotionAmountControlButton","button","$color"],"sources":["../../../../src/components/amount-control/AmountControl.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\nimport type { DisplayState } from './AmountControl';\n\ntype StyledAmountControlProps = WithTheme<{\n $isDisabled: boolean;\n}>;\n\nexport const StyledAmountControl = styled.div<StyledAmountControlProps>`\n background-color: ${({ theme }: StyledAmountControlProps) => theme['202']};\n display: flex;\n width: fit-content;\n border-radius: 3px;\n transition: opacity 0.2s ease;\n height: 28px;\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n pointer-events: none;\n `}\n`;\n\ntype StyledAmountControlInputProps = WithTheme<{\n $displayState: DisplayState;\n $shouldShowIcon: boolean;\n $hasFocus: boolean;\n $shouldShowWideInput: boolean;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nexport const StyledInputWrapper = styled.div<WithTheme<unknown>>`\n background-color: ${({ theme }) => theme['408']};\n`;\n\nexport const StyledAmountControlInput = styled.input<StyledAmountControlInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n text-align: center;\n cursor: ${({ $hasFocus }) => ($hasFocus ? 'text' : 'pointer')};\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n\n ${({ $displayState }) =>\n $displayState === 'maxAmount' &&\n css`\n border-bottom-right-radius: 3px;\n border-top-right-radius: 3px;\n `}\n ${({ $displayState, $shouldShowIcon }) =>\n $displayState === 'default' &&\n !$shouldShowIcon &&\n css`\n border-bottom-left-radius: 3px;\n border-top-left-radius: 3px;\n `};\n`;\n\ntype StyledAmountControlPseudoInputProps = WithTheme<{\n $shouldShowWideInput: boolean;\n $shouldShowRightIcon: boolean;\n}>;\n\nexport const StyledAmountControlPseudoInput = styled.div<StyledAmountControlPseudoInputProps>`\n background-color: rgba(255, 255, 255, 0.2);\n color: white;\n border: none;\n height: 28px;\n min-width: ${({ $shouldShowWideInput }) => ($shouldShowWideInput ? 90 : 55)}px;\n padding: 1px 8px;\n text-align: center;\n cursor: pointer;\n user-select: none;\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n border-bottom-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n border-top-left-radius: ${({ $shouldShowRightIcon }) =>\n $shouldShowRightIcon ? '3px' : 'unset'};\n`;\n\ntype StyledAmountControlButtonProps = WithTheme<{\n $isDisabled: boolean;\n $color?: string;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nexport const StyledMotionAmountControlButton = styled(\n motion.button,\n)<StyledAmountControlButtonProps>`\n align-items: center;\n background-color: ${({ theme, $color }: StyledAmountControlButtonProps) =>\n $color ?? theme['408']};\n display: flex;\n justify-content: center;\n //overflow: hidden;\n transition: background-color 0.2s ease-in-out;\n\n ${({ $shouldShowKeyboardHighlighting }: StyledAmountControlButtonProps) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n ${keyboardFocusHighlightingRingCss}\n }\n `};\n\n ${({ $isDisabled }) =>\n $isDisabled &&\n css`\n opacity: 0.5;\n `}\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAE/C,SAASC,gCAAgC,QAAQ,8CAA8C;AAO/F,OAAO,MAAMC,mBAAmB,GAAGH,MAAM,CAACI,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAgC,CAAC,KAAKA,KAAK,CAAC,KAAK,CA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AQD,OAAO,MAAMC,+BAA+B,GAAGjB,MAAM,CACjDD,MAAM,CAACmB,MACX,CAAiC;AACjC;AACA,wBAAwB,CAAC;EAAEb,KAAK;EAAEc;AAAuC,CAAC,KAClEA,MAAM,IAAId,KAAK,CAAC,KAAK,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEO;AAAgE,CAAC,KAClEA,+BAA+B,IAC/BX,GAAG;AACX;AACA,kBAAkBC,gCAAgC;AAClD;AACA,SAAS;AACT;AACA,MAAM,CAAC;EAAEI;AAAY,CAAC,KACdA,WAAW,IACXL,GAAG;AACX;AACA,SAAS;AACT,CAAC","ignoreList":[]}
@@ -2,6 +2,7 @@ import clsx from 'clsx';
2
2
  import { AnimatePresence } from 'motion/react';
3
3
  import React, { useMemo } from 'react';
4
4
  import { useTheme } from 'styled-components';
5
+ import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
5
6
  import Icon from '../icon/Icon';
6
7
  import { StyledIconWrapper, StyledMotionButton, StyledMotionChildrenWrapper, StyledMotionWaitCursorWrapper } from './Button.styles';
7
8
  import WaitCursor from './wait-cursor/WaitCursor';
@@ -17,7 +18,8 @@ const Button = ({
17
18
  shouldShowAsSelectButton = false,
18
19
  shouldShowTextAsRobotoMedium = true,
19
20
  buttonDesign,
20
- tapDuration = 0.5
21
+ tapDuration = 0.5,
22
+ shouldEnableKeyboardHighlighting
21
23
  }) => {
22
24
  const handleClick = event => {
23
25
  if (shouldStopPropagation) {
@@ -28,6 +30,7 @@ const Button = ({
28
30
  const buttonClasses = clsx('beta-chayns-button ellipsis', className);
29
31
  const theme = useTheme();
30
32
  const effectiveButtonDesign = buttonDesign ?? theme.buttonDesign;
33
+ const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
31
34
  const iconColor = useMemo(() => {
32
35
  if (isSecondary) {
33
36
  return theme.text;
@@ -70,6 +73,7 @@ const Button = ({
70
73
  $shouldShowTextAsRobotoMedium: shouldShowTextAsRobotoMedium,
71
74
  $shouldShowAsSelectButton: shouldShowAsSelectButton,
72
75
  $shouldShowWaitCursor: shouldShowWaitCursor,
76
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
73
77
  className: buttonClasses,
74
78
  disabled: isDisabled,
75
79
  $isDisabled: isDisabled,
@@ -1 +1 @@
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,E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,CAAE;IAC/BT,OAAO,EAAE;MAAEd,OAAO,EAAE,CAAC;MAAEuB,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC,aAAa;IACjBb,KAAK,EAAE;MAAEc,QAAQ,EAAE;IAAS,CAAE;IAC9BV,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,gBAE9BpD,KAAA,CAAAqC,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
+ {"version":3,"file":"Button.js","names":["clsx","AnimatePresence","React","useMemo","useTheme","useKeyboardFocusHighlighting","Icon","StyledIconWrapper","StyledMotionButton","StyledMotionChildrenWrapper","StyledMotionWaitCursorWrapper","WaitCursor","Button","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","shouldShowAsSelectButton","shouldShowTextAsRobotoMedium","buttonDesign","tapDuration","shouldEnableKeyboardHighlighting","handleClick","event","stopPropagation","buttonClasses","theme","effectiveButtonDesign","shouldShowKeyboardHighlighting","iconColor","text","buttonColor","buttonBackgroundColor","backgroundColor","color","tapStyles","opacity","hoverStyles","createElement","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","$shouldShowWaitCursor","$shouldShowKeyboardHighlighting","disabled","$isDisabled","$hasChildren","$hasIcon","$isSecondary","$effectiveButtonDesign","style","visibility","initial","animate","transition","duration","ease","type","whileTap","whileHover","icons","width","exit","key","overflow","shouldHideBackground","displayName"],"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { AnimatePresence } from 'motion/react';\nimport React, { FC, MouseEventHandler, useMemo } from 'react';\nimport { useTheme } from 'styled-components';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport {\n StyledIconWrapper,\n StyledMotionButton,\n StyledMotionChildrenWrapper,\n StyledMotionWaitCursorWrapper,\n} from './Button.styles';\nimport type { ButtonProps } from './Button.types';\nimport WaitCursor from './wait-cursor/WaitCursor';\n\nconst Button: FC<ButtonProps> = ({\n children,\n className,\n icon,\n isDisabled,\n isSecondary,\n onClick,\n shouldShowWaitCursor,\n shouldStopPropagation,\n shouldShowAsSelectButton = false,\n shouldShowTextAsRobotoMedium = true,\n buttonDesign,\n tapDuration = 0.5,\n shouldEnableKeyboardHighlighting,\n}) => {\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n onClick(event);\n };\n\n const buttonClasses = clsx('beta-chayns-button ellipsis', className);\n\n const theme = useTheme() as Theme;\n\n const effectiveButtonDesign = (buttonDesign ?? theme.buttonDesign) as number;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n const iconColor = useMemo(() => {\n if (isSecondary) {\n return theme.text;\n }\n\n return effectiveButtonDesign === 2\n ? (theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white')\n : (theme.buttonColor ?? 'white');\n }, [\n isSecondary,\n theme.buttonBackgroundColor,\n theme.buttonColor,\n effectiveButtonDesign,\n theme.text,\n ]);\n\n const backgroundColor = useMemo(() => {\n let color;\n\n if (isSecondary || shouldShowAsSelectButton) {\n color = theme['202'];\n } else {\n color = theme.buttonBackgroundColor ?? theme['408'];\n }\n\n if (effectiveButtonDesign === 2) {\n color = `rgba(${theme['102-rgb'] ?? ''}, 0)`;\n }\n\n return color;\n }, [isSecondary, shouldShowAsSelectButton, theme, effectiveButtonDesign]);\n\n const tapStyles = useMemo(() => {\n if (effectiveButtonDesign === 2) {\n return {\n backgroundColor:\n isSecondary || shouldShowAsSelectButton\n ? `rgba(${theme['202-rgb'] ?? ''}, 0.7)`\n : `${theme.buttonBackgroundColor ?? ''}40`,\n };\n }\n\n return { opacity: 0.6 };\n }, [isSecondary, shouldShowAsSelectButton, theme, effectiveButtonDesign]);\n\n const hoverStyles = useMemo(() => {\n if (effectiveButtonDesign === 2) {\n return { backgroundColor: `rgba(${theme['102-rgb'] ?? ''}, 0.5)` };\n }\n\n return { opacity: 1 };\n }, [theme, effectiveButtonDesign]);\n\n return (\n <StyledMotionButton\n $shouldShowTextAsRobotoMedium={shouldShowTextAsRobotoMedium}\n $shouldShowAsSelectButton={shouldShowAsSelectButton}\n $shouldShowWaitCursor={shouldShowWaitCursor}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n className={buttonClasses}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n $hasChildren={!!children}\n $hasIcon={typeof icon === 'string' && icon !== ''}\n $isSecondary={isSecondary}\n $effectiveButtonDesign={effectiveButtonDesign}\n onClick={handleClick}\n style={{ visibility: !backgroundColor ? 'hidden' : 'visible', backgroundColor }}\n initial={{ opacity: 0.5 }}\n animate={{\n opacity: isDisabled ? 0.5 : 1,\n }}\n transition={{\n visibility: { duration: 0 },\n duration: tapDuration,\n ease: 'easeIn',\n type: 'tween',\n }}\n whileTap={isDisabled ? {} : { ...tapStyles, transition: { duration: 0 } }}\n whileHover={isDisabled ? {} : { ...hoverStyles }}\n >\n <AnimatePresence initial={false}>\n {icon && (\n <StyledIconWrapper>\n <Icon color={iconColor} icons={[icon]} />\n </StyledIconWrapper>\n )}\n {shouldShowWaitCursor && (\n <StyledMotionWaitCursorWrapper\n animate={{ opacity: 1, width: 40 }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"wait-cursor\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n <WaitCursor color={iconColor ?? 'white'} shouldHideBackground />\n </StyledMotionWaitCursorWrapper>\n )}\n {!shouldShowWaitCursor && children && (\n <StyledMotionChildrenWrapper\n animate={{ opacity: 1, width: 'auto' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"children\"\n // style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionChildrenWrapper>\n )}\n </AnimatePresence>\n </StyledMotionButton>\n );\n};\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAA2BC,OAAO,QAAQ,OAAO;AAC7D,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,4BAA4B,QAAQ,0CAA0C;AAEvF,OAAOC,IAAI,MAAM,cAAc;AAC/B,SACIC,iBAAiB,EACjBC,kBAAkB,EAClBC,2BAA2B,EAC3BC,6BAA6B,QAC1B,iBAAiB;AAExB,OAAOC,UAAU,MAAM,0BAA0B;AAEjD,MAAMC,MAAuB,GAAGA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJC,UAAU;EACVC,WAAW;EACXC,OAAO;EACPC,oBAAoB;EACpBC,qBAAqB;EACrBC,wBAAwB,GAAG,KAAK;EAChCC,4BAA4B,GAAG,IAAI;EACnCC,YAAY;EACZC,WAAW,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AE;MAAEC,QAAQ,EAAE;IAAI;EAAE,gBAE9BxD,KAAA,CAAAwC,aAAA,CAAC/B,UAAU;IAAC2B,KAAK,EAAEL,SAAS,IAAI,OAAQ;IAACmC,oBAAoB;EAAA,CAAE,CACpC,CAClC,EACA,CAACjD,oBAAoB,IAAIN,QAAQ,iBAC9BX,KAAA,CAAAwC,aAAA,CAACjC,2BAA2B;IACxB+C,OAAO,EAAE;MAAEhB,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAO,CAAE;IACvCC,IAAI,EAAE;MAAEzB,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAE,CAAE;IAC/BT,OAAO,EAAE;MAAEf,OAAO,EAAE,CAAC;MAAEwB,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC;IACJ;IAAA;IACAT,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B7C,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDD,MAAM,CAACyD,WAAW,GAAG,QAAQ;AAE7B,eAAezD,MAAM","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { motion } from 'motion/react';
2
2
  import styled, { css } from 'styled-components';
3
+ import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
3
4
  export const StyledMotionButton = styled(motion.button)`
4
5
  ${({
5
6
  $shouldShowTextAsRobotoMedium,
@@ -57,6 +58,15 @@ export const StyledMotionButton = styled(motion.button)`
57
58
  user-select: none;
58
59
  width: fit-content;
59
60
 
61
+ ${({
62
+ $shouldShowKeyboardHighlighting
63
+ }) => $shouldShowKeyboardHighlighting && css`
64
+ &:focus-visible {
65
+ transition: none;
66
+ ${keyboardFocusHighlightingRingCss}
67
+ }
68
+ `}
69
+
60
70
  ${({
61
71
  $hasIcon,
62
72
  $hasChildren,
@@ -1 +1 @@
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
+ {"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 }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\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,CAAoB;AAC1E,MAAM,CAAC;EAAEC,6BAA6B;EAAEC;AAA0B,CAAC,KAC3DD,6BAA6B,IAC7B,CAACC,yBAAyB,IAC1BL,GAAG;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,MAAM,CAAC;EACCM,YAAY;EACZD,yBAAyB;EACzBE,sBAAsB;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iB,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 +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"],"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 * 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,4 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';
2
3
  import { useUuid } from '../../hooks/uuid';
3
4
  import { getHeightOfSingleTextLine } from '../../utils/calculate';
4
5
  import { StyledCheckbox, StyledCheckboxBox, StyledCheckboxBoxWrapper, StyledCheckboxInput, StyledCheckboxLabel } from './Checkbox.styles';
@@ -12,7 +13,8 @@ const Checkbox = ({
12
13
  borderRadius,
13
14
  colors,
14
15
  shouldShowCentered = false,
15
- shouldChangeOnLabelClick = true
16
+ shouldChangeOnLabelClick = true,
17
+ shouldEnableKeyboardHighlighting
16
18
  }) => {
17
19
  const [isActive, setIsActive] = useState(isChecked ?? false);
18
20
  const [checkboxTop, setCheckboxTop] = useState(undefined);
@@ -34,9 +36,11 @@ const Checkbox = ({
34
36
  setCheckboxTop((singleLineHeight - boxHeight) / 2);
35
37
  }
36
38
  }, [shouldShowCentered]);
39
+ const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting && !isDisabled);
37
40
  return /*#__PURE__*/React.createElement(StyledCheckbox, {
38
41
  ref: checkboxRootRef
39
42
  }, /*#__PURE__*/React.createElement(StyledCheckboxInput, {
43
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
40
44
  checked: isChecked,
41
45
  disabled: isDisabled,
42
46
  id: uuid,
@@ -1 +1 @@
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,CAACC,MAAM,CAACC,OAAO,CAAC;IAEjC,IAAI,OAAOhB,QAAQ,KAAK,UAAU,EAAE;MAChCA,QAAQ,CAACc,KAAK,CAAC;IACnB;EACJ,CAAC,EACD,CAACd,QAAQ,CACb,CAAC;EAED,MAAMiB,IAAI,GAAG7B,OAAO,CAAC,CAAC;EAEtBH,SAAS,CAAC,MAAM;IACZ,I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C,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
+ {"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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AS,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,4 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
+ import { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';
2
3
  export const StyledCheckbox = styled.div`
3
4
  align-items: center;
4
5
  display: flex;
@@ -7,7 +8,28 @@ export const StyledCheckbox = styled.div`
7
8
  min-height: 20px;
8
9
  `;
9
10
  export const StyledCheckboxInput = styled.input`
10
- display: none;
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
+ `}
11
33
  `;
12
34
  export const StyledCheckboxBoxWrapper = styled.div`
13
35
  display: flex;
@@ -32,6 +54,10 @@ export const StyledCheckboxBox = styled.label`
32
54
  $isDisabled
33
55
  }) => $isDisabled ? 0.5 : 1};
34
56
  position: relative;
57
+ display: inline-block;
58
+ width: ${({
59
+ $shouldShowAsSwitch
60
+ }) => $shouldShowAsSwitch ? '44px' : '16px'};
35
61
  transition: opacity 0.2s ease;
36
62
  user-select: none;
37
63
  height: 16px;
@@ -90,7 +116,8 @@ export const StyledCheckboxBox = styled.label`
90
116
  if ($shouldShowAsSwitch) {
91
117
  return 'none';
92
118
  }
93
- return `1px solid ${$borderColor ?? `rgba(${theme['409-rgb']}, 0.5)`}`;
119
+ const fallbackBorderColor = theme['409-rgb'] ? `rgba(${theme['409-rgb']}, 0.5)` : theme.text;
120
+ return `1px solid ${$borderColor ?? fallbackBorderColor}`;
94
121
  }};
95
122
 
96
123
  border-radius: ${({
@@ -1 +1 @@
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,C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M;EACjB;EAEA,OAAO,aAAaa,YAAY,IAAI,QAAQV,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE;AAC1E,CAAC;AACT;AACA,yBAAyB,CAAC;EAAEH,mBAAmB;EAAEc;AAAc,CAAC,KACpDA,aAAa,KAAKd,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,MAAMe,mBAAmB,GAAGtB,MAAM,CAACS,KAA+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":[]}
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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AC,KACtBA,mBAAmB,GACbR,GAAG;AACjB;AACA,eAAe,GACDA,GAAG;AACjB;AACA,eAAe;AACf,CAAC","ignoreList":[]}
@@ -73,7 +73,8 @@ const ColorSchemeProvider = ({
73
73
  siteId,
74
74
  style = {},
75
75
  iconColor,
76
- customVariables
76
+ customVariables,
77
+ shouldEnableKeyboardHighlighting
77
78
  }) => {
78
79
  const context = useContext(ColorSchemeContext);
79
80
  const {
@@ -84,6 +85,7 @@ const ColorSchemeProvider = ({
84
85
  const colorMode = colorModeProp ?? context?.designSettings?.colorMode ?? internalColorMode;
85
86
  const overrideParagraphFormat = color && color !== internalColor || colorMode !== internalColorMode;
86
87
  const paragraphFormat = useMemo(() => overrideParagraphFormat ? [] : undefined, [overrideParagraphFormat]);
88
+ const resolvedShouldEnableKeyboardHighlighting = shouldEnableKeyboardHighlighting ?? context?.shouldEnableKeyboardHighlighting ?? false;
87
89
  const contextValue = useChaynsTheme({
88
90
  color,
89
91
  iconColor,
@@ -97,7 +99,10 @@ const ColorSchemeProvider = ({
97
99
  return /*#__PURE__*/React.createElement(ThemeProvider, {
98
100
  theme: contextValue.theme
99
101
  }, /*#__PURE__*/React.createElement(ColorSchemeContext.Provider, {
100
- value: contextValue
102
+ value: {
103
+ ...contextValue,
104
+ shouldEnableKeyboardHighlighting: resolvedShouldEnableKeyboardHighlighting
105
+ }
101
106
  }, /*#__PURE__*/React.createElement(StyledColorSchemeProvider, {
102
107
  className: "color-scheme-provider",
103
108
  style: style