@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,33 +1,64 @@
1
- import type { ExtendProps } from '../../types/utils';
2
- import { cn } from '../../utils';
1
+ import type { ComponentProps } from 'react';
3
2
 
4
- type Props = {
5
- type?: 'submit' | 'reset' | 'button';
6
- children: React.ReactNode;
3
+ import { Slot } from 'radix-ui';
4
+
5
+ import { cn } from '../../utils/components';
6
+
7
+ const BUTTON_LINK_APPEARANCES = {
8
+ primary: 'cn-button-link-appearance-primary',
9
+ inverse: 'cn-button-link-appearance-inverse',
10
+ contrast: 'cn-button-link-appearance-contrast',
11
+ } as const;
12
+
13
+ const BUTTON_LINK_VARIANTS = {
14
+ default: 'cn-button-link-variant-default',
15
+ icon: 'cn-button-link-variant-icon',
16
+ } as const;
17
+
18
+ const BUTTON_LINK_SIZES = {
19
+ sm: 'cn-button-link-size-sm',
20
+ base: 'cn-button-link-size-base',
21
+ lg: 'cn-button-link-size-lg',
22
+ } as const;
23
+
24
+ export type ButtonLinkAppearance = keyof typeof BUTTON_LINK_APPEARANCES;
25
+ export type ButtonLinkVariant = keyof typeof BUTTON_LINK_VARIANTS;
26
+ export type ButtonLinkSize = keyof typeof BUTTON_LINK_SIZES;
27
+ export type ButtonLinkProps = ComponentProps<'button'> & {
28
+ asChild?: boolean;
29
+ appearance?: ButtonLinkAppearance;
30
+ variant?: ButtonLinkVariant;
31
+ size?: ButtonLinkSize;
7
32
  };
8
33
 
9
- export type ButtonLinkProps = ExtendProps<'button', Props>;
34
+ export const ButtonLink = ({
35
+ className,
36
+ appearance = 'primary',
37
+ variant = 'default',
38
+ size = 'base',
39
+ asChild = false,
40
+ ...props
41
+ }: ButtonLinkProps) => {
42
+ const Comp = asChild ? Slot.Root : 'button';
10
43
 
11
- /**
12
- * A button that looks like a link.
13
- * Use when you need button functionality (onClick, form submission)
14
- * but want the visual appearance of a link.
15
- */
16
- export const ButtonLink = ({ type = 'button', className, children, ...props }: ButtonLinkProps) => {
17
44
  return (
18
- <button
19
- type={type}
45
+ <Comp
46
+ {...props}
47
+ data-slot="button"
48
+ data-appearance={appearance}
49
+ data-variant={variant}
50
+ data-size={size}
20
51
  className={cn(
21
- `cursor-pointer text-link hover:decoration-[max(3px,_.1875rem,_.12em)] hover:text-link-hover
22
- visited:text-link-visited active:text-black focus:decoration-[max(3px,_.1875rem,_.12em)]
23
- decoration-[max(1px,_.0625rem)] underline-offset-[0.1578em] underline outline-none
24
- focus:text-focus-text focus:bg-focus inline-block bg-transparent border-0 p-0
25
- disabled:opacity-50 disabled:cursor-not-allowed`,
52
+ `cn-button cn-button-link inline-flex items-center select-none disabled:cursor-not-allowed
53
+ [&_svg]:pointer-events-none [&_svg]:shrink-0`,
54
+ BUTTON_LINK_APPEARANCES[appearance],
55
+ BUTTON_LINK_VARIANTS[variant],
56
+ BUTTON_LINK_SIZES[size],
26
57
  className,
27
58
  )}
28
- {...props}
29
- >
30
- {children}
31
- </button>
59
+ // Forces the button to always be understood as a button by the screenreader even
60
+ // if someone tries to replace the component with `asChild`.
61
+ role="button"
62
+ />
32
63
  );
33
64
  };
@@ -0,0 +1,13 @@
1
+ @layer components {
2
+ /* MARK: Card
3
+ Thin top divider rather than a full border box, no fill. min-h-60 (240px)
4
+ keeps cards a similar near-square shape in a grid regardless of content
5
+ length; width comes from whatever layout the card sits in (CardGroup's
6
+ grid columns, typically). Also a container-query provider (@container):
7
+ a card's own width is set by its grid column, not the viewport, so
8
+ anything stacked inside it (Stack, HeadingGroup) needs to size against
9
+ that actual width instead. */
10
+ .cn-card {
11
+ @apply border-t border-divider p-gds-3 min-h-60 @container;
12
+ }
13
+ }
@@ -1,82 +1,123 @@
1
- import { FaChevronRight } from 'react-icons/fa6';
1
+ import { LuChevronRight } from 'react-icons/lu';
2
2
 
3
3
  import type { Meta, StoryObj } from '@storybook/react-vite';
4
4
 
5
5
  import { Card } from './Card';
6
- import { ExternalLink } from '../link/ExternalLink';
6
+ import { CardGroup } from '../CardGroup/CardGroup';
7
+ import { Heading } from '../Heading/Heading';
8
+ import { HeadingGroup } from '../Layout/HeadingGroup/HeadingGroup';
9
+ import { Link } from '../Link/Link';
7
10
  import { Paragraph } from '../Paragraph/Paragraph';
8
11
 
9
12
  const meta: Meta<typeof Card> = {
10
13
  title: 'Components/Card',
11
14
  component: Card,
12
- parameters: {
13
- layout: 'padded',
14
- },
15
15
  tags: ['autodocs'],
16
- argTypes: {
17
- children: {
18
- description: 'Content of the card',
19
- control: false,
20
- },
21
- className: {
22
- description: 'Additional TailwindCSS classes to apply',
23
- control: 'text',
16
+ parameters: {
17
+ docs: {
18
+ description: {
19
+ component:
20
+ 'A content block set apart by a thin top divider rather than a full border box. Card has no opinion on internal structure, it just supplies the divider, padding, and a min-height that keeps cards a similar near-square shape when several sit side by side. Combine with CardGroup for a responsive grid.',
21
+ },
24
22
  },
25
23
  },
26
- args: {
27
- children: 'Hello, this is some simple text',
28
- },
24
+ argTypes: {},
25
+ args: {},
29
26
  };
30
27
 
31
28
  export default meta;
32
29
 
33
30
  type Story = StoryObj<typeof Card>;
34
31
 
35
- export const Default: Story = {};
32
+ export const Default: Story = {
33
+ render: () => (
34
+ <Card className="max-w-xs">
35
+ <HeadingGroup>
36
+ <Heading level="h3" className="text-lg">
37
+ <Link href="#" variant="expand">
38
+ Data requirements library
39
+ <LuChevronRight aria-hidden className="size-4" strokeWidth={2.5} />
40
+ </Link>
41
+ </Heading>
36
42
 
37
- export const ParagraphOfText: Story = {
38
- args: {
39
- children: <Paragraph>Hello, this is some simple text</Paragraph>,
40
- },
41
- };
43
+ <Paragraph className="text-sm">
44
+ The terminology and categories we use to classify and describe Environment Agency assets.
45
+ We also document the attributes we use to describe the properties of each Asset Type and
46
+ its Element Types.
47
+ </Paragraph>
48
+ </HeadingGroup>
42
49
 
43
- export const ImageAndText: Story = {
44
- args: {
45
- children: (
46
- <div>
47
- <img
48
- src="https://images.unsplash.com/photo-1563991655280-cb95c90ca2fb?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8M3x8bm8lMjBjb3B5cmlnaHR8ZW58MHx8MHx8fDA%3D"
49
- alt="Card"
50
- />
51
-
52
- <p>This is text about the image</p>
53
- </div>
54
- ),
55
- },
50
+ <Link href="#" className="mt-gds-2 inline-block text-sm">
51
+ API
52
+ </Link>
53
+ </Card>
54
+ ),
56
55
  };
57
56
 
58
- export const ComplexChildren: Story = {
59
- args: {
60
- children: (
61
- <>
62
- <ExternalLink
63
- href="https://google.co.uk"
64
- className="mb-4 flex flex-nowrap items-center gap-2 justify-between font-bold"
65
- >
66
- <strong>title</strong>
67
-
68
- <FaChevronRight className="text-base" />
69
- </ExternalLink>
70
-
71
- <Paragraph>Some descriptive text</Paragraph>
72
- </>
73
- ),
57
+ export const Grid: Story = {
58
+ parameters: {
59
+ docs: {
60
+ description: {
61
+ story:
62
+ 'CardGroup lays cards out in a responsive grid, columns auto-fill down to a minimum width rather than a fixed count, so the same markup reflows from one column on mobile up to several on desktop.',
63
+ },
64
+ },
74
65
  },
75
- };
66
+ render: () => (
67
+ <CardGroup>
68
+ <Card>
69
+ <HeadingGroup>
70
+ <Heading level="h3" className="text-lg">
71
+ <Link href="#" variant="expand">
72
+ Data requirements library
73
+ <LuChevronRight aria-hidden className="size-4" strokeWidth={2.5} />
74
+ </Link>
75
+ </Heading>
76
76
 
77
- export const CustomStyling: Story = {
78
- args: {
79
- className: 'bg-blue-100 text-blue-800 p-4 rounded-lg shadow-lg',
80
- children: 'Custom styled card',
81
- },
77
+ <Paragraph className="text-sm">
78
+ The terminology and categories we use to classify and describe Environment Agency
79
+ assets.
80
+ </Paragraph>
81
+ </HeadingGroup>
82
+
83
+ <Link href="#" className="mt-gds-2 inline-block text-sm">
84
+ API
85
+ </Link>
86
+ </Card>
87
+
88
+ <Card>
89
+ <HeadingGroup>
90
+ <Heading level="h3" className="text-lg">
91
+ <Link href="#" variant="expand">
92
+ Flood risk data
93
+ <LuChevronRight aria-hidden className="size-4" strokeWidth={2.5} />
94
+ </Link>
95
+ </Heading>
96
+
97
+ <Paragraph className="text-sm">
98
+ Flood extents, defences, and risk of flooding data for rivers, sea, and surface water.
99
+ </Paragraph>
100
+ </HeadingGroup>
101
+ </Card>
102
+
103
+ <Card>
104
+ <HeadingGroup>
105
+ <Heading level="h3" className="text-lg">
106
+ <Link href="#" variant="expand">
107
+ Water quality archive
108
+ <LuChevronRight aria-hidden className="size-4" strokeWidth={2.5} />
109
+ </Link>
110
+ </Heading>
111
+
112
+ <Paragraph className="text-sm">
113
+ Historic water quality sample data collected at monitoring points across England.
114
+ </Paragraph>
115
+ </HeadingGroup>
116
+
117
+ <Link href="#" className="mt-gds-2 inline-block text-sm">
118
+ API
119
+ </Link>
120
+ </Card>
121
+ </CardGroup>
122
+ ),
82
123
  };
@@ -1,21 +1,12 @@
1
- import type { ExtendProps } from '../../types';
2
- import { cn } from '../../utils';
1
+ import type { ComponentProps } from 'react';
3
2
 
4
- type Props = {
5
- children: React.ReactNode;
6
- };
3
+ import { cn } from '../../utils';
7
4
 
8
- export type CardProps = ExtendProps<'article', Props>;
5
+ export type CardProps = ComponentProps<'article'>;
9
6
 
10
7
  export const Card = ({ className, children, ...props }: CardProps) => {
11
8
  return (
12
- <article
13
- className={cn(
14
- 'h-full flex flex-col pt-[12px] px-[4px] mx-3 border-t border-slate-500',
15
- className,
16
- )}
17
- {...props}
18
- >
9
+ <article data-slot="card" className={cn('cn-card', className)} {...props}>
19
10
  {children}
20
11
  </article>
21
12
  );
@@ -0,0 +1,10 @@
1
+ @layer components {
2
+ /* MARK: CardGroup
3
+ Responsive grid, no fixed column count: columns auto-fill at a minimum
4
+ card width and stretch evenly to fill the remaining space, so the same
5
+ markup reflows from one column on mobile up to several on desktop. */
6
+ .cn-card-group {
7
+ @apply grid gap-gds-4;
8
+ grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
9
+ }
10
+ }
@@ -0,0 +1,81 @@
1
+ import { LuChevronRight } from 'react-icons/lu';
2
+
3
+ import type { Meta, StoryObj } from '@storybook/react-vite';
4
+
5
+ import { CardGroup } from './CardGroup';
6
+ import { Card } from '../Card/Card';
7
+ import { Heading } from '../Heading/Heading';
8
+ import { HeadingGroup } from '../Layout/HeadingGroup/HeadingGroup';
9
+ import { Link } from '../Link/Link';
10
+ import { Paragraph } from '../Paragraph/Paragraph';
11
+
12
+ const meta: Meta<typeof CardGroup> = {
13
+ title: 'Components/CardGroup',
14
+ component: CardGroup,
15
+ tags: ['autodocs'],
16
+ parameters: {
17
+ docs: {
18
+ description: {
19
+ component:
20
+ 'Lays Card components out in a responsive grid. Columns auto-fill down to a minimum width rather than a fixed count, so the same markup reflows from one column on mobile up to several on desktop.',
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ export default meta;
27
+
28
+ type Story = StoryObj<typeof CardGroup>;
29
+
30
+ const CARDS = [
31
+ {
32
+ title: 'Data requirements library',
33
+ description:
34
+ 'The terminology and categories we use to classify and describe Environment Agency assets.',
35
+ hasApi: true,
36
+ },
37
+ {
38
+ title: 'Flood risk data',
39
+ description:
40
+ 'Flood extents, defences, and risk of flooding data for rivers, sea, and surface water.',
41
+ hasApi: false,
42
+ },
43
+ {
44
+ title: 'Water quality archive',
45
+ description:
46
+ 'Historic water quality sample data collected at monitoring points across England.',
47
+ hasApi: true,
48
+ },
49
+ {
50
+ title: 'Land cover map',
51
+ description: 'Land parcel boundaries and cover classification for England.',
52
+ hasApi: false,
53
+ },
54
+ ];
55
+
56
+ export const Default: Story = {
57
+ render: () => (
58
+ <CardGroup>
59
+ {CARDS.map((card) => (
60
+ <Card key={card.title}>
61
+ <HeadingGroup>
62
+ <Heading level="h3" className="text-lg">
63
+ <Link href="#" variant="expand">
64
+ {card.title}
65
+ <LuChevronRight aria-hidden className="size-4" strokeWidth={2.5} />
66
+ </Link>
67
+ </Heading>
68
+
69
+ <Paragraph className="text-sm">{card.description}</Paragraph>
70
+ </HeadingGroup>
71
+
72
+ {card.hasApi ? (
73
+ <Link href="#" className="mt-gds-2 inline-block text-sm">
74
+ API
75
+ </Link>
76
+ ) : null}
77
+ </Card>
78
+ ))}
79
+ </CardGroup>
80
+ ),
81
+ };
@@ -0,0 +1,9 @@
1
+ import type { ComponentProps } from 'react';
2
+
3
+ import { cn } from '../../utils/components';
4
+
5
+ export type CardGroupProps = ComponentProps<'div'>;
6
+
7
+ export const CardGroup = ({ className, ...props }: CardGroupProps) => (
8
+ <div data-slot="card-group" className={cn('cn-card-group', className)} {...props} />
9
+ );
@@ -0,0 +1,49 @@
1
+ @layer components {
2
+ /* MARK: Checkbox
3
+ Radix Checkbox.Root renders a <button role="checkbox">.
4
+ Border is set explicitly (not via cn-form-border @apply) because
5
+ appearance:none on <button> can override utility-layer border styles. */
6
+ .cn-checkbox {
7
+ @apply appearance-none cursor-pointer flex-none box-border bg-white outline-none p-0;
8
+ border: var(--border-width-form) solid var(--color-divider-input);
9
+
10
+ &:focus:not(:disabled) {
11
+ @apply outline-focus border-4 outline-offset-1;
12
+ box-shadow: 0 0 0 var(--outline-width-focus) var(--color-focus);
13
+ }
14
+
15
+ &[data-state='checked'] {
16
+ @apply border-body;
17
+ }
18
+
19
+ &:disabled {
20
+ @apply opacity-50 cursor-not-allowed;
21
+ }
22
+ }
23
+
24
+ /* MARK: Indicator */
25
+ .cn-checkbox-indicator {
26
+ @apply flex items-center justify-center w-full h-full;
27
+ }
28
+
29
+ .cn-checkbox-icon {
30
+ @apply border-body;
31
+ }
32
+
33
+ /* MARK: Sizes */
34
+ .cn-checkbox-size-sm {
35
+ @apply w-6 h-6;
36
+
37
+ & .cn-checkbox-icon {
38
+ @apply w-3 h-3 stroke-4;
39
+ }
40
+ }
41
+
42
+ .cn-checkbox-size-base {
43
+ @apply w-10 h-10;
44
+
45
+ & .cn-checkbox-icon {
46
+ @apply w-6 h-6 stroke-4;
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,86 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { Checkbox } from './Checkbox';
4
+ import { Label } from '../Label/Label';
5
+
6
+ const meta: Meta<typeof Checkbox> = {
7
+ title: 'Components/Checkbox',
8
+ component: Checkbox,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: 'Let users select one or more options by using the checkboxes component.',
14
+ },
15
+ },
16
+ },
17
+ argTypes: {
18
+ size: {
19
+ control: { type: 'radio' },
20
+ options: ['sm', 'base'],
21
+ },
22
+ disabled: { control: 'boolean' },
23
+ defaultChecked: { control: 'boolean' },
24
+ },
25
+ args: {
26
+ size: 'base',
27
+ },
28
+ };
29
+
30
+ export default meta;
31
+
32
+ type Story = StoryObj<typeof Checkbox>;
33
+
34
+ export const Default: Story = {};
35
+
36
+ export const Checked: Story = {
37
+ args: { defaultChecked: true },
38
+ };
39
+
40
+ export const Sizes: Story = {
41
+ render: () => (
42
+ <div className="flex items-center gap-gds-4">
43
+ <Label className="flex flex-col items-center gap-gds-1">
44
+ <Checkbox size="sm" />
45
+ sm
46
+ </Label>
47
+
48
+ <Label className="flex flex-col items-center gap-gds-1">
49
+ <Checkbox size="base" />
50
+ base
51
+ </Label>
52
+ </div>
53
+ ),
54
+ };
55
+
56
+ export const WithLabel: Story = {
57
+ parameters: {
58
+ docs: {
59
+ description: {
60
+ story:
61
+ 'Wrap the checkbox inside a `Label` so clicking the label text activates it. Radix renders the checkbox as a `<button>`, so `htmlFor` alone is unreliable, the wrapping label avoids that.',
62
+ },
63
+ },
64
+ },
65
+ render: (args) => (
66
+ <Label className="flex items-center gap-gds-2">
67
+ <Checkbox {...args} />I agree to the terms and conditions
68
+ </Label>
69
+ ),
70
+ };
71
+
72
+ export const Disabled: Story = {
73
+ render: () => (
74
+ <div className="flex flex-col gap-gds-2">
75
+ <Label className="flex items-center gap-gds-2">
76
+ <Checkbox disabled />
77
+ Unchecked disabled
78
+ </Label>
79
+
80
+ <Label className="flex items-center gap-gds-2">
81
+ <Checkbox disabled defaultChecked />
82
+ Checked disabled
83
+ </Label>
84
+ </div>
85
+ ),
86
+ };
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+
3
+ import type { ComponentProps } from 'react';
4
+
5
+ import { Checkbox as CheckboxPrimitive } from 'radix-ui';
6
+ import { LiaCheckSolid } from 'react-icons/lia';
7
+
8
+ import { cn } from '../../utils/components';
9
+
10
+ const CHECKBOX_SIZES = {
11
+ sm: 'cn-checkbox-size-sm',
12
+ base: 'cn-checkbox-size-base',
13
+ } as const;
14
+
15
+ export type CheckboxSize = keyof typeof CHECKBOX_SIZES;
16
+
17
+ export type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root> & {
18
+ size?: CheckboxSize;
19
+ };
20
+
21
+ export const Checkbox = ({ className, size = 'base', ...props }: CheckboxProps) => (
22
+ <CheckboxPrimitive.Root
23
+ data-slot="checkbox"
24
+ data-size={size}
25
+ className={cn('cn-checkbox', CHECKBOX_SIZES[size], className)}
26
+ {...props}
27
+ >
28
+ <CheckboxPrimitive.Indicator data-slot="checkbox-indicator" className="cn-checkbox-indicator">
29
+ <LiaCheckSolid aria-hidden className="cn-checkbox-icon" />
30
+ </CheckboxPrimitive.Indicator>
31
+ </CheckboxPrimitive.Root>
32
+ );
@@ -0,0 +1,54 @@
1
+ /* MARK: Tag
2
+ GDS-style label rendered as <strong> to convey semantic importance.
3
+ Accent green by default. 1px radius, break-word, no text decoration. */
4
+ @utility cn-chip {
5
+ @apply inline-block wrap-break-word no-underline;
6
+ border-radius: 1px;
7
+ max-width: 160px;
8
+ }
9
+
10
+ /* MARK: Appearances */
11
+
12
+ @utility cn-chip-appearance-neutral {
13
+ @apply bg-neutral-subtle text-on-neutral-subtle;
14
+ }
15
+
16
+ @utility cn-chip-appearance-success {
17
+ @apply bg-success-subtle text-on-success-subtle;
18
+ }
19
+
20
+ @utility cn-chip-appearance-warning {
21
+ @apply bg-warning-subtle text-on-warning-subtle;
22
+ }
23
+
24
+ @utility cn-chip-appearance-error {
25
+ @apply bg-error-subtle text-on-error-subtle;
26
+ }
27
+
28
+ @utility cn-chip-appearance-info {
29
+ @apply bg-info-subtle text-on-info-subtle;
30
+ }
31
+
32
+ /* MARK: Sizes */
33
+
34
+ @utility cn-chip-size-sm {
35
+ @apply text-sm;
36
+ padding: 1px 6px 2px;
37
+ margin-top: -1px;
38
+ margin-bottom: -2px;
39
+ }
40
+
41
+ @utility cn-chip-size-base {
42
+ @apply text-base;
43
+ /* GDS canonical padding */
44
+ padding: 2px 8px 3px;
45
+ margin-top: -2px;
46
+ margin-bottom: -3px;
47
+ }
48
+
49
+ @utility cn-chip-size-lg {
50
+ @apply text-lg;
51
+ padding: 4px 10px 5px;
52
+ margin-top: -4px;
53
+ margin-bottom: -5px;
54
+ }