@mappedin/react-ui 6.9.0-beta.0
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.txt +104 -0
- package/README.md +85 -0
- package/lib/esm/chunk-6PPDNG4B.js +1 -0
- package/lib/esm/chunk-APRH4CAT.js +1 -0
- package/lib/esm/chunk-CSLA67FZ.js +1 -0
- package/lib/esm/chunk-GJIP2NMB.js +1 -0
- package/lib/esm/chunk-GJWKDIUL.js +1 -0
- package/lib/esm/chunk-GPW4PJ7Q.js +1 -0
- package/lib/esm/chunk-GXFJG6ET.js +1 -0
- package/lib/esm/chunk-IIQHZPWU.js +0 -0
- package/lib/esm/chunk-OU6YBVSW.js +0 -0
- package/lib/esm/chunk-R4VVGLYZ.js +1 -0
- package/lib/esm/chunk-W6FAYJPU.js +1 -0
- package/lib/esm/chunk-WBXN5D5G.js +1 -0
- package/lib/esm/components/floor-selector/index.js +1 -0
- package/lib/esm/components/location-list/index.js +1 -0
- package/lib/esm/components/search/index.js +1 -0
- package/lib/esm/components/search-bar/index.js +1 -0
- package/lib/esm/components/zoom-controls/index.js +1 -0
- package/lib/esm/index.d.ts +530 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/themes/basic.css +1 -0
- package/lib/esm/themes/basic.js +1 -0
- package/lib/esm/themes/mappedin-dark.css +1 -0
- package/lib/esm/themes/mappedin-dark.js +1 -0
- package/lib/esm/themes/mappedin-light.css +1 -0
- package/lib/esm/themes/mappedin-light.js +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as J,d as Q,e as ee}from"./chunk-GPW4PJ7Q.js";import{a as Z}from"./chunk-GJWKDIUL.js";import{c as L,d as K,e as E}from"./chunk-W6FAYJPU.js";import{a as h,b as v,c as l,d as j,f as b}from"./chunk-APRH4CAT.js";import{useEffect as We,useMemo as Xe,useRef as Ye}from"react";import Ie,{cloneElement as De,isValidElement as Re,useCallback as I,useEffect as D,useReducer as Ne,useRef as q,useState as Ce}from"react";import*as re from"react";var ve=l(t=>typeof t!="string"?{}:t.split(/ ?; ?/).reduce((e,r)=>{let[n,i]=r.split(/ ?: ?/).map((c,a)=>a===0?c.replace(/\s+/g,""):c.trim());if(n&&i){let c=n.replace(/(\w)-(\w)/g,(u,s,o)=>"".concat(s).concat(o.toUpperCase())),a=i.trim();Number.isNaN(Number(i))||(a=Number(i)),e[n.startsWith("-")?n:c]=a}return e},{}),"styleToObject");function ke(t=6){let e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="";for(let n=t;n>0;--n)r+=e[Math.round(Math.random()*(e.length-1))];return r}l(ke,"randomString");var we=["br","col","colgroup","dl","hr","iframe","img","input","link","menuitem","meta","ol","param","select","table","tbody","tfoot","thead","tr","ul","wbr"],te={"accept-charset":"acceptCharset",acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autocorrect:"autoCorrect",autofocus:"autoFocus",autoplay:"autoPlay",autosave:"autoSave",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",classid:"classID",classname:"className",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",controlslist:"controlsList",crossorigin:"crossOrigin",dangerouslysetinnerhtml:"dangerouslySetInnerHTML",datetime:"dateTime",defaultchecked:"defaultChecked",defaultvalue:"defaultValue",enctype:"encType",for:"htmlFor",formmethod:"formMethod",formaction:"formAction",formenctype:"formEncType",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",htmlfor:"htmlFor",httpequiv:"httpEquiv","http-equiv":"httpEquiv",icon:"icon",innerhtml:"innerHTML",inputmode:"inputMode",itemid:"itemID",itemprop:"itemProp",itemref:"itemRef",itemscope:"itemScope",itemtype:"itemType",keyparams:"keyParams",keytype:"keyType",marginwidth:"marginWidth",marginheight:"marginHeight",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",nomodule:"noModule",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",typemustmatch:"typeMustMatch",usemap:"useMap",accentheight:"accentHeight","accent-height":"accentHeight",alignmentbaseline:"alignmentBaseline","alignment-baseline":"alignmentBaseline",allowreorder:"allowReorder",arabicform:"arabicForm","arabic-form":"arabicForm",attributename:"attributeName",attributetype:"attributeType",autoreverse:"autoReverse",basefrequency:"baseFrequency",baselineshift:"baselineShift","baseline-shift":"baselineShift",baseprofile:"baseProfile",calcmode:"calcMode",capheight:"capHeight","cap-height":"capHeight",clippath:"clipPath","clip-path":"clipPath",clippathunits:"clipPathUnits",cliprule:"clipRule","clip-rule":"clipRule",colorinterpolation:"colorInterpolation","color-interpolation":"colorInterpolation",colorinterpolationfilters:"colorInterpolationFilters","color-interpolation-filters":"colorInterpolationFilters",colorprofile:"colorProfile","color-profile":"colorProfile",colorrendering:"colorRendering","color-rendering":"colorRendering",contentscripttype:"contentScriptType",contentstyletype:"contentStyleType",diffuseconstant:"diffuseConstant",dominantbaseline:"dominantBaseline","dominant-baseline":"dominantBaseline",edgemode:"edgeMode",enablebackground:"enableBackground","enable-background":"enableBackground",externalresourcesrequired:"externalResourcesRequired",fillopacity:"fillOpacity","fill-opacity":"fillOpacity",fillrule:"fillRule","fill-rule":"fillRule",filterres:"filterRes",filterunits:"filterUnits",floodopacity:"floodOpacity","flood-opacity":"floodOpacity",floodcolor:"floodColor","flood-color":"floodColor",fontfamily:"fontFamily","font-family":"fontFamily",fontsize:"fontSize","font-size":"fontSize",fontsizeadjust:"fontSizeAdjust","font-size-adjust":"fontSizeAdjust",fontstretch:"fontStretch","font-stretch":"fontStretch",fontstyle:"fontStyle","font-style":"fontStyle",fontvariant:"fontVariant","font-variant":"fontVariant",fontweight:"fontWeight","font-weight":"fontWeight",glyphname:"glyphName","glyph-name":"glyphName",glyphorientationhorizontal:"glyphOrientationHorizontal","glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphorientationvertical:"glyphOrientationVertical","glyph-orientation-vertical":"glyphOrientationVertical",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",horizadvx:"horizAdvX","horiz-adv-x":"horizAdvX",horizoriginx:"horizOriginX","horiz-origin-x":"horizOriginX",imagerendering:"imageRendering","image-rendering":"imageRendering",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",letterspacing:"letterSpacing","letter-spacing":"letterSpacing",lightingcolor:"lightingColor","lighting-color":"lightingColor",limitingconeangle:"limitingConeAngle",markerend:"markerEnd","marker-end":"markerEnd",markerheight:"markerHeight",markermid:"markerMid","marker-mid":"markerMid",markerstart:"markerStart","marker-start":"markerStart",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",overlineposition:"overlinePosition","overline-position":"overlinePosition",overlinethickness:"overlineThickness","overline-thickness":"overlineThickness",paintorder:"paintOrder","paint-order":"paintOrder","panose-1":"panose1",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointerevents:"pointerEvents","pointer-events":"pointerEvents",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",renderingintent:"renderingIntent","rendering-intent":"renderingIntent",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",shaperendering:"shapeRendering","shape-rendering":"shapeRendering",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",stopcolor:"stopColor","stop-color":"stopColor",stopopacity:"stopOpacity","stop-opacity":"stopOpacity",strikethroughposition:"strikethroughPosition","strikethrough-position":"strikethroughPosition",strikethroughthickness:"strikethroughThickness","strikethrough-thickness":"strikethroughThickness",strokedasharray:"strokeDasharray","stroke-dasharray":"strokeDasharray",strokedashoffset:"strokeDashoffset","stroke-dashoffset":"strokeDashoffset",strokelinecap:"strokeLinecap","stroke-linecap":"strokeLinecap",strokelinejoin:"strokeLinejoin","stroke-linejoin":"strokeLinejoin",strokemiterlimit:"strokeMiterlimit","stroke-miterlimit":"strokeMiterlimit",strokewidth:"strokeWidth","stroke-width":"strokeWidth",strokeopacity:"strokeOpacity","stroke-opacity":"strokeOpacity",suppresscontenteditablewarning:"suppressContentEditableWarning",suppresshydrationwarning:"suppressHydrationWarning",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textanchor:"textAnchor","text-anchor":"textAnchor",textdecoration:"textDecoration","text-decoration":"textDecoration",textlength:"textLength",textrendering:"textRendering","text-rendering":"textRendering",underlineposition:"underlinePosition","underline-position":"underlinePosition",underlinethickness:"underlineThickness","underline-thickness":"underlineThickness",unicodebidi:"unicodeBidi","unicode-bidi":"unicodeBidi",unicoderange:"unicodeRange","unicode-range":"unicodeRange",unitsperem:"unitsPerEm","units-per-em":"unitsPerEm",unselectable:"unselectable",valphabetic:"vAlphabetic","v-alphabetic":"vAlphabetic",vectoreffect:"vectorEffect","vector-effect":"vectorEffect",vertadvy:"vertAdvY","vert-adv-y":"vertAdvY",vertoriginx:"vertOriginX","vert-origin-x":"vertOriginX",vertoriginy:"vertOriginY","vert-origin-y":"vertOriginY",vhanging:"vHanging","v-hanging":"vHanging",videographic:"vIdeographic","v-ideographic":"vIdeographic",viewbox:"viewBox",viewtarget:"viewTarget",vmathematical:"vMathematical","v-mathematical":"vMathematical",wordspacing:"wordSpacing","word-spacing":"wordSpacing",writingmode:"writingMode","writing-mode":"writingMode",xchannelselector:"xChannelSelector",xheight:"xHeight","x-height":"xHeight",xlinkactuate:"xlinkActuate","xlink:actuate":"xlinkActuate",xlinkarcrole:"xlinkArcrole","xlink:arcrole":"xlinkArcrole",xlinkhref:"xlinkHref","xlink:href":"xlinkHref",xlinkrole:"xlinkRole","xlink:role":"xlinkRole",xlinkshow:"xlinkShow","xlink:show":"xlinkShow",xlinktitle:"xlinkTitle","xlink:title":"xlinkTitle",xlinktype:"xlinkType","xlink:type":"xlinkType",xmlbase:"xmlBase","xml:base":"xmlBase",xmllang:"xmlLang","xml:lang":"xmlLang","xml:space":"xmlSpace",xmlnsxlink:"xmlnsXlink","xmlns:xlink":"xmlnsXlink",xmlspace:"xmlSpace",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan",onblur:"onBlur",onchange:"onChange",onclick:"onClick",oncontextmenu:"onContextMenu",ondoubleclick:"onDoubleClick",ondrag:"onDrag",ondragend:"onDragEnd",ondragenter:"onDragEnter",ondragexit:"onDragExit",ondragleave:"onDragLeave",ondragover:"onDragOver",ondragstart:"onDragStart",ondrop:"onDrop",onerror:"onError",onfocus:"onFocus",oninput:"onInput",oninvalid:"onInvalid",onkeydown:"onKeyDown",onkeypress:"onKeyPress",onkeyup:"onKeyUp",onload:"onLoad",onmousedown:"onMouseDown",onmouseenter:"onMouseEnter",onmouseleave:"onMouseLeave",onmousemove:"onMouseMove",onmouseout:"onMouseOut",onmouseover:"onMouseOver",onmouseup:"onMouseUp",onscroll:"onScroll",onsubmit:"onSubmit",ontouchcancel:"onTouchCancel",ontouchend:"onTouchEnd",ontouchmove:"onTouchMove",ontouchstart:"onTouchStart",onwheel:"onWheel"};function xe(t,e){var a,u;let c=e,{key:r,level:n}=c,i=j(c,["key","level"]);switch(t.nodeType){case 1:return re.createElement(Le(t.nodeName),be(t,r),ne(t.childNodes,n,i));case 3:{let s=(u=(a=t.nodeValue)==null?void 0:a.toString())!=null?u:"";if(!i.allowWhiteSpaces&&/^\s+$/.test(s)&&!/[\u00A0\u202F]/.test(s))return null;if(!t.parentNode)return s;let o=t.parentNode.nodeName.toLowerCase();return we.includes(o)?(/\S/.test(s)&&console.warn("A textNode is not allowed inside '".concat(o,"'. Your text \"").concat(s,'" will be ignored')),null):s}case 8:return null;case 11:return ne(t.childNodes,n,e);default:return null}}l(xe,"getReactNode");function be(t,e){let r={key:e};if(t instanceof Element){let n=t.getAttribute("class");n&&(r.className=n),[...t.attributes].forEach(i=>{switch(i.name){case"class":break;case"style":r[i.name]=ve(i.value);break;case"allowfullscreen":case"allowpaymentrequest":case"async":case"autofocus":case"autoplay":case"checked":case"controls":case"default":case"defer":case"disabled":case"formnovalidate":case"hidden":case"ismap":case"itemscope":case"loop":case"multiple":case"muted":case"nomodule":case"novalidate":case"open":case"readonly":case"required":case"reversed":case"selected":case"typemustmatch":r[te[i.name]||i.name]=!0;break;default:r[te[i.name]||i.name]=i.value}})}return r}l(be,"parseAttributes");function ne(t,e,r){let n=[...t].map((i,c)=>M(i,v(h({},r),{index:c,level:e+1}))).filter(Boolean);return n.length?n:null}l(ne,"parseChildren");function Le(t){return/[a-z]+[A-Z]+[a-z]+/.test(t)?t:t.toLowerCase()}l(Le,"parseName");function H(t,e={}){return typeof t=="string"?Ee(t,e):t instanceof Node?M(t,e):null}l(H,"convert");function M(t,e={}){if(!t||!(t instanceof Node))return null;let{actions:r=[],index:n=0,level:i=0,randomKey:c}=e,a=t,u="".concat(i,"-").concat(n),s=[];return c&&i===0&&(u="".concat(ke(),"-").concat(u)),Array.isArray(r)&&r.forEach(o=>{o.condition(a,u,i)&&(typeof o.pre=="function"&&(a=o.pre(a,u,i),a instanceof Node||(a=t,b.env.NODE_ENV!=="production"&&console.warn("The `pre` method always must return a valid DomNode (instanceof Node) - your modification will be ignored (Hint: if you want to render a React-component, use the `post` method instead)"))),typeof o.post=="function"&&s.push(o.post(a,u,i)))}),s.length?s:xe(a,h({key:u,level:i},e))}l(M,"convertFromNode");function Ee(t,e={}){if(!t||typeof t!="string")return null;let{includeAllNodes:r=!1,nodeOnly:n=!1,selector:i="body > *",type:c="text/html"}=e;try{let u=new DOMParser().parseFromString(t,c);if(r){let{childNodes:o}=u.body;return n?o:[...o].map(g=>M(g,e))}let s=u.querySelector(i)||u.body.childNodes[0];if(!(s instanceof Node))throw new TypeError("Error parsing input");return n?s:M(s,e)}catch(a){b.env.NODE_ENV!=="production"&&console.error(a)}return null}l(Ee,"convertFromString");import{useEffect as Ve,useRef as qe}from"react";var Se=Object.defineProperty,Ae=l((t,e,r)=>e in t?Se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"__defNormalProp"),z=l((t,e,r)=>Ae(t,typeof e!="symbol"?e+"":e,r),"__publicField"),ie="react-inlinesvg",Pe=10,d={IDLE:"idle",LOADING:"loading",LOADED:"loaded",FAILED:"failed",READY:"ready",UNSUPPORTED:"unsupported"};function Te(t){return t[Math.floor(Math.random()*t.length)]}l(Te,"randomCharacter");function O(){var t;return!!(typeof window<"u"&&((t=window.document)!=null&&t.createElement))}l(O,"canUseDOM");function Oe(){return Ue()&&typeof window<"u"&&window!==null}l(Oe,"isSupportedEnvironment");function Me(t,...e){let r={};for(let n in t)({}).hasOwnProperty.call(t,n)&&(e.includes(n)||(r[n]=t[n]));return r}l(Me,"omit");function He(t){let e="abcdefghijklmnopqrstuvwxyz",n="".concat(e).concat(e.toUpperCase()).concat("1234567890"),i="";for(let c=0;c<t;c++)i+=Te(n);return i}l(He,"randomString");async function ae(t,e){let r=await fetch(t,e),n=r.headers.get("content-type"),[i]=(n!=null?n:"").split(/ ?; ?/);if(r.status>299)throw new Error("Not found");if(!["image/svg+xml","text/plain"].some(c=>i.includes(c)))throw new Error("Content type isn't valid: ".concat(i));return r.text()}l(ae,"request");function ze(t=1){return new Promise(e=>{setTimeout(e,t*1e3)})}l(ze,"sleep");function Ue(){if(!document)return!1;let t=document.createElement("div");t.innerHTML="<svg />";let e=t.firstChild;return!!e&&e.namespaceURI==="http://www.w3.org/2000/svg"}l(Ue,"supportsInlineSVG");var N,Fe=(N=class{constructor(){var n;z(this,"cacheApi"),z(this,"cacheStore"),z(this,"subscribers",[]),z(this,"isReady",!1),this.cacheStore=new Map;let e=ie,r=!1;O()&&(e=(n=window.REACT_INLINESVG_CACHE_NAME)!=null?n:ie,r=!!window.REACT_INLINESVG_PERSISTENT_CACHE&&"caches"in window),r?caches.open(e).then(i=>{this.cacheApi=i}).catch(i=>{console.error("Failed to open cache: ".concat(i.message)),this.cacheApi=void 0}).finally(()=>{this.isReady=!0;let i=[...this.subscribers];this.subscribers.length=0,i.forEach(c=>{try{c()}catch(a){console.error("Error in CacheStore subscriber callback: ".concat(a.message))}})}):this.isReady=!0}onReady(e){this.isReady?e():this.subscribers.push(e)}async get(e,r){var n,i;return await(this.cacheApi?this.fetchAndAddToPersistentCache(e,r):this.fetchAndAddToInternalCache(e,r)),(i=(n=this.cacheStore.get(e))==null?void 0:n.content)!=null?i:""}set(e,r){this.cacheStore.set(e,r)}isCached(e){var r;return((r=this.cacheStore.get(e))==null?void 0:r.status)===d.LOADED}async fetchAndAddToInternalCache(e,r){let n=this.cacheStore.get(e);if((n==null?void 0:n.status)===d.LOADING){await this.handleLoading(e,async()=>{this.cacheStore.set(e,{content:"",status:d.IDLE}),await this.fetchAndAddToInternalCache(e,r)});return}if(!(n!=null&&n.content)){this.cacheStore.set(e,{content:"",status:d.LOADING});try{let i=await ae(e,r);this.cacheStore.set(e,{content:i,status:d.LOADED})}catch(i){throw this.cacheStore.set(e,{content:"",status:d.FAILED}),i}}}async fetchAndAddToPersistentCache(e,r){var c,a,u,s;let n=this.cacheStore.get(e);if((n==null?void 0:n.status)===d.LOADED)return;if((n==null?void 0:n.status)===d.LOADING){await this.handleLoading(e,async()=>{this.cacheStore.set(e,{content:"",status:d.IDLE}),await this.fetchAndAddToPersistentCache(e,r)});return}this.cacheStore.set(e,{content:"",status:d.LOADING});let i=await((c=this.cacheApi)==null?void 0:c.match(e));if(i){let o=await i.text();this.cacheStore.set(e,{content:o,status:d.LOADED});return}try{await((a=this.cacheApi)==null?void 0:a.add(new Request(e,r)));let o=await((u=this.cacheApi)==null?void 0:u.match(e)),g=(s=await(o==null?void 0:o.text()))!=null?s:"";this.cacheStore.set(e,{content:g,status:d.LOADED})}catch(o){throw this.cacheStore.set(e,{content:"",status:d.FAILED}),o}}async handleLoading(e,r){var n;for(let i=0;i<Pe;i++){if(((n=this.cacheStore.get(e))==null?void 0:n.status)!==d.LOADING)return;await ze(.1)}await r()}keys(){return[...this.cacheStore.keys()]}data(){return[...this.cacheStore.entries()].map(([e,r])=>({[e]:r}))}async delete(e){this.cacheApi&&await this.cacheApi.delete(e),this.cacheStore.delete(e)}async clear(){if(this.cacheApi){let e=await this.cacheApi.keys();await Promise.allSettled(e.map(r=>this.cacheApi.delete(r)))}this.cacheStore.clear()}},l(N,"CacheStore"),N);function oe(t){let e=qe(void 0);return Ve(()=>{e.current=t}),e.current}l(oe,"usePrevious");function Ge(t){let{baseURL:e,content:r,description:n,handleError:i,hash:c,preProcessor:a,title:u,uniquifyIDs:s=!1}=t;try{let o=$e(r,a),g=H(o,{nodeOnly:!0});if(!g||!(g instanceof SVGSVGElement))throw new Error("Could not convert the src to a DOM Node");let f=se(g,{baseURL:e,hash:c,uniquifyIDs:s});if(n){let m=f.querySelector("desc");m!=null&&m.parentNode&&m.parentNode.removeChild(m);let y=document.createElementNS("http://www.w3.org/2000/svg","desc");y.innerHTML=n,f.prepend(y)}if(typeof u<"u"){let m=f.querySelector("title");if(m!=null&&m.parentNode&&m.parentNode.removeChild(m),u){let y=document.createElementNS("http://www.w3.org/2000/svg","title");y.innerHTML=u,f.prepend(y)}}return f}catch(o){return i(o)}}l(Ge,"getNode");function $e(t,e){return e?e(t):t}l($e,"processSVG");function se(t,e){let{baseURL:r="",hash:n,uniquifyIDs:i}=e,c=["id","href","xlink:href","xlink:role","xlink:arcrole"],a=["href","xlink:href"],u=l((s,o)=>a.includes(s)&&(o?!o.includes("#"):!1),"isDataValue");return i&&[...t.children].forEach(s=>{var o;if((o=s.attributes)!=null&&o.length){let g=Object.values(s.attributes).map(f=>{let m=f,y=/url\((.*?)\)/.exec(f.value);return y!=null&&y[1]&&(m.value=f.value.replace(y[0],"url(".concat(r).concat(y[1],"__").concat(n,")"))),m});c.forEach(f=>{let m=g.find(y=>y.name===f);m&&!u(f,m.value)&&(m.value="".concat(m.value,"__").concat(n))})}return s.children.length?se(s,e):s}),t}l(se,"updateSVGAttributes");var R;function _e(t){let{cacheRequests:e=!0,children:r=null,description:n,fetchOptions:i,innerRef:c,loader:a=null,onError:u,onLoad:s,src:o,title:g,uniqueHash:f}=t,[m,y]=Ne((p,k)=>h(h({},p),k),{content:"",element:null,isCached:e&&R.isCached(t.src),status:d.IDLE}),{content:$,element:_,isCached:B,status:S}=m,w=oe(t),C=oe(m),ge=q(f!=null?f:He(8)),P=q(!1),W=q(!1),x=I(p=>{P.current&&(y({status:p.message==="Browser does not support SVG"?d.UNSUPPORTED:d.FAILED}),u==null||u(p))},[u]),T=I((p,k=!1)=>{P.current&&y({content:p,isCached:k,status:d.LOADED})},[]),X=I(async()=>{let p=await ae(o,i);T(p)},[i,T,o]),A=I(()=>{try{let p=Ge(v(h({},t),{handleError:x,hash:ge.current,content:$})),k=H(p);if(!k||!Re(k))throw new Error("Could not convert the src to a React element");y({element:k,status:d.READY})}catch(p){x(p)}},[$,x,t]),Y=I(async()=>{let p=new RegExp("^data:image\\/svg[^,]*?(;base64)?,(.*)","u").exec(o),k;if(p?k=p[1]?window.atob(p[2]):decodeURIComponent(p[2]):o.includes("<svg")&&(k=o),k){T(k);return}try{if(e){let V=await R.get(o,i);T(V,!0)}else await X()}catch(V){x(V)}},[e,X,i,x,T,o]),F=I(async()=>{P.current&&y({content:"",element:null,isCached:!1,status:d.LOADING})},[]);D(()=>{if(P.current=!0,!(!O()||W.current)){try{if(S===d.IDLE){if(!Oe())throw new Error("Browser does not support SVG");if(!o)throw new Error("Missing src");F()}}catch(p){x(p)}return W.current=!0,()=>{P.current=!1}}},[]),D(()=>{if(!(!O()||!w)&&w.src!==o){if(!o){x(new Error("Missing src"));return}F()}},[x,F,w,o]),D(()=>{S===d.LOADED&&A()},[S,A]),D(()=>{!O()||!w||w.src!==o||(w.title!==g||w.description!==n)&&A()},[n,A,w,o,g]),D(()=>{if(C)switch(S){case d.LOADING:{C.status!==d.LOADING&&Y();break}case d.LOADED:{C.status!==d.LOADED&&A();break}case d.READY:{C.status!==d.READY&&(s==null||s(o,B));break}}},[Y,A,B,s,C,o,S]);let ye=Me(t,"baseURL","cacheRequests","children","description","fetchOptions","innerRef","loader","onError","onLoad","preProcessor","src","title","uniqueHash","uniquifyIDs");return O()?_?De(_,h({ref:c},ye)):[d.UNSUPPORTED,d.FAILED].includes(S)?r:a:a}l(_e,"ReactInlineSVG");function ce(t){R||(R=new Fe);let{loader:e}=t,[r,n]=Ce(R.isReady);return D(()=>{r||R.onReady(()=>{n(!0)})},[r]),r?Ie.createElement(_e,h({},t)):e}l(ce,"InlineSVG");import{createElement as Be}from"react";import{jsx as U,jsxs as le}from"react/jsx-runtime";var ue=l(({listId:t,index:e,locations:r,props:n,onClick:i,item:c})=>{var g;let{ref:a}=Q(t,e,()=>i==null?void 0:i(r[e])),{ref:u}=Z("locationId",r[e].id),s=r[e].logo,o=(g=r[e].categories[0])==null?void 0:g.icon;return U("li",v(h({},E({className:"location-list-item-wrapper",role:"button",onClick:l(()=>i==null?void 0:i(r[e]),"onClick"),ref:K(a,u)},n==null?void 0:n.listItemWrapper)),{id:"".concat(t!=null?t:"location-list","-").concat(r[e].id),children:c?Be(c,{location:r[e]}):le("div",v(h({},E({className:"location-list-item-content"},n==null?void 0:n.listItemContent)),{children:[(s||o)&&le("div",v(h({},E({className:"location-list-item-image"},n==null?void 0:n.listItemImage)),{children:[s&&U("img",{className:L("location-list-item-image-img"),src:s,alt:r[e].name}),o&&!s&&U(ce,{className:L("location-list-item-image-svg"),src:o})]})),U("span",v(h({},E({className:"location-list-item-name"},n==null?void 0:n.listItemName)),{children:r[e].name}))]}))}))},"LocationListItem");import{forwardRef as de}from"react";import{jsx as G}from"react/jsx-runtime";var he=l(({index:t,style:e,data:r})=>{var n,i,c;return G(ue,v(h({index:t},r),{props:v(h({},r.props),{listItemWrapper:h({style:h(h({},e),(i=(n=r.props)==null?void 0:n.listItemWrapper)==null?void 0:i.style)},(c=r.props)==null?void 0:c.listItemWrapper)})}))},"LocationListItemRenderer"),me=de((t,e)=>G("div",h({ref:e,tabIndex:-1},t))),fe=de((t,e)=>G("ul",v(h({ref:e,className:L("location-list-inner")},t),{style:h({display:"block"},t.style)})));import{jsx as pe}from"react/jsx-runtime";var Rt=l(({id:t,locations:e=[],onLocationSelected:r,maxHeight:n,item:i,itemSize:c=40,props:a})=>{var g,f;let{ref:u}=ee(t),s=Xe(()=>{let m=e.length*c;return n==null?Math.min(m,window.innerHeight*.8):Math.min(m,n)},[n,e,c]),o=Ye(e);return We(()=>{o.current=e},[e]),pe("div",v(h({},E({className:"location-list-wrapper",style:{height:"100vh",maxHeight:"".concat(s,"px")}},a==null?void 0:a.wrapper)),{role:"listbox",id:t,children:pe(J,v(h({ref:u,className:L("location-list",(g=a==null?void 0:a.list)==null?void 0:g.className),height:s,width:"100%",layout:"vertical",itemSize:c,itemCount:e.length,outerElementType:me,itemData:{locations:e,props:a,onClick:r,listId:t,item:i},innerElementType:fe},(f=a==null?void 0:a.list)!=null?f:{}),{children:he}))}))},"LocationList");export{Rt as a};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as C}from"./chunk-WBXN5D5G.js";import{a as k}from"./chunk-GJWKDIUL.js";import{c as s,d as p,e as r}from"./chunk-W6FAYJPU.js";import{a as t,b as o,c as a}from"./chunk-APRH4CAT.js";import{jsx as u,jsxs as H}from"react/jsx-runtime";var I=a(()=>H("svg",o(t({},r({className:"icon--magnifying-glass",viewBox:"0 0 24 24",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),{children:[u("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),u("path",{d:"M21 21l-6 -6"})]})),"MagnifyingGlass");import{useRef as R}from"react";import{jsx as h,jsxs as y}from"react/jsx-runtime";var M=a(()=>y("svg",o(t({},r({className:"icon--close",viewBox:"0 0 24 24",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),{children:[h("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),h("path",{d:"M18 6l-12 12"}),h("path",{d:"M6 6l12 12"})]})),"Close");import{jsx as c,jsxs as E}from"react/jsx-runtime";var $=a(({props:e,value:N,onChange:P,placeholder:L,searchIcon:f,closeIcon:d})=>{let i=R(null),g=R(null),x=f===void 0?c(I,{}):f,B=d===void 0?c(M,{}):d,{value:l,onChange:v}=b({value:N,onChange:P,defaultValue:""});C(g,()=>{var n;(n=i.current)==null||n.blur()});let{ref:w}=k("searchBarValue",l);return E("div",o(t({},r({className:"search-bar-wrapper",ref:p(g,w)},e==null?void 0:e.wrapper)),{children:[c("input",o(t({},r({name:"mappedin-search-bar",className:"search-bar-input",ref:i,onChange:a(n=>v(n.target.value),"onChange"),type:"search",role:"searchbox",placeholder:L},e==null?void 0:e.input)),{value:l})),c("button",o(t({},r({className:s("search-bar-icon","search-icon"),onClick:a(()=>{var n;(n=i.current)==null||n.focus()},"onClick"),tabIndex:-1},e==null?void 0:e.searchIcon)),{children:x})),c("button",o(t({},r({className:s("search-bar-icon","clear-icon"),onClick:a(()=>{var n;v(""),(n=i.current)==null||n.focus()},"onClick"),tabIndex:l.length>0?0:-1},e==null?void 0:e.clearIcon)),{children:B}))]}))},"SearchBar");export{$ as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i,b as R,c}from"./chunk-APRH4CAT.js";var f="mappedin__",l="".concat(f,"keyboard-focus"),u="mappedin";var r=c((...s)=>s.filter(t=>t!=null).filter(t=>t!=="").map(t=>t.trim()).map(t=>t.startsWith(f)?t:"".concat(f).concat(t)).join(" "),"classNames");var T=c((...s)=>t=>{s.filter(e=>e!=null).forEach(e=>{typeof e=="function"?e(t):e&&(e.current=t)})},"combineRefs");var N=c((s,t)=>{if(!t&&!s)return{};let e=R(i({},s),{className:r(s.className)});return t&&Object.entries(t).forEach(([n,o])=>{e[n]==null?e[n]=o:n==="className"?e[n]=e[n]+" "+o:n==="ref"?e[n]=T(e[n],o):typeof e[n]=="object"&&typeof o=="object"?e[n]=i(i({},e[n]),o):typeof e[n]=="function"&&typeof o=="function"?e[n]=(...m)=>{s[n](...m),o(...m)}:e[n]=o}),e},"componentProps");export{l as a,u as b,r as c,T as d,N as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o}from"./chunk-APRH4CAT.js";import{useCallback as i,useState as a}from"react";var m=o(({value:e,defaultValue:l,onChange:t})=>{let[c,s]=a(l),n=e!==void 0,u=i(r=>{s(r),t==null||t(r)},[n,t]);return{value:n?e:c,onChange:u,isControlled:n}},"useUncontrolled");import{useEffect as T}from"react";var k=o((e,l)=>{T(()=>{let t=o(c=>{let s=e==null?void 0:e.current,n=c.target;!s||s.contains(n)||l(c)},"listener");return document.addEventListener("click",t),()=>{document.removeEventListener("click",t)}},[e,l])},"useOutsideClick");export{m as a,k as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-CSLA67FZ.js";import"../../chunk-GPW4PJ7Q.js";import"../../chunk-WBXN5D5G.js";import"../../chunk-GJWKDIUL.js";import"../../chunk-W6FAYJPU.js";import"../../chunk-APRH4CAT.js";export{a as FloorSelector};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-GXFJG6ET.js";import"../../chunk-GPW4PJ7Q.js";import"../../chunk-GJWKDIUL.js";import"../../chunk-W6FAYJPU.js";import"../../chunk-APRH4CAT.js";export{a as LocationList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-GJIP2NMB.js";import"../../chunk-GXFJG6ET.js";import"../../chunk-GPW4PJ7Q.js";import"../../chunk-R4VVGLYZ.js";import"../../chunk-WBXN5D5G.js";import"../../chunk-GJWKDIUL.js";import"../../chunk-W6FAYJPU.js";import"../../chunk-APRH4CAT.js";export{a as Search};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-R4VVGLYZ.js";import"../../chunk-WBXN5D5G.js";import"../../chunk-GJWKDIUL.js";import"../../chunk-W6FAYJPU.js";import"../../chunk-APRH4CAT.js";export{a as SearchBar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-6PPDNG4B.js";import"../../chunk-W6FAYJPU.js";import"../../chunk-APRH4CAT.js";export{a as ZoomControls};
|
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { Floor, LocationProfile } from "@mappedin/mappedin-js";
|
|
2
|
+
import { FixedSizeList, VariableSizeList } from "react-window";
|
|
3
|
+
import * as react10 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/props.d.ts
|
|
6
|
+
type Prop<T extends keyof React.JSX.IntrinsicElements> = React.ComponentProps<T>;
|
|
7
|
+
type PropsAPI<T extends Record<string, keyof React.JSX.IntrinsicElements>> = Partial<{ [K in keyof T]: T[K] extends keyof React.JSX.IntrinsicElements ? Prop<T[K]> : never }>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/components/search-bar/search-bar.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Props for the {@link SearchBar} component.
|
|
12
|
+
*/
|
|
13
|
+
interface SearchBarProps {
|
|
14
|
+
/**
|
|
15
|
+
* The value of the search input.
|
|
16
|
+
*/
|
|
17
|
+
value?: string;
|
|
18
|
+
/**
|
|
19
|
+
* A function to call when the value of the search input changes.
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (value: string) => void;
|
|
22
|
+
/**
|
|
23
|
+
* The placeholder text for the search input.
|
|
24
|
+
*/
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Props to pass down to inner elements. See {@link "Props API"} for more details.
|
|
28
|
+
*
|
|
29
|
+
* - `wrapper` - The wrapper for the search bar.
|
|
30
|
+
* - `input` - The input for the search bar.
|
|
31
|
+
* - `searchIcon` - The button around the search icon.
|
|
32
|
+
* - `clearIcon` - The button around the clear icon.
|
|
33
|
+
*/
|
|
34
|
+
props?: PropsAPI<{
|
|
35
|
+
wrapper: 'div';
|
|
36
|
+
input: 'input';
|
|
37
|
+
searchIcon: 'button';
|
|
38
|
+
clearIcon: 'button';
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* A custom search icon to render. Pass `null` to disable the icon.
|
|
42
|
+
*/
|
|
43
|
+
searchIcon?: React.ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* A custom close icon to render. Pass `null` to disable the icon.
|
|
46
|
+
*/
|
|
47
|
+
closeIcon?: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Render a stylized search bar.
|
|
51
|
+
*
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <SearchBar
|
|
54
|
+
* value={value}
|
|
55
|
+
* onChange={onChange}
|
|
56
|
+
* placeholder="Search..."
|
|
57
|
+
* />
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @category Component
|
|
61
|
+
*/
|
|
62
|
+
declare const SearchBar: React.FC<SearchBarProps>;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/components/location-list/location-list-item.d.ts
|
|
65
|
+
interface LocationListItemProps {
|
|
66
|
+
/**
|
|
67
|
+
* The ID of the list that this item belongs to. This is used for keyboard accessibility.
|
|
68
|
+
*/
|
|
69
|
+
listId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The index of this item in the list of {@link LocationProfile}s.
|
|
72
|
+
*/
|
|
73
|
+
index: number;
|
|
74
|
+
/**
|
|
75
|
+
* The list of all {@link LocationProfile}s currently rendered.
|
|
76
|
+
*/
|
|
77
|
+
locations: LocationProfile[];
|
|
78
|
+
/**
|
|
79
|
+
* A function to call when this item is clicked.
|
|
80
|
+
*/
|
|
81
|
+
onClick?: (location: LocationProfile) => void;
|
|
82
|
+
/**
|
|
83
|
+
* A custom component to render within the list.
|
|
84
|
+
*/
|
|
85
|
+
item?: React.ComponentType<{
|
|
86
|
+
location: LocationProfile;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Props to pass down to inner elements.
|
|
90
|
+
*/
|
|
91
|
+
props?: PropsAPI<{
|
|
92
|
+
listItemWrapper: 'li';
|
|
93
|
+
listItemContent: 'div';
|
|
94
|
+
listItemName: 'span';
|
|
95
|
+
listItemImage: 'div';
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A single entry in the {@link LocationList}.
|
|
100
|
+
*/
|
|
101
|
+
declare const LocationListItem: React.FC<LocationListItemProps>;
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/components/location-list/utils.d.ts
|
|
104
|
+
type ItemData = Omit<React.ComponentProps<typeof LocationListItem>, 'index'>;
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/components/location-list/location-list.d.ts
|
|
107
|
+
type ListProps = React.ComponentProps<typeof FixedSizeList<ItemData>>;
|
|
108
|
+
interface LocationListProps extends Pick<React.ComponentProps<typeof LocationListItem>, 'locations' | 'item'> {
|
|
109
|
+
/**
|
|
110
|
+
* The ID of the list.
|
|
111
|
+
*
|
|
112
|
+
* When using the list as a keyboard controlled listbox (e.g. the list can be navigated with arrows when focused on an input) using
|
|
113
|
+
* {@link useKeyboardListController}, it is important to specify the ID of the list being controlled.
|
|
114
|
+
*/
|
|
115
|
+
id?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The maximum height of the list in pixels.
|
|
118
|
+
*/
|
|
119
|
+
maxHeight?: number;
|
|
120
|
+
/**
|
|
121
|
+
* The height of each item in the list in pixels.
|
|
122
|
+
*/
|
|
123
|
+
itemSize?: number;
|
|
124
|
+
/**
|
|
125
|
+
* A function to call when a {@link LocationProfile} is selected.
|
|
126
|
+
*/
|
|
127
|
+
onLocationSelected?: (location: LocationProfile) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Props to pass down to inner elements. See {@link "Props API"} for more details.
|
|
130
|
+
*
|
|
131
|
+
* - `wrapper` - The wrapper for the list.
|
|
132
|
+
* - `list` - The "react-window" list component.
|
|
133
|
+
* - `listItemWrapper` - The wrapper for an individual list item. This is always rendered, even if a custom `item` prop is provided.
|
|
134
|
+
* - `listItemContent` - The default content wrapper for an individual list item. This gets replaced if a custom `item` prop is provided.
|
|
135
|
+
* - `listItemName` - The default name of an individual list item. This gets replaced if a custom `item` prop is provided.
|
|
136
|
+
* - `listItemImage` - The default image wrapper of an individual list item. This gets replaced if a custom `item` prop is provided.
|
|
137
|
+
*/
|
|
138
|
+
props?: PropsAPI<{
|
|
139
|
+
wrapper: 'div';
|
|
140
|
+
}> & {
|
|
141
|
+
list?: Partial<Omit<ListProps, 'children' | 'itemSize' | 'itemCount' | 'width' | 'height' | 'itemData'>>;
|
|
142
|
+
} & React.ComponentProps<typeof LocationListItem>['props'];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Render virtualized list of LocationProfiles.
|
|
146
|
+
*
|
|
147
|
+
* ```tsx
|
|
148
|
+
* <LocationList
|
|
149
|
+
* locations={mapData.getByType('location-profile')}
|
|
150
|
+
* onLocationSelected={(location) => {
|
|
151
|
+
* // Handle location selection
|
|
152
|
+
* }}
|
|
153
|
+
* />
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @category Component
|
|
157
|
+
*/
|
|
158
|
+
declare const LocationList: React.FC<LocationListProps>;
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/components/search/search.d.ts
|
|
161
|
+
type ElevatedSearchBarProps = 'value' | 'onChange' | 'placeholder';
|
|
162
|
+
type ElevatedLocationListProps = 'onLocationSelected' | 'maxHeight' | 'item' | 'itemSize';
|
|
163
|
+
/**
|
|
164
|
+
* Props for the {@link Search} component.
|
|
165
|
+
*/
|
|
166
|
+
interface SearchProps extends Pick<React.ComponentProps<typeof SearchBar>, ElevatedSearchBarProps>, Pick<React.ComponentProps<typeof LocationList>, ElevatedLocationListProps> {
|
|
167
|
+
/**
|
|
168
|
+
* Results to show if the search query is empty. This will be overridden by {@link defaultContent} if both are provided.
|
|
169
|
+
*/
|
|
170
|
+
defaultResults?: LocationProfile[];
|
|
171
|
+
/**
|
|
172
|
+
* Arbitrary content to show if the search query is empty. This will take precedence over {@link defaultResults} if both are provided.
|
|
173
|
+
*/
|
|
174
|
+
defaultContent?: React.ReactNode;
|
|
175
|
+
/**
|
|
176
|
+
* Arbitrary content to show when the query returned no results.
|
|
177
|
+
*/
|
|
178
|
+
noResultsContent?: React.ReactNode;
|
|
179
|
+
/**
|
|
180
|
+
* A function to call to search for {@link LocationProfile}s. Usually this should involve `mapData.Search.query`.
|
|
181
|
+
*/
|
|
182
|
+
searchFn: (query: string) => Promise<LocationProfile[]>;
|
|
183
|
+
/**
|
|
184
|
+
* The debounce time in milliseconds to execute a search between keystrokes.
|
|
185
|
+
*/
|
|
186
|
+
searchDebounce?: number;
|
|
187
|
+
/**
|
|
188
|
+
* Force search results to be visible or hidden. By default, results are shown when the {@link SearchBar} is focused.
|
|
189
|
+
*/
|
|
190
|
+
resultsVisible?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Props to pass down to inner elements. See {@link "Props API"} for more details.
|
|
193
|
+
*
|
|
194
|
+
* - `wrapper` - The wrapper for the search component.
|
|
195
|
+
* - `contentWrapper` - The wrapper for the search results and custom content. This component has animating height.
|
|
196
|
+
* - `searchBar` - Props to pass to the {@link SearchBar}'s Props API. See {@link SearchBarProps.props}.
|
|
197
|
+
* - `locationList` - Props to pass to the {@link LocationList}'s Props API. See {@link LocationListProps.props}.
|
|
198
|
+
*/
|
|
199
|
+
props?: PropsAPI<{
|
|
200
|
+
wrapper: 'div';
|
|
201
|
+
contentWrapper: 'div';
|
|
202
|
+
}> & {
|
|
203
|
+
searchBar?: React.ComponentProps<typeof SearchBar>['props'];
|
|
204
|
+
locationList?: React.ComponentProps<typeof LocationList>['props'];
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A composite component that renders a search bar and a list of search results.
|
|
209
|
+
*
|
|
210
|
+
* This component is heavily opinionated, so it is easier to use at the cost of customizability. If you need more
|
|
211
|
+
* functionality than this component provides, it is recommended to build your own search component using the more basic
|
|
212
|
+
* {@link SearchBar} and {@link LocationList} components.
|
|
213
|
+
*
|
|
214
|
+
* ```tsx
|
|
215
|
+
* <Search
|
|
216
|
+
* searchFn={(query) => {
|
|
217
|
+
* // Handle search and return some LocationProfiles
|
|
218
|
+
* }}
|
|
219
|
+
* onLocationSelected={(location) => {
|
|
220
|
+
* // Handle location selection
|
|
221
|
+
* }}
|
|
222
|
+
* />
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```tsx
|
|
227
|
+
* import { useState, useCallback } from 'react';
|
|
228
|
+
* import { type LocationProfile, getMapData, show3dMap } from '@mappedin/mappedin-js';
|
|
229
|
+
* import { Search } from '@mappedin/react-ui';
|
|
230
|
+
*
|
|
231
|
+
* const loadMap = async () => {
|
|
232
|
+
* const mapData = await getMapData(...);
|
|
233
|
+
* const mapView = await show3dMap(...);
|
|
234
|
+
* return { mapData, mapView };
|
|
235
|
+
* }
|
|
236
|
+
*
|
|
237
|
+
* const App: React.FC = () => {
|
|
238
|
+
* // Store the MapView and MapData in state
|
|
239
|
+
* const [mapView, setMapView] = useState<MapView | null>(null);
|
|
240
|
+
* const [mapData, setMapData] = useState<MapData | null>(null);
|
|
241
|
+
*
|
|
242
|
+
* // Load the map
|
|
243
|
+
* useEffect(() => {
|
|
244
|
+
* loadMap().then(({ mapData, mapView }) => {
|
|
245
|
+
* setMapData(mapData);
|
|
246
|
+
* setMapView(mapView);
|
|
247
|
+
* });
|
|
248
|
+
* }, []);
|
|
249
|
+
*
|
|
250
|
+
* // Save the selected location as a state variable
|
|
251
|
+
* const [location, setLocation] = useState<LocationProfile | null>(null);
|
|
252
|
+
*
|
|
253
|
+
* // An example search function that uses `mapData.Search.query`
|
|
254
|
+
* const searchFn = useCallback(
|
|
255
|
+
* (query: string) => {
|
|
256
|
+
* return mapData.Search.query(query).then(results => [
|
|
257
|
+
* ...new Set(
|
|
258
|
+
* results.places
|
|
259
|
+
* .filter(p => 'locationProfiles' in p.item)
|
|
260
|
+
* .flatMap(p => p.item.locationProfiles)
|
|
261
|
+
* )
|
|
262
|
+
* ]);
|
|
263
|
+
* },
|
|
264
|
+
* [mapData],
|
|
265
|
+
* );
|
|
266
|
+
*
|
|
267
|
+
* return (
|
|
268
|
+
* <div style={{ position: 'relative' }}>
|
|
269
|
+
* <div id="map-container" />
|
|
270
|
+
* <div style={{
|
|
271
|
+
* // Show the search bar on top of the map
|
|
272
|
+
* position: 'absolute',
|
|
273
|
+
* top: 20,
|
|
274
|
+
* left: 20,
|
|
275
|
+
* zIndex: 2,
|
|
276
|
+
* }}>
|
|
277
|
+
* <Search
|
|
278
|
+
* searchFn={searchFn}
|
|
279
|
+
* onLocationSelected={setLocation}
|
|
280
|
+
* />
|
|
281
|
+
* </div>
|
|
282
|
+
* </div>
|
|
283
|
+
* );
|
|
284
|
+
* }
|
|
285
|
+
* ```
|
|
286
|
+
*
|
|
287
|
+
* @category Component
|
|
288
|
+
*/
|
|
289
|
+
declare const Search: React.FC<SearchProps>;
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/components/floor-selector/floor-selector-list-item.d.ts
|
|
292
|
+
interface FloorSelectorListItemProps {
|
|
293
|
+
/**
|
|
294
|
+
* The {@link Floor} to render in this floor selector item.
|
|
295
|
+
*/
|
|
296
|
+
floor: Floor;
|
|
297
|
+
/**
|
|
298
|
+
* The index of the {@link Floor} item in the list.
|
|
299
|
+
*/
|
|
300
|
+
index: number;
|
|
301
|
+
/**
|
|
302
|
+
* A function to call when the floor selector item is clicked.
|
|
303
|
+
*/
|
|
304
|
+
onClick: () => void;
|
|
305
|
+
/**
|
|
306
|
+
* Whether this item represents the current floor.
|
|
307
|
+
*/
|
|
308
|
+
current: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Props to pass down to inner elements.
|
|
311
|
+
*/
|
|
312
|
+
props?: PropsAPI<{
|
|
313
|
+
listItem: 'li';
|
|
314
|
+
listItemName: 'span';
|
|
315
|
+
}>;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* A single entry in the {@link FloorSelector}.
|
|
319
|
+
*/
|
|
320
|
+
declare const FloorSelectorListItem: React.FC<FloorSelectorListItemProps>;
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/components/floor-selector/floor-selector-list.d.ts
|
|
323
|
+
interface FloorSelectorListProps {
|
|
324
|
+
/**
|
|
325
|
+
* The list of {@link Floor} items to render in the floor selector.
|
|
326
|
+
*/
|
|
327
|
+
floors?: Floor[];
|
|
328
|
+
/**
|
|
329
|
+
* The current {@link Floor}.
|
|
330
|
+
*/
|
|
331
|
+
currentFloor?: Floor;
|
|
332
|
+
/**
|
|
333
|
+
* A function to call when a floor selector item is clicked.
|
|
334
|
+
*/
|
|
335
|
+
onFloorSelected?: (floor: Floor) => void;
|
|
336
|
+
/**
|
|
337
|
+
* Props to pass down to inner elements.
|
|
338
|
+
*/
|
|
339
|
+
props?: PropsAPI<{
|
|
340
|
+
list: 'ul';
|
|
341
|
+
}> & React.ComponentProps<typeof FloorSelectorListItem>['props'];
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* The list of selectable floors in the {@link FloorSelector}.
|
|
345
|
+
*/
|
|
346
|
+
declare const FloorSelectorList: react10.ForwardRefExoticComponent<FloorSelectorListProps & react10.RefAttributes<HTMLUListElement>>;
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/components/floor-selector/floor-selector.d.ts
|
|
349
|
+
/**
|
|
350
|
+
* Props for the {@link FloorSelector} component.
|
|
351
|
+
*/
|
|
352
|
+
interface FloorSelectorProps extends Omit<React.ComponentProps<typeof FloorSelectorList>, 'props'> {
|
|
353
|
+
/**
|
|
354
|
+
* Whether the floor selector is open.
|
|
355
|
+
*/
|
|
356
|
+
isOpen?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* A function to call when the floor selector is opened or closed. Only fires when the component is uncontrolled.
|
|
359
|
+
*/
|
|
360
|
+
onOpen?: (isOpen: boolean) => void;
|
|
361
|
+
/**
|
|
362
|
+
* Props to pass down to inner elements. See {@link "Props API"} for more details.
|
|
363
|
+
*
|
|
364
|
+
* - `wrapper` - The wrapper for the entire floor selector.
|
|
365
|
+
* - `button` - The button that shows the current floor and opens the floor selector.
|
|
366
|
+
* - `currentName` - The current floor name within the floor selector button.
|
|
367
|
+
* - `chevron` - The chevron icon within the floor selector button.
|
|
368
|
+
* - `listWrapper` - The wrapper for the list of selectable floors.
|
|
369
|
+
* - `list` - The `react-window` list component.
|
|
370
|
+
* - `listItem` - The wrapper for each floor selector item.
|
|
371
|
+
* - `listItemName` - The floor name within each floor selector item.
|
|
372
|
+
*/
|
|
373
|
+
props?: PropsAPI<{
|
|
374
|
+
wrapper: 'div';
|
|
375
|
+
button: 'button';
|
|
376
|
+
currentName: 'span';
|
|
377
|
+
chevron: 'div';
|
|
378
|
+
listWrapper: 'div';
|
|
379
|
+
}> & React.ComponentProps<typeof FloorSelectorList>['props'];
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Render the current floor and a collapsible list of selectable floors.
|
|
383
|
+
*
|
|
384
|
+
* ```tsx
|
|
385
|
+
* <FloorSelector
|
|
386
|
+
* currentFloor={currentFloor}
|
|
387
|
+
* floors={floors}
|
|
388
|
+
* onFloorSelected={(floor) => mapView.setCurrentFloor(floor)}
|
|
389
|
+
* />
|
|
390
|
+
* ```
|
|
391
|
+
*
|
|
392
|
+
* @category Component
|
|
393
|
+
*/
|
|
394
|
+
declare const FloorSelector: React.FC<FloorSelectorProps>;
|
|
395
|
+
//#endregion
|
|
396
|
+
//#region src/components/zoom-controls/zoom-controls.d.ts
|
|
397
|
+
interface ZoomControlsProps {
|
|
398
|
+
/**
|
|
399
|
+
* A function to call when the zoom in button is clicked.
|
|
400
|
+
*/
|
|
401
|
+
onZoomIn: () => void;
|
|
402
|
+
/**
|
|
403
|
+
* A function to call when the zoom out button is clicked.
|
|
404
|
+
*/
|
|
405
|
+
onZoomOut: () => void;
|
|
406
|
+
/**
|
|
407
|
+
* Props to pass down to inner elements. See {@link "Props API"} for more details.
|
|
408
|
+
*
|
|
409
|
+
* - `wrapper` - The wrapper for the zoom controls.
|
|
410
|
+
* - `zoomIn` - The zoom in button.
|
|
411
|
+
* - `zoomOut` - The zoom out button.
|
|
412
|
+
*/
|
|
413
|
+
props?: PropsAPI<{
|
|
414
|
+
wrapper: 'div';
|
|
415
|
+
zoomIn: 'button';
|
|
416
|
+
zoomOut: 'button';
|
|
417
|
+
}>;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Render zoom controls.
|
|
421
|
+
*
|
|
422
|
+
* ```tsx
|
|
423
|
+
* <ZoomControls
|
|
424
|
+
* onZoomIn={() => mapView.Camera.animateTo({ zoom: mapView.Camera.zoom + 1 })}
|
|
425
|
+
* onZoomOut={() => mapView.Camera.animateTo({ zoom: mapView.Camera.zoom - 1 })}
|
|
426
|
+
* />
|
|
427
|
+
* ```
|
|
428
|
+
*
|
|
429
|
+
* @category Component
|
|
430
|
+
*/
|
|
431
|
+
declare const ZoomControls: React.FC<ZoomControlsProps>;
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/hooks/accessibility/utils.d.ts
|
|
434
|
+
/**
|
|
435
|
+
* Options for {@link useKeyboardListController}.
|
|
436
|
+
*/
|
|
437
|
+
interface AccessibleListOptions {
|
|
438
|
+
/**
|
|
439
|
+
* The number of items in the list. If specified, the active item will be wrapped
|
|
440
|
+
* around to the beginning of the list when the end is reached.
|
|
441
|
+
*/
|
|
442
|
+
itemCount?: number;
|
|
443
|
+
/**
|
|
444
|
+
* Whether to blur the controller when an item is selected.
|
|
445
|
+
*
|
|
446
|
+
* @default true
|
|
447
|
+
*/
|
|
448
|
+
blurOnItemSelect?: boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Whether to reset the active item index when the list is blurred.
|
|
451
|
+
*
|
|
452
|
+
* @default false
|
|
453
|
+
*/
|
|
454
|
+
resetActiveItemOnBlur?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Whether the list is controlled with up/down keys or left/right keys.
|
|
457
|
+
*
|
|
458
|
+
* @default 'vertical'
|
|
459
|
+
*/
|
|
460
|
+
direction?: 'vertical' | 'horizontal' | 'both';
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/hooks/accessibility/use-keyboard-list-controller.d.ts
|
|
464
|
+
/**
|
|
465
|
+
* Used to create an accessible list. Call this in an input or other component that
|
|
466
|
+
* should serve as the controller for a list. When it is focused and arrow keys are
|
|
467
|
+
* pressed, elements using {@link useKeyboardListItem} will become active in sequence.
|
|
468
|
+
* If the list is virtualized, use {@link useKeyboardVirtualList} to scroll to the
|
|
469
|
+
* active item.
|
|
470
|
+
*
|
|
471
|
+
* See {@link "Accessibility"} for more information.
|
|
472
|
+
*
|
|
473
|
+
* @category Hook
|
|
474
|
+
*/
|
|
475
|
+
declare const useKeyboardListController: <T extends HTMLElement>(listId: string | undefined, options?: AccessibleListOptions) => {
|
|
476
|
+
ref: react10.Dispatch<react10.SetStateAction<T | null>>;
|
|
477
|
+
activeItemId: string | null;
|
|
478
|
+
activeItemIndex: number | null;
|
|
479
|
+
};
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/hooks/accessibility/use-keyboard-list-item.d.ts
|
|
482
|
+
/**
|
|
483
|
+
* Options for {@link useKeyboardListItem}.
|
|
484
|
+
*/
|
|
485
|
+
interface AccessibleListItemOptions {
|
|
486
|
+
/**
|
|
487
|
+
* The class name to add to the list item when it is active.
|
|
488
|
+
*/
|
|
489
|
+
activeClassName?: string;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Used to create an accessible list item. Call this in a list item component that
|
|
493
|
+
* should get activated by keyboard navigation on a {@link useKeyboardListController}
|
|
494
|
+
* component. If the list is virtualized, use {@link useKeyboardVirtualList} to
|
|
495
|
+
* scroll to the active item.
|
|
496
|
+
*
|
|
497
|
+
* See {@link "Accessibility"} for more information.
|
|
498
|
+
*
|
|
499
|
+
* @category Hook
|
|
500
|
+
*/
|
|
501
|
+
declare const useKeyboardListItem: <T extends HTMLElement>(listId: string | undefined, index: number, onSelect: () => void, options?: AccessibleListItemOptions) => {
|
|
502
|
+
isActive: boolean;
|
|
503
|
+
ref: react10.RefObject<T | null>;
|
|
504
|
+
};
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region src/hooks/accessibility/use-keyboard-virtual-list.d.ts
|
|
507
|
+
/**
|
|
508
|
+
* Options for the {@link useKeyboardVirtualList} hook.
|
|
509
|
+
*/
|
|
510
|
+
interface AccessibleVirtualListOptions {
|
|
511
|
+
/**
|
|
512
|
+
* A function that scrolls to an item in a virtualized list. Defaults to `scrollToItem`
|
|
513
|
+
* for `VariableSizeList` and `FixedSizeList` from `react-window`.
|
|
514
|
+
*/
|
|
515
|
+
scrollFn?: (index: number) => void;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Used to create a virtualized accessible list. Call this in a virtualized list
|
|
519
|
+
* component that should scroll to an active {@link useKeyboardListItem} component
|
|
520
|
+
* on a {@link useKeyboardListController} component.
|
|
521
|
+
*
|
|
522
|
+
* See {@link "Accessibility"} for more information.
|
|
523
|
+
*
|
|
524
|
+
* @category Hook
|
|
525
|
+
*/
|
|
526
|
+
declare const useKeyboardVirtualList: <T extends VariableSizeList | FixedSizeList | unknown>(listId: string | undefined, options?: AccessibleVirtualListOptions) => {
|
|
527
|
+
ref: react10.RefObject<T | null>;
|
|
528
|
+
};
|
|
529
|
+
//#endregion
|
|
530
|
+
export { AccessibleListItemOptions, AccessibleListOptions, AccessibleVirtualListOptions, FloorSelector, FloorSelectorProps, LocationList, LocationListProps, Search, SearchBar, SearchBarProps, SearchProps, ZoomControls, ZoomControlsProps, useKeyboardListController, useKeyboardListItem, useKeyboardVirtualList };
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as x}from"./chunk-6PPDNG4B.js";import{a as t}from"./chunk-CSLA67FZ.js";import{a as p}from"./chunk-GJIP2NMB.js";import{a as m}from"./chunk-GXFJG6ET.js";import{b as r,d as e,e as f}from"./chunk-GPW4PJ7Q.js";import{a as o}from"./chunk-R4VVGLYZ.js";import"./chunk-WBXN5D5G.js";import"./chunk-GJWKDIUL.js";import"./chunk-W6FAYJPU.js";import"./chunk-APRH4CAT.js";export{t as FloorSelector,m as LocationList,p as Search,o as SearchBar,x as ZoomControls,r as useKeyboardListController,e as useKeyboardListItem,f as useKeyboardVirtualList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where([class*=mappedin__]):where(li,ul,button){all:unset}:where([class*=mappedin__]):where(p,span,input){color:var(--mappedin-color-text-1, #000000);font-family:var(--mappedin-font-family, Helvetica, sans-serif);font-size:var(--mappedin-font-size-md, 1rem)}:where([class*=mappedin__]):where(input){font-size:1rem;background-color:var(--mappedin-color-background-1, #ffffff)}:where([class*=mappedin__]):where(svg){color:var(--mappedin-color-neutral-1, #000000)}:where([class*=mappedin__]):where(button,[role=button]){cursor:pointer}:where([class*=mappedin__]):where([role=button]:active span[class*=mappedin__],[role=button]:active p[class*=mappedin__],button:active span[class*=mappedin__],button:active p[class*=mappedin__]){filter:brightness(.9)}:where([class*=mappedin__]):where(:focus-visible,.mappedin__keyboard-focus){outline:var(--mappedin-focus-outline-width, 2px) solid var(--mappedin-focus-outline-color, #1890ff)}[class*=mappedin__][role=button]:hover span[class*=mappedin__],[class*=mappedin__][role=button]:hover p[class*=mappedin__],[class*=mappedin__][role=button].mappedin__keyboard-focus span[class*=mappedin__],[class*=mappedin__][role=button].mappedin__keyboard-focus p[class*=mappedin__],button[class*=mappedin__]:hover span[class*=mappedin__],button[class*=mappedin__]:hover p[class*=mappedin__],button[class*=mappedin__].mappedin__keyboard-focus span[class*=mappedin__],button[class*=mappedin__].mappedin__keyboard-focus p[class*=mappedin__]{color:var(--mappedin-color-primary-1, #000000)}:where([class*=mappedin__]):where(li.mappedin__keyboard-focus:has(span[class*=mappedin__]),li.mappedin__keyboard-focus:has(p[class*=mappedin__])){outline:none}.mappedin__search-bar-wrapper{position:relative}.mappedin__search-bar-input::-webkit-search-cancel-button{display:none}.mappedin__search-bar-input{width:100%}.mappedin__search-bar-icon{position:absolute;right:0;top:0;height:100%}.mappedin__search-bar-icon.mappedin__hidden,[data-mappedin-search-bar-value=""] .mappedin__search-bar-icon.mappedin__clear-icon{opacity:0;pointer-events:none}[data-mappedin-search-bar-value]:not([data-mappedin-search-bar-value=""]) .mappedin__search-bar-icon.mappedin__clear-icon{opacity:1;pointer-events:auto}[data-mappedin-search-bar-value=""] .mappedin__search-bar-icon.mappedin__search-icon{opacity:1;pointer-events:auto}[data-mappedin-search-bar-value]:not([data-mappedin-search-bar-value=""]) .mappedin__search-bar-icon.mappedin__search-icon{opacity:0;pointer-events:none}.mappedin__location-list ul{padding:0;margin:0}.mappedin__location-list-item-wrapper.mappedin__keyboard-focus{outline-offset:calc(var(--mappedin-focus-outline-width, 2px) * -1)}.mappedin__location-list-item-wrapper>*{height:100%}.mappedin__location-list-item-content{display:flex}.mappedin__location-list-item-image{height:calc(100% - .75rem)}.mappedin__location-list-item-image :where(img,svg){max-height:100%}.mappedin__location-list-item-image:has(svg){aspect-ratio:1}.mappedin__floor-selector-button{display:flex}.mappedin__floor-selector-chevron svg{aspect-ratio:1;min-height:1rem}.mappedin__floor-selector-open .mappedin__floor-selector-chevron{transform:rotate(-180deg)}.mappedin__floor-selector-floors-list{display:flex;flex-direction:column}.mappedin__floor-selector-wrapper span{text-wrap:nowrap}.mappedin__zoom-controls-wrapper{display:flex;flex-direction:column}.mappedin__zoom-controls-button svg{min-height:1rem}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunk-IIQHZPWU.js";import"../chunk-APRH4CAT.js";
|