| 1 |
import{a as y,g as _,i as b,H as z,j as t,_ as d,f as g,bI as f,b1 as C}from"./main-96.js";import{F as r}from"./bf-460-326.js";import{S as I}from"./bf-283-176.js";import"./bf-781-46.js";import"./bf-687-180.js";import"./bf-551-68.js";import"./bf-200-43.js";import"./bf-431-60.js";/* empty css */import"./bf-63-62.js";import"./bf-762-63.js";import"./bf-163-182.js";const j=[{value:"auto",label:"Auto (country-driven)"},{value:"off",label:"Off"},{value:"custom",label:"Custom regex"}];function H(){var m,u;const{css:i}=y(),{fieldKey:e}=_(),[o,p]=b(C);if(!e)return null;const l=z(o[e]),c=((m=l.config)==null?void 0:m.zipValidation)||"auto",x=((u=l.config)==null?void 0:u.zipCustomRegex)||"",v=({target:{value:a}})=>{const s=g(o,n=>{n[e].config.zipValidation=a});p(s),f({event:`ZIP validation set to '${a}': ${l.lbl||e}`,type:"address_zip_validation_changed",state:{fields:s,fldKey:e}})},h=({target:{value:a}})=>{const s=g(o,n=>{n[e].config.zipCustomRegex=a});p(s),f({event:`ZIP custom regex updated: ${l.lbl||e}`,type:"address_zip_regex_changed",state:{fields:s,fldKey:e}})};return t.jsx(I,{id:"addr-zip-val-stng",title:d("ZIP / Postal Validation"),className:i(r.fieldSection,r.hover_tip),open:!0,children:t.jsxs("div",{className:i({px:6,py:10}),children:[j.map(a=>t.jsxs("label",{className:i({dy:"flex",alignItems:"center",gap:8,mb:6,cursor:"pointer"}),children:[t.jsx("input",{type:"radio",name:`zip-val-${e}`,value:a.value,checked:c===a.value,onChange:v}),d(a.label)]},a.value)),c==="custom"&&t.jsx("div",{className:i({mt:8}),children:t.jsx("input",{"data-testid":"addr-zip-regex-inp",className:i(r.input),type:"text",placeholder:"e.g. ^\\d{5}(-\\d{4})?$","aria-label":d("Custom ZIP regex pattern"),value:x,onChange:h})})]})})}export{H as default}; |