@motor-hero/ui-kit 0.38.0 → 0.40.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,6 +4,12 @@ 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;
@@ -11,6 +17,6 @@ interface ResponsiveDataViewProps {
11
17
  emptyAction?: ReactNode;
12
18
  pagination?: ReactNode;
13
19
  }
14
- export declare function ResponsiveDataView({ table, cards, isEmpty, isLoading, emptyIcon, emptyTitle, emptyDescription, emptyAction, 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;
15
21
  export {};
16
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;AAGtC,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,+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,SAAS,EACT,UAAyC,EACzC,gBAAgB,EAChB,WAAW,EACX,UAAU,GACX,EAAE,uBAAuB,+BA0BzB"}
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"}
@@ -7,6 +7,7 @@ export interface RowAction {
7
7
  href?: string;
8
8
  destructive?: boolean;
9
9
  disabled?: boolean;
10
+ children?: RowAction[];
10
11
  }
11
12
  export interface RowActionsMenuProps {
12
13
  actions: RowAction[];
@@ -1 +1 @@
1
- {"version":3,"file":"row-actions-menu.d.ts","sourceRoot":"","sources":["../../src/components/row-actions-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAIhD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AAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAWD,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAgB,EAChB,KAAa,EACb,KAAe,EACf,UAA8B,GAC/B,EAAE,mBAAmB,sCA2LrB"}
package/dist/index.cjs CHANGED
@@ -2129,13 +2129,14 @@ 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,
2135
2136
  emptyAction,
2136
2137
  pagination
2137
2138
  }) {
2138
- if (!isLoading && isEmpty) {
2139
+ if (!isLoading && !isBusy && isEmpty) {
2139
2140
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rounded-md border", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2140
2141
  EmptyState,
2141
2142
  {
@@ -2146,9 +2147,20 @@ function ResponsiveDataView({
2146
2147
  }
2147
2148
  ) });
2148
2149
  }
2150
+ const busyClass = isBusy && "pointer-events-none opacity-50";
2149
2151
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-4", children: [
2150
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "hidden overflow-x-auto rounded-md border md:block", children: table }),
2151
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "md:hidden", children: cards }),
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 }),
2152
2164
  pagination
2153
2165
  ] });
2154
2166
  }
@@ -2196,6 +2208,45 @@ function RowActionsMenu({
2196
2208
  itemClass2,
2197
2209
  action.destructive && "text-destructive focus:bg-destructive/10"
2198
2210
  );
2211
+ if (action.children?.length) {
2212
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenu3.Sub, { children: [
2213
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2214
+ DropdownMenu3.SubTrigger,
2215
+ {
2216
+ className: cls,
2217
+ disabled: action.disabled,
2218
+ children: [
2219
+ action.icon,
2220
+ action.label,
2221
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react12.ChevronRight, { className: "ml-auto h-4 w-4 text-muted-foreground" })
2222
+ ]
2223
+ }
2224
+ ),
2225
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownMenu3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2226
+ DropdownMenu3.SubContent,
2227
+ {
2228
+ sideOffset: 4,
2229
+ className: "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
2230
+ children: action.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2231
+ DropdownMenu3.Item,
2232
+ {
2233
+ className: cn(
2234
+ itemClass2,
2235
+ child.destructive && "text-destructive focus:bg-destructive/10"
2236
+ ),
2237
+ disabled: child.disabled,
2238
+ onClick: child.onClick,
2239
+ children: [
2240
+ child.icon,
2241
+ child.label
2242
+ ]
2243
+ },
2244
+ child.label
2245
+ ))
2246
+ }
2247
+ ) })
2248
+ ] }, action.label);
2249
+ }
2199
2250
  return action.href ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2200
2251
  DropdownMenu3.Item,
2201
2252
  {
@@ -2245,6 +2296,36 @@ function RowActionsMenu({
2245
2296
  action.icon,
2246
2297
  action.label
2247
2298
  ] });
2299
+ if (action.children?.length) {
2300
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
2301
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mx-3 my-1 h-px bg-border" }),
2302
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-3 px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: [
2303
+ action.icon,
2304
+ action.label
2305
+ ] }),
2306
+ action.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
2307
+ "button",
2308
+ {
2309
+ type: "button",
2310
+ disabled: child.disabled,
2311
+ className: cn(
2312
+ sheetItemClass2,
2313
+ child.destructive && "text-destructive"
2314
+ ),
2315
+ onClick: () => {
2316
+ child.onClick?.();
2317
+ setOpen(false);
2318
+ },
2319
+ children: [
2320
+ child.icon,
2321
+ child.label
2322
+ ]
2323
+ },
2324
+ child.label
2325
+ )),
2326
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mx-3 my-1 h-px bg-border" })
2327
+ ] }, action.label);
2328
+ }
2248
2329
  return action.href ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2249
2330
  "span",
2250
2331
  {