@brightlocal/ui-components 2.9.2 → 2.11.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.
Files changed (67) hide show
  1. package/README.md +3 -1
  2. package/component-meta.json +41 -9
  3. package/dist/badge.cjs +1 -1
  4. package/dist/badge.d.ts.map +1 -1
  5. package/dist/badge.js +42 -25
  6. package/dist/blocks/sidebar.cjs +1 -1
  7. package/dist/blocks/sidebar.d.ts +1 -3
  8. package/dist/blocks/sidebar.d.ts.map +1 -1
  9. package/dist/blocks/sidebar.js +46 -49
  10. package/dist/browser-entry.d.ts +17 -0
  11. package/dist/browser-entry.d.ts.map +1 -0
  12. package/dist/button.cjs +1 -1
  13. package/dist/button.js +25 -25
  14. package/dist/card.cjs +1 -1
  15. package/dist/card.d.ts +10 -1
  16. package/dist/card.d.ts.map +1 -1
  17. package/dist/card.js +85 -82
  18. package/dist/carousel.cjs +1 -1
  19. package/dist/carousel.d.ts +13 -1
  20. package/dist/carousel.d.ts.map +1 -1
  21. package/dist/carousel.js +196 -150
  22. package/dist/combobox.cjs +3 -3
  23. package/dist/combobox.d.ts +3 -3
  24. package/dist/combobox.d.ts.map +1 -1
  25. package/dist/combobox.js +480 -440
  26. package/dist/command.cjs +1 -1
  27. package/dist/command.d.ts +101 -1
  28. package/dist/command.d.ts.map +1 -1
  29. package/dist/command.js +383 -119
  30. package/dist/hooks/use-breakpoint.cjs +1 -1
  31. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  32. package/dist/hooks/use-breakpoint.js +10 -10
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +402 -391
  37. package/dist/input-chip.cjs +1 -1
  38. package/dist/input-chip.d.ts +1 -4
  39. package/dist/input-chip.d.ts.map +1 -1
  40. package/dist/input-chip.js +163 -170
  41. package/dist/map.cjs +1 -0
  42. package/dist/map.d.ts +192 -0
  43. package/dist/map.d.ts.map +1 -0
  44. package/dist/map.js +250 -0
  45. package/dist/sonner.cjs +1 -1
  46. package/dist/sonner.d.ts.map +1 -1
  47. package/dist/sonner.js +32 -30
  48. package/dist/tabs.cjs +1 -1
  49. package/dist/tabs.d.ts +4 -0
  50. package/dist/tabs.d.ts.map +1 -1
  51. package/dist/tabs.js +101 -52
  52. package/package.json +4 -1
  53. package/src/blocks/sidebar.tsx +21 -26
  54. package/src/browser-entry.ts +89 -0
  55. package/src/browser-tokens.css +1 -0
  56. package/src/components/badge.tsx +22 -5
  57. package/src/components/button.tsx +13 -13
  58. package/src/components/card.tsx +35 -19
  59. package/src/components/carousel.tsx +101 -9
  60. package/src/components/combobox.tsx +106 -28
  61. package/src/components/command.tsx +637 -16
  62. package/src/components/input-chip.tsx +102 -65
  63. package/src/components/map.tsx +574 -0
  64. package/src/components/sonner.tsx +9 -3
  65. package/src/components/tabs.tsx +118 -22
  66. package/src/hooks/use-breakpoint.ts +2 -3
  67. package/src/index.ts +1 -0
package/dist/card.js CHANGED
@@ -1,17 +1,13 @@
1
- import { jsx as o } from "react/jsx-runtime";
1
+ import { jsx as d } from "react/jsx-runtime";
2
2
  import * as e from "react";
