@scottish-government/designsystem-react 0.7.1 → 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.
- package/@types/common/AbstractNotificationBanner.d.ts +2 -2
- package/@types/common/ActionLink.d.ts +8 -0
- package/@types/common/FileIcon.d.ts +1 -1
- package/@types/common/Icon.d.ts +1 -1
- package/@types/components/Accordion.d.ts +0 -1
- package/@types/components/Breadcrumbs.d.ts +2 -5
- package/@types/components/Checkbox.d.ts +0 -2
- package/@types/components/ConfirmationMessage.d.ts +1 -1
- package/@types/components/ContentsNav.d.ts +4 -6
- package/@types/components/DatePicker.d.ts +1 -1
- package/@types/components/ErrorSummary.d.ts +3 -4
- package/@types/components/NotificationPanel.d.ts +1 -1
- package/@types/components/Pagination.d.ts +5 -4
- package/@types/components/PhaseBanner.d.ts +0 -1
- package/@types/components/Question.d.ts +1 -1
- package/@types/components/RadioButton.d.ts +0 -1
- package/@types/components/Select.d.ts +0 -7
- package/@types/components/SequentialNavigation.d.ts +4 -4
- package/@types/components/SideNavigation.d.ts +4 -5
- package/@types/components/SiteFooter.d.ts +25 -0
- package/@types/components/SiteHeader.d.ts +10 -3
- package/@types/components/SiteNavigation.d.ts +2 -3
- package/@types/components/SkipLinks.d.ts +3 -4
- package/@types/components/SummaryCard.d.ts +0 -2
- package/@types/components/SummaryList.d.ts +0 -13
- package/@types/components/Tabs.d.ts +0 -1
- package/@types/components/Tag.d.ts +1 -3
- package/@types/components/TaskList.d.ts +1 -0
- package/@types/sgds.d.ts +13 -2
- package/CHANGELOG.md +63 -1
- package/dist/common/AbstractNotificationBanner.jsx +8 -6
- package/dist/common/ActionLink.jsx +19 -0
- package/dist/common/FileIcon.jsx +2 -7
- package/dist/common/Icon.jsx +3 -9
- package/dist/components/Accordion/Accordion.jsx +12 -7
- package/dist/components/Breadcrumbs/Breadcrumbs.jsx +20 -15
- package/dist/components/Checkbox/Checkbox.jsx +4 -29
- package/dist/components/Checkbox/CheckboxGroup.jsx +63 -0
- package/dist/components/ContentsNav/ContentsNav.jsx +27 -16
- package/dist/components/CookieBanner/CookieBanner.jsx +1 -0
- package/dist/components/DatePicker/DatePicker.jsx +5 -5
- package/dist/components/ErrorSummary/ErrorSummary.jsx +28 -18
- package/dist/components/NotificationBanner/NotificationBanner.jsx +2 -2
- package/dist/components/Pagination/Pagination.jsx +42 -22
- package/dist/components/PhaseBanner/PhaseBanner.jsx +3 -3
- package/dist/components/Question/Question.jsx +3 -3
- package/dist/components/RadioButton/RadioButton.jsx +7 -17
- package/dist/components/RadioButton/RadioGroup.jsx +21 -0
- package/dist/components/Select/Select.jsx +4 -7
- package/dist/components/SequentialNavigation/SequentialNavigation.jsx +31 -18
- package/dist/components/SideNavigation/SideNavigation.jsx +17 -16
- package/dist/components/SiteFooter/SiteFooter.jsx +104 -0
- package/dist/components/SiteHeader/SiteHeader.jsx +113 -32
- package/dist/components/SiteNavigation/SiteNavigation.jsx +20 -7
- package/dist/components/SkipLinks/SkipLinks.jsx +10 -10
- package/dist/components/SummaryCard/SummaryCard.jsx +25 -14
- package/dist/components/SummaryList/SummaryList.jsx +65 -47
- package/dist/components/Tabs/Tabs.jsx +6 -6
- package/dist/components/Tag/Tag.jsx +2 -2
- package/dist/components/TaskList/TaskList.jsx +14 -3
- package/dist/components/TextInput/TextInput.jsx +3 -3
- package/dist/components/Textarea/Textarea.jsx +3 -3
- package/dist/hooks/useTracking.js +21 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/context.js +5 -0
- package/package.json +2 -2
- package/src/common/AbstractNotificationBanner.test.tsx +1 -1
- package/src/common/AbstractNotificationBanner.tsx +14 -13
- package/src/common/ActionLink.test.tsx +80 -0
- package/src/common/ActionLink.tsx +27 -0
- package/src/common/ConditionalWrapper.tsx +1 -1
- package/src/common/FileIcon.tsx +7 -11
- package/src/common/HintText.tsx +2 -2
- package/src/common/Icon.tsx +13 -17
- package/src/common/ScreenReaderText.tsx +2 -2
- package/src/common/WrapperTag.tsx +2 -2
- package/src/components/Accordion/Accordion.test.tsx +17 -4
- package/src/components/Accordion/Accordion.tsx +19 -14
- package/src/components/AspectBox/AspectBox.tsx +2 -2
- package/src/components/BackToTop/BackToTop.tsx +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.test.tsx +79 -48
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +31 -31
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Checkbox/Checkbox.test.tsx +1 -96
- package/src/components/Checkbox/Checkbox.tsx +8 -55
- package/src/components/Checkbox/CheckboxGroup.test.tsx +37 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +41 -0
- package/src/components/ConfirmationMessage/ConfirmationMessage.tsx +2 -2
- package/src/components/ContentsNav/ContentsNav.test.tsx +40 -51
- package/src/components/ContentsNav/ContentsNav.tsx +32 -25
- package/src/components/CookieBanner/CookieBanner.tsx +3 -3
- package/src/components/DatePicker/DatePicker.test.tsx +1 -1
- package/src/components/DatePicker/DatePicker.tsx +7 -7
- package/src/components/Details/Details.tsx +2 -2
- package/src/components/ErrorMessage/ErrorMessage.tsx +2 -2
- package/src/components/ErrorSummary/ErrorSummary.test.tsx +40 -34
- package/src/components/ErrorSummary/ErrorSummary.tsx +40 -32
- package/src/components/FileDownload/FileDownload.tsx +2 -2
- package/src/components/HideThisPage/HideThisPage.tsx +2 -2
- package/src/components/InsetText/InsetText.tsx +2 -2
- package/src/components/NotificationBanner/NotificationBanner.tsx +6 -7
- package/src/components/NotificationPanel/NotificationPanel.tsx +2 -2
- package/src/components/PageHeader/PageHeader.tsx +2 -2
- package/src/components/PageMetadata/PageMetadata.tsx +4 -5
- package/src/components/Pagination/Pagination.test.tsx +26 -7
- package/src/components/Pagination/Pagination.tsx +70 -36
- package/src/components/PhaseBanner/PhaseBanner.tsx +4 -5
- package/src/components/Question/Question.test.tsx +1 -1
- package/src/components/Question/Question.tsx +5 -5
- package/src/components/RadioButton/RadioButton.test.tsx +7 -126
- package/src/components/RadioButton/RadioButton.tsx +10 -41
- package/src/components/RadioButton/RadioGroup.test.tsx +65 -0
- package/src/components/RadioButton/RadioGroup.tsx +31 -0
- package/src/components/Select/Select.test.tsx +39 -37
- package/src/components/Select/Select.tsx +7 -22
- package/src/components/SequentialNavigation/SequentialNavigation.test.tsx +32 -21
- package/src/components/SequentialNavigation/SequentialNavigation.tsx +52 -30
- package/src/components/SideNavigation/SideNavigation.test.tsx +39 -85
- package/src/components/SideNavigation/SideNavigation.tsx +27 -29
- package/src/components/SiteFooter/SiteFooter.test.tsx +153 -0
- package/src/components/SiteFooter/SiteFooter.tsx +107 -0
- package/src/components/SiteHeader/SiteHeader.test.tsx +87 -79
- package/src/components/SiteHeader/SiteHeader.tsx +103 -40
- package/src/components/SiteNavigation/SiteNavigation.test.tsx +42 -23
- package/src/components/SiteNavigation/SiteNavigation.tsx +28 -16
- package/src/components/SiteSearch/SiteSearch.tsx +2 -2
- package/src/components/SkipLinks/SkipLinks.test.tsx +22 -10
- package/src/components/SkipLinks/SkipLinks.tsx +16 -15
- package/src/components/SummaryCard/SummaryCard.test.tsx +31 -35
- package/src/components/SummaryCard/SummaryCard.tsx +39 -28
- package/src/components/SummaryList/SummaryList.test.tsx +49 -148
- package/src/components/SummaryList/SummaryList.tsx +54 -92
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +14 -15
- package/src/components/Tag/Tag.test.tsx +4 -4
- package/src/components/Tag/Tag.tsx +4 -4
- package/src/components/TaskList/TaskList.test.tsx +26 -0
- package/src/components/TaskList/TaskList.tsx +21 -11
- package/src/components/TextInput/TextInput.test.tsx +1 -1
- package/src/components/TextInput/TextInput.tsx +5 -5
- package/src/components/Textarea/Textarea.test.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +5 -5
- package/src/components/WarningText/WarningText.tsx +2 -2
- package/src/hooks/useTracking.test.tsx +64 -0
- package/src/hooks/useTracking.ts +19 -0
- package/src/utils/context.ts +3 -0
- package/tsconfig.json +1 -1
package/@types/common/Icon.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
declare namespace SGDS.Component {
|
|
2
2
|
namespace Breadcrumbs {
|
|
3
3
|
interface Item extends React.AllHTMLAttributes<HTMLElement> {
|
|
4
|
-
|
|
5
|
-
|
|
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,15 +1,13 @@
|
|
|
1
1
|
declare namespace SGDS.Component {
|
|
2
2
|
namespace ContentsNav {
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
12
|
-
label: string,
|
|
10
|
+
ariaLabel: React.AriaAttributes['aria-label'],
|
|
13
11
|
title: string
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
declare namespace SGDS.Component {
|
|
2
2
|
namespace ErrorSummary {
|
|
3
|
-
interface
|
|
4
|
-
fragmentId
|
|
5
|
-
|
|
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,17 +1,18 @@
|
|
|
1
1
|
declare namespace SGDS.Component {
|
|
2
2
|
namespace Pagination {
|
|
3
3
|
interface Page extends React.AllHTMLAttributes<HTMLElement> {
|
|
4
|
-
ariaLabel:
|
|
4
|
+
ariaLabel: React.AriaAttributes['aria-label'],
|
|
5
5
|
current?: boolean,
|
|
6
6
|
href: string,
|
|
7
|
-
|
|
8
|
-
|
|
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:
|
|
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,
|
|
@@ -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
|
|
@@ -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
|
-
|
|
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?:
|
|
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
|
-
|
|
5
|
-
root?: boolean
|
|
4
|
+
isRoot?: boolean
|
|
6
5
|
}
|
|
7
6
|
|
|
8
|
-
interface
|
|
7
|
+
interface Item extends React.AllHTMLAttributes<HTMLLIElement> {
|
|
9
8
|
current?: boolean,
|
|
10
9
|
href: string,
|
|
11
|
-
|
|
10
|
+
linkComponent?: SGDS.LinkComponent,
|
|
12
11
|
title: string,
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
interface SideNavigation extends React.AllHTMLAttributes<HTMLElement> {
|
|
17
|
-
|
|
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
|
|
11
|
+
alt?: string,
|
|
5
12
|
href?: string,
|
|
6
|
-
src
|
|
13
|
+
src?: string
|
|
7
14
|
},
|
|
8
|
-
navigationItems: SGDS.Component.SiteNavigation.
|
|
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
|
|
3
|
+
interface Item extends React.AllHTMLAttributes<HTMLLIElement> {
|
|
4
4
|
current?: boolean,
|
|
5
5
|
href: string,
|
|
6
|
-
|
|
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
|
-
|
|
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,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
|
}
|
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.
|
|
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,
|
|
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
|
-
|
|
17
|
-
|
|
16
|
+
const thisChild = child;
|
|
17
|
+
if (thisChild && thisChild.type === Buttons) {
|
|
18
|
+
buttons = thisChild;
|
|
18
19
|
}
|
|
19
20
|
else {
|
|
20
|
-
content.push(
|
|
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
|
-
|
|
38
|
-
|
|
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;
|
package/dist/common/FileIcon.jsx
CHANGED
|
@@ -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
|
|
43
|
-
|
|
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;
|
package/dist/common/Icon.jsx
CHANGED
|
@@ -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
|
|
43
|
-
|
|
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;
|