Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

fix(message-input): tooltip should be displayed when character limit has been reached #1280

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const argsData = {
placeholder: 'New message',
inputAriaLabel: 'Input text field',
noticeMessage: 'Files must be less than 32 MB to be sent as Dialpad messages.',
characterLimitWarningMessage: 'You have reached the character limit.',
onSubmit: action('submit'),
onFocus: action('focus'),
onBlur: action('blur'),
Expand Down
29 changes: 24 additions & 5 deletions recipes/conversation_view/message_input/message_input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,24 @@
<!-- Right content -->
<div class="d-d-flex">
<!-- Optionally displayed remaining character counter -->
<p
<dt-tooltip
v-if="displayCharacterLimitWarning"
class="d-fc-error d-mr16 d-as-center dt-message-input--remaining-char"
data-qa="dt-message-input-character-limit"
:enabled="characterLimitWarningMessage && (characterLimitCount - inputLength < 0)"
placement="top-end"
:message="characterLimitWarningMessage"
:offset="[10, -8]"
>
{{ characterLimitCount - inputLength }}
</p>
<template #anchor>
<p
v-if="displayCharacterLimitWarning"
class="d-fc-error d-mr16 d-as-center dt-message-input--remaining-char"
data-qa="dt-message-input-character-limit"
>
{{ characterLimitCount - inputLength }}
</p>
</template>
</dt-tooltip>

<dt-tooltip
placement="top-end"
:message="sendTooltipLabel"
Expand Down Expand Up @@ -363,6 +374,14 @@ export default {
default: 500,
},

/**
* Character limit warning message
*/
characterLimitWarningMessage: {
type: String,
default: '',
},

// Error related props

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:has-character-limit="$attrs.hasCharacterLimit"
:character-limit-count="$attrs.characterLimitCount"
:character-limit-warning="$attrs.characterLimitWarning"
:character-limit-warning-message="$attrs.characterLimitWarningMessage"
:notice-kind="$attrs.noticeKind"
:notice-message="$attrs.noticeMessage"
:emoji-tab-set-labels="$attrs.emojiTabSetLabels"
Expand Down
Loading