@getflip/swirl-components 0.81.3 → 0.82.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 (264) hide show
  1. package/components.json +29 -3
  2. package/dist/cjs/file-manager.cjs.entry.js +2 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/swirl-action-list_3.cjs.entry.js +8 -12
  5. package/dist/cjs/swirl-app-bar.cjs.entry.js +1 -2
  6. package/dist/cjs/swirl-app-layout_7.cjs.entry.js +10 -15
  7. package/dist/cjs/swirl-autocomplete.cjs.entry.js +4 -6
  8. package/dist/cjs/swirl-avatar-group.cjs.entry.js +1 -1
  9. package/dist/cjs/swirl-banner.cjs.entry.js +5 -7
  10. package/dist/cjs/swirl-button.cjs.entry.js +2 -3
  11. package/dist/cjs/swirl-carousel.cjs.entry.js +3 -4
  12. package/dist/cjs/swirl-chip.cjs.entry.js +2 -3
  13. package/dist/cjs/swirl-components.cjs.js +1 -1
  14. package/dist/cjs/swirl-console-layout.cjs.entry.js +2 -4
  15. package/dist/cjs/swirl-date-input.cjs.entry.js +14 -7
  16. package/dist/cjs/swirl-dialog.cjs.entry.js +4 -5
  17. package/dist/cjs/swirl-file-viewer_7.cjs.entry.js +13 -20
  18. package/dist/cjs/swirl-form-control.cjs.entry.js +1 -2
  19. package/dist/cjs/swirl-icon-check-small_3.cjs.entry.js +3 -5
  20. package/dist/cjs/swirl-icon-error_3.cjs.entry.js +2 -3
  21. package/dist/cjs/swirl-inline-status.cjs.entry.js +1 -2
  22. package/dist/cjs/swirl-lightbox.cjs.entry.js +8 -16
  23. package/dist/cjs/swirl-menu-item.cjs.entry.js +4 -7
  24. package/dist/cjs/swirl-menu.cjs.entry.js +6 -8
  25. package/dist/cjs/swirl-modal.cjs.entry.js +15 -6
  26. package/dist/cjs/swirl-option-list.cjs.entry.js +5 -8
  27. package/dist/cjs/swirl-pdf-reader.cjs.entry.js +3 -5
  28. package/dist/cjs/swirl-popover_2.cjs.entry.js +9 -14
  29. package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +2 -3
  30. package/dist/cjs/swirl-search.cjs.entry.js +8 -3
  31. package/dist/cjs/swirl-select.cjs.entry.js +9 -7
  32. package/dist/cjs/swirl-shell-layout.cjs.entry.js +2 -3
  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 -2
  36. package/dist/cjs/swirl-tabs.cjs.entry.js +2 -4
  37. package/dist/cjs/swirl-tag.cjs.entry.js +1 -2
  38. package/dist/cjs/swirl-text-input.cjs.entry.js +8 -4
  39. package/dist/cjs/swirl-theme-provider.cjs.entry.js +15 -5
  40. package/dist/cjs/swirl-time-input.cjs.entry.js +10 -6
  41. package/dist/cjs/swirl-toast-provider.cjs.entry.js +8 -3
  42. package/dist/cjs/swirl-toast.cjs.entry.js +4 -6
  43. package/dist/cjs/swirl-tooltip.cjs.entry.js +6 -8
  44. package/dist/collection/assets/pdfjs/pdf.worker.min.js +0 -22
  45. package/dist/collection/components/swirl-action-list/swirl-action-list.js +3 -5
  46. package/dist/collection/components/swirl-action-list-item/swirl-action-list-item.js +5 -7
  47. package/dist/collection/components/swirl-app-bar/swirl-app-bar.js +1 -2
  48. package/dist/collection/components/swirl-app-layout/swirl-app-layout.js +1 -2
  49. package/dist/collection/components/swirl-autocomplete/swirl-autocomplete.js +4 -6
  50. package/dist/collection/components/swirl-avatar-group/swirl-avatar-group.js +1 -1
  51. package/dist/collection/components/swirl-banner/swirl-banner.js +5 -7
  52. package/dist/collection/components/swirl-button/swirl-button.js +2 -3
  53. package/dist/collection/components/swirl-carousel/swirl-carousel.js +3 -4
  54. package/dist/collection/components/swirl-chip/swirl-chip.js +2 -3
  55. package/dist/collection/components/swirl-console-layout/swirl-console-layout.js +2 -4
  56. package/dist/collection/components/swirl-date-input/swirl-date-input.js +14 -7
  57. package/dist/collection/components/swirl-dialog/swirl-dialog.js +4 -5
  58. package/dist/collection/components/swirl-file-viewer/viewers/swirl-file-viewer-csv/swirl-file-viewer-csv.js +2 -4
  59. package/dist/collection/components/swirl-file-viewer/viewers/swirl-file-viewer-pdf/swirl-file-viewer-pdf.js +11 -16
  60. package/dist/collection/components/swirl-form-control/swirl-form-control.js +1 -2
  61. package/dist/collection/components/swirl-form-control/swirl-form-control.stories.js +28 -7
  62. package/dist/collection/components/swirl-inline-error/swirl-inline-error.js +2 -3
  63. package/dist/collection/components/swirl-inline-status/swirl-inline-status.js +1 -2
  64. package/dist/collection/components/swirl-lightbox/swirl-lightbox.js +8 -16
  65. package/dist/collection/components/swirl-menu/swirl-menu.js +6 -8
  66. package/dist/collection/components/swirl-menu-item/swirl-menu-item.js +4 -7
  67. package/dist/collection/components/swirl-modal/swirl-modal.js +53 -9
  68. package/dist/collection/components/swirl-modal/swirl-modal.stories.js +1 -1
  69. package/dist/collection/components/swirl-option-list/swirl-option-list.js +5 -8
  70. package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.js +3 -5
  71. package/dist/collection/components/swirl-pdf-reader/swirl-pdf-reader.js +3 -5
  72. package/dist/collection/components/swirl-popover/swirl-popover.js +8 -12
  73. package/dist/collection/components/swirl-popover/swirl-popover.stories.js +1 -1
  74. package/dist/collection/components/swirl-popover-trigger/swirl-popover-trigger.js +1 -2
  75. package/dist/collection/components/swirl-resource-list/swirl-resource-list.js +6 -8
  76. package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js +2 -3
  77. package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +3 -5
  78. package/dist/collection/components/swirl-search/swirl-search.js +8 -3
  79. package/dist/collection/components/swirl-select/swirl-select.js +9 -7
  80. package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.js +2 -3
  81. package/dist/collection/components/swirl-table/swirl-table.js +1 -2
  82. package/dist/collection/components/swirl-table-column/swirl-table-column.js +1 -1
  83. package/dist/collection/components/swirl-table-row/swirl-table-row.js +1 -1
  84. package/dist/collection/components/swirl-tabs/swirl-tabs.js +2 -4
  85. package/dist/collection/components/swirl-tag/swirl-tag.js +1 -2
  86. package/dist/collection/components/swirl-text-input/swirl-text-input.js +8 -4
  87. package/dist/collection/components/swirl-text-input/swirl-text-input.spec.js +1 -4
  88. package/dist/collection/components/swirl-theme-provider/swirl-theme-provider.js +15 -5
  89. package/dist/collection/components/swirl-time-input/swirl-time-input.js +10 -6
  90. package/dist/collection/components/swirl-toast/swirl-toast.js +4 -6
  91. package/dist/collection/components/swirl-toast-provider/swirl-toast-provider.js +8 -3
  92. package/dist/collection/components/swirl-tooltip/swirl-tooltip.js +6 -8
  93. package/dist/collection/prototypes/file-manager/file-manager.js +2 -4
  94. package/dist/components/assets/pdfjs/pdf.worker.min.js +0 -22
  95. package/dist/components/file-manager.js +2 -4
  96. package/dist/components/swirl-action-list-item2.js +5 -7
  97. package/dist/components/swirl-action-list2.js +3 -5
  98. package/dist/components/swirl-app-bar.js +1 -2
  99. package/dist/components/swirl-app-layout2.js +1 -2
  100. package/dist/components/swirl-autocomplete.js +4 -6
  101. package/dist/components/swirl-avatar-group.js +1 -1
  102. package/dist/components/swirl-banner.js +5 -7
  103. package/dist/components/swirl-button2.js +2 -3
  104. package/dist/components/swirl-carousel.js +3 -4
  105. package/dist/components/swirl-chip.js +2 -3
  106. package/dist/components/swirl-console-layout.js +2 -4
  107. package/dist/components/swirl-date-input.js +14 -7
  108. package/dist/components/swirl-dialog.js +4 -5
  109. package/dist/components/swirl-file-viewer-csv2.js +2 -4
  110. package/dist/components/swirl-file-viewer-pdf2.js +11 -16
  111. package/dist/components/swirl-form-control.js +1 -2
  112. package/dist/components/swirl-inline-error2.js +2 -3
  113. package/dist/components/swirl-inline-status.js +1 -2
  114. package/dist/components/swirl-lightbox.js +8 -16
  115. package/dist/components/swirl-menu-item.js +4 -7
  116. package/dist/components/swirl-menu.js +6 -8
  117. package/dist/components/swirl-modal.js +16 -6
  118. package/dist/components/swirl-option-list-item2.js +3 -5
  119. package/dist/components/swirl-option-list2.js +5 -8
  120. package/dist/components/swirl-pdf-reader.js +3 -5
  121. package/dist/components/swirl-popover-trigger2.js +1 -2
  122. package/dist/components/swirl-popover2.js +8 -12
  123. package/dist/components/swirl-resource-list-file-item.js +2 -3
  124. package/dist/components/swirl-resource-list-item2.js +3 -5
  125. package/dist/components/swirl-resource-list2.js +6 -8
  126. package/dist/components/swirl-search.js +8 -3
  127. package/dist/components/swirl-select.js +9 -7
  128. package/dist/components/swirl-shell-layout.js +2 -3
  129. package/dist/components/swirl-table-column.js +1 -1
  130. package/dist/components/swirl-table-row.js +1 -1
  131. package/dist/components/swirl-table.js +1 -2
  132. package/dist/components/swirl-tabs.js +2 -4
  133. package/dist/components/swirl-tag2.js +1 -2
  134. package/dist/components/swirl-text-input2.js +8 -4
  135. package/dist/components/swirl-theme-provider.js +15 -5
  136. package/dist/components/swirl-time-input.js +10 -6
  137. package/dist/components/swirl-toast-provider.js +8 -3
  138. package/dist/components/swirl-toast2.js +4 -6
  139. package/dist/components/swirl-tooltip.js +6 -8
  140. package/dist/esm/file-manager.entry.js +2 -4
  141. package/dist/esm/loader.js +1 -1
  142. package/dist/esm/swirl-action-list_3.entry.js +8 -12
  143. package/dist/esm/swirl-app-bar.entry.js +1 -2
  144. package/dist/esm/swirl-app-layout_7.entry.js +10 -15
  145. package/dist/esm/swirl-autocomplete.entry.js +4 -6
  146. package/dist/esm/swirl-avatar-group.entry.js +1 -1
  147. package/dist/esm/swirl-banner.entry.js +5 -7
  148. package/dist/esm/swirl-button.entry.js +2 -3
  149. package/dist/esm/swirl-carousel.entry.js +3 -4
  150. package/dist/esm/swirl-chip.entry.js +2 -3
  151. package/dist/esm/swirl-components.js +1 -1
  152. package/dist/esm/swirl-console-layout.entry.js +2 -4
  153. package/dist/esm/swirl-date-input.entry.js +14 -7
  154. package/dist/esm/swirl-dialog.entry.js +4 -5
  155. package/dist/esm/swirl-file-viewer_7.entry.js +13 -20
  156. package/dist/esm/swirl-form-control.entry.js +1 -2
  157. package/dist/esm/swirl-icon-check-small_3.entry.js +3 -5
  158. package/dist/esm/swirl-icon-error_3.entry.js +2 -3
  159. package/dist/esm/swirl-inline-status.entry.js +1 -2
  160. package/dist/esm/swirl-lightbox.entry.js +8 -16
  161. package/dist/esm/swirl-menu-item.entry.js +4 -7
  162. package/dist/esm/swirl-menu.entry.js +6 -8
  163. package/dist/esm/swirl-modal.entry.js +15 -6
  164. package/dist/esm/swirl-option-list.entry.js +5 -8
  165. package/dist/esm/swirl-pdf-reader.entry.js +3 -5
  166. package/dist/esm/swirl-popover_2.entry.js +9 -14
  167. package/dist/esm/swirl-resource-list-file-item.entry.js +2 -3
  168. package/dist/esm/swirl-search.entry.js +8 -3
  169. package/dist/esm/swirl-select.entry.js +9 -7
  170. package/dist/esm/swirl-shell-layout.entry.js +2 -3
  171. package/dist/esm/swirl-table-column.entry.js +1 -1
  172. package/dist/esm/swirl-table-row.entry.js +1 -1
  173. package/dist/esm/swirl-table.entry.js +1 -2
  174. package/dist/esm/swirl-tabs.entry.js +2 -4
  175. package/dist/esm/swirl-tag.entry.js +1 -2
  176. package/dist/esm/swirl-text-input.entry.js +8 -4
  177. package/dist/esm/swirl-theme-provider.entry.js +15 -5
  178. package/dist/esm/swirl-time-input.entry.js +10 -6
  179. package/dist/esm/swirl-toast-provider.entry.js +8 -3
  180. package/dist/esm/swirl-toast.entry.js +4 -6
  181. package/dist/esm/swirl-tooltip.entry.js +6 -8
  182. package/dist/swirl-components/p-07957b9a.entry.js +1 -0
  183. package/dist/swirl-components/p-1a05f16b.entry.js +1 -0
  184. package/dist/swirl-components/{p-1d92561c.entry.js → p-1a4c6557.entry.js} +1 -1
  185. package/dist/swirl-components/p-1f3c35bd.entry.js +1 -0
  186. package/dist/swirl-components/p-3da6d23a.entry.js +1 -0
  187. package/dist/swirl-components/{p-ab7f6735.entry.js → p-44196449.entry.js} +1 -1
  188. package/dist/swirl-components/p-4dafdcee.entry.js +1 -0
  189. package/dist/swirl-components/p-56fa872b.entry.js +1 -0
  190. package/dist/swirl-components/p-5fcf5a79.entry.js +1 -0
  191. package/dist/swirl-components/p-62f1aaae.entry.js +1 -0
  192. package/dist/swirl-components/p-684170ee.entry.js +1 -0
  193. package/dist/swirl-components/p-6f178b75.entry.js +1 -0
  194. package/dist/swirl-components/p-723f12cd.entry.js +1 -0
  195. package/dist/swirl-components/{p-bd0ba465.entry.js → p-7c9311c4.entry.js} +2 -2
  196. package/dist/swirl-components/p-7e90107b.entry.js +1 -0
  197. package/dist/swirl-components/p-81067ba3.entry.js +1 -0
  198. package/dist/swirl-components/p-8e5e6c16.entry.js +1 -0
  199. package/dist/swirl-components/p-902fc533.entry.js +1 -0
  200. package/dist/swirl-components/p-9c5e2b99.entry.js +1 -0
  201. package/dist/swirl-components/p-9c70b38e.entry.js +1 -0
  202. package/dist/swirl-components/p-a3e6a921.entry.js +1 -0
  203. package/dist/swirl-components/p-a8dc02be.entry.js +1 -0
  204. package/dist/swirl-components/p-baf3c630.entry.js +1 -0
  205. package/dist/swirl-components/p-bf317ae5.entry.js +1 -0
  206. package/dist/swirl-components/p-c3d23855.entry.js +1 -0
  207. package/dist/swirl-components/p-c4c4d5c4.entry.js +1 -0
  208. package/dist/swirl-components/p-ce1cd2e1.entry.js +1 -0
  209. package/dist/swirl-components/p-d14846f2.entry.js +1 -0
  210. package/dist/swirl-components/p-d1edd738.entry.js +10 -0
  211. package/dist/swirl-components/p-d3c3cb10.entry.js +1 -0
  212. package/dist/swirl-components/p-d3e39e06.entry.js +1 -0
  213. package/dist/swirl-components/p-d403f973.entry.js +1 -0
  214. package/dist/swirl-components/p-e4819964.entry.js +1 -0
  215. package/dist/swirl-components/p-e86c79d8.entry.js +1 -0
  216. package/dist/swirl-components/{p-b6e75c2e.entry.js → p-e9cefe04.entry.js} +1 -1
  217. package/dist/swirl-components/p-efb5e6ee.entry.js +1 -0
  218. package/dist/swirl-components/p-f299ab14.entry.js +1 -0
  219. package/dist/swirl-components/p-f703a664.entry.js +1 -0
  220. package/dist/swirl-components/p-fd7140dc.entry.js +1 -0
  221. package/dist/swirl-components/p-fdfeb16a.entry.js +1 -0
  222. package/dist/swirl-components/swirl-components.esm.js +1 -1
  223. package/dist/types/components/swirl-date-input/swirl-date-input.d.ts +1 -0
  224. package/dist/types/components/swirl-modal/swirl-modal.d.ts +5 -2
  225. package/dist/types/components/swirl-time-input/swirl-time-input.d.ts +1 -0
  226. package/dist/types/components.d.ts +5 -2
  227. package/package.json +2 -2
  228. package/vscode-data.json +4 -0
  229. package/dist/swirl-components/p-017fc399.entry.js +0 -1
  230. package/dist/swirl-components/p-028dbe1a.entry.js +0 -1
  231. package/dist/swirl-components/p-059f706f.entry.js +0 -1
  232. package/dist/swirl-components/p-062a4329.entry.js +0 -1
  233. package/dist/swirl-components/p-209e85c5.entry.js +0 -1
  234. package/dist/swirl-components/p-2278aeae.entry.js +0 -1
  235. package/dist/swirl-components/p-251884ec.entry.js +0 -1
  236. package/dist/swirl-components/p-27bdb25e.entry.js +0 -1
  237. package/dist/swirl-components/p-29147daa.entry.js +0 -1
  238. package/dist/swirl-components/p-29d32e39.entry.js +0 -1
  239. package/dist/swirl-components/p-2d5438ae.entry.js +0 -1
  240. package/dist/swirl-components/p-2fb83beb.entry.js +0 -1
  241. package/dist/swirl-components/p-30ae7d5c.entry.js +0 -1
  242. package/dist/swirl-components/p-34edf304.entry.js +0 -1
  243. package/dist/swirl-components/p-3d7a911b.entry.js +0 -1
  244. package/dist/swirl-components/p-5875e90e.entry.js +0 -1
  245. package/dist/swirl-components/p-67770da3.entry.js +0 -1
  246. package/dist/swirl-components/p-6832ee6c.entry.js +0 -1
  247. package/dist/swirl-components/p-687f534e.entry.js +0 -1
  248. package/dist/swirl-components/p-70db5c75.entry.js +0 -1
  249. package/dist/swirl-components/p-71c6c311.entry.js +0 -1
  250. package/dist/swirl-components/p-75a0a157.entry.js +0 -1
  251. package/dist/swirl-components/p-75d85160.entry.js +0 -1
  252. package/dist/swirl-components/p-794d25e2.entry.js +0 -1
  253. package/dist/swirl-components/p-873a1d91.entry.js +0 -1
  254. package/dist/swirl-components/p-8c62e1d4.entry.js +0 -1
  255. package/dist/swirl-components/p-8d92436f.entry.js +0 -1
  256. package/dist/swirl-components/p-97ac3d63.entry.js +0 -1
  257. package/dist/swirl-components/p-9d9427ab.entry.js +0 -1
  258. package/dist/swirl-components/p-a7568135.entry.js +0 -10
  259. package/dist/swirl-components/p-af46650d.entry.js +0 -1
  260. package/dist/swirl-components/p-d2845730.entry.js +0 -1
  261. package/dist/swirl-components/p-d56358aa.entry.js +0 -1
  262. package/dist/swirl-components/p-d5c14ee5.entry.js +0 -1
  263. package/dist/swirl-components/p-dd83db88.entry.js +0 -1
  264. package/dist/swirl-components/p-f6a11841.entry.js +0 -1
