@nanahoshi/mona-ui 0.41.0 → 0.43.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 (154) hide show
  1. package/README.md +2 -0
  2. package/docs/api/alert.json +1 -0
  3. package/docs/api/auto-complete.json +1 -0
  4. package/docs/api/auto-complete.md +2 -0
  5. package/docs/api/avatar.json +1 -0
  6. package/docs/api/badge.json +1 -0
  7. package/docs/api/breadcrumb.json +1 -0
  8. package/docs/api/button-group.json +1 -0
  9. package/docs/api/button.json +1 -0
  10. package/docs/api/calendar.json +1 -0
  11. package/docs/api/card.json +1 -0
  12. package/docs/api/chart.json +1 -0
  13. package/docs/api/check-box.json +1 -0
  14. package/docs/api/chip.json +1 -0
  15. package/docs/api/circular-progress-bar.json +1 -0
  16. package/docs/api/collapsible.json +1 -0
  17. package/docs/api/color-gradient.json +1 -0
  18. package/docs/api/color-palette.json +1 -0
  19. package/docs/api/color-picker.json +1 -0
  20. package/docs/api/combo-box.json +1 -0
  21. package/docs/api/combo-box.md +2 -0
  22. package/docs/api/command.json +1 -0
  23. package/docs/api/common.json +1 -0
  24. package/docs/api/contextmenu.json +1 -0
  25. package/docs/api/date-input.json +1 -0
  26. package/docs/api/date-picker.json +1 -0
  27. package/docs/api/date-range-picker.json +1 -0
  28. package/docs/api/datetime-picker.json +1 -0
  29. package/docs/api/dialog.json +1 -0
  30. package/docs/api/dropdown-button.json +1 -0
  31. package/docs/api/dropdown-list.json +1 -0
  32. package/docs/api/dropdown-tree.json +1 -0
  33. package/docs/api/dropdowns.json +1 -0
  34. package/docs/api/dropdowns.md +3 -1
  35. package/docs/api/editor.json +1 -0
  36. package/docs/api/expansion-panel.json +1 -0
  37. package/docs/api/fieldset.json +1 -0
  38. package/docs/api/file-upload.json +1 -0
  39. package/docs/api/filter.json +1 -0
  40. package/docs/api/form-field.json +1 -0
  41. package/docs/api/grid.json +1 -0
  42. package/docs/api/i18n.json +1 -0
  43. package/docs/api/i18n.md +20 -0
  44. package/docs/api/index.json +1 -0
  45. package/docs/api/kanban.json +1 -0
  46. package/docs/api/label.json +1 -0
  47. package/docs/api/list-box.json +1 -0
  48. package/docs/api/list-view.json +1 -0
  49. package/docs/api/list.json +1 -0
  50. package/docs/api/locales.json +1 -0
  51. package/docs/api/locales.md +14 -14
  52. package/docs/api/masked-text-box.json +1 -0
  53. package/docs/api/menubar.json +1 -0
  54. package/docs/api/multi-select-tree.json +1 -0
  55. package/docs/api/multi-select.json +1 -0
  56. package/docs/api/notification.json +1 -0
  57. package/docs/api/numeric-text-box.json +1 -0
  58. package/docs/api/otp-input.json +1 -0
  59. package/docs/api/pager.json +1 -0
  60. package/docs/api/placeholder.json +1 -0
  61. package/docs/api/popover.json +1 -0
  62. package/docs/api/popup-menu.json +1 -0
  63. package/docs/api/popup.json +1 -0
  64. package/docs/api/progress-bar.json +1 -0
  65. package/docs/api/qr-code.json +1 -0
  66. package/docs/api/query.json +1 -0
  67. package/docs/api/radio-button.json +1 -0
  68. package/docs/api/rating.json +1 -0
  69. package/docs/api/scroll-view.json +1 -0
  70. package/docs/api/segmented.json +1 -0
  71. package/docs/api/separator.json +1 -0
  72. package/docs/api/sheet.json +1 -0
  73. package/docs/api/sidebar.json +1 -0
  74. package/docs/api/skeleton.json +1 -0
  75. package/docs/api/slider.json +1 -0
  76. package/docs/api/sortable.json +1 -0
  77. package/docs/api/sparkline.json +1 -0
  78. package/docs/api/sparkline.md +85 -0
  79. package/docs/api/spinner.json +1 -0
  80. package/docs/api/split-button.json +1 -0
  81. package/docs/api/splitter.json +1 -0
  82. package/docs/api/stepper.json +1 -0
  83. package/docs/api/switch.json +1 -0
  84. package/docs/api/tabs.json +1 -0
  85. package/docs/api/text-area.json +1 -0
  86. package/docs/api/text-box.json +1 -0
  87. package/docs/api/theme.json +1 -0
  88. package/docs/api/time-picker.json +1 -0
  89. package/docs/api/time-selector.json +1 -0
  90. package/docs/api/toolbar.json +1 -0
  91. package/docs/api/tooltip.json +1 -0
  92. package/docs/api/tree-view.json +1 -0
  93. package/docs/api/window.json +1 -0
  94. package/docs/auto-complete.md +64 -0
  95. package/docs/combo-box.md +65 -0
  96. package/docs/installation.md +8 -0
  97. package/docs/manifest.json +1 -0
  98. package/docs/sparkline.md +303 -0
  99. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +95 -30
  100. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +58 -5
  101. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +64 -29
  102. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -0
  103. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +5 -0
  104. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +5 -0
  105. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +5 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +5 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +5 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +5 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +5 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +5 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +25 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +5 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +25 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +5 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +5 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +5 -0
  117. package/fesm2022/nanahoshi-mona-ui-sparkline.mjs +573 -0
  118. package/i18n/catalogs/en-US.messages.json +5 -0
  119. package/llms.txt +3 -1
  120. package/locales/ar-sa/ar-sa.messages.json +5 -0
  121. package/locales/de-de/de-de.messages.json +5 -0
  122. package/locales/es-es/es-es.messages.json +5 -0
  123. package/locales/fr-fr/fr-fr.messages.json +5 -0
  124. package/locales/id-id/id-id.messages.json +5 -0
  125. package/locales/it-it/it-it.messages.json +5 -0
  126. package/locales/ja-jp/ja-jp.messages.json +5 -0
  127. package/locales/ko-kr/ko-kr.messages.json +5 -0
  128. package/locales/pl-pl/pl-pl.messages.json +5 -0
  129. package/locales/pt-br/pt-br.messages.json +5 -0
  130. package/locales/ru-ru/ru-ru.messages.json +5 -0
  131. package/locales/tr-tr/tr-tr.messages.json +5 -0
  132. package/locales/zh-cn/zh-cn.messages.json +5 -0
  133. package/locales/zh-tw/zh-tw.messages.json +5 -0
  134. package/package.json +5 -1
  135. package/sparkline/package.json +4 -0
  136. package/types/nanahoshi-mona-ui-auto-complete.d.ts +42 -1
  137. package/types/nanahoshi-mona-ui-combo-box.d.ts +37 -1
  138. package/types/nanahoshi-mona-ui-dropdowns.d.ts +54 -4
  139. package/types/nanahoshi-mona-ui-i18n.d.ts +12 -0
  140. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +5 -0
  141. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +5 -0
  142. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +5 -0
  143. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +5 -0
  144. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +5 -0
  145. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +5 -0
  146. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +5 -0
  147. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +5 -0
  148. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +5 -0
  149. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +5 -0
  150. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +5 -0
  151. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +5 -0
  152. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +5 -0
  153. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +5 -0
  154. package/types/nanahoshi-mona-ui-sparkline.d.ts +228 -0
