@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
package/dist/index.js
CHANGED
|
@@ -189,6 +189,15 @@ function EmptyState({ icon, title, description, action, className }) {
|
|
|
189
189
|
|
|
190
190
|
// src/components/confirm-dialog.tsx
|
|
191
191
|
import * as AlertDialog from "@radix-ui/react-alert-dialog";
|
|
192
|
+
|
|
193
|
+
// src/lib/utils.ts
|
|
194
|
+
import { clsx } from "clsx";
|
|
195
|
+
import { twMerge } from "tailwind-merge";
|
|
196
|
+
function cn(...inputs) {
|
|
197
|
+
return twMerge(clsx(inputs));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/components/confirm-dialog.tsx
|
|
192
201
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
193
202
|
function ConfirmDialog({
|
|
194
203
|
open,
|
|
@@ -199,10 +208,21 @@ function ConfirmDialog({
|
|
|
199
208
|
confirmLabel = "Confirmar",
|
|
200
209
|
cancelLabel = "Cancelar",
|
|
201
210
|
loading = false,
|
|
202
|
-
variant = "default"
|
|
211
|
+
variant = "default",
|
|
212
|
+
blurBackdrop = true,
|
|
213
|
+
backdropClassName
|
|
203
214
|
}) {
|
|
204
215
|
return /* @__PURE__ */ jsx4(AlertDialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs3(AlertDialog.Portal, { children: [
|
|
205
|
-
/* @__PURE__ */ jsx4(
|
|
216
|
+
/* @__PURE__ */ jsx4(
|
|
217
|
+
AlertDialog.Overlay,
|
|
218
|
+
{
|
|
219
|
+
className: cn(
|
|
220
|
+
"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",
|
|
221
|
+
blurBackdrop && "backdrop-blur-sm",
|
|
222
|
+
backdropClassName
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
),
|
|
206
226
|
/* @__PURE__ */ jsxs3(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: [
|
|
207
227
|
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col space-y-2 text-center sm:text-left", children: [
|
|
208
228
|
/* @__PURE__ */ jsx4(AlertDialog.Title, { className: "text-lg font-semibold", children: title }),
|
|
@@ -391,13 +411,6 @@ function useIsDesktop() {
|
|
|
391
411
|
return isDesktop;
|
|
392
412
|
}
|
|
393
413
|
|
|
394
|
-
// src/lib/utils.ts
|
|
395
|
-
import { clsx } from "clsx";
|
|
396
|
-
import { twMerge } from "tailwind-merge";
|
|
397
|
-
function cn(...inputs) {
|
|
398
|
-
return twMerge(clsx(inputs));
|
|
399
|
-
}
|
|
400
|
-
|
|
401
414
|
// src/components/base-dialog.tsx
|
|
402
415
|
import { Fragment, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
403
416
|
var sizeClasses2 = {
|
|
@@ -423,6 +436,7 @@ function BaseDialog({
|
|
|
423
436
|
className,
|
|
424
437
|
modal,
|
|
425
438
|
blurBackdrop = true,
|
|
439
|
+
backdropClassName,
|
|
426
440
|
contentWrapper = (content) => content
|
|
427
441
|
}) {
|
|
428
442
|
const isDesktop = useIsDesktop();
|
|
@@ -459,19 +473,24 @@ function BaseDialog({
|
|
|
459
473
|
Dialog.Overlay,
|
|
460
474
|
{
|
|
461
475
|
className: cn(
|
|
462
|
-
"fixed inset-0 z-50 bg-black/
|
|
463
|
-
blurBackdrop && "backdrop-blur-sm"
|
|
476
|
+
"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",
|
|
477
|
+
blurBackdrop && "backdrop-blur-sm",
|
|
478
|
+
backdropClassName
|
|
464
479
|
)
|
|
465
480
|
}
|
|
466
481
|
) : (
|
|
467
482
|
// Radix skips Dialog.Overlay when non-modal, so the backdrop is
|
|
468
483
|
// rendered by hand; pointer-events-none keeps outside interactions
|
|
469
484
|
// working (the reason the dialog is non-modal on desktop).
|
|
470
|
-
blurBackdrop && /* @__PURE__ */ jsx10(
|
|
485
|
+
(blurBackdrop || backdropClassName) && /* @__PURE__ */ jsx10(
|
|
471
486
|
"div",
|
|
472
487
|
{
|
|
473
488
|
"aria-hidden": true,
|
|
474
|
-
className:
|
|
489
|
+
className: cn(
|
|
490
|
+
"pointer-events-none fixed inset-0 z-50 bg-black/50 animate-in fade-in-0",
|
|
491
|
+
blurBackdrop && "backdrop-blur-sm",
|
|
492
|
+
backdropClassName
|
|
493
|
+
)
|
|
475
494
|
}
|
|
476
495
|
)
|
|
477
496
|
),
|
|
@@ -1053,13 +1072,18 @@ function MultiCombobox({
|
|
|
1053
1072
|
import * as PopoverPrimitive3 from "@radix-ui/react-popover";
|
|
1054
1073
|
import { ChevronsUpDown as ChevronsUpDown3, X as X3 } from "lucide-react";
|
|
1055
1074
|
import * as React8 from "react";
|
|
1056
|
-
import {
|
|
1075
|
+
import {
|
|
1076
|
+
HexAlphaColorPicker,
|
|
1077
|
+
HexColorInput,
|
|
1078
|
+
HexColorPicker
|
|
1079
|
+
} from "react-colorful";
|
|
1057
1080
|
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1058
1081
|
function ColorPicker({
|
|
1059
1082
|
value,
|
|
1060
1083
|
onChange,
|
|
1061
1084
|
placeholder = "Selecionar cor",
|
|
1062
1085
|
clearable = true,
|
|
1086
|
+
alpha = false,
|
|
1063
1087
|
disabled,
|
|
1064
1088
|
id,
|
|
1065
1089
|
className,
|
|
@@ -1093,12 +1117,11 @@ function ColorPicker({
|
|
|
1093
1117
|
"span",
|
|
1094
1118
|
{
|
|
1095
1119
|
"aria-hidden": true,
|
|
1096
|
-
className:
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
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%)"
|
|
1120
|
+
className: "h-5 w-5 shrink-0 rounded border border-border bg-[length:8px_8px] bg-[position:0_0,4px_4px]",
|
|
1121
|
+
style: {
|
|
1122
|
+
// The checkerboard stays under the color layer so a
|
|
1123
|
+
// translucent value reads as translucent in the swatch.
|
|
1124
|
+
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%)`
|
|
1102
1125
|
}
|
|
1103
1126
|
}
|
|
1104
1127
|
),
|
|
@@ -1133,7 +1156,7 @@ function ColorPicker({
|
|
|
1133
1156
|
sideOffset: 4,
|
|
1134
1157
|
className: "z-50 w-56 rounded-md border bg-popover p-3 text-popover-foreground shadow-md",
|
|
1135
1158
|
children: /* @__PURE__ */ jsxs17("div", { className: "mh-color-picker flex flex-col gap-3", children: [
|
|
1136
|
-
/* @__PURE__ */ jsx19(HexColorPicker, { color, onChange }),
|
|
1159
|
+
alpha ? /* @__PURE__ */ jsx19(HexAlphaColorPicker, { color, onChange }) : /* @__PURE__ */ jsx19(HexColorPicker, { color, onChange }),
|
|
1137
1160
|
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
1138
1161
|
/* @__PURE__ */ jsx19("span", { className: "text-sm text-muted-foreground", children: "#" }),
|
|
1139
1162
|
/* @__PURE__ */ jsx19(
|
|
@@ -1142,6 +1165,7 @@ function ColorPicker({
|
|
|
1142
1165
|
color,
|
|
1143
1166
|
onChange,
|
|
1144
1167
|
prefixed: false,
|
|
1168
|
+
alpha,
|
|
1145
1169
|
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"
|
|
1146
1170
|
}
|
|
1147
1171
|
)
|