@brightlocal/ui-components 2.2.0 → 2.3.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/AI_USAGE.md +1 -1
- package/README.md +3 -3
- package/component-meta.json +54 -10
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +380 -196
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +452 -449
- package/dist/callout.cjs +1 -0
- package/dist/callout.d.ts +51 -0
- package/dist/callout.d.ts.map +1 -0
- package/dist/callout.js +114 -0
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +40 -4
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +156 -101
- 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 +436 -426
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +1 -1
- package/dist/sheet.d.ts +1 -1
- package/package.json +1 -1
- package/src/blocks/data-table.tsx +865 -679
- package/src/components/callout.tsx +182 -0
- package/src/components/carousel.tsx +121 -3
- package/src/components/input-group.tsx +1 -1
- package/src/index.ts +1 -0
package/dist/callout.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),y=require("react"),C=require("class-variance-authority"),n=require("@brightlocal/ui-components/lib/utils");function v(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const l=v(y),s=C.cva("relative rounded-2xl p-12 shadow-lg",{variants:{variant:{primary:"bg-primary text-primary-foreground",purple:"bg-violet-300 text-violet-950",blue:"bg-sky-300 text-sky-950",green:"bg-green-200 text-green-950"}},defaultVariants:{variant:"primary"}}),h={primary:"text-primary-foreground/80",purple:"text-violet-800",blue:"text-sky-900",green:"text-green-900"},j={primary:"bg-primary",purple:"bg-violet-300",blue:"bg-sky-300",green:"bg-green-200"},k={bottom:"left-1/2 -bottom-2 -translate-x-1/2",top:"left-1/2 -top-2 -translate-x-1/2",left:"top-1/2 -left-2 -translate-y-1/2",right:"top-1/2 -right-2 -translate-y-1/2"},c=l.createContext({variant:"primary"}),u=l.forwardRef(({className:e,variant:t="primary",pointer:a="bottom",children:o,dataHook:i,trackingEl:g,trackingLabel:m,...f},x)=>{const b=l.useMemo(()=>({variant:t}),[t]);return r.jsx(c.Provider,{value:b,children:r.jsxs("div",{ref:x,className:n.cn(s({variant:t}),e),"data-hook":i,"data-slot":"callout","data-tracking-el":g||`callout-${t}`,"data-tracking-label":m,...f,children:[r.jsx("div",{className:"flex flex-col gap-8",children:o}),a!=="none"&&r.jsx("span",{"aria-hidden":"true",className:n.cn("pointer-events-none absolute size-4 rotate-45",k[a],j[t]),"data-slot":"callout-pointer"})]})})});u.displayName="Callout";const d=l.forwardRef(({className:e,dataHook:t,...a},o)=>r.jsx("div",{ref:o,className:n.cn("heading-lg font-semibold",e),"data-hook":t,"data-slot":"callout-heading",...a}));d.displayName="CalloutHeading";const p=l.forwardRef(({className:e,dataHook:t,...a},o)=>{const{variant:i}=l.useContext(c);return r.jsx("div",{ref:o,className:n.cn("text-xs font-medium",h[i],e),"data-hook":t,"data-slot":"callout-citation",...a})});p.displayName="CalloutCitation";exports.Callout=u;exports.CalloutCitation=p;exports.CalloutHeading=d;exports.calloutVariants=s;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** Available color variants for the Callout component */
|
|
3
|
+
type CalloutVariant = "primary" | "purple" | "blue" | "green";
|
|
4
|
+
/** Pointer/caret position for the Callout speech bubble */
|
|
5
|
+
type CalloutPointer = "top" | "bottom" | "left" | "right" | "none";
|
|
6
|
+
declare const calloutVariants: (props?: ({
|
|
7
|
+
variant?: "primary" | "purple" | "blue" | "green" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
|
+
/** Props for the Callout component */
|
|
10
|
+
interface CalloutProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
11
|
+
/** Required test hook identifier */
|
|
12
|
+
dataHook: string;
|
|
13
|
+
/**
|
|
14
|
+
* Color variant
|
|
15
|
+
* @default "primary"
|
|
16
|
+
*/
|
|
17
|
+
variant?: CalloutVariant;
|
|
18
|
+
/**
|
|
19
|
+
* Pointer/caret direction
|
|
20
|
+
* @default "bottom"
|
|
21
|
+
*/
|
|
22
|
+
pointer?: CalloutPointer;
|
|
23
|
+
/** Analytics element identifier */
|
|
24
|
+
trackingEl?: string;
|
|
25
|
+
/** Analytics label */
|
|
26
|
+
trackingLabel?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Speech bubble callout for highlighting key statements or quotes.
|
|
30
|
+
* Supports 4 color variants and configurable pointer direction.
|
|
31
|
+
*
|
|
32
|
+
* Use with `CalloutHeading` and optionally `CalloutCitation` as children.
|
|
33
|
+
*/
|
|
34
|
+
declare const Callout: React.ForwardRefExoticComponent<CalloutProps & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
/** Props for the CalloutHeading sub-component */
|
|
36
|
+
interface CalloutHeadingProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
37
|
+
/** Optional test hook identifier */
|
|
38
|
+
dataHook?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Main heading/statement content for a Callout */
|
|
41
|
+
declare const CalloutHeading: React.ForwardRefExoticComponent<CalloutHeadingProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
/** Props for the CalloutCitation sub-component */
|
|
43
|
+
interface CalloutCitationProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
44
|
+
/** Optional test hook identifier */
|
|
45
|
+
dataHook?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Citation/attribution text for a Callout. Auto-styles based on parent variant. */
|
|
48
|
+
declare const CalloutCitation: React.ForwardRefExoticComponent<CalloutCitationProps & React.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
export { Callout, CalloutHeading, CalloutCitation, calloutVariants };
|
|
50
|
+
export type { CalloutProps, CalloutHeadingProps, CalloutCitationProps, CalloutVariant, CalloutPointer, };
|
|
51
|
+
//# sourceMappingURL=callout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,yDAAyD;AACzD,KAAK,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9D,2DAA2D;AAC3D,KAAK,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnE,QAAA,MAAM,eAAe;;8EAYnB,CAAC;AA4BH,sCAAsC;AACtC,UAAU,YAAa,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAClE,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,QAAA,MAAM,OAAO,qFA2CZ,CAAC;AAIF,iDAAiD;AACjD,UAAU,mBAAoB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IACzE,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,mDAAmD;AACnD,QAAA,MAAM,cAAc,4FAUnB,CAAC;AAIF,kDAAkD;AAClD,UAAU,oBAAqB,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC1E,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,oFAAoF;AACpF,QAAA,MAAM,eAAe,6FAkBpB,CAAC;AAIF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AACrE,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,cAAc,GACf,CAAC"}
|
package/dist/callout.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as l, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { cva as x } from "class-variance-authority";
|
|
4
|
+
import { cn as n } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
const f = x("relative rounded-2xl p-12 shadow-lg", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
primary: "bg-primary text-primary-foreground",
|
|
9
|
+
purple: "bg-violet-300 text-violet-950",
|
|
10
|
+
blue: "bg-sky-300 text-sky-950",
|
|
11
|
+
green: "bg-green-200 text-green-950"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
variant: "primary"
|
|
16
|
+
}
|
|
17
|
+
}), y = {
|
|
18
|
+
primary: "text-primary-foreground/80",
|
|
19
|
+
purple: "text-violet-800",
|
|
20
|
+
blue: "text-sky-900",
|
|
21
|
+
green: "text-green-900"
|
|
22
|
+
}, b = {
|
|
23
|
+
primary: "bg-primary",
|
|
24
|
+
purple: "bg-violet-300",
|
|
25
|
+
blue: "bg-sky-300",
|
|
26
|
+
green: "bg-green-200"
|
|
27
|
+
}, v = {
|
|
28
|
+
bottom: "left-1/2 -bottom-2 -translate-x-1/2",
|
|
29
|
+
top: "left-1/2 -top-2 -translate-x-1/2",
|
|
30
|
+
left: "top-1/2 -left-2 -translate-y-1/2",
|
|
31
|
+
right: "top-1/2 -right-2 -translate-y-1/2"
|
|
32
|
+
}, s = e.createContext({
|
|
33
|
+
variant: "primary"
|
|
34
|
+
}), C = e.forwardRef(
|
|
35
|
+
({
|
|
36
|
+
className: o,
|
|
37
|
+
variant: t = "primary",
|
|
38
|
+
pointer: a = "bottom",
|
|
39
|
+
children: r,
|
|
40
|
+
dataHook: i,
|
|
41
|
+
trackingEl: p,
|
|
42
|
+
trackingLabel: d,
|
|
43
|
+
...c
|
|
44
|
+
}, m) => {
|
|
45
|
+
const u = e.useMemo(() => ({ variant: t }), [t]);
|
|
46
|
+
return /* @__PURE__ */ l(s.Provider, { value: u, children: /* @__PURE__ */ g(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
ref: m,
|
|
50
|
+
className: n(f({ variant: t }), o),
|
|
51
|
+
"data-hook": i,
|
|
52
|
+
"data-slot": "callout",
|
|
53
|
+
"data-tracking-el": p || `callout-${t}`,
|
|
54
|
+
"data-tracking-label": d,
|
|
55
|
+
...c,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col gap-8", children: r }),
|
|
58
|
+
a !== "none" && /* @__PURE__ */ l(
|
|
59
|
+
"span",
|
|
60
|
+
{
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
className: n(
|
|
63
|
+
"pointer-events-none absolute size-4 rotate-45",
|
|
64
|
+
v[a],
|
|
65
|
+
b[t]
|
|
66
|
+
),
|
|
67
|
+
"data-slot": "callout-pointer"
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
C.displayName = "Callout";
|
|
76
|
+
const h = e.forwardRef(
|
|
77
|
+
({ className: o, dataHook: t, ...a }, r) => /* @__PURE__ */ l(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
ref: r,
|
|
81
|
+
className: n("heading-lg font-semibold", o),
|
|
82
|
+
"data-hook": t,
|
|
83
|
+
"data-slot": "callout-heading",
|
|
84
|
+
...a
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
h.displayName = "CalloutHeading";
|
|
89
|
+
const k = e.forwardRef(
|
|
90
|
+
({ className: o, dataHook: t, ...a }, r) => {
|
|
91
|
+
const { variant: i } = e.useContext(s);
|
|
92
|
+
return /* @__PURE__ */ l(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
ref: r,
|
|
96
|
+
className: n(
|
|
97
|
+
"text-xs font-medium",
|
|
98
|
+
y[i],
|
|
99
|
+
o
|
|
100
|
+
),
|
|
101
|
+
"data-hook": t,
|
|
102
|
+
"data-slot": "callout-citation",
|
|
103
|
+
...a
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
k.displayName = "CalloutCitation";
|
|
109
|
+
export {
|
|
110
|
+
C as Callout,
|
|
111
|
+
k as CalloutCitation,
|
|
112
|
+
h as CalloutHeading,
|
|
113
|
+
f as calloutVariants
|
|
114
|
+
};
|
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 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;
|
package/dist/carousel.d.ts
CHANGED
|
@@ -71,11 +71,16 @@ interface CarouselPreviousProps extends Omit<ButtonProps, "variant" | "size" | "
|
|
|
71
71
|
* @default "carousel-previous"
|
|
72
72
|
*/
|
|
73
73
|
dataHook?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Hide the button instead of disabling it when there are no previous slides
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
hideWhenDisabled?: boolean;
|
|
74
79
|
}
|
|
75
80
|
/**
|
|
76
81
|
* Button to navigate to the previous slide.
|
|
77
82
|
*/
|
|
78
|
-
declare function CarouselPrevious({ className, variant, size, dataHook, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
declare function CarouselPrevious({ className, variant, size, dataHook, hideWhenDisabled, ...props }: CarouselPreviousProps): import("react/jsx-runtime").JSX.Element | null;
|
|
79
84
|
declare namespace CarouselPrevious {
|
|
80
85
|
var displayName: string;
|
|
81
86
|
}
|
|
@@ -98,14 +103,45 @@ interface CarouselNextProps extends Omit<ButtonProps, "variant" | "size" | "data
|
|
|
98
103
|
* @default "carousel-next"
|
|
99
104
|
*/
|
|
100
105
|
dataHook?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Hide the button instead of disabling it when there are no next slides
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
hideWhenDisabled?: boolean;
|
|
101
111
|
}
|
|
102
112
|
/**
|
|
103
113
|
* Button to navigate to the next slide.
|
|
104
114
|
*/
|
|
105
|
-
declare function CarouselNext({ className, variant, size, dataHook, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element;
|
|
115
|
+
declare function CarouselNext({ className, variant, size, dataHook, hideWhenDisabled, ...props }: CarouselNextProps): import("react/jsx-runtime").JSX.Element | null;
|
|
106
116
|
declare namespace CarouselNext {
|
|
107
117
|
var displayName: string;
|
|
108
118
|
}
|
|
109
|
-
|
|
110
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Props for CarouselDots component.
|
|
121
|
+
*/
|
|
122
|
+
interface CarouselDotsProps extends React.ComponentProps<"div"> {
|
|
123
|
+
/**
|
|
124
|
+
* Data hook for automated testing
|
|
125
|
+
* @default "carousel-dots"
|
|
126
|
+
*/
|
|
127
|
+
dataHook?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Tracking element identifier for analytics
|
|
130
|
+
*/
|
|
131
|
+
trackingEl?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Tracking label for analytics context
|
|
134
|
+
*/
|
|
135
|
+
trackingLabel?: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Dot/pill pagination indicator for the carousel.
|
|
139
|
+
* Active slide is shown as an elongated pill, inactive slides as circles.
|
|
140
|
+
*/
|
|
141
|
+
declare function CarouselDots({ className, dataHook, trackingEl, trackingLabel, ...props }: CarouselDotsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
142
|
+
declare namespace CarouselDots {
|
|
143
|
+
var displayName: string;
|
|
144
|
+
}
|
|
145
|
+
export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, CarouselDots, };
|
|
146
|
+
export type { CarouselProps, CarouselPreviousProps, CarouselNextProps, CarouselDotsProps, };
|
|
111
147
|
//# sourceMappingURL=carousel.d.ts.map
|
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,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AAS,YAAY,CAAC,EACpB,SAAS,EACT,QAA0B,EAC1B,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,iBAAiB,kDA+DnB;kBArEQ,YAAY;;;AAyErB,OAAO,EACL,KAAK,WAAW,EAChB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,CAAC;AAEF,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAClB,CAAC"}
|
package/dist/carousel.js
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as S } from "react/jsx-runtime";
|
|
2
2
|
import * as o from "react";
|
|
3
3
|
import E from "embla-carousel-react";
|
|
4
|
-
import { ArrowRight as
|
|
5
|
-
import { cn as
|
|
4
|
+
import { ArrowRight as A, ArrowLeft as K } from "@brightlocal/icons";
|
|
5
|
+
import { cn as p } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
import { Button as N } from "@brightlocal/ui-components/button";
|
|
7
|
-
const
|
|
7
|
+
const w = o.createContext(null);
|
|
8
8
|
function C() {
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
9
|
+
const t = o.useContext(w);
|
|
10
|
+
if (!t)
|
|
11
11
|
throw new Error("useCarousel must be used within a <Carousel />");
|
|
12
|
-
return
|
|
12
|
+
return t;
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const L = o.forwardRef(
|
|
15
15
|
({
|
|
16
|
-
orientation:
|
|
16
|
+
orientation: t = "horizontal",
|
|
17
17
|
opts: l,
|
|
18
|
-
setApi:
|
|
19
|
-
plugins:
|
|
18
|
+
setApi: a,
|
|
19
|
+
plugins: s,
|
|
20
20
|
className: i,
|
|
21
|
-
children:
|
|
22
|
-
dataHook:
|
|
23
|
-
trackingEl:
|
|
24
|
-
trackingLabel:
|
|
25
|
-
...
|
|
21
|
+
children: e,
|
|
22
|
+
dataHook: f,
|
|
23
|
+
trackingEl: d,
|
|
24
|
+
trackingLabel: c,
|
|
25
|
+
...g
|
|
26
26
|
}, b) => {
|
|
27
|
-
const [
|
|
27
|
+
const [u, r] = E(
|
|
28
28
|
{
|
|
29
29
|
...l,
|
|
30
|
-
axis:
|
|
30
|
+
axis: t === "horizontal" ? "x" : "y"
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
), [
|
|
34
|
-
|
|
35
|
-
}, []),
|
|
32
|
+
s
|
|
33
|
+
), [y, k] = o.useState(!1), [P, z] = o.useState(!1), h = o.useCallback((m) => {
|
|
34
|
+
m && (k(m.canScrollPrev()), z(m.canScrollNext()));
|
|
35
|
+
}, []), v = o.useCallback(() => {
|
|
36
36
|
r?.scrollPrev();
|
|
37
|
-
}, [r]),
|
|
37
|
+
}, [r]), x = o.useCallback(() => {
|
|
38
38
|
r?.scrollNext();
|
|
39
|
-
}, [r]),
|
|
40
|
-
(
|
|
41
|
-
const
|
|
42
|
-
|
|
39
|
+
}, [r]), I = o.useCallback(
|
|
40
|
+
(m) => {
|
|
41
|
+
const R = t === "horizontal" ? "ArrowLeft" : "ArrowUp", D = t === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
42
|
+
m.key === R ? (m.preventDefault(), v()) : m.key === D && (m.preventDefault(), x());
|
|
43
43
|
},
|
|
44
|
-
[
|
|
44
|
+
[t, v, x]
|
|
45
45
|
);
|
|
46
46
|
return o.useEffect(() => {
|
|
47
|
-
!r || !
|
|
48
|
-
}, [r,
|
|
47
|
+
!r || !a || a(r);
|
|
48
|
+
}, [r, a]), o.useEffect(() => {
|
|
49
49
|
if (r)
|
|
50
|
-
return
|
|
51
|
-
r?.off("reInit",
|
|
50
|
+
return h(r), r.on("reInit", h), r.on("select", h), () => {
|
|
51
|
+
r?.off("reInit", h), r?.off("select", h);
|
|
52
52
|
};
|
|
53
|
-
}, [r,
|
|
54
|
-
|
|
53
|
+
}, [r, h]), /* @__PURE__ */ n(
|
|
54
|
+
w.Provider,
|
|
55
55
|
{
|
|
56
56
|
value: {
|
|
57
|
-
carouselRef:
|
|
57
|
+
carouselRef: u,
|
|
58
58
|
api: r,
|
|
59
59
|
opts: l,
|
|
60
|
-
orientation:
|
|
61
|
-
scrollPrev:
|
|
62
|
-
scrollNext:
|
|
63
|
-
canScrollPrev:
|
|
64
|
-
canScrollNext:
|
|
60
|
+
orientation: t || (l?.axis === "y" ? "vertical" : "horizontal"),
|
|
61
|
+
scrollPrev: v,
|
|
62
|
+
scrollNext: x,
|
|
63
|
+
canScrollPrev: y,
|
|
64
|
+
canScrollNext: P
|
|
65
65
|
},
|
|
66
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ n(
|
|
67
67
|
"div",
|
|
68
68
|
{
|
|
69
69
|
ref: b,
|
|
70
70
|
"aria-roledescription": "carousel",
|
|
71
|
-
className:
|
|
72
|
-
"data-hook":
|
|
71
|
+
className: p("relative", i),
|
|
72
|
+
"data-hook": f,
|
|
73
73
|
"data-slot": "carousel",
|
|
74
|
-
"data-tracking-el":
|
|
75
|
-
"data-tracking-label":
|
|
74
|
+
"data-tracking-el": d,
|
|
75
|
+
"data-tracking-label": c,
|
|
76
76
|
role: "region",
|
|
77
|
-
onKeyDownCapture:
|
|
78
|
-
...
|
|
79
|
-
children:
|
|
77
|
+
onKeyDownCapture: I,
|
|
78
|
+
...g,
|
|
79
|
+
children: e
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
const { carouselRef:
|
|
89
|
-
return /* @__PURE__ */
|
|
86
|
+
L.displayName = "Carousel";
|
|
87
|
+
const j = o.forwardRef(({ className: t, ...l }, a) => {
|
|
88
|
+
const { carouselRef: s, orientation: i } = C(), e = i === "vertical";
|
|
89
|
+
return /* @__PURE__ */ n(
|
|
90
90
|
"div",
|
|
91
91
|
{
|
|
92
|
-
ref:
|
|
93
|
-
className:
|
|
92
|
+
ref: s,
|
|
93
|
+
className: p("overflow-hidden", e && "w-full", t),
|
|
94
94
|
"data-slot": "carousel-content",
|
|
95
|
-
children: /* @__PURE__ */
|
|
95
|
+
children: /* @__PURE__ */ n(
|
|
96
96
|
"div",
|
|
97
97
|
{
|
|
98
|
-
ref:
|
|
99
|
-
className:
|
|
98
|
+
ref: a,
|
|
99
|
+
className: p(
|
|
100
100
|
"flex",
|
|
101
|
-
|
|
101
|
+
e ? "-mt-4 h-full w-full flex-col" : "-ml-4"
|
|
102
102
|
),
|
|
103
103
|
...l
|
|
104
104
|
}
|
|
@@ -106,18 +106,18 @@ const L = o.forwardRef(({ className: e, ...l }, t) => {
|
|
|
106
106
|
}
|
|
107
107
|
);
|
|
108
108
|
});
|
|
109
|
-
|
|
110
|
-
const O = o.forwardRef(({ className:
|
|
111
|
-
const { orientation:
|
|
112
|
-
return /* @__PURE__ */
|
|
109
|
+
j.displayName = "CarouselContent";
|
|
110
|
+
const O = o.forwardRef(({ className: t, ...l }, a) => {
|
|
111
|
+
const { orientation: s } = C();
|
|
112
|
+
return /* @__PURE__ */ n(
|
|
113
113
|
"div",
|
|
114
114
|
{
|
|
115
|
-
ref:
|
|
115
|
+
ref: a,
|
|
116
116
|
"aria-roledescription": "slide",
|
|
117
|
-
className:
|
|
117
|
+
className: p(
|
|
118
118
|
"min-w-0 shrink-0 grow-0 basis-full",
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
s === "horizontal" ? "pl-4" : "w-full pt-4",
|
|
120
|
+
t
|
|
121
121
|
),
|
|
122
122
|
"data-slot": "carousel-item",
|
|
123
123
|
role: "group",
|
|
@@ -127,73 +127,128 @@ const O = o.forwardRef(({ className: e, ...l }, t) => {
|
|
|
127
127
|
});
|
|
128
128
|
O.displayName = "CarouselItem";
|
|
129
129
|
function B({
|
|
130
|
-
className:
|
|
130
|
+
className: t,
|
|
131
131
|
variant: l = "outline",
|
|
132
|
-
size:
|
|
133
|
-
dataHook:
|
|
134
|
-
|
|
132
|
+
size: a = "default",
|
|
133
|
+
dataHook: s = "carousel-previous",
|
|
134
|
+
hideWhenDisabled: i = !1,
|
|
135
|
+
...e
|
|
135
136
|
}) {
|
|
136
|
-
const { orientation:
|
|
137
|
-
return /* @__PURE__ */
|
|
137
|
+
const { orientation: f, scrollPrev: d, canScrollPrev: c } = C();
|
|
138
|
+
return i && !c ? null : /* @__PURE__ */ S(
|
|
138
139
|
N,
|
|
139
140
|
{
|
|
140
141
|
iconOnly: !0,
|
|
141
|
-
className:
|
|
142
|
+
className: p(
|
|
142
143
|
"absolute",
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
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",
|
|
145
|
+
t
|
|
145
146
|
),
|
|
146
147
|
"data-slot": "carousel-previous",
|
|
147
|
-
dataHook:
|
|
148
|
-
disabled: !
|
|
149
|
-
size:
|
|
148
|
+
dataHook: s,
|
|
149
|
+
disabled: !c,
|
|
150
|
+
size: a,
|
|
150
151
|
variant: l,
|
|
151
152
|
onClick: d,
|
|
152
|
-
...
|
|
153
|
+
...e,
|
|
153
154
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ n(K, {}),
|
|
156
|
+
/* @__PURE__ */ n("span", { className: "sr-only", children: "Previous slide" })
|
|
156
157
|
]
|
|
157
158
|
}
|
|
158
159
|
);
|
|
159
160
|
}
|
|
160
161
|
B.displayName = "CarouselPrevious";
|
|
161
|
-
function
|
|
162
|
-
className:
|
|
162
|
+
function G({
|
|
163
|
+
className: t,
|
|
163
164
|
variant: l = "outline",
|
|
164
|
-
size:
|
|
165
|
-
dataHook:
|
|
166
|
-
|
|
165
|
+
size: a = "default",
|
|
166
|
+
dataHook: s = "carousel-next",
|
|
167
|
+
hideWhenDisabled: i = !1,
|
|
168
|
+
...e
|
|
167
169
|
}) {
|
|
168
|
-
const { orientation:
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
+
const { orientation: f, scrollNext: d, canScrollNext: c } = C();
|
|
171
|
+
return i && !c ? null : /* @__PURE__ */ S(
|
|
170
172
|
N,
|
|
171
173
|
{
|
|
172
174
|
iconOnly: !0,
|
|
173
|
-
className:
|
|
175
|
+
className: p(
|
|
174
176
|
"absolute",
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
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",
|
|
178
|
+
t
|
|
177
179
|
),
|
|
178
180
|
"data-slot": "carousel-next",
|
|
179
|
-
dataHook:
|
|
180
|
-
disabled: !
|
|
181
|
-
size:
|
|
181
|
+
dataHook: s,
|
|
182
|
+
disabled: !c,
|
|
183
|
+
size: a,
|
|
182
184
|
variant: l,
|
|
183
185
|
onClick: d,
|
|
184
|
-
...
|
|
186
|
+
...e,
|
|
185
187
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ n(A, {}),
|
|
189
|
+
/* @__PURE__ */ n("span", { className: "sr-only", children: "Next slide" })
|
|
188
190
|
]
|
|
189
191
|
}
|
|
190
192
|
);
|
|
191
193
|
}
|
|
192
|
-
|
|
194
|
+
G.displayName = "CarouselNext";
|
|
195
|
+
function T({
|
|
196
|
+
className: t,
|
|
197
|
+
dataHook: l = "carousel-dots",
|
|
198
|
+
trackingEl: a,
|
|
199
|
+
trackingLabel: s,
|
|
200
|
+
...i
|
|
201
|
+
}) {
|
|
202
|
+
const { api: e } = C(), [f, d] = o.useState(0), [c, g] = o.useState([]);
|
|
203
|
+
return o.useEffect(() => {
|
|
204
|
+
if (!e) return;
|
|
205
|
+
g(e.scrollSnapList()), d(e.selectedScrollSnap());
|
|
206
|
+
const b = () => {
|
|
207
|
+
d(e.selectedScrollSnap());
|
|
208
|
+
}, u = () => {
|
|
209
|
+
g(e.scrollSnapList()), d(e.selectedScrollSnap());
|
|
210
|
+
};
|
|
211
|
+
return e.on("select", b), e.on("reInit", u), () => {
|
|
212
|
+
e.off("select", b), e.off("reInit", u);
|
|
213
|
+
};
|
|
214
|
+
}, [e]), c.length === 0 ? null : /* @__PURE__ */ n(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
"aria-label": "Slide navigation",
|
|
218
|
+
className: p(
|
|
219
|
+
"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",
|
|
220
|
+
t
|
|
221
|
+
),
|
|
222
|
+
"data-hook": l,
|
|
223
|
+
"data-slot": "carousel-dots",
|
|
224
|
+
"data-tracking-el": a,
|
|
225
|
+
"data-tracking-label": s,
|
|
226
|
+
role: "group",
|
|
227
|
+
...i,
|
|
228
|
+
children: c.map((b, u) => /* @__PURE__ */ n(
|
|
229
|
+
"button",
|
|
230
|
+
{
|
|
231
|
+
"aria-current": u === f ? "step" : void 0,
|
|
232
|
+
"aria-label": `Go to slide ${u + 1}`,
|
|
233
|
+
className: p(
|
|
234
|
+
"focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",
|
|
235
|
+
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"
|
|
236
|
+
),
|
|
237
|
+
"data-slot": "carousel-dot",
|
|
238
|
+
type: "button",
|
|
239
|
+
onClick: () => e?.scrollTo(u)
|
|
240
|
+
},
|
|
241
|
+
u
|
|
242
|
+
))
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
T.displayName = "CarouselDots";
|
|
193
247
|
export {
|
|
194
|
-
|
|
195
|
-
|
|
248
|
+
L as Carousel,
|
|
249
|
+
j as CarouselContent,
|
|
250
|
+
T as CarouselDots,
|
|
196
251
|
O as CarouselItem,
|
|
197
|
-
|
|
252
|
+
G as CarouselNext,
|
|
198
253
|
B as CarouselPrevious
|
|
199
254
|
};
|