@proef/common-ui 2.6.40 → 2.6.41
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 +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/v1/components/data/MonthCalendar/MonthCalendar.js +56 -4
- package/dist/esm/v1/components/data/MonthCalendar/MonthCalendar.js.map +1 -1
- package/dist/esm/v1/components/forms/CheckboxGroup/CheckboxGroup.js +62 -0
- package/dist/esm/v1/components/forms/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/dist/esm/v1/components/overlays/ContextMenu/ContextMenu.js +133 -43
- package/dist/esm/v1/components/overlays/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/style.components.css +2 -2
- package/dist/style.css +2 -2
- package/dist/style.layered.css +2 -2
- package/dist/types/v1/components/data/MonthCalendar/MonthCalendar.d.ts +31 -2
- package/dist/types/v1/components/forms/CheckboxGroup/CheckboxGroup.d.ts +33 -0
- package/dist/types/v1/components/overlays/ContextMenu/ContextMenu.d.ts +6 -1
- package/dist/types/v1/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -2,10 +2,20 @@ import React from 'react';
|
|
|
2
2
|
import { type BadgeTone } from '../../../primitives/display/Badge/Badge';
|
|
3
3
|
/** Os mesmos tons do `Badge`: estados (`ok`, `risco`, `incumprido`, `neutral`, `accent`) e classificações. */
|
|
4
4
|
export type MonthCalendarTone = BadgeTone;
|
|
5
|
+
/**
|
|
6
|
+
* Ícone pequeno no canto do dia: `approved` polegar verde, `pending` "?" laranja,
|
|
7
|
+
* `rejected` polegar vermelho para baixo, `holiday` bandeira vermelha,
|
|
8
|
+
* `warning` triângulo laranja (ex: dois registos no mesmo dia), `blocked` ⊗ cinzento
|
|
9
|
+
* (ex: um dia que não conta).
|
|
10
|
+
*/
|
|
11
|
+
export type MonthCalendarIcon = 'approved' | 'pending' | 'rejected' | 'holiday' | 'warning' | 'blocked';
|
|
5
12
|
export interface MonthCalendarDay {
|
|
6
13
|
/** `YYYY-MM-DD`. Os dias de outros meses são ignorados, por isso pode passar-se a lista do ano inteiro. */
|
|
7
14
|
date: string;
|
|
8
|
-
tone:
|
|
15
|
+
/** Cor do dia. Sem `tone` nem `color`, o dia fica sem fundo (ex: só com um ícone ou uma etiqueta). */
|
|
16
|
+
tone?: MonthCalendarTone;
|
|
17
|
+
/** Ícone no canto de cima à direita. */
|
|
18
|
+
icon?: MonthCalendarIcon;
|
|
9
19
|
/** O que o dia tem (ex: "Férias · Autorizado"); vai para o `data-tip` e para os leitores de ecrã. */
|
|
10
20
|
label?: string;
|
|
11
21
|
/** Marca pequena no canto do dia (ex: o nível de aprovação já feito, "1" a "4"). */
|
|
@@ -17,6 +27,15 @@ export interface MonthCalendarDay {
|
|
|
17
27
|
pattern?: 'striped' | 'hatched';
|
|
18
28
|
/** Metade do dia (canto de baixo à direita) noutro tom: vários códigos no mesmo dia. */
|
|
19
29
|
splitTone?: MonthCalendarTone;
|
|
30
|
+
/**
|
|
31
|
+
* Cor própria do dia, em hexadecimal (`#RRGGBB` ou `#RGB`), por cima do `tone`
|
|
32
|
+
* (ex: a cor de um código de ausência definida noutro sistema). O número fica
|
|
33
|
+
* a preto ou a branco, o que tiver mais contraste. Se a cor não for válida,
|
|
34
|
+
* fica o `tone`.
|
|
35
|
+
*/
|
|
36
|
+
color?: string;
|
|
37
|
+
/** Como `color`, mas para a metade do dia (`splitTone`). */
|
|
38
|
+
splitColor?: string;
|
|
20
39
|
}
|
|
21
40
|
/** Eventos de um dia, com a data já resolvida. Com algum destes, os dias passam a botões. */
|
|
22
41
|
export interface MonthCalendarDayHandlers {
|
|
@@ -47,6 +66,8 @@ export interface MonthCalendarProps extends Omit<React.HTMLAttributes<HTMLElemen
|
|
|
47
66
|
dimPast?: boolean;
|
|
48
67
|
/** O mês que contém hoje fica com uma linha turquesa por baixo do cabeçalho. Por omissão sim. */
|
|
49
68
|
highlightCurrent?: boolean;
|
|
69
|
+
/** Faixa de fundo nas colunas de sábado e domingo. Por omissão sim; sem ela, só o número fica mais claro. */
|
|
70
|
+
weekendBand?: boolean;
|
|
50
71
|
/** Texto curto à direita do nome do mês (ex: "4 dias de férias"). */
|
|
51
72
|
summary?: React.ReactNode;
|
|
52
73
|
/** Dias selecionados (a azul, por cima do tom). Ver `useDateSelection`. */
|
|
@@ -57,6 +78,14 @@ export interface MonthCalendarProps extends Omit<React.HTMLAttributes<HTMLElemen
|
|
|
57
78
|
*/
|
|
58
79
|
isDayDisabled?: (date: string) => string | boolean | undefined;
|
|
59
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Fundo e texto para uma cor própria (`#RRGGBB` ou `#RGB`); `undefined` se não for válida.
|
|
83
|
+
* O texto é o que tiver mais contraste (luminância relativa da WCAG).
|
|
84
|
+
*/
|
|
85
|
+
export declare function corDoDia(cor: string | undefined): {
|
|
86
|
+
backgroundColor: string;
|
|
87
|
+
color: string;
|
|
88
|
+
} | undefined;
|
|
60
89
|
/**
|
|
61
90
|
* Um mês, com os dias pintados por tom (ex: férias, feriados, ausências).
|
|
62
91
|
* Para o ano inteiro, um por mês numa grelha (ver a story "Ano inteiro").
|
|
@@ -70,5 +99,5 @@ export interface MonthCalendarProps extends Omit<React.HTMLAttributes<HTMLElemen
|
|
|
70
99
|
*
|
|
71
100
|
* **Aceita os atributos HTML do `<section>`** (ex: `id`, `className`).
|
|
72
101
|
*/
|
|
73
|
-
export default function MonthCalendar({ year, month, days, title, locale, weekStartsOn, today, dimPast, highlightCurrent, summary, selected, isDayDisabled, onDayPointerDown, onDayPointerEnter, onDayClick, onDayContextMenu, onDayKeyDown, className, ...props }: MonthCalendarProps): React.JSX.Element;
|
|
102
|
+
export default function MonthCalendar({ year, month, days, title, locale, weekStartsOn, today, dimPast, highlightCurrent, weekendBand, summary, selected, isDayDisabled, onDayPointerDown, onDayPointerEnter, onDayClick, onDayContextMenu, onDayKeyDown, className, ...props }: MonthCalendarProps): React.JSX.Element;
|
|
74
103
|
export { MonthCalendar };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CheckboxGroupOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface CheckboxGroupProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
8
|
+
options: CheckboxGroupOption[];
|
|
9
|
+
/** Os valores marcados. */
|
|
10
|
+
value: readonly string[];
|
|
11
|
+
/** Recebe os valores marcados, pela ordem das opções. */
|
|
12
|
+
onChange: (value: string[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* `exclusive` (por omissão): um clique marca só essa opção; Shift+clique junta-a
|
|
15
|
+
* ou tira-a das outras (fica sempre pelo menos uma). `multiple`: cada clique
|
|
16
|
+
* marca ou desmarca, como caixas normais.
|
|
17
|
+
*/
|
|
18
|
+
mode?: 'exclusive' | 'multiple';
|
|
19
|
+
/** Nome do grupo para os leitores de ecrã (ex: "Calendários"). */
|
|
20
|
+
'aria-label'?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Caixas de marcar lado a lado, para escolher uma ou várias opções de uma lista curta
|
|
24
|
+
* (ex: os calendários Férias / Ausências / Serviços externos).
|
|
25
|
+
*
|
|
26
|
+
* Por omissão (`exclusive`) o clique escolhe só uma opção e o **Shift+clique** junta
|
|
27
|
+
* ou tira opções, como a seleção de ficheiros. O teclado faz o mesmo: Espaço escolhe
|
|
28
|
+
* só essa, Shift+Espaço junta ou tira.
|
|
29
|
+
*
|
|
30
|
+
* **Aceita os atributos HTML do `<div>`** (ex: `id`, `className`).
|
|
31
|
+
*/
|
|
32
|
+
export default function CheckboxGroup({ options, value, onChange, mode, className, ...props }: CheckboxGroupProps): React.JSX.Element;
|
|
33
|
+
export { CheckboxGroup };
|
|
@@ -14,6 +14,11 @@ export interface ContextMenuItem {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
/** Linha a separar este item do anterior. */
|
|
16
16
|
separator?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Submenu (ex: Marcar ▸ Férias / Ausências): abre ao lado ao passar o rato, ao clicar
|
|
19
|
+
* ou com → / Enter; ← ou Esc voltam. Com submenu, o `onSelect` do item é ignorado.
|
|
20
|
+
*/
|
|
21
|
+
items?: ContextMenuItem[];
|
|
17
22
|
}
|
|
18
23
|
export interface ContextMenuProps {
|
|
19
24
|
/** Onde abre, em coordenadas do ecrã (ex: `clientX`/`clientY` do botão direito). `null` = fechado. */
|
|
@@ -38,7 +43,7 @@ export interface ContextMenuProps {
|
|
|
38
43
|
* botão: a app decide quando abre.
|
|
39
44
|
*
|
|
40
45
|
* Teclado: ↑/↓ (e Home/End) andam pelos itens ativos, Enter escolhe, Esc e Tab
|
|
41
|
-
* fecham. Fecha também ao clicar fora, ao fazer scroll ou ao redimensionar. Ao
|
|
46
|
+
* fecham. Um item com `items` abre um submenu ao lado (→ ou Enter; ← volta). Fecha também ao clicar fora, ao fazer scroll ou ao redimensionar. Ao
|
|
42
47
|
* fechar, o foco volta onde estava. Nunca sai do ecrã: perto das bordas, abre
|
|
43
48
|
* para o outro lado.
|
|
44
49
|
*/
|
package/dist/types/v1/index.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ export type { RichTextProps } from './primitives/display/RichText/RichText';
|
|
|
54
54
|
export { isRichText, sanitizeRichText, richTextToPlain, richTextIsEmpty, textToRichText, richTextContentClasses, } from './primitives/display/RichText/utils';
|
|
55
55
|
export { default as FormGrid, FormDivider } from './components/forms/FormGrid/FormGrid';
|
|
56
56
|
export type { FormGridProps } from './components/forms/FormGrid/FormGrid';
|
|
57
|
+
export { default as CheckboxGroup } from './components/forms/CheckboxGroup/CheckboxGroup';
|
|
58
|
+
export type { CheckboxGroupProps, CheckboxGroupOption } from './components/forms/CheckboxGroup/CheckboxGroup';
|
|
57
59
|
export { default as FormField, FieldMark } from './components/forms/FormField/FormField';
|
|
58
60
|
export type { FormFieldProps, FieldMarkProps } from './components/forms/FormField/FormField';
|
|
59
61
|
export { default as Button } from './primitives/buttons/Button/Button';
|
|
@@ -102,7 +104,7 @@ export type { FilterChipsProps, FilterChipItem } from './primitives/display/Filt
|
|
|
102
104
|
export { BarChart, DonutChart, LineChart, useChartPalette, shortDateLabel } from './components/data/Charts/Charts';
|
|
103
105
|
export type { BarChartProps, DonutChartProps, LineChartProps, ChartSeries, ChartClick } from './components/data/Charts/Charts';
|
|
104
106
|
export { MonthCalendar } from './components/data/MonthCalendar/MonthCalendar';
|
|
105
|
-
export type { MonthCalendarProps, MonthCalendarDay, MonthCalendarTone, MonthCalendarDayHandlers } from './components/data/MonthCalendar/MonthCalendar';
|
|
107
|
+
export type { MonthCalendarProps, MonthCalendarDay, MonthCalendarTone, MonthCalendarIcon, MonthCalendarDayHandlers } from './components/data/MonthCalendar/MonthCalendar';
|
|
106
108
|
export { DayTimeline, DayTimelineScale, DEFAULT_DAY_TIMELINE_LABELS, scheduleParts, toMinutes, uncoveredIntervals } from './components/data/DayTimeline/DayTimeline';
|
|
107
109
|
export type { DayTimelineProps, DayTimelineInterval, DayTimelineSchedule, DayTimelineLabels, DayTimelineScaleProps } from './components/data/DayTimeline/DayTimeline';
|
|
108
110
|
export { Card } from './primitives/display/Card/Card';
|