@stories-js/core
Version:
Stories web components to build stories
106 lines • 2.66 kB
JavaScript
/*!
* (C) StoriesJS https://storiesjs.org - GPL-2.0 License
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Component, Event, h, Prop } from '@stencil/core';
export class ToolButton {
/**
* Handle mouse event and generate ActionEvent
*/
clickHandler(event) {
event.preventDefault();
this.storiesAction.emit({ command: this.command });
}
render() {
return (h("button", { disabled: this.disabled, onClick: this.clickHandler.bind(this) },
h("stories-icon", { name: this.icon })));
}
static get is() { return "stories-tool-button"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() { return {
"$": ["tool-button.scss"]
}; }
static get styleUrls() { return {
"$": ["tool-button.css"]
}; }
static get properties() { return {
"disabled": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "disabled property"
},
"attribute": "disabled",
"reflect": false
},
"icon": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "icon property"
},
"attribute": "icon",
"reflect": false
},
"command": {
"type": "string",
"mutable": false,
"complexType": {
"original": "Commands",
"resolved": "\"zoomIn\" | \"zoomOut\" | \"zoomReset\"",
"references": {
"Commands": {
"location": "import",
"path": "../../types"
}
}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "command property"
},
"attribute": "command",
"reflect": false
}
}; }
static get events() { return [{
"method": "storiesAction",
"name": "storiesAction",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": "Action Event"
},
"complexType": {
"original": "ToolEvent",
"resolved": "{ command: string; data?: unknown; }",
"references": {
"ToolEvent": {
"location": "import",
"path": "../../types"
}
}
}
}]; }
}
//# sourceMappingURL=tool-button.js.map