@fluid-topics/ftds-input-label 2.1.0

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.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ The design system input label component
2
+
3
+ ## Install
4
+
5
+ ```shell
6
+ npm install @fluid-topics/ftds-input-label
7
+ yarn add @fluid-topics/ftds-input-label
8
+ ```
9
+
10
+ ## Usage
11
+
12
+ ```typescript
13
+ import { html } from "lit"
14
+ import "@fluid-topics/ftds-input-label"
15
+
16
+ function render() {
17
+ return html` <ftds-input-label foo="bar"></ftds-input-label> `
18
+ }
19
+ ```
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { customElements } from "@fluid-topics/ft-wc-utils";
2
+ import definitions from "./definitions";
3
+ customElements(definitions);
@@ -0,0 +1,5 @@
1
+ import { FtdsInputLabel } from "./ftds-input-label";
2
+ declare const _default: {
3
+ "ftds-input-label": typeof FtdsInputLabel;
4
+ };
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { FtdsInputLabel } from "./ftds-input-label";
2
+ export default {
3
+ "ftds-input-label": FtdsInputLabel,
4
+ };
@@ -0,0 +1,13 @@
1
+ import { FtdsInputLabelProperties } from "./ftds-input-label.properties";
2
+ import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
3
+ import { ClassInfo } from "lit/directives/class-map.js";
4
+ declare const FtdsInputLabel_base: import("@fluid-topics/ft-wc-utils").FtdsBaseType<typeof FtLitElement>;
5
+ export declare class FtdsInputLabel extends FtdsInputLabel_base implements FtdsInputLabelProperties {
6
+ static elementDefinitions: ElementDefinitionsMap;
7
+ text: string;
8
+ raised: boolean;
9
+ static styles: any[];
10
+ get inputLabelClasses(): ClassInfo;
11
+ protected render(): import("lit-html").TemplateResult<1>;
12
+ }
13
+ export {};
@@ -0,0 +1,50 @@
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 { FtLitElement, toFtdsBase, } from "@fluid-topics/ft-wc-utils";
8
+ import { styles } from "./ftds-input-label.styles";
9
+ import { classMap, } from "lit/directives/class-map.js";
10
+ import { FtTypographyCaption } from "@fluid-topics/ft-typography";
11
+ import { html } from "lit";
12
+ import { property } from "lit/decorators.js";
13
+ import { when } from "lit/directives/when.js";
14
+ export class FtdsInputLabel extends toFtdsBase(FtLitElement) {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.text = "";
18
+ this.raised = false;
19
+ }
20
+ get inputLabelClasses() {
21
+ return {
22
+ "ftds-input-label": true,
23
+ "ftds-input-label--raised": this.raised,
24
+ ...this.getDesignSystemBaseClasses(),
25
+ };
26
+ }
27
+ render() {
28
+ return html `
29
+ <div class="${classMap(this.inputLabelClasses)}">
30
+ ${when(this.text, () => html `
31
+ <div class="ftds-input-label--text ft-typography--caption">
32
+ <label class="ftds-input-label--floating-text">${this.text}</label>
33
+ <span class="ftds-input-label--hidden-text" aria-hidden="true">${this.text}</span>
34
+ </div>
35
+ `)}
36
+ </div>
37
+ `;
38
+ }
39
+ }
40
+ FtdsInputLabel.elementDefinitions = {};
41
+ FtdsInputLabel.styles = [
42
+ FtTypographyCaption,
43
+ styles,
44
+ ];
45
+ __decorate([
46
+ property({ type: String })
47
+ ], FtdsInputLabel.prototype, "text", void 0);
48
+ __decorate([
49
+ property({ type: Boolean })
50
+ ], FtdsInputLabel.prototype, "raised", void 0);