@onsvisual/svelte-components 0.0.1

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 (46) hide show
  1. package/README.md +5 -0
  2. package/dist/@types/actions/cssVariables/index.d.ts +4 -0
  3. package/dist/@types/actions/resizeObserver/index.d.ts +4 -0
  4. package/dist/@types/components/layout/Accordion/Accordion.svelte.d.ts +27 -0
  5. package/dist/@types/components/layout/Accordion/AccordionItem.svelte.d.ts +31 -0
  6. package/dist/@types/components/layout/Container/Container.svelte.d.ts +39 -0
  7. package/dist/@types/components/layout/Footer/Footer.svelte.d.ts +31 -0
  8. package/dist/@types/components/layout/Footer/ONSLogo.svelte.d.ts +29 -0
  9. package/dist/@types/components/layout/Header/Header.svelte.d.ts +35 -0
  10. package/dist/@types/components/layout/Header/ONSLogo.svelte.d.ts +29 -0
  11. package/dist/@types/components/layout/Theme/Theme.svelte.d.ts +33 -0
  12. package/dist/@types/components/layout/Theme/themes.d.ts +29 -0
  13. package/dist/@types/components/layout/Twisty/Twisty.svelte.d.ts +29 -0
  14. package/dist/@types/components/ui/Button/Button.svelte.d.ts +43 -0
  15. package/dist/@types/components/ui/Button/Icon.svelte.d.ts +27 -0
  16. package/dist/@types/components/ui/Dropdown/Dropdown.svelte.d.ts +37 -0
  17. package/dist/@types/components/ui/Em/Em.svelte.d.ts +29 -0
  18. package/dist/@types/components/ui/Input/Input.svelte.d.ts +51 -0
  19. package/dist/@types/components/ui/Select/Select.svelte.d.ts +67 -0
  20. package/dist/@types/components/ui/Textarea/Textarea.svelte.d.ts +37 -0
  21. package/dist/@types/index.d.ts +13 -0
  22. package/dist/@types/js/utils.d.ts +10 -0
  23. package/dist/actions/cssVariables/index.js +20 -0
  24. package/dist/actions/resizeObserver/index.js +25 -0
  25. package/dist/components/layout/Accordion/Accordion.svelte +37 -0
  26. package/dist/components/layout/Accordion/AccordionItem.svelte +81 -0
  27. package/dist/components/layout/Container/Container.svelte +99 -0
  28. package/dist/components/layout/Footer/Footer.svelte +266 -0
  29. package/dist/components/layout/Footer/ONSLogo.svelte +150 -0
  30. package/dist/components/layout/Header/Header.svelte +513 -0
  31. package/dist/components/layout/Header/ONSLogo.svelte +150 -0
  32. package/dist/components/layout/Theme/Theme.svelte +91 -0
  33. package/dist/components/layout/Theme/themes.js +24 -0
  34. package/dist/components/layout/Twisty/Twisty.svelte +48 -0
  35. package/dist/components/ui/Button/Button.svelte +87 -0
  36. package/dist/components/ui/Button/Icon.svelte +50 -0
  37. package/dist/components/ui/Dropdown/Dropdown.svelte +62 -0
  38. package/dist/components/ui/Em/Em.svelte +44 -0
  39. package/dist/components/ui/Input/Input.svelte +163 -0
  40. package/dist/components/ui/Select/Select.svelte +257 -0
  41. package/dist/components/ui/Textarea/Textarea.svelte +99 -0
  42. package/dist/css/main.css +55 -0
  43. package/dist/globals.d.ts +23 -0
  44. package/dist/index.js +16 -0
  45. package/dist/js/utils.js +41 -0
  46. package/package.json +144 -0
