rio-assist-widget 0.1.14 → 0.1.23

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/index.html CHANGED
@@ -28,7 +28,7 @@
28
28
  data-title="Rio Insight"
29
29
  data-button-label="Rio Insight"
30
30
  data-placeholder="Pergunte alguma coisa"
31
- data-suggestions="Veículos com problemas|Valor das peças|Planos de manutenção"
31
+ data-suggestions="Resumo da Frota|Frota Disponível|Chamados Abertos|Parados + Causas|Aguardando Peças|Principais Gargalos|Tempo por Concessionária|Tempo de Ciclo|Preventiva x Corretiva"
32
32
  data-accent-color="#c02267"
33
33
  ></rio-assist-widget>
34
34
 
@@ -36,4 +36,3 @@
36
36
  <script type="module" src="/src/playground.ts"></script>
37
37
  </body>
38
38
  </html>
39
- </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rio-assist-widget",
3
- "version": "0.1.14",
3
+ "version": "0.1.23",
4
4
  "description": "Web Component do painel lateral Rio Insight, pronto para ser embutido em qualquer projeto.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -286,11 +286,17 @@ export const conversationsPanelStyles = css`
286
286
  height: 16px;
287
287
  }
288
288
 
289
- .conversation-loading {
290
- font-size: 13px;
291
- color: #4b5b68;
292
- padding: 6px 12px 2px;
293
- }
289
+ .conversation-loading {
290
+ font-size: 13px;
291
+ color: #4b5b68;
292
+ padding: 6px 12px 2px;
293
+ }
294
+
295
+ .conversation-error {
296
+ font-size: 13px;
297
+ color: #a33c3c;
298
+ padding: 6px 12px 2px;
299
+ }
294
300
 