@@ -91,22 +91,19 @@ const SwirlMenuItem = class {
91
91
  : undefined;
92
92
  }
93
93
  renderActionListItem() {
94
- var _a, _b, _c;
95
- const badge = Boolean((_a = this.subMenu) === null || _a === void 0 ? void 0 : _a.value)
96
- ? (_c = Array.from(((_b = this.subMenu) === null || _b === void 0 ? void 0 : _b.querySelectorAll("swirl-menu-item")) || []).find((item) => { var _a; return item.value === ((_a = this.subMenu) === null || _a === void 0 ? void 0 : _a.value); })) === null || _c === void 0 ? void 0 : _c.label
94
+ const badge = Boolean(this.subMenu?.value)
95
+ ? Array.from(this.subMenu?.querySelectorAll("swirl-menu-item") || []).find((item) => item.value === this.subMenu?.value)?.label
97
96
  : undefined;
98
97
  return (index.h("swirl-action-list-item", { badge: badge, description: this.description, disabled: this.disabled, icon: this.icon, intent: this.intent, label: this.label, onClick: this.onActionListItemClick, ref: (el) => (this.actionListItem = el) }));
99
98
  }
100
99
  renderOptionListItem() {
101
- var _a;
102
- return (index.h("swirl-option-list-item", { disabled: this.disabled, icon: this.icon, label: this.label, onClick: this.onOptionListItemClick, onKeyDown: this.onOptionListItemKeyDown, onKeyUp: this.onOptionListItemKeyUp, ref: (el) => (this.optionListItem = el), selected: ((_a = this.parentMenu) === null || _a === void 0 ? void 0 : _a.value) === this.value, swirlAriaRole: "menuitemradio", value: this.value }));
100
+ return (index.h("swirl-option-list-item", { disabled: this.disabled, icon: this.icon, label: this.label, onClick: this.onOptionListItemClick, onKeyDown: this.onOptionListItemKeyDown, onKeyUp: this.onOptionListItemKeyUp, ref: (el) => (this.optionListItem = el), selected: this.parentMenu?.value === this.value, swirlAriaRole: "menuitemradio", value: this.value }));
103
101
  }
