@pine-ds/core 4.9.0 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/components/mock-pds-modal.js +1 -1
  2. package/components/pds-checkbox2.js +1 -1
  3. package/components/pds-chip2.js +1 -1
  4. package/components/pds-combobox.js +2 -2
  5. package/components/pds-datepicker.js +1 -1
  6. package/components/pds-dropdown-menu.js +1 -1
  7. package/components/pds-icon2.js +1 -1
  8. package/components/pds-link2.js +1 -1
  9. package/components/pds-modal2.js +1 -1
  10. package/components/pds-multiselect.js +1 -1
  11. package/components/pds-radio-group.js +1 -1
  12. package/components/pds-text2.js +1 -1
  13. package/components/pds-tooltip.js +1 -1
  14. package/components/portal-target.js +1 -0
  15. package/components/tabbable.js +1 -1
  16. package/components/truncation-tooltip.js +1 -1
  17. package/dist/cjs/{index-Do70atou.js → index-BDnbr0DK.js} +1 -1
  18. package/dist/cjs/{index-BsWY_xEJ.js → index-D9iJuJCP.js} +12 -0
  19. package/dist/cjs/loader.cjs.js +2 -2
  20. package/dist/cjs/mock-pds-modal.cjs.entry.js +2 -2
  21. package/dist/cjs/pds-accordion.cjs.entry.js +2 -2
  22. package/dist/cjs/pds-alert.cjs.entry.js +1 -1
  23. package/dist/cjs/pds-avatar.cjs.entry.js +2 -2
  24. package/dist/cjs/pds-box.cjs.entry.js +1 -1
  25. package/dist/cjs/pds-button.cjs.entry.js +2 -2
  26. package/dist/cjs/pds-checkbox.cjs.entry.js +3 -3
  27. package/dist/cjs/pds-chip.cjs.entry.js +9 -9
  28. package/dist/cjs/pds-combobox.cjs.entry.js +102 -16
  29. package/dist/cjs/pds-container.cjs.entry.js +1 -1
  30. package/dist/cjs/pds-copytext.cjs.entry.js +4 -3
  31. package/dist/cjs/pds-datepicker.cjs.entry.js +4 -41
  32. package/dist/cjs/pds-divider.cjs.entry.js +1 -1
  33. package/dist/cjs/pds-drawer-content.cjs.entry.js +1 -1
  34. package/dist/cjs/pds-drawer-footer.cjs.entry.js +1 -1
  35. package/dist/cjs/pds-drawer-header.cjs.entry.js +1 -1
  36. package/dist/cjs/pds-drawer.cjs.entry.js +1 -1
  37. package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +1 -1
  38. package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +1 -1
  39. package/dist/cjs/pds-dropdown-menu.cjs.entry.js +59 -47
  40. package/dist/cjs/pds-filter.cjs.entry.js +2 -2
  41. package/dist/cjs/pds-filters.cjs.entry.js +1 -1
  42. package/dist/cjs/pds-icon.cjs.entry.js +54 -21
  43. package/dist/cjs/pds-image.cjs.entry.js +1 -1
  44. package/dist/cjs/pds-input.cjs.entry.js +2 -2
  45. package/dist/cjs/pds-link.cjs.entry.js +3 -3
  46. package/dist/cjs/pds-loader.cjs.entry.js +1 -1
  47. package/dist/cjs/pds-modal-content.cjs.entry.js +1 -1
  48. package/dist/cjs/pds-modal-footer.cjs.entry.js +1 -1
  49. package/dist/cjs/pds-modal-header.cjs.entry.js +1 -1
  50. package/dist/cjs/pds-modal.cjs.entry.js +3 -3
  51. package/dist/cjs/pds-multiselect.cjs.entry.js +11 -5
  52. package/dist/cjs/pds-popover.cjs.entry.js +2 -2
  53. package/dist/cjs/pds-progress.cjs.entry.js +1 -1
  54. package/dist/cjs/pds-property.cjs.entry.js +1 -1
  55. package/dist/cjs/pds-radio-group.cjs.entry.js +66 -5
  56. package/dist/cjs/pds-radio.cjs.entry.js +2 -2
  57. package/dist/cjs/pds-row.cjs.entry.js +1 -1
  58. package/dist/cjs/pds-select.cjs.entry.js +2 -2
  59. package/dist/cjs/pds-sortable-item.cjs.entry.js +2 -2
  60. package/dist/cjs/pds-sortable.cjs.entry.js +1 -1
  61. package/dist/cjs/pds-switch.cjs.entry.js +2 -2
  62. package/dist/cjs/pds-tab.cjs.entry.js +1 -1
  63. package/dist/cjs/pds-table-body.cjs.entry.js +1 -1
  64. package/dist/cjs/pds-table-cell.cjs.entry.js +3 -2
  65. package/dist/cjs/pds-table-head-cell.cjs.entry.js +2 -2
  66. package/dist/cjs/pds-table-head.cjs.entry.js +1 -1
  67. package/dist/cjs/pds-table-row.cjs.entry.js +1 -1
  68. package/dist/cjs/pds-table.cjs.entry.js +1 -1
  69. package/dist/cjs/pds-tabpanel.cjs.entry.js +1 -1
  70. package/dist/cjs/pds-tabs.cjs.entry.js +1 -1
  71. package/dist/cjs/pds-text.cjs.entry.js +29 -3
  72. package/dist/cjs/pds-textarea.cjs.entry.js +2 -2
  73. package/dist/cjs/pds-toast.cjs.entry.js +1 -1
  74. package/dist/cjs/pds-tooltip.cjs.entry.js +16 -5
  75. package/dist/cjs/pine-core.cjs.js +2 -2
  76. package/dist/cjs/portal-target-e8WQ6dLx.js +70 -0
  77. package/dist/cjs/{tabbable-CddSt_Hi.js → tabbable-BrrrGvdG.js} +2 -1
  78. package/dist/cjs/{truncation-tooltip-O5nQmXPw.js → truncation-tooltip-Bikp7n9I.js} +43 -3
  79. package/dist/collection/components/pds-checkbox/pds-checkbox.css +20 -14
  80. package/dist/collection/components/pds-chip/pds-chip.js +5 -6
  81. package/dist/collection/components/pds-combobox/grouped-options-panel.js +39 -1
  82. package/dist/collection/components/pds-combobox/pds-combobox.css +37 -1
  83. package/dist/collection/components/pds-combobox/pds-combobox.js +62 -14
  84. package/dist/collection/components/pds-combobox/stories/pds-combobox.stories.js +48 -0
  85. package/dist/collection/components/pds-datepicker/calendar-portal.js +1 -38
  86. package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +64 -46
  87. package/dist/collection/components/pds-link/pds-link.css +1 -1
  88. package/dist/collection/components/pds-link/stories/pds-link.stories.js +48 -0
  89. package/dist/collection/components/pds-modal/pds-modal.css +1 -1
  90. package/dist/collection/components/pds-multiselect/pds-multiselect.js +9 -3
  91. package/dist/collection/components/pds-radio-group/pds-radio-group.js +65 -4
  92. package/dist/collection/components/pds-text/pds-text.js +28 -3
  93. package/dist/collection/components/pds-text/stories/pds-text.stories.js +16 -0
  94. package/dist/collection/components/pds-tooltip/pds-tooltip.css +11 -0
  95. package/dist/collection/components/pds-tooltip/pds-tooltip.js +14 -3
  96. package/dist/collection/components/pds-tooltip/stories/pds-tooltip.stories.js +30 -0
  97. package/dist/collection/utils/portal-target.js +64 -0
  98. package/dist/collection/utils/tabbable.js +2 -1
  99. package/dist/collection/utils/truncation-tooltip.js +42 -3
  100. package/dist/docs.json +9 -3
  101. package/dist/esm/{index-BFSwd-GQ.js → index-4_RRPJTO.js} +12 -1
  102. package/dist/esm/{index-m3pqpeWg.js → index-DvN3tyZp.js} +1 -1
  103. package/dist/esm/loader.js +3 -3
  104. package/dist/esm/mock-pds-modal.entry.js +2 -2
  105. package/dist/esm/pds-accordion.entry.js +2 -2
  106. package/dist/esm/pds-alert.entry.js +1 -1
  107. package/dist/esm/pds-avatar.entry.js +2 -2
  108. package/dist/esm/pds-box.entry.js +1 -1
  109. package/dist/esm/pds-button.entry.js +2 -2
  110. package/dist/esm/pds-checkbox.entry.js +3 -3
  111. package/dist/esm/pds-chip.entry.js +8 -8
  112. package/dist/esm/pds-combobox.entry.js +102 -16
  113. package/dist/esm/pds-container.entry.js +1 -1
  114. package/dist/esm/pds-copytext.entry.js +4 -3
  115. package/dist/esm/pds-datepicker.entry.js +3 -40
  116. package/dist/esm/pds-divider.entry.js +1 -1
  117. package/dist/esm/pds-drawer-content.entry.js +1 -1
  118. package/dist/esm/pds-drawer-footer.entry.js +1 -1
  119. package/dist/esm/pds-drawer-header.entry.js +1 -1
  120. package/dist/esm/pds-drawer.entry.js +1 -1
  121. package/dist/esm/pds-dropdown-menu-item.entry.js +1 -1
  122. package/dist/esm/pds-dropdown-menu-separator.entry.js +1 -1
  123. package/dist/esm/pds-dropdown-menu.entry.js +59 -47
  124. package/dist/esm/pds-filter.entry.js +2 -2
  125. package/dist/esm/pds-filters.entry.js +1 -1
  126. package/dist/esm/pds-icon.entry.js +54 -21
  127. package/dist/esm/pds-image.entry.js +1 -1
  128. package/dist/esm/pds-input.entry.js +2 -2
  129. package/dist/esm/pds-link.entry.js +3 -3
  130. package/dist/esm/pds-loader.entry.js +1 -1
  131. package/dist/esm/pds-modal-content.entry.js +1 -1
  132. package/dist/esm/pds-modal-footer.entry.js +1 -1
  133. package/dist/esm/pds-modal-header.entry.js +1 -1
  134. package/dist/esm/pds-modal.entry.js +3 -3
  135. package/dist/esm/pds-multiselect.entry.js +11 -5
  136. package/dist/esm/pds-popover.entry.js +2 -2
  137. package/dist/esm/pds-progress.entry.js +1 -1
  138. package/dist/esm/pds-property.entry.js +1 -1
  139. package/dist/esm/pds-radio-group.entry.js +66 -5
  140. package/dist/esm/pds-radio.entry.js +2 -2
  141. package/dist/esm/pds-row.entry.js +1 -1
  142. package/dist/esm/pds-select.entry.js +2 -2
  143. package/dist/esm/pds-sortable-item.entry.js +2 -2
  144. package/dist/esm/pds-sortable.entry.js +1 -1
  145. package/dist/esm/pds-switch.entry.js +2 -2
  146. package/dist/esm/pds-tab.entry.js +1 -1
  147. package/dist/esm/pds-table-body.entry.js +1 -1
  148. package/dist/esm/pds-table-cell.entry.js +3 -2
  149. package/dist/esm/pds-table-head-cell.entry.js +2 -2
  150. package/dist/esm/pds-table-head.entry.js +1 -1
  151. package/dist/esm/pds-table-row.entry.js +1 -1
  152. package/dist/esm/pds-table.entry.js +1 -1
  153. package/dist/esm/pds-tabpanel.entry.js +1 -1
  154. package/dist/esm/pds-tabs.entry.js +1 -1
  155. package/dist/esm/pds-text.entry.js +29 -3
  156. package/dist/esm/pds-textarea.entry.js +2 -2
  157. package/dist/esm/pds-toast.entry.js +1 -1
  158. package/dist/esm/pds-tooltip.entry.js +16 -5
  159. package/dist/esm/pine-core.js +3 -3
  160. package/dist/esm/portal-target-CKRzRKdO.js +66 -0
  161. package/dist/esm/{tabbable-DCKBKRUy.js → tabbable-C6ZWpp3v.js} +2 -1
  162. package/dist/esm/{truncation-tooltip-D_gvhB9r.js → truncation-tooltip-DBcPipr9.js} +43 -4
  163. package/dist/esm-es5/{index-BFSwd-GQ.js → index-4_RRPJTO.js} +1 -1
  164. package/dist/esm-es5/loader.js +1 -1
  165. package/dist/esm-es5/mock-pds-modal.entry.js +1 -1
  166. package/dist/esm-es5/pds-accordion.entry.js +1 -1
  167. package/dist/esm-es5/pds-alert.entry.js +1 -1
  168. package/dist/esm-es5/pds-avatar.entry.js +1 -1
  169. package/dist/esm-es5/pds-box.entry.js +1 -1
  170. package/dist/esm-es5/pds-button.entry.js +1 -1
  171. package/dist/esm-es5/pds-checkbox.entry.js +1 -1
  172. package/dist/esm-es5/pds-chip.entry.js +1 -1
  173. package/dist/esm-es5/pds-combobox.entry.js +2 -2
  174. package/dist/esm-es5/pds-container.entry.js +1 -1
  175. package/dist/esm-es5/pds-copytext.entry.js +1 -1
  176. package/dist/esm-es5/pds-datepicker.entry.js +1 -1
  177. package/dist/esm-es5/pds-divider.entry.js +1 -1
  178. package/dist/esm-es5/pds-drawer-content.entry.js +1 -1
  179. package/dist/esm-es5/pds-drawer-footer.entry.js +1 -1
  180. package/dist/esm-es5/pds-drawer-header.entry.js +1 -1
  181. package/dist/esm-es5/pds-drawer.entry.js +1 -1
  182. package/dist/esm-es5/pds-dropdown-menu-item.entry.js +1 -1
  183. package/dist/esm-es5/pds-dropdown-menu-separator.entry.js +1 -1
  184. package/dist/esm-es5/pds-dropdown-menu.entry.js +1 -1
  185. package/dist/esm-es5/pds-filter.entry.js +1 -1
  186. package/dist/esm-es5/pds-filters.entry.js +1 -1
  187. package/dist/esm-es5/pds-icon.entry.js +1 -1
  188. package/dist/esm-es5/pds-image.entry.js +1 -1
  189. package/dist/esm-es5/pds-input.entry.js +1 -1
  190. package/dist/esm-es5/pds-link.entry.js +1 -1
  191. package/dist/esm-es5/pds-loader.entry.js +1 -1
  192. package/dist/esm-es5/pds-modal-content.entry.js +1 -1
  193. package/dist/esm-es5/pds-modal-footer.entry.js +1 -1
  194. package/dist/esm-es5/pds-modal-header.entry.js +1 -1
  195. package/dist/esm-es5/pds-modal.entry.js +1 -1
  196. package/dist/esm-es5/pds-multiselect.entry.js +1 -1
  197. package/dist/esm-es5/pds-popover.entry.js +1 -1
  198. package/dist/esm-es5/pds-progress.entry.js +1 -1
  199. package/dist/esm-es5/pds-property.entry.js +1 -1
  200. package/dist/esm-es5/pds-radio-group.entry.js +1 -1
  201. package/dist/esm-es5/pds-radio.entry.js +1 -1
  202. package/dist/esm-es5/pds-row.entry.js +1 -1
  203. package/dist/esm-es5/pds-select.entry.js +1 -1
  204. package/dist/esm-es5/pds-sortable-item.entry.js +1 -1
  205. package/dist/esm-es5/pds-sortable.entry.js +1 -1
  206. package/dist/esm-es5/pds-switch.entry.js +1 -1
  207. package/dist/esm-es5/pds-tab.entry.js +1 -1
  208. package/dist/esm-es5/pds-table-body.entry.js +1 -1
  209. package/dist/esm-es5/pds-table-cell.entry.js +1 -1
  210. package/dist/esm-es5/pds-table-head-cell.entry.js +1 -1
  211. package/dist/esm-es5/pds-table-head.entry.js +1 -1
  212. package/dist/esm-es5/pds-table-row.entry.js +1 -1
  213. package/dist/esm-es5/pds-table.entry.js +1 -1
  214. package/dist/esm-es5/pds-tabpanel.entry.js +1 -1
  215. package/dist/esm-es5/pds-tabs.entry.js +1 -1
  216. package/dist/esm-es5/pds-text.entry.js +1 -1
  217. package/dist/esm-es5/pds-textarea.entry.js +1 -1
  218. package/dist/esm-es5/pds-toast.entry.js +1 -1
  219. package/dist/esm-es5/pds-tooltip.entry.js +1 -1
  220. package/dist/esm-es5/pine-core.js +1 -1
  221. package/dist/esm-es5/portal-target-CKRzRKdO.js +1 -0
  222. package/dist/esm-es5/tabbable-C6ZWpp3v.js +1 -0
  223. package/dist/esm-es5/truncation-tooltip-DBcPipr9.js +1 -0
  224. package/dist/pine-core/{p-7a19477e.system.entry.js → p-01f1cdaf.system.entry.js} +1 -1
  225. package/dist/pine-core/{p-ee449a4b.entry.js → p-07323107.entry.js} +1 -1
  226. package/dist/pine-core/{p-14d872d3.entry.js → p-08b8e941.entry.js} +1 -1
  227. package/dist/pine-core/p-0b7b3fc2.system.entry.js +3 -0
  228. package/dist/pine-core/p-0d5f0ab5.system.entry.js +1 -0
  229. package/dist/pine-core/p-124a0a24.entry.js +1 -0
  230. package/dist/pine-core/p-128c04e7.entry.js +1 -0
  231. package/dist/pine-core/{p-3cc19ea8.system.entry.js → p-1415c988.system.entry.js} +1 -1
  232. package/dist/pine-core/{p-de176bd9.entry.js → p-143b33a6.entry.js} +1 -1
  233. package/dist/pine-core/{p-e9a53a88.system.entry.js → p-14dedf01.system.entry.js} +1 -1
  234. package/dist/pine-core/{p-60d27247.system.entry.js → p-19cf1d91.system.entry.js} +1 -1
  235. package/dist/pine-core/{p-bcf57566.entry.js → p-1ca8d183.entry.js} +1 -1
  236. package/dist/pine-core/{p-11e7d660.entry.js → p-1e3ef425.entry.js} +1 -1
  237. package/dist/pine-core/{p-98cc327b.entry.js → p-1f62bb71.entry.js} +2 -2
  238. package/dist/pine-core/{p-6f34ad9c.entry.js → p-2a18852f.entry.js} +1 -1
  239. package/dist/pine-core/{p-3ce7e72e.system.entry.js → p-2b9622c1.system.entry.js} +1 -1
  240. package/dist/pine-core/{p-9fbcba0d.entry.js → p-2dd30d12.entry.js} +1 -1
  241. package/dist/pine-core/{p-8b97dd57.system.entry.js → p-3306dc5a.system.entry.js} +1 -1
  242. package/dist/pine-core/{p-ce554098.entry.js → p-3610cb3b.entry.js} +1 -1
  243. package/dist/pine-core/{p-079c39d1.entry.js → p-39276663.entry.js} +1 -1
  244. package/dist/pine-core/{p-89fefe36.entry.js → p-39e57657.entry.js} +1 -1
  245. package/dist/pine-core/p-3a1dc752.system.entry.js +1 -0
  246. package/dist/pine-core/{p-ef4d8fea.entry.js → p-3c229091.entry.js} +1 -1
  247. package/dist/pine-core/{p-d8bedb58.system.entry.js → p-3f8bd3fb.system.entry.js} +1 -1
  248. package/dist/pine-core/{p-6845867f.system.entry.js → p-42d43c3f.system.entry.js} +1 -1
  249. package/dist/pine-core/{p-4ee44585.system.entry.js → p-42f70f93.system.entry.js} +1 -1
  250. package/dist/pine-core/{p-0bd61097.system.entry.js → p-4a90b9c8.system.entry.js} +1 -1
  251. package/dist/pine-core/{p-64283f7b.entry.js → p-4cfe922b.entry.js} +1 -1
  252. package/dist/pine-core/p-4d47023c.system.entry.js +1 -0
  253. package/dist/pine-core/{p-b037dcbd.system.entry.js → p-4d98bc0c.system.entry.js} +1 -1
  254. package/dist/pine-core/{p-3556f6ad.entry.js → p-50ddadbf.entry.js} +1 -1
  255. package/dist/pine-core/{p-1e5648bf.system.entry.js → p-548bce53.system.entry.js} +1 -1
  256. package/dist/pine-core/{p-92a8cf7d.entry.js → p-590df41a.entry.js} +1 -1
  257. package/dist/pine-core/{p-f549f2bc.entry.js → p-5946203c.entry.js} +1 -1
  258. package/dist/pine-core/{p-d7db749a.system.entry.js → p-5f181694.system.entry.js} +1 -1
  259. package/dist/pine-core/{p-9713d6a5.system.entry.js → p-60a30975.system.entry.js} +1 -1
  260. package/dist/pine-core/{p-d94ebe84.entry.js → p-61cfdbb2.entry.js} +1 -1
  261. package/dist/pine-core/p-62aa6a78.system.entry.js +1 -0
  262. package/dist/pine-core/p-639acef8.system.entry.js +1 -0
  263. package/dist/pine-core/{p-cb560aab.system.entry.js → p-63f85859.system.entry.js} +1 -1
  264. package/dist/pine-core/{p-001d4b86.entry.js → p-64bcb378.entry.js} +1 -1
  265. package/dist/pine-core/{p-bdde1e53.entry.js → p-67999353.entry.js} +1 -1
  266. package/dist/pine-core/{p-be3b4f12.system.entry.js → p-67f795d5.system.entry.js} +1 -1
  267. package/dist/pine-core/{p-6b6ae1be.entry.js → p-6a1aa8d3.entry.js} +1 -1
  268. package/dist/pine-core/p-6f4ab1ea.system.entry.js +1 -0
  269. package/dist/pine-core/{p-110b4051.system.entry.js → p-724baba3.system.entry.js} +1 -1
  270. package/dist/pine-core/p-72659a0e.system.entry.js +1 -0
  271. package/dist/pine-core/p-7a51f15e.entry.js +1 -0
  272. package/dist/pine-core/p-7b978fff.system.entry.js +1 -0
  273. package/dist/pine-core/p-8436cbfb.entry.js +1 -0
  274. package/dist/pine-core/{p-ced6a814.system.entry.js → p-849ec281.system.entry.js} +1 -1
  275. package/dist/pine-core/p-87a32ded.system.entry.js +1 -0
  276. package/dist/pine-core/{p-f09f27ab.system.entry.js → p-89d38a82.system.entry.js} +1 -1
  277. package/dist/pine-core/{p-6602b4d0.entry.js → p-8ade17ce.entry.js} +1 -1
  278. package/dist/pine-core/{p-ebf0c51b.system.entry.js → p-8afd5f5b.system.entry.js} +1 -1
  279. package/dist/pine-core/{p-9fe4a64a.entry.js → p-8e7f75e6.entry.js} +1 -1
  280. package/dist/pine-core/{p-b9d71b76.entry.js → p-8fb520df.entry.js} +1 -1
  281. package/dist/pine-core/{p-3b5b8f73.entry.js → p-92115e88.entry.js} +1 -1
  282. package/dist/pine-core/{p-239774c9.entry.js → p-947582e1.entry.js} +1 -1
  283. package/dist/pine-core/{p-98843402.system.entry.js → p-94c9b7d1.system.entry.js} +1 -1
  284. package/dist/pine-core/p-97356d4b.entry.js +1 -0
  285. package/dist/pine-core/p-973c3ac0.entry.js +1 -0
  286. package/dist/pine-core/p-97653e60.entry.js +1 -0
  287. package/dist/pine-core/{p-7073146f.entry.js → p-97b73359.entry.js} +1 -1
  288. package/dist/pine-core/{p-bfdfbe9f.entry.js → p-99530cb5.entry.js} +1 -1
  289. package/dist/pine-core/{p-50af67ea.system.entry.js → p-9b32727a.system.entry.js} +1 -1
  290. package/dist/pine-core/{p-CjRCtzPD.system.js → p-BK1sLRfg.system.js} +1 -1
  291. package/dist/pine-core/p-BZVUD2on.js +1 -0
  292. package/dist/pine-core/p-C6ZWpp3v.js +1 -0
  293. package/dist/pine-core/p-CKRzRKdO.js +1 -0
  294. package/dist/pine-core/p-Dj-z_ugg.system.js +1 -0
  295. package/dist/pine-core/{p-BplEmwUQ.js → p-M31tvpDN.js} +2 -2
  296. package/dist/pine-core/p-XK45dzWR.system.js +1 -0
  297. package/dist/pine-core/{p-d9243653.system.entry.js → p-a09c9c5e.system.entry.js} +1 -1
  298. package/dist/pine-core/{p-55fce29e.entry.js → p-a4ce12ef.entry.js} +1 -1
  299. package/dist/pine-core/{p-dea2a254.entry.js → p-a594c41f.entry.js} +1 -1
  300. package/dist/pine-core/{p-2d5b1deb.entry.js → p-a9d96e22.entry.js} +1 -1
  301. package/dist/pine-core/{p-e1fdd53a.system.entry.js → p-ad5208a4.system.entry.js} +1 -1
  302. package/dist/pine-core/p-afc2f165.entry.js +1 -0
  303. package/dist/pine-core/{p-25bf2f26.system.entry.js → p-bcc378ba.system.entry.js} +2 -2
  304. package/dist/pine-core/{p-3f62581a.system.entry.js → p-bd7dc317.system.entry.js} +1 -1
  305. package/dist/pine-core/p-bfa34194.entry.js +1 -0
  306. package/dist/pine-core/{p-5c46553f.system.entry.js → p-c2afe4f3.system.entry.js} +1 -1
  307. package/dist/pine-core/{p-17fc76e7.system.entry.js → p-c5e1eb3c.system.entry.js} +1 -1
  308. package/dist/pine-core/p-c6a9e62c.system.entry.js +1 -0
  309. package/dist/pine-core/{p-7a14473e.entry.js → p-c7a53c4f.entry.js} +1 -1
  310. package/dist/pine-core/{p-5967d9fa.system.entry.js → p-c8a0b562.system.entry.js} +1 -1
  311. package/dist/pine-core/{p-735b3631.entry.js → p-c9ae7964.entry.js} +1 -1
  312. package/dist/pine-core/{p-b243767b.system.entry.js → p-cb9baf78.system.entry.js} +1 -1
  313. package/dist/pine-core/{p-6d64e6c7.entry.js → p-ce9fa14b.entry.js} +1 -1
  314. package/dist/pine-core/{p-68fdfb8f.system.entry.js → p-d018dc60.system.entry.js} +1 -1
  315. package/dist/pine-core/p-d47b2a6a.system.entry.js +1 -0
  316. package/dist/pine-core/{p-0790dd0d.system.entry.js → p-d48fe5a0.system.entry.js} +1 -1
  317. package/dist/pine-core/{p-414faecf.entry.js → p-d6f338e0.entry.js} +1 -1
  318. package/dist/pine-core/{p-b7cbd913.system.entry.js → p-d920d759.system.entry.js} +1 -1
  319. package/dist/pine-core/{p-87642228.entry.js → p-d9719e37.entry.js} +1 -1
  320. package/dist/pine-core/p-da8b864a.entry.js +2 -0
  321. package/dist/pine-core/{p-f2c487e6.entry.js → p-db7fb5a3.entry.js} +1 -1
  322. package/dist/pine-core/p-dd7ded84.entry.js +1 -0
  323. package/dist/pine-core/p-de455073.system.entry.js +1 -0
  324. package/dist/pine-core/{p-a7d25143.entry.js → p-e1d1b5d8.entry.js} +1 -1
  325. package/dist/pine-core/p-e3de6a1d.entry.js +1 -0
  326. package/dist/pine-core/{p-2c0047cd.entry.js → p-e7002cee.entry.js} +1 -1
  327. package/dist/pine-core/{p-5133e8be.system.entry.js → p-e82f758f.system.entry.js} +1 -1
  328. package/dist/pine-core/p-e84fa9ed.entry.js +1 -0
  329. package/dist/pine-core/{p-9dbc017f.system.entry.js → p-eb4f0daa.system.entry.js} +1 -1
  330. package/dist/pine-core/p-eb56af4a.system.entry.js +1 -0
  331. package/dist/pine-core/p-eeYeEogd.system.js +1 -0
  332. package/dist/pine-core/{p-b33ad96e.system.entry.js → p-eecd9ad8.system.entry.js} +1 -1
  333. package/dist/pine-core/{p-06279b93.system.entry.js → p-ef0eba9b.system.entry.js} +1 -1
  334. package/dist/pine-core/{p-0c60f577.system.entry.js → p-ef3a855f.system.entry.js} +1 -1
  335. package/dist/pine-core/{p-6dad76cb.system.entry.js → p-f11cce27.system.entry.js} +1 -1
  336. package/dist/pine-core/p-f354dbac.entry.js +1 -0
  337. package/dist/pine-core/{p-bda7e3be.entry.js → p-f6f4fd42.entry.js} +1 -1
  338. package/dist/pine-core/{p-7fcf3d37.entry.js → p-f71d71ca.entry.js} +1 -1
  339. package/dist/pine-core/p-f834cb07.system.entry.js +1 -0
  340. package/dist/pine-core/p-f9063262.system.entry.js +1 -0
  341. package/dist/pine-core/p-f99bd77f.entry.js +1 -0
  342. package/dist/pine-core/p-wB2y8gR7.system.js +1 -0
  343. package/dist/pine-core/pine-core.esm.js +1 -1
  344. package/dist/pine-core/pine-core.js +1 -1
  345. package/dist/types/components/pds-combobox/combobox-interface.d.ts +26 -0
  346. package/dist/types/components/pds-combobox/grouped-options-panel.d.ts +17 -0
  347. package/dist/types/components/pds-combobox/pds-combobox.d.ts +12 -2
  348. package/dist/types/components/pds-datepicker/calendar-portal.d.ts +0 -7
  349. package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu.d.ts +4 -0
  350. package/dist/types/components/pds-radio-group/pds-radio-group.d.ts +8 -0
  351. package/dist/types/components/pds-text/pds-text.d.ts +4 -0
  352. package/dist/types/components/pds-tooltip/pds-tooltip.d.ts +1 -0
  353. package/dist/types/components.d.ts +2 -2
  354. package/dist/types/utils/portal-target.d.ts +17 -0
  355. package/dist/types/utils/truncation-tooltip.d.ts +5 -2
  356. package/dist/vscode.html-data.json +3 -3
  357. package/hydrate/index.js +422 -146
  358. package/hydrate/index.mjs +422 -146
  359. package/package.json +2 -2
  360. package/dist/esm-es5/tabbable-DCKBKRUy.js +0 -1
  361. package/dist/esm-es5/truncation-tooltip-D_gvhB9r.js +0 -1
  362. package/dist/pine-core/p-07b4524e.entry.js +0 -1
  363. package/dist/pine-core/p-08bbd3e6.system.entry.js +0 -1
  364. package/dist/pine-core/p-22ae92f7.system.entry.js +0 -1
  365. package/dist/pine-core/p-272b24ad.system.entry.js +0 -1
  366. package/dist/pine-core/p-38b87aa2.system.entry.js +0 -1
  367. package/dist/pine-core/p-3afb1208.entry.js +0 -1
  368. package/dist/pine-core/p-463a29fa.entry.js +0 -1
  369. package/dist/pine-core/p-568a9a79.system.entry.js +0 -1
  370. package/dist/pine-core/p-5ce5836e.system.entry.js +0 -1
  371. package/dist/pine-core/p-5f3242c8.system.entry.js +0 -1
  372. package/dist/pine-core/p-60e3b1af.entry.js +0 -1
  373. package/dist/pine-core/p-7d3a20ba.entry.js +0 -1
  374. package/dist/pine-core/p-9201b497.system.entry.js +0 -1
  375. package/dist/pine-core/p-94597b73.entry.js +0 -1
  376. package/dist/pine-core/p-97be00f4.system.entry.js +0 -1
  377. package/dist/pine-core/p-9a8971e2.system.entry.js +0 -1
  378. package/dist/pine-core/p-9a8d2985.system.entry.js +0 -3
  379. package/dist/pine-core/p-CirzxZ33.js +0 -1
  380. package/dist/pine-core/p-D52aRqFx.system.js +0 -1
  381. package/dist/pine-core/p-DCKBKRUy.js +0 -1
  382. package/dist/pine-core/p-DXO1yd32.system.js +0 -1
  383. package/dist/pine-core/p-a2078add.entry.js +0 -1
  384. package/dist/pine-core/p-a48b025a.system.entry.js +0 -1
  385. package/dist/pine-core/p-ad3b1ec3.entry.js +0 -1
  386. package/dist/pine-core/p-b017eb99.system.entry.js +0 -1
  387. package/dist/pine-core/p-b6edfdfe.entry.js +0 -2
  388. package/dist/pine-core/p-c02a32ec.entry.js +0 -1
  389. package/dist/pine-core/p-c1da80e5.entry.js +0 -1
  390. package/dist/pine-core/p-c233866c.system.entry.js +0 -1
  391. package/dist/pine-core/p-d7930540.entry.js +0 -1
  392. package/dist/pine-core/p-dfadfcd1.entry.js +0 -1
  393. package/dist/pine-core/p-e70cb112.system.entry.js +0 -1
  394. package/dist/pine-core/p-eb93cc6e.entry.js +0 -1
  395. package/dist/pine-core/p-ebf74c43.system.entry.js +0 -1
  396. package/dist/pine-core/p-fc743f6e.entry.js +0 -1
  397. package/dist/pine-core/p-wXfuz0Bd.system.js +0 -1
  398. /package/dist/esm-es5/{index-m3pqpeWg.js → index-DvN3tyZp.js} +0 -0
  399. /package/dist/pine-core/{p-m3pqpeWg.js → p-DvN3tyZp.js} +0 -0
  400. /package/dist/pine-core/{p-DaCT2ssj.system.js → p-vFsJv75D.system.js} +0 -0
