@tpzdsp/next-toolkit 2.5.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/package.json +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 +32 -0
  62. package/src/components/ErrorModal/ErrorModal.stories.tsx +101 -0
  63. package/src/components/ErrorModal/ErrorModal.tsx +120 -0
  64. package/src/components/ErrorText/ErrorText.css +22 -0
  65. package/src/components/ErrorText/ErrorText.stories.tsx +42 -27
  66. package/src/components/ErrorText/ErrorText.tsx +10 -8
  67. package/src/components/ExternalLink/ExternalLink.css +12 -0
  68. package/src/components/ExternalLink/ExternalLink.stories.tsx +43 -0
  69. package/src/components/ExternalLink/ExternalLink.tsx +43 -0
  70. package/src/components/Fieldset/Fieldset.css +103 -0
  71. package/src/components/Fieldset/Fieldset.stories.tsx +304 -0
  72. package/src/components/Fieldset/Fieldset.tsx +38 -0
  73. package/src/components/FileUpload/FileUpload.css +85 -0
  74. package/src/components/FileUpload/FileUpload.stories.tsx +106 -0
  75. package/src/components/FileUpload/FileUpload.tsx +99 -0
  76. package/src/components/{layout/footer → Footer}/Copyright.tsx +4 -2
  77. package/src/components/Footer/Footer.stories.tsx +24 -0
  78. package/src/components/Footer/Footer.tsx +41 -0
  79. package/src/components/Footer/Licence.tsx +18 -0
  80. package/src/components/{layout/footer → Footer}/MetaLinks.tsx +8 -3
  81. package/src/components/Footer/Small/SmallFooter.tsx +43 -42
  82. package/src/components/Form/FormGroup.css +18 -0
  83. package/src/components/Form/FormGroup.stories.tsx +87 -0
  84. package/src/components/Form/FormGroup.tsx +16 -0
  85. package/src/components/{layout/header → Header}/Header.stories.tsx +26 -12
  86. package/src/components/Header/Header.test.tsx +87 -0
  87. package/src/components/Header/Header.tsx +303 -0
  88. package/src/components/Header/HeaderAppContent.tsx +120 -0
  89. package/src/components/Heading/Heading.css +40 -0
  90. package/src/components/Heading/Heading.stories.tsx +15 -5
  91. package/src/components/Heading/Heading.tsx +21 -44
  92. package/src/components/Heading/HeadingSkeleton.stories.tsx +30 -0
  93. package/src/components/Heading/HeadingSkeleton.tsx +14 -0
  94. package/src/components/Hero/Hero.css +19 -0
  95. package/src/components/Hero/Hero.stories.tsx +41 -0
  96. package/src/components/Hero/Hero.tsx +14 -0
  97. package/src/components/HintText/HintText.css +5 -0
  98. package/src/components/HintText/HintText.stories.tsx +29 -0
  99. package/src/components/HintText/HintText.tsx +13 -0
  100. package/src/components/InfoBox/InfoBox.css +38 -0
  101. package/src/components/InfoBox/InfoBox.stories.tsx +51 -403
  102. package/src/components/InfoBox/InfoBox.tsx +31 -158
  103. package/src/components/Input/Input.css +77 -0
  104. package/src/components/Input/Input.stories.tsx +123 -0
  105. package/src/components/Input/Input.tsx +74 -0
  106. package/src/components/InputGroup/InputGroup.css +140 -0
  107. package/src/components/InputGroup/InputGroup.stories.tsx +125 -0
  108. package/src/components/InputGroup/InputGroup.tsx +47 -0
  109. package/src/components/InsetText/InsetText.css +5 -0
  110. package/src/components/InsetText/InsetText.stories.tsx +30 -0
  111. package/src/components/InsetText/InsetText.tsx +9 -0
  112. package/src/components/Keyboard/Keyboard.css +9 -0
  113. package/src/components/Keyboard/Keyboard.stories.tsx +63 -0
  114. package/src/components/Keyboard/Keyboard.tsx +30 -0
  115. package/src/components/Label/Label.css +27 -0
  116. package/src/components/Label/Label.stories.tsx +40 -0
  117. package/src/components/Label/Label.tsx +17 -0
  118. package/src/components/LayerSwitcher/LayerSwitcher.css +59 -0
  119. package/src/components/LayerSwitcher/LayerSwitcher.stories.tsx +112 -0
  120. package/src/components/LayerSwitcher/LayerSwitcher.tsx +61 -0
  121. package/src/components/Layout/401/401.stories.tsx +23 -0
  122. package/src/components/Layout/401/401.tsx +1 -0
  123. package/src/components/Layout/403/403.stories.tsx +23 -0
  124. package/src/components/Layout/403/403.tsx +21 -0
  125. package/src/components/Layout/404/404.stories.tsx +23 -0
  126. package/src/components/Layout/404/404.tsx +28 -0
  127. package/src/components/Layout/500/500.stories.tsx +56 -0
  128. package/src/components/Layout/500/500.tsx +63 -0
  129. package/src/components/Layout/ButtonGroup/ButtonGroup.css +52 -0
  130. package/src/components/Layout/ButtonGroup/ButtonGroup.stories.tsx +156 -0
  131. package/src/components/Layout/ButtonGroup/ButtonGroup.tsx +50 -0
  132. package/src/components/Layout/HeadingGroup/HeadingGroup.css +21 -0
  133. package/src/components/Layout/HeadingGroup/HeadingGroup.stories.tsx +84 -0
  134. package/src/components/Layout/HeadingGroup/HeadingGroup.tsx +9 -0
  135. package/src/components/Layout/MainWrapper/MainWrapper.css +12 -0
  136. package/src/components/Layout/MainWrapper/MainWrapper.stories.tsx +36 -0
  137. package/src/components/Layout/MainWrapper/MainWrapper.tsx +14 -0
  138. package/src/components/Layout/PageShell/PageShell.css +42 -0
  139. package/src/components/Layout/PageShell/PageShell.stories.tsx +108 -0
  140. package/src/components/Layout/PageShell/PageShell.tsx +31 -0
  141. package/src/components/Layout/ParagraphGroup/ParagraphGroup.css +5 -0
  142. package/src/components/Layout/ParagraphGroup/ParagraphGroup.stories.tsx +34 -0
  143. package/src/components/Layout/ParagraphGroup/ParagraphGroup.tsx +9 -0
  144. package/src/components/Layout/Stack/Stack.css +29 -0
  145. package/src/components/Layout/Stack/Stack.stories.tsx +83 -0
  146. package/src/components/Layout/Stack/Stack.tsx +19 -0
  147. package/src/components/Layout/WidthContainer/WidthContainer.css +17 -0
  148. package/src/components/Layout/WidthContainer/WidthContainer.stories.tsx +59 -0
  149. package/src/components/Layout/WidthContainer/WidthContainer.tsx +13 -0
  150. package/src/components/Legend/Legend.css +95 -0
  151. package/src/components/Legend/Legend.stories.tsx +81 -0
  152. package/src/components/Legend/Legend.tsx +32 -0
  153. package/src/components/Legend/LegendDot.tsx +15 -0
  154. package/src/components/Legend/LegendPanel.stories.tsx +101 -0
  155. package/src/components/Legend/LegendPanel.tsx +68 -0
  156. package/src/components/Legend/LegendSkeleton.stories.tsx +87 -0
  157. package/src/components/Legend/LegendSkeleton.tsx +73 -0
  158. package/src/components/LegendSelect/LegendSelect.css +8 -0
  159. package/src/components/LegendSelect/LegendSelect.stories.tsx +80 -0
  160. package/src/components/LegendSelect/LegendSelect.tsx +26 -0
  161. package/src/components/Link/Link.css +98 -0
  162. package/src/components/Link/Link.stories.tsx +70 -0
  163. package/src/components/Link/Link.tsx +52 -0
  164. package/src/components/LinkButton/LinkButton.css +67 -0
  165. package/src/components/LinkButton/LinkButton.stories.tsx +90 -42
  166. package/src/components/LinkButton/LinkButton.tsx +50 -63
  167. package/src/components/LinkList/LinkList.css +28 -0
  168. package/src/components/LinkList/LinkList.stories.tsx +46 -0
  169. package/src/components/LinkList/LinkList.tsx +23 -0
  170. package/src/components/List/Li.tsx +9 -0
  171. package/src/components/List/List.css +9 -0
  172. package/src/components/List/OrderedList.stories.tsx +36 -0
  173. package/src/components/List/OrderedList.tsx +9 -0
  174. package/src/components/List/UnorderedList.stories.tsx +36 -0
  175. package/src/components/List/UnorderedList.tsx +9 -0
  176. package/src/components/LoadingBox/LoadingBox.css +27 -0
  177. package/src/components/LoadingBox/LoadingBox.stories.tsx +66 -0
  178. package/src/components/LoadingBox/LoadingBox.tsx +40 -0
  179. package/src/components/Modal/Modal.css +114 -0
  180. package/src/components/Modal/Modal.stories.tsx +41 -160
  181. package/src/components/Modal/Modal.tsx +132 -75
  182. package/src/components/NoScriptBanner/NoScriptBanner.css +17 -0
  183. package/src/components/NoScriptBanner/NoScriptBanner.stories.tsx +46 -0
  184. package/src/components/NoScriptBanner/NoScriptBanner.tsx +26 -0
  185. package/src/components/Paragraph/Paragraph.css +22 -0
  186. package/src/components/Paragraph/Paragraph.stories.tsx +1 -42
  187. package/src/components/Paragraph/Paragraph.tsx +4 -3
  188. package/src/components/Paragraph/ParagraphSkeleton.stories.tsx +44 -0
  189. package/src/components/Paragraph/ParagraphSkeleton.tsx +33 -0
  190. package/src/components/PasswordInput/PasswordInput.css +3 -0
  191. package/src/components/PasswordInput/PasswordInput.stories.tsx +47 -0
  192. package/src/components/PasswordInput/PasswordInput.tsx +45 -0
  193. package/src/components/PhaseBanner/PhaseBanner.css +12 -0
  194. package/src/components/PhaseBanner/PhaseBanner.stories.tsx +61 -0
  195. package/src/components/PhaseBanner/PhaseBanner.tsx +17 -0
  196. package/src/components/Popover/Popover.css +43 -0
  197. package/src/components/Popover/Popover.stories.tsx +102 -0
  198. package/src/components/Popover/Popover.tsx +40 -0
  199. package/src/components/Radio/Radio.css +69 -0
  200. package/src/components/Radio/Radio.stories.tsx +169 -0
  201. package/src/components/Radio/Radio.tsx +56 -0
  202. package/src/components/Resizable/Resizable.css +86 -0
  203. package/src/components/Resizable/Resizable.stories.tsx +123 -0
  204. package/src/components/Resizable/Resizable.tsx +86 -0
  205. package/src/components/ScrollArea/ScrollArea.css +9 -0
  206. package/src/components/ScrollArea/ScrollArea.stories.tsx +42 -0
  207. package/src/components/ScrollArea/ScrollArea.tsx +11 -0
  208. package/src/components/SearchBox/SearchBox.stories.tsx +88 -0
  209. package/src/components/SearchBox/SearchBox.tsx +36 -0
  210. package/src/components/Select/AsyncSelect.stories.tsx +84 -0
  211. package/src/components/Select/AsyncSelect.tsx +41 -0
  212. package/src/components/Select/Select.css +194 -0
  213. package/src/components/Select/Select.stories.tsx +162 -0
  214. package/src/components/Select/Select.test.tsx +36 -0
  215. package/src/components/Select/Select.tsx +291 -0
  216. package/src/components/Select/SelectSkeleton.stories.tsx +51 -0
  217. package/src/components/Select/SelectSkeleton.tsx +23 -0
  218. package/src/components/Separator/Separator.css +41 -0
  219. package/src/components/Separator/Separator.stories.tsx +63 -0
  220. package/src/components/Separator/Separator.tsx +42 -0
  221. package/src/components/Sidebar/ResizableSidebar.tsx +118 -0
  222. package/src/components/Sidebar/Sidebar.css +203 -0
  223. package/src/components/Sidebar/Sidebar.stories.tsx +438 -0
  224. package/src/components/Sidebar/Sidebar.tsx +225 -0
  225. package/src/components/Skeleton/Skeleton.css +16 -0
  226. package/src/components/Skeleton/Skeleton.stories.tsx +39 -0
  227. package/src/components/Skeleton/Skeleton.tsx +12 -0
  228. package/src/components/SkipLink/SkipLink.css +16 -0
  229. package/src/components/SkipLink/SkipLink.stories.tsx +40 -0
  230. package/src/components/SkipLink/SkipLink.tsx +15 -0
  231. package/src/components/Spinner/Spinner.css +30 -0
  232. package/src/components/Spinner/Spinner.stories.tsx +36 -0
  233. package/src/components/Spinner/Spinner.tsx +45 -0
  234. package/src/components/StartButton/StartButton.css +13 -0
  235. package/src/components/StartButton/StartButton.stories.tsx +68 -0
  236. package/src/components/StartButton/StartButton.tsx +50 -0
  237. package/src/components/SubmitButton/SubmitButton.stories.tsx +31 -0
  238. package/src/components/SubmitButton/SubmitButton.tsx +14 -0
  239. package/src/components/SummaryList/SummaryList.css +71 -0
  240. package/src/components/SummaryList/SummaryList.stories.tsx +211 -0
  241. package/src/components/SummaryList/SummaryList.tsx +41 -0
  242. package/src/components/SummaryList/SummaryListSkeleton.stories.tsx +67 -0
  243. package/src/components/SummaryList/SummaryListSkeleton.tsx +40 -0
  244. package/src/components/Tabs/Tabs.css +84 -0
  245. package/src/components/Tabs/Tabs.stories.tsx +133 -0
  246. package/src/components/Tabs/Tabs.tsx +66 -0
  247. package/src/components/Tag/Tag.css +8 -0
  248. package/src/components/Tag/Tag.stories.tsx +96 -0
  249. package/src/components/Tag/Tag.tsx +34 -0
  250. package/src/components/Textarea/Textarea.css +38 -0
  251. package/src/components/Textarea/Textarea.stories.tsx +131 -0
  252. package/src/components/Textarea/Textarea.tsx +50 -0
  253. package/src/components/TextareaCount/TextareaCount.css +17 -0
  254. package/src/components/TextareaCount/TextareaCount.stories.tsx +131 -0
  255. package/src/components/TextareaCount/TextareaCount.tsx +108 -0
  256. package/src/components/Tooltip/Tooltip.css +43 -0
  257. package/src/components/Tooltip/Tooltip.stories.tsx +110 -0
  258. package/src/components/Tooltip/Tooltip.tsx +53 -0
  259. package/src/components/WarningText/WarningText.css +20 -0
  260. package/src/components/WarningText/WarningText.stories.tsx +29 -0
  261. package/src/components/WarningText/WarningText.tsx +17 -0
  262. package/src/components/index.ts +342 -61
  263. package/src/errors/errorDisplay.ts +70 -0
  264. package/src/errors/index.ts +1 -0
  265. package/src/http/constants.ts +1 -0
  266. package/src/http/fetch.ts +7 -3
  267. package/src/map/LayerSwitcherPanel.tsx +2 -173
  268. package/src/map/LegendShim.tsx +2 -0
  269. package/src/map/MapComponent.tsx +7 -17
  270. package/src/map/MapControlsOverlay.tsx +68 -175
  271. package/src/map/Popup.tsx +71 -24
  272. package/src/map/geocoder/Geocoder.test.tsx +46 -3
  273. package/src/map/geocoder/Geocoder.tsx +155 -278
  274. package/src/map/index.ts +1 -1
  275. package/src/types/utils.ts +0 -10
  276. package/src/utils/components.ts +96 -0
  277. package/src/utils/index.ts +1 -0
  278. package/src/utils/utils.ts +0 -12
  279. package/src/assets/images/defra-logo.svg +0 -51
  280. package/src/assets/images/ea-logo.svg +0 -58
  281. package/src/assets/images/ogl.svg +0 -1
  282. package/src/components/Button/Button.test.tsx +0 -53
  283. package/src/components/ButtonLink/ButtonLink.test.tsx +0 -154
  284. package/src/components/Card/Card.test.tsx +0 -51
  285. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +0 -75
  286. package/src/components/ErrorBoundary/ErrorFallback.test.tsx +0 -107
  287. package/src/components/ErrorText/ErrorText.test.tsx +0 -33
  288. package/src/components/Heading/Heading.test.tsx +0 -22
  289. package/src/components/Hint/Hint.stories.tsx +0 -58
  290. package/src/components/Hint/Hint.test.tsx +0 -33
  291. package/src/components/Hint/Hint.tsx +0 -12
  292. package/src/components/InfoBox/InfoBox.test.tsx +0 -330
  293. package/src/components/InfoBox/types.ts +0 -6
  294. package/src/components/LinkButton/LinkButton.test.tsx +0 -177
  295. package/src/components/Modal/Modal.test.tsx +0 -246
  296. package/src/components/NotificationBanner/NotificationBanner.stories.tsx +0 -45
  297. package/src/components/NotificationBanner/NotificationBanner.test.tsx +0 -58
  298. package/src/components/NotificationBanner/NotificationBanner.tsx +0 -45
  299. package/src/components/Paragraph/Paragraph.test.tsx +0 -10
  300. package/src/components/SlidingPanel/SlidingPanel.stories.tsx +0 -129
  301. package/src/components/SlidingPanel/SlidingPanel.test.tsx +0 -83
  302. package/src/components/SlidingPanel/SlidingPanel.tsx +0 -258
  303. package/src/components/accordion/Accordion.stories.tsx +0 -234
  304. package/src/components/accordion/Accordion.test.tsx +0 -192
  305. package/src/components/accordion/Accordion.tsx +0 -73
  306. package/src/components/backToTop/BackToTop.stories.tsx +0 -407
  307. package/src/components/backToTop/BackToTop.test.tsx +0 -57
  308. package/src/components/backToTop/BackToTop.tsx +0 -134
  309. package/src/components/chip/Chip.stories.tsx +0 -61
  310. package/src/components/chip/Chip.test.tsx +0 -31
  311. package/src/components/chip/Chip.tsx +0 -23
  312. package/src/components/container/Container.tsx +0 -42
  313. package/src/components/cookieBanner/CookieBanner.stories.tsx +0 -257
  314. package/src/components/cookieBanner/CookieBanner.test.tsx +0 -68
  315. package/src/components/cookieBanner/CookieBanner.tsx +0 -73
  316. package/src/components/divider/RuleDivider.stories.tsx +0 -254
  317. package/src/components/divider/RuleDivider.test.tsx +0 -164
  318. package/src/components/divider/RuleDivider.tsx +0 -23
  319. package/src/components/dropdown/DropdownMenu.test.tsx +0 -211
  320. package/src/components/dropdown/DropdownMenu.tsx +0 -108
  321. package/src/components/dropdown/useDropdownMenu.ts +0 -249
  322. package/src/components/form/Input.stories.tsx +0 -435
  323. package/src/components/form/Input.test.tsx +0 -206
  324. package/src/components/form/Input.tsx +0 -23
  325. package/src/components/form/TextArea.stories.tsx +0 -464
  326. package/src/components/form/TextArea.test.tsx +0 -232
  327. package/src/components/form/TextArea.tsx +0 -23
  328. package/src/components/layout/footer/Footer.tsx +0 -26
  329. package/src/components/layout/footer/Licence.tsx +0 -19
  330. package/src/components/layout/header/Header.test.tsx +0 -36
  331. package/src/components/layout/header/Header.tsx +0 -90
  332. package/src/components/layout/header/HeaderAuthClient.test.tsx +0 -45
  333. package/src/components/layout/header/HeaderAuthClient.tsx +0 -40
  334. package/src/components/layout/header/HeaderNavClient.test.tsx +0 -44
  335. package/src/components/layout/header/HeaderNavClient.tsx +0 -67
  336. package/src/components/link/ExternalLink.test.tsx +0 -102
  337. package/src/components/link/ExternalLink.tsx +0 -29
  338. package/src/components/link/Link.tsx +0 -26
  339. package/src/components/select/Select.stories.tsx +0 -336
  340. package/src/components/select/Select.test.tsx +0 -474
  341. package/src/components/select/Select.tsx +0 -125
  342. package/src/components/select/SelectSkeleton.stories.tsx +0 -194
  343. package/src/components/select/SelectSkeleton.test.tsx +0 -104
  344. package/src/components/select/SelectSkeleton.tsx +0 -23
  345. package/src/components/select/common.ts +0 -3
  346. package/src/components/select/index.ts +0 -18
  347. package/src/components/skipLink/SkipLink.stories.tsx +0 -346
  348. package/src/components/skipLink/SkipLink.test.tsx +0 -22
  349. package/src/components/skipLink/SkipLink.tsx +0 -49
  350. package/src/map/LegendPanel.tsx +0 -85
  351. /package/src/{components → assets}/images/DefraLogo.tsx +0 -0
  352. /package/src/{components → assets}/images/EaLogo.tsx +0 -0
  353. /package/src/{components → assets}/images/OglLogo.tsx +0 -0
  354. /package/src/components/{googleAnalytics → GoogleAnalytics}/GlobalVars.tsx +0 -0
  355. /package/src/components/{googleAnalytics → GoogleAnalytics}/GoogleAnalytics.tsx +0 -0
