@motifx-community/ui 0.1.0-beta.5 → 0.1.0-beta.6
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 -0
- package/README.md +7 -4
- package/dist/components/appbar/AppBar.d.ts +88 -0
- package/dist/components/appbar/app-bar-navigation-click-event-args.d.ts +9 -0
- package/dist/components/appbar/app-bar-navigation.d.ts +2 -0
- package/dist/components/appbar/app-bar-position.d.ts +2 -0
- package/dist/components/appbar/app-bar-props.d.ts +49 -0
- package/dist/components/appbar/app-bar-scroll-behavior.d.ts +2 -0
- package/dist/components/appbar/app-bar-title-align.d.ts +2 -0
- package/dist/components/appbar/app-bar-tone.d.ts +2 -0
- package/dist/components/appbar/index.d.ts +8 -0
- package/dist/components/barcode/Barcode.d.ts +62 -0
- package/dist/components/barcode/barcode-export-options.d.ts +9 -0
- package/dist/components/barcode/barcode-failed-event-args.d.ts +9 -0
- package/dist/components/barcode/barcode-props.d.ts +25 -0
- package/dist/components/barcode/index.d.ts +5 -0
- package/dist/components/bargauge/BarGauge.d.ts +120 -0
- package/dist/components/bargauge/bar-gauge-props.d.ts +38 -0
- package/dist/components/bargauge/index.d.ts +2 -0
- package/dist/components/bottomnavigation/BottomNavigation.d.ts +101 -0
- package/dist/components/bottomnavigation/bottom-navigation-item-click-event-args.d.ts +9 -0
- package/dist/components/bottomnavigation/bottom-navigation-item.d.ts +35 -0
- package/dist/components/bottomnavigation/bottom-navigation-label-mode.d.ts +2 -0
- package/dist/components/bottomnavigation/bottom-navigation-position.d.ts +2 -0
- package/dist/components/bottomnavigation/bottom-navigation-props.d.ts +31 -0
- package/dist/components/bottomnavigation/bottom-navigation-selecting-event-args.d.ts +5 -0
- package/dist/components/bottomnavigation/bottom-navigation-selection-changed-event-args.d.ts +11 -0
- package/dist/components/bottomnavigation/index.d.ts +8 -0
- package/dist/components/chart/Chart.d.ts +229 -0
- package/dist/components/chart/ChartLegend.d.ts +24 -0
- package/dist/components/chart/ChartPlot.d.ts +161 -0
- package/dist/components/chart/ChartTable.d.ts +68 -0
- package/dist/components/chart/ChartTooltip.d.ts +22 -0
- package/dist/components/chart/PartsPlot.d.ts +39 -0
- package/dist/components/chart/RadarPlot.d.ts +34 -0
- package/dist/components/chart/chart-axis-kind.d.ts +2 -0
- package/dist/components/chart/chart-axis.d.ts +31 -0
- package/dist/components/chart/chart-data-error-event-args.d.ts +7 -0
- package/dist/components/chart/chart-export-options.d.ts +7 -0
- package/dist/components/chart/chart-export.d.ts +12 -0
- package/dist/components/chart/chart-field.d.ts +2 -0
- package/dist/components/chart/chart-labels.d.ts +2 -0
- package/dist/components/chart/chart-legend-options.d.ts +10 -0
- package/dist/components/chart/chart-legend-position.d.ts +2 -0
- package/dist/components/chart/chart-look.d.ts +25 -0
- package/dist/components/chart/chart-mode-changed-event-args.d.ts +7 -0
- package/dist/components/chart/chart-mode.d.ts +2 -0
- package/dist/components/chart/chart-model.d.ts +105 -0
- package/dist/components/chart/chart-point-event-args.d.ts +9 -0
- package/dist/components/chart/chart-point-selection.d.ts +2 -0
- package/dist/components/chart/chart-point.d.ts +23 -0
- package/dist/components/chart/chart-props.d.ts +76 -0
- package/dist/components/chart/chart-reference.d.ts +12 -0
- package/dist/components/chart/chart-selection-changed-event-args.d.ts +8 -0
- package/dist/components/chart/chart-series-toggled-event-args.d.ts +10 -0
- package/dist/components/chart/chart-series-type.d.ts +6 -0
- package/dist/components/chart/chart-series.d.ts +55 -0
- package/dist/components/chart/chart-stacked.d.ts +2 -0
- package/dist/components/chart/chart-tooltip-context.d.ts +10 -0
- package/dist/components/chart/chart-tooltip-options.d.ts +10 -0
- package/dist/components/chart/chart-zoom-changed-event-args.d.ts +8 -0
- package/dist/components/chart/index.d.ts +21 -0
- package/dist/components/chart/legend-entry.d.ts +13 -0
- package/dist/components/chart/plot-text.d.ts +10 -0
- package/dist/components/chart/plot-view.d.ts +61 -0
- package/dist/components/datagrid/grid-settings.d.ts +3 -3
- package/dist/components/datagrid/model/GridData.d.ts +22 -3
- package/dist/components/gauge/Gauge.d.ts +179 -0
- package/dist/components/gauge/gauge-mark.d.ts +9 -0
- package/dist/components/gauge/gauge-marker.d.ts +2 -0
- package/dist/components/gauge/gauge-needle-shape.d.ts +2 -0
- package/dist/components/gauge/gauge-orientation.d.ts +2 -0
- package/dist/components/gauge/gauge-props.d.ts +58 -0
- package/dist/components/gauge/gauge-range.d.ts +11 -0
- package/dist/components/gauge/gauge-scale.d.ts +2 -0
- package/dist/components/gauge/gauge-shape.d.ts +43 -0
- package/dist/components/gauge/gauge-type.d.ts +2 -0
- package/dist/components/gauge/index.d.ts +9 -0
- package/dist/components/otpinput/OtpInput.d.ts +73 -0
- package/dist/components/otpinput/index.d.ts +4 -0
- package/dist/components/otpinput/otp-charset.d.ts +2 -0
- package/dist/components/otpinput/otp-completed-event-args.d.ts +8 -0
- package/dist/components/otpinput/otp-input-props.d.ts +32 -0
- package/dist/components/qrcode/QRCode.d.ts +58 -0
- package/dist/components/qrcode/index.d.ts +5 -0
- package/dist/components/qrcode/qr-code-export-options.d.ts +9 -0
- package/dist/components/qrcode/qr-code-failed-event-args.d.ts +7 -0
- package/dist/components/qrcode/qr-code-props.d.ts +23 -0
- package/dist/components/signature/Signature.d.ts +100 -0
- package/dist/components/signature/index.d.ts +5 -0
- package/dist/components/signature/signature-draw.d.ts +15 -0
- package/dist/components/signature/signature-export-options.d.ts +11 -0
- package/dist/components/signature/signature-props.d.ts +30 -0
- package/dist/components/signature/signature-stroke-event-args.d.ts +9 -0
- package/dist/components/signature/signature-stroke.d.ts +11 -0
- package/dist/components/sparkline/Sparkline.d.ts +85 -0
- package/dist/components/sparkline/index.d.ts +4 -0
- package/dist/components/sparkline/sparkline-highlight.d.ts +2 -0
- package/dist/components/sparkline/sparkline-props.d.ts +34 -0
- package/dist/components/sparkline/sparkline-type.d.ts +2 -0
- package/dist/components/validationsummary/ValidationSummary.d.ts +1 -0
- package/dist/core/fonts-loaded.d.ts +2 -0
- package/dist/core/scroll-watch.d.ts +13 -0
- package/dist/core/ui-strings.d.ts +38 -0
- package/dist/generated/tokens.d.ts +3023 -863
- package/dist/index.d.ts +10 -0
- package/dist/index.js +55999 -47313
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +37 -1
- package/dist/locales/tr.json +37 -1
- package/dist/parts/chart/chart-paths.d.ts +30 -0
- package/dist/parts/chart/chart-scale.d.ts +13 -0
- package/dist/parts/chart/chart-text.d.ts +12 -0
- package/dist/parts/chart/nice-ticks.d.ts +6 -0
- package/dist/parts/chart/svg-parts.d.ts +12 -0
- package/dist/parts/chart/thin-out.d.ts +6 -0
- package/dist/parts/chart/time-ticks.d.ts +7 -0
- package/dist/parts/chart/token-lengths.d.ts +16 -0
- package/dist/parts/chart/value-motion.d.ts +16 -0
- package/dist/parts/code/barcode-encode.d.ts +23 -0
- package/dist/parts/code/code-image.d.ts +35 -0
- package/dist/parts/code/qr-encode.d.ts +10 -0
- package/dist/parts/field/Field.d.ts +2 -0
- package/dist/styles.css +3043 -9
- package/dist/tokens/index.d.ts +3212 -967
- package/dist/tokens/index.js +3023 -863
- package/dist/tokens/index.js.map +1 -1
- package/dist/{tr-C5IXRzAH.js → tr-DhIFcH3c.js} +75 -3
- package/dist/{tr-C5IXRzAH.js.map → tr-DhIFcH3c.js.map} +1 -1
- package/docs/accordion.md +1 -1
- package/docs/actionsheet.md +1 -1
- package/docs/appbar.md +194 -0
- package/docs/avatar.md +1 -1
- package/docs/badge.md +1 -1
- package/docs/bar-gauge-angles.md +87 -0
- package/docs/bar-gauge-data.md +122 -0
- package/docs/bar-gauge-labels.md +78 -0
- package/docs/bar-gauge.md +98 -0
- package/docs/barcode.md +193 -0
- package/docs/bottomnavigation.md +258 -0
- package/docs/bottomsheet.md +1 -1
- package/docs/breadcrumb.md +1 -1
- package/docs/button.md +1 -1
- package/docs/buttongroup.md +1 -1
- package/docs/buttons.md +169 -0
- package/docs/calendar.md +1 -1
- package/docs/card.md +1 -1
- package/docs/chart-bars.md +142 -0
- package/docs/chart-candles.md +164 -0
- package/docs/chart-funnel.md +115 -0
- package/docs/chart-heatmap.md +93 -0
- package/docs/chart-lines.md +128 -0
- package/docs/chart-live.md +62 -0
- package/docs/chart-pie.md +125 -0
- package/docs/chart-radar.md +124 -0
- package/docs/chart-ranges.md +127 -0
- package/docs/chart-references.md +126 -0
- package/docs/chart-scatter.md +139 -0
- package/docs/chart-waterfall.md +111 -0
- package/docs/chart-zoom.md +95 -0
- package/docs/chart.md +427 -0
- package/docs/checkbox.md +1 -1
- package/docs/chip.md +1 -1
- package/docs/choice.md +151 -0
- package/docs/colorbox.md +1 -1
- package/docs/combobox.md +1 -1
- package/docs/control.md +1 -1
- package/docs/data.md +127 -0
- package/docs/datagrid-api.md +1 -1
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +1 -1
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +1 -1
- package/docs/datagrid-filtering.md +1 -1
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +62 -2
- package/docs/datagrid-layout.md +2 -2
- package/docs/datagrid-lookups.md +1 -1
- package/docs/datagrid-master-detail.md +1 -1
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +1 -1
- package/docs/datagrid.md +1 -1
- package/docs/datebox.md +1 -1
- package/docs/daterangebox.md +1 -1
- package/docs/display.md +148 -0
- package/docs/draggable.md +1 -1
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +1 -1
- package/docs/editors.md +157 -0
- package/docs/feedback.md +138 -0
- package/docs/fileuploader.md +1 -1
- package/docs/filterbuilder.md +1 -1
- package/docs/formlayout.md +1 -1
- package/docs/foundations.md +79 -0
- package/docs/gallery.md +1 -1
- package/docs/gauge-base.md +78 -0
- package/docs/gauge-circular.md +101 -0
- package/docs/gauge-dashboards.md +134 -0
- package/docs/gauge-linear.md +84 -0
- package/docs/gauge-markers.md +135 -0
- package/docs/gauge-marks.md +108 -0
- package/docs/gauge-ranges.md +133 -0
- package/docs/gauge-scales.md +117 -0
- package/docs/gauge.md +152 -0
- package/docs/home.md +1 -1
- package/docs/keyboard.md +1 -1
- package/docs/language.md +1 -1
- package/docs/layout.md +1 -1
- package/docs/listbox.md +1 -1
- package/docs/loadpanel.md +1 -1
- package/docs/lookup.md +1 -1
- package/docs/menus.md +1 -1
- package/docs/multiview.md +1 -1
- package/docs/navigation.md +143 -0
- package/docs/numberbox.md +1 -1
- package/docs/otpinput.md +197 -0
- package/docs/pagination.md +1 -1
- package/docs/popover.md +1 -1
- package/docs/progress.md +1 -1
- package/docs/qrcode.md +179 -0
- package/docs/radiogroup.md +1 -1
- package/docs/rating.md +1 -1
- package/docs/resizable.md +1 -1
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +1 -1
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +1 -1
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +1 -1
- package/docs/scrollview.md +1 -1
- package/docs/showcase-home.md +31 -0
- package/docs/showcase.md +1 -1
- package/docs/signature.md +208 -0
- package/docs/skeleton.md +1 -1
- package/docs/slider.md +1 -1
- package/docs/sortable.md +1 -1
- package/docs/sparkline.md +119 -0
- package/docs/speeddial.md +1 -1
- package/docs/splitter.md +1 -1
- package/docs/stepper.md +1 -1
- package/docs/switch.md +1 -1
- package/docs/tabdocs-dock.md +1 -1
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +1 -1
- package/docs/tabs.md +1 -1
- package/docs/tagbox.md +1 -1
- package/docs/textarea.md +1 -1
- package/docs/textbox.md +1 -1
- package/docs/tileview.md +1 -1
- package/docs/timeline.md +1 -1
- package/docs/toast.md +1 -1
- package/docs/tokens.md +450 -1
- package/docs/toolbar.md +1 -1
- package/docs/tooltip.md +1 -1
- package/docs/treeview.md +1 -1
- package/docs/validationsummary.md +1 -1
- package/docs/window.md +1 -1
- package/docs/wizard.md +1 -1
- package/llms-full.txt +6724 -98
- package/llms.txt +50 -1
- package/package.json +5 -5
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Gauge: Ranges
|
|
2
|
+
|
|
3
|
+
> Gauges · @motifx-community/ui 0.1.0-beta.6
|
|
4
|
+
|
|
5
|
+
Ranges give stretches of the scale a meaning, such as normal, high and critical. They show as a band beside the track, and the fill takes the color of the range its value is in.
|
|
6
|
+
|
|
7
|
+
## Tones
|
|
8
|
+
|
|
9
|
+
`tone` takes a meaning in the colors of the design language: `good`, `warning`, `danger` or `neutral`. The fill changes color where it crosses into a range.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { reactive } from '@motifx/core';
|
|
13
|
+
import { Gauge, Slider, Stack } from '@motifx-community/ui';
|
|
14
|
+
|
|
15
|
+
/** The fill takes the tone of the range its value is in; the ranges show as a band outside the track. */
|
|
16
|
+
export default function Ranges() {
|
|
17
|
+
const s = reactive({ cpu: 64 });
|
|
18
|
+
return (
|
|
19
|
+
<Stack gap="md">
|
|
20
|
+
<Gauge
|
|
21
|
+
class="ga-ranges"
|
|
22
|
+
value={() => s.cpu}
|
|
23
|
+
label="CPU"
|
|
24
|
+
format={{ style: 'unit', unit: 'percent' }}
|
|
25
|
+
ranges={[
|
|
26
|
+
{ from: 0, to: 70, tone: 'good', label: 'normal' },
|
|
27
|
+
{ from: 70, to: 90, tone: 'warning', label: 'high' },
|
|
28
|
+
{ from: 90, to: 100, tone: 'danger', label: 'critical' }
|
|
29
|
+
]}
|
|
30
|
+
/>
|
|
31
|
+
<Slider label="CPU" x-model={() => s.cpu} min={0} max={100} />
|
|
32
|
+
</Stack>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Colors of your own
|
|
38
|
+
|
|
39
|
+
`color` takes any color instead of a tone.
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { Gauge, Stack } from '@motifx-community/ui';
|
|
43
|
+
|
|
44
|
+
const BANDS = [
|
|
45
|
+
{ from: 0, to: 18.5, color: '#4f8fd8', label: 'under' },
|
|
46
|
+
{ from: 18.5, to: 25, color: '#3c9a5f', label: 'normal' },
|
|
47
|
+
{ from: 25, to: 30, color: '#d9a400', label: 'over' },
|
|
48
|
+
{ from: 30, to: 40, color: '#c8463b', label: 'high' }
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
/** Ranges in colors of your own. A color is never the only sign: the range's name is read with the value. */
|
|
52
|
+
export default function OwnColors() {
|
|
53
|
+
return (
|
|
54
|
+
<Stack orientation="horizontal" gap="lg" wrap align="end">
|
|
55
|
+
<Gauge class="ga-own" value={23.4} min={10} max={40} ranges={BANDS} scale="ticks" ticks={[10, 18.5, 25, 30, 40]} label="Body mass index" />
|
|
56
|
+
<Gauge type="linear" value={27.1} min={10} max={40} ranges={BANDS} scale="ticks" ticks={[10, 18.5, 25, 30, 40]} label="Body mass index" style="flex: 1 1 16rem" />
|
|
57
|
+
</Stack>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Chart colors
|
|
63
|
+
|
|
64
|
+
A range with neither a tone nor a color takes the next chart color, so ranges without a meaning of good or bad still read apart.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { Gauge, Stack } from '@motifx-community/ui';
|
|
68
|
+
|
|
69
|
+
const PRESSURE = [
|
|
70
|
+
{ from: 900, to: 1000, label: 'low' },
|
|
71
|
+
{ from: 1000, to: 1020, label: 'normal' },
|
|
72
|
+
{ from: 1020, to: 1100, label: 'high' }
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
/** Ranges with neither a tone nor a color take the chart colors in order. */
|
|
76
|
+
export default function ChartColors() {
|
|
77
|
+
return (
|
|
78
|
+
<Stack orientation="horizontal" gap="xl" wrap align="end">
|
|
79
|
+
<Gauge class="ga-chart-colors" value={1016} min={900} max={1100} ranges={PRESSURE} scale="ticks" ticks={[900, 1000, 1020, 1100]} label="Pressure (hPa)" />
|
|
80
|
+
<Gauge type="linear" orientation="vertical" size={200} value={1016} min={900} max={1100} ranges={PRESSURE} fill={false} marker="circle"
|
|
81
|
+
scale="ticks" ticks={[900, 1000, 1020, 1100]} label="Pressure (hPa)" />
|
|
82
|
+
</Stack>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Read with the value
|
|
88
|
+
|
|
89
|
+
A range's `label` is read with the value by assistive technology, so the meaning does not rest on color alone.
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { reactive } from '@motifx/core';
|
|
93
|
+
import { Gauge, Slider, Stack } from '@motifx-community/ui';
|
|
94
|
+
|
|
95
|
+
const RANGES = [
|
|
96
|
+
{ from: 0, to: 60, tone: 'good' as const, label: 'quiet' },
|
|
97
|
+
{ from: 60, to: 85, tone: 'warning' as const, label: 'loud' },
|
|
98
|
+
{ from: 85, to: 120, tone: 'danger' as const, label: 'harmful' }
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const decibels = (v: number) => `${v} dB`;
|
|
102
|
+
|
|
103
|
+
/** What assistive technology reads: the value with the name of its range, shown here under the gauge. */
|
|
104
|
+
export default function ReadRange() {
|
|
105
|
+
const s = reactive({ level: 52, read: '' });
|
|
106
|
+
// Shows the text the gauge gives assistive technology each time it changes.
|
|
107
|
+
const follow = (gauge: Gauge) => {
|
|
108
|
+
const show = () => (s.read = gauge.element.getAttribute('aria-valuetext') ?? '');
|
|
109
|
+
new MutationObserver(show).observe(gauge.element, { attributes: true, attributeFilter: ['aria-valuetext'] });
|
|
110
|
+
show();
|
|
111
|
+
};
|
|
112
|
+
return (
|
|
113
|
+
<Stack gap="md" align="start">
|
|
114
|
+
<Gauge ref={follow} class="ga-read" value={() => s.level} max={120} ranges={RANGES}
|
|
115
|
+
format={decibels} label="Noise" />
|
|
116
|
+
<output class="ga-read-out">{() => `Read as: ${s.read}`}</output>
|
|
117
|
+
<Slider label="Noise" x-model={() => s.level} min={0} max={120} />
|
|
118
|
+
</Stack>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Props on this page
|
|
124
|
+
|
|
125
|
+
| Prop | Type | Default | Description |
|
|
126
|
+
| --- | --- | --- | --- |
|
|
127
|
+
| `ranges` | `Bind<GaugeRange[]>` | `[]` | Stretches of the scale: `from`, `to`, `tone` or `color`, and a `label` read with the value. A range with neither a tone nor a color takes the next chart color. |
|
|
128
|
+
|
|
129
|
+
Every other prop, and the types of ranges and marks, are on the [Overview](gauge.md#api).
|
|
130
|
+
|
|
131
|
+
## Feedback
|
|
132
|
+
|
|
133
|
+
Loading issues…
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Gauge: Scales
|
|
2
|
+
|
|
3
|
+
> Gauges · @motifx-community/ui 0.1.0-beta.6
|
|
4
|
+
|
|
5
|
+
The scale tells the reader how to read the value: its ends, ticks with their values, or nothing at all.
|
|
6
|
+
|
|
7
|
+
## Ticks
|
|
8
|
+
|
|
9
|
+
`scale: 'ticks'` draws ticks with their values. `tickInterval` sets the step, or an even step that fits the size is chosen. `minorTicks` puts small ticks between them.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Gauge, Stack } from '@motifx-community/ui';
|
|
13
|
+
|
|
14
|
+
/** Ticks every 100 with three small ones between, and ticks at an even step chosen for the size. */
|
|
15
|
+
export default function Ticks() {
|
|
16
|
+
return (
|
|
17
|
+
<Stack orientation="horizontal" gap="lg" wrap align="end">
|
|
18
|
+
<Gauge class="ga-minor" value={750} max={1000} scale="ticks" tickInterval={100} minorTicks={3} label="Fan speed (rpm)" />
|
|
19
|
+
<Gauge value={63} scale="ticks" label="Even step" />
|
|
20
|
+
<Gauge type="linear" orientation="vertical" size={180} value={63} scale="ticks" minorTicks={1} label="Upright" />
|
|
21
|
+
</Stack>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Ticks of your own
|
|
27
|
+
|
|
28
|
+
`ticks` places ticks only at the values given, where they mean something.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { Gauge, Stack } from '@motifx-community/ui';
|
|
32
|
+
|
|
33
|
+
/** Ticks only where they mean something: the reserve, half and full; the limits of normal pressure. */
|
|
34
|
+
export default function OwnTicks() {
|
|
35
|
+
return (
|
|
36
|
+
<Stack orientation="horizontal" gap="xl" wrap align="end">
|
|
37
|
+
<Gauge class="ga-custom" type="linear" orientation="vertical" size={180} value={35} max={50} scale="ticks" ticks={[0, 10, 25, 50]} label="Fuel (l)" />
|
|
38
|
+
<Gauge value={1016} min={900} max={1100} scale="ticks" ticks={[900, 1000, 1020, 1100]} label="Pressure (hPa)" />
|
|
39
|
+
</Stack>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## A scale that runs down
|
|
45
|
+
|
|
46
|
+
A `min` above `max` runs the scale the other way, for what is counted down.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { Gauge, Stack } from '@motifx-community/ui';
|
|
50
|
+
|
|
51
|
+
/** A scale from 100 down to 0: what is left, counted down. */
|
|
52
|
+
export default function Reversed() {
|
|
53
|
+
return (
|
|
54
|
+
<Stack orientation="horizontal" gap="xl" wrap align="end">
|
|
55
|
+
<Gauge class="ga-down" value={30} min={100} max={0} scale="ticks" tickInterval={20} label="Remaining" />
|
|
56
|
+
<Gauge type="linear" orientation="vertical" size={180} value={30} min={100} max={0} scale="ticks" tickInterval={25} label="Depth (m)" />
|
|
57
|
+
</Stack>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Formats
|
|
63
|
+
|
|
64
|
+
`format` writes the value and the scale: options of the browser's number format, in the language of the page, or a function of your own.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { Gauge, Stack } from '@motifx-community/ui';
|
|
68
|
+
|
|
69
|
+
const degrees = (v: number) => `${v}°`;
|
|
70
|
+
|
|
71
|
+
/** Values as a percentage, as money, and through a function of your own. */
|
|
72
|
+
export default function Formats() {
|
|
73
|
+
return (
|
|
74
|
+
<Stack orientation="horizontal" gap="lg" wrap align="end">
|
|
75
|
+
<Gauge angle={180} value={45} scale="ticks" tickInterval={25} format={{ style: 'unit', unit: 'percent' }} label="Battery" />
|
|
76
|
+
<Gauge angle={180} value={7400} max={10000} scale="ticks" tickInterval={2500} format={{ style: 'currency', currency: 'EUR', notation: 'compact' }} label="Budget" />
|
|
77
|
+
<Gauge class="ga-degrees" angle={180} value={20} min={-45} max={45} scale="ticks" tickInterval={45} format={degrees} label="Angle" />
|
|
78
|
+
</Stack>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Ends, ticks or nothing
|
|
84
|
+
|
|
85
|
+
`scale` shows the two ends, `'ends'`, ticks, `'ticks'`, or nothing, `'none'`, where the value alone is enough.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { Gauge, Stack } from '@motifx-community/ui';
|
|
89
|
+
|
|
90
|
+
/** The two ends, ticks with their values, and no scale at all. */
|
|
91
|
+
export default function ScaleModes() {
|
|
92
|
+
return (
|
|
93
|
+
<Stack orientation="horizontal" gap="lg" wrap align="end">
|
|
94
|
+
<Gauge value={58} scale="ends" label="Ends" />
|
|
95
|
+
<Gauge value={58} scale="ticks" tickInterval={25} label="Ticks" />
|
|
96
|
+
<Gauge value={58} scale="none" label="None" />
|
|
97
|
+
</Stack>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Props on this page
|
|
103
|
+
|
|
104
|
+
| Prop | Type | Default | Description |
|
|
105
|
+
| --- | --- | --- | --- |
|
|
106
|
+
| `scale` | `Bind<'ends' \| 'ticks' \| 'none'>` | `'ends'` | What the scale shows. |
|
|
107
|
+
| `ticks` | `Bind<number[] \| null>` | `null` | The values of the ticks. |
|
|
108
|
+
| `tickInterval` | `Bind<number \| null>` | An even step | How far apart the ticks are. |
|
|
109
|
+
| `minorTicks` | `Bind<number>` | `0` | How many small ticks go between two ticks. |
|
|
110
|
+
| `min, max` | `Bind<number>` | `0`, `100` | The ends of the scale. A `min` above `max` runs the scale the other way. |
|
|
111
|
+
| `format` | `Bind<ChartFormat \| null>` | The language's numbers | How the values read: options of the browser's number format, or a function of your own. |
|
|
112
|
+
|
|
113
|
+
Every other prop, and the types of ranges and marks, are on the [Overview](gauge.md#api).
|
|
114
|
+
|
|
115
|
+
## Feedback
|
|
116
|
+
|
|
117
|
+
Loading issues…
|
package/docs/gauge.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Gauge
|
|
2
|
+
|
|
3
|
+
> Gauges · @motifx-community/ui 0.1.0-beta.6
|
|
4
|
+
|
|
5
|
+
Shows a value against its scale, as an arc, a circle or a straight bar. Ranges give stretches of the scale a meaning, markers and marks point at values, and every part takes its look from the design language.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Gauge } from '@motifx-community/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## A first gauge
|
|
14
|
+
|
|
15
|
+
`value` is the value and `label` says what it measures; the scale runs from `min` to `max`, 0 to 100 by default. A function as the value is followed, so the gauge moves with the data.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { reactive } from '@motifx/core';
|
|
19
|
+
import { Gauge, Slider, Stack } from '@motifx-community/ui';
|
|
20
|
+
|
|
21
|
+
/** A value against its scale, following a slider. */
|
|
22
|
+
export default function First() {
|
|
23
|
+
const s = reactive({ disk: 64 });
|
|
24
|
+
return (
|
|
25
|
+
<Stack gap="md" align="start">
|
|
26
|
+
<Gauge class="ga-first" value={() => s.disk} label="Disk" format={{ style: 'unit', unit: 'percent' }} />
|
|
27
|
+
<Slider label="Disk" x-model={() => s.disk} min={0} max={100} />
|
|
28
|
+
</Stack>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Kinds of gauges
|
|
34
|
+
|
|
35
|
+
`type` sets the shape. Each kind has its own page.
|
|
36
|
+
|
|
37
|
+
| Page | Set with | Shows |
|
|
38
|
+
| --- | --- | --- |
|
|
39
|
+
| `[Circular](gauge-circular.md)` | `type: 'arc'` or `'circle'` | An arc, a whole circle, a half or a quarter, with the value in the middle. |
|
|
40
|
+
| `[Linear](gauge-linear.md)` | `type: 'linear'` | A straight bar, across or upright, alone or in a list. |
|
|
41
|
+
| `[BarGauge](bar-gauge.md)` | `BarGauge` | Several values against one scale, as bars bent round one middle. |
|
|
42
|
+
|
|
43
|
+
## Parts of a gauge
|
|
44
|
+
|
|
45
|
+
The parts work the same on every kind.
|
|
46
|
+
|
|
47
|
+
| Page | Covers |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `[Scales](gauge-scales.md)` | The ends or ticks with their values, small ticks, ticks of your own, a scale that runs down, formats. |
|
|
50
|
+
| `[Ranges](gauge-ranges.md)` | Stretches of the scale with a meaning: tones, colors of your own, the chart colors, and their names read with the value. |
|
|
51
|
+
| `[Markers](gauge-markers.md)` | Needles, triangles, circles, rhombuses, lines and callouts that point at the value, with or without the fill. |
|
|
52
|
+
| `[Marks](gauge-marks.md)` | Targets and limits marked on the scale, with names, shapes, and values that change. |
|
|
53
|
+
| `[Base value](gauge-base.md)` | A fill that grows from a value inside the scale, to either side. |
|
|
54
|
+
| `[Dashboards](gauge-dashboards.md)` | Gauges put together and driven by the same values, live. |
|
|
55
|
+
|
|
56
|
+
## Choosing a gauge
|
|
57
|
+
|
|
58
|
+
A gauge suits one value whose scale the reader knows. For other needs, other components read better.
|
|
59
|
+
|
|
60
|
+
| To show | Use |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `One value against a known scale, read at a glance` | `Gauge` |
|
|
63
|
+
| `A few values side by side against one scale` | [BarGauge](bar-gauge.md) |
|
|
64
|
+
| `How far a task has come` | [ProgressBar](progress.md) |
|
|
65
|
+
| `How a value changes over time` | [Chart](chart.md) or [Sparkline](sparkline.md) |
|
|
66
|
+
| `Many exact values to compare and sort` | [DataGrid](datagrid.md) |
|
|
67
|
+
|
|
68
|
+
## Changes and motion
|
|
69
|
+
|
|
70
|
+
A new value moves the fill and the markers over the motion of the design language. Values that come quicker than that, from a drag or a live feed, are drawn at once, so the gauge never trails behind them. The [Dashboards](gauge-dashboards.md) page shows gauges with live values.
|
|
71
|
+
|
|
72
|
+
## Creating it programmatically
|
|
73
|
+
|
|
74
|
+
Each prop is also a property: set it later, and the gauge draws again.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { Component } from '@motifx/core';
|
|
78
|
+
import { Button, Gauge, Stack } from '@motifx-community/ui';
|
|
79
|
+
|
|
80
|
+
/** A gauge created programmatically. Each prop is also a property that can be set later. */
|
|
81
|
+
export default class Programmatic extends Component<HTMLDivElement> {
|
|
82
|
+
constructor() {
|
|
83
|
+
super('div');
|
|
84
|
+
const gauge = new Gauge({ value: 30, label: 'Queue', scale: 'ticks', tickInterval: 25 });
|
|
85
|
+
const add = new Button({ text: 'Add 10', variant: 'outline', onclick: () => (gauge.value = Math.min(100, (gauge.value ?? 0) + 10)) });
|
|
86
|
+
const needle = new Button({ text: 'Needle on or off', variant: 'outline', onclick: () => (gauge.marker = gauge.marker ? null : 'needle') });
|
|
87
|
+
const buttons = new Stack({ orientation: 'horizontal', gap: 'sm', wrap: true });
|
|
88
|
+
buttons.controls.add(add, needle);
|
|
89
|
+
const stack = new Stack({ gap: 'md', align: 'start' });
|
|
90
|
+
stack.controls.add(gauge, buttons);
|
|
91
|
+
this.controls.add(stack);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## API reference
|
|
97
|
+
|
|
98
|
+
### Props
|
|
99
|
+
|
|
100
|
+
| Prop | Type | Default | Description |
|
|
101
|
+
| --- | --- | --- | --- |
|
|
102
|
+
| `value` | `Bind<number \| null>` | `null` | The value. |
|
|
103
|
+
| `min, max` | `Bind<number>` | `0`, `100` | The ends of the scale. A `min` above `max` runs the scale the other way. |
|
|
104
|
+
| `type` | `Bind<'arc' \| 'circle' \| 'linear'>` | `'arc'` | How it draws. |
|
|
105
|
+
| `orientation` | `Bind<'horizontal' \| 'vertical'>` | `'horizontal'` | Which way a straight gauge runs. |
|
|
106
|
+
| `angle` | `Bind<number>` | `240` | How far an arc goes round, in degrees. |
|
|
107
|
+
| `rotation` | `Bind<number>` | `0` | How far the middle of an arc is turned from the top, clockwise, in degrees. |
|
|
108
|
+
| `ranges` | `Bind<GaugeRange[]>` | `[]` | Stretches of the scale: `from`, `to`, `tone` or `color`, and a `label` read with the value. A range with neither a tone nor a color takes the next chart color. |
|
|
109
|
+
| `scale` | `Bind<'ends' \| 'ticks' \| 'none'>` | `'ends'` | What the scale shows. |
|
|
110
|
+
| `ticks` | `Bind<number[] \| null>` | `null` | The values of the ticks. |
|
|
111
|
+
| `tickInterval` | `Bind<number \| null>` | An even step | How far apart the ticks are. |
|
|
112
|
+
| `minorTicks` | `Bind<number>` | `0` | How many small ticks go between two ticks. |
|
|
113
|
+
| `fill` | `Bind<boolean>` | `true` | Fills the track from `baseValue` to the value. |
|
|
114
|
+
| `baseValue` | `Bind<number \| null>` | The start of the scale | Where the fill starts. |
|
|
115
|
+
| `marker` | `Bind<'needle' \| 'triangle' \| 'circle' \| 'rhombus' \| 'line' \| 'text' \| null>` | `null` | A shape that points at the value. On a straight gauge a needle is a triangle. |
|
|
116
|
+
| `needleShape` | `Bind<'tapered' \| 'straight' \| 'two-tone'>` | `'tapered'` | How a needle is drawn. |
|
|
117
|
+
| `marks` | `Bind<GaugeMark[]>` | `[]` | Other values marked on the scale: `value`, a `label`, and a `shape` of their own. |
|
|
118
|
+
| `markShape` | `Bind<GaugeMarker>` | `'triangle'` | The shape of the marks, unless a mark has its own. |
|
|
119
|
+
| `label` | `Bind<string>` | `''` | What it measures, shown under the value and read as its name. |
|
|
120
|
+
| `format` | `Bind<ChartFormat \| null>` | The language's numbers | How the values read: options of the browser's number format, or a function of your own. |
|
|
121
|
+
| `showValue` | `Bind<boolean>` | `true` | Shows the value in the middle. |
|
|
122
|
+
| `tooltip` | `Bind<boolean>` | `true` | Shows the value or the mark under the pointer. |
|
|
123
|
+
| `size` | `Bind<number \| null>` | From the design language | The width of an arc's whole circle, or the length of an upright gauge, in pixels. |
|
|
124
|
+
|
|
125
|
+
### GaugeRange
|
|
126
|
+
|
|
127
|
+
| Field | Type | Default | Description |
|
|
128
|
+
| --- | --- | --- | --- |
|
|
129
|
+
| `from, to` | `number` | Required | The ends of the range, in either order. |
|
|
130
|
+
| `tone` | `'neutral' \| 'good' \| 'warning' \| 'danger'` | | A meaning in the colors of the design language. The fill takes it while the value is in the range. |
|
|
131
|
+
| `color` | `string` | | A color of your own instead of a tone. |
|
|
132
|
+
| `label` | `string` | | A name for the range, read with the value. |
|
|
133
|
+
|
|
134
|
+
### GaugeMark
|
|
135
|
+
|
|
136
|
+
| Field | Type | Default | Description |
|
|
137
|
+
| --- | --- | --- | --- |
|
|
138
|
+
| `value` | `number` | Required | The value marked. |
|
|
139
|
+
| `label` | `string` | | What it is, read with the gauge's value and shown in the tooltip. |
|
|
140
|
+
| `shape` | `GaugeMarker` | The gauge's `markShape` | Its shape: `needle`, `triangle`, `circle`, `rhombus`, `line` or `text`. |
|
|
141
|
+
|
|
142
|
+
### Accessibility
|
|
143
|
+
|
|
144
|
+
| Topic | Details |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `Role` | It is a meter: assistive technology reads its value, its scale, the range the value is in, and the marks with their names. |
|
|
147
|
+
| `Color` | A tone is never the only sign: the value is written, and a range's label is read with it. |
|
|
148
|
+
| `Motion` | A change of value moves over the motion of the design language, and at once when the reader prefers reduced motion. Values that come quicker than the motion, from a drag or a fast feed, are drawn at once, so the gauge keeps up with them. |
|
|
149
|
+
|
|
150
|
+
## Feedback
|
|
151
|
+
|
|
152
|
+
Loading issues…
|
package/docs/home.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @motifx-community/ui
|
|
2
2
|
|
|
3
|
-
> Get started · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Get started · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
Components for MotifJS: objects you create when you need them, show anywhere and dispose when you are done, drawn from the MotifJS design system's tokens.
|
|
6
6
|
|
package/docs/keyboard.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Keyboard and focus
|
|
2
2
|
|
|
3
|
-
> Foundations · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Foundations · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
Every control follows the same rules for Tab order, the active control of a container, focus handling, `&File` access keys and application-wide shortcuts.
|
|
6
6
|
|
package/docs/language.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Language
|
|
2
2
|
|
|
3
|
-
> Foundations · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Foundations · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
`uiLocale` controls the strings that controls display, the locale used for dates and numbers, and the text direction. The kit has one `uiLocale`, and each language pack is loaded on demand.
|
|
6
6
|
|
package/docs/layout.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Layout
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
Container controls for arranging other controls: `Stack` (a row or column), `Grid` (rows and columns), `Panel` (a plain box that can scroll), `GroupBox` (a titled frame), `DockPanel` (children docked to its edges) and `SplitContainer` (two panes with a splitter). All of them are controls, so they can disable and hide their content, and they lay out children added at any time.
|
|
6
6
|
|
package/docs/listbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ListBox
|
|
2
2
|
|
|
3
|
-
> Data · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Data · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
A list displayed directly on the page. Users select one or more items with the keyboard or pointer. Items can come from memory or a data source, can be searched and grouped, and long lists render only the visible rows.
|
|
6
6
|
|
package/docs/loadpanel.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# LoadPanel
|
|
2
2
|
|
|
3
|
-
> Feedback · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Feedback · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
A loading overlay for a container or the whole page. It includes a shade, a panel with the kit spinner and a message, and a Cancel button when the operation can be stopped. The content underneath is unavailable while it is shown, and focus returns afterward.
|
|
6
6
|
|
package/docs/lookup.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lookup
|
|
2
2
|
|
|
3
|
-
> Choice · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Choice · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
Selects one row from a table-style list, typically from a data source searched on the server, such as a customer by company, contact and city. The field shows the text of the selected row, and everything else works as in DropDown.
|
|
6
6
|
|
package/docs/menus.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MenuBar and ContextMenu
|
|
2
2
|
|
|
3
|
-
> Buttons · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Buttons · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
An application menu bar (File, Edit, View) and a context menu that opens on right-click. Both use the same menu items, which support submenus, check and radio items, shortcuts and access keys.
|
|
6
6
|
|
package/docs/multiview.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MultiView
|
|
2
2
|
|
|
3
|
-
> Navigation · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
Displays one page at a time from a horizontal set. Users move between pages with a swipe or drag, and you can navigate with `next()`, `previous()` and `goTo()`, or with [Tabs](tabs.md), a [Stepper](stepper.md) or buttons bound to the same value. It works like the panels of a tab control without the tab strip.
|
|
6
6
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Navigation
|
|
2
|
+
|
|
3
|
+
> Navigation · @motifx-community/ui 0.1.0-beta.6
|
|
4
|
+
|
|
5
|
+
Navigation components move the reader around an application and lay out its screens: bars at the top and bottom, tabs, paths, steps and pages, panels that slide in, and the containers that arrange everything.
|
|
6
|
+
|
|
7
|
+
## A project app
|
|
8
|
+
|
|
9
|
+
A top bar whose menu opens a drawer with the projects, a path, tabs with steps and expanding questions, a members list in pages, and a bar of sections at the bottom.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { reactive } from '@motifx/core';
|
|
13
|
+
import { Accordion, AccordionItem, AppBar, BottomNavigation, Breadcrumb, Drawer, ListBox, Pagination, Stepper, Tab, Tabs } from '@motifx-community/ui';
|
|
14
|
+
|
|
15
|
+
const icon = (name: string) => () => <span class="mx-glyph" data-icon={name} />;
|
|
16
|
+
|
|
17
|
+
const PROJECTS = [
|
|
18
|
+
{ id: 'web', text: 'Web shop' },
|
|
19
|
+
{ id: 'mobile', text: 'Mobile app' },
|
|
20
|
+
{ id: 'design', text: 'Design system' }
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const MEMBERS = Array.from({ length: 46 }, (_, i) => `Member ${i + 1}`);
|
|
24
|
+
|
|
25
|
+
/** A project app: a top bar with a menu that opens a drawer, a path, tabs with steps, questions and pages, and a bar at the bottom. */
|
|
26
|
+
export default function NavigationDemo() {
|
|
27
|
+
const s = reactive({ open: false, project: 'web' as unknown, step: 1, page: 1, place: 'projects' as unknown, told: 'nothing yet' });
|
|
28
|
+
const project = () => PROJECTS.find(p => p.id === s.project)?.text ?? '';
|
|
29
|
+
const pageOf = () => MEMBERS.slice((s.page - 1) * 8, s.page * 8);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div class="ov-frame ov-frame--flush ov-navigation">
|
|
33
|
+
<AppBar
|
|
34
|
+
position="static"
|
|
35
|
+
title={project}
|
|
36
|
+
subtitle="Projects"
|
|
37
|
+
navigation="menu"
|
|
38
|
+
onNavigationClick={() => (s.open = true)}
|
|
39
|
+
actions={[
|
|
40
|
+
{ icon: icon('search'), hint: 'Search', click: () => (s.told = 'search') },
|
|
41
|
+
{ icon: icon('download'), hint: 'Download', click: () => (s.told = 'download') },
|
|
42
|
+
{ icon: icon('trash'), hint: 'Delete', click: () => (s.told = 'delete') }
|
|
43
|
+
]}
|
|
44
|
+
/>
|
|
45
|
+
<Drawer title="Projects" showClose x-model={() => s.open}>
|
|
46
|
+
<ListBox label="Projects" items={PROJECTS} textField="text" valueField="id" x-model={() => s.project} onclick={() => (s.open = false)} />
|
|
47
|
+
</Drawer>
|
|
48
|
+
<div class="ov-body">
|
|
49
|
+
<Breadcrumb label="Path" items={() => [{ text: 'Home' }, { text: 'Projects' }, { text: project() }]} onItemClick={e => (s.told = String((e.item as { text?: string }).text ?? ''))} />
|
|
50
|
+
<Tabs label="Project">
|
|
51
|
+
<Tab title="&Progress">
|
|
52
|
+
<div class="ov-stack ov-pad">
|
|
53
|
+
<Stepper label="Release" items={['Plan', 'Build', 'Test', 'Release']} x-model={() => s.step} clickable />
|
|
54
|
+
<Accordion>
|
|
55
|
+
<AccordionItem title="What happens in this step?" expanded>
|
|
56
|
+
{() => ['The scope is agreed.', 'The features are built.', 'Every feature is tested.', 'The release goes out.'][s.step]}
|
|
57
|
+
</AccordionItem>
|
|
58
|
+
<AccordionItem title="Who signs it off?">The project lead and the product owner.</AccordionItem>
|
|
59
|
+
</Accordion>
|
|
60
|
+
</div>
|
|
61
|
+
</Tab>
|
|
62
|
+
<Tab title="&Members" badge={MEMBERS.length}>
|
|
63
|
+
<div class="ov-stack ov-pad">
|
|
64
|
+
<ul class="ov-file-list">
|
|
65
|
+
{pageOf().map(m => (
|
|
66
|
+
<li>{m}</li>
|
|
67
|
+
))}
|
|
68
|
+
</ul>
|
|
69
|
+
<Pagination label="Members" total={MEMBERS.length} pageSize={8} x-model={() => s.page} showInfo />
|
|
70
|
+
</div>
|
|
71
|
+
</Tab>
|
|
72
|
+
<Tab title="&Settings">
|
|
73
|
+
<p class="ov-pad ov-copy">Settings of the project go here.</p>
|
|
74
|
+
</Tab>
|
|
75
|
+
</Tabs>
|
|
76
|
+
</div>
|
|
77
|
+
<BottomNavigation
|
|
78
|
+
position="static"
|
|
79
|
+
label="Sections"
|
|
80
|
+
x-model={() => s.place}
|
|
81
|
+
items={[
|
|
82
|
+
{ value: 'projects', text: 'Projects', glyph: 'star', activeGlyph: 'star-filled' },
|
|
83
|
+
{ value: 'inbox', text: 'Inbox', glyph: 'file', badge: 4 },
|
|
84
|
+
{ value: 'calendar', text: 'Calendar', glyph: 'calendar' },
|
|
85
|
+
{ value: 'profile', text: 'Profile', glyph: 'person' }
|
|
86
|
+
]}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Components in this group
|
|
94
|
+
|
|
95
|
+
Each component has its own page with its examples and its full API.
|
|
96
|
+
|
|
97
|
+
| Component | For |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| `[AppBar](appbar.md)` | The bar at the top of an application. |
|
|
100
|
+
| `[BottomNavigation](bottomnavigation.md)` | The main places of an application at the bottom of a phone screen. |
|
|
101
|
+
| `[Tabs](tabs.md)` | Views of the same thing, one at a time. |
|
|
102
|
+
| `[Breadcrumb](breadcrumb.md)` | Where the reader is in a hierarchy. |
|
|
103
|
+
| `[Pagination](pagination.md)` | Pages of a long list. |
|
|
104
|
+
| `[Stepper](stepper.md) and [Wizard](wizard.md)` | A task in steps, with or without the pages of each step. |
|
|
105
|
+
| `[Accordion](accordion.md)` | Sections that expand and collapse. |
|
|
106
|
+
| `[MultiView](multiview.md)` | Pages swiped one after another. |
|
|
107
|
+
| `[Window](window.md), [BottomSheet](bottomsheet.md), [Drawer](drawer.md), [ActionSheet](actionsheet.md)` | Panels over the page: a window, a sheet from the bottom, a drawer from a side, actions on a phone. |
|
|
108
|
+
| `[Layout](layout.md), [Splitter](splitter.md), [Resizable](resizable.md)` | Stacks, grids, docked panels, and panels the reader resizes. |
|
|
109
|
+
| `[Draggable](draggable.md), [Sortable](sortable.md), [ScrollView](scrollview.md), [FormLayout](formlayout.md)` | Dragging, reordering, scrolling with pull to refresh, and forms laid out from data. |
|
|
110
|
+
|
|
111
|
+
## Choosing a component
|
|
112
|
+
|
|
113
|
+
Several components can do the same job; this table points to the one that reads best for it.
|
|
114
|
+
|
|
115
|
+
| To | Use |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `Switch between views of the same thing` | [Tabs](tabs.md) |
|
|
118
|
+
| `Show where the reader is` | [Breadcrumb](breadcrumb.md) |
|
|
119
|
+
| `Guide a task in order` | [Wizard](wizard.md), or [Stepper](stepper.md) for the steps alone |
|
|
120
|
+
| `Split a long list` | [Pagination](pagination.md) |
|
|
121
|
+
| `Fold away sections` | [Accordion](accordion.md) |
|
|
122
|
+
| `Give an application its menu` | [Drawer](drawer.md), or [AppBar](appbar.md) with its menu button |
|
|
123
|
+
| `Reach the main places on a phone` | [BottomNavigation](bottomnavigation.md) |
|
|
124
|
+
| `Offer actions on a phone` | [ActionSheet](actionsheet.md) |
|
|
125
|
+
| `Put content beside content, resizable` | [Splitter](splitter.md) |
|
|
126
|
+
|
|
127
|
+
## What they share
|
|
128
|
+
|
|
129
|
+
The current place is a value with `x-model`: the selected tab, the step, the page, the open section; the application can set it as well as follow it.
|
|
130
|
+
|
|
131
|
+
Panels that slide in work with a pointer, a finger and the keyboard: swipe to close, Escape, and focus kept inside while they are open.
|
|
132
|
+
|
|
133
|
+
## Accessibility
|
|
134
|
+
|
|
135
|
+
| Topic | Details |
|
|
136
|
+
| --- | --- |
|
|
137
|
+
| `Landmarks` | Bars are headers and navigation regions; the current place is marked with `aria-current`. |
|
|
138
|
+
| `Keyboard` | Tabs, steps and bars are one Tab stop moved with the arrow keys, Home and End. |
|
|
139
|
+
| `Focus` | A drawer, a sheet and a window keep focus inside while open and give it back when they close. |
|
|
140
|
+
|
|
141
|
+
## Feedback
|
|
142
|
+
|
|
143
|
+
Loading issues…
|
package/docs/numberbox.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NumberBox
|
|
2
2
|
|
|
3
|
-
> Editors · @motifx-community/ui 0.1.0-beta.
|
|
3
|
+
> Editors · @motifx-community/ui 0.1.0-beta.6
|
|
4
4
|
|
|
5
5
|
A numeric input with arrow key support, PageUp and PageDown, spin buttons that repeat while held, min and max limits, exact decimal stepping, display formats such as currency and percent, and locale-aware input.
|
|
6
6
|
|