@motifx-community/ui 0.1.0-beta.10 → 0.1.0-beta.12

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 (189) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/components/combobox/ComboBox.d.ts +5 -0
  3. package/dist/components/combobox/combo-box-props.d.ts +6 -0
  4. package/dist/components/datagrid/DataGrid.d.ts +4 -1
  5. package/dist/components/datagrid/grid-lookup.d.ts +8 -0
  6. package/dist/components/datagrid/model/FilterModel.d.ts +5 -0
  7. package/dist/components/datagrid/model/LookupTexts.d.ts +2 -0
  8. package/dist/components/datagrid/model/LookupValues.d.ts +4 -0
  9. package/dist/components/datagrid/view/ActionWidths.d.ts +13 -3
  10. package/dist/components/datagrid/view/GridRow.d.ts +1 -1
  11. package/dist/components/dropdown/DropDown.d.ts +5 -0
  12. package/dist/components/dropdown/drop-down-props.d.ts +6 -0
  13. package/dist/components/filterbuilder/filter-builder-lookup.d.ts +3 -0
  14. package/dist/components/listbox/ListBox.d.ts +5 -0
  15. package/dist/components/listbox/list-box-props.d.ts +6 -0
  16. package/dist/components/listbox/select-all-state.d.ts +1 -1
  17. package/dist/components/ribbonmenu/RibbonKeyHints.d.ts +1 -0
  18. package/dist/components/tagbox/TagBox.d.ts +5 -0
  19. package/dist/components/tagbox/tag-box-props.d.ts +6 -0
  20. package/dist/components/toolbar/Toolbar.d.ts +10 -2
  21. package/dist/core/measure/after-frame.d.ts +7 -0
  22. package/dist/core/measure/drawn.d.ts +7 -0
  23. package/dist/core/measure/index.d.ts +1 -1
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +571 -139
  26. package/dist/index.js.map +1 -1
  27. package/dist/parts/data/DataItems.d.ts +24 -0
  28. package/dist/parts/data/KeyedItems.d.ts +31 -5
  29. package/dist/parts/data/normalize-key.d.ts +7 -0
  30. package/dist/styles.css +32 -0
  31. package/docs/accordion.md +1 -1
  32. package/docs/actionsheet.md +1 -1
  33. package/docs/appbar.md +1 -1
  34. package/docs/appmenu-api.md +1 -1
  35. package/docs/appmenu-programmatic.md +1 -1
  36. package/docs/appmenu-search.md +1 -1
  37. package/docs/appmenu.md +1 -1
  38. package/docs/avatar.md +1 -1
  39. package/docs/badge.md +1 -1
  40. package/docs/bar-gauge-angles.md +1 -1
  41. package/docs/bar-gauge-data.md +1 -1
  42. package/docs/bar-gauge-labels.md +1 -1
  43. package/docs/bar-gauge.md +1 -1
  44. package/docs/barcode.md +1 -1
  45. package/docs/bottomnavigation.md +1 -1
  46. package/docs/bottomsheet.md +1 -1
  47. package/docs/breadcrumb.md +1 -1
  48. package/docs/button.md +2 -2
  49. package/docs/buttongroup.md +1 -1
  50. package/docs/buttons.md +3 -5
  51. package/docs/calendar.md +1 -1
  52. package/docs/card.md +1 -1
  53. package/docs/chart-bars.md +1 -1
  54. package/docs/chart-candles.md +1 -1
  55. package/docs/chart-funnel.md +1 -1
  56. package/docs/chart-heatmap.md +1 -1
  57. package/docs/chart-lines.md +1 -1
  58. package/docs/chart-live.md +1 -1
  59. package/docs/chart-pie.md +1 -1
  60. package/docs/chart-radar.md +1 -1
  61. package/docs/chart-ranges.md +1 -1
  62. package/docs/chart-references.md +1 -1
  63. package/docs/chart-scatter.md +1 -1
  64. package/docs/chart-waterfall.md +1 -1
  65. package/docs/chart-zoom.md +1 -1
  66. package/docs/chart.md +1 -1
  67. package/docs/checkbox.md +1 -1
  68. package/docs/chip.md +1 -1
  69. package/docs/choice.md +1 -1
  70. package/docs/colorbox.md +1 -1
  71. package/docs/combobox.md +1 -1
  72. package/docs/commands.md +126 -0
  73. package/docs/control.md +1 -1
  74. package/docs/data.md +1 -1
  75. package/docs/datagrid-api.md +3 -3
  76. package/docs/datagrid-bands.md +1 -1
  77. package/docs/datagrid-drag-select.md +1 -1
  78. package/docs/datagrid-drag.md +1 -1
  79. package/docs/datagrid-editing.md +107 -1
  80. package/docs/datagrid-filtering.md +11 -3
  81. package/docs/datagrid-forms.md +1 -1
  82. package/docs/datagrid-grouping.md +1 -1
  83. package/docs/datagrid-layout.md +2 -2
  84. package/docs/datagrid-lookups.md +1 -1
  85. package/docs/datagrid-master-detail.md +1 -1
  86. package/docs/datagrid-scrolling.md +1 -1
  87. package/docs/datagrid-selection.md +1 -1
  88. package/docs/datagrid.md +1 -1
  89. package/docs/datebox.md +1 -1
  90. package/docs/daterangebox.md +1 -1
  91. package/docs/display.md +1 -1
  92. package/docs/draggable.md +1 -1
  93. package/docs/drawer.md +1 -1
  94. package/docs/dropdown.md +1 -1
  95. package/docs/editors.md +3 -1
  96. package/docs/feedback.md +1 -1
  97. package/docs/fileuploader.md +1 -1
  98. package/docs/filterbuilder.md +1 -1
  99. package/docs/formlayout.md +1 -1
  100. package/docs/foundations.md +1 -1
  101. package/docs/gallery.md +1 -1
  102. package/docs/gauge-base.md +1 -1
  103. package/docs/gauge-circular.md +1 -1
  104. package/docs/gauge-dashboards.md +1 -1
  105. package/docs/gauge-linear.md +1 -1
  106. package/docs/gauge-markers.md +1 -1
  107. package/docs/gauge-marks.md +1 -1
  108. package/docs/gauge-ranges.md +1 -1
  109. package/docs/gauge-scales.md +1 -1
  110. package/docs/gauge.md +1 -1
  111. package/docs/home.md +2 -2
  112. package/docs/keyboard.md +5 -3
  113. package/docs/language.md +2 -2
  114. package/docs/layout.md +1 -1
  115. package/docs/listbox.md +1 -1
  116. package/docs/loadpanel.md +2 -2
  117. package/docs/lookup.md +1 -1
  118. package/docs/menus-api.md +142 -0
  119. package/docs/menus-context.md +126 -0
  120. package/docs/menus-customization.md +138 -0
  121. package/docs/menus-merging.md +208 -0
  122. package/docs/menus-programmatic.md +74 -0
  123. package/docs/menus.md +22 -179
  124. package/docs/multiview.md +1 -1
  125. package/docs/navigation.md +7 -2
  126. package/docs/numberbox.md +3 -3
  127. package/docs/otpinput.md +1 -1
  128. package/docs/pagination.md +1 -1
  129. package/docs/popover.md +1 -1
  130. package/docs/progress.md +3 -3
  131. package/docs/qrcode.md +1 -1
  132. package/docs/radiogroup.md +1 -1
  133. package/docs/rating.md +1 -1
  134. package/docs/resizable.md +1 -1
  135. package/docs/ribbonmenu-api.md +1 -1
  136. package/docs/ribbonmenu-commands.md +1 -1
  137. package/docs/ribbonmenu-customization.md +1 -1
  138. package/docs/ribbonmenu-display.md +1 -1
  139. package/docs/ribbonmenu-layouts.md +1 -1
  140. package/docs/ribbonmenu-programmatic.md +1 -1
  141. package/docs/ribbonmenu.md +1 -1
  142. package/docs/scheduler-agenda.md +1 -1
  143. package/docs/scheduler-big-data.md +1 -1
  144. package/docs/scheduler-editing.md +1 -1
  145. package/docs/scheduler-form.md +1 -1
  146. package/docs/scheduler-icalendar.md +1 -1
  147. package/docs/scheduler-mobile.md +1 -1
  148. package/docs/scheduler-recurrence.md +1 -1
  149. package/docs/scheduler-resources.md +1 -1
  150. package/docs/scheduler-timeline.md +1 -1
  151. package/docs/scheduler.md +1 -1
  152. package/docs/scrollview.md +1 -1
  153. package/docs/shortcuteditor.md +248 -0
  154. package/docs/showcase-home.md +1 -1
  155. package/docs/showcase.md +1 -1
  156. package/docs/signature.md +1 -1
  157. package/docs/skeleton.md +1 -1
  158. package/docs/slider.md +3 -3
  159. package/docs/sortable.md +1 -1
  160. package/docs/sparkline.md +1 -1
  161. package/docs/speeddial.md +1 -1
  162. package/docs/splitter.md +1 -1
  163. package/docs/stepper.md +1 -1
  164. package/docs/switch.md +1 -1
  165. package/docs/tabdocs-dock.md +1 -1
  166. package/docs/tabdocs-drag.md +1 -1
  167. package/docs/tabdocs-menus.md +1 -1
  168. package/docs/tabdocs-mobile.md +1 -1
  169. package/docs/tabdocs-tabs.md +1 -1
  170. package/docs/tabdocs-windows.md +1 -1
  171. package/docs/tabdocs-workspace.md +1 -1
  172. package/docs/tabdocs.md +1 -1
  173. package/docs/tabs.md +1 -1
  174. package/docs/tagbox.md +1 -1
  175. package/docs/textarea.md +1 -1
  176. package/docs/textbox.md +1 -1
  177. package/docs/tileview.md +1 -1
  178. package/docs/timeline.md +1 -1
  179. package/docs/toast.md +1 -1
  180. package/docs/tokens.md +13 -1
  181. package/docs/toolbar.md +1 -1
  182. package/docs/tooltip.md +1 -1
  183. package/docs/treeview.md +1 -1
  184. package/docs/validationsummary.md +1 -1
  185. package/docs/window.md +1 -1
  186. package/docs/wizard.md +1 -1
  187. package/llms-full.txt +3774 -2692
  188. package/llms.txt +16 -6
  189. package/package.json +4 -4
