@selectwin/kit 0.1.73 → 0.1.75

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.
@@ -0,0 +1,28 @@
1
+ import { ReactNode } from 'react';
2
+ import { SelectListChromeProps, SelectListPagination } from './internal/listChrome';
3
+ export declare function SelectCardGrid<T>({ items, getId, renderItem, loading, skeletonCount, empty, pagination, create, minCardWidth, title, help, description, action, filters, tools, }: {
4
+ items: T[];
5
+ getId: (item: T) => string;
6
+ /** O card de um item — tipicamente um SelectRecordCard. */
7
+ renderItem: (item: T) => ReactNode;
8
+ loading?: boolean;
9
+ /** Quantos cards-esqueleto enquanto carrega (padrão 6 — duas fileiras). */
10
+ skeletonCount?: number;
11
+ empty?: {
12
+ icon?: ReactNode;
13
+ heading: ReactNode;
14
+ text?: ReactNode;
15
+ action?: ReactNode;
16
+ };
17
+ /** Rodapé de paginação — mesma prop da SelectDataTable. */
18
+ pagination?: SelectListPagination;
19
+ /** Card tracejado no fim da grade. Substitui o botão de criar na barra do título:
20
+ * numa grade de componentes, criar É um item da grade. */
21
+ create?: {
22
+ label: ReactNode;
23
+ description?: ReactNode;
24
+ onAction: () => void;
25
+ };
26
+ /** Piso da coluna da grade (`auto-fill` + `minmax`). */
27
+ minCardWidth?: string;
28
+ } & SelectListChromeProps): import("react").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { SelectListPagination } from './internal/listChrome';
2
3
  /**
3
4
  * Grid-track width for a date/time column — a FIXED width that fits a full pt-BR
4
5
  * "dd/mm/aaaa, hh:mm" without clipping (the problem a bare `1fr` column had: it shared the
@@ -40,7 +41,7 @@ export interface SelectDataColumn<T> {
40
41
  * guards mirror SelectMoney — storage unavailable = in-memory only.
41
42
  */
42
43
  export declare function useSelectPageSize(key: string, fallback: number, options?: number[]): [number, (size: number) => void];
