@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.
Files changed (60) hide show
  1. package/dist/bundled/v2/components/OrColorPicker/OrColorPicker.js +1 -1
  2. package/dist/bundled/v2/components/OrColorPicker/index.js +1 -1
  3. package/dist/bundled/v2/components/OrColorPicker/utils/defultPalette.d.ts +2 -0
  4. package/dist/bundled/v2/components/OrColorPicker/utils/defultPalette.js +15 -0
  5. package/dist/bundled/v2/components/OrToast/composable/index.d.ts +2 -0
  6. package/dist/bundled/v2/components/OrToast/composable/index.js +7 -0
  7. package/dist/bundled/v2/components/OrToast/composable/useQueue.d.ts +8 -0
  8. package/dist/bundled/v2/components/OrToast/composable/useQueue.js +33 -0
  9. package/dist/bundled/v2/components/OrToast/composable/useToast.d.ts +13 -0
  10. package/dist/bundled/v2/components/OrToast/composable/useToast.js +82 -0
  11. package/dist/bundled/v2/components/OrToast/composable/useToastEventBus.d.ts +9 -0
  12. package/dist/bundled/v2/components/OrToast/composable/useToastEventBus.js +24 -0
  13. package/dist/bundled/v2/components/OrToast/index.js +3 -3
  14. package/dist/bundled/v2/components/OrToastContainer/OrToastContainer.js +2 -2
  15. package/dist/bundled/v2/components/OrToastContainer/index.js +3 -3
  16. package/dist/bundled/v2/components/OrToastContainerV3/OrToastContainer.js +2 -2
  17. package/dist/bundled/v2/components/OrToastContainerV3/index.js +3 -3
  18. package/dist/bundled/v2/components/OrToastV3/composable/index.d.ts +2 -0
  19. package/dist/bundled/v2/components/OrToastV3/composable/index.js +7 -0
  20. package/dist/bundled/v2/components/OrToastV3/composable/useQueue.d.ts +8 -0
  21. package/dist/bundled/v2/components/OrToastV3/composable/useQueue.js +33 -0
  22. package/dist/bundled/v2/components/OrToastV3/composable/useToast.d.ts +13 -0
  23. package/dist/bundled/v2/components/OrToastV3/composable/useToast.js +82 -0
  24. package/dist/bundled/v2/components/OrToastV3/composable/useToastEventBus.d.ts +9 -0
  25. package/dist/bundled/v2/components/OrToastV3/composable/useToastEventBus.js +24 -0
  26. package/dist/bundled/v2/components/OrToastV3/index.js +3 -3
  27. package/dist/bundled/v2/components/index.js +7 -7
  28. package/dist/bundled/v2/index.js +7 -7
  29. package/dist/bundled/v3/{OrColorPicker.vue_vue_type_script_lang-c29579b4.js → OrColorPicker.vue_vue_type_script_lang-3a799e23.js} +1 -1
  30. package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-3bb6f082.js → OrToastContainer.vue_vue_type_script_lang-51a3ba56.js} +2 -2
  31. package/dist/bundled/v3/{OrToastContainer.vue_vue_type_script_lang-e98944bc.js → OrToastContainer.vue_vue_type_script_lang-59d729a6.js} +2 -2
  32. package/dist/bundled/v3/components/OrColorPicker/OrColorPicker.js +3 -3
  33. package/dist/bundled/v3/components/OrColorPicker/index.js +2 -2
  34. package/dist/bundled/v3/components/OrColorPicker/utils/defultPalette.d.ts +2 -0
  35. package/dist/bundled/v3/components/OrColorPicker/utils/defultPalette.js +15 -0
  36. package/dist/bundled/v3/components/OrToast/composable/index.d.ts +2 -0
  37. package/dist/bundled/v3/components/OrToast/composable/index.js +7 -0
  38. package/dist/bundled/v3/components/OrToast/composable/useQueue.d.ts +8 -0
  39. package/dist/bundled/v3/components/OrToast/composable/useQueue.js +33 -0
  40. package/dist/bundled/v3/components/OrToast/composable/useToast.d.ts +13 -0
  41. package/dist/bundled/v3/components/OrToast/composable/useToast.js +82 -0
  42. package/dist/bundled/v3/components/OrToast/composable/useToastEventBus.d.ts +9 -0
  43. package/dist/bundled/v3/components/OrToast/composable/useToastEventBus.js +24 -0
  44. package/dist/bundled/v3/components/OrToast/index.js +4 -4
  45. package/dist/bundled/v3/components/OrToastContainer/OrToastContainer.js +4 -4
  46. package/dist/bundled/v3/components/OrToastContainer/index.js +4 -4
  47. package/dist/bundled/v3/components/OrToastContainerV3/OrToastContainer.js +4 -4
  48. package/dist/bundled/v3/components/OrToastContainerV3/index.js +4 -4
  49. package/dist/bundled/v3/components/OrToastV3/composable/index.d.ts +2 -0
  50. package/dist/bundled/v3/components/OrToastV3/composable/index.js +7 -0
  51. package/dist/bundled/v3/components/OrToastV3/composable/useQueue.d.ts +8 -0
  52. package/dist/bundled/v3/components/OrToastV3/composable/useQueue.js +33 -0
  53. package/dist/bundled/v3/components/OrToastV3/composable/useToast.d.ts +13 -0
  54. package/dist/bundled/v3/components/OrToastV3/composable/useToast.js +82 -0
  55. package/dist/bundled/v3/components/OrToastV3/composable/useToastEventBus.d.ts +9 -0
  56. package/dist/bundled/v3/components/OrToastV3/composable/useToastEventBus.js +24 -0
  57. package/dist/bundled/v3/components/OrToastV3/index.js +4 -4
  58. package/dist/bundled/v3/components/index.js +10 -10
  59. package/dist/bundled/v3/index.js +10 -10
  60. package/package.json +2 -2
