@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/toolbar.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Toolbar
|
|
2
2
|
|
|
3
|
-
> Buttons · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Buttons · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
A bar of commands: buttons, toggle buttons, menus and fields in groups between separators. It is one Tab stop and the arrow keys move inside it; items that do not fit move into a “more” menu at the end. Items come as data, as JSX children, or both.
|
|
6
6
|
|
|
@@ -167,7 +167,7 @@ The only text a toolbar writes itself is the name of its “more” button, from
|
|
|
167
167
|
|
|
168
168
|
```tsx
|
|
169
169
|
import { reactive } from '@motifx/core';
|
|
170
|
-
import { Button,
|
|
170
|
+
import { Button, uiLocale } from '@motifx-community/ui';
|
|
171
171
|
import { kitTexts } from '../../../shared/kit-texts';
|
|
172
172
|
|
|
173
173
|
/** Switches the texts of the kit; the “more” buttons take the new name at once. */
|
|
@@ -175,7 +175,7 @@ export default function Localization() {
|
|
|
175
175
|
const s = reactive({ lang: 'en' });
|
|
176
176
|
const toggle = () => {
|
|
177
177
|
s.lang = s.lang === 'en' ? 'tr' : 'en';
|
|
178
|
-
uiLocale.
|
|
178
|
+
void uiLocale.use(s.lang);
|
|
179
179
|
};
|
|
180
180
|
return (
|
|
181
181
|
<>
|
package/docs/tooltip.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tooltip
|
|
2
2
|
|
|
3
|
-
> Feedback · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Feedback · @motifx-community/ui 0.1.0-beta.2
|
|
4
4
|
|
|
5
5
|
A short description shown next to an element: after the pointer rests on it, when it gets keyboard focus, or from code. It can be hovered, Escape hides it, and one is open at a time on the page.
|
|
6
6
|
|
package/docs/treeview.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TreeView
|
|
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
|
A tree view shows items in a hierarchy. Rows open and close, are selected one or many at a time, can carry check boxes that add up to their parents, can be searched, and can load their children when they are first opened. Long trees draw only the rows in view.
|
|
6
6
|
|
|
@@ -185,7 +185,7 @@ The tree writes four texts, all from `uiLocale.strings`: `noItems` (nothing to s
|
|
|
185
185
|
|
|
186
186
|
```tsx
|
|
187
187
|
import { reactive } from '@motifx/core';
|
|
188
|
-
import { Button,
|
|
188
|
+
import { Button, uiLocale } from '@motifx-community/ui';
|
|
189
189
|
import { kitTexts } from '../../../shared/kit-texts';
|
|
190
190
|
|
|
191
191
|
/** Switches the texts of the kit; the trees on the page follow at once. */
|
|
@@ -193,7 +193,7 @@ export default function Localization() {
|
|
|
193
193
|
const s = reactive({ lang: 'en' });
|
|
194
194
|
const toggle = () => {
|
|
195
195
|
s.lang = s.lang === 'en' ? 'tr' : 'en';
|
|
196
|
-
uiLocale.
|
|
196
|
+
void uiLocale.use(s.lang);
|
|
197
197
|
};
|
|
198
198
|
return (
|
|
199
199
|
<>
|
package/docs/window.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Window and dialog
|
|
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
|
A window or a dialog on a native `<dialog>`: one form, shown modeless or modal by whoever shows it. It has a title bar, moves, resizes, minimizes and maximizes; Enter and Escape press its buttons; forms open forms. `messageBox` and `confirm` cover the common questions.
|
|
6
6
|
|
|
@@ -327,7 +327,7 @@ The title bar buttons and the `ok`, `cancel`, `yes`, `no` buttons of a message b
|
|
|
327
327
|
|
|
328
328
|
```tsx
|
|
329
329
|
import { reactive } from '@motifx/core';
|
|
330
|
-
import { Button,
|
|
330
|
+
import { Button, messageBox, uiLocale } from '@motifx-community/ui';
|
|
331
331
|
|
|
332
332
|
/** Switches the names of the title bar buttons and of the message box buttons. */
|
|
333
333
|
export default function Localization() {
|
|
@@ -335,7 +335,7 @@ export default function Localization() {
|
|
|
335
335
|
|
|
336
336
|
const toggle = () => {
|
|
337
337
|
s.lang = s.lang === 'en' ? 'tr' : 'en';
|
|
338
|
-
uiLocale.
|
|
338
|
+
void uiLocale.use(s.lang);
|
|
339
339
|
};
|
|
340
340
|
|
|
341
341
|
const ask = () =>
|
package/docs/wizard.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Wizard
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.2
|
|
4
|
+
|
|
5
|
+
A task in steps: a [Stepper](stepper.md) above or beside one page per step, and the Back and Next buttons under them. Next validates the page first; on the last step it finishes.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Wizard, WizardStep } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Pages from JSX
|
|
14
|
+
|
|
15
|
+
Each `WizardStep` is a step and its page. Next validates the kit’s fields on the page, then the step’s own `validate`; a page that fails keeps the wizard, marks its step and focuses the first invalid field. On the last step Next reads Finish and raises `onFinished`.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { CheckBox, Stack, TextBox, Wizard, WizardStep } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** Three pages with the kit's fields: Next validates the page first; Finish tells the app. */
|
|
22
|
+
export default function Basic() {
|
|
23
|
+
const s = reactive({ name: '', email: '', city: '', agreed: false, result: '' });
|
|
24
|
+
return (
|
|
25
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
26
|
+
<Wizard label="Sign up" onFinished={() => (s.result = `Welcome, ${s.name}.`)}>
|
|
27
|
+
<WizardStep title="Account" description="Who you are">
|
|
28
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
29
|
+
<TextBox label="Name" x-model={() => s.name} required />
|
|
30
|
+
<TextBox label="E-mail" x-model={() => s.email} required rules={[{ type: 'email' }]} />
|
|
31
|
+
</Stack>
|
|
32
|
+
</WizardStep>
|
|
33
|
+
<WizardStep title="Address" description="Where you live">
|
|
34
|
+
<TextBox label="City" x-model={() => s.city} required />
|
|
35
|
+
</WizardStep>
|
|
36
|
+
<WizardStep title="Review" validate={() => s.agreed}>
|
|
37
|
+
<p>{() => `${s.name || '—'}, ${s.email || '—'}, ${s.city || '—'}`}</p>
|
|
38
|
+
<CheckBox label="Everything is right" x-model={() => s.agreed} />
|
|
39
|
+
</WizardStep>
|
|
40
|
+
</Wizard>
|
|
41
|
+
<output class="wz-result">{() => s.result}</output>
|
|
42
|
+
</Stack>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## From code
|
|
48
|
+
|
|
49
|
+
`steps` makes the steps from props, each page from a `content` factory when it is first shown; `add`, `insert` and `remove` change them later. `next()`, `previous()`, `goTo()` and `finish()` move it.
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { Component, reactive } from '@motifx/core';
|
|
53
|
+
import { Button, Stack, Wizard, WizardStep } from '@motifx-community/ui';
|
|
54
|
+
|
|
55
|
+
// A page made from code: any MotifJS component.
|
|
56
|
+
class Note extends Component<HTMLDivElement, { text: string }> {
|
|
57
|
+
override view() {
|
|
58
|
+
return <p>{this.props.text}</p>;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A wizard made from code: its steps as props with content factories, moved with its methods, a step added later. */
|
|
63
|
+
export default function FromCode() {
|
|
64
|
+
const s = reactive({ told: '' });
|
|
65
|
+
const wizard = new Wizard({
|
|
66
|
+
label: 'Setup',
|
|
67
|
+
steps: [
|
|
68
|
+
{ title: 'Welcome', content: () => new Note({ text: 'A page made by a factory, built when first shown.' }) },
|
|
69
|
+
{ title: 'Options', description: 'Pick what you need', content: () => new Note({ text: 'The second page.' }) },
|
|
70
|
+
{ title: 'Done', content: () => new Note({ text: 'The last page; Next reads Finish here.' }) }
|
|
71
|
+
],
|
|
72
|
+
onStepChanged: e => (s.told = `Step ${e.index + 1}: ${(e.item as { text: string }).text}`),
|
|
73
|
+
onFinished: () => (s.told = 'Finished.')
|
|
74
|
+
});
|
|
75
|
+
const addStep = () => {
|
|
76
|
+
wizard.insert(2, new WizardStep({ title: 'Extra', optional: true, content: () => new Note({ text: 'Added from code.' }) }));
|
|
77
|
+
};
|
|
78
|
+
return (
|
|
79
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
80
|
+
<span onConfig={c => c.controls.add(wizard)} />
|
|
81
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
82
|
+
<Button text="Go to Done" variant="outline" onclick={() => void wizard.goTo(wizard.steps.length - 1)} />
|
|
83
|
+
<Button text="Add a step" variant="outline" onclick={addStep} />
|
|
84
|
+
<output class="wz-told">{() => s.told}</output>
|
|
85
|
+
</Stack>
|
|
86
|
+
</Stack>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Standing
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { reactive } from '@motifx/core';
|
|
95
|
+
import { RadioGroup, Switch, TextArea, Wizard, WizardStep } from '@motifx-community/ui';
|
|
96
|
+
|
|
97
|
+
/** The stepper beside the pages, the texts after the indicators. */
|
|
98
|
+
export default function Vertical() {
|
|
99
|
+
const s = reactive({ plan: 'Team', notify: true, note: '' });
|
|
100
|
+
return (
|
|
101
|
+
<Wizard label="Subscription" orientation="vertical" style="min-block-size: 16rem; inline-size: 100%">
|
|
102
|
+
<WizardStep title="Plan" description="What you pay for">
|
|
103
|
+
<RadioGroup label="Plan" items={['Solo', 'Team', 'Business']} x-model={() => s.plan} />
|
|
104
|
+
</WizardStep>
|
|
105
|
+
<WizardStep title="Alerts" description="How we reach you">
|
|
106
|
+
<Switch label="Send me a monthly summary" x-model={() => s.notify} />
|
|
107
|
+
</WizardStep>
|
|
108
|
+
<WizardStep title="Notes" optional>
|
|
109
|
+
<TextArea label="Anything else?" x-model={() => s.note} rows={3} />
|
|
110
|
+
</WizardStep>
|
|
111
|
+
</Wizard>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Your own buttons, finishing that waits
|
|
117
|
+
|
|
118
|
+
`showNavigation={false}` takes the bar away; your own buttons call the methods. `onFinishing` may set a `promise`: the wizard finishes when it resolves to `true`, and stays otherwise.
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { reactive } from '@motifx/core';
|
|
122
|
+
import { Button, Stack, TextBox, Wizard, WizardStep } from '@motifx-community/ui';
|
|
123
|
+
|
|
124
|
+
/** No bar: buttons of your own drive it; finishing waits for a promise (a server) and may be refused. */
|
|
125
|
+
export default function Custom() {
|
|
126
|
+
const s = reactive({ code: '', busy: false, note: '' });
|
|
127
|
+
let wizard!: Wizard;
|
|
128
|
+
const finish = () => {
|
|
129
|
+
s.note = '';
|
|
130
|
+
void wizard.finish().then(ok => (s.note = ok ? 'Saved.' : s.note || 'Not finished.'));
|
|
131
|
+
};
|
|
132
|
+
return (
|
|
133
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
134
|
+
<Wizard
|
|
135
|
+
ref={(w: Wizard) => (wizard = w)}
|
|
136
|
+
label="Redeem"
|
|
137
|
+
showNavigation={false}
|
|
138
|
+
labelPosition="end"
|
|
139
|
+
onFinishing={e => {
|
|
140
|
+
s.busy = true;
|
|
141
|
+
e.promise = new Promise<boolean>(resolve => setTimeout(() => resolve(s.code.toUpperCase() === 'MOTIF'), 600)).then(ok => {
|
|
142
|
+
s.busy = false;
|
|
143
|
+
if (!ok) s.note = 'That code is not known.';
|
|
144
|
+
return ok;
|
|
145
|
+
});
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<WizardStep title="Code">
|
|
149
|
+
<TextBox label="Gift code" x-model={() => s.code} required placeholder="MOTIF" />
|
|
150
|
+
</WizardStep>
|
|
151
|
+
<WizardStep title="Confirm">
|
|
152
|
+
<p>{() => `Redeem “${s.code}”?`}</p>
|
|
153
|
+
</WizardStep>
|
|
154
|
+
</Wizard>
|
|
155
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
156
|
+
<Button text="Back" variant="outline" onclick={() => void wizard.previous()} />
|
|
157
|
+
<Button text="Next" variant="outline" onclick={() => void wizard.next()} />
|
|
158
|
+
<Button text="Redeem" busy={() => s.busy} onclick={finish} />
|
|
159
|
+
<output class="wz-note">{() => s.note}</output>
|
|
160
|
+
</Stack>
|
|
161
|
+
</Stack>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Accessibility
|
|
167
|
+
|
|
168
|
+
| Topic | How |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `Stepper` | A `nav` of steps as on the [Stepper](stepper.md) page: each a button with its position and status in its name, one Tab stop. |
|
|
171
|
+
| `Page` | A `group` named after its step; the hidden pages are out of the tree. |
|
|
172
|
+
| `Validation` | A page that fails keeps focus on its first invalid field, with its message; the step reads “Needs attention”. |
|
|
173
|
+
| `Buttons` | The kit’s buttons, named in the kit language: “Back”, “Next”, “Finish”. |
|
|
174
|
+
|
|
175
|
+
## Styling
|
|
176
|
+
|
|
177
|
+
| Hook | What it is |
|
|
178
|
+
| --- | --- |
|
|
179
|
+
| `.mx-wizard` | The wizard. `data-orientation`. |
|
|
180
|
+
| `.mx-wizard__stepper` | The stepper (`.mx-stepper` too). |
|
|
181
|
+
| `.mx-wizard__pages, .mx-wizard__page` | The pages and each page; a hidden page carries `hidden`. |
|
|
182
|
+
| `.mx-wizard__bar, .mx-wizard__previous, .mx-wizard__next` | The bar and its buttons. |
|
|
183
|
+
|
|
184
|
+
### Component tokens
|
|
185
|
+
|
|
186
|
+
| Token | What it sets |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| `wizard.frame, .page, .bar` | Units: the whole, a page, the bar (a rule over it, its padding). |
|
|
189
|
+
| `wizard.previous, wizard.next` | Places: the buttons’ look in the bar (`variant`). |
|
|
190
|
+
| `wizard.gap, .bar-gap, .rail-width` | Between the stepper, the pages and the bar; between the buttons; the stepper’s width when it stands beside the pages. |
|
|
191
|
+
|
|
192
|
+
## API reference
|
|
193
|
+
|
|
194
|
+
### Wizard props
|
|
195
|
+
|
|
196
|
+
| Prop | Type | Default | Description |
|
|
197
|
+
| --- | --- | --- | --- |
|
|
198
|
+
| `steps` | `readonly WizardStepProps[]` | `[]` | Steps made from code, each as the props of a `WizardStep`; the JSX `WizardStep` children come first. |
|
|
199
|
+
| `value` | `Bind<string \| number \| null>` | `0` | The current step: its `key`, else its index. `x-model` binds it two-way. |
|
|
200
|
+
| `linear` | `Bind<boolean>` | `true` | A step is reached only after the ones before it; optional steps may be skipped. |
|
|
201
|
+
| `orientation` | `Bind<StepperOrientation>` | `'horizontal'` | `horizontal`: the stepper above the pages; `vertical`: beside them. |
|
|
202
|
+
| `labelPosition` | `Bind<StepperLabelPosition>` | `'bottom'` | Where the stepper’s texts sit, horizontal only. |
|
|
203
|
+
| `size` | `Bind<ControlSize>` | `'md'` | The stepper’s size. |
|
|
204
|
+
| `showStepper, showNavigation` | `Bind<boolean>` | `true` | The stepper, and the bar with the Back and Next buttons. |
|
|
205
|
+
| `clickable` | `Bind<boolean>` | `true` | The steps of the stepper can be pressed. |
|
|
206
|
+
| `lazy` | `Bind<boolean>` | `true` | A page is built when first shown, then kept (a step’s own `lazy` wins). |
|
|
207
|
+
| `keepAlive` | `Bind<boolean>` | `true` | `false`: what a step’s `content` made is disposed while hidden and made again when it shows (a step’s own `keepAlive` wins). |
|
|
208
|
+
| `previousText, nextText, finishText` | `Bind<string>` | the kit’s “Back”, “Next”, “Finish” | The buttons’ texts. |
|
|
209
|
+
| `label` | `Bind<string>` | the kit’s “Steps” | What screen readers call the stepper. |
|
|
210
|
+
|
|
211
|
+
### WizardStep props
|
|
212
|
+
|
|
213
|
+
| Prop | Type | Default | Description |
|
|
214
|
+
| --- | --- | --- | --- |
|
|
215
|
+
| `title` | `Bind<string>` | `''` | The step’s text in the stepper. The same property as `text`. |
|
|
216
|
+
| `description` | `Bind<string>` | `''` | A second line under the title. |
|
|
217
|
+
| `key` | `Bind<string>` | the index | Names the step in `value`; the JSX `key` works too. |
|
|
218
|
+
| `icon` | `Bind<IconSource \| null>` | `null` | Drawn in the indicator in place of the number. |
|
|
219
|
+
| `optional` | `Bind<boolean>` | `false` | May be skipped; says so under the title. |
|
|
220
|
+
| `enabled` | `Bind<boolean>` | `true` | `false` keeps the step from being reached. |
|
|
221
|
+
| `error` | `Bind<boolean>` | `false` | Draws the step with an error; the wizard sets it when the page does not validate, and clears it when it does. |
|
|
222
|
+
| `validateFields` | `Bind<boolean>` | `true` | The kit’s fields on the page are validated before the wizard moves on from it; the first invalid one takes focus. |
|
|
223
|
+
| `validate` | `() => boolean \| Promise<boolean>` | — | Asked after the fields; `false` keeps the page and marks the step. |
|
|
224
|
+
| `lazy, keepAlive` | `Bind<boolean \| undefined>` | the wizard’s | See the wizard’s. |
|
|
225
|
+
| `content` | `() => ComponentBase \| ComponentBase[]` | — | Makes the page from code, when the page is built. |
|
|
226
|
+
|
|
227
|
+
### Events, properties and methods
|
|
228
|
+
|
|
229
|
+
| Member | Kind | Description |
|
|
230
|
+
| --- | --- | --- |
|
|
231
|
+
| `onStepChanging, onStepChanged` | event | The stepper’s events: `onStepChanging` (`cancel`, `promise`) runs before the page is validated. |
|
|
232
|
+
| `onFinishing` | event | The last page validated and the wizard is about to finish; `cancel = true` keeps it open, `promise` waits and finishes on `true`. |
|
|
233
|
+
| `onFinished` | event | The wizard finished: every step is drawn done. |
|
|
234
|
+
| `next(), previous(), goTo(step)` | `Promise<boolean>` | Next validates the page first and finishes on the last step; Back validates nothing; `goTo` validates when it goes forward. |
|
|
235
|
+
| `finish()` | `Promise<boolean>` | Validates the page, asks `onFinishing`, then finishes. |
|
|
236
|
+
| `leaveCheck()` | `Promise<boolean>` | Validates the current page the way Next does, without moving. |
|
|
237
|
+
| `add(step), insert(index, step), remove(step)` | `WizardStep` / `boolean` | Steps from code; a step of another wizard moves here. |
|
|
238
|
+
| `stepper, steps, currentStep, selectedIndex` | read-only | The `Stepper`, the `WizardStep`s in order, the current one and its index. |
|
|
239
|
+
| `isLast, isFinished` | read-only | The current step is the last that can be gone to (Next finishes); the wizard finished. |
|
|
240
|
+
| `previousButton, nextButton` | read-only | The kit’s buttons in the bar, for an icon or a look of your own. |
|