react-align
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -1,5 +0,6 @@ | ||
import React, { CSSProperties } from 'react'; | ||
import React, { CSSProperties, ReactNode } from 'react'; | ||
import './grid.css'; | ||
export declare type GridSectionProps = { | ||
className?: string; | ||
children?: ReactNode; | ||
horizontal?: boolean; | ||
@@ -6,0 +7,0 @@ stretch?: boolean; |
@@ -1,2 +0,2 @@ | ||
import React, { CSSProperties } from 'react'; | ||
import React, { CSSProperties, ReactNode } from 'react'; | ||
import { Alignment } from './GridArea'; | ||
@@ -6,2 +6,3 @@ import './grid.css'; | ||
className?: string; | ||
children?: ReactNode; | ||
editing?: boolean; | ||
@@ -8,0 +9,0 @@ vertical?: boolean; |
@@ -51,2 +51,3 @@ 'use strict'; | ||
var className = _ref.className, | ||
children = _ref.children, | ||
editing = _ref.editing, | ||
@@ -57,3 +58,2 @@ vertical = _ref.vertical, | ||
editorStyle = _ref.editorStyle, | ||
children = _ref.children, | ||
onMove = _ref.onMove, | ||
@@ -126,2 +126,3 @@ onAlignChange = _ref.onAlignChange, | ||
var className = _ref.className, | ||
children = _ref.children, | ||
horizontal = _ref.horizontal, | ||
@@ -132,4 +133,3 @@ stretch = _ref.stretch, | ||
style = _ref.style, | ||
editorStyle = _ref.editorStyle, | ||
children = _ref.children; | ||
editorStyle = _ref.editorStyle; | ||
@@ -136,0 +136,0 @@ var _useAlignContext = useAlignContext(), |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,i,o,a,l,s,c,d,h,u,p,g,v,f,m,y,w,x=require("react"),b=(e=x)&&"object"==typeof e&&"default"in e?e.default:e,E=require("react-beautiful-dnd"),O=x.createContext({editing:!1,isDragging:!1}),j=function(){return x.useContext(O)};function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function k(){return(k=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function V(){return(V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function P(){return(P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function N(){return(N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function L(){return(L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function R(){return(R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function S(){return(S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".wrapper{height:100%}.section,.wrapper{display:flex;justify-content:space-between}.section{flex-direction:column}.area{border:0 solid transparent;border-radius:8px;box-sizing:border-box;display:flex;position:relative}.area-transition-in{transition:all .3s ease-in-out,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.area-transition-out{transition:all .3s ease-in-out .4s,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.item{border:0 solid transparent;border-radius:6px;margin:6px;position:relative}.stretch{flex:auto}.middle{flex-grow:0;flex:auto}.just-centered{justify-content:center}.just-end{justify-content:flex-end}.end{align-items:flex-end}.hide{display:none}.overlay{background:rgba(0,0,0,.6);box-sizing:border-box;height:100%;left:0;position:absolute;top:0;width:100%}.overlay-buttons{box-sizing:border-box;display:flex;justify-content:space-between;padding:6px}");var W={horizontalExtend:function(e){return x.createElement("svg",C({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),t||(t=x.createElement("path",{d:"M1 20.25V3.75M23 20.25V3.75M12 12h8.5M17.5 9l3 3-3 3M12 12H4M7 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},horizontalNormal:function(e){return x.createElement("svg",z({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n||(n=x.createElement("path",{d:"M1 12h5M3 9l3 3-3 3M23 12h-5M21 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),r||(r=x.createElement("rect",{x:8.75,y:2.75,width:6.5,height:18.5,rx:1.25,stroke:"currentColor",strokeWidth:1.5})))},verticalExtend:function(e){return x.createElement("svg",k({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),i||(i=x.createElement("path",{d:"M3.75 1h16.5M3.75 23h16.5M12 12v8.5M15 17.5l-3 3-3-3M12 12V4M9 7l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},verticalNormal:function(e){return x.createElement("svg",V({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),o||(o=x.createElement("path",{d:"M12 1v5M15 3l-3 3-3-3M12 23v-5M9 21l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),a||(a=x.createElement("rect",{x:21.25,y:8.75,width:6.5,height:18.5,rx:1.25,transform:"rotate(90 21.25 8.75)",stroke:"currentColor",strokeWidth:1.5})))},moveArrows:function(e){return x.createElement("svg",D({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),l||(l=x.createElement("path",{d:"M14.651 19.098L12 21.749l-2.652-2.651M12 15v6.75M9.348 4.902L12 2.25l2.651 2.652M12 9V2.25M4.902 14.65L2.25 12l2.652-2.652M9 12H2.25M19.098 9.348l2.652 2.651-2.652 2.652M15 12h6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},alignStart:function(e){return x.createElement("svg",H({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),s||(s=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),c||(c=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5h14v14H5V5zM4 4h16v16H4V4zm2 6a1 1 0 012 0v4a1 1 0 11-2 0v-4zm3 0a1 1 0 012 0v4a1 1 0 11-2 0v-4zm4-1a1 1 0 00-1 1v4a1 1 0 102 0v-4a1 1 0 00-1-1z",fill:"currentColor"})))},alignCenter:function(e){return x.createElement("svg",P({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),d||(d=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),h||(h=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-4-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignEnd:function(e){return x.createElement("svg",N({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),u||(u=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),p||(p=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-2-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignStartV:function(e){return x.createElement("svg",L({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),g||(g=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),v||(v=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 2a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignCenterV:function(e){return x.createElement("svg",R({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),f||(f=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),m||(m=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 4a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignEndV:function(e){return x.createElement("svg",S({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),y||(y=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),w||(w=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 19V5h14v14H5zm-1 1V4h16v16H4zm6-2a1 1 0 110-2h4a1 1 0 110 2h-4zm0-3a1 1 0 110-2h4a1 1 0 110 2h-4zm-1-4a1 1 0 001 1h4a1 1 0 100-2h-4a1 1 0 00-1 1z",fill:"currentColor"})))}},I=function(e){return b.createElement(W[e.name],{className:e.className,onClick:e.onClick})},A=["start","centered","end"];exports.GridArea=function(e){var t=e.id,n=e.className,r=e.vertical,i=e.stretch,o=e.end,a=e.disabled,l=e.align,s=e.onAlignChange,c=e.children,d=e.style,h=e.editorStyle,u=e.iconColor,p=void 0===u?"#FFFFFF":u,g=j(),v=g.editing,f=g.onAlignChange,m=x.useCallback((function(){var e=A[(l?A.indexOf(l)+1:0)%A.length];null==s||s(e),null==f||f(t,e)}),[l,s,f,t]),y=x.useMemo((function(){return{position:"absolute",left:r?o?0:void 0:"50%",right:r?o?void 0:0:"50%",bottom:r||o?r?"50%":void 0:0,top:r?"50%":o?0:void 0,opacity:!a&&v&&l?1:0,pointerEvents:!a&&v&&l?"auto":"none",transition:"all 0.5s ease-in-out"}}),[r,o,a,v,l]),w=x.useMemo((function(){return b.Children.map(c,(function(e){return b.cloneElement(e,{end:o,vertical:r})}))}),[c,o,r]);return b.createElement(E.Droppable,{droppableId:t,direction:r?"vertical":"horizontal",isDropDisabled:a},(function(e,t){return b.createElement("div",Object.assign({ref:e.innerRef},e.droppableProps,{className:[n,"area",i&&"stretch",o&&"end","centered"===l?"just-centered":"end"===l?"just-end":"start",v?"area-transition-in":"area-transition-out"].filter(Boolean).join(" "),style:M({flexDirection:r?"column":"row",minHeight:b.Children.count(c)||v?"26px":"0px",minWidth:b.Children.count(c)||v?"46px":"0px",opacity:t.isDraggingOver?.8:1},v?h:d)}),w,e.placeholder,b.createElement("div",{style:y},b.createElement("div",{onClick:m,style:{cursor:"pointer",color:p}},b.createElement(I,{name:"centered"===l?r?"alignCenterV":"alignCenter":"end"===l?r?"alignEndV":"alignEnd":r?"alignStartV":"alignStart"}))))}))},exports.GridItem=function(e){var t=e.className,n=e.children,r=e.id,i=e.index,o=e.extendable,a=void 0!==o&&o,l=e.extended,s=void 0!==l&&l,c=e.disabled,d=void 0!==c&&c,h=e.style,u=e.editorStyle,p=e.iconColor,g=void 0===p?"rgb(255, 255, 255)":p,v=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,["className","children","id","index","extendable","extended","disabled","style","editorStyle","iconColor"]).vertical,f=j(),m=f.editing,y=f.isDragging,w=f.onExtend,O=x.useState(!1),C=O[0],z=O[1],k=x.useCallback((function(){a&&(z(!1),null==w||w(r,!s))}),[a,w,s,r]),V=x.useMemo((function(){return{alignItems:"start",float:"left",color:g}}),[g]),D=x.useMemo((function(){return{id:r,editing:m,isDragging:y,isHovered:C,extended:s,extendable:a,disabled:d,index:i}}),[d,m,a,s,r,i,y,C]);return b.createElement(E.Draggable,{draggableId:r,index:i,isDragDisabled:d},(function(e,r){return b.createElement("div",Object.assign({ref:e.innerRef},e.draggableProps,{className:t+" item",style:M({flex:s&&!r.isDragging?"auto":void 0,opacity:r.isDragging?.5:1},m?u:h,e.draggableProps.style)}),b.createElement("div",{style:{display:"inline-block",position:"relative",minHeight:C&&!d?"35px":void 0,width:!v&&s?"100%":void 0,minWidth:C&&!d?a?"70px":"35px":void 0,height:v&&s?"100%":void 0},onMouseEnter:function(){return z(!0)},onMouseLeave:function(){return z(!1)}},"function"==typeof n?n(D):n,b.createElement("div",{className:"overlay",style:{display:d||!m||!C||!r.isDragging&&y?"none":"block"}},b.createElement("div",{className:"overlay-buttons",style:V},b.createElement("div",Object.assign({},e.dragHandleProps),b.createElement(I,{name:"moveArrows"})),a&&b.createElement("div",{style:{cursor:"pointer",marginLeft:"8px"},onClick:k},b.createElement(I,{name:v?"verticalExtend":"horizontalExtend"}))))))}))},exports.GridSection=function(e){var t=e.className,n=e.horizontal,r=e.stretch,i=e.fixedWidth,o=e.fixedHeight,a=e.style,l=e.editorStyle,s=e.children,c=j();return b.createElement("div",{className:"section "+t+" "+(n?"horizontal":"")+" "+(r?"stretch":""),style:M({},c.editing?l:a,"number"==typeof o?{height:o+"px"}:{},"number"==typeof i?{width:i+"px"}:{})},s)},exports.GridWrapper=function(e){var t=e.className,n=e.editing,r=e.vertical,i=e.stretch,o=e.style,a=e.editorStyle,l=e.children,s=e.onMove,c=e.onAlignChange,d=e.onExtend,h=x.useState(!1),u=h[0],p=h[1],g=x.useCallback((function(){p(!0)}),[]),v=x.useCallback((function(e,t){p(!1),!e.destination||"DROP"!==e.reason||e.destination.droppableId===e.source.droppableId&&e.destination.index===e.source.index||null==s||s(e.draggableId,e.destination.droppableId,e.destination.index,e.source.droppableId,e.source.index)}),[s]);return b.createElement("div",{className:"wrapper "+t+" "+(r&&"vertical")+" "+(i&&"stretch"),style:n?a:o},b.createElement(E.DragDropContext,{onDragStart:g,onDragEnd:v},b.createElement(O.Provider,{value:{editing:!!n,onAlignChange:c,onExtend:d,isDragging:u}},l)))},exports.Icon=I; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n,r,i,o,a,l,s,c,d,h,u,p,g,v,f,m,y,w,x=require("react"),b=(e=x)&&"object"==typeof e&&"default"in e?e.default:e,E=require("react-beautiful-dnd"),O=x.createContext({editing:!1,isDragging:!1}),j=function(){return x.useContext(O)};function M(){return(M=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function k(){return(k=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function V(){return(V=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function H(){return(H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function P(){return(P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function N(){return(N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function L(){return(L=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function R(){return(R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function S(){return(S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}(".wrapper{height:100%}.section,.wrapper{display:flex;justify-content:space-between}.section{flex-direction:column}.area{border:0 solid transparent;border-radius:8px;box-sizing:border-box;display:flex;position:relative}.area-transition-in{transition:all .3s ease-in-out,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.area-transition-out{transition:all .3s ease-in-out .4s,min-height .5s ease-in-out .2s,min-width .5s ease-in-out .2s}.item{border:0 solid transparent;border-radius:6px;margin:6px;position:relative}.stretch{flex:auto}.middle{flex-grow:0;flex:auto}.just-centered{justify-content:center}.just-end{justify-content:flex-end}.end{align-items:flex-end}.hide{display:none}.overlay{background:rgba(0,0,0,.6);box-sizing:border-box;height:100%;left:0;position:absolute;top:0;width:100%}.overlay-buttons{box-sizing:border-box;display:flex;justify-content:space-between;padding:6px}");var W={horizontalExtend:function(e){return x.createElement("svg",C({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),t||(t=x.createElement("path",{d:"M1 20.25V3.75M23 20.25V3.75M12 12h8.5M17.5 9l3 3-3 3M12 12H4M7 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},horizontalNormal:function(e){return x.createElement("svg",z({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n||(n=x.createElement("path",{d:"M1 12h5M3 9l3 3-3 3M23 12h-5M21 15l-3-3 3-3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),r||(r=x.createElement("rect",{x:8.75,y:2.75,width:6.5,height:18.5,rx:1.25,stroke:"currentColor",strokeWidth:1.5})))},verticalExtend:function(e){return x.createElement("svg",k({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),i||(i=x.createElement("path",{d:"M3.75 1h16.5M3.75 23h16.5M12 12v8.5M15 17.5l-3 3-3-3M12 12V4M9 7l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},verticalNormal:function(e){return x.createElement("svg",V({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),o||(o=x.createElement("path",{d:"M12 1v5M15 3l-3 3-3-3M12 23v-5M9 21l3-3 3 3",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),a||(a=x.createElement("rect",{x:21.25,y:8.75,width:6.5,height:18.5,rx:1.25,transform:"rotate(90 21.25 8.75)",stroke:"currentColor",strokeWidth:1.5})))},moveArrows:function(e){return x.createElement("svg",D({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),l||(l=x.createElement("path",{d:"M14.651 19.098L12 21.749l-2.652-2.651M12 15v6.75M9.348 4.902L12 2.25l2.651 2.652M12 9V2.25M4.902 14.65L2.25 12l2.652-2.652M9 12H2.25M19.098 9.348l2.652 2.651-2.652 2.652M15 12h6.75",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})))},alignStart:function(e){return x.createElement("svg",H({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),s||(s=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),c||(c=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5h14v14H5V5zM4 4h16v16H4V4zm2 6a1 1 0 012 0v4a1 1 0 11-2 0v-4zm3 0a1 1 0 012 0v4a1 1 0 11-2 0v-4zm4-1a1 1 0 00-1 1v4a1 1 0 102 0v-4a1 1 0 00-1-1z",fill:"currentColor"})))},alignCenter:function(e){return x.createElement("svg",P({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),d||(d=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),h||(h=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-4-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignEnd:function(e){return x.createElement("svg",N({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),u||(u=x.createElement("rect",{width:24,height:24,rx:4,fill:"#000",fillOpacity:.5})),p||(p=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 19H5V5h14v14zm1 1H4V4h16v16zm-2-6a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-3 0a1 1 0 11-2 0v-4a1 1 0 112 0v4zm-4 1a1 1 0 001-1v-4a1 1 0 10-2 0v4a1 1 0 001 1z",fill:"currentColor"})))},alignStartV:function(e){return x.createElement("svg",L({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),g||(g=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),v||(v=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 2a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignCenterV:function(e){return x.createElement("svg",R({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),f||(f=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),m||(m=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19 5v14H5V5h14zm1-1v16H4V4h16zm-6 4a1 1 0 110 2h-4a1 1 0 110-2h4zm0 3a1 1 0 110 2h-4a1 1 0 110-2h4zm1 4a1 1 0 00-1-1h-4a1 1 0 100 2h4a1 1 0 001-1z",fill:"currentColor"})))},alignEndV:function(e){return x.createElement("svg",S({width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),y||(y=x.createElement("rect",{y:24,width:24,height:24,rx:4,transform:"rotate(-90 0 24)",fill:"#000",fillOpacity:.5})),w||(w=x.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 19V5h14v14H5zm-1 1V4h16v16H4zm6-2a1 1 0 110-2h4a1 1 0 110 2h-4zm0-3a1 1 0 110-2h4a1 1 0 110 2h-4zm-1-4a1 1 0 001 1h4a1 1 0 100-2h-4a1 1 0 00-1 1z",fill:"currentColor"})))}},I=function(e){return b.createElement(W[e.name],{className:e.className,onClick:e.onClick})},A=["start","centered","end"];exports.GridArea=function(e){var t=e.id,n=e.className,r=e.vertical,i=e.stretch,o=e.end,a=e.disabled,l=e.align,s=e.onAlignChange,c=e.children,d=e.style,h=e.editorStyle,u=e.iconColor,p=void 0===u?"#FFFFFF":u,g=j(),v=g.editing,f=g.onAlignChange,m=x.useCallback((function(){var e=A[(l?A.indexOf(l)+1:0)%A.length];null==s||s(e),null==f||f(t,e)}),[l,s,f,t]),y=x.useMemo((function(){return{position:"absolute",left:r?o?0:void 0:"50%",right:r?o?void 0:0:"50%",bottom:r||o?r?"50%":void 0:0,top:r?"50%":o?0:void 0,opacity:!a&&v&&l?1:0,pointerEvents:!a&&v&&l?"auto":"none",transition:"all 0.5s ease-in-out"}}),[r,o,a,v,l]),w=x.useMemo((function(){return b.Children.map(c,(function(e){return b.cloneElement(e,{end:o,vertical:r})}))}),[c,o,r]);return b.createElement(E.Droppable,{droppableId:t,direction:r?"vertical":"horizontal",isDropDisabled:a},(function(e,t){return b.createElement("div",Object.assign({ref:e.innerRef},e.droppableProps,{className:[n,"area",i&&"stretch",o&&"end","centered"===l?"just-centered":"end"===l?"just-end":"start",v?"area-transition-in":"area-transition-out"].filter(Boolean).join(" "),style:M({flexDirection:r?"column":"row",minHeight:b.Children.count(c)||v?"26px":"0px",minWidth:b.Children.count(c)||v?"46px":"0px",opacity:t.isDraggingOver?.8:1},v?h:d)}),w,e.placeholder,b.createElement("div",{style:y},b.createElement("div",{onClick:m,style:{cursor:"pointer",color:p}},b.createElement(I,{name:"centered"===l?r?"alignCenterV":"alignCenter":"end"===l?r?"alignEndV":"alignEnd":r?"alignStartV":"alignStart"}))))}))},exports.GridItem=function(e){var t=e.className,n=e.children,r=e.id,i=e.index,o=e.extendable,a=void 0!==o&&o,l=e.extended,s=void 0!==l&&l,c=e.disabled,d=void 0!==c&&c,h=e.style,u=e.editorStyle,p=e.iconColor,g=void 0===p?"rgb(255, 255, 255)":p,v=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,["className","children","id","index","extendable","extended","disabled","style","editorStyle","iconColor"]).vertical,f=j(),m=f.editing,y=f.isDragging,w=f.onExtend,O=x.useState(!1),C=O[0],z=O[1],k=x.useCallback((function(){a&&(z(!1),null==w||w(r,!s))}),[a,w,s,r]),V=x.useMemo((function(){return{alignItems:"start",float:"left",color:g}}),[g]),D=x.useMemo((function(){return{id:r,editing:m,isDragging:y,isHovered:C,extended:s,extendable:a,disabled:d,index:i}}),[d,m,a,s,r,i,y,C]);return b.createElement(E.Draggable,{draggableId:r,index:i,isDragDisabled:d},(function(e,r){return b.createElement("div",Object.assign({ref:e.innerRef},e.draggableProps,{className:t+" item",style:M({flex:s&&!r.isDragging?"auto":void 0,opacity:r.isDragging?.5:1},m?u:h,e.draggableProps.style)}),b.createElement("div",{style:{display:"inline-block",position:"relative",minHeight:C&&!d?"35px":void 0,width:!v&&s?"100%":void 0,minWidth:C&&!d?a?"70px":"35px":void 0,height:v&&s?"100%":void 0},onMouseEnter:function(){return z(!0)},onMouseLeave:function(){return z(!1)}},"function"==typeof n?n(D):n,b.createElement("div",{className:"overlay",style:{display:d||!m||!C||!r.isDragging&&y?"none":"block"}},b.createElement("div",{className:"overlay-buttons",style:V},b.createElement("div",Object.assign({},e.dragHandleProps),b.createElement(I,{name:"moveArrows"})),a&&b.createElement("div",{style:{cursor:"pointer",marginLeft:"8px"},onClick:k},b.createElement(I,{name:v?"verticalExtend":"horizontalExtend"}))))))}))},exports.GridSection=function(e){var t=e.className,n=e.children,r=e.horizontal,i=e.stretch,o=e.fixedWidth,a=e.fixedHeight,l=e.style,s=e.editorStyle,c=j();return b.createElement("div",{className:"section "+t+" "+(r?"horizontal":"")+" "+(i?"stretch":""),style:M({},c.editing?s:l,"number"==typeof a?{height:a+"px"}:{},"number"==typeof o?{width:o+"px"}:{})},n)},exports.GridWrapper=function(e){var t=e.className,n=e.children,r=e.editing,i=e.vertical,o=e.stretch,a=e.style,l=e.editorStyle,s=e.onMove,c=e.onAlignChange,d=e.onExtend,h=x.useState(!1),u=h[0],p=h[1],g=x.useCallback((function(){p(!0)}),[]),v=x.useCallback((function(e,t){p(!1),!e.destination||"DROP"!==e.reason||e.destination.droppableId===e.source.droppableId&&e.destination.index===e.source.index||null==s||s(e.draggableId,e.destination.droppableId,e.destination.index,e.source.droppableId,e.source.index)}),[s]);return b.createElement("div",{className:"wrapper "+t+" "+(i&&"vertical")+" "+(o&&"stretch"),style:r?l:a},b.createElement(E.DragDropContext,{onDragStart:g,onDragEnd:v},b.createElement(O.Provider,{value:{editing:!!r,onAlignChange:c,onExtend:d,isDragging:u}},n)))},exports.Icon=I; | ||
//# sourceMappingURL=react-align.cjs.production.min.js.map |
@@ -44,2 +44,3 @@ import React__default, { useContext, createContext, useState, useCallback, createElement, useMemo } from 'react'; | ||
var className = _ref.className, | ||
children = _ref.children, | ||
editing = _ref.editing, | ||
@@ -50,3 +51,2 @@ vertical = _ref.vertical, | ||
editorStyle = _ref.editorStyle, | ||
children = _ref.children, | ||
onMove = _ref.onMove, | ||
@@ -119,2 +119,3 @@ onAlignChange = _ref.onAlignChange, | ||
var className = _ref.className, | ||
children = _ref.children, | ||
horizontal = _ref.horizontal, | ||
@@ -125,4 +126,3 @@ stretch = _ref.stretch, | ||
style = _ref.style, | ||
editorStyle = _ref.editorStyle, | ||
children = _ref.children; | ||
editorStyle = _ref.editorStyle; | ||
@@ -129,0 +129,0 @@ var _useAlignContext = useAlignContext(), |
{ | ||
"name": "react-align", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"author": "KaWaite", | ||
@@ -5,0 +5,0 @@ "module": "dist/react-align.esm.js", |
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 not supported yet
Sorry, the diff of this file is not supported yet
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
1830
0
167252
38