@appscode/design-system 2.2.38 → 2.2.39

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": "@appscode/design-system",
3
- "version": "2.2.38",
3
+ "version": "2.2.39",
4
4
  "description": "A design system for Appscode websites and dashboards made using Bulma",
5
5
  "main": "main.scss",
6
6
  "scripts": {
@@ -1,90 +1,28 @@
1
- <template>
2
- <div
3
- ref="multiselectDivId"
4
- class="multi-select-wrapper"
5
- :class="{
6
- multiselectCustomClass,
7
- 'has-refresh-button': hasRefreshBtn,
8
- 'is-disable': disabled || isLoaderActive,
9
- 'has-clear-button': allowEmpty && model,
10
- }"
11
- data-testid="cluster-status-select-header"
12
- >
13
- <label
14
- v-if="label.length"
15
- :class="{ 'show-label': isLabelHoisted }"
16
- data-testid="ac-multiselect-label"
17
- @click.prevent="onClickLabel"
18
- >
19
- {{ isLabelHoisted ? label : `Select ${label}` }}
20
- <span v-if="showStar" class="is-required has-text-danger"> * </span>
21
- </label>
22
- <button v-if="allowEmpty && model" class="button ac-button is-clear is-transparent" @click.prevent="model = ''">
23
- <i class="fa fa-times" />
24
- </button>
25
- <button
26
- v-if="hasRefreshBtn"
27
- class="button ac-button is-primary is-refresh is-transparent"
28
- :class="{ spin: isLoaderActive }"
29
- @click.prevent="$emit('refresh-btn-click')"
30
- >
31
- <i class="fa fa-refresh" />
32
- </button>
33
- <multiselect
34
- ref="multiselectElement"
35
- v-model="model"
36
- :track-by="trackBy"
37
- :label="showBy"
38
- :class="multiselectCustomClass"
39
- :options="options"
40
- :placeholder="placeholderText"
41
- :disabled="disabled || isLoaderActive"
42
- :allow-empty="false"
43
- :show-labels="false"
44
- :close-on-select="true"
45
- :open-direction="openDirection"
46
- :group-values="groupValues"
47
- :group-label="groupLabel"
48
- :group-select="groupSelect"
49
- data-testid="simple-select-box"
50
- @open="openDropDown"
51
- @close="closeDropDown"
52
- @select="onSelect"
53
- @remove="onRemove"
54
- >
55
- <template #noResult>
56
- <span> {{ noResultText }} </span>
57
- </template>
58
- </multiselect>
59
- <p v-show="errorMsg" class="is-danger">
60
- {{ errorMsg }}
61
- </p>
62
- </div>
63
- </template>
64
1
  <script setup lang="ts">
65
2
  import { computed, ref } from "vue";
3
+ import type { ComponentPublicInstance } from "vue";
66
4
  import Multiselect from "vue-multiselect";
67
5
 
68
6
  interface Props {
69
- errorMsg: string;
70
- placeholderText: string;
71
- disabled: boolean;
72
- label: string;
73
- allowEmpty: boolean;
74
- options: unknown[];
75
- trackBy: string;
76
- showBy: string;
77
- closeOnSelect: boolean;
78
- hasRefreshBtn: boolean;
79
- isLoaderActive: boolean;
80
- noResultText: string;
81
- showStar: boolean;
82
- wrapperDivCustomClass: string;
83
- multiselectCustomClass: string;
84
- openDirection: "top" | "bottom";
85
- groupLabel: string;
86
- groupValues: string;
87
- groupSelect: boolean;
7
+ errorMsg?: string;
8
+ placeholderText?: string;
9
+ disabled?: boolean;
10
+ label?: string;
11
+ allowEmpty?: boolean;
12
+ options?: unknown[];
13
+ trackBy?: string;
14
+ showBy?: string;
15
+ closeOnSelect?: boolean;
16
+ hasRefreshBtn?: boolean;
17
+ isLoaderActive?: boolean;
18
+ noResultText?: string;
19
+ showStar?: boolean;
20
+ wrapperDivCustomClass?: string;
21
+ multiselectCustomClass?: string;
22
+ openDirection?: "top" | "bottom";
23
+ groupLabel?: string;
24
+ groupValues?: string;
25
+ groupSelect?: boolean;
88
26
  }
