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

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 (277) hide show
  1. package/CHANGELOG.md +101 -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-lookup.d.ts +3 -3
  67. package/dist/components/datagrid/grid-settings.d.ts +3 -3
  68. package/dist/components/datagrid/model/GridData.d.ts +22 -3
  69. package/dist/components/datagrid/model/GridModel.d.ts +2 -0
  70. package/dist/components/gauge/Gauge.d.ts +179 -0
  71. package/dist/components/gauge/gauge-mark.d.ts +9 -0
  72. package/dist/components/gauge/gauge-marker.d.ts +2 -0
  73. package/dist/components/gauge/gauge-needle-shape.d.ts +2 -0
  74. package/dist/components/gauge/gauge-orientation.d.ts +2 -0
  75. package/dist/components/gauge/gauge-props.d.ts +58 -0
  76. package/dist/components/gauge/gauge-range.d.ts +11 -0
  77. package/dist/components/gauge/gauge-scale.d.ts +2 -0
  78. package/dist/components/gauge/gauge-shape.d.ts +43 -0
  79. package/dist/components/gauge/gauge-type.d.ts +2 -0
  80. package/dist/components/gauge/index.d.ts +9 -0
  81. package/dist/components/listbox/list-rows.d.ts +2 -0
  82. package/dist/components/otpinput/OtpInput.d.ts +73 -0
  83. package/dist/components/otpinput/index.d.ts +4 -0
  84. package/dist/components/otpinput/otp-charset.d.ts +2 -0
  85. package/dist/components/otpinput/otp-completed-event-args.d.ts +8 -0
  86. package/dist/components/otpinput/otp-input-props.d.ts +32 -0
  87. package/dist/components/qrcode/QRCode.d.ts +58 -0
  88. package/dist/components/qrcode/index.d.ts +5 -0
  89. package/dist/components/qrcode/qr-code-export-options.d.ts +9 -0
  90. package/dist/components/qrcode/qr-code-failed-event-args.d.ts +7 -0
  91. package/dist/components/qrcode/qr-code-props.d.ts +23 -0
  92. package/dist/components/signature/Signature.d.ts +100 -0
  93. package/dist/components/signature/index.d.ts +5 -0
  94. package/dist/components/signature/signature-draw.d.ts +15 -0
  95. package/dist/components/signature/signature-export-options.d.ts +11 -0
  96. package/dist/components/signature/signature-props.d.ts +30 -0
  97. package/dist/components/signature/signature-stroke-event-args.d.ts +9 -0
  98. package/dist/components/signature/signature-stroke.d.ts +11 -0
  99. package/dist/components/sparkline/Sparkline.d.ts +85 -0
  100. package/dist/components/sparkline/index.d.ts +4 -0
  101. package/dist/components/sparkline/sparkline-highlight.d.ts +2 -0
  102. package/dist/components/sparkline/sparkline-props.d.ts +34 -0
  103. package/dist/components/sparkline/sparkline-type.d.ts +2 -0
  104. package/dist/components/validationsummary/ValidationSummary.d.ts +1 -0
  105. package/dist/core/fonts-loaded.d.ts +2 -0
  106. package/dist/core/scroll-watch.d.ts +13 -0
  107. package/dist/core/ui-strings.d.ts +38 -0
  108. package/dist/generated/tokens.d.ts +3023 -863
  109. package/dist/index.d.ts +10 -0
  110. package/dist/index.js +55933 -47186
  111. package/dist/index.js.map +1 -1
  112. package/dist/locales/en.json +37 -1
  113. package/dist/locales/tr.json +37 -1
  114. package/dist/parts/chart/chart-paths.d.ts +30 -0
  115. package/dist/parts/chart/chart-scale.d.ts +13 -0
  116. package/dist/parts/chart/chart-text.d.ts +12 -0
  117. package/dist/parts/chart/nice-ticks.d.ts +6 -0
  118. package/dist/parts/chart/svg-parts.d.ts +12 -0
  119. package/dist/parts/chart/thin-out.d.ts +6 -0
  120. package/dist/parts/chart/time-ticks.d.ts +7 -0
  121. package/dist/parts/chart/token-lengths.d.ts +16 -0
  122. package/dist/parts/chart/value-motion.d.ts +16 -0
  123. package/dist/parts/code/barcode-encode.d.ts +23 -0
  124. package/dist/parts/code/code-image.d.ts +35 -0
  125. package/dist/parts/code/qr-encode.d.ts +10 -0
  126. package/dist/parts/data/DataItems.d.ts +2 -0
  127. package/dist/parts/data/KeyedItems.d.ts +1 -0
  128. package/dist/parts/field/Field.d.ts +2 -0
  129. package/dist/parts/list/OptionList.d.ts +6 -0
  130. package/dist/parts/list/item-source.d.ts +4 -0
  131. package/dist/styles.css +3043 -9
  132. package/dist/tokens/index.d.ts +3212 -967
  133. package/dist/tokens/index.js +3023 -863
  134. package/dist/tokens/index.js.map +1 -1
  135. package/dist/{tr-C5IXRzAH.js → tr-DhIFcH3c.js} +75 -3
  136. package/dist/{tr-C5IXRzAH.js.map → tr-DhIFcH3c.js.map} +1 -1
  137. package/docs/accordion.md +1 -1
  138. package/docs/actionsheet.md +1 -1
  139. package/docs/appbar.md +194 -0
  140. package/docs/avatar.md +1 -1
  141. package/docs/badge.md +1 -1
  142. package/docs/bar-gauge-angles.md +87 -0
  143. package/docs/bar-gauge-data.md +122 -0
  144. package/docs/bar-gauge-labels.md +78 -0
  145. package/docs/bar-gauge.md +98 -0
  146. package/docs/barcode.md +193 -0
  147. package/docs/bottomnavigation.md +258 -0
  148. package/docs/bottomsheet.md +1 -1
  149. package/docs/breadcrumb.md +1 -1
  150. package/docs/button.md +1 -1
  151. package/docs/buttongroup.md +1 -1
  152. package/docs/buttons.md +169 -0
  153. package/docs/calendar.md +1 -1
  154. package/docs/card.md +1 -1
  155. package/docs/chart-bars.md +142 -0
  156. package/docs/chart-candles.md +164 -0
  157. package/docs/chart-funnel.md +115 -0
  158. package/docs/chart-heatmap.md +93 -0
  159. package/docs/chart-lines.md +128 -0
  160. package/docs/chart-live.md +62 -0
  161. package/docs/chart-pie.md +125 -0
  162. package/docs/chart-radar.md +124 -0
  163. package/docs/chart-ranges.md +127 -0
  164. package/docs/chart-references.md +126 -0
  165. package/docs/chart-scatter.md +139 -0
  166. package/docs/chart-waterfall.md +111 -0
  167. package/docs/chart-zoom.md +95 -0
  168. package/docs/chart.md +427 -0
  169. package/docs/checkbox.md +1 -1
  170. package/docs/chip.md +1 -1
  171. package/docs/choice.md +151 -0
  172. package/docs/colorbox.md +1 -1
  173. package/docs/combobox.md +1 -1
  174. package/docs/control.md +1 -1
  175. package/docs/data.md +127 -0
  176. package/docs/datagrid-api.md +1 -1
  177. package/docs/datagrid-bands.md +1 -1
  178. package/docs/datagrid-drag-select.md +1 -1
  179. package/docs/datagrid-drag.md +1 -1
  180. package/docs/datagrid-editing.md +1 -1
  181. package/docs/datagrid-filtering.md +1 -1
  182. package/docs/datagrid-forms.md +1 -1
  183. package/docs/datagrid-grouping.md +62 -2
  184. package/docs/datagrid-layout.md +2 -2
  185. package/docs/datagrid-lookups.md +2 -2
  186. package/docs/datagrid-master-detail.md +1 -1
  187. package/docs/datagrid-scrolling.md +1 -1
  188. package/docs/datagrid-selection.md +1 -1
  189. package/docs/datagrid.md +1 -1
  190. package/docs/datebox.md +1 -1
  191. package/docs/daterangebox.md +1 -1
  192. package/docs/display.md +148 -0
  193. package/docs/draggable.md +1 -1
  194. package/docs/drawer.md +1 -1
  195. package/docs/dropdown.md +1 -1
  196. package/docs/editors.md +157 -0
  197. package/docs/feedback.md +138 -0
  198. package/docs/fileuploader.md +1 -1
  199. package/docs/filterbuilder.md +1 -1
  200. package/docs/formlayout.md +1 -1
  201. package/docs/foundations.md +79 -0
  202. package/docs/gallery.md +1 -1
  203. package/docs/gauge-base.md +78 -0
  204. package/docs/gauge-circular.md +101 -0
  205. package/docs/gauge-dashboards.md +134 -0
  206. package/docs/gauge-linear.md +84 -0
  207. package/docs/gauge-markers.md +135 -0
  208. package/docs/gauge-marks.md +108 -0
  209. package/docs/gauge-ranges.md +133 -0
  210. package/docs/gauge-scales.md +117 -0
  211. package/docs/gauge.md +152 -0
  212. package/docs/home.md +1 -1
  213. package/docs/keyboard.md +1 -1
  214. package/docs/language.md +1 -1
  215. package/docs/layout.md +1 -1
  216. package/docs/listbox.md +1 -1
  217. package/docs/loadpanel.md +1 -1
  218. package/docs/lookup.md +1 -1
  219. package/docs/menus.md +1 -1
  220. package/docs/multiview.md +1 -1
  221. package/docs/navigation.md +143 -0
  222. package/docs/numberbox.md +1 -1
  223. package/docs/otpinput.md +197 -0
  224. package/docs/pagination.md +1 -1
  225. package/docs/popover.md +1 -1
  226. package/docs/progress.md +1 -1
  227. package/docs/qrcode.md +179 -0
  228. package/docs/radiogroup.md +1 -1
  229. package/docs/rating.md +1 -1
  230. package/docs/resizable.md +1 -1
  231. package/docs/scheduler-agenda.md +1 -1
  232. package/docs/scheduler-big-data.md +1 -1
  233. package/docs/scheduler-editing.md +1 -1
  234. package/docs/scheduler-form.md +1 -1
  235. package/docs/scheduler-icalendar.md +1 -1
  236. package/docs/scheduler-mobile.md +1 -1
  237. package/docs/scheduler-recurrence.md +1 -1
  238. package/docs/scheduler-resources.md +1 -1
  239. package/docs/scheduler-timeline.md +1 -1
  240. package/docs/scheduler.md +1 -1
  241. package/docs/scrollview.md +1 -1
  242. package/docs/showcase-home.md +31 -0
  243. package/docs/showcase.md +1 -1
  244. package/docs/signature.md +208 -0
  245. package/docs/skeleton.md +1 -1
  246. package/docs/slider.md +1 -1
  247. package/docs/sortable.md +1 -1
  248. package/docs/sparkline.md +119 -0
  249. package/docs/speeddial.md +1 -1
  250. package/docs/splitter.md +1 -1
  251. package/docs/stepper.md +1 -1
  252. package/docs/switch.md +1 -1
  253. package/docs/tabdocs-dock.md +1 -1
  254. package/docs/tabdocs-drag.md +1 -1
  255. package/docs/tabdocs-menus.md +1 -1
  256. package/docs/tabdocs-mobile.md +1 -1
  257. package/docs/tabdocs-tabs.md +1 -1
  258. package/docs/tabdocs-windows.md +1 -1
  259. package/docs/tabdocs-workspace.md +1 -1
  260. package/docs/tabdocs.md +1 -1
  261. package/docs/tabs.md +1 -1
  262. package/docs/tagbox.md +1 -1
  263. package/docs/textarea.md +1 -1
  264. package/docs/textbox.md +1 -1
  265. package/docs/tileview.md +1 -1
  266. package/docs/timeline.md +1 -1
  267. package/docs/toast.md +1 -1
  268. package/docs/tokens.md +450 -1
  269. package/docs/toolbar.md +1 -1
  270. package/docs/tooltip.md +1 -1
  271. package/docs/treeview.md +1 -1
  272. package/docs/validationsummary.md +1 -1
  273. package/docs/window.md +1 -1
  274. package/docs/wizard.md +1 -1
  275. package/llms-full.txt +6725 -99
  276. package/llms.txt +50 -1
  277. package/package.json +5 -5