@@ -1 +1 @@
1
- import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,Host as r,transformTag as n}from"@stencil/core/internal/client";import{a,c as o,o as d,f as l,b as c,s as h,h as p}from"./floating-ui.dom.js";import{f as u,j as v,k as m,m as b,r as f,n as g}from"./index2.js";import{i as k}from"./form.js";import{r as _,f as y}from"./i18n-format.js";import{c as x}from"./closest.js";import{d as w}from"./pds-icon2.js";import{d as D}from"./pds-input2.js";const M=/^(\d{4})-(\d{2})-(\d{2})$/;function C(e){const t=M.exec((null!=e?e:"").trim());if(!t)return null;const[,i,s,r]=t.map(Number),n=new Date(Date.UTC(i,s-1,r));return n.getUTCFullYear()===i&&n.getUTCMonth()===s-1&&n.getUTCDate()===r?n:null}function $(e){return e.toISOString().slice(0,10)}function A(){const e=new Date;return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))}function T(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function L(e,t){const i=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1)),s=j(i.getUTCFullYear(),i.getUTCMonth());return new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),Math.min(e.getUTCDate(),s)))}function j(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function P(e,t){return!!e&&!!t&&e.getTime()===t.getTime()}function H(e,t,i){return t&&e<t?t:i&&e>i?i:e}function Y(e,t,i){return!!t&&e<t||!!i&&e>i}function E(e,t){return(e.getUTCDay()-t+7)%7}function z(e,t){return new Intl.DateTimeFormat(e,Object.assign(Object.assign({},t),{timeZone:"UTC",calendar:"gregory"}))}function S(e,t,i){return z(t,i).format(e)}class N{constructor(e){this.datepicker=e,this.copiedProperties=[],this.host=document.createElement("div"),this.host.className=N.className,this.host.pdsDatepicker=e,this.host.style.display="contents",this.root=this.host.attachShadow({mode:"open"})}mount(e,t){this.host.isConnected?t!==this.locale&&this.copyContext(t):(function(e){const t=new Set;let i=e;for(;i&&!t.has(i);){if(t.add(i),i.nodeType===Node.ELEMENT_NODE&&F(i))return i;const e=i.nodeType===Node.ELEMENT_NODE?i.assignedSlot:null;if(e){i=e;continue}const s=i.parentNode;i=s instanceof ShadowRoot?s.host:s}return document.body}(this.datepicker).appendChild(this.host),this.copyContext(t)),e.parentNode!==this.root&&this.root.appendChild(e)}remove(){this.host.remove()}contains(e){return!!e&&(e===this.host||this.root.contains(e))}copyContext(e){var t,i;this.locale=e;const s=this.datepicker.shadowRoot;s&&((null===(t=s.adoptedStyleSheets)||void 0===t?void 0:t.length)?this.root.adoptedStyleSheets=s.adoptedStyleSheets:this.root.querySelector("style")||s.querySelectorAll("style").forEach((e=>this.root.appendChild(e.cloneNode(!0)))));const r=getComputedStyle(this.datepicker);this.host.dir=r.direction||"ltr",this.host.lang=e,this.copyCustomProperties(r);const n=null===(i=x("[data-theme]",this.datepicker)||null)||void 0===i?void 0:i.getAttribute("data-theme");n?this.host.setAttribute("data-theme",n):this.host.removeAttribute("data-theme")}copyCustomProperties(e){for(const e of this.copiedProperties)this.host.style.removeProperty(e);this.copiedProperties=[];const t=this.host.parentElement,i=t?getComputedStyle(t):null;for(let t=0;t<e.length;t++){const s=e[t];if(!s.startsWith("--"))continue;const r=e.getPropertyValue(s);i&&r===i.getPropertyValue(s)||(this.host.style.setProperty(s,r.trim()),this.copiedProperties.push(s))}}}function F(e){if("dialog"===e.localName)return e.open;if(!e.hasAttribute("popover"))return!1;try{return e.matches(":popover-open")}catch(e){return!1}}N.className="pds-datepicker-calendar-portal";const U={today:"Today",yesterday:"Yesterday","last-7-days":"Last 7 days","last-30-days":"Last 30 days","last-90-days":"Last 90 days","this-month":"This month","last-month":"Last month","this-quarter":"This quarter","last-quarter":"Last quarter","this-year":"This year","last-year":"Last year","year-to-date":"Year to date","last-12-months":"Last 12 months"},O=(e,t,i)=>new Date(Date.UTC(e,t,i));function q(e,t){const i=t.getUTCFullYear(),s=t.getUTCMonth(),r=s-s%3;switch(e){case"today":return[t,t];case"yesterday":return[T(t,-1),T(t,-1)];case"last-7-days":return[T(t,-6),t];case"last-30-days":return[T(t,-29),t];case"last-90-days":return[T(t,-89),t];case"this-month":return[O(i,s,1),O(i,s+1,0)];case"last-month":return[O(i,s-1,1),O(i,s,0)];case"this-quarter":return[O(i,r,1),O(i,r+3,0)];case"last-quarter":return[O(i,r-3,1),O(i,r,0)];case"this-year":return[O(i,0,1),O(i,11,31)];case"last-year":return[O(i-1,0,1),O(i-1,11,31)];case"year-to-date":return[O(i,0,1),t];case"last-12-months":return[L(t,-12),t];default:return null}}function I(e,t,i){if(t&&i)return e.find((e=>e.start.getTime()===t.getTime()&&e.end.getTime()===i.getTime()))}function R(e,t,i){return!Y(e.start,t,i)&&!Y(e.end,t,i)}const W=/^(\d{4}-\d{2}-\d{2})(?:[T ](\d{2}):(\d{2}))?$/;function K(e){const t=W.exec((null!=e?e:"").trim());if(!t)return null;const i=C(t[1]);return i?void 0===t[2]?{date:i,time:null}:Number(t[2])<24&&Number(t[3])<60?{date:i,time:`${t[2]}:${t[3]}`}:null:null}const V="YYYY-MM-DD",X=/\[([^\]]*)\]|YYYY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|A|a/g,Z=/HH|H|hh|h/,B=/hh|h/,G=/A|a/;function J(e,t,i=!1){const s=(null==e?void 0:e.trim())||V,r=(e=>e.replace(/\[[^\]]*\]/g,""))(s);return B.test(r)&&!G.test(r)?s+" A":!t||Z.test(r)?s:`${s} ${i?"h:mm A":"HH:mm"}`}const Q=(e,t=2)=>(e+"").padStart(t,"0"),ee=new Map;function te(e){let t=ee.get(e);if(!t){const i=t=>{const i=new Intl.DateTimeFormat(e,{month:t,timeZone:"UTC",calendar:"gregory"});return Array.from({length:12},((e,t)=>i.format(new Date(Date.UTC(2023,t,1)))))},s=ue(e);t={months:i("long"),shortMonths:i("short"),am:s.am,pm:s.pm},ee.set(e,t)}return t}const ie=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),se=e=>ie(e).replace(/\s+/g,"\\s*"),re=e=>`(${e.map(ie).join("|")})`;function ne(e,t=V,i="en-US"){var s;return null!==(s=function(e,t,i="en-US"){var s,r,n,a,o,d,l,c,h,p;const u=te(i),v=te("en-US"),m=[u.am,u.pm,v.am,v.pm],b={YYYY:"(\\d{4})",MMMM:re([...u.months,...v.months]),MMM:re([...u.shortMonths,...v.shortMonths]),MM:"(\\d{1,2})",M:"(\\d{1,2})",DD:"(\\d{1,2})",D:"(\\d{1,2})",HH:"(\\d{1,2})",H:"(\\d{1,2})",hh:"(\\d{1,2})",h:"(\\d{1,2})",mm:"(\\d{2})",A:re(m),a:re(m)},f=[],g=()=>{f.length=0;let e="",i=0;return t.replace(X,((s,r,n)=>(e+=se(t.slice(i,n)),void 0!==r?e+=se(r):(e+=b[s],f.push(s)),i=n+s.length,s))),RegExp(`^\\s*${e}${se(t.slice(i))}\\s*$`,"i")};let k=g().exec(null!=e?e:"");if(k||(b.mm="(\\d{1,2})",k=g().exec(null!=e?e:"")),!k)return null;const _=k,y={};f.forEach(((e,t)=>y[e]=_[t+1]));const x=(e,t)=>{if(void 0===e)return;const i=t?[u.months,v.months]:[u.shortMonths,v.shortMonths];for(const t of i){const i=t.findIndex((t=>t.toLowerCase()===e.toLowerCase()));if(i>=0)return i+1}},w=Number(y.YYYY),D=null!==(r=null!==(s=x(y.MMMM,!0))&&void 0!==s?s:x(y.MMM,!1))&&void 0!==r?r:Number(null!==(n=y.MM)&&void 0!==n?n:y.M),M=Number(null!==(a=y.DD)&&void 0!==a?a:y.D);if(!y.YYYY||!D||!M)return null;const $=C(`${Q(w,4)}-${Q(D)}-${Q(M)}`);if(!$)return null;const A=null!==(l=null!==(d=null!==(o=y.HH)&&void 0!==o?o:y.H)&&void 0!==d?d:y.hh)&&void 0!==l?l:y.h;if(void 0===A)return{date:$,time:null};let T=Number(A);const L=Number(null!==(c=y.mm)&&void 0!==c?c:0),j=null===(p=null!==(h=y.A)&&void 0!==h?h:y.a)||void 0===p?void 0:p.toLowerCase();if(void 0!==y.hh||void 0!==y.h){if(T<1||T>12)return null;T=T%12+(j===u.pm.toLowerCase()||j===v.pm.toLowerCase()?12:0)}return T<24&&L<60?{date:$,time:pe(T,L)}:null}(e,t,i))&&void 0!==s?s:K(e)}function ae(e,t=V,i="en-US"){const s=(null!=e?e:"").trim(),r=RegExp(`${ie(ce)}|\\s+(?:–|—|-|to)\\s+${t.includes("/")?"":"|\\s*/\\s*"}`,"gi");let n;for(;null!==(n=r.exec(s));){const e=ne(s.slice(0,n.index),t,i),r=ne(s.slice(n.index+n[0].length),t,i);if(e&&r)return oe(e,r)<=0?[e,r]:null}return null}function oe(e,t){var i,s;const r=e.date.getTime()-t.date.getTime();return 0!==r?r:(null!==(i=e.time)&&void 0!==i?i:"00:00").localeCompare(null!==(s=t.time)&&void 0!==s?s:"00:00")}function de(e){return e.time?`${$(e.date)}T${e.time}`:$(e.date)}function le(e,t,i="en-US"){return function(e,t,i="en-US"){var s;const r=te(i),[n,a]=he(null!==(s=e.time)&&void 0!==s?s:"00:00"),o=n%12||12,d=e.date.getUTCMonth(),l=n<12?r.am:r.pm,c={YYYY:Q(e.date.getUTCFullYear(),4),MMMM:r.months[d],MMM:r.shortMonths[d],MM:Q(d+1),M:d+1+"",DD:Q(e.date.getUTCDate()),D:e.date.getUTCDate()+"",HH:Q(n),H:n+"",hh:Q(o),h:o+"",mm:Q(a),A:l,a:l.toLowerCase()};return t.replace(X,((e,t)=>null!=t?t:c[e]))}(e,null!=t?t:J(V,!!e.time),i)}const ce=" – ";function he(e){const[t,i]=e.split(":").map(Number);return[t||0,i||0]}function pe(e,t){return`${(e+"").padStart(2,"0")}:${(t+"").padStart(2,"0")}`}function ue(e){var t,i;const s=new Intl.DateTimeFormat(e,{hour:"numeric",timeZone:"UTC"}),r=e=>{var t;return null===(t=s.formatToParts(new Date(Date.UTC(2023,0,1,e))).find((e=>"dayPeriod"===e.type)))||void 0===t?void 0:t.value};return{hour12:!!s.resolvedOptions().hour12,am:null!==(t=r(1))&&void 0!==t?t:"AM",pm:null!==(i=r(13))&&void 0!==i?i:"PM"}}const ve={weekday:"long",year:"numeric",month:"long",day:"numeric"},me="00:00",be="23:59";let fe=0;const ge=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),ke=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.pdsDatepickerChange=i(this,"pdsDatepickerChange",7),this.pdsBlur=i(this,"pdsBlur",7),this.pdsFocus=i(this,"pdsFocus",7),this.focusActiveDay=!1,this.fallbackId="pds-datepicker-"+ ++fe,this.skipForwardedClick=!1,this.presetByArrow=!1,this.valueAtOpen="",this.committing=!1,this.hasFocus=!1,this.applyLabel="Apply",this.autoApply=!1,this.cancelLabel="Cancel",this.clearable=!1,this.clearLabel="Clear",this.customRangeLabel="Custom range",this.endTimeLabel="End time",this.format="YYYY-MM-DD",this.hourLabel="Hour",this.invalidDateMessage="Enter a date in the format shown.",this.maxDateMessage="Choose {date} or earlier.",this.minDateMessage="Choose {date} or later.",this.minuteIncrement=1,this.minuteLabel="Minute",this.monthLabel="Month",this.nextMonthLabel="Next month",this.periodLabel="AM or PM",this.placement="bottom-start",this.presetsLabel="Presets",this.previousMonthLabel="Previous month",this.range=!1,this.showDropdowns=!1,this.startTimeLabel="Start time",this.timePicker=!1,this.timeLabel="Time",this.triggerLabel="Choose date",this.value="",this.yearLabel="Year",this.isOpen=!1,this.text="",this.textError="",this.activeDate="",this.viewMonth="",this.draftStart="",this.draftEnd="",this.startTime=me,this.endTime=be,this.previewDate="",this.onApply=()=>{const e=this.draftParts();e&&(this.commitParts(e),this.closeCalendar(!0))},this.onCancel=()=>{this.clearable?this.commitValue(""):this.restoreValueAtOpen(),this.closeCalendar(!0)},this.onPresetClick=(e,t)=>{this.draftStart=$(t.start),this.draftEnd=$(t.end),this.previewDate="",!this.appliesOnPick||this.presetByArrow?(this.showDate(t.end,!0),e.currentTarget.focus()):this.onApply()},this.onPresetsKeyDown=e=>{const t={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1}[e.key],i={Home:"first",End:"last"}[e.key];if(!t&&!i)return;const s=Array.from(e.currentTarget.querySelectorAll('[role="radio"]:not([disabled])')),r=s.indexOf(e.target),n="first"===i?s[0]:"last"===i?s[s.length-1]:s[(r+t+s.length)%s.length];n&&(e.preventDefault(),n.focus(),n.classList.contains("pds-datepicker__preset")&&n!==s[s.length-1]&&(this.presetByArrow=!0,n.click(),this.presetByArrow=!1))},this.onClearMouseDown=e=>{e.preventDefault()},this.onClearClick=()=>{var e;this.commitValue(""),this.closeCalendar(!1),null===(e=this.inputEl)||void 0===e||e.setFocus()},this.onCustomRangeClick=()=>{var e,t;null===(t=null===(e=this.dialogEl)||void 0===e?void 0:e.querySelector('[data-date][tabindex="0"]'))||void 0===t||t.focus()},this.onDocumentPointerDown=e=>{var t;const i=e.composedPath();i.includes(this.el)||this.portal&&i.includes(this.portal.host)||(this.closeCalendar(!1),"dialog"===(null===(t=i[0])||void 0===t?void 0:t.localName)&&function(){const e=e=>{e.stopPropagation(),e.preventDefault()};document.addEventListener("click",e,{capture:!0,once:!0}),window.setTimeout((()=>document.removeEventListener("click",e,{capture:!0})),500)}())},this.onHostFocusIn=e=>{this.focusEntered(e)},this.onCalendarFocusIn=e=>{var t,i;this.focusEntered(e),null===(t=this.dialogEl)||void 0===t||t.setAttribute("aria-modal","true"),e.target===this.dialogEl&&(null===(i=this.dialogEl.querySelector(`[data-date="${this.activeDate}"]`))||void 0===i||i.focus({preventScroll:!0}))},this.onCalendarFocusOut=e=>{var t,i;const s=e.relatedTarget;s&&(null===(t=this.dialogEl)||void 0===t?void 0:t.contains(s))||null===(i=this.dialogEl)||void 0===i||i.removeAttribute("aria-modal"),this.checkFocusLeft(e,null!==s)},this.onHostFocusOut=e=>{const t=e.relatedTarget;t&&this.isInside(t)||this.checkFocusLeft(e,null!==t)},this.stopInnerEvent=e=>e.stopPropagation(),this.onFieldClick=e=>{var t,i;const s=e.composedPath();if(this.triggerEl&&s.includes(this.triggerEl)||this.clearEl&&s.includes(this.clearEl))return;const r=null===(i=null===(t=this.inputEl)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("label");if(r&&s.includes(r))return this.skipForwardedClick=!0,void window.setTimeout((()=>this.skipForwardedClick=!1));if(this.skipForwardedClick)return void(this.skipForwardedClick=!1);const n=this.fieldReference();n&&n!==this.inputEl&&!s.includes(n)||this.openCalendar(!1)},this.onTextInput=e=>{var t,i;if(e.stopPropagation(),this.text=(null!==(t=e.detail.value)&&void 0!==t?t:"")+"",!this.isOpen)return;const s=this.parseText(this.text);if(!s)return;const[r,n]=[this.startTime,this.endTime];if(null!==(i=this.timesBeforeTyping)&&void 0!==i||(this.timesBeforeTyping=[r,n]),this.loadDraft(s),this.timePicker){const e=this.resolvedFormat,t=this.resolvedLocale,i=this.range?ae(this.text,e,t):[ne(this.text,e,t)],s=this.parsedValue(),a=e=>{var t,r,n;return!(null===(t=null==i?void 0:i[e])||void 0===t?void 0:t.time)||(null===(r=i[e])||void 0===r?void 0:r.time)===(null===(n=null==s?void 0:s[e])||void 0===n?void 0:n.time)};a(0)&&(this.startTime=r),this.range&&a(1)&&(this.endTime=n)}this.showDate(s[s.length-1].date)},this.onTextChange=e=>{e.stopPropagation(),this.isOpen&&this.hasFooter?window.setTimeout((()=>{var e;this.isOpen&&(this.el.matches(":focus-within")||(null===(e=this.portal)||void 0===e?void 0:e.host.matches(":focus-within")))||this.commitPendingText()})):this.commitText()},this.onTextKeyDown=e=>{e.stopPropagation();const t=e.detail;if(t.altKey&&"ArrowDown"===t.key)t.preventDefault(),this.isOpen?(this.focusActiveDay=!0,this.flushActiveDayFocus()):this.openCalendar(!0);else if("Enter"===t.key&&this.isOpen){if(!this.hasFooter||this.text!==this.fieldText()&&!this.parseText(this.text))this.commitText();else{const e=this.draftParts();e&&this.commitParts(e)}this.textError||this.closeCalendar(!1)}else"Escape"===t.key&&this.isOpen&&(t.preventDefault(),t.stopPropagation(),this.restoreValueAtOpen(),this.closeCalendar(!1))},this.onTriggerKeyDown=e=>{var t;if(this.isOpen)return"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.restoreValueAtOpen(),void this.closeCalendar(!1)):void("Tab"!==e.key||e.shiftKey||"visible"!==(null===(t=this.dialogEl)||void 0===t?void 0:t.style.visibility)||(e.preventDefault(),this.focusActiveDay=!0,this.flushActiveDayFocus()))},this.onTriggerClick=()=>{this.isOpen?this.closeCalendar(!0):this.openCalendar(!0)},this.onDialogKeyDown=e=>{"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.restoreValueAtOpen(),this.closeCalendar(!0)):"Tab"===e.key&&this.trapTab(e)},this.onGridKeyDown=e=>{const t=C(this.activeDate);if(!t)return;const i="rtl"===getComputedStyle(this.el).direction,s=E(t,this.weekStart);let r=null;switch(e.key){case"ArrowLeft":r=T(t,i?1:-1);break;case"ArrowRight":r=T(t,i?-1:1);break;case"ArrowUp":r=T(t,-7);break;case"ArrowDown":r=T(t,7);break;case"Home":r=T(t,-s);break;case"End":r=T(t,6-s);break;case"PageUp":r=L(t,e.shiftKey?-12:-1);break;case"PageDown":r=L(t,e.shiftKey?12:1);break;case"Enter":case" ":return e.preventDefault(),this.pickDate(t),void(this.hasFooter&&(this.focusActiveDay=!0));default:return}e.preventDefault();const n=H(r,this.minDate,this.maxDate);this.showDate(n),this.range&&(this.previewDate=$(n)),this.focusActiveDay=!0},this.onGridClick=e=>{const t=this.dayFromEvent(e);t&&this.pickDate(t)},this.onGridPointerOver=e=>{if(!this.range||!this.draftStart||this.draftEnd)return;const t=this.dayFromEvent(e),i=t&&$(t);i&&i!==this.previewDate&&(this.previewDate=i)}}async open(){this.openCalendar(!0)}async close(){this.closeCalendar(!1)}async setFocus(){var e;await(null===(e=this.inputEl)||void 0===e?void 0:e.setFocus())}valueChanged(){var e;this.committing||(this.valueAtOpen=null!==(e=this.value)&&void 0!==e?e:""),this.refreshFromValue()}contextChanged(){this.refreshFromValue()}placementChanged(){this.stopPositioning()}refreshFromValue(){var e;if(this.text=this.fieldText(),this.textError="",this.updateFormValue(),!this.isOpen)return;const t=this.parsedValue();this.loadDraft(t);const i=null!==(e=t&&t[t.length-1].date)&&void 0!==e?e:A();this.showDate(H(i,this.minDate,this.maxDate),!0)}requiredChanged(){this.updateFormValue()}componentWillLoad(){this.text=this.fieldText()}connectedCallback(){this.el.attachInternals&&!this.internals&&(this.internals=this.el.attachInternals())}componentDidLoad(){this.updateFormValue()}disconnectedCallback(){var e;this.closeCalendar(!1),null===(e=this.portal)||void 0===e||e.remove()}componentDidRender(){var e,t;this.isOpen&&this.dialogEl?(null!==(t=this.portal)&&void 0!==t||(this.portal=new N(this.el)),this.portal.mount(this.dialogEl,this.resolvedLocale),this.cleanupAutoUpdate||this.startPositioning(),this.flushActiveDayFocus()):null===(e=this.portal)||void 0===e||e.remove()}flushActiveDayFocus(){var e,t;this.focusActiveDay&&"visible"===(null===(e=this.dialogEl)||void 0===e?void 0:e.style.visibility)&&(this.focusActiveDay=!1,null===(t=this.dialogEl.querySelector(`[data-date="${this.activeDate}"]`))||void 0===t||t.focus())}get baseId(){return this.componentId||this.fallbackId}get resolvedLocale(){return function(e){var t;try{return null!==(t=Intl.DateTimeFormat.supportedLocalesOf(e)[0])&&void 0!==t?t:"en-US"}catch(e){return"en-US"}}(this.locale||_(this.el))}get weekStart(){const e=this.firstDayOfWeek;return"number"==typeof e&&Number.isInteger(e)&&e>=0&&e<=6?e:function(e){var t,i,s;const r=Intl.Locale;if(!r)return 0;try{const n=new r(e),a=null!==(i=null===(t=n.getWeekInfo)||void 0===t?void 0:t.call(n).firstDay)&&void 0!==i?i:null===(s=n.weekInfo)||void 0===s?void 0:s.firstDay;return"number"==typeof a?a%7:0}catch(e){return 0}}(this.resolvedLocale)}get minDate(){return C(this.min)}get maxDate(){return C(this.max)}get isInteractive(){return!this.disabled&&!this.readonly}get monthCount(){const e="undefined"!=typeof window&&window.innerWidth<640;return this.range&&!e?2:1}get appliesOnPick(){return this.range&&this.autoApply&&!this.timePicker}get hasFooter(){return(this.range||this.timePicker)&&!this.appliesOnPick}get resolvedPresets(){return this.range?function(e,t){const i="string"==typeof e?e.split(",").map((e=>e.trim())).filter(Boolean).map((e=>({key:e}))):Array.isArray(e)?e:[],s=[];for(const e of i){if(!e||"string"!=typeof e.key)continue;const i="string"==typeof e.start?C(e.start):null,r="string"==typeof e.end?C(e.end):null,n=i&&r&&i<=r?[i,r]:q(e.key,t),a="string"==typeof e.label?e.label:U[e.key];n&&a&&s.push({key:e.key,label:a,start:n[0],end:n[1]})}return s}(this.presets,A()):[]}parsedValue(e=this.value){if(this.range){const[t,i,s]=(null!=e?e:"").split("/"),r=K(t),n=K(i);return void 0===s&&r&&n&&oe(r,n)<=0?[r,n]:null}const t=K(e);return t?[t]:null}get resolvedFormat(){return J(this.format,this.timePicker,this.timePicker&&ue(this.resolvedLocale).hour12)}fieldText(){var e;const t=this.parsedValue();return t?t.map((e=>le(this.withTimePicker(e),this.resolvedFormat,this.resolvedLocale))).join(ce):null!==(e=this.value)&&void 0!==e?e:""}withTimePicker(e,t=me){var i;return{date:e.date,time:this.timePicker?null!==(i=e.time)&&void 0!==i?i:t:null}}get fieldPlaceholder(){if(this.placeholder)return this.placeholder;const e=this.resolvedFormat;return this.range?`${e}${ce}${e}`:e}loadDraft(e){var t,i;const[s,r]=null!=e?e:[];this.draftStart=s?$(s.date):"",this.draftEnd=this.range&&r?$(r.date):"",this.startTime=null!==(t=null==s?void 0:s.time)&&void 0!==t?t:me,this.endTime=null!==(i=null==r?void 0:r.time)&&void 0!==i?i:be,this.previewDate=""}openCalendar(e){var t,i;if(!this.isInteractive||this.isOpen)return;const s=this.parsedValue();this.loadDraft(s),this.valueAtOpen=null!==(t=this.value)&&void 0!==t?t:"";const r=null!==(i=s&&s[s.length-1].date)&&void 0!==i?i:A();this.showDate(H(r,this.minDate,this.maxDate),!0),this.focusActiveDay=e,this.isOpen=!0,document.addEventListener("pointerdown",this.onDocumentPointerDown,!0)}closeCalendar(e){var t;this.isOpen&&(this.commitPendingText(),this.timesBeforeTyping=void 0,this.isOpen=!1,this.stopPositioning(),document.removeEventListener("pointerdown",this.onDocumentPointerDown,!0),e&&(null===(t=this.triggerEl)||void 0===t||t.focus()))}showDate(e,t=!1){const i=ge(e),s=C(this.viewMonth),r=s&&L(s,this.monthCount-1);t||!s||i<s?this.viewMonth=$(t?L(i,1-this.monthCount):i):r&&i>r&&(this.viewMonth=$(L(i,1-this.monthCount))),this.activeDate=$(e)}pickDate(e){Y(e,this.minDate,this.maxDate)||(this.dropTypedText(),this.range?this.pickRangeDay(e):this.timePicker?(this.draftStart=$(e),this.activeDate=this.draftStart):(this.commitValue($(e)),this.closeCalendar(!0)))}pickRangeDay(e){const t=C(this.draftStart),i=$(e);!t||this.draftEnd?(this.draftStart=i,this.draftEnd=""):e<t?this.draftStart=i:this.draftEnd=i,this.previewDate="",this.activeDate=i,this.draftEnd&&this.appliesOnPick&&this.onApply()}commitValue(e,t={}){var i;const s=e!==(null!==(i=this.value)&&void 0!==i?i:"");this.timesBeforeTyping=void 0,this.committing=!0,this.value=e,this.committing=!1,this.text=this.fieldText(),this.textError="",this.updateFormValue(),s&&this.pdsDatepickerChange.emit(Object.assign({value:e},t))}commitParts(e){if(!this.range)return void this.commitValue(de(e[0]));const[t,i]=e,s=I(this.resolvedPresets,t.date,i.date);this.commitValue(`${de(t)}/${de(i)}`,Object.assign({start:de(t),end:de(i)},s?{preset:s.key}:{}))}draftParts(){var e;const t=C(this.draftStart);if(!t)return null;const i=this.withTimePicker({date:t,time:this.startTime});if(!this.range)return[i];const s=this.withTimePicker({date:null!==(e=C(this.draftEnd))&&void 0!==e?e:t,time:this.endTime});return[i,oe(s,i)<0?Object.assign(Object.assign({},s),{time:i.time}):s]}restoreValueAtOpen(){var e;if(this.valueAtOpen===(null!==(e=this.value)&&void 0!==e?e:""))return void this.dropTypedText();const t=this.parsedValue(this.valueAtOpen);t?this.commitParts(t):this.commitValue(this.valueAtOpen)}isInside(e){var t,i;return!!e&&(e===this.el||this.el.contains(e)||!!(null===(t=this.el.shadowRoot)||void 0===t?void 0:t.contains(e))||!!(null===(i=this.portal)||void 0===i?void 0:i.contains(e)))}focusEntered(e){this.hasFocus||(this.hasFocus=!0,this.pdsFocus.emit(e))}checkFocusLeft(e,t){window.setTimeout((()=>{var i;this.el.matches(":focus-within")||(null===(i=this.portal)||void 0===i?void 0:i.host.matches(":focus-within"))||(t&&this.closeCalendar(!1),this.hasFocus&&(this.hasFocus=!1,this.pdsBlur.emit(e)))}))}startPositioning(){const e=this.fieldReference(),t=this.dialogEl;e&&t&&(this.cleanupAutoUpdate=a(e,t,(()=>{o(e,t,{placement:this.placement,strategy:"fixed",middleware:[d(4),l({padding:8}),c({padding:8,apply({availableWidth:e,availableHeight:t,elements:i}){const s=window.innerHeight-16;Object.assign(i.floating.style,{maxHeight:Math.max(0,Math.max(t,Math.min(s,480)))+"px",maxWidth:Math.max(0,e)+"px"})}}),h({padding:8,crossAxis:!0}),p()]}).then((({x:e,y:i,middlewareData:s})=>{var r;const n=!!(null===(r=s.hide)||void 0===r?void 0:r.referenceHidden);Object.assign(t.style,{left:e+"px",top:i+"px",visibility:n?"hidden":"visible"}),this.flushActiveDayFocus()}))})))}stopPositioning(){var e;null===(e=this.cleanupAutoUpdate)||void 0===e||e.call(this),this.cleanupAutoUpdate=void 0}fieldReference(){var e,t,i;return null!==(i=null===(t=null===(e=this.inputEl)||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelector(".pds-input__field-wrapper"))&&void 0!==i?i:this.inputEl}commitPendingText(){if(this.text===this.fieldText())return;const e=this.parseText(this.text)?this.draftParts():null;e?this.commitParts(e):this.commitText()}readText(e){const t=this.resolvedFormat,i=this.resolvedLocale,s=this.range?ae(e,t,i):[ne(e,t,i)];return!s||s.some((e=>!e))?null:s.map(((e,t)=>this.withTimePicker(e,1===t?be:me)))}parseText(e){const t=this.readText(e);return t&&!this.rangeError(t)?t:null}rangeError(e){return this.minDate&&e.some((e=>e.date<this.minDate))?"min":this.maxDate&&e.some((e=>e.date>this.maxDate))?"max":""}valueError(){if(!this.value)return"";const e=this.parsedValue();return e?this.rangeError(e):"format"}commitText(){const e=this.text.trim();if(""===e)return void this.commitValue("");const t=this.readText(e),i=t?this.rangeError(t):"format";t&&!i?this.commitParts(t):(this.textError=i,this.updateFormValue())}canShowMonth(e){var t;const i=null!==(t=C(this.viewMonth))&&void 0!==t?t:A();return e<0?!this.minDate||T(i,-1)>=this.minDate:!this.maxDate||L(i,this.monthCount)<=this.maxDate}showMonth(e,t){var i,s;const r=null!==(i=C(this.viewMonth))&&void 0!==i?i:A(),n=null!==(s=C(this.activeDate))&&void 0!==s?s:A();this.viewMonth=$(L(r,t)),this.activeDate=$(H(L(n,t),this.minDate,this.maxDate)),this.canShowMonth(t)?e.currentTarget.focus():this.focusActiveDay=!0}jumpTo(e,t,i){var s;const r=H(new Date(Date.UTC(t,i,1)),this.minDate,this.maxDate);this.viewMonth=$(L(ge(r),-e));const n=null!==(s=C(this.activeDate))&&void 0!==s?s:r,a=Math.min(n.getUTCDate(),new Date(Date.UTC(t,i+1,0)).getUTCDate());this.activeDate=$(H(new Date(Date.UTC(t,i,a)),this.minDate,this.maxDate))}dropTypedText(){this.timesBeforeTyping&&([this.startTime,this.endTime]=this.timesBeforeTyping),this.timesBeforeTyping=void 0,(this.text!==this.fieldText()||this.textError)&&(this.text=this.fieldText(),this.inputEl&&(this.inputEl.value=this.text),this.textError="",this.updateFormValue())}trapTab(e){var t,i,s,r;const n=Array.from(null!==(i=null===(t=this.dialogEl)||void 0===t?void 0:t.querySelectorAll('button:not([disabled]):not([tabindex="-1"]), select:not([disabled]), [data-date][tabindex="0"]'))&&void 0!==i?i:[]);if(0===n.length)return;const a=null===(r=null===(s=this.dialogEl)||void 0===s?void 0:s.getRootNode())||void 0===r?void 0:r.activeElement,o=n[0],d=n[n.length-1];e.shiftKey&&a===o?(e.preventDefault(),d.focus()):e.shiftKey||a!==d||(e.preventDefault(),o.focus())}dayFromEvent(e){var t,i;const s=null===(i=null===(t=e.target)||void 0===t?void 0:t.closest)||void 0===i?void 0:i.call(t,"[data-date]");return C(null==s?void 0:s.dataset.date)}updateFormValue(){var e,t,i,s;if(k()||!(null===(e=this.internals)||void 0===e?void 0:e.setFormValue))return;if(this.internals.setFormValue(this.value||null),!this.internals.setValidity)return;const r=null!==(s=null===(i=null===(t=this.inputEl)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input"))&&void 0!==s?s:void 0,n=this.textError||this.valueError();"format"===n?this.internals.setValidity({badInput:!0},this.invalidDateMessage,r):"min"===n?this.internals.setValidity({rangeUnderflow:!0},this.boundMessage(this.minDateMessage,this.minDate),r):"max"===n?this.internals.setValidity({rangeOverflow:!0},this.boundMessage(this.maxDateMessage,this.maxDate),r):this.required&&!this.value?this.internals.setValidity({valueMissing:!0},(null==r?void 0:r.validationMessage)||this.invalidDateMessage,r):this.internals.setValidity({})}boundMessage(e,t){const i=t?le({date:t,time:null},this.format||void 0,this.resolvedLocale):"";return y(e,{date:i})}formResetCallback(){this.value="",this.text="",this.textError="",this.closeCalendar(!1),this.updateFormValue()}interactivityChanged(){this.isInteractive||this.closeCalendar(!1)}formDisabledCallback(e){this.disabled=e,e&&this.closeCalendar(!1)}formStateRestoreCallback(e){"string"==typeof e&&(this.value=e)}triggerAccessibleName(e){const t=this.parsedValue();if(!t)return this.triggerLabel;const i=t.map((t=>S(t.date,e,ve)));return`${this.triggerLabel}, ${i.join(ce)}`}highlightedRange(){const e=C(this.draftStart),t=C(this.draftEnd);if(!e||t)return[e,t];const i=C(this.previewDate);return[e,i&&i>e?i:null]}selectedDay(){return this.range?null:C(this.draftStart)}renderMonthHeading(e,t,i,r){const n=S(e,i,{month:"long",year:"numeric"}),a=0===t?"polite":null;if(!this.showDropdowns)return s("div",{class:"pds-datepicker__heading",id:r,"aria-live":a},n);const o=e.getUTCFullYear(),d=e.getUTCMonth(),l=this.minDate,c=this.maxDate,h=A().getUTCFullYear(),p=l?l.getUTCFullYear():h-100,v=c?c.getUTCFullYear():h+100,m=z(i,{month:"long"}),b=z(i,{year:"numeric"});return s("div",{class:"pds-datepicker__dropdowns"},s("span",{class:"visually-hidden",id:r,"aria-live":a},n),s("span",{class:"pds-datepicker__select-wrap"},s("select",{class:"pds-datepicker__heading-select","aria-label":this.monthLabel,onChange:e=>this.jumpTo(t,o,Number(e.target.value))},Array.from({length:12},((e,t)=>{const i=!!l&&new Date(Date.UTC(o,t+1,0))<l||!!c&&new Date(Date.UTC(o,t,1))>c;return s("option",{value:t+"",selected:t===d,disabled:i},m.format(new Date(Date.UTC(o,t,1))))}))),s("pds-icon",{class:"pds-datepicker__select-caret",icon:u,size:"small","aria-hidden":"true"})),s("span",{class:"pds-datepicker__select-wrap"},s("select",{class:"pds-datepicker__heading-select","aria-label":this.yearLabel,onChange:e=>this.jumpTo(t,Number(e.target.value),d)},Array.from({length:Math.max(v,o)-Math.min(p,o)+1},((e,t)=>{const i=Math.min(p,o)+t;return s("option",{value:i+"",selected:i===o},b.format(new Date(Date.UTC(i,0,1))))}))),s("pds-icon",{class:"pds-datepicker__select-caret",icon:u,size:"small","aria-hidden":"true"})))}renderMonth(e,t,i){const r=e.getUTCFullYear(),n=e.getUTCMonth(),a=this.minDate,o=this.maxDate,d=this.selectedDay(),[l,c]=this.range?this.highlightedRange():[null,null],h=A(),p=z(i,ve),u=z(i,{day:"numeric"}),b=`${this.baseId}-calendar-heading-${t}`,f=t===this.monthCount-1;return s("div",{class:"pds-datepicker__month"},s("div",{class:"pds-datepicker__header"},0===t?s("button",{type:"button",class:"pds-datepicker__nav pds-datepicker__nav--previous","aria-label":this.previousMonthLabel,disabled:!this.canShowMonth(-1),onClick:e=>this.showMonth(e,-1)},s("pds-icon",{icon:v,"aria-hidden":"true"})):s("span",{class:"pds-datepicker__nav-spacer"}),this.renderMonthHeading(e,t,i,b),f?s("button",{type:"button",class:"pds-datepicker__nav pds-datepicker__nav--next","aria-label":this.nextMonthLabel,disabled:!this.canShowMonth(1),onClick:e=>this.showMonth(e,1)},s("pds-icon",{icon:m,"aria-hidden":"true"})):s("span",{class:"pds-datepicker__nav-spacer"})),s("table",{class:"pds-datepicker__grid",role:"grid","aria-labelledby":b,"aria-multiselectable":this.range?"true":null,onKeyDown:this.onGridKeyDown,onClick:this.onGridClick,onPointerOver:this.onGridPointerOver},s("thead",null,s("tr",null,function(e,t){const i=z(e,{weekday:"short"}),s=z(e,{weekday:"long"}),r=Array.from({length:7},((e,i)=>new Date(Date.UTC(2023,0,1+(t+i)%7)))),n=r.map((e=>i.format(e).replace(/\.$/,""))),a=n.every((e=>/^[A-Za-z\u00C0-\u024F]+$/.test(e))),o=n.map((e=>e.slice(0,2))),d=a&&7===new Set(o.map((e=>e.toLowerCase()))).size;return r.map(((e,t)=>({short:d?o[t]:i.format(e),long:s.format(e)})))}(i,this.weekStart).map((e=>s("th",{scope:"col",class:"pds-datepicker__weekday"},s("span",{"aria-hidden":"true"},e.short),s("span",{class:"visually-hidden"},e.long)))))),s("tbody",null,function(e,t,i){const s=new Date(Date.UTC(e,t,1)),r=Array(E(s,i)).fill(null);for(let i=1;i<=j(e,t);i++)r.push(new Date(Date.UTC(e,t,i)));for(;r.length%7!=0;)r.push(null);const n=[];for(let e=0;e<r.length;e+=7)n.push(r.slice(e,e+7));return n}(r,n,this.weekStart).map((e=>s("tr",null,e.map(((e,t)=>{if(!e)return s("td",{class:"pds-datepicker__day pds-datepicker__day--empty"});const i=$(e),r=Y(e,a,o),n=P(e,l)||P(e,c),v=!!l&&!!c&&!P(l,c),m=!!l&&!!c&&e>=l&&e<=c,b=P(e,d)||n||m,f=P(e,h);return s("td",{class:{"pds-datepicker__day":!0,"pds-datepicker__day--selected":P(e,d)||n,"pds-datepicker__day--in-range":m&&!n,"pds-datepicker__day--range-start":v&&P(e,l),"pds-datepicker__day--range-end":v&&P(e,c),"pds-datepicker__day--row-start":m&&0===t,"pds-datepicker__day--row-end":m&&6===t,"pds-datepicker__day--today":f,"pds-datepicker__day--disabled":r},"data-date":i,tabindex:i===this.activeDate?"0":"-1","aria-label":p.format(e),"aria-selected":b?"true":null,"aria-current":f?"date":null,"aria-disabled":r?"true":null},((e,t)=>{var i,s;return null!==(s=null===(i=e.formatToParts(t).find((e=>"day"===e.type)))||void 0===i?void 0:i.value)&&void 0!==s?s:e.format(t)})(u,e))}))))))),this.timePicker&&this.timesUnderMonth(t).map((e=>this.renderTime(e,i))))}timesUnderMonth(e){return this.range?1===this.monthCount?["start","end"]:[0===e?"start":"end"]:["start"]}renderTime(e,t){var i,r,n;const a="start"===e?this.startTime:null!==(n=null===(r=null===(i=this.draftParts())||void 0===i?void 0:i[1])||void 0===r?void 0:r.time)&&void 0!==n?n:this.endTime,[o,d]=he(a),l=ue(t),c=Math.max(1,Math.min(60,Math.floor(this.minuteIncrement)||1)),h=(t,i)=>{const s=pe(t,i);"start"===e?this.startTime=s:this.endTime=s,this.timesBeforeTyping&&(this.timesBeforeTyping["start"===e?0:1]=s)},p=this.range?"start"===e?this.startTimeLabel:this.endTimeLabel:this.timeLabel,u=o>=12,v=l.hour12?Array.from({length:12},((e,t)=>t+1)):Array.from({length:24},((e,t)=>t)),m=l.hour12?o%12||12:o,b=Array.from({length:Math.ceil(60/c)},((e,t)=>t*c));b.includes(d)||b.push(d),b.sort(((e,t)=>e-t));const f=`${this.baseId}-time-${e}`;return s("div",{class:"pds-datepicker__time",role:"group","aria-labelledby":f},s("span",{class:"pds-datepicker__time-label",id:f},p),s("span",{class:"pds-datepicker__time-field"},s("select",{class:"pds-datepicker__time-select","aria-label":this.hourLabel,onChange:e=>{const t=Number(e.target.value);h(l.hour12?t%12+(u?12:0):t,d)}},v.map((e=>s("option",{value:e+"",selected:e===m},l.hour12?e+"":(e+"").padStart(2,"0"))))),s("span",{class:"pds-datepicker__time-separator","aria-hidden":"true"},":"),s("select",{class:"pds-datepicker__time-select","aria-label":this.minuteLabel,onChange:e=>h(o,Number(e.target.value))},b.map((e=>s("option",{value:e+"",selected:e===d},(e+"").padStart(2,"0"))))),l.hour12&&s("select",{class:"pds-datepicker__time-select pds-datepicker__time-select--period","aria-label":this.periodLabel,onChange:e=>{h(o%12+("pm"===e.target.value?12:0),d)}},s("option",{value:"am",selected:!u},l.am),s("option",{value:"pm",selected:u},l.pm))))}renderPresets(){var e;const t=this.resolvedPresets;if(0===t.length)return null;const i=I(t,C(this.draftStart),C(this.draftEnd)),r=!i&&!!this.draftStart,n=e=>R(e,this.minDate,this.maxDate),a=i&&n(i)?i:r?"custom":null!==(e=t.find(n))&&void 0!==e?e:"custom";return s("div",{class:"pds-datepicker__presets-column"},s("ul",{class:"pds-datepicker__presets",part:"presets",role:"radiogroup","aria-label":this.presetsLabel,onKeyDown:this.onPresetsKeyDown},t.map((e=>{const t=e===i;return s("li",{role:"none"},s("button",{type:"button",role:"radio",class:{"pds-datepicker__preset":!0,"pds-datepicker__preset--selected":t},"aria-checked":t?"true":"false",tabindex:e===a?"0":"-1",disabled:!R(e,this.minDate,this.maxDate),onClick:t=>this.onPresetClick(t,e)},s("span",null,e.label),t&&s("pds-icon",{icon:b,"aria-hidden":"true"})))})),s("li",{role:"none"},s("button",{type:"button",role:"radio",class:{"pds-datepicker__preset":!0,"pds-datepicker__preset--selected":r},"aria-checked":r?"true":"false",tabindex:"custom"===a?"0":"-1",onClick:this.onCustomRangeClick},s("span",null,this.customRangeLabel),r&&s("pds-icon",{icon:b,"aria-hidden":"true"})))))}selectionText(){const e=this.draftParts();if(!e)return"";const t=this.resolvedFormat,i=this.resolvedLocale;return this.range&&!this.draftEnd?`${le(e[0],t,i)}${ce}`:e.map((e=>le(e,t,i))).join(ce)}renderFooter(){const e=this.draftParts(),t=this.selectionText();return s("div",{class:"pds-datepicker__footer"},s("span",{class:"pds-datepicker__selection","aria-live":"polite"},t),s("button",{type:"button",class:"pds-datepicker__action",onClick:this.onCancel},this.clearable?this.clearLabel:this.cancelLabel),s("button",{type:"button",class:"pds-datepicker__action pds-datepicker__action--primary",disabled:!e,onClick:this.onApply},this.applyLabel))}renderCalendar(e){var t;const i=null!==(t=C(this.viewMonth))&&void 0!==t?t:A(),r=Array.from({length:this.monthCount},((e,t)=>L(i,t)));return s("div",{class:{"pds-datepicker__dialog":!0,"pds-datepicker__dialog--range":this.range},id:this.baseId+"-calendar",role:"dialog",tabindex:"-1","aria-labelledby":this.range?null:this.baseId+"-calendar-heading-0","aria-label":this.range?this.label||this.triggerLabel:null,part:"calendar",ref:e=>this.dialogEl=e,onKeyDown:this.onDialogKeyDown,onFocusin:this.onCalendarFocusIn,onFocusout:this.onCalendarFocusOut},this.range&&this.renderPresets(),s("div",{class:"pds-datepicker__panel"},s("div",{class:"pds-datepicker__months"},r.map(((t,i)=>this.renderMonth(t,i,e)))),this.hasFooter&&this.renderFooter(),this.appliesOnPick&&s("span",{class:"visually-hidden","aria-live":"polite"},this.selectionText())))}render(){const e=this.resolvedLocale;return s(r,{key:"a761f0ca6eeedcac3e4bd90760aa9781cd37dcdc",class:{"pds-datepicker--range":this.range,"pds-datepicker--time":this.timePicker},"full-width":this.fullWidth?"true":null,onFocusin:this.onHostFocusIn,onFocusout:this.onHostFocusOut},s("pds-input",{key:"2eb04f9fd4e2f7a2437145d250c629c2cc8a0bf6",ref:e=>this.inputEl=e,componentId:this.baseId,label:this.label,hideLabel:this.hideLabel,helperMessage:this.helperMessage,errorMessage:this.errorMessage,invalid:this.invalid||!!this.textError||!!this.valueError(),disabled:this.disabled,readonly:this.readonly,required:this.required,placeholder:this.fieldPlaceholder,fullWidth:this.fullWidth,autocomplete:"off",value:this.text,onClick:this.onFieldClick,onPdsInput:this.onTextInput,onPdsChange:this.onTextChange,onPdsKeyDown:this.onTextKeyDown,onPdsFocus:this.stopInnerEvent,onPdsBlur:this.stopInnerEvent},this.clearable&&!!this.value&&this.isInteractive&&s("button",{key:"clear",slot:"suffix",type:"button",class:"pds-datepicker__clear",ref:e=>this.clearEl=e,"aria-label":this.label?`${this.clearLabel} ${this.label}`:this.clearLabel,tabindex:"-1",onMouseDown:this.onClearMouseDown,onClick:this.onClearClick},s("pds-icon",{key:"98c325fbba8ea78b2d409bc77099db3206738508",icon:f,"aria-hidden":"true"})),s("button",{key:"trigger",slot:"suffix",type:"button",class:"pds-datepicker__trigger",ref:e=>this.triggerEl=e,"aria-label":this.triggerAccessibleName(e),"aria-haspopup":"dialog","aria-expanded":this.isOpen?"true":"false",disabled:!this.isInteractive,onClick:this.onTriggerClick,onKeyDown:this.onTriggerKeyDown},s("pds-icon",{key:"cb8483febe1b485058b7bb4271b749981a7747a1",icon:g,"aria-hidden":"true"}))),this.isOpen&&this.renderCalendar(e))}static get formAssociated(){return!0}get el(){return this}static get watchers(){return{value:[{valueChanged:0}],format:[{contextChanged:0}],locale:[{contextChanged:0}],timePicker:[{contextChanged:0}],range:[{contextChanged:0}],min:[{contextChanged:0}],max:[{contextChanged:0}],placement:[{placementChanged:0}],required:[{requiredChanged:0}],disabled:[{interactivityChanged:0}],readonly:[{interactivityChanged:0}]}}static get style(){return':host{--pds-datepicker-day-size:var(--pine-dimension-500);--pds-datepicker-presets-width:200px;display:inline-block}:host([full-width]){display:block}pds-input{display:block}:host(.pds-datepicker--time) pds-input{min-width:220px}:host(.pds-datepicker--range) pds-input{min-width:260px}:host(.pds-datepicker--range.pds-datepicker--time) pds-input{min-width:min(380px, 100%)}.pds-datepicker__trigger,.pds-datepicker__clear{-ms-flex-align:center;align-items:center;background:transparent;border:0;border-radius:var(--pine-border-radius-sm);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;padding:var(--pine-dimension-2xs)}.pds-datepicker__trigger:hover:not(:disabled),.pds-datepicker__clear:hover:not(:disabled){background:var(--pine-color-background-muted);color:var(--pine-color-text-strong)}.pds-datepicker__trigger:focus-visible,.pds-datepicker__clear:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__trigger:disabled,.pds-datepicker__clear:disabled{color:var(--pine-color-text-disabled);cursor:not-allowed}.pds-datepicker__clear{-webkit-margin-end:var(--pine-dimension-2xs);margin-inline-end:var(--pine-dimension-2xs)}.pds-datepicker__nav{-ms-flex-align:center;align-items:center;background:var(--pine-color-secondary);border:var(--pine-border);border-radius:var(--pine-border-radius-full);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;height:var(--pine-dimension-400);-ms-flex-pack:center;justify-content:center;padding:0;width:var(--pine-dimension-400)}.pds-datepicker__nav:hover:not(:disabled){background:var(--pine-color-secondary-hover);border-color:var(--pine-color-border-hover)}.pds-datepicker__nav:focus-visible{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__nav:disabled{border-color:var(--pine-color-border-disabled);color:var(--pine-color-text-secondary-disabled);cursor:not-allowed}.pds-datepicker__nav:dir(rtl) pds-icon{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.pds-datepicker__dialog:focus{outline:none}.pds-datepicker__dialog{background:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-150);-webkit-box-shadow:var(--pine-box-shadow-200);box-shadow:var(--pine-box-shadow-200);-webkit-box-sizing:border-box;box-sizing:border-box;left:0;max-height:calc(100vh - var(--pine-dimension-sm));max-height:calc(100dvh - var(--pine-dimension-sm));max-width:calc(100vw - var(--pine-dimension-sm));overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain;padding:var(--pine-dimension-sm);pointer-events:auto;position:fixed;top:0;visibility:hidden;z-index:var(--pine-z-index-priority)}:host-context([data-theme=dark]) .pds-datepicker__dialog{border:var(--pine-border)}.pds-datepicker__header{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-webkit-margin-after:var(--pine-dimension-sm);margin-block-end:var(--pine-dimension-sm)}.pds-datepicker__nav-spacer{-ms-flex:none;flex:none;width:var(--pine-dimension-400)}.pds-datepicker__heading{color:var(--pine-color-text);font:var(--pine-typography-heading-5);font-weight:var(--pine-font-weight-semi-bold)}.pds-datepicker__grid{border-collapse:collapse;border-spacing:0}.pds-datepicker__weekday{color:var(--pine-color-text-muted);font:var(--pine-typography-body-sm);height:var(--pds-datepicker-day-size);padding:0;text-align:center;width:var(--pds-datepicker-day-size)}.pds-datepicker__day{border-radius:var(--pine-border-radius-full);color:var(--pine-color-text-secondary);cursor:pointer;font:var(--pine-typography-body);height:var(--pds-datepicker-day-size);padding:0;position:relative;text-align:center;-webkit-transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);width:var(--pds-datepicker-day-size)}.pds-datepicker__day:hover{background:var(--pine-color-background-muted)}.pds-datepicker__day:focus-visible{outline:var(--pine-outline-focus);outline-offset:calc(var(--pine-border-width-thick) * -1)}.pds-datepicker__day--empty{cursor:default;pointer-events:none}.pds-datepicker__day--today::after{background:var(--pine-color-primary);border-radius:var(--pine-border-radius-full);content:"";height:var(--pine-dimension-050);inset-block-end:var(--pine-dimension-050);inset-inline-start:50%;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:var(--pine-dimension-050)}.pds-datepicker__day--selected,.pds-datepicker__day--selected:hover{background:var(--pine-color-primary);color:var(--pine-color-text-primary)}.pds-datepicker__day--selected:focus-visible{outline-offset:var(--pine-border-width)}.pds-datepicker__day--range-start{border-end-end-radius:0;border-start-end-radius:0}.pds-datepicker__day--range-end{border-end-start-radius:0;border-start-start-radius:0}.pds-datepicker__day--range-start.pds-datepicker__day--row-end{border-end-end-radius:var(--pine-border-radius-full);border-start-end-radius:var(--pine-border-radius-full)}.pds-datepicker__day--range-end.pds-datepicker__day--row-start{border-end-start-radius:var(--pine-border-radius-full);border-start-start-radius:var(--pine-border-radius-full)}.pds-datepicker__day--selected.pds-datepicker__day--today::after{background:var(--pine-color-text-primary)}.pds-datepicker__day--in-range{border-radius:0}.pds-datepicker__day--in-range,.pds-datepicker__day--in-range:hover{background:var(--pine-color-background-muted);color:var(--pine-color-text-secondary)}.pds-datepicker__day--row-start{border-end-start-radius:var(--pine-border-radius-full);border-start-start-radius:var(--pine-border-radius-full)}.pds-datepicker__day--row-end{border-end-end-radius:var(--pine-border-radius-full);border-start-end-radius:var(--pine-border-radius-full)}.pds-datepicker__day--disabled,.pds-datepicker__day--disabled:hover{background:transparent;color:var(--pine-color-text-disabled);cursor:not-allowed;text-decoration:line-through}.pds-datepicker__day--in-range:hover{background:var(--pine-color-background-inset)}.pds-datepicker__dialog--range{display:-ms-flexbox;display:flex;padding:0}.pds-datepicker__panel{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:0}.pds-datepicker__dialog--range .pds-datepicker__panel{padding:var(--pine-dimension-sm)}.pds-datepicker__months{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--pine-dimension-lg)}.pds-datepicker__presets-column{-webkit-border-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-inline-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);-ms-flex:none;flex:none;position:relative;width:var(--pds-datepicker-presets-width)}.pds-datepicker__presets{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--pine-dimension-2xs);inset:0;list-style:none;margin:0;overflow-y:auto;padding:var(--pine-dimension-150);position:absolute}.pds-datepicker__preset{-ms-flex-align:center;align-items:center;background:transparent;border:0;border-radius:var(--pine-border-radius-md);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body);gap:var(--pine-dimension-xs);-ms-flex-pack:justify;justify-content:space-between;padding:var(--pine-dimension-xs) var(--pine-dimension-sm);text-align:start;-webkit-transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);width:100%}.pds-datepicker__preset:hover:not(:disabled){background:var(--pine-color-background-muted)}.pds-datepicker__preset:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__preset:disabled{color:var(--pine-color-text-disabled);cursor:not-allowed}.pds-datepicker__preset--selected{background:var(--pine-color-background-muted);color:var(--pine-color-text-active)}.pds-datepicker__footer{-ms-flex-align:center;align-items:center;background:var(--pine-color-background-overlay);-webkit-border-before:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-block-start:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--pine-dimension-xs);inset-block-end:calc(var(--pine-dimension-sm) * -1);-ms-flex-pack:end;justify-content:flex-end;margin-block:var(--pine-dimension-sm) calc(var(--pine-dimension-sm) * -1);padding-block:var(--pine-dimension-sm);position:-webkit-sticky;position:sticky}.pds-datepicker__selection{color:var(--pine-color-text-muted);font:var(--pine-typography-body-sm-medium);-webkit-margin-end:auto;margin-inline-end:auto}.pds-datepicker__dropdowns{display:-ms-flexbox;display:flex;gap:var(--pine-dimension-2xs)}.pds-datepicker__select-wrap{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;position:relative}.pds-datepicker__heading-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-border-radius-md);color:var(--pine-color-text);cursor:pointer;field-sizing:content;font:var(--pine-typography-heading-5);font-weight:var(--pine-font-weight-semi-bold);padding-block:var(--pine-dimension-2xs);padding-inline:var(--pine-dimension-xs) calc(var(--pine-dimension-xs) + var(--pine-dimension-sm))}.pds-datepicker__heading-select:hover{background:var(--pine-color-background-muted)}.pds-datepicker__heading-select:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__select-caret{color:var(--pine-color-text-secondary);inset-inline-end:var(--pine-dimension-xs);pointer-events:none;position:absolute}.pds-datepicker__time{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs);-ms-flex-pack:justify;justify-content:space-between;-webkit-margin-before:var(--pine-dimension-sm);margin-block-start:var(--pine-dimension-sm);padding-inline:var(--pine-dimension-xs)}.pds-datepicker__time-label{color:var(--pine-color-text-label);font:var(--pine-typography-body-medium)}.pds-datepicker__time-field{-ms-flex-align:center;align-items:center;background:var(--pine-color-background-container);border:var(--pine-border);border-radius:var(--pine-border-radius-md);display:-ms-inline-flexbox;display:inline-flex;min-height:var(--pine-dimension-400);padding-inline:var(--pine-dimension-2xs)}.pds-datepicker__time-field:hover{border-color:var(--pine-color-border-hover)}.pds-datepicker__time-field:focus-within{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__time-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-border-radius-sm);color:var(--pine-color-text-strong);cursor:pointer;font:var(--pine-typography-body);font-variant-numeric:tabular-nums;padding:var(--pine-dimension-2xs);text-align:center}.pds-datepicker__time-select:focus-visible{background:var(--pine-color-background-muted);outline:none}.pds-datepicker__time-select--period{-webkit-margin-start:var(--pine-dimension-2xs);margin-inline-start:var(--pine-dimension-2xs)}.pds-datepicker__time-separator{color:var(--pine-color-text-secondary)}:host-context([data-theme=dark]) select{color-scheme:dark}.pds-datepicker__action{background:var(--pine-color-secondary);border:var(--pine-border);border-radius:var(--pine-border-radius-full);color:var(--pine-color-text-secondary);cursor:pointer;font:var(--pine-typography-body-medium);padding:calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-sm)}.pds-datepicker__action:hover:not(:disabled){background:var(--pine-color-secondary-hover);border-color:var(--pine-color-border-hover)}.pds-datepicker__action:focus-visible{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__action:disabled{background:var(--pine-color-secondary-disabled);border-color:var(--pine-color-border-disabled);color:var(--pine-color-text-secondary-disabled);cursor:not-allowed}.pds-datepicker__action--primary{background:var(--pine-color-primary);border-color:var(--pine-color-primary);color:var(--pine-color-text-primary)}.pds-datepicker__action--primary:hover:not(:disabled){background:var(--pine-color-primary-hover);border-color:var(--pine-color-primary-hover)}.pds-datepicker__action--primary:disabled{background:var(--pine-color-primary-disabled);border-color:var(--pine-color-primary-disabled);color:var(--pine-color-text-primary-disabled)}@media (max-width: 600px){.pds-datepicker__dialog--range{-ms-flex-direction:column;flex-direction:column}.pds-datepicker__presets-column{-webkit-border-after:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-block-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);-webkit-border-end:0;border-inline-end:0;width:auto}.pds-datepicker__presets{-ms-flex-direction:row;flex-direction:row;overflow-x:auto;position:static}.pds-datepicker__preset{white-space:nowrap}.pds-datepicker__selection{-ms-flex-preferred-size:100%;flex-basis:100%}}.pds-datepicker__trigger,.pds-datepicker__clear,.pds-datepicker__nav,.pds-datepicker__weekday,.pds-datepicker__day,.pds-datepicker__preset,.pds-datepicker__action{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media (forced-colors: active){.pds-datepicker__day--selected,.pds-datepicker__day--selected:hover{background:Highlight;color:HighlightText;forced-color-adjust:none}.pds-datepicker__day--in-range,.pds-datepicker__day--in-range:hover{border-block:var(--pine-border-width-thin) solid Highlight}.pds-datepicker__day--today::after{background:CanvasText;forced-color-adjust:none}.pds-datepicker__day--selected.pds-datepicker__day--today::after{background:HighlightText}.pds-datepicker__day--disabled{color:GrayText}}.visually-hidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:polygon(0 0, 0 0, 0 0);clip-path:polygon(0 0, 0 0, 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}'}},[65,"pds-datepicker",{applyLabel:[1,"apply-label"],autoApply:[4,"auto-apply"],cancelLabel:[1,"cancel-label"],clearable:[4],clearLabel:[1,"clear-label"],componentId:[1,"component-id"],customRangeLabel:[1,"custom-range-label"],disabled:[4],endTimeLabel:[1,"end-time-label"],errorMessage:[1,"error-message"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],fullWidth:[4,"full-width"],helperMessage:[1,"helper-message"],hideLabel:[4,"hide-label"],hourLabel:[1,"hour-label"],invalid:[4],invalidDateMessage:[1,"invalid-date-message"],maxDateMessage:[1,"max-date-message"],minDateMessage:[1,"min-date-message"],label:[1],locale:[1],max:[1],min:[1],minuteIncrement:[2,"minute-increment"],minuteLabel:[1,"minute-label"],monthLabel:[1,"month-label"],name:[1],nextMonthLabel:[1,"next-month-label"],periodLabel:[1,"period-label"],placeholder:[1],placement:[1],presets:[1],presetsLabel:[1,"presets-label"],previousMonthLabel:[1,"previous-month-label"],range:[4],readonly:[4],required:[4],showDropdowns:[4,"show-dropdowns"],startTimeLabel:[1,"start-time-label"],timePicker:[4,"time-picker"],timeLabel:[1,"time-label"],triggerLabel:[1,"trigger-label"],value:[1025],yearLabel:[1,"year-label"],isOpen:[32],text:[32],textError:[32],activeDate:[32],viewMonth:[32],draftStart:[32],draftEnd:[32],startTime:[32],endTime:[32],previewDate:[32],open:[64],close:[64],setFocus:[64]},void 0,{value:[{valueChanged:0}],format:[{contextChanged:0}],locale:[{contextChanged:0}],timePicker:[{contextChanged:0}],range:[{contextChanged:0}],min:[{contextChanged:0}],max:[{contextChanged:0}],placement:[{placementChanged:0}],required:[{requiredChanged:0}],disabled:[{interactivityChanged:0}],readonly:[{interactivityChanged:0}]}]),_e=ke,ye=function(){"undefined"!=typeof customElements&&["pds-datepicker","pds-icon","pds-input"].forEach((e=>{switch(e){case"pds-datepicker":customElements.get(n(e))||customElements.define(n(e),ke);break;case"pds-icon":customElements.get(n(e))||w();break;case"pds-input":customElements.get(n(e))||D()}}))};export{_e as PdsDatepicker,ye as defineCustomElement}
1
+ import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,Host as r,transformTag as n}from"@stencil/core/internal/client";import{a,c as o,o as d,f as l,b as c,s as h,h as p}from"./floating-ui.dom.js";import{f as u,j as v,k as m,m as b,r as f,n as g}from"./index2.js";import{i as k}from"./form.js";import{r as _,f as y}from"./i18n-format.js";import{c as x}from"./closest.js";import{f as w}from"./portal-target.js";import{d as D}from"./pds-icon2.js";import{d as M}from"./pds-input2.js";const C=/^(\d{4})-(\d{2})-(\d{2})$/;function $(e){const t=C.exec((null!=e?e:"").trim());if(!t)return null;const[,i,s,r]=t.map(Number),n=new Date(Date.UTC(i,s-1,r));return n.getUTCFullYear()===i&&n.getUTCMonth()===s-1&&n.getUTCDate()===r?n:null}function A(e){return e.toISOString().slice(0,10)}function T(){const e=new Date;return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()))}function L(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function j(e,t){const i=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth()+t,1)),s=P(i.getUTCFullYear(),i.getUTCMonth());return new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),Math.min(e.getUTCDate(),s)))}function P(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}function H(e,t){return!!e&&!!t&&e.getTime()===t.getTime()}function Y(e,t,i){return t&&e<t?t:i&&e>i?i:e}function E(e,t,i){return!!t&&e<t||!!i&&e>i}function z(e,t){return(e.getUTCDay()-t+7)%7}function S(e,t){return new Intl.DateTimeFormat(e,Object.assign(Object.assign({},t),{timeZone:"UTC",calendar:"gregory"}))}function F(e,t,i){return S(t,i).format(e)}class N{constructor(e){this.datepicker=e,this.copiedProperties=[],this.host=document.createElement("div"),this.host.className=N.className,this.host.pdsDatepicker=e,this.host.style.display="contents",this.root=this.host.attachShadow({mode:"open"})}mount(e,t){this.host.isConnected?t!==this.locale&&this.copyContext(t):(w(this.datepicker).appendChild(this.host),this.copyContext(t)),e.parentNode!==this.root&&this.root.appendChild(e)}remove(){this.host.remove()}contains(e){return!!e&&(e===this.host||this.root.contains(e))}copyContext(e){var t,i;this.locale=e;const s=this.datepicker.shadowRoot;s&&((null===(t=s.adoptedStyleSheets)||void 0===t?void 0:t.length)?this.root.adoptedStyleSheets=s.adoptedStyleSheets:this.root.querySelector("style")||s.querySelectorAll("style").forEach((e=>this.root.appendChild(e.cloneNode(!0)))));const r=getComputedStyle(this.datepicker);this.host.dir=r.direction||"ltr",this.host.lang=e,this.copyCustomProperties(r);const n=null===(i=x("[data-theme]",this.datepicker)||null)||void 0===i?void 0:i.getAttribute("data-theme");n?this.host.setAttribute("data-theme",n):this.host.removeAttribute("data-theme")}copyCustomProperties(e){for(const e of this.copiedProperties)this.host.style.removeProperty(e);this.copiedProperties=[];const t=this.host.parentElement,i=t?getComputedStyle(t):null;for(let t=0;t<e.length;t++){const s=e[t];if(!s.startsWith("--"))continue;const r=e.getPropertyValue(s);i&&r===i.getPropertyValue(s)||(this.host.style.setProperty(s,r.trim()),this.copiedProperties.push(s))}}}N.className="pds-datepicker-calendar-portal";const U={today:"Today",yesterday:"Yesterday","last-7-days":"Last 7 days","last-30-days":"Last 30 days","last-90-days":"Last 90 days","this-month":"This month","last-month":"Last month","this-quarter":"This quarter","last-quarter":"Last quarter","this-year":"This year","last-year":"Last year","year-to-date":"Year to date","last-12-months":"Last 12 months"},O=(e,t,i)=>new Date(Date.UTC(e,t,i));function q(e,t){const i=t.getUTCFullYear(),s=t.getUTCMonth(),r=s-s%3;switch(e){case"today":return[t,t];case"yesterday":return[L(t,-1),L(t,-1)];case"last-7-days":return[L(t,-6),t];case"last-30-days":return[L(t,-29),t];case"last-90-days":return[L(t,-89),t];case"this-month":return[O(i,s,1),O(i,s+1,0)];case"last-month":return[O(i,s-1,1),O(i,s,0)];case"this-quarter":return[O(i,r,1),O(i,r+3,0)];case"last-quarter":return[O(i,r-3,1),O(i,r,0)];case"this-year":return[O(i,0,1),O(i,11,31)];case"last-year":return[O(i-1,0,1),O(i-1,11,31)];case"year-to-date":return[O(i,0,1),t];case"last-12-months":return[j(t,-12),t];default:return null}}function I(e,t,i){if(t&&i)return e.find((e=>e.start.getTime()===t.getTime()&&e.end.getTime()===i.getTime()))}function R(e,t,i){return!E(e.start,t,i)&&!E(e.end,t,i)}const W=/^(\d{4}-\d{2}-\d{2})(?:[T ](\d{2}):(\d{2}))?$/;function K(e){const t=W.exec((null!=e?e:"").trim());if(!t)return null;const i=$(t[1]);return i?void 0===t[2]?{date:i,time:null}:Number(t[2])<24&&Number(t[3])<60?{date:i,time:`${t[2]}:${t[3]}`}:null:null}const V="YYYY-MM-DD",X=/\[([^\]]*)\]|YYYY|MMMM|MMM|MM|M|DD|D|HH|H|hh|h|mm|A|a/g,Z=/HH|H|hh|h/,B=/hh|h/,G=/A|a/;function J(e,t,i=!1){const s=(null==e?void 0:e.trim())||V,r=(e=>e.replace(/\[[^\]]*\]/g,""))(s);return B.test(r)&&!G.test(r)?s+" A":!t||Z.test(r)?s:`${s} ${i?"h:mm A":"HH:mm"}`}const Q=(e,t=2)=>(e+"").padStart(t,"0"),ee=new Map;function te(e){let t=ee.get(e);if(!t){const i=t=>{const i=new Intl.DateTimeFormat(e,{month:t,timeZone:"UTC",calendar:"gregory"});return Array.from({length:12},((e,t)=>i.format(new Date(Date.UTC(2023,t,1)))))},s=ue(e);t={months:i("long"),shortMonths:i("short"),am:s.am,pm:s.pm},ee.set(e,t)}return t}const ie=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),se=e=>ie(e).replace(/\s+/g,"\\s*"),re=e=>`(${e.map(ie).join("|")})`;function ne(e,t=V,i="en-US"){var s;return null!==(s=function(e,t,i="en-US"){var s,r,n,a,o,d,l,c,h,p;const u=te(i),v=te("en-US"),m=[u.am,u.pm,v.am,v.pm],b={YYYY:"(\\d{4})",MMMM:re([...u.months,...v.months]),MMM:re([...u.shortMonths,...v.shortMonths]),MM:"(\\d{1,2})",M:"(\\d{1,2})",DD:"(\\d{1,2})",D:"(\\d{1,2})",HH:"(\\d{1,2})",H:"(\\d{1,2})",hh:"(\\d{1,2})",h:"(\\d{1,2})",mm:"(\\d{2})",A:re(m),a:re(m)},f=[],g=()=>{f.length=0;let e="",i=0;return t.replace(X,((s,r,n)=>(e+=se(t.slice(i,n)),void 0!==r?e+=se(r):(e+=b[s],f.push(s)),i=n+s.length,s))),RegExp(`^\\s*${e}${se(t.slice(i))}\\s*$`,"i")};let k=g().exec(null!=e?e:"");if(k||(b.mm="(\\d{1,2})",k=g().exec(null!=e?e:"")),!k)return null;const _=k,y={};f.forEach(((e,t)=>y[e]=_[t+1]));const x=(e,t)=>{if(void 0===e)return;const i=t?[u.months,v.months]:[u.shortMonths,v.shortMonths];for(const t of i){const i=t.findIndex((t=>t.toLowerCase()===e.toLowerCase()));if(i>=0)return i+1}},w=Number(y.YYYY),D=null!==(r=null!==(s=x(y.MMMM,!0))&&void 0!==s?s:x(y.MMM,!1))&&void 0!==r?r:Number(null!==(n=y.MM)&&void 0!==n?n:y.M),M=Number(null!==(a=y.DD)&&void 0!==a?a:y.D);if(!y.YYYY||!D||!M)return null;const C=$(`${Q(w,4)}-${Q(D)}-${Q(M)}`);if(!C)return null;const A=null!==(l=null!==(d=null!==(o=y.HH)&&void 0!==o?o:y.H)&&void 0!==d?d:y.hh)&&void 0!==l?l:y.h;if(void 0===A)return{date:C,time:null};let T=Number(A);const L=Number(null!==(c=y.mm)&&void 0!==c?c:0),j=null===(p=null!==(h=y.A)&&void 0!==h?h:y.a)||void 0===p?void 0:p.toLowerCase();if(void 0!==y.hh||void 0!==y.h){if(T<1||T>12)return null;T=T%12+(j===u.pm.toLowerCase()||j===v.pm.toLowerCase()?12:0)}return T<24&&L<60?{date:C,time:pe(T,L)}:null}(e,t,i))&&void 0!==s?s:K(e)}function ae(e,t=V,i="en-US"){const s=(null!=e?e:"").trim(),r=RegExp(`${ie(ce)}|\\s+(?:–|—|-|to)\\s+${t.includes("/")?"":"|\\s*/\\s*"}`,"gi");let n;for(;null!==(n=r.exec(s));){const e=ne(s.slice(0,n.index),t,i),r=ne(s.slice(n.index+n[0].length),t,i);if(e&&r)return oe(e,r)<=0?[e,r]:null}return null}function oe(e,t){var i,s;const r=e.date.getTime()-t.date.getTime();return 0!==r?r:(null!==(i=e.time)&&void 0!==i?i:"00:00").localeCompare(null!==(s=t.time)&&void 0!==s?s:"00:00")}function de(e){return e.time?`${A(e.date)}T${e.time}`:A(e.date)}function le(e,t,i="en-US"){return function(e,t,i="en-US"){var s;const r=te(i),[n,a]=he(null!==(s=e.time)&&void 0!==s?s:"00:00"),o=n%12||12,d=e.date.getUTCMonth(),l=n<12?r.am:r.pm,c={YYYY:Q(e.date.getUTCFullYear(),4),MMMM:r.months[d],MMM:r.shortMonths[d],MM:Q(d+1),M:d+1+"",DD:Q(e.date.getUTCDate()),D:e.date.getUTCDate()+"",HH:Q(n),H:n+"",hh:Q(o),h:o+"",mm:Q(a),A:l,a:l.toLowerCase()};return t.replace(X,((e,t)=>null!=t?t:c[e]))}(e,null!=t?t:J(V,!!e.time),i)}const ce=" – ";function he(e){const[t,i]=e.split(":").map(Number);return[t||0,i||0]}function pe(e,t){return`${(e+"").padStart(2,"0")}:${(t+"").padStart(2,"0")}`}function ue(e){var t,i;const s=new Intl.DateTimeFormat(e,{hour:"numeric",timeZone:"UTC"}),r=e=>{var t;return null===(t=s.formatToParts(new Date(Date.UTC(2023,0,1,e))).find((e=>"dayPeriod"===e.type)))||void 0===t?void 0:t.value};return{hour12:!!s.resolvedOptions().hour12,am:null!==(t=r(1))&&void 0!==t?t:"AM",pm:null!==(i=r(13))&&void 0!==i?i:"PM"}}const ve={weekday:"long",year:"numeric",month:"long",day:"numeric"},me="00:00",be="23:59";let fe=0;const ge=e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),1)),ke=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.pdsDatepickerChange=i(this,"pdsDatepickerChange",7),this.pdsBlur=i(this,"pdsBlur",7),this.pdsFocus=i(this,"pdsFocus",7),this.focusActiveDay=!1,this.fallbackId="pds-datepicker-"+ ++fe,this.skipForwardedClick=!1,this.presetByArrow=!1,this.valueAtOpen="",this.committing=!1,this.hasFocus=!1,this.applyLabel="Apply",this.autoApply=!1,this.cancelLabel="Cancel",this.clearable=!1,this.clearLabel="Clear",this.customRangeLabel="Custom range",this.endTimeLabel="End time",this.format="YYYY-MM-DD",this.hourLabel="Hour",this.invalidDateMessage="Enter a date in the format shown.",this.maxDateMessage="Choose {date} or earlier.",this.minDateMessage="Choose {date} or later.",this.minuteIncrement=1,this.minuteLabel="Minute",this.monthLabel="Month",this.nextMonthLabel="Next month",this.periodLabel="AM or PM",this.placement="bottom-start",this.presetsLabel="Presets",this.previousMonthLabel="Previous month",this.range=!1,this.showDropdowns=!1,this.startTimeLabel="Start time",this.timePicker=!1,this.timeLabel="Time",this.triggerLabel="Choose date",this.value="",this.yearLabel="Year",this.isOpen=!1,this.text="",this.textError="",this.activeDate="",this.viewMonth="",this.draftStart="",this.draftEnd="",this.startTime=me,this.endTime=be,this.previewDate="",this.onApply=()=>{const e=this.draftParts();e&&(this.commitParts(e),this.closeCalendar(!0))},this.onCancel=()=>{this.clearable?this.commitValue(""):this.restoreValueAtOpen(),this.closeCalendar(!0)},this.onPresetClick=(e,t)=>{this.draftStart=A(t.start),this.draftEnd=A(t.end),this.previewDate="",!this.appliesOnPick||this.presetByArrow?(this.showDate(t.end,!0),e.currentTarget.focus()):this.onApply()},this.onPresetsKeyDown=e=>{const t={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1}[e.key],i={Home:"first",End:"last"}[e.key];if(!t&&!i)return;const s=Array.from(e.currentTarget.querySelectorAll('[role="radio"]:not([disabled])')),r=s.indexOf(e.target),n="first"===i?s[0]:"last"===i?s[s.length-1]:s[(r+t+s.length)%s.length];n&&(e.preventDefault(),n.focus(),n.classList.contains("pds-datepicker__preset")&&n!==s[s.length-1]&&(this.presetByArrow=!0,n.click(),this.presetByArrow=!1))},this.onClearMouseDown=e=>{e.preventDefault()},this.onClearClick=()=>{var e;this.commitValue(""),this.closeCalendar(!1),null===(e=this.inputEl)||void 0===e||e.setFocus()},this.onCustomRangeClick=()=>{var e,t;null===(t=null===(e=this.dialogEl)||void 0===e?void 0:e.querySelector('[data-date][tabindex="0"]'))||void 0===t||t.focus()},this.onDocumentPointerDown=e=>{var t;const i=e.composedPath();i.includes(this.el)||this.portal&&i.includes(this.portal.host)||(this.closeCalendar(!1),"dialog"===(null===(t=i[0])||void 0===t?void 0:t.localName)&&function(){const e=e=>{e.stopPropagation(),e.preventDefault()};document.addEventListener("click",e,{capture:!0,once:!0}),window.setTimeout((()=>document.removeEventListener("click",e,{capture:!0})),500)}())},this.onHostFocusIn=e=>{this.focusEntered(e)},this.onCalendarFocusIn=e=>{var t,i;this.focusEntered(e),null===(t=this.dialogEl)||void 0===t||t.setAttribute("aria-modal","true"),e.target===this.dialogEl&&(null===(i=this.dialogEl.querySelector(`[data-date="${this.activeDate}"]`))||void 0===i||i.focus({preventScroll:!0}))},this.onCalendarFocusOut=e=>{var t,i;const s=e.relatedTarget;s&&(null===(t=this.dialogEl)||void 0===t?void 0:t.contains(s))||null===(i=this.dialogEl)||void 0===i||i.removeAttribute("aria-modal"),this.checkFocusLeft(e,null!==s)},this.onHostFocusOut=e=>{const t=e.relatedTarget;t&&this.isInside(t)||this.checkFocusLeft(e,null!==t)},this.stopInnerEvent=e=>e.stopPropagation(),this.onFieldClick=e=>{var t,i;const s=e.composedPath();if(this.triggerEl&&s.includes(this.triggerEl)||this.clearEl&&s.includes(this.clearEl))return;const r=null===(i=null===(t=this.inputEl)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("label");if(r&&s.includes(r))return this.skipForwardedClick=!0,void window.setTimeout((()=>this.skipForwardedClick=!1));if(this.skipForwardedClick)return void(this.skipForwardedClick=!1);const n=this.fieldReference();n&&n!==this.inputEl&&!s.includes(n)||this.openCalendar(!1)},this.onTextInput=e=>{var t,i;if(e.stopPropagation(),this.text=(null!==(t=e.detail.value)&&void 0!==t?t:"")+"",!this.isOpen)return;const s=this.parseText(this.text);if(!s)return;const[r,n]=[this.startTime,this.endTime];if(null!==(i=this.timesBeforeTyping)&&void 0!==i||(this.timesBeforeTyping=[r,n]),this.loadDraft(s),this.timePicker){const e=this.resolvedFormat,t=this.resolvedLocale,i=this.range?ae(this.text,e,t):[ne(this.text,e,t)],s=this.parsedValue(),a=e=>{var t,r,n;return!(null===(t=null==i?void 0:i[e])||void 0===t?void 0:t.time)||(null===(r=i[e])||void 0===r?void 0:r.time)===(null===(n=null==s?void 0:s[e])||void 0===n?void 0:n.time)};a(0)&&(this.startTime=r),this.range&&a(1)&&(this.endTime=n)}this.showDate(s[s.length-1].date)},this.onTextChange=e=>{e.stopPropagation(),this.isOpen&&this.hasFooter?window.setTimeout((()=>{var e;this.isOpen&&(this.el.matches(":focus-within")||(null===(e=this.portal)||void 0===e?void 0:e.host.matches(":focus-within")))||this.commitPendingText()})):this.commitText()},this.onTextKeyDown=e=>{e.stopPropagation();const t=e.detail;if(t.altKey&&"ArrowDown"===t.key)t.preventDefault(),this.isOpen?(this.focusActiveDay=!0,this.flushActiveDayFocus()):this.openCalendar(!0);else if("Enter"===t.key&&this.isOpen){if(!this.hasFooter||this.text!==this.fieldText()&&!this.parseText(this.text))this.commitText();else{const e=this.draftParts();e&&this.commitParts(e)}this.textError||this.closeCalendar(!1)}else"Escape"===t.key&&this.isOpen&&(t.preventDefault(),t.stopPropagation(),this.restoreValueAtOpen(),this.closeCalendar(!1))},this.onTriggerKeyDown=e=>{var t;if(this.isOpen)return"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.restoreValueAtOpen(),void this.closeCalendar(!1)):void("Tab"!==e.key||e.shiftKey||"visible"!==(null===(t=this.dialogEl)||void 0===t?void 0:t.style.visibility)||(e.preventDefault(),this.focusActiveDay=!0,this.flushActiveDayFocus()))},this.onTriggerClick=()=>{this.isOpen?this.closeCalendar(!0):this.openCalendar(!0)},this.onDialogKeyDown=e=>{"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),this.restoreValueAtOpen(),this.closeCalendar(!0)):"Tab"===e.key&&this.trapTab(e)},this.onGridKeyDown=e=>{const t=$(this.activeDate);if(!t)return;const i="rtl"===getComputedStyle(this.el).direction,s=z(t,this.weekStart);let r=null;switch(e.key){case"ArrowLeft":r=L(t,i?1:-1);break;case"ArrowRight":r=L(t,i?-1:1);break;case"ArrowUp":r=L(t,-7);break;case"ArrowDown":r=L(t,7);break;case"Home":r=L(t,-s);break;case"End":r=L(t,6-s);break;case"PageUp":r=j(t,e.shiftKey?-12:-1);break;case"PageDown":r=j(t,e.shiftKey?12:1);break;case"Enter":case" ":return e.preventDefault(),this.pickDate(t),void(this.hasFooter&&(this.focusActiveDay=!0));default:return}e.preventDefault();const n=Y(r,this.minDate,this.maxDate);this.showDate(n),this.range&&(this.previewDate=A(n)),this.focusActiveDay=!0},this.onGridClick=e=>{const t=this.dayFromEvent(e);t&&this.pickDate(t)},this.onGridPointerOver=e=>{if(!this.range||!this.draftStart||this.draftEnd)return;const t=this.dayFromEvent(e),i=t&&A(t);i&&i!==this.previewDate&&(this.previewDate=i)}}async open(){this.openCalendar(!0)}async close(){this.closeCalendar(!1)}async setFocus(){var e;await(null===(e=this.inputEl)||void 0===e?void 0:e.setFocus())}valueChanged(){var e;this.committing||(this.valueAtOpen=null!==(e=this.value)&&void 0!==e?e:""),this.refreshFromValue()}contextChanged(){this.refreshFromValue()}placementChanged(){this.stopPositioning()}refreshFromValue(){var e;if(this.text=this.fieldText(),this.textError="",this.updateFormValue(),!this.isOpen)return;const t=this.parsedValue();this.loadDraft(t);const i=null!==(e=t&&t[t.length-1].date)&&void 0!==e?e:T();this.showDate(Y(i,this.minDate,this.maxDate),!0)}requiredChanged(){this.updateFormValue()}componentWillLoad(){this.text=this.fieldText()}connectedCallback(){this.el.attachInternals&&!this.internals&&(this.internals=this.el.attachInternals())}componentDidLoad(){this.updateFormValue()}disconnectedCallback(){var e;this.closeCalendar(!1),null===(e=this.portal)||void 0===e||e.remove()}componentDidRender(){var e,t;this.isOpen&&this.dialogEl?(null!==(t=this.portal)&&void 0!==t||(this.portal=new N(this.el)),this.portal.mount(this.dialogEl,this.resolvedLocale),this.cleanupAutoUpdate||this.startPositioning(),this.flushActiveDayFocus()):null===(e=this.portal)||void 0===e||e.remove()}flushActiveDayFocus(){var e,t;this.focusActiveDay&&"visible"===(null===(e=this.dialogEl)||void 0===e?void 0:e.style.visibility)&&(this.focusActiveDay=!1,null===(t=this.dialogEl.querySelector(`[data-date="${this.activeDate}"]`))||void 0===t||t.focus())}get baseId(){return this.componentId||this.fallbackId}get resolvedLocale(){return function(e){var t;try{return null!==(t=Intl.DateTimeFormat.supportedLocalesOf(e)[0])&&void 0!==t?t:"en-US"}catch(e){return"en-US"}}(this.locale||_(this.el))}get weekStart(){const e=this.firstDayOfWeek;return"number"==typeof e&&Number.isInteger(e)&&e>=0&&e<=6?e:function(e){var t,i,s;const r=Intl.Locale;if(!r)return 0;try{const n=new r(e),a=null!==(i=null===(t=n.getWeekInfo)||void 0===t?void 0:t.call(n).firstDay)&&void 0!==i?i:null===(s=n.weekInfo)||void 0===s?void 0:s.firstDay;return"number"==typeof a?a%7:0}catch(e){return 0}}(this.resolvedLocale)}get minDate(){return $(this.min)}get maxDate(){return $(this.max)}get isInteractive(){return!this.disabled&&!this.readonly}get monthCount(){const e="undefined"!=typeof window&&window.innerWidth<640;return this.range&&!e?2:1}get appliesOnPick(){return this.range&&this.autoApply&&!this.timePicker}get hasFooter(){return(this.range||this.timePicker)&&!this.appliesOnPick}get resolvedPresets(){return this.range?function(e,t){const i="string"==typeof e?e.split(",").map((e=>e.trim())).filter(Boolean).map((e=>({key:e}))):Array.isArray(e)?e:[],s=[];for(const e of i){if(!e||"string"!=typeof e.key)continue;const i="string"==typeof e.start?$(e.start):null,r="string"==typeof e.end?$(e.end):null,n=i&&r&&i<=r?[i,r]:q(e.key,t),a="string"==typeof e.label?e.label:U[e.key];n&&a&&s.push({key:e.key,label:a,start:n[0],end:n[1]})}return s}(this.presets,T()):[]}parsedValue(e=this.value){if(this.range){const[t,i,s]=(null!=e?e:"").split("/"),r=K(t),n=K(i);return void 0===s&&r&&n&&oe(r,n)<=0?[r,n]:null}const t=K(e);return t?[t]:null}get resolvedFormat(){return J(this.format,this.timePicker,this.timePicker&&ue(this.resolvedLocale).hour12)}fieldText(){var e;const t=this.parsedValue();return t?t.map((e=>le(this.withTimePicker(e),this.resolvedFormat,this.resolvedLocale))).join(ce):null!==(e=this.value)&&void 0!==e?e:""}withTimePicker(e,t=me){var i;return{date:e.date,time:this.timePicker?null!==(i=e.time)&&void 0!==i?i:t:null}}get fieldPlaceholder(){if(this.placeholder)return this.placeholder;const e=this.resolvedFormat;return this.range?`${e}${ce}${e}`:e}loadDraft(e){var t,i;const[s,r]=null!=e?e:[];this.draftStart=s?A(s.date):"",this.draftEnd=this.range&&r?A(r.date):"",this.startTime=null!==(t=null==s?void 0:s.time)&&void 0!==t?t:me,this.endTime=null!==(i=null==r?void 0:r.time)&&void 0!==i?i:be,this.previewDate=""}openCalendar(e){var t,i;if(!this.isInteractive||this.isOpen)return;const s=this.parsedValue();this.loadDraft(s),this.valueAtOpen=null!==(t=this.value)&&void 0!==t?t:"";const r=null!==(i=s&&s[s.length-1].date)&&void 0!==i?i:T();this.showDate(Y(r,this.minDate,this.maxDate),!0),this.focusActiveDay=e,this.isOpen=!0,document.addEventListener("pointerdown",this.onDocumentPointerDown,!0)}closeCalendar(e){var t;this.isOpen&&(this.commitPendingText(),this.timesBeforeTyping=void 0,this.isOpen=!1,this.stopPositioning(),document.removeEventListener("pointerdown",this.onDocumentPointerDown,!0),e&&(null===(t=this.triggerEl)||void 0===t||t.focus()))}showDate(e,t=!1){const i=ge(e),s=$(this.viewMonth),r=s&&j(s,this.monthCount-1);t||!s||i<s?this.viewMonth=A(t?j(i,1-this.monthCount):i):r&&i>r&&(this.viewMonth=A(j(i,1-this.monthCount))),this.activeDate=A(e)}pickDate(e){E(e,this.minDate,this.maxDate)||(this.dropTypedText(),this.range?this.pickRangeDay(e):this.timePicker?(this.draftStart=A(e),this.activeDate=this.draftStart):(this.commitValue(A(e)),this.closeCalendar(!0)))}pickRangeDay(e){const t=$(this.draftStart),i=A(e);!t||this.draftEnd?(this.draftStart=i,this.draftEnd=""):e<t?this.draftStart=i:this.draftEnd=i,this.previewDate="",this.activeDate=i,this.draftEnd&&this.appliesOnPick&&this.onApply()}commitValue(e,t={}){var i;const s=e!==(null!==(i=this.value)&&void 0!==i?i:"");this.timesBeforeTyping=void 0,this.committing=!0,this.value=e,this.committing=!1,this.text=this.fieldText(),this.textError="",this.updateFormValue(),s&&this.pdsDatepickerChange.emit(Object.assign({value:e},t))}commitParts(e){if(!this.range)return void this.commitValue(de(e[0]));const[t,i]=e,s=I(this.resolvedPresets,t.date,i.date);this.commitValue(`${de(t)}/${de(i)}`,Object.assign({start:de(t),end:de(i)},s?{preset:s.key}:{}))}draftParts(){var e;const t=$(this.draftStart);if(!t)return null;const i=this.withTimePicker({date:t,time:this.startTime});if(!this.range)return[i];const s=this.withTimePicker({date:null!==(e=$(this.draftEnd))&&void 0!==e?e:t,time:this.endTime});return[i,oe(s,i)<0?Object.assign(Object.assign({},s),{time:i.time}):s]}restoreValueAtOpen(){var e;if(this.valueAtOpen===(null!==(e=this.value)&&void 0!==e?e:""))return void this.dropTypedText();const t=this.parsedValue(this.valueAtOpen);t?this.commitParts(t):this.commitValue(this.valueAtOpen)}isInside(e){var t,i;return!!e&&(e===this.el||this.el.contains(e)||!!(null===(t=this.el.shadowRoot)||void 0===t?void 0:t.contains(e))||!!(null===(i=this.portal)||void 0===i?void 0:i.contains(e)))}focusEntered(e){this.hasFocus||(this.hasFocus=!0,this.pdsFocus.emit(e))}checkFocusLeft(e,t){window.setTimeout((()=>{var i;this.el.matches(":focus-within")||(null===(i=this.portal)||void 0===i?void 0:i.host.matches(":focus-within"))||(t&&this.closeCalendar(!1),this.hasFocus&&(this.hasFocus=!1,this.pdsBlur.emit(e)))}))}startPositioning(){const e=this.fieldReference(),t=this.dialogEl;e&&t&&(this.cleanupAutoUpdate=a(e,t,(()=>{o(e,t,{placement:this.placement,strategy:"fixed",middleware:[d(4),l({padding:8}),c({padding:8,apply({availableWidth:e,availableHeight:t,elements:i}){const s=window.innerHeight-16;Object.assign(i.floating.style,{maxHeight:Math.max(0,Math.max(t,Math.min(s,480)))+"px",maxWidth:Math.max(0,e)+"px"})}}),h({padding:8,crossAxis:!0}),p()]}).then((({x:e,y:i,middlewareData:s})=>{var r;const n=!!(null===(r=s.hide)||void 0===r?void 0:r.referenceHidden);Object.assign(t.style,{left:e+"px",top:i+"px",visibility:n?"hidden":"visible"}),this.flushActiveDayFocus()}))})))}stopPositioning(){var e;null===(e=this.cleanupAutoUpdate)||void 0===e||e.call(this),this.cleanupAutoUpdate=void 0}fieldReference(){var e,t,i;return null!==(i=null===(t=null===(e=this.inputEl)||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelector(".pds-input__field-wrapper"))&&void 0!==i?i:this.inputEl}commitPendingText(){if(this.text===this.fieldText())return;const e=this.parseText(this.text)?this.draftParts():null;e?this.commitParts(e):this.commitText()}readText(e){const t=this.resolvedFormat,i=this.resolvedLocale,s=this.range?ae(e,t,i):[ne(e,t,i)];return!s||s.some((e=>!e))?null:s.map(((e,t)=>this.withTimePicker(e,1===t?be:me)))}parseText(e){const t=this.readText(e);return t&&!this.rangeError(t)?t:null}rangeError(e){return this.minDate&&e.some((e=>e.date<this.minDate))?"min":this.maxDate&&e.some((e=>e.date>this.maxDate))?"max":""}valueError(){if(!this.value)return"";const e=this.parsedValue();return e?this.rangeError(e):"format"}commitText(){const e=this.text.trim();if(""===e)return void this.commitValue("");const t=this.readText(e),i=t?this.rangeError(t):"format";t&&!i?this.commitParts(t):(this.textError=i,this.updateFormValue())}canShowMonth(e){var t;const i=null!==(t=$(this.viewMonth))&&void 0!==t?t:T();return e<0?!this.minDate||L(i,-1)>=this.minDate:!this.maxDate||j(i,this.monthCount)<=this.maxDate}showMonth(e,t){var i,s;const r=null!==(i=$(this.viewMonth))&&void 0!==i?i:T(),n=null!==(s=$(this.activeDate))&&void 0!==s?s:T();this.viewMonth=A(j(r,t)),this.activeDate=A(Y(j(n,t),this.minDate,this.maxDate)),this.canShowMonth(t)?e.currentTarget.focus():this.focusActiveDay=!0}jumpTo(e,t,i){var s;const r=Y(new Date(Date.UTC(t,i,1)),this.minDate,this.maxDate);this.viewMonth=A(j(ge(r),-e));const n=null!==(s=$(this.activeDate))&&void 0!==s?s:r,a=Math.min(n.getUTCDate(),new Date(Date.UTC(t,i+1,0)).getUTCDate());this.activeDate=A(Y(new Date(Date.UTC(t,i,a)),this.minDate,this.maxDate))}dropTypedText(){this.timesBeforeTyping&&([this.startTime,this.endTime]=this.timesBeforeTyping),this.timesBeforeTyping=void 0,(this.text!==this.fieldText()||this.textError)&&(this.text=this.fieldText(),this.inputEl&&(this.inputEl.value=this.text),this.textError="",this.updateFormValue())}trapTab(e){var t,i,s,r;const n=Array.from(null!==(i=null===(t=this.dialogEl)||void 0===t?void 0:t.querySelectorAll('button:not([disabled]):not([tabindex="-1"]), select:not([disabled]), [data-date][tabindex="0"]'))&&void 0!==i?i:[]);if(0===n.length)return;const a=null===(r=null===(s=this.dialogEl)||void 0===s?void 0:s.getRootNode())||void 0===r?void 0:r.activeElement,o=n[0],d=n[n.length-1];e.shiftKey&&a===o?(e.preventDefault(),d.focus()):e.shiftKey||a!==d||(e.preventDefault(),o.focus())}dayFromEvent(e){var t,i;const s=null===(i=null===(t=e.target)||void 0===t?void 0:t.closest)||void 0===i?void 0:i.call(t,"[data-date]");return $(null==s?void 0:s.dataset.date)}updateFormValue(){var e,t,i,s;if(k()||!(null===(e=this.internals)||void 0===e?void 0:e.setFormValue))return;if(this.internals.setFormValue(this.value||null),!this.internals.setValidity)return;const r=null!==(s=null===(i=null===(t=this.inputEl)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input"))&&void 0!==s?s:void 0,n=this.textError||this.valueError();"format"===n?this.internals.setValidity({badInput:!0},this.invalidDateMessage,r):"min"===n?this.internals.setValidity({rangeUnderflow:!0},this.boundMessage(this.minDateMessage,this.minDate),r):"max"===n?this.internals.setValidity({rangeOverflow:!0},this.boundMessage(this.maxDateMessage,this.maxDate),r):this.required&&!this.value?this.internals.setValidity({valueMissing:!0},(null==r?void 0:r.validationMessage)||this.invalidDateMessage,r):this.internals.setValidity({})}boundMessage(e,t){const i=t?le({date:t,time:null},this.format||void 0,this.resolvedLocale):"";return y(e,{date:i})}formResetCallback(){this.value="",this.text="",this.textError="",this.closeCalendar(!1),this.updateFormValue()}interactivityChanged(){this.isInteractive||this.closeCalendar(!1)}formDisabledCallback(e){this.disabled=e,e&&this.closeCalendar(!1)}formStateRestoreCallback(e){"string"==typeof e&&(this.value=e)}triggerAccessibleName(e){const t=this.parsedValue();if(!t)return this.triggerLabel;const i=t.map((t=>F(t.date,e,ve)));return`${this.triggerLabel}, ${i.join(ce)}`}highlightedRange(){const e=$(this.draftStart),t=$(this.draftEnd);if(!e||t)return[e,t];const i=$(this.previewDate);return[e,i&&i>e?i:null]}selectedDay(){return this.range?null:$(this.draftStart)}renderMonthHeading(e,t,i,r){const n=F(e,i,{month:"long",year:"numeric"}),a=0===t?"polite":null;if(!this.showDropdowns)return s("div",{class:"pds-datepicker__heading",id:r,"aria-live":a},n);const o=e.getUTCFullYear(),d=e.getUTCMonth(),l=this.minDate,c=this.maxDate,h=T().getUTCFullYear(),p=l?l.getUTCFullYear():h-100,v=c?c.getUTCFullYear():h+100,m=S(i,{month:"long"}),b=S(i,{year:"numeric"});return s("div",{class:"pds-datepicker__dropdowns"},s("span",{class:"visually-hidden",id:r,"aria-live":a},n),s("span",{class:"pds-datepicker__select-wrap"},s("select",{class:"pds-datepicker__heading-select","aria-label":this.monthLabel,onChange:e=>this.jumpTo(t,o,Number(e.target.value))},Array.from({length:12},((e,t)=>{const i=!!l&&new Date(Date.UTC(o,t+1,0))<l||!!c&&new Date(Date.UTC(o,t,1))>c;return s("option",{value:t+"",selected:t===d,disabled:i},m.format(new Date(Date.UTC(o,t,1))))}))),s("pds-icon",{class:"pds-datepicker__select-caret",icon:u,size:"small","aria-hidden":"true"})),s("span",{class:"pds-datepicker__select-wrap"},s("select",{class:"pds-datepicker__heading-select","aria-label":this.yearLabel,onChange:e=>this.jumpTo(t,Number(e.target.value),d)},Array.from({length:Math.max(v,o)-Math.min(p,o)+1},((e,t)=>{const i=Math.min(p,o)+t;return s("option",{value:i+"",selected:i===o},b.format(new Date(Date.UTC(i,0,1))))}))),s("pds-icon",{class:"pds-datepicker__select-caret",icon:u,size:"small","aria-hidden":"true"})))}renderMonth(e,t,i){const r=e.getUTCFullYear(),n=e.getUTCMonth(),a=this.minDate,o=this.maxDate,d=this.selectedDay(),[l,c]=this.range?this.highlightedRange():[null,null],h=T(),p=S(i,ve),u=S(i,{day:"numeric"}),b=`${this.baseId}-calendar-heading-${t}`,f=t===this.monthCount-1;return s("div",{class:"pds-datepicker__month"},s("div",{class:"pds-datepicker__header"},0===t?s("button",{type:"button",class:"pds-datepicker__nav pds-datepicker__nav--previous","aria-label":this.previousMonthLabel,disabled:!this.canShowMonth(-1),onClick:e=>this.showMonth(e,-1)},s("pds-icon",{icon:v,"aria-hidden":"true"})):s("span",{class:"pds-datepicker__nav-spacer"}),this.renderMonthHeading(e,t,i,b),f?s("button",{type:"button",class:"pds-datepicker__nav pds-datepicker__nav--next","aria-label":this.nextMonthLabel,disabled:!this.canShowMonth(1),onClick:e=>this.showMonth(e,1)},s("pds-icon",{icon:m,"aria-hidden":"true"})):s("span",{class:"pds-datepicker__nav-spacer"})),s("table",{class:"pds-datepicker__grid",role:"grid","aria-labelledby":b,"aria-multiselectable":this.range?"true":null,onKeyDown:this.onGridKeyDown,onClick:this.onGridClick,onPointerOver:this.onGridPointerOver},s("thead",null,s("tr",null,function(e,t){const i=S(e,{weekday:"short"}),s=S(e,{weekday:"long"}),r=Array.from({length:7},((e,i)=>new Date(Date.UTC(2023,0,1+(t+i)%7)))),n=r.map((e=>i.format(e).replace(/\.$/,""))),a=n.every((e=>/^[A-Za-z\u00C0-\u024F]+$/.test(e))),o=n.map((e=>e.slice(0,2))),d=a&&7===new Set(o.map((e=>e.toLowerCase()))).size;return r.map(((e,t)=>({short:d?o[t]:i.format(e),long:s.format(e)})))}(i,this.weekStart).map((e=>s("th",{scope:"col",class:"pds-datepicker__weekday"},s("span",{"aria-hidden":"true"},e.short),s("span",{class:"visually-hidden"},e.long)))))),s("tbody",null,function(e,t,i){const s=new Date(Date.UTC(e,t,1)),r=Array(z(s,i)).fill(null);for(let i=1;i<=P(e,t);i++)r.push(new Date(Date.UTC(e,t,i)));for(;r.length%7!=0;)r.push(null);const n=[];for(let e=0;e<r.length;e+=7)n.push(r.slice(e,e+7));return n}(r,n,this.weekStart).map((e=>s("tr",null,e.map(((e,t)=>{if(!e)return s("td",{class:"pds-datepicker__day pds-datepicker__day--empty"});const i=A(e),r=E(e,a,o),n=H(e,l)||H(e,c),v=!!l&&!!c&&!H(l,c),m=!!l&&!!c&&e>=l&&e<=c,b=H(e,d)||n||m,f=H(e,h);return s("td",{class:{"pds-datepicker__day":!0,"pds-datepicker__day--selected":H(e,d)||n,"pds-datepicker__day--in-range":m&&!n,"pds-datepicker__day--range-start":v&&H(e,l),"pds-datepicker__day--range-end":v&&H(e,c),"pds-datepicker__day--row-start":m&&0===t,"pds-datepicker__day--row-end":m&&6===t,"pds-datepicker__day--today":f,"pds-datepicker__day--disabled":r},"data-date":i,tabindex:i===this.activeDate?"0":"-1","aria-label":p.format(e),"aria-selected":b?"true":null,"aria-current":f?"date":null,"aria-disabled":r?"true":null},((e,t)=>{var i,s;return null!==(s=null===(i=e.formatToParts(t).find((e=>"day"===e.type)))||void 0===i?void 0:i.value)&&void 0!==s?s:e.format(t)})(u,e))}))))))),this.timePicker&&this.timesUnderMonth(t).map((e=>this.renderTime(e,i))))}timesUnderMonth(e){return this.range?1===this.monthCount?["start","end"]:[0===e?"start":"end"]:["start"]}renderTime(e,t){var i,r,n;const a="start"===e?this.startTime:null!==(n=null===(r=null===(i=this.draftParts())||void 0===i?void 0:i[1])||void 0===r?void 0:r.time)&&void 0!==n?n:this.endTime,[o,d]=he(a),l=ue(t),c=Math.max(1,Math.min(60,Math.floor(this.minuteIncrement)||1)),h=(t,i)=>{const s=pe(t,i);"start"===e?this.startTime=s:this.endTime=s,this.timesBeforeTyping&&(this.timesBeforeTyping["start"===e?0:1]=s)},p=this.range?"start"===e?this.startTimeLabel:this.endTimeLabel:this.timeLabel,u=o>=12,v=l.hour12?Array.from({length:12},((e,t)=>t+1)):Array.from({length:24},((e,t)=>t)),m=l.hour12?o%12||12:o,b=Array.from({length:Math.ceil(60/c)},((e,t)=>t*c));b.includes(d)||b.push(d),b.sort(((e,t)=>e-t));const f=`${this.baseId}-time-${e}`;return s("div",{class:"pds-datepicker__time",role:"group","aria-labelledby":f},s("span",{class:"pds-datepicker__time-label",id:f},p),s("span",{class:"pds-datepicker__time-field"},s("select",{class:"pds-datepicker__time-select","aria-label":this.hourLabel,onChange:e=>{const t=Number(e.target.value);h(l.hour12?t%12+(u?12:0):t,d)}},v.map((e=>s("option",{value:e+"",selected:e===m},l.hour12?e+"":(e+"").padStart(2,"0"))))),s("span",{class:"pds-datepicker__time-separator","aria-hidden":"true"},":"),s("select",{class:"pds-datepicker__time-select","aria-label":this.minuteLabel,onChange:e=>h(o,Number(e.target.value))},b.map((e=>s("option",{value:e+"",selected:e===d},(e+"").padStart(2,"0"))))),l.hour12&&s("select",{class:"pds-datepicker__time-select pds-datepicker__time-select--period","aria-label":this.periodLabel,onChange:e=>{h(o%12+("pm"===e.target.value?12:0),d)}},s("option",{value:"am",selected:!u},l.am),s("option",{value:"pm",selected:u},l.pm))))}renderPresets(){var e;const t=this.resolvedPresets;if(0===t.length)return null;const i=I(t,$(this.draftStart),$(this.draftEnd)),r=!i&&!!this.draftStart,n=e=>R(e,this.minDate,this.maxDate),a=i&&n(i)?i:r?"custom":null!==(e=t.find(n))&&void 0!==e?e:"custom";return s("div",{class:"pds-datepicker__presets-column"},s("ul",{class:"pds-datepicker__presets",part:"presets",role:"radiogroup","aria-label":this.presetsLabel,onKeyDown:this.onPresetsKeyDown},t.map((e=>{const t=e===i;return s("li",{role:"none"},s("button",{type:"button",role:"radio",class:{"pds-datepicker__preset":!0,"pds-datepicker__preset--selected":t},"aria-checked":t?"true":"false",tabindex:e===a?"0":"-1",disabled:!R(e,this.minDate,this.maxDate),onClick:t=>this.onPresetClick(t,e)},s("span",null,e.label),t&&s("pds-icon",{icon:b,"aria-hidden":"true"})))})),s("li",{role:"none"},s("button",{type:"button",role:"radio",class:{"pds-datepicker__preset":!0,"pds-datepicker__preset--selected":r},"aria-checked":r?"true":"false",tabindex:"custom"===a?"0":"-1",onClick:this.onCustomRangeClick},s("span",null,this.customRangeLabel),r&&s("pds-icon",{icon:b,"aria-hidden":"true"})))))}selectionText(){const e=this.draftParts();if(!e)return"";const t=this.resolvedFormat,i=this.resolvedLocale;return this.range&&!this.draftEnd?`${le(e[0],t,i)}${ce}`:e.map((e=>le(e,t,i))).join(ce)}renderFooter(){const e=this.draftParts(),t=this.selectionText();return s("div",{class:"pds-datepicker__footer"},s("span",{class:"pds-datepicker__selection","aria-live":"polite"},t),s("button",{type:"button",class:"pds-datepicker__action",onClick:this.onCancel},this.clearable?this.clearLabel:this.cancelLabel),s("button",{type:"button",class:"pds-datepicker__action pds-datepicker__action--primary",disabled:!e,onClick:this.onApply},this.applyLabel))}renderCalendar(e){var t;const i=null!==(t=$(this.viewMonth))&&void 0!==t?t:T(),r=Array.from({length:this.monthCount},((e,t)=>j(i,t)));return s("div",{class:{"pds-datepicker__dialog":!0,"pds-datepicker__dialog--range":this.range},id:this.baseId+"-calendar",role:"dialog",tabindex:"-1","aria-labelledby":this.range?null:this.baseId+"-calendar-heading-0","aria-label":this.range?this.label||this.triggerLabel:null,part:"calendar",ref:e=>this.dialogEl=e,onKeyDown:this.onDialogKeyDown,onFocusin:this.onCalendarFocusIn,onFocusout:this.onCalendarFocusOut},this.range&&this.renderPresets(),s("div",{class:"pds-datepicker__panel"},s("div",{class:"pds-datepicker__months"},r.map(((t,i)=>this.renderMonth(t,i,e)))),this.hasFooter&&this.renderFooter(),this.appliesOnPick&&s("span",{class:"visually-hidden","aria-live":"polite"},this.selectionText())))}render(){const e=this.resolvedLocale;return s(r,{key:"a761f0ca6eeedcac3e4bd90760aa9781cd37dcdc",class:{"pds-datepicker--range":this.range,"pds-datepicker--time":this.timePicker},"full-width":this.fullWidth?"true":null,onFocusin:this.onHostFocusIn,onFocusout:this.onHostFocusOut},s("pds-input",{key:"2eb04f9fd4e2f7a2437145d250c629c2cc8a0bf6",ref:e=>this.inputEl=e,componentId:this.baseId,label:this.label,hideLabel:this.hideLabel,helperMessage:this.helperMessage,errorMessage:this.errorMessage,invalid:this.invalid||!!this.textError||!!this.valueError(),disabled:this.disabled,readonly:this.readonly,required:this.required,placeholder:this.fieldPlaceholder,fullWidth:this.fullWidth,autocomplete:"off",value:this.text,onClick:this.onFieldClick,onPdsInput:this.onTextInput,onPdsChange:this.onTextChange,onPdsKeyDown:this.onTextKeyDown,onPdsFocus:this.stopInnerEvent,onPdsBlur:this.stopInnerEvent},this.clearable&&!!this.value&&this.isInteractive&&s("button",{key:"clear",slot:"suffix",type:"button",class:"pds-datepicker__clear",ref:e=>this.clearEl=e,"aria-label":this.label?`${this.clearLabel} ${this.label}`:this.clearLabel,tabindex:"-1",onMouseDown:this.onClearMouseDown,onClick:this.onClearClick},s("pds-icon",{key:"98c325fbba8ea78b2d409bc77099db3206738508",icon:f,"aria-hidden":"true"})),s("button",{key:"trigger",slot:"suffix",type:"button",class:"pds-datepicker__trigger",ref:e=>this.triggerEl=e,"aria-label":this.triggerAccessibleName(e),"aria-haspopup":"dialog","aria-expanded":this.isOpen?"true":"false",disabled:!this.isInteractive,onClick:this.onTriggerClick,onKeyDown:this.onTriggerKeyDown},s("pds-icon",{key:"cb8483febe1b485058b7bb4271b749981a7747a1",icon:g,"aria-hidden":"true"}))),this.isOpen&&this.renderCalendar(e))}static get formAssociated(){return!0}get el(){return this}static get watchers(){return{value:[{valueChanged:0}],format:[{contextChanged:0}],locale:[{contextChanged:0}],timePicker:[{contextChanged:0}],range:[{contextChanged:0}],min:[{contextChanged:0}],max:[{contextChanged:0}],placement:[{placementChanged:0}],required:[{requiredChanged:0}],disabled:[{interactivityChanged:0}],readonly:[{interactivityChanged:0}]}}static get style(){return':host{--pds-datepicker-day-size:var(--pine-dimension-500);--pds-datepicker-presets-width:200px;display:inline-block}:host([full-width]){display:block}pds-input{display:block}:host(.pds-datepicker--time) pds-input{min-width:220px}:host(.pds-datepicker--range) pds-input{min-width:260px}:host(.pds-datepicker--range.pds-datepicker--time) pds-input{min-width:min(380px, 100%)}.pds-datepicker__trigger,.pds-datepicker__clear{-ms-flex-align:center;align-items:center;background:transparent;border:0;border-radius:var(--pine-border-radius-sm);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;padding:var(--pine-dimension-2xs)}.pds-datepicker__trigger:hover:not(:disabled),.pds-datepicker__clear:hover:not(:disabled){background:var(--pine-color-background-muted);color:var(--pine-color-text-strong)}.pds-datepicker__trigger:focus-visible,.pds-datepicker__clear:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__trigger:disabled,.pds-datepicker__clear:disabled{color:var(--pine-color-text-disabled);cursor:not-allowed}.pds-datepicker__clear{-webkit-margin-end:var(--pine-dimension-2xs);margin-inline-end:var(--pine-dimension-2xs)}.pds-datepicker__nav{-ms-flex-align:center;align-items:center;background:var(--pine-color-secondary);border:var(--pine-border);border-radius:var(--pine-border-radius-full);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;height:var(--pine-dimension-400);-ms-flex-pack:center;justify-content:center;padding:0;width:var(--pine-dimension-400)}.pds-datepicker__nav:hover:not(:disabled){background:var(--pine-color-secondary-hover);border-color:var(--pine-color-border-hover)}.pds-datepicker__nav:focus-visible{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__nav:disabled{border-color:var(--pine-color-border-disabled);color:var(--pine-color-text-secondary-disabled);cursor:not-allowed}.pds-datepicker__nav:dir(rtl) pds-icon{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.pds-datepicker__dialog:focus{outline:none}.pds-datepicker__dialog{background:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-150);-webkit-box-shadow:var(--pine-box-shadow-200);box-shadow:var(--pine-box-shadow-200);-webkit-box-sizing:border-box;box-sizing:border-box;left:0;max-height:calc(100vh - var(--pine-dimension-sm));max-height:calc(100dvh - var(--pine-dimension-sm));max-width:calc(100vw - var(--pine-dimension-sm));overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain;padding:var(--pine-dimension-sm);pointer-events:auto;position:fixed;top:0;visibility:hidden;z-index:var(--pine-z-index-priority)}:host-context([data-theme=dark]) .pds-datepicker__dialog{border:var(--pine-border)}.pds-datepicker__header{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-webkit-margin-after:var(--pine-dimension-sm);margin-block-end:var(--pine-dimension-sm)}.pds-datepicker__nav-spacer{-ms-flex:none;flex:none;width:var(--pine-dimension-400)}.pds-datepicker__heading{color:var(--pine-color-text);font:var(--pine-typography-heading-5);font-weight:var(--pine-font-weight-semi-bold)}.pds-datepicker__grid{border-collapse:collapse;border-spacing:0}.pds-datepicker__weekday{color:var(--pine-color-text-muted);font:var(--pine-typography-body-sm);height:var(--pds-datepicker-day-size);padding:0;text-align:center;width:var(--pds-datepicker-day-size)}.pds-datepicker__day{border-radius:var(--pine-border-radius-full);color:var(--pine-color-text-secondary);cursor:pointer;font:var(--pine-typography-body);height:var(--pds-datepicker-day-size);padding:0;position:relative;text-align:center;-webkit-transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);width:var(--pds-datepicker-day-size)}.pds-datepicker__day:hover{background:var(--pine-color-background-muted)}.pds-datepicker__day:focus-visible{outline:var(--pine-outline-focus);outline-offset:calc(var(--pine-border-width-thick) * -1)}.pds-datepicker__day--empty{cursor:default;pointer-events:none}.pds-datepicker__day--today::after{background:var(--pine-color-primary);border-radius:var(--pine-border-radius-full);content:"";height:var(--pine-dimension-050);inset-block-end:var(--pine-dimension-050);inset-inline-start:50%;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:var(--pine-dimension-050)}.pds-datepicker__day--selected,.pds-datepicker__day--selected:hover{background:var(--pine-color-primary);color:var(--pine-color-text-primary)}.pds-datepicker__day--selected:focus-visible{outline-offset:var(--pine-border-width)}.pds-datepicker__day--range-start{border-end-end-radius:0;border-start-end-radius:0}.pds-datepicker__day--range-end{border-end-start-radius:0;border-start-start-radius:0}.pds-datepicker__day--range-start.pds-datepicker__day--row-end{border-end-end-radius:var(--pine-border-radius-full);border-start-end-radius:var(--pine-border-radius-full)}.pds-datepicker__day--range-end.pds-datepicker__day--row-start{border-end-start-radius:var(--pine-border-radius-full);border-start-start-radius:var(--pine-border-radius-full)}.pds-datepicker__day--selected.pds-datepicker__day--today::after{background:var(--pine-color-text-primary)}.pds-datepicker__day--in-range{border-radius:0}.pds-datepicker__day--in-range,.pds-datepicker__day--in-range:hover{background:var(--pine-color-background-muted);color:var(--pine-color-text-secondary)}.pds-datepicker__day--row-start{border-end-start-radius:var(--pine-border-radius-full);border-start-start-radius:var(--pine-border-radius-full)}.pds-datepicker__day--row-end{border-end-end-radius:var(--pine-border-radius-full);border-start-end-radius:var(--pine-border-radius-full)}.pds-datepicker__day--disabled,.pds-datepicker__day--disabled:hover{background:transparent;color:var(--pine-color-text-disabled);cursor:not-allowed;text-decoration:line-through}.pds-datepicker__day--in-range:hover{background:var(--pine-color-background-inset)}.pds-datepicker__dialog--range{display:-ms-flexbox;display:flex;padding:0}.pds-datepicker__panel{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:0}.pds-datepicker__dialog--range .pds-datepicker__panel{padding:var(--pine-dimension-sm)}.pds-datepicker__months{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--pine-dimension-lg)}.pds-datepicker__presets-column{-webkit-border-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-inline-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);-ms-flex:none;flex:none;position:relative;width:var(--pds-datepicker-presets-width)}.pds-datepicker__presets{-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--pine-dimension-2xs);inset:0;list-style:none;margin:0;overflow-y:auto;padding:var(--pine-dimension-150);position:absolute}.pds-datepicker__preset{-ms-flex-align:center;align-items:center;background:transparent;border:0;border-radius:var(--pine-border-radius-md);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body);gap:var(--pine-dimension-xs);-ms-flex-pack:justify;justify-content:space-between;padding:var(--pine-dimension-xs) var(--pine-dimension-sm);text-align:start;-webkit-transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);transition:background var(--pine-motion-duration-fast) var(--pine-motion-easing-in);width:100%}.pds-datepicker__preset:hover:not(:disabled){background:var(--pine-color-background-muted)}.pds-datepicker__preset:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__preset:disabled{color:var(--pine-color-text-disabled);cursor:not-allowed}.pds-datepicker__preset--selected{background:var(--pine-color-background-muted);color:var(--pine-color-text-active)}.pds-datepicker__footer{-ms-flex-align:center;align-items:center;background:var(--pine-color-background-overlay);-webkit-border-before:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-block-start:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:var(--pine-dimension-xs);inset-block-end:calc(var(--pine-dimension-sm) * -1);-ms-flex-pack:end;justify-content:flex-end;margin-block:var(--pine-dimension-sm) calc(var(--pine-dimension-sm) * -1);padding-block:var(--pine-dimension-sm);position:-webkit-sticky;position:sticky}.pds-datepicker__selection{color:var(--pine-color-text-muted);font:var(--pine-typography-body-sm-medium);-webkit-margin-end:auto;margin-inline-end:auto}.pds-datepicker__dropdowns{display:-ms-flexbox;display:flex;gap:var(--pine-dimension-2xs)}.pds-datepicker__select-wrap{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;position:relative}.pds-datepicker__heading-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-border-radius-md);color:var(--pine-color-text);cursor:pointer;field-sizing:content;font:var(--pine-typography-heading-5);font-weight:var(--pine-font-weight-semi-bold);padding-block:var(--pine-dimension-2xs);padding-inline:var(--pine-dimension-xs) calc(var(--pine-dimension-xs) + var(--pine-dimension-sm))}.pds-datepicker__heading-select:hover{background:var(--pine-color-background-muted)}.pds-datepicker__heading-select:focus-visible{outline:var(--pine-outline-focus)}.pds-datepicker__select-caret{color:var(--pine-color-text-secondary);inset-inline-end:var(--pine-dimension-xs);pointer-events:none;position:absolute}.pds-datepicker__time{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs);-ms-flex-pack:justify;justify-content:space-between;-webkit-margin-before:var(--pine-dimension-sm);margin-block-start:var(--pine-dimension-sm);padding-inline:var(--pine-dimension-xs)}.pds-datepicker__time-label{color:var(--pine-color-text-label);font:var(--pine-typography-body-medium)}.pds-datepicker__time-field{-ms-flex-align:center;align-items:center;background:var(--pine-color-background-container);border:var(--pine-border);border-radius:var(--pine-border-radius-md);display:-ms-inline-flexbox;display:inline-flex;min-height:var(--pine-dimension-400);padding-inline:var(--pine-dimension-2xs)}.pds-datepicker__time-field:hover{border-color:var(--pine-color-border-hover)}.pds-datepicker__time-field:focus-within{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__time-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-border-radius-sm);color:var(--pine-color-text-strong);cursor:pointer;font:var(--pine-typography-body);font-variant-numeric:tabular-nums;padding:var(--pine-dimension-2xs);text-align:center}.pds-datepicker__time-select:focus-visible{background:var(--pine-color-background-muted);outline:none}.pds-datepicker__time-select--period{-webkit-margin-start:var(--pine-dimension-2xs);margin-inline-start:var(--pine-dimension-2xs)}.pds-datepicker__time-separator{color:var(--pine-color-text-secondary)}:host-context([data-theme=dark]) select{color-scheme:dark}.pds-datepicker__action{background:var(--pine-color-secondary);border:var(--pine-border);border-radius:var(--pine-border-radius-full);color:var(--pine-color-text-secondary);cursor:pointer;font:var(--pine-typography-body-medium);padding:calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-sm)}.pds-datepicker__action:hover:not(:disabled){background:var(--pine-color-secondary-hover);border-color:var(--pine-color-border-hover)}.pds-datepicker__action:focus-visible{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-datepicker__action:disabled{background:var(--pine-color-secondary-disabled);border-color:var(--pine-color-border-disabled);color:var(--pine-color-text-secondary-disabled);cursor:not-allowed}.pds-datepicker__action--primary{background:var(--pine-color-primary);border-color:var(--pine-color-primary);color:var(--pine-color-text-primary)}.pds-datepicker__action--primary:hover:not(:disabled){background:var(--pine-color-primary-hover);border-color:var(--pine-color-primary-hover)}.pds-datepicker__action--primary:disabled{background:var(--pine-color-primary-disabled);border-color:var(--pine-color-primary-disabled);color:var(--pine-color-text-primary-disabled)}@media (max-width: 600px){.pds-datepicker__dialog--range{-ms-flex-direction:column;flex-direction:column}.pds-datepicker__presets-column{-webkit-border-after:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);border-block-end:var(--pine-border-width-thin) solid var(--pine-color-border-subtle);-webkit-border-end:0;border-inline-end:0;width:auto}.pds-datepicker__presets{-ms-flex-direction:row;flex-direction:row;overflow-x:auto;position:static}.pds-datepicker__preset{white-space:nowrap}.pds-datepicker__selection{-ms-flex-preferred-size:100%;flex-basis:100%}}.pds-datepicker__trigger,.pds-datepicker__clear,.pds-datepicker__nav,.pds-datepicker__weekday,.pds-datepicker__day,.pds-datepicker__preset,.pds-datepicker__action{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media (forced-colors: active){.pds-datepicker__day--selected,.pds-datepicker__day--selected:hover{background:Highlight;color:HighlightText;forced-color-adjust:none}.pds-datepicker__day--in-range,.pds-datepicker__day--in-range:hover{border-block:var(--pine-border-width-thin) solid Highlight}.pds-datepicker__day--today::after{background:CanvasText;forced-color-adjust:none}.pds-datepicker__day--selected.pds-datepicker__day--today::after{background:HighlightText}.pds-datepicker__day--disabled{color:GrayText}}.visually-hidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:polygon(0 0, 0 0, 0 0);clip-path:polygon(0 0, 0 0, 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}'}},[65,"pds-datepicker",{applyLabel:[1,"apply-label"],autoApply:[4,"auto-apply"],cancelLabel:[1,"cancel-label"],clearable:[4],clearLabel:[1,"clear-label"],componentId:[1,"component-id"],customRangeLabel:[1,"custom-range-label"],disabled:[4],endTimeLabel:[1,"end-time-label"],errorMessage:[1,"error-message"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],fullWidth:[4,"full-width"],helperMessage:[1,"helper-message"],hideLabel:[4,"hide-label"],hourLabel:[1,"hour-label"],invalid:[4],invalidDateMessage:[1,"invalid-date-message"],maxDateMessage:[1,"max-date-message"],minDateMessage:[1,"min-date-message"],label:[1],locale:[1],max:[1],min:[1],minuteIncrement:[2,"minute-increment"],minuteLabel:[1,"minute-label"],monthLabel:[1,"month-label"],name:[1],nextMonthLabel:[1,"next-month-label"],periodLabel:[1,"period-label"],placeholder:[1],placement:[1],presets:[1],presetsLabel:[1,"presets-label"],previousMonthLabel:[1,"previous-month-label"],range:[4],readonly:[4],required:[4],showDropdowns:[4,"show-dropdowns"],startTimeLabel:[1,"start-time-label"],timePicker:[4,"time-picker"],timeLabel:[1,"time-label"],triggerLabel:[1,"trigger-label"],value:[1025],yearLabel:[1,"year-label"],isOpen:[32],text:[32],textError:[32],activeDate:[32],viewMonth:[32],draftStart:[32],draftEnd:[32],startTime:[32],endTime:[32],previewDate:[32],open:[64],close:[64],setFocus:[64]},void 0,{value:[{valueChanged:0}],format:[{contextChanged:0}],locale:[{contextChanged:0}],timePicker:[{contextChanged:0}],range:[{contextChanged:0}],min:[{contextChanged:0}],max:[{contextChanged:0}],placement:[{placementChanged:0}],required:[{requiredChanged:0}],disabled:[{interactivityChanged:0}],readonly:[{interactivityChanged:0}]}]),_e=ke,ye=function(){"undefined"!=typeof customElements&&["pds-datepicker","pds-icon","pds-input"].forEach((e=>{switch(e){case"pds-datepicker":customElements.get(n(e))||customElements.define(n(e),ke);break;case"pds-icon":customElements.get(n(e))||D();break;case"pds-input":customElements.get(n(e))||M()}}))};export{_e as PdsDatepicker,ye as defineCustomElement}
@@ -1 +1 @@
1
- import{proxyCustomElement as e,HTMLElement as t,h as i,Host as s,transformTag as n}from"@stencil/core/internal/client";import{s as o}from"./attributes.js";import{l as d}from"./keep-hydrated.js";import{a as r,c as a,o as h,f as l,s as p}from"./floating-ui.dom.js";import{d as c}from"./pds-box2.js";const m=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.isOpen=!1,this.menuItems=[],this.cleanupAutoUpdate=null,this.triggerObserver=null,this.currentFocusIndex=-1,this.hasHeader=!1,this.placement="bottom-start",this.handleTriggerSlotChange=e=>{this.slotEl=e.target;const t=this.slotEl.assignedElements();this.triggerEl=t[0],this.triggerEl&&(this.triggerEl.onclick=this.handleClick,this.syncTriggerAria()),this.observeTrigger()},this.syncTriggerAria=()=>!!this.triggerEl&&o(this.triggerEl,{"aria-haspopup":"menu","aria-expanded":this.isOpen+""}),this.handleHeaderSlotChange=e=>{this.hasHeader=e.target.assignedElements().length>0},this.handleSlotChange=e=>{this.slotEl=e.target;const t=this.slotEl.assignedElements(),i=["pds-dropdown-menu-item","pds-dropdown-menu-separator","a","button"],s=t.filter((e=>!i.includes(e.tagName.toLowerCase())));if(s.length>0){const e=s.map((e=>e.tagName.toLowerCase())).join(", ");console.warn(`pds-dropdown-menu: Unexpected element(s) found: ${e}. Expected: `+i.join(", "))}this.menuItems=t.filter((e=>{const t=e.tagName.toLowerCase();return"pds-dropdown-menu-item"===t||"a"===t||"button"===t}))},this.toggleDropdown=()=>{this.isOpen=!this.isOpen,this.isOpen?this.openDropdown():this.closeDropdown()},this.openDropdown=()=>{var e;const t=()=>{a(this.triggerEl,this.panelEl,{placement:this.placement,strategy:"fixed",middleware:[h(6),l(),p({padding:5})]}).then((({x:e,y:t})=>{Object.assign(this.panelEl.style,{left:e+"px",top:t+"px"})}))};t(),this.cleanupAutoUpdate=r(this.triggerEl,this.panelEl,t),null===(e=this.host.shadowRoot)||void 0===e||e.querySelector("pds-box").classList.remove("is-hidden"),this.isOpen=!0,this.syncTriggerAria()},this.closeDropdown=()=>{var e;null===(e=this.host.shadowRoot)||void 0===e||e.querySelector("pds-box").classList.add("is-hidden"),this.isOpen=!1,this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),this.syncTriggerAria(),this.currentFocusIndex=-1,this.isFocusInMenu()&&this.triggerEl.focus()},this.handleClick=()=>{this.toggleDropdown()}}componentWillLoad(){this.hasHeader=Array.from(this.host.children).some((e=>"header"===e.getAttribute("slot")))}componentDidRender(){var e;this.panelEl=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector("pds-box")}connectedCallback(){this.observeTrigger(),this.syncTriggerAria()}disconnectedCallback(){var e;this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),null===(e=this.triggerObserver)||void 0===e||e.disconnect(),this.triggerObserver=null}observeTrigger(){var e;null===(e=this.triggerObserver)||void 0===e||e.disconnect(),this.triggerObserver=null,this.triggerEl&&"undefined"!=typeof MutationObserver&&(this.triggerObserver=new MutationObserver(d(this.syncTriggerAria,"pds-dropdown-menu: stopped restoring its trigger ARIA, as another script keeps changing it. It may be wrong until the menu opens or closes.",this.triggerEl)),this.triggerObserver.observe(this.triggerEl,{attributes:!0,attributeFilter:["aria-haspopup","aria-expanded"]}))}isFocusInMenu(){const e=this.host.getRootNode().activeElement;return null!=e&&this.host.contains(e)}isItemDisabled(e){const t=e.tagName.toLowerCase();return"pds-dropdown-menu-item"===t||"button"===t?e.disabled:"a"===t&&"true"===e.getAttribute("aria-disabled")}getFocusedItemIndex(){const e=document.activeElement;return e?this.menuItems.findIndex((t=>{if(t===e)return!0;if("pds-dropdown-menu-item"===t.tagName.toLowerCase()){const i=t.shadowRoot;if(null==i?void 0:i.contains(e))return!0}return!1})):-1}focusItemByIndex(e){var t,i,s,n,o;if(e>=0&&e<this.menuItems.length){this.currentFocusIndex=e;const d=this.menuItems[e];if("pds-dropdown-menu-item"===d.tagName.toLowerCase()){const e=d,r=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector('button, [role="menuitem"]'),a=(null===(n=null===(s=null===(i=e.shadowRoot)||void 0===i?void 0:i.querySelector("pds-link"))||void 0===s?void 0:s.shadowRoot)||void 0===n?void 0:n.querySelector("a"))||(null===(o=e.shadowRoot)||void 0===o?void 0:o.querySelector("a"));r?r.focus():a?a.focus():e.focus()}else d.focus()}}focusNextItem(){let e=(this.currentFocusIndex+1)%this.menuItems.length,t=0;const i=this.menuItems.length;for(;t<i&&this.isItemDisabled(this.menuItems[e]);)e=(e+1)%this.menuItems.length,t++;t<i&&this.focusItemByIndex(e)}focusPreviousItem(){let e=this.currentFocusIndex<=0?this.menuItems.length-1:this.currentFocusIndex-1,t=0;const i=this.menuItems.length;for(;t<i&&this.isItemDisabled(this.menuItems[e]);)e=e<=0?this.menuItems.length-1:e-1,t++;t<i&&this.focusItemByIndex(e)}handleEscapeKeyDown(e){this.isOpen&&"Escape"===e.key&&!e.defaultPrevented&&(e.preventDefault(),this.closeDropdown())}handleKeyDown(e){if(this.isOpen)switch(e.key){case"ArrowDown":e.preventDefault(),this.focusNextItem();break;case"ArrowUp":e.preventDefault(),this.focusPreviousItem();break;case"Home":if(e.preventDefault(),this.menuItems.length>0){let e=0;for(;e<this.menuItems.length&&this.isItemDisabled(this.menuItems[e]);)e++;e<this.menuItems.length&&this.focusItemByIndex(e)}break;case"End":if(e.preventDefault(),this.menuItems.length>0){let e=this.menuItems.length-1;for(;e>=0&&this.isItemDisabled(this.menuItems[e]);)e--;e>=0&&this.focusItemByIndex(e)}break;case"Tab":if(e.shiftKey)this.getFocusedItemIndex()>0&&(e.preventDefault(),this.focusPreviousItem());else{const t=document.activeElement===this.triggerEl,i=this.getFocusedItemIndex();if(t&&this.menuItems.length>0){e.preventDefault();let t=0;for(;t<this.menuItems.length&&this.isItemDisabled(this.menuItems[t]);)t++;t<this.menuItems.length&&this.focusItemByIndex(t)}else if(-1===i&&this.menuItems.length>0){e.preventDefault();let t=0;for(;t<this.menuItems.length&&this.isItemDisabled(this.menuItems[t]);)t++;t<this.menuItems.length&&this.focusItemByIndex(t)}else-1!==i&&(e.preventDefault(),this.focusNextItem())}}}handleWindowClick(e){this.isOpen&&!this.host.contains(e.target)&&e.target!==this.triggerEl&&this.closeDropdown()}render(){return i(s,{key:"0ed3d8ee889a5423ca9de66a86791d084f75abf0",id:this.componentId},i("slot",{key:"6bab71652d6afe094075623d3a48641a4d89b232",name:"trigger",onSlotchange:this.handleTriggerSlotChange}),i("pds-box",{key:"fcef0667f999ae5b8cd03eb94a0db0be7be502cb","border-radius":"sm",display:"flex",direction:"column",class:"pds-dropdown-menu--panel is-hidden",shadow:"100",part:"menu-panel"},i("div",{key:"c78d5bd7e48c5483b12171341271f9132f4b2ff9",class:{"pds-dropdown-menu__header":!0,"is-hidden":!this.hasHeader}},i("slot",{key:"6464994260720d6046da548f4aad0896965cc47c",name:"header",onSlotchange:this.handleHeaderSlotChange})),i("div",{key:"3e97dfc4e1911f91ce8917faf981d436e71e5c24",class:"pds-dropdown-menu__items",role:"menu","aria-orientation":"vertical"},i("slot",{key:"dfd77a8b73df5ce9eef3e661d3f9501cb8bfdba2",onSlotchange:this.handleSlotChange}))))}get host(){return this}static get style(){return":host{display:block}.is-hidden{display:none}.pds-dropdown-menu--panel{background-color:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-xs);left:var(--pine-dimension-none);min-width:170px;padding:var(--pine-dimension-xs);position:fixed;z-index:var(--pine-z-index-overlay)}:host-context([data-theme=dark]) .pds-dropdown-menu--panel{border:var(--pine-border)}.pds-dropdown-menu__header{-webkit-border-after:var(--pine-border-width-thin) solid var(--pine-color-border);border-block-end:var(--pine-border-width-thin) solid var(--pine-color-border);-webkit-margin-after:var(--pine-dimension-xs);margin-block-end:var(--pine-dimension-xs);margin-inline:calc(var(--pine-dimension-xs) * -1);-webkit-padding-after:var(--pine-dimension-xs);padding-block-end:var(--pine-dimension-xs);padding-inline:calc(var(--pine-dimension-xs) * 2 + var(--pine-border-width) + 2px);text-align:start}.pds-dropdown-menu__items{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}::slotted(a:not([slot=header])),::slotted(button:not([slot=header])){-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-dimension-xs) !important;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--pine-color-text) !important;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;font:var(--pine-typography-body-medium) !important;gap:var(--pine-dimension-xs);margin:calc(var(--pine-border-width) + 2px) !important;padding:var(--pine-dimension-xs) !important;text-align:start;text-decoration:none !important;width:calc(100% - (var(--pine-border-width) + 2px) * 2)}::slotted(.destructive:not([slot=header])){color:var(--pine-color-danger) !important}::slotted([aria-disabled=true]:not([slot=header])),::slotted([disabled]:not([disabled=false]):not([slot=header])){cursor:not-allowed;opacity:0.5;pointer-events:none}"}},[257,"pds-dropdown-menu",{componentId:[1,"component-id"],placement:[1],currentFocusIndex:[32],hasHeader:[32]},[[6,"keydown","handleEscapeKeyDown"],[8,"keydown","handleKeyDown"],[8,"click","handleWindowClick"]]]),u=m,b=function(){"undefined"!=typeof customElements&&["pds-dropdown-menu","pds-box"].forEach((e=>{switch(e){case"pds-dropdown-menu":customElements.get(n(e))||customElements.define(n(e),m);break;case"pds-box":customElements.get(n(e))||c()}}))};export{u as PdsDropdownMenu,b as defineCustomElement}
1
+ import{proxyCustomElement as e,HTMLElement as t,h as i,Host as s,transformTag as n}from"@stencil/core/internal/client";import{s as o}from"./attributes.js";import{l as d}from"./keep-hydrated.js";import{a as r,c as a,o as h,f as l,s as p}from"./floating-ui.dom.js";import{d as c}from"./pds-box2.js";const u=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.isOpen=!1,this.menuItems=[],this.cleanupAutoUpdate=null,this.triggerObserver=null,this.currentFocusIndex=-1,this.hasHeader=!1,this.placement="bottom-start",this.handleTriggerSlotChange=e=>{this.slotEl=e.target;const t=this.slotEl.assignedElements();this.triggerEl=t[0],this.triggerEl&&(this.triggerEl.onclick=this.handleClick,this.syncTriggerAria()),this.observeTrigger()},this.syncTriggerAria=()=>!!this.triggerEl&&o(this.triggerEl,{"aria-haspopup":"menu","aria-expanded":this.isOpen+""}),this.handleHeaderSlotChange=e=>{this.hasHeader=e.target.assignedElements().length>0},this.handleSlotChange=e=>{this.slotEl=e.target;const t=this.slotEl.assignedElements(),i=["pds-dropdown-menu-item","pds-dropdown-menu-separator","a","button"],s=t.filter((e=>!i.includes(e.tagName.toLowerCase())));if(s.length>0){const e=s.map((e=>e.tagName.toLowerCase())).join(", ");console.warn(`pds-dropdown-menu: Unexpected element(s) found: ${e}. Expected: `+i.join(", "))}this.menuItems=t.filter((e=>{const t=e.tagName.toLowerCase();return"pds-dropdown-menu-item"===t||"a"===t||"button"===t}))},this.toggleDropdown=()=>{this.isOpen=!this.isOpen,this.isOpen?this.openDropdown():this.closeDropdown()},this.openDropdown=()=>{var e;const t=()=>{a(this.triggerEl,this.panelEl,{placement:this.placement,strategy:"fixed",middleware:[h(6),l(),p({padding:5})]}).then((({x:e,y:t})=>{Object.assign(this.panelEl.style,{left:e+"px",top:t+"px"})}))};t(),this.cleanupAutoUpdate=r(this.triggerEl,this.panelEl,t),null===(e=this.host.shadowRoot)||void 0===e||e.querySelector("pds-box").classList.remove("is-hidden"),this.isOpen=!0,this.syncTriggerAria()},this.closeDropdown=()=>{var e;null===(e=this.host.shadowRoot)||void 0===e||e.querySelector("pds-box").classList.add("is-hidden"),this.isOpen=!1,this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),this.syncTriggerAria(),this.currentFocusIndex=-1,this.isFocusInMenu()&&this.focusTrigger()},this.handleClick=()=>{this.toggleDropdown()}}componentWillLoad(){this.hasHeader=Array.from(this.host.children).some((e=>"header"===e.getAttribute("slot")))}componentDidRender(){var e;this.panelEl=null===(e=this.host.shadowRoot)||void 0===e?void 0:e.querySelector("pds-box")}connectedCallback(){this.observeTrigger(),this.syncTriggerAria()}disconnectedCallback(){var e;this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),null===(e=this.triggerObserver)||void 0===e||e.disconnect(),this.triggerObserver=null}observeTrigger(){var e;null===(e=this.triggerObserver)||void 0===e||e.disconnect(),this.triggerObserver=null,this.triggerEl&&"undefined"!=typeof MutationObserver&&(this.triggerObserver=new MutationObserver(d(this.syncTriggerAria,"pds-dropdown-menu: stopped restoring its trigger ARIA, as another script keeps changing it. It may be wrong until the menu opens or closes.",this.triggerEl)),this.triggerObserver.observe(this.triggerEl,{attributes:!0,attributeFilter:["aria-haspopup","aria-expanded"]}))}isFocusInMenu(){const e=this.host.getRootNode().activeElement;return null!=e&&this.host.contains(e)}focusTrigger(){var e,t;this.triggerEl.focus(),this.host.getRootNode().activeElement!==this.triggerEl&&(null===(t=null===(e=this.triggerEl.shadowRoot)||void 0===e?void 0:e.querySelector('button, [href], [tabindex]:not([tabindex="-1"])'))||void 0===t||t.focus())}isItemDisabled(e){const t=e.tagName.toLowerCase();return"pds-dropdown-menu-item"===t||"button"===t?e.disabled:"a"===t&&"true"===e.getAttribute("aria-disabled")}getFocusedItemIndex(){const e=document.activeElement;return e?this.menuItems.findIndex((t=>{if(t===e)return!0;if("pds-dropdown-menu-item"===t.tagName.toLowerCase()){const i=t.shadowRoot;if(null==i?void 0:i.contains(e))return!0}return!1})):-1}focusItemByIndex(e){var t,i,s,n,o;if(e>=0&&e<this.menuItems.length){this.currentFocusIndex=e;const d=this.menuItems[e];if("pds-dropdown-menu-item"===d.tagName.toLowerCase()){const e=d,r=null===(t=e.shadowRoot)||void 0===t?void 0:t.querySelector('button, [role="menuitem"]'),a=(null===(n=null===(s=null===(i=e.shadowRoot)||void 0===i?void 0:i.querySelector("pds-link"))||void 0===s?void 0:s.shadowRoot)||void 0===n?void 0:n.querySelector("a"))||(null===(o=e.shadowRoot)||void 0===o?void 0:o.querySelector("a"));r?r.focus():a?a.focus():e.focus()}else d.focus()}}focusNextItem(){let e=(this.currentFocusIndex+1)%this.menuItems.length,t=0;const i=this.menuItems.length;for(;t<i&&this.isItemDisabled(this.menuItems[e]);)e=(e+1)%this.menuItems.length,t++;t<i&&this.focusItemByIndex(e)}focusPreviousItem(){let e=this.currentFocusIndex<=0?this.menuItems.length-1:this.currentFocusIndex-1,t=0;const i=this.menuItems.length;for(;t<i&&this.isItemDisabled(this.menuItems[e]);)e=e<=0?this.menuItems.length-1:e-1,t++;t<i&&this.focusItemByIndex(e)}adjacentEnabledIndex(e,t){for(let i=e+t;i>=0&&i<this.menuItems.length;i+=t)if(!this.isItemDisabled(this.menuItems[i]))return i;return-1}focusAdjacentItem(e,t){for(let i=this.adjacentEnabledIndex(e,t);-1!==i;i=this.adjacentEnabledIndex(i,t))if(this.focusItemByIndex(i),this.getFocusedItemIndex()===i)return!0;return!1}handleEscapeKeyDown(e){this.isOpen&&"Escape"===e.key&&!e.defaultPrevented&&(e.preventDefault(),this.closeDropdown())}handleTabKeyDown(e){if(!this.isOpen||"Tab"!==e.key||e.defaultPrevented)return;const t=this.getFocusedItemIndex();-1!==t?this.focusAdjacentItem(t,e.shiftKey?-1:1)?e.preventDefault():(e.shiftKey&&e.preventDefault(),this.closeDropdown()):!e.shiftKey||document.activeElement!==this.triggerEl&&this.isFocusInMenu()||this.closeDropdown()}handleKeyDown(e){if(this.isOpen)switch(e.key){case"ArrowDown":e.preventDefault(),this.focusNextItem();break;case"ArrowUp":e.preventDefault(),this.focusPreviousItem();break;case"Home":if(e.preventDefault(),this.menuItems.length>0){let e=0;for(;e<this.menuItems.length&&this.isItemDisabled(this.menuItems[e]);)e++;e<this.menuItems.length&&this.focusItemByIndex(e)}break;case"End":if(e.preventDefault(),this.menuItems.length>0){let e=this.menuItems.length-1;for(;e>=0&&this.isItemDisabled(this.menuItems[e]);)e--;e>=0&&this.focusItemByIndex(e)}break;case"Tab":if(e.shiftKey||-1!==this.getFocusedItemIndex())break;this.focusAdjacentItem(-1,1)?e.preventDefault():this.closeDropdown()}}handleWindowClick(e){this.isOpen&&!this.host.contains(e.target)&&e.target!==this.triggerEl&&this.closeDropdown()}render(){return i(s,{key:"aa4ce84354cf87638ee46fd7ed69520228b7e656",id:this.componentId},i("slot",{key:"948800e67d18c8c6cc9e77ef3aeab635c5035453",name:"trigger",onSlotchange:this.handleTriggerSlotChange}),i("pds-box",{key:"3ce2a2879b14aad975cea8ae72fcbf8c3abcf20c","border-radius":"sm",display:"flex",direction:"column",class:"pds-dropdown-menu--panel is-hidden",shadow:"100",part:"menu-panel"},i("div",{key:"ad25fbf4f3c7a24653c229e64fe2ce893a92e4c8",class:{"pds-dropdown-menu__header":!0,"is-hidden":!this.hasHeader}},i("slot",{key:"35a5903543e08577997b456bcd312bdd009fd8fc",name:"header",onSlotchange:this.handleHeaderSlotChange})),i("div",{key:"a9593adacf047918c1d87494f8c951a2a4a5f76f",class:"pds-dropdown-menu__items",role:"menu","aria-orientation":"vertical"},i("slot",{key:"8d2def1cc7020608220099f4ced0f44e9838cce8",onSlotchange:this.handleSlotChange}))))}get host(){return this}static get style(){return":host{display:block}.is-hidden{display:none}.pds-dropdown-menu--panel{background-color:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-xs);left:var(--pine-dimension-none);min-width:170px;padding:var(--pine-dimension-xs);position:fixed;z-index:var(--pine-z-index-overlay)}:host-context([data-theme=dark]) .pds-dropdown-menu--panel{border:var(--pine-border)}.pds-dropdown-menu__header{-webkit-border-after:var(--pine-border-width-thin) solid var(--pine-color-border);border-block-end:var(--pine-border-width-thin) solid var(--pine-color-border);-webkit-margin-after:var(--pine-dimension-xs);margin-block-end:var(--pine-dimension-xs);margin-inline:calc(var(--pine-dimension-xs) * -1);-webkit-padding-after:var(--pine-dimension-xs);padding-block-end:var(--pine-dimension-xs);padding-inline:calc(var(--pine-dimension-xs) * 2 + var(--pine-border-width) + 2px);text-align:start}.pds-dropdown-menu__items{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}::slotted(a:not([slot=header])),::slotted(button:not([slot=header])){-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-dimension-xs) !important;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--pine-color-text) !important;cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;font:var(--pine-typography-body-medium) !important;gap:var(--pine-dimension-xs);margin:calc(var(--pine-border-width) + 2px) !important;padding:var(--pine-dimension-xs) !important;text-align:start;text-decoration:none !important;width:calc(100% - (var(--pine-border-width) + 2px) * 2)}::slotted(.destructive:not([slot=header])){color:var(--pine-color-danger) !important}::slotted([aria-disabled=true]:not([slot=header])),::slotted([disabled]:not([disabled=false]):not([slot=header])){cursor:not-allowed;opacity:0.5;pointer-events:none}"}},[257,"pds-dropdown-menu",{componentId:[1,"component-id"],placement:[1],currentFocusIndex:[32],hasHeader:[32]},[[6,"keydown","handleEscapeKeyDown"],[6,"keydown","handleTabKeyDown"],[8,"keydown","handleKeyDown"],[8,"click","handleWindowClick"]]]),m=u,b=function(){"undefined"!=typeof customElements&&["pds-dropdown-menu","pds-box"].forEach((e=>{switch(e){case"pds-dropdown-menu":customElements.get(n(e))||customElements.define(n(e),u);break;case"pds-box":customElements.get(n(e))||c()}}))};export{m as PdsDropdownMenu,b as defineCustomElement}
@@ -1 +1 @@
1
- import{Build as t,proxyCustomElement as i,HTMLElement as e,h as n,Host as s,transformTag as o}from"@stencil/core/internal/client";let r,l=!1;const c=(t,i)=>(t||!i||u(i)||(t=i),f(t)&&(t=m(t)),f(t)&&""!==t.trim()?""!=t.replace(/[a-z]|-|\d/gi,"")?null:t:null),a=t=>f(t)&&(t=t.trim(),u(t))?t:null,h=i=>{let e=a(i.src);return e||(e=c(i.name,i.icon),e?(n=e,(()=>{if("undefined"==typeof window)return new Map;if(!r){const t=window;t.PdsIcons=t.PdsIcons||{},r=t.PdsIcons.map=t.PdsIcons.map||new Map}return r})().get(n)||(i=>{var e;const n=null===(e=document.head.querySelector("meta[data-pine-asset-path]"))||void 0===e?void 0:e.dataset.pineAssetPath,s=window.__PINE_ASSET_PATH__,o=t.isTesting?"/dist/pds-icons":n||s||"https://cdn.jsdelivr.net/npm/@pine-ds/icons/dist/";o.startsWith("https://cdn.jsdelivr.net/npm/")&&!l&&(l=!0,console.warn("\n Fetching Pine assets from jsDelivr CDN.\n\n It's recommended that you bundle Pine Assets with your application and set the path accordingly.\n\nFor more information, read the documentation: \nhttps://pine-design-system.netlify.app/?path=/docs/guides-assets--docs\n "));let r=i;return i.startsWith("./")&&(r=i.substring(2)),o.endsWith("/")||(r="/"+r),o+r})(`svg/${n}.svg`)):i.icon&&(e=a(i.icon),e)?e:null);var n},d=t=>t&&""!==t.dir?"rtl"===t.dir.toLowerCase():"rtl"===(null===document||void 0===document?void 0:document.dir.toLowerCase()),u=t=>t.length>0&&/(\/|\.)/.test(t),f=t=>"string"==typeof t,m=t=>t.toLowerCase(),p=["align-horizontal-bottom","align-horizontal-center","align-horizontal-top","align-left","align-right","align-vertical-left","align-vertical-right","arrow-corner","arrow-left","arrow-right","calendar-schedule","caret-left","caret-right","cart","cart-add","comment","comment-no","conversation","copy","copy-07","delete-key","delete-x","downsell","drawer-collapse","drawer-expand","duplicate","feedback","file-lock","file-search","form-field","form-filled","left-small","launch","list-bullet","list-numbers","margin-left","margin-right","move-left","move-right","newsletter-2","one-off-session","quote","redo","reset-password","right-small","send-message","share","super-admin","tablet-landscape","undo","user-star","user-star-filled","users","users-filled","users-tone"],g=t=>{if(1===t.nodeType){if("script"===t.nodeName.toLowerCase())return!1;for(let i=0;i<t.attributes.length;i++){const e=t.attributes[i].name;if(f(e)&&0===e.toLowerCase().indexOf("on"))return!1}for(let i=0;i<t.childNodes.length;i++)if(!g(t.childNodes[i]))return!1}return!0},w=new Map,v=new Map;let b;const y=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.didLoadIcon=!1,this.iconName=null,this.inheritedAttributes={},this.isVisible=!1,this.size="regular",this.hasAriaHidden=()=>{const{el:t}=this;return t.hasAttribute("aria-hidden")&&"true"===t.getAttribute("aria-hidden")}}iconSize(){const t={small:"12px",regular:"16px",medium:"20px",large:"24px"};return t[this.size]?t[this.size]:this.size}componentDidLoad(){this.setCSSVariables(),this.didLoadIcon||this.loadIcon(),setTimeout((()=>{this.svgContent||this.isVisible||(this.isVisible=!0,this.loadIcon())}),100),setTimeout((()=>{this.svgContent||this.isVisible||(this.isVisible=!0,this.loadIcon())}),500)}componentWillLoad(){this.inheritedAttributes=((t,i=[])=>{const e={};return i.forEach((i=>{t.hasAttribute(i)&&(null!==t.getAttribute(i)&&(e[i]=t.getAttribute(i)),t.removeAttribute(i))})),e})(this.el,["aria-label"]),this.setCSSVariables(),this.setupInitialAriaLabel()}setCSSVariables(){var t;this.el.style.setProperty("--dimension-icon-height",this.iconSize()),this.el.style.setProperty("--dimension-icon-width",this.iconSize()),this.el.style.setProperty("--color-icon-fill",null!==(t=(t=>{if(!f(t))return;const i=t.trim();return""!==i?i.startsWith("var(")?i:i.startsWith("--")?`var(${i})`:i:void 0})(this.color))&&void 0!==t?t:"currentColor")}connectedCallback(){this.isVisible||this.svgContent||this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=!0,this.loadIcon()})),this.isElementInViewport(this.el)&&(this.isVisible=!0,this.loadIcon())}disconnectedCallback(){this.io&&(this.io.disconnect(),this.io=void 0)}updateStyles(){this.setCSSVariables()}onIconPropertyChange(){this.loadIcon(),this.setupInitialAriaLabel()}loadIcon(){if(this.didLoadIcon=!1,this.svgContent=void 0,t.isBrowser&&this.isVisible){const t=h(this);t&&(w.has(t)?this.svgContent=w.get(t):((t,i=!1)=>{let e=v.get(t);if(!e){if("undefined"==typeof fetch||"undefined"==typeof document)return w.set(t,""),Promise.resolve();if((t=>t.startsWith("data:image/svg+xml"))(t)&&(t=>-1!==t.indexOf(";utf8,"))(t)){b||(b=new DOMParser);try{const i=b.parseFromString(t,"text/html").querySelector("svg");w.set(t,i?i.outerHTML:"")}catch(i){w.set(t,"")}return Promise.resolve()}e=fetch(t).then((e=>{if(e.ok)return e.text().then((e=>{if(e&&!1!==i)try{e=(t=>{const i=document.createElement("div");i.innerHTML=t;for(let t=i.childNodes.length-1;t>=0;t--)"svg"!==i.childNodes[t].nodeName.toLowerCase()&&i.removeChild(i.childNodes[t]);const e=i.firstElementChild;if(e&&"svg"===e.nodeName.toLowerCase()){const t=e.getAttribute("class")||"";if(e.setAttribute("class",(t+" s-pds-icon").trim()),g(e))return i.innerHTML}return""})(e)}catch(t){e=""}w.set(t,e||"")}));throw new Error(`Failed to load SVG: ${e.status} ${e.statusText}`)})).catch((i=>{console.warn("Failed to load SVG:",t,i),w.set(t,"")})),v.set(t,e)}return e})(t).then((()=>{setTimeout((()=>{this.svgContent=w.get(t)}),0)})).catch((()=>{this.svgContent=""})),this.didLoadIcon=!0)}this.iconName=c(this.name,this.icon)}render(){const{ariaLabel:i,flipRtl:e,iconName:o,inheritedAttributes:r}=this,l=!!o&&(t=>d(this.el)&&p.includes(t))(o)&&!1!==e,c=e||l,a=r["aria-label"]||i;return n(s,Object.assign({key:"3af1c02235a2645bc3bb300831b19779cca78827","aria-label":void 0===a||this.hasAriaHidden()?null:a,alt:"",role:"img",class:Object.assign(Object.assign({},C(this.color)),{"flip-rtl":c,"icon-rtl":c&&d(this.el)})},r),n("div",t.isBrowser&&this.svgContent?{class:"icon-inner",innerHTML:this.svgContent}:{class:"icon-inner"}))}setupInitialAriaLabel(){if(!this.inheritedAttributes["aria-label"]){const t=c(this.name,this.icon);t&&(this.ariaLabel=t.replace(/\-/g," "))}}waitUntilVisible(i,e,n){if(t.isBrowser&&"undefined"!=typeof window&&window.IntersectionObserver){const t=this.io=new window.IntersectionObserver((i=>{i[0].isIntersecting&&(t.disconnect(),this.io=void 0,n())}),{rootMargin:e});t.observe(i),setTimeout((()=>{this.io&&!this.isVisible&&this.isElementInViewport(i)&&(this.io.disconnect(),this.io=void 0,n())}),1e3)}else n()}isElementInViewport(t){if(!t||!t.isConnected)return!1;const i=t.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth;return i.top>=0&&i.left>=0&&i.bottom<=e&&i.right<=n||i.top<e&&i.bottom>0&&i.left<n&&i.right>0}debugIconState(){var t;const i=h(this),e=this.el.getBoundingClientRect();console.log("PdsIcon Debug State:",{name:this.name,src:this.src,icon:this.icon,iconName:this.iconName,url:i,isVisible:this.isVisible,didLoadIcon:this.didLoadIcon,hasSvgContent:!!this.svgContent,svgContentLength:(null===(t=this.svgContent)||void 0===t?void 0:t.length)||0,isInCache:!!i&&w.has(i),cachedContent:i?w.get(i):null,element:this.el,isConnected:this.el.isConnected,isInViewport:this.isElementInViewport(this.el),hasIntersectionObserver:!!this.io,boundingClientRect:e,windowDimensions:{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}})}static get assetsDirs(){return["svg"]}get el(){return this}static get watchers(){return{size:[{updateStyles:0}],color:[{updateStyles:0}],name:[{onIconPropertyChange:0}],src:[{onIconPropertyChange:0}],icon:[{onIconPropertyChange:0}]}}static get style(){return":host{--dimension-icon-height:16px;--dimension-icon-width:16px;--color-icon-fill:currentColor;contain:strict;display:inline-block;fill:var(--color-icon-fill);-ms-flex-negative:0;flex-shrink:0;height:var(--dimension-icon-height);width:var(--dimension-icon-width)}:host .pdsicon{fill:var(--color-icon-fill)}.pds-icon-fill-none{fill:none}.icon-inner,.pds-icon,svg{display:block;height:100%;width:100%}:host(.flip-rtl):host-context([dir=rtl]) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.flip-rtl:dir(rtl)) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{-webkit-transform:scaleX(1);transform:scaleX(1)}"}},[1,"pds-icon",{color:[1],flipRtl:[4,"flip-rtl"],icon:[8],name:[513],size:[513],src:[1],ariaLabel:[32],isVisible:[32],svgContent:[32]},void 0,{size:[{updateStyles:0}],color:[{updateStyles:0}],name:[{onIconPropertyChange:0}],src:[{onIconPropertyChange:0}],icon:[{onIconPropertyChange:0}]}]),C=t=>t?{"pds-color":!0,[`pds-color-${t}`]:!0}:null;function I(){"undefined"!=typeof customElements&&["pds-icon"].forEach((t=>{"pds-icon"===t&&(customElements.get(o(t))||customElements.define(o(t),y))}))}export{y as P,I as d}
1
+ import{Build as t,proxyCustomElement as i,HTMLElement as e,h as n,Host as s,transformTag as o}from"@stencil/core/internal/client";let r,l=!1;const c=(t,i)=>(t||!i||u(i)||(t=i),m(t)&&(t=f(t)),m(t)&&""!==t.trim()?""!=t.replace(/[a-z]|-|\d/gi,"")?null:t:null),a=t=>m(t)&&(t=t.trim(),u(t))?t:null,h=i=>{let e=a(i.src);return e||(e=c(i.name,i.icon),e?(n=e,(()=>{if("undefined"==typeof window)return new Map;if(!r){const t=window;t.PdsIcons=t.PdsIcons||{},r=t.PdsIcons.map=t.PdsIcons.map||new Map}return r})().get(n)||(i=>{var e;const n=null===(e=document.head.querySelector("meta[data-pine-asset-path]"))||void 0===e?void 0:e.dataset.pineAssetPath,s=window.__PINE_ASSET_PATH__,o=t.isTesting?"/dist/pds-icons":n||s||"https://cdn.jsdelivr.net/npm/@pine-ds/icons/dist/";o.startsWith("https://cdn.jsdelivr.net/npm/")&&!l&&(l=!0,console.warn("\n Fetching Pine assets from jsDelivr CDN.\n\n It's recommended that you bundle Pine Assets with your application and set the path accordingly.\n\nFor more information, read the documentation: \nhttps://pine-design-system.netlify.app/?path=/docs/guides-assets--docs\n "));let r=i;return i.startsWith("./")&&(r=i.substring(2)),o.endsWith("/")||(r="/"+r),o+r})(`svg/${n}.svg`)):i.icon&&(e=a(i.icon),e)?e:null);var n},d=t=>t&&""!==t.dir?"rtl"===t.dir.toLowerCase():"rtl"===(null===document||void 0===document?void 0:document.dir.toLowerCase()),u=t=>t.length>0&&/(\/|\.)/.test(t),m=t=>"string"==typeof t,f=t=>t.toLowerCase(),p=["align-horizontal-bottom","align-horizontal-center","align-horizontal-top","align-left","align-right","align-vertical-left","align-vertical-right","arrow-corner","arrow-left","arrow-right","calendar-schedule","caret-left","caret-right","cart","cart-add","comment","comment-no","conversation","copy","copy-07","delete-key","delete-x","downsell","drawer-collapse","drawer-expand","duplicate","feedback","file-lock","file-search","form-field","form-filled","left-small","launch","list-bullet","list-numbers","margin-left","margin-right","move-left","move-right","newsletter-2","one-off-session","quote","redo","reset-password","right-small","send-message","share","super-admin","tablet-landscape","undo","user-star","user-star-filled","users","users-filled","users-tone"],g=t=>{if(1===t.nodeType){if("script"===t.nodeName.toLowerCase())return!1;for(let i=0;i<t.attributes.length;i++){const e=t.attributes[i].name;if(m(e)&&0===e.toLowerCase().indexOf("on"))return!1}for(let i=0;i<t.childNodes.length;i++)if(!g(t.childNodes[i]))return!1}return!0},v=new Map,w=new Map;let b;const y=["aria-label","aria-labelledby"],x=i(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.didLoadIcon=!1,this.iconName=null,this.warnedUnnamedFocusable=!1,this.inheritedAttributes={},this.isFocusable=!1,this.isVisible=!1,this.size="regular"}iconSize(){const t={small:"12px",regular:"16px",medium:"20px",large:"24px"};return t[this.size]?t[this.size]:this.size}componentDidLoad(){this.setCSSVariables(),this.didLoadIcon||this.loadIcon(),setTimeout((()=>{this.svgContent||this.isVisible||(this.isVisible=!0,this.loadIcon())}),100),setTimeout((()=>{this.svgContent||this.isVisible||(this.isVisible=!0,this.loadIcon())}),500)}componentWillLoad(){this.inheritedAttributes=((t,i=[])=>{const e={};return i.forEach((i=>{t.hasAttribute(i)&&(null!==t.getAttribute(i)&&(e[i]=t.getAttribute(i)),t.removeAttribute(i))})),e})(this.el,y),this.isFocusable=this.el.hasAttribute("tabindex"),this.setCSSVariables()}setCSSVariables(){var t;this.el.style.setProperty("--dimension-icon-height",this.iconSize()),this.el.style.setProperty("--dimension-icon-width",this.iconSize()),this.el.style.setProperty("--color-icon-fill",null!==(t=(t=>{if(!m(t))return;const i=t.trim();return""!==i?i.startsWith("var(")?i:i.startsWith("--")?`var(${i})`:i:void 0})(this.color))&&void 0!==t?t:"currentColor")}connectedCallback(){this.observeNamingAttributes(),this.isVisible||this.svgContent||this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=!0,this.loadIcon()})),this.isElementInViewport(this.el)&&(this.isVisible=!0,this.loadIcon())}disconnectedCallback(){this.io&&(this.io.disconnect(),this.io=void 0),this.mo&&(this.mo.disconnect(),this.mo=void 0)}updateStyles(){this.setCSSVariables()}onIconPropertyChange(){this.loadIcon()}loadIcon(){if(this.didLoadIcon=!1,this.svgContent=void 0,t.isBrowser&&this.isVisible){const t=h(this);t&&(v.has(t)?this.svgContent=v.get(t):((t,i=!1)=>{let e=w.get(t);if(!e){if("undefined"==typeof fetch||"undefined"==typeof document)return v.set(t,""),Promise.resolve();if((t=>t.startsWith("data:image/svg+xml"))(t)&&(t=>-1!==t.indexOf(";utf8,"))(t)){b||(b=new DOMParser);try{const i=b.parseFromString(t,"text/html").querySelector("svg");v.set(t,i?i.outerHTML:"")}catch(i){v.set(t,"")}return Promise.resolve()}e=fetch(t).then((e=>{if(e.ok)return e.text().then((e=>{if(e&&!1!==i)try{e=(t=>{const i=document.createElement("div");i.innerHTML=t;for(let t=i.childNodes.length-1;t>=0;t--)"svg"!==i.childNodes[t].nodeName.toLowerCase()&&i.removeChild(i.childNodes[t]);const e=i.firstElementChild;if(e&&"svg"===e.nodeName.toLowerCase()){const t=e.getAttribute("class")||"";if(e.setAttribute("class",(t+" s-pds-icon").trim()),g(e))return i.innerHTML}return""})(e)}catch(t){e=""}v.set(t,e||"")}));throw new Error(`Failed to load SVG: ${e.status} ${e.statusText}`)})).catch((i=>{console.warn("Failed to load SVG:",t,i),v.set(t,"")})),w.set(t,e)}return e})(t).then((()=>{setTimeout((()=>{this.svgContent=v.get(t)}),0)})).catch((()=>{this.svgContent=""})),this.didLoadIcon=!0)}this.iconName=c(this.name,this.icon)}render(){const{flipRtl:i,iconName:e,inheritedAttributes:o}=this,r=!!e&&(t=>d(this.el)&&p.includes(t))(e)&&!1!==i,l=i||r,c=y.some((t=>void 0!==o[t])),a=!c&&!this.isFocusable;return t.isDev&&!c&&this.isFocusable&&!this.warnedUnnamedFocusable&&(this.warnedUnnamedFocusable=!0,console.warn("[pds-icon] A focusable icon needs an accessible name. Add an aria-label, or remove its tabindex.",this.el)),n(s,Object.assign({key:"6597475535756e7174072dc25c982137724d439d","aria-hidden":a?"true":void 0,alt:"",role:a?null:"img",class:Object.assign(Object.assign({},C(this.color)),{"flip-rtl":l,"icon-rtl":l&&d(this.el)})},o),n("div",t.isBrowser&&this.svgContent?{class:"icon-inner",innerHTML:this.svgContent}:{class:"icon-inner"}))}observeNamingAttributes(){t.isBrowser&&"undefined"!=typeof MutationObserver&&!this.mo&&(this.mo=new MutationObserver((()=>{const t=Object.assign({},this.inheritedAttributes);let i=!1;y.forEach((e=>{var n;const s=null!==(n=this.el.getAttribute(e))&&void 0!==n?n:void 0;t[e]!==s&&(void 0===s?delete t[e]:t[e]=s,i=!0)})),i&&(this.inheritedAttributes=t),this.isFocusable=this.el.hasAttribute("tabindex")})),this.mo.observe(this.el,{attributes:!0,attributeFilter:[...y,"tabindex"]}))}waitUntilVisible(i,e,n){if(t.isBrowser&&"undefined"!=typeof window&&window.IntersectionObserver){const t=this.io=new window.IntersectionObserver((i=>{i[0].isIntersecting&&(t.disconnect(),this.io=void 0,n())}),{rootMargin:e});t.observe(i),setTimeout((()=>{this.io&&!this.isVisible&&this.isElementInViewport(i)&&(this.io.disconnect(),this.io=void 0,n())}),1e3)}else n()}isElementInViewport(t){if(!t||!t.isConnected)return!1;const i=t.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth;return i.top>=0&&i.left>=0&&i.bottom<=e&&i.right<=n||i.top<e&&i.bottom>0&&i.left<n&&i.right>0}debugIconState(){var t;const i=h(this),e=this.el.getBoundingClientRect();console.log("PdsIcon Debug State:",{name:this.name,src:this.src,icon:this.icon,iconName:this.iconName,url:i,isVisible:this.isVisible,didLoadIcon:this.didLoadIcon,hasSvgContent:!!this.svgContent,svgContentLength:(null===(t=this.svgContent)||void 0===t?void 0:t.length)||0,isInCache:!!i&&v.has(i),cachedContent:i?v.get(i):null,element:this.el,isConnected:this.el.isConnected,isInViewport:this.isElementInViewport(this.el),hasIntersectionObserver:!!this.io,boundingClientRect:e,windowDimensions:{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}})}static get assetsDirs(){return["svg"]}get el(){return this}static get watchers(){return{size:[{updateStyles:0}],color:[{updateStyles:0}],name:[{onIconPropertyChange:0}],src:[{onIconPropertyChange:0}],icon:[{onIconPropertyChange:0}]}}static get style(){return":host{--dimension-icon-height:16px;--dimension-icon-width:16px;--color-icon-fill:currentColor;contain:strict;display:inline-block;fill:var(--color-icon-fill);-ms-flex-negative:0;flex-shrink:0;height:var(--dimension-icon-height);width:var(--dimension-icon-width)}:host .pdsicon{fill:var(--color-icon-fill)}.pds-icon-fill-none{fill:none}.icon-inner,.pds-icon,svg{display:block;height:100%;width:100%}:host(.flip-rtl):host-context([dir=rtl]) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.flip-rtl:dir(rtl)) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{-webkit-transform:scaleX(1);transform:scaleX(1)}"}},[1,"pds-icon",{color:[1],flipRtl:[4,"flip-rtl"],icon:[8],name:[513],size:[513],src:[1],inheritedAttributes:[32],isFocusable:[32],isVisible:[32],svgContent:[32]},void 0,{size:[{updateStyles:0}],color:[{updateStyles:0}],name:[{onIconPropertyChange:0}],src:[{onIconPropertyChange:0}],icon:[{onIconPropertyChange:0}]}]),C=t=>t?{"pds-color":!0,[`pds-color-${t}`]:!0}:null;function I(){"undefined"!=typeof customElements&&["pds-icon"].forEach((t=>{"pds-icon"===t&&(customElements.get(o(t))||customElements.define(o(t),x))}))}export{x as P,I as d}
@@ -1 +1 @@
1
- import{proxyCustomElement as o,HTMLElement as e,h as i,transformTag as t}from"@stencil/core/internal/client";import{s as r}from"./utils.js";import{l as n}from"./index2.js";import{d as s}from"./pds-icon2.js";const a=o(class extends e{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.active=!1,this.external=!1,this.variant="inline",this.fontSize="lg"}classNames(){const o=["pds-link"];return this.fontSize&&o.push("pds-link--"+this.fontSize),this.variant&&o.push("pds-link--"+this.variant),o.join(" ")}setLinkStyles(){if(this.color)return r(this.color,{secondary:"var(--pine-color-text-primary)",accent:"var(--pine-color-accent)",danger:"var(--pine-color-danger)"})}render(){var o;const e=this.target||(this.external?"_blank":void 0),t=this.external,r="_blank"===e,s=r?"noopener noreferrer":void 0,a=null!==(o=this.externalLabel)&&void 0!==o?o:"(opens in a new tab)",d=r&&""!==a?a:void 0;return i("a",{key:"ae7928aa6dce42657545a1d17581818d3724746f",class:this.classNames(),download:this.download,href:this.href,id:this.componentId,part:"link","aria-current":this.active?"page":void 0,target:e,rel:s,style:this.setLinkStyles(),"data-turbo":this.turbo||void 0,"data-turbo-frame":this.turboFrame||void 0,"data-turbo-action":this.turboAction||void 0,"data-turbo-method":this.turboMethod||void 0,"data-turbo-confirm":this.turboConfirm||void 0,"data-turbo-stream":this.turboStream||void 0,"data-turbo-prefetch":this.turboPrefetch||void 0,"data-turbo-preload":this.turboPreload||void 0},i("slot",{key:"e61374c58fddec869f2f5dda54634a0b1ba9f345"},this.href),t&&i("pds-icon",{key:"161657146e5f3ce360480c573ea8f14c9012cb1f",icon:n,size:this.fontSize,"aria-label":d,"aria-hidden":void 0===d?"true":void 0}))}static get style(){return":host{display:inline}:host pds-icon{-webkit-margin-start:var(--pine-dimension-2xs);margin-inline-start:var(--pine-dimension-2xs)}.pds-link{-ms-flex-align:center;align-items:center;color:var(--color, var(--pds-context-link-color, var(--pine-color-text)));display:-ms-inline-flexbox;display:inline-flex;font-weight:var(--pine-font-weight-medium)}.pds-link:focus-visible{border-radius:var(--pine-dimension-2xs);outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width-thick);position:relative}.pds-link:hover{color:var(--color, var(--pds-context-link-color-hover, var(--pine-color-text-hover)));text-decoration:none}:host([color=secondary]) .pds-link{color:var(--pine-color-text-primary)}:host([color=secondary]) .pds-link:hover{color:var(--pine-color-text-inverse-secondary)}:host([color=accent]) .pds-link{color:var(--pine-color-accent)}:host([color=accent]) .pds-link:hover{color:var(--pine-color-accent-hover)}:host([color=danger]) .pds-link{color:var(--pine-color-danger)}:host([color=danger]) .pds-link:hover{color:var(--pine-color-danger-hover)}.pds-link--sm{font-size:var(--pine-font-size-body-xs)}.pds-link--sm pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--md{font-size:var(--pine-font-size-body-sm)}.pds-link--md pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--lg{font-size:var(--pine-font-size-body-md)}.pds-link--lg pds-icon{height:var(--pine-dimension-sm);width:var(--pine-dimension-sm)}.pds-link--plain{text-decoration:none}.pds-link--plain:hover{color:var(--color, var(--pds-context-link-color-hover, var(--pine-color-text-hover)));text-decoration:underline}:host([active]) .pds-link{color:var(--pds-context-link-color, var(--pine-color-text-strong));text-decoration:underline}:host([active]) .pds-link:hover{color:var(--pds-context-link-color-hover, var(--pine-color-text-strong));text-decoration:underline}"}},[257,"pds-link",{active:[516],color:[1],download:[1],componentId:[1,"component-id"],external:[4],externalLabel:[1,"external-label"],target:[1],variant:[1],fontSize:[1,"font-size"],href:[1],turbo:[1],turboFrame:[1,"turbo-frame"],turboAction:[1,"turbo-action"],turboMethod:[1,"turbo-method"],turboConfirm:[1,"turbo-confirm"],turboStream:[1,"turbo-stream"],turboPrefetch:[1,"turbo-prefetch"],turboPreload:[1,"turbo-preload"]}]);function d(){"undefined"!=typeof customElements&&["pds-link","pds-icon"].forEach((o=>{switch(o){case"pds-link":customElements.get(t(o))||customElements.define(t(o),a);break;case"pds-icon":customElements.get(t(o))||s()}}))}export{a as P,d}
1
+ import{proxyCustomElement as o,HTMLElement as e,h as i,transformTag as t}from"@stencil/core/internal/client";import{s as r}from"./utils.js";import{l as n}from"./index2.js";import{d as s}from"./pds-icon2.js";const a=o(class extends e{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.active=!1,this.external=!1,this.variant="inline",this.fontSize="lg"}classNames(){const o=["pds-link"];return this.fontSize&&o.push("pds-link--"+this.fontSize),this.variant&&o.push("pds-link--"+this.variant),o.join(" ")}setLinkStyles(){if(this.color)return r(this.color,{secondary:"var(--pine-color-text-primary)",accent:"var(--pine-color-accent)",danger:"var(--pine-color-danger)"})}render(){var o;const e=this.target||(this.external?"_blank":void 0),t=this.external,r="_blank"===e,s=r?"noopener noreferrer":void 0,a=null!==(o=this.externalLabel)&&void 0!==o?o:"(opens in a new tab)",d=r&&""!==a?a:void 0;return i("a",{key:"ae7928aa6dce42657545a1d17581818d3724746f",class:this.classNames(),download:this.download,href:this.href,id:this.componentId,part:"link","aria-current":this.active?"page":void 0,target:e,rel:s,style:this.setLinkStyles(),"data-turbo":this.turbo||void 0,"data-turbo-frame":this.turboFrame||void 0,"data-turbo-action":this.turboAction||void 0,"data-turbo-method":this.turboMethod||void 0,"data-turbo-confirm":this.turboConfirm||void 0,"data-turbo-stream":this.turboStream||void 0,"data-turbo-prefetch":this.turboPrefetch||void 0,"data-turbo-preload":this.turboPreload||void 0},i("slot",{key:"e61374c58fddec869f2f5dda54634a0b1ba9f345"},this.href),t&&i("pds-icon",{key:"161657146e5f3ce360480c573ea8f14c9012cb1f",icon:n,size:this.fontSize,"aria-label":d,"aria-hidden":void 0===d?"true":void 0}))}static get style(){return":host{display:inline}:host pds-icon{-webkit-margin-start:var(--pine-dimension-2xs);margin-inline-start:var(--pine-dimension-2xs)}.pds-link{-ms-flex-align:center;align-items:center;color:var(--color, var(--pds-context-link-color, var(--pine-color-text)));display:-ms-inline-flexbox;display:inline-flex;font-weight:var(--pine-font-weight-medium)}.pds-link:focus-visible{border-radius:var(--pine-dimension-2xs);isolation:isolate;outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width-thick)}.pds-link:hover{color:var(--color, var(--pds-context-link-color-hover, var(--pine-color-text-hover)));text-decoration:none}:host([color=secondary]) .pds-link{color:var(--pine-color-text-primary)}:host([color=secondary]) .pds-link:hover{color:var(--pine-color-text-inverse-secondary)}:host([color=accent]) .pds-link{color:var(--pine-color-accent)}:host([color=accent]) .pds-link:hover{color:var(--pine-color-accent-hover)}:host([color=danger]) .pds-link{color:var(--pine-color-danger)}:host([color=danger]) .pds-link:hover{color:var(--pine-color-danger-hover)}.pds-link--sm{font-size:var(--pine-font-size-body-xs)}.pds-link--sm pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--md{font-size:var(--pine-font-size-body-sm)}.pds-link--md pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--lg{font-size:var(--pine-font-size-body-md)}.pds-link--lg pds-icon{height:var(--pine-dimension-sm);width:var(--pine-dimension-sm)}.pds-link--plain{text-decoration:none}.pds-link--plain:hover{color:var(--color, var(--pds-context-link-color-hover, var(--pine-color-text-hover)));text-decoration:underline}:host([active]) .pds-link{color:var(--pds-context-link-color, var(--pine-color-text-strong));text-decoration:underline}:host([active]) .pds-link:hover{color:var(--pds-context-link-color-hover, var(--pine-color-text-strong));text-decoration:underline}"}},[257,"pds-link",{active:[516],color:[1],download:[1],componentId:[1,"component-id"],external:[4],externalLabel:[1,"external-label"],target:[1],variant:[1],fontSize:[1,"font-size"],href:[1],turbo:[1],turboFrame:[1,"turbo-frame"],turboAction:[1,"turbo-action"],turboMethod:[1,"turbo-method"],turboConfirm:[1,"turbo-confirm"],turboStream:[1,"turbo-stream"],turboPrefetch:[1,"turbo-prefetch"],turboPreload:[1,"turbo-preload"]}]);function d(){"undefined"!=typeof customElements&&["pds-link","pds-icon"].forEach((o=>{switch(o){case"pds-link":customElements.get(t(o))||customElements.define(t(o),a);break;case"pds-icon":customElements.get(t(o))||s()}}))}export{a as P,d}
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as i,createEvent as o,h as s,transformTag as e}from"@stencil/core/internal/client";import{c as d}from"./closest.js";import{t as a}from"./tabbable.js";import{u as n}from"./reconnected-content.js";const r=["sm","md","lg","fullscreen"];function l(t,i){for(let o=i;o;o=o instanceof ShadowRoot?o.host:o.parentNode)if(o===t)return!0;return!1}const h=new Map;let p=0;function c(t){return!!t.querySelector("[data-pds-popover-open]")||Array.from(t.querySelectorAll("*")).some((t=>!!t.shadowRoot&&c(t.shadowRoot)))}function m(){var t;let i=document.activeElement;for(;null===(t=null==i?void 0:i.shadowRoot)||void 0===t?void 0:t.activeElement;)i=i.shadowRoot.activeElement;return i}const u=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.pdsModalOpen=o(this,"pdsModalOpen",7),this.pdsModalClose=o(this,"pdsModalClose",7),this.focusableElements=[],this.backdropDismiss=!0,this.open=!1,this.size="md",this.scrollable=!0,this.disableTopLayer=!1,this.disableInitialFocus=!1,this.focusableElementsArray=[],this.handleCancel=t=>{if(t.preventDefault(),!this.open)return;const i=this.innermostOpenModal(),o=i&&l(this.el,i)?i:this.el;o.backdropDismiss&&o.hideModal()},this.handleBackdropClick=t=>{this.backdropDismiss&&this.open&&t.target===this.modalRef&&(t.stopPropagation(),this.innermostOpenModal()===this.el&&this.hideModal())},this.handleKeyDown=t=>{var i,o,s,e;if(this.open){if("Escape"===t.key){const d=t;if(!("__pdsActiveElementAtEscape"in d)){const o=document.activeElement;d.__pdsActiveElementAtEscape=o,d.__pdsDeepActiveElementAtEscape=m();const s=null!==(i=null==o?void 0:o.closest("dialog"))&&void 0!==i?i:null;d.__pdsTopLayerDialogAtEscape=s,d.__pdsTopLayerDialogWasModalAtEscape=!(!s||!s.matches(":modal")),d.__pdsEscapeHandledInside=t.defaultPrevented,d.__pdsInnermostModalAtEscape=this.innermostOpenModal()}if(d.__pdsEscapeHandledInside)return;const a=d.__pdsActiveElementAtEscape;if(this.disableTopLayer&&a&&a!==document.body&&!l(this.el,null!==(o=d.__pdsDeepActiveElementAtEscape)&&void 0!==o?o:a)&&this.isStackedAboveOverlay(a,null!==(s=d.__pdsTopLayerDialogAtEscape)&&void 0!==s?s:null,null!==(e=d.__pdsTopLayerDialogWasModalAtEscape)&&void 0!==e&&e))return;if(this.modalRef&&c(this.modalRef))return;return t.preventDefault(),void(this.backdropDismiss&&d.__pdsInnermostModalAtEscape===this.el&&this.hideModal())}if("Tab"===t.key){if(this.disableTopLayer)return;if(t.defaultPrevented)return;const i=m();if(!i||this.modalDialogAbove(i))return;if(this.updateFocusableElements(),0===this.focusableElements.length)return;const o=this.focusableElements[0],s=this.focusableElements[this.focusableElements.length-1],e=this.stopIndex(i),d=e===this.focusableElements.length-1;t.shiftKey&&0===e?(t.preventDefault(),this.focusElement(s)):!t.shiftKey&&d&&(t.preventDefault(),this.focusElement(o))}}}}componentWillLoad(){this.warnOnInvalidSize()}sizeChanged(){this.warnOnInvalidSize()}componentDidLoad(){this.modalRef=this.el.querySelector(".pds-modal__backdrop"),this.open&&this.showModal()}componentDidRender(){n(this.el.querySelector(".pds-modal"),"dialog.pds-modal__backdrop",".pds-modal")}connectedCallback(){document.addEventListener("keydown",this.handleKeyDown),this.open&&!h.has(this.el)&&h.set(this.el,++p)}disconnectedCallback(){document.removeEventListener("keydown",this.handleKeyDown),h.delete(this.el)}handleOpenChange(t){t?this.showModal():this.hideModal()}updateFocusableElements(){this.modalRef&&(this.focusableElements=a(this.modalRef))}setInitialFocus(){0!==this.focusableElements.length&&this.focusElement(this.focusableElements[0])}focusElement(t){null==t||t.focus()}async showModal(){var t;if(this.modalRef)try{this.modalRef.open||(this.previousActiveElement=document.activeElement),this.disableTopLayer?this.modalRef.show():this.modalRef.showModal(),this.open=!0,h.has(this.el)||h.set(this.el,++p);const o=null!==(t=h.get(this.el))&&void 0!==t?t:0;setTimeout((()=>{var t,s;if(this.updateFocusableElements(),Array.from(h).some((([t,i])=>i>o&&t!==this.el&&(l(this.el,t)||!t.disableTopLayer||this.disableTopLayer))))this.pdsModalOpen.emit();else{if(this.disableInitialFocus){const o=document.activeElement;null!==o&&o!==document.body&&!(null===(t=this.modalRef)||void 0===t?void 0:t.contains(o))||(this.previousActiveElement!==document.body&&"function"==typeof(null===(s=this.previousActiveElement)||void 0===s?void 0:s.focus)?this.previousActiveElement.focus():o instanceof i&&o.blur())}else this.setInitialFocus();this.pdsModalOpen.emit()}}),100)}catch(t){console.error("Failed to show modal:",t)}}async hideModal(){var t;if(this.modalRef)try{const i=document.activeElement,o=null!==i&&i!==document.body&&!this.modalRef.contains(i);if(this.modalRef.close(),this.open=!1,h.delete(this.el),!o){const i=this.previousActiveElement;i&&i!==document.body&&i.isConnected&&(null===(t=i.focus)||void 0===t||t.call(i));const o=m();i&&i!==document.body&&l(i,o)&&!l(this.el,o)||this.focusTopModal()}this.pdsModalClose.emit()}catch(t){console.error("Failed to hide modal:",t)}}focusTopModal(){var t;const i=this.innermostOpenModal(),o=null==i?void 0:i.querySelector(".pds-modal__backdrop");o&&(d("dialog:modal",o)||l(i,this.el))&&(null===(t=a(o).find((t=>!l(this.el,t))))||void 0===t||t.focus())}getBackdropZIndex(t){const i=t.querySelector(".pds-modal__backdrop"),o=i?parseInt(getComputedStyle(i).zIndex,10):-1;return Number.isNaN(o)?0:o}isStackedAboveOverlay(t,i,o){if(i&&i!==this.modalRef&&o&&!l(i,this.el))return!0;const s=this.getBackdropZIndex(this.el);let e=t;for(;e&&e!==document.body;){const t=getComputedStyle(e),i=parseInt(t.zIndex,10);if("static"!==t.position&&!isNaN(i)&&i>s)return!0;e=e.parentElement}return!1}innermostOpenModal(){const t=Array.from(h.keys()).filter((t=>t.isConnected)),i=t.filter((i=>!t.some((t=>t!==i&&l(i,t))))),o=[...i].sort(((t,i)=>function(t,i){for(let o=t;o;o=o.getRootNode().host)for(let t=i;t;t=t.getRootNode().host)if(o.getRootNode()===t.getRootNode())return!!(o.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING);return!1}(t,i)?-1:1)),s=t=>{var i;const s=t.querySelector(".pds-modal__backdrop"),e=s?d("dialog:modal",s):null,a=null==e?void 0:e.closest("pds-modal");return[e?1:0,e&&null!==(i=a&&h.get(a))&&void 0!==i?i:0,this.getBackdropZIndex(t),o.indexOf(t)]};let e=null,a=[-1,-1,-1,-1];for(const t of i){const i=s(t),o=i.findIndex(((t,i)=>t!==a[i]));o>=0&&i[o]>a[o]&&(e=t,a=i)}return e}modalDialogAbove(t){var o;for(let s=d("dialog[open]",t);s instanceof i;){if(s===this.modalRef)return!1;if(s.matches(":modal"))return!0;s=d("dialog[open]",null!==(o=s.parentElement)&&void 0!==o?o:s.getRootNode().host)}return!1}stopIndex(t){const i=this.focusableElements.indexOf(t);if(i>=0)return i;for(let i=this.focusableElements.length-1;i>=0;i--)if(l(this.focusableElements[i],t))return i;return-1}resolveSize(){var t;const i=(null!==(t=this.size)&&void 0!==t?t:"").trim()||"md";return r.includes(i)?[i]:/^[a-z0-9.%+\-*/(), ]+$/i.test(o=i)&&/\d/.test(o)&&("undefined"==typeof CSS||CSS.supports("max-width",o))?["custom",i]:[void 0];var o}warnOnInvalidSize(){void 0===this.resolveSize()[0]&&console.warn(`pds-modal: invalid size "${String(this.size).slice(0,50)}", using md`)}render(){const[t="md",i]=this.resolveSize();return s("dialog",{key:"cd574868a46b69185e2058c60374dbec34677732",class:{"pds-modal__backdrop":!0,open:this.open},"aria-modal":this.disableTopLayer?"false":"true","aria-labelledby":`${this.componentId}-heading`,onClick:this.handleBackdropClick,onCancel:this.handleCancel},s("div",{key:"8c50fb4810b4bb07d62348fed44df30b14a52acd",class:{"pds-modal":!0,[`pds-modal--${t}`]:!0,"pds-modal--scrollable":this.scrollable},style:void 0!==i?{"--pds-modal-max-width":i}:void 0,part:"modal"},s("slot",{key:"25a71c95dfeff4648a28edef21bf510b1743ed7c"})))}get el(){return this}static get watchers(){return{size:[{sizeChanged:0}],open:[{handleOpenChange:0}]}}static get style(){return'.pds-modal__backdrop{-ms-flex-align:start;align-items:flex-start;background-color:rgba(0, 0, 0, 0.4);border:0;display:-ms-flexbox;display:flex;height:100%;inset:0;-ms-flex-pack:center;justify-content:center;margin:0;max-height:100%;max-width:100%;opacity:0;padding:0;position:fixed;-webkit-transition:opacity var(--pine-motion-duration-base) var(--pine-motion-easing-in), visibility var(--pine-motion-duration-base) var(--pine-motion-easing-in);transition:opacity var(--pine-motion-duration-base) var(--pine-motion-easing-in), visibility var(--pine-motion-duration-base) var(--pine-motion-easing-in);visibility:hidden;width:100%;z-index:var(--pine-z-index-modal)}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}}pds-modal .pds-modal__backdrop{z-index:var(--pine-z-index-priority)}.pds-modal__backdrop::-webkit-backdrop{background:transparent}.pds-modal__backdrop::-ms-backdrop{background:transparent}.pds-modal__backdrop::backdrop{background:transparent}.pds-modal__backdrop[aria-modal=false]{overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop[aria-modal=false]{-webkit-backdrop-filter:none;backdrop-filter:none}.pds-modal__backdrop[aria-modal=false]::before{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);content:"";inset:0;position:fixed;z-index:-1}}.pds-modal__backdrop.open{opacity:1;-webkit-transition-timing-function:var(--pine-motion-easing-out);transition-timing-function:var(--pine-motion-easing-out);visibility:visible}.pds-modal{background:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow-400);box-shadow:var(--pine-box-shadow-400);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:var(--pine-dimension-md);max-height:none;width:100%}.pds-modal.pds-modal--scrollable{max-height:calc(100vh - (5vh + 96px))}@supports (height: 100dvh){.pds-modal.pds-modal--scrollable{max-height:calc(100dvh - (5dvh + 96px))}}@media (min-width: 992px){.pds-modal{-webkit-margin-before:6vh;margin-block-start:6vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:6dvh;margin-block-start:6dvh}}}@media (min-width: 1200px){.pds-modal{-webkit-margin-before:8vh;margin-block-start:8vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:8dvh;margin-block-start:8dvh}}}.pds-modal--sm{max-width:520px}.pds-modal--md{max-width:700px}.pds-modal--lg{max-width:900px}.pds-modal--custom{max-width:var(--pds-modal-max-width, 700px)}.pds-modal--fullscreen{border-radius:0;height:100%;margin:0;max-height:100vh;max-width:100%}@supports (height: 100dvh){.pds-modal--fullscreen{max-height:100dvh}}.pds-modal--fullscreen.pds-modal--scrollable{max-height:100vh}@supports (height: 100dvh){.pds-modal--fullscreen.pds-modal--scrollable{max-height:100dvh}}.pds-modal--fullscreen .pds-modal-content{-ms-flex:1;flex:1}.pds-modal--scrollable pds-modal-content{-webkit-border-after:1px solid transparent;border-block-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;overflow-y:auto}.pds-modal:not(.pds-modal--scrollable) pds-modal-content{overflow-y:visible}'}},[260,"pds-modal",{backdropDismiss:[4,"backdrop-dismiss"],componentId:[1,"component-id"],open:[1028],size:[1],scrollable:[4],disableTopLayer:[4,"disable-top-layer"],disableInitialFocus:[4,"disable-initial-focus"],focusableElementsArray:[32],showModal:[64],hideModal:[64]},void 0,{size:[{sizeChanged:0}],open:[{handleOpenChange:0}]}]);function b(){"undefined"!=typeof customElements&&["pds-modal"].forEach((t=>{"pds-modal"===t&&(customElements.get(e(t))||customElements.define(e(t),u))}))}export{u as P,b as d}
1
+ import{proxyCustomElement as t,HTMLElement as i,createEvent as o,h as s,transformTag as e}from"@stencil/core/internal/client";import{c as d}from"./closest.js";import{t as a}from"./tabbable.js";import{u as n}from"./reconnected-content.js";const l=["sm","md","lg","fullscreen"];function r(t,i){for(let o=i;o;o=o instanceof ShadowRoot?o.host:o.parentNode)if(o===t)return!0;return!1}const h=new Map;let p=0;function c(t){return!!t.querySelector("[data-pds-popover-open]")||Array.from(t.querySelectorAll("*")).some((t=>!!t.shadowRoot&&c(t.shadowRoot)))}function m(){var t;let i=document.activeElement;for(;null===(t=null==i?void 0:i.shadowRoot)||void 0===t?void 0:t.activeElement;)i=i.shadowRoot.activeElement;return i}const u=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.pdsModalOpen=o(this,"pdsModalOpen",7),this.pdsModalClose=o(this,"pdsModalClose",7),this.focusableElements=[],this.backdropDismiss=!0,this.open=!1,this.size="md",this.scrollable=!0,this.disableTopLayer=!1,this.disableInitialFocus=!1,this.focusableElementsArray=[],this.handleCancel=t=>{if(t.preventDefault(),!this.open)return;const i=this.innermostOpenModal(),o=i&&r(this.el,i)?i:this.el;o.backdropDismiss&&o.hideModal()},this.handleBackdropClick=t=>{this.backdropDismiss&&this.open&&t.target===this.modalRef&&(t.stopPropagation(),this.innermostOpenModal()===this.el&&this.hideModal())},this.handleKeyDown=t=>{var i,o,s,e;if(this.open){if("Escape"===t.key){const d=t;if(!("__pdsActiveElementAtEscape"in d)){const o=document.activeElement;d.__pdsActiveElementAtEscape=o,d.__pdsDeepActiveElementAtEscape=m();const s=null!==(i=null==o?void 0:o.closest("dialog"))&&void 0!==i?i:null;d.__pdsTopLayerDialogAtEscape=s,d.__pdsTopLayerDialogWasModalAtEscape=!(!s||!s.matches(":modal")),d.__pdsEscapeHandledInside=t.defaultPrevented,d.__pdsInnermostModalAtEscape=this.innermostOpenModal()}if(d.__pdsEscapeHandledInside)return;const a=d.__pdsActiveElementAtEscape;if(this.disableTopLayer&&a&&a!==document.body&&!r(this.el,null!==(o=d.__pdsDeepActiveElementAtEscape)&&void 0!==o?o:a)&&this.isStackedAboveOverlay(a,null!==(s=d.__pdsTopLayerDialogAtEscape)&&void 0!==s?s:null,null!==(e=d.__pdsTopLayerDialogWasModalAtEscape)&&void 0!==e&&e))return;if(this.modalRef&&c(this.modalRef))return;return t.preventDefault(),void(this.backdropDismiss&&d.__pdsInnermostModalAtEscape===this.el&&this.hideModal())}if("Tab"===t.key){if(this.disableTopLayer)return;if(t.defaultPrevented)return;const i=m();if(!i||this.modalDialogAbove(i))return;if(this.updateFocusableElements(),0===this.focusableElements.length)return;const o=this.focusableElements[0],s=this.focusableElements[this.focusableElements.length-1],e=this.stopIndex(i),d=e===this.focusableElements.length-1;t.shiftKey&&0===e?(t.preventDefault(),this.focusElement(s)):!t.shiftKey&&d&&(t.preventDefault(),this.focusElement(o))}}}}componentWillLoad(){this.warnOnInvalidSize()}sizeChanged(){this.warnOnInvalidSize()}componentDidLoad(){this.modalRef=this.el.querySelector(".pds-modal__backdrop"),this.open&&this.showModal()}componentDidRender(){n(this.el.querySelector(".pds-modal"),"dialog.pds-modal__backdrop",".pds-modal")}connectedCallback(){document.addEventListener("keydown",this.handleKeyDown),this.open&&!h.has(this.el)&&h.set(this.el,++p)}disconnectedCallback(){document.removeEventListener("keydown",this.handleKeyDown),h.delete(this.el)}handleOpenChange(t){t?this.showModal():this.hideModal()}updateFocusableElements(){this.modalRef&&(this.focusableElements=a(this.modalRef))}setInitialFocus(){0!==this.focusableElements.length&&this.focusElement(this.focusableElements[0])}focusElement(t){null==t||t.focus()}async showModal(){var t;if(this.modalRef)try{this.modalRef.open||(this.previousActiveElement=document.activeElement),this.disableTopLayer?this.modalRef.show():this.modalRef.showModal(),this.open=!0,h.has(this.el)||h.set(this.el,++p);const o=null!==(t=h.get(this.el))&&void 0!==t?t:0;setTimeout((()=>{var t,s;if(this.updateFocusableElements(),Array.from(h).some((([t,i])=>i>o&&t!==this.el&&(r(this.el,t)||!t.disableTopLayer||this.disableTopLayer))))this.pdsModalOpen.emit();else{if(this.disableInitialFocus){const o=document.activeElement;null!==o&&o!==document.body&&!(null===(t=this.modalRef)||void 0===t?void 0:t.contains(o))||(this.previousActiveElement!==document.body&&"function"==typeof(null===(s=this.previousActiveElement)||void 0===s?void 0:s.focus)?this.previousActiveElement.focus():o instanceof i&&o.blur())}else this.setInitialFocus();this.pdsModalOpen.emit()}}),100)}catch(t){console.error("Failed to show modal:",t)}}async hideModal(){var t;if(this.modalRef)try{const i=document.activeElement,o=null!==i&&i!==document.body&&!this.modalRef.contains(i);if(this.modalRef.close(),this.open=!1,h.delete(this.el),!o){const i=this.previousActiveElement;i&&i!==document.body&&i.isConnected&&(null===(t=i.focus)||void 0===t||t.call(i));const o=m();i&&i!==document.body&&r(i,o)&&!r(this.el,o)||this.focusTopModal()}this.pdsModalClose.emit()}catch(t){console.error("Failed to hide modal:",t)}}focusTopModal(){var t;const i=this.innermostOpenModal(),o=null==i?void 0:i.querySelector(".pds-modal__backdrop");o&&(d("dialog:modal",o)||r(i,this.el))&&(null===(t=a(o).find((t=>!r(this.el,t))))||void 0===t||t.focus())}getBackdropZIndex(t){const i=t.querySelector(".pds-modal__backdrop"),o=i?parseInt(getComputedStyle(i).zIndex,10):-1;return Number.isNaN(o)?0:o}isStackedAboveOverlay(t,i,o){if(i&&i!==this.modalRef&&o&&!r(i,this.el))return!0;const s=this.getBackdropZIndex(this.el);let e=t;for(;e&&e!==document.body;){const t=getComputedStyle(e),i=parseInt(t.zIndex,10);if("static"!==t.position&&!isNaN(i)&&i>s)return!0;e=e.parentElement}return!1}innermostOpenModal(){const t=Array.from(h.keys()).filter((t=>t.isConnected)),i=t.filter((i=>!t.some((t=>t!==i&&r(i,t))))),o=[...i].sort(((t,i)=>function(t,i){for(let o=t;o;o=o.getRootNode().host)for(let t=i;t;t=t.getRootNode().host)if(o.getRootNode()===t.getRootNode())return!!(o.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING);return!1}(t,i)?-1:1)),s=t=>{var i;const s=t.querySelector(".pds-modal__backdrop"),e=s?d("dialog:modal",s):null,a=null==e?void 0:e.closest("pds-modal");return[e?1:0,e&&null!==(i=a&&h.get(a))&&void 0!==i?i:0,this.getBackdropZIndex(t),o.indexOf(t)]};let e=null,a=[-1,-1,-1,-1];for(const t of i){const i=s(t),o=i.findIndex(((t,i)=>t!==a[i]));o>=0&&i[o]>a[o]&&(e=t,a=i)}return e}modalDialogAbove(t){var o;for(let s=d("dialog[open]",t);s instanceof i;){if(s===this.modalRef)return!1;if(s.matches(":modal"))return!0;s=d("dialog[open]",null!==(o=s.parentElement)&&void 0!==o?o:s.getRootNode().host)}return!1}stopIndex(t){const i=this.focusableElements.indexOf(t);if(i>=0)return i;for(let i=this.focusableElements.length-1;i>=0;i--)if(r(this.focusableElements[i],t))return i;return-1}resolveSize(){var t;const i=(null!==(t=this.size)&&void 0!==t?t:"").trim()||"md";return l.includes(i)?[i]:/^[a-z0-9.%+\-*/(), ]+$/i.test(o=i)&&/\d/.test(o)&&("undefined"==typeof CSS||CSS.supports("max-width",o))?["custom",i]:[void 0];var o}warnOnInvalidSize(){void 0===this.resolveSize()[0]&&console.warn(`pds-modal: invalid size "${String(this.size).slice(0,50)}", using md`)}render(){const[t="md",i]=this.resolveSize();return s("dialog",{key:"cd574868a46b69185e2058c60374dbec34677732",class:{"pds-modal__backdrop":!0,open:this.open},"aria-modal":this.disableTopLayer?"false":"true","aria-labelledby":`${this.componentId}-heading`,onClick:this.handleBackdropClick,onCancel:this.handleCancel},s("div",{key:"8c50fb4810b4bb07d62348fed44df30b14a52acd",class:{"pds-modal":!0,[`pds-modal--${t}`]:!0,"pds-modal--scrollable":this.scrollable},style:void 0!==i?{"--pds-modal-max-width":i}:void 0,part:"modal"},s("slot",{key:"25a71c95dfeff4648a28edef21bf510b1743ed7c"})))}get el(){return this}static get watchers(){return{size:[{sizeChanged:0}],open:[{handleOpenChange:0}]}}static get style(){return'.pds-modal__backdrop{-ms-flex-align:start;align-items:flex-start;background-color:rgba(0, 0, 0, 0.4);border:0;display:-ms-flexbox;display:flex;height:100%;inset:0;-ms-flex-pack:center;justify-content:center;margin:0;max-height:100%;max-width:100%;opacity:0;padding:0;position:fixed;-webkit-transition:opacity var(--pine-motion-duration-base) var(--pine-motion-easing-in), visibility var(--pine-motion-duration-base) var(--pine-motion-easing-in);transition:opacity var(--pine-motion-duration-base) var(--pine-motion-easing-in), visibility var(--pine-motion-duration-base) var(--pine-motion-easing-in);visibility:hidden;width:100%;z-index:var(--pine-z-index-modal)}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}}pds-modal pds-modal .pds-modal__backdrop{z-index:var(--pine-z-index-priority)}.pds-modal__backdrop::-webkit-backdrop{background:transparent}.pds-modal__backdrop::-ms-backdrop{background:transparent}.pds-modal__backdrop::backdrop{background:transparent}.pds-modal__backdrop[aria-modal=false]{overflow:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop[aria-modal=false]{-webkit-backdrop-filter:none;backdrop-filter:none}.pds-modal__backdrop[aria-modal=false]::before{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);content:"";inset:0;position:fixed;z-index:-1}}.pds-modal__backdrop.open{opacity:1;-webkit-transition-timing-function:var(--pine-motion-easing-out);transition-timing-function:var(--pine-motion-easing-out);visibility:visible}.pds-modal{background:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow-400);box-shadow:var(--pine-box-shadow-400);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:var(--pine-dimension-md);max-height:none;width:100%}.pds-modal.pds-modal--scrollable{max-height:calc(100vh - (5vh + 96px))}@supports (height: 100dvh){.pds-modal.pds-modal--scrollable{max-height:calc(100dvh - (5dvh + 96px))}}@media (min-width: 992px){.pds-modal{-webkit-margin-before:6vh;margin-block-start:6vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:6dvh;margin-block-start:6dvh}}}@media (min-width: 1200px){.pds-modal{-webkit-margin-before:8vh;margin-block-start:8vh}@supports (height: 100dvh){.pds-modal{-webkit-margin-before:8dvh;margin-block-start:8dvh}}}.pds-modal--sm{max-width:520px}.pds-modal--md{max-width:700px}.pds-modal--lg{max-width:900px}.pds-modal--custom{max-width:var(--pds-modal-max-width, 700px)}.pds-modal--fullscreen{border-radius:0;height:100%;margin:0;max-height:100vh;max-width:100%}@supports (height: 100dvh){.pds-modal--fullscreen{max-height:100dvh}}.pds-modal--fullscreen.pds-modal--scrollable{max-height:100vh}@supports (height: 100dvh){.pds-modal--fullscreen.pds-modal--scrollable{max-height:100dvh}}.pds-modal--fullscreen .pds-modal-content{-ms-flex:1;flex:1}.pds-modal--scrollable pds-modal-content{-webkit-border-after:1px solid transparent;border-block-end:1px solid transparent;-webkit-border-before:1px solid transparent;border-block-start:1px solid transparent;overflow-y:auto}.pds-modal:not(.pds-modal--scrollable) pds-modal-content{overflow-y:visible}'}},[260,"pds-modal",{backdropDismiss:[4,"backdrop-dismiss"],componentId:[1,"component-id"],open:[1028],size:[1],scrollable:[4],disableTopLayer:[4,"disable-top-layer"],disableInitialFocus:[4,"disable-initial-focus"],focusableElementsArray:[32],showModal:[64],hideModal:[64]},void 0,{size:[{sizeChanged:0}],open:[{handleOpenChange:0}]}]);function b(){"undefined"!=typeof customElements&&["pds-modal"].forEach((t=>{"pds-modal"===t&&(customElements.get(e(t))||customElements.define(e(t),u))}))}export{u as P,b as d}