@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,2 +1,2 @@
1
- import{t as e,p as a,H as t,h as n,a as s}from"./index.js";import{r}from"./p-DToIJg5W.js";const i=()=>`:host{background:var(--pf-header-nav-bg);border:1px solid var(--pf-header-nav-border);border-radius:var(--pf-header-nav-radius, var(--radius-md));display:block;width:100%;--pf-nav-item-text:var(--pf-header-nav-text-muted);--pf-nav-item-hover-text:var(--pf-header-nav-text);--pf-nav-item-hover-bg:var(--pf-header-nav-bg-subtle);--pf-nav-item-current-text:var(--pf-header-nav-text);--pf-nav-item-current-bg:var(--pf-header-nav-bg-subtle)}:host([hidden]){display:none}.nav{align-items:center;display:grid;gap:var(--space-3);grid-template-columns:1fr;min-height:var(--pf-header-nav-min-height, 56px);padding:var(--space-3)}@media (min-width: 768px){.nav{grid-template-columns:auto 1fr auto;padding:0 var(--space-4)}}.brand{color:var(--pf-header-nav-text);font-size:var(--font-size-md);font-weight:var(--font-weight-semibold);white-space:nowrap}.list{align-items:center;display:flex;gap:var(--space-1);list-style:none;margin:0;overflow-x:auto;padding:0}.list slot{display:contents}.actions{align-items:center;display:inline-flex;gap:var(--space-2)}.brand.empty,.actions.empty{display:none}`;const o=a(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}get el(){return this}label="Header navigation";hasBrand=false;hasActions=false;componentWillLoad(){this.sync()}componentDidLoad(){this.sync()}async refresh(){this.sync()}get items(){return Array.from(this.el.querySelectorAll("pf-nav-item")).filter((e=>e.parentElement===this.el))}isCurrent(e){return e.current??e.hasAttribute("current")}sync(){const e=e=>Array.from(this.el.children).some((a=>a.getAttribute("slot")===e));this.hasBrand=e("brand");this.hasActions=e("actions");const a=this.items;const t=r(a.map((e=>({current:this.isCurrent(e)}))));for(const[e,n]of a.entries()){const a=n;a.currentPage=e===t;a.orientation="horizontal"}}render(){return n(s,{key:"2b0c0031fc8225b1b3d87cf91c06a84138840dca"},n("nav",{key:"196a2e3faf81b1b831683ae4e422beedeeef1af6",class:"nav",part:"nav","aria-label":this.label},n("span",{key:"a99fb70cb2763fd865f1d39290632952d1f27fbb",class:{brand:true,empty:!this.hasBrand},part:"brand"},n("slot",{key:"e9d3eb13fd19f1265b3caed47e082331414e47f9",name:"brand",onSlotchange:()=>this.refresh()})),n("ul",{key:"c03966d2083df04e560b2151d89694755276aea2",class:"list",part:"list"},n("slot",{key:"754a8d4910efc0aee658ea4c01e392f2a2f91178",onSlotchange:()=>this.refresh()})),n("span",{key:"bee95bd441bb2bac3ef88ce5ca40ea07989adba4",class:{actions:true,empty:!this.hasActions},part:"actions"},n("slot",{key:"a5a75d6aa8ff4736d32a6ddd9535c34c629ee524",name:"actions",onSlotchange:()=>this.refresh()}))))}static get style(){return i()}},[769,"pf-header-navigation",{label:[1],hasBrand:[32],hasActions:[32],refresh:[64]}]);function d(){if(typeof customElements==="undefined"){return}const a=["pf-header-navigation"];a.forEach((a=>{switch(a){case"pf-header-navigation":if(!customElements.get(e(a))){customElements.define(e(a),o)}break}}))}d();const c=o;const f=d;export{c as PfHeaderNavigation,f as defineCustomElement};
1
+ import{t as a,p as e,H as t,h as n,a as s}from"./index.js";import{r}from"./p-DToIJg5W.js";const i=()=>`:host{background:var(--pf-header-nav-bg);border:1px solid var(--pf-header-nav-border);border-radius:var(--pf-header-nav-radius, var(--radius-md));display:block;width:100%;--pf-nav-item-text:var(--pf-header-nav-text-muted);--pf-nav-item-hover-text:var(--pf-header-nav-text);--pf-nav-item-hover-bg:var(--pf-header-nav-bg-subtle);--pf-nav-item-current-text:var(--pf-header-nav-text);--pf-nav-item-current-bg:var(--pf-header-nav-bg-subtle)}:host([hidden]){display:none}.nav{align-items:center;display:grid;gap:var(--space-3);grid-template-columns:1fr;min-height:var(--pf-header-nav-min-height, 56px);padding:var(--space-3)}@media (min-width: 768px){.nav{grid-template-columns:auto 1fr auto;padding:0 var(--space-4)}}.brand{color:var(--pf-header-nav-text);font-size:var(--font-size-md);font-weight:var(--font-weight-semibold);white-space:nowrap}.list{align-items:center;display:flex;gap:var(--space-1);list-style:none;margin:0;overflow-x:auto;padding:0}.list slot{display:contents}.actions{align-items:center;display:inline-flex;gap:var(--space-2)}.brand.empty,.actions.empty{display:none}`;const o=e(class a extends t{constructor(a){super();if(a!==false){this.__registerHost()}this.__attachShadow()}get el(){return this}label="Header navigation";hasBrand=false;hasActions=false;componentWillLoad(){this.sync()}componentDidLoad(){this.sync()}handleStructureChange(a){a.stopPropagation();this.sync()}async refresh(){this.sync()}get items(){return Array.from(this.el.querySelectorAll("pf-nav-item")).filter((a=>a.parentElement===this.el))}isCurrent(a){return a.current??a.hasAttribute("current")}sync(){const a=a=>Array.from(this.el.children).some((e=>e.getAttribute("slot")===a));this.hasBrand=a("brand");this.hasActions=a("actions");const e=this.items;const t=r(e.map((a=>({current:this.isCurrent(a)}))));for(const[a,n]of e.entries()){const e=n;e.currentPage=a===t;e.orientation="horizontal"}}render(){return n(s,{key:"f3f8c91ba9eab4755b1e5e96adc7245e630bd7fa"},n("nav",{key:"7984894e4bcc395140ef229f351bbc037efa565e",class:"nav",part:"nav","aria-label":this.label},n("span",{key:"fc21f987ab7f5ac3c74779157f70a23c5375cb27",class:{brand:true,empty:!this.hasBrand},part:"brand"},n("slot",{key:"bb68a3a686be890c522671f3d6a569f438275631",name:"brand",onSlotchange:()=>this.refresh()})),n("ul",{key:"43f0bb0d2d82497373ac74bfda26d9e2e545932e",class:"list",part:"list"},n("slot",{key:"30be86d24556bd3521642ee79195a2af6a8c70c9",onSlotchange:()=>this.refresh()})),n("span",{key:"687115f0db5bb7f35a82bb1b5dd79234a0049c99",class:{actions:true,empty:!this.hasActions},part:"actions"},n("slot",{key:"f11f998414c8a424d64ddf759369a31b9ddbd0bb",name:"actions",onSlotchange:()=>this.refresh()}))))}static get style(){return i()}},[769,"pf-header-navigation",{label:[1],hasBrand:[32],hasActions:[32],refresh:[64]},[[0,"pfNavStructure","handleStructureChange"]]]);function d(){if(typeof customElements==="undefined"){return}const e=["pf-header-navigation"];e.forEach((e=>{switch(e){case"pf-header-navigation":if(!customElements.get(a(e))){customElements.define(a(e),o)}break}}))}d();const c=o;const f=d;export{c as PfHeaderNavigation,f as defineCustomElement};
2
2
  //# sourceMappingURL=pf-header-navigation.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["pfHeaderNavigationCss","PfHeaderNavigation","__stencil_proxyCustomElement","HTMLElement","label","hasBrand","hasActions","componentWillLoad","this","sync","componentDidLoad","refresh","items","Array","from","el","querySelectorAll","filter","item","parentElement","isCurrent","current","hasAttribute","slotted","name","children","some","child","getAttribute","currentIndex","resolveCurrentNavItem","map","index","entries","node","currentPage","orientation","render","h","Host","key","class","part","brand","empty","onSlotchange","actions"],"sources":["src/components/pf-header-navigation/pf-header-navigation.css?tag=pf-header-navigation&encapsulation=shadow","src/components/pf-header-navigation/pf-header-navigation.tsx"],"sourcesContent":[":host {\n background: var(--pf-header-nav-bg);\n border: 1px solid var(--pf-header-nav-border);\n border-radius: var(--pf-header-nav-radius, var(--radius-md));\n display: block;\n width: 100%;\n\n /*\n * The bridge to the shared item: custom properties inherit through a shadow\n * boundary, so a slotted `pf-nav-item` resolves these inside its own shadow\n * root. It is how one element serves two navigations without\n * `:host-context`, which Firefox does not support.\n */\n --pf-nav-item-text: var(--pf-header-nav-text-muted);\n --pf-nav-item-hover-text: var(--pf-header-nav-text);\n --pf-nav-item-hover-bg: var(--pf-header-nav-bg-subtle);\n --pf-nav-item-current-text: var(--pf-header-nav-text);\n --pf-nav-item-current-bg: var(--pf-header-nav-bg-subtle);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n/* Mobile first: one column, the items wrapping under the brand. */\n.nav {\n align-items: center;\n display: grid;\n gap: var(--space-3);\n grid-template-columns: 1fr;\n min-height: var(--pf-header-nav-min-height, 56px);\n padding: var(--space-3);\n}\n\n@media (--md) {\n .nav {\n grid-template-columns: auto 1fr auto;\n padding: 0 var(--space-4);\n }\n}\n\n.brand {\n color: var(--pf-header-nav-text);\n font-size: var(--font-size-md);\n font-weight: var(--font-weight-semibold);\n white-space: nowrap;\n}\n\n.list {\n align-items: center;\n display: flex;\n gap: var(--space-1);\n list-style: none;\n margin: 0;\n overflow-x: auto;\n padding: 0;\n}\n\n/*\n * The items have to be flex children of the list, not of a box inside it. The\n * UA stylesheet already gives a slot `display: contents`; this says so out\n * loud.\n */\n.list slot {\n display: contents;\n}\n\n.actions {\n align-items: center;\n display: inline-flex;\n gap: var(--space-2);\n}\n\n/*\n * Both classes rather than a bare `.empty`, so the rule does not depend on\n * sitting below the `display` a box sets on itself: specificity ties break on\n * source order, and `.empty` losing that way is how a bare `pf-metric-card`\n * came to draw all three of its boxes.\n */\n.brand.empty,\n.actions.empty {\n display: none;\n}\n","import { resolveCurrentNavItem } from '@pitchfork-ui/core';\nimport { Component, Element, h, Host, Method, Prop, State } from '@stencil/core';\n\n/**\n * A header navigation over `pf-nav-item` children.\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 `HeaderNavigation` marks the same\n * one, and it is one index — which is what stops a navigation claiming two\n * current pages.\n *\n * The host is **not** a banner. The React component renders a `<header>`,\n * which is the banner landmark at the top level of a page, but an element\n * cannot know whether it is the page's header: a second banner is a defect,\n * not a decoration. So the shadow root renders only the `<nav>` landmark, and\n * a consumer who wants a banner puts this inside their own `<header>`.\n *\n * @slot - the `pf-nav-item` children.\n * @slot brand - a logo or product name, before the items.\n * @slot actions - controls after the items, such as a sign-in button.\n * @part nav - the navigation landmark.\n * @part brand - the brand's box.\n * @part list - the list the items are slotted into.\n * @part actions - the actions' box.\n */\n@Component({\n tag: 'pf-header-navigation',\n styleUrl: 'pf-header-navigation.css',\n shadow: true,\n})\nexport class PfHeaderNavigation {\n @Element() el!: HTMLElement;\n\n /** The navigation's accessible name. */\n @Prop() label = 'Header navigation';\n\n /**\n * Whether anything was slotted into `brand` and `actions`.\n *\n * Asked in JS because a wrapper around a slot cannot be collapsed from CSS\n * — `:not(:has(*))` never matches, since the `<slot>` is itself a child —\n * and these two boxes have to exist when they are used: they are grid\n * items, so an empty one still takes a column and a gap, which would push\n * every item along by one `--space-3` for no visible reason.\n */\n @State() hasBrand = false;\n @State() hasActions = 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 * 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 /** Direct children only: a nested navigation owns its own items. */\n private get items(): HTMLElement[] {\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-nav-item')).filter(\n (item) => item.parentElement === this.el,\n );\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 /*\n * The children are read one by one rather than with a `:scope >`\n * selector, which Stencil's mock DOM does not support at all — it throws\n * from jQuery's selector engine rather than returning nothing.\n */\n const slotted = (name: string) =>\n Array.from(this.el.children).some((child) => child.getAttribute('slot') === name);\n\n this.hasBrand = slotted('brand');\n this.hasActions = slotted('actions');\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 = 'horizontal';\n }\n }\n\n render() {\n return (\n <Host>\n <nav class=\"nav\" part=\"nav\" aria-label={this.label}>\n {/*\n The slots stay in the tree whether or not they hold anything: a\n slot that is not rendered never fires `slotchange`, so content\n added later would stay invisible for good. The box is hidden\n instead.\n */}\n <span class={{ brand: true, empty: !this.hasBrand }} part=\"brand\">\n <slot name=\"brand\" onSlotchange={() => this.refresh()} />\n </span>\n\n <ul class=\"list\" part=\"list\">\n <slot onSlotchange={() => this.refresh()} />\n </ul>\n\n <span class={{ actions: true, empty: !this.hasActions }} part=\"actions\">\n <slot name=\"actions\" onSlotchange={() => this.refresh()} />\n </span>\n </nav>\n </Host>\n );\n }\n}\n"],"mappings":"0FAAA,MAAMA,EAAwB,IAAM,+jC,MC8BvBC,EAAkBC,EAAA,MAAAD,UAAAE,E,sGAIrBC,MAAQ,oBAWPC,SAAW,MACXC,WAAa,MAGtB,iBAAAC,GACEC,KAAKC,M,CAGP,gBAAAC,GACEF,KAAKC,M,CAQP,aAAME,GACJH,KAAKC,M,CAIP,SAAYG,GACV,OAAOC,MAAMC,KAAKN,KAAKO,GAAGC,iBAA8B,gBAAgBC,QACrEC,GAASA,EAAKC,gBAAkBX,KAAKO,I,CAQlC,SAAAK,CAAUF,GAChB,OAAQA,EAA6CG,SAAWH,EAAKI,aAAa,U,CAG5E,IAAAb,GAMN,MAAMc,EAAWC,GACfX,MAAMC,KAAKN,KAAKO,GAAGU,UAAUC,MAAMC,GAAUA,EAAMC,aAAa,UAAYJ,IAE9EhB,KAAKH,SAAWkB,EAAQ,SACxBf,KAAKF,WAAaiB,EAAQ,WAE1B,MAAMX,EAAQJ,KAAKI,MACnB,MAAMiB,EAAeC,EACnBlB,EAAMmB,KAAKb,IAAI,CAAQG,QAASb,KAAKY,UAAUF,QAGjD,IAAK,MAAOc,EAAOd,KAASN,EAAMqB,UAAW,CAC3C,MAAMC,EAAOhB,EACbgB,EAAKC,YAAcH,IAAUH,EAC7BK,EAAKE,YAAc,Y,EAIvB,MAAAC,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,4CACHF,EAAA,OAAAE,IAAA,2CAAKC,MAAM,MAAMC,KAAK,MAAK,aAAalC,KAAKJ,OAO3CkC,EAAA,QAAAE,IAAA,2CAAMC,MAAO,CAAEE,MAAO,KAAMC,OAAQpC,KAAKH,UAAYqC,KAAK,SACxDJ,EAAA,QAAAE,IAAA,2CAAMhB,KAAK,QAAQqB,aAAc,IAAMrC,KAAKG,aAG9C2B,EAAA,MAAAE,IAAA,2CAAIC,MAAM,OAAOC,KAAK,QACpBJ,EAAA,QAAAE,IAAA,2CAAMK,aAAc,IAAMrC,KAAKG,aAGjC2B,EAAA,QAAAE,IAAA,2CAAMC,MAAO,CAAEK,QAAS,KAAMF,OAAQpC,KAAKF,YAAcoC,KAAK,WAC5DJ,EAAA,QAAAE,IAAA,2CAAMhB,KAAK,UAAUqB,aAAc,IAAMrC,KAAKG,c","ignoreList":[]}
