@getflip/swirl-components 0.195.0 → 0.197.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/components.json +39 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-banner.cjs.entry.js +8 -4
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-option-list_2.cjs.entry.js +3 -2
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-banner/swirl-banner.css +29 -22
- package/dist/collection/components/swirl-banner/swirl-banner.js +24 -3
- package/dist/collection/components/swirl-banner/swirl-banner.spec.js +40 -6
- package/dist/collection/components/swirl-banner/swirl-banner.stories.js +10 -0
- package/dist/collection/components/swirl-tag/swirl-tag.css +8 -1
- package/dist/collection/components/swirl-tag/swirl-tag.js +25 -1
- package/dist/collection/components/swirl-tag/swirl-tag.spec.js +1 -1
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-banner.js +9 -4
- package/dist/components/swirl-tag2.js +4 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-banner.entry.js +8 -4
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-option-list_2.entry.js +3 -2
- package/dist/swirl-components/{p-31363b5b.entry.js → p-47e952f4.entry.js} +1 -1
- package/dist/swirl-components/p-e4330167.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-banner/swirl-banner.d.ts +2 -0
- package/dist/types/components/swirl-banner/swirl-banner.stories.d.ts +10 -0
- package/dist/types/components/swirl-tag/swirl-tag.d.ts +2 -0
- package/dist/types/components.d.ts +6 -2
- package/package.json +1 -1
- package/vscode-data.json +16 -0
- package/dist/swirl-components/p-fac10655.entry.js +0 -1
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
.banner {
|
|
10
10
|
display: flex;
|
|
11
|
+
align-items: flex-start;
|
|
12
|
+
gap: var(--s-space-16);
|
|
13
|
+
|
|
11
14
|
max-width: 100%;
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
min-height: 3.5rem;
|
|
16
|
+
padding: var(--s-space-16);
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
.banner:focus:not(:focus-visible) {
|
|
@@ -22,10 +25,11 @@
|
|
|
22
25
|
outline-offset: var(--s-space-4);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
@media (min-width:
|
|
28
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
26
29
|
|
|
27
30
|
.banner {
|
|
28
|
-
padding: var(--s-space-16)
|
|
31
|
+
padding: var(--s-space-16);
|
|
32
|
+
min-height: 3.25rem
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -35,13 +39,11 @@
|
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
.banner--size-s .banner__content {
|
|
38
|
-
margin-right: var(--s-space-8);
|
|
39
42
|
flex-grow: 0;
|
|
40
43
|
text-align: center;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
.banner--size-s .banner__controls {
|
|
44
|
-
margin-right: var(--s-space-4);
|
|
45
47
|
margin-left: 0;
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -94,16 +96,25 @@
|
|
|
94
96
|
color: var(--s-text-default);
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
.banner__content {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: flex-start;
|
|
102
|
+
|
|
103
|
+
min-height: 1.5rem;
|
|
104
|
+
flex-grow: 1;
|
|
105
|
+
line-height: var(--s-line-height-base);
|
|
106
|
+
}
|
|
98
107
|
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
109
|
+
|
|
110
|
+
.banner__content {
|
|
111
|
+
font-size: var(--s-font-size-sm);
|
|
112
|
+
line-height: var(--s-line-height-sm);
|
|
113
|
+
min-height: 1.25rem
|
|
114
|
+
}
|
|
101
115
|
}
|
|
102
|
-
}
|
|
103
116
|
|
|
104
117
|
.banner__icon {
|
|
105
|
-
position: relative;
|
|
106
|
-
top: var(--s-space-4);
|
|
107
118
|
display: none;
|
|
108
119
|
width: 1.5rem;
|
|
109
120
|
height: 1.5rem;
|
|
@@ -127,26 +138,21 @@
|
|
|
127
138
|
}
|
|
128
139
|
}
|
|
129
140
|
|
|
130
|
-
.
|
|
141
|
+
.banner__text {
|
|
131
142
|
min-height: 1.5rem;
|
|
132
|
-
margin-right: var(--s-space-12);
|
|
133
|
-
flex-grow: 1;
|
|
134
|
-
line-height: var(--s-line-height-base);
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
138
146
|
|
|
139
|
-
.
|
|
140
|
-
|
|
141
|
-
line-height: var(--s-line-height-sm)
|
|
147
|
+
.banner__text {
|
|
148
|
+
min-height: 1.25rem
|
|
142
149
|
}
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
.banner__controls {
|
|
146
153
|
display: inline-flex;
|
|
147
|
-
margin-left: var(--s-space-16);
|
|
148
154
|
flex-shrink: 0;
|
|
149
|
-
align-items:
|
|
155
|
+
align-items: flex-start;
|
|
150
156
|
line-height: var(--s-line-height-base);
|
|
151
157
|
gap: var(--s-space-16);
|
|
152
158
|
}
|
|
@@ -193,6 +199,7 @@
|
|
|
193
199
|
.banner__action-button,
|
|
194
200
|
.banner__dismiss-button {
|
|
195
201
|
font-size: var(--s-font-size-sm);
|
|
196
|
-
line-height: var(--s-line-height-sm)
|
|
202
|
+
line-height: var(--s-line-height-sm);
|
|
203
|
+
height: 1.25rem
|
|
197
204
|
}
|
|
198
205
|
}
|
|
@@ -27,6 +27,7 @@ export class SwirlBanner {
|
|
|
27
27
|
this.importance = "status";
|
|
28
28
|
this.intent = "default";
|
|
29
29
|
this.showIcon = false;
|
|
30
|
+
this.icon = undefined;
|
|
30
31
|
this.size = "m";
|
|
31
32
|
}
|
|
32
33
|
componentDidLoad() {
|
|
@@ -42,14 +43,17 @@ export class SwirlBanner {
|
|
|
42
43
|
icon?.setAttribute("size", smallIcon ? "20" : "24");
|
|
43
44
|
dismissButtonIcon?.setAttribute("size", smallIcon ? "20" : "24");
|
|
44
45
|
}
|
|
46
|
+
determineIcon() {
|
|
47
|
+
return this.icon ? this.icon : swirlBannerIconMapping[this.intent];
|
|
48
|
+
}
|
|
45
49
|
render() {
|
|
46
|
-
const icon =
|
|
50
|
+
const icon = this.determineIcon();
|
|
47
51
|
const showControls = Boolean(this.actionLabel) || this.dismissable;
|
|
48
|
-
const showIcon = this.showIcon && Boolean(icon);
|
|
52
|
+
const showIcon = this.icon || (this.showIcon && Boolean(icon));
|
|
49
53
|
const className = classnames("banner", `banner--intent-${this.intent}`, `banner--size-${this.size}`, {
|
|
50
54
|
"banner--has-icon": showIcon,
|
|
51
55
|
});
|
|
52
|
-
return (h(Host, null, h("div", { "aria-describedby": "content", class: className, role: this.importance, tabIndex: 0 }, showIcon && (h("span", { "aria-hidden": "true", class: "banner__icon", innerHTML: icon, ref: (el) => (this.iconEl = el) })), h("span", { class: "
|
|
56
|
+
return (h(Host, null, h("div", { "aria-describedby": "content", class: className, role: this.importance, tabIndex: 0 }, h("div", { class: "banner__content", id: "content", part: "banner__content" }, showIcon && (h("span", { "aria-hidden": "true", class: "banner__icon", innerHTML: icon, ref: (el) => (this.iconEl = el) })), h("span", { class: "banner__text" }, this.content)), showControls && (h("div", { class: "banner__controls" }, this.actionLabel && (h("button", { class: "banner__action-button", onClick: this.onAction, part: "banner__action-button", type: "button" }, this.actionLabel)), this.dismissable && (h("button", { "aria-label": this.dismissLabel, class: "banner__dismiss-button", onClick: this.onDismiss, part: "banner__dismiss-button", ref: (el) => (this.dismissButtonEl = el), type: "button" }, h("swirl-icon-close", null))))))));
|
|
53
57
|
}
|
|
54
58
|
static get is() { return "swirl-banner"; }
|
|
55
59
|
static get encapsulation() { return "shadow"; }
|
|
@@ -199,6 +203,23 @@ export class SwirlBanner {
|
|
|
199
203
|
"reflect": false,
|
|
200
204
|
"defaultValue": "false"
|
|
201
205
|
},
|
|
206
|
+
"icon": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"mutable": false,
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "string",
|
|
211
|
+
"resolved": "string",
|
|
212
|
+
"references": {}
|
|
213
|
+
},
|
|
214
|
+
"required": false,
|
|
215
|
+
"optional": true,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": ""
|
|
219
|
+
},
|
|
220
|
+
"attribute": "icon",
|
|
221
|
+
"reflect": false
|
|
222
|
+
},
|
|
202
223
|
"size": {
|
|
203
224
|
"type": "string",
|
|
204
225
|
"mutable": false,
|
|
@@ -10,18 +10,22 @@ describe("swirl-banner", () => {
|
|
|
10
10
|
<swirl-banner action-label="Action" content="Content" dismissable="true" intent="info" show-icon="true">
|
|
11
11
|
<mock:shadow-root>
|
|
12
12
|
<div aria-describedby="content" class="banner banner--has-icon banner--intent-info banner--size-m" role="status" tabindex="0">
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<div class="banner__content" id="content" part="banner__content">
|
|
14
|
+
<span aria-hidden="true" class="banner__icon">
|
|
15
|
+
<swirl-icon-info size="24"></swirl-icon-info>
|
|
16
|
+
</span>
|
|
17
|
+
<span class="banner__text">
|
|
18
|
+
Content
|
|
19
|
+
</span>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="banner__controls">
|
|
18
22
|
<button class="banner__action-button" part="banner__action-button" type="button">
|
|
19
23
|
Action
|
|
20
24
|
</button>
|
|
21
25
|
<button aria-label="Dismiss" class="banner__dismiss-button" part="banner__dismiss-button" type="button">
|
|
22
26
|
<swirl-icon-close size="24"></swirl-icon-close>
|
|
23
27
|
</button>
|
|
24
|
-
</
|
|
28
|
+
</div>
|
|
25
29
|
</div>
|
|
26
30
|
</mock:shadow-root>
|
|
27
31
|
</swirl-banner>
|
|
@@ -53,4 +57,34 @@ describe("swirl-banner", () => {
|
|
|
53
57
|
await page.waitForChanges();
|
|
54
58
|
expect(buttonSpy).toHaveBeenCalled();
|
|
55
59
|
});
|
|
60
|
+
it("renders with custom icon, when icon prop is set", async () => {
|
|
61
|
+
const page = await newSpecPage({
|
|
62
|
+
components: [SwirlBanner],
|
|
63
|
+
html: `<swirl-banner action-label="Action" content="Content" dismissable="true" intent="info" icon="<swirl-icon-download></swirl-icon-download>"></swirl-banner>`,
|
|
64
|
+
});
|
|
65
|
+
expect(page.root).toEqualHtml(`
|
|
66
|
+
<swirl-banner action-label="Action" content="Content" dismissable="true" icon="<swirl-icon-download></swirl-icon-download>" intent="info">
|
|
67
|
+
<mock:shadow-root>
|
|
68
|
+
<div aria-describedby="content" class="banner banner--has-icon banner--intent-info banner--size-m" role="status" tabindex="0">
|
|
69
|
+
<div class="banner__content" id="content" part="banner__content">
|
|
70
|
+
<span aria-hidden="true" class="banner__icon">
|
|
71
|
+
<swirl-icon-download size="24"></swirl-icon-download>
|
|
72
|
+
</span>
|
|
73
|
+
<span class="banner__text">
|
|
74
|
+
Content
|
|
75
|
+
</span>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="banner__controls">
|
|
78
|
+
<button class="banner__action-button" part="banner__action-button" type="button">
|
|
79
|
+
Action
|
|
80
|
+
</button>
|
|
81
|
+
<button aria-label="Dismiss" class="banner__dismiss-button" part="banner__dismiss-button" type="button">
|
|
82
|
+
<swirl-icon-close size="24"></swirl-icon-close>
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</mock:shadow-root>
|
|
87
|
+
</swirl-banner>
|
|
88
|
+
`);
|
|
89
|
+
});
|
|
56
90
|
});
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { generateStoryElement } from "../../utils";
|
|
2
2
|
import Docs from "./swirl-banner.mdx";
|
|
3
3
|
export default {
|
|
4
|
+
argTypes: {
|
|
5
|
+
icon: {
|
|
6
|
+
table: {
|
|
7
|
+
type: {
|
|
8
|
+
detail: "e.g. <swirl-icon-download></swirl-icon-download>",
|
|
9
|
+
summary: "swirl-icon-*",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
4
14
|
component: "swirl-banner",
|
|
5
15
|
tags: ["autodocs"],
|
|
6
16
|
parameters: {
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
.tag {
|
|
11
11
|
display: inline-flex;
|
|
12
12
|
max-width: 100%;
|
|
13
|
-
padding: var(--s-space-2) var(--s-space-8);
|
|
14
13
|
align-items: center;
|
|
15
14
|
border-radius: var(--s-border-radius-s);
|
|
16
15
|
color: var(--s-text-default);
|
|
@@ -22,6 +21,14 @@
|
|
|
22
21
|
gap: var(--s-space-4);
|
|
23
22
|
}
|
|
24
23
|
|
|
24
|
+
.tag--size-s {
|
|
25
|
+
padding: var(--s-space-0) var(--s-space-4);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tag--size-m {
|
|
29
|
+
padding: var(--s-space-2) var(--s-space-8);
|
|
30
|
+
}
|
|
31
|
+
|
|
25
32
|
.tag--bordered {
|
|
26
33
|
border-style: solid;
|
|
27
34
|
border-width: var(--s-border-width-default);
|
|
@@ -9,10 +9,11 @@ export class SwirlTag {
|
|
|
9
9
|
this.label = undefined;
|
|
10
10
|
this.removable = undefined;
|
|
11
11
|
this.bordered = undefined;
|
|
12
|
+
this.size = "m";
|
|
12
13
|
this.removalButtonLabel = "Remove";
|
|
13
14
|
}
|
|
14
15
|
render() {
|
|
15
|
-
const className = classnames("tag", `tag--intent-${this.intent}`, {
|
|
16
|
+
const className = classnames("tag", `tag--intent-${this.intent}`, `tag--size-${this.size}`, {
|
|
16
17
|
"tag--bordered": this.bordered,
|
|
17
18
|
});
|
|
18
19
|
return (h(Host, null, h("span", { class: className, part: "tag" }, h("span", { class: "tag__label" }, this.label), this.removable && (h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, h("swirl-icon-close", { size: 16 }))))));
|
|
@@ -105,6 +106,29 @@ export class SwirlTag {
|
|
|
105
106
|
"attribute": "bordered",
|
|
106
107
|
"reflect": false
|
|
107
108
|
},
|
|
109
|
+
"size": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "SwirlTagSize",
|
|
114
|
+
"resolved": "\"m\" | \"s\"",
|
|
115
|
+
"references": {
|
|
116
|
+
"SwirlTagSize": {
|
|
117
|
+
"location": "local",
|
|
118
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-tag/swirl-tag.tsx"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": true,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": ""
|
|
127
|
+
},
|
|
128
|
+
"attribute": "size",
|
|
129
|
+
"reflect": false,
|
|
130
|
+
"defaultValue": "\"m\""
|
|
131
|
+
},
|
|
108
132
|
"removalButtonLabel": {
|
|
109
133
|
"type": "string",
|
|
110
134
|
"mutable": false,
|
|
@@ -9,7 +9,7 @@ describe("swirl-tag", () => {
|
|
|
9
9
|
expect(page.root).toEqualHtml(`
|
|
10
10
|
<swirl-tag intent="info" label="Label">
|
|
11
11
|
<mock:shadow-root>
|
|
12
|
-
<span class="tag tag--intent-info" part="tag">
|
|
12
|
+
<span class="tag tag--intent-info tag--size-m" part="tag">
|
|
13
13
|
<span class="tag__label">
|
|
14
14
|
Label
|
|
15
15
|
</span>
|