@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/components/base-dialog.d.ts +6 -1
- package/dist/components/base-dialog.d.ts.map +1 -1
- package/dist/components/color-picker.d.ts +6 -1
- package/dist/components/color-picker.d.ts.map +1 -1
- package/dist/index.cjs +52 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +53 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/base-dialog.tsx +27 -2
- package/src/components/color-picker.tsx +35 -3
- package/src/components/combobox.tsx +1 -1
- package/src/components/multi-combobox.tsx +1 -1
|
@@ -29,6 +29,11 @@ export interface BaseDialogProps {
|
|
|
29
29
|
* modal so the bottom-sheet behaves. Pass explicitly to override.
|
|
30
30
|
*/
|
|
31
31
|
modal?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Applies backdrop-blur to the overlay behind the dialog.
|
|
34
|
+
* Defaults to true; pass false to keep the plain scrim.
|
|
35
|
+
*/
|
|
36
|
+
blurBackdrop?: boolean;
|
|
32
37
|
/**
|
|
33
38
|
* Advanced: wraps the dialog's inner content (header + body + footer) inside
|
|
34
39
|
* Content. Used by FormDialog to inject a <form>. Defaults to identity.
|
|
@@ -45,6 +50,6 @@ export interface BaseDialogProps {
|
|
|
45
50
|
* can persist after closing a dialog that contained a Select/Popover,
|
|
46
51
|
* which would otherwise make the rest of the page unclickable.
|
|
47
52
|
*/
|
|
48
|
-
export declare function BaseDialog({ open, onOpenChange, title, description, children, footer, size, className, modal, contentWrapper, }: BaseDialogProps): React.JSX.Element;
|
|
53
|
+
export declare function BaseDialog({ open, onOpenChange, title, description, children, footer, size, className, modal, blurBackdrop, contentWrapper, }: BaseDialogProps): React.JSX.Element;
|
|
49
54
|
export {};
|
|
50
55
|
//# 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;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;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,cAAqC,GACtC,EAAE,eAAe,
|
|
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;IACrC,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;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,cAAqC,GACtC,EAAE,eAAe,qBAkFjB"}
|
|
@@ -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,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,WAA8B,EAC9B,QAAQ,EACR,EAAE,EACF,SAAS,EACT,cAAc,EAAE,WAAW,EAC3B,kBAAkB,EAAE,eAAe,GACpC,EAAE,gBAAgB,
|
|
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,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,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
|
@@ -497,6 +497,7 @@ function BaseDialog({
|
|
|
497
497
|
size = "lg",
|
|
498
498
|
className,
|
|
499
499
|
modal,
|
|
500
|
+
blurBackdrop = true,
|
|
500
501
|
contentWrapper = (content) => content
|
|
501
502
|
}) {
|
|
502
503
|
const isDesktop = useIsDesktop();
|
|
@@ -527,8 +528,28 @@ function BaseDialog({
|
|
|
527
528
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children }),
|
|
528
529
|
footer && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex shrink-0 flex-col-reverse gap-2 border-t px-6 py-3 sm:flex-row sm:justify-end", children: footer })
|
|
529
530
|
] });
|
|
530
|
-
|
|
531
|
-
|
|
531
|
+
const isModal = modal ?? !isDesktop;
|
|
532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog.Root, { open, onOpenChange, modal: isModal, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Dialog.Portal, { children: [
|
|
533
|
+
isModal ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
534
|
+
Dialog.Overlay,
|
|
535
|
+
{
|
|
536
|
+
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"
|
|
539
|
+
)
|
|
540
|
+
}
|
|
541
|
+
) : (
|
|
542
|
+
// Radix skips Dialog.Overlay when non-modal, so the backdrop is
|
|
543
|
+
// rendered by hand; pointer-events-none keeps outside interactions
|
|
544
|
+
// working (the reason the dialog is non-modal on desktop).
|
|
545
|
+
blurBackdrop && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
546
|
+
"div",
|
|
547
|
+
{
|
|
548
|
+
"aria-hidden": true,
|
|
549
|
+
className: "pointer-events-none fixed inset-0 z-50 bg-black/80 backdrop-blur-sm animate-in fade-in-0"
|
|
550
|
+
}
|
|
551
|
+
)
|
|
552
|
+
),
|
|
532
553
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
533
554
|
Dialog.Content,
|
|
534
555
|
{
|
|
@@ -816,7 +837,7 @@ function Combobox({
|
|
|
816
837
|
"aria-describedby": ariaDescribedby,
|
|
817
838
|
disabled,
|
|
818
839
|
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",
|
|
840
|
+
"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
841
|
className
|
|
821
842
|
),
|
|
822
843
|
children: [
|
|
@@ -987,7 +1008,7 @@ function MultiCombobox({
|
|
|
987
1008
|
}
|
|
988
1009
|
},
|
|
989
1010
|
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",
|
|
1011
|
+
"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
1012
|
className
|
|
992
1013
|
),
|
|
993
1014
|
children: [
|
|
@@ -1113,6 +1134,7 @@ function ColorPicker({
|
|
|
1113
1134
|
value,
|
|
1114
1135
|
onChange,
|
|
1115
1136
|
placeholder = "Selecionar cor",
|
|
1137
|
+
clearable = true,
|
|
1116
1138
|
disabled,
|
|
1117
1139
|
id,
|
|
1118
1140
|
className,
|
|
@@ -1121,6 +1143,12 @@ function ColorPicker({
|
|
|
1121
1143
|
}) {
|
|
1122
1144
|
const [open, setOpen] = React8.useState(false);
|
|
1123
1145
|
const color = value || "";
|
|
1146
|
+
const showClear = clearable && !!color && !disabled;
|
|
1147
|
+
const clear = (event) => {
|
|
1148
|
+
event.stopPropagation();
|
|
1149
|
+
event.preventDefault();
|
|
1150
|
+
onChange("");
|
|
1151
|
+
};
|
|
1124
1152
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(PopoverPrimitive3.Root, { open, onOpenChange: setOpen, children: [
|
|
1125
1153
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PopoverPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1126
1154
|
"button",
|
|
@@ -1131,7 +1159,7 @@ function ColorPicker({
|
|
|
1131
1159
|
"aria-describedby": ariaDescribedby,
|
|
1132
1160
|
disabled,
|
|
1133
1161
|
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",
|
|
1162
|
+
"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
1163
|
className
|
|
1136
1164
|
),
|
|
1137
1165
|
children: [
|
|
@@ -1151,7 +1179,25 @@ function ColorPicker({
|
|
|
1151
1179
|
),
|
|
1152
1180
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: cn("truncate", !color && "text-muted-foreground"), children: color || placeholder })
|
|
1153
1181
|
] }),
|
|
1154
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.
|
|
1182
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "flex shrink-0 items-center gap-1", children: [
|
|
1183
|
+
showClear && // Not a <button> — nesting one inside the trigger button is
|
|
1184
|
+
// invalid HTML.
|
|
1185
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1186
|
+
"span",
|
|
1187
|
+
{
|
|
1188
|
+
role: "button",
|
|
1189
|
+
tabIndex: 0,
|
|
1190
|
+
"aria-label": "Limpar cor",
|
|
1191
|
+
onClick: clear,
|
|
1192
|
+
onKeyDown: (event) => {
|
|
1193
|
+
if (event.key === "Enter" || event.key === " ") clear(event);
|
|
1194
|
+
},
|
|
1195
|
+
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",
|
|
1196
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react6.X, { className: "h-3.5 w-3.5" })
|
|
1197
|
+
}
|
|
1198
|
+
),
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react6.ChevronsUpDown, { className: "h-4 w-4 shrink-0 opacity-50" })
|
|
1200
|
+
] })
|
|
1155
1201
|
]
|
|
1156
1202
|
}
|
|
1157
1203
|
) }),
|