@tpzdsp/next-toolkit 2.5.1 → 3.1.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 (357) hide show
  1. package/package.json +21 -12
  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 +34 -0
  62. package/src/components/ErrorModal/ErrorModal.stories.tsx +100 -0
  63. package/src/components/ErrorModal/ErrorModal.tsx +123 -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 +3 -2
  77. package/src/components/Footer/Footer.stories.tsx +27 -0
  78. package/src/components/Footer/Footer.tsx +46 -0
  79. package/src/components/Footer/Licence.tsx +18 -0
  80. package/src/components/Footer/MetaLinks.tsx +47 -0
  81. package/src/components/Footer/Small/SmallFooter.stories.tsx +3 -0
  82. package/src/components/Footer/Small/SmallFooter.tsx +53 -41
  83. package/src/components/Form/FormGroup.css +18 -0
  84. package/src/components/Form/FormGroup.stories.tsx +87 -0
  85. package/src/components/Form/FormGroup.tsx +16 -0
  86. package/src/components/{layout/header → Header}/Header.stories.tsx +26 -12
  87. package/src/components/Header/Header.test.tsx +87 -0
  88. package/src/components/Header/Header.tsx +304 -0
  89. package/src/components/Header/HeaderAppContent.tsx +120 -0
  90. package/src/components/Heading/Heading.css +40 -0
  91. package/src/components/Heading/Heading.stories.tsx +15 -5
  92. package/src/components/Heading/Heading.tsx +21 -44
  93. package/src/components/Heading/HeadingSkeleton.stories.tsx +30 -0
  94. package/src/components/Heading/HeadingSkeleton.tsx +14 -0
  95. package/src/components/Hero/Hero.css +19 -0
  96. package/src/components/Hero/Hero.stories.tsx +41 -0
  97. package/src/components/Hero/Hero.tsx +14 -0
  98. package/src/components/HintText/HintText.css +5 -0
  99. package/src/components/HintText/HintText.stories.tsx +29 -0
  100. package/src/components/HintText/HintText.tsx +13 -0
  101. package/src/components/InfoBox/InfoBox.css +38 -0
  102. package/src/components/InfoBox/InfoBox.stories.tsx +51 -403
  103. package/src/components/InfoBox/InfoBox.tsx +31 -158
  104. package/src/components/Input/Input.css +77 -0
  105. package/src/components/Input/Input.stories.tsx +123 -0
  106. package/src/components/Input/Input.tsx +74 -0
  107. package/src/components/InputGroup/InputGroup.css +140 -0
  108. package/src/components/InputGroup/InputGroup.stories.tsx +125 -0
  109. package/src/components/InputGroup/InputGroup.tsx +47 -0
  110. package/src/components/InsetText/InsetText.css +5 -0
  111. package/src/components/InsetText/InsetText.stories.tsx +30 -0
  112. package/src/components/InsetText/InsetText.tsx +9 -0
  113. package/src/components/Keyboard/Keyboard.css +9 -0
  114. package/src/components/Keyboard/Keyboard.stories.tsx +63 -0
  115. package/src/components/Keyboard/Keyboard.tsx +30 -0
  116. package/src/components/Label/Label.css +27 -0
  117. package/src/components/Label/Label.stories.tsx +40 -0
  118. package/src/components/Label/Label.tsx +17 -0
  119. package/src/components/LayerSwitcher/LayerSwitcher.css +59 -0
  120. package/src/components/LayerSwitcher/LayerSwitcher.stories.tsx +112 -0
  121. package/src/components/LayerSwitcher/LayerSwitcher.tsx +61 -0
  122. package/src/components/Layout/401/401.stories.tsx +23 -0
  123. package/src/components/Layout/401/401.tsx +1 -0
  124. package/src/components/Layout/403/403.stories.tsx +23 -0
  125. package/src/components/Layout/403/403.tsx +21 -0
  126. package/src/components/Layout/404/404.stories.tsx +23 -0
  127. package/src/components/Layout/404/404.tsx +28 -0
  128. package/src/components/Layout/500/500.stories.tsx +56 -0
  129. package/src/components/Layout/500/500.tsx +63 -0
  130. package/src/components/Layout/ButtonGroup/ButtonGroup.css +52 -0
  131. package/src/components/Layout/ButtonGroup/ButtonGroup.stories.tsx +156 -0
  132. package/src/components/Layout/ButtonGroup/ButtonGroup.tsx +50 -0
  133. package/src/components/Layout/HeadingGroup/HeadingGroup.css +21 -0
  134. package/src/components/Layout/HeadingGroup/HeadingGroup.stories.tsx +84 -0
  135. package/src/components/Layout/HeadingGroup/HeadingGroup.tsx +9 -0
  136. package/src/components/Layout/MainWrapper/MainWrapper.css +12 -0
  137. package/src/components/Layout/MainWrapper/MainWrapper.stories.tsx +36 -0
  138. package/src/components/Layout/MainWrapper/MainWrapper.tsx +14 -0
  139. package/src/components/Layout/PageShell/PageShell.css +42 -0
  140. package/src/components/Layout/PageShell/PageShell.stories.tsx +108 -0
  141. package/src/components/Layout/PageShell/PageShell.tsx +31 -0
  142. package/src/components/Layout/ParagraphGroup/ParagraphGroup.css +5 -0
  143. package/src/components/Layout/ParagraphGroup/ParagraphGroup.stories.tsx +34 -0
  144. package/src/components/Layout/ParagraphGroup/ParagraphGroup.tsx +9 -0
  145. package/src/components/Layout/Stack/Stack.css +29 -0
  146. package/src/components/Layout/Stack/Stack.stories.tsx +83 -0
  147. package/src/components/Layout/Stack/Stack.tsx +19 -0
  148. package/src/components/Layout/WidthContainer/WidthContainer.css +17 -0
  149. package/src/components/Layout/WidthContainer/WidthContainer.stories.tsx +59 -0
  150. package/src/components/Layout/WidthContainer/WidthContainer.tsx +13 -0
  151. package/src/components/Legend/Legend.css +95 -0
  152. package/src/components/Legend/Legend.stories.tsx +81 -0
  153. package/src/components/Legend/Legend.tsx +32 -0
  154. package/src/components/Legend/LegendDot.tsx +15 -0
  155. package/src/components/Legend/LegendPanel.stories.tsx +101 -0
  156. package/src/components/Legend/LegendPanel.tsx +68 -0
  157. package/src/components/Legend/LegendSkeleton.stories.tsx +87 -0
  158. package/src/components/Legend/LegendSkeleton.tsx +73 -0
  159. package/src/components/LegendSelect/LegendSelect.css +8 -0
  160. package/src/components/LegendSelect/LegendSelect.stories.tsx +80 -0
  161. package/src/components/LegendSelect/LegendSelect.tsx +26 -0
  162. package/src/components/Link/Link.css +98 -0
  163. package/src/components/Link/Link.stories.tsx +70 -0
  164. package/src/components/Link/Link.tsx +52 -0
  165. package/src/components/LinkButton/LinkButton.css +67 -0
  166. package/src/components/LinkButton/LinkButton.stories.tsx +90 -42
  167. package/src/components/LinkButton/LinkButton.tsx +50 -63
  168. package/src/components/LinkList/LinkList.css +28 -0
  169. package/src/components/LinkList/LinkList.stories.tsx +46 -0
  170. package/src/components/LinkList/LinkList.tsx +23 -0
  171. package/src/components/List/Li.tsx +9 -0
  172. package/src/components/List/List.css +9 -0
  173. package/src/components/List/OrderedList.stories.tsx +36 -0
  174. package/src/components/List/OrderedList.tsx +9 -0
  175. package/src/components/List/UnorderedList.stories.tsx +36 -0
  176. package/src/components/List/UnorderedList.tsx +9 -0
  177. package/src/components/LoadingBox/LoadingBox.css +27 -0
  178. package/src/components/LoadingBox/LoadingBox.stories.tsx +66 -0
  179. package/src/components/LoadingBox/LoadingBox.tsx +40 -0
  180. package/src/components/Modal/Modal.css +111 -0
  181. package/src/components/Modal/Modal.stories.tsx +94 -155
  182. package/src/components/Modal/Modal.tsx +141 -75
  183. package/src/components/NoScriptBanner/NoScriptBanner.css +17 -0
  184. package/src/components/NoScriptBanner/NoScriptBanner.stories.tsx +46 -0
  185. package/src/components/NoScriptBanner/NoScriptBanner.tsx +26 -0
  186. package/src/components/Paragraph/Paragraph.css +22 -0
  187. package/src/components/Paragraph/Paragraph.stories.tsx +1 -42
  188. package/src/components/Paragraph/Paragraph.tsx +4 -3
  189. package/src/components/Paragraph/ParagraphSkeleton.stories.tsx +44 -0
  190. package/src/components/Paragraph/ParagraphSkeleton.tsx +33 -0
  191. package/src/components/PasswordInput/PasswordInput.css +3 -0
  192. package/src/components/PasswordInput/PasswordInput.stories.tsx +47 -0
  193. package/src/components/PasswordInput/PasswordInput.tsx +45 -0
  194. package/src/components/PhaseBanner/PhaseBanner.css +12 -0
  195. package/src/components/PhaseBanner/PhaseBanner.stories.tsx +61 -0
  196. package/src/components/PhaseBanner/PhaseBanner.tsx +17 -0
  197. package/src/components/Popover/Popover.css +43 -0
  198. package/src/components/Popover/Popover.stories.tsx +102 -0
  199. package/src/components/Popover/Popover.tsx +40 -0
  200. package/src/components/Radio/Radio.css +69 -0
  201. package/src/components/Radio/Radio.stories.tsx +169 -0
  202. package/src/components/Radio/Radio.tsx +56 -0
  203. package/src/components/Resizable/Resizable.css +86 -0
  204. package/src/components/Resizable/Resizable.stories.tsx +123 -0
  205. package/src/components/Resizable/Resizable.tsx +86 -0
  206. package/src/components/ScrollArea/ScrollArea.css +9 -0
  207. package/src/components/ScrollArea/ScrollArea.stories.tsx +42 -0
  208. package/src/components/ScrollArea/ScrollArea.tsx +11 -0
  209. package/src/components/SearchBox/SearchBox.stories.tsx +88 -0
  210. package/src/components/SearchBox/SearchBox.tsx +36 -0
  211. package/src/components/Select/AsyncSelect.stories.tsx +84 -0
  212. package/src/components/Select/AsyncSelect.tsx +41 -0
  213. package/src/components/Select/Select.css +202 -0
  214. package/src/components/Select/Select.stories.tsx +162 -0
  215. package/src/components/Select/Select.test.tsx +36 -0
  216. package/src/components/Select/Select.tsx +296 -0
  217. package/src/components/Select/SelectSkeleton.stories.tsx +51 -0
  218. package/src/components/Select/SelectSkeleton.tsx +23 -0
  219. package/src/components/Separator/Separator.css +41 -0
  220. package/src/components/Separator/Separator.stories.tsx +63 -0
  221. package/src/components/Separator/Separator.tsx +42 -0
  222. package/src/components/Sidebar/ResizableSidebar.tsx +118 -0
  223. package/src/components/Sidebar/Sidebar.css +203 -0
  224. package/src/components/Sidebar/Sidebar.stories.tsx +438 -0
  225. package/src/components/Sidebar/Sidebar.tsx +225 -0
  226. package/src/components/Skeleton/Skeleton.css +16 -0
  227. package/src/components/Skeleton/Skeleton.stories.tsx +39 -0
  228. package/src/components/Skeleton/Skeleton.tsx +12 -0
  229. package/src/components/SkipLink/SkipLink.css +16 -0
  230. package/src/components/SkipLink/SkipLink.stories.tsx +40 -0
  231. package/src/components/SkipLink/SkipLink.tsx +15 -0
  232. package/src/components/Spinner/Spinner.css +30 -0
  233. package/src/components/Spinner/Spinner.stories.tsx +36 -0
  234. package/src/components/Spinner/Spinner.tsx +45 -0
  235. package/src/components/StartButton/StartButton.css +13 -0
  236. package/src/components/StartButton/StartButton.stories.tsx +68 -0
  237. package/src/components/StartButton/StartButton.tsx +50 -0
  238. package/src/components/SubmitButton/SubmitButton.stories.tsx +31 -0
  239. package/src/components/SubmitButton/SubmitButton.tsx +14 -0
  240. package/src/components/SummaryList/SummaryList.css +71 -0
  241. package/src/components/SummaryList/SummaryList.stories.tsx +211 -0
  242. package/src/components/SummaryList/SummaryList.tsx +41 -0
  243. package/src/components/SummaryList/SummaryListSkeleton.stories.tsx +67 -0
  244. package/src/components/SummaryList/SummaryListSkeleton.tsx +40 -0
  245. package/src/components/Tabs/Tabs.css +84 -0
  246. package/src/components/Tabs/Tabs.stories.tsx +133 -0
  247. package/src/components/Tabs/Tabs.tsx +66 -0
  248. package/src/components/Tag/Tag.css +8 -0
  249. package/src/components/Tag/Tag.stories.tsx +96 -0
  250. package/src/components/Tag/Tag.tsx +34 -0
  251. package/src/components/Textarea/Textarea.css +38 -0
  252. package/src/components/Textarea/Textarea.stories.tsx +131 -0
  253. package/src/components/Textarea/Textarea.tsx +50 -0
  254. package/src/components/TextareaCount/TextareaCount.css +17 -0
  255. package/src/components/TextareaCount/TextareaCount.stories.tsx +131 -0
  256. package/src/components/TextareaCount/TextareaCount.tsx +108 -0
  257. package/src/components/Tooltip/Tooltip.css +43 -0
  258. package/src/components/Tooltip/Tooltip.stories.tsx +110 -0
  259. package/src/components/Tooltip/Tooltip.tsx +53 -0
  260. package/src/components/WarningText/WarningText.css +20 -0
  261. package/src/components/WarningText/WarningText.stories.tsx +29 -0
  262. package/src/components/WarningText/WarningText.tsx +17 -0
  263. package/src/components/index.ts +343 -61
  264. package/src/errors/errorDisplay.ts +70 -0
  265. package/src/errors/index.ts +1 -0
  266. package/src/http/constants.ts +2 -0
  267. package/src/http/fetch.ts +7 -3
  268. package/src/map/LayerSwitcherPanel.tsx +2 -173
  269. package/src/map/LegendShim.tsx +2 -0
  270. package/src/map/MapComponent.tsx +7 -17
  271. package/src/map/MapControlsOverlay.tsx +68 -175
  272. package/src/map/Popup.tsx +71 -24
  273. package/src/map/geocoder/Geocoder.test.tsx +46 -3
  274. package/src/map/geocoder/Geocoder.tsx +155 -278
  275. package/src/map/index.ts +1 -1
  276. package/src/types/utils.ts +0 -10
  277. package/src/utils/components.ts +96 -0
  278. package/src/utils/index.ts +1 -0
  279. package/src/utils/utils.ts +0 -12
  280. package/src/assets/images/defra-logo.svg +0 -51
  281. package/src/assets/images/ea-logo.svg +0 -58
  282. package/src/assets/images/ogl.svg +0 -1
  283. package/src/components/Button/Button.test.tsx +0 -53
  284. package/src/components/ButtonLink/ButtonLink.test.tsx +0 -154
  285. package/src/components/Card/Card.test.tsx +0 -51
  286. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +0 -75
  287. package/src/components/ErrorBoundary/ErrorFallback.test.tsx +0 -107
  288. package/src/components/ErrorText/ErrorText.test.tsx +0 -33
  289. package/src/components/Heading/Heading.test.tsx +0 -22
  290. package/src/components/Hint/Hint.stories.tsx +0 -58
  291. package/src/components/Hint/Hint.test.tsx +0 -33
  292. package/src/components/Hint/Hint.tsx +0 -12
  293. package/src/components/InfoBox/InfoBox.test.tsx +0 -330
  294. package/src/components/InfoBox/types.ts +0 -6
  295. package/src/components/LinkButton/LinkButton.test.tsx +0 -177
  296. package/src/components/Modal/Modal.test.tsx +0 -246
  297. package/src/components/NotificationBanner/NotificationBanner.stories.tsx +0 -45
  298. package/src/components/NotificationBanner/NotificationBanner.test.tsx +0 -58
  299. package/src/components/NotificationBanner/NotificationBanner.tsx +0 -45
  300. package/src/components/Paragraph/Paragraph.test.tsx +0 -10
  301. package/src/components/SlidingPanel/SlidingPanel.stories.tsx +0 -129
  302. package/src/components/SlidingPanel/SlidingPanel.test.tsx +0 -83
  303. package/src/components/SlidingPanel/SlidingPanel.tsx +0 -258
  304. package/src/components/accordion/Accordion.stories.tsx +0 -234
  305. package/src/components/accordion/Accordion.test.tsx +0 -192
  306. package/src/components/accordion/Accordion.tsx +0 -73
  307. package/src/components/backToTop/BackToTop.stories.tsx +0 -407
  308. package/src/components/backToTop/BackToTop.test.tsx +0 -57
  309. package/src/components/backToTop/BackToTop.tsx +0 -134
  310. package/src/components/chip/Chip.stories.tsx +0 -61
  311. package/src/components/chip/Chip.test.tsx +0 -31
  312. package/src/components/chip/Chip.tsx +0 -23
  313. package/src/components/container/Container.tsx +0 -42
  314. package/src/components/cookieBanner/CookieBanner.stories.tsx +0 -257
  315. package/src/components/cookieBanner/CookieBanner.test.tsx +0 -68
  316. package/src/components/cookieBanner/CookieBanner.tsx +0 -73
  317. package/src/components/divider/RuleDivider.stories.tsx +0 -254
  318. package/src/components/divider/RuleDivider.test.tsx +0 -164
  319. package/src/components/divider/RuleDivider.tsx +0 -23
  320. package/src/components/dropdown/DropdownMenu.test.tsx +0 -211
  321. package/src/components/dropdown/DropdownMenu.tsx +0 -108
  322. package/src/components/dropdown/useDropdownMenu.ts +0 -249
  323. package/src/components/form/Input.stories.tsx +0 -435
  324. package/src/components/form/Input.test.tsx +0 -206
  325. package/src/components/form/Input.tsx +0 -23
  326. package/src/components/form/TextArea.stories.tsx +0 -464
  327. package/src/components/form/TextArea.test.tsx +0 -232
  328. package/src/components/form/TextArea.tsx +0 -23
  329. package/src/components/layout/footer/Footer.tsx +0 -26
  330. package/src/components/layout/footer/Licence.tsx +0 -19
  331. package/src/components/layout/footer/MetaLinks.tsx +0 -36
  332. package/src/components/layout/header/Header.test.tsx +0 -36
  333. package/src/components/layout/header/Header.tsx +0 -90
  334. package/src/components/layout/header/HeaderAuthClient.test.tsx +0 -45
  335. package/src/components/layout/header/HeaderAuthClient.tsx +0 -40
  336. package/src/components/layout/header/HeaderNavClient.test.tsx +0 -44
  337. package/src/components/layout/header/HeaderNavClient.tsx +0 -67
  338. package/src/components/link/ExternalLink.test.tsx +0 -102
  339. package/src/components/link/ExternalLink.tsx +0 -29
  340. package/src/components/link/Link.tsx +0 -26
  341. package/src/components/select/Select.stories.tsx +0 -336
  342. package/src/components/select/Select.test.tsx +0 -474
  343. package/src/components/select/Select.tsx +0 -125
  344. package/src/components/select/SelectSkeleton.stories.tsx +0 -194
  345. package/src/components/select/SelectSkeleton.test.tsx +0 -104
  346. package/src/components/select/SelectSkeleton.tsx +0 -23
  347. package/src/components/select/common.ts +0 -3
  348. package/src/components/select/index.ts +0 -18
  349. package/src/components/skipLink/SkipLink.stories.tsx +0 -346
  350. package/src/components/skipLink/SkipLink.test.tsx +0 -22
  351. package/src/components/skipLink/SkipLink.tsx +0 -49
  352. package/src/map/LegendPanel.tsx +0 -85
  353. /package/src/{components → assets}/images/DefraLogo.tsx +0 -0
  354. /package/src/{components → assets}/images/EaLogo.tsx +0 -0
  355. /package/src/{components → assets}/images/OglLogo.tsx +0 -0
  356. /package/src/components/{googleAnalytics → GoogleAnalytics}/GlobalVars.tsx +0 -0
  357. /package/src/components/{googleAnalytics → GoogleAnalytics}/GoogleAnalytics.tsx +0 -0
