comand-component-library 3.1.66 → 3.1.69

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,52 +13,72 @@
13
13
 
14
14
  <!-- begin form-elements -->
15
15
  <div class="flex-container">
16
- <!-- begin CmdFormElement -->
16
+ <!-- begin CmdFormElement for first input -->
17
17
  <CmdFormElement
18
+ v-if="cmdFormElementInput1.show"
18
19
  element="input"
19
- type="text"
20
- :labelText="getMessage('cmdsitesearch.labeltext.what_to_search')"
21
- :placeholder="getMessage('cmdsitesearch.placeholder.what_to_search')"
20
+ :type="cmdFormElementInput1.type"
21
+ :show-label="cmdFormElementInput1.showLabel"
22
+ :labelText="cmdFormElementInput1.labelText"
23
+ :placeholder="cmdFormElementInput1.placeholder"
24
+ v-model="searchValue1"
22
25
  />
23
- <!-- end CmdFormElement -->
26
+ <!-- end CmdFormElement for first input -->
24
27
 
25
- <!-- begin CmdFormElement -->
26
- <CmdFormElement
27
- element="input"
28
- type="text"
29
- :labelText="getMessage('cmdsitesearch.labeltext.where_to_search')"
30
- :placeholder="getMessage('cmdsitesearch.placeholder.where_to_search')"
31
- />
32
- <!-- end CmdFormElement -->
28
+ <div class="flex-container no-gap">
29
+ <!-- begin CmdFormElement for second input -->
30
+ <CmdFormElement
31
+ v-if="cmdFormElementInput2.show"
32
+ element="input"
33
+ :type="cmdFormElementInput2.type"
34
+ :show-label="cmdFormElementInput2.showLabel"
35
+ :labelText="cmdFormElementInput2.labelText"
36
+ :placeholder="cmdFormElementInput2.placeholder"
37
+ v-model="searchValue2"
38
+ />
39
+ <!-- end CmdFormElement for second input -->
33
40
 
34
- <!-- begin CmdFormElement -->
41
+ <!-- begin CmdFormElement for radius -->
42
+ <CmdFormElement
43
+ v-if="cmdFormElementRadius.show"
44
+ element="select"
45
+ class="no-flex"
46
+ v-model="radius"
47
+ :show-label="cmdFormElementRadius.showLabel"
48
+ :labelText="cmdFormElementRadius.labelText"
49
+ :select-options="cmdFormElementRadius.selectOptions"
50
+ />
51
+ <!-- end CmdFormElement for radius -->
52
+ </div>
53
+
54
+ <!-- begin CmdFormElement for search-button -->
35
55
  <CmdFormElement
36
56
  element="button"
37
- :buttonText="buttonText"
38
- :buttonIcon="{iconClass: 'icon-search', iconPosition: 'before'}"
39
- @click="$emit('click', $event)"
57
+ :nativeButton="cmdFormElementSearchButton"
58
+ @click="onSearchButtonClick"
40
59
  aria-live="assertive"
41
60
  />
42
- <!-- end CmdFormElement -->
61
+ <!-- end CmdFormElement for search-button -->
62
+
43
63
  </div>
44
64
  <!-- end form-elements -->
45
65
 
46
66
  <!-- begin filters -->
47
- <template v-if="useFilters">
67
+ <template v-if="cmdFakeSelect?.show">
48
68
  <a href="#" @click.prevent="showFilters = !showFilters">
49
69
  <span :class="showFilters ? 'icon-single-arrow-up' : 'icon-single-arrow-down'"></span>
50
70
  <span v-if="showFilters">{{ getMessage("cmdsitesearch.hide_filter_options") }}</span>
51
71
  <span v-else>{{ getMessage("cmdsitesearch.show_filter_options") }}</span>
52
72
  </a>
53
73
  <transition name="fade">
54
- <div v-if="showFilters && listOfFilters.length" class="flex-container no-flex" aria-expanded="true">
74
+ <div v-if="showFilters && cmdFakeSelect?.selectData.length" class="flex-container no-flex" aria-expanded="true">
55
75
  <!-- begin CmdFakeSelect -->
56
76
  <CmdFakeSelect
57
- :selectData="listOfFilters"
58
- v-model="fakeSelectFilters"
59
- defaultOptionName="Select filters:"
60
- type="checkboxOptions"
61
- labelText="Filters:"
77
+ :selectData="cmdFakeSelect?.selectData"
78
+ v-model="searchFilters"
79
+ :defaultOptionName="cmdFakeSelect?.defaultOptionName"
80
+ :type="cmdFakeSelect?.type"
81
+ :labelText="cmdFakeSelect?.labelText"
62
82
  />