@@ -1,11 +1,11 @@
1
- import { s as script } from '../../OrColorPicker.vue_vue_type_script_lang-c29579b4.js';
2
- export { s as default } from '../../OrColorPicker.vue_vue_type_script_lang-c29579b4.js';
1
+ import { s as script } from '../../OrColorPicker.vue_vue_type_script_lang-3a799e23.js';
2
+ export { s as default } from '../../OrColorPicker.vue_vue_type_script_lang-3a799e23.js';
3
3
  import { resolveComponent, openBlock, createElementBlock, createElementVNode, normalizeStyle, withModifiers, createBlock, withCtx, Fragment, renderList, normalizeClass, withDirectives, vShow, createCommentVNode, pushScopeId, popScopeId } from 'vue';
4
4
  import { s as styleInject } from '../../style-inject.es-4c6f2515.js';
5
5
  import './constants.js';
6
6
  import 'vue-demi';
7
7
  import '@vueuse/core';
8
- import '../or-color-picker/utils/defultPalette.js';
8
+ import './utils/defultPalette.js';
9
9
  import '../OrFloating/OrFloating.js';
10
10
  import '../../OrFloating.vue_vue_type_script_lang-d64ad4a7.js';
11
11
  import '../../floating-ui.dom.esm-83eba816.js';
@@ -1,8 +1,8 @@
1
1
  export { amber, black, blue, blueGrey, brown, cyan, deepOrange, deepPurple, green, indigo, lightBlue, lightGreen, lime, orange, pink, purple, red, teal, white, yellow } from './constants.js';
2
- export { s as OrColorPicker } from '../../OrColorPicker.vue_vue_type_script_lang-c29579b4.js';
2
+ export { s as OrColorPicker } from '../../OrColorPicker.vue_vue_type_script_lang-3a799e23.js';
3
3
  import 'vue-demi';
4
4
  import '@vueuse/core';
5
- import '../or-color-picker/utils/defultPalette.js';
5
+ import './utils/defultPalette.js';
6
6
  import '../OrFloating/OrFloating.js';
7
7
  import '../../OrFloating.vue_vue_type_script_lang-d64ad4a7.js';
8
8
  import '../../floating-ui.dom.esm-83eba816.js';
@@ -0,0 +1,2 @@
1
+ import { PaletteType } from '../types';
2
+ export default function defaultPalette(): PaletteType;
@@ -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,2 @@
1
+ export { default as useToast } from './useToast';
2
+ export { default as useQueue } from './useQueue';
@@ -0,0 +1,7 @@
1
+ export { default as useToast } from './useToast.js';
2
+ export { default as useQueue } from './useQueue.js';
3
+ import '../Timer.js';
4
+ import '@vueuse/core';
5
+ import './useToastEventBus.js';
6
+ import '../constants.js';
7
+ import 'vue-demi';
@@ -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 { 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-3bb6f082.js';
4
- export { default as useToast } from '../or-toast/composable/useToast.js';
5
- export { default as useQueue } from '../or-toast/composable/useQueue.js';
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 '../or-toast/composable/useToastEventBus.js';
35
+ import './composable/useToastEventBus.js';
36
36
  import './Timer.js';
@@ -1,5 +1,5 @@
1
- import { s as script } from '../../OrToastContainer.vue_vue_type_script_lang-3bb6f082.js';
2
- export { s as default } from '../../OrToastContainer.vue_vue_type_script_lang-3bb6f082.js';
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 '../or-toast/composable/useQueue.js';
35
- import '../or-toast/composable/useToastEventBus.js';
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-3bb6f082.js';
3
- export { default as useToast } from '../or-toast/composable/useToast.js';
4
- export { default as useQueue } from '../or-toast/composable/useQueue.js';
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 '../or-toast/composable/useToastEventBus.js';
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-e98944bc.js';
2
- export { s as default } from '../../OrToastContainer.vue_vue_type_script_lang-e98944bc.js';
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 '../or-toast-v3/composable/useQueue.js';
8
- import '../or-toast-v3/composable/useToastEventBus.js';
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-e98944bc.js';
4
- export { default as useToastV3 } from '../or-toast-v3/composable/useToast.js';
5
- export { default as useQueueV3 } from '../or-toast-v3/composable/useQueue.js';
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 '../or-toast-v3/composable/useToastEventBus.js';
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,2 @@
1
+ export { default as useToastV3 } from './useToast';
2
+ export { default as useQueueV3 } from './useQueue';
@@ -0,0 +1,7 @@
1
+ export { default as useToastV3 } from './useToast.js';
2
+ export { default as useQueueV3 } from './useQueue.js';
3
+ import '../../../props-7be029c7.js';
4
+ import '../Timer.js';
5
+ import '@vueuse/core';
6
+ import './useToastEventBus.js';
7
+ import 'vue-demi';
@@ -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 };
@@ -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-e98944bc.js';
5
- export { default as useToastV3 } from '../or-toast-v3/composable/useToast.js';
6
- export { default as useQueueV3 } from '../or-toast-v3/composable/useQueue.js';
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 '../or-toast-v3/composable/useToastEventBus.js';
43
+ import './composable/useToastEventBus.js';
44
44
  import './Timer.js';
