@motifx-community/ui 0.1.0-beta.2 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -12
- package/README.md +6 -6
- package/dist/components/accordion/Accordion.d.ts +3 -3
- package/dist/components/accordion/AccordionItem.d.ts +1 -1
- package/dist/components/card/Card.d.ts +1 -1
- package/dist/components/contextmenu/ContextMenu.d.ts +1 -1
- package/dist/components/datagrid/DataGrid.d.ts +5 -5
- package/dist/components/datagrid/data-grid-props.d.ts +2 -2
- package/dist/components/datagrid/grid-adaptive-row-expanded-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-adaptive-row-expanding-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-grouping-changed-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-grouping-changing-event-args.d.ts +2 -2
- package/dist/components/datagrid/grid-master-detail.d.ts +1 -1
- package/dist/components/datagrid/grid-row-expanded-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-row-expanding-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-search-text-changed-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-search-text-changing-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-sort-changing-event-args.d.ts +1 -1
- package/dist/components/datagrid/model/GridSearch.d.ts +1 -1
- package/dist/components/draggable/Draggable.d.ts +99 -0
- package/dist/components/draggable/DropTarget.d.ts +38 -0
- package/dist/components/draggable/draggable-event-args.d.ts +17 -0
- package/dist/components/draggable/draggable-props.d.ts +37 -0
- package/dist/components/draggable/drop-event-args.d.ts +11 -0
- package/dist/components/draggable/drop-target-props.d.ts +13 -0
- package/dist/components/draggable/index.d.ts +6 -0
- package/dist/components/fileuploader/FileUploader.d.ts +1 -1
- package/dist/components/fileuploader/file-uploader-props.d.ts +1 -1
- package/dist/components/fileuploader/upload-mode.d.ts +1 -1
- package/dist/components/filterbuilder/FilterBuilder.d.ts +1 -1
- package/dist/components/gallery/Gallery.d.ts +132 -0
- package/dist/components/gallery/gallery-item-click-event-args.d.ts +9 -0
- package/dist/components/gallery/gallery-item.d.ts +18 -0
- package/dist/components/gallery/gallery-props.d.ts +38 -0
- package/dist/components/gallery/index.d.ts +6 -0
- package/dist/components/gallery/slide-changed-event-args.d.ts +11 -0
- package/dist/components/gallery/slide-changing-event-args.d.ts +14 -0
- package/dist/components/layout/ChildSettings.d.ts +1 -1
- package/dist/components/layout/DockPanel.d.ts +2 -2
- package/dist/components/layout/Grid.d.ts +1 -1
- package/dist/components/layout/SplitContainer.d.ts +1 -1
- package/dist/components/layout/Stack.d.ts +1 -1
- package/dist/components/multiview/MultiView.d.ts +87 -0
- package/dist/components/multiview/View.d.ts +41 -0
- package/dist/components/multiview/index.d.ts +6 -0
- package/dist/components/multiview/multi-view-props.d.ts +24 -0
- package/dist/components/multiview/view-props.d.ts +15 -0
- package/dist/components/multiview/view-selecting-event-args.d.ts +15 -0
- package/dist/components/multiview/view-selection-changed-event-args.d.ts +12 -0
- package/dist/components/numberbox/number-box-props.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/popover-props.d.ts +1 -1
- package/dist/components/resizable/Resizable.d.ts +84 -0
- package/dist/components/resizable/index.d.ts +3 -0
- package/dist/components/resizable/resizable-props.d.ts +41 -0
- package/dist/components/resizable/resize-event-args.d.ts +13 -0
- package/dist/components/scheduler/AppointmentEditor.d.ts +1 -1
- package/dist/components/scheduler/scheduler-props.d.ts +1 -1
- package/dist/components/scrollview/ScrollView.d.ts +1 -1
- package/dist/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/components/speeddial/SpeedDial.d.ts +129 -0
- package/dist/components/speeddial/index.d.ts +6 -0
- package/dist/components/speeddial/speed-dial-action-click-event-args.d.ts +9 -0
- package/dist/components/speeddial/speed-dial-action.d.ts +25 -0
- package/dist/components/speeddial/speed-dial-event-args.d.ts +8 -0
- package/dist/components/speeddial/speed-dial-props.d.ts +49 -0
- package/dist/components/speeddial/speed-dial-tooltip.d.ts +3 -0
- package/dist/components/splitter/SplitPane.d.ts +45 -0
- package/dist/components/splitter/Splitter.d.ts +116 -0
- package/dist/components/splitter/index.d.ts +6 -0
- package/dist/components/splitter/split-pane-props.d.ts +21 -0
- package/dist/components/splitter/splitter-collapse-event-args.d.ts +13 -0
- package/dist/components/splitter/splitter-props.d.ts +25 -0
- package/dist/components/splitter/splitter-resize-event-args.d.ts +10 -0
- package/dist/components/stepper/Stepper.d.ts +1 -1
- package/dist/components/stepper/WizardStep.d.ts +1 -1
- package/dist/components/stepper/step-changed-event-args.d.ts +1 -1
- package/dist/components/stepper/step-changing-event-args.d.ts +1 -1
- package/dist/components/stepper/wizard-props.d.ts +1 -1
- package/dist/components/tabdocs/TabDocumentManager.d.ts +1 -1
- package/dist/components/tabs/Tabs.d.ts +2 -2
- package/dist/components/tileview/TileView.d.ts +128 -0
- package/dist/components/tileview/index.d.ts +6 -0
- package/dist/components/tileview/tile-click-event-args.d.ts +9 -0
- package/dist/components/tileview/tile-reorder-event-args.d.ts +11 -0
- package/dist/components/tileview/tile-selection-changed-event-args.d.ts +11 -0
- package/dist/components/tileview/tile-view-item.d.ts +18 -0
- package/dist/components/tileview/tile-view-props.d.ts +38 -0
- package/dist/components/timeline/Timeline.d.ts +113 -0
- package/dist/components/timeline/index.d.ts +5 -0
- package/dist/components/timeline/timeline-item-click-event-args.d.ts +9 -0
- package/dist/components/timeline/timeline-item.d.ts +24 -0
- package/dist/components/timeline/timeline-props.d.ts +30 -0
- package/dist/components/timeline/timeline-selection-changed-event-args.d.ts +11 -0
- package/dist/components/tooltip/Tooltip.d.ts +1 -1
- package/dist/components/treeview/TreeView.d.ts +1 -1
- package/dist/components/validationsummary/ValidationSummary.d.ts +56 -0
- package/dist/components/validationsummary/index.d.ts +3 -0
- package/dist/components/validationsummary/summary-item-click-event-args.d.ts +11 -0
- package/dist/components/validationsummary/validation-summary-props.d.ts +17 -0
- package/dist/core/control.d.ts +4 -4
- package/dist/core/flow-home.d.ts +1 -1
- package/dist/core/ui-strings.d.ts +26 -0
- package/dist/generated/tokens.d.ts +6390 -4745
- package/dist/index.d.ts +9 -0
- package/dist/index.js +5119 -759
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +22 -1
- package/dist/locales/tr.json +22 -1
- package/dist/parts/slide/slide-track-host.d.ts +19 -0
- package/dist/parts/slide/slide-track.d.ts +45 -0
- package/dist/styles.css +3072 -182
- package/dist/tokens/index.d.ts +6390 -4745
- package/dist/tokens/index.js +6390 -4745
- package/dist/tokens/index.js.map +1 -1
- package/dist/{tr-B218zMtu.js → tr-C5IXRzAH.js} +45 -3
- package/dist/{tr-B218zMtu.js.map → tr-C5IXRzAH.js.map} +1 -1
- package/docs/accordion.md +9 -9
- package/docs/actionsheet.md +2 -2
- package/docs/avatar.md +5 -5
- package/docs/badge.md +6 -6
- package/docs/bottomsheet.md +4 -4
- package/docs/breadcrumb.md +3 -3
- package/docs/button.md +8 -8
- package/docs/buttongroup.md +5 -5
- package/docs/calendar.md +6 -6
- package/docs/card.md +6 -6
- package/docs/checkbox.md +7 -7
- package/docs/chip.md +5 -5
- package/docs/colorbox.md +3 -3
- package/docs/combobox.md +7 -7
- package/docs/control.md +12 -12
- package/docs/datagrid-api.md +5 -5
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +2 -2
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +2 -2
- package/docs/datagrid-filtering.md +3 -3
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +1 -1
- package/docs/datagrid-layout.md +4 -4
- package/docs/datagrid-lookups.md +1 -1
- package/docs/datagrid-master-detail.md +3 -3
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +3 -3
- package/docs/datagrid.md +8 -8
- package/docs/datebox.md +6 -6
- package/docs/daterangebox.md +4 -4
- package/docs/draggable.md +194 -0
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +8 -8
- package/docs/fileuploader.md +4 -4
- package/docs/filterbuilder.md +7 -7
- package/docs/formlayout.md +1 -1
- package/docs/gallery.md +244 -0
- package/docs/home.md +11 -7
- package/docs/keyboard.md +1 -1
- package/docs/language.md +1 -1
- package/docs/layout.md +13 -13
- package/docs/listbox.md +8 -8
- package/docs/loadpanel.md +4 -4
- package/docs/lookup.md +1 -1
- package/docs/menus.md +2 -2
- package/docs/multiview.md +202 -0
- package/docs/numberbox.md +7 -7
- package/docs/pagination.md +4 -4
- package/docs/popover.md +11 -11
- package/docs/progress.md +7 -7
- package/docs/radiogroup.md +7 -7
- package/docs/rating.md +4 -4
- package/docs/resizable.md +139 -0
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +5 -5
- 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 +2 -2
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +4 -4
- package/docs/scrollview.md +5 -5
- package/docs/showcase.md +1 -1
- package/docs/skeleton.md +2 -2
- package/docs/slider.md +7 -7
- package/docs/sortable.md +2 -2
- package/docs/speeddial.md +290 -0
- package/docs/splitter.md +204 -0
- package/docs/stepper.md +5 -5
- package/docs/switch.md +7 -7
- package/docs/tabdocs-dock.md +3 -3
- 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 +5 -5
- package/docs/tabs.md +9 -9
- package/docs/tagbox.md +8 -8
- package/docs/textarea.md +7 -7
- package/docs/textbox.md +8 -8
- package/docs/tileview.md +206 -0
- package/docs/timeline.md +174 -0
- package/docs/toast.md +5 -5
- package/docs/tokens.md +333 -4
- package/docs/toolbar.md +6 -6
- package/docs/tooltip.md +12 -12
- package/docs/treeview.md +9 -9
- package/docs/validationsummary.md +115 -0
- package/docs/window.md +5 -5
- package/docs/wizard.md +9 -9
- package/llms-full.txt +2525 -379
- package/llms.txt +13 -4
- package/package.json +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# MultiView
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
Pages side by side, one in sight: a swipe or a drag brings the next one, and so do `next()`, `previous()` and `goTo()`, or a [Tabs](tabs.md), a [Stepper](stepper.md) or buttons bound to the same value. The panels of a tab strip without the strip.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { MultiView, View } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Pages driven by a stepper
|
|
14
|
+
|
|
15
|
+
The `View` children are the pages; the one in sight is `value` (a view’s `key`, else its index), `x-model` binds it two-way. Here a `Stepper` shares the value: a press on a step and a swipe on a page move both. A page is built when first in sight (`lazy`).
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { CheckBox, MultiView, Stack, Stepper, TextBox, View } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** A stepper and a multi-view bound to the same value: a press on a step or a swipe on a page moves both. */
|
|
22
|
+
export default function Pages() {
|
|
23
|
+
const s = reactive({ page: 0 as string | number | null });
|
|
24
|
+
return (
|
|
25
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
26
|
+
<Stepper class="mv-steps" label="Order" linear={false} items={['Address', 'Delivery', 'Payment']} x-model={() => s.page} />
|
|
27
|
+
<MultiView class="mv-order" label="Order" x-model={() => s.page}>
|
|
28
|
+
<View title="Address">
|
|
29
|
+
<Stack gap="sm">
|
|
30
|
+
<TextBox label="Street" />
|
|
31
|
+
<TextBox label="Town" />
|
|
32
|
+
</Stack>
|
|
33
|
+
</View>
|
|
34
|
+
<View title="Delivery">
|
|
35
|
+
<Stack gap="sm">
|
|
36
|
+
<CheckBox text="Leave it at the door" />
|
|
37
|
+
<CheckBox text="Send a message before" />
|
|
38
|
+
</Stack>
|
|
39
|
+
</View>
|
|
40
|
+
<View title="Payment">
|
|
41
|
+
<Stack gap="sm">
|
|
42
|
+
<TextBox label="Card number" />
|
|
43
|
+
<TextBox label="Name on the card" />
|
|
44
|
+
</Stack>
|
|
45
|
+
</View>
|
|
46
|
+
</MultiView>
|
|
47
|
+
<output class="mv-order-page">{() => `page: ${s.page}`}</output>
|
|
48
|
+
</Stack>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Built when first in sight, kept or not
|
|
54
|
+
|
|
55
|
+
`lazy` (the default) builds a view when it first comes into sight and keeps it; `keepAlive={false}` disposes what a view’s `content` made while it is out of sight, and makes it again the next time. The JSX children stay either way, as in `Tabs`.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { reactive } from '@motifx/core';
|
|
59
|
+
import { Button, MultiView, Stack, View } from '@motifx-community/ui';
|
|
60
|
+
|
|
61
|
+
/** Each page is made when first in sight; with `keepAlive` off, what `content` made is dropped out of sight and made again. */
|
|
62
|
+
export default function Lazy() {
|
|
63
|
+
const s = reactive({ made: 0, keep: true });
|
|
64
|
+
let views!: MultiView;
|
|
65
|
+
const report = (name: string) => () => {
|
|
66
|
+
s.made++;
|
|
67
|
+
return <p class="mv-lazy-page">{`${name}, made as number ${s.made}`}</p>;
|
|
68
|
+
};
|
|
69
|
+
return (
|
|
70
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
71
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
72
|
+
<Button text="Previous" variant="outline" onclick={() => void views.previous()} />
|
|
73
|
+
<Button text="Next" variant="outline" onclick={() => void views.next()} />
|
|
74
|
+
<Button text="Keep alive" variant="outline" toggle x-model={() => s.keep} />
|
|
75
|
+
<output class="mv-lazy-made">{() => `made ${s.made} times`}</output>
|
|
76
|
+
</Stack>
|
|
77
|
+
<MultiView ref={(m: MultiView) => (views = m)} class="mv-lazy" label="Reports" keepAlive={() => s.keep}>
|
|
78
|
+
<View title="Sales" content={report('Sales')} />
|
|
79
|
+
<View title="Stock" content={report('Stock')} />
|
|
80
|
+
<View title="Staff" content={report('Staff')} />
|
|
81
|
+
</MultiView>
|
|
82
|
+
</Stack>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Programmatic use
|
|
88
|
+
|
|
89
|
+
Made with `new`, views added with `add()` and `insert()`, removed with `remove()`; `loop` goes around the ends, `animated={false}` shows the next view at once.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { reactive } from '@motifx/core';
|
|
93
|
+
import { Button, MultiView, Stack, View } from '@motifx-community/ui';
|
|
94
|
+
|
|
95
|
+
/** A multi-view made programmatically around the ends: views added, inserted and removed, the sight moved with its methods. */
|
|
96
|
+
export default function Programmatic() {
|
|
97
|
+
const s = reactive({ told: '', count: 0 });
|
|
98
|
+
let number = 0;
|
|
99
|
+
const page = () => {
|
|
100
|
+
number++;
|
|
101
|
+
const n = number;
|
|
102
|
+
return new View({ title: `Note ${n}`, content: () => <p class="mv-coded-note">{`Note ${n}`}</p> });
|
|
103
|
+
};
|
|
104
|
+
const coded = new MultiView({
|
|
105
|
+
label: 'Notes',
|
|
106
|
+
loop: true,
|
|
107
|
+
onSelectionChanged: e => (s.told = `in sight: ${e.view?.title ?? 'none'}${e.byUser ? ', by a swipe' : ''}`)
|
|
108
|
+
});
|
|
109
|
+
const count = () => (s.count = coded.count);
|
|
110
|
+
coded.add(page());
|
|
111
|
+
coded.add(page());
|
|
112
|
+
count();
|
|
113
|
+
return (
|
|
114
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
115
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
116
|
+
<Button text="Previous" variant="outline" onclick={() => void coded.previous()} />
|
|
117
|
+
<Button text="Next" variant="outline" onclick={() => void coded.next()} />
|
|
118
|
+
<Button
|
|
119
|
+
text="Add a note"
|
|
120
|
+
variant="outline"
|
|
121
|
+
onclick={() => {
|
|
122
|
+
void coded.goTo(coded.add(page()));
|
|
123
|
+
count();
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
<Button
|
|
127
|
+
text="Remove this note"
|
|
128
|
+
variant="outline"
|
|
129
|
+
enabled={() => s.count > 1}
|
|
130
|
+
onclick={() => {
|
|
131
|
+
if (coded.selectedView) coded.remove(coded.selectedView);
|
|
132
|
+
count();
|
|
133
|
+
}}
|
|
134
|
+
/>
|
|
135
|
+
<output class="mv-coded-told">{() => `${s.count} notes${s.told ? `, ${s.told}` : ''}`}</output>
|
|
136
|
+
</Stack>
|
|
137
|
+
<span class="mv-coded" onConfig={c => c.controls.add(coded)} />
|
|
138
|
+
</Stack>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Accessibility
|
|
144
|
+
|
|
145
|
+
| Topic | How |
|
|
146
|
+
| --- | --- |
|
|
147
|
+
| `Group` | A `group` named “Pages” in the kit language; several on one page: give each its own `label`. |
|
|
148
|
+
| `A view` | A `group` named by its `title`, else “Page 2 of 3”; the views out of sight are hidden from readers and from the keys (`inert`), so Tab moves only inside the view in sight. |
|
|
149
|
+
| `Moving` | A swipe needs a finger or a mouse: give the keys a way too, a `Tabs`, a `Stepper` or buttons bound to the same `value`, as the examples do. |
|
|
150
|
+
|
|
151
|
+
## Styling
|
|
152
|
+
|
|
153
|
+
| Hook | What it is |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| `.mx-multi-view` | The multi-view. `data-swipe` when a drag moves it, `data-dragging` while one does, `data-still` with `animated` off. |
|
|
156
|
+
| `.mx-multi-view__viewport, .mx-multi-view__track` | The frame that clips the views and the track that slides in it (`data-dragging`, `data-no-motion`). |
|
|
157
|
+
| `.mx-multi-view__view` | A view (`aria-hidden`, `inert` out of sight). |
|
|
158
|
+
|
|
159
|
+
### Component tokens
|
|
160
|
+
|
|
161
|
+
| Token | What it sets |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| `multi-view.frame, .view` | Units: the frame (`swipeable`, `dragging`) and a view. |
|
|
164
|
+
| `multi-view.gap` | Between the views, seen while a finger drags them. |
|
|
165
|
+
|
|
166
|
+
## API reference
|
|
167
|
+
|
|
168
|
+
### MultiView props
|
|
169
|
+
|
|
170
|
+
| Prop | Type | Default | Description |
|
|
171
|
+
| --- | --- | --- | --- |
|
|
172
|
+
| `value` | `Bind<string \| number \| null>` | `0` | The view in sight: its `key`, else its index. `x-model` binds it two-way. |
|
|
173
|
+
| `loop` | `Bind<boolean>` | `false` | After the last view comes the first; the move goes around the ends, not back across the views between. |
|
|
174
|
+
| `swipeEnabled` | `Bind<boolean>` | `true` | A finger or a pointer drags the views; a drag far or fast enough lands on the next one. |
|
|
175
|
+
| `animated` | `Bind<boolean>` | `true` | The views slide into sight. `false` shows the next one at once. |
|
|
176
|
+
| `lazy` | `Bind<boolean>` | `true` | A view is built when first in sight, then kept (a view’s own `lazy` wins). |
|
|
177
|
+
| `keepAlive` | `Bind<boolean>` | `true` | `false` disposes what a view’s `content` made while the view is out of sight (a view’s own `keepAlive` wins). |
|
|
178
|
+
| `label` | `Bind<string>` | the kit’s “Pages” | What screen readers call it. |
|
|
179
|
+
|
|
180
|
+
### View props
|
|
181
|
+
|
|
182
|
+
| Prop | Type | Default | Description |
|
|
183
|
+
| --- | --- | --- | --- |
|
|
184
|
+
| `title` | `Bind<string>` | “Page 2 of 3” | What screen readers call the view. |
|
|
185
|
+
| `key` | `Bind<string>` | `''` | Names the view in `value`; the JSX `key` is read too. |
|
|
186
|
+
| `content` | `() => ComponentBase \| ComponentBase[]` | — | Content made when the view is first in sight, besides the JSX children. |
|
|
187
|
+
| `lazy, keepAlive` | `Bind<boolean \| undefined>` | `undefined` | The view’s own settings; `undefined` follows the multi-view. |
|
|
188
|
+
| `visible, enabled` | `Bind<boolean>` | `true` | A hidden view takes no room and is skipped; a disabled one is skipped by `next()` and `previous()` and refused by `goTo()`. |
|
|
189
|
+
|
|
190
|
+
### Events, properties and methods
|
|
191
|
+
|
|
192
|
+
| Member | Kind | Description |
|
|
193
|
+
| --- | --- | --- |
|
|
194
|
+
| `onSelecting` | event | The view in sight is about to change (`from`, `to`, `fromView`, `toView`, `byUser`); `cancel = true` keeps the one there. |
|
|
195
|
+
| `onSelectionChanged` | event | The view in sight changed (`index`, `view`, `previous`, `byUser`: by a swipe, else programmatically). |
|
|
196
|
+
| `views` | read-only | The views in order, hidden ones too. |
|
|
197
|
+
| `selectedView, selectedIndex` | read-only | The view in sight and its index; `null` and -1 when there is none. |
|
|
198
|
+
| `count` | read-only | How many views there are. |
|
|
199
|
+
| `next(), previous()` | `Promise<boolean>` | Goes to the next or the previous view that is shown and enabled; `false` at an end without `loop`, or when refused. |
|
|
200
|
+
| `goTo(view)` | `Promise<boolean>` | Goes to a view, by index, key or the `View` itself; `onSelecting` is asked first. A view’s own `select()` does the same. |
|
|
201
|
+
| `add(view), insert(index, view)` | `View` | Adds a view at the end or at an index; one from another multi-view moves here. |
|
|
202
|
+
| `remove(view)` | `boolean` | Removes a view and disposes it; the sight moves to a neighbour. |
|
package/docs/numberbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NumberBox
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A number field: arrow keys, PageUp / PageDown and spin buttons that repeat while held, bounds, a step without float noise, a format for display (currency, percent) and typing in the locale’s own way.
|
|
6
6
|
|
|
@@ -10,9 +10,9 @@ A number field: arrow keys, PageUp / PageDown and spin buttons that repeat while
|
|
|
10
10
|
import { NumberBox, type NumberBoxProps } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
`x-model` binds a number (`null` when empty). Created with `new`, the same properties are set
|
|
15
|
+
`x-model` binds a number (`null` when empty). Created with `new`, the same properties are set programmatically.
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
@@ -20,13 +20,13 @@ import { Button, NumberBox, Stack } from '@motifx-community/ui';
|
|
|
20
20
|
|
|
21
21
|
const show = (value: number | null) => (value === null ? 'null' : String(value));
|
|
22
22
|
|
|
23
|
-
/** A field bound to a number with x-model, and fields created with `new` and stepped
|
|
24
|
-
export default function
|
|
23
|
+
/** A field bound to a number with x-model, and fields created with `new` and stepped programmatically. */
|
|
24
|
+
export default function Programmatic() {
|
|
25
25
|
const s = reactive({ quantity: 3 as number | null, log: '' });
|
|
26
26
|
let added = 0;
|
|
27
27
|
let host: Stack | null = null;
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const addProgrammatic = () => {
|
|
30
30
|
const box = new NumberBox({ label: `Count ${++added}`, min: 0, max: 10, value: 5, locale: 'en' });
|
|
31
31
|
box.onValueChanged((e) => (s.log = `${box.label}: ${show(e.value)}`));
|
|
32
32
|
host?.controls.add(box);
|
|
@@ -41,7 +41,7 @@ export default function FromCode() {
|
|
|
41
41
|
<output class="nb-quantity">{() => `value: ${show(s.quantity)}`}</output>
|
|
42
42
|
</Stack>
|
|
43
43
|
<Stack orientation="horizontal" wrap align="center">
|
|
44
|
-
<Button text="Add a field
|
|
44
|
+
<Button text="Add a field programmatically" variant="outline" onclick={addProgrammatic} />
|
|
45
45
|
<output class="nb-log">{() => s.log}</output>
|
|
46
46
|
</Stack>
|
|
47
47
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
package/docs/pagination.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pagination
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
Moving through pages of items: the sizes to choose from, where the page stands, the steps and a button per page around the current one. It turns compact when it does not fit. It looks and works as the grid’s pager.
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ Moving through pages of items: the sizes to choose from, where the page stands,
|
|
|
10
10
|
import { Pagination } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
15
|
`x-model` binds the page; `onPageChanged` tells the page size too, so the data can be loaded for both.
|
|
16
16
|
|
|
@@ -18,8 +18,8 @@ import { Pagination } from '@motifx-community/ui';
|
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Pagination, Stack } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** The page bound with `x-model`, the sizes to choose from; one made with `new`
|
|
22
|
-
export default function
|
|
21
|
+
/** The page bound with `x-model`, the sizes to choose from; one made with `new` programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ page: 3, size: 25 });
|
|
24
24
|
const coded = new Pagination({ label: 'Pages made in code', total: 40, pageSize: 10, mode: 'full', showInfo: false });
|
|
25
25
|
|
package/docs/popover.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Popover
|
|
2
2
|
|
|
3
|
-
> Feedback · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Feedback · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
Content next to the element it belongs to: a title, a close button, a form, a card. It opens on a press or while the pointer rests on its target, follows it, and points at it with an arrow where the design language has one.
|
|
6
6
|
|
|
@@ -10,20 +10,20 @@ Content next to the element it belongs to: a title, a close button, a form, a ca
|
|
|
10
10
|
import { Popover } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
The JSX children are the content; `target` names the element or component it opens next to.
|
|
15
|
+
The JSX children are the content; `target` names the element or component it opens next to. Programmatically, `content` gives the content and `open()`, `close()` and `toggle()` move it; `value` and `x-model` say whether it is open.
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Button, Popover, Stack, TextBox } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A popover with a title, a close button and a small form; one made
|
|
21
|
+
/** A popover with a title, a close button and a small form; one made programmatically for a plain element. */
|
|
22
22
|
export default function Basic() {
|
|
23
23
|
const s = reactive({ open: false, name: 'Ada', saved: '' });
|
|
24
24
|
let button!: Button;
|
|
25
25
|
let link!: HTMLElement;
|
|
26
|
-
const coded = new Popover({ title: '
|
|
26
|
+
const coded = new Popover({ title: 'Programmatically', content: new Button({ text: 'OK', variant: 'outline', onclick: () => coded.close() }) });
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<Stack orientation="horizontal" wrap align="center">
|
|
@@ -45,7 +45,7 @@ export default function Basic() {
|
|
|
45
45
|
coded.toggle();
|
|
46
46
|
}}
|
|
47
47
|
>
|
|
48
|
-
A popover
|
|
48
|
+
A popover programmatically
|
|
49
49
|
</a>
|
|
50
50
|
</Stack>
|
|
51
51
|
);
|
|
@@ -157,11 +157,11 @@ export default function Events() {
|
|
|
157
157
|
|
|
158
158
|
| Topic | How |
|
|
159
159
|
| --- | --- |
|
|
160
|
-
| `Opening` | By a press on the target, by the pointer resting on it (`hover`), or
|
|
161
|
-
| `Focus` | Opened by a press or
|
|
160
|
+
| `Opening` | By a press on the target, by the pointer resting on it (`hover`), or programmatically. It appears in the browser’s top layer, next to the target, and follows it while the page scrolls. |
|
|
161
|
+
| `Focus` | Opened by a press or programmatically, focus moves to the first focusable part inside, else to the popover; it goes back to the target when the popover closes. Opened by hover, focus stays where it is. |
|
|
162
162
|
| `Closing` | Escape, a press outside it and its target, focus leaving both (Tab out), the close button, the target pressed again, or the pointer leaving both (`hover`). `onClosing` may keep it open. |
|
|
163
163
|
| `Placement` | `placement` names the side and the alignment, as for the kit’s popups; without room on that side it opens on the other. |
|
|
164
|
-
| `Where it lives` | Made
|
|
164
|
+
| `Where it lives` | Made programmatically, it goes into the nearest container of its target that can hold it, so it stays in the target’s window and landmark. |
|
|
165
165
|
|
|
166
166
|
## Accessibility
|
|
167
167
|
|
|
@@ -198,7 +198,7 @@ export default function Events() {
|
|
|
198
198
|
| `target` | `Bind<Element \| ComponentBase \| null>` | `null` | The element or component it opens next to. |
|
|
199
199
|
| `title` | `Bind<string>` | `''` | A title in the header. The same property as `text`. |
|
|
200
200
|
| `label` | `Bind<string>` | `''` | What screen readers call it when it has no title. |
|
|
201
|
-
| `content` | `Bind<ComponentBase \| null>` | `null` | Content
|
|
201
|
+
| `content` | `Bind<ComponentBase \| null>` | `null` | Content programmatically, after the JSX children. |
|
|
202
202
|
| `showOn` | `Bind<PopoverShowOn>` | `'click'` | `click`: a press on the target toggles it; `hover`: the pointer resting on the target, or keyboard focus on it; `manual`: only code. |
|
|
203
203
|
| `placement` | `Bind<PopupPlacement>` | `'bottom'` | The side and the alignment; it opens on the other side when there is no room. |
|
|
204
204
|
| `arrow` | `Bind<boolean>` | `true` | An arrow towards the target, where the design language draws one. |
|
|
@@ -215,7 +215,7 @@ export default function Events() {
|
|
|
215
215
|
| `onOpened` | event | It opened. |
|
|
216
216
|
| `onClosing` | event | About to close (`reason`); `cancel = true` keeps it open. |
|
|
217
217
|
| `onClosed` | event | It closed, with the reason: `escape`, `outside`, `focus`, `toggle`, `hover`, `close-button`, `code`. |
|
|
218
|
-
| `open(), close(reason?), toggle()` | `boolean` / `void` |
|
|
218
|
+
| `open(), close(reason?), toggle()` | `boolean` / `void` | Programmatically; `open()` is `false` without a target on the page or when disabled. |
|
|
219
219
|
| `place()` | `void` | Lines it up with its target again, after its content changed size. |
|
|
220
220
|
| `isOpen` | read-only | Whether it is open now. |
|
|
221
221
|
| `closeButton, body` | read-only | The close button (the kit’s) and the part that holds the content. |
|
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.
|
|
3
|
+
> Feedback · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
ProgressBar shows how far some work is, as a line or a circle, or that it runs when that is not known. Spinner says "busy, wait": a turning ring, alone or over a panel while it loads, shown only after a delay so quick work does not flash it.
|
|
6
6
|
|
|
@@ -10,16 +10,16 @@ ProgressBar shows how far some work is, as a line or a circle, or that it runs w
|
|
|
10
10
|
import { ProgressBar, Spinner, type ProgressTone } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
Every prop takes a value or a function; a function of a reactive object keeps the bar in step with the work. Created with `new`, the same properties are set
|
|
15
|
+
Every prop takes a value or a function; a function of a reactive object keeps the bar in step with the work. Created with `new`, the same properties are set programmatically.
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Button, ProgressBar, Stack } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A bar that follows an upload, and bars created with `new` and added
|
|
22
|
-
export default function
|
|
21
|
+
/** A bar that follows an upload, and bars created with `new` and added programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ upload: 0, uploading: false });
|
|
24
24
|
let added = 0;
|
|
25
25
|
let host: Stack | null = null;
|
|
@@ -36,7 +36,7 @@ export default function FromCode() {
|
|
|
36
36
|
}, 120);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const addProgrammatic = () => {
|
|
40
40
|
const bar = new ProgressBar({ label: `Task ${++added}`, showValue: true, tone: 'success' });
|
|
41
41
|
bar.value = 25 * added;
|
|
42
42
|
host?.controls.add(bar);
|
|
@@ -47,7 +47,7 @@ export default function FromCode() {
|
|
|
47
47
|
<ProgressBar label="Uploading" value={() => s.upload} showValue stretch />
|
|
48
48
|
<Stack orientation="horizontal" wrap align="center">
|
|
49
49
|
<Button text="Upload" tone="accent" enabled={() => !s.uploading} onclick={upload} />
|
|
50
|
-
<Button text="Add a bar
|
|
50
|
+
<Button text="Add a bar programmatically" variant="outline" onclick={addProgrammatic} />
|
|
51
51
|
</Stack>
|
|
52
52
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
|
53
53
|
</>
|
package/docs/radiogroup.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RadioGroup
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A set of options of which one is chosen: from plain values, from your own objects or from a live list; one under the other, side by side or in columns; options that are disabled, hidden or carry a help line; one Tab stop and the arrow keys.
|
|
6
6
|
|
|
@@ -10,20 +10,20 @@ A set of options of which one is chosen: from plain values, from your own object
|
|
|
10
10
|
import { RadioGroup, type RadioItem } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
A plain value is its own text. `x-model` binds the chosen value two-way. Created with `new`, the same properties are set
|
|
15
|
+
A plain value is its own text. `x-model` binds the chosen value two-way. Created with `new`, the same properties are set programmatically.
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Button, RadioGroup, Stack } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A group of plain values bound with x-model, and a group created with `new` and added
|
|
22
|
-
export default function
|
|
21
|
+
/** A group of plain values bound with x-model, and a group created with `new` and added programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ size: 'M' as string | null, result: '' });
|
|
24
24
|
let host: Stack | null = null;
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const addProgrammatic = () => {
|
|
27
27
|
const wrap = new RadioGroup<string>({ label: 'Gift wrap', orientation: 'horizontal', items: ['None', 'Paper', 'Box'], value: 'None' });
|
|
28
28
|
wrap.onValueChanged((e) => (s.result = `Gift wrap: ${e.value}`));
|
|
29
29
|
host?.controls.add(wrap);
|
|
@@ -34,7 +34,7 @@ export default function FromCode() {
|
|
|
34
34
|
<>
|
|
35
35
|
<RadioGroup label="&Size" items={['S', 'M', 'L', 'XL']} x-model={() => s.size} helpText={() => `Chosen: ${s.size ?? 'nothing'}`} />
|
|
36
36
|
<Stack orientation="horizontal" wrap align="center">
|
|
37
|
-
<Button text="Add a group
|
|
37
|
+
<Button text="Add a group programmatically" variant="outline" onclick={addProgrammatic} />
|
|
38
38
|
<output class="rg-result">{() => s.result}</output>
|
|
39
39
|
</Stack>
|
|
40
40
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
package/docs/rating.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rating
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A row of stars to give a score or to show one, whole or by halves. It is a field: label, help text, rules and `x-model` work as in every field.
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ A row of stars to give a score or to show one, whole or by halves. It is a field
|
|
|
10
10
|
import { Rating } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
15
|
Every prop takes a value or a function; `x-model` binds the score two-way. Under the pointer the stars show what a press would give.
|
|
16
16
|
|
|
@@ -18,8 +18,8 @@ Every prop takes a value or a function; `x-model` binds the score two-way. Under
|
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Rating, Stack } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A rating bound with `x-model`, with a label and a help line like any field; one made with `new`
|
|
22
|
-
export default function
|
|
21
|
+
/** A rating bound with `x-model`, with a label and a help line like any field; one made with `new` programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ stars: 3 as number | null });
|
|
24
24
|
const coded = new Rating({ label: 'Made in code', max: 10, value: 7 });
|
|
25
25
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Resizable
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
A box the user resizes from its sides and corners with the pointer, or with the arrow keys on the grip in its end corner. It keeps to its least and most sizes, stays inside an area when told, and can keep its shape.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Resizable } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Sides, corners and the grip
|
|
14
|
+
|
|
15
|
+
The JSX children are the content. `handles` says which sides and corners take the pointer (`all` by default); the grip in the end corner is the Tab stop, and the arrow keys change the size by `step`. `minWidth`, `minHeight`, `maxWidth` and `maxHeight` hold it. A box laid out by its position (`absolute`, `fixed`) also moves when a start or top side is dragged, so the far side stays; one in the flow only changes size.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { Panel, Resizable, Stack } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** A box resized from any side or corner, never under 160 × 80 or over 480 × 240; the grip in the corner takes the keys. */
|
|
22
|
+
export default function Basic() {
|
|
23
|
+
const s = reactive({ told: '' });
|
|
24
|
+
return (
|
|
25
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
26
|
+
<Resizable class="rs-box" width={280} height={140} minWidth={160} minHeight={80} maxWidth={480} maxHeight={240} onResized={e => (s.told = `${e.width} × ${e.height}, from the ${e.edge}`)}>
|
|
27
|
+
<Panel padding="md" variant="outline" text="A note" style="block-size: 100%">
|
|
28
|
+
<p class="rs-note">Drag a side or a corner, or focus the grip and use the arrow keys.</p>
|
|
29
|
+
</Panel>
|
|
30
|
+
</Resizable>
|
|
31
|
+
<output class="rs-box-told">{() => s.told}</output>
|
|
32
|
+
</Stack>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Inside an area, keeping its shape
|
|
38
|
+
|
|
39
|
+
`area` keeps the box inside its parent, or inside an element given; `keepAspectRatio` changes the other side along. Here only the end side, the bottom and the corner between them resize the picture.
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { Resizable } from '@motifx-community/ui';
|
|
43
|
+
import { scene } from '../../gallery/examples/scenes';
|
|
44
|
+
|
|
45
|
+
/** A picture that keeps its shape and stays inside the dashed area; only the end side, the bottom and the corner resize it. */
|
|
46
|
+
export default function Area() {
|
|
47
|
+
return (
|
|
48
|
+
<div class="rs-area" style="position: relative; inline-size: 100%; block-size: 260px; outline: 2px dashed var(--mx-color-stroke-control-strong); outline-offset: -2px">
|
|
49
|
+
<Resizable class="rs-picture" width={240} height={135} minWidth={120} minHeight={68} area="parent" keepAspectRatio handles={['end', 'bottom', 'bottom-end']} style="position: absolute; left: 16px; top: 16px">
|
|
50
|
+
<img src={scene(200)} alt="A harbour at dawn" style="display: block; inline-size: 100%; block-size: 100%; object-fit: cover" />
|
|
51
|
+
</Resizable>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Programmatic use
|
|
58
|
+
|
|
59
|
+
`size` gives the size in pixels and `x-model` takes it back after every resize (`onResized` tells too): a layout kept and restored, or set by a button.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { reactive } from '@motifx/core';
|
|
63
|
+
import { Button, Panel, Resizable, Stack } from '@motifx-community/ui';
|
|
64
|
+
|
|
65
|
+
/** The size goes out to x-model after every resize and comes back: set, kept and restored programmatically. */
|
|
66
|
+
export default function Programmatic() {
|
|
67
|
+
const s = reactive({ size: { width: 240, height: 120 } as { width: number; height: number } | null, kept: null as { width: number; height: number } | null });
|
|
68
|
+
return (
|
|
69
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
70
|
+
<Resizable class="rs-coded" minWidth={120} minHeight={60} x-model={() => s.size}>
|
|
71
|
+
<Panel padding="md" variant="outline" style="block-size: 100%">
|
|
72
|
+
<p class="rs-note">Sized by the model.</p>
|
|
73
|
+
</Panel>
|
|
74
|
+
</Resizable>
|
|
75
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
76
|
+
<Button text="Wider" variant="outline" onclick={() => (s.size = { width: (s.size?.width ?? 240) + 40, height: s.size?.height ?? 120 })} />
|
|
77
|
+
<Button text="Keep this size" variant="outline" onclick={() => (s.kept = s.size ? { ...s.size } : null)} />
|
|
78
|
+
<Button text="Restore it" variant="outline" enabled={() => !!s.kept} onclick={() => (s.size = s.kept ? { ...s.kept } : null)} />
|
|
79
|
+
<output class="rs-coded-told">{() => `size: ${JSON.stringify(s.size)}`}</output>
|
|
80
|
+
</Stack>
|
|
81
|
+
</Stack>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Keyboard
|
|
87
|
+
|
|
88
|
+
| Key | What it does |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `Tab` | The grip in the end corner is the one stop. |
|
|
91
|
+
| `Arrow keys` | On the grip: Left and Right change the width by `step` (the other way round in a right-to-left page), Up and Down the height; within the limits, the area and the ratio. |
|
|
92
|
+
|
|
93
|
+
## Accessibility
|
|
94
|
+
|
|
95
|
+
| Topic | How |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `The grip` | A button named “Resize” in the kit language; the new size is read out after every change (“Width 320, height 200”). |
|
|
98
|
+
| `The handles` | Strips along the sides and corners for the pointer only, hidden from readers; the grip gives the keys the same. |
|
|
99
|
+
| `Content` | The JSX children are the content, untouched: a panel, a picture, a form. |
|
|
100
|
+
|
|
101
|
+
## Styling
|
|
102
|
+
|
|
103
|
+
| Hook | What it is |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `.mx-resizable` | The box. `data-resizing` and `data-edge` while a handle is dragged; `data-disabled`. |
|
|
106
|
+
| `.mx-resizable__frame, .mx-resizable__handle` | The frame over the box and its eight handles (`data-edge`, `data-active` while dragged, `hidden` when not asked for). |
|
|
107
|
+
| `.mx-resizable__grip, .mx-resizable__grip-glyph` | The grip in the end corner and its glyph. |
|
|
108
|
+
|
|
109
|
+
### Component tokens
|
|
110
|
+
|
|
111
|
+
| Token | What it sets |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `resizable.box, .handle, .grip, .grip-glyph` | Units: the box (`resizing`), a handle (`hover`, `active`, `corner`), the grip (`hover`, `pressed`, `focus`) and its glyph (`icon`). |
|
|
114
|
+
| `resizable.edge` | How wide a strip along a side takes the pointer; a corner takes twice that each way. |
|
|
115
|
+
|
|
116
|
+
## API reference
|
|
117
|
+
|
|
118
|
+
### Props
|
|
119
|
+
|
|
120
|
+
| Prop | Type | Default | Description |
|
|
121
|
+
| --- | --- | --- | --- |
|
|
122
|
+
| `handles` | `Bind<ResizeHandles>` | `'all'` | `all`, `edges`, `corners`, or a list of `top`, `bottom`, `start`, `end`, `top-start`, `top-end`, `bottom-start`, `bottom-end`. |
|
|
123
|
+
| `minWidth, minHeight` | `Bind<number>` | `30` | The least width and height, in pixels. |
|
|
124
|
+
| `maxWidth, maxHeight` | `Bind<number \| null>` | `null` | The most width and height, in pixels; `null` for no limit. |
|
|
125
|
+
| `area` | `Bind<'parent' \| HTMLElement \| null>` | `null` | The box stays inside this: its parent, or an element it lies in. |
|
|
126
|
+
| `keepAspectRatio` | `Bind<boolean>` | `false` | The width and the height keep their ratio. |
|
|
127
|
+
| `step` | `Bind<number>` | `10` | Pixels an arrow key changes a side by. |
|
|
128
|
+
| `width, height` | `Bind<number \| string \| null>` | `null` | The size to start with, a CSS length or pixels; without one the content decides. |
|
|
129
|
+
| `size` | `Bind<ResizeSize \| null>` | `null` | The size in pixels: given, it is applied; after every resize the new one is written to `x-model`. |
|
|
130
|
+
|
|
131
|
+
### Events, properties and methods
|
|
132
|
+
|
|
133
|
+
| Member | Kind | Description |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| `onResizeStarting` | event | A resize is about to begin from a handle (`edge`, `width`, `height`); `cancel = true` keeps the size. |
|
|
136
|
+
| `onResizing` | event | The box is being resized (`edge`, `width`, `height` so far). |
|
|
137
|
+
| `onResized` | event | A resize ended: the pointer let go, or a key moved a side. |
|
|
138
|
+
| `currentSize` | read-only | The size in pixels now. |
|
|
139
|
+
| `gripElement` | read-only | The grip in the end corner, the Tab stop that takes the keys. |
|
package/docs/scheduler-agenda.md
CHANGED