@ehfuse/mui-form-controls 3.3.10 → 3.3.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/address.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{IconButton as Q,InputAdornment as ve,TextField as be,Dialog as ye,DialogContent as Re,DialogTitle as Ee}from"@mui/material";import we from"@mui/icons-material/Search";import Te from"@mui/icons-material/Close";import{useState as J,useEffect as Ie,useCallback as xe,forwardRef as U,useRef as Ce,useImperativeHandle as Pe}from"react";import N,{createRef as ee,Component as te,useEffect as ke,useCallback as Fe}from"react";var S=function(e,r){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o])},S(e,r)},x=function(){return x=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},x.apply(this,arguments)};function ne(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]])}return n}var A,j="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",re=(A=null,function(e){return e===void 0&&(e=j),A||(A=new Promise((function(r,n){var t=document.createElement("script");t.src=e,t.onload=function(){var o,s,l,i=(s=(o=window?.kakao)===null||o===void 0?void 0:o.Postcode)!==null&&s!==void 0?s:(l=window?.daum)===null||l===void 0?void 0:l.Postcode;if(i)return r(i);n(new Error("Script is loaded successfully, but cannot find Postcode module. Check your scriptURL property."))},t.onerror=function(o){return n(o)},t.id="kakao_postcode_script",document.body.appendChild(t)})))}),oe=N.createElement("p",null,"\uD604\uC7AC Kakao \uC6B0\uD3B8\uBC88\uD638 \uC11C\uBE44\uC2A4\uB97C \uC774\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694."),se={width:"100%",height:400},le={scriptUrl:j,errorMessage:oe,autoClose:!0},$=(function(e){function r(){var n=e!==null&&e.apply(this,arguments)||this;return n.mounted=!1,n.wrap=ee(),n.state={hasError:!1,completed:!1},n.initiate=function(t){if(n.wrap.current){var o=n.props;o.scriptUrl,o.className,o.style;var s=o.defaultQuery,l=o.autoClose;o.errorMessage;var i=o.onComplete,u=o.onClose,m=o.onResize,c=o.onSearch,f=ne(o,["scriptUrl","className","style","defaultQuery","autoClose","errorMessage","onComplete","onClose","onResize","onSearch"]);new t(x(x({},f),{oncomplete:function(y){i&&i(y),n.setState({completed:!0})},onsearch:c,onresize:m,onclose:u,width:"100%",height:"100%"})).embed(n.wrap.current,{q:s,autoClose:l})}},n.onError=function(t){console.error(t),n.setState({hasError:!0})},n}return(function(n,t){function o(){this.constructor=n}S(n,t),n.prototype=t===null?Object.create(t):(o.prototype=t.prototype,new o)})(r,e),r.prototype.componentDidMount=function(){var n=this.initiate,t=this.onError,o=this.props.scriptUrl;o&&(this.mounted||(re(o).then(n).catch(t),this.mounted=!0))},r.prototype.render=function(){var n=this.props,t=n.className,o=n.style,s=n.errorMessage,l=n.autoClose,i=this.state,u=i.hasError,m=i.completed;return l===!0&&m===!0?null:N.createElement("div",{ref:this.wrap,className:t,style:x(x({},se),o)},u&&s)},r.defaultProps=le,r})(te);import{useState as Ue,useRef as W,useEffect as ae,useCallback as G}from"react";function k({name:e="",debounce:r,onChange:n}){let t=W(""),o=W(null);ae(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=G((i,u,m=!1)=>{if(u===t.current)return;let c=()=>{if(u!==t.current&&(t.current=u,n)){let f={...i||{},target:{...i?.target||{},name:e,value:u}};n(f)}};o.current&&clearTimeout(o.current),m||r===void 0||r===0?c():o.current=setTimeout(c,r)},[n,r,e]),l=G((i,u)=>{if(o.current&&(clearTimeout(o.current),o.current=null),u!==t.current&&(t.current=u,n)){let m={...i,target:{...i.target,name:e,value:u}};n(m)}},[n,e]);return{emitChange:s,flushOnBlur:l,lastEmittedValue:t,debounceTimer:o}}import{useCallback as $e,useEffect as We,useRef as Ge}from"react";import{useState as ze,useEffect as Ye,useCallback as qe}from"react";import{useCallback as Xe,useEffect as Ze,useRef as et}from"react";import{useRef as rt,useState as ot,useCallback as st}from"react";import{styled as L}from"@mui/material/styles";import{Box as ie}from"@mui/material";import{jsx as g,jsxs as fe}from"react/jsx-runtime";var b={root:"MuiInputBase-root MuiOutlinedInput-root",outline:"MuiOutlinedInput-notchedOutline",label:"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-outlined MuiInputLabel-shrink",input:"MuiInputBase-input MuiOutlinedInput-input",adornment:"MuiInputAdornment-root",disabled:"Mui-disabled"},ue=L(ie,{shouldForwardProp:e=>e!=="small"&&e!=="fullWidth"&&e!=="dimmed"&&e!=="multiline"})(({theme:e,small:r,fullWidth:n,dimmed:t,multiline:o})=>({position:"relative",display:"inline-flex",alignItems:o?"flex-start":"center",width:n?"100%":void 0,minHeight:r?40:56,borderRadius:e.shape.borderRadius||4,color:t?e.palette.text.disabled:e.palette.text.primary,font:"inherit",boxSizing:"border-box"})),ce=L("fieldset",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:r})=>({position:"absolute",inset:"-5px 0 0 0",margin:0,padding:"0 8px",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,borderColor:r?e.palette.action.disabled:e.palette.mode==="dark"?"rgba(255, 255, 255, 0.23)":"rgba(0, 0, 0, 0.23)",pointerEvents:"none",overflow:"hidden",minWidth:0,"& > legend":{padding:0,fontSize:"0.75em",lineHeight:"11px",visibility:"hidden",maxWidth:"100%",whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0}}})),de=L("span",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:r})=>({position:"absolute",top:0,left:9,transform:"translateY(-50%)",padding:"0 4px",fontSize:"0.75rem",lineHeight:"1.4375em",color:r?e.palette.text.disabled:e.palette.text.secondary,backgroundColor:e.palette.background.paper,pointerEvents:"none",whiteSpace:"nowrap",maxWidth:"calc(100% - 18px)",overflow:"hidden",textOverflow:"ellipsis",zIndex:1})),me=L("div",{shouldForwardProp:e=>e!=="multiline"&&e!=="small"&&e!=="align"&&e!=="hasStart"&&e!=="hasEnd"&&e!=="minRows"})(({multiline:e,small:r,align:n,hasStart:t,hasEnd:o,minRows:s})=>({flex:1,minWidth:0,boxSizing:"border-box",padding:r?"8.5px 14px":"16.5px 14px",paddingLeft:t?0:void 0,paddingRight:o?0:void 0,fontSize:"1rem",lineHeight:"1.4375em",font:"inherit",textAlign:n,minHeight:e&&s?`calc(${s} * 1.4375em)`:void 0,overflow:"hidden",whiteSpace:e?"pre-wrap":"nowrap",overflowWrap:e?"anywhere":void 0,textOverflow:e?void 0:"ellipsis"})),K=L("span",{shouldForwardProp:e=>e!=="side"})(({theme:e,side:r})=>({flexShrink:0,display:"inline-flex",alignItems:"center",whiteSpace:"nowrap",paddingLeft:r==="start"?14:void 0,paddingRight:r==="end"?14:void 0,color:e.palette.text.secondary}));function F({label:e,value:r,prefix:n,suffix:t,startAdornment:o,endAdornment:s,showAffixOnlyWithValue:l=!1,align:i="left",size:u="medium",fullWidth:m,dimmed:c=!1,multiline:f=!1,minRows:y,onClick:R,title:E,className:M,id:w,sx:H}){let T=u==="small",D=!(r==null||r===""),p=!l||D,C=o||(n&&p?n:null),I=s||(t&&p?t:null),P=c?` ${b.disabled}`:"";return fe(ue,{small:T,fullWidth:m,dimmed:c,multiline:f,className:`${b.root}${P}${M?` ${M}`:""}`,id:w,title:E,onClick:R,sx:H,children:[g(ce,{"aria-hidden":"true",dimmed:c,className:b.outline,children:g("legend",{children:e?g("span",{children:e}):g("span",{children:"\u200B"})})}),e?g(de,{dimmed:c,className:`${b.label}${P}`,children:e}):null,C?g(K,{side:"start",className:b.adornment,children:C}):null,g(me,{className:`${b.input}${P}`,multiline:f,small:T,align:i,hasStart:!!C,hasEnd:!!I,minRows:y,children:r}),I?g(K,{side:"end",className:b.adornment,children:I}):null]})}import{jsx as O}from"react/jsx-runtime";function _(e){return!!(e.readonly||e.disabled)&&!e.readonlyInput}function pe(e){let r=e,n=r?.input,t=r?.htmlInput?.style?.textAlign;return{startAdornment:n&&typeof n!="function"?n.startAdornment:void 0,endAdornment:n&&typeof n!="function"?n.endAdornment:void 0,align:t==="right"||t==="center"?t:void 0}}function ge(e,r){if(!e)return r;if(!r)return e;let n=t=>Array.isArray(t)?t:[t];return[...n(e),...n(r)]}function z(e){let r=pe(e.slotProps);return{form:e.form,name:e.name,value:e.value,label:e.label,disabled:e.disabled,size:e.size==="small"?"small":"medium",fullWidth:e.fullWidth,className:e.className,id:e.id,onClick:e.onClick,multiline:!!e.multiline,minRows:e.minRows===void 0?void 0:Number(e.minRows),sx:ge(e.formControlProps?.sx,e.sx),...r}}function Y(e,r){return r?r(e):e==null?"":String(e)}function he({form:e,name:r,value:n,format:t,disabled:o,...s}){let l=e.useValue(r);return O(F,{...s,value:Y(l===void 0?n:l,t),dimmed:!!o})}function q(e){if(e.form&&e.name&&typeof e.form.useValue=="function")return O(he,{...e});let{form:r,name:n,value:t,format:o,disabled:s,...l}=e;return O(F,{...l,value:Y(t,o),dimmed:!!s})}import{Fragment as He,jsx as d,jsxs as V}from"react/jsx-runtime";var X=U(function({value:r,onChange:n,readonly:t,debounce:o,onBlur:s,size:l,spellCheck:i=!1,onAddressComplete:u,inputRef:m,...c},f){let y=Ce(null);Pe(m,()=>y.current,[]);let[R,E]=J(typeof r=="string"?r:""),[M,w]=J(!1),H=l==="small"?20:24,{emitChange:T,flushOnBlur:D,lastEmittedValue:p}=k({name:c.name,debounce:o,onChange:n});Ie(()=>{if(r!=null){let a=String(r);a!==p.current&&(E(a),p.current=a)}else p.current!==""&&(E(""),p.current="")},[r,p]);let C=a=>{let h=a.address,v="";a.addressType==="R"&&(a.bname!==""&&/[동|로|가]$/g.test(a.bname)&&(v+=a.bname),a.buildingName!==""&&a.apartment==="Y"&&(v+=v!==""?", "+a.buildingName:a.buildingName),v!==""&&(v=" ("+v+")"),h+=v),E(h),T(null,h,!0),u?.(h,a),w(!1)},I=()=>{w(!0)},P=a=>{a.key==="Enter"&&(a.preventDefault(),I())},B=()=>{w(!1)},Z=()=>{w(!1),T(null,R,!0)};return V(He,{children:[d(be,{...c,ref:f,inputRef:y,size:l,value:R,onChange:t?void 0:a=>{let h=a.target.value;E(h),T(a,h)},autoComplete:"off",spellCheck:i,onKeyDown:t?void 0:P,onBlur:t?void 0:a=>{D(a,R),s&&s(a)},sx:{...t?{"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)",borderWidth:1},"& .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"& .MuiInputLabel-root.Mui-focused":{color:"rgba(0, 0, 0, 0.6)"}}:{},...t&&{pointerEvents:"none"}},slotProps:{...c.slotProps,input:{...c.slotProps?.input,readOnly:t,endAdornment:t?void 0:d(ve,{position:"end",sx:{mr:l==="small"?-.5:.5},children:d(Q,{tabIndex:-1,onClick:I,edge:"end","aria-label":"\uC8FC\uC18C \uCC3E\uAE30",size:l,children:d(we,{sx:{fontSize:H}})})})}}}),V(ye,{open:M,onClose:B,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:"550px"}}},children:[V(Ee,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:["\uC8FC\uC18C \uAC80\uC0C9",d(Q,{onClick:Z,size:"small",children:d(Te,{})})]}),d(Re,{style:{padding:0},dividers:!0,children:d($,{onComplete:C,onClose:B,defaultQuery:R,style:{width:"100%",height:"100%"}})})]})]})}),Le=U(function({form:r,name:n,onChange:t,...o},s){if(!r||typeof r.useValue!="function")throw new Error("AddressTextField form prop is missing. Provide a form from useForm or useGlobalForm.");if(!n)throw new Error("AddressTextField requires a name when form prop is provided.");let l=r.useValue(n),i=xe(u=>{r.handleFormChange(u),t?.(u)},[r,t]);return d(X,{...o,ref:s,name:n,value:l,onChange:i})}),Me=U(function(r,n){return _(r)?d(q,{...z(r)}):r.form?d(Le,{...r,ref:n}):d(X,{...r,ref:n})});export{Me as AddressTextField};
1
+ import{IconButton as Q,InputAdornment as ve,TextField as be,Dialog as ye,DialogContent as Re,DialogTitle as Ee}from"@mui/material";import we from"@mui/icons-material/Search";import Te from"@mui/icons-material/Close";import{useState as J,useEffect as Ie,useCallback as xe,forwardRef as U,useRef as Ce,useImperativeHandle as Pe}from"react";import N,{createRef as ee,Component as te,useEffect as ke,useCallback as Fe}from"react";var S=function(e,r){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var o in t)t.hasOwnProperty(o)&&(n[o]=t[o])},S(e,r)},x=function(){return x=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},x.apply(this,arguments)};function ne(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(t=Object.getOwnPropertySymbols(e);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]])}return n}var A,j="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",re=(A=null,function(e){return e===void 0&&(e=j),A||(A=new Promise((function(r,n){var t=document.createElement("script");t.src=e,t.onload=function(){var o,s,l,i=(s=(o=window?.kakao)===null||o===void 0?void 0:o.Postcode)!==null&&s!==void 0?s:(l=window?.daum)===null||l===void 0?void 0:l.Postcode;if(i)return r(i);n(new Error("Script is loaded successfully, but cannot find Postcode module. Check your scriptURL property."))},t.onerror=function(o){return n(o)},t.id="kakao_postcode_script",document.body.appendChild(t)})))}),oe=N.createElement("p",null,"\uD604\uC7AC Kakao \uC6B0\uD3B8\uBC88\uD638 \uC11C\uBE44\uC2A4\uB97C \uC774\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694."),se={width:"100%",height:400},le={scriptUrl:j,errorMessage:oe,autoClose:!0},$=(function(e){function r(){var n=e!==null&&e.apply(this,arguments)||this;return n.mounted=!1,n.wrap=ee(),n.state={hasError:!1,completed:!1},n.initiate=function(t){if(n.wrap.current){var o=n.props;o.scriptUrl,o.className,o.style;var s=o.defaultQuery,l=o.autoClose;o.errorMessage;var i=o.onComplete,u=o.onClose,m=o.onResize,c=o.onSearch,f=ne(o,["scriptUrl","className","style","defaultQuery","autoClose","errorMessage","onComplete","onClose","onResize","onSearch"]);new t(x(x({},f),{oncomplete:function(y){i&&i(y),n.setState({completed:!0})},onsearch:c,onresize:m,onclose:u,width:"100%",height:"100%"})).embed(n.wrap.current,{q:s,autoClose:l})}},n.onError=function(t){console.error(t),n.setState({hasError:!0})},n}return(function(n,t){function o(){this.constructor=n}S(n,t),n.prototype=t===null?Object.create(t):(o.prototype=t.prototype,new o)})(r,e),r.prototype.componentDidMount=function(){var n=this.initiate,t=this.onError,o=this.props.scriptUrl;o&&(this.mounted||(re(o).then(n).catch(t),this.mounted=!0))},r.prototype.render=function(){var n=this.props,t=n.className,o=n.style,s=n.errorMessage,l=n.autoClose,i=this.state,u=i.hasError,m=i.completed;return l===!0&&m===!0?null:N.createElement("div",{ref:this.wrap,className:t,style:x(x({},se),o)},u&&s)},r.defaultProps=le,r})(te);import{useState as Ue,useRef as W,useEffect as ae,useCallback as G}from"react";function k({name:e="",debounce:r,onChange:n}){let t=W(""),o=W(null);ae(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=G((i,u,m=!1)=>{if(u===t.current)return;let c=()=>{if(u!==t.current&&(t.current=u,n)){let f={...i||{},target:{...i?.target||{},name:e,value:u}};n(f)}};o.current&&clearTimeout(o.current),m||r===void 0||r===0?c():o.current=setTimeout(c,r)},[n,r,e]),l=G((i,u)=>{if(o.current&&(clearTimeout(o.current),o.current=null),u!==t.current&&(t.current=u,n)){let m={...i,target:{...i.target,name:e,value:u}};n(m)}},[n,e]);return{emitChange:s,flushOnBlur:l,lastEmittedValue:t,debounceTimer:o}}import{useCallback as $e,useEffect as We,useRef as Ge}from"react";import{useState as ze,useEffect as Ye,useCallback as qe}from"react";import{useCallback as Xe,useEffect as Ze,useRef as et}from"react";import{useRef as rt,useState as ot,useCallback as st}from"react";import{styled as L}from"@mui/material/styles";import{Box as ie}from"@mui/material";import{jsx as g,jsxs as fe}from"react/jsx-runtime";var b={root:"MuiInputBase-root MuiOutlinedInput-root",outline:"MuiOutlinedInput-notchedOutline",label:"MuiFormLabel-root MuiInputLabel-root MuiInputLabel-outlined MuiInputLabel-shrink",input:"MuiInputBase-input MuiOutlinedInput-input",adornment:"MuiInputAdornment-root",disabled:"Mui-disabled"},ue=L(ie,{shouldForwardProp:e=>e!=="small"&&e!=="fullWidth"&&e!=="dimmed"&&e!=="multiline"})(({theme:e,small:r,fullWidth:n,dimmed:t,multiline:o})=>({position:"relative",display:"inline-flex",alignItems:o?"flex-start":"center",width:n?"100%":void 0,minHeight:r?"calc(1.4375em + 17px)":"calc(1.4375em + 33px)",borderRadius:e.shape.borderRadius||4,color:t?e.palette.text.disabled:e.palette.text.primary,...e.typography.body1,lineHeight:"1.4375em",boxSizing:"border-box"})),ce=L("fieldset",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:r})=>({position:"absolute",inset:"-5px 0 0 0",margin:0,padding:"0 8px",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,borderColor:r?e.palette.action.disabled:e.palette.mode==="dark"?"rgba(255, 255, 255, 0.23)":"rgba(0, 0, 0, 0.23)",pointerEvents:"none",overflow:"hidden",minWidth:0,"& > legend":{padding:0,fontSize:"0.75em",lineHeight:"11px",visibility:"hidden",maxWidth:"100%",whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0}}})),de=L("span",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:r})=>({position:"absolute",top:0,left:9,transform:"translateY(-50%)",padding:"0 4px",fontSize:"0.75em",lineHeight:"1.4375em",color:r?e.palette.text.disabled:e.palette.text.secondary,backgroundColor:e.palette.background.paper,pointerEvents:"none",whiteSpace:"nowrap",maxWidth:"calc(100% - 18px)",overflow:"hidden",textOverflow:"ellipsis",zIndex:1})),me=L("div",{shouldForwardProp:e=>e!=="multiline"&&e!=="small"&&e!=="align"&&e!=="hasStart"&&e!=="hasEnd"&&e!=="minRows"})(({multiline:e,small:r,align:n,hasStart:t,hasEnd:o,minRows:s})=>({flex:1,minWidth:0,boxSizing:"border-box",padding:r?"8.5px 14px":"16.5px 14px",paddingLeft:t?0:void 0,paddingRight:o?0:void 0,fontSize:"1rem",lineHeight:"1.4375em",font:"inherit",textAlign:n,minHeight:e&&s?`calc(${s} * 1.4375em)`:void 0,overflow:"hidden",whiteSpace:e?"pre-wrap":"nowrap",overflowWrap:e?"anywhere":void 0,textOverflow:e?void 0:"ellipsis"})),K=L("span",{shouldForwardProp:e=>e!=="side"})(({theme:e,side:r})=>({flexShrink:0,display:"inline-flex",alignItems:"center",whiteSpace:"nowrap",paddingLeft:r==="start"?14:void 0,paddingRight:r==="end"?14:void 0,color:e.palette.text.secondary}));function F({label:e,value:r,prefix:n,suffix:t,startAdornment:o,endAdornment:s,showAffixOnlyWithValue:l=!1,align:i="left",size:u="medium",fullWidth:m,dimmed:c=!1,multiline:f=!1,minRows:y,onClick:R,title:E,className:M,id:w,sx:H}){let T=u==="small",D=!(r==null||r===""),p=!l||D,C=o||(n&&p?n:null),I=s||(t&&p?t:null),P=c?` ${b.disabled}`:"";return fe(ue,{small:T,fullWidth:m,dimmed:c,multiline:f,className:`${b.root}${P}${M?` ${M}`:""}`,id:w,title:E,onClick:R,sx:H,children:[g(ce,{"aria-hidden":"true",dimmed:c,className:b.outline,children:g("legend",{children:e?g("span",{children:e}):g("span",{children:"\u200B"})})}),e?g(de,{dimmed:c,className:`${b.label}${P}`,children:e}):null,C?g(K,{side:"start",className:b.adornment,children:C}):null,g(me,{className:`${b.input}${P}`,multiline:f,small:T,align:i,hasStart:!!C,hasEnd:!!I,minRows:y,children:r}),I?g(K,{side:"end",className:b.adornment,children:I}):null]})}import{jsx as O}from"react/jsx-runtime";function _(e){return!!(e.readonly||e.disabled)&&!e.readonlyInput}function pe(e){let r=e,n=r?.input,t=r?.htmlInput?.style?.textAlign;return{startAdornment:n&&typeof n!="function"?n.startAdornment:void 0,endAdornment:n&&typeof n!="function"?n.endAdornment:void 0,align:t==="right"||t==="center"?t:void 0}}function ge(e,r){if(!e)return r;if(!r)return e;let n=t=>Array.isArray(t)?t:[t];return[...n(e),...n(r)]}function z(e){let r=pe(e.slotProps);return{form:e.form,name:e.name,value:e.value,label:e.label,disabled:e.disabled,size:e.size==="small"?"small":"medium",fullWidth:e.fullWidth,className:e.className,id:e.id,onClick:e.onClick,multiline:!!e.multiline,minRows:e.minRows===void 0?void 0:Number(e.minRows),sx:ge(e.formControlProps?.sx,e.sx),...r}}function Y(e,r){return r?r(e):e==null?"":String(e)}function he({form:e,name:r,value:n,format:t,disabled:o,...s}){let l=e.useValue(r);return O(F,{...s,value:Y(l===void 0?n:l,t),dimmed:!!o})}function q(e){if(e.form&&e.name&&typeof e.form.useValue=="function")return O(he,{...e});let{form:r,name:n,value:t,format:o,disabled:s,...l}=e;return O(F,{...l,value:Y(t,o),dimmed:!!s})}import{Fragment as He,jsx as d,jsxs as V}from"react/jsx-runtime";var X=U(function({value:r,onChange:n,readonly:t,debounce:o,onBlur:s,size:l,spellCheck:i=!1,onAddressComplete:u,inputRef:m,...c},f){let y=Ce(null);Pe(m,()=>y.current,[]);let[R,E]=J(typeof r=="string"?r:""),[M,w]=J(!1),H=l==="small"?20:24,{emitChange:T,flushOnBlur:D,lastEmittedValue:p}=k({name:c.name,debounce:o,onChange:n});Ie(()=>{if(r!=null){let a=String(r);a!==p.current&&(E(a),p.current=a)}else p.current!==""&&(E(""),p.current="")},[r,p]);let C=a=>{let h=a.address,v="";a.addressType==="R"&&(a.bname!==""&&/[동|로|가]$/g.test(a.bname)&&(v+=a.bname),a.buildingName!==""&&a.apartment==="Y"&&(v+=v!==""?", "+a.buildingName:a.buildingName),v!==""&&(v=" ("+v+")"),h+=v),E(h),T(null,h,!0),u?.(h,a),w(!1)},I=()=>{w(!0)},P=a=>{a.key==="Enter"&&(a.preventDefault(),I())},B=()=>{w(!1)},Z=()=>{w(!1),T(null,R,!0)};return V(He,{children:[d(be,{...c,ref:f,inputRef:y,size:l,value:R,onChange:t?void 0:a=>{let h=a.target.value;E(h),T(a,h)},autoComplete:"off",spellCheck:i,onKeyDown:t?void 0:P,onBlur:t?void 0:a=>{D(a,R),s&&s(a)},sx:{...t?{"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)",borderWidth:1},"& .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":{borderColor:"rgba(0, 0, 0, 0.23)"},"& .MuiInputLabel-root.Mui-focused":{color:"rgba(0, 0, 0, 0.6)"}}:{},...t&&{pointerEvents:"none"}},slotProps:{...c.slotProps,input:{...c.slotProps?.input,readOnly:t,endAdornment:t?void 0:d(ve,{position:"end",sx:{mr:l==="small"?-.5:.5},children:d(Q,{tabIndex:-1,onClick:I,edge:"end","aria-label":"\uC8FC\uC18C \uCC3E\uAE30",size:l,children:d(we,{sx:{fontSize:H}})})})}}}),V(ye,{open:M,onClose:B,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:"550px"}}},children:[V(Ee,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:["\uC8FC\uC18C \uAC80\uC0C9",d(Q,{onClick:Z,size:"small",children:d(Te,{})})]}),d(Re,{style:{padding:0},dividers:!0,children:d($,{onComplete:C,onClose:B,defaultQuery:R,style:{width:"100%",height:"100%"}})})]})]})}),Le=U(function({form:r,name:n,onChange:t,...o},s){if(!r||typeof r.useValue!="function")throw new Error("AddressTextField form prop is missing. Provide a form from useForm or useGlobalForm.");if(!n)throw new Error("AddressTextField requires a name when form prop is provided.");let l=r.useValue(n),i=xe(u=>{r.handleFormChange(u),t?.(u)},[r,t]);return d(X,{...o,ref:s,name:n,value:l,onChange:i})}),Me=U(function(r,n){return _(r)?d(q,{...z(r)}):r.form?d(Le,{...r,ref:n}):d(X,{...r,ref:n})});export{Me as AddressTextField};
2
2
  /**
3
3
  * useTextFieldBase.ts
4
4
  *