@assecosolutions/fox-button-group
Advanced tools
Comparing version 1.0.0-beta.4 to 1.0.0-beta.5
17
index.js
@@ -1703,8 +1703,10 @@ import { css, LitElement, html as html$2 } from 'lit'; | ||
this.multiselect = false; | ||
/** | ||
* @property initialValue - Initial value of the button group use string for single select and string[] for multiselect | ||
*/ | ||
this.initialValue = ''; | ||
this.selectedIndex = []; | ||
} | ||
firstUpdated() { | ||
this.buttons.forEach((button, index) => { | ||
button.addEventListener('click', () => this.handleButtonClick(button, index)); | ||
}); | ||
this.initButtons(); | ||
} | ||
@@ -1747,2 +1749,10 @@ updated() { | ||
} | ||
initButtons() { | ||
this.buttons.forEach((button, index) => { | ||
button.addEventListener('click', () => this.handleButtonClick(button, index)); | ||
if (this.initialValue && this.initialValue.includes(button.label)) { | ||
this.multiselect ? this.selectButton(index) : this.toggleButton(index); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -1756,2 +1766,3 @@ /** | ||
}), __metadata("design:type", Object)], FoxButtonGroup.prototype, "multiselect", void 0); | ||
__decorate([property(), __metadata("design:type", Object)], FoxButtonGroup.prototype, "initialValue", void 0); | ||
__decorate([state(), __metadata("design:type", Array)], FoxButtonGroup.prototype, "selectedIndex", void 0); | ||
@@ -1758,0 +1769,0 @@ __decorate([queryAssignedElements({ |
{ | ||
"name": "@assecosolutions/fox-button-group", | ||
"version": "1.0.0-beta.4", | ||
"version": "1.0.0-beta.5", | ||
"public": true, | ||
@@ -20,4 +20,4 @@ "publishConfig": { | ||
"dependencies": { | ||
"@assecosolutions/fox-button": "~1.11.8-beta.4", | ||
"@assecosolutions/fox-common-utils": "~1.11.7-beta.4" | ||
"@assecosolutions/fox-button": "~1.11.8-beta.5", | ||
"@assecosolutions/fox-common-utils": "~1.11.7-beta.5" | ||
}, | ||
@@ -24,0 +24,0 @@ "peerDependencies": { |
@@ -24,2 +24,6 @@ import { LitElement } from 'lit'; | ||
multiselect: boolean; | ||
/** | ||
* @property initialValue - Initial value of the button group use string for single select and string[] for multiselect | ||
*/ | ||
initialValue: string | string[]; | ||
selectedIndex: number[]; | ||
@@ -32,3 +36,4 @@ buttons: NodeListOf<FoxButton>; | ||
private selectButton; | ||
handleButtonClick(button: FoxButton, index: number): void; | ||
private handleButtonClick; | ||
private initButtons; | ||
} |
@@ -11,2 +11,3 @@ import { Story } from '@storybook/web-components'; | ||
export declare const Multiselect: () => import("lit-html").TemplateResult<1>; | ||
export declare const initialValue: () => import("lit-html").TemplateResult<1>; | ||
export declare const InteractionTests: Story<FoxButtonGroup>; |
65805
1540