vueless 0.0.210 → 0.0.211
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/package.json +1 -1
- package/ui.container-group/configs/default.config.js +19 -1
- package/ui.container-group/index.vue +26 -1
- package/ui.container-row/configs/default.config.js +21 -3
- package/ui.container-row/index.vue +27 -2
- package/ui.data-list/composables/attrs.composable.js +39 -36
- package/ui.data-list/configs/default.config.js +6 -4
- package/ui.data-list/index.stories.js +2 -4
- package/ui.data-list/index.vue +34 -5
- package/ui.data-table/composables/attrs.composable.js +180 -245
- package/ui.data-table/configs/default.config.js +10 -10
- package/ui.data-table/index.vue +52 -12
- package/ui.form-checkbox/composables/attrs.composable.js +28 -43
- package/ui.form-checkbox/configs/default.config.js +2 -2
- package/ui.form-checkbox/index.stories.js +2 -4
- package/ui.form-checkbox/index.vue +16 -4
- package/ui.form-checkbox-group/composables/attrs.composable.js +24 -9
- package/ui.form-checkbox-group/configs/default.config.js +2 -2
- package/ui.form-checkbox-group/index.vue +8 -2
- package/ui.form-checkbox-multi-state/composables/attrs.composable.js +34 -12
- package/ui.form-checkbox-multi-state/configs/default.config.js +1 -1
- package/ui.form-checkbox-multi-state/index.vue +8 -2
- package/ui.form-input-file/composables/attrs.composable.js +19 -62
- package/ui.form-input-file/configs/default.config.js +7 -7
- package/ui.form-input-file/index.vue +15 -3
- package/ui.form-input-money/composables/attrs.composable.js +23 -4
- package/ui.form-input-money/configs/default.config.js +1 -1
- package/ui.form-input-money/index.stories.js +2 -4
- package/ui.form-input-number/composables/attrs.composable.js +22 -36
- package/ui.form-input-number/configs/default.config.js +4 -4
- package/ui.form-input-number/index.vue +8 -2
- package/ui.form-input-rating/composables/attrs.composable.js +10 -11
- package/ui.form-input-rating/index.vue +2 -2
- package/ui.form-input-search/composables/attrs.composable.js +26 -11
- package/ui.form-input-search/configs/default.config.js +4 -4
- package/ui.form-input-search/index.stories.js +2 -4
- package/ui.form-input-search/index.vue +21 -4
- package/ui.form-label/composables/attrs.composable.js +22 -49
- package/ui.form-label/index.vue +9 -2
- package/ui.form-radio/composables/attrs.composable.js +29 -22
- package/ui.form-radio/configs/default.config.js +1 -1
- package/ui.form-radio/index.stories.js +2 -4
- package/ui.form-radio/index.vue +8 -2
- package/ui.form-radio-group/composables/attrs.composable.js +20 -15
- package/ui.form-radio-group/configs/default.config.js +2 -1
- package/ui.form-radio-group/index.vue +8 -2
- package/ui.form-switch/composables/attrs.composable.js +25 -61
- package/ui.form-switch/configs/default.config.js +2 -2
- package/ui.form-switch/index.vue +8 -2
- package/ui.form-textarea/composables/attrs.composable.js +25 -36
- package/ui.form-textarea/configs/default.config.js +1 -1
- package/ui.form-textarea/index.stories.js +3 -5
- package/ui.form-textarea/index.vue +35 -4
- package/ui.navigation-pagination/composables/attrs.composable.js +41 -31
- package/ui.navigation-pagination/configs/default.config.js +2 -2
- package/ui.navigation-pagination/index.vue +22 -6
- package/ui.navigation-progress/components/StepperProgress.vue +1 -1
- package/ui.navigation-progress/composables/attrs.composable.js +19 -22
- package/ui.navigation-progress/index.vue +14 -1
- package/ui.navigation-tab/composables/attrs.composable.js +25 -20
- package/ui.navigation-tab/index.vue +1 -1
- package/ui.navigation-tabs/composables/attrs.composable.js +19 -13
- package/ui.navigation-tabs/configs/default.config.js +1 -1
- package/ui.navigation-tabs/index.vue +9 -2
- package/ui.text-file/configs/default.config.js +3 -0
- package/ui.text-file/index.vue +36 -25
- package/ui.text-files/index.vue +8 -0
- package/ui.text-header/configs/default.config.js +1 -0
- package/ui.text-header/index.stories.js +2 -2
- package/ui.text-header/index.vue +16 -12
- package/web-types.json +383 -62
|
@@ -4,47 +4,36 @@ import { cva } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const cvaTextarea = cva({
|
|
12
|
-
base: textarea.base,
|
|
13
|
-
variants: textarea.variants,
|
|
14
|
-
compoundVariants: textarea.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const cvaTextareaWrapper = cva({
|
|
18
|
-
base: textareaWrapper.base,
|
|
19
|
-
variants: textareaWrapper.variants,
|
|
20
|
-
compoundVariants: textareaWrapper.compoundVariants,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const textareaWrapperClasses = computed(() =>
|
|
24
|
-
cvaTextareaWrapper({
|
|
25
|
-
error: Boolean(props.error),
|
|
26
|
-
size: props.size,
|
|
27
|
-
readonly: props.readonly,
|
|
28
|
-
disabled: props.disabled,
|
|
29
|
-
labelAlign: props.labelAlign,
|
|
30
|
-
label: Boolean(props.label),
|
|
31
|
-
}),
|
|
7
|
+
export default function useAttrs(props) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
32
11
|
);
|
|
12
|
+
const attrs = {};
|
|
33
13
|
|
|
34
|
-
const
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
35
16
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
17
|
+
const classes = computed(() => {
|
|
18
|
+
const value = config.value[key];
|
|
19
|
+
|
|
20
|
+
if (value.variants || value.compoundVariants) {
|
|
21
|
+
return cva(value)({
|
|
22
|
+
...props,
|
|
23
|
+
error: Boolean(props.error),
|
|
24
|
+
label: Boolean(props.label),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return "";
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
32
|
+
}
|
|
41
33
|
|
|
42
34
|
return {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
textareaWrapperAttrs,
|
|
46
|
-
leftSlotAttrs,
|
|
47
|
-
rightSlotAttrs,
|
|
35
|
+
...attrs,
|
|
36
|
+
config,
|
|
48
37
|
hasSlotContent,
|
|
49
38
|
};
|
|
50
39
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UTextarea from "../ui.form-textarea";
|
|
4
4
|
import UIcon from "../ui.image-icon";
|
|
@@ -32,9 +32,7 @@ const DefaultTemplate = (args) => ({
|
|
|
32
32
|
<UTextarea
|
|
33
33
|
v-bind="args"
|
|
34
34
|
>
|
|
35
|
-
|
|
36
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
37
|
-
</template>
|
|
35
|
+
${allSlotsFragment}
|
|
38
36
|
</UTextarea>
|
|
39
37
|
`,
|
|
40
38
|
});
|
|
@@ -140,7 +138,7 @@ slotLeft.args = {
|
|
|
140
138
|
};
|
|
141
139
|
|
|
142
140
|
export const slotRight = SlotTemplate.bind({});
|
|
143
|
-
|
|
141
|
+
slotRight.args = {
|
|
144
142
|
slotTemplate: `
|
|
145
143
|
<template #right>
|
|
146
144
|
<UIcon
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
:for="id"
|
|
18
18
|
v-bind="leftSlotAttrs"
|
|
19
19
|
>
|
|
20
|
-
<!-- @slot Use it to add
|
|
20
|
+
<!-- @slot Use it to add something before the text. -->
|
|
21
21
|
<slot name="left" />
|
|
22
22
|
</label>
|
|
23
23
|
<label ref="textareaWrapper" :for="id" v-bind="textareaWrapperAttrs">
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
/>
|
|
43
43
|
</label>
|
|
44
44
|
<label v-if="hasSlotContent($slots['right'])" :for="id" v-bind="rightSlotAttrs">
|
|
45
|
-
<!-- @slot Use it to add
|
|
45
|
+
<!-- @slot Use it to add something after the text. -->
|
|
46
46
|
<slot name="right" />
|
|
47
47
|
</label>
|
|
48
48
|
</ULabel>
|
|
@@ -56,7 +56,7 @@ import UIService, { getRandomId } from "../service.ui";
|
|
|
56
56
|
|
|
57
57
|
import { UTextarea } from "./constants";
|
|
58
58
|
import defaultConfig from "./configs/default.config";
|
|
59
|
-
import
|
|
59
|
+
import useAttrs from "./composables/attrs.composable";
|
|
60
60
|
|
|
61
61
|
/* Should be a string for correct web-types gen */
|
|
62
62
|
defineOptions({ name: "UTextarea", inheritAttrs: false });
|
|
@@ -187,7 +187,38 @@ const props = defineProps({
|
|
|
187
187
|
},
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
-
const emit = defineEmits([
|
|
190
|
+
const emit = defineEmits([
|
|
191
|
+
/**
|
|
192
|
+
* Triggers when the textarea value changes.
|
|
193
|
+
* @property {string} value
|
|
194
|
+
*/
|
|
195
|
+
"update:modelValue",
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Triggers when the textarea value changes.
|
|
199
|
+
*/
|
|
200
|
+
"change",
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Triggers when the textarea is clicked.
|
|
204
|
+
*/
|
|
205
|
+
"click",
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Triggers when the textarea is focused.
|
|
209
|
+
*/
|
|
210
|
+
"focus",
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Triggers when the textarea loses focus.
|
|
214
|
+
*/
|
|
215
|
+
"blur",
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Triggers when mouse button is released over the element.
|
|
219
|
+
*/
|
|
220
|
+
"mousedown",
|
|
221
|
+
]);
|
|
191
222
|
|
|
192
223
|
const slots = useSlots();
|
|
193
224
|
|
|
@@ -1,45 +1,55 @@
|
|
|
1
1
|
import useUI from "../../composable.ui";
|
|
2
2
|
|
|
3
3
|
import defaultConfig from "../configs/default.config";
|
|
4
|
-
import { cx } from "../../service.ui";
|
|
4
|
+
import { cva, cx } from "../../service.ui";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
7
|
+
export default function useAttrs(props) {
|
|
8
|
+
const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
|
|
9
|
+
const attrs = {};
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const itemEllipsisAttrs = getAttrs("itemEllipsis");
|
|
13
|
-
const ellipsisAttrs = getAttrs("ellipsis");
|
|
14
|
-
const navigationButtonAttrs = getAttrs("navigationButton", { isComponent: true });
|
|
15
|
-
const navigationButtonTextAttrs = getAttrs("navigationButtonText");
|
|
16
|
-
const pageButtonAttrsRaw = getAttrs("pageButton", { isComponent: true });
|
|
11
|
+
for (const key in defaultConfig) {
|
|
12
|
+
if (isSystemKey(key)) continue;
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const classes = computed(() => {
|
|
15
|
+
const value = config.value[key];
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
if (value.variants || value.compoundVariants) {
|
|
18
|
+
return cva(value)({
|
|
19
|
+
...props,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
return "";
|
|
24
|
+
});
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
27
|
+
|
|
28
|
+
if (key === "item") {
|
|
29
|
+
attrs.itemAttrs = computed(() => (page = 0) => {
|
|
30
|
+
const itemClass = page && !isFinite(page.number) && getAttrs("ellipsis");
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
...getAttrs("item"),
|
|
34
|
+
class: cx([getAttrs("item").value.class, itemClass]),
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (key === "pageButton") {
|
|
40
|
+
attrs.pageButtonAttrs = computed(() => (page) => {
|
|
41
|
+
const pageButtonActiveClasses = page.isActive && config.value.pageButtonActive;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
...getAttrs("pageButton"),
|
|
45
|
+
class: cx([getAttrs("pageButton").value.class, pageButtonActiveClasses]),
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
35
50
|
|
|
36
51
|
return {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
itemEllipsisAttrs,
|
|
40
|
-
navigationButtonAttrs,
|
|
41
|
-
navigationButtonTextAttrs,
|
|
42
|
-
pageButtonAttrs,
|
|
43
|
-
ellipsisAttrs,
|
|
52
|
+
...attrs,
|
|
53
|
+
config,
|
|
44
54
|
};
|
|
45
55
|
}
|
|
@@ -3,9 +3,9 @@ export default /*tw*/ {
|
|
|
3
3
|
item: "h-9 min-w-9 flex items-center justify-center",
|
|
4
4
|
ellipsis: "hidden md:flex",
|
|
5
5
|
itemEllipsis: "leading-none",
|
|
6
|
-
navigationButton: "size-full rounded font-normal disabled:hover:bg-transparent",
|
|
6
|
+
navigationButton: "{UButton} size-full rounded font-normal disabled:hover:bg-transparent",
|
|
7
7
|
navigationButtonText: "h-9 min-w-9 leading-none",
|
|
8
|
-
pageButton: "size-full rounded font-normal disabled:hover:bg-transparent",
|
|
8
|
+
pageButton: "{UButton} size-full rounded font-normal disabled:hover:bg-transparent",
|
|
9
9
|
pageButtonActive: `
|
|
10
10
|
rounded !bg-brand-900/15
|
|
11
11
|
hover:!text-brand-900 !hover:bg-brand-900/15 disabled:hover:bg-brand-900/15
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
v-bind="navigationButtonAttrs"
|
|
10
10
|
@click="goToFirstPage"
|
|
11
11
|
>
|
|
12
|
-
|
|
12
|
+
<!-- @slot Use it to add something instead of the "first" label. -->
|
|
13
|
+
<slot name="first">
|
|
13
14
|
<span v-bind="navigationButtonTextAttrs" v-html="firstLabel" />
|
|
14
15
|
</slot>
|
|
15
16
|
</UButton>
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
v-bind="navigationButtonAttrs"
|
|
24
25
|
@click="goToPrevPage"
|
|
25
26
|
>
|
|
26
|
-
|
|
27
|
+
<!-- @slot Use it to add something instead of the "prev" label. -->
|
|
28
|
+
<slot name="prev">
|
|
27
29
|
<span v-bind="navigationButtonTextAttrs" v-html="prevLabel" />
|
|
28
30
|
</slot>
|
|
29
31
|
</UButton>
|
|
@@ -54,7 +56,8 @@
|
|
|
54
56
|
v-bind="navigationButtonAttrs"
|
|
55
57
|
@click="goToNextPage"
|
|
56
58
|
>
|
|
57
|
-
|
|
59
|
+
<!-- @slot Use it to add something instead of the "next" label. -->
|
|
60
|
+
<slot name="next">
|
|
58
61
|
<span v-bind="navigationButtonTextAttrs" v-html="nextLabel" />
|
|
59
62
|
</slot>
|
|
60
63
|
</UButton>
|
|
@@ -68,7 +71,8 @@
|
|
|
68
71
|
v-bind="navigationButtonAttrs"
|
|
69
72
|
@click="goToLastPage"
|
|
70
73
|
>
|
|
71
|
-
|
|
74
|
+
<!-- @slot Use it to add something instead of the "last" label. -->
|
|
75
|
+
<slot name="last">
|
|
72
76
|
<span v-bind="navigationButtonTextAttrs" v-html="lastLabel" />
|
|
73
77
|
</slot>
|
|
74
78
|
</UButton>
|
|
@@ -85,7 +89,7 @@ import UIService from "../service.ui";
|
|
|
85
89
|
|
|
86
90
|
import defaultConfig from "./configs/default.config";
|
|
87
91
|
import { UPagination, ELLIPSIS_LABEL } from "./constants";
|
|
88
|
-
import
|
|
92
|
+
import useAttrs from "./composables/attrs.composable";
|
|
89
93
|
|
|
90
94
|
/* Should be a string for correct web-types gen */
|
|
91
95
|
defineOptions({ name: "UPagination", inheritAttrs: false });
|
|
@@ -207,7 +211,19 @@ const props = defineProps({
|
|
|
207
211
|
},
|
|
208
212
|
});
|
|
209
213
|
|
|
210
|
-
const emit = defineEmits([
|
|
214
|
+
const emit = defineEmits([
|
|
215
|
+
/**
|
|
216
|
+
* Triggers when current page changes.
|
|
217
|
+
* @property {number} value
|
|
218
|
+
*/
|
|
219
|
+
"change",
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Triggers when current page changes.
|
|
223
|
+
* @property {number} value
|
|
224
|
+
*/
|
|
225
|
+
"update:modelValue",
|
|
226
|
+
]);
|
|
211
227
|
|
|
212
228
|
const {
|
|
213
229
|
listAttrs,
|
|
@@ -40,7 +40,7 @@ import { computed } from "vue";
|
|
|
40
40
|
|
|
41
41
|
import { GRAY_COLORS } from "../../preset.tailwind/constants";
|
|
42
42
|
|
|
43
|
-
import
|
|
43
|
+
import useAttrs from "../composables/attrs.composable";
|
|
44
44
|
|
|
45
45
|
const props = defineProps({
|
|
46
46
|
progressPercent: {
|
|
@@ -4,45 +4,42 @@ import { cva, cx } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props) {
|
|
7
|
+
export default function useAttrs(props) {
|
|
8
8
|
const { config, getAttrs, getColor, setColor, isSystemKey } = useUI(
|
|
9
9
|
defaultConfig,
|
|
10
10
|
() => props.config,
|
|
11
11
|
);
|
|
12
|
+
|
|
12
13
|
const attrs = {};
|
|
13
14
|
|
|
14
15
|
for (const key in defaultConfig) {
|
|
15
16
|
if (isSystemKey(key)) continue;
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const isVariants = value.variants || value.compoundVariants;
|
|
21
|
-
const excludeKeys = ["progress", "indicator", "step"];
|
|
18
|
+
const classes = computed(() => {
|
|
19
|
+
const value = config.value[key];
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
if (value.variants || value.compoundVariants) {
|
|
22
|
+
return setColor(
|
|
23
|
+
cva(value)({
|
|
24
|
+
...props,
|
|
25
|
+
color: getColor(props.color),
|
|
26
|
+
}),
|
|
27
|
+
props.color,
|
|
28
|
+
);
|
|
29
|
+
}
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
}
|
|
31
|
+
return "";
|
|
32
|
+
});
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
const getCVA = cva(value);
|
|
31
|
-
|
|
32
|
-
classes = computed(() =>
|
|
33
|
-
setColor(getCVA({ ...props, color: getColor(props.color) }), props.color),
|
|
34
|
-
);
|
|
35
|
-
}
|
|
34
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
36
35
|
|
|
37
36
|
if (key === "step") {
|
|
38
|
-
const
|
|
37
|
+
const stepAttrs = attrs[`${key}Attrs`];
|
|
39
38
|
|
|
40
39
|
attrs[`${key}Attrs`] = computed(() => (classes) => ({
|
|
41
|
-
...
|
|
42
|
-
class: cx([
|
|
40
|
+
...stepAttrs,
|
|
41
|
+
class: cx([stepAttrs.value.class, classes]),
|
|
43
42
|
}));
|
|
44
|
-
} else {
|
|
45
|
-
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
45
|
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
<div v-bind="wrapperAttrs">
|
|
3
3
|
<template v-if="isVariant.progress">
|
|
4
4
|
<div v-if="indicator" v-bind="indicatorAttrs" :style="{ width: progressPercent }">
|
|
5
|
+
<!--
|
|
6
|
+
@slot Use it to add something instead of the progress indicator.
|
|
7
|
+
@binding {number} percent
|
|
8
|
+
@binding {number} value
|
|
9
|
+
@binding {number} max
|
|
10
|
+
-->
|
|
5
11
|
<slot name="indicator" :percent="progressPercent" :value="value" :max="realMax">
|
|
6
12
|
{{ progressPercent }}
|
|
7
13
|
</slot>
|
|
@@ -12,6 +18,13 @@
|
|
|
12
18
|
|
|
13
19
|
<div v-if="isSteps" v-bind="stepAttrs(!value && config.firstStep)">
|
|
14
20
|
<template v-for="(step, index) in max" :key="index">
|
|
21
|
+
<!--
|
|
22
|
+
@slot Use it to add something instead of the progress step label.
|
|
23
|
+
@binding {string} name
|
|
24
|
+
@binding {number} step
|
|
25
|
+
@binding {number} value
|
|
26
|
+
@binding {number} max
|
|
27
|
+
-->
|
|
15
28
|
<slot
|
|
16
29
|
v-if="isActiveStep(index)"
|
|
17
30
|
:name="`step-${index}`"
|
|
@@ -40,7 +53,7 @@
|
|
|
40
53
|
import { computed } from "vue";
|
|
41
54
|
|
|
42
55
|
import UIService from "../service.ui";
|
|
43
|
-
import
|
|
56
|
+
import useAttrs from "./composables/attrs.composable";
|
|
44
57
|
|
|
45
58
|
import defaultConfig from "./configs/default.config";
|
|
46
59
|
import { UProgress, VARIANT } from "./constants";
|
|
@@ -4,27 +4,32 @@ import { cva } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props, { selected, size }) {
|
|
8
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
export default function useAttrs(props, { selected, size }) {
|
|
8
|
+
const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
|
|
9
|
+
const attrs = {};
|
|
10
|
+
|
|
11
|
+
for (const key in defaultConfig) {
|
|
12
|
+
if (isSystemKey(key)) continue;
|
|
13
|
+
|
|
14
|
+
const classes = computed(() => {
|
|
15
|
+
const value = config.value[key];
|
|
16
|
+
|
|
17
|
+
if (value.variants || value.compoundVariants) {
|
|
18
|
+
return cva(value)({
|
|
19
|
+
...props,
|
|
20
|
+
size: size.value,
|
|
21
|
+
selected: selected.value,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return "";
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
29
|
+
}
|
|
26
30
|
|
|
27
31
|
return {
|
|
28
|
-
|
|
32
|
+
...attrs,
|
|
33
|
+
config,
|
|
29
34
|
};
|
|
30
35
|
}
|
|
@@ -14,7 +14,7 @@ import UIService from "../service.ui";
|
|
|
14
14
|
|
|
15
15
|
import { UTab } from "./constants";
|
|
16
16
|
import defaultConfig from "./configs/default.config";
|
|
17
|
-
import
|
|
17
|
+
import useAttrs from "./composables/attrs.composable";
|
|
18
18
|
|
|
19
19
|
/* Should be a string for correct web-types gen */
|
|
20
20
|
defineOptions({ name: "UTab", inheritAttrs: false });
|
|
@@ -4,24 +4,30 @@ import { cva } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
9
|
-
const
|
|
7
|
+
export default function useAttrs(props) {
|
|
8
|
+
const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
|
|
9
|
+
const attrs = {};
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
variants: wrapper.variants,
|
|
14
|
-
compoundVariants: wrapper.compoundVariants,
|
|
15
|
-
});
|
|
11
|
+
for (const key in defaultConfig) {
|
|
12
|
+
if (isSystemKey(key)) continue;
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
const classes = computed(() => {
|
|
15
|
+
const value = config.value[key];
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
if (value.variants || value.compoundVariants) {
|
|
18
|
+
return cva(value)({
|
|
19
|
+
...props,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
return "";
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
27
|
+
}
|
|
22
28
|
|
|
23
29
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
...attrs,
|
|
31
|
+
config,
|
|
26
32
|
};
|
|
27
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :data-cy="dataCy" v-bind="wrapperAttrs">
|
|
3
|
+
<!-- @slot Use it to add the UTab component. -->
|
|
3
4
|
<slot>
|
|
4
5
|
<UTab
|
|
5
6
|
v-for="(item, index) in options"
|
|
@@ -23,7 +24,7 @@ import UIService from "../service.ui";
|
|
|
23
24
|
|
|
24
25
|
import { UTabs } from "./constants";
|
|
25
26
|
import defaultConfig from "./configs/default.config";
|
|
26
|
-
import
|
|
27
|
+
import useAttrs from "./composables/attrs.composable";
|
|
27
28
|
|
|
28
29
|
/* Should be a string for correct web-types gen */
|
|
29
30
|
defineOptions({ name: "UTabs", inheritAttrs: false });
|
|
@@ -85,7 +86,13 @@ const props = defineProps({
|
|
|
85
86
|
},
|
|
86
87
|
});
|
|
87
88
|
|
|
88
|
-
const emit = defineEmits([
|
|
89
|
+
const emit = defineEmits([
|
|
90
|
+
/**
|
|
91
|
+
* Triggers when the selected tab changes.
|
|
92
|
+
* @property {string} modelValue
|
|
93
|
+
*/
|
|
94
|
+
"update:modelValue",
|
|
95
|
+
]);
|
|
89
96
|
|
|
90
97
|
const selectedItem = computed({
|
|
91
98
|
get: () => props.modelValue,
|