@motifx-community/ui 0.1.0-beta.5 → 0.1.0-beta.6

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 (270) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +7 -4
  3. package/dist/components/appbar/AppBar.d.ts +88 -0
  4. package/dist/components/appbar/app-bar-navigation-click-event-args.d.ts +9 -0
  5. package/dist/components/appbar/app-bar-navigation.d.ts +2 -0
  6. package/dist/components/appbar/app-bar-position.d.ts +2 -0
  7. package/dist/components/appbar/app-bar-props.d.ts +49 -0
  8. package/dist/components/appbar/app-bar-scroll-behavior.d.ts +2 -0
  9. package/dist/components/appbar/app-bar-title-align.d.ts +2 -0
  10. package/dist/components/appbar/app-bar-tone.d.ts +2 -0
  11. package/dist/components/appbar/index.d.ts +8 -0
  12. package/dist/components/barcode/Barcode.d.ts +62 -0
  13. package/dist/components/barcode/barcode-export-options.d.ts +9 -0
  14. package/dist/components/barcode/barcode-failed-event-args.d.ts +9 -0
  15. package/dist/components/barcode/barcode-props.d.ts +25 -0
  16. package/dist/components/barcode/index.d.ts +5 -0
  17. package/dist/components/bargauge/BarGauge.d.ts +120 -0
  18. package/dist/components/bargauge/bar-gauge-props.d.ts +38 -0
  19. package/dist/components/bargauge/index.d.ts +2 -0
  20. package/dist/components/bottomnavigation/BottomNavigation.d.ts +101 -0
  21. package/dist/components/bottomnavigation/bottom-navigation-item-click-event-args.d.ts +9 -0
  22. package/dist/components/bottomnavigation/bottom-navigation-item.d.ts +35 -0
  23. package/dist/components/bottomnavigation/bottom-navigation-label-mode.d.ts +2 -0
  24. package/dist/components/bottomnavigation/bottom-navigation-position.d.ts +2 -0
  25. package/dist/components/bottomnavigation/bottom-navigation-props.d.ts +31 -0
  26. package/dist/components/bottomnavigation/bottom-navigation-selecting-event-args.d.ts +5 -0
  27. package/dist/components/bottomnavigation/bottom-navigation-selection-changed-event-args.d.ts +11 -0
  28. package/dist/components/bottomnavigation/index.d.ts +8 -0
  29. package/dist/components/chart/Chart.d.ts +229 -0
  30. package/dist/components/chart/ChartLegend.d.ts +24 -0
  31. package/dist/components/chart/ChartPlot.d.ts +161 -0
  32. package/dist/components/chart/ChartTable.d.ts +68 -0
  33. package/dist/components/chart/ChartTooltip.d.ts +22 -0
  34. package/dist/components/chart/PartsPlot.d.ts +39 -0
  35. package/dist/components/chart/RadarPlot.d.ts +34 -0
  36. package/dist/components/chart/chart-axis-kind.d.ts +2 -0
  37. package/dist/components/chart/chart-axis.d.ts +31 -0
  38. package/dist/components/chart/chart-data-error-event-args.d.ts +7 -0
  39. package/dist/components/chart/chart-export-options.d.ts +7 -0
  40. package/dist/components/chart/chart-export.d.ts +12 -0
  41. package/dist/components/chart/chart-field.d.ts +2 -0
  42. package/dist/components/chart/chart-labels.d.ts +2 -0
  43. package/dist/components/chart/chart-legend-options.d.ts +10 -0
  44. package/dist/components/chart/chart-legend-position.d.ts +2 -0
  45. package/dist/components/chart/chart-look.d.ts +25 -0
  46. package/dist/components/chart/chart-mode-changed-event-args.d.ts +7 -0
  47. package/dist/components/chart/chart-mode.d.ts +2 -0
  48. package/dist/components/chart/chart-model.d.ts +105 -0
  49. package/dist/components/chart/chart-point-event-args.d.ts +9 -0
  50. package/dist/components/chart/chart-point-selection.d.ts +2 -0
  51. package/dist/components/chart/chart-point.d.ts +23 -0
  52. package/dist/components/chart/chart-props.d.ts +76 -0
  53. package/dist/components/chart/chart-reference.d.ts +12 -0
  54. package/dist/components/chart/chart-selection-changed-event-args.d.ts +8 -0
  55. package/dist/components/chart/chart-series-toggled-event-args.d.ts +10 -0
  56. package/dist/components/chart/chart-series-type.d.ts +6 -0
  57. package/dist/components/chart/chart-series.d.ts +55 -0
  58. package/dist/components/chart/chart-stacked.d.ts +2 -0
  59. package/dist/components/chart/chart-tooltip-context.d.ts +10 -0
  60. package/dist/components/chart/chart-tooltip-options.d.ts +10 -0
  61. package/dist/components/chart/chart-zoom-changed-event-args.d.ts +8 -0
  62. package/dist/components/chart/index.d.ts +21 -0
  63. package/dist/components/chart/legend-entry.d.ts +13 -0
  64. package/dist/components/chart/plot-text.d.ts +10 -0
  65. package/dist/components/chart/plot-view.d.ts +61 -0
  66. package/dist/components/datagrid/grid-settings.d.ts +3 -3
  67. package/dist/components/datagrid/model/GridData.d.ts +22 -3
  68. package/dist/components/gauge/Gauge.d.ts +179 -0
  69. package/dist/components/gauge/gauge-mark.d.ts +9 -0
  70. package/dist/components/gauge/gauge-marker.d.ts +2 -0
  71. package/dist/components/gauge/gauge-needle-shape.d.ts +2 -0
  72. package/dist/components/gauge/gauge-orientation.d.ts +2 -0
  73. package/dist/components/gauge/gauge-props.d.ts +58 -0
  74. package/dist/components/gauge/gauge-range.d.ts +11 -0
  75. package/dist/components/gauge/gauge-scale.d.ts +2 -0
  76. package/dist/components/gauge/gauge-shape.d.ts +43 -0
  77. package/dist/components/gauge/gauge-type.d.ts +2 -0
  78. package/dist/components/gauge/index.d.ts +9 -0
  79. package/dist/components/otpinput/OtpInput.d.ts +73 -0
  80. package/dist/components/otpinput/index.d.ts +4 -0
  81. package/dist/components/otpinput/otp-charset.d.ts +2 -0
  82. package/dist/components/otpinput/otp-completed-event-args.d.ts +8 -0
  83. package/dist/components/otpinput/otp-input-props.d.ts +32 -0
  84. package/dist/components/qrcode/QRCode.d.ts +58 -0
  85. package/dist/components/qrcode/index.d.ts +5 -0
  86. package/dist/components/qrcode/qr-code-export-options.d.ts +9 -0
  87. package/dist/components/qrcode/qr-code-failed-event-args.d.ts +7 -0
  88. package/dist/components/qrcode/qr-code-props.d.ts +23 -0
  89. package/dist/components/signature/Signature.d.ts +100 -0
  90. package/dist/components/signature/index.d.ts +5 -0
  91. package/dist/components/signature/signature-draw.d.ts +15 -0
  92. package/dist/components/signature/signature-export-options.d.ts +11 -0
  93. package/dist/components/signature/signature-props.d.ts +30 -0
  94. package/dist/components/signature/signature-stroke-event-args.d.ts +9 -0
  95. package/dist/components/signature/signature-stroke.d.ts +11 -0
  96. package/dist/components/sparkline/Sparkline.d.ts +85 -0
  97. package/dist/components/sparkline/index.d.ts +4 -0
  98. package/dist/components/sparkline/sparkline-highlight.d.ts +2 -0
  99. package/dist/components/sparkline/sparkline-props.d.ts +34 -0
  100. package/dist/components/sparkline/sparkline-type.d.ts +2 -0
  101. package/dist/components/validationsummary/ValidationSummary.d.ts +1 -0
  102. package/dist/core/fonts-loaded.d.ts +2 -0
  103. package/dist/core/scroll-watch.d.ts +13 -0
  104. package/dist/core/ui-strings.d.ts +38 -0
  105. package/dist/generated/tokens.d.ts +3023 -863
  106. package/dist/index.d.ts +10 -0
  107. package/dist/index.js +55999 -47313
  108. package/dist/index.js.map +1 -1
  109. package/dist/locales/en.json +37 -1
  110. package/dist/locales/tr.json +37 -1
  111. package/dist/parts/chart/chart-paths.d.ts +30 -0
  112. package/dist/parts/chart/chart-scale.d.ts +13 -0
  113. package/dist/parts/chart/chart-text.d.ts +12 -0
  114. package/dist/parts/chart/nice-ticks.d.ts +6 -0
  115. package/dist/parts/chart/svg-parts.d.ts +12 -0
  116. package/dist/parts/chart/thin-out.d.ts +6 -0
  117. package/dist/parts/chart/time-ticks.d.ts +7 -0
  118. package/dist/parts/chart/token-lengths.d.ts +16 -0
  119. package/dist/parts/chart/value-motion.d.ts +16 -0
  120. package/dist/parts/code/barcode-encode.d.ts +23 -0
  121. package/dist/parts/code/code-image.d.ts +35 -0
  122. package/dist/parts/code/qr-encode.d.ts +10 -0
  123. package/dist/parts/field/Field.d.ts +2 -0
  124. package/dist/styles.css +3043 -9
  125. package/dist/tokens/index.d.ts +3212 -967
  126. package/dist/tokens/index.js +3023 -863
  127. package/dist/tokens/index.js.map +1 -1
  128. package/dist/{tr-C5IXRzAH.js → tr-DhIFcH3c.js} +75 -3
  129. package/dist/{tr-C5IXRzAH.js.map → tr-DhIFcH3c.js.map} +1 -1
  130. package/docs/accordion.md +1 -1
  131. package/docs/actionsheet.md +1 -1
  132. package/docs/appbar.md +194 -0
  133. package/docs/avatar.md +1 -1
  134. package/docs/badge.md +1 -1
  135. package/docs/bar-gauge-angles.md +87 -0
  136. package/docs/bar-gauge-data.md +122 -0
  137. package/docs/bar-gauge-labels.md +78 -0
  138. package/docs/bar-gauge.md +98 -0
  139. package/docs/barcode.md +193 -0
  140. package/docs/bottomnavigation.md +258 -0
  141. package/docs/bottomsheet.md +1 -1
  142. package/docs/breadcrumb.md +1 -1
  143. package/docs/button.md +1 -1
  144. package/docs/buttongroup.md +1 -1
  145. package/docs/buttons.md +169 -0
  146. package/docs/calendar.md +1 -1
  147. package/docs/card.md +1 -1
  148. package/docs/chart-bars.md +142 -0
  149. package/docs/chart-candles.md +164 -0
  150. package/docs/chart-funnel.md +115 -0
  151. package/docs/chart-heatmap.md +93 -0
  152. package/docs/chart-lines.md +128 -0
  153. package/docs/chart-live.md +62 -0
  154. package/docs/chart-pie.md +125 -0
  155. package/docs/chart-radar.md +124 -0
  156. package/docs/chart-ranges.md +127 -0
  157. package/docs/chart-references.md +126 -0
  158. package/docs/chart-scatter.md +139 -0
  159. package/docs/chart-waterfall.md +111 -0
  160. package/docs/chart-zoom.md +95 -0
  161. package/docs/chart.md +427 -0
  162. package/docs/checkbox.md +1 -1
  163. package/docs/chip.md +1 -1
  164. package/docs/choice.md +151 -0
  165. package/docs/colorbox.md +1 -1
  166. package/docs/combobox.md +1 -1
  167. package/docs/control.md +1 -1
  168. package/docs/data.md +127 -0
  169. package/docs/datagrid-api.md +1 -1
  170. package/docs/datagrid-bands.md +1 -1
  171. package/docs/datagrid-drag-select.md +1 -1
  172. package/docs/datagrid-drag.md +1 -1
  173. package/docs/datagrid-editing.md +1 -1
  174. package/docs/datagrid-filtering.md +1 -1
  175. package/docs/datagrid-forms.md +1 -1
  176. package/docs/datagrid-grouping.md +62 -2
  177. package/docs/datagrid-layout.md +2 -2
  178. package/docs/datagrid-lookups.md +1 -1
  179. package/docs/datagrid-master-detail.md +1 -1
  180. package/docs/datagrid-scrolling.md +1 -1
  181. package/docs/datagrid-selection.md +1 -1
  182. package/docs/datagrid.md +1 -1
  183. package/docs/datebox.md +1 -1
  184. package/docs/daterangebox.md +1 -1
  185. package/docs/display.md +148 -0
  186. package/docs/draggable.md +1 -1
  187. package/docs/drawer.md +1 -1
  188. package/docs/dropdown.md +1 -1
  189. package/docs/editors.md +157 -0
  190. package/docs/feedback.md +138 -0
  191. package/docs/fileuploader.md +1 -1
  192. package/docs/filterbuilder.md +1 -1
  193. package/docs/formlayout.md +1 -1
  194. package/docs/foundations.md +79 -0
  195. package/docs/gallery.md +1 -1
  196. package/docs/gauge-base.md +78 -0
  197. package/docs/gauge-circular.md +101 -0
  198. package/docs/gauge-dashboards.md +134 -0
  199. package/docs/gauge-linear.md +84 -0
  200. package/docs/gauge-markers.md +135 -0
  201. package/docs/gauge-marks.md +108 -0
  202. package/docs/gauge-ranges.md +133 -0
  203. package/docs/gauge-scales.md +117 -0
  204. package/docs/gauge.md +152 -0
  205. package/docs/home.md +1 -1
  206. package/docs/keyboard.md +1 -1
  207. package/docs/language.md +1 -1
  208. package/docs/layout.md +1 -1
  209. package/docs/listbox.md +1 -1
  210. package/docs/loadpanel.md +1 -1
  211. package/docs/lookup.md +1 -1
  212. package/docs/menus.md +1 -1
  213. package/docs/multiview.md +1 -1
  214. package/docs/navigation.md +143 -0
  215. package/docs/numberbox.md +1 -1
  216. package/docs/otpinput.md +197 -0
  217. package/docs/pagination.md +1 -1
  218. package/docs/popover.md +1 -1
  219. package/docs/progress.md +1 -1
  220. package/docs/qrcode.md +179 -0
  221. package/docs/radiogroup.md +1 -1
  222. package/docs/rating.md +1 -1
  223. package/docs/resizable.md +1 -1
  224. package/docs/scheduler-agenda.md +1 -1
  225. package/docs/scheduler-big-data.md +1 -1
  226. package/docs/scheduler-editing.md +1 -1
  227. package/docs/scheduler-form.md +1 -1
  228. package/docs/scheduler-icalendar.md +1 -1
  229. package/docs/scheduler-mobile.md +1 -1
  230. package/docs/scheduler-recurrence.md +1 -1
  231. package/docs/scheduler-resources.md +1 -1
  232. package/docs/scheduler-timeline.md +1 -1
  233. package/docs/scheduler.md +1 -1
  234. package/docs/scrollview.md +1 -1
  235. package/docs/showcase-home.md +31 -0
  236. package/docs/showcase.md +1 -1
  237. package/docs/signature.md +208 -0
  238. package/docs/skeleton.md +1 -1
  239. package/docs/slider.md +1 -1
  240. package/docs/sortable.md +1 -1
  241. package/docs/sparkline.md +119 -0
  242. package/docs/speeddial.md +1 -1
  243. package/docs/splitter.md +1 -1
  244. package/docs/stepper.md +1 -1
  245. package/docs/switch.md +1 -1
  246. package/docs/tabdocs-dock.md +1 -1
  247. package/docs/tabdocs-drag.md +1 -1
  248. package/docs/tabdocs-menus.md +1 -1
  249. package/docs/tabdocs-mobile.md +1 -1
  250. package/docs/tabdocs-tabs.md +1 -1
  251. package/docs/tabdocs-windows.md +1 -1
  252. package/docs/tabdocs-workspace.md +1 -1
  253. package/docs/tabdocs.md +1 -1
  254. package/docs/tabs.md +1 -1
  255. package/docs/tagbox.md +1 -1
  256. package/docs/textarea.md +1 -1
  257. package/docs/textbox.md +1 -1
  258. package/docs/tileview.md +1 -1
  259. package/docs/timeline.md +1 -1
  260. package/docs/toast.md +1 -1
  261. package/docs/tokens.md +450 -1
  262. package/docs/toolbar.md +1 -1
  263. package/docs/tooltip.md +1 -1
  264. package/docs/treeview.md +1 -1
  265. package/docs/validationsummary.md +1 -1
  266. package/docs/window.md +1 -1
  267. package/docs/wizard.md +1 -1
  268. package/llms-full.txt +6724 -98
  269. package/llms.txt +50 -1
  270. package/package.json +5 -5
