vueless 0.0.144 → 0.0.146
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/index.js +5 -9
- package/package.json +1 -1
- package/ui.button-toggle/configs/default.config.js +4 -0
- package/ui.button-toggle/index.vue +41 -2
- package/ui.button-toggle-item/configs/default.config.js +4 -0
- package/ui.button-toggle-item/index.vue +9 -0
- package/ui.loader-rendering/Docs.mdx +20 -5
- package/ui.loader-rendering/composables/useLoaderRendering.js +10 -12
- package/ui.loader-rendering/index.vue +6 -6
- package/ui.loader-top/Docs.mdx +4 -7
- package/ui.loader-top/composables/useLoaderTop.js +6 -9
- package/ui.loader-top/index.stories.js +2 -2
- package/ui.loader-top/index.vue +4 -4
- package/web-types.json +39 -3
package/index.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
+
/* eslint-disable vue/max-len, prettier/prettier */
|
|
1
2
|
import { createLocale, LocaleSymbol } from "./composable.locale";
|
|
2
|
-
import {
|
|
3
|
-
createLoaderRendering,
|
|
4
|
-
LoaderRenderingSymbol,
|
|
5
|
-
} from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
3
|
+
import { createLoaderRendering, LoaderRenderingSymbol } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
6
4
|
import { createLoaderTop, LoaderTopSymbol } from "./ui.loader-top/composables/useLoaderTop";
|
|
7
5
|
|
|
8
6
|
export { default as createVueI18nAdapter } from "./adatper.locale/vue-i18n";
|
|
9
7
|
export { default as defaultEnLocale } from "./adatper.locale/locales/en";
|
|
10
8
|
export { useLocale } from "./composable.locale";
|
|
11
|
-
export { useLoaderRendering } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
12
9
|
export { useLoaderTop } from "./ui.loader-top/composables/useLoaderTop";
|
|
13
|
-
export {
|
|
14
|
-
loaderRenderingOn,
|
|
15
|
-
loaderRenderingOff,
|
|
16
|
-
} from "./ui.loader-rendering/services/loaderRedering.service";
|
|
17
10
|
export { loaderTopOn, loaderTopOff } from "./ui.loader-top/services/loaderTop.service";
|
|
11
|
+
export { useLoaderRendering } from "./ui.loader-rendering/composables/useLoaderRendering";
|
|
12
|
+
export { loaderRenderingOn, loaderRenderingOff } from "./ui.loader-rendering/services/loaderRedering.service";
|
|
18
13
|
export {
|
|
19
14
|
notify,
|
|
20
15
|
notifySuccess,
|
|
@@ -24,6 +19,7 @@ export {
|
|
|
24
19
|
setDelayedNotify,
|
|
25
20
|
getDelayedNotify,
|
|
26
21
|
} from "./ui.text-notify/services";
|
|
22
|
+
/* eslint-enable vue/max-len, prettier/prettier */
|
|
27
23
|
|
|
28
24
|
export function createVueless(options = {}) {
|
|
29
25
|
const i18n = createLocale(options.i18n);
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ const props = defineProps({
|
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Toggle
|
|
42
|
+
* Toggle variant.
|
|
43
43
|
* @values primary, secondary, thirdary
|
|
44
44
|
*/
|
|
45
45
|
variant: {
|
|
@@ -65,7 +65,7 @@ const props = defineProps({
|
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Toggle size.
|
|
68
|
-
* @values xs, sm, md, lg
|
|
68
|
+
* @values 2xs, xs, sm, md, lg, xl
|
|
69
69
|
*/
|
|
70
70
|
size: {
|
|
71
71
|
type: String,
|
|
@@ -88,6 +88,39 @@ const props = defineProps({
|
|
|
88
88
|
default: UIService.get(defaultConfig, UToggle).default.multiple,
|
|
89
89
|
},
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Button color.
|
|
93
|
+
* @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
|
|
94
|
+
*/
|
|
95
|
+
color: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: UIService.get(defaultConfig, UToggle).default.color,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Fill the background for thirdary variant.
|
|
102
|
+
*/
|
|
103
|
+
filled: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: UIService.get(defaultConfig, UToggle).default.filled,
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Set button corners rounded.
|
|
110
|
+
*/
|
|
111
|
+
pill: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: UIService.get(defaultConfig, UToggle).default.pill,
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Set the same paddings for the button.
|
|
118
|
+
*/
|
|
119
|
+
square: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: UIService.get(defaultConfig, UToggle).default.square,
|
|
122
|
+
},
|
|
123
|
+
|
|
91
124
|
/**
|
|
92
125
|
* Sets data-cy attribute for automated testing.
|
|
93
126
|
*/
|
|
@@ -129,6 +162,12 @@ provide("toggleName", () => props.name);
|
|
|
129
162
|
provide("toggleSize", () => props.size);
|
|
130
163
|
provide("toggleBlock", () => props.block);
|
|
131
164
|
provide("toggleVariant", () => props.variant);
|
|
165
|
+
provide("toggleColor", () => props.color);
|
|
166
|
+
provide("toggleFilled", () => props.filled);
|
|
167
|
+
provide("toggleDisabled", () => props.disabled);
|
|
168
|
+
provide("togglePill", () => props.pill);
|
|
169
|
+
provide("toggleSquare", () => props.square);
|
|
170
|
+
|
|
132
171
|
provide("toggleSelectedValue", {
|
|
133
172
|
selectedValue: readonly(selectedValue),
|
|
134
173
|
updateSelectedValue,
|
|
@@ -2,10 +2,14 @@ export default /*tw*/ {
|
|
|
2
2
|
button: "rounded-none",
|
|
3
3
|
input: "p-0 m-0 size-0 invisible peer absolute",
|
|
4
4
|
defaultVariants: {
|
|
5
|
+
color: "brand",
|
|
5
6
|
variant: "primary",
|
|
6
7
|
type: "radio",
|
|
7
8
|
size: "md",
|
|
8
9
|
block: false,
|
|
10
|
+
pill: false,
|
|
11
|
+
square: false,
|
|
12
|
+
filled: false,
|
|
9
13
|
disabled: false,
|
|
10
14
|
},
|
|
11
15
|
};
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
:size="toValue(size)"
|
|
8
8
|
:block="toValue(block)"
|
|
9
9
|
:variant="toValue(variant)"
|
|
10
|
+
:color="color"
|
|
11
|
+
:pill="pill"
|
|
12
|
+
:filled="filled"
|
|
13
|
+
:square="square"
|
|
10
14
|
v-bind="buttonAttrs"
|
|
11
15
|
@click="onClickSetValue"
|
|
12
16
|
>
|
|
@@ -115,6 +119,11 @@ const type = inject("toggleType", UIService.get(defaultConfig, UToggleItem).defa
|
|
|
115
119
|
const size = inject("toggleSize", UIService.get(defaultConfig, UToggleItem).default.size);
|
|
116
120
|
const block = inject("toggleBlock", UIService.get(defaultConfig, UToggleItem).default.block);
|
|
117
121
|
const variant = inject("toggleVariant", UIService.get(defaultConfig, UToggleItem).default.variant);
|
|
122
|
+
const color = inject("toggleColor", UIService.get(defaultConfig, UToggleItem).default.color);
|
|
123
|
+
const filled = inject("toggleFilled", UIService.get(defaultConfig, UToggleItem).default.filled);
|
|
124
|
+
const pill = inject("togglePill", UIService.get(defaultConfig, UToggleItem).default.pill);
|
|
125
|
+
const square = inject("toggleSquare", UIService.get(defaultConfig, UToggleItem).default.square);
|
|
126
|
+
|
|
118
127
|
const { selectedValue, updateSelectedValue } = inject("toggleSelectedValue", {});
|
|
119
128
|
|
|
120
129
|
const { buttonAttrs, inputAttrs } = useAttrs(props);
|
|
@@ -11,18 +11,33 @@ import * as stories from "./index.stories";
|
|
|
11
11
|
<Controls of={stories.Default} />
|
|
12
12
|
<Stories of={stories} />
|
|
13
13
|
|
|
14
|
-
##
|
|
15
|
-
|
|
14
|
+
## Using loader
|
|
15
|
+
To control the loader state in Vue components use `useLoaderRendering` composable.
|
|
16
16
|
|
|
17
17
|
<Source code={`
|
|
18
18
|
import { useLoaderRendering } from "vueless";
|
|
19
19
|
|
|
20
|
-
const {
|
|
20
|
+
const { isLoading, loaderRenderingOn, loaderRenderingOff } = useLoaderRendering();
|
|
21
|
+
|
|
22
|
+
// get loader state
|
|
23
|
+
console.log(isLoading.value);
|
|
24
|
+
|
|
25
|
+
// show loader
|
|
26
|
+
loaderRenderingOn();
|
|
27
|
+
|
|
28
|
+
// hide loader
|
|
29
|
+
loaderRenderingOff();
|
|
21
30
|
`} language="jsx" dark />
|
|
22
31
|
|
|
23
|
-
##
|
|
24
|
-
|
|
32
|
+
## Using loader outside Vue components
|
|
33
|
+
To control the loader state outside Vue components, use the following methods.
|
|
25
34
|
|
|
26
35
|
<Source code={`
|
|
27
36
|
import { loaderRenderingOn, loaderRenderingOff } from "vueless";
|
|
37
|
+
|
|
38
|
+
// show loader
|
|
39
|
+
loaderRenderingOn();
|
|
40
|
+
|
|
41
|
+
// hide loader
|
|
42
|
+
loaderRenderingOff();
|
|
28
43
|
`} language="jsx" dark />
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import { readonly, ref
|
|
1
|
+
import { inject, readonly, ref } from "vue";
|
|
2
2
|
|
|
3
3
|
export const LoaderRenderingSymbol = Symbol.for("vueless:loader-rendering");
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const isLoading = ref(true);
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function loaderRenderingOn() {
|
|
8
|
+
isLoading.value = true;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function
|
|
12
|
-
|
|
11
|
+
function loaderRenderingOff() {
|
|
12
|
+
isLoading.value = false;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function createLoaderRendering() {
|
|
16
16
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
isLoading: readonly(isLoading),
|
|
18
|
+
loaderRenderingOn,
|
|
19
|
+
loaderRenderingOff,
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function useLoaderRendering() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return loaderRenderingState;
|
|
24
|
+
return inject(LoaderRenderingSymbol);
|
|
27
25
|
}
|
|
@@ -40,19 +40,19 @@ const props = defineProps({
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
const { wrapperAttrs, config } = useAttrs(props);
|
|
43
|
-
const {
|
|
43
|
+
const { isLoading, loaderRenderingOn, loaderRenderingOff } = useLoaderRendering();
|
|
44
44
|
|
|
45
45
|
onMounted(() => {
|
|
46
|
-
window.addEventListener("setRenderingStarted",
|
|
47
|
-
window.addEventListener("setRenderingFinished",
|
|
46
|
+
window.addEventListener("setRenderingStarted", loaderRenderingOn);
|
|
47
|
+
window.addEventListener("setRenderingFinished", loaderRenderingOff);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
onUnmounted(() => {
|
|
51
|
-
window.removeEventListener("setRenderingStarted",
|
|
52
|
-
window.removeEventListener("setRenderingFinished",
|
|
51
|
+
window.removeEventListener("setRenderingStarted", loaderRenderingOn);
|
|
52
|
+
window.removeEventListener("setRenderingFinished", loaderRenderingOff);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
const showLoader = computed(() => {
|
|
56
|
-
return props.loading ||
|
|
56
|
+
return props.loading || isLoading.value;
|
|
57
57
|
});
|
|
58
58
|
</script>
|
package/ui.loader-top/Docs.mdx
CHANGED
|
@@ -21,9 +21,9 @@ You can control loader state using *useLoaderRendering* composable.
|
|
|
21
21
|
<Source code={`
|
|
22
22
|
import { useLoaderTop } from "vueless";
|
|
23
23
|
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const {
|
|
25
|
+
loaderTopOn,
|
|
26
|
+
loaderTopOff,
|
|
27
27
|
addRequestUrl,
|
|
28
28
|
removeRequestUrl
|
|
29
29
|
} = useLoaderTop();
|
|
@@ -33,8 +33,5 @@ const {
|
|
|
33
33
|
You can control loader state outside of vue components using following methods.
|
|
34
34
|
|
|
35
35
|
<Source code={`
|
|
36
|
-
import {
|
|
37
|
-
loaderTopOn,
|
|
38
|
-
loaderTopOff,
|
|
39
|
-
} from "vueless";
|
|
36
|
+
import { loaderTopOn, loaderTopOff } from "vueless";
|
|
40
37
|
`} language="jsx" dark />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject, readonly, ref } from "vue";
|
|
2
2
|
|
|
3
3
|
export const LoaderTopSymbol = Symbol.for("vueless:loader-top");
|
|
4
4
|
|
|
@@ -8,15 +8,14 @@ const loaderRequestQueue = ref([]);
|
|
|
8
8
|
const loaderRequestTimeout = ref(0);
|
|
9
9
|
const componentLoaderRequestQueue = ref([]);
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function loaderTopOn(url) {
|
|
12
12
|
loaderRequestQueue.value.push(url);
|
|
13
|
-
|
|
14
13
|
isLoading.value = true;
|
|
15
14
|
|
|
16
15
|
clearTimeout(loaderRequestTimeout.value);
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
function
|
|
18
|
+
function loaderTopOff(url) {
|
|
20
19
|
loaderRequestQueue.value = url ? loaderRequestQueue.value.filter((item) => item !== url) : [];
|
|
21
20
|
|
|
22
21
|
loaderRequestTimeout.value = setTimeout(() => {
|
|
@@ -49,8 +48,8 @@ export function createLoaderTop() {
|
|
|
49
48
|
loaderRequestQueue: readonly(loaderRequestQueue),
|
|
50
49
|
loaderRequestTimeout: readonly(loaderRequestTimeout),
|
|
51
50
|
componentLoaderRequestQueue: readonly(componentLoaderRequestQueue),
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
loaderTopOn,
|
|
52
|
+
loaderTopOff,
|
|
54
53
|
addRequestUrl,
|
|
55
54
|
removeRequestUrl,
|
|
56
55
|
setComponentRequestQueue,
|
|
@@ -59,7 +58,5 @@ export function createLoaderTop() {
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
export function useLoaderTop() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return loaderTopState;
|
|
61
|
+
return inject(LoaderTopSymbol);
|
|
65
62
|
}
|
|
@@ -21,9 +21,9 @@ export default {
|
|
|
21
21
|
const DefaultTemplate = (args) => ({
|
|
22
22
|
components: { ULoaderTop, UButton },
|
|
23
23
|
setup() {
|
|
24
|
-
const {
|
|
24
|
+
const { loaderTopOn, loaderTopOff } = useLoaderTop();
|
|
25
25
|
|
|
26
|
-
return { args,
|
|
26
|
+
return { args, loaderTopOn, loaderTopOff };
|
|
27
27
|
},
|
|
28
28
|
template: `
|
|
29
29
|
<div>
|
package/ui.loader-top/index.vue
CHANGED
|
@@ -49,8 +49,8 @@ const {
|
|
|
49
49
|
componentLoaderRequestQueue,
|
|
50
50
|
setComponentRequestQueue,
|
|
51
51
|
removeComponentRequestQueue,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
loaderTopOff,
|
|
53
|
+
loaderTopOn,
|
|
54
54
|
} = useLoaderTop();
|
|
55
55
|
const { progressAttrs } = useAttrs(props, { error, isMobileApp });
|
|
56
56
|
|
|
@@ -93,11 +93,11 @@ onUnmounted(() => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
function setLoaderOnHandler(event) {
|
|
96
|
-
|
|
96
|
+
loaderTopOn(event.detail.resource);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function setLoaderOffHandler(event) {
|
|
100
|
-
|
|
100
|
+
loaderTopOff(event.detail.resource);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function requestWithoutQuery(request) {
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.146",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -7004,7 +7004,7 @@
|
|
|
7004
7004
|
},
|
|
7005
7005
|
{
|
|
7006
7006
|
"name": "variant",
|
|
7007
|
-
"description": "Toggle
|
|
7007
|
+
"description": "Toggle variant.",
|
|
7008
7008
|
"value": {
|
|
7009
7009
|
"kind": "expression",
|
|
7010
7010
|
"type": "'primary' | 'secondary' | 'thirdary'"
|
|
@@ -7034,7 +7034,7 @@
|
|
|
7034
7034
|
"description": "Toggle size.",
|
|
7035
7035
|
"value": {
|
|
7036
7036
|
"kind": "expression",
|
|
7037
|
-
"type": "'xs' | 'sm' | 'md' | 'lg'"
|
|
7037
|
+
"type": "'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'"
|
|
7038
7038
|
},
|
|
7039
7039
|
"default": "md"
|
|
7040
7040
|
},
|
|
@@ -7056,6 +7056,42 @@
|
|
|
7056
7056
|
},
|
|
7057
7057
|
"default": "false"
|
|
7058
7058
|
},
|
|
7059
|
+
{
|
|
7060
|
+
"name": "color",
|
|
7061
|
+
"description": "Button color.",
|
|
7062
|
+
"value": {
|
|
7063
|
+
"kind": "expression",
|
|
7064
|
+
"type": "'brand' | 'grayscale' | 'gray' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'white'"
|
|
7065
|
+
},
|
|
7066
|
+
"default": "brand"
|
|
7067
|
+
},
|
|
7068
|
+
{
|
|
7069
|
+
"name": "filled",
|
|
7070
|
+
"description": "Fill the background for thirdary variant.",
|
|
7071
|
+
"value": {
|
|
7072
|
+
"kind": "expression",
|
|
7073
|
+
"type": "boolean"
|
|
7074
|
+
},
|
|
7075
|
+
"default": "false"
|
|
7076
|
+
},
|
|
7077
|
+
{
|
|
7078
|
+
"name": "pill",
|
|
7079
|
+
"description": "Set button corners rounded.",
|
|
7080
|
+
"value": {
|
|
7081
|
+
"kind": "expression",
|
|
7082
|
+
"type": "boolean"
|
|
7083
|
+
},
|
|
7084
|
+
"default": "false"
|
|
7085
|
+
},
|
|
7086
|
+
{
|
|
7087
|
+
"name": "square",
|
|
7088
|
+
"description": "Set the same paddings for the button.",
|
|
7089
|
+
"value": {
|
|
7090
|
+
"kind": "expression",
|
|
7091
|
+
"type": "boolean"
|
|
7092
|
+
},
|
|
7093
|
+
"default": "false"
|
|
7094
|
+
},
|
|
7059
7095
|
{
|
|
7060
7096
|
"name": "dataCy",
|
|
7061
7097
|
"description": "Sets data-cy attribute for automated testing.",
|