@cruk/cruk-react-components 5.0.6 → 5.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/lib/.storybook/main.d.ts +3 -0
  2. package/lib/.storybook/preview.d.ts +3 -0
  3. package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  4. package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +1 -1
  5. package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +1 -1
  6. package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +1 -1
  7. package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js +6 -1
  8. package/lib/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +1 -1
  9. package/lib/node_modules/focus-lock/dist/es2015/focusInside.js.map +1 -1
  10. package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +1 -1
  11. package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js +1 -1
  12. package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +1 -1
  13. package/lib/node_modules/focus-lock/dist/es2015/return-focus.js.map +1 -1
  14. package/lib/node_modules/focus-lock/dist/es2015/sibling.js +1 -1
  15. package/lib/node_modules/focus-lock/dist/es2015/sibling.js.map +1 -1
  16. package/lib/node_modules/focus-lock/dist/es2015/solver.js +1 -1
  17. package/lib/node_modules/focus-lock/dist/es2015/solver.js.map +1 -1
  18. package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +1 -1
  19. package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js +1 -1
  20. package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +1 -1
  21. package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +1 -1
  22. package/lib/node_modules/focus-lock/dist/es2015/utils/is.js.map +1 -1
  23. package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +1 -1
  24. package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +1 -1
  25. package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +1 -1
  26. package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js +1 -1
  27. package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js.map +1 -1
  28. package/lib/node_modules/react-focus-lock/dist/es2015/FocusGuard.js.map +1 -1
  29. package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js +1 -1
  30. package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -1
  31. package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js +1 -1
  32. package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -1
  33. package/lib/node_modules/react-intersection-observer/dist/index.js.map +1 -1
  34. package/lib/node_modules/tslib/tslib.es6.js +1 -1
  35. package/lib/node_modules/tslib/tslib.es6.js.map +1 -1
  36. package/lib/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -1
  37. package/lib/{components → src/components}/AddressLookup/AddressLookup.stories.d.ts +4 -4
  38. package/lib/{components → src/components}/AddressLookup/index.d.ts +1 -1
  39. package/lib/src/components/AddressLookup/index.js +1 -1
  40. package/lib/src/components/AddressLookup/index.js.map +1 -1
  41. package/lib/src/components/AddressLookup/styles.js +38 -1
  42. package/lib/src/components/AddressLookup/styles.js.map +1 -1
  43. package/lib/{components → src/components}/Avatar/Avatar.stories.d.ts +1 -1
  44. package/lib/src/components/Avatar/index.js +1 -1
  45. package/lib/src/components/Avatar/index.js.map +1 -1
  46. package/lib/src/components/Avatar/styles.js +10 -1
  47. package/lib/src/components/Avatar/styles.js.map +1 -1
  48. package/lib/{components → src/components}/Badge/Badge.stories.d.ts +1 -1
  49. package/lib/{components → src/components}/Badge/index.d.ts +3 -1
  50. package/lib/src/components/Badge/index.js +1 -1
  51. package/lib/src/components/Badge/index.js.map +1 -1
  52. package/lib/{components → src/components}/Badge/styles.d.ts +1 -1
  53. package/lib/src/components/Badge/styles.js +17 -1
  54. package/lib/src/components/Badge/styles.js.map +1 -1
  55. package/lib/{components → src/components}/Box/Box.stories.d.ts +1 -1
  56. package/lib/src/components/Box/index.js +1 -1
  57. package/lib/src/components/Box/index.js.map +1 -1
  58. package/lib/src/components/Box/styles.js +13 -1
  59. package/lib/src/components/Box/styles.js.map +1 -1
  60. package/lib/{components → src/components}/Button/Button.stories.d.ts +1 -1
  61. package/lib/src/components/Button/index.js +1 -1
  62. package/lib/src/components/Button/index.js.map +1 -1
  63. package/lib/src/components/Button/styles.js +108 -1
  64. package/lib/src/components/Button/styles.js.map +1 -1
  65. package/lib/{components → src/components}/Carousel/Carousel.stories.d.ts +2 -2
  66. package/lib/src/components/Carousel/Dots.js +1 -1
  67. package/lib/src/components/Carousel/Dots.js.map +1 -1
  68. package/lib/src/components/Carousel/index.js +1 -1
  69. package/lib/src/components/Carousel/index.js.map +1 -1
  70. package/lib/src/components/Carousel/styles.js +96 -1
  71. package/lib/src/components/Carousel/styles.js.map +1 -1
  72. package/lib/{components → src/components}/Checkbox/Checkbox.stories.d.ts +2 -2
  73. package/lib/src/components/Checkbox/index.js +1 -1
  74. package/lib/src/components/Checkbox/index.js.map +1 -1
  75. package/lib/src/components/Checkbox/styles.js +105 -1
  76. package/lib/src/components/Checkbox/styles.js.map +1 -1
  77. package/lib/{components → src/components}/Collapse/Collapse.stories.d.ts +1 -1
  78. package/lib/src/components/Collapse/index.js +1 -1
  79. package/lib/src/components/Collapse/index.js.map +1 -1
  80. package/lib/src/components/Collapse/styles.js +31 -1
  81. package/lib/src/components/Collapse/styles.js.map +1 -1
  82. package/lib/{components → src/components}/DateField/DateField.stories.d.ts +1 -1
  83. package/lib/src/components/DateField/index.js +1 -1
  84. package/lib/src/components/DateField/index.js.map +1 -1
  85. package/lib/src/components/DateField/styles.js +26 -1
  86. package/lib/src/components/DateField/styles.js.map +1 -1
  87. package/lib/src/components/Divider.js +17 -1
  88. package/lib/src/components/Divider.js.map +1 -1
  89. package/lib/{components → src/components}/ErrorText/ErrorText.stories.d.ts +1 -1
  90. package/lib/src/components/ErrorText/index.js +1 -1
  91. package/lib/src/components/ErrorText/index.js.map +1 -1
  92. package/lib/src/components/ErrorText/styles.js +5 -1
  93. package/lib/src/components/ErrorText/styles.js.map +1 -1
  94. package/lib/src/components/Flex.js +7 -1
  95. package/lib/src/components/Flex.js.map +1 -1
  96. package/lib/src/components/Fontface.js +1 -1
  97. package/lib/src/components/Fontface.js.map +1 -1
  98. package/lib/{components → src/components}/Footer/Footer.stories.d.ts +2 -2
  99. package/lib/src/components/Footer/index.js +1 -1
  100. package/lib/src/components/Footer/index.js.map +1 -1
  101. package/lib/src/components/Footer/styles.js +69 -1
  102. package/lib/src/components/Footer/styles.js.map +1 -1
  103. package/lib/src/components/GlobalStyle.js +37 -1
  104. package/lib/src/components/GlobalStyle.js.map +1 -1
  105. package/lib/src/components/GlobalStyleNoFontFace.js +37 -1
  106. package/lib/src/components/GlobalStyleNoFontFace.js.map +1 -1
  107. package/lib/{components → src/components}/Header/Header.stories.d.ts +1 -1
  108. package/lib/src/components/Header/index.js +1 -1
  109. package/lib/src/components/Header/index.js.map +1 -1
  110. package/lib/src/components/Header/styles.js +109 -1
  111. package/lib/src/components/Header/styles.js.map +1 -1
  112. package/lib/{components → src/components}/Heading/Heading.stories.d.ts +1 -1
  113. package/lib/src/components/Heading/index.js +1 -1
  114. package/lib/src/components/Heading/index.js.map +1 -1
  115. package/lib/src/components/Heading/styles.js +75 -1
  116. package/lib/src/components/Heading/styles.js.map +1 -1
  117. package/lib/{components → src/components}/IconFa/IconFa.stories.d.ts +1 -1
  118. package/lib/src/components/IconFa/index.js +1 -1
  119. package/lib/src/components/IconFa/index.js.map +1 -1
  120. package/lib/src/components/IconFa/styles.js +10 -1
  121. package/lib/src/components/IconFa/styles.js.map +1 -1
  122. package/lib/{components → src/components}/InfoBox/InfoBox.stories.d.ts +1 -1
  123. package/lib/src/components/InfoBox/index.js +1 -1
  124. package/lib/src/components/InfoBox/index.js.map +1 -1
  125. package/lib/src/components/InfoBox/styles.js +12 -1
  126. package/lib/src/components/InfoBox/styles.js.map +1 -1
  127. package/lib/src/components/LabelWrapper/index.js +1 -1
  128. package/lib/src/components/LabelWrapper/index.js.map +1 -1
  129. package/lib/src/components/LabelWrapper/styles.js +15 -1
  130. package/lib/src/components/LabelWrapper/styles.js.map +1 -1
  131. package/lib/{components → src/components}/LegendWrapper/LegendWrapper.stories.d.ts +1 -1
  132. package/lib/src/components/LegendWrapper/index.js +1 -1
  133. package/lib/src/components/LegendWrapper/index.js.map +1 -1
  134. package/lib/src/components/LegendWrapper/styles.js +34 -1
  135. package/lib/src/components/LegendWrapper/styles.js.map +1 -1
  136. package/lib/{components → src/components}/Link/Link.stories.d.ts +1 -1
  137. package/lib/src/components/Link/index.js +1 -1
  138. package/lib/src/components/Link/index.js.map +1 -1
  139. package/lib/src/components/Link/styles.js +29 -1
  140. package/lib/src/components/Link/styles.js.map +1 -1
  141. package/lib/{components → src/components}/Loader/Loader.stories.d.ts +1 -1
  142. package/lib/src/components/Loader/index.js +1 -1
  143. package/lib/src/components/Loader/index.js.map +1 -1
  144. package/lib/src/components/Loader/styles.js +45 -1
  145. package/lib/src/components/Loader/styles.js.map +1 -1
  146. package/lib/{components → src/components}/Modal/Modal.stories.d.ts +1 -1
  147. package/lib/src/components/Modal/index.js +1 -1
  148. package/lib/src/components/Modal/index.js.map +1 -1
  149. package/lib/src/components/Modal/styles.js +59 -1
  150. package/lib/src/components/Modal/styles.js.map +1 -1
  151. package/lib/{components → src/components}/Pagination/Pagination.stories.d.ts +1 -1
  152. package/lib/src/components/Pagination/index.js +1 -1
  153. package/lib/src/components/Pagination/index.js.map +1 -1
  154. package/lib/src/components/Pagination/styles.js +92 -1
  155. package/lib/src/components/Pagination/styles.js.map +1 -1
  156. package/lib/{components → src/components}/PopOver/Popover.stories.d.ts +1 -1
  157. package/lib/src/components/PopOver/index.js +1 -1
  158. package/lib/src/components/PopOver/index.js.map +1 -1
  159. package/lib/src/components/PopOver/styles.js +81 -1
  160. package/lib/src/components/PopOver/styles.js.map +1 -1
  161. package/lib/{components → src/components}/ProgressBar/ProgressBar.stories.d.ts +1 -1
  162. package/lib/src/components/ProgressBar/index.js +1 -1
  163. package/lib/src/components/ProgressBar/index.js.map +1 -1
  164. package/lib/src/components/ProgressBar/styles.js +132 -1
  165. package/lib/src/components/ProgressBar/styles.js.map +1 -1
  166. package/lib/{components → src/components}/Radio/Radio.stories.d.ts +2 -2
  167. package/lib/src/components/Radio/index.js +1 -1
  168. package/lib/src/components/Radio/index.js.map +1 -1
  169. package/lib/src/components/Radio/styles.js +125 -1
  170. package/lib/src/components/Radio/styles.js.map +1 -1
  171. package/lib/{components → src/components}/RadioConsent/Radio.stories.d.ts +1 -1
  172. package/lib/src/components/RadioConsent/index.js +1 -1
  173. package/lib/src/components/RadioConsent/index.js.map +1 -1
  174. package/lib/src/components/RadioConsent/styles.js +26 -1
  175. package/lib/src/components/RadioConsent/styles.js.map +1 -1
  176. package/lib/{components → src/components}/Select/Selelct.stories.d.ts +2 -2
  177. package/lib/src/components/Select/index.js +1 -1
  178. package/lib/src/components/Select/index.js.map +1 -1
  179. package/lib/src/components/Select/styles.js +41 -1
  180. package/lib/src/components/Select/styles.js.map +1 -1
  181. package/lib/src/components/Spacing/index.js +1 -1
  182. package/lib/src/components/Spacing/index.js.map +1 -1
  183. package/lib/{components → src/components}/Step/Step.stories.d.ts +1 -1
  184. package/lib/src/components/Step/index.js +1 -1
  185. package/lib/src/components/Step/index.js.map +1 -1
  186. package/lib/src/components/Step/styles.js +79 -1
  187. package/lib/src/components/Step/styles.js.map +1 -1
  188. package/lib/{components → src/components}/Text/Text.stories.d.ts +1 -1
  189. package/lib/src/components/Text/index.js +1 -1
  190. package/lib/src/components/Text/index.js.map +1 -1
  191. package/lib/src/components/Text/styles.js +19 -1
  192. package/lib/src/components/Text/styles.js.map +1 -1
  193. package/lib/{components → src/components}/TextAreaField/TextAreaField.stories.d.ts +1 -1
  194. package/lib/src/components/TextAreaField/index.js +1 -1
  195. package/lib/src/components/TextAreaField/index.js.map +1 -1
  196. package/lib/src/components/TextAreaField/styles.js +29 -1
  197. package/lib/src/components/TextAreaField/styles.js.map +1 -1
  198. package/lib/{components → src/components}/TextField/TextField.stories.d.ts +1 -1
  199. package/lib/src/components/TextField/index.js +1 -1
  200. package/lib/src/components/TextField/index.js.map +1 -1
  201. package/lib/src/components/TextField/styles.js +110 -1
  202. package/lib/src/components/TextField/styles.js.map +1 -1
  203. package/lib/{components → src/components}/Totaliser/Totaliser.stories.d.ts +1 -1
  204. package/lib/src/components/Totaliser/index.js +1 -1
  205. package/lib/src/components/Totaliser/index.js.map +1 -1
  206. package/lib/src/components/Totaliser/styles.js +59 -1
  207. package/lib/src/components/Totaliser/styles.js.map +1 -1
  208. package/lib/{components → src/components}/UserBlock/UserBlock.stories.d.ts +1 -1
  209. package/lib/src/components/UserBlock/index.js +1 -1
  210. package/lib/src/components/UserBlock/index.js.map +1 -1
  211. package/lib/src/components/UserBlock/styles.js +21 -1
  212. package/lib/src/components/UserBlock/styles.js.map +1 -1
  213. package/lib/{hooks → src/hooks}/useEffectBrowser.d.ts +1 -1
  214. package/lib/src/hooks/useEffectBrowser.js +1 -1
  215. package/lib/src/hooks/useEffectBrowser.js.map +1 -1
  216. package/lib/src/hooks/useKey.js +1 -1
  217. package/lib/src/hooks/useKey.js.map +1 -1
  218. package/lib/{hooks → src/hooks}/useLayoutEffectBrowser.d.ts +1 -1
  219. package/lib/src/hooks/useLayoutEffectBrowser.js +1 -1
  220. package/lib/src/hooks/useLayoutEffectBrowser.js.map +1 -1
  221. package/lib/src/hooks/useScrollPosition.js +1 -1
  222. package/lib/src/hooks/useScrollPosition.js.map +1 -1
  223. package/lib/src/themes/bowelbabe.js +1 -1
  224. package/lib/src/themes/bowelbabe.js.map +1 -1
  225. package/lib/src/themes/cruk.js +1 -1
  226. package/lib/src/themes/cruk.js.map +1 -1
  227. package/lib/src/themes/rfl.js +1 -1
  228. package/lib/src/themes/rfl.js.map +1 -1
  229. package/lib/src/themes/su2c.js +1 -1
  230. package/lib/src/themes/su2c.js.map +1 -1
  231. package/lib/{types.d.ts → src/types.d.ts} +1 -3
  232. package/lib/src/utils/Helper.js +1 -1
  233. package/lib/src/utils/Helper.js.map +1 -1
  234. package/lib/src/utils/debounce.d.ts +2 -0
  235. package/lib/src/utils/debounce.js +1 -1
  236. package/lib/src/utils/debounce.js.map +1 -1
  237. package/lib/src/utils/themeUtils.js +1 -1
  238. package/lib/src/utils/themeUtils.js.map +1 -1
  239. package/package.json +23 -29
  240. package/lib/utils/debounce.d.ts +0 -2
  241. /package/lib/{components → src/components}/AddressLookup/AddressLookUp.test.cypress.d.ts +0 -0
  242. /package/lib/{components → src/components}/AddressLookup/styles.d.ts +0 -0
  243. /package/lib/{components → src/components}/AllThemesWrapper.d.ts +0 -0
  244. /package/lib/{components → src/components}/Avatar/Avatar.test.cypress.d.ts +0 -0
  245. /package/lib/{components → src/components}/Avatar/index.d.ts +0 -0
  246. /package/lib/{components → src/components}/Avatar/styles.d.ts +0 -0
  247. /package/lib/{components → src/components}/Badge/Badge.test.cypress.d.ts +0 -0
  248. /package/lib/{components → src/components}/Box/Box.test.cypress.d.ts +0 -0
  249. /package/lib/{components → src/components}/Box/index.d.ts +0 -0
  250. /package/lib/{components → src/components}/Box/styles.d.ts +0 -0
  251. /package/lib/{components → src/components}/Button/Button.test.cypress.d.ts +0 -0
  252. /package/lib/{components → src/components}/Button/index.d.ts +0 -0
  253. /package/lib/{components → src/components}/Button/styles.d.ts +0 -0
  254. /package/lib/{components → src/components}/Carousel/Carousel.test.cypress.d.ts +0 -0
  255. /package/lib/{components → src/components}/Carousel/Dots.d.ts +0 -0
  256. /package/lib/{components → src/components}/Carousel/index.d.ts +0 -0
  257. /package/lib/{components → src/components}/Carousel/styles.d.ts +0 -0
  258. /package/lib/{components → src/components}/Checkbox/CheckBox.test.cypress.d.ts +0 -0
  259. /package/lib/{components → src/components}/Checkbox/index.d.ts +0 -0
  260. /package/lib/{components → src/components}/Checkbox/styles.d.ts +0 -0
  261. /package/lib/{components → src/components}/Collapse/Collapse.test.cypress.d.ts +0 -0
  262. /package/lib/{components → src/components}/Collapse/index.d.ts +0 -0
  263. /package/lib/{components → src/components}/Collapse/styles.d.ts +0 -0
  264. /package/lib/{components → src/components}/DateField/DateField.test.cypress.d.ts +0 -0
  265. /package/lib/{components → src/components}/DateField/index.d.ts +0 -0
  266. /package/lib/{components → src/components}/DateField/styles.d.ts +0 -0
  267. /package/lib/{components → src/components}/Divider.d.ts +0 -0
  268. /package/lib/{components → src/components}/ErrorText/ErrorText.test.cypress.d.ts +0 -0
  269. /package/lib/{components → src/components}/ErrorText/index.d.ts +0 -0
  270. /package/lib/{components → src/components}/ErrorText/styles.d.ts +0 -0
  271. /package/lib/{components → src/components}/Flex.d.ts +0 -0
  272. /package/lib/{components → src/components}/Fontface.d.ts +0 -0
  273. /package/lib/{components → src/components}/Footer/Footer.test.cypress.d.ts +0 -0
  274. /package/lib/{components → src/components}/Footer/index.d.ts +0 -0
  275. /package/lib/{components → src/components}/Footer/styles.d.ts +0 -0
  276. /package/lib/{components → src/components}/GlobalStyle.d.ts +0 -0
  277. /package/lib/{components → src/components}/GlobalStyleNoFontFace.d.ts +0 -0
  278. /package/lib/{components → src/components}/Header/Header.test.cypress.d.ts +0 -0
  279. /package/lib/{components → src/components}/Header/index.d.ts +0 -0
  280. /package/lib/{components → src/components}/Header/styles.d.ts +0 -0
  281. /package/lib/{components → src/components}/Heading/Heading.test.cypress.d.ts +0 -0
  282. /package/lib/{components → src/components}/Heading/index.d.ts +0 -0
  283. /package/lib/{components → src/components}/Heading/styles.d.ts +0 -0
  284. /package/lib/{components → src/components}/IconFa/IconFa.test.cypress.d.ts +0 -0
  285. /package/lib/{components → src/components}/IconFa/index.d.ts +0 -0
  286. /package/lib/{components → src/components}/IconFa/styles.d.ts +0 -0
  287. /package/lib/{components → src/components}/InfoBox/InfoBox.test.cypress.d.ts +0 -0
  288. /package/lib/{components → src/components}/InfoBox/index.d.ts +0 -0
  289. /package/lib/{components → src/components}/InfoBox/styles.d.ts +0 -0
  290. /package/lib/{components → src/components}/LabelWrapper/index.d.ts +0 -0
  291. /package/lib/{components → src/components}/LabelWrapper/styles.d.ts +0 -0
  292. /package/lib/{components → src/components}/LegendWrapper/LegendWrapper.test.cypress.d.ts +0 -0
  293. /package/lib/{components → src/components}/LegendWrapper/index.d.ts +0 -0
  294. /package/lib/{components → src/components}/LegendWrapper/styles.d.ts +0 -0
  295. /package/lib/{components → src/components}/Link/Link.test.cypress.d.ts +0 -0
  296. /package/lib/{components → src/components}/Link/index.d.ts +0 -0
  297. /package/lib/{components → src/components}/Link/styles.d.ts +0 -0
  298. /package/lib/{components → src/components}/Loader/Loader.test.cypress.d.ts +0 -0
  299. /package/lib/{components → src/components}/Loader/index.d.ts +0 -0
  300. /package/lib/{components → src/components}/Loader/styles.d.ts +0 -0
  301. /package/lib/{components → src/components}/Modal/Modal.test.cypress.d.ts +0 -0
  302. /package/lib/{components → src/components}/Modal/index.d.ts +0 -0
  303. /package/lib/{components → src/components}/Modal/styles.d.ts +0 -0
  304. /package/lib/{components → src/components}/Pagination/Pagination.test.cypress.d.ts +0 -0
  305. /package/lib/{components → src/components}/Pagination/index.d.ts +0 -0
  306. /package/lib/{components → src/components}/Pagination/styles.d.ts +0 -0
  307. /package/lib/{components → src/components}/PopOver/PopOver.test.cypress.d.ts +0 -0
  308. /package/lib/{components → src/components}/PopOver/index.d.ts +0 -0
  309. /package/lib/{components → src/components}/PopOver/styles.d.ts +0 -0
  310. /package/lib/{components → src/components}/ProgressBar/ProgressBar.test.cypress.d.ts +0 -0
  311. /package/lib/{components → src/components}/ProgressBar/index.d.ts +0 -0
  312. /package/lib/{components → src/components}/ProgressBar/styles.d.ts +0 -0
  313. /package/lib/{components → src/components}/Radio/Radio.test.cypress.d.ts +0 -0
  314. /package/lib/{components → src/components}/Radio/index.d.ts +0 -0
  315. /package/lib/{components → src/components}/Radio/styles.d.ts +0 -0
  316. /package/lib/{components → src/components}/RadioConsent/RadioConsent.test.cypress.d.ts +0 -0
  317. /package/lib/{components → src/components}/RadioConsent/index.d.ts +0 -0
  318. /package/lib/{components → src/components}/RadioConsent/styles.d.ts +0 -0
  319. /package/lib/{components → src/components}/Select/Select.test.cypress.d.ts +0 -0
  320. /package/lib/{components → src/components}/Select/index.d.ts +0 -0
  321. /package/lib/{components → src/components}/Select/styles.d.ts +0 -0
  322. /package/lib/{components → src/components}/Spacing/index.d.ts +0 -0
  323. /package/lib/{components → src/components}/Step/Step.test.cypress.d.ts +0 -0
  324. /package/lib/{components → src/components}/Step/index.d.ts +0 -0
  325. /package/lib/{components → src/components}/Step/styles.d.ts +0 -0
  326. /package/lib/{components → src/components}/Text/Text.test.cypress.d.ts +0 -0
  327. /package/lib/{components → src/components}/Text/index.d.ts +0 -0
  328. /package/lib/{components → src/components}/Text/styles.d.ts +0 -0
  329. /package/lib/{components → src/components}/TextAreaField/TextAreaField.test.cypress.d.ts +0 -0
  330. /package/lib/{components → src/components}/TextAreaField/index.d.ts +0 -0
  331. /package/lib/{components → src/components}/TextAreaField/styles.d.ts +0 -0
  332. /package/lib/{components → src/components}/TextField/TextField.test.cypress.d.ts +0 -0
  333. /package/lib/{components → src/components}/TextField/index.d.ts +0 -0
  334. /package/lib/{components → src/components}/TextField/styles.d.ts +0 -0
  335. /package/lib/{components → src/components}/ThemeCheatSheet.d.ts +0 -0
  336. /package/lib/{components → src/components}/Totaliser/Totaliser.test.cypress.d.ts +0 -0
  337. /package/lib/{components → src/components}/Totaliser/index.d.ts +0 -0
  338. /package/lib/{components → src/components}/Totaliser/styles.d.ts +0 -0
  339. /package/lib/{components → src/components}/UserBlock/UserBlock.test.cypress.d.ts +0 -0
  340. /package/lib/{components → src/components}/UserBlock/index.d.ts +0 -0
  341. /package/lib/{components → src/components}/UserBlock/styles.d.ts +0 -0
  342. /package/lib/{components → src/components}/index.d.ts +0 -0
  343. /package/lib/{hooks → src/hooks}/useKey.d.ts +0 -0
  344. /package/lib/{hooks → src/hooks}/useScrollPosition.d.ts +0 -0
  345. /package/lib/{themes → src/themes}/bowelbabe.d.ts +0 -0
  346. /package/lib/{themes → src/themes}/cruk.d.ts +0 -0
  347. /package/lib/{themes → src/themes}/rfl.d.ts +0 -0
  348. /package/lib/{themes → src/themes}/su2c.d.ts +0 -0
  349. /package/lib/{utils → src/utils}/Helper.d.ts +0 -0
  350. /package/lib/{utils → src/utils}/__tests__/testHelpers.test.d.ts +0 -0
  351. /package/lib/{utils → src/utils}/themeUtils.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../src/components/Carousel/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\n\nexport const CarouselWrapper = styled.div`\n position: relative;\n width: 100%;\n overflow-y: hidden;\n`;\n\nexport const CarouselScrollArea = styled.ul<{\n $smoothScrolling: boolean;\n}>`\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<{\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\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<{\n $isSelected: boolean;\n $shrinkUnselectedPages: boolean;\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\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\nexport const CarouselButton = styled.button<{\n disabled: boolean;\n theme: ThemeType;\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: ${({ 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\nexport const DotContainer = styled.div<{ $count: number; theme: ThemeType }>`\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<{ $selected: boolean; theme: ThemeType }>`\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":"iHAIa,wBAAAA,EAAkBC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,oEAAA,CAAA,uEAM5BC,EAAqBJ,EAAOK,GAAEC,IAAAA,EAAAH,EAAA,CAAA,wGAAA,iLAAA,CAEzC,wGAKsC,oLADnB,SAACI,GAClB,OADoCA,EAAAC,iBACjB,SAAW,MAA9B,IAUSC,EAAeT,EAAOU,GAAEC,IAAAA,EAAAR,EAAA,CAAA,sEAAA,OAAA,CAGnC,sEAIgD,UADvC,SAACI,OAAEK,EAAUL,EAAAK,WAAEC,EAAeN,EAAAM,gBACrC,OAAAD,GAAcC,EAAkB,OAAS,KAAzC,IAGSC,EAAoBd,EAAOC,IAAGc,IAAAA,EAAAZ,EAAA,CAAA,wDAAA,OAAA,CAKzC,wDAUkB,UARL,SAACI,OACZS,EAAWT,EAAAS,YACXC,EAAsBV,EAAAU,uBACtBL,EAAUL,EAAAK,WACVC,EAAeN,EAAAM,gBAEf,OAAAD,GAAeI,GAAeC,GAA2BJ,EACrD,WACA,YAFJ,IAKSK,EAAgBlB,EAAOC,IAAGkB,IAAAA,EAAAhB,EAAA,CAAA,oDAAA,CAAA,uDAK1BiB,EAAgBpB,EAAOqB,KAAIC,IAAAA,EAAAnB,EAAA,CAAA,oFAAA,CAAA,uFAO3BoB,EAAiBvB,EAAOwB,OAAMC,IAAAA,EAAAtB,EAAA,CAAA,sNAAA,mBAAA,sOAAA,YAAA,CAGzC,sNAW4B,mBACoB,sOAYuB,eAlB9D,SAACI,OAAEmB,EAAQnB,EAAAmB,SAAEC,EAAKpB,EAAAoB,MACzB,OAAAD,EACIC,EAAMC,OAAOF,SACE,SAAfC,EAAME,KACJF,EAAMC,OAAOE,SACbH,EAAMC,OAAOG,OAJnB,IAKW,SAACxB,GAAc,OAAPA,EAAAoB,MAAaK,UAAUC,IAAhB,IAYb,SAAC1B,GAAiB,OAAPA,EAAAmB,SAAmB,aAAe,UAA3B,IAItBQ,EAAelC,EAAOC,yNAAyC,sFAIjB,6BAEE,qBACC,kCAGA,qBACA,eAPjD,SAACM,GAAe,OAAPA,EAAA4B,OAAiB,EAAI,OAAS,MAAvB,IAEN,SAAC5B,GAAc,OAAPA,EAAAoB,MAAaS,WAAWC,MAAjB,IACvB,SAAC9B,GAAe,OAAPA,EAAA4B,OAAiB,GAAK,OAAS,MAAxB,IAGR,SAAC5B,GAAc,OAAPA,EAAAoB,MAAaS,WAAWE,OAAjB,IACvB,SAAC/B,GAAe,OAAPA,EAAA4B,OAAiB,GAAK,OAAS,MAAxB,IAIlBI,EAAMvC,EAAOwB,OAAgDgB,IAAAA,EAAArC,EAAA,CAAA,wCAAA,+BAAA,eAAA,gBAAA,4IAAA,0BAAA,6KAAA,CAAA,wCAEtB,+BAEE,eACX,gBACC,4IAMtC,0BAM8B,gLAhBhB,SAACI,GAAc,OAAPA,EAAAoB,MAAac,QAAQC,GAAd,IAEvB,SAACnC,GAAE,IAAAoB,EAAKpB,EAAAoB,MAAO,MAAA,eAAQA,EAAMc,QAAQC,IAAtB,IAChB,SAACnC,GAAc,OAAPA,EAAAoB,MAAaK,UAAUW,CAAhB,IACd,SAACpC,GAAc,OAAPA,EAAAoB,MAAaK,UAAUW,CAAhB,IAGf,SAACpC,GAAE,IAAAoB,EAAKpB,EAAAoB,MAChB,MAAA,aAAAiB,OACiB,SAAfjB,EAAME,KAAkBF,EAAMC,OAAOE,SAAWH,EAAMC,OAAOG,QAD/D,IAGkB,SAACxB,OAAEoB,EAAKpB,EAAAoB,MAC1B,OADqCpB,EAAAsC,UAEjC,UACiB,SAAflB,EAAME,KAAkBF,EAAMC,OAAOE,SAAWH,EAAMC,OAAOG,SAE/DJ,EAAMC,OAAOkB,eAJjB,IAgBSC,EAAmB/C,EAAOqB,KAAI2B,IAAAA,EAAA7C,EAAA,CAAA,4NAAA,CAAA"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../src/components/Carousel/styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nimport { type ThemeType } from \"../../types\";\n\nexport const CarouselWrapper = styled.div`\n position: relative;\n width: 100%;\n overflow-y: hidden;\n`;\n\nexport const CarouselScrollArea = styled.ul<{\n $smoothScrolling: boolean;\n}>`\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<{\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\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<{\n $isSelected: boolean;\n $shrinkUnselectedPages: boolean;\n $onlyChild: boolean;\n $fullWidthChild: boolean;\n}>`\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\nexport const CarouselButton = styled.button<{\n disabled: boolean;\n theme: ThemeType;\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: ${({ 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\nexport const DotContainer = styled.div<{ $count: number; theme: ThemeType }>`\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<{ $selected: boolean; theme: ThemeType }>`\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","CarouselScrollArea","ul","$smoothScrolling","CarouselCard","li","$onlyChild","$fullWidthChild","CarouselCardInner","$isSelected","$shrinkUnselectedPages","ButtonWrapper","VerticalAlign","span","CarouselButton","button","disabled","theme","colors","name","textDark","primary","fontSizes","xxxl","DotContainer","$count","breakpoint","tablet","desktop","Dot","spacing","xxs","l","$selected","backgroundLight","ScreenReaderOnly"],"mappings":"iCAIa,MAAAA,EAAkBC,EAAOC,GAAG;;;;EAM5BC,EAAqBF,EAAOG,EAEvC;;;;qBAImB,EAAGC,sBACpBA,EAAmB,SAAW;;;;;;;;EAUrBC,EAAeL,EAAOM,EAGjC;;;WAGS,EAAGC,aAAYC,qBACtBD,GAAcC,EAAkB,OAAS;EAGhCC,EAAoBT,EAAOC,GAKtC;;eAEa,EACXS,cACAC,yBACAJ,aACAC,qBAEAD,GAAeG,GAAeC,GAA2BH,EACrD,WACA;EAGKI,EAAgBZ,EAAOC,GAAG;;;EAK1BY,EAAgBb,EAAOc,IAAI;;;;;EAO3BC,EAAiBf,EAAOgB,MAGnC;;;;;;WAMS,EAAGC,WAAUC,WACpBD,EACIC,EAAMC,OAAOF,SACE,SAAfC,EAAME,KACJF,EAAMC,OAAOE,SACbH,EAAMC,OAAOG;eACR,EAAGJ,WAAYA,EAAMK,UAAUC;;;;;;;;;;;;iBAY7B,EAAGP,cAAgBA,EAAW,aAAe;;EAIjDQ,EAAezB,EAAOC,GAAyC;;;;aAI/D,EAAGyB,YAAcA,EAAS,EAAI,OAAS;;uBAE7B,EAAGR,WAAYA,EAAMS,WAAWC;eACxC,EAAGF,YAAcA,EAAS,GAAK,OAAS;;;uBAGhC,EAAGR,WAAYA,EAAMS,WAAWE;eACxC,EAAGH,YAAcA,EAAS,GAAK,OAAS;;EAI1CI,EAAM9B,EAAOgB,MAAgD;;oBAEtD,EAAGE,WAAYA,EAAMa,QAAQC;;YAErC,EAAGd,WAAY,QAAQA,EAAMa,QAAQC;WACtC,EAAGd,WAAYA,EAAMK,UAAUU;YAC9B,EAAGf,WAAYA,EAAMK,UAAUU;;;YAG/B,EAAGf,WACX,aACiB,SAAfA,EAAME,KAAkBF,EAAMC,OAAOE,SAAWH,EAAMC,OAAOG;sBAE7C,EAAGJ,QAAOgB,eAC5BA,EACI,GACiB,SAAfhB,EAAME,KAAkBF,EAAMC,OAAOE,SAAWH,EAAMC,OAAOG,UAE/DJ,EAAMC,OAAOgB;;;;;;;;;EAYRC,EAAmBpC,EAAOc,IAAI;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { StoryObj } from "@storybook/react";
3
- import CheckBox, { CheckBoxProps } from ".";
2
+ import { type StoryObj } from "@storybook/react";
3
+ import CheckBox, { type CheckBoxProps } from ".";
4
4
  declare const _default: {
5
5
  title: string;
6
6
  component: React.ForwardRefExoticComponent<Omit<CheckBoxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -1,2 +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 h}from"./styles.js";var p=t((function(t,p){var E=s(),b=e(e({},a),E),x=t.children,j=t.hasError,k=t.errorMessage,v=r(t,["children","hasError","errorMessage"]);return o.createElement(i,{theme:b},o.createElement(c,{$hasError:j||!!k||!1,$checked:t.checked||t.defaultChecked||!1,$disabled:t.disabled||!1},o.createElement(n,e({},v,{disabled:t.disabled||!1,type:"checkbox",ref:p,"aria-describedby":t.id&&k?"".concat(t.id,"-error"):void 0})),o.createElement(f,null),x||t.value,b.utilities.useDefaultFromControls?null:o.createElement(u,null,o.createElement(h,null,o.createElement(m,{faIcon:l,color:"check",size:"1.25em"})))),!!k&&o.createElement(d,{marginTop:"xxs",id:t.id?"".concat(t.id,"-error"):void 0},k))}));export{p as Checkbox,p as default};
1
+ import e,{forwardRef as r}from"react";import{useTheme as o,ThemeProvider as t}from"styled-components";import{faCheck as l}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as s}from"../../themes/cruk.js";import{ErrorText as i}from"../ErrorText/index.js";import{IconFa as d}from"../IconFa/index.js";import{StyledLabel as m,StyledInput as a,SelectedBorder as c,CheckWrapper as n,Check as f}from"./styles.js";const u=r(((r,u)=>{const p=o(),h={...s,...p},{children:E,hasError:x,errorMessage:b,...k}=r;return e.createElement(t,{theme:h},e.createElement(m,{$hasError:x||!!b||!1,$checked:r.checked||r.defaultChecked||!1,$disabled:r.disabled||!1},e.createElement(a,{...k,disabled:r.disabled||!1,type:"checkbox",ref:u,"aria-describedby":r.id&&b?`${r.id}-error`:void 0}),e.createElement(c,null),E||r.value,h.utilities.useDefaultFromControls?null:e.createElement(n,null,e.createElement(f,null,e.createElement(d,{faIcon:l,color:"check",size:"1.25em"})))),!!b&&e.createElement(i,{marginTop:"xxs",id:r.id?`${r.id}-error`:void 0},b))}));u.displayName="Checkbox";export{u as Checkbox,u as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +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\n const { children, hasError, errorMessage, ...rest } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n $hasError={hasError || !!errorMessage || false}\n $checked={props.checked || props.defaultChecked || false}\n $disabled={props.disabled || false}\n >\n <StyledInput\n {...rest}\n disabled={props.disabled || false}\n type=\"checkbox\"\n ref={ref}\n aria-describedby={\n !!props.id && !!errorMessage ? `${props.id}-error` : 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 {!!errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {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","hasError","errorMessage","rest","React","createElement","ThemeProvider","StyledLabel","$hasError","$checked","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,GAGGK,EAA8CP,EAAKO,SAAzCC,EAAoCR,EAA5BQ,SAAEC,EAA0BT,eAATU,IAASV,EAAhD,CAA6C,WAAA,WAAA,iBAEnD,OACEW,EAACC,cAAAC,EAAc,CAAAT,MAAOA,GACpBO,EAACC,cAAAE,EACY,CAAAC,UAAAP,KAAcC,IAAgB,EAAKO,SACpChB,EAAMiB,SAAWjB,EAAMkB,iBAAkB,YACxClB,EAAMmB,WAAY,GAE7BR,EAAAC,cAACQ,EACKf,EAAA,CAAA,EAAAK,GACJS,SAAUnB,EAAMmB,WAAY,EAC5BE,KAAK,WACLpB,IAAKA,EAAG,mBAEJD,EAAMsB,IAAQb,EAAe,GAAGc,OAAAvB,EAAMsB,GAAE,eAAWE,KAGzDb,EAAAC,cAACa,EAAiB,MACjBlB,GAAYP,EAAM0B,MAClBtB,EAAMuB,UAAUC,uBAAyB,KACxCjB,gBAACkB,EAAY,KACXlB,EAAAC,cAACkB,EAAK,KACJnB,EAAAC,cAACmB,EAAO,CAAAC,OAAQC,EAASC,MAAM,QAAQC,KAAK,gBAKjD1B,GACDE,gBAACyB,EAAS,CACRC,UAAU,MACVf,GAAItB,EAAMsB,GAAK,GAAGC,OAAAvB,EAAMsB,kBAAaE,GAEpCf,GAKX"}
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\n const { children, hasError, errorMessage, ...rest } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <StyledLabel\n $hasError={hasError || !!errorMessage || false}\n $checked={props.checked || props.defaultChecked || false}\n $disabled={props.disabled || false}\n >\n <StyledInput\n {...rest}\n disabled={props.disabled || false}\n type=\"checkbox\"\n ref={ref}\n aria-describedby={\n !!props.id && !!errorMessage ? `${props.id}-error` : 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 {!!errorMessage && (\n <ErrorText\n marginTop=\"xxs\"\n id={props.id ? `${props.id}-error` : undefined}\n >\n {errorMessage}\n </ErrorText>\n )}\n </ThemeProvider>\n );\n },\n);\n\nCheckbox.displayName = \"Checkbox\";\n\nexport default Checkbox;\n"],"names":["Checkbox","forwardRef","props","ref","foundTheme","useTheme","theme","defaultTheme","children","hasError","errorMessage","rest","React","createElement","ThemeProvider","StyledLabel","$hasError","$checked","checked","defaultChecked","disabled","StyledInput","type","id","undefined","SelectedBorder","value","utilities","useDefaultFromControls","CheckWrapper","Check","IconFa","faIcon","faCheck","color","size","ErrorText","marginTop","displayName"],"mappings":"4bAoCa,MAAAA,EAAWC,GACtB,CAACC,EAAsBC,KACrB,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,IAGCI,SAAEA,EAAQC,SAAEA,EAAQC,aAAEA,KAAiBC,GAAST,EAEtD,OACEU,EAACC,cAAAC,EAAc,CAAAR,MAAOA,GACpBM,EAACC,cAAAE,EACY,CAAAC,UAAAP,KAAcC,IAAgB,EAAKO,SACpCf,EAAMgB,SAAWhB,EAAMiB,iBAAkB,YACxCjB,EAAMkB,WAAY,GAE7BR,EAAAC,cAACQ,EACK,IAAAV,EACJS,SAAUlB,EAAMkB,WAAY,EAC5BE,KAAK,WACLnB,IAAKA,EAAG,mBAEJD,EAAMqB,IAAQb,EAAe,GAAGR,EAAMqB,gBAAaC,IAGzDZ,EAAAC,cAACY,EAAiB,MACjBjB,GAAYN,EAAMwB,MAClBpB,EAAMqB,UAAUC,uBAAyB,KACxChB,gBAACiB,EAAY,KACXjB,EAAAC,cAACiB,EAAK,KACJlB,EAAAC,cAACkB,EAAO,CAAAC,OAAQC,EAASC,MAAM,QAAQC,KAAK,gBAKjDzB,GACDE,gBAACwB,EAAS,CACRC,UAAU,MACVd,GAAIrB,EAAMqB,GAAK,GAAGrB,EAAMqB,gBAAaC,GAEpCd,GAGS,IAKtBV,EAASsC,YAAc"}
@@ -1,2 +1,106 @@
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};
1
+ import o,{css as e}from"styled-components";const t="1.5rem",i=o.div`
2
+ display: inline-block;
3
+ height: ${t};
4
+ width: ${t};
5
+ position: absolute;
6
+ top: calc(50% - (${t} / 2));
7
+ left: ${({theme:{spacing:{xs:o}}})=>o};
8
+ `,r=o.span`
9
+ display: block;
10
+ position: relative;
11
+ border: 2px solid ${({theme:o})=>o.colors.selectionBorder};
12
+ height: ${t};
13
+ width: ${t};
14
+ top: 0;
15
+ bottom: 0;
16
+ left: 0;
17
+ right: 0;
18
+ z-index: 5;
19
+ transition: border 0.25s ease;
20
+ overflow: hidden;
21
+
22
+ svg {
23
+ path {
24
+ transition: transform 0.25s ease;
25
+ transform: rotateY(90deg);
26
+ transform-origin: center;
27
+ }
28
+ }
29
+ `,s=o.label`
30
+ box-sizing: border-box;
31
+ *,
32
+ *:after,
33
+ *:before {
34
+ box-sizing: border-box;
35
+ }
36
+ line-height: ${({theme:o})=>o.typography.lineHeight};
37
+ font-size: ${({theme:o})=>o.typography.fontSizeBase};
38
+ font-family: ${({theme:o})=>o.typography.fontFamilyBase};
39
+
40
+ background-color: ${({theme:o})=>o.colors.backgroundLight};
41
+ position: relative;
42
+
43
+ cursor: ${({$disabled:o})=>o?"not-allowed":"pointer"};
44
+ display: block;
45
+
46
+ color: ${({theme:o,$disabled:e})=>e?o.colors.disabled:o.colors.textDark};
47
+ padding: ${({theme:o})=>`calc( (3em - ( ${o.utilities.inputBorderWidth} * 2) - ${o.typography.lineHeight} ) / 2) ${o.spacing.m} calc( (3em - ( ${o.utilities.inputBorderWidth} * 2) - ${o.typography.lineHeight} ) / 2) ${o.spacing.xl}`};
48
+ &:focus ~ ${i} ${r} {
49
+ outline: 2px solid #7aacfe; /* for non-webkit browsers */
50
+ outline: 5px auto -webkit-focus-ring-color;
51
+ }
52
+
53
+ svg {
54
+ path {
55
+ fill: ${({theme:o,$disabled:e})=>e&&o.colors.disabled};
56
+ }
57
+ }
58
+
59
+ ${({theme:o,$disabled:t,$checked:s,$hasError:l})=>o.utilities.useDefaultFromControls?null:e`
60
+ min-height: 2rem;
61
+
62
+ ${i} ${r} {
63
+ border: solid ${"2px"}
64
+ ${t?o.colors.disabled:l?o.colors.danger:s?o.colors.check:o.colors.inputBorder};
65
+ }
66
+
67
+ &:hover ${i} ${r} {
68
+ border: solid ${"2px"}
69
+ ${t?o.colors.disabled:o.colours};
70
+ }
71
+ `}
72
+ `,l=o.div`
73
+ position: absolute;
74
+ top: 0;
75
+ left: 0;
76
+ width: 100%;
77
+ height: 100%;
78
+ `,n=o.input`
79
+ margin-right: 5px !important;
80
+
81
+ ${({theme:o})=>o.utilities.useDefaultFromControls?e`
82
+ position: absolute;
83
+ display: inline-block;
84
+ transform: translate(-50%, -50%);
85
+ top: 50%;
86
+ margin: 0;
87
+ padding: 0;
88
+ left: ${o.spacing.s};
89
+ `:e`
90
+ /* This hides the original input */
91
+ position: absolute;
92
+ left: ${o.spacing.xxs};
93
+ opacity: 0;
94
+
95
+ &:focus ~ ${l} {
96
+ outline: none !important;
97
+ box-shadow: inset 0 0 0 2px ${o.colors.inputBorder};
98
+ box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;
99
+ }
100
+
101
+ &:checked ~ ${i} svg path {
102
+ transform: rotateY(0deg);
103
+ }
104
+ `}
105
+ `;export{r as Check,i as CheckWrapper,l as SelectedBorder,n as StyledInput,s as StyledLabel};
2
106
  //# sourceMappingURL=styles.js.map
@@ -1 +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\nexport const CheckWrapper = styled.div<{\n theme: ThemeType;\n}>`\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<{\n theme: ThemeType;\n}>`\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<{\n $checked: boolean;\n $disabled: boolean;\n $hasError: boolean;\n theme: ThemeType;\n}>`\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, $checked, $hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n\n ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${$disabled\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 ${$disabled ? 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<{\n theme: ThemeType;\n}>`\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","disabled","textDark","concat","utilities","inputBorderWidth","m","xl","$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,SAIVC,EAAeC,EAAOC,IAAGC,IAAAA,EAAAC,EAAA,CAAA,yCAAA,eAAA,gDAAA,oBAAA,OAAA,CAEpC,yCAEwB,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,CAE9B,mEAG+D,gBACvC,eACD,iRAFH,SAACC,GAAc,OAAPA,EAAAC,MAAaM,OAAOC,eAAb,GACzBd,EACDA,GAkBEe,EAAcb,EAAOc,MAKhCC,IAAAA,EAAAZ,EAAA,CAAA,iHAAA,mBAAA,qBAAA,4BAAA,yCAAA,oCAAA,iBAAA,kBAAA,IAAA,+JAAA,sBAAA,MAAA,CAAA,iHAOyD,mBACA,qBACI,4BAEE,yCAGK,oCAIT,iBAEyM,kBAC5O,IAAS,+JAOuC,sBAyBjE,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,GAAkB,OAAPA,EAAAiB,UAAoB,cAAgB,SAA7B,IAGpB,SAACjB,OAAEC,EAAKD,EAAAC,MACf,OAD0BD,EAAAiB,UACdhB,EAAMM,OAAOW,SAAWjB,EAAMM,OAAOY,QAAjD,IACS,SAACnB,GAAE,IAAAC,EAAKD,EAAAC,MACjB,MAAA,iBApEkB,MAoEK,SAAAmB,OAAQnB,EAAMoB,UAAUC,iBAAgB,YAAAF,OAAWnB,EAAMW,WAAWC,8BAAqBZ,EAAMC,QAAQqB,EAAY,YAAAH,OApExH,sBAoE6InB,EAAMoB,UAAUC,oCAA2BrB,EAAMW,WAAWC,WAAqB,YAAAO,OAAAnB,EAAMC,QAAQsB,GAA9P,GACU7B,EAAgBS,GAOhB,SAACJ,OAAEC,EAAKD,EAAAC,MAAkB,OAAPD,EAAAiB,WAAoBhB,EAAMM,OAAOW,QAA1B,IAIpC,SAAClB,OAAEC,EAAKD,EAAAC,MAAEgB,EAASjB,EAAAiB,UAAEQ,EAAQzB,EAAAyB,SAAEC,EAAS1B,EAAA0B,UACxC,OAAAzB,EAAMoB,UAAUM,uBACZ,KACAC,EAAGC,IAAAA,EAAA9B,EAAA,CAAA,8CAAA,IAAA,iCAAA,mBAAA,uCAAA,IAAA,iCAAA,mBAAA,4BAAA,CAAA,8CAGa,IAAS,iCACW,mBAOE,uCAGd,IAAS,iCACG,mBACqB,8BAbrDJ,EAAgBS,EArFH,MAuFTa,EACEhB,EAAMM,OAAOW,SACbQ,EACEzB,EAAMM,OAAOuB,OACbL,EACExB,EAAMM,OAAOwB,MACb9B,EAAMM,OAAOyB,YAGfrC,EAAgBS,EAhGX,MAkGTa,EAAYhB,EAAMM,OAAOW,SAAWjB,EAAMgC,QAlBtD,IAuBSC,EAAiBtC,EAAOC,IAAGsC,IAAAA,EAAApC,EAAA,CAAA,qFAAA,CAAA,wFAS3BqC,EAAcxC,EAAOyC,MAAKC,IAAAA,EAAAvC,EAAA,CAAA,0CAAA,MAAA,CAErC,0CA6BO,SA1BL,SAACC,GAAE,IAAAC,EAAKD,EAAAC,MACR,OAAAA,EAAMoB,UAAUM,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"}
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\nexport const CheckWrapper = styled.div<{\n theme: ThemeType;\n}>`\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<{\n theme: ThemeType;\n}>`\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<{\n $checked: boolean;\n $disabled: boolean;\n $hasError: boolean;\n theme: ThemeType;\n}>`\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, $checked, $hasError }) =>\n theme.utilities.useDefaultFromControls\n ? null\n : css`\n min-height: 2rem;\n\n ${CheckWrapper} ${Check} {\n border: solid ${BORDER_THICKNESS}\n ${$disabled\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 ${$disabled ? 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<{\n theme: ThemeType;\n}>`\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","theme","spacing","xs","Check","span","colors","selectionBorder","StyledLabel","label","typography","lineHeight","fontSizeBase","fontFamilyBase","backgroundLight","$disabled","disabled","textDark","utilities","inputBorderWidth","m","xl","$checked","$hasError","useDefaultFromControls","css","danger","check","inputBorder","colours","SelectedBorder","StyledInput","input","s","xxs"],"mappings":"2CAGA,MAAMA,EAAiB,SAIVC,EAAeC,EAAOC,GAEjC;;YAEUH;WACDA;;qBAEUA;UACX,EACNI,OACEC,SAAWC,UAETA;EAGKC,EAAQL,EAAOM,IAE1B;;;sBAGoB,EAAGJ,WAAYA,EAAMK,OAAOC;YACtCV;WACDA;;;;;;;;;;;;;;;;EAkBEW,EAAcT,EAAOU,KAKhC;;;;;;;iBAOe,EAAGR,WAAYA,EAAMS,WAAWC;eAClC,EAAGV,WAAYA,EAAMS,WAAWE;iBAC9B,EAAGX,WAAYA,EAAMS,WAAWG;;sBAE3B,EAAGZ,WAAYA,EAAMK,OAAOQ;;;YAGtC,EAAGC,eAAiBA,EAAY,cAAgB;;;WAGjD,EAAGd,QAAOc,eACjBA,EAAYd,EAAMK,OAAOU,SAAWf,EAAMK,OAAOW;aACxC,EAAGhB,WACZ,kBAA+BA,EAAMiB,UAAUC,2BAA2BlB,EAAMS,WAAWC,qBAAqBV,EAAMC,QAAQkB,oBAAiCnB,EAAMiB,UAAUC,2BAA2BlB,EAAMS,WAAWC,qBAAqBV,EAAMC,QAAQmB;cACpPvB,KAAgBM;;;;;;;cAOhB,EAAGH,QAAOc,eAAgBA,GAAad,EAAMK,OAAOU;;;;IAI9D,EAAGf,QAAOc,YAAWO,WAAUC,eAC/BtB,EAAMiB,UAAUM,uBACZ,KACAC,CAAG;;;YAGC3B,KAAgBM;4BArFH;gBAuFTW,EACEd,EAAMK,OAAOU,SACbO,EACEtB,EAAMK,OAAOoB,OACbJ,EACErB,EAAMK,OAAOqB,MACb1B,EAAMK,OAAOsB;;;oBAGf9B,KAAgBM;4BAhGX;gBAkGTW,EAAYd,EAAMK,OAAOU,SAAWf,EAAM4B;;;EAK7CC,EAAiB/B,EAAOC,GAAG;;;;;;EAS3B+B,EAAchC,EAAOiC,KAEhC;;;IAGE,EAAG/B,WACHA,EAAMiB,UAAUM,uBACZC,CAAG;;;;;;;kBAOOxB,EAAMC,QAAQ+B;UAExBR,CAAG;;;kBAGOxB,EAAMC,QAAQgC;;;sBAGVJ;;0CAEoB7B,EAAMK,OAAOsB;;;;wBAI/B9B;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { StoryObj } from "@storybook/react";
2
+ import { type StoryObj } from "@storybook/react";
3
3
  import Collapse from ".";
4
4
  declare const _default: {
5
5
  title: string;
@@ -1,2 +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{IconFa as c}from"../IconFa/index.js";import{CustomHeader as d,DefaultHeader as m,FlippingIcon as u,CollapseContent as s,transitionDurationSeconds as p}from"./styles.js";function f(f){var h=f.id,x=f.headerTitleText,y=f.headerTitleTextColor,T=f.headerTitleTextSize,b=f.headerTitleTextFontFamily,v=f.headerComponent,E=f.startOpen,k=f.onOpenChange,C=f.children,$=n(E||!1),g=$[0],j=$[1],F=n(E?"initial":"0"),S=F[0],I=F[1],w=r(null),z=r(null),D=a(),H=e(e({},l),D),O=function(){var e=w.current;(null==z?void 0:z.current)&&clearTimeout(null==z?void 0:z.current);var t=!g;j(t),null!==e&&I("".concat(e.scrollHeight,"px")),!1===t?setTimeout((function(){return I("0")}),10):z.current=setTimeout((function(){return I("initial")}),1e3*p),void 0!==k&&k(t)};return o((function(){j(E||!1),I(E?"initial":"0")}),[E]),t.createElement("div",{id:h},v?t.createElement(d,{theme:H,"aria-controls":"".concat(h,"-header"),"aria-expanded":g,id:"".concat(h,"-header"),onClick:O,"aria-disabled":!1,"aria-label":x,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),O())},role:"button",tabIndex:0},v):t.createElement(m,{"aria-controls":"".concat(h,"-header"),"aria-expanded":g,id:"".concat(h,"-header"),onClick:O,theme:H,type:"button",appearance:"tertiary",$textColor:y,$textSize:T,$textFontFamily:b},x,t.createElement(u,{$open:g},t.createElement(c,{faIcon:i}))),t.createElement(s,{theme:H,id:"".concat(h,"-content"),ref:w,role:"region","aria-hidden":!g,"aria-labelledby":"".concat(h,"-header"),$contentHeight:S,$openStatus:g},C))}export{f as Collapse,f as default};
1
+ import e,{useState as t,useRef as r,useEffect as n}from"react";import{useTheme as a}from"styled-components";import{faChevronDown as o}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as i}from"../../themes/cruk.js";import{IconFa as l}from"../IconFa/index.js";import{CustomHeader as d,DefaultHeader as c,FlippingIcon as m,CollapseContent as s,transitionDurationSeconds as p}from"./styles.js";function h({id:h,headerTitleText:u,headerTitleTextColor:x,headerTitleTextSize:f,headerTitleTextFontFamily:$,headerComponent:y,startOpen:T,onOpenChange:b,children:E}){const[k,C]=t(T||!1),[g,F]=t(T?"initial":"0"),j=r(null),v=r(null),S=a(),I={...i,...S},w=()=>{const{current:e}=j;v?.current&&clearTimeout(v?.current);const t=!k;C(t),null!==e&&F(`${e.scrollHeight}px`),!1===t?setTimeout((()=>F("0")),10):v.current=setTimeout((()=>F("initial")),1e3*p),void 0!==b&&b(t)};return n((()=>{C(T||!1),F(T?"initial":"0")}),[T]),e.createElement("div",{id:h},y?e.createElement(d,{theme:I,"aria-controls":`${h}-header`,"aria-expanded":k,id:`${h}-header`,onClick:w,"aria-disabled":!1,"aria-label":u,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),w())},role:"button",tabIndex:0},y):e.createElement(c,{"aria-controls":`${h}-header`,"aria-expanded":k,id:`${h}-header`,onClick:w,theme:I,type:"button",appearance:"tertiary",$textColor:x,$textSize:f,$textFontFamily:$},u,e.createElement(m,{$open:k},e.createElement(l,{faIcon:o}))),e.createElement(s,{theme:I,id:`${h}-content`,ref:j,role:"region","aria-hidden":!k,"aria-labelledby":`${h}-header`,$contentHeight:g,$openStatus:k},E))}export{h as Collapse,h as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +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\";\nimport { IconFa } from \"../IconFa\";\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 type=\"button\"\n appearance=\"tertiary\"\n $textColor={headerTitleTextColor}\n $textSize={headerTitleTextSize}\n $textFontFamily={headerTitleTextFontFamily}\n >\n {headerTitleText}\n <FlippingIcon $open={openStatus}>\n <IconFa faIcon={faChevronDown} />\n </FlippingIcon>\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","type","appearance","$textColor","$textSize","FlippingIcon","IconFa","faIcon","faChevronDown","CollapseContent","ref","$contentHeight","$openStatus"],"mappings":"kfAiDM,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,aACK,IAA5BgB,QAGiBC,IAAjBzB,GACFA,EAAaoB,EAEhB,EAmBD,OANAM,GAAU,WACRrB,EAAcN,IAAa,GAEfS,EAAZT,EAA6B,UAA8B,IAC7D,GAAG,CAACA,IAGF4B,EAAAC,cAAA,MAAA,CAAKnC,GAAIA,GACNK,EACC6B,EAACC,cAAAC,GACCf,MAAOA,EAAK,gBACG,UAAGrB,EAAE,2BACLW,EACfX,GAAI,GAAA4B,OAAG5B,EAAE,WACTqC,QAASb,EACM,iBAAA,eACHvB,EACZqC,UA5Bc,SAACC,GAEL,UAAdA,EAAMC,KACQ,MAAdD,EAAMC,KACQ,aAAdD,EAAMC,MAEND,EAAME,iBACNjB,IAEH,EAoBOkB,KAAK,SACLC,SAAU,GAETtC,GAGH6B,gBAACU,EAAa,CAAA,gBACG,GAAGhB,OAAA5B,aACH,gBAAAW,EACfX,GAAI,UAAGA,EAAE,WACTqC,QAASb,EACTH,MAAOA,EACPwB,KAAK,SACLC,WAAW,WAAUC,WACT7C,EACD8C,UAAA7C,kBACMC,GAEhBH,EACDiC,EAACC,cAAAc,SAAoBtC,GACnBuB,EAACC,cAAAe,GAAOC,OAAQC,MAItBlB,EAAAC,cAACkB,EAAe,CACdhC,MAAOA,EACPrB,GAAI,GAAA4B,OAAG5B,EAAY,YACnBsD,IAAKtC,EACL0B,KAAK,wBACS/B,EACG,kBAAA,GAAAiB,OAAG5B,EAAW,WAAAuD,eACfzC,EAAa0C,YAChB7C,GAEZH,GAIT"}
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\";\nimport { IconFa } from \"../IconFa\";\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 if (startOpen) {\n setContentHeight(\"initial\");\n } else {\n setContentHeight(\"0\");\n }\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 type=\"button\"\n appearance=\"tertiary\"\n $textColor={headerTitleTextColor}\n $textSize={headerTitleTextSize}\n $textFontFamily={headerTitleTextFontFamily}\n >\n {headerTitleText}\n <FlippingIcon $open={openStatus}>\n <IconFa faIcon={faChevronDown} />\n </FlippingIcon>\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","id","headerTitleText","headerTitleTextColor","headerTitleTextSize","headerTitleTextFontFamily","headerComponent","startOpen","onOpenChange","children","openStatus","setOpenStatus","useState","contentHeight","setContentHeight","content","useRef","transitionTimer","foundTheme","useTheme","theme","defaultTheme","toggleCollapse","current","clearTimeout","newOpenState","scrollHeight","setTimeout","transitionDurationSeconds","undefined","useEffect","React","createElement","CustomHeader","onClick","onKeyDown","event","key","preventDefault","role","tabIndex","DefaultHeader","type","appearance","$textColor","$textSize","FlippingIcon","IconFa","faIcon","faChevronDown","CollapseContent","ref","$contentHeight","$openStatus"],"mappings":"8aAiDM,SAAUA,GAASC,GACvBA,EAAEC,gBACFA,EAAeC,qBACfA,EAAoBC,oBACpBA,EAAmBC,0BACnBA,EAAyBC,gBACzBA,EAAeC,UACfA,EAASC,aACTA,EAAYC,SACZA,IAEA,MAAOC,EAAYC,GAAiBC,EAASL,IAAa,IACnDM,EAAeC,GAAoBF,EACxCL,EAAY,UAAY,KAEpBQ,EAAUC,EAAuB,MACjCC,EAAkBD,EAA6C,MAC/DE,EAAaC,IACbC,EAAmB,IACpBC,KACAH,GAGCI,EAAiB,KACrB,MAAMC,QAAEA,GAAYR,EAChBE,GAAiBM,SAASC,aAAaP,GAAiBM,SAC5D,MAAME,GAAgBf,EACtBC,EAAcc,GAEE,OAAZF,GACFT,EAAiB,GAAGS,EAAQG,mBAGT,IAAjBD,EAEFE,YAAW,IAAMb,EAAiB,MAAM,IAExCG,EAAgBM,QAAUI,YACxB,IAAMb,EAAiB,YACK,IAA5Bc,QAGiBC,IAAjBrB,GACFA,EAAaiB,IAyBjB,OAVAK,GAAU,KACRnB,EAAcJ,IAAa,GAGzBO,EADEP,EACe,UAEA,OAElB,CAACA,IAGFwB,EAAAC,cAAA,MAAA,CAAK/B,GAAIA,GACNK,EACCyB,EAACC,cAAAC,GACCb,MAAOA,EAAK,gBACG,GAAGnB,2BACHS,EACfT,GAAI,GAAGA,WACPiC,QAASZ,EACM,iBAAA,eACHpB,EACZiC,UAhCeC,IAEL,UAAdA,EAAMC,KACQ,MAAdD,EAAMC,KACQ,aAAdD,EAAMC,MAEND,EAAME,iBACNhB,MA0BIiB,KAAK,SACLC,SAAU,GAETlC,GAGHyB,gBAACU,EAAa,CAAA,gBACG,GAAGxC,WACH,gBAAAS,EACfT,GAAI,GAAGA,WACPiC,QAASZ,EACTF,MAAOA,EACPsB,KAAK,SACLC,WAAW,WAAUC,WACTzC,EACD0C,UAAAzC,kBACMC,GAEhBH,EACD6B,EAACC,cAAAc,SAAoBpC,GACnBqB,EAACC,cAAAe,GAAOC,OAAQC,MAItBlB,EAAAC,cAACkB,EAAe,CACd9B,MAAOA,EACPnB,GAAI,GAAGA,YACPkD,IAAKpC,EACLwB,KAAK,wBACS7B,EACG,kBAAA,GAAGT,WAAWmD,eACfvC,EAAawC,YAChB3C,GAEZD,GAIT"}
@@ -1,2 +1,32 @@
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";var i,e,r,a,l=.5,s=o.span(i||(i=n(["\n display: inline-block;\n transform: ",";\n transition-duration: ","s;\n"],["\n display: inline-block;\n transform: ",";\n transition-duration: ","s;\n"])),(function(n){return n.$open?"translateY(0.1em) scaleY(-1)":"initial"}),.5),f=o(t)(e||(e=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})),m=o.div(r||(r=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"})),c=o.div(a||(a=n(["\n cursor: pointer;\n"],["\n cursor: pointer;\n"])));export{m as CollapseContent,c as CustomHeader,f as DefaultHeader,s as FlippingIcon,l as transitionDurationSeconds};
1
+ import o from"styled-components";import{Button as t}from"../Button/index.js";const e=.5,i=o.span`
2
+ display: inline-block;
3
+ transform: ${({$open:o})=>o?"translateY(0.1em) scaleY(-1)":"initial"};
4
+ transition-duration: ${.5}s;
5
+ `,n=o(t)`
6
+ display: flex;
7
+ color: ${({theme:o,$textColor:t})=>t&&void 0!==o.colors[t]?o.colors[t]:t||o.colors.collapseHeaderColor};
8
+ font-size: ${({theme:{fontSizes:o,fontSizes:{m:t}},$textSize:e})=>e?o[e]:t};
9
+ font-family: ${({theme:o,$textFontFamily:t})=>t||o.typography.fontFamilyBase};
10
+ font-weight: normal;
11
+ margin-bottom: 0;
12
+ height: initial;
13
+ text-decoration: none;
14
+ text-align: left;
15
+ border-radius: 0;
16
+ &:hover,
17
+ &:focus {
18
+ color: ${({theme:{colors:o},$textColor:t})=>t&&void 0!==o[t]?o[t]:t||o.collapseHeaderColor};
19
+ }
20
+ `,r=o.div`
21
+ margin: 0;
22
+ transition: ${.5}s ease;
23
+ height: ${({$contentHeight:o})=>o};
24
+ visibility: ${({$openStatus:o})=>o?"visible":"hidden"};
25
+ overflow: hidden;
26
+ & > p {
27
+ margin-top: 0;
28
+ }
29
+ `,l=o.div`
30
+ cursor: pointer;
31
+ `;export{r as CollapseContent,l as CustomHeader,n as DefaultHeader,i as FlippingIcon,e as transitionDurationSeconds};
2
32
  //# sourceMappingURL=styles.js.map
