@onereach/ui-components 2.77.0-beta.2456.0 → 2.77.0-beta.2466.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/OrColorPicker/OrColorPicker.js +1 -1
- package/dist/bundled/v2/components/OrColorPicker/index.js +1 -1
- package/dist/bundled/v2/components/OrColorPicker/utils/defultPalette.d.ts +2 -0
- package/dist/bundled/v2/components/OrColorPicker/utils/defultPalette.js +15 -0
- package/dist/bundled/v2/components/OrToast/composable/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrToast/composable/index.js +7 -0
- package/dist/bundled/v2/components/OrToast/composable/useQueue.d.ts +8 -0
- package/dist/bundled/v2/components/OrToast/composable/useQueue.js +33 -0
- package/dist/bundled/v2/components/OrToast/composable/useToast.d.ts +13 -0
- package/dist/bundled/v2/components/OrToast/composable/useToast.js +82 -0
- package/dist/bundled/v2/components/OrToast/composable/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v2/components/OrToast/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v2/components/OrToast/index.js +3 -3
- 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/composable/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrToastV3/composable/index.js +7 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useQueue.d.ts +8 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useQueue.js +33 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useToast.d.ts +13 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useToast.js +82 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v2/components/OrToastV3/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v2/components/OrToastV3/index.js +3 -3
- 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/OrColorPicker/OrColorPicker.js +3 -3
- package/dist/bundled/v3/components/OrColorPicker/index.js +2 -2
- package/dist/bundled/v3/components/OrColorPicker/utils/defultPalette.d.ts +2 -0
- package/dist/bundled/v3/components/OrColorPicker/utils/defultPalette.js +15 -0
- package/dist/bundled/v3/components/OrToast/composable/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrToast/composable/index.js +7 -0
- package/dist/bundled/v3/components/OrToast/composable/useQueue.d.ts +8 -0
- package/dist/bundled/v3/components/OrToast/composable/useQueue.js +33 -0
- package/dist/bundled/v3/components/OrToast/composable/useToast.d.ts +13 -0
- package/dist/bundled/v3/components/OrToast/composable/useToast.js +82 -0
- package/dist/bundled/v3/components/OrToast/composable/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v3/components/OrToast/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v3/components/OrToast/index.js +4 -4
- 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/composable/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrToastV3/composable/index.js +7 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useQueue.d.ts +8 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useQueue.js +33 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useToast.d.ts +13 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useToast.js +82 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useToastEventBus.d.ts +9 -0
- package/dist/bundled/v3/components/OrToastV3/composable/useToastEventBus.js +24 -0
- package/dist/bundled/v3/components/OrToastV3/index.js +4 -4
- package/dist/bundled/v3/components/index.js +10 -10
- package/dist/bundled/v3/index.js +10 -10
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Palette from './constants.js';
|
|
2
2
|
import { defineComponent, ref } from 'vue-demi';
|
|
3
3
|
import { useToggle, onClickOutside } from '@vueuse/core';
|
|
4
|
-
import defaultPalette from '
|
|
4
|
+
import defaultPalette from './utils/defultPalette.js';
|
|
5
5
|
import __vue_component__$1 from '../OrFloating/OrFloating.js';
|
|
6
6
|
import { OrFloatingPlacements } from '../OrFloating/constants.js';
|
|
7
7
|
import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
|
|
@@ -2,7 +2,7 @@ export { default as OrColorPicker } from './OrColorPicker.js';
|
|
|
2
2
|
export { amber, black, blue, blueGrey, brown, cyan, deepOrange, deepPurple, green, indigo, lightBlue, lightGreen, lime, orange, pink, purple, red, teal, white, yellow } from './constants.js';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import '@vueuse/core';
|
|
5
|
-
import '
|
|
5
|
+
import './utils/defultPalette.js';
|
|
6
6
|
import '../OrFloating/OrFloating.js';
|
|
7
7
|
import '../../floating-ui.dom.esm-83eba816.js';
|
|
8
8
|
import '../OrTeleport/OrTeleport.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Palette from '../constants.js';
|
|
2
|
+
|
|
3
|
+
const defaultTones = ['900', '700', '500', '300', '100'];
|
|
4
|
+
function defaultPalette() {
|
|
5
|
+
return Object.entries(Palette).reduce((acc, [color, schema]) => {
|
|
6
|
+
if (color === 'black' || color === 'white') {
|
|
7
|
+
acc.push([Palette[color].default]);
|
|
8
|
+
} else {
|
|
9
|
+
acc.push(defaultTones === null || defaultTones === void 0 ? void 0 : defaultTones.map(tone => schema[tone]));
|
|
10
|
+
}
|
|
11
|
+
return acc;
|
|
12
|
+
}, []);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { defaultPalette as default };
|
|
@@ -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,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,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,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,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;
|
|
@@ -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,8 +1,8 @@
|
|
|
1
1
|
export { default as OrToast } from './OrToast.js';
|
|
2
2
|
export { default as OrToastContainer } from '../OrToastContainer/OrToastContainer.js';
|
|
3
3
|
export { PositionsX, PositionsY, ToastType, TransitionType } from './constants.js';
|
|
4
|
-
export { default as useToast } from '
|
|
5
|
-
export { default as useQueue } from '
|
|
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 'lodash';
|
|
@@ -26,5 +26,5 @@ import '../../utils/functions/px-to-rem.js';
|
|
|
26
26
|
import '../OrLoader/OrLoader.js';
|
|
27
27
|
import '../OrLoader/constants.js';
|
|
28
28
|
import '@vueuse/core';
|
|
29
|
-
import '
|
|
29
|
+
import './composable/useToastEventBus.js';
|
|
30
30
|
import './Timer.js';
|
|
@@ -2,8 +2,8 @@ import __vue_component__$1 from '../OrToast/OrToast.js';
|
|
|
2
2
|
import __vue_component__$2 from '../OrTeleport/OrTeleport.js';
|
|
3
3
|
import { defineComponent, nextTick } from 'vue-demi';
|
|
4
4
|
import { useToggle } from '@vueuse/core';
|
|
5
|
-
import useQueue from '../
|
|
6
|
-
import useToastEventBus from '../
|
|
5
|
+
import useQueue from '../OrToast/composable/useQueue.js';
|
|
6
|
+
import useToastEventBus from '../OrToast/composable/useToastEventBus.js';
|
|
7
7
|
import { PositionsX, PositionsY, TransitionType } from '../OrToast/constants.js';
|
|
8
8
|
import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
|
|
9
9
|
import { n as normalizeComponent } from '../../normalize-component-6e8e3d80.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { default as OrToastContainer } from './OrToastContainer.js';
|
|
2
2
|
export { PositionsX, PositionsY, ToastType, TransitionType } from '../OrToast/constants.js';
|
|
3
|
-
export { default as useToast } from '../
|
|
4
|
-
export { default as useQueue } from '../
|
|
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';
|
|
@@ -26,5 +26,5 @@ import '../../utils/functions/px-to-rem.js';
|
|
|
26
26
|
import '../OrLoader/OrLoader.js';
|
|
27
27
|
import '../OrLoader/constants.js';
|
|
28
28
|
import '@vueuse/core';
|
|
29
|
-
import '../
|
|
29
|
+
import '../OrToast/composable/useToastEventBus.js';
|
|
30
30
|
import '../OrToast/Timer.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useToggle } from '@vueuse/core';
|
|
2
2
|
import { defineComponent, computed, onBeforeMount, onBeforeUnmount, nextTick } from 'vue-demi';
|
|
3
|
-
import useQueue from '../
|
|
4
|
-
import useToastEventBus from '../
|
|
3
|
+
import useQueue from '../OrToastV3/composable/useQueue.js';
|
|
4
|
+
import useToastEventBus from '../OrToastV3/composable/useToastEventBus.js';
|
|
5
5
|
import __vue_component__$2 from '../OrToastV3/OrToast.js';
|
|
6
6
|
import { P as PositionsX, a as PositionsY, T as TransitionType } from '../../props-7be029c7.js';
|
|
7
7
|
import { ToastContainer, ToastContainerPositions } from '../OrToastV3/styles.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { default as OrToastContainerV3 } from './OrToastContainer.js';
|
|
2
2
|
export { t as TypesV3 } from '../../types-668300dd.js';
|
|
3
3
|
export { p as PropsV3 } from '../../props-7be029c7.js';
|
|
4
|
-
export { default as useToastV3 } from '../
|
|
5
|
-
export { default as useQueueV3 } from '../
|
|
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,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,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,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,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,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;
|
|
@@ -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 };
|
|
@@ -2,8 +2,8 @@ export { default as OrToastV3 } from './OrToast.js';
|
|
|
2
2
|
export { default as OrToastContainerV3 } from '../OrToastContainerV3/OrToastContainer.js';
|
|
3
3
|
export { t as TypesV3 } from '../../types-668300dd.js';
|
|
4
4
|
export { p as PropsV3 } from '../../props-7be029c7.js';
|
|
5
|
-
export { default as useToastV3 } from '
|
|
6
|
-
export { default as useQueueV3 } from '
|
|
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';
|
|
@@ -33,5 +33,5 @@ import '../OrLoaderV3/OrLoader.js';
|
|
|
33
33
|
import '../OrLoaderV3/props.js';
|
|
34
34
|
import '../OrLoaderV3/styles.js';
|
|
35
35
|
import '../../style-inject.es-4c6f2515.js';
|
|
36
|
-
import '
|
|
36
|
+
import './composable/useToastEventBus.js';
|
|
37
37
|
import './Timer.js';
|
|
@@ -139,15 +139,15 @@ export { default as OrTextbox } from './OrTextbox/OrTextbox.js';
|
|
|
139
139
|
export { TextboxTypes } from './OrTextbox/constants.js';
|
|
140
140
|
export { default as OrToast } from './OrToast/OrToast.js';
|
|
141
141
|
export { default as OrToastContainer } from './OrToastContainer/OrToastContainer.js';
|
|
142
|
-
export { default as useToast } from './
|
|
143
|
-
export { default as useQueue } from './
|
|
142
|
+
export { default as useToast } from './OrToast/composable/useToast.js';
|
|
143
|
+
export { default as useQueue } from './OrToast/composable/useQueue.js';
|
|
144
144
|
export { PositionsX, PositionsY, ToastType, TransitionType } from './OrToast/constants.js';
|
|
145
145
|
export { default as OrToastV3 } from './OrToastV3/OrToast.js';
|
|
146
146
|
export { default as OrToastContainerV3 } from './OrToastContainerV3/OrToastContainer.js';
|
|
147
147
|
export { t as TypesV3 } from '../types-668300dd.js';
|
|
148
148
|
export { p as PropsV3 } from '../props-7be029c7.js';
|
|
149
|
-
export { default as useToastV3 } from './
|
|
150
|
-
export { default as useQueueV3 } from './
|
|
149
|
+
export { default as useToastV3 } from './OrToastV3/composable/useToast.js';
|
|
150
|
+
export { default as useQueueV3 } from './OrToastV3/composable/useQueue.js';
|
|
151
151
|
export { default as OrTooltip } from './OrTooltip/OrTooltip.js';
|
|
152
152
|
export { default as OrTooltipContent } from './OrTooltipContent/OrTooltipContent.js';
|
|
153
153
|
export { default as OrTooltipV3 } from './OrTooltipV3/OrTooltip.js';
|
|
@@ -196,7 +196,7 @@ import './OrChips/constants.js';
|
|
|
196
196
|
import '../index-6976c52a.js';
|
|
197
197
|
import '../lang-02d2bb2d.js';
|
|
198
198
|
import './OrCode/theme.js';
|
|
199
|
-
import './
|
|
199
|
+
import './OrColorPicker/utils/defultPalette.js';
|
|
200
200
|
import '../index-63e094a0.js';
|
|
201
201
|
import './OrConfirmV3/styles.js';
|
|
202
202
|
import './OrErrorTagV3/styles.js';
|
|
@@ -229,8 +229,8 @@ import './OrTabV3/styles.js';
|
|
|
229
229
|
import './OrTabsV3/styles.js';
|
|
230
230
|
import './OrTextV3/styles.js';
|
|
231
231
|
import './OrTextareaV3/styles.js';
|
|
232
|
-
import './
|
|
232
|
+
import './OrToast/composable/useToastEventBus.js';
|
|
233
233
|
import './OrToast/Timer.js';
|
|
234
234
|
import './OrToastV3/styles.js';
|
|
235
|
-
import './
|
|
235
|
+
import './OrToastV3/composable/useToastEventBus.js';
|
|
236
236
|
import './OrToastV3/Timer.js';
|
package/dist/bundled/v2/index.js
CHANGED
|
@@ -60,9 +60,9 @@ export { default as OrTextarea } from './components/OrTextarea/OrTextarea.js';
|
|
|
60
60
|
export { default as OrTextareaV3 } from './components/OrTextareaV3/OrTextarea.js';
|
|
61
61
|
export { default as OrTextbox } from './components/OrTextbox/OrTextbox.js';
|
|
62
62
|
export { default as OrToastContainer } from './components/OrToastContainer/OrToastContainer.js';
|
|
63
|
-
export { default as useToast } from './components/
|
|
63
|
+
export { default as useToast } from './components/OrToast/composable/useToast.js';
|
|
64
64
|
export { default as OrToastContainerV3 } from './components/OrToastContainerV3/OrToastContainer.js';
|
|
65
|
-
export { default as useToastV3 } from './components/
|
|
65
|
+
export { default as useToastV3 } from './components/OrToastV3/composable/useToast.js';
|
|
66
66
|
export { default as OrTooltip } from './components/OrTooltip/OrTooltip.js';
|
|
67
67
|
export { OR_AVATAR_SIZE } from './components/OrAvatar/constants.js';
|
|
68
68
|
export { AvatarColor, AvatarSize } from './components/OrAvatarV3/props.js';
|
|
@@ -145,12 +145,12 @@ export { default as OrTeleport } from './components/OrTeleport/OrTeleport.js';
|
|
|
145
145
|
export { default as OrTeleportV3 } from './components/OrTeleportV3/OrTeleport.js';
|
|
146
146
|
export { TextboxTypes } from './components/OrTextbox/constants.js';
|
|
147
147
|
export { default as OrToast } from './components/OrToast/OrToast.js';
|
|
148
|
-
export { default as useQueue } from './components/
|
|
148
|
+
export { default as useQueue } from './components/OrToast/composable/useQueue.js';
|
|
149
149
|
export { PositionsX, PositionsY, ToastType, TransitionType } from './components/OrToast/constants.js';
|
|
150
150
|
export { default as OrToastV3 } from './components/OrToastV3/OrToast.js';
|
|
151
151
|
export { t as TypesV3 } from './types-668300dd.js';
|
|
152
152
|
export { p as PropsV3 } from './props-7be029c7.js';
|
|
153
|
-
export { default as useQueueV3 } from './components/
|
|
153
|
+
export { default as useQueueV3 } from './components/OrToastV3/composable/useQueue.js';
|
|
154
154
|
export { default as OrTooltipContent } from './components/OrTooltipContent/OrTooltipContent.js';
|
|
155
155
|
export { default as OrTooltipV3 } from './components/OrTooltipV3/OrTooltip.js';
|
|
156
156
|
export { DropdownClose } from './directives/dropdown-close.js';
|
|
@@ -178,7 +178,7 @@ import './index-6976c52a.js';
|
|
|
178
178
|
import './lang-02d2bb2d.js';
|
|
179
179
|
import '@vueuse/core';
|
|
180
180
|
import './components/OrCode/theme.js';
|
|
181
|
-
import './components/
|
|
181
|
+
import './components/OrColorPicker/utils/defultPalette.js';
|
|
182
182
|
import './index-63e094a0.js';
|
|
183
183
|
import './components/OrConfirmV3/styles.js';
|
|
184
184
|
import './utils/functions/dom.js';
|
|
@@ -205,9 +205,9 @@ import './v4-cf8987a3.js';
|
|
|
205
205
|
import './components/OrTabsV3/styles.js';
|
|
206
206
|
import './components/OrTextV3/styles.js';
|
|
207
207
|
import './components/OrTextareaV3/styles.js';
|
|
208
|
-
import './components/
|
|
208
|
+
import './components/OrToast/composable/useToastEventBus.js';
|
|
209
209
|
import './components/OrToast/Timer.js';
|
|
210
|
-
import './components/
|
|
210
|
+
import './components/OrToastV3/composable/useToastEventBus.js';
|
|
211
211
|
import './components/OrToastV3/styles.js';
|
|
212
212
|
import './components/OrToastV3/Timer.js';
|
|
213
213
|
import './components/OrBottomSheetV3/styles.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Palette from './components/OrColorPicker/constants.js';
|
|
2
2
|
import { defineComponent, ref } from 'vue-demi';
|
|
3
3
|
import { useToggle, onClickOutside } from '@vueuse/core';
|
|
4
|
-
import defaultPalette from './components/
|
|
4
|
+
import defaultPalette from './components/OrColorPicker/utils/defultPalette.js';
|
|
5
5
|
import './components/OrFloating/OrFloating.js';
|
|
6
6
|
import { s as script$1 } from './OrFloating.vue_vue_type_script_lang-d64ad4a7.js';
|
|
7
7
|
import { OrFloatingPlacements } from './components/OrFloating/constants.js';
|
|
@@ -2,8 +2,8 @@ import script$1 from './components/OrToast/OrToast.js';
|
|
|
2
2
|
import script$2 from './components/OrTeleport/OrTeleport.js';
|
|
3
3
|
import { defineComponent, nextTick } from 'vue-demi';
|
|
4
4
|
import { useToggle } from '@vueuse/core';
|
|
5
|
-
import useQueue from './components/
|
|
6
|
-
import useToastEventBus from './components/
|
|
5
|
+
import useQueue from './components/OrToast/composable/useQueue.js';
|
|
6
|
+
import useToastEventBus from './components/OrToast/composable/useToastEventBus.js';
|
|
7
7
|
import { PositionsX, PositionsY, TransitionType } from './components/OrToast/constants.js';
|
|
8
8
|
|
|
9
9
|
var script = defineComponent({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useToggle } from '@vueuse/core';
|
|
2
2
|
import { defineComponent, computed, onBeforeMount, onBeforeUnmount, nextTick } from 'vue-demi';
|
|
3
|
-
import useQueue from './components/
|
|
4
|
-
import useToastEventBus from './components/
|
|
3
|
+
import useQueue from './components/OrToastV3/composable/useQueue.js';
|
|
4
|
+
import useToastEventBus from './components/OrToastV3/composable/useToastEventBus.js';
|
|
5
5
|
import script$2 from './components/OrToastV3/OrToast.js';
|
|
6
6
|
import { P as PositionsX, a as PositionsY, T as TransitionType } from './props-7be029c7.js';
|
|
7
7
|
import { ToastContainer, ToastContainerPositions } from './components/OrToastV3/styles.js';
|