@cruk/cruk-react-components 5.0.7 → 5.0.8

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 (351) hide show
  1. package/lib/.storybook/main.d.ts +3 -0
  2. package/lib/.storybook/preview.d.ts +3 -0
  3. package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  4. package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
  5. package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +1 -1
  6. package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +1 -1
  7. package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js +6 -1
  8. package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +1 -1
  9. package/lib/node_modules/focus-lock/dist/es2015/focusInside.js.map +1 -1
  10. package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +1 -1
  11. package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js +1 -1
  12. package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +1 -1
  13. package/lib/node_modules/focus-lock/dist/es2015/return-focus.js.map +1 -1
  14. package/lib/node_modules/focus-lock/dist/es2015/sibling.js +1 -1
  15. package/lib/node_modules/focus-lock/dist/es2015/sibling.js.map +1 -1
  16. package/lib/node_modules/focus-lock/dist/es2015/solver.js +1 -1
  17. package/lib/node_modules/focus-lock/dist/es2015/solver.js.map +1 -1
  18. package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +1 -1
  19. package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js +1 -1
  20. package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +1 -1
  21. package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +1 -1
  22. package/lib/node_modules/focus-lock/dist/es2015/utils/is.js.map +1 -1
  23. package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +1 -1
  24. package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +1 -1
  25. package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +1 -1
  26. package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js +1 -1
  27. package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js.map +1 -1
  28. package/lib/node_modules/react-focus-lock/dist/es2015/FocusGuard.js.map +1 -1
  29. package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js +1 -1
  30. package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -1
  31. package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js +1 -1
  32. package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -1
  33. package/lib/node_modules/react-intersection-observer/dist/index.js.map +1 -1
  34. package/lib/node_modules/tslib/tslib.es6.js +1 -1
  35. package/lib/node_modules/tslib/tslib.es6.js.map +1 -1
  36. package/lib/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -1
  37. package/lib/{components → src/components}/AddressLookup/AddressLookup.stories.d.ts +4 -4
  38. package/lib/{components → src/components}/AddressLookup/index.d.ts +1 -1
  39. package/lib/src/components/AddressLookup/index.js +1 -1
  40. package/lib/src/components/AddressLookup/index.js.map +1 -1
  41. package/lib/src/components/AddressLookup/styles.js +38 -1
  42. package/lib/src/components/AddressLookup/styles.js.map +1 -1
  43. package/lib/{components → src/components}/Avatar/Avatar.stories.d.ts +1 -1
  44. package/lib/src/components/Avatar/index.js +1 -1
  45. package/lib/src/components/Avatar/index.js.map +1 -1
  46. package/lib/src/components/Avatar/styles.js +10 -1
  47. package/lib/src/components/Avatar/styles.js.map +1 -1
  48. package/lib/{components → src/components}/Badge/Badge.stories.d.ts +1 -1
  49. package/lib/src/components/Badge/index.js +1 -1
  50. package/lib/src/components/Badge/index.js.map +1 -1
  51. package/lib/src/components/Badge/styles.js +17 -1
  52. package/lib/src/components/Badge/styles.js.map +1 -1
  53. package/lib/{components → src/components}/Box/Box.stories.d.ts +1 -1
  54. package/lib/src/components/Box/index.js +1 -1
  55. package/lib/src/components/Box/index.js.map +1 -1
  56. package/lib/src/components/Box/styles.js +13 -1
  57. package/lib/src/components/Box/styles.js.map +1 -1
  58. package/lib/{components → src/components}/Button/Button.stories.d.ts +1 -1
  59. package/lib/src/components/Button/index.js +1 -1
  60. package/lib/src/components/Button/index.js.map +1 -1
  61. package/lib/src/components/Button/styles.js +108 -1
  62. package/lib/src/components/Button/styles.js.map +1 -1
  63. package/lib/{components → src/components}/Carousel/Carousel.stories.d.ts +2 -2
  64. package/lib/src/components/Carousel/Dots.js +1 -1
  65. package/lib/src/components/Carousel/Dots.js.map +1 -1
  66. package/lib/src/components/Carousel/index.js +1 -1
  67. package/lib/src/components/Carousel/index.js.map +1 -1
  68. package/lib/src/components/Carousel/styles.js +96 -1
  69. package/lib/src/components/Carousel/styles.js.map +1 -1
  70. package/lib/{components → src/components}/Checkbox/Checkbox.stories.d.ts +2 -2
  71. package/lib/src/components/Checkbox/index.js +1 -1
  72. package/lib/src/components/Checkbox/index.js.map +1 -1
  73. package/lib/src/components/Checkbox/styles.js +105 -1
  74. package/lib/src/components/Checkbox/styles.js.map +1 -1
  75. package/lib/{components → src/components}/Collapse/Collapse.stories.d.ts +1 -1
  76. package/lib/src/components/Collapse/index.js +1 -1
  77. package/lib/src/components/Collapse/index.js.map +1 -1
  78. package/lib/src/components/Collapse/styles.js +31 -1
  79. package/lib/src/components/Collapse/styles.js.map +1 -1
  80. package/lib/{components → src/components}/DateField/DateField.stories.d.ts +1 -1
  81. package/lib/src/components/DateField/index.js +1 -1
  82. package/lib/src/components/DateField/index.js.map +1 -1
  83. package/lib/src/components/DateField/styles.js +26 -1
  84. package/lib/src/components/DateField/styles.js.map +1 -1
  85. package/lib/src/components/Divider.js +17 -1
  86. package/lib/src/components/Divider.js.map +1 -1
  87. package/lib/{components → src/components}/ErrorText/ErrorText.stories.d.ts +1 -1
  88. package/lib/src/components/ErrorText/index.js +1 -1
  89. package/lib/src/components/ErrorText/index.js.map +1 -1
  90. package/lib/src/components/ErrorText/styles.js +5 -1
  91. package/lib/src/components/ErrorText/styles.js.map +1 -1
  92. package/lib/src/components/Flex.js +7 -1
  93. package/lib/src/components/Flex.js.map +1 -1
  94. package/lib/src/components/Fontface.js +1 -1
  95. package/lib/src/components/Fontface.js.map +1 -1
  96. package/lib/{components → src/components}/Footer/Footer.stories.d.ts +2 -2
  97. package/lib/src/components/Footer/index.js +1 -1
  98. package/lib/src/components/Footer/index.js.map +1 -1
  99. package/lib/src/components/Footer/styles.js +69 -1
  100. package/lib/src/components/Footer/styles.js.map +1 -1
  101. package/lib/src/components/GlobalStyle.js +37 -1
  102. package/lib/src/components/GlobalStyle.js.map +1 -1
  103. package/lib/src/components/GlobalStyleNoFontFace.js +37 -1
  104. package/lib/src/components/GlobalStyleNoFontFace.js.map +1 -1
  105. package/lib/{components → src/components}/Header/Header.stories.d.ts +1 -1
  106. package/lib/src/components/Header/index.js +1 -1
  107. package/lib/src/components/Header/index.js.map +1 -1
  108. package/lib/src/components/Header/styles.js +109 -1
  109. package/lib/src/components/Header/styles.js.map +1 -1
  110. package/lib/{components → src/components}/Heading/Heading.stories.d.ts +1 -1
  111. package/lib/src/components/Heading/index.js +1 -1
  112. package/lib/src/components/Heading/index.js.map +1 -1
  113. package/lib/src/components/Heading/styles.js +75 -1
  114. package/lib/src/components/Heading/styles.js.map +1 -1
  115. package/lib/{components → src/components}/IconFa/IconFa.stories.d.ts +1 -1
  116. package/lib/src/components/IconFa/index.js +1 -1
  117. package/lib/src/components/IconFa/index.js.map +1 -1
  118. package/lib/src/components/IconFa/styles.js +10 -1
  119. package/lib/src/components/IconFa/styles.js.map +1 -1
  120. package/lib/{components → src/components}/InfoBox/InfoBox.stories.d.ts +1 -1
  121. package/lib/src/components/InfoBox/index.js +1 -1
  122. package/lib/src/components/InfoBox/index.js.map +1 -1
  123. package/lib/src/components/InfoBox/styles.js +12 -1
  124. package/lib/src/components/InfoBox/styles.js.map +1 -1
  125. package/lib/src/components/LabelWrapper/index.js +1 -1
  126. package/lib/src/components/LabelWrapper/index.js.map +1 -1
  127. package/lib/src/components/LabelWrapper/styles.js +15 -1
  128. package/lib/src/components/LabelWrapper/styles.js.map +1 -1
  129. package/lib/{components → src/components}/LegendWrapper/LegendWrapper.stories.d.ts +1 -1
  130. package/lib/src/components/LegendWrapper/index.js +1 -1
  131. package/lib/src/components/LegendWrapper/index.js.map +1 -1
  132. package/lib/src/components/LegendWrapper/styles.js +34 -1
  133. package/lib/src/components/LegendWrapper/styles.js.map +1 -1
  134. package/lib/{components → src/components}/Link/Link.stories.d.ts +1 -1
  135. package/lib/src/components/Link/index.js +1 -1
  136. package/lib/src/components/Link/index.js.map +1 -1
  137. package/lib/src/components/Link/styles.js +29 -1
  138. package/lib/src/components/Link/styles.js.map +1 -1
  139. package/lib/{components → src/components}/Loader/Loader.stories.d.ts +1 -1
  140. package/lib/src/components/Loader/index.js +1 -1
  141. package/lib/src/components/Loader/index.js.map +1 -1
  142. package/lib/src/components/Loader/styles.js +45 -1
  143. package/lib/src/components/Loader/styles.js.map +1 -1
  144. package/lib/{components → src/components}/Modal/Modal.stories.d.ts +1 -1
  145. package/lib/src/components/Modal/index.js +1 -1
  146. package/lib/src/components/Modal/index.js.map +1 -1
  147. package/lib/src/components/Modal/styles.js +59 -1
  148. package/lib/src/components/Modal/styles.js.map +1 -1
  149. package/lib/{components → src/components}/Pagination/Pagination.stories.d.ts +1 -1
  150. package/lib/src/components/Pagination/index.js +1 -1
  151. package/lib/src/components/Pagination/index.js.map +1 -1
  152. package/lib/src/components/Pagination/styles.js +92 -1
  153. package/lib/src/components/Pagination/styles.js.map +1 -1
  154. package/lib/{components → src/components}/PopOver/Popover.stories.d.ts +1 -1
  155. package/lib/src/components/PopOver/index.js +1 -1
  156. package/lib/src/components/PopOver/index.js.map +1 -1
  157. package/lib/src/components/PopOver/styles.js +81 -1
  158. package/lib/src/components/PopOver/styles.js.map +1 -1
  159. package/lib/{components → src/components}/ProgressBar/ProgressBar.stories.d.ts +1 -1
  160. package/lib/src/components/ProgressBar/index.js +1 -1
  161. package/lib/src/components/ProgressBar/index.js.map +1 -1
  162. package/lib/src/components/ProgressBar/styles.js +132 -1
  163. package/lib/src/components/ProgressBar/styles.js.map +1 -1
  164. package/lib/{components → src/components}/Radio/Radio.stories.d.ts +2 -2
  165. package/lib/src/components/Radio/index.js +1 -1
  166. package/lib/src/components/Radio/index.js.map +1 -1
  167. package/lib/src/components/Radio/styles.js +125 -1
  168. package/lib/src/components/Radio/styles.js.map +1 -1
  169. package/lib/{components → src/components}/RadioConsent/Radio.stories.d.ts +1 -1
  170. package/lib/src/components/RadioConsent/index.js +1 -1
  171. package/lib/src/components/RadioConsent/index.js.map +1 -1
  172. package/lib/src/components/RadioConsent/styles.js +26 -1
  173. package/lib/src/components/RadioConsent/styles.js.map +1 -1
  174. package/lib/{components → src/components}/Select/Selelct.stories.d.ts +2 -2
  175. package/lib/src/components/Select/index.js +1 -1
  176. package/lib/src/components/Select/index.js.map +1 -1
  177. package/lib/src/components/Select/styles.js +41 -1
  178. package/lib/src/components/Select/styles.js.map +1 -1
  179. package/lib/src/components/Spacing/index.js +1 -1
  180. package/lib/src/components/Spacing/index.js.map +1 -1
  181. package/lib/{components → src/components}/Step/Step.stories.d.ts +1 -1
  182. package/lib/src/components/Step/index.js +1 -1
  183. package/lib/src/components/Step/index.js.map +1 -1
  184. package/lib/src/components/Step/styles.js +79 -1
  185. package/lib/src/components/Step/styles.js.map +1 -1
  186. package/lib/{components → src/components}/Text/Text.stories.d.ts +1 -1
  187. package/lib/src/components/Text/index.js +1 -1
  188. package/lib/src/components/Text/index.js.map +1 -1
  189. package/lib/src/components/Text/styles.js +19 -1
  190. package/lib/src/components/Text/styles.js.map +1 -1
  191. package/lib/{components → src/components}/TextAreaField/TextAreaField.stories.d.ts +1 -1
  192. package/lib/src/components/TextAreaField/index.js +1 -1
  193. package/lib/src/components/TextAreaField/index.js.map +1 -1
  194. package/lib/src/components/TextAreaField/styles.js +29 -1
  195. package/lib/src/components/TextAreaField/styles.js.map +1 -1
  196. package/lib/{components → src/components}/TextField/TextField.stories.d.ts +1 -1
  197. package/lib/src/components/TextField/index.js +1 -1
  198. package/lib/src/components/TextField/index.js.map +1 -1
  199. package/lib/src/components/TextField/styles.js +110 -1
  200. package/lib/src/components/TextField/styles.js.map +1 -1
  201. package/lib/{components → src/components}/Totaliser/Totaliser.stories.d.ts +1 -1
  202. package/lib/src/components/Totaliser/index.js +1 -1
  203. package/lib/src/components/Totaliser/index.js.map +1 -1
  204. package/lib/src/components/Totaliser/styles.js +59 -1
  205. package/lib/src/components/Totaliser/styles.js.map +1 -1
  206. package/lib/{components → src/components}/UserBlock/UserBlock.stories.d.ts +1 -1
  207. package/lib/src/components/UserBlock/index.js +1 -1
  208. package/lib/src/components/UserBlock/index.js.map +1 -1
  209. package/lib/src/components/UserBlock/styles.js +21 -1
  210. package/lib/src/components/UserBlock/styles.js.map +1 -1
  211. package/lib/{hooks → src/hooks}/useEffectBrowser.d.ts +1 -1
  212. package/lib/src/hooks/useEffectBrowser.js +1 -1
  213. package/lib/src/hooks/useEffectBrowser.js.map +1 -1
  214. package/lib/src/hooks/useKey.js +1 -1
  215. package/lib/src/hooks/useKey.js.map +1 -1
  216. package/lib/{hooks → src/hooks}/useLayoutEffectBrowser.d.ts +1 -1
  217. package/lib/src/hooks/useLayoutEffectBrowser.js +1 -1
  218. package/lib/src/hooks/useLayoutEffectBrowser.js.map +1 -1
  219. package/lib/src/hooks/useScrollPosition.js +1 -1
  220. package/lib/src/hooks/useScrollPosition.js.map +1 -1
  221. package/lib/src/themes/bowelbabe.js +1 -1
  222. package/lib/src/themes/bowelbabe.js.map +1 -1
  223. package/lib/src/themes/cruk.js +1 -1
  224. package/lib/src/themes/cruk.js.map +1 -1
  225. package/lib/src/themes/rfl.js +1 -1
  226. package/lib/src/themes/rfl.js.map +1 -1
  227. package/lib/src/themes/su2c.js +1 -1
  228. package/lib/src/themes/su2c.js.map +1 -1
  229. package/lib/{types.d.ts → src/types.d.ts} +1 -3
  230. package/lib/src/utils/Helper.js +1 -1
  231. package/lib/src/utils/Helper.js.map +1 -1
  232. package/lib/src/utils/debounce.d.ts +2 -0
  233. package/lib/src/utils/debounce.js +1 -1
  234. package/lib/src/utils/debounce.js.map +1 -1
  235. package/lib/src/utils/themeUtils.js +1 -1
  236. package/lib/src/utils/themeUtils.js.map +1 -1
  237. package/package.json +23 -30
  238. package/lib/utils/debounce.d.ts +0 -2
  239. /package/lib/{components → src/components}/AddressLookup/AddressLookUp.test.cypress.d.ts +0 -0
  240. /package/lib/{components → src/components}/AddressLookup/styles.d.ts +0 -0
  241. /package/lib/{components → src/components}/AllThemesWrapper.d.ts +0 -0
  242. /package/lib/{components → src/components}/Avatar/Avatar.test.cypress.d.ts +0 -0
  243. /package/lib/{components → src/components}/Avatar/index.d.ts +0 -0
  244. /package/lib/{components → src/components}/Avatar/styles.d.ts +0 -0
  245. /package/lib/{components → src/components}/Badge/Badge.test.cypress.d.ts +0 -0
  246. /package/lib/{components → src/components}/Badge/index.d.ts +0 -0
  247. /package/lib/{components → src/components}/Badge/styles.d.ts +0 -0
  248. /package/lib/{components → src/components}/Box/Box.test.cypress.d.ts +0 -0
  249. /package/lib/{components → src/components}/Box/index.d.ts +0 -0
  250. /package/lib/{components → src/components}/Box/styles.d.ts +0 -0
  251. /package/lib/{components → src/components}/Button/Button.test.cypress.d.ts +0 -0
  252. /package/lib/{components → src/components}/Button/index.d.ts +0 -0
  253. /package/lib/{components → src/components}/Button/styles.d.ts +0 -0
  254. /package/lib/{components → src/components}/Carousel/Carousel.test.cypress.d.ts +0 -0
  255. /package/lib/{components → src/components}/Carousel/Dots.d.ts +0 -0
  256. /package/lib/{components → src/components}/Carousel/index.d.ts +0 -0
  257. /package/lib/{components → src/components}/Carousel/styles.d.ts +0 -0
  258. /package/lib/{components → src/components}/Checkbox/CheckBox.test.cypress.d.ts +0 -0
  259. /package/lib/{components → src/components}/Checkbox/index.d.ts +0 -0
  260. /package/lib/{components → src/components}/Checkbox/styles.d.ts +0 -0
  261. /package/lib/{components → src/components}/Collapse/Collapse.test.cypress.d.ts +0 -0
  262. /package/lib/{components → src/components}/Collapse/index.d.ts +0 -0
  263. /package/lib/{components → src/components}/Collapse/styles.d.ts +0 -0
  264. /package/lib/{components → src/components}/DateField/DateField.test.cypress.d.ts +0 -0
  265. /package/lib/{components → src/components}/DateField/index.d.ts +0 -0
  266. /package/lib/{components → src/components}/DateField/styles.d.ts +0 -0
  267. /package/lib/{components → src/components}/Divider.d.ts +0 -0
  268. /package/lib/{components → src/components}/ErrorText/ErrorText.test.cypress.d.ts +0 -0
  269. /package/lib/{components → src/components}/ErrorText/index.d.ts +0 -0
  270. /package/lib/{components → src/components}/ErrorText/styles.d.ts +0 -0
  271. /package/lib/{components → src/components}/Flex.d.ts +0 -0
  272. /package/lib/{components → src/components}/Fontface.d.ts +0 -0
  273. /package/lib/{components → src/components}/Footer/Footer.test.cypress.d.ts +0 -0
  274. /package/lib/{components → src/components}/Footer/index.d.ts +0 -0
  275. /package/lib/{components → src/components}/Footer/styles.d.ts +0 -0
  276. /package/lib/{components → src/components}/GlobalStyle.d.ts +0 -0
  277. /package/lib/{components → src/components}/GlobalStyleNoFontFace.d.ts +0 -0
  278. /package/lib/{components → src/components}/Header/Header.test.cypress.d.ts +0 -0
  279. /package/lib/{components → src/components}/Header/index.d.ts +0 -0
  280. /package/lib/{components → src/components}/Header/styles.d.ts +0 -0
  281. /package/lib/{components → src/components}/Heading/Heading.test.cypress.d.ts +0 -0
  282. /package/lib/{components → src/components}/Heading/index.d.ts +0 -0
  283. /package/lib/{components → src/components}/Heading/styles.d.ts +0 -0
  284. /package/lib/{components → src/components}/IconFa/IconFa.test.cypress.d.ts +0 -0
  285. /package/lib/{components → src/components}/IconFa/index.d.ts +0 -0
  286. /package/lib/{components → src/components}/IconFa/styles.d.ts +0 -0
  287. /package/lib/{components → src/components}/InfoBox/InfoBox.test.cypress.d.ts +0 -0
  288. /package/lib/{components → src/components}/InfoBox/index.d.ts +0 -0
  289. /package/lib/{components → src/components}/InfoBox/styles.d.ts +0 -0
  290. /package/lib/{components → src/components}/LabelWrapper/index.d.ts +0 -0
  291. /package/lib/{components → src/components}/LabelWrapper/styles.d.ts +0 -0
  292. /package/lib/{components → src/components}/LegendWrapper/LegendWrapper.test.cypress.d.ts +0 -0
  293. /package/lib/{components → src/components}/LegendWrapper/index.d.ts +0 -0
  294. /package/lib/{components → src/components}/LegendWrapper/styles.d.ts +0 -0
  295. /package/lib/{components → src/components}/Link/Link.test.cypress.d.ts +0 -0
  296. /package/lib/{components → src/components}/Link/index.d.ts +0 -0
  297. /package/lib/{components → src/components}/Link/styles.d.ts +0 -0
  298. /package/lib/{components → src/components}/Loader/Loader.test.cypress.d.ts +0 -0
  299. /package/lib/{components → src/components}/Loader/index.d.ts +0 -0
  300. /package/lib/{components → src/components}/Loader/styles.d.ts +0 -0
  301. /package/lib/{components → src/components}/Modal/Modal.test.cypress.d.ts +0 -0
  302. /package/lib/{components → src/components}/Modal/index.d.ts +0 -0
  303. /package/lib/{components → src/components}/Modal/styles.d.ts +0 -0
  304. /package/lib/{components → src/components}/Pagination/Pagination.test.cypress.d.ts +0 -0
  305. /package/lib/{components → src/components}/Pagination/index.d.ts +0 -0
  306. /package/lib/{components → src/components}/Pagination/styles.d.ts +0 -0
  307. /package/lib/{components → src/components}/PopOver/PopOver.test.cypress.d.ts +0 -0
  308. /package/lib/{components → src/components}/PopOver/index.d.ts +0 -0
  309. /package/lib/{components → src/components}/PopOver/styles.d.ts +0 -0
  310. /package/lib/{components → src/components}/ProgressBar/ProgressBar.test.cypress.d.ts +0 -0
  311. /package/lib/{components → src/components}/ProgressBar/index.d.ts +0 -0
  312. /package/lib/{components → src/components}/ProgressBar/styles.d.ts +0 -0
  313. /package/lib/{components → src/components}/Radio/Radio.test.cypress.d.ts +0 -0
  314. /package/lib/{components → src/components}/Radio/index.d.ts +0 -0
  315. /package/lib/{components → src/components}/Radio/styles.d.ts +0 -0
  316. /package/lib/{components → src/components}/RadioConsent/RadioConsent.test.cypress.d.ts +0 -0
  317. /package/lib/{components → src/components}/RadioConsent/index.d.ts +0 -0
  318. /package/lib/{components → src/components}/RadioConsent/styles.d.ts +0 -0
  319. /package/lib/{components → src/components}/Select/Select.test.cypress.d.ts +0 -0
  320. /package/lib/{components → src/components}/Select/index.d.ts +0 -0
  321. /package/lib/{components → src/components}/Select/styles.d.ts +0 -0
  322. /package/lib/{components → src/components}/Spacing/index.d.ts +0 -0
  323. /package/lib/{components → src/components}/Step/Step.test.cypress.d.ts +0 -0
  324. /package/lib/{components → src/components}/Step/index.d.ts +0 -0
  325. /package/lib/{components → src/components}/Step/styles.d.ts +0 -0
  326. /package/lib/{components → src/components}/Text/Text.test.cypress.d.ts +0 -0
  327. /package/lib/{components → src/components}/Text/index.d.ts +0 -0
  328. /package/lib/{components → src/components}/Text/styles.d.ts +0 -0
  329. /package/lib/{components → src/components}/TextAreaField/TextAreaField.test.cypress.d.ts +0 -0
  330. /package/lib/{components → src/components}/TextAreaField/index.d.ts +0 -0
  331. /package/lib/{components → src/components}/TextAreaField/styles.d.ts +0 -0
  332. /package/lib/{components → src/components}/TextField/TextField.test.cypress.d.ts +0 -0
  333. /package/lib/{components → src/components}/TextField/index.d.ts +0 -0
  334. /package/lib/{components → src/components}/TextField/styles.d.ts +0 -0
  335. /package/lib/{components → src/components}/ThemeCheatSheet.d.ts +0 -0
  336. /package/lib/{components → src/components}/Totaliser/Totaliser.test.cypress.d.ts +0 -0
  337. /package/lib/{components → src/components}/Totaliser/index.d.ts +0 -0
  338. /package/lib/{components → src/components}/Totaliser/styles.d.ts +0 -0
  339. /package/lib/{components → src/components}/UserBlock/UserBlock.test.cypress.d.ts +0 -0
  340. /package/lib/{components → src/components}/UserBlock/index.d.ts +0 -0
  341. /package/lib/{components → src/components}/UserBlock/styles.d.ts +0 -0
  342. /package/lib/{components → src/components}/index.d.ts +0 -0
  343. /package/lib/{hooks → src/hooks}/useKey.d.ts +0 -0
  344. /package/lib/{hooks → src/hooks}/useScrollPosition.d.ts +0 -0
  345. /package/lib/{themes → src/themes}/bowelbabe.d.ts +0 -0
  346. /package/lib/{themes → src/themes}/cruk.d.ts +0 -0
  347. /package/lib/{themes → src/themes}/rfl.d.ts +0 -0
  348. /package/lib/{themes → src/themes}/su2c.d.ts +0 -0
  349. /package/lib/{utils → src/utils}/Helper.d.ts +0 -0
  350. /package/lib/{utils → src/utils}/__tests__/testHelpers.test.d.ts +0 -0
  351. /package/lib/{utils → src/utils}/themeUtils.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Badge/index.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { type SpaceType } from \"../../types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledBadge } from \"./styles\";\nimport { themeColorOrString } from \"../../utils/themeUtils\";\n\nexport type BadgeProps = {\n /** background colour of badge */\n backgroundColor?: string;\n /** border colour of badge */\n borderColor?: string;\n /** text colour of badge */\n textColor?: string;\n /** size of badge */\n size?: SpaceType;\n /** contents of badge */\n children?: ReactNode;\n /** forces shape to have equal width and height set by size attribute */\n isSquare?: boolean;\n};\n\n/**\n * Displays a numeric or icon indicator. You can use the icon prop to\nindicate the importance of the badge to the user.\n\nNote that depending on how they are used, badges may be confusing for users\nof screen readers and similar assistive technologies. While the styling of\nbadges provides a visual cue as to their purpose, these users will simply\nbe presented with the content of the badge. Depending on the specific\nsituation, these badges may seem like random additional words or numbers\nat the end of a sentence, link, or button. Unless the context is clear,\nconsider including additional context with a visually hidden piece of\nadditional text.\n */\nexport function Badge({\n children,\n size = \"xs\",\n backgroundColor = \"primary\",\n borderColor = \"transparent\",\n textColor = \"textOnPrimary\",\n isSquare,\n}: BadgeProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const isSquareCalculated = isSquare ?? !(typeof children === \"string\");\n\n return (\n <StyledBadge\n theme={theme}\n $isSquare={isSquareCalculated}\n $size={size}\n $backgroundColor={themeColorOrString(backgroundColor, theme)}\n $borderColor={themeColorOrString(borderColor, theme)}\n $textColor={themeColorOrString(textColor, theme)}\n >\n {children}\n </StyledBadge>\n );\n}\n\nexport default Badge;\n"],"names":["Badge","_a","children","_b","size","_c","backgroundColor","_d","borderColor","_e","textColor","isSquare","foundTheme","useTheme","theme","__assign","defaultTheme","isSquareCalculated","React","createElement","StyledBadge","$isSquare","$size","$backgroundColor","themeColorOrString","$borderColor"],"mappings":"gSAqCM,SAAUA,EAAMC,GACpB,IAAAC,EAAQD,EAAAC,SACRC,EAAWF,EAAAG,KAAXA,OAAI,IAAAD,EAAG,KAAIA,EACXE,EAAAJ,EAAAK,gBAAAA,aAAkB,UAASD,EAC3BE,EAAAN,EAAAO,YAAAA,OAAc,IAAAD,EAAA,gBACdE,EAAAR,EAAAS,UAAAA,OAAY,IAAAD,EAAA,gBAAeA,EAC3BE,EAAQV,EAAAU,SAEFC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGCK,EAAqBN,QAAAA,IAAkC,iBAAbT,GAEhD,OACEgB,EAACC,cAAAC,EACC,CAAAN,MAAOA,EAAKO,UACDJ,EAAkBK,MACtBlB,EACWmB,iBAAAC,EAAmBlB,EAAiBQ,GACxCW,aAAAD,EAAmBhB,EAAaM,cAClCU,EAAmBd,EAAWI,IAEzCZ,EAGP"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Badge/index.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { type SpaceType } from \"../../types\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledBadge } from \"./styles\";\nimport { themeColorOrString } from \"../../utils/themeUtils\";\n\nexport type BadgeProps = {\n /** background colour of badge */\n backgroundColor?: string;\n /** border colour of badge */\n borderColor?: string;\n /** text colour of badge */\n textColor?: string;\n /** size of badge */\n size?: SpaceType;\n /** contents of badge */\n children?: ReactNode;\n /** forces shape to have equal width and height set by size attribute */\n isSquare?: boolean;\n};\n\n/**\n * Displays a numeric or icon indicator. You can use the icon prop to\nindicate the importance of the badge to the user.\n\nNote that depending on how they are used, badges may be confusing for users\nof screen readers and similar assistive technologies. While the styling of\nbadges provides a visual cue as to their purpose, these users will simply\nbe presented with the content of the badge. Depending on the specific\nsituation, these badges may seem like random additional words or numbers\nat the end of a sentence, link, or button. Unless the context is clear,\nconsider including additional context with a visually hidden piece of\nadditional text.\n */\nexport function Badge({\n children,\n size = \"xs\",\n backgroundColor = \"primary\",\n borderColor = \"transparent\",\n textColor = \"textOnPrimary\",\n isSquare,\n}: BadgeProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const isSquareCalculated = isSquare ?? !(typeof children === \"string\");\n\n return (\n <StyledBadge\n theme={theme}\n $isSquare={isSquareCalculated}\n $size={size}\n $backgroundColor={themeColorOrString(backgroundColor, theme)}\n $borderColor={themeColorOrString(borderColor, theme)}\n $textColor={themeColorOrString(textColor, theme)}\n >\n {children}\n </StyledBadge>\n );\n}\n\nexport default Badge;\n"],"names":["Badge","children","size","backgroundColor","borderColor","textColor","isSquare","foundTheme","useTheme","theme","defaultTheme","isSquareCalculated","React","createElement","StyledBadge","$isSquare","$size","$backgroundColor","themeColorOrString","$borderColor"],"mappings":"4NAqCM,SAAUA,GAAMC,SACpBA,EAAQC,KACRA,EAAO,KAAIC,gBACXA,EAAkB,UAASC,YAC3BA,EAAc,cAAaC,UAC3BA,EAAY,gBAAeC,SAC3BA,IAEA,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EAAqBL,KAAkC,iBAAbL,GAEhD,OACEW,EAACC,cAAAC,EACC,CAAAL,MAAOA,EAAKM,UACDJ,EAAkBK,MACtBd,EACWe,iBAAAC,EAAmBf,EAAiBM,GACxCU,aAAAD,EAAmBd,EAAaK,cAClCS,EAAmBb,EAAWI,IAEzCR,EAGP"}