@@ -1 +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\";\n\nexport const transitionDurationSeconds = 0.5;\n\nexport const FlippingIcon = styled.span<{ $open: boolean }>`\n display: inline-block;\n transform: ${({ $open }) =>\n $open ? \"translateY(0.1em) scaleY(-1)\" : \"initial\"};\n transition-duration: ${transitionDurationSeconds}s;\n`;\n\nexport const DefaultHeader = styled(Button)<{\n theme: ThemeType;\n $textColor?: string;\n $textSize?: FontSizeType;\n $textFontFamily?: string;\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 }) => ($textSize ? fontSizes[$textSize] : m)};\n font-family: ${({ theme, $textFontFamily }) =>\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 }) =>\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","span","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":"6JASO,YAAMA,EAA4B,GAE5BC,EAAeC,EAAOC,KAAwBC,IAAAA,EAAAC,EAAA,CAAA,4CAAA,6BAAA,QAAA,CAAA,4CAGL,6BACJ,WAFnC,SAACC,GACZ,OADmBA,EAAAC,MACX,+BAAiC,SAAzC,GALqC,IAS5BC,EAAgBN,EAAOO,EAAPP,CAK3BQ,IAAAA,EAAAL,EAAA,CAAA,gCAAA,mBAAA,qBAAA,+KAAA,YAAA,CAAA,gCAMoD,mBAOR,qBAEQ,+KAYJ,eAzBvC,SAACC,OAAEK,EAAKL,EAAAK,MAAEC,EAAUN,EAAAM,WAC3B,OAAEA,QACkD,IAA7CD,EAAME,OAAOD,GAChBD,EAAME,OAAOD,GACbA,GAAcD,EAAME,OAAOC,mBAH/B,IAIW,SAACR,OACZS,EAGCT,EAAAK,MAFCK,EAASD,EAAAC,UACIC,EAACF,EAAAC,UAAAC,EAEhBC,EAASZ,EAAAY,UACL,OAACA,EAAYF,EAAUE,GAAaD,CAApC,IACS,SAACX,OAAEK,EAAKL,EAAAK,MACrB,OADsCL,EAAAa,iBACnBR,EAAMS,WAAWC,cAApC,IASS,SAACf,OAAWO,EAAMP,EAAAK,MAAAE,OAAID,EAAUN,EAAAM,WACvC,OAAAA,QAA4D,IAAvCC,EAAOD,GACxBC,EAAOD,GACPA,GAAcC,EAAOC,mBAFzB,IAMOQ,EAAkBpB,EAAOqB,IAGpCC,IAAAA,EAAAnB,EAAA,CAAA,iCAAA,sBAAA,oBAAA,gEAAA,CAAA,iCAEuC,sBACqC,oBAExC,kEArDG,IAmD7B,SAACC,GAAmD,OAAnCA,EAAAmB,cAAmC,IAChD,SAACnB,GACb,OAD0BA,EAAAoB,YACZ,UAAY,QAA1B,IAOSC,EAAezB,EAAOqB,IAAGK,IAAAA,EAAAvB,EAAA,CAAA,0BAAA,CAAA"}
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\";\n\nexport const transitionDurationSeconds = 0.5;\n\nexport const FlippingIcon = styled.span<{ $open: boolean }>`\n display: inline-block;\n transform: ${({ $open }) =>\n $open ? \"translateY(0.1em) scaleY(-1)\" : \"initial\"};\n transition-duration: ${transitionDurationSeconds}s;\n`;\n\nexport const DefaultHeader = styled(Button)<{\n theme: ThemeType;\n $textColor?: string;\n $textSize?: FontSizeType;\n $textFontFamily?: string;\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 }) => ($textSize ? fontSizes[$textSize] : m)};\n font-family: ${({ theme, $textFontFamily }) =>\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 }) =>\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","span","$open","DefaultHeader","Button","theme","$textColor","colors","collapseHeaderColor","fontSizes","m","$textSize","$textFontFamily","typography","fontFamilyBase","CollapseContent","div","$contentHeight","$openStatus","CustomHeader"],"mappings":"6EASO,MAAMA,EAA4B,GAE5BC,EAAeC,EAAOC,IAAwB;;eAE5C,EAAGC,WACdA,EAAQ,+BAAiC;yBALJ;EAS5BC,EAAgBH,EAAOI,EAKlC;;WAES,EAAGC,QAAOC,gBACfA,QACkD,IAA7CD,EAAME,OAAOD,GAChBD,EAAME,OAAOD,GACbA,GAAcD,EAAME,OAAOC;eACpB,EACXH,OACEI,YACAA,WAAaC,MAEfC,eACKA,EAAYF,EAAUE,GAAaD;iBAC3B,EAAGL,QAAOO,qBACvBA,GAAmBP,EAAMQ,WAAWC;;;;;;;;;aAS3B,EAAGT,OAASE,UAAUD,gBAC7BA,QAA4D,IAAvCC,EAAOD,GACxBC,EAAOD,GACPA,GAAcC,EAAOC;;EAIlBO,EAAkBf,EAAOgB,GAGpC;;gBAhDuC;YAmD7B,EAAGC,oBAAiDA;gBAChD,EAAGC,iBACfA,EAAc,UAAY;;;;;EAOjBC,EAAenB,EAAOgB,GAAG;;"}
@@ -1,4 +1,4 @@
1
- import { StoryObj } from "@storybook/react";
1
+ import { type StoryObj } from "@storybook/react";
2
2
  import DateField from ".";
