ngwr 16.4.0 → 16.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/charts/bar-chart/styles/_index.scss +494 -305
  2. package/charts/boxplot-chart/styles/_index.scss +114 -48
  3. package/charts/bullet-chart/styles/_index.scss +113 -42
  4. package/charts/calendar-heatmap/styles/_index.scss +111 -20
  5. package/charts/candlestick-chart/styles/_index.scss +61 -26
  6. package/charts/chart-legend/styles/_index.scss +119 -1
  7. package/charts/core/styles/_index.scss +201 -5
  8. package/charts/donut-chart/styles/_index.scss +76 -21
  9. package/charts/funnel-chart/styles/_index.scss +66 -38
  10. package/charts/gauge/styles/_index.scss +12 -1
  11. package/charts/heatmap-chart/styles/_index.scss +90 -53
  12. package/charts/line-chart/styles/_index.scss +143 -139
  13. package/charts/meter-group/styles/_index.scss +87 -25
  14. package/charts/radar-chart/styles/_index.scss +82 -40
  15. package/charts/scatter-chart/styles/_index.scss +117 -44
  16. package/charts/sparkline/styles/_index.scss +7 -1
  17. package/charts/treemap-chart/styles/_index.scss +94 -42
  18. package/charts/waterfall-chart/styles/_index.scss +150 -87
  19. package/color-picker/styles/_index.scss +7 -3
  20. package/copy-value/styles/_index.scss +21 -2
  21. package/date-stamp/styles/_index.scss +2 -1
  22. package/dialog/styles/_index.scss +6 -0
  23. package/drawer/styles/_index.scss +5 -1
  24. package/fesm2022/ngwr-carousel-testing.mjs +4 -1
  25. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  26. package/fesm2022/ngwr-carousel.mjs +21 -2
  27. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  28. package/fesm2022/ngwr-cascader-testing.mjs.map +1 -1
  29. package/fesm2022/ngwr-cascader.mjs +48 -4
  30. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  31. package/fesm2022/ngwr-charts-bar-chart-testing.mjs +16 -14
  32. package/fesm2022/ngwr-charts-bar-chart-testing.mjs.map +1 -1
  33. package/fesm2022/ngwr-charts-bar-chart.mjs +399 -141
  34. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  35. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs +19 -5
  36. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs.map +1 -1
  37. package/fesm2022/ngwr-charts-boxplot-chart.mjs +250 -56
  38. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  39. package/fesm2022/ngwr-charts-bullet-chart.mjs +118 -18
  40. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  41. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +266 -46
  42. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  43. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs +21 -10
  44. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs.map +1 -1
  45. package/fesm2022/ngwr-charts-candlestick-chart.mjs +319 -72
  46. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  47. package/fesm2022/ngwr-charts-chart-legend.mjs +211 -9
  48. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  49. package/fesm2022/ngwr-charts-core.mjs +299 -18
  50. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  51. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  52. package/fesm2022/ngwr-charts-donut-chart.mjs +206 -27
  53. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  54. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs +4 -4
  55. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs.map +1 -1
  56. package/fesm2022/ngwr-charts-funnel-chart.mjs +113 -10
  57. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  58. package/fesm2022/ngwr-charts-gauge-testing.mjs.map +1 -1
  59. package/fesm2022/ngwr-charts-gauge.mjs +98 -12
  60. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  61. package/fesm2022/ngwr-charts-heatmap-chart.mjs +226 -31
  62. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  63. package/fesm2022/ngwr-charts-line-chart-testing.mjs +16 -4
  64. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  65. package/fesm2022/ngwr-charts-line-chart.mjs +407 -172
  66. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  67. package/fesm2022/ngwr-charts-meter-group-testing.mjs +4 -4
  68. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  69. package/fesm2022/ngwr-charts-meter-group.mjs +223 -31
  70. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  71. package/fesm2022/ngwr-charts-radar-chart-testing.mjs +2 -1
  72. package/fesm2022/ngwr-charts-radar-chart-testing.mjs.map +1 -1
  73. package/fesm2022/ngwr-charts-radar-chart.mjs +255 -66
  74. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  75. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs +39 -18
  76. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs.map +1 -1
  77. package/fesm2022/ngwr-charts-scatter-chart.mjs +431 -53
  78. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  79. package/fesm2022/ngwr-charts-sparkline.mjs +19 -8
  80. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  81. package/fesm2022/ngwr-charts-treemap-chart.mjs +253 -44
  82. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  83. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs +15 -7
  84. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs.map +1 -1
  85. package/fesm2022/ngwr-charts-waterfall-chart.mjs +151 -23
  86. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  87. package/fesm2022/ngwr-color-picker.mjs +44 -4
  88. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  89. package/fesm2022/ngwr-context-menu-testing.mjs.map +1 -1
  90. package/fesm2022/ngwr-context-menu.mjs +47 -19
  91. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  92. package/fesm2022/ngwr-copy-value-testing.mjs +5 -1
  93. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -1
  94. package/fesm2022/ngwr-copy-value.mjs +38 -2
  95. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  96. package/fesm2022/ngwr-date-picker.mjs +56 -8
  97. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  98. package/fesm2022/ngwr-dialog.mjs +13 -5
  99. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  100. package/fesm2022/ngwr-drawer.mjs +19 -3
  101. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  102. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  103. package/fesm2022/ngwr-dropdown.mjs +35 -6
  104. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  105. package/fesm2022/ngwr-editor.mjs +1 -0
  106. package/fesm2022/ngwr-editor.mjs.map +1 -1
  107. package/fesm2022/ngwr-graph.mjs +81 -13
  108. package/fesm2022/ngwr-graph.mjs.map +1 -1
  109. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  110. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  111. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  112. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  113. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  114. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  115. package/fesm2022/ngwr-i18n-en.mjs +5 -0
  116. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  117. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  118. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  119. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  120. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  121. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  122. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  123. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  124. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  125. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  126. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  127. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  128. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  129. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  130. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  131. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  132. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  133. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  134. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  135. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  136. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  137. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  138. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  139. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  140. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  142. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  144. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  146. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  148. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
  150. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  152. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  153. package/fesm2022/ngwr-lightbox.mjs +20 -3
  154. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  155. package/fesm2022/ngwr-overlay.mjs +21 -2
  156. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  157. package/fesm2022/ngwr-popconfirm-testing.mjs +4 -1
  158. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  159. package/fesm2022/ngwr-popconfirm.mjs +41 -5
  160. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  161. package/fesm2022/ngwr-popover.mjs +67 -12
  162. package/fesm2022/ngwr-popover.mjs.map +1 -1
  163. package/fesm2022/ngwr-schema-form.mjs +2 -0
  164. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  165. package/fesm2022/ngwr-table.mjs +2 -0
  166. package/fesm2022/ngwr-table.mjs.map +1 -1
  167. package/fesm2022/ngwr-tour.mjs +14 -9
  168. package/fesm2022/ngwr-tour.mjs.map +1 -1
  169. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  170. package/fesm2022/ngwr-tree.mjs +49 -16
  171. package/fesm2022/ngwr-tree.mjs.map +1 -1
  172. package/fesm2022/ngwr-version.mjs +1 -1
  173. package/fesm2022/ngwr-version.mjs.map +1 -1
  174. package/fesm2022/ngwr-window.mjs +16 -9
  175. package/fesm2022/ngwr-window.mjs.map +1 -1
  176. package/i18n/ar.json +5 -0
  177. package/i18n/cs.json +5 -0
  178. package/i18n/de.json +5 -0
  179. package/i18n/en.json +5 -0
  180. package/i18n/es.json +5 -0
  181. package/i18n/fr.json +5 -0
  182. package/i18n/he.json +5 -0
  183. package/i18n/hi.json +5 -0
  184. package/i18n/id.json +5 -0
  185. package/i18n/it.json +5 -0
  186. package/i18n/ja.json +5 -0
  187. package/i18n/ko.json +5 -0
  188. package/i18n/nl.json +5 -0
  189. package/i18n/pl.json +5 -0
  190. package/i18n/pt.json +5 -0
  191. package/i18n/ru.json +5 -0
  192. package/i18n/sv.json +5 -0
  193. package/i18n/tr.json +5 -0
  194. package/i18n/uk.json +5 -0
  195. package/i18n/vi.json +5 -0
  196. package/i18n/zh-TW.json +5 -0
  197. package/i18n/zh.json +5 -0
  198. package/llms-full.txt +8 -8
  199. package/llms.txt +7 -3
  200. package/package.json +1 -1
  201. package/popconfirm/styles/_index.scss +6 -0
  202. package/popover/styles/_index.scss +24 -13
  203. package/schematics/use/symbol-map.json +1 -0
  204. package/skills/ngwr/references/catalog.md +1 -1
  205. package/tour/styles/_index.scss +6 -0
  206. package/types/ngwr-carousel-testing.d.ts +6 -4
  207. package/types/ngwr-carousel.d.ts +14 -3
  208. package/types/ngwr-cascader-testing.d.ts +4 -3
  209. package/types/ngwr-cascader.d.ts +27 -3
  210. package/types/ngwr-charts-bar-chart-testing.d.ts +15 -13
  211. package/types/ngwr-charts-bar-chart.d.ts +220 -48
  212. package/types/ngwr-charts-boxplot-chart-testing.d.ts +9 -2
  213. package/types/ngwr-charts-boxplot-chart.d.ts +110 -19
  214. package/types/ngwr-charts-bullet-chart.d.ts +72 -12
  215. package/types/ngwr-charts-calendar-heatmap.d.ts +119 -15
  216. package/types/ngwr-charts-candlestick-chart-testing.d.ts +19 -9
  217. package/types/ngwr-charts-candlestick-chart.d.ts +195 -62
  218. package/types/ngwr-charts-chart-legend.d.ts +142 -5
  219. package/types/ngwr-charts-core.d.ts +259 -21
  220. package/types/ngwr-charts-donut-chart-testing.d.ts +11 -5
  221. package/types/ngwr-charts-donut-chart.d.ts +124 -16
  222. package/types/ngwr-charts-funnel-chart.d.ts +62 -6
  223. package/types/ngwr-charts-gauge-testing.d.ts +5 -1
  224. package/types/ngwr-charts-gauge.d.ts +72 -10
  225. package/types/ngwr-charts-heatmap-chart.d.ts +103 -20
  226. package/types/ngwr-charts-line-chart-testing.d.ts +16 -2
  227. package/types/ngwr-charts-line-chart.d.ts +215 -86
  228. package/types/ngwr-charts-meter-group.d.ts +96 -7
  229. package/types/ngwr-charts-radar-chart-testing.d.ts +14 -3
  230. package/types/ngwr-charts-radar-chart.d.ts +148 -28
  231. package/types/ngwr-charts-scatter-chart-testing.d.ts +22 -10
  232. package/types/ngwr-charts-scatter-chart.d.ts +188 -18
  233. package/types/ngwr-charts-sparkline.d.ts +26 -4
  234. package/types/ngwr-charts-treemap-chart.d.ts +121 -23
  235. package/types/ngwr-charts-waterfall-chart-testing.d.ts +8 -1
  236. package/types/ngwr-charts-waterfall-chart.d.ts +108 -21
  237. package/types/ngwr-color-picker.d.ts +27 -0
  238. package/types/ngwr-context-menu-testing.d.ts +10 -9
  239. package/types/ngwr-context-menu.d.ts +17 -0
  240. package/types/ngwr-copy-value.d.ts +8 -0
  241. package/types/ngwr-date-picker.d.ts +34 -2
  242. package/types/ngwr-dialog.d.ts +30 -10
  243. package/types/ngwr-drawer.d.ts +32 -1
  244. package/types/ngwr-dropdown-testing.d.ts +8 -5
  245. package/types/ngwr-dropdown.d.ts +29 -6
  246. package/types/ngwr-graph.d.ts +22 -6
  247. package/types/ngwr-lightbox.d.ts +15 -0
  248. package/types/ngwr-overlay.d.ts +16 -1
  249. package/types/ngwr-popconfirm-testing.d.ts +11 -2
  250. package/types/ngwr-popconfirm.d.ts +28 -1
  251. package/types/ngwr-popover.d.ts +59 -9
  252. package/types/ngwr-table.d.ts +1 -1
  253. package/types/ngwr-tour.d.ts +21 -2
  254. package/types/ngwr-tree-testing.d.ts +1 -2
  255. package/types/ngwr-tree.d.ts +33 -2
  256. package/types/ngwr-version.d.ts +1 -1
  257. package/types/ngwr-window.d.ts +14 -11
  258. package/window/styles/_index.scss +5 -10
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-cascader-testing.mjs","names":[],"sources":["../../../projects/lib/cascader/testing/wr-cascader-option-harness.ts","../../../projects/lib/cascader/testing/wr-cascader-column-harness.ts","../../../projects/lib/cascader/testing/wr-cascader-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\n\nimport type { WrCascaderOptionHarnessFilters } from './types';\n\n/**\n * Test harness for one option inside a `<wr-cascader>` column.\n *\n * An option is either a BRANCH (it has children, so clicking it opens the next\n * column) or a LEAF (clicking it commits the whole path and closes the panel).\n * {@link hasChildren} reads the chevron the template draws for branches;\n * {@link isExpanded} reads the state that same branch announces. The two are\n * not one question — a branch always HAS children and is expanded only while\n * the column to its right is showing them.\n *\n * The panel is a `role=\"tree\"` and an option is a `treeitem`. It was a `menu`\n * of `menuitem`s until the roles were corrected, and this class documented that\n * a branch announced nothing at all; both are historical now.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrCascaderOptionHarness extends ComponentHarness {\n /** The `<li role=\"treeitem\">` a column renders per option. */\n static hostSelector = '.wr-cascader__opt';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrCascaderOptionHarnessFilters = {}): HarnessPredicate<WrCascaderOptionHarness> {\n return new HarnessPredicate(WrCascaderOptionHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled)\n .addOption('active', options.active, async (harness, active) => (await harness.isActive()) === active)\n .addOption(\n 'hasChildren',\n options.hasChildren,\n async (harness, hasChildren) => (await harness.hasChildren()) === hasChildren\n );\n }\n\n /** The option's label, trimmed. The branch chevron contributes no text. */\n async getText(): Promise<string> {\n return (await this.locatorFor('.wr-cascader__opt-label')()).text();\n }\n\n /** The role the option announces — `treeitem`. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the option refuses selection, from the state a screen reader is given. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-disabled')) === 'true';\n }\n\n /**\n * Whether this is the option its column is currently drilled into — the one\n * whose children the column to the right is showing, or the committed segment\n * at this level.\n *\n * Read from the `--active` modifier, and NOT the same question as\n * {@link isSelected}: this one tracks where the user has navigated, that one\n * tracks what they committed. They agree only once a leaf is picked, and a\n * harness that collapsed them would hide exactly the divergence it exists to\n * catch.\n */\n async isActive(): Promise<boolean> {\n return (await this.host()).hasClass('wr-cascader__opt--active');\n }\n\n /**\n * Whether this option is the committed choice, or `null` when it is not a\n * choice at all.\n *\n * `null` — the attribute absent — for a branch while `changeOnSelect` is off,\n * because such a branch genuinely cannot be chosen. Answering a plausible\n * `false` there would report an unselectable row as merely unselected, which\n * is the distinction the attribute exists to carry.\n */\n async isSelected(): Promise<boolean | null> {\n const raw = await (await this.host()).getAttribute('aria-selected');\n return raw === null ? null : raw === 'true';\n }\n\n /**\n * Whether this branch's children are the column to its right, or `null` for a\n * leaf.\n *\n * `null` rather than `false`, and the difference is the whole point: a leaf\n * does not have a collapsed subtree, it has none. `aria-expanded=\"false\"` on\n * one would state that a subtree exists and is shut.\n */\n async isExpanded(): Promise<boolean | null> {\n const raw = await (await this.host()).getAttribute('aria-expanded');\n return raw === null ? null : raw === 'true';\n }\n\n /**\n * The option's depth, 1-based — its `aria-level`.\n *\n * Worth reading in a spec rather than trusting: the columns are DOM SIBLINGS,\n * so nothing about the markup's shape carries depth. Every option would be\n * level 1 if this attribute were dropped, and no gate would say so.\n */\n async getLevel(): Promise<number | null> {\n const raw = await (await this.host()).getAttribute('aria-level');\n return raw === null ? null : Number.parseInt(raw, 10);\n }\n\n /** Whether the option opens a deeper level rather than ending the path. */\n async hasChildren(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-cascader__opt-arrow')()) !== null;\n }\n\n /**\n * The option's tab index — `0` for the panel's one tab stop, `-1` for every\n * other option, disabled ones included.\n *\n * Worth asking: the panel holds ONE stop, as in the APG tree pattern — the\n * option the caret last moved to, else the selected path's leaf, else the first\n * enabled root — and the arrows move it. Until v15 every enabled option was its\n * own stop.\n *\n * Read as the element's `tabIndex` PROPERTY rather than the attribute, so an\n * option that carried no `tabindex` at all answers `-1` — what the DOM says of a\n * bare `<li>` — instead of a made-up `0` that would report an unfocusable option\n * as the tab stop.\n */\n async getTabIndex(): Promise<number> {\n return (await this.host()).getProperty<number>('tabIndex');\n }\n\n /**\n * Click the option: a branch opens its children to the right, a leaf commits\n * the path and closes the panel.\n *\n * A disabled option is clickable here on purpose — the component refuses it in\n * its own handler rather than through `pointer-events`, so the click a spec\n * dispatches is exactly as ineffective as one in a browser.\n */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /**\n * Activate the option from the keyboard (Enter; Space is bound to the same\n * handler).\n *\n * Sent to THIS option, wherever the caret is. A keyboard user reaches it with\n * the arrows (and type-ahead) from the panel's one tab stop — opening the panel\n * moves focus onto the selected path's leaf, else the first enabled root — and\n * Tab leaves the panel rather than walking it. Call {@link focus} first when a\n * spec wants the caret where a reader's would be.\n */\n async selectByKeyboard(): Promise<void> {\n return (await this.host()).sendKeys(TestKey.ENTER);\n }\n\n /**\n * Move the pointer onto the option.\n *\n * Deliberately does NOT expand a branch: this cascader drills down on CLICK\n * only, unlike the hover-to-expand cascaders elsewhere. Kept because a spec\n * may want to pin that, and because the option's hover tint is styled.\n */\n async hover(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move keyboard focus to the option. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Whether the option holds keyboard focus. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrCascaderColumnHarnessFilters, WrCascaderOptionHarnessFilters } from './types';\nimport { WrCascaderOptionHarness } from './wr-cascader-option-harness';\n\n/**\n * Test harness for one COLUMN of an open `<wr-cascader>` panel.\n *\n * A column is a level of the tree: column 0 holds the root options, and each\n * further column holds the children of the active option in the column before\n * it. Which columns exist is therefore a function of what is expanded — the\n * relationship this harness exists to let a spec assert. Column 0 is always\n * there; a column only appears once there are children to put in it, so a leaf\n * adds none.\n *\n * @example\n * ```ts\n * const [countries, cities] = await cascader.getColumns();\n *\n * expect(await countries.getActiveOptionText()).toBe('Germany');\n * expect(await cities.getOptionLabels()).toEqual(['Berlin']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrCascaderColumnHarness extends ComponentHarness {\n /** The `<ul role=\"group\">` the panel renders per level, inside the `tree`. */\n static hostSelector = '.wr-cascader__col';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrCascaderColumnHarnessFilters = {}): HarnessPredicate<WrCascaderColumnHarness> {\n return new HarnessPredicate(WrCascaderColumnHarness, options).addOption(\n 'optionText',\n options.optionText,\n async (harness, text) => {\n for (const label of await harness.getOptionLabels()) {\n if (await HarnessPredicate.stringMatches(label, text)) return true;\n }\n return false;\n }\n );\n }\n\n /** The role the column announces — `group`, inside the panel's `tree`. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** The options this level offers, in order. */\n async getOptions(filters: WrCascaderOptionHarnessFilters = {}): Promise<WrCascaderOptionHarness[]> {\n return this.locatorForAll(WrCascaderOptionHarness.with(filters))();\n }\n\n /** The labels this level offers, in order. */\n async getOptionLabels(): Promise<string[]> {\n const options = await this.getOptions();\n return Promise.all(options.map(option => option.getText()));\n }\n\n /**\n * The first option matching the filters.\n *\n * Throws rather than answering `null`, and names what the column does offer:\n * a missing option here almost always means the level is not the one the spec\n * thought it was, and that is far easier to see with the alternatives listed.\n */\n async getOption(filters: WrCascaderOptionHarnessFilters): Promise<WrCascaderOptionHarness> {\n const [option] = await this.getOptions(filters);\n if (!option) {\n throw new Error(\n `WrCascaderColumnHarness.getOption(): no option matched ${JSON.stringify(filters)}. ` +\n `This column offers: ${(await this.getOptionLabels()).join(', ')}.`\n );\n }\n return option;\n }\n\n /** The option this level is drilled into, or `null` when nothing here is expanded. */\n async getActiveOption(): Promise<WrCascaderOptionHarness | null> {\n const [active] = await this.getOptions({ active: true });\n return active ?? null;\n }\n\n /** The label of the option this level is drilled into, or `null`. */\n async getActiveOptionText(): Promise<string | null> {\n const active = await this.getActiveOption();\n return active ? active.getText() : null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrCascaderColumnHarnessFilters, WrCascaderHarnessFilters, WrCascaderOptionHarnessFilters } from './types';\nimport { WrCascaderColumnHarness } from './wr-cascader-column-harness';\nimport type { WrCascaderOptionHarness } from './wr-cascader-option-harness';\n\n/**\n * Test harness for `<wr-cascader>` — the trigger, and the panel of COLUMNS it\n * opens. Root of a small family: {@link WrCascaderColumnHarness} for one level,\n * `WrCascaderOptionHarness` for one option in it.\n *\n * A cascader is not a select with extra steps. Its value is the whole PATH from\n * root to leaf (`['eu', 'de', 'ber']`, not `'ber'`), and the panel shows one\n * column per level, so which columns exist depends on what is expanded — column\n * 0 is the roots, and every further column holds the children of the active\n * option in the column to its left. That relationship is the component, so it is\n * what {@link getColumns} and {@link getColumnLabels} are for.\n *\n * The panel is NOT inside the cascader: it is a template portal in the overlay\n * container, a sibling of the whole app. Every read of it goes through the\n * document root scoped by the `aria-controls` id the trigger publishes, so two\n * cascaders on one page can never answer with each other's columns.\n *\n * @example\n * ```ts\n * const cascader = await loader.getHarness(WrCascaderHarness);\n *\n * await cascader.selectPath(['Europe', 'Germany', 'Berlin']);\n *\n * expect(await cascader.getValueText()).toBe('Europe / Germany / Berlin');\n * expect(await cascader.isOpen()).toBe(false);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrCascaderHarness extends ComponentHarness {\n static hostSelector = 'wr-cascader';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrCascaderHarnessFilters = {}): HarnessPredicate<WrCascaderHarness> {\n return new HarnessPredicate(WrCascaderHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getValueText(), text))\n .addOption('placeholder', options.placeholder, (harness, placeholder) =>\n HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder)\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled)\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n private readonly trigger = this.locatorFor('.wr-cascader__trigger');\n\n /**\n * Whether the panel is showing.\n *\n * From the trigger's `aria-expanded` rather than the host's `--open` class:\n * both exist, and the ARIA state is the one a screen-reader user is told.\n */\n async isOpen(): Promise<boolean> {\n return (await (await this.trigger()).getAttribute('aria-expanded')) === 'true';\n }\n\n /**\n * Whether the cascader refuses interaction.\n *\n * From the trigger's native `disabled`, which is what actually stops a pointer\n * and what assistive tech reports; the host's `--disabled` class only mirrors\n * it for styling.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.trigger()).getProperty<boolean>('disabled');\n }\n\n /**\n * What the trigger displays as the selection: the labels of the whole path\n * joined by the `separator` (`'Europe / Germany / Berlin'` by default), or `''`\n * while nothing is selected and the placeholder is showing.\n *\n * The joined string is all the DOM has — the separator is not published\n * anywhere on its own, so the harness will not pretend it can split the path\n * back apart. Assert against the bound value, or against\n * {@link getActiveTrail} while the panel is open, when the segments matter.\n */\n async getValueText(): Promise<string> {\n const value = await this.locatorForOptional('.wr-cascader__value')();\n return value ? value.text() : '';\n }\n\n /**\n * The placeholder, or `null` when a selection is hiding it.\n *\n * `''` is a real answer, not an absence: a cascader with no `placeholder` still\n * renders the element while unselected.\n */\n async getPlaceholder(): Promise<string | null> {\n const placeholder = await this.locatorForOptional('.wr-cascader__placeholder')();\n return placeholder ? placeholder.text() : null;\n }\n\n /**\n * The trigger's accessible name — the `ariaLabel` input, falling back to the\n * placeholder and then to the i18n catalog, because a `role=\"combobox\"` with\n * nothing selected and no placeholder would otherwise have no name at all.\n */\n async getAccessibleName(): Promise<string | null> {\n return (await this.trigger()).getAttribute('aria-label');\n }\n\n /**\n * The kind of popup the trigger promises via `aria-haspopup` — `tree`.\n *\n * Worth pinning rather than assuming: a combobox's popup may be a listbox, a\n * tree, a grid or a dialog and nothing else, and this one said `menu` for a\n * long time. `menu` is a valid token for the global `aria-haspopup`, so axe\n * reports nothing either way — an assertion here is the only guard there is.\n */\n async getPopupRole(): Promise<string | null> {\n return (await this.trigger()).getAttribute('aria-haspopup');\n }\n\n /** The role the panel announces — `tree`, matching what the trigger promised. */\n async getPanelRole(): Promise<string | null> {\n return (await this.panel()).getAttribute('role');\n }\n\n /**\n * The id the trigger publishes as `aria-controls`.\n *\n * Published unconditionally, open or closed — so while the panel is closed this\n * id resolves to nothing in the document. Exposed so a spec can pin that\n * (dangling or not) rather than have the harness quietly decide for it; every\n * panel read goes through the same id but refuses to run while closed.\n */\n async getPanelId(): Promise<string | null> {\n return (await this.trigger()).getAttribute('aria-controls');\n }\n\n /**\n * Whether the panel now in the overlay is the one this trigger claims to\n * control — `aria-controls` resolving to a real element that carries that id.\n *\n * With several cascaders on a page it is also the check that the reference lands\n * on THIS instance's panel rather than a neighbour's: the overlay container is\n * shared, so panels sit side by side in it with nothing but their ids to tell\n * them apart.\n */\n async isPanelWiredToTrigger(): Promise<boolean> {\n const rendered = await (await this.panel()).getAttribute('id');\n return rendered !== null && rendered === (await this.getPanelId());\n }\n\n /**\n * Open the panel.\n *\n * Clicks the trigger, because that is the only gesture the component binds. The\n * trigger is a native `<button>`, so a browser turns Enter / Space on it into\n * the same click — there is no separate keyboard route to model here, and jsdom\n * does not synthesise button activation from a key, so an `openByKeyboard()`\n * would only be able to lie.\n */\n async open(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.trigger()).click();\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrCascaderHarness.open(): the panel did not open. A disabled cascader refuses the click — ' +\n 'check isDisabled().'\n );\n }\n\n /**\n * Close the panel with Escape. A closed cascader is left alone.\n *\n * Escape reaches the panel through the CDK's keyboard dispatcher rather than\n * through the DOM tree, which is why sending it to the trigger works even\n * though the panel is somewhere else entirely.\n */\n async close(): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await (await this.trigger()).sendKeys(TestKey.ESCAPE);\n if (await this.isOpen()) {\n throw new Error('WrCascaderHarness.close(): Escape did not close the panel.');\n }\n }\n\n /** Click the trigger once, whatever that does — opens a closed panel, closes an open one. */\n async clickTrigger(): Promise<void> {\n return (await this.trigger()).click();\n }\n\n /**\n * The columns of the open panel, left to right: column 0 is the root options,\n * and each further one holds the children of its neighbour's active option.\n *\n * Throws while the panel is closed. The columns do not exist anywhere until the\n * portal is attached, and an empty array reads like a panel that rendered\n * nothing — a confusing failure three lines later instead of here.\n */\n async getColumns(filters: WrCascaderColumnHarnessFilters = {}): Promise<WrCascaderColumnHarness[]> {\n const loader = await this.panelLoader();\n return loader.getAllHarnesses(WrCascaderColumnHarness.with(filters));\n }\n\n /** How many levels the panel is currently showing. */\n async getColumnCount(): Promise<number> {\n return (await this.getColumns()).length;\n }\n\n /**\n * One column by its 0-based level. Throws when the level is not showing, which\n * is the interesting failure: it means the option before it has no children, or\n * has not been expanded yet.\n */\n async getColumn(index: number): Promise<WrCascaderColumnHarness> {\n const columns = await this.getColumns();\n const column = columns[index];\n if (!column) {\n throw new Error(\n `WrCascaderHarness.getColumn(): no column at level ${index} — the panel is showing ` +\n `${columns.length}. A deeper column appears only once a parent with children is expanded.`\n );\n }\n return column;\n }\n\n /** The labels offered by every column, outer array left to right. */\n async getColumnLabels(): Promise<string[][]> {\n const columns = await this.getColumns();\n return Promise.all(columns.map(column => column.getOptionLabels()));\n }\n\n /**\n * The expanded trail — the label of the active option in each column, root\n * first.\n *\n * This is the panel's own idea of where the user is, which is NOT always the\n * committed value: drilling into a branch moves the trail without committing\n * anything unless `changeOnSelect` is on. Once a leaf is picked the two agree,\n * and this is the only place the path's segments exist separately in the DOM.\n */\n async getActiveTrail(): Promise<string[]> {\n const trail: string[] = [];\n for (const column of await this.getColumns()) {\n const active = await column.getActiveOptionText();\n if (active !== null) trail.push(active);\n }\n return trail;\n }\n\n /**\n * The first option matching the filters, anywhere in the panel. Throws when\n * nothing matches, naming what is on offer.\n *\n * Use {@link getColumn} when the level matters — the same label can legitimately\n * appear at more than one level.\n */\n async getOption(filters: WrCascaderOptionHarnessFilters): Promise<WrCascaderOptionHarness> {\n for (const column of await this.getColumns()) {\n const [option] = await column.getOptions(filters);\n if (option) return option;\n }\n\n throw new Error(\n `WrCascaderHarness.getOption(): no option matched ${JSON.stringify(filters)}. ` +\n `The panel offers: ${(await this.getColumnLabels()).map(labels => labels.join(', ')).join(' | ')}.`\n );\n }\n\n /**\n * Walk a path by label, opening the panel first if needed: each label is\n * clicked in the column it belongs to, so `['Europe', 'Germany', 'Berlin']`\n * drills two levels and commits the third.\n *\n * Clicking is the only way down — this cascader does not expand on hover, so\n * neither does the harness. A path that ends on a BRANCH just leaves that\n * branch expanded: the component commits nothing on the way down unless\n * `changeOnSelect` is on, and only a leaf closes the panel.\n */\n async selectPath(labels: readonly string[]): Promise<void> {\n if (labels.length === 0) {\n throw new Error(\n 'WrCascaderHarness.selectPath(): the path is empty. Pass at least one label, or call clear() ' +\n 'to unset the selection.'\n );\n }\n\n await this.open();\n\n for (let level = 0; level < labels.length; level++) {\n const label = labels[level];\n const columns = await this.getColumns();\n const column = columns[level];\n if (!column) {\n throw new Error(\n `WrCascaderHarness.selectPath(): \"${label}\" would be at level ${level}, but the panel is ` +\n `showing ${columns.length} column(s) — the step before it opened no deeper level.`\n );\n }\n\n const option = await column.getOption({ text: label });\n if (await option.isDisabled()) {\n throw new Error(`WrCascaderHarness.selectPath(): \"${label}\" is disabled, so no path can pass through it.`);\n }\n\n const isLast = level === labels.length - 1;\n if (!isLast && !(await option.hasChildren())) {\n throw new Error(\n `WrCascaderHarness.selectPath(): \"${label}\" is a leaf, so the path cannot continue to ` +\n `\"${labels[level + 1]}\" — picking it commits and closes the panel.`\n );\n }\n\n await option.click();\n }\n }\n\n /**\n * Click the clear (×) control on the trigger.\n *\n * Throws when there is none, and both reasons are worth failing on: the\n * cascader is not `clearable`, or nothing is selected — the control is not\n * rendered at all in either case (nor while disabled).\n */\n async clear(): Promise<void> {\n const clear = await this.locatorForOptional('.wr-cascader__clear')();\n if (!clear) {\n throw new Error(\n 'WrCascaderHarness.clear(): this cascader shows no clear control — it is rendered only when ' +\n '`clearable` is on, something is selected, and the control is enabled.'\n );\n }\n await clear.click();\n }\n\n /**\n * Clear from the keyboard — Backspace on the closed trigger.\n *\n * The × {@link clear} clicks is a `tabindex=\"-1\"` span inside the trigger, so no\n * key can ever reach it; Backspace on the trigger is its keyboard twin, and the\n * route a keyboard-only user actually has. Prefer this one in a spec that cares\n * about that user — {@link clear} proves the pointer path and nothing more.\n *\n * The component honours the key only on the CLOSED trigger, so an open panel\n * is closed first with Escape — the step a keyboard user takes too. Sending\n * Backspace into an open panel and returning would be a plausible nothing.\n *\n * Does nothing, rather than throwing, when there is nothing to clear, `clearable`\n * is off, or the cascader is disabled or read-only: that silence IS the\n * component's contract, so a spec asserts it on the value.\n */\n async clearByKeyboard(): Promise<void> {\n if (await this.isOpen()) await this.close();\n await (await this.trigger()).sendKeys(TestKey.BACKSPACE);\n }\n\n /** Move keyboard focus to the trigger. */\n async focus(): Promise<void> {\n return (await this.trigger()).focus();\n }\n\n /** Take focus off the trigger, which is what makes a bound form field touched. */\n async blur(): Promise<void> {\n return (await this.trigger()).blur();\n }\n\n /** Whether the trigger holds keyboard focus. */\n async isFocused(): Promise<boolean> {\n return (await this.trigger()).isFocused();\n }\n\n /** This cascader's panel element in the overlay — the single-element scoped read. */\n private async panel(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /**\n * A loader scoped to THIS cascader's panel — the list scoped read.\n *\n * Scoped by the published id rather than by `.wr-cascader-panel`: the overlay\n * container is shared with every other overlay in the app, so a bare class\n * query would answer with whichever panel happened to be open.\n */\n private async panelLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /** The panel id, refusing to hand it out while there is no panel to find. */\n private async panelId(): Promise<string> {\n if (!(await this.isOpen())) {\n throw new Error(\n 'WrCascaderHarness: the panel is closed, so there are no columns to read — call open() or ' +\n 'selectPath() first. The trigger publishes `aria-controls` even while closed, so the id ' +\n 'alone is not proof the panel exists.'\n );\n }\n\n const id = await this.getPanelId();\n if (!id) {\n throw new Error('WrCascaderHarness: the trigger publishes no `aria-controls`, so its panel cannot be found.');\n }\n return id;\n }\n}\n"],"mappings":";;;;;;;AA2BA,IAAa,0BAAb,MAAa,gCAAgC,iBAAgB;CAE3D,OAAO,eAAe;CAGtB,OAAO,KAAK,UAA0C,CAAA,GAAE;EACtD,OAAO,IAAI,iBAAiB,yBAAyB,OAAO,CAAC,CAC1D,UAAU,QAAQ,QAAQ,OAAO,SAAS,SAAS,iBAAiB,cAAc,QAAQ,QAAO,GAAI,IAAI,CAAC,CAAC,CAC3G,UAAU,YAAY,QAAQ,UAAU,OAAO,SAAS,aAAc,MAAM,QAAQ,WAAU,MAAQ,QAAQ,CAAC,CAC/G,UAAU,UAAU,QAAQ,QAAQ,OAAO,SAAS,WAAY,MAAM,QAAQ,SAAQ,MAAQ,MAAM,CAAC,CACrG,UACC,eACA,QAAQ,aACR,OAAO,SAAS,gBAAiB,MAAM,QAAQ,YAAW,MAAQ,WAAW;CAEnF;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,WAAW,yBAAyB,CAAC,CAAA,EAAA,CAAI,KAAI;CAClE;CAGA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,MAAM;CAChD;CAGA,MAAM,aAAU;EACd,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,eAAe,MAAO;CACvE;CAaA,MAAM,WAAQ;EACZ,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI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QAAK;EACjB,OAAO,KAAK,2BAA0B,CAAE,CAAC,WAAW,IAAI,MAAM,KAAK,QAAO,GAAI,CAAC,CAAA;CACjF;CASQ,MAAM,cAAW;EACvB,OAAO,KAAK,2BAA0B,CAAE,CAAC,iBAAiB,IAAI,MAAM,KAAK,QAAO,GAAI;CACtF;CAGQ,MAAM,UAAO;EACnB,IAAI,CAAE,MAAM,KAAK,OAAM,GACrB,MAAM,IAAI,MACR,sNAEwC;EAI5C,MAAM,KAAK,MAAM,KAAK,WAAU;EAChC,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,4FAA4F;EAE9G,OAAO;CACT"}
1
+ {"version":3,"file":"ngwr-cascader-testing.mjs","names":[],"sources":["../../../projects/lib/cascader/testing/wr-cascader-option-harness.ts","../../../projects/lib/cascader/testing/wr-cascader-column-harness.ts","../../../projects/lib/cascader/testing/wr-cascader-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\n\nimport type { WrCascaderOptionHarnessFilters } from './types';\n\n/**\n * Test harness for one option inside a `<wr-cascader>` column.\n *\n * An option is either a BRANCH (it has children, so clicking it opens the next\n * column) or a LEAF (clicking it commits the whole path and closes the panel).\n * {@link hasChildren} reads the chevron the template draws for branches;\n * {@link isExpanded} reads the state that same branch announces. The two are\n * not one question — a branch always HAS children and is expanded only while\n * the column to its right is showing them.\n *\n * The panel is a `role=\"tree\"` and an option is a `treeitem`. It was a `menu`\n * of `menuitem`s until the roles were corrected, and this class documented that\n * a branch announced nothing at all; both are historical now.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrCascaderOptionHarness extends ComponentHarness {\n /** The `<li role=\"treeitem\">` a column renders per option. */\n static hostSelector = '.wr-cascader__opt';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrCascaderOptionHarnessFilters = {}): HarnessPredicate<WrCascaderOptionHarness> {\n return new HarnessPredicate(WrCascaderOptionHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled)\n .addOption('active', options.active, async (harness, active) => (await harness.isActive()) === active)\n .addOption(\n 'hasChildren',\n options.hasChildren,\n async (harness, hasChildren) => (await harness.hasChildren()) === hasChildren\n );\n }\n\n /** The option's label, trimmed. The branch chevron contributes no text. */\n async getText(): Promise<string> {\n return (await this.locatorFor('.wr-cascader__opt-label')()).text();\n }\n\n /** The role the option announces — `treeitem`. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the option refuses selection, from the state a screen reader is given. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-disabled')) === 'true';\n }\n\n /**\n * Whether this is the option its column is currently drilled into — the one\n * whose children the column to the right is showing, or the committed segment\n * at this level.\n *\n * Read from the `--active` modifier, and NOT the same question as\n * {@link isSelected}: this one tracks where the user has navigated, that one\n * tracks what they committed. They agree only once a leaf is picked, and a\n * harness that collapsed them would hide exactly the divergence it exists to\n * catch.\n */\n async isActive(): Promise<boolean> {\n return (await this.host()).hasClass('wr-cascader__opt--active');\n }\n\n /**\n * Whether this option is the committed choice, or `null` when it is not a\n * choice at all.\n *\n * `null` — the attribute absent — for a branch while `changeOnSelect` is off,\n * because such a branch genuinely cannot be chosen. Answering a plausible\n * `false` there would report an unselectable row as merely unselected, which\n * is the distinction the attribute exists to carry.\n */\n async isSelected(): Promise<boolean | null> {\n const raw = await (await this.host()).getAttribute('aria-selected');\n return raw === null ? null : raw === 'true';\n }\n\n /**\n * Whether this branch's children are the column to its right, or `null` for a\n * leaf.\n *\n * `null` rather than `false`, and the difference is the whole point: a leaf\n * does not have a collapsed subtree, it has none. `aria-expanded=\"false\"` on\n * one would state that a subtree exists and is shut.\n */\n async isExpanded(): Promise<boolean | null> {\n const raw = await (await this.host()).getAttribute('aria-expanded');\n return raw === null ? null : raw === 'true';\n }\n\n /**\n * The option's depth, 1-based — its `aria-level`.\n *\n * Worth reading in a spec rather than trusting: the columns are DOM SIBLINGS,\n * so nothing about the markup's shape carries depth. Every option would be\n * level 1 if this attribute were dropped, and no gate would say so.\n */\n async getLevel(): Promise<number | null> {\n const raw = await (await this.host()).getAttribute('aria-level');\n return raw === null ? null : Number.parseInt(raw, 10);\n }\n\n /** Whether the option opens a deeper level rather than ending the path. */\n async hasChildren(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-cascader__opt-arrow')()) !== null;\n }\n\n /**\n * The option's tab index — `0` for the panel's one tab stop, `-1` for every\n * other option, disabled ones included.\n *\n * Worth asking: the panel holds ONE stop, as in the APG tree pattern — the\n * option the caret last moved to, else the selected path's leaf, else the first\n * enabled root — and the arrows move it. Until v15 every enabled option was its\n * own stop.\n *\n * Read as the element's `tabIndex` PROPERTY rather than the attribute, so an\n * option that carried no `tabindex` at all answers `-1` — what the DOM says of a\n * bare `<li>` — instead of a made-up `0` that would report an unfocusable option\n * as the tab stop.\n */\n async getTabIndex(): Promise<number> {\n return (await this.host()).getProperty<number>('tabIndex');\n }\n\n /**\n * Click the option: a branch opens its children to the right, a leaf commits\n * the path and closes the panel.\n *\n * A disabled option is clickable here on purpose — the component refuses it in\n * its own handler rather than through `pointer-events`, so the click a spec\n * dispatches is exactly as ineffective as one in a browser.\n */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n\n /**\n * Activate the option from the keyboard (Enter; Space is bound to the same\n * handler).\n *\n * Sent to THIS option, wherever the caret is. A keyboard user reaches it with\n * the arrows (and type-ahead) from the panel's one tab stop — ArrowDown or Tab\n * on the trigger of an open panel moves focus onto the selected path's leaf,\n * else the first enabled root; opening alone moves nothing unless `autoFocus`\n * is set — and Tab leaves the panel rather than walking it. Call {@link focus} first when a\n * spec wants the caret where a reader's would be.\n */\n async selectByKeyboard(): Promise<void> {\n return (await this.host()).sendKeys(TestKey.ENTER);\n }\n\n /**\n * Move the pointer onto the option.\n *\n * Deliberately does NOT expand a branch: this cascader drills down on CLICK\n * only, unlike the hover-to-expand cascaders elsewhere. Kept because a spec\n * may want to pin that, and because the option's hover tint is styled.\n */\n async hover(): Promise<void> {\n return (await this.host()).hover();\n }\n\n /** Move keyboard focus to the option. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Whether the option holds keyboard focus. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrCascaderColumnHarnessFilters, WrCascaderOptionHarnessFilters } from './types';\nimport { WrCascaderOptionHarness } from './wr-cascader-option-harness';\n\n/**\n * Test harness for one COLUMN of an open `<wr-cascader>` panel.\n *\n * A column is a level of the tree: column 0 holds the root options, and each\n * further column holds the children of the active option in the column before\n * it. Which columns exist is therefore a function of what is expanded — the\n * relationship this harness exists to let a spec assert. Column 0 is always\n * there; a column only appears once there are children to put in it, so a leaf\n * adds none.\n *\n * @example\n * ```ts\n * const [countries, cities] = await cascader.getColumns();\n *\n * expect(await countries.getActiveOptionText()).toBe('Germany');\n * expect(await cities.getOptionLabels()).toEqual(['Berlin']);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrCascaderColumnHarness extends ComponentHarness {\n /** The `<ul role=\"group\">` the panel renders per level, inside the `tree`. */\n static hostSelector = '.wr-cascader__col';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrCascaderColumnHarnessFilters = {}): HarnessPredicate<WrCascaderColumnHarness> {\n return new HarnessPredicate(WrCascaderColumnHarness, options).addOption(\n 'optionText',\n options.optionText,\n async (harness, text) => {\n for (const label of await harness.getOptionLabels()) {\n if (await HarnessPredicate.stringMatches(label, text)) return true;\n }\n return false;\n }\n );\n }\n\n /** The role the column announces — `group`, inside the panel's `tree`. */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** The options this level offers, in order. */\n async getOptions(filters: WrCascaderOptionHarnessFilters = {}): Promise<WrCascaderOptionHarness[]> {\n return this.locatorForAll(WrCascaderOptionHarness.with(filters))();\n }\n\n /** The labels this level offers, in order. */\n async getOptionLabels(): Promise<string[]> {\n const options = await this.getOptions();\n return Promise.all(options.map(option => option.getText()));\n }\n\n /**\n * The first option matching the filters.\n *\n * Throws rather than answering `null`, and names what the column does offer:\n * a missing option here almost always means the level is not the one the spec\n * thought it was, and that is far easier to see with the alternatives listed.\n */\n async getOption(filters: WrCascaderOptionHarnessFilters): Promise<WrCascaderOptionHarness> {\n const [option] = await this.getOptions(filters);\n if (!option) {\n throw new Error(\n `WrCascaderColumnHarness.getOption(): no option matched ${JSON.stringify(filters)}. ` +\n `This column offers: ${(await this.getOptionLabels()).join(', ')}.`\n );\n }\n return option;\n }\n\n /** The option this level is drilled into, or `null` when nothing here is expanded. */\n async getActiveOption(): Promise<WrCascaderOptionHarness | null> {\n const [active] = await this.getOptions({ active: true });\n return active ?? null;\n }\n\n /** The label of the option this level is drilled into, or `null`. */\n async getActiveOptionText(): Promise<string | null> {\n const active = await this.getActiveOption();\n return active ? active.getText() : null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n ComponentHarness,\n type HarnessLoader,\n HarnessPredicate,\n TestKey,\n type TestElement,\n} from '@angular/cdk/testing';\n\nimport type { WrCascaderColumnHarnessFilters, WrCascaderHarnessFilters, WrCascaderOptionHarnessFilters } from './types';\nimport { WrCascaderColumnHarness } from './wr-cascader-column-harness';\nimport type { WrCascaderOptionHarness } from './wr-cascader-option-harness';\n\n/**\n * Test harness for `<wr-cascader>` — the trigger, and the panel of COLUMNS it\n * opens. Root of a small family: {@link WrCascaderColumnHarness} for one level,\n * `WrCascaderOptionHarness` for one option in it.\n *\n * A cascader is not a select with extra steps. Its value is the whole PATH from\n * root to leaf (`['eu', 'de', 'ber']`, not `'ber'`), and the panel shows one\n * column per level, so which columns exist depends on what is expanded — column\n * 0 is the roots, and every further column holds the children of the active\n * option in the column to its left. That relationship is the component, so it is\n * what {@link getColumns} and {@link getColumnLabels} are for.\n *\n * The panel is NOT inside the cascader: it is a template portal in the overlay\n * container, a sibling of the whole app. Every read of it goes through the\n * document root scoped by the `aria-controls` id the trigger publishes, so two\n * cascaders on one page can never answer with each other's columns.\n *\n * @example\n * ```ts\n * const cascader = await loader.getHarness(WrCascaderHarness);\n *\n * await cascader.selectPath(['Europe', 'Germany', 'Berlin']);\n *\n * expect(await cascader.getValueText()).toBe('Europe / Germany / Berlin');\n * expect(await cascader.isOpen()).toBe(false);\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrCascaderHarness extends ComponentHarness {\n static hostSelector = 'wr-cascader';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrCascaderHarnessFilters = {}): HarnessPredicate<WrCascaderHarness> {\n return new HarnessPredicate(WrCascaderHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getValueText(), text))\n .addOption('placeholder', options.placeholder, (harness, placeholder) =>\n HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder)\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled)\n .addOption('open', options.open, async (harness, open) => (await harness.isOpen()) === open);\n }\n\n private readonly trigger = this.locatorFor('.wr-cascader__trigger');\n\n /**\n * Whether the panel is showing.\n *\n * From the trigger's `aria-expanded` rather than the host's `--open` class:\n * both exist, and the ARIA state is the one a screen-reader user is told.\n */\n async isOpen(): Promise<boolean> {\n return (await (await this.trigger()).getAttribute('aria-expanded')) === 'true';\n }\n\n /**\n * Whether the cascader refuses interaction.\n *\n * From the trigger's native `disabled`, which is what actually stops a pointer\n * and what assistive tech reports; the host's `--disabled` class only mirrors\n * it for styling.\n */\n async isDisabled(): Promise<boolean> {\n return (await this.trigger()).getProperty<boolean>('disabled');\n }\n\n /**\n * What the trigger displays as the selection: the labels of the whole path\n * joined by the `separator` (`'Europe / Germany / Berlin'` by default), or `''`\n * while nothing is selected and the placeholder is showing.\n *\n * The joined string is all the DOM has — the separator is not published\n * anywhere on its own, so the harness will not pretend it can split the path\n * back apart. Assert against the bound value, or against\n * {@link getActiveTrail} while the panel is open, when the segments matter.\n */\n async getValueText(): Promise<string> {\n const value = await this.locatorForOptional('.wr-cascader__value')();\n return value ? value.text() : '';\n }\n\n /**\n * The placeholder, or `null` when a selection is hiding it.\n *\n * `''` is a real answer, not an absence: a cascader with no `placeholder` still\n * renders the element while unselected.\n */\n async getPlaceholder(): Promise<string | null> {\n const placeholder = await this.locatorForOptional('.wr-cascader__placeholder')();\n return placeholder ? placeholder.text() : null;\n }\n\n /**\n * The trigger's accessible name — the `ariaLabel` input, falling back to the\n * placeholder and then to the i18n catalog, because a `role=\"combobox\"` with\n * nothing selected and no placeholder would otherwise have no name at all.\n */\n async getAccessibleName(): Promise<string | null> {\n return (await this.trigger()).getAttribute('aria-label');\n }\n\n /**\n * The kind of popup the trigger promises via `aria-haspopup` — `tree`.\n *\n * Worth pinning rather than assuming: a combobox's popup may be a listbox, a\n * tree, a grid or a dialog and nothing else, and this one said `menu` for a\n * long time. `menu` is a valid token for the global `aria-haspopup`, so axe\n * reports nothing either way — an assertion here is the only guard there is.\n */\n async getPopupRole(): Promise<string | null> {\n return (await this.trigger()).getAttribute('aria-haspopup');\n }\n\n /** The role the panel announces — `tree`, matching what the trigger promised. */\n async getPanelRole(): Promise<string | null> {\n return (await this.panel()).getAttribute('role');\n }\n\n /**\n * The id the trigger publishes as `aria-controls`.\n *\n * Published unconditionally, open or closed — so while the panel is closed this\n * id resolves to nothing in the document. Exposed so a spec can pin that\n * (dangling or not) rather than have the harness quietly decide for it; every\n * panel read goes through the same id but refuses to run while closed.\n */\n async getPanelId(): Promise<string | null> {\n return (await this.trigger()).getAttribute('aria-controls');\n }\n\n /**\n * Whether the panel now in the overlay is the one this trigger claims to\n * control — `aria-controls` resolving to a real element that carries that id.\n *\n * With several cascaders on a page it is also the check that the reference lands\n * on THIS instance's panel rather than a neighbour's: the overlay container is\n * shared, so panels sit side by side in it with nothing but their ids to tell\n * them apart.\n */\n async isPanelWiredToTrigger(): Promise<boolean> {\n const rendered = await (await this.panel()).getAttribute('id');\n return rendered !== null && rendered === (await this.getPanelId());\n }\n\n /**\n * Open the panel.\n *\n * Clicks the trigger, because that is the only gesture the component binds. The\n * trigger is a native `<button>`, so a browser turns Enter / Space on it into\n * the same click — there is no separate keyboard route to model here, and jsdom\n * does not synthesise button activation from a key, so an `openByKeyboard()`\n * would only be able to lie.\n */\n async open(): Promise<void> {\n if (await this.isOpen()) return;\n\n await (await this.trigger()).click();\n if (await this.isOpen()) return;\n\n throw new Error(\n 'WrCascaderHarness.open(): the panel did not open. A disabled cascader refuses the click — ' +\n 'check isDisabled().'\n );\n }\n\n /**\n * Close the panel with Escape. A closed cascader is left alone.\n *\n * Escape reaches the panel through the CDK's keyboard dispatcher rather than\n * through the DOM tree, which is why sending it to the trigger works even\n * though the panel is somewhere else entirely.\n */\n async close(): Promise<void> {\n if (!(await this.isOpen())) return;\n\n await (await this.trigger()).sendKeys(TestKey.ESCAPE);\n if (await this.isOpen()) {\n throw new Error('WrCascaderHarness.close(): Escape did not close the panel.');\n }\n }\n\n /** Click the trigger once, whatever that does — opens a closed panel, closes an open one. */\n async clickTrigger(): Promise<void> {\n return (await this.trigger()).click();\n }\n\n /**\n * The columns of the open panel, left to right: column 0 is the root options,\n * and each further one holds the children of its neighbour's active option.\n *\n * Throws while the panel is closed. The columns do not exist anywhere until the\n * portal is attached, and an empty array reads like a panel that rendered\n * nothing — a confusing failure three lines later instead of here.\n */\n async getColumns(filters: WrCascaderColumnHarnessFilters = {}): Promise<WrCascaderColumnHarness[]> {\n const loader = await this.panelLoader();\n return loader.getAllHarnesses(WrCascaderColumnHarness.with(filters));\n }\n\n /** How many levels the panel is currently showing. */\n async getColumnCount(): Promise<number> {\n return (await this.getColumns()).length;\n }\n\n /**\n * One column by its 0-based level. Throws when the level is not showing, which\n * is the interesting failure: it means the option before it has no children, or\n * has not been expanded yet.\n */\n async getColumn(index: number): Promise<WrCascaderColumnHarness> {\n const columns = await this.getColumns();\n const column = columns[index];\n if (!column) {\n throw new Error(\n `WrCascaderHarness.getColumn(): no column at level ${index} — the panel is showing ` +\n `${columns.length}. A deeper column appears only once a parent with children is expanded.`\n );\n }\n return column;\n }\n\n /** The labels offered by every column, outer array left to right. */\n async getColumnLabels(): Promise<string[][]> {\n const columns = await this.getColumns();\n return Promise.all(columns.map(column => column.getOptionLabels()));\n }\n\n /**\n * The expanded trail — the label of the active option in each column, root\n * first.\n *\n * This is the panel's own idea of where the user is, which is NOT always the\n * committed value: drilling into a branch moves the trail without committing\n * anything unless `changeOnSelect` is on. Once a leaf is picked the two agree,\n * and this is the only place the path's segments exist separately in the DOM.\n */\n async getActiveTrail(): Promise<string[]> {\n const trail: string[] = [];\n for (const column of await this.getColumns()) {\n const active = await column.getActiveOptionText();\n if (active !== null) trail.push(active);\n }\n return trail;\n }\n\n /**\n * The first option matching the filters, anywhere in the panel. Throws when\n * nothing matches, naming what is on offer.\n *\n * Use {@link getColumn} when the level matters — the same label can legitimately\n * appear at more than one level.\n */\n async getOption(filters: WrCascaderOptionHarnessFilters): Promise<WrCascaderOptionHarness> {\n for (const column of await this.getColumns()) {\n const [option] = await column.getOptions(filters);\n if (option) return option;\n }\n\n throw new Error(\n `WrCascaderHarness.getOption(): no option matched ${JSON.stringify(filters)}. ` +\n `The panel offers: ${(await this.getColumnLabels()).map(labels => labels.join(', ')).join(' | ')}.`\n );\n }\n\n /**\n * Walk a path by label, opening the panel first if needed: each label is\n * clicked in the column it belongs to, so `['Europe', 'Germany', 'Berlin']`\n * drills two levels and commits the third.\n *\n * Clicking is the only way down — this cascader does not expand on hover, so\n * neither does the harness. A path that ends on a BRANCH just leaves that\n * branch expanded: the component commits nothing on the way down unless\n * `changeOnSelect` is on, and only a leaf closes the panel.\n */\n async selectPath(labels: readonly string[]): Promise<void> {\n if (labels.length === 0) {\n throw new Error(\n 'WrCascaderHarness.selectPath(): the path is empty. Pass at least one label, or call clear() ' +\n 'to unset the selection.'\n );\n }\n\n await this.open();\n\n for (let level = 0; level < labels.length; level++) {\n const label = labels[level];\n const columns = await this.getColumns();\n const column = columns[level];\n if (!column) {\n throw new Error(\n `WrCascaderHarness.selectPath(): \"${label}\" would be at level ${level}, but the panel is ` +\n `showing ${columns.length} column(s) — the step before it opened no deeper level.`\n );\n }\n\n const option = await column.getOption({ text: label });\n if (await option.isDisabled()) {\n throw new Error(`WrCascaderHarness.selectPath(): \"${label}\" is disabled, so no path can pass through it.`);\n }\n\n const isLast = level === labels.length - 1;\n if (!isLast && !(await option.hasChildren())) {\n throw new Error(\n `WrCascaderHarness.selectPath(): \"${label}\" is a leaf, so the path cannot continue to ` +\n `\"${labels[level + 1]}\" — picking it commits and closes the panel.`\n );\n }\n\n await option.click();\n }\n }\n\n /**\n * Click the clear (×) control on the trigger.\n *\n * Throws when there is none, and both reasons are worth failing on: the\n * cascader is not `clearable`, or nothing is selected — the control is not\n * rendered at all in either case (nor while disabled).\n */\n async clear(): Promise<void> {\n const clear = await this.locatorForOptional('.wr-cascader__clear')();\n if (!clear) {\n throw new Error(\n 'WrCascaderHarness.clear(): this cascader shows no clear control — it is rendered only when ' +\n '`clearable` is on, something is selected, and the control is enabled.'\n );\n }\n await clear.click();\n }\n\n /**\n * Clear from the keyboard — Backspace on the closed trigger.\n *\n * The × {@link clear} clicks is a `tabindex=\"-1\"` span inside the trigger, so no\n * key can ever reach it; Backspace on the trigger is its keyboard twin, and the\n * route a keyboard-only user actually has. Prefer this one in a spec that cares\n * about that user — {@link clear} proves the pointer path and nothing more.\n *\n * The component honours the key only on the CLOSED trigger, so an open panel\n * is closed first with Escape — the step a keyboard user takes too. Sending\n * Backspace into an open panel and returning would be a plausible nothing.\n *\n * Does nothing, rather than throwing, when there is nothing to clear, `clearable`\n * is off, or the cascader is disabled or read-only: that silence IS the\n * component's contract, so a spec asserts it on the value.\n */\n async clearByKeyboard(): Promise<void> {\n if (await this.isOpen()) await this.close();\n await (await this.trigger()).sendKeys(TestKey.BACKSPACE);\n }\n\n /** Move keyboard focus to the trigger. */\n async focus(): Promise<void> {\n return (await this.trigger()).focus();\n }\n\n /** Take focus off the trigger, which is what makes a bound form field touched. */\n async blur(): Promise<void> {\n return (await this.trigger()).blur();\n }\n\n /** Whether the trigger holds keyboard focus. */\n async isFocused(): Promise<boolean> {\n return (await this.trigger()).isFocused();\n }\n\n /** This cascader's panel element in the overlay — the single-element scoped read. */\n private async panel(): Promise<TestElement> {\n return this.documentRootLocatorFactory().locatorFor(`#${await this.panelId()}`)();\n }\n\n /**\n * A loader scoped to THIS cascader's panel — the list scoped read.\n *\n * Scoped by the published id rather than by `.wr-cascader-panel`: the overlay\n * container is shared with every other overlay in the app, so a bare class\n * query would answer with whichever panel happened to be open.\n */\n private async panelLoader(): Promise<HarnessLoader> {\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${await this.panelId()}`);\n }\n\n /** The panel id, refusing to hand it out while there is no panel to find. */\n private async panelId(): Promise<string> {\n if (!(await this.isOpen())) {\n throw new Error(\n 'WrCascaderHarness: the panel is closed, so there are no columns to read — call open() or ' +\n 'selectPath() first. The trigger publishes `aria-controls` even while closed, so the id ' +\n 'alone is not proof the panel exists.'\n );\n }\n\n const id = await this.getPanelId();\n if (!id) {\n throw new Error('WrCascaderHarness: the trigger publishes no `aria-controls`, so its panel cannot be found.');\n }\n return id;\n }\n}\n"],"mappings":";;;;;;;AA2BA,IAAa,0BAAb,MAAa,gCAAgC,iBAAgB;CAE3D,OAAO,eAAe;CAGtB,OAAO,KAAK,UAA0C,CAAA,GAAE;EACtD,OAAO,IAAI,iBAAiB,yBAA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gD;GAI3G,IAAI,EADW,UAAU,OAAO,SAAS,MAC1B,CAAE,MAAM,OAAO,YAAW,GACvC,MAAM,IAAI,MACR,oCAAoC,MAAK,+CACnC,OAAO,QAAQ,GAAE,6CAA8C;GAIzE,MAAM,OAAO,MAAK;EACpB;CACF;CASA,MAAM,QAAK;EACT,MAAM,QAAQ,MAAM,KAAK,mBAAmB,qBAAqB,CAAC,CAAA;EAClE,IAAI,CAAC,OACH,MAAM,IAAI,MACR,kKACyE;EAG7E,MAAM,MAAM,MAAK;CACnB;CAkBA,MAAM,kBAAe;EACnB,IAAI,MAAM,KAAK,OAAM,GAAI,MAAM,KAAK,MAAK;EACzC,OAAO,MAAM,KAAK,QAAO,EAAA,CAAI,SAAS,QAAQ,SAAS;CACzD;CAGA,MAAM,QAAK;EACT,QAAQ,MAAM,KAAK,QAAO,EAAA,CAAI,MAAK;CACrC;CAGA,MAAM,OAAI;EACR,QAAQ,MAAM,KAAK,QAAO,EAAA,CAAI,KAAI;CACpC;CAGA,MAAM,YAAS;EACb,QAAQ,MAAM,KAAK,QAAO,EAAA,CAAI,UAAS;CACzC;CAGQ,MAAM,QAAK;EACjB,OAAO,KAAK,2BAA0B,CAAE,CAAC,WAAW,IAAI,MAAM,KAAK,QAAO,GAAI,CAAC,CAAA;CACjF;CASQ,MAAM,cAAW;EACvB,OAAO,KAAK,2BAA0B,CAAE,CAAC,iBAAiB,IAAI,MAAM,KAAK,QAAO,GAAI;CACtF;CAGQ,MAAM,UAAO;EACnB,IAAI,CAAE,MAAM,KAAK,OAAM,GACrB,MAAM,IAAI,MACR,sNAEwC;EAI5C,MAAM,KAAK,MAAM,KAAK,WAAU;EAChC,IAAI,CAAC,IACH,MAAM,IAAI,MAAM,4FAA4F;EAE9G,OAAO;CACT"}
@@ -59,6 +59,10 @@ var WrCascader = class WrCascader {
59
59
  transform: coerceBooleanProperty
60
60
  });