@@ -1,2 +1,18 @@
1
- import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import r from"styled-components";var e,t=r.span(e||(e=n(["\n display: inline-block;\n border-width: 1px;\n border-style: solid;\n text-align: center;\n font-size: ",";\n padding: ",";\n border-radius: ",";\n height: ",";\n width: ",";\n line-height: ",";\n min-width: ",";\n\n background-color: ",";\n border-color: ",";\n color: ",";\n"],["\n display: inline-block;\n border-width: 1px;\n border-style: solid;\n text-align: center;\n font-size: ",";\n padding: ",";\n border-radius: ",";\n height: ",";\n width: ",";\n line-height: ",";\n min-width: ",";\n\n background-color: ",";\n border-color: ",";\n color: ",";\n"])),(function(n){return n.theme.fontSizes.m}),(function(n){var r=n.theme;return n.$isSquare?0:r.spacing.xxs}),(function(n){return n.$isSquare?"50%":" 1.5rem"}),(function(n){var r=n.$isSquare,e=n.$size,t=n.theme;return r?"calc(".concat(t.spacing[e]," + ").concat(t.spacing.xs,")"):"auto"}),(function(n){var r=n.$isSquare,e=n.$size,t=n.theme;return r?"calc(".concat(t.spacing[e]," + ").concat(t.spacing.xs,")"):"auto"}),(function(n){var r=n.$isSquare,e=n.$size,t=n.theme;return r?"calc(".concat(t.spacing[e]," + ").concat(t.spacing.xs,")"):" 1rem"}),(function(n){var r=n.$size,e=n.theme;return"calc(".concat(e.spacing[r]," + ").concat(e.spacing.xs,")")}),(function(n){return n.$backgroundColor}),(function(n){return n.$borderColor}),(function(n){return n.$textColor}));export{t as StyledBadge,t as default};
1
+ import e from"styled-components";const i=e.span`
2
+ display: inline-block;
3
+ border-width: 1px;
4
+ border-style: solid;
5
+ text-align: center;
6
+ font-size: ${({theme:e})=>e.fontSizes.m};
7
+ padding: ${({theme:e,$isSquare:i})=>i?0:e.spacing.xxs};
8
+ border-radius: ${({$isSquare:e})=>e?"50%":" 1.5rem"};
9
+ height: ${({$isSquare:e,$size:i,theme:s})=>e?`calc(${s.spacing[i]} + ${s.spacing.xs})`:"auto"};
10
+ width: ${({$isSquare:e,$size:i,theme:s})=>e?`calc(${s.spacing[i]} + ${s.spacing.xs})`:"auto"};
11
+ line-height: ${({$isSquare:e,$size:i,theme:s})=>e?`calc(${s.spacing[i]} + ${s.spacing.xs})`:" 1rem"};
12
+ min-width: ${({$size:e,theme:i})=>`calc(${i.spacing[e]} + ${i.spacing.xs})`};
13
+
14
+ background-color: ${({$backgroundColor:e})=>e};
15
+ border-color: ${({$borderColor:e})=>e};
16
+ color: ${({$textColor:e})=>e};
17
+ `;export{i as StyledBadge,i as default};
2
18
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/Badge/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type SpaceType, type ThemeType } from \"../../types\";\n\nexport const StyledBadge = styled.span<{\n $backgroundColor: string;\n $borderColor: string;\n $textColor: string;\n $isSquare: boolean;\n $size: SpaceType;\n theme: ThemeType;\n}>`\n display: inline-block;\n border-width: 1px;\n border-style: solid;\n text-align: center;\n font-size: ${({ theme }) => theme.fontSizes.m};\n padding: ${({ theme, $isSquare }) => ($isSquare ? 0 : theme.spacing.xxs)};\n border-radius: ${({ $isSquare }) => ($isSquare ? \"50%\" : ` 1.5rem`)};\n height: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n width: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n line-height: ${({ $isSquare, $size, theme }) =>\n $isSquare\n ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`\n : ` 1rem`};\n min-width: ${({ $size, theme }) =>\n `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`};\n\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n border-color: ${({ $borderColor }) => $borderColor};\n color: ${({ $textColor }) => $textColor};\n`;\n\nexport default StyledBadge;\n"],"names":["StyledBadge","styled","span","templateObject_1","__makeTemplateObject","_a","theme","fontSizes","m","$isSquare","spacing","xxs","$size","concat","xs","$backgroundColor","$borderColor","$textColor"],"mappings":"iHAIO,MAAMA,EAAcC,EAAOC,KAAIC,IAAAA,EAAAC,EAAA,CAAA,iHAAA,iBAAA,uBAAA,gBAAA,eAAA,qBAAA,mBAAA,4BAAA,sBAAA,eAAA,OAAA,CAOpC,iHAK6C,iBAC2B,uBACL,gBAES,eAEA,qBAI/D,mBAE0C,4BAEO,sBACZ,eACX,UAhB1B,SAACC,GAAc,OAAPA,EAAAC,MAAaC,UAAUC,CAAhB,IACjB,SAACH,OAAEC,EAAKD,EAAAC,MAAkB,OAAPD,EAAAI,UAAoB,EAAIH,EAAMI,QAAQC,GAA/B,IACpB,SAACN,GAAkB,OAAPA,EAAAI,UAAoB,MAAQ,SAArB,IAC1B,SAACJ,GAAE,IAAAI,cAAWG,EAAKP,EAAAO,MAAEN,EAAKD,EAAAC,MAClC,OAAAG,EAAY,eAAQH,EAAMI,QAAQE,GAAY,OAAAC,OAAAP,EAAMI,QAAQI,GAAK,KAAG,MAApE,IACO,SAACT,GAAE,IAAAI,cAAWG,EAAKP,EAAAO,MAAEN,EAAKD,EAAAC,MACjC,OAAAG,EAAY,eAAQH,EAAMI,QAAQE,GAAY,OAAAC,OAAAP,EAAMI,QAAQI,GAAK,KAAG,MAApE,IACa,SAACT,GAAE,IAAAI,cAAWG,EAAKP,EAAAO,MAAEN,EAAKD,EAAAC,MACvC,OAAAG,EACI,QAAAI,OAAQP,EAAMI,QAAQE,GAAM,OAAAC,OAAMP,EAAMI,QAAQI,GAAK,KACrD,OAFJ,IAGW,SAACT,OAAEO,EAAKP,EAAAO,MAAEN,EAAKD,EAAAC,MAC1B,MAAA,QAAQO,OAAAP,EAAMI,QAAQE,GAAM,OAAAC,OAAMP,EAAMI,QAAQI,GAAK,IAArD,IAEkB,SAACT,GAAyB,OAAPA,EAAAU,gBAAO,IAC9B,SAACV,GAAqB,OAAPA,EAAAW,YAAO,IAC7B,SAACX,GAAmB,OAAPA,EAAAY,UAAO"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Badge/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type SpaceType, type ThemeType } from \"../../types\";\n\nexport const StyledBadge = styled.span<{\n $backgroundColor: string;\n $borderColor: string;\n $textColor: string;\n $isSquare: boolean;\n $size: SpaceType;\n theme: ThemeType;\n}>`\n display: inline-block;\n border-width: 1px;\n border-style: solid;\n text-align: center;\n font-size: ${({ theme }) => theme.fontSizes.m};\n padding: ${({ theme, $isSquare }) => ($isSquare ? 0 : theme.spacing.xxs)};\n border-radius: ${({ $isSquare }) => ($isSquare ? \"50%\" : ` 1.5rem`)};\n height: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n width: ${({ $isSquare, $size, theme }) =>\n $isSquare ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})` : `auto`};\n line-height: ${({ $isSquare, $size, theme }) =>\n $isSquare\n ? `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`\n : ` 1rem`};\n min-width: ${({ $size, theme }) =>\n `calc(${theme.spacing[$size]} + ${theme.spacing.xs})`};\n\n background-color: ${({ $backgroundColor }) => $backgroundColor};\n border-color: ${({ $borderColor }) => $borderColor};\n color: ${({ $textColor }) => $textColor};\n`;\n\nexport default StyledBadge;\n"],"names":["StyledBadge","styled","span","theme","fontSizes","m","$isSquare","spacing","xxs","$size","xs","$backgroundColor","$borderColor","$textColor"],"mappings":"iCAIa,MAAAA,EAAcC,EAAOC,IAOhC;;;;;eAKa,EAAGC,WAAYA,EAAMC,UAAUC;aACjC,EAAGF,QAAOG,eAAiBA,EAAY,EAAIH,EAAMI,QAAQC;mBACnD,EAAGF,eAAiBA,EAAY,MAAQ;YAC/C,EAAGA,YAAWG,QAAON,WAC7BG,EAAY,QAAQH,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG,MAAQ;WAC7D,EAAGJ,YAAWG,QAAON,WAC5BG,EAAY,QAAQH,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG,MAAQ;iBACvD,EAAGJ,YAAWG,QAAON,WAClCG,EACI,QAAQH,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG,MAChD;eACO,EAAGD,QAAON,WACrB,QAAQA,EAAMI,QAAQE,QAAYN,EAAMI,QAAQG;;sBAE9B,EAAGC,sBAAuBA;kBAC9B,EAAGC,kBAAmBA;WAC7B,EAAGC,gBAAiBA;"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { StoryObj } from "@storybook/react";
2
+ import { type StoryObj } from "@storybook/react";
3
3
  import Box from ".";
