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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +16 -10
  3. package/dist/components/calendar/Calendar.d.ts +12 -0
  4. package/dist/components/calendar/calendar-props.d.ts +5 -0
  5. package/dist/components/daterangebox/DateRangeBox.d.ts +121 -0
  6. package/dist/components/daterangebox/date-range-box-props.d.ts +35 -0
  7. package/dist/components/daterangebox/date-range-preset.d.ts +6 -0
  8. package/dist/components/daterangebox/date-range.d.ts +2 -0
  9. package/dist/components/daterangebox/index.d.ts +4 -0
  10. package/dist/components/fileuploader/FileUploader.d.ts +133 -0
  11. package/dist/components/fileuploader/file-uploader-props.d.ts +46 -0
  12. package/dist/components/fileuploader/files-added-event-args.d.ts +9 -0
  13. package/dist/components/fileuploader/index.d.ts +7 -0
  14. package/dist/components/fileuploader/upload-event-args.d.ts +10 -0
  15. package/dist/components/fileuploader/upload-item.d.ts +12 -0
  16. package/dist/components/fileuploader/upload-mode.d.ts +2 -0
  17. package/dist/components/fileuploader/upload-status.d.ts +2 -0
  18. package/dist/components/loadpanel/LoadPanel.d.ts +70 -0
  19. package/dist/components/loadpanel/index.d.ts +3 -0
  20. package/dist/components/loadpanel/load-panel-props.d.ts +29 -0
  21. package/dist/components/loadpanel/load-panel-target.d.ts +3 -0
  22. package/dist/components/popover/Popover.d.ts +98 -0
  23. package/dist/components/popover/index.d.ts +5 -0
  24. package/dist/components/popover/popover-close-reason.d.ts +2 -0
  25. package/dist/components/popover/popover-closing-event-args.d.ts +8 -0
  26. package/dist/components/popover/popover-props.d.ts +39 -0
  27. package/dist/components/popover/popover-show-on.d.ts +2 -0
  28. package/dist/components/scrollview/ScrollView.d.ts +109 -0
  29. package/dist/components/scrollview/index.d.ts +7 -0
  30. package/dist/components/scrollview/pull-down-event-args.d.ts +9 -0
  31. package/dist/components/scrollview/reach-bottom-event-args.d.ts +9 -0
  32. package/dist/components/scrollview/scroll-event-args.d.ts +7 -0
  33. package/dist/components/scrollview/scroll-view-bars.d.ts +2 -0
  34. package/dist/components/scrollview/scroll-view-direction.d.ts +2 -0
  35. package/dist/components/scrollview/scroll-view-props.d.ts +31 -0
  36. package/dist/components/sortable/Sortable.d.ts +106 -0
  37. package/dist/components/sortable/index.d.ts +5 -0
  38. package/dist/components/sortable/sortable-drag-event-args.d.ts +15 -0
  39. package/dist/components/sortable/sortable-drop-event-args.d.ts +11 -0
  40. package/dist/components/sortable/sortable-orientation.d.ts +2 -0
  41. package/dist/components/sortable/sortable-props.d.ts +34 -0
  42. package/dist/components/stepper/Stepper.d.ts +121 -0
  43. package/dist/components/stepper/Wizard.d.ts +112 -0
  44. package/dist/components/stepper/WizardStep.d.ts +44 -0
  45. package/dist/components/stepper/index.d.ts +13 -0
  46. package/dist/components/stepper/step-changed-event-args.d.ts +11 -0
  47. package/dist/components/stepper/step-changing-event-args.d.ts +18 -0
  48. package/dist/components/stepper/stepper-item.d.ts +20 -0
  49. package/dist/components/stepper/stepper-label-position.d.ts +2 -0
  50. package/dist/components/stepper/stepper-orientation.d.ts +1 -0
  51. package/dist/components/stepper/stepper-props.d.ts +32 -0
  52. package/dist/components/stepper/stepper-status.d.ts +2 -0
  53. package/dist/components/stepper/wizard-finishing-event-args.d.ts +7 -0
  54. package/dist/components/stepper/wizard-props.d.ts +48 -0
  55. package/dist/components/stepper/wizard-step-props.d.ts +32 -0
  56. package/dist/core/flow-home.d.ts +6 -0
  57. package/dist/core/fold-text.d.ts +6 -0
  58. package/dist/core/ui-locale.d.ts +0 -2
  59. package/dist/core/ui-strings.d.ts +41 -0
  60. package/dist/generated/tokens.d.ts +1146 -11
  61. package/dist/index.d.ts +8 -1
  62. package/dist/index.js +22564 -20283
  63. package/dist/index.js.map +1 -1
  64. package/dist/locales/en.json +38 -1
  65. package/dist/locales/tr.json +38 -1
  66. package/dist/styles.css +1825 -5
  67. package/dist/tokens/index.d.ts +1146 -11
  68. package/dist/tokens/index.js +1146 -11
  69. package/dist/tokens/index.js.map +1 -1
  70. package/dist/tr-B218zMtu.js +1191 -0
  71. package/dist/tr-B218zMtu.js.map +1 -0
  72. package/docs/accordion.md +1 -1
  73. package/docs/actionsheet.md +1 -1
  74. package/docs/avatar.md +1 -1
  75. package/docs/badge.md +1 -1
  76. package/docs/bottomsheet.md +3 -3
  77. package/docs/breadcrumb.md +2 -2
  78. package/docs/button.md +3 -3
  79. package/docs/buttongroup.md +1 -1
  80. package/docs/calendar.md +1 -1
  81. package/docs/card.md +1 -1
  82. package/docs/checkbox.md +3 -3
  83. package/docs/chip.md +1 -1
  84. package/docs/colorbox.md +1 -1
  85. package/docs/combobox.md +1 -1
  86. package/docs/control.md +1 -1
  87. package/docs/datagrid-api.md +3 -3
  88. package/docs/datagrid-bands.md +1 -1
  89. package/docs/datagrid-drag-select.md +1 -1
  90. package/docs/datagrid-drag.md +1 -1
  91. package/docs/datagrid-editing.md +1 -1
  92. package/docs/datagrid-filtering.md +1 -1
  93. package/docs/datagrid-forms.md +1 -1
  94. package/docs/datagrid-grouping.md +1 -1
  95. package/docs/datagrid-layout.md +1 -1
  96. package/docs/datagrid-lookups.md +1 -1
  97. package/docs/datagrid-master-detail.md +1 -1
  98. package/docs/datagrid-scrolling.md +1 -1
  99. package/docs/datagrid-selection.md +1 -1
  100. package/docs/datagrid.md +1 -1
  101. package/docs/datebox.md +3 -3
  102. package/docs/daterangebox.md +192 -0
  103. package/docs/drawer.md +1 -1
  104. package/docs/dropdown.md +3 -3
  105. package/docs/fileuploader.md +201 -0
  106. package/docs/filterbuilder.md +3 -3
  107. package/docs/formlayout.md +1 -1
  108. package/docs/home.md +1 -1
  109. package/docs/keyboard.md +1 -1
  110. package/docs/language.md +229 -0
  111. package/docs/layout.md +3 -3
  112. package/docs/listbox.md +3 -3
  113. package/docs/loadpanel.md +184 -0
  114. package/docs/lookup.md +1 -1
  115. package/docs/menus.md +1 -1
  116. package/docs/numberbox.md +3 -3
  117. package/docs/pagination.md +1 -1
  118. package/docs/popover.md +221 -0
  119. package/docs/progress.md +3 -3
  120. package/docs/radiogroup.md +1 -1
  121. package/docs/rating.md +1 -1
  122. package/docs/scheduler-agenda.md +1 -1
  123. package/docs/scheduler-big-data.md +1 -1
  124. package/docs/scheduler-editing.md +1 -1
  125. package/docs/scheduler-form.md +1 -1
  126. package/docs/scheduler-icalendar.md +1 -1
  127. package/docs/scheduler-mobile.md +1 -1
  128. package/docs/scheduler-recurrence.md +1 -1
  129. package/docs/scheduler-resources.md +1 -1
  130. package/docs/scheduler-timeline.md +1 -1
  131. package/docs/scheduler.md +1 -1
  132. package/docs/scrollview.md +185 -0
  133. package/docs/showcase.md +1 -1
  134. package/docs/skeleton.md +1 -1
  135. package/docs/slider.md +3 -3
  136. package/docs/sortable.md +213 -0
  137. package/docs/stepper.md +238 -0
  138. package/docs/switch.md +1 -1
  139. package/docs/tabdocs-dock.md +1 -1
  140. package/docs/tabdocs-drag.md +1 -1
  141. package/docs/tabdocs-menus.md +1 -1
  142. package/docs/tabdocs-mobile.md +1 -1
  143. package/docs/tabdocs-tabs.md +1 -1
  144. package/docs/tabdocs-windows.md +1 -1
  145. package/docs/tabdocs-workspace.md +1 -1
  146. package/docs/tabdocs.md +1 -1
  147. package/docs/tabs.md +3 -3
  148. package/docs/tagbox.md +3 -3
  149. package/docs/textarea.md +3 -3
  150. package/docs/textbox.md +3 -3
  151. package/docs/toast.md +3 -3
  152. package/docs/tokens.md +349 -122
  153. package/docs/toolbar.md +3 -3
  154. package/docs/tooltip.md +1 -1
  155. package/docs/treeview.md +3 -3
  156. package/docs/window.md +3 -3
  157. package/docs/wizard.md +240 -0
  158. package/llms-full.txt +2415 -240
  159. package/llms.txt +10 -1
  160. package/package.json +9 -3
@@ -0,0 +1,229 @@
1
+ # Language
2
+
3
+ > Foundations · @motifx-community/ui 0.1.0-beta.2
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. |
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.2
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
 
@@ -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
  <>
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.2
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
 
@@ -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
  <>
@@ -0,0 +1,184 @@
1
+ # LoadPanel
2
+
3
+ > Feedback · @motifx-community/ui 0.1.0-beta.2
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()` from code. `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 from code 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` | From code; `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.2
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.2
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
 
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.2
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
 
@@ -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 (
@@ -1,6 +1,6 @@
1
1
  # Pagination
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.1
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.2
4
4
 
5
5
  Moving through pages of items: the sizes to choose from, where the page stands, the steps and a button per page around the current one. It turns compact when it does not fit. It looks and works as the grid’s pager.
6
6