hr-design-system-handlebars 1.100.7 → 1.101.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/assets/index.css +26 -3
  3. package/dist/assets/js/alpine.js +2 -0
  4. package/dist/assets/js/components/forms/inputHandler.alpine.js +30 -0
  5. package/dist/views/components/content/copytext/copytext_body.hbs +1 -1
  6. package/dist/views/components/forms/fields.hbs +4 -4
  7. package/dist/views/components/forms/input.hbs +98 -0
  8. package/dist/views/components/forms/textarea.hbs +19 -9
  9. package/dist/views/components/forms/webform.hbs +12 -6
  10. package/dist/views_static/components/content/copytext/copytext_body.hbs +1 -1
  11. package/dist/views_static/components/forms/fields.hbs +4 -4
  12. package/dist/views_static/components/forms/input.hbs +98 -0
  13. package/dist/views_static/components/forms/textarea.hbs +19 -9
  14. package/dist/views_static/components/forms/webform.hbs +12 -6
  15. package/package.json +1 -1
  16. package/src/assets/fixtures/content/copytext/copytext_webform.json +8 -2
  17. package/src/assets/fixtures/forms/form_fields.inc.json +15 -1
  18. package/src/assets/js/alpine.js +2 -0
  19. package/src/stories/views/components/content/copytext/copytext_body.hbs +1 -1
  20. package/src/stories/views/components/content/copytext/fixtures/copytext_webform.json +1 -1
  21. package/src/stories/views/components/forms/fields.hbs +4 -4
  22. package/src/stories/views/components/forms/fixtures/form_input_mandatory.json +1 -1
  23. package/src/stories/views/components/forms/input.hbs +98 -0
  24. package/src/stories/views/components/forms/inputHandler.alpine.js +30 -0
  25. package/src/stories/views/components/forms/textarea.hbs +19 -9
  26. package/src/stories/views/components/forms/webform.hbs +12 -6
  27. package/dist/views/components/forms/input_single_line.hbs +0 -117
  28. package/dist/views_static/components/forms/input_single_line.hbs +0 -117
  29. package/src/stories/views/components/forms/input_single_line.hbs +0 -117
