@communitiesuk/svelte-component-library 0.1.18 → 0.2.0-alpha.2

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 (97) hide show
  1. package/README.md +30 -6
  2. package/dist/assets/css/base.css +9 -0
  3. package/dist/assets/css/code-block.css +116 -0
  4. package/dist/assets/css/components.css +47 -0
  5. package/dist/assets/css/fonts.css +19 -0
  6. package/dist/assets/css/govuk-additional.css +142 -0
  7. package/dist/assets/css/govuk-frontend.min.css +2 -2
  8. package/dist/assets/css/moduk.css +1 -0
  9. package/dist/assets/css/moj-frontend.min copy.css +4108 -0
  10. package/dist/assets/css/moj-frontend.min.css +2 -0
  11. package/dist/assets/css/moj-frontend.min.css.map +1 -0
  12. package/dist/assets/css/utilities.css +0 -0
  13. package/dist/assets/images/govuk-crest.svg +1 -1
  14. package/dist/assets/js/govuk-frontend.min.js +1 -0
  15. package/dist/assets/js/moj-frontend.min.js +1 -0
  16. package/dist/assets/rebrand/images/favicon.ico +0 -0
  17. package/dist/assets/rebrand/images/favicon.svg +1 -0
  18. package/dist/assets/rebrand/images/govuk-crest.svg +1 -0
  19. package/dist/assets/rebrand/images/govuk-icon-180.png +0 -0
  20. package/dist/assets/rebrand/images/govuk-icon-192.png +0 -0
  21. package/dist/assets/rebrand/images/govuk-icon-512.png +0 -0
  22. package/dist/assets/rebrand/images/govuk-icon-mask.svg +1 -0
  23. package/dist/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  24. package/dist/assets/rebrand/manifest.json +39 -0
  25. package/dist/components/data-vis/line-chart/Line.svelte +48 -40
  26. package/dist/components/data-vis/line-chart/Line.svelte.d.ts +6 -4
  27. package/dist/components/data-vis/line-chart/LineChart.svelte +145 -36
  28. package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +25 -9
  29. package/dist/components/data-vis/line-chart/Lines.svelte +10 -23
  30. package/dist/components/data-vis/line-chart/Lines.svelte.d.ts +8 -4
  31. package/dist/components/data-vis/line-chart/Marker.svelte +31 -5
  32. package/dist/components/data-vis/line-chart/Marker.svelte.d.ts +6 -2
  33. package/dist/components/data-vis/line-chart/SeriesLabel.svelte +7 -8
  34. package/dist/components/data-vis/line-chart/SeriesLabel.svelte.d.ts +2 -2
  35. package/dist/components/data-vis/line-chart/ValueLabel.svelte +26 -34
  36. package/dist/components/data-vis/line-chart/ValueLabel.svelte.d.ts +8 -4
  37. package/dist/components/data-vis/map/Map.svelte +299 -71
  38. package/dist/components/data-vis/map/Map.svelte.d.ts +39 -12
  39. package/dist/components/data-vis/map/NonStandardControls.svelte +10 -1
  40. package/dist/components/data-vis/map/NonStandardControls.svelte.d.ts +12 -11
  41. package/dist/components/data-vis/map/Tooltip.svelte +3 -4
  42. package/dist/components/data-vis/map/Tooltip.svelte.d.ts +0 -2
  43. package/dist/components/data-vis/map/mapUtils.d.ts +2 -0
  44. package/dist/components/data-vis/map/mapUtils.js +50 -0
  45. package/dist/components/data-vis/table/Table.svelte +28 -40
  46. package/dist/components/data-vis/table/Table.svelte.d.ts +0 -2
  47. package/dist/components/layout/Breadcrumbs.svelte +10 -12
  48. package/dist/components/layout/Breadcrumbs.svelte.d.ts +1 -0
  49. package/dist/components/layout/Footer.svelte +69 -4
  50. package/dist/components/layout/Footer.svelte.d.ts +3 -0
  51. package/dist/components/layout/Header.svelte +56 -16
  52. package/dist/components/layout/Header.svelte.d.ts +1 -0
  53. package/dist/components/layout/InternalHeader.svelte +155 -150
  54. package/dist/components/layout/InternalHeader.svelte.d.ts +1 -0
  55. package/dist/components/ui/Button.svelte +78 -4
  56. package/dist/components/ui/Button.svelte.d.ts +2 -0
  57. package/dist/components/ui/CookieBanner.svelte +356 -0
  58. package/dist/components/ui/CookieBanner.svelte.d.ts +18 -0
  59. package/dist/components/ui/FilterPanel.svelte +167 -158
  60. package/dist/components/ui/FilterPanel.svelte.d.ts +2 -0
  61. package/dist/components/ui/Masthead.svelte +35 -23
  62. package/dist/components/ui/Masthead.svelte.d.ts +2 -0
  63. package/dist/components/ui/PostcodeOrAreaSearch.svelte +200 -0
  64. package/dist/components/ui/PostcodeOrAreaSearch.svelte.d.ts +37 -0
  65. package/dist/components/ui/Search.svelte +2 -2
  66. package/dist/components/ui/SearchAutocomplete.svelte +104 -14
  67. package/dist/components/ui/SearchAutocomplete.svelte.d.ts +4 -0
  68. package/dist/data/IMD2019.json +32846 -0
  69. package/dist/data/places.csv +20039 -0
  70. package/dist/data/places.json +100192 -0
  71. package/dist/data/svgFontDimensions.json +90 -0
  72. package/dist/data/testData.json +52632 -0
  73. package/dist/index.d.ts +2 -0
  74. package/dist/index.js +2 -0
  75. package/dist/package-wrapping/BaseInformation.svelte +0 -33
  76. package/dist/package-wrapping/SidebarContainer.svelte +0 -7
  77. package/dist/utils/area-search/geoConfig.d.ts +435 -0
  78. package/dist/utils/area-search/geoConfig.js +291 -0
  79. package/dist/utils/cookiesNavigation.d.ts +44 -0
  80. package/dist/utils/cookiesNavigation.js +63 -0
  81. package/dist/utils/data-transformations/convert-csv-to-json-proper.cjs +88 -0
  82. package/dist/utils/data-transformations/convert-csv-to-json-proper.d.cts +1 -0
  83. package/dist/utils/data-transformations/convertCSV.d.ts +6 -0
  84. package/dist/utils/data-transformations/convertCSV.js +40 -21
  85. package/dist/utils/text-string-conversion/textStringConversion.d.ts +6 -0
  86. package/dist/utils/text-string-conversion/textStringConversion.js +10 -0
  87. package/package.json +18 -7
  88. package/dist/components/ui/Breadcrumbs.svelte +0 -198
  89. package/dist/components/ui/Breadcrumbs.svelte.d.ts +0 -24
  90. package/dist/components/ui/Footer.svelte +0 -171
  91. package/dist/components/ui/Footer.svelte.d.ts +0 -30
  92. package/dist/components/ui/Header.svelte +0 -43
  93. package/dist/components/ui/Header.svelte.d.ts +0 -7
  94. package/dist/components/ui/ServiceNavigation.svelte +0 -143
  95. package/dist/components/ui/ServiceNavigation.svelte.d.ts +0 -13
  96. package/dist/components/ui/SideNavigation.svelte +0 -346
  97. package/dist/components/ui/SideNavigation.svelte.d.ts +0 -25
