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
@@ -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>
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.101.3",
9
+ "version": "1.102.1",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "storybook dev -p 6006 public",
@@ -454,4 +454,21 @@
454
454
  @apply top-px scale-75 translate-y-0
455
455
  }
456
456
 
457
+ select:has(option:checked[value=""]) {
458
+ @apply text-transparent
459
+ }
460
+
461
+ input[type="checkbox"]:checked::after {
462
+ position: absolute;
463
+ content: '';
464
+ width: 15px;
465
+ height: 6px;
466
+ background: transparent;
467
+ top: 7px;
468
+ left: 3px;
469
+ border: 3px solid white;
470
+ border-top: none;
471
+ border-right: none;
472
+ transform: rotate(-45deg);
473
+ }
457
474
  }
@@ -0,0 +1,18 @@
1
+ {
2
+ "fields":[
3
+ {
4
+ "@->jsoninclude": "forms/form_fields.inc.json",
5
+ "@->contentpath": "checkbox"
6
+ },
7
+ {
8
+ "@->jsoninclude": "forms/form_fields.inc.json",
9
+ "@->contentpath": "checkbox",
10
+ "@->overrides": [
11
+ {
12
+ "@->contentpath": "label",
13
+ "@->value": "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."
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ }
@@ -1,104 +1,144 @@
1
1
  {
2
- "input-text-vorname":
3
- {
4
- "type":{
5
- "isText":true,
6
- "asString":"text"
2
+ "input-text-vorname": {
3
+ "type": {
4
+ "isText": true,
5
+ "asString": "text"
7
6
  },
8
- "name":"vorname",
9
- "label":"Vorname",
10
- "description":"Das ist der Beschreibungstext von Vorname",
11
- "defaultValue":"",
12
- "isHidden":false,
13
- "isRequired":false
14
-
7
+ "name": "vorname",
8
+ "label": "Vorname",
9
+ "description": "Das ist der Beschreibungstext von Vorname",
10
+ "defaultValue": "",
11
+ "isHidden": false,
12
+ "isRequired": false
15
13
  },
16
- "input-text-vorname-required":
17
- {
18
- "type":{
19
- "isText":true,
20
- "asString":"text"
14
+ "input-text-vorname-required": {
15
+ "type": {
16
+ "isText": true,
17
+ "asString": "text"
21
18
  },
22
- "name":"vorname",
23
- "label":"Vorname",
24
- "description":"Das ist der Beschreibungstext (*Pflichtfeld)",
25
- "defaultValue":"",
26
- "isHidden":false,
27
- "isRequired":true,
28
- "maxLength":"140"
19
+ "name": "vorname",
20
+ "label": "Vorname",
21
+ "description": "Das ist der Beschreibungstext (*Pflichtfeld)",
22
+ "defaultValue": "",
23
+ "isHidden": false,
24
+ "isRequired": true,
25
+ "maxLength": "140"
29
26
  },
30
- "input-text-nachname-required":
31
- {
32
- "type":{
33
- "isText":true,
34
- "asString":"text"
27
+ "input-text-nachname-required": {
28
+ "type": {
29
+ "isText": true,
30
+ "asString": "text"
35
31
  },
36
- "name":"nachname",
37
- "label":"Nachname",
38
- "description":"",
39
- "defaultValue":"",
40
- "isHidden":false,
41
- "isRequired":true,
42
- "maxLength":"140"
32
+ "name": "nachname",
33
+ "label": "Nachname",
34
+ "description": "",
35
+ "defaultValue": "",
36
+ "isHidden": false,
37
+ "isRequired": true,
38
+ "maxLength": "140"
43
39
  },
44
- "input-text-vorname-prefilled":
45
- {
46
- "type":{
47
- "isText":true,
48
- "asString":"text"
40
+ "input-text-vorname-prefilled": {
41
+ "type": {
42
+ "isText": true,
43
+ "asString": "text"
49
44
  },
50
- "name":"nachname",
51
- "label":"Nachname",
52
- "description":"Das ist der Beschreibungstext von Nachname",
53
- "defaultValue":"Hier steht schon was",
54
- "isHidden":false,
55
- "isRequired":false,
56
- "maxLength":"140"
45
+ "name": "nachname",
46
+ "label": "Nachname",
47
+ "description": "Das ist der Beschreibungstext von Nachname",
48
+ "defaultValue": "Hier steht schon was",
49
+ "isHidden": false,
50
+ "isRequired": false,
51
+ "maxLength": "140"
57
52
  },
58
- "input-email":
59
- {
60
- "type":{
61
- "isText":true,
62
- "isEmail":true,
63
- "asString":"email"
53
+ "input-email": {
54
+ "type": {
55
+ "isText": true,
56
+ "isEmail": true,
57
+ "asString": "email"
64
58
  },
65
- "name":"email",
66
- "label":"Email",
67
- "description":"Das ist der Beschreibungstext von Email",
68
- "defaultValue":"",
69
- "isHidden":false,
70
- "isRequired":true,
71
- "maxLength":"140"
59
+ "name": "email",
60
+ "label": "Email",
61
+ "description": "Das ist der Beschreibungstext von Email",
62
+ "defaultValue": "",
63
+ "isHidden": false,
64
+ "isRequired": true,
65
+ "maxLength": "140"
72
66
  },
73
- "textarea":
67
+ "textarea": {
68
+ "type": {
69
+ "isTextarea": true,
70
+ "asString": "textarea"
71
+ },
72
+ "name": "textarea",
73
+ "label": "Textarea",
74
+ "description": "Das ist der Beschreibungstext von Textarea",
75
+ "defaultValue": "",
76
+ "isHidden": false,
77
+ "isRequired": true,
78
+ "maxLength": "300",
79
+ "columns": "30",
80
+ "rows": "10",
81
+ "counter": true
82
+ },
83
+ "checkbox":
74
84
  {
85
+ "isGrouped":false,
75
86
  "type":{
76
- "isTextarea":true,
77
- "asString":"textarea"
87
+ "isChoice":true,
88
+ "asString":"checkbox"
78
89
  },
79
- "name":"textarea",
80
- "label":"Textarea",
81
- "description":"Das ist der Beschreibungstext von Textarea",
82
- "defaultValue":"",
83
- "isHidden":false,
90
+ "name":"checkbox",
91
+ "label":"Ich bin damit einverstanden.",
92
+ "isMeta":false,
93
+ "description":"Das ist der Beschreibungstext von Checkbox",
84
94
  "isRequired":true,
85
- "maxLength":"300",
86
- "columns":"30",
87
- "rows":"10",
88
- "counter":true
95
+ "options":[
96
+ {
97
+ "value":"value0",
98
+ "isSelected":false
99
+ },
100
+ {
101
+ "value":"value1",
102
+ "isSelected":false
103
+ }
104
+ ]
89
105
  },
90
- "select":
91
- {
92
- "type":{
93
- "isSelect":true,
94
- "asString":"select"
106
+ "select": {
107
+ "type": {
108
+ "isSelect": true,
109
+ "asString": "select"
95
110
  },
96
- "name":"Select Name",
97
- "label":"Select Label",
98
- "description":"Das ist der Beschreibungstext von Select",
99
- "defaultValue":"",
100
- "isHidden":false,
101
- "isRequired":false
102
-
103
- }
104
- }
111
+ "name": "Select Name",
112
+ "label": "Wen möchten Sie erreichen?",
113
+ "description": "Das ist der Beschreibungstext von Select",
114
+ "defaultValue": "",
115
+ "isHidden": false,
116
+ "isRequired": true,
117
+ "options": [
118
+ {
119
+ "id": "option1",
120
+ "value": "option1",
121
+ "selected": false,
122
+ "label": "Option 1"
123
+ },
124
+ {
125
+ "id": "option2",
126
+ "value": "option2",
127
+ "selected": false,
128
+ "label": "Option 2"
129
+ },
130
+ {
131
+ "id": "option3",
132
+ "value": "option3",
133
+ "selected": false,
134
+ "label": "Option 3"
135
+ },
136
+ {
137
+ "id": "option4",
138
+ "value": "option4",
139
+ "selected": false,
140
+ "label": "Option 4"
141
+ }
142
+ ]
143
+ }
144
+ }
@@ -1,8 +1,18 @@
1
1
  {
2
- "fields":[
3
- {
4
- "@->jsoninclude": "forms/form_fields.inc.json",
5
- "@->contentpath": "select"
6
- }
2
+ "fields": [
3
+ {
4
+ "@->jsoninclude": "forms/form_fields.inc.json",
5
+ "@->contentpath": "select"
6
+ },
7
+ {
8
+ "@->jsoninclude": "forms/form_fields.inc.json",
9
+ "@->contentpath": "select",
10
+ "@->overrides": [
11
+ {
12
+ "@->contentpath": "isRequired",
13
+ "@->value": false
14
+ }
7
15
  ]
16
+ }
17
+ ]
8
18
  }
@@ -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
@@ -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}}
@@ -0,0 +1 @@
1
+ {"fields":[{"isGrouped":false,"type":{"isChoice":true,"asString":"checkbox"},"name":"checkbox","label":"Ich bin damit einverstanden.","isMeta":false,"description":"Das ist der Beschreibungstext von Checkbox","isRequired":true,"options":[{"value":"value0","isSelected":false},{"value":"value1","isSelected":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,"options":[{"value":"value0","isSelected":false},{"value":"value1","isSelected":false}]}]}
@@ -1 +1 @@
1
- {"fields":[{"type":{"isSelect":true,"asString":"select"},"name":"Select Name","label":"Select Label","description":"Das ist der Beschreibungstext von Select","defaultValue":"","isHidden":false,"isRequired":false}]}
1
+ {"fields":[{"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"}]},{"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":false,"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"}]}]}
@@ -1,5 +1,5 @@
1
1
  import { ArgTypes, Meta, Story, Canvas } from '@storybook/blocks'
2
- import * as formStories from './form.stories'
2
+ import * as formStories from './form_textfields.stories'
3
3
 
4
4
  <Meta of={formStories} />
5
5
 
@@ -0,0 +1,34 @@
1
+
2
+ import checkboxJson from './fixtures/form_checkbox.json'
3
+
4
+ const handlebars = require('hrHandlebars')
5
+
6
+
7
+ export default {
8
+ title: 'Komponenten/Formulare',
9
+ decorators: [
10
+ (Story) => {
11
+ return `<div class="grid grid-page">
12
+ <div class="grid bg-white grid-article">
13
+ ${Story()}
14
+ </div>
15
+ </div>`
16
+ },
17
+ ],
18
+ }
19
+ const Template = (args) => {
20
+ let hbsTemplate = handlebars.compile(`
21
+ {{#>components/forms/backgroundBox }}
22
+ <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" >
23
+ {{> components/forms/fields }}
24
+ </form>
25
+ {{/components/forms/backgroundBox }}
26
+ `)
27
+ return hbsTemplate({ ...args })
28
+ }
29
+
30
+ export const Checkbox = {
31
+ render: Template.bind({}),
32
+ name: 'Checkbox',
33
+ args: checkboxJson,
34
+ }
@@ -0,0 +1,34 @@
1
+
2
+ import selectJson from './fixtures/form_select.json'
3
+
4
+ const handlebars = require('hrHandlebars')
5
+
6
+
7
+ export default {
8
+ title: 'Komponenten/Formulare',
9
+ decorators: [
10
+ (Story) => {
11
+ return `<div class="grid grid-page">
12
+ <div class="grid bg-white grid-article">
13
+ ${Story()}
14
+ </div>
15
+ </div>`
16
+ },
17
+ ],
18
+ }
19
+ const Template = (args) => {
20
+ let hbsTemplate = handlebars.compile(`
21
+ {{#>components/forms/backgroundBox }}
22
+ <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" >
23
+ {{> components/forms/fields }}
24
+ </form>
25
+ {{/components/forms/backgroundBox }}
26
+ `)
27
+ return hbsTemplate({ ...args })
28
+ }
29
+
30
+ export const Select = {
31
+ render: Template.bind({}),
32
+ name: 'Select',
33
+ args: selectJson,
34
+ }
@@ -4,8 +4,6 @@ import inputMandatoryJson from './fixtures/form_input_mandatory.json'
4
4
  import inputPrefilledJson from './fixtures/form_input_prefilled.json'
5
5
  import textareaJson from './fixtures/form_textarea.json'
6
6
  import emailJson from './fixtures/form_email.json'
7
- import selectJson from './fixtures/form_select.json'
8
-
9
7
 
10
8
  const handlebars = require('hrHandlebars')
11
9
 
@@ -69,8 +67,3 @@ export const Textarea = {
69
67
  name: 'Textarea',
70
68
  args: textareaJson,
71
69
  }
72
- export const Select = {
73
- render: Template.bind({}),
74
- name: 'Select',
75
- args: selectJson,
76
- }