4
4
  declare const _default: {
5
5
  title: string;
@@ -1,2 +1,2 @@
1
- import{__rest as r,__assign as o}from"../../../node_modules/tslib/tslib.es6.js";import e,{forwardRef as t}from"react";import{useTheme as m}from"styled-components";import{crukTheme as n}from"../../themes/cruk.js";import{spacingPropsToSpacingPropsInternal as s}from"../Spacing/index.js";import{StyledBox as i}from"./styles.js";var l=t((function(t,l){var c=r(t,[]),a=c.children,d=c.backgroundColor,f=r(c,["children","backgroundColor"]),p=m(),u=o(o({},n),p),b=s(f);return e.createElement(i,o({theme:u,$backgroundColor:d},b,{ref:l}),a)}));export{l as Box,l as default};
1
+ import o,{forwardRef as r}from"react";import{useTheme as e}from"styled-components";import{crukTheme as t}from"../../themes/cruk.js";import{spacingPropsToSpacingPropsInternal as m}from"../Spacing/index.js";import{StyledBox as s}from"./styles.js";const n=r((({...r},n)=>{const{children:c,backgroundColor:a,...i}=r,p=e(),l={...t,...p},d=m(i);return o.createElement(s,{theme:l,$backgroundColor:a,...d,ref:n},c)}));n.displayName="Box";export{n as Box,n as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Box/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport {\n spacingPropsToSpacingPropsInternal,\n type SpacingProps,\n} from \"../Spacing\";\nimport { StyledBox } from \"./styles\";\n\nexport type BoxProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n /** background color of box, this will add default padding */\n backgroundColor?: string;\n ref?: Ref<HTMLDivElement>;\n children?: ReactNode;\n /** styled-component polymorphic feature so you take the styling of a box and cast the component to be a \"span\" for example */\n as?: ElementType;\n };\n\n/**\n * Box is used to wrap other components to add margin and padding.\n * The values will be in the t-shirt sizes specified in the theme sizes.\n * The more specific the the target the higher priority the css will have.\n * For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.\n */\nexport const Box = forwardRef(\n ({ ...props }: BoxProps, ref?: Ref<HTMLDivElement>) => {\n const { children, backgroundColor, ...rest } = props;\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const restWithInternalSpacingProps =\n spacingPropsToSpacingPropsInternal(rest);\n\n return (\n <StyledBox\n theme={theme}\n $backgroundColor={backgroundColor}\n {...restWithInternalSpacingProps}\n ref={ref}\n >\n {children}\n </StyledBox>\n );\n },\n);\n\nexport default Box;\n"],"names":["Box","forwardRef","_a","ref","props","__rest","children","backgroundColor","rest","foundTheme","useTheme","theme","__assign","defaultTheme","restWithInternalSpacingProps","spacingPropsToSpacingPropsInternal","React","createElement","StyledBox","$backgroundColor"],"mappings":"yUAiCaA,EAAMC,GACjB,SAACC,EAAwBC,OAAnBC,EAAKC,EAAAH,EAAV,IACSI,EAAuCF,EAA/BE,SAAEC,EAA6BH,EAAdG,gBAAKC,EAASH,EAAAD,EAAzC,CAAA,WAAA,oBACAK,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAECK,EACJC,EAAmCP,GAErC,OACEQ,EAACC,cAAAC,KACCP,MAAOA,EACWQ,iBAAAZ,GACdO,EAA4B,CAChCX,IAAKA,IAEJG,EAGP"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Box/index.tsx"],"sourcesContent":["import React, {\n type HTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport {\n spacingPropsToSpacingPropsInternal,\n type SpacingProps,\n} from \"../Spacing\";\nimport { StyledBox } from \"./styles\";\n\nexport type BoxProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n /** background color of box, this will add default padding */\n backgroundColor?: string;\n ref?: Ref<HTMLDivElement>;\n children?: ReactNode;\n /** styled-component polymorphic feature so you take the styling of a box and cast the component to be a \"span\" for example */\n as?: ElementType;\n };\n\n/**\n * Box is used to wrap other components to add margin and padding.\n * The values will be in the t-shirt sizes specified in the theme sizes.\n * The more specific the the target the higher priority the css will have.\n * For example `margin` will be overridden by the `marginVertical` or `marginHorizontal` props. `marginTop`, `marginBottom`, `marginLeft`, `marginRight` will override the the `marginVertical` and `marginHorizontal` props.\n */\nexport const Box = forwardRef(\n ({ ...props }: BoxProps, ref?: Ref<HTMLDivElement>) => {\n const { children, backgroundColor, ...rest } = props;\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const restWithInternalSpacingProps =\n spacingPropsToSpacingPropsInternal(rest);\n\n return (\n <StyledBox\n theme={theme}\n $backgroundColor={backgroundColor}\n {...restWithInternalSpacingProps}\n ref={ref}\n >\n {children}\n </StyledBox>\n );\n },\n);\n\nBox.displayName = \"Box\";\n\nexport default Box;\n"],"names":["Box","forwardRef","props","ref","children","backgroundColor","rest","foundTheme","useTheme","theme","defaultTheme","restWithInternalSpacingProps","spacingPropsToSpacingPropsInternal","React","createElement","StyledBox","$backgroundColor","displayName"],"mappings":"qPAiCO,MAAMA,EAAMC,GACjB,KAAMC,GAAmBC,KACvB,MAAMC,SAAEA,EAAQC,gBAAEA,KAAoBC,GAASJ,EACzCK,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAECI,EACJC,EAAmCN,GAErC,OACEO,EAACC,cAAAC,GACCN,MAAOA,EACWO,iBAAAX,KACdM,EACJR,IAAKA,GAEJC,EACS,IAKlBJ,EAAIiB,YAAc"}
@@ -1,2 +1,14 @@
1
- import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o from"styled-components";import{spacing as r}from"../Spacing/index.js";var t,a=o.div(t||(t=n(["\n background-color: ",";\n padding: ",";\n margin: 0 0 "," 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ",";\n\n ","\n"],["\n background-color: ",";\n padding: ",";\n margin: 0 0 "," 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ",";\n\n ","\n"])),(function(n){return n.theme.colors.backgroundLight}),(function(n){var o=n.theme;return n.$backgroundColor?o.spacing.s:0}),(function(n){return n.theme.spacing.m}),(function(n){var o=n.theme,r=n.$backgroundColor;return r&&void 0!==o.colors[r]?o.colors[r]:r||"transparent"}),(function(n){return r(n,n.theme)}));export{a as StyledBox,a as default};
1
+ import o from"styled-components";import{spacing as r}from"../Spacing/index.js";const t=o.div`
2
+ background-color: ${({theme:o})=>o.colors.backgroundLight};
3
+ padding: ${({theme:o,$backgroundColor:r})=>r?o.spacing.s:0};
4
+ margin: 0 0 ${({theme:o})=>o.spacing.m} 0;
5
+
6
+ &:last-child {
7
+ margin-bottom: 0;
8
+ }
9
+
10
+ background-color: ${({theme:o,$backgroundColor:r})=>r&&void 0!==o.colors[r]?o.colors[r]:r||"transparent"};
11
+
12
+ ${o=>r(o,o.theme)}
13
+ `;export{t as StyledBox,t as default};
2
14
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/Box/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\nimport { type ColorKeyType, type ThemeType } from \"../../types\";\n\ntype StyledBoxProps = SpacingPropsInternal & {\n $backgroundColor?: string;\n $css?: string;\n theme: ThemeType;\n};\n\nexport const StyledBox = styled.div<StyledBoxProps>`\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n padding: ${({ theme, $backgroundColor }) =>\n $backgroundColor ? theme.spacing.s : 0};\n margin: 0 0 ${({ theme }) => theme.spacing.m} 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ${({ theme, $backgroundColor }) =>\n $backgroundColor &&\n typeof theme.colors[$backgroundColor as ColorKeyType] !== \"undefined\"\n ? theme.colors[$backgroundColor as ColorKeyType]\n : $backgroundColor || \"transparent\"};\n\n ${(props) => spacing(props, props.theme as ThemeType)}\n`;\n\nexport default StyledBox;\n"],"names":["StyledBox","styled","div","_a","theme","colors","backgroundLight","$backgroundColor","spacing","s","m","props"],"mappings":"qKAWaA,EAAYC,EAAOC,0KAAmB,yBACc,iBAEvB,oBACI,8EAUL,UAEc,SAfjC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,OAAOC,eAAb,IACxB,SAACH,OAAEC,EAAKD,EAAAC,MACjB,OADmCD,EAAAI,iBAChBH,EAAMI,QAAQC,EAAI,CAArC,IACY,SAACN,GAAc,OAAPA,EAAAC,MAAaI,QAAQE,CAAd,IAMT,SAACP,OAAEC,EAAKD,EAAAC,MAAEG,EAAgBJ,EAAAI,iBAC5C,OAAAA,QAC0D,IAAnDH,EAAMC,OAAOE,GAChBH,EAAMC,OAAOE,GACbA,GAAoB,aAHxB,IAKA,SAACI,GAAU,OAAAH,EAAQG,EAAOA,EAAMP,MAAmB"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Box/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { spacing, type SpacingPropsInternal } from \"../Spacing\";\nimport { type ColorKeyType, type ThemeType } from \"../../types\";\n\ntype StyledBoxProps = SpacingPropsInternal & {\n $backgroundColor?: string;\n $css?: string;\n theme: ThemeType;\n};\n\nexport const StyledBox = styled.div<StyledBoxProps>`\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n padding: ${({ theme, $backgroundColor }) =>\n $backgroundColor ? theme.spacing.s : 0};\n margin: 0 0 ${({ theme }) => theme.spacing.m} 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ${({ theme, $backgroundColor }) =>\n $backgroundColor &&\n typeof theme.colors[$backgroundColor as ColorKeyType] !== \"undefined\"\n ? theme.colors[$backgroundColor as ColorKeyType]\n : $backgroundColor || \"transparent\"};\n\n ${(props) => spacing(props, props.theme as ThemeType)}\n`;\n\nexport default StyledBox;\n"],"names":["StyledBox","styled","div","theme","colors","backgroundLight","$backgroundColor","spacing","s","m","props"],"mappings":"+EAWa,MAAAA,EAAYC,EAAOC,GAAmB;sBAC7B,EAAGC,WAAYA,EAAMC,OAAOC;aACrC,EAAGF,QAAOG,sBACnBA,EAAmBH,EAAMI,QAAQC,EAAI;gBACzB,EAAGL,WAAYA,EAAMI,QAAQE;;;;;;sBAMvB,EAAGN,QAAOG,sBAC5BA,QAC0D,IAAnDH,EAAMC,OAAOE,GAChBH,EAAMC,OAAOE,GACbA,GAAoB;;IAEvBI,GAAUH,EAAQG,EAAOA,EAAMP;"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { StoryObj } from "@storybook/react";
2
+ import { type StoryObj } from "@storybook/react";
3
3
  import { Button } from "./";
