@brightlocal/ui-components 0.2.0 → 0.3.1
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/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +10 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +6 -2
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +6 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +89 -73
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +49 -25
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +57 -32
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/chip.cjs +1 -0
- package/dist/chip.d.ts +61 -0
- package/dist/chip.d.ts.map +1 -0
- package/dist/chip.js +165 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +5 -2
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +89 -52
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +228 -210
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/header.cjs +1 -0
- package/dist/header.d.ts +42 -0
- package/dist/header.d.ts.map +1 -0
- package/dist/header.js +22 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +426 -396
- package/dist/input-chip.cjs +1 -0
- package/dist/input-chip.d.ts +117 -0
- package/dist/input-chip.d.ts.map +1 -0
- package/dist/input-chip.js +284 -0
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +43 -36
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +140 -119
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +147 -19
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +197 -92
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +10 -0
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +45 -36
- package/dist/select.d.ts.map +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.d.ts +31 -3
- package/dist/slider.d.ts.map +1 -1
- package/dist/slider.js +53 -43
- package/dist/textarea.d.ts.map +1 -1
- package/package.json +23 -24
- package/src/components/alert.tsx +10 -1
- package/src/components/card.tsx +66 -38
- package/src/components/centred-layout.tsx +115 -38
- package/src/components/checkbox.tsx +2 -2
- package/src/components/chip.tsx +249 -0
- package/src/components/combobox.tsx +17 -13
- package/src/components/date-picker.tsx +410 -266
- package/src/components/dropdown-menu.tsx +6 -1
- package/src/components/header.tsx +69 -0
- package/src/components/input-chip.tsx +548 -0
- package/src/components/input-group.tsx +4 -1
- package/src/components/input-otp.tsx +159 -91
- package/src/components/input-password.tsx +469 -129
- package/src/components/input.tsx +1 -1
- package/src/components/progress.tsx +21 -2
- package/src/components/select.tsx +1 -3
- package/src/components/slider.tsx +85 -15
- package/src/components/textarea.tsx +4 -1
- package/src/index.ts +3 -0
package/dist/alert.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),j=require("class-variance-authority"),o=require("@brightlocal/icons"),g=require("@brightlocal/ui-components/lib/utils");function m(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(a,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return a.default=t,Object.freeze(a)}const u=m(v),f=j.cva("relative w-full rounded-lg px-4 py-3 text-sm flex gap-3 items-start [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:translate-y-0.5",{variants:{variant:{default:"bg-neutral-100 text-neutral-900 [&>svg]:text-neutral-900 dark:bg-neutral-800 dark:text-neutral-100 dark:[&>svg]:text-neutral-100",success:"bg-green-200 text-green-900 [&>svg]:text-green-900 dark:bg-green-950 dark:text-green-200 dark:[&>svg]:text-green-200",info:"bg-cyan-200 text-cyan-900 [&>svg]:text-cyan-900 dark:bg-cyan-900 dark:text-cyan-200 dark:[&>svg]:text-cyan-200",destructive:"bg-red-300 text-red-950 [&>svg]:text-red-950 dark:bg-red-950 dark:text-red-300 dark:[&>svg]:text-red-300",warning:"bg-orange-200 text-amber-900 [&>svg]:text-amber-900 dark:bg-amber-900 dark:text-orange-200 dark:[&>svg]:text-orange-200"}},defaultVariants:{variant:"default"}}),c=u.forwardRef(({className:t,variant:a,...r},n)=>e.jsx("div",{ref:n,className:g.cn(f({variant:a}),t),"data-slot":"alert","data-tracking-el":`alert-${a}`,role:"alert",...r}));c.displayName="Alert";const d=u.forwardRef(({className:t,...a},r)=>e.jsx("div",{ref:r,className:g.cn("overflow-hidden leading-5 font-medium text-ellipsis whitespace-nowrap",t),"data-slot":"alert-title",...a}));d.displayName="AlertTitle";const x=u.forwardRef(({className:t,...a},r)=>e.jsx("div",{ref:r,className:g.cn("text-sm leading-5 [&_p]:leading-5",t),"data-slot":"alert-description",...a}));x.displayName="AlertDescription";function k({title:t,description:a,action:r,className:n,dataHook:s,trackingEl:l,trackingLabel:i}){return e.jsxs(c,{className:n,"data-hook":s,"data-tracking-el":l,"data-tracking-label":i,variant:"success",children:[e.jsx(o.CircleCheck,{}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t&&e.jsx(d,{children:t}),e.jsx(x,{children:a})]}),r&&e.jsx("div",{className:"self-center",children:r})]})}function h({title:t,description:a,action:r,className:n,dataHook:s,trackingEl:l,trackingLabel:i}){return e.jsxs(c,{className:n,"data-hook":s,"data-tracking-el":l,"data-tracking-label":i,variant:"info",children:[e.jsx(o.Info,{}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t&&e.jsx(d,{children:t}),e.jsx(x,{children:a})]}),r&&e.jsx("div",{className:"self-center",children:r})]})}function b({title:t,description:a,action:r,className:n,dataHook:s,trackingEl:l,trackingLabel:i}){return e.jsxs(c,{className:n,"data-hook":s,"data-tracking-el":l,"data-tracking-label":i,variant:"destructive",children:[e.jsx(o.CircleX,{}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t&&e.jsx(d,{children:t}),e.jsx(x,{children:a})]}),r&&e.jsx("div",{className:"self-center",children:r})]})}function p({title:t,description:a,action:r,className:n,dataHook:s,trackingEl:l,trackingLabel:i}){return e.jsxs(c,{className:n,"data-hook":s,"data-tracking-el":l,"data-tracking-label":i,variant:"warning",children:[e.jsx(o.TriangleAlert,{}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[t&&e.jsx(d,{children:t}),e.jsx(x,{children:a})]}),r&&e.jsx("div",{className:"self-center",children:r})]})}exports.Alert=c;exports.AlertDescription=x;exports.AlertDestructive=b;exports.AlertInfo=h;exports.AlertSuccess=k;exports.AlertTitle=d;exports.AlertWarning=p;exports.alertVariants=f;
|
package/dist/alert.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
1
2
|
import * as React from "react";
|
|
3
|
+
declare const alertVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "success" | "info" | "destructive" | "warning" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
7
|
+
variant?: "default" | "success" | "info" | "destructive" | "warning" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
2
11
|
interface AlertContentProps {
|
|
3
12
|
/**
|
|
4
13
|
* Optional title for the alert
|
|
@@ -33,5 +42,5 @@ declare function AlertSuccess({ title, description, action, className, dataHook,
|
|
|
33
42
|
declare function AlertInfo({ title, description, action, className, dataHook, trackingEl, trackingLabel, }: AlertContentProps): import("react/jsx-runtime").JSX.Element;
|
|
34
43
|
declare function AlertDestructive({ title, description, action, className, dataHook, trackingEl, trackingLabel, }: AlertContentProps): import("react/jsx-runtime").JSX.Element;
|
|
35
44
|
declare function AlertWarning({ title, description, action, className, dataHook, trackingEl, trackingLabel, }: AlertContentProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
export { AlertSuccess, AlertInfo, AlertDestructive, AlertWarning };
|
|
45
|
+
export { Alert, AlertTitle, AlertDescription, alertVariants, AlertSuccess, AlertInfo, AlertDestructive, AlertWarning, };
|
|
37
46
|
//# sourceMappingURL=alert.d.ts.map
|
package/dist/alert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/components/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/components/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,QAAA,MAAM,aAAa;;8EAoBlB,CAAC;AAEF,QAAA,MAAM,KAAK;;sHAYT,CAAC;AAGH,QAAA,MAAM,UAAU,6GAad,CAAC;AAGH,QAAA,MAAM,gBAAgB,6GAUpB,CAAC;AAGH,UAAU,iBAAiB;IACzB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iBAAS,YAAY,CAAC,EACpB,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,aAAa,GACd,EAAE,iBAAiB,2CAiBnB;AAED,iBAAS,SAAS,CAAC,EACjB,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,aAAa,GACd,EAAE,iBAAiB,2CAiBnB;AAED,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,aAAa,GACd,EAAE,iBAAiB,2CAiBnB;AAED,iBAAS,YAAY,CAAC,EACpB,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,aAAa,GACd,EAAE,iBAAiB,2CAiBnB;AAED,OAAO,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,YAAY,GACb,CAAC"}
|
package/dist/alert.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as n } from "react/jsx-runtime";
|
|
2
2
|
import * as f from "react";
|
|
3
3
|
import { cva as m } from "class-variance-authority";
|
|
4
4
|
import { CircleCheck as v, Info as k, CircleX as h, TriangleAlert as u } from "@brightlocal/icons";
|
|
@@ -167,8 +167,12 @@ function D({
|
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
export {
|
|
170
|
+
c as Alert,
|
|
171
|
+
o as AlertDescription,
|
|
170
172
|
C as AlertDestructive,
|
|
171
173
|
R as AlertInfo,
|
|
172
174
|
A as AlertSuccess,
|
|
173
|
-
|
|
175
|
+
g as AlertTitle,
|
|
176
|
+
D as AlertWarning,
|
|
177
|
+
p as alertVariants
|
|
174
178
|
};
|
package/dist/card.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 s=require("react/jsx-runtime"),y=require("react"),N=require("class-variance-authority"),d=require("@brightlocal/ui-components/lib/utils");function h(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(a,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return a.default=t,Object.freeze(a)}const e=h(y),n=e.createContext({flush:!1}),v=N.cva(["flex","flex-col","gap-8","rounded-[14px]","py-8","transition-colors"],{variants:{variant:{default:["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"]}},defaultVariants:{variant:"default"}}),c=e.forwardRef(({className:t,variant:a="default",dataHook:r,trackingEl:o,trackingLabel:m,children:x,...g},b)=>{const j=a==="transparent-flush";return s.jsx(n.Provider,{value:{flush:j},children:s.jsx("div",{ref:b,className:d.cn(v({variant:a}),t),"data-hook":r,"data-slot":"card","data-tracking-el":o||`card-${a}`,"data-tracking-label":m,...g,children:x})})});c.displayName="Card";const i=e.forwardRef(({className:t,...a},r)=>{const{flush:o}=e.useContext(n);return s.jsx("div",{ref:r,className:d.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]",!o&&"px-8",t),"data-slot":"card-header",...a})});i.displayName="CardHeader";const l=e.forwardRef(({className:t,...a},r)=>s.jsx("div",{ref:r,className:d.cn("heading-sm",t),"data-slot":"card-title",...a}));l.displayName="CardTitle";const u=e.forwardRef(({className:t,...a},r)=>s.jsx("div",{ref:r,className:d.cn("text-muted-foreground text-sm leading-normal font-normal",t),"data-slot":"card-description",...a}));u.displayName="CardDescription";const f=e.forwardRef(({className:t,...a},r)=>s.jsx("div",{ref:r,className:d.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),"data-slot":"card-action",...a}));f.displayName="CardAction";const p=e.forwardRef(({className:t,...a},r)=>{const{flush:o}=e.useContext(n);return s.jsx("div",{ref:r,className:d.cn(!o&&"px-8",t),"data-slot":"card-content",...a})});p.displayName="CardContent";const C=e.forwardRef(({className:t,...a},r)=>{const{flush:o}=e.useContext(n);return s.jsx("div",{ref:r,className:d.cn("flex items-center",!o&&"px-8",t),"data-slot":"card-footer",...a})});C.displayName="CardFooter";exports.Card=c;exports.CardAction=f;exports.CardContent=p;exports.CardDescription=u;exports.CardFooter=C;exports.CardHeader=i;exports.CardTitle=l;
|
package/dist/card.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Card variant type
|
|
4
|
+
*/
|
|
5
|
+
type CardVariant = "default" | "transparent" | "border" | "transparent-flush";
|
|
2
6
|
/**
|
|
3
7
|
* Props for the Card component
|
|
4
8
|
*/
|
|
@@ -7,7 +11,7 @@ type CardProps = React.ComponentProps<"div"> & {
|
|
|
7
11
|
* Visual style variant of the card
|
|
8
12
|
* @default "default"
|
|
9
13
|
*/
|
|
10
|
-
variant?:
|
|
14
|
+
variant?: CardVariant;
|
|
11
15
|
/**
|
|
12
16
|
* Data hook for automated testing (required)
|
|
13
17
|
*/
|
|
@@ -64,5 +68,5 @@ declare const CardContent: React.ForwardRefExoticComponent<Omit<CardSubComponent
|
|
|
64
68
|
*/
|
|
65
69
|
declare const CardFooter: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
66
70
|
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
67
|
-
export type { CardProps, CardSubComponentProps };
|
|
71
|
+
export type { CardProps, CardSubComponentProps, CardVariant };
|
|
68
72
|
//# sourceMappingURL=card.d.ts.map
|
package/dist/card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
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,SAAS,GAAG,aAAa,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAkC9E;;GAEG;AACH,KAAK,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7C;;;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;CACxB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,IAAI,+FA+BT,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,WAAW,2GAYhB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAYf,CAAC;AAGF,OAAO,EACL,IAAI,EACJ,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,GACZ,CAAC;AAEF,YAAY,EAAE,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/card.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import * as e from "react";
|
|
3
|
-
import { cva as
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
3
|
+
import { cva as m } from "class-variance-authority";
|
|
4
|
+
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
const n = e.createContext({ flush: !1 }), p = m(
|
|
6
6
|
["flex", "flex-col", "gap-8", "rounded-[14px]", "py-8", "transition-colors"],
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
@@ -19,68 +19,78 @@ const f = l(
|
|
|
19
19
|
"text-foreground",
|
|
20
20
|
"border",
|
|
21
21
|
"border-border"
|
|
22
|
-
]
|
|
22
|
+
],
|
|
23
|
+
"transparent-flush": ["bg-transparent", "text-foreground"]
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
defaultVariants: {
|
|
26
27
|
variant: "default"
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
),
|
|
30
|
+
), C = e.forwardRef(
|
|
30
31
|
({
|
|
31
32
|
className: r,
|
|
32
33
|
variant: a = "default",
|
|
33
34
|
dataHook: t,
|
|
34
|
-
trackingEl:
|
|
35
|
-
trackingLabel:
|
|
35
|
+
trackingEl: d,
|
|
36
|
+
trackingLabel: c,
|
|
37
|
+
children: l,
|
|
36
38
|
...i
|
|
37
|
-
},
|
|
38
|
-
"
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
}, f) => {
|
|
40
|
+
const u = a === "transparent-flush";
|
|
41
|
+
return /* @__PURE__ */ o(n.Provider, { value: { flush: u }, children: /* @__PURE__ */ o(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
ref: f,
|
|
45
|
+
className: s(p({ variant: a }), r),
|
|
46
|
+
"data-hook": t,
|
|
47
|
+
"data-slot": "card",
|
|
48
|
+
"data-tracking-el": d || `card-${a}`,
|
|
49
|
+
"data-tracking-label": c,
|
|
50
|
+
...i,
|
|
51
|
+
children: l
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}
|
|
49
55
|
);
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
({ className: r, ...a }, t) =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
C.displayName = "Card";
|
|
57
|
+
const x = e.forwardRef(
|
|
58
|
+
({ className: r, ...a }, t) => {
|
|
59
|
+
const { flush: d } = e.useContext(n);
|
|
60
|
+
return /* @__PURE__ */ o(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
ref: t,
|
|
64
|
+
className: s(
|
|
65
|
+
"@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]",
|
|
66
|
+
!d && "px-8",
|
|
67
|
+
r
|
|
68
|
+
),
|
|
69
|
+
"data-slot": "card-header",
|
|
70
|
+
...a
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
64
74
|
);
|
|
65
|
-
|
|
75
|
+
x.displayName = "CardHeader";
|
|
66
76
|
const g = e.forwardRef(
|
|
67
|
-
({ className: r, ...a }, t) => /* @__PURE__ */
|
|
77
|
+
({ className: r, ...a }, t) => /* @__PURE__ */ o(
|
|
68
78
|
"div",
|
|
69
79
|
{
|
|
70
80
|
ref: t,
|
|
71
|
-
className:
|
|
81
|
+
className: s("heading-sm", r),
|
|
72
82
|
"data-slot": "card-title",
|
|
73
83
|
...a
|
|
74
84
|
}
|
|
75
85
|
)
|
|
76
86
|
);
|
|
77
87
|
g.displayName = "CardTitle";
|
|
78
|
-
const
|
|
79
|
-
({ className: r, ...a }, t) => /* @__PURE__ */
|
|
88
|
+
const N = e.forwardRef(
|
|
89
|
+
({ className: r, ...a }, t) => /* @__PURE__ */ o(
|
|
80
90
|
"div",
|
|
81
91
|
{
|
|
82
92
|
ref: t,
|
|
83
|
-
className:
|
|
93
|
+
className: s(
|
|
84
94
|
"text-muted-foreground text-sm leading-normal font-normal",
|
|
85
95
|
r
|
|
86
96
|
),
|
|
@@ -89,13 +99,13 @@ const u = e.forwardRef(
|
|
|
89
99
|
}
|
|
90
100
|
)
|
|
91
101
|
);
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
({ className: r, ...a }, t) => /* @__PURE__ */
|
|
102
|
+
N.displayName = "CardDescription";
|
|
103
|
+
const h = e.forwardRef(
|
|
104
|
+
({ className: r, ...a }, t) => /* @__PURE__ */ o(
|
|
95
105
|
"div",
|
|
96
106
|
{
|
|
97
107
|
ref: t,
|
|
98
|
-
className:
|
|
108
|
+
className: s(
|
|
99
109
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
100
110
|
r
|
|
101
111
|
),
|
|
@@ -104,37 +114,43 @@ const C = e.forwardRef(
|
|
|
104
114
|
}
|
|
105
115
|
)
|
|
106
116
|
);
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
({ className: r, ...a }, t) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
h.displayName = "CardAction";
|
|
118
|
+
const b = e.forwardRef(
|
|
119
|
+
({ className: r, ...a }, t) => {
|
|
120
|
+
const { flush: d } = e.useContext(n);
|
|
121
|
+
return /* @__PURE__ */ o(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
ref: t,
|
|
125
|
+
className: s(!d && "px-8", r),
|
|
126
|
+
"data-slot": "card-content",
|
|
127
|
+
...a
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
118
131
|
);
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
({ className: r, ...a }, t) =>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
b.displayName = "CardContent";
|
|
133
|
+
const v = e.forwardRef(
|
|
134
|
+
({ className: r, ...a }, t) => {
|
|
135
|
+
const { flush: d } = e.useContext(n);
|
|
136
|
+
return /* @__PURE__ */ o(
|
|
137
|
+
"div",
|
|
138
|
+
{
|
|
139
|
+
ref: t,
|
|
140
|
+
className: s("flex items-center", !d && "px-8", r),
|
|
141
|
+
"data-slot": "card-footer",
|
|
142
|
+
...a
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
130
146
|
);
|
|
131
|
-
|
|
147
|
+
v.displayName = "CardFooter";
|
|
132
148
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
149
|
+
C as Card,
|
|
150
|
+
h as CardAction,
|
|
151
|
+
b as CardContent,
|
|
152
|
+
N as CardDescription,
|
|
153
|
+
v as CardFooter,
|
|
154
|
+
x as CardHeader,
|
|
139
155
|
g as CardTitle
|
|
140
156
|
};
|
package/dist/centred-layout.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 a=require("react/jsx-runtime"),p=require("react"),o=require("@brightlocal/ui-components/lib/utils");function g(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const c=g(p),s=c.forwardRef(({className:t,maxWidth:e,children:r,dataHook:n,trackingEl:d,trackingLabel:i,...f},y)=>{const m=e!==void 0?{maxWidth:typeof e=="number"?`${e}px`:e}:void 0;return a.jsx("div",{ref:y,className:o.cn("bg-background flex min-h-screen flex-col items-center justify-center gap-4 p-6",!e&&"max-w-7xl",t),"data-hook":n,"data-slot":"centred-layout","data-tracking-el":d,"data-tracking-label":i,style:m,...f,children:r})});s.displayName="CentredLayout";const l=c.forwardRef(({className:t,children:e,...r},n)=>a.jsx("div",{ref:n,className:o.cn("flex w-full items-center justify-center lg:justify-start",t),"data-slot":"centred-layout-header",...r,children:e}));l.displayName="CentredLayoutHeader";const u=c.forwardRef(({className:t,children:e,...r},n)=>a.jsx("div",{ref:n,className:o.cn("flex flex-1 flex-col items-center justify-center",t),"data-slot":"centred-layout-content",...r,children:e}));u.displayName="CentredLayoutContent";exports.CentredLayout=s;exports.CentredLayoutContent=u;exports.CentredLayoutHeader=l;
|
package/dist/centred-layout.d.ts
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
/**
|
|
3
|
-
* CentredLayout provides a responsive centered container with max-width
|
|
4
|
-
* based on different breakpoint sizes.
|
|
3
|
+
* CentredLayout provides a responsive centered container with max-width constraint.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* - SM: 640px (max-w-2xl)
|
|
5
|
+
* Spacing tokens used:
|
|
6
|
+
* - Padding: p-6 (spacing.6 = 24px) all around
|
|
7
|
+
* - Header to content gap: gap-4 (spacing.4 = 16px)
|
|
8
|
+
* - Max width: max-w-7xl (1280px) by default
|
|
11
9
|
*
|
|
12
|
-
* The component centers content horizontally and
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
10
|
+
* The component centers content horizontally and vertically.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Basic usage
|
|
14
|
+
* <CentredLayout dataHook="my-layout">
|
|
15
|
+
* <CentredLayoutContent>
|
|
16
|
+
* <Card>...</Card>
|
|
17
|
+
* </CentredLayoutContent>
|
|
18
|
+
* </CentredLayout>
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // With Header
|
|
22
|
+
* <CentredLayout dataHook="my-layout">
|
|
23
|
+
* <CentredLayoutHeader>
|
|
24
|
+
* <Header dataHook="my-header"><Logo /></Header>
|
|
25
|
+
* </CentredLayoutHeader>
|
|
26
|
+
* <CentredLayoutContent>
|
|
27
|
+
* <Card>...</Card>
|
|
28
|
+
* </CentredLayoutContent>
|
|
29
|
+
* </CentredLayout>
|
|
21
30
|
*/
|
|
22
|
-
export type CentredLayoutBreakpoint = "xl" | "lg" | "md" | "sm";
|
|
23
31
|
interface CentredLayoutProps extends React.ComponentProps<"div"> {
|
|
24
32
|
/**
|
|
25
33
|
* Data hook for automated testing (required)
|
|
@@ -34,12 +42,7 @@ interface CentredLayoutProps extends React.ComponentProps<"div"> {
|
|
|
34
42
|
*/
|
|
35
43
|
trackingLabel?: string;
|
|
36
44
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @default "xl"
|
|
39
|
-
*/
|
|
40
|
-
breakpoint?: CentredLayoutBreakpoint;
|
|
41
|
-
/**
|
|
42
|
-
* Custom max-width value (overrides breakpoint)
|
|
45
|
+
* Custom max-width value (overrides default 1280px)
|
|
43
46
|
*/
|
|
44
47
|
maxWidth?: string | number;
|
|
45
48
|
}
|
|
@@ -47,6 +50,27 @@ interface CentredLayoutProps extends React.ComponentProps<"div"> {
|
|
|
47
50
|
* CentredLayout component for centering content with responsive max-width constraints.
|
|
48
51
|
*/
|
|
49
52
|
declare const CentredLayout: React.ForwardRefExoticComponent<Omit<CentredLayoutProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
interface CentredLayoutHeaderProps extends React.ComponentProps<"div"> {
|
|
54
|
+
/**
|
|
55
|
+
* Header content (e.g., Header component with Logo)
|
|
56
|
+
*/
|
|
57
|
+
children: React.ReactNode;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* CentredLayoutHeader component for rendering header content at the top of CentredLayout.
|
|
61
|
+
* Content is centered on mobile/tablet, left-aligned from lg breakpoint onwards.
|
|
62
|
+
*/
|
|
63
|
+
declare const CentredLayoutHeader: React.ForwardRefExoticComponent<Omit<CentredLayoutHeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
+
interface CentredLayoutContentProps extends React.ComponentProps<"div"> {
|
|
65
|
+
/**
|
|
66
|
+
* Main content to render inside the centered layout
|
|
67
|
+
*/
|
|
68
|
+
children: React.ReactNode;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* CentredLayoutContent component for rendering the main content area of CentredLayout.
|
|
72
|
+
*/
|
|
73
|
+
declare const CentredLayoutContent: React.ForwardRefExoticComponent<Omit<CentredLayoutContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
74
|
+
export { CentredLayout, CentredLayoutHeader, CentredLayoutContent };
|
|
75
|
+
export type { CentredLayoutProps, CentredLayoutHeaderProps, CentredLayoutContentProps, };
|
|
52
76
|
//# sourceMappingURL=centred-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"centred-layout.d.ts","sourceRoot":"","sources":["../../src/components/centred-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"centred-layout.d.ts","sourceRoot":"","sources":["../../src/components/centred-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC9D;;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,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,QAAA,MAAM,aAAa,wGAyClB,CAAC;AAQF,UAAU,wBAAyB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACpE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,8GAiBvB,CAAC;AAQH,UAAU,yBAA0B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACrE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,QAAA,MAAM,oBAAoB,+GAiBxB,CAAC;AAQH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;AAEpE,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,GAC1B,CAAC"}
|
package/dist/centred-layout.js
CHANGED
|
@@ -1,46 +1,71 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { cn as l } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
+
const u = n.forwardRef(
|
|
5
5
|
({
|
|
6
|
-
className:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
children: o,
|
|
6
|
+
className: t,
|
|
7
|
+
maxWidth: e,
|
|
8
|
+
children: a,
|
|
10
9
|
dataHook: r,
|
|
11
|
-
trackingEl:
|
|
12
|
-
trackingLabel:
|
|
13
|
-
...
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
lg: "max-w-5xl",
|
|
18
|
-
md: "max-w-3xl",
|
|
19
|
-
sm: "max-w-2xl"
|
|
20
|
-
}, d = t !== void 0 ? {
|
|
21
|
-
maxWidth: typeof t == "number" ? `${t}px` : t
|
|
10
|
+
trackingEl: d,
|
|
11
|
+
trackingLabel: s,
|
|
12
|
+
...c
|
|
13
|
+
}, f) => {
|
|
14
|
+
const i = e !== void 0 ? {
|
|
15
|
+
maxWidth: typeof e == "number" ? `${e}px` : e
|
|
22
16
|
} : void 0;
|
|
23
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ o(
|
|
24
18
|
"div",
|
|
25
19
|
{
|
|
26
|
-
ref:
|
|
27
|
-
className:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
ref: f,
|
|
21
|
+
className: l(
|
|
22
|
+
// Base styles with p-6 padding (container-padding-x token) and gap-4 for header/content spacing
|
|
23
|
+
"bg-background flex min-h-screen flex-col items-center justify-center gap-4 p-6",
|
|
24
|
+
!e && "max-w-7xl",
|
|
25
|
+
t
|
|
31
26
|
),
|
|
32
27
|
"data-hook": r,
|
|
33
28
|
"data-slot": "centred-layout",
|
|
34
|
-
"data-tracking-el":
|
|
35
|
-
"data-tracking-label":
|
|
36
|
-
style:
|
|
37
|
-
...
|
|
38
|
-
children:
|
|
29
|
+
"data-tracking-el": d,
|
|
30
|
+
"data-tracking-label": s,
|
|
31
|
+
style: i,
|
|
32
|
+
...c,
|
|
33
|
+
children: a
|
|
39
34
|
}
|
|
40
35
|
);
|
|
41
36
|
}
|
|
42
37
|
);
|
|
43
|
-
|
|
38
|
+
u.displayName = "CentredLayout";
|
|
39
|
+
const y = n.forwardRef(({ className: t, children: e, ...a }, r) => /* @__PURE__ */ o(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
ref: r,
|
|
43
|
+
className: l(
|
|
44
|
+
"flex w-full items-center justify-center lg:justify-start",
|
|
45
|
+
t
|
|
46
|
+
),
|
|
47
|
+
"data-slot": "centred-layout-header",
|
|
48
|
+
...a,
|
|
49
|
+
children: e
|
|
50
|
+
}
|
|
51
|
+
));
|
|
52
|
+
y.displayName = "CentredLayoutHeader";
|
|
53
|
+
const m = n.forwardRef(({ className: t, children: e, ...a }, r) => /* @__PURE__ */ o(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
ref: r,
|
|
57
|
+
className: l(
|
|
58
|
+
"flex flex-1 flex-col items-center justify-center",
|
|
59
|
+
t
|
|
60
|
+
),
|
|
61
|
+
"data-slot": "centred-layout-content",
|
|
62
|
+
...a,
|
|
63
|
+
children: e
|
|
64
|
+
}
|
|
65
|
+
));
|
|
66
|
+
m.displayName = "CentredLayoutContent";
|
|
44
67
|
export {
|
|
45
|
-
|
|
68
|
+
u as CentredLayout,
|
|
69
|
+
m as CentredLayoutContent,
|
|
70
|
+
y as CentredLayoutHeader
|
|
46
71
|
};
|
package/dist/checkbox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,gBAAgB;;8EA4BrB,CAAC;AAEF,MAAM,WAAW,aACf,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/components/checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,gBAAgB;;8EA4BrB,CAAC;AAEF,MAAM,WAAW,aACf,SACE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,EACrE,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACvC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,QAAQ,sGAuCb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/chip.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),O=require("react"),g=require("class-variance-authority"),h=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),o=require("@brightlocal/ui-components/tooltip");function R(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>a[n]})}}return t.default=a,Object.freeze(t)}const r=R(O),x=g.cva(["inline-flex","items-center","justify-center","gap-0.5","rounded-full","font-medium","whitespace-nowrap","shrink-0","select-none","bg-secondary","text-foreground","transition-[color,background-color,box-shadow]","duration-150","ease-in-out","hover:bg-secondary/80","focus:outline-none","focus-visible:shadow-default","disabled:pointer-events-none","disabled:opacity-50","aria-disabled:pointer-events-none","aria-disabled:opacity-50"],{variants:{size:{md:["h-7","pl-2.5","pr-1","text-xs"],lg:["h-8","pl-4","pr-2","text-base"]}},defaultVariants:{size:"md"}}),m=g.cva(["inline-flex","items-center","justify-center","rounded-full","cursor-pointer","text-muted-foreground","hover:text-foreground","outline-none","focus-visible:text-foreground","disabled:pointer-events-none","disabled:opacity-50"],{variants:{size:{md:["size-6"],lg:["size-6"]}},defaultVariants:{size:"md"}}),v=r.forwardRef(({className:a,children:t,size:n="md",loading:i=!1,disabled:j=!1,onRemove:y,dataHook:u,trackingEl:l,trackingLabel:w,maxWidth:T=200,...z},C)=>{const p=j||i,f=16,s=r.useRef(null),[k,N]=r.useState(!1);r.useEffect(()=>{const c=()=>{s.current&&N(s.current.scrollWidth>s.current.clientWidth)};return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[t]);const b=e.jsx("span",{ref:s,className:"truncate","data-slot":"chip-label",style:{maxWidth:T},children:t});return e.jsxs("div",{ref:C,"aria-disabled":p?"true":void 0,className:d.cn(x({size:n}),a),"data-hook":u,"data-slot":"chip","data-tracking-el":l,"data-tracking-label":w,...z,children:[k?e.jsx(o.TooltipProvider,{children:e.jsxs(o.Tooltip,{children:[e.jsx(o.TooltipTrigger,{asChild:!0,children:b}),e.jsx(o.TooltipContent,{dataHook:`${u}-tooltip`,sideOffset:8,children:t})]})}):b,i?e.jsx("span",{"aria-label":"Loading",className:d.cn(m({size:n})),"data-slot":"chip-loading",role:"status",children:e.jsx(h.LoaderCircle,{className:"animate-spin motion-reduce:animate-none",size:f})}):e.jsx("button",{"aria-label":`Remove ${typeof t=="string"?t:"chip"}`,className:d.cn(m({size:n})),"data-slot":"chip-delete","data-tracking-el":l?`${l}-delete`:void 0,disabled:p,tabIndex:-1,type:"button",onClick:y,children:e.jsx(h.X,{size:f})})]})});v.displayName="Chip";exports.Chip=v;exports.chipVariants=x;
|
package/dist/chip.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Chip size options
|
|
4
|
+
*/
|
|
5
|
+
type ChipSize = "md" | "lg";
|
|
6
|
+
declare const chipVariants: (props?: ({
|
|
7
|
+
size?: "lg" | "md" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Props for the Chip component
|
|
11
|
+
*/
|
|
12
|
+
interface ChipProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
13
|
+
/**
|
|
14
|
+
* Chip content (text label)
|
|
15
|
+
*/
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Size variant of the chip
|
|
19
|
+
* @default "md"
|
|
20
|
+
*/
|
|
21
|
+
size?: ChipSize;
|
|
22
|
+
/**
|
|
23
|
+
* Show loading spinner instead of delete button
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Disable the chip and its delete button
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Callback when delete button is clicked
|
|
34
|
+
*/
|
|
35
|
+
onRemove?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Data hook for automated testing (required)
|
|
38
|
+
*/
|
|
39
|
+
dataHook: string;
|
|
40
|
+
/**
|
|
41
|
+
* Tracking element identifier for analytics
|
|
42
|
+
*/
|
|
43
|
+
trackingEl?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Tracking label for analytics context
|
|
46
|
+
*/
|
|
47
|
+
trackingLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Maximum width of the chip label before truncation
|
|
50
|
+
* @default 200
|
|
51
|
+
*/
|
|
52
|
+
maxWidth?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Chip component for displaying removable tags or selections.
|
|
56
|
+
* Used for filter selections, tag lists, and multi-select values.
|
|
57
|
+
*/
|
|
58
|
+
declare const Chip: React.ForwardRefExoticComponent<Omit<ChipProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
export { Chip, chipVariants };
|
|
60
|
+
export type { ChipProps, ChipSize };
|
|
61
|
+
//# sourceMappingURL=chip.d.ts.map
|