@ehfuse/mui-form-controls 3.5.7 → 3.5.8
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/FormControlsConfig.d.ts +7 -0
- package/dist/address.js +15 -1
- package/dist/address.js.map +4 -4
- package/dist/address.mjs +15 -1
- package/dist/address.mjs.map +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
package/dist/address.mjs
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
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};
|
|
1
|
+
import{createContext as te,useContext as ne}from"react";import{jsx as Ne}from"react/jsx-runtime";var re=te({});function oe(e){let t=ne(re);return e??t.readonly??!1}function N(e){let t=oe(e.readonly);return t===!!e.readonly&&e.readonly!==void 0?e:t?{...e,readonly:t}:e}import{IconButton as J,InputAdornment as we,TextField as Te,Dialog as xe,DialogContent as Ie,DialogTitle as Ce}from"@mui/material";import Pe from"@mui/icons-material/Search";import Le from"@mui/icons-material/Close";import{useState as X,useEffect as Me,useCallback as He,forwardRef as U,useRef as De,useImperativeHandle as ke}from"react";import $,{createRef as se,Component as ae,useEffect as We,useCallback as Ge}from"react";var A=function(e,t){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)n.hasOwnProperty(o)&&(r[o]=n[o])},A(e,t)},I=function(){return I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},I.apply(this,arguments)};function le(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}var k,j="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",ie=(k=null,function(e){return e===void 0&&(e=j),k||(k=new Promise((function(t,r){var n=document.createElement("script");n.src=e,n.onload=function(){var o,s,a,i=(s=(o=window?.kakao)===null||o===void 0?void 0:o.Postcode)!==null&&s!==void 0?s:(a=window?.daum)===null||a===void 0?void 0:a.Postcode;if(i)return t(i);r(new Error("Script is loaded successfully, but cannot find Postcode module. Check your scriptURL property."))},n.onerror=function(o){return r(o)},n.id="kakao_postcode_script",document.body.appendChild(n)})))}),ue=$.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."),ce={width:"100%",height:400},de={scriptUrl:j,errorMessage:ue,autoClose:!0},W=(function(e){function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.mounted=!1,r.wrap=se(),r.state={hasError:!1,completed:!1},r.initiate=function(n){if(r.wrap.current){var o=r.props;o.scriptUrl,o.className,o.style;var s=o.defaultQuery,a=o.autoClose;o.errorMessage;var i=o.onComplete,u=o.onClose,m=o.onResize,c=o.onSearch,f=le(o,["scriptUrl","className","style","defaultQuery","autoClose","errorMessage","onComplete","onClose","onResize","onSearch"]);new n(I(I({},f),{oncomplete:function(y){i&&i(y),r.setState({completed:!0})},onsearch:c,onresize:m,onclose:u,width:"100%",height:"100%"})).embed(r.wrap.current,{q:s,autoClose:a})}},r.onError=function(n){console.error(n),r.setState({hasError:!0})},r}return(function(r,n){function o(){this.constructor=r}A(r,n),r.prototype=n===null?Object.create(n):(o.prototype=n.prototype,new o)})(t,e),t.prototype.componentDidMount=function(){var r=this.initiate,n=this.onError,o=this.props.scriptUrl;o&&(this.mounted||(ie(o).then(r).catch(n),this.mounted=!0))},t.prototype.render=function(){var r=this.props,n=r.className,o=r.style,s=r.errorMessage,a=r.autoClose,i=this.state,u=i.hasError,m=i.completed;return a===!0&&m===!0?null:$.createElement("div",{ref:this.wrap,className:n,style:I(I({},ce),o)},u&&s)},t.defaultProps=de,t})(ae);import{useState as ze,useRef as G,useEffect as me,useCallback as K}from"react";function F({name:e="",debounce:t,onChange:r}){let n=G(""),o=G(null);me(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=K((i,u,m=!1)=>{if(u===n.current)return;let c=()=>{if(u!==n.current&&(n.current=u,r)){let f={...i||{},target:{...i?.target||{},name:e,value:u}};r(f)}};o.current&&clearTimeout(o.current),m||t===void 0||t===0?c():o.current=setTimeout(c,t)},[r,t,e]),a=K((i,u)=>{if(o.current&&(clearTimeout(o.current),o.current=null),u!==n.current&&(n.current=u,r)){let m={...i,target:{...i.target,name:e,value:u}};r(m)}},[r,e]);return{emitChange:s,flushOnBlur:a,lastEmittedValue:n,debounceTimer:o}}import{useCallback as Je,useEffect as Xe,useRef as Ze}from"react";import{useState as nt,useEffect as rt,useCallback as ot}from"react";import{useCallback as lt,useEffect as it,useRef as ut}from"react";import{useRef as mt,useState as ft,useCallback as pt}from"react";import{styled as L}from"@mui/material/styles";import{Box as fe}from"@mui/material";import{jsx as g,jsxs as be}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"},pe=L(fe,{shouldForwardProp:e=>e!=="small"&&e!=="fullWidth"&&e!=="dimmed"&&e!=="multiline"})(({theme:e,small:t,fullWidth:r,dimmed:n,multiline:o})=>({position:"relative",display:"inline-flex",alignItems:o?"flex-start":"center",width:r?"100%":void 0,minHeight:t?"calc(1.4375em + 17px)":"calc(1.4375em + 33px)",borderRadius:e.shape.borderRadius||4,color:n?e.palette.text.disabled:e.palette.text.primary,...e.typography.body1,lineHeight:"1.4375em",boxSizing:"border-box"})),ge=L("fieldset",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:t})=>({position:"absolute",inset:"-5px 0 0 0",margin:0,padding:"0 8px",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,borderColor:t?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}}})),he=L("span",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:t})=>({position:"absolute",top:0,left:9,transform:"translateY(-50%)",padding:"0 4px",fontSize:"0.75em",lineHeight:"1.4375em",color:t?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})),ve=L("div",{shouldForwardProp:e=>e!=="multiline"&&e!=="small"&&e!=="align"&&e!=="hasStart"&&e!=="hasEnd"&&e!=="minRows"})(({multiline:e,small:t,align:r,hasStart:n,hasEnd:o,minRows:s})=>({flex:1,minWidth:0,boxSizing:"border-box",padding:t?"8.5px 14px":"16.5px 14px",paddingLeft:n?0:void 0,paddingRight:o?0:void 0,fontSize:"1rem",lineHeight:"1.4375em",font:"inherit",textAlign:r,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"})),_=L("span",{shouldForwardProp:e=>e!=="side"})(({theme:e,side:t})=>({flexShrink:0,display:"inline-flex",alignItems:"center",whiteSpace:"nowrap",paddingLeft:t==="start"?14:void 0,paddingRight:t==="end"?14:void 0,color:e.palette.text.secondary}));function S({label:e,value:t,prefix:r,suffix:n,startAdornment:o,endAdornment:s,showAffixOnlyWithValue:a=!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=!(t==null||t===""),p=!a||D,C=o||(r&&p?r:null),x=s||(n&&p?n:null),P=c?` ${b.disabled}`:"";return be(pe,{small:T,fullWidth:m,dimmed:c,multiline:f,className:`${b.root}${P}${M?` ${M}`:""}`,id:w,title:E,onClick:R,sx:H,children:[g(ge,{"aria-hidden":"true",dimmed:c,className:b.outline,children:g("legend",{children:e?g("span",{children:e}):g("span",{children:"\u200B"})})}),e?g(he,{dimmed:c,className:`${b.label}${P}`,children:e}):null,C?g(_,{side:"start",className:b.adornment,children:C}):null,g(ve,{className:`${b.input}${P}`,multiline:f,small:T,align:i,hasStart:!!C,hasEnd:!!x,minRows:y,children:t}),x?g(_,{side:"end",className:b.adornment,children:x}):null]})}import{jsx as O}from"react/jsx-runtime";function z(e){return!!(e.readonly||e.disabled)&&!e.readonlyInput}function ye(e){let t=e,r=t?.input,n=t?.htmlInput?.style?.textAlign;return{startAdornment:r&&typeof r!="function"?r.startAdornment:void 0,endAdornment:r&&typeof r!="function"?r.endAdornment:void 0,align:n==="right"||n==="center"?n:void 0}}function Re(e,t){if(!e)return t;if(!t)return e;let r=n=>Array.isArray(n)?n:[n];return[...r(e),...r(t)]}function Y(e){let t=ye(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:Re(e.formControlProps?.sx,e.sx),...t}}function q(e,t){return t?t(e):e==null?"":String(e)}function Ee({form:e,name:t,value:r,format:n,disabled:o,...s}){let a=e.useValue(t);return O(S,{...s,value:q(a===void 0?r:a,n),dimmed:!!o})}function Q(e){if(e.form&&e.name&&typeof e.form.useValue=="function")return O(Ee,{...e});let{form:t,name:r,value:n,format:o,disabled:s,...a}=e;return O(S,{...a,value:q(n,o),dimmed:!!s})}import{Fragment as Se,jsx as d,jsxs as V}from"react/jsx-runtime";var Z=U(function({value:t,onChange:r,readonly:n,debounce:o,onBlur:s,size:a,spellCheck:i=!1,onAddressComplete:u,inputRef:m,...c},f){let y=De(null);ke(m,()=>y.current,[]);let[R,E]=X(typeof t=="string"?t:""),[M,w]=X(!1),H=a==="small"?20:24,{emitChange:T,flushOnBlur:D,lastEmittedValue:p}=F({name:c.name,debounce:o,onChange:r});Me(()=>{if(t!=null){let l=String(t);l!==p.current&&(E(l),p.current=l)}else p.current!==""&&(E(""),p.current="")},[t,p]);let C=l=>{let h=l.address,v="";l.addressType==="R"&&(l.bname!==""&&/[동|로|가]$/g.test(l.bname)&&(v+=l.bname),l.buildingName!==""&&l.apartment==="Y"&&(v+=v!==""?", "+l.buildingName:l.buildingName),v!==""&&(v=" ("+v+")"),h+=v),E(h),T(null,h,!0),u?.(h,l),w(!1)},x=()=>{w(!0)},P=l=>{l.key==="Enter"&&(l.preventDefault(),x())},B=()=>{w(!1)},ee=()=>{w(!1),T(null,R,!0)};return V(Se,{children:[d(Te,{...c,ref:f,inputRef:y,size:a,value:R,onChange:n?void 0:l=>{let h=l.target.value;E(h),T(l,h)},autoComplete:"off",spellCheck:i,onKeyDown:n?void 0:P,onBlur:n?void 0:l=>{D(l,R),s&&s(l)},sx:{...n?{"& .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)"}}:{},...n&&{pointerEvents:"none"}},slotProps:{...c.slotProps,input:{...c.slotProps?.input,readOnly:n,endAdornment:n?void 0:d(we,{position:"end",sx:{mr:a==="small"?-.5:.5},children:d(J,{tabIndex:-1,onClick:x,edge:"end","aria-label":"\uC8FC\uC18C \uCC3E\uAE30",size:a,children:d(Pe,{sx:{fontSize:H}})})})}}}),V(xe,{open:M,onClose:B,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:"550px"}}},children:[V(Ce,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:["\uC8FC\uC18C \uAC80\uC0C9",d(J,{onClick:ee,size:"small",children:d(Le,{})})]}),d(Ie,{style:{padding:0},dividers:!0,children:d(W,{onComplete:C,onClose:B,defaultQuery:R,style:{width:"100%",height:"100%"}})})]})]})}),Ae=U(function({form:t,name:r,onChange:n,...o},s){if(!t||typeof t.useValue!="function")throw new Error("AddressTextField form prop is missing. Provide a form from useForm or useGlobalForm.");if(!r)throw new Error("AddressTextField requires a name when form prop is provided.");let a=t.useValue(r),i=He(u=>{t.handleFormChange(u),n?.(u)},[t,n]);return d(Z,{...o,ref:s,name:r,value:a,onChange:i})}),Fe=U(function(t,r){return t=N(t),z(t)?d(Q,{...Y(t)}):t.form?d(Ae,{...t,ref:r}):d(Z,{...t,ref:r})});export{Fe as AddressTextField};
|
|
2
|
+
/**
|
|
3
|
+
* FormControlsConfig.tsx
|
|
4
|
+
*
|
|
5
|
+
* 앱 전체에 걸 기본값 — 날짜·시간 칸마다 prop 을 달지 않고 한 곳에서 켠다.
|
|
6
|
+
* `pickerCentered`(달력·시간 선택을 칸 옆 팝오버 대신 화면 가운데 창으로)와
|
|
7
|
+
* `timePickerVariant`(시간을 숫자 목록 대신 [오전/오후][시][분] 바퀴로 고르기 — 휴대폰 터치용)가 있다.
|
|
8
|
+
* 휴대폰에서는 칸 바로 아래 뜨는 팝오버가 화면 끝에 걸리거나 키보드·하단 막대에 가려 쓰기 불편해서,
|
|
9
|
+
* 앱이 좁은 화면일 때만 `<FormControlsConfigProvider pickerCentered>` 로 감싸 쓰게 한다.
|
|
10
|
+
* 칸에 `pickerCentered` 를 직접 주면 그 값이 이긴다. Provider 가 없으면 예전 동작(팝오버) 그대로다.
|
|
11
|
+
*
|
|
12
|
+
* @license MIT
|
|
13
|
+
* @copyright 2025 김영진 (Kim Young Jin)
|
|
14
|
+
* @author 김영진 (ehfuse@gmail.com)
|
|
15
|
+
*/
|
|
2
16
|
/**
|
|
3
17
|
* useTextFieldBase.ts
|
|
4
18
|
*
|