comand-component-library 4.3.8 → 4.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comand-component-library",
3
- "version": "4.3.8",
3
+ "version": "4.3.9",
4
4
  "license": "GPL-3.0-only",
5
5
  "author": "CoManD-UI",
6
6
  "private": false,
@@ -1839,7 +1839,7 @@
1839
1839
  <p> date (YMD/default): {{ formatDate('2025-01-28', "", "-") }}</p>
1840
1840
  <p> date (DMY): {{ formatDate('2025-01-28', "dmy") }}</p>
1841
1841
  <p> date (MDY): {{ formatDate('2025-01-28', "mdy", "/") }}</p>
1842
- <p> date (invalid)): {{ formatDate('invalid') }}</p>
1842
+ <p> date (invalid): {{ formatDate('invalid') }}</p>
1843
1843
  <div class="inline-size">
1844
1844
  <CmdThumbnailScroller ref="CmdThumbnailScroller" v-bind="cmdThumbnailScrollerSettingsData"
1845
1845
  :thumbnailScrollerItems="thumbnailScrollerData" />
@@ -1847,6 +1847,31 @@
1847
1847
  </CmdWidthLimitationWrapper>
1848
1848
  <!-- end thumbnail-scroller --------------------------------------------------------------------------------------------------->
1849
1849
 
1850
+ <!-- begin toast --------------------------------------------------------------------------------------------------->
1851
+ <CmdWidthLimitationWrapper>
1852
+ <h2 class="headline-demopage" id="section-toast">
1853
+ <span>Toast</span>
1854
+ <a href="#" class="button small icon-cog" title="Open Component Settings"
1855
+ @click.prevent="openSettingsSidebar('CmdToast')">
1856
+ </a>
1857
+ </h2>
1858
+ <div class="button-wrapper">
1859
+ <button type="button" class="button" @click.prevent="toggleToast('modal')">
1860
+ <span>Open Toast (as modal)</span>
1861
+ </button>
1862
+ <button type="button" class="button" @click.prevent="toggleToast">
1863
+ <span>Toggle Toast (default)</span>
1864
+ </button>
1865
+ </div>
1866
+ this.showToast: {{ this.showToast }}
1867
+ <CmdToast
1868
+ message="This is a message!"
1869
+ ref="cmdToast"
1870
+ @close="toggleToast"
1871
+ />
1872
+ </CmdWidthLimitationWrapper>
1873
+ <!-- end toast --------------------------------------------------------------------------------------------------->
1874
+
1850
1875
  <!-- begin toggle-darkmode --------------------------------------------------------------------------------------------------->
1851
1876
  <CmdWidthLimitationWrapper>
1852
1877
  <h2 class="headline-demopage" id="section-toggle-dark-mode">
@@ -2174,6 +2199,7 @@ export default {
2174
2199
  "page-2-telephone": "12345/67890"
2175
2200
  }
2176
2201
  },
2202
+ showToast: false,
2177
2203
 
2178
2204
  // assign data from json files to data-properties
2179
2205
  addressData,
