@nanahoshi/mona-ui 0.25.1 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +2 -0
  2. package/chart/README.md +2 -2
  3. package/command/package.json +4 -0
  4. package/docs/auto-complete.md +733 -0
  5. package/docs/avatar.md +220 -0
  6. package/docs/breadcrumb.md +320 -0
  7. package/docs/button-group.md +392 -0
  8. package/docs/button.md +256 -0
  9. package/docs/calendar.md +515 -0
  10. package/docs/card.md +292 -0
  11. package/docs/chart-bar.md +714 -0
  12. package/docs/chart-financial.md +567 -0
  13. package/docs/chart-funnel.md +546 -0
  14. package/docs/chart-heatmap.md +535 -0
  15. package/docs/chart-line-area.md +462 -0
  16. package/docs/chart-pie.md +645 -0
  17. package/docs/chart-radar.md +518 -0
  18. package/docs/chart-radial.md +658 -0
  19. package/docs/chart-scatter.md +479 -0
  20. package/docs/chart-treemap.md +651 -0
  21. package/docs/chart.md +2465 -0
  22. package/docs/checkbox.md +374 -0
  23. package/docs/chip.md +339 -0
  24. package/docs/circular-progress-bar.md +287 -0
  25. package/docs/collapsible.md +308 -0
  26. package/docs/color-gradient.md +336 -0
  27. package/docs/color-palette.md +317 -0
  28. package/docs/color-picker.md +387 -0
  29. package/docs/combo-box.md +764 -0
  30. package/docs/command.md +582 -0
  31. package/docs/contextmenu.md +530 -0
  32. package/docs/date-picker.md +251 -0
  33. package/docs/datetime-picker.md +284 -0
  34. package/docs/decimal-textbox.md +260 -0
  35. package/docs/dialog.md +822 -0
  36. package/docs/dropdown-button.md +507 -0
  37. package/docs/dropdown-list.md +779 -0
  38. package/docs/editor.md +374 -0
  39. package/docs/expansion-panel.md +348 -0
  40. package/docs/fieldset.md +217 -0
  41. package/docs/forms.md +162 -0
  42. package/docs/grid.md +2053 -0
  43. package/docs/input.md +197 -0
  44. package/docs/installation.md +54 -0
  45. package/docs/introduction.md +46 -0
  46. package/docs/label.md +340 -0
  47. package/docs/list-box.md +637 -0
  48. package/docs/list-view.md +584 -0
  49. package/docs/menubar.md +559 -0
  50. package/docs/multi-select.md +765 -0
  51. package/docs/notification.md +460 -0
  52. package/docs/numeric-textbox.md +301 -0
  53. package/docs/otp-input.md +539 -0
  54. package/docs/pager.md +513 -0
  55. package/docs/placeholder.md +176 -0
  56. package/docs/popover.md +423 -0
  57. package/docs/popup-menu.md +658 -0
  58. package/docs/popup.md +617 -0
  59. package/docs/progress-bar.md +368 -0
  60. package/docs/radio-button.md +451 -0
  61. package/docs/range-slider.md +367 -0
  62. package/docs/rating.md +518 -0
  63. package/docs/scroll-view.md +375 -0
  64. package/docs/segmented.md +434 -0
  65. package/docs/sheet.md +348 -0
  66. package/docs/sidebar.md +1126 -0
  67. package/docs/skeleton.md +181 -0
  68. package/docs/slider.md +423 -0
  69. package/docs/spinner.md +370 -0
  70. package/docs/split-button.md +522 -0
  71. package/docs/splitter.md +342 -0
  72. package/docs/stepper.md +539 -0
  73. package/docs/switch.md +340 -0
  74. package/docs/tabs.md +542 -0
  75. package/docs/textarea.md +196 -0
  76. package/docs/textbox.md +332 -0
  77. package/docs/theming.md +403 -0
  78. package/docs/time-picker.md +254 -0
  79. package/docs/tooltip-directive.md +340 -0
  80. package/docs/tooltip.md +321 -0
  81. package/docs/tree-view.md +1018 -0
  82. package/docs/window.md +663 -0
  83. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  84. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  85. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  86. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  87. package/fesm2022/nanahoshi-mona-ui-chart.mjs +212 -66
  88. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  89. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  90. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  91. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  92. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  93. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  94. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  95. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  96. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  97. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  98. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  99. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  100. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  101. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  102. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  103. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  104. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  105. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  106. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  107. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  108. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  109. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  111. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  112. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  113. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  114. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  118. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  119. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  120. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  121. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  122. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  123. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  124. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  125. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  126. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  127. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  128. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  129. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  130. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  131. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  132. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  133. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  134. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  135. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  136. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  137. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  138. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  139. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  140. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  141. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  142. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  143. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  144. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  145. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  146. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  147. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  148. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  149. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  150. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  151. package/i18n/catalogs/en-US.messages.json +10 -0
  152. package/internal/popup-menu/package.json +4 -0
  153. package/llms.txt +133 -0
  154. package/locales/ar-sa/ar-sa.messages.json +10 -0
  155. package/locales/de-de/de-de.messages.json +10 -0
  156. package/locales/es-es/es-es.messages.json +10 -0
  157. package/locales/fr-fr/fr-fr.messages.json +10 -0
  158. package/locales/id-id/id-id.messages.json +10 -0
  159. package/locales/it-it/it-it.messages.json +10 -0
  160. package/locales/ja-jp/ja-jp.messages.json +10 -0
  161. package/locales/ko-kr/ko-kr.messages.json +10 -0
  162. package/locales/pt-br/pt-br.messages.json +10 -0
  163. package/locales/ru-ru/ru-ru.messages.json +10 -0
  164. package/locales/tr-tr/tr-tr.messages.json +10 -0
  165. package/locales/zh-cn/zh-cn.messages.json +10 -0
  166. package/locales/zh-tw/zh-tw.messages.json +10 -0
  167. package/package.json +9 -1
  168. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  169. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  170. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  171. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  172. package/types/nanahoshi-mona-ui-chart.d.ts +250 -20
  173. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  174. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  175. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  176. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  177. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  178. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  179. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  180. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  181. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  182. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  183. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  184. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  185. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  186. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  187. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  188. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  189. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  190. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  191. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  192. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  193. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  194. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  195. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  196. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  197. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  198. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  201. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  202. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  203. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  204. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  205. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  206. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  207. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  208. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  209. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  210. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  211. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  212. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  213. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  214. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  215. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  216. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  217. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  218. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  219. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  220. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  221. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  222. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  223. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  224. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  225. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  226. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  227. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  228. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  229. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  230. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  231. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  232. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  233. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,546 @@
