hr-design-system-handlebars 1.101.3 → 1.102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/assets/index.css +64 -7
  3. package/dist/assets/js/alpine.js +1 -0
  4. package/dist/assets/js/components/forms/inputHandler.alpine.js +13 -8
  5. package/dist/assets/js/components/forms/selectHandler.alpine.js +15 -0
  6. package/dist/views/components/forms/choice.hbs +97 -0
  7. package/dist/views/components/forms/fields.hbs +3 -1
  8. package/dist/views/components/forms/input.hbs +1 -1
  9. package/dist/views/components/forms/select.hbs +62 -22
  10. package/dist/views_static/components/forms/choice.hbs +97 -0
  11. package/dist/views_static/components/forms/fields.hbs +3 -1
  12. package/dist/views_static/components/forms/input.hbs +1 -1
  13. package/dist/views_static/components/forms/select.hbs +62 -22
  14. package/package.json +1 -1
  15. package/src/assets/css/custom-utilities.css +17 -0
  16. package/src/assets/fixtures/forms/form_checkbox.json +18 -0
  17. package/src/assets/fixtures/forms/form_fields.inc.json +127 -87
  18. package/src/assets/fixtures/forms/form_select.json +15 -5
  19. package/src/assets/js/alpine.js +1 -0
  20. package/src/stories/views/components/forms/choice.hbs +97 -0
  21. package/src/stories/views/components/forms/fields.hbs +3 -1
  22. package/src/stories/views/components/forms/fixtures/form_checkbox.json +1 -0
  23. package/src/stories/views/components/forms/fixtures/form_select.json +1 -1
  24. package/src/stories/views/components/forms/form.mdx +1 -1
  25. package/src/stories/views/components/forms/form_checkbox.stories.js +34 -0
  26. package/src/stories/views/components/forms/form_select.stories.js +34 -0
  27. package/src/stories/views/components/forms/{form.stories.js → form_textfields.stories.js} +0 -7
  28. package/src/stories/views/components/forms/input.hbs +1 -1
  29. package/src/stories/views/components/forms/inputHandler.alpine.js +13 -8
  30. package/src/stories/views/components/forms/select.hbs +62 -22
  31. package/src/stories/views/components/forms/selectHandler.alpine.js +15 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # v1.102.1 (Tue Sep 24 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - DPE-3306: add checkbox field [#1075](https://github.com/mumprod/hr-design-system-handlebars/pull/1075) (saad.elbaciri@hr.de [@selbaciri](https://github.com/selbaciri))
