@proef/common-ui 2.6.35 → 2.6.36

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.
@@ -1,32 +1,6 @@
1
1
  import React from 'react';
2
- export interface OfflineBoxesLabels {
3
- /** Título do painel. */
4
- title: string;
5
- /** Secção da Inbox. */
6
- saved: string;
7
- /** Secção da Outbox. */
8
- waiting: string;
9
- /** Ao lado do ícone, com `{n}`. */
10
- toSend: string;
11
- /** A descarregar, com `{ready}` e `{total}`. */
12
- downloading: string;
13
- /** Última descarga, com `{ready}`, `{total}` e `{time}`. */
14
- savedAt: string;
15
- /** Ainda nada guardado. */
16
- nothingSaved: string;
17
- /** Falharam pedidos, com `{n}`. */
18
- failed: string;
19
- /** Lista do que está guardado, com `{n}`. */
20
- savedList: string;
21
- /** Nada por enviar. */
22
- nothingWaiting: string;
23
- refresh: string;
24
- close: string;
25
- pending: string;
26
- sending: string;
27
- rejected: string;
28
- }
29
- export declare const DEFAULT_OFFLINE_BOXES_LABELS: OfflineBoxesLabels;
2
+ import { type OfflineBoxesLabels, type OfflineSavedSummary, type OfflineWrite, type OfflineWriteDescription } from './OfflineBoxesView';
3
+ export { DEFAULT_OFFLINE_BOXES_LABELS, type OfflineBoxesLabels, type OfflineSavedItem, type OfflineSavedSummary, type OfflineSavedTag, type OfflineWrite, type OfflineWriteDescription, } from './OfflineBoxesView';
30
4
  export interface OfflineBoxesProps {
31
5
  /** O mesmo `storageId` do `connectOutbox` e do `connectInbox`. */
32
6
  storageId: string | undefined;
@@ -34,8 +8,14 @@ export interface OfflineBoxesProps {
34
8
  inboxIds: string[];
35
9
  /** O que o botão Atualizar faz (ex: chamar o `syncInbox`). Sem ele, não há botão. */
36
10
  onRefresh?: () => void;
37
- /** Endereço da API (`api.defaults.baseURL`), para mostrar o que está guardado sem ele à frente. */
11
+ /** Endereço da API (`api.defaults.baseURL`): os endereços chegam ao `describeSaved` e ao `describeWrite` sem ele à frente. */
38
12
  address?: string;
13
+ /** Linha ao lado do título na vista (ex: o nome do ecrã). */
14
+ subtitle?: string;
15
+ /** Transforma os endereços guardados nas linhas que se mostram (ex: uma por OT). Sem ele, mostra os endereços. */
16
+ describeSaved?: (paths: string[]) => OfflineSavedSummary;
17
+ /** Diz o que é cada escrita por enviar (ex: "Ajuste guardado"). Sem ele, ou se devolver `null`, mostra método e endereço. */
18
+ describeWrite?: (write: OfflineWrite) => OfflineWriteDescription | null;
39
19
  labels?: Partial<OfflineBoxesLabels>;
40
20
  className?: string;
41
21
  }
@@ -43,8 +23,8 @@ export interface OfflineBoxesProps {
43
23
  * O que a app tem guardado para usar sem rede (Inbox, verde) e o que tem por
44
24
  * enviar (Outbox, laranja), num ícone que se põe onde se quiser (ex: à
45
25
  * direita do título). Ao lado, a percentagem guardada, que sobe enquanto a
46
- * descarga corre, e quantas escritas faltam enviar. Tocar abre o painel com o
47
- * detalhe. Fora da app OnePoint não aparece.
26
+ * descarga corre, e quantas escritas faltam enviar. Tocar abre a vista inteira
27
+ * com o detalhe. Fora da app OnePoint não aparece.
48
28
  */
49
- export default function OfflineBoxes({ storageId, inboxIds, onRefresh, address, labels, className }: OfflineBoxesProps): React.JSX.Element | null;
29
+ export default function OfflineBoxes({ storageId, inboxIds, onRefresh, address, subtitle, describeSaved, describeWrite, labels, className }: OfflineBoxesProps): React.JSX.Element | null;
50
30
  export { OfflineBoxes };
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import type { OfflineBoxesState } from '../../../capabilities/onepoint-rn/useOfflineBoxes';
3
+ export interface OfflineBoxesLabels {
4
+ /** Título da vista. */
5
+ title: string;
6
+ /** Separador da Inbox. */
7
+ saved: string;
8
+ /** Separador da Outbox. */
9
+ waiting: string;
10
+ /** Ao lado do ícone, com `{n}`. */
11
+ toSend: string;
12
+ /** A descarregar, com `{ready}` e `{total}`. */
13
+ downloading: string;
14
+ /** Quantos itens estão guardados, com `{n}`. */
15
+ savedCount: string;
16
+ /** Última descarga, com `{date}` e `{time}`. */
17
+ savedAt: string;
18
+ /** Ainda nada guardado. */
19
+ nothingSaved: string;
20
+ /** Falharam pedidos, com `{n}`. */
21
+ failed: string;
22
+ /** Nada por enviar. */
23
+ nothingWaiting: string;
24
+ /** Por cima da lista do que falta enviar. */
25
+ waitingHint: string;
26
+ /** Texto da caixa de procura. */
27
+ search: string;
28
+ /** A procura não encontrou nada. */
29
+ noMatches: string;
30
+ refresh: string;
31
+ back: string;
32
+ pending: string;
33
+ sending: string;
34
+ rejected: string;
35
+ }
36
+ export declare const DEFAULT_OFFLINE_BOXES_LABELS: OfflineBoxesLabels;
37
+ /** Uma marca curta numa linha guardada (ex: `{ short: 'F', label: 'Ficha' }`). */
38
+ export interface OfflineSavedTag {
39
+ short: string;
40
+ label: string;
41
+ }
42
+ /** Uma linha da lista do que está guardado, como o portal a quer mostrar. */
43
+ export interface OfflineSavedItem {
44
+ key: string;
45
+ title: string;
46
+ /** Ao lado do título, mais pequeno (ex: concelho · mês). */
47
+ meta?: string;
48
+ /** Por baixo do título (ex: a descrição). */
49
+ detail?: string;
50
+ tags?: OfflineSavedTag[];
51
+ }
52
+ /** O que o portal faz dos endereços guardados. */
53
+ export interface OfflineSavedSummary {
54
+ items: OfflineSavedItem[];
55
+ /** Linha no fim da lista (ex: o que também está guardado e não é item). */
56
+ note?: string;
57
+ }
58
+ /** Uma escrita por enviar, em palavras do portal. */
59
+ export interface OfflineWriteDescription {
60
+ title: string;
61
+ detail?: string;
62
+ }
63
+ export interface OfflineWrite {
64
+ method: string;
65
+ path: string;
66
+ }
67
+ export interface OfflineBoxesViewProps {
68
+ state: OfflineBoxesState;
69
+ labels: OfflineBoxesLabels;
70
+ subtitle?: string;
71
+ address?: string;
72
+ onRefresh?: () => void;
73
+ onBack: () => void;
74
+ describeSaved?: (paths: string[]) => OfflineSavedSummary;
75
+ describeWrite?: (write: OfflineWrite) => OfflineWriteDescription | null;
76
+ }
77
+ export declare function filled(template: string, values: Record<string, string | number>): string;
78
+ export declare function percentOf(state: OfflineBoxesState): number | null;
79
+ export declare function toSendOf(state: OfflineBoxesState): number;
80
+ /**
81
+ * A vista inteira que o `OfflineBoxes` abre: dois separadores, o que está
82
+ * guardado (Inbox) e o que falta enviar (Outbox). Cada linha diz o que é nas
83
+ * palavras do portal (`describeSaved`, `describeWrite`); sem elas, mostra os
84
+ * endereços.
85
+ */
86
+ export default function OfflineBoxesView({ state, labels: L, subtitle, address, onRefresh, onBack, describeSaved, describeWrite }: OfflineBoxesViewProps): React.JSX.Element;
@@ -19,7 +19,7 @@ export { connectOutbox, isOutboxSaved, OutboxSavedError, OUTBOX_SAVED_MESSAGE, t
19
19
  export { connectInbox, INBOX_SAVED_AT_HEADER, inboxSavedAt, inboxStatus, syncInbox, watchInbox, type InboxBundle, type InboxEvent, type InboxConnectOptions, type InboxEach, type InboxGet, type InboxOptions, type InboxProgress, type InboxStatus, type InboxSyncOptions, type InboxTier, } from './capabilities/onepoint-rn/connectInbox';
20
20
  export { useOfflineBoxes, type OfflineBoxesOptions, type OfflineBoxesState } from './capabilities/onepoint-rn/useOfflineBoxes';
21
21
  export { default as OfflineBoxes, DEFAULT_OFFLINE_BOXES_LABELS } from './components/feedback/OfflineBoxes/OfflineBoxes';
22
- export type { OfflineBoxesLabels, OfflineBoxesProps } from './components/feedback/OfflineBoxes/OfflineBoxes';
22
+ export type { OfflineBoxesLabels, OfflineBoxesProps, OfflineSavedItem, OfflineSavedSummary, OfflineSavedTag, OfflineWrite, OfflineWriteDescription, } from './components/feedback/OfflineBoxes/OfflineBoxes';
23
23
  export { default as OfflineBoxesIcon } from './components/feedback/OfflineBoxes/OfflineBoxesIcon';
24
24
  export { useOrientacaoNaApp } from './capabilities/onepoint-rn/useOrientacaoNaApp';
25
25
  export { useMenuLateralNaApp } from './capabilities/onepoint-rn/useMenuLateralNaApp';
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@proef/common-ui",
3
- "version": "2.6.35",
4
- "description": "",
3
+ "version": "2.6.36",
4
+ "description": "Biblioteca de componentes e tema partilhada pelos portais Proef.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://dev.azure.com/ProefNext/FTTx%20BoM/_git/CommonUI"
8
+ },
5
9
  "main": "dist/esm/index.js",
6
10
  "module": "dist/esm/index.js",
7
11
  "types": "dist/types/index.d.ts",
@@ -26,9 +30,6 @@
26
30
  "build": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json && tailwindcss -i src/styles/tailwind.css -o dist/style.css --minify && tailwindcss -i src/styles/tailwind.layered.css -o dist/style.layered.css --minify && node scripts/css-components-layer.mjs && node scripts/extrair-imagens-css.mjs && node scripts/gerar-tema.mjs && node -e \"const fs=require('fs');fs.copyFileSync('src/styles/tailwind.app.css','dist/tailwind.css');fs.copyFileSync('src/styles/tokens.css','dist/tokens.css')\" && node -e \"import('./dist/esm/v1/capabilities/theme/useTheme.js').then(m=>require('fs').writeFileSync('dist/theme-boot.js',m.themeBootScript))\"",
27
31
  "storybook": "storybook dev -p 6006",
28
32
  "build-storybook": "storybook build",
29
- "pub": "git add . && git commit -m \"update\" && git push && npm test && npm version patch && npm run build && npm publish",
30
- "pubOnly": "npm test && npm version patch && npm run build && npm publish",
31
- "pubOnlySameVersion": "npm run build && npm publish",
32
33
  "test": "vitest run",
33
34
  "test:watch": "vitest",
34
35
  "test:ci": "vitest run --coverage",