@@ -0,0 +1,14 @@
1
+ import type { ComponentProps } from 'react';
2
+
3
+ import { cn } from '../../utils/components';
4
+ import { WidthContainer } from '../Layout/WidthContainer/WidthContainer';
5
+
6
+ export type HeroProps = ComponentProps<typeof WidthContainer>;
7
+
8
+ export const Hero = ({ className, children, ...props }: HeroProps) => {
9
+ return (
10
+ <WidthContainer className={cn('cn-hero', className)} {...props}>
11
+ <section aria-label="Introduction">{children}</section>
12
+ </WidthContainer>
13
+ );
14
+ };
@@ -0,0 +1,5 @@
1
+ @layer components {
2
+ .cn-hint-text {
3
+ @apply text-body-secondary text-base;
4
+ }
5
+ }
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { HintText } from './HintText';
4
+
5
+ const meta: Meta<typeof HintText> = {
6
+ title: 'Components/HintText',
7
+ component: HintText,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'Use hint text for help that’s relevant to the majority of users, like how their information will be used, or where to find it.',
14
+ },
15
+ },
16
+ },
17
+ argTypes: {
18
+ children: { control: 'text' },
19
+ },
20
+ args: {
21
+ children: 'For example, 27 3 2007',
22
+ },
23
+ };
24
+
25
+ export default meta;
26
+
27
+ type Story = StoryObj<typeof HintText>;
28
+
29
+ export const Default: Story = {};
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps } from 'react';
2
+
3
+ import { cn } from '../../utils/components';
4
+
5
+ export type HintTextProps = ComponentProps<'div'>;
6
+
7
+ export const HintText = ({ className, children, ...props }: HintTextProps) => {
8
+ return (
9
+ <div className={cn('cn-hint-text', className)} {...props}>
10
+ {children}
11
+ </div>
12
+ );
13
+ };
@@ -0,0 +1,38 @@
1
+ /* MARK: InfoBox trigger
2
+ Sized in em, not one of Button's fixed icon sizes (cn-icon-sm/base/lg,
3
+ 32/40/48px), those are toolbar/form-control sized and force a much taller
4
+ line box than intended when the trigger sits inline next to running text
5
+ in a Paragraph or Label. 1.25em scales with whatever text it's next to
6
+ instead, staying proportionate whether that's body copy or a heading.
7
+ Bypasses Button entirely (rather than the shared component with a
8
+ className override) since cn-button-size-* always sets its own
9
+ width/height, applying cn-button's own base w-full directly here as well
10
+ (both @utility, same "utilities" layer) means the two compete on equal
11
+ footing, and which one wins turns out not to follow @import order (tested:
12
+ Tailwind doesn't emit @utility rules in file-import order), so width/
13
+ height/padding are !important here, the only way to reliably win against
14
+ another same-layer utility whose output order isn't otherwise
15
+ controllable. */
16
+ @utility cn-info-box-trigger {
17
+ @apply relative inline-flex shrink-0 items-center justify-center;
18
+ width: 1.25em !important;
19
+ height: 1.25em !important;
20
+ padding: 0 !important;
21
+ /* Best-effort alignment with adjacent text, middle sits a little above the
22
+ baseline (roughly the x-height midpoint), closer to visually centred
23
+ against a line of text than the inline-block default of baseline. */
24
+ vertical-align: middle;
25
+
26
+ /* Expands the hit area without changing the visual size, matching the
27
+ resizable handle's ::after technique, small inline icons are otherwise
28
+ an easy miss target, particularly on touch. */
29
+ &::after {
30
+ content: '';
31
+ position: absolute;
32
+ inset: -0.375em;
33
+ }
34
+ }
35
+
36
+ @utility cn-info-box-icon {
37
+ @apply h-full w-full;
38
+ }
@@ -1,460 +1,108 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
3
  import { InfoBox } from './InfoBox';
