UNPKG

2.5 kBJavaScriptView Raw
1var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4 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;
5 return c > 3 && r && Object.defineProperty(target, key, r), r;
6};
7var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8 if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11};
12var _DuoyunHelpTextElement_instances, _DuoyunHelpTextElement_status_get;
13import { adoptedStyle, customElement, attribute } from '@mantou/gem/lib/decorators';
14import { GemElement, html } from '@mantou/gem/lib/element';
15import { createCSSSheet, css } from '@mantou/gem/lib/utils';
16import { getStatusColor } from './status-light';
17const style = createCSSSheet(css `
18 :host {
19 margin-block: 0.2em;
20 font-size: 0.875em;
21 line-height: 1.5;
22 }
23`);
24/**
25 * @customElement dy-help-text
26 * @attr status
27 */
28let DuoyunHelpTextElement = class DuoyunHelpTextElement extends GemElement {
29 constructor() {
30 super(...arguments);
31 _DuoyunHelpTextElement_instances.add(this);
32 this.render = () => {
33 return html `
34 <style>
35 :host {
36 color: ${getStatusColor(__classPrivateFieldGet(this, _DuoyunHelpTextElement_instances, "a", _DuoyunHelpTextElement_status_get))};
37 }
38 </style>
39 <slot></slot>
40 `;
41 };
42 }
43};
44_DuoyunHelpTextElement_instances = new WeakSet(), _DuoyunHelpTextElement_status_get = function _DuoyunHelpTextElement_status_get() {
45 return this.status || 'neutral';
46};
47__decorate([
48 attribute
49], DuoyunHelpTextElement.prototype, "status", void 0);
50DuoyunHelpTextElement = __decorate([
51 customElement('dy-help-text'),
52 adoptedStyle(style)
53], DuoyunHelpTextElement);
54export { DuoyunHelpTextElement };
55//# sourceMappingURL=help-text.js.map
\No newline at end of file