vueless 0.0.207 → 0.0.209
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/composable.ui/index.js +1 -0
- package/package.json +1 -1
- package/service.storybook/index.js +9 -0
- package/ui.button/index.stories.js +6 -18
- package/ui.button/index.vue +6 -1
- package/ui.container-accordion/composables/attrs.composable.js +10 -11
- package/ui.container-accordion/index.vue +8 -2
- package/ui.container-card/composable/attrs.composable.js +36 -43
- package/ui.container-card/configs/default.config.js +2 -2
- package/ui.container-card/index.vue +1 -1
- package/ui.container-divider/composables/attrs.composable.js +22 -49
- package/ui.container-divider/index.vue +1 -1
- package/ui.container-group/composables/attrs.composable.js +23 -39
- package/ui.container-group/configs/default.config.js +3 -3
- package/ui.container-group/index.vue +4 -4
- package/ui.container-groups/composables/attrs.composable.js +20 -16
- package/ui.container-groups/index.vue +1 -1
- package/ui.container-modal/composables/attrs.composable.js +43 -66
- package/ui.container-modal/configs/default.config.js +6 -6
- package/ui.container-modal/index.vue +13 -2
- package/ui.container-modal-confirm/composable/attrs.composable.js +21 -40
- package/ui.container-modal-confirm/configs/default.config.js +3 -3
- package/ui.container-modal-confirm/index.vue +18 -2
- package/ui.container-page/composables/attrs.composable.js +48 -83
- package/ui.container-page/configs/default.config.js +3 -3
- package/ui.container-page/index.vue +1 -1
- package/ui.container-row/composables/attrs.composable.js +20 -17
- package/ui.container-row/index.vue +1 -1
- package/ui.form-date-picker-range/configs/default.config.js +2 -6
- package/ui.form-date-picker-range/index.vue +29 -12
- package/ui.form-input/index.stories.js +2 -5
- package/ui.form-radio-group/index.stories.js +19 -28
- package/ui.form-radio-group/index.vue +2 -2
- package/ui.form-select/composables/attrs.composable.js +16 -16
- package/ui.form-select/configs/default.config.js +39 -39
- package/ui.form-select/index.vue +19 -19
- package/ui.image-avatar/composables/attrs.composable.js +28 -24
- package/ui.image-avatar/configs/default.config.js +1 -1
- package/ui.image-avatar/index.vue +7 -2
- package/ui.image-icon/composables/attrs.composable.js +24 -49
- package/ui.image-icon/index.vue +17 -2
- package/ui.loader/index.stories.js +32 -2
- package/ui.navigation-progress/index.stories.js +48 -106
- package/ui.navigation-progress/index.vue +9 -1
- package/web-types.json +61 -18
|
@@ -6,82 +6,59 @@ import { computed } from "vue";
|
|
|
6
6
|
|
|
7
7
|
import useBreakpoint from "../../composable.breakpoint";
|
|
8
8
|
|
|
9
|
-
export function useAttrs(props) {
|
|
10
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
11
|
-
|
|
9
|
+
export default function useAttrs(props) {
|
|
10
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
11
|
+
defaultConfig,
|
|
12
|
+
() => props.config,
|
|
13
|
+
);
|
|
12
14
|
const { isMobileBreakpoint } = useBreakpoint();
|
|
15
|
+
const attrs = {};
|
|
13
16
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
variants: modal.variants,
|
|
17
|
-
compoundVariants: modal.compoundVariants,
|
|
18
|
-
});
|
|
17
|
+
for (const key in defaultConfig) {
|
|
18
|
+
if (isSystemKey(key)) continue;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const classes = computed(() => {
|
|
21
|
+
const value = config.value[key];
|
|
22
|
+
|
|
23
|
+
if (value.variants || value.compoundVariants) {
|
|
24
|
+
return cva(value)({
|
|
25
|
+
...props,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return "";
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const innerWrapperAttrs = getAttrs("innerWrapper");
|
|
30
|
-
const headerAttrsRaw = getAttrs("header");
|
|
31
|
-
const headerLeftAttrs = getAttrs("headerLeft");
|
|
32
|
-
const headerLeftFallbackAttrs = getAttrs("headerLeftFallback");
|
|
33
|
-
const backLinkAttrs = getAttrs("backLink", { isComponent: true });
|
|
34
|
-
const backLinkIconAttrs = getAttrs("backLinkIcon", { isComponent: true });
|
|
35
|
-
const titleAttrs = getAttrs("title", { isComponent: true });
|
|
36
|
-
const descriptionAttrs = getAttrs("description");
|
|
37
|
-
const headerRightAttrs = getAttrs("headerRight");
|
|
38
|
-
const closeIconAttrs = getAttrs("closeIcon", { isComponent: true });
|
|
39
|
-
const bodyAttrs = getAttrs("body");
|
|
40
|
-
const dividerAttrs = getAttrs("divider", { isComponent: true });
|
|
41
|
-
const dividerSpacingAttrs = getAttrs("dividerSpacing", { isComponent: true });
|
|
42
|
-
const footerAttrsRaw = getAttrs("footer");
|
|
34
|
+
if (key === "header") {
|
|
35
|
+
const headerAttrs = attrs[`${key}Attrs`];
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
38
|
+
...headerAttrs.value,
|
|
39
|
+
class: cx([
|
|
40
|
+
headerAttrs.value.class,
|
|
41
|
+
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
|
|
42
|
+
]),
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class: cx([
|
|
55
|
-
footerAttrsRaw.value.class,
|
|
56
|
-
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
|
|
57
|
-
]),
|
|
58
|
-
}));
|
|
46
|
+
if (key === "footer") {
|
|
47
|
+
const footerAttrs = attrs[`${key}Attrs`];
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
50
|
+
...footerAttrs.value,
|
|
51
|
+
class: cx([
|
|
52
|
+
footerAttrs.value.class,
|
|
53
|
+
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
|
|
54
|
+
]),
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
63
58
|
|
|
64
59
|
return {
|
|
60
|
+
...attrs,
|
|
65
61
|
config,
|
|
66
|
-
modalAttrs,
|
|
67
|
-
titleAttrs,
|
|
68
|
-
backLinkAttrs,
|
|
69
|
-
backLinkIconAttrs,
|
|
70
|
-
closeIconAttrs,
|
|
71
|
-
dividerAttrs,
|
|
72
|
-
dividerSpacingAttrs,
|
|
73
|
-
overlayAttrs,
|
|
74
|
-
wrapperAttrs,
|
|
75
|
-
innerWrapperAttrs,
|
|
76
|
-
headerAttrs,
|
|
77
|
-
headerLeftAttrs,
|
|
78
|
-
headerLeftFallbackAttrs,
|
|
79
|
-
descriptionAttrs,
|
|
80
|
-
headerRightAttrs,
|
|
81
|
-
bodyAttrs,
|
|
82
|
-
footerLeftAttrs,
|
|
83
|
-
footerAttrs,
|
|
84
|
-
footerRightAttrs,
|
|
85
62
|
hasSlotContent,
|
|
86
63
|
};
|
|
87
64
|
}
|
|
@@ -21,17 +21,17 @@ export default /*tw*/ {
|
|
|
21
21
|
header: "flex items-center justify-between px-4 md:px-8 pb-6 pt-8",
|
|
22
22
|
headerLeft: "flex items-center space-x-4",
|
|
23
23
|
headerLeftFallback: "flex flex-col",
|
|
24
|
-
backLink: "flex items-center gap-0.5",
|
|
25
|
-
backLinkIcon: "",
|
|
24
|
+
backLink: "{ULink} flex items-center gap-0.5",
|
|
25
|
+
backLinkIcon: "{UIcon}",
|
|
26
26
|
backLinkIconName: "arrow_back",
|
|
27
|
-
title: "",
|
|
27
|
+
title: "{UHeader}",
|
|
28
28
|
description: "mt-1.5 text-base font-normal text-gray-500",
|
|
29
29
|
headerRight: "",
|
|
30
|
-
closeIcon: "",
|
|
30
|
+
closeIcon: "{UIcon}",
|
|
31
31
|
closeIconName: "close",
|
|
32
32
|
body: "space-y-4 px-4 md:px-8",
|
|
33
|
-
divider: "",
|
|
34
|
-
dividerSpacing: "",
|
|
33
|
+
divider: "{UDivider}",
|
|
34
|
+
dividerSpacing: "{UDivider}",
|
|
35
35
|
footer: "flex justify-between px-4 md:px-8 py-8 max-md:flex-col max-md:gap-4",
|
|
36
36
|
footerLeft: "flex flex-col md:flex-row space-y-4 md:space-x-4 md:space-y-0 w-full",
|
|
37
37
|
footerRight: "flex flex-col md:flex-row space-y-4 md:space-x-4 md:space-y-0 w-full justify-end",
|
|
@@ -112,7 +112,7 @@ import UDivider from "../ui.container-divider";
|
|
|
112
112
|
|
|
113
113
|
import defaultConfig from "./configs/default.config";
|
|
114
114
|
import { UModal } from "./constants/index";
|
|
115
|
-
import
|
|
115
|
+
import useAttrs from "./composables/attrs.composable";
|
|
116
116
|
|
|
117
117
|
/* Should be a string for correct web-types gen */
|
|
118
118
|
defineOptions({ name: "UModal", inheritAttrs: false });
|
|
@@ -253,7 +253,18 @@ const props = defineProps({
|
|
|
253
253
|
},
|
|
254
254
|
});
|
|
255
255
|
|
|
256
|
-
const emit = defineEmits([
|
|
256
|
+
const emit = defineEmits([
|
|
257
|
+
/**
|
|
258
|
+
* Triggers when the modal is toggled.
|
|
259
|
+
* @property {Boolean} value
|
|
260
|
+
*/
|
|
261
|
+
"update:modelValue",
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Triggers when back link in modal is clicked.
|
|
265
|
+
*/
|
|
266
|
+
"back",
|
|
267
|
+
]);
|
|
257
268
|
|
|
258
269
|
const {
|
|
259
270
|
config,
|
|
@@ -3,57 +3,38 @@ import defaultConfig from "../configs/default.config";
|
|
|
3
3
|
import { cva } from "../../service.ui/index.js";
|
|
4
4
|
import { computed } from "vue";
|
|
5
5
|
|
|
6
|
-
export function useAttrs(props) {
|
|
7
|
-
const { config, getAttrs, hasSlotContent, getColor, setColor } = useUI(
|
|
6
|
+
export default function useAttrs(props) {
|
|
7
|
+
const { config, getAttrs, hasSlotContent, getColor, setColor, isSystemKey } = useUI(
|
|
8
8
|
defaultConfig,
|
|
9
9
|
() => props.config,
|
|
10
10
|
);
|
|
11
|
-
const
|
|
11
|
+
const attrs = {};
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
variants: modal.variants,
|
|
16
|
-
compoundVariants: modal.compoundVariants,
|
|
17
|
-
});
|
|
13
|
+
for (const key in defaultConfig) {
|
|
14
|
+
if (isSystemKey(key)) continue;
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
variants: footerLeftFallback.variants,
|
|
22
|
-
compoundVariants: footerLeftFallback.compoundVariants,
|
|
23
|
-
});
|
|
16
|
+
const classes = computed(() => {
|
|
17
|
+
const value = config.value[key];
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const footerLeftFallbackClasses = computed(() =>
|
|
35
|
-
setColor(cvaFooterLeftFallback({ color: getColor(props.color) }), props.color),
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const footerLeftFallbackAttrs = getAttrs("footerLeftFallback", {
|
|
39
|
-
classes: footerLeftFallbackClasses,
|
|
40
|
-
});
|
|
19
|
+
if (value.variants || value.compoundVariants) {
|
|
20
|
+
return setColor(
|
|
21
|
+
cva(value)({
|
|
22
|
+
...props,
|
|
23
|
+
color: getColor(props.color),
|
|
24
|
+
}),
|
|
25
|
+
props.color,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
41
28
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const modalAttrsRaw = getAttrs("modal", { isComponent: true, classes: modalClasses });
|
|
29
|
+
return "";
|
|
30
|
+
});
|
|
45
31
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class: setColor(modalAttrsRaw.value.class, props.color),
|
|
49
|
-
}));
|
|
32
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
33
|
+
}
|
|
50
34
|
|
|
51
35
|
return {
|
|
36
|
+
...attrs,
|
|
52
37
|
config,
|
|
53
|
-
footerLeftFallbackAttrs,
|
|
54
|
-
modalAttrs,
|
|
55
|
-
confirmButtonAttrs,
|
|
56
|
-
cancelButtonAttrs,
|
|
57
38
|
hasSlotContent,
|
|
58
39
|
};
|
|
59
40
|
}
|
|
@@ -70,7 +70,7 @@ import UModal from "../ui.container-modal";
|
|
|
70
70
|
|
|
71
71
|
import defaultConfig from "./configs/default.config";
|
|
72
72
|
import { UModalConfirm } from "./constants/index";
|
|
73
|
-
import
|
|
73
|
+
import useAttrs from "./composable/attrs.composable";
|
|
74
74
|
import { useLocale } from "../composable.locale";
|
|
75
75
|
|
|
76
76
|
/* Should be a string for correct web-types gen */
|
|
@@ -152,7 +152,23 @@ const props = defineProps({
|
|
|
152
152
|
},
|
|
153
153
|
});
|
|
154
154
|
|
|
155
|
-
const emit = defineEmits([
|
|
155
|
+
const emit = defineEmits([
|
|
156
|
+
/**
|
|
157
|
+
* Triggers when the modal is toggled.
|
|
158
|
+
* @property {Boolean} value
|
|
159
|
+
*/
|
|
160
|
+
"update:modelValue",
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Triggers when the action is confirmed.
|
|
164
|
+
*/
|
|
165
|
+
"confirm",
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Triggers when the action is declined or modal is closed.
|
|
169
|
+
*/
|
|
170
|
+
"close",
|
|
171
|
+
]);
|
|
156
172
|
|
|
157
173
|
const { tm } = useLocale();
|
|
158
174
|
|
|
@@ -4,93 +4,58 @@ import { cva, cx, isMobileApp } from "../../service.ui";
|
|
|
4
4
|
import defaultConfig from "../configs/default.config";
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
|
-
export function useAttrs(props, { isMobileBreakpoint }) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const cvaWrapper = cva({
|
|
12
|
-
base: wrapper.base,
|
|
13
|
-
variants: wrapper.variants,
|
|
14
|
-
compoundVariants: wrapper.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const cvaPage = cva({
|
|
18
|
-
base: page.base,
|
|
19
|
-
variants: page.variants,
|
|
20
|
-
compoundVariants: page.compoundVariants,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const cvaRightRounding = cva({
|
|
24
|
-
base: rightRounding.base,
|
|
25
|
-
variants: rightRounding.variants,
|
|
26
|
-
compoundVariants: rightRounding.compoundVariants,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const wrapperClasses = computed(() =>
|
|
30
|
-
cvaWrapper({
|
|
31
|
-
width: props.width,
|
|
32
|
-
fixedRounding: props.fixedRounding,
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const pageClasses = computed(() =>
|
|
37
|
-
cvaPage({
|
|
38
|
-
fixedRounding: props.fixedRounding,
|
|
39
|
-
gray: props.gray,
|
|
40
|
-
}),
|
|
7
|
+
export default function useAttrs(props, { isMobileBreakpoint }) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
41
11
|
);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
12
|
+
const attrs = {};
|
|
13
|
+
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
16
|
+
|
|
17
|
+
const classes = computed(() => {
|
|
18
|
+
const value = config.value[key];
|
|
19
|
+
|
|
20
|
+
if (value.variants || value.compoundVariants) {
|
|
21
|
+
return cva(value)({
|
|
22
|
+
...props,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return "";
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
30
|
+
|
|
31
|
+
if (key === "wrapper") {
|
|
32
|
+
const wrapperAttrs = attrs[`${key}Attrs`];
|
|
33
|
+
|
|
34
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
35
|
+
...wrapperAttrs.value,
|
|
36
|
+
class: cx([
|
|
37
|
+
wrapperAttrs.value.class,
|
|
38
|
+
isMobileBreakpoint.value && !isMobileApp && config.value.wrapperMobile,
|
|
39
|
+
]),
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (key === "footer") {
|
|
44
|
+
const footerAttrs = attrs[`${key}Attrs`];
|
|
45
|
+
|
|
46
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
47
|
+
...footerAttrs.value,
|
|
48
|
+
class: cx([
|
|
49
|
+
footerAttrs.value.class,
|
|
50
|
+
props.mobileFooterReverse && isMobileBreakpoint.value && config.value.footerMobileReverse,
|
|
51
|
+
]),
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
76
55
|
|
|
77
56
|
return {
|
|
57
|
+
...attrs,
|
|
78
58
|
config,
|
|
79
|
-
wrapperAttrs,
|
|
80
|
-
pageAttrs,
|
|
81
|
-
rightRoundingWrapperAttrs,
|
|
82
|
-
rightRoundingAttrs,
|
|
83
|
-
headerAttrs,
|
|
84
|
-
headerRightAttrs,
|
|
85
|
-
headerLeftAttrs,
|
|
86
|
-
headerLeftFallbackAttrs,
|
|
87
|
-
titleAttrs,
|
|
88
|
-
backLinkAttrs,
|
|
89
|
-
backLinkIconAttrs,
|
|
90
|
-
descriptionAttrs,
|
|
91
|
-
footerAttrs,
|
|
92
|
-
footerLeftAttrs,
|
|
93
|
-
footerRightAttrs,
|
|
94
59
|
hasSlotContent,
|
|
95
60
|
};
|
|
96
61
|
}
|
|
@@ -38,10 +38,10 @@ export default /*tw*/ {
|
|
|
38
38
|
header: "flex items-start justify-between mb-4 md:mb-6",
|
|
39
39
|
headerLeft: "flex items-center space-x-4",
|
|
40
40
|
headerLeftFallback: "flex flex-col",
|
|
41
|
-
backLink: "flex items-center gap-0.5",
|
|
42
|
-
backLinkIcon: "",
|
|
41
|
+
backLink: "{ULink} flex items-center gap-0.5",
|
|
42
|
+
backLinkIcon: "{UIcon}",
|
|
43
43
|
backLinkIconName: "arrow_back",
|
|
44
|
-
title: "",
|
|
44
|
+
title: "{UHeader}",
|
|
45
45
|
description: "mt-1.5 text-base font-normal text-gray-600",
|
|
46
46
|
headerRight: "",
|
|
47
47
|
footer: `mb-0 mt-14 justify-between pt-8 md:flex md:items-baseline space-y-4 md:space-y-0 border-t border-gray-200`,
|
|
@@ -90,7 +90,7 @@ import UIService from "../service.ui";
|
|
|
90
90
|
|
|
91
91
|
import defaultConfig from "./configs/default.config";
|
|
92
92
|
import { UPage } from "./constants";
|
|
93
|
-
import
|
|
93
|
+
import useAttrs from "./composables/attrs.composable";
|
|
94
94
|
|
|
95
95
|
const slots = useSlots();
|
|
96
96
|
|
|
@@ -3,27 +3,30 @@ import defaultConfig from "../configs/default.config";
|
|
|
3
3
|
import { cva } from "../../service.ui";
|
|
4
4
|
import { computed } from "vue";
|
|
5
5
|
|
|
6
|
-
export function useAttrs(props) {
|
|
7
|
-
const { config, getAttrs } = useUI(defaultConfig, () => props.config);
|
|
8
|
-
const
|
|
6
|
+
export default function useAttrs(props) {
|
|
7
|
+
const { config, getAttrs, isSystemKey } = useUI(defaultConfig, () => props.config);
|
|
8
|
+
const attrs = {};
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
variants: wrapper.variants,
|
|
13
|
-
compoundVariants: wrapper.compoundVariants,
|
|
14
|
-
});
|
|
10
|
+
for (const key in defaultConfig) {
|
|
11
|
+
if (isSystemKey(key)) continue;
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
gap: props.gap,
|
|
19
|
-
align: props.align,
|
|
20
|
-
noMobile: props.noMobile,
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
13
|
+
const classes = computed(() => {
|
|
14
|
+
const value = config.value[key];
|
|
23
15
|
|
|
24
|
-
|
|
16
|
+
if (value.variants || value.compoundVariants) {
|
|
17
|
+
return cva(value)({
|
|
18
|
+
...props,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return "";
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
26
|
+
}
|
|
25
27
|
|
|
26
28
|
return {
|
|
27
|
-
|
|
29
|
+
...attrs,
|
|
30
|
+
config,
|
|
28
31
|
};
|
|
29
32
|
}
|
|
@@ -10,7 +10,7 @@ import UIService from "../service.ui";
|
|
|
10
10
|
|
|
11
11
|
import { URow } from "./constants";
|
|
12
12
|
import defaultConfig from "./configs/default.config";
|
|
13
|
-
import
|
|
13
|
+
import useAttrs from "./composables/attrs.composable";
|
|
14
14
|
|
|
15
15
|
/* Should be a string for correct web-types gen */
|
|
16
16
|
defineOptions({ name: "URow", inheritAttrs: false });
|
|
@@ -34,8 +34,7 @@ export default /*tw*/ {
|
|
|
34
34
|
},
|
|
35
35
|
periodsRow: "mb-1 flex min-w-64 gap-1",
|
|
36
36
|
periodButton: `
|
|
37
|
-
|
|
38
|
-
px-1.5 py-2.5 text-center text-xs font-medium text-brand-900 hover:bg-brand-200
|
|
37
|
+
h-[3.125rem] w-full flex flex-col items-center justify-center
|
|
39
38
|
[&_span]:block [&_span]:font-normal [&_span]:text-brand-500
|
|
40
39
|
`,
|
|
41
40
|
periodButtonIcon: "",
|
|
@@ -52,10 +51,7 @@ export default /*tw*/ {
|
|
|
52
51
|
periodDateWeekList: "",
|
|
53
52
|
periodDateYearList: "grid grid-cols-3 grid-rows-1 gap-0.5",
|
|
54
53
|
periodDateQuarterList: "",
|
|
55
|
-
periodDate:
|
|
56
|
-
cursor-pointer block w-full rounded-lg py-3 text-center text-sm font-medium text-gray-900 hover:rounded-lg hover:bg-brand-50
|
|
57
|
-
disabled:opacity-50 disabled:cursor-not-allowed
|
|
58
|
-
`,
|
|
54
|
+
periodDate: "w-full",
|
|
59
55
|
periodDateActive: "bg-gray-100",
|
|
60
56
|
rangeInputWrapper: "flex mt-4",
|
|
61
57
|
rangeInput: {
|
|
@@ -79,27 +79,35 @@
|
|
|
79
79
|
@keydown.esc="deactivate"
|
|
80
80
|
>
|
|
81
81
|
<div v-bind="periodsRowAttrs">
|
|
82
|
-
<
|
|
82
|
+
<UButton
|
|
83
83
|
v-for="periodButton in periods"
|
|
84
84
|
:key="periodButton.name"
|
|
85
|
+
variant="thirdary"
|
|
86
|
+
size="xs"
|
|
87
|
+
square
|
|
88
|
+
color="brand"
|
|
85
89
|
v-bind="periodButtonAttrs(getPeriodButtonsClasses(periodButton.name))"
|
|
86
90
|
@click="onClickPeriodButton(periodButton.name)"
|
|
87
91
|
>
|
|
88
92
|
{{ periodButton.title }}
|
|
89
|
-
</
|
|
93
|
+
</UButton>
|
|
90
94
|
</div>
|
|
91
95
|
|
|
92
96
|
<div v-bind="periodsRowAttrs">
|
|
93
|
-
<
|
|
97
|
+
<UButton
|
|
94
98
|
v-if="customRangeButton.range.to && customRangeButton.range.from"
|
|
99
|
+
variant="thirdary"
|
|
100
|
+
color="brand"
|
|
95
101
|
v-bind="periodButtonAttrs(getPeriodButtonsClasses(PERIOD.custom))"
|
|
96
102
|
@click="onClickCustomRangeButton"
|
|
97
103
|
>
|
|
98
104
|
{{ customRangeButton.label }}
|
|
99
105
|
<span v-if="customRangeButton.description" v-text="customRangeButton.description" />
|
|
100
|
-
</
|
|
106
|
+
</UButton>
|
|
101
107
|
|
|
102
|
-
<
|
|
108
|
+
<UButton
|
|
109
|
+
variant="thirdary"
|
|
110
|
+
color="brand"
|
|
103
111
|
v-bind="periodButtonAttrs(getPeriodButtonsClasses(PERIOD.ownRange))"
|
|
104
112
|
@click="onClickOwnRange"
|
|
105
113
|
>
|
|
@@ -110,7 +118,7 @@
|
|
|
110
118
|
v-bind="periodButtonIconAttrs"
|
|
111
119
|
/>
|
|
112
120
|
{{ locale.ownRange }}
|
|
113
|
-
</
|
|
121
|
+
</UButton>
|
|
114
122
|
</div>
|
|
115
123
|
|
|
116
124
|
<template v-if="!isPeriod.ownRange && !isPeriod.custom">
|
|
@@ -141,13 +149,16 @@
|
|
|
141
149
|
</div>
|
|
142
150
|
|
|
143
151
|
<div v-bind="periodDateListAttrs(getPeriodDateListClasses())">
|
|
144
|
-
<
|
|
152
|
+
<UButton
|
|
145
153
|
v-for="date in periodDateList"
|
|
146
154
|
:key="date.title"
|
|
147
155
|
:disabled="isDatePeriodOutOfRange(date)"
|
|
156
|
+
variant="thirdary"
|
|
157
|
+
color="brand"
|
|
158
|
+
size="sm"
|
|
148
159
|
v-bind="periodDateAttrs(getPeriodDateClasses(date))"
|
|
160
|
+
:label="String(date.title)"
|
|
149
161
|
@click="selectDate(date), toggleMenu()"
|
|
150
|
-
v-text="date.title"
|
|
151
162
|
/>
|
|
152
163
|
</div>
|
|
153
164
|
</template>
|
|
@@ -522,9 +533,7 @@ const localValue = computed({
|
|
|
522
533
|
emit("update:modelValue", newValue);
|
|
523
534
|
}
|
|
524
535
|
|
|
525
|
-
activeDate.value = props.dateFormat
|
|
526
|
-
? formatDate(parsedDateFrom || new Date(), props.dateFormat, locale.value)
|
|
527
|
-
: value.from || new Date();
|
|
536
|
+
activeDate.value = props.dateFormat ? parsedDateFrom || new Date() : value.from || new Date();
|
|
528
537
|
},
|
|
529
538
|
});
|
|
530
539
|
|
|
@@ -739,7 +748,15 @@ watch(
|
|
|
739
748
|
);
|
|
740
749
|
|
|
741
750
|
watch(period, () => {
|
|
742
|
-
|
|
751
|
+
const isDate = localValue.value.from !== null;
|
|
752
|
+
|
|
753
|
+
if (isDate && !props.dateFormat) {
|
|
754
|
+
activeDate.value = isDate ? localValue.value.from : new Date();
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
if (isDate && props.dateFormat) {
|
|
758
|
+
activeDate.value = isDate ? parseDate(localValue.value.from, locale.value) : new Date();
|
|
759
|
+
}
|
|
743
760
|
});
|
|
744
761
|
|
|
745
762
|
function onClickPeriodButton(periodName) {
|
|
@@ -30,9 +30,7 @@ const DefaultTemplate = (args) => ({
|
|
|
30
30
|
return { args, slots };
|
|
31
31
|
},
|
|
32
32
|
template: `
|
|
33
|
-
<UInput
|
|
34
|
-
v-bind="args"
|
|
35
|
-
>
|
|
33
|
+
<UInput v-bind="args" v-model="args.modelValue">
|
|
36
34
|
${allSlotsFragment}
|
|
37
35
|
</UInput>
|
|
38
36
|
`,
|
|
@@ -44,8 +42,7 @@ const SlotTemplate = (args) => ({
|
|
|
44
42
|
return { args };
|
|
45
43
|
},
|
|
46
44
|
template: `
|
|
47
|
-
<UInput v-bind="args"
|
|
48
|
-
>
|
|
45
|
+
<UInput v-bind="args">
|
|
49
46
|
${args.slotTemplate}
|
|
50
47
|
</UInput>
|
|
51
48
|
`,
|