@brandsync/wc 0.0.7 → 0.0.9

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.
Files changed (195) hide show
  1. package/custom-elements.json +1810 -355
  2. package/dist/brandsync-wc/brandsync-wc.esm.js +1 -1
  3. package/dist/brandsync-wc/p-0d64ea40.entry.js +1 -0
  4. package/dist/brandsync-wc/{p-c63d16e1.entry.js → p-1515498e.entry.js} +1 -1
  5. package/dist/brandsync-wc/p-16a54578.entry.js +1 -0
  6. package/dist/brandsync-wc/p-18af02df.entry.js +1 -0
  7. package/dist/brandsync-wc/p-30a0e168.entry.js +1 -0
  8. package/dist/brandsync-wc/p-3dacae70.entry.js +1 -0
  9. package/dist/brandsync-wc/p-5333bb5a.entry.js +1 -0
  10. package/dist/brandsync-wc/p-575ce905.entry.js +1 -0
  11. package/dist/brandsync-wc/{p-dd0fea0e.entry.js → p-7776b57b.entry.js} +1 -1
  12. package/dist/brandsync-wc/{p-bfd09c98.entry.js → p-805644e4.entry.js} +1 -1
  13. package/dist/brandsync-wc/{p-f88d9a6e.entry.js → p-8a78d6ea.entry.js} +1 -1
  14. package/dist/brandsync-wc/p-8d12ed96.entry.js +1 -0
  15. package/dist/brandsync-wc/p-94ed898a.entry.js +1 -0
  16. package/dist/brandsync-wc/{p-9e5d2211.entry.js → p-96f374be.entry.js} +1 -1
  17. package/dist/brandsync-wc/{p-ab5cc7af.entry.js → p-a34f460d.entry.js} +1 -1
  18. package/dist/brandsync-wc/p-bc72439a.entry.js +1 -0
  19. package/dist/brandsync-wc/{p-76eca100.entry.js → p-ce0914a7.entry.js} +1 -1
  20. package/dist/brandsync-wc/{p-5a0fe72e.entry.js → p-d682675e.entry.js} +1 -1
  21. package/dist/brandsync-wc/p-dad4a92c.entry.js +1 -0
  22. package/dist/brandsync-wc/{p-cfc3421b.entry.js → p-dd747a12.entry.js} +1 -1
  23. package/dist/brandsync-wc/{p-2742ecef.entry.js → p-eb4d87f0.entry.js} +1 -1
  24. package/dist/cjs/brandsync-wc.cjs.js +1 -1
  25. package/dist/cjs/bs-ai-disclaimer.cjs.entry.js +17 -0
  26. package/dist/cjs/bs-ai-greeting.cjs.entry.js +24 -0
  27. package/dist/cjs/bs-ai-thinking.cjs.entry.js +2 -2
  28. package/dist/cjs/bs-attachment-list.cjs.entry.js +47 -0
  29. package/dist/cjs/bs-attachment.cjs.entry.js +46 -0
  30. package/dist/cjs/bs-badge.cjs.entry.js +1 -1
  31. package/dist/cjs/bs-button-skeleton.cjs.entry.js +1 -1
  32. package/dist/cjs/bs-button.cjs.entry.js +1 -1
  33. package/dist/cjs/bs-card.cjs.entry.js +1 -1
  34. package/dist/cjs/bs-chatbot-feedback.cjs.entry.js +94 -0
  35. package/dist/cjs/bs-chatbot-header.cjs.entry.js +1 -1
  36. package/dist/cjs/bs-chatbot-response-action.cjs.entry.js +1 -1
  37. package/dist/cjs/bs-chatbot-sources-drawer.cjs.entry.js +38 -0
  38. package/dist/cjs/bs-chatbot-suggestion-button.cjs.entry.js +1 -1
  39. package/dist/cjs/bs-composer-status-banner.cjs.entry.js +43 -0
  40. package/dist/cjs/bs-composer.cjs.entry.js +16 -2
  41. package/dist/cjs/bs-data-table.cjs.entry.js +2 -2
  42. package/dist/cjs/bs-input.cjs.entry.js +270 -4
  43. package/dist/cjs/{bs-menu-item.cjs.entry.js → bs-menu_2.cjs.entry.js} +14 -1
  44. package/dist/cjs/bs-source-link.cjs.entry.js +39 -0
  45. package/dist/cjs/bs-tooltip.cjs.entry.js +1 -1
  46. package/dist/cjs/loader.cjs.js +1 -1
  47. package/dist/collection/collection-manifest.json +8 -0
  48. package/dist/collection/components/bs-ai-chatbot/bs-ai-chatbot.stories.js +180 -0
  49. package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.cmp.test.js +14 -0
  50. package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.css +27 -0
  51. package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.js +41 -0
  52. package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.stories.js +15 -0
  53. package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.cmp.test.js +22 -0
  54. package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.css +53 -0
  55. package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.js +103 -0
  56. package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.stories.js +23 -0
  57. package/dist/collection/components/bs-ai-thinking/bs-ai-thinking.css +31 -17
  58. package/dist/collection/components/bs-ai-thinking/bs-ai-thinking.js +9 -11
  59. package/dist/collection/components/bs-attachment/bs-attachment.cmp.test.js +41 -0
  60. package/dist/collection/components/bs-attachment/bs-attachment.css +184 -0
  61. package/dist/collection/components/bs-attachment/bs-attachment.js +230 -0
  62. package/dist/collection/components/bs-attachment/bs-attachment.stories.js +58 -0
  63. package/dist/collection/components/bs-attachment-list/bs-attachment-list.cmp.test.js +28 -0
  64. package/dist/collection/components/bs-attachment-list/bs-attachment-list.css +56 -0
  65. package/dist/collection/components/bs-attachment-list/bs-attachment-list.js +105 -0
  66. package/dist/collection/components/bs-attachment-list/bs-attachment-list.stories.js +47 -0
  67. package/dist/collection/components/bs-badge/bs-badge.js +1 -1
  68. package/dist/collection/components/bs-button/bs-button.js +1 -1
  69. package/dist/collection/components/bs-button-skeleton/bs-button-skeleton.js +1 -1
  70. package/dist/collection/components/bs-card/bs-card.js +1 -1
  71. package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.cmp.test.js +73 -0
  72. package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.css +253 -0
  73. package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.js +324 -0
  74. package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.stories.js +54 -0
  75. package/dist/collection/components/bs-chatbot-header/bs-chatbot-header.js +1 -1
  76. package/dist/collection/components/bs-chatbot-response-action/bs-chatbot-response-action.js +1 -1
  77. package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.cmp.test.js +34 -0
  78. package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.css +106 -0
  79. package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.js +142 -0
  80. package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.stories.js +44 -0
  81. package/dist/collection/components/bs-chatbot-suggestion-button/bs-chatbot-suggestion-button.js +1 -1
  82. package/dist/collection/components/bs-composer/bs-composer.cmp.test.js +12 -0
  83. package/dist/collection/components/bs-composer/bs-composer.css +10 -0
  84. package/dist/collection/components/bs-composer/bs-composer.js +25 -1
  85. package/dist/collection/components/bs-composer/bs-composer.stories.js +13 -0
  86. package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.cmp.test.js +42 -0
  87. package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.css +173 -0
  88. package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.js +270 -0
  89. package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.stories.js +75 -0
  90. package/dist/collection/components/bs-data-table/bs-data-table.js +2 -2
  91. package/dist/collection/components/bs-input/bs-input.cmp.test.js +296 -0
  92. package/dist/collection/components/bs-input/bs-input.css +333 -23
  93. package/dist/collection/components/bs-input/bs-input.js +647 -11
  94. package/dist/collection/components/bs-input/bs-input.stories.js +128 -1
  95. package/dist/collection/components/bs-menu/bs-menu.js +1 -1
  96. package/dist/collection/components/bs-menu-item/bs-menu-item.js +1 -1
  97. package/dist/collection/components/bs-source-link/bs-source-link.cmp.test.js +42 -0
  98. package/dist/collection/components/bs-source-link/bs-source-link.css +114 -0
  99. package/dist/collection/components/bs-source-link/bs-source-link.js +192 -0
  100. package/dist/collection/components/bs-source-link/bs-source-link.stories.js +33 -0
  101. package/dist/collection/components/bs-tooltip/bs-tooltip.js +1 -1
  102. package/dist/components/bs-ai-disclaimer.d.ts +11 -0
  103. package/dist/components/bs-ai-disclaimer.js +1 -0
  104. package/dist/components/bs-ai-greeting.d.ts +11 -0
  105. package/dist/components/bs-ai-greeting.js +1 -0
  106. package/dist/components/bs-ai-thinking.js +1 -1
  107. package/dist/components/bs-attachment-list.d.ts +11 -0
  108. package/dist/components/bs-attachment-list.js +1 -0
  109. package/dist/components/bs-attachment.d.ts +11 -0
  110. package/dist/components/bs-attachment.js +1 -0
  111. package/dist/components/bs-badge.js +1 -1
  112. package/dist/components/bs-button-skeleton.js +1 -1
  113. package/dist/components/bs-button.js +1 -1
  114. package/dist/components/bs-card.js +1 -1
  115. package/dist/components/bs-chatbot-feedback.d.ts +11 -0
  116. package/dist/components/bs-chatbot-feedback.js +1 -0
  117. package/dist/components/bs-chatbot-header.js +1 -1
  118. package/dist/components/bs-chatbot-response-action.js +1 -1
  119. package/dist/components/bs-chatbot-sources-drawer.d.ts +11 -0
  120. package/dist/components/bs-chatbot-sources-drawer.js +1 -0
  121. package/dist/components/bs-chatbot-suggestion-button.js +1 -1
  122. package/dist/components/bs-composer-status-banner.d.ts +11 -0
  123. package/dist/components/bs-composer-status-banner.js +1 -0
  124. package/dist/components/bs-composer.js +1 -1
  125. package/dist/components/bs-data-table.js +1 -1
  126. package/dist/components/bs-input.js +1 -1
  127. package/dist/components/bs-menu-item.js +1 -1
  128. package/dist/components/bs-menu.js +1 -1
  129. package/dist/components/bs-source-link.d.ts +11 -0
  130. package/dist/components/bs-source-link.js +1 -0
  131. package/dist/components/bs-tooltip.js +1 -1
  132. package/dist/components/{p-CoC4LQCI.js → p-Cz2nfz2j.js} +1 -1
  133. package/dist/components/p-DndQiCMP.js +1 -0
  134. package/dist/components/p-_vXDfB3V.js +1 -0
  135. package/dist/esm/brandsync-wc.js +1 -1
  136. package/dist/esm/bs-ai-disclaimer.entry.js +15 -0
  137. package/dist/esm/bs-ai-greeting.entry.js +22 -0
  138. package/dist/esm/bs-ai-thinking.entry.js +2 -2
  139. package/dist/esm/bs-attachment-list.entry.js +45 -0
  140. package/dist/esm/bs-attachment.entry.js +44 -0
  141. package/dist/esm/bs-badge.entry.js +1 -1
  142. package/dist/esm/bs-button-skeleton.entry.js +1 -1
  143. package/dist/esm/bs-button.entry.js +1 -1
  144. package/dist/esm/bs-card.entry.js +1 -1
  145. package/dist/esm/bs-chatbot-feedback.entry.js +92 -0
  146. package/dist/esm/bs-chatbot-header.entry.js +1 -1
  147. package/dist/esm/bs-chatbot-response-action.entry.js +1 -1
  148. package/dist/esm/bs-chatbot-sources-drawer.entry.js +36 -0
  149. package/dist/esm/bs-chatbot-suggestion-button.entry.js +1 -1
  150. package/dist/esm/bs-composer-status-banner.entry.js +41 -0
  151. package/dist/esm/bs-composer.entry.js +17 -3
  152. package/dist/esm/bs-data-table.entry.js +2 -2
  153. package/dist/esm/bs-input.entry.js +271 -5
  154. package/dist/esm/{bs-menu-item.entry.js → bs-menu_2.entry.js} +15 -3
  155. package/dist/esm/bs-source-link.entry.js +37 -0
  156. package/dist/esm/bs-tooltip.entry.js +1 -1
  157. package/dist/esm/loader.js +1 -1
  158. package/dist/types/components/bs-ai-chatbot/bs-ai-chatbot.stories.d.ts +18 -0
  159. package/dist/types/components/bs-ai-disclaimer/bs-ai-disclaimer.cmp.test.d.ts +1 -0
  160. package/dist/types/components/bs-ai-disclaimer/bs-ai-disclaimer.d.ts +26 -0
  161. package/dist/types/components/bs-ai-disclaimer/bs-ai-disclaimer.stories.d.ts +8 -0
  162. package/dist/types/components/bs-ai-greeting/bs-ai-greeting.cmp.test.d.ts +1 -0
  163. package/dist/types/components/bs-ai-greeting/bs-ai-greeting.d.ts +42 -0
  164. package/dist/types/components/bs-ai-greeting/bs-ai-greeting.stories.d.ts +10 -0
  165. package/dist/types/components/bs-ai-thinking/bs-ai-thinking.d.ts +8 -10
  166. package/dist/types/components/bs-attachment/bs-attachment.cmp.test.d.ts +1 -0
  167. package/dist/types/components/bs-attachment/bs-attachment.d.ts +59 -0
  168. package/dist/types/components/bs-attachment/bs-attachment.stories.d.ts +17 -0
  169. package/dist/types/components/bs-attachment-list/bs-attachment-list.cmp.test.d.ts +1 -0
  170. package/dist/types/components/bs-attachment-list/bs-attachment-list.d.ts +42 -0
  171. package/dist/types/components/bs-attachment-list/bs-attachment-list.stories.d.ts +10 -0
  172. package/dist/types/components/bs-chatbot-feedback/bs-chatbot-feedback.cmp.test.d.ts +1 -0
  173. package/dist/types/components/bs-chatbot-feedback/bs-chatbot-feedback.d.ts +90 -0
  174. package/dist/types/components/bs-chatbot-feedback/bs-chatbot-feedback.stories.d.ts +16 -0
  175. package/dist/types/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.cmp.test.d.ts +1 -0
  176. package/dist/types/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.d.ts +54 -0
  177. package/dist/types/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.stories.d.ts +10 -0
  178. package/dist/types/components/bs-composer/bs-composer.d.ts +14 -0
  179. package/dist/types/components/bs-composer/bs-composer.stories.d.ts +1 -0
  180. package/dist/types/components/bs-composer-status-banner/bs-composer-status-banner.cmp.test.d.ts +1 -0
  181. package/dist/types/components/bs-composer-status-banner/bs-composer-status-banner.d.ts +88 -0
  182. package/dist/types/components/bs-composer-status-banner/bs-composer-status-banner.stories.d.ts +20 -0
  183. package/dist/types/components/bs-input/bs-input.d.ts +139 -6
  184. package/dist/types/components/bs-input/bs-input.stories.d.ts +19 -0
  185. package/dist/types/components/bs-source-link/bs-source-link.cmp.test.d.ts +1 -0
  186. package/dist/types/components/bs-source-link/bs-source-link.d.ts +51 -0
  187. package/dist/types/components/bs-source-link/bs-source-link.stories.d.ts +13 -0
  188. package/dist/types/components.d.ts +1778 -55
  189. package/package.json +1 -1
  190. package/dist/brandsync-wc/p-6abdfaf0.entry.js +0 -1
  191. package/dist/brandsync-wc/p-6c1fa4da.entry.js +0 -1
  192. package/dist/brandsync-wc/p-a12d0a60.entry.js +0 -1
  193. package/dist/brandsync-wc/p-f5f443e2.entry.js +0 -1
  194. package/dist/cjs/bs-menu.cjs.entry.js +0 -17
  195. package/dist/esm/bs-menu.entry.js +0 -15
