@fluid-topics/ft-base-input 1.3.1 → 1.3.2
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-base-input.d.ts +5 -2
- package/build/ft-base-input.js +41 -17
- package/build/ft-base-input.light.js +1106 -243
- package/build/ft-base-input.min.js +1104 -241
- package/build/ft-base-input.properties.d.ts +3 -1
- package/build/ft-base-input.styles.d.ts +2 -0
- package/build/ft-base-input.styles.js +13 -3
- package/package.json +7 -7
package/build/ft-base-input.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ElementDefinitionsMap, FtdsBase, Status } from "@fluid-topics/ft-wc-utils";
|
|
1
|
+
import { DesignSystemSize, ElementDefinitionsMap, FtdsBase, Status } from "@fluid-topics/ft-wc-utils";
|
|
2
2
|
import { FtdsBaseInputProperties } from "./ft-base-input.properties";
|
|
3
|
-
import { FtIcon } from "@fluid-topics/ft-icon";
|
|
3
|
+
import { FtIcon, FtIconVariants } from "@fluid-topics/ft-icon";
|
|
4
4
|
export declare class FtdsBaseInput extends FtdsBase implements FtdsBaseInputProperties {
|
|
5
5
|
static elementDefinitions: ElementDefinitionsMap;
|
|
6
6
|
static styles: import("lit").CSSResult[];
|
|
@@ -11,9 +11,11 @@ export declare class FtdsBaseInput extends FtdsBase implements FtdsBaseInputProp
|
|
|
11
11
|
raiseLabel: boolean;
|
|
12
12
|
helperText?: string;
|
|
13
13
|
appendIcon?: FtIcon | true;
|
|
14
|
+
appendIconVariant: FtIconVariants;
|
|
14
15
|
appendIconLabel?: string;
|
|
15
16
|
appendIconIsClickable: boolean;
|
|
16
17
|
prependIcon?: FtIcon | true;
|
|
18
|
+
prependIconVariant: FtIconVariants;
|
|
17
19
|
prependIconLabel?: string;
|
|
18
20
|
prependIconIsClickable: boolean;
|
|
19
21
|
errorMessages: string[];
|
|
@@ -24,6 +26,7 @@ export declare class FtdsBaseInput extends FtdsBase implements FtdsBaseInputProp
|
|
|
24
26
|
private setFocusState;
|
|
25
27
|
private focusSlottedInput;
|
|
26
28
|
get shouldShowLabel(): string | false;
|
|
29
|
+
get iconSize(): DesignSystemSize.medium | DesignSystemSize.small;
|
|
27
30
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
28
31
|
private renderIcon;
|
|
29
32
|
}
|
package/build/ft-base-input.js
CHANGED
|
@@ -4,16 +4,18 @@ 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, nothing
|
|
7
|
+
import { html, nothing } from "lit";
|
|
8
8
|
import { property, query, state } from "lit/decorators.js";
|
|
9
9
|
import { classMap } from "lit/directives/class-map.js";
|
|
10
10
|
import { when } from "lit/directives/when.js";
|
|
11
|
-
import {
|
|
11
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
12
|
+
import { DesignSystemFamily, DesignSystemSize, FtdsBase, Status } from "@fluid-topics/ft-wc-utils";
|
|
12
13
|
import { styles } from "./ft-base-input.styles";
|
|
13
14
|
import { FtdsInputHelperText } from "@fluid-topics/ft-input-helper-text";
|
|
14
15
|
import { FtdsInputLabel } from "@fluid-topics/ft-input-label";
|
|
15
|
-
import { FtIcon } from "@fluid-topics/ft-icon";
|
|
16
|
+
import { FtIcon, FtIconVariants } from "@fluid-topics/ft-icon";
|
|
16
17
|
import { FtTooltip } from "@fluid-topics/ft-tooltip";
|
|
18
|
+
import { FtdsButton } from "@fluid-topics/ft-button";
|
|
17
19
|
class FtdsBaseInput extends FtdsBase {
|
|
18
20
|
constructor() {
|
|
19
21
|
super(...arguments);
|
|
@@ -22,7 +24,9 @@ class FtdsBaseInput extends FtdsBase {
|
|
|
22
24
|
this.label = "";
|
|
23
25
|
this.hideLabel = false;
|
|
24
26
|
this.raiseLabel = false;
|
|
27
|
+
this.appendIconVariant = FtIconVariants.fluid_topics;
|
|
25
28
|
this.appendIconIsClickable = false;
|
|
29
|
+
this.prependIconVariant = FtIconVariants.fluid_topics;
|
|
26
30
|
this.prependIconIsClickable = false;
|
|
27
31
|
this.errorMessages = [];
|
|
28
32
|
this.warningMessages = [];
|
|
@@ -40,6 +44,16 @@ class FtdsBaseInput extends FtdsBase {
|
|
|
40
44
|
get shouldShowLabel() {
|
|
41
45
|
return !this.hideLabel && this.label;
|
|
42
46
|
}
|
|
47
|
+
get iconSize() {
|
|
48
|
+
switch (this.size) {
|
|
49
|
+
case DesignSystemSize.large:
|
|
50
|
+
return DesignSystemSize.medium;
|
|
51
|
+
case DesignSystemSize.medium:
|
|
52
|
+
return DesignSystemSize.small;
|
|
53
|
+
default:
|
|
54
|
+
return DesignSystemSize.medium;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
43
57
|
render() {
|
|
44
58
|
const classes = {
|
|
45
59
|
"ftds-input": true,
|
|
@@ -61,7 +75,7 @@ class FtdsBaseInput extends FtdsBase {
|
|
|
61
75
|
aria-hidden="true"
|
|
62
76
|
text="${this.label}"
|
|
63
77
|
?raised=${this.raiseLabel}
|
|
64
|
-
.size
|
|
78
|
+
.size=${this.size}
|
|
65
79
|
></ftds-input-label>
|
|
66
80
|
`)}
|
|
67
81
|
</slot>
|
|
@@ -85,9 +99,9 @@ class FtdsBaseInput extends FtdsBase {
|
|
|
85
99
|
|
|
86
100
|
<slot part="helper-text" name="helper-text">
|
|
87
101
|
<ftds-input-helper-text
|
|
88
|
-
.helperText
|
|
89
|
-
.errorMessages
|
|
90
|
-
.warningMessages
|
|
102
|
+
.helperText=${this.helperText}
|
|
103
|
+
.errorMessages=${this.errorMessages}
|
|
104
|
+
.warningMessages=${this.warningMessages}
|
|
91
105
|
></ftds-input-helper-text>
|
|
92
106
|
</slot>
|
|
93
107
|
|
|
@@ -96,6 +110,7 @@ class FtdsBaseInput extends FtdsBase {
|
|
|
96
110
|
}
|
|
97
111
|
renderIcon(position) {
|
|
98
112
|
const icon = position === "append" ? this.appendIcon : this.prependIcon;
|
|
113
|
+
const iconVariant = position === "append" ? this.appendIconVariant : this.prependIconVariant;
|
|
99
114
|
const eventName = position === "append" ? "append-icon-click" : "prepend-icon-click";
|
|
100
115
|
const isClickable = position === "append" ? this.appendIconIsClickable : this.prependIconIsClickable;
|
|
101
116
|
const iconText = position === "append" ? this.appendIconLabel : this.prependIconLabel;
|
|
@@ -104,22 +119,24 @@ class FtdsBaseInput extends FtdsBase {
|
|
|
104
119
|
}
|
|
105
120
|
else if (isClickable) {
|
|
106
121
|
return html `
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
<ftds-button
|
|
123
|
+
.label=${iconText}
|
|
124
|
+
.icon=${icon}
|
|
125
|
+
.iconVariant=${iconVariant}
|
|
126
|
+
.size=${this.iconSize}
|
|
127
|
+
family="${DesignSystemFamily.neutral}"
|
|
128
|
+
|
|
129
|
+
@click=${(e) => {
|
|
111
130
|
e.stopPropagation();
|
|
112
131
|
this.dispatchEvent(new CustomEvent(eventName, e));
|
|
113
132
|
}}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
</button>
|
|
117
|
-
</ft-tooltip>
|
|
133
|
+
>
|
|
134
|
+
</ftds-button>
|
|
118
135
|
`;
|
|
119
136
|
}
|
|
120
137
|
else {
|
|
121
138
|
return html `
|
|
122
|
-
<ft-icon .value=${icon}></ft-icon>`;
|
|
139
|
+
<ft-icon aria-label="${ifDefined(iconText)}" aria-hidden="${!!iconText}" .value=${icon}></ft-icon>`;
|
|
123
140
|
}
|
|
124
141
|
}
|
|
125
142
|
}
|
|
@@ -127,7 +144,8 @@ FtdsBaseInput.elementDefinitions = {
|
|
|
127
144
|
"ftds-input-helper-text": FtdsInputHelperText,
|
|
128
145
|
"ftds-input-label": FtdsInputLabel,
|
|
129
146
|
"ft-icon": FtIcon,
|
|
130
|
-
"
|
|
147
|
+
"ftds-button": FtdsButton,
|
|
148
|
+
"ft-tooltip": FtTooltip,
|
|
131
149
|
};
|
|
132
150
|
FtdsBaseInput.styles = [
|
|
133
151
|
styles,
|
|
@@ -153,6 +171,9 @@ __decorate([
|
|
|
153
171
|
__decorate([
|
|
154
172
|
property()
|
|
155
173
|
], FtdsBaseInput.prototype, "appendIcon", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
property()
|
|
176
|
+
], FtdsBaseInput.prototype, "appendIconVariant", void 0);
|
|
156
177
|
__decorate([
|
|
157
178
|
property()
|
|
158
179
|
], FtdsBaseInput.prototype, "appendIconLabel", void 0);
|
|
@@ -162,6 +183,9 @@ __decorate([
|
|
|
162
183
|
__decorate([
|
|
163
184
|
property()
|
|
164
185
|
], FtdsBaseInput.prototype, "prependIcon", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property()
|
|
188
|
+
], FtdsBaseInput.prototype, "prependIconVariant", void 0);
|
|
165
189
|
__decorate([
|
|
166
190
|
property()
|
|
167
191
|
], FtdsBaseInput.prototype, "prependIconLabel", void 0);
|