@getflip/swirl-components 0.131.1 → 0.132.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.
Files changed (42) hide show
  1. package/components.json +50 -4
  2. package/dist/cjs/index-1de6abbd.js +4 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/swirl-app-layout_6.cjs.entry.js +16 -4
  5. package/dist/cjs/swirl-avatar-group.cjs.entry.js +1 -1
  6. package/dist/cjs/swirl-badge.cjs.entry.js +1 -1
  7. package/dist/cjs/swirl-components.cjs.js +1 -1
  8. package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
  9. package/dist/collection/components/swirl-avatar-group/swirl-avatar-group.css +12 -9
  10. package/dist/collection/components/swirl-avatar-group/swirl-avatar-group.stories.js +2 -2
  11. package/dist/collection/components/swirl-badge/swirl-badge.js +1 -1
  12. package/dist/collection/components/swirl-badge/swirl-badge.spec.js +2 -2
  13. package/dist/collection/components/swirl-empty-state/swirl-empty-state.css +9 -1
  14. package/dist/collection/components/swirl-empty-state/swirl-empty-state.js +11 -1
  15. package/dist/collection/components/swirl-empty-state/swirl-empty-state.spec.js +10 -5
  16. package/dist/collection/components/swirl-empty-state/swirl-empty-state.stories.js +9 -4
  17. package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.css +11 -20
  18. package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +25 -1
  19. package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.stories.js +4 -3
  20. package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
  21. package/dist/components/swirl-avatar-group.js +1 -1
  22. package/dist/components/swirl-badge2.js +1 -1
  23. package/dist/components/swirl-empty-state2.js +16 -4
  24. package/dist/components/swirl-resource-list-item2.js +10 -2
  25. package/dist/esm/index-59244838.js +4 -4
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/swirl-app-layout_6.entry.js +16 -4
  28. package/dist/esm/swirl-avatar-group.entry.js +1 -1
  29. package/dist/esm/swirl-badge.entry.js +1 -1
  30. package/dist/esm/swirl-components.js +1 -1
  31. package/dist/swirl-components/p-041f464a.entry.js +1 -0
  32. package/dist/swirl-components/p-782ebf73.entry.js +1 -0
  33. package/dist/swirl-components/p-815f2553.entry.js +1 -0
  34. package/dist/swirl-components/swirl-components.esm.js +1 -1
  35. package/dist/types/components/swirl-empty-state/swirl-empty-state.d.ts +5 -0
  36. package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +2 -0
  37. package/dist/types/components.d.ts +2 -0
  38. package/package.json +1 -1
  39. package/vscode-data.json +4 -0
  40. package/dist/swirl-components/p-0c10bed4.entry.js +0 -1
  41. package/dist/swirl-components/p-26719601.entry.js +0 -1
  42. 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(8, 1fr);