@@ -0,0 +1,197 @@
1
+ # OtpInput
2
+
3
+ > Editors · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A one-time code in a row of boxes. Typing, pasting a whole code, the code a phone offers from a message and screen readers work as in any text box, because the boxes are drawn over one real input.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { OtpInput } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Entering a code
14
+
15
+ `x-model` binds the code, and `onCompleted` occurs when the last box is filled. Paste a code into the field, or type part of it and use the arrow keys.
16
+
17
+ ```tsx
18
+ import { reactive } from '@motifx/core';
19
+ import { Button, OtpInput, Stack } from '@motifx-community/ui';
20
+
21
+ /** A six-digit code bound to a value. `onCompleted` occurs once, when the last box is filled. */
22
+ export default function Basic() {
23
+ const s = reactive({ code: '', told: 'nothing yet' });
24
+ return (
25
+ <Stack gap="md">
26
+ <OtpInput class="otp-basic" label="Verification code" helpText="We sent it to your phone." x-model={() => s.code} onCompleted={e => (s.told = e.value)} />
27
+ <output class="otp-value">{() => `Value: ${s.code || 'empty'}`}</output>
28
+ <output class="otp-told">{() => `Completed: ${s.told}`}</output>
29
+ <Button text="Clear" variant="outline" onclick={() => (s.code = '')} />
30
+ </Stack>
31
+ );
32
+ }
33
+ ```
34
+
35
+ ## Formats
36
+
37
+ `length` sets the number of boxes, and `charset` or `pattern` the characters. `groupSize` separates the boxes, `masked` hides the characters, and `placeholder` marks empty boxes.
38
+
39
+ ```tsx
40
+ import { OtpInput, Stack } from '@motifx-community/ui';
41
+
42
+ /** Other lengths and characters, groups of boxes, and a masked PIN. */
43
+ export default function Formats() {
44
+ return (
45
+ <Stack gap="lg">
46
+ <OtpInput class="otp-key" label="Access key" length={8} charset="alphanumeric" uppercase groupSize={4} />
47
+ <OtpInput class="otp-pin" label="PIN" length={4} masked />
48
+ <OtpInput class="otp-hint" label="Code" length={4} placeholder="0" />
49
+ <OtpInput class="otp-hex" label="Color code" length={6} pattern={/[0-9a-f]/i} uppercase size="sm" />
50
+ </Stack>
51
+ );
52
+ }
53
+ ```
54
+
55
+ ## Validation
56
+
57
+ A code that is not complete fails on its own. `rules` adds your own checks, as in every field.
58
+
59
+ ```tsx
60
+ import { reactive } from '@motifx/core';
61
+ import { Button, OtpInput, Stack } from '@motifx-community/ui';
62
+
63
+ /** An incomplete code fails on its own, and a rule of the application can refuse a complete one. */
64
+ export default function Validation() {
65
+ const s = reactive({ code: '' });
66
+ let field!: OtpInput;
67
+ return (
68
+ <Stack gap="md">
69
+ <OtpInput
70
+ ref={(x: OtpInput) => (field = x)}
71
+ class="otp-valid"
72
+ label="Code"
73
+ length={4}
74
+ required
75
+ x-model={() => s.code}
76
+ rules={[{ type: 'custom', check: value => value === '1234', message: 'This code is not correct.' }]}
77
+ />
78
+ <Button text="Verify" variant="outline" onclick={() => void field.validate()} />
79
+ </Stack>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ## Sizes and states
85
+
86
+ `size` sets the size of the boxes. `readOnly` and `enabled` work as in every field.
87
+
88
+ ```tsx
89
+ import { OtpInput, Stack } from '@motifx-community/ui';
90
+
91
+ /** The sizes, and a field that cannot be changed. */
92
+ export default function States() {
93
+ return (
94
+ <Stack gap="lg">
95
+ <OtpInput class="otp-small" label="Small" size="sm" length={4} value="12" />
96
+ <OtpInput class="otp-large" label="Large" size="lg" length={4} value="12" />
97
+ <OtpInput class="otp-readonly" label="Read-only" length={4} value="1234" readOnly />
98
+ <OtpInput class="otp-disabled" label="Disabled" length={4} value="12" enabled={false} />
99
+ </Stack>
100
+ );
101
+ }
102
+ ```
103
+
104
+ ## Programmatic use
105
+
106
+ `new OtpInput(props)` creates the field without JSX. Each prop is also a property.
107
+
108
+ ```tsx
109
+ import { Component } from '@motifx/core';
110
+ import { Button, OtpInput, Stack } from '@motifx-community/ui';
111
+
112
+ /** A field created programmatically. `clear()` empties it and puts the caret in the first box. */
113
+ export default class Programmatic extends Component<HTMLDivElement> {
114
+ constructor() {
115
+ super('div');
116
+ const code = new OtpInput({ label: 'Programmatic code', length: 4, value: '12' });
117
+ const clear = new Button({ text: 'Clear', variant: 'outline', onclick: () => code.clear() });
118
+ const stack = new Stack({ gap: 'md' });
119
+ stack.controls.add(code, clear);
120
+ this.controls.add(stack);
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## API reference
126
+
127
+ ### Props
128
+
129
+ | Prop | Type | Default | Description |
130
+ | --- | --- | --- | --- |
131
+ | `length` | `Bind<number>` | `6` | The number of characters. |
132
+ | `charset` | `Bind<'digits' \| 'letters' \| 'alphanumeric'>` | `'digits'` | Which characters are accepted. Anything else is left out, also in a pasted code. |
133
+ | `pattern` | `Bind<RegExp \| null>` | `null` | Accepts the characters this matches instead of `charset`. It is tested on one character at a time. |
134
+ | `uppercase` | `Bind<boolean>` | `false` | Turns letters into capitals as they are typed. |
135
+ | `masked` | `Bind<boolean>` | `false` | Draws a mark in place of each character. |
136
+ | `maskCharacter` | `Bind<string>` | `'•'` | The mark of `masked`. |
137
+ | `placeholder` | `Bind<string>` | `''` | Shown in a box that is still empty. |
138
+ | `groupSize` | `Bind<number \| null>` | `null` | Puts a separator after every so many boxes, such as `3` for `123-456`. |
139
+ | `separator` | `Bind<string>` | `'–'` | The text of that separator. |
140
+ | `autoComplete` | `Bind<string>` | `'one-time-code'` | The `autocomplete` of the input, which lets a phone offer the code from a message. |
141
+ | `label, helpText, size, readOnly, required, rules, error, validateOn` | | | Same as `TextBox`. |
142
+
143
+ ### Properties and methods
144
+
145
+ | Member | Type | Description |
146
+ | --- | --- | --- |
147
+ | `value` | `string` | The characters entered so far. `x-model` provides two-way binding. |
148
+ | `isComplete` | `boolean` | Indicates that every box is filled. |
149
+ | `clear()` | `void` | Empties the boxes and puts the caret in the first one. |
150
+ | `validate()` | `Promise<boolean>` | Same as `TextBox`. |
151
+ | `focus()` | `boolean` | Moves focus to the first empty box. |
152
+
153
+ ### Events
154
+
155
+ | Event | Type | Description |
156
+ | --- | --- | --- |
157
+ | `onCompleted` | `{ value, source, originalEvent }` | Occurs when the user has entered every character, by typing, pasting or from the phone. It occurs once for a code. |
158
+ | `onValueChanged` | `{ value, previousValue, byUser, source, event }` | Same as `TextBox`. |
159
+
160
+ ### Keyboard
161
+
162
+ | Key | Description |
163
+ | --- | --- |
164
+ | `Characters` | Fill the box with the caret, and the caret moves on. In a filled box, the character takes its place. |
165
+ | `Backspace, Delete` | Remove a character, and those after it move back. |
166
+ | `Left, Right, Home, End` | Move the caret between the boxes. |
167
+ | `Ctrl+V` | Pastes a whole code. Characters that are not accepted, such as spaces and dashes, are left out. |
168
+
169
+ ### Accessibility
170
+
171
+ | Topic | Details |
172
+ | --- | --- |
173
+ | `Input` | One real `<input>` with its label, one Tab stop. Screen readers treat it as a text box, and the boxes are hidden from them. |
174
+ | `Direction` | The boxes run left to right in every page, as a code is read. |
175
+ | `Phones` | `autocomplete="one-time-code"` offers the code from a message, and `inputmode="numeric"` opens the number keypad for digits. |
176
+ | `Masked codes` | `masked` only changes what the boxes draw. Use it where the code should not be read over a shoulder. |
177
+
178
+ ### Styling hooks
179
+
180
+ | Hook | Description |
181
+ | --- | --- |
182
+ | `.mx-otp-input` | The field. `data-size`, `data-invalid`, `data-readonly` and `data-disabled` describe its state. |
183
+ | `.mx-otp-input__input` | The real input, unseen over the boxes. |
184
+ | `.mx-otp-input__cells, .mx-otp-input__cell, .mx-otp-input__char, .mx-otp-input__caret, .mx-otp-input__separator` | The row, a box, a character, the caret and the separator. `data-active` and `data-filled` describe a box. |
185
+
186
+ ### Design tokens
187
+
188
+ | Token | Description |
189
+ | --- | --- |
190
+ | `otp-input.cell-width, .cell-height, .font-size` | The size of a box and of a character, for `sm`, `md` and `lg`. |
191
+ | `otp-input.input-font-size` | The text of the input under the boxes. Below 16 px a phone zooms in on focus. |
192
+ | `otp-input.cells, .cell, .char, .caret, .separator` | Units: the row, a box (`hover`, `filled`, `active`, `invalid`, `invalid-active`, `readonly`, `disabled`), a character, the caret and the separator. |
193
+ | `otp-input.field` | Place: the field under the boxes, without a box of its own. |
194
+
195
+ ## Feedback
196
+
197
+ Loading issues…
@@ -1,6 +1,6 @@
1
1
  # Pagination
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.5
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Navigates through pages of items, with page size options, the current position, navigation buttons and a button for each nearby page. It switches to a compact layout when it does not fit, and it looks and works like the DataGrid pager.
6
6
 
package/docs/popover.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Popover
2
2
 
3
- > Feedback · @motifx-community/ui 0.1.0-beta.5
3
+ > Feedback · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Displays content next to a related element, such as a title, a close button, a form or a card. It opens on click or on hover, follows its target, and points to it with an arrow where the design language includes one.
6
6
 
package/docs/progress.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ProgressBar and Spinner
2
2
 
3
- > Feedback · @motifx-community/ui 0.1.0-beta.5
3
+ > Feedback · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  ProgressBar shows how far an operation has progressed, as a line or a circle, or indicates activity when the progress is unknown. Spinner shows that the system is busy. It is a rotating ring that can stand alone or cover a panel while it loads, and it can wait for a delay so that quick operations do not cause a flash.
6
6
 
package/docs/qrcode.md ADDED
@@ -0,0 +1,179 @@
1
+ # QRCode
2
+
3
+ > Display · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A QR code, drawn as vectors so that it stays sharp at any size. It has no dependencies, chooses the smallest version that holds the text, and can carry a logo.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { QRCode } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## A code from a text
14
+
15
+ `value` is the text of the code, and the code follows it. Change the text to see the code grow.
16
+
17
+ ```tsx
18
+ import { reactive } from '@motifx/core';
19
+ import { QRCode, Stack, TextBox } from '@motifx-community/ui';
20
+
21
+ /** A code that follows a text. The smallest version that holds the text is chosen. */
22
+ export default function Basic() {
23
+ const s = reactive({ text: 'https://ui.motifjs.com' });
24
+ return (
25
+ <Stack gap="md">
26
+ <TextBox label="Text" x-model={() => s.text} />
27
+ <QRCode class="qr-basic" value={() => s.text} />
28
+ </Stack>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ## Error correction
34
+
35
+ `level` sets how much of the code can be damaged. A higher level holds less text, so the code grows.
36
+
37
+ ```tsx
38
+ import { reactive } from '@motifx/core';
39
+ import { ButtonGroup, QRCode, Stack, type QrLevel } from '@motifx-community/ui';
40
+
41
+ /** A higher level survives more damage, and needs a larger code. */
42
+ export default function Levels() {
43
+ const s = reactive({ level: 'M' as QrLevel });
44
+ return (
45
+ <Stack gap="md">
46
+ <ButtonGroup
47
+ label="Error correction"
48
+ x-model={() => s.level}
49
+ items={[
50
+ { value: 'L', text: 'L' },
51
+ { value: 'M', text: 'M' },
52
+ { value: 'Q', text: 'Q' },
53
+ { value: 'H', text: 'H' }
54
+ ]}
55
+ />
56
+ <QRCode class="qr-level" value="https://ui.motifjs.com/qrcode" level={() => s.level} size={200} />
57
+ </Stack>
58
+ );
59
+ }
60
+ ```
61
+
62
+ ## A logo
63
+
64
+ `logo` puts an image in the middle, which takes the place of some modules. Level `H` restores what it covers. `logoSize` sets its share, at most `0.3`.
65
+
66
+ ```tsx
67
+ import { QRCode } from '@motifx-community/ui';
68
+
69
+ /** A logo in the middle, which takes the place of some modules. Level H restores what it covers. */
70
+ export default function Logo() {
71
+ return <QRCode class="qr-logo" value="https://ui.motifjs.com/qrcode" level="H" logo="/favicon.svg" size={220} />;
72
+ }
73
+ ```
74
+
75
+ ## Creating an image
76
+
77
+ `toDataURL()` and `toSVG()` give an image, in black on white unless you set other colors. `onEncodeFailed` occurs when a text does not fit in a code.
78
+
79
+ ```tsx
80
+ import { reactive } from '@motifx/core';
81
+ import { Button, QRCode, Stack } from '@motifx-community/ui';
82
+
83
+ /** An image of the code, to download or print. */
84
+ export default function Export() {
85
+ const s = reactive({ image: '' });
86
+ let code!: QRCode;
87
+ return (
88
+ <Stack gap="md">
89
+ <QRCode ref={(x: QRCode) => (code = x)} class="qr-export" value="Printed with the order" />
90
+ <Button text="Create the image" variant="outline" onclick={() => (s.image = code.toDataURL('image/png', { size: 256 }))} />
91
+ {s.image && <img class="qr-image" alt="The code as an image" src={() => s.image} />}
92
+ </Stack>
93
+ );
94
+ }
95
+ ```
96
+
97
+ ## Programmatic use
98
+
99
+ `new QRCode(props)` creates the code without JSX. Each prop is also a property.
100
+
101
+ ```tsx
102
+ import { Component } from '@motifx/core';
103
+ import { Button, QRCode, Stack } from '@motifx-community/ui';
104
+
105
+ /** A code created programmatically. Each prop is also a property that can be set later. */
106
+ export default class Programmatic extends Component<HTMLDivElement> {
107
+ constructor() {
108
+ super('div');
109
+ const code = new QRCode({ value: 'First', size: 140 });
110
+ const next = new Button({ text: 'Change the text', variant: 'outline', onclick: () => (code.value = 'Second') });
111
+ const stack = new Stack({ gap: 'md' });
112
+ stack.controls.add(code, next);
113
+ this.controls.add(stack);
114
+ }
115
+ }
116
+ ```
117
+
118
+ ## API reference
119
+
120
+ ### Props
121
+
122
+ | Prop | Type | Default | Description |
123
+ | --- | --- | --- | --- |
124
+ | `value` | `Bind<string>` | `''` | The text of the code. It may hold any characters. |
125
+ | `level` | `Bind<'L' \| 'M' \| 'Q' \| 'H'>` | `'M'` | How much of the code can be damaged: about 7, 15, 25 or 30 percent. |
126
+ | `size` | `Bind<number \| null>` | From the design language | The width and height in pixels. |
127
+ | `margin` | `Bind<number>` | `4` | The quiet zone around the code, in modules. Readers need at least `4`. |
128
+ | `logo` | `Bind<string \| null>` | `null` | The address of an image in the middle of the code. Use level `H` with it. |
129
+ | `logoSize` | `Bind<number>` | `0.2` | The share of the code the logo covers, at most `0.3`. |
130
+ | `label` | `Bind<string>` | The kit string “QR code: …” | The accessible name. |
131
+
132
+ ### Properties and methods
133
+
134
+ | Member | Type | Description |
135
+ | --- | --- | --- |
136
+ | `isInvalid` | `boolean` | Indicates that the value could not be drawn. |
137
+ | `modules` | `number` | The number of modules along a side of the code, without its margin. |
138
+ | `toSVG(options?)` | `string` | The code as an SVG document. The logo is not part of it. |
139
+ | `toDataURL(type?, options?)` | `string` | The code as a data URL, a PNG by default. The logo is not part of it. |
140
+
141
+ ### Image options
142
+
143
+ | Prop | Type | Default | Description |
144
+ | --- | --- | --- | --- |
145
+ | `size` | `number` | `512` | The width and height in pixels, rounded to whole modules. |
146
+ | `color` | `string` | `'#000000'` | The color of the modules. |
147
+ | `background` | `string` | `'#ffffff'` | The background. |
148
+
149
+ ### Events
150
+
151
+ | Event | Type | Description |
152
+ | --- | --- | --- |
153
+ | `onEncodeFailed` | `{ value, source }` | Occurs when the text does not fit in a code, which then draws nothing. |
154
+
155
+ ### Accessibility
156
+
157
+ | Topic | Details |
158
+ | --- | --- |
159
+ | `Name` | The code has the role `img`, and its name holds the text, so a screen reader can read it. |
160
+ | `Colors` | A code stays dark on a light sheet in every theme, as readers expect. |
161
+ | `Size` | For printing, keep a module at least 0.4 mm wide, and leave the quiet zone in place. |
162
+
163
+ ### Styling hooks
164
+
165
+ | Hook | Description |
166
+ | --- | --- |
167
+ | `.mx-qr-code` | The sheet. `data-invalid` says the value could not be drawn. |
168
+ | `.mx-qr-code__svg, .mx-qr-code__logo` | The code and the logo. |
169
+
170
+ ### Design tokens
171
+
172
+ | Token | Description |
173
+ | --- | --- |
174
+ | `qr-code.size` | The width and height. |
175
+ | `qr-code.sheet, .logo` | Units: the sheet, whose `color` is the color of the modules, and the logo. |
176
+
177
+ ## Feedback
178
+
179
+ Loading issues…
@@ -1,6 +1,6 @@
1
1
  # RadioGroup
2
2
 
3
- > Choice · @motifx-community/ui 0.1.0-beta.5
3
+ > Choice · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  A set of mutually exclusive options. Options can come from plain values, custom objects or a live list, and can be arranged vertically, horizontally or in columns. Individual options can be disabled, hidden or given help text. The group is a single Tab stop, and the arrow keys move between options.
6
6
 
package/docs/rating.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rating
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.5
3
+ > Editors · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  A row of stars for entering or displaying a score, in whole or half steps. Rating is a field, so the label, help text, rules and `x-model` work the same way as on any other field.
6
6
 
package/docs/resizable.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Resizable
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.5
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  A box that users can resize from its edges and corners with the pointer, or with the arrow keys on the grip in its end corner. It respects minimum and maximum sizes, can stay within an area, and can preserve its aspect ratio.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Agenda
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Displays upcoming days as a list, with each day's appointments in time order. Days without appointments are omitted.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Big data
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Handles thousands of resources and appointments. The scheduler renders only what is visible, and recalculates the layout only for what has changed.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Editing
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Users can add, move, resize, copy and delete appointments with the pointer and the keyboard, and you can do the same programmatically. Every change raises its event first, can wait for a server, and is reverted if saving fails.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: The appointment form
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Configure the appointment form without handling events. You can choose its fields and their order, arrange them in groups and tabs, use custom editors, add validation per field, and show or lock fields for specific appointments. You can also replace the form with your own.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: iCalendar and print
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Exports appointments to an iCalendar file (RFC 5545) and imports them back, for use with other calendar applications. The scheduler can also be printed.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Tablet and phone
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  On tablets and phones, the scheduler keeps its appointments, views and date, and changes how it presents them. On a phone, it shows the agenda, a compact toolbar and bottom sheets. Touch gestures can lift and resize appointments, swipe between days, and pinch to zoom.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Recurrence and time zones
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Recurring appointments based on RFC 5545 rules, with exceptions and individually edited occurrences, a prompt that asks what a change should apply to, a recurrence editor, and time zone support that handles daylight saving time.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Resources and groups
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Resources such as rooms, people and equipment can color appointments, divide columns into groups (nested or under each date), and define when each resource is available and when time is blocked.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Timeline
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  Displays one row per resource, with time running along the row, for a day, a week, a work week or a month. Appointments at the same time stack within a row, and the row grows to fit them.
6
6
 
package/docs/scheduler.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Scheduler
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.5
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  A full-featured calendar for appointments across days and hours. It provides day, week, work week and month views, all-day and multi-day bars, side-by-side display of overlapping appointments, and a "+N more" link when a day is full. Appointments can come from an array or a data source, and every setting can change at runtime.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # ScrollView
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.5
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  A scrollable container with configurable scrollbars, pull-to-refresh, and load-on-scroll near the end of the content. You can scroll it programmatically to a position or an element.
6
6
 
@@ -0,0 +1,31 @@
1
+ # Showcase: a smart home
2
+
3
+ > Get started · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A smart home panel for a tablet, built with the kit as a MotifJS application of its own: a rail of screens, the day and the home's state at the top, and tiles you can touch. The devices report new values every two seconds.
6
+
7
+ [Open the panel on its own](/smart-home/)
8
+
9
+ ## Screens
10
+
11
+ | Screen | Shows |
12
+ | --- | --- |
13
+ | `Home` | Scenes, the climate with its target, power now, the doors and the alarm, every room with its lights, and what happened. |
14
+ | `Rooms` | One room at a time: its temperature and target, each light with its brightness and color, the blinds. |
15
+ | `Climate` | Every room's temperature and target, the mode, the air quality and humidity, and the last hours on a chart. |
16
+ | `Energy` | Power from the grid and the sun now, today by device, the day and the week on charts. |
17
+ | `Security` | The alarm, turned off with a code, the doors, the cameras and the events. |
18
+ | `Automations` | What the home does on its own, switched on and off, and a new one step by step in a window. |
19
+
20
+ ## How it is built
21
+
22
+ | Part | How |
23
+ | --- | --- |
24
+ | `Application` | One `HomeModel` registered as a singleton service; every screen takes it with `FromService`, so all of them show the same home. |
25
+ | `Router` | Each screen is a route loaded when first opened, under a shell with the rail and the top bar. Hash addresses keep the app in one folder of a static site. |
26
+ | `Live values` | The model moves the values every two seconds, as devices would report them; the controls follow because they bind to the model with functions. |
27
+ | `Components` | `Card`, `Gauge`, `BarGauge`, `Chart`, `Sparkline`, `Switch`, `Slider`, `ColorBox`, `ListBox`, `ButtonGroup`, `Button`, `Chip`, `Badge`, `Avatar`, `OtpInput`, `Gallery`, `Timeline`, `DateBox`, `ChipGroup`, `MxForm`, `Wizard` and `toast`. |
28
+
29
+ ## Feedback
30
+
31
+ Loading issues…
package/docs/showcase.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Showcase: an order screen
2
2
 
3
- > Get started · @motifx-community/ui 0.1.0-beta.5
3
+ > Get started · @motifx-community/ui 0.1.0-beta.7
4
4
 
5
5
  An order entry screen built with the kit, structured the way a MotifJS application is normally built: state and operations live in a model (`OrderModel`), and the page binds to it. The customer list is a data source of 5,000 rows that responds like a server.
6
6