comand-component-library 3.2.8 → 3.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comand-component-library",
3
- "version": "3.2.08",
3
+ "version": "3.3.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -18,7 +18,7 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "clickout-event": "^1.1.2",
21
- "comand-frontend-framework": "^3.2.91",
21
+ "comand-frontend-framework": "^3.2.95",
22
22
  "core-js": "^3.20.1",
23
23
  "prismjs": "^1.27.0",
24
24
  "sass": "^1.54.9",
package/src/App.vue CHANGED
@@ -2,8 +2,6 @@
2
2
  <template>
3
3
  <div id="page-wrapper">
4
4
  <a id="anchor-back-to-top"></a>
5
- <Icon icon="mdi-light:home" class="icon-" />
6
- ICON: <Icon icon="mdi:account-cowboy-hat" />
7
5
  <!-- begin site-header --------------------------------------------------------------------------------------------------------------------------------------------------->
8
6
  <CmdSiteHeader :sticky="true">
9
7
  <template v-slot:top-header>
@@ -41,24 +39,25 @@
41
39
  <li><a href="#section-fancybox">Fancybox</a></li>
42
40
  </ul>
43
41
  <ul>
44
- <li><a href="#section-google-maps-integration">Google-Maps&trade;-Integration</a></li>
42
+ <li><a href="#section-google-mapsn">Google-Maps&trade;</a></li>
43
+ <li><a href="#section-icons">Icons</a></li>
45
44
  <li><a href="#section-image-gallery">Image Gallery</a></li>
46
45
  <li><a href="#section-image-zoom">Image-Zoom</a></li>
47
46
  <li><a href="#section-list-of-links">List Of Links</a></li>
48
47
  <li><a href="#section-login-form">Login Form</a></li>
49
48
  <li><a href="#section-main-navigation">Main-Navigation</a></li>
50
- <li><a href="#section-multistep-form-progress-bar">Multistepform-Progressbar</a></li>
51
49
  </ul>
52
50
  <ul>
51
+ <li><a href="#section-multistep-form-progress-bar">Multistepform-Progressbar</a></li>
53
52
  <li><a href="#section-pager">Pager</a></li>
54
53
  <li><a href="#section-share-buttons">Share Buttons</a></li>
55
54
  <li><a href="#section-site-header">Site Header</a></li>
56
55
  <li><a href="#section-site-search">Site Search</a></li>
57
56
  <li><a href="#section-slideshow">Slideshow</a></li>
58
57
  <li><a href="#section-system-message">System-Message</a></li>
59
- <li><a href="#section-tables">Tables</a></li>
60
58
  </ul>
61
59
  <ul>
60
+ <li><a href="#section-tables">Tables</a></li>
62
61
  <li><a href="#section-tabs">Tabs</a></li>
63
62
  <li><a href="#section-thumbnail-scroller">Thumbnail-Scroller</a></li>
64
63
  <li><a href="#section-toggle-darkmode">ToggleDarkMode</a></li>
@@ -932,7 +931,7 @@
932
931
  <h2 class="headline-demopage">Fancybox</h2>
933
932
  <a href="#" @click.prevent="showFancyBox('text','Some text')">Open FancyBox with text</a>
934
933
  <a href="#"
935
- @click.prevent="showFancyBox('image', 'media/images/content-images/landscape-large.jpg', 'Alternative text')"
934
+ @click.prevent="showFancyBox('image', 'media/images/content-images/landscape-large.jpg', 'Alternative text', 'figcaption')"
936
935
  title="Open FancyBox with large image"
937
936
  >
938
937
  <img src="media/images/content-images/landscape-small.jpg" alt="Alternative text"/>
@@ -940,25 +939,49 @@
940
939
  </CmdWidthLimitationWrapper>
941
940
  <!-- end fancybox ------------------------------------------------------------------------------------------------------------------------------------------------------->
942
941
 
