@cruk/cruk-react-components 4.2.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (593) hide show
  1. package/README.md +31 -71
  2. package/lib/components/AddressLookup/AddressLookup.stories.d.ts +1 -15
  3. package/lib/components/AddressLookup/index.d.ts +3 -30
  4. package/lib/components/AddressLookup/styles.d.ts +13 -9
  5. package/lib/components/AllThemesWrapper.d.ts +2 -2
  6. package/lib/components/Avatar/Avatar.stories.d.ts +2 -3
  7. package/lib/components/Avatar/index.d.ts +2 -2
  8. package/lib/components/Avatar/styles.d.ts +2 -2
  9. package/lib/components/Badge/Badge.stories.d.ts +2 -3
  10. package/lib/components/Badge/index.d.ts +3 -3
  11. package/lib/components/Badge/styles.d.ts +2 -2
  12. package/lib/components/Box/Box.stories.d.ts +1 -1
  13. package/lib/components/Box/index.d.ts +7 -6
  14. package/lib/components/Box/styles.d.ts +7 -6
  15. package/lib/components/Button/Button.stories.d.ts +1 -11
  16. package/lib/components/Button/index.d.ts +5 -23
  17. package/lib/components/Button/styles.d.ts +4 -4
  18. package/lib/components/Carousel/Carousel.stories.d.ts +1 -0
  19. package/lib/components/Carousel/Dots.d.ts +1 -1
  20. package/lib/components/Carousel/index.d.ts +7 -2
  21. package/lib/components/Carousel/styles.d.ts +16 -14
  22. package/lib/components/Checkbox/Checkbox.stories.d.ts +2 -7
  23. package/lib/components/Checkbox/index.d.ts +3 -10
  24. package/lib/components/Checkbox/styles.d.ts +6 -6
  25. package/lib/components/Collapse/Collapse.stories.d.ts +1 -1
  26. package/lib/components/Collapse/index.d.ts +3 -3
  27. package/lib/components/Collapse/styles.d.ts +15 -21
  28. package/lib/components/DateField/DateField.stories.d.ts +1 -2
  29. package/lib/components/DateField/index.d.ts +2 -2
  30. package/lib/components/DateField/styles.d.ts +10 -6
  31. package/lib/components/Divider.d.ts +1 -1
  32. package/lib/components/ErrorText/ErrorText.stories.d.ts +1 -2
  33. package/lib/components/ErrorText/index.d.ts +3 -3
  34. package/lib/components/ErrorText/styles.d.ts +4 -2
  35. package/lib/components/Flex.d.ts +6 -2
  36. package/lib/components/Fontface.d.ts +4 -2
  37. package/lib/components/Footer/Footer.stories.d.ts +1 -1
  38. package/lib/components/Footer/index.d.ts +2 -2
  39. package/lib/components/Footer/styles.d.ts +18 -12
  40. package/lib/components/GlobalStyle.d.ts +2 -8
  41. package/lib/components/GlobalStyleNoFontFace.d.ts +2 -8
  42. package/lib/components/Header/Header.stories.d.ts +2 -2
  43. package/lib/components/Header/index.d.ts +2 -2
  44. package/lib/components/Header/styles.d.ts +20 -21
  45. package/lib/components/Heading/Heading.stories.d.ts +1 -2
  46. package/lib/components/Heading/index.d.ts +4 -4
  47. package/lib/components/Heading/styles.d.ts +16 -49
  48. package/lib/components/IconFa/IconFa.stories.d.ts +1 -2
  49. package/lib/components/IconFa/index.d.ts +2 -2
  50. package/lib/components/IconFa/styles.d.ts +7 -4
  51. package/lib/components/InfoBox/InfoBox.stories.d.ts +1 -1
  52. package/lib/components/InfoBox/index.d.ts +3 -3
  53. package/lib/components/InfoBox/styles.d.ts +8 -11
  54. package/lib/components/LabelWrapper/index.d.ts +2 -7
  55. package/lib/components/LabelWrapper/styles.d.ts +9 -7
  56. package/lib/components/LegendWrapper/LegendWrapper.stories.d.ts +2 -3
  57. package/lib/components/LegendWrapper/index.d.ts +2 -2
  58. package/lib/components/LegendWrapper/styles.d.ts +4 -4
  59. package/lib/components/Link/Link.stories.d.ts +1 -7
  60. package/lib/components/Link/index.d.ts +3 -14
  61. package/lib/components/Link/styles.d.ts +10 -17
  62. package/lib/components/Loader/Loader.stories.d.ts +1 -2
  63. package/lib/components/Loader/index.d.ts +1 -1
  64. package/lib/components/Loader/styles.d.ts +3 -3
  65. package/lib/components/Modal/Modal.stories.d.ts +2 -3
  66. package/lib/components/Modal/index.d.ts +3 -3
  67. package/lib/components/Modal/styles.d.ts +9 -15
  68. package/lib/components/Pagination/Pagination.stories.d.ts +1 -2
  69. package/lib/components/Pagination/index.d.ts +2 -2
  70. package/lib/components/Pagination/styles.d.ts +9 -9
  71. package/lib/components/PopOver/Popover.stories.d.ts +2 -2
  72. package/lib/components/PopOver/index.d.ts +3 -3
  73. package/lib/components/PopOver/styles.d.ts +7 -7
  74. package/lib/components/ProgressBar/ProgressBar.stories.d.ts +1 -2
  75. package/lib/components/ProgressBar/index.d.ts +2 -2
  76. package/lib/components/ProgressBar/styles.d.ts +20 -14
  77. package/lib/components/Radio/Radio.stories.d.ts +2 -7
  78. package/lib/components/Radio/index.d.ts +3 -10
  79. package/lib/components/Radio/styles.d.ts +7 -7
  80. package/lib/components/RadioConsent/Radio.stories.d.ts +2 -3
  81. package/lib/components/RadioConsent/index.d.ts +7 -6
  82. package/lib/components/RadioConsent/styles.d.ts +8 -10
  83. package/lib/components/Select/Selelct.stories.d.ts +1 -1
  84. package/lib/components/Select/index.d.ts +3 -3
  85. package/lib/components/Select/styles.d.ts +2 -2
  86. package/lib/components/Spacing/index.d.ts +2 -2
  87. package/lib/components/Step/Step.stories.d.ts +1 -2
  88. package/lib/components/Step/index.d.ts +2 -2
  89. package/lib/components/Step/styles.d.ts +7 -6
  90. package/lib/components/Text/Text.stories.d.ts +1 -1
  91. package/lib/components/Text/index.d.ts +5 -5
  92. package/lib/components/Text/styles.d.ts +4 -14
  93. package/lib/components/TextAreaField/TextAreaField.stories.d.ts +2 -3
  94. package/lib/components/TextAreaField/index.d.ts +3 -3
  95. package/lib/components/TextAreaField/styles.d.ts +2 -2
  96. package/lib/components/TextField/TextField.stories.d.ts +1 -1
  97. package/lib/components/TextField/index.d.ts +2 -2
  98. package/lib/components/TextField/styles.d.ts +11 -7
  99. package/lib/components/ThemeCheatSheet.d.ts +6 -5
  100. package/lib/components/Totaliser/Totaliser.stories.d.ts +1 -2
  101. package/lib/components/Totaliser/index.d.ts +2 -2
  102. package/lib/components/Totaliser/styles.d.ts +14 -12
  103. package/lib/components/UserBlock/UserBlock.stories.d.ts +1 -2
  104. package/lib/components/UserBlock/index.d.ts +2 -2
  105. package/lib/components/UserBlock/styles.d.ts +5 -5
  106. package/lib/components/index.d.ts +41 -41
  107. package/lib/hooks/useEffectBrowser.d.ts +1 -1
  108. package/lib/hooks/useKey.d.ts +3 -3
  109. package/lib/hooks/useLayoutEffectBrowser.d.ts +1 -1
  110. package/lib/hooks/useScrollPosition.d.ts +1 -1
  111. package/lib/node_modules/@babel/runtime/helpers/esm/defineProperty.js.map +1 -0
  112. package/lib/node_modules/@babel/runtime/helpers/esm/extends.js +2 -0
  113. package/lib/node_modules/@babel/runtime/helpers/esm/extends.js.map +1 -0
  114. package/lib/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +1 -0
  115. package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +2 -0
  116. package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -0
  117. package/lib/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +1 -0
  118. package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +2 -0
  119. package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +1 -0
  120. package/lib/{es/node_modules → node_modules}/@babel/runtime/helpers/esm/toPropertyKey.js +1 -1
  121. package/lib/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js.map +1 -0
  122. package/lib/node_modules/@babel/runtime/helpers/esm/typeof.js.map +1 -0
  123. package/lib/{es/node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js → node_modules/@fortawesome/free-solid-svg-icons/index.js} +1 -1
  124. package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +1 -0
  125. package/lib/node_modules/focus-lock/dist/es2015/commands.js +2 -0
  126. package/lib/node_modules/focus-lock/dist/es2015/commands.js.map +1 -0
  127. package/lib/node_modules/focus-lock/dist/es2015/constants.js.map +1 -0
  128. package/lib/node_modules/focus-lock/dist/es2015/focusInside.js.map +1 -0
  129. package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +1 -0
  130. package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js +2 -0
  131. package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js.map +1 -0
  132. package/lib/node_modules/focus-lock/dist/es2015/focusables.js +2 -0
  133. package/lib/node_modules/focus-lock/dist/es2015/focusables.js.map +1 -0
  134. package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +1 -0
  135. package/lib/node_modules/focus-lock/dist/es2015/return-focus.js +2 -0
  136. package/lib/node_modules/focus-lock/dist/es2015/return-focus.js.map +1 -0
  137. package/lib/node_modules/focus-lock/dist/es2015/sibling.js +2 -0
  138. package/lib/node_modules/focus-lock/dist/es2015/sibling.js.map +1 -0
  139. package/lib/node_modules/focus-lock/dist/es2015/solver.js +2 -0
  140. package/lib/node_modules/focus-lock/dist/es2015/solver.js.map +1 -0
  141. package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +1 -0
  142. package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js.map +1 -0
  143. package/lib/node_modules/focus-lock/dist/es2015/utils/array.js.map +1 -0
  144. package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +1 -0
  145. package/lib/node_modules/focus-lock/dist/es2015/utils/correctFocus.js.map +1 -0
  146. package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/firstFocus.js +1 -1
  147. package/lib/node_modules/focus-lock/dist/es2015/utils/firstFocus.js.map +1 -0
  148. package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +1 -0
  149. package/lib/node_modules/focus-lock/dist/es2015/utils/is.js +2 -0
  150. package/lib/node_modules/focus-lock/dist/es2015/utils/is.js.map +1 -0
  151. package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +1 -0
  152. package/lib/node_modules/focus-lock/dist/es2015/utils/safe.js.map +1 -0
  153. package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js +2 -0
  154. package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +1 -0
  155. package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +1 -0
  156. package/lib/node_modules/focus-lock/dist/es2015/utils/tabbables.js.map +1 -0
  157. package/lib/node_modules/react-clientside-effect/lib/index.es.js.map +1 -0
  158. package/lib/{es/node_modules → node_modules}/react-focus-lock/dist/es2015/Combination.js +1 -1
  159. package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js.map +1 -0
  160. package/lib/node_modules/react-focus-lock/dist/es2015/FocusGuard.js.map +1 -0
  161. package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js +2 -0
  162. package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -0
  163. package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js +2 -0
  164. package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -0
  165. package/lib/node_modules/react-focus-lock/dist/es2015/index.js +2 -0
  166. package/lib/node_modules/react-focus-lock/dist/es2015/medium.js +2 -0
  167. package/lib/node_modules/react-focus-lock/dist/es2015/medium.js.map +1 -0
  168. package/lib/node_modules/react-focus-lock/dist/es2015/scope.js +2 -0
  169. package/lib/node_modules/react-focus-lock/dist/es2015/scope.js.map +1 -0
  170. package/lib/node_modules/react-focus-lock/dist/es2015/util.js +2 -0
  171. package/lib/node_modules/react-focus-lock/dist/es2015/util.js.map +1 -0
  172. package/lib/node_modules/react-intersection-observer/dist/index.js +2 -0
  173. package/lib/node_modules/react-intersection-observer/dist/index.js.map +1 -0
  174. package/lib/{es/_virtual/_tslib.js → node_modules/tslib/tslib.es6.js} +1 -1
  175. package/lib/node_modules/tslib/tslib.es6.js.map +1 -0
  176. package/lib/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -0
  177. package/lib/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +2 -0
  178. package/lib/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -0
  179. package/lib/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -0
  180. package/lib/node_modules/use-sidecar/dist/es2015/medium.js +2 -0
  181. package/lib/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -0
  182. package/lib/src/components/AddressLookup/index.js +2 -0
  183. package/lib/src/components/AddressLookup/index.js.map +1 -0
  184. package/lib/src/components/AddressLookup/styles.js +2 -0
  185. package/lib/src/components/AddressLookup/styles.js.map +1 -0
  186. package/lib/src/components/Avatar/index.js +2 -0
  187. package/lib/src/components/Avatar/index.js.map +1 -0
  188. package/lib/src/components/Avatar/styles.js +2 -0
  189. package/lib/src/components/Avatar/styles.js.map +1 -0
  190. package/lib/src/components/Badge/index.js +2 -0
  191. package/lib/src/components/Badge/index.js.map +1 -0
  192. package/lib/src/components/Badge/styles.js +2 -0
  193. package/lib/src/components/Badge/styles.js.map +1 -0
  194. package/lib/src/components/Box/index.js +2 -0
  195. package/lib/src/components/Box/index.js.map +1 -0
  196. package/lib/src/components/Box/styles.js +2 -0
  197. package/lib/src/components/Box/styles.js.map +1 -0
  198. package/lib/src/components/Button/index.js +2 -0
  199. package/lib/src/components/Button/index.js.map +1 -0
  200. package/lib/src/components/Button/styles.js +2 -0
  201. package/lib/src/components/Button/styles.js.map +1 -0
  202. package/lib/src/components/Carousel/Dots.js +2 -0
  203. package/lib/src/components/Carousel/Dots.js.map +1 -0
  204. package/lib/src/components/Carousel/index.js +2 -0
  205. package/lib/src/components/Carousel/index.js.map +1 -0
  206. package/lib/src/components/Carousel/styles.js +2 -0
  207. package/lib/src/components/Carousel/styles.js.map +1 -0
  208. package/lib/src/components/Checkbox/index.js +2 -0
  209. package/lib/src/components/Checkbox/index.js.map +1 -0
  210. package/lib/src/components/Checkbox/styles.js +2 -0
  211. package/lib/src/components/Checkbox/styles.js.map +1 -0
  212. package/lib/src/components/Collapse/index.js +2 -0
  213. package/lib/src/components/Collapse/index.js.map +1 -0
  214. package/lib/src/components/Collapse/styles.js +2 -0
  215. package/lib/src/components/Collapse/styles.js.map +1 -0
  216. package/lib/src/components/DateField/index.js +2 -0
  217. package/lib/src/components/DateField/index.js.map +1 -0
  218. package/lib/src/components/DateField/styles.js +2 -0
  219. package/lib/src/components/DateField/styles.js.map +1 -0
  220. package/lib/src/components/Divider.js +2 -0
  221. package/lib/src/components/Divider.js.map +1 -0
  222. package/lib/src/components/ErrorText/index.js +2 -0
  223. package/lib/src/components/ErrorText/index.js.map +1 -0
  224. package/lib/src/components/ErrorText/styles.js +2 -0
  225. package/lib/src/components/ErrorText/styles.js.map +1 -0
  226. package/lib/src/components/Flex.js +2 -0
  227. package/lib/src/components/Flex.js.map +1 -0
  228. package/lib/src/components/Fontface.js +2 -0
  229. package/lib/src/components/Fontface.js.map +1 -0
  230. package/lib/src/components/Footer/index.js +2 -0
  231. package/lib/src/components/Footer/index.js.map +1 -0
  232. package/lib/src/components/Footer/styles.js +2 -0
  233. package/lib/src/components/Footer/styles.js.map +1 -0
  234. package/lib/src/components/GlobalStyle.js +2 -0
  235. package/lib/src/components/GlobalStyle.js.map +1 -0
  236. package/lib/src/components/GlobalStyleNoFontFace.js +2 -0
  237. package/lib/src/components/GlobalStyleNoFontFace.js.map +1 -0
  238. package/lib/src/components/Header/index.js +2 -0
  239. package/lib/src/components/Header/index.js.map +1 -0
  240. package/lib/src/components/Header/styles.js +2 -0
  241. package/lib/src/components/Header/styles.js.map +1 -0
  242. package/lib/src/components/Heading/index.js +2 -0
  243. package/lib/src/components/Heading/index.js.map +1 -0
  244. package/lib/src/components/Heading/styles.js +2 -0
  245. package/lib/src/components/Heading/styles.js.map +1 -0
  246. package/lib/src/components/IconFa/index.js +2 -0
  247. package/lib/src/components/IconFa/index.js.map +1 -0
  248. package/lib/src/components/IconFa/styles.js +2 -0
  249. package/lib/src/components/IconFa/styles.js.map +1 -0
  250. package/lib/src/components/InfoBox/index.js +2 -0
  251. package/lib/src/components/InfoBox/index.js.map +1 -0
  252. package/lib/src/components/InfoBox/styles.js +2 -0
  253. package/lib/src/components/InfoBox/styles.js.map +1 -0
  254. package/lib/src/components/LabelWrapper/index.js +2 -0
  255. package/lib/src/components/LabelWrapper/index.js.map +1 -0
  256. package/lib/src/components/LabelWrapper/styles.js +2 -0
  257. package/lib/src/components/LabelWrapper/styles.js.map +1 -0
  258. package/lib/src/components/LegendWrapper/index.js +2 -0
  259. package/lib/src/components/LegendWrapper/index.js.map +1 -0
  260. package/lib/src/components/LegendWrapper/styles.js +2 -0
  261. package/lib/src/components/LegendWrapper/styles.js.map +1 -0
  262. package/lib/src/components/Link/index.js +2 -0
  263. package/lib/src/components/Link/index.js.map +1 -0
  264. package/lib/src/components/Link/styles.js +2 -0
  265. package/lib/src/components/Link/styles.js.map +1 -0
  266. package/lib/src/components/Loader/index.js +2 -0
  267. package/lib/src/components/Loader/index.js.map +1 -0
  268. package/lib/src/components/Loader/styles.js +2 -0
  269. package/lib/src/components/Loader/styles.js.map +1 -0
  270. package/lib/src/components/Modal/index.js +2 -0
  271. package/lib/src/components/Modal/index.js.map +1 -0
  272. package/lib/src/components/Modal/styles.js +2 -0
  273. package/lib/src/components/Modal/styles.js.map +1 -0
  274. package/lib/src/components/Pagination/index.js +2 -0
  275. package/lib/src/components/Pagination/index.js.map +1 -0
  276. package/lib/src/components/Pagination/styles.js +2 -0
  277. package/lib/src/components/Pagination/styles.js.map +1 -0
  278. package/lib/src/components/PopOver/index.js +2 -0
  279. package/lib/src/components/PopOver/index.js.map +1 -0
  280. package/lib/src/components/PopOver/styles.js +2 -0
  281. package/lib/src/components/PopOver/styles.js.map +1 -0
  282. package/lib/src/components/ProgressBar/index.js +2 -0
  283. package/lib/src/components/ProgressBar/index.js.map +1 -0
  284. package/lib/src/components/ProgressBar/styles.js +2 -0
  285. package/lib/src/components/ProgressBar/styles.js.map +1 -0
  286. package/lib/src/components/Radio/index.js +2 -0
  287. package/lib/src/components/Radio/index.js.map +1 -0
  288. package/lib/src/components/Radio/styles.js +2 -0
  289. package/lib/src/components/Radio/styles.js.map +1 -0
  290. package/lib/src/components/RadioConsent/index.js +2 -0
  291. package/lib/src/components/RadioConsent/index.js.map +1 -0
  292. package/lib/src/components/RadioConsent/styles.js +2 -0
  293. package/lib/src/components/RadioConsent/styles.js.map +1 -0
  294. package/lib/src/components/Select/index.js +2 -0
  295. package/lib/src/components/Select/index.js.map +1 -0
  296. package/lib/src/components/Select/styles.js +2 -0
  297. package/lib/src/components/Select/styles.js.map +1 -0
  298. package/lib/src/components/Spacing/index.js +2 -0
  299. package/lib/src/components/Spacing/index.js.map +1 -0
  300. package/lib/src/components/Step/index.js +2 -0
  301. package/lib/src/components/Step/index.js.map +1 -0
  302. package/lib/src/components/Step/styles.js +2 -0
  303. package/lib/src/components/Step/styles.js.map +1 -0
  304. package/lib/src/components/Text/index.js +2 -0
  305. package/lib/src/components/Text/index.js.map +1 -0
  306. package/lib/src/components/Text/styles.js +2 -0
  307. package/lib/src/components/Text/styles.js.map +1 -0
  308. package/lib/src/components/TextAreaField/index.js +2 -0
  309. package/lib/src/components/TextAreaField/index.js.map +1 -0
  310. package/lib/src/components/TextAreaField/styles.js +2 -0
  311. package/lib/src/components/TextAreaField/styles.js.map +1 -0
  312. package/lib/src/components/TextField/index.js +2 -0
  313. package/lib/src/components/TextField/index.js.map +1 -0
  314. package/lib/src/components/TextField/styles.js +2 -0
  315. package/lib/src/components/TextField/styles.js.map +1 -0
  316. package/lib/src/components/Totaliser/index.js +2 -0
  317. package/lib/src/components/Totaliser/index.js.map +1 -0
  318. package/lib/src/components/Totaliser/styles.js +2 -0
  319. package/lib/src/components/Totaliser/styles.js.map +1 -0
  320. package/lib/src/components/UserBlock/index.js +2 -0
  321. package/lib/src/components/UserBlock/index.js.map +1 -0
  322. package/lib/src/components/UserBlock/styles.js +2 -0
  323. package/lib/src/components/UserBlock/styles.js.map +1 -0
  324. package/lib/src/components/index.js +2 -0
  325. package/lib/src/hooks/useEffectBrowser.js.map +1 -0
  326. package/lib/src/hooks/useKey.js.map +1 -0
  327. package/lib/src/hooks/useLayoutEffectBrowser.js.map +1 -0
  328. package/lib/{es/src → src}/hooks/useScrollPosition.js +1 -1
  329. package/lib/src/hooks/useScrollPosition.js.map +1 -0
  330. package/lib/src/themes/bowelbabe.js +2 -0
  331. package/lib/src/themes/bowelbabe.js.map +1 -0
  332. package/lib/{es/src → src}/themes/cruk.js +1 -1
  333. package/lib/src/themes/cruk.js.map +1 -0
  334. package/lib/src/themes/rfl.js +2 -0
  335. package/lib/src/themes/rfl.js.map +1 -0
  336. package/lib/src/themes/su2c.js +2 -0
  337. package/lib/src/themes/su2c.js.map +1 -0
  338. package/lib/src/utils/Helper.js +2 -0
  339. package/lib/src/utils/Helper.js.map +1 -0
  340. package/lib/{es/src → src}/utils/debounce.js +1 -1
  341. package/lib/src/utils/debounce.js.map +1 -0
  342. package/lib/themes/bowelbabe.d.ts +3 -3
  343. package/lib/themes/cruk.d.ts +3 -3
  344. package/lib/themes/rfl.d.ts +3 -3
  345. package/lib/themes/su2c.d.ts +3 -3
  346. package/lib/types.d.ts +1 -3
  347. package/lib/utils/debounce.d.ts +2 -2
  348. package/package.json +44 -55
  349. package/lib/es/_virtual/_tslib.js.map +0 -1
  350. package/lib/es/node_modules/@babel/runtime/helpers/esm/defineProperty.js.map +0 -1
  351. package/lib/es/node_modules/@babel/runtime/helpers/esm/extends.js +0 -2
  352. package/lib/es/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
  353. package/lib/es/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +0 -1
  354. package/lib/es/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -2
  355. package/lib/es/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +0 -1
  356. package/lib/es/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +0 -1
  357. package/lib/es/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -2
  358. package/lib/es/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +0 -1
  359. package/lib/es/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js.map +0 -1
  360. package/lib/es/node_modules/@babel/runtime/helpers/esm/typeof.js.map +0 -1
  361. package/lib/es/node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js.map +0 -1
  362. package/lib/es/node_modules/focus-lock/dist/es2015/commands.js +0 -2
  363. package/lib/es/node_modules/focus-lock/dist/es2015/commands.js.map +0 -1
  364. package/lib/es/node_modules/focus-lock/dist/es2015/constants.js.map +0 -1
  365. package/lib/es/node_modules/focus-lock/dist/es2015/focusInside.js.map +0 -1
  366. package/lib/es/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +0 -1
  367. package/lib/es/node_modules/focus-lock/dist/es2015/focusSolver.js +0 -2
  368. package/lib/es/node_modules/focus-lock/dist/es2015/focusSolver.js.map +0 -1
  369. package/lib/es/node_modules/focus-lock/dist/es2015/focusables.js +0 -2
  370. package/lib/es/node_modules/focus-lock/dist/es2015/focusables.js.map +0 -1
  371. package/lib/es/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +0 -1
  372. package/lib/es/node_modules/focus-lock/dist/es2015/solver.js +0 -2
  373. package/lib/es/node_modules/focus-lock/dist/es2015/solver.js.map +0 -1
  374. package/lib/es/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +0 -1
  375. package/lib/es/node_modules/focus-lock/dist/es2015/utils/all-affected.js.map +0 -1
  376. package/lib/es/node_modules/focus-lock/dist/es2015/utils/array.js.map +0 -1
  377. package/lib/es/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +0 -1
  378. package/lib/es/node_modules/focus-lock/dist/es2015/utils/correctFocus.js.map +0 -1
  379. package/lib/es/node_modules/focus-lock/dist/es2015/utils/firstFocus.js.map +0 -1
  380. package/lib/es/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +0 -1
  381. package/lib/es/node_modules/focus-lock/dist/es2015/utils/is.js +0 -2
  382. package/lib/es/node_modules/focus-lock/dist/es2015/utils/is.js.map +0 -1
  383. package/lib/es/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +0 -1
  384. package/lib/es/node_modules/focus-lock/dist/es2015/utils/safe.js.map +0 -1
  385. package/lib/es/node_modules/focus-lock/dist/es2015/utils/tabOrder.js +0 -2
  386. package/lib/es/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +0 -1
  387. package/lib/es/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +0 -1
  388. package/lib/es/node_modules/focus-lock/dist/es2015/utils/tabbables.js.map +0 -1
  389. package/lib/es/node_modules/react-clientside-effect/lib/index.es.js.map +0 -1
  390. package/lib/es/node_modules/react-focus-lock/dist/es2015/Combination.js.map +0 -1
  391. package/lib/es/node_modules/react-focus-lock/dist/es2015/FocusGuard.js.map +0 -1
  392. package/lib/es/node_modules/react-focus-lock/dist/es2015/Lock.js +0 -2
  393. package/lib/es/node_modules/react-focus-lock/dist/es2015/Lock.js.map +0 -1
  394. package/lib/es/node_modules/react-focus-lock/dist/es2015/Trap.js +0 -2
  395. package/lib/es/node_modules/react-focus-lock/dist/es2015/Trap.js.map +0 -1
  396. package/lib/es/node_modules/react-focus-lock/dist/es2015/index.js +0 -2
  397. package/lib/es/node_modules/react-focus-lock/dist/es2015/medium.js +0 -2
  398. package/lib/es/node_modules/react-focus-lock/dist/es2015/medium.js.map +0 -1
  399. package/lib/es/node_modules/react-focus-lock/dist/es2015/util.js +0 -2
  400. package/lib/es/node_modules/react-focus-lock/dist/es2015/util.js.map +0 -1
  401. package/lib/es/node_modules/react-intersection-observer/index.mjs.js +0 -2
  402. package/lib/es/node_modules/react-intersection-observer/index.mjs.js.map +0 -1
  403. package/lib/es/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +0 -1
  404. package/lib/es/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -2
  405. package/lib/es/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +0 -1
  406. package/lib/es/node_modules/use-callback-ref/dist/es2015/useRef.js.map +0 -1
  407. package/lib/es/node_modules/use-sidecar/dist/es2015/medium.js +0 -2
  408. package/lib/es/node_modules/use-sidecar/dist/es2015/medium.js.map +0 -1
  409. package/lib/es/src/components/AddressLookup/index.js +0 -2
  410. package/lib/es/src/components/AddressLookup/styles.js +0 -2
  411. package/lib/es/src/components/AddressLookup/styles.js.map +0 -1
  412. package/lib/es/src/components/Avatar/index.js +0 -2
  413. package/lib/es/src/components/Avatar/index.js.map +0 -1
  414. package/lib/es/src/components/Avatar/styles.js +0 -2
  415. package/lib/es/src/components/Avatar/styles.js.map +0 -1
  416. package/lib/es/src/components/Badge/index.js +0 -2
  417. package/lib/es/src/components/Badge/index.js.map +0 -1
  418. package/lib/es/src/components/Badge/styles.js +0 -2
  419. package/lib/es/src/components/Badge/styles.js.map +0 -1
  420. package/lib/es/src/components/Box/index.js +0 -2
  421. package/lib/es/src/components/Box/index.js.map +0 -1
  422. package/lib/es/src/components/Box/styles.js +0 -2
  423. package/lib/es/src/components/Box/styles.js.map +0 -1
  424. package/lib/es/src/components/Button/index.js +0 -2
  425. package/lib/es/src/components/Button/index.js.map +0 -1
  426. package/lib/es/src/components/Button/styles.js +0 -2
  427. package/lib/es/src/components/Button/styles.js.map +0 -1
  428. package/lib/es/src/components/Carousel/Dots.js +0 -2
  429. package/lib/es/src/components/Carousel/Dots.js.map +0 -1
  430. package/lib/es/src/components/Carousel/index.js +0 -2
  431. package/lib/es/src/components/Carousel/index.js.map +0 -1
  432. package/lib/es/src/components/Carousel/styles.js +0 -2
  433. package/lib/es/src/components/Carousel/styles.js.map +0 -1
  434. package/lib/es/src/components/Checkbox/index.js +0 -2
  435. package/lib/es/src/components/Checkbox/index.js.map +0 -1
  436. package/lib/es/src/components/Checkbox/styles.js +0 -2
  437. package/lib/es/src/components/Checkbox/styles.js.map +0 -1
  438. package/lib/es/src/components/Collapse/index.js +0 -2
  439. package/lib/es/src/components/Collapse/index.js.map +0 -1
  440. package/lib/es/src/components/Collapse/styles.js +0 -2
  441. package/lib/es/src/components/Collapse/styles.js.map +0 -1
  442. package/lib/es/src/components/DateField/index.js +0 -2
  443. package/lib/es/src/components/DateField/index.js.map +0 -1
  444. package/lib/es/src/components/DateField/styles.js +0 -2
  445. package/lib/es/src/components/DateField/styles.js.map +0 -1
  446. package/lib/es/src/components/Divider.js +0 -2
  447. package/lib/es/src/components/Divider.js.map +0 -1
  448. package/lib/es/src/components/ErrorText/index.js +0 -2
  449. package/lib/es/src/components/ErrorText/index.js.map +0 -1
  450. package/lib/es/src/components/ErrorText/styles.js +0 -2
  451. package/lib/es/src/components/ErrorText/styles.js.map +0 -1
  452. package/lib/es/src/components/Flex.js +0 -2
  453. package/lib/es/src/components/Flex.js.map +0 -1
  454. package/lib/es/src/components/Fontface.js +0 -2
  455. package/lib/es/src/components/Fontface.js.map +0 -1
  456. package/lib/es/src/components/Footer/index.js +0 -2
  457. package/lib/es/src/components/Footer/index.js.map +0 -1
  458. package/lib/es/src/components/Footer/styles.js +0 -2
  459. package/lib/es/src/components/Footer/styles.js.map +0 -1
  460. package/lib/es/src/components/GlobalStyle.js +0 -2
  461. package/lib/es/src/components/GlobalStyle.js.map +0 -1
  462. package/lib/es/src/components/GlobalStyleNoFontFace.js +0 -2
  463. package/lib/es/src/components/GlobalStyleNoFontFace.js.map +0 -1
  464. package/lib/es/src/components/Header/index.js +0 -2
  465. package/lib/es/src/components/Header/index.js.map +0 -1
  466. package/lib/es/src/components/Header/styles.js +0 -2
  467. package/lib/es/src/components/Header/styles.js.map +0 -1
  468. package/lib/es/src/components/Heading/index.js +0 -2
  469. package/lib/es/src/components/Heading/index.js.map +0 -1
  470. package/lib/es/src/components/Heading/styles.js +0 -2
  471. package/lib/es/src/components/Heading/styles.js.map +0 -1
  472. package/lib/es/src/components/IconFa/index.js +0 -2
  473. package/lib/es/src/components/IconFa/index.js.map +0 -1
  474. package/lib/es/src/components/IconFa/styles.js +0 -2
  475. package/lib/es/src/components/IconFa/styles.js.map +0 -1
  476. package/lib/es/src/components/InfoBox/index.js +0 -2
  477. package/lib/es/src/components/InfoBox/index.js.map +0 -1
  478. package/lib/es/src/components/InfoBox/styles.js +0 -2
  479. package/lib/es/src/components/InfoBox/styles.js.map +0 -1
  480. package/lib/es/src/components/LabelWrapper/index.js +0 -2
  481. package/lib/es/src/components/LabelWrapper/index.js.map +0 -1
  482. package/lib/es/src/components/LabelWrapper/styles.js +0 -2
  483. package/lib/es/src/components/LabelWrapper/styles.js.map +0 -1
  484. package/lib/es/src/components/LegendWrapper/index.js +0 -2
  485. package/lib/es/src/components/LegendWrapper/index.js.map +0 -1
  486. package/lib/es/src/components/LegendWrapper/styles.js +0 -2
  487. package/lib/es/src/components/LegendWrapper/styles.js.map +0 -1
  488. package/lib/es/src/components/Link/index.js +0 -2
  489. package/lib/es/src/components/Link/index.js.map +0 -1
  490. package/lib/es/src/components/Link/styles.js +0 -2
  491. package/lib/es/src/components/Link/styles.js.map +0 -1
  492. package/lib/es/src/components/Loader/index.js +0 -2
  493. package/lib/es/src/components/Loader/index.js.map +0 -1
  494. package/lib/es/src/components/Loader/styles.js +0 -2
  495. package/lib/es/src/components/Loader/styles.js.map +0 -1
  496. package/lib/es/src/components/Modal/index.js +0 -2
  497. package/lib/es/src/components/Modal/index.js.map +0 -1
  498. package/lib/es/src/components/Modal/styles.js +0 -2
  499. package/lib/es/src/components/Modal/styles.js.map +0 -1
  500. package/lib/es/src/components/Pagination/index.js +0 -2
  501. package/lib/es/src/components/Pagination/index.js.map +0 -1
  502. package/lib/es/src/components/Pagination/styles.js +0 -2
  503. package/lib/es/src/components/Pagination/styles.js.map +0 -1
  504. package/lib/es/src/components/PopOver/index.js +0 -2
  505. package/lib/es/src/components/PopOver/index.js.map +0 -1
  506. package/lib/es/src/components/PopOver/styles.js +0 -2
  507. package/lib/es/src/components/PopOver/styles.js.map +0 -1
  508. package/lib/es/src/components/ProgressBar/index.js +0 -2
  509. package/lib/es/src/components/ProgressBar/index.js.map +0 -1
  510. package/lib/es/src/components/ProgressBar/styles.js +0 -2
  511. package/lib/es/src/components/ProgressBar/styles.js.map +0 -1
  512. package/lib/es/src/components/Radio/index.js +0 -2
  513. package/lib/es/src/components/Radio/index.js.map +0 -1
  514. package/lib/es/src/components/Radio/styles.js +0 -2
  515. package/lib/es/src/components/Radio/styles.js.map +0 -1
  516. package/lib/es/src/components/RadioConsent/index.js +0 -2
  517. package/lib/es/src/components/RadioConsent/index.js.map +0 -1
  518. package/lib/es/src/components/RadioConsent/styles.js +0 -2
  519. package/lib/es/src/components/RadioConsent/styles.js.map +0 -1
  520. package/lib/es/src/components/Select/index.js +0 -2
  521. package/lib/es/src/components/Select/index.js.map +0 -1
  522. package/lib/es/src/components/Select/styles.js +0 -2
  523. package/lib/es/src/components/Select/styles.js.map +0 -1
  524. package/lib/es/src/components/Spacing/index.js +0 -2
  525. package/lib/es/src/components/Spacing/index.js.map +0 -1
  526. package/lib/es/src/components/Step/index.js +0 -2
  527. package/lib/es/src/components/Step/index.js.map +0 -1
  528. package/lib/es/src/components/Step/styles.js +0 -2
  529. package/lib/es/src/components/Step/styles.js.map +0 -1
  530. package/lib/es/src/components/Text/index.js +0 -2
  531. package/lib/es/src/components/Text/index.js.map +0 -1
  532. package/lib/es/src/components/Text/styles.js +0 -2
  533. package/lib/es/src/components/Text/styles.js.map +0 -1
  534. package/lib/es/src/components/TextAreaField/index.js +0 -2
  535. package/lib/es/src/components/TextAreaField/index.js.map +0 -1
  536. package/lib/es/src/components/TextAreaField/styles.js +0 -2
  537. package/lib/es/src/components/TextAreaField/styles.js.map +0 -1
  538. package/lib/es/src/components/TextField/index.js +0 -2
  539. package/lib/es/src/components/TextField/index.js.map +0 -1
  540. package/lib/es/src/components/TextField/styles.js +0 -2
  541. package/lib/es/src/components/TextField/styles.js.map +0 -1
  542. package/lib/es/src/components/Totaliser/index.js +0 -2
  543. package/lib/es/src/components/Totaliser/index.js.map +0 -1
  544. package/lib/es/src/components/Totaliser/styles.js +0 -2
  545. package/lib/es/src/components/Totaliser/styles.js.map +0 -1
  546. package/lib/es/src/components/UserBlock/index.js +0 -2
  547. package/lib/es/src/components/UserBlock/index.js.map +0 -1
  548. package/lib/es/src/components/UserBlock/styles.js +0 -2
  549. package/lib/es/src/components/UserBlock/styles.js.map +0 -1
  550. package/lib/es/src/components/index.js +0 -2
  551. package/lib/es/src/components/index.js.map +0 -1
  552. package/lib/es/src/hooks/useEffectBrowser.js.map +0 -1
  553. package/lib/es/src/hooks/useKey.js.map +0 -1
  554. package/lib/es/src/hooks/useLayoutEffectBrowser.js.map +0 -1
  555. package/lib/es/src/hooks/useScrollPosition.js.map +0 -1
  556. package/lib/es/src/themes/bowelbabe.js +0 -2
  557. package/lib/es/src/themes/bowelbabe.js.map +0 -1
  558. package/lib/es/src/themes/cruk.js.map +0 -1
  559. package/lib/es/src/themes/rfl.js +0 -2
  560. package/lib/es/src/themes/rfl.js.map +0 -1
  561. package/lib/es/src/themes/su2c.js +0 -2
  562. package/lib/es/src/themes/su2c.js.map +0 -1
  563. package/lib/es/src/utils/Helper.js +0 -2
  564. package/lib/es/src/utils/Helper.js.map +0 -1
  565. package/lib/es/src/utils/debounce.js.map +0 -1
  566. /package/lib/{es/node_modules → node_modules}/@babel/runtime/helpers/esm/defineProperty.js +0 -0
  567. /package/lib/{es/node_modules → node_modules}/@babel/runtime/helpers/esm/inheritsLoose.js +0 -0
  568. /package/lib/{es/node_modules → node_modules}/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -0
  569. /package/lib/{es/node_modules → node_modules}/@babel/runtime/helpers/esm/typeof.js +0 -0
  570. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/constants.js +0 -0
  571. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/focusInside.js +0 -0
  572. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/focusIsHidden.js +0 -0
  573. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/moveFocusInside.js +0 -0
  574. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/DOMutils.js +0 -0
  575. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/all-affected.js +0 -0
  576. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/array.js +0 -0
  577. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/auto-focus.js +0 -0
  578. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/correctFocus.js +0 -0
  579. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/getActiveElement.js +0 -0
  580. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/parenting.js +0 -0
  581. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/safe.js +0 -0
  582. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/tabUtils.js +0 -0
  583. /package/lib/{es/node_modules → node_modules}/focus-lock/dist/es2015/utils/tabbables.js +0 -0
  584. /package/lib/{es/node_modules → node_modules}/react-clientside-effect/lib/index.es.js +0 -0
  585. /package/lib/{es/node_modules → node_modules}/react-focus-lock/dist/es2015/FocusGuard.js +0 -0
  586. /package/lib/{es/node_modules → node_modules}/react-focus-lock/dist/es2015/index.js.map +0 -0
  587. /package/lib/{es/node_modules → node_modules}/use-callback-ref/dist/es2015/assignRef.js +0 -0
  588. /package/lib/{es/node_modules → node_modules}/use-callback-ref/dist/es2015/useRef.js +0 -0
  589. /package/lib/{es/src/components/AddressLookup → src/components}/index.js.map +0 -0
  590. /package/lib/{es/src → src}/hooks/useEffectBrowser.js +0 -0
  591. /package/lib/{es/src → src}/hooks/useKey.js +0 -0
  592. /package/lib/{es/src → src}/hooks/useLayoutEffectBrowser.js +0 -0
  593. /package/lib/utils/__tests__/{testHelpers.jest.d.ts → testHelpers.test.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ import*as n from"react";import{assignRef as e}from"./assignRef.js";import{useCallbackRef as r}from"./useRef.js";var t="undefined"!=typeof window?n.useLayoutEffect:n.useEffect,f=new WeakMap;function o(n,o){var u=r(null,(function(r){return n.forEach((function(n){return e(n,r)}))}));return t((function(){var r=f.get(u);if(r){var t=new Set(r),o=new Set(n),a=u.current;t.forEach((function(n){o.has(n)||e(n,null)})),o.forEach((function(n){t.has(n)||e(n,a)}))}f.set(u,n)}),[n]),u}export{o as useMergeRefs};
2
+ //# sourceMappingURL=useMergeRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMergeRef.js","sources":["../../../../../node_modules/use-callback-ref/dist/es2015/useMergeRef.js"],"sourcesContent":["import * as React from 'react';\nimport { assignRef } from './assignRef';\nimport { useCallbackRef } from './useRef';\nvar useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\nvar currentValues = new WeakMap();\n/**\n * Merges two or more refs together providing a single interface to set their value\n * @param {RefObject|Ref} refs\n * @returns {MutableRefObject} - a new ref, which translates all changes to {refs}\n *\n * @see {@link mergeRefs} a version without buit-in memoization\n * @see https://github.com/theKashey/use-callback-ref#usemergerefs\n * @example\n * const Component = React.forwardRef((props, ref) => {\n * const ownRef = useRef();\n * const domRef = useMergeRefs([ref, ownRef]); // 👈 merge together\n * return <div ref={domRef}>...</div>\n * }\n */\nexport function useMergeRefs(refs, defaultValue) {\n var callbackRef = useCallbackRef(defaultValue || null, function (newValue) {\n return refs.forEach(function (ref) { return assignRef(ref, newValue); });\n });\n // handle refs changes - added or removed\n useIsomorphicLayoutEffect(function () {\n var oldValue = currentValues.get(callbackRef);\n if (oldValue) {\n var prevRefs_1 = new Set(oldValue);\n var nextRefs_1 = new Set(refs);\n var current_1 = callbackRef.current;\n prevRefs_1.forEach(function (ref) {\n if (!nextRefs_1.has(ref)) {\n assignRef(ref, null);\n }\n });\n nextRefs_1.forEach(function (ref) {\n if (!prevRefs_1.has(ref)) {\n assignRef(ref, current_1);\n }\n });\n }\n currentValues.set(callbackRef, refs);\n }, [refs]);\n return callbackRef;\n}\n"],"names":["useIsomorphicLayoutEffect","window","React","useLayoutEffect","useEffect","currentValues","WeakMap","useMergeRefs","refs","defaultValue","callbackRef","useCallbackRef","newValue","forEach","ref","assignRef","oldValue","get","prevRefs_1","Set","nextRefs_1","current_1","current","has","set"],"mappings":"gHAGA,IAAIA,EAA8C,oBAAXC,OAAyBC,EAAMC,gBAAkBD,EAAME,UAC1FC,EAAgB,IAAIC,QAejB,SAASC,EAAaC,EAAMC,GAC/B,IAAIC,EAAcC,EAA+B,MAAM,SAAUC,GAC7D,OAAOJ,EAAKK,SAAQ,SAAUC,GAAO,OAAOC,EAAUD,EAAKF,EAAU,GAC7E,IAqBI,OAnBAZ,GAA0B,WACtB,IAAIgB,EAAWX,EAAcY,IAAIP,GACjC,GAAIM,EAAU,CACV,IAAIE,EAAa,IAAIC,IAAIH,GACrBI,EAAa,IAAID,IAAIX,GACrBa,EAAYX,EAAYY,QAC5BJ,EAAWL,SAAQ,SAAUC,GACpBM,EAAWG,IAAIT,IAChBC,EAAUD,EAAK,KAEnC,IACYM,EAAWP,SAAQ,SAAUC,GACpBI,EAAWK,IAAIT,IAChBC,EAAUD,EAAKO,EAEnC,GACS,CACDhB,EAAcmB,IAAId,EAAaF,EACvC,GAAO,CAACA,IACGE,CACX","x_google_ignoreList":[0]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRef.js","sources":["../../../../../node_modules/use-callback-ref/dist/es2015/useRef.js"],"sourcesContent":["import { useState } from 'react';\n/**\n * creates a MutableRef with ref change callback\n * @param initialValue - initial ref value\n * @param {Function} callback - a callback to run when value changes\n *\n * @example\n * const ref = useCallbackRef(0, (newValue, oldValue) => console.log(oldValue, '->', newValue);\n * ref.current = 1;\n * // prints 0 -> 1\n *\n * @see https://reactjs.org/docs/hooks-reference.html#useref\n * @see https://github.com/theKashey/use-callback-ref#usecallbackref---to-replace-reactuseref\n * @returns {MutableRefObject}\n */\nexport function useCallbackRef(initialValue, callback) {\n var ref = useState(function () { return ({\n // value\n value: initialValue,\n // last callback\n callback: callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n var last = ref.value;\n if (last !== value) {\n ref.value = value;\n ref.callback(value, last);\n }\n },\n },\n }); })[0];\n // update callback\n ref.callback = callback;\n return ref.facade;\n}\n"],"names":["useCallbackRef","initialValue","callback","ref","useState","value","facade","current","last"],"mappings":"iCAeO,SAASA,EAAeC,EAAcC,GACzC,IAAIC,EAAMC,GAAS,WAAc,MAAQ,CAErCC,MAAOJ,EAEPC,SAAUA,EAEVI,OAAQ,CACJ,WAAIC,GACA,OAAOJ,EAAIE,KACd,EACD,WAAIE,CAAQF,GACR,IAAIG,EAAOL,EAAIE,MACXG,IAASH,IACTF,EAAIE,MAAQA,EACZF,EAAID,SAASG,EAAOG,GAE3B,GAEJ,IAAE,GAGP,OADAL,EAAID,SAAWA,EACRC,EAAIG,MACf","x_google_ignoreList":[0]}
@@ -0,0 +1,2 @@
1
+ import{__assign as n}from"../../../tslib/tslib.es6.js";function r(n){return n}function t(n,t){void 0===t&&(t=r);var u=[],e=!1;return{read:function(){if(e)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return u.length?u[u.length-1]:n},useMedium:function(n){var r=t(n,e);return u.push(r),function(){u=u.filter((function(n){return n!==r}))}},assignSyncMedium:function(n){for(e=!0;u.length;){var r=u;u=[],r.forEach(n)}u={push:function(r){return n(r)},filter:function(){return u}}},assignMedium:function(n){e=!0;var r=[];if(u.length){var t=u;u=[],t.forEach(n),r=u}var i=function(){var t=r;r=[],t.forEach(n)},o=function(){return Promise.resolve().then(i)};o(),u={push:function(n){r.push(n),o()},filter:function(n){return r=r.filter(n),u}}}}}function u(n,u){return void 0===u&&(u=r),t(n,u)}function e(r){void 0===r&&(r={});var u=t(null);return u.options=n({async:!0,ssr:!1},r),u}export{u as createMedium,e as createSidecarMedium};
2
+ //# sourceMappingURL=medium.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"medium.js","sources":["../../../../../node_modules/use-sidecar/dist/es2015/medium.js"],"sourcesContent":["import { __assign } from \"tslib\";\nfunction ItoI(a) {\n return a;\n}\nfunction innerCreateMedium(defaults, middleware) {\n if (middleware === void 0) { middleware = ItoI; }\n var buffer = [];\n var assigned = false;\n var medium = {\n read: function () {\n if (assigned) {\n throw new Error('Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.');\n }\n if (buffer.length) {\n return buffer[buffer.length - 1];\n }\n return defaults;\n },\n useMedium: function (data) {\n var item = middleware(data, assigned);\n buffer.push(item);\n return function () {\n buffer = buffer.filter(function (x) { return x !== item; });\n };\n },\n assignSyncMedium: function (cb) {\n assigned = true;\n while (buffer.length) {\n var cbs = buffer;\n buffer = [];\n cbs.forEach(cb);\n }\n buffer = {\n push: function (x) { return cb(x); },\n filter: function () { return buffer; },\n };\n },\n assignMedium: function (cb) {\n assigned = true;\n var pendingQueue = [];\n if (buffer.length) {\n var cbs = buffer;\n buffer = [];\n cbs.forEach(cb);\n pendingQueue = buffer;\n }\n var executeQueue = function () {\n var cbs = pendingQueue;\n pendingQueue = [];\n cbs.forEach(cb);\n };\n var cycle = function () { return Promise.resolve().then(executeQueue); };\n cycle();\n buffer = {\n push: function (x) {\n pendingQueue.push(x);\n cycle();\n },\n filter: function (filter) {\n pendingQueue = pendingQueue.filter(filter);\n return buffer;\n },\n };\n },\n };\n return medium;\n}\nexport function createMedium(defaults, middleware) {\n if (middleware === void 0) { middleware = ItoI; }\n return innerCreateMedium(defaults, middleware);\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function createSidecarMedium(options) {\n if (options === void 0) { options = {}; }\n var medium = innerCreateMedium(null);\n medium.options = __assign({ async: true, ssr: false }, options);\n return medium;\n}\n"],"names":["ItoI","a","innerCreateMedium","defaults","middleware","buffer","assigned","read","Error","length","useMedium","data","item","push","filter","x","assignSyncMedium","cb","cbs","forEach","assignMedium","pendingQueue","executeQueue","cycle","Promise","resolve","then","createMedium","createSidecarMedium","options","medium","__assign","async","ssr"],"mappings":"uDACA,SAASA,EAAKC,GACV,OAAOA,CACX,CACA,SAASC,EAAkBC,EAAUC,QACd,IAAfA,IAAyBA,EAAaJ,GAC1C,IAAIK,EAAS,GACTC,GAAW,EA0Df,MAzDa,CACTC,KAAM,WACF,GAAID,EACA,MAAM,IAAIE,MAAM,oGAEpB,OAAIH,EAAOI,OACAJ,EAAOA,EAAOI,OAAS,GAE3BN,CACV,EACDO,UAAW,SAAUC,GACjB,IAAIC,EAAOR,EAAWO,EAAML,GAE5B,OADAD,EAAOQ,KAAKD,GACL,WACHP,EAASA,EAAOS,QAAO,SAAUC,GAAK,OAAOA,IAAMH,CAAK,GACxE,CACS,EACDI,iBAAkB,SAAUC,GAExB,IADAX,GAAW,EACJD,EAAOI,QAAQ,CAClB,IAAIS,EAAMb,EACVA,EAAS,GACTa,EAAIC,QAAQF,EACf,CACDZ,EAAS,CACLQ,KAAM,SAAUE,GAAK,OAAOE,EAAGF,EAAK,EACpCD,OAAQ,WAAc,OAAOT,CAAS,EAE7C,EACDe,aAAc,SAAUH,GACpBX,GAAW,EACX,IAAIe,EAAe,GACnB,GAAIhB,EAAOI,OAAQ,CACf,IAAIS,EAAMb,EACVA,EAAS,GACTa,EAAIC,QAAQF,GACZI,EAAehB,CAClB,CACD,IAAIiB,EAAe,WACf,IAAIJ,EAAMG,EACVA,EAAe,GACfH,EAAIC,QAAQF,EAC5B,EACgBM,EAAQ,WAAc,OAAOC,QAAQC,UAAUC,KAAKJ,IACxDC,IACAlB,EAAS,CACLQ,KAAM,SAAUE,GACZM,EAAaR,KAAKE,GAClBQ,GACH,EACDT,OAAQ,SAAUA,GAEd,OADAO,EAAeA,EAAaP,OAAOA,GAC5BT,CACV,EAER,EAGT,CACO,SAASsB,EAAaxB,EAAUC,GAEnC,YADmB,IAAfA,IAAyBA,EAAaJ,GACnCE,EAAkBC,EAAUC,EACvC,CAEO,SAASwB,EAAoBC,QAChB,IAAZA,IAAsBA,EAAU,CAAE,GACtC,IAAIC,EAAS5B,EAAkB,MAE/B,OADA4B,EAAOD,QAAUE,EAAS,CAAEC,OAAO,EAAMC,KAAK,GAASJ,GAChDC,CACX","x_google_ignoreList":[0]}
@@ -0,0 +1,2 @@
1
+ import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import n,{forwardRef as r,useState as o,useRef as s,useCallback as a,useEffect as i}from"react";import{useTheme as l}from"styled-components";import{faChevronRight as c}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{useKey as d}from"../../hooks/useKey.js";import{debounce as u}from"../../utils/debounce.js";import{removeCommasFromObjectStringValues as m}from"../../utils/Helper.js";import{Text as f}from"../Text/index.js";import{TextField as p}from"../TextField/index.js";import{IconFa as h}from"../IconFa/index.js";import{crukTheme as g}from"../../themes/cruk.js";import{ScreenReaderOnly as v,ListWrapper as y,List as E,ListItem as w}from"./styles.js";var b=r((function(r,b){var x=r.apiKey,j=r.countries,I=r.errorMessage,T=r.hasError,V=r.isValid,k=r.isValidVisible,A=r.isInvalidVisible,C=r.label,K=r.hintText,D=r.onAddressError,F=void 0===D?function(e){console.log(e)}:D,S=r.onAddressSelected,M=r.onChange,_=r.onBlur,B=e(r,["apiKey","countries","errorMessage","hasError","isValid","isValidVisible","isInvalidVisible","label","hintText","onAddressError","onAddressSelected","onChange","onBlur"]),H=o([]),L=H[0],O=H[1],U=o(-1),q=U[0],R=U[1],W=s(null),z=l(),G=t(t({},g),z),J=function(){R(-1),O([])},N=a(u(500,(function(e){return P(e)})),[]),P=function(e,t){if(void 0===t&&(t=""),0===e.length)return O([]);var n="".concat("https://api.addressy.com/Capture/Interactive/Find/v1.1/json3.ws","?Key=").concat(x,"&Text=").concat(e,"&Container=").concat(t);return void 0!==j&&(n="".concat(n,"&Countries=").concat(j.join(","))),fetch(n).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){if(e.Items[0].Error)throw new Error("Something went wrong please try again");return O(e.Items||[]),null})).catch((function(e){return F(e)})),null},Q=function(e){fetch("".concat("https://api.addressy.com/Capture/Interactive/Retrieve/v1/json3.ws","?Key=").concat(x,"&Id=").concat(e)).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){var t=e.Items[0],n=m(t);return S(n),J(),null})).catch((function(e){return F(e)}))},X=function(e){return"Address"===e.Type?Q(e.Id):(P(e.Text,e.Id),null)},Y=function(e){W.current&&e.target instanceof HTMLElement&&!W.current.contains(e.target)&&J()};return i((function(){return document.addEventListener("mousedown",Y),function(){document.removeEventListener("mousedown",Y)}})),d((function(){J()}),{detectKeys:["Escape","Tab"]},[]),n.createElement(n.Fragment,null,n.createElement(p,t({"aria-activedescendant":L.length?"addressOptions-".concat(q):"","aria-owns":"found_addresses","aria-autocomplete":"both","aria-expanded":L.length?"true":"false",autoComplete:"off",hasError:T||!!I,errorMessage:I,hintText:null!=K?K:"Start typing your address or postcode",isValid:V,isValidVisible:k,isInvalidVisible:A,label:null!=C?C:"Home address",ref:b,required:!0,role:"combobox",type:"search"},B,{onKeyDown:function(e){"Enter"===e.key&&L[q]?(e.preventDefault(),"Address"===L[q].Type&&Q(L[q].Id),P(L[q].Text,L[q].Id),R(-1)):"ArrowUp"===e.key?(e.preventDefault(),q<=-1&&R(L.length-1),R(q-1)):"ArrowDown"===e.key?(e.preventDefault(),q+1>=L.length&&R(0),R(q+1)):R(-1)},onChange:function(e){N(e.target.value),M&&M(e)},onBlur:function(e){var t=!!L.length;_&&!t&&_(e)}})),!!L.length&&n.createElement(n.Fragment,null,n.createElement(v,{role:"status","aria-live":"assertive"},!!L.length&&"We have found ".concat(L.length," result").concat(1!==L.length?"s":""," matching your search. Use up and down arrow keys to navigate")),n.createElement(y,{ref:W},n.createElement(E,{"aria-label":"found addresses",id:"found_addresses",role:"listbox",theme:G},L.map((function(e,t){return n.createElement(w,{tabIndex:0,id:"addressOptions-".concat(t),isActive:t===q,key:e.Id,onClick:function(){X(e)},onKeyDown:function(t){"Enter"===t.key&&X(e)},role:"option","data-hj-suppress":!0,theme:G},n.createElement(f,{as:"span","data-hj-suppress":!0},e.Text," ",e.Description),"Address"!==e.Type&&n.createElement(n.Fragment,null,n.createElement(v,null,"press enter for these addresses"),n.createElement(h,{faIcon:c})))}))))))}));export{b as AddressLookup,b as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/AddressLookup/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n useCallback,\n useEffect,\n type Ref,\n useRef,\n forwardRef,\n type FocusEvent,\n type ChangeEvent,\n type KeyboardEvent,\n useState,\n type ReactNode,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { faChevronRight } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { type AddressDataType, type AddressOptionsType } from \"../../types\";\nimport { useKey } from \"../../hooks/useKey\";\n\nimport { debounce } from \"../../utils/debounce\";\nimport { removeCommasFromObjectStringValues } from \"../../utils/Helper\";\nimport { Text } from \"../Text\";\nimport { TextField } from \"../TextField\";\nimport { IconFa } from \"../IconFa\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { ListWrapper, ListItem, ScreenReaderOnly, List } from \"./styles\";\n\nconst FIND_URL =\n \"https://api.addressy.com/Capture/Interactive/Find/v1.1/json3.ws\";\nconst RETRIEVE_URL =\n \"https://api.addressy.com/Capture/Interactive/Retrieve/v1/json3.ws\";\n\nexport type AddressLookupProps = InputHTMLAttributes<HTMLInputElement> & {\n /** api key for loqate */\n apiKey: string;\n /** list of countries codes you want the address look up to search within */\n countries?: string[];\n /** callback function which is passed the selected address data */\n onAddressSelected: (address: AddressDataType) => void;\n /** error message */\n errorMessage?: string;\n /** when true a input has a red border */\n hasError?: boolean;\n /** flag which effects the check or cross icons to the right of the input */\n isValid?: boolean;\n /** flag to hide or show the check icon when valid */\n isValidVisible?: boolean;\n /** flag to hide or show the cross icon when invalid */\n isInvalidVisible?: boolean;\n /** label text */\n label?: string;\n /** hint text text */\n hintText?: ReactNode;\n /** callback function which is passed the error */\n onAddressError?: (error: Error) => void;\n /** onBlur handler */\n onBlur?: (e: FocusEvent<HTMLInputElement>) => void;\n /** attach a DOM reference variable to your component */\n ref?: Ref<HTMLInputElement>;\n};\n\n/**\n * This component creates a combobox for a user to type in a post code or partial address and be presented with a of verified addresses.\n * We use Loqate (formerly Addressy and Postcode Anywhere) API v3, we have looked at v4 but it is more expensive without many benefits for our use case.\n * You will need a Loqate api key, the examples below use \"MG17-ZD93-FF33-KF13\" our development key.\n * This component is generally only used for country codes including \"GBR\", \"GGY\", \"IMN\", \"JEY\". An example of this behavior is included bellow.\n */\nexport const AddressLookup = forwardRef(\n (\n {\n apiKey,\n countries,\n errorMessage,\n hasError,\n isValid,\n isValidVisible,\n isInvalidVisible,\n label,\n hintText,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onAddressError = (error: Error) => {\n console.log(error);\n },\n onAddressSelected,\n onChange,\n onBlur,\n ...props\n }: AddressLookupProps,\n ref?: Ref<HTMLInputElement>,\n ) => {\n const [addressOptions, setAddressOptions] = useState<AddressOptionsType[]>(\n [],\n );\n const [activeOption, setActiveOption] = useState(-1);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const clearOptions = () => {\n setActiveOption(-1);\n setAddressOptions([]);\n };\n\n const searchDebounced = useCallback(\n debounce(500, (query: string) => search(query)),\n [],\n );\n\n const search = (query: string, id = \"\") => {\n if (query.length === 0) return setAddressOptions([]);\n let searchUrl = `${FIND_URL}?Key=${apiKey}&Text=${query}&Container=${id}`;\n if (countries !== undefined) {\n searchUrl = `${searchUrl}&Countries=${countries.join(\",\")}`;\n }\n fetch(searchUrl)\n .then((res: Response) => {\n if (!res.ok) throw new Error(\"Something went wrong please try again\");\n return res.json();\n })\n .then((data: { Items: AddressOptionsType[] }) => {\n // Occasionally get the error \"The query didn't respond fast enough, it may be too complex.\"\n // returned with a 200 response. Example query \"n17 6t\"\n if (data.Items[0].Error)\n throw new Error(\"Something went wrong please try again\");\n setAddressOptions(data.Items || []);\n return null;\n })\n .catch((err) => onAddressError(err as Error));\n return null;\n };\n\n const getAddress = (id: string) => {\n fetch(`${RETRIEVE_URL}?Key=${apiKey}&Id=${id}`)\n .then((res: Response) => {\n if (!res.ok) throw new Error(\"Something went wrong please try again\");\n return res.json();\n })\n .then((data: { Items: AddressDataType[] }) => {\n const selectedAddress = data.Items[0];\n const selectedAddressWithoutCommas =\n removeCommasFromObjectStringValues<AddressDataType>(\n selectedAddress,\n );\n onAddressSelected(selectedAddressWithoutCommas);\n clearOptions();\n return null;\n })\n .catch((err) => onAddressError(err as Error));\n };\n\n const selectAddress = (address: AddressOptionsType) => {\n if (address.Type === \"Address\") return getAddress(address.Id);\n search(address.Text, address.Id);\n return null;\n };\n\n const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>): void => {\n if (e.key === \"Enter\" && addressOptions[activeOption]) {\n e.preventDefault();\n if (addressOptions[activeOption].Type === \"Address\")\n getAddress(addressOptions[activeOption].Id);\n search(\n addressOptions[activeOption].Text,\n addressOptions[activeOption].Id,\n );\n setActiveOption(-1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (activeOption <= -1) setActiveOption(addressOptions.length - 1);\n setActiveOption(activeOption - 1);\n } else if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (activeOption + 1 >= addressOptions.length) setActiveOption(0);\n setActiveOption(activeOption + 1);\n } else {\n setActiveOption(-1);\n }\n };\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n searchDebounced(e.target.value);\n if (onChange) onChange(e);\n };\n\n const handleBlur = (e: FocusEvent<HTMLInputElement>) => {\n const isOptionsOpen = !!addressOptions.length;\n if (onBlur && !isOptionsOpen) onBlur(e);\n };\n\n const handleClickOutside = (event: MouseEvent) => {\n if (\n wrapperRef.current &&\n event.target instanceof HTMLElement &&\n !wrapperRef.current.contains(event.target)\n )\n clearOptions();\n };\n\n useEffect(() => {\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n });\n\n useKey(\n () => {\n clearOptions();\n },\n {\n detectKeys: [\"Escape\", \"Tab\"],\n },\n [],\n );\n\n return (\n <>\n <TextField\n aria-activedescendant={\n addressOptions.length ? `addressOptions-${activeOption}` : \"\"\n }\n aria-owns=\"found_addresses\"\n aria-autocomplete=\"both\"\n aria-expanded={addressOptions.length ? \"true\" : \"false\"}\n autoComplete=\"off\"\n hasError={hasError || !!errorMessage}\n errorMessage={errorMessage}\n hintText={hintText ?? \"Start typing your address or postcode\"}\n isValid={isValid}\n isValidVisible={isValidVisible}\n isInvalidVisible={isInvalidVisible}\n label={label ?? \"Home address\"}\n ref={ref}\n required\n role=\"combobox\"\n type=\"search\"\n {...props}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n onBlur={handleBlur}\n />\n\n {!!addressOptions.length && (\n <>\n <ScreenReaderOnly role=\"status\" aria-live=\"assertive\">\n {!!addressOptions.length &&\n `We have found ${addressOptions.length} result${\n addressOptions.length !== 1 ? \"s\" : \"\"\n } matching your search. Use up and down arrow keys to navigate`}\n </ScreenReaderOnly>\n <ListWrapper ref={wrapperRef}>\n <List\n aria-label=\"found addresses\"\n id=\"found_addresses\"\n role=\"listbox\"\n theme={theme}\n >\n {addressOptions.map((address, index) => (\n <ListItem\n tabIndex={0}\n id={`addressOptions-${index}`}\n isActive={index === activeOption}\n key={address.Id}\n onClick={() => {\n selectAddress(address);\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n selectAddress(address);\n }\n }}\n role=\"option\"\n data-hj-suppress\n theme={theme}\n >\n <Text as=\"span\" data-hj-suppress>\n {address.Text} {address.Description}\n </Text>\n {address.Type !== \"Address\" && (\n <>\n <ScreenReaderOnly>\n press enter for these addresses\n </ScreenReaderOnly>\n <IconFa faIcon={faChevronRight} />\n </>\n )}\n </ListItem>\n ))}\n </List>\n </ListWrapper>\n </>\n )}\n </>\n );\n },\n);\n\nexport default AddressLookup;\n"],"names":["AddressLookup","forwardRef","_a","ref","apiKey","countries","errorMessage","hasError","isValid","isValidVisible","isInvalidVisible","label","hintText","_b","onAddressError","error","console","log","onAddressSelected","onChange","onBlur","props","__rest","_c","useState","addressOptions","setAddressOptions","_d","activeOption","setActiveOption","wrapperRef","useRef","foundTheme","useTheme","theme","__assign","defaultTheme","clearOptions","searchDebounced","useCallback","debounce","query","search","id","length","searchUrl","concat","undefined","join","fetch","then","res","ok","Error","json","data","Items","catch","err","getAddress","selectedAddress","selectedAddressWithoutCommas","removeCommasFromObjectStringValues","selectAddress","address","Type","Id","Text","handleClickOutside","event","current","target","HTMLElement","contains","useEffect","document","addEventListener","removeEventListener","useKey","detectKeys","React","createElement","Fragment","TextField","autoComplete","required","role","type","onKeyDown","e","key","preventDefault","value","isOptionsOpen","ScreenReaderOnly","ListWrapper","List","map","index","ListItem","tabIndex","isActive","onClick","as","Description","IconFa","faIcon","faChevronRight"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o from"styled-components";var i,r,e,t,p=o.div(i||(i=n(["\n position: relative;\n"],["\n position: relative;\n"]))),d=o.ul(r||(r=n(["\n background-color: ",";\n border-radius: 3px;\n border: 2px solid #ccc;\n box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);\n list-style: none;\n margin-top: 0;\n max-height: 400px;\n overflow-y: auto;\n padding: 0;\n position: absolute;\n width: 100%;\n z-index: 999;\n"],["\n background-color: ",";\n border-radius: 3px;\n border: 2px solid #ccc;\n box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);\n list-style: none;\n margin-top: 0;\n max-height: 400px;\n overflow-y: auto;\n padding: 0;\n position: absolute;\n width: 100%;\n z-index: 999;\n"])),(function(n){return n.theme.colors.backgroundLight})),a=o.li(e||(e=n(["\n align-items: center;\n background-color: ",";\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n padding: 5px;\n &:hover,\n &:focus {\n background-color: #ddd;\n }\n"],["\n align-items: center;\n background-color: ",";\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n padding: 5px;\n &:hover,\n &:focus {\n background-color: #ddd;\n }\n"])),(function(n){var o=n.theme;return n.isActive?o.colors.backgroundMid:o.colors.backgroundLight})),s=o.div(t||(t=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{d as List,a as ListItem,p as ListWrapper,s as ScreenReaderOnly};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/AddressLookup/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ninterface ListWrapperProps extends React.HTMLProps<HTMLDivElement> {\n tabIndex?: number;\n}\n\ntype ListProps = {\n theme: ThemeType;\n isActive?: boolean;\n};\n\nexport const ListWrapper = styled.div<ListWrapperProps>`\n position: relative;\n`;\n\nexport const List = styled.ul<\n ListProps & { ref?: React.Ref<HTMLUListElement> }\n>`\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n border-radius: 3px;\n border: 2px solid #ccc;\n box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);\n list-style: none;\n margin-top: 0;\n max-height: 400px;\n overflow-y: auto;\n padding: 0;\n position: absolute;\n width: 100%;\n z-index: 999;\n`;\n\nexport const ListItem = styled.li<\n ListProps & {\n ref?: React.Ref<HTMLLIElement>;\n }\n>`\n align-items: center;\n background-color: ${({ theme, isActive }: ListProps) =>\n isActive ? theme.colors.backgroundMid : theme.colors.backgroundLight};\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n padding: 5px;\n &:hover,\n &:focus {\n background-color: #ddd;\n }\n`;\n\n// TODO move to its own component\nexport const ScreenReaderOnly = styled.div`\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"],"names":["ListWrapper","styled","div","templateObject_1","__makeTemplateObject","List","ul","templateObject_2","_a","theme","colors","backgroundLight","ListItem","li","templateObject_3","isActive","backgroundMid","ScreenReaderOnly","templateObject_4"],"mappings":"iHAYa,YAAAA,EAAcC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,6BAAA,CAAkB,gCAI1CC,EAAOJ,EAAOK,GAAEC,IAAAA,EAAAH,EAAA,CAAA,yBAAA,kQAAA,CAE5B,yBACgE,qQAA3C,SAACI,GAAc,OAAPA,EAAAC,MAAaC,OAAOC,eAAb,IAcxBC,EAAWX,EAAOY,GAAEC,IAAAA,EAAAV,EAAA,CAAA,iDAAA,4JAAA,CAIhC,iDAGuE,+JADlD,SAACI,OAAEC,EAAKD,EAAAC,MAC1B,OADoCD,EAAAO,SACzBN,EAAMC,OAAOM,cAAgBP,EAAMC,OAAOC,eAArD,IAYSM,EAAmBhB,EAAOC,IAAGgB,IAAAA,EAAAd,EAAA,CAAA,4NAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{__rest as t,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import o from"react";import{useTheme as a}from"styled-components";import{crukTheme as e}from"../../themes/cruk.js";import{StyledAvatar as n}from"./styles.js";function m(m){var i=m.url,s=m.name,c=m.size,p=void 0===c?"m":c,l=m.alt,u=void 0===l?"":l,f=t(m,["url","name","size","alt"]),v=a(),d=r(r({},e),v);return o.createElement(n,r({},f,{size:d.avatar[p||"m"],src:function(){if(i)return i;var t=s&&"string"==typeof s&&"Anonymous"!==s&&/[a-z]/i.exec(s[0].trim())?"icon-avatar-".concat(s[0].trim().toUpperCase(),".png"):"icon-avatar-Anonymous.png";return"".concat(d.avatar.path).concat(t)}(),alt:u}))}export{m as Avatar,m as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Avatar/index.tsx"],"sourcesContent":["import React, { type ImgHTMLAttributes } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { StyledAvatar } from \"./styles\";\n\nexport type AvatarProps = ImgHTMLAttributes<HTMLElement> & {\n /** name of user/entity */\n name?: string;\n /** image url */\n url?: string;\n /** image size */\n size?: \"s\" | \"m\" | \"l\" | \"xl\";\n};\n\n/**\n *\n * You can use an avatar to display ownership of an item of content. If you pass a URL of an image that will be displayed otherwise the first letter of the name will be used to display a branded avatar.\n */\nexport function Avatar({\n url,\n name,\n size = \"m\",\n alt = \"\",\n ...rest\n}: AvatarProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const avatarUrl = () => {\n if (url) return url;\n const fileName =\n name &&\n typeof name === \"string\" &&\n name !== \"Anonymous\" &&\n /[a-z]/i.exec(name[0].trim())\n ? `icon-avatar-${name[0].trim().toUpperCase()}.png`\n : \"icon-avatar-Anonymous.png\";\n\n return `${theme.avatar.path}${fileName}`;\n };\n\n return (\n <StyledAvatar\n {...rest}\n size={theme.avatar[size || \"m\"]}\n src={avatarUrl()}\n alt={alt}\n />\n );\n}\n\nexport default Avatar;\n"],"names":["Avatar","_a","url","name","_b","size","_c","alt","rest","__rest","foundTheme","useTheme","theme","__assign","defaultTheme","React","createElement","StyledAvatar","avatar","src","fileName","exec","trim","concat","toUpperCase","path","avatarUrl"],"mappings":"8OAoBM,SAAUA,EAAOC,GACrB,IAAAC,QACAC,SACAC,EAAAH,EAAAI,KAAAA,OAAO,IAAAD,EAAA,MACPE,EAAAL,EAAAM,IAAAA,OAAM,IAAAD,EAAA,KACHE,EALkBC,EAAAR,EAAA,CAAA,MAAA,OAAA,OAAA,QAOfS,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAgBL,OACEK,EAACC,cAAAC,EACKJ,EAAA,CAAA,EAAAL,EACJ,CAAAH,KAAMO,EAAMM,OAAOb,GAAQ,KAC3Bc,IAjBc,WAChB,GAAIjB,EAAK,OAAOA,EAChB,IAAMkB,EACJjB,GACgB,iBAATA,GACE,cAATA,GACA,SAASkB,KAAKlB,EAAK,GAAGmB,QAClB,eAAAC,OAAepB,EAAK,GAAGmB,OAAOE,cAAmB,QACjD,4BAEN,MAAO,GAAAD,OAAGX,EAAMM,OAAOO,MAAIF,OAAGH,EAChC,CAMSM,GACLnB,IAAKA,IAGX"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as r}from"../../../node_modules/tslib/tslib.es6.js";import o from"styled-components";var e,n=o.img(e||(e=r(["\n box-sizing: border-box;\n border-radius: 50%;\n height: ",";\n object-fit: cover;\n width: ",";\n border-style: solid;\n border-width: 2px;\n border-color: ",";\n"],["\n box-sizing: border-box;\n border-radius: 50%;\n height: ",";\n object-fit: cover;\n width: ",";\n border-style: solid;\n border-width: 2px;\n border-color: ",";\n"])),(function(r){return r.size}),(function(r){return r.size}),(function(r){return r.theme.colors.avatarBorder}));export{n as StyledAvatar,n as default};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Avatar/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\ntype AvatarStyledProps = {\n size?: string;\n theme: ThemeType;\n};\n\nexport const StyledAvatar = styled.img<AvatarStyledProps>`\n box-sizing: border-box;\n border-radius: 50%;\n height: ${({ size }) => size};\n object-fit: cover;\n width: ${({ size }) => size};\n border-style: solid;\n border-width: 2px;\n border-color: ${({ theme }: AvatarStyledProps) => theme.colors.avatarBorder};\n`;\n\nexport default StyledAvatar;\n"],"names":["StyledAvatar","styled","img","templateObject_1","__makeTemplateObject","_a","size","theme","colors","avatarBorder"],"mappings":"iHAQa,MAAAA,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,iEAAA,qCAAA,oEAAA,OAAA,CAAmB,iEAG3B,qCAED,oEAGgD,UALjE,SAACC,GAAa,OAAPA,EAAAC,IAAO,IAEf,SAACD,GAAa,OAAPA,EAAAC,IAAO,IAGP,SAACD,GAAiC,OAA1BA,EAAAE,MAAgCC,OAAOC,YAAb"}
@@ -0,0 +1,2 @@
1
+ import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import r from"react";import{useTheme as o}from"styled-components";import{crukTheme as s}from"../../themes/cruk.js";import{StyledBadge as m}from"./styles.js";function i(i){var n=i.children,l=e(i,["children"]),f=o(),p=t(t({},s),f);return r.createElement(m,t({theme:p,isText:"string"==typeof n,size:"xs"},l),n)}export{i as Badge,i as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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\";\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};\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({ children, ...rest }: BadgeProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n return (\n <StyledBadge\n theme={theme}\n isText={typeof children === \"string\"}\n size=\"xs\"\n {...rest}\n >\n {children}\n </StyledBadge>\n );\n}\n\nexport default Badge;\n"],"names":["Badge","_a","children","rest","__rest","foundTheme","useTheme","theme","__assign","defaultTheme","React","createElement","StyledBadge","isText","size"],"mappings":"6OAkCM,SAAUA,EAAMC,GAAE,IAAAC,EAAQD,EAAAC,SAAKC,EAAIC,EAAAH,EAAnB,cACdI,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAEL,OACEK,EAACC,cAAAC,EACCJ,EAAA,CAAAD,MAAOA,EACPM,OAA4B,iBAAbX,EACfY,KAAK,MACDX,GAEHD,EAGP"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import r,{css as o}from"styled-components";var e,i,t=r.span(i||(i=n(["\n border-width: 1px;\n border-style: solid;\n background-color: ",";\n color: ",";\n border-color: ",";\n text-align: center;\n border-radius: 1.5rem;\n font-size: ",";\n line-height: 1rem;\n padding: ",";\n display: inline-block;\n min-width: ",";\n\n ","\n"],["\n border-width: 1px;\n border-style: solid;\n background-color: ",";\n color: ",";\n border-color: ",";\n text-align: center;\n border-radius: 1.5rem;\n font-size: ",";\n line-height: 1rem;\n padding: ",";\n display: inline-block;\n min-width: ",";\n\n ","\n"])),(function(n){var r=n.theme.colors,o=n.backgroundColor;return o&&void 0!==r[o]?r[o]:o||r.primary}),(function(n){var r=n.theme.colors,o=n.textColor;return o&&void 0!==r[o]?r[o]:o||r.textOnPrimary}),(function(n){var r=n.theme.colors,o=n.borderColor,e=n.backgroundColor;return o&&void 0!==r[o]?r[o]:o||(e&&void 0!==r[e]?r[e]:e||r.primary)}),(function(n){return n.theme.fontSizes.m}),(function(n){return n.theme.spacing.xxs}),(function(n){var r=n.size,o=n.theme,e=o.spacing,i=o.spacing.xs;return"calc(".concat(e[r]," + ").concat(i,")")}),(function(r){var i=r.isText,t=r.theme,c=r.size;return!i&&o(e||(e=n(["\n padding: 0;\n border-radius: 50%;\n height: ",";\n width: ",";\n line-height: ",";\n svg {\n height: ",";\n }\n "],["\n padding: 0;\n border-radius: 50%;\n height: ",";\n width: ",";\n line-height: ",";\n svg {\n height: ",";\n }\n "])),"calc(".concat(t.spacing[c]," + ").concat(t.spacing.xs,")"),"calc(".concat(t.spacing[c]," + ").concat(t.spacing.xs,")"),"calc(".concat(t.spacing[c]," + ").concat(t.spacing.xs,")"),"calc(".concat(t.spacing[c]))}));export{t as StyledBadge,t as default};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Badge/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { type ColorKeyType, type SpaceType, type ThemeType } from \"../../types\";\n\ntype StyleBadgeProps = {\n backgroundColor?: string;\n borderColor?: string;\n textColor?: string;\n isText?: boolean;\n size: SpaceType;\n theme: ThemeType;\n};\n\nexport const StyledBadge = styled.span<StyleBadgeProps>`\n border-width: 1px;\n border-style: solid;\n background-color: ${({\n theme: { colors },\n backgroundColor,\n }: StyleBadgeProps) =>\n backgroundColor &&\n typeof colors[backgroundColor as ColorKeyType] !== \"undefined\"\n ? colors[backgroundColor as ColorKeyType]\n : backgroundColor || colors.primary};\n color: ${({ theme: { colors }, textColor }: StyleBadgeProps) =>\n textColor && typeof colors[textColor as ColorKeyType] !== \"undefined\"\n ? colors[textColor as ColorKeyType]\n : textColor || colors.textOnPrimary};\n border-color: ${({\n theme: { colors },\n borderColor,\n backgroundColor,\n }: StyleBadgeProps) =>\n borderColor && typeof colors[borderColor as ColorKeyType] !== \"undefined\"\n ? colors[borderColor as ColorKeyType]\n : borderColor ||\n (backgroundColor &&\n typeof colors[backgroundColor as ColorKeyType] !== \"undefined\"\n ? colors[backgroundColor as ColorKeyType]\n : backgroundColor || colors.primary)};\n text-align: center;\n border-radius: 1.5rem;\n font-size: ${({ theme }: StyleBadgeProps) => theme.fontSizes.m};\n line-height: 1rem;\n padding: ${({\n theme: {\n spacing: { xxs },\n },\n }: StyleBadgeProps) => xxs};\n display: inline-block;\n min-width: ${({\n size,\n theme: {\n spacing,\n spacing: { xs },\n },\n }: StyleBadgeProps) => `calc(${spacing[size]} + ${xs})`};\n\n ${({ isText, theme, size }: StyleBadgeProps) =>\n !isText &&\n css`\n padding: 0;\n border-radius: 50%;\n height: ${`calc(${theme.spacing[size]} + ${theme.spacing.xs})`};\n width: ${`calc(${theme.spacing[size]} + ${theme.spacing.xs})`};\n line-height: ${`calc(${theme.spacing[size]} + ${theme.spacing.xs})`};\n svg {\n height: ${`calc(${theme.spacing[size]}`};\n }\n `}\n`;\n\nexport default StyledBadge;\n"],"names":["StyledBadge","styled","span","templateObject_2","__makeTemplateObject","_a","colors","theme","backgroundColor","primary","textColor","textOnPrimary","borderColor","fontSizes","m","spacing","xxs","size","_b","xs","concat","isText","css"],"mappings":"2HAaa,QAAAA,EAAcC,EAAOC,KAAIC,IAAAA,EAAAC,EAAA,CAAA,uEAAA,eAAA,sBAAA,oEAAA,uCAAA,6CAAA,UAAA,MAAA,CAAiB,uEAUd,eAIA,sBAYK,oEAGkB,uCAMpC,6CAQ6B,UAapD,SArDiB,SAACC,OACVC,EAAMD,EAAAE,MAAAD,OACfE,EAAeH,EAAAG,gBAEf,OAAAA,QACmD,IAA5CF,EAAOE,GACVF,EAAOE,GACPA,GAAmBF,EAAOG,OAH9B,IAIO,SAACJ,OAAWC,EAAMD,EAAAE,MAAAD,OAAII,EAASL,EAAAK,UACtC,OAAAA,QAA0D,IAAtCJ,EAAOI,GACvBJ,EAAOI,GACPA,GAAaJ,EAAOK,aAFxB,IAGc,SAACN,GACN,IAAAC,iBACTM,EAAWP,EAAAO,YACXJ,EAAeH,EAAAG,gBAEf,OAAAI,QAA8D,IAAxCN,EAAOM,GACzBN,EAAOM,GACPA,IACCJ,QACkD,IAA5CF,EAAOE,GACVF,EAAOE,GACPA,GAAmBF,EAAOG,QANlC,IASW,SAACJ,GAA+B,OAAxBA,EAAAE,MAA8BM,UAAUC,CAAhB,IAElC,SAACT,GAIW,OAFLA,EAAAE,MAAAQ,QAAAC,GAEK,IAEV,SAACX,OACZY,EAAIZ,EAAAY,KACJC,EAGCb,EAAAE,MAFCQ,EAAOG,EAAAH,QACII,EAAED,EAAAH,QAAAI,GAEM,MAAA,eAAQJ,EAAQE,GAAK,OAAAG,OAAMD,EAAK,IAAhC,IAErB,SAACd,GAAE,IAAAgB,WAAQd,EAAKF,EAAAE,MAAEU,EAAIZ,EAAAY,KACtB,OAACI,GACDC,gLAAG,iEAG6D,mBACD,yBACM,mCAE1B,sBAJ/B,QAAAF,OAAQb,EAAMQ,QAAQE,iBAAWV,EAAMQ,QAAQI,GAAE,KAClD,QAAAC,OAAQb,EAAMQ,QAAQE,GAAK,OAAAG,OAAMb,EAAMQ,QAAQI,GAAK,KAC9C,QAAQC,OAAAb,EAAMQ,QAAQE,GAAW,OAAAG,OAAAb,EAAMQ,QAAQI,QAElD,QAAAC,OAAQb,EAAMQ,QAAQE,IARpC"}
@@ -0,0 +1,2 @@
1
+ import{__rest as e,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o}from"react";import{useTheme as m}from"styled-components";import{crukTheme as s}from"../../themes/cruk.js";import{StyledBox as i}from"./styles.js";var l=o((function(o,l){var n=e(o,[]),f=n.children,c=e(n,["children"]),p=m(),a=r(r({},s),p);return t.createElement(i,r({theme:a},c,{ref:l}),f)}));export{l as Box,l as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 { type SpacingProps } 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 css?: 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, ...rest } = props;\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n return (\n <StyledBox theme={theme} {...rest} ref={ref}>\n {children}\n </StyledBox>\n );\n },\n);\n\nexport default Box;\n"],"names":["Box","forwardRef","_a","ref","props","__rest","children","rest","foundTheme","useTheme","theme","__assign","defaultTheme","React","createElement","StyledBox"],"mappings":"gQA+BaA,EAAMC,GACjB,SAACC,EAAwBC,OAAnBC,EAAKC,EAAAH,EAAV,IACSI,EAAsBF,EAAdE,SAAKC,EAAIF,EAAKD,EAAxB,CAAqB,aACrBI,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGL,OACEK,EAACC,cAAAC,EAAUJ,EAAA,CAAAD,MAAOA,GAAWH,EAAI,CAAEJ,IAAKA,IACrCG,EAGP"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as r}from"styled-components";import{Spacing as t}from"../Spacing/index.js";var c,i,a=o.div(i||(i=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"],["\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"])),(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.colors,r=n.backgroundColor;return r&&void 0!==o[r]?o[r]:r||"transparent"}),(function(o){return o.css&&r(c||(c=n(["\n ","\n "],["\n ","\n "])),o.css)}),(function(n){return t(n,n.theme)}));export{a as StyledBox,a as default};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Box/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport Spacing, { type SpacingProps } from \"../Spacing\";\nimport { type ColorKeyType, type ThemeType } from \"../../types\";\n\ntype StyledBoxProps = SpacingProps & {\n backgroundColor?: string;\n css?: string;\n theme: ThemeType;\n};\n\nexport const StyledBox = styled.div<StyledBoxProps>`\n background-color: ${({ theme }: StyledBoxProps) =>\n theme.colors.backgroundLight};\n padding: ${({ theme, backgroundColor }: StyledBoxProps) =>\n backgroundColor ? theme.spacing.s : 0};\n margin: 0 0 ${({ theme }: StyledBoxProps) => theme.spacing.m} 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ${({\n theme: { colors },\n backgroundColor,\n }: StyledBoxProps) =>\n backgroundColor &&\n typeof colors[backgroundColor as ColorKeyType] !== \"undefined\"\n ? colors[backgroundColor as ColorKeyType]\n : backgroundColor || \"transparent\"};\n\n ${(props: StyledBoxProps) =>\n props.css &&\n css`\n ${props.css}\n `}\n ${(props) => Spacing(props, props.theme as ThemeType)}\n`;\n\nexport default StyledBox;\n"],"names":["StyledBox","styled","div","templateObject_2","__makeTemplateObject","_a","theme","colors","backgroundLight","backgroundColor","spacing","s","m","props","css","templateObject_1","Spacing"],"mappings":"iLAWaA,EAAYC,EAAOC,IAAmBC,IAAAA,EAAAC,EAAA,CAAA,yBAAA,iBAAA,oBAAA,8EAAA,UAAA,OAAA,MAAA,CAAA,yBAEnB,iBAES,oBACqB,8EAatB,UAMnC,OACkD,SAxBjC,SAACC,GACnB,OAD0BA,EAAAC,MACpBC,OAAOC,eAAb,IACS,SAACH,OAAEC,EAAKD,EAAAC,MACjB,OADkCD,EAAAI,gBAChBH,EAAMI,QAAQC,EAAI,CAApC,IACY,SAACN,GAA8B,OAAvBA,EAAAC,MAA6BI,QAAQE,CAAd,IAMzB,SAACP,OACVE,EAAMF,EAAAC,MAAAC,OACfE,EAAeJ,EAAAI,gBAEf,OAAAA,QACmD,IAA5CF,EAAOE,GACVF,EAAOE,GACPA,GAAmB,aAHvB,IAKA,SAACI,GACD,OAAAA,EAAMC,KACNA,EAAGC,IAAAA,EAAAX,EAAA,CAAA,WAAA,UAAA,CAAA,WACU,YAATS,EAAMC,IAFV,IAIA,SAACD,GAAU,OAAAG,EAAQH,EAAOA,EAAMP"}
@@ -0,0 +1,2 @@
1
+ import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import r,{forwardRef as t}from"react";import{useTheme as o}from"styled-components";import{crukTheme as n}from"../../themes/cruk.js";import{IconFa as i}from"../IconFa/index.js";import{StyledButton as l,Spacer as m}from"./styles.js";var a=t((function(t,a){var s=o(),p=e(e({},n),s),c=t.appearance,f=void 0===c?"primary":c,u=t.isIconButton,d=void 0!==u&&u,h=r.Children.toArray(t.children),y="string"==typeof h[0],v=h[0],b=!(!d&&(1===h.length&&!y&&(null==v?void 0:v.type))!==i);return r.createElement(l,e({as:t.href?"a":"button"},t.href?{role:"button"}:{},{full:!1,size:"m"},t,{appearance:f,isIconButton:b,theme:p,ref:a}),t.children&&h.length?r.Children.map(t.children,(function(e,t){return r.createElement(m,{theme:p,key:t},e)})):null)}));export{a as Button,a as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const { appearance = \"primary\", isIconButton = false } = props;\n const childArray = React.Children.toArray(props.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 {...{\n full: false,\n size: \"m\",\n ...props,\n }}\n appearance={appearance}\n isIconButton={setIconButton}\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","childArray","React","Children","toArray","children","isChildString","firstElement","setIconButton","length","type","IconFa","createElement","StyledButton","as","href","role","full","size","map","child","index","Spacer","key"],"mappings":"+SAyCaA,EAASC,GACpB,SAACC,EAAoBC,GACnB,IAAMC,EAAaC,IAEbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAEGK,EAAiDP,EAAKQ,WAAtDA,aAAa,UAASD,EAAEE,EAAyBT,EAALU,aAApBA,OAAe,IAAAD,KACzCE,EAAaC,EAAMC,SAASC,QAAQd,EAAMe,UAC1CC,EAAyC,iBAAlBL,EAAW,GAClCM,EAAeN,EAAW,GAG1BO,KACJR,IACuB,IAAtBC,EAAWQ,SAAiBH,IAAiBC,aAAY,EAAZA,EAAcG,SAC1DC,GAGJ,OACET,EAACU,cAAAC,EACClB,EAAA,CAAAmB,GAAIxB,EAAMyB,KAAO,IAAM,UAClBzB,EAAMyB,KAAO,CAAEC,KAAM,UAAa,CAAE,EAEvC,CAAAC,MAAM,EACNC,KAAM,KACH5B,EAAK,CAEVQ,WAAYA,EACZE,aAAcQ,EACdd,MAAOA,EACPH,IAAKA,IAEJD,EAAMe,UAAYJ,EAAWQ,OAC1BP,EAAMC,SAASgB,IACb7B,EAAMe,UACN,SAACe,EAAkBC,GAAkB,OACnCnB,EAAAU,cAACU,EAAM,CAAC5B,MAAOA,EAAO6B,IAAKF,GACxBD,MAIP,KAGV"}
@@ -0,0 +1,2 @@
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};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +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\ntype StyledButtonProps = {\n isIconButton: boolean;\n appearance?: ButtonAppearanceType;\n full?: boolean;\n theme: ThemeType;\n href?: string;\n size?: \"m\" | \"l\";\n css?: string;\n};\n\nexport const StyledButton = styled.button<StyledButtonProps>`\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 }) => (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","templateObject_7"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{faCaretLeft as n,faCaretRight as r}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{IconFa as l}from"../IconFa/index.js";import{ButtonWrapper as o,DotContainer as c,Dot as a,ScreenReaderOnly as i,CarouselButton as m,VerticalAlign as s}from"./styles.js";var u=function(r){return t.createElement("div",null,t.createElement(m,e({},r,{"aria-label":"previous"}),t.createElement(s,null,t.createElement(l,{faIcon:n,size:"1.25em"}),t.createElement(i,null,"Scroll carousel to previous index"))))},d=function(n){return t.createElement("div",null,t.createElement(m,e({},n,{"aria-label":"next"}),t.createElement(s,null,t.createElement(l,{faIcon:r,size:"1.25em"}),t.createElement(i,null,"Scroll carousel to previous index"))))},f=function(e){var n=e.count,r=e.currentPosition,l=void 0===r?0:r,m=e.scrollToPosition,s=e.next,f=e.previous,E=l!==n-1,p=0!==l,v=Array.from({length:n},(function(e,t){return"arrayIndex".concat(t)}));return t.createElement(o,null,t.createElement(u,{disabled:!p,onClick:f}),t.createElement(c,{count:n},v.map((function(e,n){var r=n===l;return t.createElement(a,{key:e,selected:r,role:"switch","aria-checked":r,onClick:function(){m(n)}},t.createElement(i,null,"Scroll carousel to index ".concat(n)))}))),t.createElement(d,{disabled:!E,onClick:s}))};export{u as CarouselLeftButton,d as CarouselRightButton,f as Dots,f as default};
2
+ //# sourceMappingURL=Dots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dots.js","sources":["../../../../src/components/Carousel/Dots.tsx"],"sourcesContent":["import React, { type ButtonHTMLAttributes } 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\ntype DotProps = {\n count: number;\n currentPosition: number;\n scrollToPosition: (to: number) => void;\n next: () => void;\n previous: () => void;\n};\n\nexport const CarouselLeftButton = (\n props: ButtonHTMLAttributes<HTMLElement>,\n) => (\n <div>\n <CarouselButton {...props} aria-label=\"previous\">\n <VerticalAlign>\n <IconFa faIcon={faCaretLeft} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n </div>\n);\n\nexport const CarouselRightButton = (\n props: ButtonHTMLAttributes<HTMLElement>,\n) => (\n <div>\n <CarouselButton {...props} aria-label=\"next\">\n <VerticalAlign>\n <IconFa faIcon={faCaretRight} size=\"1.25em\" />\n <ScreenReaderOnly>Scroll carousel to previous index</ScreenReaderOnly>\n </VerticalAlign>\n </CarouselButton>\n </div>\n);\n\nexport const Dots = ({\n count,\n currentPosition = 0,\n scrollToPosition,\n next,\n previous,\n}: DotProps) => {\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 <CarouselLeftButton disabled={!moreOnLeft} onClick={previous} />\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 selected={isSelected}\n role=\"switch\"\n aria-checked={isSelected}\n onClick={scrollTo}\n >\n <ScreenReaderOnly>{`Scroll carousel to index ${index}`}</ScreenReaderOnly>\n </Dot>\n );\n })}\n </DotContainer>\n\n <CarouselRightButton disabled={!moreOnRight} onClick={next} />\n </ButtonWrapper>\n );\n};\n\nexport default Dots;\n"],"names":["CarouselLeftButton","props","React","createElement","CarouselButton","__assign","VerticalAlign","IconFa","faIcon","faCaretLeft","size","ScreenReaderOnly","CarouselRightButton","faCaretRight","Dots","_a","count","_b","currentPosition","scrollToPosition","next","previous","moreOnRight","moreOnLeft","countArray","Array","from","length","e","i","concat","ButtonWrapper","disabled","onClick","DotContainer","map","item","index","isSelected","Dot","key","selected","role"],"mappings":"8XAsBaA,EAAqB,SAChCC,GACG,OACHC,EAAAC,cAAA,MAAA,KACED,EAAAC,cAACC,EAAcC,EAAA,CAAA,EAAKJ,EAAK,CAAA,aAAa,aACpCC,EAAAC,cAACG,EAAa,KACZJ,EAACC,cAAAI,GAAOC,OAAQC,EAAaC,KAAK,WAClCR,EAACC,cAAAQ,8CAIP,EAEWC,EAAsB,SACjCX,GACG,OACHC,EAAAC,cAAA,MAAA,KACED,EAAAC,cAACC,EAAcC,EAAA,CAAA,EAAKJ,EAAK,CAAA,aAAa,SACpCC,EAAAC,cAACG,EAAa,KACZJ,EAACC,cAAAI,GAAOC,OAAQK,EAAcH,KAAK,WACnCR,EAACC,cAAAQ,8CAIP,EAEWG,EAAO,SAACC,GACnB,IAAAC,UACAC,EAAAF,EAAAG,gBAAAA,aAAkB,EAACD,EACnBE,qBACAC,EAAIL,EAAAK,KACJC,EAAQN,EAAAM,SAEFC,EAAcJ,IAAoBF,EAAQ,EAC1CO,EAAiC,IAApBL,EACbM,EAAaC,MAAMC,KAAK,CAAEC,OAAQX,IAAS,SAACY,EAAGC,GAAM,MAAA,aAAAC,OAAaD,EAAG,IAE3E,OACE3B,gBAAC6B,EAAa,KACZ7B,EAACC,cAAAH,EAAmB,CAAAgC,UAAWT,EAAYU,QAASZ,IAEpDnB,EAAAC,cAAC+B,EAAY,CAAClB,MAAOA,GAClBQ,EAAWW,KAAI,SAACC,EAAMC,GACrB,IAAMC,EAAaD,IAAUnB,EAI7B,OACEhB,gBAACqC,EAAG,CACFC,IAAKJ,EACLK,SAAUH,EACVI,KAAK,SAAQ,eACCJ,EACdL,QATa,WACfd,EAAiBkB,EACnB,GASInC,EAACC,cAAAQ,OAAkB,4BAA4BmB,OAAAO,IAGrD,KAGFnC,EAAAC,cAACS,EAAmB,CAACoB,UAAWV,EAAaW,QAASb,IAG5D"}
@@ -0,0 +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(),x=void 0!==f,P=n(f||0),T=P[0],y=P[1],j=n(!x),W=j[0],k=j[1],b=r(null),B=e.Children.toArray(m).filter(Boolean),S=function(e){if(null==b?void 0:b.current){var t=b.current.scrollWidth,n=0===e,r=e===b.current.children.length-1,l=b.current.children[e];if(!l)return;var o=l.offsetLeft;n?b.current.scrollTo(0,0):r?b.current.scrollTo(t,0):b.current.scrollTo(o,0),W||k(!0)}};l((function(){x&&k(!1)}),[f]),l((function(){W||S(f||0)}),[W]);var U=1===B.length;return e.createElement(e.Fragment,null,e.createElement(i,null,e.createElement(u,null,e.createElement(s,{ref:b,"aria-live":"assertive",smoothScrolling:W,tabIndex:0},B.map((function(t,n){var r=n===T,l="card-".concat(n);return e.createElement(a,{key:l,onlyChild:U,fullWidthChild:p},e.createElement(o,{threshold:.5,as:"div",onChange:function(e){var t;e&&T!==(t=n)&&(y(t),C&&clearTimeout(null==C?void 0:C.current),C.current=setTimeout((function(){h&&W&&h(t)}),500))}},e.createElement(d,{onlyChild:U,isSelected:r,shrinkUnselectedPages:g,fullWidthChild:p},t)))}))))),B.length>1?e.createElement(i,null,e.createElement(c,{count:B.length,currentPosition:T,scrollToPosition:S,next:function(){S(T+1)},previous:function(){S(T-1)}})):null)};t(f);export{f as Carousel};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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","InView","threshold","as","onChange","inView","clearTimeout","setTimeout","CarouselCardInner","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,EAEtB,CACH,EAGAmB,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,YACVF,gBAAiBA,EACjB4B,SAAU,GAETzB,EAAW0B,KAAI,SAACC,EAAOC,GACtB,IAAMC,EAAaD,IAAUlC,EACvBoC,EAAY,QAAQC,OAAAH,GAC1B,OACEvC,EAAA8B,cAACa,EAAY,CACXC,IAAKH,EACLZ,UAAWA,EACX/B,eAAgBA,GAEhBE,EAAA8B,cAACe,EAAM,CACLC,UAAW,GACXC,GAAG,MACHC,SAAU,SAACC,GA1FT,IAAChC,EA2FGgC,GA1FlB5C,KADeY,EA4FasB,KA1FhCjC,EAAmBW,GAEflB,GACFmD,aAAanD,eAAAA,EAAOmB,SAEtBnB,EAAMmB,QAAUiC,YAAW,WACrBzD,GAAqBc,GAMvBd,EAAkBuB,EAErB,GAAE,QAgFajB,EAAC8B,cAAAsB,GACCvB,UAAWA,EACXW,WAAYA,EACZ5C,sBAAuBA,EACvBE,eAAgBA,GAEfwC,IAKV,OAIN3B,EAAWY,OAAS,EACnBvB,EAAA8B,cAACE,EAAG,KACFhC,EAAA8B,cAACuB,EAAI,CACHC,MAAO3C,EAAWY,OAClBlB,gBAAiBA,EACjBW,iBAAkBA,EAClBuC,KAlGG,WACXvC,EAAiBX,EAAkB,EACrC,EAiGUmD,SA/FO,WACfxC,EAAiBX,EAAkB,EACrC,KAgGQ,KAGV,EAEeoD,EAAKnE"}
@@ -0,0 +1,2 @@
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};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Carousel/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ButtonHTMLAttributes } from \"react\";\n\nimport { type ThemeType } from \"../../types\";\n\nexport const CarouselWrapper = styled.div`\n position: relative;\n width: 100%;\n overflow-y: hidden;\n`;\n\ntype ThemeProps = {\n theme: ThemeType;\n};\n\ntype CarouselScrollAreaProps = {\n smoothScrolling: boolean;\n};\n\ntype CarouselCardProps = {\n onlyChild: boolean;\n fullWidthChild: boolean;\n};\n\ntype CarouselCardInnerProps = {\n isSelected: boolean;\n shrinkUnselectedPages: boolean;\n onlyChild: boolean;\n fullWidthChild: boolean;\n};\n\nexport const CarouselScrollArea = styled.ul<CarouselScrollAreaProps>`\n position: relative;\n overflow-x: scroll;\n scroll-snap-type: x mandatory;\n scroll-behavior: ${({ smoothScrolling }) =>\n smoothScrolling ? \"smooth\" : \"auto\"};\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\nexport const CarouselCard = styled.li<CarouselCardProps>`\n scroll-snap-align: center;\n display: inline-block;\n width: ${({ onlyChild, fullWidthChild }) =>\n onlyChild || fullWidthChild ? \"100%\" : \"80%\"};\n`;\n\nexport const CarouselCardInner = styled.div<CarouselCardInnerProps>`\n transition: transform 0.2s linear;\n transform: ${({\n isSelected,\n shrinkUnselectedPages,\n onlyChild,\n fullWidthChild,\n }) =>\n onlyChild || (isSelected && shrinkUnselectedPages) || fullWidthChild\n ? \"scale(1)\"\n : \"scale(0.9)\"};\n`;\n\nexport const ButtonWrapper = styled.div`\n display: flex;\n justify-content: center;\n`;\n\nexport const VerticalAlign = styled.span`\n display: block;\n margin: auto;\n height: 2rem;\n line-height: 1.75rem;\n`;\n\ntype CarouselButtonProps = ThemeProps & ButtonHTMLAttributes<HTMLElement>;\n\nexport const CarouselButton = styled.button<CarouselButtonProps>`\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: ${({ disabled, theme }) =>\n disabled\n ? theme.colors.disabled\n : theme.name === \"su2c\"\n ? theme.colors.textDark\n : theme.colors.primary};\n font-size: ${({ theme }) => theme.fontSizes.xxxl};\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: ${({ disabled }) => (disabled ? \"scale(0.8)\" : \"scale(1)\")};\n }\n`;\n\ntype DotContainerProps = ThemeProps & {\n count: number;\n};\n\nexport const DotContainer = styled.div<DotContainerProps>`\n display: flex;\n flex-direction: row;\n justify-content: center;\n display: ${({ count }) => (count > 6 ? \"none\" : \"flex\")};\n\n @media (min-width: ${({ theme }) => theme.breakpoint.tablet}) {\n display: ${({ count }) => (count > 10 ? \"none\" : \"flex\")};\n }\n\n @media (min-width: ${({ theme }) => theme.breakpoint.desktop}) {\n display: ${({ count }) => (count > 20 ? \"none\" : \"flex\")};\n }\n`;\n\nexport const Dot = styled.button<ThemeProps & { selected: boolean }>`\n border: none;\n outline-offset: ${({ theme }) => theme.spacing.xxs};\n padding: 0;\n margin: ${({ theme }) => `auto ${theme.spacing.xxs}`};\n width: ${({ theme }) => theme.fontSizes.l};\n height: ${({ theme }) => theme.fontSizes.l};\n border-radius: 50%;\n /* TODO if this makes it into the component library carouselButtonColor should be a theme prop */\n border: ${({ theme }) =>\n `solid 1px ${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`};\n background-color: ${({ theme, selected }) =>\n selected\n ? `${\n theme.name === \"su2c\" ? theme.colors.textDark : theme.colors.primary\n }`\n : theme.colors.backgroundLight};\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\n// TODO move to its own component\nexport const ScreenReaderOnly = styled.span`\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"],"names":["CarouselWrapper","styled","div","templateObject_1","__makeTemplateObject","CarouselScrollArea","ul","templateObject_2","_a","smoothScrolling","CarouselCard","li","templateObject_3","onlyChild","fullWidthChild","CarouselCardInner","templateObject_4","isSelected","shrinkUnselectedPages","ButtonWrapper","templateObject_5","VerticalAlign","span","templateObject_6","CarouselButton","button","templateObject_7","disabled","theme","colors","name","textDark","primary","fontSizes","xxxl","DotContainer","count","breakpoint","tablet","desktop","Dot","templateObject_9","spacing","xxs","l","concat","selected","backgroundLight","ScreenReaderOnly","templateObject_10"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import o,{forwardRef as t}from"react";import{useTheme as s,ThemeProvider as i}from"styled-components";import{faCheck as l}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as a}from"../../themes/cruk.js";import{ErrorText as d}from"../ErrorText/index.js";import{IconFa as m}from"../IconFa/index.js";import{StyledLabel as c,StyledInput as n,SelectedBorder as f,CheckWrapper as u,Check as p}from"./styles.js";var h=t((function(t,h){var E=s(),b=e(e({},a),E),x=t.children,g=r(t,["children"]);return o.createElement(i,{theme:b},o.createElement(c,{hasError:t.hasError||!!t.errorMessage||!1,checked:t.checked||t.defaultChecked||!1,disabled:t.disabled||!1},o.createElement(n,e({},g,{disabled:t.disabled||!1,type:"checkbox",ref:h,"aria-describedby":t.id&&t.errorMessage?"".concat(t.id,"-error"):void 0})),o.createElement(f,null),x||t.value,b.utilities.useDefaultFromControls?null:o.createElement(u,null,o.createElement(p,null,o.createElement(m,{faIcon:l,color:"check",size:"1.25em"})))),!!t.errorMessage&&o.createElement(d,{marginTop:"xxs",id:t.id?"".concat(t.id,"-error"):void 0},t.errorMessage))}));export{h as Checkbox,h as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Checkbox/index.tsx"],"sourcesContent":["import React, {\n type InputHTMLAttributes,\n type Ref,\n forwardRef,\n type ReactNode,\n type LegacyRef,\n} from \"react\";\nimport { useTheme, ThemeProvider } from \"styled-components\";\nimport { faCheck } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { ErrorText } from \"../ErrorText\";\nimport { IconFa } from \"../IconFa\";\n\nimport {\n StyledLabel,\n StyledInput,\n CheckWrapper,\n Check,\n SelectedBorder,\n} from \"./styles\";\n\nexport type CheckBoxProps = InputHTMLAttributes<HTMLInputElement> & {\n ref?: Ref<HTMLInputElement> | LegacyRef<HTMLInputElement>;\n /** flag for error styling */\n hasError?: boolean;\n /** error message text */\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n * Checkboxes allow the user to select one or more items.\n *\n * The value or children becomes the label, if you want an outer label for a checkbox or group of checkboxes please use a LegendWrapper component\n */\nexport const Checkbox = forwardRef(\n (props: CheckBoxProps, ref?: Ref<HTMLInputElement>) => {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n const { children, ...propsWithoutChildren } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n hasError={props.hasError || !!props.errorMessage || false}\n checked={props.checked || props.defaultChecked || false}\n disabled={props.disabled || false}\n >\n <StyledInput\n {...propsWithoutChildren}\n disabled={props.disabled || false}\n type=\"checkbox\"\n ref={ref}\n aria-describedby={\n !!props.id && !!props.errorMessage\n ? `${props.id}-error`\n : undefined\n }\n />\n <SelectedBorder />\n {children || props.value}\n {theme.utilities.useDefaultFromControls ? null : (\n <CheckWrapper>\n <Check>\n <IconFa faIcon={faCheck} color=\"check\" size=\"1.25em\" />\n </Check>\n </CheckWrapper>\n )}\n </StyledLabel>\n {!!props.errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {props.errorMessage}\n </ErrorText>\n )}\n </ThemeProvider>\n );\n },\n);\n\nexport default Checkbox;\n"],"names":["Checkbox","forwardRef","props","ref","foundTheme","useTheme","theme","__assign","defaultTheme","children","propsWithoutChildren","__rest","React","createElement","ThemeProvider","StyledLabel","hasError","errorMessage","checked","defaultChecked","disabled","StyledInput","type","id","concat","undefined","SelectedBorder","value","utilities","useDefaultFromControls","CheckWrapper","Check","IconFa","faIcon","faCheck","color","size","ErrorText","marginTop"],"mappings":"ghBAoCaA,EAAWC,GACtB,SAACC,EAAsBC,GACrB,IAAMC,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAEGK,EAAsCP,EAA9BO,SAAKC,EAAoBC,EAAKT,EAAxC,CAAqC,aAE3C,OACEU,EAACC,cAAAC,EAAc,CAAAR,MAAOA,GACpBM,EAAAC,cAACE,EAAW,CACVC,SAAUd,EAAMc,YAAcd,EAAMe,eAAgB,EACpDC,QAAShB,EAAMgB,SAAWhB,EAAMiB,iBAAkB,EAClDC,SAAUlB,EAAMkB,WAAY,GAE5BR,EAAAC,cAACQ,EAAWd,EAAA,CAAA,EACNG,EAAoB,CACxBU,SAAUlB,EAAMkB,WAAY,EAC5BE,KAAK,WACLnB,IAAKA,EAEH,mBAAED,EAAMqB,IAAQrB,EAAMe,aAClB,GAAAO,OAAGtB,EAAMqB,GAAU,eACnBE,KAGRb,EAAAC,cAACa,EAAiB,MACjBjB,GAAYP,EAAMyB,MAClBrB,EAAMsB,UAAUC,uBAAyB,KACxCjB,gBAACkB,EAAY,KACXlB,EAAAC,cAACkB,EAAK,KACJnB,EAAAC,cAACmB,EAAO,CAAAC,OAAQC,EAASC,MAAM,QAAQC,KAAK,gBAKjDlC,EAAMe,cACPL,EAACC,cAAAwB,EACC,CAAAC,UAAU,MACVf,GAAIrB,EAAMqB,GAAK,UAAGrB,EAAMqB,GAAE,eAAWE,GAEpCvB,EAAMe,cAKjB"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as t}from"styled-components";var i,e,r,s,a,l,c,d,p="1.5rem",h=o.div(i||(i=n(["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"],["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"])),p,p,p,(function(n){return n.theme.spacing.xs})),u=o.span(e||(e=n(["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"],["\n display: block;\n position: relative;\n border: 2px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n"])),(function(n){return n.theme.colors.selectionBorder}),p,p),b=o.label(s||(s=n(["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"],["\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ",";\n font-size: ",";\n font-family: ",";\n\n background-color: ",";\n position: relative;\n\n cursor: ",";\n display: block;\n\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ",";\n }\n }\n\n ","\n"])),(function(n){return n.theme.typography.lineHeight}),(function(n){return n.theme.typography.fontSizeBase}),(function(n){return n.theme.typography.fontFamilyBase}),(function(n){return n.theme.colors.backgroundLight}),(function(n){return n.disabled?"not-allowed":"pointer"}),(function(n){var o=n.theme;return n.disabled?o.colors.disabled:o.colors.textDark}),(function(n){var o=n.theme;return"calc( (".concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.m," calc( (").concat("3em"," - ( ").concat(o.utilities.inputBorderWidth," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.xl)}),h,u,(function(n){var o=n.theme;return n.disabled&&o.colors.disabled}),(function(o){var i=o.theme,e=o.disabled,s=o.checked,a=o.hasError;return i.utilities.useDefaultFromControls?null:t(r||(r=n(["\n min-height: 2rem;\n\n "," "," {\n border: solid ","\n ",";\n }\n\n &:hover "," "," {\n border: solid ","\n ",";\n }\n "],["\n min-height: 2rem;\n\n "," "," {\n border: solid ","\n ",";\n }\n\n &:hover "," "," {\n border: solid ","\n ",";\n }\n "])),h,u,"2px",e?i.colors.disabled:a?i.colors.danger:s?i.colors.check:i.colors.inputBorder,h,u,"2px",e?i.colors.disabled:i.colours)})),f=o.div(a||(a=n(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),g=o.input(d||(d=n(["\n margin-right: 5px !important;\n\n ","\n"],["\n margin-right: 5px !important;\n\n ","\n"])),(function(o){var i=o.theme;return i.utilities.useDefaultFromControls?t(l||(l=n(["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "],["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "])),i.spacing.s):t(c||(c=n(["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," svg path {\n transform: rotateY(0deg);\n }\n "],["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," svg path {\n transform: rotateY(0deg);\n }\n "])),i.spacing.xxs,f,i.colors.inputBorder,h)}));export{u as Check,h as CheckWrapper,f as SelectedBorder,g as StyledInput,b as StyledLabel};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Checkbox/styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\n\nconst CHECK_BOX_SIZE = \"1.5rem\";\nconst BUTTON_HEIGHT = \"3em\";\nconst BORDER_THICKNESS = \"2px\";\n\ntype StyledLabelProps = {\n checked: boolean;\n disabled: boolean;\n hasError: boolean;\n theme: ThemeType;\n};\n\ntype ThemeProps = {\n theme: ThemeType;\n};\n\nexport const CheckWrapper = styled.div<ThemeProps>`\n display: inline-block;\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n position: absolute;\n top: calc(50% - (${CHECK_BOX_SIZE} / 2));\n left: ${({\n theme: {\n spacing: { xs },\n },\n }) => xs};\n`;\n\nexport const Check = styled.span<ThemeProps>`\n display: block;\n position: relative;\n border: 2px solid ${({ theme }) => theme.colors.selectionBorder};\n height: ${CHECK_BOX_SIZE};\n width: ${CHECK_BOX_SIZE};\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n\n svg {\n path {\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n }\n }\n`;\n\nexport const StyledLabel = styled.label<StyledLabelProps>`\n box-sizing: border-box;\n *,\n *:after,\n *:before {\n box-sizing: border-box;\n }\n line-height: ${({ theme }) => theme.typography.lineHeight};\n font-size: ${({ theme }) => theme.typography.fontSizeBase};\n font-family: ${({ theme }) => theme.typography.fontFamilyBase};\n\n background-color: ${({ theme }) => theme.colors.backgroundLight};\n position: relative;\n\n cursor: ${({ disabled }) => (disabled ? \"not-allowed\" : \"pointer\")};\n display: block;\n\n color: ${({ theme, disabled }) =>\n disabled ? theme.colors.disabled : theme.colors.textDark};\n padding: ${({ theme }) =>\n `calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.m} calc( (${BUTTON_HEIGHT} - ( ${theme.utilities.inputBorderWidth} * 2) - ${theme.typography.lineHeight} ) / 2) ${theme.spacing.xl}`};\n &:focus ~ ${CheckWrapper} ${Check} {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n svg {\n path {\n fill: ${({ theme, disabled }) => disabled && theme.colors.disabled};\n }\n }\n\n ${({ theme, disabled: isDisabled, checked, hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n\n ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${isDisabled\n ? theme.colors.disabled\n : hasError\n ? theme.colors.danger\n : checked\n ? theme.colors.check\n : theme.colors.inputBorder};\n }\n\n &:hover ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${isDisabled ? theme.colors.disabled : theme.colours};\n }\n `}\n`;\n\nexport const SelectedBorder = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n`;\n\n// TODO when we get rid of bootstrap remove !important.\nexport const StyledInput = styled.input<ThemeProps>`\n margin-right: 5px !important;\n\n ${({ theme }) =>\n theme.utilities.useDefaultFromControls\n ? css`\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ${theme.spacing.s};\n `\n : css`\n /* This hides the original input */\n position: absolute;\n left: ${theme.spacing.xxs};\n opacity: 0;\n\n &:focus ~ ${SelectedBorder} {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ${theme.colors.inputBorder};\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ ${CheckWrapper} svg path {\n transform: rotateY(0deg);\n }\n `}\n`;\n"],"names":["CHECK_BOX_SIZE","CheckWrapper","styled","div","templateObject_1","__makeTemplateObject","_a","theme","spacing","xs","Check","span","templateObject_2","colors","selectionBorder","StyledLabel","label","templateObject_4","typography","lineHeight","fontSizeBase","fontFamilyBase","backgroundLight","disabled","textDark","concat","utilities","inputBorderWidth","m","xl","isDisabled","checked","hasError","useDefaultFromControls","css","templateObject_3","danger","check","inputBorder","colours","SelectedBorder","templateObject_5","StyledInput","input","templateObject_8","templateObject_6","s","templateObject_7","xxs"],"mappings":"2HAGA,oBAAMA,EAAiB,SAeVC,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,yCAAA,eAAA,gDAAA,oBAAA,OAAA,CAAY,yCAExB,eACD,gDAEU,oBAKzB,SAREL,EACDA,EAEUA,GACX,SAACM,GAIH,OAFWA,EAAAC,MAAAC,QAAAC,EAEX,IAGKC,EAAQR,EAAOS,KAAIC,IAAAA,EAAAP,EAAA,CAAA,mEAAA,gBAAA,eAAA,8QAAA,CAAY,mEAGqB,gBACvC,eACD,iRAFH,SAACC,GAAc,OAAPA,EAAAC,MAAaM,OAAOC,eAAb,GACzBd,EACDA,GAkBEe,EAAcb,EAAOc,MAAuBC,IAAAA,EAAAZ,EAAA,CAAA,iHAAA,mBAAA,qBAAA,4BAAA,yCAAA,oCAAA,iBAAA,kBAAA,IAAA,+JAAA,sBAAA,MAAA,CAAA,iHAOE,mBACA,qBACI,4BAEE,yCAGG,oCAIR,iBAE0M,kBAC5O,IAAS,+JAOqC,sBAyB/D,SA9CQ,SAACC,GAAc,OAAPA,EAAAC,MAAaW,WAAWC,UAAjB,IACjB,SAACb,GAAc,OAAPA,EAAAC,MAAaW,WAAWE,YAAjB,IACb,SAACd,GAAc,OAAPA,EAAAC,MAAaW,WAAWG,cAAjB,IAEV,SAACf,GAAc,OAAPA,EAAAC,MAAaM,OAAOS,eAAb,IAGzB,SAAChB,GAAiB,OAAPA,EAAAiB,SAAmB,cAAgB,SAA5B,IAGnB,SAACjB,OAAEC,EAAKD,EAAAC,MACf,OADyBD,EAAAiB,SACdhB,EAAMM,OAAOU,SAAWhB,EAAMM,OAAOW,QAAhD,IACS,SAAClB,GAAE,IAAAC,EAAKD,EAAAC,MACjB,MAAA,iBAtEkB,MAsEK,SAAAkB,OAAQlB,EAAMmB,UAAUC,iBAAgB,YAAAF,OAAWlB,EAAMW,WAAWC,8BAAqBZ,EAAMC,QAAQoB,EAAY,YAAAH,OAtExH,sBAsE6IlB,EAAMmB,UAAUC,oCAA2BpB,EAAMW,WAAWC,WAAqB,YAAAM,OAAAlB,EAAMC,QAAQqB,GAA9P,GACU5B,EAAgBS,GAOhB,SAACJ,OAAEC,EAAKD,EAAAC,MAAiB,OAAPD,EAAAiB,UAAmBhB,EAAMM,OAAOU,QAAzB,IAInC,SAACjB,OAAEC,EAAKD,EAAAC,MAAYuB,EAAUxB,EAAAiB,SAAEQ,EAAOzB,EAAAyB,QAAEC,EAAQ1B,EAAA0B,SACjD,OAAAzB,EAAMmB,UAAUO,uBACZ,KACAC,EAAGC,IAAAA,EAAA9B,EAAA,CAAA,8CAAA,IAAA,iCAAA,mBAAA,uCAAA,IAAA,iCAAA,mBAAA,4BAAA,CAAA,8CAGa,IAAS,iCACW,mBAOE,uCAGd,IAAS,iCACG,mBACsB,8BAbtDJ,EAAgBS,EAvFH,MAyFToB,EACEvB,EAAMM,OAAOU,SACbS,EACEzB,EAAMM,OAAOuB,OACbL,EACExB,EAAMM,OAAOwB,MACb9B,EAAMM,OAAOyB,YAGfrC,EAAgBS,EAlGX,MAoGToB,EAAavB,EAAMM,OAAOU,SAAWhB,EAAMgC,QAlBvD,IAuBSC,EAAiBtC,EAAOC,IAAGsC,IAAAA,EAAApC,EAAA,CAAA,qFAAA,CAAA,wFAS3BqC,EAAcxC,EAAOyC,MAAKC,IAAAA,EAAAvC,EAAA,CAAA,0CAAA,MAAA,CAAY,0CA6B1C,SA1BL,SAACC,GAAE,IAAAC,EAAKD,EAAAC,MACR,OAAAA,EAAMmB,UAAUO,uBACZC,EAAGW,IAAAA,EAAAxC,EAAA,CAAA,qMAAA,eAAA,CAAA,qMAOsB,iBAAfE,EAAMC,QAAQsC,GAExBZ,EAAGa,IAAAA,EAAA1C,EAAA,CAAA,mGAAA,mDAAA,sFAAA,8GAAA,6EAAA,CAAA,mGAGwB,mDAGC,sFAE8B,8GAI9B,+EATlBE,EAAMC,QAAQwC,IAGVR,EAEoBjC,EAAMM,OAAOyB,YAI/BrC,EAtBpB"}
@@ -0,0 +1,2 @@
1
+ import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useRef as r,useEffect as o}from"react";import{useTheme as a}from"styled-components";import{faChevronDown as i}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as l}from"../../themes/cruk.js";import{CustomHeader as c,DefaultHeader as d,FlippingIcon as m,CollapseContent as u,transitionDurationSeconds as s}from"./styles.js";function p(p){var h=p.id,f=p.headerTitleText,x=p.headerTitleTextColor,y=p.headerTitleTextSize,T=p.headerTitleTextFontFamily,b=p.headerComponent,v=p.startOpen,k=p.onOpenChange,C=p.children,E=n(v||!1),g=E[0],j=E[1],F=n(v?"initial":"0"),S=F[0],w=F[1],z=r(null),D=r(null),H=a(),I=e(e({},l),H),O=function(){var e=z.current;(null==D?void 0:D.current)&&clearTimeout(null==D?void 0:D.current);var t=!g;j(t),null!==e&&w("".concat(e.scrollHeight,"px")),!1===t?setTimeout((function(){return w("0")}),10):D.current=setTimeout((function(){return w("initial")}),1e3*s),void 0!==k&&k(t)};return o((function(){j(v||!1),w(v?"initial":"0")}),[v]),t.createElement("div",{id:h},b?t.createElement(c,{theme:I,"aria-controls":"".concat(h,"-header"),"aria-expanded":g,id:"".concat(h,"-header"),onClick:O,"aria-disabled":!1,"aria-label":f,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),O())},role:"button",tabIndex:0},b):t.createElement(d,{"aria-controls":"".concat(h,"-header"),"aria-expanded":g,id:"".concat(h,"-header"),onClick:O,theme:I,appearance:"tertiary",type:"button",textColor:x,textSize:y,textFontFamily:T},f,t.createElement(m,{faIcon:i,open:g})),t.createElement(u,{theme:I,id:"".concat(h,"-content"),ref:z,role:"region","aria-hidden":!g,"aria-labelledby":"".concat(h,"-header"),contentHeight:S,openStatus:g},C))}export{p as Collapse,p as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Collapse/index.tsx"],"sourcesContent":["import React, {\n useState,\n useRef,\n type KeyboardEvent,\n type ReactNode,\n useEffect,\n type HTMLAttributes,\n} from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { faChevronDown } from \"@fortawesome/free-solid-svg-icons\";\n\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\n\nimport { type FontSizeType, type ThemeType } from \"../../types\";\nimport {\n CustomHeader,\n DefaultHeader,\n FlippingIcon,\n CollapseContent,\n transitionDurationSeconds,\n} from \"./styles\";\n\nexport type CollapseProps = HTMLAttributes<HTMLElement> & {\n /** id is required for a11y reasons as we use aria attributes which depends on an id */\n id: string;\n /** text of collapse header, even if there is a custom header component this prop is still used for aria attributes */\n headerTitleText: string;\n /** collapse header text colour */\n headerTitleTextColor?: string;\n /** collapse header text size */\n headerTitleTextSize?: FontSizeType;\n /** collapse header font family */\n headerTitleTextFontFamily?: string;\n /** custom collapse header component */\n headerComponent?: ReactNode;\n /** flag to indicate */\n startOpen?: boolean;\n /** callback function that is passed isOpen flag */\n onOpenChange?: (isOpen: boolean) => void;\n /** children */\n children?: ReactNode;\n};\n\n/**\n *\n * Use a collapse component to show and hide content. It has a default view; however, it can be overwritten by passing a custom component as a prop.\n *\n */\nexport function Collapse({\n id,\n headerTitleText,\n headerTitleTextColor,\n headerTitleTextSize,\n headerTitleTextFontFamily,\n headerComponent,\n startOpen,\n onOpenChange,\n children,\n}: CollapseProps) {\n const [openStatus, setOpenStatus] = useState(startOpen || false);\n const [contentHeight, setContentHeight] = useState(\n startOpen ? \"initial\" : \"0\",\n );\n const content = useRef<HTMLDivElement>(null);\n const transitionTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const foundTheme = useTheme();\n const theme: ThemeType = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const toggleCollapse = () => {\n const { current } = content;\n if (transitionTimer?.current) clearTimeout(transitionTimer?.current);\n const newOpenState = !openStatus;\n setOpenStatus(newOpenState);\n\n if (current !== null) {\n setContentHeight(`${current.scrollHeight}px`);\n }\n\n if (newOpenState === false) {\n // Allow height to be rendered before setting to 0 for animation.\n setTimeout(() => setContentHeight(\"0\"), 10);\n } else {\n transitionTimer.current = setTimeout(\n () => setContentHeight(\"initial\"),\n transitionDurationSeconds * 1000,\n );\n }\n if (onOpenChange !== undefined) {\n onOpenChange(newOpenState);\n }\n };\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === \"Enter\" ||\n event.key === \" \" ||\n event.key === \"Spacebar\"\n ) {\n event.preventDefault();\n toggleCollapse();\n }\n };\n\n useEffect(() => {\n setOpenStatus(startOpen || false);\n // if start open changes then we want to set the height without animation\n startOpen ? setContentHeight(\"initial\") : setContentHeight(\"0\");\n }, [startOpen]);\n\n return (\n <div id={id}>\n {headerComponent ? (\n <CustomHeader\n theme={theme}\n aria-controls={`${id}-header`}\n aria-expanded={openStatus}\n id={`${id}-header`}\n onClick={toggleCollapse}\n aria-disabled={false}\n aria-label={headerTitleText}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n >\n {headerComponent}\n </CustomHeader>\n ) : (\n <DefaultHeader\n aria-controls={`${id}-header`}\n aria-expanded={openStatus}\n id={`${id}-header`}\n onClick={toggleCollapse}\n theme={theme}\n appearance=\"tertiary\"\n type=\"button\"\n textColor={headerTitleTextColor}\n textSize={headerTitleTextSize}\n textFontFamily={headerTitleTextFontFamily}\n >\n {headerTitleText}\n <FlippingIcon faIcon={faChevronDown} open={openStatus} />\n </DefaultHeader>\n )}\n <CollapseContent\n theme={theme}\n id={`${id}-content`}\n ref={content}\n role=\"region\"\n aria-hidden={!openStatus}\n aria-labelledby={`${id}-header`}\n contentHeight={contentHeight}\n openStatus={openStatus}\n >\n {children}\n </CollapseContent>\n </div>\n );\n}\n\nexport default Collapse;\n"],"names":["Collapse","_a","id","headerTitleText","headerTitleTextColor","headerTitleTextSize","headerTitleTextFontFamily","headerComponent","startOpen","onOpenChange","children","_b","useState","openStatus","setOpenStatus","_c","contentHeight","setContentHeight","content","useRef","transitionTimer","foundTheme","useTheme","theme","__assign","defaultTheme","toggleCollapse","current","clearTimeout","newOpenState","concat","scrollHeight","setTimeout","transitionDurationSeconds","undefined","useEffect","React","createElement","CustomHeader","onClick","onKeyDown","event","key","preventDefault","role","tabIndex","DefaultHeader","appearance","type","textColor","textSize","textFontFamily","FlippingIcon","faIcon","faChevronDown","open","CollapseContent","ref"],"mappings":"scAgDM,SAAUA,EAASC,OACvBC,EAAED,EAAAC,GACFC,EAAeF,EAAAE,gBACfC,EAAoBH,EAAAG,qBACpBC,EAAmBJ,EAAAI,oBACnBC,8BACAC,EAAeN,EAAAM,gBACfC,EAASP,EAAAO,UACTC,EAAYR,EAAAQ,aACZC,EAAQT,EAAAS,SAEFC,EAA8BC,EAASJ,IAAa,GAAnDK,EAAUF,EAAA,GAAEG,OACbC,EAAoCH,EACxCJ,EAAY,UAAY,KADnBQ,OAAeC,OAGhBC,EAAUC,EAAuB,MACjCC,EAAkBD,EAA6C,MAC/DE,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGCK,EAAiB,WACb,IAAAC,EAAYT,EAAOS,SACvBP,aAAA,EAAAA,EAAiBO,UAASC,aAAaR,eAAAA,EAAiBO,SAC5D,IAAME,GAAgBhB,EACtBC,EAAce,GAEE,OAAZF,GACFV,EAAiB,GAAGa,OAAAH,EAAQI,aAAY,QAGrB,IAAjBF,EAEFG,YAAW,WAAM,OAAAf,EAAiB,IAAI,GAAE,IAExCG,EAAgBO,QAAUK,YACxB,WAAM,OAAAf,EAAiB,UAAU,GACL,IAA5BgB,QAGiBC,IAAjBzB,GACFA,EAAaoB,EAEjB,EAmBA,OANAM,GAAU,WACRrB,EAAcN,IAAa,GAEfS,EAAZT,EAA6B,UAA8B,IAC7D,GAAG,CAACA,IAGF4B,EAAAC,cAAA,MAAA,CAAKnC,GAAIA,GACNK,EACC6B,EAACC,cAAAC,GACCf,MAAOA,EACQ,gBAAA,GAAAO,OAAG5B,EAAW,WAAA,gBACdW,EACfX,GAAI,GAAG4B,OAAA5B,aACPqC,QAASb,EAAc,iBACR,EACH,aAAAvB,EACZqC,UA5Bc,SAACC,GAEL,UAAdA,EAAMC,KACQ,MAAdD,EAAMC,KACQ,aAAdD,EAAMC,MAEND,EAAME,iBACNjB,IAEJ,EAoBQkB,KAAK,SACLC,SAAU,GAETtC,GAGH6B,EAAAC,cAACS,EACgB,CAAA,gBAAA,GAAAhB,OAAG5B,EAAW,WAAA,gBACdW,EACfX,GAAI,GAAG4B,OAAA5B,aACPqC,QAASb,EACTH,MAAOA,EACPwB,WAAW,WACXC,KAAK,SACLC,UAAW7C,EACX8C,SAAU7C,EACV8C,eAAgB7C,GAEfH,EACDiC,EAACC,cAAAe,EAAa,CAAAC,OAAQC,EAAeC,KAAM1C,KAG/CuB,EAAAC,cAACmB,EACC,CAAAjC,MAAOA,EACPrB,GAAI,GAAG4B,OAAA5B,cACPuD,IAAKvC,EACL0B,KAAK,SACQ,eAAC/B,EACG,kBAAA,GAAAiB,OAAG5B,EAAW,WAC/Bc,cAAeA,EACfH,WAAYA,GAEXH,GAIT"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o from"styled-components";import{Button as t}from"../Button/index.js";import{IconFa as i}from"../IconFa/index.js";var e,r,a,s,l=.5,f=o(i)(e||(e=n(["\n transform: ",";\n transition-duration: ","s;\n"],["\n transform: ",";\n transition-duration: ","s;\n"])),(function(n){return n.open?"translateY(0.1em) scaleY(-1)":"initial"}),.5),m=o(t)(r||(r=n(["\n display: flex;\n color: ",";\n font-size: ",";\n font-family: ",";\n font-weight: normal;\n margin-bottom: 0;\n height: initial;\n text-decoration: none;\n text-align: left;\n border-radius: 0;\n :hover,\n :focus {\n color: ",";\n }\n"],["\n display: flex;\n color: ",";\n font-size: ",";\n font-family: ",";\n font-weight: normal;\n margin-bottom: 0;\n height: initial;\n text-decoration: none;\n text-align: left;\n border-radius: 0;\n :hover,\n :focus {\n color: ",";\n }\n"])),(function(n){var o=n.theme,t=n.textColor;return t&&void 0!==o.colors[t]?o.colors[t]:t||o.colors.collapseHeaderColor}),(function(n){var o=n.theme,t=o.fontSizes,i=o.fontSizes.m,e=n.textSize;return e?t[e]:i}),(function(n){var o=n.theme;return n.textFontFamily||o.typography.fontFamilyBase}),(function(n){var o=n.theme.colors,t=n.textColor;return t&&void 0!==o[t]?o[t]:t||o.collapseHeaderColor})),c=o.div(a||(a=n(["\n margin: 0;\n transition: ","s ease;\n height: ",";\n visibility: ",";\n overflow: hidden;\n & > p {\n margin-top: 0;\n }\n"],["\n margin: 0;\n transition: ","s ease;\n height: ",";\n visibility: ",";\n overflow: hidden;\n & > p {\n margin-top: 0;\n }\n"])),.5,(function(n){return n.contentHeight}),(function(n){return n.openStatus?"visible":"hidden"})),d=o.div(s||(s=n(["\n cursor: pointer;\n"],["\n cursor: pointer;\n"])));export{c as CollapseContent,d as CustomHeader,m as DefaultHeader,f as FlippingIcon,l as transitionDurationSeconds};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Collapse/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport {\n type FontSizeType,\n type ThemeType,\n type ColorKeyType,\n} from \"../../types\";\nimport Button from \"../Button\";\nimport IconFa from \"../IconFa\";\n\ntype DefaultHeaderProps = {\n theme: ThemeType;\n textColor?: string;\n textSize?: FontSizeType;\n textFontFamily?: string;\n};\n\nexport const transitionDurationSeconds = 0.5;\n\nexport const FlippingIcon = styled(IconFa)<{ open: boolean }>`\n transform: ${({ open }) =>\n open ? \"translateY(0.1em) scaleY(-1)\" : \"initial\"};\n transition-duration: ${transitionDurationSeconds}s;\n`;\n\nexport const DefaultHeader = styled(Button)<{\n textColor?: string;\n textSize?: FontSizeType;\n textFontFamily?: string;\n theme: ThemeType;\n}>`\n display: flex;\n color: ${({ theme, textColor }) =>\n !!textColor &&\n typeof theme.colors[textColor as ColorKeyType] !== \"undefined\"\n ? theme.colors[textColor as ColorKeyType]\n : textColor || theme.colors.collapseHeaderColor};\n font-size: ${({\n theme: {\n fontSizes,\n fontSizes: { m },\n },\n textSize,\n }: DefaultHeaderProps) => (textSize ? fontSizes[textSize] : m)};\n font-family: ${({ theme, textFontFamily }: DefaultHeaderProps) =>\n textFontFamily || theme.typography.fontFamilyBase};\n font-weight: normal;\n margin-bottom: 0;\n height: initial;\n text-decoration: none;\n text-align: left;\n border-radius: 0;\n :hover,\n :focus {\n color: ${({ theme: { colors }, textColor }: DefaultHeaderProps) =>\n textColor && typeof colors[textColor as ColorKeyType] !== \"undefined\"\n ? colors[textColor as ColorKeyType]\n : textColor || colors.collapseHeaderColor};\n }\n`;\n\nexport const CollapseContent = styled.div<{\n contentHeight: string;\n openStatus: boolean;\n}>`\n margin: 0;\n transition: ${transitionDurationSeconds}s ease;\n height: ${({ contentHeight }: { contentHeight: string }) => contentHeight};\n visibility: ${({ openStatus }: { openStatus: boolean }) =>\n openStatus ? \"visible\" : \"hidden\"};\n overflow: hidden;\n & > p {\n margin-top: 0;\n }\n`;\n\nexport const CustomHeader = styled.div`\n cursor: pointer;\n`;\n"],"names":["transitionDurationSeconds","FlippingIcon","styled","IconFa","templateObject_1","__makeTemplateObject","_a","open","DefaultHeader","Button","templateObject_2","theme","textColor","colors","collapseHeaderColor","_b","fontSizes","m","textSize","textFontFamily","typography","fontFamilyBase","CollapseContent","div","templateObject_3","contentHeight","openStatus","CustomHeader","templateObject_4"],"mappings":"yMAiBO,YAAMA,EAA4B,GAE5BC,EAAeC,EAAOC,EAAPD,CAAiCE,IAAAA,EAAAC,EAAA,CAAA,kBAAA,6BAAA,QAAA,CAAA,kBAER,6BACH,WAFnC,SAACC,GACZ,OADkBA,EAAAC,KACX,+BAAiC,SAAxC,GAJqC,IAQ5BC,EAAgBN,EAAOO,EAAPP,CAK3BQ,IAAAA,EAAAL,EAAA,CAAA,gCAAA,mBAAA,qBAAA,6KAAA,YAAA,CAAA,gCAMmD,mBAOW,qBAEX,6KAYJ,eAzBtC,SAACC,OAAEK,EAAKL,EAAAK,MAAEC,EAASN,EAAAM,UAC1B,OAAEA,QACiD,IAA5CD,EAAME,OAAOD,GAChBD,EAAME,OAAOD,GACbA,GAAaD,EAAME,OAAOC,mBAH9B,IAIW,SAACR,OACZS,EAGCT,EAAAK,MAFCK,EAASD,EAAAC,UACIC,EAACF,EAAAC,UAAAC,EAEhBC,EAAQZ,EAAAY,SACgB,OAACA,EAAWF,EAAUE,GAAYD,CAAlC,IACX,SAACX,OAAEK,EAAKL,EAAAK,MACrB,OADqCL,EAAAa,gBACnBR,EAAMS,WAAWC,cAAnC,IASS,SAACf,OAAWO,EAAMP,EAAAK,MAAAE,OAAID,EAASN,EAAAM,UACtC,OAAAA,QAA0D,IAAtCC,EAAOD,GACvBC,EAAOD,GACPA,GAAaC,EAAOC,mBAFxB,IAMOQ,EAAkBpB,EAAOqB,IAGpCC,IAAAA,EAAAnB,EAAA,CAAA,iCAAA,sBAAA,oBAAA,gEAAA,CAAA,iCAEuC,sBACkC,oBAEtC,kEApDI,IAkD7B,SAACC,GAAiD,OAAlCA,EAAAmB,aAAkC,IAC9C,SAACnB,GACb,OADyBA,EAAAoB,WACZ,UAAY,QAAzB,IAOSC,EAAezB,EAAOqB,IAAGK,IAAAA,EAAAvB,EAAA,CAAA,0BAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ import e from"react";import{useTheme as t}from"styled-components";import{ErrorText as r}from"../ErrorText/index.js";import{Text as a}from"../Text/index.js";import{TextField as n}from"../TextField/index.js";import{Fieldset as o,DateTextFieldWrapper as l,LargeDateTextFieldWrapper as i,ErrorTextWrapper as m}from"./styles.js";function d(d){var u=d.label,s=d.hintText,p=d.day,y=d.month,h=d.year,c=d.dayName,x=void 0===c?"day":c,E=d.monthName,g=void 0===E?"month":E,b=d.yearName,f=void 0===b?"year":b,v=d.dayHasError,q=d.monthHasError,F=d.yearHasError,L=d.errorMessage,C=d.onChange,B=void 0===C?function(){}:C,M=d.onBlur,T=void 0===M?function(){}:M,j=d.onFocus,W=void 0===j?function(){}:j,H=d.disabled,I=d.required,N=t();return e.createElement(o,null,e.createElement(a,{as:"legend",textWeight:N.typography.fontWeightLabels||700,marginBottom:"xxs",textFontFamily:N.typography.fontFamilyLabel},u,!!I&&e.createElement("span",{style:{fontWeight:N.typography.fontWeightBase}}," (required)")),s&&e.createElement(a,null,s),e.createElement(l,null,e.createElement(n,{label:"Day",type:"text",name:x,required:!!I,hideRequiredInLabel:!0,maxLength:2,autoComplete:"bday-day",pattern:"[0-9]*",inputMode:"numeric",value:p,onChange:B,onBlur:T,onFocus:W,hasError:v,disabled:H})),e.createElement(l,null,e.createElement(n,{label:"Month",type:"text",name:g,required:!!I,hideRequiredInLabel:!0,maxLength:2,autoComplete:"bday-month",pattern:"[0-9]*",inputMode:"numeric",value:y,onChange:B,onBlur:T,onFocus:W,hasError:q,disabled:H})),e.createElement(i,null,e.createElement(n,{label:"Year",type:"text",name:f,required:!!I,hideRequiredInLabel:!0,maxLength:4,autoComplete:"bday-year",pattern:"[0-9]*",inputMode:"numeric",value:h,onChange:B,onBlur:T,onFocus:W,hasError:F,disabled:H})),L&&e.createElement(m,null,e.createElement(r,{marginTop:"xxs"},L)))}export{d as DateField,d as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/DateField/index.tsx"],"sourcesContent":["import React, { type InputHTMLAttributes } from \"react\";\n\nimport { useTheme } from \"styled-components\";\nimport { ErrorText } from \"../ErrorText\";\nimport { Text } from \"../Text\";\nimport { TextField } from \"../TextField\";\n\nimport {\n Fieldset,\n DateTextFieldWrapper,\n LargeDateTextFieldWrapper,\n ErrorTextWrapper,\n} from \"./styles\";\nimport { type ThemeType } from \"../../types\";\n\nexport type DateFieldProps = InputHTMLAttributes<HTMLInputElement> & {\n /** label text */\n label: string;\n /** hind text */\n hintText?: string;\n /** day field text value */\n day: string;\n /** month field text value */\n month: string;\n /** year field text value */\n year: string;\n /** name passed to day field input element */\n dayName?: string;\n /** name passed to month field input element */\n monthName?: string;\n /** name passed to year field input element */\n yearName?: string;\n /** flag of error styling on day field */\n dayHasError?: boolean;\n /** flag of error styling on month field */\n monthHasError?: boolean;\n /** flag of error styling on year field */\n yearHasError?: boolean;\n /** error message text */\n errorMessage?: string;\n};\n\n/**\n * To be used in forms entering dates like date of birth which are known dates and would take too long to get to with a date picker\n * */\nexport function DateField({\n label,\n hintText,\n day,\n month,\n year,\n dayName = \"day\",\n monthName = \"month\",\n yearName = \"year\",\n dayHasError,\n monthHasError,\n yearHasError,\n errorMessage,\n onChange = () => {\n // no op\n },\n onBlur = () => {\n // no op\n },\n onFocus = () => {\n // no op\n },\n disabled,\n required,\n}: DateFieldProps) {\n const theme = useTheme();\n const typedTheme = theme as ThemeType;\n return (\n <Fieldset>\n <Text\n as=\"legend\"\n textWeight={typedTheme.typography.fontWeightLabels || 700}\n marginBottom=\"xxs\"\n textFontFamily={typedTheme.typography.fontFamilyLabel}\n >\n {label}\n {!!required && (\n <span\n style={{\n fontWeight: typedTheme.typography.fontWeightBase,\n }}\n >\n {` (required)`}\n </span>\n )}\n </Text>\n {hintText && <Text>{hintText}</Text>}\n <DateTextFieldWrapper>\n <TextField\n label=\"Day\"\n type=\"text\"\n name={dayName}\n required={!!required}\n hideRequiredInLabel\n maxLength={2}\n autoComplete=\"bday-day\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={day}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={dayHasError}\n disabled={disabled}\n />\n </DateTextFieldWrapper>\n <DateTextFieldWrapper>\n <TextField\n label=\"Month\"\n type=\"text\"\n name={monthName}\n required={!!required}\n hideRequiredInLabel\n maxLength={2}\n autoComplete=\"bday-month\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={month}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={monthHasError}\n disabled={disabled}\n />\n </DateTextFieldWrapper>\n <LargeDateTextFieldWrapper>\n <TextField\n label=\"Year\"\n type=\"text\"\n name={yearName}\n required={!!required}\n hideRequiredInLabel\n maxLength={4}\n autoComplete=\"bday-year\"\n pattern=\"[0-9]*\"\n inputMode=\"numeric\"\n value={year}\n onChange={onChange}\n onBlur={onBlur}\n onFocus={onFocus}\n hasError={yearHasError}\n disabled={disabled}\n />\n </LargeDateTextFieldWrapper>\n {errorMessage && (\n <ErrorTextWrapper>\n <ErrorText marginTop=\"xxs\">{errorMessage}</ErrorText>\n </ErrorTextWrapper>\n )}\n </Fieldset>\n );\n}\n\nexport default DateField;\n"],"names":["DateField","_a","label","hintText","day","month","year","_b","dayName","_c","monthName","_d","yearName","dayHasError","monthHasError","yearHasError","errorMessage","_e","onChange","_f","onBlur","_g","onFocus","disabled","required","typedTheme","useTheme","React","Fieldset","createElement","Text","as","textWeight","typography","fontWeightLabels","marginBottom","textFontFamily","fontFamilyLabel","style","fontWeight","fontWeightBase","DateTextFieldWrapper","TextField","type","name","hideRequiredInLabel","maxLength","autoComplete","pattern","inputMode","value","hasError","LargeDateTextFieldWrapper","ErrorTextWrapper","ErrorText","marginTop"],"mappings":"oUA6CM,SAAUA,EAAUC,OACxBC,EAAKD,EAAAC,MACLC,EAAQF,EAAAE,SACRC,EAAGH,EAAAG,IACHC,EAAKJ,EAAAI,MACLC,EAAIL,EAAAK,KACJC,EAAeN,EAAAO,QAAfA,OAAO,IAAAD,EAAG,MAAKA,EACfE,EAAmBR,EAAAS,UAAnBA,OAAS,IAAAD,EAAG,QAAOA,EACnBE,aAAAC,aAAW,OAAMD,EACjBE,EAAWZ,EAAAY,YACXC,EAAab,EAAAa,cACbC,EAAYd,EAAAc,aACZC,iBACAC,EAAAhB,EAAAiB,SAAAA,OAAW,IAAAD,EAAA,WAEX,EAACA,EACDE,EAEClB,EAAAmB,OAFDA,OAAS,IAAAD,EAAA,WAET,EAACA,EACDE,EAECpB,EAAAqB,QAFDA,OAAU,IAAAD,EAAA,WAEV,IACAE,EAAQtB,EAAAsB,SACRC,EAAQvB,EAAAuB,SAGFC,EADQC,IAEd,OACEC,gBAACC,EAAQ,KACPD,EAACE,cAAAC,EACC,CAAAC,GAAG,SACHC,WAAYP,EAAWQ,WAAWC,kBAAoB,IACtDC,aAAa,MACbC,eAAgBX,EAAWQ,WAAWI,iBAErCnC,IACEsB,GACDG,EAAAE,cAAA,OAAA,CACES,MAAO,CACLC,WAAYd,EAAWQ,WAAWO,iBAGnC,gBAINrC,GAAYwB,EAAAE,cAACC,EAAI,KAAE3B,GACpBwB,EAAAE,cAACY,EAAoB,KACnBd,EAAAE,cAACa,EAAS,CACRxC,MAAM,MACNyC,KAAK,OACLC,KAAMpC,EACNgB,WAAYA,EACZqB,qBAAmB,EACnBC,UAAW,EACXC,aAAa,WACbC,QAAQ,SACRC,UAAU,UACVC,MAAO9C,EACPc,SAAUA,EACVE,OAAQA,EACRE,QAASA,EACT6B,SAAUtC,EACVU,SAAUA,KAGdI,EAAAE,cAACY,EAAoB,KACnBd,EAAAE,cAACa,EAAS,CACRxC,MAAM,QACNyC,KAAK,OACLC,KAAMlC,EACNc,WAAYA,EACZqB,qBAAmB,EACnBC,UAAW,EACXC,aAAa,aACbC,QAAQ,SACRC,UAAU,UACVC,MAAO7C,EACPa,SAAUA,EACVE,OAAQA,EACRE,QAASA,EACT6B,SAAUrC,EACVS,SAAUA,KAGdI,EAAAE,cAACuB,EAAyB,KACxBzB,EAAAE,cAACa,EAAS,CACRxC,MAAM,OACNyC,KAAK,OACLC,KAAMhC,EACNY,WAAYA,EACZqB,qBAAmB,EACnBC,UAAW,EACXC,aAAa,YACbC,QAAQ,SACRC,UAAU,UACVC,MAAO5C,EACPY,SAAUA,EACVE,OAAQA,EACRE,QAASA,EACT6B,SAAUpC,EACVQ,SAAUA,KAGbP,GACCW,EAAAE,cAACwB,EAAgB,KACf1B,EAAAE,cAACyB,EAAS,CAACC,UAAU,OAAOvC,IAKtC"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import i from"styled-components";import{Text as o}from"../Text/index.js";var r=i.fieldset(e||(e=n(["\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n"],["\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n"])));i(o)(t||(t=n(["\n font-family: ",";\n"],["\n font-family: ",";\n"])),(function(n){return n.theme.typography.fontFamilyLabel}));var e,t,a,s,b,m=i.div(a||(a=n(["\n display: inline-block;\n width: 60px;\n margin-right: ",";\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ",";\n }\n"],["\n display: inline-block;\n width: 60px;\n margin-right: ",";\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ",";\n }\n"])),(function(n){return n.theme.spacing.xs}),(function(n){return n.theme.typography.fontWeightBase})),d=i(m)(s||(s=n(["\n width: 80px;\n"],["\n width: 80px;\n"]))),g=i.div(b||(b=n(["\n clear: left;\n"],["\n clear: left;\n"])));export{m as DateTextFieldWrapper,g as ErrorTextWrapper,r as Fieldset,d as LargeDateTextFieldWrapper};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/DateField/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { type ThemeType } from \"../../types\";\nimport Text from \"../Text\";\n\ntype ThemeProps = {\n theme: ThemeType;\n};\nexport const Fieldset = styled.fieldset`\n margin: 0;\n padding: 0;\n border: 0;\n *,\n *:after,\n *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n`;\n\nexport const TextAsLabel = styled(Text)<ThemeProps>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n`;\n\nexport const DateTextFieldWrapper = styled.div<ThemeProps>`\n display: inline-block;\n width: 60px;\n margin-right: ${({ theme }) => theme.spacing.xs};\n span {\n margin-bottom: 0.25rem; // this is smaller than xxs spacing\n font-weight: ${({ theme }) => theme.typography.fontWeightBase};\n }\n`;\n\nexport const LargeDateTextFieldWrapper = styled(DateTextFieldWrapper)`\n width: 80px;\n`;\n\nexport const ErrorTextWrapper = styled.div`\n clear: left;\n`;\n"],"names":["Fieldset","styled","fieldset","templateObject_1","__makeTemplateObject","Text","templateObject_2","_a","theme","typography","fontFamilyLabel","DateTextFieldWrapper","div","templateObject_3","spacing","xs","fontWeightBase","LargeDateTextFieldWrapper","templateObject_4","ErrorTextWrapper","templateObject_5"],"mappings":"yJAOa,IAAAA,EAAWC,EAAOC,SAAQC,IAAAA,EAAAC,EAAA,CAAA,0LAAA,CAAA,6LAaZH,EAAOI,EAAPJ,CAAYK,IAAAA,EAAAF,EAAA,CAAA,oBAAA,OAAA,CAAY,oBACa,UAA/C,SAACG,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,IAGzB,cAAMC,EAAuBV,EAAOW,IAAeC,IAAAA,EAAAT,EAAA,CAAA,+DAAA,kGAAA,YAAA,CAAA,+DAGT,kGAGgB,eAH/C,SAACG,GAAc,OAAPA,EAAAC,MAAaM,QAAQC,EAAd,IAGd,SAACR,GAAc,OAAPA,EAAAC,MAAaC,WAAWO,cAAjB,IAIrBC,EAA4BhB,EAAOU,EAAPV,CAA4BiB,IAAAA,EAAAd,EAAA,CAAA,sBAAA,CAAA,yBAIxDe,EAAmBlB,EAAOW,IAAGQ,IAAAA,EAAAhB,EAAA,CAAA,sBAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as n}from"../../node_modules/tslib/tslib.es6.js";import e from"react";import t from"styled-components";var i,o=t.div(i||(i=n(['\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n :before,\n :after {\n background-color: #333;\n content: "";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n'],['\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n :before,\n :after {\n background-color: #333;\n content: "";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n']))),l=function(n){var t=n.children;return e.createElement(o,null,t)};export{l as Divider,l as default};
2
+ //# sourceMappingURL=Divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Divider.js","sources":["../../../src/components/Divider.tsx"],"sourcesContent":["import React, { type ReactNode } from \"react\";\nimport styled from \"styled-components\";\n\nconst StyledDivider = styled.div`\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n :before,\n :after {\n background-color: #333;\n content: \"\";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n`;\n\ntype DividerProps = {\n children?: ReactNode;\n};\n\nexport const Divider = ({ children }: DividerProps) => (\n <StyledDivider>{children}</StyledDivider>\n);\n\nexport default Divider;\n"],"names":["StyledDivider","styled","div","templateObject_1","__makeTemplateObject","Divider","_a","children","React","createElement"],"mappings":"mIAGA,MAAMA,EAAgBC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,wSAAA,CAAA,2SAsBnBC,EAAU,SAACC,GAAE,IAAAC,EAAQD,EAAAC,SAAqB,OACrDC,EAACC,cAAAT,EAAe,KAAAO,EADqC"}
@@ -0,0 +1,2 @@
1
+ import{__rest as e,__assign as o}from"../../../node_modules/tslib/tslib.es6.js";import r from"react";import{useTheme as t}from"styled-components";import{faTriangleExclamation as s}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as m}from"../../themes/cruk.js";import{StyledErrorText as n}from"./styles.js";import{IconFa as i}from"../IconFa/index.js";import{Box as a}from"../Box/index.js";function l(l){var d=l.children,f=l.as,p=void 0===f?"span":f,c=e(l,["children","as"]),u=t(),x=o(o({},m),u),h="string"==typeof d&&d.length;return r.createElement(n,o({forwardedAs:p},c,{theme:x,role:"alert"}),h?r.createElement(a,{as:"span",marginRight:"xxs"},r.createElement(i,{faIcon:s,size:"1em"})):null,d)}export{l as ErrorText,l as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/ErrorText/index.tsx"],"sourcesContent":["import React, { type HTMLAttributes } from \"react\";\nimport { useTheme } from \"styled-components\";\n\nimport { faTriangleExclamation } from \"@fortawesome/free-solid-svg-icons\";\nimport { crukTheme as defaultTheme } from \"../../themes/cruk\";\nimport { type SpacingProps } from \"../Spacing\";\nimport { StyledErrorText } from \"./styles\";\nimport { IconFa } from \"../IconFa\";\nimport { Box } from \"../Box\";\n\nexport type ErrorTextProps = SpacingProps &\n HTMLAttributes<HTMLElement> & {\n as?: React.ElementType;\n };\n\n/**\n *\n * To be used in forms for inline validation. Applies styling and accessibility attribute so that it will be read by screen readers.\n *\n * Please be aware that some input components already have this component built in and can be passed an \"errorMessage\" prop\n */\nexport function ErrorText({ children, as = \"span\", ...props }: ErrorTextProps) {\n const foundTheme = useTheme();\n const theme = {\n ...defaultTheme,\n ...foundTheme,\n };\n\n const shouldShowIcon = typeof children === \"string\" && children.length;\n return (\n <StyledErrorText forwardedAs={as} {...props} theme={theme} role=\"alert\">\n {shouldShowIcon ? (\n <Box as=\"span\" marginRight=\"xxs\">\n <IconFa faIcon={faTriangleExclamation} size=\"1em\" />\n </Box>\n ) : null}\n {children}\n </StyledErrorText>\n );\n}\n\nexport default ErrorText;\n"],"names":["ErrorText","_a","children","_b","as","props","__rest","foundTheme","useTheme","theme","__assign","defaultTheme","shouldShowIcon","length","React","createElement","StyledErrorText","forwardedAs","role","Box","marginRight","IconFa","faIcon","faTriangleExclamation","size"],"mappings":"4aAqBM,SAAUA,EAAUC,GAAE,IAAAC,EAAQD,EAAAC,SAAEC,EAAAF,EAAAG,GAAAA,OAAK,IAAAD,EAAA,OAAMA,EAAKE,EAAKC,EAAAL,EAAjC,mBAClBM,EAAaC,IACbC,EACDC,EAAAA,EAAA,CAAA,EAAAC,GACAJ,GAGCK,EAAqC,iBAAbV,GAAyBA,EAASW,OAChE,OACEC,EAACC,cAAAC,EAAgBN,EAAA,CAAAO,YAAab,GAAQC,EAAK,CAAEI,MAAOA,EAAOS,KAAK,UAC7DN,EACCE,EAACC,cAAAI,EAAI,CAAAf,GAAG,OAAOgB,YAAY,OACzBN,EAAAC,cAACM,EAAM,CAACC,OAAQC,EAAuBC,KAAK,SAE5C,KACHtB,EAGP"}
@@ -0,0 +1,2 @@
1
+ import{__makeTemplateObject as o}from"../../../node_modules/tslib/tslib.es6.js";import n from"styled-components";import{Text as t}from"../Text/index.js";var e,r=n(t)(e||(e=o(["\n display: inline-block;\n color: ",";\n font-weight: ",";\n"],["\n display: inline-block;\n color: ",";\n font-weight: ",";\n"])),(function(o){return o.theme.colors.textError}),(function(o){return o.theme.typography.fontWeightHeavy}));export{r as StyledErrorText,r as default};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/ErrorText/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport Text from \"../Text\";\nimport { type ThemeType } from \"../../types\";\n\ntype ThemeProps = {\n theme: ThemeType;\n};\nexport const StyledErrorText = styled(Text)<ThemeProps>`\n display: inline-block;\n color: ${({ theme }) => theme.colors.textError};\n font-weight: ${({ theme }) => theme.typography.fontWeightHeavy};\n`;\n\nexport default StyledErrorText;\n"],"names":["StyledErrorText","styled","Text","templateObject_1","__makeTemplateObject","_a","theme","colors","textError","typography","fontWeightHeavy"],"mappings":"yJAOa,MAAAA,EAAkBC,EAAOC,EAAPD,CAAwBE,IAAAA,EAAAC,EAAA,CAAA,wCAAA,qBAAA,OAAA,CAAA,wCAEP,qBACgB,UADrD,SAACC,GAAc,OAAPA,EAAAC,MAAaC,OAAOC,SAAb,IACT,SAACH,GAAc,OAAPA,EAAAC,MAAaG,WAAWC,eAAjB"}