@chayns-components/core 5.3.9 → 5.3.11-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 (495) hide show
  1. package/AGENTS.md +73 -2
  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 +17 -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 +52 -5
  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 +100 -6
  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/file-input/FileInput.js +4 -2
  42. package/lib/cjs/components/file-input/FileInput.js.map +1 -1
  43. package/lib/cjs/components/file-list/file-item/FileItem.js +23 -2
  44. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  45. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +19 -1
  46. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  47. package/lib/cjs/components/file-select/FileSelect.js +27 -4
  48. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  49. package/lib/cjs/components/file-select/FileSelect.styles.js +10 -0
  50. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  51. package/lib/cjs/components/filter/Filter.js +51 -16
  52. package/lib/cjs/components/filter/Filter.js.map +1 -1
  53. package/lib/cjs/components/filter/Filter.styles.js +9 -0
  54. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  55. package/lib/cjs/components/filter/filter-content/FilterContent.js +14 -5
  56. package/lib/cjs/components/filter/filter-content/FilterContent.js.map +1 -1
  57. package/lib/cjs/components/filter/filter-content/FilterContent.types.js.map +1 -1
  58. package/lib/cjs/components/filter-buttons/FilterButtons.js +69 -4
  59. package/lib/cjs/components/filter-buttons/FilterButtons.js.map +1 -1
  60. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +40 -2
  61. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  62. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
  63. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  64. package/lib/cjs/components/grid-image/GridImage.js +20 -2
  65. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  66. package/lib/cjs/components/grid-image/GridImage.styles.js +11 -2
  67. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  68. package/lib/cjs/components/grouped-image/GroupedImage.js +23 -4
  69. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  70. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +9 -0
  71. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  72. package/lib/cjs/components/highlight-slider/HighlightSlider.js +10 -3
  73. package/lib/cjs/components/highlight-slider/HighlightSlider.js.map +1 -1
  74. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +21 -4
  75. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  76. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +11 -2
  77. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  78. package/lib/cjs/components/icon/Icon.js +24 -5
  79. package/lib/cjs/components/icon/Icon.js.map +1 -1
  80. package/lib/cjs/components/icon/Icon.styles.js +23 -0
  81. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  82. package/lib/cjs/components/input/Input.js +29 -8
  83. package/lib/cjs/components/input/Input.js.map +1 -1
  84. package/lib/cjs/components/input/Input.styles.js +33 -3
  85. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  86. package/lib/cjs/components/list/List.js +124 -37
  87. package/lib/cjs/components/list/List.js.map +1 -1
  88. package/lib/cjs/components/list/List.utils.js +107 -1
  89. package/lib/cjs/components/list/List.utils.js.map +1 -1
  90. package/lib/cjs/components/list/list-item/ListItem.js +82 -3
  91. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  92. package/lib/cjs/components/list/list-item/ListItem.styles.js +9 -0
  93. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  94. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +40 -5
  95. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  96. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js +5 -1
  97. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  98. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +32 -1
  99. package/lib/cjs/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  100. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +32 -1
  101. package/lib/cjs/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  102. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +30 -1
  103. package/lib/cjs/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  104. package/lib/cjs/components/list/list-item/useListItemFocus.js +47 -0
  105. package/lib/cjs/components/list/list-item/useListItemFocus.js.map +1 -0
  106. package/lib/cjs/components/masonry/Masonry.context.js +17 -0
  107. package/lib/cjs/components/masonry/Masonry.context.js.map +1 -0
  108. package/lib/cjs/components/masonry/Masonry.hooks.js +53 -0
  109. package/lib/cjs/components/masonry/Masonry.hooks.js.map +1 -0
  110. package/lib/cjs/components/masonry/Masonry.js +81 -0
  111. package/lib/cjs/components/masonry/Masonry.js.map +1 -0
  112. package/lib/cjs/components/masonry/Masonry.styles.js +16 -0
  113. package/lib/cjs/components/masonry/Masonry.styles.js.map +1 -0
  114. package/lib/cjs/components/masonry/Masonry.types.js +6 -0
  115. package/lib/cjs/components/masonry/Masonry.types.js.map +1 -0
  116. package/lib/cjs/components/masonry/Masonry.utils.js +121 -0
  117. package/lib/cjs/components/masonry/Masonry.utils.js.map +1 -0
  118. package/lib/cjs/components/masonry/masonry-item/MasonryItem.js +77 -0
  119. package/lib/cjs/components/masonry/masonry-item/MasonryItem.js.map +1 -0
  120. package/lib/cjs/components/masonry/masonry-item/MasonryItem.styles.js +17 -0
  121. package/lib/cjs/components/masonry/masonry-item/MasonryItem.styles.js.map +1 -0
  122. package/lib/cjs/components/mention-finder/MentionFinder.js +31 -2
  123. package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
  124. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  125. package/lib/cjs/components/multi-action-button/MultiActionButton.js +36 -3
  126. package/lib/cjs/components/multi-action-button/MultiActionButton.js.map +1 -1
  127. package/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  128. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +7 -1
  129. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  130. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
  131. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  132. package/lib/cjs/components/number-input/NumberInput.js +13 -10
  133. package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
  134. package/lib/cjs/components/page-provider/PageProvider.js +4 -2
  135. package/lib/cjs/components/page-provider/PageProvider.js.map +1 -1
  136. package/lib/cjs/components/popup/Popup.js +8 -1
  137. package/lib/cjs/components/popup/Popup.js.map +1 -1
  138. package/lib/cjs/components/radio-button/RadioButton.js +29 -15
  139. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  140. package/lib/cjs/components/radio-button/RadioButton.styles.js +19 -8
  141. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  142. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
  143. package/lib/cjs/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  144. package/lib/cjs/components/search-box/SearchBox.js +5 -2
  145. package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
  146. package/lib/cjs/components/search-input/SearchInput.js +40 -41
  147. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  148. package/lib/cjs/components/search-input/SearchInput.styles.js +25 -2
  149. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  150. package/lib/cjs/components/select-button/SelectButton.js +4 -2
  151. package/lib/cjs/components/select-button/SelectButton.js.map +1 -1
  152. package/lib/cjs/components/setup-wizard/SetupWizard.js +7 -4
  153. package/lib/cjs/components/setup-wizard/SetupWizard.js.map +1 -1
  154. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
  155. package/lib/cjs/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  156. package/lib/cjs/components/sharing-bar/SharingBar.js +31 -6
  157. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  158. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +5 -0
  159. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  160. package/lib/cjs/components/sharing-button/SharingButton.js +4 -2
  161. package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
  162. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +3 -1
  163. package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  164. package/lib/cjs/components/signature/Signature.js +6 -3
  165. package/lib/cjs/components/signature/Signature.js.map +1 -1
  166. package/lib/cjs/components/slider/Slider.js +30 -7
  167. package/lib/cjs/components/slider/Slider.js.map +1 -1
  168. package/lib/cjs/components/slider/Slider.styles.js +9 -2
  169. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  170. package/lib/cjs/components/slider-button/SliderButton.js +63 -6
  171. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  172. package/lib/cjs/components/slider-button/SliderButton.styles.js +19 -2
  173. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  174. package/lib/cjs/components/slider-button/SliderButton.types.js +6 -0
  175. package/lib/cjs/components/slider-button/SliderButton.types.js.map +1 -0
  176. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js +66 -0
  177. package/lib/cjs/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
  178. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js +47 -0
  179. package/lib/cjs/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
  180. package/lib/cjs/components/tag-input/TagInput.js +91 -36
  181. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  182. package/lib/cjs/components/tag-input/TagInput.styles.js +31 -3
  183. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  184. package/lib/cjs/components/text-area/TextArea.js +17 -8
  185. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  186. package/lib/cjs/components/text-area/TextArea.styles.js +15 -1
  187. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  188. package/lib/cjs/components/truncation/Truncation.js +17 -3
  189. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  190. package/lib/cjs/components/truncation/Truncation.styles.js +19 -1
  191. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  192. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +68 -0
  193. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -0
  194. package/lib/cjs/index.js +7 -0
  195. package/lib/cjs/index.js.map +1 -1
  196. package/lib/cjs/utils/file.js.map +1 -1
  197. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +30 -0
  198. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +1 -0
  199. package/lib/esm/components/accordion/Accordion.js +105 -12
  200. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  201. package/lib/esm/components/accordion/Accordion.styles.js +23 -3
  202. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  203. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +3 -1
  204. package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
  205. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js +33 -19
  206. package/lib/esm/components/accordion/accordion-group/AccordionGroup.js.map +1 -1
  207. package/lib/esm/components/accordion/accordion-head/AccordionHead.js +6 -3
  208. package/lib/esm/components/accordion/accordion-head/AccordionHead.js.map +1 -1
  209. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js +14 -0
  210. package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
  211. package/lib/esm/components/amount-control/AmountControl.js +30 -16
  212. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  213. package/lib/esm/components/amount-control/AmountControl.styles.js +18 -2
  214. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  215. package/lib/esm/components/button/Button.js +5 -1
  216. package/lib/esm/components/button/Button.js.map +1 -1
  217. package/lib/esm/components/button/Button.styles.js +17 -0
  218. package/lib/esm/components/button/Button.styles.js.map +1 -1
  219. package/lib/esm/components/button/Button.types.js.map +1 -1
  220. package/lib/esm/components/checkbox/Checkbox.js +5 -1
  221. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  222. package/lib/esm/components/checkbox/Checkbox.styles.js +29 -2
  223. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  224. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +7 -2
  225. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  226. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +8 -2
  227. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
  228. package/lib/esm/components/combobox/ComboBox.js +50 -5
  229. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  230. package/lib/esm/components/combobox/ComboBox.styles.js +11 -0
  231. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  232. package/lib/esm/components/combobox/ComboBox.types.js.map +1 -1
  233. package/lib/esm/components/context-menu/ContextMenu.js +99 -5
  234. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  235. package/lib/esm/components/context-menu/ContextMenu.styles.js +38 -0
  236. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  237. package/lib/esm/components/context-menu/ContextMenu.types.js.map +1 -1
  238. package/lib/esm/components/file-input/FileInput.js +4 -2
  239. package/lib/esm/components/file-input/FileInput.js.map +1 -1
  240. package/lib/esm/components/file-list/file-item/FileItem.js +24 -3
  241. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  242. package/lib/esm/components/file-list/file-item/FileItem.styles.js +18 -0
  243. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  244. package/lib/esm/components/file-select/FileSelect.js +27 -4
  245. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  246. package/lib/esm/components/file-select/FileSelect.styles.js +10 -0
  247. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  248. package/lib/esm/components/filter/Filter.js +52 -16
  249. package/lib/esm/components/filter/Filter.js.map +1 -1
  250. package/lib/esm/components/filter/Filter.styles.js +9 -0
  251. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  252. package/lib/esm/components/filter/filter-content/FilterContent.js +15 -5
  253. package/lib/esm/components/filter/filter-content/FilterContent.js.map +1 -1
  254. package/lib/esm/components/filter/filter-content/FilterContent.types.js.map +1 -1
  255. package/lib/esm/components/filter-buttons/FilterButtons.js +69 -5
  256. package/lib/esm/components/filter-buttons/FilterButtons.js.map +1 -1
  257. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +40 -2
  258. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  259. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +11 -0
  260. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  261. package/lib/esm/components/grid-image/GridImage.js +20 -2
  262. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  263. package/lib/esm/components/grid-image/GridImage.styles.js +10 -1
  264. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  265. package/lib/esm/components/grouped-image/GroupedImage.js +22 -4
  266. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  267. package/lib/esm/components/grouped-image/GroupedImage.styles.js +9 -0
  268. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  269. package/lib/esm/components/highlight-slider/HighlightSlider.js +10 -3
  270. package/lib/esm/components/highlight-slider/HighlightSlider.js.map +1 -1
  271. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +20 -3
  272. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  273. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +10 -1
  274. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  275. package/lib/esm/components/icon/Icon.js +26 -7
  276. package/lib/esm/components/icon/Icon.js.map +1 -1
  277. package/lib/esm/components/icon/Icon.styles.js +23 -0
  278. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  279. package/lib/esm/components/input/Input.js +24 -4
  280. package/lib/esm/components/input/Input.js.map +1 -1
  281. package/lib/esm/components/input/Input.styles.js +33 -3
  282. package/lib/esm/components/input/Input.styles.js.map +1 -1
  283. package/lib/esm/components/list/List.js +123 -37
  284. package/lib/esm/components/list/List.js.map +1 -1
  285. package/lib/esm/components/list/List.utils.js +99 -0
  286. package/lib/esm/components/list/List.utils.js.map +1 -1
  287. package/lib/esm/components/list/list-item/ListItem.js +83 -4
  288. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  289. package/lib/esm/components/list/list-item/ListItem.styles.js +9 -0
  290. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  291. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +41 -6
  292. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  293. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js +4 -0
  294. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
  295. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js +33 -2
  296. package/lib/esm/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.js.map +1 -1
  297. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js +33 -2
  298. package/lib/esm/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.js.map +1 -1
  299. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js +30 -1
  300. package/lib/esm/components/list/list-item/list-item-head/list-item-title/ListItemTitle.js.map +1 -1
  301. package/lib/esm/components/list/list-item/useListItemFocus.js +40 -0
  302. package/lib/esm/components/list/list-item/useListItemFocus.js.map +1 -0
  303. package/lib/esm/components/masonry/Masonry.context.js +10 -0
  304. package/lib/esm/components/masonry/Masonry.context.js.map +1 -0
  305. package/lib/esm/components/masonry/Masonry.hooks.js +44 -0
  306. package/lib/esm/components/masonry/Masonry.hooks.js.map +1 -0
  307. package/lib/esm/components/masonry/Masonry.js +74 -0
  308. package/lib/esm/components/masonry/Masonry.js.map +1 -0
  309. package/lib/esm/components/masonry/Masonry.styles.js +9 -0
  310. package/lib/esm/components/masonry/Masonry.styles.js.map +1 -0
  311. package/lib/esm/components/masonry/Masonry.types.js +2 -0
  312. package/lib/esm/components/masonry/Masonry.types.js.map +1 -0
  313. package/lib/esm/components/masonry/Masonry.utils.js +110 -0
  314. package/lib/esm/components/masonry/Masonry.utils.js.map +1 -0
  315. package/lib/esm/components/masonry/masonry-item/MasonryItem.js +69 -0
  316. package/lib/esm/components/masonry/masonry-item/MasonryItem.js.map +1 -0
  317. package/lib/esm/components/masonry/masonry-item/MasonryItem.styles.js +10 -0
  318. package/lib/esm/components/masonry/masonry-item/MasonryItem.styles.js.map +1 -0
  319. package/lib/esm/components/mention-finder/MentionFinder.js +30 -2
  320. package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
  321. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  322. package/lib/esm/components/multi-action-button/MultiActionButton.js +36 -3
  323. package/lib/esm/components/multi-action-button/MultiActionButton.js.map +1 -1
  324. package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
  325. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -1
  326. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  327. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +12 -0
  328. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  329. package/lib/esm/components/number-input/NumberInput.js +13 -10
  330. package/lib/esm/components/number-input/NumberInput.js.map +1 -1
  331. package/lib/esm/components/page-provider/PageProvider.js +4 -2
  332. package/lib/esm/components/page-provider/PageProvider.js.map +1 -1
  333. package/lib/esm/components/popup/Popup.js +8 -1
  334. package/lib/esm/components/popup/Popup.js.map +1 -1
  335. package/lib/esm/components/radio-button/RadioButton.js +29 -15
  336. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  337. package/lib/esm/components/radio-button/RadioButton.styles.js +19 -8
  338. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  339. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js +7 -4
  340. package/lib/esm/components/radio-button/radio-button-group/RadioButtonGroup.js.map +1 -1
  341. package/lib/esm/components/search-box/SearchBox.js +5 -2
  342. package/lib/esm/components/search-box/SearchBox.js.map +1 -1
  343. package/lib/esm/components/search-input/SearchInput.js +41 -42
  344. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  345. package/lib/esm/components/search-input/SearchInput.styles.js +24 -1
  346. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  347. package/lib/esm/components/select-button/SelectButton.js +4 -2
  348. package/lib/esm/components/select-button/SelectButton.js.map +1 -1
  349. package/lib/esm/components/setup-wizard/SetupWizard.js +7 -4
  350. package/lib/esm/components/setup-wizard/SetupWizard.js.map +1 -1
  351. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js +5 -3
  352. package/lib/esm/components/setup-wizard/setup-wizard-item/SetupWizardItem.js.map +1 -1
  353. package/lib/esm/components/sharing-bar/SharingBar.js +30 -5
  354. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  355. package/lib/esm/components/sharing-bar/SharingBar.styles.js +5 -0
  356. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  357. package/lib/esm/components/sharing-button/SharingButton.js +4 -2
  358. package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
  359. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +3 -1
  360. package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
  361. package/lib/esm/components/signature/Signature.js +6 -3
  362. package/lib/esm/components/signature/Signature.js.map +1 -1
  363. package/lib/esm/components/slider/Slider.js +30 -7
  364. package/lib/esm/components/slider/Slider.js.map +1 -1
  365. package/lib/esm/components/slider/Slider.styles.js +8 -1
  366. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  367. package/lib/esm/components/slider-button/SliderButton.js +62 -6
  368. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  369. package/lib/esm/components/slider-button/SliderButton.styles.js +18 -1
  370. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  371. package/lib/esm/components/slider-button/SliderButton.types.js +2 -0
  372. package/lib/esm/components/slider-button/SliderButton.types.js.map +1 -0
  373. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js +56 -0
  374. package/lib/esm/components/slider-button/useSliderButtonPopupKeyboard.js.map +1 -0
  375. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js +38 -0
  376. package/lib/esm/components/slider-button/useSliderButtonThumbKeyboard.js.map +1 -0
  377. package/lib/esm/components/tag-input/TagInput.js +85 -35
  378. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  379. package/lib/esm/components/tag-input/TagInput.styles.js +29 -1
  380. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  381. package/lib/esm/components/text-area/TextArea.js +18 -9
  382. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  383. package/lib/esm/components/text-area/TextArea.styles.js +14 -0
  384. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  385. package/lib/esm/components/truncation/Truncation.js +18 -4
  386. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  387. package/lib/esm/components/truncation/Truncation.styles.js +18 -0
  388. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  389. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +61 -0
  390. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -0
  391. package/lib/esm/index.js +1 -0
  392. package/lib/esm/index.js.map +1 -1
  393. package/lib/esm/utils/file.js.map +1 -1
  394. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +25 -0
  395. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +1 -0
  396. package/lib/types/components/accordion/Accordion.d.ts +5 -0
  397. package/lib/types/components/accordion/Accordion.styles.d.ts +8 -4
  398. package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +2 -2
  399. package/lib/types/components/accordion/accordion-group/AccordionGroup.d.ts +7 -2
  400. package/lib/types/components/accordion/accordion-head/AccordionHead.d.ts +1 -0
  401. package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +18 -18
  402. package/lib/types/components/amount-control/AmountControl.d.ts +5 -0
  403. package/lib/types/components/amount-control/AmountControl.styles.d.ts +8 -4
  404. package/lib/types/components/button/Button.styles.d.ts +8 -6
  405. package/lib/types/components/button/Button.types.d.ts +8 -0
  406. package/lib/types/components/checkbox/Checkbox.d.ts +4 -0
  407. package/lib/types/components/checkbox/Checkbox.styles.d.ts +5 -1
  408. package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +5 -0
  409. package/lib/types/components/combobox/ComboBox.styles.d.ts +4 -2
  410. package/lib/types/components/combobox/ComboBox.types.d.ts +5 -0
  411. package/lib/types/components/context-menu/ContextMenu.styles.d.ts +4 -2
  412. package/lib/types/components/context-menu/ContextMenu.types.d.ts +6 -0
  413. package/lib/types/components/context-menu/context-menu-content/ContextMenuContent.styles.d.ts +2 -2
  414. package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +2 -2
  415. package/lib/types/components/expandable-content/ExpandableContent.styles.d.ts +2 -2
  416. package/lib/types/components/file-input/FileInput.d.ts +4 -0
  417. package/lib/types/components/file-input/FileInput.styles.d.ts +2 -2
  418. package/lib/types/components/file-list/file-item/FileItem.styles.d.ts +3 -0
  419. package/lib/types/components/file-select/FileSelect.d.ts +4 -0
  420. package/lib/types/components/file-select/FileSelect.styles.d.ts +6 -4
  421. package/lib/types/components/filter/Filter.d.ts +1 -0
  422. package/lib/types/components/filter/Filter.styles.d.ts +6 -4
  423. package/lib/types/components/filter/filter-content/FilterContent.types.d.ts +4 -0
  424. package/lib/types/components/filter-buttons/FilterButtons.d.ts +4 -0
  425. package/lib/types/components/filter-buttons/filter-button/FilterButton.d.ts +5 -0
  426. package/lib/types/components/filter-buttons/filter-button/FilterButton.styles.d.ts +12 -8
  427. package/lib/types/components/grid-image/GridImage.d.ts +4 -0
  428. package/lib/types/components/grid-image/GridImage.styles.d.ts +4 -2
  429. package/lib/types/components/grouped-image/GroupedImage.d.ts +4 -0
  430. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +8 -6
  431. package/lib/types/components/highlight-slider/HighlightSlider.d.ts +4 -0
  432. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.d.ts +3 -0
  433. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +9 -5
  434. package/lib/types/components/icon/Icon.d.ts +4 -0
  435. package/lib/types/components/icon/Icon.styles.d.ts +1 -0
  436. package/lib/types/components/input/Input.d.ts +4 -0
  437. package/lib/types/components/input/Input.styles.d.ts +17 -9
  438. package/lib/types/components/list/List.d.ts +11 -0
  439. package/lib/types/components/list/List.utils.d.ts +16 -1
  440. package/lib/types/components/list/list-item/ListItem.styles.d.ts +64 -64
  441. package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +2 -2
  442. package/lib/types/components/list/list-item/list-item-head/ListItemHead.d.ts +1 -0
  443. package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +195 -194
  444. package/lib/types/components/list/list-item/list-item-head/list-item-right-element/ListItemRightElement.d.ts +1 -0
  445. package/lib/types/components/list/list-item/list-item-head/list-item-subtitle/ListItemSubtitle.d.ts +1 -0
  446. package/lib/types/components/list/list-item/list-item-head/list-item-title/ListItemTitle.d.ts +1 -0
  447. package/lib/types/components/list/list-item/useListItemFocus.d.ts +13 -0
  448. package/lib/types/components/masonry/Masonry.context.d.ts +3 -0
  449. package/lib/types/components/masonry/Masonry.d.ts +3 -0
  450. package/lib/types/components/masonry/Masonry.hooks.d.ts +22 -0
  451. package/lib/types/components/masonry/Masonry.styles.d.ts +5 -0
  452. package/lib/types/components/masonry/Masonry.types.d.ts +40 -0
  453. package/lib/types/components/masonry/Masonry.utils.d.ts +22 -0
  454. package/lib/types/components/masonry/masonry-item/MasonryItem.d.ts +5 -0
  455. package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +5 -0
  456. package/lib/types/components/mention-finder/MentionFinder.styles.d.ts +4 -4
  457. package/lib/types/components/multi-action-button/MultiActionButton.styles.d.ts +2 -2
  458. package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +7 -0
  459. package/lib/types/components/multi-action-button/action-button/ActionButton.d.ts +4 -1
  460. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +4 -2
  461. package/lib/types/components/number-input/NumberInput.d.ts +4 -0
  462. package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +2 -2
  463. package/lib/types/components/progress-bar/ProgressBar.styles.d.ts +6 -6
  464. package/lib/types/components/radio-button/RadioButton.d.ts +4 -0
  465. package/lib/types/components/radio-button/RadioButton.styles.d.ts +15 -9
  466. package/lib/types/components/radio-button/radio-button-group/RadioButtonGroup.d.ts +5 -0
  467. package/lib/types/components/search-box/SearchBox.d.ts +4 -0
  468. package/lib/types/components/search-box/SearchBox.styles.d.ts +2 -2
  469. package/lib/types/components/search-input/SearchInput.d.ts +4 -0
  470. package/lib/types/components/search-input/SearchInput.styles.d.ts +17 -9
  471. package/lib/types/components/select-button/SelectButton.d.ts +4 -0
  472. package/lib/types/components/setup-wizard/SetupWizard.d.ts +5 -0
  473. package/lib/types/components/sharing-bar/SharingBar.d.ts +4 -0
  474. package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
  475. package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +10 -2
  476. package/lib/types/components/signature/Signature.d.ts +4 -0
  477. package/lib/types/components/skeleton/base-skeleton/BaseSkeleton.styles.d.ts +4 -4
  478. package/lib/types/components/slider/Slider.d.ts +8 -0
  479. package/lib/types/components/slider/Slider.styles.d.ts +18 -14
  480. package/lib/types/components/slider-button/SliderButton.d.ts +1 -28
  481. package/lib/types/components/slider-button/SliderButton.styles.d.ts +6 -4
  482. package/lib/types/components/slider-button/SliderButton.types.d.ts +32 -0
  483. package/lib/types/components/slider-button/useSliderButtonPopupKeyboard.d.ts +17 -0
  484. package/lib/types/components/slider-button/useSliderButtonThumbKeyboard.d.ts +13 -0
  485. package/lib/types/components/tag-input/TagInput.d.ts +4 -0
  486. package/lib/types/components/tag-input/TagInput.styles.d.ts +12 -2
  487. package/lib/types/components/text-area/TextArea.d.ts +4 -0
  488. package/lib/types/components/text-area/TextArea.styles.d.ts +1 -0
  489. package/lib/types/components/truncation/Truncation.d.ts +4 -0
  490. package/lib/types/components/truncation/Truncation.styles.d.ts +7 -2
  491. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +5 -0
  492. package/lib/types/index.d.ts +1 -0
  493. package/lib/types/utils/file.d.ts +1 -1
  494. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +9 -0
  495. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"AmountControl.js","names":["_react","require","_react2","_interopRequireWildcard","_amountControl","_Icon","_interopRequireDefault","_AmountControl","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AmountControl","amount","icon","iconColor","isDisabled","label","maxAmount","minAmount","onChange","shouldForceLabel","shouldShowAddIconOnMinAmount","shouldShowIcon","shouldShowWideInput","step","stepProp","amountValue","setAmountValue","useState","inputValue","setInputValue","toString","displayState","setDisplayState","useMemo","Number","isSafeInteger","inputRef","useRef","useEffect","hasFocus","checkForValidAmount","handleAmountAdd","useCallback","prevState","newAmount","handleAmountRemove","handleFirstAmount","handleDeleteIconClick","window","setTimeout","_inputRef$current","current","focus","handleInputBlur","checkedValue","Math","round","handleInputChange","event","value","target","valueBefore","replace","inputLabel","createElement","StyledAmountControl","onClick","$isDisabled","AnimatePresence","initial","includes","StyledMotionAmountControlButton","key","width","opacity","padding","animate","exit","transition","duration","type","disabled","icons","size","color","StyledInputWrapper","StyledAmountControlPseudoInput","$shouldShowWideInput","$shouldShowRightIcon","StyledAmountControlInput","ref","$displayState","$shouldShowIcon","$hasFocus","onBlur","$color","undefined","displayName","_default","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CA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AAa,CAACuF,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA1G,OAAA,GAE7BiB,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"AmountControl.js","names":["_react","require","_react2","_interopRequireWildcard","_amountControl","_useKeyboardFocusHighlighting","_Icon","_interopRequireDefault","_AmountControl","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AmountControl","amount","icon","iconColor","isDisabled","label","maxAmount","minAmount","onChange","shouldEnableKeyboardHighlighting","shouldForceLabel","shouldShowAddIconOnMinAmount","shouldShowIcon","shouldShowWideInput","step","stepProp","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","amountValue","setAmountValue","useState","inputValue","setInputValue","toString","displayState","setDisplayState","isEditing","setIsEditing","useMemo","Number","isSafeInteger","inputRef","useRef","useEffect","hasFocus","checkForValidAmount","handleAmountAdd","useCallback","prevState","newAmount","handleAmountRemove","handleFirstAmount","handlePseudoInputClick","window","requestAnimationFrame","_inputRef$current","current","focus","handleInputBlur","checkedValue","Math","round","handleInputChange","event","value","target","valueBefore","replace","inputLabel","shouldShowPseudoInput","createElement","StyledAmountControl","onClick","$isDisabled","AnimatePresence","initial","includes","StyledMotionAmountControlButton","$shouldShowKeyboardHighlighting","key","width","opacity","padding","animate","exit","transition","duration","type","disabled","icons","size","color","StyledInputWrapper","StyledAmountControlPseudoInput","$shouldShowWideInput","$shouldShowRightIcon","StyledAmountControlInput","ref","$displayState","$shouldShowIcon","$hasFocus","onFocus","onBlur","$color","undefined","displayName","_default","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,6BAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,cAAA,GAAAP,OAAA;AAMgC,SAAAM,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAA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ErE,YAAY,KAAK,WAAW,GAAG,kBAAkB,GAAGsE,SAAU;IACtEhC,OAAO,EACHtC,YAAY,KAAK,WAAW,GAAGgB,kBAAkB,GAAGJ,eACvD;IACD0C,QAAQ,EAAE1E,UAAU,KAAKE,SAAS,GAAGY,WAAW,IAAIZ,SAAS,GAAG,KAAK,CAAE;IACvEyD,WAAW,EAAE3D,UAAU,KAAKE,SAAS,GAAGY,WAAW,IAAIZ,SAAS,GAAG,KAAK;EAAE,gBAE1EhC,OAAA,CAAAS,OAAA,CAAA6E,aAAA,CAAClF,KAAA,CAAAK,OAAI;IACDgG,KAAK,EACD,CAAC,CAAC,QAAQ,CAAC,CAACb,QAAQ,CAAC1C,YAAY,CAAC,IAAItB,IAAI,GACpC,CAACsB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAGtB,IAAI,CAAC,GACrD,CAACsB,YAAY,KAAK,WAAW,GAAG,aAAa,GAAG,YAAY,CACrE;IACDwD,IAAI,EAAE,EAAG;IACTC,KAAK,EAAE9E,SAAS,IAAI;EAAQ,CAC/B,CAC4B,CACpB,CACA,CACxB,EACD,CACIe,WAAW,EACXM,YAAY,EACZY,eAAe,EACfI,kBAAkB,EAClBC,iBAAiB,EACjBO,eAAe,EACfI,iBAAiB,EACjBV,sBAAsB,EACtBR,QAAQ,EACRhC,IAAI,EACJC,SAAS,EACTuD,UAAU,EACVtD,UAAU,EACVE,SAAS,EACTC,SAAS,EACTK,cAAc,EACdI,8BAA8B,EAC9B2C,qBAAqB,EACrB9C,mBAAmB,CAE3B,CAAC;AACL,CAAC;AAEDb,aAAa,CAAC+F,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAlH,OAAA,GAE7BiB,aAAa","ignoreList":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.StyledMotionAmountControlButton = exports.StyledInputWrapper = exports.StyledAmountControlPseudoInput = exports.StyledAmountControlInput = exports.StyledAmountControl = void 0;
7
7
  var _react = require("motion/react");
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles");
9
10
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
11
  const StyledAmountControl = exports.StyledAmountControl = _styledComponents.default.div`
11
12
  background-color: ${({
@@ -14,7 +15,6 @@ const StyledAmountControl = exports.StyledAmountControl = _styledComponents.defa
14
15
  display: flex;
15
16
  width: fit-content;
16
17
  border-radius: 3px;
17
- overflow: hidden;
18
18
  transition: opacity 0.2s ease;
19
19
  height: 28px;
20
20
 
@@ -43,6 +43,14 @@ const StyledAmountControlInput = exports.StyledAmountControlInput = _styledCompo
43
43
  $hasFocus
44
44
  }) => $hasFocus ? 'text' : 'pointer'};
45
45
 
46
+ ${({
47
+ $shouldShowKeyboardHighlighting
48
+ }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
49
+ &:focus-visible {
50
+ ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
51
+ }
52
+ `}
53
+
46
54
  ${({
47
55
  $displayState
48
56
  }) => $displayState === 'maxAmount' && (0, _styledComponents.css)`
@@ -89,9 +97,17 @@ const StyledMotionAmountControlButton = exports.StyledMotionAmountControlButton
89
97
  }) => $color ?? theme['408']};
90
98
  display: flex;
91
99
  justify-content: center;
92
- overflow: hidden;
100
+ //overflow: hidden;
93
101
  transition: background-color 0.2s ease-in-out;
94
102
 
103
+ ${({
104
+ $shouldShowKeyboardHighlighting
105
+ }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
106
+ &:focus-visible {
107
+ ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
108
+ }
109
+ `};
110
+
95
111
  ${({
96
112
  $isDisabled
97
113
  }) => $isDisabled && (0, _styledComponents.css)`
@@ -1 +1 @@
1
- {"version":3,"file":"AmountControl.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledAmountControl","exports","styled","div","theme","$isDisabled","css","StyledInputWrapper","StyledAmountControlInput","input","$shouldShowWideInput","$hasFocus","$displayState","$shouldShowIcon","StyledAmountControlPseudoInput","$shouldShowRightIcon","StyledMotionAmountControlButton","motion","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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAA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B;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAY,CAAC,KACdA,WAAW,IACX,IAAAC,qBAAG;AACX;AACA,SAAS;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"AmountControl.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_keyboardFocusHighlighting","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledAmountControl","exports","styled","div","theme","$isDisabled","css","StyledInputWrapper","StyledAmountControlInput","input","$shouldShowWideInput","$hasFocus","$shouldShowKeyboardHighlighting","keyboardFocusHighlightingRingCss","$displayState","$shouldShowIcon","StyledAmountControlPseudoInput","$shouldShowRightIcon","StyledMotionAmountControlButton","motion","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 }: St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AoB,GAAG,EAAE,GAAG,EAAG;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,CAAC;EAAEO;AAAqB,CAAC,KAClDA,oBAAoB,GAAG,KAAK,GAAG,OAAO;AAC9C,8BAA8B,CAAC;EAAEA;AAAqB,CAAC,KAC/CA,oBAAoB,GAAG,KAAK,GAAG,OAAO;AAC9C,CAAC;AAQM,MAAMC,+BAA+B,GAAAjB,OAAA,CAAAiB,+BAAA,GAAG,IAAAhB,yBAAM,EACjDiB,aAAM,CAACC,MACX,CAAiC;AACjC;AACA,wBAAwB,CAAC;EAAEhB,KAAK;EAAEiB;AAAuC,CAAC,KAClEA,MAAM,IAAIjB,KAAK,CAAC,KAAK,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA,MAAM,CAAC;EAAEQ;AAAgE,CAAC,KAClEA,+BAA+B,IAC/B,IAAAN,qBAAG;AACX;AACA,kBAAkBO,2DAAgC;AAClD;AACA,SAAS;AACT;AACA,MAAM,CAAC;EAAER;AAAY,CAAC,KACdA,WAAW,IACX,IAAAC,qBAAG;AACX;AACA,SAAS;AACT,CAAC","ignoreList":[]}
@@ -8,6 +8,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
8
8
  var _react = require("motion/react");
9
9
  var _react2 = _interopRequireWildcard(require("react"));
10
10
  var _styledComponents = require("styled-components");
11
+ var _useKeyboardFocusHighlighting = require("../../hooks/useKeyboardFocusHighlighting");
11
12
  var _Icon = _interopRequireDefault(require("../icon/Icon"));
12
13
  var _Button = require("./Button.styles");
13
14
  var _WaitCursor = _interopRequireDefault(require("./wait-cursor/WaitCursor"));
@@ -25,7 +26,8 @@ const Button = ({
25
26
  shouldShowAsSelectButton = false,
26
27
  shouldShowTextAsRobotoMedium = true,
27
28
  buttonDesign,
28
- tapDuration = 0.5
29
+ tapDuration = 0.5,
30
+ shouldEnableKeyboardHighlighting
29
31
  }) => {
30
32
  const handleClick = event => {
31
33
  if (shouldStopPropagation) {
@@ -36,6 +38,7 @@ const Button = ({
36
38
  const buttonClasses = (0, _clsx.default)('beta-chayns-button ellipsis', className);
37
39
  const theme = (0, _styledComponents.useTheme)();
38
40
  const effectiveButtonDesign = buttonDesign ?? theme.buttonDesign;
41
+ const shouldShowKeyboardHighlighting = (0, _useKeyboardFocusHighlighting.useKeyboardFocusHighlighting)(shouldEnableKeyboardHighlighting && !isDisabled);
39
42
  const iconColor = (0, _react2.useMemo)(() => {
40
43
  if (isSecondary) {
41
44
  return theme.text;
@@ -78,6 +81,7 @@ const Button = ({
78
81
  $shouldShowTextAsRobotoMedium: shouldShowTextAsRobotoMedium,
79
82
  $shouldShowAsSelectButton: shouldShowAsSelectButton,
80
83
  $shouldShowWaitCursor: shouldShowWaitCursor,
84
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
81
85
  className: buttonClasses,
82
86
  disabled: isDisabled,
83
87
  $isDisabled: isDisabled,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["_clsx","_interopRequireDefault","require","_react","_react2","_interopRequireWildcard","_styledComponents","_Icon","_Button","_WaitCursor","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Button","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","shouldShowAsSelectButton","shouldShowTextAsRobotoMedium","buttonDesign","tapDuration","handleClick","event","stopPropagation","buttonClasses","clsx","theme","useTheme","effectiveButtonDesign","iconColor","useMemo","text","buttonColor","buttonBackgroundColor","backgroundColor","color","tapStyles","opacity","hoverStyles","createElement","StyledMotionButton","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","$shouldShowWaitCursor","disabled","$isDisabled","$hasChildren","$hasIcon","$isSecondary","$effectiveButtonDesign","style","visibility","initial","animate","transition","duration","ease","type","whileTap","whileHover","AnimatePresence","StyledIconWrapper","icons","StyledMotionWaitCursorWrapper","width","exit","key","overflow","shouldHideBackground","StyledMotionChildrenWrapper","displayName","_default","exports"],"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,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAOA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AAAkD,SAAAG,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD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;IACAZ,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B9C,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDD,MAAM,CAAC8D,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzE,OAAA,GAEfS,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Button.js","names":["_clsx","_interopRequireDefault","require","_react","_react2","_interopRequireWildcard","_styledComponents","_useKeyboardFocusHighlighting","_Icon","_Button","_WaitCursor","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Button","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","shouldShowAsSelectButton","shouldShowTextAsRobotoMedium","buttonDesign","tapDuration","shouldEnableKeyboardHighlighting","handleClick","event","stopPropagation","buttonClasses","clsx","theme","useTheme","effectiveButtonDesign","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","iconColor","useMemo","text","buttonColor","buttonBackgroundColor","backgroundColor","color","tapStyles","opacity","hoverStyles","createElement","StyledMotionButton","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","$shouldShowWaitCursor","$shouldShowKeyboardHighlighting","disabled","$isDisabled","$hasChildren","$hasIcon","$isSecondary","$effectiveButtonDesign","style","visibility","initial","animate","transition","duration","ease","type","whileTap","whileHover","AnimatePresence","StyledIconWrapper","icons","StyledMotionWaitCursorWrapper","width","exit","key","overflow","shouldHideBackground","StyledMotionChildrenWrapper","displayName","_default","exports"],"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,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,6BAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAOA,IAAAQ,WAAA,GAAAT,sBAAA,CAAAC,OAAA;AAAkD,SAAAG,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,C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AAO,EAAE;MAAEhB,OAAO,EAAE,CAAC;MAAE4B,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC;IACJ;IAAA;IACAZ,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7BlD,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDD,MAAM,CAACkE,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7E,OAAA,GAEfS,MAAM","ignoreList":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.StyledMotionWaitCursorWrapper = exports.StyledMotionChildrenWrapper = exports.StyledMotionButton = exports.StyledIconWrapper = void 0;
7
7
  var _react = require("motion/react");
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles");
9
10
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
11
  const StyledMotionButton = exports.StyledMotionButton = (0, _styledComponents.default)(_react.motion.button)`
11
12
  ${({
@@ -64,6 +65,22 @@ const StyledMotionButton = exports.StyledMotionButton = (0, _styledComponents.de
64
65
  user-select: none;
65
66
  width: fit-content;
66
67
 
68
+ ${({
69
+ $shouldShowKeyboardHighlighting,
70
+ $shouldShowAsSelectButton,
71
+ $isSecondary
72
+ }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
73
+ &:focus-visible {
74
+ transition: none;
75
+ ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
76
+
77
+ ${($shouldShowAsSelectButton || $isSecondary) && (0, _styledComponents.css)`
78
+ color: var(--chayns-color--text);
79
+ outline: solid 2px color-mix(in srgb, white 70%, transparent);
80
+ `}
81
+ }
82
+ `}
83
+
67
84
  ${({
68
85
  $hasIcon,
69
86
  $hasChildren,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionButton","exports","styled","motion","button","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","css","$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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OA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2B,GAAAnB,OAAA,CAAAmB,2BAAA,GAAG,IAAAlB,yBAAM,EAACC,aAAM,CAACkB,GAAG,CAAC;AAC7D;AACA,CAAC;AAEM,MAAMC,6BAA6B,GAAArB,OAAA,CAAAqB,6BAAA,GAAG,IAAApB,yBAAM,EAACC,aAAM,CAACkB,GAAG,CAAC;AAC/D;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Button.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_keyboardFocusHighlighting","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionButton","exports","styled","motion","button","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","css","$isSecondary","$effectiveButtonDesign","theme","text","buttonColor","buttonBackgroundColor","$isDisabled","$shouldShowKeyboardHighlighting","keyboardFocusHighlightingRingCss","$hasIcon","$hasChildren","$shouldShowWaitCursor","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledButtonProps = WithTheme<{\n $hasIcon: boolean;\n $hasChildren: boolean;\n $isDisabled?: boolean;\n $isSecondary?: boolean;\n $shouldShowTextAsRobotoMedium: boolean;\n $shouldShowAsSelectButton: boolean;\n $shouldShowWaitCursor?: boolean;\n $effectiveButtonDesign: number;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nexport const StyledMotionButton = styled(motion.button)<StyledButtonProps>`\n ${({ $shouldShowTextAsRobotoMedium, $shouldShowAsSelectButton }) =>\n $shouldShowTextAsRobotoMedium &&\n !$shouldShowAsSelectButton &&\n css`\n font-size: 110%;\n font-family: 'Roboto Medium', serif;\n `}\n\n align-items: center;\n\n ${({\n $isSecondary,\n $shouldShowAsSelectButton,\n $effectiveButtonDesign,\n theme,\n }: StyledButtonProps) => {\n if ($isSecondary || $shouldShowAsSelectButton) {\n return css`\n color: ${theme.text};\n `;\n }\n\n return css`\n color: ${$effectiveButtonDesign === 2\n ? (theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white')\n : (theme.buttonColor ?? 'white')};\n `;\n }}\n\n ${({\n theme,\n $isSecondary,\n $shouldShowAsSelectButton,\n $effectiveButtonDesign,\n }: StyledButtonProps) => {\n if ($effectiveButtonDesign === 2 && !$shouldShowAsSelectButton) {\n return css`\n border: 1px solid ${$isSecondary ? theme['202'] : theme.buttonBackgroundColor};\n box-shadow: none;\n `;\n }\n\n return css`\n border: none;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n `;\n }}\n\n border-radius: 3px;\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n display: inline-flex;\n flex: 0 0 auto;\n line-height: 22px;\n min-height: 32px;\n position: relative;\n user-select: none;\n width: fit-content;\n\n ${({ $shouldShowKeyboardHighlighting, $shouldShowAsSelectButton, $isSecondary }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n\n ${($shouldShowAsSelectButton || $isSecondary) &&\n css`\n color: var(--chayns-color--text);\n outline: solid 2px color-mix(in srgb, white 70%, transparent);\n `}\n }\n `}\n\n ${({ $hasIcon, $hasChildren, $shouldShowWaitCursor }) => {\n if ($shouldShowWaitCursor) {\n return css`\n padding: 4px 12px;\n `;\n }\n\n if ($hasIcon) {\n if ($hasChildren) {\n return css`\n padding: 6px 12px 6px 42px;\n `;\n }\n return css`\n padding: 6px 12px 6px 18px;\n `;\n }\n return css`\n padding: 6px 12px 6px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)`\n will-change: unset !important;\n`;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,0BAAA,GAAAH,OAAA;AAAgG,SAAAE,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,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B,IAAAR,qBAAG;AACX;AACA;AACA,kBAAkBS,2DAAgC;AAClD;AACA,kBAAkB,CAACV,yBAAyB,IAAIE,YAAY,KAC5C,IAAAD,qBAAG;AACnB;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA,MAAM,CAAC;EAAEU,QAAQ;EAAEC,YAAY;EAAEC;AAAsB,CAAC,KAAK;EACrD,IAAIA,qBAAqB,EAAE;IACvB,OAAO,IAAAZ,qBAAG;AACtB;AACA,aAAa;EACL;EAEA,IAAIU,QAAQ,EAAE;IACV,IAAIC,YAAY,EAAE;MACd,OAAO,IAAAX,qBAAG;AAC1B;AACA,iBAAiB;IACL;IACA,OAAO,IAAAA,qBAAG;AACtB;AACA,aAAa;EACL;EACA,OAAO,IAAAA,qBAAG;AAClB;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAEM,MAAMa,iBAAiB,GAAAnB,OAAA,CAAAmB,iBAAA,GAAGlB,yBAAM,CAACmB,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,2BAA2B,GAAArB,OAAA,CAAAqB,2BAAA,GAAG,IAAApB,yBAAM,EAACC,aAAM,CAACoB,GAAG,CAAC;AAC7D;AACA,CAAC;AAEM,MAAMC,6BAA6B,GAAAvB,OAAA,CAAAuB,6BAAA,GAAG,IAAAtB,yBAAM,EAACC,aAAM,CAACoB,GAAG,CAAC;AAC/D;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.types.js","names":[],"sources":["../../../../src/components/button/Button.types.ts"],"sourcesContent":["import type { MouseEventHandler, ReactNode } from 'react';\n\nexport type ButtonProps = {\n /**\n * The label of the button.\n * @description\n * The content to be displayed inside the button. This can be text, icons, or any React node.\n * It serves as the primary label for the button's action.\n * @optional\n */\n children?: ReactNode;\n /**\n * Additional class names for the button element.\n * @description\n * Allows adding custom CSS classes to the button for further styling or integration with CSS frameworks.\n * Multiple classes can be provided as a space-separated string.\n * @optional\n */\n className?: string;\n /**\n * An icon that is displayed on the left-hand side of the button text.\n * @description\n * Specifies an icon to be shown alongside the button text. The icon is positioned to the left of the text.\n * This enhances the visual representation of the button's function.\n * @optional\n */\n icon?: string;\n /**\n * Whether the button is disabled and cannot be clicked anymore.\n * @description\n * When set to true, the button becomes non-interactive, preventing user clicks and often changing its appearance to indicate the disabled state.\n * This is useful for scenarios where the action is temporarily unavailable.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Displays the button in the secondary style.\n * @description\n * Applies a secondary visual style to the button, typically with a different background color or border.\n * This is used to differentiate less prominent actions from primary ones.\n * @optional\n */\n isSecondary?: boolean;\n /**\n * Function to be executed when the button is clicked.\n * @description\n * A callback function that is triggered when the user clicks on the button. This can be used to handle interactions,\n * such as submitting forms, navigating to pages, or performing any custom action.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Whether the button should be displayed as a selectButton.\n * @description\n * Modifies the button's appearance to resemble a select button, often used in dropdowns or selection interfaces.\n * This changes the styling to indicate a selection state.\n * @optional\n * @default false\n */\n shouldShowAsSelectButton?: boolean;\n /**\n * Whether the text should be 'Roboto Medium'.\n * @description\n * Controls the font weight of the button text. When true, applies 'Roboto Medium' font weight for emphasis.\n * This can improve readability or match design guidelines.\n * @optional\n * @default true\n */\n shouldShowTextAsRobotoMedium?: boolean;\n /**\n * Shows a wait cursor instead of button text.\n * @description\n * Replaces the button content with a wait cursor animation, indicating that an action is in progress.\n * This provides visual feedback during loading or processing states.\n * @optional\n */\n shouldShowWaitCursor?: boolean;\n /**\n * Stops event propagation on click.\n * @description\n * Prevents the click event from bubbling up to parent elements, isolating the button's interaction.\n * Useful in complex UI structures where event handling needs to be contained.\n * @optional\n */\n shouldStopPropagation?: boolean;\n /**\n * Optional button design override.\n * @description\n * Allows overriding the default button design with a specific numeric value, corresponding to different visual themes or styles.\n * This provides flexibility for custom theming.\n * @optional\n */\n buttonDesign?: number;\n /**\n * Duration in seconds for the tap animation.\n * @description\n * Overrides how long the pressed state animation should take when the button is tapped.\n * Set this to `0` for an immediate press effect.\n * @optional\n */\n tapDuration?: number;\n};\n"],"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":[]}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
+ var _useKeyboardFocusHighlighting = require("../../hooks/useKeyboardFocusHighlighting");
8
9
  var _uuid = require("../../hooks/uuid");
9
10
  var _calculate = require("../../utils/calculate");
10
11
  var _Checkbox = require("./Checkbox.styles");
@@ -19,7 +20,8 @@ const Checkbox = ({
19
20
  borderRadius,
20
21
  colors,
21
22
  shouldShowCentered = false,
22
- shouldChangeOnLabelClick = true
23
+ shouldChangeOnLabelClick = true,
24
+ shouldEnableKeyboardHighlighting
23
25
  }) => {
24
26
  const [isActive, setIsActive] = (0, _react.useState)(isChecked ?? false);
25
27
  const [checkboxTop, setCheckboxTop] = (0, _react.useState)(undefined);
@@ -42,9 +44,11 @@ const Checkbox = ({
42
44
  setCheckboxTop((singleLineHeight - boxHeight) / 2);
43
45
  }
44
46
  }, [shouldShowCentered]);
47
+ const shouldShowKeyboardHighlighting = (0, _useKeyboardFocusHighlighting.useKeyboardFocusHighlighting)(shouldEnableKeyboardHighlighting && !isDisabled);
45
48
  return /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckbox, {
46
49
  ref: checkboxRootRef
47
50
  }, /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckboxInput, {
51
+ $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
48
52
  checked: isChecked,
49
53
  disabled: isDisabled,
50
54
  id: uuid,
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":["_react","_interopRequireWildcard","require","_uuid","_calculate","_Checkbox","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Checkbox","children","isChecked","isDisabled","labelClassName","onChange","shouldShowAsSwitch","borderRadius","colors","shouldShowCentered","shouldChangeOnLabelClick","isActive","setIsActive","useState","checkboxTop","setCheckboxTop","undefined","checkboxBoxRef","useRef","checkboxRootRef","handleChange","useCallback","event","target","checked","uuid","useUuid","useEffect","current","_checkboxBoxRef$curre","singleLineHeight","getHeightOfSingleTextLine","container","boxHeight","getBoundingClientRect","height","createElement","StyledCheckbox","ref","StyledCheckboxInput","disabled","id","type","StyledCheckboxBoxWrapper","$shouldShowAsSwitch","style","top","transform","StyledCheckboxBox","htmlFor","$isChecked","$isDisabled","$checkedBackgroundColor","checkedBackgroundColor","$uncheckedBackgroundColor","uncheckedBackgroundColor","$borderRadius","$borderColor","borderColor","StyledCheckboxLabel","className","$shouldChangeOnLabelClick","displayName","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAM2B,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,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ClB,CAAC,eAEFnE,MAAA,CAAAgB,OAAA,CAAA6C,aAAA,CAACxD,SAAA,CAAA+D,wBAAwB;IACrBC,mBAAmB,EAAEtC,kBAAmB;IACxCuC,KAAK,EAAE;MACHC,GAAG,EAAErC,kBAAkB,GAAG,KAAK,GAAGK,WAAW;MAC7CiC,SAAS,EAAEtC,kBAAkB,GAAG,kBAAkB,GAAGO;IACzD;EAAE,gBAEFzC,MAAA,CAAAgB,OAAA,CAAA6C,aAAA,CAACxD,SAAA,CAAAoE,iBAAiB;IACdC,OAAO,EAAExB,IAAK;IACda,GAAG,EAAErB,cAAe;IACpBiC,UAAU,EAAEhD,SAAS,IAAIS,QAAS;IAClCwC,WAAW,EAAEhD,UAAW;IACxByC,mBAAmB,EAAEtC,kBAAmB;IACxC8C,uBAAuB,EAAE5C,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAE6C,sBAAuB;IACxDC,yBAAyB,EAAE9C,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAE+C,wBAAyB;IAC5DC,aAAa,EAAEjD,YAAa;IAC5BkD,YAAY,EAAEjD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEkD;EAAY,CACrC,CACqB,CAAC,eAC3BnF,MAAA,CAAAgB,OAAA,CAAA6C,aAAA,CAACxD,SAAA,CAAA+E,mBAAmB;IAChBC,SAAS,EAAExD,cAAe;IAC1B+C,WAAW,EAAEhD,UAAW;IACxB0D,yBAAyB,EAAEnD,wBAAyB;IACpDkC,mBAAmB,EAAEtC,kBAAmB;IACxC2C,OAAO,EAAEvC,wBAAwB,GAAGe,IAAI,GAAGT;EAAU,GAEpDf,QACgB,CACT,CAAC;AAEzB,CAAC;AAEDD,QAAQ,CAAC8D,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzE,OAAA,GAEnBS,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"Checkbox.js","names":["_react","_interopRequireWildcard","require","_useKeyboardFocusHighlighting","_uuid","_calculate","_Checkbox","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Checkbox","children","isChecked","isDisabled","labelClassName","onChange","shouldShowAsSwitch","borderRadius","colors","shouldShowCentered","shouldChangeOnLabelClick","shouldEnableKeyboardHighlighting","isActive","setIsActive","useState","checkboxTop","setCheckboxTop","undefined","checkboxBoxRef","useRef","checkboxRootRef","handleChange","useCallback","event","target","checked","uuid","useUuid","useEffect","current","_checkboxBoxRef$curre","singleLineHeight","getHeightOfSingleTextLine","container","boxHeight","getBoundingClientRect","height","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","createElement","StyledCheckbox","ref","StyledCheckboxInput","$shouldShowKeyboardHighlighting","disabled","id","type","StyledCheckboxBoxWrapper","$shouldShowAsSwitch","style","top","transform","StyledCheckboxBox","htmlFor","$isChecked","$isDisabled","$checkedBackgroundColor","checkedBackgroundColor","$uncheckedBackgroundColor","uncheckedBackgroundColor","$borderRadius","$borderColor","borderColor","StyledCheckboxLabel","className","$shouldChangeOnLabelClick","displayName","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAYA,IAAAC,6BAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAM2B,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,C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A,GAEnBS,QAAQ","ignoreList":[]}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.StyledCheckboxLabel = exports.StyledCheckboxInput = exports.StyledCheckboxBoxWrapper = exports.StyledCheckboxBox = exports.StyledCheckbox = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
+ var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles");
8
9
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
10
  const StyledCheckbox = exports.StyledCheckbox = _styledComponents.default.div`
10
11
  align-items: center;
@@ -14,7 +15,28 @@ const StyledCheckbox = exports.StyledCheckbox = _styledComponents.default.div`
14
15
  min-height: 20px;
15
16
  `;
16
17
  const StyledCheckboxInput = exports.StyledCheckboxInput = _styledComponents.default.input`
17
- display: none;
18
+ border: 0;
19
+ clip: rect(0 0 0 0);
20
+ clip-path: inset(50%);
21
+ height: 1px;
22
+ left: 0;
23
+ margin: 0;
24
+ opacity: 0;
25
+ overflow: hidden;
26
+ padding: 0;
27
+ position: absolute;
28
+ top: 0;
29
+ white-space: nowrap;
30
+ width: 1px;
31
+
32
+ ${({
33
+ $shouldShowKeyboardHighlighting
34
+ }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
35
+ &:focus-visible + div > label {
36
+ transition: none;
37
+ ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
38
+ }
39
+ `}
18
40
  `;
19
41
  const StyledCheckboxBoxWrapper = exports.StyledCheckboxBoxWrapper = _styledComponents.default.div`
20
42
  display: flex;
@@ -39,6 +61,10 @@ const StyledCheckboxBox = exports.StyledCheckboxBox = _styledComponents.default.
39
61
  $isDisabled
40
62
  }) => $isDisabled ? 0.5 : 1};
41
63
  position: relative;
64
+ display: inline-block;
65
+ width: ${({
66
+ $shouldShowAsSwitch
67
+ }) => $shouldShowAsSwitch ? '44px' : '16px'};
42
68
  transition: opacity 0.2s ease;
43
69
  user-select: none;
44
70
  height: 16px;
@@ -97,7 +123,8 @@ const StyledCheckboxBox = exports.StyledCheckboxBox = _styledComponents.default.
97
123
  if ($shouldShowAsSwitch) {
98
124
  return 'none';
99
125
  }
100
- return `1px solid ${$borderColor ?? `rgba(${theme['409-rgb']}, 0.5)`}`;
126
+ const fallbackBorderColor = theme['409-rgb'] ? `rgba(${theme['409-rgb']}, 0.5)` : theme.text;
127
+ return `1px solid ${$borderColor ?? fallbackBorderColor}`;
101
128
  }};
102
129
 
103
130
  border-radius: ${({
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.styles.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledCheckbox","exports","styled","div","StyledCheckboxInput","input","StyledCheckboxBoxWrapper","$shouldShowAsSwitch","css","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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AAAC,qBAAG;AACjB;AACA,eAAe,GACD,IAAAA,qBAAG;AACjB;AACA,eAAe;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Checkbox.styles.js","names":["_styledComponents","_interopRequireWildcard","require","_keyboardFocusHighlighting","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledCheckbox","exports","styled","div","StyledCheckboxInput","input","$shouldShowKeyboardHighlighting","css","keyboardFocusHighlightingRingCss","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 }) => ($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