@brandsync/wc 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +419 -0
- package/dist/brandsync-wc/brandsync-wc.esm.js +1 -1
- package/dist/brandsync-wc/{p-d3265e70.entry.js → p-16c960b5.entry.js} +1 -1
- package/dist/brandsync-wc/{p-1ce7dd64.entry.js → p-17a695af.entry.js} +1 -1
- package/dist/brandsync-wc/{p-321ed4d3.entry.js → p-196cfcf0.entry.js} +1 -1
- package/dist/brandsync-wc/{p-2063a6d6.entry.js → p-1fcc9f47.entry.js} +1 -1
- package/dist/brandsync-wc/{p-d55bbcec.entry.js → p-27cce165.entry.js} +1 -1
- package/dist/brandsync-wc/p-37365a51.entry.js +1 -0
- package/dist/brandsync-wc/p-3efb76dd.entry.js +1 -0
- package/dist/brandsync-wc/{p-20c24179.entry.js → p-45016a37.entry.js} +1 -1
- package/dist/brandsync-wc/{p-6b469b2d.entry.js → p-48000949.entry.js} +1 -1
- package/dist/brandsync-wc/{p-11f3fceb.entry.js → p-4ec24ccb.entry.js} +1 -1
- package/dist/brandsync-wc/{p-f4f22015.entry.js → p-4f8459ae.entry.js} +1 -1
- package/dist/brandsync-wc/p-613ff380.entry.js +1 -0
- package/dist/brandsync-wc/{p-18813680.entry.js → p-63167373.entry.js} +1 -1
- package/dist/brandsync-wc/{p-73217b90.entry.js → p-69c5bc2e.entry.js} +1 -1
- package/dist/brandsync-wc/{p-171fed0c.entry.js → p-7e544766.entry.js} +1 -1
- package/dist/brandsync-wc/{p-79af762c.entry.js → p-9f1e4a91.entry.js} +1 -1
- package/dist/brandsync-wc/{p-9876e83c.entry.js → p-ab8de9b6.entry.js} +1 -1
- package/dist/brandsync-wc/{p-81d49240.entry.js → p-b18e4845.entry.js} +1 -1
- package/dist/brandsync-wc/{p-111974df.entry.js → p-b5cbe30b.entry.js} +1 -1
- package/dist/brandsync-wc/{p-91551e7b.entry.js → p-baa4e2e0.entry.js} +1 -1
- package/dist/brandsync-wc/{p-9c4768aa.entry.js → p-c04cf1bb.entry.js} +1 -1
- package/dist/brandsync-wc/{p-00bb9bda.entry.js → p-c90f5a74.entry.js} +1 -1
- package/dist/brandsync-wc/{p-e93e944b.entry.js → p-d037b619.entry.js} +1 -1
- package/dist/brandsync-wc/{p-0f3cb0c4.entry.js → p-d22990c0.entry.js} +1 -1
- package/dist/brandsync-wc/{p-6d85fba4.entry.js → p-e231e4cf.entry.js} +1 -1
- package/dist/brandsync-wc/{p-0847f5c0.entry.js → p-e2a37bda.entry.js} +1 -1
- package/dist/brandsync-wc/{p-eb04c578.entry.js → p-e3ce0c8c.entry.js} +1 -1
- package/dist/cjs/brandsync-wc.cjs.js +1 -1
- package/dist/cjs/bs-ai-disclaimer.cjs.entry.js +1 -1
- package/dist/cjs/bs-ai-greeting.cjs.entry.js +1 -1
- package/dist/cjs/bs-ai-thinking.cjs.entry.js +1 -1
- package/dist/cjs/bs-attachment-list.cjs.entry.js +1 -1
- package/dist/cjs/bs-breadcrumbs.cjs.entry.js +1 -1
- package/dist/cjs/bs-button-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/bs-chatbot-feedback.cjs.entry.js +1 -1
- 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 +1 -1
- package/dist/cjs/bs-chatbot-suggestion-button.cjs.entry.js +1 -1
- package/dist/cjs/bs-checkbox-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/bs-inline-tab.cjs.entry.js +1 -1
- package/dist/cjs/bs-input.cjs.entry.js +2 -2
- package/dist/cjs/bs-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/bs-menu.cjs.entry.js +1 -1
- package/dist/cjs/bs-navigation-drawer-item.cjs.entry.js +1 -1
- package/dist/cjs/bs-navigation-drawer.cjs.entry.js +1 -1
- package/dist/cjs/bs-pagination.cjs.entry.js +1 -1
- package/dist/cjs/bs-radio.cjs.entry.js +1 -1
- package/dist/cjs/bs-source-link.cjs.entry.js +2 -2
- package/dist/cjs/bs-stepper-step.cjs.entry.js +44 -0
- package/dist/cjs/bs-stepper.cjs.entry.js +62 -0
- package/dist/cjs/bs-switch.cjs.entry.js +1 -1
- package/dist/cjs/bs-tab.cjs.entry.js +1 -1
- package/dist/cjs/bs-tabs.cjs.entry.js +1 -1
- package/dist/cjs/bs-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/bs-ai-disclaimer/bs-ai-disclaimer.js +1 -1
- package/dist/collection/components/bs-ai-greeting/bs-ai-greeting.js +1 -1
- package/dist/collection/components/bs-ai-thinking/bs-ai-thinking.js +1 -1
- package/dist/collection/components/bs-attachment-list/bs-attachment-list.js +1 -1
- package/dist/collection/components/bs-breadcrumb/bs-breadcrumbs/bs-breadcrumbs.js +1 -1
- package/dist/collection/components/bs-button-skeleton/bs-button-skeleton.js +1 -1
- package/dist/collection/components/bs-chatbot-feedback/bs-chatbot-feedback.js +1 -1
- 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.js +1 -1
- package/dist/collection/components/bs-chatbot-suggestion-button/bs-chatbot-suggestion-button.js +1 -1
- package/dist/collection/components/bs-checkbox/bs-checkbox-skeleton/bs-checkbox-skeleton.js +1 -1
- package/dist/collection/components/bs-input/bs-input.js +2 -2
- 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-pagination/bs-pagination.js +1 -1
- package/dist/collection/components/bs-radio/bs-radio.js +1 -1
- package/dist/collection/components/bs-source-link/bs-source-link.js +2 -2
- package/dist/collection/components/bs-stepper/bs-stepper/bs-stepper.cmp.test.js +42 -0
- package/dist/collection/components/bs-stepper/bs-stepper/bs-stepper.css +29 -0
- package/dist/collection/components/bs-stepper/bs-stepper/bs-stepper.js +162 -0
- package/dist/collection/components/bs-stepper/bs-stepper/bs-stepper.stories.js +59 -0
- package/dist/collection/components/bs-stepper/bs-stepper-step/bs-stepper-step.cmp.test.js +73 -0
- package/dist/collection/components/bs-stepper/bs-stepper-step/bs-stepper-step.css +258 -0
- package/dist/collection/components/bs-stepper/bs-stepper-step/bs-stepper-step.js +231 -0
- package/dist/collection/components/bs-switch/bs-switch.js +1 -1
- package/dist/collection/components/bs-tab/bs-inline-tab/bs-inline-tab.js +1 -1
- package/dist/collection/components/bs-tab/bs-tab/bs-tab.js +1 -1
- package/dist/collection/components/bs-tab/bs-tabs/bs-tabs.js +1 -1
- package/dist/collection/components/bs-tooltip/bs-tooltip.js +1 -1
- package/dist/collection/components/ui-shell/bs-navigation-drawer/bs-navigation-drawer/bs-navigation-drawer.js +1 -1
- package/dist/collection/components/ui-shell/bs-navigation-drawer/bs-navigation-drawer-item/bs-navigation-drawer-item.js +1 -1
- package/dist/components/bs-ai-disclaimer.js +1 -1
- package/dist/components/bs-ai-greeting.js +1 -1
- package/dist/components/bs-ai-thinking.js +1 -1
- package/dist/components/bs-attachment-list.js +1 -1
- package/dist/components/bs-breadcrumb-overflow.js +1 -1
- package/dist/components/bs-breadcrumbs.js +1 -1
- package/dist/components/bs-button-skeleton.js +1 -1
- package/dist/components/bs-chatbot-feedback.js +1 -1
- 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.js +1 -1
- package/dist/components/bs-chatbot-suggestion-button.js +1 -1
- package/dist/components/bs-checkbox-skeleton.js +1 -1
- package/dist/components/bs-inline-tab.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-navigation-drawer-item.js +1 -1
- package/dist/components/bs-navigation-drawer.js +1 -1
- package/dist/components/bs-pagination.js +1 -1
- package/dist/components/bs-radio.js +1 -1
- package/dist/components/bs-source-link.js +1 -1
- package/dist/components/bs-stepper-step.d.ts +11 -0
- package/dist/components/bs-stepper-step.js +1 -0
- package/dist/components/bs-stepper.d.ts +11 -0
- package/dist/components/bs-stepper.js +1 -0
- package/dist/components/bs-switch.js +1 -1
- package/dist/components/bs-tab.js +1 -1
- package/dist/components/bs-tabs.js +1 -1
- package/dist/components/bs-tooltip.js +1 -1
- package/dist/components/{p-BtX5URLk.js → p-Bs7nEbqK.js} +1 -1
- package/dist/components/{p-CgaPcyEJ.js → p-CPSCOLIf.js} +1 -1
- package/dist/components/{p-qK1XlpTA.js → p-CUa8zihb.js} +1 -1
- package/dist/esm/brandsync-wc.js +1 -1
- package/dist/esm/bs-ai-disclaimer.entry.js +1 -1
- package/dist/esm/bs-ai-greeting.entry.js +1 -1
- package/dist/esm/bs-ai-thinking.entry.js +1 -1
- package/dist/esm/bs-attachment-list.entry.js +1 -1
- package/dist/esm/bs-breadcrumbs.entry.js +1 -1
- package/dist/esm/bs-button-skeleton.entry.js +1 -1
- package/dist/esm/bs-chatbot-feedback.entry.js +1 -1
- 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 +1 -1
- package/dist/esm/bs-chatbot-suggestion-button.entry.js +1 -1
- package/dist/esm/bs-checkbox-skeleton.entry.js +1 -1
- package/dist/esm/bs-inline-tab.entry.js +1 -1
- package/dist/esm/bs-input.entry.js +2 -2
- package/dist/esm/bs-menu-item.entry.js +1 -1
- package/dist/esm/bs-menu.entry.js +1 -1
- package/dist/esm/bs-navigation-drawer-item.entry.js +1 -1
- package/dist/esm/bs-navigation-drawer.entry.js +1 -1
- package/dist/esm/bs-pagination.entry.js +1 -1
- package/dist/esm/bs-radio.entry.js +1 -1
- package/dist/esm/bs-source-link.entry.js +2 -2
- package/dist/esm/bs-stepper-step.entry.js +42 -0
- package/dist/esm/bs-stepper.entry.js +60 -0
- package/dist/esm/bs-switch.entry.js +1 -1
- package/dist/esm/bs-tab.entry.js +1 -1
- package/dist/esm/bs-tabs.entry.js +1 -1
- package/dist/esm/bs-tooltip.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/bs-stepper/bs-stepper/bs-stepper.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-stepper/bs-stepper/bs-stepper.d.ts +48 -0
- package/dist/types/components/bs-stepper/bs-stepper/bs-stepper.stories.d.ts +14 -0
- package/dist/types/components/bs-stepper/bs-stepper-step/bs-stepper-step.cmp.test.d.ts +1 -0
- package/dist/types/components/bs-stepper/bs-stepper-step/bs-stepper-step.d.ts +55 -0
- package/dist/types/components.d.ts +298 -0
- package/package.json +1 -1
- package/dist/brandsync-wc/p-1b7c9928.entry.js +0 -1
|
@@ -74,7 +74,7 @@ export class BsChatbotHeader {
|
|
|
74
74
|
this.bsClose.emit();
|
|
75
75
|
};
|
|
76
76
|
render() {
|
|
77
|
-
return (h("div", { key: '
|
|
77
|
+
return (h("div", { key: '976c52c3c5fc7d4b3a71669075263053abc7b253', class: "bs-chatbot-header", role: "banner", "aria-label": this.heading }, h("div", { key: 'ee3e0f4478ccbbe293c555f4f49c040dff3347de', part: "logo", class: "bs-chatbot-header__logo", role: "img", "aria-label": this.heading, innerHTML: GENIE_LOGO_SVG }), h("div", { key: '189372f43f8d38ae906498f3eb54d0c3023b32f9', class: "bs-chatbot-header__actions" }, h("span", { key: 'f0346193fa5927156265da9a785a6f1f6920eee9', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: '8c4efc93a8f9ff06e0640635670117a05a363e6b', type: "button", part: "new-chat", class: "bs-chatbot-header__button", "aria-label": "New chat", onClick: this.onNewChatClick }, h("slot", { key: '95c55f8631203dd8addeca3814f075635f403a33', name: "new-chat-icon" }, h(NewChatIcon, { key: '2472c8aab26a9f78ca3f8ee5c9c7742bc6c4fd0a' }))), h("bs-tooltip", { key: '5eea9d22cad778e51af7ea2cf5bb7b049efeddab', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "New chat")), h("span", { key: 'fa4c416c88908a72e1e60808786eaedb4682988e', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: 'cdc4c7ecf2fceb64ea9e5ff2bcb684e5773094ff', type: "button", part: "history", class: "bs-chatbot-header__button", "aria-label": "History", onClick: this.onHistoryClick }, h("slot", { key: 'f4dd57016f0d070fcef8bd108bee57c7541d9234', name: "history-icon" }, h(HistoryIcon, { key: '361f3512015127ded2802df421238e247cb21b39' }))), h("bs-tooltip", { key: '55170d0bc19d6c27327af2b637d97d9659f28d36', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, "History")), h("span", { key: 'b7e2916d6b821fa1a5399dc4b136a56cffa74262', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: '8708ed4e461c1267fa269b26d28c161c189c1545', 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: '89051c53a9023d97a46caea933c266d317854a19', name: "expand-icon" }, h(ExpandIcon, { key: '7da6d2c1d998aa81a2799451cd2e179d48c2bac0' }))), h("bs-tooltip", { key: '4e310620ee98ab1a86c431f8793973769cbcabe8', class: "bs-chatbot-header__tooltip", placement: "top", "aria-hidden": "true" }, this.expanded ? 'Collapse' : 'Expand')), h("span", { key: '4591bee15e6b9bffa8040886afd779be8b1ddf04', class: "bs-chatbot-header__tooltip-wrapper" }, h("button", { key: 'ed8f7b652940e0075a254705d503b872d9cb54dd', type: "button", part: "close", class: "bs-chatbot-header__button", "aria-label": "Close", onClick: this.onCloseClick }, h("slot", { key: '46fd676c08f046269ed459867733bfade7ee6347', name: "close-icon" }, h(CloseIcon, { key: '58ec3e580328eb7ed51579c03c02cd9b369a8cdf' }))), h("bs-tooltip", { key: '5808c60d8d56763f6dcc39e5862178190830f4bc', 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: '
|
|
108
|
+
return (h("div", { key: '36a3a372af16e57f0747d0afacede280c75e2baa', class: "bs-chatbot-response-action" }, h("button", { key: '5d67c3cb0b3488d3f3ac84fe593cacc66e119a3b', type: "button", part: "like", class: "bs-chatbot-response-action__button", "aria-label": "Like", onClick: this.onLikeClick }, h("slot", { key: 'b9447e9cb87c841cb75b015324780a926275643d', name: "like-icon" }, h(ThumbsUpIcon, { key: 'd5b8b4cb03eb08d12ef92d6ef7e8747830f496f0' }))), h("button", { key: 'e510cc2d7edf1b85b9c298f7d988b994f716821b', type: "button", part: "dislike", class: "bs-chatbot-response-action__button", "aria-label": "Dislike", onClick: this.onDislikeClick }, h("slot", { key: '94aa62133ad644a1423539a2854e24bd809ae934', name: "dislike-icon" }, h(ThumbsDownIcon, { key: '5770a79e906a6ff99ca9e632a2dbcfccf3478756' }))), h("button", { key: 'b8477c11b99ba291406ebc8fcb953ca87d21e5d5', type: "button", part: "copy", class: "bs-chatbot-response-action__button", "aria-label": "Copy", onClick: this.onCopyClick }, h("slot", { key: 'f2ebadfff852af1e1f1462257a1132ef16fd538d', name: "copy-icon" }, h(CopyIcon, { key: '57c470579a282b8fbd0aad5e1153e4e5666c8c04' }))), h("button", { key: 'd27f9d32f57296011f8c69848b678b745e068074', type: "button", part: "regenerate", class: "bs-chatbot-response-action__button", "aria-label": "Regenerate", onClick: this.onRegenerateClick }, h("slot", { key: 'eb8dc45632ecf993cbdb78a4174eee93fc8a1df8', name: "regenerate-icon" }, h(RegenerateIcon, { key: 'a1a72e6fdc499b4f76caeb747c4711b31985e5b8' }))), h("div", { key: 'e51c762ded01dcacbfcc554b858992ecf818b890', class: "bs-chatbot-response-action__menu-wrapper" }, h("button", { key: '43cb51c908e6e57f35d6ff84a0e7fba850c3c410', 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: '515f26fb7b3c861c5fb67e6831fa0cff568006d2', name: "menu-icon" }, h(MenuIcon, { key: '93c50b2d7ed0d710c30d33a0483943e12111f479' }))), this.menuOpen && (h("div", { key: '098e59c3e121fe9565d349372d84cc8106762968', class: "bs-chatbot-response-action__menu-popup" }, h("slot", { key: 'bc7a4ec19beeaf66d7dbd506914d185233677760', name: "menu" })))), hasSources && (h("button", { key: '703c714cf207a1475069cc8c93155b9be002310a', type: "button", part: "sources", class: "bs-chatbot-response-action__sources", onClick: this.onSourcesClick }, h("slot", { key: '8184596f5a98cbaaa276d337269aea27f3de5ba4', name: "sources-icon" }, h(SourcesIcon, { key: 'eb5984310dc77e1aa082c9275105bbca923cc7ab' })), h("span", { key: '52ba085dd94415e7ee36fce236375bd9d66f6145', 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"; }
|
|
@@ -57,7 +57,7 @@ export class BsChatbotSourcesDrawer {
|
|
|
57
57
|
};
|
|
58
58
|
render() {
|
|
59
59
|
const displayCount = this.count ?? this.slottedCount;
|
|
60
|
-
return (h("div", { key: '
|
|
60
|
+
return (h("div", { key: 'bbec982298c928942775b7543865781a3fd0c555', class: "bs-chatbot-sources-drawer", role: "region", "aria-label": this.heading }, h("div", { key: '9e6e7c89bdf061c89a608fcdc9aa9e85a8de731c', class: "bs-chatbot-sources-drawer__header" }, h("div", { key: '648efdba7da08457adf1e9fe5cb69b1a4d2f9266', class: "bs-chatbot-sources-drawer__title-group" }, h("h2", { key: '08557ea95eae88878c3c0971ce8aa5fa6a72bdcc', part: "heading", class: "bs-chatbot-sources-drawer__heading" }, this.heading), displayCount > 0 && (h("span", { key: '3aaf595afc3170bf8f18cf06a119555ff386aaa4', part: "count", class: "bs-chatbot-sources-drawer__count" }, displayCount))), h("button", { key: 'ccf98e8772366e8c91e6cb6f824194d4ec8a8b35', type: "button", part: "collapse", class: "bs-chatbot-sources-drawer__collapse", "aria-label": "Collapse sources", onClick: this.onCollapseClick }, h("slot", { key: 'd1f41711fd871e0f5ef0d23fd7ffb8ae0d6aa595', name: "collapse-icon" }, h(CaretRightIcon, { key: '55dea932bcfa2dcdb776cf452737362c52ea879e' })))), h("div", { key: 'f3f8e5fd96df856ecb965c7e75b706c1f8fe6488', part: "list", class: "bs-chatbot-sources-drawer__list" }, h("slot", { key: '27f35d19a5f00275c983f17a2709932fdf2f2b61', onSlotchange: this.onSlotchange }))));
|
|
61
61
|
}
|
|
62
62
|
static get is() { return "bs-chatbot-sources-drawer"; }
|
|
63
63
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/bs-chatbot-suggestion-button/bs-chatbot-suggestion-button.js
CHANGED
|
@@ -45,7 +45,7 @@ export class BsChatbotSuggestionButton {
|
|
|
45
45
|
this.bsSelect.emit();
|
|
46
46
|
};
|
|
47
47
|
render() {
|
|
48
|
-
return (h("button", { key: '
|
|
48
|
+
return (h("button", { key: '26a03adfaace4fffed0f3c371b665f49a68dbfae', type: "button", part: "button", class: "bs-chatbot-suggestion-button", disabled: this.disabled, onClick: this.onClick }, h("slot", { key: 'e40d0b911d11329ea5f07cffe1a0f60acf777dd5' })));
|
|
49
49
|
}
|
|
50
50
|
static get is() { return "bs-chatbot-suggestion-button"; }
|
|
51
51
|
static get encapsulation() { return "shadow"; }
|
|
@@ -33,7 +33,7 @@ export class BsCheckboxSkeleton {
|
|
|
33
33
|
* (unusual) default `bs-checkbox` itself uses. */
|
|
34
34
|
size = 'lg';
|
|
35
35
|
render() {
|
|
36
|
-
return (h("span", { key: '
|
|
36
|
+
return (h("span", { key: 'c2a6166646dde6d30242d16582706d0e422eb4d6', part: "container", class: "bs-checkbox-skeleton", role: "status", "aria-label": "Loading" }, h("span", { key: 'f1be3fc565db55eac147901c8035b9b83a75911d', part: "box", class: `bs-checkbox-skeleton__box bs-checkbox-skeleton__box--${this.size}` }), h("span", { key: '4dcce33b22c6930795d2c1ea3bc5d0aa84f3601b', part: "label", class: "bs-checkbox-skeleton__label" })));
|
|
37
37
|
}
|
|
38
38
|
static get is() { return "bs-checkbox-skeleton"; }
|
|
39
39
|
static get encapsulation() { return "shadow"; }
|
|
@@ -341,10 +341,10 @@ export class BsInput {
|
|
|
341
341
|
return (h("div", { part: "field", class: `bs-input__field bs-input__field--pin ${errorClass} ${disabledClass}` }, Array.from({ length: this.length }).map((_, i) => (h("input", { id: i === 0 ? 'control' : undefined, ref: el => (this.pinInputs[i] = el), part: "control", class: "bs-input__pin-cell", type: "text", inputMode: "numeric", maxLength: 1, value: this.value[i] ?? '', disabled: this.disabled, "aria-required": this.required ? 'true' : undefined, onInput: this.onPinInput(i), onKeyDown: this.onPinKeydown(i) })))));
|
|
342
342
|
}
|
|
343
343
|
render() {
|
|
344
|
-
return (h("div", { key: '
|
|
344
|
+
return (h("div", { key: '453a7f62d3fc7f9127ad3cdd56d1ab5eb8ec443d', class: `bs-input ${this.error ? 'bs-input--error' : ''}` }, this.label && (
|
|
345
345
|
// "control" is a fixed id, not a generated one -- safe because Shadow DOM scopes ids
|
|
346
346
|
// to this instance's own shadow root, so it can never collide with another bs-input.
|
|
347
|
-
h("label", { key: '
|
|
347
|
+
h("label", { key: '3c416fdcd928a9c96d902b6367ee9a5eb0680f28', part: "label", class: "bs-input__label", htmlFor: "control" }, this.label, this.required && (h("span", { key: 'a22575f1ba2bbce601b9bf65d475bdd3abd4c4b9', part: "required", class: "bs-input__required", "aria-hidden": "true" }, "*")))), this.type === 'pin' ? this.renderPinField() : this.type === 'initials' ? this.renderInitialsField() : this.renderField(), this.error ? (h("span", { id: "description-or-error", part: "error", class: "bs-input__error" }, h("svg", { part: "error-icon", class: "bs-input__error-icon", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true" }, h("circle", { cx: "8", cy: "8", r: "6.5", stroke: "currentColor", "stroke-width": "1.2" }), h("path", { d: "M8 5V8.5", stroke: "currentColor", "stroke-width": "1.2", "stroke-linecap": "round" }), h("circle", { cx: "8", cy: "11", r: "0.75", fill: "currentColor" })), this.error)) : this.description ? (h("span", { id: "description-or-error", part: "description", class: "bs-input__description" }, this.description)) : null));
|
|
348
348
|
}
|
|
349
349
|
static get is() { return "bs-input"; }
|
|
350
350
|
static get encapsulation() { return "shadow"; }
|
|
@@ -22,7 +22,7 @@ import { h } from "@stencil/core";
|
|
|
22
22
|
*/
|
|
23
23
|
export class BsMenu {
|
|
24
24
|
render() {
|
|
25
|
-
return (h("div", { key: '
|
|
25
|
+
return (h("div", { key: '274c9fe8ed3c71e81758bbbc04880c365a79da14', part: "list", class: "bs-menu", role: "menu" }, h("slot", { key: '0011856560d7b7e7ef0e72ef54e151e26d192eaf' })));
|
|
26
26
|
}
|
|
27
27
|
static get is() { return "bs-menu"; }
|
|
28
28
|
static get encapsulation() { return "shadow"; }
|
|
@@ -47,7 +47,7 @@ export class BsMenuItem {
|
|
|
47
47
|
this.bsSelect.emit();
|
|
48
48
|
};
|
|
49
49
|
render() {
|
|
50
|
-
return (h("button", { key: '
|
|
50
|
+
return (h("button", { key: 'ea5c64d6f4e5809b323cc55aeceb306666d57693', type: "button", part: "item", role: "menuitem", class: `bs-menu-item ${this.disabled ? 'bs-menu-item--disabled' : ''}`, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : undefined, onClick: this.onClick }, h("span", { key: '7e3ca7fcfabfc54151608b12a49c43d9192d449d', part: "icon", class: `bs-menu-item__icon ${this.hasIcon ? 'bs-menu-item__icon--has-content' : ''}` }, h("slot", { key: '49e8e51c8521b5c5bc0d341a1b915b9ed9b4274b', name: "icon", onSlotchange: this.onIconSlotchange })), h("span", { key: 'e453517c12cea42f93c8eae4f663269984dffe59', part: "label", class: "bs-menu-item__label" }, h("slot", { key: 'b268cced23bebc40560209eaab856dab51c2cd38' }))));
|
|
51
51
|
}
|
|
52
52
|
static get is() { return "bs-menu-item"; }
|
|
53
53
|
static get encapsulation() { return "shadow"; }
|
|
@@ -87,7 +87,7 @@ export class BsPagination {
|
|
|
87
87
|
}
|
|
88
88
|
render() {
|
|
89
89
|
const pageList = this.getPageList();
|
|
90
|
-
return (h("nav", { key: '
|
|
90
|
+
return (h("nav", { key: '0672f1f0264fb21d352bcdc1400d9cc712e703d0', "aria-label": "Pagination" }, h("ul", { key: '525ba6927de5a4b37a258a1513ac08d0e72ecef7', part: "list", class: "bs-pagination__list" }, h("li", { key: 'c40905f2ccf7fa9df67cde3c106d5f176f7bda4e', part: "item", class: "bs-pagination__item" }, h("button", { key: 'e09624f4c9a006a69d2c4dab14c744abb347b804', part: "prev", type: "button", class: "bs-pagination__control", "aria-label": this.previousLabel, disabled: this.currentPage <= 1, onClick: () => this.goToPage(this.currentPage - 1) }, h(ChevronLeftIcon, { key: '52e2a323c484f208c2dcbd0a783241eecdb6435d' }))), pageList.map((item, index) => item === 'ellipsis' ? (h("li", { part: "item", class: "bs-pagination__item", key: `ellipsis-${index}` }, h("span", { part: "ellipsis", class: "bs-pagination__ellipsis", "aria-hidden": "true" }, h(EllipsisIcon, null)))) : (h("li", { part: "item", class: "bs-pagination__item", key: item }, h("button", { part: item === this.currentPage ? 'page current' : 'page', type: "button", class: `bs-pagination__control bs-pagination__page ${item === this.currentPage ? 'bs-pagination__page--current' : ''}`, "aria-label": `Go to page ${item}`, "aria-current": item === this.currentPage ? 'page' : undefined, onClick: () => this.goToPage(item) }, item)))), h("li", { key: '01a3a6e391db347827cad882dcd762a246b2dd38', part: "item", class: "bs-pagination__item" }, h("button", { key: 'cf7389e94bf91d3878caefe6053aaa923d509b29', part: "next", type: "button", class: "bs-pagination__control", "aria-label": this.nextLabel, disabled: this.currentPage >= this.safeTotalPages, onClick: () => this.goToPage(this.currentPage + 1) }, h(ChevronRightIcon, { key: 'a77f841c472840f7d1560715e88b823ce65c8e9b' }))))));
|
|
91
91
|
}
|
|
92
92
|
static get is() { return "bs-pagination"; }
|
|
93
93
|
static get encapsulation() { return "shadow"; }
|
|
@@ -51,7 +51,7 @@ export class BsRadio {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
render() {
|
|
54
|
-
return (h("label", { key: '
|
|
54
|
+
return (h("label", { key: '6d78b0c2ec41903227ff468952ac1972a1948f61', class: `bs-radio ${this.disabled ? 'bs-radio--disabled' : ''}` }, h("input", { key: '0d777f016ccc089ef96c66ae36bab7bdda398e4b', class: "bs-radio__input", type: "radio", name: this.name, value: this.value, checked: this.checked, disabled: this.disabled, onChange: this.onChange }), h("span", { key: '7fbcc84ffad6dfb7304b7d62396ef3733c8ac30c', class: "bs-radio__hit-area" }, h("span", { key: 'a818b5bea42ebdd0713c92a1e70db3c27fe1bd20', class: "bs-radio__state-layer" }, h("span", { key: 'ac42d940f1ad3f868e940ec8507a51595829f369', part: "circle", class: `bs-radio__circle ${this.checked ? 'bs-radio__circle--selected' : ''}` }, this.checked && h("span", { key: 'b56060d980c6579b31f8f9de0cd7367b0c145955', part: "dot", class: "bs-radio__dot" })))), h("span", { key: '287cadc837f4477c12c46e01c94799d951746ce6', part: "label", class: "bs-radio__label" }, h("slot", { key: '0230d91af5c327b7a941c6e5b0459f82fda2b516' }))));
|
|
55
55
|
}
|
|
56
56
|
static get is() { return "bs-radio"; }
|
|
57
57
|
static get encapsulation() { return "shadow"; }
|
|
@@ -51,8 +51,8 @@ export class BsSourceLink {
|
|
|
51
51
|
};
|
|
52
52
|
render() {
|
|
53
53
|
const inner = [
|
|
54
|
-
h("span", { key: '
|
|
55
|
-
h("span", { key: '
|
|
54
|
+
h("span", { key: '753542a7656a7794bc572c25530f0a5eb1669d90', class: "bs-source-link__left" }, h("span", { key: 'fd80592c0236828d9a42c5e38136f8ef0534cb4c', class: "bs-source-link__filename-row" }, h("span", { key: '94343cc0f4defb5db6398758ae415dbf15b78496', part: "icon", class: "bs-source-link__icon" }, h("slot", { key: '3c07138dd24d92ee705185fa911aea7afff12a80', name: "icon" }, h(FileTextIcon, { key: 'ec9732d23d30f5b6a2300a25195369bd5f48db28' }))), h("p", { key: 'a74356f5ccc3afb88900b726432f3205d8a10fc5', part: "filename", class: "bs-source-link__filename" }, this.fileName)), h("span", { key: '682fcd2ecc83004dc0f59f93c3cf7b60dd9c6399', class: "bs-source-link__meta" }, this.sourceName && (h("span", { key: '6dc9967534fb2cf0d23f50a00e837d2979438af2', part: "source", class: "bs-source-link__source" }, this.sourceName)), this.sourceName && this.version && h("span", { key: '3e8679e0495224b3e178ec963da886c520880e74', class: "bs-source-link__dot", "aria-hidden": "true" }), this.version && (h("span", { key: '9ccb6b36baebadb43531c58a1668838d3073fc05', part: "version", class: "bs-source-link__version" }, this.version)))),
|
|
55
|
+
h("span", { key: '0dd405de92bbda04ddf6aeb137cc2bfa4687bcb9', part: "arrow", class: "bs-source-link__arrow", "aria-hidden": "true" }, h(ArrowUpRightIcon, { key: '4b07b527923871b6ece0a48800a1bf30812c53df' })),
|
|
56
56
|
];
|
|
57
57
|
return this.href ? (h("a", { class: "bs-source-link", href: this.href, target: this.target, rel: "noopener noreferrer", onClick: this.onClick }, inner)) : (h("button", { type: "button", class: "bs-source-link", onClick: this.onClick }, inner));
|
|
58
58
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { render, h, describe, it, expect } from "@stencil/vitest";
|
|
2
|
+
describe('bs-stepper', () => {
|
|
3
|
+
it('propagates computedState to slotted steps based on position relative to currentStep', async () => {
|
|
4
|
+
const { root, waitForChanges } = await render(h("bs-stepper", { currentStep: 2 }, h("bs-stepper-step", { name: "Cart" }), h("bs-stepper-step", { name: "Shipping" }), h("bs-stepper-step", { name: "Payment" }), h("bs-stepper-step", { name: "Confirm" })));
|
|
5
|
+
await waitForChanges();
|
|
6
|
+
const steps = root.querySelectorAll('bs-stepper-step');
|
|
7
|
+
expect(steps[0].computedState).toBe('done');
|
|
8
|
+
expect(steps[1].computedState).toBe('done');
|
|
9
|
+
expect(steps[2].computedState).toBe('current');
|
|
10
|
+
expect(steps[3].computedState).toBe('enabled');
|
|
11
|
+
});
|
|
12
|
+
it('re-propagates computedState when currentStep changes', async () => {
|
|
13
|
+
const { root, waitForChanges } = await render(h("bs-stepper", { currentStep: 0 }, h("bs-stepper-step", { name: "A" }), h("bs-stepper-step", { name: "B" })));
|
|
14
|
+
await waitForChanges();
|
|
15
|
+
root.currentStep = 1;
|
|
16
|
+
await waitForChanges();
|
|
17
|
+
const steps = root.querySelectorAll('bs-stepper-step');
|
|
18
|
+
expect(steps[0].computedState).toBe('done');
|
|
19
|
+
expect(steps[1].computedState).toBe('current');
|
|
20
|
+
});
|
|
21
|
+
it('propagates direction and showDescription to slotted steps', async () => {
|
|
22
|
+
const { root, waitForChanges } = await render(h("bs-stepper", { direction: "vertical", showDescription: false }, h("bs-stepper-step", { name: "A" })));
|
|
23
|
+
await waitForChanges();
|
|
24
|
+
const step = root.querySelector('bs-stepper-step');
|
|
25
|
+
expect(step.direction).toBe('vertical');
|
|
26
|
+
expect(step.showDescription).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
it('propagates the current props to a step added after initial render', async () => {
|
|
29
|
+
// currentStep=0 and this being the only (so index-0) step once appended -- 0 === 0 -> "current".
|
|
30
|
+
const { root, waitForChanges } = await render(h("bs-stepper", { currentStep: 0 }));
|
|
31
|
+
await waitForChanges();
|
|
32
|
+
const step = document.createElement('bs-stepper-step');
|
|
33
|
+
step.setAttribute('name', 'Late add');
|
|
34
|
+
root.appendChild(step);
|
|
35
|
+
await waitForChanges();
|
|
36
|
+
expect(step.computedState).toBe('current');
|
|
37
|
+
});
|
|
38
|
+
it('reflects the direction attribute for the container itself', async () => {
|
|
39
|
+
const { root } = await render(h("bs-stepper", { direction: "vertical" }));
|
|
40
|
+
expect(root).toEqualAttribute('direction', 'vertical');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @prop --bs-stepper-edge-padding: Horizontal padding, direction="horizontal" only. Aliased to
|
|
3
|
+
* --bs-spacing-800. Every step's name/description centers under its own icon (see
|
|
4
|
+
* bs-stepper-step.css), including the first and last steps -- whose icons sit flush against this
|
|
5
|
+
* container's own edges. Without this padding, a first/last step's centered text has room to
|
|
6
|
+
* overflow in only one direction and clips against the container edge (confirmed by measuring a
|
|
7
|
+
* real render: a description clipped to a negative x position). This padding exists purely to give
|
|
8
|
+
* that overflow somewhere to go; it isn't a general "breathing room" affordance for content that
|
|
9
|
+
* fits.
|
|
10
|
+
*/
|
|
11
|
+
/* This container renders a bare <slot> with no wrapping element (see bs-stepper.tsx), so :host
|
|
12
|
+
itself is what establishes the flex row/column context each slotted bs-stepper-step's own
|
|
13
|
+
`:host(.bs-stepper-step--horizontal) { flex: 1 1 0; }` (etc.) expects from its parent. */
|
|
14
|
+
:host {
|
|
15
|
+
display: flex;
|
|
16
|
+
width: 100%;
|
|
17
|
+
|
|
18
|
+
--bs-stepper-edge-padding: var(--bs-spacing-800);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([direction='vertical']) {
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host(:not([direction='vertical'])) {
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
padding: 0 var(--bs-stepper-edge-padding);
|
|
29
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* A sequence of named steps showing overall progress through a multi-step flow (e.g. a checkout,
|
|
4
|
+
* an onboarding wizard) -- each step reads as enabled (not yet reached), current, done, error, or
|
|
5
|
+
* disabled, connected by a rail between them.
|
|
6
|
+
*
|
|
7
|
+
* This container is intentionally thin: it renders a `<slot>` for `<bs-stepper-step>` children and
|
|
8
|
+
* propagates `currentStep`/`direction`/`showDescription` down to them as JS properties whenever any
|
|
9
|
+
* of those change or the slotted children themselves change -- the same "container pushes state
|
|
10
|
+
* onto its slotted children" pattern `bs-tabs` uses for `selected` and `bs-breadcrumbs` uses for
|
|
11
|
+
* `size`. Each step computes its own `enabled`/`current`/`done` state from its position among its
|
|
12
|
+
* siblings relative to `currentStep`, unless that step's own `error`/`disabled` prop overrides it.
|
|
13
|
+
*
|
|
14
|
+
* This is a static status display, not an interactive control -- Figma's spec shows no
|
|
15
|
+
* hover/pressed treatment on any step, so nothing here is clickable.
|
|
16
|
+
*
|
|
17
|
+
* ## When to use
|
|
18
|
+
* - Showing where the user is in a fixed, ordered, multi-step flow.
|
|
19
|
+
*
|
|
20
|
+
* ## When not to use
|
|
21
|
+
* - A flow whose steps aren't fixed/known in advance -- a stepper implies the full sequence is
|
|
22
|
+
* already known.
|
|
23
|
+
* - As a substitute for actual in-page navigation between steps -- pair this with real controls
|
|
24
|
+
* (Next/Back buttons) elsewhere in the flow, this component only displays status.
|
|
25
|
+
*
|
|
26
|
+
* @slot - Default slot: the `<bs-stepper-step>` elements making up the sequence, in order.
|
|
27
|
+
*/
|
|
28
|
+
export class BsStepper {
|
|
29
|
+
el;
|
|
30
|
+
/** 0-indexed: which step is current. Every step before this index reads as "done" (unless that
|
|
31
|
+
* step's own `error`/`disabled` overrides it), every step after reads as "enabled". */
|
|
32
|
+
currentStep = 0;
|
|
33
|
+
/** `horizontal` (icon above name/description, connected by a horizontal rail) or `vertical`
|
|
34
|
+
* (icon beside name/description, connected by a vertical rail). Propagated to every slotted
|
|
35
|
+
* `bs-stepper-step`, and reflected as an attribute so this container's own `:host` CSS can switch
|
|
36
|
+
* its `flex-direction` to match -- a bare `<slot>` with no wrapping element (see `render()`)
|
|
37
|
+
* means the slotted steps' flex-row/column layout comes directly from `:host` here, not from any
|
|
38
|
+
* wrapper div. */
|
|
39
|
+
direction = 'horizontal';
|
|
40
|
+
/** Whether each step's description renders at all. Propagated to every slotted
|
|
41
|
+
* `bs-stepper-step`. */
|
|
42
|
+
showDescription = true;
|
|
43
|
+
onPropChange() {
|
|
44
|
+
this.propagateToSteps();
|
|
45
|
+
}
|
|
46
|
+
componentDidLoad() {
|
|
47
|
+
this.propagateToSteps();
|
|
48
|
+
}
|
|
49
|
+
onSlotChange = () => {
|
|
50
|
+
this.propagateToSteps();
|
|
51
|
+
};
|
|
52
|
+
propagateToSteps() {
|
|
53
|
+
const steps = this.el.querySelectorAll(':scope > bs-stepper-step');
|
|
54
|
+
steps.forEach((step, index) => {
|
|
55
|
+
const computedState = index < this.currentStep ? 'done' : index === this.currentStep ? 'current' : 'enabled';
|
|
56
|
+
Object.assign(step, {
|
|
57
|
+
computedState,
|
|
58
|
+
direction: this.direction,
|
|
59
|
+
showDescription: this.showDescription,
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
return h("slot", { key: 'aed14a6d1d81b19d7d53fe9a536b2eb4912a2108', onSlotchange: this.onSlotChange });
|
|
65
|
+
}
|
|
66
|
+
static get is() { return "bs-stepper"; }
|
|
67
|
+
static get encapsulation() { return "shadow"; }
|
|
68
|
+
static get originalStyleUrls() {
|
|
69
|
+
return {
|
|
70
|
+
"$": ["bs-stepper.css"]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
static get styleUrls() {
|
|
74
|
+
return {
|
|
75
|
+
"$": ["bs-stepper.css"]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
static get properties() {
|
|
79
|
+
return {
|
|
80
|
+
"currentStep": {
|
|
81
|
+
"type": "number",
|
|
82
|
+
"mutable": false,
|
|
83
|
+
"complexType": {
|
|
84
|
+
"original": "number",
|
|
85
|
+
"resolved": "number",
|
|
86
|
+
"references": {}
|
|
87
|
+
},
|
|
88
|
+
"required": false,
|
|
89
|
+
"optional": false,
|
|
90
|
+
"docs": {
|
|
91
|
+
"tags": [],
|
|
92
|
+
"text": "0-indexed: which step is current. Every step before this index reads as \"done\" (unless that\nstep's own `error`/`disabled` overrides it), every step after reads as \"enabled\"."
|
|
93
|
+
},
|
|
94
|
+
"getter": false,
|
|
95
|
+
"setter": false,
|
|
96
|
+
"reflect": false,
|
|
97
|
+
"attribute": "current-step",
|
|
98
|
+
"defaultValue": "0"
|
|
99
|
+
},
|
|
100
|
+
"direction": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"mutable": false,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "BsStepperDirection",
|
|
105
|
+
"resolved": "\"horizontal\" | \"vertical\"",
|
|
106
|
+
"references": {
|
|
107
|
+
"BsStepperDirection": {
|
|
108
|
+
"location": "import",
|
|
109
|
+
"path": "../bs-stepper-step/bs-stepper-step",
|
|
110
|
+
"id": "src/components/bs-stepper/bs-stepper-step/bs-stepper-step.tsx::BsStepperDirection",
|
|
111
|
+
"referenceLocation": "BsStepperDirection"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": false,
|
|
116
|
+
"optional": false,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [],
|
|
119
|
+
"text": "`horizontal` (icon above name/description, connected by a horizontal rail) or `vertical`\n(icon beside name/description, connected by a vertical rail). Propagated to every slotted\n`bs-stepper-step`, and reflected as an attribute so this container's own `:host` CSS can switch\nits `flex-direction` to match -- a bare `<slot>` with no wrapping element (see `render()`)\nmeans the slotted steps' flex-row/column layout comes directly from `:host` here, not from any\nwrapper div."
|
|
120
|
+
},
|
|
121
|
+
"getter": false,
|
|
122
|
+
"setter": false,
|
|
123
|
+
"reflect": true,
|
|
124
|
+
"attribute": "direction",
|
|
125
|
+
"defaultValue": "'horizontal'"
|
|
126
|
+
},
|
|
127
|
+
"showDescription": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "boolean",
|
|
132
|
+
"resolved": "boolean",
|
|
133
|
+
"references": {}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": "Whether each step's description renders at all. Propagated to every slotted\n`bs-stepper-step`."
|
|
140
|
+
},
|
|
141
|
+
"getter": false,
|
|
142
|
+
"setter": false,
|
|
143
|
+
"reflect": false,
|
|
144
|
+
"attribute": "show-description",
|
|
145
|
+
"defaultValue": "true"
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
static get elementRef() { return "el"; }
|
|
150
|
+
static get watchers() {
|
|
151
|
+
return [{
|
|
152
|
+
"propName": "currentStep",
|
|
153
|
+
"methodName": "onPropChange"
|
|
154
|
+
}, {
|
|
155
|
+
"propName": "direction",
|
|
156
|
+
"methodName": "onPropChange"
|
|
157
|
+
}, {
|
|
158
|
+
"propName": "showDescription",
|
|
159
|
+
"methodName": "onPropChange"
|
|
160
|
+
}];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { componentDescription, propDescription } from "../../../stories-utils";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Components/bs-stepper',
|
|
5
|
+
parameters: { docs: { description: { component: componentDescription('bs-stepper') } } },
|
|
6
|
+
render: args => html `
|
|
7
|
+
<bs-stepper current-step=${args.currentStep} direction=${args.direction} show-description=${args.showDescription}>
|
|
8
|
+
<bs-stepper-step name="Cart" description="Review items"></bs-stepper-step>
|
|
9
|
+
<bs-stepper-step name="Shipping" description="Delivery address"></bs-stepper-step>
|
|
10
|
+
<bs-stepper-step name="Payment" description="Card details"></bs-stepper-step>
|
|
11
|
+
<bs-stepper-step name="Confirm" description="Review order"></bs-stepper-step>
|
|
12
|
+
</bs-stepper>
|
|
13
|
+
`,
|
|
14
|
+
argTypes: {
|
|
15
|
+
currentStep: { control: { type: 'number', min: 0, max: 3 }, description: propDescription('bs-stepper', 'currentStep') },
|
|
16
|
+
direction: { control: { type: 'select' }, options: ['horizontal', 'vertical'], description: propDescription('bs-stepper', 'direction') },
|
|
17
|
+
showDescription: { control: 'boolean', description: propDescription('bs-stepper', 'showDescription') },
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
currentStep: 1,
|
|
21
|
+
direction: 'horizontal',
|
|
22
|
+
showDescription: true,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
export const Default = {};
|
|
27
|
+
export const Vertical = {
|
|
28
|
+
args: { direction: 'vertical' },
|
|
29
|
+
};
|
|
30
|
+
// A step's own `error` attribute overrides its position-derived state -- Shipping shows the error
|
|
31
|
+
// treatment even though it's before currentStep (which would normally read as "done").
|
|
32
|
+
export const WithError = {
|
|
33
|
+
name: 'With an error step',
|
|
34
|
+
args: { currentStep: 2 },
|
|
35
|
+
render: args => html `
|
|
36
|
+
<bs-stepper current-step=${args.currentStep} direction=${args.direction} show-description=${args.showDescription}>
|
|
37
|
+
<bs-stepper-step name="Cart" description="Review items"></bs-stepper-step>
|
|
38
|
+
<bs-stepper-step name="Shipping" description="Delivery address" error></bs-stepper-step>
|
|
39
|
+
<bs-stepper-step name="Payment" description="Card details"></bs-stepper-step>
|
|
40
|
+
<bs-stepper-step name="Confirm" description="Review order"></bs-stepper-step>
|
|
41
|
+
</bs-stepper>
|
|
42
|
+
`,
|
|
43
|
+
};
|
|
44
|
+
export const WithDisabledStep = {
|
|
45
|
+
name: 'With a disabled step',
|
|
46
|
+
args: { currentStep: 2 },
|
|
47
|
+
render: args => html `
|
|
48
|
+
<bs-stepper current-step=${args.currentStep} direction=${args.direction} show-description=${args.showDescription}>
|
|
49
|
+
<bs-stepper-step name="Cart" description="Review items"></bs-stepper-step>
|
|
50
|
+
<bs-stepper-step name="Shipping" description="Delivery address"></bs-stepper-step>
|
|
51
|
+
<bs-stepper-step name="Payment" description="Card details"></bs-stepper-step>
|
|
52
|
+
<bs-stepper-step name="Confirm" description="Review order" disabled></bs-stepper-step>
|
|
53
|
+
</bs-stepper>
|
|
54
|
+
`,
|
|
55
|
+
};
|
|
56
|
+
export const NoDescription = {
|
|
57
|
+
name: 'No description',
|
|
58
|
+
args: { showDescription: false },
|
|
59
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { render, h, describe, it, expect } from "@stencil/vitest";
|
|
2
|
+
describe('bs-stepper-step', () => {
|
|
3
|
+
it('defaults to enabled/horizontal/showDescription=true when used standalone', async () => {
|
|
4
|
+
const { root } = await render(h("bs-stepper-step", { name: "Cart" }));
|
|
5
|
+
expect(root.shadowRoot.querySelector('[part="icon"]')).toHaveClass('bs-stepper-step__icon--enabled');
|
|
6
|
+
expect(root).toHaveClass('bs-stepper-step--horizontal');
|
|
7
|
+
});
|
|
8
|
+
it('renders the name text', async () => {
|
|
9
|
+
const { root } = await render(h("bs-stepper-step", { name: "Shipping" }));
|
|
10
|
+
expect(root.shadowRoot.querySelector('[part="name"]').textContent.trim()).toBe('Shipping');
|
|
11
|
+
});
|
|
12
|
+
describe('state resolution', () => {
|
|
13
|
+
it('error overrides computedState', async () => {
|
|
14
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", computedState: "done", error: true }));
|
|
15
|
+
expect(root.shadowRoot.querySelector('[part="icon"]')).toHaveClass('bs-stepper-step__icon--error');
|
|
16
|
+
});
|
|
17
|
+
it('disabled overrides both computedState and error', async () => {
|
|
18
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", computedState: "current", error: true, disabled: true }));
|
|
19
|
+
expect(root.shadowRoot.querySelector('[part="icon"]')).toHaveClass('bs-stepper-step__icon--disabled');
|
|
20
|
+
});
|
|
21
|
+
it('falls back to computedState when neither error nor disabled is set', async () => {
|
|
22
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", computedState: "done" }));
|
|
23
|
+
expect(root.shadowRoot.querySelector('[part="icon"]')).toHaveClass('bs-stepper-step__icon--done');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('icon content per state', () => {
|
|
27
|
+
it('done shows a checkmark', async () => {
|
|
28
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", computedState: "done" }));
|
|
29
|
+
expect(root.shadowRoot.querySelector('[part="icon"] svg')).not.toBeNull();
|
|
30
|
+
});
|
|
31
|
+
it('current shows an inner dot, no svg', async () => {
|
|
32
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", computedState: "current" }));
|
|
33
|
+
expect(root.shadowRoot.querySelector('.bs-stepper-step__icon-dot')).not.toBeNull();
|
|
34
|
+
expect(root.shadowRoot.querySelector('[part="icon"] svg')).toBeNull();
|
|
35
|
+
});
|
|
36
|
+
it('enabled shows neither', async () => {
|
|
37
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", computedState: "enabled" }));
|
|
38
|
+
expect(root.shadowRoot.querySelector('.bs-stepper-step__icon-dot')).toBeNull();
|
|
39
|
+
expect(root.shadowRoot.querySelector('[part="icon"] svg')).toBeNull();
|
|
40
|
+
});
|
|
41
|
+
it('error shows an exclamation icon', async () => {
|
|
42
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", error: true }));
|
|
43
|
+
expect(root.shadowRoot.querySelector('[part="icon"] svg')).not.toBeNull();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe('showDescription', () => {
|
|
47
|
+
it('renders the description when set and showDescription is true', async () => {
|
|
48
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", description: "Some detail", showDescription: true }));
|
|
49
|
+
expect(root.shadowRoot.querySelector('[part="description"]').textContent.trim()).toBe('Some detail');
|
|
50
|
+
});
|
|
51
|
+
it('does not render a description when showDescription is false', async () => {
|
|
52
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", description: "Some detail", showDescription: false }));
|
|
53
|
+
expect(root.shadowRoot.querySelector('[part="description"]')).toBeNull();
|
|
54
|
+
});
|
|
55
|
+
it('does not render a description that was never set, even with showDescription true', async () => {
|
|
56
|
+
const { root } = await render(h("bs-stepper-step", { name: "A", showDescription: true }));
|
|
57
|
+
expect(root.shadowRoot.querySelector('[part="description"]')).toBeNull();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
it('hides its own trailing connector when last in its parent, regardless of tag mix', async () => {
|
|
61
|
+
const container = document.createElement('div');
|
|
62
|
+
container.innerHTML = '<bs-stepper-step name="A"></bs-stepper-step><bs-stepper-step name="B"></bs-stepper-step>';
|
|
63
|
+
document.body.appendChild(container);
|
|
64
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
65
|
+
await new Promise(resolve => requestAnimationFrame(resolve));
|
|
66
|
+
const [first, second] = Array.from(container.querySelectorAll('bs-stepper-step'));
|
|
67
|
+
const firstConnector = first.shadowRoot.querySelector('.bs-stepper-step__connector');
|
|
68
|
+
const secondConnector = second.shadowRoot.querySelector('.bs-stepper-step__connector');
|
|
69
|
+
expect(getComputedStyle(firstConnector).visibility).not.toBe('hidden');
|
|
70
|
+
expect(getComputedStyle(secondConnector).visibility).toBe('hidden');
|
|
71
|
+
container.remove();
|
|
72
|
+
});
|
|
73
|
+
});
|