sprintify-ui 0.0.150 → 0.0.151

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.
@@ -1,19 +1,24 @@
1
1
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
2
  modelValue?: string | null | undefined;
3
3
  collection?: string | undefined;
4
+ maxWidth?: string | undefined;
4
5
  }>, {
5
6
  modelValue: null;
6
7
  collection: string;
8
+ maxWidth: string;
7
9
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
8
10
  modelValue?: string | null | undefined;
9
11
  collection?: string | undefined;
12
+ maxWidth?: string | undefined;
10
13
  }>, {
11
14
  modelValue: null;
12
15
  collection: string;
16
+ maxWidth: string;
13
17
  }>>> & {
14
18
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
15
19
  }, {
16
20
  modelValue: string | null;
21
+ maxWidth: string;
17
22
  collection: string;
18
23
  }>;
19
24
  export default _default;
@@ -49,6 +49,7 @@ declare const messages: {
49
49
  remove: string;
50
50
  remove_file: string;
51
51
  remove_file_description: string;
52
+ search: string;
52
53
  see_all_notifications: string;
53
54
  select_an_item: string;
54
55
  select_an_option: string;
@@ -116,6 +117,7 @@ declare const messages: {
116
117
  remove: string;
117
118
  remove_file: string;
118
119
  remove_file_description: string;
120
+ search: string;
119
121
  see_all_notifications: string;
120
122
  select_an_item: string;
121
123
  select_an_option: string;
@@ -196,6 +198,7 @@ declare const config: {
196
198
  remove: string;
197
199
  remove_file: string;
198
200
  remove_file_description: string;
201
+ search: string;
199
202
  see_all_notifications: string;
200
203
  select_an_item: string;
201
204
  select_an_option: string;
@@ -263,6 +266,7 @@ declare const config: {
263
266
  remove: string;
264
267
  remove_file: string;
265
268
  remove_file_description: string;
269
+ search: string;
266
270
  see_all_notifications: string;
267
271
  select_an_item: string;
268
272
  select_an_option: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.0.150",
3
+ "version": "0.0.151",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -1,9 +1,15 @@
1
1
  <template>
2
- <div class="w-full max-w-[268px] overflow-hidden rounded border bg-white">
3
- <div class="flex w-full min-w-0 overflow-hidden px-3 pt-3">
2
+ <div
3
+ class="w-full overflow-hidden rounded border bg-white"
4
+ :style="{
5
+ maxWidth: maxWidth,
6
+ }"
7
+ >
8
+ <div class="flex w-full min-w-0 overflow-hidden px-2 py-2">
4
9
  <select
5
10
  v-model="suffix"
6
- class="max-w-[80px] shrink-0 rounded-l border-r-0 border-slate-300 text-xs focus:border-slate-300 focus:outline-none focus:ring-0"
11
+ class="max-w-[150px] shrink-0 rounded-l border-r-0 border-slate-300 py-1.5 pl-2 pr-6 focus:border-slate-300 focus:outline-none focus:ring-0 sm:text-sm"
12
+ @change="onSuffixChange"
7
13
  >
8
14
  <option v-for="(label, key) in suffixes" :key="key" :value="key">
9
15
  {{ label }}
@@ -13,12 +19,12 @@
13
19
  <input
14
20
  v-model="keywords"
15
21
  type="text"
16
- :placeholder="$t('sui.autocomplete_placeholder')"
17
- class="grow rounded-r border-slate-300 text-xs"
22
+ :placeholder="$t('sui.search') + '...'"
23
+ class="min-w-[40px] grow rounded-r border-slate-300 py-0 px-2 focus:border-blue-500 focus:ring-2 focus:ring-blue-300 sm:text-sm"
18
24
  />
19
25
  </div>
20
26
 
21
- <div ref="drawer" class="h-44 overflow-y-auto py-2 px-3">
27
+ <div ref="drawer" class="h-44 overflow-y-auto px-2 pb-2">
22
28
  <ul class="flex flex-wrap">
23
29
  <li v-for="icon in filteredIcons" :key="icon">
24
30
  <button
@@ -27,7 +33,7 @@
27
33
  :class="[
28
34
  modelValue == icon
29
35
  ? 'bg-primary-600 text-white'
30
- : 'bg-white text-slate-900 hover:bg-slate-200',
36
+ : 'bg-white text-slate-800 hover:bg-slate-200',
31
37
  ]"
32
38
  class="flex items-center justify-center rounded p-1"
33
39
  @click="onClick(icon)"
@@ -47,10 +53,12 @@ const props = withDefaults(
47
53
  defineProps<{
48
54
  modelValue?: string | null;
49
55
  collection?: string;
56
+ maxWidth?: string;
50
57
  }>(),
51
58
  {
52
59
  modelValue: null,
53
60
  collection: 'heroicons',
61
+ maxWidth: '300px',
54
62
  }
55
63
  );
56
64
 
@@ -62,6 +70,11 @@ function onClick(icon: string) {
62
70
 
63
71
  const icons = ref<string[]>([]);
64
72
  const suffixes = ref<Record<string, string>>({});
73
+ const orderedSuffixKeys = computed(() => {
74
+ return Object.keys(suffixes.value).sort((a, b) => {
75
+ return b.length - a.length;
76
+ });
77
+ });
65
78
  const suffix = ref<string | null>(null);
66
79
  const otherSuffixValue = computed(() => {
67
80
  return Object.keys(suffixes.value).filter((s) => {
@@ -139,12 +152,8 @@ function selectCurrentSuffix() {
139
152
  return;
140
153
  }
141
154
 
142
- const suffixesOrderedByLength = Object.keys(suffixes.value).sort((a, b) => {
143
- return b.length - a.length;
144
- });
145
-
146
- for (let i = 0; i < suffixesOrderedByLength.length; i++) {
147
- const s = suffixesOrderedByLength[i];
155
+ for (let i = 0; i < orderedSuffixKeys.value.length; i++) {
156
+ const s = orderedSuffixKeys.value[i];
148
157
 
149
158
  if (props.modelValue.endsWith(s)) {
150
159
  suffix.value = s;
@@ -174,6 +183,31 @@ function scrollToIcon() {
174
183
  drawer.value.scrollTop = icon.offsetTop - 10;
175
184
  }
176
185
 
186
+ function onSuffixChange() {
187
+ nextTick(() => {
188
+ let iconWithoutSuffix = props.modelValue ?? '';
189
+
190
+ orderedSuffixKeys.value.forEach((s) => {
191
+ let completeSuffix = s;
192
+
193
+ if (completeSuffix != '') {
194
+ completeSuffix = '-' + completeSuffix;
195
+ }
196
+
197
+ const regex = new RegExp(completeSuffix + '$');
198
+
199
+ iconWithoutSuffix = iconWithoutSuffix.replace(regex, '');
200
+ });
201
+
202
+ let suffixToAdd = suffix.value;
203
+ if (suffixToAdd != '') {
204
+ suffixToAdd = '-' + suffixToAdd;
205
+ }
206
+
207
+ emit('update:modelValue', iconWithoutSuffix + suffixToAdd);
208
+ });
209
+ }
210
+
177
211
  onMounted(() => {
178
212
  fetchIcons();
179
213
  });
package/src/lang/en.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "remove": "Remove",
41
41
  "remove_file": "Remove file?",
42
42
  "remove_file_description": "Are you sure you want to remove the file? This action is irreversible.",
43
+ "search": "Search",
43
44
  "see_all_notifications": "See all notifications",
44
45
  "select_an_item": "Select an item",
45
46
  "select_an_option": "Select an option",
package/src/lang/fr.json CHANGED
@@ -40,6 +40,7 @@
40
40
  "remove": "Retirer",
41
41
  "remove_file": "Retirer le fichier?",
42
42
  "remove_file_description": "Voulez-vous vraiment supprimer le fichier ? \nCette action est irréversible.",
43
+ "search": "Rechercher",
43
44
  "see_all_notifications": "Voir toutes les notifications",
44
45
  "select_an_item": "Sélectionner un élément",
45
46
  "select_an_option": "Sélectionner une option",