@motifx-community/ui 0.1.0-beta.1 → 0.1.0-beta.3

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.

Potentially problematic release.


This version of @motifx-community/ui might be problematic. Click here for more details.

Files changed (259) hide show
  1. package/CHANGELOG.md +147 -8
  2. package/README.md +19 -13
  3. package/dist/components/accordion/Accordion.d.ts +3 -3
  4. package/dist/components/accordion/AccordionItem.d.ts +1 -1
  5. package/dist/components/calendar/Calendar.d.ts +12 -0
  6. package/dist/components/calendar/calendar-props.d.ts +5 -0
  7. package/dist/components/card/Card.d.ts +1 -1
  8. package/dist/components/contextmenu/ContextMenu.d.ts +1 -1
  9. package/dist/components/datagrid/DataGrid.d.ts +5 -5
  10. package/dist/components/datagrid/data-grid-props.d.ts +2 -2
  11. package/dist/components/datagrid/grid-adaptive-row-expanded-event-args.d.ts +1 -1
  12. package/dist/components/datagrid/grid-adaptive-row-expanding-event-args.d.ts +1 -1
  13. package/dist/components/datagrid/grid-grouping-changed-event-args.d.ts +1 -1
  14. package/dist/components/datagrid/grid-grouping-changing-event-args.d.ts +2 -2
  15. package/dist/components/datagrid/grid-master-detail.d.ts +1 -1
  16. package/dist/components/datagrid/grid-row-expanded-event-args.d.ts +1 -1
  17. package/dist/components/datagrid/grid-row-expanding-event-args.d.ts +1 -1
  18. package/dist/components/datagrid/grid-search-text-changed-event-args.d.ts +1 -1
  19. package/dist/components/datagrid/grid-search-text-changing-event-args.d.ts +1 -1
  20. package/dist/components/datagrid/grid-sort-changing-event-args.d.ts +1 -1
  21. package/dist/components/datagrid/model/GridSearch.d.ts +1 -1
  22. package/dist/components/daterangebox/DateRangeBox.d.ts +121 -0
  23. package/dist/components/daterangebox/date-range-box-props.d.ts +35 -0
  24. package/dist/components/daterangebox/date-range-preset.d.ts +6 -0
  25. package/dist/components/daterangebox/date-range.d.ts +2 -0
  26. package/dist/components/daterangebox/index.d.ts +4 -0
  27. package/dist/components/draggable/Draggable.d.ts +99 -0
  28. package/dist/components/draggable/DropTarget.d.ts +38 -0
  29. package/dist/components/draggable/draggable-event-args.d.ts +17 -0
  30. package/dist/components/draggable/draggable-props.d.ts +37 -0
  31. package/dist/components/draggable/drop-event-args.d.ts +11 -0
  32. package/dist/components/draggable/drop-target-props.d.ts +13 -0
  33. package/dist/components/draggable/index.d.ts +6 -0
  34. package/dist/components/fileuploader/FileUploader.d.ts +133 -0
  35. package/dist/components/fileuploader/file-uploader-props.d.ts +46 -0
  36. package/dist/components/fileuploader/files-added-event-args.d.ts +9 -0
  37. package/dist/components/fileuploader/index.d.ts +7 -0
  38. package/dist/components/fileuploader/upload-event-args.d.ts +10 -0
  39. package/dist/components/fileuploader/upload-item.d.ts +12 -0
  40. package/dist/components/fileuploader/upload-mode.d.ts +2 -0
  41. package/dist/components/fileuploader/upload-status.d.ts +2 -0
  42. package/dist/components/filterbuilder/FilterBuilder.d.ts +1 -1
  43. package/dist/components/gallery/Gallery.d.ts +132 -0
  44. package/dist/components/gallery/gallery-item-click-event-args.d.ts +9 -0
  45. package/dist/components/gallery/gallery-item.d.ts +18 -0
  46. package/dist/components/gallery/gallery-props.d.ts +38 -0
  47. package/dist/components/gallery/index.d.ts +6 -0
  48. package/dist/components/gallery/slide-changed-event-args.d.ts +11 -0
  49. package/dist/components/gallery/slide-changing-event-args.d.ts +14 -0
  50. package/dist/components/layout/ChildSettings.d.ts +1 -1
  51. package/dist/components/layout/DockPanel.d.ts +2 -2
  52. package/dist/components/layout/Grid.d.ts +1 -1
  53. package/dist/components/layout/SplitContainer.d.ts +1 -1
  54. package/dist/components/layout/Stack.d.ts +1 -1
  55. package/dist/components/loadpanel/LoadPanel.d.ts +70 -0
  56. package/dist/components/loadpanel/index.d.ts +3 -0
  57. package/dist/components/loadpanel/load-panel-props.d.ts +29 -0
  58. package/dist/components/loadpanel/load-panel-target.d.ts +3 -0
  59. package/dist/components/multiview/MultiView.d.ts +87 -0
  60. package/dist/components/multiview/View.d.ts +41 -0
  61. package/dist/components/multiview/index.d.ts +6 -0
  62. package/dist/components/multiview/multi-view-props.d.ts +24 -0
  63. package/dist/components/multiview/view-props.d.ts +15 -0
  64. package/dist/components/multiview/view-selecting-event-args.d.ts +15 -0
  65. package/dist/components/multiview/view-selection-changed-event-args.d.ts +12 -0
  66. package/dist/components/numberbox/number-box-props.d.ts +1 -1
  67. package/dist/components/popover/Popover.d.ts +98 -0
  68. package/dist/components/popover/index.d.ts +5 -0
  69. package/dist/components/popover/popover-close-reason.d.ts +2 -0
  70. package/dist/components/popover/popover-closing-event-args.d.ts +8 -0
  71. package/dist/components/popover/popover-props.d.ts +39 -0
  72. package/dist/components/popover/popover-show-on.d.ts +2 -0
  73. package/dist/components/resizable/Resizable.d.ts +84 -0
  74. package/dist/components/resizable/index.d.ts +3 -0
  75. package/dist/components/resizable/resizable-props.d.ts +41 -0
  76. package/dist/components/resizable/resize-event-args.d.ts +13 -0
  77. package/dist/components/scheduler/AppointmentEditor.d.ts +1 -1
  78. package/dist/components/scheduler/scheduler-props.d.ts +1 -1
  79. package/dist/components/scrollview/ScrollView.d.ts +109 -0
  80. package/dist/components/scrollview/index.d.ts +7 -0
  81. package/dist/components/scrollview/pull-down-event-args.d.ts +9 -0
  82. package/dist/components/scrollview/reach-bottom-event-args.d.ts +9 -0
  83. package/dist/components/scrollview/scroll-event-args.d.ts +7 -0
  84. package/dist/components/scrollview/scroll-view-bars.d.ts +2 -0
  85. package/dist/components/scrollview/scroll-view-direction.d.ts +2 -0
  86. package/dist/components/scrollview/scroll-view-props.d.ts +31 -0
  87. package/dist/components/skeleton/Skeleton.d.ts +1 -1
  88. package/dist/components/sortable/Sortable.d.ts +106 -0
  89. package/dist/components/sortable/index.d.ts +5 -0
  90. package/dist/components/sortable/sortable-drag-event-args.d.ts +15 -0
  91. package/dist/components/sortable/sortable-drop-event-args.d.ts +11 -0
  92. package/dist/components/sortable/sortable-orientation.d.ts +2 -0
  93. package/dist/components/sortable/sortable-props.d.ts +34 -0
  94. package/dist/components/speeddial/SpeedDial.d.ts +129 -0
  95. package/dist/components/speeddial/index.d.ts +6 -0
  96. package/dist/components/speeddial/speed-dial-action-click-event-args.d.ts +9 -0
  97. package/dist/components/speeddial/speed-dial-action.d.ts +25 -0
  98. package/dist/components/speeddial/speed-dial-event-args.d.ts +8 -0
  99. package/dist/components/speeddial/speed-dial-props.d.ts +49 -0
  100. package/dist/components/speeddial/speed-dial-tooltip.d.ts +3 -0
  101. package/dist/components/splitter/SplitPane.d.ts +45 -0
  102. package/dist/components/splitter/Splitter.d.ts +116 -0
  103. package/dist/components/splitter/index.d.ts +6 -0
  104. package/dist/components/splitter/split-pane-props.d.ts +21 -0
  105. package/dist/components/splitter/splitter-collapse-event-args.d.ts +13 -0
  106. package/dist/components/splitter/splitter-props.d.ts +25 -0
  107. package/dist/components/splitter/splitter-resize-event-args.d.ts +10 -0
  108. package/dist/components/stepper/Stepper.d.ts +121 -0
  109. package/dist/components/stepper/Wizard.d.ts +112 -0
  110. package/dist/components/stepper/WizardStep.d.ts +44 -0
  111. package/dist/components/stepper/index.d.ts +13 -0
  112. package/dist/components/stepper/step-changed-event-args.d.ts +11 -0
  113. package/dist/components/stepper/step-changing-event-args.d.ts +18 -0
  114. package/dist/components/stepper/stepper-item.d.ts +20 -0
  115. package/dist/components/stepper/stepper-label-position.d.ts +2 -0
  116. package/dist/components/stepper/stepper-orientation.d.ts +1 -0
  117. package/dist/components/stepper/stepper-props.d.ts +32 -0
  118. package/dist/components/stepper/stepper-status.d.ts +2 -0
  119. package/dist/components/stepper/wizard-finishing-event-args.d.ts +7 -0
  120. package/dist/components/stepper/wizard-props.d.ts +48 -0
  121. package/dist/components/stepper/wizard-step-props.d.ts +32 -0
  122. package/dist/components/tabdocs/TabDocumentManager.d.ts +1 -1
  123. package/dist/components/tabs/Tabs.d.ts +2 -2
  124. package/dist/components/tileview/TileView.d.ts +128 -0
  125. package/dist/components/tileview/index.d.ts +6 -0
  126. package/dist/components/tileview/tile-click-event-args.d.ts +9 -0
  127. package/dist/components/tileview/tile-reorder-event-args.d.ts +11 -0
  128. package/dist/components/tileview/tile-selection-changed-event-args.d.ts +11 -0
  129. package/dist/components/tileview/tile-view-item.d.ts +18 -0
  130. package/dist/components/tileview/tile-view-props.d.ts +38 -0
  131. package/dist/components/timeline/Timeline.d.ts +113 -0
  132. package/dist/components/timeline/index.d.ts +5 -0
  133. package/dist/components/timeline/timeline-item-click-event-args.d.ts +9 -0
  134. package/dist/components/timeline/timeline-item.d.ts +24 -0
  135. package/dist/components/timeline/timeline-props.d.ts +30 -0
  136. package/dist/components/timeline/timeline-selection-changed-event-args.d.ts +11 -0
  137. package/dist/components/tooltip/Tooltip.d.ts +1 -1
  138. package/dist/components/treeview/TreeView.d.ts +1 -1
  139. package/dist/components/validationsummary/ValidationSummary.d.ts +56 -0
  140. package/dist/components/validationsummary/index.d.ts +3 -0
  141. package/dist/components/validationsummary/summary-item-click-event-args.d.ts +11 -0
  142. package/dist/components/validationsummary/validation-summary-props.d.ts +17 -0
  143. package/dist/core/control.d.ts +4 -4
  144. package/dist/core/flow-home.d.ts +6 -0
  145. package/dist/core/fold-text.d.ts +6 -0
  146. package/dist/core/ui-locale.d.ts +0 -2
  147. package/dist/core/ui-strings.d.ts +67 -0
  148. package/dist/generated/tokens.d.ts +7270 -4490
  149. package/dist/index.d.ts +17 -1
  150. package/dist/index.js +27131 -20490
  151. package/dist/index.js.map +1 -1
  152. package/dist/locales/en.json +59 -1
  153. package/dist/locales/tr.json +59 -1
  154. package/dist/parts/slide/slide-track-host.d.ts +19 -0
  155. package/dist/parts/slide/slide-track.d.ts +45 -0
  156. package/dist/styles.css +4916 -206
  157. package/dist/tokens/index.d.ts +7270 -4490
  158. package/dist/tokens/index.js +7270 -4490
  159. package/dist/tokens/index.js.map +1 -1
  160. package/dist/tr-C5IXRzAH.js +1233 -0
  161. package/dist/tr-C5IXRzAH.js.map +1 -0
  162. package/docs/accordion.md +9 -9
  163. package/docs/actionsheet.md +2 -2
  164. package/docs/avatar.md +5 -5
  165. package/docs/badge.md +6 -6
  166. package/docs/bottomsheet.md +6 -6
  167. package/docs/breadcrumb.md +4 -4
  168. package/docs/button.md +10 -10
  169. package/docs/buttongroup.md +5 -5
  170. package/docs/calendar.md +6 -6
  171. package/docs/card.md +6 -6
  172. package/docs/checkbox.md +9 -9
  173. package/docs/chip.md +5 -5
  174. package/docs/colorbox.md +3 -3
  175. package/docs/combobox.md +7 -7
  176. package/docs/control.md +12 -12
  177. package/docs/datagrid-api.md +7 -7
  178. package/docs/datagrid-bands.md +1 -1
  179. package/docs/datagrid-drag-select.md +2 -2
  180. package/docs/datagrid-drag.md +1 -1
  181. package/docs/datagrid-editing.md +2 -2
  182. package/docs/datagrid-filtering.md +3 -3
  183. package/docs/datagrid-forms.md +1 -1
  184. package/docs/datagrid-grouping.md +1 -1
  185. package/docs/datagrid-layout.md +4 -4
  186. package/docs/datagrid-lookups.md +1 -1
  187. package/docs/datagrid-master-detail.md +3 -3
  188. package/docs/datagrid-scrolling.md +1 -1
  189. package/docs/datagrid-selection.md +3 -3
  190. package/docs/datagrid.md +8 -8
  191. package/docs/datebox.md +8 -8
  192. package/docs/daterangebox.md +192 -0
  193. package/docs/draggable.md +194 -0
  194. package/docs/drawer.md +1 -1
  195. package/docs/dropdown.md +10 -10
  196. package/docs/fileuploader.md +201 -0
  197. package/docs/filterbuilder.md +9 -9
  198. package/docs/formlayout.md +1 -1
  199. package/docs/gallery.md +244 -0
  200. package/docs/home.md +11 -7
  201. package/docs/keyboard.md +1 -1
  202. package/docs/language.md +229 -0
  203. package/docs/layout.md +15 -15
  204. package/docs/listbox.md +10 -10
  205. package/docs/loadpanel.md +184 -0
  206. package/docs/lookup.md +1 -1
  207. package/docs/menus.md +2 -2
  208. package/docs/multiview.md +202 -0
  209. package/docs/numberbox.md +9 -9
  210. package/docs/pagination.md +4 -4
  211. package/docs/popover.md +221 -0
  212. package/docs/progress.md +9 -9
  213. package/docs/radiogroup.md +7 -7
  214. package/docs/rating.md +4 -4
  215. package/docs/resizable.md +139 -0
  216. package/docs/scheduler-agenda.md +1 -1
  217. package/docs/scheduler-big-data.md +1 -1
  218. package/docs/scheduler-editing.md +5 -5
  219. package/docs/scheduler-form.md +1 -1
  220. package/docs/scheduler-icalendar.md +1 -1
  221. package/docs/scheduler-mobile.md +1 -1
  222. package/docs/scheduler-recurrence.md +2 -2
  223. package/docs/scheduler-resources.md +1 -1
  224. package/docs/scheduler-timeline.md +1 -1
  225. package/docs/scheduler.md +4 -4
  226. package/docs/scrollview.md +185 -0
  227. package/docs/showcase.md +1 -1
  228. package/docs/skeleton.md +2 -2
  229. package/docs/slider.md +9 -9
  230. package/docs/sortable.md +213 -0
  231. package/docs/speeddial.md +290 -0
  232. package/docs/splitter.md +204 -0
  233. package/docs/stepper.md +238 -0
  234. package/docs/switch.md +7 -7
  235. package/docs/tabdocs-dock.md +3 -3
  236. package/docs/tabdocs-drag.md +1 -1
  237. package/docs/tabdocs-menus.md +1 -1
  238. package/docs/tabdocs-mobile.md +1 -1
  239. package/docs/tabdocs-tabs.md +1 -1
  240. package/docs/tabdocs-windows.md +1 -1
  241. package/docs/tabdocs-workspace.md +1 -1
  242. package/docs/tabdocs.md +5 -5
  243. package/docs/tabs.md +11 -11
  244. package/docs/tagbox.md +10 -10
  245. package/docs/textarea.md +9 -9
  246. package/docs/textbox.md +10 -10
  247. package/docs/tileview.md +206 -0
  248. package/docs/timeline.md +174 -0
  249. package/docs/toast.md +7 -7
  250. package/docs/tokens.md +678 -122
  251. package/docs/toolbar.md +8 -8
  252. package/docs/tooltip.md +12 -12
  253. package/docs/treeview.md +11 -11
  254. package/docs/validationsummary.md +115 -0
  255. package/docs/window.md +7 -7
  256. package/docs/wizard.md +240 -0
  257. package/llms-full.txt +4813 -492
  258. package/llms.txt +21 -3
  259. package/package.json +9 -3
