@brightlocal/ui-components 2.26.0 → 3.0.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 (284) hide show
  1. package/README.md +9 -2
  2. package/component-meta.json +4010 -255
  3. package/deprecations.json +189 -2
  4. package/dist/accordion.cjs +1 -1
  5. package/dist/accordion.js +2 -2
  6. package/dist/alert-dialog.cjs +1 -1
  7. package/dist/alert-dialog.js +18 -18
  8. package/dist/alert.cjs +1 -1
  9. package/dist/alert.d.ts +11 -1
  10. package/dist/alert.d.ts.map +1 -1
  11. package/dist/alert.js +31 -28
  12. package/dist/avatar.cjs +1 -1
  13. package/dist/avatar.js +4 -4
  14. package/dist/badge.cjs +1 -1
  15. package/dist/badge.d.ts.map +1 -1
  16. package/dist/badge.js +15 -11
  17. package/dist/blocks/empty-state.cjs +1 -0
  18. package/dist/blocks/empty-state.d.ts +172 -0
  19. package/dist/blocks/empty-state.d.ts.map +1 -0
  20. package/dist/blocks/empty-state.js +155 -0
  21. package/dist/blocks/input-list.cjs +2 -2
  22. package/dist/blocks/input-list.d.ts.map +1 -1
  23. package/dist/blocks/input-list.js +124 -108
  24. package/dist/blocks/progress-state.cjs +1 -0
  25. package/dist/blocks/progress-state.d.ts +121 -0
  26. package/dist/blocks/progress-state.d.ts.map +1 -0
  27. package/dist/blocks/progress-state.js +368 -0
  28. package/dist/blocks/sidebar.cjs +1 -1
  29. package/dist/blocks/sidebar.d.ts.map +1 -1
  30. package/dist/blocks/sidebar.js +297 -296
  31. package/dist/brand-illustration-motif.d.ts +1 -1
  32. package/dist/breadcrumb.cjs +1 -1
  33. package/dist/breadcrumb.d.ts.map +1 -1
  34. package/dist/breadcrumb.js +44 -40
  35. package/dist/button.cjs +1 -1
  36. package/dist/button.d.ts.map +1 -1
  37. package/dist/button.js +23 -23
  38. package/dist/calendar.cjs +1 -1
  39. package/dist/calendar.d.ts.map +1 -1
  40. package/dist/calendar.js +37 -38
  41. package/dist/callout.cjs +1 -1
  42. package/dist/callout.d.ts +24 -2
  43. package/dist/callout.d.ts.map +1 -1
  44. package/dist/callout.js +57 -55
  45. package/dist/card.cjs +1 -1
  46. package/dist/card.d.ts +23 -2
  47. package/dist/card.d.ts.map +1 -1
  48. package/dist/card.js +94 -91
  49. package/dist/chart-empty.cjs +1 -0
  50. package/dist/chart-empty.d.ts +59 -0
  51. package/dist/chart-empty.d.ts.map +1 -0
  52. package/dist/chart-empty.js +29 -0
  53. package/dist/chart.cjs +6 -6
  54. package/dist/chart.d.ts +6 -1
  55. package/dist/chart.d.ts.map +1 -1
  56. package/dist/chart.js +183 -183
  57. package/dist/chip.cjs +1 -1
  58. package/dist/chip.d.ts +1 -1
  59. package/dist/chip.d.ts.map +1 -1
  60. package/dist/chip.js +47 -44
  61. package/dist/combobox.cjs +3 -3
  62. package/dist/combobox.d.ts +4 -2
  63. package/dist/combobox.d.ts.map +1 -1
  64. package/dist/combobox.js +143 -141
  65. package/dist/command.cjs +1 -1
  66. package/dist/command.d.ts.map +1 -1
  67. package/dist/command.js +74 -77
  68. package/dist/context-menu.cjs +1 -1
  69. package/dist/context-menu.d.ts.map +1 -1
  70. package/dist/context-menu.js +26 -29
  71. package/dist/data-table.cjs +1 -1
  72. package/dist/data-table.d.ts +182 -13
  73. package/dist/data-table.d.ts.map +1 -1
  74. package/dist/data-table.js +462 -314
  75. package/dist/description.cjs +1 -1
  76. package/dist/description.js +5 -5
  77. package/dist/dialog.cjs +1 -1
  78. package/dist/dialog.js +20 -20
  79. package/dist/drawer.cjs +1 -1
  80. package/dist/drawer.d.ts.map +1 -1
  81. package/dist/drawer.js +8 -11
  82. package/dist/dropdown-menu.cjs +1 -1
  83. package/dist/dropdown-menu.d.ts.map +1 -1
  84. package/dist/dropdown-menu.js +17 -20
  85. package/dist/field.cjs +1 -1
  86. package/dist/field.d.ts.map +1 -1
  87. package/dist/field.js +29 -25
  88. package/dist/global-layout.cjs +1 -1
  89. package/dist/global-layout.d.ts +58 -6
  90. package/dist/global-layout.d.ts.map +1 -1
  91. package/dist/global-layout.js +278 -194
  92. package/dist/grid.cjs +1 -0
  93. package/dist/grid.d.ts +56 -0
  94. package/dist/grid.d.ts.map +1 -0
  95. package/dist/grid.js +32 -0
  96. package/dist/header.d.ts +13 -0
  97. package/dist/header.d.ts.map +1 -1
  98. package/dist/hooks/use-delayed-pending.cjs +1 -0
  99. package/dist/hooks/use-delayed-pending.d.ts +34 -0
  100. package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
  101. package/dist/hooks/use-delayed-pending.js +17 -0
  102. package/dist/hover-card.cjs +1 -1
  103. package/dist/hover-card.js +13 -13
  104. package/dist/index.cjs +1 -1
  105. package/dist/index.d.ts +10 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +523 -494
  108. package/dist/input-chip.cjs +1 -1
  109. package/dist/input-chip.js +25 -25
  110. package/dist/input-group.cjs +1 -1
  111. package/dist/input-group.js +9 -9
  112. package/dist/input-otp.cjs +1 -1
  113. package/dist/input-otp.js +9 -9
  114. package/dist/input-password.cjs +1 -1
  115. package/dist/input-password.js +51 -51
  116. package/dist/input.cjs +1 -1
  117. package/dist/input.js +9 -9
  118. package/dist/label.cjs +1 -1
  119. package/dist/label.d.ts.map +1 -1
  120. package/dist/label.js +25 -28
  121. package/dist/lib/block-illustration.cjs +1 -0
  122. package/dist/lib/block-illustration.d.ts +28 -0
  123. package/dist/lib/block-illustration.d.ts.map +1 -0
  124. package/dist/lib/block-illustration.js +21 -0
  125. package/dist/lib/empty-canvas.cjs +1 -0
  126. package/dist/lib/empty-canvas.d.ts +27 -0
  127. package/dist/lib/empty-canvas.d.ts.map +1 -0
  128. package/dist/lib/empty-canvas.js +62 -0
  129. package/dist/lib/motion.cjs +1 -1
  130. package/dist/lib/motion.js +10 -8
  131. package/dist/lib/optical-center.cjs +1 -0
  132. package/dist/lib/optical-center.d.ts +12 -0
  133. package/dist/lib/optical-center.d.ts.map +1 -0
  134. package/dist/lib/optical-center.js +11 -0
  135. package/dist/lib/utils.cjs +1 -1
  136. package/dist/lib/utils.d.ts.map +1 -1
  137. package/dist/lib/utils.js +28 -5
  138. package/dist/link.cjs +1 -1
  139. package/dist/link.d.ts +8 -6
  140. package/dist/link.d.ts.map +1 -1
  141. package/dist/link.js +52 -20
  142. package/dist/list.cjs +1 -1
  143. package/dist/list.d.ts.map +1 -1
  144. package/dist/list.js +87 -81
  145. package/dist/map.cjs +1 -1
  146. package/dist/map.d.ts +60 -2
  147. package/dist/map.d.ts.map +1 -1
  148. package/dist/map.js +187 -164
  149. package/dist/media-empty.cjs +1 -0
  150. package/dist/media-empty.d.ts +72 -0
  151. package/dist/media-empty.d.ts.map +1 -0
  152. package/dist/media-empty.js +45 -0
  153. package/dist/menubar.cjs +1 -1
  154. package/dist/menubar.d.ts.map +1 -1
  155. package/dist/menubar.js +17 -20
  156. package/dist/navigation-menu.cjs +1 -1
  157. package/dist/navigation-menu.js +7 -7
  158. package/dist/pagination.cjs +1 -1
  159. package/dist/pagination.d.ts +127 -1
  160. package/dist/pagination.d.ts.map +1 -1
  161. package/dist/pagination.js +189 -98
  162. package/dist/progress.cjs +1 -1
  163. package/dist/progress.d.ts +37 -3
  164. package/dist/progress.d.ts.map +1 -1
  165. package/dist/progress.js +102 -64
  166. package/dist/route-progress.cjs +1 -0
  167. package/dist/route-progress.d.ts +103 -0
  168. package/dist/route-progress.d.ts.map +1 -0
  169. package/dist/route-progress.js +106 -0
  170. package/dist/select.cjs +2 -2
  171. package/dist/select.d.ts.map +1 -1
  172. package/dist/select.js +19 -18
  173. package/dist/separator.cjs +1 -1
  174. package/dist/separator.js +8 -8
  175. package/dist/sheet.cjs +1 -1
  176. package/dist/sheet.d.ts +35 -2
  177. package/dist/sheet.d.ts.map +1 -1
  178. package/dist/sheet.js +103 -66
  179. package/dist/skeleton.cjs +1 -1
  180. package/dist/skeleton.d.ts +38 -3
  181. package/dist/skeleton.d.ts.map +1 -1
  182. package/dist/skeleton.js +43 -20
  183. package/dist/sonner.cjs +1 -1
  184. package/dist/sonner.d.ts.map +1 -1
  185. package/dist/sonner.js +32 -36
  186. package/dist/spinner.cjs +1 -0
  187. package/dist/spinner.d.ts +57 -0
  188. package/dist/spinner.d.ts.map +1 -0
  189. package/dist/spinner.js +35 -0
  190. package/dist/stepper.cjs +1 -1
  191. package/dist/stepper.d.ts.map +1 -1
  192. package/dist/stepper.js +23 -22
  193. package/dist/table.cjs +1 -1
  194. package/dist/table.d.ts +1 -1
  195. package/dist/table.d.ts.map +1 -1
  196. package/dist/table.js +36 -29
  197. package/dist/tabs.cjs +1 -1
  198. package/dist/tabs.js +1 -1
  199. package/dist/text-reveal-motion.d.ts +10 -0
  200. package/dist/text-reveal-motion.d.ts.map +1 -1
  201. package/dist/textarea.cjs +1 -1
  202. package/dist/textarea.js +11 -11
  203. package/dist/toggle.cjs +1 -1
  204. package/dist/toggle.js +8 -8
  205. package/dist/tooltip.cjs +1 -1
  206. package/dist/tooltip.js +8 -8
  207. package/dist/typography-heading.cjs +1 -0
  208. package/dist/typography-heading.d.ts +116 -0
  209. package/dist/typography-heading.d.ts.map +1 -0
  210. package/dist/typography-heading.js +84 -0
  211. package/dist/typography-text.cjs +1 -0
  212. package/dist/typography-text.d.ts +113 -0
  213. package/dist/typography-text.d.ts.map +1 -0
  214. package/dist/typography-text.js +81 -0
  215. package/dist/typography.d.ts +13 -0
  216. package/dist/typography.d.ts.map +1 -1
  217. package/package.json +42 -2
  218. package/src/blocks/empty-state.tsx +424 -0
  219. package/src/blocks/input-list.tsx +66 -36
  220. package/src/blocks/progress-state.tsx +542 -0
  221. package/src/blocks/sidebar.tsx +46 -40
  222. package/src/components/accordion.tsx +2 -2
  223. package/src/components/alert-dialog.tsx +2 -2
  224. package/src/components/alert.tsx +27 -13
  225. package/src/components/avatar.tsx +1 -1
  226. package/src/components/badge.tsx +8 -4
  227. package/src/components/breadcrumb.tsx +9 -4
  228. package/src/components/button.tsx +5 -8
  229. package/src/components/calendar.tsx +5 -6
  230. package/src/components/callout.tsx +48 -15
  231. package/src/components/card.tsx +52 -17
  232. package/src/components/chart-empty.tsx +116 -0
  233. package/src/components/chart.tsx +43 -17
  234. package/src/components/chip.tsx +9 -6
  235. package/src/components/combobox.tsx +21 -12
  236. package/src/components/command.tsx +9 -10
  237. package/src/components/context-menu.tsx +6 -9
  238. package/src/components/data-table.tsx +405 -31
  239. package/src/components/description.tsx +1 -1
  240. package/src/components/dialog.tsx +2 -2
  241. package/src/components/drawer.tsx +2 -5
  242. package/src/components/dropdown-menu.tsx +8 -11
  243. package/src/components/field.tsx +8 -4
  244. package/src/components/global-layout.tsx +264 -65
  245. package/src/components/grid.tsx +130 -0
  246. package/src/components/header.tsx +13 -0
  247. package/src/components/hover-card.tsx +1 -1
  248. package/src/components/input-chip.tsx +1 -1
  249. package/src/components/input-group.tsx +1 -1
  250. package/src/components/input-otp.tsx +1 -1
  251. package/src/components/input-password.tsx +1 -1
  252. package/src/components/input.tsx +1 -1
  253. package/src/components/label.tsx +10 -13
  254. package/src/components/link.tsx +39 -5
  255. package/src/components/list.tsx +18 -14
  256. package/src/components/map.tsx +101 -5
  257. package/src/components/media-empty.tsx +156 -0
  258. package/src/components/menubar.tsx +7 -10
  259. package/src/components/navigation-menu.tsx +1 -1
  260. package/src/components/pagination.tsx +279 -1
  261. package/src/components/progress.tsx +120 -11
  262. package/src/components/route-progress.tsx +354 -0
  263. package/src/components/select.tsx +5 -4
  264. package/src/components/separator.tsx +1 -1
  265. package/src/components/sheet.tsx +89 -7
  266. package/src/components/skeleton.tsx +78 -7
  267. package/src/components/sonner.tsx +5 -14
  268. package/src/components/spinner.tsx +94 -0
  269. package/src/components/stepper.tsx +6 -7
  270. package/src/components/table.tsx +11 -4
  271. package/src/components/tabs.tsx +1 -1
  272. package/src/components/text-reveal-motion.tsx +10 -0
  273. package/src/components/textarea.tsx +1 -1
  274. package/src/components/toggle.tsx +1 -1
  275. package/src/components/tooltip.tsx +1 -1
  276. package/src/components/typography-heading.tsx +229 -0
  277. package/src/components/typography-text.tsx +225 -0
  278. package/src/components/typography.tsx +13 -0
  279. package/src/hooks/use-delayed-pending.ts +60 -0
  280. package/src/index.ts +12 -0
  281. package/src/lib/block-illustration.tsx +88 -0
  282. package/src/lib/empty-canvas.tsx +128 -0
  283. package/src/lib/optical-center.tsx +45 -0
  284. package/src/lib/utils.ts +26 -0
