@getflip/swirl-components 0.287.0 → 0.289.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 (150) hide show
  1. package/components.json +296 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/swirl-action-list_2.cjs.entry.js +1 -1
  4. package/dist/cjs/swirl-app-layout_5.cjs.entry.js +1 -1
  5. package/dist/cjs/swirl-autocomplete.cjs.entry.js +1 -1
  6. package/dist/cjs/swirl-banner.cjs.entry.js +1 -1
  7. package/dist/cjs/swirl-button.cjs.entry.js +1 -1
  8. package/dist/cjs/swirl-carousel.cjs.entry.js +1 -1
  9. package/dist/cjs/swirl-chip.cjs.entry.js +1 -1
  10. package/dist/cjs/swirl-components.cjs.js +1 -1
  11. package/dist/cjs/swirl-console-layout.cjs.entry.js +1 -1
  12. package/dist/cjs/swirl-date-input.cjs.entry.js +1 -1
  13. package/dist/cjs/swirl-date-picker_2.cjs.entry.js +1 -1
  14. package/dist/cjs/swirl-file-viewer_8.cjs.entry.js +1 -1
  15. package/dist/cjs/swirl-form-control.cjs.entry.js +1 -1
  16. package/dist/cjs/swirl-icon-check-small_3.cjs.entry.js +1 -1
  17. package/dist/cjs/swirl-icon-error_3.cjs.entry.js +1 -1
  18. package/dist/cjs/swirl-image-grid-item.cjs.entry.js +1 -1
  19. package/dist/cjs/swirl-inline-status.cjs.entry.js +1 -1
  20. package/dist/cjs/swirl-lightbox.cjs.entry.js +1 -1
  21. package/dist/cjs/swirl-menu-item.cjs.entry.js +14 -5
  22. package/dist/cjs/swirl-menu.cjs.entry.js +1 -1
  23. package/dist/cjs/swirl-modal.cjs.entry.js +1 -1
  24. package/dist/cjs/swirl-option-list_2.cjs.entry.js +1 -1
  25. package/dist/cjs/swirl-pagination.cjs.entry.js +1 -1
  26. package/dist/cjs/swirl-pdf-reader.cjs.entry.js +1 -1
  27. package/dist/cjs/swirl-popover_2.cjs.entry.js +1 -1
  28. package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +1 -1
  29. package/dist/cjs/swirl-search.cjs.entry.js +1 -1
  30. package/dist/cjs/swirl-select.cjs.entry.js +1 -1
  31. package/dist/cjs/swirl-shell-layout.cjs.entry.js +1 -1
  32. package/dist/cjs/swirl-tab-bar.cjs.entry.js +34 -4
  33. package/dist/cjs/swirl-table-column.cjs.entry.js +1 -1
  34. package/dist/cjs/swirl-table-row.cjs.entry.js +1 -1
  35. package/dist/cjs/swirl-table.cjs.entry.js +1 -1
  36. package/dist/cjs/swirl-tabs.cjs.entry.js +7 -3
  37. package/dist/cjs/swirl-text-input.cjs.entry.js +1 -1
  38. package/dist/cjs/swirl-time-input.cjs.entry.js +1 -1
  39. package/dist/cjs/swirl-toast.cjs.entry.js +1 -1
  40. package/dist/cjs/swirl-toolbar.cjs.entry.js +1 -1
  41. package/dist/cjs/{utils-ea8f1bbc.js → utils-1a1dd8d3.js} +16 -0
  42. package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
  43. package/dist/collection/components/swirl-menu/swirl-menu.spec.js +5 -15
  44. package/dist/collection/components/swirl-menu-item/swirl-menu-item.js +14 -4
  45. package/dist/collection/components/swirl-menu-item/swirl-menu-item.spec.js +3 -10
  46. package/dist/collection/components/swirl-modal/swirl-modal.css +11 -0
  47. package/dist/collection/components/swirl-tab-bar/swirl-tab-bar.css +72 -30
  48. package/dist/collection/components/swirl-tab-bar/swirl-tab-bar.js +104 -4
  49. package/dist/collection/components/swirl-tab-bar/swirl-tab-bar.spec.js +4 -4
  50. package/dist/collection/components/swirl-tabs/swirl-tabs.js +77 -3
  51. package/dist/collection/components/swirl-tabs/swirl-tabs.spec.js +1 -1
  52. package/dist/collection/utils.js +15 -0
  53. package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
  54. package/dist/components/swirl-app-layout2.js +1 -1
  55. package/dist/components/swirl-date-picker2.js +1 -1
  56. package/dist/components/swirl-file-viewer-pdf2.js +1 -1
  57. package/dist/components/swirl-menu-item.js +14 -4
  58. package/dist/components/swirl-modal.js +1 -1
  59. package/dist/components/swirl-tab-bar2.js +38 -5
  60. package/dist/components/swirl-tabs.js +10 -3
  61. package/dist/components/utils.js +16 -1
  62. package/dist/esm/loader.js +1 -1
  63. package/dist/esm/swirl-action-list_2.entry.js +1 -1
  64. package/dist/esm/swirl-app-layout_5.entry.js +1 -1
  65. package/dist/esm/swirl-autocomplete.entry.js +1 -1
  66. package/dist/esm/swirl-banner.entry.js +1 -1
  67. package/dist/esm/swirl-button.entry.js +1 -1
  68. package/dist/esm/swirl-carousel.entry.js +1 -1
  69. package/dist/esm/swirl-chip.entry.js +1 -1
  70. package/dist/esm/swirl-components.js +1 -1
  71. package/dist/esm/swirl-console-layout.entry.js +1 -1
  72. package/dist/esm/swirl-date-input.entry.js +1 -1
  73. package/dist/esm/swirl-date-picker_2.entry.js +1 -1
  74. package/dist/esm/swirl-file-viewer_8.entry.js +1 -1
  75. package/dist/esm/swirl-form-control.entry.js +1 -1
  76. package/dist/esm/swirl-icon-check-small_3.entry.js +1 -1
  77. package/dist/esm/swirl-icon-error_3.entry.js +1 -1
  78. package/dist/esm/swirl-image-grid-item.entry.js +1 -1
  79. package/dist/esm/swirl-inline-status.entry.js +1 -1
  80. package/dist/esm/swirl-lightbox.entry.js +1 -1
  81. package/dist/esm/swirl-menu-item.entry.js +14 -5
  82. package/dist/esm/swirl-menu.entry.js +1 -1
  83. package/dist/esm/swirl-modal.entry.js +1 -1
  84. package/dist/esm/swirl-option-list_2.entry.js +1 -1
  85. package/dist/esm/swirl-pagination.entry.js +1 -1
  86. package/dist/esm/swirl-pdf-reader.entry.js +1 -1
  87. package/dist/esm/swirl-popover_2.entry.js +1 -1
  88. package/dist/esm/swirl-resource-list-file-item.entry.js +1 -1
  89. package/dist/esm/swirl-search.entry.js +1 -1
  90. package/dist/esm/swirl-select.entry.js +1 -1
  91. package/dist/esm/swirl-shell-layout.entry.js +1 -1
  92. package/dist/esm/swirl-tab-bar.entry.js +35 -5
  93. package/dist/esm/swirl-table-column.entry.js +1 -1
  94. package/dist/esm/swirl-table-row.entry.js +1 -1
  95. package/dist/esm/swirl-table.entry.js +1 -1
  96. package/dist/esm/swirl-tabs.entry.js +7 -3
  97. package/dist/esm/swirl-text-input.entry.js +1 -1
  98. package/dist/esm/swirl-time-input.entry.js +1 -1
  99. package/dist/esm/swirl-toast.entry.js +1 -1
  100. package/dist/esm/swirl-toolbar.entry.js +1 -1
  101. package/dist/esm/{utils-fbb8b494.js → utils-877a768f.js} +16 -1
  102. package/dist/swirl-components/{p-3035680c.entry.js → p-06bdccc8.entry.js} +1 -1
  103. package/dist/swirl-components/{p-e5fa524b.entry.js → p-107317f7.entry.js} +1 -1
  104. package/dist/swirl-components/p-138cbd38.entry.js +1 -0
  105. package/dist/swirl-components/{p-1a8cc28b.entry.js → p-1a6e40b5.entry.js} +1 -1
  106. package/dist/swirl-components/{p-1d545c20.entry.js → p-1fb940a5.entry.js} +1 -1
  107. package/dist/swirl-components/{p-97e844bc.entry.js → p-20bd4e9f.entry.js} +1 -1
  108. package/dist/swirl-components/{p-13dfb234.entry.js → p-242a3a2e.entry.js} +1 -1
  109. package/dist/swirl-components/{p-ac4d5f89.entry.js → p-286a4e5f.entry.js} +1 -1
  110. package/dist/swirl-components/{p-8aae965a.entry.js → p-2be118fe.entry.js} +1 -1
  111. package/dist/swirl-components/{p-581d4452.entry.js → p-3393c37e.entry.js} +1 -1
  112. package/dist/swirl-components/{p-c58fb3e4.entry.js → p-40a8920a.entry.js} +1 -1
  113. package/dist/swirl-components/{p-84fedd39.entry.js → p-4203d5bd.entry.js} +1 -1
  114. package/dist/swirl-components/{p-d55652aa.entry.js → p-42a8e0d3.entry.js} +1 -1
  115. package/dist/swirl-components/{p-a075cbf9.entry.js → p-47997f42.entry.js} +1 -1
  116. package/dist/swirl-components/{p-0f3e0216.js → p-5136b9f9.js} +1 -1
  117. package/dist/swirl-components/p-53609073.entry.js +1 -0
  118. package/dist/swirl-components/{p-3d225eb0.entry.js → p-648b2513.entry.js} +1 -1
  119. package/dist/swirl-components/{p-a935ab50.entry.js → p-67986fbf.entry.js} +1 -1
  120. package/dist/swirl-components/{p-21adf412.entry.js → p-6e63989b.entry.js} +1 -1
  121. package/dist/swirl-components/{p-5d981c71.entry.js → p-729b5778.entry.js} +1 -1
  122. package/dist/swirl-components/{p-56085b5f.entry.js → p-8105788c.entry.js} +1 -1
  123. package/dist/swirl-components/{p-5c750dc8.entry.js → p-879737fa.entry.js} +1 -1
  124. package/dist/swirl-components/{p-626aa890.entry.js → p-881701f9.entry.js} +1 -1
  125. package/dist/swirl-components/{p-6a3a0bbb.entry.js → p-896d79a5.entry.js} +1 -1
  126. package/dist/swirl-components/p-8d7ad114.entry.js +1 -0
  127. package/dist/swirl-components/{p-6ccc3c41.entry.js → p-917fbbd8.entry.js} +1 -1
  128. package/dist/swirl-components/{p-3400acf0.entry.js → p-9536fdc4.entry.js} +1 -1
  129. package/dist/swirl-components/{p-a7bf1966.entry.js → p-a2afb995.entry.js} +1 -1
  130. package/dist/swirl-components/{p-389b4dc5.entry.js → p-a9f98674.entry.js} +1 -1
  131. package/dist/swirl-components/{p-abcbb236.entry.js → p-b6eaeb29.entry.js} +1 -1
  132. package/dist/swirl-components/{p-e97590df.entry.js → p-ba40bf8f.entry.js} +1 -1
  133. package/dist/swirl-components/{p-da913f77.entry.js → p-c202911e.entry.js} +1 -1
  134. package/dist/swirl-components/{p-1449f6ec.entry.js → p-c71f17c9.entry.js} +1 -1
  135. package/dist/swirl-components/{p-305b560c.entry.js → p-d587d1b6.entry.js} +1 -1
  136. package/dist/swirl-components/{p-dee55c67.entry.js → p-db3dc350.entry.js} +1 -1
  137. package/dist/swirl-components/{p-4de8e4d1.entry.js → p-de850f13.entry.js} +1 -1
  138. package/dist/swirl-components/{p-279f67be.entry.js → p-ea418410.entry.js} +1 -1
  139. package/dist/swirl-components/{p-8efcb985.entry.js → p-eb81439a.entry.js} +1 -1
  140. package/dist/swirl-components/swirl-components.esm.js +1 -1
  141. package/dist/types/components/swirl-menu-item/swirl-menu-item.d.ts +2 -0
  142. package/dist/types/components/swirl-tab-bar/swirl-tab-bar.d.ts +7 -0
  143. package/dist/types/components/swirl-tabs/swirl-tabs.d.ts +4 -1
  144. package/dist/types/components.d.ts +16 -4
  145. package/dist/types/utils.d.ts +13 -0
  146. package/package.json +1 -1
  147. package/vscode-data.json +144 -0
  148. package/dist/swirl-components/p-0dacf15d.entry.js +0 -1
  149. package/dist/swirl-components/p-94a1bf2f.entry.js +0 -1
  150. package/dist/swirl-components/p-9f59a11b.entry.js +0 -1