package/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v1.101.0 (Thu Sep 19 2024)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - ✨ DPE-3361 Formular in delivery einbauen [#1071](https://github.com/mumprod/hr-design-system-handlebars/pull/1071) ([@vascoeduardo](https://github.com/vascoeduardo))
6
+
7
+ #### Authors: 1
8
+
9
+ - Vasco ([@vascoeduardo](https://github.com/vascoeduardo))
10
+
11
+ ---
12
+
13
+ # v1.100.8 (Wed Sep 18 2024)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - 🎨 Form Validation as lazy loaded async script [#1070](https://github.com/mumprod/hr-design-system-handlebars/pull/1070) ([@vascoeduardo](https://github.com/vascoeduardo))
18
+
19
+ #### Authors: 1
20
+
21
+ - Vasco ([@vascoeduardo](https://github.com/vascoeduardo))
22
+
23
+ ---
24
+
1
25
  # v1.100.7 (Tue Sep 17 2024)
2
26
 
3
27
  #### 🐛 Bug Fix
@@ -2198,6 +2198,10 @@ article.indexTextDS .indexTextHighlighted .link {
2198
2198
  .rounded-lg {
2199
2199
  border-radius: 0.5rem;
2200
2200
  }
2201
+ .rounded-b {
2202
+ border-bottom-right-radius: 0.25rem;
2203
+ border-bottom-left-radius: 0.25rem;
2204
+ }
2201
2205
  .rounded-l {
2202
2206
  border-top-left-radius: 0.25rem;
2203
2207
  border-bottom-left-radius: 0.25rem;
@@ -2259,6 +2263,9 @@ article.indexTextDS .indexTextHighlighted .link {
2259
2263
  .border-t {
2260
2264
  border-top-width: 1px;
2261
2265
  }
2266
+ .border-t-0 {
2267
+ border-top-width: 0px;
2268
+ }
2262
2269
  .border-t-\[3px\] {
2263
2270
  border-top-width: 3px;
2264
2271
  }
@@ -2348,6 +2355,10 @@ article.indexTextDS .indexTextHighlighted .link {
2348
2355
  border-color: #005293;
2349
2356
  border-color: var(--color-primary-ds);
2350
2357
  }
2358
+ .border-red-400 {
2359
+ --tw-border-opacity: 1;
2360
+ border-color: rgba(248, 113, 113, var(--tw-border-opacity));
2361
+ }
2351
2362
  .border-red-500 {
2352
2363
  --tw-border-opacity: 1;
2353
2364
  border-color: rgba(239, 68, 68, var(--tw-border-opacity));
@@ -2545,6 +2556,14 @@ article.indexTextDS .indexTextHighlighted .link {
2545
2556
  background-color: #005293;
2546
2557
  background-color: var(--color-primary-ds);
2547
2558
  }
2559
+ .bg-red-100 {
2560
+ --tw-bg-opacity: 1;
2561
+ background-color: rgba(254, 226, 226, var(--tw-bg-opacity));
2562
+ }
2563
+ .bg-red-500 {
2564
+ --tw-bg-opacity: 1;
2565
+ background-color: rgba(239, 68, 68, var(--tw-bg-opacity));
2566
+ }
2548
2567
  .bg-slate-200 {
2549
2568
  --tw-bg-opacity: 1;
2550
2569
  background-color: rgba(226, 232, 240, var(--tw-bg-opacity));
@@ -3435,7 +3454,7 @@ article.indexTextDS .indexTextHighlighted .link {
3435
3454
  border-bottom-color: var(--color-secondary-ds);
3436
3455
  }
3437
3456
  .counter-reset {
3438
- counter-reset: cnt1726580940248;
3457
+ counter-reset: cnt1726756869388;
3439
3458
  }
3440
3459
  .hyphens-auto {
3441
3460
  -webkit-hyphens: auto;
@@ -3843,7 +3862,7 @@ article.indexTextDS .indexTextHighlighted .link {
3843
3862
  --tw-ring-color: rgba(255, 255, 255, 0.5);
3844
3863
  }
3845
3864
  .-ordered {
3846
- counter-increment: cnt1726580940248 1;
3865
+ counter-increment: cnt1726756869388 1;
3847
3866
  }
3848
3867
  .-ordered::before {
3849
3868
  position: absolute;
@@ -3859,7 +3878,7 @@ article.indexTextDS .indexTextHighlighted .link {
3859
3878
  letter-spacing: .0125em;
3860
3879
  --tw-text-opacity: 1;
3861
3880
  color: rgba(0, 0, 0, var(--tw-text-opacity));
3862
- content: counter(cnt1726580940248);
3881
+ content: counter(cnt1726756869388);
3863
3882
  }
3864
3883
  /*! ****************************/
3865
3884
  /*! DataPolicy stuff */
@@ -6419,6 +6438,10 @@ ul.restrictedToTwo li:nth-of-type(1n + 2) .timelineBorder {
6419
6438
  margin-bottom: 1.75rem;
6420
6439
  }
6421
6440
 
6441
+ .sm\:mb-12 {
6442
+ margin-bottom: 3rem;
6443
+ }
6444
+
6422
6445
  .sm\:mb-14 {
6423
6446
  margin-bottom: 3.5rem;
6424
6447
  }
@@ -17,7 +17,9 @@ AsyncAlpine.init(Alpine)
17
17
  .data('slider', () =>
18
18
  import('components/horizontal_scroll_container/horizontal_scroll_container.alpine.js')
19
19
  )
20
+
20
21
  .data('socialSharingHandler', ()=> import('components/social_sharing/socialSharingHandler.alpine.js'))
22
+ .data('inputHandler', ()=> import('components/forms/inputHandler.alpine.js'))
21
23
  .start()
22
24
 
23
25
  window.Alpine = Alpine
@@ -0,0 +1,30 @@
1
+ export default function inputHandler(element, errorMandatory, errorEmail, isEmail = false, prefilledText = '') {
2
+ return {
3
+ [element]: prefilledText,
4
+ valid: false,
5
+ wasFocused: false,
6
+ isFocused: false,
7
+ validEmail: false,
8
+ errorMessage() {
9
+ if( Boolean(isEmail)){
10
+ return !this.valid ? errorMandatory : errorEmail
11
+ } else {
12
+ return errorMandatory
13
+ }
14
+ },
15
+ hideDescription() {
16
+ if( Boolean(isEmail)){
17
+ return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (!this.validEmail && this.wasFocused && !this.isFocused))
18
+ } else {
19
+ return Boolean(!this.valid && this.wasFocused && !this.isFocused)
20
+ }
21
+ },
22
+ hideError() {
23
+ return Boolean(!this.hideDescription())
24
+ },
25
+ validateEmail() {
26
+ var emailRegex = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;
27
+ this.validEmail = emailRegex.test( this[element]);
28
+ }
29
+ };
30
+ }
@@ -22,7 +22,7 @@
22
22
  {{> components/content/copytext/components/map }}
23
23
  {{/if~}}
24
24
  {{~#if this.isWebForm}}
25
- {{> components/forms/webform }}
25
+ {{> components/forms/webform _newWebForm=this.hasNewWebForm}}
26
26
  {{/if~}}
27
27
  {{~#if this.isNewsletter}}
28
28
  {{> components/content/copytext/components/newsletter }}
@@ -16,7 +16,7 @@
16
16
 
17
17
  {{else}}
18
18
 
19
- <div class="c-form__row js-wrapper-{{this.name}}">
19
+ <div class="js-wrapper-{{this.name}}">
20
20
  {{#if this.type.isTextarea}}
21
21
  {{~> components/forms/textarea
22
22
  _name=this.name
@@ -31,15 +31,15 @@
31
31
  _errorMessage="Bitte füllen Sie dieses Pflichtfeld aus"
32
32
  }}
33
33
  {{else if this.type.isText}}
34
- {{~> components/forms/input_single_line
34
+ {{~> components/forms/input
35
35
  _type=this.type.asString
36
36
  _isEmail=this.type.isEmail
37
37
  _name=this.name
38
38
  _label=this.label
39
- _labelClass="hide"
39
+ _labelClass=""
40
40
  _description=this.description
41
41
  _defaultValue=this.defaultValue
42
- _inputClass=(if this.isHidden "hide")
42
+ _wrapperClass=(if this.isHidden "hidden")
43
43
  _tabindex=(if this.isHidden "-1")
44
44
  _required=this.isRequired
45
45
  _maxLength=this.maxLength
@@ -0,0 +1,98 @@
1
+ <div class="relative flex flex-col w-full mb-5 {{_wrapperClass}}"
2
+ ax-load
3
+ x-data="inputHandler('input{{nextRandom}}','{{_errorMandatory}}','{{_errorEmail}}',{{#if _isEmail}}true{{else}}false{{/if}},'{{#if _formField.forHtmlAttribute}}{{_formField.forHtmlAttribute}}{{else}}{{#if _value}}{{_value}}{{else}}{{_defaultValue}}{{/if}}{{/if}}')"
4
+ x-ignore
5
+ >
6
+ <input class="relative w-full h-12 pt-4 pl-4 text-gray-800 placeholder-transparent bg-white border-blue-500 pr-9 peer border-y focus:border-y-2 border-t-transparent focus:outline-none"
7
+ :class="{'border-blue-500': hideError(),'border-red-700': hideDescription() }"
8
+ x-model="input{{getRandom}}"
9
+ id="input{{getRandom}}"
10
+ {{#if _required}}
11
+ @focus="isFocused = true;"
12
+ @blur="wasFocused = true; isFocused=false"
13
+ x-on:keyup ="input{{getRandom}}.length > 0 ? valid = true : valid = false; validateEmail()"
14
+ {{/if}}
15
+ type="{{#if _type}}{{_type}}{{/if}}"
16
+ name="{{#if _name}}{{_name}}{{/if}}"
17
+ {{#if _locaKey}}
18
+ title="{{loca _locaKey}}{{#if _required}}*{{/if}}"
19
+ placeholder="placeholder:{{loca _locaKey}}{{#if _required}}*{{/if}}"
20
+ {{else}}
21
+ {{#if _label}}
22
+ title="{{_label}}{{#if _required}}*{{/if}}"
23
+ placeholder="placeholder:{{_label}}{{#if _required}}*{{/if}}"
24
+ {{/if}}
25
+ {{/if}}
26
+ {{#if _formField.forHtmlAttribute}}
27
+ value="{{_formField.forHtmlAttribute}}"
28
+ {{else}}
29
+ {{#if _value}}
30
+ value="{{_value}}"
31
+ {{else}}
32
+ value="{{_defaultValue}}"
33
+ {{/if}}
34
+ {{/if}}
35
+ {{#if _maxLength}}
36
+ maxlength="{{_maxLength}}"
37
+ {{/if~}}
38
+ {{#if _required}} required{{/if}}
39
+ {{#if _tabindex}} tabindex="{{_tabindex}}"{{/if}}
40
+ {{#if _autocompleteOff}} autocomplete="off"{{/if}}
41
+ {{#if _autoSuggestFeature}}
42
+ data-hr-search-suggest='{"templateUrl":"{{resourceUrl "suche/index~suggest.jsp"}}"}'{{/if}}
43
+ >
44
+
45
+ <label for="input{{getRandom}}" class="{{_labelClass}} absolute left-[16px] top-px translate-y-0 translate-x-0 scale-75 text-gray-500
46
+
47
+ peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-x-0 peer-placeholder-shown:translate-y-3
48
+
49
+ peer-focus:translate-x-0 peer-focus:-translate-y-0 peer-focus:scale-75 peer-focus:text-blue-500 origin-top-left transform transition-transform">
50
+ {{#if _hasBody}}
51
+ {{decorator_body}}
52
+ {{else}}
53
+ {{#if _locaKey}}
54
+ {{loca _locaKey}}
55
+ {{else}}
56
+ {{#if _label}}
57
+ {{{_label}}}{{#if _required}}*{{/if}}
58
+ {{/if}}
59
+ {{/if}}
60
+ {{/if}}
61
+ </label>
62
+ {{#if _required}}
63
+ <div class="absolute top-0 z-10 flex items-center justify-center h-12 right-4">
64
+ <div class="hidden w-5 h-5 font-bold" :class="{'hidden': hideError() }">
65
+ {{> components/base/image/icon _icon="info2" _addClass="w-5 h-5 fill-red-700"}}
66
+ </div>
67
+ </div>
68
+ {{/if}}
69
+ <div class="flex items-end justify-between h-5 font-heading">
70
+ {{#if _description}}
71
+ <div class="pl-4 text-xs text-gray-500" {{#if _required}}:class="{'hidden': hideDescription() }"{{/if}}>{{_description}}</div>
72
+ {{/if}}
73
+ {{#if _required}}
74
+ <div class="hidden pl-4 text-xs text-red-700" :class="{'hidden': hideError()}" x-text="errorMessage"></div>
75
+ {{/if}}
76
+ {{#if _maxLength}}
77
+ <div class="px-4 ml-auto text-xs text-gray-500"><span x-text="input{{getRandom}}.length">0</span>/{{_maxLength}}</div>
78
+ {{/if~}}
79
+ </div>
80
+ <div class="hidden">
81
+ <div class="px-4 py-2 font-bold text-white bg-red-500 rounded-t">
82
+ DEBUG
83
+ </div>
84
+ <div class="px-4 py-3 text-red-700 bg-red-100 border border-t-0 border-red-400 rounded-b">
85
+ <div>isFocused:<span x-text="isFocused" class="font-bold" :class="isFocused ? 'text-green-800' : 'text-red-700'"></span></div>
86
+ <div>wasFocused:<span x-text="wasFocused" class="font-bold" :class="wasFocused ? 'text-green-800' : 'text-red-700'"></span></div>
87
+ <div>valid:<span x-text="valid" class="font-bold" :class="valid ? 'text-green-800' : 'text-red-700'"></span></div>
88
+ <div>validEmail:<span x-text="validEmail" class="font-bold" :class="validEmail ? 'text-green-800' : 'text-red-700'"></span></div>
89
+ <div>hideDescription:<span x-text="hideDescription()" class="font-bold" :class="hideDescription() ? 'text-green-800' : 'text-red-700'"></span></div>
90
+ <div>hideError:<span x-text="hideError()" class="font-bold" :class="hideError() ? 'text-green-800' : 'text-red-700'"></span></div>
91
+ <div>input.length:<span x-text="input{{getRandom}}.length " class="font-bold" ></span></div>
92
+ <div>input:<span x-text="input{{getRandom}}" class="font-bold" ></span></div>
93
+ <div>errorMessage:<span x-text="errorMessage" class="font-bold" ></span></div>
94
+ <div>prefilledText:<span x-text="prefilledText" class="font-bold" ></span></div>
95
+
96
+ </div>
97
+ </div>
98
+ </div>
@@ -3,9 +3,11 @@
3
3
  <textarea
4
4
  x-model="textarea{{getRandom}}"
5
5
  id="textarea{{getRandom}}"
6
- @focus="isFocused = true"
7
- @blur="wasFocused = true; isFocused=false"
8
- x-on:keyup ="textarea{{getRandom}}.length > 0 ? valid = true : valid = false"
6
+ {{#if _required}}
7
+ @focus="isFocused = true"
8
+ @blur="wasFocused = true; isFocused=false"
9
+ x-on:keyup ="textarea{{getRandom}}.length > 0 ? valid = true : valid = false"
10
+ {{/if}}
9
11
  value=""
10
12
  name="{{#if _name}}{{_name}}{{/if}}"
11
13
  {{#if _locaKey}}
@@ -28,7 +30,9 @@
28
30
  {{/if~}}
29
31
  {{#if _required}}required{{/if}}
30
32
  class="relative w-full px-4 pb-px text-gray-800 placeholder-transparent bg-white border-blue-500 min-h-12 peer border-y focus:border-b-2 focus:pb-0 border-t-transparent focus:outline-none"
31
- :class="{'border-blue-500': valid || !wasFocused || isFocused,'border-red-500': !valid && wasFocused && !isFocused}"
33
+ {{#if _required}}
34
+ :class="{'border-blue-500': valid || !wasFocused || isFocused,'border-red-500': !valid && wasFocused && !isFocused}"
35
+ {{/if}}
32
36
  >{{#if _formField.isValid}}
33
37
  {{{_formField.forHtmlContent}}}
34
38
  {{else}}
@@ -62,16 +66,22 @@
62
66
  <div class="pl-4 text-xs text-gray-500 min-h- " {{#if _required}}:class="{'hidden': !valid && wasFocused && !isFocused}"{{/if}}>{{_description}}</div>
63
67
  {{/if}}
64
68
  {{#if _required}}
65
- <div class="hidden pl-4 text-xs font-bold text-red-700" :class="{'hidden': valid || !wasFocused || isFocused}" >{{_errorMessage}}</div>
69
+ <div class="hidden pl-4 text-xs text-red-700" :class="{'hidden': valid || !wasFocused || isFocused}" >{{_errorMessage}}</div>
66
70
  {{/if}}
67
71
  {{#if _maxLength}}
68
72
  <div class="px-4 ml-auto text-xs text-gray-500"><span x-text="textarea{{getRandom}}.length">0</span>/{{_maxLength}}</div>
69
73
  {{/if~}}
70
74
  </div>
75
+
71
76
  <div class="hidden">
72
- <div>DEBUGG</div>
73
- <div>wasFocused:<span x-text="wasFocused"></span></div>
74
- <div>valid:<span x-text="valid"></span></div>
75
- <div>input.length:<span x-text="textarea{{getRandom}}.length "></span></div>
77
+ <div class="px-4 py-2 font-bold text-white bg-red-500 rounded-t">
78
+ DEBUG
79
+ </div>
80
+ <div class="px-4 py-3 text-red-700 bg-red-100 border border-t-0 border-red-400 rounded-b">
81
+ <div>isFocused:<span x-text="isFocused" class="font-bold" :class="isFocused ? 'text-green-800' : 'text-red-700'"></span></div>
82
+ <div>wasFocused:<span x-text="wasFocused" class="font-bold" :class="wasFocused ? 'text-green-800' : 'text-red-700'"></span></div>
83
+ <div>valid:<span x-text="valid" class="font-bold" :class="valid ? 'text-green-800' : 'text-red-700'"></span></div>
84
+ <div>input.length:<span x-text="textarea{{getRandom}}.length " class="font-bold" ></span></div>
85
+ </div>
76
86
  </div>
77
87
  </div>
@@ -1,9 +1,15 @@
1
- {{~#if (isStorybook)~}}
2
- {{#>components/forms/backgroundBox }}
3
- <form class="relative flex flex-col justify-center overflow-hidden group" id="form--{{nextRandom}}" action="{{this.url}}" method="post" enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}" accept-charset="utf-8" >
4
- {{> components/forms/fields }}
5
- </form>
6
- {{/components/forms/backgroundBox }}
1
+ {{~#if _newWebForm ~}}
2
+ {{#>components/forms/backgroundBox }}
3
+
4
+
5
+ <h3 class="mb-6 text-2xl font-headingSerif sm:mb-12">
6
+ {{this.title}}
7
+ </h3>
8
+
9
+ <form class="relative flex flex-col justify-center overflow-hidden group" id="form--{{nextRandom}}" action="{{this.url}}" method="post" enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}" accept-charset="utf-8" >
10
+ {{> components/forms/fields }}
11
+ </form>
12
+ {{/components/forms/backgroundBox }}
7
13
  {{~else~}}
8
14
  {{> content/webform/components/webform _addClass="print:hidden copytext__clearBox marginTrailer--m"}}
9
15
  {{~/if~}}
@@ -22,7 +22,7 @@
22
22
  {{> components/content/copytext/components/map }}
23
23
  {{/if~}}
24
24
  {{~#if this.isWebForm}}
25
- {{> components/forms/webform }}
25
+ {{> components/forms/webform _newWebForm=this.hasNewWebForm}}
26
26
  {{/if~}}
27
27
  {{~#if this.isNewsletter}}
28
28
  {{> components/content/copytext/components/newsletter }}
@@ -16,7 +16,7 @@
16
16
 
17
17
  {{else}}
18
18
 
19
- <div class="c-form__row js-wrapper-{{this.name}}">
19
+ <div class="js-wrapper-{{this.name}}">
20
20
  {{#if this.type.isTextarea}}
21
21
  {{~> components/forms/textarea
22
22
  _name=this.name
@@ -31,15 +31,15 @@
31
31
  _errorMessage="Bitte füllen Sie dieses Pflichtfeld aus"
32
32
  }}
33
33
  {{else if this.type.isText}}
34
- {{~> components/forms/input_single_line
34
+ {{~> components/forms/input
35
35
  _type=this.type.asString
36
36
  _isEmail=this.type.isEmail
37
37
  _name=this.name
38
38
  _label=this.label
39
- _labelClass="hide"
39
+ _labelClass=""
40
40
  _description=this.description
41
41
  _defaultValue=this.defaultValue
42
- _inputClass=(if this.isHidden "hide")
42
+ _wrapperClass=(if this.isHidden "hidden")
43
43
  _tabindex=(if this.isHidden "-1")
44
44
  _required=this.isRequired
45
45
  _maxLength=this.maxLength
@@ -0,0 +1,98 @@
1
+ <div class="relative flex flex-col w-full mb-5 {{_wrapperClass}}"
2
+ ax-load
3
+ x-data="inputHandler('input{{nextRandom}}','{{_errorMandatory}}','{{_errorEmail}}',{{#if _isEmail}}true{{else}}false{{/if}},'{{#if _formField.forHtmlAttribute}}{{_formField.forHtmlAttribute}}{{else}}{{#if _value}}{{_value}}{{else}}{{_defaultValue}}{{/if}}{{/if}}')"
4
+ x-ignore
5
+ >
6
+ <input class="relative w-full h-12 pt-4 pl-4 text-gray-800 placeholder-transparent bg-white border-blue-500 pr-9 peer border-y focus:border-y-2 border-t-transparent focus:outline-none"
7
+ :class="{'border-blue-500': hideError(),'border-red-700': hideDescription() }"
8
+ x-model="input{{getRandom}}"
9
+ id="input{{getRandom}}"
10
+ {{#if _required}}
11
+ @focus="isFocused = true;"
12
+ @blur="wasFocused = true; isFocused=false"
13
+ x-on:keyup ="input{{getRandom}}.length > 0 ? valid = true : valid = false; validateEmail()"
14
+ {{/if}}
15
+ type="{{#if _type}}{{_type}}{{/if}}"
16
+ name="{{#if _name}}{{_name}}{{/if}}"
17
+ {{#if _locaKey}}
18
+ title="{{loca _locaKey}}{{#if _required}}*{{/if}}"
19
+ placeholder="placeholder:{{loca _locaKey}}{{#if _required}}*{{/if}}"
20
+ {{else}}
21
+ {{#if _label}}
22
+ title="{{_label}}{{#if _required}}*{{/if}}"
23
+ placeholder="placeholder:{{_label}}{{#if _required}}*{{/if}}"
24
+ {{/if}}
25
+ {{/if}}
26
+ {{#if _formField.forHtmlAttribute}}
27
+ value="{{_formField.forHtmlAttribute}}"
28
+ {{else}}
29
+ {{#if _value}}
30
+ value="{{_value}}"
31
+ {{else}}
32
+ value="{{_defaultValue}}"
33
+ {{/if}}
34
+ {{/if}}
35
+ {{#if _maxLength}}
36
+ maxlength="{{_maxLength}}"
37
+ {{/if~}}
38
+ {{#if _required}} required{{/if}}
39
+ {{#if _tabindex}} tabindex="{{_tabindex}}"{{/if}}
40
+ {{#if _autocompleteOff}} autocomplete="off"{{/if}}
41
+ {{#if _autoSuggestFeature}}
42
+ data-hr-search-suggest='{"templateUrl":"{{resourceUrl "suche/index~suggest.jsp"}}"}'{{/if}}
43
+ >
44
+
45
+ <label for="input{{getRandom}}" class="{{_labelClass}} absolute left-[16px] top-px translate-y-0 translate-x-0 scale-75 text-gray-500
46
+
47
+ peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-x-0 peer-placeholder-shown:translate-y-3
48
+
49
+ peer-focus:translate-x-0 peer-focus:-translate-y-0 peer-focus:scale-75 peer-focus:text-blue-500 origin-top-left transform transition-transform">
50
+ {{#if _hasBody}}
51
+ {{decorator_body}}
52
+ {{else}}
53
+ {{#if _locaKey}}
54
+ {{loca _locaKey}}
55
+ {{else}}
56
+ {{#if _label}}
57
+ {{{_label}}}{{#if _required}}*{{/if}}
58
+ {{/if}}
59
+ {{/if}}
60
+ {{/if}}
61
+ </label>
62
+ {{#if _required}}
63
+ <div class="absolute top-0 z-10 flex items-center justify-center h-12 right-4">
64
+ <div class="hidden w-5 h-5 font-bold" :class="{'hidden': hideError() }">
65
+ {{> components/base/image/icon _icon="info2" _addClass="w-5 h-5 fill-red-700"}}
66
+ </div>
67
+ </div>
68
+ {{/if}}
69
+ <div class="flex items-end justify-between h-5 font-heading">
70
+ {{#if _description}}
71
+ <div class="pl-4 text-xs text-gray-500" {{#if _required}}:class="{'hidden': hideDescription() }"{{/if}}>{{_description}}</div>
72
+ {{/if}}
73
+ {{#if _required}}
74
+ <div class="hidden pl-4 text-xs text-red-700" :class="{'hidden': hideError()}" x-text="errorMessage"></div>
75
+ {{/if}}
76
+ {{#if _maxLength}}
77
+ <div class="px-4 ml-auto text-xs text-gray-500"><span x-text="input{{getRandom}}.length">0</span>/{{_maxLength}}</div>
78
+ {{/if~}}
79
+ </div>
80
+ <div class="hidden">
81
+ <div class="px-4 py-2 font-bold text-white bg-red-500 rounded-t">
82
+ DEBUG
83
+ </div>
84
+ <div class="px-4 py-3 text-red-700 bg-red-100 border border-t-0 border-red-400 rounded-b">
85
+ <div>isFocused:<span x-text="isFocused" class="font-bold" :class="isFocused ? 'text-green-800' : 'text-red-700'"></span></div>
86
+ <div>wasFocused:<span x-text="wasFocused" class="font-bold" :class="wasFocused ? 'text-green-800' : 'text-red-700'"></span></div>
87
+ <div>valid:<span x-text="valid" class="font-bold" :class="valid ? 'text-green-800' : 'text-red-700'"></span></div>
88
+ <div>validEmail:<span x-text="validEmail" class="font-bold" :class="validEmail ? 'text-green-800' : 'text-red-700'"></span></div>
89
+ <div>hideDescription:<span x-text="hideDescription()" class="font-bold" :class="hideDescription() ? 'text-green-800' : 'text-red-700'"></span></div>
90
+ <div>hideError:<span x-text="hideError()" class="font-bold" :class="hideError() ? 'text-green-800' : 'text-red-700'"></span></div>
91
+ <div>input.length:<span x-text="input{{getRandom}}.length " class="font-bold" ></span></div>
92
+ <div>input:<span x-text="input{{getRandom}}" class="font-bold" ></span></div>
93
+ <div>errorMessage:<span x-text="errorMessage" class="font-bold" ></span></div>
94
+ <div>prefilledText:<span x-text="prefilledText" class="font-bold" ></span></div>
95
+
96
+ </div>
97
+ </div>
98
+ </div>
@@ -3,9 +3,11 @@
3
3
  <textarea
4
4
  x-model="textarea{{getRandom}}"
5
5
  id="textarea{{getRandom}}"
6
- @focus="isFocused = true"
7
- @blur="wasFocused = true; isFocused=false"
8
- x-on:keyup ="textarea{{getRandom}}.length > 0 ? valid = true : valid = false"
6
+ {{#if _required}}
7
+ @focus="isFocused = true"
8
+ @blur="wasFocused = true; isFocused=false"
9
+ x-on:keyup ="textarea{{getRandom}}.length > 0 ? valid = true : valid = false"
10
+ {{/if}}
9
11
  value=""
10
12
  name="{{#if _name}}{{_name}}{{/if}}"
11
13
  {{#if _locaKey}}
@@ -28,7 +30,9 @@
28
30
  {{/if~}}
29
31
  {{#if _required}}required{{/if}}
30
32
  class="relative w-full px-4 pb-px text-gray-800 placeholder-transparent bg-white border-blue-500 min-h-12 peer border-y focus:border-b-2 focus:pb-0 border-t-transparent focus:outline-none"
31
- :class="{'border-blue-500': valid || !wasFocused || isFocused,'border-red-500': !valid && wasFocused && !isFocused}"
33
+ {{#if _required}}
34
+ :class="{'border-blue-500': valid || !wasFocused || isFocused,'border-red-500': !valid && wasFocused && !isFocused}"
35
+ {{/if}}
32
36
  >{{#if _formField.isValid}}
33
37
  {{{_formField.forHtmlContent}}}
34
38
  {{else}}
@@ -62,16 +66,22 @@
62
66
  <div class="pl-4 text-xs text-gray-500 min-h- " {{#if _required}}:class="{'hidden': !valid && wasFocused && !isFocused}"{{/if}}>{{_description}}</div>
63
67
  {{/if}}
64
68
  {{#if _required}}
65
- <div class="hidden pl-4 text-xs font-bold text-red-700" :class="{'hidden': valid || !wasFocused || isFocused}" >{{_errorMessage}}</div>
69
+ <div class="hidden pl-4 text-xs text-red-700" :class="{'hidden': valid || !wasFocused || isFocused}" >{{_errorMessage}}</div>
66
70
  {{/if}}
67
71
  {{#if _maxLength}}
68
72
  <div class="px-4 ml-auto text-xs text-gray-500"><span x-text="textarea{{getRandom}}.length">0</span>/{{_maxLength}}</div>
69
73
  {{/if~}}
70
74
  </div>
75
+
71
76
  <div class="hidden">
72
- <div>DEBUGG</div>
73
- <div>wasFocused:<span x-text="wasFocused"></span></div>
74
- <div>valid:<span x-text="valid"></span></div>
75
- <div>input.length:<span x-text="textarea{{getRandom}}.length "></span></div>
77
+ <div class="px-4 py-2 font-bold text-white bg-red-500 rounded-t">
78
+ DEBUG
79
+ </div>
80
+ <div class="px-4 py-3 text-red-700 bg-red-100 border border-t-0 border-red-400 rounded-b">
81
+ <div>isFocused:<span x-text="isFocused" class="font-bold" :class="isFocused ? 'text-green-800' : 'text-red-700'"></span></div>
82
+ <div>wasFocused:<span x-text="wasFocused" class="font-bold" :class="wasFocused ? 'text-green-800' : 'text-red-700'"></span></div>
83
+ <div>valid:<span x-text="valid" class="font-bold" :class="valid ? 'text-green-800' : 'text-red-700'"></span></div>
84
+ <div>input.length:<span x-text="textarea{{getRandom}}.length " class="font-bold" ></span></div>
85
+ </div>
76
86
  </div>
77
87
  </div>
@@ -1,9 +1,15 @@
1
- {{~#if (isStorybook)~}}
2
- {{#>components/forms/backgroundBox }}
3
- <form class="relative flex flex-col justify-center overflow-hidden group" id="form--{{nextRandom}}" action="{{this.url}}" method="post" enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}" accept-charset="utf-8" >
4
- {{> components/forms/fields }}
5
- </form>
6
- {{/components/forms/backgroundBox }}
1
+ {{~#if _newWebForm ~}}
2
+ {{#>components/forms/backgroundBox }}
3
+
4
+
5
+ <h3 class="mb-6 text-2xl font-headingSerif sm:mb-12">
6
+ {{this.title}}
7
+ </h3>
8
+
9
+ <form class="relative flex flex-col justify-center overflow-hidden group" id="form--{{nextRandom}}" action="{{this.url}}" method="post" enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}" accept-charset="utf-8" >
10
+ {{> components/forms/fields }}
11
+ </form>
12
+ {{/components/forms/backgroundBox }}
7
13
  {{~else~}}
8
14
  {{> content/webform/components/webform _addClass="print:hidden copytext__clearBox marginTrailer--m"}}
9
15
  {{~/if~}}
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.100.7",
9
+ "version": "1.101.0",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "storybook dev -p 6006 public",
@@ -7,14 +7,20 @@
7
7
  {
8
8
  "paragraphBoxItem": {
9
9
  "isWebForm": true,
10
+ "hasNewWebForm": true,
11
+ "title": "Kontaktformular",
10
12
  "fields":[
11
13
  {
12
14
  "@->jsoninclude": "forms/form_fields.inc.json",
13
- "@->contentpath": "input-text-vorname"
15
+ "@->contentpath": "input-text-vorname-required"
14
16
  },
15
17
  {
16
18
  "@->jsoninclude": "forms/form_fields.inc.json",
17
- "@->contentpath": "input-text-vorname-required"
19
+ "@->contentpath": "input-text-nachname-required"
20
+ },
21
+ {
22
+ "@->jsoninclude": "forms/form_fields.inc.json",
23
+ "@->contentpath": "textarea"
18
24
  }
19
25
  ]
20
26
 
@@ -25,7 +25,21 @@
25
25
  "defaultValue":"",
26
26
  "isHidden":false,
27
27
  "isRequired":true,
28
- "maxLength":"20"
28
+ "maxLength":"140"
29
+ },
30
+ "input-text-nachname-required":
31
+ {
32
+ "type":{
33
+ "isText":true,
34
+ "asString":"text"
35
+ },
36
+ "name":"nachname",
37
+ "label":"Nachname",
38
+ "description":"",
39
+ "defaultValue":"",
40
+ "isHidden":false,
41
+ "isRequired":true,
42
+ "maxLength":"140"
29
43
  },
30
44
  "input-text-vorname-prefilled":
31
45
  {