vueless 0.0.51 → 0.0.53
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/adatper.locale/locales/en.js +2 -0
- package/directive.tooltip/index.js +25 -0
- package/index.js +9 -0
- package/package.json +5 -7
- package/service.ui/index.js +1 -0
- package/ui.button/composables/attrs.composable.js +9 -2
- package/ui.button-link/composables/attrs.composable.js +23 -3
- package/ui.button-toggle/configs/default.config.js +1 -0
- package/ui.container-modal-confirm/composable/attrs.composable.js +55 -5
- package/ui.form-calendar/configs/default.config.js +21 -21
- package/ui.form-color-picker/composables/attrs.composable.js +2 -9
- package/ui.form-date-picker/configs/default.config.js +1 -1
- package/ui.form-date-picker-range/configs/default.config.js +16 -16
- package/ui.form-input/configs/default.config.js +2 -2
- package/ui.form-radio-card/composables/attrs.composable.js +2 -2
- package/ui.form-select/configs/default.config.js +2 -2
- package/ui.form-textarea/configs/default.config.js +1 -1
- package/ui.image-icon/index.vue +4 -15
- package/ui.loader-rendering/composables/useLoaderRendering.js +19 -0
- package/ui.loader-rendering/index.vue +15 -16
- package/ui.navigation-pagination/configs/default.config.js +2 -2
- package/ui.notify/Docs.mdx +84 -0
- package/ui.notify/composables/attrs.composable.js +30 -0
- package/ui.notify/configs/default.config.js +47 -0
- package/ui.notify/constants/index.js +19 -0
- package/ui.notify/index.stories.js +77 -0
- package/ui.notify/index.vue +196 -214
- package/ui.notify/services/index.js +65 -63
- package/ui.other-loader-top/composables/useLoaderTop.js +57 -0
- package/ui.other-loader-top/index.vue +12 -13
- package/ui.text-alert/composables/attrs.composable.js +1 -1
- package/web-types.json +21 -3
- package/ui.loader-rendering/store/index.js +0 -17
- package/ui.notify/index.sto_ries.js +0 -102
- package/ui.other-loader-top/store/index.js +0 -59
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source, Markdown } from "@storybook/blocks";
|
|
2
|
+
import { getSource } from "../service.storybook";
|
|
3
|
+
|
|
4
|
+
import * as stories from "./index.stories";
|
|
5
|
+
import defaultConfig from "./configs/default.config?raw"
|
|
6
|
+
|
|
7
|
+
<Meta of={stories} />
|
|
8
|
+
<Title of={stories} />
|
|
9
|
+
<Subtitle of={stories} />
|
|
10
|
+
<Description of={stories} />
|
|
11
|
+
<Primary of={stories} />
|
|
12
|
+
<Controls of={stories.Default} />
|
|
13
|
+
<Stories of={stories} />
|
|
14
|
+
|
|
15
|
+
## **Default config**
|
|
16
|
+
<Source code={getSource(defaultConfig)} language="jsx" dark />
|
|
17
|
+
|
|
18
|
+
## Trigger notifications
|
|
19
|
+
You can trigger notification using *notify* method. Use *notifySuccess, notifyWarning, notifyError* methods to trigger notification of specific type.
|
|
20
|
+
|
|
21
|
+
<Source code={`
|
|
22
|
+
import {
|
|
23
|
+
notify,
|
|
24
|
+
notifySuccess,
|
|
25
|
+
notifyWarning,
|
|
26
|
+
notifyError,
|
|
27
|
+
} from "vueless";
|
|
28
|
+
|
|
29
|
+
notify({
|
|
30
|
+
type: "success" // success, warning, error
|
|
31
|
+
title: "" // Some label
|
|
32
|
+
text: "" // Some text content
|
|
33
|
+
duration: 1000 // Duration in milliseconds
|
|
34
|
+
delayDuplicates: false // Delay notifications with same text
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const durationInMilliseconds = 1000;
|
|
38
|
+
|
|
39
|
+
notifySuccess("Some success text", durationInMilliseconds);
|
|
40
|
+
notifyWarning("Some warning text", durationInMilliseconds);
|
|
41
|
+
notifyError("Some error text", durationInMilliseconds);
|
|
42
|
+
`} language="jsx" dark />
|
|
43
|
+
|
|
44
|
+
## Clear active notifications
|
|
45
|
+
Use *clearAllNotifications* method to clear all active notifications.
|
|
46
|
+
|
|
47
|
+
<Source code={`
|
|
48
|
+
import { clearAllNotifications, notifySuccess } from "vueless";
|
|
49
|
+
|
|
50
|
+
const durationInMilliseconds = 1000;
|
|
51
|
+
notifySuccess("Some success text", durationInMilliseconds);
|
|
52
|
+
|
|
53
|
+
clearAllNotifications();
|
|
54
|
+
`} language="jsx" dark />
|
|
55
|
+
|
|
56
|
+
## Trigger notifications
|
|
57
|
+
You can create delayed notification which you can trigger any time later.
|
|
58
|
+
|
|
59
|
+
<Source code={`
|
|
60
|
+
import { setDelayedNotify, getDelayedNotify } from "vueless";
|
|
61
|
+
|
|
62
|
+
setDelayedNotify({
|
|
63
|
+
type: "success" // success, warning, error
|
|
64
|
+
title: "" // Some label
|
|
65
|
+
text: "" // Some text content
|
|
66
|
+
duration: 1000 // Duration in milliseconds
|
|
67
|
+
delayDuplicates: false // Delay notifications with same text
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
setTimeout(getDelayedNotify, 10_000);
|
|
71
|
+
`} language="jsx" dark />
|
|
72
|
+
|
|
73
|
+
## Place notification relatively to navigation elements
|
|
74
|
+
Provide *positionClasses* key for UNotify config to take navigation elements offset into account.
|
|
75
|
+
By default, it will be looking for UNotifyPage and UNotifyAside classes.
|
|
76
|
+
|
|
77
|
+
<Source code={`
|
|
78
|
+
const notifyConfig = {
|
|
79
|
+
positionClasses: {
|
|
80
|
+
page: "UNotifyPage",
|
|
81
|
+
aside: "UNotifyAside",
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
`} language="jsx" dark />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import useUI from "../../composable.ui";
|
|
2
|
+
|
|
3
|
+
import defaultConfig from "../configs/default.config";
|
|
4
|
+
|
|
5
|
+
export function useAttrs(props) {
|
|
6
|
+
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
|
+
|
|
8
|
+
const wrapperAttrs = getAttrs("wrapper");
|
|
9
|
+
const bodyAttrs = getAttrs("body");
|
|
10
|
+
const contentAttrs = getAttrs("content");
|
|
11
|
+
const labelAttrs = getAttrs("label");
|
|
12
|
+
const descriptionAttrs = getAttrs("description");
|
|
13
|
+
const iconSuccessAttrs = getAttrs("iconSuccess");
|
|
14
|
+
const iconWarningAttrs = getAttrs("iconWarning");
|
|
15
|
+
const iconErrorAttrs = getAttrs("iconError");
|
|
16
|
+
const iconCloseAttrs = getAttrs("iconClose");
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
config,
|
|
20
|
+
wrapperAttrs,
|
|
21
|
+
bodyAttrs,
|
|
22
|
+
contentAttrs,
|
|
23
|
+
labelAttrs,
|
|
24
|
+
descriptionAttrs,
|
|
25
|
+
iconSuccessAttrs,
|
|
26
|
+
iconWarningAttrs,
|
|
27
|
+
iconCloseAttrs,
|
|
28
|
+
iconErrorAttrs,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export default /*tw*/ {
|
|
2
|
+
wrapper: "absolute overflow-visible md:w-[22rem]",
|
|
3
|
+
body: `
|
|
4
|
+
mb-3 flex w-fit items-center justify-center gap-3 rounded-2xl bg-gray-900/90
|
|
5
|
+
p-4 shadow-[0_4px_16px_rgba(17,24,39,0.5)] backdrop-blur-md md:shadow-[0_0px_12px_rgba(0,0,0,0.25)]
|
|
6
|
+
`,
|
|
7
|
+
bodySuccess: "bg-[radial-gradient(100.16%_500.78%_at_0%_50%,rgba(74,222,128,0.1)_2.17%,transparent)]",
|
|
8
|
+
bodyWarning: "bg-[radial-gradient(100.16%_500.78%_at_0%_50%,rgba(251,146,60,0.2)_2.17%,transparent)]",
|
|
9
|
+
bodyError: "bg-[radial-gradient(100.16%_500.78%_at_0%_50%,rgba(251,113,133,0.2)_2.17%,transparent)]",
|
|
10
|
+
content: "w-full flex flex-col max-w-full px-3 text-sm text-gray-200",
|
|
11
|
+
label: "mb-1 font-medium",
|
|
12
|
+
description: "break-words font-normal leading-5",
|
|
13
|
+
iconSuccess: "",
|
|
14
|
+
iconSuccessName: "check_circle",
|
|
15
|
+
iconWarning: "",
|
|
16
|
+
iconWarningName: "warning",
|
|
17
|
+
iconError: "",
|
|
18
|
+
iconErrorName: "error",
|
|
19
|
+
iconClose: "",
|
|
20
|
+
iconCloseName: "close",
|
|
21
|
+
transitionGroup: {
|
|
22
|
+
moveClass: "transition-all duration-500",
|
|
23
|
+
enterActiveClass: "transition-all duration-500",
|
|
24
|
+
leaveActiveClass: "transition-all duration-500 absolute",
|
|
25
|
+
enterFromClass: "opacity-0",
|
|
26
|
+
leaveToClass: "opacity-0",
|
|
27
|
+
},
|
|
28
|
+
duration: {
|
|
29
|
+
short: 4000,
|
|
30
|
+
medium: 8000,
|
|
31
|
+
long: 12000,
|
|
32
|
+
},
|
|
33
|
+
i18n: {
|
|
34
|
+
success: "Operation successful.",
|
|
35
|
+
warning: "Operation warning.",
|
|
36
|
+
error: "Operation error.",
|
|
37
|
+
},
|
|
38
|
+
positionClasses: {
|
|
39
|
+
page: "UNotifyPage",
|
|
40
|
+
aside: "UNotifyAside",
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
xPosition: "center",
|
|
44
|
+
yPosition: "top",
|
|
45
|
+
vHtml: false,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This const is needed to prevent the issue in script setup:
|
|
3
|
+
`defineProps` is referencing locally declared variables. (vue/valid-define-props)
|
|
4
|
+
*/
|
|
5
|
+
export const UNotify = "UNotify";
|
|
6
|
+
|
|
7
|
+
export const NOTIFY_TYPE = {
|
|
8
|
+
success: "success",
|
|
9
|
+
warning: "warning",
|
|
10
|
+
error: "error",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const POSITION = {
|
|
14
|
+
left: "left",
|
|
15
|
+
right: "right",
|
|
16
|
+
top: "top",
|
|
17
|
+
bottom: "bottom",
|
|
18
|
+
center: "center",
|
|
19
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { notify } from "../ui.notify/services";
|
|
2
|
+
|
|
3
|
+
import UNotify from "../ui.notify";
|
|
4
|
+
import UButton from "../ui.button";
|
|
5
|
+
|
|
6
|
+
import { getArgTypes } from "../service.storybook";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Other / Notify",
|
|
10
|
+
component: UNotify,
|
|
11
|
+
args: {
|
|
12
|
+
type: "success",
|
|
13
|
+
label: "",
|
|
14
|
+
text: "",
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
...getArgTypes(UNotify.name),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const DefaultTemplate = (args) => ({
|
|
22
|
+
components: { UNotify, UButton },
|
|
23
|
+
setup() {
|
|
24
|
+
return { args };
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<div>
|
|
28
|
+
<UNotify v-bind="args" />
|
|
29
|
+
|
|
30
|
+
<UButton label="show notify" @click="onClick"/>
|
|
31
|
+
</div>
|
|
32
|
+
`,
|
|
33
|
+
|
|
34
|
+
methods: {
|
|
35
|
+
onClick() {
|
|
36
|
+
const settings = {
|
|
37
|
+
type: "success",
|
|
38
|
+
label: "Some label",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
notify(settings);
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const TypesTemplate = (args) => ({
|
|
47
|
+
components: { UNotify, UButton },
|
|
48
|
+
setup() {
|
|
49
|
+
return { args };
|
|
50
|
+
},
|
|
51
|
+
template: `
|
|
52
|
+
<div class="flex gap-4">
|
|
53
|
+
<UNotify />
|
|
54
|
+
|
|
55
|
+
<UButton label="Success" @click="onClick('success')"/>
|
|
56
|
+
<UButton label="Warning" @click="onClick('warning')"/>
|
|
57
|
+
<UButton label="Error" @click="onClick('error')"/>
|
|
58
|
+
</div>
|
|
59
|
+
`,
|
|
60
|
+
|
|
61
|
+
methods: {
|
|
62
|
+
onClick(type) {
|
|
63
|
+
const settings = { type };
|
|
64
|
+
|
|
65
|
+
notify(settings);
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export const Default = DefaultTemplate.bind({});
|
|
71
|
+
Default.args = {};
|
|
72
|
+
|
|
73
|
+
export const position = DefaultTemplate.bind({});
|
|
74
|
+
position.args = { xPosition: "right", yPosition: "bottom" };
|
|
75
|
+
|
|
76
|
+
export const types = TypesTemplate.bind({});
|
|
77
|
+
types.args = {};
|