@brightlocal/ui-components 2.15.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Machine-readable registry of all components in the BrightLocal Design System",
5
5
  "components": [
6
6
  {
@@ -426,7 +426,7 @@
426
426
  "props": [
427
427
  "maxWidth"
428
428
  ],
429
- "description": "Content container with consistent styling. Supports a density prop: 'default' uses generous spacing (gap-8, py-section-md, px-section-md) for standalone cards; 'condensed' uses compact spacing (gap-3, py-3, px-3) for cards nested inside other cards as sub-sections, inline stat panels, or dense dashboard widgets.",
429
+ "description": "Content container with consistent styling. Full-width by default — constrain width via className (e.g., className='max-w-sm'). Supports a density prop: 'default' uses generous spacing (gap-8, py-section-md, px-section-md) for standalone cards; 'condensed' uses compact spacing (gap-3, py-3, px-3) for cards nested inside other cards as sub-sections, inline stat panels, or dense dashboard widgets.",
430
430
  "aliases": [
431
431
  "container",
432
432
  "panel",
@@ -439,13 +439,7 @@
439
439
  "Page-level content containers that need consistent padding and border styling",
440
440
  "Nested sub-sections within a parent card — use density='condensed' for compact inline panels (e.g., stat summaries, ranking grids, metric tiles)"
441
441
  ],
442
- "knownGaps": [
443
- {
444
- "description": "CardTitle text size too large for some contexts — smaller variant needed",
445
- "ticket": "DS-535",
446
- "workaround": "Override CardTitle with className='text-lg' or 'text-base' for smaller titles"
447
- }
448
- ],
442
+ "knownGaps": [],
449
443
  "doNotUseFor": [
450
444
  "clickable list items (use List)",
451
445
  "modal content (use Dialog)"
@@ -1433,7 +1427,11 @@
1433
1427
  "MapTypeId",
1434
1428
  "MapLocationPin",
1435
1429
  "MapGridPin",
1430
+ "MapClusterPin",
1436
1431
  "mapGridPinColorMap",
1432
+ "clusterPinHexColors",
1433
+ "createClusterPinSvg",
1434
+ "createClusterPinElement",
1437
1435
  "MapControlButton",
1438
1436
  "MapLoadingState",
1439
1437
  "MapErrorState",
@@ -1478,6 +1476,7 @@
1478
1476
  "aliases": [
1479
1477
  "map pin",
1480
1478
  "grid pin",
1479
+ "cluster pin",
1481
1480
  "map marker",
1482
1481
  "map controls",
1483
1482
  "map legend",
@@ -1488,6 +1487,7 @@
1488
1487
  "whenToUse": [
1489
1488
  "Building a Google Maps integration with the BrightLocal Design System",
1490
1489
  "Displaying Local Search Grid rank pins on a map",
1490
+ "Clustering grouped map pins into a pie-chart summary",
1491
1491
  "Adding loading/error placeholder states for map containers",
1492
1492
  "Building map controls (zoom, locate) as floating overlays",
1493
1493
  "Adding a color-coded legend bar to map views"
package/dist/card.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),O=require("react"),D=require("class-variance-authority"),n=require("@brightlocal/ui-components/lib/utils");function M(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,d.get?d:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const r=M(O),c=r.createContext({flush:!1,density:"default"});function l(e,t){return!e&&(t==="condensed"?"px-3":"px-section-md")}const P=D.cva(["flex","flex-col","rounded-xl","transition-colors","w-full"],{variants:{variant:{filled:["bg-card","text-card-foreground","border","border-card-border"],transparent:["bg-transparent","text-foreground"],border:["bg-transparent","text-foreground","border","border-border"],"transparent-flush":["bg-transparent","text-foreground"]},density:{default:["gap-8","py-section-md"],condensed:["gap-3","py-3"]}},defaultVariants:{variant:"filled",density:"default"}}),u=r.forwardRef(({className:e,variant:t="filled",density:a="default",dataHook:d,trackingEl:s,trackingLabel:f,maxWidth:i="400px",children:v,style:N,...j},h)=>{const w=t==="transparent-flush",R=i!==void 0?{maxWidth:typeof i=="number"?`${i}px`:i}:void 0;return o.jsx(c.Provider,{value:{flush:w,density:a},children:o.jsx("div",{ref:h,className:n.cn(P({variant:t,density:a}),e),"data-density":a,"data-hook":d,"data-slot":"card","data-tracking-el":s||`card-${t}`,"data-tracking-label":f,style:{...R,...N},...j,children:v})})});u.displayName="Card";const p=r.forwardRef(({className:e,...t},a)=>{const{flush:d,density:s}=r.useContext(c);return o.jsx("div",{ref:a,className:n.cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",l(d,s),e),"data-slot":"card-header",...t})});p.displayName="CardHeader";const m=r.forwardRef(({className:e,...t},a)=>o.jsx("div",{ref:a,className:n.cn("font-display text-2xl font-medium",e),"data-slot":"card-title",...t}));m.displayName="CardTitle";const C=r.forwardRef(({className:e,...t},a)=>o.jsx("div",{ref:a,className:n.cn("text-muted-foreground text-sm leading-normal font-normal",e),"data-slot":"card-description",...t}));C.displayName="CardDescription";const x=r.forwardRef(({className:e,...t},a)=>o.jsx("div",{ref:a,className:n.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),"data-slot":"card-action",...t}));x.displayName="CardAction";const y=r.forwardRef(({className:e,children:t,...a},d)=>{const{flush:s,density:f}=r.useContext(c);return o.jsx("div",{ref:d,className:n.cn(l(s,f),e),"data-slot":"card-media",...a,children:o.jsx("div",{className:"overflow-hidden rounded-md","data-slot":"card-media-clip",children:t})})});y.displayName="CardMedia";const g=r.forwardRef(({className:e,...t},a)=>{const{flush:d,density:s}=r.useContext(c);return o.jsx("div",{ref:a,className:n.cn(l(d,s),e),"data-slot":"card-content",...t})});g.displayName="CardContent";const b=r.forwardRef(({className:e,...t},a)=>{const{flush:d,density:s}=r.useContext(c);return o.jsx("div",{ref:a,className:n.cn("flex items-center",l(d,s),e),"data-slot":"card-footer",...t})});b.displayName="CardFooter";exports.Card=u;exports.CardAction=x;exports.CardContent=g;exports.CardDescription=C;exports.CardFooter=b;exports.CardHeader=p;exports.CardMedia=y;exports.CardTitle=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),T=require("react"),u=require("class-variance-authority"),o=require("@brightlocal/ui-components/lib/utils");function D(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const d=D(T),c=d.createContext({flush:!1,density:"default"});function l(e,a){return!e&&(a==="condensed"?"px-3":"px-section-md")}const V=u.cva(["flex","flex-col","rounded-xl","transition-colors","w-full","max-w-[400px]"],{variants:{variant:{filled:["bg-card","text-card-foreground","border","border-card-border"],transparent:["bg-transparent","text-foreground"],border:["bg-transparent","text-foreground","border","border-border"],"transparent-flush":["bg-transparent","text-foreground"]},density:{default:["gap-8","py-section-md"],condensed:["gap-3","py-3"]}},defaultVariants:{variant:"filled",density:"default"}}),m=d.forwardRef(({className:e,variant:a="filled",density:t="default",dataHook:r,trackingEl:n,trackingLabel:f,maxWidth:i,children:N,style:w,...j},h)=>{const R=a==="transparent-flush";d.useEffect(()=>{process.env.NODE_ENV!=="production"&&i!==void 0&&console.warn('Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").')},[i]);const O=i!==void 0?{maxWidth:typeof i=="number"?`${i}px`:i}:void 0;return s.jsx(c.Provider,{value:{flush:R,density:t},children:s.jsx("div",{ref:h,className:o.cn(V({variant:a,density:t}),e),"data-density":t,"data-hook":r,"data-slot":"card","data-tracking-el":n||`card-${a}`,"data-tracking-label":f,style:{...O,...w},...j,children:N})})});m.displayName="Card";const p=d.forwardRef(({className:e,...a},t)=>{const{flush:r,density:n}=d.useContext(c);return s.jsx("div",{ref:t,className:o.cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",l(r,n),e),"data-slot":"card-header",...a})});p.displayName="CardHeader";const _=u.cva("font-display font-medium",{variants:{size:{small:"text-base",default:"text-2xl"}},defaultVariants:{size:"default"}}),x=d.forwardRef(({className:e,size:a="default",...t},r)=>s.jsx("div",{ref:r,className:o.cn(_({size:a}),e),"data-slot":"card-title",...t}));x.displayName="CardTitle";const C=d.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":"card-description",...a}));C.displayName="CardDescription";const g=d.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),"data-slot":"card-action",...a}));g.displayName="CardAction";const y=d.forwardRef(({className:e,children:a,...t},r)=>{const{flush:n,density:f}=d.useContext(c);return s.jsx("div",{ref:r,className:o.cn(l(n,f),e),"data-slot":"card-media",...t,children:s.jsx("div",{className:"overflow-hidden rounded-md","data-slot":"card-media-clip",children:a})})});y.displayName="CardMedia";const b=d.forwardRef(({className:e,...a},t)=>{const{flush:r,density:n}=d.useContext(c);return s.jsx("div",{ref:t,className:o.cn(l(r,n),e),"data-slot":"card-content",...a})});b.displayName="CardContent";const v=d.forwardRef(({className:e,...a},t)=>{const{flush:r,density:n}=d.useContext(c);return s.jsx("div",{ref:t,className:o.cn("flex items-center",l(r,n),e),"data-slot":"card-footer",...a})});v.displayName="CardFooter";exports.Card=m;exports.CardAction=g;exports.CardContent=b;exports.CardDescription=C;exports.CardFooter=v;exports.CardHeader=p;exports.CardMedia=y;exports.CardTitle=x;
package/dist/card.d.ts CHANGED
@@ -34,8 +34,10 @@ type CardProps = React.ComponentProps<"div"> & {
34
34
  */
35
35
  trackingLabel?: string;
36
36
  /**
37
- * Maximum width of the card (e.g., "420px", "600px", "100%")
38
- * @default "400px"
37
+ * Maximum width of the card (e.g., "420px", "600px", "100%").
38
+ * Cards are full-width by default — use className="max-w-[400px]" instead.
39
+ * @default undefined
40
+ * @deprecated Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").
39
41
  */
40
42
  maxWidth?: string | number;
41
43
  };
@@ -61,10 +63,24 @@ type CardSubComponentProps = React.ComponentProps<"div"> & {
61
63
  * Header section of the Card containing title and description.
62
64
  */
63
65
  declare const CardHeader: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
66
+ /**
67
+ * Size variant for the CardTitle.
68
+ */
69
+ type CardTitleSize = "small" | "default";
70
+ /**
71
+ * Props for the CardTitle component.
72
+ */
73
+ type CardTitleProps = CardSubComponentProps & {
74
+ /**
75
+ * Title text size.
76
+ * @default "default"
77
+ */
78
+ size?: CardTitleSize;
79
+ };
64
80
  /**
65
81
  * Title element within the Card header.
66
82
  */
67
- declare const CardTitle: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
83
+ declare const CardTitle: React.ForwardRefExoticComponent<Omit<CardTitleProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
68
84
  /**
69
85
  * Description text within the Card header.
70
86
  */
@@ -86,5 +102,5 @@ declare const CardContent: React.ForwardRefExoticComponent<Omit<CardSubComponent
86
102
  */
87
103
  declare const CardFooter: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
88
104
  export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardMedia, CardContent, };
89
- export type { CardProps, CardSubComponentProps, CardVariant, CardDensity };
105
+ export type { CardProps, CardSubComponentProps, CardTitleProps, CardTitleSize, CardVariant, CardDensity, };
90
106
  //# sourceMappingURL=card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,KAAK,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAE7E;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,WAAW,CAAC;AA8C3C;;GAEG;AACH,KAAK,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;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,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,IAAI,+FA2CT,CAAC;AAIF;;GAEG;AACH,KAAK,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAgBf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,SAAS,2GASd,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,eAAe,2GAYpB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAYf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,SAAS,2GAgBd,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,WAAW,2GAYhB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAgBf,CAAC;AAGF,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,SAAS,EACT,WAAW,GACZ,CAAC;AAEF,YAAY,EAAE,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,KAAK,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAE7E;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,WAAW,CAAC;AAqD3C;;GAEG;AACH,KAAK,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,IAAI,+FAmDT,CAAC;AAIF;;GAEG;AACH,KAAK,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAgBf,CAAC;AAGF;;GAEG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAczC;;GAEG;AACH,KAAK,cAAc,GAAG,qBAAqB,GAAG;IAC5C;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,SAAS,oGASd,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,eAAe,2GAYpB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAYf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,SAAS,2GAgBd,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,WAAW,2GAYhB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAgBf,CAAC;AAGF,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,SAAS,EACT,WAAW,GACZ,CAAC;AAEF,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,WAAW,EACX,WAAW,GACZ,CAAC"}
package/dist/card.js CHANGED
@@ -1,13 +1,20 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import * as e from "react";
3
- import { cva as g } from "class-variance-authority";
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import * as r from "react";
3
+ import { cva as u } from "class-variance-authority";
4
4
  import { cn as n } from "@brightlocal/ui-components/lib/utils";
5
- const l = e.createContext({ flush: !1, density: "default" });
5
+ const l = r.createContext({ flush: !1, density: "default" });
6
6
  function c(t, a) {
7
7
  return !t && (a === "condensed" ? "px-3" : "px-section-md");
8
8
  }
9
- const N = g(
10
- ["flex", "flex-col", "rounded-xl", "transition-colors", "w-full"],
9
+ const g = u(
10
+ [
11
+ "flex",
12
+ "flex-col",
13
+ "rounded-xl",
14
+ "transition-colors",
15
+ "w-full",
16
+ "max-w-[400px]"
17
+ ],
11
18
  {
12
19
  variants: {
13
20
  variant: {
@@ -36,50 +43,56 @@ const N = g(
36
43
  density: "default"
37
44
  }
38
45
  }
39
- ), v = e.forwardRef(
46
+ ), v = r.forwardRef(
40
47
  ({
41
48
  className: t,
42
49
  variant: a = "filled",
43
- density: r = "default",
44
- dataHook: o,
45
- trackingEl: s,
50
+ density: e = "default",
51
+ dataHook: d,
52
+ trackingEl: o,
46
53
  trackingLabel: f,
47
- maxWidth: i = "400px",
48
- children: u,
49
- style: m,
50
- ...p
54
+ maxWidth: i,
55
+ children: m,
56
+ style: p,
57
+ ...x
51
58
  }, C) => {
52
- const x = a === "transparent-flush", y = i !== void 0 ? {
59
+ const y = a === "transparent-flush";
60
+ r.useEffect(() => {
61
+ process.env.NODE_ENV !== "production" && i !== void 0 && console.warn(
62
+ 'Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").'
63
+ );
64
+ }, [i]);
65
+ const N = i !== void 0 ? {
53
66
  maxWidth: typeof i == "number" ? `${i}px` : i
54
67
  } : void 0;
55
- return /* @__PURE__ */ d(l.Provider, { value: { flush: x, density: r }, children: /* @__PURE__ */ d(
68
+ return /* @__PURE__ */ s(l.Provider, { value: { flush: y, density: e }, children: /* @__PURE__ */ s(
56
69
  "div",
57
70
  {
58
71
  ref: C,
59
- className: n(N({ variant: a, density: r }), t),
60
- "data-density": r,
61
- "data-hook": o,
72
+ className: n(g({ variant: a, density: e }), t),
73
+ "data-density": e,
74
+ "data-hook": d,
62
75
  "data-slot": "card",
63
- "data-tracking-el": s || `card-${a}`,
76
+ "data-tracking-el": o || `card-${a}`,
64
77
  "data-tracking-label": f,
65
- style: { ...y, ...m },
66
- ...p,
67
- children: u
78
+ style: { ...N, ...p },
79
+ ...x,
80
+ children: m
68
81
  }
69
82
  ) });
70
83
  }
71
84
  );
72
85
  v.displayName = "Card";
73
- const b = e.forwardRef(
74
- ({ className: t, ...a }, r) => {
75
- const { flush: o, density: s } = e.useContext(l);
76
- return /* @__PURE__ */ d(
86
+ const w = r.forwardRef(
87
+ ({ className: t, ...a }, e) => {
88
+ const { flush: d, density: o } = r.useContext(l);
89
+ return /* @__PURE__ */ s(
77
90
  "div",
78
91
  {
79
- ref: r,
92
+ ref: e,
80
93
  className: n(
81
94
  "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
82
- c(o, s),
95
+ c(d, o),
83
96
  t
84
97
  ),
85
98
  "data-slot": "card-header",
@@ -88,24 +101,34 @@ const b = e.forwardRef(
88
101
  );
89
102
  }
90
103
  );
91
- b.displayName = "CardHeader";
92
- const h = e.forwardRef(
93
- ({ className: t, ...a }, r) => /* @__PURE__ */ d(
104
+ w.displayName = "CardHeader";
105
+ const b = u("font-display font-medium", {
106
+ variants: {
107
+ size: {
108
+ small: "text-base",
109
+ default: "text-2xl"
110
+ }
111
+ },
112
+ defaultVariants: {
113
+ size: "default"
114
+ }
115
+ }), h = r.forwardRef(
116
+ ({ className: t, size: a = "default", ...e }, d) => /* @__PURE__ */ s(
94
117
  "div",
95
118
  {
96
- ref: r,
97
- className: n("font-display text-2xl font-medium", t),
119
+ ref: d,
120
+ className: n(b({ size: a }), t),
98
121
  "data-slot": "card-title",
99
- ...a
122
+ ...e
100
123
  }
101
124
  )
102
125
  );
103
126
  h.displayName = "CardTitle";
104
- const w = e.forwardRef(
105
- ({ className: t, ...a }, r) => /* @__PURE__ */ d(
127
+ const R = r.forwardRef(
128
+ ({ className: t, ...a }, e) => /* @__PURE__ */ s(
106
129
  "div",
107
130
  {
108
- ref: r,
131
+ ref: e,
109
132
  className: n(
110
133
  "text-muted-foreground text-sm leading-normal font-normal",
111
134
  t
@@ -115,12 +138,12 @@ const w = e.forwardRef(
115
138
  }
116
139
  )
117
140
  );
118
- w.displayName = "CardDescription";
119
- const R = e.forwardRef(
120
- ({ className: t, ...a }, r) => /* @__PURE__ */ d(
141
+ R.displayName = "CardDescription";
142
+ const V = r.forwardRef(
143
+ ({ className: t, ...a }, e) => /* @__PURE__ */ s(
121
144
  "div",
122
145
  {
123
- ref: r,
146
+ ref: e,
124
147
  className: n(
125
148
  "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
126
149
  t
@@ -130,48 +153,48 @@ const R = e.forwardRef(
130
153
  }
131
154
  )
132
155
  );
133
- R.displayName = "CardAction";
134
- const k = e.forwardRef(
135
- ({ className: t, children: a, ...r }, o) => {
136
- const { flush: s, density: f } = e.useContext(l);
137
- return /* @__PURE__ */ d(
156
+ V.displayName = "CardAction";
157
+ const T = r.forwardRef(
158
+ ({ className: t, children: a, ...e }, d) => {
159
+ const { flush: o, density: f } = r.useContext(l);
160
+ return /* @__PURE__ */ s(
138
161
  "div",
139
162
  {
140
- ref: o,
141
- className: n(c(s, f), t),
163
+ ref: d,
164
+ className: n(c(o, f), t),
142
165
  "data-slot": "card-media",
143
- ...r,
144
- children: /* @__PURE__ */ d("div", { className: "overflow-hidden rounded-md", "data-slot": "card-media-clip", children: a })
166
+ ...e,
167
+ children: /* @__PURE__ */ s("div", { className: "overflow-hidden rounded-md", "data-slot": "card-media-clip", children: a })
145
168
  }
146
169
  );
147
170
  }
148
171
  );
149
- k.displayName = "CardMedia";
150
- const j = e.forwardRef(
151
- ({ className: t, ...a }, r) => {
152
- const { flush: o, density: s } = e.useContext(l);
153
- return /* @__PURE__ */ d(
172
+ T.displayName = "CardMedia";
173
+ const k = r.forwardRef(
174
+ ({ className: t, ...a }, e) => {
175
+ const { flush: d, density: o } = r.useContext(l);
176
+ return /* @__PURE__ */ s(
154
177
  "div",
155
178
  {
156
- ref: r,
157
- className: n(c(o, s), t),
179
+ ref: e,
180
+ className: n(c(d, o), t),
158
181
  "data-slot": "card-content",
159
182
  ...a
160
183
  }
161
184
  );
162
185
  }
163
186
  );
164
- j.displayName = "CardContent";
165
- const A = e.forwardRef(
166
- ({ className: t, ...a }, r) => {
167
- const { flush: o, density: s } = e.useContext(l);
168
- return /* @__PURE__ */ d(
187
+ k.displayName = "CardContent";
188
+ const D = r.forwardRef(
189
+ ({ className: t, ...a }, e) => {
190
+ const { flush: d, density: o } = r.useContext(l);
191
+ return /* @__PURE__ */ s(
169
192
  "div",
170
193
  {
171
- ref: r,
194
+ ref: e,
172
195
  className: n(
173
196
  "flex items-center",
174
- c(o, s),
197
+ c(d, o),
175
198
  t
176
199
  ),
177
200
  "data-slot": "card-footer",
@@ -180,14 +203,14 @@ const A = e.forwardRef(
180
203
  );
181
204
  }
182
205
  );
183
- A.displayName = "CardFooter";
206
+ D.displayName = "CardFooter";
184
207
  export {
185
208
  v as Card,
186
- R as CardAction,
187
- j as CardContent,
188
- w as CardDescription,
189
- A as CardFooter,
190
- b as CardHeader,
191
- k as CardMedia,
209
+ V as CardAction,
210
+ k as CardContent,
211
+ R as CardDescription,
212
+ D as CardFooter,
213
+ w as CardHeader,
214
+ T as CardMedia,
192
215
  h as CardTitle
193
216
  };
package/dist/combobox.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),ie=require("react"),K=require("@brightlocal/icons"),le=require("@tanstack/react-virtual"),ce=require("class-variance-authority"),B=require("cmdk"),F=require("@brightlocal/ui-components/lib/utils"),U=require("@brightlocal/ui-components/lib/use-dev-warning"),Y=require("@brightlocal/ui-components/popover"),$=require("@brightlocal/ui-components/command");function ue(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const t=ue(ie),Q=t.createContext(null),X=t.createContext(null);function z(){const e=t.useContext(Q);if(!e)throw new Error("Combobox components must be used within a <Combobox>");return e}function de({value:e,onValueChange:r,open:n,onOpenChange:o,shouldFilter:l=!0,disabled:u=!1,itemToStringValue:a,children:m}){const[x,v]=t.useState(""),[E,p]=t.useState(!1),[d,R]=t.useState(()=>new Map),[I,C]=t.useState(""),[j,N]=t.useState(void 0),y=e!==void 0,w=n!==void 0,L=y?e:x,S=w?n:E,D=t.useCallback(g=>{g||C(""),w||p(g),o?.(g)},[w,o]),V=t.useCallback(g=>{y||v(g),r?.(g)},[y,r]),c=t.useRef(new Map),k=t.useRef(!1),T=t.useRef(!0);t.useEffect(()=>()=>{T.current=!1},[]);const b=t.useCallback(()=>{k.current||(k.current=!0,queueMicrotask(()=>{k.current=!1,T.current&&R(new Map(c.current))}))},[]),P=t.useCallback((g,A)=>{c.current.get(g)!==A&&(c.current.set(g,A),b())},[b]),O=t.useCallback(g=>{for(const[A,G]of g)c.current.set(A,G);R(new Map(c.current))},[]),W=t.useRef(L);t.useLayoutEffect(()=>{W.current=L},[L]);const q=t.useCallback(g=>{g!==W.current&&c.current.has(g)&&(c.current.delete(g),b())},[b]),_=t.useMemo(()=>a?(g,A,G)=>B.defaultFilter(a(g),A,G):B.defaultFilter,[a]),H=t.useMemo(()=>({open:S,setOpen:D,value:L,onValueChange:V,shouldFilter:l,disabled:u,itemLabels:d,registerItem:P,registerItemsSync:O,unregisterItem:q,itemToStringValue:a,filterFn:_,searchValue:I,setSearchValue:C,activeDescendantId:j,setActiveDescendantId:N}),[S,D,L,V,l,u,d,P,O,q,a,_,I,j,N]);return i.jsx(Q.Provider,{value:H,children:i.jsx(Y.Popover,{open:S,onOpenChange:D,children:m})})}const be=ce.cva(["relative flex w-full items-center justify-between gap-2","px-4 py-2 h-9","border border-input rounded-md outline-none","bg-neutral-50 shadow-xs","dark:bg-white/5 dark:border-white/15","text-base font-normal font-sans text-foreground","data-[placeholder=true]:text-muted-foreground","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","transition-[background-color,border-color,box-shadow] duration-200 ease-out","[&_svg]:pointer-events-none [&_svg]:shrink-0"]),Z=t.forwardRef(({className:e,dataHook:r,error:n,trackingEl:o,trackingLabel:l,children:u,...a},m)=>{const{open:x,disabled:v,value:E}=z(),p=t.useId(),d=!E,R=n||a["aria-invalid"]===!0||a["aria-invalid"]==="true";return i.jsx(Y.PopoverTrigger,{asChild:!0,children:i.jsxs("button",{ref:m,"aria-controls":x?p:void 0,"aria-expanded":x,"aria-haspopup":"listbox","aria-invalid":R?"true":void 0,className:F.cn(be(),R&&"border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive",e),"data-hook":r,"data-placeholder":d,"data-slot":"combobox-trigger","data-state":x?"open":"closed","data-tracking-el":o||"combobox-trigger","data-tracking-label":l,disabled:v||a.disabled,role:"combobox",type:"button",...a,children:[u,i.jsx(K.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});Z.displayName="ComboboxTrigger";function fe(e){return e!=null&&typeof e=="object"&&"value"in e&&typeof e.value=="string"}function ee(e,r,n){if(r)return{getValue:r,getLabel:n??r,hasDistinctLabel:!!n};const o=e[0];if(!fe(o))return null;const l=m=>m.value,u="label"in o&&typeof o.label=="string";return{getValue:l,getLabel:n??(u?m=>String(m.label):l),hasDistinctLabel:u||!!n}}function me({placeholder:e,className:r,displayValue:n,items:o,getItemValue:l,getItemLabel:u}){const{value:a,itemLabels:m}=z(),x=t.useMemo(()=>o?ee(o,l,u):null,[o,l,u]);U.useDevWarning(()=>!!o&&o.length>0&&!x,"ComboboxValue: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",[o,x]);const v=t.useMemo(()=>!o||!x?null:new Map(o.map(p=>[x.getValue(p),x.getLabel(p)])),[o,x]),E=a?v?.get(a)||m.get(a)||n?.(a)||a:e;return i.jsx("span",{className:F.cn("text-foreground overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",r),"data-slot":"combobox-value",children:E})}function xe({dataHook:e,className:r,children:n,align:o="start",side:l="bottom",sideOffset:u,avoidCollisions:a,hideList:m=!1,ariaLabel:x}){const{open:v,shouldFilter:E,filterFn:p,itemToStringValue:d}=z(),[R,I]=t.useState(null),C=t.useRef(null),j=t.useCallback(y=>{if(C.current?.(),C.current=null,!y)return;let w=!1;const L=c=>{w||(c==="top"||c==="bottom")&&(w=!0,S.disconnect(),I(c))},S=new MutationObserver(()=>{L(y.getAttribute("data-side"))});S.observe(y,{attributes:!0,attributeFilter:["data-side"]});let D=0,V=0;D=requestAnimationFrame(()=>{V=requestAnimationFrame(()=>{L(y.getAttribute("data-side"))})}),C.current=()=>{w=!0,S.disconnect(),cancelAnimationFrame(D),cancelAnimationFrame(V)}},[]);t.useEffect(()=>{if(!v){C.current?.(),C.current=null;const y=setTimeout(()=>I(null),150);return()=>clearTimeout(y)}},[v]);const N=d?p:void 0;return i.jsx(Y.PopoverContent,{ref:j,align:o,"aria-label":x??"Options",avoidCollisions:a,className:F.cn("flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",r),collisionPadding:4,"data-slot":"combobox-popover",side:R??l,sideOffset:u,children:i.jsx($.Command,{className:F.cn("min-h-0 flex-1 border-0 shadow-none","[&_[data-slot='command-input-wrapper']]:shrink-0",m&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:e||"combobox-command",filter:N,shouldFilter:E,children:n})})}const te=t.forwardRef(({debounceMs:e,onValueChange:r,...n},o)=>{const{setSearchValue:l,shouldFilter:u,activeDescendantId:a}=z(),m=t.useRef(void 0);U.useDevWarning(()=>!!(e&&e>0&&u),`debounceMs is set on <ComboboxInput> but shouldFilter is true (default).
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),ie=require("react"),K=require("@brightlocal/icons"),le=require("@tanstack/react-virtual"),ce=require("class-variance-authority"),B=require("cmdk"),F=require("@brightlocal/ui-components/lib/utils"),U=require("@brightlocal/ui-components/lib/use-dev-warning"),Y=require("@brightlocal/ui-components/popover"),$=require("@brightlocal/ui-components/command");function ue(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const t=ue(ie),Q=t.createContext(null),X=t.createContext(null);function z(){const e=t.useContext(Q);if(!e)throw new Error("Combobox components must be used within a <Combobox>");return e}function de({value:e,onValueChange:r,open:n,onOpenChange:o,shouldFilter:l=!0,disabled:u=!1,itemToStringValue:a,children:m}){const[p,v]=t.useState(""),[E,x]=t.useState(!1),[d,R]=t.useState(()=>new Map),[I,C]=t.useState(""),[j,N]=t.useState(void 0),y=e!==void 0,w=n!==void 0,L=y?e:p,S=w?n:E,D=t.useCallback(g=>{g||C(""),w||x(g),o?.(g)},[w,o]),V=t.useCallback(g=>{y||v(g),r?.(g)},[y,r]),c=t.useRef(new Map),k=t.useRef(!1),T=t.useRef(!0);t.useEffect(()=>()=>{T.current=!1},[]);const b=t.useCallback(()=>{k.current||(k.current=!0,queueMicrotask(()=>{k.current=!1,T.current&&R(new Map(c.current))}))},[]),P=t.useCallback((g,A)=>{c.current.get(g)!==A&&(c.current.set(g,A),b())},[b]),O=t.useCallback(g=>{for(const[A,G]of g)c.current.set(A,G);R(new Map(c.current))},[]),W=t.useRef(L);t.useLayoutEffect(()=>{W.current=L},[L]);const q=t.useCallback(g=>{g!==W.current&&c.current.has(g)&&(c.current.delete(g),b())},[b]),_=t.useMemo(()=>a?(g,A,G)=>B.defaultFilter(a(g),A,G):B.defaultFilter,[a]),H=t.useMemo(()=>({open:S,setOpen:D,value:L,onValueChange:V,shouldFilter:l,disabled:u,itemLabels:d,registerItem:P,registerItemsSync:O,unregisterItem:q,itemToStringValue:a,filterFn:_,searchValue:I,setSearchValue:C,activeDescendantId:j,setActiveDescendantId:N}),[S,D,L,V,l,u,d,P,O,q,a,_,I,j,N]);return i.jsx(Q.Provider,{value:H,children:i.jsx(Y.Popover,{open:S,onOpenChange:D,children:m})})}const be=ce.cva(["relative flex w-full items-center justify-between gap-2","px-4 py-2 h-9","border border-input rounded-md outline-none","bg-neutral-50 shadow-xs","dark:bg-white/5 dark:border-white/15","text-base font-normal font-sans text-foreground","data-[placeholder=true]:text-muted-foreground","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","transition-[background-color,border-color,box-shadow] duration-200 ease-out","[&_svg]:pointer-events-none [&_svg]:shrink-0"]),Z=t.forwardRef(({className:e,dataHook:r,error:n,trackingEl:o,trackingLabel:l,children:u,...a},m)=>{const{open:p,disabled:v,value:E}=z(),x=t.useId(),d=!E,R=n||a["aria-invalid"]===!0||a["aria-invalid"]==="true";return i.jsx(Y.PopoverTrigger,{asChild:!0,children:i.jsxs("button",{ref:m,"aria-controls":p?x:void 0,"aria-expanded":p,"aria-haspopup":"listbox","aria-invalid":R?"true":void 0,className:F.cn(be(),R&&"border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive",e),"data-hook":r,"data-placeholder":d,"data-slot":"combobox-trigger","data-state":p?"open":"closed","data-tracking-el":o||"combobox-trigger","data-tracking-label":l,disabled:v||a.disabled,role:"combobox",type:"button",...a,children:[u,i.jsx(K.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});Z.displayName="ComboboxTrigger";function fe(e){return e!=null&&typeof e=="object"&&"value"in e&&typeof e.value=="string"}function ee(e,r,n){if(r)return{getValue:r,getLabel:n??r,hasDistinctLabel:!!n};const o=e[0];if(!fe(o))return null;const l=m=>m.value,u="label"in o&&typeof o.label=="string";return{getValue:l,getLabel:n??(u?m=>String(m.label):l),hasDistinctLabel:u||!!n}}function me({placeholder:e,className:r,displayValue:n,items:o,getItemValue:l,getItemLabel:u}){const{value:a,itemLabels:m}=z(),p=t.useMemo(()=>o?ee(o,l,u):null,[o,l,u]);U.useDevWarning(()=>!!o&&o.length>0&&!p,"ComboboxValue: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",[o,p]);const v=t.useMemo(()=>!o||!p?null:new Map(o.map(x=>[p.getValue(x),p.getLabel(x)])),[o,p]),E=a?v?.get(a)||m.get(a)||n?.(a)||a:e;return i.jsx("span",{className:F.cn("overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",r),"data-slot":"combobox-value",children:E})}function pe({dataHook:e,className:r,children:n,align:o="start",side:l="bottom",sideOffset:u,avoidCollisions:a,hideList:m=!1,ariaLabel:p}){const{open:v,shouldFilter:E,filterFn:x,itemToStringValue:d}=z(),[R,I]=t.useState(null),C=t.useRef(null),j=t.useCallback(y=>{if(C.current?.(),C.current=null,!y)return;let w=!1;const L=c=>{w||(c==="top"||c==="bottom")&&(w=!0,S.disconnect(),I(c))},S=new MutationObserver(()=>{L(y.getAttribute("data-side"))});S.observe(y,{attributes:!0,attributeFilter:["data-side"]});let D=0,V=0;D=requestAnimationFrame(()=>{V=requestAnimationFrame(()=>{L(y.getAttribute("data-side"))})}),C.current=()=>{w=!0,S.disconnect(),cancelAnimationFrame(D),cancelAnimationFrame(V)}},[]);t.useEffect(()=>{if(!v){C.current?.(),C.current=null;const y=setTimeout(()=>I(null),150);return()=>clearTimeout(y)}},[v]);const N=d?x:void 0;return i.jsx(Y.PopoverContent,{ref:j,align:o,"aria-label":p??"Options",avoidCollisions:a,className:F.cn("flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",r),collisionPadding:4,"data-slot":"combobox-popover",side:R??l,sideOffset:u,children:i.jsx($.Command,{className:F.cn("min-h-0 flex-1 border-0 shadow-none","[&_[data-slot='command-input-wrapper']]:shrink-0",m&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:e||"combobox-command",filter:N,shouldFilter:E,children:n})})}const te=t.forwardRef(({debounceMs:e,onValueChange:r,...n},o)=>{const{setSearchValue:l,shouldFilter:u,activeDescendantId:a}=z(),m=t.useRef(void 0);U.useDevWarning(()=>!!(e&&e>0&&u),`debounceMs is set on <ComboboxInput> but shouldFilter is true (default).
2
2
  Debounce is designed for async/server-driven search where the consumer controls the items list.
3
- Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`,[e,u]),U.useDevWarning(()=>!!(e&&e>0&&n.value!==void 0),"debounceMs is set on <ComboboxInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.",[e,n.value]),t.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const x=t.useCallback(v=>{l(v),e&&e>0?(clearTimeout(m.current),m.current=setTimeout(()=>{r?.(v)},e)):r?.(v)},[e,r,l]);return i.jsx($.CommandInput,{ref:o,"aria-activedescendant":a,"data-slot":"combobox-input",onValueChange:x,...n})});te.displayName="ComboboxInput";const oe=t.forwardRef(({className:e,...r},n)=>i.jsx($.CommandList,{ref:n,className:F.cn("scrollbar min-h-0 flex-1",e),"data-slot":"combobox-list",...r}));oe.displayName="ComboboxList";function pe({items:e,getItemValue:r,getItemLabel:n,getItemKeywords:o,estimateSize:l=36,overscan:u=5,children:a,renderEmpty:m,className:x,dataHook:v},E){const p=t.useMemo(()=>ee(e,r,n),[e,r,n]),d=t.useMemo(()=>p?.getValue??(s=>{if(typeof s=="string"||typeof s=="number")return String(s);throw new Error("[BrightLocal DS] ComboboxVirtualList: `getItemValue` is required for non-primitive items without a `value` property.")}),[p]),R=t.useMemo(()=>p?.getLabel??d,[p,d]);U.useDevWarning(()=>!p&&e.length>0,"ComboboxVirtualList: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",[p,e.length]);const I=t.useRef(null),{value:C,onValueChange:j,setOpen:N,shouldFilter:y,searchValue:w,filterFn:L,setActiveDescendantId:S,registerItemsSync:D,unregisterItem:V}=z(),[c,k]=t.useState(0),T=t.useId();t.useImperativeHandle(E,()=>I.current,[]),t.useLayoutEffect(()=>{const s=e.map(f=>[d(f),R(f)]);return D(s),()=>{for(const f of e)V(d(f))}},[e,d,R,D,V]);const b=t.useMemo(()=>{if(!y||!w.trim())return e;const s=[];for(const f of e){let h=p?.hasDistinctLabel?B.defaultFilter(R(f),w):L(d(f),w);if(o)for(const M of o(f))h=Math.max(h,B.defaultFilter(M,w));h>0&&s.push({item:f,score:h})}return s.sort((f,h)=>h.score-f.score),s.map(f=>f.item)},[e,y,w,d,R,o,L,p?.hasDistinctLabel]),P=le.useVirtualizer({count:b.length,getScrollElement:()=>I.current,estimateSize:()=>l,overscan:u}),O=c>=0&&c<b.length?d(b[c]):null;t.useEffect(()=>{k(0)},[w,b.length]);const W=t.useRef(!1);t.useEffect(()=>{if(W.current||!C)return;const s=b.findIndex(f=>d(f)===C);s>=0&&(k(s),P.scrollToIndex(s,{align:"center"}),W.current=!0)},[C,b,d,P]);const q=t.useRef(!1);t.useEffect(()=>{q.current&&c>=0&&c<b.length&&P.scrollToIndex(c,{align:"auto"}),q.current=!1},[c,b.length,P]),t.useEffect(()=>{const s=I.current?.closest('[data-slot="combobox-command"]');if(!s)return;const f=h=>{switch(h.key){case"ArrowDown":h.preventDefault(),h.stopPropagation(),q.current=!0,k(M=>M<b.length-1?M+1:M);break;case"ArrowUp":h.preventDefault(),h.stopPropagation(),q.current=!0,k(M=>M>0?M-1:M);break;case"Enter":if(h.preventDefault(),h.stopPropagation(),c>=0&&c<b.length){const M=d(b[c]);j(M===C?"":M),N(!1)}break;case"Home":h.preventDefault(),h.stopPropagation(),q.current=!0,k(0);break;case"End":h.preventDefault(),h.stopPropagation(),q.current=!0,k(b.length-1);break}};return s.addEventListener("keydown",f,{capture:!0}),()=>s.removeEventListener("keydown",f,{capture:!0})},[b,c,C,j,N,d]);const _=t.useMemo(()=>{const s=new Map;return b.forEach((f,h)=>{s.set(d(f),h)}),s},[b,d]),H=t.useCallback(s=>{const f=_.get(s);f!==void 0&&k(f)},[_]),g=t.useCallback(s=>(_.get(s)??0)+1,[_]),A=b.length,G=t.useMemo(()=>({activeValue:O,onItemPointerMove:H,idPrefix:T,filteredCount:A,getItemPosition:g}),[O,H,T,A,g]),J=O!=null?`${T}item-${O}`:void 0;return t.useEffect(()=>(S(J),()=>S(void 0)),[J,S]),b.length===0?i.jsx("div",{ref:I,className:F.cn("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",x),"data-hook":v,"data-slot":"combobox-virtual-list",role:"listbox",children:m}):i.jsx(X.Provider,{value:G,children:i.jsx("div",{ref:I,className:F.cn("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",x),"data-hook":v,"data-slot":"combobox-virtual-list",role:"listbox",children:i.jsx("div",{className:"relative w-full",style:{height:`${P.getTotalSize()}px`},children:P.getVirtualItems().map(s=>i.jsx("div",{ref:P.measureElement,className:"absolute top-0 left-0 w-full px-2","data-index":s.index,style:{transform:`translateY(${s.start}px)`},children:a(b[s.index],s.index,w)},s.key))})})})}const ge=t.forwardRef(pe),re=t.forwardRef((e,r)=>i.jsx($.CommandEmpty,{ref:r,"data-slot":"combobox-empty",...e}));re.displayName="ComboboxEmpty";const ne=t.forwardRef(({children:e,...r},n)=>{const o=t.useRef(null);return U.useDevWarning(()=>o.current?o.current.querySelectorAll('[data-slot="combobox-item"]').length>=100:!1,`ComboboxGroup contains 100+ items. Use <ComboboxVirtualList> for large datasets to avoid DOM bloat and slow renders.
4
- Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox"`,[e]),i.jsx($.CommandGroup,{ref:l=>{o.current=l,typeof n=="function"?n(l):n&&(n.current=l)},"data-slot":"combobox-group",...r,children:e})});ne.displayName="ComboboxGroup";function he(e,r,n){if(!r||!r.trim())return e;const o=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),l=e.split(o);return i.jsx("span",{children:l.map((u,a)=>a%2===1?i.jsx("span",{className:n,children:u},a):i.jsx(t.Fragment,{children:u},a))})}const se=t.forwardRef(({value:e,label:r,dataHook:n,children:o,className:l,highlight:u,highlightClassName:a,keywords:m,onSelect:x,...v},E)=>{const{value:p,onValueChange:d,setOpen:R,registerItem:I,unregisterItem:C}=z(),j=t.useContext(X),N=p===e,y=t.useMemo(()=>r||(typeof o=="string"?o:typeof o=="number"?String(o):e),[r,o,e]),w=t.useRef(I),L=t.useRef(C);t.useEffect(()=>{w.current=I,L.current=C},[I,C]);const S=!!j;t.useEffect(()=>{if(!S)return w.current(e,y),()=>L.current(e)},[e,y,S]);const D=()=>{d(e===p?"":e),R(!1),x?.(e)},V=()=>u&&typeof o=="string"?he(o,u,a||"text-sm leading-normal font-semibold"):o;if(j){const c=j.activeValue===e,k=!!v.disabled;return i.jsxs("div",{ref:E,"aria-disabled":k||void 0,"aria-posinset":j.getItemPosition(e),"aria-selected":N,"aria-setsize":j.filteredCount,className:F.cn("data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none","[&_svg]:pointer-events-none [&_svg]:shrink-0",k&&"pointer-events-none opacity-50",l),"data-highlighted":c||void 0,"data-hook":n,"data-slot":"combobox-item",id:`${j.idPrefix}item-${e}`,role:"option",tabIndex:-1,onClick:k?void 0:D,onKeyDown:k?void 0:T=>{(T.key==="Enter"||T.key===" ")&&D()},onPointerMove:k?void 0:()=>j.onItemPointerMove(e),children:[V(),N&&i.jsx(K.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})}return i.jsxs($.CommandItem,{ref:E,className:F.cn("justify-between",l),"data-slot":"combobox-item",dataHook:n,keywords:m?[y,...m]:[y],value:e,onSelect:D,...v,children:[V(),N&&i.jsx(K.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})});se.displayName="ComboboxItem";const ae=t.forwardRef((e,r)=>i.jsx($.CommandSeparator,{ref:r,"data-slot":"combobox-separator",...e}));ae.displayName="ComboboxSeparator";function ve({className:e,children:r,loadingText:n}){return i.jsx("div",{"aria-live":"polite",className:F.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",e),"data-slot":"combobox-loading",role:"status",children:r||i.jsxs(i.Fragment,{children:[i.jsx("div",{"aria-hidden":"true",className:"size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"}),n??"Loading..."]})})}exports.Combobox=de;exports.ComboboxContent=xe;exports.ComboboxEmpty=re;exports.ComboboxGroup=ne;exports.ComboboxInput=te;exports.ComboboxItem=se;exports.ComboboxList=oe;exports.ComboboxLoading=ve;exports.ComboboxSeparator=ae;exports.ComboboxTrigger=Z;exports.ComboboxValue=me;exports.ComboboxVirtualList=ge;
3
+ Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`,[e,u]),U.useDevWarning(()=>!!(e&&e>0&&n.value!==void 0),"debounceMs is set on <ComboboxInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.",[e,n.value]),t.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const p=t.useCallback(v=>{l(v),e&&e>0?(clearTimeout(m.current),m.current=setTimeout(()=>{r?.(v)},e)):r?.(v)},[e,r,l]);return i.jsx($.CommandInput,{ref:o,"aria-activedescendant":a,"data-slot":"combobox-input",onValueChange:p,...n})});te.displayName="ComboboxInput";const oe=t.forwardRef(({className:e,...r},n)=>i.jsx($.CommandList,{ref:n,className:F.cn("scrollbar min-h-0 flex-1",e),"data-slot":"combobox-list",...r}));oe.displayName="ComboboxList";function xe({items:e,getItemValue:r,getItemLabel:n,getItemKeywords:o,estimateSize:l=36,overscan:u=5,children:a,renderEmpty:m,className:p,dataHook:v},E){const x=t.useMemo(()=>ee(e,r,n),[e,r,n]),d=t.useMemo(()=>x?.getValue??(s=>{if(typeof s=="string"||typeof s=="number")return String(s);throw new Error("[BrightLocal DS] ComboboxVirtualList: `getItemValue` is required for non-primitive items without a `value` property.")}),[x]),R=t.useMemo(()=>x?.getLabel??d,[x,d]);U.useDevWarning(()=>!x&&e.length>0,"ComboboxVirtualList: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",[x,e.length]);const I=t.useRef(null),{value:C,onValueChange:j,setOpen:N,shouldFilter:y,searchValue:w,filterFn:L,setActiveDescendantId:S,registerItemsSync:D,unregisterItem:V}=z(),[c,k]=t.useState(0),T=t.useId();t.useImperativeHandle(E,()=>I.current,[]),t.useLayoutEffect(()=>{const s=e.map(f=>[d(f),R(f)]);return D(s),()=>{for(const f of e)V(d(f))}},[e,d,R,D,V]);const b=t.useMemo(()=>{if(!y||!w.trim())return e;const s=[];for(const f of e){let h=x?.hasDistinctLabel?B.defaultFilter(R(f),w):L(d(f),w);if(o)for(const M of o(f))h=Math.max(h,B.defaultFilter(M,w));h>0&&s.push({item:f,score:h})}return s.sort((f,h)=>h.score-f.score),s.map(f=>f.item)},[e,y,w,d,R,o,L,x?.hasDistinctLabel]),P=le.useVirtualizer({count:b.length,getScrollElement:()=>I.current,estimateSize:()=>l,overscan:u}),O=c>=0&&c<b.length?d(b[c]):null;t.useEffect(()=>{k(0)},[w,b.length]);const W=t.useRef(!1);t.useEffect(()=>{if(W.current||!C)return;const s=b.findIndex(f=>d(f)===C);s>=0&&(k(s),P.scrollToIndex(s,{align:"center"}),W.current=!0)},[C,b,d,P]);const q=t.useRef(!1);t.useEffect(()=>{q.current&&c>=0&&c<b.length&&P.scrollToIndex(c,{align:"auto"}),q.current=!1},[c,b.length,P]),t.useEffect(()=>{const s=I.current?.closest('[data-slot="combobox-command"]');if(!s)return;const f=h=>{switch(h.key){case"ArrowDown":h.preventDefault(),h.stopPropagation(),q.current=!0,k(M=>M<b.length-1?M+1:M);break;case"ArrowUp":h.preventDefault(),h.stopPropagation(),q.current=!0,k(M=>M>0?M-1:M);break;case"Enter":if(h.preventDefault(),h.stopPropagation(),c>=0&&c<b.length){const M=d(b[c]);j(M===C?"":M),N(!1)}break;case"Home":h.preventDefault(),h.stopPropagation(),q.current=!0,k(0);break;case"End":h.preventDefault(),h.stopPropagation(),q.current=!0,k(b.length-1);break}};return s.addEventListener("keydown",f,{capture:!0}),()=>s.removeEventListener("keydown",f,{capture:!0})},[b,c,C,j,N,d]);const _=t.useMemo(()=>{const s=new Map;return b.forEach((f,h)=>{s.set(d(f),h)}),s},[b,d]),H=t.useCallback(s=>{const f=_.get(s);f!==void 0&&k(f)},[_]),g=t.useCallback(s=>(_.get(s)??0)+1,[_]),A=b.length,G=t.useMemo(()=>({activeValue:O,onItemPointerMove:H,idPrefix:T,filteredCount:A,getItemPosition:g}),[O,H,T,A,g]),J=O!=null?`${T}item-${O}`:void 0;return t.useEffect(()=>(S(J),()=>S(void 0)),[J,S]),b.length===0?i.jsx("div",{ref:I,className:F.cn("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",p),"data-hook":v,"data-slot":"combobox-virtual-list",role:"listbox",children:m}):i.jsx(X.Provider,{value:G,children:i.jsx("div",{ref:I,className:F.cn("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",p),"data-hook":v,"data-slot":"combobox-virtual-list",role:"listbox",children:i.jsx("div",{className:"relative w-full",style:{height:`${P.getTotalSize()}px`},children:P.getVirtualItems().map(s=>i.jsx("div",{ref:P.measureElement,className:"absolute top-0 left-0 w-full px-2","data-index":s.index,style:{transform:`translateY(${s.start}px)`},children:a(b[s.index],s.index,w)},s.key))})})})}const ge=t.forwardRef(xe),re=t.forwardRef((e,r)=>i.jsx($.CommandEmpty,{ref:r,"data-slot":"combobox-empty",...e}));re.displayName="ComboboxEmpty";const ne=t.forwardRef(({children:e,...r},n)=>{const o=t.useRef(null);return U.useDevWarning(()=>o.current?o.current.querySelectorAll('[data-slot="combobox-item"]').length>=100:!1,`ComboboxGroup contains 100+ items. Use <ComboboxVirtualList> for large datasets to avoid DOM bloat and slow renders.
4
+ Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox"`,[e]),i.jsx($.CommandGroup,{ref:l=>{o.current=l,typeof n=="function"?n(l):n&&(n.current=l)},"data-slot":"combobox-group",...r,children:e})});ne.displayName="ComboboxGroup";function he(e,r,n){if(!r||!r.trim())return e;const o=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),l=e.split(o);return i.jsx("span",{children:l.map((u,a)=>a%2===1?i.jsx("span",{className:n,children:u},a):i.jsx(t.Fragment,{children:u},a))})}const se=t.forwardRef(({value:e,label:r,dataHook:n,children:o,className:l,highlight:u,highlightClassName:a,keywords:m,onSelect:p,...v},E)=>{const{value:x,onValueChange:d,setOpen:R,registerItem:I,unregisterItem:C}=z(),j=t.useContext(X),N=x===e,y=t.useMemo(()=>r||(typeof o=="string"?o:typeof o=="number"?String(o):e),[r,o,e]),w=t.useRef(I),L=t.useRef(C);t.useEffect(()=>{w.current=I,L.current=C},[I,C]);const S=!!j;t.useEffect(()=>{if(!S)return w.current(e,y),()=>L.current(e)},[e,y,S]);const D=()=>{d(e===x?"":e),R(!1),p?.(e)},V=()=>u&&typeof o=="string"?he(o,u,a||"text-sm leading-normal font-semibold"):o;if(j){const c=j.activeValue===e,k=!!v.disabled;return i.jsxs("div",{ref:E,"aria-disabled":k||void 0,"aria-posinset":j.getItemPosition(e),"aria-selected":N,"aria-setsize":j.filteredCount,className:F.cn("data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none","[&_svg]:pointer-events-none [&_svg]:shrink-0",k&&"pointer-events-none opacity-50",l),"data-highlighted":c||void 0,"data-hook":n,"data-slot":"combobox-item",id:`${j.idPrefix}item-${e}`,role:"option",tabIndex:-1,onClick:k?void 0:D,onKeyDown:k?void 0:T=>{(T.key==="Enter"||T.key===" ")&&D()},onPointerMove:k?void 0:()=>j.onItemPointerMove(e),children:[V(),N&&i.jsx(K.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})}return i.jsxs($.CommandItem,{ref:E,className:F.cn("justify-between",l),"data-slot":"combobox-item",dataHook:n,keywords:m?[y,...m]:[y],value:e,onSelect:D,...v,children:[V(),N&&i.jsx(K.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})});se.displayName="ComboboxItem";const ae=t.forwardRef((e,r)=>i.jsx($.CommandSeparator,{ref:r,"data-slot":"combobox-separator",...e}));ae.displayName="ComboboxSeparator";function ve({className:e,children:r,loadingText:n}){return i.jsx("div",{"aria-live":"polite",className:F.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",e),"data-slot":"combobox-loading",role:"status",children:r||i.jsxs(i.Fragment,{children:[i.jsx("div",{"aria-hidden":"true",className:"size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"}),n??"Loading..."]})})}exports.Combobox=de;exports.ComboboxContent=pe;exports.ComboboxEmpty=re;exports.ComboboxGroup=ne;exports.ComboboxInput=te;exports.ComboboxItem=se;exports.ComboboxList=oe;exports.ComboboxLoading=ve;exports.ComboboxSeparator=ae;exports.ComboboxTrigger=Z;exports.ComboboxValue=me;exports.ComboboxVirtualList=ge;