@fluid-topics/ft-input-helper-text 1.2.70
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 +23 -0
- package/build/ft-input-helper-text.light.js +239 -0
- package/build/ft-input-helper-text.min.js +462 -0
- package/build/ftds-input-helper-text.d.ts +12 -0
- package/build/ftds-input-helper-text.js +71 -0
- package/build/ftds-input-helper-text.properties.d.ts +5 -0
- package/build/ftds-input-helper-text.properties.js +1 -0
- package/build/ftds-input-helper-text.styles.d.ts +8 -0
- package/build/ftds-input-helper-text.styles.js +48 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +6 -0
- package/package.json +29 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ElementDefinitionsMap, FtLitElement, Status } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtdsInputHelperTextProperties } from "./ftds-input-helper-text.properties";
|
|
3
|
+
export declare class FtdsInputHelperText extends FtLitElement implements FtdsInputHelperTextProperties {
|
|
4
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
6
|
+
helperText?: string;
|
|
7
|
+
errorMessages: string[];
|
|
8
|
+
warningMessages: string[];
|
|
9
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
10
|
+
protected renderMessage(text: string, status: Status): import("lit-html").TemplateResult<1>;
|
|
11
|
+
private toIconIdentifier;
|
|
12
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { html, } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
9
|
+
import { FtLitElement, Status } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { styles } from "./ftds-input-helper-text.styles";
|
|
11
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
12
|
+
import { when } from "lit/directives/when.js";
|
|
13
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
14
|
+
import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
|
|
15
|
+
import { FtIcon, FtIcons } from "@fluid-topics/ft-icon";
|
|
16
|
+
class FtdsInputHelperText extends FtLitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.errorMessages = [];
|
|
20
|
+
this.warningMessages = [];
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return html `
|
|
24
|
+
<ul class="ftds-input-helper-text" role="list">
|
|
25
|
+
${repeat(this.errorMessages, (v) => this.renderMessage(v, Status.error))}
|
|
26
|
+
${repeat(this.warningMessages, (v) => this.renderMessage(v, Status.warning))}
|
|
27
|
+
${when((!this.errorMessages.length && !this.warningMessages.length && this.helperText), () => this.renderMessage(this.helperText, Status.default))}
|
|
28
|
+
</ul>
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
renderMessage(text, status) {
|
|
32
|
+
const optIcon = this.toIconIdentifier(status);
|
|
33
|
+
const classes = {
|
|
34
|
+
"ftds-input-helper-text--list-item": true,
|
|
35
|
+
"hasIcon": Boolean(optIcon),
|
|
36
|
+
[status]: true,
|
|
37
|
+
};
|
|
38
|
+
return html `
|
|
39
|
+
<li class="${classMap(classes)}">
|
|
40
|
+
${when(optIcon, () => html `
|
|
41
|
+
<ft-icon class="icon" value="${optIcon}" part="icon"></ft-icon>`)}
|
|
42
|
+
<ft-typography part="text" variant="${FtTypographyVariants.caption1medium}">${text}</ft-typography>
|
|
43
|
+
</li>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
toIconIdentifier(status) {
|
|
47
|
+
switch (status) {
|
|
48
|
+
case Status.error:
|
|
49
|
+
return FtIcons.OCTAGON_XMARK;
|
|
50
|
+
case Status.warning:
|
|
51
|
+
return FtIcons.WARNING;
|
|
52
|
+
case Status.default:
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
FtdsInputHelperText.elementDefinitions = {
|
|
58
|
+
"ft-typography": FtTypography,
|
|
59
|
+
"ft-icon": FtIcon,
|
|
60
|
+
};
|
|
61
|
+
FtdsInputHelperText.styles = styles;
|
|
62
|
+
__decorate([
|
|
63
|
+
property()
|
|
64
|
+
], FtdsInputHelperText.prototype, "helperText", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
property({ type: Array })
|
|
67
|
+
], FtdsInputHelperText.prototype, "errorMessages", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
property({ type: Array })
|
|
70
|
+
], FtdsInputHelperText.prototype, "warningMessages", void 0);
|
|
71
|
+
export { FtdsInputHelperText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const FtdsInputHelperTextCssVariables: {
|
|
2
|
+
color: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
3
|
+
errorColor: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
4
|
+
warningColor: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
5
|
+
iconSize: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
6
|
+
iconHorizontalGap: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
7
|
+
};
|
|
8
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { semantic, } from "@fluid-topics/design-system-variables";
|
|
3
|
+
import { foundation, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
4
|
+
import { FtIconCssVariables } from "@fluid-topics/ft-icon";
|
|
5
|
+
export const FtdsInputHelperTextCssVariables = {
|
|
6
|
+
color: FtCssVariableFactory.extend("--ftds-helper-text-color", "", semantic.contentGlobalSubtle),
|
|
7
|
+
errorColor: FtCssVariableFactory.extend("--ftds-helper-text-error-icon-color", "", semantic.contentErrorPrimary),
|
|
8
|
+
warningColor: FtCssVariableFactory.extend("--ftds-helper-text-warning-icon-color", "", semantic.contentWarningPrimary),
|
|
9
|
+
iconSize: FtCssVariableFactory.extend("--ftds-helper-text-icon-size", "", foundation.iconSize2),
|
|
10
|
+
iconHorizontalGap: FtCssVariableFactory.extend("--ftds-helper-text-icon-horizontal-gap", "", foundation.spacing1)
|
|
11
|
+
};
|
|
12
|
+
// language=CSS
|
|
13
|
+
export const styles = css `
|
|
14
|
+
.ftds-input-helper-text {
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
list-style-type: none;
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ftds-input-helper-text--list-item {
|
|
22
|
+
position: relative;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: flex-end;
|
|
26
|
+
color: ${FtdsInputHelperTextCssVariables.color};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ftds-input-helper-text--list-item.error {
|
|
30
|
+
color: ${FtdsInputHelperTextCssVariables.errorColor};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ftds-input-helper-text--list-item.warning {
|
|
34
|
+
color: ${FtdsInputHelperTextCssVariables.warningColor};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ftds-input-helper-text--list-item.hasIcon ft-typography {
|
|
38
|
+
padding-left: calc(${FtdsInputHelperTextCssVariables.iconHorizontalGap} - 2px);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ftds-input-helper-text--list-item.hasIcon {
|
|
42
|
+
left: -2px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ft-icon {
|
|
46
|
+
${setVariable(FtIconCssVariables.size, FtdsInputHelperTextCssVariables.iconSize)};
|
|
47
|
+
}
|
|
48
|
+
`;
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { customElement } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtdsInputHelperText } from "./ftds-input-helper-text";
|
|
3
|
+
export * from "./ftds-input-helper-text.styles";
|
|
4
|
+
export * from "./ftds-input-helper-text.properties";
|
|
5
|
+
export * from "./ftds-input-helper-text";
|
|
6
|
+
customElement("ftds-input-helper-text")(FtdsInputHelperText);
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluid-topics/ft-input-helper-text",
|
|
3
|
+
"version": "1.2.70",
|
|
4
|
+
"description": "A list of stylized helper text messages for form inputs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Lit"
|
|
7
|
+
],
|
|
8
|
+
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"main": "build/index.js",
|
|
11
|
+
"web": "build/ft-input-helper-text.min.js",
|
|
12
|
+
"typings": "build/index",
|
|
13
|
+
"files": [
|
|
14
|
+
"build/**/*.js",
|
|
15
|
+
"build/**/*.ts"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "1.2.70",
|
|
23
|
+
"lit": "3.1.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@fluid-topics/ft-wc-test-utils": "1.2.70"
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "f3062e7380fa19f4c699b1cee22fa3c9f3c0c0a7"
|
|
29
|
+
}
|