@@ -0,0 +1,238 @@
1
+ # Stepper
2
+
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.3
4
+
5
+ The steps of a longer task and where the user stands in them: an indicator and a text per step, a line between them, the steps before the current one completed. The [Wizard](wizard.md) adds a page and the buttons to each step.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { Stepper } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Declarative and programmatic
14
+
15
+ The current step is `value`: a step’s `key`, else its index; `x-model` binds it two-way. Programmatically, `next()`, `previous()` and `goTo()` move it and `onStepChanged` tells.
16
+
17
+ ```tsx
18
+ import { reactive } from '@motifx/core';
19
+ import { Button, Stack, Stepper } from '@motifx-community/ui';
20
+
21
+ /** A stepper bound with x-model, and one made programmatically and moved with its own methods. */
22
+ export default function Programmatic() {
23
+ const s = reactive({ step: 0 as string | number | null, at: 0, told: '' });
24
+ const coded = new Stepper({
25
+ label: 'Order',
26
+ items: ['Cart', 'Address', 'Payment', 'Done'],
27
+ linear: false,
28
+ onStepChanged: e => {
29
+ s.at = e.index;
30
+ s.told = `Step ${e.index + 1}${e.byUser ? ', pressed' : ''}`;
31
+ }
32
+ });
33
+
34
+ return (
35
+ <Stack gap="lg" style="inline-size: 100%">
36
+ <Stepper label="Sign up" items={['Account', 'Profile', 'Review']} x-model={() => s.step} />
37
+ <output class="st-value">{() => `value: ${JSON.stringify(s.step)}`}</output>
38
+ <span onConfig={c => c.controls.add(coded)} />
39
+ <Stack orientation="horizontal" wrap align="center">
40
+ <Button text="Back" variant="outline" enabled={() => s.at > 0} onclick={() => void coded.previous()} />
41
+ <Button text="Next" variant="outline" enabled={() => s.at < 3} onclick={() => void coded.next()} />
42
+ <output class="st-told">{() => s.told}</output>
43
+ </Stack>
44
+ </Stack>
45
+ );
46
+ }
47
+ ```
48
+
49
+ ## Statuses
50
+
51
+ The steps before the current one are completed by themselves. An item may say `status: 'done'` or `'error'` whatever the current step is, be `optional`, be disabled, or carry an `icon` in place of its number; its fields may be functions of your state.
52
+
53
+ | Status | How |
54
+ | --- | --- |
55
+ | `pending` | A step to come: its number in the indicator. |
56
+ | `current` | The step in hand: `aria-current="step"`. |
57
+ | `done` | The steps before the current one, and any step whose item says `status: 'done'`: a check in the indicator, the line before it filled. |
58
+ | `error` | A step whose item says `status: 'error'`: a mark in the indicator, the text in the danger colour; read out as “Needs attention”. |
59
+ | `optional` | Says “Optional” under the text; in linear order it may be skipped. |
60
+ | `disabled` | An item with `enabled: false`, or a step linear order does not reach yet: `aria-disabled`, out of the Tab order. |
61
+
62
+ ```tsx
63
+ import { reactive } from '@motifx/core';
64
+ import { Button, Stack, Stepper } from '@motifx-community/ui';
65
+
66
+ const pencil = () => {
67
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
68
+ svg.setAttribute('viewBox', '0 0 16 16');
69
+ svg.setAttribute('aria-hidden', 'true');
70
+ svg.innerHTML = '<path d="M11.5 2.5l2 2L5 13H3v-2z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>';
71
+ return svg;
72
+ };
73
+
74
+ /** Completed and failed steps told by the items, an optional step, a disabled one, an icon in place of the number. */
75
+ export default function Statuses() {
76
+ const s = reactive({ paid: false });
77
+ const items = [
78
+ { text: 'Cart', status: 'done' as const },
79
+ { text: 'Address', description: 'Checked', status: 'done' as const },
80
+ { text: 'Payment', description: () => (s.paid ? 'Paid' : 'Card declined'), status: () => (s.paid ? 'done' : 'error') },
81
+ { text: 'Gift note', optional: true, icon: pencil() },
82
+ { text: 'Pick-up', enabled: false },
83
+ { text: 'Done' }
84
+ ];
85
+ return (
86
+ <Stack gap="md" style="inline-size: 100%">
87
+ <Stepper label="Statuses" items={items} value={5} linear={false} />
88
+ <Button text={() => (s.paid ? 'Decline the card' : 'Take the payment')} variant="outline" onclick={() => (s.paid = !s.paid)} />
89
+ </Stack>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ## In order, or free
95
+
96
+ `linear` (the default) lets a press reach only the completed steps and the next one; `linear={false}` lets it reach any. Either way `onStepChanging` is asked first: `cancel` keeps the step, a `promise` waits for a check or a server.
97
+
98
+ ```tsx
99
+ import { reactive } from '@motifx/core';
100
+ import { CheckBox, Stack, Stepper } from '@motifx-community/ui';
101
+
102
+ /** In linear order a step is reached only after the ones before it; `onStepChanging` refuses a step while the box is unchecked. */
103
+ export default function Linear() {
104
+ const s = reactive({ step: 0 as string | number | null, agreed: false, note: '' });
105
+ return (
106
+ <Stack gap="md" style="inline-size: 100%">
107
+ <Stepper
108
+ label="In order"
109
+ items={['Terms', 'Details', 'Confirm']}
110
+ x-model={() => s.step}
111
+ onStepChanging={e => {
112
+ if (e.to > 0 && !s.agreed) {
113
+ e.cancel = true;
114
+ s.note = 'Accept the terms first.';
115
+ } else {
116
+ s.note = '';
117
+ }
118
+ }}
119
+ />
120
+ <CheckBox label="I accept the terms" x-model={() => s.agreed} />
121
+ <output class="st-note">{() => s.note}</output>
122
+ </Stack>
123
+ );
124
+ }
125
+ ```
126
+
127
+ ## Orientations
128
+
129
+ ```tsx
130
+ import { Stack, Stepper } from '@motifx-community/ui';
131
+
132
+ const STEPS = [
133
+ { text: 'Details', description: 'Name and e-mail' },
134
+ { text: 'Address', description: 'Where to send it' },
135
+ { text: 'Payment', description: 'Card or transfer' },
136
+ { text: 'Review' }
137
+ ];
138
+
139
+ /** Horizontal with the texts under or after the indicators, and vertical. */
140
+ export default function Orientations() {
141
+ return (
142
+ <Stack gap="lg" style="inline-size: 100%">
143
+ <Stepper label="Texts under" items={STEPS} value={1} linear={false} />
144
+ <Stepper label="Texts after" items={STEPS.slice(0, 3)} value={1} labelPosition="end" linear={false} />
145
+ <div style="inline-size: 18rem">
146
+ <Stepper label="Standing" items={STEPS} value={1} orientation="vertical" linear={false} />
147
+ </div>
148
+ </Stack>
149
+ );
150
+ }
151
+ ```
152
+
153
+ ## Sizes
154
+
155
+ ```tsx
156
+ import { Stack, Stepper } from '@motifx-community/ui';
157
+
158
+ const STEPS = ['Plan', 'Build', 'Ship'];
159
+
160
+ /** Three sizes, and a stepper without numbers. */
161
+ export default function Sizes() {
162
+ return (
163
+ <Stack gap="lg" style="inline-size: 100%">
164
+ <Stepper label="Small" items={STEPS} value={1} size="sm" linear={false} />
165
+ <Stepper label="Medium" items={STEPS} value={1} linear={false} />
166
+ <Stepper label="Large" items={STEPS} value={1} size="lg" linear={false} />
167
+ <Stepper label="Dots" items={STEPS} value={1} showNumbers={false} size="sm" labelPosition="end" linear={false} />
168
+ </Stack>
169
+ );
170
+ }
171
+ ```
172
+
173
+ ## Keyboard
174
+
175
+ | Key | What it does |
176
+ | --- | --- |
177
+ | `Tab` | One stop: the step focused last, else the current one, else the first that can be reached. |
178
+ | `Arrow keys` | Left and Right (Up and Down standing) move between the steps that can be reached, around the ends; Home and End go to the first and the last. |
179
+ | `Enter, Space` | Choose the focused step; `onStepChanging` may refuse. |
180
+
181
+ ## Accessibility
182
+
183
+ | Topic | How |
184
+ | --- | --- |
185
+ | `Landmark` | A `nav` named “Steps” in the kit language, holding an ordered list; several on one page: give each its own `label`. |
186
+ | `A step` | A button whose name reads “Step 2 of 4, Address, Where to send it, Completed”: the position, the texts and the status are all in it. |
187
+ | `Not clickable` | Plain elements: nothing to press, the current one still `aria-current`. |
188
+ | `Lines and marks` | Decorative, hidden from readers. |
189
+
190
+ ## Styling
191
+
192
+ | Hook | What it is |
193
+ | --- | --- |
194
+ | `.mx-stepper` | The stepper. `data-orientation`, `data-labels`, `data-size`. |
195
+ | `.mx-stepper__list, .mx-stepper__item` | The list and each step with its line. `data-status` on the item. |
196
+ | `.mx-stepper__step` | The step: a button or a div. `data-status`, `aria-current`, `aria-disabled`. |
197
+ | `.mx-stepper__indicator, .mx-stepper__number, .mx-stepper__mark, .mx-stepper__icon` | The circle, the number in it, the check or error mark, an icon of your own. |
198
+ | `.mx-stepper__label, .mx-stepper__description, .mx-stepper__note` | The texts. |
199
+ | `.mx-stepper__line` | The line to the next step. `data-status="done"` up to the current one. |
200
+
201
+ ### Component tokens
202
+
203
+ | Token | What it sets |
204
+ | --- | --- |
205
+ | `stepper.step, .indicator, .mark, .label, .description, .note, .line` | Units: the step (`hover`, `pressed`, `focus`, `disabled`, `current`, `done`, `error`), its indicator, the mark (`icon` per state), the texts, the line (`done`); the line turns a quarter in a vertical stepper. |
206
+ | `stepper.size.*, .font-size.*, .padding.*` | The indicator, the text and the space around a step, per size. |
207
+ | `stepper.description-font-size, .gap, .line-gap, .line-min-length` | The second line, the space between indicator and texts, and the line’s margins and least length. |
208
+
209
+ ## API reference
210
+
211
+ ### Props
212
+
213
+ | Prop | Type | Default | Description |
214
+ | --- | --- | --- | --- |
215
+ | `items` | `Bind<readonly (StepperItem \| string)[]>` | `[]` | The steps in order: `StepperItem`s (`text`, `description`, `key`, `icon`, `status`, `optional`, `enabled`, `data`) or plain texts. |
216
+ | `value` | `Bind<string \| number \| null>` | `0` | The current step: its `key`, else its index; `null` for none. `x-model` binds it two-way. |
217
+ | `linear` | `Bind<boolean>` | `true` | A press reaches a completed step, or the one right after the last completed; optional steps may be skipped. |
218
+ | `orientation` | `Bind<StepperOrientation>` | `'horizontal'` | `horizontal` or `vertical`. |
219
+ | `labelPosition` | `Bind<StepperLabelPosition>` | `'bottom'` | Horizontal only: the texts under the indicator (`bottom`) or after it (`end`). |
220
+ | `size` | `Bind<ControlSize>` | `'md'` | `sm`, `md`, `lg`. |
221
+ | `clickable` | `Bind<boolean>` | `true` | `false` shows the way only: no buttons, no Tab stop. |
222
+ | `showNumbers` | `Bind<boolean>` | `true` | The indicator of a step to come shows its number. |
223
+ | `label` | `Bind<string>` | the kit’s “Steps” | What screen readers call it. |
224
+
225
+ ### Events, properties and methods
226
+
227
+ | Member | Kind | Description |
228
+ | --- | --- | --- |
229
+ | `onStepChanging` | event | The current step is about to change (`from`, `to`, `fromItem`, `toItem`, `byUser`). `cancel = true` keeps it; `promise` set to a `Promise<boolean>` waits, and the step changes when it resolves to `true`. |
230
+ | `onStepChanged` | event | The current step changed (`index`, `item`, `previous`, `byUser`). |
231
+ | `selectedIndex` | read-only | The index of the current step; -1 when there is none. |
232
+ | `count` | read-only | How many steps there are. |
233
+ | `canGoNext, canGoPrevious` | read-only | There is an enabled step after, or before, the current one. |
234
+ | `next(), previous()` | `Promise<boolean>` | Goes to the next or the previous enabled step; `false` when there is none or the change was refused. |
235
+ | `goTo(step)` | `Promise<boolean>` | Goes to a step by index or key, whatever the order; `onStepChanging` is asked first. |
236
+ | `statusOf(index)` | `StepperStatus` | `pending`, `current`, `done` or `error`, as drawn. |
237
+ | `canReach(index)` | `boolean` | Whether a press may reach the step. |
238
+ | `refresh()` | `void` | Reads the items again after they were changed in place. |
package/docs/switch.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Switch
2
2
 
3
- > Choice · @motifx-community/ui 0.1.0-beta.1
3
+ > Choice · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  An on / off switch with its caption: a track with a thumb that slides, an optional on / off text inside or next to it, read-only and required. A native checkbox with the switch role underneath.
6
6
 
@@ -10,21 +10,21 @@ An on / off switch with its caption: a track with a thumb that slides, an option
10
10
  import { Switch } from '@motifx-community/ui';
11
11
  ```
