@getflip/swirl-components 0.131.1 → 0.133.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 +74 -5
- package/dist/cjs/index-1de6abbd.js +8 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-app-layout_6.cjs.entry.js +19 -5
- package/dist/cjs/swirl-avatar-group.cjs.entry.js +1 -1
- package/dist/cjs/swirl-badge.cjs.entry.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-avatar-group/swirl-avatar-group.css +12 -9
- package/dist/collection/components/swirl-avatar-group/swirl-avatar-group.stories.js +2 -2
- package/dist/collection/components/swirl-badge/swirl-badge.js +1 -1
- package/dist/collection/components/swirl-badge/swirl-badge.spec.js +2 -2
- package/dist/collection/components/swirl-empty-state/swirl-empty-state.css +9 -1
- package/dist/collection/components/swirl-empty-state/swirl-empty-state.js +11 -1
- package/dist/collection/components/swirl-empty-state/swirl-empty-state.spec.js +10 -5
- package/dist/collection/components/swirl-empty-state/swirl-empty-state.stories.js +9 -4
- package/dist/collection/components/swirl-resource-list/swirl-resource-list.js +1 -1
- package/dist/collection/components/swirl-resource-list/swirl-resource-list.spec.js +8 -5
- package/dist/collection/components/swirl-resource-list/swirl-resource-list.stories.js +3 -3
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.css +39 -37
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +44 -1
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.stories.js +5 -4
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-avatar-group.js +1 -1
- package/dist/components/swirl-badge2.js +1 -1
- package/dist/components/swirl-empty-state2.js +16 -4
- package/dist/components/swirl-resource-list-item2.js +13 -2
- package/dist/components/swirl-resource-list2.js +8 -2
- package/dist/esm/index-59244838.js +8 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-app-layout_6.entry.js +19 -5
- package/dist/esm/swirl-avatar-group.entry.js +1 -1
- package/dist/esm/swirl-badge.entry.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/swirl-components/p-041f464a.entry.js +1 -0
- package/dist/swirl-components/p-66c27209.entry.js +1 -0
- package/dist/swirl-components/p-815f2553.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-empty-state/swirl-empty-state.d.ts +5 -0
- package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +3 -0
- package/dist/types/components.d.ts +4 -0
- package/package.json +1 -1
- package/vscode-data.json +8 -0
- package/dist/swirl-components/p-0c10bed4.entry.js +0 -1
- package/dist/swirl-components/p-26719601.entry.js +0 -1
- package/dist/swirl-components/p-5800f3bf.entry.js +0 -1
|
@@ -9,28 +9,27 @@
|
|
|
9
9
|
.avatar-group {
|
|
10
10
|
position: relative;
|
|
11
11
|
display: inline-grid;
|
|
12
|
-
grid-template-rows: repeat(
|
|
13
|
-
grid-template-columns: repeat(
|
|
12
|
+
grid-template-rows: repeat(9, 1fr);
|
|
13
|
+
grid-template-columns: repeat(9, 1fr);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.avatar-group ::slotted(*:first-of-type) {
|
|
17
17
|
z-index: 1;
|
|
18
18
|
display: inline-flex;
|
|
19
|
-
|
|
19
|
+
box-shadow: 0 0 0 0.25rem var(--swirl-avatar-group-border-color);
|
|
20
20
|
border-radius: 50%;
|
|
21
21
|
grid-column-start: 1;
|
|
22
22
|
grid-column-end: 7;
|
|
23
|
-
grid-row-start:
|
|
24
|
-
grid-row-end:
|
|
23
|
+
grid-row-start: 4;
|
|
24
|
+
grid-row-end: 10;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.avatar-group ::slotted(*:nth-of-type(2)) {
|
|
28
28
|
z-index: 0;
|
|
29
29
|
display: inline-flex;
|
|
30
|
-
border: 0.25rem solid var(--swirl-avatar-group-border-color);
|
|
31
30
|
border-radius: 50%;
|
|
32
|
-
grid-column-start:
|
|
33
|
-
grid-column-end:
|
|
31
|
+
grid-column-start: 4;
|
|
32
|
+
grid-column-end: 10;
|
|
34
33
|
grid-row-start: 1;
|
|
35
34
|
grid-row-end: 7;
|
|
36
35
|
}
|
|
@@ -39,8 +38,12 @@
|
|
|
39
38
|
position: absolute;
|
|
40
39
|
z-index: 2;
|
|
41
40
|
right: calc(-1 * var(--s-space-4));
|
|
42
|
-
bottom:
|
|
41
|
+
bottom: calc(-1 * var(--s-space-4));
|
|
43
42
|
display: inline-flex;
|
|
44
43
|
width: 1.5rem;
|
|
45
44
|
height: 1.5rem;
|
|
46
45
|
}
|
|
46
|
+
|
|
47
|
+
.avatar-group__badge ::part(badge) {
|
|
48
|
+
box-shadow: 0 0 0 0.25rem var(--swirl-badge-border-color);
|
|
49
|
+
}
|
|
@@ -23,8 +23,8 @@ export default {
|
|
|
23
23
|
const Template = (args) => {
|
|
24
24
|
const element = generateStoryElement("swirl-avatar-group", args);
|
|
25
25
|
element.innerHTML = `
|
|
26
|
-
<swirl-avatar label="Jane Doe" src="https://api.dicebear.com/7.x/bottts-neutral/svg?size=144&seed=a" size="
|
|
27
|
-
<swirl-avatar label="John Doe" src="https://api.dicebear.com/7.x/bottts-neutral/svg?size=144&seed=b" size="
|
|
26
|
+
<swirl-avatar label="Jane Doe" src="https://api.dicebear.com/7.x/bottts-neutral/svg?size=144&seed=a" size="s"></swirl-avatar>
|
|
27
|
+
<swirl-avatar label="John Doe" src="https://api.dicebear.com/7.x/bottts-neutral/svg?size=144&seed=b" size="s"></swirl-avatar>
|
|
28
28
|
`;
|
|
29
29
|
return element;
|
|
30
30
|
};
|
|
@@ -12,7 +12,7 @@ export class SwirlBadge {
|
|
|
12
12
|
const className = classnames("badge", `badge--intent-${this.intent}`, `badge--size-${this.size}`, `badge--variant-${this.variant}`, {
|
|
13
13
|
"badge--has-icon": this.icon,
|
|
14
14
|
});
|
|
15
|
-
return (h(Host, { role: "status" }, h("span", { class: className }, this.icon && h("span", { class: "badge__icon", innerHTML: this.icon }), this.icon === undefined && (h("span", { class: "badge__label" }, this.label)))));
|
|
15
|
+
return (h(Host, { role: "status" }, h("span", { class: className, part: "badge" }, this.icon && h("span", { class: "badge__icon", innerHTML: this.icon }), this.icon === undefined && (h("span", { class: "badge__label" }, this.label)))));
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "swirl-badge"; }
|
|
18
18
|
static get encapsulation() { return "shadow"; }
|
|
@@ -6,14 +6,14 @@ describe("swirl-badge", () => {
|
|
|
6
6
|
components: [SwirlBadge],
|
|
7
7
|
html: `<swirl-badge label="Label"></swirl-badge>`,
|
|
8
8
|
});
|
|
9
|
-
expect(page.root.shadowRoot.innerHTML).toMatchInlineSnapshot(`"<span class=\\"badge badge--intent-critical badge--size-m badge--variant-default\\"><span class=\\"badge__label\\">Label</span></span>"`);
|
|
9
|
+
expect(page.root.shadowRoot.innerHTML).toMatchInlineSnapshot(`"<span class=\\"badge badge--intent-critical badge--size-m badge--variant-default\\" part=\\"badge\\"><span class=\\"badge__label\\">Label</span></span>"`);
|
|
10
10
|
});
|
|
11
11
|
it("shows its icon", async () => {
|
|
12
12
|
const page = await newSpecPage({
|
|
13
13
|
components: [SwirlBadge],
|
|
14
14
|
html: `<swirl-badge label="Label" icon="<swirl-icon-close></swirl-icon-close>"></swirl-badge>`,
|
|
15
15
|
});
|
|
16
|
-
expect(page.root.shadowRoot.innerHTML).toMatchInlineSnapshot(`"<span class=\\"badge badge--intent-critical badge--size-m badge--variant-default badge--has-icon\\"><span class=\\"badge__icon\\"><swirl-icon-close></swirl-icon-close></span></span>"`);
|
|
16
|
+
expect(page.root.shadowRoot.innerHTML).toMatchInlineSnapshot(`"<span class=\\"badge badge--intent-critical badge--size-m badge--variant-default badge--has-icon\\" part=\\"badge\\"><span class=\\"badge__icon\\"><swirl-icon-close></swirl-icon-close></span></span>"`);
|
|
17
17
|
expect(page.root.querySelector(".badge__icon")).toBeDefined();
|
|
18
18
|
expect(page.root.querySelector(".badge__label")).toBeNull();
|
|
19
19
|
});
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
gap: var(--s-space-16);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
.empty-state--has-controls .empty-state__controls {
|
|
18
|
+
display: block;
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
.empty-state__illustration {
|
|
18
22
|
max-width: 16rem;
|
|
19
23
|
}
|
|
@@ -22,5 +26,9 @@
|
|
|
22
26
|
display: flex;
|
|
23
27
|
align-items: center;
|
|
24
28
|
flex-direction: column;
|
|
25
|
-
gap: var(--s-space-
|
|
29
|
+
gap: var(--s-space-24);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.empty-state__controls {
|
|
33
|
+
display: none;
|
|
26
34
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
/**
|
|
4
|
+
* @slot slot - The component content
|
|
5
|
+
* @slot controls - The component content
|
|
6
|
+
*/
|
|
2
7
|
export class SwirlEmptyState {
|
|
3
8
|
constructor() {
|
|
4
9
|
this.heading = undefined;
|
|
5
10
|
this.illustration = undefined;
|
|
6
11
|
}
|
|
7
12
|
render() {
|
|
8
|
-
|
|
13
|
+
const hasControls = Boolean(this.el.querySelector('[slot="controls"]'));
|
|
14
|
+
const className = classnames("empty-state", {
|
|
15
|
+
"empty-state--has-controls": hasControls,
|
|
16
|
+
});
|
|
17
|
+
return (h(Host, null, h("div", { class: className }, this.illustration && (h("img", { alt: "", class: "empty-state__illustration", src: this.illustration })), h("div", { class: "empty-state__body" }, h("swirl-stack", { align: "stretch", spacing: "8" }, this.heading && (h("swirl-heading", { align: "center", as: "p", level: 4, text: this.heading })), h("div", { class: "empty-state__content" }, h("swirl-text", { align: "center", color: "subdued" }, h("slot", null)))), h("div", { class: "empty-state__controls" }, h("slot", { name: "controls" }))))));
|
|
9
18
|
}
|
|
10
19
|
static get is() { return "swirl-empty-state"; }
|
|
11
20
|
static get encapsulation() { return "shadow"; }
|
|
@@ -57,4 +66,5 @@ export class SwirlEmptyState {
|
|
|
57
66
|
}
|
|
58
67
|
};
|
|
59
68
|
}
|
|
69
|
+
static get elementRef() { return "el"; }
|
|
60
70
|
}
|
|
@@ -18,11 +18,16 @@ describe("swirl-empty-state", () => {
|
|
|
18
18
|
<div class="empty-state">
|
|
19
19
|
<img alt="" class="empty-state__illustration" src="/assets/images/empty-state-1.svg">
|
|
20
20
|
<div class="empty-state__body">
|
|
21
|
-
<swirl-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
21
|
+
<swirl-stack align="stretch" spacing="8">
|
|
22
|
+
<swirl-heading align="center" as="p" level="4" text="Nothing to see here."></swirl-heading>
|
|
23
|
+
<div class="empty-state__content">
|
|
24
|
+
<swirl-text align="center" color="subdued">
|
|
25
|
+
<slot></slot>
|
|
26
|
+
</swirl-text>
|
|
27
|
+
</div>
|
|
28
|
+
</swirl-stack>
|
|
29
|
+
<div class="empty-state__controls">
|
|
30
|
+
<slot name="controls"></slot>
|
|
26
31
|
</div>
|
|
27
32
|
</div>
|
|
28
33
|
</div>
|
|
@@ -13,10 +13,15 @@ export default {
|
|
|
13
13
|
const Template = (args) => {
|
|
14
14
|
const element = generateStoryElement("swirl-empty-state", args);
|
|
15
15
|
element.innerHTML = `
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
|
|
17
|
+
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
|
|
18
|
+
voluptua.
|
|
19
|
+
|
|
20
|
+
<swirl-button-group slot="controls">
|
|
21
|
+
<swirl-button label="Button"></swirl-button>
|
|
22
|
+
<swirl-button intent="primary" label="Button" variant="flat"></swirl-button>
|
|
23
|
+
</swirl-button-group>
|
|
24
|
+
`;
|
|
20
25
|
return element;
|
|
21
26
|
};
|
|
22
27
|
export const SwirlEmptyState = Template.bind({});
|
|
@@ -232,7 +232,7 @@ export class SwirlResourceList {
|
|
|
232
232
|
this.assistiveText = `${this.assistiveTextItemMoving} ${this.getItemIndex(this.dragging) + 1}`;
|
|
233
233
|
}
|
|
234
234
|
render() {
|
|
235
|
-
return (h(Host, { onKeyDown: this.onKeyDown }, h("swirl-visually-hidden", { role: "alert" }, this.assistiveText), h("swirl-stack", { "aria-label": this.label, class: "resource-list", id: this.listId, ref: (el) => (this.gridEl = el), role: "grid" }, h("slot", null))));
|
|
235
|
+
return (h(Host, { onKeyDown: this.onKeyDown }, h("swirl-visually-hidden", { role: "alert" }, this.assistiveText), h("swirl-box", { paddingInlineEnd: "8", paddingInlineStart: "8" }, h("swirl-stack", { "aria-label": this.label, class: "resource-list", id: this.listId, ref: (el) => (this.gridEl = el), role: "grid" }, h("slot", null)))));
|
|
236
236
|
}
|
|
237
237
|
static get is() { return "swirl-resource-list"; }
|
|
238
238
|
static get encapsulation() { return "scoped"; }
|
|
@@ -47,10 +47,12 @@ describe("swirl-resource-list", () => {
|
|
|
47
47
|
expect(page.root).toEqualHtml(`
|
|
48
48
|
<swirl-resource-list label="Label">
|
|
49
49
|
<swirl-visually-hidden role="alert"></swirl-visually-hidden>
|
|
50
|
-
<swirl-
|
|
51
|
-
<swirl-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
<swirl-box paddinginlineend="8" paddinginlinestart="8">
|
|
51
|
+
<swirl-stack aria-label="Label" class="resource-list" id="${id}" role="grid">
|
|
52
|
+
<swirl-resource-list-item description="With a description" label="This is a resource item" media="<swirl-avatar label="John Doe" src="https://picsum.photos/id/433/144/144"></swirl-avatar>"></swirl-resource-list-item>
|
|
53
|
+
<swirl-resource-list-item description="With a description" label="This is a resource item" media="<swirl-avatar label="John Doe" src="https://picsum.photos/id/103/144/144"></swirl-avatar>"></swirl-resource-list-item>
|
|
54
|
+
</swirl-stack>
|
|
55
|
+
</swirl-box>
|
|
54
56
|
</swirl-resource-list>
|
|
55
57
|
`);
|
|
56
58
|
});
|
|
@@ -86,7 +88,8 @@ describe("swirl-resource-list", () => {
|
|
|
86
88
|
});
|
|
87
89
|
const items = Array.from(page.root.querySelectorAll("swirl-resource-list-item"));
|
|
88
90
|
const assistiveText = page.root.querySelector('[role="alert"]');
|
|
89
|
-
const resourceList = page.root.querySelector(".resource-list").parentElement
|
|
91
|
+
const resourceList = page.root.querySelector(".resource-list").parentElement
|
|
92
|
+
.parentElement;
|
|
90
93
|
for (const item of items) {
|
|
91
94
|
expect(item.getAttribute("allow-drag")).toBeNull();
|
|
92
95
|
}
|
|
@@ -17,20 +17,20 @@ const Template = (args) => {
|
|
|
17
17
|
description="With a description"
|
|
18
18
|
label="This is a resource item 1"
|
|
19
19
|
>
|
|
20
|
-
<swirl-avatar label="John Doe" src="https://picsum.photos/id/1027/144/144" slot="media"></swirl-avatar>
|
|
20
|
+
<swirl-avatar label="John Doe" size="l" src="https://picsum.photos/id/1027/144/144" slot="media"></swirl-avatar>
|
|
21
21
|
</swirl-resource-list-item>
|
|
22
22
|
<swirl-resource-list-item
|
|
23
23
|
description="With a <strong>description</strong>"
|
|
24
24
|
label="This is a <strong>resource item 2</strong>"
|
|
25
25
|
meta="Yesterday"
|
|
26
26
|
>
|
|
27
|
-
<swirl-
|
|
27
|
+
<swirl-avatar label="John Doe" size="l" src="https://picsum.photos/id/1028/144/144" slot="media"></swirl-avatar>
|
|
28
28
|
</swirl-resource-list-item>
|
|
29
29
|
<swirl-resource-list-item
|
|
30
30
|
description="With a description"
|
|
31
31
|
label="This is a resource item 3"
|
|
32
32
|
>
|
|
33
|
-
<swirl-avatar label="John Doe" src="https://picsum.photos/id/
|
|
33
|
+
<swirl-avatar label="John Doe" size="l" src="https://picsum.photos/id/1029/144/144" slot="media"></swirl-avatar>
|
|
34
34
|
</swirl-resource-list-item>
|
|
35
35
|
`;
|
|
36
36
|
return element;
|
|
@@ -24,18 +24,6 @@
|
|
|
24
24
|
width: 100%;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.resource-list-item:not(.resource-list-item--show-meta) {
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.resource-list-item:not(.resource-list-item--show-meta) .resource-list-item__control {
|
|
33
|
-
position: relative;
|
|
34
|
-
top: auto;
|
|
35
|
-
right: auto;
|
|
36
|
-
transform: none;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
27
|
.resource-list-item--interactive:hover {
|
|
40
28
|
--swirl-ghost-button-background-default: var(--s-background-hovered);
|
|
41
29
|
}
|
|
@@ -86,6 +74,21 @@
|
|
|
86
74
|
background-color: var(--s-icon-highlight);
|
|
87
75
|
}
|
|
88
76
|
|
|
77
|
+
.resource-list-item--compact .resource-list-item__content {
|
|
78
|
+
padding: var(--s-space-8);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
82
|
+
|
|
83
|
+
.resource-list-item--compact .resource-list-item__content {
|
|
84
|
+
padding: var(--s-space-8)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.resource-list-item--compact .resource-list-item__label-container {
|
|
89
|
+
min-height: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
89
92
|
@media (min-width: 768px) {
|
|
90
93
|
|
|
91
94
|
.resource-list-item--selectable .resource-list-item__content {
|
|
@@ -104,14 +107,10 @@
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
|
|
107
|
-
.resource-list-item--
|
|
108
|
-
|
|
110
|
+
.resource-list-item--label-weight-medium .resource-list-item__label {
|
|
111
|
+
font-weight: var(--s-font-weight-medium);
|
|
109
112
|
}
|
|
110
113
|
|
|
111
|
-
.resource-list-item--label-weight-medium {
|
|
112
|
-
font-weight: var(--s-font-weight-medium);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
114
|
.resource-list-item--show-control-on-focus:hover,
|
|
116
115
|
.resource-list-item--show-control-on-focus:focus,
|
|
117
116
|
.resource-list-item--show-control-on-focus:focus-within {
|
|
@@ -173,6 +172,10 @@
|
|
|
173
172
|
color: var(--s-text-on-status);
|
|
174
173
|
}
|
|
175
174
|
|
|
175
|
+
.resource-list-item--wrap-description .resource-list-item__description {
|
|
176
|
+
white-space: normal;
|
|
177
|
+
}
|
|
178
|
+
|
|
176
179
|
.resource-list-item--wrap-label .resource-list-item__label {
|
|
177
180
|
white-space: normal;
|
|
178
181
|
}
|
|
@@ -189,13 +192,14 @@
|
|
|
189
192
|
padding-top: var(--s-space-12);
|
|
190
193
|
padding-right: 0;
|
|
191
194
|
padding-bottom: var(--s-space-12);
|
|
192
|
-
padding-left: var(--s-space-
|
|
193
|
-
align-items:
|
|
195
|
+
padding-left: var(--s-space-8);
|
|
196
|
+
align-items: flex-start;
|
|
194
197
|
border: none;
|
|
198
|
+
border-radius: var(--s-border-radius-sm);
|
|
195
199
|
color: var(--s-text-default);
|
|
196
200
|
background-color: var(--swirl-resource-list-item-background-default);
|
|
197
201
|
font: inherit;
|
|
198
|
-
line-height: var(--s-line-height-
|
|
202
|
+
line-height: var(--s-line-height-sm);
|
|
199
203
|
text-align: left;
|
|
200
204
|
text-decoration: none;
|
|
201
205
|
gap: var(--s-space-12);
|
|
@@ -223,22 +227,11 @@
|
|
|
223
227
|
color: var(--s-text-disabled);
|
|
224
228
|
}
|
|
225
229
|
|
|
226
|
-
.resource-list-item__content:after {
|
|
227
|
-
position: absolute;
|
|
228
|
-
right: 0;
|
|
229
|
-
bottom: 0;
|
|
230
|
-
left: 0;
|
|
231
|
-
height: 0.0625rem;
|
|
232
|
-
background-color: var(--s-border-default);
|
|
233
|
-
content: "";
|
|
234
|
-
}
|
|
235
|
-
|
|
236
230
|
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
237
231
|
|
|
238
232
|
.resource-list-item__content {
|
|
239
|
-
padding: var(--s-space-12);
|
|
240
|
-
|
|
241
|
-
line-height: var(--s-line-height-sm)
|
|
233
|
+
padding: var(--s-space-12) var(--s-space-8);
|
|
234
|
+
line-height: var(--s-line-height-base)
|
|
242
235
|
}
|
|
243
236
|
}
|
|
244
237
|
|
|
@@ -251,7 +244,7 @@
|
|
|
251
244
|
position: relative;
|
|
252
245
|
display: flex;
|
|
253
246
|
min-width: 0;
|
|
254
|
-
min-height:
|
|
247
|
+
min-height: 3rem;
|
|
255
248
|
padding-right: var(--s-space-16);
|
|
256
249
|
flex-grow: 1;
|
|
257
250
|
justify-content: center;
|
|
@@ -260,13 +253,22 @@
|
|
|
260
253
|
|
|
261
254
|
.resource-list-item__label {
|
|
262
255
|
overflow: hidden;
|
|
256
|
+
font-size: var(--s-font-size-base);
|
|
257
|
+
line-height: var(--s-line-height-base);
|
|
263
258
|
white-space: nowrap;
|
|
264
259
|
text-overflow: ellipsis;
|
|
265
260
|
}
|
|
266
261
|
|
|
262
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
263
|
+
|
|
264
|
+
.resource-list-item__label {
|
|
265
|
+
font-size: var(--s-font-size-sm);
|
|
266
|
+
line-height: var(--s-line-height-sm)
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
267
270
|
.resource-list-item__description {
|
|
268
271
|
overflow: hidden;
|
|
269
|
-
margin-top: var(--s-space-2);
|
|
270
272
|
color: var(--s-text-subdued);
|
|
271
273
|
font-size: var(--s-font-size-sm);
|
|
272
274
|
line-height: var(--s-line-height-sm);
|
|
@@ -284,7 +286,7 @@
|
|
|
284
286
|
.resource-list-item__control {
|
|
285
287
|
position: absolute;
|
|
286
288
|
top: 50%;
|
|
287
|
-
right: var(--s-space-
|
|
289
|
+
right: var(--s-space-8);
|
|
288
290
|
transform: translateY(-50%);
|
|
289
291
|
}
|
|
290
292
|
|
|
@@ -42,7 +42,9 @@ export class SwirlResourceListItem {
|
|
|
42
42
|
this.active = undefined;
|
|
43
43
|
this.allowDrag = undefined;
|
|
44
44
|
this.checked = false;
|
|
45
|
+
this.compact = undefined;
|
|
45
46
|
this.description = undefined;
|
|
47
|
+
this.descriptionWrap = undefined;
|
|
46
48
|
this.disabled = undefined;
|
|
47
49
|
this.dragging = undefined;
|
|
48
50
|
this.dragHandleDescription = "Press spacebar to toggle grab";
|
|
@@ -123,9 +125,15 @@ export class SwirlResourceListItem {
|
|
|
123
125
|
const showMeta = (Boolean(this.meta) || hasBadges) && !this.selectable;
|
|
124
126
|
const ariaChecked = this.selectable ? String(this.checked) : undefined;
|
|
125
127
|
const role = this.interactive && this.selectable ? "checkbox" : undefined;
|
|
128
|
+
const labelContainerStyles = !showMeta && Boolean(this.controlContainer)
|
|
129
|
+
? {
|
|
130
|
+
paddingRight: `calc(${this.controlContainer?.getBoundingClientRect().width}px + var(--s-space-16))`,
|
|
131
|
+
}
|
|
132
|
+
: undefined;
|
|
126
133
|
const className = classnames("resource-list-item", `resource-list-item--label-weight-${this.labelWeight}`, {
|
|
127
134
|
"resource-list-item--active": this.active,
|
|
128
135
|
"resource-list-item--checked": this.checked,
|
|
136
|
+
"resource-list-item--compact": this.compact,
|
|
129
137
|
"resource-list-item--disabled": this.disabled,
|
|
130
138
|
"resource-list-item--draggable": this.allowDrag,
|
|
131
139
|
"resource-list-item--dragging": this.dragging,
|
|
@@ -135,9 +143,10 @@ export class SwirlResourceListItem {
|
|
|
135
143
|
"resource-list-item--selectable": this.selectable,
|
|
136
144
|
"resource-list-item--show-control-on-focus": showControlOnFocus,
|
|
137
145
|
"resource-list-item--show-meta": showMeta,
|
|
146
|
+
"resource-list-item--wrap-description": this.descriptionWrap,
|
|
138
147
|
"resource-list-item--wrap-label": this.labelWrap,
|
|
139
148
|
});
|
|
140
|
-
return (h(Host, { role: "row" }, h("div", { class: className, role: "gridcell" }, h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby": this.id, class: "resource-list-item__content", href: href, disabled: disabled, onClick: this.onClick, onBlur: this.onBlur, onFocus: this.onFocus, part: "resource-list-item__content", role: role, tabIndex: 0, type: Tag === "button" ? "button" : undefined }, this.hasMedia && (h("span", { class: "resource-list-item__media" }, h("slot", { name: "media" }))), h("span", { class: "resource-list-item__label-container" }, h("span", { class: "resource-list-item__label", id: this.id, innerHTML: this.label }), this.description && (h("span", { class: "resource-list-item__description", innerHTML: this.description }))), showMeta && (h("span", { class: "resource-list-item__meta" }, h("span", { class: "resource-list-item__meta-text" }, this.meta), h("span", { class: "resource-list-item__badges" }, h("slot", { name: "badges" }))))), this.selectable && (h("span", { "aria-hidden": "true", class: "resource-list-item__checkbox" }, h("span", { class: "resource-list-item__checkbox-icon" }, this.checked && (h("swirl-icon-check-strong", null))))), h("span", { class: "resource-list-item__control" }, h("slot", { name: "control" })), showMenu && (h("swirl-popover-trigger", { popover: this.menuTriggerId }, h("swirl-button", { "aria-disabled": disabled ? "true" : undefined, class: "resource-list-item__menu-trigger", disabled: disabled, hideLabel: true, icon: "<swirl-icon-more-horizontal></swirl-icon-more-horizontal>", intent: "primary", label: this.menuTriggerLabel, onClick: this.onMenuTriggerClick })))), this.allowDrag && (h("button", { "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, h("swirl-icon-drag-handle", { size: this.iconSize })))));
|
|
149
|
+
return (h(Host, { role: "row" }, h("div", { class: className, role: "gridcell" }, h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby": this.id, class: "resource-list-item__content", href: href, disabled: disabled, onClick: this.onClick, onBlur: this.onBlur, onFocus: this.onFocus, part: "resource-list-item__content", role: role, tabIndex: 0, type: Tag === "button" ? "button" : undefined }, this.hasMedia && (h("span", { class: "resource-list-item__media" }, h("slot", { name: "media" }))), h("span", { class: "resource-list-item__label-container", style: labelContainerStyles }, h("span", { class: "resource-list-item__label", id: this.id, innerHTML: this.label }), this.description && (h("span", { class: "resource-list-item__description", innerHTML: this.description }))), showMeta && (h("span", { class: "resource-list-item__meta" }, h("span", { class: "resource-list-item__meta-text" }, this.meta), h("span", { class: "resource-list-item__badges" }, h("slot", { name: "badges" }))))), this.selectable && (h("span", { "aria-hidden": "true", class: "resource-list-item__checkbox" }, h("span", { class: "resource-list-item__checkbox-icon" }, this.checked && (h("swirl-icon-check-strong", null))))), h("span", { class: "resource-list-item__control", ref: (el) => (this.controlContainer = el) }, h("slot", { name: "control" })), showMenu && (h("swirl-popover-trigger", { popover: this.menuTriggerId }, h("swirl-button", { "aria-disabled": disabled ? "true" : undefined, class: "resource-list-item__menu-trigger", disabled: disabled, hideLabel: true, icon: "<swirl-icon-more-horizontal></swirl-icon-more-horizontal>", intent: "primary", label: this.menuTriggerLabel, onClick: this.onMenuTriggerClick })))), this.allowDrag && (h("button", { "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, h("swirl-icon-drag-handle", { size: this.iconSize })))));
|
|
141
150
|
}
|
|
142
151
|
static get is() { return "swirl-resource-list-item"; }
|
|
143
152
|
static get encapsulation() { return "scoped"; }
|
|
@@ -205,6 +214,23 @@ export class SwirlResourceListItem {
|
|
|
205
214
|
"reflect": false,
|
|
206
215
|
"defaultValue": "false"
|
|
207
216
|
},
|
|
217
|
+
"compact": {
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "boolean",
|
|
222
|
+
"resolved": "boolean",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": true,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": ""
|
|
230
|
+
},
|
|
231
|
+
"attribute": "compact",
|
|
232
|
+
"reflect": false
|
|
233
|
+
},
|
|
208
234
|
"description": {
|
|
209
235
|
"type": "string",
|
|
210
236
|
"mutable": false,
|
|
@@ -222,6 +248,23 @@ export class SwirlResourceListItem {
|
|
|
222
248
|
"attribute": "description",
|
|
223
249
|
"reflect": false
|
|
224
250
|
},
|
|
251
|
+
"descriptionWrap": {
|
|
252
|
+
"type": "boolean",
|
|
253
|
+
"mutable": false,
|
|
254
|
+
"complexType": {
|
|
255
|
+
"original": "boolean",
|
|
256
|
+
"resolved": "boolean",
|
|
257
|
+
"references": {}
|
|
258
|
+
},
|
|
259
|
+
"required": false,
|
|
260
|
+
"optional": true,
|
|
261
|
+
"docs": {
|
|
262
|
+
"tags": [],
|
|
263
|
+
"text": ""
|
|
264
|
+
},
|
|
265
|
+
"attribute": "description-wrap",
|
|
266
|
+
"reflect": false
|
|
267
|
+
},
|
|
225
268
|
"disabled": {
|
|
226
269
|
"type": "boolean",
|
|
227
270
|
"mutable": false,
|
package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.stories.js
CHANGED
|
@@ -28,11 +28,12 @@ const Template = (args) => {
|
|
|
28
28
|
<swirl-avatar
|
|
29
29
|
slot="media"
|
|
30
30
|
label="Jane Doe"
|
|
31
|
-
|
|
31
|
+
size="l"
|
|
32
|
+
src="https://api.dicebear.com/7.x/bottts-neutral/svg?size=144&seed=a"></swirl-avatar>
|
|
32
33
|
|
|
33
34
|
<swirl-stack slot="badges" align="center" orientation="horizontal" spacing="8">
|
|
34
35
|
<swirl-icon-notifications-off size="16"></swirl-icon-notifications-off>
|
|
35
|
-
<swirl-badge label="1" size="
|
|
36
|
+
<swirl-badge label="1" size="xs"></swirl-badge>
|
|
36
37
|
</swirl-stack>
|
|
37
38
|
|
|
38
39
|
`;
|
|
@@ -73,7 +74,7 @@ const Template = (args) => {
|
|
|
73
74
|
};
|
|
74
75
|
export const SwirlResourceListItem = Template.bind({});
|
|
75
76
|
SwirlResourceListItem.args = {
|
|
76
|
-
description: "With a
|
|
77
|
-
label: "This is a
|
|
77
|
+
description: "With a description",
|
|
78
|
+
label: "This is a resource item",
|
|
78
79
|
meta: "Today",
|
|
79
80
|
};
|