@motor-hero/ui-kit 0.37.4 → 0.39.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.
@@ -4,11 +4,19 @@ interface ResponsiveDataViewProps {
4
4
  cards: ReactNode;
5
5
  isEmpty: boolean;
6
6
  isLoading: boolean;
7
+ /**
8
+ * Dados desatualizados na tela enquanto um refetch está em voo (ex.:
9
+ * `isPlaceholderData` do TanStack Query). Esmaece e bloqueia a interação
10
+ * com table/cards; a paginação continua clicável.
11
+ */
12
+ isBusy?: boolean;
7
13
  emptyIcon?: ReactNode;
8
14
  emptyTitle?: string;
9
15
  emptyDescription?: string;
16
+ /** CTA do estado vazio — normalmente o mesmo botão "Adicionar X" da página. */
17
+ emptyAction?: ReactNode;
10
18
  pagination?: ReactNode;
11
19
  }
12
- export declare function ResponsiveDataView({ table, cards, isEmpty, isLoading, emptyIcon, emptyTitle, emptyDescription, pagination, }: ResponsiveDataViewProps): import("react").JSX.Element;
20
+ export declare function ResponsiveDataView({ table, cards, isEmpty, isLoading, isBusy, emptyIcon, emptyTitle, emptyDescription, emptyAction, pagination, }: ResponsiveDataViewProps): import("react").JSX.Element;
13
21
  export {};
14
22
  //# sourceMappingURL=responsive-data-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-data-view.d.ts","sourceRoot":"","sources":["../../src/components/responsive-data-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,UAAU,uBAAuB;IAC/B,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,SAAS,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,SAAS,CAAA;CACvB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAyC,EAAE,gBAAgB,EAAE,UAAU,GACrH,EAAE,uBAAuB,+BAezB"}
1
+ {"version":3,"file":"responsive-data-view.d.ts","sourceRoot":"","sources":["../../src/components/responsive-data-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,UAAU,uBAAuB;IAC/B,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,SAAS,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,UAAU,CAAC,EAAE,SAAS,CAAA;CACvB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,MAAc,EACd,SAAS,EACT,UAAyC,EACzC,gBAAgB,EAChB,WAAW,EACX,UAAU,GACX,EAAE,uBAAuB,+BAmCzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../src/components/status-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,MAAM,GACN,SAAS,GACT,QAAQ,GACR,SAAS,CAAA;AAEb,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB;AA4BD,wBAAgB,WAAW,CAAC,EAC1B,OAAmB,EACnB,GAAU,EACV,SAAS,EACT,QAAQ,GACT,EAAE,gBAAgB,+BAelB"}
1
+ {"version":3,"file":"status-badge.d.ts","sourceRoot":"","sources":["../../src/components/status-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,MAAM,GACN,SAAS,GACT,QAAQ,GACR,SAAS,CAAA;AAEb,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAyCD,wBAAgB,WAAW,CAAC,EAC1B,OAAmB,EACnB,GAAU,EACV,SAAS,EACT,QAAQ,GACT,EAAE,gBAAgB,+BAelB"}
@@ -1 +1 @@
1
- {"version":3,"file":"table-skeleton.d.ts","sourceRoot":"","sources":["../../src/components/table-skeleton.tsx"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAQ,EAAE,OAAW,EAAE,EAAE,kBAAkB,+BAc1E"}
1
+ {"version":3,"file":"table-skeleton.d.ts","sourceRoot":"","sources":["../../src/components/table-skeleton.tsx"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,aAAa,CAAC,EAAE,IAAQ,EAAE,OAAW,EAAE,EAAE,kBAAkB,+BAiB1E"}
package/dist/index.cjs CHANGED
@@ -980,7 +980,7 @@ function ConfirmDialog({
980
980
  {
981
981
  onClick: onConfirm,
982
982
  disabled: loading,
983
- className: `inline-flex h-9 items-center justify-center rounded-md px-4 text-sm font-medium shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 cursor-pointer ${variant === "destructive" ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "bg-primary text-primary-foreground hover:bg-primary/90"}`,
983
+ className: `inline-flex h-9 items-center justify-center rounded-md px-4 text-sm font-medium shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 cursor-pointer ${variant === "destructive" ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "bg-primary text-primary-foreground hover:bg-primary/90"}`,
984
984
  children: loading ? "Aguarde..." : confirmLabel
985
985
  }
986
986
  )
@@ -1533,7 +1533,7 @@ function FormDialogLayout({
1533
1533
  {
1534
1534
  type: "submit",
1535
1535
  disabled: isSubmitting || isDisabled,
1536
- className: "inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground shadow transition-colors hover:bg-primary/90 cursor-pointer disabled:pointer-events-none disabled:opacity-50",
1536
+ className: "inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground shadow-sm transition-colors hover:bg-primary/90 cursor-pointer disabled:pointer-events-none disabled:opacity-50",
1537
1537
  children: isSubmitting ? "Salvando..." : submitLabel
1538
1538
  }
1539
1539
  )
@@ -2129,19 +2129,38 @@ function ResponsiveDataView({
2129
2129
  cards,
2130
2130
  isEmpty,
2131
2131
  isLoading,
2132
+ isBusy = false,
2132
2133
  emptyIcon,
2133
2134
  emptyTitle = "Nenhum registro encontrado",
2134
2135
  emptyDescription,
2136
+ emptyAction,
2135
2137
  pagination
2136
2138
  }) {
2139
+ if (!isLoading && !isBusy && isEmpty) {
2140
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rounded-md border", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2141
+ EmptyState,
2142
+ {
2143
+ icon: emptyIcon,
2144
+ title: emptyTitle,
2145
+ description: emptyDescription,
2146
+ action: emptyAction
2147
+ }
2148
+ ) });
2149
+ }
2150
+ const busyClass = isBusy && "pointer-events-none opacity-50";
2137
2151
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-4", children: [
2138
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden overflow-x-auto rounded-md border md:block", children: table }),
2139
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "md:hidden", children: cards }),
2140
- !isLoading && isEmpty && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
2141
- emptyIcon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mb-4 text-muted-foreground", children: emptyIcon }),
2142
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "text-lg font-semibold tracking-tight", children: emptyTitle }),
2143
- emptyDescription && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "mt-1 max-w-sm text-sm text-muted-foreground", children: emptyDescription })
2144
- ] }),
2152
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2153
+ "div",
2154
+ {
2155
+ "aria-busy": isBusy,
2156
+ className: cn(
2157
+ "hidden overflow-x-auto rounded-md border transition-opacity md:block",
2158
+ busyClass
2159
+ ),
2160
+ children: table
2161
+ }
2162
+ ),
2163
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-busy": isBusy, className: cn("transition-opacity md:hidden", busyClass), children: cards }),
2145
2164
  pagination
