@brightlocal/ui-components 2.17.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +83 -1
  2. package/component-meta.json +20 -7
  3. package/dist/alert-dialog.cjs +1 -1
  4. package/dist/alert-dialog.d.ts +23 -2
  5. package/dist/alert-dialog.d.ts.map +1 -1
  6. package/dist/alert-dialog.js +21 -19
  7. package/dist/blocks/input-list.cjs +2 -2
  8. package/dist/blocks/input-list.d.ts.map +1 -1
  9. package/dist/blocks/input-list.js +64 -63
  10. package/dist/card.cjs +1 -1
  11. package/dist/card.d.ts +22 -2
  12. package/dist/card.d.ts.map +1 -1
  13. package/dist/card.js +93 -72
  14. package/dist/chip.cjs +1 -1
  15. package/dist/chip.d.ts.map +1 -1
  16. package/dist/chip.js +1 -7
  17. package/dist/dialog.cjs +1 -1
  18. package/dist/dialog.d.ts +23 -3
  19. package/dist/dialog.d.ts.map +1 -1
  20. package/dist/dialog.js +44 -42
  21. package/dist/dropdown-menu.cjs +1 -1
  22. package/dist/dropdown-menu.d.ts +10 -0
  23. package/dist/dropdown-menu.d.ts.map +1 -1
  24. package/dist/dropdown-menu.js +30 -29
  25. package/dist/field.cjs +1 -1
  26. package/dist/field.d.ts +5 -1
  27. package/dist/field.d.ts.map +1 -1
  28. package/dist/field.js +9 -7
  29. package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
  30. package/dist/hooks/use-prefers-reduced-motion.d.ts +25 -2
  31. package/dist/hooks/use-prefers-reduced-motion.d.ts.map +1 -1
  32. package/dist/hooks/use-prefers-reduced-motion.js +17 -11
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.js +38 -37
  35. package/dist/link.cjs +1 -1
  36. package/dist/link.d.ts +13 -2
  37. package/dist/link.d.ts.map +1 -1
  38. package/dist/link.js +110 -53
  39. package/dist/map.cjs +1 -1
  40. package/dist/map.d.ts.map +1 -1
  41. package/dist/map.js +1 -1
  42. package/dist/progress.cjs +1 -1
  43. package/dist/progress.d.ts.map +1 -1
  44. package/dist/progress.js +26 -25
  45. package/dist/rating.cjs +1 -1
  46. package/dist/rating.d.ts.map +1 -1
  47. package/dist/rating.js +27 -21
  48. package/dist/sheet.cjs +1 -1
  49. package/dist/sheet.d.ts +17 -2
  50. package/dist/sheet.d.ts.map +1 -1
  51. package/dist/sheet.js +29 -27
  52. package/package.json +1 -1
  53. package/src/blocks/input-list.tsx +8 -1
  54. package/src/components/alert-dialog.tsx +38 -4
  55. package/src/components/card.tsx +56 -9
  56. package/src/components/chip.tsx +1 -4
  57. package/src/components/dialog.tsx +39 -6
  58. package/src/components/dropdown-menu.tsx +7 -1
  59. package/src/components/field.tsx +6 -0
  60. package/src/components/link.tsx +103 -27
  61. package/src/components/map.tsx +1 -2
  62. package/src/components/progress.tsx +12 -6
  63. package/src/components/rating.tsx +4 -1
  64. package/src/components/sheet.tsx +30 -5
  65. package/src/hooks/use-prefers-reduced-motion.ts +35 -5
