comand-component-library 3.3.21 → 3.3.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,25 @@
1
1
  <template>
2
2
  <div :class="['cmd-toggle-dark-mode', {'styled-layout': useStyledLayout, 'dark-mode': darkMode}]">
3
+ <!-- begin button-style -->
4
+ <a v-if="styledAsButton"
5
+ href="#"
6
+ :class="['button', {'dark-mode': darkMode}]"
7
+ @click.prevent="toggleColorScheme"
8
+ >
9
+ <span v-if="showLabel">{{ labelText }}</span>
10
+ <!-- begin CmdIcon -->
11
+ <CmdIcon
12
+ :iconClass="iconClass"
13
+ :type="iconType"
14
+ :tooltip="!showLabel ? labelText: ''"
15
+ />
16
+ <!-- end CmdIcon -->
17
+ </a>
18
+ <!-- end button-style -->
19
+
20
+ <!-- begin CmdFormElement -->
3
21
  <CmdFormElement
22
+ v-else
4
23
  element="input"
5
24
  type="checkbox"
6
25
  :labelText="labelText"
@@ -10,6 +29,7 @@
10
29
  :title="!showLabel ? labelText: ''"
11
30
  @update:modelValue="setColorScheme"
12
31
  />
32
+ <!-- end CmdFormElement -->
13
33
  </div>
14
34
  </template>
15
35
 
@@ -22,6 +42,41 @@ export default {
22
42
  }
23
43
  },
24
44
  props: {
45
+ /**
46
+ * activate if toggle-switch should be replaced by a button
47
+ *
48
+ * @affectsStyling: true
49
+ */
50
+ styledAsButton: {
51
+ type: Boolean,
52
+ default: false
53
+ },
54
+ /**
55
+ * icon for dark-mode icon if button-style is used
56
+ *
57
+ * (styledAsButton-property must be activated)
58
+ */
59
+ iconDarkMode: {
60
+ default() {
61
+ return {
62
+ iconClass: "icon-home",
63
+ iconType: "auto"
64
+ }
65
+ }
66
+ },
67
+ /**
68
+ * icon for light-mode icon if button-style is used
69
+ *
70
+ * (styledAsButton-property must be activated)
71
+ */
72
+ iconLightMode: {
73
+ default() {
74
+ return {
75
+ iconClass: "icon-globe",
76
+ iconType: "auto"
77
+ }
78
+ }
79
+ },
25
80
  /**
26
81
  * toggle visibility of label
27
82
  */
@@ -91,11 +146,21 @@ export default {
91
146
  onToggleColorScheme(event) {
92
147
  // get current color-scheme from event-listener (if color-scheme is toggled by (another) switch or browser-/os-settings)
93
148
  this.darkMode = event.detail === "dark-mode"
149
+ },
150
+ toggleColorScheme() {
151
+ this.darkMode = !this.darkMode
152
+ this.setColorScheme()
94
153
  }
95
154
  },
96
155
  computed: {
97
156
  labelText() {
98
157
  return this.darkMode ? this.labelTextDarkMode : this.labelTextLightMode
158
+ },
159
+ iconClass() {
160
+ return this.darkMode ? this.iconDarkMode.iconClass : this.iconLightMode.iconClass
161
+ },
162
+ iconType() {
163
+ return this.darkMode ? this.iconDarkMode.iconType : this.iconLightMode.iconType
99
164
  }
100
165
  },
101
166
  watch: {
@@ -25,14 +25,8 @@
25
25
  </template>
26
26
 
27
27
  <script>
28
- // import components
29
- import CmdHeadline from "./CmdHeadline.vue"
30
-
31
28
  export default {
32
29
  name: "CmdWidthLimitationWrapper",
33
- components: {
34
- CmdHeadline
35
- },
36
30
  props: {
37
31
  /**
38
32
  * set a html-tag as inner tag
@@ -126,6 +120,7 @@ export default {
126
120
  max-width: var(--max-width);
127
121
  margin: 0 auto;
128
122
  padding: var(--default-padding);
123
+ container-type: inline-size;
129
124
  }
130
125
 
131
126
  &.sticky {
@@ -5,7 +5,8 @@ export default {
5
5
  "cmdfakeselect.headline.requirements_for_input": "Requirements for input",
6
6
  "cmdfakeselect.linktext.deselect_all_options": "Deselect all options",
7
7
  "cmdfakeselect.linktext.select_all_options": "Select all options",
8
- "cmdfakeselect.headline.": "An option is selected",
8
+ "cmdfakeselect.headline.an_option_is_selected": "An option is selected",
9
+ "cmdfakeselect.option.options_selected": "{0} options selected"
9
10
 
10
11
  }
11
12
  }