@getflip/swirl-components 0.74.2 → 0.76.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 (38) hide show
  1. package/components.json +59 -5
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/swirl-badge.cjs.entry.js +1 -1
  4. package/dist/cjs/swirl-components.cjs.js +1 -1
  5. package/dist/cjs/swirl-image-grid-item.cjs.entry.js +3 -2
  6. package/dist/cjs/swirl-modal.cjs.entry.js +9 -3
  7. package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
  8. package/dist/collection/components/swirl-badge/swirl-badge.css +5 -0
  9. package/dist/collection/components/swirl-badge/swirl-badge.js +1 -1
  10. package/dist/collection/components/swirl-image-grid/swirl-image-grid.stories.js +1 -1
  11. package/dist/collection/components/swirl-image-grid-item/swirl-image-grid-item.css +24 -3
  12. package/dist/collection/components/swirl-image-grid-item/swirl-image-grid-item.js +19 -1
  13. package/dist/collection/components/swirl-image-grid-item/swirl-image-grid-item.stories.js +1 -0
  14. package/dist/collection/components/swirl-modal/swirl-modal.css +34 -7
  15. package/dist/collection/components/swirl-modal/swirl-modal.js +13 -4
  16. package/dist/collection/components/swirl-modal/swirl-modal.spec.js +5 -2
  17. package/dist/collection/components/swirl-modal/swirl-modal.stories.js +3 -11
  18. package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
  19. package/dist/components/swirl-badge2.js +1 -1
  20. package/dist/components/swirl-image-grid-item.js +4 -2
  21. package/dist/components/swirl-modal.js +10 -3
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/swirl-badge.entry.js +1 -1
  24. package/dist/esm/swirl-components.js +1 -1
  25. package/dist/esm/swirl-image-grid-item.entry.js +3 -2
  26. package/dist/esm/swirl-modal.entry.js +9 -3
  27. package/dist/swirl-components/p-39ee319c.entry.js +1 -0
  28. package/dist/swirl-components/p-99738fe7.entry.js +10 -0
  29. package/dist/swirl-components/{p-8338dd80.entry.js → p-c4d4a99d.entry.js} +1 -1
  30. package/dist/swirl-components/swirl-components.esm.js +1 -1
  31. package/dist/types/components/swirl-badge/swirl-badge.d.ts +1 -1
  32. package/dist/types/components/swirl-image-grid-item/swirl-image-grid-item.d.ts +1 -0
  33. package/dist/types/components/swirl-modal/swirl-modal.d.ts +6 -2
  34. package/dist/types/components.d.ts +2 -16
  35. package/package.json +1 -1
  36. package/vscode-data.json +8 -1
  37. package/dist/swirl-components/p-11c739fb.entry.js +0 -1
  38. package/dist/swirl-components/p-513c9da4.entry.js +0 -10
@@ -84,6 +84,11 @@
84
84
  background-color: var(--s-decorative-kiwi-surface);
85
85
  }
86
86
 