@@ -1,346 +0,0 @@
1
- <script lang="ts">
2
- import { onMount } from "svelte";
3
-
4
- // Define types for items and subitems
5
- export type NavItem = {
6
- id?: string;
7
- text: string;
8
- href: string;
9
- subItems?: NavSubItem[];
10
- };
11
-
12
- export type NavSubItem = {
13
- id?: string;
14
- text: string;
15
- href: string;
16
- };
17
-
18
- // Component props
19
- let {
20
- items = [],
21
- ariaLabel = "Side",
22
- selectedItem = $bindable(""),
23
- selectedSubItem = $bindable(""),
24
- mobile = {
25
- disabled: false,
26
- showButtonText: "Show navigation",
27
- hideButtonText: "Hide navigation",
28
- },
29
- } = $props<{
30
- items: NavItem[];
31
- ariaLabel?: string;
32
- selectedItem?: string;
33
- selectedSubItem?: string;
34
- mobile?: {
35
- disabled?: boolean;
36
- showButtonText?: string;
37
- hideButtonText?: string;
38
- };
39
- }>();
40
-
41
- // State for mobile navigation
42
- let expanded = $state(false);
43
- let isJsEnabled = $state(false);
44
- let mobileClosed = $state(false);
45
-
46
- // Check if JavaScript is enabled on mount
47
- onMount(() => {
48
- isJsEnabled = true;
49
- // Initialize mobileClosed based on initial state
50
- mobileClosed = isJsEnabled && !expanded && !mobile.disabled;
51
- });
52
-
53
- // Toggle mobile navigation
54
- function toggleSideNavigation(event: Event) {
55
- event.preventDefault();
56
- expanded = !expanded;
57
- // Update mobileClosed when expanded changes
58
- mobileClosed = isJsEnabled && !expanded && !mobile.disabled;
59
- }
60
- </script>
61
-
62
- {#if !mobile.disabled}
63
- <button
64
- class="dwp-side-navigation__button"
65
- data-module="dwp-side-navigation"
66
- data-target="dwp-side-navigation-panel"
67
- aria-expanded={expanded}
68
- onclick={toggleSideNavigation}
69
- >
70
- <span class="dwp-side-navigation__section-toggle-focus">
71
- <span
72
- class="dwp-side-navigation__chevron {expanded
73
- ? 'dwp-side-navigation__chevron--down'
74
- : ''}"
75
- ></span>
76
- <span class="dwp-side-navigation__section-toggle-text">
77
- {expanded ? mobile.hideButtonText : mobile.showButtonText}
78
- </span>
79
- </span>
80
- </button>
81
- {/if}
82
-
83
- <nav
84
- class="dwp-side-navigation {mobileClosed
85
- ? 'dwp-side-navigation--mobile'
86
- : ''}"
87
- aria-label={ariaLabel}
88
- role="navigation"
89
- >
90
- <ul class="dwp-side-navigation__list">
91
- {#each items as item}
92
- {@const currentSection = item.href && item.href === selectedItem}
93
- {@const selected = selectedSubItem || selectedItem}
94
- <li
95
- class="dwp-side-navigation__item{currentSection
96
- ? ' dwp-side-navigation__item--selected'
97
- : ''}"
98
- >
99
- <a
100
- id={item.id}
101
- href={item.href}
102
- class="dwp-side-navigation__link{selected === item.href
103
- ? ' dwp-side-navigation__link--selected'
104
- : ''}"
105
- aria-current={selected === item.href ? "true" : undefined}
106
- >
107
- {item.text}
108
- </a>
109
- {#if currentSection && item.subItems && item.subItems.length > 0}
110
- <ul
111
- class="dwp-side-navigation__list dwp-side-navigation__list--sub-item"
112
- >
113
- {#each item.subItems as subItem}
114
- <li class="dwp-side-navigation__sub-item">
115
- <a
116
- id={subItem.id}
117
- href={subItem.href}
118
- class="dwp-side-navigation__link{selected === subItem.href
119
- ? ' dwp-side-navigation__link--selected'
120
- : ''}"
121
- aria-current={selected === subItem.href ? "true" : undefined}
122
- >
123
- {subItem.text}
124
- </a>
125
- </li>
126
- {/each}
127
- </ul>
128
- {/if}
129
- </li>
130
- {/each}
131
- </ul>
132
- </nav>
133
-
134
- <style>
135
- .dwp-side-navigation {
136
- margin-bottom: var(--govuk-spacing-2, 10px);
137
- }
138
-
139
- @media (max-width: 767px) {
140
- .dwp-side-navigation {
141
- max-width: 220px;
142
- }
143
- }
144
-
145
- .dwp-side-navigation__button {
146
- display: none;
147
- font-size: 19px;
148
- line-height: 1.25;
149
- margin-bottom: var(--govuk-spacing-2, 10px);
150
- padding: var(--govuk-spacing-1, 5px) 2px var(--govuk-spacing-1, 5px) 0;
151
- border-width: 0;
152
- color: var(--govuk-link-colour, #1d70b8);
153
- background: none;
154
- cursor: pointer;
155
- -webkit-appearance: none;
156
- }
157
-
158
- @media (max-width: 767px) {
159
- .dwp-side-navigation__button {
160
- padding: var(--govuk-spacing-2, 10px) var(--govuk-spacing-2, 10px)
161
- var(--govuk-spacing-2, 10px) 0;
162
- }
163
- }
164
-
165
- .dwp-side-navigation__button:hover {
166
- color: #0b0c0c;
167
- background: #f3f2f1;
168
- }
169
-
170
- .dwp-side-navigation__button:hover .dwp-side-navigation__chevron {
171
- color: #0b0c0c;
172
- background: #0b0c0c;
173
- }
174
-
175
- .dwp-side-navigation__button:hover .dwp-side-navigation__chevron::after {
176
- color: #f3f2f1;
177
- }
178
-
179
- .dwp-side-navigation__button:focus {
180
- outline: 3px solid transparent;
181
- color: #0b0c0c;
182
- background-color: #ffdd00;
183
- box-shadow:
184
- 0 -2px #ffdd00,
185
- 0 4px #0b0c0c;
186
- text-decoration: none;
187
- }
188
-
189
- .dwp-side-navigation__button:focus .dwp-side-navigation__chevron {
190
- color: #0b0c0c;
191
- background: #0b0c0c;
192
- }
193
-
194
- .dwp-side-navigation__button:focus .dwp-side-navigation__chevron::after {
195
- color: #ffdd00;
196
- }
197
-
198
- .dwp-side-navigation__section-toggle-text {
199
- margin-left: var(--govuk-spacing-2, 10px);
200
- vertical-align: middle;
201
- }
202
-
203
- .dwp-side-navigation__chevron {
204
- box-sizing: border-box;
205
- display: inline-block;
206
- position: relative;
207
- width: 20px;
208
- height: 20px;
209
- border: 1px solid;
210
- border-radius: 50%;
211
- vertical-align: middle;
212
- }
213
-
214
- .dwp-side-navigation__chevron--down {
215
- transform: rotate(180deg);
216
- }
217
-
218
- .dwp-side-navigation__chevron::after {
219
- content: "";
220
- box-sizing: border-box;
221
- display: block;
222
- position: absolute;
223
- bottom: 5px;
224
- left: 6px;
225
- width: 6px;
226
- height: 6px;
227
- transform: rotate(-45deg);
228
- border-top: 2px solid;
229
- border-right: 2px solid;
230
- }
231
-
232
- .dwp-side-navigation__list {
233
- font-size: 19px;
234
- line-height: 1.25;
235
- margin-top: 0;
236
- margin-bottom: 30px;
237
- padding-left: 0;
238
- list-style-type: none;
239
- }
240
-
241
- .dwp-side-navigation__list > li {
242
- margin-bottom: var(--govuk-spacing-1, 5px);
243
- }
244
-
245
- .dwp-side-navigation__list--sub-item {
246
- margin-top: var(--govuk-spacing-1, 5px);
247
- }
248
-
249
- .dwp-side-navigation__item {
250
- box-sizing: border-box;
251
- padding: var(--govuk-spacing-1, 5px) 0 0;
252
- }
253
-
254
- @media (max-width: 767px) {
255
- .dwp-side-navigation__item {
256
- padding: 0;
257
- }
258
- }
259
-
260
- .dwp-side-navigation__item--selected {
261
- margin: var(--govuk-spacing-2, 10px) 0 var(--govuk-spacing-1, 5px) -14px;
262
- padding: var(--govuk-spacing-1, 5px) 0 var(--govuk-spacing-1, 5px)
263
- var(--govuk-spacing-2, 10px);
264
- border-left: 4px solid var(--govuk-link-colour, #1d70b8);
265
- background-color: #f3f2f1;
266
- }
267
-
268
- @media (max-width: 767px) {
269
- .dwp-side-navigation__item--selected {
270
- margin-left: 0;
271
- padding: 0 0 0 var(--govuk-spacing-2, 10px);
272
- }
273
- }
274
-
275
- .dwp-side-navigation__item :last-child {
276
- margin-bottom: 0;
277
- }
278
-
279
- .dwp-side-navigation__link {
280
- font-size: 16px;
281
- text-decoration: none;
282
- color: var(--govuk-link-colour, #1d70b8);
283
- }
284
-
285
- .dwp-side-navigation__link:hover {
286
- color: #003078;
287
- text-decoration: underline;
288
- }
289
-
290
- .dwp-side-navigation__link:focus {
291
- outline: 3px solid transparent;
292
- color: #0b0c0c;
293
- background-color: #ffdd00;
294
- box-shadow:
295
- 0 -2px #ffdd00,
296
- 0 4px #0b0c0c;
297
- text-decoration: none;
298
- }
299
-
300
- @media (max-width: 767px) {
301
- .dwp-side-navigation__link {
302
- display: inline-block;
303
- padding: calc(var(--govuk-spacing-2, 10px) - 1px) 0;
304
- }
305
- }
306
-
307
- .dwp-side-navigation__link--selected {
308
- font-weight: bold;
309
- }
310
-
311
- .dwp-side-navigation__sub-item {
312
- box-sizing: border-box;
313
- padding: var(--govuk-spacing-1, 5px) 0 0;
314
- }
315
-
316
- @media (max-width: 767px) {
317
- .dwp-side-navigation__sub-item {
318
- padding: 0;
319
- }
320
- }
321
-
322
- .dwp-side-navigation__sub-item::before {
323
- content: "—";
324
- color: #505a5f;
325
- font-size: 16px;
326
- font-weight: 700;
327
- }
328
-
329
- .dwp-side-navigation__sub-item:last-child {
330
- padding-bottom: var(--govuk-spacing-1, 5px);
331
- }
332
-
333
- /* JavaScript enabled styles */
334
- :global(.js-enabled) .dwp-side-navigation__button {
335
- display: none;
336
- }
337
-
338
- @media (max-width: 767px) {
339
- :global(.js-enabled) .dwp-side-navigation__button {
340
- display: block;
341
- }
342
- :global(.js-enabled) .dwp-side-navigation--mobile {
343
- display: none;
344
- }
345
- }
346
- </style>
@@ -1,25 +0,0 @@
1
- export type NavSubItem = {
2
- id?: string;
3
- text: string;
4
- href: string;
5
- };
6
- export type NavItem = {
7
- id?: string;
8
- text: string;
9
- href: string;
10
- subItems?: NavSubItem[];
11
- };
12
- type $$ComponentProps = {
13
- items: NavItem[];
14
- ariaLabel?: string;
15
- selectedItem?: string;
16
- selectedSubItem?: string;
17
- mobile?: {
18
- disabled?: boolean;
19
- showButtonText?: string;
20
- hideButtonText?: string;
21
- };
22
- };
23
- declare const SideNavigation: import("svelte").Component<$$ComponentProps, {}, "selectedItem" | "selectedSubItem">;
24
- type SideNavigation = ReturnType<typeof SideNavigation>;
25
- export default SideNavigation;