@brightlocal/ui-components 2.13.0 → 2.15.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/README.md +3 -2
- package/component-meta.json +151 -8
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +5 -1
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +48 -31
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +462 -447
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +21 -15
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +259 -46
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +460 -185
- package/dist/stepper.cjs +1 -0
- package/dist/stepper.d.ts +176 -0
- package/dist/stepper.d.ts.map +1 -0
- package/dist/stepper.js +351 -0
- package/package.json +5 -4
- package/src/components/card.tsx +23 -0
- package/src/components/list.tsx +8 -2
- package/src/components/map.tsx +681 -134
- package/src/components/stepper.tsx +708 -0
- package/src/index.ts +1 -0
- package/src/types/assets.d.ts +9 -0
package/dist/list.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),k=require("react"),w=require("@radix-ui/react-slot"),R=require("class-variance-authority"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),k=require("react"),w=require("@radix-ui/react-slot"),R=require("class-variance-authority"),o=require("@brightlocal/ui-components/lib/utils"),d=require("@brightlocal/ui-components/skeleton");function S(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const r=S(k),c=R.cva(["flex","items-center","gap-4","rounded-lg","py-2","pr-2","pl-4","transition-colors","duration-200","ease-out"],{variants:{variant:{default:[],filled:["bg-card"],outline:["bg-background","border","border-border"],loading:["flex-col","gap-2","px-0","pt-0","pb-3"]}},defaultVariants:{variant:"filled"}}),m=r.forwardRef(({className:e,dataHook:a,trackingEl:t,trackingLabel:n,...i},l)=>s.jsx("ul",{ref:l,className:o.cn("flex flex-col gap-2",e),"data-hook":a,"data-slot":"list","data-tracking-el":t,"data-tracking-label":n,...i}));m.displayName="List";const f=r.forwardRef(({asChild:e=!1,className:a,variant:t,dataHook:n,trackingEl:i,trackingLabel:l,children:N,...j},y)=>{const h=e?w.Slot:"li";return s.jsx(h,{ref:y,className:o.cn(c({variant:t}),a),"data-hook":n,"data-slot":"item","data-tracking-el":i,"data-tracking-label":l,...j,children:t==="loading"?s.jsxs(s.Fragment,{children:[s.jsx(d.Skeleton,{className:"h-4 w-full"}),s.jsx(d.Skeleton,{className:"h-4 w-full"})]}):N})});f.displayName="Item";const u=r.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("shrink-0",e),"data-slot":"item-media",...a}));u.displayName="ItemMedia";const p=r.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("flex flex-1 flex-col gap-1",e),"data-slot":"item-content",...a}));p.displayName="ItemContent";const g=r.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("text-foreground text-base leading-normal font-medium",e),"data-slot":"item-title",...a}));g.displayName="ItemTitle";const x=r.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("text-muted-foreground text-sm leading-normal font-normal",e),"data-slot":"item-description",...a}));x.displayName="ItemDescription";const b=r.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("text-muted-foreground flex size-9 shrink-0 items-center justify-center rounded-full",e),"data-slot":"item-actions",...a}));b.displayName="ItemActions";const I=r.forwardRef(({className:e,dataHook:a,...t},n)=>s.jsx("li",{ref:n,className:o.cn("text-muted-foreground flex items-center py-2 pr-2 pl-4 text-base leading-none font-medium",e),"data-hook":a,"data-slot":"item-subheader",...t}));I.displayName="ItemSubheader";exports.Item=f;exports.ItemActions=b;exports.ItemContent=p;exports.ItemDescription=x;exports.ItemMedia=u;exports.ItemSubheader=I;exports.ItemTitle=g;exports.List=m;exports.itemVariants=c;
|
package/dist/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/components/list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,QAAA,MAAM,YAAY;;8EA0BjB,CAAC;AAMF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG;IACnD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,IAAI,iGAYT,CAAC;AAOF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG;IACnD;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACvD;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,IAAI,8FAqCT,CAAC;AAOF,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,KA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AAOF,6EAA6E;AAC7E,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEzD;;GAEG;AACH,QAAA,MAAM,SAAS,mKASd,CAAC;AAOF,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D;;;GAGG;AACH,QAAA,MAAM,WAAW,mKAShB,CAAC;AAOF,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEzD;;GAEG;AACH,QAAA,MAAM,SAAS,mKAYd,CAAC;AAOF,uFAAuF;AACvF,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAE/D;;GAEG;AACH,QAAA,MAAM,eAAe,mKAYpB,CAAC;AAOF,qFAAqF;AACrF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAE3D;;GAEG;AACH,QAAA,MAAM,WAAW,mKAYhB,CAAC;AAOF,iFAAiF;AACjF,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG;IAC5D;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,aAAa,uGAalB,CAAC;AAOF,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,WAAW,EACX,SAAS,EACT,eAAe,EACf,WAAW,EACX,aAAa,EACb,YAAY,GACb,CAAC"}
|
package/dist/list.js
CHANGED
|
@@ -31,7 +31,7 @@ const N = x(
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
), b = l.forwardRef(
|
|
34
|
-
({ className: t, dataHook: a, trackingEl: e, trackingLabel:
|
|
34
|
+
({ className: t, dataHook: a, trackingEl: e, trackingLabel: i, ...s }, d) => /* @__PURE__ */ o(
|
|
35
35
|
"ul",
|
|
36
36
|
{
|
|
37
37
|
ref: d,
|
|
@@ -39,8 +39,8 @@ const N = x(
|
|
|
39
39
|
"data-hook": a,
|
|
40
40
|
"data-slot": "list",
|
|
41
41
|
"data-tracking-el": e,
|
|
42
|
-
"data-tracking-label":
|
|
43
|
-
...
|
|
42
|
+
"data-tracking-label": i,
|
|
43
|
+
...s
|
|
44
44
|
}
|
|
45
45
|
)
|
|
46
46
|
);
|
|
@@ -50,21 +50,21 @@ const I = l.forwardRef(
|
|
|
50
50
|
asChild: t = !1,
|
|
51
51
|
className: a,
|
|
52
52
|
variant: e,
|
|
53
|
-
dataHook:
|
|
54
|
-
trackingEl:
|
|
53
|
+
dataHook: i,
|
|
54
|
+
trackingEl: s,
|
|
55
55
|
trackingLabel: d,
|
|
56
56
|
children: n,
|
|
57
|
-
...
|
|
58
|
-
},
|
|
57
|
+
...f
|
|
58
|
+
}, c) => /* @__PURE__ */ o(
|
|
59
59
|
t ? g : "li",
|
|
60
60
|
{
|
|
61
|
-
ref:
|
|
61
|
+
ref: c,
|
|
62
62
|
className: r(N({ variant: e }), a),
|
|
63
|
-
"data-hook":
|
|
63
|
+
"data-hook": i,
|
|
64
64
|
"data-slot": "item",
|
|
65
|
-
"data-tracking-el":
|
|
65
|
+
"data-tracking-el": s,
|
|
66
66
|
"data-tracking-label": d,
|
|
67
|
-
...
|
|
67
|
+
...f,
|
|
68
68
|
children: e === "loading" ? /* @__PURE__ */ p(u, { children: [
|
|
69
69
|
/* @__PURE__ */ o(m, { className: "h-4 w-full" }),
|
|
70
70
|
/* @__PURE__ */ o(m, { className: "h-4 w-full" })
|
|
@@ -102,7 +102,10 @@ const y = l.forwardRef(
|
|
|
102
102
|
"div",
|
|
103
103
|
{
|
|
104
104
|
ref: e,
|
|
105
|
-
className: r(
|
|
105
|
+
className: r(
|
|
106
|
+
"text-foreground text-base leading-normal font-medium",
|
|
107
|
+
t
|
|
108
|
+
),
|
|
106
109
|
"data-slot": "item-title",
|
|
107
110
|
...a
|
|
108
111
|
}
|
|
@@ -114,7 +117,10 @@ const w = l.forwardRef(
|
|
|
114
117
|
"div",
|
|
115
118
|
{
|
|
116
119
|
ref: e,
|
|
117
|
-
className: r(
|
|
120
|
+
className: r(
|
|
121
|
+
"text-muted-foreground text-sm leading-normal font-normal",
|
|
122
|
+
t
|
|
123
|
+
),
|
|
118
124
|
"data-slot": "item-description",
|
|
119
125
|
...a
|
|
120
126
|
}
|
|
@@ -137,10 +143,10 @@ const R = l.forwardRef(
|
|
|
137
143
|
);
|
|
138
144
|
R.displayName = "ItemActions";
|
|
139
145
|
const v = l.forwardRef(
|
|
140
|
-
({ className: t, dataHook: a, ...e },
|
|
146
|
+
({ className: t, dataHook: a, ...e }, i) => /* @__PURE__ */ o(
|
|
141
147
|
"li",
|
|
142
148
|
{
|
|
143
|
-
ref:
|
|
149
|
+
ref: i,
|
|
144
150
|
className: r(
|
|
145
151
|
"text-muted-foreground flex items-center py-2 pr-2 pl-4 text-base leading-none font-medium",
|
|
146
152
|
t
|
package/dist/map.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),D=require("react"),O=require("class-variance-authority"),y=require("@brightlocal/icons"),k=require("@brightlocal/illustrations"),M=require("@brightlocal/ui-components/button"),h=require("@brightlocal/ui-components/card"),p=require("@brightlocal/ui-components/lib/utils"),x=require("@brightlocal/ui-components/popover");function q(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const c=q(D),B={ROADMAP:"roadmap",SATELLITE:"satellite"},z=["water","landscape","road","poi","transit"];function _(e,t){return[...z.map(a=>({featureType:a,elementType:"geometry",stylers:[{saturation:e,lightness:t}]})),{elementType:"labels.text.fill",stylers:[{saturation:e,lightness:t-10}]},{elementType:"labels.icon",stylers:[{saturation:e,lightness:t}]}]}const v=[{elementType:"geometry",stylers:[{color:"#444444"}]},{elementType:"labels.text.fill",stylers:[{color:"#aaaaaa"}]},{elementType:"labels.text.stroke",stylers:[{color:"#323232"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#30405a"}]},{featureType:"landscape",elementType:"geometry",stylers:[{color:"#4b4b4b"}]},{featureType:"road",elementType:"geometry",stylers:[{color:"#5c5c5c"}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#3e3e3e"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#525252"}]},{featureType:"transit",elementType:"geometry",stylers:[{color:"#505050"}]},{elementType:"labels.icon",stylers:[{visibility:"off"}]}],w={default:{light:[],dark:v},muted:{light:_(-40,20),dark:v}};function j(){const[e,t]=c.useState(()=>typeof document<"u"&&document.body.classList.contains("dark"));return c.useEffect(()=>{const a=new MutationObserver(()=>{t(document.body.classList.contains("dark"))});return a.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>a.disconnect()},[]),e}function G(e="default"){const t=j();return w[e][t?"dark":"light"]}const N={primary:"strong",secondary:"moderate",warning:"moderate",destructive:"unranked",outline:"unranked"};function F(e){return e in N}function V(e){return F(e)?N[e]:e}const g={strong:"bg-primary dark:bg-green-400",moderate:"bg-chart-4",weak:"bg-orange-400",unranked:"bg-red-600",error:"bg-warning-background dark:bg-orange-200"},$=O.cva("inline-flex items-center justify-center rounded-full font-sans text-sm font-semibold text-foreground dark:text-neutral-900 border-2 border-white shadow-sm transition-shadow duration-200 ease-out hover:shadow-md",{variants:{variant:{strong:`${g.strong}`,moderate:`${g.moderate}`,weak:`${g.weak}`,unranked:`${g.unranked} text-white dark:text-white`,error:`${g.error}`}},defaultVariants:{variant:"strong"}}),b=c.forwardRef(({value:e,variant:t="strong",loading:a=!1,pulse:n,dataHook:s,className:l,trackingEl:o,trackingLabel:i,style:d,...u},m)=>{const f=V(t);return r.jsx("div",{ref:m,className:p.cn(a?"border-border bg-accent rounded-full border":$({variant:f}),"size-8 p-0",l),"data-hook":s,"data-slot":"map-grid-pin","data-state":a?"loading":void 0,"data-tracking-el":o||"map-grid-pin","data-tracking-label":i,style:d,...u,children:f==="error"&&!a?r.jsx(y.TriangleAlert,{"aria-hidden":"true",className:"text-warning-foreground",size:14}):String(e)})});b.displayName="MapGridPin";const P=c.forwardRef(({icon:e,animateIn:t=!1,value:a,variant:n,pulse:s,dataHook:l,className:o,trackingEl:i,trackingLabel:d,ariaLabel:u,...m},f)=>a!==void 0||n!==void 0||s!==void 0?r.jsx(b,{ref:f,className:o,dataHook:l,pulse:s,trackingEl:i,trackingLabel:d,value:a??1,variant:n,...m}):r.jsx("div",{ref:f,"aria-label":u??"Location",className:p.cn("relative inline-flex h-[46px] w-[38px] items-start justify-center",o),"data-hook":l,"data-slot":"map-location-pin","data-tracking-el":i||"map-location-pin","data-tracking-label":d,role:"img",...m,children:r.jsxs("span",{"aria-hidden":"true",className:p.cn("relative flex size-full",t&&"animate-pop-in origin-bottom will-change-transform motion-reduce:animate-none"),children:[r.jsxs("svg",{"aria-hidden":"true",className:"size-full overflow-visible drop-shadow-sm",fill:"none",viewBox:"0 0 38 46",children:[r.jsx("path",{className:"fill-white",d:"M38 19.15C38 29.21 29.4 35.77 20.38 44.63C19.61 45.39 18.37 45.41 17.58 44.67C8.01 35.79 0 29.23 0 19.15C0 8.57 8.51 0 19 0C29.49 0 38 8.57 38 19.15Z"}),r.jsx("circle",{className:"fill-sky-500",cx:"19",cy:"19",r:"16"})]}),r.jsx("span",{className:"absolute top-[19px] left-1/2 flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-white",children:e??r.jsx(y.Store,{size:16})})]})}));P.displayName="MapLocationPin";const T=c.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:n,children:s,iconOnly:l=!0,...o},i)=>{const d=j();return r.jsx(M.Button,{ref:i,className:e,"data-slot":"map-control-button",dataHook:t,iconOnly:l,trackingEl:a||"map-control-button",trackingLabel:n,variant:d?"secondary":"outline",...o,children:s})});T.displayName="MapControlButton";const C=c.forwardRef(({className:e,children:t,dataHook:a,trackingEl:n,trackingLabel:s,ariaLabel:l,...o},i)=>r.jsxs("div",{ref:i,"aria-label":l??"Loading map",className:p.cn("border-border relative flex h-full w-full items-center justify-center overflow-hidden rounded-lg border",e),"data-hook":a,"data-slot":"map-loading-state","data-tracking-el":n||"map-loading-state","data-tracking-label":s,role:"status",...o,children:[r.jsx(S,{}),t&&r.jsx("div",{className:"relative",children:t})]}));C.displayName="MapLoadingState";const S=c.memo(function({rounded:t}){return r.jsx(k.MapBackground,{"aria-hidden":"true",className:p.cn("absolute inset-0 h-full w-full object-cover",t&&"rounded-[inherit]"),mode:"auto"})}),L=c.forwardRef(({className:e,title:t="We couldn't load your map rankings.",message:a="Reloading usually fixes it, and it won't use any credits",onRetry:n,retryLoading:s=!1,retryLabel:l="Reload",dataHook:o,trackingEl:i,trackingLabel:d,...u},m)=>r.jsxs("div",{ref:m,className:p.cn("border-border relative flex h-full w-full flex-col items-center justify-center gap-4 rounded-lg border p-4 text-center sm:gap-6 sm:p-8",e),"data-hook":o,"data-slot":"map-error-state","data-tracking-el":i||"map-error-state","data-tracking-label":d,role:"alert",...u,children:[r.jsx(S,{rounded:!0}),r.jsxs("div",{className:"relative flex flex-col items-center gap-4 sm:gap-6",children:[r.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center","data-slot":"map-error-illustration",children:r.jsx(k.GlobeyFixingFault,{className:"h-auto w-full max-w-41"})}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx("h3",{className:"text-foreground text-lg font-medium","data-slot":"map-error-title",children:t}),a&&r.jsx("p",{className:"text-muted-foreground text-sm","data-slot":"map-error-message",children:a})]}),n&&r.jsxs(M.Button,{className:"mt-1",dataHook:`${o}-retry`,loading:s,size:"sm",variant:"primary",onClick:n,children:[!s&&r.jsx(y.RefreshCw,{"aria-hidden":"true"}),l]})]})]}));L.displayName="MapErrorState";const A=c.forwardRef(({variant:e,color:t,dataHook:a,className:n,children:s,...l},o)=>{const i=e?g[e]:t;return r.jsxs("span",{ref:o,className:p.cn("text-foreground flex items-center gap-1 font-sans text-xs",n),"data-hook":a,"data-slot":"map-legend-item",...l,children:[r.jsx("span",{"aria-hidden":"true",className:p.cn("inline-block size-2 shrink-0 rounded-full",i)}),s]})});A.displayName="MapLegendItem";const R=c.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:n,ariaLabel:s,children:l,...o},i)=>r.jsx(h.Card,{ref:i,"aria-label":s??"Map legend",className:p.cn("inline-flex w-auto flex-row items-center bg-white font-sans dark:bg-neutral-800",e),"data-slot":"map-legend",dataHook:t,density:"condensed",maxWidth:"none",role:"group",trackingEl:a||"map-legend",trackingLabel:n,variant:"border",...o,children:r.jsx(h.CardContent,{className:"flex items-center gap-3",children:l})}));R.displayName="MapLegend";function W(e){const{hoverWhenOpen:t=!1}=e??{},[a,n]=c.useState(null),[s,l]=c.useState(null),o=c.useCallback(u=>{l(u),n(u)},[]),i=c.useCallback(()=>{n(null)},[]),d=c.useCallback(u=>{const m={onClick:()=>o(u)};return t&&(m.onPointerEnter=f=>{f.pointerType==="mouse"&&a!=null&&o(u)}),m},[t,o,a]);return{activeItem:a,anchorItem:s,showItem:o,close:i,getInteractionProps:d}}const Y=x.Popover,E=x.PopoverAnchor;E.displayName="MapPopoverAnchor";const I=c.forwardRef(({className:e,side:t="top",sideOffset:a=4,dataHook:n,trackingEl:s,trackingLabel:l,...o},i)=>r.jsx(x.PopoverContent,{ref:i,className:p.cn("w-auto max-w-68.25 p-3 data-[state=closed]:animate-none data-[state=closed]:opacity-0",e),"data-slot":"map-popover-content","data-tracking-el":s||"map-popover","data-tracking-label":l,dataHook:n,side:t,sideOffset:a,onCloseAutoFocus:d=>d.preventDefault(),onOpenAutoFocus:d=>d.preventDefault(),...o}));I.displayName="MapPopoverContent";exports.MAP_STYLES=w;exports.MapControlButton=T;exports.MapErrorState=L;exports.MapGridPin=b;exports.MapLegend=R;exports.MapLegendItem=A;exports.MapLoadingState=C;exports.MapLocationPin=P;exports.MapPopover=Y;exports.MapPopoverAnchor=E;exports.MapPopoverContent=I;exports.MapTypeId=B;exports.mapGridPinColorMap=g;exports.useMapPopoverClick=W;exports.useMapStyles=G;
|
package/dist/map.d.ts
CHANGED
|
@@ -8,23 +8,85 @@ import * as React from "react";
|
|
|
8
8
|
declare const MapTypeId: {
|
|
9
9
|
/** Default road map view */
|
|
10
10
|
readonly ROADMAP: "roadmap";
|
|
11
|
-
/** Satellite imagery */
|
|
11
|
+
/** @deprecated Satellite imagery — prefer cloud-based map styling via Map ID */
|
|
12
12
|
readonly SATELLITE: "satellite";
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Union of all map type identifier values.
|
|
16
16
|
*/
|
|
17
17
|
type MapTypeIdValue = (typeof MapTypeId)[keyof typeof MapTypeId];
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Visual variant for map styling.
|
|
20
|
+
* - `"default"` — Standard Google Maps appearance (no custom styles in light mode)
|
|
21
|
+
* - `"muted"` — Desaturated, softened map appearance so UI elements stand out
|
|
22
|
+
*/
|
|
23
|
+
type MapStyleVariant = "default" | "muted";
|
|
24
|
+
/**
|
|
25
|
+
* A single Google Maps JSON style rule.
|
|
26
|
+
* Matches the `google.maps.MapTypeStyle` shape so values can be passed
|
|
27
|
+
* directly to the `styles` prop of `@vis.gl/react-google-maps` `<Map>`.
|
|
28
|
+
*/
|
|
29
|
+
type MapStyleRule = {
|
|
30
|
+
featureType?: string;
|
|
31
|
+
elementType?: string;
|
|
32
|
+
stylers: Record<string, string | number>[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Built-in map style presets keyed by `variant.theme`.
|
|
36
|
+
*
|
|
37
|
+
* - `default.light` — empty (uses native Google Maps styling)
|
|
38
|
+
* - `default.dark` — dark colour palette based on "Example 3 Dark"
|
|
39
|
+
* - `muted.light` — desaturated/lightened based on "Example 2" (`sat -40, light +20`)
|
|
40
|
+
* - `muted.dark` — same dark palette as `default.dark`
|
|
41
|
+
*/
|
|
42
|
+
declare const MAP_STYLES: Record<MapStyleVariant, {
|
|
43
|
+
light: MapStyleRule[];
|
|
44
|
+
dark: MapStyleRule[];
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the appropriate `google.maps.MapTypeStyle[]` for the given variant
|
|
48
|
+
* and the current color scheme (light/dark). Pass the returned array to the
|
|
49
|
+
* `styles` prop of `@vis.gl/react-google-maps` `<Map>`.
|
|
50
|
+
*
|
|
51
|
+
* Dark mode is detected automatically via the `dark` class on `document.body`.
|
|
52
|
+
*
|
|
53
|
+
* > **Note:** JSON styling works with **raster maps only** (no `mapId` prop).
|
|
54
|
+
* > For vector maps use [Cloud-based Map Styling](https://developers.google.com/maps/documentation/javascript/cloud-based-map-styling).
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* import { useMapStyles } from "./map";
|
|
59
|
+
*
|
|
60
|
+
* function MyMap() {
|
|
61
|
+
* const styles = useMapStyles("muted");
|
|
62
|
+
* return <Map styles={styles} defaultCenter={center} defaultZoom={14} />;
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function useMapStyles(variant?: MapStyleVariant): MapStyleRule[];
|
|
67
|
+
type ResolvedVariant = "strong" | "moderate" | "weak" | "unranked" | "error";
|
|
68
|
+
/** @deprecated Legacy variant names kept for backward compatibility. */
|
|
69
|
+
type LegacyVariant = "primary" | "secondary" | "destructive" | "outline" | "warning";
|
|
70
|
+
type MapGridPinVariant = ResolvedVariant | LegacyVariant;
|
|
71
|
+
/**
|
|
72
|
+
* Background color classes for each ranking variant.
|
|
73
|
+
* Shared by MapGridPin (CVA) and MapLegendItem so the pin and legend
|
|
74
|
+
* colors stay in sync from a single source of truth.
|
|
75
|
+
*/
|
|
76
|
+
declare const mapGridPinColorMap: Record<ResolvedVariant, string>;
|
|
19
77
|
/**
|
|
20
78
|
* Props for the MapGridPin component.
|
|
21
79
|
*/
|
|
22
|
-
interface MapGridPinProps extends Omit<React.ComponentProps<"
|
|
80
|
+
interface MapGridPinProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
23
81
|
/** Value displayed inside the pin (number or short label) */
|
|
24
82
|
value: number | string;
|
|
25
|
-
/**
|
|
83
|
+
/** Color variant — consumer controls this based on value thresholds */
|
|
26
84
|
variant?: MapGridPinVariant;
|
|
27
|
-
/**
|
|
85
|
+
/** Show loading appearance (neutral styling, overrides variant colors) */
|
|
86
|
+
loading?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated No longer rendered. Kept for backward compatibility.
|
|
89
|
+
*/
|
|
28
90
|
pulse?: boolean;
|
|
29
91
|
/** Required test hook identifier */
|
|
30
92
|
dataHook: string;
|
|
@@ -34,25 +96,62 @@ interface MapGridPinProps extends Omit<React.ComponentProps<"button">, "children
|
|
|
34
96
|
trackingLabel?: string;
|
|
35
97
|
}
|
|
36
98
|
/**
|
|
37
|
-
* A circular map pin
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
99
|
+
* A circular map pin that displays a numeric value with a colored background.
|
|
100
|
+
* Renders as a non-focusable `div` (compatible with Google Maps AdvancedMarkerElement).
|
|
101
|
+
* Color is determined by the `variant` prop — the consumer controls which variant
|
|
102
|
+
* to apply based on the value.
|
|
41
103
|
*/
|
|
42
|
-
declare const MapGridPin: React.ForwardRefExoticComponent<Omit<MapGridPinProps, "ref"> & React.RefAttributes<
|
|
104
|
+
declare const MapGridPin: React.ForwardRefExoticComponent<Omit<MapGridPinProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
43
105
|
/**
|
|
44
106
|
* Props for the MapLocationPin component.
|
|
45
107
|
*/
|
|
46
|
-
interface MapLocationPinProps extends Omit<
|
|
47
|
-
/**
|
|
108
|
+
interface MapLocationPinProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
109
|
+
/** Icon rendered inside the pin marker @default Store icon */
|
|
110
|
+
icon?: React.ReactNode;
|
|
111
|
+
/** Play a one-time entrance — the pin springs into place from its anchor point when it mounts @default false */
|
|
112
|
+
animateIn?: boolean;
|
|
113
|
+
/** Required test hook identifier */
|
|
114
|
+
dataHook: string;
|
|
115
|
+
/** Analytics element identifier */
|
|
116
|
+
trackingEl?: string;
|
|
117
|
+
/** Analytics label */
|
|
118
|
+
trackingLabel?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Accessible label for the pin marker.
|
|
121
|
+
* @default "Location"
|
|
122
|
+
*/
|
|
123
|
+
ariaLabel?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Numeric value displayed inside the pin.
|
|
126
|
+
* @deprecated Use {@link MapGridPin} for numbered pins. Provided only for
|
|
127
|
+
* backward compatibility — passing it renders the legacy numbered-circle marker.
|
|
128
|
+
*/
|
|
48
129
|
value?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Colour variant for the legacy numbered pin.
|
|
132
|
+
* @deprecated Use {@link MapGridPin} for numbered pins. Provided only for
|
|
133
|
+
* backward compatibility — passing it renders the legacy numbered-circle marker.
|
|
134
|
+
*/
|
|
135
|
+
variant?: MapGridPinVariant;
|
|
136
|
+
/**
|
|
137
|
+
* Enable the legacy pulse animation. Prefer {@link MapLocationPinProps.animateIn}
|
|
138
|
+
* for the teardrop entrance.
|
|
139
|
+
* @deprecated Use {@link MapGridPin} for numbered pins. Provided only for
|
|
140
|
+
* backward compatibility — passing it renders the legacy numbered-circle marker.
|
|
141
|
+
*/
|
|
142
|
+
pulse?: boolean;
|
|
49
143
|
}
|
|
50
144
|
/**
|
|
51
|
-
* A map location pin
|
|
52
|
-
*
|
|
145
|
+
* A teardrop-shaped map location pin with an icon inside.
|
|
146
|
+
* Renders an SVG pin marker with a circular icon area and drop shadow.
|
|
53
147
|
* Designed to be placed inside any map marker component (e.g. AdvancedMarker).
|
|
148
|
+
*
|
|
149
|
+
* Backward compatibility: the previously published `MapLocationPin` was a thin
|
|
150
|
+
* wrapper around {@link MapGridPin} (a numbered circle). Passing any legacy prop
|
|
151
|
+
* (`value`, `variant`, or `pulse`) renders that original numbered-pin marker so
|
|
152
|
+
* existing consumers keep working; otherwise the new teardrop marker is rendered.
|
|
54
153
|
*/
|
|
55
|
-
declare const MapLocationPin: React.ForwardRefExoticComponent<Omit<MapLocationPinProps, "ref"> & React.RefAttributes<
|
|
154
|
+
declare const MapLocationPin: React.ForwardRefExoticComponent<Omit<MapLocationPinProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
56
155
|
/**
|
|
57
156
|
* Props for the MapControlButton component.
|
|
58
157
|
*/
|
|
@@ -65,10 +164,14 @@ interface MapControlButtonProps extends Omit<React.ComponentProps<"button">, "ty
|
|
|
65
164
|
trackingLabel?: string;
|
|
66
165
|
/** Button type attribute */
|
|
67
166
|
type?: "button" | "submit";
|
|
167
|
+
/** Render as compact icon-only button or with text @default true */
|
|
168
|
+
iconOnly?: boolean;
|
|
68
169
|
}
|
|
69
170
|
/**
|
|
70
171
|
* A floating control button for map UIs.
|
|
71
|
-
*
|
|
172
|
+
* Uses `outline` in light mode and `secondary` in dark mode.
|
|
173
|
+
* In icon-only mode (default) renders a circular icon button.
|
|
174
|
+
* With `iconOnly={false}` renders a pill-shaped button with text and icon.
|
|
72
175
|
* Use for zoom, locate, layer toggles, and other map controls.
|
|
73
176
|
*/
|
|
74
177
|
declare const MapControlButton: React.ForwardRefExoticComponent<Omit<MapControlButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -76,31 +179,56 @@ declare const MapControlButton: React.ForwardRefExoticComponent<Omit<MapControlB
|
|
|
76
179
|
* Props for the MapLoadingState component.
|
|
77
180
|
*/
|
|
78
181
|
interface MapLoadingStateProps extends React.ComponentProps<"div"> {
|
|
79
|
-
/**
|
|
80
|
-
|
|
182
|
+
/** Content displayed centered over the map background */
|
|
183
|
+
children?: React.ReactNode;
|
|
81
184
|
/** Required test hook identifier */
|
|
82
185
|
dataHook: string;
|
|
83
186
|
/** Analytics element identifier */
|
|
84
187
|
trackingEl?: string;
|
|
85
188
|
/** Analytics label */
|
|
86
189
|
trackingLabel?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Accessible label for the loading status region.
|
|
192
|
+
* @default "Loading map"
|
|
193
|
+
*/
|
|
194
|
+
ariaLabel?: string;
|
|
87
195
|
}
|
|
88
196
|
/**
|
|
89
197
|
* A loading placeholder for map containers.
|
|
90
|
-
*
|
|
91
|
-
*
|
|
198
|
+
* Displays the map background image with consumer-provided content
|
|
199
|
+
* centered vertically and horizontally. Fills its parent container.
|
|
200
|
+
* Use as a fallback while the map provider is initialising.
|
|
92
201
|
*/
|
|
93
202
|
declare const MapLoadingState: React.ForwardRefExoticComponent<Omit<MapLoadingStateProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
94
203
|
/**
|
|
95
204
|
* Props for the MapErrorState component.
|
|
96
205
|
*/
|
|
97
206
|
interface MapErrorStateProps extends React.ComponentProps<"div"> {
|
|
98
|
-
/**
|
|
207
|
+
/**
|
|
208
|
+
* Error title displayed as a heading.
|
|
209
|
+
* @default "We couldn't load your map rankings."
|
|
210
|
+
*/
|
|
99
211
|
title?: string;
|
|
100
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Error description displayed below the title.
|
|
214
|
+
* @default "Reloading usually fixes it, and it won't use any credits"
|
|
215
|
+
*/
|
|
101
216
|
message?: string;
|
|
102
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Retry callback. When provided, renders a retry button.
|
|
219
|
+
* Omit to hide the retry button entirely.
|
|
220
|
+
*/
|
|
103
221
|
onRetry?: () => void;
|
|
222
|
+
/**
|
|
223
|
+
* Show the retry button in its loading state while the map reloads.
|
|
224
|
+
* @default false
|
|
225
|
+
*/
|
|
226
|
+
retryLoading?: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Label for the retry button.
|
|
229
|
+
* @default "Reload"
|
|
230
|
+
*/
|
|
231
|
+
retryLabel?: string;
|
|
104
232
|
/** Required test hook identifier */
|
|
105
233
|
dataHook: string;
|
|
106
234
|
/** Analytics element identifier */
|
|
@@ -110,10 +238,33 @@ interface MapErrorStateProps extends React.ComponentProps<"div"> {
|
|
|
110
238
|
}
|
|
111
239
|
/**
|
|
112
240
|
* An error state for map containers.
|
|
113
|
-
* Displays
|
|
114
|
-
*
|
|
241
|
+
* Displays the Globey "fixing fault" illustration, title, and message.
|
|
242
|
+
* Pass `onRetry` to render a retry button; omit it to hide the button entirely.
|
|
115
243
|
*/
|
|
116
244
|
declare const MapErrorState: React.ForwardRefExoticComponent<Omit<MapErrorStateProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
245
|
+
/**
|
|
246
|
+
* Props for the MapLegendItem component.
|
|
247
|
+
*/
|
|
248
|
+
interface MapLegendItemProps extends React.ComponentProps<"span"> {
|
|
249
|
+
/**
|
|
250
|
+
* Pin ranking variant — resolves to the matching MapGridPin background color.
|
|
251
|
+
* Preferred over `color` so pin and legend stay in sync automatically.
|
|
252
|
+
*/
|
|
253
|
+
variant?: ResolvedVariant;
|
|
254
|
+
/**
|
|
255
|
+
* Dot color as a Tailwind background class (e.g. "bg-primary").
|
|
256
|
+
* Use for non-ranking legends where no pin variant applies.
|
|
257
|
+
* Ignored when `variant` is provided.
|
|
258
|
+
*/
|
|
259
|
+
color?: string;
|
|
260
|
+
/** Required test hook identifier */
|
|
261
|
+
dataHook: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* A single legend entry: colored dot + label text.
|
|
265
|
+
* Pass `variant` to match MapGridPin colors automatically, or `color` for custom dots.
|
|
266
|
+
*/
|
|
267
|
+
declare const MapLegendItem: React.ForwardRefExoticComponent<Omit<MapLegendItemProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
117
268
|
/**
|
|
118
269
|
* Props for the MapLegend component.
|
|
119
270
|
*/
|
|
@@ -124,6 +275,11 @@ interface MapLegendProps extends React.ComponentProps<"div"> {
|
|
|
124
275
|
trackingEl?: string;
|
|
125
276
|
/** Analytics label */
|
|
126
277
|
trackingLabel?: string;
|
|
278
|
+
/**
|
|
279
|
+
* Accessible label for the legend group.
|
|
280
|
+
* @default "Map legend"
|
|
281
|
+
*/
|
|
282
|
+
ariaLabel?: string;
|
|
127
283
|
}
|
|
128
284
|
/**
|
|
129
285
|
* A flexible legend container for map UIs.
|
|
@@ -131,31 +287,84 @@ interface MapLegendProps extends React.ComponentProps<"div"> {
|
|
|
131
287
|
*/
|
|
132
288
|
declare const MapLegend: React.ForwardRefExoticComponent<Omit<MapLegendProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
133
289
|
/**
|
|
134
|
-
*
|
|
290
|
+
* Options for {@link useMapPopoverClick}.
|
|
291
|
+
*/
|
|
292
|
+
interface UseMapPopoverClickOptions {
|
|
293
|
+
/**
|
|
294
|
+
* When `true`, hovering a pin switches the popover to that pin
|
|
295
|
+
* after any pin has been clicked open (menubar-style interaction).
|
|
296
|
+
* Mouse-only — touch events are filtered out.
|
|
297
|
+
* @default false
|
|
298
|
+
*/
|
|
299
|
+
hoverWhenOpen?: boolean;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Pointer interaction props returned by {@link UseMapPopoverClickReturn.getInteractionProps}.
|
|
303
|
+
*/
|
|
304
|
+
interface MapPinInteractionProps {
|
|
305
|
+
onClick: () => void;
|
|
306
|
+
onPointerEnter?: (e: React.PointerEvent) => void;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Return type of {@link useMapPopoverClick}.
|
|
135
310
|
*/
|
|
136
|
-
interface
|
|
137
|
-
/** The item
|
|
311
|
+
interface UseMapPopoverClickReturn<T> {
|
|
312
|
+
/** The item whose popover is open, or `null` when closed. */
|
|
138
313
|
activeItem: T | null;
|
|
139
|
-
/** Last non-null item — holds position stable during the close animation.
|
|
314
|
+
/** Last non-null item — holds position stable during the close animation. */
|
|
140
315
|
anchorItem: T | null;
|
|
141
|
-
/**
|
|
316
|
+
/** Open the popover for the given item. If another item is active, switches instantly. */
|
|
142
317
|
showItem: (item: T) => void;
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
|
|
318
|
+
/** Close the popover. */
|
|
319
|
+
close: () => void;
|
|
320
|
+
/**
|
|
321
|
+
* Returns event handler props for a pin.
|
|
322
|
+
* Always includes `onClick`; includes `onPointerEnter` when `hoverWhenOpen` is enabled.
|
|
323
|
+
* Spread onto the marker element or pass individual handlers.
|
|
324
|
+
*/
|
|
325
|
+
getInteractionProps: (item: T) => MapPinInteractionProps;
|
|
147
326
|
}
|
|
148
327
|
/**
|
|
149
|
-
* Manages
|
|
328
|
+
* Manages click-to-open state for a single map popover.
|
|
150
329
|
*
|
|
151
|
-
*
|
|
152
|
-
* `
|
|
153
|
-
*
|
|
330
|
+
* Designed for use with Google Maps `AdvancedMarker` — register `onClick`
|
|
331
|
+
* on the `AdvancedMarker` component (not on child DOM elements) to avoid the
|
|
332
|
+
* "Focusable child elements in AdvancedMarkerElement are not supported" warning.
|
|
154
333
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
334
|
+
* Pass `{ hoverWhenOpen: true }` to enable menubar-style interaction:
|
|
335
|
+
* the first pin requires a click, but subsequent pins switch on hover.
|
|
336
|
+
* Only mouse pointers trigger hover — touch is filtered out.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```tsx
|
|
340
|
+
* const { activeItem, anchorItem, showItem, close } = useMapPopoverClick<Pin>();
|
|
341
|
+
*
|
|
342
|
+
* <Map onClick={close}>
|
|
343
|
+
* <AdvancedMarker position={pin} onClick={() => showItem(pin)}>
|
|
344
|
+
* <MapGridPin dataHook="pin" value={pin.rank} />
|
|
345
|
+
* </AdvancedMarker>
|
|
346
|
+
* </Map>
|
|
347
|
+
*
|
|
348
|
+
* <MapPopover open={!!activeItem}>
|
|
349
|
+
* <MapPopoverAnchor ... />
|
|
350
|
+
* <MapPopoverContent dataHook="popover" onEscapeKeyDown={close}>
|
|
351
|
+
* {activeItem && <p>{activeItem.rank}</p>}
|
|
352
|
+
* </MapPopoverContent>
|
|
353
|
+
* </MapPopover>
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```tsx
|
|
358
|
+
* // With hoverWhenOpen — click first pin, then hover to switch
|
|
359
|
+
* const { activeItem, anchorItem, getInteractionProps, close } =
|
|
360
|
+
* useMapPopoverClick<Pin>({ hoverWhenOpen: true });
|
|
361
|
+
*
|
|
362
|
+
* <AdvancedMarker {...getInteractionProps(pin)}>
|
|
363
|
+
* <MapGridPin dataHook="pin" value={pin.rank} />
|
|
364
|
+
* </AdvancedMarker>
|
|
365
|
+
* ```
|
|
157
366
|
*/
|
|
158
|
-
declare function
|
|
367
|
+
declare function useMapPopoverClick<T>(options?: UseMapPopoverClickOptions): UseMapPopoverClickReturn<T>;
|
|
159
368
|
/**
|
|
160
369
|
* Controlled popover root for map UIs.
|
|
161
370
|
* Re-exports `Popover` so consumers import everything from the map module.
|
|
@@ -195,13 +404,17 @@ interface MapPopoverContentProps extends PopoverContentProps {
|
|
|
195
404
|
}
|
|
196
405
|
/**
|
|
197
406
|
* Popover content panel with map-specific defaults.
|
|
198
|
-
* Compact sizing (`w-auto p-3`), top placement, and focus
|
|
199
|
-
* for
|
|
407
|
+
* Compact sizing (`w-auto max-w-68.25 p-3` — sizes to content, max 273px), top placement, and auto-focus prevention
|
|
408
|
+
* for click-activated map popovers.
|
|
409
|
+
*
|
|
410
|
+
* Both `onOpenAutoFocus` and `onCloseAutoFocus` are prevented by default
|
|
411
|
+
* to keep focus on the map surface. Override via props if standard
|
|
412
|
+
* focus-return behavior is needed.
|
|
200
413
|
*
|
|
201
414
|
* Use inside a controlled `<MapPopover open={!!activeItem}>` together
|
|
202
|
-
* with `MapPopoverAnchor` and {@link
|
|
415
|
+
* with `MapPopoverAnchor` and {@link useMapPopoverClick}.
|
|
203
416
|
*/
|
|
204
417
|
declare const MapPopoverContent: React.ForwardRefExoticComponent<Omit<MapPopoverContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
205
|
-
export { MapTypeId, MapLocationPin, MapGridPin, MapControlButton, MapLoadingState, MapErrorState, MapLegend, MapPopover, MapPopoverAnchor, MapPopoverContent,
|
|
206
|
-
export type { MapTypeIdValue, MapLocationPinProps, MapGridPinProps, MapGridPinVariant, MapControlButtonProps, MapLoadingStateProps, MapErrorStateProps, MapLegendProps, MapPopoverProps, MapPopoverAnchorProps, MapPopoverContentProps,
|
|
418
|
+
export { MAP_STYLES, MapTypeId, MapLocationPin, MapGridPin, mapGridPinColorMap, MapControlButton, MapLoadingState, MapErrorState, MapLegend, MapLegendItem, MapPopover, MapPopoverAnchor, MapPopoverContent, useMapStyles, useMapPopoverClick, };
|
|
419
|
+
export type { MapStyleVariant, MapStyleRule, MapTypeIdValue, ResolvedVariant as MapPinVariant, MapLocationPinProps, MapGridPinProps, MapGridPinVariant, MapControlButtonProps, MapLoadingStateProps, MapErrorStateProps, MapLegendProps, MapLegendItemProps, MapPopoverProps, MapPopoverAnchorProps, MapPopoverContentProps, UseMapPopoverClickOptions, UseMapPopoverClickReturn, MapPinInteractionProps, };
|
|
207
420
|
//# sourceMappingURL=map.d.ts.map
|
package/dist/map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/components/map.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/components/map.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EACL,OAAO,EAGP,KAAK,YAAY,EACjB,KAAK,kBAAk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