@@ -25,7 +25,7 @@ export { s as OrChips } from '../OrChips.vue_vue_type_script_lang-94b456c7.js';
25
25
  export { s as OrCode } from '../OrCode.vue_vue_type_script_lang-127ee0fe.js';
26
26
  export { OrCodeLanguages } from './OrCode/constants.js';
27
27
  export { s as OrCollapse } from '../OrCollapse.vue_vue_type_script_lang-5137ca99.js';
28
- export { s as OrColorPicker } from '../OrColorPicker.vue_vue_type_script_lang-c29579b4.js';
28
+ export { s as OrColorPicker } from '../OrColorPicker.vue_vue_type_script_lang-3a799e23.js';
29
29
  export { amber, black, blue, blueGrey, brown, cyan, deepOrange, deepPurple, green, indigo, lightBlue, lightGreen, lime, orange, pink, purple, red, teal, white, yellow } from './OrColorPicker/constants.js';
30
30
  export { s as OrConfirm } from '../OrConfirm.vue_vue_type_script_lang-128506dd.js';
31
31
  export { s as OrConfirmV3 } from '../OrConfirm.vue_vue_type_script_lang-0111d143.js';
@@ -138,16 +138,16 @@ export { s as OrTextareaV3 } from '../OrTextarea.vue_vue_type_script_lang-1b3f23
138
138
  export { s as OrTextbox } from '../OrTextbox.vue_vue_type_script_lang-686e0310.js';
139
139
  export { TextboxTypes } from './OrTextbox/constants.js';
140
140
  export { default as OrToast } from './OrToast/OrToast.js';
141
- export { s as OrToastContainer } from '../OrToastContainer.vue_vue_type_script_lang-3bb6f082.js';
142
- export { default as useToast } from './or-toast/composable/useToast.js';
143
- export { default as useQueue } from './or-toast/composable/useQueue.js';
141
+ export { s as OrToastContainer } from '../OrToastContainer.vue_vue_type_script_lang-51a3ba56.js';
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
- export { s as OrToastContainerV3 } from '../OrToastContainer.vue_vue_type_script_lang-e98944bc.js';
146
+ export { s as OrToastContainerV3 } from '../OrToastContainer.vue_vue_type_script_lang-59d729a6.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 './or-toast-v3/composable/useToast.js';
150
- export { default as useQueueV3 } from './or-toast-v3/composable/useQueue.js';
149
+ export { default as useToastV3 } from './OrToastV3/composable/useToast.js';
150
+ export { default as useQueueV3 } from './OrToastV3/composable/useQueue.js';
151
151
  export { s as OrTooltip } from '../OrTooltip.vue_vue_type_script_lang-b8594f7e.js';
152
152
  export { s as OrTooltipContent } from '../OrTooltipContent.vue_vue_type_script_lang-969c20ed.js';
153
153
  export { s as OrTooltipV3 } from '../OrTooltip.vue_vue_type_script_lang-196b0605.js';
@@ -227,7 +227,7 @@ import '../lang-02d2bb2d.js';
227
227
  import './OrCode/theme.js';
228
228
  import './OrModal/OrModal.js';
229
229
  import './OrOverlay/OrOverlay.js';
230
- import './or-color-picker/utils/defultPalette.js';
230
+ import './OrColorPicker/utils/defultPalette.js';
231
231
  import '../index-63e094a0.js';
232
232
  import './OrButtonV2/OrButton.js';
233
233
  import './OrConfirmV3/styles.js';
@@ -270,8 +270,8 @@ import './OrTabV3/OrTab.js';
270
270
  import './OrTextV3/styles.js';
271
271
  import './OrTextareaV3/styles.js';
272
272
  import './OrProgress/OrProgress.js';
273
- import './or-toast/composable/useToastEventBus.js';
273
+ import './OrToast/composable/useToastEventBus.js';
274
274
  import './OrToast/Timer.js';
275
275
  import './OrToastV3/styles.js';
276
- import './or-toast-v3/composable/useToastEventBus.js';
276
+ import './OrToastV3/composable/useToastEventBus.js';
277
277
  import './OrToastV3/Timer.js';