@motor-hero/ui-kit 0.29.0 → 0.30.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/components/color-picker.d.ts +6 -1
- package/dist/components/color-picker.d.ts.map +1 -1
- package/dist/index.cjs +29 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/color-picker.tsx +35 -3
- package/src/components/combobox.tsx +1 -1
- package/src/components/multi-combobox.tsx +1 -1
package/dist/index.js
CHANGED
|
@@ -741,7 +741,7 @@ function Combobox({
|
|
|
741
741
|
"aria-describedby": ariaDescribedby,
|
|
742
742
|
disabled,
|
|
743
743
|
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",
|
|
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 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
745
|
className
|
|
746
746
|
),
|
|
747
747
|
children: [
|
|
@@ -912,7 +912,7 @@ function MultiCombobox({
|
|
|
912
912
|
}
|
|
913
913
|
},
|
|
914
914
|
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",
|
|
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 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
916
|
className
|
|
917
917
|
),
|
|
918
918
|
children: [
|
|
@@ -1030,7 +1030,7 @@ function MultiCombobox({
|
|
|
1030
1030
|
|
|
1031
1031
|
// src/components/color-picker.tsx
|
|
1032
1032
|
import * as PopoverPrimitive3 from "@radix-ui/react-popover";
|
|
1033
|
-
import { ChevronsUpDown as ChevronsUpDown3 } from "lucide-react";
|
|
1033
|
+
import { ChevronsUpDown as ChevronsUpDown3, X as X3 } from "lucide-react";
|
|
1034
1034
|
import * as React8 from "react";
|
|
1035
1035
|
import { HexColorInput, HexColorPicker } from "react-colorful";
|
|
1036
1036
|
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
@@ -1038,6 +1038,7 @@ function ColorPicker({
|
|
|
1038
1038
|
value,
|
|
1039
1039
|
onChange,
|
|
1040
1040
|
placeholder = "Selecionar cor",
|
|
1041
|
+
clearable = true,
|
|
1041
1042
|
disabled,
|
|
1042
1043
|
id,
|
|
1043
1044
|
className,
|
|
@@ -1046,6 +1047,12 @@ function ColorPicker({
|
|
|
1046
1047
|
}) {
|
|
1047
1048
|
const [open, setOpen] = React8.useState(false);
|
|
1048
1049
|
const color = value || "";
|
|
1050
|
+
const showClear = clearable && !!color && !disabled;
|
|
1051
|
+
const clear = (event) => {
|
|
1052
|
+
event.stopPropagation();
|
|
1053
|
+
event.preventDefault();
|
|
1054
|
+
onChange("");
|
|
1055
|
+
};
|
|
1049
1056
|
return /* @__PURE__ */ jsxs17(PopoverPrimitive3.Root, { open, onOpenChange: setOpen, children: [
|
|
1050
1057
|
/* @__PURE__ */ jsx19(PopoverPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs17(
|
|
1051
1058
|
"button",
|
|
@@ -1056,7 +1063,7 @@ function ColorPicker({
|
|
|
1056
1063
|
"aria-describedby": ariaDescribedby,
|
|
1057
1064
|
disabled,
|
|
1058
1065
|
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",
|
|
1066
|
+
"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
1067
|
className
|
|
1061
1068
|
),
|
|
1062
1069
|
children: [
|
|
@@ -1076,7 +1083,25 @@ function ColorPicker({
|
|
|
1076
1083
|
),
|
|
1077
1084
|
/* @__PURE__ */ jsx19("span", { className: cn("truncate", !color && "text-muted-foreground"), children: color || placeholder })
|
|
1078
1085
|
] }),
|
|
1079
|
-
/* @__PURE__ */
|
|
1086
|
+
/* @__PURE__ */ jsxs17("span", { className: "flex shrink-0 items-center gap-1", children: [
|
|
1087
|
+
showClear && // Not a <button> — nesting one inside the trigger button is
|
|
1088
|
+
// invalid HTML.
|
|
1089
|
+
/* @__PURE__ */ jsx19(
|
|
1090
|
+
"span",
|
|
1091
|
+
{
|
|
1092
|
+
role: "button",
|
|
1093
|
+
tabIndex: 0,
|
|
1094
|
+
"aria-label": "Limpar cor",
|
|
1095
|
+
onClick: clear,
|
|
1096
|
+
onKeyDown: (event) => {
|
|
1097
|
+
if (event.key === "Enter" || event.key === " ") clear(event);
|
|
1098
|
+
},
|
|
1099
|
+
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",
|
|
1100
|
+
children: /* @__PURE__ */ jsx19(X3, { className: "h-3.5 w-3.5" })
|
|
1101
|
+
}
|
|
1102
|
+
),
|
|
1103
|
+
/* @__PURE__ */ jsx19(ChevronsUpDown3, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
1104
|
+
] })
|
|
1080
1105
|
]
|
|
1081
1106
|
}
|
|
1082
1107
|
) }),
|