vueless 0.0.362 → 0.0.363

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": "vueless",
3
- "version": "0.0.362",
3
+ "version": "0.0.363",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -52,19 +52,19 @@
52
52
  <UDropdownList
53
53
  v-if="isShownOptions"
54
54
  ref="dropdownListRef"
55
- v-model="selectedItem"
56
55
  :size="size"
57
56
  :options="options"
58
57
  :value-key="valueKey"
59
58
  :label-key="labelKey"
60
59
  v-bind="dropdownListAttrs"
61
60
  :data-test="`${dataTest}-list`"
61
+ @click-option="onClickOption"
62
62
  />
63
63
  </div>
64
64
  </template>
65
65
 
66
66
  <script setup>
67
- import { nextTick, ref, watch, useId } from "vue";
67
+ import { nextTick, ref, useId } from "vue";
68
68
 
69
69
  import UIcon from "../ui.image-icon/UIcon.vue";
70
70
  import UBadge from "../ui.text-badge/UBadge.vue";
@@ -201,14 +201,13 @@ const props = defineProps({
201
201
 
202
202
  const emit = defineEmits([
203
203
  /**
204
- * Triggers when dropdown option is selected.
204
+ * Triggers on dropdown option click.
205
205
  * @property {string} value
206
206
  */
207
- "select",
207
+ "clickOption",
208
208
  ]);
209
209
 
210
210
  const isShownOptions = ref(false);
211
- const selectedItem = ref("");
212
211
  const dropdownListRef = ref(null);
213
212
 
214
213
  const elementId = props.id || useId();
@@ -220,12 +219,6 @@ const { config, wrapperAttrs, dropdownBadgeAttrs, dropdownListAttrs, dropdownIco
220
219
  },
221
220
  );
222
221
 
223
- watch(selectedItem, () => {
224
- emit("select", selectedItem.value);
225
-
226
- hideOptions();
227
- });
228
-
229
222
  function onClickBadge() {
230
223
  isShownOptions.value = !isShownOptions.value;
231
224
 
@@ -237,4 +230,10 @@ function onClickBadge() {
237
230
  function hideOptions() {
238
231
  isShownOptions.value = false;
239
232
  }
233
+
234
+ function onClickOption(option) {
235
+ emit("clickOption", option);
236
+
237
+ hideOptions();
238
+ }
240
239
  </script>
@@ -53,7 +53,6 @@
53
53
  <UDropdownList
54
54
  v-if="isShownOptions"
55
55
  ref="dropdownListRef"
56
- v-model="selectedItem"
57
56
  :size="size"
58
57
  :options="options"
59
58
  :value-key="valueKey"
@@ -61,12 +60,13 @@
61
60
  v-bind="dropdownListAttrs"
62
61
  :data-test="`${dataTest}-list`"
63
62
  @click="onClickList"
63
+ @click-option="onClickOption"
64
64
  />
65
65
  </div>
66
66
  </template>
67
67
 
68
68
  <script setup>
69
- import { nextTick, computed, provide, ref, watch, useId } from "vue";
69
+ import { nextTick, computed, provide, ref, useId } from "vue";
70
70
 
71
71
  import UIcon from "../ui.image-icon/UIcon.vue";
72
72
  import UButton from "../ui.button/UButton.vue";
@@ -227,16 +227,15 @@ const props = defineProps({
227
227
 
228
228
  const emit = defineEmits([
229
229
  /**
230
- * Triggers when dropdown option is selected.
230
+ * Triggers on dropdown option click.
231
231
  * @property {string} value
232
232
  */
233
- "select",
233
+ "clickOption",
234
234
  ]);
235
235
 
236
236
  provide("hideDropdownOptions", hideOptions);
237
237
 
238
238
  const isShownOptions = ref(false);
239
- const selectedItem = ref("");
240
239
  const dropdownListRef = ref(null);
241
240
 
242
241
  const elementId = props.id || useId();
@@ -261,9 +260,9 @@ const iconSize = computed(() => {
261
260
  return sizes[props.size];
262
261
  });
263
262
 
264
- watch(selectedItem, () => {
265
- emit("select", selectedItem.value);
266
- });
263
+ function onClickOption(option) {
264
+ emit("clickOption", option);
265
+ }
267
266
 
268
267
  function onClickButton() {
269
268
  isShownOptions.value = !isShownOptions.value;
@@ -56,7 +56,6 @@
56
56
  <UDropdownList
57
57
  v-if="isShownOptions"
58
58
  ref="dropdownListRef"
59
- v-model="selectedItem"
60
59
  :size="size"
61
60
  :options="options"
62
61
  :value-key="valueKey"
@@ -64,12 +63,13 @@
64
63
  :data-test="`${dataTest}-list`"
65
64
  v-bind="dropdownListAttrs"
66
65
  @click="onClickList"
66
+ @click-option="onClickOption"
67
67
  />
68
68
  </div>
69
69
  </template>
70
70
 
71
71
  <script setup>
72
- import { nextTick, computed, provide, ref, watch, useId } from "vue";
72
+ import { nextTick, computed, provide, ref, useId } from "vue";
73
73
 
74
74
  import UIcon from "../ui.image-icon/UIcon.vue";
75
75
  import ULink from "../ui.button-link/ULink.vue";
@@ -221,16 +221,15 @@ const props = defineProps({
221
221
 
222
222
  const emit = defineEmits([
223
223
  /**
224
- * Triggers when dropdown option is selected.
224
+ * Triggers on dropdown option click.
225
225
  * @property {string} value
226
226
  */
227
- "select",
227
+ "clickOption",
228
228
  ]);
229
229
 
230
230
  provide("hideDropdownOptions", hideOptions);
231
231
 
232
232
  const isShownOptions = ref(false);
233
- const selectedItem = ref("");
234
233
  const dropdownListRef = ref(null);
235
234
 
236
235
  const elementId = props.id || useId();
@@ -250,10 +249,6 @@ const iconSize = computed(() => {
250
249
  return sizes[props.size];
251
250
  });
252
251
 
253
- watch(selectedItem, () => {
254
- emit("select", selectedItem.value);
255
- });
256
-
257
252
  function onClickLink() {
258
253
  isShownOptions.value = !isShownOptions.value;
259
254
 
@@ -269,4 +264,8 @@ function hideOptions() {
269
264
  function onClickList() {
270
265
  hideOptions();
271
266
  }
267
+
268
+ function onClickOption(option) {
269
+ emit("clickOption", option);
270
+ }
272
271
  </script>
@@ -23,7 +23,7 @@
23
23
  v-if="!(option && (option.groupLabel || option.isSubGroup)) && !option.isHidden"
24
24
  v-bind="optionAttrs"
25
25
  :class="optionHighlight(index, option)"
26
- @click="select(option)"
26
+ @click="select(option), onClickOption(option)"
27
27
  @mouseenter.self="pointerSet(index)"
28
28
  >
29
29
  <!--
@@ -204,6 +204,10 @@ const emit = defineEmits([
204
204
  * Triggers when option is added.
205
205
  */
206
206
  "addOption",
207
+ /**
208
+ * Triggers on click option.
209
+ */
210
+ "clickOption",
207
211
  ]);
208
212
 
209
213
  const wrapperRef = ref(null);
@@ -299,8 +303,13 @@ function optionHighlight(index, option) {
299
303
  function addPointerElement({ key } = "Enter") {
300
304
  if (props.options.length > 0) {
301
305
  select(props.options[pointer.value], key);
306
+ onClickOption(props.options[pointer.value]);
302
307
  }
303
308
 
304
309
  pointerReset();
305
310
  }
311
+
312
+ function onClickOption(option) {
313
+ emit("clickOption", option);
314
+ }
306
315
  </script>
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.362",
4
+ "version": "0.0.363",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",
@@ -3206,8 +3206,8 @@
3206
3206
  ],
3207
3207
  "events": [
3208
3208
  {
3209
- "name": "select",
3210
- "description": "Triggers when dropdown option is selected.",
3209
+ "name": "clickOption",
3210
+ "description": "Triggers on dropdown option click.",
3211
3211
  "properties": [
3212
3212
  {
3213
3213
  "type": [
@@ -3422,8 +3422,8 @@
3422
3422
  ],
3423
3423
  "events": [
3424
3424
  {
3425
- "name": "select",
3426
- "description": "Triggers when dropdown option is selected.",
3425
+ "name": "clickOption",
3426
+ "description": "Triggers on dropdown option click.",
3427
3427
  "properties": [
3428
3428
  {
3429
3429
  "type": [
@@ -3625,8 +3625,8 @@
3625
3625
  ],
3626
3626
  "events": [
3627
3627
  {
3628
- "name": "select",
3629
- "description": "Triggers when dropdown option is selected.",
3628
+ "name": "clickOption",
3629
+ "description": "Triggers on dropdown option click.",
3630
3630
  "properties": [
3631
3631
  {
3632
3632
  "type": [
@@ -3764,6 +3764,10 @@
3764
3764
  {
3765
3765
  "name": "addOption",
3766
3766
  "description": "Triggers when option is added."
3767
+ },
3768
+ {
3769
+ "name": "clickOption",
3770
+ "description": "Triggers on click option."
3767
3771
  }
3768
3772
  ],
3769
3773
  "slots": [