3
3
  declare const _default: {
4
4
  title: string;
@@ -1,2 +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};
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 m,ErrorTextWrapper as i}from"./styles.js";function d({label:d,hintText:u,day:s,month:p,year:y,dayName:h="day",monthName:c="month",yearName:x="year",dayHasError:E,monthHasError:g,yearHasError:b,errorMessage:f,onChange:q=()=>{},onBlur:F=()=>{},onFocus:L=()=>{},disabled:C,required:B}){const M=t();return e.createElement(o,null,e.createElement(a,{as:"legend",textWeight:M.typography.fontWeightLabels||700,marginBottom:"xxs",textFontFamily:M.typography.fontFamilyLabel},d,!!B&&e.createElement("span",{style:{fontWeight:M.typography.fontWeightBase}}," (required)")),u&&e.createElement(a,null,u),e.createElement(l,null,e.createElement(n,{label:"Day",type:"text",name:h,required:!!B,hideRequiredInLabel:!0,maxLength:2,autoComplete:"bday-day",pattern:"[0-9]*",inputMode:"numeric",value:s,onChange:q,onBlur:F,onFocus:L,hasError:E,disabled:C})),e.createElement(l,null,e.createElement(n,{label:"Month",type:"text",name:c,required:!!B,hideRequiredInLabel:!0,maxLength:2,autoComplete:"bday-month",pattern:"[0-9]*",inputMode:"numeric",value:p,onChange:q,onBlur:F,onFocus:L,hasError:g,disabled:C})),e.createElement(m,null,e.createElement(n,{label:"Year",type:"text",name:x,required:!!B,hideRequiredInLabel:!0,maxLength:4,autoComplete:"bday-year",pattern:"[0-9]*",inputMode:"numeric",value:y,onChange:q,onBlur:F,onFocus:L,hasError:b,disabled:C})),f&&e.createElement(i,null,e.createElement(r,{marginTop:"xxs"},f)))}export{d as DateField,d as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
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","label","hintText","day","month","year","dayName","monthName","yearName","dayHasError","monthHasError","yearHasError","errorMessage","onChange","onBlur","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":"6UA6CgBA,GAAUC,MACxBA,EAAKC,SACLA,EAAQC,IACRA,EAAGC,MACHA,EAAKC,KACLA,EAAIC,QACJA,EAAU,MAAKC,UACfA,EAAY,QAAOC,SACnBA,EAAW,OAAMC,YACjBA,EAAWC,cACXA,EAAaC,aACbA,EAAYC,aACZA,EAAYC,SACZA,EAAW,OAEVC,OACDA,EAAS,OAERC,QACDA,EAAU,OAETC,SACDA,EAAQC,SACRA,IAEA,MACMC,EADQC,IAEd,OACEC,gBAACC,EAAQ,KACPD,EAACE,cAAAC,EACC,CAAAC,GAAG,SACHC,WAAYP,EAAWQ,WAAWC,kBAAoB,IACtDC,aAAa,MACbC,eAAgBX,EAAWQ,WAAWI,iBAErC7B,IACEgB,GACDG,EAAAE,cAAA,OAAA,CACES,MAAO,CACLC,WAAYd,EAAWQ,WAAWO,iBAGnC,gBAIN/B,GAAYkB,EAAAE,cAACC,EAAI,KAAErB,GACpBkB,EAAAE,cAACY,EAAoB,KACnBd,EAAAE,cAACa,EAAS,CACRlC,MAAM,MACNmC,KAAK,OACLC,KAAM/B,EACNW,WAAYA,EACZqB,qBAAmB,EACnBC,UAAW,EACXC,aAAa,WACbC,QAAQ,SACRC,UAAU,UACVC,MAAOxC,EACPU,SAAUA,EACVC,OAAQA,EACRC,QAASA,EACT6B,SAAUnC,EACVO,SAAUA,KAGdI,EAAAE,cAACY,EAAoB,KACnBd,EAAAE,cAACa,EAAS,CACRlC,MAAM,QACNmC,KAAK,OACLC,KAAM9B,EACNU,WAAYA,EACZqB,qBAAmB,EACnBC,UAAW,EACXC,aAAa,aACbC,QAAQ,SACRC,UAAU,UACVC,MAAOvC,EACPS,SAAUA,EACVC,OAAQA,EACRC,QAASA,EACT6B,SAAUlC,EACVM,SAAUA,KAGdI,EAAAE,cAACuB,EAAyB,KACxBzB,EAAAE,cAACa,EAAS,CACRlC,MAAM,OACNmC,KAAK,OACLC,KAAM7B,EACNS,WAAYA,EACZqB,qBAAmB,EACnBC,UAAW,EACXC,aAAa,YACbC,QAAQ,SACRC,UAAU,UACVC,MAAOtC,EACPQ,SAAUA,EACVC,OAAQA,EACRC,QAASA,EACT6B,SAAUjC,EACVK,SAAUA,KAGbJ,GACCQ,EAAAE,cAACwB,EAAgB,KACf1B,EAAAE,cAACyB,EAAS,CAACC,UAAU,OAAOpC,IAKtC"}
@@ -1,2 +1,27 @@
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};
1
+ import i from"styled-components";import{Text as e}from"../Text/index.js";const o=i.fieldset`
2
+ margin: 0;
3
+ padding: 0;
4
+ border: 0;
5
+ *,
6
+ *:after,
7
+ *:before {
8
+ -webkit-box-sizing: border-box;
9
+ -moz-box-sizing: border-box;
10
+ box-sizing: border-box;
11
+ }
12
+ `;i(e)`
13
+ font-family: ${({theme:i})=>i.typography.fontFamilyLabel};
14
+ `;const t=i.div`
15
+ display: inline-block;
16
+ width: 60px;
17
+ margin-right: ${({theme:i})=>i.spacing.xs};
18
+ span {
19
+ margin-bottom: 0.25rem; // this is smaller than xxs spacing
20
+ font-weight: ${({theme:i})=>i.typography.fontWeightBase};
21
+ }
22
+ `,r=i(t)`
23
+ width: 80px;
24
+ `,n=i.div`
25
+ clear: left;
26
+ `;export{t as DateTextFieldWrapper,n as ErrorTextWrapper,o as Fieldset,r as LargeDateTextFieldWrapper};
2
27
  //# sourceMappingURL=styles.js.map
