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/esm/index.js CHANGED
@@ -217,7 +217,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
217
217
  height: 0;
218
218
  }
219
219
  }
220
- `,$r=r=>{var{selected:o,multiple:i,value:n,onClick:a,children:l}=r,s=y(r,["selected","multiple","value","onClick","children"]);const d=x();return t(kr,{className:A("dgaui dgaui_dropdownItem"+(o?" selected":""),s.className),value:n,$theme:d,$selected:o,$multiple:i,onClick:e=>{a&&a(e,n)},children:[i&&e(wr,{color:"neutral",size:"small",value:o}),l]})},kr=dr.option`
220
+ `,$r=r=>{var{selected:o,multiple:i,value:n,onClick:a,children:l}=r,s=y(r,["selected","multiple","value","onClick","children"]);const d=x();return t(kr,{className:A("dgaui dgaui_dropdownItem"+(o?" selected":""),s.className),"data-value":n,$theme:d,$selected:o,$multiple:i,onClick:e=>{a&&a(e,n)},children:[i&&e(wr,{color:"neutral",size:"small",value:o}),l]})},kr=dr.div`
221
221
  direction: ${e=>e.$theme.direction};
222
222
  color: ${e=>e.$theme.textColor};
223
223
  padding: 8px;
@@ -919,7 +919,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
919
919
  pointer-events: none;
920
920
  color: ${e=>e.$theme.palette.neutral[300]};
921
921
  }
