@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/card.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),T=require("react"),u=require("class-variance-authority"),o=require("@brightlocal/ui-components/lib/utils");function D(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const d=D(T),c=d.createContext({flush:!1,density:"default"});function l(e,a){return!e&&(a==="condensed"?"px-3":"px-section-md")}const V=u.cva(["flex","flex-col","rounded-xl","transition-colors","w-full","max-w-[400px]"],{variants:{variant:{filled:["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"]},density:{default:["gap-8","py-section-md"],condensed:["gap-3","py-3"]}},defaultVariants:{variant:"filled",density:"default"}}),m=d.forwardRef(({className:e,variant:a="filled",density:t="default",dataHook:r,trackingEl:n,trackingLabel:f,maxWidth:i,children:N,style:w,...j},h)=>{const R=a==="transparent-flush";d.useEffect(()=>{process.env.NODE_ENV!=="production"&&i!==void 0&&console.warn('Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").')},[i]);const O=i!==void 0?{maxWidth:typeof i=="number"?`${i}px`:i}:void 0;return s.jsx(c.Provider,{value:{flush:R,density:t},children:s.jsx("div",{ref:h,className:o.cn(V({variant:a,density:t}),e),"data-density":t,"data-hook":r,"data-slot":"card","data-tracking-el":n||`card-${a}`,"data-tracking-label":f,style:{...O,...w},...j,children:N})})});m.displayName="Card";const p=d.forwardRef(({className:e,...a},t)=>{const{flush:r,density:n}=d.useContext(c);return s.jsx("div",{ref:t,className:o.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]",l(r,n),e),"data-slot":"card-header",...a})});p.displayName="CardHeader";const _=u.cva("font-display font-medium",{variants:{size:{small:"text-base",default:"text-2xl"}},defaultVariants:{size:"default"}}),x=d.forwardRef(({className:e,size:a="default",...t},r)=>s.jsx("div",{ref:r,className:o.cn(_({size:a}),e),"data-slot":"card-title",...t}));x.displayName="CardTitle";const C=d.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("text-muted-foreground text-sm leading-normal font-normal",e),"data-slot":"card-description",...a}));C.displayName="CardDescription";const g=d.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:o.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),"data-slot":"card-action",...a}));g.displayName="CardAction";const y=d.forwardRef(({className:e,children:a,...t},r)=>{const{flush:n,density:f}=d.useContext(c);return s.jsx("div",{ref:r,className:o.cn(l(n,f),e),"data-slot":"card-media",...t,children:s.jsx("div",{className:"overflow-hidden rounded-md","data-slot":"card-media-clip",children:a})})});y.displayName="CardMedia";const b=d.forwardRef(({className:e,...a},t)=>{const{flush:r,density:n}=d.useContext(c);return s.jsx("div",{ref:t,className:o.cn(l(r,n),e),"data-slot":"card-content",...a})});b.displayName="CardContent";const v=d.forwardRef(({className:e,...a},t)=>{const{flush:r,density:n}=d.useContext(c);return s.jsx("div",{ref:t,className:o.cn("flex items-center",l(r,n),e),"data-slot":"card-footer",...a})});v.displayName="CardFooter";exports.Card=m;exports.CardAction=g;exports.CardContent=b;exports.CardDescription=C;exports.CardFooter=v;exports.CardHeader=p;exports.CardMedia=y;exports.CardTitle=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),V=require("react"),u=require("class-variance-authority"),c=require("@brightlocal/ui-components/lib/utils");function O(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const d=O(V),l=d.createContext({flush:!1,density:"default"});function f(a,t){return!a&&(t==="condensed"?"px-3":"px-section-md")}const T=u.cva(["flex","flex-col","rounded-xl","transition-colors","w-full","max-w-[400px]"],{variants:{variant:{filled:["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"]},density:{default:["gap-8","py-section-md"],condensed:["gap-3","py-3"]}},defaultVariants:{variant:"filled",density:"default"}}),m=d.forwardRef(({className:a,variant:t="filled",density:e="default",dataHook:r,trackingEl:s,trackingLabel:i,maxWidth:o,children:b,style:N,...w},j)=>{const k=t==="transparent-flush";d.useEffect(()=>{process.env.NODE_ENV!=="production"&&o!==void 0&&console.warn('Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").')},[o]);const R=o!==void 0?{maxWidth:typeof o=="number"?`${o}px`:o}:void 0;return n.jsx(l.Provider,{value:{flush:k,density:e},children:n.jsx("div",{ref:j,className:c.cn(T({variant:t,density:e}),a),"data-density":e,"data-hook":r,"data-slot":"card","data-tracking-el":s||`card-${t}`,"data-tracking-label":i,style:{...R,...N},...w,children:b})})});m.displayName="Card";const D=u.cva("@container/card-header grid auto-rows-min grid-rows-[auto_auto] gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",{variants:{align:{left:"items-start",center:"justify-items-center text-center",right:"items-start text-right"}},defaultVariants:{align:"left"}}),p=d.forwardRef(({className:a,align:t="left",dataHook:e,...r},s)=>{const{flush:i,density:o}=d.useContext(l);return n.jsx("div",{ref:s,className:c.cn(D({align:t}),f(i,o),a),"data-hook":e,"data-slot":"card-header",...r})});p.displayName="CardHeader";const _=u.cva("font-display font-medium",{variants:{size:{small:"text-base",default:"text-2xl"}},defaultVariants:{size:"default"}}),x=d.forwardRef(({className:a,size:t="default",dataHook:e,...r},s)=>n.jsx("div",{ref:s,className:c.cn(_({size:t}),a),"data-hook":e,"data-slot":"card-title",...r}));x.displayName="CardTitle";const C=d.forwardRef(({className:a,dataHook:t,...e},r)=>n.jsx("div",{ref:r,className:c.cn("text-muted-foreground text-sm leading-normal font-normal",a),"data-hook":t,"data-slot":"card-description",...e}));C.displayName="CardDescription";const g=d.forwardRef(({className:a,dataHook:t,...e},r)=>n.jsx("div",{ref:r,className:c.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",a),"data-hook":t,"data-slot":"card-action",...e}));g.displayName="CardAction";const y=d.forwardRef(({className:a,children:t,dataHook:e,...r},s)=>{const{flush:i,density:o}=d.useContext(l);return n.jsx("div",{ref:s,className:c.cn(f(i,o),a),"data-hook":e,"data-slot":"card-media",...r,children:n.jsx("div",{className:"overflow-hidden rounded-md","data-slot":"card-media-clip",children:t})})});y.displayName="CardMedia";const h=d.forwardRef(({className:a,dataHook:t,...e},r)=>{const{flush:s,density:i}=d.useContext(l);return n.jsx("div",{ref:r,className:c.cn(f(s,i),a),"data-hook":t,"data-slot":"card-content",...e})});h.displayName="CardContent";const v=d.forwardRef(({className:a,dataHook:t,...e},r)=>{const{flush:s,density:i}=d.useContext(l);return n.jsx("div",{ref:r,className:c.cn("flex items-center",f(s,i),a),"data-hook":t,"data-slot":"card-footer",...e})});v.displayName="CardFooter";exports.Card=m;exports.CardAction=g;exports.CardContent=h;exports.CardDescription=C;exports.CardFooter=v;exports.CardHeader=p;exports.CardMedia=y;exports.CardTitle=x;
package/dist/card.d.ts CHANGED
@@ -58,11 +58,31 @@ type CardSubComponentProps = React.ComponentProps<"div"> & {
58
58
  * Content to render inside the component
59
59
  */
60
60
  children?: React.ReactNode;
61
+ /**
62
+ * Data hook for automated testing
63
+ * @example "card-header", "card-title"
64
+ */
65
+ dataHook?: string;
66
+ };
67
+ /**
68
+ * Alignment variant for CardHeader layout.
69
+ */
70
+ type CardHeaderAlign = "left" | "center" | "right";
71
+ /**
72
+ * Props for the CardHeader component.
73
+ */
74
+ type CardHeaderProps = CardSubComponentProps & {
75
+ /**
76
+ * Content alignment within the header.
77
+ * Use `"center"` for status screens with an illustration above heading and description.
78
+ * @default "left"
79
+ */
80
+ align?: CardHeaderAlign;
61
81
  };
62
82
  /**
63
83
  * Header section of the Card containing title and description.
64
84
  */
65
- declare const CardHeader: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
85
+ declare const CardHeader: React.ForwardRefExoticComponent<Omit<CardHeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
66
86
  /**
67
87
  * Size variant for the CardTitle.
68
88
  */
@@ -102,5 +122,5 @@ declare const CardContent: React.ForwardRefExoticComponent<Omit<CardSubComponent
102
122
  */
103
123
  declare const CardFooter: React.ForwardRefExoticComponent<Omit<CardSubComponentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
104
124
  export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardMedia, CardContent, };
105
- export type { CardProps, CardSubComponentProps, CardTitleProps, CardTitleSize, CardVariant, CardDensity, };
125
+ export type { CardProps, CardSubComponentProps, CardHeaderProps, CardHeaderAlign, CardTitleProps, CardTitleSize, CardVariant, CardDensity, };
106
126
  //# sourceMappingURL=card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,KAAK,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AAE7E;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,WAAW,CAAC;AAqD3C;;GAEG;AACH,KAAK,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;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;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,IAAI,+FAmDT,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,KAAK,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAczC;;GAEG;AAC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,EACd,aAAa,EACb,WAAW,EACX,WAAW,GACZ,CAAC"}
package/dist/card.js CHANGED
@@ -1,12 +1,12 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import * as r from "react";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import * as d from "react";
3
3
  import { cva as u } from "class-variance-authority";
4
- import { cn as n } from "@brightlocal/ui-components/lib/utils";
5
- const l = r.createContext({ flush: !1, density: "default" });
6
- function c(t, a) {
4
+ import { cn as l } from "@brightlocal/ui-components/lib/utils";
5
+ const c = d.createContext({ flush: !1, density: "default" });
6
+ function f(t, a) {
7
7
  return !t && (a === "condensed" ? "px-3" : "px-section-md");
8
8
  }
9
- const g = u(
9
+ const y = u(
10
10
  [
11
11
  "flex",
12
12
  "flex-col",
@@ -43,39 +43,39 @@ const g = u(
43
43
  density: "default"
44
44
  }
45
45
  }
46
- ), v = r.forwardRef(
46
+ ), v = d.forwardRef(
47
47
  ({
48
48
  className: t,
49
49
  variant: a = "filled",
50
50
  density: e = "default",
51
- dataHook: d,
51
+ dataHook: r,
52
52
  trackingEl: o,
53
- trackingLabel: f,
54
- maxWidth: i,
53
+ trackingLabel: i,
54
+ maxWidth: s,
55
55
  children: m,
56
56
  style: p,
57
57
  ...x
58
58
  }, C) => {
59
- const y = a === "transparent-flush";
60
- r.useEffect(() => {
61
- process.env.NODE_ENV !== "production" && i !== void 0 && console.warn(
59
+ const g = a === "transparent-flush";
60
+ d.useEffect(() => {
61
+ process.env.NODE_ENV !== "production" && s !== void 0 && console.warn(
62
62
  'Card: the "maxWidth" prop is deprecated. Use Tailwind max-width utilities via className instead (e.g., className="max-w-sm").'
63
63
  );
64
- }, [i]);
65
- const N = i !== void 0 ? {
66
- maxWidth: typeof i == "number" ? `${i}px` : i
64
+ }, [s]);
65
+ const h = s !== void 0 ? {
66
+ maxWidth: typeof s == "number" ? `${s}px` : s
67
67
  } : void 0;
68
- return /* @__PURE__ */ s(l.Provider, { value: { flush: y, density: e }, children: /* @__PURE__ */ s(
68
+ return /* @__PURE__ */ n(c.Provider, { value: { flush: g, density: e }, children: /* @__PURE__ */ n(
69
69
  "div",
70
70
  {
71
71
  ref: C,
72
- className: n(g({ variant: a, density: e }), t),
72
+ className: l(y({ variant: a, density: e }), t),
73
73
  "data-density": e,
74
- "data-hook": d,
74
+ "data-hook": r,
75
75
  "data-slot": "card",
76
76
  "data-tracking-el": o || `card-${a}`,
77
- "data-tracking-label": f,
78
- style: { ...N, ...p },
77
+ "data-tracking-label": i,
78
+ style: { ...h, ...p },
79
79
  ...x,
80
80
  children: m
81
81
  }
@@ -83,20 +83,35 @@ const g = u(
83
83
  }
84
84
  );
85
85
  v.displayName = "Card";
86
- const w = r.forwardRef(
87
- ({ className: t, ...a }, e) => {
88
- const { flush: d, density: o } = r.useContext(l);
89
- return /* @__PURE__ */ s(
86
+ const N = u(
87
+ "@container/card-header grid auto-rows-min grid-rows-[auto_auto] gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
88
+ {
89
+ variants: {
90
+ align: {
91
+ left: "items-start",
92
+ center: "justify-items-center text-center",
93
+ right: "items-start text-right"
94
+ }
95
+ },
96
+ defaultVariants: {
97
+ align: "left"
98
+ }
99
+ }
100
+ ), w = d.forwardRef(
101
+ ({ className: t, align: a = "left", dataHook: e, ...r }, o) => {
102
+ const { flush: i, density: s } = d.useContext(c);
103
+ return /* @__PURE__ */ n(
90
104
  "div",
91
105
  {
92
- ref: e,
93
- className: n(
94
- "@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]",
95
- c(d, o),
106
+ ref: o,
107
+ className: l(
108
+ N({ align: a }),
109
+ f(i, s),
96
110
  t
97
111
  ),
112
+ "data-hook": e,
98
113
  "data-slot": "card-header",
99
- ...a
114
+ ...r
100
115
  }
101
116
  );
102
117
  }
@@ -112,93 +127,99 @@ const b = u("font-display font-medium", {
112
127
  defaultVariants: {
113
128
  size: "default"
114
129
  }
115
- }), h = r.forwardRef(
116
- ({ className: t, size: a = "default", ...e }, d) => /* @__PURE__ */ s(
130
+ }), k = d.forwardRef(
131
+ ({ className: t, size: a = "default", dataHook: e, ...r }, o) => /* @__PURE__ */ n(
117
132
  "div",
118
133
  {
119
- ref: d,
120
- className: n(b({ size: a }), t),
134
+ ref: o,
135
+ className: l(b({ size: a }), t),
136
+ "data-hook": e,
121
137
  "data-slot": "card-title",
122
- ...e
138
+ ...r
123
139
  }
124
140
  )
125
141
  );
126
- h.displayName = "CardTitle";
127
- const R = r.forwardRef(
128
- ({ className: t, ...a }, e) => /* @__PURE__ */ s(
142
+ k.displayName = "CardTitle";
143
+ const R = d.forwardRef(
144
+ ({ className: t, dataHook: a, ...e }, r) => /* @__PURE__ */ n(
129
145
  "div",
130
146
  {
131
- ref: e,
132
- className: n(
147
+ ref: r,
148
+ className: l(
133
149
  "text-muted-foreground text-sm leading-normal font-normal",
134
150
  t
135
151
  ),
152
+ "data-hook": a,
136
153
  "data-slot": "card-description",
137
- ...a
154
+ ...e
138
155
  }
139
156
  )
140
157
  );
141
158
  R.displayName = "CardDescription";
142
- const V = r.forwardRef(
143
- ({ className: t, ...a }, e) => /* @__PURE__ */ s(
159
+ const V = d.forwardRef(
160
+ ({ className: t, dataHook: a, ...e }, r) => /* @__PURE__ */ n(
144
161
  "div",
145
162
  {
146
- ref: e,
147
- className: n(
163
+ ref: r,
164
+ className: l(
148
165
  "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
149
166
  t
150
167
  ),
168
+ "data-hook": a,
151
169
  "data-slot": "card-action",
152
- ...a
170
+ ...e
153
171
  }
154
172
  )
155
173
  );
156
174
  V.displayName = "CardAction";
157
- const T = r.forwardRef(
158
- ({ className: t, children: a, ...e }, d) => {
159
- const { flush: o, density: f } = r.useContext(l);
160
- return /* @__PURE__ */ s(
175
+ const T = d.forwardRef(
176
+ ({ className: t, children: a, dataHook: e, ...r }, o) => {
177
+ const { flush: i, density: s } = d.useContext(c);
178
+ return /* @__PURE__ */ n(
161
179
  "div",
162
180
  {
163
- ref: d,
164
- className: n(c(o, f), t),
181
+ ref: o,
182
+ className: l(f(i, s), t),
183
+ "data-hook": e,
165
184
  "data-slot": "card-media",
166
- ...e,
167
- children: /* @__PURE__ */ s("div", { className: "overflow-hidden rounded-md", "data-slot": "card-media-clip", children: a })
185
+ ...r,
186
+ children: /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-md", "data-slot": "card-media-clip", children: a })
168
187
  }
169
188
  );
170
189
  }
171
190
  );
172
191
  T.displayName = "CardMedia";
173
- const k = r.forwardRef(
174
- ({ className: t, ...a }, e) => {
175
- const { flush: d, density: o } = r.useContext(l);
176
- return /* @__PURE__ */ s(
192
+ const j = d.forwardRef(
193
+ ({ className: t, dataHook: a, ...e }, r) => {
194
+ const { flush: o, density: i } = d.useContext(c);
195
+ return /* @__PURE__ */ n(
177
196
  "div",
178
197
  {
179
- ref: e,
180
- className: n(c(d, o), t),
198
+ ref: r,
199
+ className: l(f(o, i), t),
200
+ "data-hook": a,
181
201
  "data-slot": "card-content",
182
- ...a
202
+ ...e
183
203
  }
184
204
  );
185
205
  }
186
206
  );
187
- k.displayName = "CardContent";
188
- const D = r.forwardRef(
189
- ({ className: t, ...a }, e) => {
190
- const { flush: d, density: o } = r.useContext(l);
191
- return /* @__PURE__ */ s(
207
+ j.displayName = "CardContent";
208
+ const D = d.forwardRef(
209
+ ({ className: t, dataHook: a, ...e }, r) => {
210
+ const { flush: o, density: i } = d.useContext(c);
211
+ return /* @__PURE__ */ n(
192
212
  "div",
193
213
  {
194
- ref: e,
195
- className: n(
214
+ ref: r,
215
+ className: l(
196
216
  "flex items-center",
197
- c(d, o),
217
+ f(o, i),
198
218
  t
199
219
  ),
220
+ "data-hook": a,
200
221
  "data-slot": "card-footer",
201
- ...a
222
+ ...e
202
223
  }
203
224
  );
204
225
  }
@@ -207,10 +228,10 @@ D.displayName = "CardFooter";
207
228
  export {
208
229
  v as Card,
209
230
  V as CardAction,
210
- k as CardContent,
231
+ j as CardContent,
211
232
  R as CardDescription,
212
233
  D as CardFooter,
213
234
  w as CardHeader,
214
235
  T as CardMedia,
215
- h as CardTitle
236
+ k as CardTitle
216
237
  };
package/dist/chip.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),q=require("react"),x=require("class-variance-authority"),h=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),o=require("@brightlocal/ui-components/tooltip");function S(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>a[n]})}}return e.default=a,Object.freeze(e)}const r=S(q),v=x.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"}}),g=x.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"}}),j=r.forwardRef(({className:a,children:e,size:n="md",loading:s=!1,disabled:y=!1,onRemove:w,dataHook:u,trackingEl:c,trackingLabel:T,maxWidth:z=200,loadingLabel:C,removeAriaLabel:p,...k},N)=>{const f=y||s,b=16,i=r.useRef(null),[O,R]=r.useState(!1);r.useEffect(()=>{const l=()=>{i.current&&R(i.current.scrollWidth>i.current.clientWidth)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[e]);const m=t.jsx("span",{ref:i,className:"truncate","data-slot":"chip-label",style:{maxWidth:z},children:e});return t.jsxs("div",{ref:N,"aria-disabled":f?"true":void 0,className:d.cn(v({size:n}),a),"data-hook":u,"data-slot":"chip","data-tracking-el":c,"data-tracking-label":T,...k,children:[O?t.jsx(o.TooltipProvider,{children:t.jsxs(o.Tooltip,{children:[t.jsx(o.TooltipTrigger,{asChild:!0,children:m}),t.jsx(o.TooltipContent,{dataHook:`${u}-tooltip`,sideOffset:8,children:e})]})}):m,s?t.jsx("span",{"aria-label":C??"Loading",className:d.cn(g({size:n})),"data-slot":"chip-loading",role:"status",children:t.jsx(h.LoaderCircle,{className:"animate-spin motion-reduce:animate-none",size:b})}):t.jsx("button",{"aria-label":p?p.replace("{name}",typeof e=="string"?e:"chip"):`Remove ${typeof e=="string"?e:"chip"}`,className:d.cn(g({size:n})),"data-slot":"chip-delete","data-tracking-el":c?`${c}-delete`:void 0,disabled:f,tabIndex:-1,type:"button",onClick:w,children:t.jsx(h.X,{size:b})})]})});j.displayName="Chip";exports.Chip=j;exports.chipVariants=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),q=require("react"),x=require("class-variance-authority"),m=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),o=require("@brightlocal/ui-components/tooltip");function S(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(e,n,a.get?a:{enumerable:!0,get:()=>s[n]})}}return e.default=s,Object.freeze(e)}const r=S(q),v=x.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"}}),g=x.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"}}),j=r.forwardRef(({className:s,children:e,size:n="md",loading:a=!1,disabled:y=!1,onRemove:w,dataHook:u,trackingEl:l,trackingLabel:T,maxWidth:z=200,loadingLabel:C,removeAriaLabel:p,...k},N)=>{const f=y||a,b=16,i=r.useRef(null),[O,R]=r.useState(!1);r.useEffect(()=>{const c=()=>{i.current&&R(i.current.scrollWidth>i.current.clientWidth)};return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[e]);const h=t.jsx("span",{ref:i,className:"truncate","data-slot":"chip-label",style:{maxWidth:z},children:e});return t.jsxs("div",{ref:N,"aria-disabled":f?"true":void 0,className:d.cn(v({size:n}),s),"data-hook":u,"data-slot":"chip","data-tracking-el":l,"data-tracking-label":T,...k,children:[O?t.jsx(o.TooltipProvider,{children:t.jsxs(o.Tooltip,{children:[t.jsx(o.TooltipTrigger,{asChild:!0,children:h}),t.jsx(o.TooltipContent,{dataHook:`${u}-tooltip`,sideOffset:8,children:e})]})}):h,a?t.jsx("span",{"aria-label":C??"Loading",className:d.cn(g({size:n})),"data-slot":"chip-loading",role:"status",children:t.jsx(m.LoaderCircle,{className:"animate-spin",size:b})}):t.jsx("button",{"aria-label":p?p.replace("{name}",typeof e=="string"?e:"chip"):`Remove ${typeof e=="string"?e:"chip"}`,className:d.cn(g({size:n})),"data-slot":"chip-delete","data-tracking-el":l?`${l}-delete`:void 0,disabled:f,tabIndex:-1,type:"button",onClick:w,children:t.jsx(m.X,{size:b})})]})});j.displayName="Chip";exports.Chip=j;exports.chipVariants=v;
@@ -1 +1 @@
1
- {"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../src/components/chip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B;;GAEG;AACH,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5B,QAAA,MAAM,YAAY;;8EAyCjB,CAAC;AAkCF;;GAEG;AACH,UAAU,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACvE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAChE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,+FA4GT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../src/components/chip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B;;GAEG;AACH,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5B,QAAA,MAAM,YAAY;;8EAyCjB,CAAC;AAkCF;;GAEG;AACH,UAAU,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACvE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAChE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,+FAyGT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
package/dist/chip.js CHANGED
@@ -133,13 +133,7 @@ const I = h(
133
133
  className: r(b({ size: a })),
134
134
  "data-slot": "chip-loading",
135
135
  role: "status",
136
- children: /* @__PURE__ */ e(
137
- R,
138
- {
139
- className: "animate-spin motion-reduce:animate-none",
140
- size: u
141
- }
142
- )
136
+ children: /* @__PURE__ */ e(R, { className: "animate-spin", size: u })
143
137
  }
144
138
  ) : /* @__PURE__ */ e(
145
139
  "button",
package/dist/dialog.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),w=require("react"),h=require("@radix-ui/react-dialog"),R=require("@brightlocal/icons"),s=require("@brightlocal/ui-components/lib/utils");function c(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=c(w),i=c(h),g=i.Root;g.displayName="Dialog";const f=l.forwardRef(({dataHook:e,...a},t)=>o.jsx(i.Trigger,{ref:t,"data-hook":e,"data-slot":"dialog-trigger",...a}));f.displayName="DialogTrigger";function n({...e}){return o.jsx(i.Portal,{...e})}n.displayName="DialogPortal";const u=l.forwardRef(({...e},a)=>o.jsx(i.Close,{ref:a,"data-slot":"dialog-close",...e}));u.displayName="DialogClose";const d=l.forwardRef(({className:e,...a},t)=>o.jsx(i.Overlay,{ref:t,className:s.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":"dialog-overlay",...a}));d.displayName="DialogOverlay";const m=l.forwardRef(({className:e,children:a,dataHook:t,trackingEl:r,trackingLabel:b,closeLabel:j,...N},v)=>o.jsxs(n,{children:[o.jsx(d,{}),o.jsxs(i.Content,{ref:v,className:s.cn("bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-200 sm:max-w-lg",e),"data-hook":t,"data-slot":"dialog-content","data-tracking-el":r,"data-tracking-label":b,...N,children:[a,o.jsxs(i.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 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:[o.jsx(R.X,{}),o.jsx("span",{className:"sr-only",children:j??"Close"})]})]})]}));m.displayName="DialogContent";const p=l.forwardRef(({className:e,...a},t)=>o.jsx("div",{ref:t,className:s.cn("flex flex-col gap-2 text-center sm:text-left",e),"data-slot":"dialog-header",...a}));p.displayName="DialogHeader";const D=l.forwardRef(({className:e,...a},t)=>o.jsx("div",{ref:t,className:s.cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),"data-slot":"dialog-footer",...a}));D.displayName="DialogFooter";const x=l.forwardRef(({className:e,...a},t)=>o.jsx(i.Title,{ref:t,className:s.cn("text-lg leading-none font-semibold",e),"data-slot":"dialog-title",...a}));x.displayName="DialogTitle";const y=l.forwardRef(({className:e,...a},t)=>o.jsx(i.Description,{ref:t,className:s.cn("text-muted-foreground text-sm",e),"data-slot":"dialog-description",...a}));y.displayName="DialogDescription";exports.Dialog=g;exports.DialogClose=u;exports.DialogContent=m;exports.DialogDescription=y;exports.DialogFooter=D;exports.DialogHeader=p;exports.DialogOverlay=d;exports.DialogPortal=n;exports.DialogTitle=x;exports.DialogTrigger=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),h=require("react"),w=require("@radix-ui/react-dialog"),R=require("@brightlocal/icons"),r=require("@brightlocal/ui-components/lib/utils");function c(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,i.get?i:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const s=c(h),l=c(w),g=l.Root;g.displayName="Dialog";const f=s.forwardRef(({dataHook:e,...a},t)=>o.jsx(l.Trigger,{ref:t,"data-slot":"dialog-trigger",...e!=null&&{"data-hook":e},...a}));f.displayName="DialogTrigger";function n({...e}){return o.jsx(l.Portal,{...e})}n.displayName="DialogPortal";const u=s.forwardRef(({...e},a)=>o.jsx(l.Close,{ref:a,"data-slot":"dialog-close",...e}));u.displayName="DialogClose";const d=s.forwardRef(({className:e,...a},t)=>o.jsx(l.Overlay,{ref:t,className:r.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":"dialog-overlay",...a}));d.displayName="DialogOverlay";const m=s.forwardRef(({className:e,children:a,dataHook:t,trackingEl:i,trackingLabel:b,closeLabel:j,...N},v)=>o.jsxs(n,{children:[o.jsx(d,{}),o.jsxs(l.Content,{ref:v,className:r.cn("bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-200 sm:max-w-lg",e),"data-hook":t,"data-slot":"dialog-content","data-tracking-el":i,"data-tracking-label":b,...N,children:[a,o.jsxs(l.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 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:[o.jsx(R.X,{}),o.jsx("span",{className:"sr-only",children:j??"Close"})]})]})]}));m.displayName="DialogContent";const p=s.forwardRef(({className:e,...a},t)=>o.jsx("div",{ref:t,className:r.cn("flex flex-col gap-2 text-center sm:text-left",e),"data-slot":"dialog-header",...a}));p.displayName="DialogHeader";const D=s.forwardRef(({className:e,...a},t)=>o.jsx("div",{ref:t,className:r.cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),"data-slot":"dialog-footer",...a}));D.displayName="DialogFooter";const x=s.forwardRef(({className:e,dataHook:a,...t},i)=>o.jsx(l.Title,{ref:i,className:r.cn("text-lg leading-none font-semibold",e),"data-hook":a,"data-slot":"dialog-title",...t}));x.displayName="DialogTitle";const y=s.forwardRef(({className:e,dataHook:a,...t},i)=>o.jsx(l.Description,{ref:i,className:r.cn("text-muted-foreground text-sm",e),"data-hook":a,"data-slot":"dialog-description",...t}));y.displayName="DialogDescription";exports.Dialog=g;exports.DialogClose=u;exports.DialogContent=m;exports.DialogDescription=y;exports.DialogFooter=D;exports.DialogHeader=p;exports.DialogOverlay=d;exports.DialogPortal=n;exports.DialogTitle=x;exports.DialogTrigger=f;
package/dist/dialog.d.ts CHANGED
@@ -74,16 +74,36 @@ declare const DialogHeader: React.ForwardRefExoticComponent<Omit<React.DetailedH
74
74
  * @description Groups action buttons at the bottom of the dialog
75
75
  */
76
76
  declare const DialogFooter: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
77
+ /**
78
+ * Props for the DialogTitle component
79
+ */
80
+ interface DialogTitleProps extends React.ComponentProps<typeof DialogPrimitive.Title> {
81
+ /**
82
+ * Data hook for automated testing
83
+ * @example "dialog-title"
84
+ */
85
+ dataHook?: string;
86
+ }
77
87
  /**
78
88
  * DialogTitle - The title of the dialog
79
89
  * @description Renders an accessible title for the dialog
80
90
  */
81
- declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
91
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
92
+ /**
93
+ * Props for the DialogDescription component
94
+ */
95
+ interface DialogDescriptionProps extends React.ComponentProps<typeof DialogPrimitive.Description> {
96
+ /**
97
+ * Data hook for automated testing
98
+ * @example "dialog-description"
99
+ */
100
+ dataHook?: string;
101
+ }
82
102
  /**
83
103
  * DialogDescription - The description of the dialog
84
104
  * @description Renders an accessible description for the dialog
85
105
  */
86
- declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
106
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
87
107
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
88
- export type { DialogContentProps, DialogTriggerProps };
108
+ export type { DialogContentProps, DialogDescriptionProps, DialogTitleProps, DialogTriggerProps, };
89
109
  //# sourceMappingURL=dialog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAK1D;;;GAGG;AACH,QAAA,MAAM,MAAM,uCAAuB,CAAC;AAGpC;;GAEG;AACH,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CACvD,OAAO,eAAe,CAAC,OAAO,CAC/B;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,aAAa,2GAUjB,CAAC;AAGH;;;GAGG;AACH,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,2CAErD;kBAJQ,YAAY;;;AAOrB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Z,WAAW,EACX,aAAa,GACd,CAAC;AAEF,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,GACnB,CAAC"}
package/dist/dialog.js CHANGED
@@ -1,53 +1,53 @@
1
- import { jsx as t, jsxs as r } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as d } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
3
  import * as l from "@radix-ui/react-dialog";
4
4
  import { X as u } from "@brightlocal/icons";
5
5
  import { cn as s } from "@brightlocal/ui-components/lib/utils";
6
6
  const D = l.Root;
7
7
  D.displayName = "Dialog";
8
- const x = i.forwardRef(({ dataHook: a, ...e }, o) => /* @__PURE__ */ t(
8
+ const x = i.forwardRef(({ dataHook: a, ...o }, e) => /* @__PURE__ */ t(
9
9
  l.Trigger,
10
10
  {
11
- ref: o,
12
- "data-hook": a,
11
+ ref: e,
13
12
  "data-slot": "dialog-trigger",
14
- ...e
13
+ ...a != null && { "data-hook": a },
14
+ ...o
15
15
  }
16
16
  ));
17
17
  x.displayName = "DialogTrigger";
18
- function d({
18
+ function n({
19
19
  ...a
20
20
  }) {
21
21
  return /* @__PURE__ */ t(l.Portal, { ...a });
22
22
  }
23
- d.displayName = "DialogPortal";
24
- const y = i.forwardRef(({ ...a }, e) => /* @__PURE__ */ t(l.Close, { ref: e, "data-slot": "dialog-close", ...a }));
23
+ n.displayName = "DialogPortal";
24
+ const y = i.forwardRef(({ ...a }, o) => /* @__PURE__ */ t(l.Close, { ref: o, "data-slot": "dialog-close", ...a }));
25
25
  y.displayName = "DialogClose";
26
- const n = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t(
26
+ const g = i.forwardRef(({ className: a, ...o }, e) => /* @__PURE__ */ t(
27
27
  l.Overlay,
28
28
  {
29
- ref: o,
29
+ ref: e,
30
30
  className: s(
31
31
  "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",
32
32
  a
33
33
  ),
34
34
  "data-slot": "dialog-overlay",
35
- ...e
35
+ ...o
36
36
  }
37
37
  ));
38
- n.displayName = "DialogOverlay";
38
+ g.displayName = "DialogOverlay";
39
39
  const N = i.forwardRef(
40
40
  ({
41
41
  className: a,
42
- children: e,
43
- dataHook: o,
44
- trackingEl: g,
42
+ children: o,
43
+ dataHook: e,
44
+ trackingEl: r,
45
45
  trackingLabel: c,
46
46
  closeLabel: f,
47
47
  ...m
48
- }, p) => /* @__PURE__ */ r(d, { children: [
49
- /* @__PURE__ */ t(n, {}),
50
- /* @__PURE__ */ r(
48
+ }, p) => /* @__PURE__ */ d(n, { children: [
49
+ /* @__PURE__ */ t(g, {}),
50
+ /* @__PURE__ */ d(
51
51
  l.Content,
52
52
  {
53
53
  ref: p,
@@ -55,14 +55,14 @@ const N = i.forwardRef(
55
55
  "bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-card-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-8 rounded-xl border p-8 shadow-lg duration-200 sm:max-w-lg",
56
56
  a
57
57
  ),
58
- "data-hook": o,
58
+ "data-hook": e,
59
59
  "data-slot": "dialog-content",
60
- "data-tracking-el": g,
60
+ "data-tracking-el": r,
61
61
  "data-tracking-label": c,
62
62
  ...m,
63
63
  children: [
64
- e,
65
- /* @__PURE__ */ r(l.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 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: [
64
+ o,
65
+ /* @__PURE__ */ d(l.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 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: [
66
66
  /* @__PURE__ */ t(u, {}),
67
67
  /* @__PURE__ */ t("span", { className: "sr-only", children: f ?? "Close" })
68
68
  ] })
@@ -72,58 +72,60 @@ const N = i.forwardRef(
72
72
  ] })
73
73
  );
74
74
  N.displayName = "DialogContent";
75
- const b = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t(
75
+ const h = i.forwardRef(({ className: a, ...o }, e) => /* @__PURE__ */ t(
76
76
  "div",
77
77
  {
78
- ref: o,
78
+ ref: e,
79
79
  className: s("flex flex-col gap-2 text-center sm:text-left", a),
80
80
  "data-slot": "dialog-header",
81
- ...e
81
+ ...o
82
82
  }
83
83
  ));
84
- b.displayName = "DialogHeader";
85
- const v = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t(
84
+ h.displayName = "DialogHeader";
85
+ const b = i.forwardRef(({ className: a, ...o }, e) => /* @__PURE__ */ t(
86
86
  "div",
87
87
  {
88
- ref: o,
88
+ ref: e,
89
89
  className: s(
90
90
  "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
91
91
  a
92
92
  ),
93
93
  "data-slot": "dialog-footer",
94
- ...e
94
+ ...o
95
95
  }
96
96
  ));
97
- v.displayName = "DialogFooter";
98
- const w = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t(
97
+ b.displayName = "DialogFooter";
98
+ const v = i.forwardRef(({ className: a, dataHook: o, ...e }, r) => /* @__PURE__ */ t(
99
99
  l.Title,
100
100
  {
101
- ref: o,
101
+ ref: r,
102
102
  className: s("text-lg leading-none font-semibold", a),
103
+ "data-hook": o,
103
104
  "data-slot": "dialog-title",
104
105
  ...e
105
106
  }
106
107
  ));
107
- w.displayName = "DialogTitle";
108
- const h = i.forwardRef(({ className: a, ...e }, o) => /* @__PURE__ */ t(
108
+ v.displayName = "DialogTitle";
109
+ const w = i.forwardRef(({ className: a, dataHook: o, ...e }, r) => /* @__PURE__ */ t(
109
110
  l.Description,
110
111
  {
111
- ref: o,
112
+ ref: r,
112
113
  className: s("text-muted-foreground text-sm", a),
114
+ "data-hook": o,
113
115
  "data-slot": "dialog-description",
114
116
  ...e
115
117
  }
116
118
  ));
117
- h.displayName = "DialogDescription";
119
+ w.displayName = "DialogDescription";
118
120
  export {
119
121
  D as Dialog,
120
122
  y as DialogClose,
121
123
  N as DialogContent,
122
- h as DialogDescription,
123
- v as DialogFooter,
124
- b as DialogHeader,
125
- n as DialogOverlay,
126
- d as DialogPortal,
127
- w as DialogTitle,
124
+ w as DialogDescription,
125
+ b as DialogFooter,
126
+ h as DialogHeader,
127
+ g as DialogOverlay,
128
+ n as DialogPortal,
129
+ v as DialogTitle,
128
130
  x as DialogTrigger
129
131
  };