89
27
 
90
28
  const props = withDefaults(defineProps<Props>(), {
@@ -111,7 +49,7 @@ const props = withDefaults(defineProps<Props>(), {
111
49
 
112
50
  const emit = defineEmits(["select", "remove", "refresh-btn-click"]);
113
51
 
114
- const multiselectElement = ref<HTMLInputElement | null>(null);
52
+ const multiselectElement = ref<ComponentPublicInstance | null>(null);
115
53
  const multiselectDivId = ref<HTMLInputElement | null>(null);
116
54
 
117
55
  const model = defineModel<unknown>({ required: true });
@@ -122,8 +60,9 @@ const isLabelHoisted = computed(() => {
122
60
  });
123
61
 
124
62
  const onClickLabel = () => {
63
+ openDropDown();
125
64
  if (multiselectElement.value) {
126
- multiselectDivId.value?.focus();
65
+ multiselectElement.value.$el.focus();
127
66
  }
128
67
  };
129
68
 
@@ -145,3 +84,67 @@ const onRemove = (removedOption: unknown, id: string) => emit("remove", removedO
145
84
 
146
85
  const onSelect = (selectedOption: unknown, id: string) => emit("select", selectedOption, id);
147
86
  </script>
87
+
88
+ <template>
89
+ <div
90
+ ref="multiselectDivId"
91
+ class="multi-select-wrapper"
92
+ :class="{
93
+ multiselectCustomClass,
94
+ 'has-refresh-button': hasRefreshBtn,
95
+ 'is-disable': disabled || isLoaderActive,
96
+ 'has-clear-button': allowEmpty && model,
97
+ }"
98
+ data-testid="cluster-status-select-header"
99
+ >
100
+ <label
101
+ v-if="label.length"
102
+ :class="{ 'show-label': isLabelHoisted }"
103
+ data-testid="ac-multiselect-label"
104
+ @click.prevent="onClickLabel"
105
+ >
106
+ {{ isLabelHoisted ? label : `Select ${label}` }}
107
+ <span v-if="showStar" class="is-required has-text-danger"> * </span>
108
+ </label>
109
+ <button v-if="allowEmpty && model" class="button ac-button is-clear is-transparent" @click.prevent="model = ''">
110
+ <i class="fa fa-times" />
111
+ </button>
112
+ <button
113
+ v-if="hasRefreshBtn"
114
+ class="button ac-button is-primary is-refresh is-transparent"
115
+ :class="{ spin: isLoaderActive }"
116
+ @click.prevent="$emit('refresh-btn-click')"
117
+ >
118
+ <i class="fa fa-refresh" />
119
+ </button>
120
+ <multiselect
121
+ ref="multiselectElement"
122
+ v-model="model"
123
+ :track-by="trackBy"
124
+ :label="showBy"
125
+ :class="multiselectCustomClass"
126
+ :options="options"
127
+ :placeholder="placeholderText"
128
+ :disabled="disabled || isLoaderActive"
129
+ :allow-empty="false"
130
+ :show-labels="false"
131
+ :close-on-select="true"
132
+ :open-direction="openDirection"
133
+ :group-values="groupValues"
134
+ :group-label="groupLabel"
135
+ :group-select="groupSelect"
136
+ data-testid="simple-select-box"
137
+ @open="openDropDown"
138
+ @close="closeDropDown"
139
+ @select="onSelect"
140
+ @remove="onRemove"
141
+ >
142
+ <template #noResult>
143
+ <span> {{ noResultText }} </span>
144
+ </template>
145
+ </multiselect>
146
+ <p v-show="errorMsg" class="is-danger">
147
+ {{ errorMsg }}
148
+ </p>
149
+ </div>
150
+ </template>