dga-ui-react 1.8.11 → 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 +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- 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
|
@@ -1344,7 +1344,7 @@ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import o,{useDeb
|
|
|
1344
1344
|
fill: ${e=>e.$theme.palette.neutral[400]};
|
|
1345
1345
|
}
|
|
1346
1346
|
}
|
|
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";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`
|
|
1348
1348
|
direction: ${e=>e.$theme.direction};
|
|
1349
1349
|
display: flex;
|
|
1350
1350
|
flex-direction: column;
|