12
12
 
13
- ## From JSX and from code
13
+ ## Declarative and programmatic
14
14
 
15
- Every prop takes a value or a function; `x-model` binds the value two-way. Created with `new`, the same properties are set from code.
15
+ Every prop takes a value or a function; `x-model` binds the value two-way. Created with `new`, the same properties are set programmatically.
16
16
 
17
17
  ```tsx
18
18
  import { reactive } from '@motifx/core';
19
19
  import { Button, Stack, Switch } from '@motifx-community/ui';
20
20
 
21
- /** A switch bound to state with x-model, and switches created with `new` and added from code. */
22
- export default function FromCode() {
21
+ /** A switch bound to state with x-model, and switches created with `new` and added programmatically. */
22
+ export default function Programmatic() {
23
23
  const s = reactive({ wifi: true, result: '' });
24
24
  let added = 0;
25
25
  let host: Stack | null = null;
26
26
 
27
- const addFromCode = () => {
27
+ const addProgrammatic = () => {
28
28
  const sw = new Switch({ label: `Feature ${++added}`, onText: 'On', offText: 'Off' });
29
29
  sw.onValueChanged((e) => (s.result = `${sw.label}: ${e.value ? 'on' : 'off'}`));
30
30
  host?.controls.add(sw);
@@ -35,7 +35,7 @@ export default function FromCode() {
35
35
  <>
36
36
  <Switch label="&Wi-Fi" x-model={() => s.wifi} helpText={() => (s.wifi ? 'Connected to Home.' : 'Not connected.')} />
37
37
  <Stack orientation="horizontal" wrap align="center">
38
- <Button text="Add a switch from code" variant="outline" onclick={addFromCode} />
38
+ <Button text="Add a switch programmatically" variant="outline" onclick={addProgrammatic} />
39
39
  <output class="sw-result">{() => s.result}</output>
40
40
  </Stack>
41
41
  <Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Dock and floating windows
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  Documents and whole groups float in windows of their own in the page and dock again into the documents' groups or into dock areas around them, which fold to the manager's edge. The mouse, the keys and the code do the same, through the same events.
6
6
 
@@ -568,14 +568,14 @@ export function fileDocument(path: string, extra: TabDocumentOptions = {}): TabD
568
568
  }
569
569
  ```