@@ -1 +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\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)<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n`;\n\nexport const DateTextFieldWrapper = styled.div<{ theme: ThemeType }>`\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":"yJAIa,IAAAA,EAAWC,EAAOC,SAAQC,IAAAA,EAAAC,EAAA,CAAA,0LAAA,CAAA,6LAaZH,EAAOI,EAAPJ,CAAYK,IAAAA,EAAAF,EAAA,CAAA,oBAAA,OAAA,CAAsB,oBACG,UAA/C,SAACG,GAAc,OAAPA,EAAAC,MAAaC,WAAWC,eAAjB,IAGzB,cAAMC,EAAuBV,EAAOW,IAAyBC,IAAAA,EAAAT,EAAA,CAAA,+DAAA,kGAAA,YAAA,CAAA,+DAGnB,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"}
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\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)<{ theme: ThemeType }>`\n font-family: ${({ theme }) => theme.typography.fontFamilyLabel};\n`;\n\nexport const DateTextFieldWrapper = styled.div<{ theme: ThemeType }>`\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","Text","theme","typography","fontFamilyLabel","DateTextFieldWrapper","div","spacing","xs","fontWeightBase","LargeDateTextFieldWrapper","ErrorTextWrapper"],"mappings":"yEAIa,MAAAA,EAAWC,EAAOC,QAAQ;;;;;;;;;;;EAaZD,EAAOE,EAA2B;iBAC5C,EAAGC,WAAYA,EAAMC,WAAWC;EAGpC,MAAAC,EAAuBN,EAAOO,GAAyB;;;kBAGlD,EAAGJ,WAAYA,EAAMK,QAAQC;;;mBAG5B,EAAGN,WAAYA,EAAMC,WAAWM;;EAItCC,EAA4BX,EAAOM,EAAqB;;EAIxDM,EAAmBZ,EAAOO,GAAG;;"}
@@ -1,2 +1,18 @@
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};
1
+ import e from"react";import t from"styled-components";const o=t.div`
2
+ align-items: center;
3
+ display: flex;
4
+ flex-basis: 100%;
5
+ padding-bottom: 10px;
6
+ padding-top: 10px;
7
+ text-align: center;
8
+ width: 100%;
9
+ &:before,
10
+ &:after {
11
+ background-color: #333;
12
+ content: "";
13
+ display: inline-block;
14
+ flex-grow: 1;
15
+ height: 1px;
16
+ }
17
+ `,n=({children:t})=>e.createElement(o,null,t);export{n as Divider,n as default};
2
18
  //# sourceMappingURL=Divider.js.map
@@ -1 +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\nexport const Divider = ({ children }: { children?: ReactNode }) => (\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,0SAAA,CAAA,6SAkBnBC,EAAU,SAACC,GAAE,IAAAC,EAAQD,EAAAC,SAAiC,OACjEC,EAACC,cAAAT,EAAe,KAAAO,EADiD"}
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\nexport const Divider = ({ children }: { children?: ReactNode }) => (\n <StyledDivider>{children}</StyledDivider>\n);\n\nexport default Divider;\n"],"names":["StyledDivider","styled","div","Divider","children","React","createElement"],"mappings":"sDAGA,MAAMA,EAAgBC,EAAOC,GAAG;;;;;;;;;;;;;;;;EAkBnBC,EAAU,EAAGC,cACxBC,EAACC,cAAAN,OAAeI"}
@@ -1,4 +1,4 @@
1
- import { StoryObj } from "@storybook/react";
1
+ import { type StoryObj } from "@storybook/react";
2
2
  import ErrorText from ".";
3
3
  declare const _default: {
4
4
  title: string;
@@ -1,2 +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};
1
+ import e from"react";import{useTheme as o}from"styled-components";import{faTriangleExclamation as r}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{crukTheme as t}from"../../themes/cruk.js";import{StyledErrorText as s}from"./styles.js";import{IconFa as m}from"../IconFa/index.js";import{Box as n}from"../Box/index.js";function i({children:i,as:a="span",...f}){const l=o(),c={...t,...l},p="string"==typeof i&&i.length;return e.createElement(s,{forwardedAs:a,...f,theme:c,role:"alert"},p?e.createElement(n,{as:"span",marginRight:"xxs"},e.createElement(m,{faIcon:r,size:"1em"})):null,i)}export{i as ErrorText,i as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
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","children","as","props","foundTheme","useTheme","theme","defaultTheme","shouldShowIcon","length","React","createElement","StyledErrorText","forwardedAs","role","Box","marginRight","IconFa","faIcon","faTriangleExclamation","size"],"mappings":"4VAqBgB,SAAAA,GAAUC,SAAEA,EAAQC,GAAEA,EAAK,UAAWC,IACpD,MAAMC,EAAaC,IACbC,EAAQ,IACTC,KACAH,GAGCI,EAAqC,iBAAbP,GAAyBA,EAASQ,OAChE,OACEC,EAACC,cAAAC,EAAgB,CAAAC,YAAaX,KAAQC,EAAOG,MAAOA,EAAOQ,KAAK,SAC7DN,EACCE,EAACC,cAAAI,EAAI,CAAAb,GAAG,OAAOc,YAAY,OACzBN,EAAAC,cAACM,EAAM,CAACC,OAAQC,EAAuBC,KAAK,SAE5C,KACHnB,EAGP"}
@@ -1,2 +1,6 @@
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};
1
+ import o from"styled-components";import{Text as t}from"../Text/index.js";const e=o(t)`
2
+ display: inline-block;
3
+ color: ${({theme:o})=>o.colors.textError};
4
+ font-weight: ${({theme:o})=>o.typography.fontWeightHeavy};
5
+ `;export{e as StyledErrorText,e as default};
2
6
  //# sourceMappingURL=styles.js.map
@@ -1 +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"}
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","theme","colors","textError","typography","fontWeightHeavy"],"mappings":"+EAOaA,EAAkBC,EAAOC,EAAiB;;WAE5C,EAAGC,WAAYA,EAAMC,OAAOC;iBACtB,EAAGF,WAAYA,EAAMG,WAAWC;"}
@@ -1,2 +1,8 @@
1
- import{__makeTemplateObject as e,__assign as n}from"../../node_modules/tslib/tslib.es6.js";import t from"react";import i from"styled-components";import{spacing as r,spacingPropsToSpacingPropsInternal as m}from"./Spacing/index.js";var o,a=i.div(o||(o=e(["\n display: block;\n @media (min-width: ",") {\n display: flex;\n }\n ","\n"],["\n display: block;\n @media (min-width: ",") {\n display: flex;\n }\n ","\n"])),(function(e){return e.theme.breakpoint.tablet}),(function(e){return r(e,e.theme)}));function l(e){var i=m(e);return t.createElement(a,n({theme:e.theme},i))}export{l as Flex,l as default};
1
+ import e from"react";import t from"styled-components";import{spacing as m,spacingPropsToSpacingPropsInternal as o}from"./Spacing/index.js";const i=t.div`
2
+ display: block;
3
+ @media (min-width: ${({theme:e})=>e.breakpoint.tablet}) {
4
+ display: flex;
5
+ }
6
+ ${e=>m(e,e.theme)}
7
+ `;function n(t){const m=o(t);return e.createElement(i,{theme:t.theme,...m})}export{n as Flex,n as default};
2
8
  //# sourceMappingURL=Flex.js.map