943
- <a id="section-google-maps-integration"></a>
942
+ <!-- begin google-maps ------------------------------------------------------------------------------------------------------------------------------------------------------->
943
+ <a id="section-google-maps"></a>
944
944
  <CmdWidthLimitationWrapper>
945
- <h2 class="headline-demopage">Google Maps&trade;-Integration</h2>
945
+ <h2 class="headline-demopage">Google Maps&trade;</h2>
946
946
  <CmdGoogleMaps :address="addressData"/>
947
947
  </CmdWidthLimitationWrapper>
948
+ <!-- end google-maps ------------------------------------------------------------------------------------------------------------------------------------------------------->
949
+
950
+ <!-- begin icons ------------------------------------------------------------------------------------------------------------------------------------------------------->
951
+ <a id="section-icons"></a>
952
+ <CmdWidthLimitationWrapper>
953
+ <h2 class="headline-demopage">Icons</h2>
954
+ <ul>
955
+ <li><span>Icon from local iconfont</span><CmdIcon iconClass="icon-home" /></li>
956
+ <li><span>Icon from iconify-api (icomoon-font)</span><CmdIcon iconClass="icomoon-free:home" /></li>
957
+ <li><span>Icon from iconify-api (bootstrap-font)</span><CmdIcon iconClass="bi:house-fill" /></li>
958
+ <li><span>Icon from iconify-api (material-design-font)</span><CmdIcon iconClass="mdi:home" /></li>
959
+ <li><span>Icon from iconify-api (font-awesome-solid-font)</span><CmdIcon iconClass="fa6-solid:house-chimney" /></li>
960
+
961
+ </ul>
962
+ </CmdWidthLimitationWrapper>
963
+ <!-- end icons ------------------------------------------------------------------------------------------------------------------------------------------------------->
948
964
 
965
+ <!-- begin image-gallery------------------------------------------------------------------------------------------------------------------------------------------------------->
949
966
  <a id="section-image-gallery"></a>
950
967
  <CmdWidthLimitationWrapper>
951
968
  <h2 class="headline-demopage">Image-Gallery</h2>
952
- <CmdImageGallery :images="imageGalleryData"/>
969
+ <CmdImageGallery :images="imageGalleryData" />
953
970
  </CmdWidthLimitationWrapper>
971
+ <!-- end image-gallery ------------------------------------------------------------------------------------------------------------------------------------------------------->
954
972
 
973
+ <!-- begin image-zoom ------------------------------------------------------------------------------------------------------------------------------------------------------->
955
974
  <a id="section-image-zoom"></a>
956
975
  <CmdWidthLimitationWrapper>
957
976
  <h2 class="headline-demopage">Image-Zoom</h2>
958
- <CmdImageZoom small-image-url="media/images/content-images/logo-business-edition-landscape.jpg"
959
- large-image-url="media/images/content-images/logo-business-edition-landscape-large.jpg"/>
977
+ <CmdImageZoom
978
+ small-image-url="media/images/content-images/logo-business-edition-landscape.jpg"
979
+ large-image-url="media/images/content-images/logo-business-edition-landscape-large.jpg"
980
+ />
960
981
  </CmdWidthLimitationWrapper>
982
+ <!-- end image-zoom ------------------------------------------------------------------------------------------------------------------------------------------------------->
961
983
 
984
+ <!-- begin login-form ------------------------------------------------------------------------------------------------------------------------------------------------------->
962
985
  <a id="section-login-form"></a>
963
986
  <CmdWidthLimitationWrapper>
964
987
  <h2 class="headline-demopage">Login Form</h2>
@@ -967,13 +990,15 @@
967
990
  </CmdForm>
968
991
  <p>LoginData: {{ loginData }}</p>
969
992
  </CmdWidthLimitationWrapper>
993
+ <!-- end list-of-links ------------------------------------------------------------------------------------------------------------------------------------------------------->
994
+
970
995
 
