@scottish-government/designsystem-react 0.7.0 → 0.8.0-beta.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 (211) hide show
  1. package/@types/common/AbstractNotificationBanner.d.ts +2 -2
  2. package/@types/common/ActionLink.d.ts +8 -0
  3. package/@types/common/FileIcon.d.ts +1 -1
  4. package/@types/common/Icon.d.ts +1 -1
  5. package/@types/components/Accordion.d.ts +0 -1
  6. package/@types/components/Breadcrumbs.d.ts +2 -5
  7. package/@types/components/Checkbox.d.ts +0 -2
  8. package/@types/components/ConfirmationMessage.d.ts +1 -1
  9. package/@types/components/ContentsNav.d.ts +4 -6
  10. package/@types/components/DatePicker.d.ts +1 -1
  11. package/@types/components/ErrorSummary.d.ts +3 -4
  12. package/@types/components/NotificationPanel.d.ts +1 -1
  13. package/@types/components/Pagination.d.ts +5 -4
  14. package/@types/components/PhaseBanner.d.ts +0 -1
  15. package/@types/components/Question.d.ts +1 -1
  16. package/@types/components/RadioButton.d.ts +0 -1
  17. package/@types/components/Select.d.ts +0 -7
  18. package/@types/components/SequentialNavigation.d.ts +4 -4
  19. package/@types/components/SideNavigation.d.ts +4 -5
  20. package/@types/components/SiteFooter.d.ts +25 -0
  21. package/@types/components/SiteHeader.d.ts +10 -3
  22. package/@types/components/SiteNavigation.d.ts +2 -3
  23. package/@types/components/SkipLinks.d.ts +3 -4
  24. package/@types/components/SummaryCard.d.ts +0 -2
  25. package/@types/components/SummaryList.d.ts +0 -13
  26. package/@types/components/Tabs.d.ts +0 -1
  27. package/@types/components/Tag.d.ts +1 -3
  28. package/@types/components/TaskList.d.ts +1 -0
  29. package/@types/sgds.d.ts +13 -2
  30. package/CHANGELOG.md +63 -1
  31. package/dist/common/AbstractNotificationBanner.jsx +8 -6
  32. package/dist/common/ActionLink.jsx +19 -0
  33. package/dist/common/FileIcon.jsx +2 -7
  34. package/dist/common/Icon.jsx +3 -9
  35. package/dist/components/Accordion/Accordion.jsx +12 -7
  36. package/dist/components/Breadcrumbs/Breadcrumbs.jsx +20 -15
  37. package/dist/components/Checkbox/Checkbox.jsx +4 -29
  38. package/dist/components/{aspect-box/aspect-box.jsx → Checkbox/CheckboxGroup.jsx} +14 -30
  39. package/dist/components/ContentsNav/ContentsNav.jsx +27 -16
  40. package/dist/components/CookieBanner/CookieBanner.jsx +1 -0
  41. package/dist/components/DatePicker/DatePicker.jsx +5 -5
  42. package/dist/components/ErrorSummary/ErrorSummary.jsx +28 -18
  43. package/dist/components/NotificationBanner/NotificationBanner.jsx +2 -2
  44. package/dist/components/Pagination/Pagination.jsx +42 -22
  45. package/dist/components/PhaseBanner/PhaseBanner.jsx +3 -3
  46. package/dist/components/Question/Question.jsx +3 -3
  47. package/dist/components/RadioButton/RadioButton.jsx +7 -17
  48. package/dist/components/RadioButton/RadioGroup.jsx +21 -0
  49. package/dist/components/Select/Select.jsx +4 -7
  50. package/dist/components/SequentialNavigation/SequentialNavigation.jsx +31 -18
  51. package/dist/components/SideNavigation/SideNavigation.jsx +17 -16
  52. package/dist/components/SiteFooter/SiteFooter.jsx +104 -0
  53. package/dist/components/SiteHeader/SiteHeader.jsx +113 -32
  54. package/dist/components/SiteNavigation/SiteNavigation.jsx +20 -7
  55. package/dist/components/SkipLinks/SkipLinks.jsx +10 -10
  56. package/dist/components/SummaryCard/SummaryCard.jsx +25 -14
  57. package/dist/components/SummaryList/SummaryList.jsx +65 -47
  58. package/dist/components/Tabs/Tabs.jsx +6 -6
  59. package/dist/components/Tag/Tag.jsx +2 -2
  60. package/dist/components/TaskList/TaskList.jsx +14 -3
  61. package/dist/components/TextInput/TextInput.jsx +3 -3
  62. package/dist/components/Textarea/Textarea.jsx +3 -3
  63. package/dist/hooks/useTracking.js +21 -0
  64. package/dist/tsconfig.tsbuildinfo +1 -1
  65. package/dist/utils/context.js +5 -0
  66. package/package.json +2 -2
  67. package/src/common/AbstractNotificationBanner.test.tsx +1 -1
  68. package/src/common/AbstractNotificationBanner.tsx +14 -13
  69. package/src/common/ActionLink.test.tsx +80 -0
  70. package/src/common/ActionLink.tsx +27 -0
  71. package/src/common/ConditionalWrapper.tsx +1 -1
  72. package/src/common/FileIcon.tsx +7 -11
  73. package/src/common/HintText.tsx +2 -2
  74. package/src/common/Icon.tsx +13 -17
  75. package/src/common/ScreenReaderText.tsx +2 -2
  76. package/src/common/WrapperTag.tsx +2 -2
  77. package/src/components/Accordion/Accordion.test.tsx +17 -4
  78. package/src/components/Accordion/Accordion.tsx +19 -14
  79. package/src/components/AspectBox/AspectBox.tsx +2 -2
  80. package/src/components/BackToTop/BackToTop.tsx +2 -2
  81. package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +79 -48
  82. package/src/components/Breadcrumbs/Breadcrumbs.tsx +31 -31
  83. package/src/components/Button/Button.tsx +2 -2
  84. package/src/components/Checkbox/Checkbox.test.tsx +1 -96
  85. package/src/components/Checkbox/Checkbox.tsx +8 -55
  86. package/src/components/Checkbox/CheckboxGroup.test.tsx +37 -0
  87. package/src/components/Checkbox/CheckboxGroup.tsx +41 -0
  88. package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +2 -2
  89. package/src/components/ContentsNav/ContentsNav.test.tsx +40 -51
  90. package/src/components/ContentsNav/ContentsNav.tsx +32 -25
  91. package/src/components/CookieBanner/CookieBanner.tsx +3 -3
  92. package/src/components/DatePicker/DatePicker.test.tsx +1 -1
  93. package/src/components/DatePicker/DatePicker.tsx +7 -7
  94. package/src/components/Details/Details.tsx +2 -2
  95. package/src/components/ErrorMessage/ErrorMessage.tsx +2 -2
  96. package/src/components/ErrorSummary/ErrorSummary.test.tsx +40 -34
  97. package/src/components/ErrorSummary/ErrorSummary.tsx +40 -32
  98. package/src/components/FileDownload/FileDownload.tsx +2 -2
  99. package/src/components/HideThisPage/HideThisPage.tsx +2 -2
  100. package/src/components/InsetText/InsetText.tsx +2 -2
  101. package/src/components/NotificationBanner/NotificationBanner.tsx +6 -7
  102. package/src/components/NotificationPanel/NotificationPanel.tsx +2 -2
  103. package/src/components/PageHeader/PageHeader.tsx +2 -2
  104. package/src/components/PageMetadata/PageMetadata.tsx +4 -5
  105. package/src/components/Pagination/Pagination.test.tsx +26 -7
  106. package/src/components/Pagination/Pagination.tsx +70 -36
  107. package/src/components/PhaseBanner/PhaseBanner.tsx +4 -5
  108. package/src/components/Question/Question.test.tsx +1 -1
  109. package/src/components/Question/Question.tsx +5 -5
  110. package/src/components/RadioButton/RadioButton.test.tsx +7 -126
  111. package/src/components/RadioButton/RadioButton.tsx +10 -41
  112. package/src/components/RadioButton/RadioGroup.test.tsx +65 -0
  113. package/src/components/RadioButton/RadioGroup.tsx +31 -0
  114. package/src/components/Select/Select.test.tsx +39 -37
  115. package/src/components/Select/Select.tsx +7 -22
  116. package/src/components/SequentialNavigation/SequentialNavigation.test.tsx +32 -21
  117. package/src/components/SequentialNavigation/SequentialNavigation.tsx +52 -30
  118. package/src/components/SideNavigation/SideNavigation.test.tsx +39 -85
  119. package/src/components/SideNavigation/SideNavigation.tsx +27 -29
  120. package/src/components/SiteFooter/SiteFooter.test.tsx +153 -0
  121. package/src/components/SiteFooter/SiteFooter.tsx +107 -0
  122. package/src/components/SiteHeader/SiteHeader.test.tsx +87 -79
  123. package/src/components/SiteHeader/SiteHeader.tsx +103 -40
  124. package/src/components/SiteNavigation/SiteNavigation.test.tsx +42 -23
  125. package/src/components/SiteNavigation/SiteNavigation.tsx +28 -16
  126. package/src/components/SiteSearch/SiteSearch.tsx +2 -2
  127. package/src/components/SkipLinks/SkipLinks.test.tsx +22 -10
  128. package/src/components/SkipLinks/SkipLinks.tsx +16 -15
  129. package/src/components/SummaryCard/SummaryCard.test.tsx +31 -35
  130. package/src/components/SummaryCard/SummaryCard.tsx +39 -28
  131. package/src/components/SummaryList/SummaryList.test.tsx +49 -148
  132. package/src/components/SummaryList/SummaryList.tsx +54 -92
  133. package/src/components/Table/Table.tsx +2 -2
  134. package/src/components/Tabs/Tabs.tsx +14 -15
  135. package/src/components/Tag/Tag.test.tsx +4 -4
  136. package/src/components/Tag/Tag.tsx +4 -4
  137. package/src/components/TaskList/TaskList.test.tsx +26 -0
  138. package/src/components/TaskList/TaskList.tsx +21 -11
  139. package/src/components/TextInput/TextInput.test.tsx +1 -1
  140. package/src/components/TextInput/TextInput.tsx +5 -5
  141. package/src/components/Textarea/Textarea.test.tsx +1 -1
  142. package/src/components/Textarea/Textarea.tsx +5 -5
  143. package/src/components/WarningText/WarningText.tsx +2 -2
  144. package/src/hooks/useTracking.test.tsx +64 -0
  145. package/src/hooks/useTracking.ts +19 -0
  146. package/src/utils/context.ts +3 -0
  147. package/tsconfig.json +1 -1
  148. package/dist/common/abstract-notification-banner.jsx +0 -63
  149. package/dist/common/conditional-wrapper.jsx +0 -8
  150. package/dist/common/file-icon.jsx +0 -51
  151. package/dist/common/hint-text.jsx +0 -9
  152. package/dist/common/icon.jsx +0 -57
  153. package/dist/common/screen-reader-text.jsx +0 -9
  154. package/dist/common/wrapper-tag.jsx +0 -11
  155. package/dist/components/accordion/accordion.jsx +0 -102
  156. package/dist/components/back-to-top/back-to-top.jsx +0 -27
  157. package/dist/components/breadcrumbs/breadcrumbs.jsx +0 -28
  158. package/dist/components/button/button.jsx +0 -30
  159. package/dist/components/checkbox/checkbox.jsx +0 -62
  160. package/dist/components/confirmation-message/confirmation-message.jsx +0 -24
  161. package/dist/components/contents-nav/contents-nav.jsx +0 -33
  162. package/dist/components/cookie-banner/cookie-banner.jsx +0 -21
  163. package/dist/components/date-picker/date-picker.jsx +0 -54
  164. package/dist/components/details/details.jsx +0 -17
  165. package/dist/components/error-message/error-message.jsx +0 -12
  166. package/dist/components/error-summary/error-summary.jsx +0 -27
  167. package/dist/components/file-download/file-download.jsx +0 -50
  168. package/dist/components/hide-this-page/hide-this-page.jsx +0 -71
  169. package/dist/components/inset-text/inset-text.jsx +0 -14
  170. package/dist/components/notification-banner/notification-banner.jsx +0 -26
  171. package/dist/components/notification-panel/notification-panel.jsx +0 -21
  172. package/dist/components/page-header/page-header.jsx +0 -15
  173. package/dist/components/page-metadata/page-metadata.jsx +0 -26
  174. package/dist/components/pagination/pagination.jsx +0 -97
  175. package/dist/components/phase-banner/phase-banner.jsx +0 -23
  176. package/dist/components/question/question.jsx +0 -22
  177. package/dist/components/radio-button/radio-button.jsx +0 -43
  178. package/dist/components/select/select.jsx +0 -52
  179. package/dist/components/sequential-navigation/sequential-navigation.jsx +0 -31
  180. package/dist/components/side-navigation/side-navigation.jsx +0 -52
  181. package/dist/components/site-header/site-header.jsx +0 -68
  182. package/dist/components/site-navigation/site-navigation.jsx +0 -22
  183. package/dist/components/site-search/site-search.jsx +0 -55
  184. package/dist/components/skip-links/skip-links.jsx +0 -21
  185. package/dist/components/summary-card/summary-card.jsx +0 -67
  186. package/dist/components/summary-list/summary-list.jsx +0 -75
  187. package/dist/components/table/table.jsx +0 -24
  188. package/dist/components/tabs/tabs.jsx +0 -99
  189. package/dist/components/tag/tag.jsx +0 -13
  190. package/dist/components/task-list/task-list.jsx +0 -95
  191. package/dist/components/text-input/text-input.jsx +0 -58
  192. package/dist/components/textarea/textarea.jsx +0 -54
  193. package/dist/components/warning-text/warning-text.jsx +0 -16
  194. package/dist/icons/ArrowUpward.jsx +0 -41
  195. package/dist/icons/CalendarToday.jsx +0 -41
  196. package/dist/icons/Cancel.jsx +0 -40
  197. package/dist/icons/CheckCircle.jsx +0 -41
  198. package/dist/icons/ChevronLeft.jsx +0 -41
  199. package/dist/icons/ChevronRight.jsx +0 -41
  200. package/dist/icons/Close.jsx +0 -41
  201. package/dist/icons/Description.jsx +0 -41
  202. package/dist/icons/DoubleChevronLeft.jsx +0 -40
  203. package/dist/icons/DoubleChevronRight.jsx +0 -40
  204. package/dist/icons/Error.jsx +0 -41
  205. package/dist/icons/ExpandLess.jsx +0 -41
  206. package/dist/icons/ExpandMore.jsx +0 -41
  207. package/dist/icons/List.jsx +0 -44
  208. package/dist/icons/Menu.jsx +0 -41
  209. package/dist/icons/PriorityHigh.jsx +0 -42
  210. package/dist/icons/Search.jsx +0 -41
  211. package/dist/icons/index.js +0 -40