6
+
7
+ #### Authors: 2
8
+
9
+ - Saad El Baciri ([@selbaciri](https://github.com/selbaciri))
10
+ - selbaciri (saad.elbaciri@hr.de)
11
+
12
+ ---
13
+
14
+ # v1.102.0 (Tue Sep 24 2024)
15
+
16
+ #### 🚀 Enhancement
17
+
18
+ - DPE-3290 ✨ select field for form [#1074](https://github.com/mumprod/hr-design-system-handlebars/pull/1074) ([@vascoeduardo](https://github.com/vascoeduardo))
19
+
20
+ #### Authors: 1
21
+
22
+ - Vasco ([@vascoeduardo](https://github.com/vascoeduardo))
23
+
24
+ ---
25
+
1
26
  # v1.101.3 (Tue Sep 24 2024)
2
27
 
3
28
  #### ⚠️ Pushed to `main`
@@ -426,7 +426,7 @@ video {
426
426
  font-stretch: condensed;
427
427
  }
428
428
 
429
- .-translate-x-1\/2, .-translate-x-2\/4, .-translate-y-1\/2, .translate-x-0, .translate-y-0, .translate-y-12, .translate-y-3, .translate-y-8, .-rotate-45, .rotate-180, .rotate-45, .scale-100, .scale-50, .scale-75, .scale-y-100, .scale-y-90, .transform, .is-loading::after, label, .hover\:scale-105, .active\:scale-95, .peer-placeholder-shown\:translate-x-0, .peer-placeholder-shown\:translate-y-3, .peer-placeholder-shown\:scale-100, .peer-focus\:translate-x-0, .peer-focus\:translate-y-0, .peer-focus\:scale-75 {
429
+ .-translate-x-1\/2, .-translate-x-2\/4, .-translate-y-1\/2, .translate-x-0, .translate-y-0, .translate-y-12, .translate-y-3, .translate-y-8, .-rotate-45, .rotate-180, .rotate-45, .scale-100, .scale-50, .scale-75, .scale-y-100, .scale-y-90, .transform, .is-loading::after, label, .hover\:scale-105, .active\:scale-95, .peer-placeholder-shown\:translate-x-0, .peer-placeholder-shown\:translate-y-3, .peer-placeholder-shown\:scale-100, .peer-focus\:translate-x-0, .peer-focus\:translate-y-0, .peer-focus\:rotate-180, .peer-focus\:scale-75 {
430
430
  --tw-translate-x: 0;
431
431
  --tw-translate-y: 0;
432
432
  --tw-rotate: 0;
@@ -1136,9 +1136,6 @@ article.indexTextDS .indexTextHighlighted .link {
1136
1136
  .right-0 {
1137
1137
  right: 0px;
1138
1138
  }
1139
- .right-3 {
1140
- right: 0.75rem;
1141
- }
1142
1139
  .right-4 {
1143
1140
  right: 1rem;
1144
1141
  }
@@ -1160,6 +1157,12 @@ article.indexTextDS .indexTextHighlighted .link {
1160
1157
  .top-0\.5 {
1161
1158
  top: 0.125rem;
1162
1159
  }
1160
+ .top-1 {
1161
+ top: 0.25rem;
1162
+ }
1163
+ .top-1\.5 {
1164
+ top: 0.375rem;
1165
+ }
1163
1166
  .top-1\/2 {
1164
1167
  top: 50%;
1165
1168
  }
@@ -1859,6 +1862,9 @@ article.indexTextDS .indexTextHighlighted .link {
1859
1862
  .flex-none {
1860
1863
  flex: none;
1861
1864
  }
1865
+ .flex-shrink-0 {
1866
+ flex-shrink: 0;
1867
+ }
1862
1868
  .shrink {
1863
1869
  flex-shrink: 1;
1864
1870
  }
@@ -2305,6 +2311,10 @@ article.indexTextDS .indexTextHighlighted .link {
2305
2311
  --tw-border-opacity: 1;
2306
2312
  border-color: rgba(59, 130, 246, var(--tw-border-opacity));
2307
2313
  }
2314
+ .border-blue-science-hex {
2315
+ --tw-border-opacity: 1;
2316
+ border-color: rgba(0, 109, 193, var(--tw-border-opacity));
2317
+ }
2308
2318
  .border-brandnavigation-border-color {
2309
2319
  border-color: #005293;
2310
2320
  border-color: var(--color-brandnavigation-border-color);
@@ -2464,6 +2474,10 @@ article.indexTextDS .indexTextHighlighted .link {
2464
2474
  --tw-bg-opacity: 1;
2465
2475
  background-color: rgba(243, 244, 246, var(--tw-bg-opacity));
2466
2476
  }
2477
+ .bg-gray-400 {
2478
+ --tw-bg-opacity: 1;
2479
+ background-color: rgba(156, 163, 175, var(--tw-bg-opacity));
2480
+ }
2467
2481
  .bg-gray-500 {
2468
2482
  --tw-bg-opacity: 1;
2469
2483
  background-color: rgba(107, 114, 128, var(--tw-bg-opacity));
@@ -2653,6 +2667,9 @@ article.indexTextDS .indexTextHighlighted .link {
2653
2667
  .fill-\[\#606060\] {
2654
2668
  fill: #606060;
2655
2669
  }
2670
+ .fill-blue-500 {
2671
+ fill: #3b82f6;
2672
+ }
2656
2673
  .fill-blue-congress-hex {
2657
2674
  fill: #005293;
2658
2675
  }
@@ -3466,7 +3483,7 @@ article.indexTextDS .indexTextHighlighted .link {
3466
3483
  border-bottom-color: var(--color-secondary-ds);
3467
3484
  }
3468
3485
  .counter-reset {
3469
- counter-reset: cnt1727163839066;
3486
+ counter-reset: cnt1727184436170;
3470
3487
  }
3471
3488
  .hyphens-auto {
3472
3489
  -webkit-hyphens: auto;
@@ -3874,7 +3891,7 @@ article.indexTextDS .indexTextHighlighted .link {
3874
3891
  --tw-ring-color: rgba(255, 255, 255, 0.5);
3875
3892
  }
3876
3893
  .-ordered {
3877
- counter-increment: cnt1727163839066 1;
3894
+ counter-increment: cnt1727184436170 1;
3878
3895
  }
3879
3896
  .-ordered::before {
3880
3897
  position: absolute;
@@ -3890,7 +3907,7 @@ article.indexTextDS .indexTextHighlighted .link {
3890
3907
  letter-spacing: .0125em;
3891
3908
  --tw-text-opacity: 1;
3892
3909
  color: rgba(0, 0, 0, var(--tw-text-opacity));
3893
- content: counter(cnt1727163839066);
3910
+ content: counter(cnt1727184436170);
3894
3911
  }
3895
3912
  /*! ****************************/
3896
3913
  /*! DataPolicy stuff */
@@ -4007,6 +4024,25 @@ select:has(option:checked:not([value=""])) + label {
4007
4024
  --tw-scale-y: .75;
4008
4025
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
4009
4026
  }
4027
+ select[\:has\(option\:checked\[value\%3D\%22\%22\]\)] {
4028
+ color: transparent;
4029
+ }
4030
+ select:has(option:checked[value=""]) {
4031
+ color: transparent;
4032
+ }
4033
+ input[type="checkbox"]:checked::after {
4034
+ position: absolute;
4035
+ content: '';
4036
+ width: 15px;
4037
+ height: 6px;
4038
+ background: transparent;
4039
+ top: 7px;
4040
+ left: 3px;
4041
+ border: 3px solid white;
4042
+ border-top: none;
4043
+ border-right: none;
4044
+ transform: rotate(-45deg);
4045
+ }
4010
4046
  .\[-T\:\+Z\] {
4011
4047
  --t: +Z;
4012
4048
  }
@@ -5774,6 +5810,13 @@ select:has(option:checked:not([value=""])) + label {
5774
5810
  .last-of-type\:pb-3:last-of-type {
5775
5811
  padding-bottom: 0.75rem;
5776
5812
  }
5813
+ .checked\:border-transparent:checked {
5814
+ border-color: transparent;
5815
+ }
5816
+ .checked\:bg-blue-congress-hex:checked {
5817
+ --tw-bg-opacity: 1;
5818
+ background-color: rgba(0, 82, 147, var(--tw-bg-opacity));
5819
+ }
5777
5820
  .empty\:hidden:empty {
5778
5821
  display: none;
5779
5822
  }
@@ -5984,11 +6027,21 @@ select:has(option:checked:not([value=""])) + label {
5984
6027
  --tw-translate-y: 0px;
5985
6028
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
5986
6029
  }
6030
+ .peer:focus ~ .peer-focus\:rotate-180 {
6031
+ --tw-rotate: 180deg;
6032
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
6033
+ }
5987
6034
  .peer:focus ~ .peer-focus\:scale-75 {
5988
6035
  --tw-scale-x: .75;
5989
6036
  --tw-scale-y: .75;
5990
6037
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
5991
6038
  }
6039
+ .peer:focus ~ .peer-focus\:border-l-0 {
6040
+ border-left-width: 0px;
6041
+ }
6042
+ .peer:focus ~ .peer-focus\:border-r {
6043
+ border-right-width: 1px;
6044
+ }
5992
6045
  .peer:focus ~ .peer-focus\:text-blue-500 {
5993
6046
  --tw-text-opacity: 1;
5994
6047
  color: rgba(59, 130, 246, var(--tw-text-opacity));
@@ -7096,6 +7149,10 @@ select:has(option:checked:not([value=""])) + label {
7096
7149
  row-gap: 3.5rem;
7097
7150
  }
7098
7151
 
7152
+ .md\:gap-y-4 {
7153
+ row-gap: 1rem;
7154
+ }
7155
+
7099
7156
  .md\:space-x-3 > :not([hidden]) ~ :not([hidden]) {
7100
7157
  --tw-space-x-reverse: 0;
7101
7158
  margin-right: calc(0.75rem * var(--tw-space-x-reverse));
@@ -20,6 +20,7 @@ AsyncAlpine.init(Alpine)
20
20
 
21
21
  .data('socialSharingHandler', ()=> import('components/social_sharing/socialSharingHandler.alpine.js'))
22
22
  .data('inputHandler', ()=> import('components/forms/inputHandler.alpine.js'))
23
+ .data('selectHandler', ()=> import('components/forms/selectHandler.alpine.js'))
23
24
  .start()
24
25
 
25
26
  window.Alpine = Alpine
@@ -1,22 +1,27 @@
1
- export default function inputHandler(element, errorMandatory, errorEmail, isEmail = false, prefilledText = '') {
1
+ export default function inputHandler(element, errorMandatory, type, errorEmail, prefilledText = '') {
2
2
  return {
3
3
  [element]: prefilledText,
4
4
  valid: false,
5
5
  wasFocused: false,
6
6
  isFocused: false,
7
7
  validEmail: false,
8
+ isChecked: false,
8
9
  errorMessage() {
9
- if( Boolean(isEmail)){
10
+ if( type == "email"){
10
11
  return !this.valid ? errorMandatory : errorEmail
11
- } else {
12
+ }
13
+ else {
12
14
  return errorMandatory
13
15
  }
14
16
  },
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)
17
+ hideDescription() {
18
+ switch (type) {
19
+ case "email":
20
+ return Boolean((!this.valid && this.wasFocused && !this.isFocused) || (!this.validEmail && this.wasFocused && !this.isFocused));
21
+ case "checkbox":
22
+ return Boolean(!this.valid && this.wasFocused && !this.isFocused && !this.isChecked);
23
+ default:
24
+ return Boolean(!this.valid && this.wasFocused && !this.isFocused);
20
25
  }
21
26
  },
22
27
  hideError() {
@@ -0,0 +1,15 @@
1
+ export default function selectHandler(element) {
2
+ return {
3
+ [element]: '',
4
+ valid: false,
5
+ wasFocused: false,
6
+ isFocused: false,
7
+ validEmail: false,
8
+ hideDescription() {
9
+ return Boolean(!this.valid && this.wasFocused && !this.isFocused)
10
+ },
11
+ hideError() {
12
+ return Boolean(!this.hideDescription())
13
+ }
14
+ };
15
+ }
@@ -0,0 +1,97 @@
1
+ <div class="relative flex flex-col w-full mb-6 gap-y-3 md:gap-y-4"
2
+ ax-load
3
+ x-data="inputHandler('input{{nextRandom}}','{{_errorMandatory}}','{{_type}}')"
4
+ x-ignore
5
+ >
6
+
7
+ <div class="flex flex-row items-center w-full gap-x-4">
8
+
9
+ <input class="relative self-start flex-shrink-0 w-6 h-6 bg-white border appearance-none cursor-pointer border-blue-science-hex checked:bg-blue-congress-hex checked:border-transparent"
10
+ :class="{' border-blue-science-hex': hideError(),'border-red-700': hideDescription() }"
11
+ @change="validateInput"
12
+ x-model="isChecked"
13
+ id="input{{getRandom}}"
14
+ {{#if _required}}
15
+ @focus="isFocused = true"
16
+ @blur="wasFocused = true; isFocused=false"
17
+ {{/if}}
18
+ type="{{#if _type}}{{_type}}{{/if}}"
19
+ name="{{#if _name}}{{_name}}{{/if}}"
20
+ {{#if _locaKey}}
21
+ title="{{loca _locaKey}}{{#if _required}}*{{/if}}"
22
+ {{else}}
23
+ {{#if _label}}
24
+ title="{{_label}}{{#if _required}}*{{/if}}"
25
+ {{/if}}
26
+ {{/if}}
27
+ {{#if _formField.forHtmlAttribute}}
28
+ value="{{_formField.forHtmlAttribute}}"
29
+ {{else}}
30
+ {{#if _value}}
31
+ value="{{_value}}"
32
+ {{else}}
33
+ value="{{_defaultValue}}"
34
+ {{/if}}
35
+ {{/if}}
36
+ {{#if _required}} required{{/if}}
37
+ {{#unless _multipleChoice}}
38
+ {{#if _required}}
39
+ required
40
+ {{/if}}
41
+ {{/unless}}
42
+ {{#if _formField.rawAsBoolean}}
43
+ checked
44
+ {{else}}
45
+ {{#if _selected}}
46
+ checked
47
+ {{/if}}
48
+ {{/if~}}
49
+ >
50
+
51
+ <label for="input{{getRandom}}" class="items-center justify-center text-xs text-black md:text-sm font-headingSerif ">
52
+ {{#if _hasBody}}
53
+ {{decorator_body}}{{#if _required}}*{{/if}}
54
+ {{else}}
55
+ {{#if _locaKey}}
56
+ {{loca _locaKey}}{{#if _required}}*{{/if}}
57
+ {{else}}
58
+ {{#if _label}}
59
+ {{{_label}}}{{#if _required}}*{{/if}}
60
+ {{/if}}
61
+ {{/if}}
62
+ {{/if}}
63
+ </label>
64
+
65
+ {{#if _required}}
66
+ <div class="flex items-center self-start justify-center">
67
+ <div class="hidden w-5 h-5 font-bold" :class="{'hidden': hideError() }">
68
+ {{> components/base/image/icon _icon="info2" _addClass="w-5 h-5 fill-red-700"}}
69
+ </div>
70
+ </div>
71
+ {{/if}}
72
+
73
+ </div>
74
+
75
+ <div class="flex items-end justify-between h-5 font-heading">
76
+ {{#if _description}}
77
+ <div class="text-xs text-gray-500" {{#if _required}}:class="{'hidden': hideDescription() }"{{/if}}>{{_description}}</div>
78
+ {{/if}}
79
+ {{#if _required}}
80
+ <div class="hidden text-xs text-red-700" :class="{'hidden': hideError()}" x-text="errorMessage"></div>
81
+ {{/if}}
82
+ </div>
83
+
84
+ <div class="hidden" >
85
+ <b>DEBUGG</b>
86
+ <div>isChecked:<span x-text="isChecked" class="font-bold" :class="isChecked ? 'text-green-800' : 'text-red-700'"></span></div>
87
+ <div>isFocused:<span x-text="isFocused" class="font-bold" :class="isFocused ? 'text-green-800' : 'text-red-700'"></span></div>
88
+ <div>wasFocused:<span x-text="wasFocused" class="font-bold" :class="wasFocused ? 'text-green-800' : 'text-red-700'"></span></div>
89
+ <div>valid:<span x-text="valid" class="font-bold" :class="valid ? 'text-green-800' : 'text-red-700'"></span></div>
90
+ <div>hideDescription:<span x-text="hideDescription()" class="font-bold" :class="hideDescription() ? 'text-green-800' : 'text-red-700'"></span></div>
91
+ <div>hideError:<span x-text="hideError()" class="font-bold" :class="hideError() ? 'text-green-800' : 'text-red-700'"></span></div>
92
+ <div>errorMessage:<span x-text="errorMessage" class="font-bold" ></span></div>
93
+ </div>
94
+
95
+
96
+
97
+ </div>
@@ -54,6 +54,7 @@
54
54
  _description=this.description
55
55
  _items=this.options
56
56
  _required=this.isRequired
57
+ _errorMessage="Bitte füllen Sie dieses Pflichtfeld aus"
57
58
  }}
58
59
  {{else if this.type.isChoice}}
59
60
  {{#if this.isGrouped }}
@@ -69,7 +70,7 @@
69
70
 
70
71
  }}
71
72
  {{else}}
72
- {{~> modules/forms/choice
73
+ {{~> components/forms/choice
73
74
  _type=this.type.asString
74
75
  _name=this.name
75
76
  _label=this.label
@@ -78,6 +79,7 @@
78
79
  _value=this.options.[0].value
79
80
  _required=this.isRequired
80
81
  _selected= this.options.[0].isSelected
82
+ _errorMandatory="Bitte füllen Sie dieses Pflichtfeld aus"
81
83
  }}
82
84
  {{/if}}
83
85
  {{else if this.type.isUpload}}
@@ -1,6 +1,6 @@
1
1
  <div class="relative flex flex-col w-full mb-5 {{_wrapperClass}}"
2
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}}')"
3
+ x-data="inputHandler('input{{nextRandom}}','{{_errorMandatory}}',{{#if _isEmail}}'email'{{else}}'{{_type}}'{{/if}},'{{_errorEmail}}','{{#if _formField.forHtmlAttribute}}{{_formField.forHtmlAttribute}}{{else}}{{#if _value}}{{_value}}{{else}}{{_defaultValue}}{{/if}}{{/if}}')"
4
4
  x-ignore
5
5
  >
6
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"
@@ -1,30 +1,70 @@
1
- <div class="relative flex flex-col w-full mb-5 " ax-load=""
2
- x-data="inputHandler('select9339','Bitte wählen Sie eine Option aus', false, '')">
1
+ <div class="relative flex flex-col w-full mb-5 "
2
+ ax-load
3
+ x-data="selectHandler('select{{nextRandom}}')"
4
+ x-ignore
5
+ >
3
6
  <select
4
- class="relative w-full h-12 pt-4 pl-4 text-gray-800 border-blue-500 appearance-none bg- pr-9 peer border-y focus:border-y-2 border-t-transparent focus:outline-none"
5
- :class="{'border-blue-500': hideError(),'border-red-700': hideDescription() }" x-model="select9339"
6
- id="select9339" name="options" title="Wählen Sie eine Option" aria-label="Wählen Sie eine Option" >
7
- <option value="" selected></option>
8
- <option value="1">Option 1</option>
9
- <option value="2">Option 2</option>
10
- <option value="3">Option 3</option>
7
+ class="relative w-full h-12 pt-4 pl-4 text-gray-800 bg-white border-blue-500 appearance-none bg- pr-9 peer border-y focus:border-y-2 border-t-transparent focus:outline-none"
8
+ :class="{'border-blue-500': hideError(),'border-red-700': hideDescription() }"
9
+ x-model="select{{getRandom}}"
10
+ id="select{{getRandom}}"
11
+ title="{{#if _locaKey}}{{loca _locaKey}}{{else}}{{#if _Label}}{{_label}}{{#if _required}}*{{/if}}{{/if}}{{/if}}"
12
+ name="{{#if _name}}{{_name}}{{/if}}"
13
+ {{#if _required}}required{{/if}}
14
+ {{#if _required}}
15
+ @focus="isFocused = true;"
16
+ @blur="wasFocused = true; isFocused=false"
17
+ x-on:change ="select{{getRandom}}.value != '' ? valid = true : valid = false;"
18
+ {{/if}}
19
+ >
20
+ <option class="text-white bg-gray-400" value=""{{#if _required}} disabled{{/if}} selected>
21
+ {{#if _locaKey}}
22
+ {{loca _locaKey}}{{#if _required}}*{{/if}}
23
+ {{else}}
24
+ {{#if _label}}
25
+ {{_label}}{{#if _required}}*{{/if}}
26
+ {{/if}}
27
+ {{/if}}
28
+ </option>
29
+ {{#if _options}}
30
+ {{~#each _options~}}
31
+ <option class="text-black" value="{{this.id}}" {{#if this.isSelected}}selected{{/if}}>{{this.name}}</option>
32
+ {{~/each~}}
33
+ {{else}}
34
+ {{#each _items}}
35
+ <option class="text-black" value="{{this.value}}" {{#if this.selected}}selected{{/if}}>{{this.label}}</option>
36
+ {{/each}}
37
+ {{/if}}
11
38
  </select>
12
- <label for="select9339"
39
+ <label for="select{{getRandom}}"
13
40
  class="absolute pointer-events-none left-[16px] top-0 translate-y-3 translate-x-0 scale-100 text-gray-500
14
-
15
41
  peer-focus:text-blue-500 peer-focus:scale-75 peer-focus:translate-y-0 peer-focus:top-px
16
-
17
-
18
-
19
42
  origin-top-left transform transition-transform
20
- ">
21
-
22
- Wen möchten Sie erreichen?*
43
+ ">
44
+ {{_label}}{{#if _required}}*{{/if}}
23
45
  </label>
24
- <!-- Optional custom dropdown arrow icon -->
25
- <div class="absolute transform -translate-y-1/2 pointer-events-none right-3 top-1/2">
26
- <svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
27
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
28
- </svg>
46
+ <div class="flex items-end justify-between h-5 font-heading">
47
+ {{#if _description}}
48
+ <div class="pl-4 text-xs text-gray-500 min-h- " {{#if _required}}:class="{'hidden': !valid && wasFocused && !isFocused}"{{/if}}>{{_description}}</div>
49
+ {{/if}}
50
+ {{#if _required}}
51
+ <div class="hidden pl-4 text-xs text-red-700" :class="{'hidden': valid || !wasFocused || isFocused}" >{{_errorMessage}}</div>
52
+ {{/if}}
29
53
  </div>
54
+ <div class="absolute right-0 p-4 py-3 transform border-l peer-focus:border-r peer-focus:border-l-0 pointer-events-none top-1.5 peer-focus:rotate-180">
55
+ {{> components/base/image/icon _icon="arrow-down" _addClass="w-3 h-3 fill-blue-500 dark:fill-text-dark "}}
56
+ </div>
57
+ <div class="hidden">
58
+ <div class="px-4 py-2 font-bold text-white bg-red-500 rounded-t">
59
+ DEBUG
60
+ </div>
61
+ <div class="px-4 py-3 text-red-700 bg-red-100 border border-t-0 border-red-400 rounded-b">
62
+ <div>isFocused:<span x-text="isFocused" class="font-bold" :class="isFocused ? 'text-green-800' : 'text-red-700'"></span></div>
63
+ <div>wasFocused:<span x-text="wasFocused" class="font-bold" :class="wasFocused ? 'text-green-800' : 'text-red-700'"></span></div>
64
+ <div>valid:<span x-text="valid" class="font-bold" :class="valid ? 'text-green-800' : 'text-red-700'"></span></div>
65
+ <div>hideDescription:<span x-text="hideDescription()" class="font-bold" :class="hideDescription() ? 'text-green-800' : 'text-red-700'"></span></div>
66
+ <div>hideError:<span x-text="hideError()" class="font-bold" :class="hideError() ? 'text-green-800' : 'text-red-700'"></span></div>
67
+ <div>select:<span x-text="select{{getRandom}}" class="font-bold" ></span></div>
68
+ </div>
69
+ </div>
30
70
  </div>
@@ -0,0 +1,97 @@
1
+ <div class="relative flex flex-col w-full mb-6 gap-y-3 md:gap-y-4"
2
+ ax-load
3
+ x-data="inputHandler('input{{nextRandom}}','{{_errorMandatory}}','{{_type}}')"
4
+ x-ignore
5
+ >
6
+
7
+ <div class="flex flex-row items-center w-full gap-x-4">
8
+
9
+ <input class="relative self-start flex-shrink-0 w-6 h-6 bg-white border appearance-none cursor-pointer border-blue-science-hex checked:bg-blue-congress-hex checked:border-transparent"
10
+ :class="{' border-blue-science-hex': hideError(),'border-red-700': hideDescription() }"
11
+ @change="validateInput"
12
+ x-model="isChecked"
13
+ id="input{{getRandom}}"
14
+ {{#if _required}}
15
+ @focus="isFocused = true"
16
+ @blur="wasFocused = true; isFocused=false"
17
+ {{/if}}
18
+ type="{{#if _type}}{{_type}}{{/if}}"
19
+ name="{{#if _name}}{{_name}}{{/if}}"
20
+ {{#if _locaKey}}
21
+ title="{{loca _locaKey}}{{#if _required}}*{{/if}}"
22
+ {{else}}
23
+ {{#if _label}}
24
+ title="{{_label}}{{#if _required}}*{{/if}}"
25
+ {{/if}}
26
+ {{/if}}
27
+ {{#if _formField.forHtmlAttribute}}
28
+ value="{{_formField.forHtmlAttribute}}"
29
+ {{else}}
30
+ {{#if _value}}
31
+ value="{{_value}}"
32
+ {{else}}
33
+ value="{{_defaultValue}}"
34
+ {{/if}}
35
+ {{/if}}
36
+ {{#if _required}} required{{/if}}
37
+ {{#unless _multipleChoice}}
38
+ {{#if _required}}
39
+ required
40
+ {{/if}}
41
+ {{/unless}}
42
+ {{#if _formField.rawAsBoolean}}
43
+ checked
44
+ {{else}}
45
+ {{#if _selected}}
46
+ checked
47
+ {{/if}}
48
+ {{/if~}}
49
+ >
50
+
51
+ <label for="input{{getRandom}}" class="items-center justify-center text-xs text-black md:text-sm font-headingSerif ">
52
+ {{#if _hasBody}}
53
+ {{decorator_body}}{{#if _required}}*{{/if}}
54
+ {{else}}
55
+ {{#if _locaKey}}
56
+ {{loca _locaKey}}{{#if _required}}*{{/if}}
57
+ {{else}}
58
+ {{#if _label}}
59
+ {{{_label}}}{{#if _required}}*{{/if}}
60
+ {{/if}}
61
+ {{/if}}
62
+ {{/if}}
63
+ </label>
64
+
65
+ {{#if _required}}
66
+ <div class="flex items-center self-start justify-center">
67
+ <div class="hidden w-5 h-5 font-bold" :class="{'hidden': hideError() }">
68
+ {{> components/base/image/icon _icon="info2" _addClass="w-5 h-5 fill-red-700"}}
69
+ </div>
70
+ </div>
71
+ {{/if}}
72
+
73
+ </div>
74
+
75
+ <div class="flex items-end justify-between h-5 font-heading">
76
+ {{#if _description}}
77
+ <div class="text-xs text-gray-500" {{#if _required}}:class="{'hidden': hideDescription() }"{{/if}}>{{_description}}</div>
78
+ {{/if}}
79
+ {{#if _required}}
80
+ <div class="hidden text-xs text-red-700" :class="{'hidden': hideError()}" x-text="errorMessage"></div>
81
+ {{/if}}
82
+ </div>
83
+
84
+ <div class="hidden" >
85
+ <b>DEBUGG</b>
86
+ <div>isChecked:<span x-text="isChecked" class="font-bold" :class="isChecked ? 'text-green-800' : 'text-red-700'"></span></div>
87
+ <div>isFocused:<span x-text="isFocused" class="font-bold" :class="isFocused ? 'text-green-800' : 'text-red-700'"></span></div>
88
+ <div>wasFocused:<span x-text="wasFocused" class="font-bold" :class="wasFocused ? 'text-green-800' : 'text-red-700'"></span></div>
89
+ <div>valid:<span x-text="valid" class="font-bold" :class="valid ? 'text-green-800' : 'text-red-700'"></span></div>
90
+ <div>hideDescription:<span x-text="hideDescription()" class="font-bold" :class="hideDescription() ? 'text-green-800' : 'text-red-700'"></span></div>
91
+ <div>hideError:<span x-text="hideError()" class="font-bold" :class="hideError() ? 'text-green-800' : 'text-red-700'"></span></div>
92
+ <div>errorMessage:<span x-text="errorMessage" class="font-bold" ></span></div>
93
+ </div>
94
+
95
+
96
+
97
+ </div>
@@ -54,6 +54,7 @@
54
54
  _description=this.description
55
55
  _items=this.options
56
56
  _required=this.isRequired
57
+ _errorMessage="Bitte füllen Sie dieses Pflichtfeld aus"
57
58
  }}
58
59
  {{else if this.type.isChoice}}
59
60
  {{#if this.isGrouped }}
@@ -69,7 +70,7 @@
69
70
 
70
71
  }}
71
72
  {{else}}
72
- {{~> modules/forms/choice
73
+ {{~> components/forms/choice
73
74
  _type=this.type.asString
74
75
  _name=this.name
75
76
  _label=this.label
@@ -78,6 +79,7 @@
78
79
  _value=this.options.[0].value
79
80
  _required=this.isRequired
80
81
  _selected= this.options.[0].isSelected
82
+ _errorMandatory="Bitte füllen Sie dieses Pflichtfeld aus"
81
83
  }}
82
84
  {{/if}}
83
85
  {{else if this.type.isUpload}}
@@ -1,6 +1,6 @@
1
1
  <div class="relative flex flex-col w-full mb-5 {{_wrapperClass}}"
2
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}}')"
3
+ x-data="inputHandler('input{{nextRandom}}','{{_errorMandatory}}',{{#if _isEmail}}'email'{{else}}'{{_type}}'{{/if}},'{{_errorEmail}}','{{#if _formField.forHtmlAttribute}}{{_formField.forHtmlAttribute}}{{else}}{{#if _value}}{{_value}}{{else}}{{_defaultValue}}{{/if}}{{/if}}')"
4
4
  x-ignore
5
5
  >
6
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"