@fluid-topics/ft-input-label 0.3.12 → 0.3.13

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,15 @@
1
+ export declare const FtInputLabelCssVariables: {
2
+ fontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
3
+ raisedFontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
4
+ raisedZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
5
+ verticalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
6
+ horizontalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
7
+ borderColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
8
+ textColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
9
+ disabledTextColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
10
+ colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
11
+ borderRadiusS: import("@fluid-topics/ft-wc-utils").FtCssVariable;
12
+ colorError: import("@fluid-topics/ft-wc-utils").FtCssVariable;
13
+ };
14
+ export declare const styles: import("lit").CSSResult;
15
+ //# sourceMappingURL=ft-input-label.css.d.ts.map
@@ -0,0 +1,135 @@
1
+ import { css } from "lit";
2
+ import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
3
+ import { FtTypographyCaptionCssVariables } from "@fluid-topics/ft-typography/build/ft-typography.css";
4
+ export const FtInputLabelCssVariables = {
5
+ fontSize: FtCssVariableFactory.create("--ft-input-label-font-size", "SIZE", "14px"),
6
+ raisedFontSize: FtCssVariableFactory.create("--ft-input-label-raised-font-size", "SIZE", "11px"),
7
+ raisedZIndex: FtCssVariableFactory.create("--ft-input-label-outlined-raised-z-index", "NUMBER", "2"),
8
+ verticalSpacing: FtCssVariableFactory.create("--ft-input-label-vertical-spacing", "SIZE", "4px"),
9
+ horizontalSpacing: FtCssVariableFactory.create("--ft-input-label-horizontal-spacing", "SIZE", "12px"),
10
+ borderColor: FtCssVariableFactory.extend("--ft-input-label-border-color", designSystemVariables.colorOutline),
11
+ textColor: FtCssVariableFactory.extend("--ft-input-label-text-color", designSystemVariables.colorOnSurfaceMedium),
12
+ disabledTextColor: FtCssVariableFactory.extend("--ft-input-label-disabled-text-color", designSystemVariables.colorOnSurfaceDisabled),
13
+ colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
14
+ borderRadiusS: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design system"),
15
+ colorError: FtCssVariableFactory.external(designSystemVariables.colorError, "Design system"),
16
+ };
17
+ // language=CSS
18
+ export const styles = css `
19
+ .ft-input-label {
20
+ position: absolute;
21
+ inset: 0;
22
+ display: flex;
23
+ background-color: ${FtInputLabelCssVariables.colorSurface};
24
+ border-radius: ${FtInputLabelCssVariables.borderRadiusS} ${FtInputLabelCssVariables.borderRadiusS} 0 0;
25
+ }
26
+
27
+ .ft-input-label--outlined {
28
+ border-radius: ${FtInputLabelCssVariables.borderRadiusS};
29
+ }
30
+
31
+ .ft-input-label {
32
+ border-color: ${FtInputLabelCssVariables.borderColor};
33
+ }
34
+
35
+ .ft-input-label.ft-input-label--in-error {
36
+ border-color: ${FtInputLabelCssVariables.colorError}
37
+ }
38
+
39
+ .ft-input-label:before,
40
+ .ft-input-label:after {
41
+ content: "";
42
+ display: flex;
43
+ border-bottom-width: 1px;
44
+ border-bottom-style: solid;
45
+ border-color: inherit;
46
+ }
47
+
48
+ .ft-input-label:before {
49
+ width: ${FtInputLabelCssVariables.horizontalSpacing};
50
+ flex-shrink: 0;
51
+ }
52
+
53
+ .ft-input-label:after {
54
+ flex-grow: 1;
55
+ flex-shrink: 1;
56
+ }
57
+
58
+ .ft-input-label--text {
59
+ display: flex;
60
+ flex-shrink: 1;
61
+ position: relative;
62
+ border-bottom-width: 1px;
63
+ border-bottom-style: solid;
64
+ border-color: inherit;
65
+ color: ${FtInputLabelCssVariables.textColor};
66
+ transition: font-size 250ms, line-height 250ms, color 250ms;
67
+ ${setVariable(FtTypographyCaptionCssVariables.fontSize, FtInputLabelCssVariables.fontSize)};
68
+ ${setVariable(FtTypographyCaptionCssVariables.lineHeight, FtInputLabelCssVariables.fontSize)};
69
+ }
70
+
71
+ .ft-input-label--in-error .ft-input-label--text {
72
+ color: ${FtInputLabelCssVariables.colorError}
73
+ }
74
+
75
+ .ft-input-label--disabled .ft-input-label--text {
76
+ color: ${FtInputLabelCssVariables.disabledTextColor};
77
+ }
78
+
79
+ .ft-input-label--hidden-text {
80
+ padding: 0 4px;
81
+ opacity: 0;
82
+ }
83
+
84
+ .ft-input-label--floating-text {
85
+ position: absolute;
86
+ top: calc(50% - var(--ft-typography-caption-line-height) / 2);
87
+ transition: top 250ms;
88
+ overflow: hidden;
89
+ white-space: nowrap;
90
+ text-overflow: ellipsis;
91
+ padding: ${FtInputLabelCssVariables.verticalSpacing} 4px;
92
+ margin: calc(${FtInputLabelCssVariables.verticalSpacing} * -1) 0;
93
+ }
94
+
95
+ .ft-input-label--raised .ft-input-label--text {
96
+ ${setVariable(FtTypographyCaptionCssVariables.fontSize, FtInputLabelCssVariables.raisedFontSize)};
97
+ ${setVariable(FtTypographyCaptionCssVariables.lineHeight, FtInputLabelCssVariables.raisedFontSize)};
98
+ }
99
+
100
+ .ft-input-label--raised .ft-input-label--floating-text {
101
+ top: ${FtInputLabelCssVariables.verticalSpacing};
102
+ }
103
+
104
+ .ft-input-label--outlined .ft-input-label--text,
105
+ .ft-input-label--outlined:before,
106
+ .ft-input-label--outlined:after {
107
+ border-top-width: 1px;
108
+ border-top-style: solid;
109
+ }
110
+
111
+ .ft-input-label--outlined:before {
112
+ border-left-width: 1px;
113
+ border-left-style: solid;
114
+ border-radius: ${FtInputLabelCssVariables.borderRadiusS} 0 0 ${FtInputLabelCssVariables.borderRadiusS};
115
+ }
116
+
117
+ .ft-input-label--outlined:after {
118
+ border-right-width: 1px;
119
+ border-right-style: solid;
120
+ border-radius: 0 ${FtInputLabelCssVariables.borderRadiusS} ${FtInputLabelCssVariables.borderRadiusS} 0;
121
+ }
122
+
123
+ .ft-input-label--outlined.ft-input-label--raised .ft-input-label--floating-text {
124
+ padding: 2px 4px;
125
+ z-index: ${FtInputLabelCssVariables.raisedZIndex};
126
+ background-color: ${FtInputLabelCssVariables.colorSurface};
127
+ border-radius: ${FtInputLabelCssVariables.borderRadiusS};
128
+ top: calc((var(--ft-typography-caption-line-height) / -2) + 2px);
129
+ }
130
+
131
+ .ft-input-label--outlined.ft-input-label--raised .ft-input-label--text {
132
+ border-top: none;
133
+ }
134
+ `;
135
+ //# sourceMappingURL=ft-input-label.css.js.map
@@ -1,24 +1,5 @@
1
1
  import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
