From 202fef634dbd5e01da98c75356f7d8c918e1503e Mon Sep 17 00:00:00 2001 From: petar-basic Date: Wed, 13 Nov 2024 16:56:09 +0100 Subject: [PATCH 1/2] Added shadow part for non parsed text, overflow ellipsis for text in button (quick reply) --- packages/ui/src/components/quick-reply/quick-reply.scss | 9 +++++++++ packages/ui/src/components/quick-reply/quick-reply.tsx | 2 +- packages/ui/src/components/text/readme.md | 7 +++++++ packages/ui/src/components/text/text.tsx | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/components/quick-reply/quick-reply.scss b/packages/ui/src/components/quick-reply/quick-reply.scss index 2f90389..9b2acde 100644 --- a/packages/ui/src/components/quick-reply/quick-reply.scss +++ b/packages/ui/src/components/quick-reply/quick-reply.scss @@ -19,6 +19,15 @@ flex-wrap: wrap; padding: 0 40px; + rasa-text::part(text) { + width: calc(100%); + max-width: 250px; + text-overflow: ellipsis; + display: inline-block; + white-space: nowrap; + overflow: hidden; + } + &--disabled { pointer-events: none; opacity: 0.5; diff --git a/packages/ui/src/components/quick-reply/quick-reply.tsx b/packages/ui/src/components/quick-reply/quick-reply.tsx index 5feb02c..8a34a5e 100644 --- a/packages/ui/src/components/quick-reply/quick-reply.tsx +++ b/packages/ui/src/components/quick-reply/quick-reply.tsx @@ -94,7 +94,7 @@ export class RasaQuickReply { {canShowText && this.quickReplyMessage.replies.length && (
{this.quickReplyMessage.replies.map((button, key) => ( - + ))} diff --git a/packages/ui/src/components/text/readme.md b/packages/ui/src/components/text/readme.md index 893f43f..b7dd6a5 100644 --- a/packages/ui/src/components/text/readme.md +++ b/packages/ui/src/components/text/readme.md @@ -23,6 +23,13 @@ | `textStreamComplete` | Trigger on stream complete | `CustomEvent<{ value: true; }>` | +## Shadow Parts + +| Part | Description | +| -------- | ----------- | +| `"text"` | | + + ## Dependencies ### Used by diff --git a/packages/ui/src/components/text/text.tsx b/packages/ui/src/components/text/text.tsx index 6380f03..f54a161 100644 --- a/packages/ui/src/components/text/text.tsx +++ b/packages/ui/src/components/text/text.tsx @@ -142,7 +142,7 @@ export class RasaText { if (this.disableParsing) { return ( - {this.value} + {this.value} ); } From 9311420d0cc90f8f55b4bb483d412b85e014b40e Mon Sep 17 00:00:00 2001 From: petar-basic Date: Wed, 13 Nov 2024 17:04:17 +0100 Subject: [PATCH 2/2] Updated tests --- packages/ui/src/components/text-message/text-message.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/components/text-message/text-message.test.tsx b/packages/ui/src/components/text-message/text-message.test.tsx index 2e1ca95..4c5f13c 100644 --- a/packages/ui/src/components/text-message/text-message.test.tsx +++ b/packages/ui/src/components/text-message/text-message.test.tsx @@ -14,7 +14,7 @@ describe('rasa-text-message', () => { - + Hello, World! @@ -56,7 +56,7 @@ describe('rasa-text-message', () => { - + User message