@ehfuse/mui-form-controls 3.2.0 → 3.2.2

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 z,InputAdornment as he,TextField as ge,Dialog as ve,DialogContent as be,DialogTitle as ye}from"@mui/material";import Ee from"@mui/icons-material/Search";import Re from"@mui/icons-material/Close";import{useState as q,useEffect as we,useCallback as Te,forwardRef as S,useRef as Ie,useImperativeHandle as xe}from"react";import U,{createRef as ee,Component as te,useEffect as Fe,useCallback as ke}from"react";var M=function(e,r){return M=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])},M(e,r)},R=function(){return R=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},R.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 H,B="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",re=(H=null,function(e){return e===void 0&&(e=B),H||(H=new Promise((function(r,n){var t=document.createElement("script");t.src=e,t.onload=function(){var o,i,s,a=(i=(o=window?.kakao)===null||o===void 0?void 0:o.Postcode)!==null&&i!==void 0?i:(s=window?.daum)===null||s===void 0?void 0:s.Postcode;if(a)return r(a);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=U.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:B,errorMessage:oe,autoClose:!0},N=(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 i=o.defaultQuery,s=o.autoClose;o.errorMessage;var a=o.onComplete,u=o.onClose,m=o.onResize,c=o.onSearch,p=ne(o,["scriptUrl","className","style","defaultQuery","autoClose","errorMessage","onComplete","onClose","onResize","onSearch"]);new t(R(R({},p),{oncomplete:function(v){a&&a(v),n.setState({completed:!0})},onsearch:c,onresize:m,onclose:u,width:"100%",height:"100%"})).embed(n.wrap.current,{q:i,autoClose:s})}},n.onError=function(t){console.error(t),n.setState({hasError:!0})},n}return(function(n,t){function o(){this.constructor=n}M(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,i=n.errorMessage,s=n.autoClose,a=this.state,u=a.hasError,m=a.completed;return s===!0&&m===!0?null:U.createElement("div",{ref:this.wrap,className:t,style:R(R({},se),o)},u&&i)},r.defaultProps=le,r})(te);import{useState as Ae,useRef as j,useEffect as ae,useCallback as W}from"react";function D({name:e="",debounce:r,onChange:n}){let t=j(""),o=j(null);ae(()=>()=>{o.current&&clearTimeout(o.current)},[]);let i=W((a,u,m=!1)=>{if(u===t.current)return;let c=()=>{if(u!==t.current&&(t.current=u,n)){let p={...a||{},target:{...a?.target||{},name:e,value:u}};n(p)}};o.current&&clearTimeout(o.current),m||r===void 0||r===0?c():o.current=setTimeout(c,r)},[n,r,e]),s=W((a,u)=>{if(o.current&&(clearTimeout(o.current),o.current=null),u!==t.current&&(t.current=u,n)){let m={...a,target:{...a.target,name:e,value:u}};n(m)}},[n,e]);return{emitChange:i,flushOnBlur:s,lastEmittedValue:t,debounceTimer:o}}import{useCallback as Ne,useEffect as je,useRef as We}from"react";import{useState as $e,useEffect as _e,useCallback as Ye}from"react";import{useCallback as Qe,useEffect as Je,useRef as Xe}from"react";import{useRef as tt,useState as nt,useCallback as rt}from"react";import{styled as w}from"@mui/material/styles";import{Box as ie}from"@mui/material";import{jsx as f,jsxs as G}from"react/jsx-runtime";var ue=w(ie,{shouldForwardProp:e=>e!=="small"&&e!=="fullWidth"&&e!=="dimmed"})(({theme:e,small:r,fullWidth:n,dimmed:t})=>({position:"relative",display:"inline-flex",alignItems:"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=w("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=w("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"})),me=w("div",{shouldForwardProp:e=>e!=="align"&&e!=="small"&&e!=="multiline"})(({align:e,small:r,multiline:n})=>({display:"flex",alignItems:n?"flex-start":"center",gap:4,width:"100%",padding:r?"8.5px 14px":"16.5px 14px",fontSize:"1rem",lineHeight:"1.4375em",justifyContent:e==="right"?"flex-end":e==="center"?"center":"flex-start",minWidth:0})),fe=w("span",{shouldForwardProp:e=>e!=="multiline"})(({multiline:e})=>({minWidth:0,flex:e?1:void 0,overflow:"hidden",whiteSpace:e?"pre-wrap":"nowrap",overflowWrap:e?"anywhere":void 0,textOverflow:e?void 0:"ellipsis"})),P=w("span",{shouldForwardProp:e=>e!=="pushRight"})(({theme:e,pushRight:r})=>({flexShrink:0,display:"inline-flex",alignItems:"center",marginLeft:r?"auto":void 0,color:e.palette.text.secondary}));function F({label:e,value:r,prefix:n,suffix:t,startAdornment:o,endAdornment:i,showAffixOnlyWithValue:s=!1,align:a="left",size:u="medium",fullWidth:m,dimmed:c=!1,multiline:p=!1,onClick:v,title:b,className:y,id:L,sx:E}){let x=u==="small",T=!(r==null||r===""),C=!s||T;return G(ue,{small:x,fullWidth:m,dimmed:c,className:y,id:L,title:b,onClick:v,sx:E,children:[f(ce,{"aria-hidden":"true",dimmed:c,children:f("legend",{children:e?f("span",{children:e}):f("span",{children:"\u200B"})})}),e?f(de,{dimmed:c,children:e}):null,G(me,{align:a,small:x,multiline:p,children:[o?f(P,{children:o}):null,n&&C?f(P,{children:n}):null,f(fe,{multiline:p,children:r}),t&&C?f(P,{children:t}):null,i?f(P,{pushRight:a!=="right",children:i}):null]})]})}import{jsx as k}from"react/jsx-runtime";function K(e){return!!(e.readonly||e.disabled)&&!e.readonlyInput}function $(e){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,sx:e.sx}}function _(e,r){return r?r(e):e==null?"":String(e)}function pe({form:e,name:r,value:n,format:t,disabled:o,...i}){let s=e.useValue(r);return k(F,{...i,value:_(s===void 0?n:s,t),dimmed:!!o})}function Y(e){if(e.form&&e.name&&typeof e.form.useValue=="function")return k(pe,{...e});let{form:r,name:n,value:t,format:o,disabled:i,...s}=e;return k(F,{...s,value:_(t,o),dimmed:!!i})}import{Fragment as Le,jsx as d,jsxs as O}from"react/jsx-runtime";var Q=S(function({value:r,onChange:n,readonly:t,debounce:o,onBlur:i,size:s,spellCheck:a=!1,onAddressComplete:u,inputRef:m,...c},p){let v=Ie(null);xe(m,()=>v.current,[]);let[b,y]=q(typeof r=="string"?r:""),[L,E]=q(!1),x=s==="small"?20:24,{emitChange:T,flushOnBlur:C,lastEmittedValue:I}=D({name:c.name,debounce:o,onChange:n});we(()=>{if(r!=null){let l=String(r);l!==I.current&&(y(l),I.current=l)}else I.current!==""&&(y(""),I.current="")},[r,I]);let J=l=>{let h=l.address,g="";l.addressType==="R"&&(l.bname!==""&&/[동|로|가]$/g.test(l.bname)&&(g+=l.bname),l.buildingName!==""&&l.apartment==="Y"&&(g+=g!==""?", "+l.buildingName:l.buildingName),g!==""&&(g=" ("+g+")"),h+=g),y(h),T(null,h,!0),u?.(h,l),E(!1)},A=()=>{E(!0)},X=l=>{l.key==="Enter"&&(l.preventDefault(),A())},V=()=>{E(!1)},Z=()=>{E(!1),T(null,b,!0)};return O(Le,{children:[d(ge,{...c,ref:p,inputRef:v,size:s,value:b,onChange:t?void 0:l=>{let h=l.target.value;y(h),T(l,h)},autoComplete:"off",spellCheck:a,onKeyDown:t?void 0:X,onBlur:t?void 0:l=>{C(l,b),i&&i(l)},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(he,{position:"end",sx:{mr:s==="small"?-.5:.5},children:d(z,{tabIndex:-1,onClick:A,edge:"end","aria-label":"\uC8FC\uC18C \uCC3E\uAE30",size:s,children:d(Ee,{sx:{fontSize:x}})})})}}}),O(ve,{open:L,onClose:V,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:"550px"}}},children:[O(ye,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:["\uC8FC\uC18C \uAC80\uC0C9",d(z,{onClick:Z,size:"small",children:d(Re,{})})]}),d(be,{style:{padding:0},dividers:!0,children:d(N,{onComplete:J,onClose:V,defaultQuery:b,style:{width:"100%",height:"100%"}})})]})]})}),Ce=S(function({form:r,name:n,onChange:t,...o},i){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 s=r.useValue(n),a=Te(u=>{r.handleFormChange(u),t?.(u)},[r,t]);return d(Q,{...o,ref:i,name:n,value:s,onChange:a})}),Pe=S(function(r,n){return K(r)?d(Y,{...$(r)}):r.form?d(Ce,{...r,ref:n}):d(Q,{...r,ref:n})});export{Pe 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?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};
2
2
  /**
3
3
  * useTextFieldBase.ts
4
4
  *
@@ -51,6 +51,12 @@ import{IconButton as z,InputAdornment as he,TextField as ge,Dialog as ve,DialogC
51
51
  * 실제 입력 요소/IME/포커스 머신러리가 없어 렌더 비용이 크게 낮다.
52
52
  * 실제 <input> 이 꼭 필요하면 소비처가 `readonlyInput` prop 으로 예전 동작(진짜 입력칸)을 되살릴 수 있다.
53
53
  *
54
+ * ⚠️ 클래스 호환: 소비처 `sx` 에는 `& .MuiInputBase-input { textAlign }`, `& .MuiOutlinedInput-root { minHeight }`
55
+ * 같은 MUI 내부 셀렉터가 흔하다. 박스 렌더로 바뀌어도 그 스타일이 죽지 않도록 각 파트에 MUI 와 동일한
56
+ * 클래스명(MuiInputBase-root / MuiOutlinedInput-root / MuiInputBase-input / MuiOutlinedInput-input /
57
+ * MuiOutlinedInput-notchedOutline / MuiInputLabel-root / Mui-disabled)을 그대로 붙이고,
58
+ * 값 텍스트가 MUI input 과 같은 패딩을 갖게 해서 패딩/정렬 override 도 동일하게 먹도록 맞춘다.
59
+ *
54
60
  * @license MIT
55
61
  * @copyright 2025 김영진 (Kim Young Jin)
56
62
  * @author 김영진 (ehfuse@gmail.com)