hr-design-system-handlebars 1.108.0 → 1.109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.js +1 -0
- package/CHANGELOG.md +24 -0
- package/dist/assets/index.css +11 -6
- package/dist/assets/js/alpine.js +2 -1
- package/dist/assets/js/components/forms/contactForm.alpine.js +181 -18
- package/dist/assets/js/components/forms/inputHandler.alpine.js +52 -5
- package/dist/views/components/content_nav/content_nav_container.hbs +1 -1
- package/dist/views/components/forms/controls.hbs +3 -2
- package/dist/views/components/forms/input.hbs +4 -0
- package/dist/views/components/forms/webform.hbs +37 -29
- package/dist/views/components/horizontal_scroll_container/horizontal_scroll_container.hbs +2 -2
- package/dist/views/components/horizontal_scroll_container/horizontal_scroll_container_example.hbs +2 -2
- package/dist/views/components/site_header/brand_navigation/brand_navigation.hbs +1 -1
- package/dist/views/components/site_header/section_navigation/section_navigation.hbs +1 -1
- package/dist/views_static/components/content_nav/content_nav_container.hbs +1 -1
- package/dist/views_static/components/forms/controls.hbs +3 -2
- package/dist/views_static/components/forms/input.hbs +4 -0
- package/dist/views_static/components/forms/webform.hbs +37 -29
- package/dist/views_static/components/horizontal_scroll_container/horizontal_scroll_container.hbs +2 -2
- package/dist/views_static/components/horizontal_scroll_container/horizontal_scroll_container_example.hbs +2 -2
- package/dist/views_static/components/site_header/brand_navigation/brand_navigation.hbs +1 -1
- package/dist/views_static/components/site_header/section_navigation/section_navigation.hbs +1 -1
- package/package.json +2 -1
- package/src/assets/fixtures/content/copytext/copytext_webform.json +5 -58
- package/src/assets/js/alpine.js +2 -1
- package/src/stories/views/components/content/copytext/copytext-form.stories.js +41 -0
- package/src/stories/views/components/content/copytext/copytext.stories.js +0 -7
- package/src/stories/views/components/content/copytext/fixtures/copytext_webform.json +1 -1
- package/src/stories/views/components/content_nav/content_nav_container.hbs +1 -1
- package/src/stories/views/components/forms/contactForm.alpine.js +181 -18
- package/src/stories/views/components/forms/controls.hbs +3 -2
- package/src/stories/views/components/forms/input.hbs +4 -0
- package/src/stories/views/components/forms/inputHandler.alpine.js +52 -5
- package/src/stories/views/components/forms/webform.hbs +37 -29
- package/src/stories/views/components/horizontal_scroll_container/horizontal_scroll_container.hbs +2 -2
- package/src/stories/views/components/horizontal_scroll_container/horizontal_scroll_container_example.hbs +2 -2
- package/src/stories/views/components/site_header/brand_navigation/brand_navigation.hbs +1 -1
- package/src/stories/views/components/site_header/section_navigation/section_navigation.hbs +1 -1
- package/tailwind.config.js +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default function inputHandler(element, formId, errorMandatory, type, errorEmail, prefilledText = '') {
|
|
2
2
|
return {
|
|
3
3
|
[element]: prefilledText,
|
|
4
|
+
name: document.getElementById(element).getAttribute("name"),
|
|
4
5
|
valid: false,
|
|
5
6
|
wasFocused: false,
|
|
6
7
|
isFocused: false,
|
|
@@ -13,19 +14,23 @@ export default function inputHandler(element, formId, errorMandatory, type, erro
|
|
|
13
14
|
return this.valueMissing ? errorMandatory : errorEmail
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
16
|
-
|
|
17
|
+
if(this.hasServerError()){
|
|
18
|
+
return this.getServerError()
|
|
19
|
+
} else {
|
|
20
|
+
return errorMandatory
|
|
21
|
+
}
|
|
17
22
|
}
|
|
18
23
|
},
|
|
19
24
|
hideDescription() {
|
|
20
25
|
switch (type) {
|
|
21
26
|
case "email":
|
|
22
|
-
return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (this.typeMismatch && this.wasFocused && !this.isFocused) || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]));
|
|
27
|
+
return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (this.typeMismatch && this.wasFocused && !this.isFocused) || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]) || (this.hasServerError() && !this.isFocused ));
|
|
23
28
|
case "checkbox":
|
|
24
|
-
return Boolean(!this.valid && this.wasFocused && !this.isFocused && !this.isChecked || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]));
|
|
29
|
+
return Boolean(!this.valid && this.wasFocused && !this.isFocused && !this.isChecked || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]) || (this.hasServerError() && !this.isFocused ));
|
|
25
30
|
case "select":
|
|
26
|
-
return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]))
|
|
31
|
+
return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]) || (this.hasServerError() && !this.isFocused ))
|
|
27
32
|
default:
|
|
28
|
-
return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]));
|
|
33
|
+
return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (!this.valid && !this.isFocused && this.$store.forms.submissionAttempted[formId]) || (this.hasServerError() && !this.isFocused ));
|
|
29
34
|
}
|
|
30
35
|
},
|
|
31
36
|
hideError() {
|
|
@@ -36,6 +41,48 @@ export default function inputHandler(element, formId, errorMandatory, type, erro
|
|
|
36
41
|
this.typeMismatch = field.validity.typeMismatch;
|
|
37
42
|
this.valueMissing = field.validity.valueMissing;
|
|
38
43
|
this.valid = field.checkValidity()
|
|
44
|
+
},
|
|
45
|
+
hasServerError() {
|
|
46
|
+
return Boolean(this.$store.forms.serverErrorFields[formId][this.name])
|
|
47
|
+
},
|
|
48
|
+
getServerError() {
|
|
49
|
+
let serverError = "Server Error: "
|
|
50
|
+
switch (this.$store.forms.serverErrorFields[formId][this.name]) {
|
|
51
|
+
|
|
52
|
+
case 'form_error_required':
|
|
53
|
+
serverError += "Pflichtfeld"
|
|
54
|
+
break
|
|
55
|
+
case 'form_error_max':
|
|
56
|
+
serverError += "Zu viele Zeichen"
|
|
57
|
+
break
|
|
58
|
+
case 'form_error_validurl':
|
|
59
|
+
serverError += "Ungültige URL"
|
|
60
|
+
break
|
|
61
|
+
case 'form_error_empty':
|
|
62
|
+
serverError += "Darf nicht ausgefüllt werden"
|
|
63
|
+
break
|
|
64
|
+
case 'form_error_constants_or_null':
|
|
65
|
+
serverError += "Ungültiger Wert"
|
|
66
|
+
break
|
|
67
|
+
case 'form_error_constants':
|
|
68
|
+
serverError += "Ungültiger Wert"
|
|
69
|
+
break
|
|
70
|
+
case 'form_error_max_multivalue':
|
|
71
|
+
serverError += "Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten"
|
|
72
|
+
break
|
|
73
|
+
case 'vote_error_identity_already_used':
|
|
74
|
+
serverError += "Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich."
|
|
75
|
+
break
|
|
76
|
+
case 'vote_error_token_request_count_exceeded':
|
|
77
|
+
serverError += "Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt."
|
|
78
|
+
break
|
|
79
|
+
case 'form_error_email':
|
|
80
|
+
serverError += "Ungültige E-Mail-Adresse"
|
|
81
|
+
break
|
|
82
|
+
default:
|
|
83
|
+
return false
|
|
84
|
+
}
|
|
85
|
+
return serverError
|
|
39
86
|
}
|
|
40
87
|
};
|
|
41
88
|
}
|
|
@@ -5,38 +5,46 @@
|
|
|
5
5
|
<h3 class="mb-6 text-2xl font-headingSerif sm:mb-12">
|
|
6
6
|
{{this.title}}
|
|
7
7
|
</h3>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
<div id="formWrapper">
|
|
9
|
+
<form
|
|
10
|
+
x-ref="form{{nextRandom}}"
|
|
11
|
+
ax-load
|
|
12
|
+
x-data="contactForm('form{{getRandom}}','{{this.jsonURL}}','{{this.errorMessages}}','{{this.isMultipart}}','{{this.trackingInformations}}')"
|
|
13
|
+
x-init="formInit()"
|
|
14
|
+
x-ignore
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
@submit.prevent="submitData"
|
|
17
|
+
id="form{{getRandom}}"
|
|
18
|
+
class="relative flex flex-col justify-center overflow-hidden group"
|
|
19
|
+
action="{{this.url}}"
|
|
20
|
+
method="post"
|
|
21
|
+
enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}"
|
|
22
|
+
accept-charset="utf-8"
|
|
23
|
+
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
<div class="">
|
|
27
|
+
<div class="px-4 py-2 font-bold text-white bg-red-500 rounded-t">
|
|
28
|
+
DEBUG
|
|
29
|
+
</div>
|
|
30
|
+
<div class="px-4 py-3 text-red-700 bg-red-100 border border-t-0 border-red-400 rounded-b">
|
|
31
|
+
<div>submissionAttempted[form{{getRandom}}]:<span x-text="getSubmissionAttempted()" class="font-bold" :class="getSubmissionAttempted() ? 'text-green-800' : 'text-red-700'"></span></div>
|
|
32
|
+
<div>isPosting:<span x-text="isPosting" class="font-bold" :class="isPosting ? 'text-green-800' : 'text-red-700'"></span></div>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
29
35
|
</div>
|
|
30
|
-
|
|
31
|
-
<div>submissionAttempted[form{{getRandom}}]:<span x-text="getSubmissionAttempted()" class="font-bold" :class="getSubmissionAttempted() ? 'text-green-800' : 'text-red-700'"></span></div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
{{> components/forms/fields _formId=(joinStrings 'form' (getRandom)) }}
|
|
36
|
+
{{> components/forms/fields _formId=(joinStrings 'form' (getRandom)) }}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
{{> components/forms/controls }}
|
|
39
|
+
<template id="successMessage">
|
|
40
|
+
<h2>SUPER DAS HAT ALLES FUNKTIONIERT</h2>
|
|
41
|
+
</template>
|
|
42
|
+
<template id="errorMessage">
|
|
43
|
+
<h2>DAS HAT LEIDER NICHT FUNKTIONIERT</h2>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
</form>
|
|
47
|
+
</div>
|
|
40
48
|
{{/components/forms/backgroundBox }}
|
|
41
49
|
{{~else~}}
|
|
42
50
|
{{> content/webform/components/webform _addClass="print:hidden copytext__clearBox marginTrailer--m"}}
|
package/src/stories/views/components/horizontal_scroll_container/horizontal_scroll_container.hbs
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
<button style="background-image: linear-gradient(90deg, {{_bgcolor}} 50%, transparent);" class="absolute left-0 z-10 flex items-center justify-start w-10 h-full text-{{_iconcolor}} disabled:hidden" @click="prev($refs.scrollContainer_{{getRandom}})" :disabled="!arrowLeftDisplay" tabindex="-1" aria-hidden="true" >
|
|
10
10
|
{{> components/base/image/icon _icon="arrow-left" _iconmap="icons" _addClass="w-3.5 h-3.5 fill-current" }}
|
|
11
11
|
</button>
|
|
12
|
-
<button style="background-image: linear-gradient(270deg, {{_bgcolor}} 50%, transparent);" class="bg-gradient-to-l
|
|
12
|
+
<button style="background-image: linear-gradient(270deg, {{_bgcolor}} 50%, transparent);" class="bg-gradient-to-l absolute right-0 z-10 flex items-center justify-end w-10 h-full text-{{_iconcolor}} disabled:hidden group{{_css}}" @click="next($refs.scrollContainer_{{getRandom}})" :disabled="!arrowRightDisplay" tabindex="-1" aria-hidden="true">
|
|
13
13
|
{{> components/base/image/icon _icon="arrow-right" _iconmap="icons" _addClass="w-3.5 h-3.5 fill-current" }}
|
|
14
14
|
</button>
|
|
15
15
|
</div>
|
|
16
16
|
</template>
|
|
17
|
-
<div x-ref="scrollContainer_{{getRandom}}" @scroll="updateIndex($event.target)" class="w-full overflow-hidden overflow-x-scroll transition-all duration-300 ease-in-out cursor-default hide-scroll-bar
|
|
17
|
+
<div x-ref="scrollContainer_{{getRandom}}" @scroll="updateIndex($event.target)" class="w-full overflow-hidden overflow-x-scroll transition-all duration-300 ease-in-out cursor-default hide-scroll-bar">
|
|
18
18
|
{{> @partial-block }}
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="w-full h-auto mb-10">
|
|
2
|
-
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="xs" _onDarkBackground="true" _bgcolor="var(--color-navigation-bg)" _iconcolor="navigation-icons"}}
|
|
2
|
+
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="xs" _onDarkBackground="true" _css=" from-[--color-navigation-bg]" _bgcolor="var(--color-navigation-bg)" _iconcolor="navigation-icons"}}
|
|
3
3
|
|
|
4
4
|
<div class="flex h-auto p-4 pr-10 text-lg leading-6 text-white bg-primary">
|
|
5
5
|
<p class="whitespace-nowrap ">Guten Tag. Dieses Div kann mittels click auf die Pfeiltasten verschoben werden kann. Die Pfeile werden dynamisch angezeigt/ausgeblendet sobald der Rand des Inhalts erreicht ist. </p>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{{/components/horizontal_scroll_container/horizontal_scroll_container}}
|
|
9
9
|
</div>
|
|
10
10
|
<div class="w-full h-auto mb-10">
|
|
11
|
-
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="xs" _onDarkBackground="true" _bgcolor="var(--color-navigation-bg)" _iconcolor="navigation-icons"}}
|
|
11
|
+
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="xs" _onDarkBackground="true" _css=" from-[--color-navigation-bg]" _bgcolor="var(--color-navigation-bg)" _iconcolor="navigation-icons"}}
|
|
12
12
|
|
|
13
13
|
<div class="flex h-auto p-4 pr-10 text-lg leading-6 text-white bg-primary">
|
|
14
14
|
<p class="whitespace-nowrap ">Guten Tag. Dieses Div kann mittels click auf die Pfeiltasten verschoben werden kann.</p>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="grid-cols-12 px-5 lg:px-10 col-full sm:col-main">
|
|
2
|
-
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="xs" _bgcolor="var(--color-brandnavigation-bg)" _iconcolor="primary" }}
|
|
2
|
+
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="xs" _css=" from-[--color-brandnavigation-bg]" _bgcolor="var(--color-brandnavigation-bg)" _iconcolor="primary" }}
|
|
3
3
|
<nav class="flex w-full text-xs list-none text-grey-scorpion">
|
|
4
4
|
<span id="brandNavHeading" class="hidden">Navigation der Marken des Hessischen Rundfunks</span>
|
|
5
5
|
{{#with this.brandNavigationItems}}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class="w-full px-0 mt-10 sb-section-navigation md:mt-0 lg:grid-cols-12 lg:px-10 lg:col-main "
|
|
4
4
|
x-effect="$el.setAttribute('aria-expanded', $store.burgeropen || $screen('lg')); $el.setAttribute('aria-hidden', ! ($store.burgeropen || $screen('lg')))"
|
|
5
5
|
>
|
|
6
|
-
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="lg" _bgcolor="var(--color-navigation-bg)" _iconcolor="navigation-icons"}}
|
|
6
|
+
{{#> components/horizontal_scroll_container/horizontal_scroll_container _viewport="lg" _css=" from-[--color-navigation-bg]" _bgcolor="var(--color-navigation-bg)" _iconcolor="navigation-icons"}}
|
|
7
7
|
<div class="flex w-full">
|
|
8
8
|
<span id="sectionNavHeadline" class="hidden">Bereichsnavigation</span>
|
|
9
9
|
|