@bioturing/components 0.45.0 → 0.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/base-menu/index.d.ts.map +1 -1
- package/dist/components/base-menu/item.d.ts.map +1 -1
- package/dist/components/base-menu/item.js +6 -13
- package/dist/components/base-menu/item.js.map +1 -1
- package/dist/components/button/style.css +1 -1
- package/dist/components/code-block/component.js +58 -58
- package/dist/components/code-block/component.js.map +1 -1
- package/dist/components/collapse/component.js +6 -6
- package/dist/components/collapse/component.js.map +1 -1
- package/dist/components/combobox/component.d.ts +32 -1
- package/dist/components/combobox/component.d.ts.map +1 -1
- package/dist/components/combobox/component.js +286 -261
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/combobox/style.css +1 -1
- package/dist/components/combobox/utils.d.ts +2 -0
- package/dist/components/combobox/utils.d.ts.map +1 -0
- package/dist/components/combobox/utils.js +10 -0
- package/dist/components/combobox/utils.js.map +1 -0
- package/dist/components/command-palette/component.d.ts.map +1 -1
- package/dist/components/command-palette/component.js +30 -24
- package/dist/components/command-palette/component.js.map +1 -1
- package/dist/components/drag-drop/droppable.d.ts.map +1 -1
- package/dist/components/drag-drop/droppable.js +72 -68
- package/dist/components/drag-drop/droppable.js.map +1 -1
- package/dist/components/drag-drop/index.d.ts.map +1 -1
- package/dist/components/drag-drop/value.d.ts.map +1 -1
- package/dist/components/drag-drop/value.js +40 -56
- package/dist/components/drag-drop/value.js.map +1 -1
- package/dist/components/hooks/useDraggable.d.ts.map +1 -1
- package/dist/components/hooks/useDraggable.js +34 -27
- package/dist/components/hooks/useDraggable.js.map +1 -1
- package/dist/components/popup-panel/component.d.ts +1 -1
- package/dist/components/popup-panel/component.d.ts.map +1 -1
- package/dist/components/popup-panel/component.js +217 -233
- package/dist/components/popup-panel/component.js.map +1 -1
- package/dist/components/popup-panel/constants.d.ts +5 -1
- package/dist/components/popup-panel/constants.d.ts.map +1 -1
- package/dist/components/popup-panel/constants.js +8 -4
- package/dist/components/popup-panel/constants.js.map +1 -1
- package/dist/components/popup-panel/style.css +1 -1
- package/dist/components/popup-panel/types.d.ts +14 -1
- package/dist/components/popup-panel/types.d.ts.map +1 -1
- package/dist/components/select-trigger/style.css +1 -1
- package/dist/components/theme-provider/style.css +1 -1
- package/dist/components/toast/component.d.ts.map +1 -1
- package/dist/components/toast/component.js +37 -35
- package/dist/components/toast/component.js.map +1 -1
- package/dist/components/truncate/helpers.d.ts +13 -7
- package/dist/components/truncate/helpers.d.ts.map +1 -1
- package/dist/components/truncate/helpers.js +102 -85
- package/dist/components/truncate/helpers.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/tailwind.css +16 -0
- package/dist/tokens/and-theme/tokens.d.ts.map +1 -1
- package/dist/tokens/and-theme/tokens.js +4 -1
- package/dist/tokens/and-theme/tokens.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"droppable.js","sources":["../../../src/components/drag-drop/droppable.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useCallback, useMemo, memo } from \"react\";\nimport { useDroppable } from \"./hooks\";\nimport { clsx, useCls } from \"../utils\";\nimport { ArrowsOutCardinalIcon } from \"@bioturing/assets\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type { Data, DragDropDroppableProps, DraggableInfo } from \"./types\";\nimport { Value } from \"./value\";\nimport { uniqWith, isEqual } from \"es-toolkit\";\n\n/**\n * A drop zone component that can receive draggable items\n * Styled similarly to the Upload component's droppable area\n */\nconst DroppableInner = <T extends Data = Data, M extends boolean = false>({\n id,\n children,\n className,\n disabled = false,\n placeholder = \"Drop items here\",\n icon = <ArrowsOutCardinalIcon />,\n render,\n onDrop,\n validate,\n multiple,\n value,\n onChange,\n maxItems,\n renderValueLabel,\n renderValueIcon,\n ...rest\n}: DragDropDroppableProps<T, M>) => {\n const cls = useCls();\n const handleOnDrop = useCallback(\n (item: DraggableInfo<T>) => {\n if (onDrop) {\n onDrop(item);\n }\n if (onChange) {\n if (multiple) {\n (onChange as (value: T[]) => void)(\n uniqWith([...(value as T[]), item.data], isEqual)\n );\n } else {\n (onChange as (value: T) => void)(item.data);\n }\n }\n },\n [onDrop, onChange, multiple, value]\n );\n const { isOver, setNodeRef, attributes, listeners } = useDroppable({\n id,\n disabled,\n onDrop: handleOnDrop,\n validate,\n });\n\n // memoize value props to avoid re-renders\n const valueProps = useMemo(\n () => ({\n value,\n onChange,\n multiple,\n renderValueLabel,\n renderValueIcon,\n maxItems,\n }),\n [value, onChange, multiple, renderValueLabel, renderValueIcon, maxItems]\n );\n\n // memoize dropzone content\n const dropzoneContent = useMemo(\n () =>\n children || (\n <div className={cls(\"drop-zone-content\")}>\n <div className={cls(\"drop-zone-icon\")}>{icon}</div>\n <div className={cls(\"drop-zone-text\")}>{placeholder}</div>\n </div>\n ),\n [children, cls, icon, placeholder]\n );\n\n // memoize default render tree\n const defaultRender = useCallback<\n (props: Record<string, unknown>) => React.ReactElement\n >(\n ({ className, ...props }) => {\n if (!value || (multiple && Array.isArray(value) && !value.length)) {\n return (\n <div\n className={clsx(cls(\"drop-zone\"), className as string)}\n {...props}\n >\n {dropzoneContent}\n </div>\n );\n }\n // return value when there is a value\n return (\n <Value<T, M>\n {...valueProps}\n className={className as string}\n {...props}\n />\n );\n },\n [value, multiple, valueProps, dropzoneContent, cls]\n );\n\n const renderedElement = useRender({\n render: render ?? defaultRender,\n ref: setNodeRef,\n props: {\n className: className,\n ...attributes,\n ...listeners,\n ...rest,\n },\n state: {\n isOver,\n value,\n onChange: onChange as (value: M extends true ? T[] : T) => void,\n id,\n },\n });\n\n return renderedElement;\n};\n\nexport const Droppable = memo(DroppableInner) as typeof DroppableInner;\n"],"names":["DroppableInner","id","children","className","disabled","placeholder","icon","ArrowsOutCardinalIcon","render","onDrop","validate","multiple","
|
|
1
|
+
{"version":3,"file":"droppable.js","sources":["../../../src/components/drag-drop/droppable.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useCallback, useMemo, memo } from \"react\";\nimport { useDroppable } from \"./hooks\";\nimport { clsx, useCls } from \"../utils\";\nimport { ArrowsOutCardinalIcon } from \"@bioturing/assets\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type { Data, DragDropDroppableProps, DraggableInfo } from \"./types\";\nimport { Value } from \"./value\";\nimport { uniqWith, isEqual } from \"es-toolkit\";\n\nconst hasDroppableValue = (value: unknown) => {\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n\n return Boolean(value);\n};\n\nconst droppableStateAttributesMapping = {\n value: (value: unknown) =>\n hasDroppableValue(value) ? { \"data-value\": \"true\" } : null,\n onChange: () => null,\n};\n\n/**\n * A drop zone component that can receive draggable items\n * Styled similarly to the Upload component's droppable area\n */\nconst DroppableInner = <T extends Data = Data, M extends boolean = false>({\n id,\n children,\n className,\n disabled = false,\n placeholder = \"Drop items here\",\n icon = <ArrowsOutCardinalIcon />,\n render,\n onDrop,\n validate,\n multiple,\n value,\n onChange,\n maxItems,\n renderValueLabel,\n renderValueIcon,\n ...rest\n}: DragDropDroppableProps<T, M>) => {\n const cls = useCls();\n const handleOnDrop = useCallback(\n (item: DraggableInfo<T>) => {\n if (onDrop) {\n onDrop(item);\n }\n if (onChange) {\n if (multiple) {\n (onChange as (value: T[]) => void)(\n uniqWith([...(value as T[]), item.data], isEqual)\n );\n } else {\n (onChange as (value: T) => void)(item.data);\n }\n }\n },\n [onDrop, onChange, multiple, value]\n );\n const { isOver, setNodeRef, attributes, listeners } = useDroppable({\n id,\n disabled,\n onDrop: handleOnDrop,\n validate,\n });\n\n // memoize value props to avoid re-renders\n const valueProps = useMemo(\n () => ({\n value,\n onChange,\n multiple,\n renderValueLabel,\n renderValueIcon,\n maxItems,\n }),\n [value, onChange, multiple, renderValueLabel, renderValueIcon, maxItems]\n );\n\n // memoize dropzone content\n const dropzoneContent = useMemo(\n () =>\n children || (\n <div className={cls(\"drop-zone-content\")}>\n <div className={cls(\"drop-zone-icon\")}>{icon}</div>\n <div className={cls(\"drop-zone-text\")}>{placeholder}</div>\n </div>\n ),\n [children, cls, icon, placeholder]\n );\n\n // memoize default render tree\n const defaultRender = useCallback<\n (props: Record<string, unknown>) => React.ReactElement\n >(\n ({ className, ...props }) => {\n if (!value || (multiple && Array.isArray(value) && !value.length)) {\n return (\n <div\n className={clsx(cls(\"drop-zone\"), className as string)}\n {...props}\n >\n {dropzoneContent}\n </div>\n );\n }\n // return value when there is a value\n return (\n <Value<T, M>\n {...valueProps}\n className={className as string}\n {...props}\n />\n );\n },\n [value, multiple, valueProps, dropzoneContent, cls]\n );\n\n const renderedElement = useRender({\n render: render ?? defaultRender,\n ref: setNodeRef,\n props: {\n className: className,\n ...attributes,\n ...listeners,\n ...rest,\n },\n state: {\n isOver,\n value,\n onChange: onChange as (value: M extends true ? T[] : T) => void,\n id,\n },\n stateAttributesMapping: droppableStateAttributesMapping,\n });\n\n return renderedElement;\n};\n\nexport const Droppable = memo(DroppableInner) as typeof DroppableInner;\n"],"names":["hasDroppableValue","value","droppableStateAttributesMapping","DroppableInner","id","children","className","disabled","placeholder","icon","ArrowsOutCardinalIcon","render","onDrop","validate","multiple","onChange","maxItems","renderValueLabel","renderValueIcon","rest","cls","useCls","handleOnDrop","useCallback","item","uniqWith","isEqual","isOver","setNodeRef","attributes","listeners","useDroppable","valueProps","useMemo","dropzoneContent","jsxs","jsx","defaultRender","props","clsx","Value","useRender","Droppable","memo"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAoB,CAACC,MACrB,MAAM,QAAQA,CAAK,IACdA,EAAM,SAAS,IAGjB,EAAQA,GAGXC,IAAkC;AAAA,EACtC,OAAO,CAACD,MACND,EAAkBC,CAAK,IAAI,EAAE,cAAc,OAAA,IAAW;AAAA,EACxD,UAAU,MAAM;AAClB,GAMME,IAAiB,CAAmD;AAAA,EACxE,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,aAAAC,IAAc;AAAA,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D,QAAQ,EAER,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,YAAY,EACzB,MAAM,EAAE,OAAO,EACf,SAAS,GACV,EAAE,aAAa,CAAC,CAAC,CAAC,2CA6BlB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/drag-drop/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,IAAI,IAAI,QAAQ,EAErB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AASjB,OAAO,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,EAC1D,QAAQ,EAER,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,YAAY,EACzB,MAAM,EAAE,OAAO,EACf,SAAS,GACV,EAAE,aAAa,CAAC,CAAC,CAAC,2CA6BlB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;WAYuoD,CAAC;;CAV3oD,CAAC;AAEH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,QAAQ,EACR,aAAa,GACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../src/components/drag-drop/value.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../src/components/drag-drop/value.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA+C,KAAK,YAAY,EAAY,MAAM,OAAO,CAAC;AAOjG,OAAO,EAAE,kBAAkB,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAGxD,iBAAS,UAAU,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,OAAO,EACnD,EACE,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,GAAG,EAAE,YAAY,CAAC,cAAc,CAAC,2CA2GlC;AAED,eAAO,MAAM,KAAK,EAAmC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,SAAS,OAAO,EACrF,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;CAAE,KACrE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,87 +1,72 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as o, jsxs as
|
|
3
|
-
import { FileIcon as
|
|
4
|
-
import { isEqual as
|
|
5
|
-
import { memo as
|
|
2
|
+
import { jsx as o, jsxs as M, Fragment as h } from "react/jsx-runtime";
|
|
3
|
+
import { FileIcon as T, XIcon as q } from "@bioturing/assets";
|
|
4
|
+
import { isEqual as x } from "es-toolkit";
|
|
5
|
+
import { memo as y, forwardRef as B, useState as C, useCallback as n, cloneElement as I } from "react";
|
|
6
6
|
import { Stack as X } from "../stack/index.js";
|
|
7
7
|
import v from "merge-refs";
|
|
8
8
|
import { Tag as A } from "../tag/component.js";
|
|
9
9
|
import { useCls as D } from "../utils/antdUtils.js";
|
|
10
10
|
import { Truncate as G } from "../truncate/component.js";
|
|
11
11
|
import { IconButton as H } from "../icon-button/component.js";
|
|
12
|
-
|
|
12
|
+
import { clsx as J } from "../utils/cn.js";
|
|
13
|
+
function K({
|
|
13
14
|
value: s,
|
|
14
15
|
onChange: c,
|
|
15
16
|
multiple: t,
|
|
16
|
-
renderValueLabel:
|
|
17
|
-
renderValueIcon:
|
|
17
|
+
renderValueLabel: p,
|
|
18
|
+
renderValueIcon: d,
|
|
18
19
|
className: R,
|
|
19
20
|
style: E,
|
|
20
|
-
maxItems:
|
|
21
|
+
maxItems: i,
|
|
21
22
|
...N
|
|
22
23
|
}, S) {
|
|
23
|
-
const l = D(), [u, g] =
|
|
24
|
-
g(
|
|
25
|
-
}, []),
|
|
26
|
-
(
|
|
27
|
-
const
|
|
28
|
-
return typeof
|
|
29
|
-
G,
|
|
30
|
-
{
|
|
31
|
-
position: "middle",
|
|
32
|
-
className: l("dropzone-value-label"),
|
|
33
|
-
container: u,
|
|
34
|
-
children: r
|
|
35
|
-
}
|
|
36
|
-
) : /* @__PURE__ */ o("span", { className: l("dropzone-value-label"), children: r });
|
|
24
|
+
const l = D(), [u, g] = C(null), k = n((r) => {
|
|
25
|
+
g(r);
|
|
26
|
+
}, []), a = n(
|
|
27
|
+
(r) => {
|
|
28
|
+
const e = p(r);
|
|
29
|
+
return typeof e == "string" ? /* @__PURE__ */ o(G, { position: "middle", className: l("dropzone-value-label"), container: u, children: e }) : /* @__PURE__ */ o("span", { className: l("dropzone-value-label"), children: e });
|
|
37
30
|
},
|
|
38
|
-
[l, u,
|
|
39
|
-
),
|
|
40
|
-
(
|
|
31
|
+
[l, u, p]
|
|
32
|
+
), m = n(
|
|
33
|
+
(r) => I(d(r) || /* @__PURE__ */ o(T, {}), {
|
|
41
34
|
className: l("dropzone-value-icon")
|
|
42
35
|
}),
|
|
43
|
-
[l,
|
|
36
|
+
[l, d]
|
|
44
37
|
), b = n(
|
|
45
|
-
(
|
|
46
|
-
c(
|
|
47
|
-
s.filter((r) => !q(r, e))
|
|
48
|
-
);
|
|
38
|
+
(r) => {
|
|
39
|
+
c(s.filter((e) => !x(e, r)));
|
|
49
40
|
},
|
|
50
41
|
[c, s]
|
|
51
42
|
), z = n(() => {
|
|
52
43
|
t ? c([]) : c?.(null);
|
|
53
|
-
}, [c, t]),
|
|
54
|
-
(
|
|
55
|
-
const
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/* @__PURE__ */ o(H, { size: "small", onClick: z, children: /* @__PURE__ */ o(
|
|
44
|
+
}, [c, t]), f = n(
|
|
45
|
+
(r) => {
|
|
46
|
+
const e = a(r);
|
|
47
|
+
return /* @__PURE__ */ M(h, { children: [
|
|
48
|
+
m(r),
|
|
49
|
+
e,
|
|
50
|
+
/* @__PURE__ */ o(H, { size: "small", onClick: z, children: /* @__PURE__ */ o(q, {}) })
|
|
60
51
|
] });
|
|
61
52
|
},
|
|
62
|
-
[
|
|
53
|
+
[a, m, z]
|
|
63
54
|
), j = n(
|
|
64
|
-
(
|
|
65
|
-
const F =
|
|
55
|
+
(r) => i == 1 ? f(r[0]) : /* @__PURE__ */ o(h, { children: (r || []).map((e, w) => {
|
|
56
|
+
const F = a(e);
|
|
66
57
|
return /* @__PURE__ */ o(
|
|
67
58
|
A,
|
|
68
59
|
{
|
|
69
|
-
icon:
|
|
60
|
+
icon: m(e),
|
|
70
61
|
size: "large",
|
|
71
62
|
closable: !0,
|
|
72
|
-
onClose: () => b(
|
|
63
|
+
onClose: () => b(e),
|
|
73
64
|
children: F
|
|
74
65
|
},
|
|
75
66
|
w
|
|
76
67
|
);
|
|
77
68
|
}) }),
|
|
78
|
-
[
|
|
79
|
-
i,
|
|
80
|
-
a,
|
|
81
|
-
m,
|
|
82
|
-
d,
|
|
83
|
-
b
|
|
84
|
-
]
|
|
69
|
+
[a, m, i, f, b]
|
|
85
70
|
);
|
|
86
71
|
return /* @__PURE__ */ o(
|
|
87
72
|
X,
|
|
@@ -89,20 +74,19 @@ function J({
|
|
|
89
74
|
ref: v(S, k),
|
|
90
75
|
gap: t ? 4 : 8,
|
|
91
76
|
align: "center",
|
|
92
|
-
wrap: t &&
|
|
93
|
-
className:
|
|
94
|
-
"dropzone-value",
|
|
95
|
-
t && "dropzone-value-multiple",
|
|
77
|
+
wrap: t && i !== 1,
|
|
78
|
+
className: J(
|
|
79
|
+
l("dropzone-value", t && i != 1 && "dropzone-value-multiple"),
|
|
96
80
|
R
|
|
97
81
|
),
|
|
98
82
|
style: E,
|
|
99
83
|
...N,
|
|
100
|
-
children: t ? j(s) :
|
|
84
|
+
children: t ? j(s) : f(s)
|
|
101
85
|
}
|
|
102
86
|
);
|
|
103
87
|
}
|
|
104
|
-
const
|
|
88
|
+
const rr = y(B(K));
|
|
105
89
|
export {
|
|
106
|
-
|
|
90
|
+
rr as Value
|
|
107
91
|
};
|
|
108
92
|
//# sourceMappingURL=value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.js","sources":["../../../src/components/drag-drop/value.tsx"],"sourcesContent":["\"use client\";\nimport { FileIcon, XIcon } from \"@bioturing/assets\";\nimport { isEqual } from \"es-toolkit\";\nimport {
|
|
1
|
+
{"version":3,"file":"value.js","sources":["../../../src/components/drag-drop/value.tsx"],"sourcesContent":["\"use client\";\nimport { FileIcon, XIcon } from \"@bioturing/assets\";\nimport { isEqual } from \"es-toolkit\";\nimport { cloneElement, forwardRef, memo, useCallback, type ForwardedRef, useState } from \"react\";\nimport { IconButton } from \"../icon-button\";\nimport { clsx } from \"../utils\";\nimport { Stack } from \"../stack\";\nimport { Tag } from \"../tag\";\nimport { Truncate } from \"../truncate\";\nimport { useCls } from \"../utils\";\nimport { DragDropValueProps, type Data } from \"./types\";\nimport mergeRefs from \"merge-refs\";\n\nfunction ValueInner<T extends Data, M extends boolean>(\n {\n value,\n onChange,\n multiple,\n renderValueLabel,\n renderValueIcon,\n className,\n style,\n maxItems,\n ...rest\n }: DragDropValueProps<T, M>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const cls = useCls();\n\n // todo: make this as reusable hook\n const [containerEl, setContainerEl] = useState<HTMLDivElement>(null);\n const containerRef = useCallback((el: HTMLDivElement | null) => {\n setContainerEl(el);\n }, []);\n\n const renderLabel = useCallback(\n (value: T) => {\n const label = renderValueLabel(value);\n return typeof label === \"string\" ? (\n <Truncate position=\"middle\" className={cls(\"dropzone-value-label\")} container={containerEl}>\n {label}\n </Truncate>\n ) : (\n <span className={cls(\"dropzone-value-label\")}>{label}</span>\n );\n },\n [cls, containerEl, renderValueLabel],\n );\n\n const renderedValueIcon = useCallback(\n (value: T) => {\n return cloneElement(renderValueIcon(value) || <FileIcon />, {\n className: cls(\"dropzone-value-icon\"),\n });\n },\n [cls, renderValueIcon],\n );\n\n const handleResetMultiple = useCallback(\n (singleValue: T) => {\n (onChange as (value: T[]) => void)((value as T[]).filter((v) => !isEqual(v, singleValue)));\n },\n [onChange, value],\n );\n\n const handleResetSingle = useCallback(() => {\n if (multiple) {\n (onChange as (value: T[]) => void)([] as T[]);\n } else {\n onChange?.(null);\n }\n }, [onChange, multiple]);\n\n const renderSingle = useCallback(\n (value: T) => {\n const label = renderLabel(value as T);\n return (\n <>\n {renderedValueIcon(value as T)}\n {label}\n <IconButton size=\"small\" onClick={handleResetSingle}>\n <XIcon />\n </IconButton>\n </>\n );\n },\n [renderLabel, renderedValueIcon, handleResetSingle],\n );\n\n const renderMultiple = useCallback(\n (value: T[]) => {\n if (maxItems == 1) {\n return renderSingle(value[0]);\n }\n return (\n <>\n {((value as T[]) || []).map((singleValue, index) => {\n const label = renderLabel(singleValue);\n return (\n <Tag\n key={index}\n icon={renderedValueIcon(singleValue)}\n size=\"large\"\n closable\n onClose={() => handleResetMultiple(singleValue)}\n >\n {label}\n </Tag>\n );\n })}\n </>\n );\n },\n [renderLabel, renderedValueIcon, maxItems, renderSingle, handleResetMultiple],\n );\n\n return (\n <Stack\n ref={mergeRefs(ref, containerRef)}\n gap={multiple ? 4 : 8}\n align=\"center\"\n wrap={multiple && maxItems !== 1}\n className={clsx(\n cls(\"dropzone-value\", multiple && maxItems != 1 && \"dropzone-value-multiple\"),\n className,\n )}\n style={style}\n {...rest}\n >\n {multiple ? renderMultiple(value as T[]) : renderSingle(value as T)}\n </Stack>\n );\n}\n\nexport const Value = memo(forwardRef(ValueInner)) as <T extends Data, M extends boolean>(\n props: DragDropValueProps<T, M> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReturnType<typeof ValueInner>;\n"],"names":["ValueInner","value","onChange","multiple","renderValueLabel","renderValueIcon","className","style","maxItems","rest","ref","cls","useCls","containerEl","setContainerEl","useState","containerRef","useCallback","el","renderLabel","label","jsx","Truncate","renderedValueIcon","cloneElement","FileIcon","handleResetMultiple","singleValue","v","isEqual","handleResetSingle","renderSingle","jsxs","Fragment","IconButton","XIcon","renderMultiple","index","Tag","Stack","mergeRefs","clsx","Value","memo","forwardRef"],"mappings":";;;;;;;;;;;;AAaA,SAASA,EACP;AAAA,EACE,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAMC,EAAA,GAGN,CAACC,GAAaC,CAAc,IAAIC,EAAyB,IAAI,GAC7DC,IAAeC,EAAY,CAACC,MAA8B;AAC9D,IAAAJ,EAAeI,CAAE;AAAA,EACnB,GAAG,CAAA,CAAE,GAECC,IAAcF;AAAA,IAClB,CAAChB,MAAa;AACZ,YAAMmB,IAAQhB,EAAiBH,CAAK;AACpC,aAAO,OAAOmB,KAAU,WACtB,gBAAAC,EAACC,KAAS,UAAS,UAAS,WAAWX,EAAI,sBAAsB,GAAG,WAAWE,GAC5E,aACH,IAEA,gBAAAQ,EAAC,UAAK,WAAWV,EAAI,sBAAsB,GAAI,UAAAS,EAAA,CAAM;AAAA,IAEzD;AAAA,IACA,CAACT,GAAKE,GAAaT,CAAgB;AAAA,EAAA,GAG/BmB,IAAoBN;AAAA,IACxB,CAAChB,MACQuB,EAAanB,EAAgBJ,CAAK,KAAK,gBAAAoB,EAACI,KAAS,GAAI;AAAA,MAC1D,WAAWd,EAAI,qBAAqB;AAAA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AAA,EAAA;AAG9E,SACE,gBAAAL;AAAA,IAACkB;AAAA,IAAA;AAAA,MACC,KAAKC,EAAU9B,GAAKM,CAAY;AAAA,MAChC,KAAKb,IAAW,IAAI;AAAA,MACpB,OAAM;AAAA,MACN,MAAMA,KAAYK,MAAa;AAAA,MAC/B,WAAWiC;AAAA,QACT9B,EAAI,kBAAkBR,KAAYK,KAAY,KAAK,yBAAyB;AAAA,QAC5EF;AAAA,MAAA;AAAA,MAEF,OAAAC;AAAA,MACC,GAAGE;AAAA,MAEH,UAAAN,IAAWiC,EAAenC,CAAY,IAAI8B,EAAa9B,CAAU;AAAA,IAAA;AAAA,EAAA;AAGxE;AAEO,MAAMyC,KAAQC,EAAKC,EAAW5C,CAAU,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useDraggable.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,OAAO,GAAE,OAAc;mBAChB,WAAW,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"useDraggable.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useDraggable.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,OAAO,GAAE,OAAc;mBAChB,WAAW,GAAG,IAAI;EAqNrD"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback as
|
|
3
|
-
function
|
|
4
|
-
return { ref:
|
|
5
|
-
if (!n || !
|
|
6
|
-
let
|
|
2
|
+
import { useCallback as M } from "react";
|
|
3
|
+
function B(d = !0) {
|
|
4
|
+
return { ref: M((n) => {
|
|
5
|
+
if (!n || !d) return;
|
|
6
|
+
let a = !1, f = 0, m = 0, g = 0, v = 0, o = null;
|
|
7
7
|
n.addEventListener("mousedown", p);
|
|
8
|
-
function
|
|
8
|
+
function l(t) {
|
|
9
|
+
if (t) {
|
|
10
|
+
n.setAttribute("data-dragging", "true");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
n.removeAttribute("data-dragging");
|
|
14
|
+
}
|
|
15
|
+
function y(t) {
|
|
9
16
|
let e = t;
|
|
10
17
|
for (; e && e !== n; ) {
|
|
11
18
|
if (e.classList.contains("resize-handle") || e.classList.contains("ds-resizable-resize-handle") || e.getAttribute("data-resize-handle") || e.getAttribute("data-testid")?.includes("resize") || e.getAttribute("data-placement") || // Resizable handles have data-placement
|
|
@@ -17,39 +24,39 @@ function T(u = !0) {
|
|
|
17
24
|
}
|
|
18
25
|
return !1;
|
|
19
26
|
}
|
|
20
|
-
function
|
|
27
|
+
function L(t) {
|
|
21
28
|
const e = window.getComputedStyle(t), s = new DOMMatrix(e.transform);
|
|
22
29
|
return {
|
|
23
30
|
x: s.m41 || parseInt(e.left) || 0,
|
|
24
31
|
y: s.m42 || parseInt(e.top) || 0
|
|
25
32
|
};
|
|
26
33
|
}
|
|
27
|
-
function
|
|
34
|
+
function w(t, e, s) {
|
|
28
35
|
t.style.transform = `translate(${e}px, ${s}px)`;
|
|
29
36
|
}
|
|
30
37
|
function p(t) {
|
|
31
38
|
const e = t.target;
|
|
32
|
-
if (
|
|
39
|
+
if (y(e))
|
|
33
40
|
return;
|
|
34
41
|
if (n.closest("[data-resizable]")) {
|
|
35
|
-
const r = n.getBoundingClientRect(), E = t.clientX - r.left,
|
|
36
|
-
if (
|
|
42
|
+
const r = n.getBoundingClientRect(), E = t.clientX - r.left, z = t.clientY - r.top, c = 8, A = z <= c, S = z >= r.height - c, x = E <= c, D = E >= r.width - c, X = n.querySelector('.ds-resizable-resize-handle[data-placement*="top"]'), Y = n.querySelector('.ds-resizable-resize-handle[data-placement*="bottom"]'), q = n.querySelector('.ds-resizable-resize-handle[data-placement*="left"]'), H = n.querySelector('.ds-resizable-resize-handle[data-placement*="right"]');
|
|
43
|
+
if (A && X || S && Y || x && q || D && H)
|
|
37
44
|
return;
|
|
38
45
|
}
|
|
39
|
-
t.preventDefault(), t.stopPropagation(),
|
|
40
|
-
const s =
|
|
41
|
-
|
|
46
|
+
t.preventDefault(), t.stopPropagation(), a = !0, l(!0), f = t.clientX, m = t.clientY;
|
|
47
|
+
const s = L(n);
|
|
48
|
+
g = s.x, v = s.y, document.body.style.cursor = "grabbing", document.body.style.userSelect = "none", n.querySelectorAll('button, a, input, select, textarea, [role="button"]').forEach((r) => {
|
|
42
49
|
r.style.pointerEvents = "auto";
|
|
43
|
-
}), document.addEventListener("mousemove",
|
|
50
|
+
}), document.addEventListener("mousemove", u, { passive: !1 }), document.addEventListener("mouseup", i), document.addEventListener("touchmove", h, { passive: !1 }), document.addEventListener("touchend", i);
|
|
44
51
|
}
|
|
45
|
-
function
|
|
46
|
-
!
|
|
47
|
-
const e = t.clientX -
|
|
48
|
-
|
|
52
|
+
function u(t) {
|
|
53
|
+
!a || !n || (t.preventDefault(), o && cancelAnimationFrame(o), o = requestAnimationFrame(() => {
|
|
54
|
+
const e = t.clientX - f, s = t.clientY - m, b = g + e, r = v + s;
|
|
55
|
+
w(n, b, r);
|
|
49
56
|
}));
|
|
50
57
|
}
|
|
51
58
|
function h(t) {
|
|
52
|
-
if (!
|
|
59
|
+
if (!a || !n) return;
|
|
53
60
|
t.preventDefault();
|
|
54
61
|
const e = t.touches[0];
|
|
55
62
|
if (!e) return;
|
|
@@ -58,19 +65,19 @@ function T(u = !0) {
|
|
|
58
65
|
clientY: e.clientY,
|
|
59
66
|
bubbles: !0
|
|
60
67
|
});
|
|
61
|
-
|
|
68
|
+
u(s);
|
|
62
69
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
70
|
+
function i() {
|
|
71
|
+
a && (a = !1, l(!1), o && (cancelAnimationFrame(o), o = null), document.body.style.cursor = "", document.body.style.userSelect = "", n && n.querySelectorAll('button, a, input, select, textarea, [role="button"]').forEach((e) => {
|
|
65
72
|
e.style.pointerEvents = "";
|
|
66
|
-
}), document.removeEventListener("mousemove",
|
|
73
|
+
}), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", i), document.removeEventListener("touchmove", h), document.removeEventListener("touchend", i));
|
|
67
74
|
}
|
|
68
75
|
return () => {
|
|
69
|
-
n.removeEventListener("mousedown", p),
|
|
76
|
+
n.removeEventListener("mousedown", p), l(!1), i();
|
|
70
77
|
};
|
|
71
|
-
}, [
|
|
78
|
+
}, [d]) };
|
|
72
79
|
}
|
|
73
80
|
export {
|
|
74
|
-
|
|
81
|
+
B as useDraggable
|
|
75
82
|
};
|
|
76
83
|
//# sourceMappingURL=useDraggable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDraggable.js","sources":["../../../src/components/hooks/useDraggable.ts"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\n\nexport function useDraggable(enabled: boolean = true) {\n const ref = useCallback((element: HTMLElement | null) => {\n if (!element || !enabled) return;\n \n let isDragging = false;\n let startX = 0;\n let startY = 0;\n let initialLeft = 0;\n let initialTop = 0;\n let rafId: number | null = null;\n\n element.addEventListener(\"mousedown\", dragMouseDown);\n\n function isResizeHandle(target: HTMLElement): boolean {\n // Check if the element or any of its parents is a resize handle\n let current = target;\n while (current && current !== element) {\n // Check for various resize handle indicators\n if (\n current.classList.contains('resize-handle') ||\n current.classList.contains('ds-resizable-resize-handle') ||\n current.getAttribute('data-resize-handle') ||\n current.getAttribute('data-testid')?.includes('resize') ||\n current.getAttribute('data-placement') || // Resizable handles have data-placement\n current.style.cursor?.includes('resize') ||\n // Check for react-use-resizable specific classes/attributes\n current.classList.contains('resizable-handle') ||\n current.hasAttribute('data-resizable-handle') ||\n // Check for common resize cursor styles\n ['n-resize', 's-resize', 'e-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize'].includes(current.style.cursor)\n ) {\n return true;\n }\n current = current.parentElement as HTMLElement;\n }\n return false;\n }\n\n function getElementPosition(el: HTMLElement) {\n const style = window.getComputedStyle(el);\n const matrix = new DOMMatrix(style.transform);\n return {\n x: matrix.m41 || parseInt(style.left) || 0,\n y: matrix.m42 || parseInt(style.top) || 0\n };\n }\n\n function setElementPosition(el: HTMLElement, x: number, y: number) {\n // Use transform for better performance and smoother animation\n el.style.transform = `translate(${x}px, ${y}px)`;\n }\n\n function dragMouseDown(e: MouseEvent) {\n const target = e.target as HTMLElement;\n \n // Check if the click is on a resize handle\n if (isResizeHandle(target)) {\n return; // Don't start dragging\n }\n \n // Let resize handles take priority - if we reach this point and there's a resizable container,\n // we should check if there are actual resize handles present before preventing drag\n if (element.closest('[data-resizable]')) {\n const rect = element.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n const handleSize = 8;\n \n // Only prevent drag if we're near an edge AND there are actual resize handles\n const nearTopEdge = y <= handleSize;\n const nearBottomEdge = y >= rect.height - handleSize;\n const nearLeftEdge = x <= handleSize;\n const nearRightEdge = x >= rect.width - handleSize;\n \n // Check if resize handles exist for the edges we're near\n const hasTopHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"top\"]');\n const hasBottomHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"bottom\"]');\n const hasLeftHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"left\"]');\n const hasRightHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"right\"]');\n \n if (\n (nearTopEdge && hasTopHandle) ||\n (nearBottomEdge && hasBottomHandle) ||\n (nearLeftEdge && hasLeftHandle) ||\n (nearRightEdge && hasRightHandle)\n ) {\n return; // Let resize handle it\n }\n }\n \n e.preventDefault();\n e.stopPropagation();\n \n isDragging = true;\n \n // Store initial mouse position\n startX = e.clientX;\n startY = e.clientY;\n \n // Get initial element position\n const pos = getElementPosition(element);\n initialLeft = pos.x;\n initialTop = pos.y;\n \n // Set initial cursor style and prevent text selection\n document.body.style.cursor = 'grabbing';\n document.body.style.userSelect = 'none';\n \n // Only disable pointer events on content areas, not buttons/interactive elements\n const interactiveElements = element.querySelectorAll('button, a, input, select, textarea, [role=\"button\"]');\n interactiveElements.forEach(el => {\n (el as HTMLElement).style.pointerEvents = 'auto';\n });\n \n // Add move and up listeners\n document.addEventListener(\"mousemove\", elementDrag, { passive: false });\n document.addEventListener(\"mouseup\", closeDragElement);\n \n // Add touch events for mobile support\n document.addEventListener(\"touchmove\", handleTouchMove, { passive: false });\n document.addEventListener(\"touchend\", closeDragElement);\n }\n\n function elementDrag(e: MouseEvent) {\n if (!isDragging || !element) return;\n \n e.preventDefault();\n \n // Cancel any previous animation frame\n if (rafId) {\n cancelAnimationFrame(rafId);\n }\n \n // Use requestAnimationFrame for smooth animation\n rafId = requestAnimationFrame(() => {\n const deltaX = e.clientX - startX;\n const deltaY = e.clientY - startY;\n \n const newX = initialLeft + deltaX;\n const newY = initialTop + deltaY;\n \n // Apply position directly without bounds checking\n setElementPosition(element, newX, newY);\n });\n }\n\n function handleTouchMove(e: TouchEvent) {\n if (!isDragging || !element) return;\n \n e.preventDefault();\n \n const touch = e.touches[0];\n if (!touch) return;\n \n // Convert touch event to mouse-like event\n const mouseEvent = new MouseEvent('mousemove', {\n clientX: touch.clientX,\n clientY: touch.clientY,\n bubbles: true\n });\n \n elementDrag(mouseEvent);\n }\n\n function closeDragElement() {\n if (!isDragging) return;\n \n isDragging = false;\n \n // Cancel any pending animation frame\n if (rafId) {\n cancelAnimationFrame(rafId);\n rafId = null;\n }\n \n // Restore styles\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n \n // Restore pointer events for interactive elements\n if (element) {\n const interactiveElements = element.querySelectorAll('button, a, input, select, textarea, [role=\"button\"]');\n interactiveElements.forEach(el => {\n (el as HTMLElement).style.pointerEvents = '';\n });\n }\n \n // Remove event listeners\n document.removeEventListener(\"mousemove\", elementDrag);\n document.removeEventListener(\"mouseup\", closeDragElement);\n document.removeEventListener(\"touchmove\", handleTouchMove);\n document.removeEventListener(\"touchend\", closeDragElement);\n }\n\n // Cleanup function\n return () => {\n element.removeEventListener(\"mousedown\", dragMouseDown);\n closeDragElement();\n };\n }, [enabled]);\n \n return { ref };\n}\n"],"names":["useDraggable","enabled","useCallback","element","isDragging","startX","startY","initialLeft","initialTop","rafId","dragMouseDown","isResizeHandle","target","current","getElementPosition","el","style","matrix","setElementPosition","x","y","e","rect","handleSize","nearTopEdge","nearBottomEdge","nearLeftEdge","nearRightEdge","hasTopHandle","hasBottomHandle","hasLeftHandle","hasRightHandle","pos","elementDrag","closeDragElement","handleTouchMove","deltaX","deltaY","newX","newY","touch","mouseEvent"],"mappings":";;AAGO,SAASA,EAAaC,IAAmB,IAAM;AAyMpD,SAAO,EAAE,KAxMGC,EAAY,CAACC,MAAgC;AACvD,QAAI,CAACA,KAAW,CAACF,EAAS;AAE1B,QAAIG,IAAa,IACbC,IAAS,GACTC,IAAS,GACTC,IAAc,GACdC,IAAa,GACbC,IAAuB;AAE3B,IAAAN,EAAQ,iBAAiB,aAAaO,CAAa;AAEnD,aAASC,EAAeC,GAA8B;AAEpD,UAAIC,IAAUD;AACd,aAAOC,KAAWA,MAAYV,KAAS;AAErC,YACEU,EAAQ,UAAU,SAAS,eAAe,KAC1CA,EAAQ,UAAU,SAAS,4BAA4B,KACvDA,EAAQ,aAAa,oBAAoB,KACzCA,EAAQ,aAAa,aAAa,GAAG,SAAS,QAAQ,KACtDA,EAAQ,aAAa,gBAAgB;AAAA,QACrCA,EAAQ,MAAM,QAAQ,SAAS,QAAQ;AAAA,QAEvCA,EAAQ,UAAU,SAAS,kBAAkB,KAC7CA,EAAQ,aAAa,uBAAuB;AAAA,QAE5C,CAAC,YAAY,YAAY,YAAY,YAAY,aAAa,aAAa,aAAa,WAAW,EAAE,SAASA,EAAQ,MAAM,MAAM;AAElI,iBAAO;AAET,QAAAA,IAAUA,EAAQ;AAAA,MACpB;AACA,aAAO;AAAA,IACT;AAEA,aAASC,EAAmBC,GAAiB;AAC3C,YAAMC,IAAQ,OAAO,iBAAiBD,CAAE,GAClCE,IAAS,IAAI,UAAUD,EAAM,SAAS;AAC5C,aAAO;AAAA,QACL,GAAGC,EAAO,OAAO,SAASD,E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,EAAQ,oBAAoB,aAAaO,CAAa,GACtDwB,EAAA;AAAA,IACF;AAAA,EACF,GAAG,CAACjC,CAAO,CAAC,EAEH;AACX;"}
|
|
1
|
+
{"version":3,"file":"useDraggable.js","sources":["../../../src/components/hooks/useDraggable.ts"],"sourcesContent":["\"use client\";\nimport { useCallback } from \"react\";\n\nexport function useDraggable(enabled: boolean = true) {\n const ref = useCallback((element: HTMLElement | null) => {\n if (!element || !enabled) return;\n\n let isDragging = false;\n let startX = 0;\n let startY = 0;\n let initialLeft = 0;\n let initialTop = 0;\n let rafId: number | null = null;\n\n element.addEventListener(\"mousedown\", dragMouseDown);\n\n function setDraggingState(dragging: boolean) {\n if (dragging) {\n element.setAttribute(\"data-dragging\", \"true\");\n return;\n }\n\n element.removeAttribute(\"data-dragging\");\n }\n\n function isResizeHandle(target: HTMLElement): boolean {\n // Check if the element or any of its parents is a resize handle\n let current = target;\n while (current && current !== element) {\n // Check for various resize handle indicators\n if (\n current.classList.contains('resize-handle') ||\n current.classList.contains('ds-resizable-resize-handle') ||\n current.getAttribute('data-resize-handle') ||\n current.getAttribute('data-testid')?.includes('resize') ||\n current.getAttribute('data-placement') || // Resizable handles have data-placement\n current.style.cursor?.includes('resize') ||\n // Check for react-use-resizable specific classes/attributes\n current.classList.contains('resizable-handle') ||\n current.hasAttribute('data-resizable-handle') ||\n // Check for common resize cursor styles\n ['n-resize', 's-resize', 'e-resize', 'w-resize', 'ne-resize', 'nw-resize', 'se-resize', 'sw-resize'].includes(current.style.cursor)\n ) {\n return true;\n }\n current = current.parentElement as HTMLElement;\n }\n return false;\n }\n\n function getElementPosition(el: HTMLElement) {\n const style = window.getComputedStyle(el);\n const matrix = new DOMMatrix(style.transform);\n return {\n x: matrix.m41 || parseInt(style.left) || 0,\n y: matrix.m42 || parseInt(style.top) || 0\n };\n }\n\n function setElementPosition(el: HTMLElement, x: number, y: number) {\n // Use transform for better performance and smoother animation\n el.style.transform = `translate(${x}px, ${y}px)`;\n }\n\n function dragMouseDown(e: MouseEvent) {\n const target = e.target as HTMLElement;\n\n // Check if the click is on a resize handle\n if (isResizeHandle(target)) {\n return; // Don't start dragging\n }\n\n // Let resize handles take priority - if we reach this point and there's a resizable container,\n // we should check if there are actual resize handles present before preventing drag\n if (element.closest('[data-resizable]')) {\n const rect = element.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n const handleSize = 8;\n\n // Only prevent drag if we're near an edge AND there are actual resize handles\n const nearTopEdge = y <= handleSize;\n const nearBottomEdge = y >= rect.height - handleSize;\n const nearLeftEdge = x <= handleSize;\n const nearRightEdge = x >= rect.width - handleSize;\n\n // Check if resize handles exist for the edges we're near\n const hasTopHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"top\"]');\n const hasBottomHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"bottom\"]');\n const hasLeftHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"left\"]');\n const hasRightHandle = element.querySelector('.ds-resizable-resize-handle[data-placement*=\"right\"]');\n\n if (\n (nearTopEdge && hasTopHandle) ||\n (nearBottomEdge && hasBottomHandle) ||\n (nearLeftEdge && hasLeftHandle) ||\n (nearRightEdge && hasRightHandle)\n ) {\n return; // Let resize handle it\n }\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n isDragging = true;\n setDraggingState(true);\n\n // Store initial mouse position\n startX = e.clientX;\n startY = e.clientY;\n\n // Get initial element position\n const pos = getElementPosition(element);\n initialLeft = pos.x;\n initialTop = pos.y;\n\n // Set initial cursor style and prevent text selection\n document.body.style.cursor = 'grabbing';\n document.body.style.userSelect = 'none';\n\n // Only disable pointer events on content areas, not buttons/interactive elements\n const interactiveElements = element.querySelectorAll('button, a, input, select, textarea, [role=\"button\"]');\n interactiveElements.forEach(el => {\n (el as HTMLElement).style.pointerEvents = 'auto';\n });\n\n // Add move and up listeners\n document.addEventListener(\"mousemove\", elementDrag, { passive: false });\n document.addEventListener(\"mouseup\", closeDragElement);\n\n // Add touch events for mobile support\n document.addEventListener(\"touchmove\", handleTouchMove, { passive: false });\n document.addEventListener(\"touchend\", closeDragElement);\n }\n\n function elementDrag(e: MouseEvent) {\n if (!isDragging || !element) return;\n\n e.preventDefault();\n\n // Cancel any previous animation frame\n if (rafId) {\n cancelAnimationFrame(rafId);\n }\n\n // Use requestAnimationFrame for smooth animation\n rafId = requestAnimationFrame(() => {\n const deltaX = e.clientX - startX;\n const deltaY = e.clientY - startY;\n\n const newX = initialLeft + deltaX;\n const newY = initialTop + deltaY;\n\n // Apply position directly without bounds checking\n setElementPosition(element, newX, newY);\n });\n }\n\n function handleTouchMove(e: TouchEvent) {\n if (!isDragging || !element) return;\n\n e.preventDefault();\n\n const touch = e.touches[0];\n if (!touch) return;\n\n // Convert touch event to mouse-like event\n const mouseEvent = new MouseEvent('mousemove', {\n clientX: touch.clientX,\n clientY: touch.clientY,\n bubbles: true\n });\n\n elementDrag(mouseEvent);\n }\n\n function closeDragElement() {\n if (!isDragging) return;\n\n isDragging = false;\n setDraggingState(false);\n\n // Cancel any pending animation frame\n if (rafId) {\n cancelAnimationFrame(rafId);\n rafId = null;\n }\n\n // Restore styles\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n\n // Restore pointer events for interactive elements\n if (element) {\n const interactiveElements = element.querySelectorAll('button, a, input, select, textarea, [role=\"button\"]');\n interactiveElements.forEach(el => {\n (el as HTMLElement).style.pointerEvents = '';\n });\n }\n \n // Remove event listeners\n document.removeEventListener(\"mousemove\", elementDrag);\n document.removeEventListener(\"mouseup\", closeDragElement);\n document.removeEventListener(\"touchmove\", handleTouchMove);\n document.removeEventListener(\"touchend\", closeDragElement);\n }\n\n // Cleanup function\n return () => {\n element.removeEventListener(\"mousedown\", dragMouseDown);\n setDraggingState(false);\n closeDragElement();\n };\n }, [enabled]);\n\n return { ref };\n}\n"],"names":["useDraggable","enabled","useCallback","element","isDragging","startX","startY","initialLeft","initialTop","rafId","dragMouseDown","setDraggingState","dragging","isResizeHandle","target","current","getElementPosition","el","style","matrix","setElementPosition","x","y","e","rect","handleSize","nearTopEdge","nearBottomEdge","nearLeftEdge","nearRightEdge","hasTopHandle","hasBottomHandle","hasLeftHandle","hasRightHandle","pos","elementDrag","closeDragElement","handleTouchMove","deltaX","deltaY","newX","newY","touch","mouseEvent"],"mappings":";;AAGO,SAASA,EAAaC,IAAmB,IAAM;AAqNpD,SAAO,EAAE,KApNGC,EAAY,CAACC,MAAgC;AACvD,QAAI,CAACA,KAAW,CAACF,EAAS;AAE1B,QAAIG,IAAa,IACbC,IAAS,GACTC,IAAS,GACTC,IAAc,GACdC,IAAa,GACbC,IAAuB;AAE3B,IAAAN,EAAQ,iBAAiB,aAAaO,CAAa;AAEnD,aAASC,EAAiBC,GAAmB;AAC3C,UAAIA,GAAU;AACZ,QAAAT,EAAQ,aAAa,iBAAiB,MAAM;AAC5C;AAAA,MACF;AAEA,MAAAA,EAAQ,gBAAgB,eAAe;AAAA,IACzC;AAEA,aAASU,EAAeC,GAA8B;AAEpD,UAAIC,IAAUD;AACd,aAAOC,KAAWA,MAAYZ,KAAS;AAErC,YACEY,EAAQ,UAAU,SAAS,eAAe,KAC1CA,EAAQ,UAAU,SAAS,4BAA4B,KACvDA,EAAQ,aAAa,oBAAoB,KACzCA,EAAQ,aAAa,aAAa,GAAG,SAAS,QAAQ,KACtDA,EAAQ,aAAa,gBAAgB;AAAA,QACrCA,EAAQ,MAAM,QAAQ,SAAS,QAAQ;AAAA,QAEvCA,EAAQ,UAAU,SAAS,kBAAkB,KAC7CA,EAAQ,aAAa,uBAAuB;AAAA,QAE5C,CAAC,YAAY,YAAY,YAAY,YAAY,aAAa,aAAa,aAAa,WAAW,EAAE,SAASA,EAAQ,MAAM,MAAM;AAElI,iBAAO;AAET,QAAAA,IAAUA,EAAQ;AAAA,MACpB;AACA,aAAO;AAAA,IACT;AAEA,aAASC,EAAmBC,GAAiB;AAC3C,YAAMC,IAAQ,OAAO,iBAAiBD,CAAE,GAClCE,IAAS,IAAI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AAgB,GACxD,SAAS,oBAAoB,aAAaC,CAAe,GACzD,SAAS,oBAAoB,YAAYD,CAAgB;AAAA,IAC3D;AAGA,WAAO,MAAM;AACX,MAAAjC,EAAQ,oBAAoB,aAAaO,CAAa,GACtDC,EAAiB,EAAK,GACtByB,EAAA;AAAA,IACF;AAAA,EACF,GAAG,CAACnC,CAAO,CAAC,EAEH;AACX;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { PopupPanelProps } from './types';
|
|
2
|
-
export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, size, footer, defaultOpen, resizable, draggable, maintainAspectRatio, classNames, modal, closeOnClickOutside, onPlacementChange, positionerProps, triggerProps, portalProps, offsetFrom, nativeButton, ...rest }: PopupPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const PopupPanel: ({ children, placement, openOnHover, open: outsideOpen, onOpenChange: outsideOnOpenChange, content, title, trigger, className, anchor, beforeCloseButton, afterCloseButton, afterTitle, arrow, size, footer, defaultOpen, resizable, draggable, maintainAspectRatio, classNames, modal, closeOnClickOutside, onPlacementChange, positionerProps, triggerProps, portalProps, offsetFrom, nativeButton, zIndex, ...rest }: PopupPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/popup-panel/component.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI1C,OAAO,aAAa,CAAC;AAwDrB,eAAO,MAAM,UAAU,GAAI,wZAgCxB,eAAe,4CA2QjB,CAAC"}
|