4
+ import { Label } from '../Label/Label';
5
+ import { Paragraph } from '../Paragraph/Paragraph';
4
6
 
5
- const meta = {
7
+ const meta: Meta<typeof InfoBox> = {
6
8
  title: 'Components/InfoBox',
7
9
  component: InfoBox,
8
- parameters: {
9
- layout: 'centered',
10
- docs: {
11
- description: {
12
- component:
13
- 'An accessible info box component that displays contextual information in a popover triggered by an info icon button. Uses Floating UI for intelligent auto-positioning that adapts to viewport constraints.',
14
- },
15
- },
16
- },
17
10
  tags: ['autodocs'],
18
- argTypes: {
19
- title: {
20
- control: 'text',
21
- description: 'Optional title displayed at the top of the info box content',
22
- },
23
- defaultOpen: {
24
- control: 'boolean',
25
- description: 'Whether the info box starts open',
26
- defaultValue: false,
27
- },
28
- maxWidth: {
29
- control: 'text',
30
- description: 'Maximum width of the content box (default: 320px)',
31
- },
32
- triggerLabel: {
33
- control: 'text',
34
- description: 'Accessible label for the trigger button',
35
- },
36
- placement: {
37
- control: 'select',
38
- options: [
39
- 'top',
40
- 'top-start',
41
- 'top-end',
42
- 'bottom',
43
- 'bottom-start',
44
- 'bottom-end',
45
- 'left',
46
- 'left-start',
47
- 'left-end',
48
- 'right',
49
- 'right-start',
50
- 'right-end',
51
- ],
52
- description:
53
- 'Preferred placement (Floating UI will auto-adjust if there is not enough space)',
54
- },
55
- children: {
56
- control: false,
57
- description: 'Content to display inside the info box',
58
- },
59
- onOpenChange: {
60
- action: 'onOpenChange',
61
- description: 'Callback when the info box opens or closes',
62
- },
63
- },
64
- } satisfies Meta<typeof InfoBox>;
65
-
66
- export default meta;
67
- type Story = StoryObj<typeof meta>;
68
-
69
- export const Default: Story = {
70
- args: {
71
- children: <p>This is helpful information about this feature.</p>,
72
- },
73
- parameters: {
74
- docs: {
75
- description: {
76
- story: 'Basic info box with simple text content. Click the info icon to open.',
77
- },
78
- },
79
- },
80
- };
81
-
82
- export const WithTitle: Story = {
83
- args: {
84
- title: 'Important Information',
85
- children: (
86
- <div className="space-y-2">
87
- <p>Here are some key points to remember:</p>
88
-
89
- <ul className="list-disc list-inside text-sm">
90
- <li>Point one</li>
91
-
92
- <li>Point two</li>
93
-
94
- <li>Point three</li>
95
- </ul>
96
- </div>
97
- ),
98
- },
99
- parameters: {
100
- docs: {
101
- description: {
102
- story: 'Info box with a title header for more structured content.',
103
- },
104
- },
105
- },
106
- };
107
-
108
- export const DefaultOpen: Story = {
109
- args: {
110
- title: 'Getting Started',
111
- defaultOpen: true,
112
- children: <p>This info box starts open by default.</p>,
113
- },
114
11
  parameters: {
115
12
  docs: {
116
13
  description: {
117
- story: 'Info box that starts in the open state.',
118
- },
119
- },
120
- },
121
- };
122
-
123
- export const LongContent: Story = {
124
- args: {
125
- title: 'Detailed Information',
126
- maxWidth: '400px',
127
- children: (
128
- <div className="space-y-2 max-h-48 overflow-y-auto">
129
- <p>
130
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt
131
- ut labore et dolore magna aliqua.
132
- </p>
133
-
134
- <p>
135
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
136
- commodo consequat.
137
- </p>
138
-
139
- <p>
140
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
141
- nulla pariatur.
142
- </p>
143
-
144
- <p>
145
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
146
- anim id est laborum.
147
- </p>
148
- </div>
149
- ),
150
- },
151
- parameters: {
152
- docs: {
153
- description: {
154
- story: 'Info box with longer scrollable content and custom max width.',
14
+ component:
15
+ 'A small icon that opens a Popover panel, the standard pattern for surfacing supplementary information next to a label, heading, or inline within running text, without cluttering the layout. Sized in em rather than one of the fixed icon-button sizes, so it scales with and sits inline alongside whatever text surrounds it. Because it uses Popover (click/tap activated) rather than Tooltip, it works correctly on touch devices.',
155
16
  },
156
17
  },
157
18
  },
158
19
  };
159
20
 
160
- export const AllPositions: Story = {
161
- args: {
162
- children: null,
163
- },
164
- parameters: {
165
- layout: 'fullscreen',
166
- docs: {
167
- description: {
168
- story:
169
- 'Demonstrates various placement options using Floating UI. The content will automatically adjust if there is not enough space.',
170
- },
171
- },
172
- },
173
- render: () => (
174
- <div className="p-8 grid grid-cols-2 gap-8 h-screen">
175
- <div className="flex items-start justify-start">
176
- <div className="flex items-center gap-2">
177
- <span className="text-sm text-gray-600">bottom-start:</span>
178
-
179
- <InfoBox title="Position Demo" placement="bottom-start">
180
- <p>Prefers bottom-start placement.</p>
181
- </InfoBox>
182
- </div>
183
- </div>
184
-
185
- <div className="flex items-start justify-end">
186
- <div className="flex items-center gap-2">
187
- <span className="text-sm text-gray-600">bottom-end:</span>
188
-
189
- <InfoBox title="Position Demo" placement="bottom-end">
190
- <p>Prefers bottom-end placement.</p>
191
- </InfoBox>
192
- </div>
193
- </div>
194
-
195
- <div className="flex items-end justify-start">
196
- <div className="flex items-center gap-2">
197
- <span className="text-sm text-gray-600">top-start:</span>
198
-
199
- <InfoBox title="Position Demo" placement="top-start">
200
- <p>Prefers top-start placement.</p>
201
- </InfoBox>
202
- </div>
203
- </div>
21
+ export default meta;
204
22
 
205
- <div className="flex items-end justify-end">
206
- <div className="flex items-center gap-2">
207
- <span className="text-sm text-gray-600">top-end:</span>
23
+ type Story = StoryObj<typeof InfoBox>;
208
24
 
209
- <InfoBox title="Position Demo" placement="top-end">
210
- <p>Prefers top-end placement.</p>
211
- </InfoBox>
212
- </div>
213
- </div>
214
- </div>
25
+ export const Default: Story = {
26
+ render: (args) => (
27
+ <InfoBox {...args}>
28
+ This field is used to calculate your baseline figures for the agreement period.
29
+ </InfoBox>
215
30
  ),
216
31
  };
217
32
 
218
- export const InCorners: Story = {
219
- args: {
220
- children: null,
221
- },
33
+ export const InParagraph: Story = {
222
34
  parameters: {
223
- layout: 'fullscreen',
224
35
  docs: {
225
36
  description: {
226
- story:
227
- 'Demonstrates auto-positioning when the info box is placed in different corners of the viewport. The info box automatically positions itself to stay visible.',
37
+ story: 'Placed inline within running text, immediately after the sentence it expands on.',
228
38
  },
229
39
  },
230
40
  },
231
- render: () => (
232
- <div className="relative h-screen w-full">
233
- <div className="absolute top-4 left-4 flex items-center gap-2">
234
- <InfoBox>
235
- <p>Auto-positioned from top-left corner. Should open to bottom-right.</p>
236
- </InfoBox>
237
-
238
- <span className="text-xs text-gray-500">Top-left corner</span>
239
- </div>
240
-
241
- <div className="absolute top-4 right-4 flex items-center gap-2">
242
- <span className="text-xs text-gray-500">Top-right corner</span>
243
-
244
- <InfoBox>
245
- <p>Auto-positioned from top-right corner. Should open to bottom-left.</p>
246
- </InfoBox>
247
- </div>
248
-
249
- <div className="absolute bottom-4 left-4 flex items-center gap-2">
250
- <InfoBox>
251
- <p>Auto-positioned from bottom-left corner. Should open to top-right.</p>
252
- </InfoBox>
253
-
254
- <span className="text-xs text-gray-500">Bottom-left corner</span>
255
- </div>
256
-
257
- <div className="absolute bottom-4 right-4 flex items-center gap-2">
258
- <span className="text-xs text-gray-500">Bottom-right corner</span>
259
-
260
- <InfoBox>
261
- <p>Auto-positioned from bottom-right corner. Should open to top-left.</p>
262
- </InfoBox>
263
- </div>
264
-
265
- <div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center">
266
- <p className="text-gray-400 text-sm">
267
- Click the info icons in each corner to see auto-positioning
268
- </p>
269
- </div>
270
- </div>
41
+ render: (args) => (
42
+ <Paragraph>
43
+ This field is used to calculate your baseline figures for the agreement period.{' '}
44
+ <InfoBox {...args}>
45
+ The 12-month window used to calculate your baseline figures. This must fall within your
46
+ agreement start and end dates.
47
+ </InfoBox>
48
+ </Paragraph>
271
49
  ),
272
50
  };
273
51
 
274
- export const WithInteractiveContent: Story = {
275
- args: {
276
- title: 'Take Action',
277
- children: (
278
- <div className="space-y-3">
279
- <p className="text-sm">You can interact with elements inside:</p>
280
-
281
- <input
282
- type="text"
283
- placeholder="Type something..."
284
- className="w-full px-3 py-2 text-sm border border-gray-300 rounded focus:outline-none
285
- focus:ring-2 focus:ring-blue-500"
286
- />
287
-
288
- <button
289
- type="button"
290
- className="w-full px-4 py-2 text-sm text-white bg-blue-600 rounded hover:bg-blue-700
291
- focus:outline-none focus:ring-2 focus:ring-blue-500"
292
- >
293
- Submit
294
- </button>
295
- </div>
296
- ),
297
- },
52
+ export const WithCustomWidth: Story = {
298
53
  parameters: {
299
54
  docs: {
300
55
  description: {
301
56
  story:
302
- 'Info box with interactive content (form elements). Focus is trapped within the info box when open.',
57
+ 'Defaults to max-w-xs so it never grows too wide regardless of content length. Pass a different max-w-* via className to override it.',
303
58
  },
304
59
  },
305
60
  },
306
- };
307
-
308
- export const InlineWithText: Story = {
309
- args: {
310
- children: null,
311
- },
312
- parameters: {
313
- docs: {
314
- description: {
315
- story: 'Info box used inline with paragraph text to provide contextual information.',
316
- },
317
- },
318
- },
319
- render: () => (
320
- <div className="max-w-md p-4">
321
- <p className="text-sm leading-relaxed">
322
- This is a paragraph with an inline info box{' '}
323
- <span className="inline-flex align-middle mx-1">
324
- <InfoBox triggerLabel="Learn more about this term">
325
- <p>Additional context about the preceding text that helps explain the concept.</p>
326
- </InfoBox>
327
- </span>{' '}
328
- that provides more context about a specific term or concept in the text.
329
- </p>
330
- </div>
61
+ render: (args) => (
62
+ <InfoBox {...args} className="max-w-sm">
63
+ This is a longer explanation than usual, spanning more than a couple of lines, to demonstrate
64
+ that the popover still wraps at a sensible width rather than growing to fit all of it on fewer
65
+ lines.
66
+ </InfoBox>
331
67
  ),
332
68
  };
333
69
 
334
- export const CustomTriggerLabel: Story = {
335
- args: {
336
- triggerLabel: 'Learn more about data privacy',
337
- title: 'Data Privacy',
338
- children: (
339
- <div className="space-y-2 text-sm">
340
- <p>Your data is handled securely and in accordance with our privacy policy.</p>
341
-
342
- <a href="https://example.com" className="text-blue-600 hover:underline">
343
- Read our full privacy policy
344
- </a>
345
- </div>
346
- ),
347
- },
70
+ export const NextToLabel: Story = {
348
71
  parameters: {
349
72
  docs: {
350
73
  description: {
351
74
  story:
352
- 'Info box with a custom trigger label for better accessibility context. Screen readers will announce the custom label.',
75
+ 'Placed inline at the end of a form label, no extra wrapper needed, it flows as part of the label text.',
353
76
  },
354
77
  },
355
78
  },
356
- };
357
-
358
- export const MultipleInfoBoxes: Story = {
359
- args: {
360
- children: null,
361
- },
362
- parameters: {
363
- docs: {
364
- description: {
365
- story: 'Multiple info boxes can be used independently on the same page.',
366
- },
367
- },
368
- },
369
- render: () => (
370
- <div className="space-y-4 p-4">
371
- <div className="flex items-center gap-2">
372
- <span className="text-sm font-medium">Username</span>
373
-
374
- <InfoBox triggerLabel="Username requirements">
375
- <p className="text-sm">Username must be 3-20 characters and contain only letters.</p>
376
- </InfoBox>
377
- </div>
378
-
379
- <div className="flex items-center gap-2">
380
- <span className="text-sm font-medium">Password</span>
381
-
382
- <InfoBox triggerLabel="Password requirements">
383
- <div className="text-sm space-y-1">
384
- <p>Password must contain:</p>
385
-
386
- <ul className="list-disc list-inside">
387
- <li>At least 8 characters</li>
388
-
389
- <li>One uppercase letter</li>
390
-
391
- <li>One number</li>
392
- </ul>
393
- </div>
394
- </InfoBox>
395
- </div>
396
-
397
- <div className="flex items-center gap-2">
398
- <span className="text-sm font-medium">Email</span>
399
-
400
- <InfoBox triggerLabel="Why we need your email">
401
- <p className="text-sm">We use your email for account recovery and important updates.</p>
402
- </InfoBox>
403
- </div>
404
- </div>
79
+ render: (args) => (
80
+ <Label htmlFor="reference-period">
81
+ Reference period{' '}
82
+ <InfoBox {...args}>
83
+ The 12-month window used to calculate your baseline figures. This must fall within your
84
+ agreement start and end dates.
85
+ </InfoBox>
86
+ </Label>
405
87
  ),
406
88
  };
407
89
 
408
- export const Accessibility: Story = {
409
- args: {
410
- children: null,
411
- },
90
+ export const NextToHeading: Story = {
412
91
  parameters: {
413
92
  docs: {
414
93
  description: {
415
- story: 'Demonstrates the accessibility features of the InfoBox component.',
94
+ story:
95
+ 'Can also be placed inline at the end of a section heading when the explanation applies to the whole section rather than a single field.',
416
96
  },
417
97
  },
418
98
  },
419
- render: () => (
420
- <div className="space-y-6 max-w-md p-4">
421
- <div className="bg-blue-50 border border-blue-200 rounded p-4">
422
- <h3 className="font-bold text-blue-800 mb-2">Accessibility Features:</h3>
423
-
424
- <ul className="list-disc list-inside space-y-1 text-blue-700 text-sm">
425
- <li>Trigger button has aria-expanded and aria-haspopup</li>
426
-
427
- <li>Content has role=&quot;dialog&quot; and aria-modal=&quot;true&quot;</li>
428
-
429
- <li>Focus is trapped within the info box when open</li>
430
-
431
- <li>Escape key closes the info box</li>
432
-
433
- <li>Click outside closes the info box</li>
434
-
435
- <li>Focus returns to trigger on close (via keyboard)</li>
436
-
437
- <li>Title provides aria-labelledby relationship</li>
438
- </ul>
439
- </div>
440
-
441
- <div className="flex items-center gap-2">
442
- <span className="text-sm">Try this accessible info box:</span>
443
-
444
- <InfoBox title="Accessible Info Box" triggerLabel="Show accessibility information">
445
- <div className="text-sm space-y-2">
446
- <p>This info box demonstrates proper accessibility:</p>
447
-
448
- <ul className="list-disc list-inside">
449
- <li>Use Tab to navigate between elements</li>
450
-
451
- <li>Press Escape to close</li>
452
-
453
- <li>Click outside to close</li>
454
- </ul>
455
- </div>
456
- </InfoBox>
457
- </div>
458
- </div>
99
+ render: (args) => (
100
+ <h2 className="text-lg font-bold">
101
+ Land parcel details{' '}
102
+ <InfoBox {...args} label="About land parcel details">
103
+ Land parcels are identified by their OS grid reference. Only parcels registered under your
104
+ Single Business Identifier are shown.
105
+ </InfoBox>
106
+ </h2>
459
107
  ),
460
108
  };