# Address input with map pin

> Type a street, pick a suggestion and a pin drops onto a small street map that zooms in on that area.

- Category: [Inputs](https://library.aimran.es/components/inputs)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-in-address-map
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

An address field with an accessible combobox and a stylised street map drawn in inline SVG: blocks, a park, a river and avenues. Suggestions filter without caring about accents and work with the arrow keys and Enter. Choosing one zooms the map towards that spot, drops a pin with a bounce and sends a ripple across the ground.

The main color is the pin and the second color the parks. Replace the suggestion list with results from your geocoding service and their map positions, and use it in delivery checkouts, store finders and booking forms.

## Code

### HTML

```html
<div class="uvq06-ad"><label for="uvq06-ad-in" class="lb">Delivery address</label><div class="fd"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0C18.5 15.4 12 21 12 21z"/><circle cx="12" cy="10" r="2.3"/></svg><input id="uvq06-ad-in" role="combobox" aria-expanded="false" aria-controls="uvq06-ad-ls" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="Street and number"><ul id="uvq06-ad-ls" role="listbox" aria-label="Suggestions" hidden><li role="option" id="uvq06-ad-o0" data-x="40" data-y="38" aria-selected="false"><b>Gran Vía 28</b><span>28013 Madrid</span></li><li role="option" id="uvq06-ad-o1" data-x="64" data-y="46" aria-selected="false"><b>Calle de Alcalá 42</b><span>28014 Madrid</span></li><li role="option" id="uvq06-ad-o2" data-x="72" data-y="70" aria-selected="false"><b>Paseo del Prado 8</b><span>28014 Madrid</span></li><li role="option" id="uvq06-ad-o3" data-x="26" data-y="58" aria-selected="false"><b>Calle Mayor 15</b><span>28013 Madrid</span></li><li role="option" id="uvq06-ad-o4" data-x="48" data-y="72" aria-selected="false"><b>Plaza de Santa Ana 3</b><span>28012 Madrid</span></li><li role="option" id="uvq06-ad-o5" data-x="46" data-y="18" aria-selected="false"><b>Calle de Fuencarral 70</b><span>28004 Madrid</span></li></ul></div><div class="mp" aria-hidden="true"><svg viewBox="0 0 200 110" preserveAspectRatio="xMidYMid slice"><rect class="ld" width="200" height="110"/><rect class="pk" x="118" y="10" width="56" height="34" rx="5"/><circle class="pk" cx="34" cy="88" r="10"/><path class="rv" d="M-5 102C30 92 62 108 100 97S165 80 205 90"/><path class="s2" d="M0 20H200M0 56H200M0 84H200M20 0V110M36 0V110M84 0V110M142 0V110M182 0V110"/><path class="s1" d="M0 40H200M0 70H200M58 0V110M110 0V110M0 106L132 0"/></svg><span class="rp"></span><span class="pin"></span></div><p class="ok" aria-live="polite"></p></div>
```

### CSS

```css
.uvq06-ad {
  --c1: #e11d48;
  --c2: #4ade80;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq06-ad {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 19em;
}

.uvq06-ad .lb {
  display: block;
  margin: 0 0 .45em;
  font-size: .82em;
  font-weight: 650;
}

.uvq06-ad .fd {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .55em;
  padding: 0 .85em;
  border-radius: .9em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-ad .fd:focus-within {
  box-shadow: 0 0 0 2px var(--c1),0 0 0 6px color-mix(in srgb,var(--c1) 18%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
}

.uvq06-ad .fd>svg {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  color: var(--c1);
}

.uvq06-ad input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  color: var(--fg);
  height: 2.8em;
}

.uvq06-ad input::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-ad ul {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .35em);
  margin: 0;
  padding: .3em;
  list-style: none;
  border-radius: .9em;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 1em 2em -.8em rgba(0,0,0,.45);
  transform-origin: 50% 0;
  animation: uvq06-ad-l calc(0.22s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad [hidden] {
  display: none!important;
}

.uvq06-ad li {
  display: grid;
  gap: .1em;
  padding: .42em .6em;
  border-radius: .6em;
  cursor: pointer;
}

.uvq06-ad li[aria-selected="true"] {
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq06-ad li b {
  font-size: .86em;
  font-weight: 650;
}

.uvq06-ad li span {
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-ad .mp {
  position: relative;
  height: 7.6em;
  margin-top: .7em;
  border-radius: 1em;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent);
}

.uvq06-ad svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: var(--x,50%) var(--y,50%);
  scale: var(--z,1);
  transition: scale calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1),transform-origin calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad .ld {
  fill: color-mix(in srgb,var(--fg) 5%,var(--bg));
}

.uvq06-ad .pk {
  fill: color-mix(in srgb,var(--c2) 30%,var(--bg));
}

.uvq06-ad .rv {
  fill: none;
  stroke: color-mix(in srgb,#38bdf8 35%,var(--bg));
  stroke-width: 7;
}

.uvq06-ad .s1,.uvq06-ad .s2 {
  fill: none;
  stroke: color-mix(in srgb,var(--fg) 15%,var(--bg));
}

.uvq06-ad .s1 {
  stroke-width: 4.5;
  stroke: color-mix(in srgb,var(--fg) 20%,var(--bg));
}

.uvq06-ad .s2 {
  stroke-width: 2;
}

.uvq06-ad .pin {
  position: absolute;
  left: var(--x,50%);
  top: var(--y,50%);
  width: 1.5em;
  height: 1.5em;
  margin: -1.75em 0 0 -.75em;
  opacity: 0;
  filter: drop-shadow(0 .3em .2em rgba(0,0,0,.3));
  transition: left calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),top calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-ad .pin::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 0;
  background: var(--c1);
  rotate: -45deg;
}

.uvq06-ad .pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: .5em;
  height: .5em;
  margin: -.25em;
  border-radius: 50%;
  background: #fff;
}

.uvq06-ad.has .pin {
  opacity: 1;
}

.uvq06-ad .pin.drop {
  animation: uvq06-ad calc(0.6s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq06-ad .rp {
  position: absolute;
  left: var(--x,50%);
  top: var(--y,50%);
  width: 2.6em;
  height: 1em;
  margin: -.5em 0 0 -1.3em;
  border: 2px solid var(--c1);
  border-radius: 50%;
  opacity: 0;
  transition: left calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),top calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad .rp.go {
  animation: uvq06-ad-r calc(0.9s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.4s / var(--k));
}

.uvq06-ad .ok {
  min-height: 1.2em;
  margin: .5em 0 0;
  font-size: .76em;
  font-weight: 650;
  color: #16a34a;
}

@keyframes uvq06-ad {
  from {
    transform: translateY(-1.8em);
    opacity: 0;
  }
}

@keyframes uvq06-ad-r {
  0% {
    opacity: .9;
    transform: scale(.3);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes uvq06-ad-l {
  from {
    opacity: 0;
    transform: translateY(-.3em) scale(.97);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq06-ad,.uvq06-ad *,.uvq06-ad *::before,.uvq06-ad *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq06-ad").forEach(el => {
  const i=el.querySelector("input"),ls=el.querySelector("ul"),os=[...ls.children],mp=el.querySelector(".mp"),pin=el.querySelector(".pin"),rp=el.querySelector(".rp"),ok=el.querySelector(".ok");let act=0,vis=[];
const norm=s=>s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();
const mark=()=>{os.forEach(o=>o.setAttribute("aria-selected",String(o===vis[act])));if(vis[act])i.setAttribute("aria-activedescendant",vis[act].id)};
const close=()=>{ls.hidden=true;i.setAttribute("aria-expanded","false");i.removeAttribute("aria-activedescendant")};
const open=()=>{const q=norm(i.value.trim());vis=os.filter(o=>!q||norm(o.textContent).includes(q));os.forEach(o=>o.hidden=!vis.includes(o));if(!vis.length)return close();ls.hidden=false;i.setAttribute("aria-expanded","true");act=0;mark()};
const pick=o=>{i.value=o.querySelector("b").textContent+", Madrid";close();mp.style.setProperty("--x",o.dataset.x+"%");mp.style.setProperty("--y",o.dataset.y+"%");mp.style.setProperty("--z","1.35");pin.classList.remove("drop");rp.classList.remove("go");void pin.offsetWidth;pin.classList.add("drop");rp.classList.add("go");el.classList.add("has");ok.textContent="Delivery available in this area"};
i.addEventListener("input",()=>{el.classList.remove("has");ok.textContent="";mp.style.setProperty("--z","1");open()});
i.addEventListener("focus",open);i.addEventListener("blur",close);
i.addEventListener("keydown",e=>{if(ls.hidden){if(e.key==="ArrowDown"){e.preventDefault();open()}return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();act=(act+(e.key==="ArrowDown"?1:-1)+vis.length)%vis.length;mark()}else if(e.key==="Enter"){e.preventDefault();pick(vis[act])}else if(e.key==="Escape"){e.preventDefault();close()}});
ls.addEventListener("pointerdown",e=>e.preventDefault());
os.forEach(o=>{o.addEventListener("click",()=>pick(o));o.addEventListener("pointermove",()=>{const k=vis.indexOf(o);if(k>-1&&k!==act){act=k;mark()}})});
pick(os[0])
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq06-ad {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 19em;
}

.uvq06-ad .lb {
  display: block;
  margin: 0 0 .45em;
  font-size: .82em;
  font-weight: 650;
}

.uvq06-ad .fd {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .55em;
  padding: 0 .85em;
  border-radius: .9em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-ad .fd:focus-within {
  box-shadow: 0 0 0 2px var(--c1),0 0 0 6px color-mix(in srgb,var(--c1) 18%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
}

.uvq06-ad .fd>svg {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  color: var(--c1);
}

.uvq06-ad input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  color: var(--fg);
  height: 2.8em;
}

.uvq06-ad input::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-ad ul {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .35em);
  margin: 0;
  padding: .3em;
  list-style: none;
  border-radius: .9em;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 1em 2em -.8em rgba(0,0,0,.45);
  transform-origin: 50% 0;
  animation: uvq06-ad-l calc(0.22s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad [hidden] {
  display: none!important;
}

.uvq06-ad li {
  display: grid;
  gap: .1em;
  padding: .42em .6em;
  border-radius: .6em;
  cursor: pointer;
}

.uvq06-ad li[aria-selected="true"] {
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq06-ad li b {
  font-size: .86em;
  font-weight: 650;
}

.uvq06-ad li span {
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-ad .mp {
  position: relative;
  height: 7.6em;
  margin-top: .7em;
  border-radius: 1em;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent);
}

.uvq06-ad svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: var(--x,50%) var(--y,50%);
  scale: var(--z,1);
  transition: scale calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1),transform-origin calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad .ld {
  fill: color-mix(in srgb,var(--fg) 5%,var(--bg));
}

.uvq06-ad .pk {
  fill: color-mix(in srgb,var(--c2) 30%,var(--bg));
}

.uvq06-ad .rv {
  fill: none;
  stroke: color-mix(in srgb,#38bdf8 35%,var(--bg));
  stroke-width: 7;
}

.uvq06-ad .s1,.uvq06-ad .s2 {
  fill: none;
  stroke: color-mix(in srgb,var(--fg) 15%,var(--bg));
}

.uvq06-ad .s1 {
  stroke-width: 4.5;
  stroke: color-mix(in srgb,var(--fg) 20%,var(--bg));
}

.uvq06-ad .s2 {
  stroke-width: 2;
}

.uvq06-ad .pin {
  position: absolute;
  left: var(--x,50%);
  top: var(--y,50%);
  width: 1.5em;
  height: 1.5em;
  margin: -1.75em 0 0 -.75em;
  opacity: 0;
  filter: drop-shadow(0 .3em .2em rgba(0,0,0,.3));
  transition: left calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),top calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-ad .pin::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 0;
  background: var(--c1);
  rotate: -45deg;
}

.uvq06-ad .pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: .5em;
  height: .5em;
  margin: -.25em;
  border-radius: 50%;
  background: #fff;
}

.uvq06-ad.has .pin {
  opacity: 1;
}

.uvq06-ad .pin.drop {
  animation: uvq06-ad calc(0.6s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq06-ad .rp {
  position: absolute;
  left: var(--x,50%);
  top: var(--y,50%);
  width: 2.6em;
  height: 1em;
  margin: -.5em 0 0 -1.3em;
  border: 2px solid var(--c1);
  border-radius: 50%;
  opacity: 0;
  transition: left calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),top calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad .rp.go {
  animation: uvq06-ad-r calc(0.9s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.4s / var(--k));
}

.uvq06-ad .ok {
  min-height: 1.2em;
  margin: .5em 0 0;
  font-size: .76em;
  font-weight: 650;
  color: #16a34a;
}

@keyframes uvq06-ad {
  from {
    transform: translateY(-1.8em);
    opacity: 0;
  }
}

@keyframes uvq06-ad-r {
  0% {
    opacity: .9;
    transform: scale(.3);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes uvq06-ad-l {
  from {
    opacity: 0;
    transform: translateY(-.3em) scale(.97);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq06-ad,.uvq06-ad *,.uvq06-ad *::before,.uvq06-ad *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const i=el.querySelector("input"),ls=el.querySelector("ul"),os=[...ls.children],mp=el.querySelector(".mp"),pin=el.querySelector(".pin"),rp=el.querySelector(".rp"),ok=el.querySelector(".ok");let act=0,vis=[];
const norm=s=>s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();
const mark=()=>{os.forEach(o=>o.setAttribute("aria-selected",String(o===vis[act])));if(vis[act])i.setAttribute("aria-activedescendant",vis[act].id)};
const close=()=>{ls.hidden=true;i.setAttribute("aria-expanded","false");i.removeAttribute("aria-activedescendant")};
const open=()=>{const q=norm(i.value.trim());vis=os.filter(o=>!q||norm(o.textContent).includes(q));os.forEach(o=>o.hidden=!vis.includes(o));if(!vis.length)return close();ls.hidden=false;i.setAttribute("aria-expanded","true");act=0;mark()};
const pick=o=>{i.value=o.querySelector("b").textContent+", Madrid";close();mp.style.setProperty("--x",o.dataset.x+"%");mp.style.setProperty("--y",o.dataset.y+"%");mp.style.setProperty("--z","1.35");pin.classList.remove("drop");rp.classList.remove("go");void pin.offsetWidth;pin.classList.add("drop");rp.classList.add("go");el.classList.add("has");ok.textContent="Delivery available in this area"};
i.addEventListener("input",()=>{el.classList.remove("has");ok.textContent="";mp.style.setProperty("--z","1");open()});
i.addEventListener("focus",open);i.addEventListener("blur",close);
i.addEventListener("keydown",e=>{if(ls.hidden){if(e.key==="ArrowDown"){e.preventDefault();open()}return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();act=(act+(e.key==="ArrowDown"?1:-1)+vis.length)%vis.length;mark()}else if(e.key==="Enter"){e.preventDefault();pick(vis[act])}else if(e.key==="Escape"){e.preventDefault();close()}});
ls.addEventListener("pointerdown",e=>e.preventDefault());
os.forEach(o=>{o.addEventListener("click",()=>pick(o));o.addEventListener("pointermove",()=>{const k=vis.indexOf(o);if(k>-1&&k!==act){act=k;mark()}})});
pick(os[0])
}

export default function InAddressMap() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#e11d48",
          "--c2": "#4ade80",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq06-ad"><label htmlFor="uvq06-ad-in" className="lb">Delivery address</label><div className="fd"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0C18.5 15.4 12 21 12 21z" /><circle cx="12" cy="10" r="2.3" /></svg><input id="uvq06-ad-in" role="combobox" aria-expanded="false" aria-controls="uvq06-ad-ls" aria-autocomplete="list" autoComplete="off" spellCheck="false" placeholder="Street and number" /><ul id="uvq06-ad-ls" role="listbox" aria-label="Suggestions" hidden={true}><li role="option" id="uvq06-ad-o0" data-x="40" data-y="38" aria-selected="false"><b>Gran Vía 28</b><span>28013 Madrid</span></li><li role="option" id="uvq06-ad-o1" data-x="64" data-y="46" aria-selected="false"><b>Calle de Alcalá 42</b><span>28014 Madrid</span></li><li role="option" id="uvq06-ad-o2" data-x="72" data-y="70" aria-selected="false"><b>Paseo del Prado 8</b><span>28014 Madrid</span></li><li role="option" id="uvq06-ad-o3" data-x="26" data-y="58" aria-selected="false"><b>Calle Mayor 15</b><span>28013 Madrid</span></li><li role="option" id="uvq06-ad-o4" data-x="48" data-y="72" aria-selected="false"><b>Plaza de Santa Ana 3</b><span>28012 Madrid</span></li><li role="option" id="uvq06-ad-o5" data-x="46" data-y="18" aria-selected="false"><b>Calle de Fuencarral 70</b><span>28004 Madrid</span></li></ul></div><div className="mp" aria-hidden="true"><svg viewBox="0 0 200 110" preserveAspectRatio="xMidYMid slice"><rect className="ld" width="200" height="110" /><rect className="pk" x="118" y="10" width="56" height="34" rx="5" /><circle className="pk" cx="34" cy="88" r="10" /><path className="rv" d="M-5 102C30 92 62 108 100 97S165 80 205 90" /><path className="s2" d="M0 20H200M0 56H200M0 84H200M20 0V110M36 0V110M84 0V110M142 0V110M182 0V110" /><path className="s1" d="M0 40H200M0 70H200M58 0V110M110 0V110M0 106L132 0" /></svg><span className="rp"></span><span className="pin"></span></div><p className="ok" aria-live="polite"></p></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Address input with map pin” block (Inputs) from AIMRAN Library to my project.

## What it is
Type a street, pick a suggestion and a pin drops onto a small street map that zooms in on that area.

## Chosen settings
- Main color: #e11d48
- Secondary color: #4ade80
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Dirección de entrega"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq06-ad {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 19em;
}

.uvq06-ad .lb {
  display: block;
  margin: 0 0 .45em;
  font-size: .82em;
  font-weight: 650;
}

.uvq06-ad .fd {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .55em;
  padding: 0 .85em;
  border-radius: .9em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-ad .fd:focus-within {
  box-shadow: 0 0 0 2px var(--c1),0 0 0 6px color-mix(in srgb,var(--c1) 18%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
}

.uvq06-ad .fd>svg {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  color: var(--c1);
}

.uvq06-ad input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  color: var(--fg);
  height: 2.8em;
}

.uvq06-ad input::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-ad ul {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .35em);
  margin: 0;
  padding: .3em;
  list-style: none;
  border-radius: .9em;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 1em 2em -.8em rgba(0,0,0,.45);
  transform-origin: 50% 0;
  animation: uvq06-ad-l calc(0.22s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad [hidden] {
  display: none!important;
}

.uvq06-ad li {
  display: grid;
  gap: .1em;
  padding: .42em .6em;
  border-radius: .6em;
  cursor: pointer;
}

.uvq06-ad li[aria-selected="true"] {
  background: color-mix(in srgb,var(--c1) 12%,transparent);
}

.uvq06-ad li b {
  font-size: .86em;
  font-weight: 650;
}

.uvq06-ad li span {
  font-size: .7em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-ad .mp {
  position: relative;
  height: 7.6em;
  margin-top: .7em;
  border-radius: 1em;
  overflow: hidden;
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent);
}

.uvq06-ad svg {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: var(--x,50%) var(--y,50%);
  scale: var(--z,1);
  transition: scale calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1),transform-origin calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad .ld {
  fill: color-mix(in srgb,var(--fg) 5%,var(--bg));
}

.uvq06-ad .pk {
  fill: color-mix(in srgb,var(--c2) 30%,var(--bg));
}

.uvq06-ad .rv {
  fill: none;
  stroke: color-mix(in srgb,#38bdf8 35%,var(--bg));
  stroke-width: 7;
}

.uvq06-ad .s1,.uvq06-ad .s2 {
  fill: none;
  stroke: color-mix(in srgb,var(--fg) 15%,var(--bg));
}

.uvq06-ad .s1 {
  stroke-width: 4.5;
  stroke: color-mix(in srgb,var(--fg) 20%,var(--bg));
}

.uvq06-ad .s2 {
  stroke-width: 2;
}

.uvq06-ad .pin {
  position: absolute;
  left: var(--x,50%);
  top: var(--y,50%);
  width: 1.5em;
  height: 1.5em;
  margin: -1.75em 0 0 -.75em;
  opacity: 0;
  filter: drop-shadow(0 .3em .2em rgba(0,0,0,.3));
  transition: left calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),top calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-ad .pin::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 0;
  background: var(--c1);
  rotate: -45deg;
}

.uvq06-ad .pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: .5em;
  height: .5em;
  margin: -.25em;
  border-radius: 50%;
  background: #fff;
}

.uvq06-ad.has .pin {
  opacity: 1;
}

.uvq06-ad .pin.drop {
  animation: uvq06-ad calc(0.6s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq06-ad .rp {
  position: absolute;
  left: var(--x,50%);
  top: var(--y,50%);
  width: 2.6em;
  height: 1em;
  margin: -.5em 0 0 -1.3em;
  border: 2px solid var(--c1);
  border-radius: 50%;
  opacity: 0;
  transition: left calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1),top calc(0.7s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-ad .rp.go {
  animation: uvq06-ad-r calc(0.9s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.4s / var(--k));
}

.uvq06-ad .ok {
  min-height: 1.2em;
  margin: .5em 0 0;
  font-size: .76em;
  font-weight: 650;
  color: #16a34a;
}

@keyframes uvq06-ad {
  from {
    transform: translateY(-1.8em);
    opacity: 0;
  }
}

@keyframes uvq06-ad-r {
  0% {
    opacity: .9;
    transform: scale(.3);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes uvq06-ad-l {
  from {
    opacity: 0;
    transform: translateY(-.3em) scale(.97);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq06-ad,.uvq06-ad *,.uvq06-ad *::before,.uvq06-ad *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const i=el.querySelector("input"),ls=el.querySelector("ul"),os=[...ls.children],mp=el.querySelector(".mp"),pin=el.querySelector(".pin"),rp=el.querySelector(".rp"),ok=el.querySelector(".ok");let act=0,vis=[];
const norm=s=>s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();
const mark=()=>{os.forEach(o=>o.setAttribute("aria-selected",String(o===vis[act])));if(vis[act])i.setAttribute("aria-activedescendant",vis[act].id)};
const close=()=>{ls.hidden=true;i.setAttribute("aria-expanded","false");i.removeAttribute("aria-activedescendant")};
const open=()=>{const q=norm(i.value.trim());vis=os.filter(o=>!q||norm(o.textContent).includes(q));os.forEach(o=>o.hidden=!vis.includes(o));if(!vis.length)return close();ls.hidden=false;i.setAttribute("aria-expanded","true");act=0;mark()};
const pick=o=>{i.value=o.querySelector("b").textContent+", Madrid";close();mp.style.setProperty("--x",o.dataset.x+"%");mp.style.setProperty("--y",o.dataset.y+"%");mp.style.setProperty("--z","1.35");pin.classList.remove("drop");rp.classList.remove("go");void pin.offsetWidth;pin.classList.add("drop");rp.classList.add("go");el.classList.add("has");ok.textContent="Delivery available in this area"};
i.addEventListener("input",()=>{el.classList.remove("has");ok.textContent="";mp.style.setProperty("--z","1");open()});
i.addEventListener("focus",open);i.addEventListener("blur",close);
i.addEventListener("keydown",e=>{if(ls.hidden){if(e.key==="ArrowDown"){e.preventDefault();open()}return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();act=(act+(e.key==="ArrowDown"?1:-1)+vis.length)%vis.length;mark()}else if(e.key==="Enter"){e.preventDefault();pick(vis[act])}else if(e.key==="Escape"){e.preventDefault();close()}});
ls.addEventListener("pointerdown",e=>e.preventDefault());
os.forEach(o=>{o.addEventListener("click",()=>pick(o));o.addEventListener("pointermove",()=>{const k=vis.indexOf(o);if(k>-1&&k!==act){act=k;mark()}})});
pick(os[0])
}

export default function InAddressMap() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#e11d48",
          "--c2": "#4ade80",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq06-ad"><label htmlFor="uvq06-ad-in" className="lb">Delivery address</label><div className="fd"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0C18.5 15.4 12 21 12 21z" /><circle cx="12" cy="10" r="2.3" /></svg><input id="uvq06-ad-in" role="combobox" aria-expanded="false" aria-controls="uvq06-ad-ls" aria-autocomplete="list" autoComplete="off" spellCheck="false" placeholder="Street and number" /><ul id="uvq06-ad-ls" role="listbox" aria-label="Suggestions" hidden={true}><li role="option" id="uvq06-ad-o0" data-x="40" data-y="38" aria-selected="false"><b>Gran Vía 28</b><span>28013 Madrid</span></li><li role="option" id="uvq06-ad-o1" data-x="64" data-y="46" aria-selected="false"><b>Calle de Alcalá 42</b><span>28014 Madrid</span></li><li role="option" id="uvq06-ad-o2" data-x="72" data-y="70" aria-selected="false"><b>Paseo del Prado 8</b><span>28014 Madrid</span></li><li role="option" id="uvq06-ad-o3" data-x="26" data-y="58" aria-selected="false"><b>Calle Mayor 15</b><span>28013 Madrid</span></li><li role="option" id="uvq06-ad-o4" data-x="48" data-y="72" aria-selected="false"><b>Plaza de Santa Ana 3</b><span>28012 Madrid</span></li><li role="option" id="uvq06-ad-o5" data-x="46" data-y="18" aria-selected="false"><b>Calle de Fuencarral 70</b><span>28004 Madrid</span></li></ul></div><div className="mp" aria-hidden="true"><svg viewBox="0 0 200 110" preserveAspectRatio="xMidYMid slice"><rect className="ld" width="200" height="110" /><rect className="pk" x="118" y="10" width="56" height="34" rx="5" /><circle className="pk" cx="34" cy="88" r="10" /><path className="rv" d="M-5 102C30 92 62 108 100 97S165 80 205 90" /><path className="s2" d="M0 20H200M0 56H200M0 84H200M20 0V110M36 0V110M84 0V110M142 0V110M182 0V110" /><path className="s1" d="M0 40H200M0 70H200M58 0V110M110 0V110M0 106L132 0" /></svg><span className="rp"></span><span className="pin"></span></div><p className="ok" aria-live="polite"></p></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
