@fluid-topics/ft-chip 2.0.38 → 2.1.1
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/definitions.d.ts +0 -2
- package/build/definitions.js +0 -2
- package/build/ft-chip.light.js +334 -1606
- package/build/ft-chip.min.js +343 -1614
- package/build/ft-chip.styles.d.ts +16 -16
- package/build/index.d.ts +0 -3
- package/build/index.js +0 -3
- package/package.json +7 -7
- package/build/ftds-chip.d.ts +0 -25
- package/build/ftds-chip.js +0 -132
- package/build/ftds-chip.property.d.ts +0 -6
- package/build/ftds-chip.property.js +0 -1
- package/build/ftds-chip.styles.d.ts +0 -1
- package/build/ftds-chip.styles.js +0 -184
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export declare const FtChipCssVariables: {
|
|
2
|
-
backgroundColor: import("@fluid-topics/
|
|
3
|
-
color: import("@fluid-topics/
|
|
4
|
-
fontSize: import("@fluid-topics/
|
|
5
|
-
fontWeight: import("@fluid-topics/
|
|
6
|
-
iconSize: import("@fluid-topics/
|
|
7
|
-
borderRadius: import("@fluid-topics/
|
|
8
|
-
rippleColor: import("@fluid-topics/
|
|
9
|
-
horizontalPadding: import("@fluid-topics/
|
|
10
|
-
verticalPadding: import("@fluid-topics/
|
|
11
|
-
borderColor: import("@fluid-topics/
|
|
12
|
-
opacityDisabled: import("@fluid-topics/
|
|
2
|
+
backgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
3
|
+
color: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
4
|
+
fontSize: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
5
|
+
fontWeight: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
6
|
+
iconSize: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
7
|
+
borderRadius: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
8
|
+
rippleColor: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
9
|
+
horizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
10
|
+
verticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
11
|
+
borderColor: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
12
|
+
opacityDisabled: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
13
13
|
};
|
|
14
14
|
export declare const FtChipHighlightedCssVariables: {
|
|
15
|
-
backgroundColor: import("@fluid-topics/
|
|
16
|
-
color: import("@fluid-topics/
|
|
17
|
-
rippleColor: import("@fluid-topics/
|
|
15
|
+
backgroundColor: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
16
|
+
color: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
17
|
+
rippleColor: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
18
18
|
};
|
|
19
19
|
export declare const FtChipDenseCssVariables: {
|
|
20
|
-
horizontalPadding: import("@fluid-topics/
|
|
21
|
-
verticalPadding: import("@fluid-topics/
|
|
20
|
+
horizontalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
21
|
+
verticalPadding: import("@fluid-topics/design-system-variables").FtCssVariable;
|
|
22
22
|
};
|
|
23
23
|
export declare const styles: import("lit").CSSResult[];
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-chip",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "A generic Fluid Topics chip",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/design-system-variables": "3.
|
|
23
|
-
"@fluid-topics/ft-icon": "2.
|
|
24
|
-
"@fluid-topics/ft-ripple": "2.
|
|
25
|
-
"@fluid-topics/ft-typography": "2.
|
|
26
|
-
"@fluid-topics/ft-wc-utils": "2.
|
|
22
|
+
"@fluid-topics/design-system-variables": "3.5.0",
|
|
23
|
+
"@fluid-topics/ft-icon": "2.1.1",
|
|
24
|
+
"@fluid-topics/ft-ripple": "2.1.1",
|
|
25
|
+
"@fluid-topics/ft-typography": "2.1.1",
|
|
26
|
+
"@fluid-topics/ft-wc-utils": "2.1.1",
|
|
27
27
|
"lit": "3.1.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "a9f1e471fb2dba9aeb8c12394a25460f675597dc"
|
|
30
30
|
}
|
package/build/ftds-chip.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ElementDefinitionsMap, FtdsBase } from "@fluid-topics/ft-wc-utils";
|
|
2
|
-
import { FtdsChipProperties } from "./ftds-chip.property";
|
|
3
|
-
export declare class RemoveEvent extends CustomEvent<void> {
|
|
4
|
-
constructor();
|
|
5
|
-
}
|
|
6
|
-
export declare class FtdsChip extends FtdsBase implements FtdsChipProperties {
|
|
7
|
-
static elementDefinitions: ElementDefinitionsMap;
|
|
8
|
-
withAction: boolean;
|
|
9
|
-
removable: boolean;
|
|
10
|
-
multiLine: boolean;
|
|
11
|
-
removeButtonLabel: string;
|
|
12
|
-
label: string;
|
|
13
|
-
icon?: string;
|
|
14
|
-
private slottedContent?;
|
|
15
|
-
static styles: import("lit").CSSResult[];
|
|
16
|
-
protected render(): import("lit-html").TemplateResult<1>;
|
|
17
|
-
private renderIcon;
|
|
18
|
-
private renderAction;
|
|
19
|
-
private resolveButtonSize;
|
|
20
|
-
private getLabel;
|
|
21
|
-
getTextContent(): string;
|
|
22
|
-
private onSlotchange;
|
|
23
|
-
private dispatchRemoveEvent;
|
|
24
|
-
private typographyVariant;
|
|
25
|
-
}
|
package/build/ftds-chip.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
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, nothing, } from "lit";
|
|
8
|
-
import { property, query, } from "lit/decorators.js";
|
|
9
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
10
|
-
import { DesignSystemFamily, FtdsBase, } from "@fluid-topics/ft-wc-utils";
|
|
11
|
-
import { FtdsTypography, FtdsTypographyVariants, } from "@fluid-topics/ft-typography";
|
|
12
|
-
import { FtIcon, FtIcons, FtIconVariants, } from "@fluid-topics/ft-icon";
|
|
13
|
-
import { designSystemStyle } from "./ftds-chip.styles";
|
|
14
|
-
import { DesignSystemSize } from "@fluid-topics/design-system-variables";
|
|
15
|
-
import { FtdsButton } from "@fluid-topics/ft-button";
|
|
16
|
-
export class RemoveEvent extends CustomEvent {
|
|
17
|
-
constructor() {
|
|
18
|
-
super("remove");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export class FtdsChip extends FtdsBase {
|
|
22
|
-
constructor() {
|
|
23
|
-
super(...arguments);
|
|
24
|
-
this.withAction = false;
|
|
25
|
-
this.removable = false;
|
|
26
|
-
this.multiLine = false;
|
|
27
|
-
this.removeButtonLabel = "Remove";
|
|
28
|
-
this.label = "";
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
const classes = {
|
|
32
|
-
"ftds-chip": true,
|
|
33
|
-
"ftds-chip--with-action": this.removable || this.withAction,
|
|
34
|
-
"ftds-chip--with-icon": !!this.icon,
|
|
35
|
-
"ftds-chip--multi-line": this.multiLine,
|
|
36
|
-
...this.getDesignSystemBaseClasses(),
|
|
37
|
-
};
|
|
38
|
-
return html `
|
|
39
|
-
<div class="${classMap(classes)}"
|
|
40
|
-
aria-label="${this.getLabel()}"
|
|
41
|
-
part="chip">
|
|
42
|
-
${this.renderIcon()}
|
|
43
|
-
<ftds-typography variant="${this.typographyVariant()}" element="span" class="ftds-chip--label" part="label">
|
|
44
|
-
<slot @slotchange=${this.onSlotchange}></slot>
|
|
45
|
-
</ftds-typography>
|
|
46
|
-
${this.renderAction()}
|
|
47
|
-
</div>
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
renderIcon() {
|
|
51
|
-
return this.icon
|
|
52
|
-
? html `
|
|
53
|
-
<div class="ftds-chip--icon-container" part="icon-container">
|
|
54
|
-
<ft-icon .variant=${FtIconVariants.fluid_topics} .value=${this.icon} part="icon"></ft-icon>
|
|
55
|
-
</div>
|
|
56
|
-
` : nothing;
|
|
57
|
-
}
|
|
58
|
-
renderAction() {
|
|
59
|
-
if (this.removable) {
|
|
60
|
-
return html `
|
|
61
|
-
<ftds-button round
|
|
62
|
-
class="ftds-chip--remove-button"
|
|
63
|
-
@click=${this.dispatchRemoveEvent}
|
|
64
|
-
icon="${FtIcons.X_MARK}"
|
|
65
|
-
label="${this.removeButtonLabel}"
|
|
66
|
-
family="${DesignSystemFamily.neutral}"
|
|
67
|
-
size="${this.resolveButtonSize()}"
|
|
68
|
-
part="icon-button"
|
|
69
|
-
></ftds-button>
|
|
70
|
-
`;
|
|
71
|
-
}
|
|
72
|
-
return this.withAction ? html `
|
|
73
|
-
<slot name="action"></slot>
|
|
74
|
-
` : nothing;
|
|
75
|
-
}
|
|
76
|
-
resolveButtonSize() {
|
|
77
|
-
switch (this.size) {
|
|
78
|
-
case DesignSystemSize.large:
|
|
79
|
-
return DesignSystemSize.medium;
|
|
80
|
-
default:
|
|
81
|
-
return DesignSystemSize.small;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
getLabel() {
|
|
85
|
-
return this.label || this.getTextContent();
|
|
86
|
-
}
|
|
87
|
-
getTextContent() {
|
|
88
|
-
var _a, _b;
|
|
89
|
-
return (_b = (_a = this.slottedContent) === null || _a === void 0 ? void 0 : _a.assignedNodes().map((n) => n.textContent).join("").trim()) !== null && _b !== void 0 ? _b : "";
|
|
90
|
-
}
|
|
91
|
-
onSlotchange() {
|
|
92
|
-
this.requestUpdate();
|
|
93
|
-
}
|
|
94
|
-
dispatchRemoveEvent() {
|
|
95
|
-
this.dispatchEvent(new RemoveEvent());
|
|
96
|
-
}
|
|
97
|
-
typographyVariant() {
|
|
98
|
-
switch (this.size) {
|
|
99
|
-
case DesignSystemSize.large:
|
|
100
|
-
return FtdsTypographyVariants.body2medium;
|
|
101
|
-
default:
|
|
102
|
-
return FtdsTypographyVariants.caption1medium;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
FtdsChip.elementDefinitions = {
|
|
107
|
-
"ftds-typography": FtdsTypography,
|
|
108
|
-
"ft-icon": FtIcon,
|
|
109
|
-
"ftds-button": FtdsButton,
|
|
110
|
-
};
|
|
111
|
-
FtdsChip.styles = designSystemStyle;
|
|
112
|
-
__decorate([
|
|
113
|
-
property({ type: Boolean })
|
|
114
|
-
], FtdsChip.prototype, "withAction", void 0);
|
|
115
|
-
__decorate([
|
|
116
|
-
property({ type: Boolean })
|
|
117
|
-
], FtdsChip.prototype, "removable", void 0);
|
|
118
|
-
__decorate([
|
|
119
|
-
property({ type: Boolean })
|
|
120
|
-
], FtdsChip.prototype, "multiLine", void 0);
|
|
121
|
-
__decorate([
|
|
122
|
-
property()
|
|
123
|
-
], FtdsChip.prototype, "removeButtonLabel", void 0);
|
|
124
|
-
__decorate([
|
|
125
|
-
property()
|
|
126
|
-
], FtdsChip.prototype, "label", void 0);
|
|
127
|
-
__decorate([
|
|
128
|
-
property()
|
|
129
|
-
], FtdsChip.prototype, "icon", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
query("ftds-typography slot")
|
|
132
|
-
], FtdsChip.prototype, "slottedContent", void 0);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const designSystemStyle: import("lit").CSSResult[];
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import { chip } from "@fluid-topics/design-system-variables";
|
|
3
|
-
import { setVariable } from "@fluid-topics/ft-wc-utils";
|
|
4
|
-
import { FtIconCssVariables } from "@fluid-topics/ft-icon";
|
|
5
|
-
import { FtdsButtonCssVariables } from "@fluid-topics/ft-button";
|
|
6
|
-
// language=CSS
|
|
7
|
-
export const designSystemStyle = [
|
|
8
|
-
css `
|
|
9
|
-
:host {
|
|
10
|
-
display: inline-block;
|
|
11
|
-
max-width: 100%;
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.ftds-chip {
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.ftds-chip--icon-container {
|
|
22
|
-
display: inline-flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
flex: none;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.ftds-chip ftds-typography {
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
display: flex;
|
|
30
|
-
align-items: center;
|
|
31
|
-
min-width: 0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.ftds-chip:not(.ftds-chip--multi-line) ftds-typography::part(text) {
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
text-overflow: ellipsis;
|
|
37
|
-
white-space: nowrap;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.ftds-chip--remove-button::part(icon) {
|
|
42
|
-
transform: scale(1.35); /* Little trick to have a bigger icon inside of the button */
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.ftds-chip--remove-button {
|
|
46
|
-
position: relative;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/* SMALL VARIANT */
|
|
50
|
-
.ftds--size-small {
|
|
51
|
-
min-height: ${chip.smallMinHeight};
|
|
52
|
-
padding: 0 ${chip.smallHorizontalPadding};
|
|
53
|
-
border-radius: ${chip.smallBorderRadius};
|
|
54
|
-
border-width: ${chip.smallBorderWidth};
|
|
55
|
-
border-style: solid;
|
|
56
|
-
${setVariable(FtIconCssVariables.size, chip.smallIconSize)}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.ftds--size-small.ftds-chip--with-action {
|
|
60
|
-
padding-right: ${chip.smallButtonRightPadding};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.ftds--size-small ftds-typography {
|
|
64
|
-
padding: 0 2px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.ftds--size-small .ftds-chip--icon-container {
|
|
68
|
-
overflow: visible;
|
|
69
|
-
height: ${chip.smallIconSize};
|
|
70
|
-
margin-right: ${chip.smallButtonRightPadding};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/* Dirty non-variabilized tweaks to properly center the icon */
|
|
74
|
-
.ftds--size-small .ftds-chip--remove-button {
|
|
75
|
-
overflow: visible;
|
|
76
|
-
top: -3px;
|
|
77
|
-
height: ${chip.smallIconSize};
|
|
78
|
-
transform: scale(.75); /* Little trick to have a (even) bigger icon inside of the button */
|
|
79
|
-
${FtdsButtonCssVariables.smallIconOnlyWidth.set("15px")};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.ftds--size-small .ftds-chip--remove-button::part(icon) {
|
|
83
|
-
transform: scale(2); /* Same as above */
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/* MEDIUM VARIANT */
|
|
87
|
-
.ftds--size-medium {
|
|
88
|
-
min-height: ${chip.mediumMinHeight};
|
|
89
|
-
padding: 0 ${chip.mediumHorizontalPadding};
|
|
90
|
-
border-radius: ${chip.mediumBorderRadius};
|
|
91
|
-
border-width: ${chip.mediumBorderWidth};
|
|
92
|
-
border-style: solid;
|
|
93
|
-
gap: ${chip.mediumGap};
|
|
94
|
-
${setVariable(FtIconCssVariables.size, chip.mediumIconSize)}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.ftds--size-medium.ftds-chip--with-action {
|
|
98
|
-
padding-right: ${chip.mediumButtonRightPadding};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.ftds--size-medium .ftds-chip--remove-button {
|
|
102
|
-
right: -1px; /* Fixing manually the alignement of the button with the border of the chip */
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/* LARGE VARIANT */
|
|
106
|
-
.ftds--size-large {
|
|
107
|
-
min-height: ${chip.largeMinHeight};
|
|
108
|
-
padding: 0 ${chip.largeHorizontalPadding};
|
|
109
|
-
border-radius: ${chip.largeBorderRadius};
|
|
110
|
-
border-width: ${chip.largeBorderWidth};
|
|
111
|
-
border-style: solid;
|
|
112
|
-
gap: ${chip.largeGap};
|
|
113
|
-
${setVariable(FtIconCssVariables.size, chip.largeIconSize)}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.ftds--size-large.ftds-chip--with-action {
|
|
117
|
-
padding-right: ${chip.largeButtonRightPadding};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.ftds--size-large .ftds-chip--remove-button {
|
|
121
|
-
right: -2px; /* Fixing manually the alignement of the button with the border of the chip */
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
/* NEUTRAL COLORS */
|
|
126
|
-
.ftds--family-neutral {
|
|
127
|
-
background-color: ${chip.neutralBackgroundColor};
|
|
128
|
-
border-color: ${chip.neutralBorderColor};
|
|
129
|
-
color: ${chip.neutralColor};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.ftds--family-neutral .ftds-chip--icon-container {
|
|
133
|
-
color: ${chip.neutralIconColor};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/* INFO COLORS */
|
|
138
|
-
.ftds--family-info {
|
|
139
|
-
background-color: ${chip.infoBackgroundColor};
|
|
140
|
-
border-color: ${chip.infoBorderColor};
|
|
141
|
-
color: ${chip.infoColor};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.ftds--family-info .ftds-chip--icon-container {
|
|
145
|
-
color: ${chip.infoIconColor};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
/* SUCCESS COLORS */
|
|
150
|
-
.ftds--family-success {
|
|
151
|
-
background-color: ${chip.successBackgroundColor};
|
|
152
|
-
border-color: ${chip.successBorderColor};
|
|
153
|
-
color: ${chip.successColor};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.ftds--family-success .ftds-chip--icon-container {
|
|
157
|
-
color: ${chip.successIconColor};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
/* WARNING COLORS */
|
|
162
|
-
.ftds--family-warning {
|
|
163
|
-
background-color: ${chip.warningBackgroundColor};
|
|
164
|
-
border-color: ${chip.warningBorderColor};
|
|
165
|
-
color: ${chip.warningColor};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.ftds--family-warning .ftds-chip--icon-container {
|
|
169
|
-
color: ${chip.warningIconColor};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
/* ERROR COLORS */
|
|
174
|
-
.ftds--family-error {
|
|
175
|
-
background-color: ${chip.errorBackgroundColor};
|
|
176
|
-
border-color: ${chip.errorBorderColor};
|
|
177
|
-
color: ${chip.errorColor};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.ftds--family-error .ftds-chip--icon-container {
|
|
181
|
-
color: ${chip.errorIconColor};
|
|
182
|
-
}
|
|
183
|
-
`,
|
|
184
|
-
];
|