@@ -0,0 +1,324 @@
1
+ import { h } from "@stencil/core";
2
+ const RATING_COPY = {
3
+ 1: { heading: "We're sorry we couldn't help.", subtitle: "We'll use your feedback to improve." },
4
+ 2: { heading: "We're sorry we didn't get it right.", subtitle: "We'll use your feedback to improve." },
5
+ 3: { heading: 'Thanks for your feedback.', subtitle: "We're always looking for ways to improve." },
6
+ 4: { heading: "Thanks! We're glad we could help.", subtitle: 'We appreciate your feedback.' },
7
+ 5: { heading: 'Thanks for the great rating!', subtitle: "We're happy we could help." },
8
+ };
9
+ const DEFAULT_HEADING = 'How was your experience with us?';
10
+ const DEFAULT_SUBTITLE = 'Your feedback helps us make Genie better.';
11
+ /**
12
+ * A star-rating feedback card shown at the end of a Genie AI chat: a heading/subtitle, a 5-star
13
+ * rating, an optional comment, and either "Submit feedback" + "Start new chat" (before
14
+ * submitting) or just "Start new chat" (after).
15
+ *
16
+ * ## When to use
17
+ * - Prompting for feedback on a Genie response or chat session, typically after the user ends or
18
+ * restarts a conversation.
19
+ *
20
+ * ## When not to use
21
+ * - A generic star-rating input elsewhere in the product -- this component's copy and layout are
22
+ * purpose-built for the Genie feedback flow, not a reusable rating control.
23
+ *
24
+ * The heading and subtitle are not freeform props: before submitting, they're always the fixed
25
+ * "How was your experience..." copy; after submitting, they're determined entirely by `rating`
26
+ * (1-2 stars reads apologetic, 3 neutral, 4-5 positive), matching the Figma source exactly. Use
27
+ * `heading`/`subtitle` only if a consuming app genuinely needs to override that copy.
28
+ *
29
+ * @part close - The close button.
30
+ * @part heading - The heading text.
31
+ * @part subtitle - The subtitle text.
32
+ * @part star - A single star button (`::part(star)` matches all five).
33
+ * @part label - The "Tell us what you think" label (only rendered before submitting).
34
+ * @part textarea - The comment textarea (only rendered before submitting).
35
+ * @part comment - The submitted comment, read-only (only rendered after submitting, if a comment was given).
36
+ * @part submit - The "Submit feedback" button (only rendered before submitting).
37
+ * @part new-chat - The "Start new chat" button.
38
+ * @prop --bs-chatbot-feedback-bg - Card background. Aliased to `--bs-surface-raised`.
39
+ * @prop --bs-chatbot-feedback-border - Card border color. Aliased to `--bs-border-default`.
40
+ * @prop --bs-chatbot-feedback-radius - Card corner radius. Aliased to `--bs-border-radius-200`.
41
+ * @prop --bs-chatbot-feedback-padding-x - Card horizontal padding. Aliased to `--bs-spacing-250`.
42
+ * @prop --bs-chatbot-feedback-padding-y - Card vertical padding. Aliased to `--bs-spacing-550`.
43
+ * @prop --bs-chatbot-feedback-max-width - Max width of the card. Matches Figma's 762px.
44
+ * @prop --bs-chatbot-feedback-gap - Gap between the top content block and the button(s). Aliased
45
+ * to `--bs-spacing-300`.
46
+ * @prop --bs-chatbot-feedback-top-gap - Gap between heading/subtitle, stars, and the
47
+ * textarea/comment within the top block. Aliased to `--bs-spacing-250`.
48
+ * @prop --bs-chatbot-feedback-heading-color - Aliased to `--bs-text-default`.
49
+ * @prop --bs-chatbot-feedback-subtitle-color - Aliased to `--bs-text-secondary`.
50
+ * @prop --bs-chatbot-feedback-star-filled - Filled star color. Aliased to `--bs-color-primary-default`.
51
+ * @prop --bs-chatbot-feedback-star-empty - Empty star color. Aliased to `--bs-border-neutral-container`.
52
+ * @prop --bs-chatbot-feedback-comment-color - Submitted comment text color. Aliased to `--bs-text-default`.
53
+ * @prop --bs-chatbot-feedback-close-hover - Close button hover background. Aliased to `--bs-surface-hover`.
54
+ * @prop --bs-chatbot-feedback-primary-bg - "Submit feedback" / post-submit "Start new chat"
55
+ * background. Aliased to `--bs-button-primary-default`.
56
+ * @prop --bs-chatbot-feedback-primary-bg-hover - Aliased to `--bs-button-primary-hover`.
57
+ * @prop --bs-chatbot-feedback-primary-bg-disabled - Aliased to `--bs-button-primary-disabled`.
58
+ * @prop --bs-chatbot-feedback-outlined-border - Pre-submit "Start new chat" border. Aliased to
59
+ * `--bs-border-primary`.
60
+ * @prop --bs-chatbot-feedback-outlined-hover - Pre-submit "Start new chat" hover background.
61
+ * Aliased to `--bs-color-primary-container-hover`.
62
+ * @prop --bs-chatbot-feedback-outlined-text - Pre-submit "Start new chat" text/icon color.
63
+ * Aliased to `--bs-text-action`.
64
+ */
65
+ export class BsChatbotFeedback {
66
+ /** Current star rating, 0-5. 0 means no rating has been given yet. */
67
+ rating = 0;
68
+ /** Whether feedback has been submitted. Switches the card from the editable form to the
69
+ * read-only "thanks" view. */
70
+ submitted = false;
71
+ /** The comment text. */
72
+ comment = '';
73
+ /** Overrides the computed heading (see the class doc for why this is computed by default). */
74
+ heading;
75
+ /** Overrides the computed subtitle. */
76
+ subtitle;
77
+ /** Fires when a star is clicked, with the new rating. */
78
+ bsRatingChange;
79
+ /** Fires on every keystroke in the comment textarea, with the current value. */
80
+ bsCommentInput;
81
+ /** Fires when "Submit feedback" is clicked, with the current rating and comment. Also sets
82
+ * `submitted` to true. */
83
+ bsSubmit;
84
+ /** Fires when "Start new chat" is clicked. The consuming app owns actually starting a new chat. */
85
+ bsNewChat;
86
+ /** Fires when the close button is clicked. The consuming app owns actually hiding the card. */
87
+ bsClose;
88
+ onStarClick = (value) => {
89
+ if (this.submitted)
90
+ return;
91
+ this.rating = value;
92
+ this.bsRatingChange.emit(value);
93
+ };
94
+ onCommentInput = (ev) => {
95
+ this.comment = ev.target.value;
96
+ this.bsCommentInput.emit(this.comment);
97
+ };
98
+ onSubmitClick = () => {
99
+ if (this.rating === 0)
100
+ return;
101
+ this.submitted = true;
102
+ this.bsSubmit.emit({ rating: this.rating, comment: this.comment });
103
+ };
104
+ onNewChatClick = () => {
105
+ this.bsNewChat.emit();
106
+ };
107
+ onCloseClick = () => {
108
+ this.bsClose.emit();
109
+ };
110
+ computedHeading() {
111
+ if (this.heading)
112
+ return this.heading;
113
+ if (this.submitted && RATING_COPY[this.rating])
114
+ return RATING_COPY[this.rating].heading;
115
+ return DEFAULT_HEADING;
116
+ }
117
+ computedSubtitle() {
118
+ if (this.subtitle)
119
+ return this.subtitle;
120
+ if (this.submitted && RATING_COPY[this.rating])
121
+ return RATING_COPY[this.rating].subtitle;
122
+ return DEFAULT_SUBTITLE;
123
+ }
124
+ render() {
125
+ const stars = [1, 2, 3, 4, 5];
126
+ return (h("div", { key: 'e509feb04a65ee7908c9021befe43ddb0727fd00', class: "bs-chatbot-feedback", role: "region", "aria-label": this.computedHeading() }, h("button", { key: '3c1e7f84bb1a2e0e6f89323f2c45102c3714c0f6', type: "button", part: "close", class: "bs-chatbot-feedback__close", "aria-label": "Close", onClick: this.onCloseClick }, h(CloseIcon, { key: '30202380a79f55d4187ff6f50fc0a11d7a282b81' })), h("div", { key: '228f8195087f1d6d3ec6ba53f954ab722cae2971', class: "bs-chatbot-feedback__top" }, h("div", { key: 'd7fb1f58d21aed4fa9b0e5da83a5506e8082c5ff', class: "bs-chatbot-feedback__text" }, h("p", { key: '7e275ebb91562a2f3b4eaf8076a7238f82260bcf', part: "heading", class: "bs-chatbot-feedback__heading" }, this.computedHeading()), h("p", { key: '0bd022e0594dee0a084a83fcce90abeb2b8c8a98', part: "subtitle", class: "bs-chatbot-feedback__subtitle" }, this.computedSubtitle())), h("div", { key: '0c54cd7cfc1b14c4feac0859e1ad2dd3ee2af8a1', class: "bs-chatbot-feedback__stars", role: "radiogroup", "aria-label": "Rating" }, stars.map(value => (h("button", { type: "button", part: "star", class: "bs-chatbot-feedback__star", role: "radio", "aria-checked": (this.rating >= value).toString(), "aria-label": `${value} star${value > 1 ? 's' : ''}`, disabled: this.submitted, onClick: () => this.onStarClick(value) }, h(StarIcon, { filled: this.rating >= value }))))), !this.submitted && (h("div", { key: '4e00821d17646c1d71d9893a7459557f9fcf24d2', class: "bs-chatbot-feedback__field" }, h("label", { key: '11d31fb2ff6897e97e2ec4196ead7269d60cec7b', part: "label", class: "bs-chatbot-feedback__label", htmlFor: "bs-chatbot-feedback-comment" }, "Tell us what you think"), h("textarea", { key: 'd6228e4d737e90ab61cca91d633e36ac69f1c172', part: "textarea", id: "bs-chatbot-feedback-comment", class: "bs-chatbot-feedback__textarea", placeholder: "e.g.The response was helpful ....", value: this.comment, onInput: this.onCommentInput }))), this.submitted && this.comment && (h("p", { key: 'bb5fdd240b07a6051cb784077b3476af1e1217fb', part: "comment", class: "bs-chatbot-feedback__comment" }, this.comment))), h("div", { key: '0d262521f8f13b464f4cbfa746ce49bd330986c6', class: "bs-chatbot-feedback__actions" }, !this.submitted && (h("button", { key: 'a5e8cc2a7bdd290cc95afeefe5d1fc5a1dde86ce', type: "button", part: "submit", class: "bs-chatbot-feedback__submit", disabled: this.rating === 0, onClick: this.onSubmitClick }, h(SendIcon, { key: '163b0c11e0038ae01d7bc61ae1f8c50930b7f8f2' }), "Submit feedback")), h("button", { key: '3cf2d4b2cd6b9043d4194a991cc0e33fa09c69e4', type: "button", part: "new-chat", class: `bs-chatbot-feedback__new-chat ${this.submitted ? 'bs-chatbot-feedback__new-chat--primary' : 'bs-chatbot-feedback__new-chat--outlined'}`, onClick: this.onNewChatClick }, h(EditIcon, { key: 'a0fddede710c06b60302e4cb12b7affe9ed8afec' }), "Start new chat"))));
127
+ }
128
+ static get is() { return "bs-chatbot-feedback"; }
129
+ static get encapsulation() { return "shadow"; }
130
+ static get originalStyleUrls() {
131
+ return {
132
+ "$": ["bs-chatbot-feedback.css"]
133
+ };
134
+ }
135
+ static get styleUrls() {
136
+ return {
137
+ "$": ["bs-chatbot-feedback.css"]
138
+ };
139
+ }
140
+ static get properties() {
141
+ return {
142
+ "rating": {
143
+ "type": "number",
144
+ "mutable": true,
145
+ "complexType": {
146
+ "original": "number",
147
+ "resolved": "number",
148
+ "references": {}
149
+ },
150
+ "required": false,
151
+ "optional": false,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": "Current star rating, 0-5. 0 means no rating has been given yet."
155
+ },
156
+ "getter": false,
157
+ "setter": false,
158
+ "reflect": true,
159
+ "attribute": "rating",
160
+ "defaultValue": "0"
161
+ },
162
+ "submitted": {
163
+ "type": "boolean",
164
+ "mutable": true,
165
+ "complexType": {
166
+ "original": "boolean",
167
+ "resolved": "boolean",
168
+ "references": {}
169
+ },
170
+ "required": false,
171
+ "optional": false,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": "Whether feedback has been submitted. Switches the card from the editable form to the\nread-only \"thanks\" view."
175
+ },
176
+ "getter": false,
177
+ "setter": false,
178
+ "reflect": true,
179
+ "attribute": "submitted",
180
+ "defaultValue": "false"
181
+ },
182
+ "comment": {
183
+ "type": "string",
184
+ "mutable": true,
185
+ "complexType": {
186
+ "original": "string",
187
+ "resolved": "string",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "The comment text."
195
+ },
196
+ "getter": false,
197
+ "setter": false,
198
+ "reflect": false,
199
+ "attribute": "comment",
200
+ "defaultValue": "''"
201
+ },
202
+ "heading": {
203
+ "type": "string",
204
+ "mutable": false,
205
+ "complexType": {
206
+ "original": "string",
207
+ "resolved": "string",
208
+ "references": {}
209
+ },
210
+ "required": false,
211
+ "optional": true,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": "Overrides the computed heading (see the class doc for why this is computed by default)."
215
+ },
216
+ "getter": false,
217
+ "setter": false,
218
+ "reflect": false,
219
+ "attribute": "heading"
220
+ },
221
+ "subtitle": {
222
+ "type": "string",
223
+ "mutable": false,
224
+ "complexType": {
225
+ "original": "string",
226
+ "resolved": "string",
227
+ "references": {}
228
+ },
229
+ "required": false,
230
+ "optional": true,
231
+ "docs": {
232
+ "tags": [],
233
+ "text": "Overrides the computed subtitle."
234
+ },
235
+ "getter": false,
236
+ "setter": false,
237
+ "reflect": false,
238
+ "attribute": "subtitle"
239
+ }
240
+ };
241
+ }
242
+ static get events() {
243
+ return [{
244
+ "method": "bsRatingChange",
245
+ "name": "bsRatingChange",
246
+ "bubbles": true,
247
+ "cancelable": true,
248
+ "composed": true,
249
+ "docs": {
250
+ "tags": [],
251
+ "text": "Fires when a star is clicked, with the new rating."
252
+ },
253
+ "complexType": {
254
+ "original": "number",
255
+ "resolved": "number",
256
+ "references": {}
257
+ }
258
+ }, {
259
+ "method": "bsCommentInput",
260
+ "name": "bsCommentInput",
261
+ "bubbles": true,
262
+ "cancelable": true,
263
+ "composed": true,
264
+ "docs": {
265
+ "tags": [],
266
+ "text": "Fires on every keystroke in the comment textarea, with the current value."
267
+ },
268
+ "complexType": {
269
+ "original": "string",
270
+ "resolved": "string",
271
+ "references": {}
272
+ }
273
+ }, {
274
+ "method": "bsSubmit",
275
+ "name": "bsSubmit",
276
+ "bubbles": true,
277
+ "cancelable": true,
278
+ "composed": true,
279
+ "docs": {
280
+ "tags": [],
281
+ "text": "Fires when \"Submit feedback\" is clicked, with the current rating and comment. Also sets\n`submitted` to true."
282
+ },
283
+ "complexType": {
284
+ "original": "{ rating: number; comment: string }",
285
+ "resolved": "{ rating: number; comment: string; }",
286
+ "references": {}
287
+ }
288
+ }, {
289
+ "method": "bsNewChat",
290
+ "name": "bsNewChat",
291
+ "bubbles": true,
292
+ "cancelable": true,
293
+ "composed": true,
294
+ "docs": {
295
+ "tags": [],
296
+ "text": "Fires when \"Start new chat\" is clicked. The consuming app owns actually starting a new chat."
297
+ },
298
+ "complexType": {
299
+ "original": "void",
300
+ "resolved": "void",
301
+ "references": {}
302
+ }
303
+ }, {
304
+ "method": "bsClose",
305
+ "name": "bsClose",
306
+ "bubbles": true,
307
+ "cancelable": true,
308
+ "composed": true,
309
+ "docs": {
310
+ "tags": [],
311
+ "text": "Fires when the close button is clicked. The consuming app owns actually hiding the card."
312
+ },
313
+ "complexType": {
314
+ "original": "void",
315
+ "resolved": "void",
316
+ "references": {}
317
+ }
318
+ }];
319
+ }
320
+ }
321
+ const StarIcon = ({ filled }) => (h("svg", { viewBox: "0 0 24 24", fill: filled ? 'currentColor' : 'none', xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, h("path", { d: "M12 2.5L15.09 8.75L22 9.77L17 14.62L18.18 21.5L12 18.22L5.82 21.5L7 14.62L2 9.77L8.91 8.75L12 2.5Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })));
322
+ const SendIcon = () => (h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, h("path", { d: "M13.5 12H7.5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { d: "M4.55 20.75C4.44 20.99 4.47 21.27 4.63 21.48C4.79 21.69 5.05 21.79 5.31 21.75L21.37 12.65C21.6 12.52 21.75 12.27 21.75 12C21.75 11.73 21.6 11.48 21.37 11.35L5.31 2.25C5.05 2.21 4.79 2.31 4.63 2.52C4.47 2.73 4.44 3.01 4.55 3.25L7.5 12L4.55 20.75Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })));
323
+ const EditIcon = () => (h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, h("path", { d: "M16.5 3.5L20.5 7.5L8 20H4V16L16.5 3.5Z", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { d: "M14.5 5.5L18.5 9.5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })));
324
+ const CloseIcon = () => (h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, h("path", { d: "M15 5L5 15", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), h("path", { d: "M15 15L5 5", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })));
@@ -0,0 +1,54 @@
1
+ import { html } from "lit";
2
+ import { componentDescription, propDescription } from "../../stories-utils";
3
+ const meta = {
4
+ title: 'Genie AI Components/bs-chatbot-feedback',
5
+ parameters: { docs: { description: { component: componentDescription('bs-chatbot-feedback') } } },
6
+ render: args => html `
7
+ <bs-chatbot-feedback rating=${args.rating} ?submitted=${args.submitted} comment=${args.comment}></bs-chatbot-feedback>
8
+ `,
9
+ argTypes: {
10
+ rating: { control: { type: 'range', min: 0, max: 5, step: 1 }, description: propDescription('bs-chatbot-feedback', 'rating') },
11
+ submitted: { control: 'boolean', description: propDescription('bs-chatbot-feedback', 'submitted') },
12
+ comment: { control: 'text', description: propDescription('bs-chatbot-feedback', 'comment') },
13
+ },
14
+ args: {
15
+ rating: 0,
16
+ submitted: false,
17
+ comment: '',
18
+ },
19
+ };
20
+ export default meta;
21
+ export const Default = {};
22
+ export const OneStarSubmitted = {
23
+ name: '1 star (submitted)',
24
+ args: { rating: 1, submitted: true, comment: 'The response was helpful ....' },
25
+ };
26
+ export const TwoStarsSubmitted = {
27
+ name: '2 stars (submitted)',
28
+ args: { rating: 2, submitted: true, comment: 'The response was helpful ....' },
29
+ };
30
+ export const ThreeStarsSubmitted = {
31
+ name: '3 stars (submitted)',
32
+ args: { rating: 3, submitted: true, comment: 'The response was helpful ....' },
33
+ };
34
+ export const FourStarsSubmitted = {
35
+ name: '4 stars (submitted)',
36
+ args: { rating: 4, submitted: true, comment: 'The response was helpful ....' },
37
+ };
38
+ export const FiveStarsSubmitted = {
39
+ name: '5 stars (submitted)',
40
+ args: { rating: 5, submitted: true, comment: 'The response was helpful ....' },
41
+ };
42
+ export const AllStates = {
43
+ name: 'All states',
44
+ render: () => html `
45
+ <div style="display: grid; grid-template-columns: repeat(3, minmax(280px, 1fr)); gap: 16px;">
46
+ <bs-chatbot-feedback></bs-chatbot-feedback>
47
+ <bs-chatbot-feedback rating="1" submitted comment="The response was helpful ...."></bs-chatbot-feedback>
48
+ <bs-chatbot-feedback rating="2" submitted comment="The response was helpful ...."></bs-chatbot-feedback>
49
+ <bs-chatbot-feedback rating="3" submitted comment="The response was helpful ...."></bs-chatbot-feedback>
50
+ <bs-chatbot-feedback rating="4" submitted comment="The response was helpful ...."></bs-chatbot-feedback>
51
+ <bs-chatbot-feedback rating="5" submitted comment="The response was helpful ...."></bs-chatbot-feedback>
52
+ </div>
53
+ `,
54
+ };
@@ -74,7 +74,7 @@ export class BsChatbotHeader {
74
74
  this.bsClose.emit();
75
75
  };
76
76
  render() {
77
- return (h("div", { key: '9ae798e8d79c992933228383823d3160dc660f90', class: "bs-chatbot-header", role: "banner", "aria-label": this.heading }, h("div", { key: 'c80243df90e7ed74cea0679b94c139fc6bba8cc5', part: "logo", class: "bs-chatbot-header__logo", role: "img", "aria-label": this.heading, innerHTML: GENIE_LOGO_SVG }), h("div", { key: 'ebcfc959d4d7c606866870f1f107c4fc771d25b1', class: "bs-chatbot-header__actions" }, h("span", { key: '153e84f8e63faf67c180338da94e86d2b28da945', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: '76b48c5dcaf482dfbafacf8125a5c2908bbc27c3', type: "button", part: "new-chat", class: "bs-chatbot-header__button", "aria-label": "New chat", onClick: this.onNewChatClick }, h("slot", { key: 'b09177f97df5a1ddb20374d260858f0ae3afea12', name: "new-chat-icon" }, h(NewChatIcon, { key: 'a1907a4fd8730c83af15ad7dbf8ec1d784fac88d' }))), h("bs-tooltip", { key: '77b453884b760bf4687b26adbb06f6220c49dbca', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "New chat")), h("span", { key: '8b775f74bd28efa4b812f959658cae97ffce085f', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: '1a8c279aa94175b2d90654aa4d3c959273147a7c', type: "button", part: "history", class: "bs-chatbot-header__button", "aria-label": "History", onClick: this.onHistoryClick }, h("slot", { key: '8660d04481d3d846731e83b23c865e2bab1cbea7', name: "history-icon" }, h(HistoryIcon, { key: 'a34ed34be60fbc2869b34480342007aa59700177' }))), h("bs-tooltip", { key: '7ba408053f7b0e88330720d3dff4f188f233f46a', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "History")), h("span", { key: '4b4d24319a9b5b2085c8180748f72bfcc532a942', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: 'b9055bd0344465df6afb40aad28ea9565865751e', type: "button", part: "expand", class: "bs-chatbot-header__button", "aria-label": this.expanded ? 'Collapse' : 'Expand', "aria-pressed": this.expanded ? 'true' : 'false', onClick: this.onExpandClick }, h("slot", { key: '460b3c1d20f2a48945df6385e3ebf7f54577881e', name: "expand-icon" }, h(ExpandIcon, { key: '890b772fff27703a7d3da00ff4ad5f2844714075' }))), h("bs-tooltip", { key: 'b43756a31171e14b70bc80574741b28b4dad2c98', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, this.expanded ? 'Collapse' : 'Expand')), h("span", { key: '2023c06216607d6205ec3a0a13d2b06a10babae5', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: '1bdc7a342af4b6b37121edb9a93c30ba659d95bf', type: "button", part: "close", class: "bs-chatbot-header__button", "aria-label": "Close", onClick: this.onCloseClick }, h("slot", { key: '1c47b5499cf15ca73aa8a9dab792bf72c441ff38', name: "close-icon" }, h(CloseIcon, { key: '2ce1bad2bca776187e238647c02e3cc4b68018de' }))), h("bs-tooltip", { key: 'd7a3016e6eab564ab0cd9f5ab1d79be2b6408c17', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "Close")))));
77
+ return (h("div", { key: 'b1f536775af30bea47474dbcf41f444e9361fabd', class: "bs-chatbot-header", role: "banner", "aria-label": this.heading }, h("div", { key: '1e650269ff177b26e1dce30d9e04b4fab9de9698', part: "logo", class: "bs-chatbot-header__logo", role: "img", "aria-label": this.heading, innerHTML: GENIE_LOGO_SVG }), h("div", { key: '6a35a216f3bbda37ebd14ba801bf83f1f4941616', class: "bs-chatbot-header__actions" }, h("span", { key: 'af2b8a3eeafd27a946e1dd1c51c326c6f7e73531', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: '2928c845fd3737d68d672305437d9edd76d1deb3', type: "button", part: "new-chat", class: "bs-chatbot-header__button", "aria-label": "New chat", onClick: this.onNewChatClick }, h("slot", { key: 'bdab9f84e61bc92e16abcb7a9019300291690387', name: "new-chat-icon" }, h(NewChatIcon, { key: 'c61ddb8d3b8f9945f9986253cbe16e462c836f28' }))), h("bs-tooltip", { key: '3edbc3aae276ad91d2e70d21040efaffef101381', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "New chat")), h("span", { key: 'ef3bc303486fea9088b3855ac211baf6e1acae8b', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: '60e2787be7401832a29f806723414b361c480c47', type: "button", part: "history", class: "bs-chatbot-header__button", "aria-label": "History", onClick: this.onHistoryClick }, h("slot", { key: '2bbf8e675aa150740a23d59015446e012adbcb05', name: "history-icon" }, h(HistoryIcon, { key: '55badb6fc7cf1a17abbdae74896789cf2802be01' }))), h("bs-tooltip", { key: 'd4fd6cffbff586949b9357605cf23362a09fbd86', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "History")), h("span", { key: 'e2aa88c87d900d581b5a353cb2a4d014818b238b', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: 'aa5357f502a32b586b2d5c4837b37364f00d344a', type: "button", part: "expand", class: "bs-chatbot-header__button", "aria-label": this.expanded ? 'Collapse' : 'Expand', "aria-pressed": this.expanded ? 'true' : 'false', onClick: this.onExpandClick }, h("slot", { key: '312e8c17f49c84672533e37989c73072038ca07f', name: "expand-icon" }, h(ExpandIcon, { key: 'a0b666ae7b3660d4eb892407a82a84a0d8c8607b' }))), h("bs-tooltip", { key: '3c43e4d14ef4cdedaaecebed43927eb8f59e3391', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, this.expanded ? 'Collapse' : 'Expand')), h("span", { key: '1e252dcc382c0f2c5ae89a8dcf96e9d76c086b01', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: 'b95104b5dc629e70c43f0eb01f34fd0ba57db670', type: "button", part: "close", class: "bs-chatbot-header__button", "aria-label": "Close", onClick: this.onCloseClick }, h("slot", { key: '7c24bb86799528bc1e1bcc6419217b2048f70835', name: "close-icon" }, h(CloseIcon, { key: 'c53e2028c86264bac5082e9e145deb79eca3156d' }))), h("bs-tooltip", { key: 'f132fa96cc7942a3c4574403da1f2a0d586c0068', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "Close")))));
78
78
  }
79
79
  static get is() { return "bs-chatbot-header"; }
80
80
  static get encapsulation() { return "shadow"; }
@@ -105,7 +105,7 @@ export class BsChatbotResponseAction {
105
105
  };
106
106
  render() {
107
107
  const hasSources = !!this.sourcesCount && this.sourcesCount > 0;
108
- return (h("div", { key: 'd372000276bedcf0bd64015d955a4ed4ff1c83cc', class: "bs-chatbot-response-action" }, h("button", { key: '6fff591650e4f6114a653ff37bfebe100d4874b7', type: "button", part: "like", class: "bs-chatbot-response-action__button", "aria-label": "Like", onClick: this.onLikeClick }, h("slot", { key: 'e92d29243291141fd63120b4bc6a5024f1908066', name: "like-icon" }, h(ThumbsUpIcon, { key: 'd1a7e8d922f5e712e48e19c6176fdb60ac511240' }))), h("button", { key: '7115ff6c49c5388440f0fe8a352ddd4459a5f8ed', type: "button", part: "dislike", class: "bs-chatbot-response-action__button", "aria-label": "Dislike", onClick: this.onDislikeClick }, h("slot", { key: 'd3642d52b90cbd3f6c60d8b8ead3d14fab29f531', name: "dislike-icon" }, h(ThumbsDownIcon, { key: '8cff196faabd164cf023bfa8bac02f3455885261' }))), h("button", { key: 'd32e2ebce71ab91327d7ad7406ae581b2ff98443', type: "button", part: "copy", class: "bs-chatbot-response-action__button", "aria-label": "Copy", onClick: this.onCopyClick }, h("slot", { key: '1c0459f9fb78202d41e5bf7b3bf5a11ac9c00ecd', name: "copy-icon" }, h(CopyIcon, { key: 'b3d8e9f3cb2125c26967156f046ce3caf44ab8b1' }))), h("button", { key: 'c14f8a2580018edac6b16c82be5b339c7a4033af', type: "button", part: "regenerate", class: "bs-chatbot-response-action__button", "aria-label": "Regenerate", onClick: this.onRegenerateClick }, h("slot", { key: 'cf67332b681da43a7a305909e14a16bf6a3ca962', name: "regenerate-icon" }, h(RegenerateIcon, { key: '76b5b9c39624007532b2c2b7f20554f12cd8eee4' }))), h("div", { key: 'b62694c42bf23484362e188b6b74559810fce693', class: "bs-chatbot-response-action__menu-wrapper" }, h("button", { key: '36715b97f529bfc9c064020d434d0210a3674e52', type: "button", part: "menu", class: "bs-chatbot-response-action__button", "aria-label": "More options", "aria-haspopup": "menu", "aria-expanded": this.menuOpen ? 'true' : 'false', onClick: this.onMenuClick }, h("slot", { key: 'f11d837af777a04cc9031921f92b57e139758f2c', name: "menu-icon" }, h(MenuIcon, { key: '3c0c0a70edcf1e8c817a121fce315b8a747ee8e4' }))), this.menuOpen && (h("div", { key: '5a4848466caecf26ce3797b14609932e76ca653d', class: "bs-chatbot-response-action__menu-popup" }, h("slot", { key: 'f79ac9bcde08eadd0a904223f6f13c9850066827', name: "menu" })))), hasSources && (h("button", { key: 'ef9663bbbb7f74482743177bdfa8053575c3330e', type: "button", part: "sources", class: "bs-chatbot-response-action__sources", onClick: this.onSourcesClick }, h("slot", { key: 'f848fd2b5e545d186a7f337c2d0fe0f300c567f7', name: "sources-icon" }, h(SourcesIcon, { key: '7a8be099bcf97209b30c1b941b1f13691d9c07d3' })), h("span", { key: 'e91be28b3d36b1cc3a91c17218ca5ea77938f887', class: "bs-chatbot-response-action__sources-label" }, this.sourcesCount, " ", this.sourcesCount === 1 ? 'source' : 'sources')))));
108
+ return (h("div", { key: 'bae036e0fce39e91ad77e048e6c169ea72ce78e4', class: "bs-chatbot-response-action" }, h("button", { key: 'aadfb92da35ba7b5b105cfdc3ad506c7a7fd78e7', type: "button", part: "like", class: "bs-chatbot-response-action__button", "aria-label": "Like", onClick: this.onLikeClick }, h("slot", { key: 'f61c62fa761d277b3ef1b6c7a1bf4b8077ac340b', name: "like-icon" }, h(ThumbsUpIcon, { key: 'a95b09db3fee703c4d2e31a5efa590feb777f3b5' }))), h("button", { key: '37bdacfab99f444ae215b0da5a7b11912562baf7', type: "button", part: "dislike", class: "bs-chatbot-response-action__button", "aria-label": "Dislike", onClick: this.onDislikeClick }, h("slot", { key: 'b948f912ce5cd82c570bfcf7fe69f01f4bf993b0', name: "dislike-icon" }, h(ThumbsDownIcon, { key: '59e901ec41273c235fb0e484e53d23e529a1f429' }))), h("button", { key: '5f0f954f0cadcfda62d0493ebbf07651dc9c43c3', type: "button", part: "copy", class: "bs-chatbot-response-action__button", "aria-label": "Copy", onClick: this.onCopyClick }, h("slot", { key: 'a965380a2c3af43ba49b735c19c7b4afb5ec9c9f', name: "copy-icon" }, h(CopyIcon, { key: 'c9e7d8ef53a14728bced9c753aba3529ac97152f' }))), h("button", { key: 'e06f0c60698dea9a17005d6b233e59e5389c2c11', type: "button", part: "regenerate", class: "bs-chatbot-response-action__button", "aria-label": "Regenerate", onClick: this.onRegenerateClick }, h("slot", { key: '9a5aad36b3f1e217b2ab1718c25d451bc4f0b326', name: "regenerate-icon" }, h(RegenerateIcon, { key: '02aa85caf9c69a84fab24fd97361fa0a2a42c784' }))), h("div", { key: '6c48442ee1c32fcdecab2521c7e7773aae413c61', class: "bs-chatbot-response-action__menu-wrapper" }, h("button", { key: '749474386109e0c6bf3d0c18396ab75514a84db5', type: "button", part: "menu", class: "bs-chatbot-response-action__button", "aria-label": "More options", "aria-haspopup": "menu", "aria-expanded": this.menuOpen ? 'true' : 'false', onClick: this.onMenuClick }, h("slot", { key: 'a48edebb1eb697e7ebb80ceee8b674ad28ae760b', name: "menu-icon" }, h(MenuIcon, { key: '3bc463d9d8882ae373221b754d234938bd47f7de' }))), this.menuOpen && (h("div", { key: 'b1217dd05886155d65b6c6e52933b23ddfbeda4e', class: "bs-chatbot-response-action__menu-popup" }, h("slot", { key: '5a22ff4ffe417bbd25dfddbf18a943862b499f24', name: "menu" })))), hasSources && (h("button", { key: '35d6be1ee305a8549ebc1bed28884c0c5dc83220', type: "button", part: "sources", class: "bs-chatbot-response-action__sources", onClick: this.onSourcesClick }, h("slot", { key: 'af5a033146160fc90eb9ad3d28eb0ecc3628347c', name: "sources-icon" }, h(SourcesIcon, { key: '908029587106b710ddcee80fe207dddc8f77723c' })), h("span", { key: 'aa64462f7f5f4d96adfdf7172a5c2ac18cb1e608', class: "bs-chatbot-response-action__sources-label" }, this.sourcesCount, " ", this.sourcesCount === 1 ? 'source' : 'sources')))));
109
109
  }
110
110
  static get is() { return "bs-chatbot-response-action"; }
111
111
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,34 @@
1
+ import { render, h, describe, it, expect } from "@stencil/vitest";
2
+ describe('bs-chatbot-sources-drawer', () => {
3
+ it('renders the heading and slotted bs-source-link rows', async () => {
4
+ const { root } = await render(h("bs-chatbot-sources-drawer", { heading: "Sources" }, h("bs-source-link", { "file-name": "report.pdf" }), h("bs-source-link", { "file-name": "notes.docx" })));
5
+ expect(root.shadowRoot.querySelector('[part="heading"]')).toHaveTextContent('Sources');
6
+ const slot = root.shadowRoot.querySelector('[part="list"] slot');
7
+ expect(slot.assignedElements()).toHaveLength(2);
8
+ });
9
+ it('does not render the count badge when there are no sources', async () => {
10
+ const { root } = await render(h("bs-chatbot-sources-drawer", null));
11
+ expect(root.shadowRoot.querySelector('[part="count"]')).toBeNull();
12
+ });
13
+ it('auto-detects the count from slotted bs-source-link children', async () => {
14
+ const { root, waitForChanges } = await render(h("bs-chatbot-sources-drawer", null, h("bs-source-link", { "file-name": "a.pdf" }), h("bs-source-link", { "file-name": "b.pdf" }), h("bs-source-link", { "file-name": "c.pdf" })));
15
+ // The initial count is computed from slotchange, which fires once assignment settles.
16
+ await waitForChanges();
17
+ expect(root.shadowRoot.querySelector('[part="count"]')).toHaveTextContent('3');
18
+ });
19
+ it('ignores non-bs-source-link children when counting', async () => {
20
+ const { root, waitForChanges } = await render(h("bs-chatbot-sources-drawer", null, h("bs-source-link", { "file-name": "a.pdf" }), h("div", null, "not a source")));
21
+ await waitForChanges();
22
+ expect(root.shadowRoot.querySelector('[part="count"]')).toHaveTextContent('1');
23
+ });
24
+ it('overrides the auto-detected count when the count prop is set', async () => {
25
+ const { root } = await render(h("bs-chatbot-sources-drawer", { count: 9 }, h("bs-source-link", { "file-name": "a.pdf" })));
26
+ expect(root.shadowRoot.querySelector('[part="count"]')).toHaveTextContent('9');
27
+ });
28
+ it('emits bsCollapse when the collapse button is clicked', async () => {
29
+ const { root, spyOnEvent } = await render(h("bs-chatbot-sources-drawer", null));
30
+ const spy = spyOnEvent('bsCollapse');
31
+ root.shadowRoot.querySelector('[part="collapse"]').click();
32
+ expect(spy).toHaveReceivedEventTimes(1);
33
+ });
34
+ });
@@ -0,0 +1,106 @@
1
+ :host {
2
+ display: block;
3
+ /* --bs-static-white is deliberately NOT theme-aware (never overridden in [data-theme="dark"]),
4
+ * so using it here would leave the panel pure white in dark mode while --bs-text-default (used
5
+ * for the heading below) switches to white -- invisible text on an unchanged white background.
6
+ * --bs-surface-raised is the theme-aware equivalent already used for bs-modal's own dialog box. */
7
+ --bs-chatbot-sources-drawer-bg: var(--bs-surface-raised);
8
+ --bs-chatbot-sources-drawer-header-shadow: var(--bs-shadow-xs);
9
+ --bs-chatbot-sources-drawer-header-padding-x: var(--bs-spacing-200);
10
+ --bs-chatbot-sources-drawer-header-padding-top: var(--bs-spacing-150);
11
+ --bs-chatbot-sources-drawer-header-padding-bottom: var(--bs-spacing-100);
12
+ --bs-chatbot-sources-drawer-heading-color: var(--bs-text-default);
13
+ --bs-chatbot-sources-drawer-count-bg: var(--bs-badge-bg-neutral-container);
14
+ --bs-chatbot-sources-drawer-count-color: var(--bs-badge-text-neutral);
15
+ --bs-chatbot-sources-drawer-collapse-hover: var(--bs-surface-hover);
16
+ --bs-chatbot-sources-drawer-section-gap: var(--bs-spacing-200);
17
+ --bs-chatbot-sources-drawer-list-padding: var(--bs-spacing-200);
18
+ --bs-chatbot-sources-drawer-list-gap: var(--bs-spacing-50);
19
+ }
20
+
21
+ .bs-chatbot-sources-drawer {
22
+ box-sizing: border-box;
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: var(--bs-chatbot-sources-drawer-section-gap);
26
+ width: 100%;
27
+ height: 100%;
28
+ background: var(--bs-chatbot-sources-drawer-bg);
29
+ font-family: inherit;
30
+ }
31
+
32
+ .bs-chatbot-sources-drawer__header {
33
+ box-sizing: border-box;
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: space-between;
37
+ flex-shrink: 0;
38
+ padding: var(--bs-chatbot-sources-drawer-header-padding-top) var(--bs-chatbot-sources-drawer-header-padding-x) var(--bs-chatbot-sources-drawer-header-padding-bottom);
39
+ box-shadow: var(--bs-chatbot-sources-drawer-header-shadow);
40
+ }
41
+
42
+ .bs-chatbot-sources-drawer__title-group {
43
+ display: flex;
44
+ align-items: center;
45
+ gap: var(--bs-spacing-100);
46
+ }
47
+
48
+ .bs-chatbot-sources-drawer__heading {
49
+ margin: 0;
50
+ color: var(--bs-chatbot-sources-drawer-heading-color);
51
+ font-size: var(--bs-font-size-2xl);
52
+ font-weight: var(--bs-font-weight-bold);
53
+ /* --bs-line-height-heading-h4 is a bare number (32), meant as a px value -- unlike
54
+ * --bs-line-height-normal/snug/etc, which are true unitless ratios safe to use directly. */
55
+ line-height: calc(var(--bs-line-height-heading-h4) * 1px);
56
+ }
57
+
58
+ .bs-chatbot-sources-drawer__count {
59
+ box-sizing: border-box;
60
+ display: inline-flex;
61
+ align-items: center;
62
+ justify-content: center;
63
+ min-width: 16px;
64
+ max-width: 34px;
65
+ padding: var(--bs-spacing-50) var(--bs-spacing-100);
66
+ background: var(--bs-chatbot-sources-drawer-count-bg);
67
+ border-radius: var(--bs-border-radius-50);
68
+ color: var(--bs-chatbot-sources-drawer-count-color);
69
+ font-size: var(--bs-font-size-xs);
70
+ line-height: calc(var(--bs-line-height-caption-sm) * 1px);
71
+ }
72
+
73
+ .bs-chatbot-sources-drawer__collapse {
74
+ box-sizing: border-box;
75
+ display: inline-flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ width: 32px;
79
+ height: 32px;
80
+ padding: 0;
81
+ background: none;
82
+ border: none;
83
+ border-radius: var(--bs-border-radius-100);
84
+ color: var(--bs-icon-default);
85
+ cursor: pointer;
86
+ }
87
+
88
+ .bs-chatbot-sources-drawer__collapse:hover {
89
+ background: var(--bs-chatbot-sources-drawer-collapse-hover);
90
+ }
91
+
92
+ .bs-chatbot-sources-drawer__collapse:focus-visible {
93
+ outline: 2px solid var(--bs-border-neutral-focus);
94
+ outline-offset: 1px;
95
+ }
96
+
97
+ .bs-chatbot-sources-drawer__list {
98
+ box-sizing: border-box;
99
+ display: flex;
100
+ flex-direction: column;
101
+ gap: var(--bs-chatbot-sources-drawer-list-gap);
102
+ /* No top padding -- the gap between header and list (--bs-chatbot-sources-drawer-section-gap)
103
+ * already provides that separation; adding padding here too would double it up. */
104
+ padding: 0 var(--bs-chatbot-sources-drawer-list-padding) var(--bs-chatbot-sources-drawer-list-padding);
105
+ overflow-y: auto;
106
+ }