sprintify-ui 0.6.39 → 0.6.40
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.
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
2
|
+
class: {
|
|
3
|
+
type: import("vue").PropType<string | string[]>;
|
|
4
|
+
default: undefined;
|
|
5
|
+
};
|
|
2
6
|
color: {
|
|
3
7
|
type: import("vue").PropType<string>;
|
|
4
8
|
default: string;
|
|
@@ -11,7 +15,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
11
15
|
default: undefined;
|
|
12
16
|
};
|
|
13
17
|
size: {
|
|
14
|
-
type: import("vue").PropType<
|
|
18
|
+
type: import("vue").PropType<string>;
|
|
15
19
|
default: string;
|
|
16
20
|
};
|
|
17
21
|
contrast: {
|
|
@@ -22,6 +26,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
22
26
|
type: import("vue").PropType<boolean>;
|
|
23
27
|
};
|
|
24
28
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
class: {
|
|
30
|
+
type: import("vue").PropType<string | string[]>;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
25
33
|
color: {
|
|
26
34
|
type: import("vue").PropType<string>;
|
|
27
35
|
default: string;
|
|
@@ -34,7 +42,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
34
42
|
default: undefined;
|
|
35
43
|
};
|
|
36
44
|
size: {
|
|
37
|
-
type: import("vue").PropType<
|
|
45
|
+
type: import("vue").PropType<string>;
|
|
38
46
|
default: string;
|
|
39
47
|
};
|
|
40
48
|
contrast: {
|
|
@@ -45,9 +53,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
45
53
|
type: import("vue").PropType<boolean>;
|
|
46
54
|
};
|
|
47
55
|
}>>, {
|
|
56
|
+
class: string | string[];
|
|
48
57
|
color: string;
|
|
49
58
|
icon: string;
|
|
50
|
-
size:
|
|
59
|
+
size: string;
|
|
51
60
|
contrast: "high" | "low";
|
|
52
61
|
}, {}>, {
|
|
53
62
|
default?(_: {}): any;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { palette } from '@/utils/colors';
|
|
|
4
4
|
|
|
5
5
|
const colors = [...Object.keys(palette), '#ff0000', '#dbeafe'];
|
|
6
6
|
|
|
7
|
-
const sizes = ['sm', '
|
|
7
|
+
const sizes = ['sm', 'md', 'lg'];
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
title: 'Components/BaseBadge',
|
|
@@ -88,9 +88,9 @@ export const Sizes = (args) => ({
|
|
|
88
88
|
return { args, colors, sizes };
|
|
89
89
|
},
|
|
90
90
|
template: `
|
|
91
|
-
<div v-for="size in sizes" :key="size">
|
|
92
|
-
<p class="text-xs text-slate-600 leading-tight
|
|
93
|
-
<BaseBadge v-bind="args" :size="size"
|
|
91
|
+
<div v-for="size in sizes" :key="size" class="mb-1">
|
|
92
|
+
<p class="text-xs text-slate-600 leading-tight">{{ size }}</p>
|
|
93
|
+
<BaseBadge v-bind="args" :size="size">
|
|
94
94
|
Administrator
|
|
95
95
|
</BaseBadge>
|
|
96
96
|
</div>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span
|
|
3
|
-
class="
|
|
4
|
-
:class="[sizeClasses, wrapClasses]"
|
|
3
|
+
:class="classes"
|
|
5
4
|
:style="colorStyle"
|
|
6
5
|
>
|
|
7
6
|
<BaseIcon
|
|
@@ -17,20 +16,29 @@
|
|
|
17
16
|
<script lang="ts" setup>
|
|
18
17
|
import { getColorConfig } from '@/utils/colors';
|
|
19
18
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
19
|
+
import { twMerge } from 'tailwind-merge';
|
|
20
|
+
|
|
21
|
+
const sizes = ['sm', 'md', 'lg'];
|
|
22
|
+
|
|
23
|
+
defineOptions({
|
|
24
|
+
inheritAttrs: false,
|
|
25
|
+
})
|
|
20
26
|
|
|
21
27
|
const props = withDefaults(
|
|
22
28
|
defineProps<{
|
|
29
|
+
class?: string | string[];
|
|
23
30
|
contrast?: 'low' | 'high';
|
|
24
31
|
color?: string;
|
|
25
|
-
size?:
|
|
32
|
+
size?: typeof sizes[number];
|
|
26
33
|
icon?: string;
|
|
27
34
|
wrap?: boolean;
|
|
28
35
|
bordered?: boolean;
|
|
29
36
|
}>(),
|
|
30
37
|
{
|
|
31
|
-
|
|
38
|
+
class: undefined,
|
|
39
|
+
contrast: 'low',
|
|
32
40
|
color: 'gray',
|
|
33
|
-
size: '
|
|
41
|
+
size: 'md',
|
|
34
42
|
icon: undefined,
|
|
35
43
|
}
|
|
36
44
|
);
|
|
@@ -52,36 +60,34 @@ const colorStyle = computed((): Record<string, string> => {
|
|
|
52
60
|
return styles;
|
|
53
61
|
});
|
|
54
62
|
|
|
55
|
-
const
|
|
56
|
-
if (!props.
|
|
57
|
-
return '
|
|
63
|
+
const sizeInternal = computed(() => {
|
|
64
|
+
if (!sizes.includes(props.size)) {
|
|
65
|
+
return 'md';
|
|
58
66
|
}
|
|
59
|
-
return '';
|
|
60
|
-
});
|
|
61
67
|
|
|
62
|
-
|
|
63
|
-
if (props.size == 'sm') {
|
|
64
|
-
return 'px-2 py-px text-[11px]';
|
|
65
|
-
}
|
|
66
|
-
if (props.size == 'base') {
|
|
67
|
-
return 'px-2.5 py-0.5 text-xs';
|
|
68
|
-
}
|
|
69
|
-
if (props.size == 'lg') {
|
|
70
|
-
return 'px-3 py-0.5 text-sm';
|
|
71
|
-
}
|
|
72
|
-
return 'px-2.5 py-0.5 text-xs';
|
|
68
|
+
return props.size;
|
|
73
69
|
});
|
|
74
70
|
|
|
71
|
+
const classes = computed(() => {
|
|
72
|
+
const base = 'inline-flex items-center rounded leading-tight';
|
|
73
|
+
const size = {
|
|
74
|
+
sm: 'px-1.5 py-px text-[10px]',
|
|
75
|
+
md: 'px-1.5 py-0.5 text-xs',
|
|
76
|
+
lg: 'px-1.5 py-0.5 text-sm',
|
|
77
|
+
}[sizeInternal.value];
|
|
78
|
+
const wrap = props.wrap ? 'whitespace-nowrap' : '';
|
|
79
|
+
|
|
80
|
+
return twMerge(base, wrap, size, props.class);
|
|
81
|
+
})
|
|
82
|
+
|
|
75
83
|
const iconSizeClasses = computed(() => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
return 'h-3 w-3 mr-1 -ml-0.5';
|
|
84
|
+
|
|
85
|
+
const size = {
|
|
86
|
+
sm: 'h-2.5 w-2.5 mr-1',
|
|
87
|
+
md: 'h-3 w-3 mr-1',
|
|
88
|
+
lg: 'h-4 w-4 mr-1',
|
|
89
|
+
}[sizeInternal.value];
|
|
90
|
+
|
|
91
|
+
return size;
|
|
86
92
|
});
|
|
87
93
|
</script>
|
package/src/utils/colors.ts
CHANGED
|
@@ -44,7 +44,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
44
44
|
red: {
|
|
45
45
|
low: {
|
|
46
46
|
backgroundColor: colors.red[100],
|
|
47
|
-
textColor: colors.red[
|
|
47
|
+
textColor: colors.red[800],
|
|
48
48
|
borderColor: colors.red[300],
|
|
49
49
|
},
|
|
50
50
|
high: {
|
|
@@ -56,7 +56,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
56
56
|
orange: {
|
|
57
57
|
low: {
|
|
58
58
|
backgroundColor: colors.orange[100],
|
|
59
|
-
textColor: colors.orange[
|
|
59
|
+
textColor: colors.orange[800],
|
|
60
60
|
borderColor: colors.orange[300],
|
|
61
61
|
},
|
|
62
62
|
high: {
|
|
@@ -68,7 +68,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
68
68
|
yellow: {
|
|
69
69
|
low: {
|
|
70
70
|
backgroundColor: colors.yellow[100],
|
|
71
|
-
textColor: colors.yellow[
|
|
71
|
+
textColor: colors.yellow[800],
|
|
72
72
|
borderColor: colors.yellow[300],
|
|
73
73
|
},
|
|
74
74
|
high: {
|
|
@@ -80,7 +80,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
80
80
|
green: {
|
|
81
81
|
low: {
|
|
82
82
|
backgroundColor: colors.green[100],
|
|
83
|
-
textColor: colors.green[
|
|
83
|
+
textColor: colors.green[800],
|
|
84
84
|
borderColor: colors.green[300],
|
|
85
85
|
},
|
|
86
86
|
high: {
|
|
@@ -92,7 +92,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
92
92
|
teal: {
|
|
93
93
|
low: {
|
|
94
94
|
backgroundColor: colors.teal[100],
|
|
95
|
-
textColor: colors.teal[
|
|
95
|
+
textColor: colors.teal[800],
|
|
96
96
|
borderColor: colors.teal[300],
|
|
97
97
|
},
|
|
98
98
|
high: {
|
|
@@ -104,7 +104,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
104
104
|
cyan: {
|
|
105
105
|
low: {
|
|
106
106
|
backgroundColor: colors.cyan[100],
|
|
107
|
-
textColor: colors.cyan[
|
|
107
|
+
textColor: colors.cyan[800],
|
|
108
108
|
borderColor: colors.cyan[300],
|
|
109
109
|
},
|
|
110
110
|
high: {
|
|
@@ -116,7 +116,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
116
116
|
blue: {
|
|
117
117
|
low: {
|
|
118
118
|
backgroundColor: colors.blue[100],
|
|
119
|
-
textColor: colors.blue[
|
|
119
|
+
textColor: colors.blue[800],
|
|
120
120
|
borderColor: colors.blue[300],
|
|
121
121
|
},
|
|
122
122
|
high: {
|
|
@@ -128,7 +128,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
128
128
|
indigo: {
|
|
129
129
|
low: {
|
|
130
130
|
backgroundColor: colors.indigo[100],
|
|
131
|
-
textColor: colors.indigo[
|
|
131
|
+
textColor: colors.indigo[800],
|
|
132
132
|
borderColor: colors.indigo[300],
|
|
133
133
|
},
|
|
134
134
|
high: {
|
|
@@ -140,7 +140,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
140
140
|
purple: {
|
|
141
141
|
low: {
|
|
142
142
|
backgroundColor: colors.purple[100],
|
|
143
|
-
textColor: colors.purple[
|
|
143
|
+
textColor: colors.purple[800],
|
|
144
144
|
borderColor: colors.purple[300],
|
|
145
145
|
},
|
|
146
146
|
high: {
|
|
@@ -152,7 +152,7 @@ export const palette: Record<string, ColorPalette> = {
|
|
|
152
152
|
pink: {
|
|
153
153
|
low: {
|
|
154
154
|
backgroundColor: colors.pink[100],
|
|
155
|
-
textColor: colors.pink[
|
|
155
|
+
textColor: colors.pink[800],
|
|
156
156
|
borderColor: colors.pink[300],
|
|
157
157
|
},
|
|
158
158
|
high: {
|