@fluid-topics/ft-text-field 1.1.42 → 1.1.44
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-field.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class FtTextField extends FtTextField_base implements FtTextField
|
|
|
16
16
|
outlined: boolean;
|
|
17
17
|
disabled: boolean;
|
|
18
18
|
error: boolean;
|
|
19
|
+
fixedMenuPosition: boolean;
|
|
19
20
|
prefix: string | null;
|
|
20
21
|
icon?: string;
|
|
21
22
|
passwordHiddenIcon: string;
|
|
@@ -26,7 +27,6 @@ export declare class FtTextField extends FtTextField_base implements FtTextField
|
|
|
26
27
|
password: boolean;
|
|
27
28
|
focused: boolean;
|
|
28
29
|
hidePassword: boolean;
|
|
29
|
-
suggestionsOnTop: boolean;
|
|
30
30
|
hideSuggestions: boolean;
|
|
31
31
|
visibleSuggestions: FtTextFieldSuggestion[];
|
|
32
32
|
mainPanel?: HTMLElement;
|
package/build/ft-text-field.js
CHANGED
|
@@ -14,6 +14,7 @@ import { FtInputLabel } from "@fluid-topics/ft-input-label";
|
|
|
14
14
|
import { FtRipple } from "@fluid-topics/ft-ripple";
|
|
15
15
|
import { FtIcon, FtIcons } from "@fluid-topics/ft-icon";
|
|
16
16
|
import { styles } from "./ft-text-field.styles";
|
|
17
|
+
import { computeOffsetPosition } from "@fluid-topics/ft-wc-utils/build/floating";
|
|
17
18
|
class FtTextField extends toFtFormComponent(FtLitElement, "textbox") {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
@@ -22,6 +23,7 @@ class FtTextField extends toFtFormComponent(FtLitElement, "textbox") {
|
|
|
22
23
|
this.outlined = false;
|
|
23
24
|
this.disabled = false;
|
|
24
25
|
this.error = false;
|
|
26
|
+
this.fixedMenuPosition = false;
|
|
25
27
|
this.prefix = null;
|
|
26
28
|
this.passwordHiddenIcon = FtIcons.EYE_SLASH;
|
|
27
29
|
this.passwordRevealedIcon = FtIcons.EYE;
|
|
@@ -29,7 +31,6 @@ class FtTextField extends toFtFormComponent(FtLitElement, "textbox") {
|
|
|
29
31
|
this.password = false;
|
|
30
32
|
this.focused = false;
|
|
31
33
|
this.hidePassword = true;
|
|
32
|
-
this.suggestionsOnTop = false;
|
|
33
34
|
this.hideSuggestions = false;
|
|
34
35
|
this.visibleSuggestions = [];
|
|
35
36
|
}
|
|
@@ -66,6 +67,7 @@ class FtTextField extends toFtFormComponent(FtLitElement, "textbox") {
|
|
|
66
67
|
"ft-text-field--has-value": !!this.value,
|
|
67
68
|
"ft-text-field--with-label": !!this.label,
|
|
68
69
|
"ft-text-field--in-error": this.error,
|
|
70
|
+
"ft-text-field--fixed": this.fixedMenuPosition,
|
|
69
71
|
"ft-text-field--with-prefix": !!this.prefix,
|
|
70
72
|
"ft-text-field--hide-suggestions": this.visibleSuggestions.length === 0 || this.hideSuggestions,
|
|
71
73
|
"ft-text-field--raised-label": this.focused || this.value != "",
|
|
@@ -103,7 +105,7 @@ class FtTextField extends toFtFormComponent(FtLitElement, "textbox") {
|
|
|
103
105
|
@focus=${this.onFocus}/>
|
|
104
106
|
${(this.renderIcon())}
|
|
105
107
|
</div>
|
|
106
|
-
<div class="ft-text-field--suggestions
|
|
108
|
+
<div class="ft-text-field--suggestions"
|
|
107
109
|
@suggestion-selected=${this.onSuggestionSelected}>
|
|
108
110
|
<slot @slotchange=${() => this.filterSuggestionsIfNeeded()}></slot>
|
|
109
111
|
</div>
|
|
@@ -157,14 +159,14 @@ class FtTextField extends toFtFormComponent(FtLitElement, "textbox") {
|
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
contentAvailableCallback(props) {
|
|
160
|
-
var _a, _b;
|
|
161
162
|
super.contentAvailableCallback(props);
|
|
162
163
|
if (props.has("focused") && !this.hideSuggestions && this.visibleSuggestions.length > 0) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
this.
|
|
167
|
-
|
|
164
|
+
this.suggestionsContainer.style.width = this.mainPanel.getBoundingClientRect().width + "px";
|
|
165
|
+
computeOffsetPosition(this.mainPanel, this.suggestionsContainer, "bottom")
|
|
166
|
+
.then(({ x, y }) => {
|
|
167
|
+
this.suggestionsContainer.style.left = `${x}px`;
|
|
168
|
+
this.suggestionsContainer.style.top = `${y}px`;
|
|
169
|
+
});
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
setValue(newValue, fireChangeEvent = false) {
|
|
@@ -258,6 +260,9 @@ __decorate([
|
|
|
258
260
|
__decorate([
|
|
259
261
|
property({ type: Boolean })
|
|
260
262
|
], FtTextField.prototype, "error", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
property({ type: Boolean })
|
|
265
|
+
], FtTextField.prototype, "fixedMenuPosition", void 0);
|
|
261
266
|
__decorate([
|
|
262
267
|
property()
|
|
263
268
|
], FtTextField.prototype, "prefix", void 0);
|
|
@@ -288,9 +293,6 @@ __decorate([
|
|
|
288
293
|
__decorate([
|
|
289
294
|
state()
|
|
290
295
|
], FtTextField.prototype, "hidePassword", void 0);
|
|
291
|
-
__decorate([
|
|
292
|
-
state()
|
|
293
|
-
], FtTextField.prototype, "suggestionsOnTop", void 0);
|
|
294
296
|
__decorate([
|
|
295
297
|
state()
|
|
296
298
|
], FtTextField.prototype, "hideSuggestions", void 0);
|