@ffid-br/tailor-ui 0.10.2 → 0.13.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/style.css CHANGED
@@ -130,6 +130,10 @@
130
130
  .tailor-table__arrow { opacity: 0.35; }
131
131
  .tailor-table__arrow--active { opacity: 1; color: var(--tailor-brand-primary-text); }
132
132
  .tailor-table__clickable { cursor: pointer; }
133
+ /* Linha aberta (renderExpanded): o detalhe fica colado na linha, sem hover nem borda entre os dois. */
134
+ .tailor-table__row--open td { background: color-mix(in srgb, var(--tailor-brand-text) 3%, transparent); }
135
+ .tailor-table tbody tr.tailor-table__expanded td { border-top: 0; padding: var(--tailor-table-expanded-padding, 13px 21px 21px); background: color-mix(in srgb, var(--tailor-brand-text) 3%, transparent); }
136
+ .tailor-table tbody tr.tailor-table__expanded:hover td { background: color-mix(in srgb, var(--tailor-brand-text) 3%, transparent); }
133
137
  .tailor-table__clickable:focus-visible, .tailor-table button:focus-visible { outline: 3px solid var(--tailor-brand-primary); outline-offset: -3px; }
134
138
  .tailor-table__state { padding: 34px 13px; text-align: center; color: var(--tailor-brand-text-muted); }
135
139
  .tailor-table tfoot td { border-top: 1px solid var(--tailor-brand-text); font-weight: 600; }
@@ -498,3 +502,34 @@ textarea.tailor-field__control { padding: 8px 13px; min-height: 89px; }
498
502
  .tailor-mascote__corpo, .tailor-mascote__olho, .tailor-mascote__verde { animation: none; }
499
503
  .tailor-mv *, .tailor-mv *::after { animation: none !important; transition: none !important; }
500
504
  }
505
+
506
+ /* TailorNovidades — changelog do app. Cores da marca, cantos retos. */
507
+ .tailor-nov__trigger {
508
+ display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: none; cursor: pointer;
509
+ font: inherit; font-size: 14px; color: var(--tailor-brand-text); border-radius: var(--tailor-brand-radius);
510
+ }
511
+ .tailor-nov__trigger:hover { background: var(--tailor-brand-border); }
512
+ .tailor-nov__trigger:focus-visible, .tailor-nov__close:focus-visible, .tailor-nov__more:focus-visible { outline: 3px solid var(--tailor-brand-primary); outline-offset: 2px; }
513
+ .tailor-nov__dot { width: 8px; height: 8px; background: var(--tailor-brand-text-muted); border-radius: var(--tailor-brand-radius); }
514
+ .tailor-nov__count {
515
+ min-width: 21px; padding: 0 6px; background: var(--tailor-brand-primary); color: var(--tailor-brand-on-primary);
516
+ font-size: 12px; font-weight: 500; line-height: 21px; text-align: center; font-variant-numeric: lining-nums; border-radius: var(--tailor-brand-radius);
517
+ }
518
+ .tailor-nov__overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgb(0 0 0 / 0.5); }
519
+ .tailor-nov {
520
+ display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: 80vh; background: var(--tailor-white);
521
+ color: var(--tailor-brand-text); font-family: var(--tailor-brand-body-font); border-radius: var(--tailor-brand-radius);
522
+ }
523
+ :where(.dark, [data-theme="dark"]) .tailor-nov { background: var(--tailor-black); border: 1px solid var(--tailor-brand-border); }
524
+ .tailor-nov__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; padding: 21px 21px 13px; border-bottom: 1px solid var(--tailor-brand-border); }
525
+ .tailor-nov__title { margin: 0; font-family: var(--tailor-brand-heading-font); font-weight: var(--tailor-brand-heading-weight); font-size: 26px; line-height: 1.2; }
526
+ .tailor-nov__sub { margin: 4px 0 0; font-size: 13px; color: var(--tailor-brand-text-muted); }
527
+ .tailor-nov__close { flex-shrink: 0; display: inline-flex; padding: 6px; border: 0; background: none; cursor: pointer; color: var(--tailor-brand-text-muted); border-radius: var(--tailor-brand-radius); }
528
+ .tailor-nov__close:hover { color: var(--tailor-brand-text); }
529
+ .tailor-nov__body { flex: 1; overflow-y: auto; padding: 21px; display: flex; flex-direction: column; gap: 34px; }
530
+ .tailor-nov__entry { margin: 0; }
531
+ .tailor-nov__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--tailor-brand-text-muted); }
532
+ .tailor-nov__tela { padding-left: 8px; border-left: 1px solid var(--tailor-brand-border); }
533
+ .tailor-nov__entry-title { margin: 4px 0 0; font-size: 16px; font-weight: 500; }
534
+ .tailor-nov__list { margin: 13px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; }
535
+ .tailor-nov__more { align-self: flex-start; padding: 8px 0; border: 0; background: none; cursor: pointer; font: inherit; font-size: 14px; color: var(--tailor-brand-text); text-decoration: underline; text-underline-offset: 3px; }
@@ -0,0 +1,44 @@
1
+ export type TailorNovidade = {
2
+ id: string;
3
+ /** YYYY-MM-DD */
4
+ data: string;
5
+ titulo: string;
6
+ itens: string[];
7
+ /** Tela a que a mudança se refere (ex.: "Campanhas"). */
8
+ tela?: string;
9
+ };
10
+ /**
11
+ * Quantas novidades (lista com a mais recente primeiro) são mais novas que a última vista.
12
+ * Nunca viu: todas. Guarda o id mais recente visto no localStorage; storage bloqueado só não lembra.
13
+ */
14
+ export declare function useNovidades(novidades: TailorNovidade[], { chave, usuario }: {
15
+ chave: string;
16
+ usuario?: string;
17
+ }): {
18
+ naoVistas: number;
19
+ marcarVistas: () => void;
20
+ };
21
+ export type TailorNovidadesDialogProps = {
22
+ aberto: boolean;
23
+ onFechar: () => void;
24
+ /** Mais recente primeiro. */
25
+ novidades: TailorNovidade[];
26
+ /** Quantas aparecem de início; o resto fica atrás de "Ver anteriores". Padrão: 5. */
27
+ limite?: number;
28
+ titulo?: string;
29
+ subtitulo?: string;
30
+ };
31
+ /** Modal com o changelog do app. Esc, clique fora e o botão fechar devolvem o foco a quem abriu. */
32
+ export declare function TailorNovidadesDialog({ aberto, onFechar, novidades, limite, titulo, subtitulo }: TailorNovidadesDialogProps): import('react').ReactPortal | null;
33
+ export type TailorNovidadesProps = {
34
+ novidades: TailorNovidade[];
35
+ /** Identifica o app no localStorage (ex.: "crm"). */
36
+ chave: string;
37
+ usuario?: string;
38
+ limite?: number;
39
+ /** Texto do gatilho. Padrão: "Novidades". */
40
+ rotulo?: string;
41
+ className?: string;
42
+ };
43
+ /** Gatilho compacto + modal. Contador verde com as não vistas (9+); abrir marca tudo como visto. */
44
+ export declare function TailorNovidades({ novidades, chave, usuario, limite, rotulo, className }: TailorNovidadesProps): import("react").JSX.Element;
@@ -42,6 +42,9 @@ export type TailorTableProps<T> = {
42
42
  totalRows?: number;
43
43
  };
