@progress/kendo-react-sortable 13.3.0 → 13.4.0-develop.2

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/Sortable.d.ts ADDED
@@ -0,0 +1,223 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { default as PropTypes } from 'prop-types';
9
+ import { DraggableDragEvent, DraggableDragStartEvent, DraggableReleaseEvent, Navigation } from '@progress/kendo-react-common';
10
+ import { SortableProps } from './interfaces/SortableProps.js';
11
+ import { SortableDefaultProps } from './interfaces/SortableDefaultProps.js';
12
+ import * as React from 'react';
13
+ /**
14
+ * @hidden
15
+ */
16
+ interface SortableState {
17
+ clientX: number;
18
+ clientY: number;
19
+ isDragging: boolean;
20
+ activeId: string;
21
+ dragCueWidth: number;
22
+ dragCueHeight: number;
23
+ }
24
+ export declare class Sortable extends React.Component<SortableProps, SortableState> {
25
+ /**
26
+ * @hidden
27
+ */
28
+ static defaultProps: SortableDefaultProps;
29
+ /**
30
+ * @hidden
31
+ */
32
+ static propTypes: {
33
+ idField: PropTypes.Validator<string>;
34
+ disabledField: PropTypes.Requireable<string>;
35
+ data: PropTypes.Validator<any[]>;
36
+ tabIndex: PropTypes.Requireable<number>;
37
+ navigation: PropTypes.Requireable<boolean>;
38
+ animation: PropTypes.Requireable<boolean>;
39
+ itemsWrapUI: PropTypes.Requireable<any>;
40
+ itemUI: PropTypes.Validator<(...args: any[]) => any>;
41
+ emptyItemUI: PropTypes.Requireable<(...args: any[]) => any>;
42
+ style: PropTypes.Requireable<object>;
43
+ className: PropTypes.Requireable<string>;
44
+ onDragStart: PropTypes.Requireable<(...args: any[]) => any>;
45
+ onDragOver: PropTypes.Requireable<(...args: any[]) => any>;
46
+ onDragEnd: PropTypes.Requireable<(...args: any[]) => any>;
47
+ onNavigate: PropTypes.Requireable<(...args: any[]) => any>;
48
+ };
49
+ /**
50
+ * @hidden
51
+ */
52
+ state: {
53
+ clientX: number;
54
+ clientY: number;
55
+ isDragging: boolean;
56
+ activeId: string;
57
+ dragCueWidth: number;
58
+ dragCueHeight: number;
59
+ };
60
+ private isRtl;
61
+ private get container();
62
+ private itemRefsMap;
63
+ private oldSizesMap;
64
+ private animatingItemMap;
65
+ private draggableRef;
66
+ private offsetParent;
67
+ private isUnmounted;
68
+ private focusActiveId;
69
+ private isKeyboardNavigated;
70
+ private isDragPrevented;
71
+ private navigation?;
72
+ private readonly showLicenseWatermark;
73
+ private readonly licenseMessage?;
74
+ constructor(props: SortableProps);
75
+ /**
76
+ * @hidden
77
+ */
78
+ getSnapshotBeforeUpdate(): null;
79
+ /**
80
+ * @hidden
81
+ */
82
+ componentDidUpdate(previousProps: SortableProps): void;
83
+ /**
84
+ * @hidden
85
+ */
86
+ componentDidMount(): void;
87
+ /**
88
+ * @hidden
89
+ */
90
+ componentWillUnmount(): void;
91
+ /**
92
+ * @hidden
93
+ */
94
+ windowTimeout: (id: any) => void;
95
+ /**
96
+ * @hidden
97
+ */
98
+ swapItems: (newState: object[], source: number, destination: number) => number;
99
+ /**
100
+ * @hidden
101
+ */
102
+ generateNewState: (prevIndex: number, nextIndex: number) => object[];
103
+ /**
104
+ * @hidden
105
+ */
106
+ closestSortableItem: (target: HTMLElement | null) => {
107
+ element: HTMLElement | null;
108
+ id: string;
109
+ };
110
+ /**
111
+ * @hidden
112
+ */
113
+ isSortable: (target: HTMLElement) => boolean;
114
+ /**
115
+ * @hidden
116
+ */
117
+ closestSortable: (target: HTMLElement | null) => HTMLElement | null;
118
+ /**
119
+ * @hidden
120
+ */
121
+ isSameSortable: (element: HTMLElement) => boolean;
122
+ /**
123
+ * @hidden
124
+ */
125
+ idComparer: (id1: any, id2: any) => boolean;
126
+ /**
127
+ * @hidden
128
+ */
129
+ findItem: (id: string) => object | undefined;
130
+ /**
131
+ * @hidden
132
+ */
133
+ findIndex: (id: string) => number;
134
+ /**
135
+ * @hidden
136
+ */
137
+ isItemDisabled: (item: any) => boolean;
138
+ /**
139
+ * @hidden
140
+ */
141
+ shouldResetActive: () => boolean;
142
+ /**
143
+ * @hidden
144
+ */
145
+ parentOffset(): any;
146
+ /**
147
+ * @hidden
148
+ */
149
+ widgetTarget: (target: any) => boolean;
150
+ /**
151
+ * @hidden
152
+ */
153
+ allowDrag: (target: HTMLElement) => boolean;
154
+ /**
155
+ * @hidden
156
+ */
157
+ onDragStart: (eventData: DraggableDragStartEvent) => void;
158
+ /**
159
+ * @hidden
160
+ */
161
+ onDragOver: (eventData: DraggableDragEvent) => void;
162
+ /**
163
+ * @hidden
164
+ */
165
+ onDragEnd: (eventData: DraggableReleaseEvent) => void;
166
+ /**
167
+ * @hidden
168
+ */
169
+ shouldReorder: (draggerOverElement: HTMLElement | null, clientX: number, clientY: number) => boolean | null;
170
+ /**
171
+ * @hidden
172
+ */
173
+ thresholdRect: (draggerOverElement: HTMLElement | null) => {
174
+ top: number;
175
+ left: number;
176
+ bottom: number;
177
+ right: number;
178
+ } | null;
179
+ /**
180
+ * @hidden
181
+ */
182
+ onItemBlur: () => void;
183
+ /**
184
+ * @hidden
185
+ */
186
+ onItemFocus: (event: React.FocusEvent<HTMLDivElement>) => void;
187
+ /**
188
+ * @hidden
189
+ */
190
+ resetState: (resetActive?: boolean) => void;
191
+ /**
192
+ * @hidden
193
+ */
194
+ renderData: () => React.JSX.Element[];
195
+ /**
196
+ * @hidden
197
+ */
198
+ renderNoData: () => React.JSX.Element | undefined;
199
+ /**
200
+ * @hidden
201
+ */
202
+ renderDragCue: () => React.JSX.Element | undefined;
203
+ /**
204
+ * @hidden
205
+ */
206
+ refAssign: (element: any, id: any) => void;
207
+ /**
208
+ * @hidden
209
+ */
210
+ draggableRefAssign: (ref: any) => void;
211
+ /**
212
+ * @hidden
213
+ */
214
+ onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
215
+ /**
216
+ * @hidden
217
+ */
218
+ handleNext: (t: HTMLElement, nav: Navigation, ev: React.KeyboardEvent<HTMLElement>) => void;
219
+ handlePrev: (t: HTMLElement, nav: Navigation, ev: React.KeyboardEvent<HTMLElement>) => void;
220
+ moveItem: (t: HTMLElement, nav: Navigation, ev: React.KeyboardEvent<HTMLElement>, direction: 'next' | 'prev') => void;
221
+ render(): React.JSX.Element;
222
+ }
223
+ export {};
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactSortable={},t.React,t.PropTypes,t.KendoReactCommon,t.KendoReactIntl)}(this,(function(t,e,i,s,n){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=r(e);class o{constructor(){this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}}let l=class extends o{constructor(t,e,i){super(),this.target=t,this.prevIndex=e,this.element=i}},d=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},h=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},c=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}};const g="sortable.noData",m={[g]:"No Data"},u=(t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return i;return-1},p=t=>String(t).trim().split(" "),f=/^(?:a|input|select|option|textarea|button|object)$/i,v=s.hasRelativeStackingContext(),b=Object.freeze({name:"@progress/kendo-react-sortable",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"13.3.0",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"}),I="data-sortable-id",D="data-sortable-component",S="[data-sortable-id]:not(.k-disabled)",w={[D]:!0},y=class extends a.Component{constructor(t){super(t),this.state={clientX:0,clientY:0,isDragging:!1,activeId:"",dragCueWidth:0,dragCueHeight:0},this.isRtl=!1,this.itemRefsMap={},this.oldSizesMap={},this.animatingItemMap={},this.draggableRef=null,this.isUnmounted=!1,this.focusActiveId=!1,this.isKeyboardNavigated=!1,this.isDragPrevented=!1,this.showLicenseWatermark=!1,this.windowTimeout=t=>{window.setTimeout((()=>this.animatingItemMap[t]=!1),200)},this.swapItems=(t,e,i)=>{const s=t[e];return t[e]=t[i],t[i]=s,e=i},this.generateNewState=(t,e)=>{const{data:i}=this.props,s=[...i];if(t>e)for(let n=t-1;n>=e;n--){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}else for(let n=t+1;n<=e;n++){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}return s},this.closestSortableItem=t=>{let e=t;for(;e;){const t=e.getAttribute(I);if(t&&this.itemRefsMap[t]===e)return{id:t,element:e};e=e.parentElement}return{id:"",element:null}},this.isSortable=t=>!!t.hasAttribute(D),this.closestSortable=t=>{let e=t;for(;e;){if(this.isSortable(e))return e;e=e.parentElement}return null},this.isSameSortable=t=>this.closestSortable(t)===this.container,this.idComparer=(t,e)=>t+""==e+"",this.findItem=t=>{const{data:e,idField:i}=this.props;if(!(t+""))return;const n=s.getter(i);return((t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return t[i]})(e,(e=>this.idComparer(n(e),t)))},this.findIndex=t=>{const{data:e,idField:i}=this.props;return t+""?u(e,(e=>this.idComparer(e[i],t))):-1},this.isItemDisabled=t=>t&&!0===t[this.props.disabledField||""],this.shouldResetActive=()=>{const t=s.getActiveElement(document);return t instanceof HTMLElement&&!this.closestSortableItem(t).element},this.widgetTarget=t=>{const e=((t,e)=>{for(;t&&!e(t);)t=t.parentNode;return t})(t,(t=>((t,e)=>{const i=p(e);return!!p(t.className).find((t=>i.indexOf(t)>=0))})(t,"k-widget")||this.isSortable(t)));return e&&!this.isSortable(e)},this.allowDrag=t=>t.hasAttribute(I)||!((t=>{if(t.tagName){const e=t.tagName.toLowerCase(),i=t.getAttribute("tabIndex"),s="-1"===i;let n=null!==i&&!s;return f.test(e)&&(n=!t.disabled&&!s),n}return!1})(t)||this.widgetTarget(t)),this.onDragStart=t=>{const{event:e}=t,{onDragStart:i}=this.props,s=document.elementFromPoint(e.clientX,e.clientY),{id:n,element:r}=this.closestSortableItem(s),a=this.findItem(n);if(!n||a&&this.isItemDisabled(a)||!this.allowDrag(s)||!this.isSameSortable(s))return void(this.isDragPrevented=!0);e.isTouch&&e.originalEvent.preventDefault();const o=new l(this,this.findIndex(n),s);i&&i.call(void 0,o),this.isDragPrevented=o.isDefaultPrevented(),this.isDragPrevented?e.originalEvent.preventDefault():(this.offsetParent=(t=>{if(!t||!v)return null;let e=t.parentElement;for(;e;){if("none"!==window.getComputedStyle(e).transform)return e;e=e.parentElement}})(this.container),this.setState({activeId:n,dragCueWidth:r&&r.clientWidth||0,dragCueHeight:r&&r.clientHeight||0}))},this.onDragOver=t=>{const{event:e}=t,{onDragOver:i,data:s}=this.props;if(this.isDragPrevented)return;e.originalEvent.preventDefault();const n=this.findIndex(this.state.activeId);if(-1===n)return void this.resetState();const r=document.elementFromPoint(e.clientX,e.clientY),a=this.closestSortableItem(r),o=this.findIndex(a.id),l=s[o];if(i&&o>-1&&n!==o&&!this.isItemDisabled(l)&&!this.animatingItemMap[a.id]&&this.shouldReorder(a.element,e.clientX,e.clientY)){const t=new d(this,n,o,this.generateNewState(n,o));i.call(void 0,t)}const h=this.parentOffset();this.setState({clientX:e.clientX-h.left,clientY:e.clientY-h.top,isDragging:!0})},this.onDragEnd=t=>{const{event:e}=t,i=this.shouldResetActive();if(this.isDragPrevented)return;const{onDragEnd:s,data:n}=this.props,r=document.elementFromPoint(e.clientX,e.clientY),a=this.closestSortableItem(r);let o=this.findIndex(a.id),l=this.findIndex(this.state.activeId);const d=this.isItemDisabled(n[o]);if((-1===o||d)&&(o=l),s){let t=this.generateNewState(l,o);if(!d){const i=this.thresholdRect(a.element);if(i&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)){const e=l;l=o,o=e,t=this.props.data.slice()}}const i=new h(this,l,o,t);s.call(void 0,i)}this.resetState(i)},this.shouldReorder=(t,e,i)=>{const s=this.thresholdRect(t);return s&&e>s.left&&e<s.right&&i>s.top&&i<s.bottom},this.thresholdRect=t=>{const e=this.state.activeId,i=this.container,s=(i?Array.from(i.childNodes):[]).find((t=>t instanceof HTMLElement&&t.getAttribute(I)===e));if(!t||!s)return null;const{width:n,height:r}=s.getBoundingClientRect(),a=t.getBoundingClientRect(),o=a.top+a.height/2-r/2,l=a.left+a.width/2-n/2;return{top:o,left:l,bottom:o+r,right:l+n}},this.onItemBlur=()=>{window.setTimeout((()=>{this.isUnmounted||this.shouldResetActive()&&!this.state.isDragging&&this.setState({activeId:""})}))},this.onItemFocus=t=>{const{id:e,element:i}=this.closestSortableItem(t.currentTarget);!this.idComparer(e,this.state.activeId)&&this.isSameSortable(t.target)&&i===t.target&&this.setState({activeId:e})},this.resetState=t=>{this.isDragPrevented=!1,this.setState({clientX:0,clientY:0,isDragging:!1,dragCueWidth:0,dragCueHeight:0,activeId:t?"":this.state.activeId})},this.renderData=()=>{const{data:t,itemUI:e,idField:i,tabIndex:n,navigatable:r}=this.props;return t.map((t=>{const o=s.getter(i)(t),l=this.isItemDisabled(t),d=this.idComparer(this.state.activeId,o),h=r?d?0:-1:n;return a.createElement(e,{key:o,forwardRef:t=>this.refAssign(t,o),dataItem:t,isDisabled:l,isActive:d,isDragged:d&&this.state.isDragging,isDragCue:!1,attributes:{[I]:o,"aria-disabled":l,"aria-grabbed":d&&this.state.isDragging&&!this.isDragPrevented,"aria-dropeffect":l?"none":"move",tabIndex:s.getTabIndex(h,l),onFocus:this.onItemFocus,onBlur:this.onItemBlur},style:{cursor:l?"auto":"move",MozUserSelect:"none",msUserSelect:"none",WebkitUserSelect:"none",userSelect:"none"}})}))},this.renderNoData=()=>{const{emptyItemUI:t}=this.props,e=n.provideLocalizationService(this).toLanguageString(g,m[g]);if(t)return a.createElement(t,{message:e})},this.renderDragCue=()=>{const{itemUI:t}=this.props,{isDragging:e,activeId:i,clientX:s,clientY:n}=this.state,r=this.findItem(i);if(e&&r)return a.createElement(t,{dataItem:r,isDisabled:!1,isActive:!0,isDragged:!0,isDragCue:!0,style:{position:"fixed",top:n+10,left:s+10,width:this.state.dragCueWidth,height:this.state.dragCueHeight},attributes:{}})},this.refAssign=(t,e)=>{t?this.itemRefsMap[e]=t:delete this.itemRefsMap[e]},this.draggableRefAssign=t=>{this.draggableRef=t},this.onKeyDown=t=>{var e,i,n;const{data:r,idField:a}=this.props,{activeId:o}=this.state,l=r.filter((t=>!this.isItemDisabled(t))),d=u(l,(t=>this.idComparer(t[a],o))),h=d<0?0:d;t.key===s.KEYS.tab&&s.getActiveElement(document)!==(null==(e=this.draggableRef)?void 0:e.element)&&(t.preventDefault(),t.stopPropagation()),this.navigation&&null!=(i=this.draggableRef)&&i.element&&this.navigation.triggerKeyboardEvent({target:null==(n=this.draggableRef)?void 0:n.element.querySelectorAll(S)[h],key:t.key,nativeEvent:{type:t.type},originalEvent:t})},this.handleNext=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"next"):e.focusNext(t))},this.handlePrev=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"prev"):e.focusPrevious(t))},this.moveItem=(t,e,i,n)=>{var r;if(s.getActiveElement(document)!==(null==(r=this.draggableRef)?void 0:r.element)){const{onNavigate:t,data:e,idField:i}=this.props,s=this.findIndex(this.state.activeId);if(t){let r,a;"next"===n?(r=e[s+1],a=r&&r.disabled?e[s+2]:e[s+1]):(r=e[s-1],a=r&&r.disabled?e[s-2]:e[s-1]);const o=a&&a[i],l=e[s],d=l?l[i]:"",h=this.findIndex(d),g=this.findIndex(o||d),m=new c(this,h,g,this.generateNewState(h,g));this.isKeyboardNavigated=!0,t.call(void 0,m)}}},this.showLicenseWatermark=!s.validatePackage(b,{component:"Sortable"}),this.licenseMessage=s.getLicenseMessage(b),this.onKeyDown=this.onKeyDown.bind(this)}get container(){return this.draggableRef&&this.draggableRef.element}getSnapshotBeforeUpdate(){const{idField:t,animation:e}=this.props;return this.oldSizesMap={},e&&this.props.data.forEach((e=>{const i=e[t],s=this.itemRefsMap[i];s&&(this.oldSizesMap[i]=s.getBoundingClientRect())})),null}componentDidUpdate(t){const{idField:e,animation:i}=this.props;this.focusActiveId&&(this.focusActiveId=!1,this.itemRefsMap[this.state.activeId].focus()),i&&(this.state.isDragging||this.isKeyboardNavigated)&&(this.isKeyboardNavigated=!1,t.data.forEach((t=>{const i=t[e],s=this.itemRefsMap[i];if(!s)return;const n=s.getBoundingClientRect(),r=this.oldSizesMap[i],a=r.left-n.left,o=r.top-n.top;0===a&&0===o||requestAnimationFrame((()=>{this.animatingItemMap[i]=!0,s.style.transform=`translate(${a}px, ${o}px)`,s.style.transition="transform 0s",requestAnimationFrame((()=>{s.style.transform="",s.style.transition="transform 200ms cubic-bezier(0.2, 0, 0, 1) 0s",this.windowTimeout(i)}))}))})))}componentDidMount(){var t,e;null!=(t=this.draggableRef)&&t.element&&(this.navigation=new s.Navigation({tabIndex:0,root:{current:null==(e=this.draggableRef)?void 0:e.element},rovingTabIndex:!0,selectors:[S],keyboardEvents:{keydown:{ArrowDown:this.handleNext,ArrowRight:this.handleNext,ArrowUp:this.handlePrev,ArrowLeft:this.handlePrev,Enter:(t,e,i)=>{e.focusElement(e.first,t)},Escape:(t,e,i)=>{var s,n;t.setAttribute("tabindex","-1"),null==(n=null==(s=this.draggableRef)?void 0:s.element)||n.focus(),this.setState({activeId:""})}}}})),this.isRtl=this.container&&"rtl"===getComputedStyle(this.container).direction||!1}componentWillUnmount(){this.isUnmounted=!0}parentOffset(){const t=this.offsetParent;if(t&&t.ownerDocument&&t!==t.ownerDocument.body){const e=t.getBoundingClientRect();return{left:e.left-t.scrollLeft,top:e.top-t.scrollTop}}return{left:0,top:0}}render(){const{data:t,style:e,className:i,itemsWrapUI:n,tabIndex:r,navigatable:o}=this.props,l=n||"div";return a.createElement(s.Draggable,{onDragStart:this.onDragStart,onDrag:this.onDragOver,onDragEnd:this.onDragEnd,ref:this.draggableRefAssign},a.createElement(l,{onKeyDown:t=>o&&this.onKeyDown(t),...w,className:i,style:{position:"relative",touchAction:"none",...e},tabIndex:o?r||0:void 0},t&&t.length?this.renderData():this.renderNoData(),this.renderDragCue(),this.showLicenseWatermark&&a.createElement(s.WatermarkOverlay,{message:this.licenseMessage})))}};y.defaultProps={navigation:!0,animation:!0,emptyItemUI:t=>a.createElement("div",null,t.message)},y.propTypes={idField:i.string.isRequired,disabledField:i.string,data:i.array.isRequired,tabIndex:i.number,navigation:i.bool,animation:i.bool,itemsWrapUI:i.any,itemUI:i.func.isRequired,emptyItemUI:i.func,style:i.object,className:i.string,onDragStart:i.func,onDragOver:i.func,onDragEnd:i.func,onNavigate:i.func};let R=y;n.registerForLocalization(R),t.Sortable=R,t.SortableOnDragEndEvent=h,t.SortableOnDragOverEvent=d,t.SortableOnDragStartEvent=l,t.SortableOnNavigateEvent=c}));
15
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-intl")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-intl"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoReactSortable={},t.React,t.PropTypes,t.KendoReactCommon,t.KendoReactIntl)}(this,function(t,e,i,s,n){"use strict";function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}var a=r(e);class o{constructor(){this.prevented=!1}preventDefault(){this.prevented=!0}isDefaultPrevented(){return this.prevented}}let l=class extends o{constructor(t,e,i){super(),this.target=t,this.prevIndex=e,this.element=i}},d=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},h=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}},c=class{constructor(t,e,i,s){this.target=t,this.prevIndex=e,this.nextIndex=i,this.newState=s}};const g="sortable.noData",m={[g]:"No Data"},u=(t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return i;return-1},p=t=>String(t).trim().split(" "),f=/^(?:a|input|select|option|textarea|button|object)$/i,v=s.hasRelativeStackingContext(),b=Object.freeze({name:"@progress/kendo-react-sortable",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:0,version:"13.4.0-develop.2",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"}),I="data-sortable-id",D="data-sortable-component",S="[data-sortable-id]:not(.k-disabled)",w={[D]:!0},y=class extends a.Component{constructor(t){super(t),this.state={clientX:0,clientY:0,isDragging:!1,activeId:"",dragCueWidth:0,dragCueHeight:0},this.isRtl=!1,this.itemRefsMap={},this.oldSizesMap={},this.animatingItemMap={},this.draggableRef=null,this.isUnmounted=!1,this.focusActiveId=!1,this.isKeyboardNavigated=!1,this.isDragPrevented=!1,this.showLicenseWatermark=!1,this.windowTimeout=t=>{window.setTimeout(()=>this.animatingItemMap[t]=!1,200)},this.swapItems=(t,e,i)=>{const s=t[e];return t[e]=t[i],t[i]=s,e=i},this.generateNewState=(t,e)=>{const{data:i}=this.props,s=[...i];if(t>e)for(let n=t-1;n>=e;n--){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}else for(let n=t+1;n<=e;n++){const e=i[n];this.isItemDisabled(e)||(t=this.swapItems(s,t,n))}return s},this.closestSortableItem=t=>{let e=t;for(;e;){const t=e.getAttribute(I);if(t&&this.itemRefsMap[t]===e)return{id:t,element:e};e=e.parentElement}return{id:"",element:null}},this.isSortable=t=>!!t.hasAttribute(D),this.closestSortable=t=>{let e=t;for(;e;){if(this.isSortable(e))return e;e=e.parentElement}return null},this.isSameSortable=t=>this.closestSortable(t)===this.container,this.idComparer=(t,e)=>t+""==e+"",this.findItem=t=>{const{data:e,idField:i}=this.props;if(!(t+""))return;const n=s.getter(i);return((t,e)=>{for(let i=0;i<t.length;i++)if(e(t[i]))return t[i]})(e,e=>this.idComparer(n(e),t))},this.findIndex=t=>{const{data:e,idField:i}=this.props;return t+""?u(e,e=>this.idComparer(e[i],t)):-1},this.isItemDisabled=t=>t&&!0===t[this.props.disabledField||""],this.shouldResetActive=()=>{const t=s.getActiveElement(document);return t instanceof HTMLElement&&!this.closestSortableItem(t).element},this.widgetTarget=t=>{const e=((t,e)=>{for(;t&&!e(t);)t=t.parentNode;return t})(t,t=>((t,e)=>{const i=p(e);return!!p(t.className).find(t=>i.indexOf(t)>=0)})(t,"k-widget")||this.isSortable(t));return e&&!this.isSortable(e)},this.allowDrag=t=>t.hasAttribute(I)||!((t=>{if(t.tagName){const e=t.tagName.toLowerCase(),i=t.getAttribute("tabIndex"),s="-1"===i;let n=null!==i&&!s;return f.test(e)&&(n=!t.disabled&&!s),n}return!1})(t)||this.widgetTarget(t)),this.onDragStart=t=>{const{event:e}=t,{onDragStart:i}=this.props,s=document.elementFromPoint(e.clientX,e.clientY),{id:n,element:r}=this.closestSortableItem(s),a=this.findItem(n);if(!n||a&&this.isItemDisabled(a)||!this.allowDrag(s)||!this.isSameSortable(s))return void(this.isDragPrevented=!0);e.isTouch&&e.originalEvent.preventDefault();const o=new l(this,this.findIndex(n),s);i&&i.call(void 0,o),this.isDragPrevented=o.isDefaultPrevented(),this.isDragPrevented?e.originalEvent.preventDefault():(this.offsetParent=(t=>{if(!t||!v)return null;let e=t.parentElement;for(;e;){if("none"!==window.getComputedStyle(e).transform)return e;e=e.parentElement}})(this.container),this.setState({activeId:n,dragCueWidth:r&&r.clientWidth||0,dragCueHeight:r&&r.clientHeight||0}))},this.onDragOver=t=>{const{event:e}=t,{onDragOver:i,data:s}=this.props;if(this.isDragPrevented)return;e.originalEvent.preventDefault();const n=this.findIndex(this.state.activeId);if(-1===n)return void this.resetState();const r=document.elementFromPoint(e.clientX,e.clientY),a=this.closestSortableItem(r),o=this.findIndex(a.id),l=s[o];if(i&&o>-1&&n!==o&&!this.isItemDisabled(l)&&!this.animatingItemMap[a.id]&&this.shouldReorder(a.element,e.clientX,e.clientY)){const t=new d(this,n,o,this.generateNewState(n,o));i.call(void 0,t)}const h=this.parentOffset();this.setState({clientX:e.clientX-h.left,clientY:e.clientY-h.top,isDragging:!0})},this.onDragEnd=t=>{const{event:e}=t,i=this.shouldResetActive();if(this.isDragPrevented)return;const{onDragEnd:s,data:n}=this.props,r=document.elementFromPoint(e.clientX,e.clientY),a=this.closestSortableItem(r);let o=this.findIndex(a.id),l=this.findIndex(this.state.activeId);const d=this.isItemDisabled(n[o]);if((-1===o||d)&&(o=l),s){let t=this.generateNewState(l,o);if(!d){const i=this.thresholdRect(a.element);if(i&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)){const e=l;l=o,o=e,t=this.props.data.slice()}}const i=new h(this,l,o,t);s.call(void 0,i)}this.resetState(i)},this.shouldReorder=(t,e,i)=>{const s=this.thresholdRect(t);return s&&e>s.left&&e<s.right&&i>s.top&&i<s.bottom},this.thresholdRect=t=>{const e=this.state.activeId,i=this.container,s=(i?Array.from(i.childNodes):[]).find(t=>t instanceof HTMLElement&&t.getAttribute(I)===e);if(!t||!s)return null;const{width:n,height:r}=s.getBoundingClientRect(),a=t.getBoundingClientRect(),o=a.top+a.height/2-r/2,l=a.left+a.width/2-n/2;return{top:o,left:l,bottom:o+r,right:l+n}},this.onItemBlur=()=>{window.setTimeout(()=>{this.isUnmounted||this.shouldResetActive()&&!this.state.isDragging&&this.setState({activeId:""})})},this.onItemFocus=t=>{const{id:e,element:i}=this.closestSortableItem(t.currentTarget);!this.idComparer(e,this.state.activeId)&&this.isSameSortable(t.target)&&i===t.target&&this.setState({activeId:e})},this.resetState=t=>{this.isDragPrevented=!1,this.setState({clientX:0,clientY:0,isDragging:!1,dragCueWidth:0,dragCueHeight:0,activeId:t?"":this.state.activeId})},this.renderData=()=>{const{data:t,itemUI:e,idField:i,tabIndex:n,navigatable:r}=this.props;return t.map(t=>{const o=s.getter(i)(t),l=this.isItemDisabled(t),d=this.idComparer(this.state.activeId,o),h=r?d?0:-1:n;return a.createElement(e,{key:o,forwardRef:t=>this.refAssign(t,o),dataItem:t,isDisabled:l,isActive:d,isDragged:d&&this.state.isDragging,isDragCue:!1,attributes:{[I]:o,"aria-disabled":l,"aria-grabbed":d&&this.state.isDragging&&!this.isDragPrevented,"aria-dropeffect":l?"none":"move",tabIndex:s.getTabIndex(h,l),onFocus:this.onItemFocus,onBlur:this.onItemBlur},style:{cursor:l?"auto":"move",MozUserSelect:"none",msUserSelect:"none",WebkitUserSelect:"none",userSelect:"none"}})})},this.renderNoData=()=>{const{emptyItemUI:t}=this.props,e=n.provideLocalizationService(this).toLanguageString(g,m[g]);if(t)return a.createElement(t,{message:e})},this.renderDragCue=()=>{const{itemUI:t}=this.props,{isDragging:e,activeId:i,clientX:s,clientY:n}=this.state,r=this.findItem(i);if(e&&r)return a.createElement(t,{dataItem:r,isDisabled:!1,isActive:!0,isDragged:!0,isDragCue:!0,style:{position:"fixed",top:n+10,left:s+10,width:this.state.dragCueWidth,height:this.state.dragCueHeight},attributes:{}})},this.refAssign=(t,e)=>{t?this.itemRefsMap[e]=t:delete this.itemRefsMap[e]},this.draggableRefAssign=t=>{this.draggableRef=t},this.onKeyDown=t=>{var e,i,n;const{data:r,idField:a}=this.props,{activeId:o}=this.state,l=r.filter(t=>!this.isItemDisabled(t)),d=u(l,t=>this.idComparer(t[a],o)),h=d<0?0:d;t.key===s.KEYS.tab&&s.getActiveElement(document)!==(null==(e=this.draggableRef)?void 0:e.element)&&(t.preventDefault(),t.stopPropagation()),this.navigation&&null!=(i=this.draggableRef)&&i.element&&this.navigation.triggerKeyboardEvent({target:null==(n=this.draggableRef)?void 0:n.element.querySelectorAll(S)[h],key:t.key,nativeEvent:{type:t.type},originalEvent:t})},this.handleNext=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"next"):e.focusNext(t))},this.handlePrev=(t,e,i)=>{var n;s.getActiveElement(document)!==(null==(n=this.draggableRef)?void 0:n.element)&&(i.originalEvent.metaKey?this.moveItem(t,e,i,"prev"):e.focusPrevious(t))},this.moveItem=(t,e,i,n)=>{var r;if(s.getActiveElement(document)!==(null==(r=this.draggableRef)?void 0:r.element)){const{onNavigate:t,data:e,idField:i}=this.props,s=this.findIndex(this.state.activeId);if(t){let r,a;"next"===n?(r=e[s+1],a=r&&r.disabled?e[s+2]:e[s+1]):(r=e[s-1],a=r&&r.disabled?e[s-2]:e[s-1]);const o=a&&a[i],l=e[s],d=l?l[i]:"",h=this.findIndex(d),g=this.findIndex(o||d),m=new c(this,h,g,this.generateNewState(h,g));this.isKeyboardNavigated=!0,t.call(void 0,m)}}},this.showLicenseWatermark=!s.validatePackage(b,{component:"Sortable"}),this.licenseMessage=s.getLicenseMessage(b),this.onKeyDown=this.onKeyDown.bind(this)}get container(){return this.draggableRef&&this.draggableRef.element}getSnapshotBeforeUpdate(){const{idField:t,animation:e}=this.props;return this.oldSizesMap={},e&&this.props.data.forEach(e=>{const i=e[t],s=this.itemRefsMap[i];s&&(this.oldSizesMap[i]=s.getBoundingClientRect())}),null}componentDidUpdate(t){const{idField:e,animation:i}=this.props;this.focusActiveId&&(this.focusActiveId=!1,this.itemRefsMap[this.state.activeId].focus()),i&&(this.state.isDragging||this.isKeyboardNavigated)&&(this.isKeyboardNavigated=!1,t.data.forEach(t=>{const i=t[e],s=this.itemRefsMap[i];if(!s)return;const n=s.getBoundingClientRect(),r=this.oldSizesMap[i],a=r.left-n.left,o=r.top-n.top;0===a&&0===o||requestAnimationFrame(()=>{this.animatingItemMap[i]=!0,s.style.transform=`translate(${a}px, ${o}px)`,s.style.transition="transform 0s",requestAnimationFrame(()=>{s.style.transform="",s.style.transition="transform 200ms cubic-bezier(0.2, 0, 0, 1) 0s",this.windowTimeout(i)})})}))}componentDidMount(){var t,e;null!=(t=this.draggableRef)&&t.element&&(this.navigation=new s.Navigation({tabIndex:0,root:{current:null==(e=this.draggableRef)?void 0:e.element},rovingTabIndex:!0,selectors:[S],keyboardEvents:{keydown:{ArrowDown:this.handleNext,ArrowRight:this.handleNext,ArrowUp:this.handlePrev,ArrowLeft:this.handlePrev,Enter:(t,e,i)=>{e.focusElement(e.first,t)},Escape:(t,e,i)=>{var s,n;t.setAttribute("tabindex","-1"),null==(n=null==(s=this.draggableRef)?void 0:s.element)||n.focus(),this.setState({activeId:""})}}}})),this.isRtl=this.container&&"rtl"===getComputedStyle(this.container).direction||!1}componentWillUnmount(){this.isUnmounted=!0}parentOffset(){const t=this.offsetParent;if(t&&t.ownerDocument&&t!==t.ownerDocument.body){const e=t.getBoundingClientRect();return{left:e.left-t.scrollLeft,top:e.top-t.scrollTop}}return{left:0,top:0}}render(){const{data:t,style:e,className:i,itemsWrapUI:n,tabIndex:r,navigatable:o}=this.props,l=n||"div";return a.createElement(s.Draggable,{onDragStart:this.onDragStart,onDrag:this.onDragOver,onDragEnd:this.onDragEnd,ref:this.draggableRefAssign},a.createElement(l,{onKeyDown:t=>o&&this.onKeyDown(t),...w,className:i,style:{position:"relative",touchAction:"none",...e},tabIndex:o?r||0:void 0},t&&t.length?this.renderData():this.renderNoData(),this.renderDragCue(),this.showLicenseWatermark&&a.createElement(s.WatermarkOverlay,{message:this.licenseMessage})))}};y.defaultProps={navigation:!0,animation:!0,emptyItemUI:t=>a.createElement("div",null,t.message)},y.propTypes={idField:i.string.isRequired,disabledField:i.string,data:i.array.isRequired,tabIndex:i.number,navigation:i.bool,animation:i.bool,itemsWrapUI:i.any,itemUI:i.func.isRequired,emptyItemUI:i.func,style:i.object,className:i.string,onDragStart:i.func,onDragOver:i.func,onDragEnd:i.func,onNavigate:i.func};let R=y;n.registerForLocalization(R),t.Sortable=R,t.SortableOnDragEndEvent=h,t.SortableOnDragOverEvent=d,t.SortableOnDragStartEvent=l,t.SortableOnNavigateEvent=c});
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ /**
9
+ * @hidden
10
+ */
11
+ export interface BaseEvent<T extends React.Component> {
12
+ /**
13
+ * An event target.
14
+ */
15
+ target: T;
16
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ /**
9
+ * @hidden
10
+ */
11
+ export declare abstract class PreventableEvent {
12
+ private prevented;
13
+ /**
14
+ * Prevents the default action for a specified event.
15
+ * In this way, the source component suppresses the built-in behavior that follows the event.
16
+ */
17
+ preventDefault(): void;
18
+ /**
19
+ * Returns `true` if the event was prevented by any of its subscribers.
20
+ *
21
+ * @returns - Returns `true` if the default action was prevented.
22
+ * Otherwise, returns `false`.
23
+ */
24
+ isDefaultPrevented(): boolean;
25
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { BaseEvent } from './BaseEvent.js';
9
+ import { Sortable } from '../Sortable.js';
10
+ /**
11
+ * The `SortableOnDragEndEvent` event.
12
+ */
13
+ export declare class SortableOnDragEndEvent implements BaseEvent<Sortable> {
14
+ /**
15
+ * The Sortable component.
16
+ */
17
+ target: Sortable;
18
+ /**
19
+ * The previous index of the dragged item.
20
+ */
21
+ prevIndex: number;
22
+ /**
23
+ * The new index of the dragged item.
24
+ */
25
+ nextIndex: number;
26
+ /**
27
+ * The new state of the Sortable data.
28
+ */
29
+ newState: Array<object>;
30
+ /**
31
+ * @hidden
32
+ */
33
+ constructor(target: Sortable, prevIndex: number, nextIndex: number, newState: Array<object>);
34
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { BaseEvent } from './BaseEvent.js';
9
+ import { Sortable } from '../Sortable.js';
10
+ /**
11
+ * The `SortableOnDragOverEvent` event.
12
+ */
13
+ export declare class SortableOnDragOverEvent implements BaseEvent<Sortable> {
14
+ /**
15
+ * The Sortable component.
16
+ */
17
+ target: Sortable;
18
+ /**
19
+ * The previous index of the dragged item.
20
+ */
21
+ prevIndex: number;
22
+ /**
23
+ * The new index of the dragged item.
24
+ */
25
+ nextIndex: number;
26
+ /**
27
+ * The new state of the Sortable data.
28
+ */
29
+ newState: Array<object>;
30
+ /**
31
+ * @hidden
32
+ */
33
+ constructor(target: Sortable, prevIndex: number, nextIndex: number, newState: Array<object>);
34
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { BaseEvent } from './BaseEvent.js';
9
+ import { Sortable } from '../Sortable.js';
10
+ import { PreventableEvent } from './PreventableEvent.js';
11
+ /**
12
+ * The `SortableOnDragStartEvent` event.
13
+ */
14
+ export declare class SortableOnDragStartEvent extends PreventableEvent implements BaseEvent<Sortable> {
15
+ /**
16
+ * The Sortable component.
17
+ */
18
+ target: Sortable;
19
+ /**
20
+ * The target element.
21
+ */
22
+ element: HTMLElement;
23
+ /**
24
+ * The previous index of the dragged item.
25
+ */
26
+ prevIndex: number;
27
+ /**
28
+ * @hidden
29
+ */
30
+ constructor(target: Sortable, prevIndex: number, element: HTMLElement);
31
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { BaseEvent } from './BaseEvent.js';
9
+ import { Sortable } from '../Sortable.js';
10
+ /**
11
+ * The `SortableOnNavigateEvent` event.
12
+ */
13
+ export declare class SortableOnNavigateEvent implements BaseEvent<Sortable> {
14
+ /**
15
+ * The Sortable component.
16
+ */
17
+ target: Sortable;
18
+ /**
19
+ * The previous index of the dragged item.
20
+ */
21
+ prevIndex: number;
22
+ /**
23
+ * The new index of the dragged item.
24
+ */
25
+ nextIndex: number;
26
+ /**
27
+ * The new state of the Sortable data.
28
+ */
29
+ newState: Array<object>;
30
+ /**
31
+ * @hidden
32
+ */
33
+ constructor(target: Sortable, prevIndex: number, nextIndex: number, newState: Array<object>);
34
+ }