@@ -1,73 +0,0 @@
1
- 'use client';
2
-
3
- import { useRouter } from 'next/navigation';
4
- import Script from 'next/script';
5
-
6
- import { ExternalLink } from '@tpzdsp/next-toolkit/components';
7
-
8
- const helpCookieUrl = 'https://environment.data.gov.uk/help/cookies';
9
-
10
- export const CookieBanner = () => {
11
- const router = useRouter();
12
-
13
- const setPreferences = () => {
14
- router.push(helpCookieUrl);
15
- };
16
-
17
- return (
18
- <div id="cookie-banner" role="region" aria-label="cookie banner" style={{ display: 'none' }}>
19
- <Script src="https://environment.data.gov.uk/shared/cookie-banner.js"></Script>
20
-
21
- <div className="mx-auto max-w-[960px] p-[1rem]">
22
- <h3 className="mb-4 text-base font-bold text-govukBlack">
23
- Tell us whether you accept cookies
24
- </h3>
25
-
26
- <p className="mb-4 text-sm text-black">
27
- We use essential cookies to give you the best online experience. Without them, this
28
- service will not work.
29
- </p>
30
-
31
- <p className="mb-4 text-sm text-black">
32
- We also use non-essential cookies to analyze site usage to continually improve the
33
- services we provide you with.
34
- </p>
35
-
36
- <p className="mb-4 text-sm text-black">
37
- Full details of cookies collected, and the functionality to change your cookie preference
38
- at any time can be accessed on our{' '}
39
- <ExternalLink href={helpCookieUrl}>Cookie Policy Page</ExternalLink>.
40
- </p>
41
-
42
- <div className="grid grid-cols-1 gap-4 md:grid-cols-[1fr_1fr_1fr]">
43
- <div>
44
- <button
45
- className="focus:outline-3 relative box-border inline-block w-full cursor-pointer
46
- appearance-none rounded-none border-2 border-transparent bg-green-500 px-[10px]
47
- py-[7px] text-center align-top text-base font-normal leading-[19px] text-white
48
- antialiased shadow-[0_2px_0_#002413] focus:bg-green-600 hover:bg-green-600
49
- focus:outline focus:outline-offset-0 focus:outline-yellow-500"
50
- id="accept-all-cookies"
51
- type="submit"
52
- >
53
- Accept all cookies
54
- </button>
55
- </div>
56
-
57
- <div>
58
- <button
59
- className="focus:outline-3 relative box-border inline-block w-full cursor-pointer
60
- appearance-none rounded-none border-2 border-transparent bg-green-500 px-[10px]
61
- py-[7px] text-center align-top text-base font-normal leading-[19px] text-white
62
- antialiased shadow-[0_2px_0_#002413] focus:bg-green-600 hover:bg-green-600
63
- focus:outline focus:outline-offset-0 focus:outline-yellow-500"
64
- onClick={setPreferences}
65
- >
66
- Reject additional cookies
67
- </button>
68
- </div>
69
- </div>
70
- </div>
71
- </div>
72
- );
73
- };
@@ -1,254 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
-
3
- import { RuleDivider } from './RuleDivider';
4
-
5
- const meta = {
6
- title: 'Components/RuleDivider',
7
- component: RuleDivider,
8
- parameters: {
9
- layout: 'centered',
10
- },
11
- tags: ['autodocs'],
12
- } satisfies Meta<typeof RuleDivider>;
13
-
14
- export default meta;
15
- type Story = StoryObj<typeof meta>;
16
-
17
- export const Default: Story = {
18
- render: () => (
19
- <div className="w-96">
20
- <RuleDivider />
21
- </div>
22
- ),
23
- };
24
-
25
- export const WithText: Story = {
26
- render: () => (
27
- <div className="w-96">
28
- <RuleDivider>OR</RuleDivider>
29
- </div>
30
- ),
31
- };
32
-
33
- export const WithLongerText: Story = {
34
- render: () => (
35
- <div className="w-96">
36
- <RuleDivider>Continue Reading</RuleDivider>
37
- </div>
38
- ),
39
- };
40
- export const WithIcon: Story = {
41
- render: () => (
42
- <div className="w-96">
43
- <RuleDivider>
44
- <svg
45
- className="w-4 h-4"
46
- fill="none"
47
- stroke="currentColor"
48
- viewBox="0 0 24 24"
49
- xmlns="http://www.w3.org/2000/svg"
50
- >
51
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 4v16m8-8H4" />
52
- </svg>
53
- </RuleDivider>
54
- </div>
55
- ),
56
- };
57
-
58
- export const WithStyledText: Story = {
59
- render: () => (
60
- <div className="w-96">
61
- <RuleDivider>
62
- <span className="text-sm text-gray-500 uppercase tracking-wide">Section Break</span>
63
- </RuleDivider>
64
- </div>
65
- ),
66
- };
67
-
68
- export const WithBoldText: Story = {
69
- render: () => (
70
- <div className="w-96">
71
- <RuleDivider>
72
- <strong className="text-gray-700">Important</strong>
73
- </RuleDivider>
74
- </div>
75
- ),
76
- };
77
-
78
- export const WithColoredText: Story = {
79
- render: () => (
80
- <div className="w-96">
81
- <RuleDivider>
82
- <span className="text-blue-600 font-medium">New Content</span>
83
- </RuleDivider>
84
- </div>
85
- ),
86
- };
87
-
88
- export const InContainer: Story = {
89
- render: () => (
90
- <div className="w-96 p-4 border rounded">
91
- <p className="mb-4">This is some content above the divider.</p>
92
-
93
- <RuleDivider>
94
- <span className="text-gray-500">More below</span>
95
- </RuleDivider>
96
-
97
- <p className="mt-4">This is content below the divider.</p>
98
- </div>
99
- ),
100
- };
101
-
102
- export const FormSeparator: Story = {
103
- render: () => (
104
- <div className="w-80 p-6 border rounded">
105
- <div className="space-y-4">
106
- <div>
107
- <p className="block text-sm font-medium mb-1">Email</p>
108
-
109
- <input
110
- type="email"
111
- className="w-full p-2 border border-gray-300 rounded"
112
- placeholder="Enter your email"
113
- />
114
- </div>
115
-
116
- <div>
117
- <p className="block text-sm font-medium mb-1">Password</p>
118
-
119
- <input
120
- type="password"
121
- className="w-full p-2 border border-gray-300 rounded"
122
- placeholder="Enter your password"
123
- />
124
- </div>
125
- </div>
126
-
127
- <div className="my-6">
128
- <RuleDivider>
129
- <span className="text-xs text-gray-400 uppercase">OR</span>
130
- </RuleDivider>
131
- </div>
132
-
133
- <button className="w-full py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600">
134
- Continue with Google
135
- </button>
136
- </div>
137
- ),
138
- };
139
-
140
- export const ContentSections: Story = {
141
- render: () => (
142
- <div className="max-w-2xl p-6 space-y-6">
143
- <div>
144
- <h2 className="text-xl font-bold mb-2">Introduction</h2>
145
-
146
- <p className="text-gray-600">
147
- This is the introduction section with some content that explains the topic.
148
- </p>
149
- </div>
150
-
151
- <RuleDivider>
152
- <span className="text-sm text-gray-500">Chapter 1</span>
153
- </RuleDivider>
154
-
155
- <div>
156
- <h3 className="text-lg font-semibold mb-2">Getting Started</h3>
157
-
158
- <p className="text-gray-600">
159
- Here we dive into the first chapter with detailed explanations and examples.
160
- </p>
161
- </div>
162
-
163
- <RuleDivider>
164
- <span className="text-sm text-gray-500">Chapter 2</span>
165
- </RuleDivider>
166
-
167
- <div>
168
- <h3 className="text-lg font-semibold mb-2">Advanced Topics</h3>
169
-
170
- <p className="text-gray-600">This section covers more advanced concepts and use cases.</p>
171
- </div>
172
- </div>
173
- ),
174
- };
175
-
176
- export const MultipleInList: Story = {
177
- render: () => (
178
- <div className="w-80 space-y-4">
179
- <RuleDivider />
180
-
181
- <RuleDivider>
182
- <span className="text-gray-600">Section A</span>
183
- </RuleDivider>
184
-
185
- <RuleDivider>
186
- <span className="text-gray-600">Section B</span>
187
- </RuleDivider>
188
-
189
- <RuleDivider>
190
- <span className="text-gray-600">Section C</span>
191
- </RuleDivider>
192
-
193
- <RuleDivider />
194
- </div>
195
- ),
196
- };
197
-
198
- export const DifferentWidths: Story = {
199
- render: () => (
200
- <div className="space-y-6">
201
- <div className="w-32">
202
- <div className="text-sm mb-2">Small (w-32)</div>
203
-
204
- <RuleDivider>
205
- <span className="text-xs">OR</span>
206
- </RuleDivider>
207
- </div>
208
-
209
- <div className="w-64">
210
- <div className="text-sm mb-2">Medium (w-64)</div>
211
-
212
- <RuleDivider>
213
- <span className="text-sm">Continue</span>
214
- </RuleDivider>
215
- </div>
216
-
217
- <div className="w-96">
218
- <div className="text-sm mb-2">Large (w-96)</div>
219
-
220
- <RuleDivider>
221
- <span className="text-base">Section Divider</span>
222
- </RuleDivider>
223
- </div>
224
- </div>
225
- ),
226
- };
227
-
228
- export const WithButton: Story = {
229
- render: () => (
230
- <RuleDivider>
231
- <button className="px-3 py-1 text-xs bg-gray-100 text-gray-600 rounded hover:bg-gray-200">
232
- Show More
233
- </button>
234
- </RuleDivider>
235
- ),
236
- };
237
-
238
- export const WithMultipleElements: Story = {
239
- render: () => (
240
- <RuleDivider>
241
- <div className="flex items-center gap-2">
242
- <svg className="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
243
- <path
244
- fillRule="evenodd"
245
- d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
246
- clipRule="evenodd"
247
- />
248
- </svg>
249
-
250
- <span className="text-sm text-green-600">Completed</span>
251
- </div>
252
- </RuleDivider>
253
- ),
254
- };
@@ -1,164 +0,0 @@
1
- import { RuleDivider } from './RuleDivider';
2
- import { render, screen } from '../../test/renderers';
3
-
4
- describe('RuleDivider', () => {
5
- it('should render with default props', () => {
6
- const { container } = render(<RuleDivider />);
7
-
8
- expect(container.firstChild).toBeInTheDocument();
9
- });
10
-
11
- it('should render single hr element when no children provided', () => {
12
- const { container } = render(<RuleDivider />);
13
-
14
- const hrElements = container.querySelectorAll('hr');
15
-
16
- expect(hrElements).toHaveLength(1);
17
- });
18
-
19
- it('should have correct container classes', () => {
20
- const { container } = render(<RuleDivider />);
21
-
22
- const containerElement = container.firstChild as HTMLElement;
23
-
24
- expect(containerElement).toHaveClass('flex', 'items-center');
25
- });
26
-
27
- it('should render with children', () => {
28
- render(<RuleDivider>Divider Text</RuleDivider>);
29
-
30
- expect(screen.getByText('Divider Text')).toBeInTheDocument();
31
- });
32
-
33
- it('should render two hr elements when children are provided', () => {
34
- const { container } = render(<RuleDivider>With Text</RuleDivider>);
35
-
36
- const hrElements = container.querySelectorAll('hr');
37
-
38
- expect(hrElements).toHaveLength(2);
39
- });
40
-
41
- it('should apply correct classes to hr elements', () => {
42
- const { container } = render(<RuleDivider />);
43
-
44
- const hrElement = container.querySelector('hr');
45
-
46
- expect(hrElement).toHaveClass('flex-grow');
47
- });
48
-
49
- it('should apply correct classes to span when children provided', () => {
50
- const { container } = render(<RuleDivider>Test Content</RuleDivider>);
51
-
52
- const spanElement = container.querySelector('span');
53
-
54
- expect(spanElement).toHaveClass('px-2');
55
- expect(spanElement).toHaveTextContent('Test Content');
56
- });
57
-
58
- it('should render complex children correctly', () => {
59
- render(
60
- <RuleDivider>
61
- <strong>Bold Text</strong>
62
- </RuleDivider>,
63
- );
64
-
65
- expect(screen.getByText('Bold Text')).toBeInTheDocument();
66
- expect(screen.getByText('Bold Text').tagName).toBe('STRONG');
67
- });
68
-
69
- it('should handle multiple text nodes as children', () => {
70
- render(<RuleDivider>Multiple words here</RuleDivider>);
71
-
72
- expect(screen.getByText('Multiple words here')).toBeInTheDocument();
73
- });
74
-
75
- it('should render icon as children', () => {
76
- const IconComponent = () => <svg data-testid="test-icon" />;
77
-
78
- render(
79
- <RuleDivider>
80
- <IconComponent />
81
- </RuleDivider>,
82
- );
83
-
84
- expect(screen.getByTestId('test-icon')).toBeInTheDocument();
85
- });
86
-
87
- it('should have proper structure when children provided', () => {
88
- const { container } = render(<RuleDivider>Content</RuleDivider>);
89
-
90
- const containerElement = container.firstChild as HTMLElement;
91
-
92
- expect(containerElement.children).toHaveLength(3); // hr + span + hr
93
-
94
- const [firstHr, span, secondHr] = containerElement.children;
95
-
96
- expect(firstHr?.tagName).toBe('HR');
97
- expect(span?.tagName).toBe('SPAN');
98
- expect(secondHr?.tagName).toBe('HR');
99
- });
100
-
101
- it('should have proper structure when no children provided', () => {
102
- const { container } = render(<RuleDivider />);
103
-
104
- const containerElement = container.firstChild as HTMLElement;
105
-
106
- expect(containerElement.children).toHaveLength(1); // only hr
107
-
108
- const hrElement = containerElement.children[0];
109
-
110
- expect(hrElement?.tagName).toBe('HR');
111
- });
112
-
113
- it('should handle empty string as children', () => {
114
- const { container } = render(<RuleDivider>{''}</RuleDivider>);
115
-
116
- // Empty string is falsy, so should behave like no children
117
- const hrElements = container.querySelectorAll('hr');
118
-
119
- expect(hrElements).toHaveLength(1);
120
-
121
- const spanElement = container.querySelector('span');
122
-
123
- expect(spanElement).not.toBeInTheDocument();
124
- });
125
-
126
- it('should handle null children correctly', () => {
127
- const { container } = render(<RuleDivider>{null}</RuleDivider>);
128
-
129
- // null should be considered falsy, so only one hr should render
130
- const hrElements = container.querySelectorAll('hr');
131
-
132
- expect(hrElements).toHaveLength(1);
133
-
134
- const spanElement = container.querySelector('span');
135
-
136
- expect(spanElement).not.toBeInTheDocument();
137
- });
138
-
139
- it('should handle undefined children correctly', () => {
140
- const { container } = render(<RuleDivider>{undefined}</RuleDivider>);
141
-
142
- // undefined should be considered falsy, so only one hr should render
143
- const hrElements = container.querySelectorAll('hr');
144
-
145
- expect(hrElements).toHaveLength(1);
146
-
147
- const spanElement = container.querySelector('span');
148
-
149
- expect(spanElement).not.toBeInTheDocument();
150
- });
151
-
152
- it('should render multiple child elements', () => {
153
- render(
154
- <RuleDivider>
155
- <span>Text 1</span>
156
-
157
- <span>Text 2</span>
158
- </RuleDivider>,
159
- );
160
-
161
- expect(screen.getByText('Text 1')).toBeInTheDocument();
162
- expect(screen.getByText('Text 2')).toBeInTheDocument();
163
- });
164
- });
@@ -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 RuleDividerProps = ExtendProps<'div', Props>;
9
-
10
- export const RuleDivider = ({ children, className, ...props }: RuleDividerProps) => {
11
- return (
12
- <div className={cn('flex items-center', className)} {...props}>
13
- <hr className="flex-grow" />
14
- {children ? (
15
- <>
16
- <span className="px-2">{children}</span>
17
-
18
- <hr className="flex-grow" />
19
- </>
20
- ) : null}
21
- </div>
22
- );
23
- };