@apliteni/apliteni-ui 0.113.0 → 0.115.0
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/guidelines/labels-and-titles.md +18 -6
- package/package.json +1 -1
- package/react/README.md +69 -1
- package/react/dist/index.d.ts +92 -2
- package/react/dist/index.js +789 -49
- package/src/components/dropdown.js +53 -19
- package/src/components/filter-bar.js +6 -3
- package/src/index.css +1 -0
- package/src/index.d.ts +30 -6
- package/src/index.js +1 -0
- package/src/inline.js +2 -0
- package/src/logic/chart.js +143 -0
- package/src/logic/filter-bar.js +34 -16
- package/src/styles/chart.css +282 -0
- package/src/styles/dropdown.css +2 -2
- package/src/styles/filter-bar.css +55 -16
- package/src/styles/topbar.css +1 -1
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
**Rule:** Use body ink for all words; use size, weight and spacing for hierarchy.
|
|
8
8
|
|
|
9
|
-
**Why:** Muted text can look decorative
|
|
9
|
+
**Why:** Muted text can look decorative at small sizes, even when contrast passes.
|
|
10
10
|
|
|
11
|
-
**Do:** Use body ink at
|
|
11
|
+
**Do:** Use body ink at every size; let size show hierarchy.
|
|
12
12
|
|
|
13
13
|
**Don't:** Use muted ink at different sizes to show rank.
|
|
14
14
|
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
|
|
17
17
|
<!-- rule: text-ink-exceptions -->
|
|
18
18
|
|
|
19
|
-
**Rule:** Use muted or dim ink only for the
|
|
19
|
+
**Rule:** Use muted or dim ink only for the four named exception classes.
|
|
20
20
|
|
|
21
|
-
**Why:** A closed list
|
|
21
|
+
**Why:** A closed list keeps fading from becoming hierarchy.
|
|
22
22
|
|
|
23
|
-
**Do:** Use muted ink for a
|
|
23
|
+
**Do:** Use muted ink for a placeholder or an axis.
|
|
24
24
|
|
|
25
25
|
**Don't:** Fade timestamps, counts or enabled actions.
|
|
26
26
|
|
|
27
|
-
**Except:** Only: (1) non-word glyphs
|
|
27
|
+
**Except:** Only: (1) non-word glyphs — arrows, chevrons, dismiss marks; (2) colour reporting off, unset, disabled or archived; (3) a valueless slot, such as an empty field or cell; (4) a drawing’s furniture — a chart’s axis, period row and legend — whose values remain reachable in full. Unselected options, counts, timestamps, shortcuts, enabled actions and empty-state text are information, not exceptions.
|
|
28
28
|
|
|
29
29
|
## Use sentence case
|
|
30
30
|
|
|
@@ -40,6 +40,18 @@
|
|
|
40
40
|
|
|
41
41
|
**Don't:** Display “TOTAL REVENUE” above the figure.
|
|
42
42
|
|
|
43
|
+
## Say the noun once
|
|
44
|
+
|
|
45
|
+
<!-- rule: no-repeated-noun -->
|
|
46
|
+
|
|
47
|
+
**Rule:** Leave a noun out of a label its frame already names.
|
|
48
|
+
|
|
49
|
+
**Why:** Clutter hides the available action.
|
|
50
|
+
|
|
51
|
+
**Do:** The chips name the filters; the button says what it does.
|
|
52
|
+
|
|
53
|
+
**Don't:** The noun arrives twice.
|
|
54
|
+
|
|
43
55
|
## Rank card titles
|
|
44
56
|
|
|
45
57
|
<!-- rule: title-rank -->
|
package/package.json
CHANGED
package/react/README.md
CHANGED
|
@@ -32,7 +32,7 @@ import { DataTable, Modal, Button } from '@apliteni/apliteni-ui/react';
|
|
|
32
32
|
Both stylesheets. The React one adds what React's own components need — it carries no tokens, no
|
|
33
33
|
reset and none of the kit's control CSS, so it cannot stand in for the first import.
|
|
34
34
|
|
|
35
|
-
Components: `Success`, `SuccessPanel`, `SuccessCheck`, `Checkbox`, `Switch`, `SearchField`, `EmptyState`, `DataTable`, `Pagination`, `StatBand`, `Modal`, `Confirm`, `Drawer`, `CommandPalette`, `Dropdown`, `BackLink`, `Tooltip`, `Snippet`, `Segmented`, `Tabs`, `Button`, `Badge`, `Pill`, `StatusDot`, `Card`, `Callout`, `Icon`.
|
|
35
|
+
Components: `Success`, `SuccessPanel`, `SuccessCheck`, `Checkbox`, `Switch`, `SearchField`, `EmptyState`, `DataTable`, `Pagination`, `StatBand`, `Chart`, `Modal`, `Confirm`, `Drawer`, `CommandPalette`, `Dropdown`, `BackLink`, `Tooltip`, `Snippet`, `Segmented`, `Tabs`, `Button`, `Badge`, `Pill`, `StatusDot`, `Card`, `Callout`, `Icon`.
|
|
36
36
|
|
|
37
37
|
`Segmented` is a controlled choice toolbar: pass `options`, `value`, `onChange`,
|
|
38
38
|
and a `label` for its accessible name. `size="sm"` compacts it, `block` makes it
|
|
@@ -831,3 +831,71 @@ control ever draws: selection and focus are one signal each, and only focus is a
|
|
|
831
831
|
accent. Accent names and swatch paints come from the kit's `ACCENTS` and
|
|
832
832
|
`accentSwatchStyle`, which the vanilla factory also reads, so the two pickers cannot
|
|
833
833
|
drift.
|
|
834
|
+
|
|
835
|
+
## Chart
|
|
836
|
+
|
|
837
|
+
`Chart` draws three shapes from the kit's tokens: `months`, a column per period with bars and
|
|
838
|
+
a line across them; `bridge`, one period walked from a starting total to a result; and `spark`,
|
|
839
|
+
one series at text size with no axis, for a stat band's `trend` slot.
|
|
840
|
+
|
|
841
|
+
The numbers are yours and so is the wording. `format` prints exact values in the readout, the
|
|
842
|
+
live region and the table; `formatAxis` prints the ticks, which are whole units, and defaults
|
|
843
|
+
to `format`. A `bars-below` series takes positive magnitudes and is drawn under the zero line.
|
|
844
|
+
A period marked `estimated` keeps its series fill with a dashed edge. The legend names the state.
|
|
845
|
+
The readout and the optional table show the state and its `note`.
|
|
846
|
+
|
|
847
|
+
A bar series names a tone. `accent` and `accent-soft` are one hue at two weights, which is how
|
|
848
|
+
two series read apart without spending a second colour on them; `good` and `bad` say which way
|
|
849
|
+
the news runs, and belong to a series where some direction is better. Every tone is opaque and
|
|
850
|
+
clears 3:1 against the card and against the page, in both themes and under every accent.
|
|
851
|
+
|
|
852
|
+
The plot draws a hairline at every tick and the zero rule over them, and the axis keeps a label
|
|
853
|
+
at every tick. A bar is flat, rounded only at the end away from zero, and **never wider than a
|
|
854
|
+
mark**: a chart that grows with the card gains ground between its columns rather than twelve
|
|
855
|
+
wider blocks. Two bar series on the same side of the zero line stand side by side with ground
|
|
856
|
+
between them. A bridge carries each step's running total across to the step beside it. The
|
|
857
|
+
value axis, the period row and the legend are drawn quietly, and every value they name is also
|
|
858
|
+
in the readout and in the table at full strength.
|
|
859
|
+
|
|
860
|
+
Picking a column paints the column's own ground behind it and sets its label in the strong ink
|
|
861
|
+
at a heavier weight. No mark changes colour, so the accent stays with the series it names, and
|
|
862
|
+
the only outline the chart draws is the focus ring on the plot.
|
|
863
|
+
|
|
864
|
+
The plot is one tab stop. Left, Right, Home and End step columns and announce each one
|
|
865
|
+
politely, Enter picks one when `selectable` is set, and `title` names the `role="img"` plot and
|
|
866
|
+
the table under it without being drawn — the card around the chart already carries its title.
|
|
867
|
+
The table the reader opens adds the two stops it needs of its own: its summary, and the named
|
|
868
|
+
scroller that carries its columns sideways so your card and your page keep their width.
|
|
869
|
+
At phone widths the plot scrolls with the value axis held in place, and the side that still
|
|
870
|
+
hides columns is faded. Nothing animates.
|
|
871
|
+
|
|
872
|
+
On a touch screen a tap opens the readout and a second tap on the same mark closes it. **The
|
|
873
|
+
tap that opens a readout does not call `onSelect`** — it is the reader asking what a mark is
|
|
874
|
+
worth — while the tap that closes one, and an ordinary mouse click, do. The click itself is
|
|
875
|
+
never swallowed, so your own listener around the chart still hears every tap. Below 560px, to
|
|
876
|
+
a coarse pointer, a line's point grows an invisible target that stops at its own column so
|
|
877
|
+
no two periods answer for each other. A narrow sparkline can own less than 44px across, but it
|
|
878
|
+
still owns at least 24px across and the full 44px down. The drawn line does not change. A
|
|
879
|
+
sparkline's box grows with it — 32px of drawing cannot hold the vertical target, and the part
|
|
880
|
+
outside the box would be clipped by the chart's own edge — so a `trend` slot is 44px tall there
|
|
881
|
+
instead of 32, with the same line drawn in the middle of it.
|
|
882
|
+
|
|
883
|
+
```tsx
|
|
884
|
+
<Chart title="Income and spend by month, last 12 months, with net"
|
|
885
|
+
periods={months.map(label => ({ label }))}
|
|
886
|
+
series={[
|
|
887
|
+
{ id: 'income', name: 'Income', values: income, tone: 'accent' },
|
|
888
|
+
{ id: 'spend', name: 'Spend', values: spend, shape: 'bars-below', tone: 'accent-soft' },
|
|
889
|
+
/* or `shape: 'bars'` for the two standing side by side on the zero line */
|
|
890
|
+
{ id: 'net', name: 'Net', values: net, shape: 'line', tone: 'info' },
|
|
891
|
+
]}
|
|
892
|
+
format={eur} formatAxis={eurShort} />
|
|
893
|
+
|
|
894
|
+
<Chart variant="bridge" title="Cash from opening to closing" format={eur}
|
|
895
|
+
steps={[
|
|
896
|
+
{ label: 'Opening', value: 120000 },
|
|
897
|
+
{ label: 'Subscriptions', value: 42600 },
|
|
898
|
+
{ label: 'Payroll', value: -58200 },
|
|
899
|
+
{ label: 'Closing', kind: 'total' },
|
|
900
|
+
]} />
|
|
901
|
+
```
|
package/react/dist/index.d.ts
CHANGED
|
@@ -571,17 +571,26 @@ type Filter = {
|
|
|
571
571
|
disabled?: boolean;
|
|
572
572
|
open?: boolean;
|
|
573
573
|
};
|
|
574
|
+
/** A filter the bar can put on itself: the chip's name, and the values its menu offers. */
|
|
575
|
+
type AddFilter = {
|
|
576
|
+
id: string;
|
|
577
|
+
label: string;
|
|
578
|
+
items: DropdownEntry[];
|
|
579
|
+
};
|
|
574
580
|
type FilterBarProps = {
|
|
575
581
|
filters: Filter[];
|
|
576
582
|
label?: string;
|
|
577
583
|
clearLabel?: string;
|
|
578
584
|
disabled?: boolean;
|
|
579
585
|
busy?: boolean;
|
|
586
|
+
add?: AddFilter[];
|
|
587
|
+
addLabel?: string;
|
|
580
588
|
onRemove: (id: string) => void;
|
|
581
589
|
onClear: () => void;
|
|
582
590
|
onChange: (id: string, value: string | undefined) => void;
|
|
591
|
+
onAdd?: (id: string, value: string | undefined) => void;
|
|
583
592
|
};
|
|
584
|
-
declare function FilterBar({ filters, label, clearLabel, disabled, busy, onRemove, onClear, onChange }: FilterBarProps): react.JSX.Element;
|
|
593
|
+
declare function FilterBar({ filters, label, clearLabel, add, addLabel, disabled, busy, onRemove, onClear, onChange, onAdd }: FilterBarProps): react.JSX.Element;
|
|
585
594
|
|
|
586
595
|
type KeyValueRow = {
|
|
587
596
|
label: string;
|
|
@@ -900,6 +909,87 @@ declare const Success: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLD
|
|
|
900
909
|
onCountdownEnd?: () => void;
|
|
901
910
|
} & react.RefAttributes<HTMLDivElement>>;
|
|
902
911
|
|
|
912
|
+
type ChartTone = 'accent' | 'accent-soft' | 'good' | 'bad' | 'warn' | 'info' | 'neutral';
|
|
913
|
+
type ChartPeriod = {
|
|
914
|
+
/** The period as the readout and the table name it: `Jan 2026`. */
|
|
915
|
+
label: string;
|
|
916
|
+
/** The period as the axis names it. Defaults to `label`'s first word. */
|
|
917
|
+
short?: string;
|
|
918
|
+
/** The period is not final — estimated, forecast, or still running. */
|
|
919
|
+
estimated?: boolean;
|
|
920
|
+
/** Why it is not final. Printed in the readout and in the legend. */
|
|
921
|
+
note?: string;
|
|
922
|
+
};
|
|
923
|
+
type ChartSeries = {
|
|
924
|
+
id: string;
|
|
925
|
+
name: string;
|
|
926
|
+
values: readonly number[];
|
|
927
|
+
/**
|
|
928
|
+
* `bars` stand on the zero line, `bars-below` hang under it from positive
|
|
929
|
+
* magnitudes (spend given as 31870, not −31870), and `line` crosses both.
|
|
930
|
+
*/
|
|
931
|
+
shape?: 'bars' | 'bars-below' | 'line';
|
|
932
|
+
/**
|
|
933
|
+
* Bars take a tone. A line is `neutral` unless the caller says otherwise.
|
|
934
|
+
* `accent` and `accent-soft` are one hue at two weights, which is how two
|
|
935
|
+
* series read apart without spending a second colour on them.
|
|
936
|
+
*/
|
|
937
|
+
tone?: ChartTone;
|
|
938
|
+
};
|
|
939
|
+
type ChartBridgeStep = {
|
|
940
|
+
label: string;
|
|
941
|
+
short?: string;
|
|
942
|
+
/**
|
|
943
|
+
* A `total` is an absolute column; a `change` is added to the running total.
|
|
944
|
+
* The first step is a total and every later one a change, unless it says so.
|
|
945
|
+
*/
|
|
946
|
+
kind?: 'total' | 'change';
|
|
947
|
+
/** A change's amount. A `total` without one takes the running total. */
|
|
948
|
+
value?: number;
|
|
949
|
+
estimated?: boolean;
|
|
950
|
+
note?: string;
|
|
951
|
+
};
|
|
952
|
+
type ChartBridgeTones = {
|
|
953
|
+
rise?: ChartTone;
|
|
954
|
+
fall?: ChartTone;
|
|
955
|
+
total?: ChartTone;
|
|
956
|
+
};
|
|
957
|
+
type ChartCommon = {
|
|
958
|
+
/**
|
|
959
|
+
* Names the chart for a reader who cannot see it, and the table under it.
|
|
960
|
+
* Never drawn: the card around a chart already carries its title.
|
|
961
|
+
*/
|
|
962
|
+
title: string;
|
|
963
|
+
/** Exact values, for the readout, the live region and the table. */
|
|
964
|
+
format: (value: number) => string;
|
|
965
|
+
/** Axis ticks, which are whole units. Defaults to `format`. */
|
|
966
|
+
formatAxis?: (value: number) => string;
|
|
967
|
+
/** The plot's height in CSS px. */
|
|
968
|
+
height?: number;
|
|
969
|
+
/** Offer the same numbers as a table. On by default, off for a sparkline. */
|
|
970
|
+
table?: boolean;
|
|
971
|
+
/** Let Enter and a click pick a column. */
|
|
972
|
+
selectable?: boolean;
|
|
973
|
+
/** The picked column, when the caller keeps that state. */
|
|
974
|
+
selected?: number | null;
|
|
975
|
+
onSelect?: (index: number) => void;
|
|
976
|
+
className?: string;
|
|
977
|
+
};
|
|
978
|
+
type ChartProps = ChartCommon & ({
|
|
979
|
+
variant?: 'months';
|
|
980
|
+
periods: readonly ChartPeriod[];
|
|
981
|
+
series: readonly ChartSeries[];
|
|
982
|
+
} | {
|
|
983
|
+
variant: 'spark';
|
|
984
|
+
periods: readonly ChartPeriod[];
|
|
985
|
+
series: readonly ChartSeries[];
|
|
986
|
+
} | {
|
|
987
|
+
variant: 'bridge';
|
|
988
|
+
steps: readonly ChartBridgeStep[];
|
|
989
|
+
tones?: ChartBridgeTones;
|
|
990
|
+
});
|
|
991
|
+
declare function Chart(props: ChartProps): react.JSX.Element;
|
|
992
|
+
|
|
903
993
|
type SidebarNavBadge = string | number | {
|
|
904
994
|
text: string | number;
|
|
905
995
|
tone?: 'neutral' | 'accent' | 'live' | 'danger';
|
|
@@ -965,4 +1055,4 @@ declare const AccentPicker: react.ForwardRefExoticComponent<Omit<HTMLAttributes<
|
|
|
965
1055
|
declare const PAGE_SIZES: readonly number[];
|
|
966
1056
|
declare const DEFAULT_PAGE_SIZE: number;
|
|
967
1057
|
|
|
968
|
-
export { type Accent, AccentPicker, type AccentPickerProps, AppShell, type AppShellProps, type AppShellSection, BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonLinkProps, type ButtonProps, Callout, type CalloutProps, type CalloutVariant, Card, Checkbox, type CheckboxProps, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, Confirm, type ConfirmProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DatePicker, type DatePickerMode, type DatePickerPreset, type DatePickerProps, type DatePickerRange, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, DrawerSection, type DrawerSectionProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, EmptyState, type EmptyStateProps, type EmptyStateVariant, Field, type FieldControlProps, type FieldProps, FileDrop, type FileDropFile, type FileDropProps, type FileDropStatus, FileField, type FileFieldProps, type Filter, FilterBar, type FilterBarProps, Icon, KeyValueList, type KeyValueListProps, type KeyValueRow, Modal, type ModalProps, type NativeButtonProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, Pill, type PillProps, RowIdentity, type RowIdentityProps, SearchField, type SearchFieldProps, type SegmentOption, Segmented, type SegmentedProps, SelectField, type SelectFieldProps, SidebarNav, type SidebarNavBadge, type SidebarNavItem, type SidebarNavLeaf, type SidebarNavProps, type SidebarNavSection, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, Snippet, type SnippetProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, StatusDot, type StatusDotProps, Success, SuccessCheck, type SuccessCheckProps, type SuccessCountdown, SuccessPanel, type SuccessPanelProps, type SuccessProps, Switch, type SwitchProps, THEME_INIT_SCRIPT, type TabItem, type TableSort, Tabs, type TabsProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemeToggle, type ThemeToggleProps, Timeline, type TimelineEvent, type TimelineEventKind, type TimelineProps, Toast, type ToastNotice, type ToastProps, Tooltip, type TooltipProps, sortTableRows, useToast };
|
|
1058
|
+
export { type Accent, AccentPicker, type AccentPickerProps, type AddFilter, AppShell, type AppShellProps, type AppShellSection, BackLink, type BackLinkOwnProps, type BackLinkProps, Badge, BusyRegion, type BusyRegionProps, Button, type ButtonLinkProps, type ButtonProps, Callout, type CalloutProps, type CalloutVariant, Card, Chart, type ChartBridgeStep, type ChartBridgeTones, type ChartPeriod, type ChartProps, type ChartSeries, type ChartTone, Checkbox, type CheckboxProps, type Column, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, Confirm, type ConfirmProps, DEFAULT_PAGE_SIZE, DataTable, type DataTableProps, DatePicker, type DatePickerMode, type DatePickerPreset, type DatePickerProps, type DatePickerRange, DeltaValue, type DeltaValueProps, Denied, type DeniedProps, Drawer, type DrawerProps, DrawerSection, type DrawerSectionProps, Dropdown, type DropdownBadge, type DropdownEntry, type DropdownItem, type DropdownProps, type DropdownRowProps, type DropdownSearch, type DropdownSection, type DropdownSeparator, EmptyState, type EmptyStateProps, type EmptyStateVariant, Field, type FieldControlProps, type FieldProps, FileDrop, type FileDropFile, type FileDropProps, type FileDropStatus, FileField, type FileFieldProps, type Filter, FilterBar, type FilterBarProps, Icon, KeyValueList, type KeyValueListProps, type KeyValueRow, Modal, type ModalProps, type NativeButtonProps, NumericValue, type NumericValueProps, PAGE_SIZES, Pagination, type PaginationProps, Pill, type PillProps, RowIdentity, type RowIdentityProps, SearchField, type SearchFieldProps, type SegmentOption, Segmented, type SegmentedProps, SelectField, type SelectFieldProps, SidebarNav, type SidebarNavBadge, type SidebarNavItem, type SidebarNavLeaf, type SidebarNavProps, type SidebarNavSection, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, Snippet, type SnippetProps, StatBand, type StatBandProps, type StatDelta, type StatFigure, type StatTone, type StatVariant, StatusDot, type StatusDotProps, Success, SuccessCheck, type SuccessCheckProps, type SuccessCountdown, SuccessPanel, type SuccessPanelProps, type SuccessProps, Switch, type SwitchProps, THEME_INIT_SCRIPT, type TabItem, type TableSort, Tabs, type TabsProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemeToggle, type ThemeToggleProps, Timeline, type TimelineEvent, type TimelineEventKind, type TimelineProps, Toast, type ToastNotice, type ToastProps, Tooltip, type TooltipProps, sortTableRows, useToast };
|