vueless 0.0.200 → 0.0.202
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/service.storybook/index.js +1 -1
- package/ui.button/composables/attrs.composable.js +6 -2
- package/ui.button/configs/default.config.js +14 -2
- package/ui.button/index.stories.js +27 -3
- package/ui.button/index.vue +70 -27
- 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.form-input/composables/attrs.composable.js +31 -48
- package/ui.form-input/configs/default.config.js +3 -3
- package/ui.form-input/index.stories.js +32 -9
- package/ui.form-input/index.vue +92 -41
- 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-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/web-types.json +326 -145
- 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
|
@@ -1,54 +1,64 @@
|
|
|
1
1
|
import { computed, toValue } from "vue";
|
|
2
|
-
import { cx, cva } from "../../service.ui";
|
|
3
2
|
import useUI from "../../composable.ui";
|
|
4
|
-
|
|
3
|
+
import { cx, cva } from "../../service.ui";
|
|
5
4
|
import defaultConfig from "../configs/default.config";
|
|
6
5
|
|
|
7
|
-
export function useAttrs(props, { selectedValue, separated, variant }) {
|
|
8
|
-
const { config, getAttrs } = useUI(
|
|
9
|
-
|
|
6
|
+
export default function useAttrs(props, { selectedValue, separated, variant }) {
|
|
7
|
+
const { config, getAttrs, isSystemKey, hasSlotContent } = useUI(
|
|
8
|
+
defaultConfig,
|
|
9
|
+
() => props.config,
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const skipKeys = ["selected"];
|
|
13
|
+
|
|
14
|
+
const attrs = {};
|
|
10
15
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
variants: button.variants,
|
|
14
|
-
compoundVariants: button.compoundVariants,
|
|
15
|
-
});
|
|
16
|
+
for (const key in defaultConfig) {
|
|
17
|
+
if (isSystemKey(key) || skipKeys.includes(key)) continue;
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const classes = computed(() => {
|
|
20
|
+
const value = config.value[key];
|
|
21
|
+
|
|
22
|
+
if (value.variants || value.compoundVariants) {
|
|
23
|
+
return cva(value)({
|
|
24
|
+
...props,
|
|
25
|
+
variant: toValue(variant),
|
|
26
|
+
separated: toValue(separated),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return "";
|
|
21
31
|
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const cvaSelected = cva({
|
|
25
|
-
base: selected.base,
|
|
26
|
-
variants: selected.variants,
|
|
27
|
-
compoundVariants: selected.compoundVariants,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const selectedClasses = computed(() =>
|
|
31
|
-
cvaSelected({
|
|
32
|
-
variant: toValue(variant),
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
attrs[`${key}Attrs`] = getAttrs(key, { classes });
|
|
34
|
+
|
|
35
|
+
if (key === "button") {
|
|
36
|
+
const selectedClasses = computed(() =>
|
|
37
|
+
cva(config.value.selected)({
|
|
38
|
+
...props,
|
|
39
|
+
variant: toValue(variant),
|
|
40
|
+
separated: toValue(separated),
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const buttonAttrs = attrs[`${key}Attrs`];
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
attrs[`${key}Attrs`] = computed(() => {
|
|
47
|
+
const isSelected = Array.isArray(selectedValue?.value)
|
|
48
|
+
? selectedValue?.value?.includes(props.value)
|
|
49
|
+
: selectedValue?.value === props.value;
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
return {
|
|
52
|
+
...buttonAttrs.value,
|
|
53
|
+
class: cx([buttonAttrs.value.class, isSelected && selectedClasses.value]),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
49
58
|
|
|
50
59
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
...attrs,
|
|
61
|
+
config,
|
|
62
|
+
hasSlotContent,
|
|
53
63
|
};
|
|
54
64
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default /*tw*/ {
|
|
2
2
|
button: {
|
|
3
3
|
base: `
|
|
4
|
-
border-gray-300 font-normal
|
|
4
|
+
{UButton} border-gray-300 font-normal
|
|
5
5
|
hover:text-brand-600 hover:border-brand-600 hover:relative hover:z-10
|
|
6
6
|
focus:text-brand-600 focus:border-brand-600 focus:relative focus:z-10 focus:ring-brand-600 focus-within:ring-brand-600
|
|
7
7
|
active:text-brand-700 active:border-brand-700 active:relative active:z-10
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getArgTypes, getSlotNames } from "../service.storybook";
|
|
1
|
+
import { getArgTypes, getSlotNames, allSlotsFragment } from "../service.storybook";
|
|
2
2
|
|
|
3
3
|
import UToggleItem from "../ui.button-toggle-item";
|
|
4
4
|
import UIcon from "../ui.image-icon";
|
|
@@ -29,9 +29,7 @@ const DefaultTemplate = (args) => ({
|
|
|
29
29
|
},
|
|
30
30
|
template: `
|
|
31
31
|
<UToggleItem v-bind="args" name="toggle">
|
|
32
|
-
|
|
33
|
-
<template v-if="args[slot]">{{ args[slot] }}</template>
|
|
34
|
-
</template>
|
|
32
|
+
${allSlotsFragment}
|
|
35
33
|
</UToggleItem>
|
|
36
34
|
`,
|
|
37
35
|
});
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
@click.stop="onClickSetValue"
|
|
15
15
|
>
|
|
16
16
|
<template #left>
|
|
17
|
+
<!-- @slot Use it to add something before the text. -->
|
|
17
18
|
<slot name="left" />
|
|
18
19
|
</template>
|
|
19
20
|
|
|
@@ -28,11 +29,12 @@
|
|
|
28
29
|
v-bind="inputAttrs"
|
|
29
30
|
@click.stop
|
|
30
31
|
/>
|
|
31
|
-
|
|
32
|
+
<!-- @slot Use it to add something instead of the text. -->
|
|
32
33
|
<slot name="default" />
|
|
33
34
|
</template>
|
|
34
35
|
|
|
35
36
|
<template #right>
|
|
37
|
+
<!-- @slot Use it to add something after the text. -->
|
|
36
38
|
<slot name="right" />
|
|
37
39
|
</template>
|
|
38
40
|
</UButton>
|
|
@@ -46,7 +48,7 @@ import UIService, { getRandomId } from "../service.ui";
|
|
|
46
48
|
|
|
47
49
|
import { TYPE_RADIO } from "../ui.button-toggle/constants";
|
|
48
50
|
|
|
49
|
-
import
|
|
51
|
+
import useAttrs from "./composables/attrs.composable";
|
|
50
52
|
import defaultConfig from "./configs/default.config";
|
|
51
53
|
import { UToggleItem } from "./constants";
|
|
52
54
|
|
|
@@ -112,7 +114,13 @@ const props = defineProps({
|
|
|
112
114
|
},
|
|
113
115
|
});
|
|
114
116
|
|
|
115
|
-
const emit = defineEmits([
|
|
117
|
+
const emit = defineEmits([
|
|
118
|
+
/**
|
|
119
|
+
* Triggers when new value is set.
|
|
120
|
+
* @property {string} modelValue
|
|
121
|
+
*/
|
|
122
|
+
"update:modelValue",
|
|
123
|
+
]);
|
|
116
124
|
|
|
117
125
|
const name = inject("toggleName", () => "toggle");
|
|
118
126
|
const type = inject("toggleType", UIService.get(defaultConfig, UToggleItem).default.type);
|
|
@@ -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",
|