@fluid-topics/ft-input-label 1.2.69 → 1.2.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ import { ClassInfo } from "lit/directives/class-map.js";
2
+ import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
3
+ export interface FtBaseInputLabelProperties {
4
+ text?: string;
5
+ raised?: boolean;
6
+ }
7
+ export declare class FtBaseInputLabel extends FtLitElement implements FtBaseInputLabelProperties {
8
+ static elementDefinitions: ElementDefinitionsMap;
9
+ text: string;
10
+ raised: boolean;
11
+ get inputLabelClasses(): ClassInfo;
12
+ protected render(): import("lit-html").TemplateResult<1>;
13
+ }
@@ -0,0 +1,41 @@
1
+ var __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
+ };
7
+ import { html } from "lit";
8
+ import { property } from "lit/decorators.js";
9
+ import { when } from "lit/directives/when.js";
10
+ import { classMap } from "lit/directives/class-map.js";
11
+ import { FtLitElement } from "@fluid-topics/ft-wc-utils";
12
+ class FtBaseInputLabel extends FtLitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.text = "";
16
+ this.raised = false;
17
+ }
18
+ get inputLabelClasses() {
19
+ return {};
20
+ }
21
+ render() {
22
+ return html `
23
+ <div class="${classMap(this.inputLabelClasses)}">
24
+ ${when(this.text, () => html `
25
+ <div class="ft-input-label--text ft-typography--caption">
26
+ <label class="ft-input-label--floating-text">${this.text}</label>
27
+ <span class="ft-input-label--hidden-text" aria-hidden="true">${this.text}</span>
28
+ </div>
29
+ `)}
30
+ </div>
31
+ `;
32
+ }
33
+ }
34
+ FtBaseInputLabel.elementDefinitions = {};
35
+ __decorate([
36
+ property({ type: String })
37
+ ], FtBaseInputLabel.prototype, "text", void 0);
38
+ __decorate([
39
+ property({ type: Boolean })
40
+ ], FtBaseInputLabel.prototype, "raised", void 0);
41
+ export { FtBaseInputLabel };
@@ -1,12 +1,12 @@
1
- import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
1
+ import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
2
2
  import { FtInputLabelProperties } from "./ft-input-label.properties";
3
- export declare class FtInputLabel extends FtLitElement implements FtInputLabelProperties {
3
+ import { FtBaseInputLabel } from "./ft-base-input-label";
4
+ import { ClassInfo } from "lit/development/directives/class-map";
5
+ export declare class FtInputLabel extends FtBaseInputLabel implements FtInputLabelProperties {
4
6
  static elementDefinitions: ElementDefinitionsMap;
5
- static styles: import("lit").CSSResult[];
6
- text: string;
7
- raised: boolean;
8
7
  outlined: boolean;
9
- disabled: boolean;
10
8
  error: boolean;
11
- protected render(): import("lit-html").TemplateResult<1>;
9
+ disabled: boolean;
10
+ static styles: import("lit").CSSResult[];
11
+ get inputLabelClasses(): ClassInfo;
12
12
  }
@@ -4,39 +4,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { html } from "lit";
8
7
  import { property } from "lit/decorators.js";
9
- import { classMap } from "lit/directives/class-map.js";
10
- import { FtLitElement } from "@fluid-topics/ft-wc-utils";
11
8
  import { FtTypographyCaption } from "@fluid-topics/ft-typography/build/ft-typography.styles";
12
9
  import { styles } from "./ft-input-label.styles";
13
- class FtInputLabel extends FtLitElement {
10
+ import { FtBaseInputLabel } from "./ft-base-input-label";
11
+ class FtInputLabel extends FtBaseInputLabel {
14
12
  constructor() {
15
13
  super(...arguments);
16
- this.text = "";
17
- this.raised = false;
18
14
  this.outlined = false;
19
- this.disabled = false;
20
15
  this.error = false;
16
+ this.disabled = false;
21
17
  }
22
- render() {
23
- const classes = {
18
+ get inputLabelClasses() {
19
+ return {
24
20
  "ft-input-label": true,
25
21
  "ft-input-label--raised": this.raised,
26
22
  "ft-input-label--outlined": this.outlined,
27
23
  "ft-input-label--disabled": this.disabled,
28
24
  "ft-input-label--in-error": this.error,
29
25
  };
30
- return html `
31
- <div class="${classMap(classes)}">
32
- ${this.text ? html `
33
- <div class="ft-input-label--text ft-typography--caption">
34
- <span class="ft-input-label--floating-text">${this.text}</span>
35
- <span class="ft-input-label--hidden-text" aria-hidden="true">${this.text}</span>
36
- </div>
37
- ` : null}
38
- </div>
39
- `;
40
26
  }
41
27
  }
42
28
  FtInputLabel.elementDefinitions = {};
@@ -44,19 +30,13 @@ FtInputLabel.styles = [
44
30
  FtTypographyCaption,
45
31
  styles
46
32
  ];
47
- __decorate([
48
- property({ type: String })
49
- ], FtInputLabel.prototype, "text", void 0);
50
- __decorate([
51
- property({ type: Boolean })
52
- ], FtInputLabel.prototype, "raised", void 0);
53
33
  __decorate([
54
34
  property({ type: Boolean })
55
35
  ], FtInputLabel.prototype, "outlined", void 0);
56
36
  __decorate([
57
37
  property({ type: Boolean })
58
- ], FtInputLabel.prototype, "disabled", void 0);
38
+ ], FtInputLabel.prototype, "error", void 0);
59
39
  __decorate([
60
40
  property({ type: Boolean })
61
- ], FtInputLabel.prototype, "error", void 0);
41
+ ], FtInputLabel.prototype, "disabled", void 0);
62
42
  export { FtInputLabel };