sprintify-ui 0.2.30 → 0.4.1

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,21 +1,23 @@
1
1
  <template>
2
2
  <li
3
+ ref="itemRef"
3
4
  class="group flex h-10 items-center justify-between"
4
- :class="[draggable ? 'pr-2' : 'px-2']"
5
+ :class="[xs ? 'h-9' : 'h-10']"
5
6
  >
6
7
  <div
7
8
  v-if="draggable && !disabled"
8
- class="handle shrink-0 cursor-move px-1"
9
+ class="handle shrink-0 cursor-move pr-1"
9
10
  >
10
11
  <BaseIcon
11
12
  icon="mdi:drag"
12
- class="h-5 w-5 text-slate-400"
13
+ class="text-slate-400 w-5 h-5"
13
14
  />
14
15
  </div>
15
16
  <div class="mr-2 shrink-0">
16
17
  <BaseIcon
17
18
  icon="heroicons-solid:paper-clip"
18
- class="h-5 w-5 shrink-0 text-slate-400"
19
+ class="shrink-0 text-slate-400"
20
+ :class="[xs ? 'w-4 h-4' : 'h-5 w-5']"
19
21
  />
20
22
  </div>
21
23
  <div class="flex grow items-center gap-3 overflow-hidden">
@@ -29,14 +31,18 @@
29
31
  class="flex h-10 items-center overflow-hidden"
30
32
  @click="editName()"
31
33
  >
32
- <span class="mr-2 truncate text-sm">{{ fileName }}</span>
34
+ <span
35
+ class="mr-2 truncate"
36
+ :class="[xs ? 'text-sm' : 'text-sm']"
37
+ >{{ fileName }}</span>
33
38
  <div
34
39
  v-if="!disabled"
35
40
  class="text-center opacity-0 group-hover:opacity-100"
36
41
  >
37
42
  <BaseIcon
38
43
  icon="heroicons-solid:pencil"
39
- class="h-5 w-5 shrink-0 text-slate-400"
44
+ class="shrink-0 text-slate-400"
45
+ :class="[xs ? 'w-4 h-4' : 'h-5 w-5']"
40
46
  />
41
47
  </div>
42
48
  </button>
@@ -49,6 +55,7 @@
49
55
  <input
50
56
  ref="inputRef"
51
57
  class="h-8 w-full max-w-md rounded border border-slate-300 px-2 py-0 focus:ring-0"
58
+ :class="[xs ? 'text-sm' : 'text-sm']"
52
59
  type="text"
53
60
  :value="name"
54
61
  autofocus
@@ -60,7 +67,8 @@
60
67
  <div class="flex shrink-0 items-center">
61
68
  <button
62
69
  type="button"
63
- class="h-10 shrink-0 pr-2 pl-3 text-sm text-blue-600"
70
+ class="h-10 shrink-0 pr-2 pl-3 text-blue-600"
71
+ :class="[xs ? 'text-sm' : 'text-sm']"
64
72
  @click="saveName"
65
73
  >
66
74
  {{ t('sui.save') }}
@@ -76,13 +84,18 @@
76
84
  class="shrink-0 text-sm disabled:opacity-50"
77
85
  @click="$emit('remove')"
78
86
  >
79
- <span class="hidden sm:inline">
80
- {{ t('sui.delete') }}
81
- </span>
82
87
  <BaseIcon
88
+ v-if="sm || xs"
83
89
  icon="heroicons-solid:x"
84
- class="h-5 w-5 shrink-0 text-slate-400 sm:hidden"
90
+ class="shrink-0 text-slate-400"
91
+ :class="[xs ? 'w-4 h-4' : 'h-5 w-5']"
85
92
  />
93
+ <span
94
+ v-else
95
+ class="inline"
96
+ >
97
+ {{ t('sui.delete') }}
98
+ </span>
86
99
  </button>
87
100
  <a
88
101
  v-if="url"
@@ -90,13 +103,19 @@
90
103
  class="shrink-0 text-sm text-blue-600"
91
104
  target="_blank"
92
105
  >
93
- <span class="hidden sm:inline">
94
- {{ t('sui.download') }}
95
- </span>
96
106
  <BaseIcon
107
+ v-if="sm || xs"
97
108
  icon="heroicons-solid:download"
98
- class="h-5 w-5 shrink-0 text-slate-400 sm:hidden"
109
+ class="shrink-0 text-slate-400"
110
+ :class="[xs ? 'w-4 h-4' : 'h-5 w-5']"
99
111
  />
112
+ <span
113
+ v-else
114
+ class="inline"
115
+ >
116
+ {{ t('sui.download') }}
117
+ </span>
118
+
100
119
  </a>
101
120
  </div>
102
121
  </div>
@@ -110,6 +129,8 @@ import { PropType } from 'vue';
110
129
  import { Icon as BaseIcon } from '@iconify/vue';
111
130
  import { cloneDeep } from 'lodash';
112
131
  import { t } from '@/i18n';
132
+ import { useResizeObserver } from '@vueuse/core';
133
+ import breakpoints from '../../config/breakpoints.json';
113
134
 
114
135
  const emit = defineEmits(['remove', 'update', 'save:name']);
115
136
 
@@ -132,6 +153,21 @@ const props = defineProps({
132
153
  },
133
154
  });
134
155
 
156
+ const width = ref(800);
157
+ const itemRef = ref<HTMLLIElement | null>();
158
+
159
+ useResizeObserver(itemRef, () => {
160
+ width.value = itemRef.value?.clientWidth ?? 800;
161
+ });
162
+
163
+ const xs = computed((): boolean => {
164
+ return width.value <= breakpoints.xs;
165
+ });
166
+
167
+ const sm = computed((): boolean => {
168
+ return breakpoints.sm >= width.value && width.value > breakpoints.xs;
169
+ });
170
+
135
171
  const viewMode = ref<'show' | 'edit'>('show');
136
172
 
137
173
  const name = computed(() => {
@@ -9,7 +9,7 @@ export const useSystemAlertStore = defineStore('systemAlerts', {
9
9
  };
10
10
  },
11
11
  actions: {
12
- push(systemAlert: SystemAlertOptions) {
12
+ push(systemAlert: SystemAlertOptions): string | number {
13
13
  this.count++;
14
14
  this.systemAlerts.push({
15
15
  id: this.count,
@@ -19,12 +19,11 @@ export const useSystemAlertStore = defineStore('systemAlerts', {
19
19
  action: systemAlert.action,
20
20
  closable: systemAlert.closable ?? false,
21
21
  });
22
+
23
+ return this.count;
22
24
  },
23
- remove(systemAlert: SystemAlert) {
24
- this.systemAlerts.splice(
25
- this.systemAlerts.findIndex((a) => a.id === systemAlert.id),
26
- 1
27
- );
25
+ remove(alertId: number | string) {
26
+ this.systemAlerts = this.systemAlerts.filter((alert) => alert.id !== alertId);
28
27
  },
29
28
  clear() {
30
29
  this.systemAlerts = [];