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.
- package/dist/sprintify-ui.es.js +4535 -4509
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +5 -7
- package/dist/types/src/components/BaseMediaLibrary.vue.d.ts +5 -5
- package/dist/types/src/stores/systemAlerts.d.ts +2 -2
- package/package.json +3 -2
- package/src/components/BaseFilePicker.vue +1 -4
- package/src/components/BaseFileUploader.stories.js +14 -2
- package/src/components/BaseFileUploader.vue +40 -29
- package/src/components/BaseLayoutSidebar.vue +18 -18
- package/src/components/BaseLayoutStacked.vue +1 -1
- package/src/components/BaseMediaLibrary.vue +62 -43
- package/src/components/BaseMediaListItem.vue +51 -15
- package/src/stores/systemAlerts.ts +5 -6
|
@@ -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="[
|
|
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
|
|
9
|
+
class="handle shrink-0 cursor-move pr-1"
|
|
9
10
|
>
|
|
10
11
|
<BaseIcon
|
|
11
12
|
icon="mdi:drag"
|
|
12
|
-
class="
|
|
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="
|
|
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
|
|
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="
|
|
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-
|
|
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="
|
|
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="
|
|
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(
|
|
24
|
-
this.systemAlerts.
|
|
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 = [];
|