@motor-hero/ui-kit 0.29.0 → 0.31.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.
package/dist/index.js CHANGED
@@ -422,6 +422,7 @@ function BaseDialog({
422
422
  size = "lg",
423
423
  className,
424
424
  modal,
425
+ blurBackdrop = true,
425
426
  contentWrapper = (content) => content
426
427
  }) {
427
428
  const isDesktop = useIsDesktop();
@@ -452,8 +453,28 @@ function BaseDialog({
452
453
  /* @__PURE__ */ jsx10("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children }),
453
454
  footer && /* @__PURE__ */ jsx10("div", { className: "flex shrink-0 flex-col-reverse gap-2 border-t px-6 py-3 sm:flex-row sm:justify-end", children: footer })
454
455
  ] });
455
- return /* @__PURE__ */ jsx10(Dialog.Root, { open, onOpenChange, modal: modal ?? !isDesktop, children: /* @__PURE__ */ jsxs9(Dialog.Portal, { children: [
456
- /* @__PURE__ */ jsx10(Dialog.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" }),
456
+ const isModal = modal ?? !isDesktop;
457
+ return /* @__PURE__ */ jsx10(Dialog.Root, { open, onOpenChange, modal: isModal, children: /* @__PURE__ */ jsxs9(Dialog.Portal, { children: [
458
+ isModal ? /* @__PURE__ */ jsx10(
459
+ Dialog.Overlay,
460
+ {
461
+ className: cn(
462
+ "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",
463
+ blurBackdrop && "backdrop-blur-sm"
464
+ )
465
+ }
466
+ ) : (
467
+ // Radix skips Dialog.Overlay when non-modal, so the backdrop is
468
+ // rendered by hand; pointer-events-none keeps outside interactions
469
+ // working (the reason the dialog is non-modal on desktop).
470
+ blurBackdrop && /* @__PURE__ */ jsx10(
471
+ "div",
472
+ {
473
+ "aria-hidden": true,
474
+ className: "pointer-events-none fixed inset-0 z-50 bg-black/80 backdrop-blur-sm animate-in fade-in-0"
475
+ }
476
+ )
477
+ ),
457
478
  /* @__PURE__ */ jsx10(
458
479
  Dialog.Content,
459
480
  {
@@ -741,7 +762,7 @@ function Combobox({
741
762
  "aria-describedby": ariaDescribedby,
742
763
  disabled,
743
764
  className: cn(
744
- "flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive",
765
+ "flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors hover:border-ring/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive",
745
766
  className
746
767
  ),
747
768
  children: [
@@ -912,7 +933,7 @@ function MultiCombobox({
912
933
  }
913
934
  },
914
935
  className: cn(
915
- "flex min-h-9 w-full cursor-pointer flex-wrap items-center gap-1 rounded-md border border-input bg-transparent px-3 py-1.5 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive",
936
+ "flex min-h-9 w-full cursor-pointer flex-wrap items-center gap-1 rounded-md border border-input bg-transparent px-3 py-1.5 text-sm shadow-sm transition-colors hover:border-ring/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive",
916
937
  className
917
938
  ),
918
939
  children: [
@@ -1030,7 +1051,7 @@ function MultiCombobox({
1030
1051
 
1031
1052
  // src/components/color-picker.tsx
1032
1053
  import * as PopoverPrimitive3 from "@radix-ui/react-popover";
1033
- import { ChevronsUpDown as ChevronsUpDown3 } from "lucide-react";
1054
+ import { ChevronsUpDown as ChevronsUpDown3, X as X3 } from "lucide-react";
1034
1055
  import * as React8 from "react";
1035
1056
  import { HexColorInput, HexColorPicker } from "react-colorful";
1036
1057
  import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
@@ -1038,6 +1059,7 @@ function ColorPicker({
1038
1059
  value,
1039
1060
  onChange,
1040
1061
  placeholder = "Selecionar cor",
1062
+ clearable = true,
1041
1063
  disabled,
1042
1064
  id,
1043
1065
  className,
@@ -1046,6 +1068,12 @@ function ColorPicker({
1046
1068
  }) {
1047
1069
  const [open, setOpen] = React8.useState(false);
1048
1070
  const color = value || "";
1071
+ const showClear = clearable && !!color && !disabled;
1072
+ const clear = (event) => {
1073
+ event.stopPropagation();
1074
+ event.preventDefault();
1075
+ onChange("");
1076
+ };
1049
1077
  return /* @__PURE__ */ jsxs17(PopoverPrimitive3.Root, { open, onOpenChange: setOpen, children: [
1050
1078
  /* @__PURE__ */ jsx19(PopoverPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs17(
1051
1079
  "button",
@@ -1056,7 +1084,7 @@ function ColorPicker({
1056
1084
  "aria-describedby": ariaDescribedby,
1057
1085
  disabled,
1058
1086
  className: cn(
1059
- "flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive",
1087
+ "flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors hover:border-ring/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:focus-visible:ring-destructive",
1060
1088
  className
1061
1089
  ),
1062
1090
  children: [
@@ -1076,7 +1104,25 @@ function ColorPicker({
1076
1104
  ),
1077
1105
  /* @__PURE__ */ jsx19("span", { className: cn("truncate", !color && "text-muted-foreground"), children: color || placeholder })
1078
1106
  ] }),
1079
- /* @__PURE__ */ jsx19(ChevronsUpDown3, { className: "h-4 w-4 shrink-0 opacity-50" })
1107
+ /* @__PURE__ */ jsxs17("span", { className: "flex shrink-0 items-center gap-1", children: [
1108
+ showClear && // Not a <button> — nesting one inside the trigger button is
1109
+ // invalid HTML.
1110
+ /* @__PURE__ */ jsx19(
1111
+ "span",
1112
+ {
1113
+ role: "button",
1114
+ tabIndex: 0,
1115
+ "aria-label": "Limpar cor",
1116
+ onClick: clear,
1117
+ onKeyDown: (event) => {
1118
+ if (event.key === "Enter" || event.key === " ") clear(event);
1119
+ },
1120
+ className: "rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1121
+ children: /* @__PURE__ */ jsx19(X3, { className: "h-3.5 w-3.5" })
1122
+ }
1123
+ ),
1124
+ /* @__PURE__ */ jsx19(ChevronsUpDown3, { className: "h-4 w-4 shrink-0 opacity-50" })
1125
+ ] })
1080
1126
  ]
1081
1127
  }
1082
1128
  ) }),