package/dist/rating.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),h=require("react"),d=require("@brightlocal/icons"),y=require("@brightlocal/ui-components/lib/utils");function S(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const v=S(h),x={sm:16,md:24},u=v.forwardRef(({value:t,dataHook:a,size:e="sm",ariaLabel:r,trackingEl:g,trackingLabel:m,className:f,...p},b)=>{const s=Math.max(0,Math.min(5,t)),o=x[e];return i.jsx("div",{ref:b,"aria-label":r?r.replace("{value}",String(s)):`Rating: ${s} out of 5 stars`,className:y.cn("flex items-center gap-0.5",f),"data-hook":a,"data-slot":"rating","data-tracking-el":g,"data-tracking-label":m,role:"img",...p,children:[...Array(5)].map((N,n)=>{const j=n+1,l=s>=j,c=!l&&s>n,R=c?((s-n)*100).toFixed(0):l?"100":"0";return i.jsxs("div",{className:"relative","data-slot":"rating-star",children:[i.jsx(d.StarRating,{className:"fill-muted stroke-muted","data-slot":"rating-star-base",size:o}),(l||c)&&i.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 overflow-hidden","data-slot":"rating-star-fill",style:{width:`${R}%`},children:i.jsx(d.StarRating,{size:o})})]},n)})})});u.displayName="Rating";exports.Rating=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),R=require("react"),d=require("@brightlocal/icons"),h=require("@brightlocal/ui-components/lib/utils");function S(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const v=S(R),N={sm:16,md:24},u=v.forwardRef(({value:t,dataHook:a,size:e="sm",ariaLabel:s,trackingEl:g,trackingLabel:m,className:f,...p},b)=>{const r=Math.max(0,Math.min(5,t)),o=N[e];return l.jsx("div",{ref:b,"aria-label":s?s.replace("{value}",String(r)):`Rating: ${r} out of 5 stars`,className:h.cn("flex items-center gap-0.5",f),"data-hook":a,"data-slot":"rating","data-tracking-el":g,"data-tracking-label":m,role:"img",...p,children:[...Array(5)].map((k,i)=>{const j=i+1,n=r>=j,c=!n&&r>i,y=c?((r-i)*100).toFixed(0):n?"100":"0";return l.jsxs("div",{className:"relative","data-slot":"rating-star",children:[l.jsx(d.StarRating,{className:"fill-muted stroke-muted","data-slot":"rating-star-base",size:o}),(n||c)&&l.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 overflow-hidden","data-slot":"rating-star-fill",style:{width:`${y}%`},children:l.jsx(d.StarRating,{className:"fill-yellow-400 stroke-yellow-400",size:o})})]},i)})})});u.displayName="Rating";exports.Rating=u;
@@ -1 +1 @@
1
- {"version":3,"file":"rating.d.ts","sourceRoot":"","sources":["../../src/components/rating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAO9B;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACvE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,MAAM,oFAwEX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"rating.d.ts","sourceRoot":"","sources":["../../src/components/rating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAO9B;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACvE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,MAAM,oFA2EX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,UAAU,EAAE,CAAC"}
package/dist/rating.js CHANGED
@@ -1,46 +1,46 @@
1
- import { jsx as e, jsxs as R } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as y } from "react/jsx-runtime";
2
2
  import * as N from "react";
3
3
  import { StarRating as o } from "@brightlocal/icons";
4
- import { cn as k } from "@brightlocal/ui-components/lib/utils";
5
- const y = {
4
+ import { cn as R } from "@brightlocal/ui-components/lib/utils";
5
+ const k = {
6
6
  sm: 16,
7
7
  md: 24
8
- }, z = N.forwardRef(
8
+ }, w = N.forwardRef(
9
9
  ({
10
10
  value: n,
11
- dataHook: d,
12
- size: m = "sm",
13
- ariaLabel: s,
14
- trackingEl: c,
11
+ dataHook: m,
12
+ size: c = "sm",
13
+ ariaLabel: l,
14
+ trackingEl: d,
15
15
  trackingLabel: g,
16
16
  className: f,
17
17
  ...p
18
18
  }, u) => {
19
- const a = Math.max(0, Math.min(5, n)), i = y[m];
19
+ const a = Math.max(0, Math.min(5, n)), r = k[c];
20
20
  return /* @__PURE__ */ e(
21
21
  "div",
22
22
  {
23
23
  ref: u,
24
- "aria-label": s ? s.replace("{value}", String(a)) : `Rating: ${a} out of 5 stars`,
25
- className: k("flex items-center gap-0.5", f),
26
- "data-hook": d,
24
+ "aria-label": l ? l.replace("{value}", String(a)) : `Rating: ${a} out of 5 stars`,
25
+ className: R("flex items-center gap-0.5", f),
26
+ "data-hook": m,
27
27
  "data-slot": "rating",
28
- "data-tracking-el": c,
28
+ "data-tracking-el": d,
29
29
  "data-tracking-label": g,
30
30
  role: "img",
31
31
  ...p,
32
- children: [...Array(5)].map((S, t) => {
33
- const h = t + 1, r = a >= h, l = !r && a > t, v = l ? ((a - t) * 100).toFixed(0) : r ? "100" : "0";
34
- return /* @__PURE__ */ R("div", { className: "relative", "data-slot": "rating-star", children: [
32
+ children: [...Array(5)].map((z, t) => {
33
+ const h = t + 1, s = a >= h, i = !s && a > t, v = i ? ((a - t) * 100).toFixed(0) : s ? "100" : "0";
34
+ return /* @__PURE__ */ y("div", { className: "relative", "data-slot": "rating-star", children: [
35
35
  /* @__PURE__ */ e(
36
36
  o,
37
37
  {
38
38
  className: "fill-muted stroke-muted",
39
39
  "data-slot": "rating-star-base",
40
- size: i
40
+ size: r
41
41
  }
42
42
  ),
43
- (r || l) && /* @__PURE__ */ e(
43
+ (s || i) && /* @__PURE__ */ e(
44
44
  "div",
45
45
  {
46
46
  "aria-hidden": "true",
@@ -49,7 +49,13 @@ const y = {
49
49
  style: {
50
50
  width: `${v}%`
51
51
  },
52
- children: /* @__PURE__ */ e(o, { size: i })
52
+ children: /* @__PURE__ */ e(
53
+ o,
54
+ {
55
+ className: "fill-yellow-400 stroke-yellow-400",
56
+ size: r
57
+ }
58
+ )
53
59
  }
54
60
  )
55
61
  ] }, t);
@@ -58,7 +64,7 @@ const y = {
58
64
  );
59
65
  }
60
66
  );
61
- z.displayName = "Rating";
67
+ w.displayName = "Rating";
62
68
  export {
63
- z as Rating
69
+ w as Rating
64
70
  };
package/dist/sheet.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),w=require("react"),R=require("@radix-ui/react-dialog"),C=require("class-variance-authority"),k=require("@brightlocal/icons"),i=require("@brightlocal/ui-components/lib/utils");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const r=h(w),o=h(R),O=C.cva(["bg-background","data-[state=open]:animate-in","data-[state=closed]:animate-out","fixed","z-50","flex","flex-col","gap-4","p-6","shadow-lg","transition","ease-in-out","data-[state=closed]:duration-300","data-[state=open]:duration-500"],{variants:{side:{top:["data-[state=closed]:slide-out-to-top","data-[state=open]:slide-in-from-top","inset-x-0","top-0","h-auto","border-b"],right:["data-[state=closed]:slide-out-to-right","data-[state=open]:slide-in-from-right","inset-y-0","right-0","h-full","w-3/4","border-l","sm:max-w-sm"],bottom:["data-[state=closed]:slide-out-to-bottom","data-[state=open]:slide-in-from-bottom","inset-x-0","bottom-0","h-auto","border-t"],left:["data-[state=closed]:slide-out-to-left","data-[state=open]:slide-in-from-left","inset-y-0","left-0","h-full","w-3/4","border-r","sm:max-w-sm"]}},defaultVariants:{side:"right"}});function f({...e}){return s.jsx(o.Root,{"data-slot":"sheet",modal:!0,...e})}f.displayName="Sheet";const u=r.forwardRef(({dataHook:e,...t},a)=>s.jsx(o.Trigger,{ref:a,"data-hook":e,"data-slot":"sheet-trigger",...t}));u.displayName="SheetTrigger";const m=r.forwardRef(({...e},t)=>s.jsx(o.Close,{ref:t,"data-slot":"sheet-close",...e}));m.displayName="SheetClose";function d({...e}){return s.jsx(o.Portal,{"data-slot":"sheet-portal",...e})}d.displayName="SheetPortal";const c=r.forwardRef(({className:e,...t},a)=>s.jsx(o.Overlay,{ref:a,className:i.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),"data-slot":"sheet-overlay",...t}));c.displayName="SheetOverlay";const p=r.forwardRef(({className:e,children:t,side:a,dataHook:n,trackingEl:l,trackingLabel:b,closeLabel:j,...N},v)=>s.jsxs(d,{children:[s.jsx(c,{}),s.jsxs(o.Content,{ref:v,className:i.cn(O({side:a}),e),"data-hook":n,"data-slot":"sheet-content","data-tracking-el":l,"data-tracking-label":b,...N,children:[t,s.jsxs(o.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",children:[s.jsx(k.X,{}),s.jsx("span",{className:"sr-only",children:j??"Close"})]})]})]}));p.displayName="SheetContent";const g=r.forwardRef(({className:e,...t},a)=>s.jsx("div",{ref:a,className:i.cn("flex flex-col gap-2 text-center sm:text-left",e),"data-slot":"sheet-header",...t}));g.displayName="SheetHeader";const x=r.forwardRef(({className:e,...t},a)=>s.jsx("div",{ref:a,className:i.cn("mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",e),"data-slot":"sheet-footer",...t}));x.displayName="SheetFooter";const S=r.forwardRef(({className:e,icon:t,children:a,...n},l)=>s.jsxs(o.Title,{ref:l,className:i.cn("text-foreground text-lg font-semibold",t&&"flex items-center gap-2",e),"data-slot":"sheet-title",...n,children:[t&&s.jsx("span",{className:"shrink-0 [&_svg]:size-5","data-slot":"sheet-title-icon",children:t}),a]}));S.displayName="SheetTitle";const y=r.forwardRef(({className:e,...t},a)=>s.jsx(o.Description,{ref:a,className:i.cn("text-muted-foreground text-sm",e),"data-slot":"sheet-description",...t}));y.displayName="SheetDescription";exports.Sheet=f;exports.SheetClose=m;exports.SheetContent=p;exports.SheetDescription=y;exports.SheetFooter=x;exports.SheetHeader=g;exports.SheetOverlay=c;exports.SheetPortal=d;exports.SheetTitle=S;exports.SheetTrigger=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),w=require("react"),R=require("@radix-ui/react-dialog"),k=require("class-variance-authority"),C=require("@brightlocal/icons"),i=require("@brightlocal/ui-components/lib/utils");function f(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const n=f(w),o=f(R),O=k.cva(["bg-background","data-[state=open]:animate-in","data-[state=closed]:animate-out","fixed","z-50","flex","flex-col","gap-4","p-6","shadow-lg","transition","ease-in-out","data-[state=closed]:duration-300","data-[state=open]:duration-500"],{variants:{side:{top:["data-[state=closed]:slide-out-to-top","data-[state=open]:slide-in-from-top","inset-x-0","top-0","h-auto","border-b"],right:["data-[state=closed]:slide-out-to-right","data-[state=open]:slide-in-from-right","inset-y-0","right-0","h-full","w-3/4","border-l","sm:max-w-sm"],bottom:["data-[state=closed]:slide-out-to-bottom","data-[state=open]:slide-in-from-bottom","inset-x-0","bottom-0","h-auto","border-t"],left:["data-[state=closed]:slide-out-to-left","data-[state=open]:slide-in-from-left","inset-y-0","left-0","h-full","w-3/4","border-r","sm:max-w-sm"]}},defaultVariants:{side:"right"}});function u({...e}){return s.jsx(o.Root,{"data-slot":"sheet",modal:!0,...e})}u.displayName="Sheet";const m=n.forwardRef(({dataHook:e,...t},a)=>s.jsx(o.Trigger,{ref:a,"data-slot":"sheet-trigger",...e!=null&&{"data-hook":e},...t}));m.displayName="SheetTrigger";const p=n.forwardRef(({...e},t)=>s.jsx(o.Close,{ref:t,"data-slot":"sheet-close",...e}));p.displayName="SheetClose";function c({...e}){return s.jsx(o.Portal,{"data-slot":"sheet-portal",...e})}c.displayName="SheetPortal";const h=n.forwardRef(({className:e,...t},a)=>s.jsx(o.Overlay,{ref:a,className:i.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),"data-slot":"sheet-overlay",...t}));h.displayName="SheetOverlay";const g=n.forwardRef(({className:e,children:t,side:a,dataHook:r,trackingEl:l,trackingLabel:d,closeLabel:j,...N},v)=>s.jsxs(c,{children:[s.jsx(h,{}),s.jsxs(o.Content,{ref:v,className:i.cn(O({side:a}),e),"data-hook":r,"data-slot":"sheet-content","data-tracking-el":l,"data-tracking-label":d,...N,children:[t,s.jsxs(o.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",children:[s.jsx(C.X,{}),s.jsx("span",{className:"sr-only",children:j??"Close"})]})]})]}));g.displayName="SheetContent";const x=n.forwardRef(({className:e,...t},a)=>s.jsx("div",{ref:a,className:i.cn("flex flex-col gap-2 text-center sm:text-left",e),"data-slot":"sheet-header",...t}));x.displayName="SheetHeader";const S=n.forwardRef(({className:e,...t},a)=>s.jsx("div",{ref:a,className:i.cn("mt-auto flex flex-col gap-2 sm:flex-row sm:justify-end",e),"data-slot":"sheet-footer",...t}));S.displayName="SheetFooter";const y=n.forwardRef(({className:e,icon:t,children:a,dataHook:r,...l},d)=>s.jsxs(o.Title,{ref:d,className:i.cn("text-foreground text-lg font-semibold",t&&"flex items-center gap-2",e),"data-hook":r,"data-slot":"sheet-title",...l,children:[t&&s.jsx("span",{className:"shrink-0 [&_svg]:size-5","data-slot":"sheet-title-icon",children:t}),a]}));y.displayName="SheetTitle";const b=n.forwardRef(({className:e,dataHook:t,...a},r)=>s.jsx(o.Description,{ref:r,className:i.cn("text-muted-foreground text-sm",e),"data-hook":t,"data-slot":"sheet-description",...a}));b.displayName="SheetDescription";exports.Sheet=u;exports.SheetClose=p;exports.SheetContent=g;exports.SheetDescription=b;exports.SheetFooter=S;exports.SheetHeader=x;exports.SheetOverlay=h;exports.SheetPortal=c;exports.SheetTitle=y;exports.SheetTrigger=m;
package/dist/sheet.d.ts CHANGED
@@ -98,6 +98,11 @@ declare const SheetFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHT
98
98
  * Props for the SheetTitle component
99
99
  */
100
100
  interface SheetTitleProps extends React.ComponentProps<typeof SheetPrimitive.Title> {
101
+ /**
102
+ * Data hook for automated testing
103
+ * @example "sheet-title"
104
+ */
105
+ dataHook?: string;
101
106
  /**
102
107
  * Optional icon rendered before the title text.
103
108
  * Pass any React node (typically a DS icon component).
@@ -110,11 +115,21 @@ interface SheetTitleProps extends React.ComponentProps<typeof SheetPrimitive.Tit
110
115
  * Should be used within SheetHeader.
111
116
  */
112
117
  declare const SheetTitle: React.ForwardRefExoticComponent<Omit<SheetTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
118
+ /**
119
+ * Props for the SheetDescription component
120
+ */
121
+ interface SheetDescriptionProps extends React.ComponentProps<typeof SheetPrimitive.Description> {
122
+ /**
123
+ * Data hook for automated testing
124
+ * @example "sheet-description"
125
+ */
126
+ dataHook?: string;
127
+ }
113
128
  /**
114
129
  * Sheet description component for additional context.
115
130
  * Should be used within SheetHeader below SheetTitle.
116
131
  */
117
- declare const SheetDescription: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
132
+ declare const SheetDescription: React.ForwardRefExoticComponent<Omit<SheetDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
118
133
  export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, };
119
- export type { SheetContentProps, SheetTitleProps, SheetTriggerProps };
134
+ export type { SheetContentProps, SheetDescriptionProps, SheetTitleProps, SheetTriggerProps, };
120
135
  //# sourceMappingURL=sheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sheet.d.ts","sourceRoot":"","sources":["../../src/components/sheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5D,QAAA,MAAM,oBAAoB;;8EA8DzB,CAAC;AAEF;;;GAGG;AACH,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE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AClB,CAAC"}
package/dist/sheet.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as o, jsxs as d } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as l } from "react/jsx-runtime";
2
2
  import * as r from "react";
3
3
  import * as s from "@radix-ui/react-dialog";
4
4
  import { cva as u } from "class-variance-authority";
@@ -75,21 +75,21 @@ const b = r.forwardRef(({ dataHook: t, ...e }, a) => /* @__PURE__ */ o(
75
75
  s.Trigger,
76
76
  {
77
77
  ref: a,
78
- "data-hook": t,
79
78
  "data-slot": "sheet-trigger",
79
+ ...t != null && { "data-hook": t },
80
80
  ...e
81
81
  }
82
82
  ));
83
83
  b.displayName = "SheetTrigger";
84
84
  const N = r.forwardRef(({ ...t }, e) => /* @__PURE__ */ o(s.Close, { ref: e, "data-slot": "sheet-close", ...t }));
85
85
  N.displayName = "SheetClose";
86
- function f({
86
+ function c({
87
87
  ...t
88
88
  }) {
89
89
  return /* @__PURE__ */ o(s.Portal, { "data-slot": "sheet-portal", ...t });
90
90
  }
91
- f.displayName = "SheetPortal";
92
- const c = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
91
+ c.displayName = "SheetPortal";
92
+ const m = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
93
93
  s.Overlay,
94
94
  {
95
95
  ref: a,
@@ -101,32 +101,32 @@ const c = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
101
101
  ...e
102
102
  }
103
103
  ));
104
- c.displayName = "SheetOverlay";
104
+ m.displayName = "SheetOverlay";
105
105
  const v = r.forwardRef(
106
106
  ({
107
107
  className: t,
108
108
  children: e,
109
109
  side: a,
110
- dataHook: l,
110
+ dataHook: d,
111
111
  trackingEl: n,
112
- trackingLabel: m,
112
+ trackingLabel: f,
113
113
  closeLabel: h,
114
114
  ...p
115
- }, g) => /* @__PURE__ */ d(f, { children: [
116
- /* @__PURE__ */ o(c, {}),
117
- /* @__PURE__ */ d(
115
+ }, g) => /* @__PURE__ */ l(c, { children: [
116
+ /* @__PURE__ */ o(m, {}),
117
+ /* @__PURE__ */ l(
118
118
  s.Content,
119
119
  {
120
120
  ref: g,
121
121
  className: i(y({ side: a }), t),
122
- "data-hook": l,
122
+ "data-hook": d,
123
123
  "data-slot": "sheet-content",
124
124
  "data-tracking-el": n,
125
- "data-tracking-label": m,
125
+ "data-tracking-label": f,
126
126
  ...p,
127
127
  children: [
128
128
  e,
129
- /* @__PURE__ */ d(s.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", children: [
129
+ /* @__PURE__ */ l(s.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0", children: [
130
130
  /* @__PURE__ */ o(x, {}),
131
131
  /* @__PURE__ */ o("span", { className: "sr-only", children: h ?? "Close" })
132
132
  ] })
@@ -146,7 +146,7 @@ const w = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
146
146
  }
147
147
  ));
148
148
  w.displayName = "SheetHeader";
149
- const R = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
149
+ const k = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
150
150
  "div",
151
151
  {
152
152
  ref: a,
@@ -158,32 +158,34 @@ const R = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
158
158
  ...e
159
159
  }
160
160
  ));
161
- R.displayName = "SheetFooter";
162
- const k = r.forwardRef(({ className: t, icon: e, children: a, ...l }, n) => /* @__PURE__ */ d(
161
+ k.displayName = "SheetFooter";
162
+ const R = r.forwardRef(({ className: t, icon: e, children: a, dataHook: d, ...n }, f) => /* @__PURE__ */ l(
163
163
  s.Title,
164
164
  {
165
- ref: n,
165
+ ref: f,
166
166
  className: i(
167
167
  "text-foreground text-lg font-semibold",
168
168
  e && "flex items-center gap-2",
169
169
  t
170
170
  ),
171
+ "data-hook": d,
171
172
  "data-slot": "sheet-title",
172
- ...l,
173
+ ...n,
173
174
  children: [
174
175
  e && /* @__PURE__ */ o("span", { className: "shrink-0 [&_svg]:size-5", "data-slot": "sheet-title-icon", children: e }),
175
176
  a
176
177
  ]
177
178
  }
178
179
  ));
179
- k.displayName = "SheetTitle";
180
- const C = r.forwardRef(({ className: t, ...e }, a) => /* @__PURE__ */ o(
180
+ R.displayName = "SheetTitle";
181
+ const C = r.forwardRef(({ className: t, dataHook: e, ...a }, d) => /* @__PURE__ */ o(
181
182
  s.Description,
182
183
  {
183
- ref: a,
184
+ ref: d,
184
185
  className: i("text-muted-foreground text-sm", t),
186
+ "data-hook": e,
185
187
  "data-slot": "sheet-description",
186
- ...e
188
+ ...a
187
189
  }
188
190
  ));
189
191
  C.displayName = "SheetDescription";
@@ -192,10 +194,10 @@ export {
192
194
  N as SheetClose,
193
195
  v as SheetContent,
194
196
  C as SheetDescription,
195
- R as SheetFooter,
197
+ k as SheetFooter,
196
198
  w as SheetHeader,
197
- c as SheetOverlay,
198
- f as SheetPortal,
199
- k as SheetTitle,
199
+ m as SheetOverlay,
200
+ c as SheetPortal,
201
+ R as SheetTitle,
200
202
  b as SheetTrigger
201
203
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -5,6 +5,7 @@ import { motion, AnimatePresence } from "framer-motion";
5
5
  import { X } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
+ import { usePrefersReducedMotion } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
8
9
  import { Button, type ButtonProps } from "../components/button";
9
10
  import { Input } from "../components/input";
10
11
  import { Item, ItemContent, ItemTitle, ItemActions } from "../components/list";
@@ -250,6 +251,12 @@ function InputListItems({
250
251
  }: InputListItemsProps) {
251
252
  const { value, removeItem, stableKeys } = useInputListContext();
252
253
 
254
+ // Resolves the reduced-motion preference from the OS, or an override (e.g. the
255
+ // Storybook "Reduce Motion" toolbar) when one is present. When reduced motion
256
+ // is requested, items mount at their final state (`initial={false}`) instead
257
+ // of flashing in.
258
+ const shouldReduceMotion = usePrefersReducedMotion();
259
+
253
260
  if (loading) {
254
261
  return (
255
262
  <ul
@@ -284,7 +291,7 @@ function InputListItems({
284
291
  scale: { duration: 0.12 },
285
292
  },
286
293
  }}
287
- initial={{ opacity: 0, scale: 0.8 }}
294
+ initial={shouldReduceMotion ? false : { opacity: 0, scale: 0.8 }}
288
295
  transition={{
289
296
  opacity: { duration: 0.15 },
290
297
  scale: { duration: 0.15 },
@@ -131,13 +131,27 @@ const AlertDialogFooter = React.forwardRef<
131
131
 
132
132
  AlertDialogFooter.displayName = "AlertDialogFooter";
133
133
 
134
+ /**
135
+ * Props for the AlertDialogTitle component
136
+ */
137
+ interface AlertDialogTitleProps extends React.ComponentProps<
138
+ typeof AlertDialogPrimitive.Title
139
+ > {
140
+ /**
141
+ * Data hook for automated testing
142
+ * @example "alert-dialog-title"
143
+ */
144
+ dataHook?: string;
145
+ }
146
+
134
147
  const AlertDialogTitle = React.forwardRef<
135
148
  React.ComponentRef<typeof AlertDialogPrimitive.Title>,
136
- React.ComponentProps<typeof AlertDialogPrimitive.Title>
137
- >(({ className, ...props }, ref) => (
149
+ AlertDialogTitleProps
150
+ >(({ className, dataHook, ...props }, ref) => (
138
151
  <AlertDialogPrimitive.Title
139
152
  ref={ref}
140
153
  className={cn("text-lg font-semibold", className)}
154
+ data-hook={dataHook}
141
155
  data-slot="alert-dialog-title"
142
156
  {...props}
143
157
  />
@@ -145,13 +159,27 @@ const AlertDialogTitle = React.forwardRef<
145
159
 
146
160
  AlertDialogTitle.displayName = "AlertDialogTitle";
147
161
 
162
+ /**
163
+ * Props for the AlertDialogDescription component
164
+ */
165
+ interface AlertDialogDescriptionProps extends React.ComponentProps<
166
+ typeof AlertDialogPrimitive.Description
167
+ > {
168
+ /**
169
+ * Data hook for automated testing
170
+ * @example "alert-dialog-description"
171
+ */
172
+ dataHook?: string;
173
+ }
174
+
148
175
  const AlertDialogDescription = React.forwardRef<
149
176
  React.ComponentRef<typeof AlertDialogPrimitive.Description>,
150
- React.ComponentProps<typeof AlertDialogPrimitive.Description>
151
- >(({ className, ...props }, ref) => (
177
+ AlertDialogDescriptionProps
178
+ >(({ className, dataHook, ...props }, ref) => (
152
179
  <AlertDialogPrimitive.Description
153
180
  ref={ref}
154
181
  className={cn("text-muted-foreground text-sm", className)}
182
+ data-hook={dataHook}
155
183
  data-slot="alert-dialog-description"
156
184
  {...props}
157
185
  />
@@ -200,3 +228,9 @@ export {
200
228
  AlertDialogAction,
201
229
  AlertDialogCancel,
202
230
  };
231
+
232
+ export type {
233
+ AlertDialogDescriptionProps,
234
+ AlertDialogProps,
235
+ AlertDialogTitleProps,
236
+ };
@@ -172,22 +172,61 @@ type CardSubComponentProps = React.ComponentProps<"div"> & {
172
172
  * Content to render inside the component
173
173
  */
174
174
  children?: React.ReactNode;
175
+ /**
176
+ * Data hook for automated testing
177
+ * @example "card-header", "card-title"
178
+ */
179
+ dataHook?: string;
180
+ };
181
+
182
+ /**
183
+ * Alignment variant for CardHeader layout.
184
+ */
185
+ type CardHeaderAlign = "left" | "center" | "right";
186
+
187
+ const cardHeaderVariants = cva(
188
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
189
+ {
190
+ variants: {
191
+ align: {
192
+ left: "items-start",
193
+ center: "justify-items-center text-center",
194
+ right: "items-start text-right",
195
+ },
196
+ },
197
+ defaultVariants: {
198
+ align: "left",
199
+ },
200
+ }
201
+ );
202
+
203
+ /**
204
+ * Props for the CardHeader component.
205
+ */
206
+ type CardHeaderProps = CardSubComponentProps & {
207
+ /**
208
+ * Content alignment within the header.
209
+ * Use `"center"` for status screens with an illustration above heading and description.
210
+ * @default "left"
211
+ */
212
+ align?: CardHeaderAlign;
175
213
  };
176
214
 
177
215
  /**
178
216
  * Header section of the Card containing title and description.
179
217
  */
180
- const CardHeader = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
181
- ({ className, ...props }, ref) => {
218
+ const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
219
+ ({ className, align = "left", dataHook, ...props }, ref) => {
182
220
  const { flush, density } = React.useContext(CardContext);
183
221
  return (
184
222
  <div
185
223
  ref={ref}
186
224
  className={cn(
187
- "@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]",
225
+ cardHeaderVariants({ align }),
188
226
  subPadding(flush, density),
189
227
  className
190
228
  )}
229
+ data-hook={dataHook}
191
230
  data-slot="card-header"
192
231
  {...props}
193
232
  />
@@ -228,10 +267,11 @@ type CardTitleProps = CardSubComponentProps & {
228
267
  * Title element within the Card header.
229
268
  */
230
269
  const CardTitle = React.forwardRef<HTMLDivElement, CardTitleProps>(
231
- ({ className, size = "default", ...props }, ref) => (
270
+ ({ className, size = "default", dataHook, ...props }, ref) => (
232
271
  <div
233
272
  ref={ref}
234
273
  className={cn(cardTitleVariants({ size }), className)}
274
+ data-hook={dataHook}
235
275
  data-slot="card-title"
236
276
  {...props}
237
277
  />
@@ -243,13 +283,14 @@ CardTitle.displayName = "CardTitle";
243
283
  * Description text within the Card header.
244
284
  */
245
285
  const CardDescription = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
246
- ({ className, ...props }, ref) => (
286
+ ({ className, dataHook, ...props }, ref) => (
247
287
  <div
248
288
  ref={ref}
249
289
  className={cn(
250
290
  "text-muted-foreground text-sm leading-normal font-normal",
251
291
  className
252
292
  )}
293
+ data-hook={dataHook}
253
294
  data-slot="card-description"
254
295
  {...props}
255
296
  />
@@ -261,13 +302,14 @@ CardDescription.displayName = "CardDescription";
261
302
  * Action area within the Card header for buttons or controls.
262
303
  */
263
304
  const CardAction = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
264
- ({ className, ...props }, ref) => (
305
+ ({ className, dataHook, ...props }, ref) => (
265
306
  <div
266
307
  ref={ref}
267
308
  className={cn(
268
309
  "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
269
310
  className
270
311
  )}
312
+ data-hook={dataHook}
271
313
  data-slot="card-action"
272
314
  {...props}
273
315
  />
@@ -279,12 +321,13 @@ CardAction.displayName = "CardAction";
279
321
  * Media container for images, videos, or other visual content within the Card.
280
322
  */
281
323
  const CardMedia = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
282
- ({ className, children, ...props }, ref) => {
324
+ ({ className, children, dataHook, ...props }, ref) => {
283
325
  const { flush, density } = React.useContext(CardContext);
284
326
  return (
285
327
  <div
286
328
  ref={ref}
287
329
  className={cn(subPadding(flush, density), className)}
330
+ data-hook={dataHook}
288
331
  data-slot="card-media"
289
332
  {...props}
290
333
  >
@@ -301,12 +344,13 @@ CardMedia.displayName = "CardMedia";
301
344
  * Main content area of the Card.
302
345
  */
303
346
  const CardContent = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
304
- ({ className, ...props }, ref) => {
347
+ ({ className, dataHook, ...props }, ref) => {
305
348
  const { flush, density } = React.useContext(CardContext);
306
349
  return (
307
350
  <div
308
351
  ref={ref}
309
352
  className={cn(subPadding(flush, density), className)}
353
+ data-hook={dataHook}
310
354
  data-slot="card-content"
311
355
  {...props}
312
356
  />
@@ -319,7 +363,7 @@ CardContent.displayName = "CardContent";
319
363
  * Footer section of the Card for actions or metadata.
320
364
  */
321
365
  const CardFooter = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
322
- ({ className, ...props }, ref) => {
366
+ ({ className, dataHook, ...props }, ref) => {
323
367
  const { flush, density } = React.useContext(CardContext);
324
368
  return (
325
369
  <div
@@ -329,6 +373,7 @@ const CardFooter = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
329
373
  subPadding(flush, density),
330
374
  className
331
375
  )}
376
+ data-hook={dataHook}
332
377
  data-slot="card-footer"
333
378
  {...props}
334
379
  />
@@ -351,6 +396,8 @@ export {
351
396
  export type {
352
397
  CardProps,
353
398
  CardSubComponentProps,
399
+ CardHeaderProps,
400
+ CardHeaderAlign,
354
401
  CardTitleProps,
355
402
  CardTitleSize,
356
403
  CardVariant,
@@ -232,10 +232,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
232
232
  data-slot="chip-loading"
233
233
  role="status"
234
234
  >
235
- <LoaderCircle
236
- className="animate-spin motion-reduce:animate-none"
237
- size={iconSize}
238
- />
235
+ <LoaderCircle className="animate-spin" size={iconSize} />
239
236
  </span>
240
237
  ) : (
241
238
  <button