@getflip/swirl-components 0.331.0 → 0.333.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 (200) hide show
  1. package/components.json +7 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/media-query.service-aad2b3b1.js +24 -0
  4. package/dist/cjs/swirl-action-list_2.cjs.entry.js +8 -12
  5. package/dist/cjs/swirl-app-layout_5.cjs.entry.js +19 -23
  6. package/dist/cjs/swirl-autocomplete.cjs.entry.js +1 -1
  7. package/dist/cjs/swirl-banner.cjs.entry.js +8 -9
  8. package/dist/cjs/swirl-button.cjs.entry.js +9 -11
  9. package/dist/cjs/swirl-carousel.cjs.entry.js +1 -1
  10. package/dist/cjs/swirl-chip.cjs.entry.js +8 -9
  11. package/dist/cjs/swirl-components.cjs.js +1 -1
  12. package/dist/cjs/swirl-console-layout.cjs.entry.js +1 -1
  13. package/dist/cjs/swirl-date-input.cjs.entry.js +8 -9
  14. package/dist/cjs/swirl-date-picker_2.cjs.entry.js +1 -1
  15. package/dist/cjs/swirl-file-chip.cjs.entry.js +6 -3
  16. package/dist/cjs/swirl-file-viewer_8.cjs.entry.js +1 -1
  17. package/dist/cjs/swirl-form-control.cjs.entry.js +26 -13
  18. package/dist/cjs/swirl-icon-check-small_2.cjs.entry.js +10 -12
  19. package/dist/cjs/swirl-icon-error_3.cjs.entry.js +8 -9
  20. package/dist/cjs/swirl-image-grid-item.cjs.entry.js +1 -1
  21. package/dist/cjs/swirl-inline-status.cjs.entry.js +8 -9
  22. package/dist/cjs/swirl-lightbox.cjs.entry.js +1 -1
  23. package/dist/cjs/swirl-menu-item.cjs.entry.js +1 -1
  24. package/dist/cjs/swirl-menu.cjs.entry.js +1 -1
  25. package/dist/cjs/swirl-option-list_2.cjs.entry.js +1 -1
  26. package/dist/cjs/swirl-pagination.cjs.entry.js +1 -1
  27. package/dist/cjs/swirl-pdf-reader.cjs.entry.js +1 -1
  28. package/dist/cjs/swirl-popover_2.cjs.entry.js +1 -1
  29. package/dist/cjs/swirl-resource-list-file-item.cjs.entry.js +8 -9
  30. package/dist/cjs/swirl-search.cjs.entry.js +8 -9
  31. package/dist/cjs/swirl-select.cjs.entry.js +1 -1
  32. package/dist/cjs/swirl-shell-layout.cjs.entry.js +1 -1
  33. package/dist/cjs/swirl-tab-bar.cjs.entry.js +1 -1
  34. package/dist/cjs/swirl-table-column.cjs.entry.js +1 -1
  35. package/dist/cjs/swirl-table-row.cjs.entry.js +1 -1
  36. package/dist/cjs/swirl-table.cjs.entry.js +1 -1
  37. package/dist/cjs/swirl-tabs.cjs.entry.js +1 -1
  38. package/dist/cjs/swirl-text-input.cjs.entry.js +8 -9
  39. package/dist/cjs/swirl-time-input.cjs.entry.js +8 -9
  40. package/dist/cjs/swirl-toast.cjs.entry.js +8 -9
  41. package/dist/cjs/swirl-toolbar.cjs.entry.js +1 -1
  42. package/dist/cjs/{utils-b7a6f714.js → utils-4f225daf.js} +6 -0
  43. package/dist/collection/components/swirl-action-list-item/swirl-action-list-item.js +7 -12
  44. package/dist/collection/components/swirl-app-layout/swirl-app-layout.js +11 -12
  45. package/dist/collection/components/swirl-banner/swirl-banner.js +7 -9
  46. package/dist/collection/components/swirl-button/swirl-button.js +8 -11
  47. package/dist/collection/components/swirl-chip/swirl-chip.js +7 -9
  48. package/dist/collection/components/swirl-date-input/swirl-date-input.js +8 -9
  49. package/dist/collection/components/swirl-file-chip/swirl-file-chip.css +3 -3
  50. package/dist/collection/components/swirl-file-chip/swirl-file-chip.js +5 -2
  51. package/dist/collection/components/swirl-file-chip/swirl-file-chip.spec.js +8 -0
  52. package/dist/collection/components/swirl-form-control/swirl-form-control.js +27 -12
  53. package/dist/collection/components/swirl-inline-error/swirl-inline-error.js +7 -9
  54. package/dist/collection/components/swirl-inline-status/swirl-inline-status.js +7 -9
  55. package/dist/collection/components/swirl-option-list-item/swirl-option-list-item.js +9 -12
  56. package/dist/collection/components/swirl-resource-list-file-item/swirl-resource-list-file-item.js +7 -9
  57. package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.css +1 -0
  58. package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +8 -11
  59. package/dist/collection/components/swirl-search/swirl-search.js +7 -9
  60. package/dist/collection/components/swirl-text-input/swirl-text-input.js +7 -9
  61. package/dist/collection/components/swirl-time-input/swirl-time-input.js +7 -9
  62. package/dist/collection/components/swirl-toast/swirl-toast.js +7 -9
  63. package/dist/collection/services/media-query.service.js +19 -0
  64. package/dist/collection/utils.js +5 -0
  65. package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
  66. package/dist/components/media-query.service.js +22 -0
  67. package/dist/components/swirl-action-list-item2.js +7 -12
  68. package/dist/components/swirl-app-layout2.js +11 -12
  69. package/dist/components/swirl-banner.js +7 -9
  70. package/dist/components/swirl-button2.js +8 -11
  71. package/dist/components/swirl-chip.js +7 -9
  72. package/dist/components/swirl-date-input.js +8 -9
  73. package/dist/components/swirl-file-chip.js +20 -11
  74. package/dist/components/swirl-form-control.js +27 -13
  75. package/dist/components/swirl-inline-error2.js +7 -9
  76. package/dist/components/swirl-inline-status.js +7 -9
  77. package/dist/components/swirl-option-list-item2.js +9 -12
  78. package/dist/components/swirl-resource-list-file-item.js +7 -9
  79. package/dist/components/swirl-resource-list-item2.js +9 -12
  80. package/dist/components/swirl-search.js +7 -9
  81. package/dist/components/swirl-text-input2.js +7 -9
  82. package/dist/components/swirl-time-input.js +7 -9
  83. package/dist/components/swirl-toast2.js +7 -9
  84. package/dist/components/utils.js +6 -1
  85. package/dist/esm/loader.js +1 -1
  86. package/dist/esm/media-query.service-9a0ff1cb.js +22 -0
  87. package/dist/esm/swirl-action-list_2.entry.js +8 -12
  88. package/dist/esm/swirl-app-layout_5.entry.js +19 -23
  89. package/dist/esm/swirl-autocomplete.entry.js +1 -1
  90. package/dist/esm/swirl-banner.entry.js +8 -9
  91. package/dist/esm/swirl-button.entry.js +9 -11
  92. package/dist/esm/swirl-carousel.entry.js +1 -1
  93. package/dist/esm/swirl-chip.entry.js +8 -9
  94. package/dist/esm/swirl-components.js +1 -1
  95. package/dist/esm/swirl-console-layout.entry.js +1 -1
  96. package/dist/esm/swirl-date-input.entry.js +8 -9
  97. package/dist/esm/swirl-date-picker_2.entry.js +1 -1
  98. package/dist/esm/swirl-file-chip.entry.js +6 -3
  99. package/dist/esm/swirl-file-viewer_8.entry.js +1 -1
  100. package/dist/esm/swirl-form-control.entry.js +26 -13
  101. package/dist/esm/swirl-icon-check-small_2.entry.js +10 -12
  102. package/dist/esm/swirl-icon-error_3.entry.js +8 -9
  103. package/dist/esm/swirl-image-grid-item.entry.js +1 -1
  104. package/dist/esm/swirl-inline-status.entry.js +8 -9
  105. package/dist/esm/swirl-lightbox.entry.js +1 -1
  106. package/dist/esm/swirl-menu-item.entry.js +1 -1
  107. package/dist/esm/swirl-menu.entry.js +1 -1
  108. package/dist/esm/swirl-option-list_2.entry.js +1 -1
  109. package/dist/esm/swirl-pagination.entry.js +1 -1
  110. package/dist/esm/swirl-pdf-reader.entry.js +1 -1
  111. package/dist/esm/swirl-popover_2.entry.js +1 -1
  112. package/dist/esm/swirl-resource-list-file-item.entry.js +8 -9
  113. package/dist/esm/swirl-search.entry.js +8 -9
  114. package/dist/esm/swirl-select.entry.js +1 -1
  115. package/dist/esm/swirl-shell-layout.entry.js +1 -1
  116. package/dist/esm/swirl-tab-bar.entry.js +1 -1
  117. package/dist/esm/swirl-table-column.entry.js +1 -1
  118. package/dist/esm/swirl-table-row.entry.js +1 -1
  119. package/dist/esm/swirl-table.entry.js +1 -1
  120. package/dist/esm/swirl-tabs.entry.js +1 -1
  121. package/dist/esm/swirl-text-input.entry.js +8 -9
  122. package/dist/esm/swirl-time-input.entry.js +8 -9
  123. package/dist/esm/swirl-toast.entry.js +8 -9
  124. package/dist/esm/swirl-toolbar.entry.js +1 -1
  125. package/dist/esm/{utils-0cdf2a1e.js → utils-28df99ee.js} +6 -1
  126. package/dist/swirl-components/p-01f6d9f7.entry.js +1 -0
  127. package/dist/swirl-components/{p-9efd3512.entry.js → p-0657e672.entry.js} +1 -1
  128. package/dist/swirl-components/{p-6151ce60.entry.js → p-116b0b79.entry.js} +1 -1
  129. package/dist/swirl-components/{p-a8c32e22.entry.js → p-18a5d961.entry.js} +1 -1
  130. package/dist/swirl-components/{p-8ff403f9.entry.js → p-342453b8.entry.js} +1 -1
  131. package/dist/swirl-components/{p-e266f49e.entry.js → p-3fbc754b.entry.js} +1 -1
  132. package/dist/swirl-components/{p-6ee7104a.entry.js → p-4326c599.entry.js} +1 -1
  133. package/dist/swirl-components/p-4bdd342f.entry.js +1 -0
  134. package/dist/swirl-components/{p-6883e785.entry.js → p-4c7278e7.entry.js} +1 -1
  135. package/dist/swirl-components/{p-3ce549f7.entry.js → p-54d8b273.entry.js} +1 -1
  136. package/dist/swirl-components/{p-fd170d86.entry.js → p-58459af7.entry.js} +1 -1
  137. package/dist/swirl-components/p-66a6ef4e.js +1 -0
  138. package/dist/swirl-components/{p-e6d28a3b.entry.js → p-6d4ad312.entry.js} +1 -1
  139. package/dist/swirl-components/{p-bd65c4ff.entry.js → p-6dac4d2d.entry.js} +1 -1
  140. package/dist/swirl-components/{p-f327707e.entry.js → p-6dc03904.entry.js} +1 -1
  141. package/dist/swirl-components/{p-a61dd959.entry.js → p-6f5c8919.entry.js} +1 -1
  142. package/dist/swirl-components/p-71f229c5.entry.js +1 -0
  143. package/dist/swirl-components/p-7d2f064b.entry.js +1 -0
  144. package/dist/swirl-components/{p-0212df50.entry.js → p-7ffa902d.entry.js} +1 -1
  145. package/dist/swirl-components/p-9d4f99b2.entry.js +1 -0
  146. package/dist/swirl-components/{p-d17891c6.entry.js → p-9de51fe6.entry.js} +1 -1
  147. package/dist/swirl-components/{p-75f4a7b1.entry.js → p-9dee1041.entry.js} +1 -1
  148. package/dist/swirl-components/p-a256f2e4.entry.js +1 -0
  149. package/dist/swirl-components/p-a692f31d.entry.js +1 -0
  150. package/dist/swirl-components/p-a7f421b2.entry.js +1 -0
  151. package/dist/swirl-components/{p-81d9d1e2.entry.js → p-b0882434.entry.js} +1 -1
  152. package/dist/swirl-components/{p-17ea3af1.entry.js → p-b4a18fa0.entry.js} +1 -1
  153. package/dist/swirl-components/p-bf70f6fa.entry.js +1 -0
  154. package/dist/swirl-components/p-c344994e.entry.js +1 -0
  155. package/dist/swirl-components/p-c817bbf2.entry.js +1 -0
  156. package/dist/swirl-components/p-d0196e17.entry.js +1 -0
  157. package/dist/swirl-components/p-db3132a6.entry.js +1 -0
  158. package/dist/swirl-components/{p-72c83e56.entry.js → p-dc5295de.entry.js} +1 -1
  159. package/dist/swirl-components/{p-b2020b3c.entry.js → p-dd5dfce9.entry.js} +1 -1
  160. package/dist/swirl-components/p-dd74a7bd.entry.js +1 -0
  161. package/dist/swirl-components/{p-3d741780.entry.js → p-defe37bc.entry.js} +1 -1
  162. package/dist/swirl-components/p-e4cda03f.entry.js +1 -0
  163. package/dist/swirl-components/p-e8332857.entry.js +1 -0
  164. package/dist/swirl-components/{p-9f6bfdbf.js → p-f078017d.js} +1 -1
  165. package/dist/swirl-components/swirl-components.esm.js +1 -1
  166. package/dist/types/components/swirl-action-list-item/swirl-action-list-item.d.ts +1 -3
  167. package/dist/types/components/swirl-app-layout/swirl-app-layout.d.ts +1 -2
  168. package/dist/types/components/swirl-banner/swirl-banner.d.ts +1 -2
  169. package/dist/types/components/swirl-button/swirl-button.d.ts +1 -2
  170. package/dist/types/components/swirl-chip/swirl-chip.d.ts +1 -2
  171. package/dist/types/components/swirl-date-input/swirl-date-input.d.ts +1 -2
  172. package/dist/types/components/swirl-form-control/swirl-form-control.d.ts +3 -1
  173. package/dist/types/components/swirl-inline-error/swirl-inline-error.d.ts +1 -2
  174. package/dist/types/components/swirl-inline-status/swirl-inline-status.d.ts +1 -2
  175. package/dist/types/components/swirl-option-list-item/swirl-option-list-item.d.ts +1 -2
  176. package/dist/types/components/swirl-resource-list-file-item/swirl-resource-list-file-item.d.ts +1 -2
  177. package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +1 -2
  178. package/dist/types/components/swirl-search/swirl-search.d.ts +1 -2
  179. package/dist/types/components/swirl-text-input/swirl-text-input.d.ts +1 -2
  180. package/dist/types/components/swirl-time-input/swirl-time-input.d.ts +1 -2
  181. package/dist/types/components/swirl-toast/swirl-toast.d.ts +1 -2
  182. package/dist/types/services/media-query.service.d.ts +10 -0
  183. package/dist/types/utils.d.ts +1 -0
  184. package/package.json +1 -1
  185. package/dist/swirl-components/p-003420ed.entry.js +0 -1
  186. package/dist/swirl-components/p-1848ed27.entry.js +0 -1
  187. package/dist/swirl-components/p-3440a0a7.entry.js +0 -1
  188. package/dist/swirl-components/p-4336b76f.entry.js +0 -1
  189. package/dist/swirl-components/p-4f100063.entry.js +0 -1
  190. package/dist/swirl-components/p-66fd3146.entry.js +0 -1
  191. package/dist/swirl-components/p-6a8e2781.entry.js +0 -1
  192. package/dist/swirl-components/p-7ad8cfda.entry.js +0 -1
  193. package/dist/swirl-components/p-89785229.entry.js +0 -1
  194. package/dist/swirl-components/p-ad19624f.entry.js +0 -1
  195. package/dist/swirl-components/p-de22e8e2.entry.js +0 -1
  196. package/dist/swirl-components/p-e3999150.entry.js +0 -1
  197. package/dist/swirl-components/p-e5b06e45.entry.js +0 -1
  198. package/dist/swirl-components/p-e6048064.entry.js +0 -1
  199. package/dist/swirl-components/p-ef6a438b.entry.js +0 -1
  200. package/dist/swirl-components/p-f1f234c5.entry.js +0 -1
