vueless 0.0.201 → 0.0.203
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 +3 -2
- package/package.json +2 -2
- package/ui.button-link/composables/attrs.composable.js +64 -130
- package/ui.button-link/index.stories.js +2 -4
- package/ui.button-link/index.vue +29 -4
- package/ui.button-toggle/composables/attrs.composable.js +21 -33
- package/ui.button-toggle/configs/default.config.js +2 -2
- package/ui.button-toggle/index.vue +8 -2
- package/ui.button-toggle-item/composables/attrs.composable.js +50 -40
- package/ui.button-toggle-item/configs/default.config.js +1 -1
- package/ui.button-toggle-item/index.stories.js +2 -4
- package/ui.button-toggle-item/index.vue +11 -3
- package/ui.dropdown-badge/composables/attrs.composable.js +45 -45
- package/ui.dropdown-badge/configs/default.config.js +3 -3
- package/ui.dropdown-badge/index.stories.js +2 -4
- package/ui.dropdown-badge/index.vue +8 -2
- package/ui.dropdown-button/composables/attrs.composable.js +45 -45
- package/ui.dropdown-button/configs/default.config.js +3 -3
- package/ui.dropdown-button/index.stories.js +2 -4
- package/ui.dropdown-button/index.vue +8 -2
- package/ui.dropdown-item/index.vue +7 -1
- package/ui.dropdown-link/composables/attrs.composable.js +43 -45
- package/ui.dropdown-link/configs/default.config.js +3 -3
- package/ui.dropdown-link/index.stories.js +2 -4
- package/ui.dropdown-link/index.vue +8 -2
- package/ui.dropdown-list/composables/attrs.composable.js +43 -67
- package/ui.dropdown-list/configs/default.config.js +2 -2
- package/ui.dropdown-list/index.vue +19 -3
- package/ui.form-calendar/components/DayView.vue +4 -4
- package/ui.form-calendar/composables/attrs.composable.js +5 -4
- package/ui.navigation-progress/components/StepperProgress.vue +87 -0
- package/ui.navigation-progress/composables/attrs.composable.js +33 -56
- package/ui.navigation-progress/configs/default.config.js +34 -1
- package/ui.navigation-progress/constants/index.js +5 -0
- package/ui.navigation-progress/index.stories.js +3 -0
- package/ui.navigation-progress/index.vue +55 -9
- package/ui.text-alert/composables/attrs.composable.js +23 -39
- package/ui.text-alert/configs/default.config.js +3 -3
- package/ui.text-alert/index.vue +19 -8
- package/ui.text-badge/composables/attrs.composable.js +25 -36
- package/ui.text-badge/index.stories.js +2 -4
- package/ui.text-badge/index.vue +22 -2
- package/ui.text-block/composables/attrs.composable.js +24 -20
- package/ui.text-block/index.vue +1 -1
- package/ui.text-empty/composables/attrs.composable.js +17 -27
- package/ui.text-empty/configs/default.config.js +1 -1
- package/ui.text-empty/index.stories.js +2 -4
- package/ui.text-empty/index.vue +1 -1
- package/ui.text-file/composables/attrs.composable.js +23 -27
- package/ui.text-file/configs/default.config.js +2 -2
- package/ui.text-file/index.vue +1 -1
- package/ui.text-files/composables/attrs.composable.js +21 -15
- package/ui.text-files/configs/default.config.js +1 -1
- package/ui.text-files/index.vue +7 -3
- package/ui.text-header/composables/attrs.composable.js +28 -22
- package/ui.text-header/index.stories.js +1 -1
- package/ui.text-header/index.vue +1 -1
- package/ui.text-money/composables/attrs.composable.js +21 -48
- package/ui.text-money/index.stories.js +2 -4
- package/ui.text-notify/composables/attrs.composable.js +23 -21
- package/ui.text-notify/index.vue +1 -1
- package/web-types.json +183 -97
- package/ui.navigation-stepper/Docs.mdx +0 -16
- package/ui.navigation-stepper/composables/attrs.composable.js +0 -25
- package/ui.navigation-stepper/configs/default.config.js +0 -13
- package/ui.navigation-stepper/constants/index.js +0 -5
- package/ui.navigation-stepper/index.stories.js +0 -33
- package/ui.navigation-stepper/index.vue +0 -126
|
@@ -4,59 +4,59 @@ 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, { isShownOptions }) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const cvaListWrapper = cva({
|
|
12
|
-
base: listWrapper.base,
|
|
13
|
-
variants: listWrapper.variants,
|
|
14
|
-
compoundVariants: listWrapper.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// Get list wrapper position classes to apply them to list without wrapper
|
|
18
|
-
const cvaListWrapperVariants = cva({
|
|
19
|
-
base: "",
|
|
20
|
-
variants: listWrapper.variants,
|
|
21
|
-
compoundVariants: [],
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const listWrapperPositionClasses = computed(() =>
|
|
25
|
-
cvaListWrapperVariants({
|
|
26
|
-
listYPosition: props.listYPosition,
|
|
27
|
-
listXPosition: props.listXPosition,
|
|
28
|
-
}),
|
|
7
|
+
export default function useAttrs(props, { isShownOptions }) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
29
11
|
);
|
|
12
|
+
const attrs = {};
|
|
30
13
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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 === "icon") {
|
|
32
|
+
const iconAttrs = attrs[`${key}Attrs`];
|
|
33
|
+
const rotateClasses = isShownOptions.value && config.value.iconRotate;
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
36
|
+
...iconAttrs.value,
|
|
37
|
+
class: cx([iconAttrs.value.class, rotateClasses]),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
if (key === "list") {
|
|
42
|
+
const getCVA = cva({
|
|
43
|
+
base: "",
|
|
44
|
+
variants: config.value["listWrapper"].variants,
|
|
45
|
+
compoundVariants: [],
|
|
46
|
+
});
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const classes = computed(() =>
|
|
49
|
+
getCVA({
|
|
50
|
+
...props,
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes: classes });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
return {
|
|
55
|
-
|
|
56
|
-
wrapperAttrs,
|
|
57
|
-
badgeAttrs,
|
|
58
|
-
listAttrs,
|
|
59
|
-
iconAttrs,
|
|
59
|
+
...attrs,
|
|
60
60
|
config,
|
|
61
61
|
hasSlotContent,
|
|
62
62
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative inline-block",
|
|
3
|
-
badge: "cursor-pointer",
|
|
4
|
-
icon: "transition duration-300",
|
|
3
|
+
badge: "{UBadge} cursor-pointer",
|
|
4
|
+
icon: "{UIcon} transition duration-300",
|
|
5
5
|
iconName: "keyboard_arrow_down",
|
|
6
6
|
iconRotate: "rotate-180",
|
|
7
7
|
listWrapper: {
|
|
@@ -21,7 +21,7 @@ export default /*tw*/ {
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
|
-
list: "w-fit",
|
|
24
|
+
list: "{UDropdownList} w-fit",
|
|
25
25
|
defaultVariants: {
|
|
26
26
|
color: "brand",
|
|
27
27
|
size: "md",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UDropdownBadge from "../ui.dropdown-badge";
|
|
4
4
|
import UDropdownItem from "../ui.dropdown-item";
|
|
@@ -42,9 +42,7 @@ const DefaultTemplate = (args) => ({
|
|
|
42
42
|
<UDropdownBadge
|
|
43
43
|
v-bind="args"
|
|
44
44
|
>
|
|
45
|
-
|
|
46
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
47
|
-
</template>
|
|
45
|
+
${allSlotsFragment}
|
|
48
46
|
</UDropdownBadge>
|
|
49
47
|
`,
|
|
50
48
|
});
|
|
@@ -61,7 +61,7 @@ import vClickOutside from "../directive.clickOutside";
|
|
|
61
61
|
|
|
62
62
|
import defaultConfig from "./configs/default.config";
|
|
63
63
|
import { UDropdownBadge } from "./constants";
|
|
64
|
-
import
|
|
64
|
+
import useAttrs from "./composables/attrs.composable";
|
|
65
65
|
|
|
66
66
|
/* Should be a string for correct web-types gen */
|
|
67
67
|
defineOptions({ name: "UDropdownBadge", inheritAttrs: false });
|
|
@@ -187,7 +187,13 @@ const props = defineProps({
|
|
|
187
187
|
},
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
-
const emit = defineEmits([
|
|
190
|
+
const emit = defineEmits([
|
|
191
|
+
/**
|
|
192
|
+
* Triggers when dropdown option is selected.
|
|
193
|
+
* @property {string} value
|
|
194
|
+
*/
|
|
195
|
+
"select",
|
|
196
|
+
]);
|
|
191
197
|
|
|
192
198
|
provide("hideDropdownOptions", hideOptions);
|
|
193
199
|
|
|
@@ -4,60 +4,60 @@ 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, { isShownOptions }) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const cvaListWrapper = cva({
|
|
12
|
-
base: listWrapper.base,
|
|
13
|
-
variants: listWrapper.variants,
|
|
14
|
-
compoundVariants: listWrapper.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const listWrapperClasses = computed(() =>
|
|
18
|
-
cvaListWrapper({
|
|
19
|
-
listYPosition: props.listYPosition,
|
|
20
|
-
listXPosition: props.listXPosition,
|
|
21
|
-
}),
|
|
7
|
+
export default function useAttrs(props, { isShownOptions }) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
22
11
|
);
|
|
12
|
+
const attrs = {};
|
|
23
13
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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 === "icon") {
|
|
32
|
+
const iconAttrs = attrs[`${key}Attrs`];
|
|
33
|
+
const rotateClasses = isShownOptions.value && config.value.iconRotate;
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
36
|
+
...iconAttrs.value,
|
|
37
|
+
class: cx([iconAttrs.value.class, rotateClasses]),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
if (key === "list") {
|
|
42
|
+
const getCVA = cva({
|
|
43
|
+
base: "",
|
|
44
|
+
variants: config.value["listWrapper"].variants,
|
|
45
|
+
compoundVariants: [],
|
|
46
|
+
});
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const classes = computed(() =>
|
|
49
|
+
getCVA({
|
|
50
|
+
...props,
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes: classes });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
return {
|
|
59
|
+
...attrs,
|
|
55
60
|
config,
|
|
56
|
-
listWrapperAttrs,
|
|
57
|
-
buttonAttrs,
|
|
58
|
-
listAttrs,
|
|
59
|
-
iconAttrs,
|
|
60
|
-
wrapperAttrs,
|
|
61
61
|
hasSlotContent,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative inline-block",
|
|
3
|
-
button: "",
|
|
4
|
-
icon: "transition duration-300",
|
|
3
|
+
button: "{UButton}",
|
|
4
|
+
icon: "{UIcon} transition duration-300",
|
|
5
5
|
iconName: "keyboard_arrow_down",
|
|
6
6
|
iconRotate: "rotate-180",
|
|
7
7
|
listWrapper: {
|
|
@@ -21,7 +21,7 @@ export default /*tw*/ {
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
|
-
list: "w-fit",
|
|
24
|
+
list: "{UDropdownList} w-fit",
|
|
25
25
|
defaultVariants: {
|
|
26
26
|
color: "brand",
|
|
27
27
|
size: "md",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UDropdownButton from "../ui.dropdown-button";
|
|
4
4
|
import UDropdownItem from "../ui.dropdown-item";
|
|
@@ -43,9 +43,7 @@ const DefaultTemplate = (args) => ({
|
|
|
43
43
|
<UDropdownButton
|
|
44
44
|
v-bind="args"
|
|
45
45
|
>
|
|
46
|
-
|
|
47
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
48
|
-
</template>
|
|
46
|
+
${allSlotsFragment}
|
|
49
47
|
</UDropdownButton>
|
|
50
48
|
`,
|
|
51
49
|
});
|
|
@@ -64,7 +64,7 @@ import UIService, { getRandomId } from "../service.ui";
|
|
|
64
64
|
import vClickOutside from "../directive.clickOutside";
|
|
65
65
|
|
|
66
66
|
import defaultConfig from "./configs/default.config";
|
|
67
|
-
import
|
|
67
|
+
import useAttrs from "./composables/attrs.composable";
|
|
68
68
|
import { UDropdownButton, BUTTON_VARIANT } from "./constants";
|
|
69
69
|
|
|
70
70
|
/* Should be a string for correct web-types gen */
|
|
@@ -222,7 +222,13 @@ const props = defineProps({
|
|
|
222
222
|
},
|
|
223
223
|
});
|
|
224
224
|
|
|
225
|
-
const emit = defineEmits([
|
|
225
|
+
const emit = defineEmits([
|
|
226
|
+
/**
|
|
227
|
+
* Triggers when dropdown option is selected.
|
|
228
|
+
* @property {string} value
|
|
229
|
+
*/
|
|
230
|
+
"select",
|
|
231
|
+
]);
|
|
226
232
|
|
|
227
233
|
provide("hideDropdownOptions", hideOptions);
|
|
228
234
|
|
|
@@ -40,7 +40,13 @@ const props = defineProps({
|
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const emit = defineEmits([
|
|
43
|
+
const emit = defineEmits([
|
|
44
|
+
/**
|
|
45
|
+
* Triggers when dropdown item is clicked.
|
|
46
|
+
* @property {string} value
|
|
47
|
+
*/
|
|
48
|
+
"click",
|
|
49
|
+
]);
|
|
44
50
|
|
|
45
51
|
function onClick() {
|
|
46
52
|
// invokes click event on current item
|
|
@@ -4,62 +4,60 @@ 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, { isShownOptions }) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
9
|
-
|
|
7
|
+
export default function useAttrs(props, { isShownOptions }) {
|
|
8
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
11
|
+
);
|
|
12
|
+
const attrs = {};
|
|
10
13
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
variants: listWrapper.variants,
|
|
14
|
-
compoundVariants: listWrapper.compoundVariants,
|
|
15
|
-
});
|
|
14
|
+
for (const key in defaultConfig) {
|
|
15
|
+
if (isSystemKey(key)) continue;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
listYPosition: props.listYPosition,
|
|
20
|
-
listXPosition: props.listXPosition,
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
17
|
+
const classes = computed(() => {
|
|
18
|
+
const value = config.value[key];
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
20
|
+
if (value.variants || value.compoundVariants) {
|
|
21
|
+
return cva(value)({
|
|
22
|
+
...props,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
return "";
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
30
|
+
|
|
31
|
+
if (key === "icon") {
|
|
32
|
+
const iconAttrs = attrs[`${key}Attrs`];
|
|
33
|
+
const rotateClasses = isShownOptions.value && config.value.iconRotate;
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
36
|
+
...iconAttrs.value,
|
|
37
|
+
class: cx([iconAttrs.value.class, rotateClasses]),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
if (key === "list") {
|
|
42
|
+
const getCVA = cva({
|
|
43
|
+
base: "",
|
|
44
|
+
variants: config.value["listWrapper"].variants,
|
|
45
|
+
compoundVariants: [],
|
|
46
|
+
});
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const classes = computed(() =>
|
|
49
|
+
getCVA({
|
|
50
|
+
...props,
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes: classes });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
54
57
|
|
|
55
58
|
return {
|
|
59
|
+
...attrs,
|
|
56
60
|
config,
|
|
57
|
-
listWrapperAttrs,
|
|
58
|
-
wrapperAttrs,
|
|
59
|
-
linkAttrs,
|
|
60
|
-
listAttrs,
|
|
61
|
-
iconAttrs,
|
|
62
|
-
triggerAttrs,
|
|
63
61
|
hasSlotContent,
|
|
64
62
|
};
|
|
65
63
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
wrapper: "relative inline-block",
|
|
3
3
|
trigger: "flex items-center relative space-x-0.5",
|
|
4
|
-
link: "",
|
|
5
|
-
icon: "block transition duration-300",
|
|
4
|
+
link: "{ULink}",
|
|
5
|
+
icon: "{UIcon} block transition duration-300",
|
|
6
6
|
iconName: "keyboard_arrow_down",
|
|
7
7
|
iconRotate: "rotate-180",
|
|
8
8
|
listWrapper: {
|
|
@@ -22,7 +22,7 @@ export default /*tw*/ {
|
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
|
-
list: "w-fit",
|
|
25
|
+
list: "{UDropdownList} w-fit",
|
|
26
26
|
defaultVariants: {
|
|
27
27
|
color: "brand",
|
|
28
28
|
size: "md",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UDropdownLink from "../ui.dropdown-link";
|
|
4
4
|
import UDropdownItem from "../ui.dropdown-item";
|
|
@@ -42,9 +42,7 @@ const DefaultTemplate = (args) => ({
|
|
|
42
42
|
<UDropdownLink
|
|
43
43
|
v-bind="args"
|
|
44
44
|
>
|
|
45
|
-
|
|
46
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
47
|
-
</template>
|
|
45
|
+
${allSlotsFragment}
|
|
48
46
|
</UDropdownLink>
|
|
49
47
|
`,
|
|
50
48
|
});
|
|
@@ -67,7 +67,7 @@ import vClickOutside from "../directive.clickOutside";
|
|
|
67
67
|
|
|
68
68
|
import { UDropdownLink } from "./constants";
|
|
69
69
|
import defaultConfig from "./configs/default.config";
|
|
70
|
-
import
|
|
70
|
+
import useAttrs from "./composables/attrs.composable";
|
|
71
71
|
import { UDropdownButton } from "../ui.dropdown-button/constants/index.js";
|
|
72
72
|
|
|
73
73
|
/* Should be a string for correct web-types gen */
|
|
@@ -208,7 +208,13 @@ const props = defineProps({
|
|
|
208
208
|
},
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
const emit = defineEmits([
|
|
211
|
+
const emit = defineEmits([
|
|
212
|
+
/**
|
|
213
|
+
* Triggers when dropdown option is selected.
|
|
214
|
+
* @property {string} value
|
|
215
|
+
*/
|
|
216
|
+
"select",
|
|
217
|
+
]);
|
|
212
218
|
|
|
213
219
|
provide("hideDropdownOptions", hideOptions);
|
|
214
220
|
|
|
@@ -5,65 +5,53 @@ import defaultConfig from "../configs/default.config";
|
|
|
5
5
|
import { computed } from "vue";
|
|
6
6
|
|
|
7
7
|
export default function useAttrs(props) {
|
|
8
|
-
const { config, getAttrs, hasSlotContent } = useUI(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
variants: subGroupLabel.variants,
|
|
14
|
-
compoundVariants: subGroupLabel.compoundVariants,
|
|
15
|
-
});
|
|
16
|
-
const cvaGroupLabel = cva({
|
|
17
|
-
base: groupLabel.base,
|
|
18
|
-
variants: groupLabel.variants,
|
|
19
|
-
compoundVariants: groupLabel.compoundVariants,
|
|
20
|
-
});
|
|
21
|
-
const cvaOption = cva({
|
|
22
|
-
base: option.base,
|
|
23
|
-
variants: option.variants,
|
|
24
|
-
compoundVariants: option.compoundVariants,
|
|
25
|
-
});
|
|
8
|
+
const { config, getAttrs, hasSlotContent, isSystemKey } = useUI(
|
|
9
|
+
defaultConfig,
|
|
10
|
+
() => props.config,
|
|
11
|
+
);
|
|
12
|
+
const attrs = {};
|
|
26
13
|
|
|
27
14
|
const optionClasses = computed(() =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
size: props.size,
|
|
31
|
-
}),
|
|
32
|
-
);
|
|
33
|
-
const subGroupLabelClasses = computed(() =>
|
|
34
|
-
cvaSubGroupLabel({
|
|
35
|
-
size: props.size,
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
38
|
-
const groupLabelClasses = computed(() =>
|
|
39
|
-
cvaGroupLabel({
|
|
40
|
-
size: props.size,
|
|
15
|
+
cva(config.value.option)({
|
|
16
|
+
...props,
|
|
41
17
|
}),
|
|
42
18
|
);
|
|
43
19
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
20
|
+
for (const key in defaultConfig) {
|
|
21
|
+
if (isSystemKey(key)) continue;
|
|
22
|
+
|
|
23
|
+
const classes = computed(() => {
|
|
24
|
+
const value = config.value[key];
|
|
25
|
+
|
|
26
|
+
if (value.variants || value.compoundVariants) {
|
|
27
|
+
return cva(value)({
|
|
28
|
+
...props,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
55
31
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
...subGroupLabelAttrsRaw.value,
|
|
59
|
-
class: cx([optionClasses.value, subGroupLabelAttrsRaw.value.class]),
|
|
60
|
-
}));
|
|
32
|
+
return "";
|
|
33
|
+
});
|
|
61
34
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
35
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
36
|
+
|
|
37
|
+
if (key === "subGroupLabel") {
|
|
38
|
+
const subGroupLabelAttrs = attrs[`${key}Attrs`];
|
|
39
|
+
|
|
40
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
41
|
+
...subGroupLabelAttrs.value,
|
|
42
|
+
class: cx([subGroupLabelAttrs.value.class, optionClasses.value]),
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (key === "groupLabel") {
|
|
47
|
+
const groupLabelAttrs = attrs[`${key}Attrs`];
|
|
48
|
+
|
|
49
|
+
attrs[`${key}Attrs`] = computed(() => ({
|
|
50
|
+
...groupLabelAttrs.value,
|
|
51
|
+
class: cx([groupLabelAttrs.value.class, optionClasses.value]),
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
67
55
|
|
|
68
56
|
const optionAttrs = (classes = []) => {
|
|
69
57
|
const mergedClasses = cx([optionClasses.value, ...classes]);
|
|
@@ -72,22 +60,10 @@ export default function useAttrs(props) {
|
|
|
72
60
|
};
|
|
73
61
|
|
|
74
62
|
return {
|
|
75
|
-
|
|
76
|
-
config,
|
|
77
|
-
wrapperAttrs,
|
|
78
|
-
listAttrs,
|
|
79
|
-
optionHighlightAttrs,
|
|
80
|
-
optionSelectedAttrs,
|
|
81
|
-
optionItemAttrs,
|
|
82
|
-
addTitleWrapperAttrs,
|
|
83
|
-
addTitleAttrs,
|
|
84
|
-
addTitleHotkeyAttrs,
|
|
85
|
-
buttonAddAttrs,
|
|
86
|
-
addIconAttrs,
|
|
63
|
+
...attrs,
|
|
87
64
|
optionAttrs,
|
|
88
|
-
subGroupLabelAttrs,
|
|
89
|
-
groupLabelAttrs,
|
|
90
65
|
optionClasses,
|
|
91
|
-
|
|
66
|
+
hasSlotContent,
|
|
67
|
+
config,
|
|
92
68
|
};
|
|
93
69
|
}
|
|
@@ -54,9 +54,9 @@ export default /*tw*/ {
|
|
|
54
54
|
`,
|
|
55
55
|
addTitle: "text-sm font-medium text-gray-900",
|
|
56
56
|
addTitleHotkey: "text-gray-500",
|
|
57
|
-
buttonAdd: "sticky left-[calc(100%-2.3rem)] bottom-2.5 p-1",
|
|
57
|
+
buttonAdd: "{UButton} sticky left-[calc(100%-2.3rem)] bottom-2.5 p-1",
|
|
58
58
|
addIconName: "add",
|
|
59
|
-
addIcon: "bg-transparent",
|
|
59
|
+
addIcon: "{UIcon} bg-transparent",
|
|
60
60
|
i18n: {
|
|
61
61
|
noDataToShow: "No data to show.",
|
|
62
62
|
add: "Add",
|