@brightlocal/ui-components 2.10.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/component-meta.json +200 -17
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +42 -25
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +16 -4
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +57 -53
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts +7 -1
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +82 -81
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +19 -10
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +173 -169
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +14 -2
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +37 -37
- package/dist/button.cjs +1 -1
- package/dist/button.js +25 -25
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +3 -3
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +2 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +10 -1
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +85 -82
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +37 -4
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +213 -163
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +11 -0
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +43 -38
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +12 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +235 -230
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +106 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +385 -120
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +10 -0
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +96 -96
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +38 -30
- package/dist/drawer.d.ts +2 -2
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +5 -0
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +15 -7
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +10 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +406 -395
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +8 -5
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +164 -170
- package/dist/input-group.d.ts +1 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +10 -0
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +108 -106
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +36 -37
- package/dist/list.d.ts +1 -1
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +6 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +25 -22
- package/dist/map.cjs +1 -0
- package/dist/map.d.ts +207 -0
- package/dist/map.d.ts.map +1 -0
- package/dist/map.js +256 -0
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +29 -3
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +26 -25
- package/dist/rating.cjs +1 -1
- package/dist/rating.d.ts +6 -0
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +27 -19
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +7 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +52 -51
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +16 -4
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +38 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +6 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +42 -41
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +13 -11
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +32 -30
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +4 -0
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +101 -52
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.d.ts +5 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/text-reveal-motion.js +111 -110
- package/dist/typography.cjs +1 -1
- package/dist/typography.d.ts +1 -2
- package/dist/typography.d.ts.map +1 -1
- package/dist/typography.js +49 -50
- package/package.json +4 -5
- package/src/blocks/data-table.tsx +26 -9
- package/src/blocks/input-list.tsx +12 -1
- package/src/blocks/sidebar.tsx +61 -44
- package/src/components/badge.tsx +22 -5
- package/src/components/breadcrumb.tsx +43 -26
- package/src/components/button.tsx +13 -13
- package/src/components/callout.tsx +5 -4
- package/src/components/card.tsx +35 -19
- package/src/components/carousel.tsx +134 -13
- package/src/components/chip.tsx +22 -2
- package/src/components/combobox.tsx +18 -3
- package/src/components/command.tsx +644 -17
- package/src/components/date-picker.tsx +17 -3
- package/src/components/dialog.tsx +17 -4
- package/src/components/drawer.tsx +2 -2
- package/src/components/global-layout.tsx +15 -2
- package/src/components/input-chip.tsx +114 -66
- package/src/components/input-password.tsx +73 -49
- package/src/components/link.tsx +29 -17
- package/src/components/logo.tsx +10 -2
- package/src/components/map.tsx +597 -0
- package/src/components/pagination.tsx +44 -11
- package/src/components/rating.tsx +20 -2
- package/src/components/select.tsx +9 -1
- package/src/components/separator.tsx +40 -25
- package/src/components/sheet.tsx +28 -20
- package/src/components/skeleton.tsx +13 -2
- package/src/components/sonner.tsx +9 -3
- package/src/components/tabs.tsx +118 -22
- package/src/components/text-reveal-motion.tsx +7 -1
- package/src/components/typography.tsx +6 -7
- package/src/hooks/use-breakpoint.ts +2 -3
- package/src/index.ts +1 -0
package/dist/card.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import * as e from "react";
|
|
3
|
-
import { cva as
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
41
|
+
className: t,
|
|
41
42
|
variant: a = "filled",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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__ */
|
|
55
|
+
return /* @__PURE__ */ d(i.Provider, { value: { flush: C, density: r }, children: /* @__PURE__ */ d(
|
|
54
56
|
"div",
|
|
55
57
|
{
|
|
56
|
-
ref:
|
|
57
|
-
className:
|
|
58
|
-
"data-
|
|
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":
|
|
61
|
-
"data-tracking-label":
|
|
62
|
-
style: { ...
|
|
63
|
-
...
|
|
64
|
-
children:
|
|
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
|
|
71
|
-
({ className:
|
|
72
|
-
const { flush:
|
|
73
|
-
return /* @__PURE__ */
|
|
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:
|
|
77
|
-
className:
|
|
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
|
-
|
|
80
|
-
|
|
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
|
-
|
|
89
|
-
const
|
|
90
|
-
({ className:
|
|
91
|
+
v.displayName = "CardHeader";
|
|
92
|
+
const w = e.forwardRef(
|
|
93
|
+
({ className: t, ...a }, r) => /* @__PURE__ */ d(
|
|
91
94
|
"div",
|
|
92
95
|
{
|
|
93
|
-
ref:
|
|
94
|
-
className:
|
|
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
|
-
|
|
101
|
-
const
|
|
102
|
-
({ className:
|
|
103
|
+
w.displayName = "CardTitle";
|
|
104
|
+
const h = e.forwardRef(
|
|
105
|
+
({ className: t, ...a }, r) => /* @__PURE__ */ d(
|
|
103
106
|
"div",
|
|
104
107
|
{
|
|
105
|
-
ref:
|
|
106
|
-
className:
|
|
108
|
+
ref: r,
|
|
109
|
+
className: n(
|
|
107
110
|
"text-muted-foreground text-sm leading-normal font-normal",
|
|
108
|
-
|
|
111
|
+
t
|
|
109
112
|
),
|
|
110
113
|
"data-slot": "card-description",
|
|
111
114
|
...a
|
|
112
115
|
}
|
|
113
116
|
)
|
|
114
117
|
);
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
({ className:
|
|
118
|
+
h.displayName = "CardDescription";
|
|
119
|
+
const R = e.forwardRef(
|
|
120
|
+
({ className: t, ...a }, r) => /* @__PURE__ */ d(
|
|
118
121
|
"div",
|
|
119
122
|
{
|
|
120
|
-
ref:
|
|
121
|
-
className:
|
|
123
|
+
ref: r,
|
|
124
|
+
className: n(
|
|
122
125
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
123
|
-
|
|
126
|
+
t
|
|
124
127
|
),
|
|
125
128
|
"data-slot": "card-action",
|
|
126
129
|
...a
|
|
127
130
|
}
|
|
128
131
|
)
|
|
129
132
|
);
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
({ className:
|
|
133
|
-
const { flush:
|
|
134
|
-
return /* @__PURE__ */
|
|
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:
|
|
138
|
-
className:
|
|
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
|
-
|
|
146
|
-
const
|
|
147
|
-
({ className:
|
|
148
|
-
const { flush:
|
|
149
|
-
return /* @__PURE__ */
|
|
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:
|
|
153
|
-
className:
|
|
155
|
+
ref: r,
|
|
156
|
+
className: n(
|
|
154
157
|
"flex items-center",
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
167
|
+
j.displayName = "CardFooter";
|
|
165
168
|
export {
|
|
166
169
|
N as Card,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),Q=require("react"),W=require("embla-carousel-react"),O=require("@brightlocal/icons"),h=require("@brightlocal/ui-components/lib/utils"),E=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),M=r.createContext(null);function y(){const e=r.useContext(M);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}const q=r.forwardRef(({orientation:e="horizontal",opts:l,setApi:s,plugins:c,className:x,children:d,dataHook:f,trackingEl:o,trackingLabel:i,lazyLoad:n=!1,overscan:p=1,...b},v)=>{const[m,t]=W({...l,axis:e==="horizontal"?"x":"y"},c),[T,B]=r.useState(!1),[A,G]=r.useState(!1),N=Math.max(0,Math.floor(p)),[U,$]=r.useState(()=>{if(!n)return new Set;const a=l?.startIndex??0,w=new Set;for(let S=Math.max(0,a-N);S<=a+N;S++)w.add(S);return w}),g=r.useCallback(a=>{a&&(B(a.canScrollPrev()),G(a.canScrollNext()))},[]),k=r.useCallback(()=>{t?.scrollPrev()},[t]),j=r.useCallback(()=>{t?.scrollNext()},[t]),F=r.useCallback(a=>{const w=e==="horizontal"?"ArrowLeft":"ArrowUp",S=e==="horizontal"?"ArrowRight":"ArrowDown";a.key===w?(a.preventDefault(),k()):a.key===S&&(a.preventDefault(),j())},[e,k,j]);r.useEffect(()=>{!t||!s||s(t)},[t,s]),r.useEffect(()=>{if(t)return g(t),t.on("reInit",g),t.on("select",g),()=>{t?.off("reInit",g),t?.off("select",g)}},[t,g]);const C=r.useCallback(a=>{if(!a||!n)return;const w=a.slidesInView(),S=a.slideNodes().length;$(I=>{const P=new Set(I);for(const D of w){const H=Math.max(0,D-N),J=Math.min(S-1,D+N);for(let R=H;R<=J;R++)P.add(R)}return P.size===I.size?I:P})},[n,N]);return r.useEffect(()=>{if(!(!t||!n))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,n,C]),u.jsx(M.Provider,{value:{carouselRef:m,api:t,opts:l,orientation:e||(l?.axis==="y"?"vertical":"horizontal"),scrollPrev:k,scrollNext:j,canScrollPrev:T,canScrollNext:A,lazyLoad:n,loadedSlides:U},children:u.jsx("div",{ref:v,"aria-roledescription":"carousel",className:h.cn("relative",x),"data-hook":f,"data-slot":"carousel","data-tracking-el":o,"data-tracking-label":i,role:"region",onKeyDownCapture:F,...b,children:d})})});q.displayName="Carousel";const V=r.forwardRef(({className:e,children:l,...s},c)=>{const{carouselRef:x,orientation:d,lazyLoad:f}=y(),o=d==="vertical";let i=0;const n=f?r.Children.map(l,p=>{if(r.isValidElement(p)&&p.type===z){const b=i++;return r.cloneElement(p,{_lazyIndex:b})}return p}):l;return u.jsx("div",{ref:x,className:h.cn("overflow-hidden",o&&"w-full",e),"data-slot":"carousel-content",children:u.jsx("div",{ref:c,className:h.cn("flex",o?"-mt-4 h-full w-full flex-col":"-ml-4"),...s,children:n})})});V.displayName="CarouselContent";const z=r.forwardRef(({className:e,children:l,_lazyIndex:s,...c},x)=>{const{orientation:d,lazyLoad:f,loadedSlides:o}=y(),i=!f||s===void 0||o.has(s);return u.jsx("div",{ref:x,"aria-roledescription":"slide",className:h.cn("min-w-0 shrink-0 grow-0 basis-full",d==="horizontal"?"pl-4":"w-full pt-4",e),"data-lazy-loaded":f?String(i):void 0,"data-slot":"carousel-item",role:"group",...c,children:i?l:null})});z.displayName="CarouselItem";function K({className:e,variant:l="outline",size:s="default",dataHook:c="carousel-previous",hideWhenDisabled:x=!1,ariaLabel:d="Previous slide",...f}){const{orientation:o,scrollPrev:i,canScrollPrev:n}=y();return x&&!n?null:u.jsxs(E.Button,{iconOnly:!0,className:h.cn("absolute",o==="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,...f,children:[u.jsx(O.ArrowLeft,{}),u.jsx("span",{className:"sr-only",children:d})]})}K.displayName="CarouselPrevious";function _({className:e,variant:l="outline",size:s="default",dataHook:c="carousel-next",hideWhenDisabled:x=!1,ariaLabel:d="Next slide",...f}){const{orientation:o,scrollNext:i,canScrollNext:n}=y();return x&&!n?null:u.jsxs(E.Button,{iconOnly:!0,className:h.cn("absolute",o==="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,...f,children:[u.jsx(O.ArrowRight,{}),u.jsx("span",{className:"sr-only",children:d})]})}_.displayName="CarouselNext";function L({className:e,dataHook:l="carousel-dots",trackingEl:s,trackingLabel:c,ariaLabel:x="Slide navigation",slideAriaLabel:d,...f}){const{api:o}=y(),[i,n]=r.useState(0),[p,b]=r.useState([]);return r.useEffect(()=>{if(!o)return;b(o.scrollSnapList()),n(o.selectedScrollSnap());const v=()=>{n(o.selectedScrollSnap())},m=()=>{b(o.scrollSnapList()),n(o.selectedScrollSnap())};return o.on("select",v),o.on("reInit",m),()=>{o.off("select",v),o.off("reInit",m)}},[o]),p.length===0?null:u.jsx("div",{"aria-label":x,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",...f,children:p.map((v,m)=>u.jsx("button",{"aria-current":m===i?"step":void 0,"aria-label":d?d.replace("{slide}",String(m+1)):`Go to slide ${m+1}`,className:h.cn("focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",m===i?"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(m)},m))})}L.displayName="CarouselDots";exports.Carousel=q;exports.CarouselContent=V;exports.CarouselDots=L;exports.CarouselItem=z;exports.CarouselNext=_;exports.CarouselPrevious=K;
|
package/dist/carousel.d.ts
CHANGED
|
@@ -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<
|
|
66
|
+
declare const CarouselItem: React.ForwardRefExoticComponent<React.ComponentPropsWithoutRef<"div"> & React.RefAttributes<HTMLDivElement>>;
|
|
55
67
|
/**
|
|
56
68
|
* Props for CarouselPrevious component.
|
|
57
69
|
*/
|
|
@@ -76,11 +88,16 @@ interface CarouselPreviousProps extends Omit<ButtonProps, "variant" | "size" | "
|
|
|
76
88
|
* @default false
|
|
77
89
|
*/
|
|
78
90
|
hideWhenDisabled?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Accessible label for the previous slide button.
|
|
93
|
+
* @default "Previous slide"
|
|
94
|
+
*/
|
|
95
|
+
ariaLabel?: string;
|
|
79
96
|
}
|
|
80
97
|
/**
|
|
81
98
|
* Button to navigate to the previous slide.
|
|
82
99
|
*/
|
|
83
|
-
declare function CarouselPrevious({ className, variant, size, dataHook, hideWhenDisabled, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element | null;
|
|
100
|
+
declare function CarouselPrevious({ className, variant, size, dataHook, hideWhenDisabled, ariaLabel, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element | null;
|
|
84
101
|
declare namespace CarouselPrevious {
|
|
85
102
|
var displayName: string;
|
|
86
103
|
}
|
|
@@ -108,11 +125,16 @@ interface CarouselNextProps extends Omit<ButtonProps, "variant" | "size" | "data
|
|
|
108
125
|
* @default false
|
|
109
126
|
*/
|
|
110
127
|
hideWhenDisabled?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Accessible label for the next slide button.
|
|
130
|
+
* @default "Next slide"
|
|
131
|
+
*/
|
|
132
|
+
ariaLabel?: string;
|
|
111
133
|
}
|
|
112
134
|
/**
|
|
113
135
|
* Button to navigate to the next slide.
|
|
114
136
|
*/
|
|
115
|
-
declare function CarouselNext({ className, variant, size, dataHook, hideWhenDisabled, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
137
|
+
declare function CarouselNext({ className, variant, size, dataHook, hideWhenDisabled, ariaLabel, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
116
138
|
declare namespace CarouselNext {
|
|
117
139
|
var displayName: string;
|
|
118
140
|
}
|
|
@@ -133,12 +155,23 @@ interface CarouselDotsProps extends React.ComponentProps<"div"> {
|
|
|
133
155
|
* Tracking label for analytics context
|
|
134
156
|
*/
|
|
135
157
|
trackingLabel?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Accessible label for the slide navigation group.
|
|
160
|
+
* @default "Slide navigation"
|
|
161
|
+
*/
|
|
162
|
+
ariaLabel?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Accessible label for each slide dot button.
|
|
165
|
+
* Supports `{slide}` placeholder for interpolation (1-based).
|
|
166
|
+
* @default "Go to slide {slide}"
|
|
167
|
+
*/
|
|
168
|
+
slideAriaLabel?: string;
|
|
136
169
|
}
|
|
137
170
|
/**
|
|
138
171
|
* Dot/pill pagination indicator for the carousel.
|
|
139
172
|
* Active slide is shown as an elongated pill, inactive slides as circles.
|
|
140
173
|
*/
|
|
141
|
-
declare function CarouselDots({ className, dataHook, trackingEl, trackingLabel, ...props }: CarouselDotsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
174
|
+
declare function CarouselDots({ className, dataHook, trackingEl, trackingLabel, ariaLabel, slideAriaLabel, ...props }: CarouselDotsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
142
175
|
declare namespace CarouselDots {
|
|
143
176
|
var displayName: string;
|
|
144
177
|
}
|
package/dist/carousel.d.ts.map
CHANGED
|
@@ -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;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;
|
|
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,M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