63
83
  <!-- end CmdFakeSelect -->
64
84
  </div>
@@ -66,7 +86,7 @@
66
86
  </template>
67
87
  <!-- end filters -->
68
88
  </fieldset>
69
- <CmdFormFilters v-if="useFilters" v-model="fakeSelectFilters" :selectedOptionsName="getOptionName"/>
89
+ <CmdFormFilters v-if="cmdFakeSelect?.show" v-model="searchFilters" :selectedOptionsName="getOptionName"/>
70
90
  </template>
71
91
 
72
92
  <script>
@@ -81,6 +101,13 @@ import CmdFormElement from "./CmdFormElement"
81
101
  import CmdFormFilters from "./CmdFormFilters"
82
102
 
83
103
  export default {
104
+ emits: [
105
+ "search",
106
+ "update:modelValueInput1",
107
+ "update:modelValueInput2",
108
+ "update:modelValueRadius",
109
+ "update:modelValueSearchFilters"
110
+ ],
84
111
  name: "CmdBoxSiteSearch",
85
112
  mixins: [I18n, DefaultMessageProperties],
86
113
  components: {
@@ -91,34 +118,45 @@ export default {
91
118
  },
92
119
  data() {
93
120
  return {
94
- showFilters: false,
95
- fakeSelectFilters: []
121
+ showFilters: false
96
122
  }
97
123
  },
98
124
  props: {
99
125
  /**
100
- * the native modelValue for v-model given from outside for pre-sets
126
+ * custom modelValue for first input-field
101
127
  */
102
- modelValue: {
103
- type: Array,
128
+ modelValueInput1: {
129
+ type: String,
104
130
  required: false
105
131
  },
106
132
  /**
107
- * toggle use of filters (must configured)
133
+ * custom modelValue for second input-field
108
134
  */
109
- useFilters: {
110
- type: Boolean,
111
- default: true
135
+ modelValueInput2: {
136
+ type: String,
137
+ required: false
112
138
  },
113
139
  /**
114
- * set list of filters
115
- *
116
- * useFilters-property must be activated
140
+ * custom modelValue for radius
141
+ */
142
+ modelValueRadius: {
143
+ type: [String, Number],
144
+ required: false
145
+ },
146
+ /**
147
+ * custom modelValue for search-filters
117
148
  */
118
- listOfFilters: {
149
+ modelValueSearchFilters: {
119
150
  type: Array,
120
151
  required: false
121
152
  },
153
+ /**
154
+ * toggle use of filters (must configured)
155
+ */
156
+ useFilters: {
157
+ type: Boolean,
158
+ default: true
159
+ },
122
160
  /**
123
161
  * text for legend
124
162
  *
@@ -150,31 +188,168 @@ export default {
150
188
  cmdCustomHeadline: {
151
189
  type: Object,
152
190
  required: false
191
+ },
192
+ /**
193
+ * properties for CmdFormElement-component first search-field
194
+ */
195
+ cmdFormElementInput1: {
196
+ type: Object,
197
+ default() {
198
+ return {
199
+ show: true,
200
+ type: "text",
201
+ showLabel: true,
202
+ labelText: "What do you like to search for?",
203
+ placeholder: "Search"
204
+ }
205
+ }
206
+ },
207
+ /**
208
+ * properties for CmdFormElement-component for second search-field
209
+ */
210
+ cmdFormElementInput2: {
211
+ type: Object,
212
+ default() {
213
+ return {
214
+ show: true,
215
+ type: "text",
216
+ showLabel: true,
217
+ labelText: "Where do you like to search?",
218
+ placeholder: "City, Zip"
219
+ }
220
+ }
221
+ },
222
+ /**
223
+ * properties for CmdFormElement-component for radius
224
+ */
225
+ cmdFormElementRadius: {
226
+ type: Object,
227
+ default() {
228
+ return {
229
+ show: true,
230
+ showLabel: true,
231
+ labelText: "Radius",
232
+ selectOptions: [
233
+ {
234
+ text: "5 Km",
235
+ value: 5
236
+ },
237
+ {
238
+ text: "10 Km",
239
+ value: 10
240
+ },
241
+ {
242
+ text: "15 Km",
243
+ value: 15
244
+ },
245
+ {
246
+ text: "50 Km",
247
+ value: 50
248
+ },
249
+ {
250
+ text: "100 Km",
251
+ value: 100
252
+ }
253
+ ]
254
+ }
255
+ }
256
+ },
257
+ /**
258
+ * properties for CmdFormElement-component for search-button
259
+ */
260
+ cmdFormElementSearchButton: {
261
+ type: Object,
262
+ default() {
263
+ return {
264
+ icon: {
265
+ show: true,
266
+ position: "before",
267
+ iconClass: "icon-search"
268
+ },
269
+ text: "Search"
270
+ }
271
+ }
272
+ },
273
+ /**
274
+ * properties for CmdFakeSelect-component for filters
275
+ */
276
+ cmdFakeSelect: {
277
+ type: Object,
278
+ required: false
153
279
  }
154
280
  },
155
281
  computed: {
156
- buttonText() {
157
- if (this.results) {
158
- return this.results + " Results"
282
+ searchValue1: {
283
+ get() {
284
+ return this.modelValueInput1
285
+ },
286
+ set(value) {
287
+ this.$emit("update:modelValueInput1", value)
288
+ }
289
+ },
290
+ searchValue2: {
291
+ get() {
292
+ return this.modelValueInput2
293
+ },
294
+ set(value) {
295
+ this.$emit("update:modelValueInput2", value)
296
+ }
297
+ },
298
+ radius: {
299
+ get() {
300
+ return this.modelValueRadius
301
+ },
302
+ set(value) {
303
+ this.$emit("update:modelValueRadius", value)
304
+ }
305
+ },
306
+ searchFilters: {
307
+ get() {
308
+ return this.modelValueSearchFilters
309
+ },
310
+ set(value) {
311
+ this.$emit("update:modelValueSearchFilters", value)
159
312
  }
160
- return "Search"
161
313
  }
162
314
  },
163
315
  methods: {
316
+ onSearchButtonClick() {
317
+ this.$emit("search", {
318
+ searchValue1: this.searchValue1,
319
+ searchValue2: this.searchValue2,
320
+ searchFilters: this.searchFilters,
321
+ radius: this.radius
322
+ })
323
+ },
164
324
  getOptionName(option) {
165
- for (let i = 0; i < this.listOfFilters.length; i++) {
166
- if (option === this.listOfFilters[i].value) {
167
- return this.listOfFilters[i].text
325
+ for (let i = 0; i < this.cmdFakeSelect.selectData.length; i++) {
326
+ if (option === this.cmdFakeSelect.selectData[i].value) {
327
+ return this.cmdFakeSelect.selectData[i].text
168
328
  }
169
329
  }
170
330
  return null
171
331
  }
332
+ },
333
+ watch: {
334
+ cmdFormElementRadius: {
335
+ handler() {
336
+ if (this.cmdFormElementRadius?.selectOptions && this.cmdFormElementRadius?.selectOptions.length && this.modelValueRadius == null) {
337
+ this.radius = this.cmdFormElementRadius.selectOptions[0].value
338
+ }
339
+ },
340
+ immediate: true,
341
+ deep: true
342
+ }
172
343
  }
173
344
  }
174
345
  </script>
175
346
 
176
347
  <style lang="scss">
348
+ /* begin cmd-box-site-search ---------------------------------------------------------------------------------------- */
349
+ @import '../assets/styles/variables';
177
350
  .cmd-box-site-search {
351
+ flex-wrap: nowrap;
352
+
178
353
  > a {
179
354
  [class*='icon'] {
180
355
  font-size: 1rem;
@@ -185,4 +360,11 @@ export default {
185
360
  align-self: flex-end;
186
361
  }
187
362
  }
363
+
364
+ @media only screen and (max-width: $small-max-width) {
365
+ .cmd-box-site-search {
366
+ flex-wrap: nowrap;
367
+ }
368
+ }
369
+ /* end cmd-box-site-search ---------------------------------------------------------------------------------------- */
188
370
  </style>
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div class="cmd-company-logo">
3
- <a v-if="link.type === 'router'" href="./" :title="link.tooltip">
4
- <img :src="pathCurrentLogo" :alt="altText"/>
5
- </a>
6
- <router-link v-else to="./" :title="link.tooltip">
3
+ <router-link v-if="link.type === 'router'" :href="link.path" :title="link.tooltip">
7
4
  <img :src="pathCurrentLogo" :alt="altText"/>
8
5
  </router-link>
6
+ <a v-else :to="link.path" :title="link.tooltip">
7
+ <img :src="pathCurrentLogo" :alt="altText"/>
8
+ </a>
9
9
  </div>
10
10
  </template>
11
11
 
@@ -53,26 +53,51 @@ export default {
53
53
  },
54
54
  computed: {
55
55
  pathCurrentLogo() {
56
- if (this.prefersColorScheme === 'light' || !this.pathDarkmodeLogo) {
56
+ if (this.prefersColorScheme === "light" || !this.pathDarkmodeLogo) {
57
57
  return this.pathDefaultLogo
58
58
  }
59
59
  return this.pathDarkmodeLogo
60
60
  }
61
61
  },
62
62
  created() {
63
- if (matchMedia('(prefers-color-scheme: light)').matches) {
64
- this.prefersColorScheme = "light"
65
- } else {
66
- this.prefersColorScheme = "dark"
67
- }
63
+ this.toggleColorScheme()
64
+
65
+ window.matchMedia("(prefers-color-scheme: light)").addEventListener("change", this.onColorSchemeChange)
68
66
 
69
- window.matchMedia('(prefers-color-scheme: light)').addEventListener('change', e => {
70
- this.prefersColorScheme = e.matches ? "light" : "dark"
71
- });
67
+ /* observe if class changes in html-tag */
68
+ const htmlTag = document.querySelector("html")
69
+ this.$_observer = new MutationObserver(this.observeDom)
70
+ this.$_observer.observe(htmlTag, {attributes: true})
71
+ },
72
+ beforeUnmount() {
73
+ window.matchMedia("(prefers-color-scheme: light)").removeEventListener("change", this.onColorSchemeChange)
74
+ this.$_observer.disconnect()
72
75
  },
73
76
  methods: {
77
+ onColorSchemeChange(event) {
78
+ this.prefersColorScheme = event.matches ? "light" : "dark"
79
+ },
80
+ observeDom(mutationList) {
81
+ for(let i = 0; i < mutationList.length; i++) {
82
+ if(mutationList[i].type === 'attributes') {
83
+ this.toggleColorScheme()
84
+ break
85
+ }
86
+ }
87
+ },
74
88
  getRoute(language) {
75
89
  return getRoute(language)
90
+ },
91
+ toggleColorScheme() {
92
+ if (document.querySelector("html").classList.contains("light-mode")) {
93
+ this.prefersColorScheme = "light"
94
+ } else if(document.querySelector("html").classList.contains("dark-mode")) {
95
+ this.prefersColorScheme = "dark"
96
+ } else if (matchMedia("(prefers-color-scheme: light)").matches) {
97
+ this.prefersColorScheme = "light"
98
+ } else {
99
+ this.prefersColorScheme = "dark"
100
+ }
76
101
  }
77
102
  }
78
103
  }
@@ -22,14 +22,6 @@
22
22
  >
23
23
  <template v-slot:header>
24
24
  <!-- begin CmdSwitchButton -->
25
- <CmdSwitchButton
26
- type="checkbox"
27
- :id="cookie.id"
28
- :labelText="cookie.labelText"
29
- v-model="cookie.checked"
30
- :status="cookie.status"
31
- disabled="disabled"
32
- />
33
25
  <!-- end CmdSwitchButton -->
34
26
  </template>
35
27
  <template v-slot:body>
@@ -58,13 +50,6 @@
58
50
  >
59
51
  <template v-slot:header>
60
52
  <!-- begin CmdSwitchButton -->
61
- <CmdSwitchButton
62
- type="checkbox"
63
- :id="cookie.id"
64
- :labelText="cookie.labelText"
65
- v-model="cookie.checked"
66
- :status="cookie.status"
67
- />
68
53
  <!-- end CmdSwitchButton -->
69
54
  </template>
70
55
  <template v-slot:body>
@@ -107,14 +92,12 @@
107
92
  // import components
108
93
  import CmdBox from "./CmdBox"
109
94
  import CmdCustomHeadline from "./CmdCustomHeadline"
110
- import CmdSwitchButton from "./CmdSwitchButton"
111
95
 
112
96
  export default {
113
97
  name: "CmdCookieDisclaimer",
114
98
  components: {
115
99
  CmdBox,
116
100
  CmdCustomHeadline,
117
- CmdSwitchButton
118
101
  },
119
102
  data() {
120
103
  return {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <header :class="['cmd-custom-headline', { 'has-pre-headline-text': preHeadlineText}]">
2
+ <div :class="['cmd-custom-headline', { 'has-pre-headline-text': preHeadlineText}]">
3
3
  <span v-if="iconClass" :class="iconClass"></span>
4
4
  <div v-if="preHeadlineText">
5
5
  <span class="pre-headline-text">{{ preHeadlineText }}</span>
@@ -10,7 +10,7 @@
10
10
  <component v-else :is="getHeadlineTag">
11
11
  <slot>{{ headlineText }}</slot>
12
12
  </component>
13
- </header>
13
+ </div>
14
14
  </template>
15
15
 
16
16
  <script>
@@ -22,7 +22,7 @@ export default {
22
22
  */
23
23
  headlineText: {
24
24
  type: String,
25
- required: true
25
+ required: false
26
26
  },
27
27
  /**
28
28
  * level for headline
@@ -74,7 +74,7 @@ export default {
74
74
  margin-bottom: 0;
75
75
  }
76
76
 
77
- h1, h2, h3, h4, h5 ,h6 {
77
+ h1, h2, h3, h4, h5, h6 {
78
78
  margin: 0;
79
79
  display: flex;
80
80
  align-items: center;
@@ -8,13 +8,13 @@
8
8
  'has-state': validationStatus && validationStatus !== 'none'
9
9
  }
10
10
  ]"
11
- :aria-labelledby="labelText"
11
+ :aria-labelledby="labelId"
12
12
  :aria-required="$attrs.required !== undefined"
13
13
  ref="fakeselect"
14
14
  >
15
15
  <span v-if="showLabel">
16
16
  <!-- begin label -->
17
- <span>
17
+ <span :id="labelId">
18
18
  {{ labelText }}<sup v-if="$attrs.required !== undefined">*</sup>
19
19
  </span>
20
20
  <!-- end label -->
@@ -29,7 +29,7 @@
29
29
  :role="validationStatus === 'error' ? 'alert' : 'dialog'">
30
30
  </a>
31
31
  </span>
32
- <ul :class="{'open': showOptions}" @clickout="closeOptions">
32
+ <ul :class="{'open': showOptions}" @clickout="closeOptions" :aria-expanded="showOptions">
33
33
  <li>
34
34
  <!-- begin default/selected-option -->
35
35
  <a href="#" @click.prevent="toggleOptions" @blur="onBlur">
@@ -42,8 +42,8 @@
42
42
  <!-- end default/selected-option-->
43
43
 
44
44
  <!-- begin default dropdown (incl. optional icon) -->
45
- <ul v-if="type === 'default' && showOptions" :aria-expanded="showOptions">
46
- <li v-for="(option, index) in selectData" :key="index" role="option">
45
+ <ul v-if="type === 'default' && showOptions" role="listbox">
46
+ <li v-for="(option, index) in selectData" :key="index" role="option" :aria-selected="option.value === modelValue">
47
47
  <!-- begin type 'href' -->
48
48
  <a v-if="optionLinkType === 'href'" href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
49
49
  <span v-if="option.iconClass" :class="option.iconClass"></span>
@@ -149,6 +149,9 @@
149
149
  </template>
150
150
 
151
151
  <script>
152
+ // import utils
153
+ import {createUuid} from "../utils/common.js"
154
+
152
155
  // import mixins
153
156
  import I18n from "../mixins/I18n"
154
157
  import DefaultMessageProperties from "../mixins/CmdBox/DefaultMessageProperties"
@@ -327,6 +330,13 @@ export default {
327
330
  },
328
331
  selectAllOptionsIcon() {
329
332
  return "icon-check"
333
+ },
334
+ // get ID for accessibility
335
+ labelId() {
336
+ if(this.$attrs.id !== undefined) {
337
+ return this.$attrs.id
338
+ }
339
+ return "label-" + createUuid()
330
340
  }
331
341
  },
332
342
  mounted() {
@@ -465,7 +475,7 @@ export default {
465
475
  margin: 0;
466
476
  display: block;
467
477
  min-width: 0;
468
- background: var(--pure-white);
478
+ background: var(--color-scheme-background-color);
469
479
  box-shadow: none;
470
480
  border-radius: var(--border-radius);
471
481
 
@@ -514,7 +524,7 @@ export default {
514
524
  padding-top: .8rem;
515
525
  outline: none;
516
526
  border-bottom: var(--default-border);
517
- color: var(--text-color);
527
+ color: var(--color-scheme-text-color);
518
528
  text-decoration: none;
519
529
 
520
530
  &:hover, &:active, &:focus {