44
44
  onRowClick?: (row: T) => void;
45
+ /** Conteúdo aberto embaixo da linha (detalhe, formulário), na largura da tabela. Quem
46
+ * controla o que está aberto é o app: devolva `null` para a linha fechada. */
47
+ renderExpanded?: (row: T) => React.ReactNode;
45
48
  /** Cabeçalho preso ao rolar a página. */
46
49
  stickyHeader?: boolean;
47
50
  className?: string;
@@ -53,6 +56,6 @@ export declare function formatValue(v: unknown, type?: TailorColumnType, locale?
53
56
  * em mono, ordenação, paginação (navegador ou servidor) e linha de total.
54
57
  * Visual por variáveis `--tailor-brand-*` e `--tailor-table-*`, como o cabeçalho.
55
58
  */
56
- export declare function TailorTable<T>({ columns, rows, rowKey, caption, loading, empty, sort, onSortChange, defaultSort, pageSize, pagination, onRowClick, stickyHeader, className, }: TailorTableProps<T>): React.JSX.Element;
59
+ export declare function TailorTable<T>({ columns, rows, rowKey, caption, loading, empty, sort, onSortChange, defaultSort, pageSize, pagination, onRowClick, renderExpanded, stickyHeader, className, }: TailorTableProps<T>): React.JSX.Element;
57
60
  /** Soma de uma coluna, para usar em `total`. */
58
61
  export declare const sumBy: <T>(value: (r: T) => number) => (rows: T[]) => number;
@@ -14,6 +14,11 @@ export type TailorMessages = {
14
14
  dismiss: string;
15
15
  skip: string;
16
16
  required: string;
17
+ news: string;
18
+ newsSubtitle: string;
19
+ seePrevious: string;
20
+ close: string;
21
+ unseen: (count: string) => string;
17
22
  };
18
23
  export declare const TAILOR_MESSAGES: Record<string, TailorMessages>;
19
24
  export type TailorLocale = {
@@ -36,3 +36,5 @@ export { TailorField } from './components/TailorField';
36
36
  export type { TailorFieldProps } from './components/TailorField';
37
37
  export { TailorButton } from './components/TailorButton';
38
38
  export type { TailorButtonProps } from './components/TailorButton';
39
+ export { TailorNovidades, TailorNovidadesDialog, useNovidades } from './components/TailorNovidades';
40
+ export type { TailorNovidade, TailorNovidadesProps, TailorNovidadesDialogProps } from './components/TailorNovidades';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ffid-br/tailor-ui",
3
3
  "private": false,
4
- "version": "0.10.2",
4
+ "version": "0.13.0",
5
5
  "description": "Primitivos de marca Tailor.ia em React: loader, intro, transição de login, lockup e barra lateral.",
6
6
  "type": "module",
7
7
  "main": "dist/index.umd.js",