1
+ {"version":3,"names":["pfHeaderNavigationCss","PfHeaderNavigation","__stencil_proxyCustomElement","HTMLElement","label","hasBrand","hasActions","componentWillLoad","this","sync","componentDidLoad","handleStructureChange","event","stopPropagation","refresh","items","Array","from","el","querySelectorAll","filter","item","parentElement","isCurrent","current","hasAttribute","slotted","name","children","some","child","getAttribute","currentIndex","resolveCurrentNavItem","map","index","entries","node","currentPage","orientation","render","h","Host","key","class","part","brand","empty","onSlotchange","actions"],"sources":["src/components/pf-header-navigation/pf-header-navigation.css?tag=pf-header-navigation&encapsulation=shadow","src/components/pf-header-navigation/pf-header-navigation.tsx"],"sourcesContent":[":host {\n background: var(--pf-header-nav-bg);\n border: 1px solid var(--pf-header-nav-border);\n border-radius: var(--pf-header-nav-radius, var(--radius-md));\n display: block;\n width: 100%;\n\n /*\n * The bridge to the shared item: custom properties inherit through a shadow\n * boundary, so a slotted `pf-nav-item` resolves these inside its own shadow\n * root. It is how one element serves two navigations without\n * `:host-context`, which Firefox does not support.\n */\n --pf-nav-item-text: var(--pf-header-nav-text-muted);\n --pf-nav-item-hover-text: var(--pf-header-nav-text);\n --pf-nav-item-hover-bg: var(--pf-header-nav-bg-subtle);\n --pf-nav-item-current-text: var(--pf-header-nav-text);\n --pf-nav-item-current-bg: var(--pf-header-nav-bg-subtle);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n/* Mobile first: one column, the items wrapping under the brand. */\n.nav {\n align-items: center;\n display: grid;\n gap: var(--space-3);\n grid-template-columns: 1fr;\n min-height: var(--pf-header-nav-min-height, 56px);\n padding: var(--space-3);\n}\n\n@media (--md) {\n .nav {\n grid-template-columns: auto 1fr auto;\n padding: 0 var(--space-4);\n }\n}\n\n.brand {\n color: var(--pf-header-nav-text);\n font-size: var(--font-size-md);\n font-weight: var(--font-weight-semibold);\n white-space: nowrap;\n}\n\n.list {\n align-items: center;\n display: flex;\n gap: var(--space-1);\n list-style: none;\n margin: 0;\n overflow-x: auto;\n padding: 0;\n}\n\n/*\n * The items have to be flex children of the list, not of a box inside it. The\n * UA stylesheet already gives a slot `display: contents`; this says so out\n * loud.\n */\n.list slot {\n display: contents;\n}\n\n.actions {\n align-items: center;\n display: inline-flex;\n gap: var(--space-2);\n}\n\n/*\n * Both classes rather than a bare `.empty`, so the rule does not depend on\n * sitting below the `display` a box sets on itself: specificity ties break on\n * source order, and `.empty` losing that way is how a bare `pf-metric-card`\n * came to draw all three of its boxes.\n */\n.brand.empty,\n.actions.empty {\n display: none;\n}\n","import { resolveCurrentNavItem } from '@pitchfork-ui/core';\nimport { Component, Element, h, Host, Listen, Method, Prop, State } from '@stencil/core';\n\n/**\n * A header navigation over `pf-nav-item` children.\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 `HeaderNavigation` marks the same\n * one, and it is one index — which is what stops a navigation claiming two\n * current pages.\n *\n * The host is **not** a banner. The React component renders a `<header>`,\n * which is the banner landmark at the top level of a page, but an element\n * cannot know whether it is the page's header: a second banner is a defect,\n * not a decoration. So the shadow root renders only the `<nav>` landmark, and\n * a consumer who wants a banner puts this inside their own `<header>`.\n *\n * @slot - the `pf-nav-item` children.\n * @slot brand - a logo or product name, before the items.\n * @slot actions - controls after the items, such as a sign-in button.\n * @part nav - the navigation landmark.\n * @part brand - the brand's box.\n * @part list - the list the items are slotted into.\n * @part actions - the actions' box.\n */\n@Component({\n tag: 'pf-header-navigation',\n styleUrl: 'pf-header-navigation.css',\n shadow: true,\n})\nexport class PfHeaderNavigation {\n @Element() el!: HTMLElement;\n\n /** The navigation's accessible name. */\n @Prop() label = 'Header navigation';\n\n /**\n * Whether anything was slotted into `brand` and `actions`.\n *\n * Asked in JS because a wrapper around a slot cannot be collapsed from CSS\n * — `:not(:has(*))` never matches, since the `<slot>` is itself a child —\n * and these two boxes have to exist when they are used: they are grid\n * items, so an empty one still takes a column and a gap, which would push\n * every item along by one `--space-3` for no visible reason.\n */\n @State() hasBrand = false;\n @State() hasActions = 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 * An item's `current` changed, so the resolution has to run again.\n *\n * The items are this navigation's own light-DOM children, so nothing is\n * retargeted and a host listener is safe — the same reason the sidebar can\n * listen for a section's copy of this event. `refresh()` stays for a\n * consumer who changes something else the group reads.\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 /** Direct children only: a nested navigation owns its own items. */\n private get items(): HTMLElement[] {\n return Array.from(this.el.querySelectorAll<HTMLElement>('pf-nav-item')).filter(\n (item) => item.parentElement === this.el,\n );\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 /*\n * The children are read one by one rather than with a `:scope >`\n * selector, which Stencil's mock DOM does not support at all — it throws\n * from jQuery's selector engine rather than returning nothing.\n */\n const slotted = (name: string) =>\n Array.from(this.el.children).some((child) => child.getAttribute('slot') === name);\n\n this.hasBrand = slotted('brand');\n this.hasActions = slotted('actions');\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 = 'horizontal';\n }\n }\n\n render() {\n return (\n <Host>\n <nav class=\"nav\" part=\"nav\" aria-label={this.label}>\n {/*\n The slots stay in the tree whether or not they hold anything: a\n slot that is not rendered never fires `slotchange`, so content\n added later would stay invisible for good. The box is hidden\n instead.\n */}\n <span class={{ brand: true, empty: !this.hasBrand }} part=\"brand\">\n <slot name=\"brand\" onSlotchange={() => this.refresh()} />\n </span>\n\n <ul class=\"list\" part=\"list\">\n <slot onSlotchange={() => this.refresh()} />\n </ul>\n\n <span class={{ actions: true, empty: !this.hasActions }} part=\"actions\">\n <slot name=\"actions\" onSlotchange={() => this.refresh()} />\n </span>\n </nav>\n </Host>\n );\n }\n}\n"],"mappings":"0FAAA,MAAMA,EAAwB,IAAM,+jC,MC8BvBC,EAAkBC,EAAA,MAAAD,UAAAE,E,sGAIrBC,MAAQ,oBAWPC,SAAW,MACXC,WAAa,MAGtB,iBAAAC,GACEC,KAAKC,M,CAGP,gBAAAC,GACEF,KAAKC,M,CAYP,qBAAAE,CAAsBC,GACpBA,EAAMC,kBACNL,KAAKC,M,CAQP,aAAMK,GACJN,KAAKC,M,CAIP,SAAYM,GACV,OAAO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./p-DfpCerXM.js";import{a as n}from"./p-Cr6IXrUk.js";const d=()=>`:host{display:block}:host([hidden]){display:none}.field{display:grid;gap:var(--space-2)}.label{color:var(--pf-input-field-label, var(--pf-field-label));font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}.required{color:var(--pf-field-required);margin-inline-start:var(--space-1)}.description{color:var(--pf-input-field-description, var(--pf-field-description));font-size:var(--font-size-sm);margin:0}.error{color:var(--pf-input-field-error, var(--pf-field-error));font-size:var(--font-size-sm);margin:0}.input{background:var(--pf-input-bg);border:1px solid var(--pf-input-border);border-radius:var(--radius-md);color:var(--pf-input-text);font:inherit;min-height:40px;padding:0 var(--space-3);width:100%;transition:background 0.2s, border 0.2s, color 0.2s, opacity 0.2s}.input:disabled{background:var(--pf-control-bg-disabled);border-color:var(--pf-control-border-disabled);color:var(--pf-control-text-disabled);cursor:not-allowed;opacity:0.6}.input:focus{outline:none}.input:focus-visible{border-color:var(--pf-input-focus-border);box-shadow:var(--pf-input-focus-ring, var(--pf-focus-ring))}.input::placeholder{color:var(--pf-input-placeholder)}.input--invalid{border-color:var(--pf-input-invalid-border)}@media (prefers-reduced-motion: reduce){.input{transition:none}}`;const l=t(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.pfInput=i(this,"pfInput");this.pfChange=i(this,"pfChange");this.internals=this.attachInternals()}internals;name;value="";type="text";label;description;error;placeholder;required=false;disabled=false;readonly=false;pfInput;pfChange;initialValue="";componentWillLoad(){this.initialValue=this.value??"";this.syncFormState()}syncFormState(){this.internals.setFormValue(this.value??"");n(this.internals,Boolean(this.value),this.required,this.error)}async checkValidity(){return this.internals.checkValidity()}async reportValidity(){return this.internals.reportValidity()}async getValidationMessage(){return this.internals.validationMessage}formResetCallback(){this.value=this.initialValue}onInput=e=>{this.value=e.target.value;this.pfInput.emit({value:this.value})};onChange=()=>{this.pfChange.emit({value:this.value})};render(){const e=o(this.description&&"description",this.error&&"error");return a(s,{key:"a6d68ce6641fb92407356c94e2181b280bdc03b6"},a("div",{key:"312ee69f4a661494548b01f598b74ed56bd443fc",class:"field",part:"field"},this.label&&a("label",{key:"59188fde6b3639105f8ade8b497c764ddd5d658f",class:"label",part:"label",htmlFor:"input"},this.label,this.required&&a("span",{key:"4f71679ec6bb99d3f7dc8f941d8c02bb94452c21",class:"required","aria-hidden":"true"},"*")),a("input",{key:"0680b0e5aa0f8ddf9850a212f735f0f8c5b273a3",id:"input",part:"input",class:{input:true,"input--invalid":Boolean(this.error)},type:this.type,name:this.name,value:this.value,placeholder:this.placeholder,required:this.required,disabled:this.disabled,readOnly:this.readonly,"aria-invalid":this.error?"true":null,"aria-describedby":e,onInput:this.onInput,onChange:this.onChange}),this.description&&a("p",{key:"f732742b8602ed6094600065d5036bdad538ad35",class:"description",part:"description",id:"description"},this.description),this.error&&a("p",{key:"9d524a204abfb733afaf2bf3cc5ec9a5e1c65b94",class:"error",part:"error",id:"error"},this.error)))}static get delegatesFocus(){return true}static get formAssociated(){return true}static get watchers(){return{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}}static get style(){return d()}},[593,"pf-input",{name:[513],value:[1025],type:[513],label:[1],description:[1],error:[1],placeholder:[1],required:[516],disabled:[516],readonly:[516],checkValidity:[64],reportValidity:[64],getValidationMessage:[64]},undefined,{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}]);function c(){if(typeof customElements==="undefined"){return}const t=["pf-input"];t.forEach((t=>{switch(t){case"pf-input":if(!customElements.get(e(t))){customElements.define(e(t),l)}break}}))}c();const p=l;const f=c;export{p as PfInput,f as defineCustomElement};
1
+ import{t as e,p as t,H as r,c as i,h as a,a as s}from"./index.js";import{c as o}from"./p-DfpCerXM.js";import{a as n}from"./p-Cr6IXrUk.js";import{c as d}from"./p-Cy_kHPeC.js";const l=()=>`:host{display:block}:host([hidden]){display:none}.field{display:grid;gap:var(--space-2)}.label{color:var(--pf-input-field-label, var(--pf-field-label));font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}.required{color:var(--pf-field-required);margin-inline-start:var(--space-1)}.description{color:var(--pf-input-field-description, var(--pf-field-description));font-size:var(--font-size-sm);margin:0}.error{color:var(--pf-input-field-error, var(--pf-field-error));font-size:var(--font-size-sm);margin:0}.input{background:var(--pf-input-bg);border:1px solid var(--pf-input-border);border-radius:var(--radius-md);color:var(--pf-input-text);font:inherit;min-height:40px;padding:0 var(--space-3);width:100%;transition:background 0.2s, border 0.2s, color 0.2s, opacity 0.2s}.input:disabled{background:var(--pf-control-bg-disabled);border-color:var(--pf-control-border-disabled);color:var(--pf-control-text-disabled);cursor:not-allowed;opacity:0.6}.input:focus{outline:none}.input:focus-visible{border-color:var(--pf-input-focus-border);box-shadow:var(--pf-input-focus-ring, var(--pf-focus-ring))}.input::placeholder{color:var(--pf-input-placeholder)}.input--invalid{border-color:var(--pf-input-invalid-border)}@media (prefers-reduced-motion: reduce){.input{transition:none}}`;const p=t(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.pfInput=i(this,"pfInput");this.pfChange=i(this,"pfChange");this.internals=this.attachInternals()}get el(){return this}internals;name;value="";type="text";label;description;error;placeholder;required=false;disabled=false;readonly=false;pfInput;pfChange;initialValue="";componentWillLoad(){this.initialValue=this.value??"";this.syncFormState()}syncFormState(){this.internals.setFormValue(this.value??"");n(this.internals,Boolean(this.value),this.required,this.error)}async checkValidity(){return this.internals.checkValidity()}async reportValidity(){return this.internals.reportValidity()}async getValidationMessage(){return this.internals.validationMessage}formResetCallback(){this.value=this.initialValue}onInput=e=>{this.value=e.target.value;this.pfInput.emit({value:this.value})};onChange=()=>{this.pfChange.emit({value:this.value})};render(){const e=o(this.description&&"description",this.error&&"error");return a(s,{key:"2eabd0d15d1a83b03064dee5feef9884a55a3c4c"},a("div",{key:"3c10b0b9d675eede30e34c27013d51713584baca",class:"field",part:"field"},this.label&&a("label",{key:"f0b9b45f307792a93190a354efcf0a980a326589",class:"label",part:"label",htmlFor:"input"},this.label,this.required&&a("span",{key:"e3d8edb769ea8736ca485f5e539a0398ba1d1a33",class:"required","aria-hidden":"true"},"*")),a("input",{key:"419f2ba1f5a7b62b5042d1fd94b96a8abee829a7",id:"input","aria-label":d(this.el,this.label),part:"input",class:{input:true,"input--invalid":Boolean(this.error)},type:this.type,name:this.name,value:this.value,placeholder:this.placeholder,required:this.required,disabled:this.disabled,readOnly:this.readonly,"aria-invalid":this.error?"true":null,"aria-describedby":e,onInput:this.onInput,onChange:this.onChange}),this.description&&a("p",{key:"c0d1323a34f5503a2049cc3ac5ef9e892cfb1cb6",class:"description",part:"description",id:"description"},this.description),this.error&&a("p",{key:"915301b580225bbf0b901c53f977b73a53fa94ee",class:"error",part:"error",id:"error"},this.error)))}static get delegatesFocus(){return true}static get formAssociated(){return true}static get watchers(){return{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}}static get style(){return l()}},[593,"pf-input",{name:[513],value:[1025],type:[513],label:[1],description:[1],error:[1],placeholder:[1],required:[516],disabled:[516],readonly:[516],checkValidity:[64],reportValidity:[64],getValidationMessage:[64]},undefined,{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}]);function c(){if(typeof customElements==="undefined"){return}const t=["pf-input"];t.forEach((t=>{switch(t){case"pf-input":if(!customElements.get(e(t))){customElements.define(e(t),p)}break}}))}c();const u=p;const f=c;export{u as PfInput,f as defineCustomElement};
2
2
  //# sourceMappingURL=pf-input.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["pfInputCss","PfInput","__stencil_proxyCustomElement","HTMLElement","internals","name","value","type","label","description","error","placeholder","required","disabled","readonly","pfInput","pfChange","initialValue","componentWillLoad","this","syncFormState","setFormValue","applyControlValidity","Boolean","checkValidity","reportValidity","getValidationMessage","validationMessage","formResetCallback","onInput","event","target","emit","onChange","render","describedBy","composeDescribedBy","h","Host","key","class","part","htmlFor","id","input","readOnly"],"sources":["src/components/pf-input/pf-input.css?tag=pf-input&encapsulation=shadow","src/components/pf-input/pf-input.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-2);\n}\n\n.label {\n color: var(--pf-input-field-label, var(--pf-field-label));\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-field-required);\n margin-inline-start: var(--space-1);\n}\n\n.description {\n color: var(--pf-input-field-description, var(--pf-field-description));\n font-size: var(--font-size-sm);\n margin: 0;\n}\n\n.error {\n color: var(--pf-input-field-error, var(--pf-field-error));\n font-size: var(--font-size-sm);\n margin: 0;\n}\n\n.input {\n background: var(--pf-input-bg);\n border: 1px solid var(--pf-input-border);\n border-radius: var(--radius-md);\n color: var(--pf-input-text);\n font: inherit;\n min-height: 40px;\n padding: 0 var(--space-3);\n width: 100%;\n transition:\n background 0.2s,\n border 0.2s,\n color 0.2s,\n opacity 0.2s;\n}\n\n.input:disabled {\n background: var(--pf-control-bg-disabled);\n border-color: var(--pf-control-border-disabled);\n color: var(--pf-control-text-disabled);\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.input:focus {\n outline: none;\n}\n\n.input:focus-visible {\n border-color: var(--pf-input-focus-border);\n box-shadow: var(--pf-input-focus-ring, var(--pf-focus-ring));\n}\n\n.input::placeholder {\n color: var(--pf-input-placeholder);\n}\n\n.input--invalid {\n border-color: var(--pf-input-invalid-border);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .input {\n transition: none;\n }\n}\n","import { composeDescribedBy } from '@pitchfork-ui/core';\nimport { applyControlValidity } from '../../form-validity';\nimport {\n AttachInternals,\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\n\nexport type PfInputType = 'text' | 'email' | 'password' | 'search' | 'tel' | 'url';\n\n/**\n * A form-associated text input.\n *\n * `formAssociated` plus `ElementInternals` is what makes this participate in a\n * real `<form>`: the value reaches `FormData`, constraint validation works, and\n * Angular's generated value accessor has something to bind to. A plain\n * `<input>` inside a shadow root does none of that.\n *\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part input - the native 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-input',\n styleUrl: 'pf-input.css',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n})\nexport class PfInput {\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 /** The control's value. */\n @Prop({ mutable: true }) value = '';\n\n @Prop({ reflect: true }) type: PfInputType = 'text';\n\n /** Visible label. Rendered in the same root as the input, so `for` works. */\n @Prop() label?: string;\n\n /** Hint text below the control. */\n @Prop() description?: string;\n\n /** Error message. Its presence is what marks the control invalid. */\n @Prop() error?: string;\n\n @Prop() placeholder?: string;\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n @Prop({ reflect: true }) readonly = false;\n\n /** Fires on every keystroke, like the native `input` event. */\n @Event() pfInput!: EventEmitter<{ value: string }>;\n\n /** Fires when the value is committed, like the native `change` event. */\n @Event() pfChange!: EventEmitter<{ value: string }>;\n\n /**\n * The value the control had when it was created, which is what a form reset\n * restores. Captured here because `value` has been overwritten by then.\n */\n private initialValue = '';\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n this.internals.setFormValue(this.value ?? '');\n applyControlValidity(this.internals, Boolean(this.value), this.required, this.error);\n }\n\n /**\n * Whether the control currently satisfies its constraints.\n *\n * A form-associated custom element does not inherit `checkValidity` from\n * anywhere -- the spec puts it on ElementInternals, so the element has to\n * forward it or consumers cannot ask.\n */\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 value the control started with, not an empty string —\n * verified against a native `<input value=\"initial\">`, which comes back to\n * \"initial\" rather than to \"\". Clearing it was a real defect: a\n * `<pf-input value=\"…\">` in a form lost its value on any reset.\n */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n private onInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value;\n this.pfInput.emit({ value: this.value });\n };\n\n private onChange = () => {\n this.pfChange.emit({ value: this.value });\n };\n\n render() {\n // IDs are scoped to this shadow root, so they can be literal -- the useId()\n // the React component needs has no counterpart here.\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=\"input\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n <input\n id=\"input\"\n part=\"input\"\n class={{ input: true, 'input--invalid': Boolean(this.error) }}\n type={this.type}\n name={this.name}\n value={this.value}\n placeholder={this.placeholder}\n required={this.required}\n disabled={this.disabled}\n readOnly={this.readonly}\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={describedBy}\n onInput={this.onInput}\n onChange={this.onChange}\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"],"mappings":"0IAAA,MAAMA,EAAa,IAAM,qxC,MCoCZC,EAAOC,EAAA,MAAAD,UAAAE,E,uLACCC,UAWMC,KAGAC,MAAQ,GAERC,KAAoB,OAGr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SACfC,SAAUM,KAAKN,SACfgC,SAAU1B,KAAKL,SAAQ,eACTK,KAAKT,MAAQ,OAAS,KAAI,mBACtByB,EAClBN,QAASV,KAAKU,QACdI,SAAUd,KAAKc,WAEhBd,KAAKV,aACJ4B,EAAA,KAAAE,IAAA,2CAAGC,MAAM,cAAcC,KAAK,cAAcE,GAAG,eAC1CxB,KAAKV,aAGTU,KAAKT,OACJ2B,EAAA,KAAAE,IAAA,2CAAGC,MAAM,QAAQC,KAAK,QAAQE,GAAG,SAC9BxB,KAAKT,Q","ignoreList":[]}