87
+ .badge--intent-neutral {
88
+ color: var(--s-text-default);
89
+ background-color: var(--s-surface-neutral-subdued);
90
+ }
91
+
87
92
  .badge--intent-pumpkin {
88
93
  color: var(--s-text-dark);
89
94
  background-color: var(--s-decorative-pumpkin-surface);
@@ -50,7 +50,7 @@ export class SwirlBadge {
50
50
  "mutable": false,
51
51
  "complexType": {
52
52
  "original": "SwirlBadgeIntent",
53
- "resolved": "\"banana\" | \"blueberry\" | \"chilli\" | \"critical\" | \"grape\" | \"kiwi\" | \"pumpkin\" | \"radish\"",
53
+ "resolved": "\"banana\" | \"blueberry\" | \"chilli\" | \"critical\" | \"grape\" | \"kiwi\" | \"neutral\" | \"pumpkin\" | \"radish\"",
54
54
  "references": {
55
55
  "SwirlBadgeIntent": {
56
56
  "location": "local",
@@ -19,6 +19,6 @@ export const SwirlImageGrid = Template.bind({});
19
19
  SwirlImageGrid.args = {
20
20
  aspectRatio: "16 / 9",
21
21
  slot: `<swirl-image-grid-item alt="Cute dog in a blanket" interactive src="/sample.jpg"></swirl-image-grid-item>
22
- <swirl-image-grid-item alt="Another cute dog in a blanket" interactive src="/sample-2.jpg"></swirl-image-grid-item>
22
+ <swirl-image-grid-item alt="Another cute dog in a blanket" icon="<swirl-icon-play-arrow></swirl-icon-play-arrow>" interactive src="/sample-2.jpg"></swirl-image-grid-item>
23
23
  <swirl-image-grid-item alt="Third cute dog in a blanket" interactive src="/sample-3.jpg"></swirl-image-grid-item>`,
24
24
  };
@@ -69,14 +69,35 @@ button.image-grid-item:focus-visible {
69
69
  object-position: center;
70
70
  }
71
71
 
72
+ .image-grid-item__icon {
73
+ position: absolute;
74
+ z-index: 1;
75
+ top: 50%;
76
+ left: 50%;
77
+ display: flex;
78
+ width: 3rem;
79
+ height: 3rem;
80
+ justify-content: center;
81
+ align-items: center;
82
+ border-radius: 50%;
83
+ color: var(--s-icon-on-image);
84
+ background-color: rgba(0, 0, 0, 0.6);
85
+ transform: translate3d(-50%, -50%, 0);
86
+ }
87
+
88
+ .image-grid-item__icon ::part(icon) {
89
+ width: 2rem;
90
+ height: 2rem;
91
+ }
92
+
72
93
  .image-grid-item__overlay {
73
94
  position: absolute;
74
95
  z-index: 2;
75
- inset: 0;
76
96
  display: flex;
77
- align-items: center;
78
97
  justify-content: center;
79
- background-color: rgba(0, 0, 0, 0.4);
98
+ align-items: center;
80
99
  color: var(--s-text-on-image);
100
+ background-color: rgba(0, 0, 0, 0.4);
81
101
  font-size: var(--s-font-size-2xl);
102
+ inset: 0;
82
103
  }
@@ -3,6 +3,7 @@ import classnames from "classnames";
3
3
  export class SwirlImageGridItem {
4
4
  constructor() {
5
5
  this.alt = undefined;
6
+ this.icon = undefined;
6
7
  this.interactive = undefined;
7
8
  this.overlay = undefined;
8
9
  this.src = undefined;
@@ -12,7 +13,7 @@ export class SwirlImageGridItem {
12
13
  const className = classnames("image-grid-item", {
13
14
  "image-grid-item--has-overlay": this.overlay,
14
15
  });
15
- return (h(Host, { role: "listitem" }, h(Tag, { class: className, type: this.interactive ? "button" : undefined }, h("div", { class: "image-grid-item__background", style: { backgroundImage: `url(${this.src})` } }), h("img", { alt: this.alt, class: "image-grid-item__image", src: this.src }), this.overlay && (h("div", { class: "image-grid-item__overlay" }, this.overlay)))));
16
+ return (h(Host, { role: "listitem" }, h(Tag, { class: className, type: this.interactive ? "button" : undefined }, h("div", { class: "image-grid-item__background", style: { backgroundImage: `url(${this.src})` } }), h("img", { alt: this.alt, class: "image-grid-item__image", src: this.src }), this.icon && !Boolean(this.overlay) && (h("div", { class: "image-grid-item__icon", innerHTML: this.icon })), this.overlay && (h("div", { class: "image-grid-item__overlay" }, this.overlay)))));
16
17
  }
17
18
  static get is() { return "swirl-image-grid-item"; }
18
19
  static get encapsulation() { return "shadow"; }
@@ -45,6 +46,23 @@ export class SwirlImageGridItem {
45
46
  "attribute": "alt",
46
47
  "reflect": false
47
48
  },
49
+ "icon": {
50
+ "type": "string",
51
+ "mutable": false,
52
+ "complexType": {
53
+ "original": "string",
54
+ "resolved": "string",
55
+ "references": {}
56
+ },
57
+ "required": false,
58
+ "optional": true,
59
+ "docs": {
60
+ "tags": [],
61
+ "text": ""
62
+ },
63
+ "attribute": "icon",
64
+ "reflect": false
65
+ },
48
66
  "interactive": {
49
67
  "type": "boolean",
50
68
  "mutable": false,
@@ -19,5 +19,6 @@ const Template = (args) => {
19
19
  export const SwirlImageGridItem = Template.bind({});
20
20
  SwirlImageGridItem.args = {
21
21
  alt: "Dog in a blanket",
22
+ icon: "<swirl-icon-play-arrow></swirl-icon-play-arrow>",
22
23
  src: "/sample.jpg",
23
24
  };
@@ -85,7 +85,7 @@
85
85
 
86
86
  @media (min-width: 768px) {
87
87
 
88
- .modal--variant-drawer.modal--hide-label .modal__header {
88
+ .modal--variant-drawer.modal--hide-label .modal__header-bar {
89
89
  height: auto;
90
90
  padding-top: var(--s-space-4);
91
91
  padding-bottom: var(--s-space-4)
@@ -112,17 +112,17 @@
112
112
  }
113
113
  }
114
114
 
115
- .modal--variant-drawer .modal__header {
115
+ .modal--variant-drawer .modal__header-bar {
116
116
  background-color: var(--s-surface-overlay-default);
117
117
  }
118
118
 
119
- .modal--variant-drawer .modal__header .modal__close-button {
119
+ .modal--variant-drawer .modal__header-bar .modal__close-button {
120
120
  margin-left: calc(-1 * var(--s-space-8));
121
121
  }
122
122
 
123
123
  @media (min-width: 768px) {
124
124
 
125
- .modal--variant-drawer .modal__header {
125
+ .modal--variant-drawer .modal__header-bar {
126
126
  flex-direction: row
127
127
  }
128
128
  }
@@ -177,6 +177,10 @@
177
177
  padding-left: var(--s-space-24);
178
178
  }
179
179
 
180
+ .modal--has-header-tools .modal__header-tools {
181
+ display: block;
182
+ }
183
+
180
184
  @media (min-width: 768px) {
181
185
  .modal--scrolled .modal__header {
182
186
  border-bottom-color: var(--s-border-default);
@@ -213,6 +217,17 @@
213
217
  }
214
218
 
215
219
  .modal__header {
220
+ border-bottom: var(--s-border-width-default) solid var(--s-border-default);
221
+ }
222
+
223
+ @media (min-width: 768px) {
224
+
225
+ .modal__header {
226
+ border-bottom: var(--s-border-width-default) solid transparent
227
+ }
228
+ }
229
+
230
+ .modal__header-bar {
216
231
  display: flex;
217
232
  height: 3.5rem;
218
233
  padding-top: var(--s-space-8);
@@ -221,24 +236,36 @@
221
236
  padding-left: var(--s-space-16);
222
237
  flex-shrink: 0;
223
238
  align-items: center;
224
- border-bottom: var(--s-border-width-default) solid var(--s-border-default);
225
239
  gap: var(--s-space-8);
226
240
  }
227
241
 
228
242
  @media (min-width: 768px) {
229
243
 
230
- .modal__header {
244
+ .modal__header-bar {
231
245
  height: 4.125rem;
232
246
  padding-top: var(--s-space-24);
233
247
  padding-right: var(--s-space-24);
234
248
  padding-bottom: var(--s-space-16);
235
249
  padding-left: var(--s-space-24);
236
- border-bottom: var(--s-border-width-default) solid transparent;
237
250
  flex-direction: row-reverse;
238
251
  gap: var(--s-space-16)
239
252
  }
240
253
  }
241
254
 
255
+ .modal__header-tools {
256
+ display: none;
257
+ padding-right: var(--s-space-16);
258
+ padding-left: var(--s-space-16);
259
+ }
260
+
261
+ @media (min-width: 768px) {
262
+
263
+ .modal__header-tools {
264
+ padding-right: var(--s-space-24);
265
+ padding-left: var(--s-space-24)
266
+ }
267
+ }
268
+
242
269
  .modal__custom-header {
243
270
  flex-shrink: 0;
244
271
  border-bottom: var(--s-border-width-default) solid var(--s-border-default);
@@ -3,8 +3,10 @@ import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock";
3
3
  import * as focusTrap from "focus-trap";
4
4
  import classnames from "classnames";
5
5
  /**
6
- * slot - Modal contents
7
- * custom-header - Optional custom header; should be used hidden label
6
+ * @slot slot - Modal contents
7
+ * @slot header-tools - Used to display elements inside the sticky header, below the label
8
+ * @slot custom-header - Optional custom header; should be used hidden label
9
+ * @slot custom-footer - Optional custom footer; replaces the default footer with primary and secondary actions
8
10
  */
9
11
  export class SwirlModal {
10
12
  constructor() {
@@ -53,6 +55,7 @@ export class SwirlModal {
53
55
  this.closing = false;
54
56
  this.hasCustomHeader = undefined;
55
57
  this.hasCustomFooter = undefined;
58
+ this.hasHeaderTools = undefined;
56
59
  this.scrollable = false;
57
60
  this.scrolled = false;
58
61
  this.scrolledDown = false;
@@ -70,6 +73,7 @@ export class SwirlModal {
70
73
  queueMicrotask(() => {
71
74
  this.updateCustomFooterStatus();
72
75
  this.updateCustomHeaderStatus();
76
+ this.updateHeaderToolsStatus();
73
77
  });
74
78
  }
75
79
  disconnectedCallback() {
@@ -120,6 +124,9 @@ export class SwirlModal {
120
124
  updateCustomHeaderStatus() {
121
125
  this.hasCustomHeader = Boolean(this.el.querySelector('[slot="custom-header"]'));
122
126
  }
127
+ updateHeaderToolsStatus() {
128
+ this.hasHeaderTools = Boolean(this.el.querySelector('[slot="header-tools"]'));
129
+ }
123
130
  lockBodyScroll() {
124
131
  disableBodyScroll(this.scrollContainer);
125
132
  }
@@ -132,15 +139,16 @@ export class SwirlModal {
132
139
  "modal--closing": this.closing,
133
140
  "modal--has-custom-footer": this.hasCustomFooter,
134
141
  "modal--has-custom-header": this.hasCustomHeader,
142
+ "modal--has-header-tools": this.hasHeaderTools,
135
143
  "modal--hide-label": this.hideLabel,
136
144
  "modal--padded": this.padded,
137
145
  "modal--scrollable": this.scrollable,
138
146
  "modal--scrolled": this.scrolled,
139
147
  "modal--scrolled-down": this.scrolledDown,
140
148
  });
141
- return (h(Host, null, h("section", { "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, role: "dialog", ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", style: { maxWidth: this.maxWidth } }, h("header", { class: "modal__custom-header" }, h("slot", { name: "custom-header" })), (!this.hideLabel || !this.hideCloseButton) && (h("header", { class: "modal__header" }, !this.hideCloseButton && (h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: this.variant === "default"
149
+ return (h(Host, null, h("section", { "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, role: "dialog", ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", style: { maxWidth: this.maxWidth } }, h("header", { class: "modal__custom-header" }, h("slot", { name: "custom-header" })), (!this.hideLabel || !this.hideCloseButton) && (h("header", { class: "modal__header" }, h("div", { class: "modal__header-bar" }, !this.hideCloseButton && (h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: this.variant === "default"
142
150
  ? "<swirl-icon-close></swirl-icon-close>"
143
- : "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), !this.hideLabel && (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("div", { class: "modal__custom-footer" }, h("slot", { name: "custom-footer" })), 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" })))))))));
151
+ : "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), !this.hideLabel && (h("swirl-heading", { as: "h2", class: "modal__heading", level: 3, text: this.label }))), h("div", { class: "modal__header-tools" }, h("slot", { name: "header-tools" })))), h("div", { class: "modal__content", onScroll: this.determineScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", null)), h("div", { class: "modal__custom-footer" }, h("slot", { name: "custom-footer" })), 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" })))))))));
144
152
  }
145
153
  static get is() { return "swirl-modal"; }
146
154
  static get originalStyleUrls() {
@@ -324,6 +332,7 @@ export class SwirlModal {
324
332
  "closing": {},
325
333
  "hasCustomHeader": {},
326
334
  "hasCustomFooter": {},
335
+ "hasHeaderTools": {},
327
336
  "scrollable": {},
328
337
  "scrolled": {},
329
338
  "scrolledDown": {}
@@ -13,8 +13,11 @@ describe("swirl-modal", () => {
13
13
  <div class="modal__body">
14
14
  <header class="modal__custom-header"></header>
15
15
  <header class="modal__header">
16
- <swirl-button class="modal__close-button" hidelabel="" icon="<swirl-icon-close></swirl-icon-close>" label="Close modal"></swirl-button>
17
- <swirl-heading as="h2" class="modal__heading" level="3" text="Dialog"></swirl-heading>
16
+ <div class="modal__header-bar">
17
+ <swirl-button class="modal__close-button" hidelabel="" icon="<swirl-icon-close></swirl-icon-close>" label="Close modal"></swirl-button>
18
+ <swirl-heading as="h2" class="modal__heading" level="3" text="Dialog"></swirl-heading>
19
+ </div>
20
+ <div class="modal__header-tools"></div>
18
21
  </header>
19
22
  <div class="modal__content">
20
23
  Content
@@ -49,17 +49,9 @@ const Template = (args) => {
49
49
  sit amet.
50
50
  </swirl-text>
51
51
 
52
- <swirl-form-control label="Test" label-position="outside"><swirl-select label="Select">
53
- <swirl-option-list-section label="Section 1">
54
- <swirl-option-list-item label="This is an option 1" value="1"></swirl-option-list-item>
55
- <swirl-option-list-item label="This is an option 2" value="2"></swirl-option-list-item>
56
- <swirl-option-list-item label="This is an option 3" value="3"></swirl-option-list-item>
57
- </swirl-option-list-section>
58
- <swirl-option-list-section label="Section 2">
59
- <swirl-option-list-item label="This is an option 4" value="4"></swirl-option-list-item>
60
- </swirl-option-list-section>
61
- </swirl-select></swirl-form-control>
62
-
52
+ <swirl-box padding-block-start="0" padding-block-end="16" slot="header-tools">
53
+ <swirl-search label="Search"></swirl-search>
54
+ </div>
63
55
  `;
64
56
  container.append(trigger, element);
65
57
  return container;