61
61
  separator = input("/", ...ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []);
62
+ autoFocus = input(false, {
63
+ ...ngDevMode ? { debugName: "autoFocus" } : /* istanbul ignore next */ {},
64
+ transform: coerceBooleanProperty
65
+ });
62
66
  panelClass = input(null, ...ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []);
63
67
  value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
64
68
  touch = output();
@@ -178,7 +182,11 @@ var WrCascader = class WrCascader {
178
182
  this.openState.update((v) => !v);
179
183
  }
180
184
  onTriggerKeydown(event) {
181
- if (this.disabled() || this.readonly() || this.isOpen()) return;
185
+ if (this.disabled() || this.readonly()) return;
186
+ if (this.isOpen()) {
187
+ this.enterPanelFromTrigger(event);
188
+ return;
189
+ }
182
190
  if (event.key === "Backspace") {
183
191
  if (!this.clearable() || !this.hasSelection()) return;
184
192
  event.preventDefault();
@@ -190,6 +198,25 @@ var WrCascader = class WrCascader {
190
198
  this.activePath.set(this.path());
191
199
  this.openState.set(true);
192
200
  }
201
+ enterPanelFromTrigger(event) {
202
+ const pane = this.overlayRef?.overlayElement;
203
+ if (!pane || event.defaultPrevented) return;
204
+ const stop = pane.querySelector("[role=\"treeitem\"][tabindex=\"0\"]");
205
+ if (wrIsPrintableKey(event) && event.key !== " ") {
206
+ const column = stop?.closest("[role=\"group\"]");
207
+ if (column && this.typeAhead(column, null, event)) event.preventDefault();
208
+ return;
209
+ }
210
+ if (event.altKey || event.ctrlKey || event.metaKey) return;
211
+ if (event.key === "Tab") {
212
+ if (event.shiftKey || !stop) {
213
+ this.openState.set(false);
214
+ return;
215
+ }
216
+ } else if (event.shiftKey || event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
217
+ event.preventDefault();
218
+ stop?.focus();
219
+ }
193
220
  onOptionClick(colIndex, opt, event) {
194
221
  event.stopPropagation();
195
222
  if (opt.disabled || this.disabled() || this.readonly()) return;
@@ -265,8 +292,10 @@ var WrCascader = class WrCascader {
265
292
  typeAhead(column, current, event) {
266
293
  const enabled = [...column.querySelectorAll("[role=\"treeitem\"]")].filter((o) => o.getAttribute("aria-disabled") !== "true");
267
294
  const labels = enabled.map((o) => o.querySelector(".wr-cascader__opt-label")?.textContent ?? "");
268
- const index = this.typeahead.handleKey(event, labels, enabled.indexOf(current));
269
- if (index !== null && index >= 0) enabled[index].focus();
295
+ const index = this.typeahead.handleKey(event, labels, current ? enabled.indexOf(current) : -1);
296
+ if (index === null || index < 0) return false;
297
+ enabled[index].focus();
298
+ return true;
270
299
  }
271
300
  clearSelection(event) {
272
301
  event.stopPropagation();
@@ -320,7 +349,7 @@ var WrCascader = class WrCascader {
320
349
  wrFollowDirection(this.overlayRef, this.dir, this.injector);
321
350
  const portal = new TemplatePortal(this.panelTpl(), this.vcr);
322
351
  this.overlayRef.attach(portal);
323
- afterNextRender(() => this.focusPanelOption(), { injector: this.injector });
352
+ if (this.autoFocus()) afterNextRender(() => this.focusPanelOption(), { injector: this.injector });
324
353
  this.outsideClick.outsidePointerEvents(this.overlayRef).pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
325
354
  if (this.host.nativeElement.contains(event.target)) return;
326
355
  this.openState.set(false);
@@ -442,6 +471,13 @@ var WrCascader = class WrCascader {
442
471
  isRequired: false,
443
472
  transformFunction: null
444
473
  },
474
+ autoFocus: {
475
+ classPropertyName: "autoFocus",
476
+ publicName: "autoFocus",
477
+ isSignal: true,
478
+ isRequired: false,
479
+ transformFunction: null
480
+ },
445
481
  panelClass: {
446
482
  classPropertyName: "panelClass",
447
483
  publicName: "panelClass",
@@ -589,6 +625,14 @@ i0.ɵɵngDeclareClassMetadata({
589
625
  required: false
590
626
  }]
591
627
  }],
628
+ autoFocus: [{
629
+ type: i0.Input,
630
+ args: [{
631
+ isSignal: true,
632
+ alias: "autoFocus",
633
+ required: false
634
+ }]
635
+ }],
592
636
  panelClass: [{
593
637
  type: i0.Input,
594
638
  args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-cascader.mjs","names":[],"sources":["../../../projects/lib/cascader/cascader.ts","../../../projects/lib/cascader/cascader.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from 'ngwr/overlay';\nimport { WR_LIVE_LOCALE, wrIsPrintableKey, wrToClassList, wrTypeahead, type WrClassInput } from 'ngwr/utils';\n\nimport type { WrCascaderOption } from './types';\n\nlet panelUid = 0;\n\n/**\n * Whether a keydown is a Tab that takes focus out of the open panel. The pane\n * lives in the overlay container at the end of `<body>`, so the browser's own Tab\n * out of it went to `<body>` — the top of the page — with the panel left standing.\n * The caller focuses the trigger synchronously and does NOT `preventDefault`, so\n * the browser's Tab carries on from there to the trigger's real neighbour — the\n * move `wr-dropdown` makes for its menu.\n *\n * Every Tab inside the pane leaves it, in either direction: the panel holds ONE\n * tab stop (the roving one, see `tabStop`), so there is nowhere else inside it for\n * Tab to go. Asking \"is there a later stop\" instead would also answer wrongly for\n * the moment between an arrow key moving focus and the render that moves the\n * `tabindex=\"0\"` after it.\n */\nfunction tabLeavesPane(pane: HTMLElement, event: KeyboardEvent): boolean {\n if (event.key !== 'Tab' || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return false;\n const active = pane.ownerDocument.activeElement;\n return !!active && pane.contains(active);\n}\n\n/**\n * Multi-level select — drills down through hierarchical categories\n * (e.g. country → state → city). Each level renders as a column; clicks\n * advance to the next column. Selecting a leaf (no children) commits\n * the full path.\n *\n * A signal-forms native control: it implements `FormValueControl<unknown>`,\n * so `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. The value\n * is the path through the tree (an array from root to leaf).\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-cascader [options]=\"locations\" [formField]=\"form.path\" placeholder=\"Pick a location\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-cascader [options]=\"locations\" [(value)]=\"path\" placeholder=\"Pick a location\" />\n * ```\n *\n * ```ts\n * locations: WrCascaderOption[] = [\n * {\n * value: 'us', label: 'United States', children: [\n * { value: 'ny', label: 'New York', children: [\n * { value: 'nyc', label: 'NYC' },\n * { value: 'buf', label: 'Buffalo' },\n * ] },\n * ],\n * },\n * ];\n * ```\n *\n * @see https://ngwr.dev/reference/components/cascader\n */\nexport type WrCascaderSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-cascader',\n templateUrl: './cascader.html',\n styleUrl: './cascader.scss',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-cascader', '[class]': 'classes()' },\n})\nexport class WrCascader<T = string> implements FormValueControl<unknown> {\n /** Accessible name. Falls back to `select.clearSelection`, then `'Clear selection'`. */\n readonly clearLabel = input<string | null>(null);\n\n protected readonly resolvedClearLabel = useI18nText(this.clearLabel, 'select.clearSelection', 'Clear selection');\n\n /** Root-level options. Each may have `children` for deeper levels. */\n readonly options = input.required<readonly WrCascaderOption<T>[]>();\n\n /** Placeholder shown when no path is selected. @default '' */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name of the trigger. Falls back to the placeholder, then to\n * `select.label` — a `role=\"combobox\"` with nothing selected and no\n * placeholder otherwise has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly labelText = useI18nText(this.ariaLabel, 'select.label', 'Select');\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty placeholder must fall through to the catalog string.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n const placeholder = this.placeholder();\n return placeholder ? placeholder : this.labelText();\n });\n\n /**\n * Disable the cascader. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes while the trigger stays focusable and the path still submits.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The panel is where every edit happens, so a read-only cascader simply does\n * not open — there is nothing to browse that is not already on the trigger —\n * and the clear button goes away with it. Mirrored as `aria-readonly`, which\n * role `combobox` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /**\n * The field's own label, when it renders one — `null` otherwise, and `null`\n * when `[ariaLabel]` was set deliberately.\n *\n * `aria-label` outranks a `<label for>` in the accname order, so without this\n * a cascader inside `<wr-form-field label=\"Region\">` announced its\n * PLACEHOLDER, or the generic `select.label` default, and the visible label\n * reached nobody. Nothing catches it: the control has a name, so axe is\n * satisfied, and the name is plausible, so a reader is too — it fails WCAG\n * 2.5.3, where the visible label has to be IN the accessible name. Same call\n * `wr-rating` and `wr-knob` already make.\n */\n protected readonly labelledBy = computed(() => (this.ariaLabel() ? null : this.fieldAria.labelledBy()));\n\n /** `null` once `aria-labelledby` is carrying the name — see {@link labelledBy}. */\n protected readonly nameLabel = computed(() => (this.labelledBy() ? null : this.resolvedAriaLabel()));\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrCascaderSize>('md');\n\n /** Pill-shaped corners on the trigger. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Show a clear-all (×) button on the trigger when a path is selected. @default true */\n readonly clearable = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Allow selecting non-leaf (parent) nodes. When `false`, only leaves\n * (nodes without children) commit a selection. @default false\n */\n readonly changeOnSelect = input(false, { transform: coerceBooleanProperty });\n\n /** Separator between labels in the trigger display. @default '/' */\n readonly separator = input<string>('/');\n\n /**\n * Extra CSS classes for the column panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Committed selection path (full array from root to leaf). Bound by\n * `[formField]`, or two-way via `[(value)]`.\n */\n readonly value = model<unknown>([]);\n\n /** Emitted on blur / commit so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /** Fires after the panel opens. */\n readonly opened = output<void>();\n\n /** Fires after the panel closes. */\n readonly closed = output<void>();\n\n /** Committed selection path (full T[] from root to leaf). @internal */\n protected readonly path = signal<readonly T[]>([]);\n\n /** Currently-expanded column path — drives which columns the panel shows. @internal */\n protected readonly activePath = signal<readonly T[]>([]);\n\n private readonly openState = signal(false);\n\n /** Whether the panel is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n /**\n * The option the user last moved to inside the open panel — `null` until they\n * move, and again on every open. Written by an option's `focus` event, so\n * whatever moved the caret (an arrow, a click, a harness, a type-ahead letter)\n * moves the tab stop with it.\n */\n private readonly cursor = signal<{ readonly col: number; readonly value: T } | null>(null);\n\n /**\n * The panel's ONE tab stop, as in the APG tree pattern: the option the user\n * moved to, else the selected path's leaf, else the first enabled root. Every\n * other option carries `tabindex=\"-1\"` and is reached with the arrows, so a\n * deep tree is one Tab to enter and one to leave instead of a stop per option.\n *\n * Validated against what is ON SCREEN rather than trusted: choosing a sibling\n * prunes the deeper columns, and a value written from outside replaces the\n * path, so a remembered position can name an option that is gone. A disabled\n * option is never the stop — `focus()` would land on a choice nobody can make.\n * When the leaf itself is not on screen or is disabled, the deepest ancestor on\n * the path that is takes its place.\n */\n protected readonly tabStop = computed<{ readonly col: number; readonly value: T } | null>(() => {\n const cols = this.columns();\n const enabledAt = (col: number, value: T): boolean => !!cols[col]?.some(o => o.value === value && !o.disabled);\n\n const at = this.cursor();\n if (at && enabledAt(at.col, at.value)) return at;\n\n const path = this.path();\n const active = this.activePath();\n for (let col = Math.min(path.length, cols.length) - 1; col >= 0; col--) {\n // Column `col` lists the children of the ACTIVE path above it, so the path's\n // node at that depth is on screen only while the two agree that far down.\n if (!this.pathsEqual(path.slice(0, col), active.slice(0, col))) continue;\n if (enabledAt(col, path[col])) return { col, value: path[col] };\n }\n\n const first = cols[0]?.find(o => !o.disabled);\n return first ? { col: 0, value: first.value } : null;\n });\n\n private readonly liveLocale = inject(WR_LIVE_LOCALE, { optional: true });\n /** Letters typed in quick succession, for type-ahead. */\n private readonly typeahead = wrTypeahead({ locale: () => this.liveLocale?.() });\n\n /** Panel id used by the trigger's `aria-controls`. */\n protected readonly panelId = `wr-cascader-panel-${++panelUid}`;\n\n /**\n * Columns visible in the panel. Each column shows the children of the\n * preceding activePath entry. Column 0 = root options. The last\n * column is whatever the deepest active node's children resolve to —\n * we only render a column when there are children to show.\n */\n protected readonly columns = computed<readonly (readonly WrCascaderOption<T>[])[]>(() => {\n const cols: (readonly WrCascaderOption<T>[])[] = [this.options()];\n const trail = this.activePath();\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of trail) {\n const node = list.find(o => o.value === v);\n if (!node?.children?.length) break;\n cols.push(node.children);\n list = node.children;\n }\n return cols;\n });\n\n /** Label trail joined by `separator()` — what the trigger shows. */\n protected readonly displayLabel = computed(() => {\n const p = this.path();\n if (p.length === 0) return null;\n const labels: string[] = [];\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of p) {\n const node = list.find(o => o.value === v);\n if (!node) return null;\n labels.push(node.label);\n list = node.children ?? [];\n }\n const sep = ` ${this.separator()} `;\n return labels.join(sep);\n });\n\n protected readonly hasSelection = computed(() => this.path().length > 0);\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-cascader--${size}`);\n if (this.rounded()) parts.push('wr-cascader--rounded');\n if (this.isOpen()) parts.push('wr-cascader--open');\n if (this.disabled()) parts.push('wr-cascader--disabled');\n else if (this.readonly()) parts.push('wr-cascader--readonly');\n return parts.join(' ');\n });\n\n protected readonly panelTpl = viewChild.required('panelTpl', { read: TemplateRef });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n /**\n * Ambient reading direction, for the open panel alone — nothing in this\n * component reads it directly. Optional so a bare `TestBed` needs no\n * provider; `Directionality` is root-provided anyway, and a missing one\n * simply reads as `ltr`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n private overlayRef: OverlayRef | null = null;\n\n constructor() {\n // Same contract as wr-select / wr-dropdown / wr-lightbox: an overlay lives in\n // the CDK container, not in this component's view, so destroying the\n // component while the panel is open would strand the pane and its scroll\n // strategy.\n this.destroyRef.onDestroy(() => this.closeOverlay(false));\n\n effect(() => {\n if (this.isOpen()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n\n // Close the panel if the control becomes disabled or read-only while open.\n effect(() => {\n if (this.disabled() || this.readonly()) this.openState.set(false);\n });\n\n // Mirror an external `value` write into the internal path/activePath\n // (the old `writeValue`). Skipped when the write merely echoes the\n // committed path, so a live drill-down can never be clobbered.\n effect(() => {\n // Coerce null/undefined/non-array to an empty path — a classic-forms\n // binding can write null, which the old `writeValue(value: unknown)`\n // treated as \"no selection\" too.\n const value = this.value();\n untracked(() => {\n const next: readonly T[] = Array.isArray(value) ? (value as readonly T[]) : [];\n if (this.pathsEqual(this.path(), next)) return;\n this.path.set(next);\n this.activePath.set(next);\n });\n });\n }\n\n /**\n * Focus the trigger — what Signal Forms calls to focus this control. The\n * panel stays shut: ArrowDown or a click opens it, the way it does after Tab.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus(options);\n }\n\n /** Open the panel on the selected path, as the trigger does. Refused while disabled or read-only. */\n open(): void {\n if (this.disabled() || this.readonly() || this.isOpen()) return;\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n /** Close the panel. */\n close(): void {\n this.openState.set(false);\n }\n\n // Template handlers\n\n protected onTriggerClick(): void {\n if (this.disabled() || this.readonly()) return;\n if (!this.isOpen()) this.activePath.set(this.path());\n this.openState.update(v => !v);\n }\n\n /**\n * ArrowDown / ArrowUp open the panel, Alt+ArrowDown included — the combobox way in,\n * and the shape `wr-dropdown`'s trigger uses. Enter and Space need no branch: the\n * trigger is a real `<button>`, so the browser turns them into the click above.\n *\n * Only while closed. Once the panel is up the caret is inside it, and its options\n * own their own keys.\n */\n protected onTriggerKeydown(event: KeyboardEvent): void {\n if (this.disabled() || this.readonly() || this.isOpen()) return;\n\n // Backspace is the × from the keyboard, and it has to be: the × is a\n // `tabindex=\"-1\"` span INSIDE this button, and a keydown goes to the focused\n // element, so the `(keydown.enter)` / `(keydown.space)` it used to carry could\n // never fire. Clearing was reachable by pointer alone — a WCAG 2.1.1 failure,\n // not a missing convenience. The span stays unfocusable, because a focusable\n // child of a button is `nested-interactive`. Same key, same gating as\n // `wr-select`: `clearable()` IS the clear control, so a consumer who turned\n // the × off did not ask for a keyboard twin of it.\n if (event.key === 'Backspace') {\n if (!this.clearable() || !this.hasSelection()) return;\n event.preventDefault();\n this.clearSelection(event);\n return;\n }\n\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;\n event.preventDefault();\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n protected onOptionClick(colIndex: number, opt: WrCascaderOption<T>, event: Event): void {\n event.stopPropagation();\n if (opt.disabled || this.disabled() || this.readonly()) return;\n\n const head = this.activePath().slice(0, colIndex);\n const newPath = [...head, opt.value];\n\n const hasChildren = !!opt.children?.length;\n\n // Always update active column for visual feedback / next column.\n this.activePath.set(newPath);\n // A pointer click focuses the option anyway (see `onOptionFocus`); a scripted\n // `click()` does not, and the tab stop belongs where the choice was made.\n this.cursor.set({ col: colIndex, value: opt.value });\n\n // Commit when we've reached a leaf, or when changeOnSelect is on.\n if (!hasChildren || this.changeOnSelect()) {\n this.path.set(newPath);\n this.value.set(newPath);\n this.touch.emit();\n // Close once we hit a true leaf — parent commits keep the panel open.\n if (!hasChildren) this.openState.set(false);\n }\n }\n\n /**\n * The tree keys the panel's roles promise, per the APG tree pattern: Up / Down\n * within a column, Home / End to its ends, the inline-end arrow into a branch's\n * children — opening the next column on the way — and the inline-start arrow back\n * to the option the column belongs to, or, from a root, closing the column it\n * opened. A letter moves to the next option in the column whose label starts with\n * what was typed. Enter and Space stay the commit.\n *\n * These are the ONLY way between options: the panel holds one tab stop (see\n * {@link tabStop}), and Tab leaves it.\n */\n protected onOptionKeydown(colIndex: number, opt: WrCascaderOption<T>, event: KeyboardEvent): void {\n const current = event.currentTarget as HTMLElement;\n const column = current.closest<HTMLElement>('[role=\"group\"]');\n if (!column) return;\n // Before the modifier check, because Shift is how a capital letter is typed.\n if (wrIsPrintableKey(event) && event.key !== ' ') {\n this.typeAhead(column, current, event);\n event.preventDefault();\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const rtl = this.dir?.value === 'rtl';\n const inward = rtl ? 'ArrowLeft' : 'ArrowRight';\n const outward = rtl ? 'ArrowRight' : 'ArrowLeft';\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const at = enabled.indexOf(current);\n\n switch (event.key) {\n case 'ArrowDown':\n enabled[at + 1]?.focus();\n break;\n case 'ArrowUp':\n if (at > 0) enabled[at - 1].focus();\n break;\n case 'Home':\n enabled[0]?.focus();\n break;\n case 'End':\n enabled[enabled.length - 1]?.focus();\n break;\n case inward: {\n if (opt.disabled || !opt.children?.length || this.disabled() || this.readonly()) break;\n this.activePath.set([...this.activePath().slice(0, colIndex), opt.value]);\n // The column is not in the DOM until the render this write schedules.\n afterNextRender(\n () =>\n this.overlayRef?.overlayElement\n .querySelector<HTMLElement>(\n `#${this.columnId(colIndex + 1)} [role=\"treeitem\"]:not([aria-disabled=\"true\"])`\n )\n ?.focus(),\n { injector: this.injector }\n );\n break;\n }\n case outward: {\n if (colIndex > 0) {\n const parent = this.parentOptionId(colIndex);\n if (parent) this.overlayRef?.overlayElement.querySelector<HTMLElement>(`#${parent}`)?.focus();\n } else if (opt.children?.length && this.isActiveAt(colIndex, opt.value)) {\n this.activePath.set([]);\n }\n break;\n }\n case ' ':\n // The commit is `(keydown.space)`'s; the page scrolling a screen under the\n // panel is the browser's, and it went with every Space on an option.\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n /** The caret reached an option, by whatever route — the tab stop follows it. */\n protected onOptionFocus(colIndex: number, opt: WrCascaderOption<T>): void {\n if (opt.disabled) return;\n this.cursor.set({ col: colIndex, value: opt.value });\n }\n\n /** Whether this option is the panel's one `tabindex=\"0\"`. */\n protected isTabStop(colIndex: number, opt: WrCascaderOption<T>): boolean {\n const stop = this.tabStop();\n return !opt.disabled && stop !== null && stop.col === colIndex && stop.value === opt.value;\n }\n\n /**\n * Move to the next enabled option in `column` whose label starts with the letters\n * typed so far: {@link wrTypeahead} over the column's labels.\n */\n private typeAhead(column: HTMLElement, current: HTMLElement, event: KeyboardEvent): void {\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const labels = enabled.map(o => o.querySelector('.wr-cascader__opt-label')?.textContent ?? '');\n const index = this.typeahead.handleKey(event, labels, enabled.indexOf(current));\n if (index !== null && index >= 0) enabled[index].focus();\n }\n\n protected clearSelection(event: Event): void {\n event.stopPropagation();\n if (this.disabled() || this.readonly()) return;\n this.path.set([]);\n this.activePath.set([]);\n this.value.set([]);\n this.touch.emit();\n }\n\n protected isActiveAt(colIndex: number, value: T): boolean {\n return this.activePath()[colIndex] === value;\n }\n\n /**\n * Whether this option is the committed choice — `null` when it is not a\n * choice at all.\n *\n * Two questions the panel has to keep apart, and `--active` answers only the\n * first: `activePath()` is where the user has NAVIGATED to, `path()` is what\n * they have COMMITTED. They agree once a leaf is picked and diverge for the\n * whole walk down.\n *\n * `null` — the attribute absent — on a branch while `changeOnSelect` is off,\n * because such a branch genuinely cannot be chosen; ARIA reads a missing\n * `aria-selected` as \"not selectable\", which is exactly true here. That makes\n * this binding the first expression the `changeOnSelect` contract has ever had\n * in ARIA, in both directions.\n */\n protected isSelectedAt(colIndex: number, opt: WrCascaderOption<T>): boolean | null {\n const committable = !opt.children?.length || this.changeOnSelect();\n if (!committable) return null;\n const path = this.path();\n return colIndex === path.length - 1 && path[colIndex] === opt.value;\n }\n\n /** Stable id for one option — what a column's `aria-labelledby` points at. */\n protected optionId(colIndex: number, optIndex: number): string {\n return `${this.panelId}-opt-${colIndex}-${optIndex}`;\n }\n\n /** Stable id for one column — what an expanded branch's `aria-controls` points at. */\n protected columnId(colIndex: number): string {\n return `${this.panelId}-col-${colIndex}`;\n }\n\n /**\n * The option whose children a column holds, by id — its accessible name.\n *\n * The columns are DOM SIBLINGS, so nothing in the markup says the second one\n * belongs to \"Europe\". Column 0 has no parent and stays unnamed; the tree\n * itself already carries the control's name.\n */\n protected parentOptionId(colIndex: number): string | null {\n if (colIndex === 0) return null;\n const parent = this.columns()[colIndex - 1] ?? [];\n const index = parent.findIndex(o => this.isActiveAt(colIndex - 1, o.value));\n return index < 0 ? null : this.optionId(colIndex - 1, index);\n }\n\n private pathsEqual(a: readonly T[], b: readonly T[]): boolean {\n return a.length === b.length && a.every((v, i) => v === b[i]);\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n // Each open starts from the selected path, not from where the last visit ended.\n this.cursor.set(null);\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n ])\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-cascader-overlay', this.panelClass()),\n });\n\n // The columns cascade inline-wards, and the CDK captured the direction as a\n // string when this ref was created — so a flip while the panel is open left\n // the whole cascade running the other way from the page around it.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n // Move the caret into the panel it just opened. Nothing did, and the pane is\n // appended to `<body>`, so an opened cascader left focus on the trigger and its\n // options were reachable only by tabbing past the whole rest of the page —\n // `wr-tree` and `wr-context-menu` were the same defect. `closeOverlay` below\n // already assumes this is where the caret lives.\n //\n // `afterNextRender`, NOT `queueMicrotask`: under zoneless CD change detection runs\n // in a macrotask, so a microtask queued here fires before the columns are in the\n // DOM — the trap that once left `wr-calendar`'s ring and its real focus on\n // different days.\n afterNextRender(() => this.focusPanelOption(), { injector: this.injector });\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.openState.set(false);\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.openState.set(false);\n return;\n }\n if (this.overlayRef && tabLeavesPane(this.overlayRef.overlayElement, event)) {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.openState.set(false);\n }\n });\n\n this.opened.emit();\n }\n\n /**\n * The option the panel opens on: its tab stop, which on open is the selected path's\n * leaf, else the first enabled root (see {@link tabStop}). A disabled option is\n * never the stop, so `focus()` cannot land on a choice nobody can make.\n */\n private focusPanelOption(): void {\n this.overlayRef?.overlayElement.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]')?.focus();\n }\n\n /** `notify: false` is the destroy path: an output cannot emit from a destroyed view. */\n private closeOverlay(notify = true): void {\n if (!this.overlayRef) return;\n // Opening moves the caret onto the panel's tab stop and every option commits\n // on Enter, so on the keyboard the caret is INSIDE the pane by design — and\n // the ordinary way to finish choosing (`onOptionClick` on a leaf) closes it.\n // Disposing without handing focus back dropped it on `<body>` on the SUCCESS\n // path, not merely on dismissal: a keyboard user who had just picked a value\n // then had to Tab from the top of the document to get back to the control.\n // Untouched when focus had already moved elsewhere — that click is usually\n // what closed us, and stealing the caret back would fight the user for it.\n const pane = this.overlayRef.overlayElement;\n const focusWasInside = pane.contains(this.host.nativeElement.ownerDocument.activeElement);\n this.overlayRef.dispose();\n this.overlayRef = null;\n if (!notify) return;\n if (focusWasInside) this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.closed.emit();\n }\n}\n\nexport type { WrCascaderOption } from './types';\n","<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,IAAI,WAAW;AAgBf,SAAS,cAAc,MAAmB,OAAoB;CAC5D,IAAI,MAAM,QAAQ,SAAS,MAAM,oBAAoB,MAAM,UAAU,MAAM,WAAW,MAAM,SAAS,OAAO;CAC5G,MAAM,SAAS,KAAK,cAAc;CAClC,OAAO,CAAC,CAAC,UAAU,KAAK,SAAS,MAAM;AACzC;AA8CA,IAAa,aAAb,MAAa,WAAU;CAEZ,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAE7B,qBAAqB,YAAY,KAAK,YAAY,yBAAyB,iBAAiB;CAGtG,UAAU,MAAM,SAA0C,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAG1D,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAO/B,YAAY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AA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAU;IAAI,MAAM;IAAa,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-cascader.mjs","names":[],"sources":["../../../projects/lib/cascader/cascader.ts","../../../projects/lib/cascader/cascader.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from 'ngwr/overlay';\nimport { WR_LIVE_LOCALE, wrIsPrintableKey, wrToClassList, wrTypeahead, type WrClassInput } from 'ngwr/utils';\n\nimport type { WrCascaderOption } from './types';\n\nlet panelUid = 0;\n\n/**\n * Whether a keydown is a Tab that takes focus out of the open panel. The pane\n * lives in the overlay container at the end of `<body>`, so the browser's own Tab\n * out of it went to `<body>` — the top of the page — with the panel left standing.\n * The caller focuses the trigger synchronously and does NOT `preventDefault`, so\n * the browser's Tab carries on from there to the trigger's real neighbour — the\n * move `wr-dropdown` makes for its menu.\n *\n * Every Tab inside the pane leaves it, in either direction: the panel holds ONE\n * tab stop (the roving one, see `tabStop`), so there is nowhere else inside it for\n * Tab to go. Asking \"is there a later stop\" instead would also answer wrongly for\n * the moment between an arrow key moving focus and the render that moves the\n * `tabindex=\"0\"` after it.\n */\nfunction tabLeavesPane(pane: HTMLElement, event: KeyboardEvent): boolean {\n if (event.key !== 'Tab' || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return false;\n const active = pane.ownerDocument.activeElement;\n return !!active && pane.contains(active);\n}\n\n/**\n * Multi-level select — drills down through hierarchical categories\n * (e.g. country → state → city). Each level renders as a column; clicks\n * advance to the next column. Selecting a leaf (no children) commits\n * the full path.\n *\n * A signal-forms native control: it implements `FormValueControl<unknown>`,\n * so `[formField]` binds straight to its `value` model — no\n * `ControlValueAccessor` in between. `[(value)]` works standalone. The value\n * is the path through the tree (an array from root to leaf).\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-cascader [options]=\"locations\" [formField]=\"form.path\" placeholder=\"Pick a location\" />\n *\n * <!-- standalone two-way binding -->\n * <wr-cascader [options]=\"locations\" [(value)]=\"path\" placeholder=\"Pick a location\" />\n * ```\n *\n * ```ts\n * locations: WrCascaderOption[] = [\n * {\n * value: 'us', label: 'United States', children: [\n * { value: 'ny', label: 'New York', children: [\n * { value: 'nyc', label: 'NYC' },\n * { value: 'buf', label: 'Buffalo' },\n * ] },\n * ],\n * },\n * ];\n * ```\n *\n * @see https://ngwr.dev/reference/components/cascader\n */\nexport type WrCascaderSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-cascader',\n templateUrl: './cascader.html',\n styleUrl: './cascader.scss',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-cascader', '[class]': 'classes()' },\n})\nexport class WrCascader<T = string> implements FormValueControl<unknown> {\n /** Accessible name. Falls back to `select.clearSelection`, then `'Clear selection'`. */\n readonly clearLabel = input<string | null>(null);\n\n protected readonly resolvedClearLabel = useI18nText(this.clearLabel, 'select.clearSelection', 'Clear selection');\n\n /** Root-level options. Each may have `children` for deeper levels. */\n readonly options = input.required<readonly WrCascaderOption<T>[]>();\n\n /** Placeholder shown when no path is selected. @default '' */\n readonly placeholder = input<string>('');\n\n /**\n * Accessible name of the trigger. Falls back to the placeholder, then to\n * `select.label` — a `role=\"combobox\"` with nothing selected and no\n * placeholder otherwise has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly labelText = useI18nText(this.ariaLabel, 'select.label', 'Select');\n protected readonly resolvedAriaLabel = computed(() => {\n // Not `??`: an empty placeholder must fall through to the catalog string.\n const explicit = this.ariaLabel();\n if (explicit) return explicit;\n const placeholder = this.placeholder();\n return placeholder ? placeholder : this.labelText();\n });\n\n /**\n * Disable the cascader. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse changes while the trigger stays focusable and the path still submits.\n * Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * The panel is where every edit happens, so a read-only cascader simply does\n * not open — there is nothing to browse that is not already on the trigger —\n * and the clear button goes away with it. Mirrored as `aria-readonly`, which\n * role `combobox` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /**\n * The field's own label, when it renders one — `null` otherwise, and `null`\n * when `[ariaLabel]` was set deliberately.\n *\n * `aria-label` outranks a `<label for>` in the accname order, so without this\n * a cascader inside `<wr-form-field label=\"Region\">` announced its\n * PLACEHOLDER, or the generic `select.label` default, and the visible label\n * reached nobody. Nothing catches it: the control has a name, so axe is\n * satisfied, and the name is plausible, so a reader is too — it fails WCAG\n * 2.5.3, where the visible label has to be IN the accessible name. Same call\n * `wr-rating` and `wr-knob` already make.\n */\n protected readonly labelledBy = computed(() => (this.ariaLabel() ? null : this.fieldAria.labelledBy()));\n\n /** `null` once `aria-labelledby` is carrying the name — see {@link labelledBy}. */\n protected readonly nameLabel = computed(() => (this.labelledBy() ? null : this.resolvedAriaLabel()));\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrCascaderSize>('md');\n\n /** Pill-shaped corners on the trigger. @default false */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /** Show a clear-all (×) button on the trigger when a path is selected. @default true */\n readonly clearable = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Allow selecting non-leaf (parent) nodes. When `false`, only leaves\n * (nodes without children) commit a selection. @default false\n */\n readonly changeOnSelect = input(false, { transform: coerceBooleanProperty });\n\n /** Separator between labels in the trigger display. @default '/' */\n readonly separator = input<string>('/');\n\n /**\n * Focus the selected option, or the first one, when the panel opens. Off,\n * focus stays on the trigger: ArrowDown, ArrowUp or Tab there move into the\n * panel, and a letter jumps to the option it starts.\n *\n * @default false\n */\n readonly autoFocus = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Extra CSS classes for the column panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Committed selection path (full array from root to leaf). Bound by\n * `[formField]`, or two-way via `[(value)]`.\n */\n readonly value = model<unknown>([]);\n\n /** Emitted on blur / commit so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /** Fires after the panel opens. */\n readonly opened = output<void>();\n\n /** Fires after the panel closes. */\n readonly closed = output<void>();\n\n /** Committed selection path (full T[] from root to leaf). @internal */\n protected readonly path = signal<readonly T[]>([]);\n\n /** Currently-expanded column path — drives which columns the panel shows. @internal */\n protected readonly activePath = signal<readonly T[]>([]);\n\n private readonly openState = signal(false);\n\n /** Whether the panel is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n /**\n * The option the user last moved to inside the open panel — `null` until they\n * move, and again on every open. Written by an option's `focus` event, so\n * whatever moved the caret (an arrow, a click, a harness, a type-ahead letter)\n * moves the tab stop with it.\n */\n private readonly cursor = signal<{ readonly col: number; readonly value: T } | null>(null);\n\n /**\n * The panel's ONE tab stop, as in the APG tree pattern: the option the user\n * moved to, else the selected path's leaf, else the first enabled root. Every\n * other option carries `tabindex=\"-1\"` and is reached with the arrows, so a\n * deep tree is one Tab to enter and one to leave instead of a stop per option.\n *\n * Validated against what is ON SCREEN rather than trusted: choosing a sibling\n * prunes the deeper columns, and a value written from outside replaces the\n * path, so a remembered position can name an option that is gone. A disabled\n * option is never the stop — `focus()` would land on a choice nobody can make.\n * When the leaf itself is not on screen or is disabled, the deepest ancestor on\n * the path that is takes its place.\n */\n protected readonly tabStop = computed<{ readonly col: number; readonly value: T } | null>(() => {\n const cols = this.columns();\n const enabledAt = (col: number, value: T): boolean => !!cols[col]?.some(o => o.value === value && !o.disabled);\n\n const at = this.cursor();\n if (at && enabledAt(at.col, at.value)) return at;\n\n const path = this.path();\n const active = this.activePath();\n for (let col = Math.min(path.length, cols.length) - 1; col >= 0; col--) {\n // Column `col` lists the children of the ACTIVE path above it, so the path's\n // node at that depth is on screen only while the two agree that far down.\n if (!this.pathsEqual(path.slice(0, col), active.slice(0, col))) continue;\n if (enabledAt(col, path[col])) return { col, value: path[col] };\n }\n\n const first = cols[0]?.find(o => !o.disabled);\n return first ? { col: 0, value: first.value } : null;\n });\n\n private readonly liveLocale = inject(WR_LIVE_LOCALE, { optional: true });\n /** Letters typed in quick succession, for type-ahead. */\n private readonly typeahead = wrTypeahead({ locale: () => this.liveLocale?.() });\n\n /** Panel id used by the trigger's `aria-controls`. */\n protected readonly panelId = `wr-cascader-panel-${++panelUid}`;\n\n /**\n * Columns visible in the panel. Each column shows the children of the\n * preceding activePath entry. Column 0 = root options. The last\n * column is whatever the deepest active node's children resolve to —\n * we only render a column when there are children to show.\n */\n protected readonly columns = computed<readonly (readonly WrCascaderOption<T>[])[]>(() => {\n const cols: (readonly WrCascaderOption<T>[])[] = [this.options()];\n const trail = this.activePath();\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of trail) {\n const node = list.find(o => o.value === v);\n if (!node?.children?.length) break;\n cols.push(node.children);\n list = node.children;\n }\n return cols;\n });\n\n /** Label trail joined by `separator()` — what the trigger shows. */\n protected readonly displayLabel = computed(() => {\n const p = this.path();\n if (p.length === 0) return null;\n const labels: string[] = [];\n let list: readonly WrCascaderOption<T>[] = this.options();\n for (const v of p) {\n const node = list.find(o => o.value === v);\n if (!node) return null;\n labels.push(node.label);\n list = node.children ?? [];\n }\n const sep = ` ${this.separator()} `;\n return labels.join(sep);\n });\n\n protected readonly hasSelection = computed(() => this.path().length > 0);\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-cascader--${size}`);\n if (this.rounded()) parts.push('wr-cascader--rounded');\n if (this.isOpen()) parts.push('wr-cascader--open');\n if (this.disabled()) parts.push('wr-cascader--disabled');\n else if (this.readonly()) parts.push('wr-cascader--readonly');\n return parts.join(' ');\n });\n\n protected readonly panelTpl = viewChild.required('panelTpl', { read: TemplateRef });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n /**\n * Ambient reading direction, for the open panel alone — nothing in this\n * component reads it directly. Optional so a bare `TestBed` needs no\n * provider; `Directionality` is root-provided anyway, and a missing one\n * simply reads as `ltr`.\n */\n private readonly dir = inject(Directionality, { optional: true });\n private overlayRef: OverlayRef | null = null;\n\n constructor() {\n // Same contract as wr-select / wr-dropdown / wr-lightbox: an overlay lives in\n // the CDK container, not in this component's view, so destroying the\n // component while the panel is open would strand the pane and its scroll\n // strategy.\n this.destroyRef.onDestroy(() => this.closeOverlay(false));\n\n effect(() => {\n if (this.isOpen()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n\n // Close the panel if the control becomes disabled or read-only while open.\n effect(() => {\n if (this.disabled() || this.readonly()) this.openState.set(false);\n });\n\n // Mirror an external `value` write into the internal path/activePath\n // (the old `writeValue`). Skipped when the write merely echoes the\n // committed path, so a live drill-down can never be clobbered.\n effect(() => {\n // Coerce null/undefined/non-array to an empty path — a classic-forms\n // binding can write null, which the old `writeValue(value: unknown)`\n // treated as \"no selection\" too.\n const value = this.value();\n untracked(() => {\n const next: readonly T[] = Array.isArray(value) ? (value as readonly T[]) : [];\n if (this.pathsEqual(this.path(), next)) return;\n this.path.set(next);\n this.activePath.set(next);\n });\n });\n }\n\n /**\n * Focus the trigger — what Signal Forms calls to focus this control. The\n * panel stays shut: ArrowDown or a click opens it, the way it does after Tab.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus(options);\n }\n\n /** Open the panel on the selected path, as the trigger does. Refused while disabled or read-only. */\n open(): void {\n if (this.disabled() || this.readonly() || this.isOpen()) return;\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n /** Close the panel. */\n close(): void {\n this.openState.set(false);\n }\n\n // Template handlers\n\n protected onTriggerClick(): void {\n if (this.disabled() || this.readonly()) return;\n if (!this.isOpen()) this.activePath.set(this.path());\n this.openState.update(v => !v);\n }\n\n /**\n * ArrowDown / ArrowUp open the panel, Alt+ArrowDown included — the combobox way in,\n * and the shape `wr-dropdown`'s trigger uses. Enter and Space need no branch: the\n * trigger is a real `<button>`, so the browser turns them into the click above.\n *\n * Opening leaves the caret here unless `autoFocus` asks, so while the panel is\n * up the trigger is the way in: see {@link enterPanelFromTrigger}.\n */\n protected onTriggerKeydown(event: KeyboardEvent): void {\n if (this.disabled() || this.readonly()) return;\n if (this.isOpen()) {\n this.enterPanelFromTrigger(event);\n return;\n }\n\n // Backspace is the × from the keyboard, and it has to be: the × is a\n // `tabindex=\"-1\"` span INSIDE this button, and a keydown goes to the focused\n // element, so the `(keydown.enter)` / `(keydown.space)` it used to carry could\n // never fire. Clearing was reachable by pointer alone — a WCAG 2.1.1 failure,\n // not a missing convenience. The span stays unfocusable, because a focusable\n // child of a button is `nested-interactive`. Same key, same gating as\n // `wr-select`: `clearable()` IS the clear control, so a consumer who turned\n // the × off did not ask for a keyboard twin of it.\n if (event.key === 'Backspace') {\n if (!this.clearable() || !this.hasSelection()) return;\n event.preventDefault();\n this.clearSelection(event);\n return;\n }\n\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;\n event.preventDefault();\n this.activePath.set(this.path());\n this.openState.set(true);\n }\n\n /**\n * Keys on the trigger while the panel is open. The arrows and Tab move to the\n * panel's tab stop: the pane sits at the end of `<body>`, where the browser's\n * own Tab would not find it. A letter jumps to the option of that column it\n * starts. Shift+Tab, or Tab with nothing to land on, closes the panel and\n * moves on through the page.\n */\n private enterPanelFromTrigger(event: KeyboardEvent): void {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.defaultPrevented) return;\n const stop = pane.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]');\n\n if (wrIsPrintableKey(event) && event.key !== ' ') {\n const column = stop?.closest<HTMLElement>('[role=\"group\"]');\n if (column && this.typeAhead(column, null, event)) event.preventDefault();\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n if (event.key === 'Tab') {\n if (event.shiftKey || !stop) {\n this.openState.set(false);\n return;\n }\n } else if (event.shiftKey || (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')) {\n return;\n }\n event.preventDefault();\n stop?.focus();\n }\n\n protected onOptionClick(colIndex: number, opt: WrCascaderOption<T>, event: Event): void {\n event.stopPropagation();\n if (opt.disabled || this.disabled() || this.readonly()) return;\n\n const head = this.activePath().slice(0, colIndex);\n const newPath = [...head, opt.value];\n\n const hasChildren = !!opt.children?.length;\n\n // Always update active column for visual feedback / next column.\n this.activePath.set(newPath);\n // A pointer click focuses the option anyway (see `onOptionFocus`); a scripted\n // `click()` does not, and the tab stop belongs where the choice was made.\n this.cursor.set({ col: colIndex, value: opt.value });\n\n // Commit when we've reached a leaf, or when changeOnSelect is on.\n if (!hasChildren || this.changeOnSelect()) {\n this.path.set(newPath);\n this.value.set(newPath);\n this.touch.emit();\n // Close once we hit a true leaf — parent commits keep the panel open.\n if (!hasChildren) this.openState.set(false);\n }\n }\n\n /**\n * The tree keys the panel's roles promise, per the APG tree pattern: Up / Down\n * within a column, Home / End to its ends, the inline-end arrow into a branch's\n * children — opening the next column on the way — and the inline-start arrow back\n * to the option the column belongs to, or, from a root, closing the column it\n * opened. A letter moves to the next option in the column whose label starts with\n * what was typed. Enter and Space stay the commit.\n *\n * These are the ONLY way between options: the panel holds one tab stop (see\n * {@link tabStop}), and Tab leaves it.\n */\n protected onOptionKeydown(colIndex: number, opt: WrCascaderOption<T>, event: KeyboardEvent): void {\n const current = event.currentTarget as HTMLElement;\n const column = current.closest<HTMLElement>('[role=\"group\"]');\n if (!column) return;\n // Before the modifier check, because Shift is how a capital letter is typed.\n if (wrIsPrintableKey(event) && event.key !== ' ') {\n this.typeAhead(column, current, event);\n event.preventDefault();\n return;\n }\n if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const rtl = this.dir?.value === 'rtl';\n const inward = rtl ? 'ArrowLeft' : 'ArrowRight';\n const outward = rtl ? 'ArrowRight' : 'ArrowLeft';\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const at = enabled.indexOf(current);\n\n switch (event.key) {\n case 'ArrowDown':\n enabled[at + 1]?.focus();\n break;\n case 'ArrowUp':\n if (at > 0) enabled[at - 1].focus();\n break;\n case 'Home':\n enabled[0]?.focus();\n break;\n case 'End':\n enabled[enabled.length - 1]?.focus();\n break;\n case inward: {\n if (opt.disabled || !opt.children?.length || this.disabled() || this.readonly()) break;\n this.activePath.set([...this.activePath().slice(0, colIndex), opt.value]);\n // The column is not in the DOM until the render this write schedules.\n afterNextRender(\n () =>\n this.overlayRef?.overlayElement\n .querySelector<HTMLElement>(\n `#${this.columnId(colIndex + 1)} [role=\"treeitem\"]:not([aria-disabled=\"true\"])`\n )\n ?.focus(),\n { injector: this.injector }\n );\n break;\n }\n case outward: {\n if (colIndex > 0) {\n const parent = this.parentOptionId(colIndex);\n if (parent) this.overlayRef?.overlayElement.querySelector<HTMLElement>(`#${parent}`)?.focus();\n } else if (opt.children?.length && this.isActiveAt(colIndex, opt.value)) {\n this.activePath.set([]);\n }\n break;\n }\n case ' ':\n // The commit is `(keydown.space)`'s; the page scrolling a screen under the\n // panel is the browser's, and it went with every Space on an option.\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n /** The caret reached an option, by whatever route — the tab stop follows it. */\n protected onOptionFocus(colIndex: number, opt: WrCascaderOption<T>): void {\n if (opt.disabled) return;\n this.cursor.set({ col: colIndex, value: opt.value });\n }\n\n /** Whether this option is the panel's one `tabindex=\"0\"`. */\n protected isTabStop(colIndex: number, opt: WrCascaderOption<T>): boolean {\n const stop = this.tabStop();\n return !opt.disabled && stop !== null && stop.col === colIndex && stop.value === opt.value;\n }\n\n /**\n * Move to the next enabled option in `column` whose label starts with the letters\n * typed so far: {@link wrTypeahead} over the column's labels. `current` is\n * `null` when the caret is not in the column yet.\n *\n * @returns whether the caret moved.\n */\n private typeAhead(column: HTMLElement, current: HTMLElement | null, event: KeyboardEvent): boolean {\n const enabled = [...column.querySelectorAll<HTMLElement>('[role=\"treeitem\"]')].filter(\n o => o.getAttribute('aria-disabled') !== 'true'\n );\n const labels = enabled.map(o => o.querySelector('.wr-cascader__opt-label')?.textContent ?? '');\n const index = this.typeahead.handleKey(event, labels, current ? enabled.indexOf(current) : -1);\n if (index === null || index < 0) return false;\n enabled[index].focus();\n return true;\n }\n\n protected clearSelection(event: Event): void {\n event.stopPropagation();\n if (this.disabled() || this.readonly()) return;\n this.path.set([]);\n this.activePath.set([]);\n this.value.set([]);\n this.touch.emit();\n }\n\n protected isActiveAt(colIndex: number, value: T): boolean {\n return this.activePath()[colIndex] === value;\n }\n\n /**\n * Whether this option is the committed choice — `null` when it is not a\n * choice at all.\n *\n * Two questions the panel has to keep apart, and `--active` answers only the\n * first: `activePath()` is where the user has NAVIGATED to, `path()` is what\n * they have COMMITTED. They agree once a leaf is picked and diverge for the\n * whole walk down.\n *\n * `null` — the attribute absent — on a branch while `changeOnSelect` is off,\n * because such a branch genuinely cannot be chosen; ARIA reads a missing\n * `aria-selected` as \"not selectable\", which is exactly true here. That makes\n * this binding the first expression the `changeOnSelect` contract has ever had\n * in ARIA, in both directions.\n */\n protected isSelectedAt(colIndex: number, opt: WrCascaderOption<T>): boolean | null {\n const committable = !opt.children?.length || this.changeOnSelect();\n if (!committable) return null;\n const path = this.path();\n return colIndex === path.length - 1 && path[colIndex] === opt.value;\n }\n\n /** Stable id for one option — what a column's `aria-labelledby` points at. */\n protected optionId(colIndex: number, optIndex: number): string {\n return `${this.panelId}-opt-${colIndex}-${optIndex}`;\n }\n\n /** Stable id for one column — what an expanded branch's `aria-controls` points at. */\n protected columnId(colIndex: number): string {\n return `${this.panelId}-col-${colIndex}`;\n }\n\n /**\n * The option whose children a column holds, by id — its accessible name.\n *\n * The columns are DOM SIBLINGS, so nothing in the markup says the second one\n * belongs to \"Europe\". Column 0 has no parent and stays unnamed; the tree\n * itself already carries the control's name.\n */\n protected parentOptionId(colIndex: number): string | null {\n if (colIndex === 0) return null;\n const parent = this.columns()[colIndex - 1] ?? [];\n const index = parent.findIndex(o => this.isActiveAt(colIndex - 1, o.value));\n return index < 0 ? null : this.optionId(colIndex - 1, index);\n }\n\n private pathsEqual(a: readonly T[], b: readonly T[]): boolean {\n return a.length === b.length && a.every((v, i) => v === b[i]);\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n // Each open starts from the selected path, not from where the last visit ended.\n this.cursor.set(null);\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n ])\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-cascader-overlay', this.panelClass()),\n });\n\n // The columns cascade inline-wards, and the CDK captured the direction as a\n // string when this ref was created — so a flip while the panel is open left\n // the whole cascade running the other way from the page around it.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n // Opening moves no focus unless `autoFocus` asks. The pane is appended to\n // `<body>`, where Tab from the trigger would not find it, so the trigger's\n // own arrows and Tab walk in: see `enterPanelFromTrigger`.\n //\n // `afterNextRender`, NOT `queueMicrotask`: under zoneless CD change detection runs\n // in a macrotask, so a microtask queued here fires before the columns are in the\n // DOM — the trap that once left `wr-calendar`'s ring and its real focus on\n // different days.\n if (this.autoFocus()) afterNextRender(() => this.focusPanelOption(), { injector: this.injector });\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.openState.set(false);\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.openState.set(false);\n return;\n }\n if (this.overlayRef && tabLeavesPane(this.overlayRef.overlayElement, event)) {\n this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.openState.set(false);\n }\n });\n\n this.opened.emit();\n }\n\n /**\n * The option the panel opens on: its tab stop, which on open is the selected path's\n * leaf, else the first enabled root (see {@link tabStop}). A disabled option is\n * never the stop, so `focus()` cannot land on a choice nobody can make.\n */\n private focusPanelOption(): void {\n this.overlayRef?.overlayElement.querySelector<HTMLElement>('[role=\"treeitem\"][tabindex=\"0\"]')?.focus();\n }\n\n /** `notify: false` is the destroy path: an output cannot emit from a destroyed view. */\n private closeOverlay(notify = true): void {\n if (!this.overlayRef) return;\n // Every option commits on Enter, so on the keyboard the caret is INSIDE the\n // pane when a choice is made — and the ordinary way to finish choosing (`onOptionClick` on a leaf) closes it.\n // Disposing without handing focus back dropped it on `<body>` on the SUCCESS\n // path, not merely on dismissal: a keyboard user who had just picked a value\n // then had to Tab from the top of the document to get back to the control.\n // Untouched when focus had already moved elsewhere — that click is usually\n // what closed us, and stealing the caret back would fight the user for it.\n const pane = this.overlayRef.overlayElement;\n const focusWasInside = pane.contains(this.host.nativeElement.ownerDocument.activeElement);\n this.overlayRef.dispose();\n this.overlayRef = null;\n if (!notify) return;\n if (focusWasInside) this.host.nativeElement.querySelector<HTMLElement>('.wr-cascader__trigger')?.focus();\n this.closed.emit();\n }\n}\n\nexport type { WrCascaderOption } from './types';\n","<button\n type=\"button\"\n class=\"wr-cascader__trigger\"\n role=\"combobox\"\n [attr.aria-label]=\"nameLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [disabled]=\"disabled()\"\n [attr.aria-haspopup]=\"'tree'\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onTriggerClick()\"\n (keydown)=\"onTriggerKeydown($event)\"\n (blur)=\"touch.emit()\"\n>\n @if (displayLabel(); as label) {\n <span class=\"wr-cascader__value\">{{ label }}</span>\n } @else {\n <span class=\"wr-cascader__placeholder\">{{ placeholder() }}</span>\n }\n\n @if (clearable() && hasSelection() && !disabled() && !readonly()) {\n <span\n class=\"wr-cascader__clear\"\n role=\"button\"\n [attr.aria-label]=\"resolvedClearLabel()\"\n tabindex=\"-1\"\n (click)=\"clearSelection($event)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </span>\n }\n\n <svg\n class=\"wr-icon__svg wr-cascader__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n</button>\n\n<ng-template #panelTpl>\n <div\n class=\"wr-cascader-panel\"\n [class.wr-cascader-panel--sm]=\"size() === 'sm'\"\n [class.wr-cascader-panel--lg]=\"size() === 'lg'\"\n role=\"tree\"\n [attr.id]=\"panelId\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n >\n <!--\n tree / group / treeitem, and NOT menu. A combobox's popup may be a listbox,\n a tree, a grid or a dialog and nothing else, so `aria-haspopup=\"menu\"` on\n the trigger was an author error — and a `menu` may own menuitems and\n groups, never other menus, so the columns were a second one. Neither is\n visible to axe: `menu` is a valid token for the global `aria-haspopup`, and\n `aria-required-children` passes a menu-inside-menu (measured against this\n exact fragment). A tree is what this control has always been — the value is\n a PATH, and only `treeitem` supports aria-expanded, aria-level,\n aria-setsize, aria-posinset and aria-selected at once.\n\n The columns stay `group` rather than collapsing to `role=\"presentation\"`,\n which is also axe-clean: the DOM is column-MAJOR, so a flat tree would\n leave level plus document order as the only structure, and \"Germany\"\n (level 2) would read as a child of \"Antarctica\" (level 1, the item\n immediately before it in source order).\n -->\n @for (col of columns(); track $index; let colIndex = $index) {\n <ul\n class=\"wr-cascader__col\"\n role=\"group\"\n [attr.id]=\"columnId(colIndex)\"\n [attr.aria-labelledby]=\"parentOptionId(colIndex)\"\n >\n @for (opt of col; track opt.value; let optIndex = $index) {\n <!--\n `aria-expanded` is exactly `isActiveAt`: `columns()` renders the next\n column for the active option and only when it has children, so the\n state can never claim a column that is not on screen — and\n `aria-controls` rides that same invariant, which is what makes\n \"expanded\" refer to something when the expanded content is a SIBLING\n rather than a descendant. It is emitted only while expanded: a\n reference to an absent id is a violation with `aria-expanded=\"true\"`\n and clean while collapsed.\n\n `aria-level` is load-bearing rather than decorative. The columns are\n siblings, so the DOM ancestry represents no level at all and every\n option would read as level 1. `aria-setsize` / `aria-posinset` are\n not strictly required — each column IS a complete sibling set — and\n are written anyway, because a tree that owns sibling groups is the\n uncommon shape where browser/AT pairs are known to miscompute both.\n\n `aria-selected` is written on every option that can be COMMITTED,\n `false` included, matching `wr-tree`. The alternative a reviewer may\n prefer: only the selected node, leaning on treeitem's implicit false,\n which is quieter in a long column and loses the \"this row is\n selectable\" signal that presence carries.\n\n `tabindex` is a ROVING stop, as in the APG tree pattern: one option\n carries `0` (see `tabStop`) and every other one `-1`, so the panel is\n one Tab to enter and one to leave, and the arrows move between options.\n -->\n <li\n class=\"wr-cascader__opt\"\n role=\"treeitem\"\n [attr.id]=\"optionId(colIndex, optIndex)\"\n [class.wr-cascader__opt--active]=\"isActiveAt(colIndex, opt.value)\"\n [class.wr-cascader__opt--disabled]=\"opt.disabled\"\n [attr.tabindex]=\"isTabStop(colIndex, opt) ? 0 : -1\"\n [attr.aria-disabled]=\"opt.disabled ? true : null\"\n [attr.aria-level]=\"colIndex + 1\"\n [attr.aria-setsize]=\"$count\"\n [attr.aria-posinset]=\"optIndex + 1\"\n [attr.aria-selected]=\"isSelectedAt(colIndex, opt)\"\n [attr.aria-expanded]=\"opt.children?.length ? isActiveAt(colIndex, opt.value) : null\"\n [attr.aria-controls]=\"\n opt.children?.length && isActiveAt(colIndex, opt.value) ? columnId(colIndex + 1) : null\n \"\n (click)=\"onOptionClick(colIndex, opt, $event)\"\n (focus)=\"onOptionFocus(colIndex, opt)\"\n (keydown)=\"onOptionKeydown(colIndex, opt, $event)\"\n (keydown.enter)=\"onOptionClick(colIndex, opt, $event)\"\n (keydown.space)=\"onOptionClick(colIndex, opt, $event)\"\n >\n <span class=\"wr-cascader__opt-label\">{{ opt.label }}</span>\n @if (opt.children?.length) {\n <svg\n class=\"wr-icon__svg wr-cascader__opt-arrow\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n </li>\n }\n </ul>\n }\n </div>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,IAAI,WAAW;AAgBf,SAAS,cAAc,MAAmB,OAAoB;CAC5D,IAAI,MAAM,QAAQ,SAAS,MAAM,oBAAoB,MAAM,UAAU,MAAM,WAAW,MAAM,SAAS,OAAO;CAC5G,MAAM,SAAS,KAAK,cAAc;CAClC,OAAO,CAAC,CAAC,UAAU,KAAK,SAAS,MAAM;AACzC;AA8CA,IAAa,aAAb,MAAa,WAAU;CAEZ,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAE7B,qBAAqB,YAAY,KAAK,YAAY,yBAAyB,iBAAiB;CAGtG,UAAU,MAAM,SAA0C,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAG1D,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAO/B,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA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art-legend/testing";
6
6
  * Use of this source code is governed by an MIT-style license that can be
7
7
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
8
8
  */
9
- const BAR_SHARE = /(?:^|;)\s*flex-grow\s*:\s*([\d.]+)/;
9
+ const BAR_SHARE = /(?:^|;)\s*--wr-bar-chart-size\s*:\s*([\d.]+)/;
10
10
  const inlineProperty = (style, name) => new RegExp(`(?:^|;)\\s*--wr-bar-chart-${name}\\s*:\\s*([^;]+)`).exec(style ?? "")?.[1].trim() ?? null;
11
11
  const percent = (share) => Number((share * 100).toFixed(6));
12
12
  var CategoryHarness = class CategoryHarness extends ComponentHarness {
@@ -14,18 +14,20 @@ var CategoryHarness = class CategoryHarness extends ComponentHarness {
14
14
  async read() {
15
15
  const category = await (await this.host()).getAttribute("aria-label");
16
16
  const bars = await this.locatorForAll(".wr-bar-chart__series-bar")();
17
- const edges = await this.locatorForAll(".wr-bar-chart__series-bar .wr-bar-chart__edge rect")();
18
- return Promise.all(bars.map(async (bar, index) => {
17
+ return (await Promise.all(bars.map(async (bar) => {
19
18
  const style = await bar.getAttribute("style");
20
19
  return {
21
- category,
22
- name: await bar.getAttribute("aria-label"),
23
- startPercent: CategoryHarness.share(style, "start"),
24
- sizePercent: CategoryHarness.share(style, "size"),
25
- color: inlineProperty(style, "color"),
26
- dash: await edges[index]?.getAttribute("stroke-dasharray") ?? ""
20
+ series: Number(await bar.getAttribute("data-wr-series")),
21
+ bar: {
22
+ category,
23
+ name: await bar.getAttribute("aria-label"),
24
+ startPercent: CategoryHarness.share(style, "start"),
25
+ sizePercent: CategoryHarness.share(style, "size"),
26
+ color: inlineProperty(style, "color"),
27
+ dash: await bar.getAttribute("data-dash") ?? ""
28
+ }
27
29
  };
28
- }));
30
+ }))).sort((a, b) => a.series - b.series).map(({ bar }) => bar);
29
31
  }
30
32
  static share(style, name) {
31
33
  const raw = inlineProperty(style, name);
@@ -38,14 +40,14 @@ var LineHarness = class LineHarness extends ComponentHarness {
38
40
  static hostSelector = ".wr-bar-chart__line";
39
41
  async read(horizontal) {
40
42
  const label = await (await this.host()).getAttribute("aria-label");
41
- const segments = await this.locatorForAll(".wr-bar-chart__line-segment")();
43
+ const path = await this.locatorForOptional(".wr-bar-chart__line-segment")();
42
44
  const points = await this.locatorForAll(".wr-bar-chart__point")();
43
45
  return {
44
46
  label,
45
47
  color: await (await this.locatorForAll(".wr-bar-chart__point > path")())[0]?.getAttribute("fill") ?? null,
46
- dash: segments.length === 0 ? null : await segments[0].getAttribute("stroke-dasharray") ?? "",
48
+ dash: path ? await path.getAttribute("stroke-dasharray") ?? "" : null,
47
49
  marker: await points[0]?.getAttribute("data-marker") ?? null,
48
- segmentCount: segments.length,
50
+ segmentCount: path ? Number(await path.getAttribute("data-segments")) : 0,
49
51
  points: await Promise.all(points.map(async (point) => {
50
52
  const position = horizontal ? LineHarness.position(await point.getAttribute("x"), "x") : 100 - LineHarness.position(await point.getAttribute("y"), "y");
51
53
  return {
@@ -110,7 +112,7 @@ var WrBarChartHarness = class WrBarChartHarness extends ComponentHarness {
110
112
  }
111
113
  async getZeroPercent() {
112
114
  const track = await this.locatorForOptional(".wr-bar-chart__track")();
113
- if (!track) throw new Error("WrBarChartHarness.getZeroPercent(): the chart draws no track — it is drawn from `data` standing up without `lines`, where every bar stands on the bottom of the plot.");
115
+ if (!track) throw new Error("WrBarChartHarness.getZeroPercent(): the chart draws no track. The component draws one in every layout, so its absence is the bug.");
114
116
  const style = await track.getAttribute("style");
115
117
  const raw = inlineProperty(style, "zero");
116
118
  const share = raw === null ? NaN : Number.parseFloat(raw);