1
+ {"version":3,"names":["pfInputCss","PfInput","__stencil_proxyCustomElement","HTMLElement","internals","name","value","type","label","description","error","placeholder","required","disabled","readonly","pfInput","pfChange","initialValue","componentWillLoad","this","syncFormState","setFormValue","applyControlValidity","Boolean","checkValidity","reportValidity","getValidationMessage","validationMessage","formResetCallback","onInput","event","target","emit","onChange","render","describedBy","composeDescribedBy","h","Host","key","class","part","htmlFor","id","controlAriaLabel","el","input","readOnly"],"sources":["src/components/pf-input/pf-input.css?tag=pf-input&encapsulation=shadow","src/components/pf-input/pf-input.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-2);\n}\n\n.label {\n color: var(--pf-input-field-label, var(--pf-field-label));\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-field-required);\n margin-inline-start: var(--space-1);\n}\n\n.description {\n color: var(--pf-input-field-description, var(--pf-field-description));\n font-size: var(--font-size-sm);\n margin: 0;\n}\n\n.error {\n color: var(--pf-input-field-error, var(--pf-field-error));\n font-size: var(--font-size-sm);\n margin: 0;\n}\n\n.input {\n background: var(--pf-input-bg);\n border: 1px solid var(--pf-input-border);\n border-radius: var(--radius-md);\n color: var(--pf-input-text);\n font: inherit;\n min-height: 40px;\n padding: 0 var(--space-3);\n width: 100%;\n transition:\n background 0.2s,\n border 0.2s,\n color 0.2s,\n opacity 0.2s;\n}\n\n.input:disabled {\n background: var(--pf-control-bg-disabled);\n border-color: var(--pf-control-border-disabled);\n color: var(--pf-control-text-disabled);\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.input:focus {\n outline: none;\n}\n\n.input:focus-visible {\n border-color: var(--pf-input-focus-border);\n box-shadow: var(--pf-input-focus-ring, var(--pf-focus-ring));\n}\n\n.input::placeholder {\n color: var(--pf-input-placeholder);\n}\n\n.input--invalid {\n border-color: var(--pf-input-invalid-border);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .input {\n transition: none;\n }\n}\n","import { composeDescribedBy } from '@pitchfork-ui/core';\nimport { applyControlValidity } from '../../form-validity';\nimport { controlAriaLabel } from '../../control-label';\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\nexport type PfInputType = 'text' | 'email' | 'password' | 'search' | 'tel' | 'url';\n\n/**\n * A form-associated text input.\n *\n * `formAssociated` plus `ElementInternals` is what makes this participate in a\n * real `<form>`: the value reaches `FormData`, constraint validation works, and\n * Angular's generated value accessor has something to bind to. A plain\n * `<input>` inside a shadow root does none of that.\n *\n * @part field - the wrapper around label, control and messages.\n * @part label - the label element.\n * @part input - the native 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-input',\n styleUrl: 'pf-input.css',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n})\nexport class PfInput {\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 /** The control's value. */\n @Prop({ mutable: true }) value = '';\n\n @Prop({ reflect: true }) type: PfInputType = 'text';\n\n /** Visible label. Rendered in the same root as the input, so `for` works. */\n @Prop() label?: string;\n\n /** Hint text below the control. */\n @Prop() description?: string;\n\n /** Error message. Its presence is what marks the control invalid. */\n @Prop() error?: string;\n\n @Prop() placeholder?: string;\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n @Prop({ reflect: true }) readonly = false;\n\n /** Fires on every keystroke, like the native `input` event. */\n @Event() pfInput!: EventEmitter<{ value: string }>;\n\n /** Fires when the value is committed, like the native `change` event. */\n @Event() pfChange!: EventEmitter<{ value: string }>;\n\n /**\n * The value the control had when it was created, which is what a form reset\n * restores. Captured here because `value` has been overwritten by then.\n */\n private initialValue = '';\n\n componentWillLoad() {\n this.initialValue = this.value ?? '';\n this.syncFormState();\n }\n\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n this.internals.setFormValue(this.value ?? '');\n applyControlValidity(this.internals, Boolean(this.value), this.required, this.error);\n }\n\n /**\n * Whether the control currently satisfies its constraints.\n *\n * A form-associated custom element does not inherit `checkValidity` from\n * anywhere -- the spec puts it on ElementInternals, so the element has to\n * forward it or consumers cannot ask.\n */\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 value the control started with, not an empty string —\n * verified against a native `<input value=\"initial\">`, which comes back to\n * \"initial\" rather than to \"\". Clearing it was a real defect: a\n * `<pf-input value=\"…\">` in a form lost its value on any reset.\n */\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n private onInput = (event: Event) => {\n this.value = (event.target as HTMLInputElement).value;\n this.pfInput.emit({ value: this.value });\n };\n\n private onChange = () => {\n this.pfChange.emit({ value: this.value });\n };\n\n render() {\n // IDs are scoped to this shadow root, so they can be literal -- the useId()\n // the React component needs has no counterpart here.\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=\"input\">\n {this.label}\n {this.required && (\n <span class=\"required\" aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n <input\n id=\"input\"\n aria-label={controlAriaLabel(this.el, this.label)}\n part=\"input\"\n class={{ input: true, 'input--invalid': Boolean(this.error) }}\n type={this.type}\n name={this.name}\n value={this.value}\n placeholder={this.placeholder}\n required={this.required}\n disabled={this.disabled}\n readOnly={this.readonly}\n aria-invalid={this.error ? 'true' : null}\n aria-describedby={describedBy}\n onInput={this.onInput}\n onChange={this.onChange}\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"],"mappings":"8KAAA,MAAMA,EAAa,IAAM,qxC,MCsCZC,EAAOC,EAAA,MAAAD,UAAAE,E,4MAGCC,UAWMC,KAGAC,MAAQ,GAERC,KAAoB,OAGrCC,MAGAC,YAGAC,MAEAC,YAEiBC,SAAW,MAEXC,SAAW,MAEXC,SAAW,MAG3BC,QAGAC,SAMDC,aAAe,GAEvB,iBAAAC,GACEC,KAAKF,aAAeE,KAAKb,OAAS,GAClCa,KAAKC,e,CAMP,aAAAA,GACED,KAAKf,UAAUiB,aAAaF,KAAKb,OAAS,IAC1CgB,EAAqBH,KAAKf,UAAWmB,QAAQJ,KAAKb,OAAQa,KAAKP,SAAUO,KAAKT,M,CAWhF,mBAAMc,GACJ,OAAOL,KAAKf,UAAUoB,e,CAKxB,oBAAMC,GACJ,OAAON,KAAKf,UAAUqB,gB,CAKxB,0BAAMC,GACJ,OAAOP,KAAKf,UAAUuB,iB,CASxB,iBAAAC,GACET,KAAKb,MAAQa,KA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C-VLyxRR.js";const l=()=>`:host{display:contents}.dialog{align-items:center;background:none;border:0;display:none;height:100%;justify-content:center;max-height:100%;max-width:100%;padding:var(--space-4);width:100%}.dialog[open]{display:flex}.dialog::backdrop{background:var(--pf-modal-overlay-backdrop, var(--pf-overlay-backdrop))}.panel{background:var(--pf-modal-bg);border:1px solid var(--pf-modal-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);color:var(--pf-modal-text);display:flex;flex-direction:column;max-height:100%;overflow:auto;position:relative;width:100%}:host([size='sm']) .panel{max-width:400px}:host([size='md']) .panel{max-width:560px}:host([size='lg']) .panel{max-width:800px}.close{background:none;border:0;border-radius:var(--radius-sm);color:var(--pf-modal-text-muted);cursor:pointer;display:inline-flex;inset-block-start:var(--space-3);inset-inline-end:var(--space-3);padding:var(--space-1);position:absolute}.close:hover{color:var(--pf-modal-text)}.close:focus-visible{box-shadow:var(--pf-focus-ring);outline:none}.dialog[open] .panel{animation:pf-modal-in var(--pf-transition-enter)}@keyframes pf-modal-in{from{opacity:0;transform:translateY(8px)}}@media (prefers-reduced-motion: reduce){.dialog[open] .panel{animation:none}}`;const r=s(class e extends o{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.pfOpenChange=t(this,"pfOpenChange")}get el(){return this}open=false;size="md";label;dismissable=true;showCloseButton=true;pfOpenChange;releaseScroll=null;componentDidLoad(){if(this.open)this.showDialog()}disconnectedCallback(){this.unlockScroll()}async show(){this.open=true}async hide(){this.open=false}syncOpen(e,s){if(e)this.showDialog();else this.closeDialog();if(e!==s)this.pfOpenChange.emit({open:e})}get dialog(){return this.el.shadowRoot?.querySelector("dialog")??null}lockScroll(){if(this.releaseScroll)return;this.releaseScroll=n()}unlockScroll(){this.releaseScroll?.();this.releaseScroll=null}showDialog(){const e=this.dialog;if(!e||e.open)return;e.showModal();this.lockScroll()}closeDialog(){const e=this.dialog;this.unlockScroll();if(e?.open)e.close()}onCancel=e=>{if(!this.dismissable){e.preventDefault();return}};onClose=()=>{this.unlockScroll();if(this.open)this.open=false};onDialogClick=e=>{if(!this.dismissable||e.target!==this.dialog)return;this.open=false};accessibleName(){if(this.label)return this.label;const e=this.el.textContent?.trim();return e?e.slice(0,120):undefined}render(){return a(i,{key:"4445c1692e0cdf8ea4243f031984d25c3fa35148"},a("dialog",{key:"6a87d0181761644d8f9bc2d02ead398c10030668",part:"dialog",class:"dialog","aria-label":this.accessibleName(),onCancel:this.onCancel,onClose:this.onClose,onClick:this.onDialogClick},a("div",{key:"0ce7125e86b87d9fd834aee12491d384c0a47f7c",class:"panel",part:"panel"},this.showCloseButton&&a("button",{key:"e395307252b805932cdbebe2bc8e31178b8c8fb6",class:"close",part:"close",type:"button","aria-label":"Close",onClick:()=>this.hide()},a("svg",{key:"f83625e2e03e6c0e5f29aa1dd76dabab6011d27f",viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",focusable:"false"},a("path",{key:"fccb0dadc0442661f9300fdec4b36234124fcd93",d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round",fill:"none"}))),a("slot",{key:"8a01602089364eeeb8dfb4b8c1f9d6b48bc3f4a5"}))))}static get watchers(){return{open:[{syncOpen:0}]}}static get style(){return l()}},[769,"pf-modal",{open:[1540],size:[513],label:[1],dismissable:[4],showCloseButton:[4,"show-close-button"],show:[64],hide:[64]},undefined,{open:[{syncOpen:0}]}]);function d(){if(typeof customElements==="undefined"){return}const s=["pf-modal"];s.forEach((s=>{switch(s){case"pf-modal":if(!customElements.get(e(s))){customElements.define(e(s),r)}break}}))}d();const c=r;const h=d;export{c as PfModal,h as defineCustomElement};
1
+ import{t as e,p as t,H as s,c as o,h as i,a}from"./index.js";import{l as n}from"./p-C-VLyxRR.js";var r=e=>{if(typeof e.checkVisibility==="function")return e.checkVisibility();return e.offsetParent!==null||e.getClientRects().length>0};var l=e=>{const t=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(t)).filter((e=>{if(e.hasAttribute("disabled")||e.getAttribute("aria-hidden")==="true")return false;return r(e)}))};const d=()=>`:host{display:contents}.dialog{align-items:center;background:none;border:0;display:none;height:100%;justify-content:center;max-height:100%;max-width:100%;padding:var(--space-4);width:100%}.dialog[open]{display:flex}.dialog::backdrop{background:var(--pf-modal-overlay-backdrop, var(--pf-overlay-backdrop))}.panel{background:var(--pf-modal-bg);border:1px solid var(--pf-modal-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);color:var(--pf-modal-text);display:flex;flex-direction:column;max-height:100%;overflow:auto;position:relative;width:100%}:host([size='sm']) .panel{max-width:400px}:host([size='md']) .panel{max-width:560px}:host([size='lg']) .panel{max-width:800px}.close{background:none;border:0;border-radius:var(--radius-sm);color:var(--pf-modal-text-muted);cursor:pointer;display:inline-flex;inset-block-start:var(--space-3);inset-inline-end:var(--space-3);padding:var(--space-1);position:absolute}.close:hover{color:var(--pf-modal-text)}.close:focus-visible{box-shadow:var(--pf-focus-ring);outline:none}.dialog[open] .panel{animation:pf-modal-in var(--pf-transition-enter)}@keyframes pf-modal-in{from{opacity:0;transform:translateY(8px)}}@media (prefers-reduced-motion: reduce){.dialog[open] .panel{animation:none}}`;const c=t(class e extends s{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.pfOpenChange=o(this,"pfOpenChange")}get el(){return this}open=false;size="md";label;dismissable=true;showCloseButton=true;pfOpenChange;releaseScroll=null;componentDidLoad(){if(this.open)this.showDialog()}disconnectedCallback(){this.unlockScroll()}async show(){this.open=true}async hide(){this.open=false}syncOpen(e,t){if(e)this.showDialog();else this.closeDialog();if(e!==t)this.pfOpenChange.emit({open:e})}get dialog(){return this.el.shadowRoot?.querySelector("dialog")??null}lockScroll(){if(this.releaseScroll)return;this.releaseScroll=n()}unlockScroll(){this.releaseScroll?.();this.releaseScroll=null}showDialog(){const e=this.dialog;if(!e||e.open)return;e.showModal();this.lockScroll();requestAnimationFrame((()=>this.ensureFocusInside()))}componentDidRender(){this.ensureFocusInside()}onFocusOut=e=>{if(!this.open||e.relatedTarget)return;requestAnimationFrame((()=>{if(document.hasFocus())this.ensureFocusInside()}))};ensureFocusInside(){const e=this.dialog;if(!this.open||!e?.isConnected||!e.open)return;if(e.matches(":focus-within"))return;const[t]=l(e);(t??e).focus()}closeDialog(){const e=this.dialog;this.unlockScroll();if(e?.open)e.close()}onCancel=e=>{if(!this.dismissable){e.preventDefault();return}};onClose=()=>{this.unlockScroll();if(this.open)this.open=false};onDialogClick=e=>{if(!this.dismissable||e.target!==this.dialog)return;this.open=false};accessibleName(){if(this.label)return this.label;const e=this.el.textContent?.trim();return e?e.slice(0,120):undefined}render(){return i(a,{key:"bf6b14acf276e7e327dad4e2adb0759c5371caa0"},i("dialog",{key:"fa8836858cd2ac18fe270c860671e77f5f9f6b93",part:"dialog",class:"dialog","aria-label":this.accessibleName(),onCancel:this.onCancel,onFocusout:this.onFocusOut,onClose:this.onClose,onClick:this.onDialogClick},i("div",{key:"6bfce72c9c19619388b93e3385b2fa8fe8fecc8e",class:"panel",part:"panel"},this.showCloseButton&&i("button",{key:"f11faa39f8854d5dd6854bb3c6e8e8e2f1abc6e3",class:"close",part:"close",type:"button","aria-label":"Close",onClick:()=>this.hide()},i("svg",{key:"7530bfc0821a2d09e6045589cbbf2d390e8c6897",viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",focusable:"false"},i("path",{key:"74c4d8385baa9776cfdf23570f46fd1621bd3fa2",d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round",fill:"none"}))),i("slot",{key:"d11d9ae0716dc7f846ea05dc24689f0c6465057d"}))))}static get watchers(){return{open:[{syncOpen:0}]}}static get style(){return d()}},[769,"pf-modal",{open:[1540],size:[513],label:[1],dismissable:[4],showCloseButton:[4,"show-close-button"],show:[64],hide:[64]},undefined,{open:[{syncOpen:0}]}]);function f(){if(typeof customElements==="undefined"){return}const t=["pf-modal"];t.forEach((t=>{switch(t){case"pf-modal":if(!customElements.get(e(t))){customElements.define(e(t),c)}break}}))}f();const h=c;const u=f;export{h as PfModal,u as defineCustomElement};
2
2
  //# sourceMappingURL=pf-modal.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["pfModalCss","PfModal","__stencil_proxyCustomElement","HTMLElement","open","size","label","dismissable","showCloseButton","pfOpenChange","releaseScroll","componentDidLoad","this","showDialog","disconnectedCallback","unlockScroll","show","hide","syncOpen","next","previous","closeDialog","emit","dialog","el","shadowRoot","querySelector","lockScroll","lockPageScroll","showModal","close","onCancel","event","preventDefault","onClose","onDialogClick","target","accessibleName","text","textContent","trim","slice","undefined","render","h","Host","key","part","class","onClick","type","viewBox","width","height","focusable","d","stroke","fill"],"sources":["src/components/pf-modal/pf-modal.css?tag=pf-modal&encapsulation=shadow","src/components/pf-modal/pf-modal.tsx"],"sourcesContent":[":host {\n display: contents;\n}\n\n/*\n * The dialog is the overlay: it fills the viewport and centres the panel, so a\n * click that lands on it rather than on the panel is an overlay click.\n */\n.dialog {\n align-items: center;\n background: none;\n border: 0;\n display: none;\n height: 100%;\n justify-content: center;\n max-height: 100%;\n max-width: 100%;\n padding: var(--space-4);\n width: 100%;\n}\n\n.dialog[open] {\n display: flex;\n}\n\n.dialog::backdrop {\n background: var(--pf-modal-overlay-backdrop, var(--pf-overlay-backdrop));\n}\n\n.panel {\n background: var(--pf-modal-bg);\n border: 1px solid var(--pf-modal-border);\n border-radius: var(--radius-lg);\n box-shadow: var(--shadow-lg);\n color: var(--pf-modal-text);\n display: flex;\n flex-direction: column;\n max-height: 100%;\n overflow: auto;\n position: relative;\n width: 100%;\n}\n\n:host([size='sm']) .panel {\n max-width: 400px;\n}\n\n:host([size='md']) .panel {\n max-width: 560px;\n}\n\n:host([size='lg']) .panel {\n max-width: 800px;\n}\n\n.close {\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-modal-text-muted);\n cursor: pointer;\n display: inline-flex;\n inset-block-start: var(--space-3);\n inset-inline-end: var(--space-3);\n padding: var(--space-1);\n position: absolute;\n}\n\n.close:hover {\n color: var(--pf-modal-text);\n}\n\n.close:focus-visible {\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.dialog[open] .panel {\n animation: pf-modal-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-modal-in {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .dialog[open] .panel {\n animation: none;\n }\n}\n","import { lockPageScroll } from '@pitchfork-ui/core';\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\n\nexport type PfModalSize = 'sm' | 'md' | 'lg';\n\n/**\n * A modal dialog.\n *\n * A native `<dialog>` opened with `showModal()`, which from inside a shadow\n * root gives the focus trap, Escape and the backdrop for nothing — all\n * measured: focus moves inside on open and cannot be taken by a light-DOM\n * button, and a real Escape fires `cancel` then `close`. So `trapFocus` from\n * core is not needed here, unlike in the React component.\n *\n * What `showModal()` does *not* do is lock page scroll — measured: a real\n * wheel still scrolled the page behind an open modal — so this element locks\n * it, exactly as the React component does.\n *\n * @slot - the modal's sections, usually `pf-modal-header`, `pf-modal-body` and\n * `pf-modal-footer`.\n * @part dialog - the native dialog, which is also the overlay.\n * @part panel - the bordered box the content sits in.\n * @part close - the close button.\n */\n@Component({\n tag: 'pf-modal',\n styleUrl: 'pf-modal.css',\n shadow: true,\n})\nexport class PfModal {\n @Element() el!: HTMLElement;\n\n /** Whether the modal is showing. Reflected so the stylesheet can select on it. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** Panel width. Reflected so the stylesheet can select on it. */\n @Prop({ reflect: true }) size: PfModalSize = 'md';\n\n /**\n * Accessible name. Falls back to the text of whatever is slotted, which is\n * usually the header — `aria-labelledby` cannot be used, because an IDREF\n * does not cross a shadow boundary and the header is in the light DOM.\n */\n @Prop() label?: string;\n\n /** Close on Escape or a click on the overlay. Defaults to true. */\n @Prop() dismissable = true;\n\n /** Render the corner close button. Defaults to true. */\n @Prop() showCloseButton = true;\n\n /** Fires whenever the modal opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /**\n * Releases the page-scroll lock, or null when this modal does not hold it.\n * The lock is core's and reference-counted, so a slideout opening over a\n * modal cannot leave the page unscrollable.\n */\n private releaseScroll: (() => void) | null = null;\n\n componentDidLoad() {\n if (this.open) this.showDialog();\n }\n\n disconnectedCallback() {\n // A modal removed while open would otherwise leave the page unscrollable.\n this.unlockScroll();\n }\n\n /** Opens the modal. */\n @Method()\n async show(): Promise<void> {\n this.open = true;\n }\n\n /** Closes the modal. */\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n /**\n * The one place a state change is announced, whatever caused it: `show()`,\n * the close button, Escape, an overlay click, or a consumer writing the prop.\n *\n * The first version emitted from the `close` handler alone, which fired for\n * every close and for no open — caught by its own test. A consumer mirroring\n * this value back sets `open` to what it already is, which Stencil does not\n * treat as a change, so there is no loop.\n */\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showDialog();\n else this.closeDialog();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n private get dialog() {\n return this.el.shadowRoot?.querySelector('dialog') ?? null;\n }\n\n private lockScroll() {\n if (this.releaseScroll) return;\n this.releaseScroll = lockPageScroll();\n }\n\n private unlockScroll() {\n this.releaseScroll?.();\n this.releaseScroll = null;\n }\n\n private showDialog() {\n const dialog = this.dialog;\n if (!dialog || dialog.open) return;\n dialog.showModal();\n this.lockScroll();\n }\n\n private closeDialog() {\n const dialog = this.dialog;\n this.unlockScroll();\n if (dialog?.open) dialog.close();\n }\n\n /** Fires on Escape. Blocking it is how a non-dismissable modal stays put. */\n private onCancel = (event: Event) => {\n if (!this.dismissable) {\n event.preventDefault();\n return;\n }\n // Let it close; `close` does the state mirroring.\n };\n\n /**\n * Mirrors a close the browser made — Escape, or the dialog being closed by\n * anything other than this element — back into `open`, which then announces\n * it through the watch above.\n */\n private onClose = () => {\n this.unlockScroll();\n if (this.open) this.open = false;\n };\n\n /**\n * A click on the dialog element itself is a click on the overlay: the panel\n * is an inner box, so anything landing on the dialog missed the content.\n */\n private onDialogClick = (event: MouseEvent) => {\n if (!this.dismissable || event.target !== this.dialog) return;\n this.open = false;\n };\n\n private accessibleName() {\n if (this.label) return this.label;\n const text = this.el.textContent?.trim();\n return text ? text.slice(0, 120) : undefined;\n }\n\n render() {\n return (\n <Host>\n <dialog\n part=\"dialog\"\n class=\"dialog\"\n aria-label={this.accessibleName()}\n onCancel={this.onCancel}\n onClose={this.onClose}\n onClick={this.onDialogClick}\n >\n <div class=\"panel\" part=\"panel\">\n {this.showCloseButton && (\n <button\n class=\"close\"\n part=\"close\"\n type=\"button\"\n aria-label=\"Close\"\n onClick={() => this.hide()}\n >\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path\n d=\"M4 4l8 8M12 4l-8 8\"\n stroke=\"currentColor\"\n stroke-width=\"1.6\"\n stroke-linecap=\"round\"\n fill=\"none\"\n />\n </svg>\n </button>\n )}\n <slot />\n </div>\n </dialog>\n </Host>\n );\n }\n}\n"],"mappings":"sGAAA,MAAMA,EAAa,IAAM,8tC,MCwCZC,EAAOC,EAAA,MAAAD,UAAAE,E,+IAIsBC,KAAO,MAGtBC,KAAoB,KAOrCC,MAGAC,YAAc,KAGdC,gBAAkB,KAGjBC,aAODC,cAAqC,KAE7C,gBAAAC,GACE,GAAIC,KAAKR,KAAMQ,KAAKC,Y,CAGtB,oBAAAC,GAEEF,KAAKG,c,CAKP,UAAMC,GACJJ,KAAKR,KAAO,I,CAKd,UAAMa,GACJL,KAAKR,KAAO,K,CAad,QAAAc,CAASC,EAAeC,GACtB,G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AAKK,QAEpB2B,EAAA,OAAAE,IAAA,2CACEK,QAAQ,YACRC,MAAM,KACNC,OAAO,KAAI,cACC,OACZC,UAAU,SAEVV,EAAA,QAAAE,IAAA,2CACES,EAAE,qBACFC,OAAO,eAAc,eACR,MAAK,iBACH,QACfC,KAAK,WAKbb,EAAA,QAAAE,IAAA,+C","ignoreList":[]}