2146
2165
  ] });
2147
2166
  }
@@ -2340,24 +2359,24 @@ function StatCard({ label, value, detail, icon, isLoading }) {
2340
2359
  var import_jsx_runtime29 = require("react/jsx-runtime");
2341
2360
  var variantClasses = {
2342
2361
  neutral: {
2343
- badge: "bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",
2344
- dot: "bg-gray-400"
2362
+ badge: "bg-[var(--status-neutral-surface,#f3f4f6)] text-[var(--status-neutral-text,#374151)]",
2363
+ dot: "bg-[var(--status-neutral,#9ca3af)]"
2345
2364
  },
2346
2365
  info: {
2347
- badge: "bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-400",
2348
- dot: "bg-blue-500"
2366
+ badge: "bg-[var(--status-info-surface,#dbeafe)] text-[var(--status-info-text,#1d4ed8)]",
2367
+ dot: "bg-[var(--status-info,#3b82f6)]"
2349
2368
  },
2350
2369
  success: {
2351
- badge: "bg-green-100 text-green-700 dark:bg-green-950 dark:text-green-400",
2352
- dot: "bg-green-500"
2370
+ badge: "bg-[var(--status-success-surface,#dcfce7)] text-[var(--status-success-text,#15803d)]",
2371
+ dot: "bg-[var(--status-success,#22c55e)]"
2353
2372
  },
2354
2373
  danger: {
2355
- badge: "bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-400",
2356
- dot: "bg-red-500"
2374
+ badge: "bg-[var(--status-danger-surface,#fee2e2)] text-[var(--status-danger-text,#b91c1c)]",
2375
+ dot: "bg-[var(--status-danger,#ef4444)]"
2357
2376
  },
2358
2377
  warning: {
2359
- badge: "bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-400",
2360
- dot: "bg-amber-500"
2378
+ badge: "bg-[var(--status-warning-surface,#fef3c7)] text-[var(--status-warning-text,#b45309)]",
2379
+ dot: "bg-[var(--status-warning,#f59e0b)]"
2361
2380
  }
2362
2381
  };
2363
2382
  function StatusBadge({
@@ -2401,7 +2420,12 @@ function StatusDot({ active, label, className }) {
2401
2420
  // src/components/table-skeleton.tsx
2402
2421
  var import_jsx_runtime31 = require("react/jsx-runtime");
2403
2422
  function TableSkeleton({ rows = 5, columns = 4 }) {
2404
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: Array.from({ length: rows }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("tr", { className: "border-b transition-colors", children: Array.from({ length: columns }).map((_2, j) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("td", { className: "p-4 align-middle", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-5 w-full animate-pulse rounded bg-muted" }) }, j)) }, i)) });
2423
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: Array.from({ length: rows }).map((_, i) => (
2424
+ // p-2/h-4 espelha o TableCell real. Com p-4/h-5 a linha do skeleton
2425
+ // ficava ~16px mais alta que a linha de dados, e a tabela encolhia
2426
+ // visivelmente quando a resposta chegava.
2427
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("tr", { className: "border-b transition-colors", children: Array.from({ length: columns }).map((_2, j) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("td", { className: "p-2 align-middle first:pl-4 last:pr-4", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "h-4 w-full animate-pulse rounded bg-muted" }) }, j)) }, i)
2428
+ )) });
2405
2429
  }
2406
2430
 
2407
2431
  // src/components/toaster.tsx