@fluid-topics/ft-text-area 0.1.17 → 0.1.18
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/build/ft-text-area.d.ts +2 -2
- package/build/ft-text-area.inline-styles.js +604 -0
- package/build/ft-text-area.js +109 -111
- package/build/ft-text-area.light.js +388 -441
- package/build/ft-text-area.min.js +437 -481
- package/build/index.d.ts +2 -0
- package/build/index.js +5 -0
- package/build/inline-styles.d.ts +2 -0
- package/build/inline-styles.js +4 -0
- package/package.json +7 -7
package/build/ft-text-area.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { css, html } from "lit";
|
|
8
8
|
import { property, query, state } from "lit/decorators.js";
|
|
9
9
|
import { classMap } from "lit/directives/class-map.js";
|
|
10
|
-
import {
|
|
10
|
+
import { designSystemVariables, FtCssVariable, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
11
11
|
import { FtTypography, FtTypographyBody1, FtTypographyBody1CssVariables } from "@fluid-topics/ft-typography";
|
|
12
12
|
import { FtResizer } from "@fluid-topics/ft-resizer";
|
|
13
13
|
import { FtInputLabel, FtInputLabelCssVariables } from "@fluid-topics/ft-input-label";
|
|
@@ -23,7 +23,7 @@ export const FtTextAreaCssVariables = {
|
|
|
23
23
|
colorOnSurfaceDisabled: FtCssVariable.external(designSystemVariables.colorOnSurfaceDisabled, "Design system"),
|
|
24
24
|
borderRadiusS: FtCssVariable.external(designSystemVariables.borderRadiusS, "Design system"),
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
export class FtTextArea extends FtLitElement {
|
|
27
27
|
constructor() {
|
|
28
28
|
super(...arguments);
|
|
29
29
|
this.label = "";
|
|
@@ -34,110 +34,7 @@ let FtTextArea = class FtTextArea extends FtLitElement {
|
|
|
34
34
|
this.height = 50;
|
|
35
35
|
this.focused = false;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
getStyles() {
|
|
39
|
-
return [
|
|
40
|
-
FtTypographyBody1,
|
|
41
|
-
css `
|
|
42
|
-
*:focus {
|
|
43
|
-
outline: none;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.ft-text-area {
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
align-items: stretch;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
ft-input-label {
|
|
53
|
-
${setVariable(FtInputLabelCssVariables.fontSize, FtTextAreaCssVariables.fontSize)};
|
|
54
|
-
${setVariable(FtInputLabelCssVariables.raisedFontSize, FtTextAreaCssVariables.labelSize)};
|
|
55
|
-
${setVariable(FtInputLabelCssVariables.verticalSpacing, FtTextAreaCssVariables.verticalSpacing)};
|
|
56
|
-
${setVariable(FtInputLabelCssVariables.horizontalSpacing, css `calc(${FtTextAreaCssVariables.horizontalSpacing} - 4px)`)};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.ft-text-area--main-panel {
|
|
60
|
-
position: relative;
|
|
61
|
-
display: flex;
|
|
62
|
-
height: calc(4 * ${FtTextAreaCssVariables.verticalSpacing} + ${FtTextAreaCssVariables.labelSize} + ${FtTextAreaCssVariables.fontSize} + ${this.height}px);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.ft-text-area--input-panel {
|
|
66
|
-
flex-grow: 1;
|
|
67
|
-
position: relative;
|
|
68
|
-
display: flex;
|
|
69
|
-
align-items: center;
|
|
70
|
-
overflow: hidden;
|
|
71
|
-
gap: 8px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.ft-text-area--input-panel ft-ripple {
|
|
75
|
-
${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, "0.08")};
|
|
76
|
-
${setVariable(FtRippleCssVariables.opacityContentOnSurfaceDragged, "0.04")};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ft-text-area--input {
|
|
80
|
-
display: block;
|
|
81
|
-
flex-grow: 1;
|
|
82
|
-
flex-shrink: 1;
|
|
83
|
-
min-width: 0; /* flex sets this to auto an prevents input from shrinking properly */
|
|
84
|
-
align-self: stretch;
|
|
85
|
-
resize: none;
|
|
86
|
-
|
|
87
|
-
${setVariable(FtTypographyBody1CssVariables.fontSize, FtTextAreaCssVariables.fontSize)};
|
|
88
|
-
${setVariable(FtTypographyBody1CssVariables.lineHeight, FtTextAreaCssVariables.fontSize)};
|
|
89
|
-
color: ${FtTextAreaCssVariables.colorOnSurface};
|
|
90
|
-
|
|
91
|
-
padding: 0 ${FtTextAreaCssVariables.horizontalSpacing};
|
|
92
|
-
margin: calc(${FtTextAreaCssVariables.verticalSpacing} + ${FtTextAreaCssVariables.labelSize} / 2) 0 ${FtTextAreaCssVariables.verticalSpacing} 0;
|
|
93
|
-
|
|
94
|
-
border: none;
|
|
95
|
-
background: none;
|
|
96
|
-
|
|
97
|
-
line-height: 1.4;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.ft-text-area--disabled .ft-text-area--input {
|
|
101
|
-
color: ${FtTextAreaCssVariables.colorOnSurfaceDisabled};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.ft-text-area:not(.ft-text-area--disabled) .ft-text-area--input-panel {
|
|
105
|
-
cursor: pointer;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.ft-text-area:not(.ft-text-area--disabled):focus-within ft-input-label {
|
|
109
|
-
${setVariable(FtInputLabelCssVariables.borderColor, FtTextAreaCssVariables.colorPrimary)};
|
|
110
|
-
${setVariable(FtInputLabelCssVariables.textColor, FtTextAreaCssVariables.colorPrimary)};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.ft-text-area--filled .ft-text-area--input-panel {
|
|
114
|
-
border-radius: ${FtTextAreaCssVariables.borderRadiusS} ${FtTextAreaCssVariables.borderRadiusS} 0 0;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.ft-text-area--filled:not(.ft-text-area--no-label) .ft-text-area--input {
|
|
118
|
-
align-self: stretch;
|
|
119
|
-
margin-bottom: ${FtTextAreaCssVariables.verticalSpacing};
|
|
120
|
-
margin-top: calc(${FtTextAreaCssVariables.labelSize} + 2 * ${FtTextAreaCssVariables.verticalSpacing});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.ft-text-area--outlined .ft-text-area--input-panel {
|
|
124
|
-
border-radius: ${FtTextAreaCssVariables.borderRadiusS};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.ft-text-area--helper-text {
|
|
128
|
-
padding: 0 12px 0 ${FtTextAreaCssVariables.horizontalSpacing};
|
|
129
|
-
color: ${FtTextAreaCssVariables.helperColor};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
ft-resizer {
|
|
133
|
-
position: absolute;
|
|
134
|
-
right: 0;
|
|
135
|
-
bottom: 0;
|
|
136
|
-
}
|
|
137
|
-
`
|
|
138
|
-
];
|
|
139
|
-
}
|
|
140
|
-
getTemplate() {
|
|
37
|
+
render() {
|
|
141
38
|
const classes = {
|
|
142
39
|
"ft-text-area": true,
|
|
143
40
|
"ft-text-area--filled": !this.outlined,
|
|
@@ -147,6 +44,11 @@ let FtTextArea = class FtTextArea extends FtLitElement {
|
|
|
147
44
|
"ft-text-area--no-label": !this.label
|
|
148
45
|
};
|
|
149
46
|
return html `
|
|
47
|
+
<style>
|
|
48
|
+
.ft-text-area--main-panel {
|
|
49
|
+
height: calc(4 * ${FtTextAreaCssVariables.verticalSpacing} + ${FtTextAreaCssVariables.labelSize} + ${FtTextAreaCssVariables.fontSize} + ${this.height}px);
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
150
52
|
<div class="${classMap(classes)}">
|
|
151
53
|
<div class="ft-text-area--main-panel">
|
|
152
54
|
<ft-input-label text="${this.label}"
|
|
@@ -203,13 +105,113 @@ let FtTextArea = class FtTextArea extends FtLitElement {
|
|
|
203
105
|
this.height = event.detail.height;
|
|
204
106
|
}
|
|
205
107
|
}
|
|
206
|
-
}
|
|
108
|
+
}
|
|
207
109
|
FtTextArea.elementDefinitions = {
|
|
208
110
|
"ft-input-label": FtInputLabel,
|
|
209
111
|
"ft-resizer": FtResizer,
|
|
210
112
|
"ft-ripple": FtRipple,
|
|
211
113
|
"ft-typography": FtTypography,
|
|
212
114
|
};
|
|
115
|
+
// language=CSS
|
|
116
|
+
FtTextArea.styles = [
|
|
117
|
+
FtTypographyBody1,
|
|
118
|
+
css `
|
|
119
|
+
*:focus {
|
|
120
|
+
outline: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.ft-text-area {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
align-items: stretch;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
ft-input-label {
|
|
130
|
+
${setVariable(FtInputLabelCssVariables.fontSize, FtTextAreaCssVariables.fontSize)};
|
|
131
|
+
${setVariable(FtInputLabelCssVariables.raisedFontSize, FtTextAreaCssVariables.labelSize)};
|
|
132
|
+
${setVariable(FtInputLabelCssVariables.verticalSpacing, FtTextAreaCssVariables.verticalSpacing)};
|
|
133
|
+
${setVariable(FtInputLabelCssVariables.horizontalSpacing, css `calc(${FtTextAreaCssVariables.horizontalSpacing} - 4px)`)};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ft-text-area--main-panel {
|
|
137
|
+
position: relative;
|
|
138
|
+
display: flex;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ft-text-area--input-panel {
|
|
142
|
+
flex-grow: 1;
|
|
143
|
+
position: relative;
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
gap: 8px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.ft-text-area--input-panel ft-ripple {
|
|
151
|
+
${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, "0.08")};
|
|
152
|
+
${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, "0.04")};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.ft-text-area--input {
|
|
156
|
+
display: block;
|
|
157
|
+
flex-grow: 1;
|
|
158
|
+
flex-shrink: 1;
|
|
159
|
+
min-width: 0; /* flex sets this to auto an prevents input from shrinking properly */
|
|
160
|
+
align-self: stretch;
|
|
161
|
+
resize: none;
|
|
162
|
+
|
|
163
|
+
${setVariable(FtTypographyBody1CssVariables.fontSize, FtTextAreaCssVariables.fontSize)};
|
|
164
|
+
${setVariable(FtTypographyBody1CssVariables.lineHeight, FtTextAreaCssVariables.fontSize)};
|
|
165
|
+
color: ${FtTextAreaCssVariables.colorOnSurface};
|
|
166
|
+
|
|
167
|
+
padding: 0 ${FtTextAreaCssVariables.horizontalSpacing};
|
|
168
|
+
margin: calc(${FtTextAreaCssVariables.verticalSpacing} + ${FtTextAreaCssVariables.labelSize} / 2) 0 ${FtTextAreaCssVariables.verticalSpacing} 0;
|
|
169
|
+
|
|
170
|
+
border: none;
|
|
171
|
+
background: none;
|
|
172
|
+
|
|
173
|
+
line-height: 1.4;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ft-text-area--disabled .ft-text-area--input {
|
|
177
|
+
color: ${FtTextAreaCssVariables.colorOnSurfaceDisabled};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.ft-text-area:not(.ft-text-area--disabled) .ft-text-area--input-panel {
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.ft-text-area:not(.ft-text-area--disabled):focus-within ft-input-label {
|
|
185
|
+
${setVariable(FtInputLabelCssVariables.borderColor, FtTextAreaCssVariables.colorPrimary)};
|
|
186
|
+
${setVariable(FtInputLabelCssVariables.textColor, FtTextAreaCssVariables.colorPrimary)};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.ft-text-area--filled .ft-text-area--input-panel {
|
|
190
|
+
border-radius: ${FtTextAreaCssVariables.borderRadiusS} ${FtTextAreaCssVariables.borderRadiusS} 0 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.ft-text-area--filled:not(.ft-text-area--no-label) .ft-text-area--input {
|
|
194
|
+
align-self: stretch;
|
|
195
|
+
margin-bottom: ${FtTextAreaCssVariables.verticalSpacing};
|
|
196
|
+
margin-top: calc(${FtTextAreaCssVariables.labelSize} + 2 * ${FtTextAreaCssVariables.verticalSpacing});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.ft-text-area--outlined .ft-text-area--input-panel {
|
|
200
|
+
border-radius: ${FtTextAreaCssVariables.borderRadiusS};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.ft-text-area--helper-text {
|
|
204
|
+
padding: 0 12px 0 ${FtTextAreaCssVariables.horizontalSpacing};
|
|
205
|
+
color: ${FtTextAreaCssVariables.helperColor};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
ft-resizer {
|
|
209
|
+
position: absolute;
|
|
210
|
+
right: 0;
|
|
211
|
+
bottom: 0;
|
|
212
|
+
}
|
|
213
|
+
`
|
|
214
|
+
];
|
|
213
215
|
__decorate([
|
|
214
216
|
property({ type: String })
|
|
215
217
|
], FtTextArea.prototype, "label", void 0);
|
|
@@ -234,8 +236,4 @@ __decorate([
|
|
|
234
236
|
__decorate([
|
|
235
237
|
state()
|
|
236
238
|
], FtTextArea.prototype, "focused", void 0);
|
|
237
|
-
FtTextArea = __decorate([
|
|
238
|
-
customElement("ft-text-area")
|
|
239
|
-
], FtTextArea);
|
|
240
|
-
export { FtTextArea };
|
|
241
239
|
//# sourceMappingURL=ft-text-area.js.map
|