1
+ {"version":3,"names":["isElementVisible","element","checkVisibility","offsetParent","getClientRects","length","getFocusableElements","container","selector","join","Array","from","querySelectorAll","filter","hasAttribute","getAttribute","pfModalCss","PfModal","__stencil_proxyCustomElement","HTMLElement","open","size","label","dismissable","showCloseButton","pfOpenChange","releaseScroll","componentDidLoad","this","showDialog","disconnectedCallback","unlockScroll","show","hide","syncOpen","next","previous","closeDialog","emit","dialog","el","shadowRoot","querySelector","lockScroll","lockPageScroll","showModal","requestAnimationFrame","ensureFocusInside","componentDidRender","onFocusOut","event","relatedTarget","document","hasFocus","isConnected","matches","first","focus","close","onCancel","preventDefault","onClose","onDialogClick","target","accessibleName","text","textContent","trim","slice","undefined","render","h","Host","key","part","class","onFocusout","onClick","type","viewBox","width","height","focusable","d","stroke","fill"],"sources":["../core/dist/focus.js","src/components/pf-modal/pf-modal.css?tag=pf-modal&encapsulation=shadow","src/components/pf-modal/pf-modal.tsx"],"sourcesContent":["import { noop } from \"./internal.js\";\nimport { Keys } from \"./keys.js\";\n//#region src/focus.ts\nvar isElementVisible = (element) => {\n\tif (typeof element.checkVisibility === \"function\") return element.checkVisibility();\n\treturn element.offsetParent !== null || element.getClientRects().length > 0;\n};\nvar getFocusableElements = (container) => {\n\tconst selector = [\n\t\t\"a[href]\",\n\t\t\"button:not([disabled])\",\n\t\t\"input:not([disabled])\",\n\t\t\"select:not([disabled])\",\n\t\t\"textarea:not([disabled])\",\n\t\t\"[contenteditable]:not([contenteditable=\\\"false\\\"])\",\n\t\t\"[tabindex]:not([tabindex=\\\"-1\\\"])\"\n\t].join(\",\");\n\treturn Array.from(container.querySelectorAll(selector)).filter((element) => {\n\t\tif (element.hasAttribute(\"disabled\") || element.getAttribute(\"aria-hidden\") === \"true\") return false;\n\t\treturn isElementVisible(element);\n\t});\n};\n/**\n* Moves focus into the container and keeps Tab cycling inside it. Returns a\n* cleanup function that removes the listener and, unless told otherwise,\n* restores focus to the previously active element.\n*/\nfunction trapFocus({ getContainer, onEscape, restoreFocus = true }) {\n\tif (typeof document === \"undefined\") return noop;\n\tconst container = getContainer();\n\tconst previousActiveElement = document.activeElement;\n\tconst initialFocusable = container ? getFocusableElements(container)[0] : void 0;\n\tif (initialFocusable) initialFocusable.focus();\n\telse container?.focus();\n\tconst onKeyDown = (event) => {\n\t\tif (event.key === Keys.Escape) {\n\t\t\tonEscape?.();\n\t\t\treturn;\n\t\t}\n\t\tif (event.key !== Keys.Tab) return;\n\t\tconst current = getContainer();\n\t\tif (!current) return;\n\t\tconst focusableElements = getFocusableElements(current);\n\t\tif (focusableElements.length === 0) {\n\t\t\tevent.preventDefault();\n\t\t\tcurrent.focus();\n\t\t\treturn;\n\t\t}\n\t\tconst firstElement = focusableElements[0];\n\t\tconst lastElement = focusableElements[focusableElements.length - 1];\n\t\tconst activeElement = document.activeElement;\n\t\tif (!(activeElement ? current.contains(activeElement) : false)) {\n\t\t\tevent.preventDefault();\n\t\t\t(event.shiftKey ? lastElement : firstElement).focus();\n\t\t\treturn;\n\t\t}\n\t\tif (event.shiftKey && activeElement === firstElement) {\n\t\t\tevent.preventDefault();\n\t\t\tlastElement.focus();\n\t\t\treturn;\n\t\t}\n\t\tif (!event.shiftKey && activeElement === lastElement) {\n\t\t\tevent.preventDefault();\n\t\t\tfirstElement.focus();\n\t\t}\n\t};\n\tdocument.addEventListener(\"keydown\", onKeyDown);\n\treturn () => {\n\t\tdocument.removeEventListener(\"keydown\", onKeyDown);\n\t\tif (restoreFocus) previousActiveElement?.focus?.();\n\t};\n}\n//#endregion\nexport { getFocusableElements, trapFocus };\n",":host {\n display: contents;\n}\n\n/*\n * The dialog is the overlay: it fills the viewport and centres the panel, so a\n * click that lands on it rather than on the panel is an overlay click.\n */\n.dialog {\n align-items: center;\n background: none;\n border: 0;\n display: none;\n height: 100%;\n justify-content: center;\n max-height: 100%;\n max-width: 100%;\n padding: var(--space-4);\n width: 100%;\n}\n\n.dialog[open] {\n display: flex;\n}\n\n.dialog::backdrop {\n background: var(--pf-modal-overlay-backdrop, var(--pf-overlay-backdrop));\n}\n\n.panel {\n background: var(--pf-modal-bg);\n border: 1px solid var(--pf-modal-border);\n border-radius: var(--radius-lg);\n box-shadow: var(--shadow-lg);\n color: var(--pf-modal-text);\n display: flex;\n flex-direction: column;\n max-height: 100%;\n overflow: auto;\n position: relative;\n width: 100%;\n}\n\n:host([size='sm']) .panel {\n max-width: 400px;\n}\n\n:host([size='md']) .panel {\n max-width: 560px;\n}\n\n:host([size='lg']) .panel {\n max-width: 800px;\n}\n\n.close {\n background: none;\n border: 0;\n border-radius: var(--radius-sm);\n color: var(--pf-modal-text-muted);\n cursor: pointer;\n display: inline-flex;\n inset-block-start: var(--space-3);\n inset-inline-end: var(--space-3);\n padding: var(--space-1);\n position: absolute;\n}\n\n.close:hover {\n color: var(--pf-modal-text);\n}\n\n.close:focus-visible {\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.dialog[open] .panel {\n animation: pf-modal-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-modal-in {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .dialog[open] .panel {\n animation: none;\n }\n}\n","import { getFocusableElements, lockPageScroll } from '@pitchfork-ui/core';\n\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core';\n\nexport type PfModalSize = 'sm' | 'md' | 'lg';\n\n/**\n * A modal dialog.\n *\n * A native `<dialog>` opened with `showModal()`, which from inside a shadow\n * root gives the focus trap, Escape and the backdrop for nothing — all\n * measured: focus cannot be taken by a light-DOM button, and a real Escape\n * fires `cancel` then `close`. So `trapFocus` from core is not needed here,\n * unlike in the React component.\n *\n * The one part of `showModal()` that cannot be relied on is where it puts\n * focus, and the gap is exactly the case every framework consumer is in. See\n * `showDialog` below.\n *\n * What `showModal()` does *not* do is lock page scroll — measured: a real\n * wheel still scrolled the page behind an open modal — so this element locks\n * it, exactly as the React component does.\n *\n * @slot - the modal's sections, usually `pf-modal-header`, `pf-modal-body` and\n * `pf-modal-footer`.\n * @part dialog - the native dialog, which is also the overlay.\n * @part panel - the bordered box the content sits in.\n * @part close - the close button.\n */\n@Component({\n tag: 'pf-modal',\n styleUrl: 'pf-modal.css',\n shadow: true,\n})\nexport class PfModal {\n @Element() el!: HTMLElement;\n\n /** Whether the modal is showing. Reflected so the stylesheet can select on it. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** Panel width. Reflected so the stylesheet can select on it. */\n @Prop({ reflect: true }) size: PfModalSize = 'md';\n\n /**\n * Accessible name. Falls back to the text of whatever is slotted, which is\n * usually the header — `aria-labelledby` cannot be used, because an IDREF\n * does not cross a shadow boundary and the header is in the light DOM.\n */\n @Prop() label?: string;\n\n /** Close on Escape or a click on the overlay. Defaults to true. */\n @Prop() dismissable = true;\n\n /** Render the corner close button. Defaults to true. */\n @Prop() showCloseButton = true;\n\n /** Fires whenever the modal opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /**\n * Releases the page-scroll lock, or null when this modal does not hold it.\n * The lock is core's and reference-counted, so a slideout opening over a\n * modal cannot leave the page unscrollable.\n */\n private releaseScroll: (() => void) | null = null;\n\n componentDidLoad() {\n if (this.open) this.showDialog();\n }\n\n disconnectedCallback() {\n // A modal removed while open would otherwise leave the page unscrollable.\n this.unlockScroll();\n }\n\n /** Opens the modal. */\n @Method()\n async show(): Promise<void> {\n this.open = true;\n }\n\n /** Closes the modal. */\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n /**\n * The one place a state change is announced, whatever caused it: `show()`,\n * the close button, Escape, an overlay click, or a consumer writing the prop.\n *\n * The first version emitted from the `close` handler alone, which fired for\n * every close and for no open — caught by its own test. A consumer mirroring\n * this value back sets `open` to what it already is, which Stencil does not\n * treat as a change, so there is no loop.\n */\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showDialog();\n else this.closeDialog();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n private get dialog() {\n return this.el.shadowRoot?.querySelector('dialog') ?? null;\n }\n\n private lockScroll() {\n if (this.releaseScroll) return;\n this.releaseScroll = lockPageScroll();\n }\n\n private unlockScroll() {\n this.releaseScroll?.();\n this.releaseScroll = null;\n }\n\n /**\n * Opens the dialog, and makes sure focus actually went into it.\n *\n * `showModal()` focuses the dialog or its first focusable descendant — but\n * **not** when light-DOM children were appended in the same task as the\n * open. Measured in Chromium with no framework involved: append the three\n * `pf-modal-*` sections to a long-mounted `pf-modal` and set `open` in the\n * same task, and the dialog opens with `document.activeElement` still on\n * `<body>` and `:focus-within` false. Leave one frame between the two and\n * focus lands inside; mount the element with its children and `open`\n * already set and focus lands inside. So it is the append racing the open,\n * and the flattened tree `showModal()`'s focusing steps read.\n *\n * That race is not an edge case: React, Angular and Vue all commit a\n * modal's content and its `open` in one go, so every framework consumer got\n * an open modal with focus outside it and nothing to say so — the page is\n * still inert, so the only symptom is that a reader is not taken to the\n * dialog and the first Tab is needed. Porting `apps/demo` is what found it.\n *\n * What the trace shows, with element identity and a `MutationObserver` on\n * the shadow root: `showModal()` **does** focus, onto `div[part=panel]`,\n * and one frame later a `focusout` with `relatedTarget: null` drops it,\n * with nothing removed from the shadow root. That is Chromium's focus\n * fixup running once the appended children are assigned to the slot and\n * finding the panel is no longer a valid target -- so it is not a render\n * that loses focus, and re-asserting after a render does not catch it\n * (measured: `componentDidRender` alone changes nothing here).\n *\n * So the dialog watches for exactly that: a `focusout` that goes nowhere\n * while the modal is open puts focus back. `requestAnimationFrame` after\n * `showModal()` covers the case where focus never arrived at all, and\n * `componentDidRender` covers a render that discards the focused node. All\n * three are the same guarded call, and the `:focus-within` guard makes it a\n * no-op whenever focus is already inside -- so none of them moves focus\n * that the platform or a consumer placed.\n */\n private showDialog() {\n const dialog = this.dialog;\n if (!dialog || dialog.open) return;\n dialog.showModal();\n this.lockScroll();\n requestAnimationFrame(() => this.ensureFocusInside());\n }\n\n componentDidRender() {\n this.ensureFocusInside();\n }\n\n /**\n * Focus left the dialog for nothing while it is open, which the platform\n * does when its focus fixup runs after the slotted content changes.\n *\n * `relatedTarget` is the test: a Tab or a click inside names where focus\n * went, and a modal dialog means it cannot have gone outside. The window\n * losing focus also reports null, hence the `document.hasFocus()` guard --\n * without it, switching tabs would pull focus back on return.\n */\n private onFocusOut = (event: FocusEvent) => {\n if (!this.open || event.relatedTarget) return;\n requestAnimationFrame(() => {\n if (document.hasFocus()) this.ensureFocusInside();\n });\n };\n\n /** Focus inside the open dialog, unless it is already there. */\n private ensureFocusInside() {\n const dialog = this.dialog;\n if (!this.open || !dialog?.isConnected || !dialog.open) return;\n if (dialog.matches(':focus-within')) return;\n const [first] = getFocusableElements(dialog);\n (first ?? dialog).focus();\n }\n\n private closeDialog() {\n const dialog = this.dialog;\n this.unlockScroll();\n if (dialog?.open) dialog.close();\n }\n\n /** Fires on Escape. Blocking it is how a non-dismissable modal stays put. */\n private onCancel = (event: Event) => {\n if (!this.dismissable) {\n event.preventDefault();\n return;\n }\n // Let it close; `close` does the state mirroring.\n };\n\n /**\n * Mirrors a close the browser made — Escape, or the dialog being closed by\n * anything other than this element — back into `open`, which then announces\n * it through the watch above.\n */\n private onClose = () => {\n this.unlockScroll();\n if (this.open) this.open = false;\n };\n\n /**\n * A click on the dialog element itself is a click on the overlay: the panel\n * is an inner box, so anything landing on the dialog missed the content.\n */\n private onDialogClick = (event: MouseEvent) => {\n if (!this.dismissable || event.target !== this.dialog) return;\n this.open = false;\n };\n\n private accessibleName() {\n if (this.label) return this.label;\n const text = this.el.textContent?.trim();\n return text ? text.slice(0, 120) : undefined;\n }\n\n render() {\n return (\n <Host>\n <dialog\n part=\"dialog\"\n class=\"dialog\"\n aria-label={this.accessibleName()}\n onCancel={this.onCancel}\n onFocusout={this.onFocusOut}\n onClose={this.onClose}\n onClick={this.onDialogClick}\n >\n <div class=\"panel\" part=\"panel\">\n {this.showCloseButton && (\n <button\n class=\"close\"\n part=\"close\"\n type=\"button\"\n aria-label=\"Close\"\n onClick={() => this.hide()}\n >\n <svg\n viewBox=\"0 0 16 16\"\n width=\"16\"\n height=\"16\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <path\n d=\"M4 4l8 8M12 4l-8 8\"\n stroke=\"currentColor\"\n stroke-width=\"1.6\"\n stroke-linecap=\"round\"\n fill=\"none\"\n />\n </svg>\n </button>\n )}\n <slot />\n </div>\n </dialog>\n </Host>\n );\n }\n}\n"],"mappings":"iGAGA,IAAIA,EAAoBC,IACvB,UAAWA,EAAQC,kBAAoB,WAAY,OAAOD,EAAQC,kBAClE,OAAOD,EAAQE,eAAiB,MAAQF,EAAQG,iBAAiBC,OAAS,CAAC,EAE5E,IAAIC,EAAwBC,IAC3B,MAAMC,EAAW,CAChB,UACA,yBACA,wBACA,yBACA,2BACA,mDACA,mCACCC,KAAK,KACP,OAAOC,MAAMC,KAAKJ,EAAUK,iBAAiBJ,IAAWK,QAAQZ,IAC/D,GAAIA,EAAQa,aAAa,aAAeb,EAAQc,aAAa,iBAAmB,OAAQ,OAAO,MAC/F,OAAOf,EAAiBC,EAAQ,GAC/B,ECpBH,MAAMe,EAAa,IAAM,8tC,MC4CZC,EAAOC,EAAA,MAAAD,UAAAE,E,+IAIsBC,KAAO,MAGtBC,KAAoB,KAOrCC,MAGAC,YAAc,KAGdC,gBAAkB,KAGjBC,aAODC,cAAqC,KAE7C,gBAAAC,GACE,GAAIC,KAAKR,KAAMQ,KAAKC,Y,CAGtB,oBAAAC,GAEEF,KAAKG,c,CAKP,UAAMC,GACJJ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,OAAOM,KAAKN,MAC5B,MAAM2C,EAAOrC,KAAKY,GAAG0B,aAAaC,OAClC,OAAOF,EAAOA,EAAKG,MAAM,EAAG,KAAOC,S,CAGrC,MAAAC,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,4CACHF,EAAA,UAAAE,IAAA,2CACEC,KAAK,SACLC,MAAM,SAAQ,aACF/C,KAAKoC,iBACjBL,SAAU/B,KAAK+B,SACfiB,WAAYhD,KAAKqB,WACjBY,QAASjC,KAAKiC,QACdgB,QAASjD,KAAKkC,eAEdS,EAAA,OAAAE,IAAA,2CAAKE,MAAM,QAAQD,KAAK,SACrB9C,KAAKJ,iBACJ+C,EAAA,UAAAE,IAAA,2CACEE,MAAM,QACND,KAAK,QACLI,KAAK,SAAQ,aACF,QACXD,QAAS,IAAMjD,KAAKK,QAEpBsC,EAAA,OAAAE,IAAA,2CACEM,QAAQ,YACRC,MAAM,KACNC,OAAO,KAAI,cACC,OACZC,UAAU,SAEVX,EAAA,QAAAE,IAAA,2CACEU,EAAE,qBACFC,OAAO,eAAc,eACR,MAAK,iBACH,QACfC,KAAK,WAKbd,EAAA,QAAAE,IAAA,+C","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{t,p as e,H as i,c as s,h as r,a}from"./index.js";import{o,p as n}from"./p-CC7AyfOt.js";import{c as l}from"./p-DfpCerXM.js";import{i as c,K as p}from"./p-g4FlTDZx.js";import{g as h,r as d}from"./p-CAz7-p8y.js";import{b as f,p as u,a as m,f as b}from"./p-BmcsJLdy.js";import{a as v}from"./p-Cr6IXrUk.js";import{d as g}from"./p-CkFjPRTe.js";const y=()=>`:host{display:block;--pf-option-text:var(--pf-multiselect-text);--pf-option-text-disabled:var(--pf-multiselect-text-muted);--pf-option-active-bg:var(--pf-multiselect-active-bg);--pf-option-active-text:var(--pf-multiselect-active-text)}:host([hidden]){display:none}.field{display:grid;gap:var(--space-1)}.label{color:var(--pf-multiselect-text);font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}.required{color:var(--pf-multiselect-invalid-border);margin-inline-start:var(--space-1)}.trigger{align-items:center;background:var(--pf-multiselect-bg);border:1px solid var(--pf-multiselect-border);border-radius:var(--radius-md);color:var(--pf-multiselect-text);cursor:pointer;display:flex;font-family:inherit;font-size:var(--font-size-sm);gap:var(--space-2);justify-content:space-between;padding:var(--space-2) var(--space-3);text-align:start;width:100%}.trigger:focus-visible{border-color:var(--pf-multiselect-focus-border);box-shadow:var(--pf-focus-ring);outline:none}.trigger:disabled{cursor:not-allowed;opacity:0.6}.trigger--invalid{border-color:var(--pf-multiselect-invalid-border)}.chips{display:flex;flex-wrap:wrap;gap:var(--space-1);min-width:0}.chip{background:var(--pf-multiselect-bg-subtle);border-radius:var(--radius-sm);font-size:var(--font-size-xs);padding:2px var(--space-2)}.placeholder{color:var(--pf-multiselect-text-muted)}.chevron{align-items:center;display:inline-flex;flex-shrink:0;transition:transform var(--pf-transition-fast)}:host([open]) .chevron{transform:rotate(180deg)}@media (prefers-reduced-motion: reduce){.chevron{transition:none}}.description{color:var(--pf-multiselect-text-muted);font-size:var(--font-size-xs);margin:0}.error{color:var(--pf-multiselect-invalid-border);font-size:var(--font-size-xs);margin:0}.listbox{inset:auto;margin:0;background:var(--pf-multiselect-bg);border:1px solid var(--pf-multiselect-border);border-radius:var(--radius-md);box-shadow:var(--pf-elevation-popover-shadow);padding:var(--space-1)}.listbox:popover-open{animation:pf-multi-select-in var(--pf-transition-enter)}@keyframes pf-multi-select-in{from{opacity:0;transform:translateY(-4px)}}@media (prefers-reduced-motion: reduce){.listbox:popover-open{animation:none}}`;const x={[p.ArrowDown]:"next",[p.ArrowUp]:"previous",[p.Home]:"first",[p.End]:"last"};const k=e(class t extends i{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.pfChange=s(this,"pfChange");this.pfOpenChange=s(this,"pfOpenChange");this.internals=this.attachInternals()}get el(){return this}internals;name;value="";open=false;label;description;error;placeholder="Select options";required=false;disabled=false;maxVisibleOptions;pfChange;pfOpenChange;chips=[];initialValue="";stopObserving;activeOption=null;warnedAboutSeparator=false;componentWillLoad(){this.initialValue=this.value??"";this.syncFormState();this.syncOptions()}componentDidRender(){this.syncActiveDescendant()}disconnectedCallback(){this.stopObserving?.()}syncFormState(){const t=this.values();if(t.length===0||!this.name){this.internals.setFormValue(null)}else{const e=new FormData;for(const i of t)e.append(this.name,i);this.internals.setFormValue(e)}v(this.internals,t.length>0,this.required,this.error)}syncOptions(){const t=this.values();const e=[];for(const e of this.options()){const i=t.includes(this.optionValue(e));e.selected=i}for(const i of t){const t=this.options().find((t=>this.optionValue(t)===i));if(t)e.push(t.textContent?.trim()??i)}this.chips=e;this.warnAboutSeparators()}warnAboutSeparators(){if(this.warnedAboutSeparator)return;const t=f(this.options().map((t=>this.optionValue(t))));if(t.length===0)return;this.warnedAboutSeparator=true;console.warn(`[pf-multi-select] option values cannot contain a comma, because \`value\` is a `+`comma-separated list: ${t.join(" ")}`)}syncOpen(t,e){if(t)this.showListbox();else this.hideListbox();if(t!==e)this.pfOpenChange.emit({open:t})}async show(){if(!this.disabled)this.open=true}async hide(){this.open=false}async checkValidity(){return this.internals.checkValidity()}async reportValidity(){return this.internals.reportValidity()}async getValidationMessage(){return this.internals.validationMessage}formResetCallback(){this.value=this.initialValue}async refresh(){this.syncOptions()}onSlotChange=()=>{this.syncOptions()};values(){return u(this.value)}options(){return Array.from(this.el.querySelectorAll("pf-option"))}enabled(){return this.options().filter((t=>!t.hasAttribute("disabled")))}optionValue(t){return t.value??t.getAttribute("value")??""}get listbox(){return this.el.shadowRoot?.querySelector('[part="listbox"]')??null}get trigger(){return this.el.shadowRoot?.querySelector('[part="trigger"]')??null}showListbox(){const t=this.listbox;if(this.disabled||!t||t.matches(":popover-open"))return;t.showPopover();this.stopObserving?.();this.stopObserving=o({getAnchor:()=>this.trigger,getFloating:()=>t,matchAnchorWidth:true,flip:true,onChange:({left:e,top:i,width:s,minWidth:r})=>{n(t,e,i);if(s!==undefined)t.style.width=`${s}px`;if(r!==undefined)t.style.minWidth=`${r}px`}});const e=this.values();const i=this.options().find((t=>e.includes(this.optionValue(t))&&!t.hasAttribute("disabled")))??this.enabled()[0];this.setActive(i??null)}hideListbox(){this.stopObserving?.();this.stopObserving=undefined;const t=this.listbox;if(t?.matches(":popover-open"))t.hidePopover()}onToggle=t=>{const e=t.newState==="open";if(this.open!==e)this.open=e;if(!e)this.trigger?.focus()};setActive(t){for(const e of this.options()){if(e!==t)e.active=false}if(t)t.active=true;this.activeOption=t;this.syncActiveDescendant();if(t&&typeof t.scrollIntoView==="function"){t.scrollIntoView({block:"nearest"})}}syncActiveDescendant(){const t=this.trigger;if(!t||!("ariaActiveDescendantElement"in t))return;t.ariaActiveDescendantElement=this.open?this.activeOption:null}toggle(t){if(t.hasAttribute("disabled")||this.disabled)return;const e=m(this.values(),this.optionValue(t));this.value=b(e);this.pfChange.emit({value:this.value,values:e})}handleOptionSelect(t){t.stopPropagation();const e=this.options().find((e=>this.optionValue(e)===t.detail.value));if(e)this.toggle(e)}move(t){const e=this.options();const i=h(e,(t=>t.hasAttribute("disabled")));const s=this.activeOption?e.indexOf(this.activeOption):-1;const r=d(t,i,s);if(r!==-1)this.setActive(e[r]??null)}handleKeyDown(t){if(this.disabled||t.defaultPrevented)return;const e=x[t.key];if(e){t.preventDefault();if(!this.open)this.open=true;else this.move(e);return}if(c(t.key)){t.preventDefault();if(!this.open)this.open=true;else if(this.activeOption)this.toggle(this.activeOption)}}render(){const t=l(this.description&&"description",this.error&&"error");return r(a,{key:"68ee3f2e23741c14f955523bf3cbcb10e4fc3e71"},r("div",{key:"ffbfe398e848a5134740908327bca92afe74f39c",class:"field",part:"field"},this.label&&r("label",{key:"7fe73bdad7836709b5e30536412283edf72abd37",class:"label",part:"label",htmlFor:"trigger"},this.label,this.required&&r("span",{key:"1cecfe1256d01e6770417b030a8aba22ca65f802",class:"required","aria-hidden":"true"},"*")),r("button",{key:"03c611dff79a67cda5478d586eaa301fd4178843",id:"trigger",part:"trigger",class:{trigger:true,"trigger--invalid":Boolean(this.error)},type:"button",role:"combobox",disabled:this.disabled,"aria-haspopup":"listbox","aria-expanded":this.open?"true":"false","aria-controls":"listbox","aria-invalid":this.error?"true":null,"aria-required":this.required?"true":null,"aria-describedby":t,onClick:()=>{if(!this.disabled)this.open=!this.open}},this.chips.length>0?r("span",{class:"chips"},this.chips.map((t=>r("span",{key:t,class:"chip",part:"chip"},t)))):r("span",{class:"placeholder"},this.placeholder),r("span",{key:"a31710bfb23f890b33a010962b93792424b71e36",class:"chevron","aria-hidden":"true"},r("pf-icon",{key:"517857c8ab460c5a60a50d42c3ff68d986e0c744",name:"chevron-down"}))),this.description&&r("p",{key:"549f06c9be1d291d4654ac63c6f03f749453113d",class:"description",part:"description",id:"description"},this.description),this.error&&r("p",{key:"0da14622c434e02f6098a61382b22ee2b74a3f84",class:"error",part:"error",id:"error"},this.error)),r("div",{key:"f62c24c5870b4a05bcba73969af4721ed52bf4e3",id:"listbox",part:"listbox",class:"listbox",popover:"auto",role:"listbox","aria-multiselectable":"true","aria-label":this.label??this.placeholder,style:this.maxVisibleOptions?{maxHeight:`calc(${this.maxVisibleOptions} * 36px)`,overflowY:"auto"}:undefined,onToggle:this.onToggle},r("slot",{key:"6d8c84b2173904d99f7b3583cbb2203636cd6214",onSlotchange:this.onSlotChange})))}static get formAssociated(){return true}static get watchers(){return{name:[{syncFormState:0}],value:[{syncFormState:0},{syncOptions:0}],error:[{syncFormState:0}],required:[{syncFormState:0}],open:[{syncOpen:0}]}}static get style(){return y()}},[833,"pf-multi-select",{name:[513],value:[1537],open:[1540],label:[1],description:[1],error:[1],placeholder:[1],required:[516],disabled:[516],maxVisibleOptions:[2,"max-visible-options"],chips:[32],show:[64],hide:[64],checkValidity:[64],reportValidity:[64],getValidationMessage:[64],refresh:[64]},[[0,"pfOptionSelect","handleOptionSelect"],[0,"keydown","handleKeyDown"]],{name:[{syncFormState:0}],value:[{syncFormState:0},{syncOptions:0}],error:[{syncFormState:0}],required:[{syncFormState:0}],open:[{syncOpen:0}]}]);function w(){if(typeof customElements==="undefined"){return}const e=["pf-multi-select","pf-icon"];e.forEach((e=>{switch(e){case"pf-multi-select":if(!customElements.get(t(e))){customElements.define(t(e),k)}break;case"pf-icon":if(!customElements.get(t(e))){g()}break}}))}w();const S=k;const O=w;export{S as PfMultiSelect,O as defineCustomElement};
1
+ import{t,p as e,H as i,c as s,h as r,a}from"./index.js";import{o,p as n}from"./p-CC7AyfOt.js";import{c as l}from"./p-DfpCerXM.js";import{i as c,K as p}from"./p-g4FlTDZx.js";import{g as d,r as h}from"./p-CAz7-p8y.js";import{b as f,p as u,a as m,f as b}from"./p-BmcsJLdy.js";import{a as v}from"./p-Cr6IXrUk.js";import{c as g}from"./p-Cy_kHPeC.js";import{d as y}from"./p-CkFjPRTe.js";const x=()=>`:host{display:block;--pf-option-text:var(--pf-multiselect-text);--pf-option-text-disabled:var(--pf-multiselect-text-muted);--pf-option-active-bg:var(--pf-multiselect-active-bg);--pf-option-active-text:var(--pf-multiselect-active-text)}:host([hidden]){display:none}.field{display:grid;gap:var(--space-1)}.label{color:var(--pf-multiselect-text);font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}.required{color:var(--pf-multiselect-invalid-border);margin-inline-start:var(--space-1)}.trigger{align-items:center;background:var(--pf-multiselect-bg);border:1px solid var(--pf-multiselect-border);border-radius:var(--radius-md);color:var(--pf-multiselect-text);cursor:pointer;display:flex;font-family:inherit;font-size:var(--font-size-sm);gap:var(--space-2);justify-content:space-between;padding:var(--space-2) var(--space-3);text-align:start;width:100%}.trigger:focus-visible{border-color:var(--pf-multiselect-focus-border);box-shadow:var(--pf-focus-ring);outline:none}.trigger:disabled{cursor:not-allowed;opacity:0.6}.trigger--invalid{border-color:var(--pf-multiselect-invalid-border)}.chips{display:flex;flex-wrap:wrap;gap:var(--space-1);min-width:0}.chip{background:var(--pf-multiselect-bg-subtle);border-radius:var(--radius-sm);font-size:var(--font-size-xs);padding:2px var(--space-2)}.placeholder{color:var(--pf-multiselect-text-muted)}.chevron{align-items:center;display:inline-flex;flex-shrink:0;transition:transform var(--pf-transition-fast)}:host([open]) .chevron{transform:rotate(180deg)}@media (prefers-reduced-motion: reduce){.chevron{transition:none}}.description{color:var(--pf-multiselect-text-muted);font-size:var(--font-size-xs);margin:0}.error{color:var(--pf-multiselect-invalid-border);font-size:var(--font-size-xs);margin:0}.listbox{inset:auto;margin:0;background:var(--pf-multiselect-bg);border:1px solid var(--pf-multiselect-border);border-radius:var(--radius-md);box-shadow:var(--pf-elevation-popover-shadow);padding:var(--space-1)}.listbox:popover-open{animation:pf-multi-select-in var(--pf-transition-enter)}@keyframes pf-multi-select-in{from{opacity:0;transform:translateY(-4px)}}@media (prefers-reduced-motion: reduce){.listbox:popover-open{animation:none}}`;const k={[p.ArrowDown]:"next",[p.ArrowUp]:"previous",[p.Home]:"first",[p.End]:"last"};const w=e(class t extends i{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow();this.pfChange=s(this,"pfChange");this.pfOpenChange=s(this,"pfOpenChange");this.internals=this.attachInternals()}get el(){return this}internals;name;value="";open=false;label;description;error;placeholder="Select options";required=false;disabled=false;maxVisibleOptions;pfChange;pfOpenChange;chips=[];initialValue="";stopObserving;activeOption=null;warnedAboutSeparator=false;componentWillLoad(){this.initialValue=this.value??"";this.syncFormState();this.syncOptions()}componentDidRender(){this.syncActiveDescendant()}disconnectedCallback(){this.stopObserving?.()}syncFormState(){const t=this.values();if(t.length===0||!this.name){this.internals.setFormValue(null)}else{const e=new FormData;for(const i of t)e.append(this.name,i);this.internals.setFormValue(e)}v(this.internals,t.length>0,this.required,this.error)}syncOptions(){const t=this.values();const e=[];for(const e of this.options()){const i=t.includes(this.optionValue(e));e.selected=i}for(const i of t){const t=this.options().find((t=>this.optionValue(t)===i));if(t)e.push(t.textContent?.trim()??i)}this.chips=e;this.warnAboutSeparators()}warnAboutSeparators(){if(this.warnedAboutSeparator)return;const t=f(this.options().map((t=>this.optionValue(t))));if(t.length===0)return;this.warnedAboutSeparator=true;console.warn(`[pf-multi-select] option values cannot contain a comma, because \`value\` is a `+`comma-separated list: ${t.join(" ")}`)}syncOpen(t,e){if(t)this.showListbox();else this.hideListbox();if(t!==e)this.pfOpenChange.emit({open:t})}async show(){if(!this.disabled)this.open=true}async hide(){this.open=false}async checkValidity(){return this.internals.checkValidity()}async reportValidity(){return this.internals.reportValidity()}async getValidationMessage(){return this.internals.validationMessage}formResetCallback(){this.value=this.initialValue}async refresh(){this.syncOptions()}onSlotChange=()=>{this.syncOptions()};values(){return u(this.value)}options(){return Array.from(this.el.querySelectorAll("pf-option"))}enabled(){return this.options().filter((t=>!t.hasAttribute("disabled")))}optionValue(t){return t.value??t.getAttribute("value")??""}get listbox(){return this.el.shadowRoot?.querySelector('[part="listbox"]')??null}get trigger(){return this.el.shadowRoot?.querySelector('[part="trigger"]')??null}showListbox(){const t=this.listbox;if(this.disabled||!t||t.matches(":popover-open"))return;t.showPopover();this.stopObserving?.();this.stopObserving=o({getAnchor:()=>this.trigger,getFloating:()=>t,matchAnchorWidth:true,flip:true,onChange:({left:e,top:i,width:s,minWidth:r})=>{n(t,e,i);if(s!==undefined)t.style.width=`${s}px`;if(r!==undefined)t.style.minWidth=`${r}px`}});const e=this.values();const i=this.options().find((t=>e.includes(this.optionValue(t))&&!t.hasAttribute("disabled")))??this.enabled()[0];this.setActive(i??null)}hideListbox(){this.stopObserving?.();this.stopObserving=undefined;const t=this.listbox;if(t?.matches(":popover-open"))t.hidePopover()}onToggle=t=>{const e=t.newState==="open";if(this.open!==e)this.open=e;if(!e)this.trigger?.focus()};setActive(t){for(const e of this.options()){if(e!==t)e.active=false}if(t)t.active=true;this.activeOption=t;this.syncActiveDescendant();if(t&&typeof t.scrollIntoView==="function"){t.scrollIntoView({block:"nearest"})}}syncActiveDescendant(){const t=this.trigger;if(!t||!("ariaActiveDescendantElement"in t))return;t.ariaActiveDescendantElement=this.open?this.activeOption:null}toggle(t){if(t.hasAttribute("disabled")||this.disabled)return;const e=m(this.values(),this.optionValue(t));this.value=b(e);this.pfChange.emit({value:this.value,values:e})}handleOptionSelect(t){t.stopPropagation();const e=this.options().find((e=>this.optionValue(e)===t.detail.value));if(e)this.toggle(e)}move(t){const e=this.options();const i=d(e,(t=>t.hasAttribute("disabled")));const s=this.activeOption?e.indexOf(this.activeOption):-1;const r=h(t,i,s);if(r!==-1)this.setActive(e[r]??null)}handleKeyDown(t){if(this.disabled||t.defaultPrevented)return;const e=k[t.key];if(e){t.preventDefault();if(!this.open)this.open=true;else this.move(e);return}if(c(t.key)){t.preventDefault();if(!this.open)this.open=true;else if(this.activeOption)this.toggle(this.activeOption)}}render(){const t=l(this.description&&"description",this.error&&"error");return r(a,{key:"84f645358443d6dc41515a835cf0c7136a6f2a30"},r("div",{key:"2abaf9886654a5cef6756a4c566f61e37c7c876a",class:"field",part:"field"},this.label&&r("label",{key:"76f9cf451c6fba652494862a0fa05e320a4790c4",class:"label",part:"label",htmlFor:"trigger"},this.label,this.required&&r("span",{key:"9f4a8074bc2ef06ae7256267bab07d9baf52dc2c",class:"required","aria-hidden":"true"},"*")),r("button",{key:"a5a15ff1c857e6f727bc43131741ee95ba345efd",id:"trigger","aria-label":g(this.el,this.label),part:"trigger",class:{trigger:true,"trigger--invalid":Boolean(this.error)},type:"button",role:"combobox",disabled:this.disabled,"aria-haspopup":"listbox","aria-expanded":this.open?"true":"false","aria-controls":"listbox","aria-invalid":this.error?"true":null,"aria-required":this.required?"true":null,"aria-describedby":t,onClick:()=>{if(!this.disabled)this.open=!this.open}},this.chips.length>0?r("span",{class:"chips"},this.chips.map((t=>r("span",{key:t,class:"chip",part:"chip"},t)))):r("span",{class:"placeholder"},this.placeholder),r("span",{key:"9b662f3899c243059b07b4ecc0166b74b97501cc",class:"chevron","aria-hidden":"true"},r("pf-icon",{key:"5a869e8d9d1aa023e57ed556afc613544f54424f",name:"chevron-down"}))),this.description&&r("p",{key:"d231f94ad697dc52d3115cf13c0b47f0b20045a6",class:"description",part:"description",id:"description"},this.description),this.error&&r("p",{key:"dcc0995d743ea214575031de7225f0bce71aebb6",class:"error",part:"error",id:"error"},this.error)),r("div",{key:"c161c902c9859dd71dda4967dc4e074db29dd448",id:"listbox",part:"listbox",class:"listbox",popover:"auto",role:"listbox","aria-multiselectable":"true","aria-label":this.label??this.placeholder,style:this.maxVisibleOptions?{maxHeight:`calc(${this.maxVisibleOptions} * 36px)`,overflowY:"auto"}:undefined,onToggle:this.onToggle},r("slot",{key:"8fec52209e91211ba15d8c32f53d111b2058b76f",onSlotchange:this.onSlotChange})))}static get formAssociated(){return true}static get watchers(){return{name:[{syncFormState:0}],value:[{syncFormState:0},{syncOptions:0}],error:[{syncFormState:0}],required:[{syncFormState:0}],open:[{syncOpen:0}]}}static get style(){return x()}},[833,"pf-multi-select",{name:[513],value:[1537],open:[1540],label:[1],description:[1],error:[1],placeholder:[1],required:[516],disabled:[516],maxVisibleOptions:[2,"max-visible-options"],chips:[32],show:[64],hide:[64],checkValidity:[64],reportValidity:[64],getValidationMessage:[64],refresh:[64]},[[0,"pfOptionSelect","handleOptionSelect"],[0,"keydown","handleKeyDown"]],{name:[{syncFormState:0}],value:[{syncFormState:0},{syncOptions:0}],error:[{syncFormState:0}],required:[{syncFormState:0}],open:[{syncOpen:0}]}]);function C(){if(typeof customElements==="undefined"){return}const e=["pf-multi-select","pf-icon"];e.forEach((e=>{switch(e){case"pf-multi-select":if(!customElements.get(t(e))){customElements.define(t(e),w)}break;case"pf-icon":if(!customElements.get(t(e))){y()}break}}))}C();const S=w;const O=C;export{S as PfMultiSelect,O as defineCustomElement};
2
2
  //# sourceMappingURL=pf-multi-select.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["pfMultiSelectCss","MOVES","Keys","ArrowDown","ArrowUp","Home","End","PfMultiSelect","__stencil_proxyCustomElement","HTMLElement","internals","name","value","open","label","description","error","placeholder","required","disabled","maxVisibleOptions","pfChange","pfOpenChange","chips","initialValue","stopObserving","activeOption","warnedAboutSeparator","componentWillLoad","this","syncFormState","syncOptions","componentDidRender","syncActiveDescendant","disconnectedCallback","values","length","setFormValue","data","FormData","append","applyControlValidity","chosen","labels","option","options","selected","includes","optionValue","find","candidate","push","textContent","trim","warnAboutSeparators","offenders","assertSeparableValues","map","o","console","warn","join","syncOpen","next","previous","showListbox","hideListbox","emit","show","hide","checkValidity","reportValidity","getValidationMessage","validationMessage","formResetCallback","refresh","onSlotChange","parseValueList","Array","from","el","querySelectorAll","enabled","filter","hasAttribute","getAttribute","listbox","shadowRoot","querySelector","trigger","panel","matches","showPopover","observeAnchoredPosition","getAnchor","getFloating","matchAnchorWidth","flip","onChange","left","top","width","minWidth","placePopover","undefined","style","first","setActive","hidePopover","onToggle","event","nowOpen","newState","focus","other","active","scrollIntoView","block","ariaActiveDescendantElement","toggle","toggleValueInList","formatValueList","handleOptionSelect","stopPropagation","detail","move","action","enabledIndexes","getEnabledIndexes","current","indexOf","resolveListMove","handleKeyDown","defaultPrevented","key","preventDefault","isActivationKey","render","describedBy","composeDescribedBy","h","Host","class","part","htmlFor","id","Boolean","type","role","onClick","chip","popover","maxHeight","overflowY","onSlotchange"],"sources":["src/components/pf-multi-select/pf-multi-select.css?tag=pf-multi-select&encapsulation=shadow","src/components/pf-multi-select/pf-multi-select.tsx"],"sourcesContent":["/*\n * The generic set pf-option reads, mapped to this control's own family — see\n * pf-option.css.\n */\n:host {\n display: block;\n --pf-option-text: var(--pf-multiselect-text);\n --pf-option-text-disabled: var(--pf-multiselect-text-muted);\n --pf-option-active-bg: var(--pf-multiselect-active-bg);\n --pf-option-active-text: var(--pf-multiselect-active-text);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-multiselect-text);\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-multiselect-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.trigger {\n align-items: center;\n background: var(--pf-multiselect-bg);\n border: 1px solid var(--pf-multiselect-border);\n border-radius: var(--radius-md);\n color: var(--pf-multiselect-text);\n cursor: pointer;\n display: flex;\n font-family: inherit;\n font-size: var(--font-size-sm);\n gap: var(--space-2);\n justify-content: space-between;\n padding: var(--space-2) var(--space-3);\n text-align: start;\n width: 100%;\n}\n\n.trigger:focus-visible {\n border-color: var(--pf-multiselect-focus-border);\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.trigger--invalid {\n border-color: var(--pf-multiselect-invalid-border);\n}\n\n.chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-1);\n min-width: 0;\n}\n\n.chip {\n background: var(--pf-multiselect-bg-subtle);\n border-radius: var(--radius-sm);\n font-size: var(--font-size-xs);\n padding: 2px var(--space-2);\n}\n\n.placeholder {\n color: var(--pf-multiselect-text-muted);\n}\n\n.chevron {\n align-items: center;\n display: inline-flex;\n flex-shrink: 0;\n transition: transform var(--pf-transition-fast);\n}\n\n:host([open]) .chevron {\n transform: rotate(180deg);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n}\n\n.description {\n color: var(--pf-multiselect-text-muted);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-multiselect-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/* See src/place-popover.ts: the UA stylesheet centres a popover otherwise. */\n.listbox {\n inset: auto;\n margin: 0;\n background: var(--pf-multiselect-bg);\n border: 1px solid var(--pf-multiselect-border);\n border-radius: var(--radius-md);\n box-shadow: var(--pf-elevation-popover-shadow);\n padding: var(--space-1);\n}\n\n.listbox:popover-open {\n animation: pf-multi-select-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-multi-select-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .listbox:popover-open {\n animation: none;\n }\n}\n","import {\n composeDescribedBy,\n formatValueList,\n getEnabledIndexes,\n isActivationKey,\n Keys,\n observeAnchoredPosition,\n parseValueList,\n resolveListMove,\n toggleValueInList,\n assertSeparableValues,\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 multi-choice select over `pf-option` children.\n *\n * **It submits one entry per chosen value from a single control.**\n * `setFormValue` takes a `FormData`, and a key repeated in it is submitted\n * once per value — measured, and the same shape the React component gets from\n * rendering one hidden `<input>` per selection. So a server reads\n * `data.getAll(name)` exactly as it would from a native multiple select.\n *\n * `value` is one comma-separated string, because that is what an attribute can\n * carry; `pfChange` also reports the parsed `values` array, which is what a\n * framework consumer usually wants. A value containing a comma cannot survive\n * that, so one is reported on the console rather than silently mangled.\n *\n * Shares `pf-option` with `pf-select` and `pf-combobox` through the generic\n * `--pf-option-*` set.\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 chip - each chosen value's chip in the trigger.\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-multi-select',\n styleUrl: 'pf-multi-select.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfMultiSelect {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Submitted under this name, once per chosen value. Reflected. */\n @Prop({ reflect: true }) name?: string;\n\n /** The chosen values, comma-separated. Reflected, so HTML can set it. */\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 options';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Options to show before the listbox scrolls. */\n @Prop() maxVisibleOptions?: number;\n\n /** Fires when the chosen set changes, with both representations. */\n @Event() pfChange!: EventEmitter<{ value: string; values: string[] }>;\n\n /** Fires whenever the listbox opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** The labels of the chosen options, for the trigger's chips. */\n @State() chips: string[] = [];\n\n private initialValue = '';\n private stopObserving?: () => void;\n private activeOption: HTMLElement | null = null;\n private warnedAboutSeparator = false;\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 }\n\n /*\n * `name` is watched here and not on the controls that pass a plain string to\n * `setFormValue`: those take their submission name from the reflected\n * attribute, so the platform picks a change up by itself. This one builds\n * the name *into* a FormData, so without the watch a name assigned after\n * load would never reach the submission.\n */\n @Watch('name')\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n const values = this.values();\n\n if (values.length === 0 || !this.name) {\n this.internals.setFormValue(null);\n } else {\n // One entry per value under the one name, which `data.getAll(name)`\n // reads back as an array.\n const data = new FormData();\n for (const value of values) data.append(this.name, value);\n this.internals.setFormValue(data);\n }\n\n applyControlValidity(this.internals, values.length > 0, this.required, this.error);\n }\n\n /** The value changed, so the children's `selected` and the chips follow. */\n @Watch('value')\n syncOptions() {\n const chosen = this.values();\n const labels: string[] = [];\n\n for (const option of this.options()) {\n const selected = chosen.includes(this.optionValue(option));\n (option as HTMLElement & { selected: boolean }).selected = selected;\n }\n\n // Chips in the order they were chosen, not the options' order.\n for (const value of chosen) {\n const option = this.options().find((candidate) => this.optionValue(candidate) === value);\n if (option) labels.push(option.textContent?.trim() ?? value);\n }\n\n this.chips = labels;\n this.warnAboutSeparators();\n }\n\n /**\n * One warning naming every offending value.\n *\n * A value holding a comma cannot round-trip through `value`, and failing\n * silently would show the right chips over a wrong submission.\n */\n private warnAboutSeparators() {\n if (this.warnedAboutSeparator) return;\n const offenders = assertSeparableValues(this.options().map((o) => this.optionValue(o)));\n if (offenders.length === 0) return;\n\n this.warnedAboutSeparator = true;\n console.warn(\n `[pf-multi-select] option values cannot contain a comma, because \\`value\\` is a ` +\n `comma-separated list: ${offenders.join(' ')}`,\n );\n }\n\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showListbox();\n else this.hideListbox();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n /** Re-reads the options, for a label edited in place. */\n @Method()\n async refresh(): Promise<void> {\n this.syncOptions();\n }\n\n private onSlotChange = () => {\n this.syncOptions();\n };\n\n private values(): string[] {\n return parseValueList(this.value);\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 matchAnchorWidth: true,\n flip: true,\n onChange: ({ left, top, width, minWidth }) => {\n placePopover(panel, left, top);\n if (width !== undefined) panel.style.width = `${width}px`;\n if (minWidth !== undefined) panel.style.minWidth = `${minWidth}px`;\n },\n });\n\n // Opens on the first chosen option, or the first selectable one.\n const chosen = this.values();\n const first =\n this.options().find(\n (option) => chosen.includes(this.optionValue(option)) && !option.hasAttribute('disabled'),\n ) ?? this.enabled()[0];\n this.setActive(first ?? null);\n }\n\n private hideListbox() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n const panel = this.listbox;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n 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 /** An element, not an IDREF: a cross-root IDREF resolves to nothing. */\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 /**\n * Toggles one value and keeps the listbox open — the difference from\n * `pf-select`, and the whole point of a multi-choice control: closing after\n * each pick would make choosing three things three round trips.\n */\n private toggle(option: HTMLElement) {\n if (option.hasAttribute('disabled') || this.disabled) return;\n\n const next = toggleValueInList(this.values(), this.optionValue(option));\n this.value = formatValueList(next);\n this.pfChange.emit({ value: this.value, values: next });\n }\n\n @Listen('pfOptionSelect')\n handleOptionSelect(event: CustomEvent<{ value: string }>) {\n event.stopPropagation();\n const option = this.options().find(\n (candidate) => this.optionValue(candidate) === event.detail.value,\n );\n if (option) this.toggle(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 @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 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) this.open = true;\n else if (this.activeOption) this.toggle(this.activeOption);\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 {this.chips.length > 0 ? (\n <span class=\"chips\">\n {this.chips.map((chip) => (\n <span key={chip} class=\"chip\" part=\"chip\">\n {chip}\n </span>\n ))}\n </span>\n ) : (\n <span class=\"placeholder\">{this.placeholder}</span>\n )}\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 /* The one ARIA difference from pf-select, and the important one. */\n aria-multiselectable=\"true\"\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"],"mappings":"yVAAA,MAAMA,EAAmB,IAAM,wpEC+B/B,MAAMC,EAA8C,CAClD,CAACC,EAAKC,WAAY,OAClB,CAACD,EAAKE,SAAU,WAChB,CAACF,EAAKG,MAAO,QACb,CAACH,EAAKI,KAAM,Q,MAmCDC,EAAaC,EAAA,MAAAD,UAAAE,E,sNAELC,UAGMC,KAGeC,MAAQ,GAGRC,KAAO,MAEvCC,MAEAC,YAEAC,MAEAC,YAAc,iBAEGC,SAAW,MAEXC,SAAW,MAG5BC,kBAGCC,SAGAC,aAGAC,MAAkB,GAEnBC,aAAe,GACfC,cACAC,aAAmC,KACnCC,qBAAuB,MAE/B,iBAAAC,GACEC,KAAKL,aAAeK,KAAKjB,OAAS,GAClCiB,KAAKC,gBACLD,KAAKE,a,CAGP,kBAAAC,GACEH,KAAKI,sB,CAGP,oBAAAC,GACEL,KAAKJ,iB,CAcP,aAAAK,GACE,MAAMK,EAASN,KAAK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xH,KAAKV,SAAUU,KAAKhB,MAAQgB,KAAKhB,IAAI,GAG3CgB,KAAKN,MAAMa,OAAS,EACnBwG,EAAA,QAAME,MAAM,SACTjH,KAAKN,MAAMkC,KAAK6F,GACfV,EAAA,QAAMN,IAAKgB,EAAMR,MAAM,OAAOC,KAAK,QAChCO,MAKPV,EAAA,QAAME,MAAM,eAAejH,KAAKZ,aAElC2H,EAAA,QAAAN,IAAA,2CAAMQ,MAAM,UAAS,cAAa,QAChCF,EAAA,WAAAN,IAAA,2CAAS3H,KAAK,mBAIjBkB,KAAKd,aACJ6H,EAAA,KAAAN,IAAA,2CAAGQ,MAAM,cAAcC,KAAK,cAAcE,GAAG,eAC1CpH,KAAKd,aAGTc,KAAKb,OACJ4H,EAAA,KAAAN,IAAA,2CAAGQ,MAAM,QAAQC,KAAK,QAAQE,GAAG,SAC9BpH,KAAKb,QAKZ4H,EAAA,OAAAN,IAAA,2CACEW,GAAG,UACHF,KAAK,UACLD,MAAM,UACNS,QAAQ,OACRH,KAAK,UAAS,uBAEO,OAAM,aACfvH,KAAKf,OAASe,KAAKZ,YAC/BwF,MACE5E,KAAKT,kBACD,CAAEoI,UAAW,QAAQ3H,KAAKT,4BAA6BqI,UAAW,QAClEjD,UAENK,SAAUhF,KAAKgF,UAEf+B,EAAA,QAAAN,IAAA,2CAAMoB,aAAc7H,KAAK+C,gB","ignoreList":[]}
