@chayns-components/core 5.5.29 → 5.5.31-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 (259) hide show
  1. package/AGENTS.md +10 -0
  2. package/lib/cjs/components/accordion/Accordion.js +10 -0
  3. package/lib/cjs/components/accordion/Accordion.js.map +1 -1
  4. package/lib/cjs/components/accordion/Accordion.styles.js +0 -2
  5. package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
  6. package/lib/cjs/components/amount-control/AmountControl.js +14 -3
  7. package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
  8. package/lib/cjs/components/amount-control/AmountControl.styles.js +0 -17
  9. package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
  10. package/lib/cjs/components/button/Button.js +6 -1
  11. package/lib/cjs/components/button/Button.js.map +1 -1
  12. package/lib/cjs/components/button/Button.styles.js +0 -10
  13. package/lib/cjs/components/button/Button.styles.js.map +1 -1
  14. package/lib/cjs/components/checkbox/Checkbox.js +8 -1
  15. package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
  16. package/lib/cjs/components/checkbox/Checkbox.styles.js +0 -10
  17. package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
  18. package/lib/cjs/components/combobox/ComboBox.js +7 -1
  19. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  20. package/lib/cjs/components/combobox/ComboBox.styles.js +3 -10
  21. package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
  22. package/lib/cjs/components/context-menu/ContextMenu.js +12 -0
  23. package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
  24. package/lib/cjs/components/context-menu/ContextMenu.styles.js +7 -35
  25. package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
  26. package/lib/cjs/components/copyable-content/CopyableContent.js +8 -1
  27. package/lib/cjs/components/copyable-content/CopyableContent.js.map +1 -1
  28. package/lib/cjs/components/copyable-content/CopyableContent.styles.js +7 -2
  29. package/lib/cjs/components/copyable-content/CopyableContent.styles.js.map +1 -1
  30. package/lib/cjs/components/file-list/file-item/FileItem.js +7 -0
  31. package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
  32. package/lib/cjs/components/file-list/file-item/FileItem.styles.js +1 -11
  33. package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
  34. package/lib/cjs/components/file-select/FileSelect.js +12 -3
  35. package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
  36. package/lib/cjs/components/file-select/FileSelect.styles.js +3 -9
  37. package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
  38. package/lib/cjs/components/filter/Filter.js +44 -16
  39. package/lib/cjs/components/filter/Filter.js.map +1 -1
  40. package/lib/cjs/components/filter/Filter.styles.js +2 -2
  41. package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
  42. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +9 -1
  43. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  44. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
  45. package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  46. package/lib/cjs/components/grid-image/GridImage.js +7 -1
  47. package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
  48. package/lib/cjs/components/grid-image/GridImage.styles.js +5 -10
  49. package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
  50. package/lib/cjs/components/grouped-image/GroupedImage.js +8 -2
  51. package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
  52. package/lib/cjs/components/grouped-image/GroupedImage.styles.js +3 -8
  53. package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
  54. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +7 -2
  55. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  56. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +5 -10
  57. package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  58. package/lib/cjs/components/icon/Icon.js +10 -2
  59. package/lib/cjs/components/icon/Icon.js.map +1 -1
  60. package/lib/cjs/components/icon/Icon.styles.js +4 -22
  61. package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
  62. package/lib/cjs/components/input/Input.js +14 -2
  63. package/lib/cjs/components/input/Input.js.map +1 -1
  64. package/lib/cjs/components/input/Input.styles.js +0 -3
  65. package/lib/cjs/components/input/Input.styles.js.map +1 -1
  66. package/lib/cjs/components/list/List.utils.js +3 -9
  67. package/lib/cjs/components/list/List.utils.js.map +1 -1
  68. package/lib/cjs/components/list/list-item/ListItem.js +13 -2
  69. package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
  70. package/lib/cjs/components/list/list-item/ListItem.styles.js +9 -2
  71. package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
  72. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -4
  73. package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  74. package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
  75. package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
  76. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +8 -2
  77. package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  78. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
  79. package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  80. package/lib/cjs/components/radio-button/RadioButton.js +7 -1
  81. package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
  82. package/lib/cjs/components/radio-button/RadioButton.styles.js +0 -10
  83. package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
  84. package/lib/cjs/components/search-input/SearchInput.js +9 -10
  85. package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
  86. package/lib/cjs/components/search-input/SearchInput.styles.js +5 -15
  87. package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
  88. package/lib/cjs/components/sharing-bar/SharingBar.js +13 -0
  89. package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
  90. package/lib/cjs/components/sharing-bar/SharingBar.styles.js +1 -5
  91. package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
  92. package/lib/cjs/components/slider/Slider.js +13 -6
  93. package/lib/cjs/components/slider/Slider.js.map +1 -1
  94. package/lib/cjs/components/slider/Slider.styles.js +2 -9
  95. package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
  96. package/lib/cjs/components/slider-button/SliderButton.js +6 -2
  97. package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
  98. package/lib/cjs/components/slider-button/SliderButton.styles.js +2 -15
  99. package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
  100. package/lib/cjs/components/tag-input/TagInput.js +8 -1
  101. package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
  102. package/lib/cjs/components/tag-input/TagInput.styles.js +1 -3
  103. package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
  104. package/lib/cjs/components/text-area/TextArea.js +68 -56
  105. package/lib/cjs/components/text-area/TextArea.js.map +1 -1
  106. package/lib/cjs/components/text-area/TextArea.styles.js +0 -2
  107. package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
  108. package/lib/cjs/components/truncation/Truncation.js +9 -5
  109. package/lib/cjs/components/truncation/Truncation.js.map +1 -1
  110. package/lib/cjs/components/truncation/Truncation.styles.js +0 -11
  111. package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
  112. package/lib/cjs/hooks/useFocusRingPortal.js +197 -0
  113. package/lib/cjs/hooks/useFocusRingPortal.js.map +1 -0
  114. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +9 -3
  115. package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -1
  116. package/lib/cjs/index.js +14 -0
  117. package/lib/cjs/index.js.map +1 -1
  118. package/lib/esm/components/accordion/Accordion.js +10 -0
  119. package/lib/esm/components/accordion/Accordion.js.map +1 -1
  120. package/lib/esm/components/accordion/Accordion.styles.js +0 -2
  121. package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
  122. package/lib/esm/components/amount-control/AmountControl.js +14 -3
  123. package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
  124. package/lib/esm/components/amount-control/AmountControl.styles.js +0 -17
  125. package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
  126. package/lib/esm/components/button/Button.js +7 -2
  127. package/lib/esm/components/button/Button.js.map +1 -1
  128. package/lib/esm/components/button/Button.styles.js +0 -10
  129. package/lib/esm/components/button/Button.styles.js.map +1 -1
  130. package/lib/esm/components/checkbox/Checkbox.js +8 -1
  131. package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
  132. package/lib/esm/components/checkbox/Checkbox.styles.js +0 -10
  133. package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
  134. package/lib/esm/components/combobox/ComboBox.js +7 -1
  135. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  136. package/lib/esm/components/combobox/ComboBox.styles.js +3 -10
  137. package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
  138. package/lib/esm/components/context-menu/ContextMenu.js +11 -0
  139. package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
  140. package/lib/esm/components/context-menu/ContextMenu.styles.js +7 -35
  141. package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
  142. package/lib/esm/components/copyable-content/CopyableContent.js +8 -1
  143. package/lib/esm/components/copyable-content/CopyableContent.js.map +1 -1
  144. package/lib/esm/components/copyable-content/CopyableContent.styles.js +7 -2
  145. package/lib/esm/components/copyable-content/CopyableContent.styles.js.map +1 -1
  146. package/lib/esm/components/file-list/file-item/FileItem.js +8 -1
  147. package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
  148. package/lib/esm/components/file-list/file-item/FileItem.styles.js +1 -11
  149. package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
  150. package/lib/esm/components/file-select/FileSelect.js +13 -4
  151. package/lib/esm/components/file-select/FileSelect.js.map +1 -1
  152. package/lib/esm/components/file-select/FileSelect.styles.js +3 -9
  153. package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
  154. package/lib/esm/components/filter/Filter.js +43 -16
  155. package/lib/esm/components/filter/Filter.js.map +1 -1
  156. package/lib/esm/components/filter/Filter.styles.js +2 -2
  157. package/lib/esm/components/filter/Filter.styles.js.map +1 -1
  158. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +10 -2
  159. package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
  160. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
  161. package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
  162. package/lib/esm/components/grid-image/GridImage.js +8 -2
  163. package/lib/esm/components/grid-image/GridImage.js.map +1 -1
  164. package/lib/esm/components/grid-image/GridImage.styles.js +4 -9
  165. package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
  166. package/lib/esm/components/grouped-image/GroupedImage.js +9 -3
  167. package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
  168. package/lib/esm/components/grouped-image/GroupedImage.styles.js +3 -8
  169. package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
  170. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +8 -3
  171. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
  172. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +4 -9
  173. package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
  174. package/lib/esm/components/icon/Icon.js +9 -2
  175. package/lib/esm/components/icon/Icon.js.map +1 -1
  176. package/lib/esm/components/icon/Icon.styles.js +4 -22
  177. package/lib/esm/components/icon/Icon.styles.js.map +1 -1
  178. package/lib/esm/components/input/Input.js +14 -2
  179. package/lib/esm/components/input/Input.js.map +1 -1
  180. package/lib/esm/components/input/Input.styles.js +0 -3
  181. package/lib/esm/components/input/Input.styles.js.map +1 -1
  182. package/lib/esm/components/list/List.utils.js +1 -6
  183. package/lib/esm/components/list/List.utils.js.map +1 -1
  184. package/lib/esm/components/list/list-item/ListItem.js +13 -2
  185. package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
  186. package/lib/esm/components/list/list-item/ListItem.styles.js +9 -2
  187. package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
  188. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +5 -4
  189. package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
  190. package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
  191. package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
  192. package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -2
  193. package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
  194. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
  195. package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
  196. package/lib/esm/components/radio-button/RadioButton.js +7 -1
  197. package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
  198. package/lib/esm/components/radio-button/RadioButton.styles.js +0 -10
  199. package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
  200. package/lib/esm/components/search-input/SearchInput.js +9 -10
  201. package/lib/esm/components/search-input/SearchInput.js.map +1 -1
  202. package/lib/esm/components/search-input/SearchInput.styles.js +5 -15
  203. package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
  204. package/lib/esm/components/sharing-bar/SharingBar.js +12 -0
  205. package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
  206. package/lib/esm/components/sharing-bar/SharingBar.styles.js +1 -5
  207. package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
  208. package/lib/esm/components/slider/Slider.js +13 -6
  209. package/lib/esm/components/slider/Slider.js.map +1 -1
  210. package/lib/esm/components/slider/Slider.styles.js +1 -8
  211. package/lib/esm/components/slider/Slider.styles.js.map +1 -1
  212. package/lib/esm/components/slider-button/SliderButton.js +6 -2
  213. package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
  214. package/lib/esm/components/slider-button/SliderButton.styles.js +1 -14
  215. package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
  216. package/lib/esm/components/tag-input/TagInput.js +8 -1
  217. package/lib/esm/components/tag-input/TagInput.js.map +1 -1
  218. package/lib/esm/components/tag-input/TagInput.styles.js +1 -3
  219. package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
  220. package/lib/esm/components/text-area/TextArea.js +68 -56
  221. package/lib/esm/components/text-area/TextArea.js.map +1 -1
  222. package/lib/esm/components/text-area/TextArea.styles.js +0 -2
  223. package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
  224. package/lib/esm/components/truncation/Truncation.js +9 -5
  225. package/lib/esm/components/truncation/Truncation.js.map +1 -1
  226. package/lib/esm/components/truncation/Truncation.styles.js +0 -11
  227. package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
  228. package/lib/esm/hooks/useFocusRingPortal.js +188 -0
  229. package/lib/esm/hooks/useFocusRingPortal.js.map +1 -0
  230. package/lib/esm/hooks/useKeyboardFocusHighlighting.js +7 -2
  231. package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -1
  232. package/lib/esm/index.js +2 -0
  233. package/lib/esm/index.js.map +1 -1
  234. package/lib/types/components/amount-control/AmountControl.styles.d.ts +4 -8
  235. package/lib/types/components/button/Button.styles.d.ts +2 -4
  236. package/lib/types/components/checkbox/Checkbox.styles.d.ts +1 -5
  237. package/lib/types/components/combobox/ComboBox.styles.d.ts +2 -4
  238. package/lib/types/components/copyable-content/CopyableContent.d.ts +4 -0
  239. package/lib/types/components/file-select/FileSelect.styles.d.ts +2 -4
  240. package/lib/types/components/grid-image/GridImage.styles.d.ts +2 -4
  241. package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +2 -4
  242. package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +1 -5
  243. package/lib/types/components/icon/Icon.styles.d.ts +0 -1
  244. package/lib/types/components/input/Input.styles.d.ts +4 -4
  245. package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +2 -4
  246. package/lib/types/components/radio-button/RadioButton.styles.d.ts +2 -4
  247. package/lib/types/components/search-input/SearchInput.styles.d.ts +6 -13
  248. package/lib/types/components/slider/Slider.styles.d.ts +8 -12
  249. package/lib/types/components/slider-button/SliderButton.styles.d.ts +2 -4
  250. package/lib/types/components/truncation/Truncation.styles.d.ts +1 -5
  251. package/lib/types/hooks/useFocusRingPortal.d.ts +18 -0
  252. package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +1 -0
  253. package/lib/types/index.d.ts +2 -0
  254. package/package.json +4 -4
  255. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +0 -29
  256. package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  257. package/lib/esm/utils/keyboardFocusHighlighting.styles.js +0 -24
  258. package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +0 -1
  259. package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +0 -9
