@proef/common-ui 2.2.6 → 2.3.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/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/legacy/components/charts/Charts.js +52 -192
- package/dist/esm/legacy/components/charts/Charts.js.map +1 -1
- package/dist/esm/legacy/components/molecules/DataTable/DataTable.js +81 -24
- package/dist/esm/legacy/components/molecules/DataTable/DataTable.js.map +1 -1
- package/dist/esm/legacy/components/organisms/GanttChart/GanttChart.js +7 -4
- package/dist/esm/legacy/components/organisms/GanttChart/GanttChart.js.map +1 -1
- package/dist/esm/v1/components/data/Charts/Charts.js +301 -0
- package/dist/esm/v1/components/data/Charts/Charts.js.map +1 -0
- package/dist/esm/v1/components/overlays/Dialog/Dialog.js +4 -1
- package/dist/esm/v1/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/esm/v1/components/tables/Table/ColumnFilter.js +3 -1
- package/dist/esm/v1/components/tables/Table/ColumnFilter.js.map +1 -1
- package/dist/esm/v1/primitives/forms/SelectInput/SelectInput.js +3 -1
- package/dist/esm/v1/primitives/forms/SelectInput/SelectInput.js.map +1 -1
- package/dist/style.components.css +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layered.css +1 -1
- package/dist/theme.css +28 -0
- package/dist/types/legacy/components/charts/Charts.d.ts +14 -11
- package/dist/types/legacy/components/molecules/DataTable/DataTable.d.ts +3 -0
- package/dist/types/legacy/components/organisms/GanttChart/GanttChart.d.ts +15 -1
- package/dist/types/legacy/exports/organisms.d.ts +1 -1
- package/dist/types/v1/components/data/Charts/Charts.d.ts +103 -0
- package/dist/types/v1/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -162,6 +162,9 @@ export interface DataTableLabels {
|
|
|
162
162
|
total: string;
|
|
163
163
|
/** Nome acessível da zona com scroll horizontal (só com `scrollAffordance`). */
|
|
164
164
|
scrollRegion?: string;
|
|
165
|
+
/** Botões do popup de filtro: a escolha da lista só filtra ao confirmar (default 'Cancel'/'Confirm'). */
|
|
166
|
+
cancel?: string;
|
|
167
|
+
confirm?: string;
|
|
165
168
|
}
|
|
166
169
|
interface DataTableProps<T> {
|
|
167
170
|
columns: DataTableColumn<T>[];
|
|
@@ -26,6 +26,14 @@ export interface GanttLegendItem {
|
|
|
26
26
|
kind?: 'block' | 'marker';
|
|
27
27
|
}
|
|
28
28
|
/** @deprecated Legacy — não usar em código novo. Ver Storybook › Legacy. */
|
|
29
|
+
export interface GanttClickInfo {
|
|
30
|
+
row: GanttRow;
|
|
31
|
+
/** Dia clicado (ISO yyyy-mm-dd) — só nos losangos. */
|
|
32
|
+
day?: string;
|
|
33
|
+
/** Linha-pai quando `row` é uma linha-filho. */
|
|
34
|
+
parent?: GanttRow;
|
|
35
|
+
}
|
|
36
|
+
/** @deprecated Legacy — não usar em código novo. Ver Storybook › Legacy. */
|
|
29
37
|
export interface GanttChartProps {
|
|
30
38
|
rows: GanttRow[];
|
|
31
39
|
/** Início e fim do eixo (ISO). */
|
|
@@ -48,13 +56,19 @@ export interface GanttChartProps {
|
|
|
48
56
|
count?: number;
|
|
49
57
|
parent?: GanttRow;
|
|
50
58
|
}) => React.ReactNode;
|
|
59
|
+
/** Clique num losango (marker). Torna-o clicável. */
|
|
60
|
+
onMarkerClick?: (info: GanttClickInfo & {
|
|
61
|
+
day: string;
|
|
62
|
+
}) => void;
|
|
63
|
+
/** Clique no rótulo de uma linha-filho (as linhas-pai continuam a expandir/recolher). */
|
|
64
|
+
onRowClick?: (info: GanttClickInfo) => void;
|
|
51
65
|
/** Nomes dos meses (i18n). Default PT. */
|
|
52
66
|
monthNames?: string[];
|
|
53
67
|
emptyText?: string;
|
|
54
68
|
className?: string;
|
|
55
69
|
}
|
|
56
70
|
/** @deprecated Legacy — não usar em código novo. Ver Storybook › Legacy. */
|
|
57
|
-
export default function GanttChart({ rows, start, end, dayWidth, labelWidth, labelHeader, legend, expanded: expandedProp, onExpandedChange, renderTooltip, monthNames, emptyText, className, }: GanttChartProps): React.JSX.Element;
|
|
71
|
+
export default function GanttChart({ rows, start, end, dayWidth, labelWidth, labelHeader, legend, expanded: expandedProp, onExpandedChange, renderTooltip, onMarkerClick, onRowClick, monthNames, emptyText, className, }: GanttChartProps): React.JSX.Element;
|
|
58
72
|
/**
|
|
59
73
|
* Utilitário: ISO de um dia do eixo (para quem precisa de formatar tooltips).
|
|
60
74
|
* @deprecated Legacy — não usar em código novo. Ver Storybook › Legacy.
|
|
@@ -2,7 +2,7 @@ export { default as Profile } from '../components/organisms/Profile/Profile';
|
|
|
2
2
|
export { LazyLoader } from '../components/organisms/LazyLoader/LazyLoader';
|
|
3
3
|
export { Selector } from '../components/organisms/Selector/Selector';
|
|
4
4
|
export { default as GanttChart, ganttDiaIso } from '../components/organisms/GanttChart/GanttChart';
|
|
5
|
-
export type { GanttRow, GanttLegendItem, GanttChartProps } from '../components/organisms/GanttChart/GanttChart';
|
|
5
|
+
export type { GanttRow, GanttLegendItem, GanttChartProps, GanttClickInfo } from '../components/organisms/GanttChart/GanttChart';
|
|
6
6
|
export { default as StatusMatrix } from '../components/organisms/StatusMatrix/StatusMatrix';
|
|
7
7
|
export type { StatusMatrixProps, StatusMatrixRow, StatusMatrixColumn, StatusMatrixStatus, StatusMatrixCell } from '../components/organisms/StatusMatrix/StatusMatrix';
|
|
8
8
|
export { default as MapaPontos } from '../components/organisms/MapaPontos/MapaPontos';
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** Uma série: nome (legenda e tooltip), um valor por etiqueta e, opcionalmente, a cor. */
|
|
3
|
+
export interface ChartSeries {
|
|
4
|
+
name: string;
|
|
5
|
+
values: number[];
|
|
6
|
+
color?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Clique num elemento: a etiqueta (ex: "Incidente"), a posição e a série (quando há várias). */
|
|
9
|
+
export type ChartClick = (label: string, index: number, series?: string) => void;
|
|
10
|
+
interface ChartBaseProps {
|
|
11
|
+
/** Altura em px. */
|
|
12
|
+
height?: number;
|
|
13
|
+
/** A carregar: mostra um bloco a pulsar com a altura do gráfico (a página não salta). */
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
/** Texto quando não há dados ou é tudo zero. */
|
|
16
|
+
emptyLabel?: string;
|
|
17
|
+
/** Descrição para leitores de ecrã (ex: "Tickets por estado"). */
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
/** Clique num elemento — tipicamente filtra a página. */
|
|
20
|
+
onClick?: ChartClick;
|
|
21
|
+
/**
|
|
22
|
+
* Etiqueta selecionada (ex: o filtro ativo): as outras ficam esbatidas. Com `onClick`,
|
|
23
|
+
* mostra o que o clique filtrou sem precisar de outra legenda.
|
|
24
|
+
*/
|
|
25
|
+
activeLabel?: string | null;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A paleta dos gráficos no tema atual (lida dos tokens `--color-chart-N`). Para legendas
|
|
30
|
+
* ou indicadores fora do gráfico com as mesmas cores das séries.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useChartPalette(): string[];
|
|
33
|
+
/** 'YYYY-Sxx' / 'YYYY-MM' / 'YYYY-MM-DD' → etiqueta curta no eixo; o resto fica igual. */
|
|
34
|
+
export declare function shortDateLabel(b: string): string;
|
|
35
|
+
export interface BarChartProps extends ChartBaseProps {
|
|
36
|
+
labels: string[];
|
|
37
|
+
/** Uma ou várias séries (ex: "Atribuídos" e "Resolvidos"), lado a lado ou empilhadas. */
|
|
38
|
+
series: ChartSeries[];
|
|
39
|
+
/** Barras deitadas, com as etiquetas à esquerda (bom para nomes compridos e rankings). */
|
|
40
|
+
horizontal?: boolean;
|
|
41
|
+
/** Séries empilhadas em vez de lado a lado. */
|
|
42
|
+
stacked?: boolean;
|
|
43
|
+
/** Só as primeiras N (ex: top 10). */
|
|
44
|
+
limit?: number;
|
|
45
|
+
/** Cor de cada barra, quando há uma só série (ex: a cor de cada estado). */
|
|
46
|
+
colors?: string[];
|
|
47
|
+
/** Formato dos valores no tooltip, nas etiquetas e no eixo (ex: minutos → "7h30"). */
|
|
48
|
+
format?: (v: number) => string;
|
|
49
|
+
/** Valor na ponta de cada barra (não nas empilhadas). */
|
|
50
|
+
showValues?: boolean;
|
|
51
|
+
/** Junta a percentagem do total ao valor (ex: "12 (34%)"); só com uma série. */
|
|
52
|
+
showPercent?: boolean;
|
|
53
|
+
/** Legenda das séries. Por omissão, só quando há mais do que uma. */
|
|
54
|
+
legend?: boolean;
|
|
55
|
+
/** Formato das etiquetas do eixo. Por omissão, datas ISO ficam curtas (`shortDateLabel`). */
|
|
56
|
+
formatLabel?: (label: string) => string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Barras verticais ou deitadas, de uma ou várias séries, lado a lado ou empilhadas.
|
|
60
|
+
*
|
|
61
|
+
* Clique numa barra com `onClick`; com `activeLabel`, as outras ficam esbatidas (o filtro
|
|
62
|
+
* aplicado lê-se no próprio gráfico). Sem dados, mostra `emptyLabel`; a carregar, um bloco.
|
|
63
|
+
*/
|
|
64
|
+
export declare function BarChart({ labels: allLabels, series: allSeries, horizontal, stacked, height, limit, colors, format, showValues, showPercent, legend, formatLabel, onClick, activeLabel, loading, emptyLabel, ariaLabel, className, }: BarChartProps): React.JSX.Element;
|
|
65
|
+
export interface DonutChartProps extends ChartBaseProps {
|
|
66
|
+
labels: string[];
|
|
67
|
+
values: number[];
|
|
68
|
+
/** Cor de cada fatia (ex: a cor de cada estado). Por omissão, a paleta. */
|
|
69
|
+
colors?: string[];
|
|
70
|
+
/** Formato dos valores no tooltip e nas fatias. */
|
|
71
|
+
format?: (v: number) => string;
|
|
72
|
+
/**
|
|
73
|
+
* Texto no centro do anel. `true` mostra o total (com `format`); um texto mostra esse
|
|
74
|
+
* texto (ex: "128 tickets").
|
|
75
|
+
*/
|
|
76
|
+
centerLabel?: boolean | string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Anel de uma distribuição (ex: tickets por estado). Percentagem no tooltip, valor nas
|
|
80
|
+
* fatias com espaço para ele e, com `centerLabel`, o total no meio.
|
|
81
|
+
*/
|
|
82
|
+
export declare function DonutChart({ labels, values, height, colors, format, centerLabel, onClick, activeLabel, loading, emptyLabel, ariaLabel, className, }: DonutChartProps): React.JSX.Element;
|
|
83
|
+
export interface LineChartProps extends ChartBaseProps {
|
|
84
|
+
labels: string[];
|
|
85
|
+
/**
|
|
86
|
+
* Uma ou várias linhas sobre as mesmas etiquetas — NÃO empilhadas: duas séries que medem
|
|
87
|
+
* o mesmo em dois momentos (criados vs fechados) leem-se uma contra a outra.
|
|
88
|
+
*/
|
|
89
|
+
series: ChartSeries[];
|
|
90
|
+
/** Área por baixo de cada linha. Só se lê bem com uma ou duas séries. */
|
|
91
|
+
area?: boolean;
|
|
92
|
+
/** Cor de cada série, pela ordem (ou `color` na série). */
|
|
93
|
+
colors?: string[];
|
|
94
|
+
/** Formato dos valores no tooltip e no eixo. */
|
|
95
|
+
format?: (v: number) => string;
|
|
96
|
+
/** Formato das etiquetas do eixo. Por omissão, datas ISO ficam curtas. */
|
|
97
|
+
formatLabel?: (label: string) => string;
|
|
98
|
+
/** Legenda das séries. Por omissão, só quando há mais do que uma. */
|
|
99
|
+
legend?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** Linhas sobre o tempo (ou outra sequência), com o tooltip de todas as séries no mesmo ponto. */
|
|
102
|
+
export declare function LineChart({ labels, series, height, area, colors, format, formatLabel, legend, onClick, loading, emptyLabel, ariaLabel, className, }: LineChartProps): React.JSX.Element;
|
|
103
|
+
export {};
|
package/dist/types/v1/index.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ export { Pagination } from './components/data/Pagination/Pagination';
|
|
|
70
70
|
export type { PaginationProps, PaginationLabels } from './components/data/Pagination/Pagination';
|
|
71
71
|
export { FilterChips } from './primitives/display/FilterChips/FilterChips';
|
|
72
72
|
export type { FilterChipsProps, FilterChipItem } from './primitives/display/FilterChips/FilterChips';
|
|
73
|
+
export { BarChart, DonutChart, LineChart, useChartPalette, shortDateLabel } from './components/data/Charts/Charts';
|
|
74
|
+
export type { BarChartProps, DonutChartProps, LineChartProps, ChartSeries, ChartClick } from './components/data/Charts/Charts';
|
|
73
75
|
export { Card } from './primitives/display/Card/Card';
|
|
74
76
|
export type { CardProps } from './primitives/display/Card/Card';
|
|
75
77
|
export { Kpi } from './primitives/display/Kpi/Kpi';
|