@xwadex/fesd-next 0.3.44-beta.9 → 0.3.45
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/checkboxs/checkbox.d.ts +4 -0
- package/dist/components/checkboxs/checkbox.js +9 -0
- package/dist/components/checkboxs/index.d.ts +1 -0
- package/dist/components/checkboxs/index.js +1 -0
- package/dist/components/comboboxs/comboboxs.d.ts +1 -0
- package/dist/components/comboboxs/comboboxs.js +39 -0
- package/dist/components/comboboxs/index.d.ts +1 -0
- package/dist/components/comboboxs/index.js +1 -0
- package/dist/components/commands/command.d.ts +18 -0
- package/dist/components/commands/command.js +34 -0
- package/dist/components/commands/index.d.ts +1 -0
- package/dist/components/commands/index.js +1 -0
- package/dist/components/dialogs/dialog.d.ts +15 -0
- package/dist/components/dialogs/dialog.js +36 -0
- package/dist/components/dialogs/index.d.ts +1 -0
- package/dist/components/dialogs/index.js +1 -0
- package/dist/components/dragBoxs/dragBoxs.d.ts +8 -0
- package/dist/components/dragBoxs/dragBoxs.js +70 -0
- package/dist/components/dragBoxs/dragBoxsContext.d.ts +14 -0
- package/dist/components/dragBoxs/dragBoxsContext.js +10 -0
- package/dist/components/dragBoxs/index.d.ts +2 -0
- package/dist/components/dragBoxs/index.js +2 -0
- package/dist/components/dragResize/dragResize.d.ts +2 -5
- package/dist/components/dragResize/dragResize.js +13 -13
- package/dist/components/dropdowns/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdowns/dropdown-menu.js +51 -0
- package/dist/components/dropdowns/index.d.ts +1 -0
- package/dist/components/dropdowns/index.js +1 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +10 -0
- package/dist/components/popovers/index.d.ts +1 -0
- package/dist/components/popovers/index.js +1 -0
- package/dist/components/popovers/popover.d.ts +7 -0
- package/dist/components/popovers/popover.js +17 -0
- package/dist/components/radios/index.d.ts +1 -0
- package/dist/components/radios/index.js +1 -0
- package/dist/components/radios/radio-group.d.ts +5 -0
- package/dist/components/radios/radio-group.js +12 -0
- package/dist/components/resizables/resizablePanelGroup.js +7 -0
- package/dist/components/scrollAreas/scrollArea.js +1 -1
- package/dist/components/selects/index.d.ts +1 -0
- package/dist/components/selects/index.js +1 -0
- package/dist/components/selects/select.d.ts +15 -0
- package/dist/components/selects/select.js +38 -0
- package/dist/components/switchs/index.d.ts +1 -0
- package/dist/components/switchs/index.js +1 -0
- package/dist/components/switchs/switch.d.ts +4 -0
- package/dist/components/switchs/switch.js +8 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useDragResize.d.ts +5 -2
- package/dist/hooks/useDragResize.js +20 -8
- package/dist/hooks/useEffectLeave.d.ts +1 -0
- package/dist/hooks/useEffectLeave.js +9 -0
- package/dist/hooks/useEffectOne.d.ts +1 -0
- package/dist/hooks/useEffectOne.js +9 -0
- package/package.json +1 -1
- package/dist/components/dragResize/dragResize.module.scss +0 -42
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
declare function Checkbox({ className, ...props }: ComponentProps<typeof CheckboxPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { Checkbox };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
4
|
+
import { CheckIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from "../../utils/index.js";
|
|
6
|
+
function Checkbox({ className, ...props }) {
|
|
7
|
+
return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn('peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "flex items-center justify-center text-current transition-none", children: _jsx(CheckIcon, { className: "size-3.5" }) }) }));
|
|
8
|
+
}
|
|
9
|
+
export { Checkbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./checkbox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./checkbox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ComboboxDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, ChevronsUpDown } from "lucide-react";
|
|
4
|
+
import { cn } from "../../utils/index.js";
|
|
5
|
+
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../commands";
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger, } from "../popovers";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
const frameworks = [
|
|
9
|
+
{
|
|
10
|
+
value: "next.js",
|
|
11
|
+
label: "Next.js",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: "sveltekit",
|
|
15
|
+
label: "SvelteKit",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "nuxt.js",
|
|
19
|
+
label: "Nuxt.js",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: "remix",
|
|
23
|
+
label: "Remix",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: "astro",
|
|
27
|
+
label: "Astro",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
export function ComboboxDemo() {
|
|
31
|
+
const [open, setOpen] = useState(false);
|
|
32
|
+
const [value, setValue] = useState("");
|
|
33
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { role: "combobox", "aria-expanded": open, className: "w-[200px] justify-between", children: [value
|
|
34
|
+
? frameworks.find((framework) => framework.value === value)?.label
|
|
35
|
+
: "Select framework...", _jsx(ChevronsUpDown, { className: "opacity-50" })] }) }), _jsx(PopoverContent, { className: "w-[200px] p-0", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search framework...", className: "h-9" }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No framework found." }), _jsx(CommandGroup, { children: frameworks.map((framework) => (_jsxs(CommandItem, { value: framework.value, onSelect: (currentValue) => {
|
|
36
|
+
setValue(currentValue === value ? "" : currentValue);
|
|
37
|
+
setOpen(false);
|
|
38
|
+
}, children: [framework.label, _jsx(Check, { className: cn("ml-auto", value === framework.value ? "opacity-100" : "opacity-0") })] }, framework.value))) })] })] }) })] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./comboboxs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./comboboxs";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
import { Dialog } from '../dialogs';
|
|
4
|
+
declare function Command({ className, ...props }: ComponentProps<typeof CommandPrimitive>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: ComponentProps<typeof Dialog> & {
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function CommandInput({ className, ...props }: ComponentProps<typeof CommandPrimitive.Input>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function CommandList({ className, ...props }: ComponentProps<typeof CommandPrimitive.List>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function CommandEmpty({ ...props }: ComponentProps<typeof CommandPrimitive.Empty>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function CommandGroup({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function CommandSeparator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function CommandItem({ className, ...props }: ComponentProps<typeof CommandPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare function CommandShortcut({ className, ...props }: ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
4
|
+
import { SearchIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from "../../utils/index.js";
|
|
6
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '../dialogs';
|
|
7
|
+
function Command({ className, ...props }) {
|
|
8
|
+
return (_jsx(CommandPrimitive, { "data-slot": "command", className: cn('bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md', className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function CommandDialog({ title = 'Command Palette', description = 'Search for a command to run...', children, className, showCloseButton = true, ...props }) {
|
|
11
|
+
return (_jsxs(Dialog, { ...props, children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsx(DialogContent, { className: cn('overflow-hidden p-0', className), showCloseButton: showCloseButton, children: _jsx(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: children }) })] }));
|
|
12
|
+
}
|
|
13
|
+
function CommandInput({ className, ...props }) {
|
|
14
|
+
return (_jsxs("div", { "data-slot": "command-input-wrapper", className: "flex h-9 items-center gap-2 border-b px-3", children: [_jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), _jsx(CommandPrimitive.Input, { "data-slot": "command-input", className: cn('placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', className), ...props })] }));
|
|
15
|
+
}
|
|
16
|
+
function CommandList({ className, ...props }) {
|
|
17
|
+
return (_jsx(CommandPrimitive.List, { "data-slot": "command-list", className: cn('max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto', className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
function CommandEmpty({ ...props }) {
|
|
20
|
+
return (_jsx(CommandPrimitive.Empty, { "data-slot": "command-empty", className: "py-6 text-center text-sm", ...props }));
|
|
21
|
+
}
|
|
22
|
+
function CommandGroup({ className, ...props }) {
|
|
23
|
+
return (_jsx(CommandPrimitive.Group, { "data-slot": "command-group", className: cn('text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium', className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
function CommandSeparator({ className, ...props }) {
|
|
26
|
+
return (_jsx(CommandPrimitive.Separator, { "data-slot": "command-separator", className: cn('bg-border -mx-1 h-px', className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
function CommandItem({ className, ...props }) {
|
|
29
|
+
return (_jsx(CommandPrimitive.Item, { "data-slot": "command-item", className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
30
|
+
}
|
|
31
|
+
function CommandShortcut({ className, ...props }) {
|
|
32
|
+
return (_jsx("span", { "data-slot": "command-shortcut", className: cn('text-muted-foreground ml-auto text-xs tracking-widest', className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./command";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./command";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
declare function Dialog({ ...props }: ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DialogTrigger({ ...props }: ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogPortal({ ...props }: ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DialogClose({ ...props }: ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DialogFooter({ className, ...props }: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogTitle({ className, ...props }: ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DialogDescription({ className, ...props }: ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
import { XIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from "../../utils/index.js";
|
|
6
|
+
function Dialog({ ...props }) {
|
|
7
|
+
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
8
|
+
}
|
|
9
|
+
function DialogTrigger({ ...props }) {
|
|
10
|
+
return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DialogPortal({ ...props }) {
|
|
13
|
+
return _jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
14
|
+
}
|
|
15
|
+
function DialogClose({ ...props }) {
|
|
16
|
+
return _jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
17
|
+
}
|
|
18
|
+
function DialogOverlay({ className, ...props }) {
|
|
19
|
+
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
22
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn('bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg', className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
23
|
+
}
|
|
24
|
+
function DialogHeader({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function DialogFooter({ className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "data-slot": "dialog-footer", className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function DialogTitle({ className, ...props }) {
|
|
31
|
+
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn('text-lg leading-none font-semibold', className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function DialogDescription({ className, ...props }) {
|
|
34
|
+
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dialog";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dialog";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface PropsTypes {
|
|
2
|
+
defaultPosX?: number;
|
|
3
|
+
defaultPosY?: number;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
declare const DragBoxsBase: (props: PropsTypes) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const DragBoxs: React.MemoExoticComponent<typeof DragBoxsBase>;
|
|
8
|
+
export default DragBoxs;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { memo, useCallback, useEffect, useId, useState } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
import { DndContext } from "@dnd-kit/core";
|
|
6
|
+
import { DragBoxsContext } from "./dragBoxsContext";
|
|
7
|
+
const DragBoxsBase = (props) => {
|
|
8
|
+
const { defaultPosX = 0, defaultPosY = 0, children } = props;
|
|
9
|
+
const id = useId();
|
|
10
|
+
const [isMounded, setMounded] = useState(false);
|
|
11
|
+
const [positions, setPositions] = useState({
|
|
12
|
+
x: defaultPosX,
|
|
13
|
+
y: defaultPosY
|
|
14
|
+
});
|
|
15
|
+
const dragEndEvent = useCallback((event) => {
|
|
16
|
+
const { delta, active } = event;
|
|
17
|
+
const id = active.id;
|
|
18
|
+
setPositions((prev) => ({
|
|
19
|
+
...prev,
|
|
20
|
+
x: prev.x + delta.x,
|
|
21
|
+
y: prev.y + delta.y,
|
|
22
|
+
}));
|
|
23
|
+
}, []);
|
|
24
|
+
const dragModifiers = useCallback(({ transform, activeNodeRect }) => {
|
|
25
|
+
if (!activeNodeRect)
|
|
26
|
+
return transform;
|
|
27
|
+
const boxWidth = activeNodeRect.width;
|
|
28
|
+
const boxHeight = activeNodeRect.height;
|
|
29
|
+
const originalLeft = activeNodeRect.left;
|
|
30
|
+
const originalTop = activeNodeRect.top;
|
|
31
|
+
const maxX = window.innerWidth - (originalLeft + boxWidth);
|
|
32
|
+
const maxY = window.innerHeight - (originalTop + boxHeight);
|
|
33
|
+
const minX = -originalLeft;
|
|
34
|
+
const minY = -originalTop;
|
|
35
|
+
return {
|
|
36
|
+
x: Math.min(Math.max(transform.x, minX), maxX),
|
|
37
|
+
y: Math.min(Math.max(transform.y, minY), maxY),
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const resizeNextPositions = useCallback((target, prev) => {
|
|
41
|
+
if (typeof window !== "undefined" && target) {
|
|
42
|
+
const { x: currentX = 0, y: currentY = 0 } = prev || {};
|
|
43
|
+
const { innerWidth, innerHeight } = window;
|
|
44
|
+
const { clientWidth, clientHeight } = target;
|
|
45
|
+
const maxX = innerWidth - clientWidth;
|
|
46
|
+
const maxY = innerHeight - clientHeight;
|
|
47
|
+
return {
|
|
48
|
+
x: Math.min(currentX, maxX < 0 ? 0 : maxX),
|
|
49
|
+
y: Math.min(currentY, maxY < 0 ? 0 : maxY),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { ...prev };
|
|
53
|
+
}, []);
|
|
54
|
+
const resizeEvent = useCallback(() => {
|
|
55
|
+
const target = document.getElementById(id);
|
|
56
|
+
if (target)
|
|
57
|
+
setPositions((prev) => resizeNextPositions(target, prev));
|
|
58
|
+
}, []);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
setMounded(true);
|
|
61
|
+
window.addEventListener("resize", resizeEvent);
|
|
62
|
+
return () => window.removeEventListener("resize", resizeEvent);
|
|
63
|
+
}, []);
|
|
64
|
+
return (_jsx(_Fragment, { children: isMounded
|
|
65
|
+
? createPortal(_jsx(DndContext, { onDragEnd: dragEndEvent, modifiers: [dragModifiers], children: _jsx(DragBoxsContext, { value: { id, positions }, children: _jsx("div", { "data-components": "dragboxs-root", children: children }) }) }), document.body)
|
|
66
|
+
: null }));
|
|
67
|
+
};
|
|
68
|
+
const DragBoxs = memo(DragBoxsBase);
|
|
69
|
+
DragBoxs.displayName = "DragBoxs";
|
|
70
|
+
export default DragBoxs;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useDraggable, useDndContext } from "@dnd-kit/core";
|
|
2
|
+
export type PositionsType = {
|
|
3
|
+
x?: number;
|
|
4
|
+
y?: number;
|
|
5
|
+
};
|
|
6
|
+
export interface DragBoxsContextType {
|
|
7
|
+
id: string;
|
|
8
|
+
positions: PositionsType;
|
|
9
|
+
}
|
|
10
|
+
export declare const DragBoxsContext: import("react").Context<DragBoxsContextType | undefined> & {
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const useDragBoxsContext: () => DragBoxsContextType;
|
|
14
|
+
export { useDraggable, useDndContext };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, use } from 'react';
|
|
2
|
+
import { useDraggable, useDndContext } from "@dnd-kit/core";
|
|
3
|
+
export const DragBoxsContext = Object.assign(createContext(undefined), { displayName: "DragBoxsContext" });
|
|
4
|
+
export const useDragBoxsContext = () => {
|
|
5
|
+
const context = use(DragBoxsContext);
|
|
6
|
+
if (context)
|
|
7
|
+
return context;
|
|
8
|
+
throw new Error('useDragPanel must be used inside provider');
|
|
9
|
+
};
|
|
10
|
+
export { useDraggable, useDndContext };
|
|
@@ -5,11 +5,8 @@ type PropsTypes<T extends React.ElementType = "div"> = AsPropsTypes<T, {
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
defaultWidth?: number;
|
|
7
7
|
defaultHeight?: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
dragLineColor?: string;
|
|
11
|
-
containerClass?: string;
|
|
12
|
-
dragClass?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
handlerClassName?: string;
|
|
13
10
|
resizeStore?: boolean;
|
|
14
11
|
resizeStoreKey?: string;
|
|
15
12
|
resizeStoreValue?: ResizeTypes;
|
|
@@ -3,16 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { memo, useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { useDragResize, useCookies } from "../../hooks/index.js";
|
|
5
5
|
import { DragResizeContext } from "./dragResizeContext";
|
|
6
|
-
import {
|
|
7
|
-
import styles from "./dragResize.module.scss";
|
|
6
|
+
import { cn } from "../../utils/index.js";
|
|
8
7
|
const DragResizeBase = (props) => {
|
|
9
|
-
const { as, children, defaultWidth, defaultHeight,
|
|
8
|
+
const { as, children, defaultWidth, defaultHeight, className, handlerClassName, resizeStore = true, resizeStoreKey, resizeStoreValue, active = true, direction = "horizontal", minWidth = 500, maxWidth = 950, onInit, onResizeStart, onResizing, onResizeEnd, ...othersProps } = props;
|
|
10
9
|
const RootComponent = as || "div";
|
|
11
10
|
const [isActive, setActive] = useState(active);
|
|
12
11
|
const { setCookies, deleteCookies } = useCookies();
|
|
13
|
-
const resizeCSS = useMemo(() => mergeClassName(styles.root, resizeClass ? resizeClass : ""), [resizeClass]);
|
|
14
|
-
const dragCSS = useMemo(() => mergeClassName(styles.drag, dragClass ? dragClass : "", !isActive ? styles.off : ""), [isActive, dragClass]);
|
|
15
|
-
const containerCSS = useMemo(() => mergeClassName(styles.container, containerClass ? containerClass : ""), [containerClass]);
|
|
16
12
|
const isCookieStore = useMemo(() => resizeStore
|
|
17
13
|
&& resizeStoreKey
|
|
18
14
|
&& resizeStoreKey !== ""
|
|
@@ -47,17 +43,24 @@ const DragResizeBase = (props) => {
|
|
|
47
43
|
onResizeEnd: onResizeEndHandler,
|
|
48
44
|
});
|
|
49
45
|
//Context Functions
|
|
50
|
-
const setResizeActive = useCallback((active) => setActive(active), [
|
|
46
|
+
const setResizeActive = useCallback((active) => setActive(active), []);
|
|
47
|
+
const setResizeClose = useCallback((active) => {
|
|
48
|
+
if (!resizeRef.current)
|
|
49
|
+
return;
|
|
50
|
+
// resizeRef.current.style.width = active0 + "px"
|
|
51
|
+
// resizeRef.current.style.height = minHeight + "px"
|
|
52
|
+
clearResizeStore();
|
|
53
|
+
}, []);
|
|
51
54
|
const clearResizeStore = useCallback(() => resizeStoreKey
|
|
52
55
|
? deleteCookies(resizeStoreKey)
|
|
53
|
-
: console.error("resizeStoreKey is not undefined"), [
|
|
56
|
+
: console.error("resizeStoreKey is not undefined"), []);
|
|
54
57
|
const defaultResizeSize = useCallback(() => {
|
|
55
58
|
if (!resizeRef.current)
|
|
56
59
|
return;
|
|
57
60
|
resizeRef.current.style.width = minWidth + "px";
|
|
58
61
|
// resizeRef.current.style.height = minHeight + "px"
|
|
59
62
|
clearResizeStore();
|
|
60
|
-
}, [
|
|
63
|
+
}, []);
|
|
61
64
|
const contextValue = useMemo(() => ({
|
|
62
65
|
setResizeActive,
|
|
63
66
|
clearResizeStore,
|
|
@@ -67,10 +70,7 @@ const DragResizeBase = (props) => {
|
|
|
67
70
|
clearResizeStore,
|
|
68
71
|
defaultResizeSize
|
|
69
72
|
]);
|
|
70
|
-
return (_jsx(DragResizeContext, { value: contextValue, children: _jsxs(RootComponent, { ...othersProps, ref: resizeRef, className:
|
|
71
|
-
"--drag-line-width": dragLineWidth + "px",
|
|
72
|
-
"--drag-line-color": dragLineColor
|
|
73
|
-
} })] }) }));
|
|
73
|
+
return (_jsx(DragResizeContext, { value: contextValue, children: _jsxs(RootComponent, { ...othersProps, "data-components": "drag-resize-root", ref: resizeRef, className: cn("w-[inherit]", "h-[inherit]", "flex", "flex-row", className), style: resizeDefauleStyles, children: [_jsx("div", { "data-components": "drag-resize-container", className: cn("w-[inherit]", "h-[inherit]"), children: children }), _jsx("div", { "data-components": "drag-resize-handler", ref: dragRef, className: cn("w-0", "h-full", "relative", "z-2", "hover:before:cursor-ew-resize", "hover:before:opacity-100", "before:content-[' ']", "before:w-1", "before:h-full", "before:absolute", "before:z-1", "before:opacity-0", "before:duration-500", "before:transition-opacity", "before:ease-in-out", "before:bg-black", handlerClassName) })] }) }));
|
|
74
74
|
};
|
|
75
75
|
const DragResize = memo(DragResizeBase);
|
|
76
76
|
DragResize.displayName = "DragResize";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
declare function DropdownMenu({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, sideOffset, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: 'default' | 'destructive';
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
4
|
+
import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from "../../utils/index.js";
|
|
6
|
+
function DropdownMenu({ ...props }) {
|
|
7
|
+
return _jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
8
|
+
}
|
|
9
|
+
function DropdownMenuPortal({ ...props }) {
|
|
10
|
+
return _jsx(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
13
|
+
return _jsx(DropdownMenuPrimitive.Trigger, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
14
|
+
}
|
|
15
|
+
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
16
|
+
return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { "data-slot": "dropdown-menu-content", sideOffset: sideOffset, className: cn("bg-popover", "text-popover-foreground", "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-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", "data-[side=top]:slide-in-from-bottom-2", "z-50", "max-h-(--radix-dropdown-menu-content-available-height)", "min-w-[8rem]", "origin-(--radix-dropdown-menu-content-transform-origin)", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "border", "p-1", "shadow-md", className), ...props }) }));
|
|
17
|
+
}
|
|
18
|
+
function DropdownMenuGroup({ ...props }) {
|
|
19
|
+
return _jsx(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
20
|
+
}
|
|
21
|
+
function DropdownMenuItem({ className, inset, variant = 'default', ...props }) {
|
|
22
|
+
return (_jsx(DropdownMenuPrimitive.Item, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-accent", "focus:text-accent-foreground", "data-[variant=destructive]:text-destructive", "data-[variant=destructive]:focus:bg-destructive/50", "dark:data-[variant=destructive]:focus:bg-destructive/20", "data-[variant=destructive]:focus:text-destructive", "data-[variant=destructive]:*:[svg]:!text-destructive", "[&_svg:not([class*='text-'])]:text-muted-foreground", "relative", "flex", "cursor-default", "items-center", "gap-2", "rounded-sm", "px-2", "py-1.5", "text-sm", "outline-hidden", "select-none", "data-[disabled]:pointer-events-none", "data-[disabled]:opacity-50", "data-[inset]:pl-8", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0", "[&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function DropdownMenuCheckboxItem({ className, children, checked, ...props }) {
|
|
25
|
+
return (_jsxs(DropdownMenuPrimitive.CheckboxItem, { "data-slot": "dropdown-menu-checkbox-item", className: cn("focus:bg-accent", "focus:text-accent-foreground", "relative", "flex", "cursor-default", "items-center", "gap-2", "rounded-sm", "py-1.5", "pr-2", "pl-8", "text-sm", "outline-hidden", "select-none", "data-[disabled]:pointer-events-none", "data-[disabled]:opacity-50", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0", "[&_svg:not([class*='size-'])]:size-4", className), checked: checked, ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), children] }));
|
|
26
|
+
}
|
|
27
|
+
function DropdownMenuRadioGroup({ ...props }) {
|
|
28
|
+
return _jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
|
|
29
|
+
}
|
|
30
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
31
|
+
return (_jsxs(DropdownMenuPrimitive.RadioItem, { "data-slot": "dropdown-menu-radio-item", className: cn("focus:bg-accent", "focus:text-accent-foreground", "relative", "flex", "cursor-default", "items-center", "gap-2", "rounded-sm", "py-1.5", "pr-2", "pl-8", "text-sm", "outline-hidden", "select-none", "data-[disabled]:pointer-events-none", "data-[disabled]:opacity-50", "[&_svg]:pointer-events-none", "[&_svg]:shrink-0", "[&_svg:not([class*='size-'])]:size-4", className), ...props, children: [_jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CircleIcon, { className: "size-2 fill-current" }) }) }), children] }));
|
|
32
|
+
}
|
|
33
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
34
|
+
return (_jsx(DropdownMenuPrimitive.Label, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn('px-2 py-1.5 text-sm font-medium data-[inset]:pl-8', className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
37
|
+
return (_jsx(DropdownMenuPrimitive.Separator, { "data-slot": "dropdown-menu-separator", className: cn('bg-border -mx-1 my-1 h-px', className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
40
|
+
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn('text-muted-foreground ml-auto text-xs tracking-widest', className), ...props }));
|
|
41
|
+
}
|
|
42
|
+
function DropdownMenuSub({ ...props }) {
|
|
43
|
+
return _jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
44
|
+
}
|
|
45
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
46
|
+
return (_jsxs(DropdownMenuPrimitive.SubTrigger, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: cn("focus:bg-accent", "focus:text-accent-foreground", "data-[state=open]:bg-accent", "data-[state=open]:text-accent-foreground", "flex", "cursor-default", "items-center", "rounded-sm", "px-2", "py-1.5", "text-sm", "outline-hidden", "select-none", "data-[inset]:pl-8", className), ...props, children: [children, _jsx(ChevronRightIcon, { className: "ml-auto size-4" })] }));
|
|
47
|
+
}
|
|
48
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
49
|
+
return (_jsx(DropdownMenuPrimitive.SubContent, { "data-slot": "dropdown-menu-sub-content", className: cn("bg-popover", "text-popover-foreground", "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-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", "data-[side=top]:slide-in-from-bottom-2", "z-50", "min-w-[8rem]", "origin-(--radix-dropdown-menu-content-transform-origin)", "overflow-hidden", "rounded-md", "border", "p-1", "shadow-lg", className), ...props }));
|
|
50
|
+
}
|
|
51
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dropdown-menu";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dropdown-menu";
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
export * from "./dragResize";
|
|
2
2
|
export * from "./dragSortable";
|
|
3
|
+
export * from "./dragBoxs";
|
|
3
4
|
export * from "./accordions";
|
|
4
5
|
export * from "./resizables";
|
|
5
6
|
export * from "./scrollAreas";
|
|
7
|
+
export * from "./dropdowns";
|
|
8
|
+
export * from "./selects";
|
|
9
|
+
export * from "./checkboxs";
|
|
10
|
+
export * from "./switchs";
|
|
11
|
+
export * from "./radios";
|
|
12
|
+
export * from "./commands";
|
|
13
|
+
export * from "./popovers";
|
|
14
|
+
export * from "./dialogs";
|
|
15
|
+
export * from "./comboboxs";
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
// dev components
|
|
2
2
|
export * from "./dragResize";
|
|
3
3
|
export * from "./dragSortable";
|
|
4
|
+
export * from "./dragBoxs";
|
|
4
5
|
// shadcn Components
|
|
5
6
|
export * from "./accordions";
|
|
6
7
|
export * from "./resizables";
|
|
7
8
|
export * from "./scrollAreas";
|
|
9
|
+
export * from "./dropdowns";
|
|
10
|
+
export * from "./selects";
|
|
11
|
+
export * from "./checkboxs";
|
|
12
|
+
export * from "./switchs";
|
|
13
|
+
export * from "./radios";
|
|
14
|
+
export * from "./commands";
|
|
15
|
+
export * from "./popovers";
|
|
16
|
+
export * from "./dialogs";
|
|
17
|
+
export * from "./comboboxs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./popover";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./popover";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
declare function Popover({ ...props }: ComponentProps<typeof PopoverPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function PopoverTrigger({ ...props }: ComponentProps<typeof PopoverPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: ComponentProps<typeof PopoverPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function PopoverAnchor({ ...props }: ComponentProps<typeof PopoverPrimitive.Anchor>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
4
|
+
import { cn } from "../../utils/index.js";
|
|
5
|
+
function Popover({ ...props }) {
|
|
6
|
+
return _jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
7
|
+
}
|
|
8
|
+
function PopoverTrigger({ ...props }) {
|
|
9
|
+
return _jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
|
|
10
|
+
}
|
|
11
|
+
function PopoverContent({ className, align = 'center', sideOffset = 4, ...props }) {
|
|
12
|
+
return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn('bg-popover text-popover-foreground 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden', className), ...props }) }));
|
|
13
|
+
}
|
|
14
|
+
function PopoverAnchor({ ...props }) {
|
|
15
|
+
return _jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
16
|
+
}
|
|
17
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./radio-group";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./radio-group";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
declare function RadioGroup({ className, ...props }: ComponentProps<typeof RadioGroupPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function RadioGroupItem({ className, ...props }: ComponentProps<typeof RadioGroupPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
4
|
+
import { CircleIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from "../../utils/index.js";
|
|
6
|
+
function RadioGroup({ className, ...props }) {
|
|
7
|
+
return (_jsx(RadioGroupPrimitive.Root, { "data-slot": "radio-group", className: cn('grid gap-3', className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
function RadioGroupItem({ className, ...props }) {
|
|
10
|
+
return (_jsx(RadioGroupPrimitive.Item, { "data-slot": "radio-group-item", className: cn('border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: _jsx(RadioGroupPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: _jsx(CircleIcon, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" }) }) }));
|
|
11
|
+
}
|
|
12
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -4,6 +4,13 @@ import * as ResizablePrimitive from 'react-resizable-panels';
|
|
|
4
4
|
import { cn } from "../../utils/index.js";
|
|
5
5
|
const ResizablePanelGroup = (props) => {
|
|
6
6
|
const { as = "div", className, ...restProps } = props;
|
|
7
|
+
const getItem = (name) => {
|
|
8
|
+
console.log(name);
|
|
9
|
+
return name;
|
|
10
|
+
};
|
|
11
|
+
const setItem = (name, value) => {
|
|
12
|
+
console.log(name, value);
|
|
13
|
+
};
|
|
7
14
|
return (_jsx(ResizablePrimitive.PanelGroup, { tagName: as, "data-slot": "resizable-panel-group", className: cn(`
|
|
8
15
|
flex
|
|
9
16
|
h-full
|
|
@@ -5,7 +5,7 @@ import ScrollBar from "./scrollBar";
|
|
|
5
5
|
import { cn } from "../../utils/index.js";
|
|
6
6
|
const ScrollArea = (props) => {
|
|
7
7
|
const { ref, className, viewportClassName, barClassName, thumbClassName, forceMount, orientation = "vertical", children, ...restProps } = props;
|
|
8
|
-
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn("relative", className), ...restProps, children: [_jsx(ScrollAreaPrimitive.Viewport, { ref: ref, "data-slot": "scroll-area-viewport", className: cn("focus-visible:ring-ring/50", "size-full", "rounded-[inherit]", "transition-[color,box-shadow]", "outline-none", "focus-visible:ring-[3px]", "focus-visible:outline-1", viewportClassName), children: children }), _jsx(ScrollBar, { forceMount: forceMount, orientation: orientation, thumbClassName: thumbClassName }), _jsx(ScrollAreaPrimitive.Corner, {})] }));
|
|
8
|
+
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn("relative", className), ...restProps, children: [_jsx(ScrollAreaPrimitive.Viewport, { ref: ref, "data-slot": "scroll-area-viewport", className: cn("scroll-smooth", "focus-visible:ring-ring/50", "size-full", "rounded-[inherit]", "transition-[color,box-shadow]", "outline-none", "focus-visible:ring-[3px]", "focus-visible:outline-1", viewportClassName), children: children }), _jsx(ScrollBar, { forceMount: forceMount, orientation: orientation, thumbClassName: thumbClassName }), _jsx(ScrollAreaPrimitive.Corner, {})] }));
|
|
9
9
|
};
|
|
10
10
|
ScrollArea.displayName = "ScrollArea";
|
|
11
11
|
export default ScrollArea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./select";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./select";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
declare function Select({ ...props }: ComponentProps<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function SelectGroup({ ...props }: ComponentProps<typeof SelectPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function SelectValue({ ...props }: ComponentProps<typeof SelectPrimitive.Value>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function SelectTrigger({ className, size, children, ...props }: ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
7
|
+
size?: 'sm' | 'default';
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function SelectContent({ className, children, position, ...props }: ComponentProps<typeof SelectPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function SelectLabel({ className, ...props }: ComponentProps<typeof SelectPrimitive.Label>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function SelectItem({ className, children, ...props }: ComponentProps<typeof SelectPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function SelectSeparator({ className, ...props }: ComponentProps<typeof SelectPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function SelectScrollUpButton({ className, ...props }: ComponentProps<typeof SelectPrimitive.ScrollUpButton>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function SelectScrollDownButton({ className, ...props }: ComponentProps<typeof SelectPrimitive.ScrollDownButton>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
5
|
+
import { cn } from "../../utils/index.js";
|
|
6
|
+
function Select({ ...props }) {
|
|
7
|
+
return _jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
8
|
+
}
|
|
9
|
+
function SelectGroup({ ...props }) {
|
|
10
|
+
return _jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
|
|
11
|
+
}
|
|
12
|
+
function SelectValue({ ...props }) {
|
|
13
|
+
return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
14
|
+
}
|
|
15
|
+
function SelectTrigger({ className, size = 'default', children, ...props }) {
|
|
16
|
+
return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })] }));
|
|
17
|
+
}
|
|
18
|
+
function SelectContent({ className, children, position = 'popper', ...props }) {
|
|
19
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn('bg-popover text-popover-foreground 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md', position === 'popper' &&
|
|
20
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn('p-1', position === 'popper' &&
|
|
21
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
|
|
22
|
+
}
|
|
23
|
+
function SelectLabel({ className, ...props }) {
|
|
24
|
+
return (_jsx(SelectPrimitive.Label, { "data-slot": "select-label", className: cn('text-muted-foreground px-2 py-1.5 text-xs', className), ...props }));
|
|
25
|
+
}
|
|
26
|
+
function SelectItem({ className, children, ...props }) {
|
|
27
|
+
return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className), ...props, children: [_jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
function SelectSeparator({ className, ...props }) {
|
|
30
|
+
return (_jsx(SelectPrimitive.Separator, { "data-slot": "select-separator", className: cn('bg-border pointer-events-none -mx-1 my-1 h-px', className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
function SelectScrollUpButton({ className, ...props }) {
|
|
33
|
+
return (_jsx(SelectPrimitive.ScrollUpButton, { "data-slot": "select-scroll-up-button", className: cn('flex cursor-default items-center justify-center py-1', className), ...props, children: _jsx(ChevronUpIcon, { className: "size-4" }) }));
|
|
34
|
+
}
|
|
35
|
+
function SelectScrollDownButton({ className, ...props }) {
|
|
36
|
+
return (_jsx(SelectPrimitive.ScrollDownButton, { "data-slot": "select-scroll-down-button", className: cn('flex cursor-default items-center justify-center py-1', className), ...props, children: _jsx(ChevronDownIcon, { className: "size-4" }) }));
|
|
37
|
+
}
|
|
38
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./switch";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./switch";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
2
|
+
import type { ComponentProps } from "../../types/index.js";
|
|
3
|
+
declare function Switch({ className, ...props }: ComponentProps<typeof SwitchPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { Switch };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
4
|
+
import { cn } from "../../utils/index.js";
|
|
5
|
+
function Switch({ className, ...props }) {
|
|
6
|
+
return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", className: cn('peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn('bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0') }) }));
|
|
7
|
+
}
|
|
8
|
+
export { Switch };
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -4,9 +4,11 @@ export interface ResizeTypes {
|
|
|
4
4
|
}
|
|
5
5
|
export interface DragResizePropsTypes {
|
|
6
6
|
active?: boolean;
|
|
7
|
-
direction?: "
|
|
7
|
+
direction?: "horizontal" | "vertical";
|
|
8
8
|
minWidth?: number;
|
|
9
9
|
maxWidth?: number;
|
|
10
|
+
minHeight?: number;
|
|
11
|
+
maxHeight?: number;
|
|
10
12
|
onInit?: (size: ResizeTypes) => void;
|
|
11
13
|
onResizeStart?: (size: ResizeTypes) => void;
|
|
12
14
|
onResizing?: (size: ResizeTypes) => void;
|
|
@@ -15,5 +17,6 @@ export interface DragResizePropsTypes {
|
|
|
15
17
|
export type DragResizeTypes = {
|
|
16
18
|
dragRef: React.RefObject<HTMLDivElement | null>;
|
|
17
19
|
resizeRef: React.RefObject<HTMLDivElement | null>;
|
|
20
|
+
resize?: ResizeTypes;
|
|
18
21
|
};
|
|
19
|
-
export declare function useDragResize({ active, direction, minWidth, maxWidth, onInit, onResizeStart, onResizing, onResizeEnd }: DragResizePropsTypes): DragResizeTypes;
|
|
22
|
+
export declare function useDragResize({ active, direction, minWidth, maxWidth, minHeight, maxHeight, onInit, onResizeStart, onResizing, onResizeEnd }: DragResizePropsTypes): DragResizeTypes;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//wade 2024.12.06
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
export function useDragResize({ active = true, direction = "
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
export function useDragResize({ active = true, direction = "horizontal", minWidth, maxWidth, minHeight, maxHeight, onInit, onResizeStart, onResizing, onResizeEnd }) {
|
|
5
5
|
const dragRef = useRef(null);
|
|
6
6
|
const resizeRef = useRef(null);
|
|
7
|
+
const [resize, setResize] = useState({ width: 0, height: 0 });
|
|
7
8
|
const getResizeSizeValue = () => {
|
|
8
9
|
if (!resizeRef.current)
|
|
9
10
|
return;
|
|
@@ -18,10 +19,18 @@ export function useDragResize({ active = true, direction = "width", minWidth = 3
|
|
|
18
19
|
const rect = resizeRef.current.getBoundingClientRect();
|
|
19
20
|
const resizeWidth = clientX - rect.left;
|
|
20
21
|
const resizeHeight = clientY - rect.top;
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
if (direction == "horizontal"
|
|
23
|
+
&& (minWidth && resizeWidth >= minWidth)
|
|
24
|
+
&& (maxWidth && resizeWidth <= maxWidth)) {
|
|
25
|
+
resizeRef.current.style.width = resizeWidth + "px";
|
|
26
|
+
return { width: resizeWidth, height: undefined };
|
|
27
|
+
}
|
|
28
|
+
if (direction == "vertical"
|
|
29
|
+
&& (minHeight && resizeWidth >= minHeight)
|
|
30
|
+
&& (maxHeight && resizeWidth <= maxHeight)) {
|
|
31
|
+
resizeRef.current.style.height = resizeHeight + "px";
|
|
32
|
+
return { width: undefined, height: resizeHeight };
|
|
33
|
+
}
|
|
25
34
|
};
|
|
26
35
|
const onInitCallback = () => {
|
|
27
36
|
const resizeValue = getResizeSizeValue();
|
|
@@ -33,7 +42,10 @@ export function useDragResize({ active = true, direction = "width", minWidth = 3
|
|
|
33
42
|
};
|
|
34
43
|
const onMouseMove = (e) => {
|
|
35
44
|
const resizeValue = setResizeValue(e.clientX, e.clientY);
|
|
36
|
-
|
|
45
|
+
if (!resizeValue)
|
|
46
|
+
return;
|
|
47
|
+
setResize(() => ({ ...resizeValue }));
|
|
48
|
+
onResizing?.(resizeValue);
|
|
37
49
|
};
|
|
38
50
|
const onMouseUp = () => {
|
|
39
51
|
const resizeValue = getResizeSizeValue();
|
|
@@ -59,5 +71,5 @@ export function useDragResize({ active = true, direction = "width", minWidth = 3
|
|
|
59
71
|
removeEventListeners();
|
|
60
72
|
};
|
|
61
73
|
}, [active]);
|
|
62
|
-
return { dragRef, resizeRef };
|
|
74
|
+
return { dragRef, resizeRef, resize };
|
|
63
75
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useEffectLeave(callback: () => void): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useEffectOne(callback: () => void): void;
|
package/package.json
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
width: inherit;
|
|
3
|
-
height: inherit;
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-direction: row;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.container {
|
|
9
|
-
width: inherit;
|
|
10
|
-
height: inherit;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.drag {
|
|
14
|
-
--drag-line-width: 2px;
|
|
15
|
-
--drag-line-color: rgbs(0, 0, 0, 1);
|
|
16
|
-
|
|
17
|
-
width: 0;
|
|
18
|
-
height: inherit;
|
|
19
|
-
position: relative;
|
|
20
|
-
z-index: 2;
|
|
21
|
-
|
|
22
|
-
&::before {
|
|
23
|
-
content: "";
|
|
24
|
-
width: 0;
|
|
25
|
-
height: inherit;
|
|
26
|
-
border-left: var(--drag-line-width) solid var(--drag-line-color);
|
|
27
|
-
position: absolute;
|
|
28
|
-
inset: 0 0 0 calc(var(--drag-line-width) / 2 * -1);
|
|
29
|
-
z-index: 1;
|
|
30
|
-
opacity: 0;
|
|
31
|
-
transition: 0.5s ease-in-out;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&:not(.off) {
|
|
35
|
-
&:hover {
|
|
36
|
-
cursor: ew-resize;
|
|
37
|
-
&::before {
|
|
38
|
-
opacity: 1;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|