971
996
  <!-- begin list-of-links ------------------------------------------------------------------------------------------------------------------------------------------------------->
972
997
  <a id="section-list-of-links"></a>
973
998
  <CmdWidthLimitationWrapper>
974
999
  <h2 class="headline-demopage">List Of Links</h2>
975
1000
  <h3>Vertical</h3>
976
- <CmdListOfLinks :links="listOfLinksData"/>
1001
+ <CmdListOfLinks :links="listOfLinksData" />
977
1002
  <h3>Horizontal (aligned left, with headline)</h3>
978
1003
  <CmdListOfLinks
979
1004
  orientation="horizontal"
@@ -1007,6 +1032,7 @@
1007
1032
  <a id="section-multistep-form-progress-bar"></a>
1008
1033
  <CmdWidthLimitationWrapper>
1009
1034
  <h2 class="headline-demopage">Multistepform-Progressbar</h2>
1035
+ <h3>Steps with icons</h3>
1010
1036
  <CmdMultistepFormProgressBar
1011
1037
  :multisteps="multistepsData.withIcon"
1012
1038
  separatorIconClass="icon-single-arrow-right"
@@ -1015,7 +1041,7 @@
1015
1041
  <div>
1016
1042
  <p>Page {{ showPageMultistep }}</p>
1017
1043
  </div>
1018
- <h2 class="headline-demopage">Multistepform-Progressbar</h2>
1044
+ <h3>Steps with number</h3>
1019
1045
  <CmdMultistepFormProgressBar
1020
1046
  :showStepNumber="true"
1021
1047
  :multisteps="multistepsData.withoutIcon"
@@ -1318,9 +1344,6 @@
1318
1344
  </template>
1319
1345
 
1320
1346
  <script>
1321
- import {Icon} from "@iconify/vue"
1322
-
1323
-
1324
1347
  // import used example data
1325
1348
  import accordionData from '@/assets/data/accordion.json'
1326
1349
  import addressData from '@/assets/data/address-data.json'
@@ -1369,6 +1392,7 @@ import CmdForm from "@/components/CmdForm.vue"
1369
1392
  import CmdFormElement from "@/components/CmdFormElement.vue"
1370
1393
  import CmdFormFilters from "@/components/CmdFormFilters.vue"
1371
1394
  import CmdGoogleMaps from "./components/CmdGoogleMaps"
1395
+ import CmdIcon from "./components/CmdIcon"
1372
1396
  import CmdImageGallery from "@/components/CmdImageGallery.vue"
1373
1397
  import CmdImageZoom from "@/components/CmdImageZoom.vue"
1374
1398
  import CmdInputGroup from "./components/CmdInputGroup"
