sprintify-ui 0.6.88 → 0.7.0
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/README.md +11 -11
- package/dist/sprintify-ui.es.js +245 -244
- package/dist/tailwindcss/theme.js +1 -1
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/stores/snackbars.d.ts +19 -0
- package/dist/types/types/index.d.ts +4 -4
- package/package.json +1 -1
- package/src/components/BaseApp.vue +2 -2
- package/src/components/{BaseAppNotifications.vue → BaseAppSnackbars.vue} +9 -9
- package/src/components/BaseCropper.stories.js +3 -3
- package/src/components/BaseCropperModal.stories.js +3 -3
- package/src/components/BaseDataTable.stories.js +3 -3
- package/src/components/BaseDataTable.vue +4 -4
- package/src/components/BaseFilePicker.stories.js +3 -3
- package/src/components/BaseFilePicker.vue +4 -4
- package/src/components/BaseFilePickerCrop.stories.js +3 -3
- package/src/components/BaseFileUploader.stories.js +3 -3
- package/src/components/BaseFileUploader.vue +3 -3
- package/src/components/BaseForm.stories.js +3 -0
- package/src/components/BaseForm.vue +4 -4
- package/src/components/BaseHasMany.stories.js +5 -5
- package/src/components/BaseMediaLibrary.vue +3 -3
- package/src/components/BaseTagAutocomplete.stories.js +11 -5
- package/src/components/BaseTagAutocomplete.vue +3 -3
- package/src/components/BaseTagAutocompleteFetch.stories.js +3 -3
- package/src/components/index.ts +2 -2
- package/src/index.ts +2 -1
- package/src/stores/{notifications.ts → snackbars.ts} +15 -13
- package/src/stories/List.stories.js +3 -3
- package/src/stories/PageShow.vue +4 -4
- package/src/types/index.ts +4 -4
- package/dist/types/stores/notifications.d.ts +0 -10
- /package/dist/types/components/{BaseAppNotifications.vue.d.ts → BaseAppSnackbars.vue.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BaseTagAutocompleteFetch from './BaseTagAutocompleteFetch.vue';
|
|
2
2
|
import ShowValue from '@/../.storybook/components/ShowValue.vue';
|
|
3
3
|
import { createFieldStory } from '../../.storybook/utils';
|
|
4
|
-
import
|
|
4
|
+
import BaseAppSnackbars from './BaseAppSnackbars.vue';
|
|
5
5
|
|
|
6
6
|
const sizes = ['xs', 'sm', 'md'];
|
|
7
7
|
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
|
|
25
25
|
const Template = (args) => {
|
|
26
26
|
return {
|
|
27
|
-
components: { BaseTagAutocompleteFetch, ShowValue,
|
|
27
|
+
components: { BaseTagAutocompleteFetch, ShowValue, BaseAppSnackbars },
|
|
28
28
|
setup() {
|
|
29
29
|
const value = ref([]);
|
|
30
30
|
return { args, value };
|
|
@@ -35,7 +35,7 @@ const Template = (args) => {
|
|
|
35
35
|
v-bind="args"
|
|
36
36
|
></BaseTagAutocompleteFetch>
|
|
37
37
|
<ShowValue :value="value" />
|
|
38
|
-
<
|
|
38
|
+
<BaseAppSnackbars />
|
|
39
39
|
`,
|
|
40
40
|
};
|
|
41
41
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import BaseAddressForm from './BaseAddressForm.vue';
|
|
|
3
3
|
import BaseAlert from './BaseAlert.vue';
|
|
4
4
|
import BaseApp from './BaseApp.vue';
|
|
5
5
|
import BaseAppDialogs from './BaseAppDialogs.vue';
|
|
6
|
-
import
|
|
6
|
+
import BaseAppSnackbars from './BaseAppSnackbars.vue';
|
|
7
7
|
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
8
8
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
9
9
|
import BaseAvatar from './BaseAvatar.vue';
|
|
@@ -109,7 +109,7 @@ export {
|
|
|
109
109
|
BaseAlert,
|
|
110
110
|
BaseApp,
|
|
111
111
|
BaseAppDialogs,
|
|
112
|
-
|
|
112
|
+
BaseAppSnackbars,
|
|
113
113
|
BaseAutocomplete,
|
|
114
114
|
BaseAutocompleteFetch,
|
|
115
115
|
BaseAvatar,
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import QueryString from 'qs';
|
|
|
5
5
|
import en from '@/lang/en.json';
|
|
6
6
|
import fr from '@/lang/fr.json';
|
|
7
7
|
import { useDialogsStore } from './stores/dialogs';
|
|
8
|
-
import { useNotificationsStore } from './stores/
|
|
8
|
+
import { useSnackbarsStore, useNotificationsStore } from './stores/snackbars';
|
|
9
9
|
import { useSystemAlertStore } from './stores/systemAlerts';
|
|
10
10
|
import { useClickOutside } from './composables/clickOutside';
|
|
11
11
|
import { useField } from './composables/field';
|
|
@@ -124,6 +124,7 @@ export { messages };
|
|
|
124
124
|
export { config };
|
|
125
125
|
|
|
126
126
|
export { useDialogsStore };
|
|
127
|
+
export { useSnackbarsStore };
|
|
127
128
|
export { useNotificationsStore };
|
|
128
129
|
export { useSystemAlertStore };
|
|
129
130
|
export { useClickOutside };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
|
-
import {
|
|
2
|
+
import { Snackbar, SnackbarOptions } from '../types';
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const useSnackbarsStore = defineStore('notifications', {
|
|
5
5
|
state: () => {
|
|
6
6
|
return {
|
|
7
7
|
count: 0,
|
|
8
|
-
|
|
8
|
+
snackbars: [] as Snackbar[],
|
|
9
9
|
timeouts: {} as Record<number, number>,
|
|
10
10
|
};
|
|
11
11
|
},
|
|
12
12
|
actions: {
|
|
13
|
-
push(options:
|
|
13
|
+
push(options: SnackbarOptions) {
|
|
14
14
|
this.count++;
|
|
15
15
|
|
|
16
16
|
const id = this.count;
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const snackbar = {
|
|
19
19
|
id: id,
|
|
20
20
|
color: options.color ?? 'info',
|
|
21
21
|
title: options.title,
|
|
@@ -23,21 +23,21 @@ export const useNotificationsStore = defineStore('notifications', {
|
|
|
23
23
|
duration: options.duration ?? 3000,
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
this.
|
|
26
|
+
this.snackbars.push(snackbar);
|
|
27
27
|
|
|
28
28
|
this.timeouts[id] = setTimeout(() => {
|
|
29
|
-
this.remove(
|
|
30
|
-
},
|
|
29
|
+
this.remove(snackbar);
|
|
30
|
+
}, snackbar.duration);
|
|
31
31
|
},
|
|
32
|
-
remove(
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
32
|
+
remove(snackbar: Snackbar) {
|
|
33
|
+
this.snackbars.splice(
|
|
34
|
+
this.snackbars.findIndex((n) => n.id === snackbar.id),
|
|
35
35
|
1
|
|
36
36
|
);
|
|
37
|
-
clearTimeout(this.timeouts[
|
|
37
|
+
clearTimeout(this.timeouts[snackbar.id]);
|
|
38
38
|
},
|
|
39
39
|
clear() {
|
|
40
|
-
this.
|
|
40
|
+
this.snackbars = [];
|
|
41
41
|
Object.values(this.timeouts).forEach((timeout) => {
|
|
42
42
|
clearTimeout(timeout);
|
|
43
43
|
});
|
|
@@ -45,3 +45,5 @@ export const useNotificationsStore = defineStore('notifications', {
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
});
|
|
48
|
+
|
|
49
|
+
export const useNotificationsStore = useSnackbarsStore;
|
|
@@ -7,7 +7,7 @@ import BaseBoolean from '../components/BaseBoolean.vue';
|
|
|
7
7
|
import BaseSelect from '../components/BaseSelect.vue';
|
|
8
8
|
import BaseBadge from '../components/BaseBadge.vue';
|
|
9
9
|
import BaseCounter from '../components/BaseCounter.vue';
|
|
10
|
-
import
|
|
10
|
+
import BaseAppSnackbars from '../components/BaseAppSnackbars.vue';
|
|
11
11
|
import BaseAppDialogs from '../components/BaseAppDialogs.vue';
|
|
12
12
|
import BaseContainer from '../components/BaseContainer.vue';
|
|
13
13
|
import { DateTime } from 'luxon';
|
|
@@ -83,7 +83,7 @@ const templateComponents = {
|
|
|
83
83
|
BaseBoolean,
|
|
84
84
|
BaseSelect,
|
|
85
85
|
BaseBadge,
|
|
86
|
-
|
|
86
|
+
BaseAppSnackbars,
|
|
87
87
|
BaseAppDialogs,
|
|
88
88
|
BaseCounter,
|
|
89
89
|
BaseContainer,
|
|
@@ -111,7 +111,7 @@ const template = `
|
|
|
111
111
|
|
|
112
112
|
${templateDataTable}
|
|
113
113
|
|
|
114
|
-
<
|
|
114
|
+
<BaseAppSnackbars></BaseAppSnackbars>
|
|
115
115
|
<BaseAppDialogs></BaseAppDialogs>
|
|
116
116
|
</BaseContainer>
|
|
117
117
|
</div>
|
package/src/stories/PageShow.vue
CHANGED
|
@@ -361,13 +361,13 @@
|
|
|
361
361
|
</div>
|
|
362
362
|
</BaseContainer>
|
|
363
363
|
|
|
364
|
-
<
|
|
364
|
+
<BaseAppSnackbars />
|
|
365
365
|
<BaseAppDialogs />
|
|
366
366
|
</div>
|
|
367
367
|
</template>
|
|
368
368
|
|
|
369
369
|
<script lang="ts" setup>
|
|
370
|
-
import {
|
|
370
|
+
import { useSnackbarsStore } from '..';
|
|
371
371
|
|
|
372
372
|
import BaseCard from '@/components/BaseCard.vue';
|
|
373
373
|
import BaseCardRow from '@/components/BaseCardRow.vue';
|
|
@@ -380,7 +380,7 @@ import BaseTimeline from '@/components/BaseTimeline.vue';
|
|
|
380
380
|
import { BaseIcon } from '../components/index';
|
|
381
381
|
import BaseContainer from '@/components/BaseContainer.vue';
|
|
382
382
|
import BaseClipboard from '@/components/BaseClipboard.vue';
|
|
383
|
-
import
|
|
383
|
+
import BaseAppSnackbars from '@/components/BaseAppSnackbars.vue';
|
|
384
384
|
import BaseAppDialogs from '@/components/BaseAppDialogs.vue';
|
|
385
385
|
|
|
386
386
|
const timelineItems = [
|
|
@@ -415,7 +415,7 @@ const timelineItems = [
|
|
|
415
415
|
];
|
|
416
416
|
|
|
417
417
|
function showAlert(text: string) {
|
|
418
|
-
|
|
418
|
+
useSnackbarsStore().push({
|
|
419
419
|
title: text,
|
|
420
420
|
text: text,
|
|
421
421
|
color: 'success'
|
package/src/types/index.ts
CHANGED
|
@@ -170,17 +170,17 @@ export interface Dialog {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
*
|
|
173
|
+
* Snackbar
|
|
174
174
|
*/
|
|
175
175
|
|
|
176
|
-
export interface
|
|
176
|
+
export interface SnackbarOptions {
|
|
177
177
|
title: string;
|
|
178
178
|
text: string;
|
|
179
179
|
color?: 'info' | 'success' | 'danger' | 'warning';
|
|
180
180
|
duration?: number;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
export interface
|
|
183
|
+
export interface Snackbar {
|
|
184
184
|
id: number;
|
|
185
185
|
title: string;
|
|
186
186
|
text: string;
|
|
@@ -189,7 +189,7 @@ export interface Notification {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
*
|
|
192
|
+
* Notification
|
|
193
193
|
*/
|
|
194
194
|
|
|
195
195
|
export interface NotificationsConfig {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Notification, NotificationOptions } from '../types';
|
|
2
|
-
export declare const useNotificationsStore: import("pinia").StoreDefinition<"notifications", {
|
|
3
|
-
count: number;
|
|
4
|
-
notifications: Notification[];
|
|
5
|
-
timeouts: Record<number, number>;
|
|
6
|
-
}, {}, {
|
|
7
|
-
push(options: NotificationOptions): void;
|
|
8
|
-
remove(notification: Notification): void;
|
|
9
|
-
clear(): void;
|
|
10
|
-
}>;
|
|
File without changes
|