@infinite-canvas-tutorial/webcomponents
Version:
WebComponents UI implementation
75 lines (72 loc) • 2.41 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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InputSolid = void 0;
const lit_1 = require("lit");
const decorators_js_1 = require("lit/decorators.js");
let InputSolid = class InputSolid extends lit_1.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 (0, lit_1.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>`;
}
};
exports.InputSolid = InputSolid;
InputSolid.styles = (0, lit_1.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([
(0, decorators_js_1.property)()
], InputSolid.prototype, "value", void 0);
exports.InputSolid = InputSolid = __decorate([
(0, decorators_js_1.customElement)('ic-spectrum-input-solid')
], InputSolid);
//# sourceMappingURL=input-solid.js.map