@cognigy/chat-components-vue 0.3.0 → 0.4.0
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/README.md +22 -0
- package/dist/chat-components-vue.css +1 -1
- package/dist/chat-components-vue.js +1347 -1328
- package/dist/components/common/ActionButton.vue.d.ts +2 -0
- package/dist/components/common/ActionButtons.vue.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/theme.d.ts +12 -0
- package/package.json +1 -1
- package/src/components/Message.vue +2 -1
- package/src/components/common/ActionButton.vue +37 -0
- package/src/components/common/ActionButtons.vue +4 -0
- package/src/components/common/ChatBubble.vue +1 -0
- package/src/components/common/ChatEvent.vue +4 -11
- package/src/components/common/Typography.vue +22 -22
- package/src/components/messages/AdaptiveCard.vue +4 -4
- package/src/components/messages/DatePicker.vue +1 -1
- package/src/components/messages/GalleryItem.vue +2 -2
- package/src/components/messages/ImageMessage.vue +1 -1
- package/src/components/messages/List.vue +11 -5
- package/src/components/messages/ListItem.vue +5 -9
- package/src/components/messages/TextWithButtons.vue +2 -2
- package/src/components/messages/VideoMessage.vue +1 -1
- package/src/index.ts +1 -1
- package/src/types/index.ts +2 -0
- package/src/utils/theme.ts +18 -0
|
@@ -24,6 +24,7 @@ interface Props {
|
|
|
24
24
|
dataMessageId?: string;
|
|
25
25
|
onEmitAnalytics?: AnalyticsEventCallback;
|
|
26
26
|
size?: 'small' | 'large';
|
|
27
|
+
variant?: 'primary' | 'secondary';
|
|
27
28
|
id?: string;
|
|
28
29
|
className?: string;
|
|
29
30
|
openXAppOverlay?: (url: string | undefined) => void;
|
|
@@ -44,6 +45,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
|
|
|
44
45
|
disabled: boolean;
|
|
45
46
|
config: ChatConfig;
|
|
46
47
|
className: string;
|
|
48
|
+
variant: "primary" | "secondary";
|
|
47
49
|
customIcon: CustomIcon;
|
|
48
50
|
showUrlIcon: boolean;
|
|
49
51
|
dataMessageId: string;
|
|
@@ -14,6 +14,7 @@ interface Props {
|
|
|
14
14
|
dataMessageId?: string;
|
|
15
15
|
onEmitAnalytics?: AnalyticsEventCallback;
|
|
16
16
|
size?: 'small' | 'large';
|
|
17
|
+
variant?: 'primary' | 'secondary';
|
|
17
18
|
templateTextId?: string;
|
|
18
19
|
openXAppOverlay?: (url: string | undefined) => void;
|
|
19
20
|
}
|
|
@@ -22,6 +23,7 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
22
23
|
action: MessageSender;
|
|
23
24
|
config: ChatConfig;
|
|
24
25
|
className: string;
|
|
26
|
+
variant: "primary" | "secondary";
|
|
25
27
|
customIcon: CustomIcon;
|
|
26
28
|
showUrlIcon: boolean;
|
|
27
29
|
dataMessageId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { useLiveRegion } from './composables/useLiveRegion';
|
|
|
28
28
|
export { DownloadIcon, CloseIcon, VideoPlayIcon, AudioPlayIcon, AudioPauseIcon, ArrowBackIcon, LinkIcon } from './assets/svg';
|
|
29
29
|
export { match, getChannelPayload } from './utils/matcher';
|
|
30
30
|
export { sanitizeHTMLWithConfig, sanitizeContent } from './utils/sanitize';
|
|
31
|
-
export { configColorsToCssVariables, themeFontToCssVariable } from './utils/theme';
|
|
31
|
+
export { configColorsToCssVariables, themeFontToCssVariable, themeFontSizeToCssVariable } from './utils/theme';
|
|
32
32
|
export { getWebchatButtonLabel, interpolateString, getRandomId, moveFocusToMessageFocusTarget, replaceUrlsWithHTMLanchorElem, getBackgroundImage, getFileName, getFileExtension, getSizeLabel, isImageAttachment, VALID_IMAGE_MIME_TYPES } from './utils/helpers';
|
|
33
33
|
export type { ChatConfig, ChatSettings, ChatTheme, MessageProps, MessageSender, MessagePlugin, MessagePluginOptions, MessageContext, MessageParams, IMessage, IStreamingMessage, IWebchatButton, IWebchatQuickReply, IWebchatTemplateAttachment, IWebchatAttachmentElement, IWebchatAudioAttachment, IWebchatImageAttachment, IWebchatVideoAttachment, IUploadFileAttachmentData, IDatePickerData, IWebchatChannelPayload, } from './types';
|
|
34
34
|
export type { TagVariant } from './components/common/Typography.vue';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -189,6 +189,8 @@ export interface ChatTheme {
|
|
|
189
189
|
textDark?: string;
|
|
190
190
|
textLight?: string;
|
|
191
191
|
fontFamily?: string;
|
|
192
|
+
/** Base font size for text scaling. All text sizes scale proportionally from this value. Default: '14px' */
|
|
193
|
+
fontSize?: string;
|
|
192
194
|
}
|
|
193
195
|
/**
|
|
194
196
|
* Message sender callback type.
|
package/dist/utils/theme.d.ts
CHANGED
|
@@ -27,3 +27,15 @@ export declare function configColorsToCssVariables(colors?: ChatSettings['colors
|
|
|
27
27
|
* @returns A record with the --cc-font-family CSS variable, or empty object
|
|
28
28
|
*/
|
|
29
29
|
export declare function themeFontToCssVariable(theme?: ChatTheme): Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Maps a ChatTheme's fontSize to the --cc-font-size CSS variable.
|
|
32
|
+
* Consumers can set this to scale all text proportionally.
|
|
33
|
+
*
|
|
34
|
+
* Components should reference font-size as:
|
|
35
|
+
* font-size: var(--cc-font-size, 14px); (for 14px base)
|
|
36
|
+
* font-size: calc(var(--cc-font-size, 14px) * 1.2857); (for 18px base)
|
|
37
|
+
*
|
|
38
|
+
* @param theme - The ChatTheme object
|
|
39
|
+
* @returns A record with the --cc-font-size CSS variable, or empty object
|
|
40
|
+
*/
|
|
41
|
+
export declare function themeFontSizeToCssVariable(theme?: ChatTheme): Record<string, string>;
|
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
type Component,
|
|
31
31
|
} from "vue";
|
|
32
32
|
import { match } from "../utils/matcher";
|
|
33
|
-
import {configColorsToCssVariables, themeFontToCssVariable} from "../utils/theme";
|
|
33
|
+
import {configColorsToCssVariables, themeFontToCssVariable, themeFontSizeToCssVariable} from "../utils/theme";
|
|
34
34
|
import { provideMessageContext } from "../composables/useMessageContext";
|
|
35
35
|
import { getMessageId, isMessagePlugin } from "../types";
|
|
36
36
|
import type { MessageProps, MessageContext } from "../types";
|
|
@@ -157,6 +157,7 @@ const cssVariableStyle = computed(() => {
|
|
|
157
157
|
return {
|
|
158
158
|
...configColorsToCssVariables(props.config?.settings?.colors),
|
|
159
159
|
...themeFontToCssVariable(props.theme),
|
|
160
|
+
...themeFontSizeToCssVariable(props.theme),
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
163
|
</script>
|
|
@@ -33,6 +33,7 @@ interface Props {
|
|
|
33
33
|
dataMessageId?: string
|
|
34
34
|
onEmitAnalytics?: AnalyticsEventCallback
|
|
35
35
|
size?: 'small' | 'large'
|
|
36
|
+
variant?: 'primary' | 'secondary'
|
|
36
37
|
id?: string
|
|
37
38
|
className?: string
|
|
38
39
|
openXAppOverlay?: (url: string | undefined) => void
|
|
@@ -47,6 +48,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
47
48
|
dataMessageId: undefined,
|
|
48
49
|
onEmitAnalytics: undefined,
|
|
49
50
|
size: 'small',
|
|
51
|
+
variant: 'primary',
|
|
50
52
|
id: undefined,
|
|
51
53
|
className: '',
|
|
52
54
|
openXAppOverlay: undefined,
|
|
@@ -158,6 +160,7 @@ const target = computed(() => {
|
|
|
158
160
|
// CSS classes
|
|
159
161
|
const buttonClasses = computed(() => {
|
|
160
162
|
const classes = [styles.button]
|
|
163
|
+
if (props.variant === 'secondary') classes.push(styles.secondary)
|
|
161
164
|
if (isWebURL.value) classes.push(styles.url)
|
|
162
165
|
if (props.className) classes.push(props.className)
|
|
163
166
|
if (props.disabled) {
|
|
@@ -336,6 +339,40 @@ a.button.disabled:focus {
|
|
|
336
339
|
pointer-events: none;
|
|
337
340
|
}
|
|
338
341
|
|
|
342
|
+
/* Secondary variant: outlined style */
|
|
343
|
+
button.button.secondary,
|
|
344
|
+
a.button.secondary {
|
|
345
|
+
background: transparent;
|
|
346
|
+
color: var(--cc-primary-color);
|
|
347
|
+
border: 1px solid var(--cc-primary-color);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
button.button.secondary:hover,
|
|
351
|
+
a.button.secondary:hover,
|
|
352
|
+
button.button.secondary:focus,
|
|
353
|
+
a.button.secondary:focus {
|
|
354
|
+
background: color-mix(in srgb, var(--cc-primary-color) 10%, transparent);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
button.button.secondary:disabled,
|
|
358
|
+
button.button.secondary:disabled:hover,
|
|
359
|
+
a.button.secondary.disabled,
|
|
360
|
+
a.button.secondary.disabled:hover {
|
|
361
|
+
background: transparent;
|
|
362
|
+
color: var(--cc-primary-color-disabled, color-mix(in srgb, var(--cc-primary-color) 40%, #999));
|
|
363
|
+
border-color: var(--cc-primary-color-disabled, color-mix(in srgb, var(--cc-primary-color) 40%, #999));
|
|
364
|
+
cursor: default;
|
|
365
|
+
pointer-events: none;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* Focus-visible for secondary */
|
|
369
|
+
:where(button.button.secondary):focus-visible,
|
|
370
|
+
:where(a.button.secondary):focus-visible {
|
|
371
|
+
outline: 2px solid var(--cc-primary-color-focus, var(--cc-primary-color));
|
|
372
|
+
outline-offset: 2px;
|
|
373
|
+
box-shadow: 0 0 0 4px var(--cc-primary-contrast-color, #ffffff);
|
|
374
|
+
}
|
|
375
|
+
|
|
339
376
|
.buttonLabelWithImage {
|
|
340
377
|
margin-left: 40px;
|
|
341
378
|
}
|
|
@@ -18,6 +18,7 @@ interface Props {
|
|
|
18
18
|
dataMessageId?: string
|
|
19
19
|
onEmitAnalytics?: AnalyticsEventCallback
|
|
20
20
|
size?: 'small' | 'large'
|
|
21
|
+
variant?: 'primary' | 'secondary'
|
|
21
22
|
templateTextId?: string
|
|
22
23
|
openXAppOverlay?: (url: string | undefined) => void
|
|
23
24
|
}
|
|
@@ -35,6 +36,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
35
36
|
dataMessageId: undefined,
|
|
36
37
|
onEmitAnalytics: undefined,
|
|
37
38
|
size: 'small',
|
|
39
|
+
variant: 'primary',
|
|
38
40
|
templateTextId: undefined,
|
|
39
41
|
openXAppOverlay: undefined,
|
|
40
42
|
})
|
|
@@ -118,6 +120,7 @@ const containerClasses = computed(() => {
|
|
|
118
120
|
:config="config"
|
|
119
121
|
:on-emit-analytics="onEmitAnalytics"
|
|
120
122
|
:size="size"
|
|
123
|
+
:variant="variant"
|
|
121
124
|
:data-message-id="dataMessageId"
|
|
122
125
|
:class-name="buttonClassName"
|
|
123
126
|
:open-x-app-overlay="openXAppOverlay"
|
|
@@ -140,6 +143,7 @@ const containerClasses = computed(() => {
|
|
|
140
143
|
:config="config"
|
|
141
144
|
:on-emit-analytics="onEmitAnalytics"
|
|
142
145
|
:size="size"
|
|
146
|
+
:variant="variant"
|
|
143
147
|
:data-message-id="dataMessageId"
|
|
144
148
|
:class-name="buttonClassName"
|
|
145
149
|
:open-x-app-overlay="openXAppOverlay"
|
|
@@ -72,6 +72,7 @@ const bubbleStyle = computed((): CSSProperties => {
|
|
|
72
72
|
margin-block-end: 12px;
|
|
73
73
|
word-break: break-word;
|
|
74
74
|
white-space: pre-wrap;
|
|
75
|
+
font-size: var(--cc-font-size, 14px);
|
|
75
76
|
box-shadow: var(--cc-message-shadow, rgba(151, 124, 156, 0.1) 0px 5px 9px 0px,
|
|
76
77
|
rgba(203, 195, 212, 0.1) 0px 5px 16px 0px,
|
|
77
78
|
rgba(216, 212, 221, 0.1) 0px 8px 20px 0px);
|
|
@@ -6,15 +6,16 @@
|
|
|
6
6
|
aria-live="assertive"
|
|
7
7
|
>
|
|
8
8
|
<div :class="styles.eventPillTextWrapper">
|
|
9
|
-
<
|
|
9
|
+
<Typography variant="title2-semibold" component="div">
|
|
10
10
|
{{ text }}
|
|
11
|
-
</
|
|
11
|
+
</Typography>
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import { computed, useCssModule } from 'vue'
|
|
18
|
+
import Typography from './Typography.vue'
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* ChatEvent - Display chat event notifications
|
|
@@ -64,6 +65,7 @@ const eventClasses = computed(() => {
|
|
|
64
65
|
gap: 10px;
|
|
65
66
|
margin-inline: auto;
|
|
66
67
|
margin-block-start: 40px;
|
|
68
|
+
font-family: var(--cc-font-family, 'Figtree', sans-serif);
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
.eventPillTextWrapper {
|
|
@@ -75,13 +77,4 @@ const eventClasses = computed(() => {
|
|
|
75
77
|
rgba(203, 195, 212, 0.1) 0px 5px 16px 0px,
|
|
76
78
|
rgba(216, 212, 221, 0.1) 0px 8px 20px 0px);
|
|
77
79
|
}
|
|
78
|
-
|
|
79
|
-
.eventText {
|
|
80
|
-
/* Typography variant: title2-semibold equivalent */
|
|
81
|
-
font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
82
|
-
font-size: 14px;
|
|
83
|
-
font-weight: 600;
|
|
84
|
-
line-height: 1.4;
|
|
85
|
-
margin: 0;
|
|
86
|
-
}
|
|
87
80
|
</style>
|
|
@@ -107,79 +107,79 @@ const componentStyle = computed(() => {
|
|
|
107
107
|
|
|
108
108
|
<style module>
|
|
109
109
|
.h1-semibold {
|
|
110
|
-
font-size: 2.
|
|
110
|
+
font-size: calc(var(--cc-font-size, 14px) * 2.4286); /* 34px at 14px base */
|
|
111
111
|
font-style: normal;
|
|
112
112
|
font-weight: 600;
|
|
113
|
-
line-height: 2.
|
|
113
|
+
line-height: calc(var(--cc-font-size, 14px) * 2.9143); /* 40.8px at 14px base */
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
.h2-regular {
|
|
117
|
-
font-size: 1.
|
|
117
|
+
font-size: calc(var(--cc-font-size, 14px) * 1.2857); /* 18px at 14px base */
|
|
118
118
|
font-style: normal;
|
|
119
119
|
font-weight: 400;
|
|
120
|
-
line-height: 1.
|
|
120
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.6714); /* 23.4px at 14px base */
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
.h2-semibold {
|
|
124
|
-
font-size: 1.
|
|
124
|
+
font-size: calc(var(--cc-font-size, 14px) * 1.2857); /* 18px at 14px base */
|
|
125
125
|
font-style: normal;
|
|
126
126
|
font-weight: 600;
|
|
127
|
-
line-height: 1.
|
|
127
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.6714); /* 23.4px at 14px base */
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
.title1-regular {
|
|
131
|
-
font-size:
|
|
131
|
+
font-size: calc(var(--cc-font-size, 14px) * 1.1429); /* 16px at 14px base */
|
|
132
132
|
font-style: normal;
|
|
133
133
|
font-weight: 400;
|
|
134
|
-
line-height: 1.
|
|
134
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.6); /* 22.4px at 14px base */
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
.title1-semibold {
|
|
138
|
-
font-size:
|
|
138
|
+
font-size: calc(var(--cc-font-size, 14px) * 1.1429); /* 16px at 14px base */
|
|
139
139
|
font-style: normal;
|
|
140
140
|
font-weight: 600;
|
|
141
|
-
line-height: 1.
|
|
141
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.6); /* 22.4px at 14px base */
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
.title2-regular {
|
|
145
|
-
font-size: 0.
|
|
145
|
+
font-size: calc(var(--cc-font-size, 14px) * 0.8571); /* 12px at 14px base */
|
|
146
146
|
font-style: normal;
|
|
147
147
|
font-weight: 400;
|
|
148
|
-
line-height: 1.
|
|
148
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.2); /* 16.8px at 14px base */
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
.title2-semibold {
|
|
152
|
-
font-size: 0.
|
|
152
|
+
font-size: calc(var(--cc-font-size, 14px) * 0.8571); /* 12px at 14px base */
|
|
153
153
|
font-style: normal;
|
|
154
154
|
font-weight: 600;
|
|
155
|
-
line-height:
|
|
155
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.1143); /* 15.6px at 14px base */
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
.body-regular {
|
|
159
|
-
font-size:
|
|
159
|
+
font-size: var(--cc-font-size, 14px); /* 14px base */
|
|
160
160
|
font-style: normal;
|
|
161
161
|
font-weight: 400;
|
|
162
|
-
line-height: 1.
|
|
162
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.4); /* 19.6px at 14px base */
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
.body-semibold {
|
|
166
|
-
font-size:
|
|
166
|
+
font-size: var(--cc-font-size, 14px); /* 14px base */
|
|
167
167
|
font-style: normal;
|
|
168
168
|
font-weight: 600;
|
|
169
|
-
line-height: 1.
|
|
169
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.3); /* 18.2px at 14px base */
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
.copy-medium {
|
|
173
|
-
font-size: 0.
|
|
173
|
+
font-size: calc(var(--cc-font-size, 14px) * 0.8571); /* 12px at 14px base */
|
|
174
174
|
font-style: normal;
|
|
175
175
|
font-weight: 500;
|
|
176
|
-
line-height: 1.
|
|
176
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.2); /* 16.8px at 14px base */
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
.cta-semibold {
|
|
180
|
-
font-size:
|
|
180
|
+
font-size: var(--cc-font-size, 14px); /* 14px base */
|
|
181
181
|
font-style: normal;
|
|
182
182
|
font-weight: 600;
|
|
183
|
-
line-height: 1.
|
|
183
|
+
line-height: calc(var(--cc-font-size, 14px) * 1.3); /* 18.2px at 14px base */
|
|
184
184
|
}
|
|
185
185
|
</style>
|
|
@@ -189,7 +189,7 @@ const isReadonly = computed(() => {
|
|
|
189
189
|
border: none;
|
|
190
190
|
color: var(--cc-primary-contrast-color, white);
|
|
191
191
|
cursor: pointer;
|
|
192
|
-
font-size: 14px !important;
|
|
192
|
+
font-size: var(--cc-font-size, 14px) !important;
|
|
193
193
|
font-weight: 600;
|
|
194
194
|
line-height: 160% !important;
|
|
195
195
|
min-width: 100%;
|
|
@@ -213,7 +213,7 @@ const isReadonly = computed(() => {
|
|
|
213
213
|
/* Text styles - use CSS variable for customizable font color */
|
|
214
214
|
.adaptivecardWrapper :global(.ac-textRun) {
|
|
215
215
|
color: var(--cc-adaptive-card-text-color, #333) !important;
|
|
216
|
-
font-size:
|
|
216
|
+
font-size: calc(var(--cc-font-size, 14px) * 0.8571) !important;
|
|
217
217
|
line-height: 140%;
|
|
218
218
|
}
|
|
219
219
|
|
|
@@ -233,7 +233,7 @@ const isReadonly = computed(() => {
|
|
|
233
233
|
border-radius: 10px;
|
|
234
234
|
border: 1px solid var(--cc-adaptive-card-input-border, #ccc);
|
|
235
235
|
color: var(--cc-adaptive-card-input-color, #333) !important;
|
|
236
|
-
font-size: 14px !important;
|
|
236
|
+
font-size: var(--cc-font-size, 14px) !important;
|
|
237
237
|
gap: 10px;
|
|
238
238
|
line-height: 140%;
|
|
239
239
|
padding: 8px 12px 8px 12px;
|
|
@@ -244,7 +244,7 @@ const isReadonly = computed(() => {
|
|
|
244
244
|
.adaptivecardWrapper :global(input),
|
|
245
245
|
.adaptivecardWrapper :global(textarea),
|
|
246
246
|
.adaptivecardWrapper :global(select) {
|
|
247
|
-
font-size:
|
|
247
|
+
font-size: calc(var(--cc-font-size, 14px) * 1.1429) !important;
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
@@ -88,7 +88,7 @@ const selectedDate = computed(() => {
|
|
|
88
88
|
border-radius: var(--cc-button-border-radius, 8px);
|
|
89
89
|
background-color: var(--cc-primary-color, #1976d2);
|
|
90
90
|
color: var(--cc-white, #ffffff);
|
|
91
|
-
font-size: 14px;
|
|
91
|
+
font-size: var(--cc-font-size, 14px);
|
|
92
92
|
font-weight: 600;
|
|
93
93
|
cursor: pointer;
|
|
94
94
|
transition: all 0.2s ease;
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
:buttonListItemClassName="$style.buttonListItem"
|
|
53
53
|
:config="config"
|
|
54
54
|
:dataMessageId="dataMessageId"
|
|
55
|
-
:
|
|
55
|
+
:on-emit-analytics="onEmitAnalytics"
|
|
56
56
|
:templateTextId="slide.title ? titleId : undefined"
|
|
57
|
-
:
|
|
57
|
+
:open-x-app-overlay="openXAppOverlay"
|
|
58
58
|
/>
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
:containerClassName="$style.mainButtonWrapper"
|
|
44
44
|
:config="config"
|
|
45
45
|
:dataMessageId="dataMessageId"
|
|
46
|
-
:
|
|
47
|
-
:
|
|
46
|
+
:open-x-app-overlay="openXAppOverlay"
|
|
47
|
+
:on-emit-analytics="onEmitAnalytics"
|
|
48
48
|
size="large"
|
|
49
49
|
/>
|
|
50
50
|
</div>
|
|
@@ -131,9 +131,9 @@ onMounted(() => {
|
|
|
131
131
|
|
|
132
132
|
<style module>
|
|
133
133
|
.wrapper {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
width: 295px;
|
|
135
|
+
max-width: 295px;
|
|
136
|
+
border-radius: var(--cc-bubble-border-radius, 15px);
|
|
137
137
|
background-color: var(--cc-white, #ffffff);
|
|
138
138
|
color: rgba(0, 0, 0, 0.8);
|
|
139
139
|
box-shadow: var(--cc-message-shadow, rgba(151, 124, 156, 0.1) 0px 5px 9px 0px,
|
|
@@ -160,4 +160,10 @@ onMounted(() => {
|
|
|
160
160
|
.mainButtonWrapper {
|
|
161
161
|
padding: 16px;
|
|
162
162
|
}
|
|
163
|
+
|
|
164
|
+
.mainButtonWrapper button,
|
|
165
|
+
.mainButtonWrapper a {
|
|
166
|
+
width: 100%;
|
|
167
|
+
box-sizing: border-box;
|
|
168
|
+
}
|
|
163
169
|
</style>
|
|
@@ -128,9 +128,10 @@
|
|
|
128
128
|
"
|
|
129
129
|
:config="config"
|
|
130
130
|
:dataMessageId="dataMessageId"
|
|
131
|
-
:
|
|
132
|
-
:
|
|
131
|
+
:open-x-app-overlay="openXAppOverlay"
|
|
132
|
+
:on-emit-analytics="onEmitAnalytics"
|
|
133
133
|
size="large"
|
|
134
|
+
:variant="isHeaderElement ? 'primary' : 'secondary'"
|
|
134
135
|
/>
|
|
135
136
|
|
|
136
137
|
<!-- Divider after item -->
|
|
@@ -309,19 +310,14 @@ const handleKeyDown = (event: KeyboardEvent) => {
|
|
|
309
310
|
}
|
|
310
311
|
|
|
311
312
|
.itemTitleWithSubtitle {
|
|
312
|
-
margin-top:
|
|
313
|
-
margin-bottom:
|
|
314
|
-
font-size: 0.9375rem; /* 15px */
|
|
315
|
-
font-weight: bold;
|
|
316
|
-
line-height: 1.45em; /* 23.2px */
|
|
313
|
+
margin-top: 0px;
|
|
314
|
+
margin-bottom: 8px;
|
|
317
315
|
}
|
|
318
316
|
|
|
319
317
|
.itemSubtitle {
|
|
320
318
|
margin: 0;
|
|
321
319
|
color: rgba(0, 0, 0, 0.54);
|
|
322
|
-
font-size: 0.8125rem; /* 13px */
|
|
323
320
|
white-space: pre-line;
|
|
324
|
-
line-height: 1.45em; /* 14.5px */
|
|
325
321
|
}
|
|
326
322
|
|
|
327
323
|
/* Regular list item styles */
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
:containerClassName="containerClassName"
|
|
19
19
|
:containerStyle="containerStyle"
|
|
20
20
|
:config="config"
|
|
21
|
-
:
|
|
21
|
+
:on-emit-analytics="onEmitAnalytics"
|
|
22
22
|
:templateTextId="webchatButtonTemplateTextId"
|
|
23
|
-
:
|
|
23
|
+
:open-x-app-overlay="openXAppOverlay"
|
|
24
24
|
showUrlIcon
|
|
25
25
|
/>
|
|
26
26
|
</div>
|
|
@@ -287,7 +287,7 @@ onMounted(() => {
|
|
|
287
287
|
border-top: none;
|
|
288
288
|
border-radius: 0 0 var(--cc-bubble-border-radius, 15px) var(--cc-bubble-border-radius, 15px);
|
|
289
289
|
cursor: pointer;
|
|
290
|
-
font-size: 14px;
|
|
290
|
+
font-size: var(--cc-font-size, 14px);
|
|
291
291
|
font-weight: 600;
|
|
292
292
|
transition: background-color 0.2s ease;
|
|
293
293
|
}
|
package/src/index.ts
CHANGED
|
@@ -43,7 +43,7 @@ export { DownloadIcon, CloseIcon, VideoPlayIcon, AudioPlayIcon, AudioPauseIcon,
|
|
|
43
43
|
// Utilities
|
|
44
44
|
export { match, getChannelPayload } from './utils/matcher'
|
|
45
45
|
export { sanitizeHTMLWithConfig, sanitizeContent } from './utils/sanitize'
|
|
46
|
-
export { configColorsToCssVariables, themeFontToCssVariable } from './utils/theme'
|
|
46
|
+
export { configColorsToCssVariables, themeFontToCssVariable, themeFontSizeToCssVariable } from './utils/theme'
|
|
47
47
|
export { getWebchatButtonLabel, interpolateString, getRandomId, moveFocusToMessageFocusTarget, replaceUrlsWithHTMLanchorElem, getBackgroundImage, getFileName, getFileExtension, getSizeLabel, isImageAttachment, VALID_IMAGE_MIME_TYPES } from './utils/helpers'
|
|
48
48
|
|
|
49
49
|
// Types
|
package/src/types/index.ts
CHANGED
package/src/utils/theme.ts
CHANGED
|
@@ -97,3 +97,21 @@ export function themeFontToCssVariable(
|
|
|
97
97
|
if (!theme?.fontFamily) return {}
|
|
98
98
|
return { '--cc-font-family': theme.fontFamily }
|
|
99
99
|
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Maps a ChatTheme's fontSize to the --cc-font-size CSS variable.
|
|
103
|
+
* Consumers can set this to scale all text proportionally.
|
|
104
|
+
*
|
|
105
|
+
* Components should reference font-size as:
|
|
106
|
+
* font-size: var(--cc-font-size, 14px); (for 14px base)
|
|
107
|
+
* font-size: calc(var(--cc-font-size, 14px) * 1.2857); (for 18px base)
|
|
108
|
+
*
|
|
109
|
+
* @param theme - The ChatTheme object
|
|
110
|
+
* @returns A record with the --cc-font-size CSS variable, or empty object
|
|
111
|
+
*/
|
|
112
|
+
export function themeFontSizeToCssVariable(
|
|
113
|
+
theme?: ChatTheme
|
|
114
|
+
): Record<string, string> {
|
|
115
|
+
if (!theme?.fontSize) return {}
|
|
116
|
+
return { '--cc-font-size': theme.fontSize }
|
|
117
|
+
}
|