1
+ # Funnel
2
+
3
+ > A funnel series for stages that narrow, with conversion and drop-off between them.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/chart`
6
+
7
+ **Selector:** `mona-funnel-series`
8
+
9
+ A funnel series draws the stages of a process, such as a sign-up flow or a sales pipeline, as connected bands whose width follows how many reached each stage. Each stage carries its conversion from the stage before, its conversion from the first stage, and how many dropped off, for labels, tooltips and screen readers. It goes inside a `mona-chart` on its own, with no axes.
10
+
11
+ ## Overview
12
+
13
+ A funnel shows how many items, such as visitors, deals or sessions, reach each stage of a process that runs in a fixed order, and how many are lost on the way. The widest stage takes the most room, and every other stage is as wide as its share of it.
14
+
15
+ Use it for:
16
+
17
+ - Sign-up, onboarding and checkout flows, where the reader asks where people leave.
18
+ - Sales pipelines, from leads to won deals.
19
+ - Any sequence of steps where each stage is a subset of the one before it, or at least follows it.
20
+
21
+ **Use something else when:**
22
+
23
+ - The stages have no order, or they're parts of one total. Use a pie or donut, see [Pie & Donut](chart-pie.md).
24
+ - You need to compare the stages of several funnels, or one funnel over time. A chart takes one funnel, so use grouped bars, see [Bar & Waterfall](chart-bar.md).
25
+ - The values add up and subtract to a total. Use a waterfall, see [Bar & Waterfall](chart-bar.md).
26
+
27
+ The chart, legend, tooltip and interaction parts the series sits in are described on [Chart Overview](chart.md).
28
+
29
+ ## Import & Quick Start
30
+
31
+ ```typescript
32
+ import {
33
+ ChartComponent,
34
+ ChartLegendComponent,
35
+ ChartTooltipComponent,
36
+ FunnelSeriesComponent
37
+ } from "@nanahoshi/mona-ui/chart";
38
+ ```
39
+
40
+ ```html
41
+ <mona-chart aria-label="Sign-up funnel" class="h-80 w-full" [data]="stages">
42
+ <mona-funnel-series categoryField="stage" field="users" name="Users" />
43
+ <mona-chart-legend />
44
+ <mona-chart-tooltip />
45
+ </mona-chart>
46
+ ```
47
+
48
+ ```typescript
49
+ protected readonly stages = [
50
+ { stage: "Visited", users: 12400 },
51
+ { stage: "Signed up", users: 4820 },
52
+ { stage: "Subscribed", users: 1120 }
53
+ ];
54
+ ```
55
+
56
+ Give the chart a height. It fills its host, and a host without a height has none.
57
+
58
+ ## Anatomy
59
+
60
+ The series reads its rows from the chart's `data`, unless it has its own `data`. Each row is one stage, in the order of the rows.
61
+
62
+ | Input | Reads | Default |
63
+ | :--- | :--- | :--- |
64
+ | `field` | The stage's value. | `"value"` |
65
+ | `categoryField` | The stage's name, for its label, legend entry, tooltip and announcement. | `"category"` |
66
+ | `keyField` | A key that identifies the stage, used for its stage ID. Optional. | |
67
+ | `colorField` | A CSS color for the stage. Optional. | |
68
+
69
+ A field is a property name or an accessor, `(row, index) => value`. A row without a name is called "Stage" and its position, as in "Stage 3".
70
+
71
+ ### What each stage carries
72
+
73
+ The stage label template, the tooltip context (`point.funnel`) and the `pointClick` and `pointFocusChange` events (`funnel`) describe a stage with these values. They're worked out from the visible stages only.
74
+
75
+ | Value | Holds |
76
+ | :--- | :--- |
77
+ | `value`, `formattedValue` | The stage's value, and its text from `valueFormatter` or the library locale. |
78
+ | `previousValue` | The value of the visible stage before it. The first stage has none. |
79
+ | `conversionRate`, `formattedConversionRate` | The value divided by the previous value, as a ratio and as a percentage with at most one decimal. The first stage has none, and neither does a stage after one whose value is `0`. |
80
+ | `overallConversionRate`, `formattedOverallConversionRate` | The value divided by the first visible stage's value. |
81
+ | `dropOff` | The previous value minus this value. It's negative when the stage is larger than the one before it. |
82
+ | `stageId`, `stageIndex` | The stage's ID, and its position among the visible stages. |
83
+
84
+ ### Templates
85
+
86
+ - `ng-template[monaChartFunnelLabelTemplate]`, inside the series, replaces the text of the stage labels. The context is the stage, as `$implicit` and `stage`, with the values above plus `bounds`, `color`, `textColor`, `datum`, `category`, `formattedCategory` and `dataIndex`. The template replaces only the text, so `labelContent` no longer applies, while `showLabels`, `maxLabels` and the minimum sizes still decide which stages get a label.
87
+ - The chart, legend, tooltip and no-data templates are described on [Chart Overview](chart.md).
88
+
89
+ ## Examples
90
+
91
+ ### Sales pipeline
92
+
93
+ `labelContent="category-value-conversion"` adds each stage's conversion from the stage before to its label, and `valueFormatter` adds the unit to the labels, tooltips and announcements. The legend lists the stages, one entry each.
94
+
95
+ `sales-pipeline-example.component.ts`
96
+
97
+ ```typescript
98
+ import { Component } from "@angular/core";
99
+ import {
100
+ ChartComponent,
101
+ ChartLegendComponent,
102
+ ChartTooltipComponent,
103
+ FunnelSeriesComponent
104
+ } from "@nanahoshi/mona-ui/chart";
105
+ import type { ChartValueFormatter } from "@nanahoshi/mona-ui/chart";
106
+
107
+ @Component({
108
+ selector: "app-chart-funnel-sales-pipeline-example",
109
+ imports: [ChartComponent, ChartLegendComponent, ChartTooltipComponent, FunnelSeriesComponent],
110
+ templateUrl: "./sales-pipeline-example.component.html"
111
+ })
112
+ export class ChartFunnelSalesPipelineExampleComponent {
113
+ protected readonly pipeline = [
114
+ { deals: 2400, stage: "Leads" },
115
+ { deals: 1250, stage: "Qualified" },
116
+ { deals: 640, stage: "Proposal" },
117
+ { deals: 410, stage: "Negotiation" },
118
+ { deals: 260, stage: "Won" }
119
+ ];
120
+ protected readonly deals: ChartValueFormatter = value => `${Number(value).toLocaleString("en")} deals`;
121
+ }
122
+ ```
123
+
124
+ `sales-pipeline-example.component.html`
125
+
126
+ ```html
127
+ <mona-chart aria-label="Sales pipeline by stage" class="h-80 w-full" [data]="pipeline">
128
+ <mona-funnel-series
129
+ categoryField="stage"
130
+ field="deals"
131
+ labelContent="category-value-conversion"
132
+ name="Deals"
133
+ [valueFormatter]="deals" />
134
+ <mona-chart-legend position="end" />
135
+ <mona-chart-tooltip />
136
+ </mona-chart>
137
+ ```
138
+
139
+ ### Conversion labels
140
+
141
+ A label template writes each stage's label with your own markup. Here a horizontal funnel shows the conversion and the drop-off under each step's name, and `minLabelWidth` leaves out labels on stages too narrow for them.
142
+
143
+ `conversion-labels-example.component.ts`
144
+
145
+ ```typescript
146
+ import { DecimalPipe } from "@angular/common";
147
+ import { Component } from "@angular/core";
148
+ import {
149
+ ChartComponent,
150
+ ChartFunnelLabelTemplateDirective,
151
+ ChartTooltipComponent,
152
+ FunnelSeriesComponent
153
+ } from "@nanahoshi/mona-ui/chart";
154
+
155
+ @Component({
156
+ selector: "app-chart-funnel-conversion-labels-example",
157
+ imports: [
158
+ ChartComponent,
159
+ ChartFunnelLabelTemplateDirective,
160
+ ChartTooltipComponent,
161
+ DecimalPipe,
162
+ FunnelSeriesComponent
163
+ ],
164
+ templateUrl: "./conversion-labels-example.component.html"
165
+ })
166
+ export class ChartFunnelConversionLabelsExampleComponent {
167
+ protected readonly checkout = [
168
+ { sessions: 8600, step: "Cart" },
169
+ { sessions: 5900, step: "Shipping" },
170
+ { sessions: 4700, step: "Payment" },
171
+ { sessions: 4100, step: "Review" },
172
+ { sessions: 3800, step: "Paid" }
173
+ ];
174
+ }
175
+ ```
176
+
177
+ `conversion-labels-example.component.html`
178
+
179
+ ```html
180
+ <mona-chart aria-label="Checkout sessions by step" class="h-64 w-full" [data]="checkout">
181
+ <mona-funnel-series
182
+ categoryField="step"
183
+ field="sessions"
184
+ name="Sessions"
185
+ orientation="horizontal"
186
+ [minLabelWidth]="72">
187
+ <ng-template monaChartFunnelLabelTemplate let-stage>
188
+ <span class="font-semibold">{{ stage.formattedCategory }}</span>
189
+ <span>{{ stage.formattedValue }}</span>
190
+ @if (stage.dropOff) {
191
+ <span>{{ stage.formattedConversionRate }}, lost {{ stage.dropOff | number }}</span>
192
+ }
193
+ </ng-template>
194
+ </mona-funnel-series>
195
+ <mona-chart-tooltip />
196
+ </mona-chart>
197
+ ```
198
+
199
+ ### Stage visibility
200
+
201
+ `[(hiddenStageIds)]` holds the hidden stages, and the legend writes to it when the user toggles a stage. With `keyField`, a stage keeps its ID when the rows change order. Hiding a stage works out the conversion of the stages after it again, from the visible stages.
202
+
203
+ `stage-visibility-example.component.ts`
204
+
205
+ ```typescript
206
+ import { Component, signal } from "@angular/core";
207
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
208
+ import {
209
+ ChartComponent,
210
+ ChartLegendComponent,
211
+ ChartTooltipComponent,
212
+ FunnelSeriesComponent
213
+ } from "@nanahoshi/mona-ui/chart";
214
+ import type { ChartFunnelStageVisibilityEvent } from "@nanahoshi/mona-ui/chart";
215
+
216
+ @Component({
217
+ selector: "app-chart-funnel-stage-visibility-example",
218
+ imports: [ButtonDirective, ChartComponent, ChartLegendComponent, ChartTooltipComponent, FunnelSeriesComponent],
219
+ templateUrl: "./stage-visibility-example.component.html"
220
+ })
221
+ export class ChartFunnelStageVisibilityExampleComponent {
222
+ protected readonly hidden = signal<readonly string[]>([]);
223
+ protected readonly journey = [
224
+ { id: "visited", stage: "Visited", users: 12400 },
225
+ { id: "signed-up", stage: "Signed up", users: 4820 },
226
+ { id: "trial", stage: "Started trial", users: 3150 },
227
+ { id: "subscribed", stage: "Subscribed", users: 1120 },
228
+ { id: "renewed", stage: "Renewed", users: 860 }
229
+ ];
230
+ protected readonly lastChange = signal("");
231
+
232
+ protected onStageVisibilityChange(event: ChartFunnelStageVisibilityEvent): void {
233
+ this.lastChange.set(`${event.formattedCategory} was ${event.visible ? "shown" : "hidden"} from the legend.`);
234
+ }
235
+ }
236
+ ```
237
+
238
+ `stage-visibility-example.component.html`
239
+
240
+ ```html
241
+ <div class="flex w-full flex-col gap-3">
242
+ <div class="flex flex-wrap gap-2">
243
+ <button monaButton type="button" (click)="hidden.set(['k:s:trial'])">Skip the trial stage</button>
244
+ <button monaButton type="button" [disabled]="hidden().length === 0" (click)="hidden.set([])">
245
+ Show every stage
246
+ </button>
247
+ </div>
248
+ <mona-chart aria-label="Users at each stage of the customer journey" class="h-80 w-full" [data]="journey">
249
+ <mona-funnel-series
250
+ categoryField="stage"
251
+ field="users"
252
+ keyField="id"
253
+ labelContent="category-value-conversion"
254
+ name="Users"
255
+ [(hiddenStageIds)]="hidden"
256
+ (stageVisibilityChange)="onStageVisibilityChange($event)" />
257
+ <mona-chart-legend />
258
+ <mona-chart-tooltip />
259
+ </mona-chart>
260
+ <p class="text-sm text-muted-foreground">Hidden stage IDs: {{ hidden().length ? hidden().join(", ") : "none" }}</p>
261
+ <p aria-live="polite" class="text-sm text-muted-foreground">{{ lastChange() }}</p>
262
+ </div>
263
+ ```
264
+
265
+ ## Appearance & Styling
266
+
267
+ | Input | Values | Effect |
268
+ | :--- | :--- | :--- |
269
+ | `orientation` | `"vertical"`, `"horizontal"` | Vertical runs the stages from top to bottom, horizontal from left to right. |
270
+ | `widthRatio` | A number from `0.1` to `1` | The widest stage's share of the plot's width, or of its height when horizontal. Values outside the range are clamped. |
271
+ | `gap` | Pixels | The space between stages. Together the gaps never take more than half the funnel's length. |
272
+ | `showLabels` | `boolean` | Whether stages get a label. |
273
+ | `labelContent` | `"category"`, `"value"`, `"category-value"`, `"category-value-conversion"` | What a built-in label shows. The conversion is left out on the first stage. |
274
+ | `maxLabels` | A number | The most labels shown, in stage order. |
275
+ | `minLabelWidth`, `minLabelHeight` | Pixels | The smallest space a label needs inside its stage, `48` wide and `20` tall by default. Both apply in either orientation, and a stage without room has no label. |
276
+ | `color` | Any CSS color | One color for every stage. |
277
+ | `colors` | An array of CSS colors | Colors for the stages in row order, starting over when they run out. |
278
+ | `colorField` | A field | A color for each stage from its row. |
279
+ | `fillOpacity` | A number from `0` to `1` | The opacity of the stages. `1` by default. |
280
+ | `strokeColor`, `strokeWidth` | A CSS color, pixels | The outline between stages. By default it's the surface color, 1 pixel wide. |
281
+
282
+ A stage takes the first color it finds in this order: its `colorField` value, `colors`, `color`, a text color class on the series element, then the chart palette, `--color-chart-1` to `--color-chart-5` by row.
283
+
284
+ Each stage starts as wide as its value and ends as wide as the next stage's value, and the last stage keeps one width. A stage larger than the one before it widens instead of narrowing, as when invitations bring in more people than sent them.
285
+
286
+ Built-in labels pick white or a dark text color, whichever contrasts more with the stage color.
287
+
288
+ ## Theming
289
+
290
+ These CSS custom properties style a funnel when the matching input isn't set. Put them on the chart, or on the series with its `class`.
291
+
292
+ | Property | Default | Styles |
293
+ | :--- | :--- | :--- |
294
+ | `--mona-chart-funnel-stroke-color` | The surface color | The outline between stages. |
295
+ | `--mona-chart-funnel-stroke-width` | `1` | The outline width, in pixels. |
296
+ | `--mona-chart-funnel-fill-opacity` | `1` | The opacity of the stages. |
297
+ | `--mona-chart-funnel-label-color` | White or dark, by contrast | The text color of every label. |
298
+
299
+ ## Behavior
300
+
301
+ ### One funnel per chart
302
+
303
+ A funnel has its chart to itself. A chart with two funnels, or with a funnel and another series, draws no stages, shows its no-data message and logs a development warning. Axes inside a funnel chart are ignored, with a development warning.
304
+
305
+ ### Values
306
+
307
+ - A stage needs a finite number of `0` or more. A row whose value is negative, missing, `NaN`, infinite or text that isn't a number is left out, and negative or invalid values log a development warning.
308
+ - A stage whose value is `0` is kept, with no width, and the stage after it has no conversion rate.
309
+ - When no stage is above zero, or every stage is hidden, the chart shows its no-data message. The legend stays, so the user can show hidden stages again. A hidden series shows the message too.
310
+
311
+ ### Stage IDs
312
+
313
+ Each stage has an ID, which `hiddenStageIds`, `stageVisibilityChange` and the label context use.
314
+
315
+ - With `keyField`, the ID comes from the row's key, and `chartItemKeyId(key)` builds it. It stays with the row when rows are reordered. A key used twice logs a development warning, and the later row falls back to its index.
316
+ - Without `keyField`, the ID comes from the row's index, and `chartItemIndexId(index)` builds it. It follows the position, not the row, when rows are reordered.
317
+
318
+ ```typescript
319
+ import { chartItemKeyId } from "@nanahoshi/mona-ui/chart";
320
+
321
+ protected readonly hiddenStageIds = signal([chartItemKeyId("trial")]);
322
+ ```
323
+
324
+ Both functions are described in the [Chart Overview API](chart.md). Treat the IDs as opaque: compare them, but don't parse them.
325
+
326
+ The ID also matches stages from one data set to the next, so stages with the same ID animate from where they were.
327
+
328
+ ### Stage visibility
329
+
330
+ - `[(hiddenStageIds)]` holds the IDs of the hidden stages. The legend writes to it when the user toggles a stage, and the parent can write to it too. IDs the data no longer has are dropped when the data changes, see [Two-Way Binding](chart.md).
331
+ - `stageVisibilityChange` emits when the legend or a method shows or hides a stage, with the stage's ID, name, row and new visibility. It doesn't emit when the parent writes `hiddenStageIds`.
332
+ - The series has methods for code that holds it through `viewChild`: `setDatumVisibility(stageId, visible)`, `toggleDatumVisibility(stageId)`, `isDatumVisible(stageId)` and `resetVisibility()`, which shows every stage. `resetVisibility()` doesn't emit `stageVisibilityChange`.
333
+ - A hidden stage keeps its legend entry. The other stages close up, and their widths, conversions and drop-offs are worked out again from the visible stages.
334
+ - `[(visible)]` hides the whole series.
335
+
336
+ ### Value formatting
337
+
338
+ - `valueFormatter` formats a stage's value in its label, tooltip and announcement. `categoryFormatter` formats its name everywhere it appears, including the legend. Both get the value and the row's index.
339
+ - Conversion rates are percentages for the library locale. The drop-off in the tooltip and announcements is a number for the library locale, and `valueFormatter` doesn't apply to it.
340
+
341
+ ### Tooltip
342
+
343
+ The tooltip shows one stage: its name, value, conversion and overall conversion, leaving out what the stage doesn't have, and its drop-off when that's above zero. `shared` has no effect on a funnel.
344
+
345
+ ## Accessibility
346
+
347
+ The chart is the focusable element, and the series adds no roles of its own. Moving to a stage announces the series name, the stage's name, its position ("stage 2 of 5") and value, then its conversion from the previous stage, its overall conversion, and its drop-off when that's above zero. Give the series a `name`, and use `valueFormatter` to add a unit.
348
+
349
+ - **Stage labels are hidden from screen readers.** The announcements carry each stage's name, value, conversions and drop-off, and the chart's `dataTable` lists the visible stages and their values. Don't put information only in a label template.
350
+ - **Don't rely on color alone.** Each stage's position and label tell it apart. Keep the labels or the legend so stages can be named without their color.
351
+ - **Check label contrast with custom colors.** Built-in labels pick their text color for the stage's color at full opacity, so a low `fillOpacity` or `--mona-chart-funnel-label-color` needs its own check.
352
+
353
+ ### Keyboard Navigation
354
+
355
+ | Key | Action |
356
+ | :--- | :--- |
357
+ | `ArrowDown` / `ArrowUp` | In a vertical funnel, move to the next or previous stage. |
358
+ | `ArrowRight` / `ArrowLeft` | In a horizontal funnel, move to the next or previous stage. |
359
+ | `Home` / `End` | Move to the first or last stage. |
360
+
361
+ The legend toggles stages with `Enter` and `Space`. The rest of the keys, including `Enter` for `pointClick` and `Escape`, are listed on [Chart Overview](chart.md).
362
+
363
+ ## API
364
+
365
+ Everything below is imported from `@nanahoshi/mona-ui/chart`.
366
+
367
+ ### `FunnelSeriesComponent`
368
+
369
+ Renders conversion pipeline and sales funnel visualizations using connected trapezoidal stages. Supports vertical and
370
+ horizontal layouts, custom stage colors, inscribed DOM labels, widening stages (>100% conversion), and dynamic stage
371
+ visibility toggling.
372
+
373
+ **Selector:** `mona-funnel-series`
374
+
375
+ #### Inputs
376
+
377
+ | Name | Type | Default | Description |
378
+ | --- | --- | --- | --- |
379
+ | `categoryField` | `ChartField` | `"category"` | Property key or accessor extracting stage names. |
380
+ | `categoryFormatter` | `ChartValueFormatter \| undefined` | `undefined` | Optional custom formatter for category names. |
381
+ | `class` | `string` | `""` | CSS class name applied to the hidden series host element. |
382
+ | `color` | `string` | `""` | Uniform fill color for all funnel stages. |
383
+ | `colorField` | `ChartField \| undefined` | `undefined` | Property key extracting discrete colors per datum. |
384
+ | `colors` | `readonly string[] \| undefined` | `undefined` | Palette array of colors cycled across stages. |
385
+ | `data` | `readonly unknown[] \| undefined` | `undefined` | Array of stage data items overriding chart-level root data. |
386
+ | `field` | `ChartField` | `"value"` | Property key or accessor function extracting numeric values. |
387
+ | `fillOpacity` | `number \| undefined` | `undefined` | Fill opacity applied to stage trapezoids (0 to 1). |
388
+ | `gap` | `number` | `2` | Spacing in pixels between consecutive funnel stages. |
389
+ | `hiddenStageIds` (two-way) | `readonly string[]` | `[]` | The hidden stage IDs. Bind `[(hiddenStageIds)]` for two-way binding; legend toggles write to it. Build an ID with `chartItemKeyId(key)` when `keyField` is set, or with `chartItemIndexId(index)`. |
390
+ | `keyField` | `ChartField \| undefined` | `undefined` | Unique identifier key field for datums. |
391
+ | `labelContent` | `ChartFunnelLabelContent` | `"category-value"` | Content format for automatic stage labels. |
392
+ | `maxLabels` | `number` | `100` | Maximum number of visible stage labels rendered simultaneously. |
393
+ | `minLabelHeight` | `number \| undefined` | `undefined` | Minimum stage height required in vertical orientation to render label. |
394
+ | `minLabelWidth` | `number \| undefined` | `undefined` | Minimum stage width required in horizontal orientation to render label. |
395
+ | `name` | `string` | `"Funnel"` | Descriptive series name displayed in chart legend and tooltips. |
396
+ | `orientation` | `ChartFunnelOrientation` | `"vertical"` | Layout orientation of the funnel ('vertical' or 'horizontal'). |
397
+ | `showLabels` | `boolean` | `true` | Controls whether built-in stage text labels are rendered. |
398
+ | `strokeColor` | `string` | `""` | Stroke outline color for stage trapezoids. |
399
+ | `strokeWidth` | `number \| undefined` | `undefined` | Stroke width in pixels for stage trapezoids. |
400
+ | `valueFormatter` | `ChartValueFormatter \| undefined` | `undefined` | Custom formatter function for numeric values. |
401
+ | `visible` (two-way) | `boolean` | `true` | Controls overall visibility of the funnel series. |
402
+ | `widthRatio` | `number` | `0.9` | Maximum width ratio (0 to 1) for the funnel's widest stage relative to plot area. |
403
+
404
+ #### Outputs
405
+
406
+ | Name | Type | Description |
407
+ | --- | --- | --- |
408
+ | `hiddenStageIdsChange` | `readonly string[]` | Emitted when `hiddenStageIds` changes. |
409
+ | `stageVisibilityChange` | `ChartFunnelStageVisibilityEvent<unknown>` | Emits when a stage's visibility is toggled via legend or API. |
410
+ | `visibleChange` | `boolean` | Emitted when `visible` changes. |
411
+
412
+ #### Methods
413
+
414
+ | Signature | Description |
415
+ | --- | --- |
416
+ | `isDatumVisible(stageId: string): boolean` | Whether the stage with this id is visible. |
417
+ | `resetVisibility(): void` | Shows every stage again. |
418
+ | `setDatumVisibility(stageId: string, visible: boolean): void` | Shows or hides the stage with this id. |
419
+ | `toggleDatumVisibility(stageId: string): boolean` | Shows or hides the stage with this id, and returns whether it's now visible. |
420
+
421
+ ### `ChartFunnelLabelTemplateDirective`
422
+
423
+ **Selector:** `ng-template[monaChartFunnelLabelTemplate]`
424
+
425
+ #### Template context
426
+
427
+ | Name | Type |
428
+ | --- | --- |
429
+ | `$implicit` | `ChartFunnelStageContext<unknown>` |
430
+ | `bounds` | `ChartRect` |
431
+ | `category` | `unknown` |
432
+ | `color` | `string` |
433
+ | `conversionRate?` | `number \| undefined` |
434
+ | `dataIndex` | `number` |
435
+ | `datum` | `unknown` |
436
+ | `dropOff?` | `number \| undefined` |
437
+ | `formattedCategory` | `string` |
438
+ | `formattedConversionRate?` | `string \| undefined` |
439
+ | `formattedOverallConversionRate?` | `string \| undefined` |
440
+ | `formattedValue` | `string` |
441
+ | `overallConversionRate?` | `number \| undefined` |
442
+ | `previousValue?` | `number \| undefined` |
443
+ | `stage` | `ChartFunnelStageContext<unknown>` |
444
+ | `stageId` | `string` |
445
+ | `stageIndex` | `number` |
446
+ | `textColor?` | `string \| undefined` |
447
+ | `value` | `number` |
448
+
449
+ ### Types
450
+
451
+ #### `ChartFunnelLabelTemplateContext`
452
+
453
+ **Type parameters:** `T = unknown`
454
+
455
+ | Name | Type |
456
+ | --- | --- |
457
+ | `$implicit` (read-only) | `ChartFunnelStageContext<T>` |
458
+ | `bounds` (read-only) | `ChartRect` |
459
+ | `category` (read-only) | `unknown` |
460
+ | `color` (read-only) | `string` |
461
+ | `conversionRate?` (read-only) | `number` |
462
+ | `dataIndex` (read-only) | `number` |
463
+ | `datum` (read-only) | `T` |
464
+ | `dropOff?` (read-only) | `number` |
465
+ | `formattedCategory` (read-only) | `string` |
466
+ | `formattedConversionRate?` (read-only) | `string` |
467
+ | `formattedOverallConversionRate?` (read-only) | `string` |
468
+ | `formattedValue` (read-only) | `string` |
469
+ | `overallConversionRate?` (read-only) | `number` |
470
+ | `previousValue?` (read-only) | `number` |
471
+ | `stage` (read-only) | `ChartFunnelStageContext<T>` |
472
+ | `stageId` (read-only) | `string` |
473
+ | `stageIndex` (read-only) | `number` |
474
+ | `textColor?` (read-only) | `string` |
475
+ | `value` (read-only) | `number` |
476
+
477
+ #### `ChartFunnelPointMetadata`
478
+
479
+ | Name | Type |
480
+ | --- | --- |
481
+ | `category` (read-only) | `unknown` |
482
+ | `conversionRate?` (read-only) | `number` |
483
+ | `dropOff?` (read-only) | `number` |
484
+ | `formattedCategory` (read-only) | `string` |
485
+ | `formattedConversionRate?` (read-only) | `string` |
486
+ | `formattedOverallConversionRate?` (read-only) | `string` |
487
+ | `formattedValue` (read-only) | `string` |
488
+ | `overallConversionRate?` (read-only) | `number` |
489
+ | `previousValue?` (read-only) | `number` |
490
+ | `stageId` (read-only) | `string` |
491
+ | `stageIndex` (read-only) | `number` |
492
+ | `value` (read-only) | `number` |
493
+
494
+ #### `ChartFunnelStageContext`
495
+
496
+ **Type parameters:** `T = unknown`
497
+
498
+ | Name | Type |
499
+ | --- | --- |
500
+ | `bounds` (read-only) | `ChartRect` |
501
+ | `category` (read-only) | `unknown` |
502
+ | `color` (read-only) | `string` |
503
+ | `conversionRate?` (read-only) | `number` |
504
+ | `dataIndex` (read-only) | `number` |
505
+ | `datum` (read-only) | `T` |
506
+ | `dropOff?` (read-only) | `number` |
507
+ | `formattedCategory` (read-only) | `string` |
508
+ | `formattedConversionRate?` (read-only) | `string` |
509
+ | `formattedOverallConversionRate?` (read-only) | `string` |
510
+ | `formattedValue` (read-only) | `string` |
511
+ | `overallConversionRate?` (read-only) | `number` |
512
+ | `previousValue?` (read-only) | `number` |
513
+ | `stageId` (read-only) | `string` |
514
+ | `stageIndex` (read-only) | `number` |
515
+ | `textColor?` (read-only) | `string` |
516
+ | `value` (read-only) | `number` |
517
+
518
+ #### `ChartFunnelStageVisibilityEvent`
519
+
520
+ **Type parameters:** `T = unknown`
521
+
522
+ | Name | Type |
523
+ | --- | --- |
524
+ | `category` (read-only) | `unknown` |
525
+ | `dataIndex` (read-only) | `number` |
526
+ | `datum` (read-only) | `T` |
527
+ | `formattedCategory` (read-only) | `string` |
528
+ | `seriesId` (read-only) | `string` |
529
+ | `seriesName` (read-only) | `string` |
530
+ | `seriesType` (read-only) | `"funnel"` |
531
+ | `stageId` (read-only) | `string` |
532
+ | `visible` (read-only) | `boolean` |
533
+
534
+ #### `ChartFunnelLabelContent`
535
+
536
+ ```typescript
537
+ type ChartFunnelLabelContent = "category" | "category-value" | "category-value-conversion" | "value";
538
+ ```
539
+
540
+ #### `ChartFunnelOrientation`
541
+
542
+ ```typescript
543
+ type ChartFunnelOrientation = "horizontal" | "vertical";
544
+ ```
545
+
546
+ **Documented elsewhere:** [`ChartField`](chart.md), [`ChartRect`](chart.md), [`ChartValueFormatter`](chart.md)