@cognigy/chat-components-vue 0.3.0 → 0.3.1

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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognigy/chat-components-vue",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Vue 3 version of @cognigy/chat-components",
6
6
  "license": "MIT",
@@ -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"
@@ -131,9 +131,9 @@ onMounted(() => {
131
131
 
132
132
  <style module>
133
133
  .wrapper {
134
- max-width: 250px;
135
- border-radius: var(--cc-bubble-border-radius, 16px);
136
- overflow: hidden;
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,
@@ -131,6 +131,7 @@
131
131
  :openXAppOverlay="openXAppOverlay"
132
132
  :onEmitAnalytics="onEmitAnalytics"
133
133
  size="large"
134
+ :variant="isHeaderElement ? 'primary' : 'secondary'"
134
135
  />
135
136
 
136
137
  <!-- Divider after item -->
@@ -309,19 +310,15 @@ const handleKeyDown = (event: KeyboardEvent) => {
309
310
  }
310
311
 
311
312
  .itemTitleWithSubtitle {
312
- margin-top: 2px;
313
- margin-bottom: 5px;
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
- margin: 0;
318
+ margin-top: 0px;
319
+ margin-bottom: 0px;
321
320
  color: rgba(0, 0, 0, 0.54);
322
- font-size: 0.8125rem; /* 13px */
323
321
  white-space: pre-line;
324
- line-height: 1.45em; /* 14.5px */
325
322
  }
326
323
 
327
324
  /* Regular list item styles */
@@ -340,7 +337,7 @@ const handleKeyDown = (event: KeyboardEvent) => {
340
337
  }
341
338
 
342
339
  .listItemContent {
343
- padding: 10px;
340
+ padding: 16px 16px 12px 16px;
344
341
  overflow-wrap: break-word;
345
342
  display: flex;
346
343
  -webkit-box-pack: justify;