104
102
  render() {
105
- var _a;
106
103
  const className = index$1.classnames("menu-item", {
107
104
  "menu-item--expanded": this.expanded,
108
105
  });
109
- return (index.h(index.Host, null, index.h("div", { class: className }, ((_a = this.parentMenu) === null || _a === void 0 ? void 0 : _a.variant) === "selection"
106
+ return (index.h(index.Host, null, index.h("div", { class: className }, this.parentMenu?.variant === "selection"
110
107
  ? this.renderOptionListItem()
111
108
  : this.renderActionListItem(), index.h("slot", { onSlotchange: this.onSlotChange }))));
112
109
  }
@@ -124,10 +124,9 @@ const SwirlMenu = class {
124
124
  this.updateItems();
125
125
  }
126
126
  disconnectedCallback() {
127
- var _a, _b, _c;
128
127
  this.popover.removeEventListener("popoverClose", this.resetMenu);
129
- (_b = (_a = this.mobileMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.mediaQueryHandler);
130
- (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect();
128
+ this.mobileMediaQuery.removeEventListener?.("change", this.mediaQueryHandler);
129
+ this.observer?.disconnect();
131
130
  }
132
131
  watchActive() {
133
132
  this.reposition();
@@ -265,11 +264,10 @@ const SwirlMenu = class {
265
264
  getActiveItemIndex() {
266
265
  const activeElement = utils.getActiveElement();
267
266
  return this.items.findIndex((item) => item === activeElement ||
268
- item === (activeElement === null || activeElement === void 0 ? void 0 : activeElement.querySelector('[role="menuitem"]')) ||
269
- item === (activeElement === null || activeElement === void 0 ? void 0 : activeElement.querySelector('[role="menuitemradio"]')));
267
+ item === activeElement?.querySelector('[role="menuitem"]') ||
268
+ item === activeElement?.querySelector('[role="menuitemradio"]'));
270
269
  }
271
270
  render() {
272
- var _a, _b;
273
271
  const isTopLevelMenu = !Boolean(this.parentMenu);
274
272
  const ariaLabel = isTopLevelMenu && this.mobile ? undefined : this.label;
275
273
  const ariaLabelledby = isTopLevelMenu && this.mobile ? "menu-title" : undefined;
@@ -281,8 +279,8 @@ const SwirlMenu = class {
281
279
  });
282
280
  return (index.h(index.Host, null, index.h("div", { class: className }, this.mobile && isTopLevelMenu && (index.h("div", { class: "menu__mobile-header" }, this.activeLevel === 0 && (index.h("swirl-button", { hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.mobileCloseMenuButtonLabel, onClick: this.onClose, variant: "plain" })), this.activeLevel > 0 && (index.h("swirl-button", { hideLabel: true, icon: "<swirl-icon-chevron-left></swirl-icon-chevron-left>", label: this.mobileBackButtonLabel, onClick: this.onGoBack, variant: "plain" })), index.h("span", { class: "menu__title", id: "menu-title" }, index.h("swirl-heading", { align: "center", as: "span", level: 4, text: this.label, truncate: true })), index.h("swirl-button", { class: "menu__done-button", intent: "primary", label: this.mobileDoneButtonLabel, onClick: this.onDone }))), index.h("div", { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-orientation": "vertical", class: "menu__menu", onKeyDown: this.onKeyDown, ref: (el) => (this.menuContainer = el), role: role, style: !this.mobile && this.level > 0
283
281
  ? {
284
- top: Boolean(this.position) ? `${(_a = this.position) === null || _a === void 0 ? void 0 : _a.y}px` : "",
285
- left: Boolean(this.position) ? `${(_b = this.position) === null || _b === void 0 ? void 0 : _b.x}px` : "",
282
+ top: Boolean(this.position) ? `${this.position?.y}px` : "",
283
+ left: Boolean(this.position) ? `${this.position?.x}px` : "",
286
284
  }
287
285
  : this.mobile
288
286
  ? {
@@ -1156,6 +1156,7 @@ const SwirlModal = class {
1156
1156
  this.modalClose = index.createEvent(this, "modalClose", 7);
1157
1157
  this.modalOpen = index.createEvent(this, "modalOpen", 7);
1158
1158
  this.primaryAction = index.createEvent(this, "primaryAction", 7);
1159
+ this.requestModalClose = index.createEvent(this, "requestModalClose", 7);
1159
1160
  this.secondaryAction = index.createEvent(this, "secondaryAction", 7);
1160
1161
  this.onKeyDown = (event) => {
1161
1162
  if (event.code === "Escape") {
@@ -1175,10 +1176,9 @@ const SwirlModal = class {
1175
1176
  this.secondaryAction.emit(event);
1176
1177
  };
1177
1178
  this.determineScrollStatus = () => {
1178
- var _a, _b, _c, _d, _e, _f;
1179
- const scrolled = ((_a = this.scrollContainer) === null || _a === void 0 ? void 0 : _a.scrollTop) > 0;
1180
- const scrolledDown = Math.ceil(((_b = this.scrollContainer) === null || _b === void 0 ? void 0 : _b.scrollTop) + ((_c = this.scrollContainer) === null || _c === void 0 ? void 0 : _c.offsetHeight)) >= ((_d = this.scrollContainer) === null || _d === void 0 ? void 0 : _d.scrollHeight);
1181
- const scrollable = ((_e = this.scrollContainer) === null || _e === void 0 ? void 0 : _e.scrollHeight) > ((_f = this.scrollContainer) === null || _f === void 0 ? void 0 : _f.offsetHeight);
1179
+ const scrolled = this.scrollContainer?.scrollTop > 0;
1180
+ const scrolledDown = Math.ceil(this.scrollContainer?.scrollTop + this.scrollContainer?.offsetHeight) >= this.scrollContainer?.scrollHeight;
1181
+ const scrollable = this.scrollContainer?.scrollHeight > this.scrollContainer?.offsetHeight;
1182
1182
  if (scrolled !== this.scrolled) {
1183
1183
  this.scrolled = scrolled;
1184
1184
  }
@@ -1189,6 +1189,7 @@ const SwirlModal = class {
1189
1189
  this.scrollable = scrollable;
1190
1190
  }
1191
1191
  };
1192
+ this.closable = true;
1192
1193
  this.closeButtonLabel = "Close modal";
1193
1194
  this.hideCloseButton = undefined;
1194
1195
  this.hideLabel = undefined;
@@ -1236,6 +1237,7 @@ const SwirlModal = class {
1236
1237
  // wait for animation
1237
1238
  setTimeout(() => {
1238
1239
  this.focusTrap.activate();
1240
+ this.handleAutoFocus();
1239
1241
  }, 200);
1240
1242
  }
1241
1243
  else {
@@ -1252,12 +1254,16 @@ const SwirlModal = class {
1252
1254
  this.determineScrollStatus();
1253
1255
  }
1254
1256
  /**
1255
- * Close the modal.
1257
+ * Close the modal. Pass `true` to force close even if the modal is not closable.
1256
1258
  */
1257
- async close() {
1259
+ async close(force) {
1258
1260
  if (this.closing) {
1259
1261
  return;
1260
1262
  }
1263
+ this.requestModalClose.emit();
1264
+ if (!this.closable && !force) {
1265
+ return;
1266
+ }
1261
1267
  this.closing = true;
1262
1268
  this.unlockBodyScroll();
1263
1269
  setTimeout(() => {
@@ -1275,6 +1281,9 @@ const SwirlModal = class {
1275
1281
  updateHeaderToolsStatus() {
1276
1282
  this.hasHeaderTools = Boolean(this.el.querySelector('[slot="header-tools"]'));
1277
1283
  }
1284
+ handleAutoFocus() {
1285
+ this.modalEl.querySelector("input[autofocus]")?.focus();
1286
+ }
1278
1287
  lockBodyScroll() {
1279
1288
  bodyScrollLock_esm.disableBodyScroll(this.scrollContainer);
1280
1289
  }
@@ -29,7 +29,7 @@ const SwirlOptionList = class {
29
29
  this.onClick = (event) => {
30
30
  event.preventDefault();
31
31
  const target = event.target;
32
- const item = target === null || target === void 0 ? void 0 : target.closest("swirl-option-list-item");
32
+ const item = target?.closest("swirl-option-list-item");
33
33
  const composedTarget = event.composedPath()[0];
34
34
  const clickedOption = Boolean(utils.closestPassShadow(composedTarget, '[role="option"]'));
35
35
  if (!Boolean(item) || !clickedOption) {
@@ -138,9 +138,8 @@ const SwirlOptionList = class {
138
138
  this.setupDragDrop();
139
139
  }
140
140
  disconnectedCallback() {
141
- var _a, _b;
142
- (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
143
- (_b = this.sortable) === null || _b === void 0 ? void 0 : _b.destroy();
141
+ this.observer?.disconnect();
142
+ this.sortable?.destroy();
144
143
  }
145
144
  watchAllowDrag() {
146
145
  this.setItemAllowDragState();
@@ -268,16 +267,14 @@ const SwirlOptionList = class {
268
267
  }
269
268
  }
270
269
  syncItemsWithValue() {
271
- var _a;
272
- (_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach((item) => (item.selected = this.value.includes(item.value)));
270
+ this.items?.forEach((item) => (item.selected = this.value.includes(item.value)));
273
271
  }
274
272
  focusItem(index) {
275
- var _a;
276
273
  if (this.disabled) {
277
274
  return;
278
275
  }
279
276
  this.items.forEach((item) => item.querySelector('[role="option"]').removeAttribute("tabIndex"));
280
- const item = (_a = this.items[index]) === null || _a === void 0 ? void 0 : _a.querySelector('[role="option"]');
277
+ const item = this.items[index]?.querySelector('[role="option"]');
281
278
  if (!Boolean(item)) {
282
279
  return;
283
280
  }
@@ -74,9 +74,8 @@ const SwirlPdfReader = class {
74
74
  this.zoom = value === "auto" ? value : +value;
75
75
  };
76
76
  this.onThumbnailClick = (index) => () => {
77
- var _a;
78
- const page = (_a = utils.querySelectorAllDeep(this.el, `[data-page-number="${index + 1}"]`)) === null || _a === void 0 ? void 0 : _a[0];
79
- page === null || page === void 0 ? void 0 : page.scrollIntoView();
77
+ const page = utils.querySelectorAllDeep(this.el, `[data-page-number="${index + 1}"]`)?.[0];
78
+ page?.scrollIntoView();
80
79
  };
81
80
  this.autoZoomLabel = "Full width";
82
81
  this.closeButtonLabel = "Close PDF viewer";
@@ -112,9 +111,8 @@ const SwirlPdfReader = class {
112
111
  this.modal = new a11yDialog_esm.A11yDialog(this.modalEl);
113
112
  }
114
113
  disconnectedCallback() {
115
- var _a;
116
114
  this.unlockBodyScroll();
117
- (_a = this.modal) === null || _a === void 0 ? void 0 : _a.destroy();
115
+ this.modal?.destroy();
118
116
  }
119
117
  onWindowResize() {
120
118
  if (!Boolean(this.pdfViewer)) {
@@ -81,7 +81,6 @@ const SwirlPopover = class {
81
81
  this.unlockBodyScroll();
82
82
  }
83
83
  onWindowFocusIn(event) {
84
- var _a;
85
84
  if (!this.active) {
86
85
  return;
87
86
  }
@@ -92,7 +91,7 @@ const SwirlPopover = class {
92
91
  const popoverLostFocus = !this.el.contains(target) &&
93
92
  !this.el.contains(activeElement) &&
94
93
  target !== this.triggerEl &&
95
- !((_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.contains(target)) &&
94
+ !this.triggerEl?.contains(target) &&
96
95
  (!isSafari ||
97
96
  (isSafari &&
98
97
  !this.el.contains(relatedTarget || target) &&
@@ -122,7 +121,6 @@ const SwirlPopover = class {
122
121
  * @returns
123
122
  */
124
123
  async close() {
125
- var _a;
126
124
  if (this.closing || !this.active) {
127
125
  return;
128
126
  }
@@ -137,7 +135,7 @@ const SwirlPopover = class {
137
135
  this.updateTriggerAttributes();
138
136
  }, 150);
139
137
  this.unlockBodyScroll();
140
- (_a = this.getNativeTriggerElement()) === null || _a === void 0 ? void 0 : _a.focus();
138
+ this.getNativeTriggerElement()?.focus();
141
139
  }
142
140
  /**
143
141
  * Open the popover.
@@ -186,10 +184,9 @@ const SwirlPopover = class {
186
184
  });
187
185
  }
188
186
  getNativeTriggerElement() {
189
- var _a, _b, _c, _d;
190
- return ((_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.tagName.startsWith("SWIRL-"))
191
- ? (((_b = this.triggerEl) === null || _b === void 0 ? void 0 : _b.children[0]) ||
192
- ((_d = (_c = this.triggerEl) === null || _c === void 0 ? void 0 : _c.shadowRoot) === null || _d === void 0 ? void 0 : _d.children[0]) ||
187
+ return this.triggerEl?.tagName.startsWith("SWIRL-")
188
+ ? (this.triggerEl?.children[0] ||
189
+ this.triggerEl?.shadowRoot?.children[0] ||
193
190
  this.triggerEl)
194
191
  : this.triggerEl;
195
192
  }
@@ -242,17 +239,16 @@ const SwirlPopover = class {
242
239
  bodyScrollLock_esm.enableBodyScroll(this.scrollContainer);
243
240
  }
244
241
  render() {
245
- var _a, _b, _c;
246
242
  const mobile = !window.matchMedia("(min-width: 768px)").matches;
247
- const className = index$1.classnames("popover", `popover--animation-${this.animation}`, `popover--placement-${(_a = this.position) === null || _a === void 0 ? void 0 : _a.placement}`, {
243
+ const className = index$1.classnames("popover", `popover--animation-${this.animation}`, `popover--placement-${this.position?.placement}`, {
248
244
  "popover--closing": this.closing,
249
245
  "popover--active": this.active,
250
246
  "popover--fullscreen-bottom-sheet": this.fullscreenBottomSheet,
251
247
  "popover--inactive": !this.active,
252
248
  });
253
249
  return (index.h(index.Host, null, index.h("div", { class: className, onKeyDown: this.onKeydown }, index.h("div", { "aria-hidden": !this.active ? "true" : "false", "aria-label": this.label, class: "popover__content", id: this.popoverId, part: "popover__content", role: "dialog", ref: (el) => (this.contentContainer = el), style: {
254
- top: Boolean(this.position) ? `${(_b = this.position) === null || _b === void 0 ? void 0 : _b.y}px` : "",
255
- left: Boolean(this.position) ? `${(_c = this.position) === null || _c === void 0 ? void 0 : _c.x}px` : "",
250
+ top: Boolean(this.position) ? `${this.position?.y}px` : "",
251
+ left: Boolean(this.position) ? `${this.position?.x}px` : "",
256
252
  }, tabindex: "-1" }, index.h("span", { class: "popover__handle" }), index.h("div", { class: "popover__scroll-container", ref: (el) => (this.scrollContainer = el), style: {
257
253
  maxHeight: !mobile && Boolean(this.maxHeight)
258
254
  ? this.maxHeight
@@ -294,12 +290,11 @@ const SwirlPopoverTrigger = class {
294
290
  }, { once: true });
295
291
  };
296
292
  this.updateTriggerElAriaAttributes = (open) => {
297
- var _a;
298
293
  if (!this.setAriaAttributes) {
299
294
  return;
300
295
  }
301
296
  const triggerEl = this.getTriggerEl();
302
- const popoverId = typeof this.popover === "string" ? this.popover : (_a = this.popover) === null || _a === void 0 ? void 0 : _a.id;
297
+ const popoverId = typeof this.popover === "string" ? this.popover : this.popover?.id;
303
298
  if (triggerEl.tagName.startsWith("SWIRL-")) {
304
299
  triggerEl.setAttribute("swirl-aria-controls", popoverId);
305
300
  triggerEl.setAttribute("swirl-aria-expanded", String(open || "false"));
@@ -29,15 +29,14 @@ const SwirlResourceListFileItem = class {
29
29
  this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
30
30
  }
31
31
  disconnectedCallback() {
32
- var _a, _b;
33
- (_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
32
+ this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
34
33
  }
35
34
  forceIconProps(smallIcon) {
36
35
  if (!Boolean(this.iconEl)) {
37
36
  return;
38
37
  }
39
38
  const icon = this.iconEl.children[0];
40
- icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", smallIcon ? "20" : "24");
39
+ icon?.setAttribute("size", smallIcon ? "20" : "24");
41
40
  }
42
41
  render() {
43
42
  const showError = Boolean(this.errorMessage);
@@ -49,17 +49,22 @@ const SwirlSearch = class {
49
49
  componentDidLoad() {
50
50
  this.forceIconProps(this.desktopMediaQuery.matches);
51
51
  this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
52
+ // see https://stackoverflow.com/a/27314017
53
+ if (this.autoFocus) {
54
+ setTimeout(() => {
55
+ this.input.focus();
56
+ });
57
+ }
52
58
  }
53
59
  disconnectedCallback() {
54
- var _a, _b;
55
- (_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
60
+ this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
56
61
  }
57
62
  forceIconProps(smallIcon) {
58
63
  if (!Boolean(this.iconEl)) {
59
64
  return;
60
65
  }
61
66
  const icon = this.iconEl.children[0];
62
- icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", smallIcon ? "20" : "24");
67
+ icon?.setAttribute("size", smallIcon ? "20" : "24");
63
68
  }
64
69
  onKeyDown(event) {
65
70
  if ((event.code === "KeyK" || event.code === "Slash") &&
@@ -30,8 +30,7 @@ const SwirlSelect = class {
30
30
  this.updateOptions();
31
31
  };
32
32
  this.onOpen = (event) => {
33
- var _a;
34
- this.placement = (_a = event.detail.position) === null || _a === void 0 ? void 0 : _a.placement;
33
+ this.placement = event.detail.position?.placement;
35
34
  this.open = true;
36
35
  };
37
36
  this.onClose = () => {
@@ -71,15 +70,16 @@ const SwirlSelect = class {
71
70
  this.options = utils.querySelectorAllDeep(this.el, "swirl-option-list-item");
72
71
  }
73
72
  render() {
74
- var _a, _b, _c;
75
73
  const label = Boolean(this.value)
76
- ? (_a = this.value) === null || _a === void 0 ? void 0 : _a.map((value) => { var _a; return (_a = this.options.find((option) => option.value === value)) === null || _a === void 0 ? void 0 : _a.label; }).join(", ")
74
+ ? this.value
75
+ ?.map((value) => this.options.find((option) => option.value === value)?.label)
76
+ .join(", ")
77
77
  : "";
78
78
  const ariaInvalid = this.invalid === true || this.invalid === false
79
79
  ? String(this.invalid)
80
80
  : undefined;
81
81
  const formControl = this.el.closest("swirl-form-control");
82
- const offset = (formControl === null || formControl === void 0 ? void 0 : formControl.inline) || (formControl === null || formControl === void 0 ? void 0 : formControl.labelPosition) === "outside"
82
+ const offset = formControl?.inline || formControl?.labelPosition === "outside"
83
83
  ? -12
84
84
  : -16;
85
85
  const className = index$1.classnames("select", `select--placement-${this.placement}`, {
@@ -87,9 +87,11 @@ const SwirlSelect = class {
87
87
  "select--inline": this.inline,
88
88
  "select--multi": this.multiSelect,
89
89
  });
90
- return (index.h(index.Host, { onKeyDown: this.onKeyDown }, index.h("div", { class: className }, index.h("swirl-popover-trigger", { popover: this.popover, setAriaAttributes: false }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, class: "select__input", disabled: this.disabled, readOnly: true, type: "text", value: label })), index.h("span", { class: "select__multi-select-values" }, (_c = (_b = this.value) === null || _b === void 0 ? void 0 : _b.map((value) => this.options.find((option) => option.value === value))) === null || _c === void 0 ? void 0 : _c.map((option) => (index.h("swirl-tag", { "aria-hidden": "true", label: option === null || option === void 0 ? void 0 : option.label,
90
+ return (index.h(index.Host, { onKeyDown: this.onKeyDown }, index.h("div", { class: className }, index.h("swirl-popover-trigger", { popover: this.popover, setAriaAttributes: false }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, class: "select__input", disabled: this.disabled, readOnly: true, type: "text", value: label })), index.h("span", { class: "select__multi-select-values" }, this.value
91
+ ?.map((value) => this.options.find((option) => option.value === value))
92
+ ?.map((option) => (index.h("swirl-tag", { "aria-hidden": "true", label: option?.label,
91
93
  // eslint-disable-next-line react/jsx-no-bind
92
- onRemove: () => this.unselectOption(option === null || option === void 0 ? void 0 : option.value), removable: !this.disabled && this.allowDeselect })))), index.h("span", { class: "select__indicator" }, this.open ? (index.h("swirl-icon-expand-less", null)) : (index.h("swirl-icon-expand-more", null))), index.h("swirl-popover", { animation: "scale-in-y", class: "select__popover", id: `select-options-${this.selectId}`, label: this.label, offset: [0, offset], onPopoverClose: this.onClose, onPopoverOpen: this.onOpen, ref: (el) => (this.popover = el), useContainerWidth: "swirl-form-control" }, index.h("swirl-option-list", { allowDeselect: this.allowDeselect, onValueChange: this.select, multiSelect: this.multiSelect, value: this.value }, index.h("slot", { onSlotchange: this.onSlotChange }))))));
94
+ onRemove: () => this.unselectOption(option?.value), removable: !this.disabled && this.allowDeselect })))), index.h("span", { class: "select__indicator" }, this.open ? (index.h("swirl-icon-expand-less", null)) : (index.h("swirl-icon-expand-more", null))), index.h("swirl-popover", { animation: "scale-in-y", class: "select__popover", id: `select-options-${this.selectId}`, label: this.label, offset: [0, offset], onPopoverClose: this.onClose, onPopoverOpen: this.onOpen, ref: (el) => (this.popover = el), useContainerWidth: "swirl-form-control" }, index.h("swirl-option-list", { allowDeselect: this.allowDeselect, onValueChange: this.select, multiSelect: this.multiSelect, value: this.value }, index.h("slot", { onSlotchange: this.onSlotChange }))))));
93
95
  }
94
96
  get el() { return index.getElement(this); }
95
97
  };
@@ -51,10 +51,9 @@ const SwirlShellLayout = class {
51
51
  }
52
52
  };
53
53
  this.onSidebarClick = () => {
54
- var _a, _b;
55
54
  if (this.collapsedSidebar) {
56
- (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.blur();
57
- (_b = utils.getActiveElement()) === null || _b === void 0 ? void 0 : _b.blur();
55
+ document.activeElement?.blur();
56
+ utils.getActiveElement()?.blur();
58
57
  }
59
58
  };
60
59
  this.onSidebarMouseEnter = () => {
@@ -19,7 +19,7 @@ const SwirlTableColumn = class {
19
19
  }
20
20
  componentDidRender() {
21
21
  const table = utils.closestPassShadow(this.el, "swirl-table");
22
- table === null || table === void 0 ? void 0 : table.rerender();
22
+ table?.rerender();
23
23
  }
24
24
  render() {
25
25
  const styles = {
@@ -16,7 +16,7 @@ const SwirlTableRow = class {
16
16
  }
17
17
  componentDidLoad() {
18
18
  const table = utils.closestPassShadow(this.el, "swirl-table");
19
- table === null || table === void 0 ? void 0 : table.rerender();
19
+ table?.rerender();
20
20
  }
21
21
  render() {
22
22
  const className = index$1.classnames("table-row", {
@@ -210,9 +210,8 @@ const SwirlTable = class {
210
210
  emptyRow.style.width = scrollWidth;
211
211
  }
212
212
  layoutRowGroups() {
213
- var _a;
214
213
  const tableRowGroups = Array.from(this.el.querySelectorAll("swirl-table-row-group"));
215
- const scrollWidth = `${(_a = this.el.shadowRoot.querySelector(".table__container")) === null || _a === void 0 ? void 0 : _a.scrollWidth}px`;
214
+ const scrollWidth = `${this.el.shadowRoot.querySelector(".table__container")?.scrollWidth}px`;
216
215
  tableRowGroups.forEach((tableRowGroup) => {
217
216
  const headerRow = tableRowGroup.shadowRoot.querySelector(".table-row-group__header-row");
218
217
  if (!Boolean(headerRow)) {
@@ -52,8 +52,7 @@ const SwirlTabs = class {
52
52
  const nextIndex = Math.min(this.tabs.length - 1, currentIndex + 1);
53
53
  this.activateTab(this.tabs[nextIndex].tabId);
54
54
  requestAnimationFrame(() => {
55
- var _a;
56
- (_a = this.el.querySelector(".tabs__tab--active")) === null || _a === void 0 ? void 0 : _a.focus();
55
+ this.el.querySelector(".tabs__tab--active")?.focus();
57
56
  });
58
57
  }
59
58
  activatePreviousTab() {
@@ -61,8 +60,7 @@ const SwirlTabs = class {
61
60
  const previousIndex = Math.max(0, currentIndex - 1);
62
61
  this.activateTab(this.tabs[previousIndex].tabId);
63
62
  requestAnimationFrame(() => {
64
- var _a;
65
- (_a = this.el.querySelector(".tabs__tab--active")) === null || _a === void 0 ? void 0 : _a.focus();
63
+ this.el.querySelector(".tabs__tab--active")?.focus();
66
64
  });
67
65
  }
68
66
  collectTabs() {
@@ -12,8 +12,7 @@ const SwirlTag = class {
12
12
  index.registerInstance(this, hostRef);
13
13
  this.remove = index.createEvent(this, "remove", 7);
14
14
  this.onRemove = (event) => {
15
- var _a;
16
- (_a = this.remove) === null || _a === void 0 ? void 0 : _a.emit(event);
15
+ this.remove?.emit(event);
17
16
  };
18
17
  this.intent = "default";
19
18
  this.label = undefined;
@@ -113,13 +113,18 @@ const SwirlTextInput = class {
113
113
  componentDidLoad() {
114
114
  this.updateIconSize(this.desktopMediaQuery.matches);
115
115
  this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
116
+ // see https://stackoverflow.com/a/27314017
117
+ if (this.autoFocus) {
118
+ setTimeout(() => {
119
+ this.inputEl.focus();
120
+ });
121
+ }
116
122
  }
117
123
  componentDidRender() {
118
124
  this.adjustInputSize();
119
125
  }
120
126
  disconnectedCallback() {
121
- var _a, _b;
122
- (_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
127
+ this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
123
128
  }
124
129
  updateIconSize(smallIcon) {
125
130
  this.iconSize = smallIcon ? 20 : 24;
@@ -149,7 +154,6 @@ const SwirlTextInput = class {
149
154
  event.target.select();
150
155
  }
151
156
  render() {
152
- var _a;
153
157
  const Tag = this.rows === 1 && !this.autoGrow ? "input" : "textarea";
154
158
  const ariaInvalid = this.invalid === true || this.invalid === false
155
159
  ? String(this.invalid)
@@ -172,7 +176,7 @@ const SwirlTextInput = class {
172
176
  "text-input--inline": this.inline,
173
177
  "text-input--show-password": this.type === "password" && this.showPassword,
174
178
  });
175
- return (index.h(index.Host, null, index.h("div", { class: className }, this.prefixLabel && (index.h("span", { class: "text-input__prefix" }, this.prefixLabel)), index.h(Tag, { "aria-autocomplete": this.swirlAriaAutocomplete, "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-invalid": ariaInvalid, autoComplete: this.autoComplete, autoFocus: this.autoFocus, class: "text-input__input", disabled: this.disabled, inputMode: this.mode, maxLength: this.maxLength, max: this.type === "number" ? this.max : undefined, min: this.type === "number" ? this.min : undefined, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.onInput, onKeyPress: this.onKeyPress, placeholder: !Boolean(this.suffixLabel) ? this.placeholder : undefined, ref: (el) => (this.inputEl = el), required: this.required, role: this.swirlRole, rows: this.rows > 1 ? this.rows : this.autoGrow ? 1 : undefined, spellcheck: this.spellCheck, step: this.type === "number" ? this.step : undefined, type: type, value: this.value }, this.rows > 1 && this.value), this.suffixLabel && (index.h("span", { class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (index.h("button", { "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, index.h("swirl-icon-cancel", { size: this.iconSize }))), showPasswordToggle && (index.h("button", { "aria-label": this.passwordToggleLabel, class: "text-input__password-toggle", onClick: this.togglePassword, type: "button" }, this.showPassword ? (index.h("swirl-icon-visibility-off", { size: this.iconSize })) : (index.h("swirl-icon-visibility", { size: this.iconSize })))), showStepper && (index.h("span", { class: "text-input__stepper" }, index.h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, index.h("swirl-icon-expand-less", { size: this.iconSize })), index.h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, index.h("swirl-icon-expand-more", { size: this.iconSize })))), this.showCharacterCounter && (index.h("span", { class: "text-input__character-counter" }, ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
179
+ return (index.h(index.Host, null, index.h("div", { class: className }, this.prefixLabel && (index.h("span", { class: "text-input__prefix" }, this.prefixLabel)), index.h(Tag, { "aria-autocomplete": this.swirlAriaAutocomplete, "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-invalid": ariaInvalid, autoComplete: this.autoComplete, autoFocus: this.autoFocus, class: "text-input__input", disabled: this.disabled, inputMode: this.mode, maxLength: this.maxLength, max: this.type === "number" ? this.max : undefined, min: this.type === "number" ? this.min : undefined, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.onInput, onKeyPress: this.onKeyPress, placeholder: !Boolean(this.suffixLabel) ? this.placeholder : undefined, ref: (el) => (this.inputEl = el), required: this.required, role: this.swirlRole, rows: this.rows > 1 ? this.rows : this.autoGrow ? 1 : undefined, spellcheck: this.spellCheck, step: this.type === "number" ? this.step : undefined, type: type, value: this.value }, this.rows > 1 && this.value), this.suffixLabel && (index.h("span", { class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (index.h("button", { "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, index.h("swirl-icon-cancel", { size: this.iconSize }))), showPasswordToggle && (index.h("button", { "aria-label": this.passwordToggleLabel, class: "text-input__password-toggle", onClick: this.togglePassword, type: "button" }, this.showPassword ? (index.h("swirl-icon-visibility-off", { size: this.iconSize })) : (index.h("swirl-icon-visibility", { size: this.iconSize })))), showStepper && (index.h("span", { class: "text-input__stepper" }, index.h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, index.h("swirl-icon-expand-less", { size: this.iconSize })), index.h("button", { "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, index.h("swirl-icon-expand-more", { size: this.iconSize })))), this.showCharacterCounter && (index.h("span", { class: "text-input__character-counter" }, this.value?.length || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
176
180
  }
177
181
  };
178
182
  SwirlTextInput.style = swirlTextInputCss;
@@ -296,8 +296,11 @@ const SwirlThemeProvider = class {
296
296
  this.updateAppTheme();
297
297
  }
298
298
  resolveConfig() {
299
- var _a, _b;
300
- this.resolvedConfig = Object.assign(Object.assign({}, (this.config || {})), { rootElement: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.rootElement) || document.documentElement, storage: ((_b = this.config) === null || _b === void 0 ? void 0 : _b.storage) || (window === null || window === void 0 ? void 0 : window.localStorage) });
299
+ this.resolvedConfig = {
300
+ ...(this.config || {}),
301
+ rootElement: this.config?.rootElement || document.documentElement,
302
+ storage: this.config?.storage || window?.localStorage,
303
+ };
301
304
  }
302
305
  determineOSTheme() {
303
306
  if (!Boolean(window.matchMedia)) {
@@ -336,8 +339,7 @@ const SwirlThemeProvider = class {
336
339
  }
337
340
  }
338
341
  updateTenantVariables() {
339
- var _a;
340
- const tenantTheme = (_a = this.resolvedConfig) === null || _a === void 0 ? void 0 : _a.tenantColors;
342
+ const tenantTheme = this.resolvedConfig?.tenantColors;
341
343
  if (!Boolean(tenantTheme)) {
342
344
  this.resetTenantVariables();
343
345
  return;
@@ -353,7 +355,15 @@ const SwirlThemeProvider = class {
353
355
  const secondaryPressed = toRgba(hsla(secondaryHsla[0], secondaryHsla[1], secondaryHsla[2] + 0.15, 1));
354
356
  const textHovered = toRgba(hsla(textHsla[0], textHsla[1] - 0.34, textHsla[2] + 0.1, 1));
355
357
  const textPressed = toRgba(hsla(textHsla[0], textHsla[1] - 0.48, textHsla[2] + 0.2, 1));
356
- const tenantThemeWithGeneratedStateColors = Object.assign(Object.assign({}, tenantTheme), { primaryHovered: primaryHovered, primaryPressed: primaryPressed, secondaryHovered: secondaryHovered, secondaryPressed: secondaryPressed, textHovered: textHovered, textPressed: textPressed });
358
+ const tenantThemeWithGeneratedStateColors = {
359
+ ...tenantTheme,
360
+ primaryHovered: primaryHovered,
361
+ primaryPressed: primaryPressed,
362
+ secondaryHovered: secondaryHovered,
363
+ secondaryPressed: secondaryPressed,
364
+ textHovered: textHovered,
365
+ textPressed: textPressed,
366
+ };
357
367
  // set custom properties for tenant theme colors
358
368
  Object.entries(tenantColorMapping).forEach(([key, value]) => rootElement.style.setProperty(key, tenantThemeWithGeneratedStateColors[value]));
359
369
  }
@@ -81,11 +81,16 @@ const SwirlTimeInput = class {
81
81
  this.setupMask();
82
82
  this.updateIconSize(this.desktopMediaQuery.matches);
83
83
  this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
84
+ // see https://stackoverflow.com/a/27314017
85
+ if (this.autoFocus) {
86
+ setTimeout(() => {
87
+ this.inputEl.focus();
88
+ });
89
+ }
84
90
  }
85
91
  disconnectedCallback() {
86
- var _a, _b, _c;
87
- (_a = this.mask) === null || _a === void 0 ? void 0 : _a.destroy();
88
- (_c = (_b = this.desktopMediaQuery).removeEventListener) === null || _c === void 0 ? void 0 : _c.call(_b, "change", this.desktopMediaQueryHandler);
92
+ this.mask?.destroy();
93
+ this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
89
94
  }
90
95
  watchFormat() {
91
96
  this.setupMask();
@@ -100,8 +105,7 @@ const SwirlTimeInput = class {
100
105
  event.target.select();
101
106
  }
102
107
  setupMask() {
103
- var _a;
104
- (_a = this.mask) === null || _a === void 0 ? void 0 : _a.destroy();
108
+ this.mask?.destroy();
105
109
  this.mask = maska.maska.create(`#${this.id}`, {
106
110
  mask: this.format.replace(/[Hhms]/g, "#"),
107
111
  });
@@ -119,7 +123,7 @@ const SwirlTimeInput = class {
119
123
  const className = index$1.classnames("time-input", {
120
124
  "time-input--inline": this.inline,
121
125
  });
122
- return (index.h(index.Host, null, index.h("div", { class: className }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), index.h("span", { class: "time-input__icon" }, index.h("swirl-icon-time-outlined", { size: this.iconSize })))));
126
+ return (index.h(index.Host, null, index.h("div", { class: className }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), index.h("span", { class: "time-input__icon" }, index.h("swirl-icon-time-outlined", { size: this.iconSize })))));
123
127
  }
124
128
  get el() { return index.getElement(this); }
125
129
  static get watchers() { return {
@@ -45,14 +45,19 @@ const SwirlToastProvider = class {
45
45
  else if (this.globalDuration === 0) {
46
46
  duration = undefined;
47
47
  }
48
- const newToastWithId = Object.assign(Object.assign({}, newToast), { createdAt: new Date(), duration, toastId: newToast.toastId || String(Math.round(Math.random() * 10000)) });
48
+ const newToastWithId = {
49
+ ...newToast,
50
+ createdAt: new Date(),
51
+ duration,
52
+ toastId: newToast.toastId || String(Math.round(Math.random() * 10000)),
53
+ };
49
54
  this.toasts = [...this.toasts, newToastWithId];
50
55
  return newToastWithId;
51
56
  }
52
57
  render() {
53
58
  return (index.h(index.Host, { role: "status" }, index.h("swirl-stack", { spacing: "12" }, this.toasts.map((toast) => {
54
- const props = Object.assign(Object.assign({}, toast), { content: undefined });
55
- return (index.h("swirl-toast", Object.assign({ key: toast.toastId, onDismiss: this.onDismiss }, props), toast.content));
59
+ const props = { ...toast, content: undefined };
60
+ return (index.h("swirl-toast", { key: toast.toastId, onDismiss: this.onDismiss, ...props }, toast.content));
56
61
  }))));
57
62
  }
58
63
  };
@@ -36,15 +36,13 @@ const SwirlToast = class {
36
36
  this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
37
37
  }
38
38
  disconnectedCallback() {
39
- var _a, _b;
40
- (_b = (_a = this.desktopMediaQuery).removeEventListener) === null || _b === void 0 ? void 0 : _b.call(_a, "change", this.desktopMediaQueryHandler);
39
+ this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
41
40
  }
42
41
  forceIconProps(smallIcon) {
43
- var _a;
44
- const icon = (_a = this.iconEl) === null || _a === void 0 ? void 0 : _a.children[0];
42
+ const icon = this.iconEl?.children[0];
45
43
  const dismissIcon = this.dismissIconEl;
46
- icon === null || icon === void 0 ? void 0 : icon.setAttribute("size", smallIcon ? "20" : "24");
47
- dismissIcon === null || dismissIcon === void 0 ? void 0 : dismissIcon.setAttribute("size", smallIcon ? "20" : "24");
44
+ icon?.setAttribute("size", smallIcon ? "20" : "24");
45
+ dismissIcon?.setAttribute("size", smallIcon ? "20" : "24");
48
46
  }
49
47
  startTimer() {
50
48
  this.clearTimer();