UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

2 lines (1 loc) 2.58 kB
import{jsx as n,jsxs as m}from"react/jsx-runtime";import"./WayfindingFloorSelector.scss";import w from"classnames";import g from"react";const L=({floors:a,value:s,floorSelectionLabel:p="Floor selection",onSelect:h})=>{const e=a.findIndex(i=>i?.id===s?.id),C=i=>e!==-1&&i===e;return n("div",{className:"efp-wayfinding-floor",children:n("div",{className:"efp-wayfinding-floor__body",children:n("div",{className:"efp-wayfinding-floor__list",role:"radiogroup","aria-label":p,children:a.map((i,r)=>{const d=i?.id===s?.id,f=e!==-1&&r<e,o=r===a.length-1,t=o?null:i.directionToNext??null,l=C(r),c=e!==-1&&r<e;return m(g.Fragment,{children:[n("div",{className:w("efp-wayfinding-floor__item",{"is-current":d,"is-passed":f}),children:n("button",{type:"button",role:"radio",title:i.description,"aria-checked":d,"aria-label":i.ariaLabel??i.description??i.name,onClick:()=>h?.({id:i.id,name:i.name}),children:n("span",{children:i.name})})}),!o&&t&&n("div",{className:w("efp-wayfinding-floor__arrow",{[`efp-wayfinding-floor__arrow--${t}`]:t,"efp-wayfinding-floor__arrow--blink":l,"efp-wayfinding-floor__arrow--passed":c}),"aria-hidden":"true",children:c||l?n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n("path",{d:"M11.7502 18.2823C11.7503 19.0928 12.4074 19.7499 13.218 19.75C13.5885 19.75 13.9455 19.6096 14.217 19.3575L20.6438 13.3897C21.0303 13.0308 21.2502 12.5274 21.2502 12C21.2502 11.4727 21.0303 10.9693 20.6438 10.6104L14.217 4.64258C13.9795 4.42202 13.6768 4.28716 13.3566 4.25684L13.218 4.25L13.0686 4.25782C12.3282 4.3328 11.7503 4.95766 11.7502 5.71778L11.7502 8.25L4.50024 8.25C3.53374 8.25 2.75024 9.03351 2.75024 9.99996L2.75024 14C2.75024 14.9665 3.53374 15.75 4.50024 15.75L11.7502 15.75L11.7502 18.2823Z",fill:"currentColor"})}):n("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n("path",{d:"M2.5 10C2.5 8.89544 3.39544 8 4.5 8H11.5V5.71777C11.5001 4.76912 12.2692 4.00012 13.2178 4C13.5973 4 13.9649 4.12537 14.2637 4.35449L14.3867 4.45898L20.8145 10.4268C21.2518 10.8329 21.5 11.4032 21.5 12C21.5 12.5968 21.2518 13.1671 20.8145 13.5732L14.3867 19.54L14.3877 19.541C14.0697 19.8365 13.6514 20 13.2178 20C12.2692 19.9999 11.5001 19.2308 11.5 18.2822V16H4.5C3.39545 16 2.5 15.1046 2.5 14V10ZM4.5 14H12.5C13.0523 14 13.5 14.4477 13.5 15V17.6348L19.4531 12.1074C19.4829 12.0797 19.5 12.0407 19.5 12C19.5 11.9593 19.4829 11.9203 19.4531 11.8926L13.5 6.36426V9C13.5 9.55228 13.0523 10 12.5 10H4.5V14Z",fill:"currentColor"})})})]},i.id)})})})})};export default L;