43
- export declare function SelectDataTable<T>({ columns, items, getId, loading, empty, pagination, onRowClick, title, help, action, filters, columnsKey, }: {
44
+ export declare function SelectDataTable<T>({ columns, items, getId, loading, empty, pagination, onRowClick, title, help, description, action, filters, columnsKey, }: {
44
45
  columns: SelectDataColumn<T>[];
45
46
  items: T[];
46
47
  getId: (item: T) => string;
@@ -55,45 +56,23 @@ export declare function SelectDataTable<T>({ columns, items, getId, loading, emp
55
56
  * Footer pager. The cursor fields (hasPrevious/onPrevious/hasNext/onNext) are enough for a
56
57
  * basic centered prev/next pager. Provide `total` + `pageSize` + `page` to show the count
57
58
  * label, and additionally `onPage` (+ optional `pageCount`) to render numbered page buttons.
59
+ * O mesmo rodapé da SelectCardGrid (internal/listChrome) — ver SelectListPagination.
58
60
  */
59
- pagination?: {
60
- hasPrevious: boolean;
61
- onPrevious: () => void;
62
- hasNext: boolean;
63
- onNext: () => void;
64
- /** Total item count across all pages (drives the "de N" label). */
65
- total?: number;
66
- /** Items per page — with `total` + `page` yields the "X–Y de N" range label. */
67
- pageSize?: number;
68
- /** Current page, 1-based. */
69
- page?: number;
70
- /** Total pages — enables numbered buttons when paired with `onPage`. */
71
- pageCount?: number;
72
- /** Jump to a 1-based page (enables numbered buttons). */
73
- onPage?: (page: number) => void;
74
- /** Noun for the count label, e.g. "produtos" (defaults to "resultados"). */
75
- noun?: string;
76
- /**
77
- * Page-size menu ("N por página", bottom-left of the footer) — the user picks how many
78
- * rows per page. Cap the options at 50% of the backend's zod max for the endpoint
79
- * (e.g. max 100 → [10, 25, 50]). Requires `onPageSizeChange`; pair the state with
80
- * `useSelectPageSize` so the choice persists per table.
81
- */
82
- pageSizeOptions?: number[];
83
- /** Apply a new page size (also reset the offset to the first page in the caller). */
84
- onPageSizeChange?: (size: number) => void;
85
- };
61
+ pagination?: SelectListPagination;
86
62
  onRowClick?: (item: T) => void;
87
63
  /** Card title in the table's own header bar — renders a self-contained titled card
88
64
  * (don't wrap in SelectSection; the table is already a card). */
89
65
  title?: ReactNode;
90
66
  /** Ajuda contextual: vira o "!" ao lado do título (SelectInfoTip). Precisa de `title`. */
91
67
  help?: ReactNode;
92
- /** Right-aligned header action (e.g. an "Adicionar" button). */
68
+ /** Linha discreta ABAIXO do título (subtítulo/descrição da lista) — ver SelectTable. */
69
+ description?: ReactNode;
70
+ /** Ação sobre o RECURSO, à direita do título (ex.: "Criar link"). Controles da VISTA
71
+ * (seletor de colunas) descem sozinhos para a faixa de filtros — não os passe aqui. */
93
72
  action?: ReactNode;
94
- /** Filter controls (e.g. a SelectFilterBar) embedded in the table's header bar, left of
95
- * the action/column picker — table + filters read as ONE unit, and the bar stays
96
- * reachable when a filter empties the table. */
73
+ /** Filter controls (e.g. a SelectFilterBar) na PRÓPRIA faixa do card, entre o título e o
74
+ * cabeçalho de colunas — table + filters read as ONE unit, and the bar stays reachable
75
+ * when a filter empties the table. */
97
76
  filters?: ReactNode;
98
77
  /**
99
78
  * Enables the column-visibility picker (a gear in the header bar) and persists the
@@ -0,0 +1,42 @@
1
+ import { ReactNode, ComponentPropsWithoutRef } from 'react';
2
+ export type SelectRecordCardTone = 'success' | 'critical' | 'warning' | 'info' | 'neutral';
3
+ type SelectRecordCardOwnProps = {
4
+ /** Visual da esquerda — SelectLayoutThumb, SelectAvatar ou um ícone. */
5
+ media?: ReactNode;
6
+ title: ReactNode;
7
+ /** Linha de apoio sob o título (ex.: o SelectCopyableId do id — passe `reveal="always"`,
8
+ * que fora de tabela não há hover de linha para revelar o botão de copiar). */
9
+ subtitle?: ReactNode;
10
+ /** Canto direito do topo — tipicamente um SelectRowActions. */
11
+ actions?: ReactNode;
12
+ /** Badges no meio do card (layout, escopo, canal…). */
13
+ tags?: ReactNode;
14
+ /** Rodapé à esquerda: bolinha + rótulo do estado. Sem `status` e sem `meta` o rodapé
15
+ * não é renderizado. Estado AUSENTE é `undefined`, nunca um "provável" — o card não
16
+ * inventa veredito para dado que a lista não trouxe. */
17
+ status?: {
18
+ tone?: SelectRecordCardTone;
19
+ label: ReactNode;
20
+ };
21
+ /** Rodapé à direita — normalmente a data de atualização. */
22
+ meta?: ReactNode;
23
+ /** Rota do card inteiro (o menu de ações segue clicável). */
24
+ to?: string;
25
+ /** Faixa de destaque no topo (ex.: o registro em vigor). */
26
+ accent?: boolean;
27
+ };
28
+ export type SelectRecordCardProps = SelectRecordCardOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectRecordCardOwnProps>;
29
+ export declare const SelectRecordCard: import('react').ForwardRefExoticComponent<SelectRecordCardOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectRecordCardOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
30
+ /**
31
+ * SelectLayoutThumb — o mini-wireframe que abre o card de um template de checkout:
32
+ * `steps` desenha etapas empilhadas (multi-step), `columns` desenha as colunas de uma
33
+ * página só (one-step). É o glifo que faz o card ler como COMPONENTE — sem ele o card é
34
+ * uma linha de tabela com bordas.
35
+ */
36
+ export type SelectLayoutThumbProps = {
37
+ kind: 'steps' | 'columns';
38
+ } & Omit<ComponentPropsWithoutRef<'span'>, 'children'>;
39
+ export declare const SelectLayoutThumb: import('react').ForwardRefExoticComponent<{
40
+ kind: "steps" | "columns";
41
+ } & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children"> & import('react').RefAttributes<HTMLSpanElement>>;
42
+ export {};
@@ -19,12 +19,22 @@ type SelectTableOwnProps = {
19
19
  title?: ReactNode;
20
20
  /** Ajuda contextual: vira o "!" ao lado do título (SelectInfoTip). Precisa de `title`. */
21
21
  help?: ReactNode;
22
+ /** Linha discreta ABAIXO do título (subtítulo/descrição da lista). Ocupa a largura da
23
+ * faixa de identidade — por isso o filtro não pode dividir essa linha com ela. Texto
24
+ * que ENSINA a plataforma continua sendo `help` (o "!"); aqui vai o que descreve o
25
+ * recorte desta lista. */
26
+ description?: ReactNode;
22
27
  /** Right-aligned action in the header bar (e.g. an "Adicionar" button). */
23
28
  action?: ReactNode;
24
- /** Filter controls (e.g. a SelectFilterBar) embedded in the header bar, left of the
25
- * action — the table and its filters read as ONE unit. The bar stays visible when a
26
- * filter empties the table (clearing the filter must remain reachable). */
29
+ /** Filter controls (e.g. a SelectFilterBar). Ganham a PRÓPRIA faixa, entre o título e o
30
+ * cabeçalho de colunas — tabela e filtros seguem lendo como UMA unidade, e a barra
31
+ * continua visível quando um filtro esvazia a tabela (limpar o filtro tem de continuar
32
+ * alcançável). */
27
33
  filters?: ReactNode;
34
+ /** Controles da VISTA (seletor de colunas, "Personalizar") — à direita da faixa de
35
+ * filtros, não junto do título. Sem `filters` não existe faixa de consulta, então eles
36
+ * voltam para o lado do `action` (uma faixa só para a engrenagem seria vazia). */
37
+ tools?: ReactNode;
28
38
  };
29
39
  export type SelectTableProps = SelectTableOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectTableOwnProps>;
30
40
  export declare const SelectTable: import('react').ForwardRefExoticComponent<SelectTableOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectTableOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
package/dist/index.d.ts CHANGED
@@ -79,6 +79,8 @@ export { SelectConfirmModal } from './SelectConfirmModal';
79
79
  export { SelectFormModal } from './SelectFormModal';
80
80
  export { detectSelectTheme } from './detectSelectTheme';
81
81
  export { SelectDataTable, SELECT_COL_DATETIME, useSelectPageSize } from './SelectDataTable';
82
+ export { SelectCardGrid } from './SelectCardGrid';
83
+ export { SelectRecordCard, SelectLayoutThumb } from './SelectRecordCard';
82
84
  export { SelectPagination } from './SelectPagination';
83
85
  export { SelectFilterBar } from './SelectFilterBar';
84
86
  export { SelectTagSelect } from './SelectTagSelect';
@@ -207,6 +209,8 @@ export type { SelectRowAction } from './SelectRowActions';
207
209
  export type { SelectStatusMeta } from './SelectStatusBadge';
208
210
  export type { SelectTimelineItem, SelectTimelineTone } from './SelectTimeline';
209
211
  export type { SelectDataColumn } from './SelectDataTable';
212
+ export type { SelectRecordCardProps, SelectRecordCardTone, SelectLayoutThumbProps } from './SelectRecordCard';
213
+ export type { SelectListPagination } from './internal/listChrome';
210
214
  export type { SelectPaginationProps } from './SelectPagination';
211
215
  export type { SelectFilterDef } from './SelectFilterBar';
212
216
  export type { SelectTagOption } from './SelectTagSelect';