@dnd-kit/core
Advanced tools
Comparing version 2.1.2 to 3.0.0
# @dnd-kit/core | ||
## 3.0.0 | ||
### Major Changes | ||
- [`a9d92cf`](https://github.com/clauderic/dnd-kit/commit/a9d92cf1fa35dd957e6c5915a13dfd2af134c103) [#174](https://github.com/clauderic/dnd-kit/pull/174) Thanks [@clauderic](https://github.com/clauderic)! - Distributed assets now only target modern browsers. [Browserlist](https://github.com/browserslist/browserslist) config: | ||
``` | ||
defaults | ||
last 2 version | ||
not IE 11 | ||
not dead | ||
``` | ||
If you need to support older browsers, include the appropriate polyfills in your project's build process. | ||
- [`b406cb9`](https://github.com/clauderic/dnd-kit/commit/b406cb9251beef8677d05c45ec42bab7581a86dc) [#187](https://github.com/clauderic/dnd-kit/pull/187) Thanks [@clauderic](https://github.com/clauderic)! - Introduced the `useDndMonitor` hook. The `useDndMonitor` hook can be used within components wrapped in a `DndContext` provider to monitor the different drag and drop events that happen for that `DndContext`. | ||
Example usage: | ||
```tsx | ||
import {DndContext, useDndMonitor} from '@dnd-kit/core'; | ||
function App() { | ||
return ( | ||
<DndContext> | ||
<Component /> | ||
</DndContext> | ||
); | ||
} | ||
function Component() { | ||
useDndMonitor({ | ||
onDragStart(event) {}, | ||
onDragMove(event) {}, | ||
onDragOver(event) {}, | ||
onDragEnd(event) {}, | ||
onDragCancel(event) {}, | ||
}); | ||
} | ||
``` | ||
### Minor Changes | ||
- [`b7355d1`](https://github.com/clauderic/dnd-kit/commit/b7355d19d9e15bb1972627bb622c2487ddec82ad) [#207](https://github.com/clauderic/dnd-kit/pull/207) Thanks [@clauderic](https://github.com/clauderic)! - The `data` argument for `useDraggable` and `useDroppable` is now exposed in event handlers and on the `active` and `over` objects. | ||
**Example usage:** | ||
```tsx | ||
import {DndContext, useDraggable, useDroppable} from '@dnd-kit/core'; | ||
function Draggable() { | ||
const {attributes, listeners, setNodeRef, transform} = useDraggable({ | ||
id: 'draggable', | ||
data: { | ||
type: 'type1', | ||
}, | ||
}); | ||
/* ... */ | ||
} | ||
function Droppable() { | ||
const {setNodeRef} = useDroppable({ | ||
id: 'droppable', | ||
data: { | ||
accepts: ['type1', 'type2'], | ||
}, | ||
}); | ||
/* ... */ | ||
} | ||
function App() { | ||
return ( | ||
<DndContext | ||
onDragEnd={({active, over}) => { | ||
if (over?.data.current.accepts.includes(active.data.current.type)) { | ||
// do stuff | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
``` | ||
### Patch Changes | ||
- Updated dependencies [[`a9d92cf`](https://github.com/clauderic/dnd-kit/commit/a9d92cf1fa35dd957e6c5915a13dfd2af134c103), [`b406cb9`](https://github.com/clauderic/dnd-kit/commit/b406cb9251beef8677d05c45ec42bab7581a86dc)]: | ||
- @dnd-kit/accessibility@3.0.0 | ||
- @dnd-kit/utilities@2.0.0 | ||
## 2.1.2 | ||
@@ -4,0 +95,0 @@ |
import React from 'react'; | ||
import type { Announcements, ScreenReaderInstructions } from './types'; | ||
import type { UniqueIdentifier } from '../../types'; | ||
import { State } from '../../store'; | ||
interface Props { | ||
announcements?: Announcements; | ||
activeId: UniqueIdentifier | null; | ||
overId: UniqueIdentifier | null; | ||
lastEvent: State['draggable']['lastEvent']; | ||
screenReaderInstructions: ScreenReaderInstructions; | ||
hiddenTextDescribedById: UniqueIdentifier; | ||
} | ||
export declare function Accessibility({ announcements, activeId, overId, lastEvent, hiddenTextDescribedById, screenReaderInstructions, }: Props): React.ReactPortal | null; | ||
export declare function Accessibility({ announcements, hiddenTextDescribedById, screenReaderInstructions, }: Props): React.ReactPortal | null; | ||
export {}; |
import React from 'react'; | ||
import { Transform } from '@dnd-kit/utilities'; | ||
import type { ViewRect, LayoutRect, Translate } from '../../types'; | ||
import type { AutoScrollOptions, LayoutMeasuring } from '../../hooks/utilities'; | ||
@@ -8,43 +7,5 @@ import { SensorDescriptor } from '../../sensors'; | ||
import { Modifiers } from '../../modifiers'; | ||
import type { LayoutRectMap } from '../../store/types'; | ||
import type { UniqueIdentifier } from '../../types'; | ||
import type { DragStartEvent, DragCancelEvent, DragEndEvent, DragMoveEvent, DragOverEvent } from '../../types'; | ||
import { Announcements, ScreenReaderInstructions } from '../Accessibility'; | ||
interface Active { | ||
id: UniqueIdentifier; | ||
} | ||
export interface DragStartEvent { | ||
active: Active; | ||
} | ||
export interface DragMoveEvent { | ||
active: Active; | ||
delta: Translate; | ||
draggingRect: ViewRect; | ||
droppableRects: LayoutRectMap; | ||
over: { | ||
id: UniqueIdentifier; | ||
rect: LayoutRect; | ||
} | null; | ||
} | ||
export interface DragOverEvent { | ||
active: Active; | ||
draggingRect: ViewRect; | ||
droppableRects: LayoutRectMap; | ||
over: { | ||
id: UniqueIdentifier; | ||
rect: LayoutRect; | ||
} | null; | ||
} | ||
export interface DragEndEvent { | ||
active: Active; | ||
delta: Translate; | ||
over: { | ||
id: UniqueIdentifier; | ||
} | null; | ||
} | ||
export interface DragCancelEvent extends DragEndEvent { | ||
} | ||
export interface CancelDropArguments extends DragEndEvent { | ||
} | ||
export declare type CancelDrop = (args: CancelDropArguments) => boolean | Promise<boolean>; | ||
interface Props { | ||
export interface Props { | ||
autoScroll?: boolean | AutoScrollOptions; | ||
@@ -65,4 +26,6 @@ announcements?: Announcements; | ||
} | ||
export interface CancelDropArguments extends DragEndEvent { | ||
} | ||
export declare type CancelDrop = (args: CancelDropArguments) => boolean | Promise<boolean>; | ||
export declare const ActiveDraggableContext: React.Context<Transform>; | ||
export declare const DndContext: React.NamedExoticComponent<Props>; | ||
export {}; |
export { ActiveDraggableContext, DndContext } from './DndContext'; | ||
export type { CancelDrop, DragStartEvent, DragMoveEvent, DragOverEvent, DragEndEvent, } from './DndContext'; | ||
export type { CancelDrop } from './DndContext'; |
export { defaultAnnouncements } from './Accessibility'; | ||
export type { Announcements, ScreenReaderInstructions } from './Accessibility'; | ||
export { DndContext } from './DndContext'; | ||
export type { CancelDrop, DragEndEvent, DragOverEvent, DragMoveEvent, DragStartEvent, } from './DndContext'; | ||
export type { CancelDrop } from './DndContext'; | ||
export { DragOverlay, defaultDropAnimation } from './DragOverlay'; | ||
export type { DropAnimation, Props as DragOverlayProps } from './DragOverlay'; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-dom"),i=require("@dnd-kit/utilities"),a=require("@dnd-kit/accessibility"),c={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},u={onDragStart:function(e){return"Picked up draggable item "+e+"."},onDragOver:function(e,t){return t?"Draggable item "+e+" was moved over droppable area "+t+".":"Draggable item "+e+" is no longer over a droppable area."},onDragEnd:function(e,t){return t?"Draggable item "+e+" was dropped over droppable area "+t:"Draggable item "+e+" was dropped."},onDragCancel:function(e){return"Dragging was cancelled. Draggable item "+e+" was dropped."}};!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(t||(t={}));var l=function(e){return s(e,(function(e,t){return e<t}))};function s(e,t){if(0===e.length)return-1;for(var r=e[0],n=0,o=1;o<e.length;o++)t(e[o],r)&&(n=o,r=e[o]);return n}function d(){}function f(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function p(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return g(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}function m(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var b=r.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:d,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,overlayNode:{nodeRef:{current:null},rect:null,setRef:d},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:d,windowRect:null,willRecomputeLayouts:!1}),x=Object.freeze({x:0,y:0});function w(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function E(e){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){var t=e.touches[0];return{x:t.clientX,y:t.clientY}}if(e.changedTouches&&e.changedTouches.length){var r=e.changedTouches[0];return{x:r.clientX,y:r.clientY}}}return function(e){var t;return(null==(t=window)?void 0:t.MouseEvent)&&e instanceof MouseEvent||e.type.includes("mouse")}(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}}function R(e,t){if(e instanceof KeyboardEvent)return"0 0";var r=E(e);return(r.x-t.left)/t.width*100+"% "+(r.y-t.top)/t.height*100+"%"}function D(e,t,r){return void 0===t&&(t=e.offsetLeft),void 0===r&&(r=e.offsetTop),{x:t+.5*e.width,y:r+.5*e.height}}function C(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((function(t,r){return v({},t,{top:t.top+e*r.y,bottom:t.bottom+e*r.y,left:t.left+e*r.x,right:t.right+e*r.x,offsetLeft:t.offsetLeft+e*r.x,offsetTop:t.offsetTop+e*r.y})}),v({},t))}}var L,S=C(1);function M(e){var t=[];return e?function e(r){return r?r instanceof Document&&null!=r.scrollingElement?(t.push(r.scrollingElement),t):!(r instanceof HTMLElement)||r instanceof SVGElement?t:(function(e){var t=window.getComputedStyle(e),r=/(auto|scroll)/;return null!=["overflow","overflowX","overflowY"].find((function(e){var n=t[e];return"string"==typeof n&&r.test(n)}))}(r)&&t.push(r),e(r.parentNode)):t}(e.parentNode):t}function N(e){return i.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function T(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}function A(e){var t={x:0,y:0},r={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(L||(L={}));var O={x:.2,y:.2};function I(e,t,r,n,o){var a=r.top,c=r.left,u=r.right,l=r.bottom;void 0===n&&(n=10),void 0===o&&(o=O);var s,d=e.clientHeight,f=e.clientWidth,v=(s=e,i.canUseDOM&&s&&s===document.scrollingElement?{top:0,left:0,right:f,bottom:d,width:f,height:d}:t),h=A(e),p=h.isBottom,g=h.isLeft,y=h.isRight,m={x:0,y:0},b={x:0,y:0},x=v.height*o.y,w=v.width*o.x;return!h.isTop&&a<=v.top+x?(m.y=L.Backward,b.y=n*Math.abs((v.top+x-a)/x)):!p&&l>=v.bottom-x&&(m.y=L.Forward,b.y=n*Math.abs((v.bottom-x-l)/x)),!y&&u>=v.right-w?(m.x=L.Forward,b.x=n*Math.abs((v.right-w-u)/w)):!g&&c<=v.left+w&&(m.x=L.Backward,b.x=n*Math.abs((v.left+w-c)/w)),{direction:m,speed:b}}function K(e){if(e===document.scrollingElement){var t=window,r=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:r,bottom:n,width:r,height:n}}var o=e.getBoundingClientRect();return{top:o.top,left:o.left,right:o.right,bottom:o.bottom,width:e.clientWidth,height:e.clientHeight}}function k(e){return e.reduce((function(e,t){return i.add(e,T(t))}),x)}function j(e){var t=e.offsetWidth,r=e.offsetHeight,n=function e(t,r,n){if(void 0===n&&(n=x),!(t&&t instanceof HTMLElement))return n;var o={x:n.x+t.offsetLeft,y:n.y+t.offsetTop};return t.offsetParent===r?o:e(t.offsetParent,r,o)}(e,null);return{width:t,height:r,offsetTop:n.y,offsetLeft:n.x}}function B(e){if(e instanceof Window){var t=window.innerWidth,r=window.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r,offsetTop:0,offsetLeft:0}}var n=j(e),o=n.offsetTop,i=n.offsetLeft,a=e.getBoundingClientRect();return{width:a.width,height:a.height,top:a.top,bottom:a.bottom,right:a.right,left:a.left,offsetTop:o,offsetLeft:i}}function P(e){var t=j(e),r=t.width,n=t.height,o=t.offsetTop,i=t.offsetLeft,a=k(M(e)),c=o-a.y,u=i-a.x;return{width:r,height:n,top:c,bottom:c+n,right:u+r,left:u,offsetTop:o,offsetLeft:i}}function _(e){return"top"in e}function F(e,t,r){return void 0===t&&(t=e.offsetLeft),void 0===r&&(r=e.offsetTop),[{x:t,y:r},{x:t+e.width,y:r},{x:t,y:r+e.height},{x:t+e.width,y:r+e.height}]}var q=function(e,t){var r=e.map((function(e){return function(e,t){var r=Math.max(t.top,e.offsetTop),n=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),i=Math.min(t.top+t.height,e.offsetTop+e.height);if(n<o&&r<i){var a=(o-n)*(i-r);return Number((a/(t.width*t.height+e.width*e.height-a)).toFixed(4))}return 0}(e[1],t)})),n=s(r,(function(e,t){return e>t}));return r[n]<=0?null:e[n]?e[n][0]:null};function H(e){return e instanceof HTMLElement?e.ownerDocument:document}function U(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},lastEvent:null,nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function z(e,r){switch(r.type){case t.DragStart:return v({},e,{draggable:v({},e.draggable,{initialCoordinates:r.initialCoordinates,active:r.active,lastEvent:t.DragStart})});case t.DragMove:return e.draggable.active?v({},e,{draggable:v({},e.draggable,{translate:{x:r.coordinates.x-e.draggable.initialCoordinates.x,y:r.coordinates.y-e.draggable.initialCoordinates.y}})}):e;case t.DragEnd:case t.DragCancel:return v({},e,{draggable:v({},e.draggable,{active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0},lastEvent:r.type})});case t.RegisterDroppable:var n,o=r.element;return v({},e,{droppable:v({},e.droppable,{containers:v({},e.droppable.containers,(n={},n[o.id]=o,n))})});case t.SetDroppableDisabled:var i,a=r.id,c=e.droppable.containers[a];return c?v({},e,{droppable:v({},e.droppable,{containers:v({},e.droppable.containers,(i={},i[a]=v({},c,{disabled:r.disabled}),i))})}):e;case t.UnregisterDroppable:return v({},e,{droppable:v({},e.droppable,{containers:(u=r.id,l=e.droppable.containers,p(l,[u].map(m)))})});default:return e}var u,l}function W(e){var c=e.announcements,l=void 0===c?u:c,s=e.activeId,d=e.overId,f=e.lastEvent,v=e.hiddenTextDescribedById,h=e.screenReaderInstructions,p=a.useAnnouncement(),g=p.announce,y=p.announcement,m=r.useRef({activeId:s,overId:d}),b=i.useUniqueId("DndLiveRegion");return r.useEffect((function(){var e,r=m.current,n=r.activeId,o=r.overId;!n&&s?e=l.onDragStart(s):!s&&n?f===t.DragEnd?e=l.onDragEnd(n,null!=o?o:void 0):f===t.DragCancel&&(e=l.onDragCancel(n)):s&&n&&d!==o&&(e=l.onDragOver(s,null!=d?d:void 0)),e&&g(e),m.current.overId===d&&m.current.activeId===s||(m.current={activeId:s,overId:d})}),[l,g,s,d,f]),i.canUseDOM?o.createPortal(n.createElement(n.Fragment,null,n.createElement(a.HiddenText,{id:v,value:h.draggable}),n.createElement(a.LiveRegion,{id:b,announcement:y})),document.body):null}function Y(e,t){return e(t={exports:{}},t.exports),t.exports}var X,G,V,J=Y((function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new R(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===s)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===s)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,i),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var s={};function d(){}function f(){}function v(){}var h={};h[o]=function(){return this};var p=Object.getPrototypeOf,g=p&&p(p(D([])));g&&g!==t&&r.call(g,o)&&(h=g);var y=v.prototype=d.prototype=Object.create(h);function m(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,c){var u=l(e[o],e,i);if("throw"!==u.type){var s=u.arg,d=s.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(d).then((function(e){s.value=e,a(s)}),(function(e){return n("throw",e,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,s;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function D(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return f.prototype=y.constructor=v,v.constructor=f,f.displayName=c(v,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},m(b.prototype),b.prototype[i]=function(){return this},e.AsyncIterator=b,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new b(u(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(y),c(y,a,"Generator"),y[o]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=D,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:D(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));(X=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[X.Pointer=0]="Pointer",X[X.DraggableRect=1]="DraggableRect",(G=exports.TraversalOrder||(exports.TraversalOrder={}))[G.TreeOrder=0]="TreeOrder",G[G.ReversedTreeOrder=1]="ReversedTreeOrder",(V=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[V.Always=0]="Always",V[V.BeforeDragging=1]="BeforeDragging",V[V.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";var $=new Map,Q={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},Z=[],ee=ne(B),te=oe(B),re=ne(P);function ne(e){return function(t,n){var o=r.useRef(t);return i.useLazyMemo((function(r){return t?n||!r&&t||t!==o.current?t instanceof HTMLElement&&null==t.parentNode?null:e(t):null!=r?r:null:null}),[t,n])}}function oe(e){var t=[];return function(n,o){var a=r.useRef(n);return i.useLazyMemo((function(r){return n.length?o||!r&&n.length||n!==a.current?n.map((function(t){return e(t)})):null!=r?r:t:t}),[n,o])}}var ie,ae=function(){function e(e){this.target=e,this.listeners=[]}var t=e.prototype;return t.add=function(e,t,r){this.target.addEventListener(e,t,r),this.listeners.push({eventName:e,handler:t})},t.removeAll=function(){var e=this;this.listeners.forEach((function(t){return e.target.removeEventListener(t.eventName,t.handler)}))},e}();function ce(e,t){var r=Math.abs(e.x),n=Math.abs(e.y);return"number"==typeof t?Math.sqrt(Math.pow(r,2)+Math.pow(n,2))>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t&&n>t.y}(ie=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ie.Down="ArrowDown",ie.Right="ArrowRight",ie.Left="ArrowLeft",ie.Up="ArrowUp",ie.Esc="Escape",ie.Enter="Enter";var ue,le={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},se=function(e,t){var r=t.currentCoordinates;switch(e.code){case exports.KeyboardCode.Right:return v({},r,{x:r.x+25});case exports.KeyboardCode.Left:return v({},r,{x:r.x-25});case exports.KeyboardCode.Down:return v({},r,{y:r.y+25});case exports.KeyboardCode.Up:return v({},r,{y:r.y-25})}},de=function(){function e(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=x;var t=e.event.target;this.props=e,this.listeners=new ae(H(t)),this.windowListeners=new ae(function(e){var t;return null!=(t=H(e).defaultView)?t:window}(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}var t=e.prototype;return t.attach=function(){var e=this;this.handleStart(),setTimeout((function(){e.listeners.add("keydown",e.handleKeyDown),e.windowListeners.add("resize",e.handleCancel)}))},t.handleStart=function(){var e=this.props,t=e.activeNode,r=e.onStart;if(!t.current)throw new Error("Active draggable node is undefined");var n=B(t.current),o={x:n.left,y:n.top};this.coordinates=o,r(o)},t.handleKeyDown=function(e){if(e instanceof KeyboardEvent){var t=this.coordinates,r=this.props,n=r.active,o=r.context,a=r.options,c=a.keyboardCodes,u=void 0===c?le:c,l=a.coordinateGetter,s=void 0===l?se:l,d=a.scrollBehavior,f=void 0===d?"smooth":d,v=e.code;if(u.end.includes(v))return void this.handleEnd(e);if(u.cancel.includes(v))return void this.handleCancel(e);var h=s(e,{active:n,context:o.current,currentCoordinates:t});if(h){for(var p,g={x:0,y:0},m=y(o.current.scrollableAncestors);!(p=m()).done;){var b=p.value,x=e.code,w=i.subtract(h,t),E=A(b),R=E.isTop,D=E.isRight,C=E.isLeft,L=E.isBottom,S=E.maxScroll,M=E.minScroll,N=K(b),T={x:Math.min(x===exports.KeyboardCode.Right?N.right-N.width/2:N.right,Math.max(x===exports.KeyboardCode.Right?N.left:N.left+N.width/2,h.x)),y:Math.min(x===exports.KeyboardCode.Down?N.bottom-N.height/2:N.bottom,Math.max(x===exports.KeyboardCode.Down?N.top:N.top+N.height/2,h.y))},O=x===exports.KeyboardCode.Right&&!D||x===exports.KeyboardCode.Left&&!C,I=x===exports.KeyboardCode.Down&&!L||x===exports.KeyboardCode.Up&&!R;if(O&&T.x!==h.x){if(x===exports.KeyboardCode.Right&&b.scrollLeft+w.x<=S.x||x===exports.KeyboardCode.Left&&b.scrollLeft+w.x>=M.x)return void b.scrollBy({left:w.x,behavior:f});g.x=x===exports.KeyboardCode.Right?b.scrollLeft-S.x:b.scrollLeft-M.x,b.scrollBy({left:-g.x,behavior:f});break}if(I&&T.y!==h.y){if(x===exports.KeyboardCode.Down&&b.scrollTop+w.y<=S.y||x===exports.KeyboardCode.Up&&b.scrollTop+w.y>=M.y)return void b.scrollBy({top:w.y,behavior:f});g.y=x===exports.KeyboardCode.Down?b.scrollTop-S.y:b.scrollTop-M.y,b.scrollBy({top:-g.y,behavior:f});break}}this.handleMove(e,i.add(h,g))}}},t.handleMove=function(e,t){var r=this.props.onMove;e.preventDefault(),r(t),this.coordinates=t},t.handleEnd=function(e){var t=this.props.onEnd;e.preventDefault(),this.detach(),t()},t.handleCancel=function(e){var t=this.props.onCancel;e.preventDefault(),this.detach(),t()},t.detach=function(){this.listeners.removeAll(),this.windowListeners.removeAll()},e}();function fe(e){return Boolean(e&&"distance"in e)}function ve(e){return Boolean(e&&"delay"in e)}de.activators=[{eventName:"onKeyDown",handler:function(e,t){var r=t.keyboardCodes,n=t.onActivation;return!!(void 0===r?le:r).start.includes(e.nativeEvent.code)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}],function(e){e.Keydown="keydown"}(ue||(ue={}));var he=function(){function e(e,t,r){var n;void 0===r&&(r=(n=e.event.target)instanceof HTMLElement?n:H(n)),this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;var o=e.event;this.props=e,this.events=t,this.ownerDocument=H(o.target),this.listeners=new ae(r),this.initialCoordinates=E(o),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.attach()}var t=e.prototype;return t.attach=function(){var e=this.events,t=this.props.options.activationConstraint;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(ue.Keydown,this.handleKeydown),t){if(fe(t))return;if(ve(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()},t.detach=function(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(ue.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)},t.handleStart=function(){var e=this.initialCoordinates,t=this.props.onStart;e&&(this.activated=!0,t(e))},t.handleMove=function(e){var t=this.activated,r=this.initialCoordinates,n=this.props,o=n.onMove,a=n.options.activationConstraint;if(r){var c=E(e),u=i.subtract(r,c);if(!t&&a){if(ve(a))return ce(u,a.tolerance)?this.handleCancel():void 0;if(fe(a))return ce(u,a.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),o(c)}},t.handleEnd=function(){var e=this.props.onEnd;this.detach(),e()},t.handleCancel=function(){var e=this.props.onCancel;this.detach(),e()},t.handleKeydown=function(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()},e}(),pe={move:{name:"pointermove"},end:{name:"pointerup"}},ge=function(e){function t(t){var r=H(t.event.target);return e.call(this,t,pe,r)||this}return h(t,e),t}(he);ge.activators=[{eventName:"onPointerDown",handler:function(e,t){var r=e.nativeEvent,n=t.onActivation;return!(!r.isPrimary||0!==r.button||(null==n||n({event:r}),0))}}];var ye,me={move:{name:"mousemove"},end:{name:"mouseup"}};!function(e){e[e.RightClick=2]="RightClick"}(ye||(ye={}));var be=function(e){function t(t){return e.call(this,t,me,H(t.event.target))||this}return h(t,e),t}(he);be.activators=[{eventName:"onMouseDown",handler:function(e,t){var r=e.nativeEvent,n=t.onActivation;return r.button!==ye.RightClick&&(null==n||n({event:r}),!0)}}];var xe={move:{name:"touchmove"},end:{name:"touchend"}},we=function(e){function t(t){return e.call(this,t,xe)||this}return h(t,e),t}(he);function Ee(e,t){var r=t.transform,n=p(t,["transform"]);return(null==e?void 0:e.length)?e.reduce((function(e,t){return t(v({transform:e},n))}),r):r}we.activators=[{eventName:"onTouchStart",handler:function(e,t){var r=e.nativeEvent,n=t.onActivation;return!(r.touches.length>1||(null==n||n({event:r}),0))}}];var Re=[{sensor:ge,options:{}},{sensor:de,options:{}}],De=r.createContext(v({},x,{scaleX:1,scaleY:1})),Ce=r.memo((function(e){var o,a,u,l,s,d,h=e.autoScroll,g=void 0===h||h,m=e.announcements,w=e.children,R=e.sensors,D=void 0===R?Re:R,C=e.collisionDetection,L=void 0===C?q:C,A=e.layoutMeasuring,O=e.modifiers,K=e.screenReaderInstructions,B=void 0===K?c:K,P=p(e,["autoScroll","announcements","children","sensors","collisionDetection","layoutMeasuring","modifiers","screenReaderInstructions"]),_=r.useReducer(z,void 0,U),F=_[0],H=_[1],Y=F.draggable,X=Y.active,G=Y.lastEvent,V=Y.nodes,ne=Y.translate,oe=F.droppable.containers,ie=r.useRef(null),ae=r.useState(null),ce=ae[0],ue=ae[1],le=r.useState(null),se=le[0],de=le[1],fe=r.useRef(P),ve=i.useUniqueId("DndDescribedBy"),he=function(e,t){var n,o=t.dragging,a=t.dependencies,c=t.config,u=r.useState(!1),l=u[0],s=u[1],d=(n=c)?v({},Q,n):Q,f=d.frequency,h=d.strategy,p=r.useRef(e),g=r.useCallback((function(){return s(!0)}),[]),y=r.useRef(null),m=function(){switch(h){case exports.LayoutMeasuringStrategy.Always:return!1;case exports.LayoutMeasuringStrategy.BeforeDragging:return o;default:return!o}}(),b=i.useLazyMemo((function(t){if(m&&!o)return $;if(!t||t===$||p.current!==e||l){for(var r=0,n=Object.values(e);r<n.length;r++){var i=n[r];i&&(i.rect.current=i.node.current?j(i.node.current):null)}return function(e){var t=new Map;if(e)for(var r=0,n=Object.values(e);r<n.length;r++){var o=n[r];if(o){var i=o.rect;o.disabled||null==i.current||t.set(o.id,i.current)}}return t}(e)}return t}),[e,o,m,l]);return r.useEffect((function(){p.current=e}),[e]),r.useEffect((function(){l&&s(!1)}),[l]),r.useEffect((function(){m||requestAnimationFrame(g)}),[o,m]),r.useEffect((function(){m||"number"!=typeof f||null!==y.current||(y.current=setTimeout((function(){g(),y.current=null}),f))}),[f,m,g].concat(a)),{layoutRectMap:b,recomputeLayouts:g,willRecomputeLayouts:l}}(oe,{dragging:null!=X,dependencies:[ne.x,ne.y],config:A}),pe=he.layoutRectMap,ge=he.recomputeLayouts,ye=he.willRecomputeLayouts,me=function(e,t){return i.useLazyMemo((function(r){var n,o;return null===t?null:null!=(n=null!=(o=null==e?void 0:e.current)?o:r)?n:null}),[e,t])}(function(e,t){var r;return e&&null!=(r=t[e])?r:null}(X,V),X),be=se?E(se):null,xe=re(me),we=ee(me),Ce=r.useRef(null),Se=(a=Ce.current,(o=xe)&&a?{x:o.left-a.left,y:o.top-a.top}:x),Me=r.useRef({active:X,droppableRects:pe,overId:null,scrollAdjustedTransalte:x,translatedRect:null}),Ne=function(e,t){var r,n;return e&&null!=(r=null==(n=t[e])?void 0:n.node.current)?r:null}(Me.current.overId,oe),Te=ee(me?me.ownerDocument.defaultView:null),Ae=ee(me?me.parentElement:null),Oe=(l=r.useRef(u=X?null!=Ne?Ne:me:null),s=i.useLazyMemo((function(e){return u?e&&u&&l.current&&u.parentNode===l.current.parentNode?e:M(u):Z}),[u]),r.useEffect((function(){l.current=u}),[u]),s),Ie=te(Oe),Ke=i.useNodeRef(),ke=Ke[0],je=Ke[1],Be=ee(X?ke.current:null,ye),Pe=Ee(O,{transform:{x:ne.x-Se.x,y:ne.y-Se.y,scaleX:1,scaleY:1},activeNodeRect:we,draggingNodeRect:null!=Be?Be:we,containerNodeRect:Ae,overlayNodeRect:Be,scrollableAncestors:Oe,scrollableAncestorRects:Ie,windowRect:Te}),_e=be?i.add(be,ne):null,Fe=function(e){var t=r.useState(null),n=t[0],o=t[1],a=r.useRef(e),c=r.useCallback((function(e){var t=N(e.target);t&&o((function(e){return e?(e.set(t,T(t)),new Map(e)):null}))}),[]);return r.useEffect((function(){var t=a.current;if(e!==t){n(t);var r=e.map((function(e){var t=N(e);return t?(t.addEventListener("scroll",c,{passive:!0}),[t,T(t)]):null})).filter((function(e){return null!=e}));o(r.length?new Map(r):null),a.current=e}return function(){n(e),n(t)};function n(e){e.forEach((function(e){var t=N(e);null==t||t.removeEventListener("scroll",c)}))}}),[c,e]),r.useMemo((function(){return e.length?n?Array.from(n.values()).reduce((function(e,t){return i.add(e,t)}),x):k(e):x}),[e,n])}(Oe),qe=i.add(Pe,Fe),He=xe?S(xe,Pe):null,Ue=He?S(He,Fe):null,ze=X&&Ue?L(Array.from(pe.entries()),Ue):null,We=Le(ze,pe),Ye=r.useMemo((function(){return ze&&We?{id:ze,rect:We}:null}),[ze,We]),Xe=function(e,t,r){return v({},e,{scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1})}(Pe,We,xe),Ge=r.useRef({activeNode:me,collisionRect:Ue,droppableRects:pe,droppableContainers:oe,over:Ye,scrollableAncestors:Oe,translatedRect:He}),Ve=r.useCallback((function(e,r){if(ie.current){var n=V[ie.current];if(n){var o=new(0,r.sensor)({active:ie.current,activeNode:n,event:e.nativeEvent,options:r.options,context:Ge,onStart:function(e){var r=ie.current;if(r){var n=fe.current.onDragStart;H({type:t.DragStart,initialCoordinates:e,active:r}),null==n||n({active:{id:r}})}},onMove:function(e){H({type:t.DragMove,coordinates:e})},onEnd:i(t.DragEnd),onCancel:i(t.DragCancel)});ue(o),de(e.nativeEvent)}}function i(e){return function(){var r,n=(r=J.mark((function r(){var n,o,i,a,c,u,l,s,d;return J.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=ie.current){r.next=3;break}return r.abrupt("return");case 3:if(a=fe.current.cancelDrop,c={active:{id:n},delta:(o=Me.current).scrollAdjustedTransalte,over:(i=o.overId)?{id:i}:null},ie.current=null,e!==t.DragEnd||"function"!=typeof a){r.next=12;break}return r.next=10,Promise.resolve(a(c));case 10:r.sent&&(e=t.DragCancel);case 12:H({type:e}),ue(null),de(null),l=(u=fe.current).onDragCancel,s=u.onDragEnd,d=e===t.DragEnd?s:l,n&&(null==d||d(c));case 18:case"end":return r.stop()}}),r)})),function(){var e=this,t=arguments;return new Promise((function(n,o){var i=r.apply(e,t);function a(e){f(i,n,o,a,c,"next",e)}function c(e){f(i,n,o,a,c,"throw",e)}a(void 0)}))});return function(){return n.apply(this,arguments)}}()}}),[H,V]),Je=function(e,t){return r.useMemo((function(){return e.reduce((function(e,r){var n=r.sensor.activators.map((function(e){return{eventName:e.eventName,handler:t(e.handler,r)}}));return[].concat(e,n)}),[])}),[e,t])}(D,r.useCallback((function(e,t){return function(r,n){var o=r.nativeEvent;null!==ie.current||o.dndKit||o.defaultPrevented||!0===e(r,t.options)&&(o.dndKit={capturedBy:t.sensor},ie.current=n,Ve(r,t))}}),[Ve]));i.useIsomorphicLayoutEffect((function(){fe.current=P}),Object.values(P)),r.useEffect((function(){X||(Ce.current=null),X&&xe&&!Ce.current&&(Ce.current=xe)}),[xe,X]),r.useEffect((function(){var e=ie.current;if(e){var t=fe.current.onDragMove,r=Me.current,n=r.overId,o=r.droppableRects,i=r.translatedRect;if(t&&i){var a=Le(n,o);t({active:{id:e},draggingRect:i,droppableRects:o,delta:{x:qe.x,y:qe.y},over:n&&a?{id:n,rect:a}:null})}}}),[qe.x,qe.y]),r.useEffect((function(){if(ie.current){var e=Me.current,t=e.active,r=e.translatedRect;if(t&&r){var n=fe.current.onDragOver,o=Le(ze,e.droppableRects);null==n||n({active:{id:t},droppableRects:Me.current.droppableRects,draggingRect:r,over:ze&&o?{id:ze,rect:o}:null})}}}),[ze]),r.useEffect((function(){Me.current={active:X,droppableRects:pe,overId:ze,translatedRect:He,scrollAdjustedTransalte:qe}}),[X,pe,ze,He,qe]),i.useIsomorphicLayoutEffect((function(){Ge.current={activeNode:me,collisionRect:Ue,droppableRects:pe,droppableContainers:oe,over:Ye,scrollableAncestors:Oe,translatedRect:He}}),[me,Ue,pe,oe,Ye,Oe,He]),function(e){var t=e.acceleration,n=e.activator,o=void 0===n?exports.AutoScrollActivator.Pointer:n,a=e.canScroll,c=e.draggingRect,u=e.enabled,l=e.interval,s=void 0===l?5:l,d=e.order,f=void 0===d?exports.TraversalOrder.TreeOrder:d,v=e.pointerCoordinates,h=e.scrollableAncestors,p=e.scrollableAncestorRects,g=e.threshold,m=i.useInterval(),b=m[0],w=m[1],E=r.useRef({x:1,y:1}),R=r.useMemo((function(){switch(o){case exports.AutoScrollActivator.Pointer:return v?{top:v.y,bottom:v.y,left:v.x,right:v.x}:null;case exports.AutoScrollActivator.DraggableRect:return c}return null}),[o,c,v]),D=r.useRef(x),C=r.useRef(null),L=r.useCallback((function(){var e=C.current;e&&e.scrollBy(E.current.x*D.current.x,E.current.y*D.current.y)}),[]),S=r.useMemo((function(){return f===exports.TraversalOrder.TreeOrder?[].concat(h).reverse():h}),[f,h]);r.useEffect((function(){if(u&&h.length&&R){for(var e,r=y(S);!(e=r()).done;){var n=e.value;if(!1!==(null==a?void 0:a(n))){var o=h.indexOf(n),i=p[o];if(i){var c=I(n,i,R,t,g),l=c.direction,d=c.speed;if(d.x>0||d.y>0)return w(),C.current=n,b(L,s),E.current=d,void(D.current=l)}}}E.current={x:0,y:0},D.current={x:0,y:0},w()}else w()}),[t,L,a,w,u,s,JSON.stringify(R),b,h,S,p,JSON.stringify(g)])}(v({},(d=!(!1===(null==ce?void 0:ce.autoScrollEnabled)||("object"==typeof g?!1===g.enabled:!1===g)),"object"==typeof g?v({},g,{enabled:d}):{enabled:d}),{draggingRect:He,pointerCoordinates:_e,scrollableAncestors:Oe,scrollableAncestorRects:Ie}));var $e=r.useMemo((function(){return{active:X,activeNode:me,activeNodeRect:xe,activeNodeClientRect:we,activatorEvent:se,activators:Je,ariaDescribedById:{draggable:ve},overlayNode:{nodeRef:ke,rect:Be,setRef:je},containerNodeRect:Ae,dispatch:H,draggableNodes:V,droppableContainers:oe,droppableRects:pe,over:Ye,recomputeLayouts:ge,scrollableAncestors:Oe,scrollableAncestorRects:Ie,willRecomputeLayouts:ye,windowRect:Te}}),[X,me,we,xe,se,Je,Ae,Be,ke,H,V,ve,oe,pe,Ye,ge,Oe,Ie,je,ye,Te]);return n.createElement(n.Fragment,null,n.createElement(b.Provider,{value:$e},n.createElement(De.Provider,{value:Xe},w)),n.createElement(W,{announcements:m,activeId:X,overId:ze,lastEvent:G,hiddenTextDescribedById:ve,screenReaderInstructions:B}))}));function Le(e,t){var r;return e&&null!=(r=t.get(e))?r:null}var Se=r.createContext(null);function Me(){return r.useContext(b)}var Ne={},Te=function(e){return e instanceof KeyboardEvent?"transform 250ms ease":void 0},Ae={duration:250,easing:"ease",dragSourceOpacity:0},Oe=n.memo((function(e){var t,o=e.adjustScale,a=void 0!==o&&o,c=e.children,u=e.dropAnimation,l=void 0===u?Ae:u,s=e.transition,d=void 0===s?Te:s,f=e.modifiers,h=e.wrapperElement,g=void 0===h?"div":h,y=e.className,m=e.zIndex,b=void 0===m?999:m,x=Me(),w=x.active,E=x.activeNodeRect,D=x.activeNodeClientRect,C=x.containerNodeRect,L=x.draggableNodes,S=x.activatorEvent,M=x.overlayNode,N=x.scrollableAncestors,T=x.scrollableAncestorRects,A=x.windowRect,O=Ee(f,{transform:r.useContext(De),activeNodeRect:D,overlayNodeRect:M.rect,draggingNodeRect:M.rect,containerNodeRect:C,scrollableAncestors:N,scrollableAncestorRects:T,windowRect:A}),I=function(e,t,n){var o=r.useRef(t);return i.useLazyMemo((function(r){var i=o.current;if(t!==i){if(t&&i&&(i.left!==t.left||i.top!==t.top)&&!r){var a=null==n?void 0:n.getBoundingClientRect();if(a)return v({},e,{x:a.left-t.left,y:a.top-t.top})}o.current=t}}),[t,e,n])}(O,E,M.nodeRef.current),K=null!==w,k=null!=I?I:O,j=a?k:v({},k,{scaleX:1,scaleY:1}),B=E?{position:"fixed",width:E.width,height:E.height,top:E.top,left:E.left,zIndex:b,transform:i.CSS.Transform.toString(j),touchAction:"none",transformOrigin:a&&S?R(S,E):void 0,transition:I?void 0:"function"==typeof d?d(S):d}:void 0,_=K?{style:B,children:c,className:y,transform:j}:void 0,F=r.useRef(_),q=null!=_?_:F.current,H=null!=q?q:{},U=H.children,z=p(H,["children","transform"]),W=r.useRef(w),Y=function(e){var t=e.animate,n=e.adjustScale,o=e.activeId,a=e.draggableNodes,c=e.duration,u=e.easing,l=e.dragSourceOpacity,s=e.node,d=e.transform,f=r.useState(!1),h=f[0],p=f[1];return r.useEffect((function(){t&&o&&u&&c?requestAnimationFrame((function(){var e,t=null==(e=a[o])?void 0:e.current;if(d&&s&&t&&null!==t.parentNode){var r=s.children.length>1?s:s.children[0];if(r){var f=r.getBoundingClientRect(),h=P(t),g={x:f.left-h.left,y:f.top-h.top};if(Math.abs(g.x)||Math.abs(g.y)){var y=i.CSS.Transform.toString(v({x:d.x-g.x,y:d.y-g.y},{scaleX:n?h.width*d.scaleX/f.width:1,scaleY:n?h.height*d.scaleY/f.height:1})),m=t.style.opacity;return null!=l&&(t.style.opacity=""+l),void(s.animate([{transform:i.CSS.Transform.toString(d)},{transform:y}],{easing:u,duration:c}).onfinish=function(){p(!0),t&&null!=l&&(t.style.opacity=m)})}}}p(!0)})):t&&p(!0)}),[t,o,n,a,c,u,l,s,d]),i.useIsomorphicLayoutEffect((function(){h&&p(!1)}),[h]),h}({animate:Boolean(l&&W.current&&!w),adjustScale:a,activeId:W.current,draggableNodes:L,duration:null==l?void 0:l.duration,easing:null==l?void 0:l.easing,dragSourceOpacity:null==l?void 0:l.dragSourceOpacity,node:M.nodeRef.current,transform:null==(t=F.current)?void 0:t.transform}),X=Boolean(U&&(c||l&&!Y));return r.useEffect((function(){W.current!==w&&(W.current=w),w&&F.current!==_&&(F.current=_)}),[w,_]),r.useEffect((function(){Y&&(F.current=void 0)}),[Y]),X?n.createElement(g,v({},z,{ref:M.setRef}),U):null}));exports.DndContext=Ce,exports.DragOverlay=Oe,exports.KeyboardSensor=de,exports.MouseSensor=be,exports.PointerSensor=ge,exports.TouchSensor=we,exports.applyModifiers=Ee,exports.closestCenter=function(e,t){var r=D(t,t.left,t.top),n=e.map((function(e){return w(D(e[1]),r)})),o=l(n);return e[o]?e[o][0]:null},exports.closestCorners=function(e,t){var r=F(t,t.left,t.top),n=e.map((function(e){var t=e[1],n=F(t,_(t)?t.left:void 0,_(t)?t.top:void 0),o=r.reduce((function(e,t,r){return e+w(n[r],t)}),0);return Number((o/4).toFixed(4))})),o=l(n);return e[o]?e[o][0]:null},exports.defaultAnnouncements=u,exports.defaultCoordinates=x,exports.defaultDropAnimation=Ae,exports.getBoundingClientRect=B,exports.getScrollableAncestors=M,exports.getViewRect=P,exports.rectIntersection=q,exports.useDndContext=Me,exports.useDraggable=function(e){var t=e.id,n=e.disabled,o=void 0!==n&&n,a=e.attributes,c=r.useContext(b),u=c.active,l=c.activeNodeRect,s=c.activatorEvent,d=c.ariaDescribedById,f=c.draggableNodes,v=c.droppableRects,h=c.activators,p=c.over,g=null!=a?a:{},y=g.role,m=void 0===y?"button":y,x=g.roleDescription,w=void 0===x?"draggable":x,E=g.tabIndex,R=void 0===E?0:E,D=Boolean(u===t),C=r.useContext(D?De:Se),L=i.useNodeRef(),S=L[0],M=L[1],N=function(e,t){return r.useMemo((function(){return e.reduce((function(e,r){var n=r.handler;return e[r.eventName]=function(e){n(e,t)},e}),{})}),[e,t])}(h,t);return r.useEffect((function(){return f[t]=S,function(){delete f[t]}}),[f,t]),{active:u,activeNodeRect:l,activatorEvent:s,attributes:r.useMemo((function(){return{role:m,tabIndex:R,"aria-pressed":!(!D||"button"!==m)||void 0,"aria-roledescription":w,"aria-describedby":d.draggable}}),[m,R,D,w,d.draggable]),droppableRects:v,isDragging:D,listeners:o?void 0:N,node:S,over:p,setNodeRef:M,transform:C}},exports.useDroppable=function(e){var n=e.data,o=void 0===n?Ne:n,a=e.disabled,c=void 0!==a&&a,u=e.id,l=r.useContext(b),s=l.dispatch,d=l.over,f=r.useRef(null),v=i.useNodeRef(),h=v[0],p=v[1],g=r.useRef(o);return i.useIsomorphicLayoutEffect((function(){g.current!==o&&(g.current=o)}),[o]),i.useIsomorphicLayoutEffect((function(){return s({type:t.RegisterDroppable,element:{id:u,disabled:c,node:h,rect:f,data:g}}),function(){return s({type:t.UnregisterDroppable,id:u})}}),[u]),r.useEffect((function(){s({type:t.SetDroppableDisabled,id:u,disabled:c})}),[c]),{rect:f,isOver:(null==d?void 0:d.id)===u,node:h,over:d,setNodeRef:p}},exports.useSensor=function(e,t){return r.useMemo((function(){return{sensor:e,options:null!=t?t:{}}}),[e,t])},exports.useSensors=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.useMemo((function(){return[].concat(t).filter((function(e){return null!=e}))}),[].concat(t))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("react-dom"),o=require("@dnd-kit/utilities"),a=require("@dnd-kit/accessibility");const s={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},i={onDragStart:e=>`Picked up draggable item ${e}.`,onDragOver:(e,t)=>t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`,onDragEnd:(e,t)=>t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`,onDragCancel:e=>`Dragging was cancelled. Draggable item ${e} was dropped.`};var l;!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(l||(l={}));const c=e=>u(e,(e,t)=>e<t);function u(e,t){if(0===e.length)return-1;let n=e[0],r=0;for(var o=1;o<e.length;o++)t(e[o],n)&&(r=o,n=e[o]);return r}function d(...e){}function f(e,t){const{[e]:n,...r}=t;return r}const p=t.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:d,draggableNodes:{},droppableRects:new Map,droppableContainers:{},over:null,overlayNode:{nodeRef:{current:null},rect:null,setRef:d},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:d,windowRect:null,willRecomputeLayouts:!1}),h=Object.freeze({x:0,y:0});function g(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v(e){if(function(e){var t;return(null==(t=window)?void 0:t.TouchEvent)&&e instanceof TouchEvent}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){var t;return(null==(t=window)?void 0:t.MouseEvent)&&e instanceof MouseEvent||e.type.includes("mouse")}(e)?{x:e.clientX,y:e.clientY}:{x:0,y:0}}function y(e,t){if(e instanceof KeyboardEvent)return"0 0";const n=v(e);return`${(n.x-t.left)/t.width*100}% ${(n.y-t.top)/t.height*100}%`}function b(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+.5*e.width,y:n+.5*e.height}}function m(e){return function(t,...n){return n.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x,offsetLeft:t.offsetLeft+e*n.x,offsetTop:t.offsetTop+e*n.y}),{...t})}}const x=m(1);function w(e){const t=[];return e?function e(n){return n?n instanceof Document&&null!=n.scrollingElement?(t.push(n.scrollingElement),t):!(n instanceof HTMLElement)||n instanceof SVGElement?t:(function(e){const t=window.getComputedStyle(e),n=/(auto|scroll)/;return null!=["overflow","overflowX","overflowY"].find(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(n)&&t.push(n),e(n.parentNode)):t}(e.parentNode):t}function D(e){return o.canUseDOM?e===document.scrollingElement||e instanceof Document?window:e instanceof HTMLElement?e:null:null}function R(e){return e instanceof Window?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var C;function E(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(C||(C={}));const M={x:.2,y:.2};function S(e,t,{top:n,left:r,right:a,bottom:s},i=10,l=M){const{clientHeight:c,clientWidth:u}=e,d=(f=e,o.canUseDOM&&f&&f===document.scrollingElement?{top:0,left:0,right:u,bottom:c,width:u,height:c}:t);var f;const{isTop:p,isBottom:h,isLeft:g,isRight:v}=E(e),y={x:0,y:0},b={x:0,y:0},m=d.height*l.y,x=d.width*l.x;return!p&&n<=d.top+m?(y.y=C.Backward,b.y=i*Math.abs((d.top+m-n)/m)):!h&&s>=d.bottom-m&&(y.y=C.Forward,b.y=i*Math.abs((d.bottom-m-s)/m)),!v&&a>=d.right-x?(y.x=C.Forward,b.x=i*Math.abs((d.right-x-a)/x)):!g&&r<=d.left+x&&(y.x=C.Backward,b.x=i*Math.abs((d.left+x-r)/x)),{direction:y,speed:b}}function L(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function N(e){return e.reduce((e,t)=>o.add(e,R(t)),h)}function T(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=function e(t,n,r=h){if(!(t&&t instanceof HTMLElement))return r;const o={x:r.x+t.offsetLeft,y:r.y+t.offsetTop};return t.offsetParent===n?o:e(t.offsetParent,n,o)}(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function A(e){if(e instanceof Window){const e=window.innerWidth,t=window.innerHeight;return{top:0,left:0,right:e,bottom:t,width:e,height:t,offsetTop:0,offsetLeft:0}}const{offsetTop:t,offsetLeft:n}=T(e),{width:r,height:o,top:a,bottom:s,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:a,bottom:s,right:l,left:i,offsetTop:t,offsetLeft:n}}function K(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=T(e),a=N(w(e)),s=r-a.y,i=o-a.x;return{width:t,height:n,top:s,bottom:s+n,right:i+t,left:i,offsetTop:r,offsetLeft:o}}function O(e){return"top"in e}function B(e,t=e.offsetLeft,n=e.offsetTop){return[{x:t,y:n},{x:t+e.width,y:n},{x:t,y:n+e.height},{x:t+e.width,y:n+e.height}]}const I=(e,t)=>{const n=e.map(([e,n])=>function(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),a=Math.min(t.top+t.height,e.offsetTop+e.height);if(r<o&&n<a){const s=(o-r)*(a-n);return Number((s/(t.width*t.height+e.width*e.height-s)).toFixed(4))}return 0}(n,t)),r=u(n,(e,t)=>e>t);return n[r]<=0?null:e[r]?e[r][0]:null};function k(e){return e instanceof HTMLElement?e.ownerDocument:document}function P(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:{}}}}function j(e,t){switch(t.type){case l.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case l.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case l.DragEnd:case l.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case l.RegisterDroppable:{const{element:n}=t,{id:r}=n;return{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[r]:n}}}}case l.SetDroppableDisabled:{const{id:n,disabled:r}=t,o=e.droppable.containers[n];return o?{...e,droppable:{...e.droppable,containers:{...e.droppable.containers,[n]:{...o,disabled:r}}}}:e}case l.UnregisterDroppable:{const{id:n}=t;return{...e,droppable:{...e.droppable,containers:f(n,e.droppable.containers)}}}default:return e}}const q=t.createContext({type:null,event:null});function H({onDragStart:e,onDragMove:n,onDragOver:r,onDragEnd:o,onDragCancel:a}){const s=t.useContext(q),i=t.useRef(s);t.useEffect(()=>{if(s!==i.current){const{type:t,event:c}=s;switch(t){case l.DragStart:null==e||e(c);break;case l.DragMove:null==n||n(c);break;case l.DragOver:null==r||r(c);break;case l.DragCancel:null==a||a(c);break;case l.DragEnd:null==o||o(c)}i.current=s}},[s,e,n,r,o,a])}function z({announcements:e=i,hiddenTextDescribedById:s,screenReaderInstructions:l}){const{announce:c,announcement:u}=a.useAnnouncement(),d=o.useUniqueId("DndLiveRegion");return H(t.useMemo(()=>({onDragStart({active:t}){c(e.onDragStart(t.id))},onDragOver({active:t,over:n}){c(e.onDragOver(t.id,null==n?void 0:n.id))},onDragEnd({active:t,over:n}){c(e.onDragEnd(t.id,null==n?void 0:n.id))},onDragCancel({active:t}){c(e.onDragCancel(t.id))}}),[c,e])),o.canUseDOM?r.createPortal(n.createElement(n.Fragment,null,n.createElement(a.HiddenText,{id:s,value:l.draggable}),n.createElement(a.LiveRegion,{id:d,announcement:u})),document.body):null}var U,W,F;function X(e){const n=t.useRef(e);return o.useIsomorphicLayoutEffect(()=>{n.current!==e&&(n.current=e)},[e]),n}(U=exports.AutoScrollActivator||(exports.AutoScrollActivator={}))[U.Pointer=0]="Pointer",U[U.DraggableRect=1]="DraggableRect",(W=exports.TraversalOrder||(exports.TraversalOrder={}))[W.TreeOrder=0]="TreeOrder",W[W.ReversedTreeOrder=1]="ReversedTreeOrder",(F=exports.LayoutMeasuringStrategy||(exports.LayoutMeasuringStrategy={}))[F.Always=0]="Always",F[F.BeforeDragging=1]="BeforeDragging",F[F.WhileDragging=2]="WhileDragging",(exports.LayoutMeasuringFrequency||(exports.LayoutMeasuringFrequency={})).Optimized="optimized";const Y=new Map,$={strategy:exports.LayoutMeasuringStrategy.WhileDragging,frequency:exports.LayoutMeasuringFrequency.Optimized},V=[],G=Q(A),J=Z(A),_=Q(K);function Q(e){return function(n,r){const a=t.useRef(n);return o.useLazyMemo(t=>n?r||!t&&n||n!==a.current?n instanceof HTMLElement&&null==n.parentNode?null:e(n):null!=t?t:null:null,[n,r])}}function Z(e){const n=[];return function(r,a){const s=t.useRef(r);return o.useLazyMemo(t=>r.length?a||!t&&r.length||r!==s.current?r.map(t=>e(t)):null!=t?t:n:n,[r,a])}}class ee{constructor(e){this.target=e,this.listeners=[]}add(e,t,n){this.target.addEventListener(e,t,n),this.listeners.push({eventName:e,handler:t})}removeAll(){this.listeners.forEach(({eventName:e,handler:t})=>this.target.removeEventListener(e,t))}}function te(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var ne;(ne=exports.KeyboardCode||(exports.KeyboardCode={})).Space="Space",ne.Down="ArrowDown",ne.Right="ArrowRight",ne.Left="ArrowLeft",ne.Up="ArrowUp",ne.Esc="Escape",ne.Enter="Enter";const re={start:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter],cancel:[exports.KeyboardCode.Esc],end:[exports.KeyboardCode.Space,exports.KeyboardCode.Enter]},oe=(e,{currentCoordinates:t})=>{switch(e.code){case exports.KeyboardCode.Right:return{...t,x:t.x+25};case exports.KeyboardCode.Left:return{...t,x:t.x-25};case exports.KeyboardCode.Down:return{...t,y:t.y+25};case exports.KeyboardCode.Up:return{...t,y:t.y-25}}};class ae{constructor(e){this.props=e,this.autoScrollEnabled=!1,this.coordinates=h;const{event:{target:t}}=e;this.props=e,this.listeners=new ee(k(t)),this.windowListeners=new ee(function(e){var t;return null!=(t=k(e).defaultView)?t:window}(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),setTimeout(()=>{this.listeners.add("keydown",this.handleKeyDown),this.windowListeners.add("resize",this.handleCancel)})}handleStart(){const{activeNode:e,onStart:t}=this.props;if(!e.node.current)throw new Error("Active draggable node is undefined");const n=A(e.node.current),r={x:n.left,y:n.top};this.coordinates=r,t(r)}handleKeyDown(e){if(e instanceof KeyboardEvent){const{coordinates:t}=this,{active:n,context:r,options:a}=this.props,{keyboardCodes:s=re,coordinateGetter:i=oe,scrollBehavior:l="smooth"}=a,{code:c}=e;if(s.end.includes(c))return void this.handleEnd(e);if(s.cancel.includes(c))return void this.handleCancel(e);const u=i(e,{active:n,context:r.current,currentCoordinates:t});if(u){const n={x:0,y:0},{scrollableAncestors:a}=r.current;for(const r of a){const a=e.code,s=o.subtract(u,t),{isTop:i,isRight:c,isLeft:d,isBottom:f,maxScroll:p,minScroll:h}=E(r),g=L(r),v={x:Math.min(a===exports.KeyboardCode.Right?g.right-g.width/2:g.right,Math.max(a===exports.KeyboardCode.Right?g.left:g.left+g.width/2,u.x)),y:Math.min(a===exports.KeyboardCode.Down?g.bottom-g.height/2:g.bottom,Math.max(a===exports.KeyboardCode.Down?g.top:g.top+g.height/2,u.y))},y=a===exports.KeyboardCode.Right&&!c||a===exports.KeyboardCode.Left&&!d,b=a===exports.KeyboardCode.Down&&!f||a===exports.KeyboardCode.Up&&!i;if(y&&v.x!==u.x){if(a===exports.KeyboardCode.Right&&r.scrollLeft+s.x<=p.x||a===exports.KeyboardCode.Left&&r.scrollLeft+s.x>=h.x)return void r.scrollBy({left:s.x,behavior:l});n.x=a===exports.KeyboardCode.Right?r.scrollLeft-p.x:r.scrollLeft-h.x,r.scrollBy({left:-n.x,behavior:l});break}if(b&&v.y!==u.y){if(a===exports.KeyboardCode.Down&&r.scrollTop+s.y<=p.y||a===exports.KeyboardCode.Up&&r.scrollTop+s.y>=h.y)return void r.scrollBy({top:s.y,behavior:l});n.y=a===exports.KeyboardCode.Down?r.scrollTop-p.y:r.scrollTop-h.y,r.scrollBy({top:-n.y,behavior:l});break}}this.handleMove(e,o.add(u,n))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t),this.coordinates=t}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function se(e){return Boolean(e&&"distance"in e)}function ie(e){return Boolean(e&&"delay"in e)}var le;ae.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=re,onActivation:n})=>{const{code:r}=e.nativeEvent;return!!t.start.includes(r)&&(e.preventDefault(),null==n||n({event:e.nativeEvent}),!0)}}],function(e){e.Keydown="keydown"}(le||(le={}));class ce{constructor(e,t,n=function(e){return e instanceof HTMLElement?e:k(e)}(e.event.target)){this.props=e,this.events=t,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=e;this.props=e,this.events=t,this.ownerDocument=k(r.target),this.listeners=new ee(n),this.initialCoordinates=v(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t}}}=this;if(this.listeners.add(e.move.name,this.handleMove,!1),this.listeners.add(e.end.name,this.handleEnd),this.ownerDocument.addEventListener(le.Keydown,this.handleKeydown),t){if(se(t))return;if(ie(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay))}this.handleStart()}detach(){this.listeners.removeAll(),this.ownerDocument.removeEventListener(le.Keydown,this.handleKeydown),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,t(e))}handleMove(e){const{activated:t,initialCoordinates:n,props:r}=this,{onMove:a,options:{activationConstraint:s}}=r;if(!n)return;const i=v(e),l=o.subtract(n,i);if(!t&&s){if(ie(s))return te(l,s.tolerance)?this.handleCancel():void 0;if(se(s))return te(l,s.distance)?this.handleStart():void 0}e.cancelable&&e.preventDefault(),a(i)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===exports.KeyboardCode.Esc&&this.handleCancel()}}const ue={move:{name:"pointermove"},end:{name:"pointerup"}};class de extends ce{constructor(e){const{event:t}=e,n=k(t.target);super(e,ue,n)}}de.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!(!e.isPrimary||0!==e.button||(null==t||t({event:e}),0))}];const fe={move:{name:"mousemove"},end:{name:"mouseup"}};var pe;!function(e){e[e.RightClick=2]="RightClick"}(pe||(pe={}));class he extends ce{constructor(e){super(e,fe,k(e.event.target))}}he.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button!==pe.RightClick&&(null==t||t({event:e}),!0)}];const ge={move:{name:"touchmove"},end:{name:"touchend"}};class ve extends ce{constructor(e){super(e,ge)}}function ye(e,{transform:t,...n}){return(null==e?void 0:e.length)?e.reduce((e,t)=>t({transform:e,...n}),t):t}ve.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return!(n.length>1||(null==t||t({event:e}),0))}}];const be=[{sensor:de,options:{}},{sensor:ae,options:{}}],me={current:{}},xe=t.createContext({...h,scaleX:1,scaleY:1}),we=t.memo((function({autoScroll:e=!0,announcements:r,children:a,sensors:i=be,collisionDetection:c=I,layoutMeasuring:u,modifiers:d,screenReaderInstructions:f=s,...g}){var y,b,m;const C=t.useReducer(j,void 0,P),[E,M]=C,[L,A]=t.useState(()=>({type:null,event:null})),{draggable:{active:K,nodes:O,translate:B},droppable:{containers:k}}=E,H=K?O[K]:null,U=t.useRef({initial:null,translated:null}),W=t.useMemo(()=>{var e;return null!=K?{id:K,data:null!=(e=null==H?void 0:H.data)?e:me,rect:U}:null},[K,H]),F=t.useRef(null),[X,Q]=t.useState(null),[Z,ee]=t.useState(null),te=t.useRef(g),ne=o.useUniqueId("DndDescribedBy"),{layoutRectMap:re,recomputeLayouts:oe,willRecomputeLayouts:ae}=function(e,{dragging:n,dependencies:r,config:a}){const[s,i]=t.useState(!1),{frequency:l,strategy:c}=(u=a)?{...$,...u}:$;var u;const d=t.useRef(e),f=t.useCallback(()=>i(!0),[]),p=t.useRef(null),h=function(){switch(c){case exports.LayoutMeasuringStrategy.Always:return!1;case exports.LayoutMeasuringStrategy.BeforeDragging:return n;default:return!n}}(),g=o.useLazyMemo(t=>{if(h&&!n)return Y;if(!t||t===Y||d.current!==e||s){for(let t of Object.values(e))t&&(t.rect.current=t.node.current?T(t.node.current):null);return function(e){const t=new Map;if(e)for(const n of Object.values(e)){if(!n)continue;const{id:e,rect:r,disabled:o}=n;o||null==r.current||t.set(e,r.current)}return t}(e)}return t},[e,n,h,s]);return t.useEffect(()=>{d.current=e},[e]),t.useEffect(()=>{s&&i(!1)},[s]),t.useEffect((function(){h||requestAnimationFrame(f)}),[n,h]),t.useEffect((function(){h||"number"!=typeof l||null!==p.current||(p.current=setTimeout(()=>{f(),p.current=null},l))}),[l,h,f,...r]),{layoutRectMap:g,recomputeLayouts:f,willRecomputeLayouts:s}}(k,{dragging:null!=K,dependencies:[B.x,B.y],config:u}),se=function(e,t){const n=null!==t?e[t]:void 0,r=n?n.node.current:null;return o.useLazyMemo(e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(O,K),ie=Z?v(Z):null,le=_(se),ce=G(se),ue=t.useRef(null),de=(pe=ue.current,(fe=le)&&pe?{x:fe.left-pe.left,y:fe.top-pe.top}:h);var fe,pe;const he=t.useRef({active:null,activeNode:se,collisionRect:null,droppableRects:re,draggableNodes:O,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTransalte:null,translatedRect:null}),ge=function(e,t){var n,r;return e&&null!=(n=null==(r=t[e])?void 0:r.node.current)?n:null}(null!=(y=null==(b=he.current.over)?void 0:b.id)?y:null,k),ve=G(se?se.ownerDocument.defaultView:null),we=G(se?se.parentElement:null),De=function(e){const n=t.useRef(e),r=o.useLazyMemo(t=>e?t&&e&&n.current&&e.parentNode===n.current.parentNode?t:w(e):V,[e]);return t.useEffect(()=>{n.current=e},[e]),r}(K?null!=ge?ge:se:null),Re=J(De),[Ce,Ee]=o.useNodeRef(),Me=G(K?Ce.current:null,ae),Se=null!=Me?Me:ce,Le=ye(d,{transform:{x:B.x-de.x,y:B.y-de.y,scaleX:1,scaleY:1},active:W,over:he.current.over,activeNodeRect:ce,draggingNodeRect:Se,containerNodeRect:we,overlayNodeRect:Me,scrollableAncestors:De,scrollableAncestorRects:Re,windowRect:ve}),Ne=ie?o.add(ie,B):null,Te=function(e){const[n,r]=t.useState(null),a=t.useRef(e),s=t.useCallback(e=>{const t=D(e.target);t&&r(e=>e?(e.set(t,R(t)),new Map(e)):null)},[]);return t.useEffect(()=>{const t=a.current;if(e!==t){n(t);const o=e.map(e=>{const t=D(e);return t?(t.addEventListener("scroll",s,{passive:!0}),[t,R(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=D(e);null==t||t.removeEventListener("scroll",s)})}},[s,e]),t.useMemo(()=>e.length?n?Array.from(n.values()).reduce((e,t)=>o.add(e,t),h):N(e):h,[e,n])}(De),Ae=o.add(Le,Te),Ke=le?x(le,Le):null,Oe=Ke?x(Ke,Te):null,Be=function(e,t){var n;return e&&null!=(n=t[e])?n:null}(W&&Oe?c(Array.from(re.entries()),Oe):null,k),Ie=t.useMemo(()=>Be&&Be.rect.current?{id:Be.id,rect:Be.rect.current,data:Be.data,disabled:Be.disabled}:null,[Be]),ke=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Le,null!=(m=null==Be?void 0:Be.rect.current)?m:null,le),Pe=t.useCallback((e,{sensor:t,options:n})=>{if(!F.current)return;const r=O[F.current];if(!r)return;const o=new t({active:F.current,activeNode:r,event:e.nativeEvent,options:n,context:he,onStart(e){const t=F.current;if(!t)return;const n=O[t];if(!n)return;const{onDragStart:r}=te.current,o={active:{id:t,data:n.data,rect:U}};M({type:l.DragStart,initialCoordinates:e,active:t}),A({type:l.DragStart,event:o}),null==r||r(o)},onMove(e){M({type:l.DragMove,coordinates:e})},onEnd:a(l.DragEnd),onCancel:a(l.DragCancel)});function a(e){return async function(){const t=F.current,{active:n,over:r,scrollAdjustedTransalte:o}=he.current;if(!n||!o)return;const{cancelDrop:a}=te.current,s={active:n,delta:o,over:r};F.current=null,e===l.DragEnd&&"function"==typeof a&&await Promise.resolve(a(s))&&(e=l.DragCancel),M({type:e}),Q(null),ee(null);const{onDragCancel:i,onDragEnd:c}=te.current,u=e===l.DragEnd?c:i;A({type:e,event:s}),t&&(null==u||u(s))}}Q(o),ee(e.nativeEvent)},[M,O]),je=function(e,n){return t.useMemo(()=>e.reduce((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:n(e.handler,t)}))]},[]),[e,n])}(i,t.useCallback((e,t)=>(n,r)=>{const o=n.nativeEvent;null!==F.current||o.dndKit||o.defaultPrevented||!0===e(n,t.options)&&(o.dndKit={capturedBy:t.sensor},F.current=r,Pe(n,t))},[Pe]));o.useIsomorphicLayoutEffect(()=>{te.current=g},Object.values(g)),t.useEffect(()=>{W||(ue.current=null),W&&le&&!ue.current&&(ue.current=le)},[le,W]),t.useEffect(()=>{const{onDragMove:e}=te.current,{active:t,over:n}=he.current;if(!t)return;const r={active:t,delta:{x:Ae.x,y:Ae.y},over:n};A({type:l.DragMove,event:r}),null==e||e(r)},[Ae.x,Ae.y]),t.useEffect(()=>{const{active:e,scrollAdjustedTransalte:t}=he.current;if(!e||!F.current||!t)return;const{onDragOver:n}=te.current,r={active:e,delta:{x:t.x,y:t.y},over:Ie};A({type:l.DragOver,event:r}),null==n||n(r)},[null==Ie?void 0:Ie.id]),o.useIsomorphicLayoutEffect(()=>{he.current={active:W,activeNode:se,collisionRect:Oe,droppableRects:re,draggableNodes:O,draggingNodeRect:Se,droppableContainers:k,over:Ie,scrollableAncestors:De,scrollAdjustedTransalte:Ae,translatedRect:Ke},U.current={initial:Se,translated:Ke}},[W,se,Oe,O,Se,re,k,Ie,De,Ae,Ke]),function({acceleration:e,activator:n=exports.AutoScrollActivator.Pointer,canScroll:r,draggingRect:a,enabled:s,interval:i=5,order:l=exports.TraversalOrder.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,threshold:f}){const[p,g]=o.useInterval(),v=t.useRef({x:1,y:1}),y=t.useMemo(()=>{switch(n){case exports.AutoScrollActivator.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case exports.AutoScrollActivator.DraggableRect:return a}return null},[n,a,c]),b=t.useRef(h),m=t.useRef(null),x=t.useCallback(()=>{const e=m.current;e&&e.scrollBy(v.current.x*b.current.x,v.current.y*b.current.y)},[]),w=t.useMemo(()=>l===exports.TraversalOrder.TreeOrder?[...u].reverse():u,[l,u]);t.useEffect(()=>{if(s&&u.length&&y){for(const t of w){if(!1===(null==r?void 0:r(t)))continue;const n=u.indexOf(t),o=d[n];if(!o)continue;const{direction:a,speed:s}=S(t,o,y,e,f);if(s.x>0||s.y>0)return g(),m.current=t,p(x,i),v.current=s,void(b.current=a)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[e,x,r,g,s,i,JSON.stringify(y),p,u,w,d,JSON.stringify(f)])}({...function(){const t=!(!1===(null==X?void 0:X.autoScrollEnabled)||("object"==typeof e?!1===e.enabled:!1===e));return"object"==typeof e?{...e,enabled:t}:{enabled:t}}(),draggingRect:Ke,pointerCoordinates:Ne,scrollableAncestors:De,scrollableAncestorRects:Re});const qe=t.useMemo(()=>({active:W,activeNode:se,activeNodeRect:le,activeNodeClientRect:ce,activatorEvent:Z,activators:je,ariaDescribedById:{draggable:ne},overlayNode:{nodeRef:Ce,rect:Me,setRef:Ee},containerNodeRect:we,dispatch:M,draggableNodes:O,droppableContainers:k,droppableRects:re,over:Ie,recomputeLayouts:oe,scrollableAncestors:De,scrollableAncestorRects:Re,willRecomputeLayouts:ae,windowRect:ve}),[W,se,ce,le,Z,je,we,Me,Ce,M,O,ne,k,re,Ie,oe,De,Re,Ee,ae,ve]);return n.createElement(q.Provider,{value:L},n.createElement(p.Provider,{value:qe},n.createElement(xe.Provider,{value:ke},a)),n.createElement(z,{announcements:r,hiddenTextDescribedById:ne,screenReaderInstructions:f}))})),De=t.createContext(null),Re="button";function Ce(){return t.useContext(p)}const Ee=e=>e instanceof KeyboardEvent?"transform 250ms ease":void 0,Me={duration:250,easing:"ease",dragSourceOpacity:0},Se=n.memo(({adjustScale:e=!1,children:r,dropAnimation:a=Me,transition:s=Ee,modifiers:i,wrapperElement:l="div",className:c,zIndex:u=999})=>{var d,f;const{active:p,activeNodeRect:h,activeNodeClientRect:g,containerNodeRect:v,draggableNodes:b,activatorEvent:m,over:x,overlayNode:w,scrollableAncestors:D,scrollableAncestorRects:R,windowRect:C}=Ce(),E=t.useContext(xe),M=ye(i,{active:p,activeNodeRect:g,draggingNodeRect:w.rect,containerNodeRect:v,over:x,overlayNodeRect:w.rect,scrollableAncestors:D,scrollableAncestorRects:R,transform:E,windowRect:C}),S=function(e,n,r){const a=t.useRef(n);return o.useLazyMemo(t=>{const o=a.current;if(n!==o){if(n&&o&&(o.left!==n.left||o.top!==n.top)&&!t){const t=null==r?void 0:r.getBoundingClientRect();if(t)return{...e,x:t.left-n.left,y:t.top-n.top}}a.current=n}},[n,e,r])}(M,h,w.nodeRef.current),L=null!==p,N=null!=S?S:M,T=e?N:{...N,scaleX:1,scaleY:1},A=h?{position:"fixed",width:h.width,height:h.height,top:h.top,left:h.left,zIndex:u,transform:o.CSS.Transform.toString(T),touchAction:"none",transformOrigin:e&&m?y(m,h):void 0,transition:S?void 0:"function"==typeof s?s(m):s}:void 0,O=L?{style:A,children:r,className:c,transform:T}:void 0,B=t.useRef(O),I=null!=O?O:B.current,{children:k,...P}=null!=I?I:{},j=t.useRef(null!=(d=null==p?void 0:p.id)?d:null),q=function({animate:e,adjustScale:n,activeId:r,draggableNodes:a,duration:s,easing:i,dragSourceOpacity:l,node:c,transform:u}){const[d,f]=t.useState(!1);return t.useEffect(()=>{e&&r&&i&&s?requestAnimationFrame(()=>{var e;const t=null==(e=a[r])?void 0:e.node.current;if(u&&c&&t&&null!==t.parentNode){const e=c.children.length>1?c:c.children[0];if(e){const r=e.getBoundingClientRect(),a=K(t),d={x:r.left-a.left,y:r.top-a.top};if(Math.abs(d.x)||Math.abs(d.y)){const e=o.CSS.Transform.toString({x:u.x-d.x,y:u.y-d.y,scaleX:n?a.width*u.scaleX/r.width:1,scaleY:n?a.height*u.scaleY/r.height:1}),p=t.style.opacity;return null!=l&&(t.style.opacity=""+l),void(c.animate([{transform:o.CSS.Transform.toString(u)},{transform:e}],{easing:i,duration:s}).onfinish=()=>{f(!0),t&&null!=l&&(t.style.opacity=p)})}}}f(!0)}):e&&f(!0)},[e,r,n,a,s,i,l,c,u]),o.useIsomorphicLayoutEffect(()=>{d&&f(!1)},[d]),d}({animate:Boolean(a&&j.current&&!p),adjustScale:e,activeId:j.current,draggableNodes:b,duration:null==a?void 0:a.duration,easing:null==a?void 0:a.easing,dragSourceOpacity:null==a?void 0:a.dragSourceOpacity,node:w.nodeRef.current,transform:null==(f=B.current)?void 0:f.transform}),H=Boolean(k&&(r||a&&!q));return t.useEffect(()=>{var e;(null==p?void 0:p.id)!==j.current&&(j.current=null!=(e=null==p?void 0:p.id)?e:null),p&&B.current!==O&&(B.current=O)},[p,O]),t.useEffect(()=>{q&&(B.current=void 0)},[q]),H?n.createElement(l,{...P,ref:w.setRef},k):null});exports.DndContext=we,exports.DragOverlay=Se,exports.KeyboardSensor=ae,exports.MouseSensor=he,exports.PointerSensor=de,exports.TouchSensor=ve,exports.applyModifiers=ye,exports.closestCenter=(e,t)=>{const n=b(t,t.left,t.top),r=e.map(([e,t])=>g(b(t),n)),o=c(r);return e[o]?e[o][0]:null},exports.closestCorners=(e,t)=>{const n=B(t,t.left,t.top),r=e.map(([e,t])=>{const r=B(t,O(t)?t.left:void 0,O(t)?t.top:void 0),o=n.reduce((e,t,n)=>e+g(r[n],t),0);return Number((o/4).toFixed(4))}),o=c(r);return e[o]?e[o][0]:null},exports.defaultAnnouncements=i,exports.defaultCoordinates=h,exports.defaultDropAnimation=Me,exports.getBoundingClientRect=A,exports.getScrollableAncestors=w,exports.getViewRect=K,exports.rectIntersection=I,exports.useDndContext=Ce,exports.useDndMonitor=H,exports.useDraggable=function({id:e,data:n,disabled:r=!1,attributes:a}){const{active:s,activeNodeRect:i,activatorEvent:l,ariaDescribedById:c,draggableNodes:u,droppableRects:d,activators:f,over:h}=t.useContext(p),{role:g=Re,roleDescription:v="draggable",tabIndex:y=0}=null!=a?a:{},b=(null==s?void 0:s.id)===e,m=t.useContext(b?xe:De),[x,w]=o.useNodeRef(),D=function(e,n){return t.useMemo(()=>e.reduce((e,{eventName:t,handler:r})=>(e[t]=e=>{r(e,n)},e),{}),[e,n])}(f,e),R=X(n);return t.useEffect(()=>(u[e]={node:x,data:R},()=>{delete u[e]}),[u,e]),{active:s,activeNodeRect:i,activatorEvent:l,attributes:t.useMemo(()=>({role:g,tabIndex:y,"aria-pressed":!(!b||g!==Re)||void 0,"aria-roledescription":v,"aria-describedby":c.draggable}),[g,y,b,v,c.draggable]),droppableRects:d,isDragging:b,listeners:r?void 0:D,node:x,over:h,setNodeRef:w,transform:m}},exports.useDroppable=function({data:e,disabled:n=!1,id:r}){const{active:a,dispatch:s,over:i}=t.useContext(p),c=t.useRef(null),[u,d]=o.useNodeRef(),f=X(e);return o.useIsomorphicLayoutEffect(()=>(s({type:l.RegisterDroppable,element:{id:r,disabled:n,node:u,rect:c,data:f}}),()=>s({type:l.UnregisterDroppable,id:r})),[r]),t.useEffect(()=>{s({type:l.SetDroppableDisabled,id:r,disabled:n})},[n]),{active:a,rect:c,isOver:(null==i?void 0:i.id)===r,node:u,over:i,setNodeRef:d}},exports.useSensor=function(e,n){return t.useMemo(()=>({sensor:e,options:null!=n?n:{}}),[e,n])},exports.useSensors=function(...e){return t.useMemo(()=>[...e].filter(e=>null!=e),[...e])}; | ||
//# sourceMappingURL=core.cjs.production.min.js.map |
@@ -0,1 +1,3 @@ | ||
export { useDndMonitor } from './monitor'; | ||
export type { DndMonitorArguments } from './monitor'; | ||
export { useDraggable } from './useDraggable'; | ||
@@ -2,0 +4,0 @@ export type { DraggableSyntheticListeners, UseDraggableArguments, } from './useDraggable'; |
/// <reference types="react" /> | ||
import { Transform } from '@dnd-kit/utilities'; | ||
import { Data } from '../store'; | ||
import { SyntheticListenerMap } from './utilities'; | ||
export interface UseDraggableArguments { | ||
id: string; | ||
data?: Data; | ||
disabled?: boolean; | ||
@@ -14,4 +16,4 @@ attributes?: { | ||
export declare type DraggableSyntheticListeners = SyntheticListenerMap | undefined; | ||
export declare function useDraggable({ id, disabled, attributes, }: UseDraggableArguments): { | ||
active: string | null; | ||
export declare function useDraggable({ id, data, disabled, attributes, }: UseDraggableArguments): { | ||
active: import("../store").Active | null; | ||
activeNodeRect: import("..").ViewRect | null; | ||
@@ -30,8 +32,5 @@ activatorEvent: Event | null; | ||
node: import("react").MutableRefObject<HTMLElement | null>; | ||
over: { | ||
id: string; | ||
rect: import("..").LayoutRect; | ||
} | null; | ||
over: import("../store").Over | null; | ||
setNodeRef: (element: HTMLElement | null) => void; | ||
transform: Transform | null; | ||
}; |
@@ -10,10 +10,8 @@ /// <reference types="react" /> | ||
export declare function useDroppable({ data, disabled, id, }: UseDroppableArguments): { | ||
active: import("../store").Active | null; | ||
rect: import("react").MutableRefObject<LayoutRect | null>; | ||
isOver: boolean; | ||
node: import("react").MutableRefObject<HTMLElement | null>; | ||
over: { | ||
id: string; | ||
rect: LayoutRect; | ||
} | null; | ||
over: import("../store").Over | null; | ||
setNodeRef: (element: HTMLElement | null) => void; | ||
}; |
@@ -5,2 +5,3 @@ export { AutoScrollActivator, TraversalOrder, useAutoScroller, } from './useAutoScroller'; | ||
export { useCombineActivators } from './useCombineActivators'; | ||
export { useData } from './useData'; | ||
export { useLayoutMeasuring, LayoutMeasuringFrequency, LayoutMeasuringStrategy, } from './useLayoutMeasuring'; | ||
@@ -7,0 +8,0 @@ export type { LayoutMeasuring } from './useLayoutMeasuring'; |
@@ -1,3 +0,3 @@ | ||
import type { DraggableNode } from '../../store'; | ||
import type { DraggableNode, DraggableNodes } from '../../store'; | ||
import type { UniqueIdentifier } from '../../types'; | ||
export declare function useCachedNode(draggableNode: DraggableNode | null, active: UniqueIdentifier | null): DraggableNode['current']; | ||
export declare function useCachedNode(draggableNodes: DraggableNodes, id: UniqueIdentifier | null): DraggableNode['node']['current']; |
export { DndContext, DragOverlay, defaultAnnouncements, defaultDropAnimation, } from './components'; | ||
export type { Announcements, CancelDrop, DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent, DropAnimation, ScreenReaderInstructions, } from './components'; | ||
export { AutoScrollActivator, LayoutMeasuringFrequency, LayoutMeasuringStrategy, TraversalOrder, useDraggable, useDndContext, useDroppable, } from './hooks'; | ||
export type { AutoScrollOptions, DraggableSyntheticListeners, LayoutMeasuring, UseDndContextReturnValue, UseDraggableArguments, UseDroppableArguments, } from './hooks'; | ||
export type { Announcements, CancelDrop, DropAnimation, ScreenReaderInstructions, } from './components'; | ||
export { AutoScrollActivator, LayoutMeasuringFrequency, LayoutMeasuringStrategy, TraversalOrder, useDraggable, useDndContext, useDndMonitor, useDroppable, } from './hooks'; | ||
export type { AutoScrollOptions, DndMonitorArguments, DraggableSyntheticListeners, LayoutMeasuring, UseDndContextReturnValue, UseDraggableArguments, UseDroppableArguments, } from './hooks'; | ||
export { applyModifiers } from './modifiers'; | ||
@@ -9,5 +9,5 @@ export type { Modifier, Modifiers } from './modifiers'; | ||
export type { Activator, Activators, PointerActivationConstraint, KeyboardCodes, KeyboardCoordinateGetter, KeyboardSensorOptions, KeyboardSensorProps, MouseSensorOptions, PointerEventHandlers, PointerSensorOptions, PointerSensorProps, Sensor, Sensors, SensorContext, SensorDescriptor, SensorHandler, SensorInstance, SensorOptions, SensorProps, SensorResponse, TouchSensorOptions, } from './sensors'; | ||
export type { DndContextDescriptor } from './store'; | ||
export type { DistanceMeasurement, LayoutRect, RectEntry, Translate, UniqueIdentifier, ViewRect, } from './types'; | ||
export type { Active, DndContextDescriptor, Over } from './store'; | ||
export type { DistanceMeasurement, DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent, LayoutRect, RectEntry, Translate, UniqueIdentifier, ViewRect, } from './types'; | ||
export { defaultCoordinates, getBoundingClientRect, getViewRect, getScrollableAncestors, closestCenter, closestCorners, rectIntersection, } from './utilities'; | ||
export type { CollisionDetection } from './utilities'; |
import type { Transform } from '@dnd-kit/utilities'; | ||
import type { Active, Over } from '../store'; | ||
import type { ClientRect, ViewRect } from '../types'; | ||
export declare type Modifier = (args: { | ||
transform: Transform; | ||
active: Active | null; | ||
activeNodeRect: ViewRect | null; | ||
draggingNodeRect: ViewRect | null; | ||
containerNodeRect: ViewRect | null; | ||
over: Over | null; | ||
overlayNodeRect: ViewRect | null; | ||
scrollableAncestors: Element[]; | ||
scrollableAncestorRects: ViewRect[]; | ||
transform: Transform; | ||
windowRect: ClientRect | null; | ||
}) => Transform; | ||
export declare type Modifiers = Modifier[]; |
import type { MutableRefObject } from 'react'; | ||
import type { DraggableNode, DroppableContainers, LayoutRectMap } from '../store'; | ||
import type { Coordinates, SyntheticEventName, UniqueIdentifier, ViewRect } from '../types'; | ||
import type { Active, Over, DraggableNode, DraggableNodes, DroppableContainers, LayoutRectMap } from '../store'; | ||
import type { Coordinates, LayoutRect, SyntheticEventName, Translate, UniqueIdentifier, ViewRect } from '../types'; | ||
export declare enum Response { | ||
@@ -10,10 +10,12 @@ Start = "start", | ||
export declare type SensorContext = { | ||
active: Active | null; | ||
activeNode: HTMLElement | null; | ||
collisionRect: ViewRect | null; | ||
draggableNodes: DraggableNodes; | ||
draggingNodeRect: LayoutRect | null; | ||
droppableRects: LayoutRectMap; | ||
droppableContainers: DroppableContainers; | ||
over: { | ||
id: string; | ||
} | null; | ||
over: Over | null; | ||
scrollableAncestors: Element[]; | ||
scrollAdjustedTransalte: Translate | null; | ||
translatedRect: ViewRect | null; | ||
@@ -20,0 +22,0 @@ }; |
@@ -8,2 +8,3 @@ import type { Coordinates, UniqueIdentifier } from '../types'; | ||
DragCancel = "dragCancel", | ||
DragOver = "dragOver", | ||
RegisterDroppable = "registerDroppable", | ||
@@ -10,0 +11,0 @@ SetDroppableDisabled = "setDroppableDisabled", |
export { Action } from './actions'; | ||
export { Context } from './context'; | ||
export { reducer, getInitialState } from './reducer'; | ||
export type { Data, DraggableElement, DraggableNode, DraggableNodes, DroppableContainer, DroppableContainers, DndContextDescriptor, LayoutRectMap, State, } from './types'; | ||
export type { Active, Data, DataRef, DraggableElement, DraggableNode, DraggableNodes, DroppableContainer, DroppableContainers, DndContextDescriptor, LayoutRectMap, Over, State, } from './types'; |
import type { MutableRefObject } from 'react'; | ||
import type { Coordinates, ViewRect, ClientRect, LayoutRect, UniqueIdentifier } from '../types'; | ||
import type { SyntheticListeners } from '../hooks/utilities'; | ||
import type { Action, Actions } from './actions'; | ||
import type { Actions } from './actions'; | ||
export interface DraggableElement { | ||
@@ -13,2 +13,3 @@ node: DraggableNode; | ||
export declare type Data = Record<string, any>; | ||
export declare type DataRef = MutableRefObject<Data | undefined>; | ||
export interface DroppableContainer { | ||
@@ -19,5 +20,22 @@ id: UniqueIdentifier; | ||
disabled: boolean; | ||
data: MutableRefObject<Data>; | ||
data: DataRef; | ||
} | ||
export declare type DraggableNode = MutableRefObject<HTMLElement | null>; | ||
export interface Active { | ||
id: UniqueIdentifier; | ||
data: DataRef; | ||
rect: MutableRefObject<{ | ||
initial: LayoutRect | null; | ||
translated: LayoutRect | null; | ||
}>; | ||
} | ||
export interface Over { | ||
id: UniqueIdentifier; | ||
rect: LayoutRect; | ||
disabled: boolean; | ||
data: DataRef; | ||
} | ||
export declare type DraggableNode = { | ||
node: MutableRefObject<HTMLElement | null>; | ||
data: DataRef; | ||
}; | ||
export declare type DraggableNodes = Record<UniqueIdentifier, DraggableNode | undefined>; | ||
@@ -33,3 +51,2 @@ export declare type DroppableContainers = Record<UniqueIdentifier, DroppableContainer | undefined>; | ||
initialCoordinates: Coordinates; | ||
lastEvent: Action.DragStart | Action.DragEnd | Action.DragCancel | null; | ||
nodes: DraggableNodes; | ||
@@ -43,3 +60,3 @@ translate: Coordinates; | ||
activatorEvent: Event | null; | ||
active: UniqueIdentifier | null; | ||
active: Active | null; | ||
activeNode: HTMLElement | null; | ||
@@ -55,6 +72,3 @@ activeNodeRect: ViewRect | null; | ||
droppableRects: LayoutRectMap; | ||
over: { | ||
id: UniqueIdentifier; | ||
rect: LayoutRect; | ||
} | null; | ||
over: Over | null; | ||
overlayNode: { | ||
@@ -61,0 +75,0 @@ nodeRef: MutableRefObject<HTMLElement | null>; |
export type { Coordinates, ClientRect, DistanceMeasurement, LayoutRect, ViewRect, RectEntry, Translate, ScrollCoordinates, } from './coordinates'; | ||
export { Direction } from './direction'; | ||
export type { DragStartEvent, DragCancelEvent, DragEndEvent, DragMoveEvent, DragOverEvent, } from './events'; | ||
export type { UniqueIdentifier } from './other'; | ||
export type { SyntheticEventName } from './react'; | ||
export type { UniqueIdentifier } from './other'; |
{ | ||
"name": "@dnd-kit/core", | ||
"version": "2.1.2", | ||
"version": "3.0.0", | ||
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences", | ||
@@ -34,4 +34,4 @@ "author": "Claudéric Demers", | ||
"tslib": "^2.0.0", | ||
"@dnd-kit/accessibility": "^2.0.0", | ||
"@dnd-kit/utilities": "^1.0.2" | ||
"@dnd-kit/accessibility": "^3.0.0", | ||
"@dnd-kit/utilities": "^2.0.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "publishConfig": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
110
0
722720
5699
+ Added@dnd-kit/accessibility@3.1.0(transitive)
+ Added@dnd-kit/utilities@2.0.0(transitive)
- Removed@dnd-kit/accessibility@2.0.0(transitive)
- Removed@dnd-kit/utilities@1.0.3(transitive)
Updated@dnd-kit/utilities@^2.0.0