@kubex/zinc 1.1.3 → 1.1.4
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/custom-elements.json +181 -16
- package/dist/vscode.html-custom-data.json +32 -3
- package/dist/web-types.json +68 -7
- package/dist/zn.d.ts +39 -6
- package/dist/zn.min.js +282 -272
- package/docs/pages/components/chat-message.md +56 -2
- package/package.json +1 -1
- package/src/components/alert/alert.component.ts +1 -0
- package/src/components/alert/alert.scss +8 -0
- package/src/components/chat-message/chat-message.component.ts +155 -21
- package/src/components/chat-message/chat-message.scss +148 -2
- package/src/components/chat-message/clean-message.ts +46 -0
|
@@ -178,6 +178,16 @@
|
|
|
178
178
|
"default": "false",
|
|
179
179
|
"attribute": "collapse"
|
|
180
180
|
},
|
|
181
|
+
{
|
|
182
|
+
"kind": "field",
|
|
183
|
+
"name": "appearance",
|
|
184
|
+
"type": {
|
|
185
|
+
"text": "'transparent' | 'solid'"
|
|
186
|
+
},
|
|
187
|
+
"default": "'transparent'",
|
|
188
|
+
"attribute": "appearance",
|
|
189
|
+
"reflects": true
|
|
190
|
+
},
|
|
181
191
|
{
|
|
182
192
|
"kind": "field",
|
|
183
193
|
"name": "level",
|
|
@@ -233,6 +243,14 @@
|
|
|
233
243
|
"default": "false",
|
|
234
244
|
"fieldName": "collapse"
|
|
235
245
|
},
|
|
246
|
+
{
|
|
247
|
+
"name": "appearance",
|
|
248
|
+
"type": {
|
|
249
|
+
"text": "'transparent' | 'solid'"
|
|
250
|
+
},
|
|
251
|
+
"default": "'transparent'",
|
|
252
|
+
"fieldName": "appearance"
|
|
253
|
+
},
|
|
236
254
|
{
|
|
237
255
|
"name": "level",
|
|
238
256
|
"type": {
|
|
@@ -2960,11 +2978,15 @@
|
|
|
2960
2978
|
{
|
|
2961
2979
|
"description": "The message content within the bubble.",
|
|
2962
2980
|
"name": "content"
|
|
2981
|
+
},
|
|
2982
|
+
{
|
|
2983
|
+
"description": "The card rendered for system action types.",
|
|
2984
|
+
"name": "system-card"
|
|
2963
2985
|
}
|
|
2964
2986
|
],
|
|
2965
2987
|
"slots": [
|
|
2966
2988
|
{
|
|
2967
|
-
"description": "The message content.",
|
|
2989
|
+
"description": "The message content. Ignored when the `message` attribute is set.",
|
|
2968
2990
|
"name": ""
|
|
2969
2991
|
},
|
|
2970
2992
|
{
|
|
@@ -2990,6 +3012,27 @@
|
|
|
2990
3012
|
"static": true,
|
|
2991
3013
|
"default": "{ 'zn-icon': ZnIcon }"
|
|
2992
3014
|
},
|
|
3015
|
+
{
|
|
3016
|
+
"kind": "field",
|
|
3017
|
+
"name": "SYSTEM_ACTION_TYPES",
|
|
3018
|
+
"type": {
|
|
3019
|
+
"text": "readonly string[]"
|
|
3020
|
+
},
|
|
3021
|
+
"static": true,
|
|
3022
|
+
"readonly": true,
|
|
3023
|
+
"default": "[ 'connected.agent', 'attachment.added', 'transfer', 'ended', 'customer.ended', 'customer.connected', 'customer.disconnected', ]"
|
|
3024
|
+
},
|
|
3025
|
+
{
|
|
3026
|
+
"kind": "field",
|
|
3027
|
+
"name": "DISPLAYED_ACTION_TYPES",
|
|
3028
|
+
"type": {
|
|
3029
|
+
"text": "readonly string[]"
|
|
3030
|
+
},
|
|
3031
|
+
"privacy": "private",
|
|
3032
|
+
"static": true,
|
|
3033
|
+
"readonly": true,
|
|
3034
|
+
"default": "[ '', 'connected.agent', 'attachment.added', 'multi.answer', 'transfer', 'ended', 'error', 'customer.ended', 'message-sending', 'customer.connected', 'customer.disconnected', 'internal', ]"
|
|
3035
|
+
},
|
|
2993
3036
|
{
|
|
2994
3037
|
"kind": "field",
|
|
2995
3038
|
"name": "sender",
|
|
@@ -2997,9 +3040,19 @@
|
|
|
2997
3040
|
"text": "string"
|
|
2998
3041
|
},
|
|
2999
3042
|
"default": "''",
|
|
3000
|
-
"description": "The sender's name, also used for the avatar
|
|
3043
|
+
"description": "The sender's name, also used for the avatar.",
|
|
3001
3044
|
"attribute": "sender"
|
|
3002
3045
|
},
|
|
3046
|
+
{
|
|
3047
|
+
"kind": "field",
|
|
3048
|
+
"name": "message",
|
|
3049
|
+
"type": {
|
|
3050
|
+
"text": "string"
|
|
3051
|
+
},
|
|
3052
|
+
"default": "''",
|
|
3053
|
+
"description": "The message body as an HTML string. When set, it is sanitized (scripts and event\nhandlers stripped), newlines become line breaks and bare URLs become links. When\nomitted the default slot is rendered instead.",
|
|
3054
|
+
"attribute": "message"
|
|
3055
|
+
},
|
|
3003
3056
|
{
|
|
3004
3057
|
"kind": "field",
|
|
3005
3058
|
"name": "time",
|
|
@@ -3007,21 +3060,88 @@
|
|
|
3007
3060
|
"text": "string"
|
|
3008
3061
|
},
|
|
3009
3062
|
"default": "''",
|
|
3010
|
-
"description": "Unix timestamp (seconds) of the message, shown as HH:MM.",
|
|
3063
|
+
"description": "Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today).",
|
|
3011
3064
|
"attribute": "time"
|
|
3012
3065
|
},
|
|
3066
|
+
{
|
|
3067
|
+
"kind": "field",
|
|
3068
|
+
"name": "avatar",
|
|
3069
|
+
"type": {
|
|
3070
|
+
"text": "string"
|
|
3071
|
+
},
|
|
3072
|
+
"default": "''",
|
|
3073
|
+
"description": "Overrides the avatar source. Defaults to `sender`.",
|
|
3074
|
+
"attribute": "avatar"
|
|
3075
|
+
},
|
|
3076
|
+
{
|
|
3077
|
+
"kind": "field",
|
|
3078
|
+
"name": "actionType",
|
|
3079
|
+
"type": {
|
|
3080
|
+
"text": "ChatMessageActionType"
|
|
3081
|
+
},
|
|
3082
|
+
"default": "''",
|
|
3083
|
+
"description": "The kind of message. Drives system-card rendering, the sending state and badges.",
|
|
3084
|
+
"attribute": "action-type",
|
|
3085
|
+
"reflects": true
|
|
3086
|
+
},
|
|
3087
|
+
{
|
|
3088
|
+
"kind": "field",
|
|
3089
|
+
"name": "customerInitiated",
|
|
3090
|
+
"type": {
|
|
3091
|
+
"text": "boolean"
|
|
3092
|
+
},
|
|
3093
|
+
"default": "false",
|
|
3094
|
+
"description": "Marks the message as initiated by the customer (affects styling and grouping).",
|
|
3095
|
+
"attribute": "customer-initiated",
|
|
3096
|
+
"reflects": true
|
|
3097
|
+
},
|
|
3098
|
+
{
|
|
3099
|
+
"kind": "field",
|
|
3100
|
+
"name": "agentInitiated",
|
|
3101
|
+
"type": {
|
|
3102
|
+
"text": "boolean"
|
|
3103
|
+
},
|
|
3104
|
+
"default": "false",
|
|
3105
|
+
"description": "Marks the message as initiated by an agent (affects styling and grouping).",
|
|
3106
|
+
"attribute": "agent-initiated",
|
|
3107
|
+
"reflects": true
|
|
3108
|
+
},
|
|
3109
|
+
{
|
|
3110
|
+
"kind": "method",
|
|
3111
|
+
"name": "isSystemMessage",
|
|
3112
|
+
"privacy": "private"
|
|
3113
|
+
},
|
|
3114
|
+
{
|
|
3115
|
+
"kind": "method",
|
|
3116
|
+
"name": "renderSystemCard",
|
|
3117
|
+
"privacy": "private"
|
|
3118
|
+
},
|
|
3119
|
+
{
|
|
3120
|
+
"kind": "method",
|
|
3121
|
+
"name": "systemLabel",
|
|
3122
|
+
"privacy": "private"
|
|
3123
|
+
},
|
|
3124
|
+
{
|
|
3125
|
+
"kind": "method",
|
|
3126
|
+
"name": "renderHeader",
|
|
3127
|
+
"privacy": "private"
|
|
3128
|
+
},
|
|
3129
|
+
{
|
|
3130
|
+
"kind": "method",
|
|
3131
|
+
"name": "renderContent",
|
|
3132
|
+
"privacy": "private"
|
|
3133
|
+
},
|
|
3013
3134
|
{
|
|
3014
3135
|
"kind": "method",
|
|
3015
3136
|
"name": "getTime",
|
|
3016
3137
|
"privacy": "private",
|
|
3017
|
-
"
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
]
|
|
3138
|
+
"description": "HH:MM only — used on the system card."
|
|
3139
|
+
},
|
|
3140
|
+
{
|
|
3141
|
+
"kind": "method",
|
|
3142
|
+
"name": "getSentTime",
|
|
3143
|
+
"privacy": "private",
|
|
3144
|
+
"description": "HH:MM, prefixed with the date when the message is not from today."
|
|
3025
3145
|
}
|
|
3026
3146
|
],
|
|
3027
3147
|
"attributes": [
|
|
@@ -3031,28 +3151,73 @@
|
|
|
3031
3151
|
"text": "string"
|
|
3032
3152
|
},
|
|
3033
3153
|
"default": "''",
|
|
3034
|
-
"description": "The sender's name, also used for the avatar
|
|
3154
|
+
"description": "The sender's name, also used for the avatar.",
|
|
3035
3155
|
"fieldName": "sender"
|
|
3036
3156
|
},
|
|
3157
|
+
{
|
|
3158
|
+
"name": "message",
|
|
3159
|
+
"type": {
|
|
3160
|
+
"text": "string"
|
|
3161
|
+
},
|
|
3162
|
+
"default": "''",
|
|
3163
|
+
"description": "The message body as an HTML string. When set, it is sanitized (scripts and event\nhandlers stripped), newlines become line breaks and bare URLs become links. When\nomitted the default slot is rendered instead.",
|
|
3164
|
+
"fieldName": "message"
|
|
3165
|
+
},
|
|
3037
3166
|
{
|
|
3038
3167
|
"name": "time",
|
|
3039
3168
|
"type": {
|
|
3040
3169
|
"text": "string"
|
|
3041
3170
|
},
|
|
3042
3171
|
"default": "''",
|
|
3043
|
-
"description": "Unix timestamp (seconds) of the message, shown as HH:MM.",
|
|
3172
|
+
"description": "Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today).",
|
|
3044
3173
|
"fieldName": "time"
|
|
3174
|
+
},
|
|
3175
|
+
{
|
|
3176
|
+
"name": "avatar",
|
|
3177
|
+
"type": {
|
|
3178
|
+
"text": "string"
|
|
3179
|
+
},
|
|
3180
|
+
"default": "''",
|
|
3181
|
+
"description": "Overrides the avatar source. Defaults to `sender`.",
|
|
3182
|
+
"fieldName": "avatar"
|
|
3183
|
+
},
|
|
3184
|
+
{
|
|
3185
|
+
"name": "action-type",
|
|
3186
|
+
"type": {
|
|
3187
|
+
"text": "ChatMessageActionType"
|
|
3188
|
+
},
|
|
3189
|
+
"default": "''",
|
|
3190
|
+
"description": "The kind of message. Drives system-card rendering, the sending state and badges.",
|
|
3191
|
+
"fieldName": "actionType"
|
|
3192
|
+
},
|
|
3193
|
+
{
|
|
3194
|
+
"name": "customer-initiated",
|
|
3195
|
+
"type": {
|
|
3196
|
+
"text": "boolean"
|
|
3197
|
+
},
|
|
3198
|
+
"default": "false",
|
|
3199
|
+
"description": "Marks the message as initiated by the customer (affects styling and grouping).",
|
|
3200
|
+
"fieldName": "customerInitiated"
|
|
3201
|
+
},
|
|
3202
|
+
{
|
|
3203
|
+
"name": "agent-initiated",
|
|
3204
|
+
"type": {
|
|
3205
|
+
"text": "boolean"
|
|
3206
|
+
},
|
|
3207
|
+
"default": "false",
|
|
3208
|
+
"description": "Marks the message as initiated by an agent (affects styling and grouping).",
|
|
3209
|
+
"fieldName": "agentInitiated"
|
|
3045
3210
|
}
|
|
3046
3211
|
],
|
|
3047
3212
|
"superclass": {
|
|
3048
3213
|
"name": "ZincElement",
|
|
3049
3214
|
"module": "/src/internal/zinc-element"
|
|
3050
3215
|
},
|
|
3051
|
-
"summary": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions.",
|
|
3216
|
+
"summary": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions. Also renders\nsystem events (connections, transfers, etc.) as a centred card.",
|
|
3052
3217
|
"tagNameWithoutPrefix": "chat-message",
|
|
3053
3218
|
"tagName": "zn-chat-message",
|
|
3054
3219
|
"customElement": true,
|
|
3055
|
-
"jsDoc": "/**\n * @summary A single message in a chat-style conversation: avatar, sender,\n * time, optional badge, and a message bubble with optional actions.\n * @documentation https://zinc.style/components/chat-message\n * @status experimental\n * @since 1.0\n *\n * @dependency zn-icon\n *\n * @slot - The message content.\n * @slot badge - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n * @slot edit-dialog-trigger - Action rendered at the end of the bubble (e.g. a remove icon button).\n * @slot edit-dialog - Pass-through for an associated dialog element.\n *\n * @csspart base - The component's base wrapper.\n * @csspart avatar - The avatar column.\n * @csspart body - The header and bubble column.\n * @csspart header - The sender/time/badge row.\n * @csspart bubble - The message bubble.\n * @csspart content - The message content within the bubble.\n *\n * @cssproperty --message-background - The bubble's background colour.\n */",
|
|
3220
|
+
"jsDoc": "/**\n * @summary A single message in a chat-style conversation: avatar, sender,\n * time, optional badge, and a message bubble with optional actions. Also renders\n * system events (connections, transfers, etc.) as a centred card.\n * @documentation https://zinc.style/components/chat-message\n * @status experimental\n * @since 1.0\n *\n * @dependency zn-icon\n *\n * @slot - The message content. Ignored when the `message` attribute is set.\n * @slot badge - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n * @slot edit-dialog-trigger - Action rendered at the end of the bubble (e.g. a remove icon button).\n * @slot edit-dialog - Pass-through for an associated dialog element.\n *\n * @csspart base - The component's base wrapper.\n * @csspart avatar - The avatar column.\n * @csspart body - The header and bubble column.\n * @csspart header - The sender/time/badge row.\n * @csspart bubble - The message bubble.\n * @csspart content - The message content within the bubble.\n * @csspart system-card - The card rendered for system action types.\n *\n * @cssproperty --message-background - The bubble's background colour.\n */",
|
|
3056
3221
|
"documentation": "https://zinc.style/components/chat-message",
|
|
3057
3222
|
"status": "experimental",
|
|
3058
3223
|
"since": "1.0",
|
|
@@ -36151,7 +36316,7 @@
|
|
|
36151
36316
|
"package": {
|
|
36152
36317
|
"name": "@kubex/zinc",
|
|
36153
36318
|
"description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
|
|
36154
|
-
"version": "1.1.
|
|
36319
|
+
"version": "1.1.4",
|
|
36155
36320
|
"author": "",
|
|
36156
36321
|
"license": "MIT"
|
|
36157
36322
|
}
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
{ "name": "icon", "values": [] },
|
|
32
32
|
{ "name": "caption", "values": [] },
|
|
33
33
|
{ "name": "collapse", "values": [] },
|
|
34
|
+
{
|
|
35
|
+
"name": "appearance",
|
|
36
|
+
"values": [{ "name": "transparent" }, { "name": "solid" }]
|
|
37
|
+
},
|
|
34
38
|
{
|
|
35
39
|
"name": "level",
|
|
36
40
|
"values": [
|
|
@@ -357,16 +361,41 @@
|
|
|
357
361
|
},
|
|
358
362
|
{
|
|
359
363
|
"name": "zn-chat-message",
|
|
360
|
-
"description": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions.\n---\n\n\n### **Slots:**\n - _default_ - The message content.\n- **badge** - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n- **edit-dialog-trigger** - Action rendered at the end of the bubble (e.g. a remove icon button).\n- **edit-dialog** - Pass-through for an associated dialog element.\n\n### **CSS Properties:**\n - **--message-background** - The bubble's background colour. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **avatar** - The avatar column.\n- **body** - The header and bubble column.\n- **header** - The sender/time/badge row.\n- **bubble** - The message bubble.\n- **content** - The message content within the bubble.",
|
|
364
|
+
"description": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions. Also renders\nsystem events (connections, transfers, etc.) as a centred card.\n---\n\n\n### **Slots:**\n - _default_ - The message content. Ignored when the `message` attribute is set.\n- **badge** - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n- **edit-dialog-trigger** - Action rendered at the end of the bubble (e.g. a remove icon button).\n- **edit-dialog** - Pass-through for an associated dialog element.\n\n### **CSS Properties:**\n - **--message-background** - The bubble's background colour. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **avatar** - The avatar column.\n- **body** - The header and bubble column.\n- **header** - The sender/time/badge row.\n- **bubble** - The message bubble.\n- **content** - The message content within the bubble.\n- **system-card** - The card rendered for system action types.",
|
|
361
365
|
"attributes": [
|
|
362
366
|
{
|
|
363
367
|
"name": "sender",
|
|
364
|
-
"description": "The sender's name, also used for the avatar
|
|
368
|
+
"description": "The sender's name, also used for the avatar.",
|
|
369
|
+
"values": []
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"name": "message",
|
|
373
|
+
"description": "The message body as an HTML string. When set, it is sanitized (scripts and event\nhandlers stripped), newlines become line breaks and bare URLs become links. When\nomitted the default slot is rendered instead.",
|
|
365
374
|
"values": []
|
|
366
375
|
},
|
|
367
376
|
{
|
|
368
377
|
"name": "time",
|
|
369
|
-
"description": "Unix timestamp (seconds) of the message, shown as HH:MM.",
|
|
378
|
+
"description": "Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today).",
|
|
379
|
+
"values": []
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"name": "avatar",
|
|
383
|
+
"description": "Overrides the avatar source. Defaults to `sender`.",
|
|
384
|
+
"values": []
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"name": "action-type",
|
|
388
|
+
"description": "The kind of message. Drives system-card rendering, the sending state and badges.",
|
|
389
|
+
"values": [{ "name": "ChatMessageActionType" }]
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"name": "customer-initiated",
|
|
393
|
+
"description": "Marks the message as initiated by the customer (affects styling and grouping).",
|
|
394
|
+
"values": []
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"name": "agent-initiated",
|
|
398
|
+
"description": "Marks the message as initiated by an agent (affects styling and grouping).",
|
|
370
399
|
"values": []
|
|
371
400
|
}
|
|
372
401
|
],
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@kubex/zinc",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -51,6 +51,13 @@
|
|
|
51
51
|
"name": "collapse",
|
|
52
52
|
"value": { "type": "boolean", "default": "false" }
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"name": "appearance",
|
|
56
|
+
"value": {
|
|
57
|
+
"type": "'transparent' | 'solid'",
|
|
58
|
+
"default": "'transparent'"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
54
61
|
{
|
|
55
62
|
"name": "level",
|
|
56
63
|
"value": {
|
|
@@ -78,6 +85,7 @@
|
|
|
78
85
|
{ "name": "icon", "type": "string" },
|
|
79
86
|
{ "name": "caption", "type": "string" },
|
|
80
87
|
{ "name": "collapse", "type": "boolean" },
|
|
88
|
+
{ "name": "appearance", "type": "'transparent' | 'solid'" },
|
|
81
89
|
{
|
|
82
90
|
"name": "level",
|
|
83
91
|
"type": "'primary' | 'error' | 'info' | 'success' | 'warning' | 'note' | 'cosmic'"
|
|
@@ -711,22 +719,50 @@
|
|
|
711
719
|
},
|
|
712
720
|
{
|
|
713
721
|
"name": "zn-chat-message",
|
|
714
|
-
"description": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions.\n---\n\n\n### **Slots:**\n - _default_ - The message content.\n- **badge** - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n- **edit-dialog-trigger** - Action rendered at the end of the bubble (e.g. a remove icon button).\n- **edit-dialog** - Pass-through for an associated dialog element.\n\n### **CSS Properties:**\n - **--message-background** - The bubble's background colour. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **avatar** - The avatar column.\n- **body** - The header and bubble column.\n- **header** - The sender/time/badge row.\n- **bubble** - The message bubble.\n- **content** - The message content within the bubble.",
|
|
722
|
+
"description": "A single message in a chat-style conversation: avatar, sender,\ntime, optional badge, and a message bubble with optional actions. Also renders\nsystem events (connections, transfers, etc.) as a centred card.\n---\n\n\n### **Slots:**\n - _default_ - The message content. Ignored when the `message` attribute is set.\n- **badge** - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).\n- **edit-dialog-trigger** - Action rendered at the end of the bubble (e.g. a remove icon button).\n- **edit-dialog** - Pass-through for an associated dialog element.\n\n### **CSS Properties:**\n - **--message-background** - The bubble's background colour. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.\n- **avatar** - The avatar column.\n- **body** - The header and bubble column.\n- **header** - The sender/time/badge row.\n- **bubble** - The message bubble.\n- **content** - The message content within the bubble.\n- **system-card** - The card rendered for system action types.",
|
|
715
723
|
"doc-url": "",
|
|
716
724
|
"attributes": [
|
|
717
725
|
{
|
|
718
726
|
"name": "sender",
|
|
719
|
-
"description": "The sender's name, also used for the avatar
|
|
727
|
+
"description": "The sender's name, also used for the avatar.",
|
|
728
|
+
"value": { "type": "string", "default": "''" }
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"name": "message",
|
|
732
|
+
"description": "The message body as an HTML string. When set, it is sanitized (scripts and event\nhandlers stripped), newlines become line breaks and bare URLs become links. When\nomitted the default slot is rendered instead.",
|
|
720
733
|
"value": { "type": "string", "default": "''" }
|
|
721
734
|
},
|
|
722
735
|
{
|
|
723
736
|
"name": "time",
|
|
724
|
-
"description": "Unix timestamp (seconds) of the message, shown as HH:MM.",
|
|
737
|
+
"description": "Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today).",
|
|
738
|
+
"value": { "type": "string", "default": "''" }
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
"name": "avatar",
|
|
742
|
+
"description": "Overrides the avatar source. Defaults to `sender`.",
|
|
725
743
|
"value": { "type": "string", "default": "''" }
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"name": "action-type",
|
|
747
|
+
"description": "The kind of message. Drives system-card rendering, the sending state and badges.",
|
|
748
|
+
"value": { "type": "ChatMessageActionType", "default": "''" }
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
"name": "customer-initiated",
|
|
752
|
+
"description": "Marks the message as initiated by the customer (affects styling and grouping).",
|
|
753
|
+
"value": { "type": "boolean", "default": "false" }
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"name": "agent-initiated",
|
|
757
|
+
"description": "Marks the message as initiated by an agent (affects styling and grouping).",
|
|
758
|
+
"value": { "type": "boolean", "default": "false" }
|
|
726
759
|
}
|
|
727
760
|
],
|
|
728
761
|
"slots": [
|
|
729
|
-
{
|
|
762
|
+
{
|
|
763
|
+
"name": "",
|
|
764
|
+
"description": "The message content. Ignored when the `message` attribute is set."
|
|
765
|
+
},
|
|
730
766
|
{
|
|
731
767
|
"name": "badge",
|
|
732
768
|
"description": "Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip)."
|
|
@@ -745,13 +781,38 @@
|
|
|
745
781
|
"properties": [
|
|
746
782
|
{
|
|
747
783
|
"name": "sender",
|
|
748
|
-
"description": "The sender's name, also used for the avatar
|
|
784
|
+
"description": "The sender's name, also used for the avatar.",
|
|
785
|
+
"type": "string"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"name": "message",
|
|
789
|
+
"description": "The message body as an HTML string. When set, it is sanitized (scripts and event\nhandlers stripped), newlines become line breaks and bare URLs become links. When\nomitted the default slot is rendered instead.",
|
|
749
790
|
"type": "string"
|
|
750
791
|
},
|
|
751
792
|
{
|
|
752
793
|
"name": "time",
|
|
753
|
-
"description": "Unix timestamp (seconds) of the message, shown as HH:MM.",
|
|
794
|
+
"description": "Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today).",
|
|
795
|
+
"type": "string"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"name": "avatar",
|
|
799
|
+
"description": "Overrides the avatar source. Defaults to `sender`.",
|
|
754
800
|
"type": "string"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
"name": "actionType",
|
|
804
|
+
"description": "The kind of message. Drives system-card rendering, the sending state and badges.",
|
|
805
|
+
"type": "ChatMessageActionType"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"name": "customerInitiated",
|
|
809
|
+
"description": "Marks the message as initiated by the customer (affects styling and grouping).",
|
|
810
|
+
"type": "boolean"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"name": "agentInitiated",
|
|
814
|
+
"description": "Marks the message as initiated by an agent (affects styling and grouping).",
|
|
815
|
+
"type": "boolean"
|
|
755
816
|
}
|
|
756
817
|
],
|
|
757
818
|
"events": []
|
package/dist/zn.d.ts
CHANGED
|
@@ -1435,6 +1435,7 @@ declare module "components/alert/alert.component" {
|
|
|
1435
1435
|
icon: string;
|
|
1436
1436
|
caption: string;
|
|
1437
1437
|
collapse: boolean;
|
|
1438
|
+
appearance: 'transparent' | 'solid';
|
|
1438
1439
|
level: 'primary' | 'error' | 'info' | 'success' | 'warning' | 'note' | 'cosmic';
|
|
1439
1440
|
size: 'small' | 'medium' | 'large';
|
|
1440
1441
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1493,20 +1494,26 @@ declare module "components/button-group/index" {
|
|
|
1493
1494
|
}
|
|
1494
1495
|
}
|
|
1495
1496
|
}
|
|
1497
|
+
declare module "components/chat-message/clean-message" {
|
|
1498
|
+
/** Strip scripts and event/handler attributes from an untrusted HTML string. */
|
|
1499
|
+
export function cleanHTML(message: string): string;
|
|
1500
|
+
}
|
|
1496
1501
|
declare module "components/chat-message/chat-message.component" {
|
|
1497
|
-
import { type CSSResultGroup } from 'lit';
|
|
1502
|
+
import { type CSSResultGroup, nothing } from 'lit';
|
|
1498
1503
|
import ZincElement from "internal/zinc-element";
|
|
1499
1504
|
import ZnIcon from "components/icon/index";
|
|
1505
|
+
export type ChatMessageActionType = '' | 'connected.agent' | 'attachment.added' | 'multi.answer' | 'transfer' | 'ended' | 'error' | 'message-sending' | 'customer.ended' | 'customer.connected' | 'customer.disconnected' | 'internal';
|
|
1500
1506
|
/**
|
|
1501
1507
|
* @summary A single message in a chat-style conversation: avatar, sender,
|
|
1502
|
-
* time, optional badge, and a message bubble with optional actions.
|
|
1508
|
+
* time, optional badge, and a message bubble with optional actions. Also renders
|
|
1509
|
+
* system events (connections, transfers, etc.) as a centred card.
|
|
1503
1510
|
* @documentation https://zinc.style/components/chat-message
|
|
1504
1511
|
* @status experimental
|
|
1505
1512
|
* @since 1.0
|
|
1506
1513
|
*
|
|
1507
1514
|
* @dependency zn-icon
|
|
1508
1515
|
*
|
|
1509
|
-
* @slot - The message content.
|
|
1516
|
+
* @slot - The message content. Ignored when the `message` attribute is set.
|
|
1510
1517
|
* @slot badge - Rendered in the header after the sender and time (e.g. an INTERNAL NOTE chip).
|
|
1511
1518
|
* @slot edit-dialog-trigger - Action rendered at the end of the bubble (e.g. a remove icon button).
|
|
1512
1519
|
* @slot edit-dialog - Pass-through for an associated dialog element.
|
|
@@ -1517,6 +1524,7 @@ declare module "components/chat-message/chat-message.component" {
|
|
|
1517
1524
|
* @csspart header - The sender/time/badge row.
|
|
1518
1525
|
* @csspart bubble - The message bubble.
|
|
1519
1526
|
* @csspart content - The message content within the bubble.
|
|
1527
|
+
* @csspart system-card - The card rendered for system action types.
|
|
1520
1528
|
*
|
|
1521
1529
|
* @cssproperty --message-background - The bubble's background colour.
|
|
1522
1530
|
*/
|
|
@@ -1525,12 +1533,37 @@ declare module "components/chat-message/chat-message.component" {
|
|
|
1525
1533
|
static dependencies: {
|
|
1526
1534
|
'zn-icon': typeof ZnIcon;
|
|
1527
1535
|
};
|
|
1528
|
-
|
|
1536
|
+
static readonly SYSTEM_ACTION_TYPES: readonly string[];
|
|
1537
|
+
private static readonly DISPLAYED_ACTION_TYPES;
|
|
1538
|
+
/** The sender's name, also used for the avatar. */
|
|
1529
1539
|
sender: string;
|
|
1530
|
-
/**
|
|
1540
|
+
/**
|
|
1541
|
+
* The message body as an HTML string. When set, it is sanitized (scripts and event
|
|
1542
|
+
* handlers stripped), newlines become line breaks and bare URLs become links. When
|
|
1543
|
+
* omitted the default slot is rendered instead.
|
|
1544
|
+
*/
|
|
1545
|
+
message: string;
|
|
1546
|
+
/** Unix timestamp (seconds) of the message, shown as HH:MM (with date if not today). */
|
|
1531
1547
|
time: string;
|
|
1548
|
+
/** Overrides the avatar source. Defaults to `sender`. */
|
|
1549
|
+
avatar: string;
|
|
1550
|
+
/** The kind of message. Drives system-card rendering, the sending state and badges. */
|
|
1551
|
+
actionType: ChatMessageActionType;
|
|
1552
|
+
/** Marks the message as initiated by the customer (affects styling and grouping). */
|
|
1553
|
+
customerInitiated: boolean;
|
|
1554
|
+
/** Marks the message as initiated by an agent (affects styling and grouping). */
|
|
1555
|
+
agentInitiated: boolean;
|
|
1556
|
+
connectedCallback(): void;
|
|
1557
|
+
protected render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
1558
|
+
private isSystemMessage;
|
|
1559
|
+
private renderSystemCard;
|
|
1560
|
+
private systemLabel;
|
|
1561
|
+
private renderHeader;
|
|
1562
|
+
private renderContent;
|
|
1563
|
+
/** HH:MM only — used on the system card. */
|
|
1532
1564
|
private getTime;
|
|
1533
|
-
|
|
1565
|
+
/** HH:MM, prefixed with the date when the message is not from today. */
|
|
1566
|
+
private getSentTime;
|
|
1534
1567
|
}
|
|
1535
1568
|
}
|
|
1536
1569
|
declare module "components/chat-message/index" {
|