@pitchfork-ui/elements 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/cjs/control-label-C0eK8bPh.js +36 -0
  2. package/dist/cjs/control-label-C0eK8bPh.js.map +1 -0
  3. package/dist/cjs/index-CIskGKk1.js +4 -4
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/pf-checkbox.cjs.entry.js +3 -1
  6. package/dist/cjs/pf-checkbox.cjs.entry.js.map +1 -1
  7. package/dist/cjs/pf-combobox.cjs.entry.js +4 -3
  8. package/dist/cjs/pf-combobox.cjs.entry.js.map +1 -1
  9. package/dist/cjs/pf-date-picker.cjs.entry.js +3 -2
  10. package/dist/cjs/pf-date-picker.cjs.entry.js.map +1 -1
  11. package/dist/cjs/pf-date-range-picker.cjs.entry.js +6 -5
  12. package/dist/cjs/pf-date-range-picker.cjs.entry.js.map +1 -1
  13. package/dist/cjs/pf-header-navigation.cjs.entry.js +15 -3
  14. package/dist/cjs/pf-header-navigation.cjs.entry.js.map +1 -1
  15. package/dist/cjs/pf-input.cjs.entry.js +3 -1
  16. package/dist/cjs/pf-input.cjs.entry.js.map +1 -1
  17. package/dist/cjs/pf-modal.cjs.entry.js +89 -1
  18. package/dist/cjs/pf-modal.cjs.entry.js.map +1 -1
  19. package/dist/cjs/pf-multi-select.cjs.entry.js +4 -3
  20. package/dist/cjs/pf-multi-select.cjs.entry.js.map +1 -1
  21. package/dist/cjs/pf-nav-item.cjs.entry.js +29 -4
  22. package/dist/cjs/pf-nav-item.cjs.entry.js.map +1 -1
  23. package/dist/cjs/pf-number-input.cjs.entry.js +2 -1
  24. package/dist/cjs/pf-number-input.cjs.entry.js.map +1 -1
  25. package/dist/cjs/pf-select.cjs.entry.js +4 -3
  26. package/dist/cjs/pf-select.cjs.entry.js.map +1 -1
  27. package/dist/cjs/pf-sidebar-navigation.cjs.entry.js +11 -8
  28. package/dist/cjs/pf-sidebar-navigation.cjs.entry.js.map +1 -1
  29. package/dist/cjs/pf-slider.cjs.entry.js +4 -2
  30. package/dist/cjs/pf-slider.cjs.entry.js.map +1 -1
  31. package/dist/cjs/pf-switch.cjs.entry.js +3 -1
  32. package/dist/cjs/pf-switch.cjs.entry.js.map +1 -1
  33. package/dist/cjs/pf-tag-input.cjs.entry.js +3 -2
  34. package/dist/cjs/pf-tag-input.cjs.entry.js.map +1 -1
  35. package/dist/cjs/pf-textarea.cjs.entry.js +2 -1
  36. package/dist/cjs/pf-textarea.cjs.entry.js.map +1 -1
  37. package/dist/cjs/pf-time-picker.cjs.entry.js +3 -2
  38. package/dist/cjs/pf-time-picker.cjs.entry.js.map +1 -1
  39. package/dist/cjs/pitchfork.cjs.js +1 -1
  40. package/dist/collection/components/pf-accordion/pf-accordion.js +2 -2
  41. package/dist/collection/components/pf-alert/pf-alert.js +1 -1
  42. package/dist/collection/components/pf-avatar/pf-avatar.js +2 -2
  43. package/dist/collection/components/pf-badge/pf-badge.js +1 -1
  44. package/dist/collection/components/pf-badge-group/pf-badge-group.js +3 -3
  45. package/dist/collection/components/pf-button/pf-button.js +3 -3
  46. package/dist/collection/components/pf-checkbox/pf-checkbox.js +4 -1
  47. package/dist/collection/components/pf-checkbox/pf-checkbox.js.map +1 -1
  48. package/dist/collection/components/pf-combobox/pf-combobox.js +4 -3
  49. package/dist/collection/components/pf-combobox/pf-combobox.js.map +1 -1
  50. package/dist/collection/components/pf-content-divider/pf-content-divider.js +1 -1
  51. package/dist/collection/components/pf-credit-card/pf-credit-card.js +1 -1
  52. package/dist/collection/components/pf-date-picker/pf-date-picker.js +3 -2
  53. package/dist/collection/components/pf-date-picker/pf-date-picker.js.map +1 -1
  54. package/dist/collection/components/pf-date-range-picker/pf-date-range-picker.js +6 -5
  55. package/dist/collection/components/pf-date-range-picker/pf-date-range-picker.js.map +1 -1
  56. package/dist/collection/components/pf-empty-state/pf-empty-state.js +1 -1
  57. package/dist/collection/components/pf-header-navigation/pf-header-navigation.js +25 -4
  58. package/dist/collection/components/pf-header-navigation/pf-header-navigation.js.map +1 -1
  59. package/dist/collection/components/pf-inline-cta/pf-inline-cta.js +1 -1
  60. package/dist/collection/components/pf-input/pf-input.js +5 -2
  61. package/dist/collection/components/pf-input/pf-input.js.map +1 -1
  62. package/dist/collection/components/pf-kbd/pf-kbd.js +1 -1
  63. package/dist/collection/components/pf-line-chart/pf-line-chart.js +1 -1
  64. package/dist/collection/components/pf-loading-dots/pf-loading-dots.js +1 -1
  65. package/dist/collection/components/pf-metric-card/pf-metric-card.js +1 -1
  66. package/dist/collection/components/pf-modal/pf-modal.js +77 -6
  67. package/dist/collection/components/pf-modal/pf-modal.js.map +1 -1
  68. package/dist/collection/components/pf-multi-select/pf-multi-select.js +4 -3
  69. package/dist/collection/components/pf-multi-select/pf-multi-select.js.map +1 -1
  70. package/dist/collection/components/pf-nav-item/pf-nav-item.js +50 -5
  71. package/dist/collection/components/pf-nav-item/pf-nav-item.js.map +1 -1
  72. package/dist/collection/components/pf-notification/pf-notification.js +1 -1
  73. package/dist/collection/components/pf-number-input/pf-number-input.js +2 -1
  74. package/dist/collection/components/pf-number-input/pf-number-input.js.map +1 -1
  75. package/dist/collection/components/pf-progress-steps/pf-progress-steps.js +1 -1
  76. package/dist/collection/components/pf-radio-group/pf-radio-group.js +1 -1
  77. package/dist/collection/components/pf-rating-badge/pf-rating-badge.js +1 -1
  78. package/dist/collection/components/pf-scroll-area/pf-scroll-area.js +1 -1
  79. package/dist/collection/components/pf-section-header/pf-section-header.js +1 -1
  80. package/dist/collection/components/pf-select/pf-select.js +4 -3
  81. package/dist/collection/components/pf-select/pf-select.js.map +1 -1
  82. package/dist/collection/components/pf-sidebar-navigation/pf-sidebar-navigation.js +12 -9
  83. package/dist/collection/components/pf-sidebar-navigation/pf-sidebar-navigation.js.map +1 -1
  84. package/dist/collection/components/pf-slideout-menu/pf-slideout-menu.js +2 -2
  85. package/dist/collection/components/pf-slider/pf-slider.js +5 -2
  86. package/dist/collection/components/pf-slider/pf-slider.js.map +1 -1
  87. package/dist/collection/components/pf-switch/pf-switch.js +4 -1
  88. package/dist/collection/components/pf-switch/pf-switch.js.map +1 -1
  89. package/dist/collection/components/pf-tab/pf-tab.js +2 -2
  90. package/dist/collection/components/pf-table-cell/pf-table-cell.js +1 -1
  91. package/dist/collection/components/pf-tabs/pf-tabs.js +2 -2
  92. package/dist/collection/components/pf-tag/pf-tag.js +1 -1
  93. package/dist/collection/components/pf-tag-input/pf-tag-input.js +3 -2
  94. package/dist/collection/components/pf-tag-input/pf-tag-input.js.map +1 -1
  95. package/dist/collection/components/pf-textarea/pf-textarea.js +2 -1
  96. package/dist/collection/components/pf-textarea/pf-textarea.js.map +1 -1
  97. package/dist/collection/components/pf-time-picker/pf-time-picker.js +3 -2
  98. package/dist/collection/components/pf-time-picker/pf-time-picker.js.map +1 -1
  99. package/dist/collection/components/pf-timeline-item/pf-timeline-item.js +1 -1
  100. package/dist/collection/components/pf-toaster/pf-toaster.js +2 -2
  101. package/dist/collection/components/pf-toolbar/pf-toolbar.js +1 -1
  102. package/dist/collection/components/pf-toolbar-separator/pf-toolbar-separator.js +1 -1
  103. package/dist/collection/components/pf-utility-button/pf-utility-button.js +2 -2
  104. package/dist/collection/components/pf-video-player/pf-video-player.js +2 -2
  105. package/dist/collection/control-label.js +30 -0
  106. package/dist/collection/control-label.js.map +1 -0
  107. package/dist/components/p-Cy_kHPeC.js +2 -0
  108. package/dist/components/p-Cy_kHPeC.js.map +1 -0
  109. package/dist/components/pf-checkbox.js +1 -1
  110. package/dist/components/pf-checkbox.js.map +1 -1
  111. package/dist/components/pf-combobox.js +1 -1
  112. package/dist/components/pf-combobox.js.map +1 -1
  113. package/dist/components/pf-date-picker.js +1 -1
  114. package/dist/components/pf-date-picker.js.map +1 -1
  115. package/dist/components/pf-date-range-picker.js +1 -1
  116. package/dist/components/pf-date-range-picker.js.map +1 -1
  117. package/dist/components/pf-header-navigation.js +1 -1
  118. package/dist/components/pf-header-navigation.js.map +1 -1
  119. package/dist/components/pf-input.js +1 -1
  120. package/dist/components/pf-input.js.map +1 -1
  121. package/dist/components/pf-modal.js +1 -1
  122. package/dist/components/pf-modal.js.map +1 -1
  123. package/dist/components/pf-multi-select.js +1 -1
  124. package/dist/components/pf-multi-select.js.map +1 -1
  125. package/dist/components/pf-nav-item.js +1 -1
  126. package/dist/components/pf-nav-item.js.map +1 -1
  127. package/dist/components/pf-number-input.js +1 -1
  128. package/dist/components/pf-number-input.js.map +1 -1
  129. package/dist/components/pf-select.js +1 -1
  130. package/dist/components/pf-select.js.map +1 -1
  131. package/dist/components/pf-sidebar-navigation.js +1 -1
  132. package/dist/components/pf-sidebar-navigation.js.map +1 -1
  133. package/dist/components/pf-slider.js +1 -1
  134. package/dist/components/pf-slider.js.map +1 -1
  135. package/dist/components/pf-switch.js +1 -1
  136. package/dist/components/pf-switch.js.map +1 -1
  137. package/dist/components/pf-tag-input.js +1 -1
  138. package/dist/components/pf-tag-input.js.map +1 -1
  139. package/dist/components/pf-textarea.js +1 -1
  140. package/dist/components/pf-textarea.js.map +1 -1
  141. package/dist/components/pf-time-picker.js +1 -1
  142. package/dist/components/pf-time-picker.js.map +1 -1
  143. package/dist/docs.json +73 -52
  144. package/dist/elements.json +100 -10
  145. package/dist/esm/control-label-Cy_kHPeC.js +34 -0
  146. package/dist/esm/control-label-Cy_kHPeC.js.map +1 -0
  147. package/dist/esm/index-Bm6UxEit.js +4 -4
  148. package/dist/esm/loader.js +1 -1
  149. package/dist/esm/pf-checkbox.entry.js +4 -2
  150. package/dist/esm/pf-checkbox.entry.js.map +1 -1
  151. package/dist/esm/pf-combobox.entry.js +4 -3
  152. package/dist/esm/pf-combobox.entry.js.map +1 -1
  153. package/dist/esm/pf-date-picker.entry.js +3 -2
  154. package/dist/esm/pf-date-picker.entry.js.map +1 -1
  155. package/dist/esm/pf-date-range-picker.entry.js +6 -5
  156. package/dist/esm/pf-date-range-picker.entry.js.map +1 -1
  157. package/dist/esm/pf-header-navigation.entry.js +15 -3
  158. package/dist/esm/pf-header-navigation.entry.js.map +1 -1
  159. package/dist/esm/pf-input.entry.js +4 -2
  160. package/dist/esm/pf-input.entry.js.map +1 -1
  161. package/dist/esm/pf-modal.entry.js +89 -1
  162. package/dist/esm/pf-modal.entry.js.map +1 -1
  163. package/dist/esm/pf-multi-select.entry.js +4 -3
  164. package/dist/esm/pf-multi-select.entry.js.map +1 -1
  165. package/dist/esm/pf-nav-item.entry.js +30 -5
  166. package/dist/esm/pf-nav-item.entry.js.map +1 -1
  167. package/dist/esm/pf-number-input.entry.js +2 -1
  168. package/dist/esm/pf-number-input.entry.js.map +1 -1
  169. package/dist/esm/pf-select.entry.js +4 -3
  170. package/dist/esm/pf-select.entry.js.map +1 -1
  171. package/dist/esm/pf-sidebar-navigation.entry.js +11 -8
  172. package/dist/esm/pf-sidebar-navigation.entry.js.map +1 -1
  173. package/dist/esm/pf-slider.entry.js +5 -3
  174. package/dist/esm/pf-slider.entry.js.map +1 -1
  175. package/dist/esm/pf-switch.entry.js +4 -2
  176. package/dist/esm/pf-switch.entry.js.map +1 -1
  177. package/dist/esm/pf-tag-input.entry.js +3 -2
  178. package/dist/esm/pf-tag-input.entry.js.map +1 -1
  179. package/dist/esm/pf-textarea.entry.js +2 -1
  180. package/dist/esm/pf-textarea.entry.js.map +1 -1
  181. package/dist/esm/pf-time-picker.entry.js +3 -2
  182. package/dist/esm/pf-time-picker.entry.js.map +1 -1
  183. package/dist/esm/pitchfork.js +1 -1
  184. package/dist/pitchfork/p-01ed0d56.entry.js +2 -0
  185. package/dist/pitchfork/p-01ed0d56.entry.js.map +1 -0
  186. package/dist/pitchfork/p-02e28338.entry.js +2 -0
  187. package/dist/pitchfork/p-02e28338.entry.js.map +1 -0
  188. package/dist/pitchfork/p-19c0145c.entry.js +2 -0
  189. package/dist/pitchfork/p-19c0145c.entry.js.map +1 -0
  190. package/dist/pitchfork/p-22d8c69d.entry.js +2 -0
  191. package/dist/pitchfork/p-22d8c69d.entry.js.map +1 -0
  192. package/dist/pitchfork/p-2add2e98.entry.js +2 -0
  193. package/dist/pitchfork/p-2add2e98.entry.js.map +1 -0
  194. package/dist/pitchfork/p-45039de3.entry.js +2 -0
  195. package/dist/pitchfork/p-45039de3.entry.js.map +1 -0
  196. package/dist/pitchfork/p-4dfe7e8a.entry.js +2 -0
  197. package/dist/pitchfork/p-4dfe7e8a.entry.js.map +1 -0
  198. package/dist/pitchfork/p-51353d53.entry.js +2 -0
  199. package/dist/pitchfork/p-51353d53.entry.js.map +1 -0
  200. package/dist/pitchfork/p-5b98848c.entry.js +2 -0
  201. package/dist/pitchfork/{p-fd5a5ea1.entry.js.map → p-5b98848c.entry.js.map} +1 -1
  202. package/dist/pitchfork/p-7197ef71.entry.js +2 -0
  203. package/dist/pitchfork/p-7197ef71.entry.js.map +1 -0
  204. package/dist/pitchfork/p-Cy_kHPeC.js +2 -0
  205. package/dist/pitchfork/p-Cy_kHPeC.js.map +1 -0
  206. package/dist/pitchfork/p-ab6c09e7.entry.js +2 -0
  207. package/dist/pitchfork/p-ab6c09e7.entry.js.map +1 -0
  208. package/dist/pitchfork/p-d7ca4026.entry.js +2 -0
  209. package/dist/pitchfork/p-d7ca4026.entry.js.map +1 -0
  210. package/dist/pitchfork/p-dd48d94d.entry.js +2 -0
  211. package/dist/pitchfork/p-dd48d94d.entry.js.map +1 -0
  212. package/dist/pitchfork/p-ec8df806.entry.js +2 -0
  213. package/dist/pitchfork/p-ec8df806.entry.js.map +1 -0
  214. package/dist/pitchfork/p-f5df568f.entry.js +2 -0
  215. package/dist/pitchfork/p-f5df568f.entry.js.map +1 -0
  216. package/dist/pitchfork/p-f713c62d.entry.js +2 -0
  217. package/dist/pitchfork/p-f713c62d.entry.js.map +1 -0
  218. package/dist/pitchfork/p-fd802631.entry.js +2 -0
  219. package/dist/pitchfork/p-fd802631.entry.js.map +1 -0
  220. package/dist/pitchfork/pitchfork.esm.js +1 -1
  221. package/dist/types/components/pf-checkbox/pf-checkbox.d.ts +1 -0
  222. package/dist/types/components/pf-header-navigation/pf-header-navigation.d.ts +11 -2
  223. package/dist/types/components/pf-input/pf-input.d.ts +1 -0
  224. package/dist/types/components/pf-modal/pf-modal.d.ts +56 -3
  225. package/dist/types/components/pf-nav-item/pf-nav-item.d.ts +21 -1
  226. package/dist/types/components/pf-sidebar-navigation/pf-sidebar-navigation.d.ts +10 -7
  227. package/dist/types/components/pf-slider/pf-slider.d.ts +1 -0
  228. package/dist/types/components/pf-switch/pf-switch.d.ts +1 -0
  229. package/dist/types/components.d.ts +57 -18
  230. package/dist/types/control-label.d.ts +24 -0
  231. package/package.json +4 -4
  232. package/dist/pitchfork/p-1dbea97f.entry.js +0 -2
  233. package/dist/pitchfork/p-1dbea97f.entry.js.map +0 -1
  234. package/dist/pitchfork/p-23b1be9b.entry.js +0 -2
  235. package/dist/pitchfork/p-23b1be9b.entry.js.map +0 -1
  236. package/dist/pitchfork/p-33857f80.entry.js +0 -2
  237. package/dist/pitchfork/p-33857f80.entry.js.map +0 -1
  238. package/dist/pitchfork/p-47cabc33.entry.js +0 -2
  239. package/dist/pitchfork/p-47cabc33.entry.js.map +0 -1
  240. package/dist/pitchfork/p-48b2d3f7.entry.js +0 -2
  241. package/dist/pitchfork/p-48b2d3f7.entry.js.map +0 -1
  242. package/dist/pitchfork/p-5064d2dd.entry.js +0 -2
  243. package/dist/pitchfork/p-5064d2dd.entry.js.map +0 -1
  244. package/dist/pitchfork/p-52eef7eb.entry.js +0 -2
  245. package/dist/pitchfork/p-52eef7eb.entry.js.map +0 -1
  246. package/dist/pitchfork/p-845c5252.entry.js +0 -2
  247. package/dist/pitchfork/p-845c5252.entry.js.map +0 -1
  248. package/dist/pitchfork/p-a24bf2bd.entry.js +0 -2
  249. package/dist/pitchfork/p-a24bf2bd.entry.js.map +0 -1
  250. package/dist/pitchfork/p-a9b77dbb.entry.js +0 -2
  251. package/dist/pitchfork/p-a9b77dbb.entry.js.map +0 -1
  252. package/dist/pitchfork/p-c6bdd9cd.entry.js +0 -2
  253. package/dist/pitchfork/p-c6bdd9cd.entry.js.map +0 -1
  254. package/dist/pitchfork/p-d0d2070b.entry.js +0 -2
  255. package/dist/pitchfork/p-d0d2070b.entry.js.map +0 -1
  256. package/dist/pitchfork/p-d248b027.entry.js +0 -2
  257. package/dist/pitchfork/p-d248b027.entry.js.map +0 -1
  258. package/dist/pitchfork/p-d6425298.entry.js +0 -2
  259. package/dist/pitchfork/p-d6425298.entry.js.map +0 -1
  260. package/dist/pitchfork/p-d7eb6335.entry.js +0 -2
  261. package/dist/pitchfork/p-d7eb6335.entry.js.map +0 -1
  262. package/dist/pitchfork/p-e944f504.entry.js +0 -2
  263. package/dist/pitchfork/p-e944f504.entry.js.map +0 -1
  264. package/dist/pitchfork/p-fd5a5ea1.entry.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"pf-combobox.entry.js","sources":["src/components/pf-combobox/pf-combobox.css?tag=pf-combobox&encapsulation=shadow","src/components/pf-combobox/pf-combobox.tsx"],"sourcesContent":["/*\n * The generic set pf-option reads, mapped to this control's own family — see\n * pf-option.css. The same option element is themed by whichever listbox it is\n * slotted into.\n */\n:host {\n display: block;\n --pf-option-text: var(--pf-combobox-text);\n --pf-option-text-disabled: var(--pf-combobox-placeholder);\n --pf-option-active-bg: var(--pf-combobox-option-active-bg);\n --pf-option-active-text: var(--pf-combobox-option-active-text);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-combobox-text);\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-combobox-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.control {\n align-items: center;\n background: var(--pf-combobox-bg);\n border: 1px solid var(--pf-combobox-border);\n border-radius: var(--radius-md);\n display: flex;\n gap: var(--space-1);\n padding-inline-end: var(--space-2);\n}\n\n.control:focus-within {\n border-color: var(--pf-combobox-focus-border);\n box-shadow: var(--pf-focus-ring);\n}\n\n.control--invalid {\n border-color: var(--pf-combobox-invalid-border);\n}\n\n.input {\n background: none;\n border: 0;\n color: var(--pf-combobox-text);\n flex: 1;\n font-family: inherit;\n font-size: var(--font-size-sm);\n min-width: 0;\n outline: none;\n padding: var(--space-2) var(--space-3);\n}\n\n.input::placeholder {\n color: var(--pf-combobox-placeholder);\n}\n\n.input:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.clear,\n.chevron {\n align-items: center;\n color: var(--pf-combobox-placeholder);\n display: inline-flex;\n flex-shrink: 0;\n justify-content: center;\n}\n\n.clear {\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n cursor: pointer;\n padding: var(--space-1);\n}\n\n.clear:hover {\n color: var(--pf-combobox-text);\n}\n\n.chevron {\n transition: transform var(--pf-transition-fast);\n}\n\n:host([open]) .chevron {\n transform: rotate(180deg);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n}\n\n.description {\n color: var(--pf-combobox-placeholder);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-combobox-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/* See src/place-popover.ts: the UA stylesheet centres a popover otherwise. */\n.listbox {\n inset: auto;\n margin: 0;\n background: var(--pf-combobox-menu-bg);\n border: 1px solid var(--pf-combobox-menu-border);\n border-radius: var(--radius-md);\n box-shadow: var(--pf-elevation-popover-shadow);\n max-height: min(60vh, 320px);\n overflow-y: auto;\n padding: var(--space-1);\n}\n\n.listbox:popover-open {\n animation: pf-combobox-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-combobox-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .listbox:popover-open {\n animation: none;\n }\n}\n\n.empty {\n color: var(--pf-combobox-placeholder);\n font-size: var(--font-size-sm);\n margin: 0;\n padding: var(--space-3);\n text-align: center;\n}\n","import {\n composeDescribedBy,\n getEnabledIndexes,\n Keys,\n matchesCommandQuery,\n observeAnchoredPosition,\n queryIsEchoedSelection,\n resolveListMove,\n type ListNavigationAction,\n} from '@pitchfork-ui/core';\n\nimport { applyControlValidity } from '../../form-validity';\nimport { placePopover } from '../../place-popover';\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\n\nconst MOVES: Record<string, ListNavigationAction> = {\n [Keys.ArrowDown]: 'next',\n [Keys.ArrowUp]: 'previous',\n [Keys.Home]: 'first',\n [Keys.End]: 'last',\n};\n\n/**\n * A form-associated combobox: an editable field that filters `pf-option`\n * children.\n *\n * It shares `pf-option` with `pf-select`, which is why the option reads a\n * generic `--pf-option-*` set that each container maps to its own family —\n * the same arrangement as `pf-menu-item` between the two menus.\n *\n * Filtering is core's `matchesCommandQuery`, and so is the rule that a query\n * which is only the chosen label echoed back does not filter: without it,\n * reopening the list to change your mind would show the one answer you already\n * had. Both shared with the React component, which is now rewired to them.\n *\n * Two things the React `Combobox` does not do, both gaps rather than choices:\n * Home and End, and arrows that wrap rather than stop at the ends — which is\n * what `pf-select` does, and one design system should not have two arrow\n * behaviours in neighbouring controls.\n *\n * @slot - the `pf-option` children.\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part control - the box holding the input, clear button and chevron.\n * @part input - the editable field.\n * @part clear - the clear button.\n * @part listbox - the floating listbox the options are slotted into.\n * @part empty - the message shown when nothing matches.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-combobox',\n styleUrl: 'pf-combobox.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfCombobox {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Submitted under this name. Reflected; the submission reads the attribute. */\n @Prop({ reflect: true }) name?: string;\n\n /** The chosen option's value, or empty. */\n @Prop({ mutable: true, reflect: true }) value = '';\n\n /** Whether the listbox is showing. Reflected for the stylesheet. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Prop() label?: string;\n\n @Prop() description?: string;\n\n @Prop() error?: string;\n\n @Prop() placeholder = 'Search…';\n\n /** Shown when the query matches nothing. */\n @Prop() emptyMessage = 'No matches';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Offer a button that empties the field. */\n @Prop() clearable = true;\n\n /** Accessible name for that button. */\n @Prop() clearLabel = 'Clear';\n\n /** Fires when the chosen value changes. */\n @Event() pfChange!: EventEmitter<{ value: string }>;\n\n /** Fires whenever the listbox opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** What the field holds, which is not the value until an option is chosen. */\n @State() query = '';\n\n @State() matchCount = 0;\n\n private initialValue = '';\n private stopObserving?: () => void;\n private activeOption: HTMLElement | null = null;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n this.query = this.selectedLabel();\n this.applyQuery();\n }\n\n componentDidRender() {\n this.syncActiveDescendant();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n this.internals.setFormValue(this.value || null);\n applyControlValidity(this.internals, Boolean(this.value), this.required, this.error);\n }\n\n /** A value set from outside puts its label in the field and marks the option. */\n @Watch('value')\n syncSelection() {\n for (const option of this.options()) {\n (option as HTMLElement & { selected: boolean }).selected =\n this.optionValue(option) === this.value && this.value !== '';\n }\n this.query = this.selectedLabel();\n this.applyQuery();\n }\n\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showListbox();\n else this.hideListbox();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n this.query = this.selectedLabel();\n this.applyQuery();\n }\n\n /** Re-reads the options, for a label edited in place (no `slotchange` fires). */\n @Method()\n async refresh(): Promise<void> {\n this.syncSelection();\n }\n\n private onSlotChange = () => {\n this.syncSelection();\n };\n\n private options(): HTMLElement[] {\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-option'));\n }\n\n private visible(): HTMLElement[] {\n return this.options().filter((option) => !option.hasAttribute('hidden'));\n }\n\n /** The property, never the attribute: a binding may only have set the former. */\n private optionValue(option: HTMLElement): string {\n return (option as HTMLElement & { value?: string }).value ?? option.getAttribute('value') ?? '';\n }\n\n private selectedLabel(): string {\n const chosen = this.options().find((option) => this.optionValue(option) === this.value);\n return this.value && chosen ? (chosen.textContent?.trim() ?? '') : '';\n }\n\n private get listbox() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"listbox\"]') ?? null;\n }\n\n private get input() {\n return this.el.shadowRoot?.querySelector<HTMLInputElement>('[part=\"input\"]') ?? null;\n }\n\n private get control() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"control\"]') ?? null;\n }\n\n /**\n * Hides the options the query excludes.\n *\n * `hidden` plus `:host([hidden]) { display: none }` on the option, because\n * the attribute alone loses to the option's own `display: block`.\n */\n private applyQuery() {\n const echoed = queryIsEchoedSelection(this.query, this.selectedLabel());\n const options = this.options();\n\n for (const option of options) {\n const matches =\n echoed || matchesCommandQuery({ label: option.textContent?.trim() ?? '' }, this.query);\n if (matches) option.removeAttribute('hidden');\n else option.setAttribute('hidden', '');\n }\n\n const visible = this.visible();\n this.matchCount = visible.length;\n\n // A new query starts at the top of what is left.\n const first = visible.find((option) => !option.hasAttribute('disabled')) ?? null;\n if (!this.activeOption || this.activeOption.hasAttribute('hidden')) this.setActive(first);\n }\n\n private showListbox() {\n const panel = this.listbox;\n if (this.disabled || !panel || panel.matches(':popover-open')) return;\n\n panel.showPopover();\n this.stopObserving?.();\n this.stopObserving = observeAnchoredPosition({\n getAnchor: () => this.control,\n getFloating: () => panel,\n matchAnchorWidth: true,\n flip: true,\n onChange: ({ left, top, width, minWidth }) => {\n placePopover(panel, left, top);\n if (width !== undefined) panel.style.width = `${width}px`;\n if (minWidth !== undefined) panel.style.minWidth = `${minWidth}px`;\n },\n });\n\n this.applyQuery();\n }\n\n private hideListbox() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n const panel = this.listbox;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n /**\n * A browser-driven close — light dismiss or Escape — reverts the field to\n * the chosen label, so a half-typed query never lingers over a different\n * value. Focus goes back to the input rather than the trigger, because here\n * the input *is* the control.\n */\n private onToggle = (event: ToggleEvent) => {\n const nowOpen = event.newState === 'open';\n if (this.open !== nowOpen) this.open = nowOpen;\n if (!nowOpen) {\n this.query = this.selectedLabel();\n this.applyQuery();\n this.input?.focus();\n }\n };\n\n private setActive(option: HTMLElement | null) {\n for (const other of this.options()) {\n if (other !== option) (other as HTMLElement & { active: boolean }).active = false;\n }\n if (option) (option as HTMLElement & { active: boolean }).active = true;\n\n this.activeOption = option;\n this.syncActiveDescendant();\n if (option && typeof option.scrollIntoView === 'function') {\n option.scrollIntoView({ block: 'nearest' });\n }\n }\n\n /**\n * Set as an element, not an IDREF: the input is in this shadow root and the\n * options are slotted light DOM, and a cross-root IDREF is absent from the\n * accessibility tree — measured. Feature-detected, because where element\n * reflection is missing there is no cross-root equivalent.\n */\n private syncActiveDescendant() {\n const input = this.input;\n if (!input || !('ariaActiveDescendantElement' in input)) return;\n (\n input as unknown as { ariaActiveDescendantElement: Element | null }\n ).ariaActiveDescendantElement = this.open ? this.activeOption : null;\n }\n\n private commit(option: HTMLElement) {\n if (option.hasAttribute('disabled')) return;\n\n const next = this.optionValue(option);\n this.open = false;\n\n if (next !== this.value) {\n this.value = next;\n this.pfChange.emit({ value: next });\n }\n\n // Set after the value, so it is the chosen label rather than the query.\n this.query = this.selectedLabel();\n this.applyQuery();\n this.input?.focus();\n }\n\n @Listen('pfOptionSelect')\n handleOptionSelect(event: CustomEvent<{ value: string }>) {\n event.stopPropagation();\n if (this.disabled) return;\n\n const option = this.options().find(\n (candidate) => this.optionValue(candidate) === event.detail.value,\n );\n if (option) this.commit(option);\n }\n\n private move(action: ListNavigationAction) {\n const visible = this.visible();\n const enabledIndexes = getEnabledIndexes(visible, (option) => option.hasAttribute('disabled'));\n const current = this.activeOption ? visible.indexOf(this.activeOption) : -1;\n const next = resolveListMove(action, enabledIndexes, current);\n if (next !== -1) this.setActive(visible[next] ?? null);\n }\n\n private onInput = (event: Event) => {\n this.query = (event.target as HTMLInputElement).value;\n this.applyQuery();\n if (!this.open) this.open = true;\n };\n\n private clear = () => {\n this.query = '';\n if (this.value !== '') {\n this.value = '';\n this.pfChange.emit({ value: '' });\n }\n this.applyQuery();\n this.open = true;\n this.input?.focus();\n };\n\n private onKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n const move = MOVES[event.key];\n if (move) {\n event.preventDefault();\n if (!this.open) this.open = true;\n else this.move(move);\n return;\n }\n\n /*\n * Enter only commits while the listbox is open. Closed, it is left alone\n * so a combobox inside a form still submits it.\n */\n if (event.key === Keys.Enter && this.open && this.activeOption) {\n event.preventDefault();\n this.commit(this.activeOption);\n }\n\n // Escape is the browser's: `popover=\"auto\"` closes, and `onToggle` reverts.\n };\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n const showClear = this.clearable && !this.disabled && (this.query !== '' || this.value !== '');\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"input\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div class={{ control: true, 'control--invalid': Boolean(this.error) }} part=\"control\">\n <input\n id=\"input\"\n part=\"input\"\n class=\"input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n disabled={this.disabled}\n required={this.required}\n placeholder={this.placeholder}\n value={this.query}\n aria-autocomplete=\"list\"\n aria-expanded={this.open ? 'true' : 'false'}\n /* Same shadow root as the listbox, so this IDREF resolves. */\n aria-controls=\"listbox\"\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={describedBy}\n onInput={this.onInput}\n onKeyDown={this.onKeyDown}\n onClick={() => {\n if (!this.disabled) this.open = true;\n }}\n />\n\n {showClear && (\n <button\n class=\"clear\"\n part=\"clear\"\n type=\"button\"\n aria-label={this.clearLabel}\n /* Out of the tab order, so it never interrupts the keyboard flow. */\n tabindex={-1}\n onMouseDown={(event) => event.preventDefault()}\n onClick={this.clear}\n >\n <pf-icon name=\"circle-xmark\"></pf-icon>\n </button>\n )}\n\n <span class=\"chevron\" aria-hidden=\"true\">\n <pf-icon name=\"chevron-down\"></pf-icon>\n </span>\n </div>\n\n {this.description && (\n <p class=\"description\" part=\"description\" id=\"description\">\n {this.description}\n </p>\n )}\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </div>\n\n <div\n id=\"listbox\"\n part=\"listbox\"\n class=\"listbox\"\n popover=\"auto\"\n role=\"listbox\"\n aria-label={this.label ?? this.placeholder}\n onToggle={this.onToggle}\n >\n <slot onSlotchange={this.onSlotChange} />\n {this.matchCount === 0 && (\n <p class=\"empty\" part=\"empty\">\n {this.emptyMessage}\n </p>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,aAAa,GAAG,MAAM,CAAC,i0EAAi0E,CAAC;;AC4B/1E,MAAM,KAAK,GAAyC;AAClD,IAAA,CAAC,IAAI,CAAC,SAAS,GAAG,MAAM;AACxB,IAAA,CAAC,IAAI,CAAC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f-combobox.entry.js","sources":["src/components/pf-combobox/pf-combobox.css?tag=pf-combobox&encapsulation=shadow","src/components/pf-combobox/pf-combobox.tsx"],"sourcesContent":["/*\n * The generic set pf-option reads, mapped to this control's own family — see\n * pf-option.css. The same option element is themed by whichever listbox it is\n * slotted into.\n */\n:host {\n display: block;\n --pf-option-text: var(--pf-combobox-text);\n --pf-option-text-disabled: var(--pf-combobox-placeholder);\n --pf-option-active-bg: var(--pf-combobox-option-active-bg);\n --pf-option-active-text: var(--pf-combobox-option-active-text);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-combobox-text);\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-combobox-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.control {\n align-items: center;\n background: var(--pf-combobox-bg);\n border: 1px solid var(--pf-combobox-border);\n border-radius: var(--radius-md);\n display: flex;\n gap: var(--space-1);\n padding-inline-end: var(--space-2);\n}\n\n.control:focus-within {\n border-color: var(--pf-combobox-focus-border);\n box-shadow: var(--pf-focus-ring);\n}\n\n.control--invalid {\n border-color: var(--pf-combobox-invalid-border);\n}\n\n.input {\n background: none;\n border: 0;\n color: var(--pf-combobox-text);\n flex: 1;\n font-family: inherit;\n font-size: var(--font-size-sm);\n min-width: 0;\n outline: none;\n padding: var(--space-2) var(--space-3);\n}\n\n.input::placeholder {\n color: var(--pf-combobox-placeholder);\n}\n\n.input:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.clear,\n.chevron {\n align-items: center;\n color: var(--pf-combobox-placeholder);\n display: inline-flex;\n flex-shrink: 0;\n justify-content: center;\n}\n\n.clear {\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n cursor: pointer;\n padding: var(--space-1);\n}\n\n.clear:hover {\n color: var(--pf-combobox-text);\n}\n\n.chevron {\n transition: transform var(--pf-transition-fast);\n}\n\n:host([open]) .chevron {\n transform: rotate(180deg);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n}\n\n.description {\n color: var(--pf-combobox-placeholder);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-combobox-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/* See src/place-popover.ts: the UA stylesheet centres a popover otherwise. */\n.listbox {\n inset: auto;\n margin: 0;\n background: var(--pf-combobox-menu-bg);\n border: 1px solid var(--pf-combobox-menu-border);\n border-radius: var(--radius-md);\n box-shadow: var(--pf-elevation-popover-shadow);\n max-height: min(60vh, 320px);\n overflow-y: auto;\n padding: var(--space-1);\n}\n\n.listbox:popover-open {\n animation: pf-combobox-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-combobox-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .listbox:popover-open {\n animation: none;\n }\n}\n\n.empty {\n color: var(--pf-combobox-placeholder);\n font-size: var(--font-size-sm);\n margin: 0;\n padding: var(--space-3);\n text-align: center;\n}\n","import {\n composeDescribedBy,\n getEnabledIndexes,\n Keys,\n matchesCommandQuery,\n observeAnchoredPosition,\n queryIsEchoedSelection,\n resolveListMove,\n type ListNavigationAction,\n} from '@pitchfork-ui/core';\n\nimport { applyControlValidity } from '../../form-validity';\nimport { controlAriaLabel } from '../../control-label';\nimport { placePopover } from '../../place-popover';\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\n\nconst MOVES: Record<string, ListNavigationAction> = {\n [Keys.ArrowDown]: 'next',\n [Keys.ArrowUp]: 'previous',\n [Keys.Home]: 'first',\n [Keys.End]: 'last',\n};\n\n/**\n * A form-associated combobox: an editable field that filters `pf-option`\n * children.\n *\n * It shares `pf-option` with `pf-select`, which is why the option reads a\n * generic `--pf-option-*` set that each container maps to its own family —\n * the same arrangement as `pf-menu-item` between the two menus.\n *\n * Filtering is core's `matchesCommandQuery`, and so is the rule that a query\n * which is only the chosen label echoed back does not filter: without it,\n * reopening the list to change your mind would show the one answer you already\n * had. Both shared with the React component, which is now rewired to them.\n *\n * Two things the React `Combobox` does not do, both gaps rather than choices:\n * Home and End, and arrows that wrap rather than stop at the ends — which is\n * what `pf-select` does, and one design system should not have two arrow\n * behaviours in neighbouring controls.\n *\n * @slot - the `pf-option` children.\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part control - the box holding the input, clear button and chevron.\n * @part input - the editable field.\n * @part clear - the clear button.\n * @part listbox - the floating listbox the options are slotted into.\n * @part empty - the message shown when nothing matches.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-combobox',\n styleUrl: 'pf-combobox.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfCombobox {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Submitted under this name. Reflected; the submission reads the attribute. */\n @Prop({ reflect: true }) name?: string;\n\n /** The chosen option's value, or empty. */\n @Prop({ mutable: true, reflect: true }) value = '';\n\n /** Whether the listbox is showing. Reflected for the stylesheet. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Prop() label?: string;\n\n @Prop() description?: string;\n\n @Prop() error?: string;\n\n @Prop() placeholder = 'Search…';\n\n /** Shown when the query matches nothing. */\n @Prop() emptyMessage = 'No matches';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Offer a button that empties the field. */\n @Prop() clearable = true;\n\n /** Accessible name for that button. */\n @Prop() clearLabel = 'Clear';\n\n /** Fires when the chosen value changes. */\n @Event() pfChange!: EventEmitter<{ value: string }>;\n\n /** Fires whenever the listbox opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** What the field holds, which is not the value until an option is chosen. */\n @State() query = '';\n\n @State() matchCount = 0;\n\n private initialValue = '';\n private stopObserving?: () => void;\n private activeOption: HTMLElement | null = null;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n this.query = this.selectedLabel();\n this.applyQuery();\n }\n\n componentDidRender() {\n this.syncActiveDescendant();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n this.internals.setFormValue(this.value || null);\n applyControlValidity(this.internals, Boolean(this.value), this.required, this.error);\n }\n\n /** A value set from outside puts its label in the field and marks the option. */\n @Watch('value')\n syncSelection() {\n for (const option of this.options()) {\n (option as HTMLElement & { selected: boolean }).selected =\n this.optionValue(option) === this.value && this.value !== '';\n }\n this.query = this.selectedLabel();\n this.applyQuery();\n }\n\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showListbox();\n else this.hideListbox();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n this.query = this.selectedLabel();\n this.applyQuery();\n }\n\n /** Re-reads the options, for a label edited in place (no `slotchange` fires). */\n @Method()\n async refresh(): Promise<void> {\n this.syncSelection();\n }\n\n private onSlotChange = () => {\n this.syncSelection();\n };\n\n private options(): HTMLElement[] {\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-option'));\n }\n\n private visible(): HTMLElement[] {\n return this.options().filter((option) => !option.hasAttribute('hidden'));\n }\n\n /** The property, never the attribute: a binding may only have set the former. */\n private optionValue(option: HTMLElement): string {\n return (option as HTMLElement & { value?: string }).value ?? option.getAttribute('value') ?? '';\n }\n\n private selectedLabel(): string {\n const chosen = this.options().find((option) => this.optionValue(option) === this.value);\n return this.value && chosen ? (chosen.textContent?.trim() ?? '') : '';\n }\n\n private get listbox() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"listbox\"]') ?? null;\n }\n\n private get input() {\n return this.el.shadowRoot?.querySelector<HTMLInputElement>('[part=\"input\"]') ?? null;\n }\n\n private get control() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"control\"]') ?? null;\n }\n\n /**\n * Hides the options the query excludes.\n *\n * `hidden` plus `:host([hidden]) { display: none }` on the option, because\n * the attribute alone loses to the option's own `display: block`.\n */\n private applyQuery() {\n const echoed = queryIsEchoedSelection(this.query, this.selectedLabel());\n const options = this.options();\n\n for (const option of options) {\n const matches =\n echoed || matchesCommandQuery({ label: option.textContent?.trim() ?? '' }, this.query);\n if (matches) option.removeAttribute('hidden');\n else option.setAttribute('hidden', '');\n }\n\n const visible = this.visible();\n this.matchCount = visible.length;\n\n // A new query starts at the top of what is left.\n const first = visible.find((option) => !option.hasAttribute('disabled')) ?? null;\n if (!this.activeOption || this.activeOption.hasAttribute('hidden')) this.setActive(first);\n }\n\n private showListbox() {\n const panel = this.listbox;\n if (this.disabled || !panel || panel.matches(':popover-open')) return;\n\n panel.showPopover();\n this.stopObserving?.();\n this.stopObserving = observeAnchoredPosition({\n getAnchor: () => this.control,\n getFloating: () => panel,\n matchAnchorWidth: true,\n flip: true,\n onChange: ({ left, top, width, minWidth }) => {\n placePopover(panel, left, top);\n if (width !== undefined) panel.style.width = `${width}px`;\n if (minWidth !== undefined) panel.style.minWidth = `${minWidth}px`;\n },\n });\n\n this.applyQuery();\n }\n\n private hideListbox() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n const panel = this.listbox;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n /**\n * A browser-driven close — light dismiss or Escape — reverts the field to\n * the chosen label, so a half-typed query never lingers over a different\n * value. Focus goes back to the input rather than the trigger, because here\n * the input *is* the control.\n */\n private onToggle = (event: ToggleEvent) => {\n const nowOpen = event.newState === 'open';\n if (this.open !== nowOpen) this.open = nowOpen;\n if (!nowOpen) {\n this.query = this.selectedLabel();\n this.applyQuery();\n this.input?.focus();\n }\n };\n\n private setActive(option: HTMLElement | null) {\n for (const other of this.options()) {\n if (other !== option) (other as HTMLElement & { active: boolean }).active = false;\n }\n if (option) (option as HTMLElement & { active: boolean }).active = true;\n\n this.activeOption = option;\n this.syncActiveDescendant();\n if (option && typeof option.scrollIntoView === 'function') {\n option.scrollIntoView({ block: 'nearest' });\n }\n }\n\n /**\n * Set as an element, not an IDREF: the input is in this shadow root and the\n * options are slotted light DOM, and a cross-root IDREF is absent from the\n * accessibility tree — measured. Feature-detected, because where element\n * reflection is missing there is no cross-root equivalent.\n */\n private syncActiveDescendant() {\n const input = this.input;\n if (!input || !('ariaActiveDescendantElement' in input)) return;\n (\n input as unknown as { ariaActiveDescendantElement: Element | null }\n ).ariaActiveDescendantElement = this.open ? this.activeOption : null;\n }\n\n private commit(option: HTMLElement) {\n if (option.hasAttribute('disabled')) return;\n\n const next = this.optionValue(option);\n this.open = false;\n\n if (next !== this.value) {\n this.value = next;\n this.pfChange.emit({ value: next });\n }\n\n // Set after the value, so it is the chosen label rather than the query.\n this.query = this.selectedLabel();\n this.applyQuery();\n this.input?.focus();\n }\n\n @Listen('pfOptionSelect')\n handleOptionSelect(event: CustomEvent<{ value: string }>) {\n event.stopPropagation();\n if (this.disabled) return;\n\n const option = this.options().find(\n (candidate) => this.optionValue(candidate) === event.detail.value,\n );\n if (option) this.commit(option);\n }\n\n private move(action: ListNavigationAction) {\n const visible = this.visible();\n const enabledIndexes = getEnabledIndexes(visible, (option) => option.hasAttribute('disabled'));\n const current = this.activeOption ? visible.indexOf(this.activeOption) : -1;\n const next = resolveListMove(action, enabledIndexes, current);\n if (next !== -1) this.setActive(visible[next] ?? null);\n }\n\n private onInput = (event: Event) => {\n this.query = (event.target as HTMLInputElement).value;\n this.applyQuery();\n if (!this.open) this.open = true;\n };\n\n private clear = () => {\n this.query = '';\n if (this.value !== '') {\n this.value = '';\n this.pfChange.emit({ value: '' });\n }\n this.applyQuery();\n this.open = true;\n this.input?.focus();\n };\n\n private onKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n const move = MOVES[event.key];\n if (move) {\n event.preventDefault();\n if (!this.open) this.open = true;\n else this.move(move);\n return;\n }\n\n /*\n * Enter only commits while the listbox is open. Closed, it is left alone\n * so a combobox inside a form still submits it.\n */\n if (event.key === Keys.Enter && this.open && this.activeOption) {\n event.preventDefault();\n this.commit(this.activeOption);\n }\n\n // Escape is the browser's: `popover=\"auto\"` closes, and `onToggle` reverts.\n };\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n const showClear = this.clearable && !this.disabled && (this.query !== '' || this.value !== '');\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"input\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div class={{ control: true, 'control--invalid': Boolean(this.error) }} part=\"control\">\n <input\n id=\"input\"\n aria-label={controlAriaLabel(this.el, this.label)}\n part=\"input\"\n class=\"input\"\n type=\"text\"\n role=\"combobox\"\n autocomplete=\"off\"\n disabled={this.disabled}\n required={this.required}\n placeholder={this.placeholder}\n value={this.query}\n aria-autocomplete=\"list\"\n aria-expanded={this.open ? 'true' : 'false'}\n /* Same shadow root as the listbox, so this IDREF resolves. */\n aria-controls=\"listbox\"\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={describedBy}\n onInput={this.onInput}\n onKeyDown={this.onKeyDown}\n onClick={() => {\n if (!this.disabled) this.open = true;\n }}\n />\n\n {showClear && (\n <button\n class=\"clear\"\n part=\"clear\"\n type=\"button\"\n aria-label={this.clearLabel}\n /* Out of the tab order, so it never interrupts the keyboard flow. */\n tabindex={-1}\n onMouseDown={(event) => event.preventDefault()}\n onClick={this.clear}\n >\n <pf-icon name=\"circle-xmark\"></pf-icon>\n </button>\n )}\n\n <span class=\"chevron\" aria-hidden=\"true\">\n <pf-icon name=\"chevron-down\"></pf-icon>\n </span>\n </div>\n\n {this.description && (\n <p class=\"description\" part=\"description\" id=\"description\">\n {this.description}\n </p>\n )}\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </div>\n\n <div\n id=\"listbox\"\n part=\"listbox\"\n class=\"listbox\"\n popover=\"auto\"\n role=\"listbox\"\n aria-label={this.label ?? this.placeholder}\n onToggle={this.onToggle}\n >\n <slot onSlotchange={this.onSlotChange} />\n {this.matchCount === 0 && (\n <p class=\"empty\" part=\"empty\">\n {this.emptyMessage}\n </p>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,aAAa,GAAG,MAAM,CAAC,i0EAAi0E,CAAC;;AC6B/1E,MAAM,KAAK,GAAyC;AAClD,IAAA,CAAC,IAAI,CAAC,SAAS,GAAG,MAAM;AACxB,IAAA,CAAC,IAAI,CAAC,OAAO,GAAG,UAAU;AAC1B,IAAA,CAAC,IAAI,CAAC,IAAI,GAAG,OAAO;AACpB,IAAA,CAAC,IAAI,CAAC,GAAG,GAAG,MAAM;CACnB;MAqCY,UAAU,GAAA,MAAA;;;;;;;;;;;;;;AAEF,IAAA,SAAS;;AAGH,IAAA,IAAI;;IAGW,KAAK,GAAG,EAAE;;IAGV,IAAI,GAAG,KAAK;AAE5C,IAAA,KAAK;AAEL,IAAA,WAAW;AAEX,IAAA,KAAK;IAEL,WAAW,GAAG,SAAS;;IAGvB,YAAY,GAAG,YAAY;IAEV,QAAQ,GAAG,KAAK;IAEhB,QAAQ,GAAG,KAAK;;IAGjC,SAAS,GAAG,IAAI;;IAGhB,UAAU,GAAG,OAAO;;AAGnB,IAAA,QAAQ;;AAGR,IAAA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AE,EAAC,aAAa,IACvD,IAAI,CAAC,WAAW,CACf,CACL,EACA,IAAI,CAAC,KAAK,KACT,0DAAG,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,EAAA,EACrC,IAAI,CAAC,KAAK,CACT,CACL,CACG,EAEN,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,EAAE,EAAC,SAAS,EACZ,IAAI,EAAC,SAAS,EACd,KAAK,EAAC,SAAS,EACf,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,SAAS,EAAA,YAAA,EACF,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,EAC1C,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAA,EAEvB,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,YAAY,EAAE,IAAI,CAAC,YAAY,EAAA,CAAI,EACxC,IAAI,CAAC,UAAU,KAAK,CAAC,KACpB,CAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAA,EAC1B,IAAI,CAAC,YAAY,CAChB,CACL,CACG,CACD;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,6 +4,7 @@ import { c as composeDescribedBy } from './aria-DfpCerXM.js';
4
4
  import { p as parseISODate } from './date-C9jNMqLs.js';
5
5
  import { K as Keys } from './keys-g4FlTDZx.js';
6
6
  import { a as applyControlValidity } from './form-validity-Cr6IXrUk.js';
7
+ import { c as controlAriaLabel } from './control-label-Cy_kHPeC.js';
7
8
 
8
9
  const pfDatePickerCss = () => `:host{display:block}:host([hidden]){display:none}.field{display:grid;gap:var(--space-1)}.label{color:var(--pf-field-label-text, var(--pf-input-label-text));font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}.required{color:var(--pf-input-invalid-border);margin-inline-start:var(--space-1)}.row{align-items:center;display:flex;gap:var(--space-2)}.trigger{align-items:center;background:var(--pf-input-bg);border:1px solid var(--pf-input-border);border-radius:var(--radius-md);color:var(--pf-input-text);cursor:pointer;display:flex;flex:1;font-family:inherit;font-size:var(--font-size-sm);gap:var(--space-2);justify-content:space-between;min-width:0;padding:var(--space-2) var(--space-3);text-align:start}.trigger:hover:not(:disabled){border-color:var(--pf-input-border-hover)}.trigger:focus-visible{box-shadow:var(--pf-focus-ring);outline:none}.trigger:disabled{cursor:not-allowed;opacity:0.6}.trigger--invalid{border-color:var(--pf-input-invalid-border)}.value{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.value--placeholder{color:var(--pf-input-placeholder-text)}.clear{align-items:center;background:none;border:0;border-radius:var(--radius-sm);color:var(--pf-input-text-muted, var(--pf-input-placeholder-text));cursor:pointer;display:inline-flex;flex-shrink:0;justify-content:center;padding:var(--space-1)}.clear:hover:not(:disabled){color:var(--pf-input-text)}.clear:focus-visible{box-shadow:var(--pf-focus-ring);outline:none}.description{color:var(--pf-input-description-text);font-size:var(--font-size-xs);margin:0}.error{color:var(--pf-input-invalid-border);font-size:var(--font-size-xs);margin:0}.panel{inset:auto;margin:0;background:none;border:0;overflow:visible;padding:0}.panel:popover-open{animation:pf-date-picker-in var(--pf-transition-enter)}@keyframes pf-date-picker-in{from{opacity:0;transform:translateY(-4px)}}@media (prefers-reduced-motion: reduce){.panel:popover-open{animation:none}}`;
9
10
 
@@ -210,10 +211,10 @@ const PfDatePicker = class {
210
211
  render() {
211
212
  const describedBy = composeDescribedBy(this.description && 'description', this.error && 'error');
212
213
  const text = this.formatted();
213
- return (h(Host, { key: '4c7b624f2b4f7b0a1bb1283ceeaf0884eb8617f7' }, h("div", { key: '9b8b376726d7d5073d78da8d2f8388d4e721725f', class: "field", part: "field" }, this.label && (h("label", { key: '5aa01393fb9172abb0e9718f8ca4872e93f540c2', class: "label", part: "label", htmlFor: "trigger" }, this.label, this.required && (h("span", { key: 'c0a00abc02da50500ffa64471222355a0b5c610d', class: "required", "aria-hidden": "true" }, "*")))), h("div", { key: '17bab24f52f47bde8d06f1070f13845cffeeae26', class: "row" }, h("button", { key: 'cde12c16dd7e2824cbd570d6101d9322cd56e802', id: "trigger", part: "trigger", class: { trigger: true, 'trigger--invalid': Boolean(this.error) }, type: "button", disabled: this.disabled, "aria-haspopup": "dialog", "aria-expanded": this.open ? 'true' : 'false', "aria-controls": "panel", "aria-invalid": this.error ? 'true' : null, "aria-required": this.required ? 'true' : null, "aria-describedby": describedBy, onClick: () => {
214
+ return (h(Host, { key: 'e12dc3b1467bfa1b6b47ad6ecde5ff3740f84191' }, h("div", { key: 'da81455cc8034d76ee9a5632bf3d7bba8a59ca36', class: "field", part: "field" }, this.label && (h("label", { key: '7d5e93bbb12ebaec62e541e1e7ff7051ffd1d9ba', class: "label", part: "label", htmlFor: "trigger" }, this.label, this.required && (h("span", { key: '96da5bb4885737801b0934459809761016eff84b', class: "required", "aria-hidden": "true" }, "*")))), h("div", { key: '7d4bb358df9ec3477847a7456aea8aaede3c6bd1', class: "row" }, h("button", { key: '6f0c8095438a87284f339c58cf2bd37ac6d6e8c3', id: "trigger", "aria-label": controlAriaLabel(this.el, this.label), part: "trigger", class: { trigger: true, 'trigger--invalid': Boolean(this.error) }, type: "button", disabled: this.disabled, "aria-haspopup": "dialog", "aria-expanded": this.open ? 'true' : 'false', "aria-controls": "panel", "aria-invalid": this.error ? 'true' : null, "aria-required": this.required ? 'true' : null, "aria-describedby": describedBy, onClick: () => {
214
215
  if (!this.disabled)
215
216
  this.open = !this.open;
216
- }, onKeyDown: this.onTriggerKeyDown }, h("span", { key: 'a0058117f0f220f7c023ea839320448e2cf11492', class: { value: true, 'value--placeholder': !text } }, text || this.placeholder), h("pf-icon", { key: '2fafd08f3570839fe8b1e9fbd444cb01441cff19', name: "calendar" })), this.allowClear && this.value && (h("button", { key: '3c0ae031b818206486b0dedaa67ec7da4abe47a1', class: "clear", part: "clear", type: "button", "aria-label": "Clear selected date", disabled: this.disabled, onClick: this.clear }, h("pf-icon", { key: 'f2f340dfdccdcb59cd38fa1ca9c449e14bada1bd', name: "circle-xmark" })))), this.description && (h("p", { key: '868d285932ff0a58a0917909ac566f8672b410ee', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: '425d7843886e4afadafbf38b26bae2ee80b3c7d8', class: "error", part: "error", id: "error" }, this.error))), h("div", { key: '1fa2e68673f31aeb52be6446f614a39494016d90', id: "panel", part: "panel", class: "panel", popover: "auto", role: "dialog", "aria-label": "Choose a date", onToggle: this.onToggle }, h("pf-calendar", { key: '7a9e9553c4a2975ae7ec8e6c34cc04ac7626ec76', ref: this.bindCalendar, part: "calendar", value: this.value || undefined, min: this.min, max: this.max, startYear: this.startYear, endYear: this.endYear, showOutsideDays: this.showOutsideDays, isDateDisabled: this.isDateDisabled }))));
217
+ }, onKeyDown: this.onTriggerKeyDown }, h("span", { key: '7d163538c024cb22bf62556ac45fe2c6412df31b', class: { value: true, 'value--placeholder': !text } }, text || this.placeholder), h("pf-icon", { key: '0453fc920b7ae38e155a09e355b7a3d574604d14', name: "calendar" })), this.allowClear && this.value && (h("button", { key: '2e933393553ad120ee949673477b7106e94915cb', class: "clear", part: "clear", type: "button", "aria-label": "Clear selected date", disabled: this.disabled, onClick: this.clear }, h("pf-icon", { key: 'dc784a97f467297a6cb0cb691c52006fa1e32c24', name: "circle-xmark" })))), this.description && (h("p", { key: '087d6e84fc1a653b8e5b92a2bf4c8148f4d16f39', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: '292095f16e9328828a7f821b42d47827ce0d5335', class: "error", part: "error", id: "error" }, this.error))), h("div", { key: 'a3f5435249a41d602f160e195a8a551d7f40e23a', id: "panel", part: "panel", class: "panel", popover: "auto", role: "dialog", "aria-label": "Choose a date", onToggle: this.onToggle }, h("pf-calendar", { key: '8db356ae8180b9eaae81df8c560a0f8db68664f8', ref: this.bindCalendar, part: "calendar", value: this.value || undefined, min: this.min, max: this.max, startYear: this.startYear, endYear: this.endYear, showOutsideDays: this.showOutsideDays, isDateDisabled: this.isDateDisabled }))));
217
218
  }
218
219
  static get formAssociated() { return true; }
219
220
  static get watchers() { return {
@@ -1 +1 @@
1
- {"version":3,"file":"pf-date-picker.entry.js","sources":["src/components/pf-date-picker/pf-date-picker.css?tag=pf-date-picker&encapsulation=shadow","src/components/pf-date-picker/pf-date-picker.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-field-label-text, var(--pf-input-label-text));\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-input-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.row {\n align-items: center;\n display: flex;\n gap: var(--space-2);\n}\n\n.trigger {\n align-items: center;\n background: var(--pf-input-bg);\n border: 1px solid var(--pf-input-border);\n border-radius: var(--radius-md);\n color: var(--pf-input-text);\n cursor: pointer;\n display: flex;\n flex: 1;\n font-family: inherit;\n font-size: var(--font-size-sm);\n gap: var(--space-2);\n justify-content: space-between;\n min-width: 0;\n padding: var(--space-2) var(--space-3);\n text-align: start;\n}\n\n.trigger:hover:not(:disabled) {\n border-color: var(--pf-input-border-hover);\n}\n\n.trigger:focus-visible {\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.trigger--invalid {\n border-color: var(--pf-input-invalid-border);\n}\n\n.value {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.value--placeholder {\n color: var(--pf-input-placeholder-text);\n}\n\n.clear {\n align-items: center;\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-input-text-muted, var(--pf-input-placeholder-text));\n cursor: pointer;\n display: inline-flex;\n flex-shrink: 0;\n justify-content: center;\n padding: var(--space-1);\n}\n\n.clear:hover:not(:disabled) {\n color: var(--pf-input-text);\n}\n\n.clear:focus-visible {\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.description {\n color: var(--pf-input-description-text);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-input-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/*\n * See src/place-popover.ts: `inset: auto; margin: 0` are what make the\n * coordinates mean what they say, since the UA stylesheet centres a popover.\n * Declared here and set inline, because no test project applies this file.\n */\n.panel {\n inset: auto;\n margin: 0;\n background: none;\n border: 0;\n overflow: visible;\n padding: 0;\n}\n\n.panel:popover-open {\n animation: pf-date-picker-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-date-picker-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .panel:popover-open {\n animation: none;\n }\n}\n","import {\n composeDescribedBy,\n Keys,\n observeAnchoredPosition,\n parseISODate,\n} from '@pitchfork-ui/core';\n\nimport { applyControlValidity } from '../../form-validity';\nimport { placePopover } from '../../place-popover';\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\n\n/**\n * A form-associated date field: a trigger that opens `pf-calendar` in a\n * popover.\n *\n * Form-associated, which the React `DatePicker` is not — it is a button and a\n * portal, so its value reaches a surrounding `<form>` only if the consumer\n * wires it there themselves. Here the value is submitted as `YYYY-MM-DD`,\n * constraint validation works, and Angular's generated accessor has something\n * to bind to.\n *\n * The panel is a `popover`, so light dismiss and Escape are the browser's.\n * Unlike `pf-dropdown`, the trigger and the panel are both in *this* shadow\n * root, so `aria-controls` resolves and is worth setting — a same-root IDREF\n * is the one case that works, measured.\n *\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part trigger - the button that opens the calendar.\n * @part clear - the clear button.\n * @part panel - the floating panel holding the calendar.\n * @part calendar - the calendar itself.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-date-picker',\n styleUrl: 'pf-date-picker.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfDatePicker {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * Submitted under this name. Reflected, because the submission name comes\n * from the content attribute and the generated bindings set properties.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** The selected date as `YYYY-MM-DD`, or empty. */\n @Prop({ mutable: true }) value = '';\n\n /** Whether the calendar is showing. Reflected for the stylesheet. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** Visible label. In the same root as the trigger, so `for` works. */\n @Prop() label?: string;\n\n /** Hint text below the control. */\n @Prop() description?: string;\n\n /** Error message. Its presence is what marks the control invalid. */\n @Prop() error?: string;\n\n @Prop() placeholder = 'Select a date';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Offer a button that empties the field. */\n @Prop() allowClear = false;\n\n /** Earliest selectable date, as `YYYY-MM-DD`. */\n @Prop() min?: string;\n\n /** Latest selectable date, as `YYYY-MM-DD`. */\n @Prop() max?: string;\n\n @Prop() startYear?: number;\n\n @Prop() endYear?: number;\n\n @Prop() showOutsideDays = true;\n\n /** A predicate for days that cannot be chosen; see `pf-calendar`. */\n @Prop() isDateDisabled?: (date: Date) => boolean;\n\n /** Fires when a date is chosen or cleared. */\n @Event() pfChange!: EventEmitter<{ value: string }>;\n\n /** Fires whenever the calendar opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** What a form reset restores; `value` has been overwritten by then. */\n private initialValue = '';\n\n private stopObserving?: () => void;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n this.internals.setFormValue(this.value || null);\n applyControlValidity(this.internals, Boolean(this.value), this.required, this.error);\n }\n\n /** The one place an open or close is announced, whatever caused it. */\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showPanel();\n else this.hidePanel();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n /** Opens the calendar. */\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n /** Closes the calendar. */\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n /** A reset restores the value the field started with, not an empty one. */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n private get panel() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"panel\"]') ?? null;\n }\n\n private get trigger() {\n return this.el.shadowRoot?.querySelector<HTMLButtonElement>('[part=\"trigger\"]') ?? null;\n }\n\n private get calendar() {\n return (\n this.el.shadowRoot?.querySelector<HTMLElement & { focusSelectedDay(): Promise<void> }>(\n 'pf-calendar',\n ) ?? null\n );\n }\n\n private showPanel() {\n const panel = this.panel;\n if (this.disabled || !panel || panel.matches(':popover-open')) return;\n\n panel.showPopover();\n this.stopObserving?.();\n this.stopObserving = observeAnchoredPosition({\n getAnchor: () => this.trigger,\n getFloating: () => panel,\n align: 'start',\n matchAnchorWidth: false,\n flip: true,\n onChange: ({ left, top }) => placePopover(panel, left, top),\n });\n\n // Focus the grid, not the panel: the calendar owns its own tab stop, and\n // it asks for focus through a method rather than having it reached for.\n void this.calendar?.focusSelectedDay();\n }\n\n private hidePanel() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n const panel = this.panel;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n /**\n * Mirrors a browser-driven close — a light dismiss or Escape — back into\n * `open`, which is what then announces it.\n */\n private onToggle = (event: ToggleEvent) => {\n const nowOpen = event.newState === 'open';\n if (this.open !== nowOpen) this.open = nowOpen;\n if (!nowOpen) this.trigger?.focus();\n };\n\n /**\n * Listens on the calendar element itself, not on the host.\n *\n * Both were tried. A `@Listen('pfChange')` on the host sees the calendar's\n * event *and* this element's own — a Stencil event is composed, so by then\n * both have been retargeted to the host and `event.target` cannot tell them\n * apart. Worse, `stopPropagation()` there does not help: the consumer's\n * listener is on that same node, and stopping propagation never stops\n * same-node listeners, so every pick reported twice. Caught by a test that\n * counted them.\n *\n * On the calendar, the event is stopped before it reaches the host at all,\n * which does not depend on listener registration order the way\n * `stopImmediatePropagation` would.\n */\n private bindCalendar = (element?: HTMLElement) => {\n if (!element || element === this.boundCalendar) return;\n this.boundCalendar = element;\n element.addEventListener('pfChange', this.onCalendarChange as EventListener);\n };\n\n private boundCalendar?: HTMLElement;\n\n private onCalendarChange = (event: CustomEvent<{ value: string }>) => {\n event.stopPropagation();\n\n this.value = event.detail.value;\n this.pfChange.emit({ value: this.value });\n this.open = false;\n this.trigger?.focus();\n };\n\n private clear = (event: MouseEvent) => {\n event.stopPropagation();\n if (!this.value) return;\n this.value = '';\n this.pfChange.emit({ value: '' });\n };\n\n /**\n * Down opens the calendar from a closed trigger, as a popup button should.\n * Escape is the browser's while the panel is open — `popover=\"auto\"` handles\n * it — so there is nothing to do here for it.\n */\n private onTriggerKeyDown = (event: KeyboardEvent) => {\n if (this.open || this.disabled) return;\n if (event.key === Keys.ArrowDown || event.key === Keys.Enter || event.key === Keys.Space) {\n if (event.key === Keys.ArrowDown) {\n event.preventDefault();\n this.open = true;\n }\n }\n };\n\n /** `MMM D, YYYY`, matching the React component's trigger text. */\n private formatted(): string {\n const date = parseISODate(this.value);\n if (!date) return '';\n return new Intl.DateTimeFormat('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n }).format(date);\n }\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n const text = this.formatted();\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"trigger\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div class=\"row\">\n <button\n id=\"trigger\"\n part=\"trigger\"\n class={{ trigger: true, 'trigger--invalid': Boolean(this.error) }}\n type=\"button\"\n disabled={this.disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={this.open ? 'true' : 'false'}\n /* Same shadow root as the panel, so this IDREF resolves. */\n aria-controls=\"panel\"\n aria-invalid={this.error ? 'true' : null}\n aria-required={this.required ? 'true' : null}\n aria-describedby={describedBy}\n onClick={() => {\n if (!this.disabled) this.open = !this.open;\n }}\n onKeyDown={this.onTriggerKeyDown}\n >\n <span class={{ value: true, 'value--placeholder': !text }}>\n {text || this.placeholder}\n </span>\n <pf-icon name=\"calendar\"></pf-icon>\n </button>\n\n {this.allowClear && this.value && (\n <button\n class=\"clear\"\n part=\"clear\"\n type=\"button\"\n aria-label=\"Clear selected date\"\n disabled={this.disabled}\n onClick={this.clear}\n >\n <pf-icon name=\"circle-xmark\"></pf-icon>\n </button>\n )}\n </div>\n\n {this.description && (\n <p class=\"description\" part=\"description\" id=\"description\">\n {this.description}\n </p>\n )}\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </div>\n\n <div\n id=\"panel\"\n part=\"panel\"\n class=\"panel\"\n popover=\"auto\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n onToggle={this.onToggle}\n >\n <pf-calendar\n ref={this.bindCalendar}\n part=\"calendar\"\n value={this.value || undefined}\n min={this.min}\n max={this.max}\n startYear={this.startYear}\n endYear={this.endYear}\n showOutsideDays={this.showOutsideDays}\n isDateDisabled={this.isDateDisabled}\n ></pf-calendar>\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,MAAM,CAAC,+4DAA+4D,CAAC;;MCoDl6D,YAAY,GAAA,MAAA;;;;;;;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AI,EAAC,QAAQ,EAAA,YAAA,EACF,eAAe,EAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAA,EAEvB,CAAA,CAAA,aAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,EAC9B,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAA,CACtB,CACX,CACD;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"pf-date-picker.entry.js","sources":["src/components/pf-date-picker/pf-date-picker.css?tag=pf-date-picker&encapsulation=shadow","src/components/pf-date-picker/pf-date-picker.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-field-label-text, var(--pf-input-label-text));\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-input-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.row {\n align-items: center;\n display: flex;\n gap: var(--space-2);\n}\n\n.trigger {\n align-items: center;\n background: var(--pf-input-bg);\n border: 1px solid var(--pf-input-border);\n border-radius: var(--radius-md);\n color: var(--pf-input-text);\n cursor: pointer;\n display: flex;\n flex: 1;\n font-family: inherit;\n font-size: var(--font-size-sm);\n gap: var(--space-2);\n justify-content: space-between;\n min-width: 0;\n padding: var(--space-2) var(--space-3);\n text-align: start;\n}\n\n.trigger:hover:not(:disabled) {\n border-color: var(--pf-input-border-hover);\n}\n\n.trigger:focus-visible {\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.trigger--invalid {\n border-color: var(--pf-input-invalid-border);\n}\n\n.value {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.value--placeholder {\n color: var(--pf-input-placeholder-text);\n}\n\n.clear {\n align-items: center;\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-input-text-muted, var(--pf-input-placeholder-text));\n cursor: pointer;\n display: inline-flex;\n flex-shrink: 0;\n justify-content: center;\n padding: var(--space-1);\n}\n\n.clear:hover:not(:disabled) {\n color: var(--pf-input-text);\n}\n\n.clear:focus-visible {\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.description {\n color: var(--pf-input-description-text);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-input-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/*\n * See src/place-popover.ts: `inset: auto; margin: 0` are what make the\n * coordinates mean what they say, since the UA stylesheet centres a popover.\n * Declared here and set inline, because no test project applies this file.\n */\n.panel {\n inset: auto;\n margin: 0;\n background: none;\n border: 0;\n overflow: visible;\n padding: 0;\n}\n\n.panel:popover-open {\n animation: pf-date-picker-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-date-picker-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .panel:popover-open {\n animation: none;\n }\n}\n","import {\n composeDescribedBy,\n Keys,\n observeAnchoredPosition,\n parseISODate,\n} from '@pitchfork-ui/core';\n\nimport { applyControlValidity } from '../../form-validity';\nimport { controlAriaLabel } from '../../control-label';\nimport { placePopover } from '../../place-popover';\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\n\n/**\n * A form-associated date field: a trigger that opens `pf-calendar` in a\n * popover.\n *\n * Form-associated, which the React `DatePicker` is not — it is a button and a\n * portal, so its value reaches a surrounding `<form>` only if the consumer\n * wires it there themselves. Here the value is submitted as `YYYY-MM-DD`,\n * constraint validation works, and Angular's generated accessor has something\n * to bind to.\n *\n * The panel is a `popover`, so light dismiss and Escape are the browser's.\n * Unlike `pf-dropdown`, the trigger and the panel are both in *this* shadow\n * root, so `aria-controls` resolves and is worth setting — a same-root IDREF\n * is the one case that works, measured.\n *\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part trigger - the button that opens the calendar.\n * @part clear - the clear button.\n * @part panel - the floating panel holding the calendar.\n * @part calendar - the calendar itself.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-date-picker',\n styleUrl: 'pf-date-picker.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfDatePicker {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * Submitted under this name. Reflected, because the submission name comes\n * from the content attribute and the generated bindings set properties.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** The selected date as `YYYY-MM-DD`, or empty. */\n @Prop({ mutable: true }) value = '';\n\n /** Whether the calendar is showing. Reflected for the stylesheet. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** Visible label. In the same root as the trigger, so `for` works. */\n @Prop() label?: string;\n\n /** Hint text below the control. */\n @Prop() description?: string;\n\n /** Error message. Its presence is what marks the control invalid. */\n @Prop() error?: string;\n\n @Prop() placeholder = 'Select a date';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Offer a button that empties the field. */\n @Prop() allowClear = false;\n\n /** Earliest selectable date, as `YYYY-MM-DD`. */\n @Prop() min?: string;\n\n /** Latest selectable date, as `YYYY-MM-DD`. */\n @Prop() max?: string;\n\n @Prop() startYear?: number;\n\n @Prop() endYear?: number;\n\n @Prop() showOutsideDays = true;\n\n /** A predicate for days that cannot be chosen; see `pf-calendar`. */\n @Prop() isDateDisabled?: (date: Date) => boolean;\n\n /** Fires when a date is chosen or cleared. */\n @Event() pfChange!: EventEmitter<{ value: string }>;\n\n /** Fires whenever the calendar opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** What a form reset restores; `value` has been overwritten by then. */\n private initialValue = '';\n\n private stopObserving?: () => void;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n this.internals.setFormValue(this.value || null);\n applyControlValidity(this.internals, Boolean(this.value), this.required, this.error);\n }\n\n /** The one place an open or close is announced, whatever caused it. */\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showPanel();\n else this.hidePanel();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n /** Opens the calendar. */\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n /** Closes the calendar. */\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n /** A reset restores the value the field started with, not an empty one. */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n private get panel() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"panel\"]') ?? null;\n }\n\n private get trigger() {\n return this.el.shadowRoot?.querySelector<HTMLButtonElement>('[part=\"trigger\"]') ?? null;\n }\n\n private get calendar() {\n return (\n this.el.shadowRoot?.querySelector<HTMLElement & { focusSelectedDay(): Promise<void> }>(\n 'pf-calendar',\n ) ?? null\n );\n }\n\n private showPanel() {\n const panel = this.panel;\n if (this.disabled || !panel || panel.matches(':popover-open')) return;\n\n panel.showPopover();\n this.stopObserving?.();\n this.stopObserving = observeAnchoredPosition({\n getAnchor: () => this.trigger,\n getFloating: () => panel,\n align: 'start',\n matchAnchorWidth: false,\n flip: true,\n onChange: ({ left, top }) => placePopover(panel, left, top),\n });\n\n // Focus the grid, not the panel: the calendar owns its own tab stop, and\n // it asks for focus through a method rather than having it reached for.\n void this.calendar?.focusSelectedDay();\n }\n\n private hidePanel() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n const panel = this.panel;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n /**\n * Mirrors a browser-driven close — a light dismiss or Escape — back into\n * `open`, which is what then announces it.\n */\n private onToggle = (event: ToggleEvent) => {\n const nowOpen = event.newState === 'open';\n if (this.open !== nowOpen) this.open = nowOpen;\n if (!nowOpen) this.trigger?.focus();\n };\n\n /**\n * Listens on the calendar element itself, not on the host.\n *\n * Both were tried. A `@Listen('pfChange')` on the host sees the calendar's\n * event *and* this element's own — a Stencil event is composed, so by then\n * both have been retargeted to the host and `event.target` cannot tell them\n * apart. Worse, `stopPropagation()` there does not help: the consumer's\n * listener is on that same node, and stopping propagation never stops\n * same-node listeners, so every pick reported twice. Caught by a test that\n * counted them.\n *\n * On the calendar, the event is stopped before it reaches the host at all,\n * which does not depend on listener registration order the way\n * `stopImmediatePropagation` would.\n */\n private bindCalendar = (element?: HTMLElement) => {\n if (!element || element === this.boundCalendar) return;\n this.boundCalendar = element;\n element.addEventListener('pfChange', this.onCalendarChange as EventListener);\n };\n\n private boundCalendar?: HTMLElement;\n\n private onCalendarChange = (event: CustomEvent<{ value: string }>) => {\n event.stopPropagation();\n\n this.value = event.detail.value;\n this.pfChange.emit({ value: this.value });\n this.open = false;\n this.trigger?.focus();\n };\n\n private clear = (event: MouseEvent) => {\n event.stopPropagation();\n if (!this.value) return;\n this.value = '';\n this.pfChange.emit({ value: '' });\n };\n\n /**\n * Down opens the calendar from a closed trigger, as a popup button should.\n * Escape is the browser's while the panel is open — `popover=\"auto\"` handles\n * it — so there is nothing to do here for it.\n */\n private onTriggerKeyDown = (event: KeyboardEvent) => {\n if (this.open || this.disabled) return;\n if (event.key === Keys.ArrowDown || event.key === Keys.Enter || event.key === Keys.Space) {\n if (event.key === Keys.ArrowDown) {\n event.preventDefault();\n this.open = true;\n }\n }\n };\n\n /** `MMM D, YYYY`, matching the React component's trigger text. */\n private formatted(): string {\n const date = parseISODate(this.value);\n if (!date) return '';\n return new Intl.DateTimeFormat('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n }).format(date);\n }\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n const text = this.formatted();\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"trigger\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div class=\"row\">\n <button\n id=\"trigger\"\n aria-label={controlAriaLabel(this.el, this.label)}\n part=\"trigger\"\n class={{ trigger: true, 'trigger--invalid': Boolean(this.error) }}\n type=\"button\"\n disabled={this.disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={this.open ? 'true' : 'false'}\n /* Same shadow root as the panel, so this IDREF resolves. */\n aria-controls=\"panel\"\n aria-invalid={this.error ? 'true' : null}\n aria-required={this.required ? 'true' : null}\n aria-describedby={describedBy}\n onClick={() => {\n if (!this.disabled) this.open = !this.open;\n }}\n onKeyDown={this.onTriggerKeyDown}\n >\n <span class={{ value: true, 'value--placeholder': !text }}>\n {text || this.placeholder}\n </span>\n <pf-icon name=\"calendar\"></pf-icon>\n </button>\n\n {this.allowClear && this.value && (\n <button\n class=\"clear\"\n part=\"clear\"\n type=\"button\"\n aria-label=\"Clear selected date\"\n disabled={this.disabled}\n onClick={this.clear}\n >\n <pf-icon name=\"circle-xmark\"></pf-icon>\n </button>\n )}\n </div>\n\n {this.description && (\n <p class=\"description\" part=\"description\" id=\"description\">\n {this.description}\n </p>\n )}\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </div>\n\n <div\n id=\"panel\"\n part=\"panel\"\n class=\"panel\"\n popover=\"auto\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n onToggle={this.onToggle}\n >\n <pf-calendar\n ref={this.bindCalendar}\n part=\"calendar\"\n value={this.value || undefined}\n min={this.min}\n max={this.max}\n startYear={this.startYear}\n endYear={this.endYear}\n showOutsideDays={this.showOutsideDays}\n isDateDisabled={this.isDateDisabled}\n ></pf-calendar>\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,eAAe,GAAG,MAAM,CAAC,+4DAA+4D,CAAC;;MCqDl6D,YAAY,GAAA,MAAA;;;;;;;;;;;;;;AAEJ,IAAA,SAAS;AAE5B;;;AAGG;AACsB,IAAA,IAAI;;IAGJ,KAAK,GAAG,EAAE;;IAGK,IAAI,GAAG,KAAK;;AAG5C,IAAA,KAAK;;AAGL,IAAA,WAAW;;AAGX,IAAA,KAAK;IAEL,WAAW,GAAG,eAAe;IAEZ,QAAQ,GAAG,KAAK;IAEhB,QAAQ,GAAG,KAAK;;IAGjC,UAAU,GAAG,KAAK;;AAGlB,IAAA,GAAG;;AAGH,IAAA,GAAG;AAEH,IAAA,SAAS;AAET,IAAA,OAAO;IAEP,eAAe,GAAG,IAAI;;AAGtB,IAAA,cAAc;;AAGb,IAAA,QAAQ;;AAGR,IAAA,YAAY;;IAGb,YAAY,GAAG,EAAE;AAEjB,IAAA,aAAa;IAErB,iBAAiB,GAAA;QACf,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE;QACpC,IAAI,CAAC,aAAa,EAAE;;IAGtB,oBAAoB,GAAA;AAClB,QAAA,IAAI,CAAC,aAAa,IAAI;;IAMxB,aAAa,GAAA;QACX,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QAC/C,oBAA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AEnB,CAAA,CAAA,SAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAS,IAAI,EAAC,cAAc,EAAA,CAAW,CAChC,CACV,CACG,EAEL,IAAI,CAAC,WAAW,KACf,0DAAG,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,aAAa,EAAC,EAAE,EAAC,aAAa,IACvD,IAAI,CAAC,WAAW,CACf,CACL,EACA,IAAI,CAAC,KAAK,KACT,0DAAG,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,EAAA,EACrC,IAAI,CAAC,KAAK,CACT,CACL,CACG,EAEN,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,EAAE,EAAC,OAAO,EACV,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,OAAO,EACb,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,QAAQ,EAAA,YAAA,EACF,eAAe,EAC1B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAA,EAEvB,CAAA,CAAA,aAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,GAAG,EAAE,IAAI,CAAC,YAAY,EACtB,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,EAC9B,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,cAAc,EAAE,IAAI,CAAC,cAAc,EAAA,CACtB,CACX,CACD;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,6 +4,7 @@ import { c as composeDescribedBy } from './aria-DfpCerXM.js';
4
4
  import { t as toMidday, d as isSameDay, s as startOfMonth, f as formatISODate, c as clampMonthToYearRange, i as isOutsideDateRange, p as parseISODate, m as moveCalendarDate, a as addMonths, e as isSameMonth, b as buildCalendarDays, W as WEEKDAY_LABELS, C as CALENDAR_CELL_COUNT } from './date-C9jNMqLs.js';
5
5
  import { K as Keys } from './keys-g4FlTDZx.js';
6
6
  import { a as applyControlValidity } from './form-validity-Cr6IXrUk.js';
7
+ import { c as controlAriaLabel } from './control-label-Cy_kHPeC.js';
7
8
 
8
9
  //#region src/date-range.ts
9
10
  /**
@@ -434,16 +435,16 @@ const PfDateRangePicker = class {
434
435
  const describedBy = composeDescribedBy(this.description && 'description', this.error && 'error');
435
436
  const text = this.formatted();
436
437
  const right = addMonths(this.leftMonth, 1);
437
- return (h(Host, { key: 'c769f8e46ecb2b1cc36fb6569f5c52c602d5bace' }, h("div", { key: '9800b4ea3fbd90e9ce1aa0e14b1c18c960da6c80', class: "field", part: "field" }, this.label && (h("label", { key: 'da11753ffc0352c61aa63c57fa03f84dbff7b8be', class: "label", part: "label", htmlFor: "trigger" }, this.label, this.required && (h("span", { key: '156cce16b0dcd46f94cf13f87bf2bdeebb1f8bd3', class: "required", "aria-hidden": "true" }, "*")))), h("div", { key: '9ff549ec5c220e04049055b813eb979fdf87a835', class: "row-controls" }, h("button", { key: 'b4245ab2a3fe86abfc33b451eb4cc4994ef78480', id: "trigger", part: "trigger", class: { trigger: true, 'trigger--invalid': Boolean(this.error) }, type: "button", disabled: this.disabled, "aria-haspopup": "dialog", "aria-expanded": this.open ? 'true' : 'false', "aria-controls": "panel", "aria-invalid": this.error ? 'true' : null, "aria-required": this.required ? 'true' : null, "aria-describedby": describedBy, onClick: () => {
438
+ return (h(Host, { key: 'e581ed7c3a2449e96b594a4d650d7d16225c502b' }, h("div", { key: '42af6feb4a669c989f734bf179e0f60c24a47401', class: "field", part: "field" }, this.label && (h("label", { key: '5a6b9ea4e2bcdb7c07801c474a901ae4019d397f', class: "label", part: "label", htmlFor: "trigger" }, this.label, this.required && (h("span", { key: '6e90bc09ed442464ea424d47e60a64951df45eea', class: "required", "aria-hidden": "true" }, "*")))), h("div", { key: 'b0b66d4bf30cc7228e7e2153e9be05d71401ec20', class: "row-controls" }, h("button", { key: '46cfbfeb5e679bb00dd48e7b718350db4530e82e', id: "trigger", "aria-label": controlAriaLabel(this.el, this.label), part: "trigger", class: { trigger: true, 'trigger--invalid': Boolean(this.error) }, type: "button", disabled: this.disabled, "aria-haspopup": "dialog", "aria-expanded": this.open ? 'true' : 'false', "aria-controls": "panel", "aria-invalid": this.error ? 'true' : null, "aria-required": this.required ? 'true' : null, "aria-describedby": describedBy, onClick: () => {
438
439
  if (!this.disabled)
439
440
  this.open = !this.open;
440
- } }, h("span", { key: '02e3efca7af827add1fa80519cdf995c7cb54dc3', class: { value: true, 'value--placeholder': !text } }, text || this.placeholder), h("pf-icon", { key: 'e2139c1b236edfd82e109caeb778de8c1c43468d', name: "calendar" })), this.allowClear && (this.value || this.pendingStart) && (h("button", { key: 'f2572d3f798e9ba895b1165d024522014cfbb5ab', class: "clear", part: "clear", type: "button", "aria-label": "Clear selected dates", disabled: this.disabled, onClick: this.clear }, h("pf-icon", { key: 'd22ecfecc4114815c557b60d4908a9bbea6e8b1d', name: "circle-xmark" })))), this.description && (h("p", { key: 'f5399489f7666e2b7b7d4bbc1885e74a52e32cd4', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: '1a46f2d10e6edcc47979ecbb0724958a9790b2db', class: "error", part: "error", id: "error" }, this.error))), h("div", { key: '2aaa30dcd06ab95ebe7973d2783224cf236b57ef', id: "panel", part: "panel", class: "panel", popover: "auto", role: "dialog", "aria-label": "Choose a date range", onToggle: this.onToggle, onKeyDown: this.onKeyDown, onMouseLeave: () => {
441
+ } }, h("span", { key: '4bcf49fdfed1cef4f458c5019315ea833d8575e0', class: { value: true, 'value--placeholder': !text } }, text || this.placeholder), h("pf-icon", { key: 'da03fb4ccb5aef720f042adae79d701148ade479', name: "calendar" })), this.allowClear && (this.value || this.pendingStart) && (h("button", { key: 'f6b36144e765a28a15e7addf3d10d4aff1d25a00', class: "clear", part: "clear", type: "button", "aria-label": "Clear selected dates", disabled: this.disabled, onClick: this.clear }, h("pf-icon", { key: 'f4fb9769008137437b26c14c54d4d73909729da9', name: "circle-xmark" })))), this.description && (h("p", { key: '084a2a397d5277d237310cd9c202dce0028fcf78', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: '9fa6a9400ded59e6c0263012ce4d4be1d04c9352', class: "error", part: "error", id: "error" }, this.error))), h("div", { key: 'f8b15d11302ae13a7d9d21fea5ce5db3d0c407cc', id: "panel", part: "panel", class: "panel", popover: "auto", role: "dialog", "aria-label": "Choose a date range", onToggle: this.onToggle, onKeyDown: this.onKeyDown, onMouseLeave: () => {
441
442
  this.hovered = null;
442
- } }, h("div", { key: 'd5c052b2ce87bb5a19492a3d2afe65a8be50aac6', class: "nav" }, h("button", { key: '3f04ddb2cfea5ef4c05380a81c1f4cd2b43be396', type: "button", class: "step", "aria-label": "Previous month", onClick: () => {
443
+ } }, h("div", { key: '39a29079e9e97d19272ef9d5ec9fa02c2c368f6a', class: "nav" }, h("button", { key: '8e0fb9c8e800e53a88dfa98c928966a919f4dee0', type: "button", class: "step", "aria-label": "Previous month", onClick: () => {
443
444
  this.leftMonth = this.clamp(addMonths(this.leftMonth, -1));
444
- } }, h("pf-icon", { key: 'cb18b7c7e71a687d6220126f503a36170f1afc2f', name: "square-caret-left" })), h("button", { key: '837bf1095910392e6a0249f785e558ecf729e870', type: "button", class: "step", "aria-label": "Next month", onClick: () => {
445
+ } }, h("pf-icon", { key: 'df4f5aa6dfc5b387a9d73c674f25e5f445ad4778', name: "square-caret-left" })), h("button", { key: 'c48a949065acfb0e16fce8b732399f6fa9d8204c', type: "button", class: "step", "aria-label": "Next month", onClick: () => {
445
446
  this.leftMonth = this.clamp(addMonths(this.leftMonth, 1));
446
- } }, h("pf-icon", { key: 'bd56b0173777c7dc13bc9c052e2ccb7fc81cefb1', name: "square-caret-right" }))), h("div", { key: '102f50860c882a493ec9b8f9098d0703f4ecaf40', class: "months" }, this.renderGrid(this.leftMonth), this.renderGrid(right)))));
447
+ } }, h("pf-icon", { key: '10ae6ca6d30cbfdbd538d1a5247a6c83b299fd7a', name: "square-caret-right" }))), h("div", { key: '46610cb99d27eda167a28c281a5c1462fd5ab19c', class: "months" }, this.renderGrid(this.leftMonth), this.renderGrid(right)))));
447
448
  }
448
449
  static get formAssociated() { return true; }
449
450
  static get watchers() { return {
@@ -1 +1 @@
1
- {"version":3,"file":"pf-date-range-picker.entry.js","sources":["../core/dist/date-range.js","src/components/pf-date-range-picker/pf-date-range-picker.css?tag=pf-date-range-picker&encapsulation=shadow","src/components/pf-date-range-picker/pf-date-range-picker.tsx"],"sourcesContent":["import { isSameDay, toMidday } from \"./date.js\";\n//#region src/date-range.ts\n/**\n* Where a click on `date` leaves the selection.\n*\n* Three cases, and the second two are the ones worth naming:\n* - not awaiting an end: start the range here and wait for the other end;\n* - awaiting an end, clicked before the start: the two swap, because a range\n* has no opinion about which end the user picked first;\n* - awaiting an end, clicked the start again: start over rather than make a\n* one-day range, which is what the React component does and is the kinder\n* reading of a double click.\n*/\nfunction nextDateRangeSelection(current, date) {\n\tconst clicked = toMidday(date);\n\tif (!current.awaitingEnd || !current.range.start) return {\n\t\trange: {\n\t\t\tstart: clicked,\n\t\t\tend: null\n\t\t},\n\t\tawaitingEnd: true\n\t};\n\tconst start = current.range.start;\n\tif (isSameDay(start, clicked)) return {\n\t\trange: {\n\t\t\tstart: clicked,\n\t\t\tend: null\n\t\t},\n\t\tawaitingEnd: true\n\t};\n\treturn {\n\t\trange: clicked.getTime() < start.getTime() ? {\n\t\t\tstart: clicked,\n\t\t\tend: start\n\t\t} : {\n\t\t\tstart,\n\t\t\tend: clicked\n\t\t},\n\t\tawaitingEnd: false\n\t};\n}\n/**\n* How a day should read, given the range and whatever is hovered.\n*\n* A hovered day stands in for the missing end while the range is half-made,\n* which is what makes the preview follow the pointer. It stands in only when\n* there is a start and no end — hovering before the first click previews\n* nothing.\n*/\nfunction rangeDayState(date, range, hovered = null) {\n\tconst { start } = range;\n\tconst end = range.end ?? (start && hovered ? hovered : null);\n\tconst isStart = Boolean(start && isSameDay(date, start));\n\tconst isEnd = Boolean(end && isSameDay(date, end));\n\tif (!start || !end) return {\n\t\tisStart,\n\t\tisEnd,\n\t\tisInside: false\n\t};\n\tconst [low, high] = start.getTime() <= end.getTime() ? [start, end] : [end, start];\n\tconst day = date.getTime();\n\treturn {\n\t\tisStart,\n\t\tisEnd,\n\t\tisInside: day > low.getTime() && day < high.getTime()\n\t};\n}\n/** `YYYY-MM-DD/YYYY-MM-DD`, or `''` when the range is not yet complete. */\nfunction formatDateRange(range, format) {\n\tif (!range.start || !range.end) return \"\";\n\treturn `${format(range.start)}/${format(range.end)}`;\n}\n/** Parses `YYYY-MM-DD/YYYY-MM-DD`; anything else is an empty range. */\nfunction parseDateRange(value, parse) {\n\tconst [from, to] = (value ?? \"\").split(\"/\");\n\tconst start = parse(from ?? \"\");\n\tconst end = parse(to ?? \"\");\n\tif (!start || !end) return {\n\t\tstart: null,\n\t\tend: null\n\t};\n\treturn start.getTime() <= end.getTime() ? {\n\t\tstart,\n\t\tend\n\t} : {\n\t\tstart: end,\n\t\tend: start\n\t};\n}\n//#endregion\nexport { formatDateRange, nextDateRangeSelection, parseDateRange, rangeDayState };\n",":host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-daterange-text);\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-daterange-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.row-controls {\n align-items: center;\n display: flex;\n gap: var(--space-2);\n}\n\n.trigger {\n align-items: center;\n background: var(--pf-daterange-bg);\n border: 1px solid var(--pf-daterange-border);\n border-radius: var(--radius-md);\n color: var(--pf-daterange-text);\n cursor: pointer;\n display: flex;\n flex: 1;\n font-family: inherit;\n font-size: var(--font-size-sm);\n gap: var(--space-2);\n justify-content: space-between;\n min-width: 0;\n padding: var(--space-2) var(--space-3);\n text-align: start;\n}\n\n.trigger:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.trigger--invalid {\n border-color: var(--pf-daterange-invalid-border);\n}\n\n.value {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.value--placeholder {\n color: var(--pf-daterange-text-muted);\n}\n\n.clear {\n align-items: center;\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-daterange-text-muted);\n cursor: pointer;\n display: inline-flex;\n flex-shrink: 0;\n justify-content: center;\n padding: var(--space-1);\n}\n\n.clear:hover:not(:disabled) {\n color: var(--pf-daterange-text);\n}\n\n.clear:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n.description {\n color: var(--pf-daterange-text-muted);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-daterange-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/* See src/place-popover.ts: the UA stylesheet centres a popover otherwise. */\n.panel {\n inset: auto;\n margin: 0;\n background: var(--pf-daterange-menu-bg);\n border: 1px solid var(--pf-daterange-menu-border);\n border-radius: var(--radius-md);\n box-shadow: var(--pf-elevation-popover-shadow);\n color: var(--pf-daterange-text);\n padding: var(--space-3);\n}\n\n.panel:popover-open {\n animation: pf-date-range-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-date-range-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .panel:popover-open {\n animation: none;\n }\n}\n\n.nav {\n display: flex;\n justify-content: space-between;\n margin-bottom: var(--space-2);\n}\n\n.step {\n align-items: center;\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-daterange-text-muted);\n cursor: pointer;\n display: inline-flex;\n justify-content: center;\n padding: var(--space-1);\n}\n\n.step:hover {\n background: var(--pf-daterange-bg-subtle);\n color: var(--pf-daterange-text);\n}\n\n.step:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n/* One month on a phone, two side by side from --md up. */\n.months {\n display: grid;\n gap: var(--space-4);\n}\n\n@media (--md) {\n .months {\n grid-template-columns: 1fr 1fr;\n }\n}\n\n.month-label {\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-semibold);\n margin: 0 0 var(--space-2);\n text-align: center;\n}\n\n.grid {\n display: grid;\n gap: 2px;\n grid-template-columns: repeat(7, 1fr);\n}\n\n/*\n * `display: contents`, so each row's seven cells join the grid's own columns.\n * The rows exist for the `role=\"row\"` the grid pattern needs, not for layout.\n */\n.row {\n display: contents;\n}\n\n.weekday {\n color: var(--pf-daterange-text-muted);\n font-size: var(--font-size-xs);\n font-weight: var(--font-weight-semibold);\n padding: var(--space-1) 0;\n text-align: center;\n}\n\n.day,\n.empty {\n aspect-ratio: 1;\n display: flex;\n min-width: var(--space-7);\n}\n\n.day {\n align-items: center;\n background: none;\n border: 1px solid transparent;\n border-radius: var(--radius-sm);\n color: var(--pf-daterange-text);\n cursor: pointer;\n font-family: inherit;\n font-size: var(--font-size-sm);\n justify-content: center;\n}\n\n.day:hover:not([aria-disabled='true']) {\n background: var(--pf-daterange-bg-subtle);\n}\n\n.day:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n.day--today {\n border-color: var(--pf-calendar-today-border);\n}\n\n/*\n * The inside of the range is square and the ends are rounded on their outer\n * side only, so the run reads as one band rather than a row of pills.\n */\n.day--inside {\n background: var(--pf-daterange-range-bg);\n border-radius: 0;\n color: var(--pf-daterange-range-text);\n}\n\n.day--endpoint {\n background: var(--pf-calendar-selected-bg);\n border-color: var(--pf-calendar-selected-bg);\n color: var(--pf-calendar-selected-text);\n}\n\n.day--start:not(.day--end) {\n border-end-end-radius: 0;\n border-start-end-radius: 0;\n}\n\n.day--end:not(.day--start) {\n border-end-start-radius: 0;\n border-start-start-radius: 0;\n}\n\n.day[aria-disabled='true'] {\n cursor: not-allowed;\n opacity: 0.4;\n}\n","import {\n addMonths,\n buildCalendarDays,\n CALENDAR_CELL_COUNT,\n clampMonthToYearRange,\n composeDescribedBy,\n formatDateRange,\n formatISODate,\n isOutsideDateRange,\n isSameDay,\n isSameMonth,\n Keys,\n moveCalendarDate,\n nextDateRangeSelection,\n observeAnchoredPosition,\n parseDateRange,\n parseISODate,\n rangeDayState,\n startOfMonth,\n toMidday,\n WEEKDAY_LABELS,\n type CalendarMove,\n type DateRangeValue,\n} from '@pitchfork-ui/core';\n\nimport { applyControlValidity } from '../../form-validity';\nimport { placePopover } from '../../place-popover';\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\n\nconst MOVES: Record<string, CalendarMove> = {\n [Keys.ArrowRight]: 'day-next',\n [Keys.ArrowLeft]: 'day-previous',\n [Keys.ArrowDown]: 'week-next',\n [Keys.ArrowUp]: 'week-previous',\n [Keys.Home]: 'week-start',\n [Keys.End]: 'week-end',\n PageDown: 'month-next',\n PageUp: 'month-previous',\n};\n\n/**\n * A form-associated date-range field: two month grids in a popover, with a\n * preview that follows the pointer while the range is half-made.\n *\n * **It submits two entries from one control.** `setFormValue` accepts a\n * `FormData`, and every entry in it is submitted — measured, along with the\n * fact that the element's own `name` attribute is then ignored entirely. So a\n * range goes in as `${name}-start` and `${name}-end`, which is what a server\n * handling a form actually wants, rather than one field a handler has to split.\n * The `value` property stays a single round-trippable `start/end` string.\n *\n * The grids are rendered here rather than composed from two `pf-calendar`s:\n * the range preview spans both months, so one element has to own the hover and\n * the selection for both. The day-state and selection rules are core's, shared\n * with the React component.\n *\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part trigger - the button that opens the grids.\n * @part clear - the clear button.\n * @part panel - the floating panel.\n * @part grid - each month grid.\n * @part day - every day cell.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-date-range-picker',\n styleUrl: 'pf-date-range-picker.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfDateRangePicker {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The base name for the two submitted entries, `${name}-start` and\n * `${name}-end`. Reflected for selectors; the submission reads the property,\n * because a `FormData` value carries its own keys.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** The range as `YYYY-MM-DD/YYYY-MM-DD`, or empty. */\n @Prop({ mutable: true }) value = '';\n\n /** Whether the panel is showing. Reflected for the stylesheet. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Prop() label?: string;\n\n @Prop() description?: string;\n\n @Prop() error?: string;\n\n @Prop() placeholder = 'Select dates';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Offer a button that empties the range. */\n @Prop() allowClear = false;\n\n @Prop() min?: string;\n\n @Prop() max?: string;\n\n @Prop() startYear?: number;\n\n @Prop() endYear?: number;\n\n /** A predicate for days that cannot be chosen; see `pf-calendar`. */\n @Prop() isDateDisabled?: (date: Date) => boolean;\n\n /** Fires when the range changes or is cleared, with the `start/end` string. */\n @Event() pfChange!: EventEmitter<{ value: string; start: string; end: string }>;\n\n /** Fires whenever the panel opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** The left-hand month; the right-hand one is always the month after. */\n @State() leftMonth: Date = startOfMonth(new Date());\n\n /** The day the grids' single tab stop sits on. */\n @State() focusedDate: Date = toMidday(new Date());\n\n /** The day under the pointer, which previews the missing end. */\n @State() hovered: Date | null = null;\n\n /** True once a start is chosen and the next click sets the end. */\n @State() awaitingEnd = false;\n\n private initialValue = '';\n\n /**\n * The start held while the range is half-made.\n *\n * Not in `value`, because `value` is the *submitted* range and a half-made\n * one is not a range — a form read mid-selection would see a start with no\n * end. Held here instead, and folded back in for rendering.\n */\n private pendingStart: Date | null = null;\n private stopObserving?: () => void;\n private shouldRestoreFocus = false;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n const { start } = this.range();\n const base = start ?? toMidday(new Date());\n this.focusedDate = base;\n this.leftMonth = this.clamp(startOfMonth(base));\n this.syncFormState();\n }\n\n componentDidRender() {\n if (!this.shouldRestoreFocus) return;\n this.shouldRestoreFocus = false;\n this.el.shadowRoot?.querySelector<HTMLButtonElement>('button[data-day][tabindex=\"0\"]')?.focus();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n }\n\n /**\n * Follows a range set from outside, so the grids show what they are told.\n *\n * Without this the element kept whatever month it loaded with, and a\n * consumer assigning `value` got a correct value over the wrong months —\n * the days it names were not even rendered.\n */\n @Watch('value')\n syncDisplayedMonths() {\n const { start, end } = this.range();\n if (!start || !end) return;\n this.pendingStart = null;\n this.awaitingEnd = false;\n this.focusedDate = start;\n this.leftMonth = this.clamp(startOfMonth(start));\n }\n\n /*\n * `name` is watched here and not on the controls that pass a plain string to\n * `setFormValue`: those take their submission name from the reflected\n * attribute, so the platform picks a change up by itself. This one builds\n * the name *into* a FormData, so without the watch a name assigned after\n * load would never reach the submission.\n */\n @Watch('name')\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n const { start, end } = this.range();\n\n if (!start || !end || !this.name) {\n this.internals.setFormValue(null);\n } else {\n /*\n * A FormData, so one control submits both ends. Measured: every entry in\n * it reaches the submission, and the element's own `name` attribute is\n * ignored in this mode — which is why the keys are built here.\n */\n const data = new FormData();\n data.append(`${this.name}-start`, formatISODate(start));\n data.append(`${this.name}-end`, formatISODate(end));\n this.internals.setFormValue(data);\n }\n\n applyControlValidity(this.internals, Boolean(start && end), this.required, this.error);\n }\n\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showPanel();\n else this.hidePanel();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n this.awaitingEnd = false;\n this.hovered = null;\n }\n\n private range(): DateRangeValue {\n return parseDateRange(this.value, parseISODate);\n }\n\n private get years() {\n const now = new Date().getFullYear();\n const start = this.startYear ?? now - 50;\n const end = this.endYear ?? now + 50;\n return { start: Math.min(start, end), end: Math.max(start, end) };\n }\n\n private clamp(date: Date): Date {\n const { start, end } = this.years;\n return clampMonthToYearRange(date, start, end);\n }\n\n private get panel() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"panel\"]') ?? null;\n }\n\n private get trigger() {\n return this.el.shadowRoot?.querySelector<HTMLButtonElement>('[part=\"trigger\"]') ?? null;\n }\n\n private isDisabled(date: Date): boolean {\n if (isOutsideDateRange(date, parseISODate(this.min), parseISODate(this.max))) return true;\n return this.isDateDisabled?.(date) ?? false;\n }\n\n private showPanel() {\n const panel = this.panel;\n if (this.disabled || !panel || panel.matches(':popover-open')) return;\n\n panel.showPopover();\n this.stopObserving?.();\n this.stopObserving = observeAnchoredPosition({\n getAnchor: () => this.trigger,\n getFloating: () => panel,\n align: 'start',\n matchAnchorWidth: false,\n flip: true,\n onChange: ({ left, top }) => placePopover(panel, left, top),\n });\n\n this.shouldRestoreFocus = true;\n }\n\n private hidePanel() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n this.hovered = null;\n const panel = this.panel;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n private onToggle = (event: ToggleEvent) => {\n const nowOpen = event.newState === 'open';\n if (this.open !== nowOpen) this.open = nowOpen;\n if (!nowOpen) this.trigger?.focus();\n };\n\n /** One click through core's state machine, plus this element's side-effects. */\n private pick(date: Date) {\n if (this.isDisabled(date)) return;\n\n /*\n * `displayRange()`, not `range()`. A half-made range is deliberately kept\n * out of `value`, so reading the state machine's input from `value` hands\n * it a range with no start — and core, correctly, treats that as \"begin a\n * new range\". Every second click restarted instead of closing. Caught by\n * the swap and Enter tests.\n */\n const next = nextDateRangeSelection(\n { range: this.displayRange(), awaitingEnd: this.awaitingEnd },\n date,\n );\n\n this.awaitingEnd = next.awaitingEnd;\n this.focusedDate = toMidday(date);\n\n if (next.awaitingEnd) {\n // Half-made: hold the start without reporting an incomplete range.\n this.value = '';\n this.pendingStart = next.range.start;\n return;\n }\n\n this.pendingStart = null;\n this.hovered = null;\n this.value = formatDateRange(next.range, formatISODate);\n this.pfChange.emit({\n value: this.value,\n start: next.range.start ? formatISODate(next.range.start) : '',\n end: next.range.end ? formatISODate(next.range.end) : '',\n });\n this.open = false;\n }\n\n /** What the grids draw: the committed range, or the half-made one. */\n private displayRange(): DateRangeValue {\n const committed = this.range();\n if (committed.start && committed.end) return committed;\n return { start: this.pendingStart, end: null };\n }\n\n private moveFocus(move: CalendarMove) {\n const next = moveCalendarDate(this.focusedDate, move);\n const { start, end } = this.years;\n if (next.getFullYear() < start || next.getFullYear() > end) return;\n\n this.focusedDate = next;\n this.shouldRestoreFocus = true;\n\n // Keep the focused day on screen: it belongs to one of the two months.\n const right = addMonths(this.leftMonth, 1);\n if (!isSameMonth(next, this.leftMonth) && !isSameMonth(next, right)) {\n this.leftMonth = this.clamp(startOfMonth(next));\n }\n }\n\n private onKeyDown = (event: KeyboardEvent) => {\n const move = MOVES[event.key];\n if (move) {\n event.preventDefault();\n this.moveFocus(move);\n return;\n }\n\n if (event.key === Keys.Enter || event.key === Keys.Space) {\n event.preventDefault();\n this.pick(this.focusedDate);\n this.shouldRestoreFocus = true;\n }\n };\n\n private clear = (event: MouseEvent) => {\n event.stopPropagation();\n if (!this.value && !this.pendingStart) return;\n this.value = '';\n this.pendingStart = null;\n this.awaitingEnd = false;\n this.hovered = null;\n this.pfChange.emit({ value: '', start: '', end: '' });\n };\n\n private formatted(): string {\n const { start, end } = this.range();\n if (!start || !end) return '';\n const format = new Intl.DateTimeFormat('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n });\n return `${format.format(start)} – ${format.format(end)}`;\n }\n\n private renderGrid(month: Date) {\n const days = buildCalendarDays(month);\n const range = this.displayRange();\n const today = toMidday(new Date());\n const label = new Intl.DateTimeFormat('en-US', {\n month: 'long',\n year: 'numeric',\n }).format(month);\n\n return (\n <div class=\"month\">\n <p class=\"month-label\">{label}</p>\n <div class=\"grid\" part=\"grid\" role=\"grid\" aria-label={label}>\n <div class=\"row\" role=\"row\">\n {WEEKDAY_LABELS.map((day) => (\n <span key={day} class=\"weekday\" role=\"columnheader\" aria-label={day}>\n {day}\n </span>\n ))}\n </div>\n\n {Array.from({ length: CALENDAR_CELL_COUNT / 7 }, (_, week) => (\n <div key={week} class=\"row\" role=\"row\">\n {days.slice(week * 7, week * 7 + 7).map(({ date, inCurrentMonth }) => {\n if (!inCurrentMonth) {\n return <span key={formatISODate(date)} class=\"empty\" role=\"gridcell\"></span>;\n }\n\n const state = rangeDayState(date, range, this.hovered);\n const isEndpoint = state.isStart || state.isEnd;\n const disabled = this.isDisabled(date);\n\n return (\n <button\n key={formatISODate(date)}\n type=\"button\"\n role=\"gridcell\"\n data-day={formatISODate(date)}\n part=\"day\"\n class={{\n day: true,\n 'day--today': isSameDay(today, date),\n 'day--endpoint': isEndpoint,\n 'day--start': state.isStart,\n 'day--end': state.isEnd,\n 'day--inside': state.isInside,\n }}\n tabindex={isSameDay(this.focusedDate, date) ? 0 : -1}\n aria-selected={isEndpoint || state.isInside ? 'true' : 'false'}\n aria-current={isSameDay(today, date) ? 'date' : null}\n aria-disabled={disabled ? 'true' : null}\n aria-label={new Intl.DateTimeFormat('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n }).format(date)}\n onClick={() => {\n this.pick(date);\n this.shouldRestoreFocus = true;\n }}\n onMouseEnter={() => {\n if (this.awaitingEnd && !disabled) this.hovered = date;\n }}\n >\n {date.getDate()}\n </button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n const text = this.formatted();\n const right = addMonths(this.leftMonth, 1);\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"trigger\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div class=\"row-controls\">\n <button\n id=\"trigger\"\n part=\"trigger\"\n class={{ trigger: true, 'trigger--invalid': Boolean(this.error) }}\n type=\"button\"\n disabled={this.disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={this.open ? 'true' : 'false'}\n aria-controls=\"panel\"\n aria-invalid={this.error ? 'true' : null}\n aria-required={this.required ? 'true' : null}\n aria-describedby={describedBy}\n onClick={() => {\n if (!this.disabled) this.open = !this.open;\n }}\n >\n <span class={{ value: true, 'value--placeholder': !text }}>\n {text || this.placeholder}\n </span>\n <pf-icon name=\"calendar\"></pf-icon>\n </button>\n\n {this.allowClear && (this.value || this.pendingStart) && (\n <button\n class=\"clear\"\n part=\"clear\"\n type=\"button\"\n aria-label=\"Clear selected dates\"\n disabled={this.disabled}\n onClick={this.clear}\n >\n <pf-icon name=\"circle-xmark\"></pf-icon>\n </button>\n )}\n </div>\n\n {this.description && (\n <p class=\"description\" part=\"description\" id=\"description\">\n {this.description}\n </p>\n )}\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </div>\n\n <div\n id=\"panel\"\n part=\"panel\"\n class=\"panel\"\n popover=\"auto\"\n role=\"dialog\"\n aria-label=\"Choose a date range\"\n onToggle={this.onToggle}\n onKeyDown={this.onKeyDown}\n onMouseLeave={() => {\n this.hovered = null;\n }}\n >\n <div class=\"nav\">\n <button\n type=\"button\"\n class=\"step\"\n aria-label=\"Previous month\"\n onClick={() => {\n this.leftMonth = this.clamp(addMonths(this.leftMonth, -1));\n }}\n >\n <pf-icon name=\"square-caret-left\"></pf-icon>\n </button>\n <button\n type=\"button\"\n class=\"step\"\n aria-label=\"Next month\"\n onClick={() => {\n this.leftMonth = this.clamp(addMonths(this.leftMonth, 1));\n }}\n >\n <pf-icon name=\"square-caret-right\"></pf-icon>\n </button>\n </div>\n\n <div class=\"months\">\n {this.renderGrid(this.leftMonth)}\n {this.renderGrid(right)}\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,sBAAsB,CAAC,OAAO,EAAE,IAAI,EAAE;AAC/C,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC/B,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO;AAC1D,EAAE,KAAK,EAAE;AACT,GAAG,KAAK,EAAE,OAAO;AACjB,GAAG,GAAG,EAAE;AACR,GAAG;AACH,EAAE,WAAW,EAAE;AACf,EAAE;AACF,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK;AAClC,CAAC,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO;AACvC,EAAE,KAAK,EAAE;AACT,GAAG,KAAK,EAAE,OAAO;AACjB,GAAG,GAAG,EAAE;AACR,GAAG;AACH,EAAE,WAAW,EAAE;AACf,EAAE;AACF,CAAC,OAAO;AACR,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG;AAC/C,GAAG,KAAK,EAAE,OAAO;AACjB,GAAG,GAAG,EAAE;AACR,GAAG,GAAG;AACN,GAAG,KAAK;AACR,GAAG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EAED,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,KAAK,EAAA,EACd,CAAA,CAAA,QAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EAAA,YAAA,EACD,gBAAgB,EAC3B,OAAO,EAAE,MAAK;AACZ,gBAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC5D,aAAC,EAAA,EAED,CAAA,CAAA,SAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAS,IAAI,EAAC,mBAAmB,EAAA,CAAW,CACrC,EACT,CAAA,CAAA,QAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,MAAM,EAAA,YAAA,EACD,YAAY,EACvB,OAAO,EAAE,MAAK;AACZ,gBAAA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;aAC1D,EAAA,EAED,CAAA,CAAA,SAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAS,IAAI,EAAC,oBAAoB,EAAA,CAAW,CACtC,CACL,EAEN,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,QAAQ,EAAA,EAChB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAC/B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CACnB,CACF,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"pf-date-range-picker.entry.js","sources":["../core/dist/date-range.js","src/components/pf-date-range-picker/pf-date-range-picker.css?tag=pf-date-range-picker&encapsulation=shadow","src/components/pf-date-range-picker/pf-date-range-picker.tsx"],"sourcesContent":["import { isSameDay, toMidday } from \"./date.js\";\n//#region src/date-range.ts\n/**\n* Where a click on `date` leaves the selection.\n*\n* Three cases, and the second two are the ones worth naming:\n* - not awaiting an end: start the range here and wait for the other end;\n* - awaiting an end, clicked before the start: the two swap, because a range\n* has no opinion about which end the user picked first;\n* - awaiting an end, clicked the start again: start over rather than make a\n* one-day range, which is what the React component does and is the kinder\n* reading of a double click.\n*/\nfunction nextDateRangeSelection(current, date) {\n\tconst clicked = toMidday(date);\n\tif (!current.awaitingEnd || !current.range.start) return {\n\t\trange: {\n\t\t\tstart: clicked,\n\t\t\tend: null\n\t\t},\n\t\tawaitingEnd: true\n\t};\n\tconst start = current.range.start;\n\tif (isSameDay(start, clicked)) return {\n\t\trange: {\n\t\t\tstart: clicked,\n\t\t\tend: null\n\t\t},\n\t\tawaitingEnd: true\n\t};\n\treturn {\n\t\trange: clicked.getTime() < start.getTime() ? {\n\t\t\tstart: clicked,\n\t\t\tend: start\n\t\t} : {\n\t\t\tstart,\n\t\t\tend: clicked\n\t\t},\n\t\tawaitingEnd: false\n\t};\n}\n/**\n* How a day should read, given the range and whatever is hovered.\n*\n* A hovered day stands in for the missing end while the range is half-made,\n* which is what makes the preview follow the pointer. It stands in only when\n* there is a start and no end — hovering before the first click previews\n* nothing.\n*/\nfunction rangeDayState(date, range, hovered = null) {\n\tconst { start } = range;\n\tconst end = range.end ?? (start && hovered ? hovered : null);\n\tconst isStart = Boolean(start && isSameDay(date, start));\n\tconst isEnd = Boolean(end && isSameDay(date, end));\n\tif (!start || !end) return {\n\t\tisStart,\n\t\tisEnd,\n\t\tisInside: false\n\t};\n\tconst [low, high] = start.getTime() <= end.getTime() ? [start, end] : [end, start];\n\tconst day = date.getTime();\n\treturn {\n\t\tisStart,\n\t\tisEnd,\n\t\tisInside: day > low.getTime() && day < high.getTime()\n\t};\n}\n/** `YYYY-MM-DD/YYYY-MM-DD`, or `''` when the range is not yet complete. */\nfunction formatDateRange(range, format) {\n\tif (!range.start || !range.end) return \"\";\n\treturn `${format(range.start)}/${format(range.end)}`;\n}\n/** Parses `YYYY-MM-DD/YYYY-MM-DD`; anything else is an empty range. */\nfunction parseDateRange(value, parse) {\n\tconst [from, to] = (value ?? \"\").split(\"/\");\n\tconst start = parse(from ?? \"\");\n\tconst end = parse(to ?? \"\");\n\tif (!start || !end) return {\n\t\tstart: null,\n\t\tend: null\n\t};\n\treturn start.getTime() <= end.getTime() ? {\n\t\tstart,\n\t\tend\n\t} : {\n\t\tstart: end,\n\t\tend: start\n\t};\n}\n//#endregion\nexport { formatDateRange, nextDateRangeSelection, parseDateRange, rangeDayState };\n",":host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-daterange-text);\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-daterange-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.row-controls {\n align-items: center;\n display: flex;\n gap: var(--space-2);\n}\n\n.trigger {\n align-items: center;\n background: var(--pf-daterange-bg);\n border: 1px solid var(--pf-daterange-border);\n border-radius: var(--radius-md);\n color: var(--pf-daterange-text);\n cursor: pointer;\n display: flex;\n flex: 1;\n font-family: inherit;\n font-size: var(--font-size-sm);\n gap: var(--space-2);\n justify-content: space-between;\n min-width: 0;\n padding: var(--space-2) var(--space-3);\n text-align: start;\n}\n\n.trigger:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.trigger--invalid {\n border-color: var(--pf-daterange-invalid-border);\n}\n\n.value {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.value--placeholder {\n color: var(--pf-daterange-text-muted);\n}\n\n.clear {\n align-items: center;\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-daterange-text-muted);\n cursor: pointer;\n display: inline-flex;\n flex-shrink: 0;\n justify-content: center;\n padding: var(--space-1);\n}\n\n.clear:hover:not(:disabled) {\n color: var(--pf-daterange-text);\n}\n\n.clear:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n.description {\n color: var(--pf-daterange-text-muted);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-daterange-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/* See src/place-popover.ts: the UA stylesheet centres a popover otherwise. */\n.panel {\n inset: auto;\n margin: 0;\n background: var(--pf-daterange-menu-bg);\n border: 1px solid var(--pf-daterange-menu-border);\n border-radius: var(--radius-md);\n box-shadow: var(--pf-elevation-popover-shadow);\n color: var(--pf-daterange-text);\n padding: var(--space-3);\n}\n\n.panel:popover-open {\n animation: pf-date-range-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-date-range-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .panel:popover-open {\n animation: none;\n }\n}\n\n.nav {\n display: flex;\n justify-content: space-between;\n margin-bottom: var(--space-2);\n}\n\n.step {\n align-items: center;\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-daterange-text-muted);\n cursor: pointer;\n display: inline-flex;\n justify-content: center;\n padding: var(--space-1);\n}\n\n.step:hover {\n background: var(--pf-daterange-bg-subtle);\n color: var(--pf-daterange-text);\n}\n\n.step:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n/* One month on a phone, two side by side from --md up. */\n.months {\n display: grid;\n gap: var(--space-4);\n}\n\n@media (--md) {\n .months {\n grid-template-columns: 1fr 1fr;\n }\n}\n\n.month-label {\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-semibold);\n margin: 0 0 var(--space-2);\n text-align: center;\n}\n\n.grid {\n display: grid;\n gap: 2px;\n grid-template-columns: repeat(7, 1fr);\n}\n\n/*\n * `display: contents`, so each row's seven cells join the grid's own columns.\n * The rows exist for the `role=\"row\"` the grid pattern needs, not for layout.\n */\n.row {\n display: contents;\n}\n\n.weekday {\n color: var(--pf-daterange-text-muted);\n font-size: var(--font-size-xs);\n font-weight: var(--font-weight-semibold);\n padding: var(--space-1) 0;\n text-align: center;\n}\n\n.day,\n.empty {\n aspect-ratio: 1;\n display: flex;\n min-width: var(--space-7);\n}\n\n.day {\n align-items: center;\n background: none;\n border: 1px solid transparent;\n border-radius: var(--radius-sm);\n color: var(--pf-daterange-text);\n cursor: pointer;\n font-family: inherit;\n font-size: var(--font-size-sm);\n justify-content: center;\n}\n\n.day:hover:not([aria-disabled='true']) {\n background: var(--pf-daterange-bg-subtle);\n}\n\n.day:focus-visible {\n box-shadow: var(--pf-daterange-focus-ring);\n outline: none;\n}\n\n.day--today {\n border-color: var(--pf-calendar-today-border);\n}\n\n/*\n * The inside of the range is square and the ends are rounded on their outer\n * side only, so the run reads as one band rather than a row of pills.\n */\n.day--inside {\n background: var(--pf-daterange-range-bg);\n border-radius: 0;\n color: var(--pf-daterange-range-text);\n}\n\n.day--endpoint {\n background: var(--pf-calendar-selected-bg);\n border-color: var(--pf-calendar-selected-bg);\n color: var(--pf-calendar-selected-text);\n}\n\n.day--start:not(.day--end) {\n border-end-end-radius: 0;\n border-start-end-radius: 0;\n}\n\n.day--end:not(.day--start) {\n border-end-start-radius: 0;\n border-start-start-radius: 0;\n}\n\n.day[aria-disabled='true'] {\n cursor: not-allowed;\n opacity: 0.4;\n}\n","import {\n addMonths,\n buildCalendarDays,\n CALENDAR_CELL_COUNT,\n clampMonthToYearRange,\n composeDescribedBy,\n formatDateRange,\n formatISODate,\n isOutsideDateRange,\n isSameDay,\n isSameMonth,\n Keys,\n moveCalendarDate,\n nextDateRangeSelection,\n observeAnchoredPosition,\n parseDateRange,\n parseISODate,\n rangeDayState,\n startOfMonth,\n toMidday,\n WEEKDAY_LABELS,\n type CalendarMove,\n type DateRangeValue,\n} from '@pitchfork-ui/core';\n\nimport { applyControlValidity } from '../../form-validity';\nimport { controlAriaLabel } from '../../control-label';\nimport { placePopover } from '../../place-popover';\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\n\nconst MOVES: Record<string, CalendarMove> = {\n [Keys.ArrowRight]: 'day-next',\n [Keys.ArrowLeft]: 'day-previous',\n [Keys.ArrowDown]: 'week-next',\n [Keys.ArrowUp]: 'week-previous',\n [Keys.Home]: 'week-start',\n [Keys.End]: 'week-end',\n PageDown: 'month-next',\n PageUp: 'month-previous',\n};\n\n/**\n * A form-associated date-range field: two month grids in a popover, with a\n * preview that follows the pointer while the range is half-made.\n *\n * **It submits two entries from one control.** `setFormValue` accepts a\n * `FormData`, and every entry in it is submitted — measured, along with the\n * fact that the element's own `name` attribute is then ignored entirely. So a\n * range goes in as `${name}-start` and `${name}-end`, which is what a server\n * handling a form actually wants, rather than one field a handler has to split.\n * The `value` property stays a single round-trippable `start/end` string.\n *\n * The grids are rendered here rather than composed from two `pf-calendar`s:\n * the range preview spans both months, so one element has to own the hover and\n * the selection for both. The day-state and selection rules are core's, shared\n * with the React component.\n *\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part trigger - the button that opens the grids.\n * @part clear - the clear button.\n * @part panel - the floating panel.\n * @part grid - each month grid.\n * @part day - every day cell.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-date-range-picker',\n styleUrl: 'pf-date-range-picker.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfDateRangePicker {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The base name for the two submitted entries, `${name}-start` and\n * `${name}-end`. Reflected for selectors; the submission reads the property,\n * because a `FormData` value carries its own keys.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** The range as `YYYY-MM-DD/YYYY-MM-DD`, or empty. */\n @Prop({ mutable: true }) value = '';\n\n /** Whether the panel is showing. Reflected for the stylesheet. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Prop() label?: string;\n\n @Prop() description?: string;\n\n @Prop() error?: string;\n\n @Prop() placeholder = 'Select dates';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Offer a button that empties the range. */\n @Prop() allowClear = false;\n\n @Prop() min?: string;\n\n @Prop() max?: string;\n\n @Prop() startYear?: number;\n\n @Prop() endYear?: number;\n\n /** A predicate for days that cannot be chosen; see `pf-calendar`. */\n @Prop() isDateDisabled?: (date: Date) => boolean;\n\n /** Fires when the range changes or is cleared, with the `start/end` string. */\n @Event() pfChange!: EventEmitter<{ value: string; start: string; end: string }>;\n\n /** Fires whenever the panel opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** The left-hand month; the right-hand one is always the month after. */\n @State() leftMonth: Date = startOfMonth(new Date());\n\n /** The day the grids' single tab stop sits on. */\n @State() focusedDate: Date = toMidday(new Date());\n\n /** The day under the pointer, which previews the missing end. */\n @State() hovered: Date | null = null;\n\n /** True once a start is chosen and the next click sets the end. */\n @State() awaitingEnd = false;\n\n private initialValue = '';\n\n /**\n * The start held while the range is half-made.\n *\n * Not in `value`, because `value` is the *submitted* range and a half-made\n * one is not a range — a form read mid-selection would see a start with no\n * end. Held here instead, and folded back in for rendering.\n */\n private pendingStart: Date | null = null;\n private stopObserving?: () => void;\n private shouldRestoreFocus = false;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n const { start } = this.range();\n const base = start ?? toMidday(new Date());\n this.focusedDate = base;\n this.leftMonth = this.clamp(startOfMonth(base));\n this.syncFormState();\n }\n\n componentDidRender() {\n if (!this.shouldRestoreFocus) return;\n this.shouldRestoreFocus = false;\n this.el.shadowRoot?.querySelector<HTMLButtonElement>('button[data-day][tabindex=\"0\"]')?.focus();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n }\n\n /**\n * Follows a range set from outside, so the grids show what they are told.\n *\n * Without this the element kept whatever month it loaded with, and a\n * consumer assigning `value` got a correct value over the wrong months —\n * the days it names were not even rendered.\n */\n @Watch('value')\n syncDisplayedMonths() {\n const { start, end } = this.range();\n if (!start || !end) return;\n this.pendingStart = null;\n this.awaitingEnd = false;\n this.focusedDate = start;\n this.leftMonth = this.clamp(startOfMonth(start));\n }\n\n /*\n * `name` is watched here and not on the controls that pass a plain string to\n * `setFormValue`: those take their submission name from the reflected\n * attribute, so the platform picks a change up by itself. This one builds\n * the name *into* a FormData, so without the watch a name assigned after\n * load would never reach the submission.\n */\n @Watch('name')\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n const { start, end } = this.range();\n\n if (!start || !end || !this.name) {\n this.internals.setFormValue(null);\n } else {\n /*\n * A FormData, so one control submits both ends. Measured: every entry in\n * it reaches the submission, and the element's own `name` attribute is\n * ignored in this mode — which is why the keys are built here.\n */\n const data = new FormData();\n data.append(`${this.name}-start`, formatISODate(start));\n data.append(`${this.name}-end`, formatISODate(end));\n this.internals.setFormValue(data);\n }\n\n applyControlValidity(this.internals, Boolean(start && end), this.required, this.error);\n }\n\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showPanel();\n else this.hidePanel();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n this.awaitingEnd = false;\n this.hovered = null;\n }\n\n private range(): DateRangeValue {\n return parseDateRange(this.value, parseISODate);\n }\n\n private get years() {\n const now = new Date().getFullYear();\n const start = this.startYear ?? now - 50;\n const end = this.endYear ?? now + 50;\n return { start: Math.min(start, end), end: Math.max(start, end) };\n }\n\n private clamp(date: Date): Date {\n const { start, end } = this.years;\n return clampMonthToYearRange(date, start, end);\n }\n\n private get panel() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"panel\"]') ?? null;\n }\n\n private get trigger() {\n return this.el.shadowRoot?.querySelector<HTMLButtonElement>('[part=\"trigger\"]') ?? null;\n }\n\n private isDisabled(date: Date): boolean {\n if (isOutsideDateRange(date, parseISODate(this.min), parseISODate(this.max))) return true;\n return this.isDateDisabled?.(date) ?? false;\n }\n\n private showPanel() {\n const panel = this.panel;\n if (this.disabled || !panel || panel.matches(':popover-open')) return;\n\n panel.showPopover();\n this.stopObserving?.();\n this.stopObserving = observeAnchoredPosition({\n getAnchor: () => this.trigger,\n getFloating: () => panel,\n align: 'start',\n matchAnchorWidth: false,\n flip: true,\n onChange: ({ left, top }) => placePopover(panel, left, top),\n });\n\n this.shouldRestoreFocus = true;\n }\n\n private hidePanel() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n this.hovered = null;\n const panel = this.panel;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n private onToggle = (event: ToggleEvent) => {\n const nowOpen = event.newState === 'open';\n if (this.open !== nowOpen) this.open = nowOpen;\n if (!nowOpen) this.trigger?.focus();\n };\n\n /** One click through core's state machine, plus this element's side-effects. */\n private pick(date: Date) {\n if (this.isDisabled(date)) return;\n\n /*\n * `displayRange()`, not `range()`. A half-made range is deliberately kept\n * out of `value`, so reading the state machine's input from `value` hands\n * it a range with no start — and core, correctly, treats that as \"begin a\n * new range\". Every second click restarted instead of closing. Caught by\n * the swap and Enter tests.\n */\n const next = nextDateRangeSelection(\n { range: this.displayRange(), awaitingEnd: this.awaitingEnd },\n date,\n );\n\n this.awaitingEnd = next.awaitingEnd;\n this.focusedDate = toMidday(date);\n\n if (next.awaitingEnd) {\n // Half-made: hold the start without reporting an incomplete range.\n this.value = '';\n this.pendingStart = next.range.start;\n return;\n }\n\n this.pendingStart = null;\n this.hovered = null;\n this.value = formatDateRange(next.range, formatISODate);\n this.pfChange.emit({\n value: this.value,\n start: next.range.start ? formatISODate(next.range.start) : '',\n end: next.range.end ? formatISODate(next.range.end) : '',\n });\n this.open = false;\n }\n\n /** What the grids draw: the committed range, or the half-made one. */\n private displayRange(): DateRangeValue {\n const committed = this.range();\n if (committed.start && committed.end) return committed;\n return { start: this.pendingStart, end: null };\n }\n\n private moveFocus(move: CalendarMove) {\n const next = moveCalendarDate(this.focusedDate, move);\n const { start, end } = this.years;\n if (next.getFullYear() < start || next.getFullYear() > end) return;\n\n this.focusedDate = next;\n this.shouldRestoreFocus = true;\n\n // Keep the focused day on screen: it belongs to one of the two months.\n const right = addMonths(this.leftMonth, 1);\n if (!isSameMonth(next, this.leftMonth) && !isSameMonth(next, right)) {\n this.leftMonth = this.clamp(startOfMonth(next));\n }\n }\n\n private onKeyDown = (event: KeyboardEvent) => {\n const move = MOVES[event.key];\n if (move) {\n event.preventDefault();\n this.moveFocus(move);\n return;\n }\n\n if (event.key === Keys.Enter || event.key === Keys.Space) {\n event.preventDefault();\n this.pick(this.focusedDate);\n this.shouldRestoreFocus = true;\n }\n };\n\n private clear = (event: MouseEvent) => {\n event.stopPropagation();\n if (!this.value && !this.pendingStart) return;\n this.value = '';\n this.pendingStart = null;\n this.awaitingEnd = false;\n this.hovered = null;\n this.pfChange.emit({ value: '', start: '', end: '' });\n };\n\n private formatted(): string {\n const { start, end } = this.range();\n if (!start || !end) return '';\n const format = new Intl.DateTimeFormat('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n });\n return `${format.format(start)} – ${format.format(end)}`;\n }\n\n private renderGrid(month: Date) {\n const days = buildCalendarDays(month);\n const range = this.displayRange();\n const today = toMidday(new Date());\n const label = new Intl.DateTimeFormat('en-US', {\n month: 'long',\n year: 'numeric',\n }).format(month);\n\n return (\n <div class=\"month\">\n <p class=\"month-label\">{label}</p>\n <div class=\"grid\" part=\"grid\" role=\"grid\" aria-label={label}>\n <div class=\"row\" role=\"row\">\n {WEEKDAY_LABELS.map((day) => (\n <span key={day} class=\"weekday\" role=\"columnheader\" aria-label={day}>\n {day}\n </span>\n ))}\n </div>\n\n {Array.from({ length: CALENDAR_CELL_COUNT / 7 }, (_, week) => (\n <div key={week} class=\"row\" role=\"row\">\n {days.slice(week * 7, week * 7 + 7).map(({ date, inCurrentMonth }) => {\n if (!inCurrentMonth) {\n return <span key={formatISODate(date)} class=\"empty\" role=\"gridcell\"></span>;\n }\n\n const state = rangeDayState(date, range, this.hovered);\n const isEndpoint = state.isStart || state.isEnd;\n const disabled = this.isDisabled(date);\n\n return (\n <button\n key={formatISODate(date)}\n type=\"button\"\n role=\"gridcell\"\n data-day={formatISODate(date)}\n part=\"day\"\n class={{\n day: true,\n 'day--today': isSameDay(today, date),\n 'day--endpoint': isEndpoint,\n 'day--start': state.isStart,\n 'day--end': state.isEnd,\n 'day--inside': state.isInside,\n }}\n tabindex={isSameDay(this.focusedDate, date) ? 0 : -1}\n aria-selected={isEndpoint || state.isInside ? 'true' : 'false'}\n aria-current={isSameDay(today, date) ? 'date' : null}\n aria-disabled={disabled ? 'true' : null}\n aria-label={new Intl.DateTimeFormat('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n }).format(date)}\n onClick={() => {\n this.pick(date);\n this.shouldRestoreFocus = true;\n }}\n onMouseEnter={() => {\n if (this.awaitingEnd && !disabled) this.hovered = date;\n }}\n >\n {date.getDate()}\n </button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n const text = this.formatted();\n const right = addMonths(this.leftMonth, 1);\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"trigger\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div class=\"row-controls\">\n <button\n id=\"trigger\"\n aria-label={controlAriaLabel(this.el, this.label)}\n part=\"trigger\"\n class={{ trigger: true, 'trigger--invalid': Boolean(this.error) }}\n type=\"button\"\n disabled={this.disabled}\n aria-haspopup=\"dialog\"\n aria-expanded={this.open ? 'true' : 'false'}\n aria-controls=\"panel\"\n aria-invalid={this.error ? 'true' : null}\n aria-required={this.required ? 'true' : null}\n aria-describedby={describedBy}\n onClick={() => {\n if (!this.disabled) this.open = !this.open;\n }}\n >\n <span class={{ value: true, 'value--placeholder': !text }}>\n {text || this.placeholder}\n </span>\n <pf-icon name=\"calendar\"></pf-icon>\n </button>\n\n {this.allowClear && (this.value || this.pendingStart) && (\n <button\n class=\"clear\"\n part=\"clear\"\n type=\"button\"\n aria-label=\"Clear selected dates\"\n disabled={this.disabled}\n onClick={this.clear}\n >\n <pf-icon name=\"circle-xmark\"></pf-icon>\n </button>\n )}\n </div>\n\n {this.description && (\n <p class=\"description\" part=\"description\" id=\"description\">\n {this.description}\n </p>\n )}\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </div>\n\n <div\n id=\"panel\"\n part=\"panel\"\n class=\"panel\"\n popover=\"auto\"\n role=\"dialog\"\n aria-label=\"Choose a date range\"\n onToggle={this.onToggle}\n onKeyDown={this.onKeyDown}\n onMouseLeave={() => {\n this.hovered = null;\n }}\n >\n <div class=\"nav\">\n <button\n type=\"button\"\n class=\"step\"\n aria-label=\"Previous month\"\n onClick={() => {\n this.leftMonth = this.clamp(addMonths(this.leftMonth, -1));\n }}\n >\n <pf-icon name=\"square-caret-left\"></pf-icon>\n </button>\n <button\n type=\"button\"\n class=\"step\"\n aria-label=\"Next month\"\n onClick={() => {\n this.leftMonth = this.clamp(addMonths(this.leftMonth, 1));\n }}\n >\n <pf-icon name=\"square-caret-right\"></pf-icon>\n </button>\n </div>\n\n <div class=\"months\">\n {this.renderGrid(this.le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