@flowtomic/ui 0.1.8 → 0.1.10
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/atoms/actions/badge/badge.d.ts +1 -1
- package/dist/components/atoms/actions/button/button.d.ts +2 -2
- package/dist/components/atoms/animation/sliding-number/sliding-number.d.ts.map +1 -1
- package/dist/components/atoms/animation/sliding-number/sliding-number.js +6 -3
- package/dist/components/atoms/data-display/qr-code/qr-code.d.ts +2 -2
- package/dist/components/atoms/data-display/qr-code/qr-code.d.ts.map +1 -1
- package/dist/components/atoms/data-display/qr-code/qr-code.js +4 -3
- package/dist/components/atoms/feedback/alert/alert.d.ts +1 -1
- package/dist/components/atoms/feedback/alert-dialog/alert-dialog.d.ts +2 -2
- package/dist/components/atoms/forms/input/input.d.ts +2 -2
- package/dist/components/atoms/forms/toggle/toggle.d.ts +1 -1
- package/dist/components/atoms/index.d.ts +2 -0
- package/dist/components/atoms/index.d.ts.map +1 -1
- package/dist/components/atoms/index.js +1 -0
- package/dist/components/atoms/layout/sidebar/sidebar.d.ts +1 -1
- package/dist/components/atoms/navigation/command/command.d.ts +13 -13
- package/dist/components/atoms/widget-resize-handle/index.d.ts +3 -0
- package/dist/components/atoms/widget-resize-handle/index.d.ts.map +1 -0
- package/dist/components/atoms/widget-resize-handle/index.js +1 -0
- package/dist/components/atoms/widget-resize-handle/widget-resize-handle.d.ts +60 -0
- package/dist/components/atoms/widget-resize-handle/widget-resize-handle.d.ts.map +1 -0
- package/dist/components/atoms/widget-resize-handle/widget-resize-handle.js +75 -0
- package/dist/components/molecules/draggable-widget/draggable-widget.d.ts +73 -0
- package/dist/components/molecules/draggable-widget/draggable-widget.d.ts.map +1 -0
- package/dist/components/molecules/draggable-widget/draggable-widget.js +44 -0
- package/dist/components/molecules/draggable-widget/index.d.ts +3 -0
- package/dist/components/molecules/draggable-widget/index.d.ts.map +1 -0
- package/dist/components/molecules/draggable-widget/index.js +1 -0
- package/dist/components/molecules/edit-mode-toggle/edit-mode-toggle.d.ts +41 -0
- package/dist/components/molecules/edit-mode-toggle/edit-mode-toggle.d.ts.map +1 -0
- package/dist/components/molecules/edit-mode-toggle/edit-mode-toggle.js +26 -0
- package/dist/components/molecules/edit-mode-toggle/index.d.ts +3 -0
- package/dist/components/molecules/edit-mode-toggle/index.d.ts.map +1 -0
- package/dist/components/molecules/edit-mode-toggle/index.js +1 -0
- package/dist/components/molecules/forms/autocomplete/autocomplete-context.d.ts.map +1 -1
- package/dist/components/molecules/forms/autocomplete/autocomplete-item.d.ts.map +1 -1
- package/dist/components/molecules/forms/autocomplete/autocomplete-section.d.ts.map +1 -1
- package/dist/components/molecules/forms/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/molecules/forms/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/molecules/forms/autocomplete/autocomplete.js +4 -4
- package/dist/components/molecules/forms/autocomplete/index.d.ts +2 -2
- package/dist/components/molecules/forms/autocomplete/index.d.ts.map +1 -1
- package/dist/components/molecules/forms/autocomplete/index.js +1 -1
- package/dist/components/molecules/forms/text-editor/text-editor.d.ts.map +1 -1
- package/dist/components/molecules/forms/text-editor/text-editor.js +13 -12
- package/dist/components/molecules/index.d.ts +8 -2
- package/dist/components/molecules/index.d.ts.map +1 -1
- package/dist/components/molecules/index.js +4 -1
- package/dist/components/molecules/navigation/menu-dock/menu-dock.d.ts.map +1 -1
- package/dist/components/molecules/navigation/menu-dock/menu-dock.js +1 -1
- package/dist/components/molecules/widget-renderer/index.d.ts +3 -0
- package/dist/components/molecules/widget-renderer/index.d.ts.map +1 -0
- package/dist/components/molecules/widget-renderer/index.js +1 -0
- package/dist/components/molecules/widget-renderer/widget-renderer.d.ts +46 -0
- package/dist/components/molecules/widget-renderer/widget-renderer.d.ts.map +1 -0
- package/dist/components/molecules/widget-renderer/widget-renderer.js +37 -0
- package/dist/components/organisms/document-editor/document-editor.d.ts.map +1 -1
- package/dist/components/organisms/document-editor/document-editor.js +3 -3
- package/dist/components/organisms/document-editor/index.d.ts +1 -1
- package/dist/components/organisms/document-editor/index.d.ts.map +1 -1
- package/dist/components/organisms/draggable-dashboard-grid/draggable-dashboard-grid.d.ts +65 -0
- package/dist/components/organisms/draggable-dashboard-grid/draggable-dashboard-grid.d.ts.map +1 -0
- package/dist/components/organisms/draggable-dashboard-grid/draggable-dashboard-grid.js +124 -0
- package/dist/components/organisms/draggable-dashboard-grid/index.d.ts +3 -0
- package/dist/components/organisms/draggable-dashboard-grid/index.d.ts.map +1 -0
- package/dist/components/organisms/draggable-dashboard-grid/index.js +1 -0
- package/dist/components/organisms/form-layout/form-layout.d.ts +2 -2
- package/dist/components/organisms/form-layout/form-layout.d.ts.map +1 -1
- package/dist/components/organisms/form-layout/form-layout.js +11 -9
- package/dist/components/organisms/form-layout/index.d.ts +1 -1
- package/dist/components/organisms/form-layout/index.d.ts.map +1 -1
- package/dist/components/organisms/index.d.ts +6 -0
- package/dist/components/organisms/index.d.ts.map +1 -1
- package/dist/components/organisms/index.js +3 -0
- package/dist/components/organisms/model-selector/model-selector.d.ts +1 -1
- package/dist/components/organisms/widget-config-modal/index.d.ts +3 -0
- package/dist/components/organisms/widget-config-modal/index.d.ts.map +1 -0
- package/dist/components/organisms/widget-config-modal/index.js +1 -0
- package/dist/components/organisms/widget-config-modal/widget-config-modal.d.ts +57 -0
- package/dist/components/organisms/widget-config-modal/widget-config-modal.d.ts.map +1 -0
- package/dist/components/organisms/widget-config-modal/widget-config-modal.js +35 -0
- package/dist/components/organisms/widget-palette/index.d.ts +3 -0
- package/dist/components/organisms/widget-palette/index.d.ts.map +1 -0
- package/dist/components/organisms/widget-palette/index.js +1 -0
- package/dist/components/organisms/widget-palette/widget-palette.d.ts +71 -0
- package/dist/components/organisms/widget-palette/widget-palette.d.ts.map +1 -0
- package/dist/components/organisms/widget-palette/widget-palette.js +42 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +458 -454
- package/dist/types/dashboard.d.ts +74 -0
- package/dist/types/dashboard.d.ts.map +1 -0
- package/dist/types/dashboard.js +7 -0
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "default" | "
|
|
4
|
+
variant?: "default" | "outline" | "destructive" | "secondary" | "success" | "info" | "warning" | null | undefined;
|
|
5
5
|
size?: "md" | "lg" | "sm" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
@@ -2,8 +2,8 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { type Transition } from "motion/react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
declare const buttonVariants: (props?: ({
|
|
5
|
-
variant?: "link" | "default" | "
|
|
6
|
-
size?: "
|
|
5
|
+
variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "ghost" | "success" | "info" | "natural" | null | undefined;
|
|
6
|
+
size?: "default" | "icon" | "lg" | "sm" | "icon-sm" | "icon-lg" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "transition">, VariantProps<typeof buttonVariants> {
|
|
9
9
|
asChild?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliding-number.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/animation/sliding-number/sliding-number.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAItB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sliding-number.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/animation/sliding-number/sliding-number.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAItB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0F/B,MAAM,WAAW,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;IACtE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B;AAED,iBAAS,aAAa,CAAC,EACrB,GAAG,EACH,MAAM,EACN,SAAS,EACT,MAAc,EACd,YAAoB,EACpB,UAAiB,EACjB,QAAgB,EAChB,gBAAsB,EACtB,aAAiB,EACjB,UAIC,EACD,GAAG,KAAK,EACT,EAAE,kBAAkB,2CA+GpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -18,7 +18,10 @@ function SlidingNumberRoller({ prevValue, value, place, transition }) {
|
|
|
18
18
|
animatedValue.set(targetNumber);
|
|
19
19
|
}, [targetNumber, animatedValue]);
|
|
20
20
|
const [measureRef, { height }] = useMeasure();
|
|
21
|
-
return (_jsxs("span", { ref: measureRef, "data-slot": "sliding-number-roller", className: "relative inline-block shrink-0 w-[1ch]
|
|
21
|
+
return (_jsxs("span", { ref: measureRef, "data-slot": "sliding-number-roller", className: "relative inline-block shrink-0 w-[1ch] h-[1em] overflow-hidden leading-none tabular-nums", style: {
|
|
22
|
+
color: "var(--animated-number-color, inherit)",
|
|
23
|
+
lineHeight: 1,
|
|
24
|
+
}, children: [_jsx("span", { className: "invisible", children: "0" }), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((digit) => (_jsx(SlidingNumberDisplay, { motionValue: animatedValue, number: digit, height: height ?? 0, transition: transition }, `sliding-digit-${digit}`)))] }));
|
|
22
25
|
}
|
|
23
26
|
function SlidingNumberDisplay({ motionValue, number, height, transition, }) {
|
|
24
27
|
const y = useTransform(motionValue, (latest) => {
|
|
@@ -32,12 +35,12 @@ function SlidingNumberDisplay({ motionValue, number, height, transition, }) {
|
|
|
32
35
|
return translateY;
|
|
33
36
|
});
|
|
34
37
|
if (!height) {
|
|
35
|
-
return _jsx("span", { className: "invisible absolute", children: number });
|
|
38
|
+
return (_jsx("span", { className: "invisible absolute top-0 left-0 w-full h-[1em] leading-none", children: number }));
|
|
36
39
|
}
|
|
37
40
|
return (_jsx(motion.span, { "data-slot": "sliding-number-display", style: {
|
|
38
41
|
y,
|
|
39
42
|
color: "var(--animated-number-color, inherit)",
|
|
40
|
-
}, className: "absolute
|
|
43
|
+
}, className: "absolute top-0 left-0 w-full h-[1em] flex items-center justify-center leading-none", transition: { ...transition, type: "spring" }, children: number }));
|
|
41
44
|
}
|
|
42
45
|
function SlidingNumber({ ref, number, className, inView = false, inViewMargin = "0px", inViewOnce = true, padStart = false, decimalSeparator = ".", decimalPlaces = 0, transition = {
|
|
43
46
|
stiffness: 200,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { type Options as QRCodeStylingOptions } from "qr-code-styling";
|
|
3
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { type Options as QRCodeStylingOptions } from "qr-code-styling";
|
|
3
|
+
import * as React from "react";
|
|
4
4
|
declare const qrCodeRootVariants: (props?: ({
|
|
5
5
|
size?: "md" | "lg" | null | undefined;
|
|
6
6
|
animated?: boolean | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qr-code.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/data-display/qr-code/qr-code.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"qr-code.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/data-display/qr-code/qr-code.tsx"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAsB,EAAE,KAAK,OAAO,IAAI,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,kBAAkB;;;8EAkBvB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,EAC5D,YAAY,CAAC,OAAO,kBAAkB,CAAC;IACzC,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0CD,eAAO,MAAM,MAAM,oFAwElB,CAAC;AAGF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import QRCodeStyling from "qr-code-styling";
|
|
5
3
|
import { cva } from "class-variance-authority";
|
|
4
|
+
import QRCodeStyling from "qr-code-styling";
|
|
5
|
+
import * as React from "react";
|
|
6
6
|
import { cn } from "@/lib/utils";
|
|
7
7
|
// Size tokens (visual wrapper padding + internal QR size)
|
|
8
8
|
const qrCodeRootVariants = cva("relative flex items-center justify-center select-none", // base classes
|
|
@@ -72,7 +72,8 @@ export const QRCode = React.forwardRef(({ value, options, size = "md", animated
|
|
|
72
72
|
});
|
|
73
73
|
}, [value, options, size]);
|
|
74
74
|
// Respect prefers-reduced-motion for animated overlay
|
|
75
|
-
const prefersReducedMotion = React.useMemo(() => typeof window !== "undefined" &&
|
|
75
|
+
const prefersReducedMotion = React.useMemo(() => typeof window !== "undefined" &&
|
|
76
|
+
window.matchMedia("(prefers-reduced-motion: reduce)").matches, []);
|
|
76
77
|
return (_jsxs("div", { ref: ref, role: "img", "aria-label": ariaLabel, className: cn(qrCodeRootVariants({ size, animated }), className), ...props, children: [_jsx("div", { ref: containerRef, className: "[&>canvas]:h-auto [&>canvas]:w-auto" }), _jsx(FrameHandle, { className: "absolute left-0 top-0" }), _jsx(FrameHandle, { className: "absolute top-0 right-0 rotate-90" }), _jsx(FrameHandle, { className: "absolute bottom-0 right-0 rotate-180" }), _jsx(FrameHandle, { className: "absolute bottom-0 left-0 -rotate-90" }), animated && !prefersReducedMotion && (_jsx(GradientScan, { className: "animate-[scan_2.4s_linear_infinite]", style: {} })), _jsx("style", { children: `@keyframes scan { from { transform: translateY(100%); opacity: .15; } to { transform: translateY(0%); opacity: .55; } }` })] }));
|
|
77
78
|
});
|
|
78
79
|
QRCode.displayName = "QRCode";
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { type VariantProps } from "class-variance-authority";
|
|
15
15
|
import * as React from "react";
|
|
16
16
|
declare const alertVariants: (props?: ({
|
|
17
|
-
variant?: "default" | "destructive" | "success" | "
|
|
17
|
+
variant?: "default" | "destructive" | "success" | "info" | "warning" | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
export interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {
|
|
20
20
|
}
|
|
@@ -19,7 +19,7 @@ export type AlertDialogTriggerProps = React.ComponentPropsWithoutRef<typeof Aler
|
|
|
19
19
|
* Variantes de animação para AlertDialogContent
|
|
20
20
|
*/
|
|
21
21
|
declare const alertDialogContentVariants: (props?: ({
|
|
22
|
-
animation?: "
|
|
22
|
+
animation?: "center" | "left" | "right" | "bottom" | "top" | "depth" | "3d" | null | undefined;
|
|
23
23
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
24
24
|
export type AlertDialogContentProps = React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> & VariantProps<typeof alertDialogContentVariants> & {
|
|
25
25
|
/**
|
|
@@ -61,7 +61,7 @@ declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDial
|
|
|
61
61
|
* Suporta animações 3D quando animation="3d"
|
|
62
62
|
*/
|
|
63
63
|
declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
64
|
-
animation?: "
|
|
64
|
+
animation?: "center" | "left" | "right" | "bottom" | "top" | "depth" | "3d" | null | undefined;
|
|
65
65
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
66
66
|
/**
|
|
67
67
|
* Habilita backdrop blur (apenas para animation="3d")
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type VariantProps } from "class-variance-authority";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const inputVariants: (props?: ({
|
|
4
|
-
size?: "
|
|
5
|
-
variant?: "default" | "
|
|
4
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
5
|
+
variant?: "default" | "error" | "success" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">, VariantProps<typeof inputVariants> {
|
|
8
8
|
label?: string;
|
|
@@ -3,7 +3,7 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
3
3
|
import type * as React from "react";
|
|
4
4
|
declare const toggleVariants: (props?: ({
|
|
5
5
|
variant?: "default" | "outline" | null | undefined;
|
|
6
|
-
size?: "
|
|
6
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
export interface ToggleProps extends React.ComponentProps<typeof TogglePrimitive.Root>, VariantProps<typeof toggleVariants> {
|
|
9
9
|
}
|
|
@@ -11,4 +11,6 @@ export * from "./feedback";
|
|
|
11
11
|
export * from "./forms";
|
|
12
12
|
export * from "./layout";
|
|
13
13
|
export * from "./navigation";
|
|
14
|
+
export type { WidgetResizeHandleProps } from "./widget-resize-handle";
|
|
15
|
+
export { WidgetResizeHandle } from "./widget-resize-handle";
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/atoms/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,WAAW,CAAC;AAE1B,cAAc,aAAa,CAAC;AAE5B,cAAc,QAAQ,CAAC;AAEvB,cAAc,gBAAgB,CAAC;AAE/B,cAAc,WAAW,CAAC;AAE1B,cAAc,YAAY,CAAC;AAE3B,cAAc,SAAS,CAAC;AAExB,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/atoms/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,WAAW,CAAC;AAE1B,cAAc,aAAa,CAAC;AAE5B,cAAc,QAAQ,CAAC;AAEvB,cAAc,gBAAgB,CAAC;AAE/B,cAAc,WAAW,CAAC;AAE1B,cAAc,YAAY,CAAC;AAE3B,cAAc,SAAS,CAAC;AAExB,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC;AAE7B,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -107,7 +107,7 @@ declare namespace SidebarMenuItem {
|
|
|
107
107
|
}
|
|
108
108
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
109
109
|
variant?: "default" | "outline" | null | undefined;
|
|
110
|
-
size?: "
|
|
110
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
111
111
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
112
112
|
export interface SidebarMenuButtonProps extends React.ComponentProps<"button">, VariantProps<typeof sidebarMenuButtonVariants> {
|
|
113
113
|
asChild?: boolean;
|
|
@@ -19,11 +19,11 @@ export type CommandSeparatorProps = React.ComponentPropsWithoutRef<typeof Comman
|
|
|
19
19
|
*/
|
|
20
20
|
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
21
21
|
children?: React.ReactNode;
|
|
22
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement
|
|
22
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
23
23
|
ref?: React.Ref<HTMLDivElement>;
|
|
24
24
|
} & {
|
|
25
25
|
asChild?: boolean;
|
|
26
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild"
|
|
26
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
27
27
|
label?: string;
|
|
28
28
|
shouldFilter?: boolean;
|
|
29
29
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -48,7 +48,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
48
48
|
ref?: React.Ref<HTMLInputElement>;
|
|
49
49
|
} & {
|
|
50
50
|
asChild?: boolean;
|
|
51
|
-
}, "
|
|
51
|
+
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "value" | "onChange" | "type"> & {
|
|
52
52
|
value?: string;
|
|
53
53
|
onValueChange?: (search: string) => void;
|
|
54
54
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -57,11 +57,11 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
|
|
|
57
57
|
*/
|
|
58
58
|
declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
59
59
|
children?: React.ReactNode;
|
|
60
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement
|
|
60
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
61
61
|
ref?: React.Ref<HTMLDivElement>;
|
|
62
62
|
} & {
|
|
63
63
|
asChild?: boolean;
|
|
64
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild"
|
|
64
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
65
65
|
label?: string;
|
|
66
66
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
67
67
|
/**
|
|
@@ -69,21 +69,21 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
|
69
69
|
*/
|
|
70
70
|
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
71
71
|
children?: React.ReactNode;
|
|
72
|
-
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement
|
|
72
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
73
73
|
ref?: React.Ref<HTMLDivElement>;
|
|
74
74
|
} & {
|
|
75
75
|
asChild?: boolean;
|
|
76
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild"
|
|
76
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
77
77
|
/**
|
|
78
78
|
* CommandGroup - Grupo do command
|
|
79
79
|
*/
|
|
80
80
|
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
81
81
|
children?: React.ReactNode;
|
|
82
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement
|
|
82
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
83
83
|
ref?: React.Ref<HTMLDivElement>;
|
|
84
84
|
} & {
|
|
85
85
|
asChild?: boolean;
|
|
86
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild"
|
|
86
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
|
|
87
87
|
heading?: React.ReactNode;
|
|
88
88
|
value?: string;
|
|
89
89
|
forceMount?: boolean;
|
|
@@ -91,11 +91,11 @@ declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
|
91
91
|
/**
|
|
92
92
|
* CommandSeparator - Separador do command
|
|
93
93
|
*/
|
|
94
|
-
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement
|
|
94
|
+
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
95
95
|
ref?: React.Ref<HTMLDivElement>;
|
|
96
96
|
} & {
|
|
97
97
|
asChild?: boolean;
|
|
98
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild"
|
|
98
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
|
|
99
99
|
alwaysRender?: boolean;
|
|
100
100
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
101
101
|
/**
|
|
@@ -103,11 +103,11 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
|
|
|
103
103
|
*/
|
|
104
104
|
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
105
105
|
children?: React.ReactNode;
|
|
106
|
-
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement
|
|
106
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
107
107
|
ref?: React.Ref<HTMLDivElement>;
|
|
108
108
|
} & {
|
|
109
109
|
asChild?: boolean;
|
|
110
|
-
}, keyof React.HTMLAttributes<HTMLDivElement> | "asChild"
|
|
110
|
+
}, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "onSelect" | "disabled"> & {
|
|
111
111
|
disabled?: boolean;
|
|
112
112
|
onSelect?: (value: string) => void;
|
|
113
113
|
value?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/widget-resize-handle/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WidgetResizeHandle } from "./widget-resize-handle";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WidgetResizeHandle - Atom Component
|
|
3
|
+
*
|
|
4
|
+
* Handle para redimensionar widgets arrastando o canto inferior direito.
|
|
5
|
+
* Componente puro de UI, totalmente genérico e reutilizável.
|
|
6
|
+
*/
|
|
7
|
+
export interface WidgetResizeHandleProps {
|
|
8
|
+
/**
|
|
9
|
+
* ID do widget a ser redimensionado
|
|
10
|
+
*/
|
|
11
|
+
widgetId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Largura atual do widget em unidades de grade
|
|
14
|
+
*/
|
|
15
|
+
currentWidth: number;
|
|
16
|
+
/**
|
|
17
|
+
* Altura atual do widget em unidades de grade
|
|
18
|
+
*/
|
|
19
|
+
currentHeight: number;
|
|
20
|
+
/**
|
|
21
|
+
* Callback quando widget é redimensionado
|
|
22
|
+
*/
|
|
23
|
+
onResize: (widgetId: string, w: number, h: number) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Tamanho mínimo do widget (largura)
|
|
26
|
+
*/
|
|
27
|
+
minWidth?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Tamanho mínimo do widget (altura)
|
|
30
|
+
*/
|
|
31
|
+
minHeight?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Tamanho máximo do widget (largura)
|
|
34
|
+
*/
|
|
35
|
+
maxWidth?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Tamanho máximo do widget (altura)
|
|
38
|
+
*/
|
|
39
|
+
maxHeight?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Tamanho da célula do grid em pixels
|
|
42
|
+
*/
|
|
43
|
+
cellSize?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Gap entre células em pixels
|
|
46
|
+
*/
|
|
47
|
+
gap?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Classe CSS adicional
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Handle para redimensionar widget
|
|
55
|
+
*
|
|
56
|
+
* Componente puro de UI que permite redimensionar widgets arrastando
|
|
57
|
+
* o canto inferior direito. Usa snap to grid para alinhamento.
|
|
58
|
+
*/
|
|
59
|
+
export declare function WidgetResizeHandle({ widgetId, currentWidth, currentHeight, onResize, minWidth, minHeight, maxWidth, maxHeight, cellSize, gap, className, }: WidgetResizeHandleProps): import("react/jsx-runtime").JSX.Element;
|
|
60
|
+
//# sourceMappingURL=widget-resize-handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-resize-handle.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/widget-resize-handle/widget-resize-handle.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,QAAY,EACZ,SAAa,EACb,QAAa,EACb,SAAc,EACd,QAAa,EACb,GAAQ,EACR,SAAS,GACV,EAAE,uBAAuB,2CAyFzB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* WidgetResizeHandle - Atom Component
|
|
4
|
+
*
|
|
5
|
+
* Handle para redimensionar widgets arrastando o canto inferior direito.
|
|
6
|
+
* Componente puro de UI, totalmente genérico e reutilizável.
|
|
7
|
+
*/
|
|
8
|
+
import { Maximize2 } from "lucide-react";
|
|
9
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
10
|
+
import { cn } from "@/lib/utils";
|
|
11
|
+
/**
|
|
12
|
+
* Handle para redimensionar widget
|
|
13
|
+
*
|
|
14
|
+
* Componente puro de UI que permite redimensionar widgets arrastando
|
|
15
|
+
* o canto inferior direito. Usa snap to grid para alinhamento.
|
|
16
|
+
*/
|
|
17
|
+
export function WidgetResizeHandle({ widgetId, currentWidth, currentHeight, onResize, minWidth = 2, minHeight = 2, maxWidth = 12, maxHeight = 20, cellSize = 50, gap = 16, className, }) {
|
|
18
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
19
|
+
const [startPos, setStartPos] = useState({ x: 0, y: 0 });
|
|
20
|
+
const [startSize, setStartSize] = useState({ w: currentWidth, h: currentHeight });
|
|
21
|
+
const handleRef = useRef(null);
|
|
22
|
+
const handleMouseDown = useCallback((e) => {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
setIsResizing(true);
|
|
26
|
+
setStartPos({ x: e.clientX, y: e.clientY });
|
|
27
|
+
setStartSize({ w: currentWidth, h: currentHeight });
|
|
28
|
+
}, [currentWidth, currentHeight]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!isResizing)
|
|
31
|
+
return;
|
|
32
|
+
const handleMouseMove = (e) => {
|
|
33
|
+
const deltaX = e.clientX - startPos.x;
|
|
34
|
+
const deltaY = e.clientY - startPos.y;
|
|
35
|
+
// Calcula novo tamanho baseado no movimento do mouse
|
|
36
|
+
// Usa snap to grid
|
|
37
|
+
const totalCellSize = cellSize + gap;
|
|
38
|
+
const deltaW = Math.round(deltaX / totalCellSize);
|
|
39
|
+
const deltaH = Math.round(deltaY / totalCellSize);
|
|
40
|
+
// Se não houver mudança significativa, não atualiza
|
|
41
|
+
if (deltaW === 0 && deltaH === 0)
|
|
42
|
+
return;
|
|
43
|
+
const newW = Math.max(minWidth, Math.min(maxWidth, startSize.w + deltaW));
|
|
44
|
+
const newH = Math.max(minHeight, Math.min(maxHeight, startSize.h + deltaH));
|
|
45
|
+
// Atualiza apenas se mudou
|
|
46
|
+
if (newW !== currentWidth || newH !== currentHeight) {
|
|
47
|
+
onResize(widgetId, newW, newH);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const handleMouseUp = () => {
|
|
51
|
+
setIsResizing(false);
|
|
52
|
+
};
|
|
53
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
54
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
57
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
58
|
+
};
|
|
59
|
+
}, [
|
|
60
|
+
isResizing,
|
|
61
|
+
startPos,
|
|
62
|
+
startSize,
|
|
63
|
+
currentWidth,
|
|
64
|
+
currentHeight,
|
|
65
|
+
widgetId,
|
|
66
|
+
minWidth,
|
|
67
|
+
minHeight,
|
|
68
|
+
maxWidth,
|
|
69
|
+
maxHeight,
|
|
70
|
+
cellSize,
|
|
71
|
+
gap,
|
|
72
|
+
onResize,
|
|
73
|
+
]);
|
|
74
|
+
return (_jsx("div", { ref: handleRef, onMouseDown: handleMouseDown, className: cn("absolute bottom-0 right-0 w-6 h-6", "flex items-center justify-center", "bg-primary/20 border border-primary/40 rounded-tl-md", "cursor-nwse-resize", "opacity-0 group-hover:opacity-100 transition-opacity", "hover:bg-primary/30", isResizing && "opacity-100 bg-primary/40", className), "aria-label": "Redimensionar widget", children: _jsx(Maximize2, { className: "w-3 h-3 text-primary" }) }));
|
|
75
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DraggableWidget - Molecule Component
|
|
3
|
+
*
|
|
4
|
+
* Wrapper para widgets que permite drag and drop e redimensionamento.
|
|
5
|
+
* Componente genérico e reutilizável para qualquer dashboard.
|
|
6
|
+
*/
|
|
7
|
+
export interface DraggableWidgetProps {
|
|
8
|
+
/**
|
|
9
|
+
* ID único do widget
|
|
10
|
+
*/
|
|
11
|
+
widgetId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Tipo do widget (opcional, para identificação)
|
|
14
|
+
*/
|
|
15
|
+
widgetType?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Conteúdo do widget
|
|
18
|
+
*/
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Se está em modo de edição
|
|
22
|
+
*/
|
|
23
|
+
isEditMode: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Posição CSS Grid
|
|
26
|
+
*/
|
|
27
|
+
gridPosition: {
|
|
28
|
+
gridColumnStart: number;
|
|
29
|
+
gridColumnEnd: number;
|
|
30
|
+
gridRowStart: number;
|
|
31
|
+
gridRowEnd: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Largura atual do widget em unidades de grade
|
|
35
|
+
*/
|
|
36
|
+
currentWidth: number;
|
|
37
|
+
/**
|
|
38
|
+
* Altura atual do widget em unidades de grade
|
|
39
|
+
*/
|
|
40
|
+
currentHeight: number;
|
|
41
|
+
/**
|
|
42
|
+
* Callback quando widget é clicado para configurar
|
|
43
|
+
*/
|
|
44
|
+
onConfigure?: (widgetId: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Callback quando widget é removido
|
|
47
|
+
*/
|
|
48
|
+
onRemove?: (widgetId: string) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Callback quando widget é redimensionado
|
|
51
|
+
*/
|
|
52
|
+
onResize?: (widgetId: string, w: number, h: number) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Tamanho da célula do grid em pixels
|
|
55
|
+
*/
|
|
56
|
+
cellSize?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Gap entre células em pixels
|
|
59
|
+
*/
|
|
60
|
+
gap?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Classe CSS adicional
|
|
63
|
+
*/
|
|
64
|
+
className?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Componente de widget arrastável
|
|
68
|
+
*
|
|
69
|
+
* Wrapper genérico que adiciona funcionalidades de drag and drop,
|
|
70
|
+
* redimensionamento e controles de edição a qualquer widget.
|
|
71
|
+
*/
|
|
72
|
+
export declare const DraggableWidget: import("react").NamedExoticComponent<DraggableWidgetProps>;
|
|
73
|
+
//# sourceMappingURL=draggable-widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable-widget.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/draggable-widget/draggable-widget.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,YAAY,EAAE;QACZ,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5D;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,4DAiI3B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* DraggableWidget - Molecule Component
|
|
4
|
+
*
|
|
5
|
+
* Wrapper para widgets que permite drag and drop e redimensionamento.
|
|
6
|
+
* Componente genérico e reutilizável para qualquer dashboard.
|
|
7
|
+
*/
|
|
8
|
+
import { useDraggable } from "@dnd-kit/core";
|
|
9
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
10
|
+
import { GripVertical, Settings2, X } from "lucide-react";
|
|
11
|
+
import { memo } from "react";
|
|
12
|
+
import { WidgetResizeHandle } from "@/components/atoms/widget-resize-handle";
|
|
13
|
+
import { cn } from "@/lib/utils";
|
|
14
|
+
/**
|
|
15
|
+
* Componente de widget arrastável
|
|
16
|
+
*
|
|
17
|
+
* Wrapper genérico que adiciona funcionalidades de drag and drop,
|
|
18
|
+
* redimensionamento e controles de edição a qualquer widget.
|
|
19
|
+
*/
|
|
20
|
+
export const DraggableWidget = memo(({ widgetId, widgetType, children, isEditMode, gridPosition, currentWidth, currentHeight, onConfigure, onRemove, onResize, cellSize = 50, gap = 16, className, }) => {
|
|
21
|
+
const { attributes, listeners, setNodeRef, transform, isDragging } = useDraggable({
|
|
22
|
+
id: widgetId,
|
|
23
|
+
disabled: !isEditMode,
|
|
24
|
+
data: {
|
|
25
|
+
type: "widget",
|
|
26
|
+
widgetId,
|
|
27
|
+
widgetType,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const style = {
|
|
31
|
+
transform: CSS.Translate.toString(transform),
|
|
32
|
+
...gridPosition,
|
|
33
|
+
};
|
|
34
|
+
const handleRemove = (e) => {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
onRemove?.(widgetId);
|
|
37
|
+
};
|
|
38
|
+
const handleConfigure = (e) => {
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
onConfigure?.(widgetId);
|
|
41
|
+
};
|
|
42
|
+
return (_jsxs("div", { ref: setNodeRef, style: style, className: cn("relative group", isDragging && "opacity-50 z-50", isEditMode && "ring-2 ring-primary/20", className), children: [_jsx("div", { className: cn("h-full w-full bg-card rounded-lg border border-border shadow-sm overflow-hidden", isEditMode && "hover:shadow-md transition-shadow"), children: children }), isEditMode && (_jsxs(_Fragment, { children: [_jsx("div", { ...attributes, ...listeners, className: cn("absolute top-2 left-2 p-1.5 rounded-md", "bg-background/80 backdrop-blur-sm border border-border", "cursor-grab active:cursor-grabbing", "opacity-0 group-hover:opacity-100 transition-opacity", "hover:bg-background"), "aria-label": "Arrastar widget", children: _jsx(GripVertical, { className: "w-4 h-4 text-muted-foreground" }) }), _jsxs("div", { className: "absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity", children: [onConfigure && (_jsx("button", { onClick: handleConfigure, className: cn("p-1.5 rounded-md", "bg-background/80 backdrop-blur-sm border border-border", "hover:bg-background text-muted-foreground hover:text-foreground", "transition-colors"), "aria-label": "Configurar widget", children: _jsx(Settings2, { className: "w-4 h-4" }) })), onRemove && (_jsx("button", { onClick: handleRemove, className: cn("p-1.5 rounded-md", "bg-background/80 backdrop-blur-sm border border-border", "hover:bg-destructive hover:text-destructive-foreground", "text-muted-foreground transition-colors"), "aria-label": "Remover widget", children: _jsx(X, { className: "w-4 h-4" }) }))] }), onResize && (_jsx(WidgetResizeHandle, { widgetId: widgetId, currentWidth: currentWidth, currentHeight: currentHeight, onResize: onResize, cellSize: cellSize, gap: gap }))] }))] }));
|
|
43
|
+
});
|
|
44
|
+
DraggableWidget.displayName = "DraggableWidget";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/draggable-widget/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DraggableWidget } from "./draggable-widget";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EditModeToggle - Molecule Component
|
|
3
|
+
*
|
|
4
|
+
* Componente para alternar entre modo de edição e visualização.
|
|
5
|
+
* Genérico e reutilizável para qualquer contexto de edição.
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
export interface EditModeToggleProps {
|
|
9
|
+
/**
|
|
10
|
+
* Se está em modo de edição
|
|
11
|
+
*/
|
|
12
|
+
isEditMode: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Callback quando modo de edição é alterado
|
|
15
|
+
*/
|
|
16
|
+
onToggle: (editMode: boolean) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Se está desabilitado
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Label para o botão quando em modo de edição (padrão: "Visualizar")
|
|
23
|
+
*/
|
|
24
|
+
viewLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Label para o botão quando em modo de visualização (padrão: "Editar Dashboard")
|
|
27
|
+
*/
|
|
28
|
+
editLabel?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Classe CSS adicional
|
|
31
|
+
*/
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Toggle para alternar modo de edição
|
|
36
|
+
*
|
|
37
|
+
* Componente genérico que permite alternar entre modo de edição e visualização.
|
|
38
|
+
* Pode ser usado em qualquer contexto que precise de toggle de edição.
|
|
39
|
+
*/
|
|
40
|
+
export declare const EditModeToggle: React.ForwardRefExoticComponent<EditModeToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
//# sourceMappingURL=edit-mode-toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-mode-toggle.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/edit-mode-toggle/edit-mode-toggle.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,+FA6C1B,CAAC"}
|