@@ -119,9 +119,7 @@ describe("swirl-menu", () => {
119
119
  <swirl-menu-item label="Item 1">
120
120
  <mock:shadow-root>
121
121
  <div class="menu-item">
122
- <swirl-action-list-item intent="default" label="Item 1">
123
- <slot name="avatar" slot="avatar"></slot>
124
- </swirl-action-list-item>
122
+ <swirl-action-list-item intent="default" label="Item 1"></swirl-action-list-item>
125
123
  <slot></slot>
126
124
  </div>
127
125
  </mock:shadow-root>
@@ -129,9 +127,7 @@ describe("swirl-menu", () => {
129
127
  <swirl-menu-item label="Item 2">
130
128
  <mock:shadow-root>
131
129
  <div class="menu-item">
132
- <swirl-action-list-item intent="default" label="Item 2">
133
- <slot name="avatar" slot="avatar"></slot>
134
- </swirl-action-list-item>
130
+ <swirl-action-list-item intent="default" label="Item 2"></swirl-action-list-item>
135
131
  <slot></slot>
136
132
  </div>
137
133
  </mock:shadow-root>
@@ -168,9 +164,7 @@ describe("swirl-menu", () => {
168
164
  <swirl-menu-item label="Sub item 1" value="1">
169
165
  <mock:shadow-root>
170
166
  <div class="menu-item">
171
- <swirl-option-list-item label="Sub item 1" swirlariarole="menuitemradio" value="1">
172
- <slot name="avatar" slot="avatar"></slot>
173
- </swirl-option-list-item>
167
+ <swirl-option-list-item label="Sub item 1" swirlariarole="menuitemradio" value="1"></swirl-option-list-item>
174
168
  <slot></slot>
175
169
  </div>
176
170
  </mock:shadow-root>
@@ -178,9 +172,7 @@ describe("swirl-menu", () => {
178
172
  <swirl-menu-item label="Sub item 2" value="2">
179
173
  <mock:shadow-root>
180
174
  <div class="menu-item">
181
- <swirl-option-list-item label="Sub item 2" swirlariarole="menuitemradio" value="2">
182
- <slot name="avatar" slot="avatar"></slot>
183
- </swirl-option-list-item>
175
+ <swirl-option-list-item label="Sub item 2" swirlariarole="menuitemradio" value="2"></swirl-option-list-item>
184
176
  <slot></slot>
185
177
  </div>
186
178
  </mock:shadow-root>
@@ -190,9 +182,7 @@ describe("swirl-menu", () => {
190
182
  <swirl-menu-item label="Item 3">
191
183
  <mock:shadow-root>
192
184
  <div class="menu-item">
193
- <swirl-action-list-item intent="default" label="Item 3">
194
- <slot name="avatar" slot="avatar"></slot>
195
- </swirl-action-list-item>
185
+ <swirl-action-list-item intent="default" label="Item 3"></swirl-action-list-item>
196
186
  <slot></slot>
197
187
  </div>
198
188
  </mock:shadow-root>
@@ -52,6 +52,7 @@ export class SwirlMenuItem {
52
52
  this.label = undefined;
53
53
  this.suffix = undefined;
54
54
  this.value = undefined;
55
+ this.hasAvatar = false;
55
56
  this.parentMenu = undefined;
56
57
  this.subMenu = undefined;
57
58
  }
@@ -59,6 +60,7 @@ export class SwirlMenuItem {
59
60
  this.parentMenu = closestPassShadow(this.el, "swirl-menu");
60
61
  this.rootMenu = parentsPassShadow(this.el, "swirl-menu").pop();
61
62
  this.subMenu = this.el.querySelector("swirl-menu");
63
+ this.updateAvatarState();
62
64
  }
63
65
  watchExpanded() {
64
66
  this.updateActionListItemProps();
@@ -93,23 +95,30 @@ export class SwirlMenuItem {
93
95
  ? '<swirl-icon-chevron-right size="16"></swirl-icon-chevron-right>'
94
96
  : undefined;
95
97
  }
98
+ updateAvatarState() {
99
+ const avatarContainer = this.el.querySelector('[slot="avatar"]');
100
+ const hasAvatar = Boolean(avatarContainer);
101
+ if (hasAvatar !== this.hasAvatar) {
102
+ this.hasAvatar = hasAvatar;
103
+ }
104
+ }
96
105
  renderActionListItem() {
97
106
  const badge = Boolean(this.subMenu?.value)
98
107
  ? Array.from(this.subMenu?.querySelectorAll("swirl-menu-item") || []).find((item) => item.value === this.subMenu?.value)?.label
99
108
  : undefined;
100
- return (h("swirl-action-list-item", { badge: badge, description: this.description, disabled: this.disabled, icon: this.icon, iconBadge: this.iconBadge, intent: this.intent, label: this.label, onClick: this.onActionListItemClick, ref: (el) => (this.actionListItem = el), suffix: this.suffix }, h("slot", { slot: "avatar", name: "avatar" })));
109
+ return (h("swirl-action-list-item", { badge: badge, description: this.description, disabled: this.disabled, icon: this.icon, iconBadge: this.iconBadge, intent: this.intent, label: this.label, onClick: this.onActionListItemClick, ref: (el) => (this.actionListItem = el), suffix: this.suffix }, this.hasAvatar && h("slot", { name: "avatar", slot: "avatar" })));
101
110
  }
102
111
  renderOptionListItem() {
103
112
  const selected = this.parentMenu?.value === this.value;
104
- return (h("swirl-option-list-item", { disabled: this.disabled, icon: this.icon, iconBadge: this.iconBadge, label: this.label, onClick: this.onOptionListItemClick, onKeyDown: this.onOptionListItemKeyDown, onKeyUp: this.onOptionListItemKeyUp, ref: (el) => (this.optionListItem = el), selected: selected, swirlAriaRole: "menuitemradio", value: this.value }, h("slot", { slot: "avatar", name: "avatar" })));
113
+ return (h("swirl-option-list-item", { disabled: this.disabled, icon: this.icon, iconBadge: this.iconBadge, label: this.label, onClick: this.onOptionListItemClick, onKeyDown: this.onOptionListItemKeyDown, onKeyUp: this.onOptionListItemKeyUp, ref: (el) => (this.optionListItem = el), selected: selected, swirlAriaRole: "menuitemradio", value: this.value }, this.hasAvatar && h("slot", { name: "avatar", slot: "avatar" })));
105
114
  }
106
115
  render() {
107
116
  const className = classnames("menu-item", {
108
117
  "menu-item--expanded": this.expanded,
109
118
  });
110
- return (h(Host, { key: 'c3aee9e9e8c3eeec2287796fcbc2bc403e717d83' }, h("div", { key: '9624ee9775abc19991e6c2f61d35c09233d176dc', class: className }, this.parentMenu?.variant === "selection"
119
+ return (h(Host, { key: 'ec53da29dd7ec22ecbb14eae3cfd7212e666325e' }, h("div", { key: 'a639071a7c8fb60cec52c673bc1b0fe9518100b9', class: className }, this.parentMenu?.variant === "selection"
111
120
  ? this.renderOptionListItem()
112
- : this.renderActionListItem(), h("slot", { key: 'd1e331b8f5556280305ae6512daeaf7130efb752', onSlotchange: this.onSlotChange }))));
121
+ : this.renderActionListItem(), h("slot", { key: '02935d7a4997aaa9c8dece8f66f21a42508f8294', onSlotchange: this.onSlotChange }))));
113
122
  }
114
123
  static get is() { return "swirl-menu-item"; }
115
124
  static get encapsulation() { return "shadow"; }
@@ -289,6 +298,7 @@ export class SwirlMenuItem {
289
298
  }
290
299
  static get states() {
291
300
  return {
301
+ "hasAvatar": {},
292
302
  "parentMenu": {},
293
303
  "subMenu": {}
294
304
  };
@@ -27,9 +27,7 @@ describe("swirl-menu-item", () => {
27
27
  <swirl-menu-item label="Item">
28
28
  <mock:shadow-root>
29
29
  <div class="menu-item">
30
- <swirl-action-list-item intent="default" label="Item">
31
- <slot name="avatar" slot="avatar"></slot>
32
- </swirl-action-list-item>
30
+ <swirl-action-list-item intent="default" label="Item"></swirl-action-list-item>
33
31
  <slot></slot>
34
32
  </div>
35
33
  </mock:shadow-root>
@@ -42,9 +40,7 @@ describe("swirl-menu-item", () => {
42
40
  html: `
43
41
  <swirl-popover label="Menu">
44
42
  <swirl-menu label="Menu" variant="selection">
45
- <swirl-menu-item label="Item" value="Value">
46
- <slot name="avatar" slot="avatar"></slot>
47
- </swirl-menu-item>
43
+ <swirl-menu-item label="Item" value="Value"></swirl-menu-item>
48
44
  </swirl-menu>
49
45
  </swirl-popover>`,
50
46
  });
@@ -52,13 +48,10 @@ describe("swirl-menu-item", () => {
52
48
  <swirl-menu-item label="Item" value="Value">
53
49
  <mock:shadow-root>
54
50
  <div class="menu-item">
55
- <swirl-option-list-item label="Item" swirlariarole="menuitemradio" value="Value">
56
- <slot name="avatar" slot="avatar"></slot>
57
- </swirl-option-list-item>
51
+ <swirl-option-list-item label="Item" swirlariarole="menuitemradio" value="Value"></swirl-option-list-item>
58
52
  <slot></slot>
59
53
  </div>
60
54
  </mock:shadow-root>
61
- <slot name="avatar" slot="avatar"></slot>
62
55
  </swirl-menu-item>
63
56
  `);
64
57
  });
@@ -270,6 +270,10 @@
270
270
  .modal--scrolled.modal--has-header-tools .modal__header-tools {
271
271
  border-bottom-color: var(--s-border-default);
272
272
  }
273
+
274
+ .modal--scrolled .modal__custom-header {
275
+ border-bottom-color: var(--s-border-default);
276
+ }
273
277
  }
274
278
 
275
279
  .modal__backdrop {
@@ -373,6 +377,13 @@
373
377
  border-bottom: var(--s-border-width-default) solid var(--s-border-default);
374
378
  }
375
379
 
380
+ @media (min-width: 768px) {
381
+
382
+ .modal__custom-header {
383
+ border-bottom-color: transparent
384
+ }
385
+ }
386
+
376
387
  .modal__heading {
377
388
  overflow: hidden;
378
389
  }
@@ -12,9 +12,19 @@
12
12
  display: flex;
13
13
  width: 100%;
14
14
  justify-content: flex-start;
15
- border-bottom: var(--swirl-tab-bar-border-width) solid var(--s-border-default);
15
+ overflow-x: auto;
16
+ scrollbar-width: none;
16
17
  }
17
18
 
19
+ .tab-bar.tab-bar--variant-default {
20
+ border-bottom: var(--swirl-tab-bar-border-width) solid
21
+ var(--s-border-default);
22
+ }
23
+
24
+ .tab-bar.tab-bar--variant-pill {
25
+ gap: var(--s-space-8);
26
+ }
27
+
18
28
  .tab-bar--justify-evenly > * {
19
29
  flex: 1;
20
30
  }
@@ -22,13 +32,12 @@
22
32
  .tab-bar__tab {
23
33
  position: relative;
24
34
  display: flex;
25
- min-width: 0;
35
+ min-width: -webkit-fit-content;
36
+ min-width: -moz-fit-content;
37
+ min-width: fit-content;
26
38
  margin: 0;
27
- padding: var(--s-space-4) var(--s-space-8);
28
39
  align-items: center;
29
40
  border: none;
30
- color: var(--s-interactive-neutral-default);
31
- background-color: transparent;
32
41
  font: inherit;
33
42
  font-weight: var(--s-font-weight-medium);
34
43
  line-height: var(--s-line-height-lg);
@@ -36,28 +45,77 @@
36
45
  justify-content: center;
37
46
  }
38
47
 
39
- .tab-bar__tab:focus {
40
- outline: none;
48
+ .tab-bar__tab.tab-bar__tab--variant-default {
49
+ background-color: transparent;
50
+ color: var(--s-interactive-neutral-default);
51
+ padding: var(--s-space-4) var(--s-space-8);
41
52
  }
42
53
 
43
- .tab-bar__tab:focus-visible .tab-bar__tab-label {
44
- border-radius: var(--s-border-radius-s);
45
- box-shadow: inset 0 0 0 0.125rem var(--s-focus-default);
54
+ .tab-bar__tab.tab-bar__tab--variant-default:not(.tab-bar__tab--active):hover:after {
55
+ position: absolute;
56
+ bottom: 0;
57
+ left: 50%;
58
+ width: calc(100% - var(--s-space-8));
59
+ height: 0.1875rem;
60
+ border-radius: 0.125rem;
61
+ background-color: var(--s-border-default);
62
+ content: "";
63
+ transform: translateX(-50%);
64
+ pointer-events: none;
65
+ }
66
+
67
+ .tab-bar__tab.tab-bar__tab--variant-default.tab-bar__tab--active {
68
+ color: var(--s-text-highlight);
46
69
  }
47
70
 
48
- .tab-bar__tab:not(.tab-bar__tab--active):hover:after {
71
+ .tab-bar__tab.tab-bar__tab--variant-default.tab-bar__tab--active:after {
49
72
  position: absolute;
50
73
  bottom: 0;
51
74
  left: 50%;
52
75
  width: calc(100% - var(--s-space-8));
53
76
  height: 0.1875rem;
54
77
  border-radius: 0.125rem;
55
- background-color: var(--s-border-default);
78
+ background-color: var(--s-border-highlight);
56
79
  content: "";
57
80
  transform: translateX(-50%);
58
81
  pointer-events: none;
59
82
  }
60
83
 
84
+ .tab-bar__tab.tab-bar__tab--variant-default:focus {
85
+ outline: none;
86
+ }
87
+
88
+ .tab-bar__tab.tab-bar__tab--variant-default:focus-visible .tab-bar__tab-label {
89
+ border-radius: var(--s-border-radius-s);
90
+ box-shadow: inset 0 0 0 0.125rem var(--s-focus-default);
91
+ }
92
+
93
+ .tab-bar__tab.tab-bar__tab--variant-pill {
94
+ border-radius: var(--s-border-radius-full-round);
95
+ background: var(--s-action-neutral-default);
96
+ color: var(--s-text-default);
97
+ padding: var(--s-space-8) var(--s-space-16);
98
+ gap: var(--s-space-8);
99
+ }
100
+
101
+ .tab-bar__tab.tab-bar__tab--variant-pill:hover {
102
+ background: var(--s-action-neutral-hovered);
103
+ }
104
+
105
+ .tab-bar__tab.tab-bar__tab--variant-pill:active {
106
+ background: var(--s-action-neutral-pressed);
107
+ }
108
+
109
+ .tab-bar__tab.tab-bar__tab--variant-pill.tab-bar__tab--active {
110
+ background: var(--s-action-primary-default);
111
+ color: var(--s-text-on-action-primary);
112
+ }
113
+
114
+ .tab-bar__tab.tab-bar__tab--variant-pill:focus-visible {
115
+ outline-color: var(--s-focus-default);
116
+ outline-offset: var(--s-space-2);
117
+ }
118
+
61
119
  @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
62
120
 
63
121
  .tab-bar__tab {
@@ -73,26 +131,10 @@
73
131
 
74
132
  .tab-bar__tab-label {
75
133
  display: inline-flex;
76
- overflow: hidden;
77
134
  padding: var(--s-space-8) var(--s-space-8);
78
135
  text-align: center;
79
- white-space: nowrap;
80
- text-overflow: ellipsis;
81
- }
82
-
83
- .tab-bar__tab--active {
84
- color: var(--s-text-highlight);
85
136
  }
86
137
 
87
- .tab-bar__tab--active:after {
88
- position: absolute;
89
- bottom: 0;
90
- left: 50%;
91
- width: calc(100% - var(--s-space-8));
92
- height: 0.1875rem;
93
- border-radius: 0.125rem;
94
- background-color: var(--s-border-highlight);
95
- content: "";
96
- transform: translateX(-50%);
97
- pointer-events: none;
138
+ .tab-bar__tab-label.tab-bar__tab-label--variant-pill {
139
+ padding: 0;
98
140
  }
@@ -1,26 +1,44 @@
1
- import { h, Host } from "@stencil/core";
1
+ import { h, Host, } from "@stencil/core";
2
2
  import classnames from "classnames";
3
+ import { getCircularArrayIndex } from "../../utils";
3
4
  export class SwirlTabBar {
4
5
  constructor() {
5
6
  this.onKeyDown = (event) => {
6
7
  if (event.code === "ArrowLeft") {
7
8
  event.preventDefault();
9
+ this.focusAdjacentTab(true);
8
10
  this.activatePreviousTab.emit();
9
11
  }
10
12
  else if (event.code === "ArrowRight") {
11
13
  event.preventDefault();
14
+ this.focusAdjacentTab(false);
12
15
  this.activateNextTab.emit();
13
16
  }
14
17
  };
15
18
  this.disableTabSemantics = undefined;
16
19
  this.label = undefined;
17
20
  this.justify = "start";
21
+ this.paddingBlockEnd = undefined;
22
+ this.paddingBlockStart = undefined;
18
23
  this.paddingInlineEnd = undefined;
19
24
  this.paddingInlineStart = undefined;
20
25
  this.tabs = [];
26
+ this.variant = "default";
27
+ }
28
+ focusAdjacentTab(previous) {
29
+ const tabs = this.getTabs();
30
+ const selectedTabIndex = tabs.findIndex((tab) => tab.ariaSelected === "true");
31
+ const nextIndex = getCircularArrayIndex(previous ? selectedTabIndex - 1 : selectedTabIndex + 1, tabs.length);
32
+ tabs[nextIndex].focus();
33
+ }
34
+ getTabs() {
35
+ return Array.from(this.el.querySelectorAll('[role="tab"]'));
21
36
  }
22
37
  render() {
23
- const className = classnames("tab-bar", `tab-bar--justify-${this.justify}`);
38
+ const className = classnames("tab-bar", `tab-bar--justify-${this.justify}`, {
39
+ "tab-bar--variant-pill": this.variant === "pill",
40
+ "tab-bar--variant-default": this.variant === "default",
41
+ });
24
42
  const styles = {
25
43
  paddingInlineEnd: Boolean(this.paddingInlineEnd)
26
44
  ? `var(--s-space-${this.paddingInlineEnd})`
@@ -28,10 +46,21 @@ export class SwirlTabBar {
28
46
  paddingInlineStart: Boolean(this.paddingInlineStart)
29
47
  ? `var(--s-space-${this.paddingInlineStart})`
30
48
  : undefined,
49
+ paddingBlockEnd: Boolean(this.paddingBlockEnd)
50
+ ? `var(--s-space-${this.paddingBlockEnd})`
51
+ : undefined,
52
+ paddingBlockStart: Boolean(this.paddingBlockStart)
53
+ ? `var(--s-space-${this.paddingBlockStart})`
54
+ : undefined,
31
55
  };
32
- return (h(Host, { key: 'd883f7af119dd81a09081301e1e48c9f65e4a822' }, h("div", { key: '016e1125ef12dac89655aee9cae6e7514ba42e67', "aria-label": this.label, class: className, onKeyDown: this.onKeyDown, role: this.disableTabSemantics ? undefined : "tablist", style: styles }, this.tabs.map((tab) => {
56
+ return (h(Host, { key: 'deb50eba4e47565ae6338a5af43b7a0a1054e6b1' }, h("div", { key: '75cc9b8e1ffbe76ff00165fb3428799fcd7ea2ac', "aria-label": this.label, class: className, onKeyDown: this.onKeyDown, role: this.disableTabSemantics ? undefined : "tablist", style: styles }, this.tabs.map((tab) => {
33
57
  const className = classnames("tab-bar__tab", {
34
58
  "tab-bar__tab--active": tab.active,
59
+ "tab-bar__tab--variant-pill": this.variant === "pill",
60
+ "tab-bar__tab--variant-default": this.variant === "default",
61
+ });
62
+ const labelClassName = classnames("tab-bar__tab-label", {
63
+ "tab-bar__tab-label--variant-pill": this.variant === "pill",
35
64
  });
36
65
  return (h("button", { "aria-controls": this.disableTabSemantics ? undefined : tab.id, "aria-selected": this.disableTabSemantics
37
66
  ? undefined
@@ -39,7 +68,7 @@ export class SwirlTabBar {
39
68
  ? "true"
40
69
  : "false", class: className, id: `tab-${tab.id}`, key: tab.id,
41
70
  // eslint-disable-next-line react/jsx-no-bind
42
- onClick: () => this.activateTab.emit(tab.id), role: this.disableTabSemantics ? undefined : "tab", tabIndex: this.disableTabSemantics ? undefined : tab.active ? 0 : -1, type: "button" }, tab.icon && (h("span", { class: "tab-bar__tab-icon", innerHTML: tab.icon })), h("span", { class: "tab-bar__tab-label" }, tab.label)));
71
+ onClick: () => this.activateTab.emit(tab.id), role: this.disableTabSemantics ? undefined : "tab", tabIndex: this.disableTabSemantics ? undefined : tab.active ? 0 : -1, type: "button" }, tab.icon && (h("span", { class: "tab-bar__tab-icon", innerHTML: tab.icon })), h("span", { class: labelClassName }, tab.label)));
43
72
  }))));
44
73
  }
45
74
  static get is() { return "swirl-tab-bar"; }
@@ -114,6 +143,52 @@ export class SwirlTabBar {
114
143
  "reflect": false,
115
144
  "defaultValue": "\"start\""
116
145
  },
146
+ "paddingBlockEnd": {
147
+ "type": "string",
148
+ "mutable": false,
149
+ "complexType": {
150
+ "original": "SwirlTabBarPadding",
151
+ "resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"4\" | \"8\"",
152
+ "references": {
153
+ "SwirlTabBarPadding": {
154
+ "location": "local",
155
+ "path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-tab-bar/swirl-tab-bar.tsx",
156
+ "id": "src/components/swirl-tab-bar/swirl-tab-bar.tsx::SwirlTabBarPadding"
157
+ }
158
+ }
159
+ },
160
+ "required": false,
161
+ "optional": true,
162
+ "docs": {
163
+ "tags": [],
164
+ "text": ""
165
+ },
166
+ "attribute": "padding-block-end",
167
+ "reflect": false
168
+ },
169
+ "paddingBlockStart": {
170
+ "type": "string",
171
+ "mutable": false,
172
+ "complexType": {
173
+ "original": "SwirlTabBarPadding",
174
+ "resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"4\" | \"8\"",
175
+ "references": {
176
+ "SwirlTabBarPadding": {
177
+ "location": "local",
178
+ "path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-tab-bar/swirl-tab-bar.tsx",
179
+ "id": "src/components/swirl-tab-bar/swirl-tab-bar.tsx::SwirlTabBarPadding"
180
+ }
181
+ }
182
+ },
183
+ "required": false,
184
+ "optional": true,
185
+ "docs": {
186
+ "tags": [],
187
+ "text": ""
188
+ },
189
+ "attribute": "padding-block-start",
190
+ "reflect": false
191
+ },
117
192
  "paddingInlineEnd": {
118
193
  "type": "string",
119
194
  "mutable": false,
@@ -181,6 +256,30 @@ export class SwirlTabBar {
181
256
  "text": ""
182
257
  },
183
258
  "defaultValue": "[]"
259
+ },
260
+ "variant": {
261
+ "type": "string",
262
+ "mutable": false,
263
+ "complexType": {
264
+ "original": "SwirlTabBarVariant",
265
+ "resolved": "\"default\" | \"pill\"",
266
+ "references": {
267
+ "SwirlTabBarVariant": {
268
+ "location": "local",
269
+ "path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-tab-bar/swirl-tab-bar.tsx",
270
+ "id": "src/components/swirl-tab-bar/swirl-tab-bar.tsx::SwirlTabBarVariant"
271
+ }
272
+ }
273
+ },
274
+ "required": false,
275
+ "optional": true,
276
+ "docs": {
277
+ "tags": [],
278
+ "text": ""
279
+ },
280
+ "attribute": "variant",
281
+ "reflect": false,
282
+ "defaultValue": "\"default\""
184
283
  }
185
284
  };
186
285
  }
@@ -232,4 +331,5 @@ export class SwirlTabBar {
232
331
  }
233
332
  }];
234
333
  }
334
+ static get elementRef() { return "el"; }
235
335
  }
@@ -26,18 +26,18 @@ describe("swirl-tab-bar", () => {
26
26
  await page.waitForChanges();
27
27
  expect(page.root).toEqualHtml(`
28
28
  <swirl-tab-bar label="Tabs">
29
- <div aria-label="Tabs" class="tab-bar tab-bar--justify-start" role="tablist">
30
- <button aria-controls="tab1" aria-selected="false" class="tab-bar__tab" id="tab-tab1" role="tab" tabindex="-1" type="button">
29
+ <div aria-label="Tabs" class="tab-bar tab-bar--justify-start tab-bar--variant-default" role="tablist">
30
+ <button aria-controls="tab1" aria-selected="false" class="tab-bar__tab tab-bar__tab--variant-default" id="tab-tab1" role="tab" tabindex="-1" type="button">
31
31
  <span class="tab-bar__tab-label">
32
32
  Tab #1
33
33
  </span>
34
34
  </button>
35
- <button aria-controls="tab2" aria-selected="true" class="tab-bar__tab tab-bar__tab--active" id="tab-tab2" role="tab" tabindex="0" type="button">
35
+ <button aria-controls="tab2" aria-selected="true" class="tab-bar__tab tab-bar__tab--variant-default tab-bar__tab--active" id="tab-tab2" role="tab" tabindex="0" type="button">
36
36
  <span class="tab-bar__tab-label">
37
37
  Tab #2
38
38
  </span>
39
39
  </button>
40
- <button aria-controls="tab3" aria-selected="false" class="tab-bar__tab" id="tab-tab3" role="tab" tabindex="-1" type="button">
40
+ <button aria-controls="tab3" aria-selected="false" class="tab-bar__tab tab-bar__tab--variant-default" id="tab-tab3" role="tab" tabindex="-1" type="button">
41
41
  <span class="tab-bar__tab-label">
42
42
  Tab #3
43
43
  </span>
@@ -1,4 +1,5 @@
1
1
  import { h, Host, } from "@stencil/core";
2
+ import { getCircularArrayIndex } from "../../utils";
2
3
  export class SwirlTabs {
3
4
  constructor() {
4
5
  this.tabs = [];
@@ -14,8 +15,11 @@ export class SwirlTabs {
14
15
  this.initialTab = undefined;
15
16
  this.label = undefined;
16
17
  this.justifyTabBar = undefined;
18
+ this.tabBarPaddingBlockEnd = undefined;
19
+ this.tabBarPaddingBlockStart = undefined;
17
20
  this.tabBarPaddingInlineEnd = undefined;
18
21
  this.tabBarPaddingInlineStart = undefined;
22
+ this.tabBarVariant = "default";
19
23
  this.activeTab = undefined;
20
24
  this.tabBarTabs = [];
21
25
  }
@@ -43,7 +47,7 @@ export class SwirlTabs {
43
47
  }
44
48
  activateNextTab() {
45
49
  const currentIndex = this.tabs.findIndex((tab) => tab.tabId === this.activeTab);
46
- const nextIndex = Math.min(this.tabs.length - 1, currentIndex + 1);
50
+ const nextIndex = getCircularArrayIndex(currentIndex + 1, this.tabs.length);
47
51
  this.activateTab(this.tabs[nextIndex].tabId);
48
52
  requestAnimationFrame(() => {
49
53
  this.el.querySelector(".tabs__tab--active")?.focus();
@@ -51,7 +55,7 @@ export class SwirlTabs {
51
55
  }
52
56
  activatePreviousTab() {
53
57
  const currentIndex = this.tabs.findIndex((tab) => tab.tabId === this.activeTab);
54
- const previousIndex = Math.max(0, currentIndex - 1);
58
+ const previousIndex = getCircularArrayIndex(currentIndex - 1, this.tabs.length);
55
59
  this.activateTab(this.tabs[previousIndex].tabId);
56
60
  requestAnimationFrame(() => {
57
61
  this.el.querySelector(".tabs__tab--active")?.focus();
@@ -74,7 +78,7 @@ export class SwirlTabs {
74
78
  }));
75
79
  }
76
80
  render() {
77
- return (h(Host, { key: '44caea9a926dc297cd030eb005fc3f6123a8d505' }, h("div", { key: '34a91794a16c5bf3f274edafd9a9cba4d4784ce0', class: "tabs" }, h("swirl-tab-bar", { key: '7d7351ea490ba3cd2d8863da2ce302bd4761fc6f', label: this.label, onActivateNextTab: this.onActivateNextTab, onActivatePreviousTab: this.onActivatePreviousTab, onActivateTab: this.onActivateTab, tabs: this.tabBarTabs, justify: this.justifyTabBar, paddingInlineEnd: this.tabBarPaddingInlineEnd, paddingInlineStart: this.tabBarPaddingInlineStart })), h("slot", { key: '35a4ab2fe39e56da291bfe5e3b624ffed3ce6220' })));
81
+ return (h(Host, { key: '1ac2dfa2ae746878117dd5a9d084c4f01b3bfea8' }, h("div", { key: '01e1a9a7f5fd4801af2bd54750f3e7954a6fff50', class: "tabs" }, h("swirl-tab-bar", { key: '9435cfed3336d04ae4f531992c26e1fbd54c4520', label: this.label, onActivateNextTab: this.onActivateNextTab, onActivatePreviousTab: this.onActivatePreviousTab, onActivateTab: this.onActivateTab, tabs: this.tabBarTabs, justify: this.justifyTabBar, paddingBlockEnd: this.tabBarPaddingBlockEnd, paddingBlockStart: this.tabBarPaddingBlockStart, paddingInlineEnd: this.tabBarPaddingInlineEnd, paddingInlineStart: this.tabBarPaddingInlineStart, variant: this.tabBarVariant })), h("slot", { key: '649844c197a13ebc8cd4a7925acb1cf48d728404' })));
78
82
  }
79
83
  static get is() { return "swirl-tabs"; }
80
84
  static get encapsulation() { return "scoped"; }
@@ -147,6 +151,52 @@ export class SwirlTabs {
147
151
  "attribute": "justify-tab-bar",
148
152
  "reflect": false
149
153
  },
154
+ "tabBarPaddingBlockEnd": {
155
+ "type": "string",
156
+ "mutable": false,
157
+ "complexType": {
158
+ "original": "SwirlTabBarPadding",
159
+ "resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"4\" | \"8\"",
160
+ "references": {
161
+ "SwirlTabBarPadding": {
162
+ "location": "import",
163
+ "path": "../swirl-tab-bar/swirl-tab-bar",
164
+ "id": "src/components/swirl-tab-bar/swirl-tab-bar.tsx::SwirlTabBarPadding"
165
+ }
166
+ }
167
+ },
168
+ "required": false,
169
+ "optional": true,
170
+ "docs": {
171
+ "tags": [],
172
+ "text": ""
173
+ },
174
+ "attribute": "tab-bar-padding-block-end",
175
+ "reflect": false
176
+ },
177
+ "tabBarPaddingBlockStart": {
178
+ "type": "string",
179
+ "mutable": false,
180
+ "complexType": {
181
+ "original": "SwirlTabBarPadding",
182
+ "resolved": "\"0\" | \"12\" | \"16\" | \"2\" | \"20\" | \"24\" | \"4\" | \"8\"",
183
+ "references": {
184
+ "SwirlTabBarPadding": {
185
+ "location": "import",
186
+ "path": "../swirl-tab-bar/swirl-tab-bar",
187
+ "id": "src/components/swirl-tab-bar/swirl-tab-bar.tsx::SwirlTabBarPadding"
188
+ }
189
+ }
190
+ },
191
+ "required": false,
192
+ "optional": true,
193
+ "docs": {
194
+ "tags": [],
195
+ "text": ""
196
+ },
197
+ "attribute": "tab-bar-padding-block-start",
198
+ "reflect": false
199
+ },
150
200
  "tabBarPaddingInlineEnd": {
151
201
  "type": "string",
152
202
  "mutable": false,
@@ -192,6 +242,30 @@ export class SwirlTabs {
192
242
  },
193
243
  "attribute": "tab-bar-padding-inline-start",
194
244
  "reflect": false
245
+ },
246
+ "tabBarVariant": {
247
+ "type": "string",
248
+ "mutable": false,
249
+ "complexType": {
250
+ "original": "SwirlTabBarVariant",
251
+ "resolved": "\"default\" | \"pill\"",
252
+ "references": {
253
+ "SwirlTabBarVariant": {
254
+ "location": "import",
255
+ "path": "../swirl-tab-bar/swirl-tab-bar",
256
+ "id": "src/components/swirl-tab-bar/swirl-tab-bar.tsx::SwirlTabBarVariant"
257
+ }
258
+ }
259
+ },
260
+ "required": false,
261
+ "optional": true,
262
+ "docs": {
263
+ "tags": [],
264
+ "text": ""
265
+ },
266
+ "attribute": "tab-bar-variant",
267
+ "reflect": false,
268
+ "defaultValue": "\"default\""
195
269
  }
196
270
  };
197
271
  }
@@ -17,7 +17,7 @@ describe("swirl-tabs", () => {
17
17
  expect(page.root).toEqualHtml(`
18
18
  <swirl-tabs label="Tabs">
19
19
  <div class="tabs">
20
- <swirl-tab-bar label="Tabs"></swirl-tab-bar>
20
+ <swirl-tab-bar label="Tabs" variant="default"></swirl-tab-bar>
21
21
  </div>
22
22
  <swirl-tab aria-labelledby="tab-tab-1" class="tab tab--active" id="tab-1" label="Tab #1" role="tabpanel" tab-id="tab-1" tabindex="0" style="padding: var(--s-space-8);">
23
23
  <mock:shadow-root>