@@ -2391,6 +2417,21 @@ export default {
2391
2417
  showError() {
2392
2418
  alert("Error")
2393
2419
  },
2420
+ toggleToast(type) {
2421
+ const dialog = this.$refs.cmdToast
2422
+
2423
+ if (!this.showToast) {
2424
+ if (type === "modal") {
2425
+ dialog.showModal()
2426
+ } else {
2427
+ dialog.show()
2428
+ }
2429
+ this.showToast = true
2430
+ } else {
2431
+ dialog.closeDialog()
2432
+ this.showToast = false
2433
+ }
2434
+ },
2394
2435
  showFancyBox(type, content, ariaLabelText) {
2395
2436
  if (type === "text") {
2396
2437
  openFancyBox({
@@ -45,6 +45,7 @@
45
45
  "Tag",
46
46
  "TextImageBlock",
47
47
  "ThumbnailScroller",
48
+ "Toast",
48
49
  "ToggleDarkMode",
49
50
  "Tooltip",
50
51
  "UploadForm",
@@ -870,6 +870,9 @@ export default {
870
870
  }
871
871
  ]
872
872
  },
873
+ cmdToast: {
874
+ message: "This is a message!"
875
+ },
873
876
  cmdTextImageBlockSettingsData: {
874
877
  htmlContent: "Text given as html-content",
875
878
  paragraphTextAlign: "left",
@@ -5,7 +5,7 @@
5
5
  v-if="showSystemMessage"
6
6
  :class="['cmd-system-message', 'system-message', 'flex-container', 'flex-direction-column', { 'full-width': fullWidth }, systemMessageTextAlign, validationStatus]"
7
7
  :role="validationStatus === 'error' ? 'alert' : 'dialog'"
8
- :aria-labelledby="htmlId"
8
+ :aria-labelledby="ariaId"
9
9
  >
10
10
  <!-- begin slot-content -->
11
11
  <slot>
@@ -16,7 +16,7 @@
16
16
  :headlineText="systemMessage"
17
17
  :headlineLevel="messageHeadlineLevel"
18
18
  :textAlign="textAlign"
19
- :id="htmlId"
19
+ :id="ariaId"
20
20
  />
21
21
  <!-- end CmdHeadline -->
22
22
  </slot>
@@ -50,7 +50,7 @@ export default {
50
50
  data() {
51
51
  return {
52
52
  showSystemMessage: true,
53
- id: this.ariaReferenceId || this.buildHtmlId("system-message") // mixin requires id to be defined
53
+ ariaId: this.ariaReferenceId || this.buildHtmlId("system-message") // mixin requires id to be defined
54
54
  }
55
55
  },
56
56
  props: {
@@ -0,0 +1,125 @@
1
+ <template>
2
+ <!-- begin CmdToast ---------------------------------------------------------------------------------------- -->
3
+ <transition :name="transition">
4
+ <dialog class="cmd-toast box" ref="cmdToast">
5
+ <slot>
6
+ <header>
7
+ <CmdHeadline
8
+ v-if="cmdHeadlineProps"
9
+ v-bind="cmdHeadlineProps"
10
+ />
11
+ <a href="#" @click.prevent="closeModal">
12
+ <CmdIcon v-bind="cmdIconProps" />
13
+ </a>
14
+ </header>
15
+ <p>{{ message }}</p>
16
+ this.dialogIsOpen: {{ this.dialogIsOpen }}
17
+ </slot>
18
+ </dialog>
19
+ </transition>
20
+ <!-- end CmdToast ---------------------------------------------------------------------------------------- -->
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: 'CmdToast',
26
+ data() {
27
+ return {
28
+ dialogIsOpen: true
29
+ }
30
+ },
31
+ props: {
32
+ /**
33
+ * message shown in toast
34
+ */
35
+ message: {
36
+ type: String,
37
+ required: true
38
+ },
39
+ /**
40
+ * properties for CmdHeadline-component
41
+ */
42
+ cmdHeadline: {
43
+ type: Object,
44
+ required: false
45
+ },
46
+ /**
47
+ * properties for CmdIcon-component
48
+ */
49
+ cmdIcon: {
50
+ type: Object,
51
+ required: false
52
+ }
53
+ },
54
+ computed: {
55
+ cmdHeadlineProps() {
56
+ return {
57
+ headlineLevel: 6,
58
+ headlineText: "Information",
59
+ ...this?.cmdHeadline
60
+ }
61
+ },
62
+ cmdIconProps() {
63
+ return {
64
+ iconClass: "icon-cancel",
65
+ tooltip: "Close Toast",
66
+ ...this?.cmdIcon
67
+ }
68
+ },
69
+ transition() {
70
+ return this.dialogIsOpen ? 'fade-in' : 'fade-out'
71
+ }
72
+ },
73
+ methods: {
74
+ closeModal() {
75
+ this.dialogIsOpen = false
76
+ this.$emit("close", true);
77
+ },
78
+ showModal() {
79
+ this.dialogIsOpen = true
80
+ this.$refs.cmdToast.showModal()
81
+ },
82
+ show() {
83
+ this.dialogIsOpen = true
84
+ this.$refs.cmdToast.show()
85
+ },
86
+ closeDialog() {
87
+ // Close only if the dialog is open; avoids immediate reopen if already closed.
88
+ const dialog = this.$refs.cmdToast
89
+ if (this.dialogIsOpen === true && dialog && (dialog.open || dialog.hasAttribute?.('open'))) {
90
+ dialog.close()
91
+ }
92
+ }
93
+ }
94
+ }
95
+ </script>
96
+
97
+ <style>
98
+ /* begin cmd-toast ---------------------------------------------------------------------------------------- */
99
+ .cmd-toast {
100
+ position: fixed;
101
+ margin-right: 2rem;
102
+ margin-left: auto;
103
+ top: auto;
104
+ bottom: 7rem;
105
+ z-index: 1000;
106
+ transition: margin-right linear 3s;
107
+
108
+ header {
109
+ display: flex;
110
+
111
+ a {
112
+ margin-left: auto;
113
+ }
114
+ }
115
+ }
116
+
117
+ .fade-in {
118
+ margin-right: 2rem;
119
+ }
120
+
121
+ .fade-out {
122
+ margin-right: 100%;
123
+ }
124
+ /* end cmd-toast ---------------------------------------------------------------------------------------- */
125
+ </style>