13
- grid-template-columns: repeat(8, 1fr);
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
- border: 0.25rem solid var(--swirl-avatar-group-border-color);
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: 3;
24
- grid-row-end: 9;
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: 3;
33
- grid-column-end: 9;
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: 0;
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="xs"></swirl-avatar>
27
- <swirl-avatar label="John Doe" src="https://api.dicebear.com/7.x/bottts-neutral/svg?size=144&seed=b" size="xs"></swirl-avatar>
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-8);
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
- return (h(Host, null, h("div", { class: "empty-state" }, this.illustration && (h("img", { alt: "", class: "empty-state__illustration", src: this.illustration })), h("div", { class: "empty-state__body" }, 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)))))));
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-heading align="center" as="p" level="4" text="Nothing to see here."></swirl-heading>
22
- <div class="empty-state__content">
23
- <swirl-text align="center" color="subdued">
24
- <slot></slot>
25
- </swirl-text>
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
- 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
- `;
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({});
@@ -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
  }
@@ -108,9 +96,9 @@
108
96
  display: none;
109
97
  }
110
98
 
111
- .resource-list-item--label-weight-medium {
112
- font-weight: var(--s-font-weight-medium);
113
- }
99
+ .resource-list-item--label-weight-medium .resource-list-item__label {
100
+ font-weight: var(--s-font-weight-medium);
101
+ }
114
102
 
115
103
  .resource-list-item--show-control-on-focus:hover,
116
104
  .resource-list-item--show-control-on-focus:focus,
@@ -173,6 +161,10 @@
173
161
  color: var(--s-text-on-status);
174
162
  }
175
163
 
164
+ .resource-list-item--wrap-description .resource-list-item__description {
165
+ white-space: normal;
166
+ }
167
+
176
168
  .resource-list-item--wrap-label .resource-list-item__label {
177
169
  white-space: normal;
178
170
  }
@@ -190,7 +182,7 @@
190
182
  padding-right: 0;
191
183
  padding-bottom: var(--s-space-12);
192
184
  padding-left: var(--s-space-16);
193
- align-items: center;
185
+ align-items: flex-start;
194
186
  border: none;
195
187
  color: var(--s-text-default);
196
188
  background-color: var(--swirl-resource-list-item-background-default);
@@ -236,9 +228,7 @@
236
228
  @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
237
229
 
238
230
  .resource-list-item__content {
239
- padding: var(--s-space-12);
240
- font-size: var(--s-font-size-sm);
241
- line-height: var(--s-line-height-sm)
231
+ padding: var(--s-space-12)
242
232
  }
243
233
  }
244
234
 
@@ -251,7 +241,7 @@
251
241
  position: relative;
252
242
  display: flex;
253
243
  min-width: 0;
254
- min-height: 2.875rem;
244
+ min-height: 3rem;
255
245
  padding-right: var(--s-space-16);
256
246
  flex-grow: 1;
257
247
  justify-content: center;
@@ -260,6 +250,7 @@
260
250
 
261
251
  .resource-list-item__label {
262
252
  overflow: hidden;
253
+ font-size: var(--s-font-size-base);
263
254
  white-space: nowrap;
264
255
  text-overflow: ellipsis;
265
256
  }
@@ -43,6 +43,7 @@ export class SwirlResourceListItem {
43
43
  this.allowDrag = undefined;
44
44
  this.checked = false;
45
45
  this.description = undefined;
46
+ this.descriptionWrap = undefined;
46
47
  this.disabled = undefined;
47
48
  this.dragging = undefined;
48
49
  this.dragHandleDescription = "Press spacebar to toggle grab";
@@ -123,6 +124,11 @@ export class SwirlResourceListItem {
123
124
  const showMeta = (Boolean(this.meta) || hasBadges) && !this.selectable;
124
125
  const ariaChecked = this.selectable ? String(this.checked) : undefined;
125
126
  const role = this.interactive && this.selectable ? "checkbox" : undefined;
127
+ const labelContainerStyles = !showMeta && Boolean(this.controlContainer)
128
+ ? {
129
+ paddingRight: `calc(${this.controlContainer?.getBoundingClientRect().width}px + var(--s-space-16))`,
130
+ }
131
+ : undefined;
126
132
  const className = classnames("resource-list-item", `resource-list-item--label-weight-${this.labelWeight}`, {
127
133
  "resource-list-item--active": this.active,
128
134
  "resource-list-item--checked": this.checked,
@@ -135,9 +141,10 @@ export class SwirlResourceListItem {
135
141
  "resource-list-item--selectable": this.selectable,
136
142
  "resource-list-item--show-control-on-focus": showControlOnFocus,
137
143
  "resource-list-item--show-meta": showMeta,
144
+ "resource-list-item--wrap-description": this.descriptionWrap,
138
145
  "resource-list-item--wrap-label": this.labelWrap,
139
146
  });
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 })))));
147
+ 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
148
  }
142
149
  static get is() { return "swirl-resource-list-item"; }
143
150
  static get encapsulation() { return "scoped"; }
@@ -222,6 +229,23 @@ export class SwirlResourceListItem {
222
229
  "attribute": "description",
223
230
  "reflect": false
224
231
  },
232
+ "descriptionWrap": {
233
+ "type": "boolean",
234
+ "mutable": false,
235
+ "complexType": {
236
+ "original": "boolean",
237
+ "resolved": "boolean",
238
+ "references": {}
239
+ },
240
+ "required": false,
241
+ "optional": true,
242
+ "docs": {
243
+ "tags": [],
244
+ "text": ""
245
+ },
246
+ "attribute": "description-wrap",
247
+ "reflect": false
248
+ },
225
249
  "disabled": {
226
250
  "type": "boolean",
227
251
  "mutable": false,
@@ -28,7 +28,8 @@ const Template = (args) => {
28
28
  <swirl-avatar
29
29
  slot="media"
30
30
  label="Jane Doe"
31
- src="https://api.dicebear.com/7.x/bottts-neutral/svg?size=144"></swirl-avatar>
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>
@@ -73,7 +74,7 @@ const Template = (args) => {
73
74
  };
74
75
  export const SwirlResourceListItem = Template.bind({});
75
76
  SwirlResourceListItem.args = {
76
- description: "With a <strong>description</strong>",
77
- label: "This is a <strong>resource item</strong>",
77
+ description: "With a description",
78
+ label: "This is a resource item",
78
79
  meta: "Today",
79
80
  };