@fluid-topics/ft-chip 1.0.0-alpha.0 → 1.0.0
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-chip.css.js +10 -2
- package/build/ft-chip.d.ts +1 -0
- package/build/ft-chip.js +22 -10
- package/build/ft-chip.light.js +404 -105
- package/build/ft-chip.min.js +453 -149
- package/build/ft-chip.property.d.ts +10 -9
- package/package.json +6 -6
package/build/ft-chip.css.js
CHANGED
|
@@ -3,6 +3,7 @@ import { designSystemVariables, FtCssVariableFactory, noTextSelect, setVariable
|
|
|
3
3
|
import { FtRippleCssVariables } from "@fluid-topics/ft-ripple/build/ft-ripple.css";
|
|
4
4
|
import { FtTypographyBody2CssVariables } from "@fluid-topics/ft-typography/build/ft-typography.css";
|
|
5
5
|
import { FtIconCssVariables } from "@fluid-topics/ft-icon/build/ft-icon.css";
|
|
6
|
+
import { FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
6
7
|
const chipColor = FtCssVariableFactory.extend("--ft-chip-color", designSystemVariables.colorOnSurface);
|
|
7
8
|
export const FtChipCssVariables = {
|
|
8
9
|
backgroundColor: FtCssVariableFactory.extend("--ft-chip-background-color", designSystemVariables.colorSurface),
|
|
@@ -41,7 +42,6 @@ export const styles = [
|
|
|
41
42
|
justify-content: center;
|
|
42
43
|
align-items: center;
|
|
43
44
|
width: 100%;
|
|
44
|
-
overflow: hidden;
|
|
45
45
|
box-sizing: border-box;
|
|
46
46
|
pointer-events: auto;
|
|
47
47
|
|
|
@@ -118,6 +118,13 @@ export const styles = [
|
|
|
118
118
|
position: relative;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
.ft-chip--icon-button {
|
|
122
|
+
${setVariable(FtButtonCssVariables.iconSize, FtChipCssVariables.iconSize)};
|
|
123
|
+
${setVariable(FtButtonCssVariables.horizontalPadding, 'var(--ft-chip-internal-icon-padding)')};
|
|
124
|
+
${setVariable(FtButtonCssVariables.verticalPadding, 'var(--ft-chip-internal-icon-padding)')};
|
|
125
|
+
margin: calc((-1) * var(--ft-chip-internal-icon-padding));
|
|
126
|
+
}
|
|
127
|
+
|
|
121
128
|
.ft-chip--label {
|
|
122
129
|
vertical-align: bottom;
|
|
123
130
|
display: block;
|
|
@@ -155,7 +162,8 @@ export const styles = [
|
|
|
155
162
|
outline: none;
|
|
156
163
|
}
|
|
157
164
|
|
|
158
|
-
.ft-chip:not(.ft-chip--trailing-icon) .ft-chip--icon-container
|
|
165
|
+
.ft-chip:not(.ft-chip--trailing-icon) .ft-chip--icon-container,
|
|
166
|
+
.ft-chip:not(.ft-chip--trailing-icon) .ft-chip--icon-button {
|
|
159
167
|
order: -1;
|
|
160
168
|
}
|
|
161
169
|
`
|
package/build/ft-chip.d.ts
CHANGED
package/build/ft-chip.js
CHANGED
|
@@ -12,6 +12,7 @@ import { FtRipple } from "@fluid-topics/ft-ripple";
|
|
|
12
12
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
13
13
|
import { FtIcon } from "@fluid-topics/ft-icon";
|
|
14
14
|
import { styles } from "./ft-chip.css";
|
|
15
|
+
import { FtButton } from "@fluid-topics/ft-button";
|
|
15
16
|
export class IconClickEvent extends CustomEvent {
|
|
16
17
|
constructor() {
|
|
17
18
|
super("icon-click");
|
|
@@ -28,6 +29,7 @@ class FtChip extends FtLitElement {
|
|
|
28
29
|
this.dense = false;
|
|
29
30
|
this.multiLine = false;
|
|
30
31
|
this.label = "";
|
|
32
|
+
this.iconLabel = "";
|
|
31
33
|
this.icon = undefined;
|
|
32
34
|
this.trailingIcon = false;
|
|
33
35
|
}
|
|
@@ -63,15 +65,21 @@ class FtChip extends FtLitElement {
|
|
|
63
65
|
return (this.iconClickable || this.removable) && !this.disabled;
|
|
64
66
|
}
|
|
65
67
|
renderIcon() {
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
return this.interactionsOnIcon
|
|
69
|
+
? html `
|
|
70
|
+
<ft-button round
|
|
71
|
+
class="ft-chip--icon-button"
|
|
72
|
+
@click=${this.onIconClick}
|
|
73
|
+
.iconVariant=${this.iconVariant}
|
|
74
|
+
icon="${this.internalIcon}"
|
|
75
|
+
label="${this.iconLabel}"
|
|
76
|
+
></ft-button>
|
|
77
|
+
`
|
|
78
|
+
: html `
|
|
79
|
+
<div class="ft-chip--icon-container ft-no-text-select">
|
|
80
|
+
<ft-icon .variant=${this.iconVariant} .value="${this.internalIcon}"></ft-icon>
|
|
81
|
+
</div>
|
|
82
|
+
`;
|
|
75
83
|
}
|
|
76
84
|
onKeyUp(e) {
|
|
77
85
|
if (this.interactionsOnChip && ["Enter", " "].includes(e.key)) {
|
|
@@ -104,13 +112,14 @@ class FtChip extends FtLitElement {
|
|
|
104
112
|
this.requestUpdate();
|
|
105
113
|
}
|
|
106
114
|
get internalIcon() {
|
|
107
|
-
return this.icon || (this.removable ? "
|
|
115
|
+
return this.icon || (this.removable ? "close" : undefined);
|
|
108
116
|
}
|
|
109
117
|
}
|
|
110
118
|
FtChip.elementDefinitions = {
|
|
111
119
|
"ft-ripple": FtRipple,
|
|
112
120
|
"ft-typography": FtTypography,
|
|
113
121
|
"ft-icon": FtIcon,
|
|
122
|
+
"ft-button": FtButton,
|
|
114
123
|
};
|
|
115
124
|
FtChip.styles = styles;
|
|
116
125
|
__decorate([
|
|
@@ -137,6 +146,9 @@ __decorate([
|
|
|
137
146
|
__decorate([
|
|
138
147
|
property()
|
|
139
148
|
], FtChip.prototype, "label", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
property()
|
|
151
|
+
], FtChip.prototype, "iconLabel", void 0);
|
|
140
152
|
__decorate([
|
|
141
153
|
property()
|
|
142
154
|
], FtChip.prototype, "icon", void 0);
|