@brightlocal/ui-components 2.17.1 → 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 (61) 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/sheet.cjs +1 -1
  46. package/dist/sheet.d.ts +17 -2
  47. package/dist/sheet.d.ts.map +1 -1
  48. package/dist/sheet.js +29 -27
  49. package/package.json +3 -3
  50. package/src/blocks/input-list.tsx +8 -1
  51. package/src/components/alert-dialog.tsx +38 -4
  52. package/src/components/card.tsx +56 -9
  53. package/src/components/chip.tsx +1 -4
  54. package/src/components/dialog.tsx +39 -6
  55. package/src/components/dropdown-menu.tsx +7 -1
  56. package/src/components/field.tsx +6 -0
  57. package/src/components/link.tsx +103 -27
  58. package/src/components/map.tsx +1 -2
  59. package/src/components/progress.tsx +12 -6
  60. package/src/components/sheet.tsx +30 -5
  61. package/src/hooks/use-prefers-reduced-motion.ts +35 -5
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,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,2CAE5E;kBAFQ,KAAK;;;AAKd;;GAEG;AACH,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CACtD,OAAO,cAAc,CA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;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,QAAA,MAAM,YAAY,uGAsCjB,CAAC;AAGF;;;GAGG;AACH,QAAA,MAAM,WAAW,mKAUf,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,WAAW,mKAaf,CAAC;AAGH;;GAEG;AACH,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CACpD,OAAO,cAAc,CAAC,KAAK,CAC5B;IACC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED;;;GAGG;AACH,QAAA,MAAM,UAAU,yGAsBd,CAAC;AAGH;;GAEG;AACH,UAAU,qBAAsB,SAAQ,KAAK,CAAC,cAAc,CAC1D,OAAO,cAAc,CAAC,WAAW,CAClC;IACC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,gBAAgB,iHAWpB,CAAC;AAGH,OAAO,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,GACb,CAAC;AAEF,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,GAClB,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.1",
3
+ "version": "2.18.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -195,8 +195,8 @@
195
195
  "sonner": "^2.0.7",
196
196
  "tailwind-merge": "^3.4.0",
197
197
  "vaul": "^1.1.2",
198
- "@brightlocal/illustrations": "0.5.0",
199
- "@brightlocal/icons": "2.3.1"
198
+ "@brightlocal/icons": "2.3.1",
199
+ "@brightlocal/illustrations": "0.5.0"
200
200
  },
201
201
  "size-limit": [
202
202
  {
@@ -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
@@ -35,8 +35,8 @@ const DialogTrigger = React.forwardRef<
35
35
  >(({ dataHook, ...props }, ref) => (
36
36
  <DialogPrimitive.Trigger
37
37
  ref={ref}
38
- data-hook={dataHook}
39
38
  data-slot="dialog-trigger"
39
+ {...(dataHook != null && { "data-hook": dataHook })}
40
40
  {...props}
41
41
  />
42
42
  ));
@@ -191,34 +191,62 @@ const DialogFooter = React.forwardRef<
191
191
  ));
192
192
  DialogFooter.displayName = "DialogFooter";
193
193
 
194
+ /**
195
+ * Props for the DialogTitle component
196
+ */
197
+ interface DialogTitleProps extends React.ComponentProps<
198
+ typeof DialogPrimitive.Title
199
+ > {
200
+ /**
201
+ * Data hook for automated testing
202
+ * @example "dialog-title"
203
+ */
204
+ dataHook?: string;
205
+ }
206
+
194
207
  /**
195
208
  * DialogTitle - The title of the dialog
196
209
  * @description Renders an accessible title for the dialog
197
210
  */
198
211
  const DialogTitle = React.forwardRef<
199
212
  React.ComponentRef<typeof DialogPrimitive.Title>,