1
+ {"version":3,"names":["pfMultiSelectCss","MOVES","Keys","ArrowDown","ArrowUp","Home","End","PfMultiSelect","__stencil_proxyCustomElement","HTMLElement","internals","name","value","open","label","description","error","placeholder","required","disabled","maxVisibleOptions","pfChange","pfOpenChange","chips","initialValue","stopObserving","activeOption","warnedAboutSeparator","componentWillLoad","this","syncFormState","syncOptions","componentDidRender","syncActiveDescendant","disconnectedCallback","values","length","setFormValue","data","FormData","append","applyControlValidity","chosen","labels","option","options","selected","includes","optionValue","find","candidate","push","textContent","trim","warnAboutSeparators","offenders","assertSeparableValues","map","o","console","warn","join","syncOpen","next","previous","showListbox","hideListbox","emit","show","hide","checkValidity","reportValidity","getValidationMessage","validationMessage","formResetCallback","refresh","onSlotChange","parseValueList","Array","from","el","querySelectorAll","enabled","filter","hasAttribute","getAttribute","listbox","shadowRoot","querySelector","trigger","panel","matches","showPopover","observeAnchoredPosition","getAnchor","getFloating","matchAnchorWidth","flip","onChange","left","top","width","minWidth","placePopover","undefined","style","first","setActive","hidePopover","onToggle","event","nowOpen","newState","focus","other","active","scrollIntoView","block","ariaActiveDescendantElement","toggle","toggleValueInList","formatValueList","handleOptionSelect","stopPropagation","detail","move","action","enabledIndexes","getEnabledIndexes","current","indexOf","resolveListMove","handleKeyDown","defaultPrevented","key","preventDefault","isActivationKey","render","describedBy","composeDescribedBy","h","Host","class","part","htmlFor","id","controlAriaLabel","Boolean","type","role","onClick","chip","popover","maxHeight","overflowY","onSlotchange"],"sources":["src/components/pf-multi-select/pf-multi-select.css?tag=pf-multi-select&encapsulation=shadow","src/components/pf-multi-select/pf-multi-select.tsx"],"sourcesContent":["/*\n * The generic set pf-option reads, mapped to this control's own family — see\n * pf-option.css.\n */\n:host {\n display: block;\n --pf-option-text: var(--pf-multiselect-text);\n --pf-option-text-disabled: var(--pf-multiselect-text-muted);\n --pf-option-active-bg: var(--pf-multiselect-active-bg);\n --pf-option-active-text: var(--pf-multiselect-active-text);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.field {\n display: grid;\n gap: var(--space-1);\n}\n\n.label {\n color: var(--pf-multiselect-text);\n font-size: var(--font-size-sm);\n font-weight: var(--font-weight-medium);\n}\n\n.required {\n color: var(--pf-multiselect-invalid-border);\n margin-inline-start: var(--space-1);\n}\n\n.trigger {\n align-items: center;\n background: var(--pf-multiselect-bg);\n border: 1px solid var(--pf-multiselect-border);\n border-radius: var(--radius-md);\n color: var(--pf-multiselect-text);\n cursor: pointer;\n display: flex;\n font-family: inherit;\n font-size: var(--font-size-sm);\n gap: var(--space-2);\n justify-content: space-between;\n padding: var(--space-2) var(--space-3);\n text-align: start;\n width: 100%;\n}\n\n.trigger:focus-visible {\n border-color: var(--pf-multiselect-focus-border);\n box-shadow: var(--pf-focus-ring);\n outline: none;\n}\n\n.trigger:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n\n.trigger--invalid {\n border-color: var(--pf-multiselect-invalid-border);\n}\n\n.chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-1);\n min-width: 0;\n}\n\n.chip {\n background: var(--pf-multiselect-bg-subtle);\n border-radius: var(--radius-sm);\n font-size: var(--font-size-xs);\n padding: 2px var(--space-2);\n}\n\n.placeholder {\n color: var(--pf-multiselect-text-muted);\n}\n\n.chevron {\n align-items: center;\n display: inline-flex;\n flex-shrink: 0;\n transition: transform var(--pf-transition-fast);\n}\n\n:host([open]) .chevron {\n transform: rotate(180deg);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .chevron {\n transition: none;\n }\n}\n\n.description {\n color: var(--pf-multiselect-text-muted);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n.error {\n color: var(--pf-multiselect-invalid-border);\n font-size: var(--font-size-xs);\n margin: 0;\n}\n\n/* See src/place-popover.ts: the UA stylesheet centres a popover otherwise. */\n.listbox {\n inset: auto;\n margin: 0;\n background: var(--pf-multiselect-bg);\n border: 1px solid var(--pf-multiselect-border);\n border-radius: var(--radius-md);\n box-shadow: var(--pf-elevation-popover-shadow);\n padding: var(--space-1);\n}\n\n.listbox:popover-open {\n animation: pf-multi-select-in var(--pf-transition-enter);\n}\n\n/* Its own copy: @keyframes do not cross a shadow boundary. */\n@keyframes pf-multi-select-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .listbox:popover-open {\n animation: none;\n }\n}\n","import {\n composeDescribedBy,\n formatValueList,\n getEnabledIndexes,\n isActivationKey,\n Keys,\n observeAnchoredPosition,\n parseValueList,\n resolveListMove,\n toggleValueInList,\n assertSeparableValues,\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 multi-choice select over `pf-option` children.\n *\n * **It submits one entry per chosen value from a single control.**\n * `setFormValue` takes a `FormData`, and a key repeated in it is submitted\n * once per value — measured, and the same shape the React component gets from\n * rendering one hidden `<input>` per selection. So a server reads\n * `data.getAll(name)` exactly as it would from a native multiple select.\n *\n * `value` is one comma-separated string, because that is what an attribute can\n * carry; `pfChange` also reports the parsed `values` array, which is what a\n * framework consumer usually wants. A value containing a comma cannot survive\n * that, so one is reported on the console rather than silently mangled.\n *\n * Shares `pf-option` with `pf-select` and `pf-combobox` through the generic\n * `--pf-option-*` set.\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 chip - each chosen value's chip in the trigger.\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-multi-select',\n styleUrl: 'pf-multi-select.css',\n formAssociated: true,\n shadow: true,\n})\nexport class PfMultiSelect {\n @Element() el!: HTMLElement;\n @AttachInternals() internals!: ElementInternals;\n\n /** Submitted under this name, once per chosen value. Reflected. */\n @Prop({ reflect: true }) name?: string;\n\n /** The chosen values, comma-separated. Reflected, so HTML can set it. */\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 options';\n\n @Prop({ reflect: true }) required = false;\n\n @Prop({ reflect: true }) disabled = false;\n\n /** Options to show before the listbox scrolls. */\n @Prop() maxVisibleOptions?: number;\n\n /** Fires when the chosen set changes, with both representations. */\n @Event() pfChange!: EventEmitter<{ value: string; values: string[] }>;\n\n /** Fires whenever the listbox opens or closes, whoever caused it. */\n @Event() pfOpenChange!: EventEmitter<{ open: boolean }>;\n\n /** The labels of the chosen options, for the trigger's chips. */\n @State() chips: string[] = [];\n\n private initialValue = '';\n private stopObserving?: () => void;\n private activeOption: HTMLElement | null = null;\n private warnedAboutSeparator = false;\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 }\n\n /*\n * `name` is watched here and not on the controls that pass a plain string to\n * `setFormValue`: those take their submission name from the reflected\n * attribute, so the platform picks a change up by itself. This one builds\n * the name *into* a FormData, so without the watch a name assigned after\n * load would never reach the submission.\n */\n @Watch('name')\n @Watch('value')\n @Watch('error')\n @Watch('required')\n syncFormState() {\n const values = this.values();\n\n if (values.length === 0 || !this.name) {\n this.internals.setFormValue(null);\n } else {\n // One entry per value under the one name, which `data.getAll(name)`\n // reads back as an array.\n const data = new FormData();\n for (const value of values) data.append(this.name, value);\n this.internals.setFormValue(data);\n }\n\n applyControlValidity(this.internals, values.length > 0, this.required, this.error);\n }\n\n /** The value changed, so the children's `selected` and the chips follow. */\n @Watch('value')\n syncOptions() {\n const chosen = this.values();\n const labels: string[] = [];\n\n for (const option of this.options()) {\n const selected = chosen.includes(this.optionValue(option));\n (option as HTMLElement & { selected: boolean }).selected = selected;\n }\n\n // Chips in the order they were chosen, not the options' order.\n for (const value of chosen) {\n const option = this.options().find((candidate) => this.optionValue(candidate) === value);\n if (option) labels.push(option.textContent?.trim() ?? value);\n }\n\n this.chips = labels;\n this.warnAboutSeparators();\n }\n\n /**\n * One warning naming every offending value.\n *\n * A value holding a comma cannot round-trip through `value`, and failing\n * silently would show the right chips over a wrong submission.\n */\n private warnAboutSeparators() {\n if (this.warnedAboutSeparator) return;\n const offenders = assertSeparableValues(this.options().map((o) => this.optionValue(o)));\n if (offenders.length === 0) return;\n\n this.warnedAboutSeparator = true;\n console.warn(\n `[pf-multi-select] option values cannot contain a comma, because \\`value\\` is a ` +\n `comma-separated list: ${offenders.join(' ')}`,\n );\n }\n\n @Watch('open')\n syncOpen(next: boolean, previous: boolean) {\n if (next) this.showListbox();\n else this.hideListbox();\n if (next !== previous) this.pfOpenChange.emit({ open: next });\n }\n\n @Method()\n async show(): Promise<void> {\n if (!this.disabled) this.open = true;\n }\n\n @Method()\n async hide(): Promise<void> {\n this.open = false;\n }\n\n @Method()\n async checkValidity(): Promise<boolean> {\n return this.internals.checkValidity();\n }\n\n @Method()\n async reportValidity(): Promise<boolean> {\n return this.internals.reportValidity();\n }\n\n @Method()\n async getValidationMessage(): Promise<string> {\n return this.internals.validationMessage;\n }\n\n formResetCallback() {\n this.value = this.initialValue;\n }\n\n /** Re-reads the options, for a label edited in place. */\n @Method()\n async refresh(): Promise<void> {\n this.syncOptions();\n }\n\n private onSlotChange = () => {\n this.syncOptions();\n };\n\n private values(): string[] {\n return parseValueList(this.value);\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 matchAnchorWidth: true,\n flip: true,\n onChange: ({ left, top, width, minWidth }) => {\n placePopover(panel, left, top);\n if (width !== undefined) panel.style.width = `${width}px`;\n if (minWidth !== undefined) panel.style.minWidth = `${minWidth}px`;\n },\n });\n\n // Opens on the first chosen option, or the first selectable one.\n const chosen = this.values();\n const first =\n this.options().find(\n (option) => chosen.includes(this.optionValue(option)) && !option.hasAttribute('disabled'),\n ) ?? this.enabled()[0];\n this.setActive(first ?? null);\n }\n\n private hideListbox() {\n this.stopObserving?.();\n this.stopObserving = undefined;\n const panel = this.listbox;\n if (panel?.matches(':popover-open')) panel.hidePopover();\n }\n\n 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 /** An element, not an IDREF: a cross-root IDREF resolves to nothing. */\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 /**\n * Toggles one value and keeps the listbox open — the difference from\n * `pf-select`, and the whole point of a multi-choice control: closing after\n * each pick would make choosing three things three round trips.\n */\n private toggle(option: HTMLElement) {\n if (option.hasAttribute('disabled') || this.disabled) return;\n\n const next = toggleValueInList(this.values(), this.optionValue(option));\n this.value = formatValueList(next);\n this.pfChange.emit({ value: this.value, values: next });\n }\n\n @Listen('pfOptionSelect')\n handleOptionSelect(event: CustomEvent<{ value: string }>) {\n event.stopPropagation();\n const option = this.options().find(\n (candidate) => this.optionValue(candidate) === event.detail.value,\n );\n if (option) this.toggle(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 @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 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) this.open = true;\n else if (this.activeOption) this.toggle(this.activeOption);\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 {this.chips.length > 0 ? (\n <span class=\"chips\">\n {this.chips.map((chip) => (\n <span key={chip} class=\"chip\" part=\"chip\">\n {chip}\n </span>\n ))}\n </span>\n ) : (\n <span class=\"placeholder\">{this.placeholder}</span>\n )}\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 /* The one ARIA difference from pf-select, and the important one. */\n aria-multiselectable=\"true\"\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"],"mappings":"6XAAA,MAAMA,EAAmB,IAAM,wpECgC/B,MAAMC,EAA8C,CAClD,CAACC,EAAKC,WAAY,OAClB,CAACD,EAAKE,SAAU,WAChB,CAACF,EAAKG,MAAO,QACb,CAACH,EAAKI,KAAM,Q,MAmCDC,EAAaC,EAAA,MAAAD,UAAAE,E,sNAELC,UAGMC,KAGeC,MAAQ,GAGRC,KAAO,MAEvCC,MAEAC,YAEAC,MAEAC,YAAc,iBAEGC,SAAW,MAEXC,SAAW,MAG5BC,kBAGCC,SAGAC,aAGAC,MAAkB,GAEnBC,aAAe,GACfC,cACAC,aAAmC,KACnCC,qBAAuB,MAE/B,iBAAAC,GACEC,KAAKL,aAAeK,KAAKjB,OAAS,GAClCiB,KAAKC,gBACLD,KAAKE,a,CAGP,kBAAAC,GACEH,KAAKI,sB,CAGP,oBAAAC,GACEL,KAAKJ,iB,CAcP,aAAAK,GACE,MAAMK,EAASN,KAAKM,SAEpB,GAAIA,EAAOC,SAAW,IAAMP,KAAKlB,KAAM,CACrCkB,KAAKnB,UAAU2B,aAAa,K,KACvB,CAGL,MAAMC,EAAO,IAAIC,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AMa,OAAS,EACnBwG,EAAA,QAAME,MAAM,SACTjH,KAAKN,MAAMkC,KAAK8F,GACfX,EAAA,QAAMN,IAAKiB,EAAMT,MAAM,OAAOC,KAAK,QAChCQ,MAKPX,EAAA,QAAME,MAAM,eAAejH,KAAKZ,aAElC2H,EAAA,QAAAN,IAAA,2CAAMQ,MAAM,UAAS,cAAa,QAChCF,EAAA,WAAAN,IAAA,2CAAS3H,KAAK,mBAIjBkB,KAAKd,aACJ6H,EAAA,KAAAN,IAAA,2CAAGQ,MAAM,cAAcC,KAAK,cAAcE,GAAG,eAC1CpH,KAAKd,aAGTc,KAAKb,OACJ4H,EAAA,KAAAN,IAAA,2CAAGQ,MAAM,QAAQC,KAAK,QAAQE,GAAG,SAC9BpH,KAAKb,QAKZ4H,EAAA,OAAAN,IAAA,2CACEW,GAAG,UACHF,KAAK,UACLD,MAAM,UACNU,QAAQ,OACRH,KAAK,UAAS,uBAEO,OAAM,aACfxH,KAAKf,OAASe,KAAKZ,YAC/BwF,MACE5E,KAAKT,kBACD,CAAEqI,UAAW,QAAQ5H,KAAKT,4BAA6BsI,UAAW,QAClElD,UAENK,SAAUhF,KAAKgF,UAEf+B,EAAA,QAAAN,IAAA,2CAAMqB,aAAc9H,KAAK+C,gB","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{t as e,p as t,H as a,h as n,a as r}from"./index.js";const i=()=>`:host{display:block}:host([hidden]){display:none}:host([orientation='horizontal']){flex:0 0 auto}.link{align-items:center;background:transparent;border:0;border-radius:var(--pf-nav-item-radius, var(--radius-sm));color:var(--pf-nav-item-text);cursor:pointer;display:flex;font:inherit;gap:var(--pf-nav-item-gap, var(--space-2));min-height:var(--pf-nav-item-min-height, 32px);padding:var(--pf-nav-item-padding, 0 var(--space-2));text-decoration:none;white-space:nowrap}:host([orientation='vertical']) .link{min-height:var(--pf-nav-item-vertical-min-height, 36px);padding:var(--pf-nav-item-vertical-padding, 0 var(--space-3));width:100%}.link:hover{background:var(--pf-nav-item-hover-bg);color:var(--pf-nav-item-hover-text)}a.link:focus-visible{box-shadow:var(--pf-nav-item-focus-ring, var(--pf-focus-ring));outline:none}:host([current-page]) .link{background:var(--pf-nav-item-current-bg);color:var(--pf-nav-item-current-text);font-weight:var(--font-weight-semibold)}:host([disabled]) .link{cursor:not-allowed;opacity:var(--pf-nav-item-disabled-opacity, 0.5)}:host([disabled]) .link:hover{background:transparent;color:var(--pf-nav-item-text)}.label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}:host([orientation='horizontal']) .label{flex:0 0 auto}::slotted([slot='icon']){color:inherit;flex:0 0 auto}::slotted([slot='badge']){flex:0 0 auto}::slotted(a),::slotted(button){align-items:center;align-self:stretch;background:none;border:0;color:inherit;cursor:inherit;display:flex;flex:1 1 auto;font:inherit;margin:0;padding:0;text-decoration:none}`;const o=t(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow()}href;target;rel;current=false;currentPage=false;disabled=false;orientation="horizontal";render(){const e=[n("slot",{key:"35769e4f7edb3524591111fd8c78eca5a6ae5e76",name:"icon"}),n("span",{key:"201e0efd80af4ec26fde67d5c90fbf47d2f8f16f",class:"label",part:"label"},n("slot",{key:"bf2ada457257d25f3a054beb41133e872585a26b"})),n("slot",{key:"c807ea3208d83e9f205392aa655a35e211c75e3e",name:"badge"})];return n(r,{key:"ad28038cf786d9c8431e1da725305cceacac5a15",role:"listitem"},this.href&&!this.disabled?n("a",{class:"link",part:"link",href:this.href,target:this.target,rel:this.rel,"aria-current":this.currentPage?"page":null},e):n("span",{class:"link",part:"link","aria-current":this.currentPage?"page":null,"aria-disabled":this.disabled?"true":null},e))}static get style(){return i()}},[769,"pf-nav-item",{href:[513],target:[1],rel:[1],current:[516],currentPage:[1540,"current-page"],disabled:[516],orientation:[1537]}]);function s(){if(typeof customElements==="undefined"){return}const t=["pf-nav-item"];t.forEach((t=>{switch(t){case"pf-nav-item":if(!customElements.get(e(t))){customElements.define(e(t),o)}break}}))}s();const l=o;const c=s;export{l as PfNavItem,c as defineCustomElement};
1
+ import{t as e,p as t,H as a,c as r,h as n,a as i}from"./index.js";const o=()=>`:host{display:block}:host([hidden]){display:none}:host([orientation='horizontal']){flex:0 0 auto}.link{align-items:center;background:transparent;border:0;border-radius:var(--pf-nav-item-radius, var(--radius-sm));color:var(--pf-nav-item-text);cursor:pointer;display:flex;font:inherit;gap:var(--pf-nav-item-gap, var(--space-2));min-height:var(--pf-nav-item-min-height, 32px);padding:var(--pf-nav-item-padding, 0 var(--space-2));text-decoration:none;white-space:nowrap}:host([orientation='vertical']) .link{min-height:var(--pf-nav-item-vertical-min-height, 36px);padding:var(--pf-nav-item-vertical-padding, 0 var(--space-3));width:100%}.link:hover{background:var(--pf-nav-item-hover-bg);color:var(--pf-nav-item-hover-text)}a.link:focus-visible{box-shadow:var(--pf-nav-item-focus-ring, var(--pf-focus-ring));outline:none}:host([current-page]) .link{background:var(--pf-nav-item-current-bg);color:var(--pf-nav-item-current-text);font-weight:var(--font-weight-semibold)}:host([disabled]) .link{cursor:not-allowed;opacity:var(--pf-nav-item-disabled-opacity, 0.5)}:host([disabled]) .link:hover{background:transparent;color:var(--pf-nav-item-text)}.label{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}:host([orientation='horizontal']) .label{flex:0 0 auto}::slotted([slot='icon']){color:inherit;flex:0 0 auto}::slotted([slot='badge']){flex:0 0 auto}::slotted(a),::slotted(button){align-items:center;align-self:stretch;background:none;border:0;color:inherit;cursor:inherit;display:flex;flex:1 1 auto;font:inherit;margin:0;padding:0;text-decoration:none}`;const s=t(class e extends a{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.pfNavStructure=r(this,"pfNavStructure")}href;target;rel;current=false;pfNavStructure;handleCurrentChange(){this.pfNavStructure.emit()}currentPage=false;disabled=false;orientation="horizontal";render(){const e=[n("slot",{key:"b478a66b7ae6c6d00b18f762600435dbac37996d",name:"icon"}),n("span",{key:"4b1ddbe87804c604d492b00bbc743299c54f7240",class:"label",part:"label"},n("slot",{key:"86778db42fef8af44096211cd8a743155dca3fb0"})),n("slot",{key:"02fef2701ef217701ce18e71e9ff873dc3bd3a44",name:"badge"})];return n(i,{key:"c4ee7f6245eedd2bf0546ebcb987120212ea18e3",role:"listitem"},this.href&&!this.disabled?n("a",{class:"link",part:"link",href:this.href,target:this.target,rel:this.rel,"aria-current":this.currentPage?"page":null},e):n("span",{class:"link",part:"link","aria-current":this.currentPage?"page":null,"aria-disabled":this.disabled?"true":null},e))}static get watchers(){return{current:[{handleCurrentChange:0}]}}static get style(){return o()}},[769,"pf-nav-item",{href:[513],target:[1],rel:[1],current:[516],currentPage:[1540,"current-page"],disabled:[516],orientation:[1537]},undefined,{current:[{handleCurrentChange:0}]}]);function l(){if(typeof customElements==="undefined"){return}const t=["pf-nav-item"];t.forEach((t=>{switch(t){case"pf-nav-item":if(!customElements.get(e(t))){customElements.define(e(t),s)}break}}))}l();const c=s;const d=l;export{c as PfNavItem,d as defineCustomElement};
2
2
  //# sourceMappingURL=pf-nav-item.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["pfNavItemCss","PfNavItem","__stencil_proxyCustomElement","HTMLElement","href","target","rel","current","currentPage","disabled","orientation","render","content","h","key","name","class","part","Host","role","this"],"sources":["src/components/pf-nav-item/pf-nav-item.css?tag=pf-nav-item&encapsulation=shadow","src/components/pf-nav-item/pf-nav-item.tsx"],"sourcesContent":["/*\n * This element is shared by pf-header-navigation and pf-sidebar-navigation,\n * whose React counterparts have separate alias families with their own\n * values. Rather than pick one and diverge from the other, the item reads a\n * generic `--pf-nav-item-*` set that each navigation defines on itself --\n * custom properties inherit through the shadow boundary, so a slotted item\n * picks up whichever navigation it is inside, which no selector can do\n * (`:host-context` is not in Firefox). Exactly the pf-option arrangement, for\n * the same reason. There is deliberately no `:root` default: without one the\n * bridge is load-bearing, and a missing one shows up as an item with no\n * colours at all rather than as one that quietly looks right.\n */\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n:host([orientation='horizontal']) {\n flex: 0 0 auto;\n}\n\n.link {\n align-items: center;\n background: transparent;\n border: 0;\n border-radius: var(--pf-nav-item-radius, var(--radius-sm));\n color: var(--pf-nav-item-text);\n cursor: pointer;\n display: flex;\n font: inherit;\n gap: var(--pf-nav-item-gap, var(--space-2));\n min-height: var(--pf-nav-item-min-height, 32px);\n padding: var(--pf-nav-item-padding, 0 var(--space-2));\n text-decoration: none;\n white-space: nowrap;\n}\n\n:host([orientation='vertical']) .link {\n min-height: var(--pf-nav-item-vertical-min-height, 36px);\n padding: var(--pf-nav-item-vertical-padding, 0 var(--space-3));\n width: 100%;\n}\n\n.link:hover {\n background: var(--pf-nav-item-hover-bg);\n color: var(--pf-nav-item-hover-text);\n}\n\na.link:focus-visible {\n box-shadow: var(--pf-nav-item-focus-ring, var(--pf-focus-ring));\n outline: none;\n}\n\n/*\n * `current-page` is the group's answer, not the consumer's `current` ask: the\n * highlight and the announcement are the same decision, so they read the same\n * attribute.\n */\n:host([current-page]) .link {\n background: var(--pf-nav-item-current-bg);\n color: var(--pf-nav-item-current-text);\n font-weight: var(--font-weight-semibold);\n}\n\n:host([disabled]) .link {\n cursor: not-allowed;\n opacity: var(--pf-nav-item-disabled-opacity, 0.5);\n}\n\n:host([disabled]) .link:hover {\n background: transparent;\n color: var(--pf-nav-item-text);\n}\n\n/* The label takes the slack so a badge sits at the far edge of a sidebar. */\n.label {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n:host([orientation='horizontal']) .label {\n flex: 0 0 auto;\n}\n\n/*\n * No wrapper around the icon and badge slots: an unassigned slot is\n * `display: contents` and generates nothing, while a wrapper around one\n * cannot be collapsed from CSS and would cost a gap in front of every label\n * with no icon.\n */\n::slotted([slot='icon']) {\n color: inherit;\n flex: 0 0 auto;\n}\n\n::slotted([slot='badge']) {\n flex: 0 0 auto;\n}\n\n/*\n * A consumer's own router link, slotted in with no `href` of ours. It fills\n * the box's content area rather than being a word inside it, and it inherits\n * every colour the box resolved, so hover and the current page look the same\n * whichever of the two is the control.\n */\n::slotted(a),\n::slotted(button) {\n align-items: center;\n align-self: stretch;\n background: none;\n border: 0;\n color: inherit;\n cursor: inherit;\n display: flex;\n flex: 1 1 auto;\n font: inherit;\n margin: 0;\n padding: 0;\n text-decoration: none;\n}\n","import { Component, h, Host, Prop } from '@stencil/core';\n\n/**\n * One item in a `pf-header-navigation` or a `pf-sidebar-navigation`.\n *\n * Shared by both, because the React library's `HeaderNavigationItem` and\n * `SidebarNavigationItem` are the same shape — one element rather than two\n * that would drift. What differs is the layout, and that is the group's to\n * say: it pushes `orientation` down, which is the only thing an item cannot\n * work out for itself.\n *\n * With an `href` it renders a link; without one it renders a plain box, which\n * is how a framework's own router is used — slot an `<a routerLink>` or a\n * `<Link>` in and leave `href` unset.\n *\n * `currentPage` and `orientation` are the group's to set. A consumer asks by\n * setting `current`; the group resolves every item with core's rule and\n * writes the answer to `currentPage`.\n *\n * @slot - the item's label.\n * @slot icon - a leading icon.\n * @slot badge - a trailing badge or count.\n * @part link - the link, or the box standing in for one.\n */\n@Component({\n tag: 'pf-nav-item',\n styleUrl: 'pf-nav-item.css',\n shadow: true,\n})\nexport class PfNavItem {\n /** Where the item goes. Reflected; a consumer's stylesheet reads it. */\n @Prop({ reflect: true }) href?: string;\n\n /** Opens elsewhere, as on a plain anchor. Ignored without an `href`. */\n @Prop() target?: string;\n\n /** Goes on the anchor as-is. Ignored without an `href`. */\n @Prop() rel?: string;\n\n /**\n * Set it to mark this item as the current page.\n *\n * The *asking* half, which the group never writes — `currentPage` below is\n * the answer. The two are kept apart for the reason `pf-breadcrumb` keeps\n * them apart: a group that wrote its answer back would leave the mark\n * behind on an item the consumer had not marked.\n */\n @Prop({ reflect: true }) current = false;\n\n /**\n * Set by the group: the resolved current page, which is the one thing that\n * renders `aria-current=\"page\"`. At most one item in a navigation carries\n * it, and the highlight follows it rather than `current` — a second\n * highlighted item with no `aria-current` would be a sighted-only lie.\n */\n @Prop({ mutable: true, reflect: true }) currentPage = false;\n\n /**\n * Takes the item out of the navigation without removing it.\n *\n * A disabled item renders **no anchor at all**, because an anchor has no\n * disabled state: `aria-disabled` alone leaves it focusable and clickable,\n * and dropping the `href` is the only thing that really takes it out of the\n * tab order.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /** Set by the group, which is the only one that knows which it is. */\n @Prop({ mutable: true, reflect: true }) orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n render() {\n const content = [\n <slot name=\"icon\" />,\n <span class=\"label\" part=\"label\">\n <slot />\n </span>,\n <slot name=\"badge\" />,\n ];\n\n return (\n <Host role=\"listitem\">\n {this.href && !this.disabled ? (\n <a\n class=\"link\"\n part=\"link\"\n href={this.href}\n target={this.target}\n rel={this.rel}\n aria-current={this.currentPage ? 'page' : null}\n >\n {content}\n </a>\n ) : (\n <span\n class=\"link\"\n part=\"link\"\n aria-current={this.currentPage ? 'page' : null}\n aria-disabled={this.disabled ? 'true' : null}\n >\n {content}\n </span>\n )}\n </Host>\n );\n }\n}\n"],"mappings":"2DAAA,MAAMA,EAAe,IAAM,6hD,MC6BdC,EAASC,EAAA,MAAAD,UAAAE,E,iFAEKC,KAGjBC,OAGAC,IAUiBC,QAAU,MAQKC,YAAc,MAU7BC,SAAW,MAGIC,YAAyC,aAEjF,MAAAC,GACE,MAAMC,EAAU,CACdC,EAAA,QAAAC,IAAA,2CAAMC,KAAK,SACXF,EAAA,QAAAC,IAAA,2CAAME,MAAM,QAAQC,KAAK,SACvBJ,EAAA,QAAAC,IAAA,8CAEFD,EAAA,QAAAC,IAAA,2CAAMC,KAAK,WAGb,OACEF,EAACK,EAAI,CAAAJ,IAAA,2CAACK,KAAK,YACRC,KAAKhB,OAASgB,KAAKX,SAClBI,EAAA,KACEG,MAAM,OACNC,KAAK,OACLb,KAAMgB,KAAKhB,KACXC,OAAQe,KAAKf,OACbC,IAAKc,KAAKd,IAAG,eACCc,KAAKZ,YAAc,OAAS,MAEzCI,GAGHC,EAAA,QACEG,MAAM,OACNC,KAAK,OAAM,eACGG,KAAKZ,YAAc,OAAS,KAAI,gBAC/BY,KAAKX,SAAW,OAAS,MAEvCG,G","ignoreList":[]}
