hr-design-system-handlebars 1.113.0 → 1.113.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 (38) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/assets/index.css +50 -8
  3. package/dist/assets/js/alpine.js +2 -1
  4. package/dist/assets/js/components/forms/js/contactForm.alpine.js +34 -99
  5. package/dist/assets/js/components/forms/js/inputHandler.alpine.js +2 -36
  6. package/dist/views/components/forms/components/controls.hbs +1 -1
  7. package/dist/views/components/forms/components/input.hbs +1 -1
  8. package/dist/views/components/forms/components/message.hbs +4 -1
  9. package/dist/views/components/forms/components/textarea.hbs +1 -2
  10. package/dist/views/components/forms/webform.hbs +28 -11
  11. package/dist/views/components/voting/voting_error.hbs +10 -0
  12. package/dist/views/components/voting/voting_result.hbs +21 -1
  13. package/dist/views_static/components/forms/components/controls.hbs +1 -1
  14. package/dist/views_static/components/forms/components/input.hbs +1 -1
  15. package/dist/views_static/components/forms/components/message.hbs +4 -1
  16. package/dist/views_static/components/forms/components/textarea.hbs +1 -2
  17. package/dist/views_static/components/forms/webform.hbs +28 -11
  18. package/dist/views_static/components/voting/voting_error.hbs +10 -0
  19. package/dist/views_static/components/voting/voting_result.hbs +21 -1
  20. package/package.json +1 -1
  21. package/src/assets/css/custom-utilities.css +1 -1
  22. package/src/assets/fixtures/content/copytext/copytext_webform.json +6 -1
  23. package/src/assets/fixtures/content/copytext/copytext_webform_simple.json +32 -0
  24. package/src/assets/fixtures/forms/error_messages.inc.json +3 -0
  25. package/src/assets/js/alpine.js +2 -1
  26. package/src/stories/views/components/content/copytext/copytext-form.stories.js +52 -1
  27. package/src/stories/views/components/content/copytext/fixtures/copytext_webform.json +1 -1
  28. package/src/stories/views/components/content/copytext/fixtures/copytext_webform_simple.json +1 -0
  29. package/src/stories/views/components/forms/components/controls.hbs +1 -1
  30. package/src/stories/views/components/forms/components/input.hbs +1 -1
  31. package/src/stories/views/components/forms/components/message.hbs +4 -1
  32. package/src/stories/views/components/forms/components/textarea.hbs +1 -2
  33. package/src/stories/views/components/forms/js/contactForm.alpine.js +34 -99
  34. package/src/stories/views/components/forms/js/inputHandler.alpine.js +2 -36
  35. package/src/stories/views/components/forms/webform.hbs +28 -11
  36. package/src/stories/views/components/voting/voting_error.hbs +10 -0
  37. package/src/stories/views/components/voting/voting_error.stories.js +30 -0
  38. package/src/stories/views/components/voting/voting_result.hbs +21 -1
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <div class="w-full h-4 bg-white dark:bg-black dark:text-text-dark"></div>
8
8
  <textarea
9
- class="relative w-full pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
9
+ class="relative w-full py-px pl-4 placeholder-transparent bg-white placeholder:select-none dark:border-form-highlight-dark min-h-12 peer focus:border-b-2 focus:py-0 text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
10
10
  x-model="textarea{{getRandom}}"
11
11
  id="textarea{{getRandom}}"
