q2-tecton-elements 1.50.3 → 1.50.4

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 (178) hide show
  1. package/dist/cjs/click-elsewhere_2.cjs.entry.js +1 -1
  2. package/dist/cjs/{index-7f6e3c5a.js → index-49a00751.js} +36 -1
  3. package/dist/{esm/index-c8cc7209.js.map → cjs/index-49a00751.js.map} +1 -1
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/q2-action-sheet.cjs.entry.js +1 -1
  6. package/dist/cjs/q2-badge_7.cjs.entry.js +1 -1
  7. package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
  8. package/dist/cjs/q2-card.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
  10. package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
  11. package/dist/cjs/q2-chart-area.cjs.entry.js +1 -1
  12. package/dist/cjs/q2-chart-bar.cjs.entry.js +1 -1
  13. package/dist/cjs/q2-chart-donut.cjs.entry.js +1 -1
  14. package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
  15. package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
  16. package/dist/cjs/q2-data-table.cjs.entry.js +1 -1
  17. package/dist/cjs/q2-detail.cjs.entry.js +1 -1
  18. package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
  19. package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
  20. package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
  21. package/dist/cjs/q2-item.cjs.entry.js +1 -1
  22. package/dist/cjs/q2-list.cjs.entry.js +1 -1
  23. package/dist/cjs/q2-loc.cjs.entry.js +1 -1
  24. package/dist/cjs/q2-message.cjs.entry.js +1 -1
  25. package/dist/cjs/q2-month-picker.cjs.entry.js +1 -1
  26. package/dist/cjs/q2-optgroup.cjs.entry.js +1 -1
  27. package/dist/cjs/q2-option-list.cjs.entry.js +1 -1
  28. package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
  29. package/dist/cjs/q2-pill.cjs.entry.js +1 -1
  30. package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
  31. package/dist/cjs/q2-radio.cjs.entry.js +1 -1
  32. package/dist/cjs/q2-relative-time.cjs.entry.js +1 -1
  33. package/dist/cjs/q2-section.cjs.entry.js +1 -1
  34. package/dist/cjs/q2-select.cjs.entry.js +13 -5
  35. package/dist/cjs/q2-select.cjs.entry.js.map +1 -1
  36. package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
  37. package/dist/cjs/q2-stepper-vertical.cjs.entry.js +1 -1
  38. package/dist/cjs/q2-stepper.cjs.entry.js +1 -1
  39. package/dist/cjs/q2-tag.cjs.entry.js +1 -1
  40. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  41. package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
  42. package/dist/cjs/q2-tooltip.cjs.entry.js +1 -1
  43. package/dist/collection/components/q2-select/q2-select.js +19 -5
  44. package/dist/collection/components/q2-select/q2-select.js.map +1 -1
  45. package/dist/collection/components/q2-select/test/q2-select-test.spec.js +8 -8
  46. package/dist/collection/components/q2-select/test/q2-select-test.spec.js.map +1 -1
  47. package/dist/collection/utils/index.js +34 -0
  48. package/dist/collection/utils/index.js.map +1 -1
  49. package/dist/components/index2.js +35 -1
  50. package/dist/components/index2.js.map +1 -1
  51. package/dist/components/q2-select2.js +14 -6
  52. package/dist/components/q2-select2.js.map +1 -1
  53. package/dist/esm/click-elsewhere_2.entry.js +1 -1
  54. package/dist/esm/{index-c8cc7209.js → index-cbff16b3.js} +36 -2
  55. package/dist/{q2-tecton-elements/p-ff8ed604.js.map → esm/index-cbff16b3.js.map} +1 -1
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/esm/q2-action-sheet.entry.js +1 -1
  58. package/dist/esm/q2-badge_7.entry.js +1 -1
  59. package/dist/esm/q2-calendar.entry.js +1 -1
  60. package/dist/esm/q2-card.entry.js +1 -1
  61. package/dist/esm/q2-carousel-pane.entry.js +1 -1
  62. package/dist/esm/q2-carousel.entry.js +1 -1
  63. package/dist/esm/q2-chart-area.entry.js +1 -1
  64. package/dist/esm/q2-chart-bar.entry.js +1 -1
  65. package/dist/esm/q2-chart-donut.entry.js +1 -1
  66. package/dist/esm/q2-checkbox-group.entry.js +1 -1
  67. package/dist/esm/q2-checkbox.entry.js +1 -1
  68. package/dist/esm/q2-data-table.entry.js +1 -1
  69. package/dist/esm/q2-detail.entry.js +1 -1
  70. package/dist/esm/q2-dropdown-item.entry.js +1 -1
  71. package/dist/esm/q2-dropdown.entry.js +1 -1
  72. package/dist/esm/q2-editable-field.entry.js +1 -1
  73. package/dist/esm/q2-item.entry.js +1 -1
  74. package/dist/esm/q2-list.entry.js +1 -1
  75. package/dist/esm/q2-loc.entry.js +1 -1
  76. package/dist/esm/q2-message.entry.js +1 -1
  77. package/dist/esm/q2-month-picker.entry.js +1 -1
  78. package/dist/esm/q2-optgroup.entry.js +1 -1
  79. package/dist/esm/q2-option-list.entry.js +1 -1
  80. package/dist/esm/q2-pagination.entry.js +1 -1
  81. package/dist/esm/q2-pill.entry.js +1 -1
  82. package/dist/esm/q2-radio-group.entry.js +1 -1
  83. package/dist/esm/q2-radio.entry.js +1 -1
  84. package/dist/esm/q2-relative-time.entry.js +1 -1
  85. package/dist/esm/q2-section.entry.js +1 -1
  86. package/dist/esm/q2-select.entry.js +13 -5
  87. package/dist/esm/q2-select.entry.js.map +1 -1
  88. package/dist/esm/q2-stepper-pane.entry.js +1 -1
  89. package/dist/esm/q2-stepper-vertical.entry.js +1 -1
  90. package/dist/esm/q2-stepper.entry.js +1 -1
  91. package/dist/esm/q2-tag.entry.js +1 -1
  92. package/dist/esm/q2-tecton-elements.js +1 -1
  93. package/dist/esm/q2-textarea.entry.js +1 -1
  94. package/dist/esm/q2-tooltip.entry.js +1 -1
  95. package/dist/q2-tecton-elements/{p-1148b992.entry.js → p-0571b12f.entry.js} +2 -2
  96. package/dist/q2-tecton-elements/{p-0da2dfde.entry.js → p-085b8cee.entry.js} +2 -2
  97. package/dist/q2-tecton-elements/{p-016563e1.entry.js → p-0ac68b0e.entry.js} +2 -2
  98. package/dist/q2-tecton-elements/{p-13630805.entry.js → p-0e3ef3b4.entry.js} +2 -2
  99. package/dist/q2-tecton-elements/{p-b773fd31.entry.js → p-116c4bd5.entry.js} +2 -2
  100. package/dist/q2-tecton-elements/{p-8823f132.entry.js → p-119b0b32.entry.js} +2 -2
  101. package/dist/q2-tecton-elements/{p-3927fd62.entry.js → p-13c46699.entry.js} +2 -2
  102. package/dist/q2-tecton-elements/{p-c82e2e7f.entry.js → p-14fc3a88.entry.js} +2 -2
  103. package/dist/q2-tecton-elements/{p-f02deb01.entry.js → p-18e286f6.entry.js} +2 -2
  104. package/dist/q2-tecton-elements/{p-6041e3c3.entry.js → p-1d4ecfd5.entry.js} +2 -2
  105. package/dist/q2-tecton-elements/p-1e1f8113.entry.js +2 -0
  106. package/dist/q2-tecton-elements/p-1e1f8113.entry.js.map +1 -0
  107. package/dist/q2-tecton-elements/{p-181d0482.entry.js → p-20e50baf.entry.js} +2 -2
  108. package/dist/q2-tecton-elements/{p-90bd6c17.entry.js → p-20e6f53d.entry.js} +2 -2
  109. package/dist/q2-tecton-elements/{p-7dc8ad9d.entry.js → p-2b18312e.entry.js} +2 -2
  110. package/dist/q2-tecton-elements/{p-ff8ed604.js → p-33c5a660.js} +2 -2
  111. package/dist/q2-tecton-elements/p-33c5a660.js.map +1 -0
  112. package/dist/q2-tecton-elements/{p-3d7f5f4a.entry.js → p-346ecf03.entry.js} +2 -2
  113. package/dist/q2-tecton-elements/{p-6abfc75e.entry.js → p-3c47bad0.entry.js} +2 -2
  114. package/dist/q2-tecton-elements/{p-200084c2.entry.js → p-44de9917.entry.js} +2 -2
  115. package/dist/q2-tecton-elements/{p-f5ce223b.entry.js → p-455a56e9.entry.js} +2 -2
  116. package/dist/q2-tecton-elements/{p-44049830.entry.js → p-45bc4d62.entry.js} +2 -2
  117. package/dist/q2-tecton-elements/{p-1bcf4fe0.entry.js → p-480088e9.entry.js} +2 -2
  118. package/dist/q2-tecton-elements/{p-0c77ab7d.entry.js → p-62046422.entry.js} +2 -2
  119. package/dist/q2-tecton-elements/{p-e13b1b40.entry.js → p-652784fc.entry.js} +2 -2
  120. package/dist/q2-tecton-elements/{p-7a3c82b1.entry.js → p-7000a5af.entry.js} +2 -2
  121. package/dist/q2-tecton-elements/{p-7390e3d2.entry.js → p-7f09400a.entry.js} +2 -2
  122. package/dist/q2-tecton-elements/{p-f50cfb8d.entry.js → p-8796ebb9.entry.js} +2 -2
  123. package/dist/q2-tecton-elements/{p-c89b40cc.entry.js → p-8edb3d71.entry.js} +2 -2
  124. package/dist/q2-tecton-elements/{p-a4dc79c8.entry.js → p-94b185de.entry.js} +2 -2
  125. package/dist/q2-tecton-elements/{p-00d5c9c4.entry.js → p-95a4cea6.entry.js} +2 -2
  126. package/dist/q2-tecton-elements/{p-a04337ce.entry.js → p-a789f344.entry.js} +2 -2
  127. package/dist/q2-tecton-elements/{p-c620a664.entry.js → p-bb437107.entry.js} +2 -2
  128. package/dist/q2-tecton-elements/{p-f8f6acd1.entry.js → p-c2021e7e.entry.js} +2 -2
  129. package/dist/q2-tecton-elements/{p-c395c46f.entry.js → p-c8814bd9.entry.js} +2 -2
  130. package/dist/q2-tecton-elements/{p-97c0111f.entry.js → p-ce4e51a7.entry.js} +2 -2
  131. package/dist/q2-tecton-elements/{p-91586158.entry.js → p-df4ec3dc.entry.js} +2 -2
  132. package/dist/q2-tecton-elements/{p-919d614f.entry.js → p-e7ca59d5.entry.js} +2 -2
  133. package/dist/q2-tecton-elements/{p-53b0b123.entry.js → p-e8aa124c.entry.js} +2 -2
  134. package/dist/q2-tecton-elements/{p-1465cd9a.entry.js → p-f19cc37b.entry.js} +2 -2
  135. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  136. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
  137. package/dist/types/components/q2-select/q2-select.d.ts +2 -1
  138. package/dist/types/utils/index.d.ts +4 -0
  139. package/package.json +3 -3
  140. package/dist/cjs/index-7f6e3c5a.js.map +0 -1
  141. package/dist/q2-tecton-elements/p-f6e6f43e.entry.js +0 -2
  142. package/dist/q2-tecton-elements/p-f6e6f43e.entry.js.map +0 -1
  143. /package/dist/q2-tecton-elements/{p-1148b992.entry.js.map → p-0571b12f.entry.js.map} +0 -0
  144. /package/dist/q2-tecton-elements/{p-0da2dfde.entry.js.map → p-085b8cee.entry.js.map} +0 -0
  145. /package/dist/q2-tecton-elements/{p-016563e1.entry.js.map → p-0ac68b0e.entry.js.map} +0 -0
  146. /package/dist/q2-tecton-elements/{p-13630805.entry.js.map → p-0e3ef3b4.entry.js.map} +0 -0
  147. /package/dist/q2-tecton-elements/{p-b773fd31.entry.js.map → p-116c4bd5.entry.js.map} +0 -0
  148. /package/dist/q2-tecton-elements/{p-8823f132.entry.js.map → p-119b0b32.entry.js.map} +0 -0
  149. /package/dist/q2-tecton-elements/{p-3927fd62.entry.js.map → p-13c46699.entry.js.map} +0 -0
  150. /package/dist/q2-tecton-elements/{p-c82e2e7f.entry.js.map → p-14fc3a88.entry.js.map} +0 -0
  151. /package/dist/q2-tecton-elements/{p-f02deb01.entry.js.map → p-18e286f6.entry.js.map} +0 -0
  152. /package/dist/q2-tecton-elements/{p-6041e3c3.entry.js.map → p-1d4ecfd5.entry.js.map} +0 -0
  153. /package/dist/q2-tecton-elements/{p-181d0482.entry.js.map → p-20e50baf.entry.js.map} +0 -0
  154. /package/dist/q2-tecton-elements/{p-90bd6c17.entry.js.map → p-20e6f53d.entry.js.map} +0 -0
  155. /package/dist/q2-tecton-elements/{p-7dc8ad9d.entry.js.map → p-2b18312e.entry.js.map} +0 -0
  156. /package/dist/q2-tecton-elements/{p-3d7f5f4a.entry.js.map → p-346ecf03.entry.js.map} +0 -0
  157. /package/dist/q2-tecton-elements/{p-6abfc75e.entry.js.map → p-3c47bad0.entry.js.map} +0 -0
  158. /package/dist/q2-tecton-elements/{p-200084c2.entry.js.map → p-44de9917.entry.js.map} +0 -0
  159. /package/dist/q2-tecton-elements/{p-f5ce223b.entry.js.map → p-455a56e9.entry.js.map} +0 -0
  160. /package/dist/q2-tecton-elements/{p-44049830.entry.js.map → p-45bc4d62.entry.js.map} +0 -0
  161. /package/dist/q2-tecton-elements/{p-1bcf4fe0.entry.js.map → p-480088e9.entry.js.map} +0 -0
  162. /package/dist/q2-tecton-elements/{p-0c77ab7d.entry.js.map → p-62046422.entry.js.map} +0 -0
  163. /package/dist/q2-tecton-elements/{p-e13b1b40.entry.js.map → p-652784fc.entry.js.map} +0 -0
  164. /package/dist/q2-tecton-elements/{p-7a3c82b1.entry.js.map → p-7000a5af.entry.js.map} +0 -0
  165. /package/dist/q2-tecton-elements/{p-7390e3d2.entry.js.map → p-7f09400a.entry.js.map} +0 -0
  166. /package/dist/q2-tecton-elements/{p-f50cfb8d.entry.js.map → p-8796ebb9.entry.js.map} +0 -0
  167. /package/dist/q2-tecton-elements/{p-c89b40cc.entry.js.map → p-8edb3d71.entry.js.map} +0 -0
  168. /package/dist/q2-tecton-elements/{p-a4dc79c8.entry.js.map → p-94b185de.entry.js.map} +0 -0
  169. /package/dist/q2-tecton-elements/{p-00d5c9c4.entry.js.map → p-95a4cea6.entry.js.map} +0 -0
  170. /package/dist/q2-tecton-elements/{p-a04337ce.entry.js.map → p-a789f344.entry.js.map} +0 -0
  171. /package/dist/q2-tecton-elements/{p-c620a664.entry.js.map → p-bb437107.entry.js.map} +0 -0
  172. /package/dist/q2-tecton-elements/{p-f8f6acd1.entry.js.map → p-c2021e7e.entry.js.map} +0 -0
  173. /package/dist/q2-tecton-elements/{p-c395c46f.entry.js.map → p-c8814bd9.entry.js.map} +0 -0
  174. /package/dist/q2-tecton-elements/{p-97c0111f.entry.js.map → p-ce4e51a7.entry.js.map} +0 -0
  175. /package/dist/q2-tecton-elements/{p-91586158.entry.js.map → p-df4ec3dc.entry.js.map} +0 -0
  176. /package/dist/q2-tecton-elements/{p-919d614f.entry.js.map → p-e7ca59d5.entry.js.map} +0 -0
  177. /package/dist/q2-tecton-elements/{p-53b0b123.entry.js.map → p-e8aa124c.entry.js.map} +0 -0
  178. /package/dist/q2-tecton-elements/{p-1465cd9a.entry.js.map → p-f19cc37b.entry.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{r as t,c as e,h as i,F as s,g as o}from"./p-a5f18e27.js";import{c as l,d as n,l as r,a,o as c,q as h,i as d,t as p,w as u}from"./p-33c5a660.js";import{a as v,s as f}from"./p-b7554a79.js";const b="*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.q2-element-dropdown{display:none;position:absolute;background-color:var(--app-white, #ffffff);color:var(--t-text, #4d4d4d);left:0;width:100%;z-index:100;margin-top:1px;box-shadow:var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14));height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity var(--app-tween-1, 0.2s ease);border-radius:var(--tct-dropdown-border-radius, --t-dropdown-border-radius, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 4px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.q2-element-dropdown::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.q2-element-dropdown::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown.sizable{display:block;height:auto}.dropdown-open .q2-element-dropdown{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}:host([alignment=right]) .q2-element-dropdown{left:auto;right:0}:host([block]) q2-btn,:host([block]){display:block}:host{--comp-select-margin:var(--tct-select-margin, var(--tct-select-margin-top, var(--t-select-margin-top, var(--app-scale-4, 30px))) 0 var(--tct-select-margin-bottom, var(--t-select-margin-bottom, var(--app-scale-4, 30px))));display:block;margin:var(--comp-select-margin)}.q2-select-container{position:relative;display:block}.q2-select-input{margin:0;--tct-input-min-height:var(--tct-select-input-min-height, var(--t-select-input-min-height));--tct-input-max-height:var(--tct-select-input-max-height, var(--t-select-input-max-height, none))}::slotted([slot=_selected-display]){width:100%;min-height:var(--comp-selected-display-height, 44px)}.custom-display-content{position:absolute;bottom:0;left:calc(var(--tct-scale-2, var(--app-scale-2x, 10px)) + 1px);height:44px;width:calc(100% - 34px - var(--tct-scale-3, var(--app-scale-3x, 15px)));overflow:hidden;cursor:pointer;transition:left var(--tct-tween-2, var(--app-tween-1, 0.2s ease))}.custom-display-content:not([hidden]){display:flex;align-items:center}.is-searchable.is-focused .custom-display-content,.is-searchable .custom-display-content:active{left:calc(var(--tct-scale-3, var(--app-scale-3x, 15px)) + 1px)}.has-error .custom-display-content{width:calc(100% - 68px - var(--tct-scale-3, var(--app-scale-3x, 15px)))}.popover-content{display:flex;flex-direction:column-reverse}.popover-bottom-container{position:sticky;bottom:0;z-index:5}.popover-top-container{position:sticky;top:0;z-index:5}.popover-top-container .multi-select-header{padding:var(--tct-scale-2, var(--app-scale-2x, 10px)) var(--tct-scale-2, var(--app-scale-2x, 10px));background:var(--app-white);display:flex;gap:var(--app-scale-2x, 10px);align-items:center}.popover-top-container .multi-select-header fieldset{margin:0;padding:0;border:0;display:flex;gap:var(--app-scale-2x, 10px)}.popover-top-container .multi-select-header legend{padding:0;float:left}.popover-top-container .multi-select-header label{cursor:pointer;padding:var(--tct-select-multi-select-option-padding, var(--t-select-multi-select-option-padding, var(--tct-btn-badge-padding, var(--t-btn-badge-padding, 2px 5px))));font-size:var(--tct-select-multi-select-option-font-size, var(--t-select-multi-select-option-font-size, var(--tct-btn-badge-font-size, var(--t-btn-badge-font-size, inherit))));border-radius:var(--tct-select-multi-select-option-radius, var(--t-select-multi-select-option-radius, var(--tct-btn-badge-border-radius, var(--t-btn-badge-border-radius, var(--app-border-radius-1, 4px)))));background:var(--tct-select-multi-select-option-background, var(--tct-select-multi-select-option-bg, var(--t-select-multi-select-option-bg, var(--tct-badge-background, var(--tct-btn-badge-bg, var(--t-btn-badge-bg, transparent))))));color:var(--tct-select-multi-select-option-color, var(--t-select-multi-select-option-color, var(--tct-btn-badge-font-color, var(--t-btn-badge-font-color, inherit))))}.popover-top-container .multi-select-header label:hover{background:var(--tct-select-multi-select-option-hover-background, var(--tct-select-multi-select-option-hover-background-color, var(--t-select-multi-select-option-hover-background-color, var(--tct-btn-badge-hover-bg, var(--t-btn-badge-hover-bg, var(--tct-gray-14, var(--t-gray-14, var(--app-gray-l3, #f2f2f2))))))));color:var(--tct-select-multi-select-option-hover-color, var(--tct-select-multi-select-option-color, var(--t-select-multi-select-option-color, var(--tct-btn-badge-hover-font-color, var(--t-btn-badge-hover-font-color, var(--tct-gray-5, var(--t-gray-5, var(--app-gray-d2, #404040))))))))}.popover-top-container .multi-select-header input:checked+label,.popover-top-container .multi-select-header input:checked+label:enabled:hover{background:var(--tct-select-multi-select-option-active-background, var(--tct-select-multi-select-option-active-background-color, var(--t-select-multi-select-option-active-background-color, var(--tct-btn-primary-bg, var(--t-btn-primary-bg, #2e2e2e)))));color:var(--tct-select-multi-select-option-active-color, var(--t-select-multi-select-option-active-color, var(--tct-btn-primary-font-color, var(--t-btn-primary-font-color, var(--app-white, #ffffff)))))}.popover-top-container .multi-select-header input:disabled+label{opacity:var(--tct-select-multi-select-option-disabled-opacity, var(--t-select-multi-select-option-disabled-opacity, var(--tct-btn-disabled-opacity, var(--t-btn-disabled-opacity, var(--app-disabled-opacity, 0.4)))));cursor:not-allowed}.popover-top-container .multi-select-header input:focus+label{box-shadow:var(--const-double-focus-ring)}";const m=b;const g=class{constructor(i){t(this,i);this.change=e(this,"change",7);this.input=e(this,"input",7);var s;this.guid=l();this.lastTouchWasInPopover=false;this.scheduledAfterRender=[];this.addTouchEventListeners=()=>{if(!n()||!this.popoverElement)return;this.popoverElement.addEventListener("touchmove",this.handleTouchMove,{passive:true})};this.clickedElsewhere=t=>{const e=t.target;if(e.localName!=="click-elsewhere")return;t.stopPropagation();const{popoverElement:i}=this;if(!i)return;i.open=false;this.innerInputField.blur()};this.destroyEventListeners=()=>{var t;if(!n())return;(t=screen===null||screen===void 0?void 0:screen.orientation)===null||t===void 0?void 0:t.removeEventListener("change",this.handleOrientationChange);window.removeEventListener("resize",this.handleOrientationChange);visualViewport===null||visualViewport===void 0?void 0:visualViewport.removeEventListener("resize",this.handleOrientationChange);this.removeTouchEventListeners()};this.handleOrientationChange=()=>{var t,e,i;if(!n())return;let s;if(this.isModule){s=(t=window.Tecton)===null||t===void 0?void 0:t.platformDimensions.orientationType.includes("landscape")}else{s=(i=(e=screen===null||screen===void 0?void 0:screen.orientation)===null||e===void 0?void 0:e.type)===null||i===void 0?void 0:i.includes("landscape")}if(s&&this.searchable)this.searchable=false;if(!s)this.searchable=this.originalSearchable};this.handleTouchMove=t=>{if(document.activeElement===this.hostElement){const e=t.target;if(e&&e!==this.hostElement){this.inputFocused=false;this.lastTouchWasInPopover=true;e.focus()}}};this.initEventListeners=()=>{var t;if(!n())return;(t=screen===null||screen===void 0?void 0:screen.orientation)===null||t===void 0?void 0:t.addEventListener("change",this.handleOrientationChange);window.addEventListener("resize",this.handleOrientationChange);visualViewport===null||visualViewport===void 0?void 0:visualViewport.addEventListener("resize",this.handleOrientationChange)};this.initMutationObserver=()=>{const t=new MutationObserver(this.onMutationObserved);t.observe(this.hostElement,{childList:true,subtree:true});this.mutationObserver=t;this.onMutationObserved()};this.inputBlurHandler=()=>{this.inputFocused=false};this.inputChangeHandler=t=>{t.stopPropagation()};this.inputClickHandler=async t=>{t.stopPropagation();if(this.lastTouchWasInPopover&&this.open&&this.searchable){this.lastTouchWasInPopover=false;this.focusInput();return}this.lastTouchWasInPopover=false;if(v(this)){return this.executeActionSheet(t)}this.toggleDropdown();this.focusInput()};this.inputFocusHandler=()=>{this.inputFocused=true};this.inputInputHandler=t=>{t.stopPropagation();const e=t.detail.value;const i=!!this.value;if(i)this.clearValue();if(!this.open)this.openDropdownWithoutActiveElement();this.prioritizeSearch=true;this.searchText=e;this.input.emit({query:e})};this.inputKeydownHandler=t=>{if(this.readonly||this.disabled)return;const{key:e,shiftKey:i}=t;const s=e==="Tab"&&i;const o=this.hasPopoverTop||this.hasPopoverBottom;if(o&&(e==="Tab"||s))return;if(v(this,t)&&!o){return this.executeActionSheet(t)}const l=["ArrowDown","ArrowUp","PageDown","PageUp","Home","End","Escape","Tab"];if(this.searchable&&(e===" "||e==="Enter")&&this.inputField.value==""){t.preventDefault();if(!this.open)this.openDropdownWithoutActiveElement()}if(this.searchable&&!l.includes(e))return;if(this.shouldClearSearchText(t))this.clearSearchText();if(e===" ")t.preventDefault();this.handleOptionListExternalKeydown(t)};this.onCustomDisplayClick=t=>{t.stopPropagation();this.focusInput();this.toggleDropdown()};this.onMutationObserved=()=>{const{hostElement:t,hasPopoverTop:e,hasPopoverBottom:i}=this;const s=t.querySelector(".custom-display-content");const o=t.shadowRoot.querySelector('slot[name="q2-select-display"]');const l=!!o?o.assignedNodes().length>0:s.children.length>0;if(this.hasCustomDisplay!==l){this.hasCustomDisplay=l}const n=t.shadowRoot.querySelector('slot[name="popover-top"]');const r=(n===null||n===void 0?void 0:n.assignedNodes().length)>0;if(e!==r){this.hasPopoverTop=r}const a=t.shadowRoot.querySelector('slot[name="popover-bottom"]');const c=(a===null||a===void 0?void 0:a.assignedNodes().length)>0;if(i!==c){this.hasPopoverBottom=c}this.checkSelectedOptions()};this.onOptionListChange=t=>{t.stopPropagation();const{values:e}=t.detail;if(e.length===0)this.showAllOptions();this.handleSelectionChanges(t.detail)};this.onPopoverState=({detail:{open:t,action:e}})=>{if(!t||this.searchText){if(e!=="select"){this.optionList.setActiveElement(null)}this.inputField.focus()}if(this.open===t)return;this.open=t};this.removeTouchEventListeners=()=>{if(!n()||!this.popoverElement)return;this.popoverElement.removeEventListener("touchmove",this.handleTouchMove)};this.showAllOptions=()=>{this.showSelected=false};this.showSelectedOptions=()=>{this.showSelected=true};this.visibilityToggleKeyDown=t=>{const e=t.key;const i=e==="Tab"&&t.shiftKey;const s=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e);if(s)t.stopPropagation();if(i){t.stopPropagation();if(this.hasPopoverTop)return;this.optionList.setDefaultActiveElement()}};this.hasCustomDisplay=false;this.hasPopoverBottom=false;this.hasPopoverTop=false;this.inputFocused=false;this.open=false;this.prioritizeSearch=false;this.searchText="";this.showSelected=false;this.statusMessage=undefined;this.structuredSelectedOptions=[];this.ariaLabel=undefined;this.clearable=undefined;this.disabled=false;this.errors=undefined;this.hideLabel=undefined;this.hoist=!!((s=window.Tecton)===null||s===void 0?void 0:s.useActionSheets);this.invalid=undefined;this.label=undefined;this.listLabel=r("tecton.element.select.listLabel");this.minRows=3;this.multilineOptions=false;this.multiple=false;this.optional=false;this.placeholder=undefined;this.popDirection=undefined;this.popoverMaxHeight=undefined;this.popoverMode=null;this.readonly=false;this.searchable=false;this.selectedOptions=[];this.value=undefined}disconnectedCallback(){var t;(t=this.mutationObserver)===null||t===void 0?void 0:t.disconnect();this.mutationObserver=null;this.destroyEventListeners()}componentWillLoad(){this.originalSearchable=this.searchable;a(this);this.handleOrientationChange();this.buildStructuredSelectedOptions();this.handleMultilineOptionsUpdate(this.multilineOptions,false)}componentDidLoad(){this.initMutationObserver();this.initEventListeners();c(this.hostElement);setTimeout((()=>this.checkSelectedDisplay()),0);this.setCustomLabel()}componentDidRender(){setTimeout((()=>{this.scheduledAfterRender.forEach((t=>t()));this.scheduledAfterRender=[]}),25)}onHostElementChange(t){if(this.readonly||this.disabled)return;if(t.target!==this.hostElement||this.hostElement.onchange)return;if(this.multiple){this.value=null;this.selectedOptions=t.detail.selectedOptions}else{this.value=t.detail.value;this.selectedOptions=[]}}onClearHandler(){this.clearValue()}handleSelectedDisplay(t){if(!this.multiple&&!!this.value&&this.value===t.detail.value){this.inputField.value=t.detail.display}}delegateFocus(t){const e=h(t,this.hostElement);const i=this.prioritizeSearch=e&&this.searchable;if(i){this.clearSelectedDisplay()}else if(d(t,this.hostElement)){this.innerInputField.focus()}}handleFocusout(t){var e;const i=t.relatedTarget;const s=!((e=this.popoverElement)===null||e===void 0?void 0:e.contains(i))&&!this.hostElement.contains(i);if(s)this.closeDropdown();this.prioritizeSearch=!s&&this.searchable}onHostElementInput(t){if(!this.searchable||t.target!==this.hostElement||this.hostElement.oninput)return;const e=this.optionElements;const i=this.searchText.trim().toLocaleLowerCase();let s=0;e.forEach((t=>{var e;if(i===""){t.hidden=false;return}const o=((e=t.firstElementChild)===null||e===void 0?void 0:e.tagName)==="Q2-CARD"?t.firstElementChild.title:null;const{display:l="",innerText:n=""}=t;const r=[l,o,n];const a=r.some((t=>{var e;return(e=t===null||t===void 0?void 0:t.toLocaleLowerCase().includes(i))!==null&&e!==void 0?e:false}));t.hidden=!a;if(a)s++}));const o=i?"tecton.element.select.searchable.results":"tecton.element.select.allOptions";const l=i?s:e.length;this.setStatusMessage(r(o,[l]))}keydownHandler(t){this.inputKeydownHandler(t)}popoverStateChanged({detail:{open:t}}){if(this.open!==t)this.open=t}handleTctClick(){const{name:t,version:e}=p();const i=Number(e.split(".")[0]);if(this.searchable&&t==="Safari"&&!isNaN(i)&&i<18){this.scheduledAfterRender.push((()=>this.innerInputField.blur()))}}async closePopover(){if(!this.open||this.disabled)return;this._togglePopover()}async openPopover(){if(this.open||this.disabled)return;this._togglePopover()}searchOptions(t){if(!this.searchable)return;const{innerInputField:e}=this;e.focus();e.dispatchEvent(new FocusEvent("focus"));e.value=t;e.dispatchEvent(new InputEvent("input"))}async setValue(t,e={closePopover:true}){const i=new Set(Array.isArray(t)?t:[t]);if(!this.open){await this.openPopover();await u()}i.forEach((t=>{var e;(e=this.optionElements.find((e=>e.value===t)))===null||e===void 0?void 0:e.click()}));if(e.closePopover){await this.closePopover();await u()}}ariaLabelObserver(){a(this)}handleMultilineOptionsUpdate(t,e){if(t===e)return;this.optionElements.forEach((e=>e.multiline=t))}openChanged(t){if(t){this.addTouchEventListeners()}else{this.removeTouchEventListeners()}this.scheduledAfterRender.push((async()=>{await u();const{popoverTopContainer:e,popoverElement:i}=this;const s=t&&(e===null||e===void 0?void 0:e.offsetHeight)||0;if(s){i.style.setProperty("--comp-popover-top-container-height",`${s}px`)}else{i.style.removeProperty("--comp-popover-top-container-height")}}))}buildStructuredSelectedOptions(){const{multiple:t,selectedOptions:e,value:i}=this;if(t){this.structuredSelectedOptions=!!(e===null||e===void 0?void 0:e.length)?e.map((t=>typeof t==="string"?{value:t}:t)):[]}else{this.structuredSelectedOptions=i?[{value:i}]:[]}}valueUpdated(){if(this.multiple)return;this.clearSearchText()}get badgeValue(){var t,e;if(!this.multiple)return null;const i=(e=(t=this.selectedOptions)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0;if(this.open&&this.searchable)return i?`${i}`:null;else return i>1?`+${i-1}`:null}get firstSelectedOptionElement(){const{firstSelectedValue:t}=this;return t?this.optionElements.find((({value:e})=>e===t)):null}get firstSelectedValue(){var t;return this.multiple?(t=this.selectedOptions)===null||t===void 0?void 0:t[0]:this.value}get innerInputContainer(){var t,e;return(e=(t=this.inputField)===null||t===void 0?void 0:t.shadowRoot)===null||e===void 0?void 0:e.querySelector(".input-container")}get innerInputField(){var t,e;return(e=(t=this.inputField)===null||t===void 0?void 0:t.shadowRoot)===null||e===void 0?void 0:e.querySelector(".input-field")}get inputId(){return`select-guid-${this.guid}`}get isModule(){var t,e;const i=window!==window.top;const s=Object.keys((e=(t=window.Tecton)===null||t===void 0?void 0:t.platformDimensions)!==null&&e!==void 0?e:{}).length>0;return i&&s}get optionElements(){return Array.from(this.hostElement.querySelectorAll("q2-option"))}get popoverMinHeight(){const{minRows:t}=this;const e=this.hostElement.querySelector("q2-option:not([hidden])");let i=e&&window.getComputedStyle(e).minHeight;if(!i||i==="0px")i="44px";return t*parseInt(i)}get selectedDisplay(){if(this.prioritizeSearch||this.searchText)return this.searchText;if(this.hasCustomDisplay)return"";return this.multiple?this.calculateMultiSelectSelectedDisplay():this.calculateSingleSelectSelectedDisplay()}get selectedDisplaySlot(){return this.hostElement.querySelector('[slot="_selected-display"]')}get wrapperClasses(){const{errors:t}=this;const e=["q2-select-container"];if(Array.isArray(t)&&t.length>0)e.push("has-error");if(this.inputFocused)e.push("is-focused");if(this.searchable)e.push("is-searchable");return e.join(" ")}_togglePopover(){const{innerInputField:t}=this;t===null||t===void 0?void 0:t.click();t===null||t===void 0?void 0:t.focus();t.dispatchEvent(new FocusEvent("focus"))}calculateMultiSelectSelectedDisplay(){var t,e,i;const{firstSelectedOptionElement:s,firstSelectedValue:o,multilineOptions:l}=this;if(!o)return"";if(s===null||s===void 0?void 0:s.display)return r(s.display);if(l&&this.searchable)return this.searchText;if(l)return"";return(i=(e=(t=s===null||s===void 0?void 0:s.textContent)===null||t===void 0?void 0:t.trim())!==null&&e!==void 0?e:s===null||s===void 0?void 0:s.value)!==null&&i!==void 0?i:o}calculateSingleSelectSelectedDisplay(){var t;const{firstSelectedOptionElement:e,multilineOptions:i}=this;if(i){return(e===null||e===void 0?void 0:e.display)&&r(e.display)||this.value||""}else{return(e===null||e===void 0?void 0:e.display)&&r(e.display)||((t=e===null||e===void 0?void 0:e.textContent)===null||t===void 0?void 0:t.trim())||this.value||""}}checkSelectedDisplay(){let t=this.selectedDisplaySlot;const{value:e,multiple:i,selectedOptions:s,multilineOptions:o,firstSelectedOptionElement:l,prioritizeSearch:n}=this;const r=!e&&i&&!(s===null||s===void 0?void 0:s.length);if(n||!o||r)return this.clearSelectedDisplay();if(!l||l.display)return this.clearSelectedDisplay();const a=l.firstElementChild.cloneNode(true);a.querySelectorAll("[hide-on-select]").forEach((t=>t.remove()));if(t){const e=t.clientHeight===0?"auto":`${t.clientHeight}px`;t.style.setProperty("--comp-selected-display-height",e);if(t.firstElementChild.outerHTML!==a.outerHTML){t.replaceChild(a,t.firstElementChild)}}else{t=document.createElement("div");t.slot="_selected-display";t.appendChild(a);this.hostElement.appendChild(t)}return t}checkSelectedDisplayHeight(){const{selectedDisplaySlot:t}=this;if(!t)return;t.style.setProperty("--comp-selected-display-height","44px")}checkSelectedOptions(){const{multiple:t,selectedOptions:e,value:i}=this;this.optionElements.forEach((s=>{if(t){s.selected=e.includes(s.value)}else{s.selected=s.value===i}}))}clearSearchText(){if(!this.searchText)return;this.searchText="";this.input.emit({query:""})}clearSelectedDisplay(){var t;(t=this.selectedDisplaySlot)===null||t===void 0?void 0:t.remove()}clearValue(){const{multiple:t}=this;this.value="";this.selectedOptions=[];this.change.emit({value:t?undefined:"",selectedOptions:t?[]:undefined})}closeDropdown(){this.open=false;this.lastTouchWasInPopover=false;this.clearSearchText()}async executeActionSheet(t){const e=await f(this,t);this.focusInput();this.handleSelectionChanges(e)}focusInput(){var t;(t=this.inputField)===null||t===void 0?void 0:t.dispatchEvent(new FocusEvent("focus"))}handleOptionListExternalKeydown(t){this.optionList.handleExternalKeydown(t)}handleSelectionChanges(t){const{value:e="",values:i=[]}=t;const s=i.map((t=>t.value));const{multiple:o}=this;if(!this.hostElement.onchange){this.selectedOptions=s}this.change.emit({value:o?undefined:e,selectedOptions:o?s:undefined})}openDropdownWithoutActiveElement(){if(this.readonly||this.disabled)return;this.optionList.setActiveElement(null);this.open=true}setCustomLabel(){var t;const e=this.hostElement.querySelector('[slot="label"]');if(e){(t=this.inputField)===null||t===void 0?void 0:t.appendChild(e.cloneNode(true));this.hostElement.removeChild(e)}}setStatusMessage(t){clearTimeout(this.statusMessageTimer);this.statusMessage="";this.statusMessageTimer=setTimeout((()=>{this.statusMessage=t}),1e3)}shouldClearSearchText(t){return this.searchable&&!!this.searchText&&t.key==="Escape"}toggleDropdown(){if(this.readonly||this.disabled)return;if(this.open&&!this.searchText){this.closeDropdown()}else{this.openDropdownWithoutActiveElement()}}renderCustomDisplay(){const t=this.checkSelectedDisplay();if(!t)return;this.checkSelectedDisplayHeight();return i("slot",{name:"_selected-display",slot:"custom-display"})}renderOptionsDropdown(){return i("q2-popover",{ref:t=>this.popoverElement=t,controlElement:this.innerInputContainer,open:this.open,"max-height":this.popoverMaxHeight,minHeight:this.popoverMinHeight,direction:this.popDirection,mode:this.popoverMode||undefined,block:true},i("div",{class:"popover-content"},i("q2-option-list",{onPopoverState:this.onPopoverState,ref:t=>this.optionList=t,type:"listbox",id:"option-list","show-selected":this.showSelected,label:this.listLabel,multiple:this.multiple,selectedOptions:this.structuredSelectedOptions,onChange:this.onOptionListChange},i("slot",null)),i("div",{class:"popover-top-container",ref:t=>this.popoverTopContainer=t,hidden:!this.multiple&&!this.hasPopoverTop,tabindex:"-1"},i("slot",{name:"popover-top"}),this.multiple&&this.renderVisibilityToggle())),i("div",{class:"popover-bottom-container",hidden:!this.hasPopoverBottom,tabindex:"-1"},i("slot",{name:"popover-bottom"})))}renderSelectField(){var t;return i(s,null,i("div",{"aria-live":"polite","aria-atomic":"true",role:"status",class:"sr"},this.statusMessage),i("q2-input",{ref:t=>this.inputField=t,class:"q2-select-input",label:this.label&&r(this.label)||"",value:this.selectedDisplay,clearable:this.clearable&&(!!this.value||!!((t=this.selectedOptions)===null||t===void 0?void 0:t.length))||undefined,errors:Array.isArray(this.errors)&&this.errors.length>0&&this.errors.map((t=>r(t)))||this.invalid&&["tecton.element.select.invalid"]||[],disabled:this.disabled,optional:this.optional,readonly:!!this.readonly,placeholder:this.placeholder||undefined,hideLabel:this.hideLabel,ariaExpanded:`${this.open}`,ariaControls:"option-list",ariaHaspopup:"listbox","test-id":"toggleDropdown","hide-messages":true,iconRight:"chevron-down",onClick:this.inputClickHandler,onInput:this.inputInputHandler,onKeyDown:this.inputKeydownHandler,onFocus:this.inputFocusHandler,onBlur:this.inputBlurHandler,onChange:this.inputChangeHandler,badgeValue:this.badgeValue,badgeTheme:this.inputFocused?"primary":undefined,_role:"combobox",_preventEntry:!this.searchable},this.renderCustomDisplay()),i("div",{class:"custom-display-content",hidden:!this.hasCustomDisplay||!!this.searchText,onClick:this.onCustomDisplayClick},i("slot",{name:"q2-select-display"})),this.renderOptionsDropdown())}renderVisibilityToggle(){var t,e;const s=(e=(t=this.selectedOptions)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0;const{showSelected:o}=this;return i("div",{class:"multi-select-header"},i("fieldset",null,i("legend",{"aria-label":r("tecton.element.select.multiHeader.showing")},r("tecton.element.select.multiHeader.showing")),i("div",null,i("input",{class:"sr",type:"radio",id:"all",name:"viewDisplay",value:"all",checked:!o,"aria-label":r("tecton.element.select.multiHeader.allAriaLabel"),"test-id":"allOptionsButton",onClick:this.showAllOptions,onKeyDown:this.visibilityToggleKeyDown}),i("label",{htmlFor:"all"},r("tecton.element.select.multiHeader.all"))),i("div",null,i("input",{class:"sr",type:"radio",id:"selected",disabled:s===0,name:"viewDisplay",value:"selected","aria-label":r("tecton.element.select.multiHeader.selectedAriaLabel",[s]),checked:o,"test-id":"selectedOptionsButton",onClick:this.showSelectedOptions,onKeyDown:this.visibilityToggleKeyDown}),i("label",{htmlFor:"selected"},r("tecton.element.select.multiHeader.selected",[s])))))}render(){return i("click-elsewhere",{key:"71d71b0070c578f80d8add0667a8ca7cb9703ac7",class:this.wrapperClasses,onChange:this.clickedElsewhere},this.renderSelectField())}get hostElement(){return o(this)}static get watchers(){return{ariaLabel:["ariaLabelObserver"],multilineOptions:["handleMultilineOptionsUpdate"],open:["openChanged"],value:["buildStructuredSelectedOptions","valueUpdated"],selectedOptions:["buildStructuredSelectedOptions"]}}};g.style=m;export{g as q2_select};
2
+ //# sourceMappingURL=p-1e1f8113.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["q2SelectCss","Q2SelectStyle0","Q2Select","this","guid","createGuid","lastTouchWasInPopover","scheduledAfterRender","addTouchEventListeners","isMobile","popoverElement","addEventListener","handleTouchMove","passive","clickedElsewhere","event","target","localName","stopPropagation","open","innerInputField","blur","destroyEventListeners","_a","screen","orientation","removeEventListener","handleOrientationChange","window","visualViewport","removeTouchEventListeners","isLandscape","isModule","Tecton","platformDimensions","orientationType","includes","_c","_b","type","searchable","originalSearchable","document","activeElement","hostElement","inputFocused","focus","initEventListeners","initMutationObserver","observer","MutationObserver","onMutationObserved","observe","childList","subtree","mutationObserver","inputBlurHandler","inputChangeHandler","inputClickHandler","async","focusInput","shouldShowActionSheet","executeActionSheet","toggleDropdown","inputFocusHandler","inputInputHandler","eventValue","detail","value","shouldClearValue","clearValue","openDropdownWithoutActiveElement","prioritizeSearch","searchText","input","emit","query","inputKeydownHandler","readonly","disabled","key","shiftKey","isShiftTab","hasSlot","hasPopoverTop","hasPopoverBottom","keysForOptionListToHandle","inputField","preventDefault","shouldClearSearchText","clearSearchText","handleOptionListExternalKeydown","onCustomDisplayClick","slotContainer","querySelector","displaySlot","shadowRoot","hasCustomDisplay","assignedNodes","length","children","popTopSlot","topSlotHasNode","popBottomSlot","bottomSlotHasNode","checkSelectedOptions","onOptionListChange","values","showAllOptions","handleSelectionChanges","onPopoverState","action","optionList","setActiveElement","showSelected","showSelectedOptions","visibilityToggleKeyDown","isRadioControlKey","setDefaultActiveElement","useActionSheets","loc","disconnectedCallback","disconnect","componentWillLoad","handleAriaLabel","buildStructuredSelectedOptions","handleMultilineOptionsUpdate","multilineOptions","componentDidLoad","overrideFocus","setTimeout","checkSelectedDisplay","setCustomLabel","componentDidRender","forEach","fn","onHostElementChange","onchange","multiple","selectedOptions","onClearHandler","handleSelectedDisplay","display","delegateFocus","fromHost","isRelatedTargetWithinHost","clearSelectedDisplay","isEventFromElement","handleFocusout","relatedTarget","isLeavingHost","contains","closeDropdown","onHostElementInput","oninput","options","optionElements","trim","toLocaleLowerCase","matchedCount","option","hidden","title","firstElementChild","tagName","innerText","searchParams","matched","some","text","statusMessageLocString","count","setStatusMessage","keydownHandler","popoverStateChanged","handleTctClick","name","version","getBrowserInfo","majorVersion","Number","split","isNaN","push","closePopover","_togglePopover","openPopover","searchOptions","dispatchEvent","FocusEvent","InputEvent","setValue","valuesSet","Set","Array","isArray","waitForNextPaint","find","click","ariaLabelObserver","newValue","oldValue","element","multiline","openChanged","isOpen","popoverTopContainer","height","offsetHeight","style","setProperty","removeProperty","structuredSelectedOptions","map","valueUpdated","badgeValue","optionsLength","firstSelectedOptionElement","firstSelectedValue","innerInputContainer","inputId","isIframe","top","hasPlatformDimensions","Object","keys","from","querySelectorAll","popoverMinHeight","minRows","firstOption","minHeight","getComputedStyle","parseInt","selectedDisplay","calculateMultiSelectSelectedDisplay","calculateSingleSelectSelectedDisplay","selectedDisplaySlot","wrapperClasses","errors","classes","join","textContent","namedSlot","hasNoValue","selectionClone","cloneNode","remove","clientHeight","outerHTML","replaceChild","createElement","slot","appendChild","checkSelectedDisplayHeight","selected","change","undefined","result","showActionSheetList","handleExternalKeydown","changeDetails","selectedOptionValues","customLabel","removeChild","message","clearTimeout","statusMessageTimer","statusMessage","renderCustomDisplay","hasSelectedDisplay","h","renderOptionsDropdown","ref","el","controlElement","popoverMaxHeight","direction","popDirection","mode","popoverMode","block","class","id","label","listLabel","onChange","tabindex","renderVisibilityToggle","renderSelectField","Fragment","role","clearable","error","invalid","optional","placeholder","hideLabel","ariaExpanded","ariaControls","ariaHaspopup","iconRight","onClick","onInput","onKeyDown","onFocus","onBlur","badgeTheme","_role","_preventEntry","selectedOptionsCount","checked","htmlFor","render"],"sources":["src/components/q2-select/q2-select.scss?tag=q2-select&encapsulation=shadow","src/components/q2-select/q2-select.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions';\n@import '../../styles/dropdowns';\n\n:host {\n --comp-select-margin: #{var-list(\n --tct-select-margin,\n unquote(\n '#{var-list(var-prefixer(select-margin-top), --app-scale-4, 30px)} 0 #{var-list(var-prefixer(select-margin-bottom), --app-scale-4, 30px)}'\n )\n )};\n display: block;\n margin: var(--comp-select-margin);\n}\n\n.q2-select-container {\n position: relative;\n display: block;\n}\n\n.q2-select-input {\n margin: 0;\n\n --tct-input-min-height: #{var-list(var-prefixer(select-input-min-height))};\n --tct-input-max-height: #{var-list(var-prefixer(select-input-max-height), none)};\n}\n\n::slotted([slot='_selected-display']) {\n width: 100%;\n min-height: var(--comp-selected-display-height, 44px);\n}\n\n.custom-display-content {\n position: absolute;\n bottom: 0;\n left: calc(var-list(--tct-scale-2, --app-scale-2x, 10px) + 1px);\n height: 44px;\n width: calc(100% - 34px - var-list(--tct-scale-3, --app-scale-3x, 15px));\n overflow: hidden;\n cursor: pointer;\n transition: left var-list(--tct-tween-2, --app-tween-1, unquote('0.2s ease'));\n}\n\n.custom-display-content:not([hidden]) {\n display: flex;\n align-items: center;\n}\n\n.is-searchable.is-focused .custom-display-content,\n.is-searchable .custom-display-content:active {\n left: calc(var-list(--tct-scale-3, --app-scale-3x, 15px) + 1px);\n}\n\n.has-error .custom-display-content {\n width: calc(100% - 68px - var-list(--tct-scale-3, --app-scale-3x, 15px));\n}\n\n.popover-content {\n display: flex;\n flex-direction: column-reverse;\n}\n\n.popover-bottom-container {\n position: sticky;\n bottom: 0;\n z-index: 5;\n}\n\n.popover-top-container {\n position: sticky;\n top: 0;\n z-index: 5;\n .multi-select-header {\n padding: var(--tct-scale-2, var(--app-scale-2x, 10px)) var(--tct-scale-2, var(--app-scale-2x, 10px));\n background: var(--app-white);\n display: flex;\n gap: var-list(--app-scale-2x, 10px);\n align-items: center;\n\n fieldset {\n margin: 0;\n padding: 0;\n border: 0;\n display: flex;\n gap: var-list(--app-scale-2x, 10px);\n }\n\n legend {\n padding: 0;\n float: left;\n }\n\n label {\n cursor: pointer;\n padding: var-list(\n var-prefixer(select-multi-select-option-padding),\n var-prefixer(btn-badge-padding),\n unquote('2px 5px')\n );\n font-size: var-list(\n var-prefixer(select-multi-select-option-font-size),\n var-prefixer(btn-badge-font-size),\n inherit\n );\n border-radius: var-list(\n var-prefixer(select-multi-select-option-radius),\n var-prefixer(btn-badge-border-radius),\n --app-border-radius-1,\n 4px\n );\n background: var-list(\n --tct-select-multi-select-option-background,\n var-prefixer(select-multi-select-option-bg),\n --tct-badge-background,\n var-prefixer(btn-badge-bg),\n transparent\n );\n color: var-list(\n var-prefixer(select-multi-select-option-color),\n var-prefixer(btn-badge-font-color),\n inherit\n );\n\n &:hover {\n background: var-list(\n --tct-select-multi-select-option-hover-background,\n var-prefixer(select-multi-select-option-hover-background-color),\n var-prefixer(btn-badge-hover-bg),\n var-prefixer(gray-14),\n --app-gray-l3,\n #f2f2f2\n );\n color: var-list(\n --tct-select-multi-select-option-hover-color,\n var-prefixer(select-multi-select-option-color),\n var-prefixer(btn-badge-hover-font-color),\n var-prefixer(gray-5),\n --app-gray-d2,\n #404040\n );\n }\n }\n\n input {\n &:checked + label {\n &,\n &:enabled:hover {\n background: var-list(\n --tct-select-multi-select-option-active-background,\n var-prefixer(select-multi-select-option-active-background-color),\n var-prefixer(btn-primary-bg),\n #2e2e2e\n );\n color: var-list(\n var-prefixer(select-multi-select-option-active-color),\n var-prefixer(btn-primary-font-color),\n --app-white,\n #ffffff\n );\n }\n }\n\n &:disabled + label {\n opacity: var-list(\n var-prefixer(select-multi-select-option-disabled-opacity),\n var-prefixer(btn-disabled-opacity),\n --app-disabled-opacity,\n 0.4\n );\n cursor: not-allowed;\n }\n\n &:focus + label {\n box-shadow: var(--const-double-focus-ring);\n }\n }\n }\n}\n","import {\n Component,\n Prop,\n Element,\n h,\n Listen,\n State,\n EventEmitter,\n Event,\n ComponentInterface,\n Watch,\n Method,\n Fragment,\n} from '@stencil/core';\nimport { IEventDetail, Q2InputCustomEvent, Q2OptionListCustomEvent } from 'src/components';\nimport {\n getBrowserInfo,\n createGuid,\n handleAriaLabel,\n isEventFromElement,\n isMobile,\n isRelatedTargetWithinHost,\n loc,\n overrideFocus,\n waitForNextPaint,\n} from '../../utils';\nimport { IOptionValue } from '../q2-option-list/q2-option-list';\nimport { shouldShowActionSheet, showActionSheetList } from 'src/utils/action-sheet';\n\n/**\n * @slot popover-top - An optional slot to display custom content persistently at the top of the popover. This is **not** compatible with the action sheet workflow.\n * @slot popover-bottom - An optional slot to display custom content persistently at the bottom of the popover. This is **not** compatible with the action sheet workflow.\n * @slot q2-select-display - An optional slot to display custom HTML content in the display area.\n */\n@Component({ tag: 'q2-select', shadow: true, styleUrl: 'q2-select.scss' })\nexport class Q2Select implements ComponentInterface {\n // #region Own Properties\n\n guid = createGuid();\n inputField?: HTMLQ2InputElement;\n lastTouchWasInPopover: boolean = false;\n mutationObserver: MutationObserver;\n optionList: HTMLQ2OptionListElement;\n originalSearchable: boolean;\n popoverElement?: HTMLQ2PopoverElement;\n popoverTopContainer?: HTMLDivElement;\n scheduledAfterRender: (() => void)[] = [];\n statusMessageTimer: NodeJS.Timeout;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n hasCustomDisplay: boolean = false;\n\n @State()\n hasPopoverBottom: boolean = false;\n\n @State()\n hasPopoverTop: boolean = false;\n\n @State()\n inputFocused: boolean = false;\n\n @State()\n open: boolean = false;\n\n @State()\n prioritizeSearch: boolean = false;\n\n @State()\n searchText: string = '';\n\n @State()\n showSelected: boolean = false;\n\n @State()\n statusMessage: string;\n\n @State()\n structuredSelectedOptions: IOptionValue[] = [];\n\n // #endregion\n // #region Public Property API\n\n /** @deprecated */\n @Prop({ reflect: true, mutable: true })\n ariaLabel: string;\n\n /** Renders an icon button when the field is non-empty. Pressing the button clears all input from the field. */\n @Prop({ reflect: true })\n clearable: boolean;\n\n /** Disables all interaction with the field and leverages the disabled visual style of `q2-input`. */\n @Prop({ reflect: true })\n disabled: boolean = false;\n\n /**\n * The presence of `errors` will mark the field as invalid, putting it into an error state.\n * @localizable\n */\n @Prop()\n errors: string[];\n\n /**\n * Hide's the field's `<label>` element from view.\n * @warning\n * Only use when a visible label is impractical.\n */\n @Prop({ reflect: true, mutable: true })\n hideLabel: boolean;\n\n /**\n * Instructs the component to use the action sheet workflow for displaying its options.\n *\n * For more information, see [Action Sheets](https://tecton.q2developer.com/guides/action-sheets/).\n * @warning\n * If your `q2-select` renders inside of an iframe, and you are using multiline/robust content options,\n * any custom CSS you apply to your options will not get passed up to the platform which displays the action sheet.\n * For this reason, we strongly suggest using the [q2-card](https://tecton.q2developer.com/design-system/q2-card/) component since its styling is managed by Tecton.\n */\n @Prop()\n hoist: boolean = !!window.Tecton?.useActionSheets;\n\n /** Determines whether to show an error state. Its primary use-case is for an unfilled field. */\n @Prop({ reflect: true })\n invalid: boolean;\n\n /**\n * The text that will be used as the label for the field.\n * @localizable\n */\n @Prop({ reflect: true, mutable: true })\n label: string;\n\n /**\n * Determines the label that is applied to the option list for accessibility purposes.\n * @localizable\n */\n @Prop()\n listLabel: string = loc('tecton.element.select.listLabel');\n\n /** The minimum number of rows the component will try to display below or above the component when opened. */\n @Prop()\n minRows: number = 3;\n\n /** Enables text wrapping for `q2-option` elements. When `false`, the text truncates and does not wrap. */\n @Prop({ reflect: true })\n multilineOptions: boolean = false;\n\n /** Enables multi-select functionality. */\n @Prop({ reflect: true })\n multiple: boolean = false;\n\n /** Appends \"(optional)\" to the field label, and sets `aria-required` on the nested input tag to `false`. */\n @Prop({ reflect: true })\n optional: boolean = false;\n\n /**\n * Text that appears within the field when it is blurred and empty.\n * Placeholder text disappears when the user selects an option.\n * @localizable\n */\n @Prop({ reflect: true })\n placeholder: string;\n\n /** @deprecated */\n @Prop({ reflect: true })\n popDirection: 'up' | 'down';\n\n /**\n * Force the maximum height of the popover. This value will be interpreted as pixels.\n * If no value is passed, or the value exceeds available space, the component will auto-detect the maximum height based on available space.\n */\n @Prop()\n popoverMaxHeight: number;\n\n /**\n * Determines the display mode of the popover.\n *\n * Providing a value of `legacy` instructs the popover to use absolute positioning instead of fixed positioning.\n *\n * @info\n * This is a temporary solution to work around styling issues related to using fixed positioning for the popover\n * when nested inside of elements with transform properties. This will be removed once the popover API is available\n * for use.\n */\n @Prop({ mutable: true })\n popoverMode: 'legacy' = null;\n\n /**\n * Appends \"(read only)\" to the field label, and field becomes unusable, but remains focusable.\n * Takes priority over `optional` if both are `true`.\n */\n @Prop({ reflect: true })\n readonly: boolean = false;\n\n /** Enables search functionality. */\n @Prop({ reflect: true, mutable: true })\n searchable: boolean = false;\n\n /**\n * Each item in this array should correspond to the value of a `q2-option` element.\n * This property is only relevant for `multiple` (i.e., multi-select) implementations.\n */\n @Prop({ mutable: true })\n selectedOptions: string[] = [];\n\n /**\n * The current value for the select. This should correspond to the value of a nested q2-option element.\n * This property is only relevant for single-select implementations.\n */\n @Prop({ mutable: true })\n value: string;\n\n // #endregion\n // #region Events\n\n /**\n * Emitted when an option is selected or deselected.\n *\n * When the multi-select is enabled, the `value` property will be `undefined` and the `selectedOptions` property\n * will contain the selected option values.\n *\n * @legacyEvent\n */\n @Event()\n change: EventEmitter<{ value: string; selectedOptions: string[] }>;\n\n /**\n * Emitted when the input value changes.\n *\n * Requires the `searchable` prop to be set to `true`.\n */\n @Event()\n input: EventEmitter<{ query: string }>;\n\n // #endregion\n // #region Component Lifecycle Events\n\n disconnectedCallback() {\n this.mutationObserver?.disconnect();\n this.mutationObserver = null;\n this.destroyEventListeners();\n }\n\n componentWillLoad() {\n this.originalSearchable = this.searchable;\n handleAriaLabel(this);\n this.handleOrientationChange();\n this.buildStructuredSelectedOptions();\n this.handleMultilineOptionsUpdate(this.multilineOptions, false);\n }\n\n componentDidLoad() {\n this.initMutationObserver();\n this.initEventListeners();\n overrideFocus(this.hostElement);\n setTimeout(() => this.checkSelectedDisplay(), 0);\n this.setCustomLabel();\n }\n\n componentDidRender() {\n setTimeout(() => {\n this.scheduledAfterRender.forEach(fn => fn());\n this.scheduledAfterRender = [];\n }, 25);\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('change')\n onHostElementChange(event: CustomEvent<{ value: string; selectedOptions: string[] }>) {\n if (this.readonly || this.disabled) return;\n if (event.target !== this.hostElement || this.hostElement.onchange) return;\n if (this.multiple) {\n this.value = null;\n this.selectedOptions = event.detail.selectedOptions;\n } else {\n this.value = event.detail.value;\n this.selectedOptions = [];\n }\n }\n\n @Listen('clear')\n onClearHandler() {\n this.clearValue();\n }\n\n @Listen('displayChanged')\n handleSelectedDisplay(event: CustomEvent) {\n if (!this.multiple && !!this.value && this.value === event.detail.value) {\n this.inputField.value = event.detail.display;\n }\n }\n\n @Listen('focus')\n delegateFocus(event: FocusEvent) {\n const fromHost = isRelatedTargetWithinHost(event, this.hostElement);\n const prioritizeSearch = (this.prioritizeSearch = fromHost && this.searchable);\n if (prioritizeSearch) {\n this.clearSelectedDisplay();\n } else if (isEventFromElement(event, this.hostElement)) {\n this.innerInputField.focus();\n }\n }\n\n @Listen('focusout')\n handleFocusout(event: FocusEvent) {\n const relatedTarget = event.relatedTarget as HTMLElement;\n const isLeavingHost =\n !this.popoverElement?.contains(relatedTarget) && !this.hostElement.contains(relatedTarget);\n if (isLeavingHost) this.closeDropdown();\n this.prioritizeSearch = !isLeavingHost && this.searchable;\n }\n\n @Listen('input')\n onHostElementInput(event: CustomEvent) {\n if (!this.searchable || event.target !== this.hostElement || this.hostElement.oninput) return;\n const options = this.optionElements;\n const query = this.searchText.trim().toLocaleLowerCase();\n let matchedCount = 0;\n options.forEach(option => {\n if (query === '') {\n option.hidden = false;\n return;\n }\n\n const title =\n option.firstElementChild?.tagName === 'Q2-CARD'\n ? (option.firstElementChild as HTMLQ2CardElement).title\n : null;\n const { display = '', innerText = '' } = option;\n const searchParams = [display, title, innerText];\n const matched = searchParams.some(text => text?.toLocaleLowerCase().includes(query) ?? false);\n\n option.hidden = !matched;\n if (matched) matchedCount++;\n });\n\n const statusMessageLocString = query\n ? 'tecton.element.select.searchable.results'\n : 'tecton.element.select.allOptions';\n const count = query ? matchedCount : options.length;\n this.setStatusMessage(loc(statusMessageLocString, [count]));\n }\n\n @Listen('keydown')\n keydownHandler(event: KeyboardEvent) {\n this.inputKeydownHandler(event);\n }\n\n @Listen('popoverStateChanged')\n popoverStateChanged({ detail: { open } }: CustomEvent<{ open: boolean }>) {\n if (this.open !== open) this.open = open;\n }\n\n @Listen('tctClick')\n handleTctClick() {\n const { name, version } = getBrowserInfo();\n const majorVersion = Number(version.split('.')[0]);\n // Only Safari under iOS 18 having issue when searchable\n if (this.searchable && name === 'Safari' && !isNaN(majorVersion) && majorVersion < 18) {\n this.scheduledAfterRender.push(() => this.innerInputField.blur());\n }\n }\n\n // #endregion\n // #region Public Methods API\n\n /**\n * Emulates clicking the `<input>` to hide the popover if it is visible.\n *\n * @testOnly\n */\n @Method()\n async closePopover() {\n if (!this.open || this.disabled) return;\n this._togglePopover();\n }\n\n /**\n * Emulates clicking the `<input>` to display the popover if it is hidden.\n *\n * @testOnly\n */\n @Method()\n async openPopover() {\n if (this.open || this.disabled) return;\n this._togglePopover();\n }\n\n /**\n * Emulates focusing the `<input>`, entering the provided value, and emitting an `input` event.\n *\n * @warning\n * Only applicable when the input is searchable.\n *\n * @testOnly\n */\n @Method()\n searchOptions(query: string) {\n if (!this.searchable) return;\n\n const { innerInputField } = this;\n innerInputField.focus();\n innerInputField.dispatchEvent(new FocusEvent('focus'));\n innerInputField.value = query;\n innerInputField.dispatchEvent(new InputEvent('input'));\n }\n\n /**\n * Emulates clicking the `<input>` to display the popover and selecting the option(s) with the specified value(s).\n *\n * If the multi-select is enabled and the `closePopover` argument is `true` (default), the popover will be closed\n * after the option(s) are selected.\n *\n * @testOnly\n */\n @Method()\n async setValue(values: string | string[], options: { closePopover?: boolean } = { closePopover: true }) {\n const valuesSet = new Set(Array.isArray(values) ? values : [values]);\n if (!this.open) {\n await this.openPopover();\n await waitForNextPaint();\n }\n\n valuesSet.forEach(value => {\n this.optionElements.find(option => option.value === value)?.click();\n });\n\n if (options.closePopover) {\n await this.closePopover();\n await waitForNextPaint();\n }\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('ariaLabel')\n ariaLabelObserver() {\n handleAriaLabel(this);\n }\n\n @Watch('multilineOptions')\n handleMultilineOptionsUpdate(newValue, oldValue) {\n if (newValue === oldValue) return;\n this.optionElements.forEach(element => (element.multiline = newValue));\n }\n\n @Watch('open')\n openChanged(isOpen: boolean) {\n if (isOpen) {\n this.addTouchEventListeners();\n } else {\n this.removeTouchEventListeners();\n }\n this.scheduledAfterRender.push(async () => {\n await waitForNextPaint();\n const { popoverTopContainer, popoverElement } = this;\n const height = (isOpen && popoverTopContainer?.offsetHeight) || 0;\n if (height) {\n popoverElement.style.setProperty('--comp-popover-top-container-height', `${height}px`);\n } else {\n popoverElement.style.removeProperty('--comp-popover-top-container-height');\n }\n });\n }\n\n @Watch('value')\n @Watch('selectedOptions')\n buildStructuredSelectedOptions() {\n const { multiple, selectedOptions, value } = this;\n if (multiple) {\n this.structuredSelectedOptions = !!selectedOptions?.length\n ? selectedOptions.map(option => (typeof option === 'string' ? { value: option } : option))\n : [];\n } else {\n this.structuredSelectedOptions = value ? [{ value }] : [];\n }\n }\n\n @Watch('value')\n valueUpdated() {\n if (this.multiple) return;\n this.clearSearchText();\n }\n\n // #endregion\n // #region Local Methods\n\n get badgeValue(): string {\n if (!this.multiple) return null;\n const optionsLength = this.selectedOptions?.length ?? 0;\n if (this.open && this.searchable) return optionsLength ? `${optionsLength}` : null;\n else return optionsLength > 1 ? `+${optionsLength - 1}` : null;\n }\n\n get firstSelectedOptionElement() {\n const { firstSelectedValue } = this;\n return firstSelectedValue ? this.optionElements.find(({ value }) => value === firstSelectedValue) : null;\n }\n\n get firstSelectedValue() {\n return this.multiple ? this.selectedOptions?.[0] : this.value;\n }\n\n get innerInputContainer(): HTMLElement {\n return this.inputField?.shadowRoot?.querySelector('.input-container');\n }\n\n get innerInputField(): HTMLInputElement | HTMLButtonElement {\n return this.inputField?.shadowRoot?.querySelector('.input-field');\n }\n\n get inputId() {\n return `select-guid-${this.guid}`;\n }\n\n get isModule() {\n const isIframe = window !== window.top;\n const hasPlatformDimensions = Object.keys(window.Tecton?.platformDimensions ?? {}).length > 0;\n return isIframe && hasPlatformDimensions;\n }\n\n get optionElements() {\n return Array.from(this.hostElement.querySelectorAll<HTMLQ2OptionElement>('q2-option'));\n }\n\n get popoverMinHeight() {\n const { minRows } = this;\n const firstOption = this.hostElement.querySelector<HTMLQ2OptionElement>('q2-option:not([hidden])');\n let minHeight = firstOption && window.getComputedStyle(firstOption).minHeight;\n\n // Safari doesn't return a min-height for non-visible items\n if (!minHeight || minHeight === '0px') minHeight = '44px';\n\n return minRows * parseInt(minHeight);\n }\n\n get selectedDisplay() {\n if (this.prioritizeSearch || this.searchText) return this.searchText;\n if (this.hasCustomDisplay) return '';\n return this.multiple ? this.calculateMultiSelectSelectedDisplay() : this.calculateSingleSelectSelectedDisplay();\n }\n\n get selectedDisplaySlot() {\n return this.hostElement.querySelector<HTMLElement>('[slot=\"_selected-display\"]');\n }\n\n get wrapperClasses() {\n const { errors } = this;\n const classes = ['q2-select-container'];\n if (Array.isArray(errors) && errors.length > 0) classes.push('has-error');\n if (this.inputFocused) classes.push('is-focused');\n if (this.searchable) classes.push('is-searchable');\n return classes.join(' ');\n }\n\n _togglePopover() {\n const { innerInputField } = this;\n innerInputField?.click();\n innerInputField?.focus();\n innerInputField.dispatchEvent(new FocusEvent('focus'));\n }\n\n addTouchEventListeners = () => {\n if (!isMobile() || !this.popoverElement) return;\n\n this.popoverElement.addEventListener('touchmove', this.handleTouchMove, { passive: true });\n };\n\n calculateMultiSelectSelectedDisplay() {\n const { firstSelectedOptionElement, firstSelectedValue, multilineOptions } = this;\n if (!firstSelectedValue) return '';\n if (firstSelectedOptionElement?.display) return loc(firstSelectedOptionElement.display);\n if (multilineOptions && this.searchable) return this.searchText;\n if (multilineOptions) return '';\n return (\n firstSelectedOptionElement?.textContent?.trim() ?? firstSelectedOptionElement?.value ?? firstSelectedValue\n );\n }\n\n calculateSingleSelectSelectedDisplay() {\n const { firstSelectedOptionElement, multilineOptions } = this;\n if (multilineOptions) {\n return (firstSelectedOptionElement?.display && loc(firstSelectedOptionElement.display)) || this.value || '';\n } else {\n return (\n (firstSelectedOptionElement?.display && loc(firstSelectedOptionElement.display)) ||\n firstSelectedOptionElement?.textContent?.trim() ||\n this.value ||\n ''\n );\n }\n }\n\n checkSelectedDisplay() {\n // This prevents an undefined property error when the spec tests are run\n try {\n this.hostElement;\n } catch (error) {\n return null;\n }\n let namedSlot = this.selectedDisplaySlot;\n const { value, multiple, selectedOptions, multilineOptions, firstSelectedOptionElement, prioritizeSearch } =\n this;\n const hasNoValue = !value && multiple && !selectedOptions?.length;\n if (prioritizeSearch || !multilineOptions || hasNoValue) return this.clearSelectedDisplay();\n\n if (!firstSelectedOptionElement || firstSelectedOptionElement.display) return this.clearSelectedDisplay();\n\n // Clone selected option and remove elements with hide-on-select attribute\n const selectionClone = firstSelectedOptionElement.firstElementChild.cloneNode(true) as HTMLElement;\n selectionClone.querySelectorAll('[hide-on-select]').forEach(element => element.remove());\n\n if (namedSlot) {\n const height = namedSlot.clientHeight === 0 ? 'auto' : `${namedSlot.clientHeight}px`;\n namedSlot.style.setProperty('--comp-selected-display-height', height);\n if (namedSlot.firstElementChild.outerHTML !== selectionClone.outerHTML) {\n namedSlot.replaceChild(selectionClone, namedSlot.firstElementChild);\n }\n } else {\n namedSlot = document.createElement('div');\n namedSlot.slot = '_selected-display';\n namedSlot.appendChild(selectionClone);\n this.hostElement.appendChild(namedSlot);\n }\n return namedSlot;\n }\n\n checkSelectedDisplayHeight() {\n const { selectedDisplaySlot } = this;\n if (!selectedDisplaySlot) return;\n selectedDisplaySlot.style.setProperty('--comp-selected-display-height', '44px');\n }\n\n checkSelectedOptions() {\n const { multiple, selectedOptions, value } = this;\n this.optionElements.forEach(option => {\n if (multiple) {\n option.selected = selectedOptions.includes(option.value);\n } else {\n option.selected = option.value === value;\n }\n });\n }\n\n clearSearchText() {\n if (!this.searchText) return;\n this.searchText = '';\n this.input.emit({ query: '' });\n }\n\n clearSelectedDisplay() {\n this.selectedDisplaySlot?.remove();\n }\n\n clearValue() {\n const { multiple } = this;\n this.value = '';\n this.selectedOptions = [];\n this.change.emit({ value: multiple ? undefined : '', selectedOptions: multiple ? [] : undefined });\n }\n\n clickedElsewhere = (event: CustomEvent) => {\n const target = event.target as HTMLClickElsewhereElement;\n if (target.localName !== 'click-elsewhere') return;\n event.stopPropagation();\n const { popoverElement } = this;\n if (!popoverElement) return;\n popoverElement.open = false;\n this.innerInputField.blur();\n };\n\n closeDropdown() {\n this.open = false;\n this.lastTouchWasInPopover = false;\n this.clearSearchText();\n }\n\n destroyEventListeners = () => {\n if (!isMobile()) return;\n screen?.orientation?.removeEventListener('change', this.handleOrientationChange);\n window.removeEventListener('resize', this.handleOrientationChange);\n visualViewport?.removeEventListener('resize', this.handleOrientationChange);\n this.removeTouchEventListeners();\n };\n\n async executeActionSheet(event: MouseEvent | KeyboardEvent) {\n const result = await showActionSheetList(this, event);\n this.focusInput();\n this.handleSelectionChanges(result);\n }\n\n focusInput() {\n this.inputField?.dispatchEvent(new FocusEvent('focus'));\n }\n\n // Helps with checking for calls to handleExternalKeydown in spec tests\n handleOptionListExternalKeydown(event: KeyboardEvent) {\n this.optionList.handleExternalKeydown(event);\n }\n\n handleOrientationChange = () => {\n if (!isMobile()) return;\n\n let isLandscape: boolean;\n if (this.isModule) {\n isLandscape = window.Tecton?.platformDimensions.orientationType.includes('landscape');\n } else {\n isLandscape = screen?.orientation?.type?.includes('landscape');\n }\n if (isLandscape && this.searchable) this.searchable = false;\n if (!isLandscape) this.searchable = this.originalSearchable;\n };\n\n handleSelectionChanges(changeDetails: { value?: string; values?: IOptionValue[] }) {\n const { value = '', values = [] } = changeDetails;\n const selectedOptionValues = values.map(value => value.value);\n const { multiple } = this;\n if (!this.hostElement.onchange) {\n this.selectedOptions = selectedOptionValues;\n }\n\n this.change.emit({\n value: multiple ? undefined : value,\n selectedOptions: multiple ? selectedOptionValues : undefined,\n });\n }\n\n handleTouchMove = (event: TouchEvent) => {\n if (document.activeElement === this.hostElement) {\n const target = event.target as HTMLElement;\n if (target && target !== this.hostElement) {\n this.inputFocused = false;\n this.lastTouchWasInPopover = true;\n target.focus();\n }\n }\n };\n\n initEventListeners = () => {\n if (!isMobile()) return;\n screen?.orientation?.addEventListener('change', this.handleOrientationChange);\n window.addEventListener('resize', this.handleOrientationChange);\n visualViewport?.addEventListener('resize', this.handleOrientationChange);\n };\n\n initMutationObserver = () => {\n const observer = new MutationObserver(this.onMutationObserved);\n observer.observe(this.hostElement, { childList: true, subtree: true });\n this.mutationObserver = observer;\n this.onMutationObserved();\n };\n\n inputBlurHandler = () => {\n this.inputFocused = false;\n };\n\n inputChangeHandler = (event: Event) => {\n event.stopPropagation();\n };\n\n inputClickHandler = async (event: MouseEvent) => {\n event.stopPropagation();\n\n // Check if the last interaction was a touch within the popover\n // If so, don't toggle the dropdown as the user is likely continuing to interact\n if (this.lastTouchWasInPopover && this.open && this.searchable) {\n // Reset the flag and don't toggle\n this.lastTouchWasInPopover = false;\n this.focusInput();\n return;\n }\n\n // Reset the flag for any other click\n this.lastTouchWasInPopover = false;\n\n if (shouldShowActionSheet(this)) {\n return this.executeActionSheet(event);\n }\n this.toggleDropdown();\n this.focusInput();\n };\n\n inputFocusHandler = () => {\n this.inputFocused = true;\n };\n\n inputInputHandler = (event: Q2InputCustomEvent<IEventDetail> & InputEvent) => {\n event.stopPropagation();\n const eventValue = event.detail.value;\n const shouldClearValue = !!this.value;\n\n if (shouldClearValue) this.clearValue();\n if (!this.open) this.openDropdownWithoutActiveElement();\n\n this.prioritizeSearch = true;\n this.searchText = eventValue;\n this.input.emit({ query: eventValue });\n };\n\n inputKeydownHandler = (event: KeyboardEvent) => {\n if (this.readonly || this.disabled) return;\n const { key, shiftKey } = event;\n const isShiftTab = key === 'Tab' && shiftKey;\n const hasSlot = this.hasPopoverTop || this.hasPopoverBottom;\n if (hasSlot && (key === 'Tab' || isShiftTab)) return;\n\n // slots are incompatible with action sheet\n if (shouldShowActionSheet(this, event) && !hasSlot) {\n return this.executeActionSheet(event);\n }\n\n const keysForOptionListToHandle = [\n 'ArrowDown',\n 'ArrowUp',\n 'PageDown',\n 'PageUp',\n 'Home',\n 'End',\n 'Escape',\n 'Tab',\n ];\n\n if (this.searchable && (key === ' ' || key === 'Enter') && this.inputField.value == '') {\n event.preventDefault();\n if (!this.open) this.openDropdownWithoutActiveElement();\n }\n\n if (this.searchable && !keysForOptionListToHandle.includes(key)) return;\n if (this.shouldClearSearchText(event)) this.clearSearchText();\n\n // Prevent click event from firing when spacebar is pressed\n if (key === ' ') event.preventDefault();\n\n this.handleOptionListExternalKeydown(event);\n };\n\n onCustomDisplayClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.focusInput();\n this.toggleDropdown();\n };\n\n onMutationObserved = () => {\n const { hostElement, hasPopoverTop, hasPopoverBottom } = this;\n const slotContainer = hostElement.querySelector('.custom-display-content');\n const displaySlot = hostElement.shadowRoot.querySelector<HTMLSlotElement>('slot[name=\"q2-select-display\"]');\n const hasCustomDisplay = !!displaySlot\n ? displaySlot.assignedNodes().length > 0\n : slotContainer.children.length > 0;\n\n if (this.hasCustomDisplay !== hasCustomDisplay) {\n this.hasCustomDisplay = hasCustomDisplay;\n }\n\n const popTopSlot = hostElement.shadowRoot.querySelector<HTMLSlotElement>('slot[name=\"popover-top\"]');\n const topSlotHasNode = popTopSlot?.assignedNodes().length > 0;\n if (hasPopoverTop !== topSlotHasNode) {\n this.hasPopoverTop = topSlotHasNode;\n }\n\n const popBottomSlot = hostElement.shadowRoot.querySelector<HTMLSlotElement>('slot[name=\"popover-bottom\"]');\n const bottomSlotHasNode = popBottomSlot?.assignedNodes().length > 0;\n if (hasPopoverBottom !== bottomSlotHasNode) {\n this.hasPopoverBottom = bottomSlotHasNode;\n }\n\n this.checkSelectedOptions();\n };\n\n onOptionListChange = (event: Q2OptionListCustomEvent<{ value: string; values: IOptionValue[] }>) => {\n event.stopPropagation();\n const { values } = event.detail;\n\n if (values.length === 0) this.showAllOptions();\n this.handleSelectionChanges(event.detail);\n };\n\n onPopoverState = ({\n detail: { open, action },\n }: CustomEvent<{ open: boolean; action: 'close' | 'select' | 'open' }>) => {\n if (!open || this.searchText) {\n if (action !== 'select') {\n this.optionList.setActiveElement(null);\n }\n this.inputField.focus();\n }\n\n if (this.open === open) return;\n this.open = open;\n };\n\n openDropdownWithoutActiveElement() {\n if (this.readonly || this.disabled) return;\n this.optionList.setActiveElement(null);\n this.open = true;\n }\n\n removeTouchEventListeners = () => {\n if (!isMobile() || !this.popoverElement) return;\n\n this.popoverElement.removeEventListener('touchmove', this.handleTouchMove);\n };\n\n setCustomLabel() {\n const customLabel = this.hostElement.querySelector('[slot=\"label\"]');\n if (customLabel) {\n this.inputField?.appendChild(customLabel.cloneNode(true));\n this.hostElement.removeChild(customLabel);\n }\n }\n\n setStatusMessage(message) {\n clearTimeout(this.statusMessageTimer);\n this.statusMessage = '';\n this.statusMessageTimer = setTimeout(() => {\n this.statusMessage = message;\n }, 1000);\n }\n\n shouldClearSearchText(event: KeyboardEvent) {\n return this.searchable && !!this.searchText && event.key === 'Escape';\n }\n\n showAllOptions = () => {\n this.showSelected = false;\n };\n\n showSelectedOptions = () => {\n this.showSelected = true;\n };\n\n toggleDropdown() {\n if (this.readonly || this.disabled) return;\n\n if (this.open && !this.searchText) {\n this.closeDropdown();\n } else {\n this.openDropdownWithoutActiveElement();\n }\n }\n\n visibilityToggleKeyDown = (event: KeyboardEvent) => {\n const key = event.key;\n const isShiftTab = key === 'Tab' && event.shiftKey;\n const isRadioControlKey = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(key);\n if (isRadioControlKey) event.stopPropagation();\n if (isShiftTab) {\n event.stopPropagation();\n // allows shift+tab keys to select the top slot when present\n if (this.hasPopoverTop) return;\n\n this.optionList.setDefaultActiveElement();\n }\n };\n\n // #endregion\n // #region Render Methods\n\n renderCustomDisplay() {\n const hasSelectedDisplay = this.checkSelectedDisplay();\n if (!hasSelectedDisplay) return;\n this.checkSelectedDisplayHeight();\n\n return (\n <slot\n name=\"_selected-display\"\n slot=\"custom-display\"\n />\n );\n }\n\n renderOptionsDropdown() {\n return (\n <q2-popover\n ref={el => (this.popoverElement = el)}\n controlElement={this.innerInputContainer}\n open={this.open}\n max-height={this.popoverMaxHeight}\n minHeight={this.popoverMinHeight}\n direction={this.popDirection}\n mode={this.popoverMode || undefined}\n block\n >\n <div class=\"popover-content\">\n <q2-option-list\n onPopoverState={this.onPopoverState}\n ref={el => (this.optionList = el)}\n type=\"listbox\"\n id=\"option-list\"\n show-selected={this.showSelected}\n label={this.listLabel}\n multiple={this.multiple}\n selectedOptions={this.structuredSelectedOptions}\n onChange={this.onOptionListChange}\n >\n <slot />\n </q2-option-list>\n <div\n class=\"popover-top-container\"\n ref={el => (this.popoverTopContainer = el)}\n hidden={!this.multiple && !this.hasPopoverTop}\n tabindex=\"-1\"\n >\n <slot name=\"popover-top\"></slot>\n {this.multiple && this.renderVisibilityToggle()}\n </div>\n </div>\n <div\n class=\"popover-bottom-container\"\n hidden={!this.hasPopoverBottom}\n tabindex=\"-1\"\n >\n <slot name=\"popover-bottom\" />\n </div>\n </q2-popover>\n );\n }\n\n renderSelectField() {\n return (\n <Fragment>\n <div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n role=\"status\"\n class=\"sr\"\n >\n {this.statusMessage}\n </div>\n <q2-input\n ref={el => (this.inputField = el)}\n class=\"q2-select-input\"\n label={(this.label && loc(this.label)) || ''}\n value={this.selectedDisplay}\n clearable={(this.clearable && (!!this.value || !!this.selectedOptions?.length)) || undefined}\n errors={\n (Array.isArray(this.errors) &&\n this.errors.length > 0 &&\n this.errors.map(error => loc(error))) ||\n (this.invalid && ['tecton.element.select.invalid']) ||\n []\n }\n disabled={this.disabled}\n optional={this.optional}\n readonly={!!this.readonly}\n placeholder={this.placeholder || undefined}\n hideLabel={this.hideLabel}\n ariaExpanded={`${this.open}`}\n ariaControls=\"option-list\"\n ariaHaspopup=\"listbox\"\n test-id=\"toggleDropdown\"\n hide-messages\n iconRight=\"chevron-down\"\n onClick={this.inputClickHandler}\n onInput={this.inputInputHandler}\n onKeyDown={this.inputKeydownHandler}\n onFocus={this.inputFocusHandler}\n onBlur={this.inputBlurHandler}\n onChange={this.inputChangeHandler}\n badgeValue={this.badgeValue}\n badgeTheme={this.inputFocused ? 'primary' : undefined}\n _role=\"combobox\"\n _preventEntry={!this.searchable}\n >\n {this.renderCustomDisplay()}\n </q2-input>\n <div\n class=\"custom-display-content\"\n hidden={!this.hasCustomDisplay || !!this.searchText}\n onClick={this.onCustomDisplayClick}\n >\n <slot name=\"q2-select-display\" />\n </div>\n {this.renderOptionsDropdown()}\n </Fragment>\n );\n }\n\n renderVisibilityToggle() {\n const selectedOptionsCount = this.selectedOptions?.length ?? 0;\n const { showSelected } = this;\n return (\n <div class=\"multi-select-header\">\n <fieldset>\n <legend aria-label={loc('tecton.element.select.multiHeader.showing')}>\n {loc('tecton.element.select.multiHeader.showing')}\n </legend>\n <div>\n <input\n class=\"sr\"\n type=\"radio\"\n id=\"all\"\n name=\"viewDisplay\"\n value=\"all\"\n checked={!showSelected}\n aria-label={loc('tecton.element.select.multiHeader.allAriaLabel')}\n test-id=\"allOptionsButton\"\n onClick={this.showAllOptions}\n onKeyDown={this.visibilityToggleKeyDown}\n />\n <label htmlFor=\"all\">{loc('tecton.element.select.multiHeader.all')}</label>\n </div>\n\n <div>\n <input\n class=\"sr\"\n type=\"radio\"\n id=\"selected\"\n disabled={selectedOptionsCount === 0}\n name=\"viewDisplay\"\n value=\"selected\"\n aria-label={loc('tecton.element.select.multiHeader.selectedAriaLabel', [\n selectedOptionsCount,\n ])}\n checked={showSelected}\n test-id=\"selectedOptionsButton\"\n onClick={this.showSelectedOptions}\n onKeyDown={this.visibilityToggleKeyDown}\n />\n <label htmlFor=\"selected\">\n {loc('tecton.element.select.multiHeader.selected', [selectedOptionsCount])}\n </label>\n </div>\n </fieldset>\n </div>\n );\n }\n\n render() {\n return (\n <click-elsewhere\n class={this.wrapperClasses}\n onChange={this.clickedElsewhere}\n >\n {this.renderSelectField()}\n </click-elsewhere>\n );\n }\n\n // #endregion\n}\n\n// #endregion\n"],"mappings":"kMAAA,MAAMA,EAAc,skNACpB,MAAAC,EAAeD,E,MCkCFE,EAAQ,M,2FAGjBC,KAAAC,KAAOC,IAEPF,KAAAG,sBAAiC,MAMjCH,KAAAI,qBAAuC,GAghBvCJ,KAAAK,uBAAyB,KACrB,IAAKC,MAAeN,KAAKO,eAAgB,OAEzCP,KAAKO,eAAeC,iBAAiB,YAAaR,KAAKS,gBAAiB,CAAEC,QAAS,MAAO,EAgG9FV,KAAAW,iBAAoBC,IAChB,MAAMC,EAASD,EAAMC,OACrB,GAAIA,EAAOC,YAAc,kBAAmB,OAC5CF,EAAMG,kBACN,MAAMR,eAAEA,GAAmBP,KAC3B,IAAKO,EAAgB,OACrBA,EAAeS,KAAO,MACtBhB,KAAKiB,gBAAgBC,MAAM,EAS/BlB,KAAAmB,sBAAwB,K,MACpB,IAAKb,IAAY,QACjBc,EAAAC,SAAM,MAANA,cAAM,SAANA,OAAQC,eAAW,MAAAF,SAAA,SAAAA,EAAEG,oBAAoB,SAAUvB,KAAKwB,yBACxDC,OAAOF,oBAAoB,SAAUvB,KAAKwB,yBAC1CE,iBAAc,MAAdA,sBAAc,SAAdA,eAAgBH,oBAAoB,SAA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AoBvJ,EAAI,8CACnBA,EAAI,8CAETuJ,EAAA,WACIA,EAAA,SACIW,MAAM,KACNnP,KAAK,QACLoP,GAAG,MACH3G,KAAK,cACL5G,MAAM,MACNmP,SAAUrM,EAAY,aACVM,EAAI,kDAAiD,UACzD,mBACRsL,QAAS3S,KAAKyG,eACdoM,UAAW7S,KAAKiH,0BAEpB2J,EAAA,SAAOyC,QAAQ,OAAOhM,EAAI,2CAG9BuJ,EAAA,WACIA,EAAA,SACIW,MAAM,KACNnP,KAAK,QACLoP,GAAG,WACH5M,SAAUuO,IAAyB,EACnCtI,KAAK,cACL5G,MAAM,WAAU,aACJoD,EAAI,sDAAuD,CACnE8L,IAEJC,QAASrM,EAAY,UACb,wBACR4L,QAAS3S,KAAKgH,oBACd6L,UAAW7S,KAAKiH,0BAEpB2J,EAAA,SAAOyC,QAAQ,YACVhM,EAAI,6CAA8C,CAAC8L,O,CAQ5E,MAAAG,GACI,OACI1C,EAAA,mBAAA/L,IAAA,2CACI0M,MAAOvR,KAAK2O,eACZgD,SAAU3R,KAAKW,kBAEdX,KAAK8R,oB"}
@@ -1,2 +1,2 @@
1
- import{r as o,c as t,g as i,h as e}from"./p-a5f18e27.js";import{h as s,w as r,v as n,d as p}from"./p-ff8ed604.js";const a=class{constructor(i){o(this,i);this.change=t(this,"change",7);this.isCurrentlyFocused=false;this.mouseEventList=["mousedown","dragstart","touchstart"];this.mouseHandler=o=>{const t=this.shadowContains(this.findActiveElement());const i=this.shadowContains(this.shadowEventTarget(o))||this.originatesInSlots(o.target);if(!i&&(this.isCurrentlyFocused||t)){this.isCurrentlyFocused=false;this.change.emit();return}this.isCurrentlyFocused=i||t};this.windowBlurHandler=()=>{this.isCurrentlyFocused=false;this.change.emit()}}connectedCallback(){this.mouseEventList.forEach((o=>{document.addEventListener(o,this.mouseHandler)}));window.addEventListener("blur",this.windowBlurHandler)}disconnectedCallback(){this.mouseEventList.forEach((o=>{document.removeEventListener(o,this.mouseHandler)}));window.removeEventListener("blur",this.windowBlurHandler)}componentWillLoad(){}findActiveElement(){let o=document.activeElement;while(true){if(!o||!o.shadowRoot){return o}o=o.shadowRoot.activeElement}}originatesInSlots(o){const t=this.hostElement.querySelectorAll("slot");for(const i of Array.from(t)){const t=i&&i.assignedNodes&&i.assignedNodes()||this.hostElement.childNodes;for(const i of Array.from(t)){if(i.contains(o)){return true}}}return false}shadowContains(o){while(true){if(o===this.hostElement){return true}if(!o){return false}o=o.parentNode||o.host}}shadowEventTarget(o){return o.composedPath()[0]||o.target}get hostElement(){return i(this)}};const c="*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.legacy.container{display:none}.legacy.show{display:block;z-index:var(--tct-popover-z-index, 50)}:popover-open,.show{position:absolute;margin:0;padding:0;overflow:auto;background:var(--tct-popover-background, var(--app-white, #ffffff));color:var(--tct-popover-font-color, var(--t-text, #4d4d4d));min-width:var(--tct-popover-min-width, 135px);margin-block:var(--tct-popover-margin-block, 0);box-shadow:var(--tct-popover-box-shadow, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14)));border-width:var(--tct-popover-border-width, 0);border-style:solid;border-color:var(--tct-popover-border-color, transparent);border-radius:var(--tct-popover-border-radius, 0);max-height:var(--comp-pop-max-height);left:var(--comp-pop-left);opacity:var(--comp-pop-opacity, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 4px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}:popover-open.block,.show.block{right:unset;width:var(--comp-pop-width);min-width:var(--tct-popover-min-width, unset)}:popover-open.left,.show.left{left:var(--comp-pop-left);right:unset}:popover-open.right,.show.right{right:var(--comp-pop-right);left:unset}:popover-open.down,.show.down{top:var(--tct-popover-top, var(--comp-pop-top));bottom:unset}:popover-open.up,.show.up{top:unset;bottom:var(--comp-pop-bottom)}:popover-open::-webkit-scrollbar,.show::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}:popover-open::-webkit-scrollbar-thumb,.show::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}:popover-open::-webkit-scrollbar-track,.show::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}click-elsewhere{position:relative;display:block}";const l=c;const h=class{constructor(i){o(this,i);this.popoverStateChanged=t(this,"popoverStateChanged",7);this.displayBuffer=10;this.orientationChanged=false;this.handleMinHeight=()=>{if(this.minHeight){s(this,"minHeight","prop")}};this.handlePopoverToggleEvent=o=>{this.popoverStateChanged.emit({open:o.newState==="open"})};this.setAbsoluteCSSProperties=async()=>{const{controlElement:o,containerElement:t,currentDirection:i,align:e}=this;if(e==="right"){t.style.setProperty("--comp-pop-right","0");t.style.setProperty("--comp-pop-left","unset")}else{t.style.setProperty("--comp-pop-left","0");t.style.setProperty("--comp-pop-right","unset")}if(this.block){t.style.setProperty("--comp-pop-width","100%")}if(i==="up"){const i=getComputedStyle(o);const e=parseInt(i.height||"0")+parseInt(i.borderTopWidth||"0")+parseInt(i.borderBottomWidth||"0");t.style.setProperty("--comp-pop-bottom",`${e}px`)}await r();t.style.setProperty("--comp-pop-opacity","1")};this.setPopoverAPICSSProperties=async()=>{var o,t,i;const{controlElement:e,containerElement:s,currentDirection:n,isModule:p,align:a}=this;const{top:c,bottom:l,left:h,right:d}=(t=(o=e===null||e===void 0?void 0:e.getBoundingClientRect)===null||o===void 0?void 0:o.call(e))!==null&&t!==void 0?t:{top:0,bottom:0,left:0,right:0};const u=h;const v=((i=window===null||window===void 0?void 0:window.visualViewport)===null||i===void 0?void 0:i.width)-d;if(a==="right"){s.style.setProperty("--comp-pop-right",`${v-window.scrollX}px`);s.style.setProperty("--comp-pop-left","unset")}else{s.style.setProperty("--comp-pop-left",`${u+window.scrollX}px`);s.style.setProperty("--comp-pop-right","unset")}if(this.block)s.style.setProperty("--comp-pop-width",`${(e===null||e===void 0?void 0:e.offsetWidth)||0}px`);if(n==="up"){if(p){s.style.setProperty("--comp-pop-bottom",`${window.innerHeight-c}px`)}else{s.style.setProperty("--comp-pop-bottom",`${window.innerHeight-c-window.scrollY}px`)}}if(n==="down"){if(p){s.style.setProperty("--comp-pop-top",`${l}px`)}else{s.style.setProperty("--comp-pop-top",`${l+window.scrollY}px`)}}await r();s.style.setProperty("--comp-pop-opacity","1")};this.viewPortChanged=()=>{if(!this.open)return;this.determinePopDirection()};this.viewPortOrientationChanged=()=>{this.orientationChanged=true;this.viewPortChanged()};this.currentDirection=undefined;this.show=false;this.align="left";this.block=undefined;this.controlElement=undefined;this.direction=undefined;this.minHeight=undefined;this.mode=null;this.open=undefined}disconnectedCallback(){this.removeViewportListeners();this.containerElement.removeEventListener("toggle",this.handlePopoverToggleEvent);this.containerElement=null;this.contentElement=null;this.controlElement=null}componentWillLoad(){if(!this.supportsPopoverAPI){console.warn("The Popover API is not supported in this browser. Please update your browser to the latest version. The component will use legacy mode.");this.mode="legacy"}}componentDidLoad(){this.handleMinHeight();if(this.supportsPopoverAPI)this.containerElement.addEventListener("toggle",this.handlePopoverToggleEvent);if(this.open)this.determinePopDirection()}popoverStateHandler(o){const{detail:{open:t}}=o;if(t===this.open)return;this.open=t;o.stopPropagation()}async scrollContainerTo(o){this.containerElement.scrollTo(o)}async toggle(){this.open=!this.open}minHeightProvided(){this.handleMinHeight()}async openChanged(o){this.popoverStateChanged.emit({open:o});if(o){this.addViewportListeners();this.determinePopDirection()}else{this.removeViewportListeners();this.currentDirection=undefined;if(this.mode==="legacy"||!this.supportsPopoverAPI){this.show=false}else{this.containerElement.hidePopover()}await r();this.clearCSSProperties()}}get isModule(){var o,t;const i=window!==window.top;const e=Object.keys((t=(o=window.Tecton)===null||o===void 0?void 0:o.platformDimensions)!==null&&t!==void 0?t:{}).length>0;return i&&e}get providedDirection(){const{direction:o}=this;switch(o){case"up":case"down":return o;default:return undefined}}get supportsPopoverAPI(){return Object.hasOwn(HTMLElement.prototype,"popover")}addViewportListeners(){var o;window.addEventListener("resize",this.viewPortOrientationChanged);visualViewport===null||visualViewport===void 0?void 0:visualViewport.addEventListener("resize",this.viewPortChanged);if(n(this.hostElement)&&!p()){window.addEventListener("scroll",this.viewPortChanged,{passive:true,capture:true})}(o=screen===null||screen===void 0?void 0:screen.orientation)===null||o===void 0?void 0:o.addEventListener("orientationchange",this.viewPortOrientationChanged);window.addEventListener("orientationchange",this.viewPortOrientationChanged)}clearCSSProperties(){this.containerElement.style.removeProperty("--comp-pop-max-height");this.containerElement.style.removeProperty("--comp-pop-top");this.containerElement.style.removeProperty("--comp-pop-bottom");this.containerElement.style.removeProperty("--comp-pop-left");this.containerElement.style.removeProperty("--comp-pop-right");this.containerElement.style.removeProperty("--comp-pop-width");this.containerElement.style.removeProperty("--comp-pop-opacity")}async determinePopDirection(){var o,t,i;const{containerElement:e,controlElement:s,providedDirection:n,displayBuffer:p}=this;if(e)e.style.maxHeight=null;await r();const{isModule:a}=this;const{top:c,bottom:l}=(t=(o=s===null||s===void 0?void 0:s.getBoundingClientRect)===null||o===void 0?void 0:o.call(s))!==null&&t!==void 0?t:{top:0,bottom:0};let h;let d;let u;if(a){const{outletOffset:o=0,innerHeight:t=window.innerHeight,top:e=0,bottom:s=0}=((i=window.Tecton)===null||i===void 0?void 0:i.platformDimensions)||{};const r=window.innerHeight-l;const n=o>0?c:c+o-e;const a=o+l-e;const h=n;const v=t-s-a;const w=r<v;d=h-p;u=w?r-p:v-p}else{h=window.innerHeight;d=c-p;u=h-l-p}const v=d>u?"up":"down";const w=!e.style.getPropertyValue("--comp-pop-max-height")||this.orientationChanged;this.orientationChanged=false;const b=this.currentDirection||n||v;switch(b){case"up":if(w){e.style.setProperty("--comp-pop-max-height",`${d}px`)}this.setDirectionAndShow("up");break;case"down":if(w){e.style.setProperty("--comp-pop-max-height",`${u}px`)}this.setDirectionAndShow("down");break}}removeViewportListeners(){var o;window.removeEventListener("resize",this.viewPortOrientationChanged);visualViewport===null||visualViewport===void 0?void 0:visualViewport.removeEventListener("resize",this.viewPortChanged);window.removeEventListener("scroll",this.viewPortChanged,{capture:true});(o=screen===null||screen===void 0?void 0:screen.orientation)===null||o===void 0?void 0:o.removeEventListener("orientationchange",this.viewPortOrientationChanged);window.removeEventListener("orientationchange",this.viewPortOrientationChanged)}setDirectionAndShow(o){const t=this.open;if(!t)return;this.currentDirection=o;if(this.mode==="legacy"||!this.supportsPopoverAPI){this.show=true;this.setAbsoluteCSSProperties()}else{this.setPopoverAPICSSProperties();this.containerElement.showPopover()}}render(){const o=["container",this.currentDirection,this.align];if(this.show)o.push("show");if(this.block)o.push("block");if(this.mode==="legacy")o.push("legacy");return e("div",{key:"9e0d1d581cb24bf6189b289fbe4e77e21064b275",ref:o=>this.containerElement=o,class:o.join(" "),"test-id":"outerContainer",tabIndex:-1,popover:"manual"},e("div",{key:"8eff792ebb66e3f23985755e6884e8e3ce8ce9b3",ref:o=>this.contentElement=o,class:"content"},e("slot",{key:"68e641a22f00c6f9e8dbb8900dd22db5fb3f3c6b"})))}get hostElement(){return i(this)}static get watchers(){return{minHeight:["minHeightProvided"],open:["openChanged"]}}};h.style=l;export{a as click_elsewhere,h as q2_popover};
2
- //# sourceMappingURL=p-181d0482.entry.js.map
1
+ import{r as o,c as t,g as i,h as e}from"./p-a5f18e27.js";import{h as s,w as r,x as n,d as p}from"./p-33c5a660.js";const a=class{constructor(i){o(this,i);this.change=t(this,"change",7);this.isCurrentlyFocused=false;this.mouseEventList=["mousedown","dragstart","touchstart"];this.mouseHandler=o=>{const t=this.shadowContains(this.findActiveElement());const i=this.shadowContains(this.shadowEventTarget(o))||this.originatesInSlots(o.target);if(!i&&(this.isCurrentlyFocused||t)){this.isCurrentlyFocused=false;this.change.emit();return}this.isCurrentlyFocused=i||t};this.windowBlurHandler=()=>{this.isCurrentlyFocused=false;this.change.emit()}}connectedCallback(){this.mouseEventList.forEach((o=>{document.addEventListener(o,this.mouseHandler)}));window.addEventListener("blur",this.windowBlurHandler)}disconnectedCallback(){this.mouseEventList.forEach((o=>{document.removeEventListener(o,this.mouseHandler)}));window.removeEventListener("blur",this.windowBlurHandler)}componentWillLoad(){}findActiveElement(){let o=document.activeElement;while(true){if(!o||!o.shadowRoot){return o}o=o.shadowRoot.activeElement}}originatesInSlots(o){const t=this.hostElement.querySelectorAll("slot");for(const i of Array.from(t)){const t=i&&i.assignedNodes&&i.assignedNodes()||this.hostElement.childNodes;for(const i of Array.from(t)){if(i.contains(o)){return true}}}return false}shadowContains(o){while(true){if(o===this.hostElement){return true}if(!o){return false}o=o.parentNode||o.host}}shadowEventTarget(o){return o.composedPath()[0]||o.target}get hostElement(){return i(this)}};const c="*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.legacy.container{display:none}.legacy.show{display:block;z-index:var(--tct-popover-z-index, 50)}:popover-open,.show{position:absolute;margin:0;padding:0;overflow:auto;background:var(--tct-popover-background, var(--app-white, #ffffff));color:var(--tct-popover-font-color, var(--t-text, #4d4d4d));min-width:var(--tct-popover-min-width, 135px);margin-block:var(--tct-popover-margin-block, 0);box-shadow:var(--tct-popover-box-shadow, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14)));border-width:var(--tct-popover-border-width, 0);border-style:solid;border-color:var(--tct-popover-border-color, transparent);border-radius:var(--tct-popover-border-radius, 0);max-height:var(--comp-pop-max-height);left:var(--comp-pop-left);opacity:var(--comp-pop-opacity, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 4px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}:popover-open.block,.show.block{right:unset;width:var(--comp-pop-width);min-width:var(--tct-popover-min-width, unset)}:popover-open.left,.show.left{left:var(--comp-pop-left);right:unset}:popover-open.right,.show.right{right:var(--comp-pop-right);left:unset}:popover-open.down,.show.down{top:var(--tct-popover-top, var(--comp-pop-top));bottom:unset}:popover-open.up,.show.up{top:unset;bottom:var(--comp-pop-bottom)}:popover-open::-webkit-scrollbar,.show::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}:popover-open::-webkit-scrollbar-thumb,.show::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}:popover-open::-webkit-scrollbar-track,.show::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}click-elsewhere{position:relative;display:block}";const l=c;const h=class{constructor(i){o(this,i);this.popoverStateChanged=t(this,"popoverStateChanged",7);this.displayBuffer=10;this.orientationChanged=false;this.handleMinHeight=()=>{if(this.minHeight){s(this,"minHeight","prop")}};this.handlePopoverToggleEvent=o=>{this.popoverStateChanged.emit({open:o.newState==="open"})};this.setAbsoluteCSSProperties=async()=>{const{controlElement:o,containerElement:t,currentDirection:i,align:e}=this;if(e==="right"){t.style.setProperty("--comp-pop-right","0");t.style.setProperty("--comp-pop-left","unset")}else{t.style.setProperty("--comp-pop-left","0");t.style.setProperty("--comp-pop-right","unset")}if(this.block){t.style.setProperty("--comp-pop-width","100%")}if(i==="up"){const i=getComputedStyle(o);const e=parseInt(i.height||"0")+parseInt(i.borderTopWidth||"0")+parseInt(i.borderBottomWidth||"0");t.style.setProperty("--comp-pop-bottom",`${e}px`)}await r();t.style.setProperty("--comp-pop-opacity","1")};this.setPopoverAPICSSProperties=async()=>{var o,t,i;const{controlElement:e,containerElement:s,currentDirection:n,isModule:p,align:a}=this;const{top:c,bottom:l,left:h,right:d}=(t=(o=e===null||e===void 0?void 0:e.getBoundingClientRect)===null||o===void 0?void 0:o.call(e))!==null&&t!==void 0?t:{top:0,bottom:0,left:0,right:0};const u=h;const v=((i=window===null||window===void 0?void 0:window.visualViewport)===null||i===void 0?void 0:i.width)-d;if(a==="right"){s.style.setProperty("--comp-pop-right",`${v-window.scrollX}px`);s.style.setProperty("--comp-pop-left","unset")}else{s.style.setProperty("--comp-pop-left",`${u+window.scrollX}px`);s.style.setProperty("--comp-pop-right","unset")}if(this.block)s.style.setProperty("--comp-pop-width",`${(e===null||e===void 0?void 0:e.offsetWidth)||0}px`);if(n==="up"){if(p){s.style.setProperty("--comp-pop-bottom",`${window.innerHeight-c}px`)}else{s.style.setProperty("--comp-pop-bottom",`${window.innerHeight-c-window.scrollY}px`)}}if(n==="down"){if(p){s.style.setProperty("--comp-pop-top",`${l}px`)}else{s.style.setProperty("--comp-pop-top",`${l+window.scrollY}px`)}}await r();s.style.setProperty("--comp-pop-opacity","1")};this.viewPortChanged=()=>{if(!this.open)return;this.determinePopDirection()};this.viewPortOrientationChanged=()=>{this.orientationChanged=true;this.viewPortChanged()};this.currentDirection=undefined;this.show=false;this.align="left";this.block=undefined;this.controlElement=undefined;this.direction=undefined;this.minHeight=undefined;this.mode=null;this.open=undefined}disconnectedCallback(){this.removeViewportListeners();this.containerElement.removeEventListener("toggle",this.handlePopoverToggleEvent);this.containerElement=null;this.contentElement=null;this.controlElement=null}componentWillLoad(){if(!this.supportsPopoverAPI){console.warn("The Popover API is not supported in this browser. Please update your browser to the latest version. The component will use legacy mode.");this.mode="legacy"}}componentDidLoad(){this.handleMinHeight();if(this.supportsPopoverAPI)this.containerElement.addEventListener("toggle",this.handlePopoverToggleEvent);if(this.open)this.determinePopDirection()}popoverStateHandler(o){const{detail:{open:t}}=o;if(t===this.open)return;this.open=t;o.stopPropagation()}async scrollContainerTo(o){this.containerElement.scrollTo(o)}async toggle(){this.open=!this.open}minHeightProvided(){this.handleMinHeight()}async openChanged(o){this.popoverStateChanged.emit({open:o});if(o){this.addViewportListeners();this.determinePopDirection()}else{this.removeViewportListeners();this.currentDirection=undefined;if(this.mode==="legacy"||!this.supportsPopoverAPI){this.show=false}else{this.containerElement.hidePopover()}await r();this.clearCSSProperties()}}get isModule(){var o,t;const i=window!==window.top;const e=Object.keys((t=(o=window.Tecton)===null||o===void 0?void 0:o.platformDimensions)!==null&&t!==void 0?t:{}).length>0;return i&&e}get providedDirection(){const{direction:o}=this;switch(o){case"up":case"down":return o;default:return undefined}}get supportsPopoverAPI(){return Object.hasOwn(HTMLElement.prototype,"popover")}addViewportListeners(){var o;window.addEventListener("resize",this.viewPortOrientationChanged);visualViewport===null||visualViewport===void 0?void 0:visualViewport.addEventListener("resize",this.viewPortChanged);if(n(this.hostElement)&&!p()){window.addEventListener("scroll",this.viewPortChanged,{passive:true,capture:true})}(o=screen===null||screen===void 0?void 0:screen.orientation)===null||o===void 0?void 0:o.addEventListener("orientationchange",this.viewPortOrientationChanged);window.addEventListener("orientationchange",this.viewPortOrientationChanged)}clearCSSProperties(){this.containerElement.style.removeProperty("--comp-pop-max-height");this.containerElement.style.removeProperty("--comp-pop-top");this.containerElement.style.removeProperty("--comp-pop-bottom");this.containerElement.style.removeProperty("--comp-pop-left");this.containerElement.style.removeProperty("--comp-pop-right");this.containerElement.style.removeProperty("--comp-pop-width");this.containerElement.style.removeProperty("--comp-pop-opacity")}async determinePopDirection(){var o,t,i;const{containerElement:e,controlElement:s,providedDirection:n,displayBuffer:p}=this;if(e)e.style.maxHeight=null;await r();const{isModule:a}=this;const{top:c,bottom:l}=(t=(o=s===null||s===void 0?void 0:s.getBoundingClientRect)===null||o===void 0?void 0:o.call(s))!==null&&t!==void 0?t:{top:0,bottom:0};let h;let d;let u;if(a){const{outletOffset:o=0,innerHeight:t=window.innerHeight,top:e=0,bottom:s=0}=((i=window.Tecton)===null||i===void 0?void 0:i.platformDimensions)||{};const r=window.innerHeight-l;const n=o>0?c:c+o-e;const a=o+l-e;const h=n;const v=t-s-a;const w=r<v;d=h-p;u=w?r-p:v-p}else{h=window.innerHeight;d=c-p;u=h-l-p}const v=d>u?"up":"down";const w=!e.style.getPropertyValue("--comp-pop-max-height")||this.orientationChanged;this.orientationChanged=false;const b=this.currentDirection||n||v;switch(b){case"up":if(w){e.style.setProperty("--comp-pop-max-height",`${d}px`)}this.setDirectionAndShow("up");break;case"down":if(w){e.style.setProperty("--comp-pop-max-height",`${u}px`)}this.setDirectionAndShow("down");break}}removeViewportListeners(){var o;window.removeEventListener("resize",this.viewPortOrientationChanged);visualViewport===null||visualViewport===void 0?void 0:visualViewport.removeEventListener("resize",this.viewPortChanged);window.removeEventListener("scroll",this.viewPortChanged,{capture:true});(o=screen===null||screen===void 0?void 0:screen.orientation)===null||o===void 0?void 0:o.removeEventListener("orientationchange",this.viewPortOrientationChanged);window.removeEventListener("orientationchange",this.viewPortOrientationChanged)}setDirectionAndShow(o){const t=this.open;if(!t)return;this.currentDirection=o;if(this.mode==="legacy"||!this.supportsPopoverAPI){this.show=true;this.setAbsoluteCSSProperties()}else{this.setPopoverAPICSSProperties();this.containerElement.showPopover()}}render(){const o=["container",this.currentDirection,this.align];if(this.show)o.push("show");if(this.block)o.push("block");if(this.mode==="legacy")o.push("legacy");return e("div",{key:"9e0d1d581cb24bf6189b289fbe4e77e21064b275",ref:o=>this.containerElement=o,class:o.join(" "),"test-id":"outerContainer",tabIndex:-1,popover:"manual"},e("div",{key:"8eff792ebb66e3f23985755e6884e8e3ce8ce9b3",ref:o=>this.contentElement=o,class:"content"},e("slot",{key:"68e641a22f00c6f9e8dbb8900dd22db5fb3f3c6b"})))}get hostElement(){return i(this)}static get watchers(){return{minHeight:["minHeightProvided"],open:["openChanged"]}}};h.style=l;export{a as click_elsewhere,h as q2_popover};
2
+ //# sourceMappingURL=p-20e50baf.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as t,c as a,h as r,F as c,g as o}from"./p-a5f18e27.js";import{p as e,o as i,i as s}from"./p-ff8ed604.js";const n="*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block}.container{position:relative;width:100%;text-align:start;height:100%;display:grid;gap:var(--tct-card-gap, var(--t-card-gap, var(--app-scale-3x, 15px)));margin:0;color:var(--tct-card-color, var(--t-card-color, var(--t-text, #4d4d4d)));--comp-avatar-size:var(--tct-card-avatar-size, var(--t-card-avatar-size, 44px));--comp-chevron-size:0;--comp-bar-width:var(--tct-card-bar-width, var(--t-card-bar-width, var(--app-scale-2x, 10px)));--comp-card-padding:var(--tct-card-padding, var(--t-card-padding, var(--app-scale-4x, 20px)))}.container.is-small{--comp-avatar-size:var(--tct-card-avatar-size, var(--t-card-avatar-size, 26px))}.container.has-avatar{grid-template-columns:var(--comp-avatar-size) 1fr;--tct-avatar-width:var(--comp-avatar-size);--tct-avatar-height:var(--comp-avatar-size);--tct-icon-size:var(--comp-avatar-size)}:host([bar][is-static]) .container{padding-left:var(--comp-card-padding)}:host(:not([is-static])) .container{--comp-border-radius:var(--tct-card-border-radius, var(--t-card-border-radius, var(--app-border-radius-1, 4px)));--comp-border-width:var(--tct-card-border-width, var(--t-card-border-width, 0px));border:none;background:var(--tct-card-background, var(--t-card-background, var(--t-base, #ffffff)));padding:var(--comp-card-padding);text-decoration:none;border-width:var(--comp-border-width);border-color:var(--tct-card-border-color, var(--t-card-border-color, transparent));border-style:var(--tct-card-border-style, solid);border-radius:var(--comp-border-radius);transition:box-shadow var(--tct-tween-1, var(--app-tween-1, 0.2s ease));box-shadow:var(--tct-card-box-shadow, var(--t-card-box-shadow, var(--app-shadow-2, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 4px 8px rgba(0, 0, 0, 0.14))))}:host(:not([is-static])) .container.clickable{cursor:pointer}@media (hover: hover){:host(:not([is-static])) .container.clickable{--comp-card-hover-box-shadow:var(--tct-card-hover-box-shadow, var(--t-card-hover-box-shadow, var(--app-shadow-3, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 8px 16px rgba(0, 0, 0, 0.14))))}:host(:not([is-static])) .container.clickable:hover,:host(:not([is-static])) .container.clickable:active,:host(:not([is-static])) .container.clickable:focus{color:var(--tct-card-color, var(--t-card-color, var(--t-text, #4d4d4d)));box-shadow:var(--const-double-focus-ring)}:host(:not([is-static])) .container.clickable:hover{box-shadow:var(--comp-card-hover-box-shadow)}:host(:not([is-static])) .container.clickable:focus:hover{box-shadow:var(--const-double-focus-ring), var(--comp-card-hover-box-shadow)}:host(:not([is-static])) .container.clickable:active{box-shadow:var(--tct-card-active-box-shadow, var(--t-card-active-box-shadow, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14))))}}:host(:not([is-static])) .container.is-touch{--comp-chevron-size:var(--tct-card-chevron-size, var(--t-card-chevron-size, 26px));grid-template-columns:1fr var(--comp-chevron-size)}:host(:not([is-static])) .container.has-avatar.is-touch{grid-template-columns:var(--comp-avatar-size) 1fr var(--comp-chevron-size)}.content{overflow:hidden;display:grid;gap:var(--tct-card-content-gap, var(--t-card-content-gap, var(--app-scale-1x, 5px)));align-content:start}h3,p{margin:0;padding:0;line-height:var(--tct-card-font-height, var(--t-card-font-height, 20px))}h3{font-weight:var(--tct-card-font-weight, var(--t-card-font-weight, 600));font-size:var(--tct-card-font-size, var(--t-card-font-size, 17px));text-overflow:ellipsis;overflow:hidden;white-space:nowrap}p{text-overflow:ellipsis;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.bar{--comp-bar-border-radius:calc(var(--comp-border-radius) - var(--comp-border-width));border-radius:var(--comp-bar-border-radius) 0 0 var(--comp-bar-border-radius);position:absolute;inset:0 auto auto 0;width:var(--comp-bar-width);background:var(--comp-bar-color);height:100%}.bar.color-primary{--comp-bar-color:var(--tct-card-bar-color-primary, var(--t-primary, #5446a4))}.bar.color-secondary{--comp-bar-color:var(--tct-card-bar-color-secondary, var(--t-secondary, #b6b3cc))}.bar.color-tertiary{--comp-bar-color:var(--tct-card-bar-color-tertiary, var(--t-tertiary, #ebe8fc))}.bar.color-info{--comp-bar-color:var(--tct-card-bar-color-info, var(--const-stoplight-info, #0079c1))}.bar.color-success{--comp-bar-color:var(--tct-card-bar-color-success, var(--const-stoplight-success, #0e8a00))}.bar.color-warning{--comp-bar-color:var(--tct-card-bar-color-warning, var(--const-stoplight-warning, #c35500))}.bar.color-alert{--comp-bar-color:var(--tct-card-bar-color-alert, var(--const-stoplight-alert, #c35500))}.bar.color-accent-1{--comp-bar-color:var(--tct-card-bar-color-accent-1, var(--t-accent-1, #e05252))}.bar.color-accent-2{--comp-bar-color:var(--tct-card-bar-color-accent-2, var(--t-accent-2, #e09952))}.bar.color-accent-3{--comp-bar-color:var(--tct-card-bar-color-accent-3, var(--t-accent-3, #e0e052))}.bar.color-accent-4{--comp-bar-color:var(--tct-card-bar-color-accent-4, var(--t-accent-4, #99e052))}.bar.color-accent-5{--comp-bar-color:var(--tct-card-bar-color-accent-5, var(--t-accent-5, #52e052))}.bar.color-accent-6{--comp-bar-color:var(--tct-card-bar-color-accent-6, var(--t-accent-6, #52e099))}.bar.color-accent-7{--comp-bar-color:var(--tct-card-bar-color-accent-7, var(--t-accent-7, #52e0e0))}.bar.color-accent-8{--comp-bar-color:var(--tct-card-bar-color-accent-8, var(--t-accent-8, #5299e0))}.bar.color-accent-9{--comp-bar-color:var(--tct-card-bar-color-accent-9, var(--t-accent-9, #5252e0))}.bar.color-accent-10{--comp-bar-color:var(--tct-card-bar-color-accent-10, var(--t-accent-10, #9952e0))}.bar.color-accent-11{--comp-bar-color:var(--tct-card-bar-color-accent-11, var(--t-accent-11, #e052e0))}.bar.color-accent-12{--comp-bar-color:var(--tct-card-bar-color-accent-12, var(--t-accent-12, #e05299))}.touch-indicator{align-self:center;--tct-icon-size:var(--comp-chevron-size)}";const d=n;const l=["primary","secondary","tertiary","info","success","warning","alert","accent-1","accent-2","accent-3","accent-4","accent-5","accent-6","accent-7","accent-8","accent-9","accent-10","accent-11","accent-12"];const h=class{constructor(r){t(this,r);this.click=a(this,"click",7);this.handleClick=t=>{if(this.url)return true;t.preventDefault();t.stopPropagation();this.click.emit()};this.isAutoSmall=false;this.isAutoTouch=false;this.avatarIcon=undefined;this.avatarInitials=undefined;this.avatarName=undefined;this.avatarSrc=undefined;this.bar=undefined;this.description=undefined;this.isSmall=undefined;this.isStatic=undefined;this.isTouch=e();this.target=undefined;this.title=undefined;this.type="clickable";this.url=undefined}disconnectedCallback(){this.resizeObserver=null}componentDidLoad(){const{hostElement:t,clickableElement:a}=this;t.click=()=>a.click();i(this.hostElement);this.resizeObserver=new ResizeObserver((()=>this.determineAutoSmall()));this.resizeObserver.observe(this.hostElement)}onHostElementFocus(t){if(!s(t,this.hostElement))return;this.clickableElement.focus()}determineAutoSmall(){var t,a;if(this.isStatic)return;if(this.hostElement.hasAttribute("is-small"))return;const{containerElement:r,avatarElement:c}=this;const o=(t=c===null||c===void 0?void 0:c.offsetWidth)!==null&&t!==void 0?t:0;const e=(a=r===null||r===void 0?void 0:r.offsetWidth)!==null&&a!==void 0?a:0;const i=o+e;this.isAutoSmall=i<350}determineAutoTouch(){if(this.hostElement.hasAttribute("is-touch"))return;this.isAutoTouch=e()}generateAvatar(){const{avatarName:t,avatarInitials:a,avatarSrc:c,avatarIcon:o}=this;if(o){return r("q2-icon",{type:o,ref:t=>this.avatarElement=t,"test-id":"avatar"})}else if(t||a||c){return r("q2-avatar",{name:t,initials:a,src:c,ref:t=>this.avatarElement=t,"test-id":"avatar"})}}generateContainerClasses(){const{isSmall:t,isAutoSmall:a,avatarName:r,avatarInitials:c,avatarSrc:o,avatarIcon:e,isTouch:i,isAutoTouch:s,isStatic:n,type:d}=this;const l=["container",d];const h=t||a;const v=i||s;const p=r||c||o||e;if(h)l.push("is-small");if(v&&!n)l.push("is-touch");if(p)l.push("has-avatar");if(n)l.push("is-static");return l.join(" ")}generateContent(){return r(c,null,this.bar&&r("div",{class:this.getBarClasses(),"test-id":"bar",style:this.getBarStyles()}),this.generateAvatar(),r("div",{class:"content","test-id":"contentContainer",ref:t=>this.containerElement=t},this.title&&r("h3",{"test-id":"title"},this.title),this.description&&r("p",{"test-id":"description"},this.description),r("slot",null)),this.isTouch&&!this.isStatic&&r("q2-icon",{"test-id":"touchIndicator",type:"chevron-right",class:"touch-indicator"}))}getBarClasses(){const{bar:t}=this;return{bar:true,[`color-${t}`]:this.isBarColorPredefined()}}getBarStyles(){const{bar:t}=this;return this.isBarColorPredefined()?{}:{"--comp-bar-color":t}}isBarColorPredefined(){return l.includes(this.bar)}render(){const{url:t,isStatic:a,type:c}=this;if(a||c==="non-clickable")return r("div",{ref:t=>this.clickableElement=t,class:this.generateContainerClasses(),"test-id":"clickableElement"},this.generateContent());else if(!!t)return r("a",{ref:t=>this.clickableElement=t,href:this.url,class:this.generateContainerClasses(),target:this.target,rel:"noopener noreferrer","test-id":"clickableElement",onClick:this.handleClick},this.generateContent());else return r("button",{ref:t=>this.clickableElement=t,class:this.generateContainerClasses(),"test-id":"clickableElement",type:"button",onClick:this.handleClick},this.generateContent())}get hostElement(){return o(this)}};h.style=d;export{h as q2_card};
2
- //# sourceMappingURL=p-90bd6c17.entry.js.map
1
+ import{r as t,c as a,h as r,F as c,g as o}from"./p-a5f18e27.js";import{p as e,o as i,i as s}from"./p-33c5a660.js";const n="*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block}.container{position:relative;width:100%;text-align:start;height:100%;display:grid;gap:var(--tct-card-gap, var(--t-card-gap, var(--app-scale-3x, 15px)));margin:0;color:var(--tct-card-color, var(--t-card-color, var(--t-text, #4d4d4d)));--comp-avatar-size:var(--tct-card-avatar-size, var(--t-card-avatar-size, 44px));--comp-chevron-size:0;--comp-bar-width:var(--tct-card-bar-width, var(--t-card-bar-width, var(--app-scale-2x, 10px)));--comp-card-padding:var(--tct-card-padding, var(--t-card-padding, var(--app-scale-4x, 20px)))}.container.is-small{--comp-avatar-size:var(--tct-card-avatar-size, var(--t-card-avatar-size, 26px))}.container.has-avatar{grid-template-columns:var(--comp-avatar-size) 1fr;--tct-avatar-width:var(--comp-avatar-size);--tct-avatar-height:var(--comp-avatar-size);--tct-icon-size:var(--comp-avatar-size)}:host([bar][is-static]) .container{padding-left:var(--comp-card-padding)}:host(:not([is-static])) .container{--comp-border-radius:var(--tct-card-border-radius, var(--t-card-border-radius, var(--app-border-radius-1, 4px)));--comp-border-width:var(--tct-card-border-width, var(--t-card-border-width, 0px));border:none;background:var(--tct-card-background, var(--t-card-background, var(--t-base, #ffffff)));padding:var(--comp-card-padding);text-decoration:none;border-width:var(--comp-border-width);border-color:var(--tct-card-border-color, var(--t-card-border-color, transparent));border-style:var(--tct-card-border-style, solid);border-radius:var(--comp-border-radius);transition:box-shadow var(--tct-tween-1, var(--app-tween-1, 0.2s ease));box-shadow:var(--tct-card-box-shadow, var(--t-card-box-shadow, var(--app-shadow-2, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 4px 8px rgba(0, 0, 0, 0.14))))}:host(:not([is-static])) .container.clickable{cursor:pointer}@media (hover: hover){:host(:not([is-static])) .container.clickable{--comp-card-hover-box-shadow:var(--tct-card-hover-box-shadow, var(--t-card-hover-box-shadow, var(--app-shadow-3, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 8px 16px rgba(0, 0, 0, 0.14))))}:host(:not([is-static])) .container.clickable:hover,:host(:not([is-static])) .container.clickable:active,:host(:not([is-static])) .container.clickable:focus{color:var(--tct-card-color, var(--t-card-color, var(--t-text, #4d4d4d)));box-shadow:var(--const-double-focus-ring)}:host(:not([is-static])) .container.clickable:hover{box-shadow:var(--comp-card-hover-box-shadow)}:host(:not([is-static])) .container.clickable:focus:hover{box-shadow:var(--const-double-focus-ring), var(--comp-card-hover-box-shadow)}:host(:not([is-static])) .container.clickable:active{box-shadow:var(--tct-card-active-box-shadow, var(--t-card-active-box-shadow, var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14))))}}:host(:not([is-static])) .container.is-touch{--comp-chevron-size:var(--tct-card-chevron-size, var(--t-card-chevron-size, 26px));grid-template-columns:1fr var(--comp-chevron-size)}:host(:not([is-static])) .container.has-avatar.is-touch{grid-template-columns:var(--comp-avatar-size) 1fr var(--comp-chevron-size)}.content{overflow:hidden;display:grid;gap:var(--tct-card-content-gap, var(--t-card-content-gap, var(--app-scale-1x, 5px)));align-content:start}h3,p{margin:0;padding:0;line-height:var(--tct-card-font-height, var(--t-card-font-height, 20px))}h3{font-weight:var(--tct-card-font-weight, var(--t-card-font-weight, 600));font-size:var(--tct-card-font-size, var(--t-card-font-size, 17px));text-overflow:ellipsis;overflow:hidden;white-space:nowrap}p{text-overflow:ellipsis;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.bar{--comp-bar-border-radius:calc(var(--comp-border-radius) - var(--comp-border-width));border-radius:var(--comp-bar-border-radius) 0 0 var(--comp-bar-border-radius);position:absolute;inset:0 auto auto 0;width:var(--comp-bar-width);background:var(--comp-bar-color);height:100%}.bar.color-primary{--comp-bar-color:var(--tct-card-bar-color-primary, var(--t-primary, #5446a4))}.bar.color-secondary{--comp-bar-color:var(--tct-card-bar-color-secondary, var(--t-secondary, #b6b3cc))}.bar.color-tertiary{--comp-bar-color:var(--tct-card-bar-color-tertiary, var(--t-tertiary, #ebe8fc))}.bar.color-info{--comp-bar-color:var(--tct-card-bar-color-info, var(--const-stoplight-info, #0079c1))}.bar.color-success{--comp-bar-color:var(--tct-card-bar-color-success, var(--const-stoplight-success, #0e8a00))}.bar.color-warning{--comp-bar-color:var(--tct-card-bar-color-warning, var(--const-stoplight-warning, #c35500))}.bar.color-alert{--comp-bar-color:var(--tct-card-bar-color-alert, var(--const-stoplight-alert, #c35500))}.bar.color-accent-1{--comp-bar-color:var(--tct-card-bar-color-accent-1, var(--t-accent-1, #e05252))}.bar.color-accent-2{--comp-bar-color:var(--tct-card-bar-color-accent-2, var(--t-accent-2, #e09952))}.bar.color-accent-3{--comp-bar-color:var(--tct-card-bar-color-accent-3, var(--t-accent-3, #e0e052))}.bar.color-accent-4{--comp-bar-color:var(--tct-card-bar-color-accent-4, var(--t-accent-4, #99e052))}.bar.color-accent-5{--comp-bar-color:var(--tct-card-bar-color-accent-5, var(--t-accent-5, #52e052))}.bar.color-accent-6{--comp-bar-color:var(--tct-card-bar-color-accent-6, var(--t-accent-6, #52e099))}.bar.color-accent-7{--comp-bar-color:var(--tct-card-bar-color-accent-7, var(--t-accent-7, #52e0e0))}.bar.color-accent-8{--comp-bar-color:var(--tct-card-bar-color-accent-8, var(--t-accent-8, #5299e0))}.bar.color-accent-9{--comp-bar-color:var(--tct-card-bar-color-accent-9, var(--t-accent-9, #5252e0))}.bar.color-accent-10{--comp-bar-color:var(--tct-card-bar-color-accent-10, var(--t-accent-10, #9952e0))}.bar.color-accent-11{--comp-bar-color:var(--tct-card-bar-color-accent-11, var(--t-accent-11, #e052e0))}.bar.color-accent-12{--comp-bar-color:var(--tct-card-bar-color-accent-12, var(--t-accent-12, #e05299))}.touch-indicator{align-self:center;--tct-icon-size:var(--comp-chevron-size)}";const d=n;const l=["primary","secondary","tertiary","info","success","warning","alert","accent-1","accent-2","accent-3","accent-4","accent-5","accent-6","accent-7","accent-8","accent-9","accent-10","accent-11","accent-12"];const h=class{constructor(r){t(this,r);this.click=a(this,"click",7);this.handleClick=t=>{if(this.url)return true;t.preventDefault();t.stopPropagation();this.click.emit()};this.isAutoSmall=false;this.isAutoTouch=false;this.avatarIcon=undefined;this.avatarInitials=undefined;this.avatarName=undefined;this.avatarSrc=undefined;this.bar=undefined;this.description=undefined;this.isSmall=undefined;this.isStatic=undefined;this.isTouch=e();this.target=undefined;this.title=undefined;this.type="clickable";this.url=undefined}disconnectedCallback(){this.resizeObserver=null}componentDidLoad(){const{hostElement:t,clickableElement:a}=this;t.click=()=>a.click();i(this.hostElement);this.resizeObserver=new ResizeObserver((()=>this.determineAutoSmall()));this.resizeObserver.observe(this.hostElement)}onHostElementFocus(t){if(!s(t,this.hostElement))return;this.clickableElement.focus()}determineAutoSmall(){var t,a;if(this.isStatic)return;if(this.hostElement.hasAttribute("is-small"))return;const{containerElement:r,avatarElement:c}=this;const o=(t=c===null||c===void 0?void 0:c.offsetWidth)!==null&&t!==void 0?t:0;const e=(a=r===null||r===void 0?void 0:r.offsetWidth)!==null&&a!==void 0?a:0;const i=o+e;this.isAutoSmall=i<350}determineAutoTouch(){if(this.hostElement.hasAttribute("is-touch"))return;this.isAutoTouch=e()}generateAvatar(){const{avatarName:t,avatarInitials:a,avatarSrc:c,avatarIcon:o}=this;if(o){return r("q2-icon",{type:o,ref:t=>this.avatarElement=t,"test-id":"avatar"})}else if(t||a||c){return r("q2-avatar",{name:t,initials:a,src:c,ref:t=>this.avatarElement=t,"test-id":"avatar"})}}generateContainerClasses(){const{isSmall:t,isAutoSmall:a,avatarName:r,avatarInitials:c,avatarSrc:o,avatarIcon:e,isTouch:i,isAutoTouch:s,isStatic:n,type:d}=this;const l=["container",d];const h=t||a;const v=i||s;const p=r||c||o||e;if(h)l.push("is-small");if(v&&!n)l.push("is-touch");if(p)l.push("has-avatar");if(n)l.push("is-static");return l.join(" ")}generateContent(){return r(c,null,this.bar&&r("div",{class:this.getBarClasses(),"test-id":"bar",style:this.getBarStyles()}),this.generateAvatar(),r("div",{class:"content","test-id":"contentContainer",ref:t=>this.containerElement=t},this.title&&r("h3",{"test-id":"title"},this.title),this.description&&r("p",{"test-id":"description"},this.description),r("slot",null)),this.isTouch&&!this.isStatic&&r("q2-icon",{"test-id":"touchIndicator",type:"chevron-right",class:"touch-indicator"}))}getBarClasses(){const{bar:t}=this;return{bar:true,[`color-${t}`]:this.isBarColorPredefined()}}getBarStyles(){const{bar:t}=this;return this.isBarColorPredefined()?{}:{"--comp-bar-color":t}}isBarColorPredefined(){return l.includes(this.bar)}render(){const{url:t,isStatic:a,type:c}=this;if(a||c==="non-clickable")return r("div",{ref:t=>this.clickableElement=t,class:this.generateContainerClasses(),"test-id":"clickableElement"},this.generateContent());else if(!!t)return r("a",{ref:t=>this.clickableElement=t,href:this.url,class:this.generateContainerClasses(),target:this.target,rel:"noopener noreferrer","test-id":"clickableElement",onClick:this.handleClick},this.generateContent());else return r("button",{ref:t=>this.clickableElement=t,class:this.generateContainerClasses(),"test-id":"clickableElement",type:"button",onClick:this.handleClick},this.generateContent())}get hostElement(){return o(this)}};h.style=d;export{h as q2_card};
2
+ //# sourceMappingURL=p-20e6f53d.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as e,c as t,h as i,g as n}from"./p-a5f18e27.js";import{d as a}from"./p-f1e887f5.js";import{l as s,a as r,o,i as d,w as l,k as c}from"./p-ff8ed604.js";function h(e){const t=new Date(e);if(!a.isValid(t))return;return a.formatISO(t,{representation:"date"})}let u;function f(e){const t=new Date(e);if(!a.isValid(t))return;const i=t.toISOString();if(!u){u=new Intl.DateTimeFormat("en-US",{month:"2-digit",day:"2-digit",year:"numeric",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})}return u.format(new Date(i))}let v;function p(e){const t=new Date(e);if(!a.isValid(t))return;if(!v){v=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"})}return v.format(t)}let b;function y(e){if(!e)return;const t=new Date(e);if(!a.isValid(t))return;if(!b){b=new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric",weekday:"long",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})}return b.format(t)}function m(e){return e.replace(/[d]/g,"E").replace(/[D]/g,"d").replace(/[Y]/g,"y").replace(/[l]/g,"P").replace(/[W]/g,"I")}function g(e){const t=typeof e==="string";if(!t&&e&&a.isValid(new Date(e||undefined))){e=h(e)}else if(!e||!a.isValid(new Date(e))){return undefined}let i;const n=e.split(/[\/\-]/).map((e=>e.padStart(2,"0")));const s=t&&e.length>=24&&e[10]==="T";const r=n.length===3;const o=n.length<3;if(s){e=e.split("T")[0];i=new Date(e)}else if(r){const t=e.includes("/")&&n[2].length===4;if(t)n.unshift(n.pop());i=new Date(Date.UTC(parseInt(n[0]),parseInt(n[1])-1,parseInt(n[2])))}else if(o){const e=new Date;let t;let a;let s;switch(n.length){case 1:t=e.getFullYear();a=n[0];s="01";break;case 2:t=e.getFullYear();a=n[0];s=n[1];break}i=new Date(`${t}-${a}-${s}`)}if(!a.isValid(i))return undefined;i=w(i);return a.isValid(i)?i:undefined}function w(e){const t=e.getTimezoneOffset();return a.setMinutes(e,t+Math.abs(t%60))}function D(e){if(!Array.isArray(e)||e.length===0){return[]}return e.map((e=>g(e)))}function x(e=new Date){return{monthIndex:e.getMonth(),selectedYear:e.getFullYear()}}function k(e="",t=[],i=[],n=[],r,o,d="mm/dd/yyyy",l){let c=true;let u=false;let f="info";let v=`${s("tecton.element.calendar.hint.format")}: ${d}`;if(!e){return{isValid:c,inputDate:new Date(""),isAvailable:u,messageType:f,message:v}}const b=$(e,l);const y=b.getMonth()+1;const m=b.getDate();const g=b.getFullYear();const w=[y,m,g];if(a.isValid(b)){const a=C()[b.getMonth()];if(e.length===10){c=true;f=null;v=null}u=t.includes(b.getDay());const l=h(b);if(u){const e=i.length&&!i.includes(l);const t=n.length&&n.includes(l);const a=r&&r>l;const s=o&&o<l;if(e||t||a||s){u=false}}if(e.length>=5&&!u){c=false;f="error";const e=!a||!m||!g;v=e?`${s("tecton.element.calendar.hint.invalidDate")}: ${d}`:s("tecton.element.calendar.hint.notAvailableDate",[p(b)])}}else{c=false;f="error";v=`${s("tecton.element.calendar.hint.invalidDate")}: ${d}`}return{isValid:c,messageType:f,message:v,inputDate:b,isAvailable:u,calendarPosition:w}}function $(e,t){const i=new Date;let[n,a,s]=e.split("/");if(n==="0")n="01";if(a==="0")a="01";if(e.length===10){return new Date(e)}else if(n&&a&&Number(a)>0){const e=Number(a)<10?`0${Number(a)}`:a;const i=!s||s.length<4?I(n,a,t):s;return new Date(`${n}/${e}/${i}`)}else if(n){return new Date(`${n}/01/${i.getFullYear()}`)}}function I(e,t,i){const n=`${e}/${t}`;const a=new Date;const s=a.getMonth()<9?`0${a.getMonth()+1}`:`${a.getMonth()+1}`;const r=a.getDate()<10?`0${a.getDate()}`:`${a.getDate()}`;const o=`${s}/${r}/${a.getFullYear()}`;let d=a.getFullYear();if(i==="future"&&o.slice(0,5)>n){d=a.getFullYear()+1}else if(i==="past"&&o.slice(0,5)<n){d=a.getFullYear()-1}return d.toString()}function T(e){if(!e){return""}if(e.match(/^[1-9]\/$/)){return`0${e}/`}else if(e.match(/^[0-9]{2}\/[1-9]{1}\/$/)){const t=e.split("/");return`${t[0]}/0${t[1]}/`}return e}function E(e){const t=(e||"").split("-");if(t.length!==3)return"";return`${t[1]}/${t[2]}/${t[0]}`}function O(e,t){return new Date(t,e,1,1,1,1,1).getDay()}function V(){return[s("tecton.element.calendar.days.short.Sunday"),s("tecton.element.calendar.days.short.Monday"),s("tecton.element.calendar.days.short.Tuesday"),s("tecton.element.calendar.days.short.Wednesday"),s("tecton.element.calendar.days.short.Thursday"),s("tecton.element.calendar.days.short.Friday"),s("tecton.element.calendar.days.short.Saturday")]}function A(){return[s("tecton.element.calendar.days.Sunday"),s("tecton.element.calendar.days.Monday"),s("tecton.element.calendar.days.Tuesday"),s("tecton.element.calendar.days.Wednesday"),s("tecton.element.calendar.days.Thursday"),s("tecton.element.calendar.days.Friday"),s("tecton.element.calendar.days.Saturday")]}function C(){return[s("tecton.element.calendar.months.January"),s("tecton.element.calendar.months.February"),s("tecton.element.calendar.months.March"),s("tecton.element.calendar.months.April"),s("tecton.element.calendar.months.May"),s("tecton.element.calendar.months.June"),s("tecton.element.calendar.months.July"),s("tecton.element.calendar.months.August"),s("tecton.element.calendar.months.September"),s("tecton.element.calendar.months.October"),s("tecton.element.calendar.months.November"),s("tecton.element.calendar.months.December")]}function z(e,t){const i=a.getDaysInMonth(new Date(t,e));return[...Array(i).keys()].reduce(((i,n)=>{i.push(new Date(t,e,n+1));return i}),[])}function q(e=127){const t=e&1;const i=e&2;const n=e&4;const a=e&8;const s=e&16;const r=e&32;const o=e&64;const d=[];if(e<=0)return d;if(t)d.push(0);if(i)d.push(1);if(n)d.push(2);if(a)d.push(3);if(s)d.push(4);if(r)d.push(5);if(o)d.push(6);return d}function S(e,t){return e.includes(t.getDay())}function Y(e,t){return!F(e,t)}function F(e,t){return e.some((e=>a.isSameDay(e,t)))}function M(e,t,i,n,a,s,r){const o=[H.bind(null,s,new Date)];if(t===null||t===void 0?void 0:t.length){o.push(F.bind(null,t))}else{o.push(S.bind(null,e))}o.push(Y.bind(null,i));return L(n,a,s,o,r)}function L({monthIndex:e,selectedYear:t},i,n,s,r){const o=!a.isValid(new Date(r));const d=z(e,t).map(((e,t)=>{const a=s.some((t=>!t(e)));const r=P(e,n,i);const d=j(Object.assign(Object.assign({},r),{isInvalid:a,isIncompleteDate:o}));return Object.assign(Object.assign({},r),{isValid:!a,date:e,integer:t+1,isEmpty:false,isActivity:false,classList:d})}));const l=B(O(e,t));const c=U((l.length+d.length)%7);return[...l,...d,...c]}function H(e,t,i){const n=a.isAfter(e===null||e===void 0?void 0:e.startDate,i);const s=a.isBefore(e===null||e===void 0?void 0:e.endDate,i);const r=a.isSameDay(t,i)&&a.isAfter(t,e===null||e===void 0?void 0:e.cutOffTime);return!(n||r||s)}function P(e,t,i){if(!i)i=new Date;const n=i&&a.isSameDay(i,e);const s=a.isSameDay(e,new Date);const r=a.isSameDay(e,t===null||t===void 0?void 0:t.startDate);const o=a.isSameDay(e,t===null||t===void 0?void 0:t.endDate);return{isSelected:n,isToday:s,isStartDate:r,isEndDate:o}}function j({isInvalid:e,isSelected:t,isEndDate:i,isStartDate:n,isToday:a,isIncompleteDate:s}){const r=[];if(!e)r.push("is-valid");if(t)r.push("is-selected");if(i)r.push("is-end-date");if(n)r.push("is-start-date");if(a)r.push("is-today");if(t&&e&&!s)r.push("is-unavailable");return r.join(" ")}function B(e){return K(0,e)}function U(e){if(e===0)return[];return K(e,7)}const W={date:null,integer:null,isActivity:false,isEmpty:true,isValid:false,isToday:false,isSelected:false,isStartDate:false,isEndDate:false,classList:""};function K(e,t){if(e===7)e=0;return[...Array(t-e).keys()].map((()=>Object.assign({},W)))}const N="*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block}:host[hidden]{display:none}click-elsewhere{position:relative;display:block}q2-input{margin:0;cursor:pointer}q2-popover{--comp-min-tappable-size:44px;--comp-table-border-spacing:2px;--comp-min-tappable-size-and-spacing:calc(var(--comp-min-tappable-size) + var(--comp-table-border-spacing));--comp-popover-padding:var(--tct-calendar-popover-padding, var(--t-calendar-popover-padding, var(--app-scale-1x, 5px)));--comp-min-table-width:calc(var(--comp-min-tappable-size-and-spacing) * 7);--comp-table-container-border-spacing:calc(var(--comp-table-border-spacing) * 2);--comp-popover-total-padding:calc(var(--comp-popover-padding) * 2);--tct-popover-min-width:calc(\n var(--comp-min-table-width) + var(--comp-table-container-border-spacing) + var(--comp-popover-total-padding)\n )}.calendar-field-popup{padding:var(--comp-popover-padding)}.calendar-label{--comp-label-padding:var(--tct-calendar-label-padding, var(--tct-calendar-label-vertical-padding, var(--t-calendar-label-vertical-padding, var(--tct-scale-2, var(--app-scale-2x, 10px)))) 0);font-size:var(--tct-calendar-label-font-size, var(--t-calendar-label-font-size, 16px));flex:1 1;flex-basis:calc(100% - var(--tct-btn-icon-width, 44px));margin:0;padding:var(--comp-label-padding)}.cal-month-heading{padding:0 0 0.75rem;display:flex;justify-content:center;align-items:center;font-size:var(--tct-calendar-month-font-size, var(--t-calendar-month-font-size, 16px));font-weight:var(--tct-calendar-month-font-weight, var(--t-calendar-month-font-weight, 600));text-align:center}.cal-month-text{min-width:82px;display:inline-block}.cal-year-text{min-width:50px;display:inline-block}table{width:100%;margin-bottom:2px;text-align:center;border-spacing:var(--comp-table-border-spacing)}th{font-size:var(--tct-calendar-day-heading-font-size, var(--t-calendar-day-heading-font-size, inherit));font-weight:var(--tct-calendar-day-heading-font-weight, var(--t-calendar-day-heading-font-weight, 600));width:14.285714%}td{height:var(--comp-min-tappable-size);cursor:pointer;border:var(--tct-calendar-day-border, var(--t-calendar-day-border, 0));border-radius:var(--tct-calendar-day-border-radius, var(--t-calendar-day-border-radius))}td.is-unavailable{border:1px solid var(--tct-input-error-border-color, var(--const-stoplight-alert, #d20a0a))}td.is-valid:hover{border:var(--tct-calendar-day-hover-border, var(--t-calendar-day-hover-border, var(--tct-calendar-day-border, var(--t-calendar-day-border, 0))));border-radius:var(--tct-calendar-day-hover-border-radius, var(--t-calendar-day-hover-border-radius, var(--tct-calendar-day-border-radius, var(--t-calendar-day-border-radius))));background:var(--tct-calendar-day-hover-background, var(--tct-calendar-day-hover-bg, var(--t-calendar-day-hover-bg, var(--tct-gray-14, var(--app-gray14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2)))))));color:var(--tct-calendar-day-hover-font-color, var(--t-calendar-day-hover-font-color, inherit))}td[aria-hidden],td[aria-disabled]{pointer-events:none;cursor:not-allowed}td[aria-disabled]{opacity:var(--tct-calendar-day-disabled-opacity, var(--t-calendar-day-disabled-opacity, var(--app-disabled-opacity, 0.4)))}td[aria-selected]{border:var(--tct-calendar-day-selected-border, var(--t-calendar-day-selected-border, var(--tct-calendar-day-border, var(--t-calendar-day-border, 0))));border-radius:var(--tct-calendar-day-selected-border-radius, var(--t-calendar-day-selected-border-radius, var(--tct-calendar-day-border-radius, var(--t-calendar-day-border-radius))));background:var(--tct-calendar-day-selected-background, var(--tct-calendar-day-selected-bg, var(--t-calendar-day-selected-bg, var(--tct-calendar-day-hover-background, var(--tct-calendar-day-hover-bg, var(--t-calendar-day-hover-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2))))))))));color:var(--tct-calendar-day-selected-font-color, var(--t-calendar-day-selected-font-color, var(--tct-calendar-day-hover-font-color, var(--t-calendar-day-hover-font-color, inherit))));box-shadow:0 0 0 2px var(--tct-calendar-day-selected-outline-color, var(--t-calendar-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1))))}td[aria-selected]:focus{box-shadow:0 0 0 2px var(--tct-calendar-day-selected-outline-color, var(--t-calendar-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1)))), 0 0 0 4px var(--const-focus-color, #0066cc)}.today-decorator{text-transform:uppercase;font-weight:700;font-size:10px;height:12px}.calendar-disclaimer{font-size:var(--tct-calendar-disclaimer-font-size, var(--t-calendar-disclaimer-font-size, var(--tct-font-size-small, var(--app-font-size-small, 12px))));border-style:solid;border-width:var(--tct-calendar-disclaimer-border-width, var(--t-calendar-disclaimer-border-width, 1px 0 0 0));border-color:var(--tct-calendar-disclaimer-border-color, var(--t-calendar-disclaimer-border-color, var(--tct-gray-13, var(--t-gray-13, var(--tct-gray-l3, var(--app-gray-l3, #e6e6e6))))));padding:var(--tct-calendar-disclaimer-padding, var(--tct-scale-2, var(--app-scale-2x, 10px)));text-align:left}";const _=N;const J=class{constructor(i){e(this,i);this.change=t(this,"change",7);this.error=t(this,"error",7);this.success=t(this,"success",7);this.dayAbbrStrings=V();this.dayStrings=A();this.defaultFormatString="mm/dd/yyyy";this.formatModifier="M/D/YYYY";this.internalError="";this.monthStrings=C();this.scheduledAfterRender=[];this.closeCalendar=()=>{if(!this.open)return;this.open=false;this.focusInput()};this.goToMonthYear=(e,t)=>{if(e<0){e=11;t--}else if(e>11){e=0;t++}this.selectedMonthYear={monthIndex:e,selectedYear:t};this.dateList=this.buildDateList(this.selectedMonthYear);this.scheduledAfterRender.push((()=>this.checkActiveCellForBlankness()))};this.onClickElsewhere=e=>{const t=e.target;if(t.localName==="click-elsewhere"){e.stopPropagation();this.closeCalendar()}};this.onDateKeydown=e=>{const{monthIndex:t,selectedYear:i}=this.selectedMonthYear;const n=parseInt(e.target.dataset.day);const s=this.generateDateFromDay(n);switch(e.key){case"ArrowUp":e.preventDefault();this.activateDay(a.addDays(s,-7));break;case"ArrowDown":e.preventDefault();this.activateDay(a.addDays(s,7));break;case"ArrowRight":e.preventDefault();this.activateDay(a.addDays(s,1));break;case"ArrowLeft":e.preventDefault();this.activateDay(a.addDays(s,-1));break;case"PageUp":e.preventDefault();if(e.shiftKey)this.goToMonthYear(t,i-1);else this.goToMonthYear(t-1,i);break;case"PageDown":e.preventDefault();if(e.shiftKey)this.goToMonthYear(t,i+1);else this.goToMonthYear(t+1,i);break;case"Home":e.preventDefault();this.activateDay(a.addDays(s,-s.getDay()));break;case"End":e.preventDefault();this.activateDay(a.addDays(s,6-s.getDay()));break;case"Escape":e.preventDefault();this.closeCalendar();this.focusInput();break;case"Enter":e.preventDefault();if(!this.dateList.find((({date:e})=>a.isSameDay(e,s))).isValid)return;this.selectDate(s);this.closeCalendar();this.focusInput();break;case" ":e.preventDefault();if(!this.dateList.find((({date:e})=>a.isSameDay(e,s))).isValid)return;this.selectDate(s);this.closeCalendar();this.focusInput();break}};this.onDateSelection=e=>{const t=e.target.closest("td:not([aria-hidden])");if(!t)return;const i=w(new Date(t.dataset.date));this.selectDate(i);this.closeCalendar()};this.onHeaderControlKeydown=e=>{var t;const i=this.generateDateFromDay(1);const n=(t=this.calendarBody)===null||t===void 0?void 0:t.querySelector('[aria-selected="true"]');if(e.key==="Tab"&&!n){e.preventDefault();this.activateDay(i)}};this.onInputBlur=()=>{if(!this.isTypeable)return;const e=q(this.daysOfWeekChecksum);const{typedValue:t}=this;const{isValid:i,inputDate:n,isAvailable:s}=k(this.typedValue,e,this.validDates,this.invalidDates,this.startDate,this.endDate,this.defaultFormatString,this.assume);if(!t&&(n===null||n===void 0?void 0:n.toString())==="Invalid Date"){this.setHints({isValid:true,message:this.defaultHintMessage,messageType:"info"})}else if(i||t&&t.length>4&&n&&a.isValid(n)&&s){this.setCompleteInput(n)}else if(this.value){this.valueOnBlur=this.value;this.value=null;this.change.emit({value:null});this.typedValue=t}};this.onInputChange=e=>{e.stopPropagation()};this.onInputClick=()=>{if(this.disabled)return;this.toggleCalendar()};this.onInputFocus=e=>{if(!this.isTypeable)return;if(e.target===this.controlElement){if(this.valueOnBlur&&!this.value){const e=this.typedValue;this.value=this.valueOnBlur;this.typedValue=e;this.valueOnBlur=null}this.closeCalendar()}};this.onInputInput=({detail:{value:e}})=>{this.typedValue=e};this.onInputKeydown=e=>{const{dateValue:t}=this;switch(e.key){case"ArrowDown":e.preventDefault();this.openCalendar();this.activateDay(t||new Date);break;case"Enter":case" ":if(this.typeable)break;e.preventDefault();if(this.open){this.closeCalendar()}else{this.openCalendar();this.activateDay(t||new Date)}break}};this.onInputKeyup=e=>{if(this.disabled){return}switch(e.key){case"Escape":this.onInputBlur();this.closeCalendar();break}if(!this.isTypeable)return;this.typedValue=T(this.typedValue);const{typedValue:t}=this;const i=q(this.daysOfWeekChecksum);const{isValid:n,message:s,messageType:r,inputDate:o,isAvailable:d,calendarPosition:l}=k(t,i,this.validDates,this.invalidDates,this.startDate,this.endDate,this.defaultFormatString,this.assume);if(l){const[e,t,i]=l;const n=new Date(i,e-1,t);if(a.isValid(n)){this.selectedMonthYear=x(n);this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}}if(e.key==="Enter"){if(n||t&&t.length>4&&o&&a.isValid(o)&&d){this.setCompleteInput(o)}else if(this.value){this.value=null;this.change.emit({value:null});this.typedValue=t}if(this.keyboardSelection){this.keyboardSelection=false;this.closeCalendar()}else{this.toggleCalendar()}}else{this.setHints({isValid:n,message:s,messageType:r})}};this.onPopupKeyup=e=>{if(e.key==="Escape"||e.key==="Esc"){this.onInputBlur();this.closeCalendar()}};this.onRefocus=()=>{var e;(e=this.btnPrevMonth)===null||e===void 0?void 0:e.dispatchEvent(new FocusEvent("focus"))};this.openCalendar=()=>{if(this.readonly||this.open)return;this.selectedMonthYear=x(this.dateValue);this.dateList=this.buildDateList(this.selectedMonthYear);this.open=true};this.selectDate=e=>{const{isValid:t}=this.dateList.find((({date:t})=>a.isSameDay(t,e)));if(!t)return;this.change.emit({value:h(e)});this.typedValue=f(e);this.invalid=false;this.success.emit({value:h(e)})};this.toggleCalendar=()=>{if(this.readonly)return;if(this.open){this.closeCalendar()}else{this.openCalendar()}};this.dateList=undefined;this.hintMessage=this.defaultHintMessage;this.hintMessageType="info";this.keyboardSelection=false;this.typedValue="";this.ariaLabel=undefined;this.assume="current";this.buttonLabel=undefined;this.calendarLabel=undefined;this.clearable=undefined;this.cutoffTime=undefined;this.daysOfWeekChecksum=undefined;this.disabled=undefined;this.disabledMsg=undefined;this.disclaimer=undefined;this.displayFormat=undefined;this.endDate=undefined;this.errors=undefined;this.hideLabel=undefined;this.hints=undefined;this.invalid=undefined;this.invalidDates=undefined;this.label=undefined;this.onsuccess=undefined;this.open=undefined;this.optional=undefined;this.placeholder=undefined;this.popDirection=undefined;this.popoverAlignment=undefined;this.popoverDirection=undefined;this.popoverMinHeight=355;this.popoverMode=null;this.readonly=undefined;this.startDate=undefined;this.typeable=undefined;this.validDates=undefined;this.value=undefined}connectedCallback(){this.selectedMonthYear=x(this.dateValue);this.dateList=this.buildDateList(this.selectedMonthYear);if(this.value&&this.isTypeable&&!this.typedValue){this.typedValue=E(this.value)}this.validateDate()}componentWillLoad(){this.popDirectionHandler();r(this)}componentDidLoad(){o(this.hostElement)}componentDidRender(){setTimeout((()=>{this.scheduledAfterRender.forEach((e=>e()));this.scheduledAfterRender=[]}),25)}defaultChangeHandler(e){if(e.target===this.hostElement&&!this.hostElement.onchange&&!!e.detail){this.value=e.detail.value}}handleClear(){this.change.emit({value:null});this.value=null;this.typedValue=""}defaultErrorHandler(e){if(e.target===this.hostElement&&!this.hostElement.onerror){if(this.hintMessageType==="error"&&this.hintMessage){this.internalError=this.hintMessage}else{this.internalError=s("tecton.element.calendar.hint.invalidDate")}}}delegateFocus(e){if(!d(e,this.hostElement))return;this.controlElement.shadowRoot.querySelector(".input-field").focus()}popoverStateHandler({detail:{open:e}}){if(this.open!==e)this.open=e}defaultSuccessHandler(e){if(e.target!==this.hostElement){return}if(typeof this.onsuccess==="function"){this.onsuccess(e)}else{this.internalError="";if(this.hintMessageType==="error"&&this.hintMessage){this.hintMessage=null;this.hintMessageType=null;this.invalid=false}}}async closePopover(){if(!this.open)return;this._togglePopover()}async openPopover(){if(this.open)return;this._togglePopover()}async setValue(e){var t;const i=typeof e==="string"?g(e):e;if(!a.isValid(i))return;await this.openPopover();await l();this.goToMonthYear(i.getMonth(),i.getFullYear());await l();const n=(t=this.calendarTable)===null||t===void 0?void 0:t.querySelector(`td[data-date="${h(i)}"]`);n===null||n===void 0?void 0:n.click()}async typeValue(e){if(!this.typeable)return;const t=typeof e==="string"?g(e):e;const i=f(t);if(!a.isValid(t))return;const{innerInputField:n,controlElement:s}=this;n.focus();n.dispatchEvent(new FocusEvent("focus"));n.value=i;n.dispatchEvent(new InputEvent("input"));s.dispatchEvent(new KeyboardEvent("keyup"))}ariaLabelObserver(){r(this)}cutoffTimeObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}daysOfWeekChecksumObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}endDateObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}invalidDatesObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}popDirectionHandler(){c(this,"popDirection","popoverDirection")}startDateObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}typeableChanged(){this.valueObserver(this.value)}validDatesObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}valueObserver(e){if(e===""){this.value=undefined;this.setHints({isValid:true,message:this.defaultHintMessage,messageType:"info"});return}const t=e&&typeof e!=="string"&&"toDate"in e;const i=t?e.toDate():g(e);const n=f(i);if(this.isTypeable){this.typedValue=n}else{this.controlElement.value=n;this.selectedMonthYear=x(i);this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}if(this.invalid)return;if(n){this.setHints({isValid:true,message:null,messageType:null})}else{this.setHints({isValid:true,message:this.defaultHintMessage,messageType:"info"})}}get canClear(){if(this.isTypeable){return this.clearable&&!!this.typedValue}else{return this.clearable&&!!this.value}}get computedPlaceholder(){if(this.disabled&&this.disabledMsg){return s(this.disabledMsg)}if(this.buttonLabel&&(this.disabled||this.placeholder)){return s(this.buttonLabel)}return this.placeholder&&s(this.placeholder)||""}get currentWeeks(){const e=this.dateList.reduce(((e,t,i)=>{const n=Math.floor(i/7);if(!e[n]){e[n]=[]}e[n].push(t);return e}),[]);return e}get dateValidators(){const e=new Date(this.cutoffTime||"");return{startDate:g(this.startDate),endDate:g(this.endDate),cutOffTime:a.isValid(e)?e:undefined}}get dateValue(){if(this.isTypeable){return g(this.typedValue)}else{let{value:e}=this;const t=e&&typeof e!=="string"&&"toDate"in e;if(t)return e.toDate();const i=typeof e==="string"&&e.split(" ").length===6&&/GMT-\d{4}/g.test(e);if(i){e=h(e)}return g(e)}}get defaultHintMessage(){return this.typeable?s("tecton.element.calendar.hint.format")+": "+this.defaultFormatString:s("tecton.element.calendar.hint.select")}get errorList(){const{errors:e,internalError:t,invalid:i}=this;let n=[];if(t){n=[t]}if(Array.isArray(e)&&e.length){n=e.filter((e=>!!e)).map((e=>s(e))).concat(n)}else if(!t&&i){return["tecton.element.calendar.invalid"]}return n}get formattedValue(){const{typedValue:e,dateValue:t,displayFormat:i,isTypeable:n}=this;if(n)return e;if(t===undefined)return"";if(i)return a.format(t,m(i));return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}).format(t)}get hintList(){const{hints:e,hintMessageType:t,hintMessage:i}=this;if(Array.isArray(e)&&e.length)return e.filter((e=>!!e)).map((e=>s(e)));if(t==="info"&&i)return[i];return[]}get innerInputContainer(){var e,t;return(t=(e=this.controlElement)===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector(".input-container")}get innerInputField(){var e,t;return(t=(e=this.controlElement)===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector(".input-field")}get isTypeable(){return this.typeable}get selectedDate(){var e;const t=(e=this.calendarBody)===null||e===void 0?void 0:e.querySelector('[aria-selected="true"]');return t?w(new Date(t.dataset.date)):null}_togglePopover(){const e=this.typeable?this.btnCalendarToggle:this.innerInputField;e===null||e===void 0?void 0:e.click();e===null||e===void 0?void 0:e.focus();e.dispatchEvent(new FocusEvent("focus"))}activateDay(e){this.goToMonthYear(e.getMonth(),e.getFullYear());this.scheduledAfterRender.push((()=>this.focusDay(e)))}buildDateList(e){const t=D(this.invalidDates);const i=q(this.daysOfWeekChecksum);const n=D(this.validDates);return M(i,n,t,e,this.dateValue,this.dateValidators,this.typedValue)}calendarDays(){return i("table",{role:"grid","aria-labelledby":"table-label",ref:e=>this.calendarTable=e},i("thead",null,i("tr",null,[...Array(7).keys()].map((e=>i("th",{scope:"col","aria-label":this.dayStrings[e]},this.dayAbbrStrings[e]))))),i("tbody",{onClick:this.onDateSelection,onKeyDown:this.onDateKeydown,ref:e=>this.calendarBody=e,"test-id":"calendarTableBody"},this.currentWeeks.map((e=>i("tr",null,e.map((e=>{var t;let n="";if(e.isToday)n=`${s("tecton.element.calendar.today")}, `;n+=y(e.date);if(e.isSelected)n+=` (${s("tecton.element.calendar.selected")})`;return i("td",{class:e.classList,"aria-hidden":e.isEmpty?"true":undefined,tabindex:e.isSelected?0:-1,role:e.isSelected?"gridcell":undefined,"aria-selected":e.isSelected?"true":undefined,"aria-disabled":e.isValid?undefined:"true","data-day":e.integer||undefined,"data-date":e.date?h(e.date):undefined},(e===null||e===void 0?void 0:e.isToday)&&i("div",{class:"today-decorator","aria-hidden":"true"},s("tecton.element.calendar.today")),i("div",{"aria-label":n},(t=e===null||e===void 0?void 0:e.integer)!==null&&t!==void 0?t:""))})))))))}calendarPopover(){const{monthIndex:e,selectedYear:t}=this.selectedMonthYear;return i("div",{class:"calendar-field-popup",onKeyUp:this.onPopupKeyup},this.calendarLabel&&i("p",{class:"calendar-label"},s(this.calendarLabel)),i("div",{class:"cal-month-heading"},i("q2-btn",{label:s("tecton.element.calendar.previousMonth"),"hide-label":true,ref:e=>this.btnPrevMonth=e,class:"cal-nav-btn prev-month","test-id":"previousMonthButton",onClick:()=>this.goToMonthYear(e-1,t)},i("q2-icon",{type:"chevron-left"})),i("span",{class:"cal-month-text"},this.monthStrings[e]),i("q2-btn",{label:s("tecton.element.calendar.nextMonth"),"hide-label":true,class:"cal-nav-btn next-month",ref:e=>this.btnNextMonth=e,"test-id":"nextMonthButton",onClick:()=>this.goToMonthYear(e+1,t)},i("q2-icon",{type:"chevron-right"})),i("q2-btn",{label:s("tecton.element.calendar.previousYear"),"hide-label":true,class:"cal-nav-btn prev-year",ref:e=>this.btnPrevYear=e,"test-id":"previousYearButton",onClick:()=>this.goToMonthYear(e,t-1)},i("q2-icon",{type:"chevron-left"})),i("span",{class:"cal-year-text"},this.selectedMonthYear.selectedYear),i("q2-btn",{label:s("tecton.element.calendar.nextYear"),"hide-label":true,class:"cal-nav-btn next-year",ref:e=>this.btnNextYear=e,"test-id":"nextYearButton",onClick:()=>this.goToMonthYear(e,t+1),onKeyDown:this.onHeaderControlKeydown},i("q2-icon",{type:"chevron-right"}))),i("div",{class:"sr","aria-live":"polite",id:"table-label"},`${this.monthStrings[e]} ${t}`),this.calendarDays(),this.disclaimer&&i("div",{class:"calendar-disclaimer"},s(this.disclaimer)),i("q2-btn",{class:"sr refocus-popup",onFocus:this.onRefocus}))}checkActiveCellForBlankness(){const e=this.hostElement.shadowRoot.activeElement;if(!e||e.tagName!=="TD"||!e.hasAttribute("aria-hidden"))return;const{calendarBody:t}=this;const i=Array.from(t.querySelectorAll("td"));const n=Array.from(i).indexOf(e);const a=n<15?1:i.filter((e=>!e.hasAttribute("aria-hidden"))).length;this.focusDay(this.generateDateFromDay(a))}async focusDay(e){var t;if(!e)return;await l();(t=this.calendarBody.querySelector(`td[data-day="${e.getDate()}"]`))===null||t===void 0?void 0:t.focus()}focusInput(){var e;(e=this.controlElement)===null||e===void 0?void 0:e.focus()}generateDateFromDay(e){const{monthIndex:t,selectedYear:i}=this.selectedMonthYear;return new Date(i,t,e)}hintField(){if(!this.hintMessage)return;return i("q2-message",{class:"calendar-hint sr",ref:e=>this.hintMessageElement=e,type:this.hintMessageType},this.hintMessage)}inputField(){const{isTypeable:e}=this;return i("q2-input",{ref:e=>this.controlElement=e,class:"calendar-input-field",value:this.formattedValue,label:s(this.label),hideLabel:this.hideLabel,disabled:!!this.disabled,readonly:!!this.readonly,clearable:this.canClear,placeholder:this.computedPlaceholder,optional:!!this.optional,ariaExpanded:`${!!this.open}`,hints:this.hintList,errors:this.errorList,onClick:e?undefined:this.onInputClick,onChange:this.onInputChange,onInput:this.onInputInput,onKeyDown:this.onInputKeydown,onKeyUp:this.onInputKeyup,onBlur:this.onInputBlur,onFocus:this.onInputFocus,"icon-right":e?undefined:"calendar","format-modifier":e?this.formatModifier:this.displayFormat||this.formatModifier,type:"date","hide-messages":!e,"test-id":"inputAndCalendarToggle",_role:"combobox",_preventEntry:!e},e&&i("q2-btn",{ref:e=>this.btnCalendarToggle=e,slot:"input-right",onClick:this.onInputClick,"test-id":"calendarToggle",label:"tecton.element.calendar.toggleAriaLabel","hide-label":true},i("q2-icon",{type:"calendar"})))}setCompleteInput(e){const t=f(e);this.change.emit({value:h(e)});this.typedValue=t;this.internalError=null;this.setHints({isValid:true,message:null,messageType:null})}setHints({isValid:e,message:t,messageType:i}){var n;if(t===this.hintMessage)return(n=this.hintMessageElement)===null||n===void 0?void 0:n.present();this.invalid=!e;this.hintMessage=t;this.hintMessageType=i;if(i==="error"&&t){this.internalError=t;this.error.emit({errors:[{message:t,errorCode:"generalInvalid"}]})}}validateDate(){var e,t,i;try{if(!!this.value){const{dateValue:n}=this;const a=(e=n===null||n===void 0?void 0:n.getMonth())!==null&&e!==void 0?e:undefined;const s=(t=n===null||n===void 0?void 0:n.getFullYear())!==null&&t!==void 0?t:undefined;const{monthIndex:r,selectedYear:o}=this.selectedMonthYear;const d=a===r&&s===o;let l=[];if(!n){l=[]}else if(d){l=this.dateList}else{l=this.buildDateList({monthIndex:a,selectedYear:s})}const c=(i=n===null||n===void 0?void 0:n.getDate())!==null&&i!==void 0?i:undefined;const u=c?!l.find((({integer:e})=>e===c)).isValid:true;if(u){this.error.emit({errors:[{message:`Value passed is invalid: The date ${this.value} is not valid`,errorCode:"generalInvalid"}]})}else{this.success.emit({value:h(n)})}}}catch(e){console.warn("Invalid moment value ",this.dateValue)}}render(){return i("click-elsewhere",{key:"e23ea47b755999a0447d11b11185040de8b6cb34",class:this.open?"dropdown-open":undefined,onChange:this.onClickElsewhere},this.inputField(),i("q2-popover",{key:"b1b25c6016f27d75c3e4934fce14049e9becb012",ref:e=>this.popoverElement=e,controlElement:this.innerInputContainer,open:this.open,direction:this.popoverDirection,minHeight:this.popoverMinHeight,align:this.popoverAlignment,mode:this.popoverMode||undefined,block:true},this.hintField(),this.calendarPopover()))}get hostElement(){return n(this)}static get watchers(){return{ariaLabel:["ariaLabelObserver"],cutoffTime:["cutoffTimeObserver"],daysOfWeekChecksum:["daysOfWeekChecksumObserver"],endDate:["endDateObserver"],invalidDates:["invalidDatesObserver"],popDirection:["popDirectionHandler"],startDate:["startDateObserver"],typeable:["typeableChanged"],validDates:["validDatesObserver"],value:["valueObserver"]}}};J.style=_;export{J as q2_calendar};
2
- //# sourceMappingURL=p-7dc8ad9d.entry.js.map
1
+ import{r as e,c as t,h as i,g as n}from"./p-a5f18e27.js";import{d as a}from"./p-f1e887f5.js";import{l as s,a as r,o,i as d,w as l,k as c}from"./p-33c5a660.js";function h(e){const t=new Date(e);if(!a.isValid(t))return;return a.formatISO(t,{representation:"date"})}let u;function f(e){const t=new Date(e);if(!a.isValid(t))return;const i=t.toISOString();if(!u){u=new Intl.DateTimeFormat("en-US",{month:"2-digit",day:"2-digit",year:"numeric",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})}return u.format(new Date(i))}let v;function p(e){const t=new Date(e);if(!a.isValid(t))return;if(!v){v=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"})}return v.format(t)}let b;function y(e){if(!e)return;const t=new Date(e);if(!a.isValid(t))return;if(!b){b=new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric",weekday:"long",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})}return b.format(t)}function m(e){return e.replace(/[d]/g,"E").replace(/[D]/g,"d").replace(/[Y]/g,"y").replace(/[l]/g,"P").replace(/[W]/g,"I")}function g(e){const t=typeof e==="string";if(!t&&e&&a.isValid(new Date(e||undefined))){e=h(e)}else if(!e||!a.isValid(new Date(e))){return undefined}let i;const n=e.split(/[\/\-]/).map((e=>e.padStart(2,"0")));const s=t&&e.length>=24&&e[10]==="T";const r=n.length===3;const o=n.length<3;if(s){e=e.split("T")[0];i=new Date(e)}else if(r){const t=e.includes("/")&&n[2].length===4;if(t)n.unshift(n.pop());i=new Date(Date.UTC(parseInt(n[0]),parseInt(n[1])-1,parseInt(n[2])))}else if(o){const e=new Date;let t;let a;let s;switch(n.length){case 1:t=e.getFullYear();a=n[0];s="01";break;case 2:t=e.getFullYear();a=n[0];s=n[1];break}i=new Date(`${t}-${a}-${s}`)}if(!a.isValid(i))return undefined;i=w(i);return a.isValid(i)?i:undefined}function w(e){const t=e.getTimezoneOffset();return a.setMinutes(e,t+Math.abs(t%60))}function D(e){if(!Array.isArray(e)||e.length===0){return[]}return e.map((e=>g(e)))}function x(e=new Date){return{monthIndex:e.getMonth(),selectedYear:e.getFullYear()}}function k(e="",t=[],i=[],n=[],r,o,d="mm/dd/yyyy",l){let c=true;let u=false;let f="info";let v=`${s("tecton.element.calendar.hint.format")}: ${d}`;if(!e){return{isValid:c,inputDate:new Date(""),isAvailable:u,messageType:f,message:v}}const b=$(e,l);const y=b.getMonth()+1;const m=b.getDate();const g=b.getFullYear();const w=[y,m,g];if(a.isValid(b)){const a=C()[b.getMonth()];if(e.length===10){c=true;f=null;v=null}u=t.includes(b.getDay());const l=h(b);if(u){const e=i.length&&!i.includes(l);const t=n.length&&n.includes(l);const a=r&&r>l;const s=o&&o<l;if(e||t||a||s){u=false}}if(e.length>=5&&!u){c=false;f="error";const e=!a||!m||!g;v=e?`${s("tecton.element.calendar.hint.invalidDate")}: ${d}`:s("tecton.element.calendar.hint.notAvailableDate",[p(b)])}}else{c=false;f="error";v=`${s("tecton.element.calendar.hint.invalidDate")}: ${d}`}return{isValid:c,messageType:f,message:v,inputDate:b,isAvailable:u,calendarPosition:w}}function $(e,t){const i=new Date;let[n,a,s]=e.split("/");if(n==="0")n="01";if(a==="0")a="01";if(e.length===10){return new Date(e)}else if(n&&a&&Number(a)>0){const e=Number(a)<10?`0${Number(a)}`:a;const i=!s||s.length<4?I(n,a,t):s;return new Date(`${n}/${e}/${i}`)}else if(n){return new Date(`${n}/01/${i.getFullYear()}`)}}function I(e,t,i){const n=`${e}/${t}`;const a=new Date;const s=a.getMonth()<9?`0${a.getMonth()+1}`:`${a.getMonth()+1}`;const r=a.getDate()<10?`0${a.getDate()}`:`${a.getDate()}`;const o=`${s}/${r}/${a.getFullYear()}`;let d=a.getFullYear();if(i==="future"&&o.slice(0,5)>n){d=a.getFullYear()+1}else if(i==="past"&&o.slice(0,5)<n){d=a.getFullYear()-1}return d.toString()}function T(e){if(!e){return""}if(e.match(/^[1-9]\/$/)){return`0${e}/`}else if(e.match(/^[0-9]{2}\/[1-9]{1}\/$/)){const t=e.split("/");return`${t[0]}/0${t[1]}/`}return e}function E(e){const t=(e||"").split("-");if(t.length!==3)return"";return`${t[1]}/${t[2]}/${t[0]}`}function O(e,t){return new Date(t,e,1,1,1,1,1).getDay()}function V(){return[s("tecton.element.calendar.days.short.Sunday"),s("tecton.element.calendar.days.short.Monday"),s("tecton.element.calendar.days.short.Tuesday"),s("tecton.element.calendar.days.short.Wednesday"),s("tecton.element.calendar.days.short.Thursday"),s("tecton.element.calendar.days.short.Friday"),s("tecton.element.calendar.days.short.Saturday")]}function A(){return[s("tecton.element.calendar.days.Sunday"),s("tecton.element.calendar.days.Monday"),s("tecton.element.calendar.days.Tuesday"),s("tecton.element.calendar.days.Wednesday"),s("tecton.element.calendar.days.Thursday"),s("tecton.element.calendar.days.Friday"),s("tecton.element.calendar.days.Saturday")]}function C(){return[s("tecton.element.calendar.months.January"),s("tecton.element.calendar.months.February"),s("tecton.element.calendar.months.March"),s("tecton.element.calendar.months.April"),s("tecton.element.calendar.months.May"),s("tecton.element.calendar.months.June"),s("tecton.element.calendar.months.July"),s("tecton.element.calendar.months.August"),s("tecton.element.calendar.months.September"),s("tecton.element.calendar.months.October"),s("tecton.element.calendar.months.November"),s("tecton.element.calendar.months.December")]}function z(e,t){const i=a.getDaysInMonth(new Date(t,e));return[...Array(i).keys()].reduce(((i,n)=>{i.push(new Date(t,e,n+1));return i}),[])}function q(e=127){const t=e&1;const i=e&2;const n=e&4;const a=e&8;const s=e&16;const r=e&32;const o=e&64;const d=[];if(e<=0)return d;if(t)d.push(0);if(i)d.push(1);if(n)d.push(2);if(a)d.push(3);if(s)d.push(4);if(r)d.push(5);if(o)d.push(6);return d}function S(e,t){return e.includes(t.getDay())}function Y(e,t){return!F(e,t)}function F(e,t){return e.some((e=>a.isSameDay(e,t)))}function M(e,t,i,n,a,s,r){const o=[H.bind(null,s,new Date)];if(t===null||t===void 0?void 0:t.length){o.push(F.bind(null,t))}else{o.push(S.bind(null,e))}o.push(Y.bind(null,i));return L(n,a,s,o,r)}function L({monthIndex:e,selectedYear:t},i,n,s,r){const o=!a.isValid(new Date(r));const d=z(e,t).map(((e,t)=>{const a=s.some((t=>!t(e)));const r=P(e,n,i);const d=j(Object.assign(Object.assign({},r),{isInvalid:a,isIncompleteDate:o}));return Object.assign(Object.assign({},r),{isValid:!a,date:e,integer:t+1,isEmpty:false,isActivity:false,classList:d})}));const l=B(O(e,t));const c=U((l.length+d.length)%7);return[...l,...d,...c]}function H(e,t,i){const n=a.isAfter(e===null||e===void 0?void 0:e.startDate,i);const s=a.isBefore(e===null||e===void 0?void 0:e.endDate,i);const r=a.isSameDay(t,i)&&a.isAfter(t,e===null||e===void 0?void 0:e.cutOffTime);return!(n||r||s)}function P(e,t,i){if(!i)i=new Date;const n=i&&a.isSameDay(i,e);const s=a.isSameDay(e,new Date);const r=a.isSameDay(e,t===null||t===void 0?void 0:t.startDate);const o=a.isSameDay(e,t===null||t===void 0?void 0:t.endDate);return{isSelected:n,isToday:s,isStartDate:r,isEndDate:o}}function j({isInvalid:e,isSelected:t,isEndDate:i,isStartDate:n,isToday:a,isIncompleteDate:s}){const r=[];if(!e)r.push("is-valid");if(t)r.push("is-selected");if(i)r.push("is-end-date");if(n)r.push("is-start-date");if(a)r.push("is-today");if(t&&e&&!s)r.push("is-unavailable");return r.join(" ")}function B(e){return K(0,e)}function U(e){if(e===0)return[];return K(e,7)}const W={date:null,integer:null,isActivity:false,isEmpty:true,isValid:false,isToday:false,isSelected:false,isStartDate:false,isEndDate:false,classList:""};function K(e,t){if(e===7)e=0;return[...Array(t-e).keys()].map((()=>Object.assign({},W)))}const N="*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block}:host[hidden]{display:none}click-elsewhere{position:relative;display:block}q2-input{margin:0;cursor:pointer}q2-popover{--comp-min-tappable-size:44px;--comp-table-border-spacing:2px;--comp-min-tappable-size-and-spacing:calc(var(--comp-min-tappable-size) + var(--comp-table-border-spacing));--comp-popover-padding:var(--tct-calendar-popover-padding, var(--t-calendar-popover-padding, var(--app-scale-1x, 5px)));--comp-min-table-width:calc(var(--comp-min-tappable-size-and-spacing) * 7);--comp-table-container-border-spacing:calc(var(--comp-table-border-spacing) * 2);--comp-popover-total-padding:calc(var(--comp-popover-padding) * 2);--tct-popover-min-width:calc(\n var(--comp-min-table-width) + var(--comp-table-container-border-spacing) + var(--comp-popover-total-padding)\n )}.calendar-field-popup{padding:var(--comp-popover-padding)}.calendar-label{--comp-label-padding:var(--tct-calendar-label-padding, var(--tct-calendar-label-vertical-padding, var(--t-calendar-label-vertical-padding, var(--tct-scale-2, var(--app-scale-2x, 10px)))) 0);font-size:var(--tct-calendar-label-font-size, var(--t-calendar-label-font-size, 16px));flex:1 1;flex-basis:calc(100% - var(--tct-btn-icon-width, 44px));margin:0;padding:var(--comp-label-padding)}.cal-month-heading{padding:0 0 0.75rem;display:flex;justify-content:center;align-items:center;font-size:var(--tct-calendar-month-font-size, var(--t-calendar-month-font-size, 16px));font-weight:var(--tct-calendar-month-font-weight, var(--t-calendar-month-font-weight, 600));text-align:center}.cal-month-text{min-width:82px;display:inline-block}.cal-year-text{min-width:50px;display:inline-block}table{width:100%;margin-bottom:2px;text-align:center;border-spacing:var(--comp-table-border-spacing)}th{font-size:var(--tct-calendar-day-heading-font-size, var(--t-calendar-day-heading-font-size, inherit));font-weight:var(--tct-calendar-day-heading-font-weight, var(--t-calendar-day-heading-font-weight, 600));width:14.285714%}td{height:var(--comp-min-tappable-size);cursor:pointer;border:var(--tct-calendar-day-border, var(--t-calendar-day-border, 0));border-radius:var(--tct-calendar-day-border-radius, var(--t-calendar-day-border-radius))}td.is-unavailable{border:1px solid var(--tct-input-error-border-color, var(--const-stoplight-alert, #d20a0a))}td.is-valid:hover{border:var(--tct-calendar-day-hover-border, var(--t-calendar-day-hover-border, var(--tct-calendar-day-border, var(--t-calendar-day-border, 0))));border-radius:var(--tct-calendar-day-hover-border-radius, var(--t-calendar-day-hover-border-radius, var(--tct-calendar-day-border-radius, var(--t-calendar-day-border-radius))));background:var(--tct-calendar-day-hover-background, var(--tct-calendar-day-hover-bg, var(--t-calendar-day-hover-bg, var(--tct-gray-14, var(--app-gray14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2)))))));color:var(--tct-calendar-day-hover-font-color, var(--t-calendar-day-hover-font-color, inherit))}td[aria-hidden],td[aria-disabled]{pointer-events:none;cursor:not-allowed}td[aria-disabled]{opacity:var(--tct-calendar-day-disabled-opacity, var(--t-calendar-day-disabled-opacity, var(--app-disabled-opacity, 0.4)))}td[aria-selected]{border:var(--tct-calendar-day-selected-border, var(--t-calendar-day-selected-border, var(--tct-calendar-day-border, var(--t-calendar-day-border, 0))));border-radius:var(--tct-calendar-day-selected-border-radius, var(--t-calendar-day-selected-border-radius, var(--tct-calendar-day-border-radius, var(--t-calendar-day-border-radius))));background:var(--tct-calendar-day-selected-background, var(--tct-calendar-day-selected-bg, var(--t-calendar-day-selected-bg, var(--tct-calendar-day-hover-background, var(--tct-calendar-day-hover-bg, var(--t-calendar-day-hover-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l4, var(--app-gray-l4, #f2f2f2))))))))));color:var(--tct-calendar-day-selected-font-color, var(--t-calendar-day-selected-font-color, var(--tct-calendar-day-hover-font-color, var(--t-calendar-day-hover-font-color, inherit))));box-shadow:0 0 0 2px var(--tct-calendar-day-selected-outline-color, var(--t-calendar-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1))))}td[aria-selected]:focus{box-shadow:0 0 0 2px var(--tct-calendar-day-selected-outline-color, var(--t-calendar-day-selected-outline-color, var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1)))), 0 0 0 4px var(--const-focus-color, #0066cc)}.today-decorator{text-transform:uppercase;font-weight:700;font-size:10px;height:12px}.calendar-disclaimer{font-size:var(--tct-calendar-disclaimer-font-size, var(--t-calendar-disclaimer-font-size, var(--tct-font-size-small, var(--app-font-size-small, 12px))));border-style:solid;border-width:var(--tct-calendar-disclaimer-border-width, var(--t-calendar-disclaimer-border-width, 1px 0 0 0));border-color:var(--tct-calendar-disclaimer-border-color, var(--t-calendar-disclaimer-border-color, var(--tct-gray-13, var(--t-gray-13, var(--tct-gray-l3, var(--app-gray-l3, #e6e6e6))))));padding:var(--tct-calendar-disclaimer-padding, var(--tct-scale-2, var(--app-scale-2x, 10px)));text-align:left}";const _=N;const J=class{constructor(i){e(this,i);this.change=t(this,"change",7);this.error=t(this,"error",7);this.success=t(this,"success",7);this.dayAbbrStrings=V();this.dayStrings=A();this.defaultFormatString="mm/dd/yyyy";this.formatModifier="M/D/YYYY";this.internalError="";this.monthStrings=C();this.scheduledAfterRender=[];this.closeCalendar=()=>{if(!this.open)return;this.open=false;this.focusInput()};this.goToMonthYear=(e,t)=>{if(e<0){e=11;t--}else if(e>11){e=0;t++}this.selectedMonthYear={monthIndex:e,selectedYear:t};this.dateList=this.buildDateList(this.selectedMonthYear);this.scheduledAfterRender.push((()=>this.checkActiveCellForBlankness()))};this.onClickElsewhere=e=>{const t=e.target;if(t.localName==="click-elsewhere"){e.stopPropagation();this.closeCalendar()}};this.onDateKeydown=e=>{const{monthIndex:t,selectedYear:i}=this.selectedMonthYear;const n=parseInt(e.target.dataset.day);const s=this.generateDateFromDay(n);switch(e.key){case"ArrowUp":e.preventDefault();this.activateDay(a.addDays(s,-7));break;case"ArrowDown":e.preventDefault();this.activateDay(a.addDays(s,7));break;case"ArrowRight":e.preventDefault();this.activateDay(a.addDays(s,1));break;case"ArrowLeft":e.preventDefault();this.activateDay(a.addDays(s,-1));break;case"PageUp":e.preventDefault();if(e.shiftKey)this.goToMonthYear(t,i-1);else this.goToMonthYear(t-1,i);break;case"PageDown":e.preventDefault();if(e.shiftKey)this.goToMonthYear(t,i+1);else this.goToMonthYear(t+1,i);break;case"Home":e.preventDefault();this.activateDay(a.addDays(s,-s.getDay()));break;case"End":e.preventDefault();this.activateDay(a.addDays(s,6-s.getDay()));break;case"Escape":e.preventDefault();this.closeCalendar();this.focusInput();break;case"Enter":e.preventDefault();if(!this.dateList.find((({date:e})=>a.isSameDay(e,s))).isValid)return;this.selectDate(s);this.closeCalendar();this.focusInput();break;case" ":e.preventDefault();if(!this.dateList.find((({date:e})=>a.isSameDay(e,s))).isValid)return;this.selectDate(s);this.closeCalendar();this.focusInput();break}};this.onDateSelection=e=>{const t=e.target.closest("td:not([aria-hidden])");if(!t)return;const i=w(new Date(t.dataset.date));this.selectDate(i);this.closeCalendar()};this.onHeaderControlKeydown=e=>{var t;const i=this.generateDateFromDay(1);const n=(t=this.calendarBody)===null||t===void 0?void 0:t.querySelector('[aria-selected="true"]');if(e.key==="Tab"&&!n){e.preventDefault();this.activateDay(i)}};this.onInputBlur=()=>{if(!this.isTypeable)return;const e=q(this.daysOfWeekChecksum);const{typedValue:t}=this;const{isValid:i,inputDate:n,isAvailable:s}=k(this.typedValue,e,this.validDates,this.invalidDates,this.startDate,this.endDate,this.defaultFormatString,this.assume);if(!t&&(n===null||n===void 0?void 0:n.toString())==="Invalid Date"){this.setHints({isValid:true,message:this.defaultHintMessage,messageType:"info"})}else if(i||t&&t.length>4&&n&&a.isValid(n)&&s){this.setCompleteInput(n)}else if(this.value){this.valueOnBlur=this.value;this.value=null;this.change.emit({value:null});this.typedValue=t}};this.onInputChange=e=>{e.stopPropagation()};this.onInputClick=()=>{if(this.disabled)return;this.toggleCalendar()};this.onInputFocus=e=>{if(!this.isTypeable)return;if(e.target===this.controlElement){if(this.valueOnBlur&&!this.value){const e=this.typedValue;this.value=this.valueOnBlur;this.typedValue=e;this.valueOnBlur=null}this.closeCalendar()}};this.onInputInput=({detail:{value:e}})=>{this.typedValue=e};this.onInputKeydown=e=>{const{dateValue:t}=this;switch(e.key){case"ArrowDown":e.preventDefault();this.openCalendar();this.activateDay(t||new Date);break;case"Enter":case" ":if(this.typeable)break;e.preventDefault();if(this.open){this.closeCalendar()}else{this.openCalendar();this.activateDay(t||new Date)}break}};this.onInputKeyup=e=>{if(this.disabled){return}switch(e.key){case"Escape":this.onInputBlur();this.closeCalendar();break}if(!this.isTypeable)return;this.typedValue=T(this.typedValue);const{typedValue:t}=this;const i=q(this.daysOfWeekChecksum);const{isValid:n,message:s,messageType:r,inputDate:o,isAvailable:d,calendarPosition:l}=k(t,i,this.validDates,this.invalidDates,this.startDate,this.endDate,this.defaultFormatString,this.assume);if(l){const[e,t,i]=l;const n=new Date(i,e-1,t);if(a.isValid(n)){this.selectedMonthYear=x(n);this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}}if(e.key==="Enter"){if(n||t&&t.length>4&&o&&a.isValid(o)&&d){this.setCompleteInput(o)}else if(this.value){this.value=null;this.change.emit({value:null});this.typedValue=t}if(this.keyboardSelection){this.keyboardSelection=false;this.closeCalendar()}else{this.toggleCalendar()}}else{this.setHints({isValid:n,message:s,messageType:r})}};this.onPopupKeyup=e=>{if(e.key==="Escape"||e.key==="Esc"){this.onInputBlur();this.closeCalendar()}};this.onRefocus=()=>{var e;(e=this.btnPrevMonth)===null||e===void 0?void 0:e.dispatchEvent(new FocusEvent("focus"))};this.openCalendar=()=>{if(this.readonly||this.open)return;this.selectedMonthYear=x(this.dateValue);this.dateList=this.buildDateList(this.selectedMonthYear);this.open=true};this.selectDate=e=>{const{isValid:t}=this.dateList.find((({date:t})=>a.isSameDay(t,e)));if(!t)return;this.change.emit({value:h(e)});this.typedValue=f(e);this.invalid=false;this.success.emit({value:h(e)})};this.toggleCalendar=()=>{if(this.readonly)return;if(this.open){this.closeCalendar()}else{this.openCalendar()}};this.dateList=undefined;this.hintMessage=this.defaultHintMessage;this.hintMessageType="info";this.keyboardSelection=false;this.typedValue="";this.ariaLabel=undefined;this.assume="current";this.buttonLabel=undefined;this.calendarLabel=undefined;this.clearable=undefined;this.cutoffTime=undefined;this.daysOfWeekChecksum=undefined;this.disabled=undefined;this.disabledMsg=undefined;this.disclaimer=undefined;this.displayFormat=undefined;this.endDate=undefined;this.errors=undefined;this.hideLabel=undefined;this.hints=undefined;this.invalid=undefined;this.invalidDates=undefined;this.label=undefined;this.onsuccess=undefined;this.open=undefined;this.optional=undefined;this.placeholder=undefined;this.popDirection=undefined;this.popoverAlignment=undefined;this.popoverDirection=undefined;this.popoverMinHeight=355;this.popoverMode=null;this.readonly=undefined;this.startDate=undefined;this.typeable=undefined;this.validDates=undefined;this.value=undefined}connectedCallback(){this.selectedMonthYear=x(this.dateValue);this.dateList=this.buildDateList(this.selectedMonthYear);if(this.value&&this.isTypeable&&!this.typedValue){this.typedValue=E(this.value)}this.validateDate()}componentWillLoad(){this.popDirectionHandler();r(this)}componentDidLoad(){o(this.hostElement)}componentDidRender(){setTimeout((()=>{this.scheduledAfterRender.forEach((e=>e()));this.scheduledAfterRender=[]}),25)}defaultChangeHandler(e){if(e.target===this.hostElement&&!this.hostElement.onchange&&!!e.detail){this.value=e.detail.value}}handleClear(){this.change.emit({value:null});this.value=null;this.typedValue=""}defaultErrorHandler(e){if(e.target===this.hostElement&&!this.hostElement.onerror){if(this.hintMessageType==="error"&&this.hintMessage){this.internalError=this.hintMessage}else{this.internalError=s("tecton.element.calendar.hint.invalidDate")}}}delegateFocus(e){if(!d(e,this.hostElement))return;this.controlElement.shadowRoot.querySelector(".input-field").focus()}popoverStateHandler({detail:{open:e}}){if(this.open!==e)this.open=e}defaultSuccessHandler(e){if(e.target!==this.hostElement){return}if(typeof this.onsuccess==="function"){this.onsuccess(e)}else{this.internalError="";if(this.hintMessageType==="error"&&this.hintMessage){this.hintMessage=null;this.hintMessageType=null;this.invalid=false}}}async closePopover(){if(!this.open)return;this._togglePopover()}async openPopover(){if(this.open)return;this._togglePopover()}async setValue(e){var t;const i=typeof e==="string"?g(e):e;if(!a.isValid(i))return;await this.openPopover();await l();this.goToMonthYear(i.getMonth(),i.getFullYear());await l();const n=(t=this.calendarTable)===null||t===void 0?void 0:t.querySelector(`td[data-date="${h(i)}"]`);n===null||n===void 0?void 0:n.click()}async typeValue(e){if(!this.typeable)return;const t=typeof e==="string"?g(e):e;const i=f(t);if(!a.isValid(t))return;const{innerInputField:n,controlElement:s}=this;n.focus();n.dispatchEvent(new FocusEvent("focus"));n.value=i;n.dispatchEvent(new InputEvent("input"));s.dispatchEvent(new KeyboardEvent("keyup"))}ariaLabelObserver(){r(this)}cutoffTimeObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}daysOfWeekChecksumObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}endDateObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}invalidDatesObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}popDirectionHandler(){c(this,"popDirection","popoverDirection")}startDateObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}typeableChanged(){this.valueObserver(this.value)}validDatesObserver(){this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}valueObserver(e){if(e===""){this.value=undefined;this.setHints({isValid:true,message:this.defaultHintMessage,messageType:"info"});return}const t=e&&typeof e!=="string"&&"toDate"in e;const i=t?e.toDate():g(e);const n=f(i);if(this.isTypeable){this.typedValue=n}else{this.controlElement.value=n;this.selectedMonthYear=x(i);this.dateList=this.buildDateList(this.selectedMonthYear);this.validateDate()}if(this.invalid)return;if(n){this.setHints({isValid:true,message:null,messageType:null})}else{this.setHints({isValid:true,message:this.defaultHintMessage,messageType:"info"})}}get canClear(){if(this.isTypeable){return this.clearable&&!!this.typedValue}else{return this.clearable&&!!this.value}}get computedPlaceholder(){if(this.disabled&&this.disabledMsg){return s(this.disabledMsg)}if(this.buttonLabel&&(this.disabled||this.placeholder)){return s(this.buttonLabel)}return this.placeholder&&s(this.placeholder)||""}get currentWeeks(){const e=this.dateList.reduce(((e,t,i)=>{const n=Math.floor(i/7);if(!e[n]){e[n]=[]}e[n].push(t);return e}),[]);return e}get dateValidators(){const e=new Date(this.cutoffTime||"");return{startDate:g(this.startDate),endDate:g(this.endDate),cutOffTime:a.isValid(e)?e:undefined}}get dateValue(){if(this.isTypeable){return g(this.typedValue)}else{let{value:e}=this;const t=e&&typeof e!=="string"&&"toDate"in e;if(t)return e.toDate();const i=typeof e==="string"&&e.split(" ").length===6&&/GMT-\d{4}/g.test(e);if(i){e=h(e)}return g(e)}}get defaultHintMessage(){return this.typeable?s("tecton.element.calendar.hint.format")+": "+this.defaultFormatString:s("tecton.element.calendar.hint.select")}get errorList(){const{errors:e,internalError:t,invalid:i}=this;let n=[];if(t){n=[t]}if(Array.isArray(e)&&e.length){n=e.filter((e=>!!e)).map((e=>s(e))).concat(n)}else if(!t&&i){return["tecton.element.calendar.invalid"]}return n}get formattedValue(){const{typedValue:e,dateValue:t,displayFormat:i,isTypeable:n}=this;if(n)return e;if(t===undefined)return"";if(i)return a.format(t,m(i));return new Intl.DateTimeFormat("en-US",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone}).format(t)}get hintList(){const{hints:e,hintMessageType:t,hintMessage:i}=this;if(Array.isArray(e)&&e.length)return e.filter((e=>!!e)).map((e=>s(e)));if(t==="info"&&i)return[i];return[]}get innerInputContainer(){var e,t;return(t=(e=this.controlElement)===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector(".input-container")}get innerInputField(){var e,t;return(t=(e=this.controlElement)===null||e===void 0?void 0:e.shadowRoot)===null||t===void 0?void 0:t.querySelector(".input-field")}get isTypeable(){return this.typeable}get selectedDate(){var e;const t=(e=this.calendarBody)===null||e===void 0?void 0:e.querySelector('[aria-selected="true"]');return t?w(new Date(t.dataset.date)):null}_togglePopover(){const e=this.typeable?this.btnCalendarToggle:this.innerInputField;e===null||e===void 0?void 0:e.click();e===null||e===void 0?void 0:e.focus();e.dispatchEvent(new FocusEvent("focus"))}activateDay(e){this.goToMonthYear(e.getMonth(),e.getFullYear());this.scheduledAfterRender.push((()=>this.focusDay(e)))}buildDateList(e){const t=D(this.invalidDates);const i=q(this.daysOfWeekChecksum);const n=D(this.validDates);return M(i,n,t,e,this.dateValue,this.dateValidators,this.typedValue)}calendarDays(){return i("table",{role:"grid","aria-labelledby":"table-label",ref:e=>this.calendarTable=e},i("thead",null,i("tr",null,[...Array(7).keys()].map((e=>i("th",{scope:"col","aria-label":this.dayStrings[e]},this.dayAbbrStrings[e]))))),i("tbody",{onClick:this.onDateSelection,onKeyDown:this.onDateKeydown,ref:e=>this.calendarBody=e,"test-id":"calendarTableBody"},this.currentWeeks.map((e=>i("tr",null,e.map((e=>{var t;let n="";if(e.isToday)n=`${s("tecton.element.calendar.today")}, `;n+=y(e.date);if(e.isSelected)n+=` (${s("tecton.element.calendar.selected")})`;return i("td",{class:e.classList,"aria-hidden":e.isEmpty?"true":undefined,tabindex:e.isSelected?0:-1,role:e.isSelected?"gridcell":undefined,"aria-selected":e.isSelected?"true":undefined,"aria-disabled":e.isValid?undefined:"true","data-day":e.integer||undefined,"data-date":e.date?h(e.date):undefined},(e===null||e===void 0?void 0:e.isToday)&&i("div",{class:"today-decorator","aria-hidden":"true"},s("tecton.element.calendar.today")),i("div",{"aria-label":n},(t=e===null||e===void 0?void 0:e.integer)!==null&&t!==void 0?t:""))})))))))}calendarPopover(){const{monthIndex:e,selectedYear:t}=this.selectedMonthYear;return i("div",{class:"calendar-field-popup",onKeyUp:this.onPopupKeyup},this.calendarLabel&&i("p",{class:"calendar-label"},s(this.calendarLabel)),i("div",{class:"cal-month-heading"},i("q2-btn",{label:s("tecton.element.calendar.previousMonth"),"hide-label":true,ref:e=>this.btnPrevMonth=e,class:"cal-nav-btn prev-month","test-id":"previousMonthButton",onClick:()=>this.goToMonthYear(e-1,t)},i("q2-icon",{type:"chevron-left"})),i("span",{class:"cal-month-text"},this.monthStrings[e]),i("q2-btn",{label:s("tecton.element.calendar.nextMonth"),"hide-label":true,class:"cal-nav-btn next-month",ref:e=>this.btnNextMonth=e,"test-id":"nextMonthButton",onClick:()=>this.goToMonthYear(e+1,t)},i("q2-icon",{type:"chevron-right"})),i("q2-btn",{label:s("tecton.element.calendar.previousYear"),"hide-label":true,class:"cal-nav-btn prev-year",ref:e=>this.btnPrevYear=e,"test-id":"previousYearButton",onClick:()=>this.goToMonthYear(e,t-1)},i("q2-icon",{type:"chevron-left"})),i("span",{class:"cal-year-text"},this.selectedMonthYear.selectedYear),i("q2-btn",{label:s("tecton.element.calendar.nextYear"),"hide-label":true,class:"cal-nav-btn next-year",ref:e=>this.btnNextYear=e,"test-id":"nextYearButton",onClick:()=>this.goToMonthYear(e,t+1),onKeyDown:this.onHeaderControlKeydown},i("q2-icon",{type:"chevron-right"}))),i("div",{class:"sr","aria-live":"polite",id:"table-label"},`${this.monthStrings[e]} ${t}`),this.calendarDays(),this.disclaimer&&i("div",{class:"calendar-disclaimer"},s(this.disclaimer)),i("q2-btn",{class:"sr refocus-popup",onFocus:this.onRefocus}))}checkActiveCellForBlankness(){const e=this.hostElement.shadowRoot.activeElement;if(!e||e.tagName!=="TD"||!e.hasAttribute("aria-hidden"))return;const{calendarBody:t}=this;const i=Array.from(t.querySelectorAll("td"));const n=Array.from(i).indexOf(e);const a=n<15?1:i.filter((e=>!e.hasAttribute("aria-hidden"))).length;this.focusDay(this.generateDateFromDay(a))}async focusDay(e){var t;if(!e)return;await l();(t=this.calendarBody.querySelector(`td[data-day="${e.getDate()}"]`))===null||t===void 0?void 0:t.focus()}focusInput(){var e;(e=this.controlElement)===null||e===void 0?void 0:e.focus()}generateDateFromDay(e){const{monthIndex:t,selectedYear:i}=this.selectedMonthYear;return new Date(i,t,e)}hintField(){if(!this.hintMessage)return;return i("q2-message",{class:"calendar-hint sr",ref:e=>this.hintMessageElement=e,type:this.hintMessageType},this.hintMessage)}inputField(){const{isTypeable:e}=this;return i("q2-input",{ref:e=>this.controlElement=e,class:"calendar-input-field",value:this.formattedValue,label:s(this.label),hideLabel:this.hideLabel,disabled:!!this.disabled,readonly:!!this.readonly,clearable:this.canClear,placeholder:this.computedPlaceholder,optional:!!this.optional,ariaExpanded:`${!!this.open}`,hints:this.hintList,errors:this.errorList,onClick:e?undefined:this.onInputClick,onChange:this.onInputChange,onInput:this.onInputInput,onKeyDown:this.onInputKeydown,onKeyUp:this.onInputKeyup,onBlur:this.onInputBlur,onFocus:this.onInputFocus,"icon-right":e?undefined:"calendar","format-modifier":e?this.formatModifier:this.displayFormat||this.formatModifier,type:"date","hide-messages":!e,"test-id":"inputAndCalendarToggle",_role:"combobox",_preventEntry:!e},e&&i("q2-btn",{ref:e=>this.btnCalendarToggle=e,slot:"input-right",onClick:this.onInputClick,"test-id":"calendarToggle",label:"tecton.element.calendar.toggleAriaLabel","hide-label":true},i("q2-icon",{type:"calendar"})))}setCompleteInput(e){const t=f(e);this.change.emit({value:h(e)});this.typedValue=t;this.internalError=null;this.setHints({isValid:true,message:null,messageType:null})}setHints({isValid:e,message:t,messageType:i}){var n;if(t===this.hintMessage)return(n=this.hintMessageElement)===null||n===void 0?void 0:n.present();this.invalid=!e;this.hintMessage=t;this.hintMessageType=i;if(i==="error"&&t){this.internalError=t;this.error.emit({errors:[{message:t,errorCode:"generalInvalid"}]})}}validateDate(){var e,t,i;try{if(!!this.value){const{dateValue:n}=this;const a=(e=n===null||n===void 0?void 0:n.getMonth())!==null&&e!==void 0?e:undefined;const s=(t=n===null||n===void 0?void 0:n.getFullYear())!==null&&t!==void 0?t:undefined;const{monthIndex:r,selectedYear:o}=this.selectedMonthYear;const d=a===r&&s===o;let l=[];if(!n){l=[]}else if(d){l=this.dateList}else{l=this.buildDateList({monthIndex:a,selectedYear:s})}const c=(i=n===null||n===void 0?void 0:n.getDate())!==null&&i!==void 0?i:undefined;const u=c?!l.find((({integer:e})=>e===c)).isValid:true;if(u){this.error.emit({errors:[{message:`Value passed is invalid: The date ${this.value} is not valid`,errorCode:"generalInvalid"}]})}else{this.success.emit({value:h(n)})}}}catch(e){console.warn("Invalid moment value ",this.dateValue)}}render(){return i("click-elsewhere",{key:"e23ea47b755999a0447d11b11185040de8b6cb34",class:this.open?"dropdown-open":undefined,onChange:this.onClickElsewhere},this.inputField(),i("q2-popover",{key:"b1b25c6016f27d75c3e4934fce14049e9becb012",ref:e=>this.popoverElement=e,controlElement:this.innerInputContainer,open:this.open,direction:this.popoverDirection,minHeight:this.popoverMinHeight,align:this.popoverAlignment,mode:this.popoverMode||undefined,block:true},this.hintField(),this.calendarPopover()))}get hostElement(){return n(this)}static get watchers(){return{ariaLabel:["ariaLabelObserver"],cutoffTime:["cutoffTimeObserver"],daysOfWeekChecksum:["daysOfWeekChecksumObserver"],endDate:["endDateObserver"],invalidDates:["invalidDatesObserver"],popDirection:["popDirectionHandler"],startDate:["startDateObserver"],typeable:["typeableChanged"],validDates:["validDatesObserver"],value:["valueObserver"]}}};J.style=_;export{J as q2_calendar};
2
+ //# sourceMappingURL=p-2b18312e.entry.js.map