@spaced-out/ui-design-system 0.6.11 → 0.6.12
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/CHANGELOG.md +7 -0
- package/lib/components/DraggableWrapper/DraggableWrapper.d.ts +10 -3
- package/lib/components/DraggableWrapper/DraggableWrapper.d.ts.map +1 -1
- package/lib/components/DraggableWrapper/DraggableWrapper.js +32 -12
- package/lib/components/DraggableWrapper/index.d.ts +1 -1
- package/lib/components/DraggableWrapper/index.d.ts.map +1 -1
- package/mcp/package.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.6.12](https://github.com/spaced-out/ui-design-system/compare/v0.6.11...v0.6.12) (2026-04-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **DraggableWrapper:** decouple from native HTML5 drag to support multiple DnD libraries ([#477](https://github.com/spaced-out/ui-design-system/issues/477)) ([fdd7386](https://github.com/spaced-out/ui-design-system/commit/fdd7386c033d248c8e5eb9de738ba00c7873bebe))
|
|
11
|
+
|
|
5
12
|
### [0.6.11](https://github.com/spaced-out/ui-design-system/compare/v0.6.10...v0.6.11) (2026-04-15)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
type DraggableWrapperClassNames = Readonly<{
|
|
2
|
+
export type DraggableWrapperClassNames = Readonly<{
|
|
3
3
|
/** Override or extend the root wrapper element. */
|
|
4
4
|
wrapper?: string;
|
|
5
5
|
/** Override or extend the drag handle element. */
|
|
@@ -19,7 +19,14 @@ export interface DraggableWrapperProps extends Pick<React.HTMLAttributes<HTMLDiv
|
|
|
19
19
|
*/
|
|
20
20
|
onKeyboardReorder?: (direction: 'up' | 'down') => void;
|
|
21
21
|
testId?: string;
|
|
22
|
+
/** Set false when using @dnd-kit / react-beautiful-dnd (pointer-event libs). Keep true for react-dnd HTML5 backend. Default true. */
|
|
23
|
+
enableNativeDrag?: boolean;
|
|
24
|
+
/** Extra props to spread on the wrapper (library listeners/attributes). */
|
|
25
|
+
wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
26
|
+
/** Extra props to spread on the drag handle (some libs attach activator listeners here). */
|
|
27
|
+
dragHandleProps?: React.HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
/** Separate ref for the drag handle (for libs with setActivatorNodeRef / react-dnd's drag). */
|
|
29
|
+
dragHandleRef?: React.Ref<HTMLDivElement>;
|
|
22
30
|
}
|
|
23
|
-
export declare const DraggableWrapper:
|
|
24
|
-
export {};
|
|
31
|
+
export declare const DraggableWrapper: React.ForwardRefExoticComponent<DraggableWrapperProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
32
|
//# sourceMappingURL=DraggableWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/DraggableWrapper/DraggableWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DraggableWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/DraggableWrapper/DraggableWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAChD,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH,MAAM,WAAW,qBACf,SAAQ,IAAI,CACV,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,aAAa,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,CACtD;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6FAA6F;IAC7F,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,KAAK,IAAI,CAAC;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qIAAqI;IACrI,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,2EAA2E;IAC3E,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IACpD,4FAA4F;IAC5F,eAAe,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IACvD,+FAA+F;IAC/F,aAAa,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,gBAAgB,8FA6H5B,CAAC"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.DraggableWrapper = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _mergeRefs = require("../../utils/merge-refs");
|
|
9
10
|
var _qa = require("../../utils/qa");
|
|
10
11
|
var _Icon = require("../Icon");
|
|
11
12
|
var _Tooltip = require("../Tooltip");
|
|
@@ -13,7 +14,7 @@ var _DraggableWrapperModule = _interopRequireDefault(require("./DraggableWrapper
|
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
-
const DraggableWrapper = _ref => {
|
|
17
|
+
const DraggableWrapper = exports.DraggableWrapper = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
17
18
|
let {
|
|
18
19
|
children,
|
|
19
20
|
isDragging,
|
|
@@ -24,12 +25,17 @@ const DraggableWrapper = _ref => {
|
|
|
24
25
|
onDragEnd,
|
|
25
26
|
onDragOver,
|
|
26
27
|
onDrop,
|
|
27
|
-
onKeyboardReorder
|
|
28
|
+
onKeyboardReorder,
|
|
29
|
+
enableNativeDrag = true,
|
|
30
|
+
wrapperProps,
|
|
31
|
+
dragHandleProps,
|
|
32
|
+
dragHandleRef
|
|
28
33
|
} = _ref;
|
|
29
|
-
const
|
|
34
|
+
const internalRef = React.useRef(null);
|
|
35
|
+
const mergedRef = React.useMemo(() => (0, _mergeRefs.mergeRefs)([internalRef, ref]), [ref]);
|
|
30
36
|
const isKeyboardGrabbed = React.useRef(false);
|
|
31
37
|
const dispatchDragEvent = type => {
|
|
32
|
-
|
|
38
|
+
internalRef.current?.dispatchEvent(new DragEvent(type, {
|
|
33
39
|
bubbles: true,
|
|
34
40
|
dataTransfer: new DataTransfer()
|
|
35
41
|
}));
|
|
@@ -38,6 +44,17 @@ const DraggableWrapper = _ref => {
|
|
|
38
44
|
isKeyboardGrabbed.current = false;
|
|
39
45
|
dispatchDragEvent('dragend');
|
|
40
46
|
};
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
const element = internalRef.current;
|
|
49
|
+
return () => {
|
|
50
|
+
if (isKeyboardGrabbed.current && element) {
|
|
51
|
+
element.dispatchEvent(new DragEvent('dragend', {
|
|
52
|
+
bubbles: true,
|
|
53
|
+
dataTransfer: new DataTransfer()
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
41
58
|
const handleBlur = () => {
|
|
42
59
|
if (isKeyboardGrabbed.current) {
|
|
43
60
|
releaseKeyboardGrab();
|
|
@@ -67,26 +84,29 @@ const DraggableWrapper = _ref => {
|
|
|
67
84
|
}
|
|
68
85
|
};
|
|
69
86
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
70
|
-
ref:
|
|
71
|
-
draggable: true,
|
|
87
|
+
ref: mergedRef,
|
|
72
88
|
onDragStart: onDragStart,
|
|
73
89
|
onDragEnd: onDragEnd,
|
|
74
90
|
onDragOver: onDragOver,
|
|
75
91
|
onDrop: onDrop,
|
|
92
|
+
...wrapperProps,
|
|
93
|
+
draggable: enableNativeDrag,
|
|
76
94
|
"data-testid": (0, _qa.generateTestId)({
|
|
77
95
|
base: testId
|
|
78
96
|
}),
|
|
79
97
|
className: (0, _classify.default)(_DraggableWrapperModule.default.wrapper, {
|
|
80
98
|
[_DraggableWrapperModule.default.dragging]: !!isDragging
|
|
81
|
-
}, classNames?.wrapper),
|
|
99
|
+
}, classNames?.wrapper, wrapperProps?.className),
|
|
82
100
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
|
-
|
|
101
|
+
ref: dragHandleRef,
|
|
102
|
+
...dragHandleProps,
|
|
103
|
+
onKeyDownCapture: enableNativeDrag ? handleKeyDown : dragHandleProps?.onKeyDownCapture,
|
|
104
|
+
onBlur: enableNativeDrag ? handleBlur : dragHandleProps?.onBlur,
|
|
84
105
|
"data-testid": (0, _qa.generateTestId)({
|
|
85
106
|
base: testId,
|
|
86
107
|
slot: 'drag-handle'
|
|
87
108
|
}),
|
|
88
|
-
|
|
89
|
-
onBlur: handleBlur,
|
|
109
|
+
className: (0, _classify.default)(_DraggableWrapperModule.default.dragHandle, classNames?.dragHandle, dragHandleProps?.className),
|
|
90
110
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
|
|
91
111
|
title: dragHandleLabel,
|
|
92
112
|
placement: "top",
|
|
@@ -98,5 +118,5 @@ const DraggableWrapper = _ref => {
|
|
|
98
118
|
})
|
|
99
119
|
}), children]
|
|
100
120
|
});
|
|
101
|
-
};
|
|
102
|
-
|
|
121
|
+
});
|
|
122
|
+
DraggableWrapper.displayName = 'DraggableWrapper';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { DraggableWrapper } from '../../components/DraggableWrapper/DraggableWrapper';
|
|
2
|
-
export type { DraggableWrapperProps } from '../../components/DraggableWrapper/DraggableWrapper';
|
|
2
|
+
export type { DraggableWrapperProps, DraggableWrapperClassNames, } from '../../components/DraggableWrapper/DraggableWrapper';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DraggableWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kDAAkD,CAAC;AAClF,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DraggableWrapper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kDAAkD,CAAC;AAClF,YAAY,EACV,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,kDAAkD,CAAC"}
|
package/mcp/package.json
CHANGED