@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
@@ -1,6 +1,6 @@
1
1
  # FilterBuilder
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 filter builder lets people put a filter together by hand: groups joined by And, Or, Not And or Not Or, and conditions of a field, an operation and a value. Its value is the data layer's filter expression, so it goes to rows in memory and to every adapter as it is. The DataGrid opens it from its filter panel; on its own it serves a report screen or a saved search.
6
6
 
@@ -57,7 +57,7 @@ export const saleFields: FilterBuilderField[] = [
57
57
  ];
58
58
  ```
59
59
 
60
- ## From code, and the events
60
+ ## Programmatic use, and the events
61
61
 
62
62
  Every change the user makes is also a method (`addCondition`, `addGroup`, `removeItem`, `setField`, `setOperation`, `setConditionValue`, `setGroupOperation`, `clear`), and every change asks first: `onItemAdding`, `onItemRemoving` and `onItemChanging` can change it or cancel it, the `…ed` events and `onValueChanged` follow. Here the last condition of the root cannot be taken out.
63
63
 
@@ -372,7 +372,7 @@ export const saleFields: FilterBuilderField[] = [
372
372
  | `setField(condition, dataField), setOperation(condition, op), setConditionValue(condition, value)` | `boolean` | An operation or value that no longer fits the new field is reset. |
373
373
  | `setGroupOperation(group, op)` | `boolean` | |
374
374
  | `clear()` | `void` | Empties the tree. |
375
- | `openEditor(condition), closeEditor(keep?)` | `boolean`, `void` | The value editor, from code. |
375
+ | `openEditor(condition), closeEditor(keep?)` | `boolean`, `void` | The value editor, programmatically. |
376
376
  | `focusItem(item, part?), focus()` | `boolean` | A row's button (`'remove'`, `'group'`, `'add'`, `'field'`, `'operation'`, `'value'`); the tree's Tab stop. |
377
377
  | `getFilterExpression()` | `data.FilterExpression \| null` | The value. |
378
378
  | `refresh()` | `void` | Your fields and value may be plain or reactive; the builder reads them as they are. After changing them in place, call `refresh()`. The rows are drawn again; a value changed in place is read into the tree. |
@@ -460,7 +460,7 @@ export const saleFields: FilterBuilderField[] = [
460
460
  ];
461
461
  ```
462
462
 
463
- `FromCode.tsx`
463
+ `Programmatic.tsx`
464
464
 
465
465
  ```tsx
466
466
  import { reactive } from '@motifx/core';
@@ -468,14 +468,14 @@ import { data } from '@motifx-community/data';
468
468
  import { Button, FilterBuilder, Stack } from '@motifx-community/ui';
469
469
  import { saleFields } from './sales';
470
470
 
471
- /** Made with `new` and driven from code; every change asks first, and a handler may cancel it. */
472
- export default function FromCode() {
471
+ /** Made with `new` and driven programmatically; every change asks first, and a handler may cancel it. */
472
+ export default function Programmatic() {
473
473
  const log = reactive({ lines: [] as { id: number; text: string }[], next: 0 });
474
474
  const write = (text: string) => {
475
475
  log.lines.unshift({ id: log.next++, text });
476
476
  if (log.lines.length > 6) log.lines.pop();
477
477
  };
478
- const builder = new FilterBuilder({ fields: saleFields, locale: 'en', label: 'Built from code' });
478
+ const builder = new FilterBuilder({ fields: saleFields, locale: 'en', label: 'Built programmatically' });
479
479
  builder.element.classList.add('fb-code');
480
480
  builder.onItemAdding((e) => write(`adding a ${e.item.kind}${e.byUser ? ' (user)' : ''}`));
481
481
  builder.onItemRemoving((e) => {
@@ -574,7 +574,7 @@ export default function CustomOperations() {
574
574
  ```tsx
575
575
  import { reactive } from '@motifx/core';
576
576
  import { data } from '@motifx-community/data';
577
- import { Button, FilterBuilder, enStrings, trStrings, uiLocale } from '@motifx-community/ui';
577
+ import { Button, FilterBuilder, uiLocale } from '@motifx-community/ui';
578
578
  import { saleFields } from './sales';
579
579
 
580
580
  /** The builder's texts come from `uiLocale`; `texts` changes some for one builder only. */
