@scottish-government/designsystem-react 0.10.2 → 0.12.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 (175) hide show
  1. package/@types/components/Accordion.d.ts +3 -2
  2. package/@types/components/ButtonGroup.d.ts +5 -0
  3. package/@types/components/PageHeader.d.ts +2 -1
  4. package/@types/components/RadioButton.d.ts +2 -2
  5. package/@types/components/SearchFacets.d.ts +18 -0
  6. package/@types/components/SearchFilters.d.ts +14 -0
  7. package/@types/components/SearchResult.d.ts +30 -0
  8. package/@types/components/SearchSort.d.ts +9 -0
  9. package/@types/components/SideNavigation.d.ts +1 -1
  10. package/CHANGELOG.md +39 -5
  11. package/dist/common/AbstractNotificationBanner.d.ts +9 -0
  12. package/dist/common/ActionLink.d.ts +5 -0
  13. package/dist/common/ConditionalWrapper.d.ts +8 -0
  14. package/dist/common/FileIcon.d.ts +6 -0
  15. package/dist/common/HintText.d.ts +5 -0
  16. package/dist/common/Icon.d.ts +6 -0
  17. package/dist/common/ScreenReaderText.d.ts +5 -0
  18. package/dist/common/WrapperTag.d.ts +8 -0
  19. package/dist/components/Accordion/Accordion.d.ts +10 -0
  20. package/dist/components/Accordion/Accordion.jsx +8 -3
  21. package/dist/components/AspectBox/AspectBox.d.ts +6 -0
  22. package/dist/components/BackToTop/BackToTop.d.ts +5 -0
  23. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +9 -0
  24. package/dist/components/Button/Button.d.ts +5 -0
  25. package/dist/components/ButtonGroup/ButtonGroup.d.ts +5 -0
  26. package/dist/components/ButtonGroup/ButtonGroup.jsx +13 -0
  27. package/dist/components/CategoryItem/CategoryItem.d.ts +5 -0
  28. package/dist/components/CategoryList/CategoryList.d.ts +6 -0
  29. package/dist/components/Checkbox/Checkbox.d.ts +5 -0
  30. package/dist/components/Checkbox/CheckboxGroup.d.ts +6 -0
  31. package/dist/components/ConfirmationMessage/ConfirmationMessage.d.ts +5 -0
  32. package/dist/components/ContentsNav/ContentsNav.d.ts +10 -0
  33. package/dist/components/CookieBanner/CookieBanner.d.ts +9 -0
  34. package/dist/components/DatePicker/DatePicker.d.ts +5 -0
  35. package/dist/components/Details/Details.d.ts +5 -0
  36. package/dist/components/ErrorMessage/ErrorMessage.d.ts +5 -0
  37. package/dist/components/ErrorSummary/ErrorSummary.d.ts +9 -0
  38. package/dist/components/FileDownload/FileDownload.d.ts +5 -0
  39. package/dist/components/HideThisPage/HideThisPage.d.ts +6 -0
  40. package/dist/components/InsetText/InsetText.d.ts +5 -0
  41. package/dist/components/NotificationBanner/NotificationBanner.d.ts +9 -0
  42. package/dist/components/NotificationPanel/NotificationPanel.d.ts +5 -0
  43. package/dist/components/PageHeader/PageHeader.d.ts +5 -0
  44. package/dist/components/PageHeader/PageHeader.jsx +2 -2
  45. package/dist/components/PageMetadata/PageMetadata.d.ts +9 -0
  46. package/dist/components/Pagination/Pagination.d.ts +7 -0
  47. package/dist/components/PhaseBanner/PhaseBanner.d.ts +5 -0
  48. package/dist/components/Question/Question.d.ts +5 -0
  49. package/dist/components/RadioButton/RadioButton.d.ts +5 -0
  50. package/dist/components/RadioButton/RadioGroup.d.ts +6 -0
  51. package/dist/components/RadioButton/RadioGroup.jsx +1 -1
  52. package/dist/components/SearchFacets/SearchFacets.d.ts +14 -0
  53. package/dist/components/SearchFacets/SearchFacets.jsx +101 -0
  54. package/dist/components/SearchFilters/SearchFilters.d.ts +16 -0
  55. package/dist/components/SearchFilters/SearchFilters.jsx +63 -0
  56. package/dist/components/SearchResult/SearchResult.d.ts +28 -0
  57. package/dist/components/SearchResult/SearchResult.jsx +93 -0
  58. package/dist/components/SearchSort/SearchSort.d.ts +10 -0
  59. package/dist/components/SearchSort/SearchSort.jsx +28 -0
  60. package/dist/components/Select/Select.d.ts +5 -0
  61. package/dist/components/SequentialNavigation/SequentialNavigation.d.ts +13 -0
  62. package/dist/components/SequentialNavigation/SequentialNavigation.jsx +0 -1
  63. package/dist/components/SideNavigation/SideNavigation.d.ts +13 -0
  64. package/dist/components/SideNavigation/SideNavigation.jsx +2 -2
  65. package/dist/components/SiteFooter/SiteFooter.d.ts +22 -0
  66. package/dist/components/SiteHeader/SiteHeader.d.ts +22 -0
  67. package/dist/components/SiteHeader/SiteHeader.jsx +0 -1
  68. package/dist/components/SiteNavigation/SiteNavigation.d.ts +9 -0
  69. package/dist/components/SiteSearch/SiteSearch.d.ts +5 -0
  70. package/dist/components/SkipLinks/SkipLinks.d.ts +10 -0
  71. package/dist/components/SkipLinks/SkipLinks.jsx +42 -0
  72. package/dist/components/SummaryCard/SummaryCard.d.ts +10 -0
  73. package/dist/components/SummaryList/SummaryList.d.ts +18 -0
  74. package/dist/components/Table/Table.d.ts +5 -0
  75. package/dist/components/Tabs/Tabs.d.ts +10 -0
  76. package/dist/components/Tag/Tag.d.ts +5 -0
  77. package/dist/components/TaskList/TaskList.d.ts +13 -0
  78. package/dist/components/TextInput/TextInput.d.ts +5 -0
  79. package/dist/components/Textarea/Textarea.d.ts +5 -0
  80. package/dist/components/WarningText/WarningText.d.ts +5 -0
  81. package/dist/hooks/useTracking.d.ts +1 -0
  82. package/dist/images/documents/audio.d.ts +4 -0
  83. package/dist/images/documents/csv.d.ts +4 -0
  84. package/dist/images/documents/excel.d.ts +4 -0
  85. package/dist/images/documents/file.d.ts +4 -0
  86. package/dist/images/documents/generic.d.ts +4 -0
  87. package/dist/images/documents/geodata.d.ts +4 -0
  88. package/dist/images/documents/ical.d.ts +4 -0
  89. package/dist/images/documents/ico.d.ts +4 -0
  90. package/dist/images/documents/image.d.ts +4 -0
  91. package/dist/images/documents/index.d.ts +22 -0
  92. package/dist/images/documents/odf.d.ts +4 -0
  93. package/dist/images/documents/odg.d.ts +4 -0
  94. package/dist/images/documents/odp.d.ts +4 -0
  95. package/dist/images/documents/ods.d.ts +4 -0
  96. package/dist/images/documents/odt.d.ts +4 -0
  97. package/dist/images/documents/pdf.d.ts +4 -0
  98. package/dist/images/documents/ppt.d.ts +4 -0
  99. package/dist/images/documents/rtf.d.ts +4 -0
  100. package/dist/images/documents/text.d.ts +4 -0
  101. package/dist/images/documents/video.d.ts +4 -0
  102. package/dist/images/documents/word.d.ts +4 -0
  103. package/dist/images/documents/xml.d.ts +4 -0
  104. package/dist/images/documents/zip.d.ts +4 -0
  105. package/dist/images/icons/arrow_upward.d.ts +4 -0
  106. package/dist/images/icons/calendar_today.d.ts +4 -0
  107. package/dist/images/icons/cancel.d.ts +4 -0
  108. package/dist/images/icons/check_circle.d.ts +4 -0
  109. package/dist/images/icons/chevron_left.d.ts +4 -0
  110. package/dist/images/icons/chevron_right.d.ts +4 -0
  111. package/dist/images/icons/close.d.ts +4 -0
  112. package/dist/images/icons/description.d.ts +4 -0
  113. package/dist/images/icons/double_chevron_left.d.ts +4 -0
  114. package/dist/images/icons/double_chevron_right.d.ts +4 -0
  115. package/dist/images/icons/error.d.ts +4 -0
  116. package/dist/images/icons/expand_less.d.ts +4 -0
  117. package/dist/images/icons/expand_more.d.ts +4 -0
  118. package/dist/images/icons/index.d.ts +17 -0
  119. package/dist/images/icons/list.d.ts +4 -0
  120. package/dist/images/icons/menu.d.ts +4 -0
  121. package/dist/images/icons/priority_high.d.ts +4 -0
  122. package/dist/images/icons/search.d.ts +4 -0
  123. package/dist/tsconfig.tsbuildinfo +1 -1
  124. package/dist/utils/context.d.ts +4 -0
  125. package/package.json +6 -6
  126. package/src/components/Accordion/Accordion.Item.stories.tsx +10 -9
  127. package/src/components/Accordion/Accordion.stories.tsx +4 -4
  128. package/src/components/Accordion/Accordion.test.tsx +48 -14
  129. package/src/components/Accordion/Accordion.tsx +12 -1
  130. package/src/components/Breadcrumbs/Breadcrumbs.Item.stories.tsx +8 -1
  131. package/src/components/Button/Button.stories.tsx +1 -1
  132. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +41 -0
  133. package/src/components/ButtonGroup/ButtonGroup.test.tsx +45 -0
  134. package/src/components/ButtonGroup/ButtonGroup.tsx +20 -0
  135. package/src/components/ContentsNav/ContentsNav.Item.stories.tsx +8 -0
  136. package/src/components/ErrorSummary/ErrorSummary.Item.stories.tsx +7 -0
  137. package/src/components/PageHeader/PageHeader.tsx +2 -1
  138. package/src/components/PageMetadata/PageMetadata.Item.stories.tsx +9 -0
  139. package/src/components/RadioButton/RadioGroup.tsx +2 -2
  140. package/src/components/SearchFacets/SearchFacets.Group.stories.tsx +56 -0
  141. package/src/components/SearchFacets/SearchFacets.Item.stories.tsx +53 -0
  142. package/src/components/SearchFacets/SearchFacets.stories.tsx +38 -0
  143. package/src/components/SearchFacets/SearchFacets.test.tsx +214 -0
  144. package/src/components/SearchFacets/SearchFacets.tsx +99 -0
  145. package/src/components/SearchFilters/SearchFilters.Panel.stories.tsx +201 -0
  146. package/src/components/SearchFilters/SearchFilters.stories.tsx +137 -0
  147. package/src/components/SearchFilters/SearchFilters.test.tsx +161 -0
  148. package/src/components/SearchFilters/SearchFilters.tsx +89 -0
  149. package/src/components/SearchResult/SearchResult.stories.tsx +111 -0
  150. package/src/components/SearchResult/SearchResult.test.tsx +215 -0
  151. package/src/components/SearchResult/SearchResult.tsx +137 -0
  152. package/src/components/SearchSort/SearchSort.stories.tsx +32 -0
  153. package/src/components/SearchSort/SearchSort.test.tsx +129 -0
  154. package/src/components/SearchSort/SearchSort.tsx +45 -0
  155. package/src/components/SequentialNavigation/SequentialNavigation.Next.stories.tsx +1 -1
  156. package/src/components/SequentialNavigation/SequentialNavigation.Previous.stories.tsx +1 -1
  157. package/src/components/SequentialNavigation/SequentialNavigation.tsx +0 -1
  158. package/src/components/SideNavigation/SideNavigation.Item.stories.tsx +9 -0
  159. package/src/components/SideNavigation/SideNavigation.List.stories.tsx +7 -0
  160. package/src/components/SideNavigation/SideNavigation.tsx +2 -1
  161. package/src/components/SiteFooter/SiteFooter.License.stories.tsx +7 -0
  162. package/src/components/SiteFooter/SiteFooter.Link.stories.tsx +9 -0
  163. package/src/components/SiteFooter/SiteFooter.Org.stories.tsx +7 -0
  164. package/src/components/SiteHeader/SiteHeader.tsx +0 -2
  165. package/src/components/SiteNavigation/SiteNavigation.Item.stories.tsx +10 -0
  166. package/src/components/SkipLinks/SkipLinks.Item.stories.tsx +11 -1
  167. package/src/components/SkipLinks/SkipLinks.tsx +10 -0
  168. package/src/components/SummaryCard/SummaryCard.Action.stories.tsx +7 -0
  169. package/src/components/SummaryCard/SummaryCard.stories.tsx +7 -0
  170. package/src/components/SummaryList/SummaryList.Item.stories.tsx +15 -0
  171. package/src/components/SummaryList/SummaryList.Value.stories.tsx +5 -2
  172. package/src/components/Tabs/Tabs.Item.stories.tsx +4 -1
  173. package/src/components/TaskList/TaskList.Group.stories.tsx +9 -0
  174. package/src/components/TaskList/TaskList.Item.stories.tsx +7 -0
  175. package/tsconfig.json +14 -14
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const react_1 = __importStar(require("react"));
40
+ const Icon_1 = __importDefault(require("../../common/Icon"));
41
+ const icons_1 = require("../../../src/images/icons");
42
+ const FacetsItem = ({ accessibleName, joinContent, onClick, title, ...props }) => {
43
+ accessibleName = accessibleName ? accessibleName : title;
44
+ return (<dd className="ds_facet-wrapper" {...props}>
45
+ {joinContent &&
46
+ <span aria-hidden="true">{joinContent}</span>}
47
+ <span className="ds_facet">
48
+ {title}
49
+ <button type="button" onClick={onClick} aria-label={`Remove '${accessibleName}' filter`} className="ds_facet__button">
50
+ <Icon_1.default className="ds_facet__button-icon" aria-hidden="true" role="img" icon="Cancel"/>
51
+ </button>
52
+ </span>
53
+ </dd>);
54
+ };
55
+ const FacetsGroup = ({ children, joinContent = 'or', title, ...props }) => {
56
+ return (<div className="ds_facet-group" {...props}>
57
+ <dt className="ds_facet__group-title">
58
+ {title.trim()}:
59
+ </dt>
60
+ {react_1.Children.map(children, (child, index) => {
61
+ const thisChild = child;
62
+ return react_1.default.cloneElement(thisChild, { joinContent: index > 0 ? joinContent : undefined, key: 'facet' + index });
63
+ })}
64
+ </div>);
65
+ };
66
+ const Facets = ({ children, className, ...props }) => {
67
+ let facetCount = 0;
68
+ function processChild(item) {
69
+ if (item.type.displayName === 'Facets.Item') {
70
+ facetCount = facetCount + 1;
71
+ }
72
+ else if (item.type.displayName === 'Facets.Group') {
73
+ react_1.Children.forEach(item.props.children, child => {
74
+ processChild(child);
75
+ });
76
+ }
77
+ }
78
+ react_1.Children.forEach(children, child => {
79
+ processChild(child);
80
+ });
81
+ return (<div className={[
82
+ "ds_facets",
83
+ className
84
+ ].join(' ')} {...props}>
85
+ <p className="visually-hidden">There {facetCount === 1 ? 'is' : 'are'} {facetCount} search {facetCount === 1 ? 'filter' : 'filters'} applied</p>
86
+ <dl className="ds_facets__list">
87
+ {children}
88
+ </dl>
89
+ {facetCount > 0 &&
90
+ <button className="ds_button ds_button--secondary ds_button--has-icon ds_facets__clear-button" type="button">
91
+ Clear all filters
92
+ <icons_1.Cancel className="ds_facet__button-icon"/>
93
+ </button>}
94
+ </div>);
95
+ };
96
+ Facets.displayName = 'Facets';
97
+ FacetsItem.displayName = 'Facets.Item';
98
+ FacetsGroup.displayName = 'Facets.Group';
99
+ Facets.Item = FacetsItem;
100
+ Facets.Group = FacetsGroup;
101
+ exports.default = Facets;
@@ -0,0 +1,16 @@
1
+ export declare const FilterPanel: {
2
+ ({ activeFilterCount, children, isScrollable, legend, heading, ...props }: SGDS.Component.SearchFilters.Panel): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ declare const Filters: {
6
+ ({ children, searchResultsContainerId, ...props }: SGDS.Component.SearchFilters): import("react").JSX.Element;
7
+ Panel: {
8
+ ({ activeFilterCount, children, isScrollable, legend, heading, ...props }: SGDS.Component.SearchFilters.Panel): import("react").JSX.Element;
9
+ displayName: string;
10
+ };
11
+ CheckboxGroup: {
12
+ ({ children, ...props }: any): import("react").JSX.Element;
13
+ displayName: string;
14
+ };
15
+ };
16
+ export default Filters;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FilterPanel = void 0;
7
+ const Accordion_1 = __importDefault(require("../Accordion/Accordion"));
8
+ const Button_1 = __importDefault(require("../Button/Button"));
9
+ const SkipLinks_1 = __importDefault(require("../SkipLinks/SkipLinks"));
10
+ const ConditionalWrapper_1 = __importDefault(require("../../common/ConditionalWrapper"));
11
+ const CheckboxGroup_1 = __importDefault(require("../Checkbox/CheckboxGroup"));
12
+ const FilterPanel = ({ activeFilterCount = 0, children, isScrollable = false, legend, heading = 'Filter', ...props }) => {
13
+ const headingWithCount = <>
14
+ {heading}
15
+ {activeFilterCount > 0 && <div className="ds_search-filters__filter-count">({activeFilterCount} selected)</div>}
16
+ </>;
17
+ return (<Accordion_1.default.Item heading={headingWithCount} {...props}>
18
+ <fieldset>
19
+ <legend className="visually-hidden">{legend}</legend>
20
+
21
+ <ConditionalWrapper_1.default condition={isScrollable} wrapper={(children) => <div className="ds_search-filters__scrollable">{children}</div>}>
22
+ {children}
23
+ </ConditionalWrapper_1.default>
24
+ </fieldset>
25
+ </Accordion_1.default.Item>);
26
+ };
27
+ exports.FilterPanel = FilterPanel;
28
+ const FilterCheckboxGroup = ({ children, ...props }) => {
29
+ return (<CheckboxGroup_1.default className="ds_search-filters__checkboxes" isSmall {...props}>
30
+ {children}
31
+ </CheckboxGroup_1.default>);
32
+ };
33
+ const Filters = ({ children, searchResultsContainerId = 'search-results', ...props }) => {
34
+ return (<div className="ds_search-filters" {...props}>
35
+ <div className="ds_details ds_no-margin" data-module="ds-details">
36
+ <input id="filters-toggle" type="checkbox" className="ds_details__toggle visually-hidden"/>
37
+ <label htmlFor="filters-toggle" className="ds_details__summary">
38
+ Search filters
39
+ </label>
40
+
41
+ <SkipLinks_1.default isStatic>
42
+ <SkipLinks_1.default.Link fragmentId={searchResultsContainerId}>Skip to results</SkipLinks_1.default.Link>
43
+ </SkipLinks_1.default>
44
+
45
+ <div className="ds_details__text">
46
+ <form id="filters">
47
+ <h2 className="ds_search-filters__title ds_h4">Filter by</h2>
48
+
49
+ <Accordion_1.default className="ds_!_margin-top--0" isSmall hideOpenAll>
50
+ {children}
51
+ </Accordion_1.default>
52
+
53
+ <Button_1.default isSmall width="max" className="ds_no-margin">Apply filter</Button_1.default>
54
+ </form>
55
+ </div>
56
+ </div>
57
+ </div>);
58
+ };
59
+ Filters.Panel = exports.FilterPanel;
60
+ Filters.CheckboxGroup = FilterCheckboxGroup;
61
+ FilterCheckboxGroup.displayName = 'Filters.CheckboxGroup';
62
+ exports.FilterPanel.displayName = 'Filters.Panel';
63
+ exports.default = Filters;
@@ -0,0 +1,28 @@
1
+ declare const SearchResult: {
2
+ ({ children, href, isPromoted, linkComponent, promotedTitle, title, ...props }: SGDS.Component.SearchResult): import("react").JSX.Element;
3
+ Content: {
4
+ ({ children }: SGDS.Component.SearchResult.Content): import("react").JSX.Element;
5
+ displayName: string;
6
+ };
7
+ Context: {
8
+ ({ children, title }: SGDS.Component.SearchResult.Context): import("react").JSX.Element;
9
+ displayName: string;
10
+ };
11
+ ContextItem: {
12
+ ({ children }: SGDS.Component.SearchResult.ContextItem): import("react").JSX.Element;
13
+ displayName: string;
14
+ };
15
+ Media: {
16
+ ({ children }: SGDS.Component.SearchResult.Media): import("react").JSX.Element;
17
+ displayName: string;
18
+ };
19
+ Meta: {
20
+ ({ children }: SGDS.Component.SearchResult.Meta): import("react").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ MetaItem: {
24
+ ({ children, className, name, ...props }: SGDS.Component.Metadata.Item): import("react").JSX.Element;
25
+ displayName: string;
26
+ };
27
+ };
28
+ export default SearchResult;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = require("react");
7
+ const ConditionalWrapper_1 = __importDefault(require("../../common/ConditionalWrapper"));
8
+ const AspectBox_1 = __importDefault(require("../AspectBox/AspectBox"));
9
+ const PageMetadata_1 = __importDefault(require("../PageMetadata/PageMetadata"));
10
+ const SearchResultLinkHrefContext = (0, react_1.createContext)('');
11
+ const SearchResultContent = ({ children }) => {
12
+ const otherChildren = [];
13
+ let imageChild = null;
14
+ // assign to slots
15
+ react_1.Children.forEach(children, (child) => {
16
+ const thisChild = child;
17
+ if (thisChild && thisChild.type === SearchResultMedia) {
18
+ imageChild = thisChild;
19
+ }
20
+ else {
21
+ otherChildren.push(thisChild);
22
+ }
23
+ });
24
+ return (imageChild ?
25
+ (<div className="ds_search-result__has-media">
26
+ {imageChild}
27
+ <div className="ds_search-result__summary">{otherChildren}</div>
28
+ </div>)
29
+ :
30
+ (<div className="ds_search-result__summary">
31
+ {otherChildren}
32
+ </div>));
33
+ };
34
+ const SearchResultContext = ({ children, title = 'Part of' }) => {
35
+ return (<dl className="ds_search-result__context">
36
+ <dt className="ds_search-result__context-key">{title}:</dt>
37
+ {children}
38
+ </dl>);
39
+ };
40
+ const SearchResultContextItem = ({ children }) => {
41
+ return (<dd className="ds_search-result__context-value">
42
+ {children}
43
+ </dd>);
44
+ };
45
+ const SearchResultMedia = ({ children }) => {
46
+ return (<div className="ds_search-result__media-wrapper">
47
+ <a className="ds_search-result__media-link" href={(0, react_1.useContext)(SearchResultLinkHrefContext)} tabIndex={-1} aria-hidden="true">
48
+ <AspectBox_1.default className="ds_search-result__media" ratio="1:1">
49
+ {children}
50
+ </AspectBox_1.default>
51
+ </a>
52
+ </div>);
53
+ };
54
+ const SearchResultMeta = ({ children }) => {
55
+ return (<PageMetadata_1.default className="ds_search-result__metadata" isInline>
56
+ {children}
57
+ </PageMetadata_1.default>);
58
+ };
59
+ const SearchResult = ({ children, href, isPromoted, linkComponent, promotedTitle = 'Recommended', title, ...props }) => {
60
+ const LINK_CLASS = 'ds_search-result__link';
61
+ return (<div className={[
62
+ 'ds_search-result',
63
+ isPromoted ? 'ds_search-result--promoted' : ''
64
+ ].join(' ')} {...props}>
65
+ <ConditionalWrapper_1.default condition={!!isPromoted} wrapper={(children) => <div className="ds_search-result--promoted-content">
66
+ <header className="ds_search-result--promoted-title">{promotedTitle}</header>
67
+ {children}
68
+ </div>}>
69
+ <SearchResultLinkHrefContext value={href}>
70
+ <h3 className="ds_search-result__title">
71
+ {linkComponent ?
72
+ linkComponent({ className: LINK_CLASS, children: title, href }) :
73
+ <a className={LINK_CLASS} href={href}>{title}</a>}
74
+ </h3>
75
+
76
+ {children}
77
+ </SearchResultLinkHrefContext>
78
+ </ConditionalWrapper_1.default>
79
+ </div>);
80
+ };
81
+ SearchResult.Content = SearchResultContent;
82
+ SearchResult.Context = SearchResultContext;
83
+ SearchResult.ContextItem = SearchResultContextItem;
84
+ SearchResult.Media = SearchResultMedia;
85
+ SearchResult.Meta = SearchResultMeta;
86
+ SearchResult.MetaItem = PageMetadata_1.default.Item;
87
+ SearchResultContent.displayName = 'SearchResult.Content';
88
+ SearchResultContext.displayName = 'SearchResult.Context';
89
+ SearchResultContextItem.displayName = 'SearchResult.ContextItem';
90
+ SearchResultMedia.displayName = 'SearchResult.Media';
91
+ SearchResultMeta.displayName = 'SearchResult.Meta';
92
+ SearchResult.MetaItem.displayName = 'SearchResult.MetaItem';
93
+ exports.default = SearchResult;
@@ -0,0 +1,10 @@
1
+ import { AllHTMLAttributes } from "react";
2
+ declare const SearchSort: {
3
+ ({ children, className, id, label, onApply, ...props }: SGDS.Component.SearchSort): import("react").JSX.Element;
4
+ displayName: string;
5
+ Option: {
6
+ ({ children, value }: AllHTMLAttributes<HTMLOptionElement>): import("react").JSX.Element;
7
+ displayName: string;
8
+ };
9
+ };
10
+ export default SearchSort;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Button_1 = __importDefault(require("../Button/Button"));
7
+ const Select_1 = __importDefault(require("../Select/Select"));
8
+ const Option = ({ children, value }) => {
9
+ return (<option value={value}>
10
+ {children}
11
+ </option>);
12
+ };
13
+ const SearchSort = ({ children, className, id = 'sort-by', label = 'Sort by', onApply, ...props }) => {
14
+ return (<div className={[
15
+ 'ds_sort-options',
16
+ className
17
+ ].join(' ')} {...props}>
18
+ <Select_1.default id={id} label={label}>
19
+ {children}
20
+ </Select_1.default>
21
+
22
+ <Button_1.default onClick={onApply} isSmall buttonStyle="secondary" type="submit">Apply sort</Button_1.default>
23
+ </div>);
24
+ };
25
+ SearchSort.displayName = 'SearchSort';
26
+ Option.displayName = 'SearchSort.Option';
27
+ SearchSort.Option = Option;
28
+ exports.default = SearchSort;
@@ -0,0 +1,5 @@
1
+ declare const Select: {
2
+ ({ children, className, defaultValue, errorMessage, hasError, hintText, id, label, name, onBlur, onChange, placeholder, width, ...props }: SGDS.Component.Select): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default Select;
@@ -0,0 +1,13 @@
1
+ declare const SequentialNavigation: {
2
+ ({ ariaLabel, children, className, ...props }: SGDS.Component.SequentialNavigation): import("react").JSX.Element;
3
+ displayName: string;
4
+ Next: {
5
+ ({ children, href, linkComponent, textLabel }: SGDS.Component.SequentialNavigation.Link): import("react").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ Previous: {
9
+ ({ children, href, linkComponent, textLabel }: SGDS.Component.SequentialNavigation.Link): import("react").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ };
13
+ export default SequentialNavigation;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const SeqNavLink = ({ children, href, isPrev, linkComponent, textLabel }) => {
4
- console.log(textLabel);
5
4
  const LINK_CLASSES = [
6
5
  'ds_sequential-nav__button',
7
6
  isPrev ? 'ds_sequential-nav__button--left' : 'ds_sequential-nav__button--right'
@@ -0,0 +1,13 @@
1
+ declare const SideNavigation: {
2
+ ({ ariaLabel, children, className, ...props }: SGDS.Component.SideNavigation): import("react").JSX.Element;
3
+ displayName: string;
4
+ Item: {
5
+ ({ children, href, isCurrent, linkComponent, title }: SGDS.Component.SideNavigation.Item): import("react").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ List: {
9
+ ({ children, isRoot }: SGDS.Component.SideNavigation.List): import("react").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ };
13
+ export default SideNavigation;
@@ -25,14 +25,14 @@ const SideNavigationItem = function ({ children, href, isCurrent = false, linkCo
25
25
  {children}
26
26
  </li>);
27
27
  };
28
- const SideNavigation = function ({ children, className, ...props }) {
28
+ const SideNavigation = function ({ ariaLabel = 'Sections', children, className, ...props }) {
29
29
  const ref = (0, react_1.useRef)(null);
30
30
  (0, react_1.useEffect)(() => {
31
31
  if (ref.current && children) {
32
32
  new side_navigation_1.default(ref.current).init();
33
33
  }
34
34
  }, [ref]);
35
- return (<nav aria-label="Sections" className={[
35
+ return (<nav aria-label={ariaLabel} className={[
36
36
  'ds_side-navigation',
37
37
  className
38
38
  ].join(' ')} data-module="ds-side-navigation" ref={ref} {...props}>
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ declare const SiteFooter: {
3
+ ({ children, className, ...props }: SGDS.Component.SiteFooter): React.JSX.Element;
4
+ Links: {
5
+ ({ children, ...props }: SGDS.Component.SiteFooter.Links): React.JSX.Element;
6
+ displayName: string;
7
+ };
8
+ Link: {
9
+ ({ children, href, linkComponent, ...props }: SGDS.Component.SiteFooter.Link): React.JSX.Element;
10
+ displayName: string;
11
+ };
12
+ License: {
13
+ ({ children, ...props }: SGDS.Component.SiteFooter.License): React.JSX.Element;
14
+ displayName: string;
15
+ };
16
+ Org: {
17
+ ({ href, title, children, ...props }: SGDS.Component.SiteFooter.Org): React.JSX.Element;
18
+ displayName: string;
19
+ };
20
+ displayName: string;
21
+ };
22
+ export default SiteFooter;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ declare const SiteHeader: {
3
+ ({ children, ...props }: SGDS.Component.SiteHeader): React.JSX.Element;
4
+ Brand: {
5
+ ({ children, homeUrl, linkComponent, siteTitle }: SGDS.Component.SiteHeader.Brand): React.JSX.Element;
6
+ displayName: string;
7
+ };
8
+ Navigation: {
9
+ ({ children }: any): any;
10
+ displayName: string;
11
+ };
12
+ Phase: {
13
+ ({ children }: any): any;
14
+ displayName: string;
15
+ };
16
+ Search: {
17
+ ({ children }: any): any;
18
+ displayName: string;
19
+ };
20
+ displayName: string;
21
+ };
22
+ export default SiteHeader;
@@ -1,4 +1,3 @@
1
- 'use client';
2
1
  "use strict";
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
@@ -0,0 +1,9 @@
1
+ declare const SiteNavigation: {
2
+ ({ children, className, ...props }: SGDS.Component.SiteNavigation): import("react").JSX.Element;
3
+ displayName: string;
4
+ Item: {
5
+ ({ children, isCurrent, href, linkComponent }: SGDS.Component.SiteNavigation.Item): import("react").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ };
9
+ export default SiteNavigation;
@@ -0,0 +1,5 @@
1
+ declare const SiteSearch: {
2
+ ({ action, autocompleteEndpoint, autocompleteSuggestionMappingFunction, className, id, method, minLength, name, placeholder, ...props }: SGDS.Component.SiteSearch): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default SiteSearch;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare const SkipLinks: {
3
+ ({ children, mainContentId, mainLinkText, isStatic, ...props }: SGDS.Component.SkipLinks): React.JSX.Element;
4
+ displayName: string;
5
+ Link: {
6
+ ({ children, fragmentId }: SGDS.Component.SkipLinks.Link): React.JSX.Element;
7
+ displayName: string;
8
+ };
9
+ };
10
+ export default SkipLinks;
@@ -1,11 +1,53 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ const react_1 = __importStar(require("react"));
40
+ // @ts-ignore
41
+ const skip_links_1 = __importDefault(require("@scottish-government/design-system/src/components/skip-links/skip-links"));
3
42
  const Link = ({ children, fragmentId }) => {
4
43
  return (<li className="ds_skip-links__item">
5
44
  <a href={`#${fragmentId}`} className="ds_skip-links__link">{children}</a>
6
45
  </li>);
7
46
  };
8
47
  const SkipLinks = ({ children, mainContentId = 'main-content', mainLinkText = 'Skip to main content', isStatic, ...props }) => {
48
+ (0, react_1.useEffect)(() => {
49
+ skip_links_1.default.init();
50
+ });
9
51
  return (<div className={[
10
52
  'ds_skip-links',
11
53
  isStatic && 'ds_skip-links--static',
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare const SummaryCard: {
3
+ ({ children, className, headingLevel, title, ...props }: SGDS.Component.SummaryCard): React.JSX.Element;
4
+ displayName: string;
5
+ Action: {
6
+ ({ children, describedby, href, linkComponent, onclick }: SGDS.Common.ActionLink): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
7
+ displayName: string;
8
+ };
9
+ };
10
+ export default SummaryCard;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ declare const SummaryList: {
3
+ ({ children, className, isBorderless, ...props }: SGDS.Component.SummaryList): React.JSX.Element;
4
+ Action: {
5
+ ({ children, describedby, href, linkComponent, onclick }: SGDS.Common.ActionLink): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
6
+ displayName: string;
7
+ };
8
+ Item: {
9
+ ({ children, title }: SGDS.Component.SummaryList.Item): React.JSX.Element;
10
+ displayName: string;
11
+ };
12
+ Value: {
13
+ ({ children }: SGDS.Component.SummaryList.Answer): React.JSX.Element;
14
+ displayName: string;
15
+ };
16
+ displayName: string;
17
+ };
18
+ export default SummaryList;
@@ -0,0 +1,5 @@
1
+ declare const Table: {
2
+ ({ children, className, smallscreen, ...props }: SGDS.Component.Table): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default Table;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare const Tabs: {
3
+ ({ baseId, children, className, headingLevel, isBorderless, isManual, title, ...props }: SGDS.Component.Tabs): React.JSX.Element;
4
+ displayName: string;
5
+ Item: {
6
+ ({ isBorderless, children, className, id, tabLabel, ...props }: SGDS.Component.Tabs.Item): React.JSX.Element;
7
+ displayName: string;
8
+ };
9
+ };
10
+ export default Tabs;
@@ -0,0 +1,5 @@
1
+ declare const Tag: {
2
+ ({ children, className, colour, ...props }: SGDS.Component.Tag): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default Tag;
@@ -0,0 +1,13 @@
1
+ declare const TaskList: {
2
+ ({ children, className, headingId, title, ...props }: SGDS.Component.TaskList): import("react").JSX.Element;
3
+ displayName: string;
4
+ Item: {
5
+ ({ children, className, href, id, isComplete, linkComponent, statusText, tagColour, title, ...props }: SGDS.Component.TaskList.Item): import("react").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ Group: {
9
+ ({ children, className, intro, title, ...props }: SGDS.Component.TaskList.Group): import("react").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ };
13
+ export default TaskList;
@@ -0,0 +1,5 @@
1
+ declare const TextInput: {
2
+ ({ buttonIcon, buttonText, children, className, countThreshold, width, isCurrency, currencySymbol, errorMessage, hasButton, hasError, hintText, id, label, maxlength, name, onBlur, onChange, placeholder, type, value, ...props }: SGDS.Component.TextInput): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default TextInput;
@@ -0,0 +1,5 @@
1
+ declare const Textarea: {
2
+ ({ className, countThreshold, errorMessage, hasError, hintText, id, label, maxlength, name, onBlur, onChange, placeholder, rows, value, ...props }: SGDS.Component.Textarea): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default Textarea;
@@ -0,0 +1,5 @@
1
+ declare const WarningText: {
2
+ ({ children, className, ...props }: SGDS.Component.WarningText): import("react").JSX.Element;
3
+ displayName: string;
4
+ };
5
+ export default WarningText;
@@ -0,0 +1 @@
1
+ export default function (): void;
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import type { SVGProps } from "react";
3
+ declare const SvgAudio: (props: SVGProps<SVGSVGElement>) => React.JSX.Element;
4
+ export default SvgAudio;