@@ -0,0 +1,95 @@
1
+ # Chart: Zoom and large data
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.6
4
+
5
+ Large data stays quick: long lines are thinned to the width with their peaks kept, and the reader zooms in for detail.
6
+
7
+ ## Zooming into large data
8
+
9
+ `zoom` lets the reader drag across the plot to zoom in, use Ctrl and the wheel to zoom around the pointer, Shift and the wheel to move along, and + and - with the keyboard. A button in the title row shows all of it again, and the value axis fits what is in view. `zoomTo()` and `resetZoom()` do the same programmatically.
10
+
11
+ ```tsx
12
+ import { reactive } from '@motifx/core';
13
+ import { Chart, Stack } from '@motifx-community/ui';
14
+
15
+ const MINUTE = 60 * 1000;
16
+ const START = new Date(2026, 9, 1).getTime();
17
+ // A sensor read every minute for about ten weeks: 100,000 values.
18
+ const READINGS = Array.from({ length: 100000 }, (_, i) => ({ time: new Date(START + i * MINUTE), load: Math.round(50 + 20 * Math.sin(i / 1440 * Math.PI * 2) + 8 * Math.sin(i / 97) + (i % 8191 === 0 ? 30 : 0)) }));
19
+
20
+ /** Drag across the plot to zoom in, Ctrl and the wheel zoom around the pointer, Shift and the wheel move along. The line is thinned to the width, and its peaks stay. */
21
+ export default function Zoom() {
22
+ const s = reactive({ seen: 'All of it' });
23
+ const time = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'short' });
24
+ return (
25
+ <Stack class="docs-wide" gap="sm">
26
+ <Chart
27
+ class="ch-zoom"
28
+ title="Server load"
29
+ subtitle="100,000 readings, one a minute"
30
+ data={READINGS}
31
+ xField="time"
32
+ zoom
33
+ yAxis={{ format: { style: 'unit', unit: 'percent' } }}
34
+ series={[{ type: 'area', yField: 'load', name: 'Load' }]}
35
+ onZoomChanged={(e) => (s.seen = e.from ? `${time.format(e.from as Date)} to ${time.format(e.to as Date)}` : 'All of it')}
36
+ />
37
+ <output class="ch-zoom-told">{() => s.seen}</output>
38
+ </Stack>
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Zooming categories
44
+
45
+ Zoom works on a category axis too. `zoomTo()` takes the first and last category to show, as they are written in the rows.
46
+
47
+ ```tsx
48
+ import { reactive } from '@motifx/core';
49
+ import { ButtonGroup, Chart, Stack } from '@motifx-community/ui';
50
+
51
+ const WEEKS = Array.from({ length: 52 }, (_, i) => ({ week: `W${i + 1}`, orders: Math.round(300 + Math.sin(i / 8) * 90 + (i > 46 ? 160 : 0) + ((i * 13) % 7) * 12) }));
52
+
53
+ /** Zoom works on categories too: the buttons call `zoomTo` with the names of the first and last week to show. */
54
+ export default function ZoomWeeks() {
55
+ const s = reactive({ part: 'all' });
56
+ let chart!: Chart;
57
+ let moving = false;
58
+ const show = (part: string) => {
59
+ moving = true;
60
+ if (part === 'first') chart.zoomTo('W1', 'W26');
61
+ else if (part === 'last') chart.zoomTo('W41', 'W52');
62
+ else chart.resetZoom();
63
+ moving = false;
64
+ };
65
+ return (
66
+ <Stack class="docs-wide" gap="md">
67
+ <ButtonGroup
68
+ label="Weeks"
69
+ x-model={() => s.part}
70
+ onValueChanged={e => e.byUser && show(e.value as string)}
71
+ items={[
72
+ { value: 'first', text: 'First half' },
73
+ { value: 'last', text: 'Last 12 weeks' },
74
+ { value: 'all', text: 'All' }
75
+ ]}
76
+ />
77
+ <Chart
78
+ ref={(x: Chart) => (chart = x)}
79
+ class="ch-zoom-weeks"
80
+ title="Orders by week"
81
+ data={WEEKS}
82
+ xField="week"
83
+ zoom
84
+ legend={false}
85
+ series={[{ type: 'bar', yField: 'orders', name: 'Orders' }]}
86
+ onZoomChanged={e => !moving && (s.part = e.from ? '' : 'all')}
87
+ />
88
+ </Stack>
89
+ );
90
+ }
91
+ ```
92
+
93
+ ## Feedback
94
+
95
+ Loading issues…
package/docs/chart.md ADDED
@@ -0,0 +1,427 @@
1
+ # Chart
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.6
4
+
5
+ Displays lines, areas, bars, scatter points and bubbles on a shared value axis. The chart has no dependencies, takes its appearance from the design language, and makes every value available through the keyboard and a table view.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { Chart } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Binding rows
14
+
15
+ `data` holds the rows, `xField` sets the position of each row along the axis, and each item of `series` selects a field and how it is drawn. A chart with one series shows no legend, because its title identifies the series.
16
+
17
+ ```tsx
18
+ /** Twelve months of made-up figures, shared by the examples. */
19
+ export const SALES = [
20
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
21
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
22
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
23
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
24
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
25
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
26
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
27
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
28
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
29
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
30
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
31
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
32
+ ];
33
+ ```
34
+
35
+ ## Kinds of charts
36
+
37
+ A series says how it draws with `type`, and a chart draws the family of its first series. Each kind has its own page.
38
+
39
+ | Page | Types | Shows |
40
+ | --- | --- | --- |
41
+ | `[Lines and areas](chart-lines.md)` | `line`, `area` | Change along an axis, over time or across categories. |
42
+ | `[Bars](chart-bars.md)` | `bar` | Amounts compared on a common baseline, side by side or stacked. |
43
+ | `[Scatter and bubble](chart-scatter.md)` | `scatter`, `bubble` | How two numbers relate, with a third as the size. |
44
+ | `[Pie and donut](chart-pie.md)` | `pie`, `donut` | The parts of one whole, at a glance. |
45
+ | `[Funnel](chart-funnel.md)` | `funnel` | A quantity through stages in order. |
46
+ | `[Radar](chart-radar.md)` | `radar` | Several measures at once, around a center. |
47
+ | `[Heat map](chart-heatmap.md)` | `heatmap` | A value for each pair of two categories, as a color. |
48
+ | `[Ranges](chart-ranges.md)` | `rangeArea`, `rangeBar` | A low and a high value for each position. |
49
+ | `[Candles](chart-candles.md)` | `candlestick`, `ohlc` | Four prices for each position. |
50
+ | `[Waterfall](chart-waterfall.md)` | `waterfall` | A start becoming an end through changes. |
51
+
52
+ | Page | For |
53
+ | --- | --- |
54
+ | `[Zoom and large data](chart-zoom.md)` | Hundreds of thousands of values, zoomed in by a drag, the wheel or the keys. |
55
+ | `[Live data](chart-live.md)` | Reactive values and a moving window over the latest ones. |
56
+ | `[References and selection](chart-references.md)` | Targets, limits and periods, and values chosen by a click. |
57
+ | `[Sparkline](sparkline.md)` | A chart the size of a word, in text and in tables. |
58
+ | `[Gauge](gauge.md)` | A value against its scale, on an arc or a bar, with ticks, markers and marks. |
59
+ | `[BarGauge](bar-gauge.md)` | Several values against one scale, as bars bent round one middle. |
60
+
61
+ ## Data sources
62
+
63
+ `dataSource` reads rows from any adapter of the data layer. While rows load, the current chart stays in place at reduced opacity.
64
+
65
+ ```tsx
66
+ /** Twelve months of made-up figures, shared by the examples. */
67
+ export const SALES = [
68
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
69
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
70
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
71
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
72
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
73
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
74
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
75
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
76
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
77
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
78
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
79
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
80
+ ];
81
+ ```
82
+
83
+ ## Empty and loading states
84
+
85
+ A chart without values displays a message, which `emptyText` sets. `loading` keeps the current chart in place at reduced opacity, so that the layout does not shift while new values arrive.
86
+
87
+ ```tsx
88
+ /** Twelve months of made-up figures, shared by the examples. */
89
+ export const SALES = [
90
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
91
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
92
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
93
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
94
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
95
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
96
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
97
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
98
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
99
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
100
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
101
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
102
+ ];
103
+ ```
104
+
105
+ ## Creating an image
106
+
107
+ `toDataURL()` and `toSVG()` return an image that includes the title and the legend. A browser cannot use the page's fonts inside an image, so a system font replaces them.
108
+
109
+ ```tsx
110
+ /** Twelve months of made-up figures, shared by the examples. */
111
+ export const SALES = [
112
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
113
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
114
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
115
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
116
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
117
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
118
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
119
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
120
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
121
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
122
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
123
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
124
+ ];
125
+ ```
126
+
127
+ ## Programmatic use
128
+
129
+ `new Chart(props)` creates the chart without JSX. Each prop is also a property.
130
+
131
+ ```tsx
132
+ /** Twelve months of made-up figures, shared by the examples. */
133
+ export const SALES = [
134
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
135
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
136
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
137
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
138
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
139
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
140
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
141
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
142
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
143
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
144
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
145
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
146
+ ];
147
+ ```
148
+
149
+ ## API reference
150
+
151
+ ### Props
152
+
153
+ | Prop | Type | Default | Description |
154
+ | --- | --- | --- | --- |
155
+ | `data` | `Bind<T[] \| null>` | `null` | The rows. The chart reads them and never changes them. After an in-place change, call `refresh()`. |
156
+ | `dataSource` | `Bind<DataSource \| null>` | `null` | Rows from a data source of the data layer. The chart follows its changes and its loading state. |
157
+ | `xField` | `Bind<string \| (row) => unknown>` | `null` | The field of a row that holds its position along the axis. |
158
+ | `series` | `Bind<ChartSeries[]>` | `[]` | The series to draw. See the Series table. |
159
+ | `horizontal` | `Bind<boolean>` | `false` | Draws the chart horizontally, with categories down the page and values across it. |
160
+ | `stacked` | `Bind<false \| 'normal' \| 'percent'>` | `false` | Stacks bars and areas, as values or as percentages. |
161
+ | `title` | `Bind<string>` | `''` | The title above the chart. |
162
+ | `subtitle` | `Bind<string>` | `''` | A line under the title. |
163
+ | `label` | `Bind<string>` | The title | The accessible name. |
164
+ | `xAxis` | `Bind<ChartAxis>` | `{}` | The position axis. See the Axes table. |
165
+ | `yAxis` | `Bind<ChartAxis>` | `{}` | The value axis. See the Axes table. |
166
+ | `legend` | `Bind<boolean \| ChartLegendOptions>` | On with two series or more | The legend, its `position`, and whether a click hides a series (`toggle`). |
167
+ | `tooltip` | `Bind<boolean \| ChartTooltipOptions>` | On | The tooltip, whether it lists every series (`shared`), and custom content (`format`). |
168
+ | `crosshair` | `Bind<boolean>` | `true` | A line that follows the pointer on line and area series. |
169
+ | `height` | `Bind<number \| null>` | From the design language | The height in pixels, including the title and the legend. |
170
+ | `animation` | `Bind<boolean>` | `true` | Animates the marks when they first appear. |
171
+ | `tableButton` | `Bind<boolean>` | `true` | Shows a button that switches between the chart and its table view. |
172
+ | `mode` | `Bind<'chart' \| 'table'>` | `'chart'` | Shows the chart or its table view. Supports `x-model`. |
173
+ | `zoom` | `Bind<boolean>` | `false` | Lets the reader zoom in on positions: a drag, Ctrl and the wheel, + and -. |
174
+ | `references` | `Bind<ChartReference[]>` | `[]` | Lines and bands across the plot: `axis`, `value` or `from` and `to`, and `label`. |
175
+ | `pointSelection` | `Bind<'none' \| 'single' \| 'multiple'>` | `'none'` | Whether a click or Enter chooses values. |
176
+ | `emptyText` | `Bind<string>` | A kit string | The text shown when there is nothing to draw. |
177
+ | `loading` | `Bind<boolean>` | `false` | Keeps the current chart at reduced opacity while new values load. |
178
+
179
+ ### Series
180
+
181
+ | Field | Type | Default | Description |
182
+ | --- | --- | --- | --- |
183
+ | `yField` | `string \| (row) => unknown` | Required | The field that holds the value. |
184
+ | `type` | `ChartSeriesType` | `'line'` | How the series is drawn: `line`, `area`, `bar`, `scatter`, `bubble`, `rangeArea`, `rangeBar`, `candlestick`, `ohlc`, `waterfall`, `heatmap`, `pie`, `donut`, `funnel` or `radar`. A chart draws the family of its first series. |
185
+ | `name` | `string` | `yField` | The name in the legend, the tooltip and the table view. |
186
+ | `xField` | `string \| (row) => unknown` | The chart's | The position, for a series with its own values. |
187
+ | `sizeField` | `string \| (row) => unknown` | | The size of a bubble. |
188
+ | `lowField, highField` | `string \| (row) => unknown` | | The ends of a range, and the lowest and highest price of a candle. |
189
+ | `openField, closeField` | `string \| (row) => unknown` | | The first and the last price of a candle. |
190
+ | `valueField` | `string \| (row) => unknown` | | The value a heat map shows as a color. |
191
+ | `totalField` | `string \| (row) => unknown` | | A row of a waterfall that shows the total so far. |
192
+ | `innerRadius` | `number` | From the design language | The hole of a donut, as a share of its radius. |
193
+ | `startAngle` | `number` | `0` | Where the first slice starts, in degrees from the top, clockwise. |
194
+ | `data` | `T[]` | The chart's rows | The rows of this series. |
195
+ | `color` | `string` | The color of its position in `series` | A custom color. |
196
+ | `stack` | `string \| boolean` | The chart's `stacked` | Series with the same name stack on each other. |
197
+ | `visible` | `boolean` | `true` | Draws the series. |
198
+ | `legend` | `boolean` | `true` | Lists the series in the legend. |
199
+ | `tooltip` | `boolean` | `true` | Lists the series in the tooltip. |
200
+ | `smooth` | `boolean` | `false` | Curves the line without passing the values it connects. |
201
+ | `step` | `'start' \| 'middle' \| 'end'` | | Draws a stepped line, and sets where the value changes. |
202
+ | `markers` | `boolean` | `false` | Marks each value on a line. |
203
+ | `labels` | `'none' \| 'last' \| 'extremes' \| 'all'` | `'none'` | The values that show a label. A label that does not fit is omitted. |
204
+ | `gaps` | `'break' \| 'connect' \| 'zero'` | `'break'` | How a line treats a missing value. |
205
+ | `format` | `ChartFormat` | The value axis's | How values are displayed: a function, or options of the browser's number format. |
206
+
207
+ ### Axes
208
+
209
+ | Field | Type | Default | Description |
210
+ | --- | --- | --- | --- |
211
+ | `kind` | `'auto' \| 'category' \| 'linear' \| 'log' \| 'time'` | `'auto'` | How the axis places its values. |
212
+ | `title` | `string` | | A title along the axis. |
213
+ | `min, max` | `number \| Date` | From the values | The first and the last value. |
214
+ | `format` | `ChartFormat` | The language of the page | How values are displayed: a function, or options of the browser's formats. |
215
+ | `tickCount` | `number` | As many as fit | The approximate number of values it marks. |
216
+ | `labelAngle` | `number` | `0` | Rotates the labels by this many degrees, for long labels. |
217
+ | `reversed` | `boolean` | `false` | Reverses the direction of the axis. |
218
+ | `labels` | `boolean` | `true` | Shows the labels. |
219
+ | `grid` | `boolean` | On the value axis | Draws grid lines. |
220
+ | `line` | `boolean` | On the category axis | Draws the line of the axis. |
221
+ | `span` | `number` | | Shows only the latest stretch of positions: a time in milliseconds, a number, or a count of categories. |
222
+ | `visible` | `boolean` | `true` | Shows the axis. |
223
+
224
+ ### Properties and methods
225
+
226
+ | Member | Type | Description |
227
+ | --- | --- | --- |
228
+ | `refresh()` | `void` | Redraws the chart from the current rows and series, after an in-place change. |
229
+ | `setSeriesVisible(index, visible)` | `void` | Hides or shows a series, by its index in `series`. |
230
+ | `isSeriesVisible(index)` | `boolean` | Indicates whether a series is drawn. |
231
+ | `zoomTo(from, to)` | `void` | Shows the positions from one to another, given as in the rows. |
232
+ | `resetZoom()` | `void` | Shows every position again. |
233
+ | `selectedPoints` | `ChartPoint[]` | The values chosen now. |
234
+ | `clearSelection()` | `void` | Chooses nothing. |
235
+ | `toSVG(options?)` | `string` | Returns the chart as an SVG document, with its title and legend. |
236
+ | `toDataURL(type?, options?)` | `Promise<string>` | Returns the chart as a data URL, a PNG by default. |
237
+
238
+ ### Image options
239
+
240
+ | Prop | Type | Default | Description |
241
+ | --- | --- | --- | --- |
242
+ | `scale` | `number` | `2` | The pixel scale of a PNG. |
243
+ | `background` | `string` | The color behind the chart | The background. |
244
+
245
+ ### Events
246
+
247
+ | Event | Type | Description |
248
+ | --- | --- | --- |
249
+ | `onPointClick` | `{ point, originalEvent, source }` | Occurs when a value is clicked, or chosen with Enter or Space. |
250
+ | `onPointFocused` | `{ point, originalEvent, source }` | Occurs when the pointer or the keyboard reaches a value. |
251
+ | `onSeriesToggled` | `{ series, visible, source }` | Occurs when a series is hidden or shown in the legend. |
252
+ | `onModeChanged` | `{ mode, source }` | Occurs when the chart or its table view appears. |
253
+ | `onZoomChanged` | `{ from, to, source }` | Occurs when the positions in view change; both are null when all of them are in view again. |
254
+ | `onSelectionChanged` | `{ points, source }` | Occurs when values are chosen or let go. |
255
+ | `onDataError` | `{ error, source }` | Occurs when the data source fails to load. The chart also displays a message. |
256
+
257
+ ### Keyboard
258
+
259
+ | Key | Action |
260
+ | --- | --- |
261
+ | `Arrow keys` | Move between positions along the axis, and between the series at a position across it. |
262
+ | `Home, End` | Move to the first or the last position. |
263
+ | `Enter, Space` | Raise `onPointClick` for the current value. |
264
+ | `+, -, 0` | With `zoom`: zoom in and out around the value, and show all of it again. |
265
+ | `Escape` | Hides the current value. |
266
+
267
+ ### Accessibility
268
+
269
+ | Topic | Details |
270
+ | --- | --- |
271
+ | `Values` | Every value is available without a pointer. The arrow keys move through the chart, and a screen reader announces each value. |
272
+ | `Table` | The button in the title row shows the same values in a table. Keep it unless the values also appear on the page. |
273
+ | `Color` | Neighboring series stay distinct for color-blind readers, which each build verifies. The legend and its keys also identify the series, so color is never the only cue. |
274
+ | `Motion` | The marks appear immediately when the reader prefers reduced motion. |
275
+ | `Name` | Provide a `title` or a `label` to name the chart. |
276
+
277
+ ### Styling hooks
278
+
279
+ | Hook | Description |
280
+ | --- | --- |
281
+ | `.mx-chart` | The chart. `data-mode` and `data-legend` describe what it shows, and `data-loading` indicates that it is loading. |
282
+ | `.mx-chart__head, .mx-chart__title, .mx-chart__subtitle` | The title row. |
283
+ | `.mx-chart__plot, .mx-chart__svg` | The plot. |
284
+ | `.mx-chart__series` | A series, with `data-type`. `--_mark` holds its color. |
285
+ | `.mx-chart__legend, .mx-chart__legend-item` | The legend. `data-off` marks a hidden series. |
286
+ | `.mx-chart__tooltip` | The tooltip. |
287
+ | `.mx-chart__table` | The table view. |
288
+
289
+ ### Design tokens
290
+
291
+ | Token | Description |
292
+ | --- | --- |
293
+ | `chart.height` | The height, including the title and the legend. |
294
+ | `chart.series-1 … series-8` | The colors of the series, from `color.chart.*` of the design system. |
295
+ | `chart.bar-width, .bar-radius, .bar-gap` | The maximum bar width, its end corners, and the gap between bars. |
296
+ | `chart.line-width, .marker-size, .marker-ring` | Lines and markers, and the ring that separates a marker from what it crosses. |
297
+ | `chart.area-opacity, .bubble-opacity` | The fill strength of areas and bubbles. |
298
+ | `chart.title, .subtitle, .ticks, .grid, .axis` | Units of the title row and the axes. |
299
+ | `chart.tooltip, .tooltip-row, .tooltip-value` | Units of the tooltip. |
300
+ | `chart.legend-item, .legend-key` | Units of the legend. |
301
+
302
+ ## Feedback
303
+
304
+ Loading issues…
305
+
306
+ ## Example files
307
+
308
+ `Basic.tsx`
309
+
310
+ ```tsx
311
+ import { Chart } from '@motifx-community/ui';
312
+ import { SALES } from './sales';
313
+
314
+ /** One series needs no legend: the title names it. */
315
+ export default function Basic() {
316
+ return <Chart class="ch-basic" title="Online sales" subtitle="By month, in euros" data={SALES} xField="month" series={[{ type: 'bar', yField: 'online', name: 'Online' }]} />;
317
+ }
318
+ ```
319
+
320
+ `sales.ts`
321
+
322
+ ```tsx
323
+ /** Twelve months of made-up figures, shared by the examples. */
324
+ export const SALES = [
325
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
326
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
327
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
328
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
329
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
330
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
331
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
332
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
333
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
334
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
335
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
336
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
337
+ ];
338
+ ```
339
+
340
+ `Source.tsx`
341
+
342
+ ```tsx
343
+ import { data } from '@motifx-community/data';
344
+ import { Chart } from '@motifx-community/ui';
345
+ import { SALES } from './sales';
346
+
347
+ const source = new data.DataSource({ adapter: new data.ArrayAdapter({ data: SALES, key: 'month' }) });
348
+
349
+ /** Rows from any adapter of the data layer: the chart follows the source. */
350
+ export default function Source() {
351
+ return <Chart class="ch-source" title="From a data source" dataSource={source} xField="month" series={[{ type: 'bar', yField: 'returns', name: 'Returns' }]} />;
352
+ }
353
+ ```
354
+
355
+ `States.tsx`
356
+
357
+ ```tsx
358
+ import { reactive } from '@motifx/core';
359
+ import { Button, Chart, Stack } from '@motifx-community/ui';
360
+ import { SALES } from './sales';
361
+
362
+ /** No values, and new values on their way. */
363
+ export default function States() {
364
+ const s = reactive({ rows: SALES.slice(0, 6), loading: false });
365
+ return (
366
+ <Stack class="docs-wide" gap="md">
367
+ <Chart class="ch-states" label="Sales" data={() => s.rows} loading={() => s.loading} xField="month" emptyText="No sales in this period" series={[{ type: 'bar', yField: 'online', name: 'Online' }]} />
368
+ <Stack orientation="horizontal" gap="sm">
369
+ <Button text="Clear" variant="outline" onclick={() => (s.rows = [])} />
370
+ <Button text="Fill" variant="outline" onclick={() => (s.rows = SALES.slice(0, 6))} />
371
+ <Button text="Load" variant="outline" onclick={() => (s.loading = !s.loading)} />
372
+ </Stack>
373
+ </Stack>
374
+ );
375
+ }
376
+ ```
377
+
378
+ `Export.tsx`
379
+
380
+ ```tsx
381
+ import { reactive } from '@motifx/core';
382
+ import { Button, Chart, Stack } from '@motifx-community/ui';
383
+ import { SALES } from './sales';
384
+
385
+ /** An image with the title and the legend, to download or to put in a report. */
386
+ export default function Export() {
387
+ const s = reactive({ image: '' });
388
+ let chart!: Chart;
389
+ return (
390
+ <Stack class="docs-wide" gap="md">
391
+ <Chart
392
+ ref={(x: Chart) => (chart = x)}
393
+ class="ch-export"
394
+ title="Sales by channel"
395
+ data={SALES}
396
+ xField="month"
397
+ series={[
398
+ { type: 'bar', yField: 'online', name: 'Online' },
399
+ { type: 'bar', yField: 'stores', name: 'Stores' }
400
+ ]}
401
+ />
402
+ <Button text="Create the image" variant="outline" onclick={() => chart.toDataURL().then(url => (s.image = url))} />
403
+ {s.image && <img class="ch-image" alt="The chart as an image" src={() => s.image} />}
404
+ </Stack>
405
+ );
406
+ }
407
+ ```
408
+
409
+ `Programmatic.tsx`
410
+
411
+ ```tsx
412
+ import { Component } from '@motifx/core';
413
+ import { Button, Chart, Stack } from '@motifx-community/ui';
414
+ import { SALES } from './sales';
415
+
416
+ /** A chart created programmatically. Each prop is also a property that can be set later. */
417
+ export default class Programmatic extends Component<HTMLDivElement> {
418
+ constructor() {
419
+ super('div');
420
+ const chart = new Chart({ label: 'Sales', data: SALES, xField: 'month', series: [{ type: 'bar', yField: 'online', name: 'Online' }] });
421
+ const next = new Button({ text: 'Show the stores', variant: 'outline', onclick: () => (chart.series = [{ type: 'bar', yField: 'stores', name: 'Stores' }]) });
422
+ const stack = new Stack({ gap: 'md' });
423
+ stack.controls.add(chart, next);
424
+ this.controls.add(stack);
425
+ }
426
+ }
427
+ ```
package/docs/checkbox.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CheckBox
2
2
 
3
- > Choice · @motifx-community/ui 0.1.0-beta.5
3
+ > Choice · @motifx-community/ui 0.1.0-beta.6
4
4
 
5
5
  A check box with a label that can be checked, unchecked or indeterminate. It supports an optional three-state cycle, read-only and required states, and validation with its group. It is a native check box styled with design tokens.
6
6
 
package/docs/chip.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Chip and ChipGroup
2
2
 
3
- > Display · @motifx-community/ui 0.1.0-beta.5
3
+ > Display · @motifx-community/ui 0.1.0-beta.6
4
4
 
5
5
  A compact element with short text and an optional leading icon or avatar. Use it as a filter, as a choice among a few options, or to represent a selected item that can be removed. A group handles single or multiple selection and arrow key navigation.
6
6