UNPKG

@geoapify/geocoder-autocomplete

Version:

A JavaScript address autocomplete input, compatible with Leaflet, MapLibre, OpenLayers, and other map libraries for efficient location search and geocoding.

428 lines (360 loc) 8.35 kB
.geoapify-input-wrapper { position: relative; flex: 0 0 auto; } .geoapify-autocomplete-input { outline: none; line-height: 36px; height: 36px; padding: 0 31px 0 7px; width: calc(100% - 40px); border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 5px; font-size: 14px; } .geoapify-autocomplete-items { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background-color: #fff; border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 5px; overflow: hidden; box-shadow: 0px 2px 10px 2px rgba(0, 0, 0, 0.1); z-index: 99; } .geoapify-autocomplete-items div { padding: 10px; cursor: pointer; } .geoapify-autocomplete-items div:hover { background-color: rgba(0, 0, 0, 0.1); } .geoapify-autocomplete-items .active { background-color: rgba(0, 0, 0, 0.1); } .geoapify-autocomplete-item { display: flex; flex-direction: row; align-items: center; } .geoapify-autocomplete-item .icon { display: inline-block; width: 40px; height: 24px; color: #aaa; flex: 0 0 40px; } .geoapify-autocomplete-item .icon.emoji { color: unset; font-size: 20px; opacity: 0.9; } .geoapify-close-button { position: absolute; right: 5px; top: 0; height: 100%; display: none; align-items: center; } .geoapify-close-button.visible { display: flex; } .geoapify-close-button { color: rgba(0, 0, 0, 0.4); cursor: pointer; } .geoapify-close-button:hover { color: rgba(0, 0, 0, 0.6); } .geoapify-autocomplete-items .main-part .non-verified { color: #ff4848; } .geoapify-places-list { background-color: #fff; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 5px 5px 5px 5px; display: none; margin-top: 5px; } .geoapify-geocoder-autocomplete-container { display: flex; flex-direction: column; align-items: stretch; position: relative; pointer-events: all; } .geoapify-places-list.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; } .geoapify-places-title-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid rgba(0, 0, 0, 0.1); background-color: #f8f9fa; font-size: 13px; color: rgba(0, 0, 0, 0.7); border-radius: 0; } .geoapify-places-title-icon { display: inline-flex; align-items: center; color: rgba(0, 0, 0, 0.5); } .geoapify-places-title-icon svg { height: 14px; width: 14px; } .geoapify-places-title-label { font-weight: 500; margin-left: auto; } .geoapify-places-scroll-container { overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; max-height: 100%; } .geoapify-places-scroll-container::-webkit-scrollbar { width: 6px; } .geoapify-places-scroll-container::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.08); border-radius: 3px; } .geoapify-places-scroll-container::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.35); border-radius: 3px; } .geoapify-places-scroll-container::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.6); } .geoapify-places-item { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid rgba(0, 0, 0, 0.08); transition: background-color 0.15s ease; min-width: 0; /* Allow flex item to shrink below content size */ } .geoapify-places-item:hover { background-color: rgba(0, 0, 0, 0.05); } .geoapify-places-item.active { background-color: rgba(0, 0, 0, 0.1); } .geoapify-places-item:last-child { border-bottom: none; } .geoapify-places-text-container { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; /* Allow text to shrink */ } .geoapify-places-main-part { font-size: 16px; font-weight: 500; color: #202124; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .geoapify-places-secondary-part { font-size: 12px; color: rgba(0, 0, 0, 0.6); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .geoapify-places-hours-info { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; font-size: 13px; color: rgba(0, 0, 0, 0.6); max-width: 150px; } .geoapify-places-clock-icon { display: inline-flex; align-items: center; color: rgba(0, 0, 0, 0.5); } .geoapify-places-clock-icon svg { height: 14px; width: 14px; } .geoapify-places-hours-text { white-space: nowrap; font-size: 13px; text-overflow: ellipsis; overflow: hidden; } .geoapify-places-status-bar { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 16px; border-top: 1px solid rgba(0, 0, 0, 0.1); background: #fafafa; border-radius: 0 0 5px 5px; font-size: 13px; color: rgba(0, 0, 0, 0.6); } .geoapify-places-status-count { display: flex; align-items: center; gap: 6px; } .geoapify-places-status-count span { display: inline-flex; align-items: center; } .geoapify-places-status-count svg { height: 14px; width: 14px; display: block; } .geoapify-places-status-selected { font-weight: 500; color: rgba(0, 0, 0, 0.8); } .geoapify-places-load-more { display: flex; align-items: center; justify-content: center; min-height: 29px; padding: 6px 16px; } .geoapify-places-load-more.end { padding: 6px 16px; } .geoapify-places-load-more-button { background: transparent; border: none; cursor: pointer; padding: 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: rgba(0, 0, 0, 0.6); transition: all 0.2s ease; } .geoapify-places-load-more-button:hover { background-color: rgba(0, 0, 0, 0.08); color: rgba(0, 0, 0, 0.8); } .geoapify-places-load-more-button:active { background-color: rgba(0, 0, 0, 0.15); } .geoapify-places-load-more-button svg { height: 16px; width: 16px; } .geoapify-places-load-more-loading { display: inline-flex; align-items: center; color: rgba(0, 0, 0, 0.5); font-size: 16px; letter-spacing: 2px; animation: geoapify-dots-pulse 1.4s ease-in-out infinite; } @keyframes geoapify-dots-pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } } .geoapify-places-empty-state { display: flex; align-items: center; justify-content: center; padding: 48px 16px; min-height: 200px; } .geoapify-places-empty-icon { color: rgba(0, 0, 0, 0.2); } .geoapify-places-empty-icon svg { display: block; height: 64px; width: 64px; } .geoapify-places-loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, 0.6); z-index: 99; display: none; } .geoapify-places-loading-overlay.visible { display: block; } .geoapify-places-loading-indicator { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 100; display: none; background: rgba(255, 255, 255, 0.95); padding: 16px 24px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); } .geoapify-places-loading-indicator.visible { display: block; } .geoapify-places-loading-dots { display: flex; gap: 8px; align-items: center; justify-content: center; } .geoapify-places-loading-dots span { width: 8px; height: 8px; background-color: rgba(0, 0, 0, 0.6); border-radius: 50%; display: inline-block; animation: geoapify-places-loading-bounce 1.4s infinite ease-in-out both; } .geoapify-places-loading-dots span:nth-child(1) { animation-delay: -0.32s; } .geoapify-places-loading-dots span:nth-child(2) { animation-delay: -0.16s; } @keyframes geoapify-places-loading-bounce { 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; } 40% { transform: scale(1.2); opacity: 1; } } .geoapify-autocomplete-items .secondary-part { margin-left: 10px; font-size: small; color: rgba(0, 0, 0, 0.6); }