@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.
- package/custom-elements.json +1810 -355
- package/dist/brandsync-wc/brandsync-wc.esm.js +1 -1
- package/dist/brandsync-wc/p-0d64ea40.entry.js +1 -0
- package/dist/brandsync-wc/{p-c63d16e1.entry.js → p-1515498e.entry.js} +1 -1
- package/dist/brandsync-wc/p-16a54578.entry.js +1 -0
- package/dist/brandsync-wc/p-18af02df.entry.js +1 -0
- package/dist/brandsync-wc/p-30a0e168.entry.js +1 -0
- package/dist/brandsync-wc/p-3dacae70.entry.js +1 -0
- package/dist/brandsync-wc/p-5333bb5a.entry.js +1 -0
- package/dist/brandsync-wc/p-575ce905.entry.js +1 -0
- package/dist/brandsync-wc/{p-dd0fea0e.entry.js → p-7776b57b.entry.js} +1 -1
- package/dist/brandsync-wc/{p-bfd09c98.entry.js → p-805644e4.entry.js} +1 -1
- package/dist/brandsync-wc/{p-f88d9a6e.entry.js → p-8a78d6ea.entry.js} +1 -1
- package/dist/brandsync-wc/p-8d12ed96.entry.js +1 -0
- package/dist/brandsync-wc/p-94ed898a.entry.js +1 -0
- package/dist/brandsync-wc/{p-9e5d2211.entry.js → p-96f374be.entry.js} +1 -1
- package/dist/brandsync-wc/{p-ab5cc7af.entry.js → p-a34f460d.entry.js} +1 -1
- package/dist/brandsync-wc/p-bc72439a.entry.js +1 -0
- package/dist/brandsync-wc/{p-76eca100.entry.js → p-ce0914a7.entry.js} +1 -1
- package/dist/brandsync-wc/{p-5a0fe72e.entry.js → p-d682675e.entry.js} +1 -1
- package/dist/brandsync-wc/p-dad4a92c.entry.js +1 -0
- package/dist/brandsync-wc/{p-cfc3421b.entry.js → p-dd747a12.entry.js} +1 -1
- package/dist/brandsync-wc/{p-2742ecef.entry.js → p-eb4d87f0.entry.js} +1 -1
- package/dist/cjs/brandsync-wc.cjs.js +1 -1
- package/dist/cjs/bs-ai-disclaimer.cjs.entry.js +17 -0
- package/dist/cjs/bs-ai-greeting.cjs.entry.js +24 -0
- package/dist/cjs/bs-ai-thinking.cjs.entry.js +2 -2
- package/dist/cjs/bs-attachment-list.cjs.entry.js +47 -0
- package/dist/cjs/bs-attachment.cjs.entry.js +46 -0
- package/dist/cjs/bs-badge.cjs.entry.js +1 -1
- package/dist/cjs/bs-button-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/bs-button.cjs.entry.js +1 -1
- package/dist/cjs/bs-card.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-feedback.cjs.entry.js +94 -0
- package/dist/cjs/bs-chatbot-header.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-response-action.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-sources-drawer.cjs.entry.js +38 -0
- package/dist/cjs/bs-chatbot-suggestion-button.cjs.entry.js +1 -1
- package/dist/cjs/bs-composer-status-banner.cjs.entry.js +43 -0
- package/dist/cjs/bs-composer.cjs.entry.js +16 -2
- package/dist/cjs/bs-data-table.cjs.entry.js +2 -2
- package/dist/cjs/bs-input.cjs.entry.js +270 -4
- package/dist/cjs/{bs-menu-item.cjs.entry.js → bs-menu_2.cjs.entry.js} +14 -1
- package/dist/cjs/bs-source-link.cjs.entry.js +39 -0
- package/dist/cjs/bs-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +8 -0
- package/dist/collection/components/bs-ai-chatbot/bs-ai-chatbot.stories.js +180 -0
- package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.cmp.test.js +14 -0
- package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.css +27 -0
- package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.js +41 -0
- package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.stories.js +15 -0
- package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.cmp.test.js +22 -0
- package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.css +53 -0
- package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.js +103 -0
- package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.stories.js +23 -0
- package/dist/collection/components/bs-ai-thinking/bs-ai-thinking.css +31 -17
- package/dist/collection/components/bs-ai-thinking/bs-ai-thinking.js +9 -11
- package/dist/collection/components/bs-attachment/bs-attachment.cmp.test.js +41 -0
- package/dist/collection/components/bs-attachment/bs-attachment.css +184 -0
- package/dist/collection/components/bs-attachment/bs-attachment.js +230 -0
- package/dist/collection/components/bs-attachment/bs-attachment.stories.js +58 -0
- package/dist/collection/components/bs-attachment-list/bs-attachment-list.cmp.test.js +28 -0
- package/dist/collection/components/bs-attachment-list/bs-attachment-list.css +56 -0
- package/dist/collection/components/bs-attachment-list/bs-attachment-list.js +105 -0
- package/dist/collection/components/bs-attachment-list/bs-attachment-list.stories.js +47 -0
- package/dist/collection/components/bs-badge/bs-badge.js +1 -1
- package/dist/collection/components/bs-button/bs-button.js +1 -1
- package/dist/collection/components/bs-button-skeleton/bs-button-skeleton.js +1 -1
- package/dist/collection/components/bs-card/bs-card.js +1 -1
- package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.cmp.test.js +73 -0
- package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.css +253 -0
- package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.js +324 -0
- package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.stories.js +54 -0
- package/dist/collection/components/bs-chatbot-header/bs-chatbot-header.js +1 -1
- package/dist/collection/components/bs-chatbot-response-action/bs-chatbot-response-action.js +1 -1
- package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.cmp.test.js +34 -0
- package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.css +106 -0
- package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.js +142 -0
- package/dist/collection/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.stories.js +44 -0
- package/dist/collection/components/bs-chatbot-suggestion-button/bs-chatbot-suggestion-button.js +1 -1
- package/dist/collection/components/bs-composer/bs-composer.cmp.test.js +12 -0
- package/dist/collection/components/bs-composer/bs-composer.css +10 -0
- package/dist/collection/components/bs-composer/bs-composer.js +25 -1
- package/dist/collection/components/bs-composer/bs-composer.stories.js +13 -0
- package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.cmp.test.js +42 -0
- package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.css +173 -0
- package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.js +270 -0
- package/dist/collection/components/bs-composer-status-banner/bs-composer-status-banner.stories.js +75 -0
- package/dist/collection/components/bs-data-table/bs-data-table.js +2 -2
- package/dist/collection/components/bs-input/bs-input.cmp.test.js +296 -0
- package/dist/collection/components/bs-input/bs-input.css +333 -23
- package/dist/collection/components/bs-input/bs-input.js +647 -11
- package/dist/collection/components/bs-input/bs-input.stories.js +128 -1
- package/dist/collection/components/bs-menu/bs-menu.js +1 -1
- package/dist/collection/components/bs-menu-item/bs-menu-item.js +1 -1
- package/dist/collection/components/bs-source-link/bs-source-link.cmp.test.js +42 -0
- package/dist/collection/components/bs-source-link/bs-source-link.css +114 -0
- package/dist/collection/components/bs-source-link/bs-source-link.js +192 -0
- package/dist/collection/components/bs-source-link/bs-source-link.stories.js +33 -0
- package/dist/collection/components/bs-tooltip/bs-tooltip.js +1 -1
- package/dist/components/bs-ai-disclaimer.d.ts +11 -0
- package/dist/components/bs-ai-disclaimer.js +1 -0
- package/dist/components/bs-ai-greeting.d.ts +11 -0
- package/dist/components/bs-ai-greeting.js +1 -0
- package/dist/components/bs-ai-thinking.js +1 -1
- package/dist/components/bs-attachment-list.d.ts +11 -0
- package/dist/components/bs-attachment-list.js +1 -0
- package/dist/components/bs-attachment.d.ts +11 -0
- package/dist/components/bs-attachment.js +1 -0
- package/dist/components/bs-badge.js +1 -1
- package/dist/components/bs-button-skeleton.js +1 -1
- package/dist/components/bs-button.js +1 -1
- package/dist/components/bs-card.js +1 -1
- package/dist/components/bs-chatbot-feedback.d.ts +11 -0
- package/dist/components/bs-chatbot-feedback.js +1 -0
- package/dist/components/bs-chatbot-header.js +1 -1
- package/dist/components/bs-chatbot-response-action.js +1 -1
- package/dist/components/bs-chatbot-sources-drawer.d.ts +11 -0
- package/dist/components/bs-chatbot-sources-drawer.js +1 -0
- package/dist/components/bs-chatbot-suggestion-button.js +1 -1
- package/dist/components/bs-composer-status-banner.d.ts +11 -0
- package/dist/components/bs-composer-status-banner.js +1 -0
- package/dist/components/bs-composer.js +1 -1
- package/dist/components/bs-data-table.js +1 -1
- package/dist/components/bs-input.js +1 -1
- package/dist/components/bs-menu-item.js +1 -1
- package/dist/components/bs-menu.js +1 -1
- package/dist/components/bs-source-link.d.ts +11 -0
- package/dist/components/bs-source-link.js +1 -0
- package/dist/components/bs-tooltip.js +1 -1
- package/dist/components/{p-CoC4LQCI.js → p-Cz2nfz2j.js} +1 -1
- package/dist/components/p-DndQiCMP.js +1 -0
- package/dist/components/p-_vXDfB3V.js +1 -0
- package/dist/esm/brandsync-wc.js +1 -1
- package/dist/esm/bs-ai-disclaimer.entry.js +15 -0
- package/dist/esm/bs-ai-greeting.entry.js +22 -0
- package/dist/esm/bs-ai-thinking.entry.js +2 -2
- package/dist/esm/bs-attachment-list.entry.js +45 -0
- package/dist/esm/bs-attachment.entry.js +44 -0
- package/dist/esm/bs-badge.entry.js +1 -1
- package/dist/esm/bs-button-skeleton.entry.js +1 -1
- package/dist/esm/bs-button.entry.js +1 -1
- package/dist/esm/bs-card.entry.js +1 -1
- package/dist/esm/bs-chatbot-feedback.entry.js +92 -0
- package/dist/esm/bs-chatbot-header.entry.js +1 -1
- package/dist/esm/bs-chatbot-response-action.entry.js +1 -1
- package/dist/esm/bs-chatbot-sources-drawer.entry.js +36 -0
- package/dist/esm/bs-chatbot-suggestion-button.entry.js +1 -1
- package/dist/esm/bs-composer-status-banner.entry.js +41 -0
- package/dist/esm/bs-composer.entry.js +17 -3
- package/dist/esm/bs-data-table.entry.js +2 -2
- package/dist/esm/bs-input.entry.js +271 -5
- package/dist/esm/{bs-menu-item.entry.js → bs-menu_2.entry.js} +15 -3
- package/dist/esm/bs-source-link.entry.js +37 -0
- package/dist/esm/bs-tooltip.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/bs-ai-chatbot/bs-ai-chatbot.stories.d.ts +18 -0
- package/dist/types/components/bs-ai-disclaimer/bs-ai-disclaimer.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-ai-disclaimer/bs-ai-disclaimer.d.ts +26 -0
- package/dist/types/components/bs-ai-disclaimer/bs-ai-disclaimer.stories.d.ts +8 -0
- package/dist/types/components/bs-ai-greeting/bs-ai-greeting.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-ai-greeting/bs-ai-greeting.d.ts +42 -0
- package/dist/types/components/bs-ai-greeting/bs-ai-greeting.stories.d.ts +10 -0
- package/dist/types/components/bs-ai-thinking/bs-ai-thinking.d.ts +8 -10
- package/dist/types/components/bs-attachment/bs-attachment.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-attachment/bs-attachment.d.ts +59 -0
- package/dist/types/components/bs-attachment/bs-attachment.stories.d.ts +17 -0
- package/dist/types/components/bs-attachment-list/bs-attachment-list.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-attachment-list/bs-attachment-list.d.ts +42 -0
- package/dist/types/components/bs-attachment-list/bs-attachment-list.stories.d.ts +10 -0
- package/dist/types/components/bs-chatbot-feedback/bs-chatbot-feedback.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-chatbot-feedback/bs-chatbot-feedback.d.ts +90 -0
- package/dist/types/components/bs-chatbot-feedback/bs-chatbot-feedback.stories.d.ts +16 -0
- package/dist/types/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.d.ts +54 -0
- package/dist/types/components/bs-chatbot-sources-drawer/bs-chatbot-sources-drawer.stories.d.ts +10 -0
- package/dist/types/components/bs-composer/bs-composer.d.ts +14 -0
- package/dist/types/components/bs-composer/bs-composer.stories.d.ts +1 -0
- package/dist/types/components/bs-composer-status-banner/bs-composer-status-banner.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-composer-status-banner/bs-composer-status-banner.d.ts +88 -0
- package/dist/types/components/bs-composer-status-banner/bs-composer-status-banner.stories.d.ts +20 -0
- package/dist/types/components/bs-input/bs-input.d.ts +139 -6
- package/dist/types/components/bs-input/bs-input.stories.d.ts +19 -0
- package/dist/types/components/bs-source-link/bs-source-link.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-source-link/bs-source-link.d.ts +51 -0
- package/dist/types/components/bs-source-link/bs-source-link.stories.d.ts +13 -0
- package/dist/types/components.d.ts +1778 -55
- package/package.json +1 -1
- package/dist/brandsync-wc/p-6abdfaf0.entry.js +0 -1
- package/dist/brandsync-wc/p-6c1fa4da.entry.js +0 -1
- package/dist/brandsync-wc/p-a12d0a60.entry.js +0 -1
- package/dist/brandsync-wc/p-f5f443e2.entry.js +0 -1
- package/dist/cjs/bs-menu.cjs.entry.js +0 -17
- package/dist/esm/bs-menu.entry.js +0 -15
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { componentDescription, propDescription } from "../../stories-utils";
|
|
3
|
+
const SAMPLE_IMAGE = 'https://images.unsplash.com/photo-1512917774080-9991f1c4c750?w=200&h=200&fit=crop';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Genie AI Components/bs-attachment-list',
|
|
6
|
+
parameters: { docs: { description: { component: componentDescription('bs-attachment-list') } } },
|
|
7
|
+
argTypes: {
|
|
8
|
+
ariaLabel: { control: 'text', description: propDescription('bs-attachment-list', 'ariaLabel') },
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
ariaLabel: 'Attachments',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
export const OneAttachment = {
|
|
16
|
+
name: 'One attachment',
|
|
17
|
+
render: args => html `
|
|
18
|
+
<bs-attachment-list aria-label=${args.ariaLabel}>
|
|
19
|
+
<bs-attachment type="image" image-src=${SAMPLE_IMAGE}></bs-attachment>
|
|
20
|
+
</bs-attachment-list>
|
|
21
|
+
`,
|
|
22
|
+
};
|
|
23
|
+
export const ThreeAttachments = {
|
|
24
|
+
name: 'Three attachments',
|
|
25
|
+
render: args => html `
|
|
26
|
+
<bs-attachment-list aria-label=${args.ariaLabel}>
|
|
27
|
+
<bs-attachment type="image" image-src=${SAMPLE_IMAGE}></bs-attachment>
|
|
28
|
+
<bs-attachment type="pdf" file-name="Dummy-pdf-in-here"></bs-attachment>
|
|
29
|
+
<bs-attachment type="document" file-name="Dummy-pdf-in-here"></bs-attachment>
|
|
30
|
+
</bs-attachment-list>
|
|
31
|
+
`,
|
|
32
|
+
};
|
|
33
|
+
export const ManyAttachments = {
|
|
34
|
+
name: 'Many attachments (scrollable)',
|
|
35
|
+
render: args => html `
|
|
36
|
+
<div style="max-width: 400px; border: 1px dashed #c2c7d3;">
|
|
37
|
+
<bs-attachment-list aria-label=${args.ariaLabel}>
|
|
38
|
+
<bs-attachment type="pdf" file-name="Dummy-pdf-in-here"></bs-attachment>
|
|
39
|
+
<bs-attachment type="pdf" file-name="Dummy-pdf-in-here"></bs-attachment>
|
|
40
|
+
<bs-attachment type="document" file-name="Dummy-pdf-in-here"></bs-attachment>
|
|
41
|
+
<bs-attachment type="document" file-name="Dummy-pdf-in-here"></bs-attachment>
|
|
42
|
+
<bs-attachment type="document" file-name="Dummy-pdf-in-here"></bs-attachment>
|
|
43
|
+
<bs-attachment type="image" image-src=${SAMPLE_IMAGE}></bs-attachment>
|
|
44
|
+
</bs-attachment-list>
|
|
45
|
+
</div>
|
|
46
|
+
`,
|
|
47
|
+
};
|
|
@@ -17,7 +17,7 @@ export class BsBadge {
|
|
|
17
17
|
/** Maps directly to the brandsync-tokens `--bs-badge-bg-*` / `--bs-badge-text-*` sets. */
|
|
18
18
|
variant = 'default';
|
|
19
19
|
render() {
|
|
20
|
-
return (h("span", { key: '
|
|
20
|
+
return (h("span", { key: '33a4103fad2c535c1eeb787a4ba8e7633ef92082', part: "container", class: `bs-badge bs-badge--${this.variant}` }, h("slot", { key: '68c95c6e9dd8a90fbec5853f7274f5ff2859faa3' })));
|
|
21
21
|
}
|
|
22
22
|
static get is() { return "bs-badge"; }
|
|
23
23
|
static get encapsulation() { return "shadow"; }
|
|
@@ -100,7 +100,7 @@ export class BsButton {
|
|
|
100
100
|
};
|
|
101
101
|
render() {
|
|
102
102
|
const iconOnly = (this.hasIcon || this.hasEndIcon) && !this.hasLabel;
|
|
103
|
-
return (h("button", { key: '
|
|
103
|
+
return (h("button", { key: '8fe88c418417a4b2f8944c282aa97dbc98aaeb06', class: `bs-button bs-button--${this.variant} bs-button--${this.size} ${iconOnly ? 'bs-button--icon-only' : ''}`, type: this.type, disabled: this.disabled, "aria-label": this.ariaLabel }, h("span", { key: '85b3a07595c93cbe3113204315669c3b087f216d', part: "icon", class: `bs-button__icon ${this.hasIcon ? 'bs-button__icon--visible' : ''}` }, h("slot", { key: '53740a910449f215229686fa9c506cce6d399b52', name: "icon", onSlotchange: this.onIconSlotchange })), h("span", { key: '3a3b133d9386d0d2044d44cdf0b47bd3e100c6d2', part: "label", class: "bs-button__label" }, h("slot", { key: '9c7c0e468651c0d93aafa53afb3fcab60ab7f311', onSlotchange: this.onLabelSlotchange })), h("span", { key: 'fa5b7afa82c697cfa7cf1a0f564e743832c9c039', part: "end-icon", class: `bs-button__end-icon ${this.hasEndIcon ? 'bs-button__end-icon--visible' : ''}` }, h("slot", { key: '20bf73485fbd7c30e524e380ec291ac3939c3ba1', name: "end-icon", onSlotchange: this.onEndIconSlotchange }))));
|
|
104
104
|
}
|
|
105
105
|
static get is() { return "bs-button"; }
|
|
106
106
|
static get encapsulation() { return "shadow"; }
|
|
@@ -25,7 +25,7 @@ export class BsButtonSkeleton {
|
|
|
25
25
|
/** Sizing scale, matching the `bs-button` size it stands in for. */
|
|
26
26
|
size = 'md';
|
|
27
27
|
render() {
|
|
28
|
-
return h("span", { key: '
|
|
28
|
+
return h("span", { key: '3d08a657337abf1db82ab85d3ef6c6a15a23010a', part: "container", class: `bs-button-skeleton bs-button-skeleton--${this.size}`, role: "status", "aria-label": "Loading" });
|
|
29
29
|
}
|
|
30
30
|
static get is() { return "bs-button-skeleton"; }
|
|
31
31
|
static get encapsulation() { return "shadow"; }
|
|
@@ -23,7 +23,7 @@ export class BsCard {
|
|
|
23
23
|
* dedicated "card" component yet, so this reuses the existing Paper surface tokens. */
|
|
24
24
|
surface = 'raised';
|
|
25
25
|
render() {
|
|
26
|
-
return (h("div", { key: '
|
|
26
|
+
return (h("div", { key: 'c8f95e45c3aa78315341d5ef5f7aa53b33f289cc', part: "container", class: `bs-card bs-card--${this.surface}` }, h("div", { key: 'b0787524f4b874e4e47459ef5325f2494ea8bf59', part: "header", class: "bs-card__header" }, h("slot", { key: '41ee7852c3ea215f9b6fbc72ccd13283b58afc50', name: "header" })), h("div", { key: 'e4537f5ec7e11af4518cfae464ee6f65120355cc', part: "body", class: "bs-card__body" }, h("slot", { key: 'b6ceecfa3ad173f43811ae7c24b70822879f89f4' })), h("div", { key: '31bc782bb46991e1db5718ff9690140965810572', part: "footer", class: "bs-card__footer" }, h("slot", { key: 'f2530ea24aab67ea5f3f575ef251419b5565b5bc', name: "footer" }))));
|
|
27
27
|
}
|
|
28
28
|
static get is() { return "bs-card"; }
|
|
29
29
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { render, h, describe, it, expect } from "@stencil/vitest";
|
|
2
|
+
describe('bs-chatbot-feedback', () => {
|
|
3
|
+
it('renders the default heading/subtitle and the editable form before submitting', async () => {
|
|
4
|
+
const { root } = await render(h("bs-chatbot-feedback", null));
|
|
5
|
+
expect(root.shadowRoot.querySelector('[part="heading"]')).toHaveTextContent('How was your experience with us?');
|
|
6
|
+
expect(root.shadowRoot.querySelector('[part="textarea"]')).not.toBeNull();
|
|
7
|
+
expect(root.shadowRoot.querySelector('[part="submit"]')).not.toBeNull();
|
|
8
|
+
expect(root.shadowRoot.querySelector('[part="comment"]')).toBeNull();
|
|
9
|
+
});
|
|
10
|
+
it('disables the submit button until a star is clicked', async () => {
|
|
11
|
+
const { root } = await render(h("bs-chatbot-feedback", null));
|
|
12
|
+
expect(root.shadowRoot.querySelector('[part="submit"]')).toHaveAttribute('disabled');
|
|
13
|
+
});
|
|
14
|
+
it('emits bsRatingChange and updates aria-checked when a star is clicked', async () => {
|
|
15
|
+
const { root, spyOnEvent, waitForChanges } = await render(h("bs-chatbot-feedback", null));
|
|
16
|
+
const spy = spyOnEvent('bsRatingChange');
|
|
17
|
+
const stars = root.shadowRoot.querySelectorAll('[part="star"]');
|
|
18
|
+
stars[2].click(); // 3rd star -> rating 3
|
|
19
|
+
await waitForChanges();
|
|
20
|
+
expect(spy).toHaveReceivedEventDetail(3);
|
|
21
|
+
expect(stars[0]).toEqualAttribute('aria-checked', 'true');
|
|
22
|
+
expect(stars[2]).toEqualAttribute('aria-checked', 'true');
|
|
23
|
+
expect(stars[3]).toEqualAttribute('aria-checked', 'false');
|
|
24
|
+
});
|
|
25
|
+
it('enables the submit button once a star is selected, and emits bsSubmit with rating + comment', async () => {
|
|
26
|
+
const { root, spyOnEvent, waitForChanges } = await render(h("bs-chatbot-feedback", null));
|
|
27
|
+
const submitSpy = spyOnEvent('bsSubmit');
|
|
28
|
+
root.shadowRoot.querySelectorAll('[part="star"]')[3].click(); // rating 4
|
|
29
|
+
await waitForChanges();
|
|
30
|
+
const textarea = root.shadowRoot.querySelector('[part="textarea"]');
|
|
31
|
+
textarea.value = 'Great answer';
|
|
32
|
+
textarea.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
|
33
|
+
await waitForChanges();
|
|
34
|
+
const submit = root.shadowRoot.querySelector('[part="submit"]');
|
|
35
|
+
expect(submit).not.toHaveAttribute('disabled');
|
|
36
|
+
submit.click();
|
|
37
|
+
expect(submitSpy).toHaveReceivedEventDetail({ rating: 4, comment: 'Great answer' });
|
|
38
|
+
});
|
|
39
|
+
it('switches to the rating-specific heading/subtitle and read-only comment after submitting', async () => {
|
|
40
|
+
const { root } = await render(h("bs-chatbot-feedback", { rating: 5, submitted: true, comment: "Loved it" }));
|
|
41
|
+
expect(root.shadowRoot.querySelector('[part="heading"]')).toHaveTextContent('Thanks for the great rating!');
|
|
42
|
+
expect(root.shadowRoot.querySelector('[part="textarea"]')).toBeNull();
|
|
43
|
+
expect(root.shadowRoot.querySelector('[part="submit"]')).toBeNull();
|
|
44
|
+
expect(root.shadowRoot.querySelector('[part="comment"]')).toHaveTextContent('Loved it');
|
|
45
|
+
});
|
|
46
|
+
it('does not render the comment part when submitted with no comment', async () => {
|
|
47
|
+
const { root } = await render(h("bs-chatbot-feedback", { rating: 5, submitted: true }));
|
|
48
|
+
expect(root.shadowRoot.querySelector('[part="comment"]')).toBeNull();
|
|
49
|
+
});
|
|
50
|
+
it('disables stars and ignores clicks once submitted', async () => {
|
|
51
|
+
const { root, spyOnEvent } = await render(h("bs-chatbot-feedback", { rating: 2, submitted: true }));
|
|
52
|
+
const spy = spyOnEvent('bsRatingChange');
|
|
53
|
+
const stars = root.shadowRoot.querySelectorAll('[part="star"]');
|
|
54
|
+
expect(stars[0]).toHaveAttribute('disabled');
|
|
55
|
+
stars[4].click();
|
|
56
|
+
expect(spy).toHaveReceivedEventTimes(0);
|
|
57
|
+
});
|
|
58
|
+
it('renders "Start new chat" as outlined before submitting and primary after', async () => {
|
|
59
|
+
const { root: before } = await render(h("bs-chatbot-feedback", null));
|
|
60
|
+
expect(before.shadowRoot.querySelector('[part="new-chat"]').className).toContain('--outlined');
|
|
61
|
+
const { root: after } = await render(h("bs-chatbot-feedback", { rating: 5, submitted: true }));
|
|
62
|
+
expect(after.shadowRoot.querySelector('[part="new-chat"]').className).toContain('--primary');
|
|
63
|
+
});
|
|
64
|
+
it('emits bsNewChat and bsClose when their buttons are clicked', async () => {
|
|
65
|
+
const { root, spyOnEvent } = await render(h("bs-chatbot-feedback", null));
|
|
66
|
+
const newChatSpy = spyOnEvent('bsNewChat');
|
|
67
|
+
const closeSpy = spyOnEvent('bsClose');
|
|
68
|
+
root.shadowRoot.querySelector('[part="new-chat"]').click();
|
|
69
|
+
root.shadowRoot.querySelector('[part="close"]').click();
|
|
70
|
+
expect(newChatSpy).toHaveReceivedEventTimes(1);
|
|
71
|
+
expect(closeSpy).toHaveReceivedEventTimes(1);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
--bs-chatbot-feedback-bg: var(--bs-surface-raised);
|
|
4
|
+
--bs-chatbot-feedback-border: var(--bs-border-default);
|
|
5
|
+
--bs-chatbot-feedback-radius: var(--bs-border-radius-200);
|
|
6
|
+
--bs-chatbot-feedback-padding-x: var(--bs-spacing-250);
|
|
7
|
+
--bs-chatbot-feedback-padding-y: var(--bs-spacing-550);
|
|
8
|
+
--bs-chatbot-feedback-max-width: 762px;
|
|
9
|
+
--bs-chatbot-feedback-gap: var(--bs-spacing-300);
|
|
10
|
+
--bs-chatbot-feedback-top-gap: var(--bs-spacing-250);
|
|
11
|
+
--bs-chatbot-feedback-heading-color: var(--bs-text-default);
|
|
12
|
+
--bs-chatbot-feedback-subtitle-color: var(--bs-text-secondary);
|
|
13
|
+
--bs-chatbot-feedback-star-filled: var(--bs-color-primary-default);
|
|
14
|
+
--bs-chatbot-feedback-star-empty: var(--bs-border-neutral-container);
|
|
15
|
+
--bs-chatbot-feedback-comment-color: var(--bs-text-default);
|
|
16
|
+
--bs-chatbot-feedback-close-hover: var(--bs-surface-hover);
|
|
17
|
+
--bs-chatbot-feedback-primary-bg: var(--bs-button-primary-default);
|
|
18
|
+
--bs-chatbot-feedback-primary-bg-hover: var(--bs-button-primary-hover);
|
|
19
|
+
--bs-chatbot-feedback-primary-bg-disabled: var(--bs-button-primary-disabled);
|
|
20
|
+
--bs-chatbot-feedback-outlined-border: var(--bs-border-primary);
|
|
21
|
+
--bs-chatbot-feedback-outlined-hover: var(--bs-color-primary-container-hover);
|
|
22
|
+
--bs-chatbot-feedback-outlined-text: var(--bs-text-action);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.bs-chatbot-feedback {
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
position: relative;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: var(--bs-chatbot-feedback-gap);
|
|
32
|
+
max-width: var(--bs-chatbot-feedback-max-width);
|
|
33
|
+
padding: var(--bs-chatbot-feedback-padding-y) var(--bs-chatbot-feedback-padding-x);
|
|
34
|
+
background: var(--bs-chatbot-feedback-bg);
|
|
35
|
+
border: 1px solid var(--bs-chatbot-feedback-border);
|
|
36
|
+
border-radius: var(--bs-chatbot-feedback-radius);
|
|
37
|
+
font-family: inherit;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.bs-chatbot-feedback__close {
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: var(--bs-spacing-100);
|
|
44
|
+
right: var(--bs-spacing-100);
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
width: 32px;
|
|
49
|
+
height: 32px;
|
|
50
|
+
padding: 0;
|
|
51
|
+
background: transparent;
|
|
52
|
+
border: none;
|
|
53
|
+
border-radius: var(--bs-border-radius-100);
|
|
54
|
+
color: var(--bs-icon-default);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
transition: background-color var(--bs-duration-fast) var(--bs-easing-standard);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.bs-chatbot-feedback__close svg {
|
|
60
|
+
width: 20px;
|
|
61
|
+
height: 20px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.bs-chatbot-feedback__close:hover {
|
|
65
|
+
background: var(--bs-chatbot-feedback-close-hover);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.bs-chatbot-feedback__top {
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: var(--bs-chatbot-feedback-top-gap);
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.bs-chatbot-feedback__text {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
gap: var(--bs-spacing-50);
|
|
81
|
+
width: 100%;
|
|
82
|
+
text-align: center;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.bs-chatbot-feedback__heading {
|
|
86
|
+
margin: 0;
|
|
87
|
+
color: var(--bs-chatbot-feedback-heading-color);
|
|
88
|
+
font-size: var(--bs-font-size-xl);
|
|
89
|
+
font-weight: var(--bs-font-weight-bold);
|
|
90
|
+
line-height: calc(var(--bs-line-height-heading-h5) * 1px);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.bs-chatbot-feedback__subtitle {
|
|
94
|
+
margin: 0;
|
|
95
|
+
color: var(--bs-chatbot-feedback-subtitle-color);
|
|
96
|
+
font-size: var(--bs-font-size-md);
|
|
97
|
+
line-height: calc(var(--bs-line-height-body-md) * 1px);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.bs-chatbot-feedback__stars {
|
|
101
|
+
display: flex;
|
|
102
|
+
gap: var(--bs-spacing-350);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.bs-chatbot-feedback__star {
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
width: 36px;
|
|
109
|
+
height: 36px;
|
|
110
|
+
padding: 0;
|
|
111
|
+
background: transparent;
|
|
112
|
+
border: none;
|
|
113
|
+
color: var(--bs-chatbot-feedback-star-empty);
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.bs-chatbot-feedback__star[aria-checked='true'] {
|
|
118
|
+
color: var(--bs-chatbot-feedback-star-filled);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.bs-chatbot-feedback__star:disabled {
|
|
122
|
+
cursor: default;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.bs-chatbot-feedback__star:focus-visible {
|
|
126
|
+
outline: 2px solid var(--bs-border-neutral-focus);
|
|
127
|
+
outline-offset: 2px;
|
|
128
|
+
border-radius: var(--bs-border-radius-50);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.bs-chatbot-feedback__field {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex-direction: column;
|
|
134
|
+
gap: var(--bs-spacing-50);
|
|
135
|
+
width: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.bs-chatbot-feedback__label {
|
|
139
|
+
color: var(--bs-input-label);
|
|
140
|
+
font-size: var(--bs-font-size-md);
|
|
141
|
+
font-weight: var(--bs-font-weight-semibold);
|
|
142
|
+
line-height: calc(var(--bs-line-height-body-md) * 1px);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.bs-chatbot-feedback__textarea {
|
|
146
|
+
box-sizing: border-box;
|
|
147
|
+
width: 100%;
|
|
148
|
+
/* Matches Figma's 103px Input Field height -- not tied to the spacing scale. */
|
|
149
|
+
min-height: 103px;
|
|
150
|
+
padding: var(--bs-spacing-100) var(--bs-spacing-150);
|
|
151
|
+
border: 1px solid var(--bs-input-border-default);
|
|
152
|
+
border-radius: var(--bs-border-radius-100);
|
|
153
|
+
background: var(--bs-input-bg-default);
|
|
154
|
+
color: var(--bs-input-text);
|
|
155
|
+
font-family: inherit;
|
|
156
|
+
font-size: var(--bs-font-size-md);
|
|
157
|
+
line-height: calc(var(--bs-line-height-body-md) * 1px);
|
|
158
|
+
resize: vertical;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.bs-chatbot-feedback__textarea::placeholder {
|
|
162
|
+
color: var(--bs-input-placeholder);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.bs-chatbot-feedback__textarea:hover {
|
|
166
|
+
border-color: var(--bs-input-border-hover);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.bs-chatbot-feedback__textarea:focus-visible {
|
|
170
|
+
outline: none;
|
|
171
|
+
border-color: var(--bs-input-border-focus);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.bs-chatbot-feedback__comment {
|
|
175
|
+
box-sizing: border-box;
|
|
176
|
+
width: 100%;
|
|
177
|
+
min-height: 103px;
|
|
178
|
+
margin: 0;
|
|
179
|
+
padding: var(--bs-spacing-100) var(--bs-spacing-150);
|
|
180
|
+
border: 1px solid var(--bs-input-border-default);
|
|
181
|
+
border-radius: var(--bs-border-radius-100);
|
|
182
|
+
background: var(--bs-input-bg-filled);
|
|
183
|
+
color: var(--bs-chatbot-feedback-comment-color);
|
|
184
|
+
font-size: var(--bs-font-size-md);
|
|
185
|
+
line-height: calc(var(--bs-line-height-body-md) * 1px);
|
|
186
|
+
word-break: break-word;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.bs-chatbot-feedback__actions {
|
|
190
|
+
display: flex;
|
|
191
|
+
flex-direction: column;
|
|
192
|
+
gap: var(--bs-spacing-150);
|
|
193
|
+
width: 100%;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.bs-chatbot-feedback__submit,
|
|
197
|
+
.bs-chatbot-feedback__new-chat {
|
|
198
|
+
box-sizing: border-box;
|
|
199
|
+
display: inline-flex;
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
gap: var(--bs-spacing-50);
|
|
203
|
+
width: 100%;
|
|
204
|
+
height: 44px;
|
|
205
|
+
padding: 0 var(--bs-spacing-250) 0 var(--bs-spacing-150);
|
|
206
|
+
border-radius: var(--bs-border-radius-100);
|
|
207
|
+
font-family: inherit;
|
|
208
|
+
font-size: var(--bs-font-size-md);
|
|
209
|
+
font-weight: var(--bs-font-weight-medium);
|
|
210
|
+
cursor: pointer;
|
|
211
|
+
transition: background-color var(--bs-duration-fast) var(--bs-easing-standard);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.bs-chatbot-feedback__submit svg,
|
|
215
|
+
.bs-chatbot-feedback__new-chat svg {
|
|
216
|
+
width: 24px;
|
|
217
|
+
height: 24px;
|
|
218
|
+
flex-shrink: 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.bs-chatbot-feedback__submit,
|
|
222
|
+
.bs-chatbot-feedback__new-chat--primary {
|
|
223
|
+
background: var(--bs-chatbot-feedback-primary-bg);
|
|
224
|
+
border: none;
|
|
225
|
+
color: var(--bs-text-on-action);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.bs-chatbot-feedback__submit:hover:not(:disabled),
|
|
229
|
+
.bs-chatbot-feedback__new-chat--primary:hover {
|
|
230
|
+
background: var(--bs-chatbot-feedback-primary-bg-hover);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.bs-chatbot-feedback__submit:disabled {
|
|
234
|
+
background: var(--bs-chatbot-feedback-primary-bg-disabled);
|
|
235
|
+
color: var(--bs-text-on-disabled);
|
|
236
|
+
cursor: not-allowed;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.bs-chatbot-feedback__new-chat--outlined {
|
|
240
|
+
background: transparent;
|
|
241
|
+
border: 1px solid var(--bs-chatbot-feedback-outlined-border);
|
|
242
|
+
color: var(--bs-chatbot-feedback-outlined-text);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.bs-chatbot-feedback__new-chat--outlined:hover {
|
|
246
|
+
background: var(--bs-chatbot-feedback-outlined-hover);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.bs-chatbot-feedback__submit:focus-visible,
|
|
250
|
+
.bs-chatbot-feedback__new-chat:focus-visible {
|
|
251
|
+
outline: 2px solid var(--bs-border-neutral-focus);
|
|
252
|
+
outline-offset: 2px;
|
|
253
|
+
}
|