@fluid-topics/ft-chip 0.3.71 → 1.0.0-alpha.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.
@@ -19,4 +19,3 @@ export declare const FtChipDenseCssVariables: {
19
19
  verticalPadding: import("@fluid-topics/ft-wc-utils").FtCssVariable;
20
20
  };
21
21
  export declare const styles: import("lit").CSSResult[];
22
- //# sourceMappingURL=ft-chip.css.d.ts.map
@@ -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,9 +162,9 @@ 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
  `
162
170
  ];
163
- //# sourceMappingURL=ft-chip.css.js.map
@@ -1,4 +1,5 @@
1
1
  import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
+ import { FtIconVariants } from "@fluid-topics/ft-icon";
2
3
  import { FtChipProperties } from "./ft-chip.property";
3
4
  export declare class IconClickEvent extends CustomEvent<void> {
4
5
  constructor();
@@ -13,7 +14,9 @@ export declare class FtChip extends FtLitElement implements FtChipProperties {
13
14
  dense: boolean;
14
15
  multiLine: boolean;
15
16
  label: string;
17
+ iconLabel: string;
16
18
  icon?: string;
19
+ iconVariant?: FtIconVariants;
17
20
  trailingIcon: boolean;
18
21
  private slottedContent?;
19
22
  static styles: import("lit").CSSResult[];
@@ -30,4 +33,3 @@ export declare class FtChip extends FtLitElement implements FtChipProperties {
30
33
  private onSlotchange;
31
34
  private get internalIcon();
32
35
  }
33
- //# sourceMappingURL=ft-chip.d.ts.map
package/build/ft-chip.js CHANGED
@@ -12,12 +12,13 @@ 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");
18
19
  }
19
20
  }
20
- export class FtChip extends FtLitElement {
21
+ class FtChip extends FtLitElement {
21
22
  constructor() {
22
23
  super(...arguments);
23
24
  this.highlighted = false;
@@ -28,6 +29,7 @@ export 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 @@ export class FtChip extends FtLitElement {
63
65
  return (this.iconClickable || this.removable) && !this.disabled;
64
66
  }
65
67
  renderIcon() {
66
- return html `
67
- <div class="ft-chip--icon-container ft-no-text-select ${this.interactionsOnIcon ? "ft-chip--clickable" : ""}"
68
- tabindex="${this.interactionsOnIcon ? 0 : -1}"
69
- @click=${this.onIconClick}
70
- @keyup=${this.onIconKeyUp}>
71
- <ft-ripple ?disabled=${!this.interactionsOnIcon}></ft-ripple>
72
- <ft-icon variant="material">${this.internalIcon}</ft-icon>
73
- </div>
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)) {
@@ -111,6 +119,7 @@ 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([
@@ -135,15 +144,21 @@ __decorate([
135
144
  property({ type: Boolean })
136
145
  ], FtChip.prototype, "multiLine", void 0);
137
146
  __decorate([
138
- property({ type: String })
147
+ property()
139
148
  ], FtChip.prototype, "label", void 0);
140
149
  __decorate([
141
- property({ type: String })
150
+ property()
151
+ ], FtChip.prototype, "iconLabel", void 0);
152
+ __decorate([
153
+ property()
142
154
  ], FtChip.prototype, "icon", void 0);
155
+ __decorate([
156
+ property()
157
+ ], FtChip.prototype, "iconVariant", void 0);
143
158
  __decorate([
144
159
  property({ type: Boolean })
145
160
  ], FtChip.prototype, "trailingIcon", void 0);
146
161
  __decorate([
147
162
  query("ft-typography slot")
148
163
  ], FtChip.prototype, "slottedContent", void 0);
149
- //# sourceMappingURL=ft-chip.js.map
164
+ export { FtChip };