@getflip/swirl-components 0.120.4 → 0.120.5

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.
@@ -20,10 +20,11 @@ const Template = (args) => {
20
20
  <swirl-avatar label="John Doe" 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
- description="With a description"
24
- label="This is a resource item 2"
23
+ description="With a <strong>description</strong>"
24
+ label="This is a <strong>resource item 2</strong>"
25
+ meta="Yesterday"
25
26
  >
26
- <swirl-avatar label="John Doe" src="https://picsum.photos/id/1027/144/144" slot="media"></swirl-avatar>
27
+ <swirl-thumbnail alt="Brief description of the image." src="https://picsum.photos/id/433/400/400" size="s" format="square" slot="badges"></swirl-thumbnail>
27
28
  </swirl-resource-list-item>
28
29
  <swirl-resource-list-item
29
30
  description="With a description"
@@ -93,7 +93,7 @@
93
93
  }
94
94
  }
95
95
 
96
- .resource-list-item--hide-divider .resource-list-item__label-container:after {
96
+ .resource-list-item--hide-divider .resource-list-item__content:after {
97
97
  display: none;
98
98
  }
99
99
 
@@ -166,6 +166,7 @@
166
166
  --swirl-avatar-group-border-color: var(--s-background-default);
167
167
  --swirl-badge-border-color: var(--s-background-default);
168
168
 
169
+ position: relative;
169
170
  display: flex;
170
171
  width: 100%;
171
172
  min-width: 0;
@@ -207,6 +208,16 @@
207
208
  color: var(--s-text-disabled);
208
209
  }
209
210
 
211
+ .resource-list-item__content:after {
212
+ position: absolute;
213
+ right: 0;
214
+ bottom: 0;
215
+ left: 0;
216
+ height: 0.0625rem;
217
+ background-color: var(--s-border-default);
218
+ content: "";
219
+ }
220
+
210
221
  @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
211
222
 
212
223
  .resource-list-item__content {
@@ -231,27 +242,12 @@
231
242
  flex-direction: column;
232
243
  }
233
244
 
234
- .resource-list-item__label-container:after {
235
- position: absolute;
236
- right: 0;
237
- bottom: calc(-1 * var(--s-space-12));
238
- left: 0;
239
- height: 0.0625rem;
240
- background-color: var(--s-border-default);
241
- content: "";
242
- }
243
-
244
245
  .resource-list-item__label {
245
246
  overflow: hidden;
246
247
  white-space: nowrap;
247
248
  text-overflow: ellipsis;
248
249
  }
249
250
 
250
- .resource-list-item__label b,
251
- .resource-list-item__label strong {
252
- font-weight: var(--s-font-weight-semibold);
253
- }
254
-
255
251
  .resource-list-item__description {
256
252
  overflow: hidden;
257
253
  margin-top: var(--s-space-2);
@@ -317,6 +313,11 @@
317
313
  font-size: var(--s-font-size-sm);
318
314
  flex-direction: column;
319
315
  align-self: flex-start;
316
+ gap: var(--s-space-2);
317
+ }
318
+
319
+ .resource-list-item__badges {
320
+ display: inline-flex;
320
321
  }
321
322
 
322
323
  .resource-list-item__drag-handle {
@@ -114,9 +114,10 @@ export class SwirlResourceListItem {
114
114
  : "button";
115
115
  const disabled = this.disabled && !Boolean(this.href);
116
116
  const hasBadges = Boolean(this.el.querySelector("[slot='badges']"));
117
- const hasMenu = Boolean(this.menuTriggerId) || this.el.querySelector("[slot='control']");
117
+ const hasControl = this.el.querySelector("[slot='control']");
118
+ const hasMenu = Boolean(this.menuTriggerId) || hasControl;
118
119
  const href = this.interactive && Boolean(this.href) ? this.href : undefined;
119
- const showControlOnFocus = Boolean(this.meta) || hasBadges;
120
+ const showControlOnFocus = hasControl && (Boolean(this.meta) || hasBadges);
120
121
  const showMenu = Boolean(this.menuTriggerId) && !Boolean(this.meta) && !this.selectable;
121
122
  const showMeta = (Boolean(this.meta) || hasBadges) && !this.selectable;
122
123
  const ariaChecked = this.selectable ? String(this.checked) : undefined;
@@ -134,7 +135,7 @@ export class SwirlResourceListItem {
134
135
  "resource-list-item--show-control-on-focus": showControlOnFocus,
135
136
  "resource-list-item--show-meta": showMeta,
136
137
  });
137
- 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" }, 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 })))));
138
+ 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 })))));
138
139
  }
139
140
  static get is() { return "swirl-resource-list-item"; }
140
141
  static get encapsulation() { return "scoped"; }
@@ -73,7 +73,7 @@ const Template = (args) => {
73
73
  };
74
74
  export const SwirlResourceListItem = Template.bind({});
75
75
  SwirlResourceListItem.args = {
76
- description: "With a description",
77
- label: "This is a resource item",
76
+ description: "With a <strong>description</strong>",
77
+ label: "This is a <strong>resource item</strong>",
78
78
  meta: "Today",
79
79
  };
@@ -10,10 +10,15 @@
10
10
  position: relative;
11
11
  display: inline-flex;
12
12
  overflow: hidden;
13
+ padding: 0.0625rem;
13
14
  border-radius: var(--s-border-radius-s);
14
15
  box-shadow: inset 0 0 0 0.03125rem rgba(0, 0, 0, 0.1);
15
16
  }
16
17
 
18
+ .thumbnail .thumbnail__image {
19
+ width: 100%;
20
+ }
21
+
17
22
  .thumbnail--size-s {
18
23
  --swirl-thumbnail-size: 2.5rem;
19
24
  }
@@ -43,28 +48,16 @@
43
48
  aspect-ratio: 4 / 3;
44
49
  }
45
50
 
46
- .thumbnail--format-landscape .thumbnail__image {
47
- width: 100%;
48
- }
49
-
50
51
  .thumbnail--format-portrait {
51
52
  height: var(--swirl-thumbnail-size);
52
53
  aspect-ratio: 3 / 4;
53
54
  }
54
55
 
55
- .thumbnail--format-portrait .thumbnail__image {
56
- height: 100%;
57
- }
58
-
59
56
  .thumbnail--format-square {
60
57
  width: var(--swirl-thumbnail-size);
61
58
  height: var(--swirl-thumbnail-size);
62
59
  }
63
60
 
64
- .thumbnail--format-square .thumbnail__image {
65
- width: 100%;
66
- }
67
-
68
61
  .thumbnail--has-progress .thumbnail__timestamp {
69
62
  bottom: var(--s-space-8);
70
63
  }