@almadar/ui 4.51.14 → 4.51.16
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/dist/avl/index.cjs +807 -154
- package/dist/avl/index.js +807 -154
- package/dist/components/atoms/Sparkline.d.ts +30 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/index.cjs +797 -153
- package/dist/components/index.js +798 -154
- package/dist/components/molecules/DateRangePicker.d.ts +56 -0
- package/dist/components/molecules/FilterGroup.d.ts +3 -3
- package/dist/components/molecules/StatDisplay.d.ts +9 -1
- package/dist/components/molecules/index.d.ts +1 -0
- package/dist/components/organisms/Chart.d.ts +32 -12
- package/dist/providers/index.cjs +795 -153
- package/dist/providers/index.js +795 -153
- package/dist/runtime/index.cjs +795 -153
- package/dist/runtime/index.js +795 -153
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DateRangePicker Molecule Component
|
|
3
|
+
*
|
|
4
|
+
* Two date inputs plus an optional preset row. Emits `{ from, to }` ISO
|
|
5
|
+
* strings on the event bus whenever the range changes. Falls back to a
|
|
6
|
+
* standard callback for direct consumers.
|
|
7
|
+
*
|
|
8
|
+
* Bus contract: caller passes `event` prop with a string key; the molecule
|
|
9
|
+
* emits `UI:{event}` with `{ from, to }` as the payload — mirrors the
|
|
10
|
+
* FilterGroup / MapView / DataGrid pattern.
|
|
11
|
+
*/
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import type { EventEmit } from '@almadar/core';
|
|
14
|
+
export interface DateRangePickerPreset {
|
|
15
|
+
/** Display label (e.g. "Last 30 days"). */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Stable key used for highlighting the active preset. */
|
|
18
|
+
value: string;
|
|
19
|
+
/** Returns `{ from, to }` as ISO date strings (YYYY-MM-DD). */
|
|
20
|
+
range: () => {
|
|
21
|
+
from: string;
|
|
22
|
+
to: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface DateRangePickerProps {
|
|
26
|
+
/** Controlled `from` (ISO date YYYY-MM-DD). */
|
|
27
|
+
from?: string;
|
|
28
|
+
/** Controlled `to` (ISO date YYYY-MM-DD). */
|
|
29
|
+
to?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Event name emitted as `UI:{event}` with payload `{ from, to }`.
|
|
32
|
+
* Optional — when omitted, only the `onChange` callback fires.
|
|
33
|
+
*/
|
|
34
|
+
event?: EventEmit<{
|
|
35
|
+
from: string;
|
|
36
|
+
to: string;
|
|
37
|
+
}>;
|
|
38
|
+
/** Callback fired alongside the bus emit. */
|
|
39
|
+
onChange?: (range: {
|
|
40
|
+
from: string;
|
|
41
|
+
to: string;
|
|
42
|
+
}) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Preset shortcuts. Defaults to the standard finance set
|
|
45
|
+
* (Last 7d / Last 30d / This Month / This Quarter / YTD).
|
|
46
|
+
* Pass an empty array to hide presets entirely.
|
|
47
|
+
*/
|
|
48
|
+
presets?: DateRangePickerPreset[];
|
|
49
|
+
/** From-input label. */
|
|
50
|
+
fromLabel?: string;
|
|
51
|
+
/** To-input label. */
|
|
52
|
+
toLabel?: string;
|
|
53
|
+
/** Additional CSS classes. */
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
export declare const DateRangePicker: React.FC<DateRangePickerProps>;
|
|
@@ -16,10 +16,10 @@ import React from "react";
|
|
|
16
16
|
export interface FilterDefinition {
|
|
17
17
|
field: string;
|
|
18
18
|
label: string;
|
|
19
|
-
/** Filter type - 'date' renders a date picker, 'date-range'/'daterange' renders two date pickers */
|
|
20
|
-
filterType?: "select" | "toggle" | "checkbox" | "date" | "daterange" | "date-range";
|
|
19
|
+
/** Filter type - 'text' free-text input, 'date' renders a date picker, 'date-range'/'daterange' renders two date pickers */
|
|
20
|
+
filterType?: "text" | "select" | "toggle" | "checkbox" | "date" | "daterange" | "date-range";
|
|
21
21
|
/** Alias for filterType (schema compatibility) */
|
|
22
|
-
type?: "select" | "toggle" | "checkbox" | "date" | "daterange" | "date-range";
|
|
22
|
+
type?: "text" | "select" | "toggle" | "checkbox" | "date" | "daterange" | "date-range";
|
|
23
23
|
/** Options for select/toggle filters */
|
|
24
24
|
options?: readonly string[];
|
|
25
25
|
}
|
|
@@ -15,8 +15,16 @@ export interface StatDisplayProps {
|
|
|
15
15
|
max?: number;
|
|
16
16
|
/** Optional progress target. >0 renders a progress bar at value/target. */
|
|
17
17
|
target?: number;
|
|
18
|
-
/** Signed delta vs previous period. >0 renders ↑ green, <0 renders ↓ red, 0 hides. */
|
|
18
|
+
/** Signed delta vs previous period. >0 renders ↑ green, <0 renders ↓ red, 0 hides. Polarity reversal via `trendPolarity`. */
|
|
19
19
|
trend?: number;
|
|
20
|
+
/** Controls whether `trend > 0` is "good" (default) or "bad". `lower-is-better` inverts the color logic. */
|
|
21
|
+
trendPolarity?: 'higher-is-better' | 'lower-is-better';
|
|
22
|
+
/** When `'percent'`, renders trend with a `%` suffix (e.g. `↓ 3.3%`); default is `'absolute'`. */
|
|
23
|
+
trendFormat?: 'absolute' | 'percent';
|
|
24
|
+
/** Optional inline sparkline data appended to the trend row. Length < 2 renders nothing. */
|
|
25
|
+
sparklineData?: readonly number[];
|
|
26
|
+
/** Event name emitted as `UI:{clickEvent}` with `{ metricLabel }` when the card is clicked. */
|
|
27
|
+
clickEvent?: string;
|
|
20
28
|
/** Prefix prepended to the formatted value (e.g. "≈ "). */
|
|
21
29
|
prefix?: string;
|
|
22
30
|
/** Suffix appended to the formatted value (e.g. " /mo", " ms"). */
|
|
@@ -39,6 +39,7 @@ export { RepeatableFormSection, type RepeatableFormSectionProps, type Repeatable
|
|
|
39
39
|
export { ViolationAlert, type ViolationAlertProps, type ViolationRecord } from './ViolationAlert';
|
|
40
40
|
export { FormSectionHeader, type FormSectionHeaderProps } from './FormSectionHeader';
|
|
41
41
|
export { FlipCard, type FlipCardProps } from './FlipCard';
|
|
42
|
+
export { DateRangePicker, type DateRangePickerProps, type DateRangePickerPreset } from './DateRangePicker';
|
|
42
43
|
export { DateRangeSelector, type DateRangeSelectorProps, type DateRangeSelectorOption } from './DateRangeSelector';
|
|
43
44
|
export { ChartLegend, type ChartLegendProps, type ChartLegendItem } from './ChartLegend';
|
|
44
45
|
export { LineChart, type LineChartProps, type ChartDataPoint } from './LineChart';
|
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Chart Organism Component
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Data visualization. Supports bar / line / pie / area / donut / scatter /
|
|
5
|
+
* histogram chart types. Renders multi-series natively for bar / line / area
|
|
6
|
+
* via the `series` prop. Pie / donut consume the first series only. Scatter
|
|
7
|
+
* plots raw {x,y} points; histogram renders pre-binned data as gap-less bars.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Bus integration:
|
|
10
|
+
* - top-level `actions[].event` → `UI:{event}` on click (existing behavior)
|
|
11
|
+
* - per-data-point `drillEvent` → `UI:{drillEvent}` with `{ label, value, seriesLabel? }`
|
|
12
|
+
*
|
|
13
|
+
* Time axis: when `timeAxis: true`, ISO date labels are formatted via Intl
|
|
14
|
+
* (e.g. "Mar 2026"). Positioning remains evenly spaced (real time-scale
|
|
15
|
+
* alignment is deliberately deferred).
|
|
12
16
|
*/
|
|
13
17
|
import React from "react";
|
|
14
|
-
export type ChartType = "bar" | "line" | "pie" | "area" | "donut";
|
|
18
|
+
export type ChartType = "bar" | "line" | "pie" | "area" | "donut" | "scatter" | "histogram";
|
|
19
|
+
export type ChartStackMode = "none" | "stack" | "normalize";
|
|
15
20
|
export interface ChartDataPoint {
|
|
16
21
|
label: string;
|
|
17
22
|
value: number;
|
|
18
23
|
color?: string;
|
|
19
24
|
}
|
|
25
|
+
export interface ChartScatterPoint {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
label?: string;
|
|
29
|
+
size?: number;
|
|
30
|
+
color?: string;
|
|
31
|
+
}
|
|
20
32
|
export interface ChartSeries {
|
|
21
33
|
name: string;
|
|
22
34
|
data: readonly ChartDataPoint[];
|
|
23
35
|
color?: string;
|
|
36
|
+
dashed?: boolean;
|
|
24
37
|
}
|
|
25
38
|
export interface ChartAction {
|
|
26
39
|
label: string;
|
|
@@ -35,18 +48,25 @@ export interface ChartProps {
|
|
|
35
48
|
subtitle?: string;
|
|
36
49
|
/** Chart type */
|
|
37
50
|
chartType?: ChartType;
|
|
38
|
-
/**
|
|
51
|
+
/** Multi-series data */
|
|
39
52
|
series?: readonly ChartSeries[];
|
|
40
|
-
/** Simple
|
|
41
|
-
/** Simple data (single series shorthand) */
|
|
53
|
+
/** Simple single-series shorthand (bar/line/pie/area/donut/histogram) */
|
|
42
54
|
data?: readonly ChartDataPoint[];
|
|
55
|
+
/** Raw {x,y} points for scatter */
|
|
56
|
+
scatterData?: readonly ChartScatterPoint[];
|
|
43
57
|
/** Chart height in px */
|
|
44
58
|
height?: number;
|
|
45
59
|
/** Show legend */
|
|
46
60
|
showLegend?: boolean;
|
|
47
61
|
/** Show values on chart */
|
|
48
62
|
showValues?: boolean;
|
|
49
|
-
/**
|
|
63
|
+
/** Stack mode for bar / area */
|
|
64
|
+
stack?: ChartStackMode;
|
|
65
|
+
/** Format X-axis labels as time (ISO date in → "Mar 2026"-style label out) */
|
|
66
|
+
timeAxis?: boolean;
|
|
67
|
+
/** Event name emitted as `UI:{drillEvent}` with `{ label, value, seriesLabel? }` on data-point click */
|
|
68
|
+
drillEvent?: string;
|
|
69
|
+
/** Top-level chart actions (export, refresh, etc.) */
|
|
50
70
|
actions?: readonly ChartAction[];
|
|
51
71
|
/** Entity name for schema-driven auto-fetch */
|
|
52
72
|
entity?: string;
|