570
570
 
571
- `FloatFromCode.tsx`
571
+ `FloatProgrammatically.tsx`
572
572
 
573
573
  ```tsx
574
574
  import { Button, Stack, TabDocumentManager } from '@motifx-community/ui';
575
575
  import { FILES, fileDocument } from './files';
576
576
 
577
577
  /** Floating windows by code: float a document, move, resize and maximize its window, dock it back or to a side, close it. */
578
- export default function FloatFromCode() {
578
+ export default function FloatProgrammatically() {
579
579
  const docs = new TabDocumentManager({ label: 'Files to float' });
580
580
  docs.element.style.cssText = 'block-size: 28rem; inline-size: 100%';
581
581
  for (const file of FILES.slice(0, 5)) docs.open(fileDocument(file.path), { index: 99 });
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Drag and drop
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  Tabs and whole groups dragged as in a code editor: along a strip, to another group, beside a group or along an edge of the layout, between two managers, and the same moves from the keyboard. Every drop goes through the methods and events of what it does.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Menus and keys
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  The commands around the tabs: context menus on tabs and on the empty strip, a searchable list of a group's documents, the app's own toolbar buttons, the recently used list, back and forward, reopening what was closed, locked groups, and the keys for all of them.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Tablet and phone
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  On a tablet and a phone a layout of groups, splits and dock areas does not fit as it is. The manager keeps the layout and shows it another way: the same documents, groups and areas, the same saved JSON, the content moved and never made again. It goes by its own width, not by the device; on a touch screen its tabs and buttons get larger.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Tabs
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  What a tab does in a code editor: preview tabs that the next preview replaces, pinned tabs that stay at the start, tabs that shrink, wrap or scroll, counts and colours, and the same document open in two groups.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: New windows
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  A document, a group or a floating window moves into a browser window of its own, and back. Its content moves with it, nothing is made again, and the new window is a part of the same manager: its tabs, menus, keys and drag work as they do here.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: A whole workspace
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  A whole screen made of the kit's parts: a menu bar, the manager, a DataGrid with everything turned on, forms and a tool docked at the bottom. Each part is the same component it is on its own page; the manager only holds them.
6
6
 
package/docs/tabdocs.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.1
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  A document manager in the way code editors arrange files: documents in tabs, tabs in groups, groups split side by side and one under the other. A document's content is any component, a form, a grid or plain text, and it is moved, never made again, when its tab goes to another group. Everything the user does is a method too, asks first and reports after; the whole layout saves to JSON and comes back. Preview and pinned tabs, sizes and copies are on [Tabs](tabdocs-tabs.md); context menus, lists and keys on [Menus and keys](tabdocs-menus.md).
6
6
 
@@ -131,7 +131,7 @@ export function customerCard(customer: Customer): ComponentBase {
131
131
  }
132
132
  ```