295
301
  .new-conversation-cta {
296
302
  overflow: hidden;
@@ -168,18 +168,21 @@ const renderConversationSurface = (
168
168
  </div>
169
169
 
170
170
  <div
171
- class=${classMap({
172
- 'conversation-list-wrapper': true,
173
- 'conversation-list-wrapper--sidebar': isSidebar,
174
- })}
175
- >
176
- ${component.conversationHistoryLoading
177
- ? html`<div class="conversation-loading">Carregando conversas...</div>`
178
- : null}
179
- ${list}
180
- ${isSidebar
181
- ? html`
182
- <div
171
+ class=${classMap({
172
+ 'conversation-list-wrapper': true,
173
+ 'conversation-list-wrapper--sidebar': isSidebar,
174
+ })}
175
+ >
176
+ ${component.conversationHistoryLoading
177
+ ? html`<div class="conversation-loading">Carregando conversas...</div>`
178
+ : null}
179
+ ${component.conversationHistoryError
180
+ ? html`<div class="conversation-error">${component.conversationHistoryError}</div>`
181
+ : null}
182
+ ${list}
183
+ ${isSidebar
184
+ ? html`
185
+ <div
183
186
  class=${classMap({
184
187
  'conversation-scrollbar': true,
185
188
  'conversation-scrollbar--visible':
@@ -232,14 +232,46 @@ export const miniPanelStyles = css`
232
232
  text-align: right;
233
233
  }
234
234
 
235
- .typing {
236
- font-style: italic;
237
- opacity: 0.75;
238
- }
239
-
240
- .message--user time {
241
- margin-top: 3px;
242
- }
235
+ .typing {
236
+ font-style: italic;
237
+ opacity: 0.75;
238
+ }
239
+
240
+ .typing__dots {
241
+ display: inline-flex;
242
+ gap: 2px;
243
+ margin-left: 4px;
244
+ }
245
+
246
+ .typing__dots span {
247
+ display: inline-block;
248
+ animation: typing-bounce 1.2s infinite;
249
+ }
250
+
251
+ .typing__dots span:nth-child(2) {
252
+ animation-delay: 0.2s;
253
+ }
254
+
255
+ .typing__dots span:nth-child(3) {
256
+ animation-delay: 0.4s;
257
+ }
258
+
259
+ @keyframes typing-bounce {
260
+ 0%,
261
+ 80%,
262
+ 100% {
263
+ transform: translateY(0);
264
+ opacity: 0.25;
265
+ }
266
+ 40% {
267
+ transform: translateY(-4px);
268
+ opacity: 1;
269
+ }
270
+ }
271
+
272
+ .message--user time {
273
+ margin-top: 3px;
274
+ }
243
275
 
244
276
  .panel-footer {
245
277
  width: 100%;
@@ -251,11 +283,12 @@ export const miniPanelStyles = css`
251
283
  margin-top: auto;
252
284
  }
253
285
 
254
- .suggestions {
255
- display: inline-flex;
256
- gap: 12px;
257
- justify-content: center;
258
- }
286
+ .suggestions {
287
+ display: flex;
288
+ flex-wrap: wrap;
289
+ gap: 12px;
290
+ justify-content: center;
291
+ }
259
292
 
260
293
  .suggestions-wrapper {
261
294
  width: 100%;
@@ -47,7 +47,10 @@ export const renderChatSurface = (component: RioAssistWidget) => {
47
47
  ${component.isLoading
48
48
  ? html`
49
49
  <div class="message message--assistant typing">
50
- <span>Rio Insight está respondendo...</span>
50
+ <span>${component.loadingLabel}</span>
51
+ <span class="typing__dots" aria-hidden="true">
52
+ <span>.</span><span>.</span><span>.</span>
53
+ </span>
51
54
  </div>
52
55
  `
53
56
  : null}
@@ -22,6 +22,80 @@ const baseStyles = css`
22
22
  border-radius: 999px;
23
23
  transition: transform 0.2s ease, box-shadow 0.2s ease;
24
24
  }
25
+
26
+ .dialog-overlay {
27
+ position: fixed;
28
+ inset: 0;
29
+ background: rgba(0, 0, 0, 0.35);
30
+ display: grid;
31
+ place-items: center;
32
+ z-index: 2147484000;
33
+ pointer-events: auto;
34
+ }
35
+
36
+ .dialog {
37
+ width: min(360px, calc(100% - 32px));
38
+ background: #fff;
39
+ border-radius: 12px;
40
+ box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
41
+ padding: 20px;
42
+ display: flex;
43
+ flex-direction: column;
44
+ gap: 16px;
45
+ }
46
+
47
+ .dialog__message {
48
+ margin: 0;
49
+ font-size: 16px;
50
+ color: #1f2f36;
51
+ }
52
+
53
+ .dialog__input {
54
+ width: 100%;
55
+ box-sizing: border-box;
56
+ padding: 10px 12px;
57
+ border-radius: 8px;
58
+ border: 1px solid #c7d0d9;
59
+ font: inherit;
60
+ outline: none;
61
+ }
62
+
63
+ .dialog__input:focus {
64
+ border-color: var(--accent-color, #008b9a);
65
+ box-shadow: 0 0 0 2px rgba(0, 139, 154, 0.2);
66
+ }
67
+
68
+ .dialog__actions {
69
+ display: flex;
70
+ justify-content: flex-end;
71
+ gap: 10px;
72
+ }
73
+
74
+ .dialog__button {
75
+ min-width: 96px;
76
+ height: 36px;
77
+ padding: 0 14px;
78
+ border-radius: 8px;
79
+ border: 1px solid transparent;
80
+ font-weight: 600;
81
+ transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
82
+ }
83
+
84
+ .dialog__button--ghost {
85
+ background: #fff;
86
+ border-color: #c7d0d9;
87
+ color: #1f2f36;
88
+ }
89
+
90
+ .dialog__button--danger {
91
+ background: #d9534f;
92
+ color: #fff;
93
+ }
94
+
95
+ .dialog__button--primary {
96
+ background: var(--accent-color, #008b9a);
97
+ color: #fff;
98
+ }
25
99
  `;
26
100
 
27
101
  export const widgetStyles = [
@@ -16,6 +16,54 @@ export const renderRioAssist = (component: RioAssistWidget) => {
16
16
  ${renderFloatingButton(component)}
17
17
  ${renderMiniPanel(component)}
18
18
  ${component.isFullscreen ? renderFullscreen(component) : null}
19
+ ${component.renameConversationTarget
20
+ ? html`
21
+ <div class="dialog-overlay" role="dialog" aria-modal="true">
22
+ <div class="dialog">
23
+ <p class="dialog__message">Digite o novo título para a conversa:</p>
24
+ <input
25
+ class="dialog__input"
26
+ type="text"
27
+ .value=${component.renameConversationTarget.draft}
28
+ @input=${(event: InputEvent) => component.handleRenameDraft(event)}
29
+ aria-label="Novo titulo da conversa"
30
+ />
31
+ <div class="dialog__actions">
32
+ <button type="button" class="dialog__button dialog__button--ghost" @click=${() =>
33
+ component.cancelRenameConversation()}>
34
+ Cancelar
35
+ </button>
36
+ <button
37
+ type="button"
38
+ class="dialog__button dialog__button--primary"
39
+ @click=${() => component.confirmRenameConversation()}
40
+ >
41
+ Renomear
42
+ </button>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ `
47
+ : null}
48
+ ${component.deleteConversationTarget
49
+ ? html`
50
+ <div class="dialog-overlay" role="dialog" aria-modal="true">
51
+ <div class="dialog">
52
+ <p class="dialog__message">Deseja realmente excluir essa conversa?</p>
53
+ <div class="dialog__actions">
54
+ <button type="button" class="dialog__button dialog__button--ghost" @click=${() =>
55
+ component.cancelDeleteConversation()}>
56
+ Cancelar
57
+ </button>
58
+ <button type="button" class="dialog__button dialog__button--danger" @click=${() =>
59
+ component.confirmDeleteConversation()}>
60
+ Excluir
61
+ </button>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ `
66
+ : null}
19
67
  </div>
20
68
  `;
21
69
  };