@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,87 @@
1
+ # BarGauge: Angles and size
2
+
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.6
4
+
5
+ How far the bars go round and which way they face fit a bar gauge to the room it has.
6
+
7
+ ## Circle and halves
8
+
9
+ `angle` sets how far the bars go round: 270 degrees by default, a whole circle at 360. `rotation` turns them.
10
+
11
+ ```tsx
12
+ import { BarGauge, Stack } from '@motifx-community/ui';
13
+
14
+ const VALUES = [72, 54, 38];
15
+
16
+ /** A whole circle, a half that opens downward, and a half turned to the right. */
17
+ export default function Shapes() {
18
+ return (
19
+ <Stack orientation="horizontal" gap="xl" wrap align="center">
20
+ <BarGauge class="bg-circle" data={VALUES} angle={360} size={160} label="Whole circle" />
21
+ <BarGauge class="bg-half" data={VALUES} angle={180} size={180} label="Half" />
22
+ <BarGauge class="bg-side" data={VALUES} angle={180} rotation={90} size={160} label="Half turned" />
23
+ </Stack>
24
+ );
25
+ }
26
+ ```
27
+
28
+ ## Quarters
29
+
30
+ A quarter turned to a corner fits the corner of a card.
31
+
32
+ ```tsx
33
+ import { BarGauge, Stack } from '@motifx-community/ui';
34
+
35
+ const VALUES = [72, 54, 38];
36
+
37
+ /** Quarters turned to each corner, for a gauge in the corner of a card. */
38
+ export default function Directions() {
39
+ return (
40
+ <Stack orientation="horizontal" gap="xl" wrap align="center">
41
+ <BarGauge data={VALUES} angle={90} rotation={-45} size={180} label="Upper left" />
42
+ <BarGauge data={VALUES} angle={90} rotation={45} size={180} label="Upper right" />
43
+ <BarGauge data={VALUES} angle={90} rotation={135} size={180} label="Lower right" />
44
+ <BarGauge data={VALUES} angle={90} rotation={-135} size={180} label="Lower left" />
45
+ </Stack>
46
+ );
47
+ }
48
+ ```
49
+
50
+ ## Many bars
51
+
52
+ `size` sets the width of the whole circle. With many bars they grow thinner, so the middle stays open.
53
+
54
+ ```tsx
55
+ import { BarGauge } from '@motifx-community/ui';
56
+
57
+ const SKILLS = [
58
+ { name: 'Reading', value: 82 },
59
+ { name: 'Writing', value: 64 },
60
+ { name: 'Listening', value: 91 },
61
+ { name: 'Speaking', value: 58 },
62
+ { name: 'Grammar', value: 73 },
63
+ { name: 'Vocabulary', value: 69 },
64
+ { name: 'Spelling', value: 77 },
65
+ { name: 'Pronunciation', value: 61 }
66
+ ];
67
+
68
+ /** Eight bars: they grow thinner so the middle stays open. */
69
+ export default function Many() {
70
+ return <BarGauge class="bg-many" data={SKILLS} valueField="value" nameField="name" size={260} showLabels={false} legend label="Skills" />;
71
+ }
72
+ ```
73
+
74
+ ## Props on this page
75
+
76
+ | Prop | Type | Default | Description |
77
+ | --- | --- | --- | --- |
78
+ | `angle` | `Bind<number>` | `270` | How far the bars go round, in degrees. |
79
+ | `rotation` | `Bind<number>` | `0` | How far the middle of the bars is turned from the top, clockwise, in degrees. |
80
+ | `size` | `Bind<number \| null>` | From the design language | The width of the bars' whole circle in pixels. |
81
+ | `colors` | `Bind<string[] \| null>` | The chart colors | Colors of your own, in the order of the values. |
82
+
83
+ Every other prop and member is on the [Overview](bar-gauge.md#api).
84
+
85
+ ## Feedback
86
+
87
+ Loading issues…
@@ -0,0 +1,122 @@
1
+ # BarGauge: Data
2
+
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.6
4
+
5
+ A bar gauge reads numbers, or rows through their fields, and follows them as they change.
6
+
7
+ ## Numbers or rows
8
+
9
+ `data` takes numbers, or rows with `valueField` and `nameField`. A field can be a function that works the value out; the rows stay as they are.
10
+
11
+ ```tsx
12
+ import { BarGauge } from '@motifx-community/ui';
13
+
14
+ interface Team {
15
+ team: string;
16
+ done: number;
17
+ planned: number;
18
+ }
19
+
20
+ const TEAMS: Team[] = [
21
+ { team: 'Design', done: 18, planned: 24 },
22
+ { team: 'Web', done: 31, planned: 36 },
23
+ { team: 'Mobile', done: 12, planned: 30 }
24
+ ];
25
+
26
+ /** Rows read through fields: the value is worked out by a function, the share of the work done. */
27
+ export default function Rows() {
28
+ return (
29
+ <BarGauge<Team> class="bg-rows" data={TEAMS} valueField={t => Math.round((t.done / t.planned) * 100)} nameField="team" legend
30
+ format={{ style: 'unit', unit: 'percent' }} label="Work done" />
31
+ );
32
+ }
33
+ ```
34
+
35
+ ## Both ways from a base value
36
+
37
+ `baseValue` sets where the bars start, so values below and above it go either way.
38
+
39
+ ```tsx
40
+ import { BarGauge } from '@motifx-community/ui';
41
+
42
+ const mm = (v: number) => `${v.toFixed(2)} mm`;
43
+
44
+ /** Deviations from a measure: the bars start at 0 and go either way. */
45
+ export default function BothWays() {
46
+ return <BarGauge class="bg-both" data={[-2.13, 1.48, -3.09, 4.52, 3.9]} min={-5} max={5} baseValue={0} format={mm} label="Deviations of the parts" />;
47
+ }
48
+ ```
49
+
50
+ ## A changing number of bars
51
+
52
+ The bars follow the data: a new bar grows from the base value. `colorField` keeps each row's color, so the others keep theirs when one goes.
53
+
54
+ ```tsx
55
+ import { reactive } from '@motifx/core';
56
+ import { BarGauge, CheckBox, Stack } from '@motifx-community/ui';
57
+
58
+ /** As many bars as goods chosen. Each row keeps its own color, so a bar does not change color when another goes. */
59
+ export default function Changing() {
60
+ const goods = reactive([
61
+ { name: 'Hammers', count: 41, color: 'var(--mx-color-chart-series-1)', on: true },
62
+ { name: 'Shovels', count: 32, color: 'var(--mx-color-chart-series-2)', on: true },
63
+ { name: 'Ladders', count: 13, color: 'var(--mx-color-chart-series-3)', on: true },
64
+ { name: 'Watering cans', count: 48, color: 'var(--mx-color-chart-series-4)', on: true },
65
+ { name: 'Screwdrivers', count: 24, color: 'var(--mx-color-chart-series-5)', on: true },
66
+ { name: 'Drills', count: 19, color: 'var(--mx-color-chart-series-6)', on: true }
67
+ ]);
68
+ return (
69
+ <Stack orientation="horizontal" gap="xl" wrap align="center">
70
+ <BarGauge class="bg-changing" data={() => goods.filter(g => g.on)} valueField="count" nameField="name" colorField="color" max={50}
71
+ label="Goods sold" legend />
72
+ <Stack gap="sm">
73
+ {goods.map(g => (
74
+ <CheckBox label={g.name} x-model={() => g.on} />
75
+ ))}
76
+ </Stack>
77
+ </Stack>
78
+ );
79
+ }
80
+ ```
81
+
82
+ ## Live values
83
+
84
+ New values every second. Each change moves over the motion of the design language.
85
+
86
+ ```tsx
87
+ import { reactive } from '@motifx/core';
88
+ import { BarGauge, Button, Stack } from '@motifx-community/ui';
89
+
90
+ const walk = (v: number) => Math.max(5, Math.min(95, v + Math.round(Math.random() * 20 - 10)));
91
+
92
+ /** New values every second for each line of production. Each change moves over the motion of the design language. */
93
+ export default function LiveBars() {
94
+ const s = reactive({ running: true, lines: [{ name: 'Line A', load: 64 }, { name: 'Line B', load: 41 }, { name: 'Line C', load: 78 }] });
95
+ const timer = setInterval(() => {
96
+ if (s.running) s.lines = s.lines.map(l => ({ ...l, load: walk(l.load) }));
97
+ }, 1000);
98
+ return (
99
+ <Stack gap="md" align="start" onDisposing={() => clearInterval(timer)}>
100
+ <BarGauge class="bg-live" data={() => s.lines} valueField="load" nameField="name" legend format={{ style: 'unit', unit: 'percent' }} label="Load" />
101
+ <Button text={() => (s.running ? 'Pause' : 'Go on')} variant="outline" onclick={() => (s.running = !s.running)} />
102
+ </Stack>
103
+ );
104
+ }
105
+ ```
106
+
107
+ ## Props on this page
108
+
109
+ | Prop | Type | Default | Description |
110
+ | --- | --- | --- | --- |
111
+ | `data` | `Bind<(T \| number)[]>` | `[]` | The values: numbers, or rows with `valueField`. They are read and never changed. |
112
+ | `valueField` | `Bind<ChartField<T> \| null>` | `null` | The field of a row that holds its value, or a function that reads it. |
113
+ | `nameField` | `Bind<ChartField<T> \| null>` | `null` | The field of a row that holds its name, shown in the legend and the tooltip and read with its value. |
114
+ | `colorField` | `Bind<ChartField<T> \| null>` | `null` | The field of a row that holds a color of its own. |
115
+ | `baseValue` | `Bind<number \| null>` | The start of the scale | Where the bars start, so they grow both ways from a value inside the scale. |
116
+ | `min, max` | `Bind<number>` | `0`, `100` | The ends of the scale. |
117
+
118
+ Every other prop and member is on the [Overview](bar-gauge.md#api).
119
+
120
+ ## Feedback
121
+
122
+ Loading issues…
@@ -0,0 +1,78 @@
1
+ # BarGauge: Labels and legend
2
+
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.6
4
+
5
+ Each value can be written at the end of its bar, named in a legend, and shown with its name under the pointer.
6
+
7
+ ## Values at the ends
8
+
9
+ A line runs from the end of each bar to its value, outside the bars. A value that would sit on another moves further out along its line.
10
+
11
+ ```tsx
12
+ import { BarGauge } from '@motifx-community/ui';
13
+
14
+ /** Four ratings against the same scale, each written at the end of its bar. */
15
+ export default function Basic() {
16
+ return <BarGauge class="bg-basic" data={[47.3, 65.3, 84.6, 71.9]} format={{ style: 'unit', unit: 'percent', maximumFractionDigits: 1 }} label="Ratings" />;
17
+ }
18
+ ```
19
+
20
+ ## Formats
21
+
22
+ `format` writes the values: options of the browser's number format, in the language of the page, or a function of your own.
23
+
24
+ ```tsx
25
+ import { BarGauge, Stack } from '@motifx-community/ui';
26
+
27
+ const points = (v: number) => `${v} pts`;
28
+
29
+ /** Values as a percentage with one decimal, and through a function of your own. */
30
+ export default function Formats() {
31
+ return (
32
+ <Stack orientation="horizontal" gap="xl" wrap align="center">
33
+ <BarGauge data={[0.473, 0.653, 0.846]} max={1} format={{ style: 'percent', maximumFractionDigits: 1 }} label="Shares" />
34
+ <BarGauge class="bg-points" data={[38, 52, 71]} format={points} label="Scores" />
35
+ </Stack>
36
+ );
37
+ }
38
+ ```
39
+
40
+ ## Legend and tooltip
41
+
42
+ `legend` lists the names under the bars; `showLabels` can then leave the values at the ends out. The bar under the pointer shows its name and value.
43
+
44
+ ```tsx
45
+ import { BarGauge } from '@motifx-community/ui';
46
+
47
+ const RIDERS = [
48
+ { name: 'Rider 1', speed: 121.4 },
49
+ { name: 'Rider 2', speed: 135.4 },
50
+ { name: 'Rider 3', speed: 115.9 },
51
+ { name: 'Rider 4', speed: 141.1 },
52
+ { name: 'Rider 5', speed: 127.5 }
53
+ ];
54
+
55
+ /** Rows read through their fields, named in a legend; the bar under the pointer shows its name and value. */
56
+ export default function Legend() {
57
+ return (
58
+ <BarGauge class="bg-legend" data={RIDERS} valueField="speed" nameField="name" max={200} showLabels={false} legend
59
+ format={{ style: 'unit', unit: 'kilometer-per-hour' }} label="Average speed" />
60
+ );
61
+ }
62
+ ```
63
+
64
+ ## Props on this page
65
+
66
+ | Prop | Type | Default | Description |
67
+ | --- | --- | --- | --- |
68
+ | `showLabels` | `Bind<boolean>` | `true` | Writes each value at the end of its bar. |
69
+ | `legend` | `Bind<boolean>` | `false` | Shows a legend of the names under the bars. |
70
+ | `tooltip` | `Bind<boolean>` | `true` | Shows the value under the pointer. |
71
+ | `format` | `Bind<ChartFormat \| null>` | The language's numbers | How the values read: options of the browser's number format, or a function of your own. |
72
+ | `nameField` | `Bind<ChartField<T> \| null>` | `null` | The field of a row that holds its name, shown in the legend and the tooltip and read with its value. |
73
+
74
+ Every other prop and member is on the [Overview](bar-gauge.md#api).
75
+
76
+ ## Feedback
77
+
78
+ Loading issues…
@@ -0,0 +1,98 @@
1
+ # BarGauge
2
+
3
+ > Gauges · @motifx-community/ui 0.1.0-beta.6
4
+
5
+ Shows several values side by side as bars bent round one middle, each against the same scale. It compares a few values at a glance, in little room.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { BarGauge } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## A first bar gauge
14
+
15
+ `data` takes the values, the first one on the outside. Each value is written at the end of its bar.
16
+
17
+ ```tsx
18
+ import { BarGauge } from '@motifx-community/ui';
19
+
20
+ /** Four ratings against the same scale, each written at the end of its bar. */
21
+ export default function Basic() {
22
+ return <BarGauge class="bg-basic" data={[47.3, 65.3, 84.6, 71.9]} format={{ style: 'unit', unit: 'percent', maximumFractionDigits: 1 }} label="Ratings" />;
23
+ }
24
+ ```
25
+
26
+ ## More about bar gauges
27
+
28
+ Each part has its own page.
29
+
30
+ | Page | Covers |
31
+ | --- | --- |
32
+ | `[Labels and legend](bar-gauge-labels.md)` | Values at the ends of the bars, formats, a legend and the tooltip. |
33
+ | `[Data](bar-gauge-data.md)` | Numbers or rows, fields and functions, bars both ways, a changing number of bars, live values. |
34
+ | `[Angles and size](bar-gauge-angles.md)` | A whole circle, halves and quarters, and many bars in one gauge. |
35
+
36
+ ## Creating it programmatically
37
+
38
+ Each prop is also a property: set it later, and the gauge draws again. A new bar grows from the base value.
39
+
40
+ ```tsx
41
+ import { Component } from '@motifx/core';
42
+ import { BarGauge, Button, Stack } from '@motifx-community/ui';
43
+
44
+ /** A bar gauge created programmatically. Each prop is also a property that can be set later. */
45
+ export default class Programmatic extends Component<HTMLDivElement> {
46
+ constructor() {
47
+ super('div');
48
+ const gauge = new BarGauge({ data: [42, 67], label: 'Goals' });
49
+ const add = new Button({ text: 'Add a bar', variant: 'outline', onclick: () => (gauge.data = [...gauge.data, Math.round(20 + Math.random() * 70)]) });
50
+ const legend = new Button({ text: 'Legend on or off', variant: 'outline', onclick: () => (gauge.legend = !gauge.legend) });
51
+ const buttons = new Stack({ orientation: 'horizontal', gap: 'sm', wrap: true });
52
+ buttons.controls.add(add, legend);
53
+ const stack = new Stack({ gap: 'md', align: 'start' });
54
+ stack.controls.add(gauge, buttons);
55
+ this.controls.add(stack);
56
+ }
57
+ }
58
+ ```
59
+
60
+ ## API reference
61
+
62
+ ### Props
63
+
64
+ | Prop | Type | Default | Description |
65
+ | --- | --- | --- | --- |
66
+ | `data` | `Bind<(T \| number)[]>` | `[]` | The values: numbers, or rows with `valueField`. They are read and never changed. |
67
+ | `valueField` | `Bind<ChartField<T> \| null>` | `null` | The field of a row that holds its value, or a function that reads it. |
68
+ | `nameField` | `Bind<ChartField<T> \| null>` | `null` | The field of a row that holds its name, shown in the legend and the tooltip and read with its value. |
69
+ | `colorField` | `Bind<ChartField<T> \| null>` | `null` | The field of a row that holds a color of its own. |
70
+ | `min, max` | `Bind<number>` | `0`, `100` | The ends of the scale. |
71
+ | `baseValue` | `Bind<number \| null>` | The start of the scale | Where the bars start, so they grow both ways from a value inside the scale. |
72
+ | `angle` | `Bind<number>` | `270` | How far the bars go round, in degrees. |
73
+ | `rotation` | `Bind<number>` | `0` | How far the middle of the bars is turned from the top, clockwise, in degrees. |
74
+ | `colors` | `Bind<string[] \| null>` | The chart colors | Colors of your own, in the order of the values. |
75
+ | `label` | `Bind<string>` | `''` | What the values are, read as its name. |
76
+ | `format` | `Bind<ChartFormat \| null>` | The language's numbers | How the values read: options of the browser's number format, or a function of your own. |
77
+ | `showLabels` | `Bind<boolean>` | `true` | Writes each value at the end of its bar. |
78
+ | `legend` | `Bind<boolean>` | `false` | Shows a legend of the names under the bars. |
79
+ | `tooltip` | `Bind<boolean>` | `true` | Shows the value under the pointer. |
80
+ | `size` | `Bind<number \| null>` | From the design language | The width of the bars' whole circle in pixels. |
81
+
82
+ ### Members
83
+
84
+ | Member | Description |
85
+ | --- | --- |
86
+ | `refresh()` | Draws again after the given rows were changed in place. |
87
+
88
+ ### Accessibility
89
+
90
+ | Topic | Details |
91
+ | --- | --- |
92
+ | `Role` | It has the role `img`, and its name gives every value with its name. |
93
+ | `Color` | A color is never the only sign: each value is written at the end of its bar, or named in the legend. |
94
+ | `Motion` | A change moves over the motion of the design language, and at once when the reader prefers reduced motion. A new bar grows from the base value. |
95
+
96
+ ## Feedback
97
+
98
+ Loading issues…
@@ -0,0 +1,193 @@
1
+ # Barcode
2
+
3
+ > Display · @motifx-community/ui 0.1.0-beta.6
4
+
5
+ A linear barcode, drawn as vectors: Code 128, Code 39, EAN-13, EAN-8, UPC-A or Interleaved 2 of 5. It has no dependencies, works out check digits and refuses a value the format cannot hold.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { Barcode } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Formats
14
+
15
+ `format` sets the kind of barcode, and `value` what it holds.
16
+
17
+ | Format | Value | Description |
18
+ | --- | --- | --- |
19
+ | `code128` | Any ASCII text | The default, for labels, shipping and stock. Digits are packed in pairs, so it stays short. |
20
+ | `code39` | Capitals, digits and `- . $ / + %` and space | Older industrial labels. Lower-case letters become capitals. |
21
+ | `ean13` | 12 or 13 digits | Retail products. The check digit is worked out, and a wrong one is refused. |
22
+ | `ean8` | 7 or 8 digits | Small retail products. |
23
+ | `upca` | 11 or 12 digits | Retail products in North America. |
24
+ | `itf` | Digits | Interleaved 2 of 5, for cartons. An odd number of digits gets a leading zero. |
25
+
26
+ ```tsx
27
+ import { Barcode, Stack } from '@motifx-community/ui';
28
+
29
+ /** Each format, with a value it can hold. */
30
+ export default function Formats() {
31
+ return (
32
+ <Stack gap="md">
33
+ <Barcode class="bc-128" format="code128" value="ORDER-2026-118" />
34
+ <Barcode class="bc-39" format="code39" value="PART-77" />
35
+ <Barcode class="bc-13" format="ean13" value="400638133393" />
36
+ <Barcode class="bc-8" format="ean8" value="9638507" />
37
+ <Barcode class="bc-upc" format="upca" value="03600029145" />
38
+ <Barcode class="bc-itf" format="itf" value="1234567890" />
39
+ </Stack>
40
+ );
41
+ }
42
+ ```
43
+
44
+ ## Size and text
45
+
46
+ `moduleWidth` and `height` set the size of the bars, and `showText` the text under them. Keep the bars wide enough for the distance it is read from.
47
+
48
+ ```tsx
49
+ import { Barcode, Stack } from '@motifx-community/ui';
50
+
51
+ /** The size of the bars, and a code without its text. */
52
+ export default function Options() {
53
+ return (
54
+ <Stack gap="md">
55
+ <Barcode class="bc-large" value="LARGE-1" moduleWidth={3} height={96} />
56
+ <Barcode class="bc-plain" value="NO-TEXT" showText={false} />
57
+ </Stack>
58
+ );
59
+ }
60
+ ```
61
+
62
+ ## Values that do not fit
63
+
64
+ A value the format cannot hold draws nothing and raises `onEncodeFailed`. Change the last digit of this EAN-13 to see it refused.
65
+
66
+ ```tsx
67
+ import { reactive } from '@motifx/core';
68
+ import { Barcode, Stack, TextBox } from '@motifx-community/ui';
69
+
70
+ /** A value the format cannot hold draws nothing and raises `onEncodeFailed`. An EAN refuses a wrong check digit. */
71
+ export default function Validation() {
72
+ const s = reactive({ value: '4006381333931', told: '' });
73
+ return (
74
+ <Stack gap="md">
75
+ <TextBox label="EAN-13" x-model={() => s.value} />
76
+ <Barcode
77
+ class="bc-valid"
78
+ format="ean13"
79
+ value={() => s.value}
80
+ onEncodeFailed={e => (s.told = `“${e.value}” is not a valid EAN-13.`)}
81
+ />
82
+ <output class="bc-told">{() => s.told}</output>
83
+ </Stack>
84
+ );
85
+ }
86
+ ```
87
+
88
+ ## Creating an image
89
+
90
+ `toDataURL()` and `toSVG()` give an image with the text under the bars, in black on white unless you set other colors.
91
+
92
+ ```tsx
93
+ import { reactive } from '@motifx/core';
94
+ import { Barcode, Button, Stack } from '@motifx-community/ui';
95
+
96
+ /** An image of the code, with its text, to download or print. */
97
+ export default function Export() {
98
+ const s = reactive({ image: '' });
99
+ let code!: Barcode;
100
+ return (
101
+ <Stack gap="md">
102
+ <Barcode ref={(x: Barcode) => (code = x)} class="bc-export" value="LABEL-42" />
103
+ <Button text="Create the image" variant="outline" onclick={() => (s.image = code.toDataURL('image/png', { scale: 2 }))} />
104
+ {s.image && <img class="bc-image" alt="The code as an image" src={() => s.image} />}
105
+ </Stack>
106
+ );
107
+ }
108
+ ```
109
+
110
+ ## Programmatic use
111
+
112
+ `new Barcode(props)` creates the code without JSX. Each prop is also a property.
113
+
114
+ ```tsx
115
+ import { Component } from '@motifx/core';
116
+ import { Barcode, Button, Stack } from '@motifx-community/ui';
117
+
118
+ /** A code created programmatically. Each prop is also a property that can be set later. */
119
+ export default class Programmatic extends Component<HTMLDivElement> {
120
+ constructor() {
121
+ super('div');
122
+ const code = new Barcode({ value: 'FIRST' });
123
+ const next = new Button({ text: 'Change the value', variant: 'outline', onclick: () => (code.value = 'SECOND') });
124
+ const stack = new Stack({ gap: 'md' });
125
+ stack.controls.add(code, next);
126
+ this.controls.add(stack);
127
+ }
128
+ }
129
+ ```
130
+
131
+ ## API reference
132
+
133
+ ### Props
134
+
135
+ | Prop | Type | Default | Description |
136
+ | --- | --- | --- | --- |
137
+ | `value` | `Bind<string>` | `''` | The value of the code. |
138
+ | `format` | `Bind<BarcodeFormat>` | `'code128'` | The kind of barcode. |
139
+ | `checkDigit` | `Bind<boolean>` | `false` | Adds the optional check character of Code 39. |
140
+ | `moduleWidth` | `Bind<number>` | `2` | The width of the thinnest bar in pixels. |
141
+ | `height` | `Bind<number \| null>` | From the design language | The height of the bars in pixels. |
142
+ | `margin` | `Bind<number>` | `10` | The quiet zone at each side, in modules. Readers need it. |
143
+ | `showText` | `Bind<boolean>` | `true` | Shows the text under the bars. |
144
+ | `label` | `Bind<string>` | The kit string “Barcode: …” | The accessible name. |
145
+
146
+ ### Properties and methods
147
+
148
+ | Member | Type | Description |
149
+ | --- | --- | --- |
150
+ | `isInvalid` | `boolean` | Indicates that the value could not be drawn. |
151
+ | `codeText` | `string` | The text under the bars, with the check digit where the format has one. |
152
+ | `toSVG(options?)` | `string` | The code as an SVG document, with its text. |
153
+ | `toDataURL(type?, options?)` | `string` | The code as a data URL, a PNG by default. |
154
+
155
+ ### Image options
156
+
157
+ | Prop | Type | Default | Description |
158
+ | --- | --- | --- | --- |
159
+ | `scale` | `number` | `2` | The width of a module in pixels. |
160
+ | `color` | `string` | `'#000000'` | The color of the bars and the text. |
161
+ | `background` | `string` | `'#ffffff'` | The background. |
162
+
163
+ ### Events
164
+
165
+ | Event | Type | Description |
166
+ | --- | --- | --- |
167
+ | `onEncodeFailed` | `{ value, format, source }` | Occurs when the format cannot hold the value, which then draws nothing. |
168
+
169
+ ### Accessibility
170
+
171
+ | Topic | Details |
172
+ | --- | --- |
173
+ | `Name` | The code has the role `img`, and its name holds the value, so a screen reader can read it. |
174
+ | `Colors` | A code stays dark on a light sheet in every theme, as readers expect. |
175
+ | `Width` | A narrow parent scrolls the code rather than squeezing its bars, which would stop it reading. |
176
+
177
+ ### Styling hooks
178
+
179
+ | Hook | Description |
180
+ | --- | --- |
181
+ | `.mx-barcode` | The sheet. `data-invalid` says the value could not be drawn. |
182
+ | `.mx-barcode__svg, .mx-barcode__text` | The bars and the text. |
183
+
184
+ ### Design tokens
185
+
186
+ | Token | Description |
187
+ | --- | --- |
188
+ | `barcode.height` | The height of the bars. |
189
+ | `barcode.sheet, .text` | Units: the sheet, whose `color` is the color of the bars, and the text. |
190
+
191
+ ## Feedback
192
+
193
+ Loading issues…