@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
package/docs/layout.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Layout
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
5
  Containers that place controls: `Stack` (a row or a column), `Grid` (rows and columns), `Panel` (a plain box that can scroll), `GroupBox` (a titled frame), `DockPanel` (children stuck to its edges) and `SplitContainer` (two panes and a splitter). All of them are controls: they disable and hide what is inside, and lay out children added at any time.
6
6
 
@@ -10,7 +10,7 @@ Containers that place controls: `Stack` (a row or a column), `Grid` (rows and co
10
10
  import { Stack, Grid, Panel, GroupBox, DockPanel, SplitContainer, type LayoutSpace } from '@motifx-community/ui';
11
11
  ```
12
12
 
13
- ## From JSX and from code
13
+ ## Declarative and programmatic
14
14
 
15
15
  Children come as JSX or are added later with `controls.add`; either way the container picks them up. A child says where it goes in its own props (`grow`, `row`, `dock`…), whatever kind of component it is.
16
16
 
@@ -19,13 +19,13 @@ import type { Component } from '@motifx/core';
19
19
  import { Button, Grid, Stack, TextBox } from '@motifx-community/ui';
20
20
 
21
21
  /** Buttons added to a Stack with `controls.add`, and a Grid built with `new`. */
22
- export default function FromCode() {
22
+ export default function Programmatic() {
23
23
  let added = 0;
24
24
  let bar: Stack | null = null;
25
25
 
26
26
  const addButton = () => bar?.controls.add(new Button({ text: `Button ${++added}`, variant: 'outline', grow: added % 3 === 0 }));
27
27
 
28
- const buildFromCode = (host: Component<HTMLDivElement>) => {
28
+ const buildProgrammatic = (host: Component<HTMLDivElement>) => {
29
29
  const grid = new Grid({ columns: '* *', gap: 'xs' });
30
30
  grid.element.classList.add('layout-coded');
31
31
  grid.controls.add(
@@ -41,7 +41,7 @@ export default function FromCode() {
41
41
  <Stack ref={(c: Stack) => (bar = c)} orientation="horizontal" gap="sm" wrap align="center" style="inline-size: 100%">
42
42
  <Button text="Add a button" tone="accent" onclick={addButton} />
43
43
  </Stack>
44
- <div style="inline-size: 100%" ref={(c: Component<HTMLDivElement>) => buildFromCode(c)} />
44
+ <div style="inline-size: 100%" ref={(c: Component<HTMLDivElement>) => buildProgrammatic(c)} />
45
45
  </>
46
46
  );
47
47
  }
@@ -287,7 +287,7 @@ const FRAME = 'border: var(--mx-border-width-1) solid var(--mx-color-stroke-card
287
287
  const BAR = 'background: var(--mx-color-bg-bar);';
288
288
  const LAYER = 'background: var(--mx-color-bg-layer);';
289
289
 
290
- /** A mail app laid out with DockPanel: a header, a sidebar that changes sides, a status bar, a float button and a panel added from code. */
290
+ /** A mail app laid out with DockPanel: a header, a sidebar that changes sides, a status bar, a float button and a panel added programmatically. */
291
291
  export default function AppShell() {
292
292
  const s = reactive({ side: 'start' as Dock, messages: 3 });
293
293
  let shell: DockPanel | null = null;
@@ -302,7 +302,7 @@ export default function AppShell() {
302
302
  notes = new Panel({ dock: 'end', padding: 'sm' });
303
303
  notes.element.setAttribute('style', `inline-size: 9rem; ${LAYER}`);
304
304
  notes.element.classList.add('layout-notes');
305
- notes.controls.add(<span>Notes, added from code.</span>);
305
+ notes.controls.add(<span>Notes, added programmatically.</span>);
306
306
  shell?.controls.add(notes);
307
307
  };
308
308
 
@@ -310,7 +310,7 @@ export default function AppShell() {
310
310
  <>
311
311
  <Stack orientation="horizontal" wrap align="center">
312
312
  <Button text={() => `Sidebar: ${s.side}`} size="sm" variant="outline" onclick={() => (s.side = s.side === 'start' ? 'end' : 'start')} />
313
- <Button text="Notes panel from code" size="sm" variant="outline" onclick={toggleNotes} />
313
+ <Button text="Notes panel programmatically" size="sm" variant="outline" onclick={toggleNotes} />
314
314
  </Stack>
315
315
  <DockPanel class="layout-shell" ref={(c: DockPanel) => (shell = c)} style={`block-size: 22rem; inline-size: 100%; overflow: hidden; ${FRAME}`}>
316
316
  <Stack dock="top" orientation="horizontal" align="center" gap="sm" padding="xs sm" style={BAR}>
@@ -332,7 +332,7 @@ export default function AppShell() {
332
332
  <Panel class="layout-content" text="Message" scrollable padding="md">
333
333
  <h3 style="margin-block-start: 0">Welcome</h3>
334
334
  <p>The header, the folders and the status bar are docked; this panel fills the rest and scrolls on its own.</p>
335
- <p>Switch the sidebar to the other side, or add a panel from code: the layout follows at once.</p>
335
+ <p>Switch the sidebar to the other side, or add a panel programmatically: the layout follows at once.</p>
336
336
  </Panel>
337
337
  <Button class="layout-help" dock="float" right={16} bottom={48} text="Help" variant="outline" />
338
338
  </DockPanel>
@@ -353,7 +353,7 @@ const FOLDERS = ['Inbox', 'Drafts', 'Sent', 'Archive', 'Spam', 'Trash'];
353
353
  const FRAME = 'border: var(--mx-border-width-1) solid var(--mx-color-stroke-card); border-radius: var(--mx-radius-lg);';
354
354
  const LAYER = 'background: var(--mx-color-bg-layer);';
355
355
 
356
- /** A split container inside another: a position bound with x-model, minimum sizes, a fixed pane, and hiding a pane from code. */
356
+ /** A split container inside another: a position bound with x-model, minimum sizes, a fixed pane, and hiding a pane programmatically. */
357
357
  export default function NestedSplit() {
358
358
  const s = reactive({ tree: 180 as SplitPosition, fixed: 'first' as SplitPanel, log: '' });
359
359
  let outer: SplitContainer | null = null;
@@ -426,7 +426,7 @@ The only text the containers write is the splitter's name, `uiLocale.strings.res
426
426
 
427
427
  ```tsx
428
428
  import { reactive } from '@motifx/core';
429
- import { Button, enStrings, trStrings, uiLocale } from '@motifx-community/ui';
429
+ import { Button, uiLocale } from '@motifx-community/ui';
430
430
  import { kitTexts } from '../../../shared/kit-texts';
431
431
 
432
432
  /** Switches the texts of the kit; the splitters on the page take the new name at once. */
@@ -434,7 +434,7 @@ export default function Localization() {
434
434
  const s = reactive({ lang: 'en' });
435
435
  const toggle = () => {
436
436
  s.lang = s.lang === 'en' ? 'tr' : 'en';
437
- uiLocale.strings = s.lang === 'en' ? enStrings : trStrings;
437
+ void uiLocale.use(s.lang);
438
438
  };
439
439
  return (
440
440
  <>
@@ -567,9 +567,9 @@ Every container also has the shared properties of `Control`: `enabled` / `disabl
567
567
 
568
568
  | Method | Returns | Description |
569
569
  | --- | --- | --- |
570
- | `Stack.setGrow(child, grow), growOf(child)` | `void`, value | A child's `grow` from code (a value or a function). |
571
- | `Grid.setCell(child, cell), cellOf(child)` | `void`, `GridCell` | A child's `row`, `column`, `rowSpan`, `columnSpan` from code. |
572
- | `DockPanel.setDock(child, dock), dockOf(child)` | `void`, `Dock` | A child's `dock` from code. |
570
+ | `Stack.setGrow(child, grow), growOf(child)` | `void`, value | A child's `grow` programmatically (a value or a function). |
571
+ | `Grid.setCell(child, cell), cellOf(child)` | `void`, `GridCell` | A child's `row`, `column`, `rowSpan`, `columnSpan` programmatically. |
572
+ | `DockPanel.setDock(child, dock), dockOf(child)` | `void`, `Dock` | A child's `dock` programmatically. |
573
573
  | `DockPanel.setAnchors(child, anchors)` | `void` | The `left` / `top` / `right` / `bottom` of a `float` child. |
574
574
  | `SplitContainer.collapse(pane?), restore()` | `void` | Hides a pane (the first by default) / shows both again. |
575
575
  | `GroupBox.focus()` | `boolean` | Focuses the first control inside, opening a collapsed box. |
package/docs/listbox.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ListBox
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
  A list that stays on the page. One item or several are chosen with the keys or the pointer; items come from memory or from a data source, can be searched and grouped, and long lists draw only the rows in view.
6
6
 
@@ -11,9 +11,9 @@ import { ListBox } 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
- `items` can be plain values; `x-model` binds the value. Created with `new`, the same properties are set from code.
16
+ `items` can be plain values; `x-model` binds the value. Created with `new`, the same properties are set programmatically.
17
17
 
18
18
  ```tsx
19
19
  /** The cities the lists of the examples show. */
@@ -164,14 +164,14 @@ export const cities = ['Ankara', 'Antalya', 'Bursa', 'İstanbul', 'İzmir', 'Kon
164
164
 
165
165
  ```tsx
166
166
  import { reactive } from '@motifx/core';
167
- import { Button, ListBox, enStrings, trStrings, uiLocale } from '@motifx-community/ui';
167
+ import { Button, ListBox, uiLocale } from '@motifx-community/ui';
168
168
 
169
169
  /** Switches the texts of every list on the page: “Select all”, the search box, “No items”. */
170
170
  export default function Localization() {
171
171
  const s = reactive({ lang: 'en' });
172
172
  const toggle = () => {
173
173
  s.lang = s.lang === 'en' ? 'tr' : 'en';
174
- uiLocale.strings = s.lang === 'en' ? enStrings : trStrings;
174
+ void uiLocale.use(s.lang);
175
175
  };
176
176
  return (
177
177
  <>
@@ -255,20 +255,20 @@ A prop whose value is a function of its own (`textField`, a template) takes the
255
255
 
256
256
  ## Example files
257
257
 
258
- `FromCode.tsx`
258
+ `Programmatic.tsx`
259
259
 
260
260
  ```tsx
261
261
  import { reactive } from '@motifx/core';
262
262
  import { Button, ListBox, Stack } from '@motifx-community/ui';
263
263
  import { cities } from './cities';
264
264
 
265
- /** A list bound with x-model, and lists created with `new` and added from code. */
266
- export default function FromCode() {
265
+ /** A list bound with x-model, and lists created with `new` and added programmatically. */
266
+ export default function Programmatic() {
267
267
  const form = reactive({ city: 'İzmir' as string | null, result: '' });
268
268
  let added = 0;
269
269
  let host: Stack | null = null;
270
270
 
271
- const addFromCode = () => {
271
+ const addProgrammatic = () => {
272
272
  const list = new ListBox<string, string>({ label: `Size ${++added}`, items: ['S', 'M', 'L', 'XL'], height: 4 });
273
273
  list.onValueChanged((e) => (form.result = `${list.label}: ${e.value}`));
274
274
  host?.controls.add(list);
@@ -280,7 +280,7 @@ export default function FromCode() {
280
280
  <ListBox label="&City" items={cities} x-model={() => form.city} />
281
281
  <Stack orientation="horizontal" wrap align="center">
282
282
  <output class="lb-city">{() => `city: ${form.city ?? '—'}`}</output>
283
- <Button text="Add a list from code" variant="outline" onclick={addFromCode} />
283
+ <Button text="Add a list programmatically" variant="outline" onclick={addProgrammatic} />
284
284
  <output class="lb-made">{() => form.result}</output>
285
285
  </Stack>
286
286
  <Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
@@ -0,0 +1,184 @@
1
+ # LoadPanel
2
+
3
+ > Feedback · @motifx-community/ui 0.1.0-beta.3
4
+
5
+ A “loading” layer over a container or the whole page: a shade, a pane with the kit’s spinner and a message, a Cancel button when the work can be stopped. Nothing under it can be used meanwhile, and focus comes back afterwards.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { LoadPanel } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Over a container
14
+
15
+ `target` names the component or element it covers; `value` (or `x-model`) shows and hides it, `show()` and `hide()` programmatically. `delay` keeps quick work from flashing it.
16
+
17
+ ```tsx
18
+ import { reactive } from '@motifx/core';
19
+ import { Button, LoadPanel, Panel, Stack, TextBox } from '@motifx-community/ui';
20
+
21
+ /** A load panel over a panel while its orders load: bound with x-model, shown after a short delay. */
22
+ export default function Container() {
23
+ const s = reactive({ loading: false, result: '' });
24
+ let panel!: Panel;
25
+
26
+ // Stands in for a call to the server.
27
+ const load = () => {
28
+ s.loading = true;
29
+ s.result = '';
30
+ setTimeout(() => {
31
+ s.loading = false;
32
+ s.result = 'Orders loaded.';
33
+ }, 1800);
34
+ };
35
+
36
+ return (
37
+ <Stack gap="md" style="inline-size: 100%">
38
+ <Panel class="lp-panel" variant="outline" padding="md" style="min-block-size: 10rem" ref={(c: Panel) => (panel = c)}>
39
+ <Stack orientation="horizontal" wrap align="center">
40
+ <TextBox label="Customer" value="Ada" />
41
+ <Button text="Load orders" tone="accent" onclick={load} />
42
+ </Stack>
43
+ </Panel>
44
+ <LoadPanel target={() => panel} message="Loading orders" delay={200} x-model={() => s.loading} />
45
+ <output class="lp-result">{() => s.result}</output>
46
+ </Stack>
47
+ );
48
+ }
49
+ ```
50
+
51
+ ## Over the page, with Cancel
52
+
53
+ ```tsx
54
+ import { reactive } from '@motifx/core';
55
+ import { Button, LoadPanel, Stack } from '@motifx-community/ui';
56
+
57
+ /** Over the whole page, with a Cancel button: the work stops when it is pressed (or on Escape). */
58
+ export default function Page() {
59
+ const s = reactive({ told: '' });
60
+ let timer: ReturnType<typeof setTimeout> | null = null;
61
+ const panel = new LoadPanel({
62
+ message: 'Building the report…',
63
+ cancelable: true,
64
+ onCancel: () => {
65
+ if (timer) clearTimeout(timer);
66
+ timer = null;
67
+ s.told = 'Cancelled.';
68
+ }
69
+ });
70
+ const start = () => {
71
+ s.told = '';
72
+ panel.show();
73
+ timer = setTimeout(() => {
74
+ timer = null;
75
+ panel.hide();
76
+ s.told = 'The report is ready.';
77
+ }, 4000);
78
+ };
79
+ return (
80
+ <Stack orientation="horizontal" wrap align="center">
81
+ <Button text="Build the report" variant="outline" onclick={start} />
82
+ <span onConfig={c => c.controls.add(panel)} />
83
+ <output class="lp-told">{() => s.told}</output>
84
+ </Stack>
85
+ );
86
+ }
87
+ ```
88
+
89
+ ## Shade, pane and indicator
90
+
91
+ ```tsx
92
+ import { reactive } from '@motifx/core';
93
+ import { Button, LoadPanel, Panel, Stack } from '@motifx-community/ui';
94
+
95
+ /** Without the shade, without the pane, without the indicator; a press on the shade may hide it. */
96
+ export default function Options() {
97
+ const s = reactive({ clear: false, bare: false, words: false });
98
+ let clear!: Panel;
99
+ let bare!: Panel;
100
+ let words!: Panel;
101
+ const flash = (key: 'clear' | 'bare' | 'words') => {
102
+ s[key] = true;
103
+ setTimeout(() => (s[key] = false), 2500);
104
+ };
105
+ return (
106
+ <Stack orientation="horizontal" wrap align="center" style="inline-size: 100%">
107
+ <Panel variant="outline" padding="md" style="min-inline-size: 16rem; min-block-size: 9rem" ref={(c: Panel) => (clear = c)}>
108
+ <Button text="No shade" variant="outline" onclick={() => flash('clear')} />
109
+ </Panel>
110
+ <LoadPanel target={() => clear} shade={false} x-model={() => s.clear} closeOnOutside />
111
+ <Panel variant="outline" padding="md" style="min-inline-size: 16rem; min-block-size: 9rem" ref={(c: Panel) => (bare = c)}>
112
+ <Button text="No pane" variant="outline" onclick={() => flash('bare')} />
113
+ </Panel>
114
+ <LoadPanel target={() => bare} showPane={false} x-model={() => s.bare} />
115
+ <Panel variant="outline" padding="md" style="min-inline-size: 16rem; min-block-size: 9rem" ref={(c: Panel) => (words = c)}>
116
+ <Button text="Words only" variant="outline" onclick={() => flash('words')} />
117
+ </Panel>
118
+ <LoadPanel target={() => words} showIndicator={false} message="Please wait" x-model={() => s.words} />
119
+ </Stack>
120
+ );
121
+ }
122
+ ```
123
+
124
+ ## Behaviour
125
+
126
+ | Topic | How |
127
+ | --- | --- |
128
+ | `Over a container` | It goes inside the container, over everything in it; the container is `aria-busy` and what is under the panel is inert: nothing there can be pressed or focused. |
129
+ | `Over the page` | Without a `target`, it covers the viewport and the rest of the page is inert. |
130
+ | `Focus` | Focus that was under it waits on the panel (on the Cancel button when there is one) and goes back where it was when the panel hides. |
131
+ | `Delay` | Quick work shows nothing: it comes after `delay`, and a hide before that cancels it. |
132
+ | `Spinner.cover` | The kit’s spinner covers a container programmatically in one call (`Spinner.cover`); the load panel is the component with the pane, the message, the delay and the button. |
133
+
134
+ ## Accessibility
135
+
136
+ | Topic | How |
137
+ | --- | --- |
138
+ | `Pane` | A `status` region: the message is read when the panel appears, and again when it changes. |
139
+ | `Indicator` | Decorative; the message says what is going on. |
140
+ | `Under it` | `inert` and `aria-busy`, so readers skip it and nothing there takes a press or focus. |
141
+ | `Cancel` | The kit’s button, named in the kit language; Escape presses it. |
142
+
143
+ ## Styling
144
+
145
+ | Hook | What it is |
146
+ | --- | --- |
147
+ | `.mx-load-panel` | The layer. `data-shade`, `data-pane`, `data-page`. |
148
+ | `.mx-load-panel__pane` | The pane. |
149
+ | `.mx-load-panel__indicator, .mx-load-panel__message, .mx-load-panel__cancel` | The spinner, the message and the button. |
150
+
151
+ ### Component tokens
152
+
153
+ | Token | What it sets |
154
+ | --- | --- |
155
+ | `load-panel.shade, .pane, .message` | Units: the layer (`shaded`), the pane (`shown`), the message. |
156
+ | `load-panel.cancel` | Place: the Cancel button’s look (`variant`). |
157
+ | `load-panel.padding, .gap` | The least space to the edge of what it covers; the space between the indicator, the message and the button. |
158
+
159
+ ## API reference
160
+
161
+ ### Props
162
+
163
+ | Prop | Type | Default | Description |
164
+ | --- | --- | --- | --- |
165
+ | `target` | `Bind<ComponentBase \| HTMLElement \| null>` | `null` | What it covers: a component or an element; `null` covers the whole page. |
166
+ | `message` | `Bind<string>` | the kit’s “Loading…” | The message under the indicator. The same property as `text`. |
167
+ | `value` | `Bind<boolean>` | `false` | Shown or not; `x-model` binds it two-way. |
168
+ | `delay` | `Bind<number>` | `0` | Milliseconds before it shows; a hide before that shows nothing. |
169
+ | `shade` | `Bind<boolean>` | `true` | Dims what it covers. |
170
+ | `showPane` | `Bind<boolean>` | `true` | The box behind the indicator and the message. |
171
+ | `showIndicator` | `Bind<boolean>` | `true` | The turning indicator (the kit’s spinner). |
172
+ | `cancelable` | `Bind<boolean>` | `false` | A Cancel button in the pane; Escape presses it too. |
173
+ | `cancelText` | `Bind<string>` | the kit’s “Cancel” | The button’s text. |
174
+ | `closeOnOutside` | `Bind<boolean>` | `false` | A press on the shade hides it. |
175
+
176
+ ### Events, properties and methods
177
+
178
+ | Member | Kind | Description |
179
+ | --- | --- | --- |
180
+ | `onShown, onHidden` | event | It came on the screen (after its delay); it went. |
181
+ | `onCancel` | event | The Cancel button was pressed, or Escape; the panel hides after. |
182
+ | `show(), hide(), cancel()` | `boolean` / `void` | Programmatically; `show()` is `false` while it is shown or waiting for its delay. |
183
+ | `isShown` | read-only | Whether it is on the screen now. |
184
+ | `spinner, cancelButton` | read-only | The kit’s spinner and button in the pane. |
package/docs/lookup.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Lookup
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
  Picks one row of a table-like list, typically from a data source searched on the server: a customer by its company, contact and city. The field shows the chosen row's text; everything else works as in DropDown.
6
6
 
package/docs/menus.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MenuBar and ContextMenu
2
2
 
3
- > Buttons · @motifx-community/ui 0.1.0-beta.1
3
+ > Buttons · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  A menu bar of an app (File, Edit, View) and the menu that opens on a right-click. Both show the same menu items: submenus, check and radio items, shortcuts, access keys.
6
6
 
@@ -298,7 +298,7 @@ Menus write no text of their own: every label, shortcut and name comes from your
298
298
  | --- | --- | --- |
299
299
  | `MenuBar.open(item \| index)` | `boolean` | Opens a top item’s menu with focus on its first item. |
300
300
  | `MenuBar.close()` | `void` | Closes the open menu. |
301
- | `ContextMenu.open(at, target?)` | `boolean` | Opens it from code, at `{ x, y }` or at an element. |
301
+ | `ContextMenu.open(at, target?)` | `boolean` | Opens it programmatically, at `{ x, y }` or at an element. |
302
302
  | `ContextMenu.close()` | `void` | Closes it. |
303
303
  | `MenuBar.refresh(), ContextMenu.refresh()` | `void` | Your items may be plain or reactive; the menu reads them as they are. After changing them in place, call `refresh()`. The bar, the open menu and its submenus follow. |
304
304
  | `attachContextMenu(target, items)` | `() => void` | Gives an element or component a menu; `items` can be a function of the opening (`e.target`). Returns the remover. |
@@ -0,0 +1,202 @@
1
+ # MultiView
2
+
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.3
4
+
5
+ Pages side by side, one in sight: a swipe or a drag brings the next one, and so do `next()`, `previous()` and `goTo()`, or a [Tabs](tabs.md), a [Stepper](stepper.md) or buttons bound to the same value. The panels of a tab strip without the strip.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { MultiView, View } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Pages driven by a stepper
14
+
15
+ The `View` children are the pages; the one in sight is `value` (a view’s `key`, else its index), `x-model` binds it two-way. Here a `Stepper` shares the value: a press on a step and a swipe on a page move both. A page is built when first in sight (`lazy`).
16
+
17
+ ```tsx
18
+ import { reactive } from '@motifx/core';
19
+ import { CheckBox, MultiView, Stack, Stepper, TextBox, View } from '@motifx-community/ui';
20
+
21
+ /** A stepper and a multi-view bound to the same value: a press on a step or a swipe on a page moves both. */
22
+ export default function Pages() {
23
+ const s = reactive({ page: 0 as string | number | null });
24
+ return (
25
+ <Stack gap="md" style="inline-size: 100%">
26
+ <Stepper class="mv-steps" label="Order" linear={false} items={['Address', 'Delivery', 'Payment']} x-model={() => s.page} />
27
+ <MultiView class="mv-order" label="Order" x-model={() => s.page}>
28
+ <View title="Address">
29
+ <Stack gap="sm">
30
+ <TextBox label="Street" />
31
+ <TextBox label="Town" />
32
+ </Stack>
33
+ </View>
34
+ <View title="Delivery">
35
+ <Stack gap="sm">
36
+ <CheckBox text="Leave it at the door" />
37
+ <CheckBox text="Send a message before" />
38
+ </Stack>
39
+ </View>
40
+ <View title="Payment">
41
+ <Stack gap="sm">
42
+ <TextBox label="Card number" />
43
+ <TextBox label="Name on the card" />
44
+ </Stack>
45
+ </View>
46
+ </MultiView>
47
+ <output class="mv-order-page">{() => `page: ${s.page}`}</output>
48
+ </Stack>
49
+ );
50
+ }
51
+ ```
52
+
53
+ ## Built when first in sight, kept or not
54
+
55
+ `lazy` (the default) builds a view when it first comes into sight and keeps it; `keepAlive={false}` disposes what a view’s `content` made while it is out of sight, and makes it again the next time. The JSX children stay either way, as in `Tabs`.
56
+
57
+ ```tsx
58
+ import { reactive } from '@motifx/core';
59
+ import { Button, MultiView, Stack, View } from '@motifx-community/ui';
60
+
61
+ /** Each page is made when first in sight; with `keepAlive` off, what `content` made is dropped out of sight and made again. */
62
+ export default function Lazy() {
63
+ const s = reactive({ made: 0, keep: true });
64
+ let views!: MultiView;
65
+ const report = (name: string) => () => {
66
+ s.made++;
67
+ return <p class="mv-lazy-page">{`${name}, made as number ${s.made}`}</p>;
68
+ };
69
+ return (
70
+ <Stack gap="sm" style="inline-size: 100%">
71
+ <Stack orientation="horizontal" wrap align="center">
72
+ <Button text="Previous" variant="outline" onclick={() => void views.previous()} />
73
+ <Button text="Next" variant="outline" onclick={() => void views.next()} />
74
+ <Button text="Keep alive" variant="outline" toggle x-model={() => s.keep} />
75
+ <output class="mv-lazy-made">{() => `made ${s.made} times`}</output>
76
+ </Stack>
77
+ <MultiView ref={(m: MultiView) => (views = m)} class="mv-lazy" label="Reports" keepAlive={() => s.keep}>
78
+ <View title="Sales" content={report('Sales')} />
79
+ <View title="Stock" content={report('Stock')} />
80
+ <View title="Staff" content={report('Staff')} />
81
+ </MultiView>
82
+ </Stack>
83
+ );
84
+ }
85
+ ```
86
+
87
+ ## Programmatic use
88
+
89
+ Made with `new`, views added with `add()` and `insert()`, removed with `remove()`; `loop` goes around the ends, `animated={false}` shows the next view at once.
90
+
91
+ ```tsx
92
+ import { reactive } from '@motifx/core';
93
+ import { Button, MultiView, Stack, View } from '@motifx-community/ui';
94
+
95
+ /** A multi-view made programmatically around the ends: views added, inserted and removed, the sight moved with its methods. */
96
+ export default function Programmatic() {
97
+ const s = reactive({ told: '', count: 0 });
98
+ let number = 0;
99
+ const page = () => {
100
+ number++;
101
+ const n = number;
102
+ return new View({ title: `Note ${n}`, content: () => <p class="mv-coded-note">{`Note ${n}`}</p> });
103
+ };
104
+ const coded = new MultiView({
105
+ label: 'Notes',
106
+ loop: true,
107
+ onSelectionChanged: e => (s.told = `in sight: ${e.view?.title ?? 'none'}${e.byUser ? ', by a swipe' : ''}`)
108
+ });
109
+ const count = () => (s.count = coded.count);
110
+ coded.add(page());
111
+ coded.add(page());
112
+ count();
113
+ return (
114
+ <Stack gap="sm" style="inline-size: 100%">
115
+ <Stack orientation="horizontal" wrap align="center">
116
+ <Button text="Previous" variant="outline" onclick={() => void coded.previous()} />
117
+ <Button text="Next" variant="outline" onclick={() => void coded.next()} />
118
+ <Button
119
+ text="Add a note"
120
+ variant="outline"
121
+ onclick={() => {
122
+ void coded.goTo(coded.add(page()));
123
+ count();
124
+ }}
125
+ />
126
+ <Button
127
+ text="Remove this note"
128
+ variant="outline"
129
+ enabled={() => s.count > 1}
130
+ onclick={() => {
131
+ if (coded.selectedView) coded.remove(coded.selectedView);
132
+ count();
133
+ }}
134
+ />
135
+ <output class="mv-coded-told">{() => `${s.count} notes${s.told ? `, ${s.told}` : ''}`}</output>
136
+ </Stack>
137
+ <span class="mv-coded" onConfig={c => c.controls.add(coded)} />
138
+ </Stack>
139
+ );
140
+ }
141
+ ```
142
+
143
+ ## Accessibility
144
+
145
+ | Topic | How |
146
+ | --- | --- |
147
+ | `Group` | A `group` named “Pages” in the kit language; several on one page: give each its own `label`. |
148
+ | `A view` | A `group` named by its `title`, else “Page 2 of 3”; the views out of sight are hidden from readers and from the keys (`inert`), so Tab moves only inside the view in sight. |
149
+ | `Moving` | A swipe needs a finger or a mouse: give the keys a way too, a `Tabs`, a `Stepper` or buttons bound to the same `value`, as the examples do. |
150
+
151
+ ## Styling
152
+
153
+ | Hook | What it is |
154
+ | --- | --- |
155
+ | `.mx-multi-view` | The multi-view. `data-swipe` when a drag moves it, `data-dragging` while one does, `data-still` with `animated` off. |
156
+ | `.mx-multi-view__viewport, .mx-multi-view__track` | The frame that clips the views and the track that slides in it (`data-dragging`, `data-no-motion`). |
157
+ | `.mx-multi-view__view` | A view (`aria-hidden`, `inert` out of sight). |
158
+
159
+ ### Component tokens
160
+
161
+ | Token | What it sets |
162
+ | --- | --- |
163
+ | `multi-view.frame, .view` | Units: the frame (`swipeable`, `dragging`) and a view. |
164
+ | `multi-view.gap` | Between the views, seen while a finger drags them. |
165
+
166
+ ## API reference
167
+
168
+ ### MultiView props
169
+
170
+ | Prop | Type | Default | Description |
171
+ | --- | --- | --- | --- |
172
+ | `value` | `Bind<string \| number \| null>` | `0` | The view in sight: its `key`, else its index. `x-model` binds it two-way. |
173
+ | `loop` | `Bind<boolean>` | `false` | After the last view comes the first; the move goes around the ends, not back across the views between. |
174
+ | `swipeEnabled` | `Bind<boolean>` | `true` | A finger or a pointer drags the views; a drag far or fast enough lands on the next one. |
175
+ | `animated` | `Bind<boolean>` | `true` | The views slide into sight. `false` shows the next one at once. |
176
+ | `lazy` | `Bind<boolean>` | `true` | A view is built when first in sight, then kept (a view’s own `lazy` wins). |
177
+ | `keepAlive` | `Bind<boolean>` | `true` | `false` disposes what a view’s `content` made while the view is out of sight (a view’s own `keepAlive` wins). |
178
+ | `label` | `Bind<string>` | the kit’s “Pages” | What screen readers call it. |
179
+
180
+ ### View props
181
+
182
+ | Prop | Type | Default | Description |
183
+ | --- | --- | --- | --- |
184
+ | `title` | `Bind<string>` | “Page 2 of 3” | What screen readers call the view. |
185
+ | `key` | `Bind<string>` | `''` | Names the view in `value`; the JSX `key` is read too. |
186
+ | `content` | `() => ComponentBase \| ComponentBase[]` | — | Content made when the view is first in sight, besides the JSX children. |
187
+ | `lazy, keepAlive` | `Bind<boolean \| undefined>` | `undefined` | The view’s own settings; `undefined` follows the multi-view. |
188
+ | `visible, enabled` | `Bind<boolean>` | `true` | A hidden view takes no room and is skipped; a disabled one is skipped by `next()` and `previous()` and refused by `goTo()`. |
189
+
190
+ ### Events, properties and methods
191
+
192
+ | Member | Kind | Description |
193
+ | --- | --- | --- |
194
+ | `onSelecting` | event | The view in sight is about to change (`from`, `to`, `fromView`, `toView`, `byUser`); `cancel = true` keeps the one there. |
195
+ | `onSelectionChanged` | event | The view in sight changed (`index`, `view`, `previous`, `byUser`: by a swipe, else programmatically). |
196
+ | `views` | read-only | The views in order, hidden ones too. |
197
+ | `selectedView, selectedIndex` | read-only | The view in sight and its index; `null` and -1 when there is none. |
198
+ | `count` | read-only | How many views there are. |
199
+ | `next(), previous()` | `Promise<boolean>` | Goes to the next or the previous view that is shown and enabled; `false` at an end without `loop`, or when refused. |
200
+ | `goTo(view)` | `Promise<boolean>` | Goes to a view, by index, key or the `View` itself; `onSelecting` is asked first. A view’s own `select()` does the same. |
201
+ | `add(view), insert(index, view)` | `View` | Adds a view at the end or at an index; one from another multi-view moves here. |
202
+ | `remove(view)` | `boolean` | Removes a view and disposes it; the sight moves to a neighbour. |
package/docs/numberbox.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NumberBox
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 number field: arrow keys, PageUp / PageDown and spin buttons that repeat while held, bounds, a step without float noise, a format for display (currency, percent) and typing in the locale’s own way.
6
6
 
@@ -10,9 +10,9 @@ A number field: arrow keys, PageUp / PageDown and spin buttons that repeat while
10
10
  import { NumberBox, type NumberBoxProps } from '@motifx-community/ui';
11
11
  ```
12
12
 
13
- ## From JSX and from code
13
+ ## Declarative and programmatic
14
14
 
15
- `x-model` binds a number (`null` when empty). Created with `new`, the same properties are set from code.
15
+ `x-model` binds a number (`null` when empty). Created with `new`, the same properties are set programmatically.
16
16
 
17
17
  ```tsx
18
18
  import { reactive } from '@motifx/core';
@@ -20,13 +20,13 @@ import { Button, NumberBox, Stack } from '@motifx-community/ui';
20
20
 
21
21
  const show = (value: number | null) => (value === null ? 'null' : String(value));
22
22
 
23
- /** A field bound to a number with x-model, and fields created with `new` and stepped from code. */
24
- export default function FromCode() {
23
+ /** A field bound to a number with x-model, and fields created with `new` and stepped programmatically. */
24
+ export default function Programmatic() {
25
25
  const s = reactive({ quantity: 3 as number | null, log: '' });
26
26
  let added = 0;
27
27
  let host: Stack | null = null;
28
28
 
29
- const addFromCode = () => {
29
+ const addProgrammatic = () => {
30
30
  const box = new NumberBox({ label: `Count ${++added}`, min: 0, max: 10, value: 5, locale: 'en' });
31
31
  box.onValueChanged((e) => (s.log = `${box.label}: ${show(e.value)}`));
32
32
  host?.controls.add(box);
@@ -41,7 +41,7 @@ export default function FromCode() {
41
41
  <output class="nb-quantity">{() => `value: ${show(s.quantity)}`}</output>
42
42
  </Stack>
43
43
  <Stack orientation="horizontal" wrap align="center">
44
- <Button text="Add a field from code" variant="outline" onclick={addFromCode} />
44
+ <Button text="Add a field programmatically" variant="outline" onclick={addProgrammatic} />
45
45
  <output class="nb-log">{() => s.log}</output>
46
46
  </Stack>
47
47
  <Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
@@ -212,7 +212,7 @@ The names of the spin buttons and the range messages come from `uiLocale.strings
212
212
 
213
213
  ```tsx
214
214
  import { reactive } from '@motifx/core';
215
- import { Button, enStrings, trStrings, uiLocale } from '@motifx-community/ui';
215
+ import { Button, uiLocale } from '@motifx-community/ui';
216
216
  import { kitTexts } from '../../../shared/kit-texts';
217
217
 
218
218
  /** Switches the names of the spin buttons and the range messages. */
@@ -221,7 +221,7 @@ export default function Localization() {
221
221
 
222
222
  const toggle = () => {
223
223
  s.lang = s.lang === 'en' ? 'tr' : 'en';
224
- uiLocale.strings = s.lang === 'en' ? enStrings : trStrings;
224
+ void uiLocale.use(s.lang);
225
225
  };
226
226
 
227
227
  return (