@@ -1,46 +1,46 @@
1
- import { jsx as s, jsxs as h } from "react/jsx-runtime";
2
- import * as c from "react";
3
- import { MoreHorizontal as v, ChevronRight as b, ChevronLeft as x } from "@brightlocal/icons";
4
- import { cva as y } from "class-variance-authority";
1
+ import { jsx as a, jsxs as y } from "react/jsx-runtime";
2
+ import * as f from "react";
3
+ import { MoreHorizontal as T, ChevronRight as E, ChevronLeft as H } from "@brightlocal/icons";
4
+ import { cva as q } from "class-variance-authority";
5
5
  import { cn as d } from "@brightlocal/ui-components/lib/utils";
6
- import { useIsBelowBreakpoint as N } from "@brightlocal/ui-components/hooks/use-breakpoint";
7
- function I({
6
+ import { useIsBelowBreakpoint as A } from "@brightlocal/ui-components/hooks/use-breakpoint";
7
+ function D({
8
8
  page: i,
9
- totalPages: a
9
+ totalPages: n
10
10
  }) {
11
- const n = N("sm") ? 5 : 7;
12
- return c.useMemo(() => {
13
- const t = Math.max(5, n), r = [];
14
- if (r.push("previous"), a <= t)
15
- for (let u = 1; u <= a; u++)
16
- r.push(u);
11
+ const o = A("sm") ? 5 : 7;
12
+ return f.useMemo(() => {
13
+ const r = Math.max(5, o), e = [];
14
+ if (e.push("previous"), n <= r)
15
+ for (let u = 1; u <= n; u++)
16
+ e.push(u);
17
17
  else {
18
- const u = Math.floor((t - 5) / 2), f = t - 3, m = a - f;
19
- if (i <= f) {
20
- for (let o = 1; o <= t - 2; o++)
21
- r.push(o);
22
- r.push("ellipsis", a);
23
- } else if (i >= m) {
24
- r.push(1, "ellipsis");
25
- for (let o = a - (t - 3); o <= a; o++)
26
- r.push(o);
18
+ const u = Math.floor((r - 5) / 2), b = r - 3, g = n - b;
19
+ if (i <= b) {
20
+ for (let l = 1; l <= r - 2; l++)
21
+ e.push(l);
22
+ e.push("ellipsis", n);
23
+ } else if (i >= g) {
24
+ e.push(1, "ellipsis");
25
+ for (let l = n - (r - 3); l <= n; l++)
26
+ e.push(l);
27
27
  } else {
28
- r.push(1, "ellipsis");
29
- for (let o = i - u; o <= i + u; o++)
30
- r.push(o);
31
- r.push("ellipsis", a);
28
+ e.push(1, "ellipsis");
29
+ for (let l = i - u; l <= i + u; l++)
30
+ e.push(l);
31
+ e.push("ellipsis", n);
32
32
  }
33
33
  }
34
- return r.push("next"), r;
35
- }, [i, a, n]);
34
+ return e.push("next"), e;
35
+ }, [i, n, o]);
36
36
  }
37
- const g = y(
37
+ const w = q(
38
38
  [
39
39
  // Base styles - circular button
40
40
  "inline-flex items-center justify-center",
41
41
  "h-9 w-9",
42
42
  "rounded-full",
43
- "text-sm font-medium",
43
+ "text-label",
44
44
  "transition-colors duration-fast ease-out",
45
45
  "focus-visible:outline-none focus-visible:shadow-default"
46
46
  ],
@@ -83,131 +83,222 @@ const g = y(
83
83
  }
84
84
  }
85
85
  );
86
- function k({
86
+ function M({
87
87
  className: i,
88
- dataHook: a,
89
- trackingEl: e,
90
- trackingLabel: n,
91
- ariaLabel: l,
92
- ...t
88
+ dataHook: n,
89
+ trackingEl: t,
90
+ trackingLabel: o,
91
+ ariaLabel: s,
92
+ ...r
93
93
  }) {
94
- return /* @__PURE__ */ s(
94
+ return /* @__PURE__ */ a(
95
95
  "nav",
96
96
  {
97
- "aria-label": l ?? "Pagination",
97
+ "aria-label": s ?? "Pagination",
98
98
  className: d("mx-auto flex w-full justify-center", i),
99
- "data-hook": a,
99
+ "data-hook": n,
100
100
  "data-slot": "pagination",
101
- "data-tracking-el": e || "pagination",
102
- "data-tracking-label": n,
101
+ "data-tracking-el": t || "pagination",
102
+ "data-tracking-label": o,
103
103
  role: "navigation",
104
- ...t
104
+ ...r
105
105
  }
106
106
  );
107
107
  }
108
- k.displayName = "Pagination";
109
- function V({
108
+ M.displayName = "Pagination";
109
+ function J({
110
110
  className: i,
111
- ...a
111
+ ...n
112
112
  }) {
113
- return /* @__PURE__ */ s(
113
+ return /* @__PURE__ */ a(
114
114
  "ul",
115
115
  {
116
116
  className: d("flex flex-row items-center gap-2", i),
117
117
  "data-slot": "pagination-content",
118
- ...a
118
+ ...n
119
119
  }
120
120
  );
121
121
  }
122
- function L(i) {
123
- return /* @__PURE__ */ s("li", { "data-slot": "pagination-item", ...i });
122
+ function m(i) {
123
+ return /* @__PURE__ */ a("li", { "data-slot": "pagination-item", ...i });
124
124
  }
125
- const p = c.forwardRef(({ className: i, variant: a, isActive: e, children: n, ...l }, t) => /* @__PURE__ */ s(
125
+ const v = f.forwardRef(({ className: i, variant: n, isActive: t, children: o, ...s }, r) => /* @__PURE__ */ a(
126
126
  "button",
127
127
  {
128
- ref: t,
129
- "aria-current": e ? "page" : void 0,
130
- className: d(g({ variant: a }), i),
131
- "data-active": e,
128
+ ref: r,
129
+ "aria-current": t ? "page" : void 0,
130
+ className: d(w({ variant: n }), i),
131
+ "data-active": t,
132
132
  "data-slot": "pagination-button",
133
133
  type: "button",
134
- ...l,
135
- children: n
134
+ ...s,
135
+ children: o
136
136
  }
137
137
  ));
138
- p.displayName = "PaginationButton";
139
- const P = c.forwardRef(({ className: i, disabled: a, ariaLabel: e, ...n }, l) => /* @__PURE__ */ s(
140
- p,
138
+ v.displayName = "PaginationButton";
139
+ const P = f.forwardRef(({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
140
+ v,
141
141
  {
142
- ref: l,
143
- "aria-disabled": a,
144
- "aria-label": e ?? "Go to previous page",
142
+ ref: s,
143
+ "aria-disabled": n,
144
+ "aria-label": t ?? "Go to previous page",
145
145
  className: i,
146
- disabled: a,
146
+ disabled: n,
147
147
  variant: "previous",
148
- ...n,
149
- children: /* @__PURE__ */ s(x, {})
148
+ ...o,
149
+ children: /* @__PURE__ */ a(H, {})
150
150
  }
151
151
  ));
152
152
  P.displayName = "PaginationPrevious";
153
- const w = c.forwardRef(
154
- ({ className: i, disabled: a, ariaLabel: e, ...n }, l) => /* @__PURE__ */ s(
155
- p,
153
+ const j = f.forwardRef(
154
+ ({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
155
+ v,
156
156
  {
157
- ref: l,
158
- "aria-disabled": a,
159
- "aria-label": e ?? "Go to next page",
157
+ ref: s,
158
+ "aria-disabled": n,
159
+ "aria-label": t ?? "Go to next page",
160
160
  className: i,
161
- disabled: a,
161
+ disabled: n,
162
162
  variant: "next",
163
- ...n,
164
- children: /* @__PURE__ */ s(b, {})
163
+ ...o,
164
+ children: /* @__PURE__ */ a(E, {})
165
165
  }
166
166
  )
167
167
  );
168
- w.displayName = "PaginationNext";
169
- const R = c.forwardRef(
170
- ({ className: i, page: a, isActive: e, ariaLabel: n, ...l }, t) => /* @__PURE__ */ s(
171
- p,
168
+ j.displayName = "PaginationNext";
169
+ const R = f.forwardRef(
170
+ ({ className: i, page: n, isActive: t, ariaLabel: o, ...s }, r) => /* @__PURE__ */ a(
171
+ v,
172
172
  {
173
- ref: t,
174
- "aria-label": n ? n.replace("{page}", String(a)) : `Go to page ${a}`,
173
+ ref: r,
174
+ "aria-label": o ? o.replace("{page}", String(n)) : `Go to page ${n}`,
175
175
  className: i,
176
- isActive: e,
176
+ isActive: t,
177
177
  variant: "link",
178
- ...l,
179
- children: a
178
+ ...s,
179
+ children: n
180
180
  }
181
181
  )
182
182
  );
183
183
  R.displayName = "PaginationLink";
184
- function T({
184
+ function K({
185
185
  className: i,
186
- srLabel: a = "More pages",
187
- ...e
186
+ srLabel: n = "More pages",
187
+ ...t
188
188
  }) {
189
- return /* @__PURE__ */ h(
189
+ return /* @__PURE__ */ y(
190
190
  "span",
191
191
  {
192
192
  "aria-hidden": "true",
193
- className: d(g({ variant: "ellipsis" }), i),
193
+ className: d(w({ variant: "ellipsis" }), i),
194
194
  "data-slot": "pagination-ellipsis",
195
- ...e,
195
+ ...t,
196
196
  children: [
197
- /* @__PURE__ */ s(v, {}),
198
- /* @__PURE__ */ s("span", { className: "sr-only", children: a })
197
+ /* @__PURE__ */ a(T, {}),
198
+ /* @__PURE__ */ a("span", { className: "sr-only", children: n })
199
199
  ]
200
200
  }
201
201
  );
202
202
  }
203
+ const O = f.forwardRef(
204
+ ({
205
+ className: i,
206
+ page: n,
207
+ totalPages: t,
208
+ onPageChange: o,
209
+ dataHook: s,
210
+ totalItems: r,
211
+ pageSize: e,
212
+ renderCaption: u,
213
+ ariaLabel: b,
214
+ prevAriaLabel: g,
215
+ nextAriaLabel: l,
216
+ pageAriaLabel: C,
217
+ ellipsisSrLabel: L,
218
+ trackingEl: $,
219
+ trackingLabel: B,
220
+ ...G
221
+ }, V) => {
222
+ const F = D({ page: n, totalPages: t }), p = (() => {
223
+ if (u === null || r === void 0 || e === void 0 || !Number.isFinite(e) || e <= 0 || !Number.isFinite(r) || r < 0) return null;
224
+ const c = Math.max(1, Math.ceil(r / e)), h = Math.min(Math.max(1, Math.floor(n) || 1), c), N = r === 0 ? 0 : (h - 1) * e + 1, k = Math.min(h * e, r);
225
+ return u ? u({
226
+ page: h,
227
+ totalPages: t,
228
+ from: N,
229
+ to: k,
230
+ total: r
231
+ }) : r === 0 ? null : `Showing ${N} to ${k} of ${r} results`;
232
+ })(), x = t > 1;
233
+ return p == null && !x ? null : /* @__PURE__ */ y(
234
+ "div",
235
+ {
236
+ ref: V,
237
+ className: d(
238
+ "flex min-h-9 w-full items-center gap-4",
239
+ p == null ? "justify-center" : "justify-between",
240
+ i
241
+ ),
242
+ "data-hook": s,
243
+ "data-slot": "pagination-controls",
244
+ "data-tracking-el": $ || "pagination-controls",
245
+ "data-tracking-label": B,
246
+ ...G,
247
+ children: [
248
+ p != null && /* @__PURE__ */ a(
249
+ "span",
250
+ {
251
+ className: "text-body-sm text-muted-foreground",
252
+ "data-slot": "pagination-caption",
253
+ children: p
254
+ }
255
+ ),
256
+ x && /* @__PURE__ */ a(
257
+ M,
258
+ {
259
+ ariaLabel: b,
260
+ className: d(p != null && "mx-0 w-auto justify-end"),
261
+ dataHook: `${s}-nav`,
262
+ children: /* @__PURE__ */ a(J, { children: F.map((c, h) => c === "previous" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
263
+ P,
264
+ {
265
+ ariaLabel: g,
266
+ disabled: n <= 1,
267
+ onClick: () => o(n - 1)
268
+ }
269
+ ) }, "previous") : c === "next" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
270
+ j,
271
+ {
272
+ ariaLabel: l,
273
+ disabled: n >= t,
274
+ onClick: () => o(n + 1)
275
+ }
276
+ ) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(K, { srLabel: L }) }, `ellipsis-${h}`) : /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
277
+ R,
278
+ {
279
+ ariaLabel: C,
280
+ isActive: c === n,
281
+ page: c,
282
+ onClick: () => o(c)
283
+ }
284
+ ) }, c)) })
285
+ }
286
+ )
287
+ ]
288
+ }
289
+ );
290
+ }
291
+ );
292
+ O.displayName = "PaginationControls";
203
293
  export {
204
- k as Pagination,
205
- p as PaginationButton,
206
- V as PaginationContent,
207
- T as PaginationEllipsis,
208
- L as PaginationItem,
294
+ M as Pagination,
295
+ v as PaginationButton,
296
+ J as PaginationContent,
297
+ O as PaginationControls,
298
+ K as PaginationEllipsis,
299
+ m as PaginationItem,
209
300
  R as PaginationLink,
210
- w as PaginationNext,
301
+ j as PaginationNext,
211
302
  P as PaginationPrevious,
212
- I as usePagination
303
+ D as usePagination
213
304
  };
package/dist/progress.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),S=require("react"),$=require("@radix-ui/react-progress"),q=require("framer-motion"),i=require("@brightlocal/ui-components/lib/utils"),_=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),v=require("./lib/motion.cjs");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const b=h(S),p=h($),m={green:{track:"bg-brand-primary-foreground/20",indicator:"bg-green-400"},red:{track:"bg-brand-red/20",indicator:"bg-brand-red"},orange:{track:"bg-brand-orange/20",indicator:"bg-brand-orange"},yellow:{track:"bg-brand-yellow/20",indicator:"bg-brand-yellow"}};function I(e,t,r){if(e==null)return"–";if(r==="%")return`${t>0?Math.min(100,Math.max(0,Math.round(e/t*100))):0}%`;const n=r?` ${r}`:"";return t>0?`${e} / ${t}${n}`:`${e}${n}`}const P=b.forwardRef(({className:e,value:t,max:r=100,dataHook:n,trackingEl:c,trackingLabel:y,ariaLabel:j="Progress",label:d,color:x="green",showValue:s=!1,unit:M="%",indicatorClassName:k,disabled:l,...R},N)=>{const g=b.useId(),a=!!d,w=_.usePrefersReducedMotion(),u=m[x]??m.green,O=r>0?Math.min(100,Math.max(0,(t??0)/r*100)):0,f=o.jsx(p.Root,{ref:N,"aria-label":a?void 0:j,"aria-labelledby":a?g:void 0,className:i.cn("relative h-2 w-full overflow-hidden rounded-full",u.track,!a&&!s&&l&&"opacity-50",e),"data-hook":n,"data-slot":"progress","data-tracking-el":c,"data-tracking-label":y,max:r,value:t,...R,children:o.jsx(p.Indicator,{asChild:!0,children:o.jsx(q.motion.div,{animate:{transform:`translateX(-${100-O}%)`},className:i.cn("h-full w-full flex-1",u.indicator,k),"data-slot":"progress-indicator",initial:!1,transition:w?{duration:0}:v.SPRING_GENTLE})})});return!a&&!s?f:o.jsxs("div",{className:i.cn("flex w-full items-center gap-2",l&&"opacity-50"),"data-slot":"progress-wrapper",children:[a&&o.jsx("span",{className:"text-foreground text-xs leading-none font-medium","data-slot":"progress-label",id:g,children:d}),f,s&&o.jsx("span",{className:"text-muted-foreground shrink-0 text-xs leading-none tabular-nums","data-slot":"progress-value",children:I(t,r,M)})]})});P.displayName="Progress";exports.Progress=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),T=require("react"),I=require("@radix-ui/react-progress"),D=require("framer-motion"),n=require("@brightlocal/ui-components/lib/utils"),z=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),A=require("./lib/motion.cjs");function R(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const w=R(T),x=R(I),y={sm:{text:"text-body-sm",bar:"h-2"},md:{text:"text-body",bar:"h-3"}},P={green:{track:"bg-brand-primary-foreground/20",indicator:"bg-green-400"},red:{track:"bg-brand-red/20",indicator:"bg-brand-red"},orange:{track:"bg-brand-orange/20",indicator:"bg-brand-orange"},yellow:{track:"bg-brand-yellow/20",indicator:"bg-brand-yellow"}},B="40%";function j(r,t,e){if(r==null)return"–";if(e==="%")return`${t>0?Math.min(100,Math.max(0,Math.round(r/t*100))):0}%`;const a=e?` ${e}`:"";return t>0?`${r} / ${t}${a}`:`${r}${a}`}const k=w.forwardRef(({className:r,value:t,max:e=100,dataHook:a,trackingEl:d,trackingLabel:v,ariaLabel:S="Progress",label:g,labelWidth:u=B,color:M="green",size:N="sm",showValue:i=!1,unit:b="%",indicatorClassName:_,disabled:f,...L},O)=>{const m=w.useId(),o=!!g,$=z.usePrefersReducedMotion(),p=P[M]??P.green,c=y[N]??y.sm,l=u==="auto",q=o||i,E=e>0?Math.min(100,Math.max(0,(t??0)/e*100)):0,h=s.jsx(x.Root,{ref:O,"aria-label":o?void 0:S,"aria-labelledby":o?m:void 0,className:n.cn("relative w-full overflow-hidden rounded-full",q&&"min-w-0 flex-1",c.bar,p.track,!o&&!i&&f&&"opacity-50",r),"data-hook":a,"data-slot":"progress","data-tracking-el":d,"data-tracking-label":v,max:e,value:t??0,...L,children:s.jsx(x.Indicator,{asChild:!0,children:s.jsx(D.motion.div,{animate:{transform:`translateX(-${100-E}%)`},className:n.cn("h-full w-full flex-1",p.indicator,_),"data-slot":"progress-indicator",initial:!1,transition:$?{duration:0}:A.SPRING_GENTLE})})});return!o&&!i?h:s.jsxs("div",{className:n.cn("flex w-full items-center gap-2",f&&"opacity-50"),"data-slot":"progress-wrapper",children:[o&&s.jsx("span",{className:n.cn("text-foreground shrink-0 break-words",l&&"max-w-2/5",c.text),"data-label-width":l?"auto":void 0,"data-slot":"progress-label",id:m,style:l?void 0:{width:u},children:g}),h,i&&s.jsxs("span",{className:n.cn("text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",c.text),"data-slot":"progress-value",children:[s.jsx("span",{"aria-hidden":"true",className:"invisible col-start-1 row-start-1","data-slot":"progress-value-sizer",children:j(e,e,b)}),s.jsx("span",{className:"col-start-1 row-start-1","data-slot":"progress-value-text",children:j(t,e,b)})]})]})});k.displayName="Progress";exports.Progress=k;
@@ -8,6 +8,17 @@ import * as ProgressPrimitive from "@radix-ui/react-progress";
8
8
  * - `red` — critical / urgent
9
9
  */
10
10
  type ProgressColor = "green" | "red" | "orange" | "yellow";
11
+ /**
12
+ * Text size of the label and value.
13
+ * - `sm` — 14px (`text-body-sm`), the default for metric rows in cards
14
+ * - `md` — 16px (`text-body`) for roomier layouts
15
+ */
16
+ type ProgressSize = "sm" | "md";
17
+ /**
18
+ * Width of the label column as a share of the row, or `auto` to hug the text.
19
+ * Mirrors the Figma `Progress / Label` Width options.
20
+ */
21
+ type ProgressLabelWidth = "auto" | "20%" | "30%" | "40%" | "50%";
11
22
  /**
12
23
  * Props for the Progress component.
13
24
  */
@@ -30,14 +41,31 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
30
41
  */
31
42
  ariaLabel?: string;
32
43
  /**
33
- * Optional visible label text displayed to the left of the progress bar
44
+ * Optional visible label text displayed to the left of the progress bar.
45
+ * Rendered inside a fixed-width column (see `labelWidth`); longer labels
46
+ * wrap onto further lines while the bar and value stay in their columns.
34
47
  */
35
48
  label?: string;
49
+ /**
50
+ * Width of the label column: `"20%"` … `"50%"` of the row in 10% steps, or
51
+ * `"auto"`. Every row that uses the same percentage starts its bar at the
52
+ * same x-position, so stacked rows inside a card line up — pick the step that
53
+ * keeps the labels in that card to one or two lines. Use `"auto"` for a
54
+ * single row that isn't aligned with others: the label hugs its text (capped
55
+ * at 40% of the row) and the bar starts right after it.
56
+ * @default "40%"
57
+ */
58
+ labelWidth?: ProgressLabelWidth;
36
59
  /**
37
60
  * Brand color for the indicator.
38
61
  * @default "green"
39
62
  */
40
63
  color?: ProgressColor;
64
+ /**
65
+ * Row size: `sm` = 14px text with an 8px bar, `md` = 16px text with a 12px bar.
66
+ * @default "sm"
67
+ */
68
+ size?: ProgressSize;
41
69
  /**
42
70
  * Whether to render the numeric value to the right of the progress bar.
43
71
  * Falls back to `–` when no value is provided so the layout stays consistent.
@@ -53,7 +81,7 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
53
81
  unit?: string;
54
82
  /**
55
83
  * Custom class name for the indicator (progress fill)
56
- * Use this to customize the color, e.g., "bg-red-500"
84
+ * Use this to customize the color, e.g., "bg-chart-red"
57
85
  */
58
86
  indicatorClassName?: string;
59
87
  /**
@@ -65,8 +93,14 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
65
93
  /**
66
94
  * Progress component for displaying loading states and task completion.
67
95
  * Built on Radix UI Progress primitive with Framer Motion animation.
96
+ *
97
+ * With a `label` and/or `showValue` the bar renders as a three-column row:
98
+ * a fixed-width label column, the bar filling the remaining space, and a
99
+ * right-aligned value column sized to the widest value it can show — so rows
100
+ * stacked in a card share the same bar start position and width, even when
101
+ * a label wraps onto two lines.
68
102
  */
69
103
  declare const Progress: React.ForwardRefExoticComponent<Omit<ProgressProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
70
104
  export { Progress };
71
- export type { ProgressProps, ProgressColor };
105
+ export type { ProgressProps, ProgressColor, ProgressSize, ProgressLabelWidth };
72
106
  //# sourceMappingURL=progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA0D3D;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,QAAQ,mGAqGb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAO9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D;;;;GAIG;AACH,KAAK,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AA6ChC;;;GAGG;AACH,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAkCjE;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;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,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,QAAQ,mGA2Jb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC"}