@brightlocal/ui-components 2.14.0 → 2.16.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 +155 -13
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +20 -4
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +95 -72
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.js +33 -33
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +8 -2
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +24 -21
- 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 +326 -307
- 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 +402 -46
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +615 -184
- 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 +12 -2
- package/src/components/card.tsx +62 -8
- package/src/components/combobox.tsx +1 -1
- package/src/components/field.tsx +7 -1
- package/src/components/global-layout.tsx +4 -1
- package/src/components/list.tsx +8 -2
- package/src/components/map.tsx +1068 -135
- 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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,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 s=require("react/jsx-runtime"),N=require("react"),w=require("@brightlocal/icons"),u=require("@brightlocal/ui-components/button"),v=require("@brightlocal/ui-components/card"),p=require("@brightlocal/ui-components/lib/utils"),m=require("@brightlocal/ui-components/popover");function k(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const c=k(N),C={ROADMAP:"roadmap",SATELLITE:"satellite"},S={primary:"var(--primary)",secondary:"var(--secondary)",destructive:"var(--destructive)",outline:"var(--muted)",warning:"var(--warning-background)"},g=c.forwardRef(({value:t,variant:a="primary",pulse:e=!1,dataHook:r,className:n,trackingEl:o,trackingLabel:i,...l},d)=>s.jsx(u.Button,{ref:d,className:p.cn("size-8 p-0",e&&"animate-grid-pin-pulse transition-none motion-reduce:animate-none",n),dataHook:r,size:"sm",style:e?{"--grid-pin-pulse-color":S[a]}:void 0,trackingEl:o||"map-grid-pin",trackingLabel:i,variant:a,...l,children:String(t)}));g.displayName="MapGridPin";const x=c.forwardRef(({value:t=1,dataHook:a,...e},r)=>s.jsx(g,{ref:r,dataHook:a,value:t,...e}));x.displayName="MapLocationPin";const M=c.forwardRef(({className:t,dataHook:a,trackingEl:e,trackingLabel:r,children:n,...o},i)=>s.jsx(u.Button,{ref:i,className:p.cn("rounded-lg shadow-sm",t),"data-slot":"map-control-button",dataHook:a,trackingEl:e||"map-control-button",trackingLabel:r,variant:"outline",...o,children:n}));M.displayName="MapControlButton";const y=c.forwardRef(({className:t,message:a="Loading map…",dataHook:e,trackingEl:r,trackingLabel:n,...o},i)=>s.jsxs("div",{ref:i,"aria-live":"polite",className:p.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",t),"data-hook":e,"data-slot":"map-loading-state","data-tracking-el":r||"map-loading-state","data-tracking-label":n,role:"status",...o,children:[s.jsx("div",{"aria-hidden":"true",className:"size-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),a]}));y.displayName="MapLoadingState";const h=c.forwardRef(({className:t,title:a="Unable to load map",message:e="Something went wrong while loading the map. Please try again.",onRetry:r,dataHook:n,trackingEl:o,trackingLabel:i,...l},d)=>s.jsxs("div",{ref:d,className:p.cn("bg-muted/50 flex flex-col items-center justify-center gap-3 rounded-xl p-8 text-center",t),"data-hook":n,"data-slot":"map-error-state","data-tracking-el":o||"map-error-state","data-tracking-label":i,role:"alert",...l,children:[s.jsx(w.AlertCircle,{"aria-hidden":"true",className:"text-muted-foreground/60",size:40,strokeWidth:1.5}),s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h3",{className:"text-foreground text-sm font-semibold","data-slot":"map-error-title",children:a}),e&&s.jsx("p",{className:"text-muted-foreground max-w-xs text-xs","data-slot":"map-error-message",children:e})]}),r&&s.jsx(u.Button,{className:"mt-1",dataHook:`${n}-retry`,size:"sm",variant:"primary",onClick:r,children:"Try again"})]}));h.displayName="MapErrorState";const P=c.forwardRef(({className:t,dataHook:a,trackingEl:e,trackingLabel:r,children:n,...o},i)=>s.jsx(v.Card,{ref:i,className:p.cn("inline-flex w-auto flex-row items-center",t),"data-slot":"map-legend",dataHook:a,density:"condensed",maxWidth:"none",trackingEl:e||"map-legend",trackingLabel:r,variant:"filled",...o,children:s.jsx(v.CardContent,{className:"flex items-center gap-3",children:n})}));P.displayName="MapLegend";function L(t=150){const[a,e]=c.useState(null),[r,n]=c.useState(null),o=c.useRef(null),i=c.useCallback(f=>{o.current&&clearTimeout(o.current),n(f),e(f)},[]),l=c.useCallback(()=>{o.current&&clearTimeout(o.current),o.current=setTimeout(()=>e(null),t)},[t]),d=c.useCallback(()=>{o.current&&clearTimeout(o.current)},[]);return{activeItem:a,anchorItem:r,showItem:i,scheduleClose:l,cancelClose:d}}const R=m.Popover,b=m.PopoverAnchor;b.displayName="MapPopoverAnchor";const j=c.forwardRef(({className:t,side:a="top",sideOffset:e=4,dataHook:r,trackingEl:n,trackingLabel:o,...i},l)=>s.jsx(m.PopoverContent,{ref:l,className:p.cn("w-auto p-3 data-[state=closed]:animate-none data-[state=closed]:opacity-0",t),"data-slot":"map-popover-content","data-tracking-el":n||"map-popover","data-tracking-label":o,dataHook:r,side:a,sideOffset:e,onOpenAutoFocus:d=>d.preventDefault(),...i}));j.displayName="MapPopoverContent";exports.MapControlButton=M;exports.MapErrorState=h;exports.MapGridPin=g;exports.MapLegend=P;exports.MapLoadingState=y;exports.MapLocationPin=x;exports.MapPopover=R;exports.MapPopoverAnchor=b;exports.MapPopoverContent=j;exports.MapTypeId=C;exports.useMapPopoverHover=L;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),ae=require("react"),ne=require("class-variance-authority"),P=require("@brightlocal/icons"),R=require("@brightlocal/illustrations"),L=require("@brightlocal/ui-components/button"),T=require("@brightlocal/ui-components/card"),g=require("@brightlocal/ui-components/lib/utils"),j=require("@brightlocal/ui-components/popover");function oe(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 p=oe(ae),se={ROADMAP:"roadmap",SATELLITE:"satellite"},le=["water","landscape","road","poi","transit"];function ie(e,t){return[...le.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 E=[{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"}]}],A={default:{light:[],dark:E},muted:{light:ie(-40,20),dark:E}},k=new Set;let w=typeof document<"u"&&document.body.classList.contains("dark"),O=!1;function ce(){if(O||typeof document>"u")return;O=!0,new MutationObserver(()=>{const t=document.body.classList.contains("dark");if(t!==w){w=t;for(const a of k)a()}}).observe(document.body,{attributes:!0,attributeFilter:["class"]})}function de(e){return k.add(e),ce(),()=>{k.delete(e)}}function ue(){return w}function pe(){return!1}function I(){return p.useSyncExternalStore(de,ue,pe)}function me(e="default"){const t=I();return A[e][t?"dark":"light"]}const _={primary:"strong",secondary:"moderate",warning:"moderate",destructive:"unranked",outline:"unranked"};function fe(e){return e in _}function ge(e){return fe(e)?_[e]:e}const h={strong:{className:"bg-primary dark:bg-green-400",cssVar:"--ds-tailwind-colors-green-400",fallback:"#2ae855"},moderate:{className:"bg-chart-4",cssVar:"--ds-tailwind-colors-yellow-400",fallback:"#facc15"},weak:{className:"bg-orange-400",cssVar:"--ds-tailwind-colors-orange-400",fallback:"#fb923c"},unranked:{className:"bg-red-600",cssVar:"--ds-tailwind-colors-red-600",fallback:"#dc2626"},error:{className:"bg-warning-background dark:bg-orange-200",cssVar:"--ds-tailwind-colors-orange-200",fallback:"#fed7aa"}},y=Object.fromEntries(Object.entries(h).map(([e,t])=>[e,t.className])),ye=ne.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:`${y.strong}`,moderate:`${y.moderate}`,weak:`${y.weak}`,unranked:`${y.unranked} text-white dark:text-white`,error:`${y.error}`}},defaultVariants:{variant:"strong"}}),C=p.forwardRef(({value:e,variant:t="strong",loading:a=!1,pulse:n,dataHook:s,className:o,trackingEl:r,trackingLabel:c,style:i,...d},m)=>{const u=ge(t);return l.jsx("div",{ref:m,className:g.cn(a?"border-border bg-accent rounded-full border":ye({variant:u}),"size-8 p-0",o),"data-hook":s,"data-slot":"map-grid-pin","data-state":a?"loading":void 0,"data-tracking-el":r||"map-grid-pin","data-tracking-label":c,style:i,...d,children:u==="error"&&!a?l.jsx(P.TriangleAlert,{"aria-hidden":"true",className:"text-warning-foreground",size:14}):String(e)})});C.displayName="MapGridPin";function D(){const t={colors:Object.fromEntries(Object.entries(h).map(([n,s])=>[n,s.fallback])),fontFamily:"Inter, system-ui, sans-serif",textColor:"#111412"};if(typeof document>"u")return t;const a=getComputedStyle(document.documentElement);return{colors:Object.fromEntries(Object.entries(h).map(([n,{cssVar:s,fallback:o}])=>[n,a.getPropertyValue(s).trim()||o])),fontFamily:a.getPropertyValue("--ds-font-font-sans").trim()||t.fontFamily,textColor:a.getPropertyValue("--ds-tailwind-colors-neutral-950").trim()||t.textColor}}function xe(){return D().colors}const be=Object.fromEntries(Object.entries(h).map(([e,t])=>[e,t.fallback])),M=["strong","moderate","weak","unranked","error"];function N(e,t){const{colors:a,fontFamily:n,textColor:s}=D(),o=40,r=o/2,c=2,i=r-c,d=i*.55,u=[...e].sort((f,x)=>M.indexOf(f.variant)-M.indexOf(x.variant)).filter(f=>f.count>0),W=u.reduce((f,x)=>f+x.count,0)||1,Z=Math.max(Number(t)||0,1);let b;const S=u[0];if(u.length<=1){const f=S?a[S.variant]:"#e5e7eb";b=`<circle cx="${r}" cy="${r}" r="${i}" fill="${f}"/>`}else{b="";let f=-Math.PI/2;for(const x of u){const $=x.count/W*Math.PI*2,v=f+$,Q=r+i*Math.cos(f),X=r+i*Math.sin(f),ee=r+i*Math.cos(v),te=r+i*Math.sin(v),re=$>Math.PI?1:0;b+=`<path d="M${r},${r}L${Q.toFixed(2)},${X.toFixed(2)}A${i},${i} 0 ${re} 1 ${ee.toFixed(2)},${te.toFixed(2)}Z" fill="${a[x.variant]}"/>`,f=v}}const J=Math.round(o*.3);return[`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${o}" viewBox="0 0 ${o} ${o}" style="filter:drop-shadow(0 1px 2px rgba(0,0,0,.15))">`,`<circle cx="${r}" cy="${r}" r="${r}" fill="white"/>`,b,`<circle cx="${r}" cy="${r}" r="${i}" fill="none" stroke="white" stroke-width="${c}"/>`,`<circle cx="${r}" cy="${r}" r="${d}" fill="white"/>`,`<text x="${r}" y="${r}" text-anchor="middle" dominant-baseline="central" font-family="${n}" font-size="${J}" font-weight="600" fill="${s}">${Z}</text>`,"</svg>"].join("")}function he(e){if(typeof DOMParser>"u")throw new Error("createClusterPinElement requires a browser environment (DOMParser). Use createClusterPinSvg for SSR.");const{markers:t,count:a,getVariant:n}=e,s=new Map;for(const m of t){const u=n(m);s.set(u,(s.get(u)??0)+1)}const o=[];for(const m of M){const u=s.get(m);u&&o.push({variant:m,count:u})}const r=N(o,a),d=new DOMParser().parseFromString(r,"image/svg+xml").documentElement;if(!(d instanceof SVGElement))throw new Error("createClusterPinElement: failed to parse SVG");return d}const V=p.forwardRef(({segments:e,count:t,dataHook:a,className:n,trackingEl:s,trackingLabel:o,...r},c)=>{const i=JSON.stringify(e),d=p.useMemo(()=>N(e,t),[i,t]);return l.jsx("div",{dangerouslySetInnerHTML:{__html:d},ref:c,className:g.cn("inline-flex items-center justify-center",n),"data-hook":a,"data-slot":"map-cluster-pin","data-tracking-el":s||"map-cluster-pin","data-tracking-label":o,...r})});V.displayName="MapClusterPin";const F=p.forwardRef(({icon:e,animateIn:t=!1,value:a,variant:n,pulse:s,dataHook:o,className:r,trackingEl:c,trackingLabel:i,ariaLabel:d,...m},u)=>a!==void 0||n!==void 0||s!==void 0?l.jsx(C,{ref:u,className:r,dataHook:o,pulse:s,trackingEl:c,trackingLabel:i,value:a??1,variant:n,...m}):l.jsx("div",{ref:u,"aria-label":d??"Location",className:g.cn("relative inline-flex h-[46px] w-[38px] items-start justify-center",r),"data-hook":o,"data-slot":"map-location-pin","data-tracking-el":c||"map-location-pin","data-tracking-label":i,role:"img",...m,children:l.jsxs("span",{"aria-hidden":"true",className:g.cn("relative flex size-full",t&&"animate-pop-in origin-bottom will-change-transform motion-reduce:animate-none"),children:[l.jsxs("svg",{"aria-hidden":"true",className:"size-full overflow-visible drop-shadow-sm",fill:"none",viewBox:"0 0 38 46",children:[l.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"}),l.jsx("circle",{className:"fill-sky-500",cx:"19",cy:"19",r:"16"})]}),l.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??l.jsx(P.Store,{size:16})})]})}));F.displayName="MapLocationPin";const z=p.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:n,children:s,iconOnly:o=!0,...r},c)=>{const i=I();return l.jsx(L.Button,{ref:c,className:e,"data-slot":"map-control-button",dataHook:t,iconOnly:o,trackingEl:a||"map-control-button",trackingLabel:n,variant:i?"secondary":"outline",...r,children:s})});z.displayName="MapControlButton";const q=p.forwardRef(({className:e,children:t,dataHook:a,trackingEl:n,trackingLabel:s,ariaLabel:o,...r},c)=>l.jsxs("div",{ref:c,"aria-label":o??"Loading map",className:g.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",...r,children:[l.jsx(B,{}),t&&l.jsx("div",{className:"relative",children:t})]}));q.displayName="MapLoadingState";const B=p.memo(function({rounded:t}){return l.jsx(R.MapBackground,{"aria-hidden":"true",className:g.cn("absolute inset-0 h-full w-full object-cover",t&&"rounded-[inherit]"),mode:"auto"})}),G=p.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:o="Reload",dataHook:r,trackingEl:c,trackingLabel:i,...d},m)=>l.jsxs("div",{ref:m,className:g.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":r,"data-slot":"map-error-state","data-tracking-el":c||"map-error-state","data-tracking-label":i,role:"alert",...d,children:[l.jsx(B,{rounded:!0}),l.jsxs("div",{className:"relative flex flex-col items-center gap-4 sm:gap-6",children:[l.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center","data-slot":"map-error-illustration",children:l.jsx(R.GlobeyFixingFault,{className:"h-auto w-full max-w-41"})}),l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("h3",{className:"text-foreground text-lg font-medium","data-slot":"map-error-title",children:t}),a&&l.jsx("p",{className:"text-muted-foreground text-sm","data-slot":"map-error-message",children:a})]}),n&&l.jsxs(L.Button,{className:"mt-1",dataHook:`${r}-retry`,loading:s,size:"sm",variant:"primary",onClick:n,children:[!s&&l.jsx(P.RefreshCw,{"aria-hidden":"true"}),o]})]})]}));G.displayName="MapErrorState";const K=p.forwardRef(({variant:e,color:t,dataHook:a,className:n,children:s,...o},r)=>{const c=e?y[e]:t;return l.jsxs("span",{ref:r,className:g.cn("text-foreground flex items-center gap-1 font-sans text-xs",n),"data-hook":a,"data-slot":"map-legend-item",...o,children:[l.jsx("span",{"aria-hidden":"true",className:g.cn("inline-block size-2 shrink-0 rounded-full",c)}),s]})});K.displayName="MapLegendItem";const Y=p.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:n,ariaLabel:s,children:o,...r},c)=>l.jsx(T.Card,{ref:c,"aria-label":s??"Map legend",className:g.cn("inline-flex w-auto max-w-none flex-row items-center bg-white font-sans dark:bg-neutral-800",e),"data-slot":"map-legend",dataHook:t,density:"condensed",role:"group",trackingEl:a||"map-legend",trackingLabel:n,variant:"border",...r,children:l.jsx(T.CardContent,{className:"flex items-center gap-3",children:o})}));Y.displayName="MapLegend";function ve(e){const{hoverWhenOpen:t=!1}=e??{},[a,n]=p.useState(null),[s,o]=p.useState(null),r=p.useCallback(d=>{o(d),n(d)},[]),c=p.useCallback(()=>{n(null)},[]),i=p.useCallback(d=>{const m={onClick:()=>r(d)};return t&&(m.onPointerEnter=u=>{u.pointerType==="mouse"&&a!=null&&r(d)}),m},[t,r,a]);return{activeItem:a,anchorItem:s,showItem:r,close:c,getInteractionProps:i}}const ke=j.Popover,H=j.PopoverAnchor;H.displayName="MapPopoverAnchor";const U=p.forwardRef(({className:e,side:t="top",sideOffset:a=4,dataHook:n,trackingEl:s,trackingLabel:o,...r},c)=>l.jsx(j.PopoverContent,{ref:c,className:g.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":o,dataHook:n,side:t,sideOffset:a,onCloseAutoFocus:i=>i.preventDefault(),onOpenAutoFocus:i=>i.preventDefault(),...r}));U.displayName="MapPopoverContent";exports.MAP_STYLES=A;exports.MapClusterPin=V;exports.MapControlButton=z;exports.MapErrorState=G;exports.MapGridPin=C;exports.MapLegend=Y;exports.MapLegendItem=K;exports.MapLoadingState=q;exports.MapLocationPin=F;exports.MapPopover=ke;exports.MapPopoverAnchor=H;exports.MapPopoverContent=U;exports.MapTypeId=se;exports.clusterPinHexColors=be;exports.createClusterPinElement=he;exports.createClusterPinSvg=N;exports.mapGridPinColorMap=y;exports.resolveClusterPinColors=xe;exports.useMapPopoverClick=ve;exports.useMapStyles=me;
|