@motifx-community/ui 0.1.0-beta.0 → 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.
- package/CHANGELOG.md +82 -0
- package/README.md +16 -10
- package/dist/components/calendar/Calendar.d.ts +12 -0
- package/dist/components/calendar/calendar-props.d.ts +5 -0
- package/dist/components/daterangebox/DateRangeBox.d.ts +121 -0
- package/dist/components/daterangebox/date-range-box-props.d.ts +35 -0
- package/dist/components/daterangebox/date-range-preset.d.ts +6 -0
- package/dist/components/daterangebox/date-range.d.ts +2 -0
- package/dist/components/daterangebox/index.d.ts +4 -0
- package/dist/components/dropdown/DropDown.d.ts +14 -0
- package/dist/components/dropdown/drop-down-props.d.ts +5 -0
- package/dist/components/fileuploader/FileUploader.d.ts +133 -0
- package/dist/components/fileuploader/file-uploader-props.d.ts +46 -0
- package/dist/components/fileuploader/files-added-event-args.d.ts +9 -0
- package/dist/components/fileuploader/index.d.ts +7 -0
- package/dist/components/fileuploader/upload-event-args.d.ts +10 -0
- package/dist/components/fileuploader/upload-item.d.ts +12 -0
- package/dist/components/fileuploader/upload-mode.d.ts +2 -0
- package/dist/components/fileuploader/upload-status.d.ts +2 -0
- package/dist/components/loadpanel/LoadPanel.d.ts +70 -0
- package/dist/components/loadpanel/index.d.ts +3 -0
- package/dist/components/loadpanel/load-panel-props.d.ts +29 -0
- package/dist/components/loadpanel/load-panel-target.d.ts +3 -0
- package/dist/components/popover/Popover.d.ts +98 -0
- package/dist/components/popover/index.d.ts +5 -0
- package/dist/components/popover/popover-close-reason.d.ts +2 -0
- package/dist/components/popover/popover-closing-event-args.d.ts +8 -0
- package/dist/components/popover/popover-props.d.ts +39 -0
- package/dist/components/popover/popover-show-on.d.ts +2 -0
- package/dist/components/scheduler/view/AgendaView.d.ts +1 -1
- package/dist/components/scrollview/ScrollView.d.ts +109 -0
- package/dist/components/scrollview/index.d.ts +7 -0
- package/dist/components/scrollview/pull-down-event-args.d.ts +9 -0
- package/dist/components/scrollview/reach-bottom-event-args.d.ts +9 -0
- package/dist/components/scrollview/scroll-event-args.d.ts +7 -0
- package/dist/components/scrollview/scroll-view-bars.d.ts +2 -0
- package/dist/components/scrollview/scroll-view-direction.d.ts +2 -0
- package/dist/components/scrollview/scroll-view-props.d.ts +31 -0
- package/dist/components/sortable/Sortable.d.ts +106 -0
- package/dist/components/sortable/index.d.ts +5 -0
- package/dist/components/sortable/sortable-drag-event-args.d.ts +15 -0
- package/dist/components/sortable/sortable-drop-event-args.d.ts +11 -0
- package/dist/components/sortable/sortable-orientation.d.ts +2 -0
- package/dist/components/sortable/sortable-props.d.ts +34 -0
- package/dist/components/stepper/Stepper.d.ts +121 -0
- package/dist/components/stepper/Wizard.d.ts +112 -0
- package/dist/components/stepper/WizardStep.d.ts +44 -0
- package/dist/components/stepper/index.d.ts +13 -0
- package/dist/components/stepper/step-changed-event-args.d.ts +11 -0
- package/dist/components/stepper/step-changing-event-args.d.ts +18 -0
- package/dist/components/stepper/stepper-item.d.ts +20 -0
- package/dist/components/stepper/stepper-label-position.d.ts +2 -0
- package/dist/components/stepper/stepper-orientation.d.ts +1 -0
- package/dist/components/stepper/stepper-props.d.ts +32 -0
- package/dist/components/stepper/stepper-status.d.ts +2 -0
- package/dist/components/stepper/wizard-finishing-event-args.d.ts +7 -0
- package/dist/components/stepper/wizard-props.d.ts +48 -0
- package/dist/components/stepper/wizard-step-props.d.ts +32 -0
- package/dist/core/flow-home.d.ts +6 -0
- package/dist/core/fold-text.d.ts +6 -0
- package/dist/core/ui-locale.d.ts +0 -2
- package/dist/core/ui-strings.d.ts +43 -0
- package/dist/generated/tokens.d.ts +1186 -11
- package/dist/index.d.ts +8 -1
- package/dist/index.js +22542 -20143
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +39 -1
- package/dist/locales/tr.json +39 -1
- package/dist/parts/data/DataItems.d.ts +5 -0
- package/dist/parts/data/KeyedItems.d.ts +2 -0
- package/dist/styles.css +1912 -8
- package/dist/tokens/index.d.ts +1186 -11
- package/dist/tokens/index.js +1186 -11
- package/dist/tokens/index.js.map +1 -1
- package/dist/tr-B218zMtu.js +1191 -0
- package/dist/tr-B218zMtu.js.map +1 -0
- package/docs/accordion.md +1 -1
- package/docs/actionsheet.md +1 -1
- package/docs/avatar.md +1 -1
- package/docs/badge.md +1 -1
- package/docs/bottomsheet.md +3 -3
- package/docs/breadcrumb.md +2 -2
- package/docs/button.md +3 -3
- package/docs/buttongroup.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/card.md +1 -1
- package/docs/checkbox.md +3 -3
- package/docs/chip.md +1 -1
- package/docs/colorbox.md +1 -1
- package/docs/combobox.md +1 -1
- package/docs/control.md +1 -1
- package/docs/datagrid-api.md +3 -3
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +1 -1
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +1 -1
- package/docs/datagrid-filtering.md +1 -1
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +1 -1
- package/docs/datagrid-layout.md +1 -1
- package/docs/datagrid-lookups.md +1 -1
- package/docs/datagrid-master-detail.md +1 -1
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +1 -1
- package/docs/datagrid.md +1 -1
- package/docs/datebox.md +3 -3
- package/docs/daterangebox.md +192 -0
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +13 -7
- package/docs/fileuploader.md +201 -0
- package/docs/filterbuilder.md +3 -3
- package/docs/formlayout.md +1 -1
- package/docs/home.md +1 -1
- package/docs/keyboard.md +1 -1
- package/docs/language.md +229 -0
- package/docs/layout.md +3 -3
- package/docs/listbox.md +3 -3
- package/docs/loadpanel.md +184 -0
- package/docs/lookup.md +86 -2
- package/docs/menus.md +1 -1
- package/docs/numberbox.md +3 -3
- package/docs/pagination.md +1 -1
- package/docs/popover.md +221 -0
- package/docs/progress.md +3 -3
- package/docs/radiogroup.md +1 -1
- package/docs/rating.md +1 -1
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +1 -1
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +1 -1
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +1 -1
- package/docs/scrollview.md +185 -0
- package/docs/showcase.md +1 -1
- package/docs/skeleton.md +1 -1
- package/docs/slider.md +3 -3
- package/docs/sortable.md +213 -0
- package/docs/stepper.md +238 -0
- package/docs/switch.md +1 -1
- package/docs/tabdocs-dock.md +1 -1
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +1 -1
- package/docs/tabs.md +3 -3
- package/docs/tagbox.md +3 -3
- package/docs/textarea.md +3 -3
- package/docs/textbox.md +3 -3
- package/docs/toast.md +3 -3
- package/docs/tokens.md +357 -122
- package/docs/toolbar.md +3 -3
- package/docs/tooltip.md +1 -1
- package/docs/treeview.md +3 -3
- package/docs/window.md +3 -3
- package/docs/wizard.md +240 -0
- package/llms-full.txt +2518 -245
- package/llms.txt +10 -1
- package/package.json +10 -4
package/docs/sortable.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Sortable
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.2
|
|
4
|
+
|
|
5
|
+
Items the user puts in order by dragging them, with the pointer or a finger, or with the keys; lists of one group take each other’s items. A drop moves the element and tells you the indexes: your data stays yours.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Sortable } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Children as items
|
|
14
|
+
|
|
15
|
+
The JSX children are the items. Drag one, or focus it and press Ctrl + Down; `onReorder` says from where to where, and the app reorders its own data.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { Panel, Sortable, Stack } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** Rows put in order by dragging, or with Ctrl + an arrow on the focused row; the app reorders its data when told. */
|
|
22
|
+
export default function Basic() {
|
|
23
|
+
const s = reactive({ steps: ['Collect the order', 'Pack it', 'Print the label', 'Hand it over'], told: '' });
|
|
24
|
+
return (
|
|
25
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
26
|
+
<Sortable
|
|
27
|
+
label="Steps"
|
|
28
|
+
class="so-steps"
|
|
29
|
+
onReorder={e => {
|
|
30
|
+
const next = s.steps.slice();
|
|
31
|
+
next.splice(e.toIndex, 0, ...next.splice(e.fromIndex, 1));
|
|
32
|
+
s.steps = next;
|
|
33
|
+
s.told = `"${next[e.toIndex]}" is step ${e.toIndex + 1} now`;
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<Panel variant="outline" padding="sm">
|
|
37
|
+
Collect the order
|
|
38
|
+
</Panel>
|
|
39
|
+
<Panel variant="outline" padding="sm">
|
|
40
|
+
Pack it
|
|
41
|
+
</Panel>
|
|
42
|
+
<Panel variant="outline" padding="sm">
|
|
43
|
+
Print the label
|
|
44
|
+
</Panel>
|
|
45
|
+
<Panel variant="outline" padding="sm">
|
|
46
|
+
Hand it over
|
|
47
|
+
</Panel>
|
|
48
|
+
</Sortable>
|
|
49
|
+
<output class="so-told">{() => s.told || `Order: ${s.steps.join(' → ')}`}</output>
|
|
50
|
+
</Stack>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Items from data, across lists
|
|
56
|
+
|
|
57
|
+
`items` with an `itemTemplate` draws the rows from your data and keeps each row as the order changes. Two sortables of one `group` take each other’s items: `onRemove` and `onAdd` tell both sides, and each list draws its array again.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { reactive } from '@motifx/core';
|
|
61
|
+
import { Panel, Sortable, Stack } from '@motifx-community/ui';
|
|
62
|
+
|
|
63
|
+
interface Task {
|
|
64
|
+
id: number;
|
|
65
|
+
title: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// A task as a row.
|
|
69
|
+
const row = (task: Task) => {
|
|
70
|
+
const panel = new Panel({ variant: 'outline', padding: 'sm' });
|
|
71
|
+
panel.element.textContent = task.title;
|
|
72
|
+
return panel;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** Two lists of one group take each other's items; each list draws its own data and the app moves the task between arrays when told. */
|
|
76
|
+
export default function Groups() {
|
|
77
|
+
const s = reactive({
|
|
78
|
+
todo: [{ id: 1, title: 'Write the brief' }, { id: 2, title: 'Book the room' }, { id: 3, title: 'Send the invites' }] as Task[],
|
|
79
|
+
done: [{ id: 4, title: 'Pick the date' }] as Task[]
|
|
80
|
+
});
|
|
81
|
+
const reorder = (key: 'todo' | 'done') => (e: { fromIndex: number; toIndex: number }) => {
|
|
82
|
+
const next = s[key].slice();
|
|
83
|
+
next.splice(e.toIndex, 0, ...next.splice(e.fromIndex, 1));
|
|
84
|
+
s[key] = next;
|
|
85
|
+
};
|
|
86
|
+
// The item leaves one array when removed and joins the other when added: the lists draw themselves again.
|
|
87
|
+
const remove = (key: 'todo' | 'done') => (e: { fromIndex: number }) => (s[key] = s[key].filter((_, i) => i !== e.fromIndex));
|
|
88
|
+
const add = (key: 'todo' | 'done') => (e: { item: Task; toIndex: number }) => {
|
|
89
|
+
const next = s[key].slice();
|
|
90
|
+
next.splice(e.toIndex, 0, e.item);
|
|
91
|
+
s[key] = next;
|
|
92
|
+
};
|
|
93
|
+
return (
|
|
94
|
+
<Stack orientation="horizontal" gap="lg" style="inline-size: 100%">
|
|
95
|
+
<Stack gap="sm" grow>
|
|
96
|
+
<strong>To do</strong>
|
|
97
|
+
<Sortable<Task> label="To do" class="so-todo" group="tasks" items={() => s.todo} itemTemplate={row} onReorder={reorder('todo')} onRemove={remove('todo')} onAdd={add('todo')} style="min-block-size: 8rem" />
|
|
98
|
+
</Stack>
|
|
99
|
+
<Stack gap="sm" grow>
|
|
100
|
+
<strong>Done</strong>
|
|
101
|
+
<Sortable<Task> label="Done" class="so-done" group="tasks" items={() => s.done} itemTemplate={row} onReorder={reorder('done')} onRemove={remove('done')} onAdd={add('done')} style="min-block-size: 8rem" />
|
|
102
|
+
</Stack>
|
|
103
|
+
</Stack>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## A handle, side by side, a refused drag
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { reactive } from '@motifx/core';
|
|
112
|
+
import { Chip, Sortable, Stack } from '@motifx-community/ui';
|
|
113
|
+
|
|
114
|
+
/** Chips side by side, moved by their handle only (the dots), with Ctrl + Left / Right on the handle; a drag may be refused. */
|
|
115
|
+
export default function Handle() {
|
|
116
|
+
const s = reactive({ tags: ['Design', 'Build', 'Test', 'Ship', 'Locked'], told: '' });
|
|
117
|
+
return (
|
|
118
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
119
|
+
<Sortable
|
|
120
|
+
label="Tags"
|
|
121
|
+
class="so-tags"
|
|
122
|
+
orientation="horizontal"
|
|
123
|
+
handle=".so-grip"
|
|
124
|
+
items={() => s.tags}
|
|
125
|
+
itemTemplate={tag => {
|
|
126
|
+
const chip = new Chip({ text: tag });
|
|
127
|
+
const grip = document.createElement('span');
|
|
128
|
+
grip.className = 'mx-glyph so-grip';
|
|
129
|
+
grip.dataset.icon = 'drag-dots';
|
|
130
|
+
grip.setAttribute('aria-label', `Move ${tag}`);
|
|
131
|
+
chip.element.prepend(grip);
|
|
132
|
+
return chip;
|
|
133
|
+
}}
|
|
134
|
+
onDragStarting={e => {
|
|
135
|
+
if (e.item === 'Locked') {
|
|
136
|
+
e.cancel = true;
|
|
137
|
+
s.told = 'Locked stays where it is.';
|
|
138
|
+
}
|
|
139
|
+
}}
|
|
140
|
+
onReorder={e => {
|
|
141
|
+
const next = s.tags.slice();
|
|
142
|
+
next.splice(e.toIndex, 0, ...next.splice(e.fromIndex, 1));
|
|
143
|
+
s.tags = next;
|
|
144
|
+
s.told = next.join(', ');
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
147
|
+
<output class="so-tags-told">{() => s.told}</output>
|
|
148
|
+
</Stack>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Behaviour
|
|
154
|
+
|
|
155
|
+
| Topic | How |
|
|
156
|
+
| --- | --- |
|
|
157
|
+
| `Dragging` | With the pointer after a few pixels; with a finger after a long press (a finger that moves before that scrolls). A copy follows the pointer, the item stays faint in its place, a line shows where it would land; the list scrolls near its edges. |
|
|
158
|
+
| `Dropping` | The item’s element moves there at once and `onReorder` says from where to where: your data is yours to reorder. Across sortables of a group, `onRemove` and `onAdd` say the same on both sides. |
|
|
159
|
+
| `Items from data` | With `items`, each item keeps its component as the order changes (the rows are keyed by item): reordering your array moves the rows, no row is made again. |
|
|
160
|
+
| `Keys` | The focused item (its handle when there is one) takes Ctrl + Up / Down (Left / Right side by side), Ctrl + Home / End; each move is told to `onReorder` and read out. |
|
|
161
|
+
| `Escape` | Cancels a drag; nothing moves. |
|
|
162
|
+
|
|
163
|
+
## Accessibility
|
|
164
|
+
|
|
165
|
+
| Topic | How |
|
|
166
|
+
| --- | --- |
|
|
167
|
+
| `List` | A `group` named by `label`; the items are whatever you put in it. |
|
|
168
|
+
| `Items` | One Tab stop that moves between the items with the keys; an item with a focusable part of its own keeps that. A handle is a button named by you. |
|
|
169
|
+
| `Moves` | Each move by the keys is read out: “Moved to 2 of 5”. |
|
|
170
|
+
|
|
171
|
+
## Styling
|
|
172
|
+
|
|
173
|
+
| Hook | What it is |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| `.mx-sortable` | The list. `data-orientation`, `data-sortable`, `data-drop-target` while a dragged item may land here. |
|
|
176
|
+
| `.mx-sortable__item` | Each item. `data-dragging` on the one being dragged. |
|
|
177
|
+
| `.mx-sortable__line` | The line where a drop would land. |
|
|
178
|
+
| `.mx-sortable__ghost` | The copy after the pointer. |
|
|
179
|
+
|
|
180
|
+
### Component tokens
|
|
181
|
+
|
|
182
|
+
| Token | What it sets |
|
|
183
|
+
| --- | --- |
|
|
184
|
+
| `sortable.container, .item, .line, .ghost` | Units: the list (`target`), an item (`sortable`, `dragging`, `focus`), the line (its thickness and colour; standing in a horizontal list), the copy. |
|
|
185
|
+
| `sortable.gap` | Between the items. |
|
|
186
|
+
|
|
187
|
+
## API reference
|
|
188
|
+
|
|
189
|
+
### Props
|
|
190
|
+
|
|
191
|
+
| Prop | Type | Default | Description |
|
|
192
|
+
| --- | --- | --- | --- |
|
|
193
|
+
| `items` | `Bind<readonly T[]>` | — | The items, each drawn with `itemTemplate`; without them the JSX children are the items. |
|
|
194
|
+
| `itemTemplate` | `(item, index) => ComponentBase` | the item’s text | Makes an item’s component. A function, so it is not bound like the other props. |
|
|
195
|
+
| `handle` | `Bind<string \| null>` | `null` | A selector inside an item that takes the drag and the keys; without one the whole item does. |
|
|
196
|
+
| `group` | `Bind<string \| null>` | `null` | Sortables of one group take each other’s items. |
|
|
197
|
+
| `allowReordering` | `Bind<boolean>` | `true` | The items can be moved; `false` leaves them as they are. |
|
|
198
|
+
| `orientation` | `Bind<SortableOrientation>` | `'vertical'` | `vertical` or `horizontal`: the drop line and the move keys follow. |
|
|
199
|
+
| `label` | `Bind<string>` | `''` | What screen readers call the list. |
|
|
200
|
+
|
|
201
|
+
### Events, properties and methods
|
|
202
|
+
|
|
203
|
+
| Member | Kind | Description |
|
|
204
|
+
| --- | --- | --- |
|
|
205
|
+
| `onDragStarting` | event | A drag (or a move by the keys) is about to start (`item`, `fromIndex`); `cancel = true` refuses. |
|
|
206
|
+
| `onDragChanging` | event | The place it would land changed (`to`, `toIndex`); `cancel = true` refuses that place. |
|
|
207
|
+
| `onDragEnding` | event | About to drop; `cancel = true` leaves everything as it was. |
|
|
208
|
+
| `onReorder` | event | An item moved within this sortable (`fromIndex`, `toIndex`, `item`), by a drop or the keys. Reorder your data here. |
|
|
209
|
+
| `onRemove, onAdd` | event | An item went to another sortable of the group, and came into one: `from`, `to`, the indexes and the item. Move the data between your arrays here. |
|
|
210
|
+
| `move(fromIndex, toIndex)` | `boolean` | Moves an item from code as a drop would, telling `onReorder`. |
|
|
211
|
+
| `elements` | read-only | The items’ elements, in order. |
|
|
212
|
+
| `isDragging` | read-only | An item is being dragged. |
|
|
213
|
+
| `refresh()` | `void` | Reads the items again after they were changed in place. |
|
package/docs/stepper.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Stepper
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.2
|
|
4
|
+
|
|
5
|
+
The steps of a longer task and where the user stands in them: an indicator and a text per step, a line between them, the steps before the current one completed. The [Wizard](wizard.md) adds a page and the buttons to each step.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Stepper } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## From JSX and from code
|
|
14
|
+
|
|
15
|
+
The current step is `value`: a step’s `key`, else its index; `x-model` binds it two-way. From code, `next()`, `previous()` and `goTo()` move it and `onStepChanged` tells.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { Button, Stack, Stepper } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** A stepper bound with x-model, and one made from code and moved with its own methods. */
|
|
22
|
+
export default function FromCode() {
|
|
23
|
+
const s = reactive({ step: 0 as string | number | null, at: 0, told: '' });
|
|
24
|
+
const coded = new Stepper({
|
|
25
|
+
label: 'Order',
|
|
26
|
+
items: ['Cart', 'Address', 'Payment', 'Done'],
|
|
27
|
+
linear: false,
|
|
28
|
+
onStepChanged: e => {
|
|
29
|
+
s.at = e.index;
|
|
30
|
+
s.told = `Step ${e.index + 1}${e.byUser ? ', pressed' : ''}`;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Stack gap="lg" style="inline-size: 100%">
|
|
36
|
+
<Stepper label="Sign up" items={['Account', 'Profile', 'Review']} x-model={() => s.step} />
|
|
37
|
+
<output class="st-value">{() => `value: ${JSON.stringify(s.step)}`}</output>
|
|
38
|
+
<span onConfig={c => c.controls.add(coded)} />
|
|
39
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
40
|
+
<Button text="Back" variant="outline" enabled={() => s.at > 0} onclick={() => void coded.previous()} />
|
|
41
|
+
<Button text="Next" variant="outline" enabled={() => s.at < 3} onclick={() => void coded.next()} />
|
|
42
|
+
<output class="st-told">{() => s.told}</output>
|
|
43
|
+
</Stack>
|
|
44
|
+
</Stack>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Statuses
|
|
50
|
+
|
|
51
|
+
The steps before the current one are completed by themselves. An item may say `status: 'done'` or `'error'` whatever the current step is, be `optional`, be disabled, or carry an `icon` in place of its number; its fields may be functions of your state.
|
|
52
|
+
|
|
53
|
+
| Status | How |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `pending` | A step to come: its number in the indicator. |
|
|
56
|
+
| `current` | The step in hand: `aria-current="step"`. |
|
|
57
|
+
| `done` | The steps before the current one, and any step whose item says `status: 'done'`: a check in the indicator, the line before it filled. |
|
|
58
|
+
| `error` | A step whose item says `status: 'error'`: a mark in the indicator, the text in the danger colour; read out as “Needs attention”. |
|
|
59
|
+
| `optional` | Says “Optional” under the text; in linear order it may be skipped. |
|
|
60
|
+
| `disabled` | An item with `enabled: false`, or a step linear order does not reach yet: `aria-disabled`, out of the Tab order. |
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { reactive } from '@motifx/core';
|
|
64
|
+
import { Button, Stack, Stepper } from '@motifx-community/ui';
|
|
65
|
+
|
|
66
|
+
const pencil = () => {
|
|
67
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
68
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
|
69
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
70
|
+
svg.innerHTML = '<path d="M11.5 2.5l2 2L5 13H3v-2z" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/>';
|
|
71
|
+
return svg;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Completed and failed steps told by the items, an optional step, a disabled one, an icon in place of the number. */
|
|
75
|
+
export default function Statuses() {
|
|
76
|
+
const s = reactive({ paid: false });
|
|
77
|
+
const items = [
|
|
78
|
+
{ text: 'Cart', status: 'done' as const },
|
|
79
|
+
{ text: 'Address', description: 'Checked', status: 'done' as const },
|
|
80
|
+
{ text: 'Payment', description: () => (s.paid ? 'Paid' : 'Card declined'), status: () => (s.paid ? 'done' : 'error') },
|
|
81
|
+
{ text: 'Gift note', optional: true, icon: pencil() },
|
|
82
|
+
{ text: 'Pick-up', enabled: false },
|
|
83
|
+
{ text: 'Done' }
|
|
84
|
+
];
|
|
85
|
+
return (
|
|
86
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
87
|
+
<Stepper label="Statuses" items={items} value={5} linear={false} />
|
|
88
|
+
<Button text={() => (s.paid ? 'Decline the card' : 'Take the payment')} variant="outline" onclick={() => (s.paid = !s.paid)} />
|
|
89
|
+
</Stack>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## In order, or free
|
|
95
|
+
|
|
96
|
+
`linear` (the default) lets a press reach only the completed steps and the next one; `linear={false}` lets it reach any. Either way `onStepChanging` is asked first: `cancel` keeps the step, a `promise` waits for a check or a server.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { reactive } from '@motifx/core';
|
|
100
|
+
import { CheckBox, Stack, Stepper } from '@motifx-community/ui';
|
|
101
|
+
|
|
102
|
+
/** In linear order a step is reached only after the ones before it; `onStepChanging` refuses a step while the box is unchecked. */
|
|
103
|
+
export default function Linear() {
|
|
104
|
+
const s = reactive({ step: 0 as string | number | null, agreed: false, note: '' });
|
|
105
|
+
return (
|
|
106
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
107
|
+
<Stepper
|
|
108
|
+
label="In order"
|
|
109
|
+
items={['Terms', 'Details', 'Confirm']}
|
|
110
|
+
x-model={() => s.step}
|
|
111
|
+
onStepChanging={e => {
|
|
112
|
+
if (e.to > 0 && !s.agreed) {
|
|
113
|
+
e.cancel = true;
|
|
114
|
+
s.note = 'Accept the terms first.';
|
|
115
|
+
} else {
|
|
116
|
+
s.note = '';
|
|
117
|
+
}
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
<CheckBox label="I accept the terms" x-model={() => s.agreed} />
|
|
121
|
+
<output class="st-note">{() => s.note}</output>
|
|
122
|
+
</Stack>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Orientations
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { Stack, Stepper } from '@motifx-community/ui';
|
|
131
|
+
|
|
132
|
+
const STEPS = [
|
|
133
|
+
{ text: 'Details', description: 'Name and e-mail' },
|
|
134
|
+
{ text: 'Address', description: 'Where to send it' },
|
|
135
|
+
{ text: 'Payment', description: 'Card or transfer' },
|
|
136
|
+
{ text: 'Review' }
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
/** Horizontal with the texts under or after the indicators, and vertical. */
|
|
140
|
+
export default function Orientations() {
|
|
141
|
+
return (
|
|
142
|
+
<Stack gap="lg" style="inline-size: 100%">
|
|
143
|
+
<Stepper label="Texts under" items={STEPS} value={1} linear={false} />
|
|
144
|
+
<Stepper label="Texts after" items={STEPS.slice(0, 3)} value={1} labelPosition="end" linear={false} />
|
|
145
|
+
<div style="inline-size: 18rem">
|
|
146
|
+
<Stepper label="Standing" items={STEPS} value={1} orientation="vertical" linear={false} />
|
|
147
|
+
</div>
|
|
148
|
+
</Stack>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Sizes
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import { Stack, Stepper } from '@motifx-community/ui';
|
|
157
|
+
|
|
158
|
+
const STEPS = ['Plan', 'Build', 'Ship'];
|
|
159
|
+
|
|
160
|
+
/** Three sizes, and a stepper without numbers. */
|
|
161
|
+
export default function Sizes() {
|
|
162
|
+
return (
|
|
163
|
+
<Stack gap="lg" style="inline-size: 100%">
|
|
164
|
+
<Stepper label="Small" items={STEPS} value={1} size="sm" linear={false} />
|
|
165
|
+
<Stepper label="Medium" items={STEPS} value={1} linear={false} />
|
|
166
|
+
<Stepper label="Large" items={STEPS} value={1} size="lg" linear={false} />
|
|
167
|
+
<Stepper label="Dots" items={STEPS} value={1} showNumbers={false} size="sm" labelPosition="end" linear={false} />
|
|
168
|
+
</Stack>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Keyboard
|
|
174
|
+
|
|
175
|
+
| Key | What it does |
|
|
176
|
+
| --- | --- |
|
|
177
|
+
| `Tab` | One stop: the step focused last, else the current one, else the first that can be reached. |
|
|
178
|
+
| `Arrow keys` | Left and Right (Up and Down standing) move between the steps that can be reached, around the ends; Home and End go to the first and the last. |
|
|
179
|
+
| `Enter, Space` | Choose the focused step; `onStepChanging` may refuse. |
|
|
180
|
+
|
|
181
|
+
## Accessibility
|
|
182
|
+
|
|
183
|
+
| Topic | How |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| `Landmark` | A `nav` named “Steps” in the kit language, holding an ordered list; several on one page: give each its own `label`. |
|
|
186
|
+
| `A step` | A button whose name reads “Step 2 of 4, Address, Where to send it, Completed”: the position, the texts and the status are all in it. |
|
|
187
|
+
| `Not clickable` | Plain elements: nothing to press, the current one still `aria-current`. |
|
|
188
|
+
| `Lines and marks` | Decorative, hidden from readers. |
|
|
189
|
+
|
|
190
|
+
## Styling
|
|
191
|
+
|
|
192
|
+
| Hook | What it is |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| `.mx-stepper` | The stepper. `data-orientation`, `data-labels`, `data-size`. |
|
|
195
|
+
| `.mx-stepper__list, .mx-stepper__item` | The list and each step with its line. `data-status` on the item. |
|
|
196
|
+
| `.mx-stepper__step` | The step: a button or a div. `data-status`, `aria-current`, `aria-disabled`. |
|
|
197
|
+
| `.mx-stepper__indicator, .mx-stepper__number, .mx-stepper__mark, .mx-stepper__icon` | The circle, the number in it, the check or error mark, an icon of your own. |
|
|
198
|
+
| `.mx-stepper__label, .mx-stepper__description, .mx-stepper__note` | The texts. |
|
|
199
|
+
| `.mx-stepper__line` | The line to the next step. `data-status="done"` up to the current one. |
|
|
200
|
+
|
|
201
|
+
### Component tokens
|
|
202
|
+
|
|
203
|
+
| Token | What it sets |
|
|
204
|
+
| --- | --- |
|
|
205
|
+
| `stepper.step, .indicator, .mark, .label, .description, .note, .line` | Units: the step (`hover`, `pressed`, `focus`, `disabled`, `current`, `done`, `error`), its indicator, the mark (`icon` per state), the texts, the line (`done`); the line turns a quarter in a vertical stepper. |
|
|
206
|
+
| `stepper.size.*, .font-size.*, .padding.*` | The indicator, the text and the space around a step, per size. |
|
|
207
|
+
| `stepper.description-font-size, .gap, .line-gap, .line-min-length` | The second line, the space between indicator and texts, and the line’s margins and least length. |
|
|
208
|
+
|
|
209
|
+
## API reference
|
|
210
|
+
|
|
211
|
+
### Props
|
|
212
|
+
|
|
213
|
+
| Prop | Type | Default | Description |
|
|
214
|
+
| --- | --- | --- | --- |
|
|
215
|
+
| `items` | `Bind<readonly (StepperItem \| string)[]>` | `[]` | The steps in order: `StepperItem`s (`text`, `description`, `key`, `icon`, `status`, `optional`, `enabled`, `data`) or plain texts. |
|
|
216
|
+
| `value` | `Bind<string \| number \| null>` | `0` | The current step: its `key`, else its index; `null` for none. `x-model` binds it two-way. |
|
|
217
|
+
| `linear` | `Bind<boolean>` | `true` | A press reaches a completed step, or the one right after the last completed; optional steps may be skipped. |
|
|
218
|
+
| `orientation` | `Bind<StepperOrientation>` | `'horizontal'` | `horizontal` or `vertical`. |
|
|
219
|
+
| `labelPosition` | `Bind<StepperLabelPosition>` | `'bottom'` | Horizontal only: the texts under the indicator (`bottom`) or after it (`end`). |
|
|
220
|
+
| `size` | `Bind<ControlSize>` | `'md'` | `sm`, `md`, `lg`. |
|
|
221
|
+
| `clickable` | `Bind<boolean>` | `true` | `false` shows the way only: no buttons, no Tab stop. |
|
|
222
|
+
| `showNumbers` | `Bind<boolean>` | `true` | The indicator of a step to come shows its number. |
|
|
223
|
+
| `label` | `Bind<string>` | the kit’s “Steps” | What screen readers call it. |
|
|
224
|
+
|
|
225
|
+
### Events, properties and methods
|
|
226
|
+
|
|
227
|
+
| Member | Kind | Description |
|
|
228
|
+
| --- | --- | --- |
|
|
229
|
+
| `onStepChanging` | event | The current step is about to change (`from`, `to`, `fromItem`, `toItem`, `byUser`). `cancel = true` keeps it; `promise` set to a `Promise<boolean>` waits, and the step changes when it resolves to `true`. |
|
|
230
|
+
| `onStepChanged` | event | The current step changed (`index`, `item`, `previous`, `byUser`). |
|
|
231
|
+
| `selectedIndex` | read-only | The index of the current step; -1 when there is none. |
|
|
232
|
+
| `count` | read-only | How many steps there are. |
|
|
233
|
+
| `canGoNext, canGoPrevious` | read-only | There is an enabled step after, or before, the current one. |
|
|
234
|
+
| `next(), previous()` | `Promise<boolean>` | Goes to the next or the previous enabled step; `false` when there is none or the change was refused. |
|
|
235
|
+
| `goTo(step)` | `Promise<boolean>` | Goes to a step by index or key, whatever the order; `onStepChanging` is asked first. |
|
|
236
|
+
| `statusOf(index)` | `StepperStatus` | `pending`, `current`, `done` or `error`, as drawn. |
|
|
237
|
+
| `canReach(index)` | `boolean` | Whether a press may reach the step. |
|
|
238
|
+
| `refresh()` | `void` | Reads the items again after they were changed in place. |
|
package/docs/switch.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Switch
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
An on / off switch with its caption: a track with a thumb that slides, an optional on / off text inside or next to it, read-only and required. A native checkbox with the switch role underneath.
|
|
6
6
|
|
package/docs/tabdocs-dock.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Dock and floating windows
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
Documents and whole groups float in windows of their own in the page and dock again into the documents' groups or into dock areas around them, which fold to the manager's edge. The mouse, the keys and the code do the same, through the same events.
|
|
6
6
|
|
package/docs/tabdocs-drag.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Drag and drop
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
Tabs and whole groups dragged as in a code editor: along a strip, to another group, beside a group or along an edge of the layout, between two managers, and the same moves from the keyboard. Every drop goes through the methods and events of what it does.
|
|
6
6
|
|
package/docs/tabdocs-menus.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Menus and keys
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
The commands around the tabs: context menus on tabs and on the empty strip, a searchable list of a group's documents, the app's own toolbar buttons, the recently used list, back and forward, reopening what was closed, locked groups, and the keys for all of them.
|
|
6
6
|
|
package/docs/tabdocs-mobile.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Tablet and phone
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
On a tablet and a phone a layout of groups, splits and dock areas does not fit as it is. The manager keeps the layout and shows it another way: the same documents, groups and areas, the same saved JSON, the content moved and never made again. It goes by its own width, not by the device; on a touch screen its tabs and buttons get larger.
|
|
6
6
|
|
package/docs/tabdocs-tabs.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Tabs
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
What a tab does in a code editor: preview tabs that the next preview replaces, pinned tabs that stay at the start, tabs that shrink, wrap or scroll, counts and colours, and the same document open in two groups.
|
|
6
6
|
|
package/docs/tabdocs-windows.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: New windows
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
A document, a group or a floating window moves into a browser window of its own, and back. Its content moves with it, nothing is made again, and the new window is a part of the same manager: its tabs, menus, keys and drag work as they do here.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: A whole workspace
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
A whole screen made of the kit's parts: a menu bar, the manager, a DataGrid with everything turned on, forms and a tool docked at the bottom. Each part is the same component it is on its own page; the manager only holds them.
|
|
6
6
|
|
package/docs/tabdocs.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
A document manager in the way code editors arrange files: documents in tabs, tabs in groups, groups split side by side and one under the other. A document's content is any component, a form, a grid or plain text, and it is moved, never made again, when its tab goes to another group. Everything the user does is a method too, asks first and reports after; the whole layout saves to JSON and comes back. Preview and pinned tabs, sizes and copies are on [Tabs](tabdocs-tabs.md); context menus, lists and keys on [Menus and keys](tabdocs-menus.md).
|
|
6
6
|
|
package/docs/tabs.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tabs
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
Tabs show one panel at a time under a strip of tabs: from JSX or from code, closable, with icons and badges, scroll buttons when the tabs do not fit, four placements and panels built when they are first shown.
|
|
6
6
|
|
|
@@ -346,7 +346,7 @@ Tabs write one text: the close button's tooltip, `uiLocale.strings.close`. Every
|
|
|
346
346
|
|
|
347
347
|
```tsx
|
|
348
348
|
import { reactive } from '@motifx/core';
|
|
349
|
-
import { Button,
|
|
349
|
+
import { Button, uiLocale } from '@motifx-community/ui';
|
|
350
350
|
import { kitTexts } from '../../../shared/kit-texts';
|
|
351
351
|
|
|
352
352
|
/** Switches the texts of every component on the page, the tabs' close button included. */
|
|
@@ -354,7 +354,7 @@ export default function Localization() {
|
|
|
354
354
|
const s = reactive({ lang: 'en' });
|
|
355
355
|
const toggle = () => {
|
|
356
356
|
s.lang = s.lang === 'en' ? 'tr' : 'en';
|
|
357
|
-
uiLocale.
|
|
357
|
+
void uiLocale.use(s.lang);
|
|
358
358
|
};
|
|
359
359
|
return (
|
|
360
360
|
<>
|
package/docs/tagbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TagBox
|
|
2
2
|
|
|
3
|
-
> Data · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Data · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
Picks several items. The chosen ones are tags in the field, followed by a text input that searches the list; items come from memory or from a data source, and typed text can become a tag of its own.
|
|
6
6
|
|
|
@@ -341,7 +341,7 @@ export default function Validation() {
|
|
|
341
341
|
|
|
342
342
|
```tsx
|
|
343
343
|
import { reactive } from '@motifx/core';
|
|
344
|
-
import { Button, TagBox,
|
|
344
|
+
import { Button, TagBox, uiLocale } from '@motifx-community/ui';
|
|
345
345
|
import { skills } from './skills';
|
|
346
346
|
|
|
347
347
|
/** Switches the texts of every tag box on the page: remove buttons, “+3”, “Select all”. */
|
|
@@ -349,7 +349,7 @@ export default function Localization() {
|
|
|
349
349
|
const s = reactive({ lang: 'en' });
|
|
350
350
|
const toggle = () => {
|
|
351
351
|
s.lang = s.lang === 'en' ? 'tr' : 'en';
|
|
352
|
-
uiLocale.
|
|
352
|
+
void uiLocale.use(s.lang);
|
|
353
353
|
};
|
|
354
354
|
return (
|
|
355
355
|
<>
|
package/docs/textarea.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TextArea
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
A text field of several lines: a box that grows with the text or that the user drags bigger, a character counter, a clear button, Ctrl+Enter to send, and the label, help text and validation every field has.
|
|
6
6
|
|
|
@@ -217,7 +217,7 @@ The name of the clear button and the validation messages come from `uiLocale.str
|
|
|
217
217
|
|
|
218
218
|
```tsx
|
|
219
219
|
import { reactive } from '@motifx/core';
|
|
220
|
-
import { Button,
|
|
220
|
+
import { Button, uiLocale } from '@motifx-community/ui';
|
|
221
221
|
import { kitTexts } from '../../../shared/kit-texts';
|
|
222
222
|
|
|
223
223
|
/** Switches the texts of every field on the page, the clear button's name included. */
|
|
@@ -225,7 +225,7 @@ export default function Localization() {
|
|
|
225
225
|
const s = reactive({ lang: 'en' });
|
|
226
226
|
const toggle = () => {
|
|
227
227
|
s.lang = s.lang === 'en' ? 'tr' : 'en';
|
|
228
|
-
uiLocale.
|
|
228
|
+
void uiLocale.use(s.lang);
|
|
229
229
|
};
|
|
230
230
|
return (
|
|
231
231
|
<>
|
package/docs/textbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TextBox
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
A one-line text field with its label, help text and error: placeholder, prefix and suffix, buttons in the box, a clear button, a password that can be shown, a character counter, an input mask and validation — alone, in a group, or every field in a panel.
|
|
6
6
|
|
|
@@ -316,7 +316,7 @@ The names of the clear and password buttons and every validation message come fr
|
|
|
316
316
|
|
|
317
317
|
```tsx
|
|
318
318
|
import { reactive } from '@motifx/core';
|
|
319
|
-
import { Button,
|
|
319
|
+
import { Button, uiLocale } from '@motifx-community/ui';
|
|
320
320
|
import { kitTexts } from '../../../shared/kit-texts';
|
|
321
321
|
|
|
322
322
|
/** Switches the texts of every field on the page; errors already shown follow too. */
|
|
@@ -324,7 +324,7 @@ export default function Localization() {
|
|
|
324
324
|
const s = reactive({ lang: 'en' });
|
|
325
325
|
const toggle = () => {
|
|
326
326
|
s.lang = s.lang === 'en' ? 'tr' : 'en';
|
|
327
|
-
uiLocale.
|
|
327
|
+
void uiLocale.use(s.lang);
|
|
328
328
|
};
|
|
329
329
|
return (
|
|
330
330
|
<>
|