@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/datebox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DateBox
|
|
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 date, a time or both. It is typed in the order of the locale through a mask, or picked from a calendar and a list of times; `min`, `max` and `disabledDates` limit both ways.
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ A date, a time or both. It is typed in the order of the locale through a mask, o
|
|
|
10
10
|
import { DateBox } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
16
|
import { reactive } from '@motifx/core';
|
|
@@ -18,13 +18,13 @@ import { Button, DateBox, Stack } from '@motifx-community/ui';
|
|
|
18
18
|
|
|
19
19
|
const today = new Date();
|
|
20
20
|
|
|
21
|
-
/** A date box bound with x-model, and date boxes created with `new`, given a value and added
|
|
22
|
-
export default function
|
|
21
|
+
/** A date box bound with x-model, and date boxes created with `new`, given a value and added programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const order = reactive({ delivery: new Date(today.getFullYear(), today.getMonth(), today.getDate() + 3) as Date | null, result: '' });
|
|
24
24
|
let added = 0;
|
|
25
25
|
let host: Stack | null = null;
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const addProgrammatic = () => {
|
|
28
28
|
const due = new DateBox({ label: `Due ${++added}`, locale: 'tr-TR', clearButton: true });
|
|
29
29
|
due.value = new Date(2026, 9, 25);
|
|
30
30
|
due.onValueChanged((e) => (order.result = `${due.label}: ${e.value ? e.value.toDateString() : '—'}`));
|
|
@@ -36,7 +36,7 @@ export default function FromCode() {
|
|
|
36
36
|
<>
|
|
37
37
|
<DateBox label="&Delivery" x-model={() => order.delivery} clearButton />
|
|
38
38
|
<output class="db-day">{() => (order.delivery ? order.delivery.toDateString() : '—')}</output>
|
|
39
|
-
<Button text="Add a date box
|
|
39
|
+
<Button text="Add a date box programmatically" variant="outline" onclick={addProgrammatic} />
|
|
40
40
|
<output class="db-made">{() => order.result}</output>
|
|
41
41
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
|
42
42
|
</>
|
package/docs/daterangebox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DateRangeBox
|
|
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 start and an end date in one field: typed through two masks, or picked on two months side by side, from ready-made ranges, within the dates and the span allowed. The value is a `[start, end]` pair.
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ A start and an end date in one field: typed through two masks, or picked on two
|
|
|
10
10
|
import { DateRangeBox, type DateRange } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
16
|
import { reactive } from '@motifx/core';
|
|
@@ -18,8 +18,8 @@ import { Button, DateRangeBox, Stack, type DateRange } from '@motifx-community/u
|
|
|
18
18
|
|
|
19
19
|
const say = (d: Date | null) => (d ? d.toLocaleDateString('en-GB') : '—');
|
|
20
20
|
|
|
21
|
-
/** A range bound with x-model, and one made
|
|
22
|
-
export default function
|
|
21
|
+
/** A range bound with x-model, and one made programmatically and read through its properties. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ stay: [new Date(2026, 2, 10), new Date(2026, 2, 14)] as DateRange, told: '' });
|
|
24
24
|
const coded = new DateRangeBox({ label: 'Report period', clearButton: true, onValueChanged: e => (s.told = `${say(e.value[0])} to ${say(e.value[1])}`) });
|
|
25
25
|
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Draggable and DropTarget
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
Anything the user moves with the pointer, a finger or the arrow keys, along an axis or inside a boundary, by a handle or as a copy; and the targets that take it. For items that change places in a list, see [Sortable](sortable.md).
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Draggable, DropTarget } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Moving things
|
|
14
|
+
|
|
15
|
+
The JSX children are what moves. `boundary` keeps it inside its parent or an element, `axis` keeps it on a line, `handle` names the only part that takes the press and the keys. A drag writes the place to `x-model` and `onDragEnded` tells it; Escape brings it back.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { Draggable, Panel, Stack } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** Three notes in a room: one moves anywhere inside it, one only sideways, one only by its grip; the keys move the focused one. */
|
|
22
|
+
export default function Free() {
|
|
23
|
+
const s = reactive({ told: '' });
|
|
24
|
+
const note = (text: string, grip = false) => (
|
|
25
|
+
<Panel padding="sm" variant="outline" style="inline-size: 150px">
|
|
26
|
+
{grip && <span class="dg-grip">⋮⋮ </span>}
|
|
27
|
+
<span>{text}</span>
|
|
28
|
+
</Panel>
|
|
29
|
+
);
|
|
30
|
+
return (
|
|
31
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
32
|
+
<div class="dg-room" style="position: relative; block-size: 220px; outline: 2px dashed var(--mx-color-stroke-control-strong); outline-offset: -2px">
|
|
33
|
+
<Draggable class="dg-free" boundary="parent" style="position: absolute; left: 16px; top: 16px" onDragEnded={e => (s.told = `free: ${e.x}, ${e.y}`)}>
|
|
34
|
+
{note('Anywhere in the room')}
|
|
35
|
+
</Draggable>
|
|
36
|
+
<Draggable class="dg-axis" axis="x" boundary="parent" style="position: absolute; left: 16px; top: 100px" onDragEnded={e => (s.told = `sideways: ${e.x}, ${e.y}`)}>
|
|
37
|
+
{note('Only sideways')}
|
|
38
|
+
</Draggable>
|
|
39
|
+
<Draggable class="dg-handle" handle=".dg-grip" boundary="parent" style="position: absolute; left: 300px; top: 16px" onDragEnded={e => (s.told = `by the grip: ${e.x}, ${e.y}`)}>
|
|
40
|
+
{note('Only by the grip', true)}
|
|
41
|
+
</Draggable>
|
|
42
|
+
</div>
|
|
43
|
+
<output class="dg-free-told">{() => s.told}</output>
|
|
44
|
+
</Stack>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Drop targets
|
|
50
|
+
|
|
51
|
+
A `DropTarget` of the same `group` takes a draggable dropped on it and is told in `onDropped` with the draggable’s `data`; `onDragEntering` may refuse. With `clone` a copy follows the pointer and the draggable stays, so one thing can be dropped many times. What a drop does to your data is yours.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { reactive } from '@motifx/core';
|
|
55
|
+
import { Draggable, DropTarget, Stack } from '@motifx-community/ui';
|
|
56
|
+
|
|
57
|
+
const FRUIT = ['Apple', 'Pear', 'Plum'];
|
|
58
|
+
|
|
59
|
+
/** Copies of the chips go to the bowls of their group; the small bowl refuses a third, and the data moves in `onDropped`. */
|
|
60
|
+
export default function Targets() {
|
|
61
|
+
const s = reactive({ big: [] as string[], small: [] as string[], told: '' });
|
|
62
|
+
const bowl = (name: 'big' | 'small', limit: number) => (
|
|
63
|
+
<DropTarget
|
|
64
|
+
class={`dg-bowl dg-bowl-${name}`}
|
|
65
|
+
group="fruit"
|
|
66
|
+
grow
|
|
67
|
+
style="flex-basis: 0; min-block-size: 96px; padding: 12px; border: 1px solid var(--mx-color-stroke-divider); border-radius: var(--mx-radius-md)"
|
|
68
|
+
onDragEntering={e => (e.cancel = s[name].length >= limit)}
|
|
69
|
+
onDropped={e => {
|
|
70
|
+
s[name].push(e.data as string);
|
|
71
|
+
s.told = `${e.data} went to the ${name} bowl`;
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<strong>{name === 'big' ? 'Big bowl' : 'Small bowl, two at most'}</strong>
|
|
75
|
+
<div class="dg-bowl-list">{() => s[name].join(', ') || 'empty'}</div>
|
|
76
|
+
</DropTarget>
|
|
77
|
+
);
|
|
78
|
+
return (
|
|
79
|
+
<Stack gap="md" style="inline-size: 100%">
|
|
80
|
+
<Stack orientation="horizontal" gap="sm" wrap>
|
|
81
|
+
{FRUIT.map(fruit => (
|
|
82
|
+
<Draggable class="dg-chip" clone group="fruit" data={fruit} style="padding: 6px 12px; border-radius: var(--mx-radius-full); border: 1px solid var(--mx-color-stroke-control-strong)">
|
|
83
|
+
{fruit}
|
|
84
|
+
</Draggable>
|
|
85
|
+
))}
|
|
86
|
+
</Stack>
|
|
87
|
+
<Stack orientation="horizontal" gap="md">
|
|
88
|
+
{bowl('big', 99)}
|
|
89
|
+
{bowl('small', 2)}
|
|
90
|
+
</Stack>
|
|
91
|
+
<output class="dg-bowls-told">{() => s.told}</output>
|
|
92
|
+
</Stack>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Programmatic use
|
|
98
|
+
|
|
99
|
+
`position` puts it where you say, in pixels from where it was laid out, and `x-model` takes the place back after every drag or key: kept and restored.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { reactive } from '@motifx/core';
|
|
103
|
+
import { Button, Draggable, Panel, Stack } from '@motifx-community/ui';
|
|
104
|
+
|
|
105
|
+
/** The place goes out to x-model after every drag or key and comes back: moved, kept and restored programmatically. */
|
|
106
|
+
export default function Programmatic() {
|
|
107
|
+
const s = reactive({ at: { x: 0, y: 0 } as { x: number; y: number } | null, kept: null as { x: number; y: number } | null });
|
|
108
|
+
return (
|
|
109
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
110
|
+
<div style="position: relative; block-size: 160px">
|
|
111
|
+
<Draggable class="dg-coded" boundary="parent" step={20} x-model={() => s.at} style="position: absolute; left: 0; top: 0">
|
|
112
|
+
<Panel padding="sm" variant="outline" style="inline-size: 140px">
|
|
113
|
+
Moved by the model
|
|
114
|
+
</Panel>
|
|
115
|
+
</Draggable>
|
|
116
|
+
</div>
|
|
117
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
118
|
+
<Button text="Right by 40" variant="outline" onclick={() => (s.at = { x: (s.at?.x ?? 0) + 40, y: s.at?.y ?? 0 })} />
|
|
119
|
+
<Button text="Keep this place" variant="outline" onclick={() => (s.kept = s.at ? { ...s.at } : null)} />
|
|
120
|
+
<Button text="Restore it" variant="outline" enabled={() => !!s.kept} onclick={() => (s.at = s.kept ? { ...s.kept } : null)} />
|
|
121
|
+
<Button text="Back to the start" variant="outline" onclick={() => (s.at = { x: 0, y: 0 })} />
|
|
122
|
+
<output class="dg-coded-told">{() => `at: ${JSON.stringify(s.at)}`}</output>
|
|
123
|
+
</Stack>
|
|
124
|
+
</Stack>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Keyboard
|
|
130
|
+
|
|
131
|
+
| Key | What it does |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| `Tab` | The draggable (or its handle) is one stop. |
|
|
134
|
+
| `Arrow keys` | Move it by `step` pixels along its axis, inside its boundary; the new place is read out. |
|
|
135
|
+
| `Escape` | While dragging: lets go and brings it back where it started. |
|
|
136
|
+
|
|
137
|
+
## Accessibility
|
|
138
|
+
|
|
139
|
+
| Topic | How |
|
|
140
|
+
| --- | --- |
|
|
141
|
+
| `The draggable` | A `group` with `aria-roledescription="draggable"` named “Move” in the kit language; with a `handle`, that element is a button of that name instead. |
|
|
142
|
+
| `Dragging` | A long press lifts it on a touch screen. While it is dragged it lets the pointer through, so the target under it is found; the copy of a `clone` follows the pointer. |
|
|
143
|
+
| `Targets` | Marked while a drag of their group is under way, while the draggable is over them, and when they refuse it. |
|
|
144
|
+
|
|
145
|
+
## Styling
|
|
146
|
+
|
|
147
|
+
| Hook | What it is |
|
|
148
|
+
| --- | --- |
|
|
149
|
+
| `.mx-draggable` | The draggable. `data-dragging`, `data-handle`, `data-clone`, `data-axis`. |
|
|
150
|
+
| `.mx-draggable__handle, .mx-draggable__ghost` | The handle named by `handle`; the copy after the pointer. |
|
|
151
|
+
| `.mx-drop-target` | A target. `data-drop-active` during a drag of its group, `data-drop-over`, `data-drop-refused`. |
|
|
152
|
+
|
|
153
|
+
### Component tokens
|
|
154
|
+
|
|
155
|
+
| Token | What it sets |
|
|
156
|
+
| --- | --- |
|
|
157
|
+
| `draggable.box, .handle, .ghost` | Units: the draggable (`draggable`, `dragging`, `focus`), its handle (`hover`, `focus`), the copy. |
|
|
158
|
+
| `drop-target.target` | Unit: a target (`active`, `over`, `refused`). |
|
|
159
|
+
|
|
160
|
+
## API reference
|
|
161
|
+
|
|
162
|
+
### Draggable props
|
|
163
|
+
|
|
164
|
+
| Prop | Type | Default | Description |
|
|
165
|
+
| --- | --- | --- | --- |
|
|
166
|
+
| `axis` | `Bind<DragAxis>` | `'both'` | `both`, `x` or `y`. |
|
|
167
|
+
| `boundary` | `Bind<'parent' \| HTMLElement \| null>` | `null` | The draggable stays inside this: its parent, or an element it lies in. |
|
|
168
|
+
| `handle` | `Bind<string \| null>` | `null` | A selector inside the draggable: only a press there drags it, and it takes the Tab stop and the keys. |
|
|
169
|
+
| `clone` | `Bind<boolean>` | `false` | A copy follows the pointer and the draggable stays where it is; for a drop target to take. |
|
|
170
|
+
| `group` | `Bind<string \| null>` | `null` | Drop targets of the same group take it. |
|
|
171
|
+
| `data` | `unknown` | — | Anything of your own, given to the drop target with the drop. |
|
|
172
|
+
| `step` | `Bind<number>` | `10` | Pixels an arrow key moves it by. |
|
|
173
|
+
| `position` | `Bind<DragPosition \| null>` | `null` | Where it stands, in pixels from where it was laid out: given, it is applied; after every drag or key the new place is written to `x-model`. |
|
|
174
|
+
|
|
175
|
+
### DropTarget props and events
|
|
176
|
+
|
|
177
|
+
| Prop | Type | Default | Description |
|
|
178
|
+
| --- | --- | --- | --- |
|
|
179
|
+
| `group` | `Bind<string \| null>` | `null` | Takes the draggables of this group; `null` takes those without one. |
|
|
180
|
+
| `onDragEntering` | event | A draggable came over it (`draggable`, `data`); `cancel = true` refuses it. |
|
|
181
|
+
| `onDragLeaving` | event | The draggable left it. |
|
|
182
|
+
| `onDropped` | event | A draggable was dropped on it: your data is yours to move. |
|
|
183
|
+
|
|
184
|
+
### Events, properties and methods
|
|
185
|
+
|
|
186
|
+
| Member | Kind | Description |
|
|
187
|
+
| --- | --- | --- |
|
|
188
|
+
| `onDragStarting` | event | A drag is about to begin; `cancel = true` keeps it in place. |
|
|
189
|
+
| `onDragging` | event | It is being dragged (`x`, `y`, the `target` under the pointer). |
|
|
190
|
+
| `onDragEnding` | event | The pointer let go; `cancel = true` brings it back where it started. |
|
|
191
|
+
| `onDragEnded` | event | The drag ended (`x`, `y`, `target`, `dropped`). |
|
|
192
|
+
| `currentPosition` | read-only | Where it stands now. |
|
|
193
|
+
| `isDragging` | read-only | A drag is under way. |
|
|
194
|
+
| `handleElement` | read-only | What takes the press and the keys: the handle, else the draggable itself. |
|
package/docs/drawer.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Drawer
|
|
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
|
A panel that slides in from an edge of the page or of a container, over the content or pushing it aside. A finger swipes it in from the edge and back again; Escape, the scrim and the browser's back close it.
|
|
6
6
|
|
package/docs/dropdown.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DropDown
|
|
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
|
Picks one item from a list. The field shows the chosen item; the list opens below it with the keyboard or a press, can be searched, grouped and drawn your way, and stays fast with thousands of items.
|
|
6
6
|
|
|
@@ -10,9 +10,9 @@ Picks one item from a list. The field shows the chosen item; the list opens belo
|
|
|
10
10
|
import { DropDown, type DropDownItem } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
`items` can be plain values; `x-model` binds the value. Created with `new`, the same properties are set
|
|
15
|
+
`items` can be plain values; `x-model` binds the value. Created with `new`, the same properties are set programmatically.
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
/** The cities the drop-downs of the examples show. */
|
|
@@ -249,20 +249,20 @@ The list is a shared part, `OptionList`, exported for combo boxes, list boxes an
|
|
|
249
249
|
|
|
250
250
|
## Example files
|
|
251
251
|
|
|
252
|
-
`
|
|
252
|
+
`Programmatic.tsx`
|
|
253
253
|
|
|
254
254
|
```tsx
|
|
255
255
|
import { reactive } from '@motifx/core';
|
|
256
256
|
import { Button, DropDown, Stack } from '@motifx-community/ui';
|
|
257
257
|
import { cities } from './cities';
|
|
258
258
|
|
|
259
|
-
/** Drop-downs bound with x-model, and drop-downs created with `new` and added
|
|
260
|
-
export default function
|
|
259
|
+
/** Drop-downs bound with x-model, and drop-downs created with `new` and added programmatically. */
|
|
260
|
+
export default function Programmatic() {
|
|
261
261
|
const form = reactive({ city: 'İzmir' as string | null, size: null as string | null, result: '' });
|
|
262
262
|
let added = 0;
|
|
263
263
|
let host: Stack | null = null;
|
|
264
264
|
|
|
265
|
-
const
|
|
265
|
+
const addProgrammatic = () => {
|
|
266
266
|
const size = new DropDown<string, string>({ label: `Size ${++added}`, items: ['S', 'M', 'L'], placeholder: 'Pick one' });
|
|
267
267
|
size.onValueChanged((e) => (form.result = `${size.label}: ${e.value}`));
|
|
268
268
|
host?.controls.add(size);
|
|
@@ -277,7 +277,7 @@ export default function FromCode() {
|
|
|
277
277
|
</Stack>
|
|
278
278
|
<DropDown label="Size" items={['S', 'M', 'L', 'XL']} placeholder="Pick one" x-model={() => form.size} clearButton />
|
|
279
279
|
<Stack orientation="horizontal" wrap align="center">
|
|
280
|
-
<Button text="Add a drop-down
|
|
280
|
+
<Button text="Add a drop-down programmatically" variant="outline" onclick={addProgrammatic} />
|
|
281
281
|
<output class="dd-made">{() => form.result}</output>
|
|
282
282
|
</Stack>
|
|
283
283
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
package/docs/fileuploader.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# FileUploader
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
|
-
Files chosen with a button or dropped on the box, listed with their size and what happens to them: uploaded as they come, on a button or
|
|
5
|
+
Files chosen with a button or dropped on the box, listed with their size and what happens to them: uploaded as they come, on a button or programmatically, with progress, cancel, retry and remove on each. Files outside the limits are listed with the reason.
|
|
6
6
|
|
|
7
7
|
## Import
|
|
8
8
|
|
|
@@ -137,7 +137,7 @@ The uploader posts a form with the file in `uploadField` (`file` by default) to
|
|
|
137
137
|
| --- | --- |
|
|
138
138
|
| `Choosing` | The button opens the file dialog; files may be dropped on the box too, which lights up while they are over it. |
|
|
139
139
|
| `Refusing` | A file outside `accept`, the sizes or `maxFiles` is listed as refused with the reason, and is not in the value. |
|
|
140
|
-
| `Uploading` | As chosen, on the Upload button, or
|
|
140
|
+
| `Uploading` | As chosen, on the Upload button, or programmatically. A row shows the progress and a Cancel button meanwhile; afterwards “Uploaded”, or the failure with Retry. The server’s answer is the item’s `response` (JSON parsed). |
|
|
141
141
|
| `Chunks` | With `chunkSize` the file goes in pieces, each a request with `Content-Range: bytes start-end/total`; progress runs over the whole. |
|
|
142
142
|
| `Removing` | Each row has a remove button; a running upload is stopped first. |
|
|
143
143
|
|
|
@@ -178,7 +178,7 @@ The uploader posts a form with the file in `uploadField` (`file` by default) to
|
|
|
178
178
|
| `maxFileSize, minFileSize` | `Bind<number \| null>` | `null` | Bytes. A file outside is listed as refused, with the reason. |
|
|
179
179
|
| `maxFiles` | `Bind<number \| null>` | `null` | How many files may be taken in all. |
|
|
180
180
|
| `allowDrop` | `Bind<boolean>` | `true` | Files may be dropped on the box. |
|
|
181
|
-
| `uploadMode` | `Bind<UploadMode>` | `instant` / `manual` | `instant`: as chosen; `button`: an Upload button; `manual`: `upload()`
|
|
181
|
+
| `uploadMode` | `Bind<UploadMode>` | `instant` / `manual` | `instant`: as chosen; `button`: an Upload button; `manual`: `upload()` programmatically. Default `instant` with `uploadUrl` or `upload`, else `manual`. |
|
|
182
182
|
| `uploadUrl, uploadMethod, uploadHeaders, uploadField` | `Bind<string \| null>`, … | `null`, `POST`, `null`, `file` | Where and how the uploader itself sends a file (XMLHttpRequest, with progress), as a form with the file in `uploadField`. |
|
|
183
183
|
| `chunkSize` | `Bind<number \| null>` | `null` | Bytes per request: the file goes in pieces, each with its `Content-Range` and `chunkIndex` / `chunkCount` fields; the last answer is the response. |
|
|
184
184
|
| `upload` | `(file, report, signal) => Promise<unknown>` | — | Your own upload instead of `uploadUrl`: call `report(0…1)` as it goes, stop on `signal`; what it resolves to is the response. |
|
package/docs/filterbuilder.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FilterBuilder
|
|
2
2
|
|
|
3
|
-
> Data · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Data · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A filter builder lets people put a filter together by hand: groups joined by And, Or, Not And or Not Or, and conditions of a field, an operation and a value. Its value is the data layer's filter expression, so it goes to rows in memory and to every adapter as it is. The DataGrid opens it from its filter panel; on its own it serves a report screen or a saved search.
|
|
6
6
|
|
|
@@ -57,7 +57,7 @@ export const saleFields: FilterBuilderField[] = [
|
|
|
57
57
|
];
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Programmatic use, and the events
|
|
61
61
|
|
|
62
62
|
Every change the user makes is also a method (`addCondition`, `addGroup`, `removeItem`, `setField`, `setOperation`, `setConditionValue`, `setGroupOperation`, `clear`), and every change asks first: `onItemAdding`, `onItemRemoving` and `onItemChanging` can change it or cancel it, the `…ed` events and `onValueChanged` follow. Here the last condition of the root cannot be taken out.
|
|
63
63
|
|
|
@@ -372,7 +372,7 @@ export const saleFields: FilterBuilderField[] = [
|
|
|
372
372
|
| `setField(condition, dataField), setOperation(condition, op), setConditionValue(condition, value)` | `boolean` | An operation or value that no longer fits the new field is reset. |
|
|
373
373
|
| `setGroupOperation(group, op)` | `boolean` | |
|
|
374
374
|
| `clear()` | `void` | Empties the tree. |
|
|
375
|
-
| `openEditor(condition), closeEditor(keep?)` | `boolean`, `void` | The value editor,
|
|
375
|
+
| `openEditor(condition), closeEditor(keep?)` | `boolean`, `void` | The value editor, programmatically. |
|
|
376
376
|
| `focusItem(item, part?), focus()` | `boolean` | A row's button (`'remove'`, `'group'`, `'add'`, `'field'`, `'operation'`, `'value'`); the tree's Tab stop. |
|
|
377
377
|
| `getFilterExpression()` | `data.FilterExpression \| null` | The value. |
|
|
378
378
|
| `refresh()` | `void` | Your fields and value may be plain or reactive; the builder reads them as they are. After changing them in place, call `refresh()`. The rows are drawn again; a value changed in place is read into the tree. |
|
|
@@ -460,7 +460,7 @@ export const saleFields: FilterBuilderField[] = [
|
|
|
460
460
|
];
|
|
461
461
|
```
|
|
462
462
|
|
|
463
|
-
`
|
|
463
|
+
`Programmatic.tsx`
|
|
464
464
|
|
|
465
465
|
```tsx
|
|
466
466
|
import { reactive } from '@motifx/core';
|
|
@@ -468,14 +468,14 @@ import { data } from '@motifx-community/data';
|
|
|
468
468
|
import { Button, FilterBuilder, Stack } from '@motifx-community/ui';
|
|
469
469
|
import { saleFields } from './sales';
|
|
470
470
|
|
|
471
|
-
/** Made with `new` and driven
|
|
472
|
-
export default function
|
|
471
|
+
/** Made with `new` and driven programmatically; every change asks first, and a handler may cancel it. */
|
|
472
|
+
export default function Programmatic() {
|
|
473
473
|
const log = reactive({ lines: [] as { id: number; text: string }[], next: 0 });
|
|
474
474
|
const write = (text: string) => {
|
|
475
475
|
log.lines.unshift({ id: log.next++, text });
|
|
476
476
|
if (log.lines.length > 6) log.lines.pop();
|
|
477
477
|
};
|
|
478
|
-
const builder = new FilterBuilder({ fields: saleFields, locale: 'en', label: 'Built
|
|
478
|
+
const builder = new FilterBuilder({ fields: saleFields, locale: 'en', label: 'Built programmatically' });
|
|
479
479
|
builder.element.classList.add('fb-code');
|
|
480
480
|
builder.onItemAdding((e) => write(`adding a ${e.item.kind}${e.byUser ? ' (user)' : ''}`));
|
|
481
481
|
builder.onItemRemoving((e) => {
|
package/docs/formlayout.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FormLayout
|
|
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
|
Lays out the fields of a data object on a grid. Each field gets an editor — by name, or by the type of its value — bound to the object both ways; groups, spans and buttons arrange them; sending the form checks every field first.
|
|
6
6
|
|