@@ -1404,7 +1428,6 @@ import {localizedTime} from "./components/CmdOpeningHours"
1404
1428
  export default {
1405
1429
  name: "App",
1406
1430
  components: {
1407
- Icon,
1408
1431
  CmdListOfLinks,
1409
1432
  CmdAddressData,
1410
1433
  CmdBackToTopButton,
@@ -1422,6 +1445,7 @@ export default {
1422
1445
  CmdFormFilters,
1423
1446
  CmdFormElement,
1424
1447
  CmdGoogleMaps,
1448
+ CmdIcon,
1425
1449
  CmdImageGallery,
1426
1450
  CmdImageZoom,
1427
1451
  CmdInputGroup,
@@ -1604,11 +1628,11 @@ export default {
1604
1628
  showError() {
1605
1629
  alert("Error")
1606
1630
  },
1607
- showFancyBox(type, content, altText) {
1631
+ showFancyBox(type, content, altText, figcaption) {
1608
1632
  if (type === 'text') {
1609
1633
  openFancyBox({content: content, cmdHeadline: {show: true, headlineText: "Fancybox headline", headlineLevel: 3}})
1610
1634
  } else if (type === 'image') {
1611
- openFancyBox({url: content, altText: altText, cmdHeadline: {show: true, headlineText: "Fancybox headline", headlineLevel: 3}})
1635
+ openFancyBox({url: content, altText: altText, cmdHeadline: {show: true, headlineText: "Fancybox headline", headlineLevel: 3}, figcaption: figcaption})
1612
1636
  }
1613
1637
  },
1614
1638
  getOptionName(option) {
@@ -13,5 +13,10 @@
13
13
  "text": "Option 3",
14
14
  "value": "3",
15
15
  "iconClass": "icon-phone"
16
+ },
17
+ {
18
+ "value": "4",
19
+ "iconClass": "icon-fax",
20
+ "tooltip": "Fax"
16
21
  }
17
22
  ]
@@ -0,0 +1,17 @@
1
+ {
2
+ "prefix": "cmd",
3
+ "icons": {
4
+ "3d-cursor": {
5
+ "body": "<path d=\"M13 4H4v9.01h2V6h7V4z\" fill=\"currentColor\"/><path d=\"M29.49 13.12l-9-5a1 1 0 0 0-1 0l-9 5A1 1 0 0 0 10 14v10a1 1 0 0 0 .52.87l9 5A1 1 0 0 0 20 30a1.05 1.05 0 0 0 .49-.13l9-5A1 1 0 0 0 30 24V14a1 1 0 0 0-.51-.88zM19 27.3l-7-3.89v-7.72l7 3.89zm1-9.45L13.06 14L20 10.14L26.94 14zm8 5.56l-7 3.89v-7.72l7-3.89z\" fill=\"currentColor\"/>",
6
+ "hidden": true
7
+ },
8
+ "building": {
9
+ "body": "<path fill=\"currentColor\" d=\"M28 2H16a2.002 2.002 0 0 0-2 2v10H4a2.002 2.002 0 0 0-2 2v14h28V4a2.002 2.002 0 0 0-2-2ZM9 28v-7h4v7Zm19 0H15v-8a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v8H4V16h12V4h12Z\"/><path fill=\"currentColor\" d=\"M18 8h2v2h-2zm6 0h2v2h-2zm-6 6h2v2h-2zm6 0h2v2h-2zm-6 6h2v2h-2zm6 0h2v2h-2z\"/>"
10
+ },
11
+ "linkedin": {
12
+ "body": "<path fill=\"currentColor\" d=\"M12,12h5.535v2.837h0.078C18.384,13.456,20.27,12,23.078,12C28.92,12,30,15.637,30,20.367V30h-5.77v-8.54\n\tc0-2.037-0.041-4.657-3-4.657c-3.006,0-3.463,2.219-3.463,4.51V30H12V12z\"/>\n<path fill=\"currentColor\" d=\"M2,12h6v18H2V12z\"/>\n<path fill=\"currentColor\" d=\"M8,7c0,1.657-1.343,3-3,3S2,8.657,2,7s1.343-3,3-3S8,5.343,8,7z\"/>"
13
+ }
14
+ },
15
+ "width": 32,
16
+ "height": 32
17
+ }
@@ -3,19 +3,21 @@
3
3
  "name": "Tab 1",
4
4
  "headlineText": "Tab 1 Headline",
5
5
  "headlineLevel": 4,
6
- "iconClass": "icon-home",
6
+ "iconClass": "icomoon-free:airplane",
7
7
  "htmlContent": "<p>Inhalt 1</p>"
8
8
  },
9
9
  {
10
10
  "name": "Tab 2",
11
11
  "headlineText": "Tab 2 Headline",
12
12
  "headlineLevel": 4,
13
+ "iconClass": "icomoon-free:blocked",
13
14
  "htmlContent": "<p>Inhalt 2</p>"
14
15
  },
15
16
  {
16
17
  "name": "Tab 3",
17
18
  "headlineText": "Tab 3 Headline",
18
19
  "headlineLevel": 4,
20
+ "iconClass": "cmd:linkedin",
19
21
  "htmlContent": "<p>Inhalt 3</p>"
20
22
  }
21
23
  ]
@@ -51,7 +51,7 @@
51
51
  </dd>
52
52
  <!-- end telephone -->
53
53
 
54
- <!-- begin mobilephone -->
54
+ <!-- begin mobile phone -->
55
55
  <dt v-if="addressData.mobilephone?.value">
56
56
  <span v-if="addressData.mobilephone.iconClass && showLabelIcons" :class="addressData.mobilephone.iconClass" :title="getMessage('cmdaddressdata.labeltext.mobile_phone')"></span>
57
57
  <span v-if="showLabelTexts">{{ getMessage('cmdaddressdata.labeltext.mobile_phone')}}</span>
@@ -59,7 +59,7 @@
59
59
  <dd v-if="addressData.mobilephone?.value">
60
60
  <a :href="'tel:' + addressData.mobilephone" title="Call number" class="tel" v-telephone="addressData.mobilephone.value">{{ addressData.mobilephone.value }}</a>
61
61
  </dd>
62
- <!-- end mobilephone -->
62
+ <!-- end mobile phone -->
63
63
 
64
64
  <!-- begin fax -->
65
65
  <dt v-if="addressData.fax?.value">
@@ -368,7 +368,7 @@ export default {
368
368
  }
369
369
 
370
370
  > .toggle-icon, .toggle-icon > [class*="icon"] {
371
- font-size: 1rem;
371
+ font-size: var(--font-size-small);
372
372
  }
373
373
  }
374
374
 
@@ -47,12 +47,26 @@
47
47
  <ul :class="{'open': showOptions}" @clickout="closeOptions" :aria-expanded="showOptions">
48
48
  <li>
49
49
  <!-- begin default/selected-option -->
50
- <a href="#" @click.prevent="toggleOptions" @blur="onBlur">
50
+ <a href="#" @click.prevent="toggleOptions" @blur="onBlur" :title="optionIcon?.tooltip">
51
+ <!-- begin show flag -->
51
52
  <img v-if="type === 'country' && optionCountry" :src="pathFlag(optionCountry)" :alt="optionCountry" :class="['flag', optionCountry]"/>
53
+ <!-- end show flag -->
54
+
55
+ <!-- begin show color-box -->
52
56
  <span v-else-if="type === 'color'" :style="'background: ' + optionColor"></span>
53
- <span v-if="optionIcon" :class="optionIcon"></span>
54
- <span class="option-name" :style="limitWidthStyle">{{ optionName }}</span>
57
+ <!-- end show color-box -->
58
+
59
+ <!-- begin optional icon -->
60
+ <span v-if="optionIcon?.iconClass" :class="optionIcon?.iconClass"></span>
61
+ <!-- end optional icon -->
62
+
63
+ <!-- begin text -->
64
+ <span v-if="optionName" class="option-name" :style="limitWidthStyle">{{ optionName }}</span>
65
+ <!-- end text -->
66
+
67
+ <!-- begin custom dropdown-icon -->
55
68
  <span v-if="dropdownIcon" :class="dropdownIcon.iconClass" :title="dropdownIcon.tooltip"></span>
69
+ <!-- end custom dropdown-icon -->
56
70
  </a>
57
71
  <!-- end default/selected-option-->
58
72
 
@@ -60,9 +74,13 @@
60
74
  <ul v-if="type === 'default' && showOptions" role="listbox">
61
75
  <li v-for="(option, index) in selectData" :key="index" role="option" :aria-selected="option.value === modelValue">
62
76
  <!-- begin type 'href' -->
63
- <a v-if="optionLinkType === 'href'" href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
77
+ <a v-if="optionLinkType === 'href'"
78
+ href="#" @click.prevent="selectOption(option.value)"
79
+ :class="{'active' : option.value === modelValue}"
80
+ :title="option.tooltip"
81
+ >
64
82
  <span v-if="option.iconClass" :class="option.iconClass"></span>
65
- <span>{{ option.text }}</span>
83
+ <span v-if="option.text">{{ option.text }}</span>
66
84
  </a>
67
85
  <!-- end type 'href' -->
68
86
 
@@ -76,27 +94,34 @@
76
94
  </ul>
77
95
  <!-- end default dropdown (incl. optional icon) -->
78
96
 
79
- <!-- begin dropdown with checkboxes -->
97
+ <!-- begin dropdown with checkboxes/countries/colors -->
80
98
  <ul v-else-if="type !== 'default' && type !== 'content' && showOptions" :class="{'checkbox-options': type === 'checkboxOptions'}" :aria-expanded="showOptions">
81
99
  <li v-for="(option, index) in selectData" :key="index">
100
+ <!-- begin checkboxes -->
82
101
  <label v-if="type === 'checkboxOptions'" :for="'option-' + (index + 1)" :class="{'active' : modelValue.includes(`${option.value}`)}">
83
102
  <input type="checkbox" :value="option.value" @change="optionSelect"
84
103
  :checked="compareValues(option.value)" :id="'option-' + (index + 1)"/>
85
104
  <span>{{ option.text }}</span>
86
105
  </label>
106
+ <!-- end checkboxes -->
87
107
 
108
+ <!-- begin country-flags -->
88
109
  <a v-else-if="type === 'country'" href="#"
89
110
  @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
90
111
  <img class="flag" :src="pathFlag(option.value)"
91
112
  :alt="option.text"/>
92
113
  <span>{{ option.text }}</span>
93
114
  </a>
115
+ <!-- end country-flags -->
94
116
 
117
+ <!-- begin color-boxes -->
95
118
  <a v-else-if="type === 'color'" href="#" @click.prevent="selectOption(option.value)" :class="{'active' : option.value === modelValue}">
96
119
  <span class="color" :style="'background: ' + option.value"></span>
97
120
  <span>{{ option.text }}</span>
98
121
  </a>
122
+ <!-- end color-boxe -->
99
123
  </li>
124
+
100
125
  <!-- begin (de)select all options -->
101
126
  <li v-if="showSelectAllOptions && type === 'checkboxOptions'" class="select-all-options">
102
127
  <a href="#" @click.prevent="toggleAllOptions">
@@ -106,7 +131,7 @@
106
131
  </li>
107
132
  <!-- end (de)select all options -->
108
133
  </ul>
109
- <!-- end dropdown with checkboxes -->
134
+ <!-- end dropdown with checkboxes/countries/colors -->
110
135
 
111
136
  <!-- begin dropdown with slot -->
112
137
  <template v-else-if="type === 'content' && showOptions" :aria-expanded="showOptions">
@@ -240,6 +265,13 @@ export default {
240
265
  pathFlags: {
241
266
  type: String,
242
267
  default: "/media/images/flags"
268
+ },
269
+ /**
270
+ * default text if no option is selected (and first option is not used)
271
+ */
272
+ textPleaseSelect: {
273
+ type: String,
274
+ default: "Please select\u2026"
243
275
  }
244
276
  },
245
277
  computed: {
@@ -260,11 +292,11 @@ export default {
260
292
  optionName() {
261
293
  // fake a native selectbox
262
294
  if (this.type !== "checkboxOptions" && this.type !== "content" && this.modelValue) {
263
- const result = this.selectData.find(option => option.value === this.modelValue)?.text
295
+ const result = this.selectData.find(option => option.value === this.modelValue)
264
296
 
265
297
  // if find() returns some data, return this data
266
298
  if (result) {
267
- return result
299
+ return result.text
268
300
  }
269
301
  }
270
302
 
@@ -276,29 +308,37 @@ export default {
276
308
  return this.modelValue.length + " options selected"
277
309
  }
278
310
  } else if (this.selectData?.length) {
311
+ // return text of first option nothing is selected (and type !== checkboxOptions && type !== content)
279
312
  return this.selectData[0].text
280
313
  }
281
314
 
282
- return "Please select"
315
+ // return default text if nothing is selected (and no modelValue exists) (and type !== checkboxOptions && type !== content)
316
+ return this.textPleaseSelect
283
317
  },
284
318
  // get the displayed icon (only available for default selectbox)
285
319
  optionIcon() {
286
320
  if (this.type === "default") {
287
- return this.selectData.find(option => {
321
+
322
+ const selectedOption = this.selectData.find(option => {
288
323
  return option.value === this.modelValue
289
- })?.icon?.iconClass
324
+ })
325
+
326
+ return {
327
+ iconClass: selectedOption?.iconClass,
328
+ tooltip: selectedOption?.tooltip
329
+ }
290
330
  }
291
331
  return null
292
332
  },
293
333
  optionCountry() {
294
334
  if (this.type === "country") {
295
- return this.modelValue
335
+ return this.modelValue || this.selectData?.[0]?.value
296
336
  }
297
337
  return null
298
338
  },
299
339
  optionColor() {
300
340
  if (this.type === "color") {
301
- return this.modelValue
341
+ return this.modelValue || this.selectData?.[0]?.value
302
342
  }
303
343
  return null
304
344
  },
@@ -464,7 +504,7 @@ export default {
464
504
 
465
505
  > [class*="icon-"]:last-child {
466
506
  margin-left: auto;
467
- font-size: 1rem;
507
+ font-size: var(--icon-size-small);
468
508
  }
469
509
 
470
510
  &:hover, &:active, &:focus {
@@ -2,7 +2,7 @@
2
2
  <teleport to="body">
3
3
  <dialog
4
4
  ref="dialog"
5
- :class="['cmd-fancybox', {'show-overlay': showOverlay, 'image' : fancyBoxImageUrl || fancyBoxGallery}]"
5
+ :class="['cmd-fancybox', {'show-overlay': showOverlay, 'image' : fancyBoxImageUrl || fancyBoxGallery, 'image-gallery': fancyBoxGallery}]"
6
6
  :aria-label="ariaLabelText"
7
7
  >
8
8
  <header class="flex-container">
@@ -45,6 +45,7 @@
45
45
  id="close-dialog"
46
46
  :class="fancyboxOptions.closeIcon.iconClass"
47
47
  :title="fancyboxOptions.closeIcon.tooltip"
48
+ ref="close-dialog"
48
49
  @click.prevent="close">
49
50
  </a>
50
51
  <!-- end close-icon -->
@@ -54,7 +55,7 @@
54
55
  <div :class="['outer-content-wrapper', {'grayscale' : printInGrayscale}]">
55
56
  <div v-if="fancyBoxImageUrl" class="content">
56
57
  <figure>
57
- <img :src="fancyBoxImageUrl" :alt="altText" />#
58
+ <img :src="fancyBoxImageUrl" :alt="altText" />
58
59
  <figcaption v-if="figcaption">{{ figcaption }}</figcaption>
59
60
  </figure>
60
61
  </div>
@@ -108,8 +109,8 @@ import CmdSlideButton from "./CmdSlideButton.vue"
108
109
  import CmdThumbnailScroller from './CmdThumbnailScroller.vue'
109
110
 
110
111
  const openFancyBox = (config) => {
111
- const node = document.createElement('div');
112
- document.querySelector('body').appendChild(node);
112
+ const node = document.createElement("div");
113
+ document.querySelector("body").appendChild(node);
113
114
  const fb = createApp(FancyBox, {
114
115
  ...config,
115
116
  show: true
@@ -280,10 +281,8 @@ const FancyBox = defineComponent({
280
281
  )
281
282
  },
282
283
  mounted() {
283
- // avoid scrolling if fancybox is shown
284
284
  if (this.showFancyBox) {
285
- document.querySelector("body").classList.add("avoid-scrolling")
286
- this.$refs.dialog.showModal()
285
+ this.showDialog()
287
286
  }
288
287
  },
289
288
  beforeUnmount() {
@@ -293,6 +292,14 @@ const FancyBox = defineComponent({
293
292
  }
294
293
  },
295
294
  methods: {
295
+ showDialog() {
296
+ // avoid scrolling if fancybox is shown
297
+ document.querySelector("body").classList.add("avoid-scrolling")
298
+ this.$refs.dialog.showModal()
299
+
300
+ // overwrite default behavior of dialog-element, which sets focus on first focusable element inside
301
+ this.$refs["close-dialog"].focus()
302
+ },
296
303
  updateContentOnPropertyChange() {
297
304
  this.fancyBoxImageUrl = this.fancyBoxContent = this.fancyBoxElements = null
298
305
  if (this.url) {
@@ -359,21 +366,13 @@ const FancyBox = defineComponent({
359
366
  showFancyBox: {
360
367
  handler() {
361
368
  if (this.showFancyBox) {
362
- // add listener and class to disable scroll
363
- // this.$_FancyBox_verticalScrollPosition = window.scrollY
364
- document.querySelector("body").classList.add("avoid-scrolling")
365
- // window.addEventListener("scroll", this.$_FancyBox_scrollHandler)
366
- this.$refs.dialog.showModal()
369
+ this.showDialog()
367
370
  } else {
368
371
  // remove class to re-enable scrolling
369
372
  document.querySelector("body").classList.remove("avoid-scrolling")
370
- // window.removeEventListener("scroll", this.$_FancyBox_scrollHandler)
371
- // console.log("$_FancyBox_verticalScrollPosition", this.$_FancyBox_verticalScrollPosition)
372
- // window.scrollTo(0, this.$_FancyBox_verticalScrollPosition)
373
373
  this.$refs.dialog.close()
374
374
  }
375
- },
376
- immediate: false
375
+ }
377
376
  }
378
377
  }
379
378
  })
@@ -405,6 +404,10 @@ export default FancyBox
405
404
  overflow: hidden;
406
405
  gap: calc(var(--default-gap) / 2);
407
406
 
407
+ &.image-gallery {
408
+ margin-top: calc(var(--default-margin) * 2)
409
+ }
410
+
408
411
  // detect open-attribute (will be added to dom automatically)
409
412
  &[open] {
410
413
  display: flex;
@@ -429,7 +432,7 @@ export default FancyBox
429
432
 
430
433
  &.image {
431
434
  .outer-content-wrapper {
432
- overflow-y: hidden;
435
+ max-height: none;
433
436
  }
434
437
 
435
438
  img {
@@ -559,7 +562,7 @@ export default FancyBox
559
562
 
560
563
  @media only screen and (max-width: $medium-max-width) {
561
564
  dialog {
562
- top: var(--default-margin);
565
+ margin-top: var(--default-margin);
563
566
  }
564
567
  }
565
568
  /* end cmd-fancybox ------------------------------------------------------------------------------------------ */
@@ -113,7 +113,7 @@ export default {
113
113
  margin-right: var(--default-margin);
114
114
  border: var(--default-border);
115
115
  background: var(--pure-white);
116
- font-size: 1.1rem;
116
+ font-size: var(--font-size-small);
117
117
 
118
118
  &:hover, &:active, &:focus {
119
119
  border-color: var(--primary-color);
@@ -131,7 +131,7 @@ export default {
131
131
  }
132
132
 
133
133
  [class*="icon-"] {
134
- font-size: 1rem;
134
+ font-size: var(--icon-size-small);
135
135
  }
136
136
  }
137
137
  }