@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
package/docs/tileview.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# TileView
|
|
2
|
+
|
|
3
|
+
> Display · @motifx-community/ui 0.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
Tiles of different sizes packed on a grid of base cells: a tile is so many cells wide and tall. They fill the height in columns and scroll sideways, or fill the width in rows; they can be chosen, and put in another order by dragging.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { TileView } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Tiles on a grid
|
|
14
|
+
|
|
15
|
+
`baseItemWidth` and `baseItemHeight` are one cell; a tile’s `widthRatio` and `heightRatio` say how many it takes. Down the columns (`horizontal`, the default) the view needs a `height` and scrolls sideways; the tiles are packed so no cell stays empty where a later tile fits.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { TileView } from '@motifx-community/ui';
|
|
19
|
+
|
|
20
|
+
/** Tiles of one, two and four base cells packed down the columns; the view scrolls sideways when they do not fit. */
|
|
21
|
+
export default function Basic() {
|
|
22
|
+
return (
|
|
23
|
+
<TileView
|
|
24
|
+
class="tv-board"
|
|
25
|
+
label="Board"
|
|
26
|
+
height={330}
|
|
27
|
+
baseItemWidth={120}
|
|
28
|
+
baseItemHeight={100}
|
|
29
|
+
items={[
|
|
30
|
+
{ text: 'Sales today', widthRatio: 2 },
|
|
31
|
+
{ text: 'Orders' },
|
|
32
|
+
{ text: 'Returns' },
|
|
33
|
+
{ text: 'Visitors this week', widthRatio: 2, heightRatio: 2 },
|
|
34
|
+
{ text: 'Stock' },
|
|
35
|
+
{ text: 'Staff on duty', heightRatio: 2 },
|
|
36
|
+
{ text: 'Tickets' },
|
|
37
|
+
{ text: 'Deliveries', widthRatio: 2 },
|
|
38
|
+
{ text: 'Reviews' },
|
|
39
|
+
{ text: 'Costs' }
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Choosing tiles
|
|
47
|
+
|
|
48
|
+
`selectionMode` makes the tiles options: `single` keeps one, `multiple` any number (Ctrl and a press, or Space, adds and takes away). `value` is the chosen tile’s `key`, else its index, or a list of them; `x-model` binds it two-way. The arrow keys walk the grid by where the tiles lie.
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { reactive } from '@motifx/core';
|
|
52
|
+
import { Stack, TileView } from '@motifx-community/ui';
|
|
53
|
+
|
|
54
|
+
/** Tiles along the rows, any number of them chosen: a press, Ctrl and a press, Space; the keys walk the grid. */
|
|
55
|
+
export default function Selection() {
|
|
56
|
+
const s = reactive({ chosen: ['tea'] as string | number | null | readonly (string | number)[] });
|
|
57
|
+
return (
|
|
58
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
59
|
+
<TileView
|
|
60
|
+
class="tv-pick"
|
|
61
|
+
label="Snacks"
|
|
62
|
+
direction="vertical"
|
|
63
|
+
selectionMode="multiple"
|
|
64
|
+
baseItemWidth={110}
|
|
65
|
+
baseItemHeight={70}
|
|
66
|
+
x-model={() => s.chosen}
|
|
67
|
+
items={[
|
|
68
|
+
{ key: 'tea', text: 'Tea' },
|
|
69
|
+
{ key: 'coffee', text: 'Coffee' },
|
|
70
|
+
{ key: 'water', text: 'Water', enabled: false },
|
|
71
|
+
{ key: 'cake', text: 'Cake', widthRatio: 2 },
|
|
72
|
+
{ key: 'fruit', text: 'Fruit' },
|
|
73
|
+
{ key: 'nuts', text: 'Nuts' }
|
|
74
|
+
]}
|
|
75
|
+
/>
|
|
76
|
+
<output class="tv-pick-told">{() => `chosen: ${JSON.stringify(s.chosen)}`}</output>
|
|
77
|
+
</Stack>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Another order
|
|
83
|
+
|
|
84
|
+
With `allowReorder` a tile is dragged to its new place (a long press on a touch screen) or moved with Ctrl and an arrow key. The tile moves and `onReordered` tells the indexes: reorder your data there, as the example does, so the next draw agrees.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { reactive } from '@motifx/core';
|
|
88
|
+
import { Stack, TileView } from '@motifx-community/ui';
|
|
89
|
+
|
|
90
|
+
/** Drag a tile to another place, or move it with Ctrl and an arrow key; the data is reordered in `onReordered`. */
|
|
91
|
+
export default function Reorder() {
|
|
92
|
+
const s = reactive({ tiles: [{ text: 'Plan' }, { text: 'Design', widthRatio: 2 }, { text: 'Build' }, { text: 'Test' }, { text: 'Ship', heightRatio: 2 }, { text: 'Rest' }] });
|
|
93
|
+
return (
|
|
94
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
95
|
+
<TileView
|
|
96
|
+
class="tv-order"
|
|
97
|
+
label="Steps"
|
|
98
|
+
direction="vertical"
|
|
99
|
+
allowReorder
|
|
100
|
+
baseItemWidth={100}
|
|
101
|
+
baseItemHeight={70}
|
|
102
|
+
items={() => s.tiles}
|
|
103
|
+
onReordered={e => s.tiles.splice(e.toIndex, 0, ...s.tiles.splice(e.fromIndex, 1))}
|
|
104
|
+
/>
|
|
105
|
+
<output class="tv-order-told">{() => s.tiles.map(t => t.text).join(', ')}</output>
|
|
106
|
+
</Stack>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Any content
|
|
112
|
+
|
|
113
|
+
An item’s `content` makes the tile’s content when the tile is made; what is in it works as anywhere else, and a press on a button inside is that button’s. `onItemClick` tells a press on the tile itself.
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { reactive } from '@motifx/core';
|
|
117
|
+
import { Button, Stack, TileView } from '@motifx-community/ui';
|
|
118
|
+
|
|
119
|
+
const ROOMS = [
|
|
120
|
+
{ name: 'Kitchen', temp: 21 },
|
|
121
|
+
{ name: 'Lounge', temp: 23 },
|
|
122
|
+
{ name: 'Study', temp: 19 },
|
|
123
|
+
{ name: 'Bedroom', temp: 18 }
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
/** Any content on a tile: a room each, with its own button; a press on the tile itself is told too. */
|
|
127
|
+
export default function Content() {
|
|
128
|
+
const s = reactive({ told: '' });
|
|
129
|
+
const room = (r: (typeof ROOMS)[number]) => (
|
|
130
|
+
<Stack class="tv-room" gap="xs" justify="center" style="block-size: 100%">
|
|
131
|
+
<strong>{r.name}</strong>
|
|
132
|
+
<span class="tv-room-temp">{r.temp} °C</span>
|
|
133
|
+
<Button text="Warmer" variant="outline" size="sm" onclick={() => (s.told = `${r.name}: warmer`)} />
|
|
134
|
+
</Stack>
|
|
135
|
+
);
|
|
136
|
+
return (
|
|
137
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
138
|
+
<TileView class="tv-rooms" label="Rooms" direction="vertical" baseItemWidth={150} baseItemHeight={120} items={ROOMS.map(r => ({ key: r.name, content: () => room(r) }))} onItemClick={e => (s.told = `${(e.item as { key: string }).key} pressed`)} />
|
|
139
|
+
<output class="tv-rooms-told">{() => s.told}</output>
|
|
140
|
+
</Stack>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Keyboard
|
|
146
|
+
|
|
147
|
+
| Key | What it does |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| `Tab` | One stop: the tile focused last, else the first chosen, else the first. |
|
|
150
|
+
| `Arrow keys` | The nearest tile that way, by where the tiles lie; Home and End the first and the last. |
|
|
151
|
+
| `Space` | Chooses the tile (`single`), or chooses it or lets it go (`multiple`). |
|
|
152
|
+
| `Enter` | A press on the tile: `onItemClick`, and the choice as a press makes it. |
|
|
153
|
+
| `Ctrl + Arrow keys` | With `allowReorder`: moves the tile a place back or on; Ctrl + Home and End to the ends. The move is read out. |
|
|
154
|
+
|
|
155
|
+
## Accessibility
|
|
156
|
+
|
|
157
|
+
| Topic | How |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| `Roles` | A `list` of `listitem`s without selection; a `listbox` of `option`s with it (`aria-multiselectable` for `multiple`), each `aria-selected`. |
|
|
160
|
+
| `Disabled tiles` | `aria-disabled`, skipped by the keys, not chosen by a press. |
|
|
161
|
+
| `Dragging` | A copy of the tile follows the pointer; the tile where the drop would land is marked; Escape lets go. On a touch screen a long press lifts the tile. |
|
|
162
|
+
|
|
163
|
+
## Styling
|
|
164
|
+
|
|
165
|
+
| Hook | What it is |
|
|
166
|
+
| --- | --- |
|
|
167
|
+
| `.mx-tile-view` | The view. `data-direction`, `data-reorder`, `data-dragging` while a tile is dragged. |
|
|
168
|
+
| `.mx-tile-view__tile` | A tile. `aria-selected`, `aria-disabled`, `data-dragging` (left faint in its place), `data-drop="before\|after"` where the drop would land. |
|
|
169
|
+
| `.mx-tile-view__text, .mx-tile-view__ghost` | A tile’s text; the copy after the pointer. |
|
|
170
|
+
|
|
171
|
+
### Component tokens
|
|
172
|
+
|
|
173
|
+
| Token | What it sets |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| `tile-view.tile, .text, .ghost, .view` | Units: a tile (`hover`, `pressed`, `focus`, `selected`, `disabled`, `dragging`, `target`), its text, the copy after the pointer, the view. |
|
|
176
|
+
| `tile-view.gap` | Between the tiles. |
|
|
177
|
+
|
|
178
|
+
## API reference
|
|
179
|
+
|
|
180
|
+
### Props
|
|
181
|
+
|
|
182
|
+
| Prop | Type | Default | Description |
|
|
183
|
+
| --- | --- | --- | --- |
|
|
184
|
+
| `items` | `Bind<readonly (TileViewItem \| string)[]>` | `[]` | The tiles in order: `TileViewItem`s (`text`, `widthRatio`, `heightRatio`, `key`, `content`, `enabled`, `data`) or plain texts. |
|
|
185
|
+
| `baseItemWidth, baseItemHeight` | `Bind<number>` | `100` | A base cell in pixels; a tile is `widthRatio` × `heightRatio` of them. |
|
|
186
|
+
| `direction` | `Bind<TileViewDirection>` | `'horizontal'` | `horizontal`: the tiles fill the height in columns and the view scrolls sideways (give it a `height`); `vertical`: they fill the width in rows. |
|
|
187
|
+
| `selectionMode` | `Bind<TileViewSelectionMode>` | `'none'` | `none`, `single` or `multiple`. |
|
|
188
|
+
| `value` | `Bind<string \| number \| null \| (string \| number)[]>` | `null` | The chosen tile (`single`): its `key`, else its index; the chosen tiles (`multiple`) as a list. `x-model` binds it two-way. |
|
|
189
|
+
| `allowReorder` | `Bind<boolean>` | `false` | The tiles can be put in another order by dragging, or with Ctrl and an arrow key. |
|
|
190
|
+
| `height` | `Bind<string \| number \| null>` | `null` | A CSS length or pixels. |
|
|
191
|
+
| `label` | `Bind<string>` | the kit’s “Tiles” | What screen readers call it. |
|
|
192
|
+
|
|
193
|
+
### Events, properties and methods
|
|
194
|
+
|
|
195
|
+
| Member | Kind | Description |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| `onItemClick` | event | A press on a tile that was not a drag (`index`, `item`, `event`); Enter on a focused tile too. |
|
|
198
|
+
| `onSelectionChanged` | event | The chosen tiles changed (`indexes`, `items`, `byUser`). |
|
|
199
|
+
| `onReordering` | event | A tile is about to be dragged or moved with the keys (`fromIndex`, `toIndex`); `cancel = true` keeps it. |
|
|
200
|
+
| `onReordered` | event | A tile was dropped or moved to a new place (`item`, `fromIndex`, `toIndex`): your data is yours to reorder. |
|
|
201
|
+
| `selectedIndexes` | read-only | The chosen tiles’ indexes, in tile order. |
|
|
202
|
+
| `count` | read-only | How many tiles there are. |
|
|
203
|
+
| `isDragging` | read-only | A tile is being dragged. |
|
|
204
|
+
| `select(index)` | `void` | Chooses a tile programmatically: the only one (`single`), or one more (`multiple`). |
|
|
205
|
+
| `indexOf(value), valueAt(index)` | `number`, `string \| number` | Between a value (a key or an index) and a tile’s index. |
|
|
206
|
+
| `refresh()` | `void` | Reads the items again after they were changed in place. |
|
package/docs/timeline.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Timeline
|
|
2
|
+
|
|
3
|
+
> Display · @motifx-community/ui 0.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
Events in time order: down the page, each a card beside a line with a dot; or along a line of dates, where a press on a date shows that event’s card under the line. The dates are written in the kit’s language. For hours on a calendar, see the [Scheduler](scheduler.md).
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Timeline } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Down the page
|
|
14
|
+
|
|
15
|
+
`items` are the events: a `date`, a `title`, a `description`, a `tone` for the dot and a `glyph` in it. `alternate` puts the cards on either side of the line in turn; `collapsible` folds the descriptions until a card is pressed. `onItemClick` tells a press.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { Button, Stack, Timeline } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** A project down the page: a dot per event on the line, coloured by its tone; the cards take turns or fold when told. */
|
|
22
|
+
export default function Vertical() {
|
|
23
|
+
const s = reactive({ alternate: false, collapsible: false, told: '' });
|
|
24
|
+
return (
|
|
25
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
26
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
27
|
+
<Button text="Take turns" variant="outline" toggle x-model={() => s.alternate} />
|
|
28
|
+
<Button text="Fold the cards" variant="outline" toggle x-model={() => s.collapsible} />
|
|
29
|
+
<output class="tl-told">{() => s.told}</output>
|
|
30
|
+
</Stack>
|
|
31
|
+
<Timeline
|
|
32
|
+
class="tl-project"
|
|
33
|
+
label="The project"
|
|
34
|
+
alternate={() => s.alternate}
|
|
35
|
+
collapsible={() => s.collapsible}
|
|
36
|
+
onItemClick={e => (s.told = `pressed: ${(e.item as { title: string }).title}`)}
|
|
37
|
+
items={[
|
|
38
|
+
{ date: '2026-01-12', title: 'Kick-off', description: 'The team met and the scope was agreed.', glyph: 'calendar' },
|
|
39
|
+
{ date: '2026-02-20', title: 'Design signed off', description: 'Five languages, every state measured.', tone: 'info', glyph: 'pencil' },
|
|
40
|
+
{ date: '2026-04-03', title: 'Beta', description: 'The first users came in; two slow screens were found.', tone: 'accent', glyph: 'person' },
|
|
41
|
+
{ date: '2026-05-15', title: 'Slow screens fixed', description: 'The grid draws only what is in view.', tone: 'caution' },
|
|
42
|
+
{ date: '2026-06-30', title: 'Shipped', description: 'Version one, on time.', tone: 'success', glyph: 'check' }
|
|
43
|
+
]}
|
|
44
|
+
/>
|
|
45
|
+
</Stack>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Along a line of dates
|
|
51
|
+
|
|
52
|
+
`orientation='horizontal'` puts the dates on a line that scrolls with the buttons at its ends; the shown event (`value`, `x-model`) has its card under the line. The arrow keys move along the dates. `dateFormat` takes the options of `Intl.DateTimeFormat`.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { reactive } from '@motifx/core';
|
|
56
|
+
import { Stack, Timeline } from '@motifx-community/ui';
|
|
57
|
+
|
|
58
|
+
const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
59
|
+
|
|
60
|
+
/** Releases along a line of dates: a press on a date, or the arrow keys, shows that release under the line; the buttons scroll the track. */
|
|
61
|
+
export default function Horizontal() {
|
|
62
|
+
const s = reactive({ shown: 'r3' as string | number | null });
|
|
63
|
+
const releases = MONTHS.map((month, i) => ({
|
|
64
|
+
key: `r${i + 1}`,
|
|
65
|
+
date: new Date(2026, i, 15),
|
|
66
|
+
title: `Release ${i + 1}`,
|
|
67
|
+
description: `What ${month} brought: ${i % 3 === 0 ? 'new components' : i % 3 === 1 ? 'fixes and speed' : 'the docs and the languages'}.`,
|
|
68
|
+
tone: i % 3 === 0 ? ('accent' as const) : ('default' as const),
|
|
69
|
+
glyph: i % 3 === 0 ? 'star' : ''
|
|
70
|
+
}));
|
|
71
|
+
return (
|
|
72
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
73
|
+
<Timeline class="tl-releases" label="Releases" orientation="horizontal" dateFormat={{ month: 'short', year: 'numeric' }} items={releases} x-model={() => s.shown} />
|
|
74
|
+
<output class="tl-releases-told">{() => `shown: ${s.shown}`}</output>
|
|
75
|
+
</Stack>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Any content
|
|
81
|
+
|
|
82
|
+
An item’s `content` makes what goes in its card besides the texts; `icon` puts an icon of your own in the dot. A date with a time is written with it when `dateFormat` says so.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { reactive } from '@motifx/core';
|
|
86
|
+
import { Button, Stack, Timeline } from '@motifx-community/ui';
|
|
87
|
+
|
|
88
|
+
/** Any content in a card: a button to act on the event, an icon of your own in the dot. */
|
|
89
|
+
export default function Content() {
|
|
90
|
+
const s = reactive({ told: '' });
|
|
91
|
+
const act = (what: string) => (
|
|
92
|
+
<Stack orientation="horizontal" gap="sm">
|
|
93
|
+
<Button text={what} variant="outline" size="sm" onclick={() => (s.told = `${what} pressed`)} />
|
|
94
|
+
</Stack>
|
|
95
|
+
);
|
|
96
|
+
return (
|
|
97
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
98
|
+
<Timeline
|
|
99
|
+
class="tl-orders"
|
|
100
|
+
label="An order"
|
|
101
|
+
items={[
|
|
102
|
+
{ date: '2026-11-02T09:15:00', title: 'Order placed', description: 'Three items, paid by card.', tone: 'info', content: () => act('See the invoice') },
|
|
103
|
+
{ date: '2026-11-03T14:40:00', title: 'Packed', tone: 'accent', glyph: 'columns' },
|
|
104
|
+
{ date: '2026-11-04T08:00:00', title: 'On its way', description: 'Handed to the courier.', content: () => act('Track it') },
|
|
105
|
+
{ date: '2026-11-05T16:25:00', title: 'Delivered', tone: 'success', glyph: 'check', content: () => act('Rate it') }
|
|
106
|
+
]}
|
|
107
|
+
dateFormat={{ dateStyle: 'medium', timeStyle: 'short' }}
|
|
108
|
+
/>
|
|
109
|
+
<output class="tl-orders-told">{() => s.told}</output>
|
|
110
|
+
</Stack>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Keyboard
|
|
116
|
+
|
|
117
|
+
| Key | What it does |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| `Tab` | Vertical: the cards that fold are stops, one each. Horizontal: the shown date is the one stop; the track’s buttons are stops too. |
|
|
120
|
+
| `Arrow keys` | Horizontal: Left and Right (the other way round in a right-to-left page) show the event before or after; Home and End the first and the last. |
|
|
121
|
+
| `Enter, Space` | On a folding card: unfolds or folds it. On a date: shows it. |
|
|
122
|
+
|
|
123
|
+
## Accessibility
|
|
124
|
+
|
|
125
|
+
| Topic | How |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `Down the page` | A `list` named by `label`, one item per event; a date is a `time` element with its ISO value; a folding card is a button with `aria-expanded` over its description. |
|
|
128
|
+
| `Along the line` | The dates are tabs (`tablist`, `tab`, `aria-selected`) and the card under them the `tabpanel` they control; the buttons at the ends are named “Earlier” and “Later”. |
|
|
129
|
+
| `Dots and glyphs` | Decorative; the tone shows in colour only, so put what matters in the title. |
|
|
130
|
+
|
|
131
|
+
## Styling
|
|
132
|
+
|
|
133
|
+
| Hook | What it is |
|
|
134
|
+
| --- | --- |
|
|
135
|
+
| `.mx-timeline` | The timeline. `data-orientation`, `data-alternate`. |
|
|
136
|
+
| `.mx-timeline__list, .mx-timeline__item` | The list (the line is its `::before`) and an event (`data-tone`, `data-side`, `data-expanded`, `data-selected`). |
|
|
137
|
+
| `.mx-timeline__dot, .mx-timeline__dot-glyph, .mx-timeline__dot-icon` | The dot and what is in it. |
|
|
138
|
+
| `.mx-timeline__card, .mx-timeline__flag, .mx-timeline__detail` | A card down the page, a date along the line, the card under the line. |
|
|
139
|
+
| `.mx-timeline__date, .mx-timeline__title, .mx-timeline__description, .mx-timeline__content` | The texts and the content of your own. |
|
|
140
|
+
| `.mx-timeline__track, .mx-timeline__nav, .mx-timeline__nav-glyph` | The track that scrolls, its buttons and their arrows. |
|
|
141
|
+
|
|
142
|
+
### Component tokens
|
|
143
|
+
|
|
144
|
+
| Token | What it sets |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `timeline.line, .dot, .dot-glyph, .card, .flag, .date, .title, .description, .detail, .nav, .nav-glyph` | Units: the line, a dot and its glyph (by tone), a card (`pressable`, `hover`, `pressed`, `focus`, `expanded`), a flag (`hover`, `pressed`, `focus`, `selected`), the texts, the detail, the track buttons. |
|
|
147
|
+
| `timeline.gap, .dot-gap, .track-gap, .row-gap, .mark-size, .line-thickness` | Between events, between a dot and its card, between flags, between the track and the detail; the dot’s size; the line’s thickness. |
|
|
148
|
+
|
|
149
|
+
## API reference
|
|
150
|
+
|
|
151
|
+
### Props
|
|
152
|
+
|
|
153
|
+
| Prop | Type | Default | Description |
|
|
154
|
+
| --- | --- | --- | --- |
|
|
155
|
+
| `items` | `Bind<readonly TimelineItem[]>` | `[]` | The events in order: `date` (a `Date`, an ISO text or milliseconds), `title`, `description`, `glyph` or `icon`, `tone`, `content`, `key`, `data`. |
|
|
156
|
+
| `orientation` | `Bind<TimelineOrientation>` | `'vertical'` | `vertical`: down the page, a card per event; `horizontal`: along a line of dates, the shown event’s card under it. |
|
|
157
|
+
| `alternate` | `Bind<boolean>` | `false` | Vertical: the cards take turns on either side of the line. |
|
|
158
|
+
| `collapsible` | `Bind<boolean>` | `false` | Vertical: a card shows its description only when pressed. |
|
|
159
|
+
| `dateFormat` | `Bind<TimelineDateFormat>` | `'medium'` | `short`, `medium`, `long`, or the options of `Intl.DateTimeFormat`; written in the kit’s language. |
|
|
160
|
+
| `value` | `Bind<string \| number \| null>` | `0` | Horizontal: the event whose card is shown, its `key` else its index. `x-model` binds it two-way. |
|
|
161
|
+
| `label` | `Bind<string>` | the kit’s “Timeline” | What screen readers call it. |
|
|
162
|
+
|
|
163
|
+
### Events, properties and methods
|
|
164
|
+
|
|
165
|
+
| Member | Kind | Description |
|
|
166
|
+
| --- | --- | --- |
|
|
167
|
+
| `onItemClick` | event | A press on an event’s card or flag (`index`, `item`). |
|
|
168
|
+
| `onSelectionChanged` | event | Horizontal: the shown event changed (`index`, `item`, `previous`, `byUser`). |
|
|
169
|
+
| `selectedIndex` | read-only | Horizontal: the index of the shown event; -1 when there is none. |
|
|
170
|
+
| `count` | read-only | How many events there are. |
|
|
171
|
+
| `goTo(event)` | `boolean` | Horizontal: shows an event by index or key; vertical: unfolds its card. |
|
|
172
|
+
| `unfold(event, on), isUnfolded(event)` | `void`, `boolean` | Vertical, `collapsible`: unfolds or folds a card; whether it is unfolded. |
|
|
173
|
+
| `formatDate(date)` | `string` | A date as the timeline writes it. |
|
|
174
|
+
| `refresh()` | `void` | Reads the items again after they were changed in place. |
|
package/docs/toast.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Toast
|
|
2
2
|
|
|
3
|
-
> Feedback · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Feedback · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
|
-
Short notifications at an edge of the window: four tones, an action such as Undo, a time of their own or none, six positions and a limit on how many show at once. Called
|
|
5
|
+
Short notifications at an edge of the window: four tones, an action such as Undo, a time of their own or none, six positions and a limit on how many show at once. Called programmatically; a region of your own can sit in JSX.
|
|
6
6
|
|
|
7
7
|
## Import
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Short notifications at an edge of the window: four tones, an action such as Undo
|
|
|
10
10
|
import { toast, Toast, Toaster, type ToastTone, type ToastPosition } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Programmatic and declarative
|
|
14
14
|
|
|
15
15
|
`toast.show()` and its tone shortcuts return the `Toast`, an object you can `close()`, `update()` or await. They use `Toaster.default`, made in `document.body` the first time; an app can put a `Toaster` of its own where it wants it in JSX and make it the default.
|
|
16
16
|
|
|
@@ -18,8 +18,8 @@ import { toast, Toast, Toaster, type ToastTone, type ToastPosition } from '@moti
|
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Button, toast, type Toast } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** Toasts shown
|
|
22
|
-
export default function
|
|
21
|
+
/** Toasts shown programmatically: the Toast that comes back can be closed and awaited. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ reason: '' });
|
|
24
24
|
|
|
25
25
|
const exportFile = () => {
|