package/docs/combo-box.md CHANGED
@@ -295,6 +295,59 @@ export class ComboBoxFormsExampleComponent {
295
295
  </div>
296
296
  ```
297
297
 
298
+ ### A bottom sheet on a phone
299
+
300
+ With `adaptiveMode="auto"`, on a screen narrower than 640 pixels, the popup opens as a sheet along the bottom of the screen, with a text box of its own at the top. Narrow the window to see it.
301
+
302
+ `adaptive-example.component.ts`
303
+
304
+ ```typescript
305
+ import { Component, signal } from "@angular/core";
306
+ import { ComboBoxComponent } from "@nanahoshi/mona-ui/combo-box";
307
+ import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
308
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
309
+
310
+ @Component({
311
+ selector: "app-combo-box-adaptive-example",
312
+ imports: [ComboBoxComponent, DropdownFilterableDirective, FormFieldComponent],
313
+ templateUrl: "./adaptive-example.component.html"
314
+ })
315
+ export class ComboBoxAdaptiveExampleComponent {
316
+ protected readonly countries = [
317
+ "Argentina",
318
+ "Australia",
319
+ "Brazil",
320
+ "Canada",
321
+ "Germany",
322
+ "Indonesia",
323
+ "Italy",
324
+ "Japan",
325
+ "Poland",
326
+ "South Korea",
327
+ "Spain",
328
+ "Türkiye"
329
+ ];
330
+ protected readonly country = signal<string | null>("Japan");
331
+ }
332
+ ```
333
+
334
+ `adaptive-example.component.html`
335
+
336
+ ```html
337
+ <mona-form-field
338
+ class="max-w-sm"
339
+ label="Country"
340
+ hint="On a phone, the list opens along the bottom of the screen, with a box to type in.">
341
+ <mona-combo-box
342
+ adaptiveMode="auto"
343
+ class="w-full"
344
+ monaDropDownFilterable
345
+ placeholder="Type a country"
346
+ [data]="countries"
347
+ [(value)]="country" />
348
+ </mona-form-field>
349
+ ```
350
+
298
351
  ### Grouping
299
352
 
300
353
  `monaDropDownGroupable` groups options under a header row, driven by `groupBy`.
@@ -365,6 +418,16 @@ While the popup is open, `Escape` reverts the displayed text to the currently se
365
418
 
366
419
  `open` and `close` emit event objects with `preventDefault()` and `isDefaultPrevented()`. Calling `preventDefault()` in an `open` handler stops the popup from opening; calling it in a `close` handler stops the popup from closing. `close`'s event object also exposes `via`, describing what triggered the close attempt.
367
420
 
421
+ ### The bottom sheet
422
+
423
+ With `adaptiveMode="auto"`, the popup opens as a bottom sheet when the screen is narrower than 640 pixels as it opens; it doesn't switch while open. On such a screen, the field raises no on-screen keyboard. Pressing it opens the sheet, and so does typing into it with a keyboard, which carries the text along.
424
+
425
+ The sheet covers the page with a dimmed backdrop and has a header with the field's name (or `adaptiveTitle`) and a close button. Below it is a text box, which takes focus and is named by that header, then the list, whose options are 44 pixels tall.
426
+
427
+ The text box works as the field does: it filters the list, the arrow keys move through it, `Enter` resolves the text as described in [Enter key resolution](#enter-key-resolution), and `Escape` reverts it. The sheet keeps its height while the list filters, so the text box stays put, and it sits above an on-screen keyboard.
428
+
429
+ When the sheet closes, focus goes back to the field. Pressing the backdrop or the close button leaves the typed text in the field, which resolves it when focus leaves, as usual. Without `adaptiveMode`, or with `"none"`, the popup always opens under the field.
430
+
368
431
  ### `DropdownFieldSelectorType`, `DropdownFieldPredicateType`, and `ListSizeInputType` are not exported
369
432
 
370
433
  `textField`, `valueField`, `itemDisabled`, `popupHeight`, and `popupWidth` are typed with these generic aliases internally, but none of the three types are re-exported from `@nanahoshi/mona-ui`. Inline values (as in the examples above) still type-check structurally; only a standalone typed variable would require an import.
@@ -390,6 +453,8 @@ While the popup is open, `Escape` reverts the displayed text to the currently se
390
453
 
391
454
  The host element itself is not a Tab stop (`tabindex="-1"`); the inner `<input>` element receives focus and is the actual Tab stop. Arrow-key navigation moves an internal highlighted-option pointer, reflected through `aria-activedescendant` on the input, instead of moving DOM focus into the popup.
392
455
 
456
+ In a bottom sheet (`adaptiveMode="auto"` on a small screen), focus moves to the sheet's text box, which has the same role and states as the input, and comes back to the input when the sheet closes.
457
+
393
458
  ### ARIA
394
459
 
395
460
  | Element | Attribute | When present | Value |
@@ -178,6 +178,14 @@ See [Export](chart.md#export) for how to export a chart.
178
178
 
179
179
  The documentation is also available as markdown, for coding agents. Point an agent at `/llms.txt`, which lists every page with a link to its markdown, or at `node_modules/@nanahoshi/mona-ui/llms.txt`, which matches the installed version.
180
180
 
181
+ Agents that support the Model Context Protocol (MCP), such as Claude Code, Cursor and VS Code, can use the `@nanahoshi/mona-ui-mcp` server instead. It answers from the docs of the installed version, a page section or a component's inputs at a time, so the agent doesn't read them all. It also checks a template for elements, inputs and outputs that don't exist, and lists the imports the template needs. Add it from your project's folder:
182
+
183
+ ```bash
184
+ claude mcp add mona-ui -- npx -y @nanahoshi/mona-ui-mcp
185
+ ```
186
+
187
+ Other clients run the command `npx` with the arguments `-y @nanahoshi/mona-ui-mcp`. The server's [README](https://github.com/nanahoshi-dev/mona-ui/tree/main/projects/mona-ui-mcp#readme) shows the setup for each client, and the tools it offers.
188
+
181
189
  ## Next Steps
182
190
 
183
191
  - [Theming](theming.md): choose a theme, and match it to your brand.
@@ -0,0 +1 @@
1
+ {"essentials":"Mona UI is an Angular component library styled with Tailwind CSS 4. Its components are standalone and signal based: inputs are `input()` and `model()`, events are `output()`.\n\n## Essentials\n\n- Install with `npm install @nanahoshi/mona-ui`. The application needs Tailwind CSS 4.\n- Import the styles in the main stylesheet, after Tailwind: `@import \"tailwindcss\";` then `@import \"@nanahoshi/mona-ui/styles.css\";`. Without it, components render unstyled.\n- Import every symbol from its entry point, such as `import { ButtonDirective } from \"@nanahoshi/mona-ui/button\";`. Each page below names its entry point. The root `@nanahoshi/mona-ui` exports nothing.\n- Add what you import to the standalone component's `imports` array. There are no NgModules.\n- No provider is required. Optional ones: `provideThemeOptions` (`@nanahoshi/mona-ui/theme`) to pick a theme, `provideMonaI18n` (`@nanahoshi/mona-ui/i18n`) for locale and messages, `provideNotificationDefaults` (`@nanahoshi/mona-ui/notification`) and `provideSidebarStorage` (`@nanahoshi/mona-ui/sidebar`).\n- Form controls implement `FormValueControl` from `@angular/forms/signals`: bind them with `[formField]`. They have no `ControlValueAccessor`, but `[(ngModel)]` and `[formControl]` still work, because Angular binds a control's `value` and `touch` directly.\n\n## Common mistakes\n\n- Importing from `@nanahoshi/mona-ui` instead of an entry point such as `@nanahoshi/mona-ui/grid`.\n- Leaving out `@nanahoshi/mona-ui/styles.css`, or importing it before Tailwind.\n- Treating a `placeholder` as a label. Give each control a name: a `<label for>` pointed at its input id, `aria-label` or `aria-labelledby`. Those two are inputs on every component that takes a name, and the component moves them to the element that has the role.\n- Expecting the grid, list box or tabs to change their data. They report the change through an event, and you write it back to the data you bound.\n- Putting `[disabled]` on a `monaTooltip` that sits on a button: it disables the button too. Use `[tooltipDisabled]`.\n- Using the rich text editor without its packages and styles. Mona UI doesn't install them: add `@tiptap/core`, `@tiptap/pm`, `@tiptap/starter-kit`, `@tiptap/extension-highlight`, `@tiptap/extension-image`, `@tiptap/extension-list`, `@tiptap/extension-subscript`, `@tiptap/extension-superscript`, `@tiptap/extension-table`, `@tiptap/extension-text-align`, `@tiptap/extension-text-style`, `remixicon` and `@tailwindcss/typography`, then `@import \"remixicon/fonts/remixicon.css\";` and `@plugin \"@tailwindcss/typography\";` to the global stylesheet.\n- Exporting a chart without its packages. `exportChart` and `downloadChart` need `jspdf`, `svg2pdf.js` and `html2canvas-pro`, which Mona UI doesn't install.","pages":[{"category":"Get Started","description":"What Mona UI is, what it includes and how it is built.","file":"docs/introduction.md","kind":"guide","path":"introduction","slug":"introduction","title":"Introduction"},{"category":"Get Started","description":"Install the package, set up its styles and choose a theme.","file":"docs/installation.md","kind":"guide","path":"installation","slug":"installation","title":"Installation"},{"category":"Get Started","description":"Choose and switch themes, follow the system's dark mode, and use theme tokens in your own styles.","entryPoint":"theme","file":"docs/theming.md","kind":"guide","path":"theming","slug":"theming","title":"Theming"},{"category":"Get Started","description":"Mona, Luna and Anna side by side, and when to use each one.","file":"docs/theming-built-in-themes.md","kind":"guide","path":"theming/built-in-themes","slug":"theming-built-in-themes","title":"Built-in Themes"},{"category":"Get Started","description":"Generate a palette from brand colors, override tokens, or let users choose a color.","file":"docs/theming-custom-colors.md","kind":"guide","path":"theming/custom-colors","slug":"theming-custom-colors","title":"Custom Colors"},{"category":"Get Started","description":"Register a theme of your own, from scratch or based on a built-in theme.","file":"docs/theming-custom-themes.md","kind":"guide","path":"theming/custom-themes","slug":"theming-custom-themes","title":"Custom Themes"},{"category":"Get Started","description":"Connect Mona UI controls to Angular signal forms.","file":"docs/forms.md","kind":"guide","path":"forms","slug":"forms","title":"Forms"},{"category":"Actions","description":"Styles a native button and adds loading, toggle and disabled behavior.","entryPoint":"button","file":"docs/button.md","kind":"component","path":"button","slug":"button","title":"Button"},{"category":"Actions","description":"Joins related buttons into one control with a shared look and size.","entryPoint":"button-group","file":"docs/button-group.md","kind":"component","path":"button-group","slug":"button-group","title":"Button Group"},{"category":"Actions","description":"A single button that opens a menu of actions.","entryPoint":"dropdown-button","file":"docs/dropdown-button.md","kind":"component","path":"dropdown-button","slug":"dropdown-button","title":"Dropdown Button"},{"category":"Actions","description":"A primary action button paired with a menu of secondary actions.","entryPoint":"split-button","file":"docs/split-button.md","kind":"component","path":"split-button","slug":"split-button","title":"Split Button"},{"category":"Actions","description":"A row of controls that is one Tab stop, moving what doesn't fit into a More menu.","entryPoint":"toolbar","file":"docs/toolbar.md","kind":"component","path":"toolbar","slug":"toolbar","title":"Toolbar"},{"category":"Form Fields","description":"A numeric input whose value is a decimal string, for exact values like money.","entryPoint":"numeric-text-box","file":"docs/decimal-textbox.md","kind":"component","path":"decimal-textbox","slug":"decimal-textbox","title":"Decimal Text Box"},{"category":"Form Fields","description":"A rich text editor with a configurable toolbar and an HTML value.","entryPoint":"editor","file":"docs/editor.md","kind":"component","path":"editor","slug":"editor","title":"Editor"},{"category":"Form Fields","description":"Groups related form controls under a labelled border.","entryPoint":"fieldset","file":"docs/fieldset.md","kind":"component","path":"fieldset","slug":"fieldset","title":"Fieldset"},{"category":"Form Fields","description":"Picks files from a drop zone or the file dialog, checks them, and uploads them with progress.","entryPoint":"file-upload","file":"docs/file-upload.md","kind":"component","path":"file-upload","slug":"file-upload","title":"File Upload"},{"category":"Form Fields","description":"Labels one form control, describes it with a hint and shows its validation errors.","entryPoint":"form-field","file":"docs/form-field.md","kind":"component","path":"form-field","slug":"form-field","title":"Form Field"},{"category":"Form Fields","description":"Styles a native input element and keeps its browser behavior.","entryPoint":"text-box","file":"docs/input.md","kind":"component","path":"input","slug":"input","title":"Input"},{"category":"Form Fields","description":"Styled, accessible labels associated with form controls.","entryPoint":"label","file":"docs/label.md","kind":"component","path":"label","slug":"label","title":"Label"},{"category":"Form Fields","description":"A text input for values in a fixed format, such as phone numbers, that fills in the format as you type.","entryPoint":"masked-text-box","file":"docs/masked-textbox.md","kind":"component","path":"masked-textbox","slug":"masked-textbox","title":"Masked Text Box"},{"category":"Form Fields","description":"A number input with spinner buttons, bounds and decimal formatting.","entryPoint":"numeric-text-box","file":"docs/numeric-textbox.md","kind":"component","path":"numeric-textbox","slug":"numeric-textbox","title":"Numeric Text Box"},{"category":"Form Fields","description":"A segmented input for one-time passwords and verification codes.","entryPoint":"otp-input","file":"docs/otp-input.md","kind":"component","path":"otp-input","slug":"otp-input","title":"OTP Input"},{"category":"Form Fields","description":"Styles a native textarea element and keeps its browser behavior.","entryPoint":"text-area","file":"docs/textarea.md","kind":"component","path":"textarea","slug":"textarea","title":"Text Area"},{"category":"Form Fields","description":"A text input with prefix and suffix slots and an optional clear button.","entryPoint":"text-box","file":"docs/textbox.md","kind":"component","path":"textbox","slug":"textbox","title":"Text Box"},{"category":"Selection","description":"A text input that suggests matching options as the user types.","entryPoint":"auto-complete","file":"docs/auto-complete.md","kind":"component","path":"auto-complete","slug":"auto-complete","title":"Auto Complete"},{"category":"Selection","description":"A checkbox with label handling and an indeterminate state.","entryPoint":"check-box","file":"docs/checkbox.md","kind":"component","path":"checkbox","slug":"checkbox","title":"Checkbox"},{"category":"Selection","description":"A text input that resolves typed text to one item from a collection.","entryPoint":"combo-box","file":"docs/combo-box.md","kind":"component","path":"combo-box","slug":"combo-box","title":"Combo Box"},{"category":"Selection","description":"A closed control that opens a list for choosing exactly one option.","entryPoint":"dropdown-list","file":"docs/dropdown-list.md","kind":"component","path":"dropdown-list","slug":"dropdown-list","title":"Dropdown List"},{"category":"Selection","description":"A closed control that opens a tree for choosing one item from a hierarchy.","entryPoint":"dropdown-tree","file":"docs/dropdown-tree.md","kind":"component","path":"dropdown-tree","slug":"dropdown-tree","title":"Dropdown Tree"},{"category":"Selection","description":"A control that shows selected options as removable tags.","entryPoint":"multi-select","file":"docs/multi-select.md","kind":"component","path":"multi-select","slug":"multi-select","title":"Multi Select"},{"category":"Selection","description":"A control that opens a tree with checkboxes and shows the checked items as removable tags.","entryPoint":"multi-select-tree","file":"docs/multi-select-tree.md","kind":"component","path":"multi-select-tree","slug":"multi-select-tree","title":"Multi Select Tree"},{"category":"Selection","description":"Radio buttons and groups for choosing one option from several.","entryPoint":"radio-button","file":"docs/radio-button.md","kind":"component","path":"radio-button","slug":"radio-button","title":"Radio Button"},{"category":"Selection","description":"A two-handle slider for selecting a numeric interval.","entryPoint":"slider","file":"docs/range-slider.md","kind":"component","path":"range-slider","slug":"range-slider","title":"Range Slider"},{"category":"Selection","description":"Choose a value from a visual scale of icons, in whole or half steps.","entryPoint":"rating","file":"docs/rating.md","kind":"component","path":"rating","slug":"rating","title":"Rating"},{"category":"Selection","description":"A compact set of mutually exclusive options.","entryPoint":"segmented","file":"docs/segmented.md","kind":"component","path":"segmented","slug":"segmented","title":"Segmented"},{"category":"Selection","description":"A single-handle slider for selecting a numeric value.","entryPoint":"slider","file":"docs/slider.md","kind":"component","path":"slider","slug":"slider","title":"Slider"},{"category":"Selection","description":"A binary on and off toggle with optional state labels.","entryPoint":"switch","file":"docs/switch.md","kind":"component","path":"switch","slug":"switch","title":"Switch"},{"category":"Date, Time & Color","description":"Date selection in single, multiple and range modes across month, year and decade views.","entryPoint":"calendar","file":"docs/calendar.md","kind":"component","path":"calendar","slug":"calendar","title":"Calendar"},{"category":"Date, Time & Color","description":"A color editor for saturation, value, hue and alpha.","entryPoint":"color-gradient","file":"docs/color-gradient.md","kind":"component","path":"color-gradient","slug":"color-gradient","title":"Color Gradient"},{"category":"Date, Time & Color","description":"A grid of selectable color swatches from a built-in or custom scheme.","entryPoint":"color-palette","file":"docs/color-palette.md","kind":"component","path":"color-palette","slug":"color-palette","title":"Color Palette"},{"category":"Date, Time & Color","description":"A compact control that opens a color palette or gradient editor.","entryPoint":"color-picker","file":"docs/color-picker.md","kind":"component","path":"color-picker","slug":"color-picker","title":"Color Picker"},{"category":"Date, Time & Color","description":"A date input that opens a calendar popup.","entryPoint":"date-picker","file":"docs/date-picker.md","kind":"component","path":"date-picker","slug":"date-picker","title":"Date Picker"},{"category":"Date, Time & Color","description":"Two date inputs for a range of days, with a calendar popup that shows two months.","entryPoint":"date-range-picker","file":"docs/date-range-picker.md","kind":"component","path":"date-range-picker","slug":"date-range-picker","title":"Date Range Picker"},{"category":"Date, Time & Color","description":"An input for choosing a date and a time together.","entryPoint":"datetime-picker","file":"docs/datetime-picker.md","kind":"component","path":"datetime-picker","slug":"datetime-picker","title":"Date Time Picker"},{"category":"Date, Time & Color","description":"A time input that opens a time selector popup.","entryPoint":"time-picker","file":"docs/time-picker.md","kind":"component","path":"time-picker","slug":"time-picker","title":"Time Picker"},{"category":"Data","description":"Shows a person or entity as an image, text label or projected content, alone or stacked in a group.","entryPoint":"avatar","file":"docs/avatar.md","kind":"component","path":"avatar","slug":"avatar","title":"Avatar"},{"category":"Data","description":"A small filled or outlined label for a count or a status.","entryPoint":"badge","file":"docs/badge.md","kind":"component","path":"badge","slug":"badge","title":"Badge"},{"category":"Data","description":"A compact label that can be selected, removed or given a prefix.","entryPoint":"chip","file":"docs/chip.md","kind":"component","path":"chip","slug":"chip","title":"Chip"},{"category":"Data","description":"A board of columns that cards move between by dragging or with the keyboard, with column limits.","entryPoint":"kanban","file":"docs/kanban.md","kind":"component","path":"kanban","slug":"kanban","title":"Kanban"},{"category":"Data","description":"A selectable list with a toolbar for moving items and transferring them between lists.","entryPoint":"list-box","file":"docs/list-box.md","kind":"component","path":"list-box","slug":"list-box","title":"List Box"},{"category":"Data","description":"Renders a collection as a list, with optional selection, grouping and paging.","entryPoint":"list-view","file":"docs/list-view.md","kind":"component","path":"list-view","slug":"list-view","title":"List View"},{"category":"Data","description":"Pagination controls with page buttons, a page-size selector and a page-jump input.","entryPoint":"pager","file":"docs/pager.md","kind":"component","path":"pager","slug":"pager","title":"Pager"},{"category":"Data","description":"Encodes text or a URL as a scannable QR code, with logo overlays and PNG, SVG and PDF export.","entryPoint":"qr-code","file":"docs/qr-code.md","kind":"component","path":"qr-code","slug":"qr-code","title":"QR Code"},{"category":"Data","description":"Lets users reorder any list by dragging or with the keyboard, and move items between connected lists.","entryPoint":"sortable","file":"docs/sortable.md","kind":"component","path":"sortable","slug":"sortable","title":"Sortable"},{"category":"Data","description":"Hierarchical data as an expandable, keyboard-navigable tree.","entryPoint":"tree-view","file":"docs/tree-view.md","kind":"component","path":"tree-view","slug":"tree-view","title":"Tree View"},{"category":"Grid","description":"Tabular data in typed columns with paging, templates and a toolbar, extended by feature directives.","entryPoint":"grid","file":"docs/grid.md","kind":"component","path":"grid","slug":"grid","title":"Grid Overview"},{"category":"Grid","description":"Sort rows by column headers and filter them from a header menu or a filter row.","entryPoint":"grid","file":"docs/grid-sorting-filtering.md","kind":"component","path":"grid-sorting-filtering","slug":"grid-sorting-filtering","title":"Sorting & Filtering"},{"category":"Grid","description":"Group rows by column values and show sums, averages and other aggregates in footers.","entryPoint":"grid","file":"docs/grid-grouping.md","kind":"component","path":"grid-grouping","slug":"grid-grouping","title":"Grouping & Aggregates"},{"category":"Grid","description":"Show hierarchical rows in a grid, nested or linked by a parent key, with expandable levels.","entryPoint":"grid","file":"docs/grid-tree.md","kind":"component","path":"grid-tree","slug":"grid-tree","title":"Tree List"},{"category":"Grid","description":"Select rows by key with checkboxes, clicks and the keyboard, or a range of cells to copy and paste.","entryPoint":"grid","file":"docs/grid-selection.md","kind":"component","path":"grid-selection","slug":"grid-selection","title":"Selection"},{"category":"Grid","description":"Edit cells or rows inline with Signal Forms, and add, save, cancel and remove rows.","entryPoint":"grid","file":"docs/grid-editing.md","kind":"component","path":"grid-editing","slug":"grid-editing","title":"Editing"},{"category":"Grid","description":"Group, resize, reorder, lock and hide columns, by pointer, keyboard or the column chooser.","entryPoint":"grid","file":"docs/grid-columns.md","kind":"component","path":"grid-columns","slug":"grid-columns","title":"Columns"},{"category":"Grid","description":"Expandable detail rows, row reordering by drag or keyboard, row classes and row sizing.","entryPoint":"grid","file":"docs/grid-rows.md","kind":"component","path":"grid-rows","slug":"grid-rows","title":"Rows"},{"category":"Grid","description":"Load pages from a server, or render only the visible rows of a large data set.","entryPoint":"grid","file":"docs/grid-server.md","kind":"component","path":"grid-server","slug":"grid-server","title":"Server Binding & Virtualization"},{"category":"Grid","description":"Save and restore the grid's columns, sort, filter, groups and page size, and export rows as CSV, Excel or PDF.","entryPoint":"grid","file":"docs/grid-state-export.md","kind":"component","path":"grid-state-export","slug":"grid-state-export","title":"State & Export"},{"category":"Charts","description":"High-performance Canvas charts composed from series, axes and interaction parts.","entryPoint":"chart","file":"docs/chart.md","kind":"component","path":"chart","slug":"chart","title":"Chart Overview"},{"category":"Charts","description":"Line, area and range area series for values that change across a continuous or category axis.","entryPoint":"chart","file":"docs/chart-line-area.md","kind":"component","path":"chart-line-area","slug":"chart-line-area","title":"Line & Area"},{"category":"Charts","description":"Bar, range bar and waterfall series for comparing values, intervals and running totals.","entryPoint":"chart","file":"docs/chart-bar.md","kind":"component","path":"chart-bar","slug":"chart-bar","title":"Bar & Waterfall"},{"category":"Charts","description":"Scatter and bubble series for the relationship between two or three numeric values.","entryPoint":"chart","file":"docs/chart-scatter.md","kind":"component","path":"chart-scatter","slug":"chart-scatter","title":"Scatter & Bubble"},{"category":"Charts","description":"Candlestick and OHLC series for open, high, low and close prices.","entryPoint":"chart","file":"docs/chart-financial.md","kind":"component","path":"chart-financial","slug":"chart-financial","title":"Financial"},{"category":"Charts","description":"A heatmap series that colors a grid of cells by value, with a color legend.","entryPoint":"chart","file":"docs/chart-heatmap.md","kind":"component","path":"chart-heatmap","slug":"chart-heatmap","title":"Heatmap"},{"category":"Charts","description":"Pie and donut series for the parts of a whole, with slice labels and a donut center.","entryPoint":"chart","file":"docs/chart-pie.md","kind":"component","path":"chart-pie","slug":"chart-pie","title":"Pie & Donut"},{"category":"Charts","description":"A funnel series for stages that narrow, with conversion and drop-off between them.","entryPoint":"chart","file":"docs/chart-funnel.md","kind":"component","path":"chart-funnel","slug":"chart-funnel","title":"Funnel"},{"category":"Charts","description":"A treemap series that tiles hierarchical data by value.","entryPoint":"chart","file":"docs/chart-treemap.md","kind":"component","path":"chart-treemap","slug":"chart-treemap","title":"Treemap"},{"category":"Charts","description":"Radar and polar series on angular and radial axes, for comparing metrics or directions.","entryPoint":"chart","file":"docs/chart-radar.md","kind":"component","path":"chart-radar","slug":"chart-radar","title":"Radar & Polar"},{"category":"Charts","description":"Radial bar, rose and gauge series that draw values as arcs around a center.","entryPoint":"chart","file":"docs/chart-radial.md","kind":"component","path":"chart-radial","slug":"chart-radial","title":"Radial"},{"category":"Charts","description":"A word-sized line, area, column or win-loss chart, for a table cell or a line of text.","entryPoint":"sparkline","file":"docs/sparkline.md","kind":"component","path":"sparkline","slug":"sparkline","title":"Sparkline"},{"category":"Navigation","description":"A navigation trail showing where the current page sits in a hierarchy.","entryPoint":"breadcrumb","file":"docs/breadcrumb.md","kind":"component","path":"breadcrumb","slug":"breadcrumb","title":"Breadcrumb"},{"category":"Navigation","description":"A searchable list of actions or options, operated from one input, inline or in a dialog.","entryPoint":"command","file":"docs/command.md","kind":"component","path":"command","slug":"command","title":"Command Menu"},{"category":"Navigation","description":"A popup menu attached to an element, opened by right-click or keyboard.","entryPoint":"contextmenu","file":"docs/contextmenu.md","kind":"component","path":"contextmenu","slug":"contextmenu","title":"Context Menu"},{"category":"Navigation","description":"A persistent horizontal bar of top-level menus.","entryPoint":"menubar","file":"docs/menubar.md","kind":"component","path":"menubar","slug":"menubar","title":"Menubar"},{"category":"Navigation","description":"Opens a menu from an element you already have, such as an icon button or a row action.","entryPoint":"popup-menu","file":"docs/popup-menu.md","kind":"component","path":"popup-menu","slug":"popup-menu","title":"Popup Menu"},{"category":"Navigation","description":"A composable application shell with collapsible side panels.","entryPoint":"sidebar","file":"docs/sidebar.md","kind":"component","path":"sidebar","slug":"sidebar","title":"Sidebar"},{"category":"Navigation","description":"Groups, menus, rows, submenus, badges, actions and loading rows inside a sidebar.","entryPoint":"sidebar","file":"docs/sidebar-menus.md","kind":"component","path":"sidebar/menus","slug":"sidebar-menus","title":"Sidebar Menus"},{"category":"Navigation","description":"Collapsing, controlled and remembered state, the drawer on small screens, and reading a sidebar from code.","entryPoint":"sidebar","file":"docs/sidebar-state.md","kind":"component","path":"sidebar/state","slug":"sidebar-state","title":"Sidebar State & Behavior"},{"category":"Navigation","description":"Guides users through a sequential, multi-step process.","entryPoint":"stepper","file":"docs/stepper.md","kind":"component","path":"stepper","slug":"stepper","title":"Stepper"},{"category":"Navigation","description":"Switches between panels of related content.","entryPoint":"tabs","file":"docs/tabs.md","kind":"component","path":"tabs","slug":"tabs","title":"Tabs"},{"category":"Overlays","description":"Modal or non-modal messages, confirmations and content dialogs.","entryPoint":"dialog","file":"docs/dialog.md","kind":"component","path":"dialog","slug":"dialog","title":"Dialog"},{"category":"Overlays","description":"A floating panel anchored to a target and opened by a configurable trigger.","entryPoint":"popover","file":"docs/popover.md","kind":"component","path":"popover","slug":"popover","title":"Popover"},{"category":"Overlays","description":"Positions arbitrary content relative to an anchor, a point or the viewport.","entryPoint":"popup","file":"docs/popup.md","kind":"component","path":"popup","slug":"popup","title":"Popup"},{"category":"Overlays","description":"A modal panel attached to an edge of the viewport.","entryPoint":"sheet","file":"docs/sheet.md","kind":"component","path":"sheet","slug":"sheet","title":"Sheet"},{"category":"Overlays","description":"A floating tooltip with projected content, anchored to a separate target.","entryPoint":"tooltip","file":"docs/tooltip.md","kind":"component","path":"tooltip","slug":"tooltip","title":"Tooltip"},{"category":"Overlays","description":"Replaces a native title attribute with a styled tooltip.","entryPoint":"tooltip","file":"docs/tooltip-directive.md","kind":"component","path":"tooltip-directive","slug":"tooltip-directive","title":"Tooltip Directive"},{"category":"Overlays","description":"A draggable, resizable floating window that can be minimized and maximized.","entryPoint":"window","file":"docs/window.md","kind":"component","path":"window","slug":"window","title":"Window"},{"category":"Layout","description":"Groups related content and actions on one raised surface.","entryPoint":"card","file":"docs/card.md","kind":"component","path":"card","slug":"card","title":"Card"},{"category":"Layout","description":"A headless disclosure primitive for expandable regions.","entryPoint":"collapsible","file":"docs/collapsible.md","kind":"component","path":"collapsible","slug":"collapsible","title":"Collapsible"},{"category":"Layout","description":"A header that shows and hides its content, designed to stack with other panels.","entryPoint":"expansion-panel","file":"docs/expansion-panel.md","kind":"component","path":"expansion-panel","slug":"expansion-panel","title":"Expansion Panel"},{"category":"Layout","description":"A fixed-size carousel that pages through a collection one item at a time.","entryPoint":"scroll-view","file":"docs/scroll-view.md","kind":"component","path":"scroll-view","slug":"scroll-view","title":"Scroll View"},{"category":"Layout","description":"A thin line between groups of content, across or down, with an optional label.","entryPoint":"separator","file":"docs/separator.md","kind":"component","path":"separator","slug":"separator","title":"Separator"},{"category":"Layout","description":"Lays out panes in a row or column that can be resized and collapsed.","entryPoint":"splitter","file":"docs/splitter.md","kind":"component","path":"splitter","slug":"splitter","title":"Splitter"},{"category":"Feedback","description":"A message that stays on the page, tinted for what it means, with optional actions and dismissal.","entryPoint":"alert","file":"docs/alert.md","kind":"component","path":"alert","slug":"alert","title":"Alert"},{"category":"Feedback","description":"A circular progress indicator with an optional custom label.","entryPoint":"circular-progress-bar","file":"docs/circular-progress-bar.md","kind":"component","path":"circular-progress-bar","slug":"circular-progress-bar","title":"Circular Progress Bar"},{"category":"Feedback","description":"Transient toast notifications with optional auto-dismiss.","entryPoint":"notification","file":"docs/notification.md","kind":"component","path":"notification","slug":"notification","title":"Notification"},{"category":"Feedback","description":"Fills an empty area with a muted label or projected content.","entryPoint":"placeholder","file":"docs/placeholder.md","kind":"component","path":"placeholder","slug":"placeholder","title":"Placeholder"},{"category":"Feedback","description":"A horizontal progress indicator with determinate and indeterminate modes.","entryPoint":"progress-bar","file":"docs/progress-bar.md","kind":"component","path":"progress-bar","slug":"progress-bar","title":"Progress Bar"},{"category":"Feedback","description":"A decorative placeholder block for content that is still loading.","entryPoint":"skeleton","file":"docs/skeleton.md","kind":"component","path":"skeleton","slug":"skeleton","title":"Skeleton"},{"category":"Feedback","description":"An animated loading indicator and a service for loading overlays.","entryPoint":"spinner","file":"docs/spinner.md","kind":"component","path":"spinner","slug":"spinner","title":"Spinner"}],"schemaVersion":1,"version":"0.43.0"}
@@ -0,0 +1,303 @@
1
+ # Sparkline
2
+
3
+ > A word-sized line, area, column or win-loss chart, for a table cell or a line of text.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/sparkline`
6
+
7
+ **Selector:** `mona-sparkline`
8
+
9
+ `SparklineComponent` draws a series of values as a chart the size of a word, to sit on a line of text or in a table cell: a line, an area, columns or wins and losses. It has no axes, legend or tooltips; it shows a trend at a glance, next to the numbers that give it.
10
+
11
+ Screen readers read it as an image, with its name and a summary of its values: how many, the first, the last, the lowest and the highest.
12
+
13
+ ## Overview
14
+
15
+ Give the sparkline its values and a name. It draws them from left to right, scaled to fill its box, which is 6rem wide and 1.5rem tall unless a class sizes it.
16
+
17
+ **Use Sparkline when:**
18
+
19
+ - A trend matters more than its values: in a table row, a dashboard tile or a sentence.
20
+ - Many small charts should compare at a glance, on one scale.
21
+
22
+ To read values off axes, see a tooltip or interact with the data, use a [chart](chart.md).
23
+
24
+ ## Import & Quick Start
25
+
26
+ ```typescript
27
+ import { SparklineComponent } from "@nanahoshi/mona-ui/sparkline";
28
+ ```
29
+
30
+ ```html
31
+ <mona-sparkline aria-label="Visitors per day" [data]="visitors" />
32
+ ```
33
+
34
+ ```typescript
35
+ protected readonly visitors = [320, 410, 380, 520, 490, 610, 580, 720];
36
+ ```
37
+
38
+ ## Examples
39
+
40
+ ### Line, area, column and win-loss
41
+
42
+ `type` sets how the values are drawn. A column sparkline stands its bars on zero, in the error color below it. A win-loss sparkline draws a bar up for each positive value, down for each negative one, and a short tick for each zero, all of one height.
43
+
44
+ `types-example.component.ts`
45
+
46
+ ```typescript
47
+ import { Component } from "@angular/core";
48
+ import { SparklineComponent } from "@nanahoshi/mona-ui/sparkline";
49
+
50
+ @Component({
51
+ selector: "app-sparkline-types-example",
52
+ imports: [SparklineComponent],
53
+ templateUrl: "./types-example.component.html"
54
+ })
55
+ export class SparklineTypesExampleComponent {
56
+ protected readonly results = [1, 1, -1, 0, 1, -1, -1, 1, 1, 0, 1, 1];
57
+ protected readonly revenueChange = [4, 7, -2, 5, 9, -6, 3, 8, -3, 6];
58
+ protected readonly signUps = [12, 15, 14, 22, 28, 24, 31, 36, 33, 41];
59
+ protected readonly visitors = [320, 410, 380, 520, 490, 610, 580, 720, 690, 840];
60
+ }
61
+ ```
62
+
63
+ `types-example.component.html`
64
+
65
+ ```html
66
+ <dl class="grid max-w-md grid-cols-[8rem_auto] items-center gap-x-6 gap-y-4 text-sm">
67
+ <dt class="text-muted-foreground">Line</dt>
68
+ <dd><mona-sparkline aria-label="Visitors per day" [data]="visitors" /></dd>
69
+
70
+ <dt class="text-muted-foreground">Area</dt>
71
+ <dd><mona-sparkline aria-label="Sign-ups per day" type="area" [data]="signUps" /></dd>
72
+
73
+ <dt class="text-muted-foreground">Column</dt>
74
+ <dd><mona-sparkline aria-label="Change in revenue per month" type="column" [data]="revenueChange" /></dd>
75
+
76
+ <dt class="text-muted-foreground">Win-loss</dt>
77
+ <dd><mona-sparkline aria-label="Results of the last 12 matches" type="win-loss" [data]="results" /></dd>
78
+ </dl>
79
+ ```
80
+
81
+ ### Smooth and stepped lines
82
+
83
+ `curve` sets how a line or an area joins its values, with the same choices as a chart's line series:
84
+
85
+ - `"linear"`, the default, joins them with straight segments.
86
+ - `"monotone-x"` draws a smooth curve that never swings past the values, so none looks higher or lower than it is.
87
+ - `"natural"` is smoother still, but it can overshoot where the values rise and fall sharply.
88
+ - `"step"` changes halfway between values.
89
+ - `"step-after"` holds each value until the next, for something that changes at a moment, such as a price, a plan or a stock level.
90
+
91
+ Columns and win-loss bars ignore it.
92
+
93
+ `curves-example.component.ts`
94
+
95
+ ```typescript
96
+ import { Component } from "@angular/core";
97
+ import { SparklineComponent } from "@nanahoshi/mona-ui/sparkline";
98
+
99
+ @Component({
100
+ selector: "app-sparkline-curves-example",
101
+ imports: [SparklineComponent],
102
+ templateUrl: "./curves-example.component.html"
103
+ })
104
+ export class SparklineCurvesExampleComponent {
105
+ protected readonly orders = [14, 22, 18, 30, 26, 41, 35, 38, 52, 47];
106
+ protected readonly plan = [10, 10, 10, 25, 25, 25, 25, 50, 50, 50];
107
+ }
108
+ ```
109
+
110
+ `curves-example.component.html`
111
+
112
+ ```html
113
+ <dl class="grid max-w-md grid-cols-[8rem_auto] items-center gap-x-6 gap-y-4 text-sm">
114
+ <dt class="text-muted-foreground">Linear</dt>
115
+ <dd><mona-sparkline aria-label="Orders per day" [data]="orders" /></dd>
116
+
117
+ <dt class="text-muted-foreground">Monotone</dt>
118
+ <dd><mona-sparkline aria-label="Orders per day" curve="monotone-x" [data]="orders" /></dd>
119
+
120
+ <dt class="text-muted-foreground">Natural</dt>
121
+ <dd><mona-sparkline aria-label="Orders per day" curve="natural" [data]="orders" /></dd>
122
+
123
+ <dt class="text-muted-foreground">Step</dt>
124
+ <dd><mona-sparkline aria-label="Orders per day" curve="step" type="area" [data]="orders" /></dd>
125
+
126
+ <dt class="text-muted-foreground">Step after</dt>
127
+ <dd><mona-sparkline aria-label="Plan limit per month" curve="step-after" type="area" [data]="plan" /></dd>
128
+ </dl>
129
+ ```
130
+
131
+ ### In a table
132
+
133
+ Give every row's sparkline the same `min` and `max`, and they share a scale, so their heights compare. `markers` puts a dot on the latest week.
134
+
135
+ `table-example.component.ts`
136
+
137
+ ```typescript
138
+ import { Component } from "@angular/core";
139
+ import { SparklineComponent } from "@nanahoshi/mona-ui/sparkline";
140
+
141
+ interface Product {
142
+ readonly name: string;
143
+ readonly total: number;
144
+ readonly weeks: readonly number[];
145
+ }
146
+
147
+ function product(name: string, weeks: readonly number[]): Product {
148
+ return { name, total: weeks.reduce((sum, units) => sum + units, 0), weeks };
149
+ }
150
+
151
+ @Component({
152
+ selector: "app-sparkline-table-example",
153
+ imports: [SparklineComponent],
154
+ templateUrl: "./table-example.component.html"
155
+ })
156
+ export class SparklineTableExampleComponent {
157
+ protected readonly products: readonly Product[] = [
158
+ product("Desk lamp", [42, 38, 45, 51, 48, 56, 61, 58, 66, 72, 69, 78]),
159
+ product("Notebook", [80, 76, 71, 74, 68, 65, 62, 66, 59, 55, 57, 52]),
160
+ product("Water bottle", [20, 24, 31, 45, 62, 70, 74, 69, 51, 38, 29, 24]),
161
+ product("Headphones", [33, 35, 34, 36, 35, 37, 36, 38, 37, 39, 38, 40])
162
+ ];
163
+ /** One scale for every row, so the sparklines compare. */
164
+ protected readonly highest = Math.max(...this.products.flatMap(item => item.weeks));
165
+ }
166
+ ```
167
+
168
+ `table-example.component.html`
169
+
170
+ ```html
171
+ <table class="w-full max-w-lg text-sm">
172
+ <thead class="text-muted-foreground">
173
+ <tr>
174
+ <th scope="col" class="pb-2 text-start font-medium">Product</th>
175
+ <th scope="col" class="pb-2 text-start font-medium">Last 12 weeks</th>
176
+ <th scope="col" class="pb-2 text-end font-medium">Units</th>
177
+ </tr>
178
+ </thead>
179
+ <tbody>
180
+ @for (product of products; track product.name) {
181
+ <tr class="border-t border-border">
182
+ <th scope="row" class="py-2 text-start font-medium">{{ product.name }}</th>
183
+ <td class="py-2">
184
+ <mona-sparkline
185
+ class="w-32"
186
+ [aria-label]="'Weekly units of ' + product.name"
187
+ [data]="product.weeks"
188
+ [markers]="['last']"
189
+ [max]="highest"
190
+ [min]="0" />
191
+ </td>
192
+ <td class="py-2 text-end tabular-nums">{{ product.total }}</td>
193
+ </tr>
194
+ }
195
+ </tbody>
196
+ </table>
197
+ ```
198
+
199
+ ### Markers and a reference line
200
+
201
+ `markers` marks the first, the last, the lowest and the highest values with dots. `referenceValue` draws a dashed line at a target or an average, and the range widens to show it. `color` sets the sparkline's color, and `format` how the summary reads its values.
202
+
203
+ `reference-example.component.ts`
204
+
205
+ ```typescript
206
+ import { Component } from "@angular/core";
207
+ import { SparklineComponent } from "@nanahoshi/mona-ui/sparkline";
208
+
209
+ @Component({
210
+ selector: "app-sparkline-reference-example",
211
+ imports: [SparklineComponent],
212
+ templateUrl: "./reference-example.component.html"
213
+ })
214
+ export class SparklineReferenceExampleComponent {
215
+ protected readonly milliseconds: Intl.NumberFormatOptions = { style: "unit", unit: "millisecond" };
216
+ protected readonly responseTimes = [172, 168, 181, 195, 214, 231, 208, 193, 188, 179, 191, 186];
217
+ }
218
+ ```
219
+
220
+ `reference-example.component.html`
221
+
222
+ ```html
223
+ <div class="flex max-w-md flex-col gap-1 rounded-lg border border-border p-4">
224
+ <span class="text-sm text-muted-foreground">Response time, target 200 ms</span>
225
+ <div class="flex items-center gap-4">
226
+ <span class="text-2xl font-semibold tabular-nums">186 ms</span>
227
+ <mona-sparkline
228
+ aria-label="Response time per hour, against a target of 200 ms"
229
+ class="h-10 w-48"
230
+ color="var(--color-chart-3)"
231
+ type="area"
232
+ [data]="responseTimes"
233
+ [format]="milliseconds"
234
+ [markers]="['min', 'max', 'last']"
235
+ [referenceValue]="200" />
236
+ </div>
237
+ </div>
238
+ ```
239
+
240
+ ## Appearance & Styling
241
+
242
+ The sparkline is an inline block, aligned to the middle of the text around it. Size it with a class, such as `class="h-8 w-40"`.
243
+
244
+ Its colors are custom properties, so a class or a style sheet can set them too:
245
+
246
+ | Custom property | Input | Default | Colors |
247
+ | --- | --- | --- | --- |
248
+ | `--mona-sparkline-color` | `color` | The first chart color, `--color-chart-1` | The line, the area, columns above zero and wins |
249
+ | `--mona-sparkline-negative-color` | `negativeColor` | The error color, `--color-error` | Columns below zero and losses |
250
+
251
+ The line is 1.5 pixels wide and markers are 5 pixels across, whatever the sparkline's size. An area under the line is a wash of its color, with the line carrying the shape. Keep a color you choose at 3:1 against the background, as the default chart colors are. In forced colors, the sparkline is drawn in the system's text color.
252
+
253
+ ## Behavior
254
+
255
+ ### Values and gaps
256
+
257
+ `data` takes the values in order. A `null`, or anything that isn't a finite number, leaves a gap: the line breaks there, and a value alone between gaps shows as a dot. Gaps keep their place, so the values on either side stay where they'd be. A curve joins each run of values between gaps on its own.
258
+
259
+ ### The range
260
+
261
+ Without `min` and `max`, the lowest value is at the bottom and the highest at the top. Columns always take zero into the range, as they stand on it, and so does a reference value. Values outside a range you set are drawn at its edge. When all the values are the same, the line runs across the middle. A `"natural"` curve can swing a little past the lowest and highest values, and out of the box; `"monotone-x"` stays inside it.
262
+
263
+ An area fills down to zero when the values cross it, and to the bottom edge when they're all above it.
264
+
265
+ ### Direction
266
+
267
+ Values run from left to right in right-to-left layouts too, as on a chart's axis.
268
+
269
+ ## Accessibility
270
+
271
+ The sparkline is an image (`role="img"`) to assistive technology. `aria-label` names it, and a summary of its values describes it: "12 values, first 6, last 15, lowest 4, highest 18", or for a win-loss sparkline, "7 wins, 3 losses, 1 draw". Without a name, the summary is its name. `format` sets how the summary formats values, such as a currency, in the locale's number format.
272
+
273
+ When the text beside a sparkline already gives its values, set `decorative` to hide it from assistive technology.
274
+
275
+ The sparkline isn't focusable and has no keyboard interaction.
276
+
277
+ ### ARIA
278
+
279
+ | Attribute | When present | Value |
280
+ | --- | --- | --- |
281
+ | `role` | Unless `decorative` | `"img"` |
282
+ | `aria-label` | Unless `decorative` | The `aria-label` input, or the summary without one |
283
+ | `aria-describedby` | With a name, or `aria-describedby` given | The ids given, then the summary's |
284
+ | `aria-hidden` | `decorative` is set | `"true"` |
285
+
286
+ ## API
287
+
288
+ Everything below is imported from `@nanahoshi/mona-ui/sparkline`. Each name links to its reference page, with every input, output, property and method.
289
+
290
+ | Name | Kind | Description |
291
+ | --- | --- | --- |
292
+ | [`SparklineComponent`](api/sparkline.md#sparklinecomponent) | Component | A word-sized chart of a series of values, to sit on a line of text or in a table cell: a line, an area, columns or wins and losses. |
293
+
294
+ ### Types
295
+
296
+ | Type | Kind | Description |
297
+ | --- | --- | --- |
298
+ | [`SPARKLINE_DEFAULT_MESSAGES`](api/sparkline.md#sparkline-default-messages) | Constant | |
299
+ | [`SparklineCurve`](api/sparkline.md#sparklinecurve) | Type alias | How a line or an area sparkline joins its values, as a chart's line series does: `"linear"` with straight segments, `"monotone-x"` with a smooth curve that never swings past the values, `"natural"` with a smoother curve that can, `"step"` in steps that change halfway between values, and `"step-after"` in steps that hold each value until the next one. |
300
+ | [`SparklineMarker`](api/sparkline.md#sparklinemarker) | Type alias | A value a line or area sparkline marks with a dot: its first, its last, its lowest or its highest. |
301
+ | [`SparklineType`](api/sparkline.md#sparklinetype) | Type alias | How a sparkline draws its values: `"line"` joins them, `"area"` fills under the line, `"column"` draws a bar for each from zero, and `"win-loss"` draws a bar up for each positive value, down for each negative one and a short tick for each zero, all of one height. |
302
+
303
+ **Related types:** [`MonaSparklineMessages`](api/i18n.md#monasparklinemessages)