@tpzdsp/next-toolkit 2.5.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/package.json +22 -13
  2. package/src/assets/styles/globals.css +75 -95
  3. package/src/assets/styles/ol.css +57 -16
  4. package/src/assets/styles/utils.css +80 -0
  5. package/src/components/Accordion/Accordion.css +85 -0
  6. package/src/components/Accordion/Accordion.stories.tsx +264 -0
  7. package/src/components/Accordion/Accordion.tsx +98 -0
  8. package/src/components/Alert/Alert.css +129 -0
  9. package/src/components/Alert/Alert.stories.tsx +291 -0
  10. package/src/components/Alert/Alert.tsx +76 -0
  11. package/src/components/BackLink/BackLink.css +12 -0
  12. package/src/components/BackLink/BackLink.stories.tsx +52 -0
  13. package/src/components/BackLink/BackLink.tsx +44 -0
  14. package/src/components/BackToTop/BackToTop.css +23 -0
  15. package/src/components/BackToTop/BackToTop.stories.tsx +41 -0
  16. package/src/components/BackToTop/BackToTop.tsx +48 -0
  17. package/src/components/Breadcrumb/Breadcrumb.css +42 -0
  18. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +94 -0
  19. package/src/components/Breadcrumb/Breadcrumb.tsx +135 -0
  20. package/src/components/Button/Button.css +229 -0
  21. package/src/components/Button/Button.stories.tsx +140 -20
  22. package/src/components/Button/Button.tsx +53 -28
  23. package/src/components/Button/ButtonSkeleton.stories.tsx +50 -0
  24. package/src/components/Button/ButtonSkeleton.tsx +14 -0
  25. package/src/components/ButtonGroup/ButtonGroup.css +52 -0
  26. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +156 -0
  27. package/src/components/ButtonGroup/ButtonGroup.tsx +50 -0
  28. package/src/components/ButtonLink/ButtonLink.css +114 -0
  29. package/src/components/ButtonLink/ButtonLink.stories.tsx +38 -51
  30. package/src/components/ButtonLink/ButtonLink.tsx +54 -23
  31. package/src/components/Card/Card.css +13 -0
  32. package/src/components/Card/Card.stories.tsx +98 -57
  33. package/src/components/Card/Card.tsx +4 -13
  34. package/src/components/CardGroup/CardGroup.css +10 -0
  35. package/src/components/CardGroup/CardGroup.stories.tsx +81 -0
  36. package/src/components/CardGroup/CardGroup.tsx +9 -0
  37. package/src/components/Checkbox/Checkbox.css +49 -0
  38. package/src/components/Checkbox/Checkbox.stories.tsx +86 -0
  39. package/src/components/Checkbox/Checkbox.tsx +32 -0
  40. package/src/components/Chip/Chip.css +54 -0
  41. package/src/components/Chip/Chip.stories.tsx +94 -0
  42. package/src/components/Chip/Chip.tsx +34 -0
  43. package/src/components/CookieBanner/CookieBanner.css +19 -0
  44. package/src/components/CookieBanner/CookieBanner.stories.tsx +52 -0
  45. package/src/components/CookieBanner/CookieBanner.tsx +55 -0
  46. package/src/components/CopyButton/CopyButton.stories.tsx +28 -0
  47. package/src/components/CopyButton/CopyButton.tsx +65 -0
  48. package/src/components/DateInput/DateInput.css +13 -0
  49. package/src/components/DateInput/DateInput.stories.tsx +131 -0
  50. package/src/components/DateInput/DateInput.test.tsx +21 -0
  51. package/src/components/DateInput/DateInput.tsx +98 -0
  52. package/src/components/Details/Details.css +28 -0
  53. package/src/components/Details/Details.stories.tsx +48 -0
  54. package/src/components/Details/Details.tsx +41 -0
  55. package/src/components/Dropdown/Dropdown.css +81 -0
  56. package/src/components/Dropdown/Dropdown.stories.tsx +131 -0
  57. package/src/components/Dropdown/Dropdown.tsx +69 -0
  58. package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +4 -39
  59. package/src/components/ErrorBoundary/ErrorBoundary.tsx +7 -4
  60. package/src/components/ErrorBoundary/ErrorFallback.tsx +32 -66
  61. package/src/components/ErrorModal/ErrorModal.css +32 -0
  62. package/src/components/ErrorModal/ErrorModal.stories.tsx +101 -0
  63. package/src/components/ErrorModal/ErrorModal.tsx +120 -0
  64. package/src/components/ErrorText/ErrorText.css +22 -0
  65. package/src/components/ErrorText/ErrorText.stories.tsx +42 -27
  66. package/src/components/ErrorText/ErrorText.tsx +10 -8
  67. package/src/components/ExternalLink/ExternalLink.css +12 -0
  68. package/src/components/ExternalLink/ExternalLink.stories.tsx +43 -0
  69. package/src/components/ExternalLink/ExternalLink.tsx +43 -0
  70. package/src/components/Fieldset/Fieldset.css +103 -0
  71. package/src/components/Fieldset/Fieldset.stories.tsx +304 -0
  72. package/src/components/Fieldset/Fieldset.tsx +38 -0
  73. package/src/components/FileUpload/FileUpload.css +85 -0
  74. package/src/components/FileUpload/FileUpload.stories.tsx +106 -0
  75. package/src/components/FileUpload/FileUpload.tsx +99 -0
  76. package/src/components/{layout/footer → Footer}/Copyright.tsx +4 -2
  77. package/src/components/Footer/Footer.stories.tsx +24 -0
  78. package/src/components/Footer/Footer.tsx +41 -0
  79. package/src/components/Footer/Licence.tsx +18 -0
  80. package/src/components/{layout/footer → Footer}/MetaLinks.tsx +8 -3
  81. package/src/components/Footer/Small/SmallFooter.tsx +43 -42
  82. package/src/components/Form/FormGroup.css +18 -0
  83. package/src/components/Form/FormGroup.stories.tsx +87 -0
  84. package/src/components/Form/FormGroup.tsx +16 -0
  85. package/src/components/{layout/header → Header}/Header.stories.tsx +26 -12
  86. package/src/components/Header/Header.test.tsx +87 -0
  87. package/src/components/Header/Header.tsx +303 -0
  88. package/src/components/Header/HeaderAppContent.tsx +120 -0
  89. package/src/components/Heading/Heading.css +40 -0
  90. package/src/components/Heading/Heading.stories.tsx +15 -5
  91. package/src/components/Heading/Heading.tsx +21 -44
  92. package/src/components/Heading/HeadingSkeleton.stories.tsx +30 -0
  93. package/src/components/Heading/HeadingSkeleton.tsx +14 -0
  94. package/src/components/Hero/Hero.css +19 -0
  95. package/src/components/Hero/Hero.stories.tsx +41 -0
  96. package/src/components/Hero/Hero.tsx +14 -0
  97. package/src/components/HintText/HintText.css +5 -0
  98. package/src/components/HintText/HintText.stories.tsx +29 -0
  99. package/src/components/HintText/HintText.tsx +13 -0
  100. package/src/components/InfoBox/InfoBox.css +38 -0
  101. package/src/components/InfoBox/InfoBox.stories.tsx +51 -403
  102. package/src/components/InfoBox/InfoBox.tsx +31 -158
  103. package/src/components/Input/Input.css +77 -0
  104. package/src/components/Input/Input.stories.tsx +123 -0
  105. package/src/components/Input/Input.tsx +74 -0
  106. package/src/components/InputGroup/InputGroup.css +140 -0
  107. package/src/components/InputGroup/InputGroup.stories.tsx +125 -0
  108. package/src/components/InputGroup/InputGroup.tsx +47 -0
  109. package/src/components/InsetText/InsetText.css +5 -0
  110. package/src/components/InsetText/InsetText.stories.tsx +30 -0
  111. package/src/components/InsetText/InsetText.tsx +9 -0
  112. package/src/components/Keyboard/Keyboard.css +9 -0
  113. package/src/components/Keyboard/Keyboard.stories.tsx +63 -0
  114. package/src/components/Keyboard/Keyboard.tsx +30 -0
  115. package/src/components/Label/Label.css +27 -0
  116. package/src/components/Label/Label.stories.tsx +40 -0
  117. package/src/components/Label/Label.tsx +17 -0
  118. package/src/components/LayerSwitcher/LayerSwitcher.css +59 -0
  119. package/src/components/LayerSwitcher/LayerSwitcher.stories.tsx +112 -0
  120. package/src/components/LayerSwitcher/LayerSwitcher.tsx +61 -0
  121. package/src/components/Layout/401/401.stories.tsx +23 -0
  122. package/src/components/Layout/401/401.tsx +1 -0
  123. package/src/components/Layout/403/403.stories.tsx +23 -0
  124. package/src/components/Layout/403/403.tsx +21 -0
  125. package/src/components/Layout/404/404.stories.tsx +23 -0
  126. package/src/components/Layout/404/404.tsx +28 -0
  127. package/src/components/Layout/500/500.stories.tsx +56 -0
  128. package/src/components/Layout/500/500.tsx +63 -0
  129. package/src/components/Layout/ButtonGroup/ButtonGroup.css +52 -0
  130. package/src/components/Layout/ButtonGroup/ButtonGroup.stories.tsx +156 -0
  131. package/src/components/Layout/ButtonGroup/ButtonGroup.tsx +50 -0
  132. package/src/components/Layout/HeadingGroup/HeadingGroup.css +21 -0
  133. package/src/components/Layout/HeadingGroup/HeadingGroup.stories.tsx +84 -0
  134. package/src/components/Layout/HeadingGroup/HeadingGroup.tsx +9 -0
  135. package/src/components/Layout/MainWrapper/MainWrapper.css +12 -0
  136. package/src/components/Layout/MainWrapper/MainWrapper.stories.tsx +36 -0
  137. package/src/components/Layout/MainWrapper/MainWrapper.tsx +14 -0
  138. package/src/components/Layout/PageShell/PageShell.css +42 -0
  139. package/src/components/Layout/PageShell/PageShell.stories.tsx +108 -0
  140. package/src/components/Layout/PageShell/PageShell.tsx +31 -0
  141. package/src/components/Layout/ParagraphGroup/ParagraphGroup.css +5 -0
  142. package/src/components/Layout/ParagraphGroup/ParagraphGroup.stories.tsx +34 -0
  143. package/src/components/Layout/ParagraphGroup/ParagraphGroup.tsx +9 -0
  144. package/src/components/Layout/Stack/Stack.css +29 -0
  145. package/src/components/Layout/Stack/Stack.stories.tsx +83 -0
  146. package/src/components/Layout/Stack/Stack.tsx +19 -0
  147. package/src/components/Layout/WidthContainer/WidthContainer.css +17 -0
  148. package/src/components/Layout/WidthContainer/WidthContainer.stories.tsx +59 -0
  149. package/src/components/Layout/WidthContainer/WidthContainer.tsx +13 -0
  150. package/src/components/Legend/Legend.css +95 -0
  151. package/src/components/Legend/Legend.stories.tsx +81 -0
  152. package/src/components/Legend/Legend.tsx +32 -0
  153. package/src/components/Legend/LegendDot.tsx +15 -0
  154. package/src/components/Legend/LegendPanel.stories.tsx +101 -0
  155. package/src/components/Legend/LegendPanel.tsx +68 -0
  156. package/src/components/Legend/LegendSkeleton.stories.tsx +87 -0
  157. package/src/components/Legend/LegendSkeleton.tsx +73 -0
  158. package/src/components/LegendSelect/LegendSelect.css +8 -0
  159. package/src/components/LegendSelect/LegendSelect.stories.tsx +80 -0
  160. package/src/components/LegendSelect/LegendSelect.tsx +26 -0
  161. package/src/components/Link/Link.css +98 -0
  162. package/src/components/Link/Link.stories.tsx +70 -0
  163. package/src/components/Link/Link.tsx +52 -0
  164. package/src/components/LinkButton/LinkButton.css +67 -0
  165. package/src/components/LinkButton/LinkButton.stories.tsx +90 -42
  166. package/src/components/LinkButton/LinkButton.tsx +50 -63
  167. package/src/components/LinkList/LinkList.css +28 -0
  168. package/src/components/LinkList/LinkList.stories.tsx +46 -0
  169. package/src/components/LinkList/LinkList.tsx +23 -0
  170. package/src/components/List/Li.tsx +9 -0
  171. package/src/components/List/List.css +9 -0
  172. package/src/components/List/OrderedList.stories.tsx +36 -0
  173. package/src/components/List/OrderedList.tsx +9 -0
  174. package/src/components/List/UnorderedList.stories.tsx +36 -0
  175. package/src/components/List/UnorderedList.tsx +9 -0
  176. package/src/components/LoadingBox/LoadingBox.css +27 -0
  177. package/src/components/LoadingBox/LoadingBox.stories.tsx +66 -0
  178. package/src/components/LoadingBox/LoadingBox.tsx +40 -0
  179. package/src/components/Modal/Modal.css +114 -0
  180. package/src/components/Modal/Modal.stories.tsx +41 -160
  181. package/src/components/Modal/Modal.tsx +132 -75
  182. package/src/components/NoScriptBanner/NoScriptBanner.css +17 -0
  183. package/src/components/NoScriptBanner/NoScriptBanner.stories.tsx +46 -0
  184. package/src/components/NoScriptBanner/NoScriptBanner.tsx +26 -0
  185. package/src/components/Paragraph/Paragraph.css +22 -0
  186. package/src/components/Paragraph/Paragraph.stories.tsx +1 -42
  187. package/src/components/Paragraph/Paragraph.tsx +4 -3
  188. package/src/components/Paragraph/ParagraphSkeleton.stories.tsx +44 -0
  189. package/src/components/Paragraph/ParagraphSkeleton.tsx +33 -0
  190. package/src/components/PasswordInput/PasswordInput.css +3 -0
  191. package/src/components/PasswordInput/PasswordInput.stories.tsx +47 -0
  192. package/src/components/PasswordInput/PasswordInput.tsx +45 -0
  193. package/src/components/PhaseBanner/PhaseBanner.css +12 -0
  194. package/src/components/PhaseBanner/PhaseBanner.stories.tsx +61 -0
  195. package/src/components/PhaseBanner/PhaseBanner.tsx +17 -0
  196. package/src/components/Popover/Popover.css +43 -0
  197. package/src/components/Popover/Popover.stories.tsx +102 -0
  198. package/src/components/Popover/Popover.tsx +40 -0
  199. package/src/components/Radio/Radio.css +69 -0
  200. package/src/components/Radio/Radio.stories.tsx +169 -0
  201. package/src/components/Radio/Radio.tsx +56 -0
  202. package/src/components/Resizable/Resizable.css +86 -0
  203. package/src/components/Resizable/Resizable.stories.tsx +123 -0
  204. package/src/components/Resizable/Resizable.tsx +86 -0
  205. package/src/components/ScrollArea/ScrollArea.css +9 -0
  206. package/src/components/ScrollArea/ScrollArea.stories.tsx +42 -0
  207. package/src/components/ScrollArea/ScrollArea.tsx +11 -0
  208. package/src/components/SearchBox/SearchBox.stories.tsx +88 -0
  209. package/src/components/SearchBox/SearchBox.tsx +36 -0
  210. package/src/components/Select/AsyncSelect.stories.tsx +84 -0
  211. package/src/components/Select/AsyncSelect.tsx +41 -0
  212. package/src/components/Select/Select.css +194 -0
  213. package/src/components/Select/Select.stories.tsx +162 -0
  214. package/src/components/Select/Select.test.tsx +36 -0
  215. package/src/components/Select/Select.tsx +291 -0
  216. package/src/components/Select/SelectSkeleton.stories.tsx +51 -0
  217. package/src/components/Select/SelectSkeleton.tsx +23 -0
  218. package/src/components/Separator/Separator.css +41 -0
  219. package/src/components/Separator/Separator.stories.tsx +63 -0
  220. package/src/components/Separator/Separator.tsx +42 -0
  221. package/src/components/Sidebar/ResizableSidebar.tsx +118 -0
  222. package/src/components/Sidebar/Sidebar.css +203 -0
  223. package/src/components/Sidebar/Sidebar.stories.tsx +438 -0
  224. package/src/components/Sidebar/Sidebar.tsx +225 -0
  225. package/src/components/Skeleton/Skeleton.css +16 -0
  226. package/src/components/Skeleton/Skeleton.stories.tsx +39 -0
  227. package/src/components/Skeleton/Skeleton.tsx +12 -0
  228. package/src/components/SkipLink/SkipLink.css +16 -0
  229. package/src/components/SkipLink/SkipLink.stories.tsx +40 -0
  230. package/src/components/SkipLink/SkipLink.tsx +15 -0
  231. package/src/components/Spinner/Spinner.css +30 -0
  232. package/src/components/Spinner/Spinner.stories.tsx +36 -0
  233. package/src/components/Spinner/Spinner.tsx +45 -0
  234. package/src/components/StartButton/StartButton.css +13 -0
  235. package/src/components/StartButton/StartButton.stories.tsx +68 -0
  236. package/src/components/StartButton/StartButton.tsx +50 -0
  237. package/src/components/SubmitButton/SubmitButton.stories.tsx +31 -0
  238. package/src/components/SubmitButton/SubmitButton.tsx +14 -0
  239. package/src/components/SummaryList/SummaryList.css +71 -0
  240. package/src/components/SummaryList/SummaryList.stories.tsx +211 -0
  241. package/src/components/SummaryList/SummaryList.tsx +41 -0
  242. package/src/components/SummaryList/SummaryListSkeleton.stories.tsx +67 -0
  243. package/src/components/SummaryList/SummaryListSkeleton.tsx +40 -0
  244. package/src/components/Tabs/Tabs.css +84 -0
  245. package/src/components/Tabs/Tabs.stories.tsx +133 -0
  246. package/src/components/Tabs/Tabs.tsx +66 -0
  247. package/src/components/Tag/Tag.css +8 -0
  248. package/src/components/Tag/Tag.stories.tsx +96 -0
  249. package/src/components/Tag/Tag.tsx +34 -0
  250. package/src/components/Textarea/Textarea.css +38 -0
  251. package/src/components/Textarea/Textarea.stories.tsx +131 -0
  252. package/src/components/Textarea/Textarea.tsx +50 -0
  253. package/src/components/TextareaCount/TextareaCount.css +17 -0
  254. package/src/components/TextareaCount/TextareaCount.stories.tsx +131 -0
  255. package/src/components/TextareaCount/TextareaCount.tsx +108 -0
  256. package/src/components/Tooltip/Tooltip.css +43 -0
  257. package/src/components/Tooltip/Tooltip.stories.tsx +110 -0
  258. package/src/components/Tooltip/Tooltip.tsx +53 -0
  259. package/src/components/WarningText/WarningText.css +20 -0
  260. package/src/components/WarningText/WarningText.stories.tsx +29 -0
  261. package/src/components/WarningText/WarningText.tsx +17 -0
  262. package/src/components/index.ts +342 -61
  263. package/src/errors/errorDisplay.ts +70 -0
  264. package/src/errors/index.ts +1 -0
  265. package/src/http/constants.ts +1 -0
  266. package/src/http/fetch.ts +7 -3
  267. package/src/map/LayerSwitcherPanel.tsx +2 -173
  268. package/src/map/LegendShim.tsx +2 -0
  269. package/src/map/MapComponent.tsx +7 -17
  270. package/src/map/MapControlsOverlay.tsx +68 -175
  271. package/src/map/Popup.tsx +71 -24
  272. package/src/map/geocoder/Geocoder.test.tsx +46 -3
  273. package/src/map/geocoder/Geocoder.tsx +155 -278
  274. package/src/map/index.ts +1 -1
  275. package/src/types/utils.ts +0 -10
  276. package/src/utils/components.ts +96 -0
  277. package/src/utils/index.ts +1 -0
  278. package/src/utils/utils.ts +0 -12
  279. package/src/assets/images/defra-logo.svg +0 -51
  280. package/src/assets/images/ea-logo.svg +0 -58
  281. package/src/assets/images/ogl.svg +0 -1
  282. package/src/components/Button/Button.test.tsx +0 -53
  283. package/src/components/ButtonLink/ButtonLink.test.tsx +0 -154
  284. package/src/components/Card/Card.test.tsx +0 -51
  285. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +0 -75
  286. package/src/components/ErrorBoundary/ErrorFallback.test.tsx +0 -107
  287. package/src/components/ErrorText/ErrorText.test.tsx +0 -33
  288. package/src/components/Heading/Heading.test.tsx +0 -22
  289. package/src/components/Hint/Hint.stories.tsx +0 -58
  290. package/src/components/Hint/Hint.test.tsx +0 -33
  291. package/src/components/Hint/Hint.tsx +0 -12
  292. package/src/components/InfoBox/InfoBox.test.tsx +0 -330
  293. package/src/components/InfoBox/types.ts +0 -6
  294. package/src/components/LinkButton/LinkButton.test.tsx +0 -177
  295. package/src/components/Modal/Modal.test.tsx +0 -246
  296. package/src/components/NotificationBanner/NotificationBanner.stories.tsx +0 -45
  297. package/src/components/NotificationBanner/NotificationBanner.test.tsx +0 -58
  298. package/src/components/NotificationBanner/NotificationBanner.tsx +0 -45
  299. package/src/components/Paragraph/Paragraph.test.tsx +0 -10
  300. package/src/components/SlidingPanel/SlidingPanel.stories.tsx +0 -129
  301. package/src/components/SlidingPanel/SlidingPanel.test.tsx +0 -83
  302. package/src/components/SlidingPanel/SlidingPanel.tsx +0 -258
  303. package/src/components/accordion/Accordion.stories.tsx +0 -234
  304. package/src/components/accordion/Accordion.test.tsx +0 -192
  305. package/src/components/accordion/Accordion.tsx +0 -73
  306. package/src/components/backToTop/BackToTop.stories.tsx +0 -407
  307. package/src/components/backToTop/BackToTop.test.tsx +0 -57
  308. package/src/components/backToTop/BackToTop.tsx +0 -134
  309. package/src/components/chip/Chip.stories.tsx +0 -61
  310. package/src/components/chip/Chip.test.tsx +0 -31
  311. package/src/components/chip/Chip.tsx +0 -23
  312. package/src/components/container/Container.tsx +0 -42
  313. package/src/components/cookieBanner/CookieBanner.stories.tsx +0 -257
  314. package/src/components/cookieBanner/CookieBanner.test.tsx +0 -68
  315. package/src/components/cookieBanner/CookieBanner.tsx +0 -73
  316. package/src/components/divider/RuleDivider.stories.tsx +0 -254
  317. package/src/components/divider/RuleDivider.test.tsx +0 -164
  318. package/src/components/divider/RuleDivider.tsx +0 -23
  319. package/src/components/dropdown/DropdownMenu.test.tsx +0 -211
  320. package/src/components/dropdown/DropdownMenu.tsx +0 -108
  321. package/src/components/dropdown/useDropdownMenu.ts +0 -249
  322. package/src/components/form/Input.stories.tsx +0 -435
  323. package/src/components/form/Input.test.tsx +0 -206
  324. package/src/components/form/Input.tsx +0 -23
  325. package/src/components/form/TextArea.stories.tsx +0 -464
  326. package/src/components/form/TextArea.test.tsx +0 -232
  327. package/src/components/form/TextArea.tsx +0 -23
  328. package/src/components/layout/footer/Footer.tsx +0 -26
  329. package/src/components/layout/footer/Licence.tsx +0 -19
  330. package/src/components/layout/header/Header.test.tsx +0 -36
  331. package/src/components/layout/header/Header.tsx +0 -90
  332. package/src/components/layout/header/HeaderAuthClient.test.tsx +0 -45
  333. package/src/components/layout/header/HeaderAuthClient.tsx +0 -40
  334. package/src/components/layout/header/HeaderNavClient.test.tsx +0 -44
  335. package/src/components/layout/header/HeaderNavClient.tsx +0 -67
  336. package/src/components/link/ExternalLink.test.tsx +0 -102
  337. package/src/components/link/ExternalLink.tsx +0 -29
  338. package/src/components/link/Link.tsx +0 -26
  339. package/src/components/select/Select.stories.tsx +0 -336
  340. package/src/components/select/Select.test.tsx +0 -474
  341. package/src/components/select/Select.tsx +0 -125
  342. package/src/components/select/SelectSkeleton.stories.tsx +0 -194
  343. package/src/components/select/SelectSkeleton.test.tsx +0 -104
  344. package/src/components/select/SelectSkeleton.tsx +0 -23
  345. package/src/components/select/common.ts +0 -3
  346. package/src/components/select/index.ts +0 -18
  347. package/src/components/skipLink/SkipLink.stories.tsx +0 -346
  348. package/src/components/skipLink/SkipLink.test.tsx +0 -22
  349. package/src/components/skipLink/SkipLink.tsx +0 -49
  350. package/src/map/LegendPanel.tsx +0 -85
  351. /package/src/{components → assets}/images/DefraLogo.tsx +0 -0
  352. /package/src/{components → assets}/images/EaLogo.tsx +0 -0
  353. /package/src/{components → assets}/images/OglLogo.tsx +0 -0
  354. /package/src/components/{googleAnalytics → GoogleAnalytics}/GlobalVars.tsx +0 -0
  355. /package/src/components/{googleAnalytics → GoogleAnalytics}/GoogleAnalytics.tsx +0 -0