200
- React.ComponentProps<typeof DialogPrimitive.Title>
201
- >(({ className, ...props }, ref) => (
213
+ DialogTitleProps
214
+ >(({ className, dataHook, ...props }, ref) => (
202
215
  <DialogPrimitive.Title
203
216
  ref={ref}
204
217
  className={cn("text-lg leading-none font-semibold", className)}
218
+ data-hook={dataHook}
205
219
  data-slot="dialog-title"
206
220
  {...props}
207
221
  />
208
222
  ));
209
223
  DialogTitle.displayName = "DialogTitle";
210
224
 
225
+ /**
226
+ * Props for the DialogDescription component
227
+ */
228
+ interface DialogDescriptionProps extends React.ComponentProps<
229
+ typeof DialogPrimitive.Description
230
+ > {
231
+ /**
232
+ * Data hook for automated testing
233
+ * @example "dialog-description"
234
+ */
235
+ dataHook?: string;
236
+ }
237
+
211
238
  /**
212
239
  * DialogDescription - The description of the dialog
213
240
  * @description Renders an accessible description for the dialog
214
241
  */
215
242
  const DialogDescription = React.forwardRef<
216
243
  React.ComponentRef<typeof DialogPrimitive.Description>,
217
- React.ComponentProps<typeof DialogPrimitive.Description>
218
- >(({ className, ...props }, ref) => (
244
+ DialogDescriptionProps
245
+ >(({ className, dataHook, ...props }, ref) => (
219
246
  <DialogPrimitive.Description
220
247
  ref={ref}
221
248
  className={cn("text-muted-foreground text-sm", className)}
249
+ data-hook={dataHook}
222
250
  data-slot="dialog-description"
223
251
  {...props}
224
252
  />
@@ -238,4 +266,9 @@ export {
238
266
  DialogTrigger,
239
267
  };
240
268
 
241
- export type { DialogContentProps, DialogTriggerProps };
269
+ export type {
270
+ DialogContentProps,
271
+ DialogDescriptionProps,
272
+ DialogTitleProps,
273
+ DialogTriggerProps,
274
+ };
@@ -364,6 +364,11 @@ DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
364
364
  type DropdownMenuLabelProps = React.ComponentPropsWithoutRef<
365
365
  typeof DropdownMenuPrimitive.Label
366
366
  > & {
367
+ /**
368
+ * Data hook for automated testing
369
+ * @example "dropdown-menu-label"
370
+ */
371
+ dataHook?: string;
367
372
  /**
368
373
  * Indent the label (for hierarchical menus)
369
374
  */
@@ -376,7 +381,7 @@ type DropdownMenuLabelProps = React.ComponentPropsWithoutRef<
376
381
  const DropdownMenuLabel = React.forwardRef<
377
382
  React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
378
383
  DropdownMenuLabelProps
379
- >(({ className, inset, ...props }, ref) => {
384
+ >(({ className, inset, dataHook, ...props }, ref) => {
380
385
  return (
381
386
  <DropdownMenuPrimitive.Label
382
387
  ref={ref}
@@ -387,6 +392,7 @@ const DropdownMenuLabel = React.forwardRef<
387
392
  ],
388
393
  className
389
394
  )}
395
+ data-hook={dataHook}
390
396
  data-inset={inset}
391
397
  data-slot="dropdown-menu-label"
392
398
  {...props}
@@ -127,6 +127,10 @@ const fieldVariants = cva(
127
127
  */
128
128
  interface FieldProps
129
129
  extends React.ComponentProps<"div">, VariantProps<typeof fieldVariants> {
130
+ /**
131
+ * Data hook for automated testing
132
+ */
133
+ dataHook?: string;
130
134
  /**
131
135
  * Controls the grid column sizing for horizontal orientation.
132
136
  * - `"start"` (default): `auto 1fr` — control left, content right
@@ -140,6 +144,7 @@ function Field({
140
144
  orientation = "vertical",
141
145
  variant = "default",
142
146
  align = "start",
147
+ dataHook,
143
148
  ...props
144
149
  }: FieldProps) {
145
150
  return (
@@ -151,6 +156,7 @@ function Field({
151
156
  "grid-cols-[1fr_auto]",
152
157
  className
153
158
  )}
159
+ data-hook={dataHook}
154
160
  data-orientation={orientation}
155
161
  data-slot="field"
156
162
  data-variant={variant}