@veracity/vui 5.2.4-alpha.402418.2607010853 → 5.2.4
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/toast/useToast.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ declare const slowToastDuration = 8000;
|
|
|
8
8
|
declare const useToast: () => {
|
|
9
9
|
showToast: (options?: ToastOptions) => void;
|
|
10
10
|
hideToast: (id: string) => void;
|
|
11
|
-
showInfo: (text: ReactNode, duration?: ToastDuration) => void;
|
|
12
|
-
showSuccess: (text: ReactNode, duration?: ToastDuration) => void;
|
|
13
|
-
showWarning: (text: ReactNode, duration?: ToastDuration) => void;
|
|
14
|
-
showError: (text: ReactNode, duration?: ToastDuration) => void;
|
|
15
|
-
showLoading: (text: ReactNode, duration?: ToastDuration) => void;
|
|
11
|
+
showInfo: (text: ReactNode, duration?: ToastDuration, title?: ReactNode, showDismissButton?: boolean) => void;
|
|
12
|
+
showSuccess: (text: ReactNode, duration?: ToastDuration, title?: ReactNode, showDismissButton?: boolean) => void;
|
|
13
|
+
showWarning: (text: ReactNode, duration?: ToastDuration, title?: ReactNode, showDismissButton?: boolean) => void;
|
|
14
|
+
showError: (text: ReactNode, duration?: ToastDuration, title?: ReactNode, showDismissButton?: boolean) => void;
|
|
15
|
+
showLoading: (text: ReactNode, duration?: ToastDuration, title?: ReactNode, showDismissButton?: boolean) => void;
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
18
18
|
export { defaultDuration, fastToastDuration, slowToastDuration, useToast };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToast.d.ts","names":[],"sources":["../../src/toast/useToast.tsx"],"mappings":";;;;cAUa,eAAA;AAAA,cACA,iBAAA;AAAA,cACA,iBAAA;AAAA,cAWA,QAAA;wBAG8B,YAAA;;
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","names":[],"sources":["../../src/toast/useToast.tsx"],"mappings":";;;;cAUa,eAAA;AAAA,cACA,iBAAA;AAAA,cACA,iBAAA;AAAA,cAWA,QAAA;wBAG8B,YAAA;;mBAkChC,SAAA,EAAS,QAAA,GAAY,aAAA,EAAa,KAAA,GAA4B,SAAA,EAAS,iBAAA;sBAMvE,SAAA,EAAS,QAAA,GAAY,aAAA,EAAa,KAAA,GAA4B,SAAA,EAAS,iBAAA;sBAMvE,SAAA,EAAS,QAAA,GAAY,aAAA,EAAa,KAAA,GAA4B,SAAA,EAAS,iBAAA;oBAMvE,SAAA,EAAS,QAAA,GAAY,aAAA,EAAa,KAAA,GAA4B,SAAA,EAAS,iBAAA;sBAMvE,SAAA,EAAS,QAAA,GAAY,aAAA,EAAa,KAAA,GAA4B,SAAA,EAAS,iBAAA;AAAA"}
|
package/dist/toast/useToast.js
CHANGED
|
@@ -17,12 +17,14 @@ const useToast = () => {
|
|
|
17
17
|
const { addToast, removeToast } = useVuiContext();
|
|
18
18
|
const showToast = useCallback((options) => {
|
|
19
19
|
const id = options?.id ? options.id : uid("toast");
|
|
20
|
-
const { duration = setup.options.duration, status = "info", action, icon, text, title } = options || {};
|
|
20
|
+
const { duration = setup.options.duration, status = "info", action, icon, text, title, showDismissButton = true } = options || {};
|
|
21
21
|
addToast({
|
|
22
22
|
id,
|
|
23
23
|
component: /* @__PURE__ */ jsx(Notification, {
|
|
24
24
|
action,
|
|
25
|
+
align: "center",
|
|
25
26
|
animation: "fadeDown",
|
|
27
|
+
ariaLive: "polite",
|
|
26
28
|
elevation: 3,
|
|
27
29
|
icon,
|
|
28
30
|
mt: {
|
|
@@ -31,12 +33,11 @@ const useToast = () => {
|
|
|
31
33
|
xs: "4px"
|
|
32
34
|
},
|
|
33
35
|
onClose: () => removeToast(id),
|
|
36
|
+
role: "status",
|
|
37
|
+
showDismissButton,
|
|
34
38
|
status,
|
|
35
39
|
text,
|
|
36
40
|
title,
|
|
37
|
-
align: "center",
|
|
38
|
-
role: "status",
|
|
39
|
-
ariaLive: "polite",
|
|
40
41
|
w: 1
|
|
41
42
|
})
|
|
42
43
|
});
|
|
@@ -45,30 +46,40 @@ const useToast = () => {
|
|
|
45
46
|
return {
|
|
46
47
|
showToast,
|
|
47
48
|
hideToast: removeToast,
|
|
48
|
-
showInfo: useCallback((text, duration = defaultDuration) => showToast({
|
|
49
|
+
showInfo: useCallback((text, duration = defaultDuration, title, showDismissButton) => showToast({
|
|
49
50
|
text,
|
|
50
51
|
status: "info",
|
|
51
|
-
duration
|
|
52
|
+
duration,
|
|
53
|
+
title,
|
|
54
|
+
showDismissButton
|
|
52
55
|
}), [showToast]),
|
|
53
|
-
showSuccess: useCallback((text, duration = defaultDuration) => showToast({
|
|
56
|
+
showSuccess: useCallback((text, duration = defaultDuration, title, showDismissButton) => showToast({
|
|
54
57
|
text,
|
|
55
58
|
status: "success",
|
|
56
|
-
duration
|
|
59
|
+
duration,
|
|
60
|
+
title,
|
|
61
|
+
showDismissButton
|
|
57
62
|
}), [showToast]),
|
|
58
|
-
showWarning: useCallback((text, duration = defaultDuration) => showToast({
|
|
63
|
+
showWarning: useCallback((text, duration = defaultDuration, title, showDismissButton) => showToast({
|
|
59
64
|
text,
|
|
60
65
|
status: "warning",
|
|
61
|
-
duration
|
|
66
|
+
duration,
|
|
67
|
+
title,
|
|
68
|
+
showDismissButton
|
|
62
69
|
}), [showToast]),
|
|
63
|
-
showError: useCallback((text, duration = defaultDuration) => showToast({
|
|
70
|
+
showError: useCallback((text, duration = defaultDuration, title, showDismissButton) => showToast({
|
|
64
71
|
text,
|
|
65
72
|
status: "error",
|
|
66
|
-
duration
|
|
73
|
+
duration,
|
|
74
|
+
title,
|
|
75
|
+
showDismissButton
|
|
67
76
|
}), [showToast]),
|
|
68
|
-
showLoading: useCallback((text, duration = defaultDuration) => showToast({
|
|
77
|
+
showLoading: useCallback((text, duration = defaultDuration, title, showDismissButton) => showToast({
|
|
69
78
|
text,
|
|
70
79
|
status: "loading",
|
|
71
|
-
duration
|
|
80
|
+
duration,
|
|
81
|
+
title,
|
|
82
|
+
showDismissButton
|
|
72
83
|
}), [showToast])
|
|
73
84
|
};
|
|
74
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToast.js","names":[],"sources":["../../src/toast/useToast.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { useCallback } from 'react'\n\nimport type { ToastDuration, ToastOptions, ToastSetup } from './toast.types'\n\nimport { useVuiContext } from '../core/vuiProvider/context'\nimport { Notification } from '../notification'\nimport { uid } from '../utils'\n\nexport const defaultDuration = 'fast'\nexport const fastToastDuration = 4000\nexport const slowToastDuration = 8000\n\nconst setup: ToastSetup = {\n options: {\n duration: defaultDuration,\n },\n componentList: [],\n}\n\nconst getDurationTime = (duration: ToastDuration) => (duration === 'fast' ? fastToastDuration : slowToastDuration)\n\nexport const useToast = () => {\n const { addToast, removeToast } = useVuiContext()\n\n const showToast = useCallback((options?: ToastOptions): void => {\n const id = options?.id ? options.id : uid('toast')\n const { duration = setup.options.duration, status = 'info', action, icon, text, title } = options || {}\n\n const toast = {\n id,\n component: (\n <Notification\n action={action}\n animation=\"fadeDown\"\n elevation={3}\n icon={icon}\n mt={{ md: 1, sm: '4px', xs: '4px' }}\n onClose={() => removeToast(id)}\n status={status}\n text={text}\n title={title}\n
|
|
1
|
+
{"version":3,"file":"useToast.js","names":[],"sources":["../../src/toast/useToast.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { useCallback } from 'react'\n\nimport type { ToastDuration, ToastOptions, ToastSetup } from './toast.types'\n\nimport { useVuiContext } from '../core/vuiProvider/context'\nimport { Notification } from '../notification'\nimport { uid } from '../utils'\n\nexport const defaultDuration = 'fast'\nexport const fastToastDuration = 4000\nexport const slowToastDuration = 8000\n\nconst setup: ToastSetup = {\n options: {\n duration: defaultDuration,\n },\n componentList: [],\n}\n\nconst getDurationTime = (duration: ToastDuration) => (duration === 'fast' ? fastToastDuration : slowToastDuration)\n\nexport const useToast = () => {\n const { addToast, removeToast } = useVuiContext()\n\n const showToast = useCallback((options?: ToastOptions): void => {\n const id = options?.id ? options.id : uid('toast')\n const { duration = setup.options.duration, status = 'info', action, icon, text, title, showDismissButton = true } = options || {}\n\n const toast = {\n id,\n component: (\n <Notification\n action={action}\n align=\"center\"\n animation=\"fadeDown\"\n ariaLive=\"polite\"\n elevation={3}\n icon={icon}\n mt={{ md: 1, sm: '4px', xs: '4px' }}\n onClose={() => removeToast(id)}\n role=\"status\"\n showDismissButton={showDismissButton}\n status={status}\n text={text}\n title={title}\n w={1}\n />\n ),\n }\n\n addToast(toast)\n\n if (duration && duration !== 'sticky') {\n window.setTimeout(() => removeToast(id), getDurationTime(duration))\n }\n }, [])\n\n const showInfo = useCallback(\n (text: ReactNode, duration: ToastDuration = defaultDuration, title?: ReactNode, showDismissButton?: boolean) =>\n showToast({ text, status: 'info', duration, title, showDismissButton }),\n [showToast],\n )\n\n const showSuccess = useCallback(\n (text: ReactNode, duration: ToastDuration = defaultDuration, title?: ReactNode, showDismissButton?: boolean) =>\n showToast({ text, status: 'success', duration, title, showDismissButton }),\n [showToast],\n )\n\n const showWarning = useCallback(\n (text: ReactNode, duration: ToastDuration = defaultDuration, title?: ReactNode, showDismissButton?: boolean) =>\n showToast({ text, status: 'warning', duration, title, showDismissButton }),\n [showToast],\n )\n\n const showError = useCallback(\n (text: ReactNode, duration: ToastDuration = defaultDuration, title?: ReactNode, showDismissButton?: boolean) =>\n showToast({ text, status: 'error', duration, title, showDismissButton }),\n [showToast],\n )\n\n const showLoading = useCallback(\n (text: ReactNode, duration: ToastDuration = defaultDuration, title?: ReactNode, showDismissButton?: boolean) =>\n showToast({ text, status: 'loading', duration, title, showDismissButton }),\n [showToast],\n )\n\n return {\n showToast,\n hideToast: removeToast,\n showInfo,\n showSuccess,\n showWarning,\n showError,\n showLoading,\n }\n}\n"],"mappings":";;;;;;;AAUA,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAa,oBAAoB;AAEjC,MAAM,QAAoB;CACxB,SAAS,EACP,UAAU,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EAAkB,CAAC,GACzE,CAAC,SAAS,CAeF;EACR,aAbkB,aACjB,MAAiB,WAA0B,iBAAiB,OAAmB,sBAC9E,UAAU;GAAE;GAAM,QAAQ;GAAW;GAAU;GAAO;EAAkB,CAAC,GAC3E,CAAC,SAAS,CAUA;CACZ;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "5.2.4
|
|
3
|
+
"version": "5.2.4",
|
|
4
4
|
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tanstack-intent"
|