@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-select.js","sourceRoot":"","sources":["../../../src/components/pf-select/pf-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,IAAI,EACJ,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,cAAc,GAEf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,MAAM,KAAK,GAAyC;IAClD,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM;IACxB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU;IAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO;IACpB,CAAC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nextTypeaheadBuffer,\n observeAnchoredPosition,\n resolveListMove,\n TYPEAHEAD_TIMEOUT_MS,\n isTypeaheadKey,\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 single-choice select over `pf-option` children.\n *\n * The first of Wave 5, and the worked example for §2.1: the options are child\n * elements, so a label is a slot and can hold anything, where the React\n * `Select`'s `options` array can only hold a string.\n *\n * **It has typeahead, which the React component does not.** Typing `b` jumps\n * to the next option beginning with `b`, `br` narrows, and `bbb` cycles — the\n * ARIA listbox pattern, and the matching is core's so a later `pf-combobox`\n * answers the same keystrokes. `todo.md` has the React fix.\n *\n * Form-associated, so the value submits by itself. The React component fakes\n * that with a hidden `<input>` beside the trigger.\n *\n * The active option is set as an *element*, not an IDREF: the trigger is in\n * this shadow root and the options are slotted light DOM, and a cross-root\n * IDREF is absent from the accessibility tree — measured. `aria-controls` does\n * work, because the listbox itself is in this same root.\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 trigger - the combobox button.\n * @part listbox - the floating listbox the options are slotted into.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-select',\n styleUrl: 'pf-select.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfSelect {\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 = 'Select an option';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Options to show before the listbox scrolls. Unset means it fits them all. */\n @Prop() maxVisibleOptions?: number;\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 /** The label of the chosen option, for the trigger to show. */\n @State() selectedLabel = '';\n\n private initialValue = '';\n private stopObserving?: () => void;\n private activeOption: HTMLElement | null = null;\n private typeahead = '';\n private typeaheadTimer?: ReturnType<typeof setTimeout>;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n this.syncOptions();\n }\n\n componentDidRender() {\n this.syncActiveDescendant();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\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 value changed, so the children's `selected` and the trigger follow. */\n @Watch('value')\n syncOptions() {\n const options = this.options();\n let label = '';\n\n for (const option of options) {\n const selected = this.optionValue(option) === this.value && this.value !== '';\n (option as HTMLElement & { selected: boolean }).selected = selected;\n if (selected) label = option.textContent?.trim() ?? '';\n }\n\n this.selectedLabel = label;\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 /** A reset restores the value the control started with, not an empty one. */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n /** An option added or removed while mounted; re-mark the children. */\n private onSlotChange = () => {\n this.syncOptions();\n };\n\n /** Re-reads the options, for a label edited in place (which fires no slotchange). */\n @Method()\n async refresh(): Promise<void> {\n this.syncOptions();\n }\n\n private options(): HTMLElement[] {\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-option'));\n }\n\n private enabled(): HTMLElement[] {\n return this.options().filter((option) => !option.hasAttribute('disabled'));\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 get listbox() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"listbox\"]') ?? null;\n }\n\n private get trigger() {\n return this.el.shadowRoot?.querySelector<HTMLButtonElement>('[part=\"trigger\"]') ?? null;\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.trigger,\n getFloating: () => panel,\n // The listbox matches the trigger's width, as the React component does.\n matchAnchorWidth: true,\n flip: true,\n /*\n * `width` *and* `minWidth`: core reports whichever the mode calls for\n * and leaves the other undefined — `matchAnchorWidth: true` gives a\n * `width`, false gives a `minWidth`. Reading only `minWidth`, which is\n * what pf-dropdown needs, left the listbox at its intrinsic 156px beside\n * a 1216px trigger. The smoke test against a real build caught it.\n */\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 /*\n * Opens on the chosen option, or the first selectable one. Landing\n * anywhere else would make the arrows start from somewhere the user has\n * no reason to expect.\n */\n const options = this.options();\n const chosen = options.find((option) => this.optionValue(option) === this.value);\n this.setActive(\n chosen && !chosen.hasAttribute('disabled') ? chosen : (this.enabled()[0] ?? null),\n );\n }\n\n private hideListbox() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n this.clearTypeahead();\n const panel = this.listbox;\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 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 * Feature-detected. Where ARIA element reflection is missing there is no\n * cross-root equivalent, so the active option stops being *announced* while\n * the arrows and Enter still work — recorded in `todo.md`.\n */\n private syncActiveDescendant() {\n const trigger = this.trigger;\n if (!trigger || !('ariaActiveDescendantElement' in trigger)) return;\n (\n trigger 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 this.trigger?.focus();\n\n if (next === this.value) return;\n this.value = next;\n this.pfChange.emit({ value: next });\n }\n\n /** An option asked to be taken. The select decides, reports and closes. */\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 options = this.options();\n const enabledIndexes = getEnabledIndexes(options, (option) => option.hasAttribute('disabled'));\n const current = this.activeOption ? options.indexOf(this.activeOption) : -1;\n const next = resolveListMove(action, enabledIndexes, current);\n if (next !== -1) this.setActive(options[next] ?? null);\n }\n\n private clearTypeahead() {\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n this.typeaheadTimer = undefined;\n this.typeahead = '';\n }\n\n /**\n * Typeahead. The buffer and its timer live here, because a timer is state\n * and core is never a state container; the matching is core's.\n */\n private handleTypeahead(key: string) {\n this.typeahead = nextTypeaheadBuffer(this.typeahead, key);\n\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n this.typeaheadTimer = setTimeout(() => this.clearTypeahead(), TYPEAHEAD_TIMEOUT_MS);\n\n const options = this.options();\n const labels = options.map((option) => option.textContent ?? '');\n const from = this.activeOption ? options.indexOf(this.activeOption) : -1;\n const match = findTypeaheadMatch(labels, this.typeahead, from, (index) =>\n options[index].hasAttribute('disabled'),\n );\n\n if (match === -1) return;\n\n /*\n * Closed, typeahead *chooses* rather than merely highlighting: that is\n * what a native `<select>` does, and with no listbox on screen a\n * highlight nobody can see would be no feedback at all.\n */\n if (this.open) this.setActive(options[match]);\n else this.commit(options[match]);\n }\n\n @Listen('keydown')\n handleKeyDown(event: KeyboardEvent) {\n if (this.disabled || event.defaultPrevented) return;\n\n const move = MOVES[event.key];\n if (move) {\n event.preventDefault();\n // Down or Up on a closed select opens it, as a combobox should.\n if (!this.open) this.open = true;\n else this.move(move);\n return;\n }\n\n if (isActivationKey(event.key)) {\n event.preventDefault();\n if (!this.open) {\n this.open = true;\n } else if (this.activeOption) {\n this.commit(this.activeOption);\n }\n return;\n }\n\n // Escape is the browser's while the listbox is a `popover=\"auto\"`.\n if (isTypeaheadKey(event.key)) {\n event.preventDefault();\n this.handleTypeahead(event.key);\n }\n }\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\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 <button\n id=\"trigger\"\n part=\"trigger\"\n class={{ trigger: true, 'trigger--invalid': Boolean(this.error) }}\n type=\"button\"\n role=\"combobox\"\n disabled={this.disabled}\n aria-haspopup=\"listbox\"\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-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': !this.selectedLabel }}>\n {this.selectedLabel || this.placeholder}\n </span>\n <span class=\"chevron\" aria-hidden=\"true\">\n <pf-icon name=\"chevron-down\"></pf-icon>\n </span>\n </button>\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 style={\n this.maxVisibleOptions\n ? { maxHeight: `calc(${this.maxVisibleOptions} * 36px)`, overflowY: 'auto' }\n : undefined\n }\n onToggle={this.onToggle}\n >\n <slot onSlotchange={this.onSlotChange} />\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pf-select.js","sourceRoot":"","sources":["../../../src/components/pf-select/pf-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,IAAI,EACJ,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,cAAc,GAEf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA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,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n composeDescribedBy,\n findTypeaheadMatch,\n getEnabledIndexes,\n isActivationKey,\n Keys,\n nextTypeaheadBuffer,\n observeAnchoredPosition,\n resolveListMove,\n TYPEAHEAD_TIMEOUT_MS,\n isTypeaheadKey,\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 single-choice select over `pf-option` children.\n *\n * The first of Wave 5, and the worked example for §2.1: the options are child\n * elements, so a label is a slot and can hold anything, where the React\n * `Select`'s `options` array can only hold a string.\n *\n * **It has typeahead, which the React component does not.** Typing `b` jumps\n * to the next option beginning with `b`, `br` narrows, and `bbb` cycles — the\n * ARIA listbox pattern, and the matching is core's so a later `pf-combobox`\n * answers the same keystrokes. `todo.md` has the React fix.\n *\n * Form-associated, so the value submits by itself. The React component fakes\n * that with a hidden `<input>` beside the trigger.\n *\n * The active option is set as an *element*, not an IDREF: the trigger is in\n * this shadow root and the options are slotted light DOM, and a cross-root\n * IDREF is absent from the accessibility tree — measured. `aria-controls` does\n * work, because the listbox itself is in this same root.\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 trigger - the combobox button.\n * @part listbox - the floating listbox the options are slotted into.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-select',\n styleUrl: 'pf-select.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfSelect {\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 = 'Select an option';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Options to show before the listbox scrolls. Unset means it fits them all. */\n @Prop() maxVisibleOptions?: number;\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 /** The label of the chosen option, for the trigger to show. */\n @State() selectedLabel = '';\n\n private initialValue = '';\n private stopObserving?: () => void;\n private activeOption: HTMLElement | null = null;\n private typeahead = '';\n private typeaheadTimer?: ReturnType<typeof setTimeout>;\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n this.syncOptions();\n }\n\n componentDidRender() {\n this.syncActiveDescendant();\n }\n\n disconnectedCallback() {\n this.stopObserving?.();\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\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 value changed, so the children's `selected` and the trigger follow. */\n @Watch('value')\n syncOptions() {\n const options = this.options();\n let label = '';\n\n for (const option of options) {\n const selected = this.optionValue(option) === this.value && this.value !== '';\n (option as HTMLElement & { selected: boolean }).selected = selected;\n if (selected) label = option.textContent?.trim() ?? '';\n }\n\n this.selectedLabel = label;\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 /** A reset restores the value the control started with, not an empty one. */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n /** An option added or removed while mounted; re-mark the children. */\n private onSlotChange = () => {\n this.syncOptions();\n };\n\n /** Re-reads the options, for a label edited in place (which fires no slotchange). */\n @Method()\n async refresh(): Promise<void> {\n this.syncOptions();\n }\n\n private options(): HTMLElement[] {\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-option'));\n }\n\n private enabled(): HTMLElement[] {\n return this.options().filter((option) => !option.hasAttribute('disabled'));\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 get listbox() {\n return this.el.shadowRoot?.querySelector<HTMLElement>('[part=\"listbox\"]') ?? null;\n }\n\n private get trigger() {\n return this.el.shadowRoot?.querySelector<HTMLButtonElement>('[part=\"trigger\"]') ?? null;\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.trigger,\n getFloating: () => panel,\n // The listbox matches the trigger's width, as the React component does.\n matchAnchorWidth: true,\n flip: true,\n /*\n * `width` *and* `minWidth`: core reports whichever the mode calls for\n * and leaves the other undefined — `matchAnchorWidth: true` gives a\n * `width`, false gives a `minWidth`. Reading only `minWidth`, which is\n * what pf-dropdown needs, left the listbox at its intrinsic 156px beside\n * a 1216px trigger. The smoke test against a real build caught it.\n */\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 /*\n * Opens on the chosen option, or the first selectable one. Landing\n * anywhere else would make the arrows start from somewhere the user has\n * no reason to expect.\n */\n const options = this.options();\n const chosen = options.find((option) => this.optionValue(option) === this.value);\n this.setActive(\n chosen && !chosen.hasAttribute('disabled') ? chosen : (this.enabled()[0] ?? null),\n );\n }\n\n private hideListbox() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n this.clearTypeahead();\n const panel = this.listbox;\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 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 * Feature-detected. Where ARIA element reflection is missing there is no\n * cross-root equivalent, so the active option stops being *announced* while\n * the arrows and Enter still work — recorded in `todo.md`.\n */\n private syncActiveDescendant() {\n const trigger = this.trigger;\n if (!trigger || !('ariaActiveDescendantElement' in trigger)) return;\n (\n trigger 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 this.trigger?.focus();\n\n if (next === this.value) return;\n this.value = next;\n this.pfChange.emit({ value: next });\n }\n\n /** An option asked to be taken. The select decides, reports and closes. */\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 options = this.options();\n const enabledIndexes = getEnabledIndexes(options, (option) => option.hasAttribute('disabled'));\n const current = this.activeOption ? options.indexOf(this.activeOption) : -1;\n const next = resolveListMove(action, enabledIndexes, current);\n if (next !== -1) this.setActive(options[next] ?? null);\n }\n\n private clearTypeahead() {\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n this.typeaheadTimer = undefined;\n this.typeahead = '';\n }\n\n /**\n * Typeahead. The buffer and its timer live here, because a timer is state\n * and core is never a state container; the matching is core's.\n */\n private handleTypeahead(key: string) {\n this.typeahead = nextTypeaheadBuffer(this.typeahead, key);\n\n if (this.typeaheadTimer) clearTimeout(this.typeaheadTimer);\n this.typeaheadTimer = setTimeout(() => this.clearTypeahead(), TYPEAHEAD_TIMEOUT_MS);\n\n const options = this.options();\n const labels = options.map((option) => option.textContent ?? '');\n const from = this.activeOption ? options.indexOf(this.activeOption) : -1;\n const match = findTypeaheadMatch(labels, this.typeahead, from, (index) =>\n options[index].hasAttribute('disabled'),\n );\n\n if (match === -1) return;\n\n /*\n * Closed, typeahead *chooses* rather than merely highlighting: that is\n * what a native `<select>` does, and with no listbox on screen a\n * highlight nobody can see would be no feedback at all.\n */\n if (this.open) this.setActive(options[match]);\n else this.commit(options[match]);\n }\n\n @Listen('keydown')\n handleKeyDown(event: KeyboardEvent) {\n if (this.disabled || event.defaultPrevented) return;\n\n const move = MOVES[event.key];\n if (move) {\n event.preventDefault();\n // Down or Up on a closed select opens it, as a combobox should.\n if (!this.open) this.open = true;\n else this.move(move);\n return;\n }\n\n if (isActivationKey(event.key)) {\n event.preventDefault();\n if (!this.open) {\n this.open = true;\n } else if (this.activeOption) {\n this.commit(this.activeOption);\n }\n return;\n }\n\n // Escape is the browser's while the listbox is a `popover=\"auto\"`.\n if (isTypeaheadKey(event.key)) {\n event.preventDefault();\n this.handleTypeahead(event.key);\n }\n }\n\n render() {\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\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 <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 role=\"combobox\"\n disabled={this.disabled}\n aria-haspopup=\"listbox\"\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-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': !this.selectedLabel }}>\n {this.selectedLabel || this.placeholder}\n </span>\n <span class=\"chevron\" aria-hidden=\"true\">\n <pf-icon name=\"chevron-down\"></pf-icon>\n </span>\n </button>\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 style={\n this.maxVisibleOptions\n ? { maxHeight: `calc(${this.maxVisibleOptions} * 36px)`, overflowY: 'auto' }\n : undefined\n }\n onToggle={this.onToggle}\n >\n <slot onSlotchange={this.onSlotChange} />\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -50,21 +50,24 @@ export class PfSidebarNavigation {
50
50
  this.sync();
51
51
  }
52
52
  /**
53
- * A section's own slot changed, so the items below it have moved.
53
+ * A section's items moved, or an item's `current` changed. Either way the
54
+ * resolution has to run again.
54
55
  *
55
56
  * `slotchange` is not composed, so this is the only way the navigation
56
- * hears about an item appended inside a section. The event comes from a
57
- * slotted child in the navigation's own tree, so `event.target` is the
58
- * section rather than the host — nothing is retargeted, which is what makes
59
- * a host listener safe here and not on a child in the shadow root.
57
+ * hears about an item appended inside a section — and an item's `current`
58
+ * arriving as a *property* fires no DOM event at all, which is why the item
59
+ * emits this too. The event comes from a slotted child in the navigation's
60
+ * own tree, so `event.target` is the section or the item rather than the
61
+ * host — nothing is retargeted, which is what makes a host listener safe
62
+ * here and not on a child in the shadow root.
60
63
  */
61
64
  handleStructureChange(event) {
62
65
  event.stopPropagation();
63
66
  this.sync();
64
67
  }
65
68
  /**
66
- * Re-reads the items, for a consumer who marked one current through its
67
- * *property* — which leaves no attribute and fires no `slotchange`.
69
+ * Re-reads the items, for a consumer who changed something the group reads
70
+ * and has no event for.
68
71
  */
69
72
  async refresh() {
70
73
  this.sync();
@@ -112,7 +115,7 @@ export class PfSidebarNavigation {
112
115
  }
113
116
  }
114
117
  render() {
115
- return (h(Host, { key: 'c53d731970844c06cf2d86789dfbc9e111eeb83e' }, h("div", { key: '1ca019d8890305e0f1656243bcca112f461ea51c', class: { header: true, empty: !this.hasHeader }, part: "header" }, h("slot", { key: '750fc4f32e167e6b186824d1429ea25d09818c3d', name: "header", onSlotchange: () => this.refresh() })), h("nav", { key: '6ebe62b6bd357a9fac58220f31309c811a6af76a', class: "nav", part: "nav", "aria-label": this.label }, h("slot", { key: '636b7284ed6113e7c60da733da62c0562a8ba042', onSlotchange: () => this.refresh() })), h("div", { key: '9a5b32c84e82ced42bc6520806f9d02b5c7af65e', class: { footer: true, empty: !this.hasFooter }, part: "footer" }, h("slot", { key: 'd04ef066ba6168173d0f778e8dc163ba34deeef5', name: "footer", onSlotchange: () => this.refresh() }))));
118
+ return (h(Host, { key: '32d3374c206ae575f3b572e249203d9b5e1b5c66' }, h("div", { key: '18ddded266a900836c09b26b3716bb4e4d17a027', class: { header: true, empty: !this.hasHeader }, part: "header" }, h("slot", { key: '8a74ca32bb1574d64bf6bfca53b799580fae5980', name: "header", onSlotchange: () => this.refresh() })), h("nav", { key: 'b4168ab94367d2e7086ec82aa08d81e92540d1f3', class: "nav", part: "nav", "aria-label": this.label }, h("slot", { key: 'afa43f3d6f1b247e527a3d1e6a11ac585dd8fdd9', onSlotchange: () => this.refresh() })), h("div", { key: '00afd1800a0aff350f73422823431287457ad2a9', class: { footer: true, empty: !this.hasFooter }, part: "footer" }, h("slot", { key: 'cf899e9e6cab4199f7ed5846ea2fdb4011e71672', name: "footer", onSlotchange: () => this.refresh() }))));
116
119
  }
117
120
  static get is() { return "pf-sidebar-navigation"; }
118
121
  static get encapsulation() { return "shadow"; }
@@ -171,7 +174,7 @@ export class PfSidebarNavigation {
171
174
  "return": "Promise<void>"
172
175
  },
173
176
  "docs": {
174
- "text": "Re-reads the items, for a consumer who marked one current through its\n*property* \u2014 which leaves no attribute and fires no `slotchange`.",
177
+ "text": "Re-reads the items, for a consumer who changed something the group reads\nand has no event for.",
175
178
  "tags": []
176
179
  }
177
180
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pf-sidebar-navigation.js","sourceRoot":"","sources":["../../../src/components/pf-sidebar-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AE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAC,QAAQ;gBACjE,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAI,CACtD;YAEN,4DAAK,KAAK,EAAC,KAAK,EAAC,IAAI,EAAC,KAAK,gBAAa,IAAI,CAAC,KAAK;gBAChD,6DAAM,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAI,CACxC;YAEN,4DAAK,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAC,QAAQ;gBACjE,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAI,CACtD,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { resolveCurrentNavItem } from '@pitchfork-ui/core';\nimport { Component, Element, h, Host, Listen, Method, Prop, State } from '@stencil/core';\n\n/**\n * A sidebar navigation over `pf-nav-item` children, optionally grouped into\n * `pf-nav-section`s.\n *\n * The group owns the one thing an item cannot know: which item is the current\n * page. Core's rule decides, so the React `SidebarNavigation` marks the same\n * one — and the resolution runs across every section rather than within one,\n * because `aria-current=\"page\"` names the one page the reader is on and a\n * sidebar with two marked sections would claim two.\n *\n * As with `pf-header-navigation`, the host is not a landmark of its own: the\n * React component renders an `<aside>`, and an element cannot know whether it\n * is the page's complementary region. Only the `<nav>` is rendered.\n *\n * Items are grouped: the default slot takes `pf-nav-section` children, each\n * of which owns its own `<ul>`. A navigation with no section titles is one\n * untitled section, which is exactly what the React `sections` array is — and\n * it is also the only arrangement that keeps the list semantics honest, since\n * a `<ul>` here would be a list whose children were sections rather than\n * items.\n *\n * @slot - the `pf-nav-section` children.\n * @slot header - a box above the navigation, such as a product switcher.\n * @slot footer - a box below it, pushed to the bottom.\n * @part header - the header's box.\n * @part nav - the navigation landmark.\n * @part footer - the footer's box.\n */\n@Component({\n tag: 'pf-sidebar-navigation',\n styleUrl: 'pf-sidebar-navigation.css',\n shadow: true,\n})\nexport class PfSidebarNavigation {\n @Element() el!: HTMLElement;\n\n /** The navigation's accessible name. */\n @Prop() label = 'Sidebar navigation';\n\n /**\n * Whether anything was slotted into `header` and `footer`.\n *\n * Asked in JS: both boxes carry a border and padding, so an empty one draws\n * a rule across the sidebar for no reason, and a wrapper around a slot\n * cannot be collapsed from CSS. The same arrangement as\n * `pf-slideout-menu`'s footer.\n */\n @State() hasHeader = false;\n @State() hasFooter = false;\n\n /** The light DOM is readable here, so first paint is already right. */\n componentWillLoad() {\n this.sync();\n }\n\n componentDidLoad() {\n this.sync();\n }\n\n /**\n * A section's own slot changed, so the items below it have moved.\n *\n * `slotchange` is not composed, so this is the only way the navigation\n * hears about an item appended inside a section. The event comes from a\n * slotted child in the navigation's own tree, so `event.target` is the\n * section rather than the host — nothing is retargeted, which is what makes\n * a host listener safe here and not on a child in the shadow root.\n */\n @Listen('pfNavStructure')\n handleStructureChange(event: CustomEvent<void>) {\n event.stopPropagation();\n this.sync();\n }\n\n /**\n * Re-reads the items, for a consumer who marked one current through its\n * *property* — which leaves no attribute and fires no `slotchange`.\n */\n @Method()\n async refresh() {\n this.sync();\n }\n\n /**\n * Every item this navigation owns, in document order, however deeply a\n * section nests it — but not one belonging to a navigation nested inside\n * this one.\n */\n private get items(): HTMLElement[] {\n /*\n * The walk up is written out rather than done with `closest`, which would\n * need a comma selector the mock DOM may not take. The first navigation\n * above an item is the one that owns it, so a navigation nested inside\n * this one keeps its own.\n */\n const ownedByThis = (item: HTMLElement) => {\n for (let node = item.parentElement; node; node = node.parentElement) {\n const tag = node.tagName.toLowerCase();\n if (tag === 'pf-sidebar-navigation' || tag === 'pf-header-navigation') {\n return node === this.el;\n }\n }\n return false;\n };\n\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-nav-item')).filter(ownedByThis);\n }\n\n /**\n * The property if the item has upgraded, the attribute if it has not:\n * `componentWillLoad` can run before a child parsed from HTML upgrades.\n */\n private isCurrent(item: HTMLElement) {\n return (item as HTMLElement & { current?: boolean }).current ?? item.hasAttribute('current');\n }\n\n private sync() {\n const slotted = (name: string) =>\n Array.from(this.el.children).some((child) => child.getAttribute('slot') === name);\n\n this.hasHeader = slotted('header');\n this.hasFooter = slotted('footer');\n\n const items = this.items;\n const currentIndex = resolveCurrentNavItem(\n items.map((item) => ({ current: this.isCurrent(item) })),\n );\n\n for (const [index, item] of items.entries()) {\n const node = item as HTMLElement & { currentPage: boolean; orientation: string };\n node.currentPage = index === currentIndex;\n node.orientation = 'vertical';\n }\n }\n\n render() {\n return (\n <Host>\n <div class={{ header: true, empty: !this.hasHeader }} part=\"header\">\n <slot name=\"header\" onSlotchange={() => this.refresh()} />\n </div>\n\n <nav class=\"nav\" part=\"nav\" aria-label={this.label}>\n <slot onSlotchange={() => this.refresh()} />\n </nav>\n\n <div class={{ footer: true, empty: !this.hasFooter }} part=\"footer\">\n <slot name=\"footer\" onSlotchange={() => this.refresh()} />\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pf-sidebar-navigation.js","sourceRoot":"","sources":["../../../src/components/pf-sidebar-navigation/pf-sidebar-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,MAAM,OAAO,mBAAmB;IACnB,EAAE,CAAe;IAE5B,wCAAwC;IAChC,KAAK,GAAG,oBAAoB,CAAC;IAErC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AAE,IAAI,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAC,QAAQ;gBACjE,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAI,CACtD,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { resolveCurrentNavItem } from '@pitchfork-ui/core';\nimport { Component, Element, h, Host, Listen, Method, Prop, State } from '@stencil/core';\n\n/**\n * A sidebar navigation over `pf-nav-item` children, optionally grouped into\n * `pf-nav-section`s.\n *\n * The group owns the one thing an item cannot know: which item is the current\n * page. Core's rule decides, so the React `SidebarNavigation` marks the same\n * one — and the resolution runs across every section rather than within one,\n * because `aria-current=\"page\"` names the one page the reader is on and a\n * sidebar with two marked sections would claim two.\n *\n * As with `pf-header-navigation`, the host is not a landmark of its own: the\n * React component renders an `<aside>`, and an element cannot know whether it\n * is the page's complementary region. Only the `<nav>` is rendered.\n *\n * Items are grouped: the default slot takes `pf-nav-section` children, each\n * of which owns its own `<ul>`. A navigation with no section titles is one\n * untitled section, which is exactly what the React `sections` array is — and\n * it is also the only arrangement that keeps the list semantics honest, since\n * a `<ul>` here would be a list whose children were sections rather than\n * items.\n *\n * @slot - the `pf-nav-section` children.\n * @slot header - a box above the navigation, such as a product switcher.\n * @slot footer - a box below it, pushed to the bottom.\n * @part header - the header's box.\n * @part nav - the navigation landmark.\n * @part footer - the footer's box.\n */\n@Component({\n tag: 'pf-sidebar-navigation',\n styleUrl: 'pf-sidebar-navigation.css',\n shadow: true,\n})\nexport class PfSidebarNavigation {\n @Element() el!: HTMLElement;\n\n /** The navigation's accessible name. */\n @Prop() label = 'Sidebar navigation';\n\n /**\n * Whether anything was slotted into `header` and `footer`.\n *\n * Asked in JS: both boxes carry a border and padding, so an empty one draws\n * a rule across the sidebar for no reason, and a wrapper around a slot\n * cannot be collapsed from CSS. The same arrangement as\n * `pf-slideout-menu`'s footer.\n */\n @State() hasHeader = false;\n @State() hasFooter = false;\n\n /** The light DOM is readable here, so first paint is already right. */\n componentWillLoad() {\n this.sync();\n }\n\n componentDidLoad() {\n this.sync();\n }\n\n /**\n * A section's items moved, or an item's `current` changed. Either way the\n * resolution has to run again.\n *\n * `slotchange` is not composed, so this is the only way the navigation\n * hears about an item appended inside a section — and an item's `current`\n * arriving as a *property* fires no DOM event at all, which is why the item\n * emits this too. The event comes from a slotted child in the navigation's\n * own tree, so `event.target` is the section or the item rather than the\n * host — nothing is retargeted, which is what makes a host listener safe\n * here and not on a child in the shadow root.\n */\n @Listen('pfNavStructure')\n handleStructureChange(event: CustomEvent<void>) {\n event.stopPropagation();\n this.sync();\n }\n\n /**\n * Re-reads the items, for a consumer who changed something the group reads\n * and has no event for.\n */\n @Method()\n async refresh() {\n this.sync();\n }\n\n /**\n * Every item this navigation owns, in document order, however deeply a\n * section nests it — but not one belonging to a navigation nested inside\n * this one.\n */\n private get items(): HTMLElement[] {\n /*\n * The walk up is written out rather than done with `closest`, which would\n * need a comma selector the mock DOM may not take. The first navigation\n * above an item is the one that owns it, so a navigation nested inside\n * this one keeps its own.\n */\n const ownedByThis = (item: HTMLElement) => {\n for (let node = item.parentElement; node; node = node.parentElement) {\n const tag = node.tagName.toLowerCase();\n if (tag === 'pf-sidebar-navigation' || tag === 'pf-header-navigation') {\n return node === this.el;\n }\n }\n return false;\n };\n\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-nav-item')).filter(ownedByThis);\n }\n\n /**\n * The property if the item has upgraded, the attribute if it has not:\n * `componentWillLoad` can run before a child parsed from HTML upgrades.\n */\n private isCurrent(item: HTMLElement) {\n return (item as HTMLElement & { current?: boolean }).current ?? item.hasAttribute('current');\n }\n\n private sync() {\n const slotted = (name: string) =>\n Array.from(this.el.children).some((child) => child.getAttribute('slot') === name);\n\n this.hasHeader = slotted('header');\n this.hasFooter = slotted('footer');\n\n const items = this.items;\n const currentIndex = resolveCurrentNavItem(\n items.map((item) => ({ current: this.isCurrent(item) })),\n );\n\n for (const [index, item] of items.entries()) {\n const node = item as HTMLElement & { currentPage: boolean; orientation: string };\n node.currentPage = index === currentIndex;\n node.orientation = 'vertical';\n }\n }\n\n render() {\n return (\n <Host>\n <div class={{ header: true, empty: !this.hasHeader }} part=\"header\">\n <slot name=\"header\" onSlotchange={() => this.refresh()} />\n </div>\n\n <nav class=\"nav\" part=\"nav\" aria-label={this.label}>\n <slot onSlotchange={() => this.refresh()} />\n </nav>\n\n <div class={{ footer: true, empty: !this.hasFooter }} part=\"footer\">\n <slot name=\"footer\" onSlotchange={() => this.refresh()} />\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -200,7 +200,7 @@ export class PfSlideoutMenu {
200
200
  "references": {
201
201
  "PfSlideoutMenuPlacement": {
202
202
  "location": "local",
203
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-slideout-menu/pf-slideout-menu.tsx",
203
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-slideout-menu/pf-slideout-menu.tsx",
204
204
  "id": "src/components/pf-slideout-menu/pf-slideout-menu.tsx::PfSlideoutMenuPlacement"
205
205
  }
206
206
  }
@@ -226,7 +226,7 @@ export class PfSlideoutMenu {
226
226
  "references": {
227
227
  "PfSlideoutMenuSize": {
228
228
  "location": "local",
229
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-slideout-menu/pf-slideout-menu.tsx",
229
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-slideout-menu/pf-slideout-menu.tsx",
230
230
  "id": "src/components/pf-slideout-menu/pf-slideout-menu.tsx::PfSlideoutMenuSize"
231
231
  }
232
232
  }
@@ -1,6 +1,7 @@
1
1
  import { clampToRange, composeDescribedBy, getRangePercent, normalizeRange, } from "@pitchfork-ui/core";
2
2
  import { h, Host, } from "@stencil/core";
3
3
  import { applyControlValidity } from "../../form-validity";
4
+ import { controlAriaLabel } from "../../control-label";
4
5
  /**
5
6
  * A form-associated range slider.
6
7
  *
@@ -17,6 +18,7 @@ import { applyControlValidity } from "../../form-validity";
17
18
  * @part error - the error message below the control.
18
19
  */
19
20
  export class PfSlider {
21
+ el;
20
22
  internals;
21
23
  /**
22
24
  * Submitted under this name. Reflected, because a form-associated element
@@ -92,10 +94,10 @@ export class PfSlider {
92
94
  const { min, max, step } = this.range;
93
95
  const current = this.current;
94
96
  const describedBy = composeDescribedBy(this.description && 'description', this.error && 'error');
95
- return (h(Host, { key: 'aa9f73bc61fc164df6b960827337c57c89f3e041' }, h("div", { key: '6de203487f260a1025c2a49abeef29f3a9a1e250', class: "field", part: "field" }, (this.label || this.showValue) && (h("div", { key: 'c02c8be4fff2bb3eafbb45c8d19c777d79f984a4', class: "header", part: "header" }, this.label ? (h("label", { class: "label", part: "label", htmlFor: "input" }, this.label)) : (h("span", null)), this.showValue && (
97
+ return (h(Host, { key: '6d0718760dc214dbd200824c20417bfa51d49371' }, h("div", { key: 'cdfb094bb52dcc8b41fcd6fabf43a2057af644cf', class: "field", part: "field" }, (this.label || this.showValue) && (h("div", { key: '7278ee388367c3c5a33a837cd6f26e148ced2387', class: "header", part: "header" }, this.label ? (h("label", { class: "label", part: "label", htmlFor: "input" }, this.label)) : (h("span", null)), this.showValue && (
96
98
  // aria-hidden: the input already reports its value to
97
99
  // assistive technology through the range role.
98
- h("span", { key: '6638b3e9b626493e92c4dd76428a0ba2637956d6', class: "value", part: "value", "aria-hidden": "true" }, Math.round(current))))), h("input", { key: '03a97800d5dabc7d17e6f1cd91b9884485cafb42', id: "input", part: "input", class: { slider: true, 'slider--invalid': Boolean(this.error) }, type: "range", name: this.name, value: `${current}`, min: `${min}`, max: `${max}`, step: `${step}`, disabled: this.disabled, "aria-invalid": this.error ? 'true' : null, "aria-describedby": describedBy, onInput: this.onInput, onChange: this.onChange, style: { '--pf-slider-progress': `${getRangePercent(current, min, max)}%` } }), this.description && (h("p", { key: '0338224959bff19c234bfe07b8bf83027d85b17d', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: 'f469ebcbb86d81d933c0b66f578f8990d2a4b9a5', class: "error", part: "error", id: "error" }, this.error)))));
100
+ h("span", { key: 'f23e6b6e4db255a1f3e74785a07d185c64b89a62', class: "value", part: "value", "aria-hidden": "true" }, Math.round(current))))), h("input", { key: '8287d9fe81179e731ff30855f7e3d644ca7874ca', id: "input", "aria-label": controlAriaLabel(this.el, this.label), part: "input", class: { slider: true, 'slider--invalid': Boolean(this.error) }, type: "range", name: this.name, value: `${current}`, min: `${min}`, max: `${max}`, step: `${step}`, disabled: this.disabled, "aria-invalid": this.error ? 'true' : null, "aria-describedby": describedBy, onInput: this.onInput, onChange: this.onChange, style: { '--pf-slider-progress': `${getRangePercent(current, min, max)}%` } }), this.description && (h("p", { key: '810b7f5aff7336fd9042b7e70a834d6a4a69e32e', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: 'a95ec2ba460bdce626df1e66b94b9d290b8d600d', class: "error", part: "error", id: "error" }, this.error)))));
99
101
  }
100
102
  static get is() { return "pf-slider"; }
101
103
  static get encapsulation() { return "shadow"; }
@@ -399,6 +401,7 @@ export class PfSlider {
399
401
  }
400
402
  };
401
403
  }
404
+ static get elementRef() { return "el"; }
402
405
  static get watchers() {
403
406
  return [{
404
407
  "propName": "value",
@@ -1 +1 @@
1
- {"version":3,"file":"pf-slider.js","sourceRoot":"","sources":["../../../src/components/pf-slider/pf-slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,SAAS,EACT,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AA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AAI,CACnB,0DAAG,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,aAAa,EAAC,EAAE,EAAC,aAAa,IACvD,IAAI,CAAC,WAAW,CACf,CACL;gBACA,IAAI,CAAC,KAAK,IAAI,CACb,0DAAG,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,IACrC,IAAI,CAAC,KAAK,CACT,CACL,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n clampToRange,\n composeDescribedBy,\n getRangePercent,\n normalizeRange,\n} from '@pitchfork-ui/core';\nimport {\n AttachInternals,\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\n\nimport { applyControlValidity } from '../../form-validity';\n\n/**\n * A form-associated range slider.\n *\n * A native `<input type=\"range\">`, as the React component is — the drag, the\n * keyboard stepping and the touch handling are all the browser's, and nothing\n * here reimplements them.\n *\n * @part field - the wrapper around header, control and messages.\n * @part header - the row holding the label and the readout.\n * @part label - the label element.\n * @part value - the numeric readout.\n * @part input - the native range input.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-slider',\n styleUrl: 'pf-slider.css',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n})\nexport class PfSlider {\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * Submitted under this name. Reflected, because a form-associated element\n * takes its submission name from the attribute, not this property.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** The control's value. */\n @Prop({ mutable: true }) value = 0;\n\n @Prop() min = 0;\n\n @Prop() max = 100;\n\n @Prop() step = 1;\n\n /** Visible label, rendered in the same root so `for` actually associates. */\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 /** Show the current value beside the label. Reflected for the stylesheet. */\n @Prop({ reflect: true }) showValue = true;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Fires as the user drags, like the native `input` event. */\n @Event() pfInput!: EventEmitter<{ value: number }>;\n\n /** Fires when the value is committed, like the native `change` event. */\n @Event() pfChange!: EventEmitter<{ value: number }>;\n\n /** The value a form reset restores, which is the initial attribute. */\n private initialValue = 0;\n\n componentWillLoad() {\n this.initialValue = this.value;\n this.syncFormState();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('min')\n @Watch('max')\n syncFormState() {\n this.internals.setFormValue(`${this.current}`);\n /*\n * A slider always has a value — it cannot be empty the way a text field\n * can — so `required` would never fail and the element does not offer it.\n * Only an explicit error can make this control invalid.\n */\n applyControlValidity(this.internals, true, false, this.error);\n }\n\n /** A form-associated custom element does not inherit this. */\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n /** As `checkValidity`, but also shows the browser's validation message. */\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n /** The message explaining why the control is invalid, or an empty string. */\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n /** A reset restores the value the control started with. */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n /** The bounds, with a non-finite or inverted range made drawable. */\n private get range() {\n return normalizeRange(Number(this.min), Number(this.max), Number(this.step));\n }\n\n /** The value as rendered: always inside the bounds. */\n private get current() {\n const { min, max } = this.range;\n return clampToRange(Number(this.value), min, max);\n }\n\n private onInput = (event: Event) => {\n this.value = Number((event.target as HTMLInputElement).value);\n this.pfInput.emit({ value: this.value });\n };\n\n private onChange = () => {\n this.pfChange.emit({ value: this.current });\n };\n\n render() {\n const { min, max, step } = this.range;\n const current = this.current;\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {(this.label || this.showValue) && (\n <div class=\"header\" part=\"header\">\n {this.label ? (\n <label class=\"label\" part=\"label\" htmlFor=\"input\">\n {this.label}\n </label>\n ) : (\n <span />\n )}\n {this.showValue && (\n // aria-hidden: the input already reports its value to\n // assistive technology through the range role.\n <span class=\"value\" part=\"value\" aria-hidden=\"true\">\n {Math.round(current)}\n </span>\n )}\n </div>\n )}\n\n <input\n id=\"input\"\n part=\"input\"\n class={{ slider: true, 'slider--invalid': Boolean(this.error) }}\n type=\"range\"\n name={this.name}\n value={`${current}`}\n min={`${min}`}\n max={`${max}`}\n step={`${step}`}\n disabled={this.disabled}\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={describedBy}\n onInput={this.onInput}\n onChange={this.onChange}\n style={{ '--pf-slider-progress': `${getRangePercent(current, min, max)}%` }}\n />\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 </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pf-slider.js","sourceRoot":"","sources":["../../../src/components/pf-slider/pf-slider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBA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,EAAE,sBAAsB,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAC3E;gBAED,IAAI,CAAC,WAAW,IAAI,CACnB,0DAAG,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,aAAa,EAAC,EAAE,EAAC,aAAa,IACvD,IAAI,CAAC,WAAW,CACf,CACL;gBACA,IAAI,CAAC,KAAK,IAAI,CACb,0DAAG,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,IACrC,IAAI,CAAC,KAAK,CACT,CACL,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n clampToRange,\n composeDescribedBy,\n getRangePercent,\n normalizeRange,\n} from '@pitchfork-ui/core';\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\nimport { applyControlValidity } from '../../form-validity';\nimport { controlAriaLabel } from '../../control-label';\n\n/**\n * A form-associated range slider.\n *\n * A native `<input type=\"range\">`, as the React component is — the drag, the\n * keyboard stepping and the touch handling are all the browser's, and nothing\n * here reimplements them.\n *\n * @part field - the wrapper around header, control and messages.\n * @part header - the row holding the label and the readout.\n * @part label - the label element.\n * @part value - the numeric readout.\n * @part input - the native range input.\n * @part description - the hint text below the control.\n * @part error - the error message below the control.\n */\n@Component({\n tag: 'pf-slider',\n styleUrl: 'pf-slider.css',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n})\nexport class PfSlider {\n @Element() el!: HTMLElement;\n\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * Submitted under this name. Reflected, because a form-associated element\n * takes its submission name from the attribute, not this property.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** The control's value. */\n @Prop({ mutable: true }) value = 0;\n\n @Prop() min = 0;\n\n @Prop() max = 100;\n\n @Prop() step = 1;\n\n /** Visible label, rendered in the same root so `for` actually associates. */\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 /** Show the current value beside the label. Reflected for the stylesheet. */\n @Prop({ reflect: true }) showValue = true;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Fires as the user drags, like the native `input` event. */\n @Event() pfInput!: EventEmitter<{ value: number }>;\n\n /** Fires when the value is committed, like the native `change` event. */\n @Event() pfChange!: EventEmitter<{ value: number }>;\n\n /** The value a form reset restores, which is the initial attribute. */\n private initialValue = 0;\n\n componentWillLoad() {\n this.initialValue = this.value;\n this.syncFormState();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('min')\n @Watch('max')\n syncFormState() {\n this.internals.setFormValue(`${this.current}`);\n /*\n * A slider always has a value — it cannot be empty the way a text field\n * can — so `required` would never fail and the element does not offer it.\n * Only an explicit error can make this control invalid.\n */\n applyControlValidity(this.internals, true, false, this.error);\n }\n\n /** A form-associated custom element does not inherit this. */\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n /** As `checkValidity`, but also shows the browser's validation message. */\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n /** The message explaining why the control is invalid, or an empty string. */\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n /** A reset restores the value the control started with. */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n /** The bounds, with a non-finite or inverted range made drawable. */\n private get range() {\n return normalizeRange(Number(this.min), Number(this.max), Number(this.step));\n }\n\n /** The value as rendered: always inside the bounds. */\n private get current() {\n const { min, max } = this.range;\n return clampToRange(Number(this.value), min, max);\n }\n\n private onInput = (event: Event) => {\n this.value = Number((event.target as HTMLInputElement).value);\n this.pfInput.emit({ value: this.value });\n };\n\n private onChange = () => {\n this.pfChange.emit({ value: this.current });\n };\n\n render() {\n const { min, max, step } = this.range;\n const current = this.current;\n const describedBy = composeDescribedBy(\n this.description && 'description',\n this.error && 'error',\n );\n\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n {(this.label || this.showValue) && (\n <div class=\"header\" part=\"header\">\n {this.label ? (\n <label class=\"label\" part=\"label\" htmlFor=\"input\">\n {this.label}\n </label>\n ) : (\n <span />\n )}\n {this.showValue && (\n // aria-hidden: the input already reports its value to\n // assistive technology through the range role.\n <span class=\"value\" part=\"value\" aria-hidden=\"true\">\n {Math.round(current)}\n </span>\n )}\n </div>\n )}\n\n <input\n id=\"input\"\n aria-label={controlAriaLabel(this.el, this.label)}\n part=\"input\"\n class={{ slider: true, 'slider--invalid': Boolean(this.error) }}\n type=\"range\"\n name={this.name}\n value={`${current}`}\n min={`${min}`}\n max={`${max}`}\n step={`${step}`}\n disabled={this.disabled}\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={describedBy}\n onInput={this.onInput}\n onChange={this.onChange}\n style={{ '--pf-slider-progress': `${getRangePercent(current, min, max)}%` }}\n />\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 </Host>\n );\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { h, Host, } from "@stencil/core";
2
2
  import { applyControlValidity } from "../../form-validity";
3
+ import { controlAriaLabel } from "../../control-label";
3
4
  /**
4
5
  * A form-associated on/off switch.
5
6
  *
@@ -13,6 +14,7 @@ import { applyControlValidity } from "../../form-validity";
13
14
  * @part label - the label element.
14
15
  */
15
16
  export class PfSwitch {
17
+ el;
16
18
  internals;
17
19
  /**
18
20
  * Submitted under this name.
@@ -79,7 +81,7 @@ export class PfSwitch {
79
81
  this.pfChange.emit({ checked: this.checked, value: this.value });
80
82
  };
81
83
  render() {
82
- return (h(Host, { key: '2b1d5bf745c871e8633aa562ef6aa619d77b27bd' }, h("div", { key: 'ce5a586351ff1ac9d64f446a991365085f185a2e', class: "field", part: "field" }, h("input", { key: '5596a0b34fc5f91435da841b5196db5221090be4', id: "input", part: "input", class: "input", type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, "aria-invalid": this.error ? 'true' : null, "aria-describedby": this.error ? 'error' : null, onChange: this.onChange }), this.label && (h("label", { key: '59741e6dcbe31fbaf0df1ea730800ef1b5b79622', class: "label", part: "label", htmlFor: "input" }, this.label))), this.error && (h("p", { key: 'e1278052a8546bae276ed0eff2d74a1ccee06176', class: "error", part: "error", id: "error" }, this.error))));
84
+ return (h(Host, { key: '4c521d4d2e26f0adf9542c8eb490fedf78b6361a' }, h("div", { key: '3d7dcdfd665db7435e49b1ad93518b380d63c52e', class: "field", part: "field" }, h("input", { key: '936c2972a1249d1bfd5aeac3fc4e590e51360487', id: "input", "aria-label": controlAriaLabel(this.el, this.label), part: "input", class: "input", type: "checkbox", role: "switch", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, "aria-invalid": this.error ? 'true' : null, "aria-describedby": this.error ? 'error' : null, onChange: this.onChange }), this.label && (h("label", { key: '90aad05c07c0a81c785de9aad998c876b3f4ae21', class: "label", part: "label", htmlFor: "input" }, this.label))), this.error && (h("p", { key: 'd2904bfb254bb2ae9699c50e6ab4fe150beb98e8', class: "error", part: "error", id: "error" }, this.error))));
83
85
  }
84
86
  static get is() { return "pf-switch"; }
85
87
  static get encapsulation() { return "shadow"; }
@@ -309,6 +311,7 @@ export class PfSwitch {
309
311
  }
310
312
  };
311
313
  }
314
+ static get elementRef() { return "el"; }
312
315
  static get watchers() {
313
316
  return [{
314
317
  "propName": "checked",
@@ -1 +1 @@
1
- {"version":3,"file":"pf-switch.js","sourceRoot":"","sources":["../../../src/components/pf-switch/pf-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EACT,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;;;GAWG;AAOH,MAAM,OAAO,QAAQ;IACA,SAAS,CAAoB;IAEhD;;;;;;;;OAQG;IACsB,IAAI,CAAU;IAEvC,8EAA8E;IACtC,OAAO,GAAG,KAAK,CAAC;IAExD;;;OAGG;IACK,KAAK,GAAG,IAAI,CAAC;IAErB,6EAA6E;IACrE,KAAK,CAAU;IAEvB,qEAAqE;IAC7D,KAAK,CAAU;IAEE,QAAQ,GAAG,KAAK,CAAC;IAEjB,QAAQ,GAAG,KAAK,CAAC;IAE1C,sDAAsD;IAC7C,QAAQ,CAAqD;IAEtE,uEAAuE;IAC/D,cAAc,GAAG,KAAK,CAAC;IAE/B,iBAAiB;QACf,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAMD,aAAa;QACX;;;;;WAKG;QACH,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9D,oBAAoB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAChF,CAAC;IAED,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E,IAAI,CAAC,QAAQ,GACvB;gBACD,IAAI,CAAC,KAAK,IAAI,CACb,8DAAO,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,IAC9C,IAAI,CAAC,KAAK,CACL,CACT,CACG;YACL,IAAI,CAAC,KAAK,IAAI,CACb,0DAAG,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,IACrC,IAAI,CAAC,KAAK,CACT,CACL,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n AttachInternals,\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\n\nimport { applyControlValidity } from '../../form-validity';\n\n/**\n * A form-associated on/off switch.\n *\n * Built on a native checkbox with `role=\"switch\"`, exactly as the React\n * component is: a switch is a checkbox whose two states are \"on\" and \"off\"\n * rather than \"selected\" and \"not selected\", and the role is the only\n * difference assistive technology needs.\n *\n * @part field - the wrapper around control and label.\n * @part input - the native checkbox carrying role=\"switch\".\n * @part label - the label element.\n */\n@Component({\n tag: 'pf-switch',\n styleUrl: 'pf-switch.css',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n})\nexport class PfSwitch {\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * Submitted under this name.\n *\n * Reflected, because a form-associated custom element takes its submission\n * name from the `name` *content attribute* -- not from this property. A\n * framework wrapper that sets properties rather than attributes (the\n * generated React bindings do) would otherwise leave the control nameless\n * and absent from the submission, with every other sign of working.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** Whether the switch is on. Reflected so the stylesheet can select on it. */\n @Prop({ mutable: true, reflect: true }) checked = false;\n\n /**\n * What is submitted when on. Mirrors the native attribute, whose default is\n * also `on` — a checkbox with no value still submits something.\n */\n @Prop() value = 'on';\n\n /** Visible label, rendered in the same root so `for` actually associates. */\n @Prop() label?: string;\n\n /** Error message. Its presence is what marks the control invalid. */\n @Prop() error?: string;\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Fires when the user turns the switch on or off. */\n @Event() pfChange!: EventEmitter<{ checked: boolean; value: string }>;\n\n /** The state a form reset restores, which is the initial attribute. */\n private initialChecked = false;\n\n componentWillLoad() {\n this.initialChecked = this.checked;\n this.syncFormState();\n }\n\n @Watch('checked')\n @Watch('error')\n @Watch('required')\n @Watch('value')\n syncFormState() {\n /*\n * `null`, not an empty string, when off: an unchecked checkbox is\n * absent from the submission entirely, rather than present and empty.\n * That is what a server distinguishing \"unticked\" from \"not sent\" relies\n * on, and it is what a native checkbox does.\n */\n this.internals.setFormValue(this.checked ? this.value : null);\n applyControlValidity(this.internals, this.checked, this.required, this.error);\n }\n\n /** A form-associated custom element does not inherit this. */\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n /** As `checkValidity`, but also shows the browser's validation message. */\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n /** The message explaining why the control is invalid, or an empty string. */\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n /**\n * A reset restores the initial state, not `false` — a native\n * `<input type=checkbox checked>` comes back on.\n */\n formResetCallback() {\n this.checked = this.initialChecked;\n }\n\n private onChange = (event: Event) => {\n this.checked = (event.target as HTMLInputElement).checked;\n this.pfChange.emit({ checked: this.checked, value: this.value });\n };\n\n render() {\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n <input\n id=\"input\"\n part=\"input\"\n class=\"input\"\n type=\"checkbox\"\n role=\"switch\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={this.error ? 'error' : null}\n onChange={this.onChange}\n />\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"input\">\n {this.label}\n </label>\n )}\n </div>\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pf-switch.js","sourceRoot":"","sources":["../../../src/components/pf-switch/pf-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;GAWG;AAOH,MAAM,OAAO,QAAQ;IACR,EAAE,CAAe;IAET,SAAS,CAAoB;IAEhD;;;;;;;;OAQG;IACsB,IAAI,CAAU;IAEvC,8EAA8E;IACtC,OAAO,GAAG,KAAK,CAAC;IAExD;;;OAGG;IACK,KAAK,GAAG,IAAI,CAAC;IAErB,6EAA6E;IACrE,KAAK,CAAU;IAEvB,qEAAqE;IAC7D,KAAK,CAAU;IAEE,QAAQ,GAAG,KAAK,CAAC;IAEjB,QAAQ,GAAG,KAAK,CAAC;IAE1C,sDAAsD;IAC7C,QAAQ,CAAqD;IAEtE,uEAAuE;IAC/D,cAAc,GAAG,KAAK,CAAC;IAE/B,iBAAiB;QACf,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAMD,aAAa;QACX;;;;;WAKG;QACH,IAAI,CA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IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,kBACT,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,sBACtB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAC7C,QAAQ,EAAE,IAAI,CAAC,QAAQ,GACvB;gBACD,IAAI,CAAC,KAAK,IAAI,CACb,8DAAO,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,IAC9C,IAAI,CAAC,KAAK,CACL,CACT,CACG;YACL,IAAI,CAAC,KAAK,IAAI,CACb,0DAAG,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,IACrC,IAAI,CAAC,KAAK,CACT,CACL,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\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\nimport { applyControlValidity } from '../../form-validity';\nimport { controlAriaLabel } from '../../control-label';\n\n/**\n * A form-associated on/off switch.\n *\n * Built on a native checkbox with `role=\"switch\"`, exactly as the React\n * component is: a switch is a checkbox whose two states are \"on\" and \"off\"\n * rather than \"selected\" and \"not selected\", and the role is the only\n * difference assistive technology needs.\n *\n * @part field - the wrapper around control and label.\n * @part input - the native checkbox carrying role=\"switch\".\n * @part label - the label element.\n */\n@Component({\n tag: 'pf-switch',\n styleUrl: 'pf-switch.css',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n})\nexport class PfSwitch {\n @Element() el!: HTMLElement;\n\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * Submitted under this name.\n *\n * Reflected, because a form-associated custom element takes its submission\n * name from the `name` *content attribute* -- not from this property. A\n * framework wrapper that sets properties rather than attributes (the\n * generated React bindings do) would otherwise leave the control nameless\n * and absent from the submission, with every other sign of working.\n */\n @Prop({ reflect: true }) name?: string;\n\n /** Whether the switch is on. Reflected so the stylesheet can select on it. */\n @Prop({ mutable: true, reflect: true }) checked = false;\n\n /**\n * What is submitted when on. Mirrors the native attribute, whose default is\n * also `on` — a checkbox with no value still submits something.\n */\n @Prop() value = 'on';\n\n /** Visible label, rendered in the same root so `for` actually associates. */\n @Prop() label?: string;\n\n /** Error message. Its presence is what marks the control invalid. */\n @Prop() error?: string;\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Fires when the user turns the switch on or off. */\n @Event() pfChange!: EventEmitter<{ checked: boolean; value: string }>;\n\n /** The state a form reset restores, which is the initial attribute. */\n private initialChecked = false;\n\n componentWillLoad() {\n this.initialChecked = this.checked;\n this.syncFormState();\n }\n\n @Watch('checked')\n @Watch('error')\n @Watch('required')\n @Watch('value')\n syncFormState() {\n /*\n * `null`, not an empty string, when off: an unchecked checkbox is\n * absent from the submission entirely, rather than present and empty.\n * That is what a server distinguishing \"unticked\" from \"not sent\" relies\n * on, and it is what a native checkbox does.\n */\n this.internals.setFormValue(this.checked ? this.value : null);\n applyControlValidity(this.internals, this.checked, this.required, this.error);\n }\n\n /** A form-associated custom element does not inherit this. */\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n /** As `checkValidity`, but also shows the browser's validation message. */\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n /** The message explaining why the control is invalid, or an empty string. */\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n /**\n * A reset restores the initial state, not `false` — a native\n * `<input type=checkbox checked>` comes back on.\n */\n formResetCallback() {\n this.checked = this.initialChecked;\n }\n\n private onChange = (event: Event) => {\n this.checked = (event.target as HTMLInputElement).checked;\n this.pfChange.emit({ checked: this.checked, value: this.value });\n };\n\n render() {\n return (\n <Host>\n <div class=\"field\" part=\"field\">\n <input\n id=\"input\"\n aria-label={controlAriaLabel(this.el, this.label)}\n part=\"input\"\n class=\"input\"\n type=\"checkbox\"\n role=\"switch\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={this.error ? 'error' : null}\n onChange={this.onChange}\n />\n {this.label && (\n <label class=\"label\" part=\"label\" htmlFor=\"input\">\n {this.label}\n </label>\n )}\n </div>\n {this.error && (\n <p class=\"error\" part=\"error\" id=\"error\">\n {this.error}\n </p>\n )}\n </Host>\n );\n }\n}\n"]}
@@ -272,7 +272,7 @@ export class PfTab {
272
272
  "references": {
273
273
  "PfTabPlacement": {
274
274
  "location": "local",
275
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-tab/pf-tab.tsx",
275
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-tab/pf-tab.tsx",
276
276
  "id": "src/components/pf-tab/pf-tab.tsx::PfTabPlacement"
277
277
  }
278
278
  }
@@ -317,7 +317,7 @@ export class PfTab {
317
317
  "references": {
318
318
  "PfTabPlacement": {
319
319
  "location": "local",
320
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-tab/pf-tab.tsx",
320
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-tab/pf-tab.tsx",
321
321
  "id": "src/components/pf-tab/pf-tab.tsx::PfTabPlacement"
322
322
  }
323
323
  }
@@ -107,7 +107,7 @@ export class PfTableCell {
107
107
  "references": {
108
108
  "PfTableCellAlign": {
109
109
  "location": "local",
110
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-table-cell/pf-table-cell.tsx",
110
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-table-cell/pf-table-cell.tsx",
111
111
  "id": "src/components/pf-table-cell/pf-table-cell.tsx::PfTableCellAlign"
112
112
  }
113
113
  }
@@ -360,7 +360,7 @@ export class PfTabs {
360
360
  "references": {
361
361
  "PfTabsVariant": {
362
362
  "location": "local",
363
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-tabs/pf-tabs.tsx",
363
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-tabs/pf-tabs.tsx",
364
364
  "id": "src/components/pf-tabs/pf-tabs.tsx::PfTabsVariant"
365
365
  }
366
366
  }
@@ -386,7 +386,7 @@ export class PfTabs {
386
386
  "references": {
387
387
  "PfTabsSize": {
388
388
  "location": "local",
389
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-tabs/pf-tabs.tsx",
389
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-tabs/pf-tabs.tsx",
390
390
  "id": "src/components/pf-tabs/pf-tabs.tsx::PfTabsSize"
391
391
  }
392
392
  }
@@ -47,7 +47,7 @@ export class PfTag {
47
47
  "references": {
48
48
  "PfTagVariant": {
49
49
  "location": "local",
50
- "path": "/Users/lelandrangel/Development/lelandrangel.com/pitchfork-ui/packages/elements/src/components/pf-tag/pf-tag.tsx",
50
+ "path": "/home/runner/work/pitchfork-ui/pitchfork-ui/packages/elements/src/components/pf-tag/pf-tag.tsx",
51
51
  "id": "src/components/pf-tag/pf-tag.tsx::PfTagVariant"
52
52
  }
53
53
  }
@@ -1,5 +1,6 @@
1
1
  import { addTag, composeDescribedBy, formatValueList, Keys, parseValueList, removeTagAt, splitPastedTags, } from "@pitchfork-ui/core";
2
2
  import { applyControlValidity } from "../../form-validity";
3
+ import { controlAriaLabel } from "../../control-label";
3
4
  import { h, Host, } from "@stencil/core";
4
5
  /**
5
6
  * A form-associated field that collects free-text tags.
@@ -176,12 +177,12 @@ export class PfTagInput {
176
177
  const describedBy = composeDescribedBy(this.description && 'description', this.error && 'error');
177
178
  const tags = this.tags();
178
179
  const atMax = this.max !== undefined && tags.length >= this.max;
179
- return (h(Host, { key: '57924b0d046c1abc64450b0a70b3ed6edfbdf9f4' }, h("div", { key: '08d98d4400774b3e90881cafdf70580fcf79cce2', class: "field", part: "field" }, this.label && (h("label", { key: '4964890c0aefbd1a81af8344d3a74c8ab32dde37', class: "label", part: "label", htmlFor: "input" }, this.label, this.required && (h("span", { key: '921369e87d6cc0af07bdc791defb816207cc3dc0', class: "required", "aria-hidden": "true" }, "*")))), h("div", { key: 'ec4d7fad20d686473bc9c5f56c9b0c0f69b5f0f5', class: { control: true, 'control--invalid': Boolean(this.error) }, part: "control" }, tags.map((tag, index) => (h("pf-tag", { key: tag, part: "tag", variant: this.tagVariant, dismissible: !this.disabled, dismissLabel: `Remove ${tag}`, onPfDismiss: () => this.remove(index) }, tag))), h("input", { key: '1e065f32bb9e13cac1dcfa29c03e516aa5d785bb', id: "input", part: "input", class: "input", type: "text", autocomplete: "off", disabled: this.disabled || atMax, required: this.required && tags.length === 0, placeholder: atMax ? '' : this.placeholder, "aria-invalid": this.error ? 'true' : null, "aria-describedby": describedBy, onKeyDown: this.onKeyDown, onPaste: this.onPaste, onBlur: (event) => {
180
+ return (h(Host, { key: 'fcd65f00fd3c83168d4aa60792eb082f2f34846b' }, h("div", { key: '9d2660af1fd754840ec49eb1a8d4882e5fd1fc34', class: "field", part: "field" }, this.label && (h("label", { key: '4bce4bfd9258b72f95dc038be8ad8a34f0684c0c', class: "label", part: "label", htmlFor: "input" }, this.label, this.required && (h("span", { key: '9c82d014c88b2d5fd4cbd8be60c1a98834baa8a9', class: "required", "aria-hidden": "true" }, "*")))), h("div", { key: 'df92aae8117828f5bd11b7f09aaf64b4c19cefa5', class: { control: true, 'control--invalid': Boolean(this.error) }, part: "control" }, tags.map((tag, index) => (h("pf-tag", { key: tag, part: "tag", variant: this.tagVariant, dismissible: !this.disabled, dismissLabel: `Remove ${tag}`, onPfDismiss: () => this.remove(index) }, tag))), h("input", { key: 'e606fa3fd879dcef2e878e5311b601c4e46860c3', id: "input", "aria-label": controlAriaLabel(this.el, this.label), part: "input", class: "input", type: "text", autocomplete: "off", disabled: this.disabled || atMax, required: this.required && tags.length === 0, placeholder: atMax ? '' : this.placeholder, "aria-invalid": this.error ? 'true' : null, "aria-describedby": describedBy, onKeyDown: this.onKeyDown, onPaste: this.onPaste, onBlur: (event) => {
180
181
  // Commit on blur, so a typed tag is not lost by clicking away.
181
182
  const field = event.target;
182
183
  if (field.value.trim())
183
184
  this.addDraft(field.value);
184
- } })), this.description && (h("p", { key: '96700116a9bf9d23869c48bc1f0f1c23229a0813', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: 'd846511a00c7e03a4fb5b8be25b01723c742e912', class: "error", part: "error", id: "error" }, this.error)))));
185
+ } })), this.description && (h("p", { key: '099590e7e19084d8aaaf595bb280ac61118c5a6e', class: "description", part: "description", id: "description" }, this.description)), this.error && (h("p", { key: '0ab0b8ebc4e94ce1eed0ea57747c3c0b21d7d174', class: "error", part: "error", id: "error" }, this.error)))));
185
186
  }
186
187
  static get is() { return "pf-tag-input"; }
187
188
  static get encapsulation() { return "shadow"; }