133
133
 
134
- ## From code, and the events
134
+ ## Programmatic use, and the events
135
135
 
136
136
  Each thing the user does is also a method (`open`, `close`, `activate`, `split`, `move`, `closeGroup`, `focusGroup`, `maximizeGroup`, `restoreGroups`, `evenSizes`, `resizeGroup`), asks first through a cancelable `on…ing` event and reports through `on…ed`, with `byUser` telling the two apart.
137
137
 
@@ -731,7 +731,7 @@ export default function Options() {
731
731
  }
732
732
  ```
733
733
 
734
- `FromCode.tsx`
734
+ `Programmatic.tsx`
735
735
 
736
736
  ```tsx
737
737
  import { reactive } from '@motifx/core';
@@ -739,14 +739,14 @@ import { Button, Stack, TabDocumentManager, type SplitDirection } from '@motifx-
739
739
  import { notes } from './contents';
740
740
 
741
741
  /** Everything the user does is a method too; the events report each change, by the user or by code. */
742
- export default function FromCode() {
742
+ export default function Programmatic() {
743
743
  const log = reactive({ lines: [] as { id: number; text: string }[], next: 0, opened: 0 });
744
744
  const write = (text: string) => {
745
745
  log.lines.unshift({ id: log.next++, text });
746
746
  if (log.lines.length > 6) log.lines.pop();
747
747
  };
748
748
 
749
- const docs = new TabDocumentManager({ label: 'Driven from code' });
749
+ const docs = new TabDocumentManager({ label: 'Driven programmatically' });
750
750
  docs.element.style.cssText = 'block-size: 28rem; inline-size: 100%';
751
751
  docs.onOpened((e) => write(`opened ${e.document.title} in group ${e.group.index + 1}`));
752
752
  docs.onClosed((e) => write(`closed ${e.document.title}${e.byUser ? ' (user)' : ''}`));
package/docs/tabs.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Tabs
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.1
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
- Tabs show one panel at a time under a strip of tabs: from JSX or from code, closable, with icons and badges, scroll buttons when the tabs do not fit, four placements and panels built when they are first shown.
5
+ Tabs show one panel at a time under a strip of tabs: from JSX or programmatically, closable, with icons and badges, scroll buttons when the tabs do not fit, four placements and panels built when they are first shown.
6
6
 
7
7
  ## Import
8
8
 
@@ -10,22 +10,22 @@ Tabs show one panel at a time under a strip of tabs: from JSX or from code, clos
10
10
  import { Tabs, Tab } from '@motifx-community/ui';
11
11
  ```
12
12
 
13
- ## From JSX and from code
13
+ ## Declarative and programmatic
14
14
 
15
- A `<Tab>`'s children are its panel. `value` is the selected tab's `key` (else its index) and `x-model` binds it two-way. Created with `new`, tabs are added, inserted and removed from code.
15
+ A `<Tab>`'s children are its panel. `value` is the selected tab's `key` (else its index) and `x-model` binds it two-way. Created with `new`, tabs are added, inserted and removed programmatically.
16
16
 
17
17
  ```tsx
18
18
  import { reactive } from '@motifx/core';
19
19
  import { Button, Stack, Tab, Tabs, TextBox } from '@motifx-community/ui';
20
20
 
21
- /** Tabs from JSX bound with x-model, and tabs created with `new` and added from code. */
22
- export default function FromCode() {
21
+ /** Tabs from JSX bound with x-model, and tabs created with `new` and added programmatically. */
22
+ export default function Programmatic() {
23
23
  const s = reactive({ page: 'general' as string | number, name: '', log: '' });
24
24
  let added = 0;
25
25
 
26
26
  const reports = new Tabs({ label: 'Reports', closable: true });
27
27
  reports.add(new Tab({ title: 'Summary', content: () => <p>The summary, built when it was first shown.</p> }));
28
- reports.onSelectionChanged((e) => (s.log = e.tab ? `Selected “${e.tab.title}”${e.byUser ? ' by the user' : ' from code'}.` : 'No tab left.'));
28
+ reports.onSelectionChanged((e) => (s.log = e.tab ? `Selected “${e.tab.title}”${e.byUser ? ' by the user' : ' programmatically'}.` : 'No tab left.'));
29
29
 
30
30
  const addReport = () => {
31
31
  const n = ++added;
@@ -48,7 +48,7 @@ export default function FromCode() {
48
48
  </Tabs>
49
49
  <output class="tabs-page">{() => `value: "${s.page}"`}</output>
50
50
  <Stack orientation="horizontal" wrap align="center">
51
- <Button text="Add a report from code" variant="outline" onclick={addReport} />
51
+ <Button text="Add a report programmatically" variant="outline" onclick={addReport} />
52
52
  <output class="tabs-log">{() => s.log}</output>
53
53
  </Stack>
54
54
  <Stack orientation="horizontal" wrap align="center" class="tabs-coded" style="inline-size: 100%" onBuilt={(c) => c.controls.add(reports)} />
@@ -346,7 +346,7 @@ Tabs write one text: the close button's tooltip, `uiLocale.strings.close`. Every
346
346
 
347
347
  ```tsx
348
348
  import { reactive } from '@motifx/core';
349
- import { Button, enStrings, trStrings, uiLocale } from '@motifx-community/ui';
349
+ import { Button, uiLocale } from '@motifx-community/ui';
350
350
  import { kitTexts } from '../../../shared/kit-texts';
351
351
 
352
352
  /** Switches the texts of every component on the page, the tabs' close button included. */
@@ -354,7 +354,7 @@ export default function Localization() {
354
354
  const s = reactive({ lang: 'en' });
355
355
  const toggle = () => {
356
356
  s.lang = s.lang === 'en' ? 'tr' : 'en';
357
- uiLocale.strings = s.lang === 'en' ? enStrings : trStrings;
357
+ void uiLocale.use(s.lang);
358
358
  };
359
359
  return (
360
360
  <>
@@ -442,7 +442,7 @@ export default function Localization() {
442
442
  | `add(tab)` | `Tab` | Adds a tab at the end. A tab of another `Tabs` moves here. |
443
443
  | `insert(index, tab)` | `Tab` | Adds a tab at an index. |
444
444
  | `remove(tab)` | `boolean` | Removes the tab and disposes it; no `onClose`. The selection and focus move to a neighbour. |
445
- | `select(tab \| index)` | `boolean` | Selects a tab from code; `false` when it is hidden or not there. |
445
+ | `select(tab \| index)` | `boolean` | Selects a tab programmatically; `false` when it is hidden or not there. |
446
446
  | `close(tab)` | `boolean` | Closes a tab as its close button does: `onClose` can cancel it. |
447
447
  | `focus()` | `boolean` | Focuses the selected tab. |
448
448
  | `Tab.select(), Tab.close(), Tab.focus()` | `boolean` | The same, from the tab. |
package/docs/tagbox.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TagBox
2
2
 
3
- > Data · @motifx-community/ui 0.1.0-beta.1
3
+ > Data · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  Picks several items. The chosen ones are tags in the field, followed by a text input that searches the list; items come from memory or from a data source, and typed text can become a tag of its own.
6
6
 
@@ -11,9 +11,9 @@ import { TagBox } from '@motifx-community/ui';
11
11
  import { data } from '@motifx-community/data';
12
12
  ```
13
13
 
14
- ## From JSX and from code
14
+ ## Declarative and programmatic
15
15
 
16
- `x-model` binds an array; every change writes a new one. Created with `new`, the same properties are set from code.
16
+ `x-model` binds an array; every change writes a new one. Created with `new`, the same properties are set programmatically.
17
17
 
18
18
  ```tsx
19
19
  /** The skills the tag boxes of the examples pick from. */
@@ -265,20 +265,20 @@ export const skills = ['CSS', 'Go', 'HTML', 'Java', 'JavaScript', 'Kotlin', 'Pyt
265
265
 
266
266
  ## Example files
267
267
 
268
- `FromCode.tsx`
268
+ `Programmatic.tsx`
269
269
 
270
270
  ```tsx
271
271
  import { reactive } from '@motifx/core';
272
272
  import { Button, Stack, TagBox } from '@motifx-community/ui';
273
273
  import { skills } from './skills';
274
274
 
275
- /** A tag box bound to an array with x-model, and tag boxes created with `new` and added from code. */
276
- export default function FromCode() {
275
+ /** A tag box bound to an array with x-model, and tag boxes created with `new` and added programmatically. */
276
+ export default function Programmatic() {
277
277
  const form = reactive({ skills: ['TypeScript', 'CSS'] as string[], result: '' });
278
278
  let added = 0;
279
279
  let host: Stack | null = null;
280
280
 
281
- const addFromCode = () => {
281
+ const addProgrammatic = () => {
282
282
  const tags = new TagBox<string, string>({ label: `Skills ${++added}`, items: skills, placeholder: 'Pick some' });
283
283
  tags.onValueChanged((e) => (form.result = `${tags.label}: ${e.value.join(', ')}`));
284
284
  host?.controls.add(tags);
@@ -290,7 +290,7 @@ export default function FromCode() {
290
290
  <TagBox label="&Skills" items={skills} x-model={() => form.skills} stretch />
291
291
  <Stack orientation="horizontal" wrap align="center">
292
292
  <output class="tg-skills">{() => `skills: ${JSON.stringify(form.skills)}`}</output>
293
- <Button text="Add a tag box from code" variant="outline" onclick={addFromCode} />
293
+ <Button text="Add a tag box programmatically" variant="outline" onclick={addProgrammatic} />
294
294
  <output class="tg-made">{() => form.result}</output>
295
295
  </Stack>
296
296
  <Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
@@ -341,7 +341,7 @@ export default function Validation() {
341
341
 
342
342
  ```tsx
343
343
  import { reactive } from '@motifx/core';
344
- import { Button, TagBox, enStrings, trStrings, uiLocale } from '@motifx-community/ui';
344
+ import { Button, TagBox, uiLocale } from '@motifx-community/ui';
345
345
  import { skills } from './skills';
346
346
 
347
347
  /** Switches the texts of every tag box on the page: remove buttons, “+3”, “Select all”. */
@@ -349,7 +349,7 @@ export default function Localization() {
349
349
  const s = reactive({ lang: 'en' });
350
350
  const toggle = () => {
351
351
  s.lang = s.lang === 'en' ? 'tr' : 'en';
352
- uiLocale.strings = s.lang === 'en' ? enStrings : trStrings;
352
+ void uiLocale.use(s.lang);
353
353
  };
354
354
  return (
355
355
  <>
package/docs/textarea.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TextArea
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.1
3
+ > Editors · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  A text field of several lines: a box that grows with the text or that the user drags bigger, a character counter, a clear button, Ctrl+Enter to send, and the label, help text and validation every field has.
6
6
 
@@ -10,21 +10,21 @@ A text field of several lines: a box that grows with the text or that the user d
10
10
  import { TextArea, type TextAreaProps } from '@motifx-community/ui';
11
11
  ```
12
12
 
13
- ## From JSX and from code
13
+ ## Declarative and programmatic
14
14
 
15
- Every prop takes a value or a function; `x-model` binds the text two-way. Created with `new`, the same properties are set from code.
15
+ Every prop takes a value or a function; `x-model` binds the text two-way. Created with `new`, the same properties are set programmatically.
16
16
 
17
17
  ```tsx
18
18
  import { reactive } from '@motifx/core';
19
19
  import { Button, Stack, TextArea } from '@motifx-community/ui';
20
20
 
21
- /** A textarea bound with x-model, and notes created with `new` and added from code. */
22
- export default function FromCode() {
21
+ /** A textarea bound with x-model, and notes created with `new` and added programmatically. */
22
+ export default function Programmatic() {
23
23
  const s = reactive({ comment: 'MotifJS keeps the DOM it builds.', log: '' });
24
24
  let added = 0;
25
25
  let host: Stack | null = null;
26
26
 
27
- const addFromCode = () => {
27
+ const addProgrammatic = () => {
28
28
  const note = new TextArea({ label: `Note ${++added}`, rows: 2, autoGrow: true, maxRows: 5, clearButton: true });
29
29
  note.onValueChanged((e) => (s.log = `${note.label}: ${e.value.split('\n').length} line(s)`));
30
30
  host?.controls.add(note);
@@ -35,7 +35,7 @@ export default function FromCode() {
35
35
  <>
36
36
  <TextArea label="&Comment" x-model={() => s.comment} helpText={() => `${s.comment.length} characters`} stretch />
37
37
  <Stack orientation="horizontal" wrap align="center">
38
- <Button text="Add a note from code" variant="outline" onclick={addFromCode} />
38
+ <Button text="Add a note programmatically" variant="outline" onclick={addProgrammatic} />
39
39
  <output class="ta-log">{() => s.log}</output>
40
40
  </Stack>
41
41
  <Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
@@ -217,7 +217,7 @@ The name of the clear button and the validation messages come from `uiLocale.str
217
217
 
218
218
  ```tsx
219
219
  import { reactive } from '@motifx/core';
220
- import { Button, enStrings, trStrings, uiLocale } from '@motifx-community/ui';
220
+ import { Button, uiLocale } from '@motifx-community/ui';
221
221
  import { kitTexts } from '../../../shared/kit-texts';
222
222
 
223
223
  /** Switches the texts of every field on the page, the clear button's name included. */
@@ -225,7 +225,7 @@ export default function Localization() {
225
225
  const s = reactive({ lang: 'en' });
226
226
  const toggle = () => {
227
227
  s.lang = s.lang === 'en' ? 'tr' : 'en';
228
- uiLocale.strings = s.lang === 'en' ? enStrings : trStrings;
228
+ void uiLocale.use(s.lang);
229
229
  };
230
230
  return (
231
231
  <>