@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/splitter.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Splitter
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
Panes side by side or one under the other, as many as needed, with a handle between each two that the pointer drags and the keys move. A handle resizes the two panes beside it; a pane may be hidden from its handle, and may hold another splitter. For two panes with one fixed, see [SplitContainer](layout.md).
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Splitter, SplitPane } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Pixels, shares and the rest
|
|
14
|
+
|
|
15
|
+
Each `SplitPane` says its `size`: pixels stay pixels when the splitter changes size, a share (`'30%'`) divides the room the shares get, and a pane without a size takes an equal part of what is left. `minSize` and `maxSize` hold the handles. Drag a handle, or focus it and use the arrow keys, Home and End.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { SplitPane, Splitter } from '@motifx-community/ui';
|
|
19
|
+
|
|
20
|
+
/** Three panes: a fixed one in pixels with a least size, one that takes what is left, and a share. */
|
|
21
|
+
export default function Basic() {
|
|
22
|
+
return (
|
|
23
|
+
<Splitter class="sp-basic" style="block-size: 240px">
|
|
24
|
+
<SplitPane size={220} minSize={140} padding="md" text="Folders">
|
|
25
|
+
<p class="sp-note">Folders, 220 px to start, never under 140.</p>
|
|
26
|
+
</SplitPane>
|
|
27
|
+
<SplitPane minSize={120} padding="md" text="Messages">
|
|
28
|
+
<p class="sp-note">Messages take what the others leave.</p>
|
|
29
|
+
</SplitPane>
|
|
30
|
+
<SplitPane size="30%" minSize={100} padding="md" text="Preview">
|
|
31
|
+
<p class="sp-note">Preview, three tenths of the room the shares divide.</p>
|
|
32
|
+
</SplitPane>
|
|
33
|
+
</Splitter>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Hiding a pane
|
|
39
|
+
|
|
40
|
+
A `collapsible` pane gets a button on the handle next to it; Enter on the handle and a double press do the same. The neighbours take its room, and it comes back where it was. `onCollapsing` may refuse, `onCollapsed` tells.
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { reactive } from '@motifx/core';
|
|
44
|
+
import { SplitPane, Splitter, Stack } from '@motifx-community/ui';
|
|
45
|
+
|
|
46
|
+
/** The side panes can be hidden: a button on the handle, Enter on it, or a double press; the middle one cannot. */
|
|
47
|
+
export default function Collapsible() {
|
|
48
|
+
const s = reactive({ told: '' });
|
|
49
|
+
return (
|
|
50
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
51
|
+
<Splitter class="sp-fold" style="block-size: 200px" onCollapsed={e => (s.told = `${e.pane.text} ${e.collapsed ? 'hidden' : 'shown'}`)}>
|
|
52
|
+
<SplitPane size={180} minSize={120} collapsible padding="md" text="Tree">
|
|
53
|
+
<p class="sp-note">Tree</p>
|
|
54
|
+
</SplitPane>
|
|
55
|
+
<SplitPane minSize={160} padding="md" text="Page">
|
|
56
|
+
<p class="sp-note">Page</p>
|
|
57
|
+
</SplitPane>
|
|
58
|
+
<SplitPane size={200} minSize={120} collapsible padding="md" text="Properties">
|
|
59
|
+
<p class="sp-note">Properties</p>
|
|
60
|
+
</SplitPane>
|
|
61
|
+
</Splitter>
|
|
62
|
+
<output class="sp-fold-told">{() => s.told}</output>
|
|
63
|
+
</Stack>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## One inside another
|
|
69
|
+
|
|
70
|
+
A pane is a `Panel`: put a `Splitter` of the other `orientation` in it for an editor over an output, next to a tree.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { SplitPane, Splitter } from '@motifx-community/ui';
|
|
74
|
+
|
|
75
|
+
/** A pane may hold another splitter: here the right pane is split the other way. */
|
|
76
|
+
export default function Nested() {
|
|
77
|
+
return (
|
|
78
|
+
<Splitter class="sp-nested" style="block-size: 260px">
|
|
79
|
+
<SplitPane size={200} minSize={120} padding="md" text="Navigation">
|
|
80
|
+
<p class="sp-note">Navigation</p>
|
|
81
|
+
</SplitPane>
|
|
82
|
+
<SplitPane minSize={200}>
|
|
83
|
+
<Splitter class="sp-inner" orientation="vertical">
|
|
84
|
+
<SplitPane minSize={80} padding="md" text="Editor">
|
|
85
|
+
<p class="sp-note">Editor</p>
|
|
86
|
+
</SplitPane>
|
|
87
|
+
<SplitPane size={90} minSize={60} collapsible padding="md" text="Output">
|
|
88
|
+
<p class="sp-note">Output</p>
|
|
89
|
+
</SplitPane>
|
|
90
|
+
</Splitter>
|
|
91
|
+
</SplitPane>
|
|
92
|
+
</Splitter>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Keeping the layout
|
|
98
|
+
|
|
99
|
+
After every move the panes’ pixels are written to `x-model` (and `onResized` tells). Give them back as `sizes` to restore a layout; `null` starts from the panes’ own sizes again.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { reactive } from '@motifx/core';
|
|
103
|
+
import { Button, SplitPane, Splitter, Stack } from '@motifx-community/ui';
|
|
104
|
+
|
|
105
|
+
/** The sizes go out to x-model as pixels after every move, and come back: a layout kept and restored. */
|
|
106
|
+
export default function Sizes() {
|
|
107
|
+
const s = reactive({ sizes: null as readonly (number | string | null)[] | null, kept: null as readonly number[] | null, moved: 0 });
|
|
108
|
+
return (
|
|
109
|
+
<Stack gap="sm" style="inline-size: 100%">
|
|
110
|
+
<Splitter class="sp-sizes" style="block-size: 180px" x-model={() => s.sizes} onResized={() => s.moved++}>
|
|
111
|
+
<SplitPane size={160} minSize={80} padding="md" text="Left">
|
|
112
|
+
<p class="sp-note">Left</p>
|
|
113
|
+
</SplitPane>
|
|
114
|
+
<SplitPane minSize={80} padding="md" text="Middle">
|
|
115
|
+
<p class="sp-note">Middle</p>
|
|
116
|
+
</SplitPane>
|
|
117
|
+
<SplitPane size={160} minSize={80} padding="md" text="Right">
|
|
118
|
+
<p class="sp-note">Right</p>
|
|
119
|
+
</SplitPane>
|
|
120
|
+
</Splitter>
|
|
121
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
122
|
+
<Button text="Keep this layout" variant="outline" onclick={() => (s.kept = (s.sizes as number[] | null)?.slice() ?? null)} />
|
|
123
|
+
<Button text="Restore it" variant="outline" enabled={() => !!s.kept} onclick={() => (s.sizes = s.kept)} />
|
|
124
|
+
<Button text="Start again" variant="outline" onclick={() => (s.sizes = null)} />
|
|
125
|
+
<output class="sp-sizes-told">{() => `sizes: ${JSON.stringify(s.sizes)}, moved ${s.moved} times`}</output>
|
|
126
|
+
</Stack>
|
|
127
|
+
</Stack>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Keyboard
|
|
133
|
+
|
|
134
|
+
| Key | What it does |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `Tab` | Each handle that can move or hide a pane is a stop, between the panes it lies between. |
|
|
137
|
+
| `Arrow keys` | Left and Right (Up and Down one under the other) move the handle by `step` pixels, within the panes’ least and most sizes; the other way round in a right-to-left page. |
|
|
138
|
+
| `Home, End` | Give the pane before the handle its least, or its most. |
|
|
139
|
+
| `Enter` | Hides the pane before the handle, or shows it again; when that pane cannot be hidden, the one after. |
|
|
140
|
+
|
|
141
|
+
## Accessibility
|
|
142
|
+
|
|
143
|
+
| Topic | How |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| `A handle` | A `separator` named “Resize” in the kit language, with `aria-controls` on the pane before it, `aria-orientation`, and `aria-valuenow` as that pane’s share of the two beside the handle. |
|
|
146
|
+
| `Fold buttons` | Buttons named “Hide the pane” and “Show the pane”, out of the Tab order: Enter on the handle does the same. |
|
|
147
|
+
| `A hidden pane` | Out of sight and `inert`; focus inside it moves to the handle. |
|
|
148
|
+
| `Panes` | A pane with a `text` is a `region` of that name. |
|
|
149
|
+
|
|
150
|
+
## Styling
|
|
151
|
+
|
|
152
|
+
| Hook | What it is |
|
|
153
|
+
| --- | --- |
|
|
154
|
+
| `.mx-splitter` | The splitter. `data-orientation`, `data-dragging` while a handle is dragged. |
|
|
155
|
+
| `.mx-splitter__pane` | A pane (a `Panel`). `data-collapsed` while hidden. |
|
|
156
|
+
| `.mx-splitter__handle` | A handle. `data-resizable`, `data-dragging`. |
|
|
157
|
+
| `.mx-splitter__grip, .mx-splitter__fold, .mx-splitter__fold-glyph` | The grip in the middle of a handle, the fold buttons at either end of it (`data-side`), their arrows. |
|
|
158
|
+
|
|
159
|
+
### Component tokens
|
|
160
|
+
|
|
161
|
+
| Token | What it sets |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| `splitter.handle, .line, .grip, .fold, .fold-glyph, .pane` | Units: the handle (`focus`), the line along it (`active`, `disabled`), the grip (`active`, `disabled`), the fold buttons (`hover`, `pressed`, `focus`) and their arrows, a pane (`collapsed`). |
|
|
164
|
+
| `splitter.size, .line-width, .active-width, .grip-length, .grip-thickness` | The handle’s thickness, the line’s, the line’s under the pointer, the grip’s size. |
|
|
165
|
+
|
|
166
|
+
## API reference
|
|
167
|
+
|
|
168
|
+
### Splitter props
|
|
169
|
+
|
|
170
|
+
| Prop | Type | Default | Description |
|
|
171
|
+
| --- | --- | --- | --- |
|
|
172
|
+
| `orientation` | `Bind<LayoutOrientation>` | `'horizontal'` | `horizontal`: the panes side by side; `vertical`: one under the other. |
|
|
173
|
+
| `resizable` | `Bind<boolean>` | `true` | The handles can be dragged and moved with the keys (a pane’s own `resizable` wins). |
|
|
174
|
+
| `collapsible` | `Bind<boolean>` | `false` | Every pane can be hidden from the handle next to it (a pane’s own `collapsible` wins). |
|
|
175
|
+
| `step` | `Bind<number>` | `10` | Pixels an arrow key moves a handle. |
|
|
176
|
+
| `sizes` | `Bind<readonly (number \| string \| null)[] \| null>` | `null` | The panes’ sizes in pane order (pixels, a share or `null`); given, they take the place of the panes’ own `size`. After a drag or a key the pixels are written to `x-model`. |
|
|
177
|
+
|
|
178
|
+
### SplitPane props
|
|
179
|
+
|
|
180
|
+
| Prop | Type | Default | Description |
|
|
181
|
+
| --- | --- | --- | --- |
|
|
182
|
+
| `size` | `Bind<number \| string \| null>` | `null` | Pixels, a share (`'30%'`) of the room the shares divide, or `null` for an equal share of what is left. |
|
|
183
|
+
| `minSize, maxSize` | `Bind<number>`, `Bind<number \| null>` | `0`, `null` | The least and the most it gets, in pixels. |
|
|
184
|
+
| `collapsible` | `Bind<boolean \| undefined>` | `undefined` | The handles next to it can hide it; `undefined` follows the splitter. |
|
|
185
|
+
| `collapsed` | `Bind<boolean>` | `false` | Hidden, the neighbours taking its room. |
|
|
186
|
+
| `resizable` | `Bind<boolean>` | `true` | The handles next to it can change its size. |
|
|
187
|
+
| `key` | `Bind<string>` | `''` | Names the pane; the JSX `key` is read too. |
|
|
188
|
+
| `content` | `() => ComponentBase \| ComponentBase[]` | — | Content made with the pane, besides the JSX children. |
|
|
189
|
+
| `padding, scrollable, variant, text` | as `Panel` | | A pane is a `Panel`: its padding, its own scrolling, a frame, a name (a region). |
|
|
190
|
+
|
|
191
|
+
### Events, properties and methods
|
|
192
|
+
|
|
193
|
+
| Member | Kind | Description |
|
|
194
|
+
| --- | --- | --- |
|
|
195
|
+
| `onResizing` | event | A handle is being dragged (`handle`, `sizes` in pixels). |
|
|
196
|
+
| `onResized` | event | A drag ended or a key moved a handle (`handle`, `sizes`). |
|
|
197
|
+
| `onCollapsing` | event | A pane is about to be hidden or shown again (`pane`, `index`, `collapsed`, `byUser`); `cancel = true` leaves it. |
|
|
198
|
+
| `onCollapsed` | event | A pane was hidden or shown again. |
|
|
199
|
+
| `panes` | read-only | The panes in order, hidden ones too. |
|
|
200
|
+
| `currentSizes` | read-only | The panes’ pixels along the split now; 0 for a hidden pane. |
|
|
201
|
+
| `count` | read-only | How many panes there are. |
|
|
202
|
+
| `add(pane), insert(index, pane)` | `SplitPane` | Adds a pane at the end or at an index. |
|
|
203
|
+
| `remove(pane)` | `boolean` | Removes a pane and disposes it. |
|
|
204
|
+
| `collapse(pane), expand(pane)` | `boolean` | Hides a pane (by index or the pane itself), or shows it again; `onCollapsing` is asked first. A pane’s own `collapse()` and `expand()` do the same. |
|
package/docs/stepper.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Stepper
|
|
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
|
The steps of a longer task and where the user stands in them: an indicator and a text per step, a line between them, the steps before the current one completed. The [Wizard](wizard.md) adds a page and the buttons to each step.
|
|
6
6
|
|
|
@@ -10,16 +10,16 @@ The steps of a longer task and where the user stands in them: an indicator and a
|
|
|
10
10
|
import { Stepper } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
The current step is `value`: a step’s `key`, else its index; `x-model` binds it two-way.
|
|
15
|
+
The current step is `value`: a step’s `key`, else its index; `x-model` binds it two-way. Programmatically, `next()`, `previous()` and `goTo()` move it and `onStepChanged` tells.
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Button, Stack, Stepper } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A stepper bound with x-model, and one made
|
|
22
|
-
export default function
|
|
21
|
+
/** A stepper bound with x-model, and one made programmatically and moved with its own methods. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ step: 0 as string | number | null, at: 0, told: '' });
|
|
24
24
|
const coded = new Stepper({
|
|
25
25
|
label: 'Order',
|
package/docs/switch.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Switch
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
An on / off switch with its caption: a track with a thumb that slides, an optional on / off text inside or next to it, read-only and required. A native checkbox with the switch role underneath.
|
|
6
6
|
|
|
@@ -10,21 +10,21 @@ An on / off switch with its caption: a track with a thumb that slides, an option
|
|
|
10
10
|
import { Switch } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
Every prop takes a value or a function; `x-model` binds the value two-way. Created with `new`, the same properties are set
|
|
15
|
+
Every prop takes a value or a function; `x-model` binds the 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, Stack, Switch } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A switch bound to state with x-model, and switches created with `new` and added
|
|
22
|
-
export default function
|
|
21
|
+
/** A switch bound to state with x-model, and switches created with `new` and added programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ wifi: true, result: '' });
|
|
24
24
|
let added = 0;
|
|
25
25
|
let host: Stack | null = null;
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const addProgrammatic = () => {
|
|
28
28
|
const sw = new Switch({ label: `Feature ${++added}`, onText: 'On', offText: 'Off' });
|
|
29
29
|
sw.onValueChanged((e) => (s.result = `${sw.label}: ${e.value ? 'on' : 'off'}`));
|
|
30
30
|
host?.controls.add(sw);
|
|
@@ -35,7 +35,7 @@ export default function FromCode() {
|
|
|
35
35
|
<>
|
|
36
36
|
<Switch label="&Wi-Fi" x-model={() => s.wifi} helpText={() => (s.wifi ? 'Connected to Home.' : 'Not connected.')} />
|
|
37
37
|
<Stack orientation="horizontal" wrap align="center">
|
|
38
|
-
<Button text="Add a switch
|
|
38
|
+
<Button text="Add a switch programmatically" variant="outline" onclick={addProgrammatic} />
|
|
39
39
|
<output class="sw-result">{() => s.result}</output>
|
|
40
40
|
</Stack>
|
|
41
41
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
package/docs/tabdocs-dock.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Dock and floating windows
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
Documents and whole groups float in windows of their own in the page and dock again into the documents' groups or into dock areas around them, which fold to the manager's edge. The mouse, the keys and the code do the same, through the same events.
|
|
6
6
|
|
|
@@ -568,14 +568,14 @@ export function fileDocument(path: string, extra: TabDocumentOptions = {}): TabD
|
|
|
568
568
|
}
|
|
569
569
|
```
|
|
570
570
|
|
|
571
|
-
`
|
|
571
|
+
`FloatProgrammatically.tsx`
|
|
572
572
|
|
|
573
573
|
```tsx
|
|
574
574
|
import { Button, Stack, TabDocumentManager } from '@motifx-community/ui';
|
|
575
575
|
import { FILES, fileDocument } from './files';
|
|
576
576
|
|
|
577
577
|
/** Floating windows by code: float a document, move, resize and maximize its window, dock it back or to a side, close it. */
|
|
578
|
-
export default function
|
|
578
|
+
export default function FloatProgrammatically() {
|
|
579
579
|
const docs = new TabDocumentManager({ label: 'Files to float' });
|
|
580
580
|
docs.element.style.cssText = 'block-size: 28rem; inline-size: 100%';
|
|
581
581
|
for (const file of FILES.slice(0, 5)) docs.open(fileDocument(file.path), { index: 99 });
|
package/docs/tabdocs-drag.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Drag and drop
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
Tabs and whole groups dragged as in a code editor: along a strip, to another group, beside a group or along an edge of the layout, between two managers, and the same moves from the keyboard. Every drop goes through the methods and events of what it does.
|
|
6
6
|
|
package/docs/tabdocs-menus.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Menus and keys
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
The commands around the tabs: context menus on tabs and on the empty strip, a searchable list of a group's documents, the app's own toolbar buttons, the recently used list, back and forward, reopening what was closed, locked groups, and the keys for all of them.
|
|
6
6
|
|
package/docs/tabdocs-mobile.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Tablet and phone
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
On a tablet and a phone a layout of groups, splits and dock areas does not fit as it is. The manager keeps the layout and shows it another way: the same documents, groups and areas, the same saved JSON, the content moved and never made again. It goes by its own width, not by the device; on a touch screen its tabs and buttons get larger.
|
|
6
6
|
|
package/docs/tabdocs-tabs.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: Tabs
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
What a tab does in a code editor: preview tabs that the next preview replaces, pinned tabs that stay at the start, tabs that shrink, wrap or scroll, counts and colours, and the same document open in two groups.
|
|
6
6
|
|
package/docs/tabdocs-windows.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: New windows
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A document, a group or a floating window moves into a browser window of its own, and back. Its content moves with it, nothing is made again, and the new window is a part of the same manager: its tabs, menus, keys and drag work as they do here.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager: A whole workspace
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A whole screen made of the kit's parts: a menu bar, the manager, a DataGrid with everything turned on, forms and a tool docked at the bottom. Each part is the same component it is on its own page; the manager only holds them.
|
|
6
6
|
|
package/docs/tabdocs.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TabDocumentManager
|
|
2
2
|
|
|
3
|
-
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> TabDocumentManager · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A document manager in the way code editors arrange files: documents in tabs, tabs in groups, groups split side by side and one under the other. A document's content is any component, a form, a grid or plain text, and it is moved, never made again, when its tab goes to another group. Everything the user does is a method too, asks first and reports after; the whole layout saves to JSON and comes back. Preview and pinned tabs, sizes and copies are on [Tabs](tabdocs-tabs.md); context menus, lists and keys on [Menus and keys](tabdocs-menus.md).
|
|
6
6
|
|
|
@@ -131,7 +131,7 @@ export function customerCard(customer: Customer): ComponentBase {
|
|
|
131
131
|
}
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
##
|
|
134
|
+
## Programmatic use, and the events
|
|
135
135
|
|
|
136
136
|
Each thing the user does is also a method (`open`, `close`, `activate`, `split`, `move`, `closeGroup`, `focusGroup`, `maximizeGroup`, `restoreGroups`, `evenSizes`, `resizeGroup`), asks first through a cancelable `on…ing` event and reports through `on…ed`, with `byUser` telling the two apart.
|
|
137
137
|
|
|
@@ -731,7 +731,7 @@ export default function Options() {
|
|
|
731
731
|
}
|
|
732
732
|
```
|
|
733
733
|
|
|
734
|
-
`
|
|
734
|
+
`Programmatic.tsx`
|
|
735
735
|
|
|
736
736
|
```tsx
|
|
737
737
|
import { reactive } from '@motifx/core';
|
|
@@ -739,14 +739,14 @@ import { Button, Stack, TabDocumentManager, type SplitDirection } from '@motifx-
|
|
|
739
739
|
import { notes } from './contents';
|
|
740
740
|
|
|
741
741
|
/** Everything the user does is a method too; the events report each change, by the user or by code. */
|
|
742
|
-
export default function
|
|
742
|
+
export default function Programmatic() {
|
|
743
743
|
const log = reactive({ lines: [] as { id: number; text: string }[], next: 0, opened: 0 });
|
|
744
744
|
const write = (text: string) => {
|
|
745
745
|
log.lines.unshift({ id: log.next++, text });
|
|
746
746
|
if (log.lines.length > 6) log.lines.pop();
|
|
747
747
|
};
|
|
748
748
|
|
|
749
|
-
const docs = new TabDocumentManager({ label: 'Driven
|
|
749
|
+
const docs = new TabDocumentManager({ label: 'Driven programmatically' });
|
|
750
750
|
docs.element.style.cssText = 'block-size: 28rem; inline-size: 100%';
|
|
751
751
|
docs.onOpened((e) => write(`opened ${e.document.title} in group ${e.group.index + 1}`));
|
|
752
752
|
docs.onClosed((e) => write(`closed ${e.document.title}${e.byUser ? ' (user)' : ''}`));
|
package/docs/tabs.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Tabs
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
|
-
Tabs show one panel at a time under a strip of tabs: from JSX or
|
|
5
|
+
Tabs show one panel at a time under a strip of tabs: from JSX or programmatically, closable, with icons and badges, scroll buttons when the tabs do not fit, four placements and panels built when they are first shown.
|
|
6
6
|
|
|
7
7
|
## Import
|
|
8
8
|
|
|
@@ -10,22 +10,22 @@ Tabs show one panel at a time under a strip of tabs: from JSX or from code, clos
|
|
|
10
10
|
import { Tabs, Tab } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
A `<Tab>`'s children are its panel. `value` is the selected tab's `key` (else its index) and `x-model` binds it two-way. Created with `new`, tabs are added, inserted and removed
|
|
15
|
+
A `<Tab>`'s children are its panel. `value` is the selected tab's `key` (else its index) and `x-model` binds it two-way. Created with `new`, tabs are added, inserted and removed programmatically.
|
|
16
16
|
|
|
17
17
|
```tsx
|
|
18
18
|
import { reactive } from '@motifx/core';
|
|
19
19
|
import { Button, Stack, Tab, Tabs, TextBox } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** Tabs from JSX bound with x-model, and tabs created with `new` and added
|
|
22
|
-
export default function
|
|
21
|
+
/** Tabs from JSX bound with x-model, and tabs created with `new` and added programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ page: 'general' as string | number, name: '', log: '' });
|
|
24
24
|
let added = 0;
|
|
25
25
|
|
|
26
26
|
const reports = new Tabs({ label: 'Reports', closable: true });
|
|
27
27
|
reports.add(new Tab({ title: 'Summary', content: () => <p>The summary, built when it was first shown.</p> }));
|
|
28
|
-
reports.onSelectionChanged((e) => (s.log = e.tab ? `Selected “${e.tab.title}”${e.byUser ? ' by the user' : '
|
|
28
|
+
reports.onSelectionChanged((e) => (s.log = e.tab ? `Selected “${e.tab.title}”${e.byUser ? ' by the user' : ' programmatically'}.` : 'No tab left.'));
|
|
29
29
|
|
|
30
30
|
const addReport = () => {
|
|
31
31
|
const n = ++added;
|
|
@@ -48,7 +48,7 @@ export default function FromCode() {
|
|
|
48
48
|
</Tabs>
|
|
49
49
|
<output class="tabs-page">{() => `value: "${s.page}"`}</output>
|
|
50
50
|
<Stack orientation="horizontal" wrap align="center">
|
|
51
|
-
<Button text="Add a report
|
|
51
|
+
<Button text="Add a report programmatically" variant="outline" onclick={addReport} />
|
|
52
52
|
<output class="tabs-log">{() => s.log}</output>
|
|
53
53
|
</Stack>
|
|
54
54
|
<Stack orientation="horizontal" wrap align="center" class="tabs-coded" style="inline-size: 100%" onBuilt={(c) => c.controls.add(reports)} />
|
|
@@ -442,7 +442,7 @@ export default function Localization() {
|
|
|
442
442
|
| `add(tab)` | `Tab` | Adds a tab at the end. A tab of another `Tabs` moves here. |
|
|
443
443
|
| `insert(index, tab)` | `Tab` | Adds a tab at an index. |
|
|
444
444
|
| `remove(tab)` | `boolean` | Removes the tab and disposes it; no `onClose`. The selection and focus move to a neighbour. |
|
|
445
|
-
| `select(tab \| index)` | `boolean` | Selects a tab
|
|
445
|
+
| `select(tab \| index)` | `boolean` | Selects a tab programmatically; `false` when it is hidden or not there. |
|
|
446
446
|
| `close(tab)` | `boolean` | Closes a tab as its close button does: `onClose` can cancel it. |
|
|
447
447
|
| `focus()` | `boolean` | Focuses the selected tab. |
|
|
448
448
|
| `Tab.select(), Tab.close(), Tab.focus()` | `boolean` | The same, from the tab. |
|
package/docs/tagbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TagBox
|
|
2
2
|
|
|
3
|
-
> Data · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Data · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
Picks several items. The chosen ones are tags in the field, followed by a text input that searches the list; items come from memory or from a data source, and typed text can become a tag of its own.
|
|
6
6
|
|
|
@@ -11,9 +11,9 @@ import { TagBox } from '@motifx-community/ui';
|
|
|
11
11
|
import { data } from '@motifx-community/data';
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Declarative and programmatic
|
|
15
15
|
|
|
16
|
-
`x-model` binds an array; every change writes a new one. Created with `new`, the same properties are set
|
|
16
|
+
`x-model` binds an array; every change writes a new one. Created with `new`, the same properties are set programmatically.
|
|
17
17
|
|
|
18
18
|
```tsx
|
|
19
19
|
/** The skills the tag boxes of the examples pick from. */
|
|
@@ -265,20 +265,20 @@ export const skills = ['CSS', 'Go', 'HTML', 'Java', 'JavaScript', 'Kotlin', 'Pyt
|
|
|
265
265
|
|
|
266
266
|
## Example files
|
|
267
267
|
|
|
268
|
-
`
|
|
268
|
+
`Programmatic.tsx`
|
|
269
269
|
|
|
270
270
|
```tsx
|
|
271
271
|
import { reactive } from '@motifx/core';
|
|
272
272
|
import { Button, Stack, TagBox } from '@motifx-community/ui';
|
|
273
273
|
import { skills } from './skills';
|
|
274
274
|
|
|
275
|
-
/** A tag box bound to an array with x-model, and tag boxes created with `new` and added
|
|
276
|
-
export default function
|
|
275
|
+
/** A tag box bound to an array with x-model, and tag boxes created with `new` and added programmatically. */
|
|
276
|
+
export default function Programmatic() {
|
|
277
277
|
const form = reactive({ skills: ['TypeScript', 'CSS'] as string[], result: '' });
|
|
278
278
|
let added = 0;
|
|
279
279
|
let host: Stack | null = null;
|
|
280
280
|
|
|
281
|
-
const
|
|
281
|
+
const addProgrammatic = () => {
|
|
282
282
|
const tags = new TagBox<string, string>({ label: `Skills ${++added}`, items: skills, placeholder: 'Pick some' });
|
|
283
283
|
tags.onValueChanged((e) => (form.result = `${tags.label}: ${e.value.join(', ')}`));
|
|
284
284
|
host?.controls.add(tags);
|
|
@@ -290,7 +290,7 @@ export default function FromCode() {
|
|
|
290
290
|
<TagBox label="&Skills" items={skills} x-model={() => form.skills} stretch />
|
|
291
291
|
<Stack orientation="horizontal" wrap align="center">
|
|
292
292
|
<output class="tg-skills">{() => `skills: ${JSON.stringify(form.skills)}`}</output>
|
|
293
|
-
<Button text="Add a tag box
|
|
293
|
+
<Button text="Add a tag box programmatically" variant="outline" onclick={addProgrammatic} />
|
|
294
294
|
<output class="tg-made">{() => form.result}</output>
|
|
295
295
|
</Stack>
|
|
296
296
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
package/docs/textarea.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TextArea
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A text field of several lines: a box that grows with the text or that the user drags bigger, a character counter, a clear button, Ctrl+Enter to send, and the label, help text and validation every field has.
|
|
6
6
|
|
|
@@ -10,21 +10,21 @@ A text field of several lines: a box that grows with the text or that the user d
|
|
|
10
10
|
import { TextArea, type TextAreaProps } from '@motifx-community/ui';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Declarative and programmatic
|
|
14
14
|
|
|
15
|
-
Every prop takes a value or a function; `x-model` binds the text two-way. Created with `new`, the same properties are set
|
|
15
|
+
Every prop takes a value or a function; `x-model` binds the text 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, Stack, TextArea } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A textarea bound with x-model, and notes created with `new` and added
|
|
22
|
-
export default function
|
|
21
|
+
/** A textarea bound with x-model, and notes created with `new` and added programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const s = reactive({ comment: 'MotifJS keeps the DOM it builds.', log: '' });
|
|
24
24
|
let added = 0;
|
|
25
25
|
let host: Stack | null = null;
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const addProgrammatic = () => {
|
|
28
28
|
const note = new TextArea({ label: `Note ${++added}`, rows: 2, autoGrow: true, maxRows: 5, clearButton: true });
|
|
29
29
|
note.onValueChanged((e) => (s.log = `${note.label}: ${e.value.split('\n').length} line(s)`));
|
|
30
30
|
host?.controls.add(note);
|
|
@@ -35,7 +35,7 @@ export default function FromCode() {
|
|
|
35
35
|
<>
|
|
36
36
|
<TextArea label="&Comment" x-model={() => s.comment} helpText={() => `${s.comment.length} characters`} stretch />
|
|
37
37
|
<Stack orientation="horizontal" wrap align="center">
|
|
38
|
-
<Button text="Add a note
|
|
38
|
+
<Button text="Add a note programmatically" variant="outline" onclick={addProgrammatic} />
|
|
39
39
|
<output class="ta-log">{() => s.log}</output>
|
|
40
40
|
</Stack>
|
|
41
41
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
package/docs/textbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TextBox
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.3
|
|
4
4
|
|
|
5
5
|
A one-line text field with its label, help text and error: placeholder, prefix and suffix, buttons in the box, a clear button, a password that can be shown, a character counter, an input mask and validation — alone, in a group, or every field in a panel.
|
|
6
6
|
|
|
@@ -10,21 +10,21 @@ A one-line text field with its label, help text and error: placeholder, prefix a
|
|
|
10
10
|
import { TextBox, ValidationGroup, validateFields, type ValidationRule } 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 field in step with it. `x-model` binds the value two-way. 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 field in step with it. `x-model` binds the 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, Stack, TextBox } from '@motifx-community/ui';
|
|
20
20
|
|
|
21
|
-
/** A field bound to state with x-model, and fields created with `new` and added
|
|
22
|
-
export default function
|
|
21
|
+
/** A field bound to state with x-model, and fields created with `new` and added programmatically. */
|
|
22
|
+
export default function Programmatic() {
|
|
23
23
|
const form = reactive({ name: 'Ada', result: '' });
|
|
24
24
|
let added = 0;
|
|
25
25
|
let host: Stack | null = null;
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const addProgrammatic = () => {
|
|
28
28
|
const box = new TextBox({ label: `Field ${++added}`, clearButton: true, placeholder: 'Created with new' });
|
|
29
29
|
box.onValueChanged((e) => (form.result = `${box.label}: ${e.value}`));
|
|
30
30
|
host?.controls.add(box);
|
|
@@ -35,7 +35,7 @@ export default function FromCode() {
|
|
|
35
35
|
<>
|
|
36
36
|
<TextBox label="&Name" x-model={() => form.name} clearButton helpText={() => `Hello, ${form.name || 'stranger'}.`} />
|
|
37
37
|
<Stack orientation="horizontal" wrap align="center">
|
|
38
|
-
<Button text="Add a field
|
|
38
|
+
<Button text="Add a field programmatically" variant="outline" onclick={addProgrammatic} />
|
|
39
39
|
<output class="tb-result">{() => form.result}</output>
|
|
40
40
|
</Stack>
|
|
41
41
|
<Stack orientation="horizontal" wrap align="center" ref={(c: Stack) => (host = c)} />
|
|
@@ -428,7 +428,7 @@ export default function Localization() {
|
|
|
428
428
|
|
|
429
429
|
| Event | When |
|
|
430
430
|
| --- | --- |
|
|
431
|
-
| `onValueChanged(e)` | The value changed. `e`: `{ value, previousValue, byUser, source, event? }`; `byUser` tells the user
|
|
431
|
+
| `onValueChanged(e)` | The value changed. `e`: `{ value, previousValue, byUser, source, event? }`; `byUser` tells the user programmatically. |
|
|
432
432
|
| `onValidated(e)` | A check ended. `e`: `{ valid, message, source }`. |
|
|
433
433
|
| `onEnter(e)` | Enter was pressed. `e`: `{ value, source, event }`. |
|
|
434
434
|
| `oninput, onchange, onkeydown, onfocusin, onfocusout` | The DOM events of the input reach the field. |
|