3
- import { cva as C } from "class-variance-authority";
4
- import { cn as s } from "@brightlocal/ui-components/lib/utils";
5
- const l = e.createContext({ flush: !1 }), g = C(
6
- [
7
- "flex",
8
- "flex-col",
9
- "gap-8",
10
- "rounded-xl",
11
- "py-section-md",
12
- "transition-colors",
13
- "w-full"
14
- ],
3
+ import { cva as y } from "class-variance-authority";
4
+ import { cn as n } from "@brightlocal/ui-components/lib/utils";
5
+ const i = e.createContext({ flush: !1, density: "default" });
6
+ function c(t, a) {
7
+ return !t && (a === "condensed" ? "px-3" : "px-section-md");
8
+ }
9
+ const b = y(
10
+ ["flex", "flex-col", "rounded-xl", "transition-colors", "w-full"],
15
11
  {
16
12
  variants: {
17
13
  variant: {
@@ -29,55 +25,62 @@ const l = e.createContext({ flush: !1 }), g = C(
29
25
  "border-border"
30
26
  ],
31
27
  "transparent-flush": ["bg-transparent", "text-foreground"]
28
+ },
29
+ density: {
30
+ default: ["gap-8", "py-section-md"],
31
+ condensed: ["gap-3", "py-3"]
32
32
  }
33
33
  },
34
34
  defaultVariants: {
35
- variant: "filled"
35
+ variant: "filled",
36
+ density: "default"
36
37
  }
37
38
  }
38
39
  ), N = e.forwardRef(
39
40
  ({
40
- className: r,
41
+ className: t,
41
42
  variant: a = "filled",
42
- dataHook: t,
43
- trackingEl: d,
44
- trackingLabel: c,
45
- maxWidth: n = "400px",
46
- children: i,
47
- style: f,
48
- ...m
49
- }, p) => {
50
- const u = a === "transparent-flush", x = n !== void 0 ? {
51
- maxWidth: typeof n == "number" ? `${n}px` : n
43
+ density: r = "default",
44
+ dataHook: o,
45
+ trackingEl: s,
46
+ trackingLabel: f,
47
+ maxWidth: l = "400px",
48
+ children: u,
49
+ style: m,
50
+ ...p
51
+ }, x) => {
52
+ const C = a === "transparent-flush", g = l !== void 0 ? {
53
+ maxWidth: typeof l == "number" ? `${l}px` : l
52
54
  } : void 0;
53
- return /* @__PURE__ */ o(l.Provider, { value: { flush: u }, children: /* @__PURE__ */ o(
55
+ return /* @__PURE__ */ d(i.Provider, { value: { flush: C, density: r }, children: /* @__PURE__ */ d(
54
56
  "div",
55
57
  {
56
- ref: p,
57
- className: s(g({ variant: a }), r),
58
- "data-hook": t,
58
+ ref: x,
59
+ className: n(b({ variant: a, density: r }), t),
60
+ "data-density": r,
61
+ "data-hook": o,
59
62
  "data-slot": "card",
60
- "data-tracking-el": d || `card-${a}`,
61
- "data-tracking-label": c,
62
- style: { ...x, ...f },
63
- ...m,
64
- children: i
63
+ "data-tracking-el": s || `card-${a}`,
64
+ "data-tracking-label": f,
65
+ style: { ...g, ...m },
66
+ ...p,
67
+ children: u
65
68
  }
66
69
  ) });
67
70
  }
68
71
  );
69
72
  N.displayName = "Card";
70
- const b = e.forwardRef(
71
- ({ className: r, ...a }, t) => {
72
- const { flush: d } = e.useContext(l);
73
- return /* @__PURE__ */ o(
73
+ const v = e.forwardRef(
74
+ ({ className: t, ...a }, r) => {
75
+ const { flush: o, density: s } = e.useContext(i);
76
+ return /* @__PURE__ */ d(
74
77
  "div",
75
78
  {
76
- ref: t,
77
- className: s(
79
+ ref: r,
80
+ className: n(
78
81
  "@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]",
79
- !d && "px-section-md",
80
- r
82
+ c(o, s),
83
+ t
81
84
  ),
82
85
  "data-slot": "card-header",
83
86
  ...a
@@ -85,75 +88,75 @@ const b = e.forwardRef(
85
88
  );
86
89
  }
87
90
  );
88
- b.displayName = "CardHeader";
89
- const v = e.forwardRef(
90
- ({ className: r, ...a }, t) => /* @__PURE__ */ o(
91
+ v.displayName = "CardHeader";
92
+ const w = e.forwardRef(
93
+ ({ className: t, ...a }, r) => /* @__PURE__ */ d(
91
94
  "div",
92
95
  {
93
- ref: t,
94
- className: s("font-display text-2xl font-medium", r),
96
+ ref: r,
97
+ className: n("font-display text-2xl font-medium", t),
95
98
  "data-slot": "card-title",
96
99
  ...a
97
100
  }
98
101
  )
99
102
  );
100
- v.displayName = "CardTitle";
101
- const y = e.forwardRef(
102
- ({ className: r, ...a }, t) => /* @__PURE__ */ o(
103
+ w.displayName = "CardTitle";
104
+ const h = e.forwardRef(
105
+ ({ className: t, ...a }, r) => /* @__PURE__ */ d(
103
106
  "div",
104
107
  {
105
- ref: t,
106
- className: s(
108
+ ref: r,
109
+ className: n(
107
110
  "text-muted-foreground text-sm leading-normal font-normal",
108
- r
111
+ t
109
112
  ),
110
113
  "data-slot": "card-description",
111
114
  ...a
112
115
  }
113
116
  )
114
117
  );
115
- y.displayName = "CardDescription";
116
- const w = e.forwardRef(
117
- ({ className: r, ...a }, t) => /* @__PURE__ */ o(
118
+ h.displayName = "CardDescription";
119
+ const R = e.forwardRef(
120
+ ({ className: t, ...a }, r) => /* @__PURE__ */ d(
118
121
  "div",
119
122
  {
120
- ref: t,
121
- className: s(
123
+ ref: r,
124
+ className: n(
122
125
  "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
123
- r
126
+ t
124
127
  ),
125
128
  "data-slot": "card-action",
126
129
  ...a
127
130
  }
128
131
  )
129
132
  );
130
- w.displayName = "CardAction";
131
- const h = e.forwardRef(
132
- ({ className: r, ...a }, t) => {
133
- const { flush: d } = e.useContext(l);
134
- return /* @__PURE__ */ o(
133
+ R.displayName = "CardAction";
134
+ const k = e.forwardRef(
135
+ ({ className: t, ...a }, r) => {
136
+ const { flush: o, density: s } = e.useContext(i);
137
+ return /* @__PURE__ */ d(
135
138
  "div",
136
139
  {
137
- ref: t,
138
- className: s(!d && "px-section-md", r),
140
+ ref: r,
141
+ className: n(c(o, s), t),
139
142
  "data-slot": "card-content",
140
143
  ...a
141
144
  }
142
145
  );
143
146
  }
144
147
  );
145
- h.displayName = "CardContent";
146
- const R = e.forwardRef(
147
- ({ className: r, ...a }, t) => {
148
- const { flush: d } = e.useContext(l);
149
- return /* @__PURE__ */ o(
148
+ k.displayName = "CardContent";
149
+ const j = e.forwardRef(
150
+ ({ className: t, ...a }, r) => {
151
+ const { flush: o, density: s } = e.useContext(i);
152
+ return /* @__PURE__ */ d(
150
153
  "div",
151
154
  {
152
- ref: t,
153
- className: s(
155
+ ref: r,
156
+ className: n(
154
157
  "flex items-center",
155
- !d && "px-section-md",
156
- r
158
+ c(o, s),
159
+ t
157
160
  ),
158
161
  "data-slot": "card-footer",
159
162
  ...a
@@ -161,13 +164,13 @@ const R = e.forwardRef(
161
164
  );
162
165
  }
163
166
  );
164
- R.displayName = "CardFooter";
167
+ j.displayName = "CardFooter";
165
168
  export {
166
169
  N as Card,
167
- w as CardAction,
168
- h as CardContent,
169
- y as CardDescription,
170
- R as CardFooter,
171
- b as CardHeader,
172
- v as CardTitle
170
+ R as CardAction,
171
+ k as CardContent,
172
+ h as CardDescription,
173
+ j as CardFooter,
174
+ v as CardHeader,
175
+ w as CardTitle
173
176
  };
package/dist/carousel.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),L=require("react"),_=require("embla-carousel-react"),S=require("@brightlocal/icons"),b=require("@brightlocal/ui-components/lib/utils"),y=require("@brightlocal/ui-components/button");function T(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const l=T(L),N=l.createContext(null);function C(){const e=l.useContext(N);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}const w=l.forwardRef(({orientation:e="horizontal",opts:o,setApi:r,plugins:s,className:i,children:t,dataHook:f,trackingEl:d,trackingLabel:c,...g},x)=>{const[u,a]=_({...o,axis:e==="horizontal"?"x":"y"},s),[D,I]=l.useState(!1),[O,q]=l.useState(!1),m=l.useCallback(p=>{p&&(I(p.canScrollPrev()),q(p.canScrollNext()))},[]),h=l.useCallback(()=>{a?.scrollPrev()},[a]),v=l.useCallback(()=>{a?.scrollNext()},[a]),E=l.useCallback(p=>{const A=e==="horizontal"?"ArrowLeft":"ArrowUp",K=e==="horizontal"?"ArrowRight":"ArrowDown";p.key===A?(p.preventDefault(),h()):p.key===K&&(p.preventDefault(),v())},[e,h,v]);return l.useEffect(()=>{!a||!r||r(a)},[a,r]),l.useEffect(()=>{if(a)return m(a),a.on("reInit",m),a.on("select",m),()=>{a?.off("reInit",m),a?.off("select",m)}},[a,m]),n.jsx(N.Provider,{value:{carouselRef:u,api:a,opts:o,orientation:e||(o?.axis==="y"?"vertical":"horizontal"),scrollPrev:h,scrollNext:v,canScrollPrev:D,canScrollNext:O},children:n.jsx("div",{ref:x,"aria-roledescription":"carousel",className:b.cn("relative",i),"data-hook":f,"data-slot":"carousel","data-tracking-el":d,"data-tracking-label":c,role:"region",onKeyDownCapture:E,...g,children:t})})});w.displayName="Carousel";const k=l.forwardRef(({className:e,...o},r)=>{const{carouselRef:s,orientation:i}=C(),t=i==="vertical";return n.jsx("div",{ref:s,className:b.cn("overflow-hidden",t&&"w-full",e),"data-slot":"carousel-content",children:n.jsx("div",{ref:r,className:b.cn("flex",t?"-mt-4 h-full w-full flex-col":"-ml-4"),...o})})});k.displayName="CarouselContent";const j=l.forwardRef(({className:e,...o},r)=>{const{orientation:s}=C();return n.jsx("div",{ref:r,"aria-roledescription":"slide",className:b.cn("min-w-0 shrink-0 grow-0 basis-full",s==="horizontal"?"pl-4":"w-full pt-4",e),"data-slot":"carousel-item",role:"group",...o})});j.displayName="CarouselItem";function P({className:e,variant:o="outline",size:r="default",dataHook:s="carousel-previous",hideWhenDisabled:i=!1,...t}){const{orientation:f,scrollPrev:d,canScrollPrev:c}=C();return i&&!c?null:n.jsxs(y.Button,{iconOnly:!0,className:b.cn("absolute",f==="horizontal"?"top-1/2 left-1 -translate-y-1/2 sm:-left-12":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),"data-slot":"carousel-previous",dataHook:s,disabled:!c,size:r,variant:o,onClick:d,...t,children:[n.jsx(S.ArrowLeft,{}),n.jsx("span",{className:"sr-only",children:"Previous slide"})]})}P.displayName="CarouselPrevious";function R({className:e,variant:o="outline",size:r="default",dataHook:s="carousel-next",hideWhenDisabled:i=!1,...t}){const{orientation:f,scrollNext:d,canScrollNext:c}=C();return i&&!c?null:n.jsxs(y.Button,{iconOnly:!0,className:b.cn("absolute",f==="horizontal"?"top-1/2 right-1 -translate-y-1/2 sm:-right-12":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),"data-slot":"carousel-next",dataHook:s,disabled:!c,size:r,variant:o,onClick:d,...t,children:[n.jsx(S.ArrowRight,{}),n.jsx("span",{className:"sr-only",children:"Next slide"})]})}R.displayName="CarouselNext";function z({className:e,dataHook:o="carousel-dots",trackingEl:r,trackingLabel:s,...i}){const{api:t}=C(),[f,d]=l.useState(0),[c,g]=l.useState([]);return l.useEffect(()=>{if(!t)return;g(t.scrollSnapList()),d(t.selectedScrollSnap());const x=()=>{d(t.selectedScrollSnap())},u=()=>{g(t.scrollSnapList()),d(t.selectedScrollSnap())};return t.on("select",x),t.on("reInit",u),()=>{t.off("select",x),t.off("reInit",u)}},[t]),c.length===0?null:n.jsx("div",{"aria-label":"Slide navigation",className:b.cn("border-border dark:border-input dark:bg-input/30 inline-flex items-center justify-center gap-2 rounded-full border bg-white px-2.5 py-2",e),"data-hook":o,"data-slot":"carousel-dots","data-tracking-el":r,"data-tracking-label":s,role:"group",...i,children:c.map((x,u)=>n.jsx("button",{"aria-current":u===f?"step":void 0,"aria-label":`Go to slide ${u+1}`,className:b.cn("focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",u===f?"bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9":"bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"),"data-slot":"carousel-dot",type:"button",onClick:()=>t?.scrollTo(u)},u))})}z.displayName="CarouselDots";exports.Carousel=w;exports.CarouselContent=k;exports.CarouselDots=z;exports.CarouselItem=j;exports.CarouselNext=R;exports.CarouselPrevious=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),Q=require("react"),W=require("embla-carousel-react"),z=require("@brightlocal/icons"),h=require("@brightlocal/ui-components/lib/utils"),D=require("@brightlocal/ui-components/button");function X(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const c=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(l,s,c.get?c:{enumerable:!0,get:()=>e[s]})}}return l.default=e,Object.freeze(l)}const r=X(Q),O=r.createContext(null);function v(){const e=r.useContext(O);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}const E=r.forwardRef(({orientation:e="horizontal",opts:l,setApi:s,plugins:c,className:x,children:o,dataHook:u,trackingEl:i,trackingLabel:n,lazyLoad:m=!1,overscan:p=1,...f},L)=>{const[_,t]=W({...l,axis:e==="horizontal"?"x":"y"},c),[T,A]=r.useState(!1),[B,G]=r.useState(!1),w=Math.max(0,Math.floor(p)),[U,$]=r.useState(()=>{if(!m)return new Set;const a=l?.startIndex??0,g=new Set;for(let b=Math.max(0,a-w);b<=a+w;b++)g.add(b);return g}),S=r.useCallback(a=>{a&&(A(a.canScrollPrev()),G(a.canScrollNext()))},[]),N=r.useCallback(()=>{t?.scrollPrev()},[t]),y=r.useCallback(()=>{t?.scrollNext()},[t]),F=r.useCallback(a=>{const g=e==="horizontal"?"ArrowLeft":"ArrowUp",b=e==="horizontal"?"ArrowRight":"ArrowDown";a.key===g?(a.preventDefault(),N()):a.key===b&&(a.preventDefault(),y())},[e,N,y]);r.useEffect(()=>{!t||!s||s(t)},[t,s]),r.useEffect(()=>{if(t)return S(t),t.on("reInit",S),t.on("select",S),()=>{t?.off("reInit",S),t?.off("select",S)}},[t,S]);const C=r.useCallback(a=>{if(!a||!m)return;const g=a.slidesInView(),b=a.slideNodes().length;$(k=>{const j=new Set(k);for(const R of g){const H=Math.max(0,R-w),J=Math.min(b-1,R+w);for(let I=H;I<=J;I++)j.add(I)}return j.size===k.size?k:j})},[m,w]);return r.useEffect(()=>{if(!(!t||!m))return C(t),t.on("slidesInView",C),t.on("select",C),t.on("reInit",C),()=>{t.off("slidesInView",C),t.off("select",C),t.off("reInit",C)}},[t,m,C]),d.jsx(O.Provider,{value:{carouselRef:_,api:t,opts:l,orientation:e||(l?.axis==="y"?"vertical":"horizontal"),scrollPrev:N,scrollNext:y,canScrollPrev:T,canScrollNext:B,lazyLoad:m,loadedSlides:U},children:d.jsx("div",{ref:L,"aria-roledescription":"carousel",className:h.cn("relative",x),"data-hook":u,"data-slot":"carousel","data-tracking-el":i,"data-tracking-label":n,role:"region",onKeyDownCapture:F,...f,children:o})})});E.displayName="Carousel";const M=r.forwardRef(({className:e,children:l,...s},c)=>{const{carouselRef:x,orientation:o,lazyLoad:u}=v(),i=o==="vertical";let n=0;const m=u?r.Children.map(l,p=>{if(r.isValidElement(p)&&p.type===P){const f=n++;return r.cloneElement(p,{_lazyIndex:f})}return p}):l;return d.jsx("div",{ref:x,className:h.cn("overflow-hidden",i&&"w-full",e),"data-slot":"carousel-content",children:d.jsx("div",{ref:c,className:h.cn("flex",i?"-mt-4 h-full w-full flex-col":"-ml-4"),...s,children:m})})});M.displayName="CarouselContent";const P=r.forwardRef(({className:e,children:l,_lazyIndex:s,...c},x)=>{const{orientation:o,lazyLoad:u,loadedSlides:i}=v(),n=!u||s===void 0||i.has(s);return d.jsx("div",{ref:x,"aria-roledescription":"slide",className:h.cn("min-w-0 shrink-0 grow-0 basis-full",o==="horizontal"?"pl-4":"w-full pt-4",e),"data-lazy-loaded":u?String(n):void 0,"data-slot":"carousel-item",role:"group",...c,children:n?l:null})});P.displayName="CarouselItem";function q({className:e,variant:l="outline",size:s="default",dataHook:c="carousel-previous",hideWhenDisabled:x=!1,...o}){const{orientation:u,scrollPrev:i,canScrollPrev:n}=v();return x&&!n?null:d.jsxs(D.Button,{iconOnly:!0,className:h.cn("absolute",u==="horizontal"?"top-1/2 left-1 -translate-y-1/2 sm:-left-12":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),"data-slot":"carousel-previous",dataHook:c,disabled:!n,size:s,variant:l,onClick:i,...o,children:[d.jsx(z.ArrowLeft,{}),d.jsx("span",{className:"sr-only",children:"Previous slide"})]})}q.displayName="CarouselPrevious";function V({className:e,variant:l="outline",size:s="default",dataHook:c="carousel-next",hideWhenDisabled:x=!1,...o}){const{orientation:u,scrollNext:i,canScrollNext:n}=v();return x&&!n?null:d.jsxs(D.Button,{iconOnly:!0,className:h.cn("absolute",u==="horizontal"?"top-1/2 right-1 -translate-y-1/2 sm:-right-12":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),"data-slot":"carousel-next",dataHook:c,disabled:!n,size:s,variant:l,onClick:i,...o,children:[d.jsx(z.ArrowRight,{}),d.jsx("span",{className:"sr-only",children:"Next slide"})]})}V.displayName="CarouselNext";function K({className:e,dataHook:l="carousel-dots",trackingEl:s,trackingLabel:c,...x}){const{api:o}=v(),[u,i]=r.useState(0),[n,m]=r.useState([]);return r.useEffect(()=>{if(!o)return;m(o.scrollSnapList()),i(o.selectedScrollSnap());const p=()=>{i(o.selectedScrollSnap())},f=()=>{m(o.scrollSnapList()),i(o.selectedScrollSnap())};return o.on("select",p),o.on("reInit",f),()=>{o.off("select",p),o.off("reInit",f)}},[o]),n.length===0?null:d.jsx("div",{"aria-label":"Slide navigation",className:h.cn("border-border dark:border-input dark:bg-input/30 inline-flex items-center justify-center gap-2 rounded-full border bg-white px-2.5 py-2",e),"data-hook":l,"data-slot":"carousel-dots","data-tracking-el":s,"data-tracking-label":c,role:"group",...x,children:n.map((p,f)=>d.jsx("button",{"aria-current":f===u?"step":void 0,"aria-label":`Go to slide ${f+1}`,className:h.cn("focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",f===u?"bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9":"bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"),"data-slot":"carousel-dot",type:"button",onClick:()=>o?.scrollTo(f)},f))})}K.displayName="CarouselDots";exports.Carousel=E;exports.CarouselContent=M;exports.CarouselDots=K;exports.CarouselItem=P;exports.CarouselNext=V;exports.CarouselPrevious=q;
@@ -38,6 +38,18 @@ interface CarouselProps extends React.ComponentProps<"div"> {
38
38
  * Callback to receive the carousel API instance
39
39
  */
40
40
  setApi?: (api: CarouselApi) => void;
41
+ /**
42
+ * Enable lazy loading to only mount slides near the viewport.
43
+ * Off-screen slide children are not rendered until they scroll into view.
44
+ * @default false
45
+ */
46
+ lazyLoad?: boolean;
47
+ /**
48
+ * Number of off-screen slides to pre-render on each side of the viewport.
49
+ * Only applies when `lazyLoad` is enabled.
50
+ * @default 1
51
+ */
52
+ overscan?: number;
41
53
  }
42
54
  /**
43
55
  * Carousel component for displaying a scrollable series of content.
@@ -51,7 +63,7 @@ declare const CarouselContent: React.ForwardRefExoticComponent<Omit<React.Detail
51
63
  /**
52
64
  * Individual slide item within the carousel.
53
65
  */
54
- declare const CarouselItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
66
+ declare const CarouselItem: React.ForwardRefExoticComponent<React.ComponentPropsWithoutRef<"div"> & React.RefAttributes<HTMLDivElement>>;
55
67
  /**
56
68
  * Props for CarouselPrevious component.
57
69
  */
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../src/components/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAE7E,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACjE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAChD,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE/C;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACzD;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;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