sprintify-ui 0.0.150 → 0.0.152
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/dist/sprintify-ui.es.js +7649 -6964
- package/dist/types/src/components/BaseBadge.vue.d.ts +5 -5
- package/dist/types/src/components/BaseIconPicker.vue.d.ts +5 -0
- package/dist/types/src/components/BaseShortcut.vue.d.ts +3 -3
- package/dist/types/src/index.d.ts +4 -0
- package/dist/types/src/utils/colors.d.ts +13 -0
- package/package.json +2 -1
- package/src/components/BaseBadge.stories.js +3 -13
- package/src/components/BaseBadge.vue +9 -89
- package/src/components/BaseColor.stories.js +1 -5
- package/src/components/BaseColor.vue +17 -15
- package/src/components/BaseIconPicker.vue +47 -13
- package/src/components/BaseShortcut.stories.js +2 -11
- package/src/components/BaseShortcut.vue +11 -68
- package/src/lang/en.json +1 -0
- package/src/lang/fr.json +1 -0
- package/src/utils/colors.ts +200 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
2
|
contrast: 'low' | 'high';
|
|
3
|
-
color:
|
|
4
|
-
size
|
|
3
|
+
color: string;
|
|
4
|
+
size?: "base" | "sm" | "lg" | undefined;
|
|
5
5
|
icon?: string | undefined;
|
|
6
6
|
}>, {
|
|
7
7
|
contrast: string;
|
|
@@ -10,8 +10,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
10
10
|
icon: undefined;
|
|
11
11
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
12
12
|
contrast: 'low' | 'high';
|
|
13
|
-
color:
|
|
14
|
-
size
|
|
13
|
+
color: string;
|
|
14
|
+
size?: "base" | "sm" | "lg" | undefined;
|
|
15
15
|
icon?: string | undefined;
|
|
16
16
|
}>, {
|
|
17
17
|
contrast: string;
|
|
@@ -19,7 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
19
19
|
size: string;
|
|
20
20
|
icon: undefined;
|
|
21
21
|
}>>>, {
|
|
22
|
-
color:
|
|
22
|
+
color: string;
|
|
23
23
|
icon: string;
|
|
24
24
|
size: 'sm' | 'base' | 'lg';
|
|
25
25
|
contrast: 'low' | 'high';
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
2
|
modelValue?: string | null | undefined;
|
|
3
3
|
collection?: string | undefined;
|
|
4
|
+
maxWidth?: string | undefined;
|
|
4
5
|
}>, {
|
|
5
6
|
modelValue: null;
|
|
6
7
|
collection: string;
|
|
8
|
+
maxWidth: string;
|
|
7
9
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
8
10
|
modelValue?: string | null | undefined;
|
|
9
11
|
collection?: string | undefined;
|
|
12
|
+
maxWidth?: string | undefined;
|
|
10
13
|
}>, {
|
|
11
14
|
modelValue: null;
|
|
12
15
|
collection: string;
|
|
16
|
+
maxWidth: string;
|
|
13
17
|
}>>> & {
|
|
14
18
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
15
19
|
}, {
|
|
16
20
|
modelValue: string | null;
|
|
21
|
+
maxWidth: string;
|
|
17
22
|
collection: string;
|
|
18
23
|
}>;
|
|
19
24
|
export default _default;
|
|
@@ -19,7 +19,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
19
19
|
};
|
|
20
20
|
color: {
|
|
21
21
|
default: string;
|
|
22
|
-
type: PropType<
|
|
22
|
+
type: PropType<string>;
|
|
23
23
|
};
|
|
24
24
|
icon: {
|
|
25
25
|
required: true;
|
|
@@ -48,7 +48,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
48
48
|
};
|
|
49
49
|
color: {
|
|
50
50
|
default: string;
|
|
51
|
-
type: PropType<
|
|
51
|
+
type: PropType<string>;
|
|
52
52
|
};
|
|
53
53
|
icon: {
|
|
54
54
|
required: true;
|
|
@@ -59,7 +59,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
59
|
type: PropType<"high" | "low">;
|
|
60
60
|
};
|
|
61
61
|
}>>, {
|
|
62
|
-
color:
|
|
62
|
+
color: string;
|
|
63
63
|
description: string;
|
|
64
64
|
contrast: "high" | "low";
|
|
65
65
|
linkText: string;
|
|
@@ -49,6 +49,7 @@ declare const messages: {
|
|
|
49
49
|
remove: string;
|
|
50
50
|
remove_file: string;
|
|
51
51
|
remove_file_description: string;
|
|
52
|
+
search: string;
|
|
52
53
|
see_all_notifications: string;
|
|
53
54
|
select_an_item: string;
|
|
54
55
|
select_an_option: string;
|
|
@@ -116,6 +117,7 @@ declare const messages: {
|
|
|
116
117
|
remove: string;
|
|
117
118
|
remove_file: string;
|
|
118
119
|
remove_file_description: string;
|
|
120
|
+
search: string;
|
|
119
121
|
see_all_notifications: string;
|
|
120
122
|
select_an_item: string;
|
|
121
123
|
select_an_option: string;
|
|
@@ -196,6 +198,7 @@ declare const config: {
|
|
|
196
198
|
remove: string;
|
|
197
199
|
remove_file: string;
|
|
198
200
|
remove_file_description: string;
|
|
201
|
+
search: string;
|
|
199
202
|
see_all_notifications: string;
|
|
200
203
|
select_an_item: string;
|
|
201
204
|
select_an_option: string;
|
|
@@ -263,6 +266,7 @@ declare const config: {
|
|
|
263
266
|
remove: string;
|
|
264
267
|
remove_file: string;
|
|
265
268
|
remove_file_description: string;
|
|
269
|
+
search: string;
|
|
266
270
|
see_all_notifications: string;
|
|
267
271
|
select_an_item: string;
|
|
268
272
|
select_an_option: string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const colors: import("tailwindcss/types/generated/colors").DefaultColors;
|
|
2
|
+
export { colors };
|
|
3
|
+
interface ColorConfig {
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
textColor: string;
|
|
6
|
+
borderColor: string;
|
|
7
|
+
}
|
|
8
|
+
interface ColorPalette {
|
|
9
|
+
low: ColorConfig;
|
|
10
|
+
high: ColorConfig;
|
|
11
|
+
}
|
|
12
|
+
export declare const palette: Record<string, ColorPalette>;
|
|
13
|
+
export declare function getColorConfig(color: string, contrast?: boolean): ColorConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprintify-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.152",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rimraf dist && vue-tsc && vite build",
|
|
6
6
|
"build-fast": "rimraf dist && vite build",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@headlessui/vue": "^1.7.4",
|
|
38
|
+
"color2k": "^2.0.1",
|
|
38
39
|
"storybook": "^6.5.15"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import BaseBadge from './BaseBadge.vue';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'orange',
|
|
7
|
-
'yellow',
|
|
8
|
-
'green',
|
|
9
|
-
'blue',
|
|
10
|
-
'indigo',
|
|
11
|
-
'purple',
|
|
12
|
-
'pink',
|
|
13
|
-
'#ff0000',
|
|
14
|
-
'#dbeafe',
|
|
15
|
-
];
|
|
3
|
+
import { palette } from '@/utils/colors';
|
|
4
|
+
|
|
5
|
+
const colors = [...Object.keys(palette), '#ff0000', '#dbeafe'];
|
|
16
6
|
|
|
17
7
|
const sizes = ['sm', 'base', 'lg'];
|
|
18
8
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span
|
|
3
3
|
class="inline-flex items-center rounded-full font-medium"
|
|
4
|
-
:class="[
|
|
4
|
+
:class="[sizeClasses]"
|
|
5
5
|
:style="colorStyle"
|
|
6
6
|
>
|
|
7
7
|
<BaseIcon v-if="icon" :icon="icon" :class="iconSizeClasses"> </BaseIcon>
|
|
@@ -10,23 +10,14 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
|
+
import { getColorConfig } from '@/utils/colors';
|
|
13
14
|
import { BaseIcon } from '.';
|
|
14
15
|
|
|
15
16
|
const props = withDefaults(
|
|
16
17
|
defineProps<{
|
|
17
18
|
contrast: 'low' | 'high';
|
|
18
|
-
color:
|
|
19
|
-
|
|
20
|
-
| 'red'
|
|
21
|
-
| 'orange'
|
|
22
|
-
| 'yellow'
|
|
23
|
-
| 'green'
|
|
24
|
-
| 'blue'
|
|
25
|
-
| 'indigo'
|
|
26
|
-
| 'purple'
|
|
27
|
-
| 'pink'
|
|
28
|
-
| string;
|
|
29
|
-
size: 'sm' | 'base' | 'lg';
|
|
19
|
+
color: string;
|
|
20
|
+
size?: 'sm' | 'base' | 'lg';
|
|
30
21
|
icon?: string;
|
|
31
22
|
}>(),
|
|
32
23
|
{
|
|
@@ -37,84 +28,13 @@ const props = withDefaults(
|
|
|
37
28
|
}
|
|
38
29
|
);
|
|
39
30
|
|
|
40
|
-
const colorClasses = computed(() => {
|
|
41
|
-
if (props.color == 'gray') {
|
|
42
|
-
if (props.contrast == 'high') {
|
|
43
|
-
return 'bg-slate-600 text-white';
|
|
44
|
-
}
|
|
45
|
-
return 'bg-slate-100 text-slate-800';
|
|
46
|
-
}
|
|
47
|
-
if (props.color == 'red') {
|
|
48
|
-
if (props.contrast == 'high') {
|
|
49
|
-
return 'bg-red-600 text-white';
|
|
50
|
-
}
|
|
51
|
-
return 'bg-red-100 text-red-900';
|
|
52
|
-
}
|
|
53
|
-
if (props.color == 'orange') {
|
|
54
|
-
if (props.contrast == 'high') {
|
|
55
|
-
return 'bg-orange-500 text-white';
|
|
56
|
-
}
|
|
57
|
-
return 'bg-orange-100 text-yellow-900';
|
|
58
|
-
}
|
|
59
|
-
if (props.color == 'yellow') {
|
|
60
|
-
if (props.contrast == 'high') {
|
|
61
|
-
return 'bg-yellow-500 text-white';
|
|
62
|
-
}
|
|
63
|
-
return 'bg-yellow-100 text-yellow-900';
|
|
64
|
-
}
|
|
65
|
-
if (props.color == 'green') {
|
|
66
|
-
if (props.contrast == 'high') {
|
|
67
|
-
return 'bg-green-600 text-white';
|
|
68
|
-
}
|
|
69
|
-
return 'bg-green-100 text-green-900';
|
|
70
|
-
}
|
|
71
|
-
if (props.color == 'blue') {
|
|
72
|
-
if (props.contrast == 'high') {
|
|
73
|
-
return 'bg-blue-600 text-white';
|
|
74
|
-
}
|
|
75
|
-
return 'bg-blue-100 text-blue-900';
|
|
76
|
-
}
|
|
77
|
-
if (props.color == 'indigo') {
|
|
78
|
-
if (props.contrast == 'high') {
|
|
79
|
-
return 'bg-indigo-600 text-white';
|
|
80
|
-
}
|
|
81
|
-
return 'bg-indigo-100 text-indigo-900';
|
|
82
|
-
}
|
|
83
|
-
if (props.color == 'purple') {
|
|
84
|
-
if (props.contrast == 'high') {
|
|
85
|
-
return 'bg-purple-600 text-white';
|
|
86
|
-
}
|
|
87
|
-
return 'bg-purple-100 text-purple-900';
|
|
88
|
-
}
|
|
89
|
-
if (props.color == 'pink') {
|
|
90
|
-
if (props.contrast == 'high') {
|
|
91
|
-
return 'bg-pink-600 text-white';
|
|
92
|
-
}
|
|
93
|
-
return 'bg-pink-100 text-pink-900';
|
|
94
|
-
}
|
|
95
|
-
if (!props.color) {
|
|
96
|
-
return 'bg-slate-100 text-slate-900';
|
|
97
|
-
}
|
|
98
|
-
return '';
|
|
99
|
-
});
|
|
100
|
-
|
|
101
31
|
const colorStyle = computed((): Record<string, string> => {
|
|
102
|
-
|
|
103
|
-
props.color &&
|
|
104
|
-
(props.color.startsWith('#') || props.color.startsWith('rgb'))
|
|
105
|
-
) {
|
|
106
|
-
let textColor = 'white';
|
|
107
|
-
|
|
108
|
-
if (props.contrast == 'low') {
|
|
109
|
-
textColor = 'rgba(0,0,0,0.8)';
|
|
110
|
-
}
|
|
32
|
+
const config = getColorConfig(props.color, props.contrast == 'high');
|
|
111
33
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
return {};
|
|
34
|
+
return {
|
|
35
|
+
backgroundColor: config.backgroundColor,
|
|
36
|
+
color: config.textColor,
|
|
37
|
+
};
|
|
118
38
|
});
|
|
119
39
|
|
|
120
40
|
const sizeClasses = computed(() => {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { createFieldStory
|
|
1
|
+
import { createFieldStory } from '../../.storybook/utils';
|
|
2
2
|
import BaseColor from './BaseColor.vue';
|
|
3
3
|
import ShowValue from '../../.storybook/components/ShowValue.vue';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Form/BaseColor',
|
|
7
7
|
component: BaseColor,
|
|
8
|
-
argTypes: {},
|
|
9
|
-
args: {
|
|
10
|
-
colors: colors,
|
|
11
|
-
},
|
|
12
8
|
decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
|
|
13
9
|
};
|
|
14
10
|
|
|
@@ -17,10 +17,17 @@
|
|
|
17
17
|
<template #option="option">
|
|
18
18
|
<div
|
|
19
19
|
:style="{ backgroundColor: option.option.value + '' }"
|
|
20
|
-
class="rounded-md border
|
|
20
|
+
class="box-border rounded-md border p-3"
|
|
21
21
|
:class="[
|
|
22
|
-
option.selected.value
|
|
22
|
+
option.selected.value
|
|
23
|
+
? option.option.option.hasLowContrast
|
|
24
|
+
? 'text-slate-700'
|
|
25
|
+
: 'text-white'
|
|
26
|
+
: 'text-transparent',
|
|
23
27
|
disabled ? ' cursor-not-allowed opacity-50' : '',
|
|
28
|
+
option.option.option.hasLowContrast
|
|
29
|
+
? 'border-slate-400'
|
|
30
|
+
: 'border-transparent',
|
|
24
31
|
]"
|
|
25
32
|
>
|
|
26
33
|
<BaseIcon icon="heroicons-solid:check-circle" class="h-5 w-5" />
|
|
@@ -36,6 +43,8 @@ import { BaseButtonGroup } from '.';
|
|
|
36
43
|
import { isArray } from 'lodash';
|
|
37
44
|
import { useField } from '@/composables/field';
|
|
38
45
|
import { Option } from '@/types';
|
|
46
|
+
import { palette } from '@/utils/colors';
|
|
47
|
+
import { getContrast } from 'color2k';
|
|
39
48
|
|
|
40
49
|
const props = defineProps({
|
|
41
50
|
modelValue: {
|
|
@@ -59,19 +68,7 @@ const props = defineProps({
|
|
|
59
68
|
colors: {
|
|
60
69
|
type: [Array] as PropType<string[]>,
|
|
61
70
|
default() {
|
|
62
|
-
return
|
|
63
|
-
'#0f172a',
|
|
64
|
-
'#dc2626',
|
|
65
|
-
'#ea580c',
|
|
66
|
-
'#eab308',
|
|
67
|
-
'#16a34a',
|
|
68
|
-
'#0d9488',
|
|
69
|
-
'#0891b2',
|
|
70
|
-
'#2563eb',
|
|
71
|
-
'#4f46e5',
|
|
72
|
-
'#9333ea',
|
|
73
|
-
'#db2777',
|
|
74
|
-
];
|
|
71
|
+
return Object.values(palette).map((p) => p.high.backgroundColor);
|
|
75
72
|
},
|
|
76
73
|
},
|
|
77
74
|
multiple: {
|
|
@@ -95,10 +92,15 @@ const colorOptions = computed(() => {
|
|
|
95
92
|
return {
|
|
96
93
|
label: c,
|
|
97
94
|
value: c,
|
|
95
|
+
hasLowContrast: hasLowContrast(c),
|
|
98
96
|
};
|
|
99
97
|
});
|
|
100
98
|
});
|
|
101
99
|
|
|
100
|
+
function hasLowContrast(color: string): boolean {
|
|
101
|
+
return getContrast(color, '#fff') < 1.38;
|
|
102
|
+
}
|
|
103
|
+
|
|
102
104
|
const normalizeModelValue = computed(() => {
|
|
103
105
|
return isArray(props.modelValue)
|
|
104
106
|
? props.modelValue?.map((m) => {
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="w-full overflow-hidden rounded border bg-white"
|
|
4
|
+
:style="{
|
|
5
|
+
maxWidth: maxWidth,
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
8
|
+
<div class="flex w-full min-w-0 overflow-hidden px-2 py-2">
|
|
4
9
|
<select
|
|
5
10
|
v-model="suffix"
|
|
6
|
-
class="max-w-[
|
|
11
|
+
class="max-w-[150px] shrink-0 rounded-l border-r-0 border-slate-300 py-1.5 pl-2 pr-6 focus:border-slate-300 focus:outline-none focus:ring-0 sm:text-sm"
|
|
12
|
+
@change="onSuffixChange"
|
|
7
13
|
>
|
|
8
14
|
<option v-for="(label, key) in suffixes" :key="key" :value="key">
|
|
9
15
|
{{ label }}
|
|
@@ -13,12 +19,12 @@
|
|
|
13
19
|
<input
|
|
14
20
|
v-model="keywords"
|
|
15
21
|
type="text"
|
|
16
|
-
:placeholder="$t('sui.
|
|
17
|
-
class="grow rounded-r border-slate-300 text-
|
|
22
|
+
:placeholder="$t('sui.search') + '...'"
|
|
23
|
+
class="min-w-[40px] grow rounded-r border-slate-300 py-0 px-2 focus:border-blue-500 focus:ring-2 focus:ring-blue-300 sm:text-sm"
|
|
18
24
|
/>
|
|
19
25
|
</div>
|
|
20
26
|
|
|
21
|
-
<div ref="drawer" class="h-44 overflow-y-auto
|
|
27
|
+
<div ref="drawer" class="h-44 overflow-y-auto px-2 pb-2">
|
|
22
28
|
<ul class="flex flex-wrap">
|
|
23
29
|
<li v-for="icon in filteredIcons" :key="icon">
|
|
24
30
|
<button
|
|
@@ -27,7 +33,7 @@
|
|
|
27
33
|
:class="[
|
|
28
34
|
modelValue == icon
|
|
29
35
|
? 'bg-primary-600 text-white'
|
|
30
|
-
: 'bg-white text-slate-
|
|
36
|
+
: 'bg-white text-slate-800 hover:bg-slate-200',
|
|
31
37
|
]"
|
|
32
38
|
class="flex items-center justify-center rounded p-1"
|
|
33
39
|
@click="onClick(icon)"
|
|
@@ -47,10 +53,12 @@ const props = withDefaults(
|
|
|
47
53
|
defineProps<{
|
|
48
54
|
modelValue?: string | null;
|
|
49
55
|
collection?: string;
|
|
56
|
+
maxWidth?: string;
|
|
50
57
|
}>(),
|
|
51
58
|
{
|
|
52
59
|
modelValue: null,
|
|
53
60
|
collection: 'heroicons',
|
|
61
|
+
maxWidth: '300px',
|
|
54
62
|
}
|
|
55
63
|
);
|
|
56
64
|
|
|
@@ -62,6 +70,11 @@ function onClick(icon: string) {
|
|
|
62
70
|
|
|
63
71
|
const icons = ref<string[]>([]);
|
|
64
72
|
const suffixes = ref<Record<string, string>>({});
|
|
73
|
+
const orderedSuffixKeys = computed(() => {
|
|
74
|
+
return Object.keys(suffixes.value).sort((a, b) => {
|
|
75
|
+
return b.length - a.length;
|
|
76
|
+
});
|
|
77
|
+
});
|
|
65
78
|
const suffix = ref<string | null>(null);
|
|
66
79
|
const otherSuffixValue = computed(() => {
|
|
67
80
|
return Object.keys(suffixes.value).filter((s) => {
|
|
@@ -139,12 +152,8 @@ function selectCurrentSuffix() {
|
|
|
139
152
|
return;
|
|
140
153
|
}
|
|
141
154
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
for (let i = 0; i < suffixesOrderedByLength.length; i++) {
|
|
147
|
-
const s = suffixesOrderedByLength[i];
|
|
155
|
+
for (let i = 0; i < orderedSuffixKeys.value.length; i++) {
|
|
156
|
+
const s = orderedSuffixKeys.value[i];
|
|
148
157
|
|
|
149
158
|
if (props.modelValue.endsWith(s)) {
|
|
150
159
|
suffix.value = s;
|
|
@@ -174,6 +183,31 @@ function scrollToIcon() {
|
|
|
174
183
|
drawer.value.scrollTop = icon.offsetTop - 10;
|
|
175
184
|
}
|
|
176
185
|
|
|
186
|
+
function onSuffixChange() {
|
|
187
|
+
nextTick(() => {
|
|
188
|
+
let iconWithoutSuffix = props.modelValue ?? '';
|
|
189
|
+
|
|
190
|
+
orderedSuffixKeys.value.forEach((s) => {
|
|
191
|
+
let completeSuffix = s;
|
|
192
|
+
|
|
193
|
+
if (completeSuffix != '') {
|
|
194
|
+
completeSuffix = '-' + completeSuffix;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const regex = new RegExp(completeSuffix + '$');
|
|
198
|
+
|
|
199
|
+
iconWithoutSuffix = iconWithoutSuffix.replace(regex, '');
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
let suffixToAdd = suffix.value;
|
|
203
|
+
if (suffixToAdd != '') {
|
|
204
|
+
suffixToAdd = '-' + suffixToAdd;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
emit('update:modelValue', iconWithoutSuffix + suffixToAdd);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
177
211
|
onMounted(() => {
|
|
178
212
|
fetchIcons();
|
|
179
213
|
});
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import BaseShortcut from './BaseShortcut.vue';
|
|
2
|
+
import { palette } from '@/utils/colors';
|
|
2
3
|
|
|
3
|
-
const colors = [
|
|
4
|
-
'gray',
|
|
5
|
-
'red',
|
|
6
|
-
'orange',
|
|
7
|
-
'yellow',
|
|
8
|
-
'green',
|
|
9
|
-
'blue',
|
|
10
|
-
'indigo',
|
|
11
|
-
'purple',
|
|
12
|
-
'pink',
|
|
13
|
-
];
|
|
4
|
+
const colors = [...Object.keys(palette), '#ff0000', '#dbeafe'];
|
|
14
5
|
|
|
15
6
|
const sizes = ['base', 'lg'];
|
|
16
7
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<!-- Icon -->
|
|
6
6
|
<div
|
|
7
7
|
class="mb-2.5 inline-flex items-center rounded p-2"
|
|
8
|
-
:
|
|
8
|
+
:style="colorStyle"
|
|
9
9
|
>
|
|
10
10
|
<BaseIcon
|
|
11
11
|
v-if="icon"
|
|
@@ -47,6 +47,7 @@ import { PropType } from 'vue';
|
|
|
47
47
|
import { BaseIcon } from '.';
|
|
48
48
|
import BaseCard from './BaseCard.vue';
|
|
49
49
|
import { RouteLocationRaw } from 'vue-router';
|
|
50
|
+
import { getColorConfig } from '@/utils/colors';
|
|
50
51
|
|
|
51
52
|
const props = defineProps({
|
|
52
53
|
to: {
|
|
@@ -67,17 +68,7 @@ const props = defineProps({
|
|
|
67
68
|
},
|
|
68
69
|
color: {
|
|
69
70
|
default: 'gray',
|
|
70
|
-
type: String as PropType<
|
|
71
|
-
| 'gray'
|
|
72
|
-
| 'red'
|
|
73
|
-
| 'orange'
|
|
74
|
-
| 'yellow'
|
|
75
|
-
| 'green'
|
|
76
|
-
| 'blue'
|
|
77
|
-
| 'indigo'
|
|
78
|
-
| 'purple'
|
|
79
|
-
| 'pink'
|
|
80
|
-
>,
|
|
71
|
+
type: String as PropType<string>,
|
|
81
72
|
},
|
|
82
73
|
icon: {
|
|
83
74
|
required: true,
|
|
@@ -89,62 +80,14 @@ const props = defineProps({
|
|
|
89
80
|
},
|
|
90
81
|
});
|
|
91
82
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (props.contrast == 'high') {
|
|
101
|
-
return 'bg-red-600 text-white';
|
|
102
|
-
}
|
|
103
|
-
return 'bg-red-100 text-red-700 border border-red-300';
|
|
104
|
-
}
|
|
105
|
-
if (props.color == 'orange') {
|
|
106
|
-
if (props.contrast == 'high') {
|
|
107
|
-
return 'bg-orange-500 text-white';
|
|
108
|
-
}
|
|
109
|
-
return 'bg-orange-100 text-yellow-700 border border-orange-300';
|
|
110
|
-
}
|
|
111
|
-
if (props.color == 'yellow') {
|
|
112
|
-
if (props.contrast == 'high') {
|
|
113
|
-
return 'bg-yellow-500 text-white';
|
|
114
|
-
}
|
|
115
|
-
return 'bg-yellow-100 text-yellow-700 border border-yellow-300';
|
|
116
|
-
}
|
|
117
|
-
if (props.color == 'green') {
|
|
118
|
-
if (props.contrast == 'high') {
|
|
119
|
-
return 'bg-green-600 text-white';
|
|
120
|
-
}
|
|
121
|
-
return 'bg-green-100 text-green-700 border border-green-300';
|
|
122
|
-
}
|
|
123
|
-
if (props.color == 'blue') {
|
|
124
|
-
if (props.contrast == 'high') {
|
|
125
|
-
return 'bg-blue-600 text-white';
|
|
126
|
-
}
|
|
127
|
-
return 'bg-blue-100 text-blue-700 border border-blue-300';
|
|
128
|
-
}
|
|
129
|
-
if (props.color == 'indigo') {
|
|
130
|
-
if (props.contrast == 'high') {
|
|
131
|
-
return 'bg-indigo-600 text-white';
|
|
132
|
-
}
|
|
133
|
-
return 'bg-indigo-100 text-indigo-700 border border-indigo-300';
|
|
134
|
-
}
|
|
135
|
-
if (props.color == 'purple') {
|
|
136
|
-
if (props.contrast == 'high') {
|
|
137
|
-
return 'bg-purple-600 text-white';
|
|
138
|
-
}
|
|
139
|
-
return 'bg-purple-100 text-purple-700 border border-purple-300';
|
|
140
|
-
}
|
|
141
|
-
if (props.color == 'pink') {
|
|
142
|
-
if (props.contrast == 'high') {
|
|
143
|
-
return 'bg-pink-600 text-white';
|
|
144
|
-
}
|
|
145
|
-
return 'bg-pink-100 text-pink-700 border border-pink-300';
|
|
146
|
-
}
|
|
147
|
-
return 'bg-slate-100 text-slate-700 border border-slate-300';
|
|
83
|
+
const colorStyle = computed((): Record<string, string> => {
|
|
84
|
+
const config = getColorConfig(props.color, props.contrast == 'high');
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
backgroundColor: config.backgroundColor,
|
|
88
|
+
border: `1px solid ${config.borderColor}`,
|
|
89
|
+
color: config.textColor,
|
|
90
|
+
};
|
|
148
91
|
});
|
|
149
92
|
|
|
150
93
|
const iconSizeClasses = computed(() => {
|
package/src/lang/en.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"remove": "Remove",
|
|
41
41
|
"remove_file": "Remove file?",
|
|
42
42
|
"remove_file_description": "Are you sure you want to remove the file? This action is irreversible.",
|
|
43
|
+
"search": "Search",
|
|
43
44
|
"see_all_notifications": "See all notifications",
|
|
44
45
|
"select_an_item": "Select an item",
|
|
45
46
|
"select_an_option": "Select an option",
|
package/src/lang/fr.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"remove": "Retirer",
|
|
41
41
|
"remove_file": "Retirer le fichier?",
|
|
42
42
|
"remove_file_description": "Voulez-vous vraiment supprimer le fichier ? \nCette action est irréversible.",
|
|
43
|
+
"search": "Rechercher",
|
|
43
44
|
"see_all_notifications": "Voir toutes les notifications",
|
|
44
45
|
"select_an_item": "Sélectionner un élément",
|
|
45
46
|
"select_an_option": "Sélectionner une option",
|