@@ -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 _useFocusRingPortal = require("../../hooks/useFocusRingPortal");
11
12
  var _useKeyboardFocusHighlighting = require("../../hooks/useKeyboardFocusHighlighting");
12
13
  var _Icon = _interopRequireDefault(require("../icon/Icon"));
13
14
  var _Button = require("./Button.styles");
@@ -29,6 +30,7 @@ const Button = ({
29
30
  tapDuration = 0.5,
30
31
  shouldEnableKeyboardHighlighting
31
32
  }) => {
33
+ const buttonRef = (0, _react2.useRef)(null);
32
34
  const handleClick = event => {
33
35
  if (shouldStopPropagation) {
34
36
  event.stopPropagation();
@@ -39,6 +41,9 @@ const Button = ({
39
41
  const theme = (0, _styledComponents.useTheme)();
40
42
  const effectiveButtonDesign = buttonDesign ?? theme.buttonDesign;
41
43
  const shouldShowKeyboardHighlighting = (0, _useKeyboardFocusHighlighting.useKeyboardFocusHighlighting)(shouldEnableKeyboardHighlighting && !isDisabled);
44
+ (0, _useFocusRingPortal.useFocusRingPortal)(buttonRef, {
45
+ isEnabled: shouldShowKeyboardHighlighting
46
+ });
42
47
  const iconColor = (0, _react2.useMemo)(() => {
43
48
  if (isSecondary) {
44
49
  return theme.text;
@@ -78,10 +83,10 @@ const Button = ({
78
83
  };
79
84
  }, [theme, effectiveButtonDesign]);
80
85
  return /*#__PURE__*/_react2.default.createElement(_Button.StyledMotionButton, {
86
+ ref: buttonRef,
81
87
  $shouldShowTextAsRobotoMedium: shouldShowTextAsRobotoMedium,
82
88
  $shouldShowAsSelectButton: shouldShowAsSelectButton,
83
89
  $shouldShowWaitCursor: shouldShowWaitCursor,
84
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
85
90
  className: buttonClasses,
86
91
  disabled: isDisabled,
87
92
  $isDisabled: isDisabled,
@@ -1 +1 @@
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,CA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4B,KAAK,EAAE;IAAE,CAAE;IAC/BZ,OAAO,EAAE;MAAEhB,OAAO,EAAE,CAAC;MAAE4B,KAAK,EAAE;IAAE,CAAE;IAClCE,GAAG,EAAC,aAAa;IACjBhB,KAAK,EAAE;MAAEiB,QAAQ,EAAE;IAAS,CAAE;IAC9Bb,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,gBAE9B7E,OAAA,CAAAiB,OAAA,CAAA2C,aAAA,CAACtD,WAAA,CAAAW,OAAU;IAACuC,KAAK,EAAEN,SAAS,IAAI,OAAQ;IAACwC,oBAAoB;EAAA,CAAE,CACpC,CAClC,EACA,CAACzD,oBAAoB,IAAIN,QAAQ,iBAC9B3B,OAAA,CAAAiB,OAAA,CAAA2C,aAAA,CAACvD,OAAA,CAAAsF,2BAA2B;IACxBhB,OAAO,EAAE;MAAEjB,OAAO,EAAE,CAAC;MAAE4B,KAAK,EAAE;IAAO,CAAE;IACvCC,IAAI,EAAE;MAAE7B,OAAO,EAAE,CAAC;MAAE4B,KAAK,EAAE;IAAE,CAAE;IAC/BZ,OAAO,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":[]}
1
+ {"version":3,"file":"Button.js","names":["_clsx","_interopRequireDefault","require","_react","_react2","_interopRequireWildcard","_styledComponents","_useFocusRingPortal","_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","buttonRef","useRef","handleClick","event","stopPropagation","buttonClasses","clsx","theme","useTheme","effectiveButtonDesign","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","useFocusRingPortal","isEnabled","iconColor","useMemo","text","buttonColor","buttonBackgroundColor","backgroundColor","color","tapStyles","opacity","hoverStyles","createElement","StyledMotionButton","ref","$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, useRef } from 'react';\nimport { useTheme } from 'styled-components';\nimport { useFocusRingPortal } from '../../hooks/useFocusRingPortal';\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 buttonRef = useRef<HTMLButtonElement>(null);\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 useFocusRingPortal(buttonRef, { isEnabled: shouldShowKeyboardHighlighting });\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 ref={buttonRef}\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,I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BtD,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDD,MAAM,CAACsE,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjF,OAAA,GAEfS,MAAM","ignoreList":[]}
@@ -6,7 +6,6 @@ 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");
10
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); }
11
10
  const StyledMotionButton = exports.StyledMotionButton = (0, _styledComponents.default)(_react.motion.button)`
12
11
  ${({
@@ -65,15 +64,6 @@ const StyledMotionButton = exports.StyledMotionButton = (0, _styledComponents.de
65
64
  user-select: none;
66
65
  width: fit-content;
67
66
 
68
- ${({
69
- $shouldShowKeyboardHighlighting
70
- }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
71
- &:focus-visible {
72
- transition: none;
73
- ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
74
- }
75
- `}
76
-
77
67
  ${({
78
68
  $hasIcon,
79
69
  $hasChildren,
@@ -1 +1 @@
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 }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n ${keyboardFocusHighlightingRingCss}\n }\n `}\n\n ${({ $hasIcon, $hasChildren, $shouldShowWaitCursor }) => {\n if ($shouldShowWaitCursor) {\n return css`\n padding: 4px 12px;\n `;\n }\n\n if ($hasIcon) {\n if ($hasChildren) {\n return css`\n padding: 6px 12px 6px 42px;\n `;\n }\n return css`\n padding: 6px 12px 6px 18px;\n `;\n }\n return css`\n padding: 6px 12px 6px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)`\n will-change: unset !important;\n`;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":";;;;;;AAAA,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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AM,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
+ {"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;AA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GAAGhB,yBAAM,CAACiB,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,2BAA2B,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":[]}
@@ -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 _useFocusRingPortal = require("../../hooks/useFocusRingPortal");
8
9
  var _useKeyboardFocusHighlighting = require("../../hooks/useKeyboardFocusHighlighting");
9
10
  var _uuid = require("../../hooks/uuid");
10
11
  var _calculate = require("../../utils/calculate");
@@ -26,6 +27,7 @@ const Checkbox = ({
26
27
  const [isActive, setIsActive] = (0, _react.useState)(isChecked ?? false);
27
28
  const [checkboxTop, setCheckboxTop] = (0, _react.useState)(undefined);
28
29
  const checkboxBoxRef = (0, _react.useRef)(null);
30
+ const checkboxInputRef = (0, _react.useRef)(null);
29
31
  const checkboxRootRef = (0, _react.useRef)(null);
30
32
  const handleChange = (0, _react.useCallback)(event => {
31
33
  setIsActive(event.target.checked);
@@ -45,11 +47,16 @@ const Checkbox = ({
45
47
  }
46
48
  }, [shouldShowCentered]);
47
49
  const shouldShowKeyboardHighlighting = (0, _useKeyboardFocusHighlighting.useKeyboardFocusHighlighting)(shouldEnableKeyboardHighlighting && !isDisabled);
50
+ (0, _useFocusRingPortal.useFocusRingPortal)(checkboxInputRef, {
51
+ isEnabled: shouldShowKeyboardHighlighting,
52
+ overlayRef: checkboxBoxRef,
53
+ borderRadius: shouldShowAsSwitch ? borderRadius ?? '100px' : borderRadius
54
+ });
48
55
  return /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckbox, {
49
56
  ref: checkboxRootRef,
50
57
  className: "beta-chayns-checkbox"
51
58
  }, /*#__PURE__*/_react.default.createElement(_Checkbox.StyledCheckboxInput, {
52
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
59
+ ref: checkboxInputRef,
53
60
  checked: isChecked,
54
61
  disabled: isDisabled,
55
62
  id: uuid,
@@ -1 +1 @@
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","className","StyledCheckboxInput","$shouldShowKeyboardHighlighting","disabled","id","type","StyledCheckboxBoxWrapper","$shouldShowAsSwitch","style","top","transform","StyledCheckboxBox","htmlFor","$isChecked","$isDisabled","$checkedBackgroundColor","checkedBackgroundColor","$uncheckedBackgroundColor","uncheckedBackgroundColor","$borderRadius","$borderColor","borderColor","StyledCheckboxLabel","$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} className=\"beta-chayns-checkbox\">\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\nChe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CAAC,eAC3BzF,MAAA,CAAAiB,OAAA,CAAAgD,aAAA,CAAC3D,SAAA,CAAAoF,mBAAmB;IAChBtB,SAAS,EAAEtC,cAAe;IAC1BoD,WAAW,EAAErD,UAAW;IACxB8D,yBAAyB,EAAEvD,wBAAyB;IACpDuC,mBAAmB,EAAE3C,kBAAmB;IACxCgD,OAAO,EAAE5C,wBAAwB,GAAGgB,IAAI,GAAGT;EAAU,GAEpDhB,QACgB,CACT,CAAC;AAEzB,CAAC;AAEDD,QAAQ,CAACkE,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7E,OAAA,GAEnBS,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"Checkbox.js","names":["_react","_interopRequireWildcard","require","_useFocusRingPortal","_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","checkboxInputRef","checkboxRootRef","handleChange","useCallback","event","target","checked","uuid","useUuid","useEffect","current","_checkboxBoxRef$curre","singleLineHeight","getHeightOfSingleTextLine","container","boxHeight","getBoundingClientRect","height","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","useFocusRingPortal","isEnabled","overlayRef","createElement","StyledCheckbox","ref","className","StyledCheckboxInput","disabled","id","type","StyledCheckboxBoxWrapper","$shouldShowAsSwitch","style","top","transform","StyledCheckboxBox","htmlFor","$isChecked","$isDisabled","$checkedBackgroundColor","checkedBackgroundColor","$uncheckedBackgroundColor","uncheckedBackgroundColor","$borderRadius","$borderColor","borderColor","StyledCheckboxLabel","$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 { useFocusRingPortal } from '../../hooks/useFocusRingPortal';\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 checkboxInputRef = useRef<HTMLInputElement>(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 useFocusRingPortal(checkboxInputRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n overlayRef: checkboxBoxRef,\n borderRadius: shouldShowAsSwitch ? (borderRadius ?? '100px') : borderRadius,\n });\n\n return (\n <StyledCheckbox ref={checkboxRootRef} className=\"beta-chayns-checkbox\">\n <StyledCheckboxInput\n ref={checkboxInputRef}\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,mBAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAM2B,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,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,CAA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AAmB;IACxC+C,KAAK,EAAE;MACHC,GAAG,EAAE7C,kBAAkB,GAAG,KAAK,GAAGM,WAAW;MAC7CwC,SAAS,EAAE9C,kBAAkB,GAAG,kBAAkB,GAAGQ;IACzD;EAAE,gBAEF5C,MAAA,CAAAkB,OAAA,CAAAoD,aAAA,CAAC/D,SAAA,CAAA4E,iBAAiB;IACdC,OAAO,EAAE9B,IAAK;IACdkB,GAAG,EAAE3B,cAAe;IACpBwC,UAAU,EAAExD,SAAS,IAAIU,QAAS;IAClC+C,WAAW,EAAExD,UAAW;IACxBiD,mBAAmB,EAAE9C,kBAAmB;IACxCsD,uBAAuB,EAAEpD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEqD,sBAAuB;IACxDC,yBAAyB,EAAEtD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuD,wBAAyB;IAC5DC,aAAa,EAAEzD,YAAa;IAC5B0D,YAAY,EAAEzD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAE0D;EAAY,CACrC,CACqB,CAAC,eAC3B7F,MAAA,CAAAkB,OAAA,CAAAoD,aAAA,CAAC/D,SAAA,CAAAuF,mBAAmB;IAChBrB,SAAS,EAAE1C,cAAe;IAC1BuD,WAAW,EAAExD,UAAW;IACxBiE,yBAAyB,EAAE1D,wBAAyB;IACpD0C,mBAAmB,EAAE9C,kBAAmB;IACxCmD,OAAO,EAAE/C,wBAAwB,GAAGiB,IAAI,GAAGV;EAAU,GAEpDhB,QACgB,CACT,CAAC;AAEzB,CAAC;AAEDD,QAAQ,CAACqE,WAAW,GAAG,UAAU;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhF,OAAA,GAEnBS,QAAQ","ignoreList":[]}
@@ -5,7 +5,6 @@ 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");
9
8
  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
9
  const StyledCheckbox = exports.StyledCheckbox = _styledComponents.default.div`
11
10
  align-items: center;
@@ -28,15 +27,6 @@ const StyledCheckboxInput = exports.StyledCheckboxInput = _styledComponents.defa
28
27
  top: 0;
29
28
  white-space: nowrap;
30
29
  width: 1px;
31
-
32
- ${({
33
- $shouldShowKeyboardHighlighting
34
- }) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
35
- &:focus-visible + div > label {
36
- transition: none;
37
- ${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
38
- }
39
- `}
40
30
  `;
41
31
  const StyledCheckboxBoxWrapper = exports.StyledCheckboxBoxWrapper = _styledComponents.default.div`
42
32
  display: flex;
@@ -1 +1 @@
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 }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n user-select: none;\n ${({ $shouldShowAsSwitch }) =>\n $shouldShowAsSwitch\n ? css`\n padding-right: 48px;\n `\n : css`\n padding-left: 20px;\n `}\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,0BAAA,GAAAD,OAAA;AAAgG,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL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AG;AACjB;AACA,eAAe;AACf,CAAC","ignoreList":[]}
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","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 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 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\ntype StyledCheckboxBoxWrapperProps = WithTheme<{\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n}>;\n\nexport const StyledCheckboxBoxWrapper = styled.div<StyledCheckboxBoxWrapperProps>`\n display: flex;\n flex-shrink: 0;\n height: 16px;\n position: absolute;\n\n ${({ $shouldShowAsSwitch }) =>\n $shouldShowAsSwitch &&\n css`\n right: 42px;\n `}\n`;\n\ntype StyledCheckboxBoxProps = WithTheme<{\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n $isDisabled?: CheckboxProps['isDisabled'];\n $isChecked?: CheckboxProps['isChecked'];\n $checkedBackgroundColor?: CSSProperties['backgroundColor'];\n $uncheckedBackgroundColor?: CSSProperties['backgroundColor'];\n $borderRadius?: CSSProperties['borderRadius'];\n $borderColor?: CSSProperties['borderColor'];\n}>;\n\nexport const StyledCheckboxBox = styled.label<StyledCheckboxBoxProps>`\n color: ${({ theme }: StyledCheckboxBoxProps) => theme.text};\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n position: relative;\n display: inline-block;\n width: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '44px' : '16px')};\n transition: opacity 0.2s ease;\n user-select: none;\n height: 16px;\n\n &:after {\n ${({ $isChecked, $shouldShowAsSwitch }: StyledCheckboxBoxProps) =>\n $shouldShowAsSwitch\n ? css`\n background-color: white;\n border-radius: 50%;\n box-shadow: 0 1px 4px rgb(0 0 0 / 35%);\n height: 16px;\n left: 7px;\n top: 50%;\n transform: translateX(${$isChecked ? '18px' : 0}) translateY(-50%);\n transition: transform 0.2s ease;\n width: 16px;\n `\n : css`\n border-right: 2px solid #fff;\n border-bottom: 2px solid #fff;\n height: 10px;\n left: 2px;\n opacity: ${$isChecked ? 1 : 0};\n top: calc(50% - 2px);\n transform: rotateZ(37deg) translateY(-50%);\n transition: opacity 0.2s ease;\n width: 5px;\n `}\n\n content: ' ';\n position: absolute;\n }\n\n &:before {\n background-color: ${({\n $isChecked,\n $shouldShowAsSwitch,\n $checkedBackgroundColor,\n $uncheckedBackgroundColor,\n theme,\n }: StyledCheckboxBoxProps) => {\n const activeBackgroundColor =\n $checkedBackgroundColor ?? ($shouldShowAsSwitch ? theme.green : theme['408']);\n const inactiveBackgroundColor =\n $uncheckedBackgroundColor ?? ($shouldShowAsSwitch ? theme.red : theme['403']);\n\n if ($shouldShowAsSwitch) {\n return $isChecked ? activeBackgroundColor : inactiveBackgroundColor;\n }\n\n return $isChecked ? activeBackgroundColor : inactiveBackgroundColor;\n }};\n\n border: ${({ $borderColor, $shouldShowAsSwitch, theme }: StyledCheckboxBoxProps) => {\n if ($shouldShowAsSwitch) {\n return 'none';\n }\n\n const fallbackBorderColor = theme['409-rgb']\n ? `rgba(${theme['409-rgb']}, 0.5)`\n : theme.text;\n\n return `1px solid ${$borderColor ?? fallbackBorderColor}`;\n }};\n\n border-radius: ${({ $shouldShowAsSwitch, $borderRadius }) =>\n $borderRadius ?? ($shouldShowAsSwitch ? '100px' : 0)};\n content: ' ';\n height: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '13px' : '15px')};\n left: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '10px' : 0)};\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n transition: background-color 0.2s ease;\n width: ${({ $shouldShowAsSwitch }) => ($shouldShowAsSwitch ? '28px' : '15px')};\n }\n}\n`;\n\ntype StyledCheckboxLabelProps = WithTheme<{\n $isDisabled?: CheckboxProps['isDisabled'];\n $shouldChangeOnLabelClick?: CheckboxProps['shouldChangeOnLabelClick'];\n $shouldShowAsSwitch?: CheckboxProps['shouldShowAsSwitch'];\n}>;\n\nexport const StyledCheckboxLabel = styled.label<StyledCheckboxLabelProps>`\n color: ${({ theme }: StyledCheckboxLabelProps) => theme.text};\n cursor: ${({ $shouldChangeOnLabelClick }) =>\n !$shouldChangeOnLabelClick ? 'default' : 'pointer'};\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n user-select: none;\n ${({ $shouldShowAsSwitch }) =>\n $shouldShowAsSwitch\n ? css`\n padding-right: 48px;\n `\n : css`\n padding-left: 20px;\n `}\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,C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
@@ -16,6 +16,7 @@ var _dropdown = require("../../types/dropdown");
16
16
  var _element = require("../../hooks/element");
17
17
  var _ComboBox2 = require("./ComboBox.types");
18
18
  var _ComboBox3 = require("./ComboBox.utils");
19
+ var _useFocusRingPortal = require("../../hooks/useFocusRingPortal");
19
20
  var _useKeyboardFocusHighlighting = require("../../hooks/useKeyboardFocusHighlighting");
20
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
22
  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); }
@@ -94,6 +95,12 @@ const ComboBox = /*#__PURE__*/(0, _react.forwardRef)(({
94
95
  }, [functions, internalSelectedItem, lists, parentSize, placeholder, prefix, prefixMinWidth, selectedItem, shouldDropDownUseMaxItemWidth, shouldShowBigImage, shouldShowClearIcon, shouldUseCurrentItemWidth, shouldUseFullWidth, values]);
95
96
  const shouldChangeColor = (0, _react.useMemo)(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]);
96
97
  const shouldShowKeyboardHighlighting = (0, _useKeyboardFocusHighlighting.useKeyboardFocusHighlighting)(shouldEnableKeyboardHighlighting && !isDisabled);
98
+ (0, _useFocusRingPortal.useFocusRingPortal)(comboBoxHeaderRef, {
99
+ isEnabled: shouldShowKeyboardHighlighting && typeof inputValue !== 'string'
100
+ });
101
+ (0, _useFocusRingPortal.useFocusRingPortal)(comboBoxInputRef, {
102
+ isEnabled: shouldShowKeyboardHighlighting && typeof inputValue === 'string'
103
+ });
97
104
  const shouldDisableActions = (0, _react.useMemo)(() => {
98
105
  if (!selectedItem) {
99
106
  return false;
@@ -357,7 +364,6 @@ const ComboBox = /*#__PURE__*/(0, _react.forwardRef)(({
357
364
  $isDisabled: isDisabled,
358
365
  $shouldChangeColor: shouldChangeColor,
359
366
  $shouldShowBigImage: shouldShowBigImage,
360
- $shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
361
367
  onKeyDown: handleHeaderKeyDown,
362
368
  tabIndex: !isDisabled && typeof inputValue !== 'string' ? 0 : undefined,
363
369
  role: !isDisabled && typeof inputValue !== 'string' ? 'button' : undefined,