vueless 0.0.283 → 0.0.285
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
CHANGED
|
@@ -22,8 +22,8 @@ export default function useAttrs(props) {
|
|
|
22
22
|
...props,
|
|
23
23
|
color: getColor(props.color),
|
|
24
24
|
square: props.loading || props.square,
|
|
25
|
-
leftIcon: Boolean(props.
|
|
26
|
-
rightIcon: Boolean(props.
|
|
25
|
+
leftIcon: Boolean(props.leftIcon) || hasSlotContent(slots["left-icon"]),
|
|
26
|
+
rightIcon: Boolean(props.rightIcon) || hasSlotContent(slots["right-icon"]),
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -96,28 +96,54 @@ Weight.args = { enum: "weight" };
|
|
|
96
96
|
export const Colors = ColorsTemplate.bind({});
|
|
97
97
|
Colors.args = {};
|
|
98
98
|
|
|
99
|
-
export const
|
|
100
|
-
|
|
99
|
+
export const leftIcon = DefaultTemplate.bind({});
|
|
100
|
+
leftIcon.args = {
|
|
101
|
+
leftIcon: "star",
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const rightIcon = DefaultTemplate.bind({});
|
|
105
|
+
rightIcon.args = {
|
|
106
|
+
rightIcon: "star",
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const leftIconSlot = DefaultTemplate.bind({});
|
|
110
|
+
leftIconSlot.args = {
|
|
101
111
|
slotTemplate: `
|
|
102
|
-
<template #
|
|
112
|
+
<template #left-icon>
|
|
103
113
|
<UIcon
|
|
104
|
-
tooltip="tooltip text"
|
|
105
114
|
name="info"
|
|
106
|
-
|
|
115
|
+
color="red"
|
|
107
116
|
/>
|
|
108
117
|
</template>
|
|
109
118
|
`,
|
|
110
119
|
};
|
|
111
120
|
|
|
112
|
-
export const
|
|
113
|
-
|
|
121
|
+
export const rightIconSlot = DefaultTemplate.bind({});
|
|
122
|
+
rightIconSlot.args = {
|
|
114
123
|
slotTemplate: `
|
|
115
|
-
<template #
|
|
124
|
+
<template #right-icon>
|
|
116
125
|
<UIcon
|
|
117
|
-
tooltip="tooltip text"
|
|
118
126
|
name="info"
|
|
119
|
-
|
|
127
|
+
color="red"
|
|
120
128
|
/>
|
|
121
129
|
</template>
|
|
122
130
|
`,
|
|
123
131
|
};
|
|
132
|
+
|
|
133
|
+
export const slotLeft = DefaultTemplate.bind({});
|
|
134
|
+
slotLeft.args = {
|
|
135
|
+
slotTemplate: `
|
|
136
|
+
<template #left>
|
|
137
|
+
🤘
|
|
138
|
+
</template>
|
|
139
|
+
`,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const slotRight = DefaultTemplate.bind({});
|
|
143
|
+
slotRight.args = {
|
|
144
|
+
slotTemplate: `
|
|
145
|
+
<template #right>
|
|
146
|
+
🤘
|
|
147
|
+
</template>
|
|
148
|
+
`,
|
|
149
|
+
};
|
package/ui.text-badge/index.vue
CHANGED
|
@@ -13,6 +13,25 @@
|
|
|
13
13
|
<!-- @slot Use it to add something before text. -->
|
|
14
14
|
<slot name="left" />
|
|
15
15
|
|
|
16
|
+
<div v-if="hasSlotContent($slots['left-icon']) || leftIcon">
|
|
17
|
+
<!--
|
|
18
|
+
@slot Use it to add icon before the text.
|
|
19
|
+
@binding {string} icon-name
|
|
20
|
+
@binding {string} icon-size
|
|
21
|
+
@binding {string} icon-color
|
|
22
|
+
-->
|
|
23
|
+
<slot name="left-icon" :icon-name="leftIcon" :icon-size="iconSize" :icon-color="color">
|
|
24
|
+
<UIcon
|
|
25
|
+
v-if="leftIcon"
|
|
26
|
+
:name="leftIcon"
|
|
27
|
+
:size="iconSize"
|
|
28
|
+
:color="color"
|
|
29
|
+
internal
|
|
30
|
+
v-bind="leftIconAttrs"
|
|
31
|
+
/>
|
|
32
|
+
</slot>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
16
35
|
<!-- @slot Use it to add something instead of text. -->
|
|
17
36
|
<slot>
|
|
18
37
|
<div v-if="!hasSlotContent($slots['default'])">
|
|
@@ -20,6 +39,25 @@
|
|
|
20
39
|
</div>
|
|
21
40
|
</slot>
|
|
22
41
|
|
|
42
|
+
<div v-if="hasSlotContent($slots['right-icon']) || rightIcon">
|
|
43
|
+
<!--
|
|
44
|
+
@slot Use it to add icon after the text.
|
|
45
|
+
@binding {string} icon-name
|
|
46
|
+
@binding {string} icon-size
|
|
47
|
+
@binding {string} icon-color
|
|
48
|
+
-->
|
|
49
|
+
<slot name="right-icon" :icon-name="rightIcon" :icon-size="iconSize" :icon-color="color">
|
|
50
|
+
<UIcon
|
|
51
|
+
v-if="rightIcon"
|
|
52
|
+
:name="rightIcon"
|
|
53
|
+
:size="iconSize"
|
|
54
|
+
:color="color"
|
|
55
|
+
internal
|
|
56
|
+
v-bind="rightIconAttrs"
|
|
57
|
+
/>
|
|
58
|
+
</slot>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
23
61
|
<!-- @slot Use it to add something after text. -->
|
|
24
62
|
<slot name="right" />
|
|
25
63
|
</div>
|
|
@@ -27,9 +65,10 @@
|
|
|
27
65
|
</template>
|
|
28
66
|
|
|
29
67
|
<script setup>
|
|
30
|
-
import { ref } from "vue";
|
|
68
|
+
import { ref, computed } from "vue";
|
|
31
69
|
|
|
32
70
|
import { getDefault } from "../service.ui";
|
|
71
|
+
import UIcon from "../ui.image-icon";
|
|
33
72
|
|
|
34
73
|
import { UBadge } from "./constants";
|
|
35
74
|
import useAttrs from "./composables/attrs.composable";
|
|
@@ -66,6 +105,22 @@ const props = defineProps({
|
|
|
66
105
|
default: getDefault(defaultConfig, UBadge).size,
|
|
67
106
|
},
|
|
68
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Left side icon name.
|
|
110
|
+
*/
|
|
111
|
+
leftIcon: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: "",
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Right side icon name.
|
|
118
|
+
*/
|
|
119
|
+
rightIcon: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: "",
|
|
122
|
+
},
|
|
123
|
+
|
|
69
124
|
/**
|
|
70
125
|
* Badge font weight.
|
|
71
126
|
* @values regular, medium, bold
|
|
@@ -123,12 +178,22 @@ const emit = defineEmits([
|
|
|
123
178
|
"click",
|
|
124
179
|
]);
|
|
125
180
|
|
|
126
|
-
const { bodyAttrs, wrapperAttrs, hasSlotContent } = useAttrs(props);
|
|
181
|
+
const { bodyAttrs, wrapperAttrs, leftIconAttrs, rightIconAttrs, hasSlotContent } = useAttrs(props);
|
|
127
182
|
|
|
128
183
|
const wrapperRef = ref(null);
|
|
129
184
|
|
|
130
185
|
defineExpose({ wrapperRef });
|
|
131
186
|
|
|
187
|
+
const iconSize = computed(() => {
|
|
188
|
+
const sizes = {
|
|
189
|
+
sm: "xs",
|
|
190
|
+
md: "sm",
|
|
191
|
+
lg: "md",
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
return sizes[props.size];
|
|
195
|
+
});
|
|
196
|
+
|
|
132
197
|
function onFocus() {
|
|
133
198
|
emit("focus");
|
|
134
199
|
}
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.285",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -686,6 +686,24 @@
|
|
|
686
686
|
},
|
|
687
687
|
"default": "md"
|
|
688
688
|
},
|
|
689
|
+
{
|
|
690
|
+
"name": "leftIcon",
|
|
691
|
+
"description": "Left side icon name.",
|
|
692
|
+
"value": {
|
|
693
|
+
"kind": "expression",
|
|
694
|
+
"type": "string"
|
|
695
|
+
},
|
|
696
|
+
"default": "\"\""
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"name": "rightIcon",
|
|
700
|
+
"description": "Right side icon name.",
|
|
701
|
+
"value": {
|
|
702
|
+
"kind": "expression",
|
|
703
|
+
"type": "string"
|
|
704
|
+
},
|
|
705
|
+
"default": "\"\""
|
|
706
|
+
},
|
|
689
707
|
{
|
|
690
708
|
"name": "weight",
|
|
691
709
|
"description": "Badge font weight.",
|
|
@@ -746,10 +764,48 @@
|
|
|
746
764
|
"name": "left",
|
|
747
765
|
"description": "Use it to add something before text."
|
|
748
766
|
},
|
|
767
|
+
{
|
|
768
|
+
"name": "left-icon",
|
|
769
|
+
"scoped": true,
|
|
770
|
+
"description": "Use it to add icon before the text.",
|
|
771
|
+
"bindings": [
|
|
772
|
+
{
|
|
773
|
+
"type": "string",
|
|
774
|
+
"name": "icon-name"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"type": "string",
|
|
778
|
+
"name": "icon-size"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"type": "string",
|
|
782
|
+
"name": "icon-color"
|
|
783
|
+
}
|
|
784
|
+
]
|
|
785
|
+
},
|
|
749
786
|
{
|
|
750
787
|
"name": "default",
|
|
751
788
|
"description": "Use it to add something instead of text."
|
|
752
789
|
},
|
|
790
|
+
{
|
|
791
|
+
"name": "right-icon",
|
|
792
|
+
"scoped": true,
|
|
793
|
+
"description": "Use it to add icon after the text.",
|
|
794
|
+
"bindings": [
|
|
795
|
+
{
|
|
796
|
+
"type": "string",
|
|
797
|
+
"name": "icon-name"
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
"type": "string",
|
|
801
|
+
"name": "icon-size"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
"type": "string",
|
|
805
|
+
"name": "icon-color"
|
|
806
|
+
}
|
|
807
|
+
]
|
|
808
|
+
},
|
|
753
809
|
{
|
|
754
810
|
"name": "right",
|
|
755
811
|
"description": "Use it to add something after text."
|