dga-ui-react 1.8.10 → 1.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +8 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -869,7 +869,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
|
|
|
869
869
|
transition: all 0.2s;
|
|
870
870
|
border-bottom-left-radius: 50px;
|
|
871
871
|
border-bottom-right-radius: 50px;
|
|
872
|
-
`,lo=r=>{var{children:i,menuItems:n,disabled:a,keepOpenOnItemsClicked:l,onOpen:s,onClose:d,reverseOpeningDirection:c}=r,p=v(r,["children","menuItems","disabled","keepOpenOnItemsClicked","onOpen","onClose","reverseOpeningDirection"]);const u=b(),[g,h]=o.useState(!1),[A,f]=o.useState(""),[x,y]=o.useState({top:0,left:0}),w=o.useRef(null),C=o.useRef(null),$=o.useRef(null),k=()=>{const e=Math.max(document.documentElement.clientHeight,window.innerHeight);if(C.current&&$.current){const t=C.current.getBoundingClientRect();let r={top:t.bottom,left:"ltr"===u.direction?t.left:t.right-$.current.clientWidth};"ltr"===u.direction?r.left+$.current.clientWidth>window.innerWidth&&(r.left=window.innerWidth-$.current.clientWidth):r.left&&t.right-$.current.clientWidth<0&&(r.left=0),c&&(r={top:r.top,left:"ltr"===u.direction?t.right-$.current.clientWidth:t.left},r.left<0&&(r.left=0),t.left+$.current.clientWidth>innerWidth&&(r.left=innerWidth-$.current.clientWidth)),t.bottom+$.current.clientHeight>e&&(r.top=t.top-$.current.clientHeight),r.top<0&&(r.top=0),r.top>e&&(r.top=$.current.clientHeight),y(r)}};return o.useEffect((()=>{if(C.current){const e=()=>{k()},t=e=>{var t;(null===(t=w.current)||void 0===t?void 0:t.contains(e.target))||(null==d||d(e),h(!1))};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[C,c]),o.useEffect((()=>{const e=document.getElementsByTagName("body");e&&e[0]&&(e[0].style.overflow=g?"hidden":A)}),[g]),o.useEffect((()=>{var e,t,r;f(null===(r=null===(t=null===(e=document.getElementsByTagName("body"))||void 0===e?void 0:e[0])||void 0===t?void 0:t.style)||void 0===r?void 0:r.overflow)}),[]),t(so,Object.assign({$theme:u},p,{className:m("dgaui dgaui_menu",p.className),ref:w,children:[e("div",{ref:C,onClick:e=>(e=>{g?(h(!1),null==d||d(e)):(k(),h(!0),null==s||s(e))})(e),className:"menuChildren",children:i}),e("div",{ref:$,className:"menueItemsContainer dgaui_hiddenScrollbar "+(g?" slide-bottom":""),style:x,onClick:e=>{l||(h(!1),null==d||d(e))},children:n})]}))},so=sr.div`
|
|
872
|
+
`,lo=r=>{var{children:i,menuItems:n,disabled:a,keepOpenOnItemsClicked:l,onOpen:s,onClose:d,reverseOpeningDirection:c}=r,p=v(r,["children","menuItems","disabled","keepOpenOnItemsClicked","onOpen","onClose","reverseOpeningDirection"]);const u=b(),[g,h]=o.useState(!1),[A,f]=o.useState(""),[x,y]=o.useState({top:0,left:0}),w=o.useRef(null),C=o.useRef(null),$=o.useRef(null),k=()=>{const e=Math.max(document.documentElement.clientHeight,window.innerHeight);if(C.current&&$.current){const t=C.current.getBoundingClientRect();let r={top:t.bottom,left:"ltr"===u.direction?t.left:t.right-$.current.clientWidth};"ltr"===u.direction?r.left+$.current.clientWidth>window.innerWidth&&(r.left=window.innerWidth-$.current.clientWidth):r.left&&t.right-$.current.clientWidth<0&&(r.left=0),c&&(r={top:r.top,left:"ltr"===u.direction?t.right-$.current.clientWidth:t.left},r.left<0&&(r.left=0),t.left+$.current.clientWidth>innerWidth&&(r.left=innerWidth-$.current.clientWidth)),t.bottom+$.current.clientHeight>e&&(r.top=t.top-$.current.clientHeight),r.top<0&&(r.top=0),r.top>e&&(r.top=$.current.clientHeight),y(r)}};return o.useEffect((()=>{if(C.current){const e=()=>{k()},t=e=>{var t;(null===(t=w.current)||void 0===t?void 0:t.contains(e.target))||(null==d||d(e),h(!1))};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[C,c]),o.useEffect((()=>{const e=document.getElementsByTagName("body");e&&e[0]&&(e[0].style.overflow=g?"hidden":A)}),[g]),o.useEffect((()=>{var e,t,r;f(null===(r=null===(t=null===(e=document.getElementsByTagName("body"))||void 0===e?void 0:e[0])||void 0===t?void 0:t.style)||void 0===r?void 0:r.overflow)}),[]),t(so,Object.assign({$theme:u},p,{className:m("dgaui dgaui_menu"+(a?" disabled":""),p.className),ref:w,children:[e("div",{ref:C,onClick:e=>(e=>{g?(h(!1),null==d||d(e)):(k(),h(!0),null==s||s(e))})(e),className:"menuChildren",children:i}),e("div",{ref:$,className:"menueItemsContainer dgaui_hiddenScrollbar "+(g?" slide-bottom":""),style:x,onClick:e=>{l||(h(!1),null==d||d(e))},children:n})]}))},so=sr.div`
|
|
873
873
|
direction: ${e=>e.$theme.direction};
|
|
874
874
|
display: inline-block;
|
|
875
875
|
|
|
@@ -905,7 +905,12 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
|
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
|
-
|
|
908
|
+
|
|
909
|
+
&.disabled {
|
|
910
|
+
pointer-events: none;
|
|
911
|
+
color: ${e=>e.$theme.palette.neutral[300]};
|
|
912
|
+
}
|
|
913
|
+
`;var co="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/SURBVHgB7dUxroJAEAbgAV5I6LaBUHqExxG8wWtf9Z4n8Ah6I49gbaU30JJAIQUVCeA/xsLCgl2zRpP/SzYLxSSTmZ1dESIiIiJ6IE3TZZZlK3lSKJ6M4xhgWyPJvTFmJu8IVfzHOiPJo2uSgXiW5/lsGIYtPg2qOq/r+mAT7z1BdZ9k13VF0zSnqbFfYkEPPrYfsdT3vQTBtRYmjmMdnMXUWKshuR18J4htxMFLWqwDgsppiyUMw3lZlqepsVYtdoFj8Y32blBBg1+r5JS3e1AhuT9s18pFUVTYTrBX+opgjXpR6xSLo0g8SZKkQGt3VVX9tm3rNCBEREREn+8C+TlJKy8I1/cAAAAASUVORK5CYII=",po="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEJSURBVHgB7dU9boNAEAXgtySigYKGn9JHSI7AEXIC5wi5QXKEtOlyhZwgbTp8g7gEUWQLQBEF+I1l916stWxpPmnFFFsMszO7gFJKKaXULbvDmbIse43j+LHv+x94EGChJElWTK5i+DbPc4JrckjuN03TP65neHQPR0zogZ9vLstVtm27gUfGZbNULgxDSQ5BEJR1XW/hmVOCrN6nMWbNcMO+s1iAP/bVNM37yfvhgMkdw4sNhVMFi6JYTdO0P+JxHEtr7RaeOVVQeo5H+ySx9KL0JDxzvgdlamVAJGaSFftyjWskx83kKt6Hc57nL/Bk8VPXdZ0dhuEjiiLOjvn39dQppZRSSt22HXZvSded5pbnAAAAAElFTkSuQmCC";const uo=({hijri:r=!1,range:i=!1,minYear:n,maxYear:a,minDate:l,maxDate:s,onChange:c,onRangeChange:p,value:u,withTextInput:g=!0,textInputProps:h,closeOnSelect:m=!0,rangeSeparator:A=" - "})=>{const f=b(),[x,v]=o.useState(),[y,w]=o.useState(""),[C,$]=o.useState([]),[k,S]=o.useState(0),B=o.useRef(),E=i&&Array.isArray(x)&&1===x.length;o.useEffect((()=>{let e=0,t=0;r?(e=l?l.year:n||1300,t=s?s.year:a||1500):(e=l?l.year:n||1900,t=(s?s.year:a||2100)+1);let o=[];if(e>=t)return o=Array(200).fill(0).map(((e,t)=>t+1900)),void $(o);o=e&&t?Array(t-e).fill(0).map(((t,r)=>r+e)):e&&!t?Array(200).fill(0).map(((t,r)=>r+e)):!e&&t?Array(200).fill(0).map(((e,t)=>t+(r?1300:1900))):r?Array(200).fill(0).map(((e,t)=>t+1300)):Array(200).fill(0).map(((e,t)=>t+1900)),$(o)}),[n,a,l,s,r]),o.useEffect((()=>{const e=u&&Array.isArray(u)?u[0].year:u&&!Array.isArray(u)?u.year:(new Date).getFullYear(),t=(new Date).getMonth()+1;S(r?function(e,t){let r=(e-622)/.970224;t>=9&&(r+=1);return Math.floor(r)}(e,t):e)}),[r]),o.useEffect((()=>{i||v(void 0)}),[i]),o.useEffect((()=>{v(u)}),[u]),o.useEffect((()=>{let e="";i&&Array.isArray(x)&&2===x.length?e=`${mo(x[0])}${A}${mo(x[1])}`:x&&!Array.isArray(x)&&(e=mo(x)),w(e)}),[x,i]),o.useEffect((()=>{l&&setTimeout((()=>{var e,t;null===(e=null==B?void 0:B.current)||void 0===e||e.set("year",n||(null==l?void 0:l.year)),null===(t=null==B?void 0:B.current)||void 0===t||t.set("month",n||(null==l?void 0:l.month))}),200),n&&setTimeout((()=>{var e;null===(e=null==B?void 0:B.current)||void 0===e||e.set("year",n||(null==l?void 0:l.year))}),200)}),[l,n]);const N=e(d,{ref:B,value:u||x,range:i,calendar:r?_r:Zr,onMonthChange:e=>S(e.year),locale:r?to:"rtl"===f.direction?eo:void 0,weekStartDayIndex:r?1:0,weekDays:r?["سبت","أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة"]:"rtl"===f.direction?["أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"]:void 0,onChange:e=>{v(e),i&&p&&Array.isArray(e)?p(e):e&&c&&c(e),m&&(i&&Array.isArray(e)&&e.length>1?document.body.click():i||document.body.click())},format:"YYYY/MM/DD",showOtherDays:!0,monthYearSeparator:" ",minDate:l,maxDate:s,children:e("div",{className:"yearsSelect",children:e("select",{value:k,onChange:e=>(e=>{var t;v(void 0),null===(t=null==B?void 0:B.current)||void 0===t||t.set("year",e),S(e)})(+e.target.value),children:C.map((t=>e("option",{value:t,children:t},t)))})})});return t(go,{className:"dgaui"+(E?" rangeOnlyOneSelected":""),$theme:f,children:[!g&&N,g&&e(lo,{menuItems:N,keepOpenOnItemsClicked:!0,disabled:null==h?void 0:h.disabled,children:e(oo,Object.assign({value:(null==h?void 0:h.value)||y,readOnly:!0},h))})]})},go=sr.div`
|
|
909
914
|
.rmdp-top-class {
|
|
910
915
|
width: 424px;
|
|
911
916
|
display: block !important;
|
|
@@ -1339,7 +1344,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
|
|
|
1339
1344
|
fill: ${e=>e.$theme.palette.neutral[400]};
|
|
1340
1345
|
}
|
|
1341
1346
|
}
|
|
1342
|
-
`;var yo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADMSURBVHgB7ZJBDoIwEEU7VfccwSt4A69giCslLAyu5QTgCeheQxOpK1OJJ8AjeB+lY6sxJg2I0SW8pJt25s1PM4R0tBDOc+efOmpflH0Vp0IWpAEcYLHNJGsU9m6UIcKQizypk/F9HiES56pr7TeoathkhzGFnk6J4WLuMlumEOMSYLScTS6NCQ2BNz0rhaGel6Ti6L/uU3HyjUzpQVWy2oTvpDKmAJFJSoGiljF91oHnxnU9H4UP6U6unlJCFGiZ9QU/YVbk23XqaAN3EK5V48n9BCMAAAAASUVORK5CYII=";const wo={medium:{w:320,h:32,p:16,f:14},large:{w:320,h:40,p:16,f:16}},Co=r=>{const i=b(),{state:n,error:a,filled:l,style:s,onChange:d,children:c,onOpen:p,className:u,dropdownStyle:g,label:h,placeholder:A,value:f,valueDisplay:x,multiple:y,name:w,size:C}=r,$=v(r,["state","error","filled","style","onChange","children","onOpen","className","dropdownStyle","label","placeholder","value","valueDisplay","multiple","name","size"]),[k,S]=o.useState(""),[B,E]=o.useState(!1),[N,I]=o.useState({top:0,left:0,width:0}),z=o.useRef(null),F=null!=C?C:"large";let
|
|
1347
|
+
`;var yo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADMSURBVHgB7ZJBDoIwEEU7VfccwSt4A69giCslLAyu5QTgCeheQxOpK1OJJ8AjeB+lY6sxJg2I0SW8pJt25s1PM4R0tBDOc+efOmpflH0Vp0IWpAEcYLHNJGsU9m6UIcKQizypk/F9HiES56pr7TeoathkhzGFnk6J4WLuMlumEOMSYLScTS6NCQ2BNz0rhaGel6Ti6L/uU3HyjUzpQVWy2oTvpDKmAJFJSoGiljF91oHnxnU9H4UP6U6unlJCFGiZ9QU/YVbk23XqaAN3EK5V48n9BCMAAAAASUVORK5CYII=";const wo={medium:{w:320,h:32,p:16,f:14},large:{w:320,h:40,p:16,f:16}},Co=r=>{const i=b(),{state:n,error:a,filled:l,style:s,onChange:d,children:c,onOpen:p,className:u,dropdownStyle:g,label:h,placeholder:A,value:f,valueDisplay:x,multiple:y,name:w,size:C}=r,$=v(r,["state","error","filled","style","onChange","children","onOpen","className","dropdownStyle","label","placeholder","value","valueDisplay","multiple","name","size"]),[k,S]=o.useState(""),[B,E]=o.useState(!1),[N,I]=o.useState({top:0,left:0,width:0}),z=o.useRef(null),F=null!=C?C:"large",U=r.disabled||"disabled"===n;let R=i.textColor,D=i.palette.neutral[500],T=`1px solid ${a?i.palette.error[700]:i.palette.neutral[400]}`,O=`1px solid ${a?i.palette.error[700]:i.palette.neutral[700]}`,Q=`1px solid ${a?i.palette.error[700]:i.palette.neutral[700]}`,Y="#FFF",H=a?i.palette.error[700]:i.textColor,L=i.elevation.shadows.md;"filled"===s&&(Y=i.palette.neutral[50],T=`1px solid ${i.palette.neutral[300]}`),"filled-darker"===s&&(Y=i.palette.neutral[100],T=`1px solid ${i.palette.neutral[400]}`),"filled-lighter"===s&&(Y=i.palette.neutral[25],T=`1px solid ${i.palette.neutral[200]}`),l&&(Y=i.palette.neutral[50],T=`1px solid ${i.palette.neutral[300]}`),U&&(R=i.palette.neutral[400],T=`1px solid ${i.palette.neutral[200]}`,O=`1px solid ${i.palette.neutral[200]}`,Q=`1px solid ${i.palette.neutral[200]}`,Y=i.palette.neutral[50]),"read-only"===n&&(Y=i.palette.neutral[25],T=`1px solid ${i.palette.neutral[300]}`,O=`1px solid ${i.palette.neutral[300]}`,Q=`1px solid ${i.palette.neutral[300]}`),"hovered"===n&&(T=O),"focused"===n&&(T=Q,L=i.elevation.shadows.md),"pressed"===n&&(Y=i.palette.neutral[100],T=Q),a&&(T=`1px solid ${i.palette.error[700]}`,O=`1px solid ${i.palette.error[700]}`,Q=`1px solid ${i.palette.error[700]}`,H=i.palette.error[700]);const M=()=>{z.current&&I({top:z.current.offsetTop+z.current.clientHeight,left:z.current.offsetLeft,width:z.current.clientWidth})},j=(e,t)=>{if(y||null==d||d(e,t),y){let r=[];r=f&&Array.isArray(f)&&f.includes(t)?f.filter((e=>e!==t)):[...f||[],t],null==d||d(e,r)}},V=o.Children.map(c,(e=>{var t,r;if(e)return o.cloneElement(e,Object.assign(Object.assign({},e.props),{onClick:j,selected:(null===(t=e.props)||void 0===t?void 0:t.selected)||f===(null===(r=e.props)||void 0===r?void 0:r.value)||Array.isArray(f)&&f.includes(e.props.value),multiple:y}))}));return o.useEffect((()=>{let e="";y?(null==V||V.map((t=>{t.props.selected&&(e=e.concat(t.props.children+", "))})),e=e.slice(0,e.length-2)):null==V||V.map((t=>{t.props.selected&&(e=t.props.children)})),S(e)}),[V,f]),o.useEffect((()=>{if(z.current){const e=()=>{z.current&&M()},t=e=>{var t;(null===(t=z.current)||void 0===t?void 0:t.contains(e.target))||(!y||y&&e.target&&e.target.classList&&!e.target.classList.contains("dgaui_dropdownItem"))&&E(!1)};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[z]),o.useEffect((()=>{B&&M(),B&&p&&p()}),[B,p]),t($o,Object.assign({style:g,$theme:i,className:m("dgaui dgaui_dropdown",u)},$,{children:[h&&e("label",{className:U?"disabled":"read-only"===n?"readonly":void 0,children:h}),t(ko,{ref:z,onClick:()=>{"disabled"!==n&&"read-only"!==n&&E((e=>!e))},className:"dgaui_dropdownContainer "+(U?"disabled":"")+("read-only"===n?" readonly":""),$customStyle:{theme:i,direction:i.direction,minWidth:wo[F].w,height:wo[F].h,padding:wo[F].p,fontSize:wo[F].f,placeholderFontColor:D,fontColor:R,border:T,borderHovered:O,borderFocused:Q,backgroundColor:Y,shadowFocus:L},children:[A&&!x&&!k&&e("div",{className:"placeholder",children:A}),e("div",{className:"valueDisplay",children:x||k})]}),e("div",{className:"dgaui_dropdownItems"+(B?" slide-bottom":""),style:Object.assign({},N),children:V}),e(So,{$bgColor:H,className:"dgaui_dropdownSeparator"+(B?" open":"")})]}))},$o=sr.div`
|
|
1343
1348
|
direction: ${e=>e.$theme.direction};
|
|
1344
1349
|
display: flex;
|
|
1345
1350
|
flex-direction: column;
|