@openeuropa/bcl-data-form 1.10.8 → 1.10.9

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 (2) hide show
  1. package/data--all-inputs.js +196 -0
  2. package/package.json +2 -2
@@ -0,0 +1,196 @@
1
+ const { DrupalAttribute } = require("drupal-attribute");
2
+
3
+ const singleSelectOptions = [
4
+ { value: "", label: "Choose an option", hidden: true },
5
+ { value: "option-1", label: "First option" },
6
+ { value: "option-2", label: "Second option", selected: true },
7
+ { value: "option-3", label: "Third option" },
8
+ ];
9
+
10
+ const multiSelectOptions = [
11
+ { value: "alpha", label: "Alpha" },
12
+ { value: "beta", label: "Beta", selected: true },
13
+ { value: "gamma", label: "Gamma", selected: true },
14
+ { value: "delta", label: "Delta" },
15
+ ];
16
+
17
+ const buildRadioAttributes = () =>
18
+ new DrupalAttribute().setAttribute("name", "validRadios");
19
+
20
+ module.exports = {
21
+ attributes: new DrupalAttribute()
22
+ .addClass(["needs-validation", "row", "gy-4"])
23
+ .setAttribute("novalidate", true)
24
+ .setAttribute("onsubmit", "return false;"),
25
+ items: [
26
+ [
27
+ {
28
+ wrapper_classes: "col-12 col-md-6",
29
+ input_type: "text",
30
+ label: "Text input",
31
+ id: "validTextInput",
32
+ placeholder: "Type something",
33
+ },
34
+ {
35
+ wrapper_classes: "col-12 col-md-6",
36
+ input_type: "text",
37
+ label: "Text input",
38
+ id: "validTextInput",
39
+ valid: true,
40
+ placeholder: "Type something",
41
+ },
42
+ {
43
+ wrapper_classes: "col-12 col-md-6",
44
+ input_type: "email",
45
+ label: "Email input",
46
+ id: "validEmailInput",
47
+ invalid: true,
48
+ placeholder: "name@example.com",
49
+ },
50
+ {
51
+ wrapper_classes: "col-12 col-md-6",
52
+ input_type: "password",
53
+ label: "Password input",
54
+ id: "validPasswordInput",
55
+ },
56
+ {
57
+ wrapper_classes: "col-12 col-md-6",
58
+ input_type: "search",
59
+ label: "Search input",
60
+ id: "validSearchInput",
61
+ placeholder: "Search term",
62
+ },
63
+ {
64
+ wrapper_classes: "col-12 col-md-6",
65
+ input_type: "tel",
66
+ label: "Telephone input",
67
+ id: "validTelInput",
68
+ placeholder: "+32 123 45 67",
69
+ },
70
+ {
71
+ wrapper_classes: "col-12 col-md-6",
72
+ input_type: "number",
73
+ label: "Number input",
74
+ id: "validNumberInput",
75
+ },
76
+ {
77
+ wrapper_classes: "col-12 col-md-6",
78
+ input_type: "url",
79
+ label: "URL input",
80
+ id: "validUrlInput",
81
+ placeholder: "https://example.com",
82
+ },
83
+ {
84
+ wrapper_classes: "col-12 col-md-6",
85
+ input_type: "date",
86
+ label: "Date input",
87
+ id: "validDateInput",
88
+ },
89
+ {
90
+ wrapper_classes: "col-12 col-md-6",
91
+ input_type: "time",
92
+ label: "Time input",
93
+ id: "validTimeInput",
94
+ },
95
+ {
96
+ wrapper_classes: "col-12 col-md-6",
97
+ input_type: "file",
98
+ label: "File input",
99
+ id: "validFileInput",
100
+ },
101
+ {
102
+ wrapper_classes: "col-12",
103
+ input_type: "range",
104
+ label: "Range input",
105
+ id: "validRangeInput",
106
+ attributes: new DrupalAttribute()
107
+ .setAttribute("min", 0)
108
+ .setAttribute("max", 100)
109
+ .setAttribute("value", 42),
110
+ },
111
+ {
112
+ wrapper_classes: "col-12",
113
+ type: "textarea",
114
+ label: "Textarea",
115
+ id: "validTextarea",
116
+ text: "Multiline content",
117
+ rows: 4,
118
+ },
119
+ {
120
+ wrapper_classes: "col-12 col-md-6",
121
+ type: "select",
122
+ label: "Select",
123
+ id: "validSelect",
124
+ options: singleSelectOptions,
125
+ },
126
+ {
127
+ wrapper_classes: "col-12 col-md-6",
128
+ type: "select",
129
+ label: "Valid Select",
130
+ valid: true,
131
+ id: "validSelect",
132
+ options: singleSelectOptions,
133
+ },
134
+ {
135
+ wrapper_classes: "col-12 col-md-6",
136
+ type: "select",
137
+ label: "Invalid Select",
138
+ invalid: true,
139
+ id: "validSelect",
140
+ options: singleSelectOptions,
141
+ },
142
+ {
143
+ wrapper_classes: "col-12 col-md-6",
144
+ type: "select",
145
+ label: "Disabled Select",
146
+ disabled: true,
147
+ id: "validSelect",
148
+ options: singleSelectOptions,
149
+ },
150
+ {
151
+ wrapper_classes: "col-12 col-md-6",
152
+ type: "select",
153
+ label: "Multiple select",
154
+ id: "validMultiSelect",
155
+ multiple: true,
156
+ options: multiSelectOptions,
157
+ },
158
+ {
159
+ wrapper_classes: "col-12 col-md-6",
160
+ input_type: "checkbox",
161
+ label: "Checkbox",
162
+ id: "validCheckbox",
163
+ checked: true,
164
+ },
165
+ {
166
+ wrapper_classes: "col-12 col-md-6",
167
+ input_type: "checkbox",
168
+ label: "Switch",
169
+ id: "validSwitch",
170
+ checked: true,
171
+ switch: true,
172
+ },
173
+ {
174
+ wrapper_classes: "col-12 col-md-6",
175
+ input_type: "radio",
176
+ label: "Radio option A",
177
+ id: "validRadioA",
178
+ checked: true,
179
+ attributes: buildRadioAttributes(),
180
+ },
181
+ {
182
+ wrapper_classes: "col-12 col-md-6",
183
+ input_type: "radio",
184
+ label: "Radio option B",
185
+ id: "validRadioB",
186
+ attributes: buildRadioAttributes(),
187
+ },
188
+ ],
189
+ ],
190
+ submit: {
191
+ wrapper: "col-12",
192
+ label: "Submit",
193
+ type: "submit",
194
+ variant: "primary",
195
+ },
196
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@openeuropa/bcl-data-form",
3
3
  "author": "European Commission",
4
4
  "license": "EUPL-1.2",
5
- "version": "1.10.8",
5
+ "version": "1.10.9",
6
6
  "description": "OE - BCL data form",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -21,5 +21,5 @@
21
21
  "design-system",
22
22
  "twig"
23
23
  ],
24
- "gitHead": "9c2e64443ae179948cbf748c41d438af7a0f2421"
24
+ "gitHead": "cb9864341bfc98404071520d61568bd18e17e1fe"
25
25
  }