@motor-hero/ui-kit 0.31.0 → 0.32.1
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 +8 -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/components/confirm-dialog.d.ts +12 -1
- package/dist/components/confirm-dialog.d.ts.map +1 -1
- package/dist/index.cjs +40 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/base-dialog.tsx +16 -3
- package/src/components/color-picker.tsx +25 -14
- package/src/components/confirm-dialog.tsx +22 -1
|
@@ -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;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,
|
|
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;;;;;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"}
|
|
@@ -10,6 +10,11 @@ export interface ColorPickerProps {
|
|
|
10
10
|
* so the field can fall back to its default. On by default.
|
|
11
11
|
*/
|
|
12
12
|
clearable?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Accept an alpha channel — the picker gains an opacity slider and the
|
|
15
|
+
* value may be an 8-digit hex (`#RRGGBBAA`). Off by default.
|
|
16
|
+
*/
|
|
17
|
+
alpha?: boolean;
|
|
13
18
|
disabled?: boolean;
|
|
14
19
|
id?: string;
|
|
15
20
|
className?: string;
|
|
@@ -24,5 +29,5 @@ export interface ColorPickerProps {
|
|
|
24
29
|
* `aria-invalid`/`aria-describedby` from FormField and shows a destructive
|
|
25
30
|
* border when invalid, matching the other kit inputs.
|
|
26
31
|
*/
|
|
27
|
-
export declare function ColorPicker({ value, onChange, placeholder, clearable, disabled, id, className, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, }: ColorPickerProps): React.JSX.Element;
|
|
32
|
+
export declare function ColorPicker({ value, onChange, placeholder, clearable, alpha, disabled, id, className, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedby, }: ColorPickerProps): React.JSX.Element;
|
|
28
33
|
//# 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;
|
|
1
|
+
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../../src/components/color-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,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;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,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,KAAa,EACb,QAAQ,EACR,EAAE,EACF,SAAS,EACT,cAAc,EAAE,WAAW,EAC3B,kBAAkB,EAAE,eAAe,GACpC,EAAE,gBAAgB,qBA0FlB"}
|
|
@@ -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;
|
|
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"}
|
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)(
|
|
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/
|
|
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:
|
|
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
|
),
|
|
@@ -1135,6 +1154,7 @@ function ColorPicker({
|
|
|
1135
1154
|
onChange,
|
|
1136
1155
|
placeholder = "Selecionar cor",
|
|
1137
1156
|
clearable = true,
|
|
1157
|
+
alpha = false,
|
|
1138
1158
|
disabled,
|
|
1139
1159
|
id,
|
|
1140
1160
|
className,
|
|
@@ -1168,12 +1188,11 @@ function ColorPicker({
|
|
|
1168
1188
|
"span",
|
|
1169
1189
|
{
|
|
1170
1190
|
"aria-hidden": true,
|
|
1171
|
-
className:
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
backgroundImage: "linear-gradient(45deg,var(--color-muted) 25%,transparent 25%,transparent 75%,var(--color-muted) 75%),linear-gradient(45deg,var(--color-muted) 25%,transparent 25%,transparent 75%,var(--color-muted) 75%)"
|
|
1191
|
+
className: "h-5 w-5 shrink-0 rounded border border-border bg-[length:8px_8px] bg-[position:0_0,4px_4px]",
|
|
1192
|
+
style: {
|
|
1193
|
+
// The checkerboard stays under the color layer so a
|
|
1194
|
+
// translucent value reads as translucent in the swatch.
|
|
1195
|
+
backgroundImage: `${color ? `linear-gradient(${color},${color}),` : ""}linear-gradient(45deg,var(--color-muted) 25%,transparent 25%,transparent 75%,var(--color-muted) 75%),linear-gradient(45deg,var(--color-muted) 25%,transparent 25%,transparent 75%,var(--color-muted) 75%)`
|
|
1177
1196
|
}
|
|
1178
1197
|
}
|
|
1179
1198
|
),
|
|
@@ -1208,7 +1227,7 @@ function ColorPicker({
|
|
|
1208
1227
|
sideOffset: 4,
|
|
1209
1228
|
className: "z-50 w-56 rounded-md border bg-popover p-3 text-popover-foreground shadow-md",
|
|
1210
1229
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mh-color-picker flex flex-col gap-3", children: [
|
|
1211
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_colorful.HexColorPicker, { color, onChange }),
|
|
1230
|
+
alpha ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_colorful.HexAlphaColorPicker, { color, onChange }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_colorful.HexColorPicker, { color, onChange }),
|
|
1212
1231
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1213
1232
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-muted-foreground", children: "#" }),
|
|
1214
1233
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -1217,6 +1236,7 @@ function ColorPicker({
|
|
|
1217
1236
|
color,
|
|
1218
1237
|
onChange,
|
|
1219
1238
|
prefixed: false,
|
|
1239
|
+
alpha,
|
|
1220
1240
|
className: "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm uppercase shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
1221
1241
|
}
|
|
1222
1242
|
)
|