@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
@@ -0,0 +1,264 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from './Accordion';
4
+
5
+ const meta: Meta<typeof Accordion> = {
6
+ title: 'Components/Accordion',
7
+ component: Accordion,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component:
13
+ "Vertically stacked sections that can be expanded or collapsed. Uses separator lines rather than borders, so it works equally in a sidebar panel or as a standalone FAQ section on a page. Each AccordionTrigger renders as a real heading (h3 by default), pass `level` to match wherever the accordion sits in the page's own heading hierarchy.",
14
+ },
15
+ },
16
+ },
17
+ argTypes: {
18
+ type: {
19
+ control: { type: 'radio' },
20
+ options: ['single', 'multiple'],
21
+ description: '`single` closes others when one opens; `multiple` allows any number open.',
22
+ },
23
+ },
24
+ args: {
25
+ type: 'multiple',
26
+ },
27
+ };
28
+
29
+ export default meta;
30
+
31
+ type Story = StoryObj<typeof Accordion>;
32
+
33
+ export const Default: Story = {
34
+ render: (args) => (
35
+ <Accordion {...args}>
36
+ <AccordionItem value="item-1">
37
+ <AccordionTrigger>What is the purpose of this service?</AccordionTrigger>
38
+
39
+ <AccordionContent>
40
+ This service helps you manage your environmental land management applications and track
41
+ payments. You can check your eligibility, submit evidence, and view your agreement
42
+ details.
43
+ </AccordionContent>
44
+ </AccordionItem>
45
+
46
+ <AccordionItem value="item-2">
47
+ <AccordionTrigger>How do I submit an application?</AccordionTrigger>
48
+
49
+ <AccordionContent>
50
+ Start by checking your eligibility using the tool on the homepage. Once confirmed, you can
51
+ begin a new application from your dashboard. Most applications take around 20 minutes to
52
+ complete.
53
+ </AccordionContent>
54
+ </AccordionItem>
55
+
56
+ <AccordionItem value="item-3">
57
+ <AccordionTrigger>When will I receive payment?</AccordionTrigger>
58
+
59
+ <AccordionContent>
60
+ Payments are processed quarterly once your evidence has been reviewed and approved. You
61
+ will receive an email confirmation when payment has been issued to your nominated bank
62
+ account.
63
+ </AccordionContent>
64
+ </AccordionItem>
65
+ </Accordion>
66
+ ),
67
+ };
68
+
69
+ export const HeadingLevel: Story = {
70
+ parameters: {
71
+ docs: {
72
+ description: {
73
+ story:
74
+ "AccordionTrigger renders as an h3 by default, matching Radix's own default. Pass `level` when the accordion sits directly under an h2 with nothing in between, so the page's heading order stays valid (e.g. for axe's heading-order rule).",
75
+ },
76
+ },
77
+ },
78
+ render: (args) => (
79
+ <Accordion {...args}>
80
+ <AccordionItem value="item-1">
81
+ <AccordionTrigger level="h2">What is the purpose of this service?</AccordionTrigger>
82
+
83
+ <AccordionContent>
84
+ This service helps you manage your environmental land management applications and track
85
+ payments.
86
+ </AccordionContent>
87
+ </AccordionItem>
88
+
89
+ <AccordionItem value="item-2">
90
+ <AccordionTrigger level="h2">How do I submit an application?</AccordionTrigger>
91
+
92
+ <AccordionContent>
93
+ Start by checking your eligibility using the tool on the homepage.
94
+ </AccordionContent>
95
+ </AccordionItem>
96
+ </Accordion>
97
+ ),
98
+ };
99
+
100
+ export const SingleOpen: Story = {
101
+ parameters: {
102
+ docs: {
103
+ description: {
104
+ story: 'Only one section can be open at a time. Opening another closes the current one.',
105
+ },
106
+ },
107
+ },
108
+ args: { type: 'single' },
109
+ render: (args) => (
110
+ <Accordion {...args}>
111
+ <AccordionItem value="item-1">
112
+ <AccordionTrigger>Arable land</AccordionTrigger>
113
+
114
+ <AccordionContent>
115
+ Actions available for arable land include winter bird food plots, flower-rich grass
116
+ margins, and no-till cultivation.
117
+ </AccordionContent>
118
+ </AccordionItem>
119
+
120
+ <AccordionItem value="item-2">
121
+ <AccordionTrigger>Grassland</AccordionTrigger>
122
+
123
+ <AccordionContent>
124
+ Grassland actions include low-input farming, diverse swards, and species-rich hay meadow
125
+ restoration.
126
+ </AccordionContent>
127
+ </AccordionItem>
128
+
129
+ <AccordionItem value="item-3">
130
+ <AccordionTrigger>Woodland</AccordionTrigger>
131
+
132
+ <AccordionContent>
133
+ Woodland actions cover creation, management, and improvement of existing woodland habitats
134
+ to support biodiversity.
135
+ </AccordionContent>
136
+ </AccordionItem>
137
+ </Accordion>
138
+ ),
139
+ };
140
+
141
+ export const InSidebar: Story = {
142
+ parameters: {
143
+ docs: {
144
+ description: {
145
+ story:
146
+ 'Shown in a constrained-width panel, as used in the sidebar filter context. The separator lines run edge-to-edge within the container.',
147
+ },
148
+ },
149
+ },
150
+ args: { type: 'multiple' },
151
+ render: (args) => (
152
+ <div className="w-72 border border-divider p-0">
153
+ <Accordion {...args}>
154
+ <AccordionItem value="area">
155
+ <AccordionTrigger>Select area of interest</AccordionTrigger>
156
+
157
+ <AccordionContent>
158
+ <ul className="flex flex-col gap-gds-1 text-sm">
159
+ <li>Arable land</li>
160
+
161
+ <li>Grassland</li>
162
+
163
+ <li>Woodland</li>
164
+
165
+ <li>Wetland</li>
166
+ </ul>
167
+ </AccordionContent>
168
+ </AccordionItem>
169
+
170
+ <AccordionItem value="type">
171
+ <AccordionTrigger>Agreement type</AccordionTrigger>
172
+
173
+ <AccordionContent>
174
+ <ul className="flex flex-col gap-gds-1 text-sm">
175
+ <li>Sustainable Farming Incentive</li>
176
+
177
+ <li>Countryside Stewardship</li>
178
+
179
+ <li>Landscape Recovery</li>
180
+ </ul>
181
+ </AccordionContent>
182
+ </AccordionItem>
183
+
184
+ <AccordionItem value="status">
185
+ <AccordionTrigger>Status</AccordionTrigger>
186
+
187
+ <AccordionContent>
188
+ <ul className="flex flex-col gap-gds-1 text-sm">
189
+ <li>Active</li>
190
+
191
+ <li>Pending</li>
192
+
193
+ <li>Expired</li>
194
+ </ul>
195
+ </AccordionContent>
196
+ </AccordionItem>
197
+ </Accordion>
198
+ </div>
199
+ ),
200
+ };
201
+
202
+ export const DisabledTransition: Story = {
203
+ parameters: {
204
+ docs: {
205
+ description: {
206
+ story:
207
+ 'disableTransition on AccordionContent skips the height animation, opening/closing instantly instead. The animation forces a reflow every frame, fine for text but visibly laggy for something expensive to lay out (a map, a large table).',
208
+ },
209
+ },
210
+ },
211
+ render: (args) => (
212
+ <Accordion {...args}>
213
+ <AccordionItem value="item-1">
214
+ <AccordionTrigger>Ordinary section</AccordionTrigger>
215
+
216
+ <AccordionContent>Animates open/closed as normal.</AccordionContent>
217
+ </AccordionItem>
218
+
219
+ <AccordionItem value="item-2">
220
+ <AccordionTrigger>Expensive-to-render section</AccordionTrigger>
221
+
222
+ <AccordionContent disableTransition>
223
+ Snaps open/closed instantly, no height animation.
224
+ </AccordionContent>
225
+ </AccordionItem>
226
+ </Accordion>
227
+ ),
228
+ };
229
+
230
+ export const WithDisabledItem: Story = {
231
+ args: { type: 'multiple', defaultValue: ['item-2'] },
232
+ parameters: {
233
+ docs: {
234
+ description: {
235
+ story:
236
+ "item-2 starts open to show that a disabled item's content is inert even while expanded — its links and buttons can't be focused or clicked, not just styled to look disabled.",
237
+ },
238
+ },
239
+ },
240
+ render: (args) => (
241
+ <Accordion {...args}>
242
+ <AccordionItem value="item-1">
243
+ <AccordionTrigger>Available section</AccordionTrigger>
244
+
245
+ <AccordionContent>This section is available to expand.</AccordionContent>
246
+ </AccordionItem>
247
+
248
+ <AccordionItem value="item-2" disabled>
249
+ <AccordionTrigger>Unavailable section</AccordionTrigger>
250
+
251
+ <AccordionContent>
252
+ This content is not reachable. <a href="https://example.com">This link</a> cannot be
253
+ focused or clicked.
254
+ </AccordionContent>
255
+ </AccordionItem>
256
+
257
+ <AccordionItem value="item-3">
258
+ <AccordionTrigger>Another available section</AccordionTrigger>
259
+
260
+ <AccordionContent>This section is also available.</AccordionContent>
261
+ </AccordionItem>
262
+ </Accordion>
263
+ ),
264
+ };
@@ -0,0 +1,98 @@
1
+ 'use client';
2
+
3
+ import { createContext, useContext, type ComponentProps } from 'react';
4
+
5
+ import { Accordion as AccordionPrimitive } from 'radix-ui';
6
+ import { LuChevronDown } from 'react-icons/lu';
7
+
8
+ import { cn } from '../../utils/components';
9
+
10
+ const AccordionItemDisabledContext = createContext(false);
11
+
12
+ export type AccordionProps = ComponentProps<typeof AccordionPrimitive.Root>;
13
+
14
+ export const Accordion = ({ className, ...props }: AccordionProps) => (
15
+ <AccordionPrimitive.Root
16
+ data-slot="accordion"
17
+ className={cn('cn-accordion', className)}
18
+ {...props}
19
+ />
20
+ );
21
+
22
+ export type AccordionItemProps = ComponentProps<typeof AccordionPrimitive.Item>;
23
+
24
+ export const AccordionItem = ({ className, disabled, children, ...props }: AccordionItemProps) => (
25
+ <AccordionPrimitive.Item
26
+ data-slot="accordion-item"
27
+ className={cn('cn-accordion-item', className)}
28
+ disabled={disabled}
29
+ {...props}
30
+ >
31
+ <AccordionItemDisabledContext.Provider value={disabled ?? false}>
32
+ {children}
33
+ </AccordionItemDisabledContext.Provider>
34
+ </AccordionPrimitive.Item>
35
+ );
36
+
37
+ export type AccordionTriggerProps = ComponentProps<typeof AccordionPrimitive.Trigger> & {
38
+ /** Radix hardcodes AccordionHeader to an h3 with no way to override it, a
39
+ * problem since the correct level actually depends on where the accordion
40
+ * sits in the consuming page's own heading hierarchy (axe's heading-order
41
+ * rule fails if there's no h2 above an h3, for example). Rendered via
42
+ * asChild onto a real heading at this level instead, defaulting to h3 to
43
+ * match Radix's own default. */
44
+ level?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
45
+ };
46
+
47
+ export const AccordionTrigger = ({
48
+ className,
49
+ children,
50
+ level = 'h3',
51
+ ...props
52
+ }: AccordionTriggerProps) => {
53
+ const Heading = level;
54
+
55
+ return (
56
+ <AccordionPrimitive.Header asChild>
57
+ <Heading className="flex">
58
+ <AccordionPrimitive.Trigger
59
+ data-slot="accordion-trigger"
60
+ className={cn('cn-accordion-trigger', className)}
61
+ {...props}
62
+ >
63
+ {children}
64
+ <LuChevronDown aria-hidden className="cn-accordion-trigger-icon" />
65
+ </AccordionPrimitive.Trigger>
66
+ </Heading>
67
+ </AccordionPrimitive.Header>
68
+ );
69
+ };
70
+
71
+ export type AccordionContentProps = ComponentProps<typeof AccordionPrimitive.Content> & {
72
+ /** Skips the open/close height animation. It animates the `height`
73
+ * property, which forces the browser to reflow on every frame, fine for
74
+ * ordinary text/form content but visibly laggy for something expensive to
75
+ * lay out (a map, a large table). Snaps open/closed instantly instead. */
76
+ disableTransition?: boolean;
77
+ };
78
+
79
+ export const AccordionContent = ({
80
+ className,
81
+ children,
82
+ disableTransition = false,
83
+ ...props
84
+ }: AccordionContentProps) => {
85
+ const isDisabled = useContext(AccordionItemDisabledContext);
86
+
87
+ return (
88
+ <AccordionPrimitive.Content
89
+ data-slot="accordion-content"
90
+ data-disable-transition={disableTransition || undefined}
91
+ className="cn-accordion-content"
92
+ inert={isDisabled}
93
+ {...props}
94
+ >
95
+ <div className={cn('cn-accordion-content-inner', className)}>{children}</div>
96
+ </AccordionPrimitive.Content>
97
+ );
98
+ };
@@ -0,0 +1,129 @@
1
+ @layer components {
2
+ /* MARK: Alert
3
+ Three variants that map to three GDS patterns:
4
+ banner: govuk-notification-banner (coloured header bar + white content)
5
+ outlined: govuk-error-summary (coloured border, white bg)
6
+ filled: govuk-panel (fully coloured bg, centred, large title)
7
+
8
+ Appearance colour is threaded via --alert-color / --alert-on-color so
9
+ variant rules don't need to repeat per-colour logic. Warning uses black
10
+ text/links because yellow backgrounds require dark contrast. */
11
+
12
+ /* MARK: Appearances */
13
+ /* --alert-color / --alert-on-color are used by variant rules below.
14
+ --alert-link-color colours bare <a> tags in title/description/list slots.
15
+ For Link components, use appearance="error" (or the appropriate appearance)
16
+ explicitly, otherwise the content area stays brand-themed. */
17
+ .cn-alert-appearance-info {
18
+ --alert-color: var(--color-blue);
19
+ --alert-on-color: var(--color-white);
20
+ --alert-link-color: var(--color-link);
21
+ }
22
+
23
+ .cn-alert-appearance-success {
24
+ --alert-color: var(--color-success);
25
+ --alert-on-color: var(--color-white);
26
+ --alert-link-color: var(--color-link);
27
+ }
28
+
29
+ .cn-alert-appearance-warning {
30
+ --alert-color: var(--color-warning);
31
+ --alert-on-color: var(--color-on-warning);
32
+ --alert-link-color: var(--color-body);
33
+ }
34
+
35
+ .cn-alert-appearance-error {
36
+ --alert-color: var(--color-error);
37
+ --alert-on-color: var(--color-white);
38
+ --alert-link-color: var(--color-error);
39
+ }
40
+
41
+ /* MARK: Variant, Banner
42
+ Root carries the appearance colour as background, the title area is
43
+ transparent so it inherits that colour. Description/action/list slots
44
+ get a white background, creating the two-tone look. */
45
+ .cn-alert-variant-banner {
46
+ @apply text-base border-form;
47
+ border: var(--border-width-form) solid var(--alert-color);
48
+ background-color: var(--alert-color);
49
+
50
+ &:focus {
51
+ outline: var(--outline-width-focus) solid var(--color-focus);
52
+ }
53
+
54
+ & [data-slot='alert-title'] {
55
+ @apply font-bold;
56
+ padding: 2px var(--spacing-gds-3) var(--spacing-gds-1);
57
+ color: var(--alert-on-color);
58
+ /* transparent border separates header from content in forced-colours mode */
59
+ border-bottom: 1px solid transparent;
60
+ }
61
+
62
+ & [data-slot='alert-body'] {
63
+ @apply p-gds-3 bg-white text-body;
64
+ }
65
+ }
66
+
67
+ /* MARK: Variant, Outlined
68
+ Simple coloured border, white background. Used for error summaries and
69
+ inline notices. Title is bold and slightly larger, with no separate header zone. */
70
+ .cn-alert-variant-outlined {
71
+ @apply text-base;
72
+ border: var(--border-width-form) solid var(--alert-color);
73
+ background-color: var(--color-white);
74
+ color: var(--color-body);
75
+ padding: var(--spacing-gds-3);
76
+
77
+ @media (min-width: 40em) {
78
+ padding: var(--spacing-gds-4);
79
+ }
80
+
81
+ &:focus {
82
+ outline: var(--outline-width-focus) solid var(--color-focus);
83
+ }
84
+
85
+ & [data-slot='alert-title'] {
86
+ @apply text-xl font-bold;
87
+ margin-top: 0;
88
+ margin-bottom: var(--spacing-gds-4);
89
+ }
90
+
91
+ & > :last-child {
92
+ margin-bottom: 0;
93
+ }
94
+ }
95
+
96
+ /* MARK: Variant, Filled
97
+ Fully coloured background, white text, centred. Used for confirmation
98
+ panels (post-transaction success pages). Title is very large, body text
99
+ is smaller (typically a reference number or short confirmation line). */
100
+ .cn-alert-variant-filled {
101
+ @apply box-border border-form border-transparent text-center wrap-break-word;
102
+ padding: calc(var(--spacing-gds-7) - var(--border-width-form));
103
+ background-color: var(--alert-color);
104
+ color: var(--alert-on-color);
105
+
106
+ @media (max-width: 40em) {
107
+ padding: calc(var(--spacing-gds-4) - var(--border-width-form));
108
+ }
109
+
110
+ & [data-slot='alert-title'] {
111
+ @apply text-4xl font-bold mt-0 mb-gds-6;
112
+ }
113
+
114
+ & [data-slot='alert-title']:last-child {
115
+ @apply mb-0;
116
+ }
117
+
118
+ & [data-slot='alert-description'] {
119
+ @apply text-xl;
120
+ }
121
+ }
122
+
123
+ /* MARK: Alert List
124
+ Used inside outlined alerts for error summary link lists.
125
+ Links are coloured with --alert-link-color (appearance-aware). */
126
+ .cn-alert-list {
127
+ @apply list-none m-0 p-0 space-y-gds-2;
128
+ }
129
+ }