@getflip/swirl-components 0.17.0 → 0.19.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 +82 -23
- package/dist/cjs/file-manager.cjs.entry.js +2 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{swirl-app-layout_5.cjs.entry.js → swirl-app-layout_7.cjs.entry.js} +43 -25
- package/dist/cjs/swirl-button.cjs.entry.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-heading.cjs.entry.js +1 -1
- package/dist/cjs/swirl-modal.cjs.entry.js +7 -2
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-app-layout/swirl-app-layout.js +2 -2
- package/dist/collection/components/swirl-button/swirl-button.css +5 -3
- package/dist/collection/components/swirl-heading/swirl-heading.css +8 -3
- package/dist/collection/components/swirl-modal/swirl-modal.css +17 -14
- package/dist/collection/components/swirl-modal/swirl-modal.js +58 -1
- package/dist/collection/components/swirl-resource-list/swirl-resource-list.stories.js +9 -6
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +17 -40
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.stories.js +3 -1
- package/dist/collection/prototypes/file-manager/file-manager.js +2 -4
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/file-manager.js +46 -36
- package/dist/components/swirl-app-layout2.js +2 -2
- package/dist/components/swirl-button2.js +1 -1
- package/dist/components/swirl-heading2.js +1 -1
- package/dist/components/swirl-icon-file.js +1 -35
- package/dist/{esm/swirl-icon-file.entry.js → components/swirl-icon-file2.js} +26 -8
- package/dist/components/swirl-icon-folder-shared.js +1 -35
- package/dist/{esm/swirl-icon-folder-shared.entry.js → components/swirl-icon-folder-shared2.js} +26 -8
- package/dist/components/swirl-modal.js +10 -2
- package/dist/components/swirl-resource-list-item2.js +11 -25
- package/dist/esm/file-manager.entry.js +2 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{swirl-app-layout_5.entry.js → swirl-app-layout_7.entry.js} +43 -27
- package/dist/esm/swirl-button.entry.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-heading.entry.js +1 -1
- package/dist/esm/swirl-modal.entry.js +7 -2
- package/dist/swirl-components/{p-90078d0c.entry.js → p-5044fc33.entry.js} +1 -1
- package/dist/swirl-components/p-736d7f96.entry.js +1 -0
- package/dist/swirl-components/p-b556f2af.entry.js +1 -0
- package/dist/swirl-components/p-b66abab3.entry.js +1 -0
- package/dist/swirl-components/p-ca5fd664.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-modal/swirl-modal.d.ts +3 -0
- package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +6 -4
- package/dist/types/components.d.ts +6 -2
- package/package.json +1 -1
- package/vscode-data.json +12 -4
- package/dist/cjs/swirl-icon-file.cjs.entry.js +0 -23
- package/dist/cjs/swirl-icon-folder-shared.cjs.entry.js +0 -23
- package/dist/swirl-components/p-45422bf0.entry.js +0 -1
- package/dist/swirl-components/p-593f3604.entry.js +0 -1
- package/dist/swirl-components/p-a08e1204.entry.js +0 -1
- package/dist/swirl-components/p-c1119f03.entry.js +0 -1
- package/dist/swirl-components/p-e6ce5e2c.entry.js +0 -1
- package/dist/swirl-components/p-ed2db791.entry.js +0 -1
|
@@ -166,9 +166,9 @@ export class SwirlAppLayout {
|
|
|
166
166
|
"app-layout--sidebar-active": this.mobileView === "sidebar" || this.sidebarActive,
|
|
167
167
|
"app-layout--sidebar-closing": this.sidebarClosing,
|
|
168
168
|
});
|
|
169
|
-
return (h(Host, null, h("section", { "aria-labelledby": "app-name", class: className, role: "document", tabIndex: 0 }, h("div", { class: "app-layout__grid" }, h("header", { class: "app-layout__header" }, this.showNavigationBackButton && (h("span", { class: "app-layout__navigation-back-button" }, h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.navigationBackButtonLabel, onClick: this.onNavigationBackButtonClick }))), h("swirl-heading", { as: "h1", class: "app-layout__app-name", headingId: "app-name", level:
|
|
169
|
+
return (h(Host, null, h("section", { "aria-labelledby": "app-name", class: className, role: "document", tabIndex: 0 }, h("div", { class: "app-layout__grid" }, h("header", { class: "app-layout__header" }, this.showNavigationBackButton && (h("span", { class: "app-layout__navigation-back-button" }, h("swirl-button", { hideLabel: true, icon: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.navigationBackButtonLabel, onClick: this.onNavigationBackButtonClick }))), h("swirl-heading", { as: "h1", class: "app-layout__app-name", headingId: "app-name", level: 3, text: this.appName }), this.hasNavigation && (h("span", { class: "app-layout__navigation-controls" }, h("slot", { name: "navigation-controls" })))), h("nav", { "aria-label": this.navigationLabel, class: "app-layout__navigation" }, h("slot", { name: "navigation" })), h("section", { "aria-labelledby": this.hasNavigation ? "heading" : "app-name", class: "app-layout__body" }, this.hasNavigation ? (h("header", { class: "app-layout__app-bar" }, showBackToNavigationButton && (h("span", { class: "app-layout__back-to-navigation-button" }, h("swirl-button", { hideLabel: true, icon: this.transitionStyle === "dialog"
|
|
170
170
|
? "<swirl-icon-close></swirl-icon-close>"
|
|
171
|
-
: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.backToNavigationViewButtonLabel, onClick: this.onBackToNavigationViewButtonClick }))), this.appBarMedia && (h("div", { class: "app-layout__app-bar-media", innerHTML: this.appBarMedia })), h("div", { class: "app-layout__app-bar-heading" }, this.heading && (h("swirl-heading", { as: "h2", headingId: "heading", level: 4, text: this.heading })), this.subheading && (h("span", { class: "app-layout__app-bar-subheading" }, this.subheading))), h("div", { class: "app-layout__app-bar-controls" }, h("slot", { name: "app-bar-controls" })))) : (h("header", { class: "app-layout__app-bar" }, h("swirl-heading", { as: "h1", headingId: "app-name", level: 2, text: this.appName }), h("span", { class: "app-layout__navigation-controls" }, h("slot", { name: "navigation-controls" })))), h("div", { class: "app-layout__content" }, h("slot", { name: "content" }))), h("aside", { class: "app-layout__sidebar" }, h("header", { class: "app-layout__sidebar-header" }, h("swirl-button", { class: "app-layout__sidebar-close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.sidebarCloseButtonLabel, onClick: this.onSidebarCloseButtonClick }), h("swirl-heading", { as: "h3", class: "app-layout__sidebar-heading", headingId: "sidebar-heading", level:
|
|
171
|
+
: "<swirl-icon-arrow-back></swirl-icon-arrow-back>", label: this.backToNavigationViewButtonLabel, onClick: this.onBackToNavigationViewButtonClick }))), this.appBarMedia && (h("div", { class: "app-layout__app-bar-media", innerHTML: this.appBarMedia })), h("div", { class: "app-layout__app-bar-heading" }, this.heading && (h("swirl-heading", { as: "h2", headingId: "heading", level: 4, text: this.heading })), this.subheading && (h("span", { class: "app-layout__app-bar-subheading" }, this.subheading))), h("div", { class: "app-layout__app-bar-controls" }, h("slot", { name: "app-bar-controls" })))) : (h("header", { class: "app-layout__app-bar" }, h("swirl-heading", { as: "h1", headingId: "app-name", level: 2, text: this.appName }), h("span", { class: "app-layout__navigation-controls" }, h("slot", { name: "navigation-controls" })))), h("div", { class: "app-layout__content" }, h("slot", { name: "content" }))), h("aside", { class: "app-layout__sidebar" }, h("header", { class: "app-layout__sidebar-header" }, h("swirl-button", { class: "app-layout__sidebar-close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.sidebarCloseButtonLabel, onClick: this.onSidebarCloseButtonClick }), h("swirl-heading", { as: "h3", class: "app-layout__sidebar-heading", headingId: "sidebar-heading", level: 3, text: this.sidebarHeading })), h("div", { class: "app-layout__sidebar-content" }, h("slot", { name: "sidebar" }))), this.ctaLabel && (h("span", { class: "app-layout__floating-cta" }, h("swirl-button", { hideLabel: Boolean(this.ctaIcon), icon: this.ctaIcon, intent: "primary", label: this.ctaLabel, onClick: this.onCtaClick, variant: "floating" })))))));
|
|
172
172
|
}
|
|
173
173
|
static get is() { return "swirl-app-layout"; }
|
|
174
174
|
static get encapsulation() { return "shadow"; }
|
|
@@ -129,17 +129,19 @@
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
.button--variant-outline {
|
|
132
|
-
border: var(--s-border-width-default) solid var(--s-border-strong);
|
|
133
132
|
color: var(--s-action-primary-default);
|
|
133
|
+
box-shadow: inset 0 0 0 var(--s-border-width-default) var(--s-border-strong);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
.button--variant-outline:disabled {
|
|
137
|
-
|
|
137
|
+
box-shadow: inset 0 0 0 var(--s-border-width-default)
|
|
138
|
+
var(--s-border-default);
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
.button--variant-outline.button--intent-critical:not(:disabled) {
|
|
141
142
|
color: var(--s-text-critical);
|
|
142
|
-
|
|
143
|
+
box-shadow: inset 0 0 0 var(--s-border-width-default)
|
|
144
|
+
var(--s-border-critical);
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
.button--variant-outline.button--intent-critical:not(:disabled) .button__icon {
|
|
@@ -46,10 +46,15 @@
|
|
|
46
46
|
line-height: var(--s-line-height-lg);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.heading--level-4
|
|
50
|
-
.heading--level-5,
|
|
51
|
-
.heading--level-6 {
|
|
49
|
+
.heading--level-4 {
|
|
52
50
|
font-size: var(--s-font-size-base);
|
|
53
51
|
font-weight: var(--s-font-weight-semibold);
|
|
54
52
|
line-height: var(--s-line-height-base);
|
|
55
53
|
}
|
|
54
|
+
|
|
55
|
+
.heading--level-5,
|
|
56
|
+
.heading--level-6 {
|
|
57
|
+
font-size: var(--s-font-size-sm);
|
|
58
|
+
font-weight: var(--s-font-weight-semibold);
|
|
59
|
+
line-height: var(--s-line-height-sm);
|
|
60
|
+
}
|
|
@@ -49,6 +49,23 @@
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
.modal--padded .modal__content {
|
|
53
|
+
padding-top: var(--s-space-24);
|
|
54
|
+
padding-right: var(--s-space-16);
|
|
55
|
+
padding-bottom: var(--s-space-24);
|
|
56
|
+
padding-left: var(--s-space-16);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (min-width: 768px) {
|
|
60
|
+
|
|
61
|
+
.modal--padded .modal__content {
|
|
62
|
+
padding-top: 0;
|
|
63
|
+
padding-right: var(--s-space-24);
|
|
64
|
+
padding-bottom: var(--s-space-16);
|
|
65
|
+
padding-left: var(--s-space-24)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
52
69
|
.modal--closing {
|
|
53
70
|
-webkit-animation: 0.15s modal-fade-out;
|
|
54
71
|
animation: 0.15s modal-fade-out;
|
|
@@ -162,10 +179,6 @@
|
|
|
162
179
|
.modal__content {
|
|
163
180
|
overflow-x: hidden;
|
|
164
181
|
overflow-y: auto;
|
|
165
|
-
padding-top: var(--s-space-24);
|
|
166
|
-
padding-right: var(--s-space-16);
|
|
167
|
-
padding-bottom: var(--s-space-24);
|
|
168
|
-
padding-left: var(--s-space-16);
|
|
169
182
|
flex-grow: 1;
|
|
170
183
|
line-height: var(--s-line-height-base);
|
|
171
184
|
}
|
|
@@ -174,16 +187,6 @@
|
|
|
174
187
|
margin: 0;
|
|
175
188
|
}
|
|
176
189
|
|
|
177
|
-
@media (min-width: 768px) {
|
|
178
|
-
|
|
179
|
-
.modal__content {
|
|
180
|
-
padding-top: 0;
|
|
181
|
-
padding-right: var(--s-space-24);
|
|
182
|
-
padding-bottom: var(--s-space-16);
|
|
183
|
-
padding-left: var(--s-space-24)
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
190
|
.modal__controls {
|
|
188
191
|
display: flex;
|
|
189
192
|
padding-top: var(--s-space-16);
|
|
@@ -37,7 +37,10 @@ export class SwirlModal {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
this.closeButtonLabel = "Close modal";
|
|
40
|
+
this.hideCloseButton = undefined;
|
|
41
|
+
this.hideLabel = undefined;
|
|
40
42
|
this.label = undefined;
|
|
43
|
+
this.padded = true;
|
|
41
44
|
this.primaryActionLabel = undefined;
|
|
42
45
|
this.secondaryActionLabel = undefined;
|
|
43
46
|
this.closing = false;
|
|
@@ -88,13 +91,15 @@ export class SwirlModal {
|
|
|
88
91
|
enableBodyScroll(this.scrollContainer);
|
|
89
92
|
}
|
|
90
93
|
render() {
|
|
94
|
+
const showControls = Boolean(this.primaryActionLabel) || Boolean(this.secondaryActionLabel);
|
|
91
95
|
const className = classnames("modal", {
|
|
92
96
|
"modal--closing": this.closing,
|
|
97
|
+
"modal--padded": this.padded,
|
|
93
98
|
"modal--scrollable": this.scrollable,
|
|
94
99
|
"modal--scrolled": this.scrolled,
|
|
95
100
|
"modal--scrolled-down": this.scrolledDown,
|
|
96
101
|
});
|
|
97
|
-
return (h(Host, null, h("section", { "aria-hidden": "true", "aria-label": this.label, class: className, id: "modal", onKeyDown: this.onKeyDown, ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", role: "document" }, h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick }), h("header", { class: "modal__header" }, h("swirl-heading", { as: "h2", class: "modal__heading", level: 3, text: this.label })), h("div", { class: "modal__content", onScroll: this.determineScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", null)), h("footer", { class: "modal__controls" }, h("swirl-button-group", { wrap: true }, this.secondaryActionLabel && (h("swirl-button", { label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { intent: "primary", label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: "flat" }))))))));
|
|
102
|
+
return (h(Host, null, h("section", { "aria-hidden": "true", "aria-label": this.label, class: className, id: "modal", onKeyDown: this.onKeyDown, ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", role: "document" }, !this.hideCloseButton && (h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), !this.hideLabel && (h("header", { class: "modal__header" }, h("swirl-heading", { as: "h2", class: "modal__heading", level: 3, text: this.label }))), h("div", { class: "modal__content", onScroll: this.determineScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", null)), showControls && (h("footer", { class: "modal__controls" }, h("swirl-button-group", { wrap: true }, this.secondaryActionLabel && (h("swirl-button", { label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { intent: "primary", label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: "flat" })))))))));
|
|
98
103
|
}
|
|
99
104
|
static get is() { return "swirl-modal"; }
|
|
100
105
|
static get encapsulation() { return "shadow"; }
|
|
@@ -128,6 +133,40 @@ export class SwirlModal {
|
|
|
128
133
|
"reflect": false,
|
|
129
134
|
"defaultValue": "\"Close modal\""
|
|
130
135
|
},
|
|
136
|
+
"hideCloseButton": {
|
|
137
|
+
"type": "boolean",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "boolean",
|
|
141
|
+
"resolved": "boolean",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": true,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": ""
|
|
149
|
+
},
|
|
150
|
+
"attribute": "hide-close-button",
|
|
151
|
+
"reflect": false
|
|
152
|
+
},
|
|
153
|
+
"hideLabel": {
|
|
154
|
+
"type": "boolean",
|
|
155
|
+
"mutable": false,
|
|
156
|
+
"complexType": {
|
|
157
|
+
"original": "boolean",
|
|
158
|
+
"resolved": "boolean",
|
|
159
|
+
"references": {}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": true,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": ""
|
|
166
|
+
},
|
|
167
|
+
"attribute": "hide-label",
|
|
168
|
+
"reflect": false
|
|
169
|
+
},
|
|
131
170
|
"label": {
|
|
132
171
|
"type": "string",
|
|
133
172
|
"mutable": false,
|
|
@@ -145,6 +184,24 @@ export class SwirlModal {
|
|
|
145
184
|
"attribute": "label",
|
|
146
185
|
"reflect": false
|
|
147
186
|
},
|
|
187
|
+
"padded": {
|
|
188
|
+
"type": "boolean",
|
|
189
|
+
"mutable": false,
|
|
190
|
+
"complexType": {
|
|
191
|
+
"original": "boolean",
|
|
192
|
+
"resolved": "boolean",
|
|
193
|
+
"references": {}
|
|
194
|
+
},
|
|
195
|
+
"required": false,
|
|
196
|
+
"optional": true,
|
|
197
|
+
"docs": {
|
|
198
|
+
"tags": [],
|
|
199
|
+
"text": ""
|
|
200
|
+
},
|
|
201
|
+
"attribute": "padded",
|
|
202
|
+
"reflect": false,
|
|
203
|
+
"defaultValue": "true"
|
|
204
|
+
},
|
|
148
205
|
"primaryActionLabel": {
|
|
149
206
|
"type": "string",
|
|
150
207
|
"mutable": false,
|
|
@@ -15,18 +15,21 @@ const Template = (args) => {
|
|
|
15
15
|
<swirl-resource-list-item
|
|
16
16
|
description="With a description"
|
|
17
17
|
label="This is a resource item"
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
>
|
|
19
|
+
<swirl-avatar label="John Doe" src="https://picsum.photos/id/1027/144/144" slot="media"></swirl-avatar>
|
|
20
|
+
</swirl-resource-list-item>
|
|
20
21
|
<swirl-resource-list-item
|
|
21
22
|
description="With a description"
|
|
22
23
|
label="This is a resource item"
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
>
|
|
25
|
+
<swirl-avatar label="John Doe" src="https://picsum.photos/id/1027/144/144" slot="media"></swirl-avatar>
|
|
26
|
+
</swirl-resource-list-item>
|
|
25
27
|
<swirl-resource-list-item
|
|
26
28
|
description="With a description"
|
|
27
29
|
label="This is a resource item"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
>
|
|
31
|
+
<swirl-avatar label="John Doe" src="https://picsum.photos/id/1027/144/144" slot="media"></swirl-avatar>
|
|
32
|
+
</swirl-resource-list-item>
|
|
30
33
|
`;
|
|
31
34
|
return element;
|
|
32
35
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
+
/**
|
|
4
|
+
* @slot media - Media displayed inside the item (e.g. swirl-avatar)
|
|
5
|
+
*/
|
|
3
6
|
export class SwirlResourceListItem {
|
|
4
7
|
constructor() {
|
|
5
8
|
this.onClick = () => {
|
|
@@ -20,35 +23,21 @@ export class SwirlResourceListItem {
|
|
|
20
23
|
this.hideDivider = undefined;
|
|
21
24
|
this.href = undefined;
|
|
22
25
|
this.label = undefined;
|
|
23
|
-
this.media = undefined;
|
|
24
26
|
this.menuTriggerId = undefined;
|
|
25
27
|
this.menuTriggerLabel = "Options";
|
|
26
28
|
this.meta = undefined;
|
|
27
29
|
this.selectable = undefined;
|
|
28
30
|
this.value = undefined;
|
|
31
|
+
this.hasMedia = false;
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
this.
|
|
32
|
-
this.forceThumbnailProps();
|
|
33
|
+
async componentWillLoad() {
|
|
34
|
+
this.updateMediaState();
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
avatarEl.removeAttribute("interactive");
|
|
40
|
-
avatarEl.removeAttribute("show-label");
|
|
41
|
-
avatarEl.removeAttribute("variant");
|
|
42
|
-
avatarEl.setAttribute("size", "l");
|
|
43
|
-
}
|
|
44
|
-
forceThumbnailProps() {
|
|
45
|
-
const thumbnailEl = this.el.querySelector("swirl-thumbnail");
|
|
46
|
-
if (!Boolean(thumbnailEl)) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
thumbnailEl.setAttribute("format", "landscape");
|
|
50
|
-
if (!["s", "m"].includes(thumbnailEl.getAttribute("size"))) {
|
|
51
|
-
thumbnailEl.setAttribute("size", "m");
|
|
36
|
+
updateMediaState() {
|
|
37
|
+
const mediaContainer = this.el.querySelector('[slot="media"]');
|
|
38
|
+
const hasMedia = Boolean(mediaContainer);
|
|
39
|
+
if (hasMedia !== this.hasMedia) {
|
|
40
|
+
this.hasMedia = hasMedia;
|
|
52
41
|
}
|
|
53
42
|
}
|
|
54
43
|
render() {
|
|
@@ -65,7 +54,7 @@ export class SwirlResourceListItem {
|
|
|
65
54
|
"resource-list-item--hide-divider": this.hideDivider,
|
|
66
55
|
"resource-list-item--selectable": this.selectable,
|
|
67
56
|
});
|
|
68
|
-
return (h(Host, { role: "row" }, h("div", { class: className, role: "gridcell" }, h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby": "label", class: "resource-list-item__content", href: this.href, disabled: disabled, onClick: this.onClick, part: "resource-list-item__content", role: role, tabIndex: 0 },
|
|
57
|
+
return (h(Host, { role: "row" }, h("div", { class: className, role: "gridcell" }, h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby": "label", class: "resource-list-item__content", href: this.href, disabled: disabled, onClick: this.onClick, part: "resource-list-item__content", role: role, tabIndex: 0 }, 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: "label" }, this.label), this.description && (h("span", { class: "resource-list-item__description" }, this.description)))), 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))))), showMeta && (h("span", { class: "resource-list-item__meta" }, this.meta)), showMenu && (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>", id: this.menuTriggerId, intent: "primary", label: this.menuTriggerLabel, onClick: this.onMenuTriggerClick })))));
|
|
69
58
|
}
|
|
70
59
|
static get is() { return "swirl-resource-list-item"; }
|
|
71
60
|
static get encapsulation() { return "shadow"; }
|
|
@@ -184,23 +173,6 @@ export class SwirlResourceListItem {
|
|
|
184
173
|
"attribute": "label",
|
|
185
174
|
"reflect": false
|
|
186
175
|
},
|
|
187
|
-
"media": {
|
|
188
|
-
"type": "string",
|
|
189
|
-
"mutable": false,
|
|
190
|
-
"complexType": {
|
|
191
|
-
"original": "string",
|
|
192
|
-
"resolved": "string",
|
|
193
|
-
"references": {}
|
|
194
|
-
},
|
|
195
|
-
"required": false,
|
|
196
|
-
"optional": true,
|
|
197
|
-
"docs": {
|
|
198
|
-
"tags": [],
|
|
199
|
-
"text": ""
|
|
200
|
-
},
|
|
201
|
-
"attribute": "media",
|
|
202
|
-
"reflect": false
|
|
203
|
-
},
|
|
204
176
|
"menuTriggerId": {
|
|
205
177
|
"type": "string",
|
|
206
178
|
"mutable": false,
|
|
@@ -289,6 +261,11 @@ export class SwirlResourceListItem {
|
|
|
289
261
|
}
|
|
290
262
|
};
|
|
291
263
|
}
|
|
264
|
+
static get states() {
|
|
265
|
+
return {
|
|
266
|
+
"hasMedia": {}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
292
269
|
static get events() {
|
|
293
270
|
return [{
|
|
294
271
|
"method": "valueChange",
|
package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.stories.js
CHANGED
|
@@ -35,6 +35,9 @@ const Template = (args) => {
|
|
|
35
35
|
const container = document.createElement("div");
|
|
36
36
|
const popover = document.createElement("swirl-popover");
|
|
37
37
|
const element = generateStoryElement("swirl-resource-list-item", args);
|
|
38
|
+
element.innerHTML = `
|
|
39
|
+
<swirl-avatar label="Jane Doe" src="https://avatars.dicebear.com/api/adventurer-neutral/a.svg?size=144" slot="media"></swirl-avatar>
|
|
40
|
+
`;
|
|
38
41
|
container.setAttribute("aria-label", "List");
|
|
39
42
|
container.setAttribute("role", "grid");
|
|
40
43
|
popover.label = "Options";
|
|
@@ -59,6 +62,5 @@ export const SwirlResourceListItem = Template.bind({});
|
|
|
59
62
|
SwirlResourceListItem.args = {
|
|
60
63
|
description: "With a description",
|
|
61
64
|
label: "This is a resource item",
|
|
62
|
-
media: `<swirl-avatar label="Jane Doe" src="https://avatars.dicebear.com/api/adventurer-neutral/a.svg?size=144" size="s"></swirl-avatar>`,
|
|
63
65
|
menuTriggerId: "trigger",
|
|
64
66
|
};
|
|
@@ -51,11 +51,9 @@ export class FileManager {
|
|
|
51
51
|
const items = Boolean(this.selectedDirectory)
|
|
52
52
|
? this.selectedDirectory.children
|
|
53
53
|
: FileManagerMockData.directories;
|
|
54
|
-
return items.length > 0 ? (items.map((item) => (h("swirl-resource-list-item", { description: item.description, key: item.name, label: item.name,
|
|
55
|
-
? "<swirl-icon-file></swirl-icon-file>"
|
|
56
|
-
: "<swirl-icon-folder-shared></swirl-icon-folder-shared>",
|
|
54
|
+
return items.length > 0 ? (items.map((item) => (h("swirl-resource-list-item", { description: item.description, key: item.name, label: item.name,
|
|
57
55
|
// eslint-disable-next-line react/jsx-no-bind
|
|
58
|
-
onClick: () => this.selectItem(item) })))) : (h("swirl-box", { padding: "16" }, h("swirl-text", { color: "subdued", weight: "medium" }, "This directory is empty.")));
|
|
56
|
+
onClick: () => this.selectItem(item) }, "type" in item ? (h("swirl-icon-file", { slot: "media" })) : (h("swirl-icon-folder-shared", { slot: "media" })))))) : (h("swirl-box", { padding: "16" }, h("swirl-text", { color: "subdued", weight: "medium" }, "This directory is empty.")));
|
|
59
57
|
}
|
|
60
58
|
render() {
|
|
61
59
|
var _a, _b;
|