4
4
  declare const _default: {
5
5
  title: string;
@@ -1,2 +1,2 @@
1
- import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o}from"react";import{useTheme as n}from"styled-components";import{crukTheme as i}from"../../themes/cruk.js";import{IconFa as l}from"../IconFa/index.js";import{StyledButton as a,Spacer as m}from"./styles.js";var s=o((function(o,s){var c=n(),p=e(e({},i),c),u=o.appearance,d=void 0===u?"primary":u,f=o.isIconButton,h=void 0!==f&&f,v=o.full,y=void 0!==v&&v,b=o.size,j=void 0===b?"m":b,I=o.children,$=r(o,["appearance","isIconButton","full","size","children"]),g=t.Children.toArray(I),z="string"==typeof g[0],B=g[0],k=!(!h&&(1===g.length&&!z&&(null==B?void 0:B.type))!==l);return t.createElement(a,e({as:o.href?"a":"button"},o.href?{role:"button"}:{},{$full:!!y,$size:j,$appearance:d,$isIconButton:k},$,{theme:p,ref:s}),o.children&&g.length?t.Children.map(o.children,(function(e,r){return t.createElement(m,{theme:p,key:r},e)})):null)}));export{s as Button,s as default};
1
+ import e,{forwardRef as t}from"react";import{useTheme as r}from"styled-components";import{crukTheme as n}from"../../themes/cruk.js";import{IconFa as o}from"../IconFa/index.js";import{StyledButton as l,Spacer as m}from"./styles.js";const a=t(((t,a)=>{const i=r(),s={...n,...i},{appearance:p="primary",isIconButton:c=!1,full:f=!1,size:h="m",children:u,...d}=t,y=e.Children.toArray(u),$="string"==typeof y[0],g=y[0],j=!(!c&&(1===y.length&&!$&&g?.type)!==o);return e.createElement(l,{as:t.href?"a":"button",...t.href?{role:"button"}:{},$full:!!f,$size:h,$appearance:p,$isIconButton:j,...d,theme:s,ref:a},t.children&&y.length?e.Children.map(t.children,((t,r)=>e.createElement(m,{theme:s,key:r},t))):null)}));a.displayName="Button";export{a as Button,a as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n type ReactNode,\n type ButtonHTMLAttributes,\n type Ref,\n forwardRef,\n type ReactElement,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { IconFa } from \"../IconFa\";\n\nimport { Spacer, StyledButton } from \"./styles\";\nimport { type ButtonAppearanceType } from \"../../types\";\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLElement> & {\n /** the look and feel of the button */\n appearance?: ButtonAppearanceType;\n /** flag to stretch but to 100% width */\n full?: boolean;\n /** this is a url which will convert the button to an anchor tag */\n href?: string;\n /** the height of the button, this will add padding not increase text size */\n size?: \"m\" | \"l\";\n css?: unknown;\n /** styled-components polymorphism where you can use the styling of a button but convert to another element like an anchor tag */\n as?: ElementType;\n /** flag to force button into an icon button shape which is square or round */\n isIconButton?: boolean;\n /** Element reference */\n ref?: Ref<HTMLElement>;\n /** Component reference */\n children?: ReactNode;\n};\n\n/**\n * Design system documentation CRUK https://zeroheight.com/23de8a59a/p/180ef6-buttons/b/32e1a2\n *\n * Design system documentation SU2C https://zeroheight.com/79db39f7e/p/22ff0e-button/b/32e1a2\n */\nexport const Button = forwardRef(\n (props: ButtonProps, ref?: Ref<HTMLElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const {\n appearance = \"primary\",\n isIconButton = false,\n full = false,\n size = \"m\",\n children,\n ...rest\n } = props;\n\n const childArray = React.Children.toArray(children);\n const isChildString = typeof childArray[0] === \"string\";\n const firstElement = childArray[0] as ReactElement;\n\n // button has a fixed width if there is a single icon\n const setIconButton = !!(\n isIconButton ||\n (childArray.length === 1 && !isChildString && firstElement?.type) ===\n IconFa\n );\n\n return (\n <StyledButton\n as={props.href ? \"a\" : \"button\"}\n {...(props.href ? { role: \"button\" } : {})}\n $full={!!full}\n $size={size}\n $appearance={appearance}\n $isIconButton={setIconButton}\n {...rest}\n theme={theme}\n ref={ref}\n >\n {props.children && childArray.length\n ? React.Children.map(\n props.children,\n (child: ReactNode, index: number) => (\n <Spacer theme={theme} key={index}>\n {child}\n </Spacer>\n ),\n )\n : null}\n </StyledButton>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","props","ref","foundTheme","useTheme","theme","__assign","defaultTheme","_a","appearance","_b","isIconButton","_c","full","_d","size","children","rest","childArray","React","Children","toArray","isChildString","firstElement","setIconButton","length","type","IconFa","createElement","StyledButton","as","href","role","$full","$size","$appearance","$isIconButton","map","child","index","Spacer","key"],"mappings":"2TAyCaA,EAASC,GACpB,SAACC,EAAoBC,GACnB,IAAMC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGHK,EAMEP,EANoBQ,WAAtBA,OAAa,IAAAD,EAAA,YACbE,EAKET,EALkBU,aAApBA,OAAe,IAAAD,KACfE,EAIEX,EAAKY,KAJPA,cAAYD,EACZE,EAGEb,OAHFc,OAAO,IAAAD,EAAA,IAAGA,EACVE,EAEEf,WADCgB,IACDhB,EAPE,CAOL,aAAA,eAAA,OAAA,OAAA,aAEKiB,EAAaC,EAAMC,SAASC,QAAQL,GACpCM,EAAyC,iBAAlBJ,EAAW,GAClCK,EAAeL,EAAW,GAG1BM,KACJb,IACuB,IAAtBO,EAAWO,SAAiBH,IAAiBC,aAAY,EAAZA,EAAcG,SAC1DC,GAGJ,OACER,EAAAS,cAACC,EAAYvB,EAAA,CACXwB,GAAI7B,EAAM8B,KAAO,IAAM,UAClB9B,EAAM8B,KAAO,CAAEC,KAAM,UAAa,CAAA,EAChC,CAAAC,QAAEpB,EACFqB,MAAAnB,EACMoB,YAAA1B,EACE2B,cAAAZ,GACXP,EACJ,CAAAZ,MAAOA,EACPH,IAAKA,IAEJD,EAAMe,UAAYE,EAAWO,OAC1BN,EAAMC,SAASiB,IACbpC,EAAMe,UACN,SAACsB,EAAkBC,GAAkB,OACnCpB,EAAAS,cAACY,EAAM,CAACnC,MAAOA,EAAOoC,IAAKF,GACxBD,EAEJ,IAEH,KAGV"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Button/index.tsx"],"sourcesContent":["import React, {\n type ReactNode,\n type ButtonHTMLAttributes,\n type Ref,\n forwardRef,\n type ReactElement,\n type ElementType,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { IconFa } from \"../IconFa\";\n\nimport { Spacer, StyledButton } from \"./styles\";\nimport { type ButtonAppearanceType } from \"../../types\";\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLElement> & {\n /** the look and feel of the button */\n appearance?: ButtonAppearanceType;\n /** flag to stretch but to 100% width */\n full?: boolean;\n /** this is a url which will convert the button to an anchor tag */\n href?: string;\n /** the height of the button, this will add padding not increase text size */\n size?: \"m\" | \"l\";\n css?: unknown;\n /** styled-components polymorphism where you can use the styling of a button but convert to another element like an anchor tag */\n as?: ElementType;\n /** flag to force button into an icon button shape which is square or round */\n isIconButton?: boolean;\n /** Element reference */\n ref?: Ref<HTMLElement>;\n /** Component reference */\n children?: ReactNode;\n};\n\n/**\n * Design system documentation CRUK https://zeroheight.com/23de8a59a/p/180ef6-buttons/b/32e1a2\n *\n * Design system documentation SU2C https://zeroheight.com/79db39f7e/p/22ff0e-button/b/32e1a2\n */\nexport const Button = forwardRef(\n (props: ButtonProps, ref?: Ref<HTMLElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const {\n appearance = \"primary\",\n isIconButton = false,\n full = false,\n size = \"m\",\n children,\n ...rest\n } = props;\n\n const childArray = React.Children.toArray(children);\n const isChildString = typeof childArray[0] === \"string\";\n const firstElement = childArray[0] as ReactElement;\n\n // button has a fixed width if there is a single icon\n const setIconButton = !!(\n isIconButton ||\n (childArray.length === 1 && !isChildString && firstElement?.type) ===\n IconFa\n );\n\n return (\n <StyledButton\n as={props.href ? \"a\" : \"button\"}\n {...(props.href ? { role: \"button\" } : {})}\n $full={!!full}\n $size={size}\n $appearance={appearance}\n $isIconButton={setIconButton}\n {...rest}\n theme={theme}\n ref={ref}\n >\n {props.children && childArray.length\n ? React.Children.map(\n props.children,\n (child: ReactNode, index: number) => (\n <Spacer theme={theme} key={index}>\n {child}\n </Spacer>\n ),\n )\n : null}\n </StyledButton>\n );\n },\n);\n\nButton.displayName = \"Button\";\n\nexport default Button;\n"],"names":["Button","forwardRef","props","ref","foundTheme","useTheme","theme","defaultTheme","appearance","isIconButton","full","size","children","rest","childArray","React","Children","toArray","isChildString","firstElement","setIconButton","length","type","IconFa","createElement","StyledButton","as","href","role","$full","$size","$appearance","$isIconButton","map","child","index","Spacer","key","displayName"],"mappings":"uOAyCa,MAAAA,EAASC,GACpB,CAACC,EAAoBC,KACnB,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,IAECI,WACJA,EAAa,UAASC,aACtBA,GAAe,EAAKC,KACpBA,GAAO,EAAKC,KACZA,EAAO,IAAGC,SACVA,KACGC,GACDX,EAEEY,EAAaC,EAAMC,SAASC,QAAQL,GACpCM,EAAyC,iBAAlBJ,EAAW,GAClCK,EAAeL,EAAW,GAG1BM,KACJX,IACuB,IAAtBK,EAAWO,SAAiBH,GAAiBC,GAAcG,QAC1DC,GAGJ,OACER,EAAAS,cAACC,EAAY,CACXC,GAAIxB,EAAMyB,KAAO,IAAM,YAClBzB,EAAMyB,KAAO,CAAEC,KAAM,UAAa,CAAA,EAChCC,QAAEnB,EACFoB,MAAAnB,EACMoB,YAAAvB,EACEwB,cAAAZ,KACXP,EACJP,MAAOA,EACPH,IAAKA,GAEJD,EAAMU,UAAYE,EAAWO,OAC1BN,EAAMC,SAASiB,IACb/B,EAAMU,UACN,CAACsB,EAAkBC,IACjBpB,EAAAS,cAACY,EAAM,CAAC9B,MAAOA,EAAO+B,IAAKF,GACxBD,KAIP,KACS,IAKrBlC,EAAOsC,YAAc"}
@@ -1,2 +1,109 @@
1
- import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as r}from"styled-components";var t,e,c,a,i,l,d,s,u="3rem",b="4rem",m=o.span(t||(t=n(["\n margin-left: ",";\n &:first-of-type {\n margin-left: 0;\n }\n"],["\n margin-left: ",";\n &:first-of-type {\n margin-left: 0;\n }\n"])),(function(n){return n.theme.spacing.xxs})),h=o.button(s||(s=n(["\n box-sizing: border-box;\n min-height: ",";\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ",";\n width: ",";\n min-width: ",";\n\n border-radius: ",";\n border-style: solid;\n border-width: ",";\n\n transition:\n color 0.2s ease,\n background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ",";\n font-family: ",";\n font-weight: ",";\n text-align: center;\n text-transform: ",";\n text-decoration: ",";\n\n &:focus-visible {\n outline: auto;\n }\n\n ","\n\n ","\n\n ","\n \n ","\n\n ","\n\n ","\n"],["\n box-sizing: border-box;\n min-height: ",";\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ",";\n width: ",";\n min-width: ",";\n\n border-radius: ",";\n border-style: solid;\n border-width: ",";\n\n transition:\n color 0.2s ease,\n background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ",";\n font-family: ",";\n font-weight: ",";\n text-align: center;\n text-transform: ",";\n text-decoration: ",";\n\n &:focus-visible {\n outline: auto;\n }\n\n ","\n\n ","\n\n ","\n \n ","\n\n ","\n\n ","\n"])),u,(function(n){var o=n.theme;return n.$isIconButton?"0":"calc( (".concat(u," - ( ").concat(o.button.buttonBorderThickness," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.button.horizontalPadding)}),(function(n){return n.$isIconButton?"".concat(u):"auto"}),(function(n){return n.$isIconButton?"".concat(u):"auto"}),(function(n){return n.theme.button.borderRadius}),(function(n){return n.theme.button.buttonBorderThickness}),(function(n){return n.theme.fontSizes.m}),(function(n){return n.theme.typography.fontFamilyButtons}),(function(n){return n.theme.typography.fontWeightButtons}),(function(n){return n.theme.button.textTransform}),(function(n){return n.theme.button.textDecoration}),(function(o){return"primary"===o.$appearance&&r(e||(e=n(["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "],["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "])),o.theme.colors.buttonPrimaryBackground,o.theme.colors.buttonPrimaryBorder,o.theme.colors.buttonPrimaryText,o.theme.colors.buttonPrimaryBackgroundHover,o.theme.colors.buttonPrimaryBorderHover,o.theme.colors.buttonPrimaryTextHover,o.theme.colors.buttonPrimaryDisabledBackground,o.theme.colors.buttonPrimaryDisabledText,o.theme.colors.buttonPrimaryDisabledBorder)}),(function(o){return"secondary"===o.$appearance&&r(c||(c=n(["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "],["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n &:focus,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "])),o.theme.colors.buttonSecondaryBackground,o.theme.colors.buttonSecondaryBorder,o.theme.colors.buttonSecondaryText,o.theme.colors.buttonSecondaryBackgroundHover,o.theme.colors.buttonSecondaryBorderHover,o.theme.colors.buttonSecondaryTextHover,o.theme.colors.buttonSecondaryDisabledBackground,o.theme.colors.buttonSecondaryDisabledText,o.theme.colors.buttonSecondaryDisabledBorder)}),(function(o){return"tertiary"===o.$appearance&&r(a||(a=n(["\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ",";\n &:focus,\n &:hover {\n color: ",";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: "," !important;\n border-color: transparent;\n }\n "],["\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ",";\n &:focus,\n &:hover {\n color: ",";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: "," !important;\n border-color: transparent;\n }\n "])),o.theme.colors.buttonTertiaryText,o.theme.colors.buttonTertiaryTextHover,o.theme.colors.buttonTertiaryDisabledText)}),(function(o){var t=o.theme,e=o.$size,c=o.$isIconButton;return"l"===e&&r(i||(i=n(["\n min-height: ",";\n border-radius: ",";\n padding: ",";\n min-width: ",";\n height: ",";\n "],["\n min-height: ",";\n border-radius: ",";\n padding: ",";\n min-width: ",";\n height: ",";\n "])),b,t.button.borderRadiusLarge,c?"0":"calc( (".concat(b," - ( ").concat(t.button.buttonBorderThickness," * 2) - ").concat(t.typography.lineHeight," ) / 2) ").concat(t.spacing.m),c?"".concat(b):"auto",c?"".concat(b):"min-content")}),(function(o){return o.$full&&r(l||(l=n(["\n width: 100%;\n "],["\n width: 100%;\n "])))}),(function(o){return o.$css&&r(d||(d=n(["\n ","\n "],["\n ","\n "])),o.$css)}));export{m as Spacer,h as StyledButton};
1
+ import o,{css as r}from"styled-components";const t="3rem",e="4rem",n=o.span`
2
+ margin-left: ${({theme:o})=>o.spacing.xxs};
3
+ &:first-of-type {
4
+ margin-left: 0;
5
+ }
6
+ `,a=o.button`
7
+ box-sizing: border-box;
8
+ min-height: ${t};
9
+ height: min-content;
10
+ display: inline-block;
11
+ vertical-align: middle;
12
+
13
+ padding: ${({theme:o,$isIconButton:r})=>r?"0":`calc( (${t} - ( ${o.button.buttonBorderThickness} * 2) - ${o.typography.lineHeight} ) / 2) ${o.button.horizontalPadding}`};
14
+ width: ${({$isIconButton:o})=>o?`${t}`:"auto"};
15
+ min-width: ${({$isIconButton:o})=>o?`${t}`:"auto"};
16
+
17
+ border-radius: ${({theme:o})=>o.button.borderRadius};
18
+ border-style: solid;
19
+ border-width: ${({theme:o})=>o.button.buttonBorderThickness};
20
+
21
+ transition:
22
+ color 0.2s ease,
23
+ background-color 0.2s ease,
24
+ border-color 0.2s ease;
25
+
26
+ cursor: pointer;
27
+ font-size: ${({theme:{fontSizes:{m:o}}})=>o};
28
+ font-family: ${({theme:{typography:{fontFamilyButtons:o}}})=>o};
29
+ font-weight: ${({theme:{typography:{fontWeightButtons:o}}})=>o};
30
+ text-align: center;
31
+ text-transform: ${({theme:o})=>o.button.textTransform};
32
+ text-decoration: ${({theme:o})=>o.button.textDecoration};
33
+
34
+ &:focus-visible {
35
+ outline: auto;
36
+ }
37
+
38
+ ${o=>"primary"===o.$appearance&&r`
39
+ background-color: ${o.theme.colors.buttonPrimaryBackground};
40
+ border-color: ${o.theme.colors.buttonPrimaryBorder};
41
+ color: ${o.theme.colors.buttonPrimaryText} !important;
42
+ &:focus,
43
+ &:hover {
44
+ background-color: ${o.theme.colors.buttonPrimaryBackgroundHover};
45
+ border-color: ${o.theme.colors.buttonPrimaryBorderHover};
46
+ color: ${o.theme.colors.buttonPrimaryTextHover} !important;
47
+ }
48
+ &:disabled {
49
+ cursor: not-allowed;
50
+ background-color: ${o.theme.colors.buttonPrimaryDisabledBackground};
51
+ color: ${o.theme.colors.buttonPrimaryDisabledText} !important;
52
+ border-color: ${o.theme.colors.buttonPrimaryDisabledBorder};
53
+ }
54
+ `}
55
+
56
+ ${o=>"secondary"===o.$appearance&&r`
57
+ background-color: ${o.theme.colors.buttonSecondaryBackground};
58
+ border-color: ${o.theme.colors.buttonSecondaryBorder};
59
+ color: ${o.theme.colors.buttonSecondaryText} !important;
60
+ &:focus,
61
+ &:hover {
62
+ background-color: ${o.theme.colors.buttonSecondaryBackgroundHover};
63
+ border-color: ${o.theme.colors.buttonSecondaryBorderHover};
64
+ color: ${o.theme.colors.buttonSecondaryTextHover} !important;
65
+ }
66
+ &:disabled {
67
+ cursor: not-allowed;
68
+ background-color: ${o.theme.colors.buttonSecondaryDisabledBackground};
69
+ color: ${o.theme.colors.buttonSecondaryDisabledText} !important;
70
+ border-color: ${o.theme.colors.buttonSecondaryDisabledBorder};
71
+ }
72
+ `}
73
+
74
+ ${o=>"tertiary"===o.$appearance&&r`
75
+ display: inline-block;
76
+ padding: 0;
77
+ border: 0px;
78
+ background-color: rgba(255, 255, 255, 0);
79
+ transition: color 0.2s ease;
80
+ color: ${o.theme.colors.buttonTertiaryText};
81
+ &:focus,
82
+ &:hover {
83
+ color: ${o.theme.colors.buttonTertiaryTextHover};
84
+ }
85
+ &:disabled {
86
+ cursor: not-allowed;
87
+ background-color: transparent;
88
+ color: ${o.theme.colors.buttonTertiaryDisabledText} !important;
89
+ border-color: transparent;
90
+ }
91
+ `}
92
+
93
+ ${({theme:o,$size:t,$isIconButton:n})=>"l"===t&&r`
94
+ min-height: ${e};
95
+ border-radius: ${o.button.borderRadiusLarge};
96
+ padding: ${n?"0":`calc( (${e} - ( ${o.button.buttonBorderThickness} * 2) - ${o.typography.lineHeight} ) / 2) ${o.spacing.m}`};
97
+ min-width: ${n?`${e}`:"auto"};
98
+ height: ${n?`${e}`:"min-content"};
99
+ `}
100
+
101
+ ${o=>o.$full&&r`
102
+ width: 100%;
103
+ `}
104
+
105
+ ${o=>o.$css&&r`
106
+ ${o.$css}
107
+ `}
108
+ `;export{n as Spacer,a as StyledButton};
2
109
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/Button/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { type ThemeType, type ButtonAppearanceType } from \"../../types\";\n\nconst BUTTON_HEIGHT = \"3rem\";\nconst BUTTON_HEIGHT_LARGE = \"4rem\";\n\nexport const Spacer = styled.span<{ theme: ThemeType }>`\n margin-left: ${({ theme }) => theme.spacing.xxs};\n &:first-of-type {\n margin-left: 0;\n }\n`;\n\nexport const StyledButton = styled.button<{\n theme: ThemeType;\n href?: string;\n $isIconButton: boolean;\n $appearance?: ButtonAppearanceType;\n $full?: boolean;\n $size?: \"m\" | \"l\";\n $css?: string;\n}>`\n box-sizing: border-box;\n min-height: ${BUTTON_HEIGHT};\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ${({ theme, $isIconButton }) =>\n $isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.button.horizontalPadding}`};\n width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n min-width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n\n border-radius: ${({ theme }) => theme.button.borderRadius};\n border-style: solid;\n border-width: ${({ theme }) => theme.button.buttonBorderThickness};\n\n transition:\n color 0.2s ease,\n background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ${({\n theme: {\n fontSizes: { m },\n },\n }) => m};\n font-family: ${({\n theme: {\n typography: { fontFamilyButtons },\n },\n }) => fontFamilyButtons};\n font-weight: ${({\n theme: {\n typography: { fontWeightButtons },\n },\n }) => fontWeightButtons};\n text-align: center;\n text-transform: ${({ theme }) => theme.button.textTransform};\n text-decoration: ${({ theme }) => theme.button.textDecoration};\n\n &:focus-visible {\n outline: auto;\n }\n\n ${(props) =>\n props.$appearance === \"primary\" &&\n css`\n background-color: ${props.theme.colors.buttonPrimaryBackground};\n border-color: ${props.theme.colors.buttonPrimaryBorder};\n color: ${props.theme.colors.buttonPrimaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonPrimaryBackgroundHover};\n border-color: ${props.theme.colors.buttonPrimaryBorderHover};\n color: ${props.theme.colors.buttonPrimaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors.buttonPrimaryDisabledBackground};\n color: ${props.theme.colors.buttonPrimaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonPrimaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"secondary\" &&\n css`\n background-color: ${props.theme.colors.buttonSecondaryBackground};\n border-color: ${props.theme.colors.buttonSecondaryBorder};\n color: ${props.theme.colors.buttonSecondaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonSecondaryBackgroundHover};\n border-color: ${props.theme.colors.buttonSecondaryBorderHover};\n color: ${props.theme.colors.buttonSecondaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors\n .buttonSecondaryDisabledBackground};\n color: ${props.theme.colors.buttonSecondaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonSecondaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"tertiary\" &&\n css`\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ${props.theme.colors.buttonTertiaryText};\n &:focus,\n &:hover {\n color: ${props.theme.colors.buttonTertiaryTextHover};\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: ${props.theme.colors.buttonTertiaryDisabledText} !important;\n border-color: transparent;\n }\n `}\n \n ${({ theme, $size, $isIconButton }) =>\n $size === \"l\" &&\n css`\n min-height: ${BUTTON_HEIGHT_LARGE};\n border-radius: ${theme.button.borderRadiusLarge};\n padding: ${$isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT_LARGE} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m}`};\n min-width: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"auto\"};\n height: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"min-content\"};\n `}\n\n ${(props) =>\n props.$full &&\n css`\n width: 100%;\n `}\n\n ${(props) =>\n props.$css &&\n css`\n ${props.$css}\n `}\n`;\n"],"names":["BUTTON_HEIGHT","BUTTON_HEIGHT_LARGE","Spacer","styled","span","templateObject_1","__makeTemplateObject","_a","theme","spacing","xxs","StyledButton","button","$isIconButton","concat","buttonBorderThickness","typography","lineHeight","horizontalPadding","borderRadius","fontSizes","m","fontFamilyButtons","fontWeightButtons","textTransform","textDecoration","props","$appearance","css","colors","buttonPrimaryBackground","buttonPrimaryBorder","buttonPrimaryText","buttonPrimaryBackgroundHover","buttonPrimaryBorderHover","buttonPrimaryTextHover","buttonPrimaryDisabledBackground","buttonPrimaryDisabledText","buttonPrimaryDisabledBorder","templateObject_3","buttonSecondaryBackground","buttonSecondaryBorder","buttonSecondaryText","buttonSecondaryBackgroundHover","buttonSecondaryBorderHover","buttonSecondaryTextHover","buttonSecondaryDisabledBackground","buttonSecondaryDisabledText","buttonSecondaryDisabledBorder","templateObject_4","buttonTertiaryText","buttonTertiaryTextHover","buttonTertiaryDisabledText","$size","templateObject_5","borderRadiusLarge","$full","templateObject_6","$css","templateObject_7"],"mappings":"2HAIA,oBAAMA,EAAgB,OAChBC,EAAsB,OAEfC,EAASC,EAAOC,KAAIC,IAAAA,EAAAC,EAAA,CAAA,oBAAA,sDAAA,CAAsB,oBACN,yDAAhC,SAACC,GAAc,OAAPA,EAAAC,MAAaC,QAAQC,GAAd,IAMnBC,EAAeR,EAAOS,unBAQjC,8CAE2B,gGAQ6H,eAE3G,mBAEA,yBAEY,8CAEQ,8IAY1D,qBAKgB,qBAKA,+CAEoC,yBACE,0DAwB1D,SAqBA,SAqBA,WAYA,SAMA,SAMA,QAnIWZ,GAKH,SAACO,OAAEC,EAAKD,EAAAC,MACjB,OADgCD,EAAAM,cAE5B,IACA,iBAAUb,EAAa,SAAAc,OAAQN,EAAMI,OAAOG,sBAAqB,YAAAD,OAAWN,EAAMQ,WAAWC,WAAU,YAAAH,OAAWN,EAAMI,OAAOM,kBAFnI,IAGO,SAACX,GACR,OADuBA,EAAAM,cACP,GAAAC,OAAGd,GAAkB,MAArC,IACW,SAACO,GACZ,OAD2BA,EAAAM,cACX,GAAAC,OAAGd,GAAkB,MAArC,IAEe,SAACO,GAAc,OAAPA,EAAAC,MAAaI,OAAOO,YAAb,IAEhB,SAACZ,GAAc,OAAPA,EAAAC,MAAaI,OAAOG,qBAAb,IAQlB,SAACR,GAIR,OAFYA,EAAAC,MAAAY,UAAAC,CAEZ,IACS,SAACd,GAIV,OAF6BA,EAAAC,MAAAQ,WAAAM,iBAE7B,IACS,SAACf,GAIV,OAF6BA,EAAAC,MAAAQ,WAAAO,iBAE7B,IAEY,SAAChB,GAAc,OAAPA,EAAAC,MAAaI,OAAOY,aAAb,IACd,SAACjB,GAAc,OAAPA,EAAAC,MAAaI,OAAOa,cAAb,IAMhC,SAACC,GACD,MAAsB,YAAtBA,EAAMC,aACNC,yYAAG,6BAC6D,0BACR,mBACT,4EAGwB,4BACR,qBACT,sGAIoB,qBACjB,uCACS,sBAb5CF,EAAMlB,MAAMqB,OAAOC,wBACvBJ,EAAMlB,MAAMqB,OAAOE,oBAC1BL,EAAMlB,MAAMqB,OAAOG,kBAGNN,EAAMlB,MAAMqB,OAAOI,6BACvBP,EAAMlB,MAAMqB,OAAOK,yBAC1BR,EAAMlB,MAAMqB,OAAOM,uBAIRT,EAAMlB,MAAMqB,OAAOO,gCAC9BV,EAAMlB,MAAMqB,OAAOQ,0BACZX,EAAMlB,MAAMqB,OAAOS,4BAfvC,IAmBA,SAACZ,GACD,MAAsB,cAAtBA,EAAMC,aACNC,EAAGW,IAAAA,EAAAjC,EAAA,CAAA,6BAAA,0BAAA,mBAAA,4EAAA,4BAAA,qBAAA,sGAAA,qBAAA,uCAAA,oBAAA,CAAA,6BAC+D,0BACR,mBACT,4EAGwB,4BACR,qBACT,sGAKhB,qBACmB,uCACS,sBAd9CoB,EAAMlB,MAAMqB,OAAOW,0BACvBd,EAAMlB,MAAMqB,OAAOY,sBAC1Bf,EAAMlB,MAAMqB,OAAOa,oBAGNhB,EAAMlB,MAAMqB,OAAOc,+BACvBjB,EAAMlB,MAAMqB,OAAOe,2BAC1BlB,EAAMlB,MAAMqB,OAAOgB,yBAIRnB,EAAMlB,MAAMqB,OAC7BiB,kCACMpB,EAAMlB,MAAMqB,OAAOkB,4BACZrB,EAAMlB,MAAMqB,OAAOmB,8BAhBvC,IAoBA,SAACtB,GACD,MAAsB,aAAtBA,EAAMC,aACNC,EAAGqB,IAAAA,EAAA3C,EAAA,CAAA,4KAAA,sDAAA,wHAAA,mEAAA,CAAA,4KAM6C,sDAGO,wHAKG,qEAR/CoB,EAAMlB,MAAMqB,OAAOqB,mBAGjBxB,EAAMlB,MAAMqB,OAAOsB,wBAKnBzB,EAAMlB,MAAMqB,OAAOuB,2BAfhC,IAoBA,SAAC7C,GAAE,IAAAC,UAAO6C,EAAK9C,EAAA8C,MAAExC,EAAaN,EAAAM,cAC9B,MAAU,MAAVwC,GACAzB,EAAG0B,IAAAA,EAAAhD,EAAA,CAAA,uBAAA,2BAAA,qBAAA,uBAAA,oBAAA,WAAA,CAAA,uBACgC,2BACc,qBAG8F,uBAC/E,oBACI,aANpDL,EACGO,EAAMI,OAAO2C,kBACnB1C,EACP,IACA,iBAAUZ,EAAmB,SAAAa,OAAQN,EAAMI,OAAOG,sBAAqB,YAAAD,OAAWN,EAAMQ,WAAWC,WAAU,YAAAH,OAAWN,EAAMC,QAAQY,GAC7HR,EAAgB,GAAGC,OAAAb,GAAwB,OAC9CY,EAAgB,GAAGC,OAAAb,GAAwB,cARvD,IAWA,SAACyB,GACD,OAAAA,EAAM8B,OACN5B,EAAG6B,IAAAA,EAAAnD,EAAA,CAAA,8BAAA,CAAA,gCADH,IAKA,SAACoB,GACD,OAAAA,EAAMgC,MACN9B,EAAG+B,IAAAA,EAAArD,EAAA,CAAA,WAAA,UAAA,CAAA,WACW,YAAVoB,EAAMgC,KAFV"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Button/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { type ThemeType, type ButtonAppearanceType } from \"../../types\";\n\nconst BUTTON_HEIGHT = \"3rem\";\nconst BUTTON_HEIGHT_LARGE = \"4rem\";\n\nexport const Spacer = styled.span<{ theme: ThemeType }>`\n margin-left: ${({ theme }) => theme.spacing.xxs};\n &:first-of-type {\n margin-left: 0;\n }\n`;\n\nexport const StyledButton = styled.button<{\n theme: ThemeType;\n href?: string;\n $isIconButton: boolean;\n $appearance?: ButtonAppearanceType;\n $full?: boolean;\n $size?: \"m\" | \"l\";\n $css?: string;\n}>`\n box-sizing: border-box;\n min-height: ${BUTTON_HEIGHT};\n height: min-content;\n display: inline-block;\n vertical-align: middle;\n\n padding: ${({ theme, $isIconButton }) =>\n $isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.button.horizontalPadding}`};\n width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n min-width: ${({ $isIconButton }) =>\n $isIconButton ? `${BUTTON_HEIGHT}` : \"auto\"};\n\n border-radius: ${({ theme }) => theme.button.borderRadius};\n border-style: solid;\n border-width: ${({ theme }) => theme.button.buttonBorderThickness};\n\n transition:\n color 0.2s ease,\n background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ${({\n theme: {\n fontSizes: { m },\n },\n }) => m};\n font-family: ${({\n theme: {\n typography: { fontFamilyButtons },\n },\n }) => fontFamilyButtons};\n font-weight: ${({\n theme: {\n typography: { fontWeightButtons },\n },\n }) => fontWeightButtons};\n text-align: center;\n text-transform: ${({ theme }) => theme.button.textTransform};\n text-decoration: ${({ theme }) => theme.button.textDecoration};\n\n &:focus-visible {\n outline: auto;\n }\n\n ${(props) =>\n props.$appearance === \"primary\" &&\n css`\n background-color: ${props.theme.colors.buttonPrimaryBackground};\n border-color: ${props.theme.colors.buttonPrimaryBorder};\n color: ${props.theme.colors.buttonPrimaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonPrimaryBackgroundHover};\n border-color: ${props.theme.colors.buttonPrimaryBorderHover};\n color: ${props.theme.colors.buttonPrimaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors.buttonPrimaryDisabledBackground};\n color: ${props.theme.colors.buttonPrimaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonPrimaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"secondary\" &&\n css`\n background-color: ${props.theme.colors.buttonSecondaryBackground};\n border-color: ${props.theme.colors.buttonSecondaryBorder};\n color: ${props.theme.colors.buttonSecondaryText} !important;\n &:focus,\n &:hover {\n background-color: ${props.theme.colors.buttonSecondaryBackgroundHover};\n border-color: ${props.theme.colors.buttonSecondaryBorderHover};\n color: ${props.theme.colors.buttonSecondaryTextHover} !important;\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ${props.theme.colors\n .buttonSecondaryDisabledBackground};\n color: ${props.theme.colors.buttonSecondaryDisabledText} !important;\n border-color: ${props.theme.colors.buttonSecondaryDisabledBorder};\n }\n `}\n\n ${(props) =>\n props.$appearance === \"tertiary\" &&\n css`\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ${props.theme.colors.buttonTertiaryText};\n &:focus,\n &:hover {\n color: ${props.theme.colors.buttonTertiaryTextHover};\n }\n &:disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: ${props.theme.colors.buttonTertiaryDisabledText} !important;\n border-color: transparent;\n }\n `}\n \n ${({ theme, $size, $isIconButton }) =>\n $size === \"l\" &&\n css`\n min-height: ${BUTTON_HEIGHT_LARGE};\n border-radius: ${theme.button.borderRadiusLarge};\n padding: ${$isIconButton\n ? \"0\"\n : `calc( (${BUTTON_HEIGHT_LARGE} - ( ${theme.button.buttonBorderThickness} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m}`};\n min-width: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"auto\"};\n height: ${$isIconButton ? `${BUTTON_HEIGHT_LARGE}` : \"min-content\"};\n `}\n\n ${(props) =>\n props.$full &&\n css`\n width: 100%;\n `}\n\n ${(props) =>\n props.$css &&\n css`\n ${props.$css}\n `}\n`;\n"],"names":["BUTTON_HEIGHT","BUTTON_HEIGHT_LARGE","Spacer","styled","span","theme","spacing","xxs","StyledButton","button","$isIconButton","buttonBorderThickness","typography","lineHeight","horizontalPadding","borderRadius","fontSizes","m","fontFamilyButtons","fontWeightButtons","textTransform","textDecoration","props","$appearance","css","colors","buttonPrimaryBackground","buttonPrimaryBorder","buttonPrimaryText","buttonPrimaryBackgroundHover","buttonPrimaryBorderHover","buttonPrimaryTextHover","buttonPrimaryDisabledBackground","buttonPrimaryDisabledText","buttonPrimaryDisabledBorder","buttonSecondaryBackground","buttonSecondaryBorder","buttonSecondaryText","buttonSecondaryBackgroundHover","buttonSecondaryBorderHover","buttonSecondaryTextHover","buttonSecondaryDisabledBackground","buttonSecondaryDisabledText","buttonSecondaryDisabledBorder","buttonTertiaryText","buttonTertiaryTextHover","buttonTertiaryDisabledText","$size","borderRadiusLarge","$full","$css"],"mappings":"2CAIA,MAAMA,EAAgB,OAChBC,EAAsB,OAEfC,EAASC,EAAOC,IAA0B;iBACtC,EAAGC,WAAYA,EAAMC,QAAQC;;;;EAMjCC,EAAeL,EAAOM,MAQjC;;gBAEcT;;;;;aAKH,EAAGK,QAAOK,mBACnBA,EACI,IACA,UAAUV,SAAqBK,EAAMI,OAAOE,gCAAgCN,EAAMO,WAAWC,qBAAqBR,EAAMI,OAAOK;WAC5H,EAAGJ,mBACVA,EAAgB,GAAGV,IAAkB;eAC1B,EAAGU,mBACdA,EAAgB,GAAGV,IAAkB;;mBAEtB,EAAGK,WAAYA,EAAMI,OAAOM;;kBAE7B,EAAGV,WAAYA,EAAMI,OAAOE;;;;;;;;eAQ/B,EACXN,OACEW,WAAaC,SAEXA;iBACS,EACbZ,OACEO,YAAcM,yBAEZA;iBACS,EACbb,OACEO,YAAcO,yBAEZA;;oBAEY,EAAGd,WAAYA,EAAMI,OAAOW;qBAC3B,EAAGf,WAAYA,EAAMI,OAAOY;;;;;;IAM5CC,GACqB,YAAtBA,EAAMC,aACNC,CAAG;0BACmBF,EAAMjB,MAAMoB,OAAOC;sBACvBJ,EAAMjB,MAAMoB,OAAOE;eAC1BL,EAAMjB,MAAMoB,OAAOG;;;4BAGNN,EAAMjB,MAAMoB,OAAOI;wBACvBP,EAAMjB,MAAMoB,OAAOK;iBAC1BR,EAAMjB,MAAMoB,OAAOM;;;;4BAIRT,EAAMjB,MAAMoB,OAAOO;iBAC9BV,EAAMjB,MAAMoB,OAAOQ;wBACZX,EAAMjB,MAAMoB,OAAOS;;;;IAItCZ,GACqB,cAAtBA,EAAMC,aACNC,CAAG;0BACmBF,EAAMjB,MAAMoB,OAAOU;sBACvBb,EAAMjB,MAAMoB,OAAOW;eAC1Bd,EAAMjB,MAAMoB,OAAOY;;;4BAGNf,EAAMjB,MAAMoB,OAAOa;wBACvBhB,EAAMjB,MAAMoB,OAAOc;iBAC1BjB,EAAMjB,MAAMoB,OAAOe;;;;4BAIRlB,EAAMjB,MAAMoB,OAC7BgB;iBACMnB,EAAMjB,MAAMoB,OAAOiB;wBACZpB,EAAMjB,MAAMoB,OAAOkB;;;;IAItCrB,GACqB,aAAtBA,EAAMC,aACNC,CAAG;;;;;;eAMQF,EAAMjB,MAAMoB,OAAOmB;;;iBAGjBtB,EAAMjB,MAAMoB,OAAOoB;;;;;iBAKnBvB,EAAMjB,MAAMoB,OAAOqB;;;;;IAKhC,EAAGzC,QAAO0C,QAAOrC,mBACP,MAAVqC,GACAvB,CAAG;oBACavB;uBACGI,EAAMI,OAAOuC;iBACnBtC,EACP,IACA,UAAUT,SAA2BI,EAAMI,OAAOE,gCAAgCN,EAAMO,WAAWC,qBAAqBR,EAAMC,QAAQW;mBAC7HP,EAAgB,GAAGT,IAAwB;gBAC9CS,EAAgB,GAAGT,IAAwB;;;IAGtDqB,GACDA,EAAM2B,OACNzB,CAAG;;;;IAIFF,GACDA,EAAM4B,MACN1B,CAAG;QACCF,EAAM4B;;"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { StoryObj } from "@storybook/react";
3
- import Carousel, { CarouselProps } from ".";
2
+ import { type StoryObj } from "@storybook/react";
3
+ import Carousel, { type CarouselProps } from ".";
4
4
  declare const _default: {
5
5
  title: string;
6
6
  component: React.MemoExoticComponent<({ startPosition, children, onPositionChanged, shrinkUnselectedPages, fullWidthChild, }: CarouselProps) => React.JSX.Element>;
@@ -1,2 +1,2 @@
1
- import e from"react";import{faCaretLeft as n,faCaretRight as t}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{IconFa as r}from"../IconFa/index.js";import{ButtonWrapper as o,CarouselButton as l,VerticalAlign as c,ScreenReaderOnly as a,DotContainer as i,Dot as s}from"./styles.js";var u=function(u){var m=u.count,d=u.currentPosition,f=void 0===d?0:d,E=u.scrollToPosition,p=u.next,v=u.previous,x=f!==m-1,k=0!==f,b=Array.from({length:m},(function(e,n){return"arrayIndex".concat(n)}));return e.createElement(o,null,e.createElement(l,{disabled:!k,"aria-label":"previous",onClick:function(){v()}},e.createElement(c,null,e.createElement(r,{faIcon:n,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))),e.createElement(i,{$count:m},b.map((function(n,t){var r=t===f;return e.createElement(s,{key:n,role:"switch","aria-checked":r,onClick:function(){E(t)},$selected:r},e.createElement(a,null,"Scroll carousel to index ".concat(t)))}))),e.createElement(l,{disabled:!x,"aria-label":"next",onClick:function(){p()}},e.createElement(c,null,e.createElement(r,{faIcon:t,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))))};export{u as Dots,u as default};
1
+ import e from"react";import{faCaretLeft as l,faCaretRight as t}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{IconFa as r}from"../IconFa/index.js";import{ButtonWrapper as o,CarouselButton as n,VerticalAlign as c,ScreenReaderOnly as a,DotContainer as i,Dot as s}from"./styles.js";const m=({count:m,currentPosition:u=0,scrollToPosition:d,next:E,previous:f})=>{const p=u!==m-1,x=0!==u,k=Array.from({length:m},((e,l)=>`arrayIndex${l}`));return e.createElement(o,null,e.createElement(n,{disabled:!x,"aria-label":"previous",onClick:()=>{f()}},e.createElement(c,null,e.createElement(r,{faIcon:l,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))),e.createElement(i,{$count:m},k.map(((l,t)=>{const r=t===u;return e.createElement(s,{key:l,role:"switch","aria-checked":r,onClick:()=>{d(t)},$selected:r},e.createElement(a,null,`Scroll carousel to index ${t}`))}))),e.createElement(n,{disabled:!p,"aria-label":"next",onClick:()=>{E()}},e.createElement(c,null,e.createElement(r,{faIcon:t,size:"1.25em"}),e.createElement(a,null,"Scroll carousel to previous index"))))};export{m as Dots,m as default};
2
2
  //# sourceMappingURL=Dots.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dots.js","sources":["../../../../src/components/Carousel/Dots.tsx"],"sourcesContent":["import React from \"react\";\nimport { faCaretLeft, faCaretRight } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\n\nimport {\n DotContainer,\n Dot,\n CarouselButton,\n ButtonWrapper,\n VerticalAlign,\n ScreenReaderOnly,\n} from \"./styles\";\n\nexport const Dots = ({\n count,\n currentPosition = 0,\n scrollToPosition,\n next,\n previous,\n}: {\n count: number;\n currentPosition: number;\n scrollToPosition: (to: number) => void;\n next: () => void;\n previous: () => void;\n}) => {\n const moreOnRight = currentPosition !== count - 1;\n const moreOnLeft = currentPosition !== 0;\n const countArray = Array.from({ length: count }, (e, i) => `arrayIndex${i}`);\n\n return (\n <ButtonWrapper>\n <CarouselButton\n disabled={!moreOnLeft}\n aria-label=\"previous\"\n onClick={() => {\n previous();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretLeft} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n\n <DotContainer $count={count}>\n {countArray.map((item, index) => {\n const isSelected = index === currentPosition;\n const scrollTo = () => {\n scrollToPosition(index);\n };\n return (\n <Dot\n key={item}\n role=\"switch\"\n aria-checked={isSelected}\n onClick={scrollTo}\n $selected={isSelected}\n >\n <ScreenReaderOnly>{`Scroll carousel to index ${index}`}</ScreenReaderOnly>\n </Dot>\n );\n })}\n </DotContainer>\n\n <CarouselButton\n disabled={!moreOnRight}\n aria-label=\"next\"\n onClick={() => {\n next();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretRight} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n </ButtonWrapper>\n );\n};\n\nexport default Dots;\n"],"names":["Dots","_a","count","_b","currentPosition","scrollToPosition","next","previous","moreOnRight","moreOnLeft","countArray","Array","from","length","e","i","concat","React","ButtonWrapper","createElement","CarouselButton","disabled","onClick","VerticalAlign","IconFa","faIcon","faCaretLeft","size","ScreenReaderOnly","DotContainer","$count","map","item","index","isSelected","Dot","key","role","faCaretRight"],"mappings":"sTAcO,IAAMA,EAAO,SAACC,GACnB,IAAAC,UACAC,EAAAF,EAAAG,gBAAAA,aAAkB,EAACD,EACnBE,qBACAC,EAAIL,EAAAK,KACJC,EAAQN,EAAAM,SAQFC,EAAcJ,IAAoBF,EAAQ,EAC1CO,EAAiC,IAApBL,EACbM,EAAaC,MAAMC,KAAK,CAAEC,OAAQX,IAAS,SAACY,EAAGC,GAAM,MAAA,aAAAC,OAAaD,EAAG,IAE3E,OACEE,gBAACC,EAAa,KACZD,EAACE,cAAAC,EACC,CAAAC,UAAWZ,EACA,aAAA,WACXa,QAAS,WACPf,MAGFU,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQC,EAAaC,KAAK,WAClCV,EAACE,cAAAS,EAAqE,KAAA,uCAI1EX,EAACE,cAAAU,EAAqB,CAAAC,OAAA5B,GACnBQ,EAAWqB,KAAI,SAACC,EAAMC,GACrB,IAAMC,EAAaD,IAAU7B,EAI7B,OACEa,EAACE,cAAAgB,GACCC,IAAKJ,EACLK,KAAK,wBACSH,EACdZ,QARa,WACfjB,EAAiB4B,EAClB,YAOcC,GAEXjB,EAACE,cAAAS,OAAkB,4BAA4BZ,OAAAiB,IAGrD,KAGFhB,EAACE,cAAAC,EACC,CAAAC,UAAWb,EACA,aAAA,OACXc,QAAS,WACPhB,MAGFW,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQa,EAAcX,KAAK,WACnCV,EAAAE,cAACS,EAAqE,KAAA,uCAKhF"}
1
+ {"version":3,"file":"Dots.js","sources":["../../../../src/components/Carousel/Dots.tsx"],"sourcesContent":["import React from \"react\";\nimport { faCaretLeft, faCaretRight } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { IconFa } from \"../IconFa\";\n\nimport {\n DotContainer,\n Dot,\n CarouselButton,\n ButtonWrapper,\n VerticalAlign,\n ScreenReaderOnly,\n} from \"./styles\";\n\nexport const Dots = ({\n count,\n currentPosition = 0,\n scrollToPosition,\n next,\n previous,\n}: {\n count: number;\n currentPosition: number;\n scrollToPosition: (to: number) => void;\n next: () => void;\n previous: () => void;\n}) => {\n const moreOnRight = currentPosition !== count - 1;\n const moreOnLeft = currentPosition !== 0;\n const countArray = Array.from({ length: count }, (e, i) => `arrayIndex${i}`);\n\n return (\n <ButtonWrapper>\n <CarouselButton\n disabled={!moreOnLeft}\n aria-label=\"previous\"\n onClick={() => {\n previous();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretLeft} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n\n <DotContainer $count={count}>\n {countArray.map((item, index) => {\n const isSelected = index === currentPosition;\n const scrollTo = () => {\n scrollToPosition(index);\n };\n return (\n <Dot\n key={item}\n role=\"switch\"\n aria-checked={isSelected}\n onClick={scrollTo}\n $selected={isSelected}\n >\n <ScreenReaderOnly>{`Scroll carousel to index ${index}`}</ScreenReaderOnly>\n </Dot>\n );\n })}\n </DotContainer>\n\n <CarouselButton\n disabled={!moreOnRight}\n aria-label=\"next\"\n onClick={() => {\n next();\n }}\n >\n <VerticalAlign>\n <IconFa faIcon={faCaretRight} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n </ButtonWrapper>\n );\n};\n\nexport default Dots;\n"],"names":["Dots","count","currentPosition","scrollToPosition","next","previous","moreOnRight","moreOnLeft","countArray","Array","from","length","e","i","React","ButtonWrapper","createElement","CarouselButton","disabled","onClick","VerticalAlign","IconFa","faIcon","faCaretLeft","size","ScreenReaderOnly","DotContainer","$count","map","item","index","isSelected","Dot","key","role","faCaretRight"],"mappings":"sTAca,MAAAA,EAAO,EAClBC,QACAC,kBAAkB,EAClBC,mBACAC,OACAC,eAQA,MAAMC,EAAcJ,IAAoBD,EAAQ,EAC1CM,EAAiC,IAApBL,EACbM,EAAaC,MAAMC,KAAK,CAAEC,OAAQV,IAAS,CAACW,EAAGC,IAAM,aAAaA,MAExE,OACEC,gBAACC,EAAa,KACZD,EAAAE,cAACC,EAAc,CACbC,UAAWX,EACA,aAAA,WACXY,QAAS,KACPd,GAAU,GAGZS,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQC,EAAaC,KAAK,WAClCV,EAACE,cAAAS,EAAqE,KAAA,uCAI1EX,EAAAE,cAACU,EAAY,CAAAC,OAAS1B,GACnBO,EAAWoB,KAAI,CAACC,EAAMC,KACrB,MAAMC,EAAaD,IAAU5B,EAI7B,OACEY,EAACE,cAAAgB,GACCC,IAAKJ,EACLK,KAAK,wBACSH,EACdZ,QARa,KACfhB,EAAiB2B,EAAM,YAQVC,GAEXjB,EAACE,cAAAS,OAAkB,4BAA4BK,KAC3C,KAKZhB,EAAAE,cAACC,EAAc,CACbC,UAAWZ,EACA,aAAA,OACXa,QAAS,KACPf,GAAM,GAGRU,EAAAE,cAACI,EAAa,KACZN,EAACE,cAAAK,GAAOC,OAAQa,EAAcX,KAAK,WACnCV,EAAAE,cAACS,EAAqE,KAAA,uCAG5D"}
@@ -1,2 +1,2 @@
1
- import e,{memo as t,useState as n,useRef as r,useEffect as l}from"react";import{InView as o}from"../../../node_modules/react-intersection-observer/dist/index.js";import{Box as i}from"../Box/index.js";import{Dots as c}from"./Dots.js";import{CarouselWrapper as u,CarouselScrollArea as s,CarouselCard as a,CarouselCardInner as d}from"./styles.js";var f=function(t){var f=t.startPosition,m=t.children,h=t.onPositionChanged,v=t.shrinkUnselectedPages,g=void 0!==v&&v,E=t.fullWidthChild,p=void 0!==E&&E,C=e.useRef(),$=void 0!==f,x=n(f||0),P=x[0],T=x[1],y=n(!$),j=y[0],W=y[1],k=r(null),b=e.Children.toArray(m).filter(Boolean),B=function(e){if(null==k?void 0:k.current){var t=k.current.scrollWidth,n=0===e,r=e===k.current.children.length-1,l=k.current.children[e];if(!l)return;var o=l.offsetLeft;n?k.current.scrollTo(0,0):r?k.current.scrollTo(t,0):k.current.scrollTo(o,0),j||W(!0)}};l((function(){$&&W(!1)}),[f]),l((function(){j||B(f||0)}),[j]);var S=1===b.length;return e.createElement(e.Fragment,null,e.createElement(i,null,e.createElement(u,null,e.createElement(s,{ref:k,"aria-live":"assertive",$smoothScrolling:j,tabIndex:0},b.map((function(t,n){var r=n===P,l="card-".concat(n);return e.createElement(a,{key:l,$onlyChild:S,$fullWidthChild:p},e.createElement(o,{threshold:.5,as:"div",onChange:function(e){var t;e&&P!==(t=n)&&(T(t),C&&clearTimeout(null==C?void 0:C.current),C.current=setTimeout((function(){h&&j&&h(t)}),500))}},e.createElement(d,{$onlyChild:S,$isSelected:r,$shrinkUnselectedPages:g,$fullWidthChild:p},t)))}))))),b.length>1?e.createElement(i,null,e.createElement(c,{count:b.length,currentPosition:P,scrollToPosition:B,next:function(){B(P+1)},previous:function(){B(P-1)}})):null)};t(f);export{f as Carousel};
1
+ import e,{memo as t,useState as r,useRef as n,useEffect as l}from"react";import{InView as o}from"../../../node_modules/react-intersection-observer/dist/index.js";import{Box as i}from"../Box/index.js";import{Dots as c}from"./Dots.js";import{CarouselWrapper as s,CarouselScrollArea as a,CarouselCard as u,CarouselCardInner as d}from"./styles.js";const m=({startPosition:t,children:m,onPositionChanged:h,shrinkUnselectedPages:f=!1,fullWidthChild:g=!1})=>{const E=e.useRef(),p=void 0!==t,[C,$]=r(t||0),[v,x]=r(!p),P=n(null),T=e.Children.toArray(m).filter(Boolean),y=e=>{if(P?.current){const t=P.current.scrollWidth,r=0===e,n=e===P.current.children.length-1,l=P.current.children[e];if(!l)return;const o=l.offsetLeft;r?P.current.scrollTo(0,0):n?P.current.scrollTo(t,0):P.current.scrollTo(o,0),v||x(!0)}};l((()=>{p&&x(!1)}),[t]),l((()=>{v||y(t||0)}),[v]);const j=1===T.length;return e.createElement(e.Fragment,null,e.createElement(i,null,e.createElement(s,null,e.createElement(a,{ref:P,"aria-live":"assertive",$smoothScrolling:v,tabIndex:0},T.map(((t,r)=>{const n=r===C,l=`card-${r}`;return e.createElement(u,{key:l,$onlyChild:j,$fullWidthChild:g},e.createElement(o,{threshold:.5,as:"div",onChange:e=>{var t;e&&C!==(t=r)&&($(t),E&&clearTimeout(E?.current),E.current=setTimeout((()=>{h&&v&&h(t)}),500))}},e.createElement(d,{$onlyChild:j,$isSelected:n,$shrinkUnselectedPages:f,$fullWidthChild:g},t)))}))))),T.length>1?e.createElement(i,null,e.createElement(c,{count:T.length,currentPosition:C,scrollToPosition:y,next:()=>{y(C+1)},previous:()=>{y(C-1)}})):null)};t(m);export{m as Carousel};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Carousel/index.tsx"],"sourcesContent":["import React, {\n useState,\n useRef,\n useEffect,\n memo,\n type ReactNode,\n} from \"react\";\nimport { InView } from \"react-intersection-observer\";\n\nimport { Box } from \"../Box\";\nimport { Dots } from \"./Dots\";\n\nimport {\n CarouselWrapper,\n CarouselCardInner,\n CarouselCard,\n CarouselScrollArea,\n} from \"./styles\";\n\nexport type CarouselProps = {\n /** Index in which the carousel is scrolled to on mount */\n startPosition?: number;\n /** call back for on position changed first prop is the possition */\n onPositionChanged?: (position: number) => void;\n /** show item left and right of current smaller than current item */\n shrinkUnselectedPages?: boolean;\n /** childrent item of the carousel */\n children?: ReactNode;\n /** set carousel image to full width of parent */\n fullWidthChild?: boolean;\n};\n\n/**\n *\n * Lightweight carousel component that works with mouse and touch events,\n * Accepts react node array as children so will work with any html element as a child.\n *\n * Also works with external state that holds carousel postion,\n * by accepting a starting position as a prop, whilst also accepting a handler\n * with current position as a prop triggered when carousel component is interacted with.\n */\nexport const Carousel = ({\n startPosition,\n children,\n onPositionChanged,\n shrinkUnselectedPages = false,\n fullWidthChild = false,\n}: CarouselProps) => {\n const timer = React.useRef<NodeJS.Timeout | string | number | undefined>();\n const isStartPositionSet = typeof startPosition !== \"undefined\";\n const [currentPosition, setCurrentPosition] = useState(startPosition || 0);\n const [smoothScrolling, setSmoothScrolling] = useState(!isStartPositionSet);\n const scrollRef = useRef<HTMLUListElement>(null);\n\n // remove null children\n const childArray = React.Children.toArray(children).filter(Boolean);\n\n const setPosition = (to: number) => {\n if (currentPosition === to) return;\n setCurrentPosition(to);\n\n if (timer) {\n clearTimeout(timer?.current);\n }\n timer.current = setTimeout(() => {\n if (onPositionChanged && smoothScrolling) {\n // Timer to debounce and only send the new position at the end of the scroll.\n // When using external state which also sets start position,\n // if scrolling to a new position past multiple cards,\n // it would effectively scroll to the past the first adjacent card,\n // receive the postion of the first card and stop there before it scrolls any further.\n onPositionChanged(to);\n }\n }, 500);\n };\n\n const next = () => {\n scrollToPosition(currentPosition + 1);\n };\n\n const previous = () => {\n scrollToPosition(currentPosition - 1);\n };\n\n const scrollToPosition = (to: number) => {\n if (scrollRef?.current) {\n const containerWidth = scrollRef.current.scrollWidth;\n const totalItems = scrollRef.current.children.length;\n const atBegining = to === 0;\n const atEnd = to === totalItems - 1;\n\n const item = scrollRef.current.children[to] as HTMLElement;\n if (!item) return;\n const newScroll = item.offsetLeft;\n\n if (atBegining) {\n scrollRef.current.scrollTo(0, 0);\n } else if (atEnd) {\n scrollRef.current.scrollTo(containerWidth, 0);\n } else {\n scrollRef.current.scrollTo(newScroll, 0);\n }\n\n // always resume normal smooth scrolling behaviour after the first scroll\n if (!smoothScrolling) {\n setSmoothScrolling(true);\n }\n }\n };\n\n // Stop smooth scrolling when moving to a starting position\n useEffect(() => {\n if (isStartPositionSet) {\n setSmoothScrolling(false);\n }\n }, [startPosition]);\n\n useEffect(() => {\n if (!smoothScrolling) {\n scrollToPosition(startPosition || 0);\n }\n }, [smoothScrolling]);\n\n const onlyChild = childArray.length === 1;\n\n return (\n <>\n <Box>\n <CarouselWrapper>\n <CarouselScrollArea\n ref={scrollRef}\n aria-live=\"assertive\"\n $smoothScrolling={smoothScrolling}\n tabIndex={0}\n >\n {childArray.map((child, index) => {\n const isSelected = index === currentPosition;\n const keyString = `card-${index}`;\n return (\n <CarouselCard\n key={keyString}\n $onlyChild={onlyChild}\n $fullWidthChild={fullWidthChild}\n >\n <InView\n threshold={0.5}\n as=\"div\"\n onChange={(inView) => {\n if (inView) {\n setPosition(index);\n }\n }}\n >\n <CarouselCardInner\n $onlyChild={onlyChild}\n $isSelected={isSelected}\n $shrinkUnselectedPages={shrinkUnselectedPages}\n $fullWidthChild={fullWidthChild}\n >\n {child}\n </CarouselCardInner>\n </InView>\n </CarouselCard>\n );\n })}\n </CarouselScrollArea>\n </CarouselWrapper>\n </Box>\n {childArray.length > 1 ? (\n <Box>\n <Dots\n count={childArray.length}\n currentPosition={currentPosition}\n scrollToPosition={scrollToPosition}\n next={next}\n previous={previous}\n />\n </Box>\n ) : null}\n </>\n );\n};\n\nexport default memo(Carousel);\n"],"names":["Carousel","_a","startPosition","children","onPositionChanged","_b","shrinkUnselectedPages","_c","fullWidthChild","timer","React","useRef","isStartPositionSet","_d","useState","currentPosition","setCurrentPosition","_e","smoothScrolling","setSmoothScrolling","scrollRef","childArray","Children","toArray","filter","Boolean","scrollToPosition","to","current","containerWidth","scrollWidth","atBegining","atEnd","length","item","newScroll","offsetLeft","scrollTo","useEffect","onlyChild","createElement","Fragment","Box","CarouselWrapper","CarouselScrollArea","ref","tabIndex","map","child","index","isSelected","keyString","concat","CarouselCard","key","$onlyChild","$fullWidthChild","InView","threshold","as","onChange","inView","clearTimeout","setTimeout","CarouselCardInner","$isSelected","$shrinkUnselectedPages","Dots","count","next","previous","memo"],"mappings":"wVAyCO,IAAMA,EAAW,SAACC,OACvBC,EAAaD,EAAAC,cACbC,EAAQF,EAAAE,SACRC,EAAiBH,EAAAG,kBACjBC,EAA6BJ,EAAAK,sBAA7BA,OAAwB,IAAAD,KACxBE,EAAAN,EAAAO,eAAAA,OAAc,IAAAD,GAAQA,EAEhBE,EAAQC,EAAMC,SACdC,OAA8C,IAAlBV,EAC5BW,EAAwCC,EAASZ,GAAiB,GAAjEa,EAAeF,EAAA,GAAEG,OAClBC,EAAwCH,GAAUF,GAAjDM,EAAeD,EAAA,GAAEE,EAAkBF,EAAA,GACpCG,EAAYT,EAAyB,MAGrCU,EAAaX,EAAMY,SAASC,QAAQpB,GAAUqB,OAAOC,SA6BrDC,EAAmB,SAACC,GACxB,GAAIP,aAAS,EAATA,EAAWQ,QAAS,CACtB,IAAMC,EAAiBT,EAAUQ,QAAQE,YAEnCC,EAAoB,IAAPJ,EACbK,EAAQL,IAFKP,EAAUQ,QAAQzB,SAAS8B,OAEZ,EAE5BC,EAAOd,EAAUQ,QAAQzB,SAASwB,GACxC,IAAKO,EAAM,OACX,IAAMC,EAAYD,EAAKE,WAEnBL,EACFX,EAAUQ,QAAQS,SAAS,EAAG,GACrBL,EACTZ,EAAUQ,QAAQS,SAASR,EAAgB,GAE3CT,EAAUQ,QAAQS,SAASF,EAAW,GAInCjB,GACHC,GAAmB,GAGxB,EAGDmB,GAAU,WACJ1B,GACFO,GAAmB,EAEvB,GAAG,CAACjB,IAEJoC,GAAU,WACHpB,GACHQ,EAAiBxB,GAAiB,EAEtC,GAAG,CAACgB,IAEJ,IAAMqB,EAAkC,IAAtBlB,EAAWY,OAE7B,OACEvB,EAAA8B,cAAA9B,EAAA+B,SAAA,KACE/B,EAAA8B,cAACE,EAAG,KACFhC,EAAA8B,cAACG,EAAe,KACdjC,EAAC8B,cAAAI,GACCC,IAAKzB,EACK,YAAA,6BACQF,EAClB4B,SAAU,GAETzB,EAAW0B,KAAI,SAACC,EAAOC,GACtB,IAAMC,EAAaD,IAAUlC,EACvBoC,EAAY,QAAQC,OAAAH,GAC1B,OACEvC,EAAC8B,cAAAa,EACC,CAAAC,IAAKH,EAASI,WACFhB,EAASiB,gBACJhD,GAEjBE,EAAA8B,cAACiB,EAAM,CACLC,UAAW,GACXC,GAAG,MACHC,SAAU,SAACC,GA1FT,IAAClC,EA2FGkC,GA1FlB9C,KADeY,EA4FasB,KA1FhCjC,EAAmBW,GAEflB,GACFqD,aAAarD,eAAAA,EAAOmB,SAEtBnB,EAAMmB,QAAUmC,YAAW,WACrB3D,GAAqBc,GAMvBd,EAAkBuB,EAErB,GAAE,QAgFajB,EAAA8B,cAACwB,EAAiB,CAAAT,WACJhB,EAAS0B,YACRf,EACWgB,uBAAA5D,EACPkD,gBAAAhD,GAEhBwC,IAKV,OAIN3B,EAAWY,OAAS,EACnBvB,EAAA8B,cAACE,EAAG,KACFhC,EAAA8B,cAAC2B,EAAI,CACHC,MAAO/C,EAAWY,OAClBlB,gBAAiBA,EACjBW,iBAAkBA,EAClB2C,KAlGG,WACX3C,EAAiBX,EAAkB,EACpC,EAiGSuD,SA/FO,WACf5C,EAAiBX,EAAkB,EACpC,KAgGO,KAGV,EAEewD,EAAKvE"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Carousel/index.tsx"],"sourcesContent":["import React, {\n useState,\n useRef,\n useEffect,\n memo,\n type ReactNode,\n} from \"react\";\nimport { InView } from \"react-intersection-observer\";\n\nimport { Box } from \"../Box\";\nimport { Dots } from \"./Dots\";\n\nimport {\n CarouselWrapper,\n CarouselCardInner,\n CarouselCard,\n CarouselScrollArea,\n} from \"./styles\";\n\nexport type CarouselProps = {\n /** Index in which the carousel is scrolled to on mount */\n startPosition?: number;\n /** call back for on position changed first prop is the possition */\n onPositionChanged?: (position: number) => void;\n /** show item left and right of current smaller than current item */\n shrinkUnselectedPages?: boolean;\n /** childrent item of the carousel */\n children?: ReactNode;\n /** set carousel image to full width of parent */\n fullWidthChild?: boolean;\n};\n\n/**\n *\n * Lightweight carousel component that works with mouse and touch events,\n * Accepts react node array as children so will work with any html element as a child.\n *\n * Also works with external state that holds carousel postion,\n * by accepting a starting position as a prop, whilst also accepting a handler\n * with current position as a prop triggered when carousel component is interacted with.\n */\nexport const Carousel = ({\n startPosition,\n children,\n onPositionChanged,\n shrinkUnselectedPages = false,\n fullWidthChild = false,\n}: CarouselProps) => {\n const timer = React.useRef<NodeJS.Timeout | string | number | undefined>();\n const isStartPositionSet = typeof startPosition !== \"undefined\";\n const [currentPosition, setCurrentPosition] = useState(startPosition || 0);\n const [smoothScrolling, setSmoothScrolling] = useState(!isStartPositionSet);\n const scrollRef = useRef<HTMLUListElement>(null);\n\n // remove null children\n const childArray = React.Children.toArray(children).filter(Boolean);\n\n const setPosition = (to: number) => {\n if (currentPosition === to) return;\n setCurrentPosition(to);\n\n if (timer) {\n clearTimeout(timer?.current);\n }\n timer.current = setTimeout(() => {\n if (onPositionChanged && smoothScrolling) {\n // Timer to debounce and only send the new position at the end of the scroll.\n // When using external state which also sets start position,\n // if scrolling to a new position past multiple cards,\n // it would effectively scroll to the past the first adjacent card,\n // receive the postion of the first card and stop there before it scrolls any further.\n onPositionChanged(to);\n }\n }, 500);\n };\n\n const next = () => {\n scrollToPosition(currentPosition + 1);\n };\n\n const previous = () => {\n scrollToPosition(currentPosition - 1);\n };\n\n const scrollToPosition = (to: number) => {\n if (scrollRef?.current) {\n const containerWidth = scrollRef.current.scrollWidth;\n const totalItems = scrollRef.current.children.length;\n const atBegining = to === 0;\n const atEnd = to === totalItems - 1;\n\n const item = scrollRef.current.children[to] as HTMLElement;\n if (!item) return;\n const newScroll = item.offsetLeft;\n\n if (atBegining) {\n scrollRef.current.scrollTo(0, 0);\n } else if (atEnd) {\n scrollRef.current.scrollTo(containerWidth, 0);\n } else {\n scrollRef.current.scrollTo(newScroll, 0);\n }\n\n // always resume normal smooth scrolling behaviour after the first scroll\n if (!smoothScrolling) {\n setSmoothScrolling(true);\n }\n }\n };\n\n // Stop smooth scrolling when moving to a starting position\n useEffect(() => {\n if (isStartPositionSet) {\n setSmoothScrolling(false);\n }\n }, [startPosition]);\n\n useEffect(() => {\n if (!smoothScrolling) {\n scrollToPosition(startPosition || 0);\n }\n }, [smoothScrolling]);\n\n const onlyChild = childArray.length === 1;\n\n return (\n <>\n <Box>\n <CarouselWrapper>\n <CarouselScrollArea\n ref={scrollRef}\n aria-live=\"assertive\"\n $smoothScrolling={smoothScrolling}\n tabIndex={0}\n >\n {childArray.map((child, index) => {\n const isSelected = index === currentPosition;\n const keyString = `card-${index}`;\n return (\n <CarouselCard\n key={keyString}\n $onlyChild={onlyChild}\n $fullWidthChild={fullWidthChild}\n >\n <InView\n threshold={0.5}\n as=\"div\"\n onChange={(inView) => {\n if (inView) {\n setPosition(index);\n }\n }}\n >\n <CarouselCardInner\n $onlyChild={onlyChild}\n $isSelected={isSelected}\n $shrinkUnselectedPages={shrinkUnselectedPages}\n $fullWidthChild={fullWidthChild}\n >\n {child}\n </CarouselCardInner>\n </InView>\n </CarouselCard>\n );\n })}\n </CarouselScrollArea>\n </CarouselWrapper>\n </Box>\n {childArray.length > 1 ? (\n <Box>\n <Dots\n count={childArray.length}\n currentPosition={currentPosition}\n scrollToPosition={scrollToPosition}\n next={next}\n previous={previous}\n />\n </Box>\n ) : null}\n </>\n );\n};\n\nexport default memo(Carousel);\n"],"names":["Carousel","startPosition","children","onPositionChanged","shrinkUnselectedPages","fullWidthChild","timer","React","useRef","isStartPositionSet","currentPosition","setCurrentPosition","useState","smoothScrolling","setSmoothScrolling","scrollRef","childArray","Children","toArray","filter","Boolean","scrollToPosition","to","current","containerWidth","scrollWidth","atBegining","atEnd","length","item","newScroll","offsetLeft","scrollTo","useEffect","onlyChild","createElement","Fragment","Box","CarouselWrapper","CarouselScrollArea","ref","$smoothScrolling","tabIndex","map","child","index","isSelected","keyString","CarouselCard","key","$onlyChild","$fullWidthChild","InView","threshold","as","onChange","inView","clearTimeout","setTimeout","CarouselCardInner","$isSelected","$shrinkUnselectedPages","Dots","count","next","previous","memo"],"mappings":"8VAyCaA,EAAW,EACtBC,gBACAC,WACAC,oBACAC,yBAAwB,EACxBC,kBAAiB,MAEjB,MAAMC,EAAQC,EAAMC,SACdC,OAA8C,IAAlBR,GAC3BS,EAAiBC,GAAsBC,EAASX,GAAiB,IACjEY,EAAiBC,GAAsBF,GAAUH,GAClDM,EAAYP,EAAyB,MAGrCQ,EAAaT,EAAMU,SAASC,QAAQhB,GAAUiB,OAAOC,SA6BrDC,EAAoBC,IACxB,GAAIP,GAAWQ,QAAS,CACtB,MAAMC,EAAiBT,EAAUQ,QAAQE,YAEnCC,EAAoB,IAAPJ,EACbK,EAAQL,IAFKP,EAAUQ,QAAQrB,SAAS0B,OAEZ,EAE5BC,EAAOd,EAAUQ,QAAQrB,SAASoB,GACxC,IAAKO,EAAM,OACX,MAAMC,EAAYD,EAAKE,WAEnBL,EACFX,EAAUQ,QAAQS,SAAS,EAAG,GACrBL,EACTZ,EAAUQ,QAAQS,SAASR,EAAgB,GAE3CT,EAAUQ,QAAQS,SAASF,EAAW,GAInCjB,GACHC,GAAmB,KAMzBmB,GAAU,KACJxB,GACFK,GAAmB,KAEpB,CAACb,IAEJgC,GAAU,KACHpB,GACHQ,EAAiBpB,GAAiB,KAEnC,CAACY,IAEJ,MAAMqB,EAAkC,IAAtBlB,EAAWY,OAE7B,OACErB,EAAA4B,cAAA5B,EAAA6B,SAAA,KACE7B,EAAA4B,cAACE,EAAG,KACF9B,EAAA4B,cAACG,EAAe,KACd/B,EAAC4B,cAAAI,GACCC,IAAKzB,EACK,YAAA,YACQ0B,iBAAA5B,EAClB6B,SAAU,GAET1B,EAAW2B,KAAI,CAACC,EAAOC,KACtB,MAAMC,EAAaD,IAAUnC,EACvBqC,EAAY,QAAQF,IAC1B,OACEtC,EAAC4B,cAAAa,EACC,CAAAC,IAAKF,EAASG,WACFhB,EAASiB,gBACJ9C,GAEjBE,EAAA4B,cAACiB,EAAM,CACLC,UAAW,GACXC,GAAG,MACHC,SAAWC,IA1FT,IAAClC,EA2FGkC,GA1FlB9C,KADeY,EA4FauB,KA1FhClC,EAAmBW,GAEfhB,GACFmD,aAAanD,GAAOiB,SAEtBjB,EAAMiB,QAAUmC,YAAW,KACrBvD,GAAqBU,GAMvBV,EAAkBmB,KAEnB,QAgFaf,EAAA4B,cAACwB,EAAiB,CAAAT,WACJhB,EAAS0B,YACRd,EACWe,uBAAAzD,EACP+C,gBAAA9C,GAEhBuC,IAGQ,OAMxB5B,EAAWY,OAAS,EACnBrB,EAAA4B,cAACE,EAAG,KACF9B,EAAA4B,cAAC2B,EAAI,CACHC,MAAO/C,EAAWY,OAClBlB,gBAAiBA,EACjBW,iBAAkBA,EAClB2C,KAlGG,KACX3C,EAAiBX,EAAkB,EAAE,EAkG7BuD,SA/FO,KACf5C,EAAiBX,EAAkB,EAAE,KAiG/B,KACH,EAIQwD,EAAKlE"}
@@ -1,2 +1,97 @@
1
- import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import e from"styled-components";var o,t,r,i,a,s,l,c,d,p,h=e.div(o||(o=n(["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"],["\n position: relative;\n width: 100%;\n overflow-y: hidden;\n"]))),m=e.ul(t||(t=n(["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"],["\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ",";\n -webkit-overflow-scrolling: touch;\n white-space: nowrap;\n padding-left: 0;\n padding-right: 0;\n padding-bottom: 20px;\n margin-bottom: -20px;\n height: 100%;\n"])),(function(n){return n.$smoothScrolling?"smooth":"auto"})),u=e.li(r||(r=n(["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"],["\n scroll-snap-align: center;\n display: inline-block;\n width: ",";\n"])),(function(n){var e=n.$onlyChild,o=n.$fullWidthChild;return e||o?"100%":"80%"})),f=e.div(i||(i=n(["\n transition: transform 0.2s linear;\n transform: ",";\n"],["\n transition: transform 0.2s linear;\n transform: ",";\n"])),(function(n){var e=n.$isSelected,o=n.$shrinkUnselectedPages,t=n.$onlyChild,r=n.$fullWidthChild;return t||e&&o||r?"scale(1)":"scale(0.9)"})),g=e.div(a||(a=n(["\n display: flex;\n justify-content: center;\n"],["\n display: flex;\n justify-content: center;\n"]))),b=e.span(s||(s=n(["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"],["\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n"]))),x=e.button(l||(l=n(["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"],["\n height: 100%;\n cursor: pointer;\n background-color: rgba(255, 255, 255, 0);\n border: none;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n color: ",";\n font-size: ",";\n font-weight: 600;\n transition:\n color 0.3s ease,\n transform 0.3s ease;\n max-width: 3rem;\n padding: 0;\n vertical-align: middle;\n user-select: none;\n\n transform: scale(0.8);\n &:hover {\n transform: ",";\n }\n"])),(function(n){var e=n.disabled,o=n.theme;return e?o.colors.disabled:"su2c"===o.name?o.colors.textDark:o.colors.primary}),(function(n){return n.theme.fontSizes.xxxl}),(function(n){return n.disabled?"scale(0.8)":"scale(1)"})),w=e.div(c||(c=n(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"],["\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ",";\n\n @media (min-width: ",") {\n display: ",";\n }\n\n @media (min-width: ",") {\n display: ",";\n }\n"])),(function(n){return n.$count>6?"none":"flex"}),(function(n){return n.theme.breakpoint.tablet}),(function(n){return n.$count>10?"none":"flex"}),(function(n){return n.theme.breakpoint.desktop}),(function(n){return n.$count>20?"none":"flex"})),y=e.button(d||(d=n(["\n border: none;\n outline-offset: ",";\n padding: 0;\n margin: ",";\n width: ",";\n height: ",";\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ",";\n background-color: ",";\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n"],["\n border: none;\n outline-offset: ",";\n padding: 0;\n margin: ",";\n width: ",";\n height: ",";\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ",";\n background-color: ",";\n user-select: none;\n transition:\n background-color 0.3s ease,\n transform 0.3s ease;\n transform: scale(0.8);\n &:hover {\n transform: scale(1);\n }\n"])),(function(n){return n.theme.spacing.xxs}),(function(n){var e=n.theme;return"auto ".concat(e.spacing.xxs)}),(function(n){return n.theme.fontSizes.l}),(function(n){return n.theme.fontSizes.l}),(function(n){var e=n.theme;return"solid 1px ".concat("su2c"===e.name?e.colors.textDark:e.colors.primary)}),(function(n){var e=n.theme;return n.$selected?"".concat("su2c"===e.name?e.colors.textDark:e.colors.primary):e.colors.backgroundLight})),v=e.span(p||(p=n(["\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n"],["\n border: 0px;\n clip: rect(0px, 0px, 0px, 0px);\n height: 1px;\n margin-bottom: -1px;\n margin-right: -1px;\n overflow: hidden;\n padding: 0px;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n"])));export{g as ButtonWrapper,x as CarouselButton,u as CarouselCard,f as CarouselCardInner,m as CarouselScrollArea,h as CarouselWrapper,y as Dot,w as DotContainer,v as ScreenReaderOnly,b as VerticalAlign};
1
+ import e from"styled-components";const o=e.div`
2
+ position: relative;
3
+ width: 100%;
4
+ overflow-y: hidden;
5
+ `,t=e.ul`
6
+ position: relative;
7
+ overflow-x: scroll;
8
+ scroll-snap-type: x mandatory;
9
+ scroll-behavior: ${({$smoothScrolling:e})=>e?"smooth":"auto"};
10
+ -webkit-overflow-scrolling: touch;
11
+ white-space: nowrap;
12
+ padding-left: 0;
13
+ padding-right: 0;
14
+ padding-bottom: 20px;
15
+ margin-bottom: -20px;
16
+ height: 100%;
17
+ `,i=e.li`
18
+ scroll-snap-align: center;
19
+ display: inline-block;
20
+ width: ${({$onlyChild:e,$fullWidthChild:o})=>e||o?"100%":"80%"};
21
+ `,r=e.div`
22
+ transition: transform 0.2s linear;
23
+ transform: ${({$isSelected:e,$shrinkUnselectedPages:o,$onlyChild:t,$fullWidthChild:i})=>t||e&&o||i?"scale(1)":"scale(0.9)"};
24
+ `,n=e.div`
25
+ display: flex;
26
+ justify-content: center;
27
+ `,s=e.span`
28
+ display: block;
29
+ margin: auto;
30
+ height: 2rem;
31
+ line-height: 1.75rem;
32
+ `,l=e.button`
33
+ height: 100%;
34
+ cursor: pointer;
35
+ background-color: rgba(255, 255, 255, 0);
36
+ border: none;
37
+ /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */
38
+ color: ${({disabled:e,theme:o})=>e?o.colors.disabled:"su2c"===o.name?o.colors.textDark:o.colors.primary};
39
+ font-size: ${({theme:e})=>e.fontSizes.xxxl};
40
+ font-weight: 600;
41
+ transition:
42
+ color 0.3s ease,
43
+ transform 0.3s ease;
44
+ max-width: 3rem;
45
+ padding: 0;
46
+ vertical-align: middle;
47
+ user-select: none;
48
+
49
+ transform: scale(0.8);
50
+ &:hover {
51
+ transform: ${({disabled:e})=>e?"scale(0.8)":"scale(1)"};
52
+ }
53
+ `,a=e.div`
54
+ display: flex;
55
+ flex-direction: row;
56
+ justify-content: center;
57
+ display: ${({$count:e})=>e>6?"none":"flex"};
58
+
59
+ @media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
60
+ display: ${({$count:e})=>e>10?"none":"flex"};
61
+ }
62
+
63
+ @media (min-width: ${({theme:e})=>e.breakpoint.desktop}) {
64
+ display: ${({$count:e})=>e>20?"none":"flex"};
65
+ }
66
+ `,d=e.button`
67
+ border: none;
68
+ outline-offset: ${({theme:e})=>e.spacing.xxs};
69
+ padding: 0;
70
+ margin: ${({theme:e})=>`auto ${e.spacing.xxs}`};
71
+ width: ${({theme:e})=>e.fontSizes.l};
72
+ height: ${({theme:e})=>e.fontSizes.l};
73
+ border-radius: 50%;
74
+ /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */
75
+ border: ${({theme:e})=>`solid 1px ${"su2c"===e.name?e.colors.textDark:e.colors.primary}`};
76
+ background-color: ${({theme:e,$selected:o})=>o?`${"su2c"===e.name?e.colors.textDark:e.colors.primary}`:e.colors.backgroundLight};
77
+ user-select: none;
78
+ transition:
79
+ background-color 0.3s ease,
80
+ transform 0.3s ease;
81
+ transform: scale(0.8);
82
+ &:hover {
83
+ transform: scale(1);
84
+ }
85
+ `,c=e.span`
86
+ border: 0px;
87
+ clip: rect(0px, 0px, 0px, 0px);
88
+ height: 1px;
89
+ margin-bottom: -1px;
90
+ margin-right: -1px;
91
+ overflow: hidden;
92
+ padding: 0px;
93
+ position: absolute;
94
+ white-space: nowrap;
95
+ width: 1px;
96
+ `;export{n as ButtonWrapper,l as CarouselButton,i as CarouselCard,r as CarouselCardInner,t as CarouselScrollArea,o as CarouselWrapper,d as Dot,a as DotContainer,c as ScreenReaderOnly,s as VerticalAlign};
2
97
  //# sourceMappingURL=styles.js.map