@selectwin/kit 0.1.74 → 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
@@ -55,34 +56,9 @@ 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). */
@@ -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 {};
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';