12
12
  {{#if _required}}
@@ -35,7 +35,6 @@
35
35
  maxlength="{{_maxLength}}"
36
36
  {{/if~}}
37
37
  {{#if _required}}required{{/if}}
38
- class="relative w-full px-4 pb-px text-black placeholder-transparent bg-white border-form-highlight dark:border-form-highlight-dark min-h-12 peer border-y focus:border-b-2 focus:pb-0 border-t-transparent focus:outline-none"
39
38
  {{#if _required}}
40
39
  :class="{'border-form-highlight dark:border-form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
41
40
  {{/if}}
@@ -1,7 +1,5 @@
1
1
  {{~#if _newWebForm ~}}
2
- {{#>components/forms/components/backgroundBox }}
3
-
4
-
2
+ {{#>components/forms/components/backgroundBox }}
5
3
  <h3 class="mb-6 text-2xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
6
4
  {{this.title}}
7
5
  </h3>
@@ -21,20 +19,39 @@
21
19
  enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}"
22
20
  accept-charset="utf-8"
23
21
 
22
+ >
23
+ <div x-show="!wasPosted"
24
+ x-transition:enter="transition ease-out duration-300 delay-300"
25
+ x-transition:enter-start="opacity-0 transform scale-90"
26
+ x-transition:enter-end="opacity-100 transform scale-100"
27
+ x-transition:leave="transition ease-in duration-75 delay-0"
28
+ x-transition:leave-start="opacity-100 transform scale-100"
29
+ x-transition:leave-end="opacity-0 transform scale-90"
24
30
  >
25
- {{> components/forms/components/fields _formId=(joinStrings 'form' (getRandom)) }}
26
-
27
- {{> components/forms/components/controls }}
31
+ {{> components/forms/components/fields _formId=(joinStrings 'form' (getRandom)) }}
28
32
 
29
- <template id="successMessage">
33
+ {{> components/forms/components/controls }}
34
+ </div>
35
+ <div id="successMessage" x-show="wasPostedWithSuccess"
36
+ x-transition:enter="transition ease-out duration-300 delay-75"
37
+ x-transition:enter-start="opacity-0 transform scale-90"
38
+ x-transition:enter-end="opacity-100 transform scale-100"
39
+ x-cloak
40
+ >
30
41
  {{> components/forms/components/message _success=true }}
31
- </template>
42
+ </div>
32
43
 
33
- <template id="errorMessage">
44
+ <div id="errorMessage" x-show="wasPostedWithError"
45
+ x-transition:enter="transition ease-out duration-300 delay-75"
46
+ x-transition:enter-start="opacity-0 transform scale-90"
47
+ x-transition:enter-end="opacity-100 transform scale-100"
48
+ x-cloak>
34
49
  {{> components/forms/components/message _success=false }}
35
- </template>
36
-
50
+ </div>
51
+
37
52
  </form>
53
+
54
+
38
55
  </div>
39
56
  {{/components/forms/components/backgroundBox }}
40
57
  {{~else~}}
@@ -0,0 +1,10 @@
1
+ {{> components/voting/voting_result
2
+ _title=this.title
3
+ _topline=this.topline
4
+ _resultBoxMessageTitle=(loca "votingform_title_error")
5
+ _resultBoxMessageText=(loca "votingform_text_error")
6
+ _locaKeyText="votingform_text_error"
7
+ _isInline=_isInline
8
+ _hideVotingResult=true
9
+ _statusDone=false
10
+ }}
@@ -1,5 +1,25 @@
1
- {{> components/voting/voting_header _title=_title _topline=_topline}}
1
+ {{#unless _isResultOnRedirectPage}}
2
+ {{> components/voting/voting_header _title=_title _topline=_topline}}
3
+ {{/unless}}
4
+
5
+ {{#if _hideVotingResult}}
6
+ {{#if _isVotingOver}}
7
+ <p class="c-teaser__text text__copytext">{{{_resultBoxMessageText}}}</p>
8
+ {{else}}
9
+ {{~> components/base/image/icon _icon=(if _statusDone "status-done" "status-error") _iconmap="icons" _addClass=(if _statusDone "" "float-left w-6 h-6 text-red-thunderbird-hex fill-current mt-6 sm:mt-12")}}
10
+ <p class="mt-6 ml-8 text-base font-bold sm:ml-9 text-red-thunderbird-hex sm:text-lg font-heading sm:mt-12">{{{_resultBoxMessageText}}}</p>
11
+ <div class="mt-6 sm:mt-12">
12
+ {{#> components/button/link_button _size="lg" _css="float-right"}}
13
+ {{> components/button/components/button_label _label=(loca "votingform_form_back")}}
14
+ {{/components/button/link_button}}
15
+ </div>
16
+ {{/if}}
17
+ {{else}}
18
+
19
+ {{/if}}
2
20
 
3
21
  {{#if _isVotingOver}}
4
22
  <p class="mt-6 text-base font-bold sm:text-xl font-heading sm:mt-12 dark:text-text-dark">{{loca "votingform_voting_finished"}}</p>
5
23
  {{/if}}
24
+
25
+
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "repository": "https://github.com/szuelch/hr-design-system-handlebars",
9
- "version": "1.113.0",
9
+ "version": "1.113.2",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "storybook dev -p 6006 public",
@@ -462,7 +462,7 @@
462
462
  }
463
463
 
464
464
  select:has(option:checked[value='']) {
465
- @apply text-transparent;
465
+ @apply text-transparent select-none;
466
466
  }
467
467
 
468
468
  .form-checkbox:checked::after {
@@ -10,7 +10,12 @@
10
10
  "hasNewWebForm": true,
11
11
  "title": "Kontaktformular",
12
12
  "jsonUrl": "https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de",
13
- "errorMessages": "errorMessages",
13
+ "errorMessages":
14
+ {
15
+ "@->jsoninclude": "forms/error_messages.inc.json",
16
+ "@->contentpath": "error-messages"
17
+
18
+ },
14
19
  "isMultipart": "isMultipart",
15
20
  "trackingInformations": "trackingInformations",
16
21
  "fields":[
@@ -0,0 +1,32 @@
1
+ {
2
+ "copytextParagraph": [
3
+ {
4
+ "isHeadline": true,
5
+ "text": "Copytext mit Formular"
6
+ },
7
+ {
8
+ "paragraphBoxItem": {
9
+ "isWebForm": true,
10
+ "hasNewWebForm": true,
11
+ "title": "Kontaktformular",
12
+ "jsonUrl": "https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de",
13
+ "errorMessages":
14
+ {
15
+ "@->jsoninclude": "forms/error_messages.inc.json",
16
+ "@->contentpath": "error-messages"
17
+
18
+ },
19
+ "isMultipart": "isMultipart",
20
+ "trackingInformations": "trackingInformations",
21
+ "fields":[
22
+ {
23
+ "@->jsoninclude": "forms/form_fields.inc.json",
24
+ "@->contentpath": "input-text-vorname"
25
+ }
26
+ ]
27
+
28
+ }
29
+ }
30
+
31
+ ]
32
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "error-messages": "&quot;form_error_required&quot;:&quot;Server: Pflichtfeld&quot;,&quot;form_error_max&quot;:&quot;Server: Zu viele Zeichen&quot;,&quot;form_error_validurl&quot;:&quot;Server: Ungültige URL&quot;,&quot;form_error_empty&quot;:&quot;Server: Darf nicht ausgefüllt werden&quot;,&quot;form_error_constants_or_null&quot;:&quot;Server: Ungültiger Wert&quot;,&quot;form_error_constants&quot;:&quot;Server: Ungültiger Wert&quot;,&quot;form_error_max_multivalue&quot;:&quot;Server: Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten&quot;,&quot;vote_error_identity_already_used&quot;:&quot;Server: Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.&quot;,&quot;vote_error_token_request_count_exceeded&quot;:&quot;Server: Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.&quot;,&quot;form_error_email&quot;:&quot;Server: Ungültige E-Mail-Adresse&quot;"
3
+ }
@@ -54,7 +54,8 @@ Alpine.store('sharingBottomPos', {
54
54
  })
55
55
  Alpine.store('forms', {
56
56
  submissionAttempted: [],
57
- serverErrorFields: [{}]
57
+ serverErrorFields: [{}],
58
+ errorMessages: [{}]
58
59
  })
59
60
  // Initialization of data handlers
60
61
  Alpine.data('mainNavigationHandler', mainNavigationHandler)
@@ -1,6 +1,7 @@
1
1
  import copytext from './copytext.hbs'
2
2
 
3
3
  import copytext_webform_json from './fixtures/copytext_webform.json'
4
+ import copytext_webform_simple_json from './fixtures/copytext_webform_simple.json'
4
5
 
5
6
  const Template = ({ ...args }) => {
6
7
  return copytext({ ...args })
@@ -40,4 +41,54 @@ export const WithWebform = {
40
41
  name: 'Formular',
41
42
  args: copytext_webform_json,
42
43
  }
43
-
44
+ export const WithWebformStatusOk = {
45
+ render: Template.bind({}),
46
+ name: 'Formular Status OK',
47
+ args: copytext_webform_simple_json,
48
+ parameters: {
49
+ mockData: [
50
+ {
51
+ url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
52
+ method: 'POST',
53
+ status: 200,
54
+ response: {
55
+ "status":"OK"
56
+ },
57
+ },
58
+ ]
59
+ }
60
+ }
61
+ export const WithWebformStatusNone = {
62
+ render: Template.bind({}),
63
+ name: 'Formular Status None',
64
+ args: copytext_webform_simple_json,
65
+ parameters: {
66
+ mockData: [
67
+ {
68
+ url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
69
+ method: 'POST',
70
+ status: 200,
71
+ response: {
72
+ "status":""
73
+ },
74
+ },
75
+ ]
76
+ }
77
+ }
78
+ export const WithWebformStatusValidationError = {
79
+ render: Template.bind({}),
80
+ name: 'Formular Status Validation Error',
81
+ args: copytext_webform_simple_json,
82
+ parameters: {
83
+ mockData: [
84
+ {
85
+ url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
86
+ method: 'POST',
87
+ status: 200,
88
+ response: {
89
+ "status":"VALIDATION_ERROR", "errors":{"vorname":"form_error_required"}
90
+ },
91
+ },
92
+ ]
93
+ }
94
+ }
@@ -1 +1 @@
1
- {"copytextParagraph":[{"isHeadline":true,"text":"Copytext mit Formular"},{"paragraphBoxItem":{"isWebForm":true,"hasNewWebForm":true,"title":"Kontaktformular","jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":"errorMessages","isMultipart":"isMultipart","trackingInformations":"trackingInformations","fields":[{"type":{"isText":true,"asString":"text"},"name":"vorname","label":"Vorname","description":"Das ist der Beschreibungstext (*Pflichtfeld)","defaultValue":"","isHidden":false,"isRequired":true,"maxLength":"140"},{"type":{"isText":true,"asString":"text"},"name":"nachname","label":"Nachname","description":"","defaultValue":"","isHidden":false,"isRequired":true,"maxLength":"140"},{"type":{"isUpload":true,"asString":"upload"},"name":"Datei Hochladen","label":"Wählen Sie eine Datei zum Hochladen","description":"Maximale Dateigröße: 35 MB.","isRequired":true},{"type":{"isSelect":true,"asString":"select"},"name":"Select Name","label":"Wen möchten Sie erreichen?","description":"Das ist der Beschreibungstext von Select","defaultValue":"","isHidden":false,"isRequired":true,"options":[{"id":"option1","value":"option1","selected":false,"label":"Option 1"},{"id":"option2","value":"option2","selected":false,"label":"Option 2"},{"id":"option3","value":"option3","selected":false,"label":"Option 3"},{"id":"option4","value":"option4","selected":false,"label":"Option 4"}]},{"isGrouped":true,"type":{"isChoice":true,"asString":"checkbox"},"name":"interessen","label":"Wählen Sie Ihre Interessen","isMeta":false,"description":"Bitte kreuzen Sie alle Interessen an, die auf Sie zutreffen. Ihre Auswahl hilft uns, Ihnen relevante Inhalte anzubieten.","isRequired":false,"options":[{"value":"sport","label":"sport","title":"sport","isSelected":false},{"value":"musik","label":"musik","title":"musik","isSelected":false},{"value":"lesen","label":"lesen","title":"lesen","isSelected":false},{"value":"reisen","label":"reisen","title":"reisen","isSelected":false},{"value":"kochen","label":"kochen","title":"kochen","isSelected":false},{"value":"filme","label":"filme","title":"filme","isSelected":false},{"value":"tanzen","label":"tanzen","title":"tanzen","isSelected":false},{"value":"fotografie","label":"fotografie","title":"fotografie","isSelected":false}]},{"isGrouped":true,"type":{"isChoice":true,"isRadioChoice":true,"asString":"radio"},"name":"lieblingsfarbe","label":"Wählen Sie Ihre Lieblingsfarbe","isMeta":false,"description":"Bitte wählen Sie eine der folgenden Farben aus.","isRequired":true,"options":[{"value":"rot","label":"rot","title":"rot","isSelected":false},{"value":"blau","label":"blau","title":"blau","isSelected":false},{"value":"grün","label":"grün","title":"grün","isSelected":false}]},{"isGrouped":true,"type":{"isChoice":true,"isRadioChoice":true,"asString":"radio"},"name":"lieblingsfarbe","label":"Wählen Sie Ihre Lieblingsfarbe","isMeta":false,"description":"Bitte wählen Sie eine der folgenden Farben aus.","isRequired":false,"options":[{"value":"rot","label":"rot","title":"rot","isSelected":false},{"value":"blau","label":"blau","title":"blau","isSelected":false},{"value":"grün","label":"grün","title":"grün","isSelected":false}]},{"isGrouped":false,"type":{"isChoice":true,"asString":"checkbox"},"name":"checkbox","label":"Ich bin damit einverstanden.","isMeta":false,"description":"Das ist der Beschreibungstext von Checkbox","isRequired":false},{"isGrouped":false,"type":{"isChoice":true,"asString":"checkbox"},"name":"checkbox","label":"Ich bin damit einverstanden, dass der hr die von mir im vorstehenden Formular angegebenen personenbezogenen Daten für den Zweck der Kontaktaufnahme mit Upload verarbeitet. Eine Weitergabe an Dritte findet nicht statt, es sei denn, es wird ausdrücklich darauf hingewiesen. Unsere Datenschutzerklärung mit sämtlichen Informationen gemäß Art 13 DSGVO zur Datenverarbeitung durch den hr und zu Ihren Rechten können Sie unter Datenschutzerklärung einsehen. Den Datenschutzbeauftragten des hr erreichen Sie unter datenschutz@hr.de.","isMeta":false,"description":"Das ist der Beschreibungstext von Checkbox","isRequired":true}]}}]}
1
+ {"copytextParagraph":[{"isHeadline":true,"text":"Copytext mit Formular"},{"paragraphBoxItem":{"isWebForm":true,"hasNewWebForm":true,"title":"Kontaktformular","jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":"&quot;form_error_required&quot;:&quot;Server: Pflichtfeld&quot;,&quot;form_error_max&quot;:&quot;Server: Zu viele Zeichen&quot;,&quot;form_error_validurl&quot;:&quot;Server: Ungültige URL&quot;,&quot;form_error_empty&quot;:&quot;Server: Darf nicht ausgefüllt werden&quot;,&quot;form_error_constants_or_null&quot;:&quot;Server: Ungültiger Wert&quot;,&quot;form_error_constants&quot;:&quot;Server: Ungültiger Wert&quot;,&quot;form_error_max_multivalue&quot;:&quot;Server: Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten&quot;,&quot;vote_error_identity_already_used&quot;:&quot;Server: Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.&quot;,&quot;vote_error_token_request_count_exceeded&quot;:&quot;Server: Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.&quot;,&quot;form_error_email&quot;:&quot;Server: Ungültige E-Mail-Adresse&quot;","isMultipart":"isMultipart","trackingInformations":"trackingInformations","fields":[{"type":{"isText":true,"asString":"text"},"name":"vorname","label":"Vorname","description":"Das ist der Beschreibungstext (*Pflichtfeld)","defaultValue":"","isHidden":false,"isRequired":true,"maxLength":"140"},{"type":{"isText":true,"asString":"text"},"name":"nachname","label":"Nachname","description":"","defaultValue":"","isHidden":false,"isRequired":true,"maxLength":"140"},{"type":{"isUpload":true,"asString":"upload"},"name":"Datei Hochladen","label":"Wählen Sie eine Datei zum Hochladen","description":"Maximale Dateigröße: 35 MB.","isRequired":true},{"type":{"isSelect":true,"asString":"select"},"name":"Select Name","label":"Wen möchten Sie erreichen?","description":"Das ist der Beschreibungstext von Select","defaultValue":"","isHidden":false,"isRequired":true,"options":[{"id":"option1","value":"option1","selected":false,"label":"Option 1"},{"id":"option2","value":"option2","selected":false,"label":"Option 2"},{"id":"option3","value":"option3","selected":false,"label":"Option 3"},{"id":"option4","value":"option4","selected":false,"label":"Option 4"}]},{"isGrouped":true,"type":{"isChoice":true,"asString":"checkbox"},"name":"interessen","label":"Wählen Sie Ihre Interessen","isMeta":false,"description":"Bitte kreuzen Sie alle Interessen an, die auf Sie zutreffen. Ihre Auswahl hilft uns, Ihnen relevante Inhalte anzubieten.","isRequired":false,"options":[{"value":"sport","label":"sport","title":"sport","isSelected":false},{"value":"musik","label":"musik","title":"musik","isSelected":false},{"value":"lesen","label":"lesen","title":"lesen","isSelected":false},{"value":"reisen","label":"reisen","title":"reisen","isSelected":false},{"value":"kochen","label":"kochen","title":"kochen","isSelected":false},{"value":"filme","label":"filme","title":"filme","isSelected":false},{"value":"tanzen","label":"tanzen","title":"tanzen","isSelected":false},{"value":"fotografie","label":"fotografie","title":"fotografie","isSelected":false}]},{"isGrouped":true,"type":{"isChoice":true,"isRadioChoice":true,"asString":"radio"},"name":"lieblingsfarbe","label":"Wählen Sie Ihre Lieblingsfarbe","isMeta":false,"description":"Bitte wählen Sie eine der folgenden Farben aus.","isRequired":true,"options":[{"value":"rot","label":"rot","title":"rot","isSelected":false},{"value":"blau","label":"blau","title":"blau","isSelected":false},{"value":"grün","label":"grün","title":"grün","isSelected":false}]},{"isGrouped":true,"type":{"isChoice":true,"isRadioChoice":true,"asString":"radio"},"name":"lieblingsfarbe","label":"Wählen Sie Ihre Lieblingsfarbe","isMeta":false,"description":"Bitte wählen Sie eine der folgenden Farben aus.","isRequired":false,"options":[{"value":"rot","label":"rot","title":"rot","isSelected":false},{"value":"blau","label":"blau","title":"blau","isSelected":false},{"value":"grün","label":"grün","title":"grün","isSelected":false}]},{"isGrouped":false,"type":{"isChoice":true,"asString":"checkbox"},"name":"checkbox","label":"Ich bin damit einverstanden.","isMeta":false,"description":"Das ist der Beschreibungstext von Checkbox","isRequired":false},{"isGrouped":false,"type":{"isChoice":true,"asString":"checkbox"},"name":"checkbox","label":"Ich bin damit einverstanden, dass der hr die von mir im vorstehenden Formular angegebenen personenbezogenen Daten für den Zweck der Kontaktaufnahme mit Upload verarbeitet. Eine Weitergabe an Dritte findet nicht statt, es sei denn, es wird ausdrücklich darauf hingewiesen. Unsere Datenschutzerklärung mit sämtlichen Informationen gemäß Art 13 DSGVO zur Datenverarbeitung durch den hr und zu Ihren Rechten können Sie unter Datenschutzerklärung einsehen. Den Datenschutzbeauftragten des hr erreichen Sie unter datenschutz@hr.de.","isMeta":false,"description":"Das ist der Beschreibungstext von Checkbox","isRequired":true}]}}]}
@@ -0,0 +1 @@
1
+ {"copytextParagraph":[{"isHeadline":true,"text":"Copytext mit Formular"},{"paragraphBoxItem":{"isWebForm":true,"hasNewWebForm":true,"title":"Kontaktformular","jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":"&quot;form_error_required&quot;:&quot;Server: Pflichtfeld&quot;,&quot;form_error_max&quot;:&quot;Server: Zu viele Zeichen&quot;,&quot;form_error_validurl&quot;:&quot;Server: Ungültige URL&quot;,&quot;form_error_empty&quot;:&quot;Server: Darf nicht ausgefüllt werden&quot;,&quot;form_error_constants_or_null&quot;:&quot;Server: Ungültiger Wert&quot;,&quot;form_error_constants&quot;:&quot;Server: Ungültiger Wert&quot;,&quot;form_error_max_multivalue&quot;:&quot;Server: Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten&quot;,&quot;vote_error_identity_already_used&quot;:&quot;Server: Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.&quot;,&quot;vote_error_token_request_count_exceeded&quot;:&quot;Server: Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.&quot;,&quot;form_error_email&quot;:&quot;Server: Ungültige E-Mail-Adresse&quot;","isMultipart":"isMultipart","trackingInformations":"trackingInformations","fields":[{"type":{"isText":true,"asString":"text"},"name":"vorname","label":"Vorname","description":"Das ist der Beschreibungstext von Vorname","defaultValue":"","isHidden":false,"isRequired":false}]}}]}
@@ -4,7 +4,7 @@
4
4
  <label class="order-2 cursor-pointer {{> components/button/utilities/button_base_classes}} {{> components/button/utilities/button_variation_classes _variant='primary'}} {{> components/button/utilities/button_dimension_classes _size='lg'}}">
5
5
  <span class="hidden" :class="{'hidden': !isPosting}">{{> components/base/image/icon _icon="reload" _addClass="w-5 h-5 fill-white dark:fill-text-dark animate-spin"}}</span>
6
6
  <span class="" :class="{'hidden': isPosting}">{{> components/base/image/icon _icon="send-ds" _addClass="w-5 h-5 fill-white dark:fill-text-dark "}}</span>
7
- <input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="clickHandler($event)"/>
7
+ <input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="submitButtonHandler($event)"/>
8
8
  </label>
9
9
 
10
10
  {{#> components/button/button _variant="tertiary"_size="lg" _css="order-1 mr-4" _type="reset"}}
@@ -4,7 +4,7 @@
4
4
  x-init="validateField()"
5
5
  x-ignore
6
6
  >
7
- <input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
7
+ <input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white placeholder:select-none text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
8
8
  :class="{'border-form-highlight dark:form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
9
9
  x-model="input{{getRandom}}"
10
10
  id="input{{getRandom}}"
@@ -9,8 +9,11 @@
9
9
  {{/if}}
10
10
  </div>
11
11
  {{#unless _success}}
12
- {{#> components/button/button _variant="primary"_size="lg" _css="" _type="reset"}}
12
+ {{#> components/button/button _variant="primary"_size="lg" }}
13
13
  <span class="text-base ds-button-label ">Nochmal versuchen</span>
14
14
  {{/components/button/button}}
15
+ {{#*inline "htmlProperties"}}
16
+ @click="retryHandler"
17
+ {{/inline}}
15
18
  {{/unless}}
16
19
  </div>
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <div class="w-full h-4 bg-white dark:bg-black dark:text-text-dark"></div>
8
8
  <textarea
9
- class="relative w-full pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
9
+ class="relative w-full py-px pl-4 placeholder-transparent bg-white placeholder:select-none dark:border-form-highlight-dark min-h-12 peer focus:border-b-2 focus:py-0 text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
10
10
  x-model="textarea{{getRandom}}"
11
11
  id="textarea{{getRandom}}"
12
12
  {{#if _required}}
@@ -35,7 +35,6 @@
35
35
  maxlength="{{_maxLength}}"
36
36
  {{/if~}}
37
37
  {{#if _required}}required{{/if}}
38
- class="relative w-full px-4 pb-px text-black placeholder-transparent bg-white border-form-highlight dark:border-form-highlight-dark min-h-12 peer border-y focus:border-b-2 focus:pb-0 border-t-transparent focus:outline-none"
39
38
  {{#if _required}}
40
39
  :class="{'border-form-highlight dark:border-form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
41
40
  {{/if}}
@@ -1,7 +1,12 @@
1
+ import { uxAction } from 'base/tracking/pianoHelper.subfeature'
2
+
1
3
  export default function contactForm(formId, jsonUrl, errorMessages, multipart, trackingInformations, jsonp = false) {
2
4
  return {
3
5
  isPosting: false,
4
- isWebview:false,
6
+ wasPosted: false,
7
+ wasPostedWithSuccess: false,
8
+ wasPostedWithError: false,
9
+ isWebview: window.parent.document.documentElement.classList.contains('webview'),
5
10
  ajaxTimeout: 60 * 1000,
6
11
  form: this.$refs[formId],
7
12
  formWrapper: this.$refs[formId].closest("#formWrapper"),
@@ -13,47 +18,20 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
13
18
  },
14
19
  formInit(){
15
20
  this.checkForJsonURL()
16
- console.log("%cformId:", 'color: green' ,formId);
17
- console.log("%cform:", 'color: green' ,this.form);
18
- console.log("%cformWrapper:", 'color: green' ,this.formWrapper);
19
- console.log("%cactionUrl:", 'color: green' ,this.actionUrl);
20
- console.log("%cjsonUrl:", 'color: green', jsonUrl);
21
- console.log("%cerrorMessages:", 'color: green', errorMessages);
22
- console.log("%cmultipart:", 'color: green', multipart);
23
- console.log("%ctrackingInformations:", 'color: green', trackingInformations);
24
-
25
21
  this.$store.forms.submissionAttempted[formId] = false;
22
+ this.$store.forms.errorMessages = JSON.parse( "{" + errorMessages.replace(/&quot;/g,'"') + "}")
26
23
  },
27
- clickHandler(event) {
28
- console.log("event:",event);
29
- console.log('check for Error:',formId);
30
- console.log('form:',this.form);
31
-
24
+ submitButtonHandler(event) {
32
25
  if(this.form.reportValidity()){
33
- // this.logData(event,form);
34
26
  this.handleSubmit(event,this.form)
35
27
  } else {
36
28
  this.$store.forms.submissionAttempted[formId] = true;
37
29
  }
38
30
  },
39
- logData(event,form) {
40
- // TODO - FOR DEBUGGIN CN BE REMOVED AT THE END
41
- const formData = new FormData(form);
42
- const fields = Array.from(form.elements);
43
- // Log the serialized form data
44
- console.log(fields);
45
-
46
- // Convert the FormData to a serialized string
47
- const serializedData = Array.from(formData.entries())
48
- .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
49
- .join('&');
50
-
51
- // Log the serialized form data
52
- console.log('serialized DATA: ' + serializedData);
53
- console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
54
-
31
+ retryHandler() {
32
+ this.wasPosted = false;
33
+ this.wasPostedWithError = false;
55
34
  },
56
- // TODO - Validation error handler (adapt to your case)
57
35
  handleValidationErrors(errors) {
58
36
  console.log('Validation Errors:', errors);
59
37
  this.$store.forms.serverErrorFields[formId] = errors;
@@ -61,29 +39,19 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
61
39
  },
62
40
  resetValidationErrors() {
63
41
  this.$store.forms.serverErrorFields[formId] = {}
64
- },
65
-
42
+ },
66
43
  handleSubmit(event, form ) {
67
44
  event.preventDefault();
68
45
 
69
- if (!this.isWebview) {
70
- //uxAction(trackingInformations); // Assuming this is a tracking library
46
+ if (!this.isWebview) {
47
+ uxAction(trackingInformations);
71
48
  }
72
49
 
73
50
  if (this.isPosting) return;
74
51
  this.isPosting = true;
75
52
 
76
- // TODO mit alpine umsetzen
77
- //const preloadIcon = formWrapper.querySelector('.js-preloadIcon');
78
- //const loadingIcon = formWrapper.querySelector('.js-loadingIcon');
79
-
80
- // Show loading indicator
81
- //preloadIcon.classList.add('-isHidden');
82
- //loadingIcon.classList.remove('-isHidden');
83
-
84
53
  console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
85
54
 
86
- // Define ajaxOptions based on form type (without jQuery $.ajax)
87
55
  let ajaxOptions = {
88
56
  method: jsonp ? 'GET' : 'POST',
89
57
  headers: {
@@ -96,13 +64,13 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
96
64
  if (jsonp) {
97
65
  ajaxOptions.url = this.actionUrl;
98
66
  ajaxOptions.headers['Content-Type'] = 'application/json; charset=utf-8';
99
- ajaxOptions.body = new URLSearchParams(new FormData(form)).toString(); // For JSONP case
67
+ ajaxOptions.body = new URLSearchParams(new FormData(form)).toString();
100
68
  } else if (multipart) {
101
69
  ajaxOptions = {
102
70
  method: 'POST',
103
71
  url: this.actionUrl,
104
72
  timeout: 600 * 1000,
105
- body: new FormData(form), // No URLSearchParams, we use FormData for multipart
73
+ body: new FormData(form),
106
74
  processData: false,
107
75
  headers: {}
108
76
  };
@@ -110,10 +78,9 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
110
78
  ajaxOptions.url = `${this.actionUrl}?${responseFormatParam}`;
111
79
  }
112
80
 
113
- // Using fetch API instead of $.ajax
114
81
  fetch(ajaxOptions.url, ajaxOptions)
115
82
  .then(async (response) => {
116
- const data = await response.text(); // Assuming the rponse is text or JSON
83
+ const data = await response.text();
117
84
  if (response.ok) {
118
85
  console.log('Done');
119
86
  console.log(data);
@@ -126,74 +93,42 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
126
93
  break;
127
94
  case 'OK':
128
95
  console.log("OK");
129
- this.replaceAnimated(
130
- this.formWrapper,
131
- this.form.querySelector('#successMessage').innerHTML,
132
- true
133
- );
96
+ this.wasPosted = true;
97
+ this.wasPostedWithSuccess = true;
134
98
  break;
135
99
  default:
136
100
  console.log("default");
137
- this.replaceAnimated(
138
- this.formWrapper,
139
- this.form.querySelector('#errorMessage').innerHTML,
140
- true
141
- );
101
+ this.wasPosted = true;
102
+ this.wasPostedWithError = true;
142
103
  break;
143
104
  }
144
105
  } else {
145
- this.replaceAnimated(this.formWrapper, data, true);
106
+
107
+ this.wasPosted = true;
108
+ this.wasPostedWithError = true;
146
109
  }
147
- /*
148
- if (eventOnSuccess) {
149
- fireEvent(eventOnSuccess, true);
150
- } */
151
-
152
- /* if (rootElement.id) {
153
- window.location.hash = rootElement.id;
154
- } */
110
+ if (formId) {
111
+ window.location.hash = formId;
112
+ }
155
113
  } else {
114
+ this.wasPosted = true;
115
+ this.wasPostedWithError = true;
156
116
  throw new Error('Network response was not ok.');
117
+
157
118
  }
158
119
  })
159
120
  .catch((error) => {
160
121
  console.error('Fail:', error);
161
- this.replaceAnimated(
162
- this.formWrapper,
163
- '<div class="c-form success">Das hat leider nicht funktioniert!</div>',
164
- true
165
- );
122
+ this.wasPosted = true;
123
+ this.wasPostedWithError = true;
166
124
  })
167
125
  .finally(() => {
168
126
  console.log('Always');
169
- // TODO MIT ALPINE UMSETZEN
170
- //preloadIcon.classList.remove('-isHidden');
171
- //loadingIcon.classList.add('-isHidden');
172
127
  this.isPosting = false;
173
128
  });
174
129
  },
175
- // Helper function to replace content with animation (replacing hrQuery's replaceAnimated)
176
- replaceAnimated(wrapper, newContent, withFade = true) {
177
- if (withFade) {
178
- wrapper.style.opacity = 0;
179
- setTimeout(() => {
180
- wrapper.innerHTML = newContent;
181
- wrapper.style.opacity = 1;
182
- }, 300);
183
- } else {
184
- wrapper.innerHTML = newContent;
185
- }
186
- },
187
- // Fire event utility (could be Alpine.js specific or custom)
188
- fireEvent(eventName, success){
189
- const event = new CustomEvent(eventName, { detail: success });
190
- document.dispatchEvent(event);
191
- },
192
130
  getSubmissionAttempted() {
193
131
  return this.$store.forms.submissionAttempted[formId]
194
- }
195
-
132
+ }
196
133
  }
197
- }
198
-
199
-
134
+ }
@@ -90,42 +90,8 @@ export default function inputHandler(element, formId, errorMandatory, type, erro
90
90
  return Boolean(this.$store.forms.serverErrorFields[formId]?.[name]);
91
91
  },
92
92
  getServerError() {
93
- let serverError = "Server Error: "
94
- switch (this.$store.forms.serverErrorFields[formId][name]) {
95
-
96
- case 'form_error_required':
97
- serverError += "Pflichtfeld"
98
- break
99
- case 'form_error_max':
100
- serverError += "Zu viele Zeichen"
101
- break
102
- case 'form_error_validurl':
103
- serverError += "Ungültige URL"
104
- break
105
- case 'form_error_empty':
106
- serverError += "Darf nicht ausgefüllt werden"
107
- break
108
- case 'form_error_constants_or_null':
109
- serverError += "Ungültiger Wert"
110
- break
111
- case 'form_error_constants':
112
- serverError += "Ungültiger Wert"
113
- break
114
- case 'form_error_max_multivalue':
115
- serverError += "Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten"
116
- break
117
- case 'vote_error_identity_already_used':
118
- serverError += "Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich."
119
- break
120
- case 'vote_error_token_request_count_exceeded':
121
- serverError += "Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt."
122
- break
123
- case 'form_error_email':
124
- serverError += "Ungültige E-Mail-Adresse"
125
- break
126
- default:
127
- return false
128
- }
93
+ let errorName = this.$store.forms.serverErrorFields[formId][name]
94
+ let serverError = this.$store.forms.errorMessages[errorName]
129
95
  return serverError
130
96
  }
131
97
  };