@@ -1,57 +0,0 @@
1
- import { BackToTop } from './BackToTop';
2
- import { render, screen, userEvent } from '../../test/renderers';
3
-
4
- describe('BackToTop component', () => {
5
- const originalScrollTo = window.scrollTo;
6
-
7
- beforeEach(() => {
8
- Object.defineProperty(window, 'scrollTo', {
9
- value: vi.fn(),
10
- writable: true,
11
- });
12
-
13
- // Simulate scrollY (more modern than pageYOffset)
14
- Object.defineProperty(window, 'pageYOffset', {
15
- get: () => 700,
16
- configurable: true,
17
- });
18
-
19
- Object.defineProperty(window, 'scrollY', {
20
- get: () => 700,
21
- configurable: true,
22
- });
23
- });
24
-
25
- afterEach(() => {
26
- vi.clearAllMocks();
27
- window.scrollTo = originalScrollTo;
28
- });
29
-
30
- it('renders correctly when scrolled down', async () => {
31
- render(<BackToTop />);
32
-
33
- // Trigger the scroll event manually to call toggleVisibility
34
- window.dispatchEvent(new Event('scroll'));
35
-
36
- // Wait for the component to update
37
- const button = await screen.findByRole('button', { name: /back to top/i });
38
-
39
- expect(button).toBeInTheDocument();
40
- });
41
-
42
- it('clickable and triggers scrollToTop', async () => {
43
- const user = userEvent.setup();
44
-
45
- render(<BackToTop />);
46
-
47
- // Trigger the scroll event manually to call toggleVisibility
48
- window.dispatchEvent(new Event('scroll'));
49
-
50
- // Wait for the component to update and find the button
51
- const button = await screen.findByRole('button', { name: /back to top/i });
52
-
53
- await user.click(button);
54
-
55
- expect(window.scrollTo).toHaveBeenCalledWith({ top: 0, behavior: 'smooth' });
56
- });
57
- });
@@ -1,134 +0,0 @@
1
- 'use client';
2
-
3
- import { type KeyboardEvent, useCallback, useEffect, useState } from 'react';
4
-
5
- import { LuArrowUp } from 'react-icons/lu';
6
-
7
- import type { ExtendProps } from '../../types';
8
- import { cn, KeyboardKeys } from '../../utils';
9
-
10
- type Props = {
11
- /** Scroll threshold in pixels before button appears */
12
- threshold?: number;
13
- /** Position from bottom in pixels */
14
- bottom?: number;
15
- /** Position from left in pixels */
16
- left?: number;
17
- /** Explicitly disallow children as we hard-code the button content */
18
- children?: never;
19
- };
20
-
21
- export type BackToTopProps = ExtendProps<'button', Props>;
22
-
23
- export const BackToTop = ({
24
- threshold = 600,
25
- bottom = 16,
26
- left = 8,
27
- className,
28
- ...props
29
- }: BackToTopProps) => {
30
- const [isVisible, setIsVisible] = useState(false);
31
-
32
- // Throttle scroll events for better performance
33
- const throttle = useCallback((func: () => void, delay: number) => {
34
- let timeoutId: number | null = null;
35
- let lastExecTime = 0;
36
-
37
- return () => {
38
- const currentTime = Date.now();
39
-
40
- if (currentTime - lastExecTime > delay) {
41
- func();
42
- lastExecTime = currentTime;
43
- } else {
44
- if (timeoutId) {
45
- clearTimeout(timeoutId);
46
- }
47
-
48
- timeoutId = window.setTimeout(
49
- () => {
50
- func();
51
- lastExecTime = Date.now();
52
- },
53
- delay - (currentTime - lastExecTime),
54
- );
55
- }
56
- };
57
- }, []);
58
-
59
- // Show button when page is scrolled down
60
- const toggleVisibility = useCallback(() => {
61
- if (typeof window !== 'undefined') {
62
- setIsVisible(window.pageYOffset > threshold);
63
- }
64
- }, [threshold]);
65
-
66
- // Scroll to top smoothly
67
- const scrollToTop = useCallback(() => {
68
- if (typeof window !== 'undefined') {
69
- window.scrollTo({
70
- top: 0,
71
- behavior: 'smooth',
72
- });
73
- }
74
- }, []);
75
-
76
- useEffect(() => {
77
- if (typeof window === 'undefined') {
78
- return;
79
- }
80
-
81
- const throttledToggleVisibility = throttle(toggleVisibility, 100);
82
-
83
- // Check initial scroll position
84
- toggleVisibility();
85
-
86
- window.addEventListener('scroll', throttledToggleVisibility, { passive: true });
87
-
88
- return () => {
89
- window.removeEventListener('scroll', throttledToggleVisibility);
90
- };
91
- }, [toggleVisibility, throttle]);
92
-
93
- // Handle keyboard interaction
94
- const handleKeyDown = useCallback(
95
- (event: KeyboardEvent<HTMLButtonElement>) => {
96
- if (event.key === KeyboardKeys.Enter || event.key === KeyboardKeys.Space) {
97
- event.preventDefault();
98
- scrollToTop();
99
- }
100
- },
101
- [scrollToTop],
102
- );
103
-
104
- if (!isVisible) {
105
- return <></>;
106
- }
107
-
108
- return (
109
- <button
110
- type="button"
111
- className={cn(
112
- `fixed z-50 inline-flex items-center gap-1 bg-white text-link border border-gray-300
113
- rounded-md px-3 py-2 shadow-lg hover:bg-gray-50 focus:outline-none focus:ring-2
114
- focus:ring-blue-500 focus:ring-offset-2 transition-all duration-200 ease-in-out`,
115
- className,
116
- )}
117
- style={{
118
- bottom: `${bottom}px`,
119
- left: `${left}px`,
120
- }}
121
- onClick={scrollToTop}
122
- onKeyDown={handleKeyDown}
123
- aria-label="Scroll back to top of page"
124
- title="Back to top"
125
- {...props}
126
- >
127
- <LuArrowUp size={20} aria-hidden="true" />
128
-
129
- <span className="hidden sm:inline">Back to top</span>
130
-
131
- <span className="sr-only sm:hidden">Back to top</span>
132
- </button>
133
- );
134
- };
@@ -1,61 +0,0 @@
1
- import { AiFillChrome } from 'react-icons/ai';
2
-
3
- import type { Meta, StoryObj } from '@storybook/react-vite';
4
-
5
- import { Chip } from './Chip';
6
- import { Paragraph } from '../Paragraph/Paragraph';
7
-
8
- const meta: Meta<typeof Chip> = {
9
- title: 'Components/Chip',
10
- component: Chip,
11
- parameters: {
12
- layout: 'padded',
13
- },
14
- tags: ['autodocs'],
15
- argTypes: {
16
- children: {
17
- description: 'Content of the chip',
18
- control: false,
19
- },
20
- className: {
21
- description: 'Additional TailwindCSS classes to apply',
22
- control: 'text',
23
- },
24
- },
25
- args: {
26
- children: 'Hello, this is some simple Chip',
27
- },
28
- };
29
-
30
- export default meta;
31
-
32
- type Story = StoryObj<typeof Chip>;
33
-
34
- export const Default: Story = {};
35
-
36
- export const ParagraphOfText: Story = {
37
- args: {
38
- children: <Paragraph className="pb-0">Hello, this is a paragraph of text</Paragraph>,
39
- },
40
- };
41
-
42
- export const TextWithIcon: Story = {
43
- args: {
44
- children: (
45
- <div className="flex items-center justify-center gap-2">
46
- <AiFillChrome className="text-base" />
47
-
48
- <Paragraph className="pb-0">
49
- Hello, this is a Chip container with a paragraph of text
50
- </Paragraph>
51
- </div>
52
- ),
53
- },
54
- };
55
-
56
- export const CustomStyling: Story = {
57
- args: {
58
- className: 'bg-blue-100 text-blue-800 px-4 py-2 rounded-full',
59
- children: 'Custom styled chip',
60
- },
61
- };
@@ -1,31 +0,0 @@
1
- import { Chip } from './Chip';
2
- import { render, screen } from '../../test/renderers';
3
-
4
- describe('Chip component', () => {
5
- it('should render children correctly', () => {
6
- render(
7
- <Chip>
8
- <p>Hello, World!</p>
9
- </Chip>,
10
- );
11
-
12
- expect(screen.getByText('Hello, World!')).toBeInTheDocument();
13
- });
14
-
15
- it('should merge custom className correctly', () => {
16
- render(<Chip className="bg-red-500 rounded-lg">Custom</Chip>);
17
- const element = screen.getByText('Custom');
18
-
19
- expect(element).toHaveClass('bg-red-500');
20
- expect(element).toHaveClass('rounded-lg');
21
- });
22
-
23
- it('should override conflicting className using twMerge', () => {
24
- render(<Chip className="px-2">Custom</Chip>);
25
- const element = screen.getByText('Custom');
26
-
27
- // Should NOT have original 'pt-[12px]' due to twMerge override
28
- expect(element?.className).not.toMatch(/px-3/);
29
- expect(element).toHaveClass('px-2');
30
- });
31
- });
@@ -1,23 +0,0 @@
1
- import type { ExtendProps } from '../../types';
2
- import { cn } from '../../utils';
3
-
4
- type Props = {
5
- children: React.ReactNode;
6
- };
7
-
8
- export type ChipProps = ExtendProps<'span', Props>;
9
-
10
- export const Chip = ({ className, children, ...props }: ChipProps) => {
11
- return (
12
- <span
13
- className={cn(
14
- `inline-flex items-center rounded-lg bg-gray-200 px-3 py-1 text-sm font-medium
15
- text-gray-800`,
16
- className,
17
- )}
18
- {...props}
19
- >
20
- {children}
21
- </span>
22
- );
23
- };
@@ -1,42 +0,0 @@
1
- import type { ReactNode } from 'react';
2
-
3
- import type { ExtendProps } from '../../types';
4
- import { cn } from '../../utils';
5
-
6
- type Props = {
7
- children: ReactNode;
8
- size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
9
- centerContent?: boolean;
10
- };
11
-
12
- export type ContainerProps = ExtendProps<'div', Props>;
13
-
14
- const containerSizes = {
15
- sm: 'max-w-3xl',
16
- md: 'max-w-5xl',
17
- lg: 'max-w-7xl',
18
- xl: 'max-w-screen-2xl',
19
- full: 'max-w-none',
20
- };
21
-
22
- export const Container = ({
23
- children,
24
- className,
25
- size = 'lg',
26
- centerContent = false,
27
- ...props
28
- }: ContainerProps) => {
29
- return (
30
- <div
31
- className={cn(
32
- 'mx-auto px-4 sm:px-6 lg:px-8',
33
- containerSizes[size],
34
- centerContent && 'flex items-center justify-center min-h-screen',
35
- className,
36
- )}
37
- {...props}
38
- >
39
- {children}
40
- </div>
41
- );
42
- };
@@ -1,257 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
-
3
- import { CookieBanner } from './CookieBanner';
4
-
5
- const meta = {
6
- title: 'Components/CookieBanner',
7
- component: CookieBanner,
8
- parameters: {
9
- layout: 'fullscreen',
10
- docs: {
11
- description: {
12
- component: 'Cookie banner component for displaying cookie consent options.',
13
- },
14
- },
15
- },
16
- tags: ['autodocs'],
17
- } satisfies Meta<typeof CookieBanner>;
18
-
19
- export default meta;
20
-
21
- type Story = StoryObj<typeof meta>;
22
-
23
- export const Default: Story = {
24
- parameters: {
25
- docs: {
26
- description: {
27
- story: 'Default cookie banner (hidden by default with inline style).',
28
- },
29
- },
30
- },
31
- };
32
-
33
- export const Visible: Story = {
34
- render: () => (
35
- <div>
36
- <style>
37
- {`
38
- #cookie-banner {
39
- display: block !important;
40
- }
41
- `}
42
- </style>
43
-
44
- <CookieBanner />
45
- </div>
46
- ),
47
- parameters: {
48
- docs: {
49
- description: {
50
- story: 'Cookie banner with visibility forced on for demonstration purposes.',
51
- },
52
- },
53
- },
54
- };
55
-
56
- export const VisibleWithBackground: Story = {
57
- render: () => (
58
- <div className="min-h-screen bg-gray-100">
59
- <CookieBanner />
60
-
61
- <div className="p-8">
62
- <h1 className="text-2xl font-bold mb-4">Sample Page Content</h1>
63
-
64
- <p className="mb-4">
65
- This demonstrates how the cookie banner would appear on a real page. The banner is
66
- positioned at the bottom of the screen.
67
- </p>
68
-
69
- <p className="mb-4">
70
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt
71
- ut labore et dolore magna aliqua.
72
- </p>
73
- </div>
74
- </div>
75
- ),
76
- parameters: {
77
- docs: {
78
- description: {
79
- story:
80
- 'Cookie banner shown in context with page content, positioned at the bottom of the screen.',
81
- },
82
- },
83
- },
84
- };
85
-
86
- export const InteractiveDemo: Story = {
87
- render: () => {
88
- const handleAcceptAll = () => {
89
- alert('All cookies accepted!');
90
- // In a real implementation, this would hide the banner
91
- const banner = document.getElementById('cookie-banner');
92
-
93
- if (banner) {
94
- banner.style.display = 'none';
95
- }
96
- };
97
-
98
- const handleRejectAdditional = () => {
99
- alert('Additional cookies rejected!');
100
- // In a real implementation, this would hide the banner
101
- const banner = document.getElementById('cookie-banner');
102
-
103
- if (banner) {
104
- banner.style.display = 'none';
105
- }
106
- };
107
-
108
- return (
109
- <div className="min-h-screen bg-gray-50">
110
- <style>
111
- {`
112
- #cookie-banner {
113
- display: block !important;
114
- background-color: white;
115
- border-top: 2px solid #1f2937;
116
- position: fixed;
117
- bottom: 0;
118
- left: 0;
119
- right: 0;
120
- z-index: 1000;
121
- box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
122
- }
123
- `}
124
- </style>
125
-
126
- <div className="p-8">
127
- <h1 className="text-3xl font-bold mb-6">Interactive Cookie Banner Demo</h1>
128
-
129
- <p className="mb-4 text-lg">
130
- Click either button on the cookie banner below to see the interaction.
131
- </p>
132
-
133
- <p className="mb-4">
134
- This story demonstrates the banner in a more realistic context with interactive
135
- behavior.
136
- </p>
137
-
138
- <div className="space-y-4">
139
- <p>Sample page content continues here...</p>
140
-
141
- <p>More content to show page scrolling behavior...</p>
142
-
143
- <p>The cookie banner remains fixed at the bottom.</p>
144
- </div>
145
- </div>
146
-
147
- <div id="cookie-banner" role="region" aria-label="cookie banner">
148
- <div className="mx-auto max-w-[960px] p-[1rem]">
149
- <h3 className="mb-4 text-base font-bold text-govukBlack">
150
- Tell us whether you accept cookies
151
- </h3>
152
-
153
- <p className="mb-4 text-sm text-black">
154
- We use essential cookies to give you the best online experience. Without them, this
155
- service will not work.
156
- </p>
157
-
158
- <p className="mb-4 text-sm text-black">
159
- We also use non-essential cookies to analyze site usage to continually improve the
160
- services we provide you with.
161
- </p>
162
-
163
- <p className="mb-4 text-sm text-black">
164
- Full details of cookies collected, and the functionality to change your cookie
165
- preference at any time can be accessed on our{' '}
166
- <a
167
- href="https://environment.data.gov.uk/help/cookies"
168
- className="text-blue-600 underline hover:text-blue-800"
169
- target="_blank"
170
- rel="noopener noreferrer"
171
- >
172
- Cookie Policy Page
173
- </a>
174
- .
175
- </p>
176
-
177
- <div className="grid grid-cols-1 gap-4 md:grid-cols-[1fr_1fr_1fr]">
178
- <div>
179
- <button
180
- className="focus:outline-3 relative box-border inline-block w-full cursor-pointer
181
- appearance-none rounded-none border-2 border-transparent bg-green-500 px-[10px]
182
- py-[7px] text-center align-top text-base font-normal leading-[19px] text-white
183
- antialiased shadow-[0_2px_0_#002413] focus:bg-green-600 hover:bg-green-600
184
- focus:outline focus:outline-offset-0 focus:outline-yellow-500"
185
- id="accept-all-cookies"
186
- type="button"
187
- onClick={handleAcceptAll}
188
- >
189
- Accept all cookies
190
- </button>
191
- </div>
192
-
193
- <div>
194
- <button
195
- className="focus:outline-3 relative box-border inline-block w-full cursor-pointer
196
- appearance-none rounded-none border-2 border-transparent bg-green-500 px-[10px]
197
- py-[7px] text-center align-top text-base font-normal leading-[19px] text-white
198
- antialiased shadow-[0_2px_0_#002413] focus:bg-green-600 hover:bg-green-600
199
- focus:outline focus:outline-offset-0 focus:outline-yellow-500"
200
- onClick={handleRejectAdditional}
201
- >
202
- Reject additional cookies
203
- </button>
204
- </div>
205
- </div>
206
- </div>
207
- </div>
208
- </div>
209
- );
210
- },
211
- parameters: {
212
- docs: {
213
- description: {
214
- story: 'Interactive version with working buttons that demonstrate the expected behavior.',
215
- },
216
- },
217
- },
218
- };
219
-
220
- export const MobileView: Story = {
221
- render: () => (
222
- <div className="max-w-sm mx-auto bg-gray-100 min-h-screen">
223
- <style>
224
- {`
225
- #cookie-banner {
226
- display: block !important;
227
- background-color: white;
228
- border-top: 1px solid #ccc;
229
- position: fixed;
230
- bottom: 0;
231
- left: 0;
232
- right: 0;
233
- z-index: 1000;
234
- }
235
- `}
236
- </style>
237
-
238
- <div className="p-4">
239
- <h1 className="text-xl font-bold mb-4">Mobile View</h1>
240
-
241
- <p className="mb-4 text-sm">This shows how the cookie banner appears on mobile devices.</p>
242
- </div>
243
-
244
- <CookieBanner />
245
- </div>
246
- ),
247
- parameters: {
248
- docs: {
249
- description: {
250
- story: 'Cookie banner optimized for mobile viewport to test responsive behavior.',
251
- },
252
- },
253
- viewport: {
254
- defaultViewport: 'mobile1',
255
- },
256
- },
257
- };
@@ -1,68 +0,0 @@
1
- import { CookieBanner } from './CookieBanner';
2
- import { render, screen, userEvent } from '../../test/renderers';
3
-
4
- const handlePush = vi.fn();
5
-
6
- vi.mock('next/navigation', () => ({
7
- useRouter: () => ({
8
- push: handlePush,
9
- }),
10
- }));
11
-
12
- describe('CookieBanner', () => {
13
- it('should render cookie banner content', () => {
14
- render(<CookieBanner />);
15
-
16
- expect(
17
- screen.getByRole('heading', {
18
- name: /tell us whether you accept cookies/i,
19
- hidden: true,
20
- }),
21
- ).toBeInTheDocument();
22
-
23
- expect(
24
- screen.getByText(/we use essential cookies to give you the best online experience/i),
25
- ).toBeInTheDocument();
26
-
27
- expect(
28
- screen.getByText(/we also use non-essential cookies to analyze site usage/i),
29
- ).toBeInTheDocument();
30
-
31
- expect(
32
- screen.getByText(
33
- /full details of cookies collected, and the functionality to change your cookie preference/i,
34
- ),
35
- ).toBeInTheDocument();
36
-
37
- expect(screen.getByRole('link', { name: /cookie policy page/i, hidden: true })).toHaveAttribute(
38
- 'href',
39
- 'https://environment.data.gov.uk/help/cookies',
40
- );
41
-
42
- expect(
43
- screen.getByRole('button', { name: /accept all cookies/i, hidden: true }),
44
- ).toBeInTheDocument();
45
-
46
- expect(
47
- screen.getByRole('button', {
48
- name: /reject additional cookies/i,
49
- hidden: true,
50
- }),
51
- ).toBeInTheDocument();
52
- });
53
-
54
- it('should navigate to cookie preference page on "Reject additional cookies" click', async () => {
55
- const user = userEvent.setup();
56
-
57
- render(<CookieBanner />);
58
-
59
- await user.click(
60
- screen.getByRole('button', {
61
- name: /reject additional cookies/i,
62
- hidden: true,
63
- }),
64
- );
65
-
66
- expect(handlePush).toHaveBeenCalled();
67
- });
68
- });