@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
|
@@ -5,6 +5,11 @@ export interface ColorPickerProps {
|
|
|
5
5
|
onChange: (value: string) => void;
|
|
6
6
|
/** Trigger text shown when no color is set. */
|
|
7
7
|
placeholder?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Show a clear (×) affordance when a color is set — emits `onChange("")`
|
|
10
|
+
* so the field can fall back to its default. On by default.
|
|
11
|
+
*/
|
|
12
|
+
clearable?: boolean;
|
|
8
13
|
disabled?: boolean;
|
|
9
14
|
id?: string;
|
|
10
15
|
className?: string;
|
|
@@ -19,5 +24,5 @@ export interface ColorPickerProps {
|
|
|
19
24
|
* `aria-invalid`/`aria-describedby` from FormField and shows a destructive
|
|
20
25
|
* border when invalid, matching the other kit inputs.
|
|
21
26
|
*/
|
|
22
|
-
export declare function ColorPicker({ value, onChange, placeholder, disabled, id, className, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, }: ColorPickerProps): React.JSX.Element;
|
|
27
|
+
export declare function ColorPicker({ value, onChange, placeholder, clearable, disabled, id, className, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, }: ColorPickerProps): React.JSX.Element;
|
|
23
28
|
//# sourceMappingURL=color-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../../src/components/color-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B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AW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,WAA8B,EAC9B,SAAgB,EAChB,QAAQ,EACR,EAAE,EACF,SAAS,EACT,cAAc,EAAE,WAAW,EAC3B,kBAAkB,EAAE,eAAe,GACpC,EAAE,gBAAgB,qBAyFlB"}
|
package/dist/index.cjs
CHANGED
|
@@ -816,7 +816,7 @@ function Combobox({
|
|
|
816
816
|
"aria-describedby": ariaDescribedby,
|
|
817
817
|
disabled,
|
|
818
818
|
className: cn(
|
|
819
|
-
"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",
|
|
819
|
+
"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",
|
|
820
820
|
className
|
|
821
821
|
),
|
|
822
822
|
children: [
|
|
@@ -987,7 +987,7 @@ function MultiCombobox({
|
|
|
987
987
|
}
|
|
988
988
|
},
|
|
989
989
|
className: cn(
|
|
990
|
-
"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",
|
|
990
|
+
"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",
|
|
991
991
|
className
|
|
992
992
|
),
|
|
993
993
|
children: [
|
|
@@ -1113,6 +1113,7 @@ function ColorPicker({
|
|
|
1113
1113
|
value,
|
|
1114
1114
|
onChange,
|
|
1115
1115
|
placeholder = "Selecionar cor",
|
|
1116
|
+
clearable = true,
|
|
1116
1117
|
disabled,
|
|
1117
1118
|
id,
|
|
1118
1119
|
className,
|
|
@@ -1121,6 +1122,12 @@ function ColorPicker({
|
|
|
1121
1122
|
}) {
|
|
1122
1123
|
const [open, setOpen] = React8.useState(false);
|
|
1123
1124
|
const color = value || "";
|
|
1125
|
+
const showClear = clearable && !!color && !disabled;
|
|
1126
|
+
const clear = (event) => {
|
|
1127
|
+
event.stopPropagation();
|
|
1128
|
+
event.preventDefault();
|
|
1129
|
+
onChange("");
|
|
1130
|
+
};
|
|
1124
1131
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(PopoverPrimitive3.Root, { open, onOpenChange: setOpen, children: [
|
|
1125
1132
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PopoverPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1126
1133
|
"button",
|
|
@@ -1131,7 +1138,7 @@ function ColorPicker({
|
|
|
1131
1138
|
"aria-describedby": ariaDescribedby,
|
|
1132
1139
|
disabled,
|
|
1133
1140
|
className: cn(
|
|
1134
|
-
"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",
|
|
1141
|
+
"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",
|
|
1135
1142
|
className
|
|
1136
1143
|
),
|
|
1137
1144
|
children: [
|
|
@@ -1151,7 +1158,25 @@ function ColorPicker({
|
|
|
1151
1158
|
),
|
|
1152
1159
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: cn("truncate", !color && "text-muted-foreground"), children: color || placeholder })
|
|
1153
1160
|
] }),
|
|
1154
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex shrink-0 items-center gap-1", children: [
|
|
1162
|
+
showClear && // Not a <button> — nesting one inside the trigger button is
|
|
1163
|
+
// invalid HTML.
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1165
|
+
"span",
|
|
1166
|
+
{
|
|
1167
|
+
role: "button",
|
|
1168
|
+
tabIndex: 0,
|
|
1169
|
+
"aria-label": "Limpar cor",
|
|
1170
|
+
onClick: clear,
|
|
1171
|
+
onKeyDown: (event) => {
|
|
1172
|
+
if (event.key === "Enter" || event.key === " ") clear(event);
|
|
1173
|
+
},
|
|
1174
|
+
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",
|
|
1175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react6.X, { className: "h-3.5 w-3.5" })
|
|
1176
|
+
}
|
|
1177
|
+
),
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react6.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
1179
|
+
] })
|
|
1155
1180
|
]
|
|
1156
1181
|
}
|
|
1157
1182
|
) }),
|