@onereach/ui-components 2.77.0-beta.2456.0 → 2.77.0-beta.2460.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/dist/bundled/v2/components/OrCarousel/OrCarouselItem.vue.d.ts +2 -0
- package/dist/bundled/v2/components/OrCarousel/index.d.ts +1 -2
- package/dist/bundled/v2/components/OrChips/OrChip.vue.d.ts +58 -0
- package/dist/bundled/v2/components/OrChips/index.d.ts +1 -2
- package/dist/bundled/v2/components/OrColorPicker/OrColorPicker.js +1 -1
- package/dist/bundled/v2/components/OrColorPicker/defultPalette.d.ts +2 -0
- package/dist/bundled/v2/components/OrColorPicker/index.js +1 -1
- package/dist/bundled/v2/components/OrColorPicker/utils/defultPalette.js +15 -0
- package/dist/bundled/v2/components/OrSkeleton/OrSkeletonCircle.vue.d.ts +43 -0
- package/dist/bundled/v2/components/OrSkeleton/OrSkeletonRect.vue.d.ts +56 -0
- package/dist/bundled/v2/components/OrSkeleton/OrSkeletonText.vue.d.ts +73 -0
- package/dist/bundled/v2/components/OrSkeleton/index.d.ts +2 -4
- package/dist/bundled/v2/components/OrSkeletonV3/OrSkeletonCircle.vue.d.ts +51 -0
- package/dist/bundled/v2/components/OrSkeletonV3/OrSkeletonRect.vue.d.ts +60 -0
- package/dist/bundled/v2/components/OrSkeletonV3/OrSkeletonText.vue.d.ts +96 -0
- package/dist/bundled/v2/components/OrSkeletonV3/index.d.ts +1 -3
- package/dist/bundled/v2/components/OrToast/OrToastContainer.vue.d.ts +93 -0
- package/dist/bundled/v2/components/OrToast/composable/index.js +7 -0
- package/dist/bundled/v2/components/OrToast/composable/useQueue.js +33 -0
- package/dist/bundled/v2/components/OrToast/composable/useToast.js +82 -0
- package/dist/bundled/v2/components/OrToast/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v2/components/OrToast/index.d.ts +5 -5
- package/dist/bundled/v2/components/OrToast/index.js +3 -3
- package/dist/bundled/v2/components/OrToast/useQueue.d.ts +8 -0
- package/dist/bundled/v2/components/OrToast/useToast.d.ts +13 -0
- package/dist/bundled/v2/components/OrToast/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v2/components/OrToastContainer/OrToastContainer.js +2 -2
- package/dist/bundled/v2/components/OrToastContainer/index.js +3 -3
- package/dist/bundled/v2/components/OrToastContainerV3/OrToastContainer.js +2 -2
- package/dist/bundled/v2/components/OrToastContainerV3/index.js +3 -3
- package/dist/bundled/v2/components/OrToastV3/OrToastContainer.vue.d.ts +85 -0
- package/dist/bundled/v2/components/OrToastV3/composable/index.js +7 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useQueue.js +33 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useToast.js +82 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v2/components/OrToastV3/index.d.ts +4 -5
- package/dist/bundled/v2/components/OrToastV3/index.js +3 -3
- package/dist/bundled/v2/components/OrToastV3/useQueue.d.ts +8 -0
- package/dist/bundled/v2/components/OrToastV3/useToast.d.ts +13 -0
- package/dist/bundled/v2/components/OrToastV3/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v2/components/OrTooltip/OrTooltipContent.vue.d.ts +38 -0
- package/dist/bundled/v2/components/OrTooltip/index.d.ts +1 -2
- package/dist/bundled/v2/components/index.js +7 -7
- package/dist/bundled/v2/index.js +7 -7
- package/dist/bundled/v3/{OrColorPicker.vue_vue_type_script_lang-c29579b4.js → OrColorPicker.vue_vue_type_script_lang-3a799e23.js} +1 -1
- package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-3bb6f082.js → OrToastContainer.vue_vue_type_script_lang-51a3ba56.js} +2 -2
- package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-e98944bc.js → OrToastContainer.vue_vue_type_script_lang-59d729a6.js} +2 -2
- package/dist/bundled/v3/components/OrCarousel/OrCarouselItem.vue.d.ts +2 -0
- package/dist/bundled/v3/components/OrCarousel/index.d.ts +1 -2
- package/dist/bundled/v3/components/OrChips/OrChip.vue.d.ts +58 -0
- package/dist/bundled/v3/components/OrChips/index.d.ts +1 -2
- package/dist/bundled/v3/components/OrColorPicker/OrColorPicker.js +3 -3
- package/dist/bundled/v3/components/OrColorPicker/defultPalette.d.ts +2 -0
- package/dist/bundled/v3/components/OrColorPicker/index.js +2 -2
- package/dist/bundled/v3/components/OrColorPicker/utils/defultPalette.js +15 -0
- package/dist/bundled/v3/components/OrSkeleton/OrSkeletonCircle.vue.d.ts +43 -0
- package/dist/bundled/v3/components/OrSkeleton/OrSkeletonRect.vue.d.ts +56 -0
- package/dist/bundled/v3/components/OrSkeleton/OrSkeletonText.vue.d.ts +73 -0
- package/dist/bundled/v3/components/OrSkeleton/index.d.ts +2 -4
- package/dist/bundled/v3/components/OrSkeletonV3/OrSkeletonCircle.vue.d.ts +51 -0
- package/dist/bundled/v3/components/OrSkeletonV3/OrSkeletonRect.vue.d.ts +60 -0
- package/dist/bundled/v3/components/OrSkeletonV3/OrSkeletonText.vue.d.ts +96 -0
- package/dist/bundled/v3/components/OrSkeletonV3/index.d.ts +1 -3
- package/dist/bundled/v3/components/OrToast/OrToastContainer.vue.d.ts +93 -0
- package/dist/bundled/v3/components/OrToast/composable/index.js +7 -0
- package/dist/bundled/v3/components/OrToast/composable/useQueue.js +33 -0
- package/dist/bundled/v3/components/OrToast/composable/useToast.js +82 -0
- package/dist/bundled/v3/components/OrToast/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v3/components/OrToast/index.d.ts +2 -5
- package/dist/bundled/v3/components/OrToast/index.js +4 -4
- package/dist/bundled/v3/components/OrToast/useQueue.d.ts +8 -0
- package/dist/bundled/v3/components/OrToast/useToast.d.ts +13 -0
- package/dist/bundled/v3/components/OrToast/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +4 -4
- package/dist/bundled/v3/components/OrToastContainer/index.js +4 -4
- package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.js +4 -4
- package/dist/bundled/v3/components/OrToastContainerV3/index.js +4 -4
- package/dist/bundled/v3/components/OrToastV3/OrToastContainer.vue.d.ts +85 -0
- package/dist/bundled/v3/components/OrToastV3/composable/index.js +7 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useQueue.js +33 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useToast.js +82 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v3/components/OrToastV3/index.d.ts +2 -5
- package/dist/bundled/v3/components/OrToastV3/index.js +4 -4
- package/dist/bundled/v3/components/OrToastV3/useQueue.d.ts +8 -0
- package/dist/bundled/v3/components/OrToastV3/useToast.d.ts +13 -0
- package/dist/bundled/v3/components/OrToastV3/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v3/components/OrTooltip/OrTooltipContent.vue.d.ts +38 -0
- package/dist/bundled/v3/components/OrTooltip/index.d.ts +1 -2
- package/dist/bundled/v3/components/index.js +10 -10
- package/dist/bundled/v3/index.js +10 -10
- package/package.json +2 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { PropType } from 'vue-demi';
|
|
2
|
+
import { Position, ToastBehaviour, ToastConfiguration } from '../types';
|
|
3
|
+
import { PositionsX, PositionsY, TransitionType } from '../constants';
|
|
4
|
+
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
5
|
+
on: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
6
|
+
off: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
7
|
+
isActive: import("@vue/composition-api").Ref<boolean>;
|
|
8
|
+
toggle: (value?: boolean | undefined) => boolean;
|
|
9
|
+
queue: import("@vue/composition-api").Ref<import("@vue/composition-api").Ref<ToastConfiguration>[]>;
|
|
10
|
+
addItem: (item: ToastConfiguration) => void;
|
|
11
|
+
removeItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => void;
|
|
12
|
+
clearAll: () => void;
|
|
13
|
+
getItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => import("@vue/composition-api").Ref<ToastConfiguration>;
|
|
14
|
+
}> & import("@vue/composition-api").Data, {
|
|
15
|
+
createToast(toastConfiguration: ToastConfiguration): void;
|
|
16
|
+
toastUpdate(toast: ToastConfiguration): void;
|
|
17
|
+
toastRemove(toast: ToastConfiguration): void;
|
|
18
|
+
onToastEnter(toast: ToastConfiguration): void;
|
|
19
|
+
onToastLeave(toast: ToastConfiguration): void;
|
|
20
|
+
onClick(toastBehaviour: ToastBehaviour): void;
|
|
21
|
+
onToastHidden(): void;
|
|
22
|
+
}, {
|
|
23
|
+
getQueue(): ToastConfiguration[];
|
|
24
|
+
classes(): (Record<string, boolean> | string)[];
|
|
25
|
+
transitionName(): string;
|
|
26
|
+
}, {
|
|
27
|
+
includeHeaderHeight: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
position: {
|
|
32
|
+
type: PropType<Position>;
|
|
33
|
+
default: () => {
|
|
34
|
+
positionX: PositionsX;
|
|
35
|
+
positionY: PositionsY;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
transition: {
|
|
39
|
+
type: PropType<TransitionType>;
|
|
40
|
+
default: TransitionType;
|
|
41
|
+
};
|
|
42
|
+
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
43
|
+
includeHeaderHeight: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
position: {
|
|
48
|
+
type: PropType<Position>;
|
|
49
|
+
default: () => {
|
|
50
|
+
positionX: PositionsX;
|
|
51
|
+
positionY: PositionsY;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
transition: {
|
|
55
|
+
type: PropType<TransitionType>;
|
|
56
|
+
default: TransitionType;
|
|
57
|
+
};
|
|
58
|
+
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
59
|
+
includeHeaderHeight: boolean;
|
|
60
|
+
position: Position;
|
|
61
|
+
transition: TransitionType;
|
|
62
|
+
} & {}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
63
|
+
on: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
64
|
+
off: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
65
|
+
isActive: import("@vue/composition-api").Ref<boolean>;
|
|
66
|
+
toggle: (value?: boolean | undefined) => boolean;
|
|
67
|
+
queue: import("@vue/composition-api").Ref<import("@vue/composition-api").Ref<ToastConfiguration>[]>;
|
|
68
|
+
addItem: (item: ToastConfiguration) => void;
|
|
69
|
+
removeItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => void;
|
|
70
|
+
clearAll: () => void;
|
|
71
|
+
getItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => import("@vue/composition-api").Ref<ToastConfiguration>;
|
|
72
|
+
}>, import("@vue/composition-api").Data, {
|
|
73
|
+
getQueue(): ToastConfiguration[];
|
|
74
|
+
classes(): (Record<string, boolean> | string)[];
|
|
75
|
+
transitionName(): string;
|
|
76
|
+
}, {
|
|
77
|
+
createToast(toastConfiguration: ToastConfiguration): void;
|
|
78
|
+
toastUpdate(toast: ToastConfiguration): void;
|
|
79
|
+
toastRemove(toast: ToastConfiguration): void;
|
|
80
|
+
onToastEnter(toast: ToastConfiguration): void;
|
|
81
|
+
onToastLeave(toast: ToastConfiguration): void;
|
|
82
|
+
onClick(toastBehaviour: ToastBehaviour): void;
|
|
83
|
+
onToastHidden(): void;
|
|
84
|
+
}, {}, {}, {}, {
|
|
85
|
+
includeHeaderHeight: boolean;
|
|
86
|
+
position: Position;
|
|
87
|
+
transition: TransitionType;
|
|
88
|
+
} & {}, {
|
|
89
|
+
includeHeaderHeight: boolean;
|
|
90
|
+
position: Position;
|
|
91
|
+
transition: TransitionType;
|
|
92
|
+
}, true>);
|
|
93
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ref } from 'vue-demi';
|
|
2
|
+
|
|
3
|
+
function useQueue(initialValue) {
|
|
4
|
+
//generic needed! see https://github.com/vuejs/core/issues/2136
|
|
5
|
+
const queue = ref(initialValue || []);
|
|
6
|
+
const addItem = item => {
|
|
7
|
+
const refItem = ref(item);
|
|
8
|
+
queue.value.push(refItem);
|
|
9
|
+
};
|
|
10
|
+
const removeItem = condition => {
|
|
11
|
+
const index = queue.value.findIndex((i, idx, q) => {
|
|
12
|
+
return condition === null || condition === void 0 ? void 0 : condition(i.value, idx, q);
|
|
13
|
+
});
|
|
14
|
+
if (index !== -1) queue.value.splice(index, 1);
|
|
15
|
+
};
|
|
16
|
+
const getItem = condition => {
|
|
17
|
+
return queue.value.filter((i, idx, q) => {
|
|
18
|
+
return condition === null || condition === void 0 ? void 0 : condition(i.value, idx, q);
|
|
19
|
+
})[0];
|
|
20
|
+
};
|
|
21
|
+
const clearAll = () => {
|
|
22
|
+
queue.value = [];
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
queue,
|
|
26
|
+
addItem,
|
|
27
|
+
removeItem,
|
|
28
|
+
clearAll,
|
|
29
|
+
getItem
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { useQueue as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import Timer from '../Timer.js';
|
|
2
|
+
import useToastEventBus from './useToastEventBus.js';
|
|
3
|
+
import { ToastType } from '../constants.js';
|
|
4
|
+
import '@vueuse/core';
|
|
5
|
+
|
|
6
|
+
function useToast(globalToastProps = {}) {
|
|
7
|
+
const {
|
|
8
|
+
emit
|
|
9
|
+
} = useToastEventBus();
|
|
10
|
+
function notify(props, behaviour = {}) {
|
|
11
|
+
const {
|
|
12
|
+
duration = 5000,
|
|
13
|
+
pauseOnHover = true,
|
|
14
|
+
onToastClose,
|
|
15
|
+
onToastClick
|
|
16
|
+
} = behaviour;
|
|
17
|
+
const propsData = {
|
|
18
|
+
...props,
|
|
19
|
+
...globalToastProps
|
|
20
|
+
};
|
|
21
|
+
const config = {
|
|
22
|
+
toastProps: propsData,
|
|
23
|
+
//generate ToastHash
|
|
24
|
+
hash: Math.random().toString(36).slice(2),
|
|
25
|
+
...(Number.isInteger(duration) && {
|
|
26
|
+
timer: new Timer()
|
|
27
|
+
}),
|
|
28
|
+
toastBehaviour: {
|
|
29
|
+
duration,
|
|
30
|
+
pauseOnHover,
|
|
31
|
+
onToastClose,
|
|
32
|
+
onToastClick
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
emit('toastNotify', config);
|
|
36
|
+
return {
|
|
37
|
+
close: () => emit('toastClose', config),
|
|
38
|
+
update: data => emit('toastUpdate', {
|
|
39
|
+
...config,
|
|
40
|
+
toastProps: {
|
|
41
|
+
...config.toastProps,
|
|
42
|
+
...data
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function clearAll() {
|
|
48
|
+
emit('toastCloseAll');
|
|
49
|
+
}
|
|
50
|
+
function success(props, behaviour = {}) {
|
|
51
|
+
return notify({
|
|
52
|
+
...props,
|
|
53
|
+
toastType: ToastType.success
|
|
54
|
+
}, behaviour);
|
|
55
|
+
}
|
|
56
|
+
function error(props, behaviour = {}) {
|
|
57
|
+
return notify({
|
|
58
|
+
...props,
|
|
59
|
+
toastType: ToastType.error
|
|
60
|
+
}, behaviour);
|
|
61
|
+
}
|
|
62
|
+
function loading(props, behaviour = {}) {
|
|
63
|
+
return notify({
|
|
64
|
+
...props,
|
|
65
|
+
toastType: ToastType.loading,
|
|
66
|
+
dismissible: false
|
|
67
|
+
}, {
|
|
68
|
+
...behaviour,
|
|
69
|
+
duration: 0 // <- toast with type "loading" will not cloe automatically
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
notify,
|
|
75
|
+
clearAll,
|
|
76
|
+
success,
|
|
77
|
+
error,
|
|
78
|
+
loading
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { useToast as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createSharedComposable, useEventBus } from '@vueuse/core';
|
|
2
|
+
|
|
3
|
+
const useToastEventBus = () => {
|
|
4
|
+
const busPull = {
|
|
5
|
+
toastNotify: useEventBus('toastNotify'),
|
|
6
|
+
toastClose: useEventBus('toastClose'),
|
|
7
|
+
toastCloseAll: useEventBus('toastCloseAll'),
|
|
8
|
+
toastUpdate: useEventBus('toastUpdate')
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
on: (namedQueue, listener) => {
|
|
12
|
+
busPull[namedQueue].on(listener);
|
|
13
|
+
},
|
|
14
|
+
off: (namedQueue, listener) => {
|
|
15
|
+
busPull[namedQueue].off(listener);
|
|
16
|
+
},
|
|
17
|
+
emit: (namedQueue, data) => {
|
|
18
|
+
busPull[namedQueue].emit(data);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
var useToastEventBus$1 = createSharedComposable(useToastEventBus);
|
|
23
|
+
|
|
24
|
+
export { useToastEventBus$1 as default };
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as
|
|
3
|
-
export * from './composable';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './constants';
|
|
1
|
+
export { default as useToast } from './useToast';
|
|
2
|
+
export { default as useQueue } from './useQueue';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { PositionsX, PositionsY, ToastType, TransitionType } from './constants.js';
|
|
2
2
|
export { default as OrToast } from './OrToast.js';
|
|
3
|
-
export { s as OrToastContainer } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
4
|
-
export { default as useToast } from '
|
|
5
|
-
export { default as useQueue } from '
|
|
3
|
+
export { s as OrToastContainer } from '../../OrToastContainer.vue_vue_type_script_lang-51a3ba56.js';
|
|
4
|
+
export { default as useToast } from './composable/useToast.js';
|
|
5
|
+
export { default as useQueue } from './composable/useQueue.js';
|
|
6
6
|
import 'vue-demi';
|
|
7
7
|
import '../OrProgress/OrProgress.js';
|
|
8
8
|
import '../../OrProgress.vue_vue_type_script_lang-26d7b3da.js';
|
|
@@ -32,5 +32,5 @@ import '../OrLoader/OrLoader.js';
|
|
|
32
32
|
import '../../OrLoader.vue_vue_type_script_lang-b48715a3.js';
|
|
33
33
|
import '../OrLoader/constants.js';
|
|
34
34
|
import '@vueuse/core';
|
|
35
|
-
import '
|
|
35
|
+
import './composable/useToastEventBus.js';
|
|
36
36
|
import './Timer.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref } from 'vue-demi';
|
|
2
|
+
export default function useQueue<T>(initialValue?: Array<T>): {
|
|
3
|
+
queue: Ref<Ref<T>[]>;
|
|
4
|
+
addItem: (item: T) => void;
|
|
5
|
+
removeItem: (condition: (i: T, index: number, queue: Ref<T>[]) => boolean) => void;
|
|
6
|
+
clearAll: () => void;
|
|
7
|
+
getItem: (condition: (i: T, index: number, queue: Ref<T>[]) => boolean) => Ref<T>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToastBehaviour, ToastProps } from '../types';
|
|
2
|
+
interface UseToastNotifyReturns {
|
|
3
|
+
close: () => void;
|
|
4
|
+
update: (data: ToastProps) => void;
|
|
5
|
+
}
|
|
6
|
+
export default function useToast(globalToastProps?: ToastProps): {
|
|
7
|
+
notify: (props: ToastProps, behaviour?: ToastBehaviour) => UseToastNotifyReturns;
|
|
8
|
+
clearAll: () => void;
|
|
9
|
+
success: (props: ToastProps, behaviour?: ToastBehaviour) => UseToastNotifyReturns;
|
|
10
|
+
error: (props: ToastProps, behaviour?: ToastBehaviour) => UseToastNotifyReturns;
|
|
11
|
+
loading: (props: ToastProps, behaviour?: ToastBehaviour) => UseToastNotifyReturns;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EventBusListener } from '@vueuse/core';
|
|
2
|
+
import { ToastConfiguration } from '../types';
|
|
3
|
+
export type ToastEventsBusEvents = 'toastNotify' | 'toastClose' | 'toastCloseAll' | 'toastUpdate';
|
|
4
|
+
declare const _default: () => {
|
|
5
|
+
on: (namedQueue: ToastEventsBusEvents, listener: EventBusListener<ToastConfiguration, any>) => void;
|
|
6
|
+
off: (namedQueue: ToastEventsBusEvents, listener: EventBusListener<ToastConfiguration, any>) => void;
|
|
7
|
+
emit: (namedQueue: ToastEventsBusEvents, data?: ToastConfiguration | undefined) => void;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as script } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
2
|
-
export { s as default } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
1
|
+
import { s as script } from '../../OrToastContainer.vue_vue_type_script_lang-51a3ba56.js';
|
|
2
|
+
export { s as default } from '../../OrToastContainer.vue_vue_type_script_lang-51a3ba56.js';
|
|
3
3
|
import { resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createVNode, TransitionGroup, createElementBlock, Fragment, renderList, mergeProps, createCommentVNode } from 'vue';
|
|
4
4
|
import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
|
|
5
5
|
import '../OrToast/OrToast.js';
|
|
@@ -31,8 +31,8 @@ import '../OrLoader/OrLoader.js';
|
|
|
31
31
|
import '../../OrLoader.vue_vue_type_script_lang-b48715a3.js';
|
|
32
32
|
import '../OrLoader/constants.js';
|
|
33
33
|
import '@vueuse/core';
|
|
34
|
-
import '../
|
|
35
|
-
import '../
|
|
34
|
+
import '../OrToast/composable/useQueue.js';
|
|
35
|
+
import '../OrToast/composable/useToastEventBus.js';
|
|
36
36
|
|
|
37
37
|
const _hoisted_1 = ["onClick", "onMouseenter", "onMouseleave"];
|
|
38
38
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { PositionsX, PositionsY, ToastType, TransitionType } from '../OrToast/constants.js';
|
|
2
|
-
export { s as OrToastContainer } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
3
|
-
export { default as useToast } from '../
|
|
4
|
-
export { default as useQueue } from '../
|
|
2
|
+
export { s as OrToastContainer } from '../../OrToastContainer.vue_vue_type_script_lang-51a3ba56.js';
|
|
3
|
+
export { default as useToast } from '../OrToast/composable/useToast.js';
|
|
4
|
+
export { default as useQueue } from '../OrToast/composable/useQueue.js';
|
|
5
5
|
import '../OrToast/OrToast.js';
|
|
6
6
|
import 'vue-demi';
|
|
7
7
|
import '../OrProgress/OrProgress.js';
|
|
@@ -32,5 +32,5 @@ import '../OrLoader/OrLoader.js';
|
|
|
32
32
|
import '../../OrLoader.vue_vue_type_script_lang-b48715a3.js';
|
|
33
33
|
import '../OrLoader/constants.js';
|
|
34
34
|
import '@vueuse/core';
|
|
35
|
-
import '../
|
|
35
|
+
import '../OrToast/composable/useToastEventBus.js';
|
|
36
36
|
import '../OrToast/Timer.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { s as script } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
2
|
-
export { s as default } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
1
|
+
import { s as script } from '../../OrToastContainer.vue_vue_type_script_lang-59d729a6.js';
|
|
2
|
+
export { s as default } from '../../OrToastContainer.vue_vue_type_script_lang-59d729a6.js';
|
|
3
3
|
import { resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createVNode, TransitionGroup, createElementBlock, Fragment, renderList, mergeProps, createCommentVNode } from 'vue';
|
|
4
4
|
import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
|
|
5
5
|
import '@vueuse/core';
|
|
6
6
|
import 'vue-demi';
|
|
7
|
-
import '../
|
|
8
|
-
import '../
|
|
7
|
+
import '../OrToastV3/composable/useQueue.js';
|
|
8
|
+
import '../OrToastV3/composable/useToastEventBus.js';
|
|
9
9
|
import '../OrToastV3/OrToast.js';
|
|
10
10
|
import '../../props-7be029c7.js';
|
|
11
11
|
import '../OrToastV3/styles.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { t as TypesV3 } from '../../types-668300dd.js';
|
|
2
2
|
export { p as PropsV3 } from '../../props-7be029c7.js';
|
|
3
|
-
export { s as OrToastContainerV3 } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
4
|
-
export { default as useToastV3 } from '../
|
|
5
|
-
export { default as useQueueV3 } from '../
|
|
3
|
+
export { s as OrToastContainerV3 } from '../../OrToastContainer.vue_vue_type_script_lang-59d729a6.js';
|
|
4
|
+
export { default as useToastV3 } from '../OrToastV3/composable/useToast.js';
|
|
5
|
+
export { default as useQueueV3 } from '../OrToastV3/composable/useQueue.js';
|
|
6
6
|
import '@vueuse/core';
|
|
7
7
|
import 'vue-demi';
|
|
8
|
-
import '../
|
|
8
|
+
import '../OrToastV3/composable/useToastEventBus.js';
|
|
9
9
|
import '../OrToastV3/OrToast.js';
|
|
10
10
|
import '../OrToastV3/styles.js';
|
|
11
11
|
import '../OrIconButtonV3/OrIconButton.js';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { PropType } from 'vue-demi';
|
|
2
|
+
import { TransitionType } from '../props';
|
|
3
|
+
import { Position, ToastBehaviour, ToastConfiguration } from '../types';
|
|
4
|
+
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
5
|
+
on: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
6
|
+
off: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
7
|
+
classes: import("@vue/composition-api").ComputedRef<(string | {
|
|
8
|
+
'position--top--with-header': boolean;
|
|
9
|
+
})[]>;
|
|
10
|
+
transitionName: import("@vue/composition-api").ComputedRef<string>;
|
|
11
|
+
isActive: import("@vue/composition-api").Ref<boolean>;
|
|
12
|
+
toggle: (value?: boolean | undefined) => boolean;
|
|
13
|
+
addItem: (item: ToastConfiguration) => void;
|
|
14
|
+
removeItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => void;
|
|
15
|
+
clearAll: () => void;
|
|
16
|
+
getItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => import("@vue/composition-api").Ref<ToastConfiguration>;
|
|
17
|
+
queue: import("@vue/composition-api").ComputedRef<ToastConfiguration[]>;
|
|
18
|
+
createToast: (toastConfiguration: ToastConfiguration) => void;
|
|
19
|
+
toastUpdate: (toast: ToastConfiguration) => void;
|
|
20
|
+
toastRemove: (toast: ToastConfiguration) => void;
|
|
21
|
+
onToastEnter: (toast: ToastConfiguration) => void;
|
|
22
|
+
onToastLeave: (toast: ToastConfiguration) => void;
|
|
23
|
+
onClick: (toastBehaviour: ToastBehaviour) => void;
|
|
24
|
+
onToastHidden: () => void;
|
|
25
|
+
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
26
|
+
includeHeaderHeight: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
position: {
|
|
31
|
+
type: PropType<Position>;
|
|
32
|
+
default: Position;
|
|
33
|
+
};
|
|
34
|
+
transition: {
|
|
35
|
+
type: PropType<TransitionType>;
|
|
36
|
+
default: TransitionType;
|
|
37
|
+
};
|
|
38
|
+
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
39
|
+
includeHeaderHeight: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
position: {
|
|
44
|
+
type: PropType<Position>;
|
|
45
|
+
default: Position;
|
|
46
|
+
};
|
|
47
|
+
transition: {
|
|
48
|
+
type: PropType<TransitionType>;
|
|
49
|
+
default: TransitionType;
|
|
50
|
+
};
|
|
51
|
+
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
52
|
+
includeHeaderHeight: boolean;
|
|
53
|
+
position: Position;
|
|
54
|
+
transition: TransitionType;
|
|
55
|
+
} & {}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
56
|
+
on: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
57
|
+
off: (namedQueue: import("../composable/useToastEventBus").ToastEventsBusEvents, listener: import("@vueuse/core").EventBusListener<ToastConfiguration, any>) => void;
|
|
58
|
+
classes: import("@vue/composition-api").ComputedRef<(string | {
|
|
59
|
+
'position--top--with-header': boolean;
|
|
60
|
+
})[]>;
|
|
61
|
+
transitionName: import("@vue/composition-api").ComputedRef<string>;
|
|
62
|
+
isActive: import("@vue/composition-api").Ref<boolean>;
|
|
63
|
+
toggle: (value?: boolean | undefined) => boolean;
|
|
64
|
+
addItem: (item: ToastConfiguration) => void;
|
|
65
|
+
removeItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => void;
|
|
66
|
+
clearAll: () => void;
|
|
67
|
+
getItem: (condition: (i: ToastConfiguration, index: number, queue: import("@vue/composition-api").Ref<ToastConfiguration>[]) => boolean) => import("@vue/composition-api").Ref<ToastConfiguration>;
|
|
68
|
+
queue: import("@vue/composition-api").ComputedRef<ToastConfiguration[]>;
|
|
69
|
+
createToast: (toastConfiguration: ToastConfiguration) => void;
|
|
70
|
+
toastUpdate: (toast: ToastConfiguration) => void;
|
|
71
|
+
toastRemove: (toast: ToastConfiguration) => void;
|
|
72
|
+
onToastEnter: (toast: ToastConfiguration) => void;
|
|
73
|
+
onToastLeave: (toast: ToastConfiguration) => void;
|
|
74
|
+
onClick: (toastBehaviour: ToastBehaviour) => void;
|
|
75
|
+
onToastHidden: () => void;
|
|
76
|
+
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
|
|
77
|
+
includeHeaderHeight: boolean;
|
|
78
|
+
position: Position;
|
|
79
|
+
transition: TransitionType;
|
|
80
|
+
} & {}, {
|
|
81
|
+
includeHeaderHeight: boolean;
|
|
82
|
+
position: Position;
|
|
83
|
+
transition: TransitionType;
|
|
84
|
+
}, true>);
|
|
85
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ref } from 'vue-demi';
|
|
2
|
+
|
|
3
|
+
function useQueue(initialValue) {
|
|
4
|
+
//generic needed! see https://github.com/vuejs/core/issues/2136
|
|
5
|
+
const queue = ref(initialValue || []);
|
|
6
|
+
const addItem = item => {
|
|
7
|
+
const refItem = ref(item);
|
|
8
|
+
queue.value.push(refItem);
|
|
9
|
+
};
|
|
10
|
+
const removeItem = condition => {
|
|
11
|
+
const index = queue.value.findIndex((i, idx, q) => {
|
|
12
|
+
return condition === null || condition === void 0 ? void 0 : condition(i.value, idx, q);
|
|
13
|
+
});
|
|
14
|
+
if (index !== -1) queue.value.splice(index, 1);
|
|
15
|
+
};
|
|
16
|
+
const getItem = condition => {
|
|
17
|
+
return queue.value.filter((i, idx, q) => {
|
|
18
|
+
return condition === null || condition === void 0 ? void 0 : condition(i.value, idx, q);
|
|
19
|
+
})[0];
|
|
20
|
+
};
|
|
21
|
+
const clearAll = () => {
|
|
22
|
+
queue.value = [];
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
queue,
|
|
26
|
+
addItem,
|
|
27
|
+
removeItem,
|
|
28
|
+
clearAll,
|
|
29
|
+
getItem
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { useQueue as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { b as ToastType } from '../../../props-7be029c7.js';
|
|
2
|
+
import Timer from '../Timer.js';
|
|
3
|
+
import useToastEventBus from './useToastEventBus.js';
|
|
4
|
+
import '@vueuse/core';
|
|
5
|
+
|
|
6
|
+
function useToast(globalToastProps = {}) {
|
|
7
|
+
const {
|
|
8
|
+
emit
|
|
9
|
+
} = useToastEventBus();
|
|
10
|
+
function notify(props, behaviour = {}) {
|
|
11
|
+
const {
|
|
12
|
+
duration = 5000,
|
|
13
|
+
pauseOnHover = true,
|
|
14
|
+
onToastClose,
|
|
15
|
+
onToastClick
|
|
16
|
+
} = behaviour;
|
|
17
|
+
const propsData = {
|
|
18
|
+
...props,
|
|
19
|
+
...globalToastProps
|
|
20
|
+
};
|
|
21
|
+
const config = {
|
|
22
|
+
toastProps: propsData,
|
|
23
|
+
//generate ToastHash
|
|
24
|
+
hash: Math.random().toString(36).slice(2),
|
|
25
|
+
...(Number.isInteger(duration) && {
|
|
26
|
+
timer: new Timer()
|
|
27
|
+
}),
|
|
28
|
+
toastBehaviour: {
|
|
29
|
+
duration,
|
|
30
|
+
pauseOnHover,
|
|
31
|
+
onToastClose,
|
|
32
|
+
onToastClick
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
emit('toastNotify', config);
|
|
36
|
+
return {
|
|
37
|
+
close: () => emit('toastClose', config),
|
|
38
|
+
update: data => emit('toastUpdate', {
|
|
39
|
+
...config,
|
|
40
|
+
toastProps: {
|
|
41
|
+
...config.toastProps,
|
|
42
|
+
...data
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function clearAll() {
|
|
48
|
+
emit('toastCloseAll');
|
|
49
|
+
}
|
|
50
|
+
function success(props, behaviour = {}) {
|
|
51
|
+
return notify({
|
|
52
|
+
...props,
|
|
53
|
+
toastType: ToastType.Success
|
|
54
|
+
}, behaviour);
|
|
55
|
+
}
|
|
56
|
+
function error(props, behaviour = {}) {
|
|
57
|
+
return notify({
|
|
58
|
+
...props,
|
|
59
|
+
toastType: ToastType.Error
|
|
60
|
+
}, behaviour);
|
|
61
|
+
}
|
|
62
|
+
function loading(props, behaviour = {}) {
|
|
63
|
+
return notify({
|
|
64
|
+
...props,
|
|
65
|
+
toastType: ToastType.Loading,
|
|
66
|
+
dismissible: false
|
|
67
|
+
}, {
|
|
68
|
+
...behaviour,
|
|
69
|
+
duration: 0 // <- toast with type "loading" will not cloe automatically
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
notify,
|
|
75
|
+
clearAll,
|
|
76
|
+
success,
|
|
77
|
+
error,
|
|
78
|
+
loading
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { useToast as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createSharedComposable, useEventBus } from '@vueuse/core';
|
|
2
|
+
|
|
3
|
+
const useToastEventBus = () => {
|
|
4
|
+
const busPull = {
|
|
5
|
+
toastNotify: useEventBus('toastNotify'),
|
|
6
|
+
toastClose: useEventBus('toastClose'),
|
|
7
|
+
toastCloseAll: useEventBus('toastCloseAll'),
|
|
8
|
+
toastUpdate: useEventBus('toastUpdate')
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
on: (namedQueue, listener) => {
|
|
12
|
+
busPull[namedQueue].on(listener);
|
|
13
|
+
},
|
|
14
|
+
off: (namedQueue, listener) => {
|
|
15
|
+
busPull[namedQueue].off(listener);
|
|
16
|
+
},
|
|
17
|
+
emit: (namedQueue, data) => {
|
|
18
|
+
busPull[namedQueue].emit(data);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
var useToastEventBus$1 = createSharedComposable(useToastEventBus);
|
|
23
|
+
|
|
24
|
+
export { useToastEventBus$1 as default };
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as
|
|
3
|
-
export * from './composable';
|
|
4
|
-
export * as TypesV3 from './types';
|
|
5
|
-
export * as PropsV3 from './props';
|
|
1
|
+
export { default as useToastV3 } from './useToast';
|
|
2
|
+
export { default as useQueueV3 } from './useQueue';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { t as TypesV3 } from '../../types-668300dd.js';
|
|
2
2
|
export { p as PropsV3 } from '../../props-7be029c7.js';
|
|
3
3
|
export { default as OrToastV3 } from './OrToast.js';
|
|
4
|
-
export { s as OrToastContainerV3 } from '../../OrToastContainer.vue_vue_type_script_lang-
|
|
5
|
-
export { default as useToastV3 } from '
|
|
6
|
-
export { default as useQueueV3 } from '
|
|
4
|
+
export { s as OrToastContainerV3 } from '../../OrToastContainer.vue_vue_type_script_lang-59d729a6.js';
|
|
5
|
+
export { default as useToastV3 } from './composable/useToast.js';
|
|
6
|
+
export { default as useQueueV3 } from './composable/useQueue.js';
|
|
7
7
|
import 'vue-demi';
|
|
8
8
|
import './styles.js';
|
|
9
9
|
import '../OrIconButtonV3/OrIconButton.js';
|
|
@@ -40,5 +40,5 @@ import '../../OrLoader.vue_vue_type_script_lang-228835e3.js';
|
|
|
40
40
|
import '../OrLoaderV3/props.js';
|
|
41
41
|
import '../OrLoaderV3/styles.js';
|
|
42
42
|
import '../../style-inject.es-4c6f2515.js';
|
|
43
|
-
import '
|
|
43
|
+
import './composable/useToastEventBus.js';
|
|
44
44
|
import './Timer.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref } from 'vue-demi';
|
|
2
|
+
export default function useQueue<T>(initialValue?: Array<T>): {
|
|
3
|
+
queue: Ref<Ref<T>[]>;
|
|
4
|
+
addItem: (item: T) => void;
|
|
5
|
+
removeItem: (condition: (i: T, index: number, queue: Ref<T>[]) => boolean) => void;
|
|
6
|
+
clearAll: () => void;
|
|
7
|
+
getItem: (condition: (i: T, index: number, queue: Ref<T>[]) => boolean) => Ref<T>;
|
|
8
|
+
};
|