@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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 KIM YOUNG JIN (ehfuse@gmail.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 KIM YOUNG JIN (ehfuse@gmail.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * SwitchField.tsx
3
+ *
4
+ * @license MIT
5
+ * @copyright 2025 김영진 (Kim Young Jin)
6
+ * @author 김영진 (ehfuse@gmail.com)
7
+ */
8
+ import React from "react";
9
+ import type { SwitchFieldProps } from "./types";
10
+ export declare const SwitchField: React.ForwardRefExoticComponent<Omit<SwitchFieldProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -7,9 +7,4 @@
7
7
  */
8
8
  import React from "react";
9
9
  import type { BaseTextFieldProps } from "./types";
10
- /** slotProps.input 에서 start/endAdornment 만 뽑아 박스 렌더에 넘긴다(함수형 slotProps 는 무시). */
11
- export declare function pickAdornments(slotProps: unknown): {
12
- startAdornment?: React.ReactNode;
13
- endAdornment?: React.ReactNode;
14
- };
15
10
  export declare const TextField: React.ForwardRefExoticComponent<(Omit<import("@mui/material").FilledTextFieldProps & BaseTextFieldProps, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & BaseTextFieldProps, "ref"> | Omit<import("@mui/material").StandardTextFieldProps & BaseTextFieldProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ToggleButtonGroupField.tsx
3
+ *
4
+ * @license MIT
5
+ * @copyright 2025 김영진 (Kim Young Jin)
6
+ * @author 김영진 (ehfuse@gmail.com)
7
+ */
8
+ import React from "react";
9
+ import type { ToggleButtonGroupFieldProps } from "./types";
10
+ export declare const ToggleButtonGroupField: React.ForwardRefExoticComponent<Omit<ToggleButtonGroupFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
package/dist/address.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ae=Object.create;var D=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var me=(e,t)=>{for(var n in t)D(e,n,{get:t[n],enumerable:!0})},_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ue(t))!de.call(e,o)&&o!==n&&D(e,o,{get:()=>t[o],enumerable:!(r=ie(t,o))||r.enumerable});return e};var S=(e,t,n)=>(n=e!=null?ae(ce(e)):{},_(t||!e||!e.__esModule?D(n,"default",{value:e,enumerable:!0}):n,e)),fe=e=>_(D({},"__esModule",{value:!0}),e);var Ce={};me(Ce,{AddressTextField:()=>re});module.exports=fe(Ce);var p=require("@mui/material"),ee=S(require("@mui/icons-material/Search")),te=S(require("@mui/icons-material/Close")),d=require("react");var g=S(require("react")),V=function(e,t){return V=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)r.hasOwnProperty(o)&&(n[o]=r[o])},V(e,t)},C=function(){return C=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},C.apply(this,arguments)};function pe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}var A,Y="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",he=(A=null,function(e){return e===void 0&&(e=Y),A||(A=new Promise((function(t,n){var r=document.createElement("script");r.src=e,r.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 t(a);n(new Error("Script is loaded successfully, but cannot find Postcode module. Check your scriptURL property."))},r.onerror=function(o){return n(o)},r.id="kakao_postcode_script",document.body.appendChild(r)})))}),ge=g.default.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."),ve={width:"100%",height:400},be={scriptUrl:Y,errorMessage:ge,autoClose:!0},z=(function(e){function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.mounted=!1,n.wrap=(0,g.createRef)(),n.state={hasError:!1,completed:!1},n.initiate=function(r){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,h=o.onResize,f=o.onSearch,b=pe(o,["scriptUrl","className","style","defaultQuery","autoClose","errorMessage","onComplete","onClose","onResize","onSearch"]);new r(C(C({},b),{oncomplete:function(w){a&&a(w),n.setState({completed:!0})},onsearch:f,onresize:h,onclose:u,width:"100%",height:"100%"})).embed(n.wrap.current,{q:i,autoClose:s})}},n.onError=function(r){console.error(r),n.setState({hasError:!0})},n}return(function(n,r){function o(){this.constructor=n}V(n,r),n.prototype=r===null?Object.create(r):(o.prototype=r.prototype,new o)})(t,e),t.prototype.componentDidMount=function(){var n=this.initiate,r=this.onError,o=this.props.scriptUrl;o&&(this.mounted||(he(o).then(n).catch(r),this.mounted=!0))},t.prototype.render=function(){var n=this.props,r=n.className,o=n.style,i=n.errorMessage,s=n.autoClose,a=this.state,u=a.hasError,h=a.completed;return s===!0&&h===!0?null:g.default.createElement("div",{ref:this.wrap,className:r,style:C(C({},ve),o)},u&&i)},t.defaultProps=be,t})(g.Component);var v=require("react");function U({name:e="",debounce:t,onChange:n}){let r=(0,v.useRef)(""),o=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let i=(0,v.useCallback)((a,u,h=!1)=>{if(u===r.current)return;let f=()=>{if(u!==r.current&&(r.current=u,n)){let b={...a||{},target:{...a?.target||{},name:e,value:u}};n(b)}};o.current&&clearTimeout(o.current),h||t===void 0||t===0?f():o.current=setTimeout(f,t)},[n,t,e]),s=(0,v.useCallback)((a,u)=>{if(o.current&&(clearTimeout(o.current),o.current=null),u!==r.current&&(r.current=u,n)){let h={...a,target:{...a.target,name:e,value:u}};n(h)}},[n,e]);return{emitChange:i,flushOnBlur:s,lastEmittedValue:r,debounceTimer:o}}var B=require("react");var N=require("react");var j=require("react");var W=require("react");var R=require("@mui/material/styles"),q=require("@mui/material"),m=require("react/jsx-runtime");var ye=(0,R.styled)(q.Box,{shouldForwardProp:e=>e!=="small"&&e!=="fullWidth"&&e!=="dimmed"})(({theme:e,small:t,fullWidth:n,dimmed:r})=>({position:"relative",display:"inline-flex",alignItems:"center",width:n?"100%":void 0,minHeight:t?40:56,borderRadius:e.shape.borderRadius||4,color:r?e.palette.text.disabled:e.palette.text.primary,font:"inherit",boxSizing:"border-box"})),Ee=(0,R.styled)("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}}})),Re=(0,R.styled)("span",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:t})=>({position:"absolute",top:0,left:9,transform:"translateY(-50%)",padding:"0 4px",fontSize:"0.75rem",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"})),we=(0,R.styled)("div",{shouldForwardProp:e=>e!=="align"&&e!=="small"&&e!=="multiline"})(({align:e,small:t,multiline:n})=>({display:"flex",alignItems:n?"flex-start":"center",gap:4,width:"100%",padding:t?"8.5px 14px":"16.5px 14px",fontSize:"1rem",lineHeight:"1.4375em",justifyContent:e==="right"?"flex-end":e==="center"?"center":"flex-start",minWidth:0})),Te=(0,R.styled)("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"})),F=(0,R.styled)("span",{shouldForwardProp:e=>e!=="pushRight"})(({theme:e,pushRight:t})=>({flexShrink:0,display:"inline-flex",alignItems:"center",marginLeft:t?"auto":void 0,color:e.palette.text.secondary}));function G({label:e,value:t,prefix:n,suffix:r,startAdornment:o,endAdornment:i,showAffixOnlyWithValue:s=!1,align:a="left",size:u="medium",fullWidth:h,dimmed:f=!1,multiline:b=!1,onClick:w,title:T,className:I,id:O,sx:x}){let H=u==="small",P=!(t==null||t===""),M=!s||P;return(0,m.jsxs)(ye,{small:H,fullWidth:h,dimmed:f,className:I,id:O,title:T,onClick:w,sx:x,children:[(0,m.jsx)(Ee,{"aria-hidden":"true",dimmed:f,children:(0,m.jsx)("legend",{children:e?(0,m.jsx)("span",{children:e}):(0,m.jsx)("span",{children:"\u200B"})})}),e?(0,m.jsx)(Re,{dimmed:f,children:e}):null,(0,m.jsxs)(we,{align:a,small:H,multiline:b,children:[o?(0,m.jsx)(F,{children:o}):null,n&&M?(0,m.jsx)(F,{children:n}):null,(0,m.jsx)(Te,{multiline:b,children:t}),r&&M?(0,m.jsx)(F,{children:r}):null,i?(0,m.jsx)(F,{pushRight:a!=="right",children:i}):null]})]})}var k=require("react/jsx-runtime");function Q(e){return!!(e.readonly||e.disabled)&&!e.readonlyInput}function J(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 X(e,t){return t?t(e):e==null?"":String(e)}function Ie({form:e,name:t,value:n,format:r,disabled:o,...i}){let s=e.useValue(t);return(0,k.jsx)(G,{...i,value:X(s===void 0?n:s,r),dimmed:!!o})}function Z(e){if(e.form&&e.name&&typeof e.form.useValue=="function")return(0,k.jsx)(Ie,{...e});let{form:t,name:n,value:r,format:o,disabled:i,...s}=e;return(0,k.jsx)(G,{...s,value:X(r,o),dimmed:!!i})}var c=require("react/jsx-runtime");var ne=(0,d.forwardRef)(function({value:t,onChange:n,readonly:r,debounce:o,onBlur:i,size:s,spellCheck:a=!1,onAddressComplete:u,inputRef:h,...f},b){let w=(0,d.useRef)(null);(0,d.useImperativeHandle)(h,()=>w.current,[]);let[T,I]=(0,d.useState)(typeof t=="string"?t:""),[O,x]=(0,d.useState)(!1),H=s==="small"?20:24,{emitChange:P,flushOnBlur:M,lastEmittedValue:L}=U({name:f.name,debounce:o,onChange:n});(0,d.useEffect)(()=>{if(t!=null){let l=String(t);l!==L.current&&(I(l),L.current=l)}else L.current!==""&&(I(""),L.current="")},[t,L]);let oe=l=>{let y=l.address,E="";l.addressType==="R"&&(l.bname!==""&&/[동|로|가]$/g.test(l.bname)&&(E+=l.bname),l.buildingName!==""&&l.apartment==="Y"&&(E+=E!==""?", "+l.buildingName:l.buildingName),E!==""&&(E=" ("+E+")"),y+=E),I(y),P(null,y,!0),u?.(y,l),x(!1)},K=()=>{x(!0)},se=l=>{l.key==="Enter"&&(l.preventDefault(),K())},$=()=>{x(!1)},le=()=>{x(!1),P(null,T,!0)};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p.TextField,{...f,ref:b,inputRef:w,size:s,value:T,onChange:r?void 0:l=>{let y=l.target.value;I(y),P(l,y)},autoComplete:"off",spellCheck:a,onKeyDown:r?void 0:se,onBlur:r?void 0:l=>{M(l,T),i&&i(l)},sx:{...r?{"& .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)"}}:{},...r&&{pointerEvents:"none"}},slotProps:{...f.slotProps,input:{...f.slotProps?.input,readOnly:r,endAdornment:r?void 0:(0,c.jsx)(p.InputAdornment,{position:"end",sx:{mr:s==="small"?-.5:.5},children:(0,c.jsx)(p.IconButton,{tabIndex:-1,onClick:K,edge:"end","aria-label":"\uC8FC\uC18C \uCC3E\uAE30",size:s,children:(0,c.jsx)(ee.default,{sx:{fontSize:H}})})})}}}),(0,c.jsxs)(p.Dialog,{open:O,onClose:$,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:"550px"}}},children:[(0,c.jsxs)(p.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:["\uC8FC\uC18C \uAC80\uC0C9",(0,c.jsx)(p.IconButton,{onClick:le,size:"small",children:(0,c.jsx)(te.default,{})})]}),(0,c.jsx)(p.DialogContent,{style:{padding:0},dividers:!0,children:(0,c.jsx)(z,{onComplete:oe,onClose:$,defaultQuery:T,style:{width:"100%",height:"100%"}})})]})]})}),xe=(0,d.forwardRef)(function({form:t,name:n,onChange:r,...o},i){if(!t||typeof t.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=t.useValue(n),a=(0,d.useCallback)(u=>{t.handleFormChange(u),r?.(u)},[t,r]);return(0,c.jsx)(ne,{...o,ref:i,name:n,value:s,onChange:a})}),re=(0,d.forwardRef)(function(t,n){return Q(t)?(0,c.jsx)(Z,{...J(t)}):t.form?(0,c.jsx)(xe,{...t,ref:n}):(0,c.jsx)(ne,{...t,ref:n})});0&&(module.exports={AddressTextField});
1
+ "use strict";var ie=Object.create;var k=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var fe=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},Y=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ce(t))!me.call(e,o)&&o!==n&&k(e,o,{get:()=>t[o],enumerable:!(r=ue(t,o))||r.enumerable});return e};var U=(e,t,n)=>(n=e!=null?ie(de(e)):{},Y(t||!e||!e.__esModule?k(n,"default",{value:e,enumerable:!0}):n,e)),pe=e=>Y(k({},"__esModule",{value:!0}),e);var Le={};fe(Le,{AddressTextField:()=>le});module.exports=pe(Le);var f=require("@mui/material"),re=U(require("@mui/icons-material/Search")),oe=U(require("@mui/icons-material/Close")),d=require("react");var h=U(require("react")),N=function(e,t){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var o in r)r.hasOwnProperty(o)&&(n[o]=r[o])},N(e,t)},M=function(){return M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},M.apply(this,arguments)};function ge(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}var B,q="https://t1.kakaocdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js",he=(B=null,function(e){return e===void 0&&(e=q),B||(B=new Promise((function(t,n){var r=document.createElement("script");r.src=e,r.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 t(i);n(new Error("Script is loaded successfully, but cannot find Postcode module. Check your scriptURL property."))},r.onerror=function(o){return n(o)},r.id="kakao_postcode_script",document.body.appendChild(r)})))}),ve=h.default.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."),be={width:"100%",height:400},ye={scriptUrl:q,errorMessage:ve,autoClose:!0},Q=(function(e){function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.mounted=!1,n.wrap=(0,h.createRef)(),n.state={hasError:!1,completed:!1},n.initiate=function(r){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,p=o.onResize,m=o.onSearch,b=ge(o,["scriptUrl","className","style","defaultQuery","autoClose","errorMessage","onComplete","onClose","onResize","onSearch"]);new r(M(M({},b),{oncomplete:function(T){i&&i(T),n.setState({completed:!0})},onsearch:m,onresize:p,onclose:u,width:"100%",height:"100%"})).embed(n.wrap.current,{q:s,autoClose:l})}},n.onError=function(r){console.error(r),n.setState({hasError:!0})},n}return(function(n,r){function o(){this.constructor=n}N(n,r),n.prototype=r===null?Object.create(r):(o.prototype=r.prototype,new o)})(t,e),t.prototype.componentDidMount=function(){var n=this.initiate,r=this.onError,o=this.props.scriptUrl;o&&(this.mounted||(he(o).then(n).catch(r),this.mounted=!0))},t.prototype.render=function(){var n=this.props,r=n.className,o=n.style,s=n.errorMessage,l=n.autoClose,i=this.state,u=i.hasError,p=i.completed;return l===!0&&p===!0?null:h.default.createElement("div",{ref:this.wrap,className:r,style:M(M({},be),o)},u&&s)},t.defaultProps=ye,t})(h.Component);var v=require("react");function j({name:e="",debounce:t,onChange:n}){let r=(0,v.useRef)(""),o=(0,v.useRef)(null);(0,v.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=(0,v.useCallback)((i,u,p=!1)=>{if(u===r.current)return;let m=()=>{if(u!==r.current&&(r.current=u,n)){let b={...i||{},target:{...i?.target||{},name:e,value:u}};n(b)}};o.current&&clearTimeout(o.current),p||t===void 0||t===0?m():o.current=setTimeout(m,t)},[n,t,e]),l=(0,v.useCallback)((i,u)=>{if(o.current&&(clearTimeout(o.current),o.current=null),u!==r.current&&(r.current=u,n)){let p={...i,target:{...i.target,name:e,value:u}};n(p)}},[n,e]);return{emitChange:s,flushOnBlur:l,lastEmittedValue:r,debounceTimer:o}}var $=require("react");var W=require("react");var G=require("react");var K=require("react");var H=require("@mui/material/styles"),X=require("@mui/material"),g=require("react/jsx-runtime");var w={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"},Re=(0,H.styled)(X.Box,{shouldForwardProp:e=>e!=="small"&&e!=="fullWidth"&&e!=="dimmed"&&e!=="multiline"})(({theme:e,small:t,fullWidth:n,dimmed:r,multiline:o})=>({position:"relative",display:"inline-flex",alignItems:o?"flex-start":"center",width:n?"100%":void 0,minHeight:t?40:56,borderRadius:e.shape.borderRadius||4,color:r?e.palette.text.disabled:e.palette.text.primary,font:"inherit",boxSizing:"border-box"})),Ee=(0,H.styled)("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}}})),we=(0,H.styled)("span",{shouldForwardProp:e=>e!=="dimmed"})(({theme:e,dimmed:t})=>({position:"absolute",top:0,left:9,transform:"translateY(-50%)",padding:"0 4px",fontSize:"0.75rem",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})),Te=(0,H.styled)("div",{shouldForwardProp:e=>e!=="multiline"&&e!=="small"&&e!=="align"&&e!=="hasStart"&&e!=="hasEnd"&&e!=="minRows"})(({multiline:e,small:t,align:n,hasStart:r,hasEnd:o,minRows:s})=>({flex:1,minWidth:0,boxSizing:"border-box",padding:t?"8.5px 14px":"16.5px 14px",paddingLeft:r?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"})),J=(0,H.styled)("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 _({label:e,value:t,prefix:n,suffix:r,startAdornment:o,endAdornment:s,showAffixOnlyWithValue:l=!1,align:i="left",size:u="medium",fullWidth:p,dimmed:m=!1,multiline:b=!1,minRows:T,onClick:I,title:x,className:S,id:C,sx:O}){let P=u==="small",V=!(t==null||t===""),y=!l||V,D=o||(n&&y?n:null),L=s||(r&&y?r:null),A=m?` ${w.disabled}`:"";return(0,g.jsxs)(Re,{small:P,fullWidth:p,dimmed:m,multiline:b,className:`${w.root}${A}${S?` ${S}`:""}`,id:C,title:x,onClick:I,sx:O,children:[(0,g.jsx)(Ee,{"aria-hidden":"true",dimmed:m,className:w.outline,children:(0,g.jsx)("legend",{children:e?(0,g.jsx)("span",{children:e}):(0,g.jsx)("span",{children:"\u200B"})})}),e?(0,g.jsx)(we,{dimmed:m,className:`${w.label}${A}`,children:e}):null,D?(0,g.jsx)(J,{side:"start",className:w.adornment,children:D}):null,(0,g.jsx)(Te,{className:`${w.input}${A}`,multiline:b,small:P,align:i,hasStart:!!D,hasEnd:!!L,minRows:T,children:t}),L?(0,g.jsx)(J,{side:"end",className:w.adornment,children:L}):null]})}var F=require("react/jsx-runtime");function Z(e){return!!(e.readonly||e.disabled)&&!e.readonlyInput}function Ie(e){let t=e,n=t?.input,r=t?.htmlInput?.style?.textAlign;return{startAdornment:n&&typeof n!="function"?n.startAdornment:void 0,endAdornment:n&&typeof n!="function"?n.endAdornment:void 0,align:r==="right"||r==="center"?r:void 0}}function xe(e,t){if(!e)return t;if(!t)return e;let n=r=>Array.isArray(r)?r:[r];return[...n(e),...n(t)]}function ee(e){let t=Ie(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:xe(e.formControlProps?.sx,e.sx),...t}}function te(e,t){return t?t(e):e==null?"":String(e)}function Ce({form:e,name:t,value:n,format:r,disabled:o,...s}){let l=e.useValue(t);return(0,F.jsx)(_,{...s,value:te(l===void 0?n:l,r),dimmed:!!o})}function ne(e){if(e.form&&e.name&&typeof e.form.useValue=="function")return(0,F.jsx)(Ce,{...e});let{form:t,name:n,value:r,format:o,disabled:s,...l}=e;return(0,F.jsx)(_,{...l,value:te(r,o),dimmed:!!s})}var c=require("react/jsx-runtime");var se=(0,d.forwardRef)(function({value:t,onChange:n,readonly:r,debounce:o,onBlur:s,size:l,spellCheck:i=!1,onAddressComplete:u,inputRef:p,...m},b){let T=(0,d.useRef)(null);(0,d.useImperativeHandle)(p,()=>T.current,[]);let[I,x]=(0,d.useState)(typeof t=="string"?t:""),[S,C]=(0,d.useState)(!1),O=l==="small"?20:24,{emitChange:P,flushOnBlur:V,lastEmittedValue:y}=j({name:m.name,debounce:o,onChange:n});(0,d.useEffect)(()=>{if(t!=null){let a=String(t);a!==y.current&&(x(a),y.current=a)}else y.current!==""&&(x(""),y.current="")},[t,y]);let D=a=>{let R=a.address,E="";a.addressType==="R"&&(a.bname!==""&&/[동|로|가]$/g.test(a.bname)&&(E+=a.bname),a.buildingName!==""&&a.apartment==="Y"&&(E+=E!==""?", "+a.buildingName:a.buildingName),E!==""&&(E=" ("+E+")"),R+=E),x(R),P(null,R,!0),u?.(R,a),C(!1)},L=()=>{C(!0)},A=a=>{a.key==="Enter"&&(a.preventDefault(),L())},z=()=>{C(!1)},ae=()=>{C(!1),P(null,I,!0)};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(f.TextField,{...m,ref:b,inputRef:T,size:l,value:I,onChange:r?void 0:a=>{let R=a.target.value;x(R),P(a,R)},autoComplete:"off",spellCheck:i,onKeyDown:r?void 0:A,onBlur:r?void 0:a=>{V(a,I),s&&s(a)},sx:{...r?{"& .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)"}}:{},...r&&{pointerEvents:"none"}},slotProps:{...m.slotProps,input:{...m.slotProps?.input,readOnly:r,endAdornment:r?void 0:(0,c.jsx)(f.InputAdornment,{position:"end",sx:{mr:l==="small"?-.5:.5},children:(0,c.jsx)(f.IconButton,{tabIndex:-1,onClick:L,edge:"end","aria-label":"\uC8FC\uC18C \uCC3E\uAE30",size:l,children:(0,c.jsx)(re.default,{sx:{fontSize:O}})})})}}}),(0,c.jsxs)(f.Dialog,{open:S,onClose:z,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{height:"550px"}}},children:[(0,c.jsxs)(f.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",pr:2},children:["\uC8FC\uC18C \uAC80\uC0C9",(0,c.jsx)(f.IconButton,{onClick:ae,size:"small",children:(0,c.jsx)(oe.default,{})})]}),(0,c.jsx)(f.DialogContent,{style:{padding:0},dividers:!0,children:(0,c.jsx)(Q,{onComplete:D,onClose:z,defaultQuery:I,style:{width:"100%",height:"100%"}})})]})]})}),Pe=(0,d.forwardRef)(function({form:t,name:n,onChange:r,...o},s){if(!t||typeof t.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=t.useValue(n),i=(0,d.useCallback)(u=>{t.handleFormChange(u),r?.(u)},[t,r]);return(0,c.jsx)(se,{...o,ref:s,name:n,value:l,onChange:i})}),le=(0,d.forwardRef)(function(t,n){return Z(t)?(0,c.jsx)(ne,{...ee(t)}):t.form?(0,c.jsx)(Pe,{...t,ref:n}):(0,c.jsx)(se,{...t,ref:n})});0&&(module.exports={AddressTextField});
2
2
  /**
3
3
  * useTextFieldBase.ts
4
4
  *
@@ -51,6 +51,12 @@
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)