@@ -9,8 +9,8 @@ declare namespace SGDS.Common {
9
9
  close?: boolean,
10
10
  hasIcon?: boolean,
11
11
  icon?: IconName,
12
- iconColour?: boolean,
13
- iconInverse?: boolean,
12
+ hasColourIcon?: boolean,
13
+ hasInverseIcon?: boolean,
14
14
  title: string,
15
15
  ref?: any
16
16
  }
@@ -0,0 +1,8 @@
1
+ declare namespace SGDS.Common {
2
+ interface ActionLink extends React.AllHTMLAttributes<HTMLElement> {
3
+ describedby: string,
4
+ href?: string,
5
+ linkComponent?: SGDS.LinkComponent,
6
+ onclick?: React.EventHandler<any>
7
+ }
8
+ }
@@ -1,6 +1,6 @@
1
1
  declare namespace SGDS.Common {
2
2
  interface FileIcon extends React.AllHTMLAttributes<SVGSVGElement> {
3
- ariaLabel?: string,
3
+ ariaLabel?: React.AriaAttributes['aria-label'],
4
4
  className?: string,
5
5
  icon: DocumentIconName
6
6
  }
@@ -1,6 +1,6 @@
1
1
  declare namespace SGDS.Common {
2
2
  interface Icon extends React.AllHTMLAttributes<SVGSVGElement> {
3
- ariaLabel?: string,
3
+ ariaLabel?: React.AriaAttributes['aria-label'],
4
4
  className?: string,
5
5
  fill?: boolean,
6
6
  icon: IconName,
@@ -1,7 +1,6 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace Accordion {
3
3
  interface Item extends React.AllHTMLAttributes<HTMLElement> {
4
- headingLevel?: SGDS.HeadingLevel,
5
4
  id: string,
6
5
  open?: boolean,
7
6
  title: string
@@ -1,14 +1,11 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace Breadcrumbs {
3
3
  interface Item extends React.AllHTMLAttributes<HTMLElement> {
4
- hidden?: boolean,
5
- href?: string,
6
- title: string
4
+ isHidden?: boolean,
5
+ linkComponent?: SGDS.LinkComponent
7
6
  }
8
7
  }
9
8
 
10
9
  interface Breadcrumbs extends React.AllHTMLAttributes<HTMLElement> {
11
- hideLastItem?: boolean,
12
- items: Breadcrumbs.Item[]
13
10
  }
14
11
  }
@@ -1,13 +1,11 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace Checkbox {
3
3
  interface Group extends React.AllHTMLAttributes<HTMLElement> {
4
- items: Checkbox[],
5
4
  small?: boolean
6
5
  }
7
6
  }
8
7
 
9
8
  interface Checkbox extends CheckboxRadioBase<HTMLInputElement> {
10
9
  exclusive?: boolean
11
- id: string
12
10
  }
13
11
  }
@@ -1,6 +1,6 @@
1
1
  declare namespace SGDS.Component {
2
2
  interface ConfirmationMessage extends React.AllHTMLAttributes<HTMLElement> {
3
- ariaLive: AriaLive,
3
+ ariaLive: React.AriaAttributes['aria-live'],
4
4
  headingLevel: HeadingLevel,
5
5
  title: string
6
6
  }
@@ -1,15 +1,13 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace ContentsNav {
3
- interface Link extends React.AllHTMLAttributes<HTMLElement> {
4
- title: string,
5
- current: boolean,
6
- href: string
3
+ interface ContentsNavItem extends React.AllHTMLAttributes<HTMLElement> {
4
+ current?: boolean,
5
+ linkComponent?: SGDS.LinkComponent;
7
6
  }
8
7
  }
9
8
 
10
9
  interface ContentsNav extends React.AllHTMLAttributes<HTMLElement> {
11
- items: ContentsNav.Link[],
12
- label: string,
10
+ ariaLabel: React.AriaAttributes['aria-label'],
13
11
  title: string
14
12
  }
15
13
  }
@@ -2,7 +2,7 @@ declare namespace SGDS.Component {
2
2
  interface DatePicker extends React.AllHTMLAttributes<HTMLElement> {
3
3
  dateSelectCallback?: Function;
4
4
  disabledDates?: string,
5
- error?: boolean,
5
+ hasError?: boolean,
6
6
  errorMessage?: string,
7
7
  id: string,
8
8
  hintText?: string,
@@ -1,13 +1,12 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace ErrorSummary {
3
- interface Error extends React.AllHTMLAttributes<HTMLElement> {
4
- fragmentId?: string
5
- title: string
3
+ interface Item extends React.AllHTMLAttributes<HTMLElement> {
4
+ fragmentId: string,
5
+ linkComponent: SGDS.LinkComponent
6
6
  }
7
7
  }
8
8
 
9
9
  interface ErrorSummary extends React.AllHTMLAttributes<HTMLElement> {
10
- errors?: ErrorSummary.Error[],
11
10
  title: string
12
11
  }
13
12
  }
@@ -1,6 +1,6 @@
1
1
  declare namespace SGDS.Component {
2
2
  interface NotificationPanel extends React.AllHTMLAttributes<HTMLDivElement> {
3
- ariaLive?: AriaLive,
3
+ ariaLive?: React.AriaAttributes['aria-live'],
4
4
  headingLevel?: HeadingLevel,
5
5
  title: string
6
6
  }
@@ -1,17 +1,18 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace Pagination {
3
3
  interface Page extends React.AllHTMLAttributes<HTMLElement> {
4
- ariaLabel: string,
4
+ ariaLabel: React.AriaAttributes['aria-label'],
5
5
  current?: boolean,
6
6
  href: string,
7
- onClick?: React.EventHandler<any>,
8
- text: string
7
+ linkComponent?: SGDS.LinkComponent,
8
+ onClick?: React.EventHandler<any>
9
9
  }
10
10
  }
11
11
 
12
12
  interface Pagination extends React.AllHTMLAttributes<HTMLElement> {
13
- ariaLabel: string,
13
+ ariaLabel: React.AriaAttributes['aria-label'],
14
14
  className?: string,
15
+ linkComponent?: SGDS.LinkComponent,
15
16
  onClick?: React.EventHandler<any>,
16
17
  padding: number,
17
18
  page: number,
@@ -1,6 +1,5 @@
1
1
  declare namespace SGDS.Component {
2
2
  interface PhaseBanner extends React.AllHTMLAttributes<HTMLDivElement> {
3
- content?: string,
4
3
  phaseName: string
5
4
  }
6
5
  }
@@ -2,8 +2,8 @@ declare namespace SGDS.Component {
2
2
  type QuestionTags = 'div' | 'fieldset';
3
3
 
4
4
  interface Question extends React.AllHTMLAttributes<HTMLElement> {
5
- error?: boolean,
6
5
  errorMessage?: string,
6
+ hasError?: boolean,
7
7
  hintText?: string,
8
8
  legend?: string,
9
9
  tagName: QuestionTags
@@ -2,7 +2,6 @@ declare namespace SGDS.Component {
2
2
  namespace RadioButton {
3
3
  interface Group extends React.AllHTMLAttributes<HTMLElement> {
4
4
  inline?: boolean,
5
- items: RadioButton[],
6
5
  name: string,
7
6
  small?: boolean
8
7
  }
@@ -1,13 +1,6 @@
1
1
  declare namespace SGDS.Component {
2
- namespace Select {
3
- interface Option extends React.AllHTMLAttributes<HTMLOptionElement> {
4
- text: string
5
- }
6
- }
7
-
8
2
  interface Select extends FormFieldBase<HTMLDivElement> {
9
3
  defaultValue?: string,
10
- options: Select.Option[],
11
4
  placeholder?: string,
12
5
  width?: InputWidth
13
6
  }
@@ -2,13 +2,13 @@ declare namespace SGDS.Component {
2
2
  namespace SequentialNavigation {
3
3
  interface Link extends React.AllHTMLAttributes<HTMLDivElement> {
4
4
  href: string,
5
- title: string
5
+ isPrev?: boolean,
6
+ linkComponent?: SGDS.LinkComponent,
7
+ textLabel: string
6
8
  }
7
9
  }
8
10
 
9
11
  interface SequentialNavigation extends React.AllHTMLAttributes<HTMLElement> {
10
- ariaLabel?: string,
11
- next?: SequentialNavigation.Link,
12
- previous?: SequentialNavigation.Link
12
+ ariaLabel?: React.AriaAttributes['aria-label']
13
13
  }
14
14
  }
@@ -1,19 +1,18 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace SideNavigation {
3
3
  interface List extends React.AllHTMLAttributes<HTMLUListElement> {
4
- items?: SideNavigation.Link[],
5
- root?: boolean
4
+ isRoot?: boolean
6
5
  }
7
6
 
8
- interface Link extends React.AllHTMLAttributes<HTMLLIElement> {
7
+ interface Item extends React.AllHTMLAttributes<HTMLLIElement> {
9
8
  current?: boolean,
10
9
  href: string,
11
- items?: SideNavigation.Link[]
10
+ linkComponent?: SGDS.LinkComponent,
12
11
  title: string,
13
12
  }
14
13
  }
15
14
 
16
15
  interface SideNavigation extends React.AllHTMLAttributes<HTMLElement> {
17
- items: SideNavigation.Link[]
16
+
18
17
  }
19
18
  }
@@ -0,0 +1,25 @@
1
+ declare namespace SGDS.Component {
2
+ namespace SiteFooter {
3
+ interface Links extends React.AllHTMLAttributes<HTMLUListElement> {
4
+ }
5
+
6
+ interface Link extends React.AllHTMLAttributes<HTMLLIElement> {
7
+ href?: string,
8
+ linkComponent?: SGDS.LinkComponent
9
+ }
10
+
11
+ interface License extends React.AllHTMLAttributes<HTMLDivElement> {
12
+ href?: string,
13
+ logoSrc?: string
14
+ }
15
+
16
+ interface Org extends React.AllHTMLAttributes<HTMLDivElement> {
17
+ href?: string,
18
+ title: string
19
+ }
20
+ }
21
+
22
+ interface SiteFooter extends React.AllHTMLAttributes<HTMLElement> {
23
+
24
+ }
25
+ }
@@ -1,11 +1,18 @@
1
1
  declare namespace SGDS.Component {
2
+ namespace SiteHeader {
3
+ interface Brand extends React.AllHTMLAttributes<HTMLElement> {
4
+ homeUrl: string,
5
+ linkComponent?: SGDS.LinkComponent,
6
+ siteTitle?: string
7
+ }
8
+ }
2
9
  interface SiteHeader extends React.AllHTMLAttributes<HTMLHeadingElement> {
3
10
  logo?: {
4
- alt: string,
11
+ alt?: string,
5
12
  href?: string,
6
- src: string
13
+ src?: string
7
14
  },
8
- navigationItems: SGDS.Component.SiteNavigation.Link[],
15
+ navigationItems: SGDS.Component.SiteNavigation.Item[],
9
16
  phaseBanner?: SGDS.Component.PhaseBanner,
10
17
  siteSearch?: SGDS.Component.SiteSearch,
11
18
  siteTitle?: string
@@ -1,14 +1,13 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace SiteNavigation {
3
- interface Link extends React.AllHTMLAttributes<HTMLLIElement> {
3
+ interface Item extends React.AllHTMLAttributes<HTMLLIElement> {
4
4
  current?: boolean,
5
5
  href: string,
6
- title: string
6
+ linkComponent?: SGDS.LinkComponent
7
7
  }
8
8
  }
9
9
 
10
10
  interface SiteNavigation extends React.AllHTMLAttributes<HTMLElement> {
11
- items: SiteNavigation.Link[],
12
11
  ref?: React.RefObject<null>
13
12
  }
14
13
  }
@@ -1,14 +1,13 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace SkipLinks {
3
3
  interface Link extends React.AllHTMLAttributes<HTMLLIElement> {
4
- targetId: string,
5
- title: string
4
+ fragmentId: string
6
5
  }
7
6
  }
8
7
 
9
8
  interface SkipLinks extends React.AllHTMLAttributes<HTMLDivElement> {
10
- items?: SkipLinks.Link[],
11
9
  mainContentId?: string,
12
- mainLinkText?: string
10
+ mainLinkText?: string,
11
+ isStatic?: boolean
13
12
  }
14
13
  }
@@ -1,8 +1,6 @@
1
1
  declare namespace SGDS.Component {
2
2
  interface SummaryCard extends React.AllHTMLAttributes<HTMLElement> {
3
- actions?: SummaryList.Action[],
4
3
  headingLevel?: SGDS.HeadingLevel,
5
- items: SummaryList.Item[],
6
4
  title: string
7
5
  }
8
6
  }
@@ -1,27 +1,14 @@
1
1
  declare namespace SGDS.Component {
2
2
  namespace SummaryList {
3
- interface Action extends React.AllHTMLAttributes<HTMLElement> {
4
- describedby: string,
5
- href?: string,
6
- onclick?: React.EventHandler<any>,
7
- title: string
8
- }
9
-
10
3
  interface Answer extends React.AllHTMLAttributes<HTMLElement> {
11
- value: number | string
12
4
  }
13
5
 
14
6
  interface Item extends React.LiHTMLAttributes<HTMLLIElement> {
15
- actions?: SummaryList.Action[],
16
- index: number,
17
7
  title: string
18
- value?: string | string[]
19
8
  }
20
-
21
9
  }
22
10
 
23
11
  interface SummaryList extends React.OlHTMLAttributes<HTMLOListElement> {
24
- items: SummaryList.Item[],
25
12
  noBorder?: boolean
26
13
  }
27
14
  }
@@ -7,7 +7,6 @@ declare namespace SGDS.Component {
7
7
  }
8
8
 
9
9
  interface TabListItem extends React.AllHTMLAttributes<HTMLLIElement> {
10
- title: string,
11
10
  href: string
12
11
  }
13
12
  }
@@ -1,7 +1,5 @@
1
1
  declare namespace SGDS.Component {
2
2
  interface Tag extends React.AllHTMLAttributes<HTMLElement> {
3
- className?: string,
4
- colour?: TagColour,
5
- title: string
3
+ colour?: TagColour
6
4
  }
7
5
  }
@@ -9,6 +9,7 @@ declare namespace SGDS.Component {
9
9
  href?: string,
10
10
  id?: string,
11
11
  isComplete?: boolean,
12
+ linkComponent?: SGDS.LinkComponent,
12
13
  statusText?: string,
13
14
  tagColour?: TagColour,
14
15
  title: string
package/@types/sgds.d.ts CHANGED
@@ -1,11 +1,22 @@
1
1
  declare namespace SGDS {
2
- type AriaLive = 'polite' | 'assertive';
3
2
  type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
4
3
  type IconName = 'ArrowUpward' | 'CalendarToday' | 'Cancel' | 'CheckCircle' | 'ChevronLeft' | 'ChevronRight' | 'Close' | 'Description' | 'DoubleChevronLeft' | 'DoubleChevronRight' | 'Error' | 'ExpandLess' | 'ExpandMore' | 'List' | 'Menu' | 'PriorityHigh' | 'Search';
5
4
  type DocumentIconName = 'Audio' | 'Csv' | 'Excel' | 'File' | 'Generic' | 'Geodata' | 'Ical' | 'Ico' | 'Image' | 'Odf' | 'Odg' | 'Odp' | 'Ods' | 'Odt' | 'Pdf' | 'Ppt' | 'Rtf' | 'Text' | 'Video' | 'Word' | 'Xml' | 'Zip';
6
5
  type InputWidth = 'fixed-20' | 'fixed-10' | 'fixed-5' | 'fixed-4' | 'fixed-3' | 'fixed-2' | 'fluid-three-quarters' | 'fluid-two-thirds' | 'fluid-half' | 'fluid-one-third' | 'fluid-one-quarter';
7
6
  type TagColour = 'grey' | 'green' | 'teal' | 'blue' | 'purple' | 'pink' | 'red' | 'orange' | 'yellow';
8
7
 
8
+ type LinkComponent = (linkComponent: LinkComponentProps) => React.ReactNode;
9
+
10
+ type LinkComponentProps = {
11
+ 'aria-label'?: React.AriaAttributes['aria-label'],
12
+ 'aria-current'?: React.AriaAttributes['aria-current'];
13
+ 'aria-describedby'?: React.AriaAttributes['aria-describedby'];
14
+ children?: React.ReactNode,
15
+ className?: string,
16
+ href?: string,
17
+ onClick?: React.EventHandler<any>
18
+ }
19
+
9
20
  interface CheckboxRadioBase<T> extends React.AllHTMLAttributes<T> {
10
21
  checked?: boolean,
11
22
  hintText?: string,
@@ -18,8 +29,8 @@ declare namespace SGDS {
18
29
  }
19
30
 
20
31
  interface FormFieldBase<T> extends React.AllHTMLAttributes <T> {
21
- error?: boolean,
22
32
  errorMessage?: string,
33
+ hasError?: boolean,
23
34
  id: string,
24
35
  hintText?: string,
25
36
  label: string,
package/CHANGELOG.md CHANGED
@@ -7,7 +7,69 @@ Changes are grouped under the labels: `Added`, `Changed`, `Deprecated`, `Fixed`,
7
7
 
8
8
  ---
9
9
 
10
- ## [0.7.0]
10
+ ## [0.8.0] - 2025-08-18
11
+ ## Added
12
+ - ActionLink component, centralising behaviour used in actions in both SummaryCard and SummaryList
13
+ - SiteFooter component
14
+ - Add support for the SkipLinks 'static' variant
15
+
16
+ ## Changed
17
+
18
+ Two headline changes:
19
+
20
+ 1. Components that used an array of data to populate their children have been changed to use explicit child components.
21
+ Affected components:
22
+ - Breadcrumbs
23
+ - Checkbox/CheckboxGroup
24
+ - ContentsNav
25
+ - ErrorSummary
26
+ - RadioButton/RadioGroup
27
+ - Select
28
+ - SequentialNavigation
29
+ - SideNavigation
30
+ - SiteHeader
31
+ - SiteNavigation
32
+ - SkipLinks
33
+ - SummaryCard
34
+ - SummaryList
35
+
36
+ 2. Many components that use links now accept a `linkComponent` param to provide a mechanism for overriding the default `<a>` element, for example to allow the use of the Next.js `<Link>` component.
37
+ Affected components:
38
+ - ActionLink
39
+ - Breadcrumbs
40
+ - ContentsNav
41
+ - ErrorSummary
42
+ - Pagination
43
+ - SequentialNavigation
44
+ - SideNavigation
45
+ - SiteFooter
46
+ - SiteHeader
47
+ - TaskList
48
+
49
+ Other component changes:
50
+
51
+ - Prop names for many boolean properties made more explicit:
52
+ - form fields (and Question) use `hasError` (was: `error`)
53
+ - AbstractNotificationBanner (and components extending it) uses `hasColourIcon` and `hasInverseIcon` (was: `colourIcon`, `inverseIcon`)
54
+ - Breadcrumb.Item uses `isHidden` (was: `hidden`)
55
+ - SideNavigation.List uses `isRoot` (was: `root`)
56
+ - PhaseBanner and Tag only use their children instead of allowing content to be passed through a prop
57
+ - SequentialNav allows custom 'previous' and 'next' text labels
58
+ - SkipLinks will add a default link if it has no children; if any children are added the default link will not be included (i.e. include your own 'main' link if you're adding additional skip links)
59
+
60
+ Maintenance:
61
+
62
+ - Reduce use of legacy React APIs
63
+ - remove use of `isValidElement`
64
+ - Icon and FileIcon use JSX instead of `React.createElement`
65
+ - Components no longer use `React.FC<>` in their definitions
66
+ - ARIA attributes in props now derive their types from the React ARIA types
67
+
68
+ ## [0.7.1] - 2025-08-04
69
+ ### Removed
70
+ - Cleaned up unwanted items in the 'dist' folder
71
+
72
+ ## [0.7.0] - 2025-08-01
11
73
  ### Changed
12
74
  - Change all component file names to Pascal case
13
75
  - Use uppercase text for const variable names
@@ -9,15 +9,16 @@ const ScreenReaderText_1 = __importDefault(require("./ScreenReaderText"));
9
9
  const Buttons = ({ children }) => {
10
10
  return (<>{children}</>);
11
11
  };
12
- const AbstractNotificationBanner = ({ children, className, close, icon, iconColour, iconInverse, title = 'Information', ...props }) => {
12
+ const AbstractNotificationBanner = ({ children, className, close, hasColourIcon, hasInverseIcon, icon, title = 'Information', ...props }) => {
13
13
  let content = [];
14
14
  let buttons;
15
15
  react_1.Children.forEach(children, (child) => {
16
- if ((0, react_1.isValidElement)(child) && child.type === Buttons) {
17
- buttons = child;
16
+ const thisChild = child;
17
+ if (thisChild && thisChild.type === Buttons) {
18
+ buttons = thisChild;
18
19
  }
19
20
  else {
20
- content.push(child);
21
+ content.push(thisChild);
21
22
  }
22
23
  });
23
24
  return (<div className={[
@@ -34,8 +35,8 @@ const AbstractNotificationBanner = ({ children, className, close, icon, iconColo
34
35
  {icon &&
35
36
  <span className={[
36
37
  'ds_notification__icon',
37
- iconInverse && 'ds_notification__icon--inverse',
38
- iconColour && 'ds_notification__icon--colour'
38
+ hasInverseIcon && 'ds_notification__icon--inverse',
39
+ hasColourIcon && 'ds_notification__icon--colour'
39
40
  ].join(' ')} aria-hidden="true">
40
41
  <Icon_1.default icon={icon}/>
41
42
  </span>}
@@ -60,4 +61,5 @@ const AbstractNotificationBanner = ({ children, className, close, icon, iconColo
60
61
  };
61
62
  AbstractNotificationBanner.displayName = 'AbstractNotificationBanner';
62
63
  AbstractNotificationBanner.Buttons = Buttons;
64
+ Buttons.displayName = 'Buttons';
63
65
  exports.default = AbstractNotificationBanner;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ActionLink = ({ children, describedby, href, linkComponent, onclick }) => {
4
+ const CLASSNAME = 'ds_link';
5
+ function processChildren(children) {
6
+ if (linkComponent) {
7
+ return linkComponent({ className: CLASSNAME, href, children, onClick: onclick, 'aria-describedby': describedby });
8
+ }
9
+ else if (href) {
10
+ return <a aria-describedby={describedby} onClick={onclick} href={href} className={CLASSNAME}>{children}</a>;
11
+ }
12
+ else {
13
+ return <button type="button" aria-describedby={describedby} onClick={onclick} className={CLASSNAME}>{children}</button>;
14
+ }
15
+ }
16
+ return (processChildren(children));
17
+ };
18
+ ActionLink.displayName = 'ActionLink';
19
+ exports.default = ActionLink;
@@ -39,13 +39,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const react_1 = __importDefault(require("react"));
40
40
  const FileIcons = __importStar(require("../images/documents"));
41
41
  const FileIcon = ({ ariaLabel = '', className, icon }) => {
42
- const Component = react_1.default.createElement(FileIcons[icon], {
43
- className: className,
44
- 'aria-label': ariaLabel
45
- });
46
- return (<>
47
- {Component}
48
- </>);
42
+ const FileIconComponent = FileIcons[icon];
43
+ return (<FileIconComponent aria-label={ariaLabel} className={className}/>);
49
44
  };
50
45
  FileIcon.displayName = 'FileIcon';
51
46
  exports.default = FileIcon;
@@ -39,19 +39,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  const react_1 = __importDefault(require("react"));
40
40
  const Icons = __importStar(require("../images/icons"));
41
41
  const Icon = ({ ariaLabel, className, fill, icon, iconSize }) => {
42
- const Component = react_1.default.createElement(Icons[icon], {
43
- 'aria-hidden': ariaLabel ? undefined : true,
44
- 'aria-label': ariaLabel,
45
- className: [
42
+ const IconComponent = Icons[icon];
43
+ return (<IconComponent aria-hidden={ariaLabel ? undefined : true} aria-label={ariaLabel} className={[
46
44
  'ds_icon',
47
45
  className,
48
46
  fill && 'ds_icon--fill',
49
47
  iconSize && `ds_icon--${iconSize}`
50
- ].join(' ')
51
- });
52
- return (<>
53
- {Component}
54
- </>);
48
+ ].join(' ')}/>);
55
49
  };
56
50
  Icon.displayName = 'Icon';
57
51
  exports.default = Icon;