dga-ui-react 1.9.5 → 1.9.6
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 +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
height: 0;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
`,hr=t=>{var{selected:r,multiple:o,value:i,onClick:n,children:a}=t,s=u(t,["selected","multiple","value","onClick","children"]);const d=c();return e.jsxs(mr,{className:l("dgaui dgaui_dropdownItem"+(r?" selected":""),s.className),value:i,$theme:d,$selected:r,$multiple:o,onClick:e=>{n&&n(e,i)},children:[o&&e.jsx(ur,{color:"neutral",size:"small",value:r}),a]})},mr=er.
|
|
220
|
+
`,hr=t=>{var{selected:r,multiple:o,value:i,onClick:n,children:a}=t,s=u(t,["selected","multiple","value","onClick","children"]);const d=c();return e.jsxs(mr,{className:l("dgaui dgaui_dropdownItem"+(r?" selected":""),s.className),"data-value":i,$theme:d,$selected:r,$multiple:o,onClick:e=>{n&&n(e,i)},children:[o&&e.jsx(ur,{color:"neutral",size:"small",value:r}),a]})},mr=er.div`
|
|
221
221
|
direction: ${e=>e.$theme.direction};
|
|
222
222
|
color: ${e=>e.$theme.textColor};
|
|
223
223
|
padding: 8px;
|
|
@@ -919,7 +919,7 @@
|
|
|
919
919
|
pointer-events: none;
|
|
920
920
|
color: ${e=>e.$theme.palette.neutral[300]};
|
|
921
921
|
}
|
|
922
|
-
`;var Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/SURBVHgB7dUxroJAEAbgAV5I6LaBUHqExxG8wWtf9Z4n8Ah6I49gbaU30JJAIQUVCeA/xsLCgl2zRpP/SzYLxSSTmZ1dESIiIiJ6IE3TZZZlK3lSKJ6M4xhgWyPJvTFmJu8IVfzHOiPJo2uSgXiW5/lsGIYtPg2qOq/r+mAT7z1BdZ9k13VF0zSnqbFfYkEPPrYfsdT3vQTBtRYmjmMdnMXUWKshuR18J4htxMFLWqwDgsppiyUMw3lZlqepsVYtdoFj8Y32blBBg1+r5JS3e1AhuT9s18pFUVTYTrBX+opgjXpR6xSLo0g8SZKkQGt3VVX9tm3rNCBEREREn+8C+TlJKy8I1/cAAAAASUVORK5CYII=",qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEJSURBVHgB7dU9boNAEAXgtySigYKGn9JHSI7AEXIC5wi5QXKEtOlyhZwgbTp8g7gEUWQLQBEF+I1l916stWxpPmnFFFsMszO7gFJKKaXULbvDmbIse43j+LHv+x94EGChJElWTK5i+DbPc4JrckjuN03TP65neHQPR0zogZ9vLstVtm27gUfGZbNULgxDSQ5BEJR1XW/hmVOCrN6nMWbNcMO+s1iAP/bVNM37yfvhgMkdw4sNhVMFi6JYTdO0P+JxHEtr7RaeOVVQeo5H+ySx9KL0JDxzvgdlamVAJGaSFftyjWskx83kKt6Hc57nL/Bk8VPXdZ0dhuEjiiLOjvn39dQppZRSSt22HXZvSded5pbnAAAAAElFTkSuQmCC";const _r={medium:{w:320,h:32,p:16,f:14},large:{w:320,h:40,p:16,f:16}},eo=r=>{const o=c(),{state:i,error:n,filled:a,style:s,onChange:d,children:p,onOpen:g,className:h,dropdownStyle:m,label:A,placeholder:x,value:f,valueDisplay:b,multiple:v,name:y,size:w}=r,C=u(r,["state","error","filled","style","onChange","children","onOpen","className","dropdownStyle","label","placeholder","value","valueDisplay","multiple","name","size"]),[$,k]=t.useState(""),[S,B]=t.useState(!1),[j,E]=t.useState({top:0,left:0,width:0}),N=t.useRef(null),I=t.useRef(null),z=null!=w?w:"large",F=r.disabled||"disabled"===i;let R=o.textColor,U=o.palette.neutral[500],D=`1px solid ${n?o.palette.error[700]:o.palette.neutral[400]}`,T=`1px solid ${n?o.palette.error[700]:o.palette.neutral[700]}`,O=`1px solid ${n?o.palette.error[700]:o.palette.neutral[700]}`,Q="#FFF",Y=n?o.palette.error[700]:o.textColor,L=o.elevation.shadows.md;"filled"===s&&(Q=o.palette.neutral[50],D=`1px solid ${o.palette.neutral[300]}`),"filled-darker"===s&&(Q=o.palette.neutral[100],D=`1px solid ${o.palette.neutral[400]}`),"filled-lighter"===s&&(Q=o.palette.neutral[25],D=`1px solid ${o.palette.neutral[200]}`),a&&(Q=o.palette.neutral[50],D=`1px solid ${o.palette.neutral[300]}`),F&&(R=o.palette.neutral[400],D=`1px solid ${o.palette.neutral[200]}`,T=`1px solid ${o.palette.neutral[200]}`,O=`1px solid ${o.palette.neutral[200]}`,Q=o.palette.neutral[50]),"read-only"===i&&(Q=o.palette.neutral[25],D=`1px solid ${o.palette.neutral[300]}`,T=`1px solid ${o.palette.neutral[300]}`,O=`1px solid ${o.palette.neutral[300]}`),"hovered"===i&&(D=T),"focused"===i&&(D=O,L=o.elevation.shadows.md),"pressed"===i&&(Q=o.palette.neutral[100],D=O),n&&(D=`1px solid ${o.palette.error[700]}`,T=`1px solid ${o.palette.error[700]}`,O=`1px solid ${o.palette.error[700]}`,Y=o.palette.error[700]);const H=()=>{N.current&&E({top:N.current.offsetTop+N.current.clientHeight,left:N.current.offsetLeft,width:N.current.clientWidth})},M=(e,t)=>{if(v||null==d||d(e,t),v){let r=[];r=f&&Array.isArray(f)&&f.includes(t)?f.filter((e=>e!==t)):[...f||[],t],null==d||d(e,r)}},P=t.Children.map(p,(e=>{var r,o;if(e)return t.cloneElement(e,Object.assign(Object.assign({},e.props),{onClick:M,selected:(null===(r=e.props)||void 0===r?void 0:r.selected)||f===(null===(o=e.props)||void 0===o?void 0:o.value)||Array.isArray(f)&&f.includes(e.props.value),multiple:v}))}));return t.useEffect((()=>{let e="";v?(null==P||P.map((t=>{t.props.selected&&(e=e.concat(t.props.children+", "))})),e=e.slice(0,e.length-2)):null==P||P.map((t=>{t.props.selected&&(e=t.props.children)})),k(e)}),[P,f]),t.useEffect((()=>{if(N.current){const e=()=>{N.current&&H()},t=e=>{var t;(null===(t=N.current)||void 0===t?void 0:t.contains(e.target))||(!v||v&&e.target&&e.target.classList&&!e.target.classList.contains("dgaui_dropdownItem"))&&B(!1)};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[N]),t.useEffect((()=>{v||B(!1)}),[f,v]),t.useEffect((()=>{S&&(H(),(()=>{var e;const t=null===(e=I.current)||void 0===e?void 0:e.children;if(t&&t.length>0)for(const e of t){const t=e;
|
|
922
|
+
`;var Zr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/SURBVHgB7dUxroJAEAbgAV5I6LaBUHqExxG8wWtf9Z4n8Ah6I49gbaU30JJAIQUVCeA/xsLCgl2zRpP/SzYLxSSTmZ1dESIiIiJ6IE3TZZZlK3lSKJ6M4xhgWyPJvTFmJu8IVfzHOiPJo2uSgXiW5/lsGIYtPg2qOq/r+mAT7z1BdZ9k13VF0zSnqbFfYkEPPrYfsdT3vQTBtRYmjmMdnMXUWKshuR18J4htxMFLWqwDgsppiyUMw3lZlqepsVYtdoFj8Y32blBBg1+r5JS3e1AhuT9s18pFUVTYTrBX+opgjXpR6xSLo0g8SZKkQGt3VVX9tm3rNCBEREREn+8C+TlJKy8I1/cAAAAASUVORK5CYII=",qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEJSURBVHgB7dU9boNAEAXgtySigYKGn9JHSI7AEXIC5wi5QXKEtOlyhZwgbTp8g7gEUWQLQBEF+I1l916stWxpPmnFFFsMszO7gFJKKaXULbvDmbIse43j+LHv+x94EGChJElWTK5i+DbPc4JrckjuN03TP65neHQPR0zogZ9vLstVtm27gUfGZbNULgxDSQ5BEJR1XW/hmVOCrN6nMWbNcMO+s1iAP/bVNM37yfvhgMkdw4sNhVMFi6JYTdO0P+JxHEtr7RaeOVVQeo5H+ySx9KL0JDxzvgdlamVAJGaSFftyjWskx83kKt6Hc57nL/Bk8VPXdZ0dhuEjiiLOjvn39dQppZRSSt22HXZvSded5pbnAAAAAElFTkSuQmCC";const _r={medium:{w:320,h:32,p:16,f:14},large:{w:320,h:40,p:16,f:16}},eo=r=>{const o=c(),{state:i,error:n,filled:a,style:s,onChange:d,children:p,onOpen:g,className:h,dropdownStyle:m,label:A,placeholder:x,value:f,valueDisplay:b,multiple:v,name:y,size:w}=r,C=u(r,["state","error","filled","style","onChange","children","onOpen","className","dropdownStyle","label","placeholder","value","valueDisplay","multiple","name","size"]),[$,k]=t.useState(""),[S,B]=t.useState(!1),[j,E]=t.useState({top:0,left:0,width:0}),N=t.useRef(null),I=t.useRef(null),z=null!=w?w:"large",F=r.disabled||"disabled"===i;let R=o.textColor,U=o.palette.neutral[500],D=`1px solid ${n?o.palette.error[700]:o.palette.neutral[400]}`,T=`1px solid ${n?o.palette.error[700]:o.palette.neutral[700]}`,O=`1px solid ${n?o.palette.error[700]:o.palette.neutral[700]}`,Q="#FFF",Y=n?o.palette.error[700]:o.textColor,L=o.elevation.shadows.md;"filled"===s&&(Q=o.palette.neutral[50],D=`1px solid ${o.palette.neutral[300]}`),"filled-darker"===s&&(Q=o.palette.neutral[100],D=`1px solid ${o.palette.neutral[400]}`),"filled-lighter"===s&&(Q=o.palette.neutral[25],D=`1px solid ${o.palette.neutral[200]}`),a&&(Q=o.palette.neutral[50],D=`1px solid ${o.palette.neutral[300]}`),F&&(R=o.palette.neutral[400],D=`1px solid ${o.palette.neutral[200]}`,T=`1px solid ${o.palette.neutral[200]}`,O=`1px solid ${o.palette.neutral[200]}`,Q=o.palette.neutral[50]),"read-only"===i&&(Q=o.palette.neutral[25],D=`1px solid ${o.palette.neutral[300]}`,T=`1px solid ${o.palette.neutral[300]}`,O=`1px solid ${o.palette.neutral[300]}`),"hovered"===i&&(D=T),"focused"===i&&(D=O,L=o.elevation.shadows.md),"pressed"===i&&(Q=o.palette.neutral[100],D=O),n&&(D=`1px solid ${o.palette.error[700]}`,T=`1px solid ${o.palette.error[700]}`,O=`1px solid ${o.palette.error[700]}`,Y=o.palette.error[700]);const H=()=>{N.current&&E({top:N.current.offsetTop+N.current.clientHeight,left:N.current.offsetLeft,width:N.current.clientWidth})},M=(e,t)=>{if(v||null==d||d(e,t),v){let r=[];r=f&&Array.isArray(f)&&f.includes(t)?f.filter((e=>e!==t)):[...f||[],t],null==d||d(e,r)}},P=t.Children.map(p,(e=>{var r,o;if(e)return t.cloneElement(e,Object.assign(Object.assign({},e.props),{onClick:M,selected:(null===(r=e.props)||void 0===r?void 0:r.selected)||f===(null===(o=e.props)||void 0===o?void 0:o.value)||Array.isArray(f)&&f.includes(e.props.value),multiple:v}))}));return t.useEffect((()=>{let e="";v?(null==P||P.map((t=>{t.props.selected&&(e=e.concat(t.props.children+", "))})),e=e.slice(0,e.length-2)):null==P||P.map((t=>{t.props.selected&&(e=t.props.children)})),k(e)}),[P,f]),t.useEffect((()=>{if(N.current){const e=()=>{N.current&&H()},t=e=>{var t;(null===(t=N.current)||void 0===t?void 0:t.contains(e.target))||(!v||v&&e.target&&e.target.classList&&!e.target.classList.contains("dgaui_dropdownItem"))&&B(!1)};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[N]),t.useEffect((()=>{v||B(!1)}),[f,v]),t.useEffect((()=>{S&&(H(),(()=>{var e;const t=null===(e=I.current)||void 0===e?void 0:e.children;if(t&&t.length>0)for(const e of t){const t=e;t.dataset.value==f&&I.current.scrollTo(0,t.offsetTop)}})()),S&&g&&g()}),[S,g]),e.jsxs(to,Object.assign({style:m,$theme:o,className:l("dgaui dgaui_dropdown",h)},C,{children:[A&&e.jsx("label",{className:F?"disabled":"read-only"===i?"readonly":void 0,children:A}),e.jsxs(ro,{ref:N,onClick:()=>{"disabled"!==i&&"read-only"!==i&&B((e=>!e))},className:"dgaui_dropdownContainer "+(F?"disabled":"")+("read-only"===i?" readonly":""),$customStyle:{theme:o,direction:o.direction,minWidth:_r[z].w,height:_r[z].h,padding:_r[z].p,fontSize:_r[z].f,placeholderFontColor:U,fontColor:R,border:D,borderHovered:T,borderFocused:O,backgroundColor:Q,shadowFocus:L},children:[x&&!b&&!$&&e.jsx("div",{className:"placeholder",children:x}),e.jsx("div",{className:"valueDisplay",children:b||$})]}),e.jsx("div",{className:"dgaui_dropdownItems"+(S?" slide-bottom":""),style:Object.assign({},j),ref:I,children:P}),e.jsx(oo,{$bgColor:Y,className:"dgaui_dropdownSeparator"+(S?" open":"")})]}))},to=er.div`
|
|
923
923
|
direction: ${e=>e.$theme.direction};
|
|
924
924
|
display: flex;
|
|
925
925
|
flex-direction: column;
|
|
@@ -962,11 +962,11 @@
|
|
|
962
962
|
}
|
|
963
963
|
@keyframes slide-bottom {
|
|
964
964
|
0% {
|
|
965
|
-
transform:
|
|
965
|
+
transform: translateY(0);
|
|
966
966
|
opacity: 0;
|
|
967
967
|
}
|
|
968
968
|
100% {
|
|
969
|
-
transform:
|
|
969
|
+
transform: translateY(8px);
|
|
970
970
|
opacity: 1;
|
|
971
971
|
}
|
|
972
972
|
}
|
|
@@ -3279,6 +3279,7 @@
|
|
|
3279
3279
|
opacity: 1;
|
|
3280
3280
|
display: none;
|
|
3281
3281
|
max-height: 400px;
|
|
3282
|
+
width: min-content;
|
|
3282
3283
|
|
|
3283
3284
|
border-radius: 4px;
|
|
3284
3285
|
${e=>e.$theme.elevation.shadows.lg}
|