- export interface FtInputLabelProperties {
3
- text?: string;
4
- raised?: boolean;
5
- outlined?: boolean;
6
- disabled?: boolean;
7
- error?: boolean;
8
- }
9
- export declare const FtInputLabelCssVariables: {
10
- fontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
11
- raisedFontSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
12
- raisedZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
13
- verticalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
14
- horizontalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
15
- borderColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
16
- textColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
17
- disabledTextColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
18
- colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
19
- borderRadiusS: import("@fluid-topics/ft-wc-utils").FtCssVariable;
20
- colorError: import("@fluid-topics/ft-wc-utils").FtCssVariable;
21
- };
2
+ import { FtInputLabelProperties } from "./ft-input-label.properties";
22
3
  export declare class FtInputLabel extends FtLitElement implements FtInputLabelProperties {
23
4
  static elementDefinitions: ElementDefinitionsMap;
24
5
  static styles: import("lit").CSSResult[];
@@ -4,24 +4,12 @@ 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 { css, html } from "lit";
7
+ import { html } from "lit";
8
8
  import { property } from "lit/decorators.js";
9
9
  import { classMap } from "lit/directives/class-map.js";
10
- import { designSystemVariables, FtCssVariableFactory, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
11
- import { FtTypographyCaption, FtTypographyCaptionCssVariables } from "@fluid-topics/ft-typography";
12
- export const FtInputLabelCssVariables = {
13
- fontSize: FtCssVariableFactory.create("--ft-input-label-font-size", "SIZE", "14px"),
14
- raisedFontSize: FtCssVariableFactory.create("--ft-input-label-raised-font-size", "SIZE", "11px"),
15
- raisedZIndex: FtCssVariableFactory.create("--ft-input-label-outlined-raised-z-index", "NUMBER", "2"),
16
- verticalSpacing: FtCssVariableFactory.create("--ft-input-label-vertical-spacing", "SIZE", "4px"),
17
- horizontalSpacing: FtCssVariableFactory.create("--ft-input-label-horizontal-spacing", "SIZE", "12px"),
18
- borderColor: FtCssVariableFactory.extend("--ft-input-label-border-color", designSystemVariables.colorOutline),
19
- textColor: FtCssVariableFactory.extend("--ft-input-label-text-color", designSystemVariables.colorOnSurfaceMedium),
20
- disabledTextColor: FtCssVariableFactory.extend("--ft-input-label-disabled-text-color", designSystemVariables.colorOnSurfaceDisabled),
21
- colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
22
- borderRadiusS: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design system"),
23
- colorError: FtCssVariableFactory.external(designSystemVariables.colorError, "Design system"),
24
- };
10
+ import { FtLitElement } from "@fluid-topics/ft-wc-utils";
11
+ import { FtTypographyCaption } from "@fluid-topics/ft-typography/build/ft-typography.css";
12
+ import { styles } from "./ft-input-label.css";
25
13
  export class FtInputLabel extends FtLitElement {
26
14
  constructor() {
27
15
  super(...arguments);
@@ -52,126 +40,9 @@ export class FtInputLabel extends FtLitElement {
52
40
  }
53
41
  }
54
42
  FtInputLabel.elementDefinitions = {};
55
- // language=CSS
56
43
  FtInputLabel.styles = [
57
44
  FtTypographyCaption,
58
- css `
59
- .ft-input-label {
60
- position: absolute;
61
- inset: 0;
62
- display: flex;
63
- background-color: ${FtInputLabelCssVariables.colorSurface};
64
- border-radius: ${FtInputLabelCssVariables.borderRadiusS} ${FtInputLabelCssVariables.borderRadiusS} 0 0;
65
- }
66
-
67
- .ft-input-label--outlined {
68
- border-radius: ${FtInputLabelCssVariables.borderRadiusS};
69
- }
70
-
71
- .ft-input-label {
72
- border-color: ${FtInputLabelCssVariables.borderColor};
73
- }
74
-
75
- .ft-input-label.ft-input-label--in-error {
76
- border-color: ${FtInputLabelCssVariables.colorError}
77
- }
78
-
79
- .ft-input-label:before,
80
- .ft-input-label:after {
81
- content: "";
82
- display: flex;
83
- border-bottom-width: 1px;
84
- border-bottom-style: solid;
85
- border-color: inherit;
86
- }
87
-
88
- .ft-input-label:before {
89
- width: ${FtInputLabelCssVariables.horizontalSpacing};
90
- flex-shrink: 0;
91
- }
92
-
93
- .ft-input-label:after {
94
- flex-grow: 1;
95
- flex-shrink: 1;
96
- }
97
-
98
- .ft-input-label--text {
99
- display: flex;
100
- flex-shrink: 1;
101
- position: relative;
102
- border-bottom-width: 1px;
103
- border-bottom-style: solid;
104
- border-color: inherit;
105
- color: ${FtInputLabelCssVariables.textColor};
106
- transition: font-size 250ms, line-height 250ms, color 250ms;
107
- ${setVariable(FtTypographyCaptionCssVariables.fontSize, FtInputLabelCssVariables.fontSize)};
108
- ${setVariable(FtTypographyCaptionCssVariables.lineHeight, FtInputLabelCssVariables.fontSize)};
109
- }
110
-
111
- .ft-input-label--in-error .ft-input-label--text {
112
- color: ${FtInputLabelCssVariables.colorError}
113
- }
114
-
115
- .ft-input-label--disabled .ft-input-label--text {
116
- color: ${FtInputLabelCssVariables.disabledTextColor};
117
- }
118
-
119
- .ft-input-label--hidden-text {
120
- padding: 0 4px;
121
- opacity: 0;
122
- }
123
-
124
- .ft-input-label--floating-text {
125
- position: absolute;
126
- top: calc(50% - var(--ft-typography-caption-line-height) / 2);
127
- transition: top 250ms;
128
- overflow: hidden;
129
- white-space: nowrap;
130
- text-overflow: ellipsis;
131
- padding: ${FtInputLabelCssVariables.verticalSpacing} 4px;
132
- margin: calc(${FtInputLabelCssVariables.verticalSpacing} * -1) 0;
133
- }
134
-
135
- .ft-input-label--raised .ft-input-label--text {
136
- ${setVariable(FtTypographyCaptionCssVariables.fontSize, FtInputLabelCssVariables.raisedFontSize)};
137
- ${setVariable(FtTypographyCaptionCssVariables.lineHeight, FtInputLabelCssVariables.raisedFontSize)};
138
- }
139
-
140
- .ft-input-label--raised .ft-input-label--floating-text {
141
- top: ${FtInputLabelCssVariables.verticalSpacing};
142
- }
143
-
144
- .ft-input-label--outlined .ft-input-label--text,
145
- .ft-input-label--outlined:before,
146
- .ft-input-label--outlined:after {
147
- border-top-width: 1px;
148
- border-top-style: solid;
149
- }
150
-
151
- .ft-input-label--outlined:before {
152
- border-left-width: 1px;
153
- border-left-style: solid;
154
- border-radius: ${FtInputLabelCssVariables.borderRadiusS} 0 0 ${FtInputLabelCssVariables.borderRadiusS};
155
- }
156
-
157
- .ft-input-label--outlined:after {
158
- border-right-width: 1px;
159
- border-right-style: solid;
160
- border-radius: 0 ${FtInputLabelCssVariables.borderRadiusS} ${FtInputLabelCssVariables.borderRadiusS} 0;
161
- }
162
-
163
- .ft-input-label--outlined.ft-input-label--raised .ft-input-label--floating-text {
164
- padding: 2px 4px;
165
- z-index: ${FtInputLabelCssVariables.raisedZIndex};
166
- background-color: ${FtInputLabelCssVariables.colorSurface};
167
- border-radius: ${FtInputLabelCssVariables.borderRadiusS};
168
- top: calc((var(--ft-typography-caption-line-height) / -2) + 2px);
169
- }
170
-
171
- .ft-input-label--outlined.ft-input-label--raised .ft-input-label--text {
172
- border-top: none;
173
- }
174
- `
45
+ styles
175
46
  ];
176
47
  __decorate([
177
48
  property({ type: String })