@@ -2,14 +2,12 @@ import { h, Host, } from "@stencil/core";
2
2
  import classnames from "classnames";
3
3
  import { format, isValid, parse } from "date-fns";
4
4
  import { create as createMask } from "maska/dist/es6/maska";
5
- import { getDesktopMediaQuery, isMobileViewport } from "../../utils";
5
+ import { DesktopMediaQuery } from "../../services/media-query.service";
6
+ import { isMobileViewport } from "../../utils";
6
7
  const internalDateFormat = "yyyy-MM-dd";
7
8
  export class SwirlDateInput {
8
9
  constructor() {
9
- this.desktopMediaQuery = getDesktopMediaQuery();
10
- this.desktopMediaQueryHandler = (event) => {
11
- this.updateIconSize(event.matches);
12
- };
10
+ this.mediaQueryUnsubscribe = () => { };
13
11
  this.onChange = (event) => {
14
12
  const value = event.target.value;
15
13
  if (value === "") {
@@ -88,8 +86,9 @@ export class SwirlDateInput {
88
86
  }
89
87
  componentDidLoad() {
90
88
  this.setupMask();
91
- this.updateIconSize(this.desktopMediaQuery.matches);
92
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
89
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
90
+ this.updateIconSize(isDesktop);
91
+ });
93
92
  // see https://stackoverflow.com/a/27314017
94
93
  if (this.autoFocus) {
95
94
  this.focus();
@@ -97,7 +96,7 @@ export class SwirlDateInput {
97
96
  }
98
97
  disconnectedCallback() {
99
98
  this.mask?.destroy();
100
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
99
+ this.mediaQueryUnsubscribe();
101
100
  }
102
101
  watchFormat() {
103
102
  this.setupMask();
@@ -148,7 +147,7 @@ export class SwirlDateInput {
148
147
  const className = classnames("date-input", {
149
148
  "date-input--inline": this.inline,
150
149
  });
151
- return (h(Host, { key: 'b6ddc22bcdc331f61fca4b108b4d34f4d7f4eccd' }, h("div", { key: 'd92b1daa42c5e2fb64c378621bf50b0440813252', class: className }, h("input", { key: 'a775ec1989a9e35f3dbe380e5f7f83170bb5d1fe', "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, readonly: this.readonly, id: this.id, inputmode: "numeric", onClick: this.onClick, onMouseDown: this.onMouseDown, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { key: '1fd79df32d35be0951b49a2ce141309b2938d4c3', swirlPopover: `popover-${this.id}` }, h("button", { key: '11680b4c3bfee66566fd895c5399b5c860f7b771', "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { key: '91563a1eb521b7beceb4f967b091c44445d04b60', size: this.iconSize })))), !this.disabled && (h("swirl-popover", { key: '7b7534da460943832ed5cc8d786dd316a4e442c3', animation: "scale-in-y", class: "date-input__date-picker-popover", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { key: '74b13475c333443ae34d68fa7ac78e63c79c1c1e', disableDate: this.datePickerDisableDate, firstDayOfWeek: this.firstDayOfWeek, labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue, startDate: dateValue })))));
150
+ return (h(Host, { key: 'b08bf17f0edd807a419199a88ba2ca14b0a2e4b6' }, h("div", { key: '5543669cbc75241146e2808293631e007914e258', class: className }, h("input", { key: '85836403ef82b583fad6a4118dc4532aa482e01b', "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, readonly: this.readonly, id: this.id, inputmode: "numeric", onClick: this.onClick, onMouseDown: this.onMouseDown, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { key: '2054f02531393bbb345c78ed79dc620ce491e90a', swirlPopover: `popover-${this.id}` }, h("button", { key: '6aa6a53cd62693a74be31f1e2c1ed6f42d8dccec', "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { key: '87745196a9f9a67938410acf56ca36b6d7396711', size: this.iconSize })))), !this.disabled && (h("swirl-popover", { key: '29e15ada59823318ef9c05aae7813eeda1e8ecbb', animation: "scale-in-y", class: "date-input__date-picker-popover", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { key: '65b8374a92785362f5b9060d4ddd83c5d518c5bd', disableDate: this.datePickerDisableDate, firstDayOfWeek: this.firstDayOfWeek, labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue, startDate: dateValue })))));
152
151
  }
153
152
  static get is() { return "swirl-date-input"; }
154
153
  static get encapsulation() { return "scoped"; }
@@ -19,17 +19,17 @@
19
19
  }
20
20
 
21
21
 
22
- .file-chip:hover.file-chip--one-action .file-chip__info > * {
22
+ .file-chip:hover.file-chip--one-action .file-chip__info > *, .file-chip:focus-within.file-chip--one-action .file-chip__info > * {
23
23
  width: calc(100% - 44px - var(--s-space-12));
24
24
  }
25
25
 
26
26
 
27
- .file-chip:hover.file-chip--two-actions .file-chip__info > * {
27
+ .file-chip:hover.file-chip--two-actions .file-chip__info > *, .file-chip:focus-within.file-chip--two-actions .file-chip__info > * {
28
28
  width: calc(100% - 88px - var(--s-space-12));
29
29
  }
30
30
 
31
31
 
32
- .file-chip:hover .file-chip__actions {
32
+ .file-chip:hover .file-chip__actions, .file-chip:focus-within .file-chip__actions {
33
33
  opacity: 1;
34
34
  }
35
35
 
@@ -1,7 +1,7 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import { saveAs } from "file-saver";
3
3
  import classnames from "classnames";
4
- import { isAudioMimeType, isCompressedArchiveMimeType, isImageMimeType, isPdfMimeType, isVideoMimeType, } from "../../utils";
4
+ import { isAudioMimeType, isCompressedArchiveMimeType, isDocumentMimeType, isImageMimeType, isPdfMimeType, isVideoMimeType, } from "../../utils";
5
5
  export class SwirlFileChip {
6
6
  constructor() {
7
7
  this.handleDownloadClick = () => {
@@ -51,6 +51,9 @@ export class SwirlFileChip {
51
51
  else if (isCompressedArchiveMimeType(this.type)) {
52
52
  return h("swirl-icon-folder", null);
53
53
  }
54
+ else if (isDocumentMimeType(this.type)) {
55
+ return h("swirl-icon-file", null);
56
+ }
54
57
  else {
55
58
  return h("swirl-icon-attachment", null);
56
59
  }
@@ -62,7 +65,7 @@ export class SwirlFileChip {
62
65
  "file-chip--one-action": actionCount === 1,
63
66
  "file-chip--two-actions": actionCount === 2,
64
67
  });
65
- return (h(Host, { key: '6bb82407abd2caedf8e8e3dbdb08685ead172764' }, h("span", { key: '10a71f96282accfa427b0bf8d682eff5121382f5', role: "group", class: className }, h("span", { key: '67c7d86b2634d47b8a92b637c8640f50fe163779', class: "file-chip__icon" }, this.getFileIcon()), h("span", { key: '1d725f11420cf6d1a3d87141e4b7947494a2fcd1', class: "file-chip__info" }, h("span", { key: '4ea4d1165c422d859d7d31e14cf8f2a28fd000a2', class: "file-chip__name", title: this.name }, this.name), this.description && (h("span", { key: 'dfe58e30c3ef1a866d87f896fb933ad74cfa06c5', class: "file-chip__description" }, this.description))), h("swirl-button-group", { key: 'b1a25c531577816ae713816924718709a411cd06', class: "file-chip__actions" }, this.showPreviewButton && (h("swirl-button", { key: '8beec8259386d52de103dbee165ce6c80604d55a', variant: "flat", icon: "<swirl-icon-preview></swirl-icon-preview>", onClick: this.handlePreviewClick, label: this.previewButtonLabel, hideLabel: true, part: "file-chip__preview" })), this.showDownloadButton && (h("swirl-button", { key: '187724687cfcbc72ed553c6924ff39f4427a72bf', variant: "flat", icon: "<swirl-icon-download></swirl-icon-download>", onClick: this.handleDownloadClick, label: this.downloadButtonLabel, hideLabel: true, part: "file-chip__download" }))))));
68
+ return (h(Host, { key: '8ba0390953507f3c39fdb662c2714a721c1f048b' }, h("span", { key: '97a4e2627f6490a237cde23f54347e320e8065b5', role: "group", class: className }, h("span", { key: 'f6dee9b3416db43baeeb3854995d94ef1142607f', class: "file-chip__icon" }, this.getFileIcon()), h("span", { key: '29d1a7aa234ceb846039004e8439db4441a32ba1', class: "file-chip__info" }, h("span", { key: '8594d492fd758e59797dff9b0923b2e2ec5bdc86', class: "file-chip__name", title: this.name }, this.name), this.description && (h("span", { key: '887570df6590394016b9b0a4a49e06e6719acb53', class: "file-chip__description" }, this.description))), h("swirl-button-group", { key: '9fee7eaf170777b86fd33b98c069e641fa7eab02', class: "file-chip__actions" }, this.showPreviewButton && (h("swirl-button", { key: '647360858f679d9eb4a65947f2839dec369d1a08', variant: "flat", icon: "<swirl-icon-preview></swirl-icon-preview>", onClick: this.handlePreviewClick, label: this.previewButtonLabel, hideLabel: true, part: "file-chip__preview" })), this.showDownloadButton && (h("swirl-button", { key: '6e718daf409c8f37caa228f545806f2fe7579f6d', variant: "flat", icon: "<swirl-icon-download></swirl-icon-download>", onClick: this.handleDownloadClick, label: this.downloadButtonLabel, hideLabel: true, part: "file-chip__download" }))))));
66
69
  }
67
70
  static get is() { return "swirl-file-chip"; }
68
71
  static get encapsulation() { return "shadow"; }
@@ -83,6 +83,14 @@ describe("swirl-file-chip", () => {
83
83
  const iconElement = page.root.shadowRoot.querySelector(".file-chip__icon swirl-icon-audio-file");
84
84
  expect(iconElement).toBeTruthy();
85
85
  });
86
+ it("renders document file type", async () => {
87
+ const page = await newSpecPage({
88
+ components: [SwirlFileChip],
89
+ html: `<swirl-file-chip url="https://example.com/document.doc" name="document.doc" type="application/msword"></swirl-file-chip>`,
90
+ });
91
+ const iconElement = page.root.shadowRoot.querySelector(".file-chip__icon swirl-icon-file");
92
+ expect(iconElement).toBeTruthy();
93
+ });
86
94
  it("renders text file type", async () => {
87
95
  const page = await newSpecPage({
88
96
  components: [SwirlFileChip],
@@ -64,16 +64,11 @@ export class SwirlFormControl {
64
64
  componentDidRender() {
65
65
  this.checkInputValue();
66
66
  }
67
- associateDescriptionWithInputElement() {
68
- if (!Boolean(this.description) || !Boolean(this.inputEl)) {
69
- return;
70
- }
71
- if (Boolean(this.inputEl.getAttribute("contenteditable"))) {
72
- this.inputEl.setAttribute("aria-describedby", this.descriptionId);
73
- }
74
- else {
75
- this.inputEl.setAttribute("swirl-aria-describedby", this.descriptionId);
76
- }
67
+ watchDescription() {
68
+ this.associateDescriptionWithInputElement();
69
+ }
70
+ watchErrorMessage() {
71
+ this.associateDescriptionWithInputElement();
77
72
  }
78
73
  setInputElementDisabledState() {
79
74
  if (!Boolean(this.inputEl)) {
@@ -136,6 +131,23 @@ export class SwirlFormControl {
136
131
  this.inputEl.setAttribute("aria-labelledby", this.labelId);
137
132
  this.inputEl.setAttribute("aria-describedby", this.descriptionId);
138
133
  }
134
+ associateDescriptionWithInputElement() {
135
+ if (!Boolean(this.inputEl)) {
136
+ return;
137
+ }
138
+ if (Boolean(this.description) || Boolean(this.errorMessage)) {
139
+ if (Boolean(this.inputEl.getAttribute("contenteditable"))) {
140
+ this.inputEl.setAttribute("aria-describedby", this.descriptionId);
141
+ }
142
+ else {
143
+ this.inputEl.setAttribute("swirl-aria-describedby", this.descriptionId);
144
+ }
145
+ }
146
+ else {
147
+ this.inputEl.removeAttribute("aria-describedby");
148
+ this.inputEl.removeAttribute("swirl-aria-describedby");
149
+ }
150
+ }
139
151
  render() {
140
152
  const showErrorMessage = Boolean(this.errorMessage);
141
153
  const showDescription = Boolean(this.description) && !showErrorMessage;
@@ -163,7 +175,7 @@ export class SwirlFormControl {
163
175
  "form-control--is-select": isSelect,
164
176
  });
165
177
  const LabelTag = hasContenteditableControl ? "div" : "label";
166
- return (h(Host, { key: '75f89bf5628f878c9905adc63eccdc466a1b1216', onFocusin: this.onFocusIn, onFocusout: this.onFocusOut, onKeyDown: this.onKeyDown }, h("div", { key: '029f9f8d95b0a93add2dbf1d88d3518e0ff95a97', class: className, role: "group" }, h("span", { key: 'b74c4cd72ad874cc5884e24ab5e84e637f73dde7', class: "form-control__controls" }, h("span", { key: '3e185f5b9339766db5fb50f1ac69e1c24a831904', class: "form-control__prefix" }, h("slot", { key: 'a160fe30b0c0befead143f1c0ed947fd13c72df1', name: "prefix" })), h(LabelTag, { key: '077bdc0fdca9f99383f8f66dff4930fc4ee0de21', class: "form-control__label", onClick: this.onLabelClick }, hasIcon && (h("span", { key: 'c743d337b6e2d4bcf3113cb82f0378f600dec1c7', class: "form-control__icon" }, h("swirl-icon", { key: '554f4a49720b5b0e0ca2c50789cb5542f340909a', glyph: this.icon, size: 20 }))), h("span", { key: '55852523399d32a5835355144ee744757d10efaa', class: "form-control__label-text", id: this.labelId }, this.label, this.secondaryLabel && this.labelPosition === "outside" && (h("span", { key: '5affcc782e4f7834ceac151e8cd62b199f98bfbf', class: "form-control__secondary-label" }, this.secondaryLabel)), this.tooltip && (h("span", { key: '1ba74a1a9ddbee3126743d62105d74cf7f600241', class: "form-control__tooltip" }, h("swirl-tooltip", { key: '5f4a8ab75d986099c01159e7084ad8c819be9a61', content: this.tooltip, positioning: "fixed", position: "top" }, h("swirl-icon-help", { key: '0cc87113e888aa3b99f5ad2616a39c1925b9cb87', size: 16, tabindex: "0" }))))), h("span", { key: '11492d15ac22c4bcb7e9753457ac3149a3703e00', class: "form-control__input" }, h("slot", { key: 'e4f4d01a17e4d39462f33bf1dce0bc1949dd2015' })))), showDescription && (h("span", { key: '6afcb5673ba1bee9693ff9c5405e4c7933f4888a', class: "form-control__description", id: this.descriptionId }, this.description)), showErrorMessage && (h("span", { key: '89875a4b67de19acdeecb10878e65447b4a1e88c', "aria-live": "polite", class: "form-control__error-message", id: this.descriptionId }, h("swirl-inline-error", { key: '5dd41ad22713ec400b2c01d8c8117180937aa940', message: this.errorMessage, size: "s" }))))));
178
+ return (h(Host, { key: 'f78a0f9a49ce41a080064a155f715ef89fd91587', onFocusin: this.onFocusIn, onFocusout: this.onFocusOut, onKeyDown: this.onKeyDown }, h("div", { key: 'd2fd7eb95177001c0706a6d18e48e83185f6caf9', class: className, role: "group" }, h("span", { key: 'e8fe85fc929992d48a22005c63c228c8ee14d208', class: "form-control__controls" }, h("span", { key: 'bd67548611eec6031148bf04e5b45c9d6caec594', class: "form-control__prefix" }, h("slot", { key: '5093dd090be2f2432bece77ec1d0d390fdb482bd', name: "prefix" })), h(LabelTag, { key: '30c60c1a1b7d36faa862acca026d218e38406da3', class: "form-control__label", onClick: this.onLabelClick }, hasIcon && (h("span", { key: '7f3b05a85aeac928540c1fcd7a34bebceccf786f', class: "form-control__icon" }, h("swirl-icon", { key: '12cd37a3f685e93fa7fc6b08d3fb4239e0202b36', glyph: this.icon, size: 20 }))), h("span", { key: '045cc7c094980fc107c1b47ebd0bbe37e5a4080e', class: "form-control__label-text", id: this.labelId }, this.label, this.secondaryLabel && this.labelPosition === "outside" && (h("span", { key: 'c6fdda2752f2a88ed46839213d6906c6768b7f16', class: "form-control__secondary-label" }, this.secondaryLabel)), this.tooltip && (h("span", { key: 'cf3f742e1cedd723e655f3f6d237aeb04cf26bad', class: "form-control__tooltip" }, h("swirl-tooltip", { key: 'a450c876d07b2c4f2ff90f9468554c1c897a111d', content: this.tooltip, positioning: "fixed", position: "top" }, h("swirl-icon-help", { key: '41b1b6ab4f6c240d7e7028020b15edf178129293', size: 16, tabindex: "0" }))))), h("span", { key: '968e151ce5df21d39ffd348bb696e8b6c53828c9', class: "form-control__input" }, h("slot", { key: '8b9507aae4143b57d8a29ef4ae4fa1de23d0f897' })))), showDescription && (h("span", { key: '1d2a0bada179effc4c912adc43e1ea9e8aa49ea4', class: "form-control__description", id: this.descriptionId }, this.description)), showErrorMessage && (h("span", { key: '4b1e4794cdf197fba650d97d56e752f0ed09df89', "aria-live": "polite", class: "form-control__error-message", id: this.descriptionId }, h("swirl-inline-error", { key: '505704e097a229340d566b0240be6f43af4d19f0', message: this.errorMessage, size: "s" }))))));
167
179
  }
168
180
  static get is() { return "swirl-form-control"; }
169
181
  static get encapsulation() { return "scoped"; }
@@ -409,7 +421,10 @@ export class SwirlFormControl {
409
421
  static get watchers() {
410
422
  return [{
411
423
  "propName": "description",
412
- "methodName": "associateDescriptionWithInputElement"
424
+ "methodName": "watchDescription"
425
+ }, {
426
+ "propName": "errorMessage",
427
+ "methodName": "watchErrorMessage"
413
428
  }, {
414
429
  "propName": "disabled",
415
430
  "methodName": "setInputElementDisabledState"
@@ -1,21 +1,19 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import classnames from "classnames";
3
- import { getDesktopMediaQuery } from "../../utils";
3
+ import { DesktopMediaQuery } from "../../services/media-query.service";
4
4
  export class SwirlInlineError {
5
5
  constructor() {
6
- this.desktopMediaQuery = getDesktopMediaQuery();
7
- this.desktopMediaQueryHandler = (event) => {
8
- this.forceIconProps(event.matches);
9
- };
6
+ this.mediaQueryUnsubscribe = () => { };
10
7
  this.message = undefined;
11
8
  this.size = "m";
12
9
  }
13
10
  componentDidLoad() {
14
- this.forceIconProps(this.desktopMediaQuery.matches);
15
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
11
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
12
+ this.forceIconProps(isDesktop);
13
+ });
16
14
  }
17
15
  disconnectedCallback() {
18
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
16
+ this.mediaQueryUnsubscribe();
19
17
  }
20
18
  forceIconProps(smallIcon) {
21
19
  if (!Boolean(this.iconEl)) {
@@ -33,7 +31,7 @@ export class SwirlInlineError {
33
31
  }
34
32
  render() {
35
33
  const className = classnames("inline-error", `inline-error--size-${this.size}`);
36
- return (h(Host, { key: '6303d15a3f9688dfb4cba1f2abeef8ebe84b8fc0' }, h("span", { key: '4c86820f5b1089c302197c7de6ccd0eb74d24dc5', class: className, part: "inline-error" }, h("span", { key: '8efe0709d23bff115d86a0e0f8adf8dbfe9ffe2f', class: "inline-error__icon", ref: (el) => (this.iconEl = el) }, h("swirl-icon-error", { key: 'c4d463892cdaafaefe9b295404366b0291d753aa' })), h("span", { key: '590848cd8c87f995501e87f2147b0e746151b445', class: "inline-error__message" }, this.message))));
34
+ return (h(Host, { key: '78eb4e0317497e4eb8b474bf2fc5dfe73a184a8d' }, h("span", { key: 'a60bd28648dac3243d1af914dbaa4c77fcac9829', class: className, part: "inline-error" }, h("span", { key: '67c27900c45afff291461ba8446e3d812f02c955', class: "inline-error__icon", ref: (el) => (this.iconEl = el) }, h("swirl-icon-error", { key: 'a6dbd685b5dcc2ccd50fdbf1802898cb99eb4a2d' })), h("span", { key: '7454ee5da004959bcf52ce2ca168b7aa1e81370e', class: "inline-error__message" }, this.message))));
37
35
  }
38
36
  static get is() { return "swirl-inline-error"; }
39
37
  static get encapsulation() { return "shadow"; }
@@ -1,12 +1,9 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import classnames from "classnames";
3
- import { getDesktopMediaQuery } from "../../utils";
3
+ import { DesktopMediaQuery } from "../../services/media-query.service";
4
4
  export class SwirlInlineStatus {
5
5
  constructor() {
6
- this.desktopMediaQuery = getDesktopMediaQuery();
7
- this.desktopMediaQueryHandler = (event) => {
8
- this.forceIconProps(event.matches);
9
- };
6
+ this.mediaQueryUnsubscribe = () => { };
10
7
  this.icon = undefined;
11
8
  this.intent = undefined;
12
9
  this.message = undefined;
@@ -14,11 +11,12 @@ export class SwirlInlineStatus {
14
11
  this.iconSize = 20;
15
12
  }
16
13
  componentDidLoad() {
17
- this.forceIconProps(this.desktopMediaQuery.matches);
18
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
14
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
15
+ this.forceIconProps(isDesktop);
16
+ });
19
17
  }
20
18
  disconnectedCallback() {
21
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
19
+ this.mediaQueryUnsubscribe();
22
20
  }
23
21
  forceIconProps(smallIcon) {
24
22
  if (!Boolean(this.iconEl)) {
@@ -39,7 +37,7 @@ export class SwirlInlineStatus {
39
37
  }
40
38
  render() {
41
39
  const className = classnames("inline-status", `inline-status--intent-${this.intent}`, `inline-status--size-${this.size}`);
42
- return (h(Host, { key: '2399be5d627741cba2a289842457b41fc838c28a' }, h("span", { key: '3f6ad8e7b1fd303874334fccab02b942deb31ed3', class: className, part: "inline-status" }, this.icon && (h("span", { key: '9d296ed8a4c1c232f91b7f96a2e9330bbad4d5ce', class: "inline-status__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), h("span", { key: '4a027e288e1b152c732e9881ac2eb781631f7674', class: "inline-status__message" }, this.message))));
40
+ return (h(Host, { key: '4061d83f2fe39058d8d6e6d90b9dadc73d575aa7' }, h("span", { key: 'ae51319d804419fda99def8af8fd81b25f5c9cfc', class: className, part: "inline-status" }, this.icon && (h("span", { key: 'c677da1834aef7c19041022ad7580115c1fd8ec3', class: "inline-status__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), h("span", { key: 'dbec6cd97a2cab40ccbd9670eac038d64d14137c', class: "inline-status__message" }, this.message))));
43
41
  }
44
42
  static get is() { return "swirl-inline-status"; }
45
43
  static get encapsulation() { return "shadow"; }
@@ -1,18 +1,14 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import classnames from "classnames";
3
3
  import { v4 as uuid } from "uuid";
4
- import { getDesktopMediaQuery } from "../../utils";
4
+ import { DesktopMediaQuery } from "../../services/media-query.service";
5
5
  /**
6
6
  * @slot avatar - Optional avatar displayed to the left of the label
7
7
  */
8
8
  export class SwirlOptionListItem {
9
9
  constructor() {
10
- this.desktopMediaQuery = getDesktopMediaQuery();
11
10
  this.elementId = uuid();
12
- this.desktopMediaQueryHandler = (event) => {
13
- this.forceIconProps(event.matches);
14
- this.updateIconSize(event.matches);
15
- };
11
+ this.mediaQueryUnsubscribe = () => { };
16
12
  this.onDragHandleKeyDown = (event) => {
17
13
  if (event.code === "Space" || event.code === "Enter") {
18
14
  event.preventDefault();
@@ -42,12 +38,13 @@ export class SwirlOptionListItem {
42
38
  this.focused = undefined;
43
39
  }
44
40
  componentDidLoad() {
45
- this.forceIconProps(this.desktopMediaQuery.matches);
46
- this.updateIconSize(this.desktopMediaQuery.matches);
47
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
41
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
42
+ this.forceIconProps(isDesktop);
43
+ this.updateIconSize(isDesktop);
44
+ });
48
45
  }
49
46
  disconnectedCallback() {
50
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
47
+ this.mediaQueryUnsubscribe();
51
48
  }
52
49
  forceIconProps(smallIcon) {
53
50
  const icon = this.iconEl?.children[0];
@@ -71,9 +68,9 @@ export class SwirlOptionListItem {
71
68
  "option-list-item--selected": this.selected,
72
69
  "option-list-item--show-avatar": showAvatar,
73
70
  });
74
- return (h(Host, { key: 'd10255b1a3ce16def32576bcfce8b007122e80fc' }, h("div", { key: '67d2f23595c118dc104cc0c1bec3aa516d514783', "aria-checked": this.swirlAriaRole === "menuitemradio" ? ariaSelected : undefined, "aria-describedby": Boolean(this.description)
71
+ return (h(Host, { key: 'f10b9d5998e571b30de2b9755b20aa9ff6553b7c' }, h("div", { key: '7351b14adf1f9b8e7f6c8fe95bff82703e3cb0c8', "aria-checked": this.swirlAriaRole === "menuitemradio" ? ariaSelected : undefined, "aria-describedby": Boolean(this.description)
75
72
  ? `option-list-item-${this.elementId}-description`
76
- : undefined, "aria-disabled": ariaDisabled, "aria-labelledby": `option-list-item-${this.elementId}-label`, "aria-selected": this.swirlAriaRole === "option" ? ariaSelected : undefined, class: className, id: `option-list-item-${this.elementId}`, onBlur: this.onBlur, onFocus: this.onFocus, part: "option-list-item", role: this.swirlAriaRole }, showIcon && (h("span", { key: '12c511dd3c23e90f0d4cc988daa0c9992cc71c60', class: "option-list-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) }, showIconBadge && (h("span", { key: '9041ef204b95835c99fa409268337c553079d6c2', class: "option-list-item__icon-badge", innerHTML: this.iconBadge })))), showCheckbox && (h("span", { key: '37ccff8e7e31a78eac6f9a1ede06e55123755a8f', class: "option-list-item__checkbox" }, h("span", { key: 'd0b3a8115a097ee4f538bf6ce64f4de6fe9e5c87', class: "option-list-item__checkbox-box" }, this.selected && (h("swirl-icon-check-strong", { key: '732bfb290c9c6038ec11001919c3bdd658843490', class: "option-list-item__checkbox-icon", size: 16 }))))), h("span", { key: 'd2810259d04b5d49d40d0774c98ee56a7f5f7226', class: "option-list-item__avatar" }, h("slot", { key: '042f2a3c70063fd130fec296ccddec084d56aec4', name: "avatar" })), h("span", { key: '61032284deee69c6dc2a66fc0627a5dbedd1dc75', class: "option-list-item__label-container" }, h("span", { key: '320288d88e77a1e8033f102147e046e7fd52a98b', class: "option-list-item__label", id: `option-list-item-${this.elementId}-label`, part: "option-list-item__label" }, this.label), this.description && (h("span", { key: '6af76305ce6ac4fd64d562801ae976a265075cac', class: "option-list-item__description", id: `option-list-item-${this.elementId}-description` }, this.description))), showSelectionIcon && (h("span", { key: 'd9a049efa8acc2f8e163bb201d537fa09e6e215c', class: "option-list-item__selection-icon" }, h("swirl-icon-check-small", { key: '57ce2025b73bdf1d5303b6c6abc1bc27f6f4beb6', size: this.iconSize })))), this.allowDrag && (h("button", { key: '94f9abc9e467ee5e7ca0bb20cbb41759cefe4207', "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "option-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, tabIndex: this.focused ? 0 : -1, type: "button" }, h("swirl-icon-drag-handle", { key: '3bf3b75c4fc6ea020ef18d595d80d8529ec227bf', size: this.iconSize })))));
73
+ : undefined, "aria-disabled": ariaDisabled, "aria-labelledby": `option-list-item-${this.elementId}-label`, "aria-selected": this.swirlAriaRole === "option" ? ariaSelected : undefined, class: className, id: `option-list-item-${this.elementId}`, onBlur: this.onBlur, onFocus: this.onFocus, part: "option-list-item", role: this.swirlAriaRole }, showIcon && (h("span", { key: '28b5bf751e4b6f040e217976431cc10ccc18b2ab', class: "option-list-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) }, showIconBadge && (h("span", { key: '17d8ee99d49bc39e9c29acbdefa6a33ac1fe011f', class: "option-list-item__icon-badge", innerHTML: this.iconBadge })))), showCheckbox && (h("span", { key: 'c96a9aa51eb3d24d8d2981e72f57258ec104a4f0', class: "option-list-item__checkbox" }, h("span", { key: 'e5e16760dac9d5f8fd32dfc1a87b276bac40e218', class: "option-list-item__checkbox-box" }, this.selected && (h("swirl-icon-check-strong", { key: '19678c01717c67032d419f1c081c79dd3d2d86d2', class: "option-list-item__checkbox-icon", size: 16 }))))), h("span", { key: '206a3376c0fc0cc5fc251417d3807cb9d021dcc8', class: "option-list-item__avatar" }, h("slot", { key: 'd017728bbc40c000fd35fb1baa92ea4c01f730a2', name: "avatar" })), h("span", { key: '0fd4cec5ad5274106c2db52c304bc1877bbb03fd', class: "option-list-item__label-container" }, h("span", { key: 'b3e61b55ed5e5a0f40a59ee5ff6705ba0f170915', class: "option-list-item__label", id: `option-list-item-${this.elementId}-label`, part: "option-list-item__label" }, this.label), this.description && (h("span", { key: 'a789b71d53ce36c63aacba3136d29e778da6c506', class: "option-list-item__description", id: `option-list-item-${this.elementId}-description` }, this.description))), showSelectionIcon && (h("span", { key: 'cc615418e02db15288d1038518c032216db71025', class: "option-list-item__selection-icon" }, h("swirl-icon-check-small", { key: '6f06dee5b1cd618ad9fabb61b6bf9f4abf07fa0a', size: this.iconSize })))), this.allowDrag && (h("button", { key: '1bad552ed0a4324962a5e4735bc4330bb44cd3ea', "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "option-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, tabIndex: this.focused ? 0 : -1, type: "button" }, h("swirl-icon-drag-handle", { key: '124518bd0178c8e3e8021b5519ae751213f2e99a', size: this.iconSize })))));
77
74
  }
78
75
  static get is() { return "swirl-option-list-item"; }
79
76
  static get encapsulation() { return "scoped"; }
@@ -1,12 +1,9 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import classnames from "classnames";
3
- import { getDesktopMediaQuery } from "../../utils";
3
+ import { DesktopMediaQuery } from "../../services/media-query.service";
4
4
  export class SwirlResourceListFileItem {
5
5
  constructor() {
6
- this.desktopMediaQuery = getDesktopMediaQuery();
7
- this.desktopMediaQueryHandler = (event) => {
8
- this.forceIconProps(event.matches);
9
- };
6
+ this.mediaQueryUnsubscribe = () => { };
10
7
  this.description = undefined;
11
8
  this.errorMessage = undefined;
12
9
  this.icon = "<swirl-icon-file></swirl-icon-file>";
@@ -16,11 +13,12 @@ export class SwirlResourceListFileItem {
16
13
  this.removeButtonLabel = "Remove file";
17
14
  }
18
15
  componentDidLoad() {
19
- this.forceIconProps(this.desktopMediaQuery.matches);
20
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
16
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
17
+ this.forceIconProps(isDesktop);
18
+ });
21
19
  }
22
20
  disconnectedCallback() {
23
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
21
+ this.mediaQueryUnsubscribe();
24
22
  }
25
23
  forceIconProps(smallIcon) {
26
24
  if (!Boolean(this.iconEl)) {
@@ -37,7 +35,7 @@ export class SwirlResourceListFileItem {
37
35
  const className = classnames("resource-list-file-item", {
38
36
  "resource-list-file-item--has-control": showSpinner || showRemoveButton,
39
37
  });
40
- return (h(Host, { key: 'a77fb6c728aa73b07338bf27be5fe1bcff9cd5ce', role: "row" }, h("div", { key: '4f3e56655138f59ded67feb2a1c56d14d5bdbfab', class: className, part: "resource-list-file-item", role: "gridcell" }, h("span", { key: 'fd87bc5faf44da2adfe0531f14084a3716357ff0', class: "resource-list-file-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) }), h("span", { key: '591358738d945b39c9b9ffdeb8ff8420662fc2d1', class: "resource-list-file-item__label-container" }, h("span", { key: 'e542836253c3cbd2330d1ac3f8b39e9b4e44ccd4', class: "resource-list-file-item__label", id: "label" }, this.label), showDescription && (h("span", { key: 'a3fa60138b871755ddb9d6f882af6acd4add6594', class: "resource-list-file-item__description" }, this.description)), showError && (h("span", { key: '22f1d243bf021a496f5bb1096a70915099d79e6b', "aria-live": "polite", class: "resource-list-file-item__error-message" }, h("swirl-inline-error", { key: '76d645965f1c9e33ac2f74f9a5f53428fd76c430', message: this.errorMessage, size: "s" })))), showSpinner && (h("span", { key: '0e3e3962afcdd746b1a46e3dd96f56563ae34170', class: "resource-list-file-item__spinner" }, h("swirl-spinner", { key: 'cd07ad9b4b3f18f3d6d10dff309ba6451362f2ca', size: "s" }))), showRemoveButton && (h("span", { key: '0001190d82fc5a32420a465ee5bd5eaa917e0f42', class: "resource-list-file-item__remove-button" }, h("swirl-button", { key: '7a6bc7c626ab5c9060c0bfc2aae771862055fbd8', hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.removeButtonLabel, onClick: this.remove.emit }))))));
38
+ return (h(Host, { key: '00406d571fa761d38dbba9b0f662bf8fd8ccf894', role: "row" }, h("div", { key: 'ae94f2002c524e297f147eef7fb1f468259ef351', class: className, part: "resource-list-file-item", role: "gridcell" }, h("span", { key: 'b09d36edbd320f67f9a6fabf0c55b9aaba1dfcef', class: "resource-list-file-item__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) }), h("span", { key: 'e2c7ebed082e6d7e5807865df3a86a7162ca6bb9', class: "resource-list-file-item__label-container" }, h("span", { key: '3899742fff0596baec287802dbae87171934f7fd', class: "resource-list-file-item__label", id: "label" }, this.label), showDescription && (h("span", { key: '47d88eb73d4652c7575d0460db2a218002b2b765', class: "resource-list-file-item__description" }, this.description)), showError && (h("span", { key: '453f887dc5d5c4d6ce05f8fb089b05f3e6036bab', "aria-live": "polite", class: "resource-list-file-item__error-message" }, h("swirl-inline-error", { key: '6afa1e5d6a7c93bef6fbfaacae4ceb1d9d0cf5a7', message: this.errorMessage, size: "s" })))), showSpinner && (h("span", { key: '24f2fe680d14334561cdcbc395084b338fd0bb11', class: "resource-list-file-item__spinner" }, h("swirl-spinner", { key: '83a6ba6bec794a03673af8cc9fc3f1e851af17a2', size: "s" }))), showRemoveButton && (h("span", { key: 'c50ffc6f5db1880b01ba4df0dc68e20c7b1e85b7', class: "resource-list-file-item__remove-button" }, h("swirl-button", { key: '4d8f1cc62abed8353d12d57e4b87387fbc6b0895', hideLabel: true, icon: "<swirl-icon-close></swirl-icon-close>", label: this.removeButtonLabel, onClick: this.remove.emit }))))));
41
39
  }
42
40
  static get is() { return "swirl-resource-list-file-item"; }
43
41
  static get encapsulation() { return "scoped"; }
@@ -298,6 +298,7 @@
298
298
  top: 50%;
299
299
  right: var(--s-space-8);
300
300
  transform: translateY(-50%);
301
+ z-index: 2;
301
302
  }
302
303
 
303
304
  .resource-list-item__checkbox {
@@ -1,7 +1,7 @@
1
1
  import classnames from "classnames";
2
2
  import { v4 as uuid } from "uuid";
3
3
  import { h, Host, } from "@stencil/core";
4
- import { getDesktopMediaQuery } from "../../utils";
4
+ import { DesktopMediaQuery } from "../../services/media-query.service";
5
5
  /**
6
6
  * @slot control - Used to add a menu button to the item
7
7
  * @slot badges - Badges displayed inside the item
@@ -9,12 +9,8 @@ import { getDesktopMediaQuery } from "../../utils";
9
9
  */
10
10
  export class SwirlResourceListItem {
11
11
  constructor() {
12
- this.desktopMediaQuery = getDesktopMediaQuery();
13
12
  this.elementId = uuid();
14
- this.desktopMediaQueryHandler = (event) => {
15
- this.forceIconProps(event.matches);
16
- this.updateIconSize(event.matches);
17
- };
13
+ this.mediaQueryUnsubscribe = () => { };
18
14
  this.onClick = () => {
19
15
  if (!this.selectable) {
20
16
  return;
@@ -73,16 +69,17 @@ export class SwirlResourceListItem {
73
69
  this.updateMediaState();
74
70
  }
75
71
  componentDidLoad() {
76
- this.forceIconProps(this.desktopMediaQuery.matches);
77
- this.updateIconSize(this.desktopMediaQuery.matches);
78
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
72
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
73
+ this.forceIconProps(isDesktop);
74
+ this.updateIconSize(isDesktop);
75
+ });
79
76
  this.makeControlUnfocusable();
80
77
  if (Boolean(this.menuTriggerId)) {
81
78
  console.warn('[Swirl] The "menu-trigger-id" prop of swirl-resource-list-item is deprecated and will be removed with the next major release. Please use the "control" slot to add a menu button instead. https://swirl-storybook.flip-app.dev/?path=/docs/components-swirlresourcelistitem--docs');
82
79
  }
83
80
  }
84
81
  disconnectedCallback() {
85
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
82
+ this.mediaQueryUnsubscribe();
86
83
  }
87
84
  forceIconProps(smallIcon) {
88
85
  const icon = this.iconEl?.children[0];
@@ -156,7 +153,7 @@ export class SwirlResourceListItem {
156
153
  "resource-list-item--wrap-description": this.descriptionWrap,
157
154
  "resource-list-item--wrap-label": this.labelWrap,
158
155
  });
159
- return (h(Host, { key: '51070214010bb6f42b11d1451d711523908dcd24', role: "row" }, h("div", { key: '58da33a690ad26cc6cb613f7c3a120cc27c14168', class: className, role: "gridcell" }, h(Tag, { key: '4733c36969976407c76a0852e7b688005d829467', "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-label": ariaLabel, "aria-labelledby": Boolean(this.swirlAriaLabel) ? undefined : this.elementId, class: "resource-list-item__content", href: href, disabled: disabled, onClick: this.onClick, onBlur: this.onBlur, onFocus: this.onFocus, part: "resource-list-item__content", role: role, tabIndex: 0, type: Tag === "button" ? "button" : undefined }, this.hasMedia && (h("span", { key: '43feb905ed747fb0f3dce03c9bb0906e807f4cc9', class: "resource-list-item__media" }, h("slot", { key: '8bf74e8f11becef18f95a50ee78af293176e3c74', name: "media" }))), h("span", { key: 'b74ee63857ae512b974e9732d73ff2c7eb070ef6', class: "resource-list-item__label-container", style: labelContainerStyles }, h("span", { key: '7271335be0863add557483c3819bc61f0bcf3eee', class: "resource-list-item__label", id: this.elementId, innerHTML: this.allowHtml ? this.label : undefined }, !this.allowHtml && this.label), this.description && (h("span", { key: '4ddca66a33fcbe50927e3af38c6d1bea2ed67887', class: "resource-list-item__description", innerHTML: this.allowHtml ? this.description : undefined }, !this.allowHtml && this.description))), showMeta && (h("span", { key: '540c9ad85c13187700ff1607d59afc80d90529ac', class: "resource-list-item__meta" }, h("span", { key: 'cb31b8cebf261df69ebb90989e0ec0fbc3c267ee', class: "resource-list-item__meta-text" }, this.meta), h("span", { key: '57d467dfc1dff7d17e93aa0e03f1760054d85de9', class: "resource-list-item__badges" }, h("slot", { key: '18ea4383798222c2aea1dac37464b65133143604', name: "badges" }))))), this.selectable && (h("span", { key: 'aa967cf2216cd148edca930425ecbda013413850', "aria-hidden": "true", class: "resource-list-item__checkbox" }, h("span", { key: '3cc2777fbf3850ba756ed88e0ad4ae29e4caf32c', class: "resource-list-item__checkbox-icon" }, this.checked && (h("swirl-icon-check-strong", { key: '61a80c63ef99e3b530c3cc231a1abada0f1940fc' }))))), h("span", { key: 'eaaf028e6c729fc7093d355ebc6c31bc2d4a8696', class: "resource-list-item__control", onClick: this.onControlClick, ref: (el) => (this.controlContainer = el) }, h("slot", { key: 'f988fee1daed088fb4fb56a5ab262f6e8815d4f7', name: "control" })), showMenu && (h("swirl-popover-trigger", { key: '170cc8abf345cbfeeb3d86a77ad4ba081465ee4d', swirlPopover: this.menuTriggerId }, h("swirl-button", { key: 'b33497fd10358229f0125497dda088c1d0c3ee6b', "aria-disabled": disabled ? "true" : undefined, class: "resource-list-item__menu-trigger", disabled: disabled, hideLabel: true, icon: "<swirl-icon-more-horizontal></swirl-icon-more-horizontal>", intent: "primary", label: this.menuTriggerLabel, onClick: this.onMenuTriggerClick })))), this.allowDrag && (h("button", { key: '1caaaf86725af4eb4215453453ab724c5777f035', "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, h("swirl-icon-drag-handle", { key: 'eb0b87432675feb37a2f6d8de9f6228e9e921b6e', size: this.iconSize })))));
156
+ return (h(Host, { key: '63387d5ff4c56c678c6c0e30d8236d5b966d0bff', role: "row" }, h("div", { key: '6fd8f35b61a84ea91ff9ff80f6f754ee50a5933f', class: className, role: "gridcell" }, h(Tag, { key: '17e7329e6692317ad3dea70d660720c6fb8b33a5', "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-label": ariaLabel, "aria-labelledby": Boolean(this.swirlAriaLabel) ? undefined : this.elementId, class: "resource-list-item__content", href: href, disabled: disabled, onClick: this.onClick, onBlur: this.onBlur, onFocus: this.onFocus, part: "resource-list-item__content", role: role, tabIndex: 0, type: Tag === "button" ? "button" : undefined }, this.hasMedia && (h("span", { key: '4d12c2a220c03d1ee1bb77e214e028f013a23e21', class: "resource-list-item__media" }, h("slot", { key: '5d104523e7da44ceac278d5f6eebea6c2d2e516f', name: "media" }))), h("span", { key: 'cdc7fdf4a5a3e2df7080fece60638aa1d67c6388', class: "resource-list-item__label-container", style: labelContainerStyles }, h("span", { key: '187fd3a9974f65902e0fa89cb6c90b4178df7063', class: "resource-list-item__label", id: this.elementId, innerHTML: this.allowHtml ? this.label : undefined }, !this.allowHtml && this.label), this.description && (h("span", { key: '5047356c9b024dcdcf1299cc8479aedb2eb7b961', class: "resource-list-item__description", innerHTML: this.allowHtml ? this.description : undefined }, !this.allowHtml && this.description))), showMeta && (h("span", { key: '1a5039459c067b4de2a540f79124ac9310f9c594', class: "resource-list-item__meta" }, h("span", { key: 'a74caa7e64e88b8cbd9be7be020d63d833f03781', class: "resource-list-item__meta-text" }, this.meta), h("span", { key: 'ae4f5a2e927b934fba247e989cfc219b09805c99', class: "resource-list-item__badges" }, h("slot", { key: '59df5cb937ffc581ad1f6470b6080561045997fd', name: "badges" }))))), this.selectable && (h("span", { key: 'a494bc2e24fd043cc3c1024e89ae0a16d7c14f86', "aria-hidden": "true", class: "resource-list-item__checkbox" }, h("span", { key: 'b0070f0ad50a683528c216d8e0d1221b53652433', class: "resource-list-item__checkbox-icon" }, this.checked && (h("swirl-icon-check-strong", { key: 'dc3cdd5fa6e9adda926966fc77d8acf44762fda5' }))))), h("span", { key: 'd5b2f9079f6cae27bca88d7b00d9eb954641e3f1', class: "resource-list-item__control", onClick: this.onControlClick, ref: (el) => (this.controlContainer = el) }, h("slot", { key: '263ee1c8cd59301ebd510a29ce29afd112fa6c32', name: "control" })), showMenu && (h("swirl-popover-trigger", { key: '16ecfb13e3bf0e3d36851671f708ce949ff3dfee', swirlPopover: this.menuTriggerId }, h("swirl-button", { key: 'a1d94f00a09a875a689c015b332a794cda4612ca', "aria-disabled": disabled ? "true" : undefined, class: "resource-list-item__menu-trigger", disabled: disabled, hideLabel: true, icon: "<swirl-icon-more-horizontal></swirl-icon-more-horizontal>", intent: "primary", label: this.menuTriggerLabel, onClick: this.onMenuTriggerClick })))), this.allowDrag && (h("button", { key: '6a580ae58f2e50fe42828d9db668260b91bb9d43', "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, h("swirl-icon-drag-handle", { key: 'e999dfe63293b3367c6d8507532761887b3835d6', size: this.iconSize })))));
160
157
  }
161
158
  static get is() { return "swirl-resource-list-item"; }
162
159
  static get encapsulation() { return "scoped"; }
@@ -1,12 +1,9 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import classnames from "classnames";
3
- import { getDesktopMediaQuery } from "../../utils";
3
+ import { DesktopMediaQuery } from "../../services/media-query.service";
4
4
  export class SwirlSearch {
5
5
  constructor() {
6
- this.desktopMediaQuery = getDesktopMediaQuery();
7
- this.desktopMediaQueryHandler = (event) => {
8
- this.forceIconProps(event.matches);
9
- };
6
+ this.mediaQueryUnsubscribe = () => { };
10
7
  this.clear = () => {
11
8
  this.input.value = "";
12
9
  this.input.focus();
@@ -35,8 +32,9 @@ export class SwirlSearch {
35
32
  this.variant = "filled";
36
33
  }
37
34
  componentDidLoad() {
38
- this.forceIconProps(this.desktopMediaQuery.matches);
39
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
35
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
36
+ this.forceIconProps(isDesktop);
37
+ });
40
38
  // see https://stackoverflow.com/a/27314017
41
39
  if (this.autoFocus) {
42
40
  setTimeout(() => {
@@ -45,7 +43,7 @@ export class SwirlSearch {
45
43
  }
46
44
  }
47
45
  disconnectedCallback() {
48
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
46
+ this.mediaQueryUnsubscribe();
49
47
  }
50
48
  forceIconProps(smallIcon) {
51
49
  if (!Boolean(this.iconEl)) {
@@ -64,7 +62,7 @@ export class SwirlSearch {
64
62
  const className = classnames("search", `search--variant-${this.variant}`, {
65
63
  "search--disabled": this.disabled,
66
64
  });
67
- return (h(Host, { key: '4092fdf29e81da467a01ce14169ef0a236fa1e81' }, h("span", { key: '8d44e68c5d1ee9dcaa87e7b072b7368060451a21', class: className, ref: (el) => (this.iconEl = el) }, h("swirl-icon-search", { key: 'a398ce6356847a6cf619cef1d8d1a1e84949a624', "aria-hidden": "true", class: "search__icon" }), h("input", { key: '4fe717d1512a62b47608dbc99042a01e438a38ef', "aria-disabled": this.disabled ? "true" : undefined, "aria-label": this.label, autoComplete: "off", autoFocus: this.autoFocus, class: "search__input", disabled: this.disabled, id: this.inputId, inputMode: "search", name: this.inputName, onBlur: this.onBlur, onChange: this.onChange, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.input = el), type: "search", value: this.value }), !this.disabled && (h("button", { key: '541696544a78036c61621ac82e9ab5071f4b69fe', "aria-label": this.clearButtonLabel, class: "search__clear-button", onClick: this.clear, type: "button" }, h("swirl-icon-cancel", { key: '57a0dbb569ca31f11ae9187c4675d90fffca4a0e' }))))));
65
+ return (h(Host, { key: 'c54510f133d5583f1cb2942a21e889a271ec083c' }, h("span", { key: 'f09bf81a55b0e0e23e78dd1929055e92fd966e90', class: className, ref: (el) => (this.iconEl = el) }, h("swirl-icon-search", { key: '9d5107940cfaff59864c6a94c5eb2a3657a9168d', "aria-hidden": "true", class: "search__icon" }), h("input", { key: 'd42dcf2414af5d7f569a6990c5e85f67bdc8b9b5', "aria-disabled": this.disabled ? "true" : undefined, "aria-label": this.label, autoComplete: "off", autoFocus: this.autoFocus, class: "search__input", disabled: this.disabled, id: this.inputId, inputMode: "search", name: this.inputName, onBlur: this.onBlur, onChange: this.onChange, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.input = el), type: "search", value: this.value }), !this.disabled && (h("button", { key: 'b6ec549ceb75a93fda65cc8fb008e00c26b133ac', "aria-label": this.clearButtonLabel, class: "search__clear-button", onClick: this.clear, type: "button" }, h("swirl-icon-cancel", { key: '7bff26d8ebc73200035936d4add57e2ef6bdd1e5' }))))));
68
66
  }
69
67
  static get is() { return "swirl-search"; }
70
68
  static get encapsulation() { return "scoped"; }
@@ -1,12 +1,9 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import classnames from "classnames";
3
- import { getDesktopMediaQuery } from "../../utils";
3
+ import { DesktopMediaQuery } from "../../services/media-query.service";
4
4
  export class SwirlTextInput {
5
5
  constructor() {
6
- this.desktopMediaQuery = getDesktopMediaQuery();
7
- this.desktopMediaQueryHandler = (event) => {
8
- this.updateIconSize(event.matches);
9
- };
6
+ this.mediaQueryUnsubscribe = () => { };
10
7
  this.clear = () => {
11
8
  this.inputEl.value = "";
12
9
  this.value = "";
@@ -102,8 +99,9 @@ export class SwirlTextInput {
102
99
  this.showPassword = false;
103
100
  }
104
101
  componentDidLoad() {
105
- this.updateIconSize(this.desktopMediaQuery.matches);
106
- this.desktopMediaQuery.addEventListener("change", this.desktopMediaQueryHandler);
102
+ this.mediaQueryUnsubscribe = DesktopMediaQuery.subscribe((isDesktop) => {
103
+ this.updateIconSize(isDesktop);
104
+ });
107
105
  // see https://stackoverflow.com/a/27314017
108
106
  if (this.autoFocus) {
109
107
  setTimeout(() => {
@@ -115,7 +113,7 @@ export class SwirlTextInput {
115
113
  this.adjustInputSize();
116
114
  }
117
115
  disconnectedCallback() {
118
- this.desktopMediaQuery.removeEventListener?.("change", this.desktopMediaQueryHandler);
116
+ this.mediaQueryUnsubscribe();
119
117
  }
120
118
  async blurInput() {
121
119
  this.inputEl.blur();
@@ -179,7 +177,7 @@ export class SwirlTextInput {
179
177
  "text-input--inline": this.inline,
180
178
  "text-input--show-password": this.type === "password" && this.showPassword,
181
179
  });
182
- return (h(Host, { key: 'c88e6bd426c87abc2e5aa4a6a67b92a33705c737' }, h("div", { key: '88e1c2cdf842a603bb81ca75abe0869c6b321e95', class: className }, this.prefixLabel && (h("span", { key: '6bc23160f6d688b9cb245d6089e129cf350f9533', class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { key: '880004143dd812f6af0f74fe9a7fa0d4ccd231fd', "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, name: this.inputName, 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 && (h("span", { key: 'e4bece6d11b65ccddb4e73b330bb7a98203553ad', class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { key: '209d064d58f71f255181a8b4c8277e94d7fc6840', "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { key: '2c10978eb66b7c9e05b194d51ff540b1774cdde7', size: this.iconSize }))), showPasswordToggle && (h("button", { key: '7d14538e3f4816f0230de3178fe8d5857b541cd2', "aria-label": this.passwordToggleLabel, class: "text-input__password-toggle", onClick: this.togglePassword, type: "button" }, this.showPassword ? (h("swirl-icon-visibility-off", { size: this.iconSize })) : (h("swirl-icon-visibility", { size: this.iconSize })))), showStepper && (h("span", { key: 'dfcabad170b5312132722cd18e3894bdda4dabee', class: "text-input__stepper" }, h("button", { key: '29fe802c07d61744a0a2411dde31ace11332c90c', "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { key: '629dbfef2caf408b3b34ddcfe3beb8305ff14dd8', size: this.iconSize })), h("button", { key: '41f995a4aff79d37d77bc67ceab02da7acbf2841', "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { key: '57101c11f11133c49f1bb422e0d78fd0701e92dd', size: this.iconSize })))), this.showCharacterCounter && (h("span", { key: 'e0e9b2a54e8d264529c213e5fe5cc225d7829353', class: "text-input__character-counter", "aria-live": "polite" }, h("swirl-visually-hidden", { key: '21f37a30db4fdc8ffd032e8fee392a2e90f41cc4' }, this.characterCounterLabel), this.value?.length || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
180
+ return (h(Host, { key: '118c43993df15e8a56132135bd6e5bd7b20c7fa5' }, h("div", { key: 'b32019d666499025e823f65c84107090b3e0bdde', class: className }, this.prefixLabel && (h("span", { key: 'e92f359d218821987e795d91ba09de0a5ac83787', class: "text-input__prefix" }, this.prefixLabel)), h(Tag, { key: '311c606dc2c9b78965d35543c79c828bbf04939d', "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, name: this.inputName, 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 && (h("span", { key: '2e2987f816f1a26b074ca67fc67d2b88031af88e', class: "text-input__suffix" }, this.suffixLabel)), showClearButton && (h("button", { key: '82218c372d0374651f5cb3a07a679c5f045dabfc', "aria-label": this.clearButtonLabel, class: "text-input__clear-button", onClick: this.clear, part: "text-input__clear-button", type: "button" }, h("swirl-icon-cancel", { key: '9c42c315b34e9a614a145d2e8a00da2b28fcc21e', size: this.iconSize }))), showPasswordToggle && (h("button", { key: 'd78dcd286ba441a8d5df0a9d9e8b02c466dab617', "aria-label": this.passwordToggleLabel, class: "text-input__password-toggle", onClick: this.togglePassword, type: "button" }, this.showPassword ? (h("swirl-icon-visibility-off", { size: this.iconSize })) : (h("swirl-icon-visibility", { size: this.iconSize })))), showStepper && (h("span", { key: 'e29c6cb14c6bb8ff7ebf67800b2b267ca0208df9', class: "text-input__stepper" }, h("button", { key: '6218def82164fd3b57015d3fb8c40391cefcf84d', "aria-hidden": "true", class: "text-input__step-button", onClick: this.increaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-less", { key: '9b338df89a94563b9f9fde0ba16cb1fae537c203', size: this.iconSize })), h("button", { key: '6d31cb2c37f9a2887c57f2350afe184a76dd09f8', "aria-hidden": "true", class: "text-input__step-button", onClick: this.decreaseValue, tabIndex: -1, type: "button" }, h("swirl-icon-expand-more", { key: 'f2b7974999012a8ad29d84dd5df8a908605f57b4', size: this.iconSize })))), this.showCharacterCounter && (h("span", { key: '4dae89e8b35db216b513bbca04dff56c48b64696', class: "text-input__character-counter", "aria-live": "polite" }, h("swirl-visually-hidden", { key: 'c48b6c6017b6b2a8524a2f3f5e9d2d8869026b3f' }, this.characterCounterLabel), this.value?.length || 0, " ", Boolean(this.maxLength) ? `/ ${this.maxLength}` : "")))));
183
181
  }
184
182
  static get is() { return "swirl-text-input"; }
185
183
  static get encapsulation() { return "scoped"; }