@teammodlr/ui-kit 2.1.29 → 2.1.31

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": "@teammodlr/ui-kit",
3
- "version": "2.1.29",
3
+ "version": "2.1.31",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs.js",
6
6
  "module": "lib/index.es.js",
@@ -15,8 +15,8 @@
15
15
  :aria-disabled="disabled ? 'true' : 'false'"
16
16
  :aria-labelledby="`${id}-label`"
17
17
  tabindex="0"
18
- @focusin="focusSelect"
19
- @click="onSelectClick">
18
+ @mousedown.prevent="onSelectClick"
19
+ @focusin.stop="focusSelect">
20
20
  <div :class="selectComputedClasses">
21
21
  <template
22
22
  v-if="
@@ -28,7 +28,7 @@
28
28
  v-for="value in selectedMax"
29
29
  :key="value"
30
30
  :closeable="true"
31
- @close="removeSelected(value)"
31
+ @close="event => removeSelected(event, value)"
32
32
  :size="size">
33
33
  {{ getSelectedLabel(value) }}
34
34
  </MTag>
@@ -454,7 +454,6 @@ export default defineComponent({
454
454
  open.value = false;
455
455
  return;
456
456
  }
457
-
458
457
  open.value = true;
459
458
  }
460
459
 
@@ -514,7 +513,9 @@ export default defineComponent({
514
513
  }
515
514
  }
516
515
 
517
- function removeSelected(value: string | number) {
516
+ function removeSelected(event: MouseEvent, value: string | number) {
517
+ event.preventDefault();
518
+ event.stopPropagation();
518
519
  if (!props.multiple) {
519
520
  return;
520
521
  }
@@ -722,19 +723,16 @@ export default defineComponent({
722
723
  });
723
724
 
724
725
  const focusSelect = (event: FocusEvent) => {
725
- event.preventDefault();
726
- event.stopPropagation();
727
- if (event.relatedTarget != null && !isOpen.value) {
728
- if (selectRef.value) {
726
+ setTimeout(() => {
727
+ if (selectRef.value && !open.value) {
729
728
  openSelect();
730
729
  }
731
- }
730
+ }, 10);
732
731
  };
733
732
 
734
733
  const onSelectClick = (event: MouseEvent) => {
735
734
  event.preventDefault();
736
735
  event.stopPropagation();
737
-
738
736
  openSelect();
739
737
  };
740
738
 
@@ -3,58 +3,64 @@
3
3
  <span>
4
4
  <slot />
5
5
  </span>
6
- <button v-if="closeable" @click.stop="close" :class="style.close" tabindex="0">
7
- <svg viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width: 1em; height: 1em;">
8
- <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
6
+ <button
7
+ v-if="closeable"
8
+ @mousedown.stop="close"
9
+ :class="style.close"
10
+ tabindex="0">
11
+ <svg
12
+ viewBox="0 0 12 12"
13
+ version="1.1"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ aria-hidden="true"
16
+ style="width: 1em; height: 1em">
17
+ <g
18
+ stroke="none"
19
+ stroke-width="1"
20
+ fill="none"
21
+ fill-rule="evenodd">
9
22
  <g fill="currentColor" fill-rule="nonzero">
10
23
  <path
11
- d="M2.08859116,2.2156945 L2.14644661,2.14644661 C2.32001296,1.97288026 2.58943736,1.95359511 2.7843055,2.08859116 L2.85355339,2.14644661 L6,5.293 L9.14644661,2.14644661 C9.34170876,1.95118446 9.65829124,1.95118446 9.85355339,2.14644661 C10.0488155,2.34170876 10.0488155,2.65829124 9.85355339,2.85355339 L6.707,6 L9.85355339,9.14644661 C10.0271197,9.32001296 10.0464049,9.58943736 9.91140884,9.7843055 L9.85355339,9.85355339 C9.67998704,10.0271197 9.41056264,10.0464049 9.2156945,9.91140884 L9.14644661,9.85355339 L6,6.707 L2.85355339,9.85355339 C2.65829124,10.0488155 2.34170876,10.0488155 2.14644661,9.85355339 C1.95118446,9.65829124 1.95118446,9.34170876 2.14644661,9.14644661 L5.293,6 L2.14644661,2.85355339 C1.97288026,2.67998704 1.95359511,2.41056264 2.08859116,2.2156945 L2.14644661,2.14644661 L2.08859116,2.2156945 Z">
12
- </path>
24
+ d="M2.08859116,2.2156945 L2.14644661,2.14644661 C2.32001296,1.97288026 2.58943736,1.95359511 2.7843055,2.08859116 L2.85355339,2.14644661 L6,5.293 L9.14644661,2.14644661 C9.34170876,1.95118446 9.65829124,1.95118446 9.85355339,2.14644661 C10.0488155,2.34170876 10.0488155,2.65829124 9.85355339,2.85355339 L6.707,6 L9.85355339,9.14644661 C10.0271197,9.32001296 10.0464049,9.58943736 9.91140884,9.7843055 L9.85355339,9.85355339 C9.67998704,10.0271197 9.41056264,10.0464049 9.2156945,9.91140884 L9.14644661,9.85355339 L6,6.707 L2.85355339,9.85355339 C2.65829124,10.0488155 2.34170876,10.0488155 2.14644661,9.85355339 C1.95118446,9.65829124 1.95118446,9.34170876 2.14644661,9.14644661 L5.293,6 L2.14644661,2.85355339 C1.97288026,2.67998704 1.95359511,2.41056264 2.08859116,2.2156945 L2.14644661,2.14644661 L2.08859116,2.2156945 Z"></path>
13
25
  </g>
14
26
  </g>
15
27
  </svg>
16
-
17
28
  </button>
18
29
  </div>
19
30
  </template>
20
31
 
21
32
  <script lang="ts">
22
- import type { Color, Size } from "../../types/props";
23
- import { computed, defineComponent, type PropType } from "vue";
24
- import * as style from "./style";
33
+ import type { Color, Size } from '../../types/props';
34
+ import { computed, defineComponent, type PropType } from 'vue';
35
+ import * as style from './style';
25
36
 
26
37
  export default defineComponent({
27
- name: "MTag",
38
+ name: 'MTag',
28
39
  props: {
29
40
  color: {
30
41
  type: String as PropType<Color>,
31
- default: "primary",
42
+ default: 'primary'
32
43
  },
33
44
  size: {
34
45
  type: String as PropType<Size>,
35
- default: "md",
46
+ default: 'md'
36
47
  },
37
48
  closeable: {
38
49
  type: Boolean,
39
- default: false,
40
- },
50
+ default: false
51
+ }
52
+ },
53
+ emits: {
54
+ close: (event: MouseEvent) => true
41
55
  },
42
- emits: ['close'],
43
56
  setup(props, { emit }) {
44
57
  const computedClasses = computed(() => {
45
- return [
46
- style.base
47
- ];
48
- return {
49
- "m-tag": true,
50
- [`m-tag--${props.color}`]: true,
51
- [`m-tag--${props.size}`]: true,
52
- };
58
+ return [style.base];
53
59
  });
54
60
 
55
- const close = () => {
56
- emit('close')
57
- }
61
+ const close = (event: MouseEvent) => {
62
+ emit('close', event);
63
+ };
58
64
 
59
65
  return {
60
66
  computedClasses,
@@ -62,5 +68,5 @@ export default defineComponent({
62
68
  style
63
69
  };
64
70
  }
65
- })
71
+ });
66
72
  </script>