@@ -582,7 +582,7 @@ export default function Localization() {
582
582
  const s = reactive({ lang: 'en' });
583
583
  const toggle = () => {
584
584
  s.lang = s.lang === 'en' ? 'tr' : 'en';
585
- uiLocale.strings = s.lang === 'en' ? enStrings : trStrings;
585
+ void uiLocale.use(s.lang);
586
586
  };
587
587
  return (
588
588
  <>
@@ -1,6 +1,6 @@
1
1
  # FormLayout
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
  Lays out the fields of a data object on a grid. Each field gets an editor — by name, or by the type of its value — bound to the object both ways; groups, spans and buttons arrange them; sending the form checks every field first.
6
6
 
@@ -0,0 +1,244 @@
1
+ # Gallery
2
+
3
+ > Display · @motifx-community/ui 0.1.0-beta.3
4
+
5
+ Panes side by side, one in view or several, moved by the buttons at the sides, the dots under them, a swipe or the arrow keys; a slideshow when told. A pane is an image with a caption, or any content.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { Gallery } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Pictures with captions
14
+
15
+ `items` are the panes: an address, or an item with `image`, `alt`, `text` and `description`. The pane in view is `value` (a pane’s `key`, else its index), `x-model` binds it two-way. Drag a pane with a finger or the mouse, press an arrow or a dot, or use the keys on the panes.
16
+
17
+ ```tsx
18
+ import { Gallery } from '@motifx-community/ui';
19
+ import { scene } from './scenes';
20
+
21
+ /** Five pictures with captions: the buttons at the sides, the dots under them, a swipe or the arrow keys move them. */
22
+ export default function Basic() {
23
+ return (
24
+ <Gallery
25
+ class="ga-trip"
26
+ label="A trip"
27
+ height={300}
28
+ items={[
29
+ { image: scene(205), alt: 'Boats in a harbour', text: 'Harbour', description: 'Early morning' },
30
+ { image: scene(30), alt: 'Market stalls', text: 'Market' },
31
+ { image: scene(120), alt: 'Hills under cloud', text: 'Hills', description: 'After the rain' },
32
+ { image: scene(280), alt: 'The town at night', text: 'Night' },
33
+ { image: scene(345), alt: 'The way home', text: 'Home', description: 'Last day' }
34
+ ]}
35
+ />
36
+ );
37
+ }
38
+ ```
39
+
40
+ ## Loop and slideshow
41
+
42
+ `loop` goes around the ends: the pane on the other side is brought next to the one leaving, so the move never runs back across the panes between. `slideInterval` makes a slideshow; it waits while the pointer rests on the gallery, while focus is inside, while the page is out of sight and under reduced motion, and the button in the bar pauses it. `stretchImages` fills the panes.
43
+
44
+ ```tsx
45
+ import { reactive } from '@motifx/core';
46
+ import { Gallery, Stack } from '@motifx-community/ui';
47
+ import { scene } from './scenes';
48
+
49
+ /** A slideshow around the ends: it moves on every 2.5 s, waits while the pointer or focus is on it, and its button pauses it. */
50
+ export default function Slideshow() {
51
+ const s = reactive({ shown: 0 as string | number | null, told: '' });
52
+ return (
53
+ <Stack gap="sm" style="inline-size: 100%">
54
+ <Gallery
55
+ class="ga-show"
56
+ label="Slideshow"
57
+ height={240}
58
+ loop
59
+ stretchImages
60
+ slideInterval={2500}
61
+ x-model={() => s.shown}
62
+ onSlideChanged={e => (s.told = e.byUser ? 'moved by you' : 'moved by the slideshow')}
63
+ items={[
64
+ { image: scene(190), alt: 'Dawn over the sea', text: 'Dawn' },
65
+ { image: scene(50), alt: 'Noon in the square', text: 'Noon' },
66
+ { image: scene(260), alt: 'Dusk on the hill', text: 'Dusk' }
67
+ ]}
68
+ />
69
+ <output class="ga-show-told">{() => `in view: ${s.shown}${s.told ? `, ${s.told}` : ''}`}</output>
70
+ </Stack>
71
+ );
72
+ }
73
+ ```
74
+
75
+ ## Several panes side by side
76
+
77
+ `itemsPerPage` puts that many panes in the width, the `gap` token between them. The buttons and the keys move one pane at a time and stop when the last pane is in view; the pane in view is the first of them.
78
+
79
+ ```tsx
80
+ import { Gallery } from '@motifx-community/ui';
81
+ import { scene } from './scenes';
82
+
83
+ /** Three panes share the width; next and previous move one pane at a time and stop when the last is in view. */
84
+ export default function PerPage() {
85
+ const places = ['Pier', 'Lane', 'Roof', 'Park', 'Bridge', 'Shore', 'Tower'];
86
+ return (
87
+ <Gallery
88
+ class="ga-wide"
89
+ label="Places"
90
+ height={150}
91
+ itemsPerPage={3}
92
+ stretchImages
93
+ items={places.map((place, i) => ({ image: scene(i * 48), alt: `The ${i + 1}. picture of the walk`, text: place }))}
94
+ />
95
+ );
96
+ }
97
+ ```
98
+
99
+ ## Any content
100
+
101
+ An item’s `content` makes the pane’s content when the pane is made; what is in it works as anywhere else. `onItemClick` tells a press on the pane that was not a drag.
102
+
103
+ ```tsx
104
+ import { reactive } from '@motifx/core';
105
+ import { Button, Gallery, Stack } from '@motifx-community/ui';
106
+
107
+ const PLANS = [
108
+ { name: 'Starter', price: '€9', line: 'One project, two people' },
109
+ { name: 'Team', price: '€29', line: 'Ten projects, your whole team' },
110
+ { name: 'Company', price: '€79', line: 'No limits, a person to call' }
111
+ ];
112
+
113
+ /** Any content in a pane: a plan each, with its own button; a press on the pane itself is told too. */
114
+ export default function Content() {
115
+ const s = reactive({ told: '' });
116
+ const plan = (p: (typeof PLANS)[number]) => (
117
+ <Stack class="ga-plan" gap="xs" align="center" justify="center" style="block-size: 100%">
118
+ <strong>{p.name}</strong>
119
+ <span class="ga-plan-price">{p.price} a month</span>
120
+ <span>{p.line}</span>
121
+ <Button text="Choose" variant="outline" onclick={() => (s.told = `${p.name} chosen`)} />
122
+ </Stack>
123
+ );
124
+ return (
125
+ <Stack gap="sm" style="inline-size: 100%">
126
+ <Gallery class="ga-plans" label="Plans" height={200} swipeEnabled={false} items={PLANS.map(p => ({ key: p.name, content: () => plan(p) }))} onItemClick={e => (s.told = `pane ${e.index + 1} pressed`)} />
127
+ <output class="ga-plans-told">{() => s.told}</output>
128
+ </Stack>
129
+ );
130
+ }
131
+ ```
132
+
133
+ ## Programmatic use
134
+
135
+ Made with `new`, moved with `next()`, `previous()` and `goTo()`; `showNavButtons` and `showIndicator` off leave the moving to your own buttons, `onSlideChanged` tells where it stands.
136
+
137
+ ```tsx
138
+ import { reactive } from '@motifx/core';
139
+ import { Button, Gallery, Stack } from '@motifx-community/ui';
140
+ import { scene } from './scenes';
141
+
142
+ /** A gallery made programmatically without its own buttons or dots: yours move it, and `onSlideChanged` tells where it is. */
143
+ export default function Programmatic() {
144
+ const s = reactive({ at: 0, told: '' });
145
+ const coded = new Gallery({
146
+ label: 'Rooms',
147
+ height: 200,
148
+ showNavButtons: false,
149
+ showIndicator: false,
150
+ swipeEnabled: false,
151
+ items: [
152
+ { key: 'hall', image: scene(20), alt: 'The hall', text: 'Hall' },
153
+ { key: 'study', image: scene(200), alt: 'The study', text: 'Study' },
154
+ { key: 'garden', image: scene(110), alt: 'The garden', text: 'Garden' }
155
+ ],
156
+ onSlideChanged: e => {
157
+ s.at = e.index;
158
+ s.told = `slide ${e.index + 1} of ${coded.count}`;
159
+ }
160
+ });
161
+ return (
162
+ <Stack gap="sm" style="inline-size: 100%">
163
+ <span class="ga-rooms" onConfig={c => c.controls.add(coded)} />
164
+ <Stack orientation="horizontal" wrap align="center">
165
+ <Button text="Previous" variant="outline" enabled={() => s.at > 0} onclick={() => void coded.previous()} />
166
+ <Button text="Next" variant="outline" enabled={() => s.at < 2} onclick={() => void coded.next()} />
167
+ <Button text="Garden" variant="outline" onclick={() => void coded.goTo('garden')} />
168
+ <output class="ga-rooms-told">{() => s.told}</output>
169
+ </Stack>
170
+ </Stack>
171
+ );
172
+ }
173
+ ```
174
+
175
+ ## Keyboard
176
+
177
+ | Key | What it does |
178
+ | --- | --- |
179
+ | `Tab` | The slideshow button, the dots (one stop: the dot of the pane in view), the previous button, the panes, the next button; what is in the pane in view after it. |
180
+ | `Arrow keys` | On the panes or the dots: Left and Right (the other way round in a right-to-left page) move to the previous and the next pane, Home and End to the first and the last. |
181
+ | `Enter, Space` | On a button or a dot: press it. |
182
+
183
+ ## Accessibility
184
+
185
+ | Topic | How |
186
+ | --- | --- |
187
+ | `Landmark` | A `region` with `aria-roledescription="carousel"`, named “Gallery” in the kit language; several on one page: give each its own `label`. |
188
+ | `A pane` | A `group` with `aria-roledescription="slide"` named “Slide 2 of 5”; the panes out of view are hidden from readers and from the keys (`inert`). |
189
+ | `Images` | Give each an `alt`; an empty one is a decorative image. The caption is read as the pane’s content. |
190
+ | `Slideshow` | The panes are a live region while it is stopped (`polite`), silent while it runs (`off`), as the carousel pattern asks; the button to stop it comes first in the Tab order. |
191
+ | `Dots and arrows` | Buttons named “Slide 2 of 5”, “Previous slide” and “Next slide”; the dot of the pane in view is `aria-current`; an arrow at an end is `aria-disabled`. |
192
+
193
+ ## Styling
194
+
195
+ | Hook | What it is |
196
+ | --- | --- |
197
+ | `.mx-gallery` | The gallery. `data-swipe` when a drag moves it, `data-dragging` while one does, `data-playing` while the slideshow is on, `data-stretch`. |
198
+ | `.mx-gallery__viewport, .mx-gallery__track` | The frame that clips the panes and the track that slides in it (`data-dragging`, `data-no-motion`). |
199
+ | `.mx-gallery__item, .mx-gallery__figure, .mx-gallery__image` | A pane (`data-current`, `aria-hidden`), what it shows, the image. |
200
+ | `.mx-gallery__caption, .mx-gallery__title, .mx-gallery__description` | The band over the bottom of a pane and its two lines. |
201
+ | `.mx-gallery__nav, .mx-gallery__arrow` | The previous and next buttons (`data-direction`, `aria-disabled`) and the glyph in them. |
202
+ | `.mx-gallery__bar, .mx-gallery__indicator, .mx-gallery__dot, .mx-gallery__play, .mx-gallery__play-glyph` | The bar over the bottom, the dots (`aria-current`), the slideshow button and its glyph. |
203
+
204
+ ### Component tokens
205
+
206
+ | Token | What it sets |
207
+ | --- | --- |
208
+ | `gallery.frame, .item, .caption, .title, .description` | Units: the frame (`focus`, `swipeable`, `dragging`), a pane (`current`), the caption and its texts. |
209
+ | `gallery.nav, .arrow, .dot, .play, .play-glyph, .bar` | Units: the side buttons (`hover`, `pressed`, `focus`, `disabled`), their glyph (`icon` per direction), the dots (`current`, `hover`, `pressed`, `focus`), the slideshow button and its glyph (`icon` while `playing`), the bar. |
210
+ | `gallery.gap, .nav-inset, .bar-inset, .indicator-gap, .caption-padding` | Between panes side by side, from the sides and the bottom to what lies over them, between the dots, inside a caption. |
211
+
212
+ ## API reference
213
+
214
+ ### Props
215
+
216
+ | Prop | Type | Default | Description |
217
+ | --- | --- | --- | --- |
218
+ | `items` | `Bind<readonly (GalleryItem \| string)[]>` | `[]` | The panes in order: `GalleryItem`s (`image`, `alt`, `text`, `description`, `key`, `content`, `data`) or image addresses. |
219
+ | `value` | `Bind<string \| number \| null>` | `0` | The pane in view: its `key`, else its index. `x-model` binds it two-way. |
220
+ | `loop` | `Bind<boolean>` | `false` | After the last pane comes the first; the move goes around the ends, not back across the panes between. |
221
+ | `showNavButtons` | `Bind<boolean>` | `true` | The previous and next buttons over the sides. |
222
+ | `showIndicator` | `Bind<boolean>` | `true` | The dots under the panes, one per pane. |
223
+ | `slideInterval` | `Bind<number>` | `0` | Milliseconds a pane stays in a slideshow; `0` for none. It pauses under the pointer, while focus is inside, out of sight and under reduced motion. |
224
+ | `pauseOnHover` | `Bind<boolean>` | `true` | The slideshow waits while the pointer rests on the gallery. |
225
+ | `swipeEnabled` | `Bind<boolean>` | `true` | A finger or a pointer drags the panes; a drag far or fast enough lands on the next one. |
226
+ | `itemsPerPage` | `Bind<number>` | `1` | Panes side by side in the width, with the `gap` token between them. |
227
+ | `stretchImages` | `Bind<boolean>` | `false` | An image fills its pane, cut at the edges, instead of fitting inside it whole. |
228
+ | `height` | `Bind<string \| number \| null>` | `null` | A CSS length or pixels. Without one the gallery is as tall as its tallest pane. |
229
+ | `label` | `Bind<string>` | the kit’s “Gallery” | What screen readers call it. |
230
+
231
+ ### Events, properties and methods
232
+
233
+ | Member | Kind | Description |
234
+ | --- | --- | --- |
235
+ | `onSlideChanging` | event | The pane in view is about to change (`from`, `to`, `fromItem`, `toItem`, `byUser`); `cancel = true` keeps the one there. |
236
+ | `onSlideChanged` | event | The pane in view changed (`index`, `item`, `previous`, `byUser`: by a press, a swipe or a key, else programmatically or the slideshow). |
237
+ | `onItemClick` | event | A press on a pane that was not a drag (`index`, `item`, `event`). |
238
+ | `selectedIndex` | read-only | The index of the pane in view; -1 when there is none. |
239
+ | `count` | read-only | How many panes there are. |
240
+ | `isPlaying` | read-only | The slideshow runs now: not paused, and nothing holds it. |
241
+ | `next(), previous()` | `Promise<boolean>` | Goes to the next or the previous pane; `false` at an end without `loop`, or when the change was refused. |
242
+ | `goTo(pane)` | `Promise<boolean>` | Goes to a pane by index or key; `onSlideChanging` is asked first. |
243
+ | `play(), pause()` | `void` | Starts the slideshow again, or stops it until `play()`; the button in the bar does the same. |
244
+ | `refresh()` | `void` | Reads the items again after they were changed in place. |
package/docs/home.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @motifx-community/ui
2
2
 
3
- > Get started · @motifx-community/ui 0.1.0-beta.1
3
+ > Get started · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  Components for MotifJS that work the way desktop UI does — created when needed, shown anywhere, closed and disposed like windows — drawn from the MotifJS design system's tokens.
6
6
 
@@ -22,14 +22,18 @@ import { Button, Control, FocusContainer, addShortcut } from '@motifx-community/
22
22
 
23
23
  ## What ships today
24
24
 
25
- The components are being written one at a time; Button is the first. Under them is the base they all build on: focus and the keyboard, and the shared parts a menu or a drop-down opens on.
25
+ More than fifty components, every one an object with the same base: focus and the keyboard, the right roles and names for a screen reader, texts in English and Turkish that switch while the app runs, right to left, and a look in each of the design system's five languages (Tactile, Lounge, Material, Fluent, Lilac) painted from component tokens. Each has a page with live examples and its API.
26
26
 
27
- | Part | What it is |
27
+ | Group | Components |
28
28
  | --- | --- |
29
- | [`Button`](button.md) | Solid, outline and ghost in three tones and sizes, pressable; icon, `&` access key, toggle, busy; a menu or any content, from the whole button or with `split` from an arrow next to it. |
30
- | `Popup`, `MenuList` | The shared parts: a surface above the page that follows its anchor and closes on Escape or a press outside, and a keyboard-driven list of commands. |
31
- | [`Control`](control.md) | The base of every control: `text`, `enabled`, `visible`, `tabStop` and focus, the same from JSX and from code. |
32
- | [`FocusContainer`, `addShortcut`](keyboard.md) | Tab order, the active control of a container, `&` access keys, shortcuts, and focus that never falls to the page when a control goes away. |
29
+ | Buttons and commands | [`Button`](button.md) (menu, split, toggle, busy), [`ButtonGroup`](buttongroup.md), [`Toolbar`](toolbar.md), [`MenuBar` and `ContextMenu`](menus.md) |
30
+ | Editors | [`TextBox`](textbox.md) (mask, validation), [`TextArea`](textarea.md), [`NumberBox`](numberbox.md), [`DateBox`](datebox.md), [`DateRangeBox`](daterangebox.md), [`Calendar`](calendar.md), [`ColorBox` and `ColorPicker`](colorbox.md), [`Slider`](slider.md), [`Rating`](rating.md), [`FileUploader`](fileuploader.md) |
31
+ | Choice | [`CheckBox`](checkbox.md), [`Switch`](switch.md), [`RadioGroup`](radiogroup.md), [`DropDown`](dropdown.md), [`ComboBox` and `Autocomplete`](combobox.md), [`Lookup`](lookup.md), [`TagBox`](tagbox.md), [`ListBox`](listbox.md) |
32
+ | Display and feedback | [`Badge`](badge.md), [`Avatar` and `AvatarGroup`](avatar.md), [`Chip` and `ChipGroup`](chip.md), [`Card`](card.md), [`Skeleton`](skeleton.md), [`ProgressBar` and `Spinner`](progress.md), [`LoadPanel`](loadpanel.md), [`Tooltip`](tooltip.md), [`Popover`](popover.md), [`Toast`](toast.md) |
33
+ | Navigation and layers | [`Tabs`](tabs.md), [`Accordion`](accordion.md), [`Breadcrumb`](breadcrumb.md), [`Pagination`](pagination.md), [`Stepper`](stepper.md), [`Wizard`](wizard.md), [`Window` and dialog](window.md), [`BottomSheet`](bottomsheet.md), [`Drawer`](drawer.md), [`ActionSheet`](actionsheet.md) |
34
+ | Layout | [`Stack`, `Grid`, `DockPanel`, `Panel`, `GroupBox`, `SplitContainer`](layout.md), [`FormLayout`](formlayout.md), [`ScrollView`](scrollview.md) (pull to refresh, load more), [`Sortable`](sortable.md) |
35
+ | Data | [`DataGrid`](datagrid.md) (virtual or paged, editing, filters, grouping, master-detail, export), [`TreeView`](treeview.md), [`FilterBuilder`](filterbuilder.md), [`Scheduler`](scheduler.md) (day to timeline, recurrence, resources, iCalendar), [`TabDocumentManager`](tabdocs.md) (tabs, split, dock, new windows); lists and grids read `@motifx-community/data` sources |
36
+ | Base | [`Control`](control.md), [`FocusContainer` and `addShortcut`](keyboard.md), [`uiLocale`](language.md), [the component tokens](tokens.md); `Popup` and `MenuList`, the shared parts a menu or a drop-down opens on |
33
37
 
34
38
  ## Design system
35
39
 
package/docs/keyboard.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Keyboard and focus
2
2
 
3
- > Foundations · @motifx-community/ui 0.1.0-beta.1
3
+ > Foundations · @motifx-community/ui 0.1.0-beta.3
4
4
 
5
5
  The rules every control follows: Tab order, the active control of a container, focus that never falls to `<body>`, `&File` access keys and app-wide shortcuts.
6
6
 
@@ -0,0 +1,229 @@
1
+ # Language
2
+
3
+ > Foundations · @motifx-community/ui 0.1.0-beta.3
4
+
5
+ The texts the controls write, the locale their dates and numbers follow, and the direction: one `uiLocale` for the kit, with a pack per language loaded as it is asked for.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { uiLocale, connectI18n } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Switching the language
14
+
15
+ `uiLocale.use('tr')` loads the Turkish pack the first time, then every control on the page draws its texts and formats again. The Language menu in the header of these docs does the same.
16
+
17
+ ```tsx
18
+ import { reactive } from '@motifx/core';
19
+ import { Button, DateBox, NumberBox, Pagination, Stack, uiLocale } from '@motifx-community/ui';
20
+ import { kitTexts } from '../../../shared/kit-texts';
21
+
22
+ /** The kit's language switched live: the pack is loaded first, then every control draws its texts and formats again. */
23
+ export default function Switch() {
24
+ const s = reactive({ price: 1234.5, when: new Date(2026, 2, 18) as Date | null });
25
+ return (
26
+ <Stack gap="md">
27
+ <Stack orientation="horizontal" wrap align="center">
28
+ <Button text="English" variant="outline" onclick={() => void uiLocale.use('en')} />
29
+ <Button text="Türkçe" variant="outline" onclick={() => void uiLocale.use('tr')} />
30
+ <span>
31
+ In use: <output class="lang-locale">{() => kitTexts.locale}</output>
32
+ </span>
33
+ </Stack>
34
+ <Stack orientation="horizontal" wrap align="center">
35
+ <NumberBox label="Price" x-model={() => s.price} format={{ style: 'currency', currency: 'EUR' }} />
36
+ <DateBox label="When" x-model={() => s.when} clearButton />
37
+ </Stack>
38
+ <Pagination total={95} pageSizes={[10, 20, 50]} label="Orders" />
39
+ </Stack>
40
+ );
41
+ }
42
+ ```
43
+
44
+ ## The rules
45
+
46
+ | Rule | How |
47
+ | --- | --- |
48
+ | `Start` | The page’s `<html lang>`, else the browser’s language. Set `lang` before the first control is made; `uiLocale.ready` settles once that language is in. |
49
+ | `Texts` | Every text a control writes itself (a button’s name, a message, “No items”) comes from the pack of the language in use; English fills what the pack leaves out. |
50
+ | `Formats` | Dates, numbers, the first day of the week and 12 or 24 hours follow `uiLocale.locale`; a control’s own `locale` prop wins for that control. |
51
+ | `Direction` | `uiLocale.dir` is `rtl` for Arabic, Hebrew, Persian, Urdu…; the controls lay themselves out from `<html dir>`, which `@motifx-community/i18n` keeps in step. |
52
+ | `Nothing follows` | A change is one event, `onChanged`: the controls draw again on it, and so can your own texts. No binding reads `uiLocale`. |
53
+ | `Plurals` | A text with a count is an ICU message, `{count, plural, one {# record} other {# records}}`; a pack writes it the way its language counts. |
54
+
55
+ ## Packs
56
+
57
+ | Pack | Where it comes from |
58
+ | --- | --- |
59
+ | `English` | Built in. What a pack leaves out is shown in English. |
60
+ | `Turkish` | `uiLocale.use('tr')` loads it the first time, as a chunk of the package. |
61
+ | `@motifx-community/ui/locales/<language>.json` | The same packs as files, for an app that bundles or serves them its own way: `uiLocale.add('tr', pack)`. |
62
+ | `uiLocale.loader` | Where the kit asks for a pack it does not have: `(language) => fetch(`/i18n/ui/${language}.json`).then((r) => r.json())`. A language without a pack keeps the English texts. |
63
+
64
+ A pack of your own is a plain object of the kit’s texts: `uiLocale.add` gives a language its texts, `use` switches to it. A few texts are enough to start; the rest stay English until the pack has them.
65
+
66
+ ```tsx
67
+ import { Button, DropDown, Stack, uiLocale } from '@motifx-community/ui';
68
+
69
+ // A few German texts; what is left out stays English.
70
+ uiLocale.add('de', {
71
+ close: 'Schließen',
72
+ clear: 'Leeren',
73
+ search: 'Suchen',
74
+ noItems: 'Keine Einträge',
75
+ loading: 'Wird geladen…',
76
+ ok: 'OK',
77
+ cancel: 'Abbrechen',
78
+ });
79
+
80
+ /** A pack of your own: `uiLocale.add` gives a language its texts, `use` switches to it. */
81
+ export default function OwnPack() {
82
+ return (
83
+ <Stack gap="md">
84
+ <Stack orientation="horizontal" wrap align="center">
85
+ <Button text="Deutsch" variant="outline" onclick={() => void uiLocale.use('de')} />
86
+ <Button text="English" variant="outline" onclick={() => void uiLocale.use('en')} />
87
+ </Stack>
88
+ <DropDown label="Empty list" items={[]} placeholder="Open me" />
89
+ </Stack>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ## With your app’s translations
95
+
96
+ An app translated with `@motifx-community/i18n` has one locale already. `connectI18n(i18n)` makes the kit follow it: when the app switches, the kit loads its own pack and switches too. The link is undone by what it returns.
97
+
98
+ ```tsx
99
+ import { Component } from '@motifx/core';
100
+ import { createI18n } from '@motifx-community/i18n';
101
+ import { Button, connectI18n, Stack, TextBox } from '@motifx-community/ui';
102
+
103
+ // The app's own translations; the kit follows their locale.
104
+ const i18n = createI18n({
105
+ locale: 'en',
106
+ messages: {
107
+ en: { greeting: 'Hello {name}', hint: 'The clear button is named by the kit' },
108
+ tr: { greeting: 'Merhaba {name}', hint: 'Temizle düğmesini kit adlandırır' },
109
+ },
110
+ dom: false,
111
+ });
112
+
113
+ /** One locale for the app and the kit: `connectI18n` switches the kit whenever the app's translations switch. */
114
+ export default class Connect extends Component<HTMLDivElement> {
115
+ override onBuilt(): void {
116
+ this.motif.setDisposable(connectI18n(i18n));
117
+ }
118
+
119
+ override view() {
120
+ return (
121
+ <Stack gap="md">
122
+ <Stack orientation="horizontal" wrap align="center">
123
+ <Button text="English" variant="outline" onclick={() => void i18n.setLocale('en')} />
124
+ <Button text="Türkçe" variant="outline" onclick={() => void i18n.setLocale('tr')} />
125
+ </Stack>
126
+ <p class="lang-greeting">{() => i18n.t('greeting', { name: 'Ada' })}</p>
127
+ <TextBox label={() => i18n.t('hint')} value="Clear me" clearButton />
128
+ </Stack>
129
+ );
130
+ }
131
+ }
132
+ ```
133
+
134
+ ## Your own texts that follow
135
+
136
+ The kit follows nothing: a change of language is told once, through `uiLocale.onChanged`. Keep your own texts with it, and fill the kit’s own texts with `uiLocale.text`, plurals included.
137
+
138
+ ```tsx
139
+ import { Component, reactive } from '@motifx/core';
140
+ import { Button, NumberBox, Stack, uiLocale } from '@motifx-community/ui';
141
+
142
+ const OWN = {
143
+ en: { title: 'Orders', hint: 'Written by the app, kept with the kit’s language' },
144
+ tr: { title: 'Siparişler', hint: 'Uygulama yazar, kitin diliyle birlikte değişir' },
145
+ };
146
+
147
+ /** Your own texts drawn again on `uiLocale.onChanged`, and the kit's plural texts filled with `uiLocale.text`. */
148
+ export default class OwnTexts extends Component<HTMLDivElement> {
149
+ s = reactive({ count: 3, title: '', hint: '', records: '' });
150
+
151
+ override onBuilt(): void {
152
+ this.motif.register(uiLocale.onChanged(() => this.draw()));
153
+ this.draw();
154
+ }
155
+
156
+ draw(): void {
157
+ const own = uiLocale.locale.startsWith('tr') ? OWN.tr : OWN.en;
158
+ this.s.title = own.title;
159
+ this.s.hint = own.hint;
160
+ this.s.records = uiLocale.text('gridRecords', { count: this.s.count });
161
+ }
162
+
163
+ override view() {
164
+ return (
165
+ <Stack gap="md">
166
+ <Stack orientation="horizontal" wrap align="center">
167
+ <Button text="English" variant="outline" onclick={() => void uiLocale.use('en')} />
168
+ <Button text="Türkçe" variant="outline" onclick={() => void uiLocale.use('tr')} />
169
+ </Stack>
170
+ <p>
171
+ <strong class="lang-own-title">{this.s.title}</strong>
172
+ </p>
173
+ <p>{this.s.hint}</p>
174
+ <Stack orientation="horizontal" wrap align="center">
175
+ <NumberBox label="Count" min={0} max={99} x-model={() => this.s.count} onValueChanged={() => this.draw()} />
176
+ <output class="lang-records">{this.s.records}</output>
177
+ </Stack>
178
+ </Stack>
179
+ );
180
+ }
181
+ }
182
+ ```
183
+
184
+ ## Formats of one control
185
+
186
+ Dates and numbers follow the kit’s locale. A control given a `locale` of its own writes that one, whatever the kit’s language is.
187
+
188
+ ```tsx
189
+ import { reactive } from '@motifx/core';
190
+ import { DateBox, NumberBox, Stack } from '@motifx-community/ui';
191
+
192
+ /** A control's own `locale` wins over the kit's: these write German and Japanese whatever the kit's language is. */
193
+ export default function Formats() {
194
+ const s = reactive({ amount: 98765.43, day: new Date(2026, 2, 18) as Date | null });
195
+ return (
196
+ <Stack orientation="horizontal" wrap align="center">
197
+ <NumberBox label="Betrag" locale="de-DE" format={{ style: 'currency', currency: 'EUR' }} x-model={() => s.amount} />
198
+ <DateBox label="日付" locale="ja-JP" x-model={() => s.day} />
199
+ <NumberBox label="The kit's locale" format={{ style: 'currency', currency: 'EUR' }} x-model={() => s.amount} />
200
+ </Stack>
201
+ );
202
+ }
203
+ ```
204
+
205
+ ## Checking a pack
206
+
207
+ In the repository, `npm run locales` checks every pack the kit ships, and `npm run locales -- path/to/de.json` one of your own. The texts themselves are in `src/locales/en.json`; a pack is the same keys in another language.
208
+
209
+ | Check | What it means |
210
+ | --- | --- |
211
+ | `Every text` | A pack names every text of `en.json`; one it leaves out is shown in English, and the check says which. |
212
+ | `Only the kit’s texts` | A key `en.json` does not have is a typo. |
213
+ | `The same arguments` | A text fills the same `{values}` as the English one, in ICU; the plural forms are the language’s own. |
214
+ | `The interface` | `UiStrings` and `en.json` name the same keys. |
215
+
216
+ ## API reference
217
+
218
+ | Member | Type | Description |
219
+ | --- | --- | --- |
220
+ | `uiLocale.use(locale)` | `Promise<void>` | Switches to `locale` (`tr`, `tr-TR`): its pack is loaded first when it is not there, then every control draws again. A later call wins over one still loading. |
221
+ | `uiLocale.locale` | `string` | The locale in use. |
222
+ | `uiLocale.dir` | `'ltr' \| 'rtl'` | The direction of the locale in use. |
223
+ | `uiLocale.strings` | `UiStrings` | The texts in use. Assigning a set changes the texts and keeps the locale: `uiLocale.strings = { ...uiLocale.strings, close: 'Shut' }`. |
224
+ | `uiLocale.text(key, values)` | `string` | A text of the kit with its values filled in: `uiLocale.text('gridRecords', { count: 3 })`. |
225
+ | `uiLocale.add(language, pack)` | `void` | Adds the pack of a language, or more texts to it; a language in use shows them at once. |
226
+ | `uiLocale.loader` | `(language) => Promise<UiPackModule>` | Where packs come from; the package by default. |
227
+ | `uiLocale.ready` | `Promise<void>` | Settles once the starting language is in. |
228
+ | `uiLocale.onChanged` | event | Raised once the language changed, with `locale` and `previous`. |
229
+ | `connectI18n(i18n)` | `() => void` | Keeps the kit’s language with your app’s translations (`@motifx-community/i18n`, or anything with `locale` and `onLocaleChanged`); returns what stops it. |