@brightlocal/ui-components 0.1.1 → 0.1.3

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 (244) hide show
  1. package/dist/accordion.cjs +1 -1
  2. package/dist/accordion.d.ts +74 -4
  3. package/dist/accordion.d.ts.map +1 -1
  4. package/dist/accordion.js +100 -105
  5. package/dist/alert-dialog.cjs +1 -1
  6. package/dist/alert-dialog.d.ts +30 -10
  7. package/dist/alert-dialog.d.ts.map +1 -1
  8. package/dist/alert-dialog.js +129 -132
  9. package/dist/alert.d.ts +22 -1
  10. package/dist/alert.d.ts.map +1 -1
  11. package/dist/aspect-ratio.cjs +1 -1
  12. package/dist/aspect-ratio.d.ts +11 -1
  13. package/dist/aspect-ratio.d.ts.map +1 -1
  14. package/dist/aspect-ratio.js +16 -20
  15. package/dist/avatar.cjs +1 -1
  16. package/dist/avatar.d.ts +43 -3
  17. package/dist/avatar.d.ts.map +1 -1
  18. package/dist/avatar.js +18 -16
  19. package/dist/badge.cjs +1 -1
  20. package/dist/badge.d.ts +24 -9
  21. package/dist/badge.d.ts.map +1 -1
  22. package/dist/badge.js +34 -32
  23. package/dist/blocks/data-table.cjs +1 -1
  24. package/dist/blocks/data-table.d.ts.map +1 -1
  25. package/dist/blocks/data-table.js +209 -202
  26. package/dist/blocks/sidebar.cjs +1 -1
  27. package/dist/blocks/sidebar.d.ts +1 -1
  28. package/dist/blocks/sidebar.d.ts.map +1 -1
  29. package/dist/blocks/sidebar.js +154 -154
  30. package/dist/breadcrumb.cjs +1 -1
  31. package/dist/breadcrumb.d.ts +63 -8
  32. package/dist/breadcrumb.d.ts.map +1 -1
  33. package/dist/breadcrumb.js +97 -93
  34. package/dist/button.cjs +1 -1
  35. package/dist/button.d.ts +17 -45
  36. package/dist/button.d.ts.map +1 -1
  37. package/dist/button.js +49 -50
  38. package/dist/calendar.cjs +1 -1
  39. package/dist/calendar.d.ts +12 -0
  40. package/dist/calendar.d.ts.map +1 -1
  41. package/dist/calendar.js +10 -8
  42. package/dist/card.cjs +1 -1
  43. package/dist/card.d.ts +58 -18
  44. package/dist/card.d.ts.map +1 -1
  45. package/dist/card.js +60 -51
  46. package/dist/carousel.cjs +1 -1
  47. package/dist/carousel.d.ts +99 -9
  48. package/dist/carousel.d.ts.map +1 -1
  49. package/dist/carousel.js +142 -128
  50. package/dist/centred-layout.cjs +1 -1
  51. package/dist/centred-layout.d.ts +18 -2
  52. package/dist/centred-layout.d.ts.map +1 -1
  53. package/dist/centred-layout.js +46 -33
  54. package/dist/chart.cjs +4 -4
  55. package/dist/chart.d.ts +70 -7
  56. package/dist/chart.d.ts.map +1 -1
  57. package/dist/chart.js +71 -66
  58. package/dist/checkbox.cjs +1 -1
  59. package/dist/checkbox.d.ts +9 -5
  60. package/dist/checkbox.d.ts.map +1 -1
  61. package/dist/checkbox.js +61 -82
  62. package/dist/collapsible.cjs +1 -1
  63. package/dist/collapsible.d.ts +65 -8
  64. package/dist/collapsible.d.ts.map +1 -1
  65. package/dist/collapsible.js +41 -55
  66. package/dist/combobox.cjs +1 -1
  67. package/dist/combobox.d.ts +29 -11
  68. package/dist/combobox.d.ts.map +1 -1
  69. package/dist/combobox.js +193 -159
  70. package/dist/command.cjs +1 -1
  71. package/dist/command.d.ts +115 -9
  72. package/dist/command.d.ts.map +1 -1
  73. package/dist/command.js +176 -152
  74. package/dist/context-menu.cjs +1 -1
  75. package/dist/context-menu.d.ts +188 -20
  76. package/dist/context-menu.d.ts.map +1 -1
  77. package/dist/context-menu.js +119 -121
  78. package/dist/date-picker.cjs +1 -1
  79. package/dist/date-picker.d.ts +75 -9
  80. package/dist/date-picker.d.ts.map +1 -1
  81. package/dist/date-picker.js +220 -81
  82. package/dist/description.cjs +1 -0
  83. package/dist/description.d.ts +37 -0
  84. package/dist/description.d.ts.map +1 -0
  85. package/dist/description.js +25 -0
  86. package/dist/dialog.cjs +1 -1
  87. package/dist/dialog.d.ts +73 -9
  88. package/dist/dialog.d.ts.map +1 -1
  89. package/dist/dialog.js +103 -112
  90. package/dist/drawer.cjs +1 -1
  91. package/dist/drawer.d.ts +92 -0
  92. package/dist/drawer.d.ts.map +1 -1
  93. package/dist/drawer.js +67 -52
  94. package/dist/dropdown-menu.cjs +1 -1
  95. package/dist/dropdown-menu.d.ts +95 -11
  96. package/dist/dropdown-menu.d.ts.map +1 -1
  97. package/dist/dropdown-menu.js +146 -106
  98. package/dist/field.cjs +1 -1
  99. package/dist/field.d.ts +23 -6
  100. package/dist/field.d.ts.map +1 -1
  101. package/dist/field.js +54 -53
  102. package/dist/global-layout.cjs +1 -1
  103. package/dist/global-layout.d.ts +27 -17
  104. package/dist/global-layout.d.ts.map +1 -1
  105. package/dist/global-layout.js +86 -79
  106. package/dist/hover-card.cjs +1 -1
  107. package/dist/hover-card.d.ts +36 -6
  108. package/dist/hover-card.d.ts.map +1 -1
  109. package/dist/hover-card.js +44 -42
  110. package/dist/index.cjs +1 -1
  111. package/dist/index.d.ts +1 -1
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +383 -387
  114. package/dist/input-group.cjs +1 -1
  115. package/dist/input-group.d.ts +21 -2
  116. package/dist/input-group.d.ts.map +1 -1
  117. package/dist/input-group.js +51 -41
  118. package/dist/input-password.cjs +1 -1
  119. package/dist/input-password.d.ts.map +1 -1
  120. package/dist/input-password.js +24 -25
  121. package/dist/input.cjs +1 -1
  122. package/dist/input.d.ts +38 -24
  123. package/dist/input.d.ts.map +1 -1
  124. package/dist/input.js +68 -136
  125. package/dist/label.cjs +1 -1
  126. package/dist/label.d.ts +20 -1
  127. package/dist/label.d.ts.map +1 -1
  128. package/dist/label.js +31 -18
  129. package/dist/logo.cjs +1 -1
  130. package/dist/logo.d.ts +3 -0
  131. package/dist/logo.d.ts.map +1 -1
  132. package/dist/logo.js +12 -10
  133. package/dist/menubar.cjs +1 -1
  134. package/dist/menubar.d.ts +40 -6
  135. package/dist/menubar.d.ts.map +1 -1
  136. package/dist/menubar.js +97 -76
  137. package/dist/popover.cjs +1 -1
  138. package/dist/popover.d.ts +59 -4
  139. package/dist/popover.d.ts.map +1 -1
  140. package/dist/popover.js +42 -34
  141. package/dist/progress.cjs +1 -1
  142. package/dist/progress.d.ts +9 -2
  143. package/dist/progress.d.ts.map +1 -1
  144. package/dist/progress.js +71 -59
  145. package/dist/radio-group.d.ts +40 -0
  146. package/dist/radio-group.d.ts.map +1 -1
  147. package/dist/rating.d.ts +4 -0
  148. package/dist/rating.d.ts.map +1 -1
  149. package/dist/resizable.cjs +1 -1
  150. package/dist/resizable.d.ts +65 -4
  151. package/dist/resizable.d.ts.map +1 -1
  152. package/dist/resizable.js +53 -36
  153. package/dist/scroll-area.cjs +1 -1
  154. package/dist/scroll-area.d.ts +46 -5
  155. package/dist/scroll-area.d.ts.map +1 -1
  156. package/dist/scroll-area.js +42 -38
  157. package/dist/select.cjs +1 -1
  158. package/dist/select.d.ts +30 -0
  159. package/dist/select.d.ts.map +1 -1
  160. package/dist/select.js +64 -54
  161. package/dist/separator.cjs +1 -1
  162. package/dist/separator.d.ts +49 -2
  163. package/dist/separator.d.ts.map +1 -1
  164. package/dist/separator.js +48 -36
  165. package/dist/sheet.cjs +1 -1
  166. package/dist/sheet.d.ts +80 -9
  167. package/dist/sheet.d.ts.map +1 -1
  168. package/dist/sheet.js +117 -113
  169. package/dist/skeleton.cjs +1 -1
  170. package/dist/skeleton.d.ts +24 -2
  171. package/dist/skeleton.d.ts.map +1 -1
  172. package/dist/skeleton.js +15 -9
  173. package/dist/slider.cjs +1 -1
  174. package/dist/slider.d.ts +18 -4
  175. package/dist/slider.d.ts.map +1 -1
  176. package/dist/slider.js +72 -66
  177. package/dist/sonner.cjs +1 -1
  178. package/dist/sonner.d.ts +4 -2
  179. package/dist/sonner.d.ts.map +1 -1
  180. package/dist/sonner.js +29 -28
  181. package/dist/split-layout.d.ts +4 -1
  182. package/dist/split-layout.d.ts.map +1 -1
  183. package/dist/table.cjs +1 -1
  184. package/dist/table.js +1 -1
  185. package/dist/toggle-group.cjs +1 -1
  186. package/dist/toggle-group.d.ts +3 -1
  187. package/dist/toggle-group.d.ts.map +1 -1
  188. package/dist/toggle-group.js +38 -36
  189. package/package.json +8 -2
  190. package/src/blocks/data-table.tsx +42 -32
  191. package/src/blocks/sidebar.tsx +4 -12
  192. package/src/components/accordion.tsx +163 -77
  193. package/src/components/alert-dialog.tsx +156 -111
  194. package/src/components/alert.tsx +26 -13
  195. package/src/components/aspect-ratio.tsx +25 -16
  196. package/src/components/avatar.tsx +56 -8
  197. package/src/components/badge.tsx +65 -42
  198. package/src/components/breadcrumb.tsx +158 -82
  199. package/src/components/button.tsx +41 -62
  200. package/src/components/calendar.tsx +16 -2
  201. package/src/components/card.tsx +92 -40
  202. package/src/components/carousel.tsx +240 -115
  203. package/src/components/centred-layout.tsx +67 -35
  204. package/src/components/chart.tsx +118 -47
  205. package/src/components/checkbox.tsx +42 -78
  206. package/src/components/collapsible.tsx +95 -26
  207. package/src/components/combobox.tsx +242 -144
  208. package/src/components/command.tsx +295 -121
  209. package/src/components/context-menu.tsx +278 -81
  210. package/src/components/date-picker.tsx +281 -30
  211. package/src/components/description.tsx +60 -0
  212. package/src/components/dialog.tsx +162 -86
  213. package/src/components/drawer.tsx +76 -2
  214. package/src/components/dropdown-menu.tsx +143 -37
  215. package/src/components/field.tsx +36 -11
  216. package/src/components/global-layout.tsx +116 -77
  217. package/src/components/hover-card.tsx +54 -14
  218. package/src/components/input-group.tsx +56 -18
  219. package/src/components/input-password.tsx +3 -4
  220. package/src/components/input.tsx +93 -186
  221. package/src/components/label.tsx +56 -15
  222. package/src/components/logo.tsx +3 -0
  223. package/src/components/menubar.tsx +58 -4
  224. package/src/components/popover.tsx +103 -20
  225. package/src/components/progress.tsx +82 -60
  226. package/src/components/radio-group.tsx +40 -0
  227. package/src/components/rating.tsx +4 -1
  228. package/src/components/resizable.tsx +119 -31
  229. package/src/components/scroll-area.tsx +123 -56
  230. package/src/components/select.tsx +21 -1
  231. package/src/components/separator.tsx +97 -20
  232. package/src/components/sheet.tsx +180 -79
  233. package/src/components/skeleton.tsx +40 -10
  234. package/src/components/slider.tsx +83 -57
  235. package/src/components/sonner.tsx +10 -7
  236. package/src/components/split-layout.tsx +4 -1
  237. package/src/components/table.tsx +1 -1
  238. package/src/components/toggle-group.tsx +4 -0
  239. package/src/index.ts +1 -1
  240. package/dist/input-base.cjs +0 -1
  241. package/dist/input-base.d.ts +0 -28
  242. package/dist/input-base.d.ts.map +0 -1
  243. package/dist/input-base.js +0 -56
  244. package/src/components/input-base.tsx +0 -86