922
- `;var uo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/SURBVHgB7dUxroJAEAbgAV5I6LaBUHqExxG8wWtf9Z4n8Ah6I49gbaU30JJAIQUVCeA/xsLCgl2zRpP/SzYLxSSTmZ1dESIiIiJ6IE3TZZZlK3lSKJ6M4xhgWyPJvTFmJu8IVfzHOiPJo2uSgXiW5/lsGIYtPg2qOq/r+mAT7z1BdZ9k13VF0zSnqbFfYkEPPrYfsdT3vQTBtRYmjmMdnMXUWKshuR18J4htxMFLWqwDgsppiyUMw3lZlqepsVYtdoFj8Y32blBBg1+r5JS3e1AhuT9s18pFUVTYTrBX+opgjXpR6xSLo0g8SZKkQGt3VVX9tm3rNCBEREREn+8C+TlJKy8I1/cAAAAASUVORK5CYII=",go="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEJSURBVHgB7dU9boNAEAXgtySigYKGn9JHSI7AEXIC5wi5QXKEtOlyhZwgbTp8g7gEUWQLQBEF+I1l916stWxpPmnFFFsMszO7gFJKKaXULbvDmbIse43j+LHv+x94EGChJElWTK5i+DbPc4JrckjuN03TP65neHQPR0zogZ9vLstVtm27gUfGZbNULgxDSQ5BEJR1XW/hmVOCrN6nMWbNcMO+s1iAP/bVNM37yfvhgMkdw4sNhVMFi6JYTdO0P+JxHEtr7RaeOVVQeo5H+ySx9KL0JDxzvgdlamVAJGaSFftyjWskx83kKt6Hc57nL/Bk8VPXdZ0dhuEjiiLOjvn39dQppZRSSt22HXZvSded5pbnAAAAAElFTkSuQmCC";const ho={medium:{w:320,h:32,p:16,f:14},large:{w:320,h:40,p:16,f:16}},mo=r=>{const i=x(),{state:n,error:a,filled:l,style:s,onChange:d,children:c,onOpen:p,className:u,dropdownStyle:g,label:h,placeholder:m,value:f,valueDisplay:b,multiple:v,name:w,size:C}=r,$=y(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=o.useRef(null),U=null!=C?C:"large",R=r.disabled||"disabled"===n;let D=i.textColor,T=i.palette.neutral[500],O=`1px solid ${a?i.palette.error[700]:i.palette.neutral[400]}`,Q=`1px solid ${a?i.palette.error[700]:i.palette.neutral[700]}`,Y=`1px solid ${a?i.palette.error[700]:i.palette.neutral[700]}`,L="#FFF",H=a?i.palette.error[700]:i.textColor,M=i.elevation.shadows.md;"filled"===s&&(L=i.palette.neutral[50],O=`1px solid ${i.palette.neutral[300]}`),"filled-darker"===s&&(L=i.palette.neutral[100],O=`1px solid ${i.palette.neutral[400]}`),"filled-lighter"===s&&(L=i.palette.neutral[25],O=`1px solid ${i.palette.neutral[200]}`),l&&(L=i.palette.neutral[50],O=`1px solid ${i.palette.neutral[300]}`),R&&(D=i.palette.neutral[400],O=`1px solid ${i.palette.neutral[200]}`,Q=`1px solid ${i.palette.neutral[200]}`,Y=`1px solid ${i.palette.neutral[200]}`,L=i.palette.neutral[50]),"read-only"===n&&(L=i.palette.neutral[25],O=`1px solid ${i.palette.neutral[300]}`,Q=`1px solid ${i.palette.neutral[300]}`,Y=`1px solid ${i.palette.neutral[300]}`),"hovered"===n&&(O=Q),"focused"===n&&(O=Y,M=i.elevation.shadows.md),"pressed"===n&&(L=i.palette.neutral[100],O=Y),a&&(O=`1px solid ${i.palette.error[700]}`,Q=`1px solid ${i.palette.error[700]}`,Y=`1px solid ${i.palette.error[700]}`,H=i.palette.error[700]);const j=()=>{z.current&&I({top:z.current.offsetTop+z.current.clientHeight,left:z.current.offsetLeft,width:z.current.clientWidth})},P=(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)}},V=o.Children.map(c,(e=>{var t,r;if(e)return o.cloneElement(e,Object.assign(Object.assign({},e.props),{onClick:P,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:v}))}));return o.useEffect((()=>{let e="";v?(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&&j()},t=e=>{var t;(null===(t=z.current)||void 0===t?void 0:t.contains(e.target))||(!v||v&&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((()=>{v||E(!1)}),[f,v]),o.useEffect((()=>{B&&(j(),(()=>{var e;const t=null===(e=F.current)||void 0===e?void 0:e.children;if(t&&t.length>0)for(const e of t){const t=e;if(t.value==f){const e=t.offsetTop;F.current.scrollTo(0,e)}}})()),B&&p&&p()}),[B,p]),t(Ao,Object.assign({style:g,$theme:i,className:A("dgaui dgaui_dropdown",u)},$,{children:[h&&e("label",{className:R?"disabled":"read-only"===n?"readonly":void 0,children:h}),t(fo,{ref:z,onClick:()=>{"disabled"!==n&&"read-only"!==n&&E((e=>!e))},className:"dgaui_dropdownContainer "+(R?"disabled":"")+("read-only"===n?" readonly":""),$customStyle:{theme:i,direction:i.direction,minWidth:ho[U].w,height:ho[U].h,padding:ho[U].p,fontSize:ho[U].f,placeholderFontColor:T,fontColor:D,border:O,borderHovered:Q,borderFocused:Y,backgroundColor:L,shadowFocus:M},children:[m&&!b&&!k&&e("div",{className:"placeholder",children:m}),e("div",{className:"valueDisplay",children:b||k})]}),e("div",{className:"dgaui_dropdownItems"+(B?" slide-bottom":""),style:Object.assign({},N),ref:F,children:V}),e(bo,{$bgColor:H,className:"dgaui_dropdownSeparator"+(B?" open":"")})]}))},Ao=dr.div`
922
+ `;var uo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAD/SURBVHgB7dUxroJAEAbgAV5I6LaBUHqExxG8wWtf9Z4n8Ah6I49gbaU30JJAIQUVCeA/xsLCgl2zRpP/SzYLxSSTmZ1dESIiIiJ6IE3TZZZlK3lSKJ6M4xhgWyPJvTFmJu8IVfzHOiPJo2uSgXiW5/lsGIYtPg2qOq/r+mAT7z1BdZ9k13VF0zSnqbFfYkEPPrYfsdT3vQTBtRYmjmMdnMXUWKshuR18J4htxMFLWqwDgsppiyUMw3lZlqepsVYtdoFj8Y32blBBg1+r5JS3e1AhuT9s18pFUVTYTrBX+opgjXpR6xSLo0g8SZKkQGt3VVX9tm3rNCBEREREn+8C+TlJKy8I1/cAAAAASUVORK5CYII=",go="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEJSURBVHgB7dU9boNAEAXgtySigYKGn9JHSI7AEXIC5wi5QXKEtOlyhZwgbTp8g7gEUWQLQBEF+I1l916stWxpPmnFFFsMszO7gFJKKaXULbvDmbIse43j+LHv+x94EGChJElWTK5i+DbPc4JrckjuN03TP65neHQPR0zogZ9vLstVtm27gUfGZbNULgxDSQ5BEJR1XW/hmVOCrN6nMWbNcMO+s1iAP/bVNM37yfvhgMkdw4sNhVMFi6JYTdO0P+JxHEtr7RaeOVVQeo5H+ySx9KL0JDxzvgdlamVAJGaSFftyjWskx83kKt6Hc57nL/Bk8VPXdZ0dhuEjiiLOjvn39dQppZRSSt22HXZvSded5pbnAAAAAElFTkSuQmCC";const ho={medium:{w:320,h:32,p:16,f:14},large:{w:320,h:40,p:16,f:16}},mo=r=>{const i=x(),{state:n,error:a,filled:l,style:s,onChange:d,children:c,onOpen:p,className:u,dropdownStyle:g,label:h,placeholder:m,value:f,valueDisplay:b,multiple:v,name:w,size:C}=r,$=y(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=o.useRef(null),U=null!=C?C:"large",R=r.disabled||"disabled"===n;let D=i.textColor,T=i.palette.neutral[500],O=`1px solid ${a?i.palette.error[700]:i.palette.neutral[400]}`,Q=`1px solid ${a?i.palette.error[700]:i.palette.neutral[700]}`,Y=`1px solid ${a?i.palette.error[700]:i.palette.neutral[700]}`,L="#FFF",H=a?i.palette.error[700]:i.textColor,M=i.elevation.shadows.md;"filled"===s&&(L=i.palette.neutral[50],O=`1px solid ${i.palette.neutral[300]}`),"filled-darker"===s&&(L=i.palette.neutral[100],O=`1px solid ${i.palette.neutral[400]}`),"filled-lighter"===s&&(L=i.palette.neutral[25],O=`1px solid ${i.palette.neutral[200]}`),l&&(L=i.palette.neutral[50],O=`1px solid ${i.palette.neutral[300]}`),R&&(D=i.palette.neutral[400],O=`1px solid ${i.palette.neutral[200]}`,Q=`1px solid ${i.palette.neutral[200]}`,Y=`1px solid ${i.palette.neutral[200]}`,L=i.palette.neutral[50]),"read-only"===n&&(L=i.palette.neutral[25],O=`1px solid ${i.palette.neutral[300]}`,Q=`1px solid ${i.palette.neutral[300]}`,Y=`1px solid ${i.palette.neutral[300]}`),"hovered"===n&&(O=Q),"focused"===n&&(O=Y,M=i.elevation.shadows.md),"pressed"===n&&(L=i.palette.neutral[100],O=Y),a&&(O=`1px solid ${i.palette.error[700]}`,Q=`1px solid ${i.palette.error[700]}`,Y=`1px solid ${i.palette.error[700]}`,H=i.palette.error[700]);const j=()=>{z.current&&I({top:z.current.offsetTop+z.current.clientHeight,left:z.current.offsetLeft,width:z.current.clientWidth})},P=(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)}},V=o.Children.map(c,(e=>{var t,r;if(e)return o.cloneElement(e,Object.assign(Object.assign({},e.props),{onClick:P,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:v}))}));return o.useEffect((()=>{let e="";v?(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&&j()},t=e=>{var t;(null===(t=z.current)||void 0===t?void 0:t.contains(e.target))||(!v||v&&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((()=>{v||E(!1)}),[f,v]),o.useEffect((()=>{B&&(j(),(()=>{var e;const t=null===(e=F.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&&F.current.scrollTo(0,t.offsetTop)}})()),B&&p&&p()}),[B,p]),t(Ao,Object.assign({style:g,$theme:i,className:A("dgaui dgaui_dropdown",u)},$,{children:[h&&e("label",{className:R?"disabled":"read-only"===n?"readonly":void 0,children:h}),t(fo,{ref:z,onClick:()=>{"disabled"!==n&&"read-only"!==n&&E((e=>!e))},className:"dgaui_dropdownContainer "+(R?"disabled":"")+("read-only"===n?" readonly":""),$customStyle:{theme:i,direction:i.direction,minWidth:ho[U].w,height:ho[U].h,padding:ho[U].p,fontSize:ho[U].f,placeholderFontColor:T,fontColor:D,border:O,borderHovered:Q,borderFocused:Y,backgroundColor:L,shadowFocus:M},children:[m&&!b&&!k&&e("div",{className:"placeholder",children:m}),e("div",{className:"valueDisplay",children:b||k})]}),e("div",{className:"dgaui_dropdownItems"+(B?" slide-bottom":""),style:Object.assign({},N),ref:F,children:V}),e(bo,{$bgColor:H,className:"dgaui_dropdownSeparator"+(B?" open":"")})]}))},Ao=dr.div`
923
923
  direction: ${e=>e.$theme.direction};
924
924
  display: flex;
925
925
  flex-direction: column;
@@ -962,11 +962,11 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
962
962
  }
963
963
  @keyframes slide-bottom {
964
964
  0% {
965
- transform: translateZ(0) translateY(0);
965
+ transform: translateY(0);
966
966
  opacity: 0;
967
967
  }
968
968
  100% {
969
- transform: translateZ(160px) translateY(8px);
969
+ transform: translateY(8px);
970
970
  opacity: 1;
971
971
  }
972
972
  }
@@ -3279,6 +3279,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
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}