@motor-hero/ui-kit 0.32.0 → 0.33.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.
@@ -34,6 +34,13 @@ export interface BaseDialogProps {
34
34
  * Defaults to true; pass false to keep the plain scrim.
35
35
  */
36
36
  blurBackdrop?: boolean;
37
+ /**
38
+ * Extra classes appended to the backdrop/overlay. Use it to tune the scrim
39
+ * per dialog, e.g. `bg-black/40` for a lighter tint or `bg-transparent` to
40
+ * drop the darkening and keep only the blur. Wins over the default via
41
+ * tailwind-merge.
42
+ */
43
+ backdropClassName?: string;
37
44
  /**
38
45
  * Advanced: wraps the dialog's inner content (header + body + footer) inside
39
46
  * Content. Used by FormDialog to inject a <form>. Defaults to identity.
@@ -50,6 +57,6 @@ export interface BaseDialogProps {
50
57
  * can persist after closing a dialog that contained a Select/Popover,
51
58
  * which would otherwise make the rest of the page unclickable.
52
59
  */
53
- export declare function BaseDialog({ open, onOpenChange, title, description, children, footer, size, className, modal, blurBackdrop, contentWrapper, }: BaseDialogProps): React.JSX.Element;
60
+ export declare function BaseDialog({ open, onOpenChange, title, description, children, footer, size, className, modal, blurBackdrop, backdropClassName, contentWrapper, }: BaseDialogProps): React.JSX.Element;
54
61
  export {};
55
62
  //# sourceMappingURL=base-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-dialog.d.ts","sourceRoot":"","sources":["../../src/components/base-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,QAAA,MAAM,WAAW;;;;;;;;;;;CAWP,CAAA;AAEV,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,WAAW,CAAA;AAErD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAC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O,CAAA;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,SAAS,CAAA;CACnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,IAAW,EACX,SAAS,EACT,KAAK,EACL,YAAmB,EACnB,iBAAiB,EACjB,cAAqC,GACtC,EAAE,eAAe,qBAuFjB"}
@@ -9,7 +9,18 @@ interface ConfirmDialogProps {
9
9
  cancelLabel?: string;
10
10
  loading?: boolean;
11
11
  variant?: "default" | "destructive";
12
+ /**
13
+ * Applies backdrop-blur to the overlay behind the dialog.
14
+ * Defaults to true; pass false to keep the plain scrim.
15
+ */
16
+ blurBackdrop?: boolean;
17
+ /**
18
+ * Extra classes appended to the backdrop/overlay. Use it to tune the scrim
19
+ * per dialog, e.g. `bg-black/40` for a lighter tint. Wins over the default
20
+ * via tailwind-merge.
21
+ */
22
+ backdropClassName?: string;
12
23
  }
13
- export declare function ConfirmDialog({ open, onOpenChange, onConfirm, title, description, confirmLabel, cancelLabel, loading, variant, }: ConfirmDialogProps): import("react").JSX.Element;
24
+ export declare function ConfirmDialog({ open, onOpenChange, onConfirm, title, description, confirmLabel, cancelLabel, loading, variant, blurBackdrop, backdropClassName, }: ConfirmDialogProps): import("react").JSX.Element;
14
25
  export {};
15
26
  //# sourceMappingURL=confirm-dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../src/components/confirm-dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,UAAU,kBAAkB;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,SAAS,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;CACpC;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,WAAW,EACX,YAA0B,EAC1B,WAAwB,EACxB,OAAe,EACf,OAAmB,GACpB,EAAE,kBAAkB,+BAgCpB"}
1
+ {"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../src/components/confirm-dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,UAAU,kBAAkB;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,SAAS,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,WAAW,EACX,YAA0B,EAC1B,WAAwB,EACxB,OAAe,EACf,OAAmB,EACnB,YAAmB,EACnB,iBAAiB,GAClB,EAAE,kBAAkB,+BAsCpB"}
@@ -1,10 +1,16 @@
1
- interface PaginationProps {
1
+ export interface PaginationProps {
2
2
  page: number;
3
3
  onPageChange: (page: number) => void;
4
4
  hasNextPage: boolean;
5
5
  hasPreviousPage: boolean;
6
+ /** Total de páginas. Quando informado, o rótulo vira "Página {page} de {totalPages}". */
7
+ totalPages?: number;
8
+ /** Exibe o seletor de itens por página. Use com `pageSize`, `onPageSizeChange` e `pageSizeOptions`. */
9
+ showPageSizeSelector?: boolean;
10
+ pageSize?: number;
11
+ onPageSizeChange?: (size: number) => void;
12
+ pageSizeOptions?: number[];
6
13
  className?: string;
7
14
  }
8
- export declare function Pagination({ page, onPageChange, hasNextPage, hasPreviousPage, className }: PaginationProps): import("react").JSX.Element;
9
- export {};
15
+ export declare function Pagination({ page, onPageChange, hasNextPage, hasPreviousPage, totalPages, showPageSizeSelector, pageSize, onPageSizeChange, pageSizeOptions, className, }: PaginationProps): import("react").JSX.Element;
10
16
  //# sourceMappingURL=pagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,WAAW,EAAE,OAAO,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,eAAe,+BAsB1G"}
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,WAAW,EAAE,OAAO,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uGAAuG;IACvG,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAKD,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,oBAA4B,EAC5B,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,SAAS,GACV,EAAE,eAAe,+BAgDjB"}
package/dist/index.cjs CHANGED
@@ -264,6 +264,15 @@ function EmptyState({ icon, title, description, action, className }) {
264
264
 
265
265
  // src/components/confirm-dialog.tsx
266
266
  var AlertDialog = __toESM(require("@radix-ui/react-alert-dialog"), 1);
267
+
268
+ // src/lib/utils.ts
269
+ var import_clsx = require("clsx");
270
+ var import_tailwind_merge = require("tailwind-merge");
271
+ function cn(...inputs) {
272
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
273
+ }
274
+
275
+ // src/components/confirm-dialog.tsx
267
276
  var import_jsx_runtime4 = require("react/jsx-runtime");
268
277
  function ConfirmDialog({
269
278
  open,
@@ -274,10 +283,21 @@ function ConfirmDialog({
274
283
  confirmLabel = "Confirmar",
275
284
  cancelLabel = "Cancelar",
276
285
  loading = false,
277
- variant = "default"
286
+ variant = "default",
287
+ blurBackdrop = true,
288
+ backdropClassName
278
289
  }) {
279
290
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertDialog.Root, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(AlertDialog.Portal, { children: [
280
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertDialog.Overlay, { className: "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
291
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
292
+ AlertDialog.Overlay,
293
+ {
294
+ className: cn(
295
+ "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
296
+ blurBackdrop && "backdrop-blur-sm",
297
+ backdropClassName
298
+ )
299
+ }
300
+ ),
281
301
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(AlertDialog.Content, { className: "fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", children: [
282
302
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-col space-y-2 text-center sm:text-left", children: [
283
303
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertDialog.Title, { className: "text-lg font-semibold", children: title }),
@@ -466,13 +486,6 @@ function useIsDesktop() {
466
486
  return isDesktop;
467
487
  }
468
488
 
469
- // src/lib/utils.ts
470
- var import_clsx = require("clsx");
471
- var import_tailwind_merge = require("tailwind-merge");
472
- function cn(...inputs) {
473
- return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
474
- }
475
-
476
489
  // src/components/base-dialog.tsx
477
490
  var import_jsx_runtime10 = require("react/jsx-runtime");
478
491
  var sizeClasses2 = {
@@ -498,6 +511,7 @@ function BaseDialog({
498
511
  className,
499
512
  modal,
500
513
  blurBackdrop = true,
514
+ backdropClassName,
501
515
  contentWrapper = (content) => content
502
516
  }) {
503
517
  const isDesktop = useIsDesktop();
@@ -534,19 +548,24 @@ function BaseDialog({
534
548
  Dialog.Overlay,
535
549
  {
536
550
  className: cn(
537
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
538
- blurBackdrop && "backdrop-blur-sm"
551
+ "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
552
+ blurBackdrop && "backdrop-blur-sm",
553
+ backdropClassName
539
554
  )
540
555
  }
541
556
  ) : (
542
557
  // Radix skips Dialog.Overlay when non-modal, so the backdrop is
543
558
  // rendered by hand; pointer-events-none keeps outside interactions
544
559
  // working (the reason the dialog is non-modal on desktop).
545
- blurBackdrop && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
560
+ (blurBackdrop || backdropClassName) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
546
561
  "div",
547
562
  {
548
563
  "aria-hidden": true,
549
- className: "pointer-events-none fixed inset-0 z-50 bg-black/80 backdrop-blur-sm animate-in fade-in-0"
564
+ className: cn(
565
+ "pointer-events-none fixed inset-0 z-50 bg-black/50 animate-in fade-in-0",
566
+ blurBackdrop && "backdrop-blur-sm",
567
+ backdropClassName
568
+ )
550
569
  }
551
570
  )
552
571
  ),
@@ -632,33 +651,67 @@ function AuthCard({ title, description, children, footer }) {
632
651
 
633
652
  // src/components/pagination.tsx
634
653
  var import_jsx_runtime13 = require("react/jsx-runtime");
635
- function Pagination({ page, onPageChange, hasNextPage, hasPreviousPage, className }) {
636
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `flex items-center justify-end gap-4 ${className ?? ""}`, children: [
637
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
638
- "button",
639
- {
640
- type: "button",
641
- onClick: () => onPageChange(page - 1),
642
- disabled: !hasPreviousPage,
643
- className: "inline-flex h-8 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground cursor-pointer disabled:pointer-events-none disabled:opacity-50",
644
- children: "Anterior"
645
- }
646
- ),
647
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-sm text-muted-foreground", children: [
648
- "P\xE1gina ",
649
- page
650
- ] }),
651
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
652
- "button",
653
- {
654
- type: "button",
655
- onClick: () => onPageChange(page + 1),
656
- disabled: !hasNextPage,
657
- className: "inline-flex h-8 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground cursor-pointer disabled:pointer-events-none disabled:opacity-50",
658
- children: "Pr\xF3ximo"
659
- }
660
- )
661
- ] });
654
+ var navButtonClass = "inline-flex h-8 items-center justify-center rounded-md border border-input bg-background px-3 text-xs font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground cursor-pointer disabled:pointer-events-none disabled:opacity-50";
655
+ function Pagination({
656
+ page,
657
+ onPageChange,
658
+ hasNextPage,
659
+ hasPreviousPage,
660
+ totalPages,
661
+ showPageSizeSelector = false,
662
+ pageSize,
663
+ onPageSizeChange,
664
+ pageSizeOptions,
665
+ className
666
+ }) {
667
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
668
+ "div",
669
+ {
670
+ className: `flex items-center ${showPageSizeSelector ? "justify-between" : "justify-end"} gap-4 ${className ?? ""}`,
671
+ children: [
672
+ showPageSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
673
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "pagination-page-size", className: "text-sm text-muted-foreground", children: "Itens por p\xE1gina" }),
674
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
675
+ "select",
676
+ {
677
+ id: "pagination-page-size",
678
+ value: pageSize,
679
+ onChange: (e) => onPageSizeChange?.(Number(e.target.value)),
680
+ className: "h-8 rounded-md border border-input bg-background px-2 text-xs font-medium shadow-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring cursor-pointer",
681
+ children: (pageSizeOptions ?? []).map((size) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: size, children: size }, size))
682
+ }
683
+ )
684
+ ] }),
685
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-4", children: [
686
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
687
+ "button",
688
+ {
689
+ type: "button",
690
+ onClick: () => onPageChange(page - 1),
691
+ disabled: !hasPreviousPage,
692
+ className: navButtonClass,
693
+ children: "Anterior"
694
+ }
695
+ ),
696
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-sm text-muted-foreground", children: [
697
+ "P\xE1gina ",
698
+ page,
699
+ totalPages ? ` de ${totalPages}` : ""
700
+ ] }),
701
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
702
+ "button",
703
+ {
704
+ type: "button",
705
+ onClick: () => onPageChange(page + 1),
706
+ disabled: !hasNextPage,
707
+ className: navButtonClass,
708
+ children: "Pr\xF3ximo"
709
+ }
710
+ )
711
+ ] })
712
+ ]
713
+ }
714
+ );
662
715
  }
663
716
 
664
717
  // src/components/table-skeleton.tsx