1
+ {"version":3,"names":["pfNavItemCss","PfNavItem","__stencil_proxyCustomElement","HTMLElement","href","target","rel","current","pfNavStructure","handleCurrentChange","this","emit","currentPage","disabled","orientation","render","content","h","key","name","class","part","Host","role"],"sources":["src/components/pf-nav-item/pf-nav-item.css?tag=pf-nav-item&encapsulation=shadow","src/components/pf-nav-item/pf-nav-item.tsx"],"sourcesContent":["/*\n * This element is shared by pf-header-navigation and pf-sidebar-navigation,\n * whose React counterparts have separate alias families with their own\n * values. Rather than pick one and diverge from the other, the item reads a\n * generic `--pf-nav-item-*` set that each navigation defines on itself --\n * custom properties inherit through the shadow boundary, so a slotted item\n * picks up whichever navigation it is inside, which no selector can do\n * (`:host-context` is not in Firefox). Exactly the pf-option arrangement, for\n * the same reason. There is deliberately no `:root` default: without one the\n * bridge is load-bearing, and a missing one shows up as an item with no\n * colours at all rather than as one that quietly looks right.\n */\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n:host([orientation='horizontal']) {\n flex: 0 0 auto;\n}\n\n.link {\n align-items: center;\n background: transparent;\n border: 0;\n border-radius: var(--pf-nav-item-radius, var(--radius-sm));\n color: var(--pf-nav-item-text);\n cursor: pointer;\n display: flex;\n font: inherit;\n gap: var(--pf-nav-item-gap, var(--space-2));\n min-height: var(--pf-nav-item-min-height, 32px);\n padding: var(--pf-nav-item-padding, 0 var(--space-2));\n text-decoration: none;\n white-space: nowrap;\n}\n\n:host([orientation='vertical']) .link {\n min-height: var(--pf-nav-item-vertical-min-height, 36px);\n padding: var(--pf-nav-item-vertical-padding, 0 var(--space-3));\n width: 100%;\n}\n\n.link:hover {\n background: var(--pf-nav-item-hover-bg);\n color: var(--pf-nav-item-hover-text);\n}\n\na.link:focus-visible {\n box-shadow: var(--pf-nav-item-focus-ring, var(--pf-focus-ring));\n outline: none;\n}\n\n/*\n * `current-page` is the group's answer, not the consumer's `current` ask: the\n * highlight and the announcement are the same decision, so they read the same\n * attribute.\n */\n:host([current-page]) .link {\n background: var(--pf-nav-item-current-bg);\n color: var(--pf-nav-item-current-text);\n font-weight: var(--font-weight-semibold);\n}\n\n:host([disabled]) .link {\n cursor: not-allowed;\n opacity: var(--pf-nav-item-disabled-opacity, 0.5);\n}\n\n:host([disabled]) .link:hover {\n background: transparent;\n color: var(--pf-nav-item-text);\n}\n\n/* The label takes the slack so a badge sits at the far edge of a sidebar. */\n.label {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n:host([orientation='horizontal']) .label {\n flex: 0 0 auto;\n}\n\n/*\n * No wrapper around the icon and badge slots: an unassigned slot is\n * `display: contents` and generates nothing, while a wrapper around one\n * cannot be collapsed from CSS and would cost a gap in front of every label\n * with no icon.\n */\n::slotted([slot='icon']) {\n color: inherit;\n flex: 0 0 auto;\n}\n\n::slotted([slot='badge']) {\n flex: 0 0 auto;\n}\n\n/*\n * A consumer's own router link, slotted in with no `href` of ours. It fills\n * the box's content area rather than being a word inside it, and it inherits\n * every colour the box resolved, so hover and the current page look the same\n * whichever of the two is the control.\n */\n::slotted(a),\n::slotted(button) {\n align-items: center;\n align-self: stretch;\n background: none;\n border: 0;\n color: inherit;\n cursor: inherit;\n display: flex;\n flex: 1 1 auto;\n font: inherit;\n margin: 0;\n padding: 0;\n text-decoration: none;\n}\n","import { Component, Event, EventEmitter, h, Host, Prop, Watch } from '@stencil/core';\n\n/**\n * One item in a `pf-header-navigation` or a `pf-sidebar-navigation`.\n *\n * Shared by both, because the React library's `HeaderNavigationItem` and\n * `SidebarNavigationItem` are the same shape — one element rather than two\n * that would drift. What differs is the layout, and that is the group's to\n * say: it pushes `orientation` down, which is the only thing an item cannot\n * work out for itself.\n *\n * With an `href` it renders a link; without one it renders a plain box, which\n * is how a framework's own router is used — slot an `<a routerLink>` or a\n * `<Link>` in and leave `href` unset.\n *\n * `currentPage` and `orientation` are the group's to set. A consumer asks by\n * setting `current`; the group resolves every item with core's rule and\n * writes the answer to `currentPage`. Changing the ask tells the group, so\n * the answer follows a framework's re-render without the consumer calling\n * anything.\n *\n * @slot - the item's label.\n * @slot icon - a leading icon.\n * @slot badge - a trailing badge or count.\n * @part link - the link, or the box standing in for one.\n */\n@Component({\n tag: 'pf-nav-item',\n styleUrl: 'pf-nav-item.css',\n shadow: true,\n})\nexport class PfNavItem {\n /** Where the item goes. Reflected; a consumer's stylesheet reads it. */\n @Prop({ reflect: true }) href?: string;\n\n /** Opens elsewhere, as on a plain anchor. Ignored without an `href`. */\n @Prop() target?: string;\n\n /** Goes on the anchor as-is. Ignored without an `href`. */\n @Prop() rel?: string;\n\n /**\n * Set it to mark this item as the current page.\n *\n * The *asking* half, which the group never writes — `currentPage` below is\n * the answer. The two are kept apart for the reason `pf-breadcrumb` keeps\n * them apart: a group that wrote its answer back would leave the mark\n * behind on an item the consumer had not marked.\n */\n @Prop({ reflect: true }) current = false;\n\n /**\n * Tells the group the ask changed, so it can resolve again.\n *\n * The same event `pf-nav-section` emits when its items move, because the\n * groups do the same thing with both: re-read every item and resolve the\n * one current page. Without this a navigation resolves at load and never\n * again for a consumer who marks items through the *property*, which is\n * every framework consumer — the generated bindings set props as\n * properties, so there is no attribute change and no `slotchange` either.\n * The symptom is a navigation whose highlight never moves while the router\n * works perfectly, which is what porting `apps/demo` ran into.\n *\n * `current` only. Watching `currentPage` would loop, since that is what the\n * group writes back.\n */\n @Event() pfNavStructure!: EventEmitter<void>;\n\n @Watch('current')\n handleCurrentChange() {\n this.pfNavStructure.emit();\n }\n\n /**\n * Set by the group: the resolved current page, which is the one thing that\n * renders `aria-current=\"page\"`. At most one item in a navigation carries\n * it, and the highlight follows it rather than `current` — a second\n * highlighted item with no `aria-current` would be a sighted-only lie.\n */\n @Prop({ mutable: true, reflect: true }) currentPage = false;\n\n /**\n * Takes the item out of the navigation without removing it.\n *\n * A disabled item renders **no anchor at all**, because an anchor has no\n * disabled state: `aria-disabled` alone leaves it focusable and clickable,\n * and dropping the `href` is the only thing that really takes it out of the\n * tab order.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /** Set by the group, which is the only one that knows which it is. */\n @Prop({ mutable: true, reflect: true }) orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n render() {\n const content = [\n <slot name=\"icon\" />,\n <span class=\"label\" part=\"label\">\n <slot />\n </span>,\n <slot name=\"badge\" />,\n ];\n\n return (\n <Host role=\"listitem\">\n {this.href && !this.disabled ? (\n <a\n class=\"link\"\n part=\"link\"\n href={this.href}\n target={this.target}\n rel={this.rel}\n aria-current={this.currentPage ? 'page' : null}\n >\n {content}\n </a>\n ) : (\n <span\n class=\"link\"\n part=\"link\"\n aria-current={this.currentPage ? 'page' : null}\n aria-disabled={this.disabled ? 'true' : null}\n >\n {content}\n </span>\n )}\n </Host>\n );\n }\n}\n"],"mappings":"kEAAA,MAAMA,EAAe,IAAM,6hD,MC+BdC,EAASC,EAAA,MAAAD,UAAAE,E,8HAEKC,KAGjBC,OAGAC,IAUiBC,QAAU,MAiB1BC,eAGT,mBAAAC,GACEC,KAAKF,eAAeG,M,CASkBC,YAAc,MAU7BC,SAAW,MAGIC,YAAyC,aAEjF,MAAAC,GACE,MAAMC,EAAU,CACdC,EAAA,QAAAC,IAAA,2CAAMC,KAAK,SACXF,EAAA,QAAAC,IAAA,2CAAME,MAAM,QAAQC,KAAK,SACvBJ,EAAA,QAAAC,IAAA,8CAEFD,EAAA,QAAAC,IAAA,2CAAMC,KAAK,WAGb,OACEF,EAACK,EAAI,CAAAJ,IAAA,2CAACK,KAAK,YACRb,KAAKN,OAASM,KAAKG,SAClBI,EAAA,KACEG,MAAM,OACNC,KAAK,OACLjB,KAAMM,KAAKN,KACXC,OAAQK,KAAKL,OACbC,IAAKI,KAAKJ,IAAG,eACCI,KAAKE,YAAc,OAAS,MAEzCI,GAGHC,EAAA,QACEG,MAAM,OACNC,KAAK,OAAM,eACGX,KAAKE,YAAc,OAAS,KAAI,gBAC/BF,KAAKG,SAAW,OAAS,MAEvCG,G","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{t as e,p as t,H as r,c as i,h as n,a as s}from"./index.js";import{c as a}from"./p-DfpCerXM.js";import{K as o}from"./p-g4FlTDZx.js";import{p as l,r as d,s as c,f as u,c as p}from"./p-DSXauhXX.js";import{a as f}from"./p-Cr6IXrUk.js";import{d as h}from"./p-CkFjPRTe.js";const b=()=>`:host{display:block}:host([hidden]){display:none}.field{display:grid;gap:var(--space-2)}.label{color:var(--pf-numberinput-field-label, var(--pf-field-label));font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}.required{color:var(--pf-field-required);margin-inline-start:var(--space-1)}.control{align-items:stretch;background:var(--pf-numberinput-bg);border:1px solid var(--pf-numberinput-border);border-radius:var(--radius-md);display:inline-flex;min-height:40px;overflow:hidden;transition:border var(--pf-transition-fast), box-shadow var(--pf-transition-fast);width:100%}.control:focus-within{border-color:var(--pf-numberinput-focus-border);box-shadow:var(--pf-numberinput-focus-ring, var(--pf-focus-ring))}.control--invalid{border-color:var(--pf-numberinput-invalid-border)}:host([disabled]) .control{background:var(--pf-control-bg-disabled);border-color:var(--pf-control-border-disabled);color:var(--pf-control-text-disabled);opacity:0.6}.input{background:transparent;border:none;color:var(--pf-numberinput-text);flex:1;font:inherit;min-width:0;outline:none;padding:0 var(--space-3);text-align:center;width:100%}.input::placeholder{color:var(--pf-numberinput-placeholder)}.input:disabled{cursor:not-allowed}.step{align-items:center;align-self:stretch;background:var(--pf-numberinput-step-bg);border:none;color:var(--pf-numberinput-step-text);cursor:pointer;display:inline-flex;flex-shrink:0;justify-content:center;padding:0;transition:background var(--pf-transition-fast), color var(--pf-transition-fast);width:40px}.step:hover:not(:disabled){background:var(--pf-numberinput-step-hover-bg);color:var(--pf-numberinput-step-hover-text)}.step:disabled{cursor:not-allowed;opacity:0.45}[part='decrement']{border-inline-end:1px solid var(--pf-numberinput-border)}[part='increment']{border-inline-start:1px solid var(--pf-numberinput-border)}.step pf-icon{font-size:16px}.description{color:var(--pf-numberinput-field-description, var(--pf-field-description));font-size:var(--font-size-sm);margin:0}.error{color:var(--pf-field-error);font-size:var(--font-size-sm);margin:0}@media (prefers-reduced-motion: reduce){.control,.step{transition:none}}`;const m=t(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.pfChange=i(this,"pfChange");this.internals=this.attachInternals()}get el(){return this}internals;name;value="";min;max;step=1;label;description;error;placeholder;required=false;disabled=false;decrementLabel="Decrease";incrementLabel="Increase";pfChange;draft=null;initialValue="";componentWillLoad(){this.initialValue=this.value??"";this.syncFormState()}syncFormState(){this.internals.setFormValue(this.value??"");f(this.internals,Boolean(this.value),this.required,this.error)}async checkValidity(){return this.internals.checkValidity()}async reportValidity(){return this.internals.reportValidity()}async getValidationMessage(){return this.internals.validationMessage}formResetCallback(){this.value=this.initialValue;this.draft=null}async stepBy(e){this.step_(e)}get bounds(){return{min:this.min===undefined?-Infinity:Number(this.min),max:this.max===undefined?Infinity:Number(this.max),step:Number(this.step)||1}}get current(){return l(this.value)}get atMin(){const{min:e}=this.bounds;return this.current!==null&&this.current<=e}get atMax(){const{max:e}=this.bounds;return this.current!==null&&this.current>=e}commit(e){const{min:t,max:r,step:i}=this.bounds;const n=e===null?"":String(d(p(e,t,r),i));if(n===this.value)return;this.value=n;this.pfChange.emit({value:n,number:l(n)})}step_(e){if(this.disabled)return;this.draft=null;this.commit(c(this.current,e,this.bounds))}onInput=e=>{const t=e.target.value;this.draft=t;const r=l(t);if(t.trim()===""){this.commit(null);return}if(r!==null)this.commit(r)};onBlur=()=>{this.draft=null};onKeyDown=e=>{if(this.disabled)return;const{min:t,max:r}=this.bounds;if(e.key===o.ArrowUp){e.preventDefault();this.step_(1)}else if(e.key===o.ArrowDown){e.preventDefault();this.step_(-1)}else if(e.key===o.Home&&Number.isFinite(t)){e.preventDefault();this.draft=null;this.commit(t)}else if(e.key===o.End&&Number.isFinite(r)){e.preventDefault();this.draft=null;this.commit(r)}};render(){const e=a(this.description&&"description",this.error&&"error");const{min:t,max:r}=this.bounds;const i=this.draft??u(this.current);return n(s,{key:"b873ad5d26191b9589a3f67432f911f57a3db2cc"},n("div",{key:"1fe3503ee61589e6cd9ebe683c937665b934fc8e",class:"field",part:"field"},this.label&&n("label",{key:"7d9da068ca611a068b89e5292238852f2d40ba53",class:"label",part:"label",htmlFor:"input"},this.label,this.required&&n("span",{key:"bfb6e221092438b3ccef19dfe811767f4d2f3a5d",class:"required","aria-hidden":"true"},"*")),n("div",{key:"7bb8c35312b4d30e1b09fefa78f752c6791a34f9",class:{control:true,"control--invalid":Boolean(this.error)},part:"control"},n("button",{key:"ff991dc6a65ca1fc5984e5b260b7b9c77def5d49",type:"button",class:"step",part:"decrement","aria-label":this.decrementLabel,disabled:this.disabled||this.atMin,tabindex:"-1",onMouseDown:e=>e.preventDefault(),onClick:()=>this.step_(-1)},n("pf-icon",{key:"4d65e8eda2958a1e9a7308a3b23f2f3bcf9083cf",name:"minus","aria-hidden":"true"})),n("input",{key:"4a7db9fb97f9cdf12c4228ff47079f2cecadf7d8",id:"input",part:"input",class:"input",type:"text",inputMode:"decimal",role:"spinbutton",name:this.name,value:i,placeholder:this.placeholder,required:this.required,disabled:this.disabled,autocomplete:"off","aria-invalid":this.error?"true":null,"aria-describedby":e,"aria-valuenow":this.current??null,"aria-valuemin":Number.isFinite(t)?t:null,"aria-valuemax":Number.isFinite(r)?r:null,onInput:this.onInput,onBlur:this.onBlur,onKeyDown:this.onKeyDown}),n("button",{key:"436e0a6557aef36b2bd59b7f0cee8d0a08636c53",type:"button",class:"step",part:"increment","aria-label":this.incrementLabel,disabled:this.disabled||this.atMax,tabindex:"-1",onMouseDown:e=>e.preventDefault(),onClick:()=>this.step_(1)},n("pf-icon",{key:"0ae5162f3d63f69c135cc9991c9d02aaf3ac86ea",name:"plus","aria-hidden":"true"}))),this.description&&n("p",{key:"6c958dd2bdeb22310d6c422d1757f4938687513c",class:"description",part:"description",id:"description"},this.description),this.error&&n("p",{key:"f8ea4d36f4941251e63cdfdc127fd08d3bb55ae4",class:"error",part:"error",id:"error"},this.error)))}static get delegatesFocus(){return true}static get formAssociated(){return true}static get watchers(){return{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}}static get style(){return b()}},[593,"pf-number-input",{name:[513],value:[1025],min:[2],max:[2],step:[2],label:[1],description:[1],error:[1],placeholder:[1],required:[516],disabled:[516],decrementLabel:[1,"decrement-label"],incrementLabel:[1,"increment-label"],draft:[32],checkValidity:[64],reportValidity:[64],getValidationMessage:[64],stepBy:[64]},undefined,{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}]);function v(){if(typeof customElements==="undefined"){return}const t=["pf-number-input","pf-icon"];t.forEach((t=>{switch(t){case"pf-number-input":if(!customElements.get(e(t))){customElements.define(e(t),m)}break;case"pf-icon":if(!customElements.get(e(t))){h()}break}}))}v();const y=m;const g=v;export{y as PfNumberInput,g as defineCustomElement};
1
+ import{t as e,p as t,H as r,c as i,h as n,a as s}from"./index.js";import{c as a}from"./p-DfpCerXM.js";import{K as o}from"./p-g4FlTDZx.js";import{p as l,r as c,s as d,f as p,c as u}from"./p-DSXauhXX.js";import{a as f}from"./p-Cr6IXrUk.js";import{c as b}from"./p-Cy_kHPeC.js";import{d as h}from"./p-CkFjPRTe.js";const m=()=>`:host{display:block}:host([hidden]){display:none}.field{display:grid;gap:var(--space-2)}.label{color:var(--pf-numberinput-field-label, var(--pf-field-label));font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}.required{color:var(--pf-field-required);margin-inline-start:var(--space-1)}.control{align-items:stretch;background:var(--pf-numberinput-bg);border:1px solid var(--pf-numberinput-border);border-radius:var(--radius-md);display:inline-flex;min-height:40px;overflow:hidden;transition:border var(--pf-transition-fast), box-shadow var(--pf-transition-fast);width:100%}.control:focus-within{border-color:var(--pf-numberinput-focus-border);box-shadow:var(--pf-numberinput-focus-ring, var(--pf-focus-ring))}.control--invalid{border-color:var(--pf-numberinput-invalid-border)}:host([disabled]) .control{background:var(--pf-control-bg-disabled);border-color:var(--pf-control-border-disabled);color:var(--pf-control-text-disabled);opacity:0.6}.input{background:transparent;border:none;color:var(--pf-numberinput-text);flex:1;font:inherit;min-width:0;outline:none;padding:0 var(--space-3);text-align:center;width:100%}.input::placeholder{color:var(--pf-numberinput-placeholder)}.input:disabled{cursor:not-allowed}.step{align-items:center;align-self:stretch;background:var(--pf-numberinput-step-bg);border:none;color:var(--pf-numberinput-step-text);cursor:pointer;display:inline-flex;flex-shrink:0;justify-content:center;padding:0;transition:background var(--pf-transition-fast), color var(--pf-transition-fast);width:40px}.step:hover:not(:disabled){background:var(--pf-numberinput-step-hover-bg);color:var(--pf-numberinput-step-hover-text)}.step:disabled{cursor:not-allowed;opacity:0.45}[part='decrement']{border-inline-end:1px solid var(--pf-numberinput-border)}[part='increment']{border-inline-start:1px solid var(--pf-numberinput-border)}.step pf-icon{font-size:16px}.description{color:var(--pf-numberinput-field-description, var(--pf-field-description));font-size:var(--font-size-sm);margin:0}.error{color:var(--pf-field-error);font-size:var(--font-size-sm);margin:0}@media (prefers-reduced-motion: reduce){.control,.step{transition:none}}`;const v=t(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.pfChange=i(this,"pfChange");this.internals=this.attachInternals()}get el(){return this}internals;name;value="";min;max;step=1;label;description;error;placeholder;required=false;disabled=false;decrementLabel="Decrease";incrementLabel="Increase";pfChange;draft=null;initialValue="";componentWillLoad(){this.initialValue=this.value??"";this.syncFormState()}syncFormState(){this.internals.setFormValue(this.value??"");f(this.internals,Boolean(this.value),this.required,this.error)}async checkValidity(){return this.internals.checkValidity()}async reportValidity(){return this.internals.reportValidity()}async getValidationMessage(){return this.internals.validationMessage}formResetCallback(){this.value=this.initialValue;this.draft=null}async stepBy(e){this.step_(e)}get bounds(){return{min:this.min===undefined?-Infinity:Number(this.min),max:this.max===undefined?Infinity:Number(this.max),step:Number(this.step)||1}}get current(){return l(this.value)}get atMin(){const{min:e}=this.bounds;return this.current!==null&&this.current<=e}get atMax(){const{max:e}=this.bounds;return this.current!==null&&this.current>=e}commit(e){const{min:t,max:r,step:i}=this.bounds;const n=e===null?"":String(c(u(e,t,r),i));if(n===this.value)return;this.value=n;this.pfChange.emit({value:n,number:l(n)})}step_(e){if(this.disabled)return;this.draft=null;this.commit(d(this.current,e,this.bounds))}onInput=e=>{const t=e.target.value;this.draft=t;const r=l(t);if(t.trim()===""){this.commit(null);return}if(r!==null)this.commit(r)};onBlur=()=>{this.draft=null};onKeyDown=e=>{if(this.disabled)return;const{min:t,max:r}=this.bounds;if(e.key===o.ArrowUp){e.preventDefault();this.step_(1)}else if(e.key===o.ArrowDown){e.preventDefault();this.step_(-1)}else if(e.key===o.Home&&Number.isFinite(t)){e.preventDefault();this.draft=null;this.commit(t)}else if(e.key===o.End&&Number.isFinite(r)){e.preventDefault();this.draft=null;this.commit(r)}};render(){const e=a(this.description&&"description",this.error&&"error");const{min:t,max:r}=this.bounds;const i=this.draft??p(this.current);return n(s,{key:"27f7f45a2732cbca6d252f4b9128901ed7868663"},n("div",{key:"75bfab2f72a83b830fd960e5fae19b9941eeae6c",class:"field",part:"field"},this.label&&n("label",{key:"f2e60206f153933cde6b36a23c510225bd5fb2ab",class:"label",part:"label",htmlFor:"input"},this.label,this.required&&n("span",{key:"3925b4690d5b560190aaa04e7e7cf83453c7c49e",class:"required","aria-hidden":"true"},"*")),n("div",{key:"dcf1949c7fd8626c5a334fd3d72d8c4544369b41",class:{control:true,"control--invalid":Boolean(this.error)},part:"control"},n("button",{key:"03e3592fa8ff57a23e3675c475e7a66908af6cc3",type:"button",class:"step",part:"decrement","aria-label":this.decrementLabel,disabled:this.disabled||this.atMin,tabindex:"-1",onMouseDown:e=>e.preventDefault(),onClick:()=>this.step_(-1)},n("pf-icon",{key:"157e45ebe127230052c34215c3f88d487dacd41a",name:"minus","aria-hidden":"true"})),n("input",{key:"6fb05cb46de22b37387a16869f93b31b2ea6cc0a",id:"input","aria-label":b(this.el,this.label),part:"input",class:"input",type:"text",inputMode:"decimal",role:"spinbutton",name:this.name,value:i,placeholder:this.placeholder,required:this.required,disabled:this.disabled,autocomplete:"off","aria-invalid":this.error?"true":null,"aria-describedby":e,"aria-valuenow":this.current??null,"aria-valuemin":Number.isFinite(t)?t:null,"aria-valuemax":Number.isFinite(r)?r:null,onInput:this.onInput,onBlur:this.onBlur,onKeyDown:this.onKeyDown}),n("button",{key:"9b6eeddb4884a2961ac5a5cfe6a406111635cf79",type:"button",class:"step",part:"increment","aria-label":this.incrementLabel,disabled:this.disabled||this.atMax,tabindex:"-1",onMouseDown:e=>e.preventDefault(),onClick:()=>this.step_(1)},n("pf-icon",{key:"2a97e66ca7bf42c6d10a872c4b8eec52316d0784",name:"plus","aria-hidden":"true"}))),this.description&&n("p",{key:"3943b0c1ec5ad58d749b0e6d1fb5f60a17eb917e",class:"description",part:"description",id:"description"},this.description),this.error&&n("p",{key:"5aafabcd042976f000f906e6c16fc3eb45d57bf6",class:"error",part:"error",id:"error"},this.error)))}static get delegatesFocus(){return true}static get formAssociated(){return true}static get watchers(){return{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}}static get style(){return m()}},[593,"pf-number-input",{name:[513],value:[1025],min:[2],max:[2],step:[2],label:[1],description:[1],error:[1],placeholder:[1],required:[516],disabled:[516],decrementLabel:[1,"decrement-label"],incrementLabel:[1,"increment-label"],draft:[32],checkValidity:[64],reportValidity:[64],getValidationMessage:[64],stepBy:[64]},undefined,{value:[{syncFormState:0}],error:[{syncFormState:0}],required:[{syncFormState:0}]}]);function y(){if(typeof customElements==="undefined"){return}const t=["pf-number-input","pf-icon"];t.forEach((t=>{switch(t){case"pf-number-input":if(!customElements.get(e(t))){customElements.define(e(t),v)}break;case"pf-icon":if(!customElements.get(e(t))){h()}break}}))}y();const g=v;const x=y;export{g as PfNumberInput,x as defineCustomElement};
2
2
  //# sourceMappingURL=pf-number-input.js.map