mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-22 05:54:55 +00:00
* feat: Remove foundation * chore: Minor fix * Minor fix * Update _forms.scss * chore: More changes * chore: Minor fix * chore: Clean up * fix: font-weight * chore: More changes * chore: Setting page * chore: Editor fix * chore: Reports page * chore: More changes * chore: Minor changes * chore: More fixes * chore: More changes * chore: More changes * chore: More changes * chore: Minor fix * chore: More changes * chore: More changes * chore: More changes * chore: More changes * chore: Clean up * chore: Minor fix * chore: Clean ups * chore: Rename basic file * chore: Remove unused files * chore: Fix expanded input * Fix campaign rendering * chore: Clean up * chore: More changes * chore: Remove unused files * fix: Overflow issue * chore: Minor fix * chore: Clean up * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * fix: autoprefixer start/end value has mixed support * chore: Minor fix * chore: Remove unused files * chore: Minor fix * chore: Minor fix * chore: Minor fix * Add responsive design to label settings * fix inbox view * chore: Minor fix * w-60% to w-2/3 * chore: Fix team * chore: Fix button * w-[34%] to w-1/3 * chore: Fix border * Add support mobile views in team page * chore: fix snackbar * chore: clean up * chore: Clean up * fix: loading state alignment * fix: alert styles * chore: Minor fix * fix: spacing for agent bot row * fix: layout * fix: layout for SLA * fix: checkbox * fix: SLA checkbox spacing * Update inbox settings pages * fix macros listing page layout * fix canned responses * chore: Fix bot page * chore: fix automation page * chore: fix agents page * chore: fix canned response editor * chore: Fix settings table * chore: fix settings layout * chore: Minor fix * fix: canned response table layou * fix: layout for table header for webhooks * fix: webhook row layout * fix: dashboard app modal layout * fix: add title to canned response truncated shortcode * fix: dashboard apps row layuot * fix: layouts hooks * fix: body color * fix: delete action color in portal locales * fix: text color for campagin title * fix: success button color --------- Co-authored-by: Pranav <pranav@chatwoot.com> Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com> Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
208 lines
4.8 KiB
Vue
208 lines
4.8 KiB
Vue
<template>
|
|
<div
|
|
class="ltr:mr-1 rtl:ml-1 mb-1"
|
|
:class="labelClass"
|
|
:style="labelStyle"
|
|
:title="description"
|
|
>
|
|
<span v-if="icon" class="label-action--button">
|
|
<fluent-icon :icon="icon" size="12" class="label--icon cursor-pointer" />
|
|
</span>
|
|
<span
|
|
v-if="['smooth', 'dashed'].includes(variant) && title && !icon"
|
|
:style="{ background: color }"
|
|
class="label-color-dot flex-shrink-0"
|
|
/>
|
|
<span v-if="!href" class="whitespace-nowrap text-ellipsis overflow-hidden">
|
|
{{ title }}
|
|
</span>
|
|
<a v-else :href="href" :style="anchorStyle">{{ title }}</a>
|
|
<button
|
|
v-if="showClose"
|
|
class="label-close--button p-0"
|
|
:style="{ color: textColor }"
|
|
@click="onClick"
|
|
>
|
|
<fluent-icon icon="dismiss" size="12" class="close--icon" />
|
|
</button>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import { getContrastingTextColor } from '@chatwoot/utils';
|
|
|
|
export default {
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
description: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
href: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
bgColor: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
small: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
showClose: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
icon: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
color: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
colorScheme: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
variant: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
},
|
|
computed: {
|
|
textColor() {
|
|
if (this.variant === 'smooth') return '';
|
|
if (this.variant === 'dashed') return '';
|
|
return this.color || getContrastingTextColor(this.bgColor);
|
|
},
|
|
labelClass() {
|
|
return `label ${this.colorScheme} ${this.variant} ${
|
|
this.small ? 'small' : ''
|
|
}`;
|
|
},
|
|
labelStyle() {
|
|
if (this.bgColor) {
|
|
return {
|
|
background: this.bgColor,
|
|
color: this.textColor,
|
|
border: `1px solid ${this.bgColor}`,
|
|
};
|
|
}
|
|
return {};
|
|
},
|
|
anchorStyle() {
|
|
if (this.bgColor) {
|
|
return { color: this.textColor };
|
|
}
|
|
return {};
|
|
},
|
|
},
|
|
methods: {
|
|
onClick() {
|
|
this.$emit('click', this.title);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.label {
|
|
@apply inline-flex items-center font-medium text-xs rounded-[4px] gap-1 p-1 bg-slate-50 dark:bg-slate-700 text-slate-800 dark:text-slate-100 border border-solid border-slate-75 dark:border-slate-600 h-6;
|
|
|
|
&.small {
|
|
@apply text-xs py-0.5 px-1 leading-tight h-5;
|
|
}
|
|
|
|
&.small .label--icon,
|
|
&.small .close--icon {
|
|
@apply text-[0.5rem];
|
|
}
|
|
|
|
a {
|
|
@apply text-xs;
|
|
&:hover {
|
|
@apply underline;
|
|
}
|
|
}
|
|
|
|
/* Color Schemes */
|
|
&.primary {
|
|
@apply bg-woot-100 dark:bg-woot-100 text-woot-900 dark:text-woot-900 border border-solid border-woot-200;
|
|
|
|
a {
|
|
@apply text-woot-900 dark:text-woot-900;
|
|
}
|
|
.label-color-dot {
|
|
@apply bg-woot-600 dark:bg-woot-600;
|
|
}
|
|
}
|
|
&.secondary {
|
|
@apply bg-slate-100 dark:bg-slate-700 text-slate-900 dark:text-slate-100 border border-solid border-slate-200 dark:border-slate-600;
|
|
|
|
a {
|
|
@apply text-slate-900 dark:text-slate-100;
|
|
}
|
|
.label-color-dot {
|
|
@apply bg-slate-600 dark:bg-slate-600;
|
|
}
|
|
}
|
|
&.success {
|
|
@apply bg-green-100 dark:bg-green-700 text-green-900 dark:text-green-100 border border-solid border-green-200 dark:border-green-600;
|
|
|
|
a {
|
|
@apply text-green-900 dark:text-green-100;
|
|
}
|
|
.label-color-dot {
|
|
@apply bg-green-600 dark:bg-green-600;
|
|
}
|
|
}
|
|
&.alert {
|
|
@apply bg-red-100 dark:bg-red-700 text-red-900 dark:text-red-100 border border-solid border-red-200 dark:border-red-600;
|
|
|
|
a {
|
|
@apply text-red-900 dark:text-red-100;
|
|
}
|
|
.label-color-dot {
|
|
@apply bg-red-600 dark:bg-red-600;
|
|
}
|
|
}
|
|
&.warning {
|
|
@apply bg-yellow-100 dark:bg-yellow-700 text-yellow-900 dark:text-yellow-100 border border-solid border-yellow-200 dark:border-yellow-600;
|
|
|
|
a {
|
|
@apply text-yellow-900 dark:text-yellow-100;
|
|
}
|
|
.label-color-dot {
|
|
@apply bg-yellow-900 dark:bg-yellow-900;
|
|
}
|
|
}
|
|
|
|
&.smooth {
|
|
@apply bg-transparent text-slate-700 dark:text-slate-100 border border-solid border-slate-100 dark:border-slate-700;
|
|
}
|
|
|
|
&.dashed {
|
|
@apply bg-transparent text-slate-700 dark:text-slate-100 border border-dashed border-slate-100 dark:border-slate-700;
|
|
}
|
|
}
|
|
|
|
.label-close--button {
|
|
@apply text-slate-800 dark:text-slate-100 -mb-0.5 rounded-sm cursor-pointer flex items-center justify-center hover:bg-slate-100 dark:hover:bg-slate-700;
|
|
}
|
|
|
|
.label-action--button {
|
|
@apply flex mr-1;
|
|
}
|
|
|
|
.label-color-dot {
|
|
@apply inline-block w-3 h-3 rounded-sm shadow-sm;
|
|
}
|
|
.label.small .label-color-dot {
|
|
@apply w-2 h-2 rounded-sm shadow-sm;
|
|
}
|
|
</style>
|