@getflip/swirl-components 0.77.0 → 0.78.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/README.md +1 -1
- package/components.json +79 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-chip.cjs.entry.js +8 -3
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/collection/components/swirl-chip/swirl-chip.css +47 -0
- package/dist/collection/components/swirl-chip/swirl-chip.js +87 -3
- package/dist/collection/components/swirl-chip/swirl-chip.spec.js +3 -3
- package/dist/collection/components/swirl-chip/swirl-chip.stories.js +1 -0
- package/dist/components/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/components/swirl-chip.js +19 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-chip.entry.js +9 -4
- package/dist/esm/swirl-components.js +1 -1
- package/dist/swirl-components/p-44422011.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-chip/swirl-chip.d.ts +6 -0
- package/dist/types/components.d.ts +13 -2
- package/package.json +2 -2
- package/vscode-data.json +20 -0
- package/dist/swirl-components/p-22c58025.entry.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
:host {
|
|
2
|
+
position: relative;
|
|
2
3
|
display: inline-flex;
|
|
3
4
|
max-width: 100%;
|
|
4
5
|
}
|
|
@@ -36,6 +37,18 @@
|
|
|
36
37
|
background-color: var(--s-surface-raised-hovered);
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
.chip--interactive:hover + .chip__remove-button {
|
|
41
|
+
background-color: var(--s-surface-raised-default);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.chip--interactive:hover + .chip__remove-button:hover {
|
|
45
|
+
background-color: var(--s-surface-raised-hovered);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.chip--interactive:hover + .chip__remove-button:active {
|
|
49
|
+
background-color: var(--s-surface-raised-pressed);
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
.chip--interactive:active {
|
|
40
53
|
background-color: var(--s-surface-overlay-pressed);
|
|
41
54
|
}
|
|
@@ -44,6 +57,10 @@
|
|
|
44
57
|
background-color: var(--s-surface-raised-pressed);
|
|
45
58
|
}
|
|
46
59
|
|
|
60
|
+
.chip--removable {
|
|
61
|
+
padding-right: calc(2rem + var(--s-space-12));
|
|
62
|
+
}
|
|
63
|
+
|
|
47
64
|
.chip--intent-critical {
|
|
48
65
|
border-color: var(--s-border-critical);
|
|
49
66
|
color: var(--s-text-critical);
|
|
@@ -53,6 +70,10 @@
|
|
|
53
70
|
color: var(--s-icon-critical);
|
|
54
71
|
}
|
|
55
72
|
|
|
73
|
+
.chip--border-radius-sm {
|
|
74
|
+
border-radius: var(--s-border-radius-sm);
|
|
75
|
+
}
|
|
76
|
+
|
|
56
77
|
.chip--intent-success {
|
|
57
78
|
border-color: var(--s-border-success);
|
|
58
79
|
color: var(--s-text-success);
|
|
@@ -114,3 +135,29 @@
|
|
|
114
135
|
white-space: nowrap;
|
|
115
136
|
text-overflow: ellipsis;
|
|
116
137
|
}
|
|
138
|
+
|
|
139
|
+
.chip__remove-button {
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: 50%;
|
|
142
|
+
right: var(--s-space-4);
|
|
143
|
+
display: inline-flex;
|
|
144
|
+
width: 2rem;
|
|
145
|
+
height: 2rem;
|
|
146
|
+
padding: 0;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
align-items: center;
|
|
149
|
+
border: none;
|
|
150
|
+
border-radius: 50%;
|
|
151
|
+
color: var(--s-icon-default);
|
|
152
|
+
background-color: var(--s-surface-overlay-default);
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
transform: translateY(-50%);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.chip__remove-button:hover {
|
|
158
|
+
background-color: var(--s-surface-overlay-hovered);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.chip__remove-button:active {
|
|
162
|
+
background-color: var(--s-surface-overlay-pressed);
|
|
163
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Host } from "@stencil/core";
|
|
1
|
+
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { getDesktopMediaQuery } from "../../utils";
|
|
4
4
|
/**
|
|
@@ -10,10 +10,13 @@ export class SwirlChip {
|
|
|
10
10
|
this.desktopMediaQueryHandler = (event) => {
|
|
11
11
|
this.forceIconProps(event.matches);
|
|
12
12
|
};
|
|
13
|
+
this.borderRadius = "pill";
|
|
13
14
|
this.icon = undefined;
|
|
14
15
|
this.intent = "default";
|
|
15
16
|
this.interactive = false;
|
|
16
17
|
this.label = undefined;
|
|
18
|
+
this.removable = undefined;
|
|
19
|
+
this.removeButtonLabel = "Remove";
|
|
17
20
|
this.variant = "outline";
|
|
18
21
|
}
|
|
19
22
|
componentDidLoad() {
|
|
@@ -35,10 +38,11 @@ export class SwirlChip {
|
|
|
35
38
|
const Tag = this.interactive ? "button" : "span";
|
|
36
39
|
const showAvatar = Boolean(this.el.querySelector('[slot="avatar"]'));
|
|
37
40
|
const showIcon = !showAvatar && Boolean(this.icon);
|
|
38
|
-
const className = classnames("chip", `chip--intent-${this.intent}`, `chip--variant-${this.variant}`, {
|
|
41
|
+
const className = classnames("chip", `chip--border-radius-${this.borderRadius}`, `chip--intent-${this.intent}`, `chip--variant-${this.variant}`, {
|
|
39
42
|
"chip--interactive": this.interactive,
|
|
43
|
+
"chip--removable": this.removable,
|
|
40
44
|
});
|
|
41
|
-
return (h(Host, null, h(Tag, { class: className, type: this.interactive ? "button" : undefined }, showAvatar && (h("span", { class: "chip__avatar" }, h("slot", { name: "avatar" }))), showIcon && (h("span", { class: "chip__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), h("span", { class: "chip__label" }, this.label))));
|
|
45
|
+
return (h(Host, null, h(Tag, { class: className, type: this.interactive ? "button" : undefined }, showAvatar && (h("span", { class: "chip__avatar" }, h("slot", { name: "avatar" }))), showIcon && (h("span", { class: "chip__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), h("span", { class: "chip__label" }, this.label)), this.removable && (h("button", { "aria-label": this.removeButtonLabel, class: "chip__remove-button", onClick: this.remove.emit }, h("swirl-icon-close", { size: 20 })))));
|
|
42
46
|
}
|
|
43
47
|
static get is() { return "swirl-chip"; }
|
|
44
48
|
static get encapsulation() { return "shadow"; }
|
|
@@ -54,6 +58,29 @@ export class SwirlChip {
|
|
|
54
58
|
}
|
|
55
59
|
static get properties() {
|
|
56
60
|
return {
|
|
61
|
+
"borderRadius": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"mutable": false,
|
|
64
|
+
"complexType": {
|
|
65
|
+
"original": "SwirlChipBorderRadius",
|
|
66
|
+
"resolved": "\"pill\" | \"sm\"",
|
|
67
|
+
"references": {
|
|
68
|
+
"SwirlChipBorderRadius": {
|
|
69
|
+
"location": "local",
|
|
70
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-chip/swirl-chip.tsx"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"required": false,
|
|
75
|
+
"optional": true,
|
|
76
|
+
"docs": {
|
|
77
|
+
"tags": [],
|
|
78
|
+
"text": ""
|
|
79
|
+
},
|
|
80
|
+
"attribute": "border-radius",
|
|
81
|
+
"reflect": false,
|
|
82
|
+
"defaultValue": "\"pill\""
|
|
83
|
+
},
|
|
57
84
|
"icon": {
|
|
58
85
|
"type": "string",
|
|
59
86
|
"mutable": false,
|
|
@@ -129,6 +156,41 @@ export class SwirlChip {
|
|
|
129
156
|
"attribute": "label",
|
|
130
157
|
"reflect": false
|
|
131
158
|
},
|
|
159
|
+
"removable": {
|
|
160
|
+
"type": "boolean",
|
|
161
|
+
"mutable": false,
|
|
162
|
+
"complexType": {
|
|
163
|
+
"original": "boolean",
|
|
164
|
+
"resolved": "boolean",
|
|
165
|
+
"references": {}
|
|
166
|
+
},
|
|
167
|
+
"required": false,
|
|
168
|
+
"optional": true,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": ""
|
|
172
|
+
},
|
|
173
|
+
"attribute": "removable",
|
|
174
|
+
"reflect": false
|
|
175
|
+
},
|
|
176
|
+
"removeButtonLabel": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"mutable": false,
|
|
179
|
+
"complexType": {
|
|
180
|
+
"original": "string",
|
|
181
|
+
"resolved": "string",
|
|
182
|
+
"references": {}
|
|
183
|
+
},
|
|
184
|
+
"required": false,
|
|
185
|
+
"optional": true,
|
|
186
|
+
"docs": {
|
|
187
|
+
"tags": [],
|
|
188
|
+
"text": ""
|
|
189
|
+
},
|
|
190
|
+
"attribute": "remove-button-label",
|
|
191
|
+
"reflect": false,
|
|
192
|
+
"defaultValue": "\"Remove\""
|
|
193
|
+
},
|
|
132
194
|
"variant": {
|
|
133
195
|
"type": "string",
|
|
134
196
|
"mutable": false,
|
|
@@ -154,5 +216,27 @@ export class SwirlChip {
|
|
|
154
216
|
}
|
|
155
217
|
};
|
|
156
218
|
}
|
|
219
|
+
static get events() {
|
|
220
|
+
return [{
|
|
221
|
+
"method": "remove",
|
|
222
|
+
"name": "remove",
|
|
223
|
+
"bubbles": true,
|
|
224
|
+
"cancelable": true,
|
|
225
|
+
"composed": true,
|
|
226
|
+
"docs": {
|
|
227
|
+
"tags": [],
|
|
228
|
+
"text": ""
|
|
229
|
+
},
|
|
230
|
+
"complexType": {
|
|
231
|
+
"original": "MouseEvent",
|
|
232
|
+
"resolved": "MouseEvent",
|
|
233
|
+
"references": {
|
|
234
|
+
"MouseEvent": {
|
|
235
|
+
"location": "global"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}];
|
|
240
|
+
}
|
|
157
241
|
static get elementRef() { return "el"; }
|
|
158
242
|
}
|
|
@@ -9,7 +9,7 @@ describe("swirl-chip", () => {
|
|
|
9
9
|
expect(page.root).toEqualHtml(`
|
|
10
10
|
<swirl-chip intent="critical" label="Label">
|
|
11
11
|
<mock:shadow-root>
|
|
12
|
-
<span class="chip chip--intent-critical chip--variant-outline">
|
|
12
|
+
<span class="chip chip--border-radius-pill chip--intent-critical chip--variant-outline">
|
|
13
13
|
<span class="chip__label">Label</span>
|
|
14
14
|
</span>
|
|
15
15
|
</mock:shadow-root>
|
|
@@ -24,7 +24,7 @@ describe("swirl-chip", () => {
|
|
|
24
24
|
expect(page.root).toEqualHtml(`
|
|
25
25
|
<swirl-chip interactive="true" label="Label">
|
|
26
26
|
<mock:shadow-root>
|
|
27
|
-
<button class="chip chip--intent-default chip--interactive chip--variant-outline" type="button">
|
|
27
|
+
<button class="chip chip--border-radius-pill chip--intent-default chip--interactive chip--variant-outline" type="button">
|
|
28
28
|
<span class="chip__label">Label</span>
|
|
29
29
|
</button>
|
|
30
30
|
</mock:shadow-root>
|
|
@@ -39,7 +39,7 @@ describe("swirl-chip", () => {
|
|
|
39
39
|
expect(page.root).toEqualHtml(`
|
|
40
40
|
<swirl-chip label="Label">
|
|
41
41
|
<mock:shadow-root>
|
|
42
|
-
<span class="chip chip--intent-default chip--variant-outline">
|
|
42
|
+
<span class="chip chip--border-radius-pill chip--intent-default chip--variant-outline">
|
|
43
43
|
<span class="chip__label">
|
|
44
44
|
Label
|
|
45
45
|
</span>
|