package/docs/progress.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ProgressBar and Spinner
2
2
 
3
- > Feedback · @motifx-community/ui 0.1.0-beta.8
3
+ > Feedback · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  ProgressBar shows how far an operation has progressed, as a line or a circle, or indicates activity when the progress is unknown. Spinner shows that the system is busy. It is a rotating ring that can stand alone or cover a panel while it loads, and it can wait for a delay so that quick operations do not cause a flash.
6
6
 
@@ -303,7 +303,7 @@ export default function Cover() {
303
303
 
304
304
  ## Localization
305
305
 
306
- A bar or spinner without a label is named `uiLocale.strings.loading`. The percentage uses `locale`, which defaults to the kit's language, `uiLocale.locale`.
306
+ A bar or spinner without a label is named `uiLocale.strings.loading`. The percentage uses `locale`, which defaults to the page `lang`.
307
307
 
308
308
  ```tsx
309
309
  import { reactive } from '@motifx/core';
@@ -372,7 +372,7 @@ export default function Localization() {
372
372
  | `labelPosition` | `Bind<'top' \| 'bottom' \| 'side'>` | `'top'` (`'bottom'` for a circle) | `top` places the label and value above the bar, `bottom` places them below it, and `side` places the label before it and the value after it. |
373
373
  | `showValue` | `Bind<boolean>` | `false` | Shows the percentage, rounded down to a whole number, or `valueText`. |
374
374
  | `valueText` | `(value, fraction) => string` | — | The text shown and announced for a value (`3 of 12 files`). Because it is a function, it is stored as is and not bound. |
375
- | `locale` | `Bind<string>` | `uiLocale.locale` | The locale of the percentage. |
375
+ | `locale` | `Bind<string>` | The page `lang` | The locale of the percentage. |
376
376
  | `tone` | `Bind<ProgressTone>` | `'accent'` | `accent`, `neutral`, `success`, `caution`, `danger`. |
377
377
  | `size` | `Bind<ControlSize>` | `'md'` | The thickness, and the size of a circle: `sm`, `md` or `lg`. |
378
378
  | `stretch` | `Bind<boolean>` | `false` | Stretches to the full width of its container. |
package/docs/qrcode.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # QRCode
2
2
 
3
- > Display · @motifx-community/ui 0.1.0-beta.8
3
+ > Display · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A QR code, drawn as vectors so that it stays sharp at any size. It has no dependencies, chooses the smallest version that holds the text, and can carry a logo.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RadioGroup
2
2
 
3
- > Choice · @motifx-community/ui 0.1.0-beta.8
3
+ > Choice · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A set of mutually exclusive options. Options can come from plain values, custom objects or a live list, and can be arranged vertically, horizontally or in columns. Individual options can be disabled, hidden or given help text. The group is a single Tab stop, and the arrow keys move between options.
6
6
 
package/docs/rating.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rating
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.8
3
+ > Editors · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A row of stars for entering or displaying a score, in whole or half steps. Rating is a field, so the label, help text, rules and `x-model` work the same way as on any other field.
6
6
 
package/docs/resizable.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Resizable
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.8
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A box that users can resize from its edges and corners with the pointer, or with the arrow keys on the grip in its end corner. It respects minimum and maximum sizes, can stay within an area, and can preserve its aspect ratio.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RibbonMenu: API reference
2
2
 
3
- > RibbonMenu · @motifx-community/ui 0.1.0-beta.8
3
+ > RibbonMenu · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Everything `RibbonMenu` takes, offers and reports. Every prop is also a settable property, and a function is followed.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RibbonMenu: Commands
2
2
 
3
- > RibbonMenu · @motifx-community/ui 0.1.0-beta.8
3
+ > RibbonMenu · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A group holds commands of three sizes and eight types. Every field of a command is a value or a function the menu follows, so the commands change with the application’s state.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RibbonMenu: Customization
2
2
 
3
- > RibbonMenu · @motifx-community/ui 0.1.0-beta.8
3
+ > RibbonMenu · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Users arrange the menu from its context menu: they hide what they never use, move what they use most, and add commands to the quick commands. Everything they change is one plain object, to save and give back.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RibbonMenu: Showing and keys
2
2
 
3
- > RibbonMenu · @motifx-community/ui 0.1.0-beta.8
3
+ > RibbonMenu · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  The menu can show only its tabs or hide itself to leave the page more room. A button before the tabs opens the app’s main menu, quick commands are at hand from every tab, and key hints let the keyboard reach any command in a few letters.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RibbonMenu: Layouts and room
2
2
 
3
- > RibbonMenu · @motifx-community/ui 0.1.0-beta.8
3
+ > RibbonMenu · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  The menu has two layouts, and gives way step by step when its room shrinks: commands become smaller, groups fold, and what is left scrolls. Narrow enough, it turns compact.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RibbonMenu: Programmatic changes
2
2
 
3
- > RibbonMenu · @motifx-community/ui 0.1.0-beta.8
3
+ > RibbonMenu · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Tabs, groups and commands can be added, removed, moved and changed at any time, by their paths. The menu redraws only what changed: groups and commands that stay keep their buttons, their state and their place.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # RibbonMenu
2
2
 
3
- > RibbonMenu · @motifx-community/ui 0.1.0-beta.8
3
+ > RibbonMenu · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  The commands of an application in tabs, each tab in named groups of large, medium and small commands. It adapts to the room it has, can show only its tabs or hide itself, and lets users arrange it to their liking. The menu holds nothing of its own: the tabs, the groups and the commands are given by the application.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Agenda
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Displays upcoming days as a list, with each day's appointments in time order. Days without appointments are omitted.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Big data
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Handles thousands of resources and appointments. The scheduler renders only what is visible, and recalculates the layout only for what has changed.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Editing
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Users can add, move, resize, copy and delete appointments with the pointer and the keyboard, and you can do the same programmatically. Every change raises its event first, can wait for a server, and is reverted if saving fails.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: The appointment form
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Configure the appointment form without handling events. You can choose its fields and their order, arrange them in groups and tabs, use custom editors, add validation per field, and show or lock fields for specific appointments. You can also replace the form with your own.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: iCalendar and print
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Exports appointments to an iCalendar file (RFC 5545) and imports them back, for use with other calendar applications. The scheduler can also be printed.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Tablet and phone
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  On tablets and phones, the scheduler keeps its appointments, views and date, and changes how it presents them. On a phone, it shows the agenda, a compact toolbar and bottom sheets. Touch gestures can lift and resize appointments, swipe between days, and pinch to zoom.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Recurrence and time zones
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Recurring appointments based on RFC 5545 rules, with exceptions and individually edited occurrences, a prompt that asks what a change should apply to, a recurrence editor, and time zone support that handles daylight saving time.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Resources and groups
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Resources such as rooms, people and equipment can color appointments, divide columns into groups (nested or under each date), and define when each resource is available and when time is blocked.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Scheduler: Timeline
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Displays one row per resource, with time running along the row, for a day, a week, a work week or a month. Appointments at the same time stack within a row, and the row grows to fit them.
6
6
 
package/docs/scheduler.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Scheduler
2
2
 
3
- > Scheduler · @motifx-community/ui 0.1.0-beta.8
3
+ > Scheduler · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A full-featured calendar for appointments across days and hours. It provides day, week, work week and month views, all-day and multi-day bars, side-by-side display of overlapping appointments, and a "+N more" link when a day is full. Appointments can come from an array or a data source, and every setting can change at runtime.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # ScrollView
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.8
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A scrollable container with configurable scrollbars, pull-to-refresh, and load-on-scroll near the end of the content. You can scroll it programmatically to a position or an element.
6
6
 
@@ -0,0 +1,248 @@
1
+ # ShortcutEditor
2
+
3
+ > Editors · @motifx-community/ui 0.1.0-beta.11
4
+
5
+ A list of the app’s keyboard shortcuts in which the user assigns other keys. It shows the shortcuts of commands, of the app and of the kit’s components, and you can place it anywhere: a settings page, a dialog or a tab.
6
+
7
+ ## Import
8
+
9
+ ```tsx
10
+ import { ShortcutEditor } from '@motifx-community/ui';
11
+ ```
12
+
13
+ ## Changing the keys of shortcuts
14
+
15
+ The editor lists the shortcuts in `shortcuts`, the registry that holds every keyboard shortcut of the app. Select a shortcut, press the new keys in the field, and choose Assign. The field says first whether the keys are free or which shortcut uses them. Remove keys leaves a shortcut without keys, and Reset gives it its own keys again.
16
+
17
+ ```tsx
18
+ import { reactive } from '@motifx/core';
19
+ import { ShortcutEditor, Stack, commands, type Keymap } from '@motifx-community/ui';
20
+
21
+ /**
22
+ * The app's commands, limited to this example, and an editor for their keys. The keys the user gives arrive in
23
+ * `onKeysChanged`, ready to save; giving them back to `shortcuts.keymap` restores them.
24
+ */
25
+ export default function Basic() {
26
+ const s = reactive({ told: 'Nothing yet.', keymap: {} as Keymap });
27
+ const run = (what: string) => () => (s.told = what);
28
+
29
+ return (
30
+ <Stack
31
+ gap="md"
32
+ ref={(host: Stack) => {
33
+ commands.add({ key: 'demo.save', text: '&Save', shortcut: 'Mod+S', category: 'File', scope: host, run: run('Save') });
34
+ commands.add({ key: 'demo.print', text: '&Print', shortcut: 'Mod+P', category: 'File', scope: host, run: run('Print') });
35
+ commands.add({ key: 'demo.find', text: '&Find', shortcut: 'Mod+F', category: 'Edit', scope: host, run: run('Find') });
36
+ commands.add({ key: 'demo.replace', text: '&Replace', category: 'Edit', scope: host, run: run('Replace') });
37
+ }}
38
+ >
39
+ <ShortcutEditor height="22rem" filter={(info) => info.customizable && !!info.name?.startsWith('demo.')} onKeysChanged={(e) => (s.keymap = e.keymap)} />
40
+ <p tabIndex={0} class="se-page">Click here, then press the keys: they work while focus is in this example.</p>
41
+ <output class="se-told">{() => s.told}</output>
42
+ <pre class="se-keymap">{() => JSON.stringify(s.keymap)}</pre>
43
+ </Stack>
44
+ );
45
+ }
46
+ ```
47
+
48
+ ## Saving the user’s keys
49
+
50
+ The keys the user assigns are kept in `shortcuts.keymap`, a plain object keyed by the shortcut’s name. `onKeysChanged`, or `shortcuts.onKeymapChanged`, reports it after each change; assigning a saved object to `shortcuts.keymap` restores the keys. Where the object is stored is up to the app.
51
+
52
+ ```tsx
53
+ shortcuts.keymap = JSON.parse(localStorage.getItem('keys') ?? '{}');
54
+ shortcuts.onKeymapChanged((e) => localStorage.setItem('keys', JSON.stringify(e.keymap)));
55
+ ```
56
+
57
+ A shortcut added later, such as one of a component opened after the keymap was restored, takes the user’s keys for its name when it is added.
58
+
59
+ ## In a dialog
60
+
61
+ The editor fills the height of its parent, so it can be the content of a window or a tab panel. Without a `filter`, it lists every shortcut of the page the user can change: here, the shortcuts of this documentation site.
62
+
63
+ ```tsx
64
+ import { Button, MxForm, ShortcutEditor } from '@motifx-community/ui';
65
+
66
+ /** The editor in a window of its own, as a settings dialog opens it. It lists every shortcut of this site. */
67
+ export default function InWindow() {
68
+ const open = (button: Button) => {
69
+ const form = new MxForm({ title: 'Keyboard shortcuts', width: '40rem', height: '30rem', resizable: true, modal: true });
70
+ form.content = new ShortcutEditor();
71
+ form.footer = <Button text="Close" tone="accent" onclick={() => form.close('ok')} />;
72
+ void form.showDialog(button);
73
+ };
74
+ let button!: Button;
75
+ return <Button text="Keyboard shortcuts…" variant="outline" ref={(b: Button) => (button = b)} onclick={() => open(button)} />;
76
+ }
77
+ ```
78
+
79
+ The customizer of a [MenuBar](menus-customization.md) shows the same editor on its Keyboard page; `customizerKeyboard: false` leaves the page out.
80
+
81
+ ## Which shortcuts are listed
82
+
83
+ A shortcut is listed when it has a name. `addShortcut` takes the name, the text the list shows and the category it is grouped under; `customizable: false` keeps its keys fixed. Several shortcuts with one name, such as the same action in two documents, are one row and take the same keys. `filter` chooses the rows, `grouped`, `searchEnabled` and `resetAllEnabled` turn the parts of the editor on and off.
84
+
85
+ ```tsx
86
+ import { reactive } from '@motifx/core';
87
+ import { ShortcutEditor, Stack, Switch, addShortcut, type ShortcutInfo } from '@motifx-community/ui';
88
+
89
+ /**
90
+ * Shortcuts of the app's own (`addShortcut` with a name), one the user cannot change, and the switches of the editor:
91
+ * the categories, the search field, the reset button, and every shortcut or only the ones the user can change.
92
+ */
93
+ export default function Options() {
94
+ const s = reactive({ grouped: true, search: true, resetAll: true, all: false });
95
+ const ours = (info: ShortcutInfo) => !!info.name?.startsWith('options.');
96
+ const changeable = (info: ShortcutInfo) => info.customizable && ours(info);
97
+
98
+ return (
99
+ <Stack
100
+ gap="md"
101
+ ref={(host: Stack) => {
102
+ const stops = [
103
+ addShortcut(['F5', 'Mod+R'], () => {}, { scope: host, name: 'options.reload', text: 'Reload', category: 'View' }),
104
+ addShortcut('Mod+=', () => {}, { scope: host, name: 'options.zoomIn', text: 'Zoom in', category: 'View' }),
105
+ addShortcut('Mod+-', () => {}, { scope: host, name: 'options.zoomOut', text: 'Zoom out', category: 'View' }),
106
+ addShortcut('F1', () => {}, { scope: host, name: 'options.help', text: 'Help', category: 'Help', customizable: false }),
107
+ ];
108
+ host.motif.setDisposable(() => stops.forEach((stop) => stop()));
109
+ }}
110
+ >
111
+ <Stack orientation="horizontal" gap="lg" wrap>
112
+ <Switch label="Categories" x-model={() => s.grouped} />
113
+ <Switch label="Search" x-model={() => s.search} />
114
+ <Switch label="Reset all keys" x-model={() => s.resetAll} />
115
+ <Switch label="Fixed shortcuts too" x-model={() => s.all} />
116
+ </Stack>
117
+ <ShortcutEditor
118
+ height="20rem"
119
+ grouped={() => s.grouped}
120
+ searchEnabled={() => s.search}
121
+ resetAllEnabled={() => s.resetAll}
122
+ filter={() => (s.all ? ours : changeable)}
123
+ />
124
+ </Stack>
125
+ );
126
+ }
127
+ ```
128
+
129
+ ```tsx
130
+ addShortcut(['F5', 'Mod+R'], () => view.reload(), { name: 'view.reload', text: () => t('Reload'), category: () => t('View') });
131
+ ```
132
+
133
+ ## Shortcuts of the kit’s components
134
+
135
+ The kit’s components register their shortcuts under names of their own, with texts in the kit’s language. The user’s keys apply to them as to any other shortcut.
136
+
137
+ | Component | Names | Shortcuts |
138
+ | --- | --- | --- |
139
+ | `Commands (`commands.add`)` | The key of the command | The text and the category of the command. |
140
+ | `TabDocumentManager` | `tabDocuments.<action>`, such as `tabDocuments.closeTab`; `tabDocuments.focusGroup1` to `9` | Each action of `keys`. The keys of a mode, such as moving a window with the arrow keys, are read inside the mode and are not listed. |
141
+ | `Toaster` | `toaster.focus` | The key that moves focus to the notifications. |
142
+ | `MenuBar` | `menuBar.focus` | F10, with `focusOnF10`. |
143
+
144
+ ## Programmatic use
145
+
146
+ `new ShortcutEditor(props)` creates the editor without JSX. Each prop is also a property; `selected`, `give()` and `resetAll()` do what the toolbar does.
147
+
148
+ ```tsx
149
+ import { Component } from '@motifx/core';
150
+ import { Button, ShortcutEditor, Stack, addShortcut } from '@motifx-community/ui';
151
+
152
+ /** An editor created programmatically: a shortcut is selected and given other keys from code, then reset. */
153
+ export default class Programmatic extends Component<HTMLDivElement> {
154
+ constructor() {
155
+ super('div');
156
+ const stack = new Stack({ gap: 'md' });
157
+ const stop = addShortcut('Mod+K', () => {}, { scope: stack, name: 'code.palette', text: 'Command palette', category: 'Go' });
158
+ stack.motif.setDisposable(stop);
159
+ const editor = new ShortcutEditor({ height: '10rem', filter: (info) => info.name === 'code.palette' });
160
+ const give = new Button({
161
+ text: 'Give it Ctrl+Shift+P',
162
+ variant: 'outline',
163
+ onclick: () => {
164
+ editor.selected = 'code.palette';
165
+ editor.give(['Ctrl+Shift+P']);
166
+ },
167
+ });
168
+ const reset = new Button({ text: 'Reset all keys', variant: 'outline', onclick: () => editor.resetAll() });
169
+ const buttons = new Stack({ orientation: 'horizontal', gap: 'sm' });
170
+ buttons.controls.add(give, reset);
171
+ stack.controls.add(editor, buttons);
172
+ this.controls.add(stack);
173
+ }
174
+ }
175
+ ```
176
+
177
+ ## API reference
178
+
179
+ ### Props
180
+
181
+ | Prop | Type | Default | Description |
182
+ | --- | --- | --- | --- |
183
+ | `filter` | `Bind<((shortcut: ShortcutInfo) => boolean) \| null>` | The shortcuts the user can change | Which shortcuts are listed. A shortcut the user cannot change is listed with its row turned off. |
184
+ | `grouped` | `Bind<boolean>` | `true` | Lists the shortcuts under their categories. A shortcut without one is listed under “Other”. |
185
+ | `searchEnabled` | `Bind<boolean>` | `true` | Shows a search field above the list. |
186
+ | `resetAllEnabled` | `Bind<boolean>` | `true` | Shows the button that gives every shortcut its own keys again. |
187
+ | `height` | `Bind<string \| null>` | The height of the parent | The height, as a CSS length. |
188
+ | `label` | `Bind<string>` | The kit string “Keyboard shortcuts” | The accessible name. |
189
+
190
+ ### Properties and methods
191
+
192
+ | Member | Type | Description |
193
+ | --- | --- | --- |
194
+ | `selected` | `string \| null` | The name of the selected shortcut. Settable. |
195
+ | `give(keys)` | `boolean` | Gives the selected shortcut the keys (an empty list removes its keys), or its own keys again with `null`. Returns `false` when no shortcut the user can change is selected. |
196
+ | `resetAll()` | `void` | Gives every shortcut its own keys again. |
197
+ | `refresh()` | `void` | Reads the shortcuts and their keys again. The editor does this when shortcuts are added or removed, and when the language changes. |
198
+
199
+ ### Events
200
+
201
+ | Event | Type | Description |
202
+ | --- | --- | --- |
203
+ | `onKeysChanged` | `{ name, keys, keymap }` | Occurs after the user changes the keys of a shortcut. `name` is `null` after a reset of all keys; `keymap` holds every key the user has given, to save. |
204
+
205
+ ### Shortcut options for the list
206
+
207
+ | Option of addShortcut | Type | Description |
208
+ | --- | --- | --- |
209
+ | `name` | `string` | Names what the shortcut does. Shortcuts with the same name share the keys the user gives them. Without a name, a shortcut is not listed and cannot be changed. |
210
+ | `text` | `string \| (() => string)` | How the shortcut reads in the list. A function is read again when the language changes. |
211
+ | `category` | `string \| (() => string)` | The heading the list groups the shortcut under. |
212
+ | `customizable` | `boolean` | `false` keeps the shortcut’s own keys. It is still listed when the filter allows it. |
213
+
214
+ ### Keyboard
215
+
216
+ | Where | Keys |
217
+ | --- | --- |
218
+ | `A row` | The arrow keys, Home and End move through the list; typing in the search field filters it. |
219
+ | `The keys field` | Takes the keys pressed instead of running them. Backspace clears it; Tab and Escape keep their usual meaning. |
220
+
221
+ ### Accessibility
222
+
223
+ | Topic | Details |
224
+ | --- | --- |
225
+ | `Name` | The editor is a group named by `label`; the list, the toolbar and the keys field have names of their own. |
226
+ | `Status` | The text that says who uses the keys pressed is a live region, read when it changes. |
227
+ | `Keys` | Keys are written as the platform writes them: Ctrl+Shift+S, and ⇧⌘S on Apple platforms. |
228
+
229
+ ### Styling hooks
230
+
231
+ | Hook | Description |
232
+ | --- | --- |
233
+ | `.mx-shortcut-editor` | The editor. |
234
+ | `.mx-shortcut-editor__tools, .mx-shortcut-editor__keys, .mx-shortcut-editor__capture` | The toolbar, the keys row and its field. |
235
+ | `.mx-shortcut-editor__status` | The text that says who uses the keys pressed. |
236
+ | `.mx-shortcut-editor__list` | The list of shortcuts. |
237
+ | `.mx-shortcut-editor__text, .mx-shortcut-editor__changed, .mx-shortcut-editor__row-keys` | A row: the name of the shortcut, the mark of keys the user changed, and its keys. |
238
+
239
+ ### Design tokens
240
+
241
+ | Token | Description |
242
+ | --- | --- |
243
+ | `shortcut-editor.editor, .keys` | Units: the editor and the keys row, with the `gap` between their parts. |
244
+ | `shortcut-editor.status, .row-keys, .changed` | Units: the status text, the keys at the end of a row (read as in a menu), and the mark of changed keys. |
245
+
246
+ ## Feedback
247
+
248
+ Loading issues…
@@ -1,6 +1,6 @@
1
1
  # Showcase: a smart home
2
2
 
3
- > Get started · @motifx-community/ui 0.1.0-beta.8
3
+ > Get started · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A smart home panel for a tablet, built with the kit as a MotifJS application of its own: a rail of screens, the day and the home's state at the top, and tiles you can touch. The devices report new values every two seconds.
6
6
 
package/docs/showcase.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Showcase: an order screen
2
2
 
3
- > Get started · @motifx-community/ui 0.1.0-beta.8
3
+ > Get started · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  An order entry screen built with the kit, structured the way a MotifJS application is normally built: state and operations live in a model (`OrderModel`), and the page binds to it. The customer list is a data source of 5,000 rows that responds like a server.
6
6
 
package/docs/signature.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Signature
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.8
3
+ > Editors · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A pad to sign on with a pen, a finger or a mouse. The value is the strokes themselves, so a signature can be stored as data, drawn again at any size and exported as an image.
6
6
 
package/docs/skeleton.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Skeleton
2
2
 
3
- > Display · @motifx-community/ui 0.1.0-beta.8
3
+ > Display · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A placeholder that matches the shape of content that is loading, so the page keeps its layout while data arrives. If you provide content, it replaces the placeholder in the same place when loading ends.
6
6
 
package/docs/slider.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Slider
2
2
 
3
- > Editors · @motifx-community/ui 0.1.0-beta.8
3
+ > Editors · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Selects a value on a track by dragging a thumb or using the keyboard. It supports a single number or a range with two thumbs, steps, labeled tick marks, a value tooltip, a vertical orientation and number formatting, along with the label, help text and validation common to all fields.
6
6
 
@@ -243,7 +243,7 @@ export default function States() {
243
243
 
244
244
  ## Localization
245
245
 
246
- The names of the two thumbs in a range come from `uiLocale.strings` (`minimum`, `maximum`). Numbers use `locale`, which defaults to the kit's language, `uiLocale.locale`.
246
+ The names of the two thumbs in a range come from `uiLocale.strings` (`minimum`, `maximum`). Numbers use `locale`, which defaults to the page `lang`.
247
247
 
248
248
  ```tsx
249
249
  import { reactive } from '@motifx/core';
@@ -326,7 +326,7 @@ export default function Localization() {
326
326
  | `tickLabels` | `Bind<boolean>` | `false` | Shows values under the marks, or at the two ends if there are no marks. |
327
327
  | `showValue` | `Bind<'never' \| 'drag' \| 'always'>` | `'never'` | Shows a value tooltip above the thumb: never, while it moves (with the pointer or keyboard), or always. |
328
328
  | `format` | `Bind<Intl.NumberFormatOptions \| null>` | `null` | The format used by the tooltip, the tick labels and screen readers. |
329
- | `locale` | `Bind<string>` | `uiLocale.locale` | The locale of `format`. |
329
+ | `locale` | `Bind<string>` | The page `lang` | The locale of `format`. |
330
330
  | `valueText` | `(value: number) => string` | — | The text screen readers announce for a value. Because it is a function, it is stored as is and not bound. |
331
331
  | `updateOn` | `Bind<'input' \| 'change'>` | `'input'` | With `change`, the value updates when the thumb is released. The thumb still moves during the drag. |
332
332
  | `name` | `Bind<string>` | `''` | The name submitted with the form. A range submits two values. |
package/docs/sortable.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Sortable
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.8
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Lets users reorder items by dragging them with the pointer or a finger, or with the keyboard. Lists in the same group can exchange items. A drop moves the element and reports the indexes, while your data stays under your control.
6
6
 
package/docs/sparkline.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Sparkline
2
2
 
3
- > Charts · @motifx-community/ui 0.1.0-beta.8
3
+ > Charts · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A chart the size of a word, for a trend beside a number, in a sentence or in a row of a table. It draws a line, an area, bars, or wins and losses, and marks the values that matter.
6
6
 
package/docs/speeddial.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SpeedDial
2
2
 
3
- > Buttons · @motifx-community/ui 0.1.0-beta.8
3
+ > Buttons · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  A floating action button that opens a set of related actions. Place it in a corner, on an edge or inline. Actions appear in a line with labels, or on a full, half or quarter circle around the button with tooltips. If there is only one action, the main button performs it directly.
6
6
 
package/docs/splitter.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Splitter
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.8
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Divides space into any number of resizable panes, arranged side by side or stacked. A handle between each pair of panes can be dragged or moved with the keyboard, and it resizes the two panes next to it. Panes can be collapsed from their handle and can contain another splitter. For two panes where one has a fixed size, see [SplitContainer](layout.md).
6
6
 
package/docs/stepper.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Stepper
2
2
 
3
- > Navigation · @motifx-community/ui 0.1.0-beta.8
3
+ > Navigation · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Shows the steps of a longer task and the user's progress through them. Each step has an indicator and text, with a line between steps, and steps before the current one are marked complete. [Wizard](wizard.md) adds a page and navigation buttons to each step.
6
6
 
package/docs/switch.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Switch
2
2
 
3
- > Choice · @motifx-community/ui 0.1.0-beta.8
3
+ > Choice · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  An on/off switch with a label. It has a track with a sliding thumb, optional on/off text inside or next to the track, and read-only and required states. It is a native check box with the switch role.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Dock and floating windows
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.8
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Documents and whole groups can float in their own windows within the page, and dock again into document groups or into dock areas around them, which can collapse to the edge of the manager. The mouse, the keyboard and the API all perform the same actions through the same events.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Drag and drop
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.8
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  Drag tabs and whole groups as you would in a code editor: along a strip, to another group, beside a group, along an edge of the layout, or between two managers. The same moves are available from the keyboard, and every drop goes through the methods and events of the action it performs.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Menus and keys
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.8
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  The commands around tabs: context menus on tabs and on the empty strip, a searchable list of a group's documents, application toolbar buttons, the recently used list, back and forward, reopening closed documents, locked groups, and keyboard shortcuts for all of them.
6
6
 
@@ -1,6 +1,6 @@
1
1
  # TabDocumentManager: Tablet and phone
2
2
 
3
- > TabDocumentManager · @motifx-community/ui 0.1.0-beta.8
3
+ > TabDocumentManager · @motifx-community/ui 0.1.0-beta.11
4
4
 
5
5
  On tablets and phones, a layout of groups, splits and dock areas does not fit as designed. The manager keeps the layout and changes how it is presented: the documents, groups, areas and saved JSON stay the same, and content is moved rather than recreated. The presentation depends on the manager's own width rather than the device, and on touch screens its tabs and buttons are larger.
6
6