@onsvisual/svelte-components 0.0.6 → 0.0.8
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/dist/@types/datavis/Table/Table.svelte.d.ts +4 -4
- package/dist/@types/datavis/shared/data.d.ts +6 -0
- package/dist/@types/index.d.ts +1 -0
- package/dist/@types/inputs/Button/Button.svelte.d.ts +2 -2
- package/dist/@types/inputs/Dropdown/Dropdown.svelte.d.ts +2 -2
- package/dist/@types/inputs/ErrorSummary/ErrorSummary.svelte.d.ts +27 -0
- package/dist/@types/inputs/Input/Input.svelte.d.ts +2 -2
- package/dist/@types/inputs/Select/Select.svelte.d.ts +2 -2
- package/dist/@types/inputs/Textarea/Textarea.svelte.d.ts +2 -2
- package/dist/@types/layout/Accordion/AccordionItem.svelte.d.ts +2 -2
- package/dist/@types/layout/AnalyticsBanner/AnalyticsBanner.svelte.d.ts +30 -0
- package/dist/@types/layout/BackLink/Backlink.svelte.d.ts +23 -0
- package/dist/@types/layout/Breadcrumb/Breadcrumb.svelte.d.ts +23 -0
- package/dist/@types/layout/Contents/Contents.svelte.d.ts +29 -0
- package/dist/@types/layout/ErrorPage/ErrorPage.svelte.d.ts +25 -0
- package/dist/@types/layout/Grid/Grid.svelte.d.ts +2 -2
- package/dist/@types/layout/Header/Header.svelte.d.ts +2 -2
- package/dist/@types/layout/Hero/Hero.svelte.d.ts +2 -2
- package/dist/@types/layout/NavSections/NavSection.svelte.d.ts +2 -2
- package/dist/@types/layout/Notice/Notice.svelte.d.ts +31 -0
- package/dist/@types/layout/PhaseBanner/PhaseBanner.svelte.d.ts +25 -0
- package/dist/@types/layout/Scroller/Scroller.svelte.d.ts +2 -2
- package/dist/@types/layout/Scroller/ScrollerSection.svelte.d.ts +2 -2
- package/dist/@types/layout/Section/Section.svelte.d.ts +2 -2
- package/dist/@types/layout/ShareButtons/ShareButtons.svelte.d.ts +33 -0
- package/dist/@types/layout/Summary/Summary.svelte.d.ts +25 -0
- package/dist/@types/layout/Survey/Survey.svelte.d.ts +23 -0
- package/dist/@types/layout/Survey/init-survey.d.ts +1 -0
- package/dist/@types/layout/Tabs/Tab.svelte.d.ts +31 -0
- package/dist/@types/layout/Tabs/Tabs.svelte.d.ts +27 -0
- package/dist/@types/layout/TitleBlock/TitleBlock.svelte.d.ts +2 -2
- package/dist/datavis/Table/Table.svelte +1 -1
- package/dist/datavis/shared/data.js +18 -0
- package/dist/decorators/Divider/Divider.svelte +1 -1
- package/dist/index.js +2 -0
- package/dist/inputs/ErrorSummary/ErrorSummary.svelte +21 -0
- package/dist/layout/Accordion/AccordionItem.svelte +1 -1
- package/dist/layout/AnalyticsBanner/AnalyticsBanner.svelte +256 -0
- package/dist/layout/BackLink/Backlink.svelte +32 -0
- package/dist/layout/Breadcrumb/Breadcrumb.svelte +39 -0
- package/dist/layout/Contents/Contents.svelte +44 -0
- package/dist/layout/ErrorPage/ErrorPage.svelte +39 -0
- package/dist/layout/Filler/Filler.svelte +1 -1
- package/dist/layout/Footer/Footer.svelte +1 -1
- package/dist/layout/Grid/Grid.svelte +1 -1
- package/dist/layout/Header/Header.svelte +2 -2
- package/dist/layout/Hero/Hero.svelte +2 -2
- package/dist/layout/NavSections/NavSection.svelte +3 -3
- package/dist/layout/Notice/Notice.svelte +54 -0
- package/dist/layout/PhaseBanner/PhaseBanner.svelte +40 -0
- package/dist/layout/Scroller/ScrollerSection.svelte +3 -3
- package/dist/layout/Section/Section.svelte +4 -4
- package/dist/layout/ShareButtons/ShareButtons.svelte +177 -0
- package/dist/layout/Summary/Summary.svelte +51 -0
- package/dist/layout/Survey/Survey.svelte +96 -0
- package/dist/layout/Survey/init-survey.js +230 -0
- package/dist/layout/Tabs/Tab.svelte +48 -0
- package/dist/layout/Tabs/Tabs.svelte +85 -0
- package/dist/layout/TitleBlock/Meta.svelte +1 -1
- package/dist/layout/TitleBlock/TitleBlock.svelte +1 -1
- package/package.json +17 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* Phase of project (alpha, beta, prototype etc.)
|
|
4
|
+
* @type {string}
|
|
5
|
+
*/
|
|
6
|
+
export let phase = "Beta";
|
|
7
|
+
/**
|
|
8
|
+
* URL of feedback form (relative or absolute)
|
|
9
|
+
* @type {string}
|
|
10
|
+
*/
|
|
11
|
+
export let href = "/feedback";
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="ons-phase-banner">
|
|
15
|
+
<div class="ons-container">
|
|
16
|
+
<div class="ons-grid ons-grid--flex ons-grid--gutterless ons-grid--no-wrap">
|
|
17
|
+
<div class="ons-grid__col ons-col-auto ons-u-flex-no-grow ons-u-flex-no-shrink">
|
|
18
|
+
<strong class="ons-phase-banner__badge">{phase}</strong>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="ons-col-auto ons-grid--flex ons-grid--no-wrap@l ons-grid--vertical-center">
|
|
21
|
+
<span class="ons-u-fs-s ons-u-m-no">
|
|
22
|
+
{#if phase.toLowerCase() === "prototype"}
|
|
23
|
+
This is a prototype – your <a href="{href}">feedback</a> will help us improve it.
|
|
24
|
+
{:else}
|
|
25
|
+
This is a new service – your <a href="{href}">feedback</a> will help us improve it.
|
|
26
|
+
{/if}
|
|
27
|
+
</span>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
.ons-phase-banner {
|
|
35
|
+
background: var(--pale, rgb(245, 245, 246)) !important;
|
|
36
|
+
}
|
|
37
|
+
.ons-phase-banner__badge {
|
|
38
|
+
background: var(--text, rgb(34, 34, 34)) !important;
|
|
39
|
+
color: var(--background, white) !important;
|
|
40
|
+
}</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { onMount } from "svelte";
|
|
3
|
-
import Container from "
|
|
3
|
+
import Container from "../../wrappers/Container/Container.svelte";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Sets the unique ID of the section
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
<section data-id="{id}" bind:this="{section}">
|
|
36
36
|
<Container theme="{theme}" width="narrow" background="none">
|
|
37
37
|
<div class="ons-scroller-section" style:--background="{background}">
|
|
38
|
-
{#if title
|
|
39
|
-
<h2 class="section-title">{title}</h2>
|
|
38
|
+
{#if title}
|
|
39
|
+
<h2 class="section-title" class:ons-u-vh="{hideTitle}">{title}</h2>
|
|
40
40
|
{/if}
|
|
41
41
|
<slot />
|
|
42
42
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { slugify } from "
|
|
3
|
-
import Container from "
|
|
2
|
+
import { slugify } from "../../js/utils.js";
|
|
3
|
+
import Container from "../../wrappers/Container/Container.svelte";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Sets the unique ID of the section
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
marginBottom="{marginBottom}"
|
|
53
53
|
>
|
|
54
54
|
<section id="{id ? id : slugify(title)}" aria-label="{title}" class="ons-feature__section">
|
|
55
|
-
{#if title
|
|
56
|
-
<h2 class="section-title">{title}</h2>
|
|
55
|
+
{#if title}
|
|
56
|
+
<h2 class="section-title" class:ons-u-vh="{hideTitle}">{title}</h2>
|
|
57
57
|
{/if}
|
|
58
58
|
<slot />
|
|
59
59
|
</section>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import Container from "../../wrappers/Container/Container.svelte";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Set the title/call to action
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
export let title = "Share this page";
|
|
10
|
+
/**
|
|
11
|
+
* Sets the width of the container
|
|
12
|
+
* @type {"narrow"|"medium"|"wide"|"full"}
|
|
13
|
+
*/
|
|
14
|
+
export let width = "narrow";
|
|
15
|
+
/**
|
|
16
|
+
* Sets a predefined theme
|
|
17
|
+
* @type {"light"|"dark"|"lightblue"}
|
|
18
|
+
*/
|
|
19
|
+
export let theme = null;
|
|
20
|
+
/**
|
|
21
|
+
* Define additional props to override the base theme
|
|
22
|
+
* @type {object}
|
|
23
|
+
*/
|
|
24
|
+
export let themeOverrides = null;
|
|
25
|
+
/**
|
|
26
|
+
* Optional margin above section
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
*/
|
|
29
|
+
export let marginTop = false;
|
|
30
|
+
/**
|
|
31
|
+
* Optional margin below section
|
|
32
|
+
* @type {boolean}
|
|
33
|
+
*/
|
|
34
|
+
export let marginBottom = true;
|
|
35
|
+
|
|
36
|
+
let href = "";
|
|
37
|
+
let pageTitle = "";
|
|
38
|
+
|
|
39
|
+
onMount(() => {
|
|
40
|
+
href = document.location.href;
|
|
41
|
+
pageTitle = document.title;
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<Container
|
|
46
|
+
theme="{theme}"
|
|
47
|
+
themeOverrides="{themeOverrides}"
|
|
48
|
+
width="{width}"
|
|
49
|
+
marginTop="{marginTop}"
|
|
50
|
+
marginBottom="{marginBottom}"
|
|
51
|
+
>
|
|
52
|
+
<section class="ons-grid ons-u-ml-no" aria-label="Share this dataset">
|
|
53
|
+
<h2 class="ons-u-fs-r--b ons-u-mb-xs">{title}</h2>
|
|
54
|
+
<ul class="ons-list ons-list--inline ons-list--bare ons-list--icons">
|
|
55
|
+
<li class="ons-list__item ons-u-pl-no ons-u-pr-xs">
|
|
56
|
+
<span class="ons-list__prefix">
|
|
57
|
+
<svg
|
|
58
|
+
class="ons-svg-icon ons-svg-icon--xxl"
|
|
59
|
+
id="icon-facebook"
|
|
60
|
+
viewBox="0 0 32 32"
|
|
61
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
+
focusable="false"
|
|
63
|
+
aria-hidden="true"
|
|
64
|
+
>
|
|
65
|
+
<path
|
|
66
|
+
d="M32,16.0986285 C32.0009185,7.5342974 25.337417,0.468462963 16.8372092,0.0203294753 C8.33700136,-0.427804013
|
|
67
|
+
0.97607758,5.89865855 0.0874346352,14.4161886 C-0.801208309,22.9337186 5.09355054,30.6602611 13.5009524,31.9979281
|
|
68
|
+
L13.5009524,20.7518951 L9.44,20.7518951 L9.44,16.0986285 L13.5009524,16.0986285 L13.5009524,12.549267
|
|
69
|
+
C13.5009524,8.5169471 15.8857143,6.28613892 19.5428571,6.28613892 C20.742535,6.30277426 21.9393895,6.40782423
|
|
70
|
+
23.1238095,6.60044523 L23.1238095,10.5637711 L21.1047619,10.5637711 C19.1161905,10.5637711 18.4990476,11.8056643
|
|
71
|
+
18.4990476,13.0782216 L18.4990476,16.0986285 L22.9409524,16.0986285 L22.2247619,20.7518951 L18.4990476,20.7518951
|
|
72
|
+
L18.4990476,31.9979281 C26.2735701,30.760956 31.9991507,24.0182672 32,16.0986285 L32,16.0986285 Z"
|
|
73
|
+
></path>
|
|
74
|
+
</svg>
|
|
75
|
+
</span>
|
|
76
|
+
<a
|
|
77
|
+
href="https://www.facebook.com/sharer/sharer.php?u={href}"
|
|
78
|
+
class="ons-list__link ons-u-fs-r ons-u-pt-xxs"
|
|
79
|
+
target="_blank"
|
|
80
|
+
rel="noreferrer external"
|
|
81
|
+
>Facebook<span class="ons-u-vh">this link will open in a new tab</span>
|
|
82
|
+
</a>
|
|
83
|
+
</li>
|
|
84
|
+
<li class="ons-list__item ons-u-pl-no ons-u-pr-xs">
|
|
85
|
+
<span class="ons-list__prefix">
|
|
86
|
+
<svg
|
|
87
|
+
class="ons-svg-icon ons-svg-icon--xxl"
|
|
88
|
+
id="icon-twitter"
|
|
89
|
+
viewBox="0 0 32 32"
|
|
90
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
91
|
+
focusable="false"
|
|
92
|
+
aria-hidden="true"
|
|
93
|
+
>
|
|
94
|
+
<path
|
|
95
|
+
d="M24.04,12.95c0,0.17,0,0.33,0,0.5c0.01,4.01-2.17,7.71-5.69,9.64c-3.52,1.93-7.81,1.78-11.19-0.38c0.31,0.04,0.61,0.05,0.92,0.05c1.73,0,3.42-0.58,4.78-1.65c-1.65-0.04-3.09-1.11-3.6-2.68c0.25,0.05,0.51,0.07,0.76,0.07c0.34,0,0.68-0.05,1.01-0.14C9.23,18,7.93,16.4,7.95,14.55v-0.05c0.54,0.29,1.13,0.46,1.74,0.48c-1.66-1.12-2.2-3.33-1.23-5.08c1.96,2.41,4.85,3.87,7.95,4.03c-0.07-0.29-0.1-0.58-0.1-0.88c0-1.58,0.97-3,2.44-3.59c1.47-0.58,3.15-0.21,4.23,0.94c0.86-0.17,1.69-0.49,2.45-0.94c-0.28,0.9-0.88,1.65-1.69,2.13c0.76-0.09,1.51-0.29,2.21-0.6C25.43,11.76,24.79,12.42,24.04,12.95zM16,0C7.16,0,0,7.16,0,16s7.16,16,16,16s16-7.16,16-16c0-4.24-1.69-8.31-4.69-11.31S20.24,0,16,0z"
|
|
96
|
+
></path>
|
|
97
|
+
</svg>
|
|
98
|
+
</span>
|
|
99
|
+
<a
|
|
100
|
+
href="https://twitter.com/intent/tweet?original_referer&text={pageTitle}&url={href}"
|
|
101
|
+
class="ons-list__link ons-u-fs-r ons-u-pt-xxs"
|
|
102
|
+
target="_blank"
|
|
103
|
+
rel="noreferrer external"
|
|
104
|
+
>Twitter<span class="ons-u-vh">this link will open in a new tab</span>
|
|
105
|
+
</a>
|
|
106
|
+
</li>
|
|
107
|
+
<li class="ons-list__item ons-u-pl-no ons-u-pr-xs">
|
|
108
|
+
<span class="ons-list__prefix">
|
|
109
|
+
<svg
|
|
110
|
+
class="ons-svg-icon ons-svg-icon--xxl"
|
|
111
|
+
id="icon-linkedin"
|
|
112
|
+
viewBox="0 0 32 32"
|
|
113
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
114
|
+
focusable="false"
|
|
115
|
+
aria-hidden="true"
|
|
116
|
+
>
|
|
117
|
+
<path
|
|
118
|
+
d="M16,-3.41060513e-13 C20.2434638,-3.41060513e-13 24.3131264,1.68570945 27.3137085,4.6862915 C30.3142906,7.68687356
|
|
119
|
+
32,11.7565362 32,16 C32,24.836556 24.836556,32 16,32 C7.163444,32 0,24.836556 0,16 C0,7.163444 7.163444,-3.41060513e-13
|
|
120
|
+
16,-3.41060513e-13 Z M11.3505859,12.4641113 L7.45385744,12.4641113 L7.45385744,24.1875 L11.3505859,24.1875
|
|
121
|
+
L11.3505859,12.4641113 Z M20.9152832,12.1889649 C18.8479004,12.1889649 17.9213867,13.3251953 17.4035644,14.1240234
|
|
122
|
+
L17.4035644,14.1240234 L17.4035644,12.4641113 L13.5070801,12.4641113 C13.5212538,12.7696262 13.5275532,13.809993
|
|
123
|
+
13.5292593,15.1533871 L13.5293118,16.8832762 C13.5292156,16.9843911 13.5291048,17.0860852 13.5289803,17.1882303
|
|
124
|
+
L13.5280782,17.8054916 L13.5280782,17.8054916 L13.5268961,18.427439 C13.5216699,20.9164121 13.5108442,23.3704557
|
|
125
|
+
13.5078578,24.0208157 L13.5070801,24.1875 L17.4035644,24.1875 L17.4035644,17.640625 C17.4035644,17.2902832
|
|
126
|
+
17.4287109,16.9401856 17.5317382,16.6896972 C17.8134766,15.9897461 18.4545899,15.2646484 19.5310059,15.2646484
|
|
127
|
+
C20.940918,15.2646484 21.5051269,16.3395996 21.5051269,17.9157715 L21.5051269,17.9157715 L21.5051269,24.1875
|
|
128
|
+
L25.4013672,24.1875 L25.4013672,17.465332 C25.4013672,13.8645019 23.4790039,12.1889649 20.9152832,12.1889649 Z
|
|
129
|
+
M9.42822263,6.8125 C8.09521488,6.8125 7.22363281,7.68774412 7.22363281,8.83813475 C7.22363281,9.96313475
|
|
130
|
+
8.06933594,10.8632812 9.37695313,10.8632812 L9.37695313,10.8632812 L9.40234375,10.8632812 C10.7612305,10.8632812
|
|
131
|
+
11.6069336,9.96313475 11.6069336,8.83813475 C11.581543,7.68774412 10.7612305,6.8125 9.42822263,6.8125 Z"
|
|
132
|
+
></path>
|
|
133
|
+
</svg>
|
|
134
|
+
</span>
|
|
135
|
+
<a
|
|
136
|
+
href="https://www.linkedin.com/sharing/share-offsite/?url={href}"
|
|
137
|
+
class="ons-list__link ons-u-fs-r ons-u-pt-xxs"
|
|
138
|
+
target="_blank"
|
|
139
|
+
rel="noreferrer external"
|
|
140
|
+
>LinkedIn<span class="ons-u-vh">this link will open in a new tab</span>
|
|
141
|
+
</a>
|
|
142
|
+
</li>
|
|
143
|
+
<li class="ons-list__item ons-u-pl-no ons-u-pr-xs">
|
|
144
|
+
<span class="ons-list__prefix">
|
|
145
|
+
<svg
|
|
146
|
+
class="ons-svg-icon ons-svg-icon--xxl"
|
|
147
|
+
id="icon-email"
|
|
148
|
+
viewBox="0 0 36 36"
|
|
149
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
150
|
+
focusable="false"
|
|
151
|
+
aria-hidden="true"
|
|
152
|
+
>
|
|
153
|
+
<path
|
|
154
|
+
fill-rule="evenodd"
|
|
155
|
+
clip-rule="evenodd"
|
|
156
|
+
d="M30.7279 5.27208C27.3523 1.89642 22.7739 0 18 0C8.05887 0 0 8.05887 0 18C0 27.9411 8.05887 36 18 36C27.9411 36 36
|
|
157
|
+
27.9411 36 18C36 13.2261 34.1036 8.64773 30.7279 5.27208ZM18 19L26 14V12L18 17L10 12V14L18 19ZM8 10H28V26H8V10Z"
|
|
158
|
+
></path>
|
|
159
|
+
</svg>
|
|
160
|
+
</span>
|
|
161
|
+
<a
|
|
162
|
+
href="mailto:?subject={pageTitle}&body={pageTitle}%0A{href}"
|
|
163
|
+
class="ons-list__link ons-u-fs-r ons-u-pt-xxs"
|
|
164
|
+
target="_blank"
|
|
165
|
+
rel="noreferrer external"
|
|
166
|
+
>Email<span class="ons-u-vh">this link will open in a new tab</span>
|
|
167
|
+
</a>
|
|
168
|
+
</li>
|
|
169
|
+
</ul>
|
|
170
|
+
</section>
|
|
171
|
+
</Container>
|
|
172
|
+
|
|
173
|
+
<style>
|
|
174
|
+
.ons-svg-icon {
|
|
175
|
+
color: currentColor;
|
|
176
|
+
fill: currentColor;
|
|
177
|
+
}</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
/**
|
|
3
|
+
* Title for summary table
|
|
4
|
+
* @type {string}
|
|
5
|
+
*/
|
|
6
|
+
export let title = null;
|
|
7
|
+
/**
|
|
8
|
+
* Array of items in format {key, value, href?}
|
|
9
|
+
* @type {array}
|
|
10
|
+
*/
|
|
11
|
+
export let items = [];
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="ons-summary">
|
|
15
|
+
<div id="turnover" class="ons-summary__group">
|
|
16
|
+
{#if title}<h2 class="ons-summary__group-title">{title}</h2>{/if}
|
|
17
|
+
<div class="ons-summary__items ons-u-mb-s ons-u-bt ons-u-bb">
|
|
18
|
+
{#each items as item}
|
|
19
|
+
<div class="ons-summary__item">
|
|
20
|
+
<dl class="ons-summary__row ons-summary__row--has-values" id="sales-dates">
|
|
21
|
+
<dt
|
|
22
|
+
class="ons-summary__item-title ons-u-pt-s ons-u-pb-s ons-u-pr-m ons-u-order--1@xxs@m ons-u-flex--2@xxs@m ons-col-4@m"
|
|
23
|
+
>
|
|
24
|
+
<div class="ons-summary__item--text ons-u-fw-b">{item.key}</div>
|
|
25
|
+
</dt>
|
|
26
|
+
<dd
|
|
27
|
+
class="ons-summary__values ons-u-pt-s ons-u-pb-s ons-u-pr-m ons-u-pl-no@xxs@m ons-u-order--3@xxs@m ons-u-fw@xxs@m
|
|
28
|
+
ons-u-pt-no@xxs@m ons-u-pt-no@xxs@m ons-u-bb-no@xxs@m ons-u-d-b@xxs@m"
|
|
29
|
+
>
|
|
30
|
+
<div>{item.value}</div>
|
|
31
|
+
</dd>
|
|
32
|
+
{#if item.href}
|
|
33
|
+
<dd
|
|
34
|
+
class="ons-summary__actions ons-u-flex-ai-fs ons-u-pt-s ons-u-pb-s ons-u-pl-no@xxs ons-u-ml-xs@xxs ons-u-order--2@xxs@m ons-col-2@m"
|
|
35
|
+
>
|
|
36
|
+
<a href="{item.href}" class="ons-summary__button"
|
|
37
|
+
>Change<span class="ons-u-vh"> value for {item.key}</span></a
|
|
38
|
+
>
|
|
39
|
+
</dd>
|
|
40
|
+
{/if}
|
|
41
|
+
</dl>
|
|
42
|
+
</div>
|
|
43
|
+
{/each}
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<style>
|
|
49
|
+
.ons-summary__values {
|
|
50
|
+
font-weight: normal !important;
|
|
51
|
+
}</style>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import initSurvey from "./init-survey.js";
|
|
4
|
+
|
|
5
|
+
onMount(initSurvey);
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class="wrapper link-adjust">
|
|
9
|
+
<div class="improve-this-page" data-module="improve-this-page">
|
|
10
|
+
<div
|
|
11
|
+
class="improve-this-page__prompt clearfix"
|
|
12
|
+
id="feedback-form-header"
|
|
13
|
+
role="status"
|
|
14
|
+
aria-live="assertive"
|
|
15
|
+
tabindex="-1"
|
|
16
|
+
>
|
|
17
|
+
<div class="improve-this-page__prompt_left">
|
|
18
|
+
<h3 class="improve-this-page__is-useful-question margin-right--1">Is this page useful?</h3>
|
|
19
|
+
<a
|
|
20
|
+
id="feedback-form-yes"
|
|
21
|
+
class="improve-this-page__page-is-useful-button"
|
|
22
|
+
href="/feedback/thanks"
|
|
23
|
+
aria-label="Yes I found this page useful">Yes</a
|
|
24
|
+
>
|
|
25
|
+
<span>|</span>
|
|
26
|
+
<a
|
|
27
|
+
id="feedback-form-no"
|
|
28
|
+
class="js-toggle"
|
|
29
|
+
href="/feedback"
|
|
30
|
+
aria-label="No I didn't find this page useful">No</a
|
|
31
|
+
>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="improve-this-page__prompt_right">
|
|
34
|
+
<a
|
|
35
|
+
id="feedback-form-anything-wrong"
|
|
36
|
+
class="js-toggle improve-this-page__anything-wrong"
|
|
37
|
+
href="/feedback">Can't find what you're looking for?</a
|
|
38
|
+
>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div id="feedback-form" class="improve-this-page__form js-hidden font-size--18">
|
|
42
|
+
<form id="feedback-form-container">
|
|
43
|
+
<input type="hidden" name="url" id="feedback-api-enabled" value="false" />
|
|
44
|
+
<input type="hidden" name="url" id="feedback-api-url" value="" />
|
|
45
|
+
<input type="hidden" name="feedback-form-type" value="footer" />
|
|
46
|
+
<input
|
|
47
|
+
type="hidden"
|
|
48
|
+
name="url"
|
|
49
|
+
id="feedback-form-url"
|
|
50
|
+
value="https://www.ons.gov.uk/datasets/RM169/editions/2021/versions/4"
|
|
51
|
+
/>
|
|
52
|
+
<div class="form-group">
|
|
53
|
+
<label class="form-label-bold" id="description-field-label" for="description-field"
|
|
54
|
+
>How should we improve this page?</label
|
|
55
|
+
>
|
|
56
|
+
<textarea
|
|
57
|
+
id="description-field"
|
|
58
|
+
class="form-control"
|
|
59
|
+
name="description"
|
|
60
|
+
rows="5"
|
|
61
|
+
style="overflow: hidden; overflow-wrap: break-word; resize: horizontal;"></textarea>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="form-group">
|
|
64
|
+
<p class="font-size--24 font-weight-700 margin-bottom--0">Do you want a reply?</p>
|
|
65
|
+
<p class="font-size--18 margin-top--0">
|
|
66
|
+
If you'd like us to get back to you, please add your name and email address below.
|
|
67
|
+
</p>
|
|
68
|
+
<label class="form-label-bold" for="name-field">Name (optional)</label>
|
|
69
|
+
<input id="name-field" class="form-control" type="text" name="name" />
|
|
70
|
+
</div>
|
|
71
|
+
<div class="form-group">
|
|
72
|
+
<label class="form-label-bold" id="email-field-label" for="email-field"
|
|
73
|
+
>Email (optional)</label
|
|
74
|
+
>
|
|
75
|
+
<input id="email-field" class="form-control" type="text" name="email" />
|
|
76
|
+
</div>
|
|
77
|
+
<div>
|
|
78
|
+
<input
|
|
79
|
+
id="feedback-form-submit"
|
|
80
|
+
class="btn btn--primary font-weight-700 margin-bottom--2"
|
|
81
|
+
type="submit"
|
|
82
|
+
value="Send feedback"
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<div>
|
|
86
|
+
<a
|
|
87
|
+
href="javascript:void(0)"
|
|
88
|
+
id="feedback-form-close"
|
|
89
|
+
class="improve-this-page__close js-toggle btn btn--secondary font-weight-700"
|
|
90
|
+
>I don't want to provide feedback</a
|
|
91
|
+
>
|
|
92
|
+
</div>
|
|
93
|
+
</form>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
function initSurveyA() {
|
|
2
|
+
"use strict";
|
|
3
|
+
(function () {
|
|
4
|
+
var e = document.querySelector("#feedback-form-page-container");
|
|
5
|
+
if (e) {
|
|
6
|
+
var t = document.referrer,
|
|
7
|
+
n = "/feedback/thanks",
|
|
8
|
+
r = document.querySelector("#feedback-form-url");
|
|
9
|
+
r && (r.value = t),
|
|
10
|
+
e.addEventListener("submit", function (t) {
|
|
11
|
+
t.preventDefault(),
|
|
12
|
+
document
|
|
13
|
+
.querySelectorAll("#feedback-form-page-container .feedback-form-control__error")
|
|
14
|
+
.forEach((e) => {
|
|
15
|
+
e.classList.remove("feedback-form-control__error");
|
|
16
|
+
}),
|
|
17
|
+
document
|
|
18
|
+
.querySelectorAll("#feedback-form-page-container .feedback-form-error")
|
|
19
|
+
.forEach((e) => {
|
|
20
|
+
e.remove();
|
|
21
|
+
});
|
|
22
|
+
var r = document.querySelector("#email-field"),
|
|
23
|
+
i = document.querySelector("#description-field"),
|
|
24
|
+
o = !1;
|
|
25
|
+
if (i && "" === i.value) {
|
|
26
|
+
var s = document.createElement("span");
|
|
27
|
+
if (
|
|
28
|
+
((s.className = "feedback-form-error"),
|
|
29
|
+
(s.textContent = "Write some feedback"),
|
|
30
|
+
s.setAttribute("role", "alert"),
|
|
31
|
+
!document.querySelector("#description-field-label .feedback-form-error"))
|
|
32
|
+
)
|
|
33
|
+
document.querySelector("#feedback-description-field").insertBefore(s, i);
|
|
34
|
+
i.classList.add("feedback-form-control__error"), i.focus(), (o = !0);
|
|
35
|
+
}
|
|
36
|
+
if (r && "" !== r.value) {
|
|
37
|
+
var a = document.createElement("span");
|
|
38
|
+
(a.className = "feedback-form-error"),
|
|
39
|
+
a.setAttribute("role", "alert"),
|
|
40
|
+
(a.textContent = "This is not a valid email address, correct it or delete it.");
|
|
41
|
+
if (!/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/g.test(r.value)) {
|
|
42
|
+
if (!document.querySelector("#email-field-label .feedback-form-error"))
|
|
43
|
+
document.querySelector("#reply-request").insertBefore(a, r);
|
|
44
|
+
r.classList.add("feedback-form-control__error"), (o = !0);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (!o) {
|
|
48
|
+
var u,
|
|
49
|
+
l,
|
|
50
|
+
c,
|
|
51
|
+
d = document.querySelector("#page-url-field").value,
|
|
52
|
+
h = d ? n + "?returnTo=" + d : n,
|
|
53
|
+
f = {
|
|
54
|
+
method: "POST",
|
|
55
|
+
body: ((u = e), (l = new FormData(u)), (c = new URLSearchParams(l).toString()), c),
|
|
56
|
+
headers: new Headers({
|
|
57
|
+
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
return fetch(h, f)
|
|
61
|
+
.then((e) => {
|
|
62
|
+
if (!e.ok) throw e;
|
|
63
|
+
return (window.location.href = h), e.text();
|
|
64
|
+
})
|
|
65
|
+
.then((e) => e)
|
|
66
|
+
.catch((e) => Promise.reject(e));
|
|
67
|
+
}
|
|
68
|
+
document.querySelector(".feedback-btn").blur();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
})();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function initSurveyB() {
|
|
75
|
+
"use strict";
|
|
76
|
+
|
|
77
|
+
function r(e, t, n, r, i, o) {
|
|
78
|
+
var s = (function (e) {
|
|
79
|
+
var t = new FormData(e);
|
|
80
|
+
return new URLSearchParams(t).toString();
|
|
81
|
+
})(e),
|
|
82
|
+
a = new XMLHttpRequest();
|
|
83
|
+
return (
|
|
84
|
+
a.open("POST", t, !0),
|
|
85
|
+
a.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"),
|
|
86
|
+
(a.onreadystatechange = function () {
|
|
87
|
+
if (a.readyState === XMLHttpRequest.DONE) {
|
|
88
|
+
var e = a.status;
|
|
89
|
+
if (o) return;
|
|
90
|
+
n.innerHTML = 0 === e || (e >= 200 && e < 400) ? r : i;
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
93
|
+
{
|
|
94
|
+
request: a,
|
|
95
|
+
serializedData: s,
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function i(e, t, n, r, i, o) {
|
|
101
|
+
var s = {
|
|
102
|
+
method: "POST",
|
|
103
|
+
body: r,
|
|
104
|
+
headers: new Headers({
|
|
105
|
+
"Content-Type": "application/json; charset=UTF-8",
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
fetch(t, s)
|
|
109
|
+
.then((e) => {
|
|
110
|
+
if (!e.ok) throw e;
|
|
111
|
+
})
|
|
112
|
+
.then((e) => {
|
|
113
|
+
n.innerHTML = o;
|
|
114
|
+
})
|
|
115
|
+
.catch((e) => {
|
|
116
|
+
n.innerHTML = i;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
(function () {
|
|
120
|
+
var e = window.location.href,
|
|
121
|
+
t = "/feedback",
|
|
122
|
+
n = "".concat(t, "/thanks"),
|
|
123
|
+
o = document.querySelector("#feedback-form-header"),
|
|
124
|
+
s =
|
|
125
|
+
'<span id="feedback-form-confirmation">Thank you. Your feedback will help us as we continue to improve the service.</span>',
|
|
126
|
+
a =
|
|
127
|
+
'<span id="feedback-form-error role="alert"">Something went wrong, try using our <a href="/feedback">feedback form</a>.</span>',
|
|
128
|
+
u = !1,
|
|
129
|
+
l = document.querySelector("#feedback-api-enabled"),
|
|
130
|
+
c = document.querySelector("#feedback-api-url"),
|
|
131
|
+
d = document.querySelector("#feedback-form-url");
|
|
132
|
+
d && (d.value = e);
|
|
133
|
+
var h = document.querySelectorAll("a.js-toggle");
|
|
134
|
+
h &&
|
|
135
|
+
h.forEach((e) => {
|
|
136
|
+
e.addEventListener("click", function (t) {
|
|
137
|
+
t.preventDefault();
|
|
138
|
+
var n = document.querySelector("#feedback-form");
|
|
139
|
+
if (
|
|
140
|
+
(n && n.classList.toggle("js-hidden"),
|
|
141
|
+
o && o.classList.toggle("js-hidden"),
|
|
142
|
+
"feedback-form-close" !== e.id)
|
|
143
|
+
) {
|
|
144
|
+
var r = document.querySelector("#description-field");
|
|
145
|
+
r && r.focus();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
var f = document.querySelector("#feedback-form-yes");
|
|
150
|
+
f &&
|
|
151
|
+
o &&
|
|
152
|
+
f.addEventListener("click", function (t) {
|
|
153
|
+
(u = !0), t.preventDefault();
|
|
154
|
+
var d = document.querySelector("#feedback-form-container");
|
|
155
|
+
if (l && "true" === l.value && c) {
|
|
156
|
+
var h = {
|
|
157
|
+
is_page_useful: !0,
|
|
158
|
+
is_general_feedback: !1,
|
|
159
|
+
ons_url: e,
|
|
160
|
+
},
|
|
161
|
+
f = JSON.stringify(h);
|
|
162
|
+
i(d, c.value, o, f, a, s);
|
|
163
|
+
} else {
|
|
164
|
+
var { request: p, serializedData: v } = r(d, n, o, s, a, u);
|
|
165
|
+
(o.innerHTML = s), p.send(v);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
var p = document.querySelector("#feedback-form-container");
|
|
169
|
+
p &&
|
|
170
|
+
p.addEventListener("submit", function (n) {
|
|
171
|
+
n.preventDefault(),
|
|
172
|
+
document
|
|
173
|
+
.querySelectorAll("#feedback-form-container .form-control__error")
|
|
174
|
+
.forEach((e) => {
|
|
175
|
+
e.classList.remove("form-control__error");
|
|
176
|
+
}),
|
|
177
|
+
document.querySelectorAll("#feedback-form-container .form-error").forEach((e) => {
|
|
178
|
+
e.remove();
|
|
179
|
+
});
|
|
180
|
+
var d = document.querySelector("#email-field"),
|
|
181
|
+
h = document.querySelector("#description-field"),
|
|
182
|
+
f = document.querySelector("#name-field"),
|
|
183
|
+
v = !1;
|
|
184
|
+
if (h && "" === h.value) {
|
|
185
|
+
if (!document.querySelector("#description-field-label .form-error"))
|
|
186
|
+
document
|
|
187
|
+
.querySelector("#description-field-label")
|
|
188
|
+
.insertAdjacentHTML(
|
|
189
|
+
"beforeend",
|
|
190
|
+
'<span class="form-error" role="alert">Write some feedback</span>'
|
|
191
|
+
);
|
|
192
|
+
h.classList.add("form-control__error"), (v = !0);
|
|
193
|
+
}
|
|
194
|
+
if (d && "" !== d.value) {
|
|
195
|
+
var m = "";
|
|
196
|
+
m = v
|
|
197
|
+
? '<span class="form-error" role="alert" aria-live="polite">This is not a valid email address, correct it or delete it</span>'
|
|
198
|
+
: '<span class="form-error" role="alert">This is not a valid email address, correct it or delete it</span>';
|
|
199
|
+
if (!/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/g.test(d.value)) {
|
|
200
|
+
if (!document.querySelector("#email-field-label .form-error"))
|
|
201
|
+
document.querySelector("#email-field-label").insertAdjacentHTML("beforeend", m);
|
|
202
|
+
v = !0;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (!v)
|
|
206
|
+
if (l && "true" === l.value && c) {
|
|
207
|
+
var g = {
|
|
208
|
+
is_page_useful: !1,
|
|
209
|
+
is_general_feedback: !1,
|
|
210
|
+
ons_url: e,
|
|
211
|
+
name: f.value,
|
|
212
|
+
email_address: d.value,
|
|
213
|
+
},
|
|
214
|
+
b = JSON.stringify(g);
|
|
215
|
+
i(p, c.value, o, b, a, s);
|
|
216
|
+
} else {
|
|
217
|
+
var { request: y, serializedData: _ } = r(p, t, o, s, a, u),
|
|
218
|
+
w = document.querySelector("#feedback-form");
|
|
219
|
+
w && w.classList.add("js-hidden"), y.send(_);
|
|
220
|
+
var aa = document.getElementById("feedback-form-header");
|
|
221
|
+
aa && aa.classList.remove("js-hidden");
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
})();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export default function initSurvey() {
|
|
228
|
+
initSurveyA();
|
|
229
|
+
initSurveyB();
|
|
230
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { onMount, onDestroy, getContext } from "svelte";
|
|
3
|
+
import { slugify } from "../../js/utils.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Title of tab/panel
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
export let title = "Tab title";
|
|
10
|
+
/**
|
|
11
|
+
* Hide the title within the panel
|
|
12
|
+
* @type {boolean}
|
|
13
|
+
*/
|
|
14
|
+
export let hideTitle = false;
|
|
15
|
+
/**
|
|
16
|
+
* ID/slug for tab (auto-generated from title if not set)
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
export let id = slugify(title);
|
|
20
|
+
|
|
21
|
+
const sections = getContext("sections");
|
|
22
|
+
const selected = getContext("selected");
|
|
23
|
+
|
|
24
|
+
let el;
|
|
25
|
+
|
|
26
|
+
onMount(() => {
|
|
27
|
+
if (sections) {
|
|
28
|
+
if (!$sections[0] && ($selected || $selected === null)) $selected = id;
|
|
29
|
+
$sections = [...$sections, { title, id, el }];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
onDestroy(() => {
|
|
34
|
+
if (sections) {
|
|
35
|
+
$sections = $sections.filter((s) => s.id !== id);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<section
|
|
41
|
+
id="{id}"
|
|
42
|
+
class="ons-tabs__panel"
|
|
43
|
+
bind:this="{el}"
|
|
44
|
+
class:ons-tabs__panel--hidden="{$selected !== id}"
|
|
45
|
+
>
|
|
46
|
+
<h2 id="{id}-content-title" class="ons-u-vh" class:ons-u-vh="{hideTitle}">{title}</h2>
|
|
47
|
+
<slot />
|
|
48
|
+
</section>
|