package/dist/carousel.js CHANGED
@@ -1,185 +1,199 @@
1
- import { jsx as a, jsxs as p } from "react/jsx-runtime";
2
- import * as l from "react";
3
- import D from "embla-carousel-react";
4
- import { ArrowLeft as I, ArrowRight as R } from "lucide-react";
5
- import { cn as i } from "@brightlocal/ui-components/lib/utils";
6
- import { Button as v, ButtonVariant as N, ButtonSize as w } from "@brightlocal/ui-components/button";
7
- const S = l.createContext(null);
8
- function m() {
9
- const e = l.useContext(S);
1
+ import { jsx as s, jsxs as p } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import E from "embla-carousel-react";
4
+ import { ArrowLeft as I, ArrowRight as K } from "@brightlocal/icons";
5
+ import { cn as f } from "@brightlocal/ui-components/lib/utils";
6
+ import { Button as N } from "@brightlocal/ui-components/button";
7
+ const v = o.createContext(null);
8
+ function C() {
9
+ const e = o.useContext(v);
10
10
  if (!e)
11
11
  throw new Error("useCarousel must be used within a <Carousel />");
12
12
  return e;
13
13
  }
14
- function j({
15
- orientation: e = "horizontal",
16
- opts: r,
17
- setApi: t,
18
- plugins: s,
19
- className: u,
20
- children: f,
21
- ...d
22
- }) {
23
- const [x, o] = D(
24
- {
25
- ...r,
26
- axis: e === "horizontal" ? "x" : "y"
27
- },
28
- s
29
- ), [b, y] = l.useState(!1), [z, P] = l.useState(!1), c = l.useCallback((n) => {
30
- n && (y(n.canScrollPrev()), P(n.canScrollNext()));
31
- }, []), h = l.useCallback(() => {
32
- o?.scrollPrev();
33
- }, [o]), C = l.useCallback(() => {
34
- o?.scrollNext();
35
- }, [o]), k = l.useCallback(
36
- (n) => {
37
- const g = e === "horizontal" ? "ArrowLeft" : "ArrowUp", E = e === "horizontal" ? "ArrowRight" : "ArrowDown";
38
- n.key === g ? (n.preventDefault(), h()) : n.key === E && (n.preventDefault(), C());
39
- },
40
- [e, h, C]
41
- );
42
- return l.useEffect(() => {
43
- !o || !t || t(o);
44
- }, [o, t]), l.useEffect(() => {
45
- if (o)
46
- return c(o), o.on("reInit", c), o.on("select", c), () => {
47
- o?.off("reInit", c), o?.off("select", c);
48
- };
49
- }, [o, c]), /* @__PURE__ */ a(
50
- S.Provider,
51
- {
52
- value: {
53
- carouselRef: x,
54
- api: o,
55
- opts: r,
56
- orientation: e || (r?.axis === "y" ? "vertical" : "horizontal"),
57
- scrollPrev: h,
58
- scrollNext: C,
59
- canScrollPrev: b,
60
- canScrollNext: z
14
+ const j = o.forwardRef(
15
+ ({
16
+ orientation: e = "horizontal",
17
+ opts: l,
18
+ setApi: t,
19
+ plugins: a,
20
+ className: i,
21
+ children: n,
22
+ dataHook: d,
23
+ trackingEl: m,
24
+ trackingLabel: w,
25
+ ...y
26
+ }, b) => {
27
+ const [k, r] = E(
28
+ {
29
+ ...l,
30
+ axis: e === "horizontal" ? "x" : "y"
61
31
  },
62
- children: /* @__PURE__ */ a(
63
- "div",
64
- {
65
- "aria-roledescription": "carousel",
66
- className: i("relative", u),
67
- "data-slot": "carousel",
68
- role: "region",
69
- onKeyDownCapture: k,
70
- ...d,
71
- children: f
72
- }
73
- )
74
- }
75
- );
76
- }
77
- function M({ className: e, ...r }) {
78
- const { carouselRef: t, orientation: s } = m();
79
- return /* @__PURE__ */ a(
32
+ a
33
+ ), [P, S] = o.useState(!1), [g, z] = o.useState(!1), u = o.useCallback((c) => {
34
+ c && (S(c.canScrollPrev()), z(c.canScrollNext()));
35
+ }, []), x = o.useCallback(() => {
36
+ r?.scrollPrev();
37
+ }, [r]), h = o.useCallback(() => {
38
+ r?.scrollNext();
39
+ }, [r]), R = o.useCallback(
40
+ (c) => {
41
+ const D = e === "horizontal" ? "ArrowLeft" : "ArrowUp", A = e === "horizontal" ? "ArrowRight" : "ArrowDown";
42
+ c.key === D ? (c.preventDefault(), x()) : c.key === A && (c.preventDefault(), h());
43
+ },
44
+ [e, x, h]
45
+ );
46
+ return o.useEffect(() => {
47
+ !r || !t || t(r);
48
+ }, [r, t]), o.useEffect(() => {
49
+ if (r)
50
+ return u(r), r.on("reInit", u), r.on("select", u), () => {
51
+ r?.off("reInit", u), r?.off("select", u);
52
+ };
53
+ }, [r, u]), /* @__PURE__ */ s(
54
+ v.Provider,
55
+ {
56
+ value: {
57
+ carouselRef: k,
58
+ api: r,
59
+ opts: l,
60
+ orientation: e || (l?.axis === "y" ? "vertical" : "horizontal"),
61
+ scrollPrev: x,
62
+ scrollNext: h,
63
+ canScrollPrev: P,
64
+ canScrollNext: g
65
+ },
66
+ children: /* @__PURE__ */ s(
67
+ "div",
68
+ {
69
+ ref: b,
70
+ "aria-roledescription": "carousel",
71
+ className: f("relative", i),
72
+ "data-hook": d,
73
+ "data-slot": "carousel",
74
+ "data-tracking-el": m,
75
+ "data-tracking-label": w,
76
+ role: "region",
77
+ onKeyDownCapture: R,
78
+ ...y,
79
+ children: n
80
+ }
81
+ )
82
+ }
83
+ );
84
+ }
85
+ );
86
+ j.displayName = "Carousel";
87
+ const L = o.forwardRef(({ className: e, ...l }, t) => {
88
+ const { carouselRef: a, orientation: i } = C(), n = i === "vertical";
89
+ return /* @__PURE__ */ s(
80
90
  "div",
81
91
  {
82
- ref: t,
83
- className: i(
84
- "overflow-hidden",
85
- s === "vertical" && "h-[400px]"
86
- ),
92
+ ref: a,
93
+ className: f("overflow-hidden", n && "w-full", e),
87
94
  "data-slot": "carousel-content",
88
- children: /* @__PURE__ */ a(
95
+ children: /* @__PURE__ */ s(
89
96
  "div",
90
97
  {
91
- className: i(
92
- "flex gap-4",
93
- s === "horizontal" ? "" : "h-full flex-col",
94
- e
98
+ ref: t,
99
+ className: f(
100
+ "flex",
101
+ n ? "-mt-4 h-full w-full flex-col" : "-ml-4"
95
102
  ),
96
- ...r
103
+ ...l
97
104
  }
98
105
  )
99
106
  }
100
107
  );
101
- }
102
- function O({ className: e, ...r }) {
103
- const { orientation: t } = m();
104
- return /* @__PURE__ */ a(
108
+ });
109
+ L.displayName = "CarouselContent";
110
+ const O = o.forwardRef(({ className: e, ...l }, t) => {
111
+ const { orientation: a } = C();
112
+ return /* @__PURE__ */ s(
105
113
  "div",
106
114
  {
115
+ ref: t,
107
116
  "aria-roledescription": "slide",
108
- className: i(
117
+ className: f(
109
118
  "min-w-0 shrink-0 grow-0 basis-full",
110
- t === "horizontal" ? "pl-1" : "pt-1",
119
+ a === "horizontal" ? "pl-4" : "w-full pt-4",
111
120
  e
112
121
  ),
113
122
  "data-slot": "carousel-item",
114
123
  role: "group",
115
- ...r
124
+ ...l
116
125
  }
117
126
  );
118
- }
119
- function T({
127
+ });
128
+ O.displayName = "CarouselItem";
129
+ function B({
120
130
  className: e,
121
- variant: r = N.OUTLINE,
122
- size: t = w.SM,
123
- dataHook: s = "carousel-previous",
124
- ...u
131
+ variant: l = "outline",
132
+ size: t = "default",
133
+ dataHook: a = "carousel-previous",
134
+ ...i
125
135
  }) {
126
- const { orientation: f, scrollPrev: d, canScrollPrev: x } = m();
136
+ const { orientation: n, scrollPrev: d, canScrollPrev: m } = C();
127
137
  return /* @__PURE__ */ p(
128
- v,
138
+ N,
129
139
  {
130
- className: i(
131
- "absolute size-8 rounded-full",
132
- f === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
140
+ iconOnly: !0,
141
+ className: f(
142
+ "absolute",
143
+ n === "horizontal" ? "top-1/2 -left-12 -translate-y-1/2" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
133
144
  e
134
145
  ),
135
146
  "data-slot": "carousel-previous",
136
- dataHook: s,
137
- disabled: !x,
147
+ dataHook: a,
148
+ disabled: !m,
138
149
  size: t,
139
- variant: r,
150
+ variant: l,
140
151
  onClick: d,
141
- ...u,
152
+ ...i,
142
153
  children: [
143
- /* @__PURE__ */ a(I, {}),
144
- /* @__PURE__ */ a("span", { className: "sr-only", children: "Previous slide" })
154
+ /* @__PURE__ */ s(I, {}),
155
+ /* @__PURE__ */ s("span", { className: "sr-only", children: "Previous slide" })
145
156
  ]
146
157
  }
147
158
  );
148
159
  }
149
- function V({
160
+ B.displayName = "CarouselPrevious";
161
+ function U({
150
162
  className: e,
151
- variant: r = N.OUTLINE,
152
- size: t = w.SM,
153
- dataHook: s = "carousel-next",
154
- ...u
163
+ variant: l = "outline",
164
+ size: t = "default",
165
+ dataHook: a = "carousel-next",
166
+ ...i
155
167
  }) {
156
- const { orientation: f, scrollNext: d, canScrollNext: x } = m();
168
+ const { orientation: n, scrollNext: d, canScrollNext: m } = C();
157
169
  return /* @__PURE__ */ p(
158
- v,
170
+ N,
159
171
  {
160
- className: i(
161
- "absolute size-8 rounded-full",
162
- f === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
172
+ iconOnly: !0,
173
+ className: f(
174
+ "absolute",
175
+ n === "horizontal" ? "top-1/2 -right-12 -translate-y-1/2" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
163
176
  e
164
177
  ),
165
178
  "data-slot": "carousel-next",
166
- dataHook: s,
167
- disabled: !x,
179
+ dataHook: a,
180
+ disabled: !m,
168
181
  size: t,
169
- variant: r,
182
+ variant: l,
170
183
  onClick: d,
171
- ...u,
184
+ ...i,
172
185
  children: [
173
- /* @__PURE__ */ a(R, {}),
174
- /* @__PURE__ */ a("span", { className: "sr-only", children: "Next slide" })
186
+ /* @__PURE__ */ s(K, {}),
187
+ /* @__PURE__ */ s("span", { className: "sr-only", children: "Next slide" })
175
188
  ]
176
189
  }
177
190
  );
178
191
  }
192
+ U.displayName = "CarouselNext";
179
193
  export {
180
194
  j as Carousel,
181
- M as CarouselContent,
195
+ L as CarouselContent,
182
196
  O as CarouselItem,
183
- V as CarouselNext,
184
- T as CarouselPrevious
197
+ U as CarouselNext,
198
+ B as CarouselPrevious
185
199
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),x=require("@brightlocal/ui-components/lib/utils");var l=(e=>(e.XL="xl",e.LG="lg",e.MD="md",e.SM="sm",e))(l||{});function a({className:e,breakpoint:s="xl",maxWidth:t,children:n,...r}){const c={xl:"max-w-7xl",lg:"max-w-5xl",md:"max-w-3xl",sm:"max-w-2xl"},o=t!==void 0?{maxWidth:typeof t=="number"?`${t}px`:t}:void 0;return u.jsx("div",{className:x.cn("bg-background flex min-h-screen items-center justify-center p-6",!t&&c[s],e),"data-slot":"centred-layout",style:o,...r,children:n})}exports.CentredLayout=a;exports.CentredLayoutBreakpoint=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),x=require("react"),b=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const y=g(x);var n=(e=>(e.XL="xl",e.LG="lg",e.MD="md",e.SM="sm",e))(n||{});const l=y.forwardRef(({className:e,breakpoint:r="xl",maxWidth:t,children:a,dataHook:c,trackingEl:o,trackingLabel:s,...u},i)=>{const d={xl:"max-w-7xl",lg:"max-w-5xl",md:"max-w-3xl",sm:"max-w-2xl"},m=t!==void 0?{maxWidth:typeof t=="number"?`${t}px`:t}:void 0;return f.jsx("div",{ref:i,className:b.cn("bg-background flex min-h-screen items-center justify-center p-6",!t&&d[r],e),"data-hook":c,"data-slot":"centred-layout","data-tracking-el":o,"data-tracking-label":s,style:m,...u,children:a})});l.displayName="CentredLayout";exports.CentredLayout=l;exports.CentredLayoutBreakpoint=n;
@@ -35,7 +35,20 @@ export declare enum CentredLayoutBreakpoint {
35
35
  }
36
36
  interface CentredLayoutProps extends React.ComponentProps<"div"> {
37
37
  /**
38
- * Breakpoint size variant (default: xl)
38
+ * Data hook for automated testing (required)
39
+ */
40
+ dataHook: string;
41
+ /**
42
+ * Tracking element identifier for analytics
43
+ */
44
+ trackingEl?: string;
45
+ /**
46
+ * Tracking label for analytics context
47
+ */
48
+ trackingLabel?: string;
49
+ /**
50
+ * Breakpoint size variant
51
+ * @default "xl"
39
52
  */
40
53
  breakpoint?: CentredLayoutBreakpoint;
41
54
  /**
@@ -43,7 +56,10 @@ interface CentredLayoutProps extends React.ComponentProps<"div"> {
43
56
  */
44
57
  maxWidth?: string | number;
45
58
  }
46
- declare function CentredLayout({ className, breakpoint, maxWidth, children, ...props }: CentredLayoutProps): import("react/jsx-runtime").JSX.Element;
59
+ /**
60
+ * CentredLayout component for centering content with responsive max-width constraints.
61
+ */
62
+ declare const CentredLayout: React.ForwardRefExoticComponent<Omit<CentredLayoutProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
47
63
  export { CentredLayout };
48
64
  export type { CentredLayoutProps };
49
65
  //# sourceMappingURL=centred-layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"centred-layout.d.ts","sourceRoot":"","sources":["../../src/components/centred-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,oBAAY,uBAAuB;IACjC;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;CACV;AAED,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC9D;;OAEG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,UAAuC,EACvC,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,kBAAkB,2CA6BpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"centred-layout.d.ts","sourceRoot":"","sources":["../../src/components/centred-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,oBAAY,uBAAuB;IACjC;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;IACT;;OAEG;IACH,EAAE,OAAO;CACV;AAED,UAAU,kBAAmB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC9D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,QAAA,MAAM,aAAa,wGAiDlB,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,35 +1,48 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { cn as n } from "@brightlocal/ui-components/lib/utils";
3
- var o = /* @__PURE__ */ ((l) => (l.XL = "xl", l.LG = "lg", l.MD = "md", l.SM = "sm", l))(o || {});
4
- function i({
5
- className: l,
6
- breakpoint: s = "xl",
7
- maxWidth: m,
8
- children: x,
9
- ...e
10
- }) {
11
- const r = {
12
- xl: "max-w-7xl",
13
- lg: "max-w-5xl",
14
- md: "max-w-3xl",
15
- sm: "max-w-2xl"
16
- }, t = m !== void 0 ? { maxWidth: typeof m == "number" ? `${m}px` : m } : void 0;
17
- return /* @__PURE__ */ c(
18
- "div",
19
- {
20
- className: n(
21
- "bg-background flex min-h-screen items-center justify-center p-6",
22
- !m && r[s],
23
- l
24
- ),
25
- "data-slot": "centred-layout",
26
- style: t,
27
- ...e,
28
- children: x
29
- }
30
- );
31
- }
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { cn as f } from "@brightlocal/ui-components/lib/utils";
4
+ var g = /* @__PURE__ */ ((a) => (a.XL = "xl", a.LG = "lg", a.MD = "md", a.SM = "sm", a))(g || {});
5
+ const p = i.forwardRef(
6
+ ({
7
+ className: a,
8
+ breakpoint: l = "xl",
9
+ maxWidth: t,
10
+ children: e,
11
+ dataHook: r,
12
+ trackingEl: m,
13
+ trackingLabel: s,
14
+ ...o
15
+ }, x) => {
16
+ const c = {
17
+ xl: "max-w-7xl",
18
+ lg: "max-w-5xl",
19
+ md: "max-w-3xl",
20
+ sm: "max-w-2xl"
21
+ }, n = t !== void 0 ? {
22
+ maxWidth: typeof t == "number" ? `${t}px` : t
23
+ } : void 0;
24
+ return /* @__PURE__ */ d(
25
+ "div",
26
+ {
27
+ ref: x,
28
+ className: f(
29
+ "bg-background flex min-h-screen items-center justify-center p-6",
30
+ !t && c[l],
31
+ a
32
+ ),
33
+ "data-hook": r,
34
+ "data-slot": "centred-layout",
35
+ "data-tracking-el": m,
36
+ "data-tracking-label": s,
37
+ style: n,
38
+ ...o,
39
+ children: e
40
+ }
41
+ );
42
+ }
43
+ );
44
+ p.displayName = "CentredLayout";
32
45
  export {
33
- i as CentredLayout,
34
- o as CentredLayoutBreakpoint
46
+ p as CentredLayout,
47
+ g as CentredLayoutBreakpoint
35
48
  };
package/dist/chart.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),T=require("react"),e=require("recharts"),g=require("@brightlocal/ui-components/lib/utils");function O(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,n.get?n:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const j=O(T),y=O(e),_=j.createContext(null);function k(){const r=j.useContext(_);if(!r)throw new Error("useChart must be used within a <ChartContainer />");return r}function L({id:r,className:o,children:s,config:n,dataHook:l,trackingEl:i,trackingLabel:c,...u}){const d=j.useId(),f=`chart-${r||d.replace(/:/g,"")}`;return t.jsx(_.Provider,{value:{config:n},children:t.jsxs("div",{className:g.cn("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",o),"data-chart":f,"data-hook":l,"data-slot":"chart-container","data-tracking-el":i,"data-tracking-label":c,...u,children:[t.jsx(R,{config:n,id:f}),t.jsx(y.ResponsiveContainer,{children:s})]})})}L.displayName="ChartContainer";function R({id:r,config:o}){const s=Object.entries(o).filter(([,n])=>n.theme||n.color);return s.length?t.jsx("style",{dangerouslySetInnerHTML:{__html:s.map(([n,l])=>{const i=typeof l.color=="string"?l.color.replace(/^hsl\((.*)\)$/,"$1"):null;return i?`
2
- [data-chart=${r}] {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),B=require("react"),e=require("recharts"),g=require("@brightlocal/ui-components/lib/utils");function _(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(o,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return o.default=t,Object.freeze(o)}const f=_(B),v=_(e),k=f.createContext(null);function L(){const t=f.useContext(k);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}const R=f.forwardRef(({id:t,className:o,children:s,config:n,dataHook:l,trackingEl:i,trackingLabel:c,...u},d)=>{const b=f.useId(),p=`chart-${t||b.replace(/:/g,"")}`;return r.jsx(k.Provider,{value:{config:n},children:r.jsxs("div",{ref:d,className:g.cn("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-pie-sector]:stroke-background flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",o),"data-chart":p,"data-hook":l,"data-slot":"chart-container","data-tracking-el":i,"data-tracking-label":c,...u,children:[r.jsx(N,{config:n,id:p}),r.jsx(v.ResponsiveContainer,{children:s})]})})});R.displayName="ChartContainer";function N({id:t,config:o}){const s=Object.entries(o).filter(([,n])=>n.theme||n.color);return s.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:s.map(([n,l])=>{const i=typeof l.color=="string"?l.color.replace(/^hsl\((.*)\)$/,"$1"):null;return i?`
2
+ [data-chart=${t}] {
3
3
  --color-${n}: ${i};
4
4
  }
5
5
  `:l.theme?Object.entries(l.theme).map(([c,u])=>`
6
- .${c} [data-chart=${r}] {
6
+ .${c} [data-chart=${t}] {
7
7
  --color-${n}: ${u.replace(/^hsl\((.*)\)$/,"$1")};
8
8
  }
9
9
  `).join(""):""}).join(`
10
- `)}}):null}function S({...r}){return t.jsx(y.Tooltip,{...r})}function N({active:r,payload:o,className:s,indicator:n="dot",hideLabel:l=!1,hideIndicator:i=!1,label:c,labelFormatter:u,labelClassName:d,formatter:f,color:w,nameKey:A,labelKey:C}){const{config:b}=k(),v=j.useMemo(()=>{if(l||!o?.length)return null;const[a]=o;if(!a)return null;const x=`${C||a.dataKey||a.name||"value"}`,m=b[x],h=!C&&typeof c=="string"?b[c]?.label||c:m?.label;return u?t.jsx("div",{className:g.cn("font-medium",d),children:u(h,o)}):h?t.jsx("div",{className:g.cn("font-medium",d),children:h}):null},[c,u,o,l,d,b,C]);if(!r||!o?.length)return null;const p=o.length===1&&n!=="dot";return t.jsxs("div",{className:g.cn("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",s),"data-slot":"chart-tooltip-content",children:[p?null:v,t.jsx("div",{className:"grid gap-1.5",children:o.map((a,x)=>{const m=`${A||a.name||a.dataKey||"value"}`,h=b[m],P=w||a.color||a.payload.fill||`var(--color-${m})`;return t.jsx("div",{className:g.cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",n==="dot"&&"items-center"),children:f&&a?.value!==void 0&&a.name?f(a.value,a.name,a,x,o):t.jsxs(t.Fragment,{children:[h?.icon&&!i?t.jsx(h.icon,{}):!i&&t.jsx("div",{className:g.cn("shrink-0 rounded-[2px]",{"h-2.5 w-2.5":n==="dot","w-1":n==="line","w-0 border-[1.5px] border-dashed bg-transparent":n==="dashed","my-0.5":p&&n==="dashed"}),style:{backgroundColor:n==="dashed"?"transparent":P,borderColor:P}}),t.jsxs("div",{className:g.cn("flex flex-1 justify-between leading-none",p?"items-end":"items-center"),children:[t.jsxs("div",{className:"grid gap-1.5",children:[p?v:null,t.jsx("span",{className:"text-muted-foreground",children:h?.label||a.name})]}),a.value&&t.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:typeof a.value=="number"?a.value.toLocaleString():a.value})]})]})},a.dataKey)})})]})}N.displayName="ChartTooltipContent";function B({...r}){return t.jsx(y.Legend,{...r})}function $({className:r,hideIcon:o=!1,payload:s,verticalAlign:n="bottom",nameKey:l}){const{config:i}=k();return s?.length?t.jsx("div",{className:g.cn("flex items-center justify-center gap-4",n==="top"?"pb-4":"pt-4",r),"data-slot":"chart-legend-content",children:s.map(c=>{const u=`${l||c.dataKey||"value"}`,d=i[u];return t.jsxs("div",{className:g.cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),children:[d?.icon&&!o?t.jsx(d.icon,{}):t.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),d?.label||c.value]},c.value)})}):null}$.displayName="ChartLegendContent";Object.defineProperty(exports,"Area",{enumerable:!0,get:()=>e.Area});Object.defineProperty(exports,"AreaChart",{enumerable:!0,get:()=>e.AreaChart});Object.defineProperty(exports,"Bar",{enumerable:!0,get:()=>e.Bar});Object.defineProperty(exports,"BarChart",{enumerable:!0,get:()=>e.BarChart});Object.defineProperty(exports,"CartesianGrid",{enumerable:!0,get:()=>e.CartesianGrid});Object.defineProperty(exports,"Cell",{enumerable:!0,get:()=>e.Cell});Object.defineProperty(exports,"ChartLabel",{enumerable:!0,get:()=>e.Label});Object.defineProperty(exports,"ChartsLegend",{enumerable:!0,get:()=>e.Legend});Object.defineProperty(exports,"ChartsTooltip",{enumerable:!0,get:()=>e.Tooltip});Object.defineProperty(exports,"Customized",{enumerable:!0,get:()=>e.Customized});Object.defineProperty(exports,"LabelList",{enumerable:!0,get:()=>e.LabelList});Object.defineProperty(exports,"Line",{enumerable:!0,get:()=>e.Line});Object.defineProperty(exports,"LineChart",{enumerable:!0,get:()=>e.LineChart});Object.defineProperty(exports,"Pie",{enumerable:!0,get:()=>e.Pie});Object.defineProperty(exports,"PieChart",{enumerable:!0,get:()=>e.PieChart});Object.defineProperty(exports,"PolarAngleAxis",{enumerable:!0,get:()=>e.PolarAngleAxis});Object.defineProperty(exports,"PolarGrid",{enumerable:!0,get:()=>e.PolarGrid});Object.defineProperty(exports,"PolarRadiusAxis",{enumerable:!0,get:()=>e.PolarRadiusAxis});Object.defineProperty(exports,"Radar",{enumerable:!0,get:()=>e.Radar});Object.defineProperty(exports,"RadarChart",{enumerable:!0,get:()=>e.RadarChart});Object.defineProperty(exports,"RadialBar",{enumerable:!0,get:()=>e.RadialBar});Object.defineProperty(exports,"RadialBarChart",{enumerable:!0,get:()=>e.RadialBarChart});Object.defineProperty(exports,"Rectangle",{enumerable:!0,get:()=>e.Rectangle});Object.defineProperty(exports,"ReferenceLine",{enumerable:!0,get:()=>e.ReferenceLine});Object.defineProperty(exports,"ResponsiveContainer",{enumerable:!0,get:()=>e.ResponsiveContainer});Object.defineProperty(exports,"Sector",{enumerable:!0,get:()=>e.Sector});Object.defineProperty(exports,"XAxis",{enumerable:!0,get:()=>e.XAxis});Object.defineProperty(exports,"YAxis",{enumerable:!0,get:()=>e.YAxis});exports.ChartContainer=L;exports.ChartLegend=B;exports.ChartLegendContent=$;exports.ChartStyle=R;exports.ChartTooltip=S;exports.ChartTooltipContent=N;
10
+ `)}}):null}function w({...t}){return r.jsx(v.Tooltip,{...t})}w.displayName="ChartTooltip";function $({active:t,payload:o,className:s,indicator:n="dot",hideLabel:l=!1,hideIndicator:i=!1,label:c,labelFormatter:u,labelClassName:d,formatter:b,color:p,nameKey:S,labelKey:x}){const{config:m}=L(),P=f.useMemo(()=>{if(l||!o?.length)return null;const[a]=o;if(!a)return null;const y=`${x||a.dataKey||a.name||"value"}`,C=m[y],h=!x&&typeof c=="string"?m[c]?.label||c:C?.label;return u?r.jsx("div",{className:g.cn("font-medium",d),children:u(h,o)}):h?r.jsx("div",{className:g.cn("font-medium",d),children:h}):null},[c,u,o,l,d,m,x]);if(!t||!o?.length)return null;const j=o.length===1&&n!=="dot";return r.jsxs("div",{className:g.cn("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",s),"data-slot":"chart-tooltip-content",children:[j?null:P,r.jsx("div",{className:"grid gap-1.5",children:o.map((a,y)=>{const C=`${S||a.name||a.dataKey||"value"}`,h=m[C],O=p||a.color||a.payload.fill||`var(--color-${C})`;return r.jsx("div",{className:g.cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",n==="dot"&&"items-center"),children:b&&a?.value!==void 0&&a.name?b(a.value,a.name,a,y,o):r.jsxs(r.Fragment,{children:[h?.icon&&!i?r.jsx(h.icon,{}):!i&&r.jsx("div",{className:g.cn("shrink-0 rounded-[2px]",{"h-2.5 w-2.5":n==="dot","w-1":n==="line","w-0 border-[1.5px] border-dashed bg-transparent":n==="dashed","my-0.5":j&&n==="dashed"}),style:{backgroundColor:n==="dashed"?"transparent":O,borderColor:O}}),r.jsxs("div",{className:g.cn("flex flex-1 justify-between leading-none",j?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[j?P:null,r.jsx("span",{className:"text-muted-foreground",children:h?.label||a.name})]}),a.value&&r.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:typeof a.value=="number"?a.value.toLocaleString():a.value})]})]})},a.dataKey)})})]})}$.displayName="ChartTooltipContent";function A({...t}){return r.jsx(v.Legend,{...t})}A.displayName="ChartLegend";function T({className:t,hideIcon:o=!1,payload:s,verticalAlign:n="bottom",nameKey:l}){const{config:i}=L();return s?.length?r.jsx("div",{className:g.cn("flex items-center justify-center gap-4",n==="top"?"pb-4":"pt-4",t),"data-slot":"chart-legend-content",children:s.map(c=>{const u=`${l||c.dataKey||"value"}`,d=i[u];return r.jsxs("div",{className:g.cn("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),children:[d?.icon&&!o?r.jsx(d.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:c.color}}),d?.label||c.value]},c.value)})}):null}T.displayName="ChartLegendContent";Object.defineProperty(exports,"Area",{enumerable:!0,get:()=>e.Area});Object.defineProperty(exports,"AreaChart",{enumerable:!0,get:()=>e.AreaChart});Object.defineProperty(exports,"Bar",{enumerable:!0,get:()=>e.Bar});Object.defineProperty(exports,"BarChart",{enumerable:!0,get:()=>e.BarChart});Object.defineProperty(exports,"CartesianGrid",{enumerable:!0,get:()=>e.CartesianGrid});Object.defineProperty(exports,"Cell",{enumerable:!0,get:()=>e.Cell});Object.defineProperty(exports,"ChartLabel",{enumerable:!0,get:()=>e.Label});Object.defineProperty(exports,"ChartsLegend",{enumerable:!0,get:()=>e.Legend});Object.defineProperty(exports,"ChartsTooltip",{enumerable:!0,get:()=>e.Tooltip});Object.defineProperty(exports,"Customized",{enumerable:!0,get:()=>e.Customized});Object.defineProperty(exports,"LabelList",{enumerable:!0,get:()=>e.LabelList});Object.defineProperty(exports,"Line",{enumerable:!0,get:()=>e.Line});Object.defineProperty(exports,"LineChart",{enumerable:!0,get:()=>e.LineChart});Object.defineProperty(exports,"Pie",{enumerable:!0,get:()=>e.Pie});Object.defineProperty(exports,"PieChart",{enumerable:!0,get:()=>e.PieChart});Object.defineProperty(exports,"PolarAngleAxis",{enumerable:!0,get:()=>e.PolarAngleAxis});Object.defineProperty(exports,"PolarGrid",{enumerable:!0,get:()=>e.PolarGrid});Object.defineProperty(exports,"PolarRadiusAxis",{enumerable:!0,get:()=>e.PolarRadiusAxis});Object.defineProperty(exports,"Radar",{enumerable:!0,get:()=>e.Radar});Object.defineProperty(exports,"RadarChart",{enumerable:!0,get:()=>e.RadarChart});Object.defineProperty(exports,"RadialBar",{enumerable:!0,get:()=>e.RadialBar});Object.defineProperty(exports,"RadialBarChart",{enumerable:!0,get:()=>e.RadialBarChart});Object.defineProperty(exports,"Rectangle",{enumerable:!0,get:()=>e.Rectangle});Object.defineProperty(exports,"ReferenceLine",{enumerable:!0,get:()=>e.ReferenceLine});Object.defineProperty(exports,"ResponsiveContainer",{enumerable:!0,get:()=>e.ResponsiveContainer});Object.defineProperty(exports,"Sector",{enumerable:!0,get:()=>e.Sector});Object.defineProperty(exports,"XAxis",{enumerable:!0,get:()=>e.XAxis});Object.defineProperty(exports,"YAxis",{enumerable:!0,get:()=>e.YAxis});exports.ChartContainer=R;exports.ChartLegend=A;exports.ChartLegendContent=T;exports.ChartStyle=N;exports.ChartTooltip=w;exports.ChartTooltipContent=$;
package/dist/chart.d.ts CHANGED
@@ -15,34 +15,76 @@ export interface ChartConfig {
15
15
  type ChartContextProps = {
16
16
  config: ChartConfig;
17
17
  };
18
+ /**
19
+ * Props for the ChartContainer component.
20
+ */
18
21
  interface ChartContainerProps extends React.ComponentProps<"div">, ChartContextProps {
22
+ /**
23
+ * Chart content (typically a Recharts chart component)
24
+ */
19
25
  children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
26
+ /**
27
+ * Configuration object for chart colors and labels
28
+ */
20
29
  config: ChartConfig;
30
+ /**
31
+ * Data hook for automated testing (required)
32
+ */
21
33
  dataHook: string;
34
+ /**
35
+ * Tracking element identifier for analytics
36
+ */
22
37
  trackingEl?: string;
38
+ /**
39
+ * Tracking label for analytics context
40
+ */
23
41
  trackingLabel?: string;
24
42
  }
25
- declare function ChartContainer({ id, className, children, config, dataHook, trackingEl, trackingLabel, ...props }: ChartContainerProps): import("react/jsx-runtime").JSX.Element;
26
- declare namespace ChartContainer {
27
- var displayName: string;
28
- }
43
+ /**
44
+ * ChartContainer wraps Recharts charts with theme-aware styling,
45
+ * responsive container, and configuration context.
46
+ */
47
+ declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
29
48
  declare function ChartStyle({ id, config }: {
30
49
  id: string;
31
50
  config: ChartConfig;
32
51
  }): import("react/jsx-runtime").JSX.Element | null;
52
+ /**
53
+ * Props for the ChartTooltip component.
54
+ */
33
55
  interface ChartTooltipProps extends React.ComponentProps<typeof RechartsPrimitive.Tooltip> {
56
+ /** Hide the tooltip label */
34
57
  hideLabel?: boolean;
58
+ /** Hide the color indicator */
35
59
  hideIndicator?: boolean;
60
+ /** Style of the color indicator */
36
61
  indicator?: "line" | "dot" | "dashed";
62
+ /** Key to use for the series name */
37
63
  nameKey?: string;
64
+ /** Key to use for the label */
38
65
  labelKey?: string;
39
66
  }
67
+ /**
68
+ * ChartTooltip displays data values on hover.
69
+ */
40
70
  declare function ChartTooltip({ ...props }: ChartTooltipProps): import("react/jsx-runtime").JSX.Element;
71
+ declare namespace ChartTooltip {
72
+ var displayName: string;
73
+ }
74
+ /**
75
+ * Props for the ChartTooltipContent component.
76
+ */
41
77
  interface ChartTooltipContentProps extends React.ComponentProps<"div">, Pick<ChartTooltipProps, "hideLabel" | "hideIndicator" | "indicator" | "nameKey" | "labelKey"> {
78
+ /** Custom label formatter function */
42
79
  labelFormatter?: (value: unknown, payload: unknown[]) => React.ReactNode;
80
+ /** Additional CSS class for the label */
43
81
  labelClassName?: string;
82
+ /** Custom value formatter function */
44
83
  formatter?: (value: unknown, name: string, item: unknown, index: number, payload: unknown[]) => React.ReactNode;
45
84
  }
85
+ /**
86
+ * ChartTooltipContent renders the content inside the tooltip.
87
+ */
46
88
  declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: ChartTooltipContentProps & {
47
89
  active?: boolean;
48
90
  payload?: Array<{
@@ -58,22 +100,43 @@ declare function ChartTooltipContent({ active, payload, className, indicator, hi
58
100
  declare namespace ChartTooltipContent {
59
101
  var displayName: string;
60
102
  }
103
+ /**
104
+ * Props for the ChartLegend component.
105
+ */
61
106
  interface ChartLegendProps extends React.ComponentProps<typeof RechartsPrimitive.Legend> {
107
+ /** Key to use for the series name */
62
108
  nameKey?: string;
63
109
  }
110
+ /**
111
+ * ChartLegend displays a legend for the chart series.
112
+ */
64
113
  declare function ChartLegend({ ...props }: ChartLegendProps): import("react/jsx-runtime").JSX.Element;
114
+ declare namespace ChartLegend {
115
+ var displayName: string;
116
+ }
117
+ /**
118
+ * Props for the ChartLegendContent component.
119
+ */
65
120
  interface ChartLegendContentProps extends React.ComponentProps<"div">, Pick<ChartLegendProps, "nameKey"> {
121
+ /** Hide the series icon in the legend */
66
122
  hideIcon?: boolean;
123
+ /** Legend payload from Recharts (automatically provided) */
67
124
  payload?: Array<{
68
125
  value: string;
69
126
  dataKey: string;
70
127
  color?: string;
71
128
  payload: Record<string, unknown>;
72
129
  }>;
73
- }
74
- declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: ChartLegendContentProps & {
130
+ /**
131
+ * Vertical alignment of the legend relative to the chart
132
+ * @default "bottom"
133
+ */
75
134
  verticalAlign?: "top" | "bottom";
76
- }): import("react/jsx-runtime").JSX.Element | null;
135
+ }
136
+ /**
137
+ * ChartLegendContent renders the content inside the legend.
138
+ */
139
+ declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: ChartLegendContentProps): import("react/jsx-runtime").JSX.Element | null;
77
140
  declare namespace ChartLegendContent {
78
141
  var displayName: string;
79
142
  }