@brightlocal/ui-components 2.17.1 → 2.18.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 +83 -1
- package/component-meta.json +20 -7
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +23 -2
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +21 -19
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +64 -63
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +22 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +93 -72
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +1 -7
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +23 -3
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +44 -42
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +10 -0
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +30 -29
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +5 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +9 -7
- package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
- package/dist/hooks/use-prefers-reduced-motion.d.ts +25 -2
- package/dist/hooks/use-prefers-reduced-motion.d.ts.map +1 -1
- package/dist/hooks/use-prefers-reduced-motion.js +17 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +38 -37
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +13 -2
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +110 -53
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +26 -25
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +17 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +29 -27
- package/package.json +3 -3
- package/src/blocks/input-list.tsx +8 -1
- package/src/components/alert-dialog.tsx +38 -4
- package/src/components/card.tsx +56 -9
- package/src/components/chip.tsx +1 -4
- package/src/components/dialog.tsx +39 -6
- package/src/components/dropdown-menu.tsx +7 -1
- package/src/components/field.tsx +6 -0
- package/src/components/link.tsx +103 -27
- package/src/components/map.tsx +1 -2
- package/src/components/progress.tsx +12 -6
- package/src/components/sheet.tsx +30 -5
- package/src/hooks/use-prefers-reduced-motion.ts +35 -5
package/dist/index.js
CHANGED
|
@@ -68,10 +68,10 @@ import { InputList as ap, InputListAddButton as np, InputListInput as ip, InputL
|
|
|
68
68
|
import { Sidebar as dp, SidebarAccountDropdown as bp, SidebarCollapseIcon as Cp, SidebarCollapseIconType as mp, SidebarCollapsible as Sp, SidebarContent as gp, SidebarDrawer as sp, SidebarFooter as xp, SidebarGroup as Tp, SidebarGroupAction as cp, SidebarGroupContent as Mp, SidebarGroupLabel as Dp, SidebarGroupLabelSize as Ip, SidebarGroupLabelVariant as fp, SidebarHeader as Pp, SidebarHeaderButton as Lp, SidebarInboxItem as hp, SidebarInput as yp, SidebarInset as Ap, SidebarMenu as wp, SidebarMenuAction as Bp, SidebarMenuBadge as Gp, SidebarMenuButton as vp, SidebarMenuButtonSize as Rp, SidebarMenuButtonVariant as Hp, SidebarMenuCollapsible as kp, SidebarMenuCollapsibleContent as Vp, SidebarMenuCollapsibleTrigger as Ep, SidebarMenuItem as Fp, SidebarMenuSkeleton as Np, SidebarMenuSub as Op, SidebarMenuSubButton as _p, SidebarMenuSubButtonSize as zp, SidebarMenuSubItem as Yp, SidebarMenuSubVariant as Wp, SidebarPopoverMenu as Xp, SidebarPopoverMenuItem as Up, SidebarPopoverTrigger as qp, SidebarProvider as jp, SidebarRail as Jp, SidebarSeparator as Kp, SidebarSide as Qp, SidebarSwitcher as Zp, SidebarTrigger as $p, SidebarVariant as el, useSidebar as ol } from "./blocks/sidebar.js";
|
|
69
69
|
import { useDebounce as tl } from "./hooks/use-debounce.js";
|
|
70
70
|
import { getBreakpointValue as nl, getBreakpointValue as il, isBelowBreakpoint as pl, isBelowBreakpoint as ll, useIsBelowBreakpoint as ul, useIsBelowBreakpoint as dl } from "./hooks/use-breakpoint.js";
|
|
71
|
-
import {
|
|
72
|
-
import { cn as
|
|
73
|
-
import { Area as
|
|
74
|
-
import { REGEXP_ONLY_CHARS as
|
|
71
|
+
import { ReducedMotionOverrideContext as Cl, usePrefersReducedMotion as ml } from "./hooks/use-prefers-reduced-motion.js";
|
|
72
|
+
import { cn as gl } from "./lib/utils.js";
|
|
73
|
+
import { Area as xl, AreaChart as Tl, Bar as cl, BarChart as Ml, CartesianGrid as Dl, Cell as Il, Label as fl, Legend as Pl, Tooltip as Ll, Customized as hl, LabelList as yl, Line as Al, LineChart as wl, Pie as Bl, PieChart as Gl, PolarAngleAxis as vl, PolarGrid as Rl, PolarRadiusAxis as Hl, Radar as kl, RadarChart as Vl, RadialBar as El, RadialBarChart as Fl, Rectangle as Nl, ReferenceLine as Ol, ResponsiveContainer as _l, Sector as zl, XAxis as Yl, YAxis as Wl } from "recharts";
|
|
74
|
+
import { REGEXP_ONLY_CHARS as Ul, REGEXP_ONLY_DIGITS as ql, REGEXP_ONLY_DIGITS_AND_CHARS as jl } from "input-otp";
|
|
75
75
|
export {
|
|
76
76
|
r as Accordion,
|
|
77
77
|
t as AccordionContent,
|
|
@@ -95,15 +95,15 @@ export {
|
|
|
95
95
|
b as AlertSuccess,
|
|
96
96
|
C as AlertTitle,
|
|
97
97
|
m as AlertWarning,
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
xl as Area,
|
|
99
|
+
Tl as AreaChart,
|
|
100
100
|
A as AspectRatio,
|
|
101
101
|
B as Avatar,
|
|
102
102
|
G as AvatarFallback,
|
|
103
103
|
v as AvatarImage,
|
|
104
104
|
H as Badge,
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
cl as Bar,
|
|
106
|
+
Ml as BarChart,
|
|
107
107
|
V as Breadcrumb,
|
|
108
108
|
E as BreadcrumbEllipsis,
|
|
109
109
|
F as BreadcrumbItem,
|
|
@@ -132,20 +132,20 @@ export {
|
|
|
132
132
|
me as CarouselItem,
|
|
133
133
|
Se as CarouselNext,
|
|
134
134
|
ge as CarouselPrevious,
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
Dl as CartesianGrid,
|
|
136
|
+
Il as Cell,
|
|
137
137
|
Pe as CentredLayout,
|
|
138
138
|
Le as CentredLayoutContent,
|
|
139
139
|
he as CentredLayoutHeader,
|
|
140
140
|
xe as ChartContainer,
|
|
141
|
-
|
|
141
|
+
fl as ChartLabel,
|
|
142
142
|
Te as ChartLegend,
|
|
143
143
|
ce as ChartLegendContent,
|
|
144
144
|
Me as ChartStyle,
|
|
145
145
|
De as ChartTooltip,
|
|
146
146
|
Ie as ChartTooltipContent,
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
Pl as ChartsLegend,
|
|
148
|
+
Ll as ChartsTooltip,
|
|
149
149
|
Ae as Checkbox,
|
|
150
150
|
Be as Chip,
|
|
151
151
|
Re as Collapsible,
|
|
@@ -188,7 +188,7 @@ export {
|
|
|
188
188
|
yo as ContextMenuSubContent,
|
|
189
189
|
Ao as ContextMenuSubTrigger,
|
|
190
190
|
wo as ContextMenuTrigger,
|
|
191
|
-
|
|
191
|
+
hl as Customized,
|
|
192
192
|
po as DEFAULT_DATE_PRESETS,
|
|
193
193
|
va as DEFAULT_STRENGTH_LEVELS,
|
|
194
194
|
Wi as DataTable,
|
|
@@ -297,9 +297,9 @@ export {
|
|
|
297
297
|
Pt as ItemSubheader,
|
|
298
298
|
Lt as ItemTitle,
|
|
299
299
|
St as Label,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
yl as LabelList,
|
|
301
|
+
Al as Line,
|
|
302
|
+
wl as LineChart,
|
|
303
303
|
xt as Link,
|
|
304
304
|
ht as List,
|
|
305
305
|
wt as Logo,
|
|
@@ -346,35 +346,36 @@ export {
|
|
|
346
346
|
ya as PaginationLink,
|
|
347
347
|
Aa as PaginationNext,
|
|
348
348
|
wa as PaginationPrevious,
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
349
|
+
Bl as Pie,
|
|
350
|
+
Gl as PieChart,
|
|
351
|
+
vl as PolarAngleAxis,
|
|
352
|
+
Rl as PolarGrid,
|
|
353
|
+
Hl as PolarRadiusAxis,
|
|
354
354
|
Na as Popover,
|
|
355
355
|
Oa as PopoverAnchor,
|
|
356
356
|
_a as PopoverContent,
|
|
357
357
|
za as PopoverTrigger,
|
|
358
358
|
Wa as Progress,
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
359
|
+
Ul as REGEXP_ONLY_CHARS,
|
|
360
|
+
ql as REGEXP_ONLY_DIGITS,
|
|
361
|
+
jl as REGEXP_ONLY_DIGITS_AND_CHARS,
|
|
362
|
+
kl as Radar,
|
|
363
|
+
Vl as RadarChart,
|
|
364
|
+
El as RadialBar,
|
|
365
|
+
Fl as RadialBarChart,
|
|
366
366
|
Ua as RadioGroup,
|
|
367
367
|
qa as RadioGroupItem,
|
|
368
368
|
Ja as Rating,
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
Nl as Rectangle,
|
|
370
|
+
Cl as ReducedMotionOverrideContext,
|
|
371
|
+
Ol as ReferenceLine,
|
|
371
372
|
Qa as ResizableHandle,
|
|
372
373
|
Za as ResizablePanel,
|
|
373
374
|
$a as ResizablePanelGroup,
|
|
374
|
-
|
|
375
|
+
_l as ResponsiveContainer,
|
|
375
376
|
on as ScrollArea,
|
|
376
377
|
rn as ScrollBar,
|
|
377
|
-
|
|
378
|
+
zl as Sector,
|
|
378
379
|
an as Select,
|
|
379
380
|
nn as SelectContent,
|
|
380
381
|
pn as SelectGroup,
|
|
@@ -495,14 +496,14 @@ export {
|
|
|
495
496
|
_i as TypographyP,
|
|
496
497
|
zi as TypographySmall,
|
|
497
498
|
op as VirtualizedDataTable,
|
|
498
|
-
|
|
499
|
-
|
|
499
|
+
Yl as XAxis,
|
|
500
|
+
Wl as YAxis,
|
|
500
501
|
S as alertVariants,
|
|
501
502
|
Ea as calculatePasswordStrength,
|
|
502
503
|
$ as calloutVariants,
|
|
503
504
|
Ge as chipVariants,
|
|
504
505
|
Wt as clusterPinHexColors,
|
|
505
|
-
|
|
506
|
+
gl as cn,
|
|
506
507
|
Xt as createClusterPinElement,
|
|
507
508
|
Ut as createClusterPinSvg,
|
|
508
509
|
Ar as fieldLegendVariants,
|
|
@@ -528,6 +529,6 @@ export {
|
|
|
528
529
|
Jt as useMapPopoverClick,
|
|
529
530
|
Kt as useMapStyles,
|
|
530
531
|
Ba as usePagination,
|
|
531
|
-
|
|
532
|
+
ml as usePrefersReducedMotion,
|
|
532
533
|
ol as useSidebar
|
|
533
534
|
};
|
package/dist/link.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 o=require("react/jsx-runtime"),h=require("react"),y=require("@brightlocal/icons"),c=require("@radix-ui/react-slot"),m=require("class-variance-authority"),j=require("@brightlocal/ui-components/lib/utils");function S(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const w=S(h),i=["justify-center","h-9","px-4","py-2","rounded-full","text-sm","font-semibold","no-underline","whitespace-nowrap","shrink-0","[&_svg]:pointer-events-none","[&_svg]:shrink-0","transition-[color,background-color,border-color,box-shadow]","duration-150","ease-in-out","focus-visible:shadow-default"],q=m.cva(["inline-flex","items-center","gap-2","cursor-pointer","outline-none"],{variants:{variant:{inline:["rounded-sm","text-link","dark:text-link-dark","no-underline","hover:underline","hover:underline-offset-4","active:text-link/80","visited:text-link-visited","visited:dark:text-link-visited-dark","transition-[text-decoration,text-decoration-color,text-underline-offset,color]","duration-300","focus-visible:shadow-default"],filled:[...i,"bg-secondary","text-secondary-foreground","hover:bg-secondary/80"],outline:[...i,"border","border-input","border-solid","bg-background","text-foreground","hover:bg-accent","hover:text-accent-foreground","dark:bg-input/30","dark:border-input","dark:hover:bg-input/50","dark:hover:border-input"],ghost:[...i,"bg-transparent","text-foreground","hover:bg-accent"]}},defaultVariants:{variant:"inline"}}),u=w.forwardRef(({className:e,variant:t="inline",dataHook:n,trackingEl:r,trackingLabel:f,asChild:b=!1,external:a=!1,showExternalIcon:k=!0,children:s,...g},p)=>{const x=a?{target:"_blank",rel:"noopener noreferrer"}:{},v=t==="inline"?"link-default":`link-${t}`,l={ref:p,className:j.cn(q({variant:t}),e),"data-hook":n,"data-slot":"link","data-tracking-el":r||v,"data-tracking-label":f,...x,...g},d=a&&k&&o.jsx(y.ExternalLink,{"aria-hidden":"true","data-slot":"external-icon"});return b?o.jsxs(c.Slot,{...l,children:[o.jsx(c.Slottable,{children:s}),d]}):o.jsxs("a",{...l,children:[s,d]})});u.displayName="Link";exports.Link=u;
|
package/dist/link.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
declare const linkVariants: (props?:
|
|
4
|
-
|
|
3
|
+
declare const linkVariants: (props?: ({
|
|
4
|
+
variant?: "inline" | "ghost" | "filled" | "outline" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
/** Supported visual style variants for the Link component. */
|
|
7
|
+
export type LinkVariant = NonNullable<VariantProps<typeof linkVariants>["variant"]>;
|
|
8
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
5
9
|
/**
|
|
6
10
|
* Data hook for automated testing (REQUIRED)
|
|
7
11
|
*/
|
|
8
12
|
dataHook: string;
|
|
13
|
+
/**
|
|
14
|
+
* Visual style variant. `inline` renders a standard text link; `filled`,
|
|
15
|
+
* `outline` and `ghost` render button-styled treatments for inline actions
|
|
16
|
+
* and high-priority navigation.
|
|
17
|
+
* @default "inline"
|
|
18
|
+
*/
|
|
19
|
+
variant?: LinkVariant;
|
|
9
20
|
/**
|
|
10
21
|
* Tracking element identifier for analytics
|
|
11
22
|
*/
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AA0BlE,QAAA,MAAM,YAAY;;8EA6DjB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,MAAM,WAAW,GAAG,WAAW,CACnC,YAAY,CAAC,OAAO,YAAY,CAAC,CAAC,SAAS,CAAC,CAC7C,CAAC;AAEF,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC9E;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,IAAI,qFAwDT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
package/dist/link.js
CHANGED
|
@@ -1,63 +1,120 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { ExternalLink as
|
|
4
|
-
import { Slot as
|
|
5
|
-
import { cva as
|
|
6
|
-
import { cn as
|
|
7
|
-
const
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
1
|
+
import { jsxs as a, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import * as h from "react";
|
|
3
|
+
import { ExternalLink as v } from "@brightlocal/icons";
|
|
4
|
+
import { Slot as m, Slottable as y } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva as w } from "class-variance-authority";
|
|
6
|
+
import { cn as j } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
const r = [
|
|
8
|
+
"justify-center",
|
|
9
|
+
"h-9",
|
|
10
|
+
"px-4",
|
|
11
|
+
"py-2",
|
|
12
|
+
"rounded-full",
|
|
13
|
+
"text-sm",
|
|
14
|
+
"font-semibold",
|
|
15
15
|
"no-underline",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"duration-300",
|
|
24
|
-
"cursor-pointer",
|
|
25
|
-
// Focus state
|
|
26
|
-
"rounded-sm",
|
|
27
|
-
"outline-none",
|
|
16
|
+
"whitespace-nowrap",
|
|
17
|
+
"shrink-0",
|
|
18
|
+
"[&_svg]:pointer-events-none",
|
|
19
|
+
"[&_svg]:shrink-0",
|
|
20
|
+
"transition-[color,background-color,border-color,box-shadow]",
|
|
21
|
+
"duration-150",
|
|
22
|
+
"ease-in-out",
|
|
28
23
|
"focus-visible:shadow-default"
|
|
29
|
-
]
|
|
24
|
+
], L = w(
|
|
25
|
+
// `gap-2` (spacing/2) keeps the icon–text gap consistent across all variants.
|
|
26
|
+
["inline-flex", "items-center", "gap-2", "cursor-pointer", "outline-none"],
|
|
27
|
+
{
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
// Inline text link (default) — the original Link styling.
|
|
31
|
+
inline: [
|
|
32
|
+
"rounded-sm",
|
|
33
|
+
// Color tokens (light mode: #2563EB, dark mode: #3B82F6)
|
|
34
|
+
"text-link",
|
|
35
|
+
"dark:text-link-dark",
|
|
36
|
+
// States
|
|
37
|
+
"no-underline",
|
|
38
|
+
"hover:underline",
|
|
39
|
+
"hover:underline-offset-4",
|
|
40
|
+
"active:text-link/80",
|
|
41
|
+
"visited:text-link-visited",
|
|
42
|
+
"visited:dark:text-link-visited-dark",
|
|
43
|
+
// Transitions
|
|
44
|
+
"transition-[text-decoration,text-decoration-color,text-underline-offset,color]",
|
|
45
|
+
"duration-300",
|
|
46
|
+
// Focus state
|
|
47
|
+
"focus-visible:shadow-default"
|
|
48
|
+
],
|
|
49
|
+
// Button-styled, filled (maps to Button `secondary`).
|
|
50
|
+
filled: [
|
|
51
|
+
...r,
|
|
52
|
+
"bg-secondary",
|
|
53
|
+
"text-secondary-foreground",
|
|
54
|
+
"hover:bg-secondary/80"
|
|
55
|
+
],
|
|
56
|
+
// Button-styled, bordered. Uses the `input` border token in both modes
|
|
57
|
+
// and keeps that border on focus (focus is the shared shadow ring only).
|
|
58
|
+
outline: [
|
|
59
|
+
...r,
|
|
60
|
+
"border",
|
|
61
|
+
"border-input",
|
|
62
|
+
"border-solid",
|
|
63
|
+
"bg-background",
|
|
64
|
+
"text-foreground",
|
|
65
|
+
"hover:bg-accent",
|
|
66
|
+
"hover:text-accent-foreground",
|
|
67
|
+
"dark:bg-input/30",
|
|
68
|
+
"dark:border-input",
|
|
69
|
+
"dark:hover:bg-input/50",
|
|
70
|
+
"dark:hover:border-input"
|
|
71
|
+
],
|
|
72
|
+
// Button-styled, transparent (maps to Button `ghost`).
|
|
73
|
+
ghost: [
|
|
74
|
+
...r,
|
|
75
|
+
"bg-transparent",
|
|
76
|
+
"text-foreground",
|
|
77
|
+
"hover:bg-accent"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
defaultVariants: {
|
|
82
|
+
variant: "inline"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
), S = h.forwardRef(
|
|
30
86
|
({
|
|
31
|
-
className:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
87
|
+
className: l,
|
|
88
|
+
variant: e = "inline",
|
|
89
|
+
dataHook: s,
|
|
90
|
+
trackingEl: c,
|
|
91
|
+
trackingLabel: u,
|
|
92
|
+
asChild: f = !1,
|
|
36
93
|
external: t = !1,
|
|
37
|
-
showExternalIcon:
|
|
38
|
-
children:
|
|
39
|
-
...
|
|
40
|
-
},
|
|
41
|
-
const
|
|
42
|
-
ref:
|
|
43
|
-
className:
|
|
44
|
-
"data-hook":
|
|
94
|
+
showExternalIcon: k = !0,
|
|
95
|
+
children: n,
|
|
96
|
+
...b
|
|
97
|
+
}, p) => {
|
|
98
|
+
const g = t ? { target: "_blank", rel: "noopener noreferrer" } : {}, x = e === "inline" ? "link-default" : `link-${e}`, o = {
|
|
99
|
+
ref: p,
|
|
100
|
+
className: j(L({ variant: e }), l),
|
|
101
|
+
"data-hook": s,
|
|
45
102
|
"data-slot": "link",
|
|
46
|
-
"data-tracking-el":
|
|
47
|
-
"data-tracking-label":
|
|
48
|
-
...
|
|
49
|
-
...
|
|
50
|
-
},
|
|
51
|
-
return
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
] }) : /* @__PURE__ */
|
|
55
|
-
|
|
56
|
-
|
|
103
|
+
"data-tracking-el": c || x,
|
|
104
|
+
"data-tracking-label": u,
|
|
105
|
+
...g,
|
|
106
|
+
...b
|
|
107
|
+
}, i = t && k && /* @__PURE__ */ d(v, { "aria-hidden": "true", "data-slot": "external-icon" });
|
|
108
|
+
return f ? /* @__PURE__ */ a(m, { ...o, children: [
|
|
109
|
+
/* @__PURE__ */ d(y, { children: n }),
|
|
110
|
+
i
|
|
111
|
+
] }) : /* @__PURE__ */ a("a", { ...o, children: [
|
|
112
|
+
n,
|
|
113
|
+
i
|
|
57
114
|
] });
|
|
58
115
|
}
|
|
59
116
|
);
|
|
60
|
-
|
|
117
|
+
S.displayName = "Link";
|
|
61
118
|
export {
|
|
62
|
-
|
|
119
|
+
S as Link
|
|
63
120
|
};
|
package/dist/map.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"),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;
|
package/dist/map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAM5C;;;;GAIG;AACH,QAAA,MAAM,SAAS;IACb,4BAA4B;;IAE5B,gFAAgF;;CAExE,CAAC;AAEX;;GAEG;AACH,KAAK,cAAc,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAMjE;;;;GAIG;AACH,KAAK,eAAe,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3C;;;;GAIG;AACH,KAAK,YAAY,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC5C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ACd,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,SAAS,EACT,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,GACnB,CAAC;AAEF,YAAY,EACV,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe,IAAI,aAAa,EAChC,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,8BAA8B,EAC9B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,GACvB,CAAC"}
|
package/dist/map.js
CHANGED
|
@@ -365,7 +365,7 @@ const ue = u.forwardRef(
|
|
|
365
365
|
"aria-hidden": "true",
|
|
366
366
|
className: g(
|
|
367
367
|
"relative flex size-full",
|
|
368
|
-
t && "animate-pop-in origin-bottom will-change-transform
|
|
368
|
+
t && "animate-pop-in origin-bottom will-change-transform"
|
|
369
369
|
),
|
|
370
370
|
children: [
|
|
371
371
|
/* @__PURE__ */ y(
|
package/dist/progress.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),v=require("react"),x=require("@radix-ui/react-progress"),R=require("framer-motion"),i=require("@brightlocal/ui-components/lib/utils"),w=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion");function g(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=g(v),f=g(x),m=u.forwardRef(({className:e,value:t,dataHook:r,trackingEl:a,trackingLabel:p,ariaLabel:b="Progress",label:o,indicatorClassName:P,disabled:l,...j},y)=>{const c=u.useId(),n=!!o,h=w.usePrefersReducedMotion(),d=s.jsx(f.Root,{ref:y,"aria-label":n?void 0:b,"aria-labelledby":n?c:void 0,className:i.cn("relative h-2 w-full overflow-hidden rounded-full","bg-primary/20",!n&&l&&"opacity-50",e),"data-hook":r,"data-slot":"progress","data-tracking-el":a,"data-tracking-label":p,...j,children:s.jsx(f.Indicator,{asChild:!0,children:s.jsx(R.motion.div,{animate:{transform:`translateX(-${100-(t||0)}%)`},className:i.cn("h-full w-full flex-1 bg-green-400",P),"data-slot":"progress-indicator",initial:!1,transition:h?{duration:0}:{type:"spring",stiffness:80,damping:20,mass:1}})})});return o?s.jsxs("div",{className:i.cn("flex w-full items-center gap-2",l&&"opacity-50"),"data-slot":"progress-wrapper",children:[s.jsx("span",{className:"text-foreground text-sm leading-normal font-medium","data-slot":"progress-label",id:c,children:o}),d]}):d});m.displayName="Progress";exports.Progress=m;
|
package/dist/progress.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAM9D;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,QAAQ,mGAyFb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/progress.js
CHANGED
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as x } from "react/jsx-runtime";
|
|
2
2
|
import * as l from "react";
|
|
3
3
|
import * as n from "@radix-ui/react-progress";
|
|
4
|
-
import { motion as
|
|
5
|
-
import { cn as
|
|
6
|
-
|
|
4
|
+
import { motion as w } from "framer-motion";
|
|
5
|
+
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { usePrefersReducedMotion as y } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
7
|
+
const P = l.forwardRef(
|
|
7
8
|
({
|
|
8
9
|
className: d,
|
|
9
10
|
value: m,
|
|
10
11
|
dataHook: f,
|
|
11
|
-
trackingEl:
|
|
12
|
-
trackingLabel:
|
|
12
|
+
trackingEl: c,
|
|
13
|
+
trackingLabel: p,
|
|
13
14
|
ariaLabel: g = "Progress",
|
|
14
|
-
label:
|
|
15
|
+
label: e,
|
|
15
16
|
indicatorClassName: u,
|
|
16
|
-
disabled:
|
|
17
|
+
disabled: o,
|
|
17
18
|
...h
|
|
18
19
|
}, b) => {
|
|
19
|
-
const
|
|
20
|
+
const t = l.useId(), a = !!e, v = y(), i = /* @__PURE__ */ r(
|
|
20
21
|
n.Root,
|
|
21
22
|
{
|
|
22
23
|
ref: b,
|
|
23
|
-
"aria-label":
|
|
24
|
-
"aria-labelledby":
|
|
25
|
-
className:
|
|
24
|
+
"aria-label": a ? void 0 : g,
|
|
25
|
+
"aria-labelledby": a ? t : void 0,
|
|
26
|
+
className: s(
|
|
26
27
|
"relative h-2 w-full overflow-hidden rounded-full",
|
|
27
28
|
"bg-primary/20",
|
|
28
|
-
!
|
|
29
|
+
!a && o && "opacity-50",
|
|
29
30
|
d
|
|
30
31
|
),
|
|
31
32
|
"data-hook": f,
|
|
32
33
|
"data-slot": "progress",
|
|
33
|
-
"data-tracking-el":
|
|
34
|
-
"data-tracking-label":
|
|
34
|
+
"data-tracking-el": c,
|
|
35
|
+
"data-tracking-label": p,
|
|
35
36
|
...h,
|
|
36
37
|
children: /* @__PURE__ */ r(n.Indicator, { asChild: !0, children: /* @__PURE__ */ r(
|
|
37
|
-
|
|
38
|
+
w.div,
|
|
38
39
|
{
|
|
39
40
|
animate: {
|
|
40
41
|
transform: `translateX(-${100 - (m || 0)}%)`
|
|
41
42
|
},
|
|
42
|
-
className:
|
|
43
|
+
className: s(
|
|
43
44
|
"h-full w-full flex-1 bg-green-400",
|
|
44
45
|
u
|
|
45
46
|
),
|
|
46
47
|
"data-slot": "progress-indicator",
|
|
47
48
|
initial: !1,
|
|
48
|
-
transition: {
|
|
49
|
+
transition: v ? { duration: 0 } : {
|
|
49
50
|
type: "spring",
|
|
50
51
|
stiffness: 80,
|
|
51
52
|
damping: 20,
|
|
@@ -55,12 +56,12 @@ const w = l.forwardRef(
|
|
|
55
56
|
) })
|
|
56
57
|
}
|
|
57
58
|
);
|
|
58
|
-
return
|
|
59
|
+
return e ? /* @__PURE__ */ x(
|
|
59
60
|
"div",
|
|
60
61
|
{
|
|
61
|
-
className:
|
|
62
|
+
className: s(
|
|
62
63
|
"flex w-full items-center gap-2",
|
|
63
|
-
|
|
64
|
+
o && "opacity-50"
|
|
64
65
|
),
|
|
65
66
|
"data-slot": "progress-wrapper",
|
|
66
67
|
children: [
|
|
@@ -69,8 +70,8 @@ const w = l.forwardRef(
|
|
|
69
70
|
{
|
|
70
71
|
className: "text-foreground text-sm leading-normal font-medium",
|
|
71
72
|
"data-slot": "progress-label",
|
|
72
|
-
id:
|
|
73
|
-
children:
|
|
73
|
+
id: t,
|
|
74
|
+
children: e
|
|
74
75
|
}
|
|
75
76
|
),
|
|
76
77
|
i
|
|
@@ -79,7 +80,7 @@ const w = l.forwardRef(
|
|
|
79
80
|
) : i;
|
|
80
81
|
}
|
|
81
82
|
);
|
|
82
|
-
|
|
83
|
+
P.displayName = "Progress";
|
|
83
84
|
export {
|
|
84
|
-
|
|
85
|
+
P as Progress
|
|
85
86
|
};
|