@@ -0,0 +1,150 @@
1
+ <script>
2
+ import { getContext } from "svelte";
3
+
4
+ const theme = getContext("theme");
5
+
6
+ $: primary = $theme === "dark" ? "white" : "#003c57";
7
+ const secondary = "#a8bd3a";
8
+
9
+ export let compact = false;
10
+ export let className = "ons-svg-logo";
11
+ export let width = "auto";
12
+ export let height = "auto";
13
+ </script>
14
+
15
+ {#if !compact}
16
+ <svg
17
+ class="{className}"
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ width="{width}"
20
+ height="{height}"
21
+ viewBox="33 2 552 60"
22
+ aria-labelledby="ons-logo-en-alt"
23
+ >
24
+ <title id="ons-logo-en-alt">Office for National Statistics logo</title>
25
+ <g class="ons-svg-logo__group ons-svg-logo__group--secondary" fill="{secondary}">
26
+ <path
27
+ d="M0,34.6c.8-1.69,1.39-3,2.32-4.6A38.28,38.28,0,0,1,0,23.4V34.6M5,3S0,3,0,9.25v1A62.12,62.12,0,0,0,4.2,27a43.77,43.77,0,0,1,9.42-10.79C21.69,9.21,31.16,5.13,45.9,3Z"
28
+ ></path>
29
+ </g>
30
+ <g class="ons-svg-logo__group ons-svg-logo__group--primary" fill="{primary}">
31
+ <path
32
+ d="M53.06,6.42C36.2,8,24.68,12.92,16.43,20.07A41.46,41.46,0,0,0,6.4,32.2C12.87,44.93,28.88,57,46.6,57H47s6.32.21,6.32-6.91V6.36a1.22,1.22,0,0,1-.26.06M9.72,42.67a44.25,44.25,0,0,1-5-7.42A80.59,80.59,0,0,0,0,46.38V56.91L31.06,57c-9.83-3-15.74-7.64-21.34-14.3"
33
+ ></path>
34
+ </g>
35
+ <g class="ons-svg-logo__group ons-svg-logo__group--text" fill="{primary}">
36
+ <path
37
+ d="M82,47.49c-9.07,0-13.13-7.51-13.13-16.77S72.91,14,82,14s13.1,7.61,13.1,16.77S91.1,47.54,82,47.54m0-30.91c-6.69,0-9.07,7.33-9.07,14.05s2.16,13.9,9.07,13.9,9-7.28,9-13.9-2.34-14-9-14"
38
+ ></path>
39
+ <path
40
+ d="M106.36,23.81V46.88h-3.67V23.81H98.93V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.38,0,.86.05.86.05v2.35h-.43c-2.55,0-4.84,1.64-4.84,5.12v4.09h5.27v2.25Z"
41
+ ></path>
42
+ <path
43
+ d="M121.53,23.81V46.88h-3.67V23.81H114.1V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.38,0,.86.05.86.05v2.35h-.43c-2.55,0-4.84,1.64-4.84,5.12v4.09h5.27v2.25Z"
44
+ ></path>
45
+ <path
46
+ d="M132.85,16.72a2.28,2.28,0,0,1-2.33-2.23v0a2.34,2.34,0,0,1,4.67,0,2.28,2.28,0,0,1-2.3,2.26h0M131,21.56h3.71V46.88H131Z"
47
+ ></path>
48
+ <path
49
+ d="M150.53,47.49c-6,0-10.63-5.16-10.63-13.29S144.52,21,150.66,21a9.76,9.76,0,0,1,6.17,1.74l-1,2.25a7.53,7.53,0,0,0-4.4-1.36c-5.15,0-7.78,4.46-7.78,10.48,0,6.2,3,10.62,7.65,10.62a8,8,0,0,0,4.49-1.37l1,2.45a10.21,10.21,0,0,1-6.3,1.73"
50
+ ></path>
51
+ <path
52
+ d="M162.84,35.75c.48,6,3.76,9,8.9,9a14.66,14.66,0,0,0,6.88-1.55l1.08,2.59a18,18,0,0,1-8.22,1.73c-7.12,0-12.18-4.23-12.18-13.34,0-8.69,4.67-13.2,11-13.2s10.37,3.95,10.37,12.4Zm7.35-12.41c-4.1,0-7.56,3.2-7.52,10.29l14.39-2c0-5.87-2.81-8.32-6.87-8.32"
53
+ ></path>
54
+ <path
55
+ d="M198.57,23.81V46.88H194.9V23.81h-3.76V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.39,0,.87.05.87.05v2.35h-.44c-2.54,0-4.84,1.64-4.84,5.12v4.09h5.28v2.25Z"
56
+ ></path>
57
+ <path
58
+ d="M217.28,47.49c-7.47,0-10.89-5.78-10.89-13.24S209.81,21,217.28,21s10.85,5.82,10.85,13.3-3.37,13.24-10.85,13.24m0-24c-5.53,0-7.13,5.59-7.13,10.81s1.73,10.56,7.13,10.56,7.13-5.35,7.13-10.56-1.6-10.81-7.13-10.81"
59
+ ></path>
60
+ <path
61
+ d="M244.08,23.91c-2.34-.61-5.75-.52-7.35.47v22.5H233V22.69c2.67-1.13,5.36-1.74,10.11-1.74H245Z"
62
+ ></path>
63
+ <path
64
+ d="M277.42,47.13,263.07,25a32.2,32.2,0,0,1-1.85-3.29h-.09s.13,1.88.13,3.85V47.13h-4.71V14.8h5.31l13.61,20.82A28.76,28.76,0,0,1,277.38,39h.08s-.17-1.84-.17-3.77V14.8H282V47.13Z"
65
+ ></path>
66
+ <path
67
+ d="M297.52,47.79c-7.43,0-10.93-3-10.93-7.81,0-6.8,7.12-8.64,15.59-9.39V29.13c0-3.47-2.37-4.51-5.83-4.51a18,18,0,0,0-6.87,1.46L288.23,23a24,24,0,0,1,9.12-1.83c5.61,0,9.93,2.3,9.93,8.78V46a22.71,22.71,0,0,1-9.76,1.83m4.66-14.67c-6.26.67-10.45,1.84-10.45,6.73,0,3.42,2.42,4.88,6.22,4.88a10.09,10.09,0,0,0,4.23-.84Z"
68
+ ></path>
69
+ <path
70
+ d="M322,47.69c-5.31,0-7.34-3.43-7.34-6.86V25.09h-3.55V21.81h3.55V16.12l5.4-1.5v7.19H325v3.28h-5V40.55a3.26,3.26,0,0,0,3,3.52h.5a5.5,5.5,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"
71
+ ></path>
72
+ <path
73
+ d="M331.91,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.44V47.13h-5.44Z"
74
+ ></path>
75
+ <path
76
+ d="M350.88,47.79c-7.73,0-11.57-5.74-11.57-13.3s3.84-13.34,11.57-13.34,11.54,5.78,11.54,13.34-3.8,13.3-11.54,13.3m0-23.17c-4.66,0-6.05,4.89-6.05,9.82s1.47,9.63,6.05,9.63,6.05-4.7,6.05-9.63-1.38-9.82-6.05-9.82"
77
+ ></path>
78
+ <path
79
+ d="M382.52,47.13V29c0-3.24-2.77-4.47-5.88-4.47a12.3,12.3,0,0,0-4.37.76v21.8h-5.39V23a26.81,26.81,0,0,1,10.06-1.83c6.61,0,11,2.25,11,7.8V47.13Z"
80
+ ></path>
81
+ <path
82
+ d="M403.18,47.79c-7.43,0-10.94-3-10.94-7.81,0-6.8,7.13-8.64,15.6-9.39V29.13c0-3.47-2.37-4.51-5.83-4.51a18,18,0,0,0-6.87,1.46L393.89,23A24,24,0,0,1,403,21.15c5.62,0,9.94,2.3,9.94,8.78V46a22.71,22.71,0,0,1-9.76,1.83m4.66-14.67c-6.27.67-10.46,1.84-10.46,6.73,0,3.42,2.43,4.88,6.23,4.88a10.09,10.09,0,0,0,4.23-.84Z"
83
+ ></path>
84
+ <polygon
85
+ points="418.52 47.13 418.52 34.91 418.52 10.25 423.92 10.25 423.92 22.76 423.92 47.13 418.52 47.13"
86
+ ></polygon>
87
+ <path
88
+ d="M445.39,47.79A19.11,19.11,0,0,1,436.58,46l1.51-4a13.48,13.48,0,0,0,6.22,1.55c3.76,0,6.44-2.21,6.44-5.41,0-7.09-13.44-4.36-13.44-14.42,0-5.13,4.15-9.59,10.72-9.59A15.82,15.82,0,0,1,455.8,16l-1.38,3.52a11.93,11.93,0,0,0-5.66-1.5c-3.5,0-5.79,2.11-5.79,5.12,0,7,13.74,3.94,13.74,14.65,0,5.74-4.71,10-11.32,10"
89
+ ></path>
90
+ <path
91
+ d="M470.41,47.69c-5.31,0-7.34-3.43-7.34-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.92v3.28h-4.92V40.55a3.27,3.27,0,0,0,3,3.52h.48a5.12,5.12,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"
92
+ ></path>
93
+ <path
94
+ d="M487.27,47.79c-7.44,0-10.93-3-10.93-7.81,0-6.8,7.13-8.64,15.6-9.39V29.13c0-3.47-2.38-4.51-5.84-4.51a18,18,0,0,0-6.87,1.46L478,23a23.94,23.94,0,0,1,9.11-1.83c5.62,0,9.94,2.3,9.94,8.78V46a22.71,22.71,0,0,1-9.76,1.83M492,33.16c-6.27.67-10.46,1.84-10.46,6.73,0,3.42,2.42,4.88,6.22,4.88a10,10,0,0,0,4.24-.84Z"
95
+ ></path>
96
+ <path
97
+ d="M511.73,47.69c-5.32,0-7.35-3.43-7.35-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.92v3.28h-4.92V40.55a3.26,3.26,0,0,0,3,3.52h.5a5.5,5.5,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"
98
+ ></path>
99
+ <path
100
+ d="M521.66,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.45V47.13h-5.45Z"
101
+ ></path>
102
+ <path
103
+ d="M536.19,47.79A15.9,15.9,0,0,1,528.54,46L530,42.48a10.53,10.53,0,0,0,5.52,1.5c2.77,0,5-1.78,5-3.94,0-6-11.1-3.2-11.1-11.47,0-3.76,3.37-7.42,8.86-7.42A13.56,13.56,0,0,1,545.34,23l-1.42,3.14a8.47,8.47,0,0,0-4.62-1.45c-2.81,0-4.54,1.69-4.54,3.62,0,5.64,11.32,3.14,11.32,11.6,0,4-3.85,7.9-9.89,7.9"
104
+ ></path>
105
+ <path
106
+ d="M559.83,47.69c-5.31,0-7.35-3.43-7.35-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.93v3.28h-4.93V40.55a3.27,3.27,0,0,0,3,3.52h.48a5.64,5.64,0,0,0,1.47-.23v3.33a7.72,7.72,0,0,1-3,.52"
107
+ ></path>
108
+ <path
109
+ d="M569.77,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.44V47.13h-5.44Z"
110
+ ></path>
111
+ <path
112
+ d="M588.14,47.79c-6.23,0-11-5.08-11-13.35s4.88-13.29,11-13.29A10.51,10.51,0,0,1,594.66,23l-1.21,3a6.87,6.87,0,0,0-4-1.22c-4.4,0-6.69,3.81-6.69,9.49s2.63,9.59,6.61,9.59a6.74,6.74,0,0,0,4-1.28L594.7,46c-1.12.94-3.33,1.84-6.56,1.84"
113
+ ></path>
114
+ <path
115
+ d="M605.1,47.79A15.9,15.9,0,0,1,597.45,46l1.42-3.47A10.54,10.54,0,0,0,604.4,44c2.77,0,5-1.78,5-3.94,0-6-11.1-3.2-11.1-11.47,0-3.76,3.37-7.42,8.85-7.42a13.49,13.49,0,0,1,7.1,1.83l-1.42,3.14a8.42,8.42,0,0,0-4.63-1.45c-2.8,0-4.53,1.69-4.53,3.62,0,5.64,11.32,3.14,11.32,11.6,0,4-3.85,7.9-9.89,7.9"
116
+ ></path>
117
+ </g>
118
+ </svg>
119
+ {:else}
120
+ <svg
121
+ class="{className}"
122
+ xmlns="http://www.w3.org/2000/svg"
123
+ width="{width}"
124
+ height="{height}"
125
+ viewBox="0 5 595 116"
126
+ aria-labelledby="ons-logo-stacked-en-alt"
127
+ >
128
+ <title id="ons-logo-stacked-en-alt">Office for National Statistics logo</title>
129
+ <g class="ons-svg-logo__group ons-svg-logo__group--secondary" fill="{secondary}">
130
+ <path
131
+ d="M0,70.5c1.8-3.7,3.6-7.2,5.6-10.7A127.94,127.94,0,0,1,0,42.6V70.5M10.9,0S0,0,0,13.5v7.2A128.06,128.06,0,0,0,7.9,56.2a114.75,114.75,0,0,1,22.3-26C47.8,15.1,71.5,4.7,103.7.1Z"
132
+ ></path>
133
+ </g>
134
+ <g class="ons-svg-logo__group ons-svg-logo__group--primary" fill="{primary}">
135
+ <path
136
+ d="M115.9,7.3c-36.8,3.5-62,14-80,29.4a108.15,108.15,0,0,0-23.6,29c14.1,27.4,41.1,47.6,86,50.5h4.4s13.8.5,13.8-14.9V7.2l-.6.1M21.2,85.4a92.68,92.68,0,0,1-11-16A173,173,0,0,0,0,93.4v22.7l73.6.1c-22.9-5.5-40.1-16.4-52.4-30.8"
137
+ ></path>
138
+ </g>
139
+ <g class="ons-svg-logo__group ons-svg-logo__group--text" fill="{primary}">
140
+ <path
141
+ d="M161,51.9c-11.3,0-16.3-9.3-16.3-20.8s5-20.8,16.3-20.8,16.3,9.5,16.3,20.8c-.1,11.5-5.1,20.8-16.3,20.8m0-38.3c-8.3,0-11.3,9.1-11.3,17.4s2.7,17.3,11.3,17.3,11.2-9.1,11.2-17.3S169.3,13.6,161,13.6m30.2,8.9V51.2h-4.5V22.6H182V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8l-6.7-.1Zm18.9,0V51.2h-4.5V22.6h-4.7V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8l-6.7-.1Zm14-8.8a2.82,2.82,0,0,1-2.9-2.8,2.9,2.9,0,0,1,5.8,0,2.76,2.76,0,0,1-2.9,2.8m-2.3,6h4.6V51.2h-4.6Zm24.3,32.2c-7.4,0-13.2-6.4-13.2-16.5,0-10.3,5.8-16.5,13.4-16.5a12.36,12.36,0,0,1,7.7,2.2l-1.2,2.8a8.92,8.92,0,0,0-5.5-1.7c-6.4,0-9.7,5.5-9.7,13,0,7.7,3.7,13.2,9.5,13.2a9.8,9.8,0,0,0,5.6-1.7l1.2,3c-1.3,1.2-4,2.2-7.8,2.2m15.3-14.6c.6,7.4,4.7,11.1,11.1,11.1a18.36,18.36,0,0,0,8.5-1.9l1.3,3.2a22.58,22.58,0,0,1-10.2,2.1c-8.8,0-15.1-5.3-15.1-16.6,0-10.8,5.8-16.4,13.7-16.4s12.9,4.9,12.9,15.4l-22.2,3.1ZM270.5,22c-5.1,0-9.4,4-9.3,12.8l17.9-2.5C279,25,275.5,22,270.5,22m42.2.5V51.2h-4.5V22.6h-4.7V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8Zm23.2,29.4c-9.3,0-13.5-7.2-13.5-16.5s4.2-16.5,13.5-16.5,13.5,7.2,13.5,16.5-4.2,16.5-13.5,16.5m0-29.8c-6.9,0-8.8,7-8.8,13.4s2.1,13.1,8.8,13.1c6.9,0,8.9-6.6,8.9-13.1s-2-13.4-8.9-13.4m33.3.6c-2.9-.8-7.1-.6-9.1.6V51.2h-4.6V21.1c3.3-1.4,6.6-2.2,12.5-2.2h2.4c0,.1-1.2,3.8-1.2,3.8ZM171.3,114.8,153.5,87.3c-1.3-2.1-2.3-4.1-2.3-4.1h-.1s.2,2.3.2,4.8v26.8h-5.8V74.7h6.6L169,100.5a46.13,46.13,0,0,1,2.4,4.1h.1s-.2-2.3-.2-4.7V74.6h5.9v40.1l-5.9.1Zm25,.8c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.8-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8l-1.6-3.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.7,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm24.5,18.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2c0,2.5,1.4,4.4,4.3,4.4a5.66,5.66,0,0,0,1.8-.3v4.1a11.47,11.47,0,0,1-3.7.6M239,77.9a3.52,3.52,0,1,1,3.9-3.5,3.71,3.71,0,0,1-3.9,3.5m-3.4,5.5h6.8v31.4h-6.8Zm26.9,32.2c-9.6,0-14.4-7.1-14.4-16.5s4.8-16.6,14.4-16.6,14.3,7.2,14.3,16.6-4.7,16.5-14.3,16.5m0-28.7c-5.8,0-7.5,6.1-7.5,12.2s1.8,11.9,7.5,11.9,7.5-5.8,7.5-11.9-1.7-12.2-7.5-12.2m39.3,27.9V92.3c0-4-3.4-5.5-7.3-5.5a16,16,0,0,0-5.4.9v27.1h-6.7v-30a32.8,32.8,0,0,1,12.5-2.3c8.2,0,13.7,2.8,13.7,9.7v22.6Zm25.7.8c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.9-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8L316,84.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.7,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm13.2,17.4V69h6.7v45.8Zm38.6.8a23.94,23.94,0,0,1-10.9-2.3l1.9-4.9a17,17,0,0,0,7.7,1.9c4.7,0,8-2.7,8-6.7,0-8.8-16.7-5.4-16.7-17.9,0-6.4,5.2-11.9,13.3-11.9a20.22,20.22,0,0,1,9.7,2.3l-1.7,4.4a14.57,14.57,0,0,0-7-1.9c-4.3,0-7.2,2.6-7.2,6.4,0,8.6,17.1,4.9,17.1,18.2-.1,7.1-6,12.4-14.2,12.4m31.1-.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2a4.07,4.07,0,0,0,4.3,4.4,5.66,5.66,0,0,0,1.8-.3v4.1a12.06,12.06,0,0,1-3.7.6m20.9.1c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.9-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8l-1.6-3.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.6,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm24.6,18.1c-6.6,0-9.1-4.3-9.1-8.5V87.5H454V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2a4.07,4.07,0,0,0,4.3,4.4,5.66,5.66,0,0,0,1.8-.3v4.1a12.69,12.69,0,0,1-3.7.6m12.3-37.6a3.52,3.52,0,1,1,3.9-3.5,3.65,3.65,0,0,1-3.9,3.5m-3.4,5.5h6.8v31.4h-6.8Zm21.4,32.2a19.46,19.46,0,0,1-9.5-2.3l1.8-4.3a13.21,13.21,0,0,0,6.9,1.9c3.4,0,6.2-2.2,6.2-4.9,0-7.5-13.8-4-13.8-14.2,0-4.7,4.2-9.2,11-9.2a16.21,16.21,0,0,1,8.8,2.3l-1.8,3.9a10.31,10.31,0,0,0-5.7-1.8c-3.5,0-5.6,2.1-5.6,4.5,0,7,14,3.9,14,14.4,0,4.9-4.7,9.7-12.3,9.7m29.4-.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2c0,2.5,1.4,4.4,4.3,4.4a5.66,5.66,0,0,0,1.8-.3v4.1a12.06,12.06,0,0,1-3.7.6m12.3-37.6a3.52,3.52,0,1,1,3.9-3.5c.1,2-1.7,3.5-3.9,3.5m-3.3,5.5H543v31.4h-6.8Zm26.2,32.2c-7.7,0-13.6-6.3-13.6-16.6s6.1-16.5,13.7-16.5c3.9,0,6.6,1.1,8,2.3L569,88.6a8.61,8.61,0,0,0-4.9-1.5c-5.5,0-8.3,4.7-8.3,11.8s3.3,11.9,8.2,11.9a8.39,8.39,0,0,0,4.9-1.6l1.7,4.1c-1.5,1.2-4.2,2.3-8.2,2.3m20.6,0a19.46,19.46,0,0,1-9.5-2.3l1.8-4.3a13.21,13.21,0,0,0,6.9,1.9c3.4,0,6.2-2.2,6.2-4.9,0-7.5-13.8-4-13.8-14.2,0-4.7,4.2-9.2,11-9.2a16.85,16.85,0,0,1,8.9,2.3l-1.8,3.9A10.31,10.31,0,0,0,587,87c-3.5,0-5.6,2.1-5.6,4.5,0,7,14,3.9,14,14.4-.1,4.9-4.9,9.7-12.4,9.7"
142
+ ></path>
143
+ </g>
144
+ </svg>
145
+ {/if}
146
+
147
+ <style>
148
+ svg {
149
+ overflow: visible;
150
+ }</style>
@@ -0,0 +1,513 @@
1
+ <script>
2
+ import { onMount, getContext } from "svelte";
3
+ import Theme from "../Theme/Theme.svelte";
4
+ import ONSLogo from "./ONSLogo.svelte";
5
+
6
+ const page = getContext("page");
7
+
8
+ /**
9
+ * Display compact header without menus
10
+ * @type {boolean}
11
+ */
12
+ export let compact = false;
13
+ /**
14
+ * Optional product title
15
+ * @type {string}
16
+ */
17
+ export let title = "";
18
+ /**
19
+ * Optional link for product title
20
+ * @type {string}
21
+ */
22
+ export let titleHref = "";
23
+ /**
24
+ * Sets a predefined theme
25
+ * @type {"light"|"dark"}
26
+ */
27
+ export let theme = null;
28
+ /**
29
+ * Define additional props to override the base theme
30
+ * @type {object}
31
+ */
32
+ export let themeOverrides = null;
33
+
34
+ let lang = "en";
35
+ let baseurl = "//www.ons.gov.uk";
36
+ let baseother = "//cy.ons.gov.uk";
37
+ let path = "";
38
+ let mounted = false;
39
+
40
+ function setPaths(mounted, page) {
41
+ if (mounted) {
42
+ const url = page?.url || document.location;
43
+ lang = url.host.startsWith("cy") ? "cy" : "en";
44
+ baseurl = `//${url.host}`;
45
+ baseother =
46
+ lang === "en"
47
+ ? `//cy.${url.host.replace("www.", "")}`
48
+ : `//www.${url.host.replace("cy.", "")}`;
49
+ path = url.pathname;
50
+ }
51
+ }
52
+ $: setPaths(mounted, $page);
53
+ onMount(() => (mounted = true));
54
+
55
+ let menuExpanded = false;
56
+ let searchExpanded = false;
57
+
58
+ let menu = [
59
+ {
60
+ label_en: "Business, industry and trade",
61
+ label_cy: "Busnes, diwydiant a masnach",
62
+ url: "/businessindustryandtrade",
63
+ expanded: false,
64
+ children: [
65
+ { label_en: "Business", label_cy: "Busnes", url: "/businessindustryandtrade/business" },
66
+ {
67
+ label_en: "Changes to business",
68
+ label_cy: "Newidiadau i fusnesau",
69
+ url: "/businessindustryandtrade/changestobusiness",
70
+ },
71
+ {
72
+ label_en: "Construction industry",
73
+ label_cy: "Diwydiant adeiladu",
74
+ url: "/businessindustryandtrade/constructionindustry",
75
+ },
76
+ {
77
+ label_en: "IT and internet industry",
78
+ label_cy: "Y diwydiant TG a'r rhyngrwyd",
79
+ url: "/businessindustryandtrade",
80
+ },
81
+ {
82
+ label_en: "International trade",
83
+ label_cy: "Masnach ryngwladol",
84
+ url: "/businessindustryandtrade/itandinternetindustry",
85
+ },
86
+ {
87
+ label_en: "Manufacturing and production industry",
88
+ label_cy: "Y diwydiant gweithgynhyrchu a chynhyrchu",
89
+ url: "/businessindustryandtrade/manufacturingandproductionindustry",
90
+ },
91
+ {
92
+ label_en: "Retail industry",
93
+ label_cy: "Y diwydiant manwerthu",
94
+ url: "/businessindustryandtrade/retailindustry",
95
+ },
96
+ {
97
+ label_en: "Tourism industry",
98
+ label_cy: "Y diwydiant twristiaeth",
99
+ url: "/businessindustryandtrade/tourismindustry",
100
+ },
101
+ ],
102
+ },
103
+ {
104
+ label_en: "Economy",
105
+ label_cy: "Yr economi",
106
+ url: "/economy",
107
+ expanded: false,
108
+ children: [
109
+ {
110
+ label_en: "Economic output and productivity",
111
+ label_cy: "Allgynnyrch economaidd a chynhyrchiant",
112
+ url: "/economy/economicoutputandproductivity",
113
+ },
114
+ {
115
+ label_en: "Environmental accounts",
116
+ label_cy: "Cyfrifon amgylcheddol",
117
+ url: "/economy/environmentalaccounts",
118
+ },
119
+ {
120
+ label_en: "Government, public sector and taxes",
121
+ label_cy: "Llywodraeth, y sector cyhoeddus a threthi",
122
+ url: "/economy/governmentpublicsectorandtaxes",
123
+ },
124
+ {
125
+ label_en: "Gross Domestic Product (GDP)",
126
+ label_cy: "Cynnyrch Domestig Gros (CDG)",
127
+ url: "/economy/grossdomesticproductgdp",
128
+ },
129
+ {
130
+ label_en: "Gross Value Added (GVA)",
131
+ label_cy: "Gwerth Ychwanegol Gros",
132
+ url: "/economy/grossvalueaddedgva",
133
+ },
134
+ {
135
+ label_en: "Inflation and price indices",
136
+ label_cy: "Mynegeion chwyddiant a phrisiau",
137
+ url: "/economy/inflationandpriceindices",
138
+ },
139
+ {
140
+ label_en: "Investments, pensions and trusts",
141
+ label_cy: "Buddsoddiadau, pensiynau ac ymddiriedolaethau",
142
+ url: "/economy/investmentspensionsandtrusts",
143
+ },
144
+ {
145
+ label_en: "National accounts",
146
+ label_cy: "Cyfrifon gwladol",
147
+ url: "/economy/nationalaccounts",
148
+ },
149
+ {
150
+ label_en: "Regional accounts",
151
+ label_cy: "Cyfrifon rhanbarthol",
152
+ url: "/economy/regionalaccounts",
153
+ },
154
+ ],
155
+ },
156
+ {
157
+ label_en: "Employment and labour market",
158
+ label_cy: "Cyflogaeth a'r farchnad lafur",
159
+ url: "/employmentandlabourmarket",
160
+ expanded: false,
161
+ children: [
162
+ {
163
+ label_en: "People in work",
164
+ label_cy: "Pobl mewn gwaith",
165
+ url: "/employmentandlabourmarket/peopleinwork",
166
+ },
167
+ {
168
+ label_en: "People not in work",
169
+ label_cy: "Pobl nad ydynt mewn gwaith",
170
+ url: "/employmentandlabourmarket/peoplenotinwork",
171
+ },
172
+ ],
173
+ },
174
+ {
175
+ label_en: "People, population and community",
176
+ label_cy: "Pobl, y boblogaeth a chymunedau",
177
+ url: "/peoplepopulationandcommunity",
178
+ expanded: false,
179
+ children: [
180
+ {
181
+ label_en: "Births, deaths and marriages",
182
+ label_cy: "Genedigaethau, marwolaethau a phriodasau",
183
+ url: "/peoplepopulationandcommunity/birthsdeathsandmarriages",
184
+ },
185
+ {
186
+ label_en: "Crime and justice",
187
+ label_cy: "Troseddu a chyfiawnder",
188
+ url: "/peoplepopulationandcommunity/crimeandjustice",
189
+ },
190
+ {
191
+ label_en: "Cultural identity",
192
+ label_cy: "Hunaniaeth ddiwylliannol",
193
+ url: "/peoplepopulationandcommunity/culturalidentity",
194
+ },
195
+ {
196
+ label_en: "Education and childcare",
197
+ label_cy: "Addysg a gofal plant",
198
+ url: "/peoplepopulationandcommunity/educationandchildcare",
199
+ },
200
+ {
201
+ label_en: "Elections",
202
+ label_cy: "Etholiadau",
203
+ url: "/peoplepopulationandcommunity/elections",
204
+ },
205
+ {
206
+ label_en: "Health and social care",
207
+ label_cy: "Iechyd a gofal cymdeithasol",
208
+ url: "/peoplepopulationandcommunity/healthandsocialcare",
209
+ },
210
+ {
211
+ label_en: "Household characteristics",
212
+ label_cy: "Nodweddion aelwydydd",
213
+ url: "/peoplepopulationandcommunity/householdcharacteristics",
214
+ },
215
+ { label_en: "Housing", label_cy: "Tai", url: "/peoplepopulationandcommunity/housing" },
216
+ {
217
+ label_en: "Leisure and tourism",
218
+ label_cy: "Hamdden a thwristiaeth",
219
+ url: "/peoplepopulationandcommunity/leisureandtourism",
220
+ },
221
+ {
222
+ label_en: "Personal and household finances",
223
+ label_cy: "Cyllid personol a chyllid aelwydydd",
224
+ url: "/peoplepopulationandcommunity/personalandhouseholdfinances",
225
+ },
226
+ {
227
+ label_en: "Population and migration",
228
+ label_cy: "Poblogaeth ac ymfudo",
229
+ url: "/peoplepopulationandcommunity/populationandmigration",
230
+ },
231
+ {
232
+ label_en: "Well-being",
233
+ label_cy: "Lles",
234
+ url: "/peoplepopulationandcommunity/wellbeing",
235
+ },
236
+ ],
237
+ },
238
+ { label_en: "Taking part in a survey?", label_cy: "Cymryd rhan mewn arolwg?", url: "/surveys" },
239
+ {
240
+ label_en: "Release calendar",
241
+ label_cy: "Calendar datganiadau",
242
+ url: "/releasecalendar",
243
+ secondary: true,
244
+ },
245
+ { label_en: "Methodology", label_cy: "Methodoleg", url: "/methodology", secondary: true },
246
+ { label_en: "Media", label_cy: "Media", url: "/news", secondary: true },
247
+ { label_en: "About", label_cy: "Amdanom ni", url: "/aboutus", secondary: true },
248
+ { label_en: "Blog", label_cy: "Blog", url: "https://blog.ons.gov.uk/", secondary: true },
249
+ ];
250
+
251
+ const texts = {
252
+ Home: "Hafan",
253
+ Search: "Chwilio",
254
+ Menu: "Dewislen",
255
+ "Hide search": "Cuddio",
256
+ "Office for National Statistics logo - Homepage": "Logo Swyddfa Ystadegau Gwladol - Hafan",
257
+ "Search for a keyword(s) or time series ID": "Chwilio am allweddair neu ID cyfres amser",
258
+ };
259
+
260
+ const i18n = (text) => (lang == "cy" && texts[text] ? texts[text] : text);
261
+
262
+ function toggle_sm(e, i) {
263
+ if (window.matchMedia("(max-width:767px)").matches) {
264
+ e.preventDefault();
265
+ menu[i].expanded = !menu[i].expanded;
266
+ }
267
+ }
268
+ </script>
269
+
270
+ <Theme theme="{theme}" overrides="{themeOverrides}">
271
+ {#if lang}
272
+ <header class="ons-header" role="banner">
273
+ <a class="skiplink" href="#main" tabindex="0">
274
+ {i18n("Skip to main content")}
275
+ </a>
276
+ <div id="pagePath" class="hide">{path}</div>
277
+ <slot name="before" />
278
+ {#if compact}
279
+ <div
280
+ class="ons-header__top"
281
+ style:border-bottom="{!title ? "1px solid var(--ons-color-borders)" : null}"
282
+ >
283
+ <div class="ons-container">
284
+ <div
285
+ class="ons-header__grid-top ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap"
286
+ >
287
+ <div class="ons-grid__col ons-col-auto">
288
+ <a class="ons-header__org-logo-link" href="#0"
289
+ ><div class="ons-header__org-logo ons-header__org-logo--large">
290
+ <ONSLogo width="{197}" height="{19}" />
291
+ </div>
292
+ <div class="ons-header__org-logo ons-header__org-logo--small">
293
+ <ONSLogo width="{120}" height="{27}" compact />
294
+ </div></a
295
+ >
296
+ </div>
297
+ </div>
298
+ </div>
299
+ </div>
300
+ {:else}
301
+ <div class="wrapper">
302
+ <div class="header col-wrap">
303
+ <div class="col col--lg-one-third col--md-one-third">
304
+ <a href="{baseurl}/">
305
+ <ONSLogo className="logo" height="{39}" compact />
306
+ </a>
307
+ </div>
308
+ <div
309
+ class="col col--lg-two-thirds col--md-two-thirds hide--sm print--hide language--js__container"
310
+ >
311
+ <div class="language">
312
+ {#if lang == "en"}
313
+ <span>English (EN) | </span>
314
+ <a href="{baseother}{path}" class="language__link" lang="cy">Cymraeg (CY)</a>
315
+ {:else}
316
+ <a href="{baseother}{path}" class="language__link" lang="en">English (EN)</a>
317
+ <span> | Cymraeg (EN)</span>
318
+ {/if}
319
+ </div>
320
+ </div>
321
+ <div class="secondary-nav col col--lg-two-thirds col--md-two-thirds print--hide">
322
+ <ul class="secondary-nav__list js-nav-clone__list">
323
+ {#each menu.filter((d) => d.secondary) as item}
324
+ <li class="secondary-nav__item">
325
+ <a class="secondary-nav__link js-nav-clone__link" href="{baseurl}{item.url}"
326
+ >{item["label_" + lang]}</a
327
+ >
328
+ </li>
329
+ {/each}
330
+ </ul>
331
+ </div>
332
+ </div>
333
+ </div>
334
+ <div class="primary-nav print--hide">
335
+ <nav aria-label="Header links">
336
+ <ul class="nav--controls">
337
+ <li class="nav--controls__item" class:menu-is-expanded="{menuExpanded}">
338
+ <a
339
+ href="#nav-primary"
340
+ id="menu-toggle"
341
+ aria-controls="nav-primary"
342
+ aria-expanded="{menuExpanded}"
343
+ class="nav--controls__menu"
344
+ on:click|preventDefault="{() => {
345
+ menuExpanded = !menuExpanded;
346
+ searchExpanded = false;
347
+ }}"
348
+ >
349
+ <span class="nav--controls__text">{i18n("Menu")}</span>
350
+ </a>
351
+ </li>
352
+ <li class="nav--controls__item" class:search-is-expanded="{searchExpanded}">
353
+ <a
354
+ href="#nav-search"
355
+ id="search-toggle"
356
+ aria-controls="nav-search"
357
+ aria-expanded="{searchExpanded}"
358
+ class="nav--controls__search"
359
+ on:click|preventDefault="{() => {
360
+ searchExpanded = !searchExpanded;
361
+ menuExpanded = false;
362
+ }}"
363
+ >
364
+ <span class="nav--controls__text"
365
+ >{searchExpanded ? i18n("Hide search") : i18n("Search")}</span
366
+ >
367
+ </a>
368
+ </li>
369
+ </ul>
370
+ <ul
371
+ class="wrapper primary-nav__list"
372
+ class:nav-main--hidden="{!menuExpanded}"
373
+ id="nav-primary"
374
+ aria-expanded="{menuExpanded}"
375
+ >
376
+ <li class="primary-nav__item js-nav">
377
+ <a
378
+ class="primary-nav__link col col--md-7 col--lg-9"
379
+ href="{baseurl}/"
380
+ style="color: #e5e6e7">{i18n("Home")}</a
381
+ >
382
+ </li>
383
+ {#each [...menu
384
+ .filter((d) => d.children)
385
+ .sort( (a, b) => a["label_" + lang].localeCompare(b["label_" + lang]) ), ...menu.filter((d) => !d.children)] as item, i}
386
+ {#if item.children}
387
+ <li
388
+ class="primary-nav__item js-nav js-expandable"
389
+ class:js-expandable-active="{item.expanded}"
390
+ >
391
+ <a
392
+ class="primary-nav__link col col--md-8 col--lg-10"
393
+ href="{baseurl}{item.url}"
394
+ aria-expanded="false"
395
+ aria-label="{item['label_' + lang]} sub menu"
396
+ on:click="{(e) => toggle_sm(e, i)}"
397
+ >
398
+ <span aria-hidden="true" class="expansion-indicator"></span>
399
+ <span class="submenu-title">
400
+ {item["label_" + lang]}
401
+ </span>
402
+ </a>
403
+ <ul
404
+ class="primary-nav__child-list col col--md-16 col--lg-20 js-expandable__content jsEnhance"
405
+ class:js-nav-hidden="{!item.expanded}"
406
+ aria-expanded="{item.expanded}"
407
+ aria-label="submenu"
408
+ >
409
+ <li class="primary-nav__child-item js-expandable__child hide--md">
410
+ <a class="primary-nav__child-link" tabindex="-1" href="{baseurl}{item.url}"
411
+ >{item["label_" + lang]}</a
412
+ >
413
+ </li>
414
+ {#each [...item.children].sort( (a, b) => a["label_" + lang].localeCompare(b["label_" + lang]) ) as child}
415
+ <li class="primary-nav__child-item js-expandable__child">
416
+ <a
417
+ class="primary-nav__child-link"
418
+ tabindex="-1"
419
+ href="{baseurl}{child.url}">{child["label_" + lang]}</a
420
+ >
421
+ </li>
422
+ {/each}
423
+ </ul>
424
+ </li>
425
+ {:else}
426
+ <li class="primary-nav__item js-nav" class:hide--md="{item.secondary}">
427
+ <a
428
+ class="primary-nav__link col col--md-8 col--lg-10"
429
+ href="{baseurl}{item.url}"
430
+ >
431
+ {item["label_" + lang]}
432
+ </a>
433
+ </li>
434
+ {/if}
435
+ {/each}
436
+ <li class="hide--md primary-nav__language">
437
+ {#if lang == "en"}
438
+ <span>English (EN) | </span>
439
+ <a href="{baseother}{path}" class="language__link" lang="cy">Cymraeg (CY)</a>
440
+ {:else}
441
+ <a href="{baseother}{path}" class="language__link" lang="en">English (EN)</a>
442
+ <span> | Cymraeg (EN)</span>
443
+ {/if}
444
+ </li>
445
+ </ul>
446
+ </nav>
447
+ </div>
448
+ <div
449
+ class="search print--hide"
450
+ class:nav-search--hidden="{!searchExpanded}"
451
+ id="searchBar"
452
+ aria-expanded="{searchExpanded}"
453
+ >
454
+ <div class="wrapper" role="search">
455
+ <form class="col-wrap search__form" action="{baseurl}/search">
456
+ <label class="search__label col col--md-23 col--lg-24" for="nav-search"
457
+ >{i18n("Search for a keyword(s) or time series ID")}</label
458
+ >
459
+ <input
460
+ type="search"
461
+ autocomplete="off"
462
+ class="search__input col col--md-21 col--lg-32"
463
+ id="nav-search"
464
+ name="q"
465
+ value=""
466
+ />
467
+ <button
468
+ type="submit"
469
+ class="search__button col--md-3 col--lg-3"
470
+ id="nav-search-submit"
471
+ >
472
+ <span class="visuallyhidden">{i18n("Search")}</span>
473
+ <span class="icon-search--light">
474
+ <svg
475
+ class="ons-svg-icon ons-svg-icon--m"
476
+ viewBox="0 0 12 12"
477
+ xmlns="http://www.w3.org/2000/svg"
478
+ aria-hidden="true"
479
+ fill="currentColor"
480
+ >
481
+ <path
482
+ d="M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0
483
+ 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z"></path>
484
+ </svg>
485
+ </span>
486
+ </button>
487
+ </form>
488
+ </div>
489
+ </div>
490
+ {/if}
491
+ {#if title}
492
+ <div class="ons-header__main">
493
+ <div class="ons-container">
494
+ <div
495
+ class="ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap"
496
+ >
497
+ <div class="ons-grid__col ons-col-auto ons-u-flex-shrink">
498
+ <a class="ons-header__title-link" href="{titleHref}"
499
+ ><div class="ons-header__title">{title}</div></a
500
+ >
501
+ </div>
502
+ </div>
503
+ </div>
504
+ </div>
505
+ {/if}
506
+ </header>
507
+ {/if}
508
+ </Theme>
509
+
510
+ <style>
511
+ .ons-header__top {
512
+ background: none;
513
+ }</style>