@infinite-canvas-tutorial/webcomponents
Version:
WebComponents UI implementation
72 lines (69 loc) • 2.23 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
let InputSolid = class InputSolid extends LitElement {
handleSolidChanged(e) {
const value = e.target.color.toString();
this.dispatchEvent(new CustomEvent('color-change', {
detail: {
type: 'solid',
value,
},
bubbles: true,
composed: true,
}));
}
render() {
return html `<sp-color-area
color=${this.value}
@input=${this.handleSolidChanged}
></sp-color-area>
<sp-color-slider
color=${this.value}
@input=${this.handleSolidChanged}
></sp-color-slider>
<div class="hex-field">
<sp-field-label for="hex" side-aligned="start">Hex</sp-field-label>
<sp-color-field
id="hex"
size="s"
value=${this.value}
@input=${this.handleSolidChanged}
></sp-color-field>
</div>`;
}
};
InputSolid.styles = css `
:host {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 8px;
.hex-field {
display: flex;
align-items: center;
justify-content: center;
sp-color-field {
width: 100px;
}
}
}
sp-color-area {
width: 72px;
height: 72px;
}
`;
__decorate([
property()
], InputSolid.prototype, "value", void 0);
InputSolid = __decorate([
customElement('ic-spectrum-input-solid')
], InputSolid);
export { InputSolid };
//# sourceMappingURL=input-solid.js.map