vueless 0.0.478-beta.2 → 0.0.478-beta.4
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 +2 -2
- package/types.ts +3 -2
- package/ui.data-table/UTable.vue +1 -1
- package/ui.image-icon/UIcon.vue +2 -2
- package/ui.text-badge/UBadge.vue +89 -179
- package/ui.text-badge/{config.js → config.ts} +1 -1
- package/ui.text-badge/storybook/Docs.mdx +2 -2
- package/ui.text-badge/storybook/{stories.js → stories.ts} +18 -35
- package/ui.text-badge/types.ts +84 -0
- package/ui.text-badge/{useAttrs.js → useAttrs.ts} +10 -5
- package/ui.text-file/UFile.vue +0 -1
- package/utils/utilUI.js +1 -1
- package/web-types.json +0 -9580
- /package/ui.text-badge/{constants.js → constants.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "0.0.478-beta.
|
|
3
|
+
"version": "0.0.478-beta.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build": "npx @vueless/web-types && node prepare.icons && storybook build --docs",
|
|
33
33
|
"preview": "vite preview --host --outDir=storybook-static",
|
|
34
34
|
"ts:check": "vue-tsc --build --force",
|
|
35
|
-
"release:prepare": "
|
|
35
|
+
"release:prepare": "node prepare.icons && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md dist/ && node prepare.package",
|
|
36
36
|
"release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
|
|
37
37
|
"release:patch": "release-it patch --ci --npm.publish",
|
|
38
38
|
"release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
|
package/types.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { hasSlotContent } from "./composablesTs/useUI.ts";
|
|
|
3
3
|
// TODO: Import all components here
|
|
4
4
|
import UTextDefaultConfig from "./ui.text-block/config.ts";
|
|
5
5
|
import UButtonDefaultConfig from "./ui.button/config.ts";
|
|
6
|
-
|
|
6
|
+
import UBadgeDefaultConfig from "./ui.text-badge/config.ts";
|
|
7
7
|
import type { ComputedRef } from "vue";
|
|
8
8
|
|
|
9
9
|
export interface ThemeConfig {
|
|
@@ -97,12 +97,13 @@ export type BrandColors =
|
|
|
97
97
|
export interface Components {
|
|
98
98
|
UText?: Partial<typeof UTextDefaultConfig>;
|
|
99
99
|
UButton?: Partial<typeof UButtonDefaultConfig>;
|
|
100
|
+
UBadge?: Partial<typeof UBadgeDefaultConfig>;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
export interface Component {
|
|
103
104
|
i18n?: UnknownObject;
|
|
104
105
|
defaults?: Defaults;
|
|
105
|
-
safelist?: () => TailwindSafelist[];
|
|
106
|
+
safelist?: (string: string) => TailwindSafelist[];
|
|
106
107
|
strategy?: Strategies;
|
|
107
108
|
transition?: Transition;
|
|
108
109
|
safelistColors?: BrandColors;
|
package/ui.data-table/UTable.vue
CHANGED
|
@@ -703,7 +703,7 @@ function onChangeSelectedRows(selectedRows) {
|
|
|
703
703
|
if (selectedRows.length) {
|
|
704
704
|
canSelectAll.value = false;
|
|
705
705
|
|
|
706
|
-
isCheckedMoreOneTableItems.value
|
|
706
|
+
isCheckedMoreOneTableItems.value && setFooterCellWidth();
|
|
707
707
|
} else {
|
|
708
708
|
nextTick(setHeaderCellWidth);
|
|
709
709
|
}
|
package/ui.image-icon/UIcon.vue
CHANGED
|
@@ -164,7 +164,7 @@ const dynamicComponent = computed(() => {
|
|
|
164
164
|
return component;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
/* eslint-disable
|
|
167
|
+
/* eslint-disable prettier/prettier */
|
|
168
168
|
const libraries = {
|
|
169
169
|
"vueless": async () => {
|
|
170
170
|
return import.meta.env.PROD
|
|
@@ -197,7 +197,7 @@ const dynamicComponent = computed(() => {
|
|
|
197
197
|
: import(/* @vite-ignore */ `/node_modules/${library}/24/${fillType}/${name}.svg?component`);
|
|
198
198
|
},
|
|
199
199
|
};
|
|
200
|
-
/* eslint-enable
|
|
200
|
+
/* eslint-enable prettier/prettier */
|
|
201
201
|
|
|
202
202
|
return defineAsyncComponent(libraries[library]);
|
|
203
203
|
});
|
package/ui.text-badge/UBadge.vue
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useTemplateRef, computed } from "vue";
|
|
3
|
+
|
|
4
|
+
import { getDefault } from "../utilsTs/utilUI.ts";
|
|
5
|
+
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
6
|
+
|
|
7
|
+
import { UBadge } from "./constants.ts";
|
|
8
|
+
import useAttrs from "./useAttrs.ts";
|
|
9
|
+
import defaultConfig from "./config.ts";
|
|
10
|
+
|
|
11
|
+
import type { UBadgeProps } from "./types.ts";
|
|
12
|
+
|
|
13
|
+
defineOptions({ inheritAttrs: false });
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<UBadgeProps>(), {
|
|
16
|
+
variant: getDefault<UBadgeProps>(defaultConfig, UBadge).variant,
|
|
17
|
+
bordered: getDefault<UBadgeProps>(defaultConfig, UBadge).bordered,
|
|
18
|
+
size: getDefault<UBadgeProps>(defaultConfig, UBadge).size,
|
|
19
|
+
color: getDefault<UBadgeProps>(defaultConfig, UBadge).color,
|
|
20
|
+
round: getDefault<UBadgeProps>(defaultConfig, UBadge).round,
|
|
21
|
+
tabindex: getDefault<UBadgeProps>(defaultConfig, UBadge).tabindex,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits([
|
|
25
|
+
/**
|
|
26
|
+
* Triggers when the badge is focused.
|
|
27
|
+
*/
|
|
28
|
+
"focus",
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Triggers when the badge is pressed.
|
|
32
|
+
*/
|
|
33
|
+
"keydown",
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Triggers when the badge loses focus.
|
|
37
|
+
*/
|
|
38
|
+
"blur",
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Triggers when the badge is clicked.
|
|
42
|
+
*/
|
|
43
|
+
"click",
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs } = useAttrs(props);
|
|
47
|
+
|
|
48
|
+
const wrapperRef = useTemplateRef<HTMLElement>("wrapper");
|
|
49
|
+
|
|
50
|
+
const iconSize = computed(() => {
|
|
51
|
+
const sizes = {
|
|
52
|
+
sm: "3xs",
|
|
53
|
+
md: "2xs",
|
|
54
|
+
lg: "xs",
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return sizes[props.size];
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const iconColor = computed(() => {
|
|
61
|
+
return props.variant === "primary" ? "white" : props.color;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
function onFocus() {
|
|
65
|
+
emit("focus");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function onBlur(event: FocusEvent) {
|
|
69
|
+
emit("blur", event);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function onKeydown(event: KeyboardEvent) {
|
|
73
|
+
emit("keydown", event);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function onClick(event: MouseEvent) {
|
|
77
|
+
emit("click", event);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
defineExpose({
|
|
81
|
+
/**
|
|
82
|
+
* A reference to the component's wrapper element for direct DOM manipulation.
|
|
83
|
+
* @property {HTMLElement}
|
|
84
|
+
*/
|
|
85
|
+
wrapperRef,
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
88
|
+
|
|
1
89
|
<template>
|
|
2
90
|
<div
|
|
3
|
-
ref="
|
|
91
|
+
ref="wrapper"
|
|
4
92
|
:data-test="dataTest"
|
|
5
93
|
v-bind="badgeAttrs"
|
|
6
94
|
:tabindex="tabindex"
|
|
@@ -73,181 +161,3 @@
|
|
|
73
161
|
</div>
|
|
74
162
|
</div>
|
|
75
163
|
</template>
|
|
76
|
-
|
|
77
|
-
<script setup>
|
|
78
|
-
import { ref, computed } from "vue";
|
|
79
|
-
|
|
80
|
-
import { getDefault } from "../utils/utilUI.js";
|
|
81
|
-
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
82
|
-
|
|
83
|
-
import { UBadge } from "./constants.js";
|
|
84
|
-
import useAttrs from "./useAttrs.js";
|
|
85
|
-
import defaultConfig from "./config.js";
|
|
86
|
-
|
|
87
|
-
defineOptions({ inheritAttrs: false });
|
|
88
|
-
|
|
89
|
-
const props = defineProps({
|
|
90
|
-
/**
|
|
91
|
-
* Badge label.
|
|
92
|
-
*/
|
|
93
|
-
label: {
|
|
94
|
-
type: String,
|
|
95
|
-
default: "",
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Badge variant.
|
|
100
|
-
* @values primary, secondary, thirdary
|
|
101
|
-
*/
|
|
102
|
-
variant: {
|
|
103
|
-
type: String,
|
|
104
|
-
default: getDefault(defaultConfig, UBadge).variant,
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Add border to the `thirdary` variant.
|
|
109
|
-
*/
|
|
110
|
-
bordered: {
|
|
111
|
-
type: Boolean,
|
|
112
|
-
default: getDefault(defaultConfig, UBadge).bordered,
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Badge size.
|
|
117
|
-
* @values sm, md, lg
|
|
118
|
-
*/
|
|
119
|
-
size: {
|
|
120
|
-
type: String,
|
|
121
|
-
default: getDefault(defaultConfig, UBadge).size,
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Badge color.
|
|
126
|
-
* @values brand, grayscale, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose, white
|
|
127
|
-
*/
|
|
128
|
-
color: {
|
|
129
|
-
type: String,
|
|
130
|
-
default: getDefault(defaultConfig, UBadge).color,
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Icon name (appears instead of label).
|
|
135
|
-
*/
|
|
136
|
-
icon: {
|
|
137
|
-
type: String,
|
|
138
|
-
default: "",
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Left icon name.
|
|
143
|
-
*/
|
|
144
|
-
leftIcon: {
|
|
145
|
-
type: String,
|
|
146
|
-
default: "",
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Right icon name.
|
|
151
|
-
*/
|
|
152
|
-
rightIcon: {
|
|
153
|
-
type: String,
|
|
154
|
-
default: "",
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Set badge corners rounded.
|
|
159
|
-
*/
|
|
160
|
-
round: {
|
|
161
|
-
type: Boolean,
|
|
162
|
-
default: getDefault(defaultConfig, UBadge).round,
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Controls the keyboard “Tab” focus order of elements.
|
|
167
|
-
*/
|
|
168
|
-
tabindex: {
|
|
169
|
-
type: [String, Number],
|
|
170
|
-
default: getDefault(defaultConfig, UBadge).tabindex,
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Component config object.
|
|
175
|
-
*/
|
|
176
|
-
config: {
|
|
177
|
-
type: Object,
|
|
178
|
-
default: () => ({}),
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Data-test attribute for automated testing.
|
|
183
|
-
*/
|
|
184
|
-
dataTest: {
|
|
185
|
-
type: String,
|
|
186
|
-
default: "",
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
const emit = defineEmits([
|
|
191
|
-
/**
|
|
192
|
-
* Triggers when the badge is focused.
|
|
193
|
-
*/
|
|
194
|
-
"focus",
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Triggers when the badge is pressed.
|
|
198
|
-
*/
|
|
199
|
-
"keydown",
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Triggers when the badge loses focus.
|
|
203
|
-
*/
|
|
204
|
-
"blur",
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Triggers when the badge is clicked.
|
|
208
|
-
*/
|
|
209
|
-
"click",
|
|
210
|
-
]);
|
|
211
|
-
|
|
212
|
-
const { badgeAttrs, bodyAttrs, leftIconAttrs, centerIconAttrs, rightIconAttrs } = useAttrs(props);
|
|
213
|
-
|
|
214
|
-
const wrapperRef = ref(null);
|
|
215
|
-
|
|
216
|
-
const iconSize = computed(() => {
|
|
217
|
-
const sizes = {
|
|
218
|
-
sm: "3xs",
|
|
219
|
-
md: "2xs",
|
|
220
|
-
lg: "xs",
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
return sizes[props.size];
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
const iconColor = computed(() => {
|
|
227
|
-
return props.variant === "primary" ? "white" : props.color;
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
function onFocus() {
|
|
231
|
-
emit("focus");
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function onBlur(event) {
|
|
235
|
-
emit("blur", event);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
function onKeydown(event) {
|
|
239
|
-
emit("keydown", event);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function onClick(event) {
|
|
243
|
-
emit("click", event);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
defineExpose({
|
|
247
|
-
/**
|
|
248
|
-
* A reference to the component's wrapper element for direct DOM manipulation.
|
|
249
|
-
* @property {HTMLElement}
|
|
250
|
-
*/
|
|
251
|
-
wrapperRef,
|
|
252
|
-
});
|
|
253
|
-
</script>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
|
|
2
2
|
import { getSource } from "../../utils/utilStorybook.js";
|
|
3
3
|
|
|
4
|
-
import * as stories from "./stories.
|
|
5
|
-
import defaultConfig from "../config.
|
|
4
|
+
import * as stories from "./stories.ts";
|
|
5
|
+
import defaultConfig from "../config.ts?raw"
|
|
6
6
|
|
|
7
7
|
<Meta of={stories} />
|
|
8
8
|
<Title of={stories} />
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from "@storybook/vue3";
|
|
2
|
+
import { getArgTypes, getSlotNames, getSlotsFragment } from "../../utilsTs/utilStorybook.ts";
|
|
2
3
|
|
|
3
4
|
import UBadge from "../../ui.text-badge/UBadge.vue";
|
|
4
5
|
import UIcon from "../../ui.image-icon/UIcon.vue";
|
|
5
6
|
import URow from "../../ui.container-row/URow.vue";
|
|
6
7
|
import UCol from "../../ui.container-col/UCol.vue";
|
|
7
8
|
|
|
9
|
+
import type { UBadgeProps } from "../types.ts";
|
|
10
|
+
|
|
11
|
+
interface UBadgeArgs extends UBadgeProps {
|
|
12
|
+
slotTemplate?: string;
|
|
13
|
+
enum: "variant" | "size";
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* The `UBadge` component. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/ui.text-badge)
|
|
10
18
|
*/
|
|
@@ -18,9 +26,9 @@ export default {
|
|
|
18
26
|
argTypes: {
|
|
19
27
|
...getArgTypes(UBadge.__name),
|
|
20
28
|
},
|
|
21
|
-
};
|
|
29
|
+
} as Meta;
|
|
22
30
|
|
|
23
|
-
const DefaultTemplate = (args) => ({
|
|
31
|
+
const DefaultTemplate: StoryFn<UBadgeArgs> = (args: UBadgeArgs) => ({
|
|
24
32
|
components: { UBadge, UIcon },
|
|
25
33
|
setup() {
|
|
26
34
|
const slots = getSlotNames(UBadge.__name);
|
|
@@ -29,18 +37,18 @@ const DefaultTemplate = (args) => ({
|
|
|
29
37
|
},
|
|
30
38
|
template: `
|
|
31
39
|
<UBadge v-bind="args">
|
|
32
|
-
${args.slotTemplate || getSlotsFragment()}
|
|
40
|
+
${args.slotTemplate || getSlotsFragment("")}
|
|
33
41
|
</UBadge>
|
|
34
42
|
`,
|
|
35
43
|
});
|
|
36
44
|
|
|
37
|
-
const ColorsTemplate = (args, { argTypes }) => ({
|
|
45
|
+
const ColorsTemplate: StoryFn<UBadgeArgs> = (args: UBadgeArgs, { argTypes }) => ({
|
|
38
46
|
components: { UBadge, URow, UCol },
|
|
39
47
|
setup() {
|
|
40
48
|
return {
|
|
41
49
|
args,
|
|
42
|
-
variants: argTypes
|
|
43
|
-
colors: argTypes
|
|
50
|
+
variants: argTypes?.variant?.options,
|
|
51
|
+
colors: argTypes?.color?.options,
|
|
44
52
|
};
|
|
45
53
|
},
|
|
46
54
|
template: `
|
|
@@ -59,14 +67,14 @@ const ColorsTemplate = (args, { argTypes }) => ({
|
|
|
59
67
|
`,
|
|
60
68
|
});
|
|
61
69
|
|
|
62
|
-
const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
70
|
+
const EnumVariantTemplate: StoryFn<UBadgeArgs> = (args: UBadgeArgs, { argTypes }) => ({
|
|
63
71
|
components: { UBadge, URow },
|
|
64
72
|
setup() {
|
|
65
|
-
function getText(value) {
|
|
73
|
+
function getText(value: string) {
|
|
66
74
|
return `Badge ${value}`;
|
|
67
75
|
}
|
|
68
76
|
|
|
69
|
-
return { args, options: argTypes[args.enum]
|
|
77
|
+
return { args, options: argTypes?.[args.enum]?.options || [], getText };
|
|
70
78
|
},
|
|
71
79
|
template: `
|
|
72
80
|
<URow>
|
|
@@ -76,7 +84,6 @@ const EnumVariantTemplate = (args, { argTypes }) => ({
|
|
|
76
84
|
variant="thirdary"
|
|
77
85
|
filled
|
|
78
86
|
>
|
|
79
|
-
fff
|
|
80
87
|
</UDropdownButton>
|
|
81
88
|
<UBadge
|
|
82
89
|
v-for="(option, index) in options"
|
|
@@ -107,30 +114,6 @@ LeftIcon.args = { leftIcon: "star" };
|
|
|
107
114
|
export const RightIcon = DefaultTemplate.bind({});
|
|
108
115
|
RightIcon.args = { rightIcon: "star" };
|
|
109
116
|
|
|
110
|
-
export const LeftIconSlot = DefaultTemplate.bind({});
|
|
111
|
-
LeftIconSlot.args = {
|
|
112
|
-
slotTemplate: `
|
|
113
|
-
<template #left-icon>
|
|
114
|
-
<UIcon
|
|
115
|
-
name="info"
|
|
116
|
-
color="red"
|
|
117
|
-
/>
|
|
118
|
-
</template>
|
|
119
|
-
`,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export const RightIconSlot = DefaultTemplate.bind({});
|
|
123
|
-
RightIconSlot.args = {
|
|
124
|
-
slotTemplate: `
|
|
125
|
-
<template #right-icon>
|
|
126
|
-
<UIcon
|
|
127
|
-
name="info"
|
|
128
|
-
color="red"
|
|
129
|
-
/>
|
|
130
|
-
</template>
|
|
131
|
-
`,
|
|
132
|
-
};
|
|
133
|
-
|
|
134
117
|
export const SlotLeft = DefaultTemplate.bind({});
|
|
135
118
|
SlotLeft.args = {
|
|
136
119
|
slotTemplate: `
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import defaultConfig from "./config.ts";
|
|
2
|
+
|
|
3
|
+
export interface UBadgeProps {
|
|
4
|
+
/**
|
|
5
|
+
* Badge label.
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Badge variant.
|
|
11
|
+
*/
|
|
12
|
+
variant?: "primary" | "secondary" | "thirdary";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Add border to the `thirdary` variant.
|
|
16
|
+
*/
|
|
17
|
+
bordered: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Badge size.
|
|
21
|
+
*/
|
|
22
|
+
size?: "sm" | "md" | "lg";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Badge color.
|
|
26
|
+
*/
|
|
27
|
+
color?:
|
|
28
|
+
| "brand"
|
|
29
|
+
| "grayscale"
|
|
30
|
+
| "gray"
|
|
31
|
+
| "red"
|
|
32
|
+
| "orange"
|
|
33
|
+
| "amber"
|
|
34
|
+
| "yellow"
|
|
35
|
+
| "lime"
|
|
36
|
+
| "green"
|
|
37
|
+
| "emerald"
|
|
38
|
+
| "teal"
|
|
39
|
+
| "cyan"
|
|
40
|
+
| "sky"
|
|
41
|
+
| "blue"
|
|
42
|
+
| "indigo"
|
|
43
|
+
| "violet"
|
|
44
|
+
| "purple"
|
|
45
|
+
| "fuchsia"
|
|
46
|
+
| "pink"
|
|
47
|
+
| "rose"
|
|
48
|
+
| "white";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Icon name (appears instead of label).
|
|
52
|
+
*/
|
|
53
|
+
icon?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Left icon name.
|
|
57
|
+
*/
|
|
58
|
+
leftIcon?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Right icon name.
|
|
62
|
+
*/
|
|
63
|
+
rightIcon?: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Set badge corners rounded.
|
|
67
|
+
*/
|
|
68
|
+
round: boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Controls the keyboard “Tab” focus order of elements.
|
|
72
|
+
*/
|
|
73
|
+
tabindex: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Component config object.
|
|
77
|
+
*/
|
|
78
|
+
config?: Partial<typeof defaultConfig>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Data-test attribute for automated testing.
|
|
82
|
+
*/
|
|
83
|
+
dataTest?: string;
|
|
84
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { computed, useSlots } from "vue";
|
|
2
|
-
import useUI from "../
|
|
2
|
+
import useUI from "../composablesTs/useUI.ts";
|
|
3
3
|
|
|
4
|
-
import defaultConfig from "./config.
|
|
4
|
+
import defaultConfig from "./config.ts";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import type { UseAttrs } from "../types.ts";
|
|
7
|
+
import type { UBadgeProps } from "./types.ts";
|
|
8
|
+
|
|
9
|
+
type Config = Partial<typeof defaultConfig>;
|
|
10
|
+
|
|
11
|
+
export default function useAttrs(props: UBadgeProps) {
|
|
12
|
+
const { config, getKeysAttrs, hasSlotContent } = useUI<Config>(defaultConfig, () => props.config);
|
|
8
13
|
const slots = useSlots();
|
|
9
14
|
|
|
10
15
|
const mutatedProps = computed(() => ({
|
|
@@ -19,5 +24,5 @@ export default function useAttrs(props) {
|
|
|
19
24
|
config,
|
|
20
25
|
...keysAttrs,
|
|
21
26
|
hasSlotContent,
|
|
22
|
-
};
|
|
27
|
+
} as UseAttrs;
|
|
23
28
|
}
|
package/ui.text-file/UFile.vue
CHANGED