@progress/kendo-react-layout 11.0.0-develop.9 → 11.0.1-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.mts CHANGED
@@ -233,7 +233,7 @@ export declare interface ActionSheetProps {
233
233
  * <ActionSheet subTitle="Subtitle text" />
234
234
  * ```
235
235
  */
236
- subTitle?: string | React_2.ReactNode;
236
+ subTitle?: React_2.ReactNode;
237
237
  /**
238
238
  * Specifies the text that is rendered as title.
239
239
  *
@@ -242,7 +242,7 @@ export declare interface ActionSheetProps {
242
242
  * <ActionSheet title="Title text" />
243
243
  * ```
244
244
  */
245
- title?: string | React_2.ReactNode;
245
+ title?: React_2.ReactNode;
246
246
  /**
247
247
  * **Deprecated**. Fires when the modal overlay is clicked. Use `onClose` event instead.
248
248
  *
@@ -5597,6 +5597,7 @@ export declare class TileLayout extends React_2.Component<TileLayoutProps, TileL
5597
5597
  rowSpan: number;
5598
5598
  colSpan: number;
5599
5599
  } & TilePosition)[];
5600
+ activeHint: boolean;
5600
5601
  };
5601
5602
  /**
5602
5603
  * Gets the HTML element of the TileLayout component.
@@ -5859,6 +5860,7 @@ export declare interface TileLayoutRepositionEvent extends BaseEvent<TileLayout>
5859
5860
  */
5860
5861
  export declare interface TileLayoutState {
5861
5862
  positions: TileStrictPosition[];
5863
+ activeHint?: boolean;
5862
5864
  }
5863
5865
 
5864
5866
  /**
package/index.d.ts CHANGED
@@ -233,7 +233,7 @@ export declare interface ActionSheetProps {
233
233
  * <ActionSheet subTitle="Subtitle text" />
234
234
  * ```
235
235
  */
236
- subTitle?: string | React_2.ReactNode;
236
+ subTitle?: React_2.ReactNode;
237
237
  /**
238
238
  * Specifies the text that is rendered as title.
239
239
  *
@@ -242,7 +242,7 @@ export declare interface ActionSheetProps {
242
242
  * <ActionSheet title="Title text" />
243
243
  * ```
244
244
  */
245
- title?: string | React_2.ReactNode;
245
+ title?: React_2.ReactNode;
246
246
  /**
247
247
  * **Deprecated**. Fires when the modal overlay is clicked. Use `onClose` event instead.
248
248
  *
@@ -5597,6 +5597,7 @@ export declare class TileLayout extends React_2.Component<TileLayoutProps, TileL
5597
5597
  rowSpan: number;
5598
5598
  colSpan: number;
5599
5599
  } & TilePosition)[];
5600
+ activeHint: boolean;
5600
5601
  };
5601
5602
  /**
5602
5603
  * Gets the HTML element of the TileLayout component.
@@ -5859,6 +5860,7 @@ export declare interface TileLayoutRepositionEvent extends BaseEvent<TileLayout>
5859
5860
  */
5860
5861
  export declare interface TileLayoutState {
5861
5862
  positions: TileStrictPosition[];
5863
+ activeHint?: boolean;
5862
5864
  }
5863
5865
 
5864
5866
  /**
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-layout",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1747121261,version:"11.0.0-develop.9",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-layout",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1747918830,version:"11.0.1-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -10,8 +10,8 @@ const e = {
10
10
  productName: "KendoReact",
11
11
  productCode: "KENDOUIREACT",
12
12
  productCodes: ["KENDOUIREACT"],
13
- publishDate: 1747121261,
14
- version: "11.0.0-develop.9",
13
+ publishDate: 1747918830,
14
+ version: "11.0.1-develop.1",
15
15
  licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
16
  };
17
17
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-layout",
3
- "version": "11.0.0-develop.9",
3
+ "version": "11.0.1-develop.1",
4
4
  "description": "React Layout components enable you to create a perceptive and intuitive layout of web projects. KendoReact Layout package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -25,13 +25,13 @@
25
25
  },
26
26
  "sideEffects": false,
27
27
  "peerDependencies": {
28
- "@progress/kendo-licensing": "^1.5.1",
29
- "@progress/kendo-react-animation": "11.0.0-develop.9",
30
- "@progress/kendo-react-buttons": "11.0.0-develop.9",
31
- "@progress/kendo-react-common": "11.0.0-develop.9",
32
- "@progress/kendo-react-intl": "11.0.0-develop.9",
33
- "@progress/kendo-react-popup": "11.0.0-develop.9",
34
- "@progress/kendo-react-progressbars": "11.0.0-develop.9",
28
+ "@progress/kendo-licensing": "^1.6.0",
29
+ "@progress/kendo-react-animation": "11.0.1-develop.1",
30
+ "@progress/kendo-react-buttons": "11.0.1-develop.1",
31
+ "@progress/kendo-react-common": "11.0.1-develop.1",
32
+ "@progress/kendo-react-intl": "11.0.1-develop.1",
33
+ "@progress/kendo-react-popup": "11.0.1-develop.1",
34
+ "@progress/kendo-react-progressbars": "11.0.1-develop.1",
35
35
  "@progress/kendo-svg-icons": "^4.0.0",
36
36
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
37
37
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
@@ -76,7 +76,7 @@
76
76
  "package": {
77
77
  "productName": "KendoReact",
78
78
  "productCode": "KENDOUIREACT",
79
- "publishDate": 1747121261,
79
+ "publishDate": 1747918830,
80
80
  "licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
81
81
  }
82
82
  },
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),l=require("prop-types"),g=require("@progress/kendo-react-common"),b=require("./ResizeHandlers.js");function x(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const e in c)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(c,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>c[e]})}}return t.default=c,Object.freeze(t)}const p=x(y),f=200,h=class h extends p.Component{constructor(){super(...arguments),this.state={rtl:!1},this.oldSize={},this.draggable=null,this.dragging=!1,this.resizing=!1,this.element=null,this.hintElement=null,this.ignoreDrag=!1,this.pressOffset={x:0,y:0},this.pressXY={x:0,y:0},this.currentTranslate={x:0,y:0},this.preventDataOps=void 0,this.handleResize=(t,e)=>{if(e.end){this.handleRelease();return}if(!this.element||!this.hintElement)return;const s=t.clientX,n=t.clientY;this.resizing=!0;const a=(e.direction!=="ns"?s-this.pressXY.x:0)*(this.state.rtl?-1:1),i=e.direction!=="ew"?n-this.pressXY.y:0;if(this.dragElement&&(this.state.rtl?this.dragElement.style.marginLeft=-a+"px":this.dragElement.style.marginRight=-a+"px",this.dragElement.style.height=`calc(100% + ${i}px)`),this.hintElement.classList.add("k-layout-item-hint-resize"),this.preventDataOps)return;let r=0,o=0;const d=this.element.getBoundingClientRect();a>d.width/this.props.defaultPosition.colSpan/3&&(r=1),a<-d.width/this.props.defaultPosition.colSpan/1.25&&(r=-1),i>d.height/this.props.defaultPosition.rowSpan/3&&(o=1),i<-d.height/this.props.defaultPosition.rowSpan/1.25&&(o=-1),(r!==0||o!==0)&&this.props.update(this.props.index,0,0,o,r)},this.handlePress=t=>{if(!this.dragElement)return;if(this.pressXY={x:t.event.clientX,y:t.event.clientY},this.ignoreDrag=!1,this.props.ignoreDrag&&this.props.ignoreDrag(t.event.originalEvent)){this.ignoreDrag=!0;return}this.element&&this.hintElement&&(this.element.style.zIndex="10",this.hintElement.style.display="block"),this.dragElement.classList.remove("k-cursor-grab"),this.dragElement.classList.add("k-cursor-grabbing");const e=this.dragElement.getBoundingClientRect();this.pressOffset={x:t.event.clientX-e.x,y:t.event.clientY-e.y}},this.handleDrag=t=>{if(this.ignoreDrag)return;const e=this.dragElement;if(t.event.originalEvent.defaultPrevented||!e)return;this.dragging=!0,t.event.originalEvent.preventDefault();const s=e.getBoundingClientRect();if(this.currentTranslate={x:t.event.clientX-s.x-this.pressOffset.x+this.currentTranslate.x,y:t.event.clientY-s.y-this.pressOffset.y+this.currentTranslate.y},e.style.transform=`translate(${this.currentTranslate.x}px, ${this.currentTranslate.y}px)`,e.style.transition="transform 0s",this.preventDataOps)return;let n=0,a=0;this.currentTranslate.y>.7*s.height/this.props.defaultPosition.rowSpan&&(a=1),this.currentTranslate.y<.7*-s.height/this.props.defaultPosition.rowSpan&&(a=-1),this.currentTranslate.x>.7*s.width/this.props.defaultPosition.colSpan&&(n=1),this.currentTranslate.x<.7*-s.width/this.props.defaultPosition.colSpan&&(n=-1),this.props.update(this.props.index,a,this.state.rtl?-n:n,0,0)},this.handleRelease=()=>{this.dragging=this.resizing=!1,this.currentTranslate={x:0,y:0},this.element&&this.hintElement&&(this.element.style.zIndex="1",this.hintElement.classList.remove("k-layout-item-hint-resize"),this.hintElement.style.display="none");const t=this.dragElement;t&&(t.style.transform="translate(0px, 0px)",t.style.transition=`transform ${f}ms cubic-bezier(0.2, 0, 0, 1) 0s`,t.style.marginRight="0px",t.style.marginLeft="0px",t.style.height="100%",t.classList.remove("k-cursor-grabbing"),t.classList.add("k-cursor-grab"))}}get reorderable(){return this.props.reorderable!==void 0?this.props.reorderable:h.defaultProps.reorderable}get dragElement(){return this.draggable?this.draggable.element:void 0}componentDidMount(){this.element&&(getComputedStyle(this.element).direction==="rtl"&&this.setState({rtl:!0}),this.hintElement&&(this.hintElement.style.height=this.element.offsetHeight+"px",this.hintElement.style.width=this.element.offsetWidth+"px"))}render(){g.canUseDOM&&clearTimeout&&typeof clearTimeout=="function"&&(clearTimeout(this.preventDataOps),this.preventDataOps=window.setTimeout(()=>{this.preventDataOps=void 0},200));const t=this.props.defaultPosition,e=this.props.resizable!==void 0?this.props.resizable:h.defaultProps.resizable,s={gridColumnStart:t.col,gridColumnEnd:`span ${t.colSpan}`,gridRowStart:t.row,gridRowEnd:`span ${t.rowSpan}`,outline:"none",order:t.order,display:"none",...this.props.hintStyle},n={gridColumnStart:t.col,gridColumnEnd:`span ${t.colSpan}`,gridRowStart:t.row,gridRowEnd:`span ${t.rowSpan}`,order:t.order},a=p.createElement("div",{ref:i=>{this.draggable=i?{element:i}:null},className:g.classNames("k-tilelayout-item k-card",{"k-cursor-grab":this.reorderable},this.props.className),style:{height:"100%",...n,...this.props.style}},this.props.children,p.createElement(b.ResizeHandlers,{onPress:this.handlePress,onResize:this.handleResize,resizable:e,rtl:this.state.rtl}));return p.createElement("div",{ref:i=>{this.element=i},style:n},p.createElement("div",{ref:i=>{this.hintElement=i},style:{position:"absolute",...s},className:g.classNames("k-layout-item-hint",this.props.hintClassName)}),p.createElement(g.Draggable,{ref:i=>{this.draggable=i},onDrag:this.props.reorderable?this.handleDrag:void 0,onRelease:this.props.reorderable?this.handleRelease:void 0,onPress:this.props.reorderable?this.handlePress:void 0},a))}getSnapshotBeforeUpdate(t){return this.oldSize={},this.dragElement&&(this.oldSize=this.dragElement.getBoundingClientRect()),null}componentDidUpdate(t){const e=this.dragElement;if(!e)return;const s=e.getBoundingClientRect(),n=this.oldSize;if(this.resizing){const r=s.width-n.width;if(this.state.rtl){const u=parseFloat(e.style.marginLeft||"0");e.style.marginLeft=u-r+"px"}else{const u=parseFloat(e.style.marginRight||"0");e.style.marginRight=u+r+"px"}this.pressXY.x+=this.state.rtl?-r:r;const o=s.height-n.height,d=parseFloat(e.style.height.substring(12));e.style.height=`calc(100% + ${d+o}px)`,this.pressXY.y+=o}const a=n.left-s.left,i=n.top-s.top;if(!(a===0&&i===0)){if(this.dragging){(t.defaultPosition.order!==this.props.defaultPosition.order||t.defaultPosition.col!==this.props.defaultPosition.col)&&(this.currentTranslate.x=0,this.currentTranslate.y=0,e.style.transform="");return}Math.abs(i)<15&&Math.abs(a)<15||requestAnimationFrame(()=>{const r=this.element;r&&(r.style.transform=`translate(${a}px, ${i}px)`,r.style.transition="transform 0s",requestAnimationFrame(()=>{r.style.transform="",r.style.transition=`transform ${f}ms cubic-bezier(0.2, 0, 0, 1) 0s`}))})}}};h.propTypes={defaultPosition:l.object.isRequired,style:l.object,className:l.string,hintStyle:l.object,hintClassName:l.string,header:l.any,body:l.any,item:l.any,resizable:l.oneOf(["horizontal","vertical",!0,!1]),reorderable:l.bool},h.displayName="KendoTileLayoutItem",h.defaultProps={resizable:!0,reorderable:!0};let m=h;exports.InternalTile=m;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),a=require("prop-types"),u=require("@progress/kendo-react-common"),b=require("./ResizeHandlers.js");function E(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const e in c)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(c,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>c[e]})}}return t.default=c,Object.freeze(t)}const d=E(y),f=200,p=class p extends d.Component{constructor(){super(...arguments),this.state={rtl:!1,visibleHint:!1},this.oldSize={},this.draggable=null,this.dragging=!1,this.resizing=!1,this.element=null,this.hintElement=null,this.ignoreDrag=!1,this.pressOffset={x:0,y:0},this.pressXY={x:0,y:0},this.currentTranslate={x:0,y:0},this.preventDataOps=void 0,this.handleResize=(t,e)=>{if(e.end){this.handleRelease();return}if(!this.element||!this.hintElement)return;const s=t.clientX,l=t.clientY;this.resizing=!0;const r=(e.direction!=="ns"?s-this.pressXY.x:0)*(this.state.rtl?-1:1),i=e.direction!=="ew"?l-this.pressXY.y:0;if(this.dragElement&&(this.state.rtl?this.dragElement.style.marginLeft=-r+"px":this.dragElement.style.marginRight=-r+"px",this.dragElement.style.height=`calc(100% + ${i}px)`),this.hintElement.classList.add("k-layout-item-hint-resize"),this.preventDataOps)return;let n=0,o=0;const h=this.element.getBoundingClientRect();r>h.width/this.props.defaultPosition.colSpan/3&&(n=1),r<-h.width/this.props.defaultPosition.colSpan/1.25&&(n=-1),i>h.height/this.props.defaultPosition.rowSpan/3&&(o=1),i<-h.height/this.props.defaultPosition.rowSpan/1.25&&(o=-1),(n!==0||o!==0)&&this.props.update(this.props.index,0,0,o,n)},this.handlePress=t=>{if(!this.dragElement)return;if(this.pressXY={x:t.event.clientX,y:t.event.clientY},this.ignoreDrag=!1,this.props.ignoreDrag&&this.props.ignoreDrag(t.event.originalEvent)){this.ignoreDrag=!0;return}this.element&&(this.element.style.zIndex="10",this.setState({visibleHint:!0})),this.dragElement.classList.remove("k-cursor-move"),this.dragElement.classList.add("k-cursor-grabbing");const e=this.dragElement.getBoundingClientRect();this.pressOffset={x:t.event.clientX-e.x,y:t.event.clientY-e.y},this.props.onPress()},this.handleDrag=t=>{var n;if(this.ignoreDrag)return;const e=this.dragElement;if(t.event.originalEvent.defaultPrevented||!e)return;this.dragging=!0,t.event.originalEvent.preventDefault();const s=e.getBoundingClientRect();if(this.currentTranslate={x:t.event.clientX-s.x-this.pressOffset.x+this.currentTranslate.x,y:t.event.clientY-s.y-this.pressOffset.y+this.currentTranslate.y},e.style.transform=`translate(${this.currentTranslate.x}px, ${this.currentTranslate.y}px)`,e.style.transition="transform 0s",this.preventDataOps)return;let l=0,r=0;this.currentTranslate.y>.7*s.height/this.props.defaultPosition.rowSpan&&(r=1),this.currentTranslate.y<.7*-s.height/this.props.defaultPosition.rowSpan&&(r=-1),this.currentTranslate.x>.7*s.width/this.props.defaultPosition.colSpan&&(l=1),this.currentTranslate.x<.7*-s.width/this.props.defaultPosition.colSpan&&(l=-1),this.props.update(this.props.index,r,this.state.rtl?-l:l,0,0);const i=(n=this.element)==null?void 0:n.closest(".k-tilelayout");if(i&&this.hintElement){const o=i.getBoundingClientRect(),h=u.getScrollbarWidth()||50;t.event.clientX<o.left-h||t.event.clientX>o.right-h||t.event.clientY<o.top||t.event.clientY>o.bottom?this.hintElement.style.display="none":this.hintElement.style.display="block"}},this.handleRelease=()=>{this.dragging=this.resizing=!1,this.currentTranslate={x:0,y:0},this.element&&this.hintElement&&(this.element.style.zIndex="1",this.hintElement.classList.remove("k-layout-item-hint-resize"),this.setState({visibleHint:!1}));const t=this.dragElement;t&&(t.style.transform="translate(0px, 0px)",t.style.transition=`transform ${f}ms cubic-bezier(0.2, 0, 0, 1) 0s`,t.style.marginRight="0px",t.style.marginLeft="0px",t.style.height="100%",t.classList.remove("k-cursor-grabbing"),t.classList.add("k-cursor-move")),this.props.onRelease()},this.handleMouseDown=()=>{this.setInitialHintPosition()},this.handleMouseUp=()=>{setTimeout(()=>{this.setInitialHintPosition()},100)},this.calcNewHintPosition=()=>{if(!this.dragElement||!this.hintElement)return;const t=this.dragElement.getBoundingClientRect(),e=t.top+this.currentTranslate.y,s=t.left+this.currentTranslate.x;this.hintElement.style.top=`${e}px`,this.hintElement.style.left=`${s}px`,this.hintElement.style.display="block"}}get reorderable(){return this.props.reorderable!==void 0?this.props.reorderable:p.defaultProps.reorderable}get dragElement(){return this.draggable?this.draggable.element:void 0}componentDidMount(){this.element&&(getComputedStyle(this.element).direction==="rtl"&&this.setState({rtl:!0}),this.hintElement&&(this.hintElement.style.height=this.element.offsetHeight+"px",this.hintElement.style.width=this.element.offsetWidth+"px"))}render(){u.canUseDOM&&clearTimeout&&typeof clearTimeout=="function"&&(clearTimeout(this.preventDataOps),this.preventDataOps=window.setTimeout(()=>{this.preventDataOps=void 0},200));const t=this.props.defaultPosition,e=this.props.resizable!==void 0?this.props.resizable:p.defaultProps.resizable,s={gridColumnStart:t.col,gridColumnEnd:`span ${t.colSpan}`,gridRowStart:t.row,gridRowEnd:`span ${t.rowSpan}`,outline:"none",order:t.order,display:"block",...this.props.hintStyle},l={gridColumnStart:t.col,gridColumnEnd:`span ${t.colSpan}`,gridRowStart:t.row,gridRowEnd:`span ${t.rowSpan}`,order:t.order},r=d.createElement("div",{ref:i=>{this.draggable=i?{element:i}:null},role:"listitem",tabIndex:0,"aria-labelledby":typeof this.props.header=="string"?this.props.header:`tile-${this.props.index}`,"aria-keyshortcuts":"Enter",className:u.classNames("k-tilelayout-item k-card",{"k-cursor-move":this.reorderable},this.props.className),style:{height:"100%",...l,...this.props.style},onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp},this.props.children,d.createElement(b.ResizeHandlers,{onPress:this.handlePress,onResize:this.handleResize,resizable:e,rtl:this.state.rtl}));return d.createElement(d.Fragment,null,this.state.visibleHint&&d.createElement("div",{ref:i=>{this.hintElement=i},style:{position:"fixed",...s},className:u.classNames("k-layout-item-hint",this.props.hintClassName)}),d.createElement(u.Draggable,{ref:i=>{this.draggable=i,this.element=i?i.element:null},onDrag:this.props.reorderable?this.handleDrag:void 0,onRelease:this.props.reorderable?this.handleRelease:void 0,onPress:this.props.reorderable?this.handlePress:void 0},r))}getSnapshotBeforeUpdate(t){return this.oldSize={},this.dragElement&&(this.oldSize=this.dragElement.getBoundingClientRect()),null}setInitialHintPosition(){if(this.element&&this.hintElement){const t=this.element.getBoundingClientRect();this.hintElement.style.top=t.top+"px",this.hintElement.style.left=t.left+"px",this.hintElement.style.height=this.element.offsetHeight+"px",this.hintElement.style.width=this.element.offsetWidth+"px"}}componentDidUpdate(t){const e=this.dragElement;if(!e)return;const s=e.getBoundingClientRect(),l=this.oldSize;if(this.resizing){const n=s.width-l.width;if(this.state.rtl){const g=parseFloat(e.style.marginLeft||"0");e.style.marginLeft=g-n+"px"}else{const g=parseFloat(e.style.marginRight||"0");e.style.marginRight=g+n+"px"}this.pressXY.x+=this.state.rtl?-n:n;const o=s.height-l.height,h=parseFloat(e.style.height.substring(12));e.style.height=`calc(100% + ${h+o}px)`,this.pressXY.y+=o}const r=l.left-s.left,i=l.top-s.top;if(!(r===0&&i===0)){if(this.dragging){(t.defaultPosition.order!==this.props.defaultPosition.order||t.defaultPosition.col!==this.props.defaultPosition.col)&&(this.currentTranslate.x=0,this.currentTranslate.y=0,e.style.transform="",this.calcNewHintPosition());return}Math.abs(i)<15&&Math.abs(r)<15||requestAnimationFrame(()=>{const n=this.element;n&&(n.style.transform=`translate(${r}px, ${i}px)`,n.style.transition="transform 0s",requestAnimationFrame(()=>{n.style.transform="",n.style.transition=`transform ${f}ms cubic-bezier(0.2, 0, 0, 1) 0s`}))})}}};p.propTypes={defaultPosition:a.object.isRequired,style:a.object,className:a.string,hintStyle:a.object,hintClassName:a.string,header:a.any,body:a.any,item:a.any,resizable:a.oneOf(["horizontal","vertical",!0,!1]),reorderable:a.bool},p.displayName="KendoTileLayoutItem",p.defaultProps={resizable:!0,reorderable:!0};let m=p;exports.InternalTile=m;
@@ -5,14 +5,15 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as p from "react";
9
- import l from "prop-types";
10
- import { canUseDOM as u, classNames as g, Draggable as y } from "@progress/kendo-react-common";
11
- import { ResizeHandlers as b } from "./ResizeHandlers.mjs";
12
- const m = 200, h = class h extends p.Component {
8
+ import * as d from "react";
9
+ import a from "prop-types";
10
+ import { getScrollbarWidth as f, canUseDOM as y, classNames as m, Draggable as x } from "@progress/kendo-react-common";
11
+ import { ResizeHandlers as E } from "./ResizeHandlers.mjs";
12
+ const g = 200, p = class p extends d.Component {
13
13
  constructor() {
14
14
  super(...arguments), this.state = {
15
- rtl: !1
15
+ rtl: !1,
16
+ visibleHint: !1
16
17
  }, this.oldSize = {}, this.draggable = null, this.dragging = !1, this.resizing = !1, this.element = null, this.hintElement = null, this.ignoreDrag = !1, this.pressOffset = { x: 0, y: 0 }, this.pressXY = { x: 0, y: 0 }, this.currentTranslate = { x: 0, y: 0 }, this.preventDataOps = void 0, this.handleResize = (t, e) => {
17
18
  if (e.end) {
18
19
  this.handleRelease();
@@ -20,14 +21,14 @@ const m = 200, h = class h extends p.Component {
20
21
  }
21
22
  if (!this.element || !this.hintElement)
22
23
  return;
23
- const i = t.clientX, n = t.clientY;
24
+ const n = t.clientX, l = t.clientY;
24
25
  this.resizing = !0;
25
- const a = (e.direction !== "ns" ? i - this.pressXY.x : 0) * (this.state.rtl ? -1 : 1), s = e.direction !== "ew" ? n - this.pressXY.y : 0;
26
- if (this.dragElement && (this.state.rtl ? this.dragElement.style.marginLeft = -a + "px" : this.dragElement.style.marginRight = -a + "px", this.dragElement.style.height = `calc(100% + ${s}px)`), this.hintElement.classList.add("k-layout-item-hint-resize"), this.preventDataOps)
26
+ const r = (e.direction !== "ns" ? n - this.pressXY.x : 0) * (this.state.rtl ? -1 : 1), s = e.direction !== "ew" ? l - this.pressXY.y : 0;
27
+ if (this.dragElement && (this.state.rtl ? this.dragElement.style.marginLeft = -r + "px" : this.dragElement.style.marginRight = -r + "px", this.dragElement.style.height = `calc(100% + ${s}px)`), this.hintElement.classList.add("k-layout-item-hint-resize"), this.preventDataOps)
27
28
  return;
28
- let r = 0, o = 0;
29
- const d = this.element.getBoundingClientRect();
30
- a > d.width / this.props.defaultPosition.colSpan / 3 && (r = 1), a < -d.width / this.props.defaultPosition.colSpan / 1.25 && (r = -1), s > d.height / this.props.defaultPosition.rowSpan / 3 && (o = 1), s < -d.height / this.props.defaultPosition.rowSpan / 1.25 && (o = -1), (r !== 0 || o !== 0) && this.props.update(this.props.index, 0, 0, o, r);
29
+ let i = 0, o = 0;
30
+ const h = this.element.getBoundingClientRect();
31
+ r > h.width / this.props.defaultPosition.colSpan / 3 && (i = 1), r < -h.width / this.props.defaultPosition.colSpan / 1.25 && (i = -1), s > h.height / this.props.defaultPosition.rowSpan / 3 && (o = 1), s < -h.height / this.props.defaultPosition.rowSpan / 1.25 && (o = -1), (i !== 0 || o !== 0) && this.props.update(this.props.index, 0, 0, o, i);
31
32
  }, this.handlePress = (t) => {
32
33
  if (!this.dragElement)
33
34
  return;
@@ -38,35 +39,52 @@ const m = 200, h = class h extends p.Component {
38
39
  this.ignoreDrag = !0;
39
40
  return;
40
41
  }
41
- this.element && this.hintElement && (this.element.style.zIndex = "10", this.hintElement.style.display = "block"), this.dragElement.classList.remove("k-cursor-grab"), this.dragElement.classList.add("k-cursor-grabbing");
42
+ this.element && (this.element.style.zIndex = "10", this.setState({ visibleHint: !0 })), this.dragElement.classList.remove("k-cursor-move"), this.dragElement.classList.add("k-cursor-grabbing");
42
43
  const e = this.dragElement.getBoundingClientRect();
43
44
  this.pressOffset = {
44
45
  x: t.event.clientX - e.x,
45
46
  y: t.event.clientY - e.y
46
- };
47
+ }, this.props.onPress();
47
48
  }, this.handleDrag = (t) => {
49
+ var i;
48
50
  if (this.ignoreDrag)
49
51
  return;
50
52
  const e = this.dragElement;
51
53
  if (t.event.originalEvent.defaultPrevented || !e)
52
54
  return;
53
55
  this.dragging = !0, t.event.originalEvent.preventDefault();
54
- const i = e.getBoundingClientRect();
56
+ const n = e.getBoundingClientRect();
55
57
  if (this.currentTranslate = {
56
- x: t.event.clientX - i.x - this.pressOffset.x + this.currentTranslate.x,
57
- y: t.event.clientY - i.y - this.pressOffset.y + this.currentTranslate.y
58
+ x: t.event.clientX - n.x - this.pressOffset.x + this.currentTranslate.x,
59
+ y: t.event.clientY - n.y - this.pressOffset.y + this.currentTranslate.y
58
60
  }, e.style.transform = `translate(${this.currentTranslate.x}px, ${this.currentTranslate.y}px)`, e.style.transition = "transform 0s", this.preventDataOps)
59
61
  return;
60
- let n = 0, a = 0;
61
- this.currentTranslate.y > 0.7 * i.height / this.props.defaultPosition.rowSpan && (a = 1), this.currentTranslate.y < 0.7 * -i.height / this.props.defaultPosition.rowSpan && (a = -1), this.currentTranslate.x > 0.7 * i.width / this.props.defaultPosition.colSpan && (n = 1), this.currentTranslate.x < 0.7 * -i.width / this.props.defaultPosition.colSpan && (n = -1), this.props.update(this.props.index, a, this.state.rtl ? -n : n, 0, 0);
62
+ let l = 0, r = 0;
63
+ this.currentTranslate.y > 0.7 * n.height / this.props.defaultPosition.rowSpan && (r = 1), this.currentTranslate.y < 0.7 * -n.height / this.props.defaultPosition.rowSpan && (r = -1), this.currentTranslate.x > 0.7 * n.width / this.props.defaultPosition.colSpan && (l = 1), this.currentTranslate.x < 0.7 * -n.width / this.props.defaultPosition.colSpan && (l = -1), this.props.update(this.props.index, r, this.state.rtl ? -l : l, 0, 0);
64
+ const s = (i = this.element) == null ? void 0 : i.closest(".k-tilelayout");
65
+ if (s && this.hintElement) {
66
+ const o = s.getBoundingClientRect(), h = f() || 50;
67
+ t.event.clientX < o.left - h || t.event.clientX > o.right - h || t.event.clientY < o.top || t.event.clientY > o.bottom ? this.hintElement.style.display = "none" : this.hintElement.style.display = "block";
68
+ }
62
69
  }, this.handleRelease = () => {
63
- this.dragging = this.resizing = !1, this.currentTranslate = { x: 0, y: 0 }, this.element && this.hintElement && (this.element.style.zIndex = "1", this.hintElement.classList.remove("k-layout-item-hint-resize"), this.hintElement.style.display = "none");
70
+ this.dragging = this.resizing = !1, this.currentTranslate = { x: 0, y: 0 }, this.element && this.hintElement && (this.element.style.zIndex = "1", this.hintElement.classList.remove("k-layout-item-hint-resize"), this.setState({ visibleHint: !1 }));
64
71
  const t = this.dragElement;
65
- t && (t.style.transform = "translate(0px, 0px)", t.style.transition = `transform ${m}ms cubic-bezier(0.2, 0, 0, 1) 0s`, t.style.marginRight = "0px", t.style.marginLeft = "0px", t.style.height = "100%", t.classList.remove("k-cursor-grabbing"), t.classList.add("k-cursor-grab"));
72
+ t && (t.style.transform = "translate(0px, 0px)", t.style.transition = `transform ${g}ms cubic-bezier(0.2, 0, 0, 1) 0s`, t.style.marginRight = "0px", t.style.marginLeft = "0px", t.style.height = "100%", t.classList.remove("k-cursor-grabbing"), t.classList.add("k-cursor-move")), this.props.onRelease();
73
+ }, this.handleMouseDown = () => {
74
+ this.setInitialHintPosition();
75
+ }, this.handleMouseUp = () => {
76
+ setTimeout(() => {
77
+ this.setInitialHintPosition();
78
+ }, 100);
79
+ }, this.calcNewHintPosition = () => {
80
+ if (!this.dragElement || !this.hintElement)
81
+ return;
82
+ const t = this.dragElement.getBoundingClientRect(), e = t.top + this.currentTranslate.y, n = t.left + this.currentTranslate.x;
83
+ this.hintElement.style.top = `${e}px`, this.hintElement.style.left = `${n}px`, this.hintElement.style.display = "block";
66
84
  };
67
85
  }
68
86
  get reorderable() {
69
- return this.props.reorderable !== void 0 ? this.props.reorderable : h.defaultProps.reorderable;
87
+ return this.props.reorderable !== void 0 ? this.props.reorderable : p.defaultProps.reorderable;
70
88
  }
71
89
  get dragElement() {
72
90
  return this.draggable ? this.draggable.element : void 0;
@@ -77,40 +95,46 @@ const m = 200, h = class h extends p.Component {
77
95
  }), this.hintElement && (this.hintElement.style.height = this.element.offsetHeight + "px", this.hintElement.style.width = this.element.offsetWidth + "px"));
78
96
  }
79
97
  render() {
80
- u && clearTimeout && typeof clearTimeout == "function" && (clearTimeout(this.preventDataOps), this.preventDataOps = window.setTimeout(() => {
98
+ y && clearTimeout && typeof clearTimeout == "function" && (clearTimeout(this.preventDataOps), this.preventDataOps = window.setTimeout(() => {
81
99
  this.preventDataOps = void 0;
82
100
  }, 200));
83
- const t = this.props.defaultPosition, e = this.props.resizable !== void 0 ? this.props.resizable : h.defaultProps.resizable, i = {
101
+ const t = this.props.defaultPosition, e = this.props.resizable !== void 0 ? this.props.resizable : p.defaultProps.resizable, n = {
84
102
  gridColumnStart: t.col,
85
103
  gridColumnEnd: `span ${t.colSpan}`,
86
104
  gridRowStart: t.row,
87
105
  gridRowEnd: `span ${t.rowSpan}`,
88
106
  outline: "none",
89
107
  order: t.order,
90
- display: "none",
108
+ display: "block",
91
109
  ...this.props.hintStyle
92
- }, n = {
110
+ }, l = {
93
111
  gridColumnStart: t.col,
94
112
  gridColumnEnd: `span ${t.colSpan}`,
95
113
  gridRowStart: t.row,
96
114
  gridRowEnd: `span ${t.rowSpan}`,
97
115
  order: t.order
98
- }, a = /* @__PURE__ */ p.createElement(
116
+ }, r = /* @__PURE__ */ d.createElement(
99
117
  "div",
100
118
  {
101
119
  ref: (s) => {
102
120
  this.draggable = s ? { element: s } : null;
103
121
  },
104
- className: g(
122
+ role: "listitem",
123
+ tabIndex: 0,
124
+ "aria-labelledby": typeof this.props.header == "string" ? this.props.header : `tile-${this.props.index}`,
125
+ "aria-keyshortcuts": "Enter",
126
+ className: m(
105
127
  "k-tilelayout-item k-card",
106
- { "k-cursor-grab": this.reorderable },
128
+ { "k-cursor-move": this.reorderable },
107
129
  this.props.className
108
130
  ),
109
- style: { height: "100%", ...n, ...this.props.style }
131
+ style: { height: "100%", ...l, ...this.props.style },
132
+ onMouseDown: this.handleMouseDown,
133
+ onMouseUp: this.handleMouseUp
110
134
  },
111
135
  this.props.children,
112
- /* @__PURE__ */ p.createElement(
113
- b,
136
+ /* @__PURE__ */ d.createElement(
137
+ E,
114
138
  {
115
139
  onPress: this.handlePress,
116
140
  onResize: this.handleResize,
@@ -119,37 +143,27 @@ const m = 200, h = class h extends p.Component {
119
143
  }
120
144
  )
121
145
  );
122
- return /* @__PURE__ */ p.createElement(
146
+ return /* @__PURE__ */ d.createElement(d.Fragment, null, this.state.visibleHint && /* @__PURE__ */ d.createElement(
123
147
  "div",
124
148
  {
125
149
  ref: (s) => {
126
- this.element = s;
150
+ this.hintElement = s;
127
151
  },
128
- style: n
129
- },
130
- /* @__PURE__ */ p.createElement(
131
- "div",
132
- {
133
- ref: (s) => {
134
- this.hintElement = s;
135
- },
136
- style: { position: "absolute", ...i },
137
- className: g("k-layout-item-hint", this.props.hintClassName)
138
- }
139
- ),
140
- /* @__PURE__ */ p.createElement(
141
- y,
142
- {
143
- ref: (s) => {
144
- this.draggable = s;
145
- },
146
- onDrag: this.props.reorderable ? this.handleDrag : void 0,
147
- onRelease: this.props.reorderable ? this.handleRelease : void 0,
148
- onPress: this.props.reorderable ? this.handlePress : void 0
152
+ style: { position: "fixed", ...n },
153
+ className: m("k-layout-item-hint", this.props.hintClassName)
154
+ }
155
+ ), /* @__PURE__ */ d.createElement(
156
+ x,
157
+ {
158
+ ref: (s) => {
159
+ this.draggable = s, this.element = s ? s.element : null;
149
160
  },
150
- a
151
- )
152
- );
161
+ onDrag: this.props.reorderable ? this.handleDrag : void 0,
162
+ onRelease: this.props.reorderable ? this.handleRelease : void 0,
163
+ onPress: this.props.reorderable ? this.handlePress : void 0
164
+ },
165
+ r
166
+ ));
153
167
  }
154
168
  /**
155
169
  * @hidden
@@ -157,6 +171,15 @@ const m = 200, h = class h extends p.Component {
157
171
  getSnapshotBeforeUpdate(t) {
158
172
  return this.oldSize = {}, this.dragElement && (this.oldSize = this.dragElement.getBoundingClientRect()), null;
159
173
  }
174
+ /**
175
+ * @hidden
176
+ */
177
+ setInitialHintPosition() {
178
+ if (this.element && this.hintElement) {
179
+ const t = this.element.getBoundingClientRect();
180
+ this.hintElement.style.top = t.top + "px", this.hintElement.style.left = t.left + "px", this.hintElement.style.height = this.element.offsetHeight + "px", this.hintElement.style.width = this.element.offsetWidth + "px";
181
+ }
182
+ }
160
183
  /**
161
184
  * @hidden
162
185
  */
@@ -164,51 +187,51 @@ const m = 200, h = class h extends p.Component {
164
187
  const e = this.dragElement;
165
188
  if (!e)
166
189
  return;
167
- const i = e.getBoundingClientRect(), n = this.oldSize;
190
+ const n = e.getBoundingClientRect(), l = this.oldSize;
168
191
  if (this.resizing) {
169
- const r = i.width - n.width;
192
+ const i = n.width - l.width;
170
193
  if (this.state.rtl) {
171
194
  const c = parseFloat(e.style.marginLeft || "0");
172
- e.style.marginLeft = c - r + "px";
195
+ e.style.marginLeft = c - i + "px";
173
196
  } else {
174
197
  const c = parseFloat(e.style.marginRight || "0");
175
- e.style.marginRight = c + r + "px";
198
+ e.style.marginRight = c + i + "px";
176
199
  }
177
- this.pressXY.x += this.state.rtl ? -r : r;
178
- const o = i.height - n.height, d = parseFloat(e.style.height.substring(12));
179
- e.style.height = `calc(100% + ${d + o}px)`, this.pressXY.y += o;
200
+ this.pressXY.x += this.state.rtl ? -i : i;
201
+ const o = n.height - l.height, h = parseFloat(e.style.height.substring(12));
202
+ e.style.height = `calc(100% + ${h + o}px)`, this.pressXY.y += o;
180
203
  }
181
- const a = n.left - i.left, s = n.top - i.top;
182
- if (!(a === 0 && s === 0)) {
204
+ const r = l.left - n.left, s = l.top - n.top;
205
+ if (!(r === 0 && s === 0)) {
183
206
  if (this.dragging) {
184
- (t.defaultPosition.order !== this.props.defaultPosition.order || t.defaultPosition.col !== this.props.defaultPosition.col) && (this.currentTranslate.x = 0, this.currentTranslate.y = 0, e.style.transform = "");
207
+ (t.defaultPosition.order !== this.props.defaultPosition.order || t.defaultPosition.col !== this.props.defaultPosition.col) && (this.currentTranslate.x = 0, this.currentTranslate.y = 0, e.style.transform = "", this.calcNewHintPosition());
185
208
  return;
186
209
  }
187
- Math.abs(s) < 15 && Math.abs(a) < 15 || requestAnimationFrame(() => {
188
- const r = this.element;
189
- r && (r.style.transform = `translate(${a}px, ${s}px)`, r.style.transition = "transform 0s", requestAnimationFrame(() => {
190
- r.style.transform = "", r.style.transition = `transform ${m}ms cubic-bezier(0.2, 0, 0, 1) 0s`;
210
+ Math.abs(s) < 15 && Math.abs(r) < 15 || requestAnimationFrame(() => {
211
+ const i = this.element;
212
+ i && (i.style.transform = `translate(${r}px, ${s}px)`, i.style.transition = "transform 0s", requestAnimationFrame(() => {
213
+ i.style.transform = "", i.style.transition = `transform ${g}ms cubic-bezier(0.2, 0, 0, 1) 0s`;
191
214
  }));
192
215
  });
193
216
  }
194
217
  }
195
218
  };
196
- h.propTypes = {
197
- defaultPosition: l.object.isRequired,
198
- style: l.object,
199
- className: l.string,
200
- hintStyle: l.object,
201
- hintClassName: l.string,
202
- header: l.any,
203
- body: l.any,
204
- item: l.any,
205
- resizable: l.oneOf(["horizontal", "vertical", !0, !1]),
206
- reorderable: l.bool
207
- }, h.displayName = "KendoTileLayoutItem", h.defaultProps = {
219
+ p.propTypes = {
220
+ defaultPosition: a.object.isRequired,
221
+ style: a.object,
222
+ className: a.string,
223
+ hintStyle: a.object,
224
+ hintClassName: a.string,
225
+ header: a.any,
226
+ body: a.any,
227
+ item: a.any,
228
+ resizable: a.oneOf(["horizontal", "vertical", !0, !1]),
229
+ reorderable: a.bool
230
+ }, p.displayName = "KendoTileLayoutItem", p.defaultProps = {
208
231
  resizable: !0,
209
232
  reorderable: !0
210
233
  };
211
- let f = h;
234
+ let u = p;
212
235
  export {
213
- f as InternalTile
236
+ u as InternalTile
214
237
  };
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),t=require("prop-types"),y=require("@progress/kendo-react-common"),S=require("./InternalTile.js");function k(d){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const s in d)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(d,s);Object.defineProperty(o,s,n.get?n:{enumerable:!0,get:()=>d[s]})}}return o.default=d,Object.freeze(o)}const a=k(w),N={column:"k-grid-flow-col",row:"k-grid-flow-row","column dense":"k-grid-flow-col-dense","row dense":"k-grid-flow-row-dense",unset:"k-grid-flow-unset"},h=class h extends a.Component{constructor(){super(...arguments),this._element=null,this.state={positions:(this.props.items||[]).map((o,s)=>Object.assign({order:s,rowSpan:1,colSpan:1},o.defaultPosition))},this.focus=()=>{this._element&&this._element.focus()},this.update=(o,s,n,r=0,l=0)=>{if(s===0&&n===0&&!l&&!r)return;let c=!1;const p=this.state.positions.map(f=>Object.assign({},f)),i=p[o],m=p.find(f=>f.order===i.order+s);m&&m!==i&&(i.order+=s,m.order+=-s,c=!0);const g=i.col+n;n!==0&&g>=1&&g+i.colSpan<=(this.props.columns||3)+1&&(i.col=g,c=!0);const e=i.colSpan+l;l&&e>=1&&e+i.col<=(this.props.columns||3)+1&&(i.colSpan=e,c=!0);const u=i.rowSpan+r;r&&u>=1&&(i.rowSpan=u,c=!0),c&&(this.setState({positions:p}),y.dispatchEvent(this.props.onReposition,{},this,{value:p}))}}get element(){return this._element}static getDerivedStateFromProps(o,s){return o.positions?{positions:o.positions.map((n,r)=>Object.assign({order:r,rowSpan:1,colSpan:1},n))}:o.items&&(!s.positions||o.items.length!==s.positions.length)?{positions:o.items.map((n,r)=>Object.assign({order:r,rowSpan:1,colSpan:1},n.defaultPosition))}:null}render(){const{className:o,columns:s=3,columnWidth:n="1fr",gap:r,rowHeight:l="1fr",style:c,autoFlow:p="column",items:i=[]}=this.props,m=r?`${typeof r.rows=="number"?r.rows+"px":r.rows} ${typeof r.columns=="number"?r.columns+"px":r.columns}`:16,g={gridTemplateColumns:`repeat(${s}, minmax(0px, ${typeof n=="number"?n+"px":n}))`,gridAutoRows:`minmax(0px, ${typeof l=="number"?l+"px":l})`,gap:m,padding:m,...c};return a.createElement("div",{ref:e=>{this._element=e},dir:this.props.dir,className:y.classNames("k-tilelayout k-pos-relative",N[p],o),style:g,id:this.props.id,children:i.map((e,u)=>a.createElement(a.Fragment,{key:this.props.dataItemKey?y.getter(this.props.dataItemKey)(e):u},a.createElement(S.InternalTile,{update:this.update,defaultPosition:this.state.positions[u],index:u,resizable:e.resizable,reorderable:e.reorderable,style:e.style,className:e.className,hintClassName:e.hintClassName,hintStyle:e.hintStyle,ignoreDrag:this.props.ignoreDrag},e.item?e.item:a.createElement(a.Fragment,null,a.createElement("div",{className:"k-tilelayout-item-header k-card-header"},a.isValidElement(e.header)?e.header:a.createElement("h5",{className:"k-card-title"},e.header)),a.createElement("div",{className:"k-tilelayout-item-body k-card-body"},e.body)))))})}};h.propTypes={id:t.string,style:t.object,className:t.string,dir:t.string,gap:t.object,columns:t.number,columnWidth:t.oneOfType([t.number,t.string]),rowHeight:t.oneOfType([t.number,t.string]),dataItemKey:t.string,items:t.array,positions:t.array,autoFlow:t.oneOf(["column","row","column dense","row dense","unset"]),onReposition:t.func,ignoreDrag:t.func},h.displayName="KendoTileLayout";let b=h;exports.TileLayout=b;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),t=require("prop-types"),y=require("@progress/kendo-react-common"),S=require("./InternalTile.js");function k(d){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const s in d)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(d,s);Object.defineProperty(o,s,n.get?n:{enumerable:!0,get:()=>d[s]})}}return o.default=d,Object.freeze(o)}const a=k(w),v={column:"k-grid-flow-col",row:"k-grid-flow-row","column dense":"k-grid-flow-col-dense","row dense":"k-grid-flow-row-dense",unset:"k-grid-flow-unset"},g=class g extends a.Component{constructor(){super(...arguments),this._element=null,this.state={positions:(this.props.items||[]).map((o,s)=>Object.assign({order:s,rowSpan:1,colSpan:1},o.defaultPosition)),activeHint:!1},this.focus=()=>{this._element&&this._element.focus()},this.update=(o,s,n,r=0,c=0)=>{if(s===0&&n===0&&!c&&!r)return;let p=!1;const m=this.state.positions.map(f=>Object.assign({},f)),i=m[o],u=m.find(f=>f.order===i.order+s);u&&u!==i&&(i.order+=s,u.order+=-s,p=!0);const h=i.col+n;n!==0&&h>=1&&h+i.colSpan<=(this.props.columns||3)+1&&(i.col=h,p=!0);const e=i.colSpan+c;c&&e>=1&&e+i.col<=(this.props.columns||3)+1&&(i.colSpan=e,p=!0);const l=i.rowSpan+r;r&&l>=1&&(i.rowSpan=l,p=!0),p&&(this.setState({positions:m}),y.dispatchEvent(this.props.onReposition,{},this,{value:m}))}}get element(){return this._element}static getDerivedStateFromProps(o,s){return o.positions?{positions:o.positions.map((n,r)=>Object.assign({order:r,rowSpan:1,colSpan:1},n))}:o.items&&(!s.positions||o.items.length!==s.positions.length)?{positions:o.items.map((n,r)=>Object.assign({order:r,rowSpan:1,colSpan:1},n.defaultPosition))}:null}render(){const{className:o,columns:s=3,columnWidth:n="1fr",gap:r,rowHeight:c="1fr",style:p,autoFlow:m="column",items:i=[]}=this.props,u=r?`${typeof r.rows=="number"?r.rows+"px":r.rows} ${typeof r.columns=="number"?r.columns+"px":r.columns}`:16,h={gridTemplateColumns:`repeat(${s}, minmax(0px, ${typeof n=="number"?n+"px":n}))`,gridAutoRows:`minmax(0px, ${typeof c=="number"?c+"px":c})`,gap:u,padding:u,...p};return a.createElement("div",{ref:e=>{this._element=e},dir:this.props.dir,className:y.classNames("k-tilelayout k-pos-relative",v[m],o),style:h,id:this.props.id,role:"list"},i.map((e,l)=>a.createElement(a.Fragment,{key:this.props.dataItemKey?y.getter(this.props.dataItemKey)(e):l},a.createElement(S.InternalTile,{update:this.update,defaultPosition:this.state.positions[l],index:l,resizable:e.resizable,reorderable:e.reorderable,style:e.style,header:e.header,className:e.className,hintClassName:e.hintClassName,hintStyle:e.hintStyle,ignoreDrag:this.props.ignoreDrag,onPress:()=>this.setState({activeHint:!0}),onRelease:()=>this.setState({activeHint:!1})},e.item?e.item:a.createElement(a.Fragment,null,a.createElement("div",{className:"k-tilelayout-item-header k-card-header"},a.isValidElement(e.header)?e.header:a.createElement("div",{id:typeof e.header=="string"?e.header:this.props.id?`tilelayout-${this.props.id}-${l}`:`tilelayout-${l}`,className:"k-card-title"},e.header)),a.createElement("div",{className:"k-tilelayout-item-body k-card-body"},e.body))))),!this.state.activeHint&&a.createElement("div",{className:"k-layout-item-hint",style:{display:"none",zIndex:"1",height:"auto"}}))}};g.propTypes={id:t.string,style:t.object,className:t.string,dir:t.string,gap:t.object,columns:t.number,columnWidth:t.oneOfType([t.number,t.string]),rowHeight:t.oneOfType([t.number,t.string]),dataItemKey:t.string,items:t.array,positions:t.array,autoFlow:t.oneOf(["column","row","column dense","row dense","unset"]),onReposition:t.func,ignoreDrag:t.func},g.displayName="KendoTileLayout";let b=g;exports.TileLayout=b;