@motor-hero/ui-kit 0.30.0 → 0.32.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 +31 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -10
- 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 +25 -14
|
@@ -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":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,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"}
|
|
@@ -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"}
|
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
|
{
|
|
@@ -1114,6 +1135,7 @@ function ColorPicker({
|
|
|
1114
1135
|
onChange,
|
|
1115
1136
|
placeholder = "Selecionar cor",
|
|
1116
1137
|
clearable = true,
|
|
1138
|
+
alpha = false,
|
|
1117
1139
|
disabled,
|
|
1118
1140
|
id,
|
|
1119
1141
|
className,
|
|
@@ -1147,12 +1169,11 @@ function ColorPicker({
|
|
|
1147
1169
|
"span",
|
|
1148
1170
|
{
|
|
1149
1171
|
"aria-hidden": true,
|
|
1150
|
-
className:
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
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%)"
|
|
1172
|
+
className: "h-5 w-5 shrink-0 rounded border border-border bg-[length:8px_8px] bg-[position:0_0,4px_4px]",
|
|
1173
|
+
style: {
|
|
1174
|
+
// The checkerboard stays under the color layer so a
|
|
1175
|
+
// translucent value reads as translucent in the swatch.
|
|
1176
|
+
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%)`
|
|
1156
1177
|
}
|
|
1157
1178
|
}
|
|
1158
1179
|
),
|
|
@@ -1187,7 +1208,7 @@ function ColorPicker({
|
|
|
1187
1208
|
sideOffset: 4,
|
|
1188
1209
|
className: "z-50 w-56 rounded-md border bg-popover p-3 text-popover-foreground shadow-md",
|
|
1189
1210
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "mh-color-picker flex flex-col gap-3", children: [
|
|
1190
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_colorful.HexColorPicker, { color, onChange }),
|
|
1211
|
+
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 }),
|
|
1191
1212
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1192
1213
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm text-muted-foreground", children: "#" }),
|
|
1193
1214
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -1196,6 +1217,7 @@ function ColorPicker({
|
|
|
1196
1217
|
color,
|
|
1197
1218
|
onChange,
|
|
1198
1219
|
prefixed: false,
|
|
1220
|
+
alpha,
|
|
1199
1221
|
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"
|
|
1200
1222
|
}
|
|
1201
1223
|
)
|