@brightlocal/ui-components 2.27.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 (259) hide show
  1. package/README.md +6 -1
  2. package/component-meta.json +480 -126
  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-screen.d.ts → progress-state.d.ts} +30 -18
  26. package/dist/blocks/progress-state.d.ts.map +1 -0
  27. package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
  28. package/dist/blocks/sidebar.cjs +1 -1
  29. package/dist/blocks/sidebar.d.ts.map +1 -1
  30. package/dist/blocks/sidebar.js +160 -161
  31. package/dist/breadcrumb.cjs +1 -1
  32. package/dist/breadcrumb.js +1 -1
  33. package/dist/button.cjs +1 -1
  34. package/dist/button.js +11 -11
  35. package/dist/calendar.cjs +1 -1
  36. package/dist/calendar.d.ts.map +1 -1
  37. package/dist/calendar.js +37 -38
  38. package/dist/callout.cjs +1 -1
  39. package/dist/callout.d.ts +24 -2
  40. package/dist/callout.d.ts.map +1 -1
  41. package/dist/callout.js +57 -55
  42. package/dist/card.cjs +1 -1
  43. package/dist/card.d.ts +23 -2
  44. package/dist/card.d.ts.map +1 -1
  45. package/dist/card.js +94 -91
  46. package/dist/chart-empty.cjs +1 -0
  47. package/dist/chart-empty.d.ts +59 -0
  48. package/dist/chart-empty.d.ts.map +1 -0
  49. package/dist/chart-empty.js +29 -0
  50. package/dist/chart.cjs +6 -6
  51. package/dist/chart.d.ts +6 -1
  52. package/dist/chart.d.ts.map +1 -1
  53. package/dist/chart.js +183 -183
  54. package/dist/chip.cjs +1 -1
  55. package/dist/chip.d.ts.map +1 -1
  56. package/dist/chip.js +5 -3
  57. package/dist/combobox.cjs +2 -2
  58. package/dist/combobox.d.ts.map +1 -1
  59. package/dist/combobox.js +81 -79
  60. package/dist/command.cjs +1 -1
  61. package/dist/command.d.ts.map +1 -1
  62. package/dist/command.js +74 -77
  63. package/dist/context-menu.cjs +1 -1
  64. package/dist/context-menu.d.ts.map +1 -1
  65. package/dist/context-menu.js +26 -29
  66. package/dist/data-table.cjs +1 -1
  67. package/dist/data-table.d.ts +44 -10
  68. package/dist/data-table.d.ts.map +1 -1
  69. package/dist/data-table.js +13 -11
  70. package/dist/description.cjs +1 -1
  71. package/dist/description.js +5 -5
  72. package/dist/dialog.cjs +1 -1
  73. package/dist/dialog.js +20 -20
  74. package/dist/drawer.cjs +1 -1
  75. package/dist/drawer.d.ts.map +1 -1
  76. package/dist/drawer.js +8 -11
  77. package/dist/dropdown-menu.cjs +1 -1
  78. package/dist/dropdown-menu.d.ts.map +1 -1
  79. package/dist/dropdown-menu.js +17 -20
  80. package/dist/field.cjs +1 -1
  81. package/dist/field.d.ts.map +1 -1
  82. package/dist/field.js +29 -25
  83. package/dist/global-layout.cjs +1 -1
  84. package/dist/global-layout.d.ts +27 -1
  85. package/dist/global-layout.d.ts.map +1 -1
  86. package/dist/global-layout.js +18 -16
  87. package/dist/grid.cjs +1 -0
  88. package/dist/grid.d.ts +56 -0
  89. package/dist/grid.d.ts.map +1 -0
  90. package/dist/grid.js +32 -0
  91. package/dist/header.d.ts +13 -0
  92. package/dist/header.d.ts.map +1 -1
  93. package/dist/hooks/use-delayed-pending.cjs +1 -0
  94. package/dist/hooks/use-delayed-pending.d.ts +34 -0
  95. package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
  96. package/dist/hooks/use-delayed-pending.js +17 -0
  97. package/dist/hover-card.cjs +1 -1
  98. package/dist/hover-card.js +13 -13
  99. package/dist/index.cjs +1 -1
  100. package/dist/index.d.ts +8 -1
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +512 -494
  103. package/dist/input-chip.cjs +1 -1
  104. package/dist/input-chip.js +25 -25
  105. package/dist/input-group.cjs +1 -1
  106. package/dist/input-group.js +9 -9
  107. package/dist/input-otp.cjs +1 -1
  108. package/dist/input-otp.js +9 -9
  109. package/dist/input-password.cjs +1 -1
  110. package/dist/input-password.js +51 -51
  111. package/dist/input.cjs +1 -1
  112. package/dist/input.js +9 -9
  113. package/dist/label.cjs +1 -1
  114. package/dist/label.d.ts.map +1 -1
  115. package/dist/label.js +25 -28
  116. package/dist/lib/block-illustration.cjs +1 -0
  117. package/dist/lib/block-illustration.d.ts +28 -0
  118. package/dist/lib/block-illustration.d.ts.map +1 -0
  119. package/dist/lib/block-illustration.js +21 -0
  120. package/dist/lib/empty-canvas.cjs +1 -0
  121. package/dist/lib/empty-canvas.d.ts +27 -0
  122. package/dist/lib/empty-canvas.d.ts.map +1 -0
  123. package/dist/lib/empty-canvas.js +62 -0
  124. package/dist/lib/optical-center.cjs +1 -0
  125. package/dist/lib/optical-center.d.ts +12 -0
  126. package/dist/lib/optical-center.d.ts.map +1 -0
  127. package/dist/lib/optical-center.js +11 -0
  128. package/dist/lib/utils.cjs +1 -1
  129. package/dist/lib/utils.d.ts.map +1 -1
  130. package/dist/lib/utils.js +28 -5
  131. package/dist/list.cjs +1 -1
  132. package/dist/list.d.ts.map +1 -1
  133. package/dist/list.js +62 -58
  134. package/dist/map.cjs +1 -1
  135. package/dist/map.d.ts +60 -2
  136. package/dist/map.d.ts.map +1 -1
  137. package/dist/map.js +187 -164
  138. package/dist/media-empty.cjs +1 -0
  139. package/dist/media-empty.d.ts +72 -0
  140. package/dist/media-empty.d.ts.map +1 -0
  141. package/dist/media-empty.js +45 -0
  142. package/dist/menubar.cjs +1 -1
  143. package/dist/menubar.d.ts.map +1 -1
  144. package/dist/menubar.js +17 -20
  145. package/dist/navigation-menu.cjs +1 -1
  146. package/dist/navigation-menu.js +7 -7
  147. package/dist/pagination.cjs +1 -1
  148. package/dist/pagination.d.ts +127 -1
  149. package/dist/pagination.d.ts.map +1 -1
  150. package/dist/pagination.js +189 -98
  151. package/dist/progress.cjs +1 -1
  152. package/dist/progress.d.ts +2 -26
  153. package/dist/progress.d.ts.map +1 -1
  154. package/dist/progress.js +79 -118
  155. package/dist/select.cjs +2 -2
  156. package/dist/select.d.ts.map +1 -1
  157. package/dist/select.js +19 -18
  158. package/dist/separator.cjs +1 -1
  159. package/dist/separator.js +8 -8
  160. package/dist/sheet.cjs +1 -1
  161. package/dist/sheet.js +2 -2
  162. package/dist/skeleton.cjs +1 -1
  163. package/dist/skeleton.d.ts +38 -3
  164. package/dist/skeleton.d.ts.map +1 -1
  165. package/dist/skeleton.js +43 -20
  166. package/dist/sonner.cjs +1 -1
  167. package/dist/sonner.js +26 -26
  168. package/dist/stepper.cjs +1 -1
  169. package/dist/stepper.js +40 -40
  170. package/dist/table.cjs +1 -1
  171. package/dist/table.d.ts.map +1 -1
  172. package/dist/table.js +31 -28
  173. package/dist/tabs.cjs +1 -1
  174. package/dist/tabs.js +1 -1
  175. package/dist/text-reveal-motion.d.ts +10 -0
  176. package/dist/text-reveal-motion.d.ts.map +1 -1
  177. package/dist/textarea.cjs +1 -1
  178. package/dist/textarea.js +11 -11
  179. package/dist/toggle.cjs +1 -1
  180. package/dist/toggle.js +8 -8
  181. package/dist/tooltip.cjs +1 -1
  182. package/dist/tooltip.js +8 -8
  183. package/dist/typography-heading.cjs +1 -0
  184. package/dist/typography-heading.d.ts +116 -0
  185. package/dist/typography-heading.d.ts.map +1 -0
  186. package/dist/typography-heading.js +84 -0
  187. package/dist/typography-text.cjs +1 -0
  188. package/dist/typography-text.d.ts +113 -0
  189. package/dist/typography-text.d.ts.map +1 -0
  190. package/dist/typography-text.js +81 -0
  191. package/dist/typography.d.ts +13 -0
  192. package/dist/typography.d.ts.map +1 -1
  193. package/package.json +35 -7
  194. package/src/blocks/empty-state.tsx +424 -0
  195. package/src/blocks/input-list.tsx +66 -36
  196. package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
  197. package/src/blocks/sidebar.tsx +25 -26
  198. package/src/components/accordion.tsx +2 -2
  199. package/src/components/alert-dialog.tsx +2 -2
  200. package/src/components/alert.tsx +27 -13
  201. package/src/components/avatar.tsx +1 -1
  202. package/src/components/badge.tsx +8 -4
  203. package/src/components/breadcrumb.tsx +1 -1
  204. package/src/components/button.tsx +3 -3
  205. package/src/components/calendar.tsx +5 -6
  206. package/src/components/callout.tsx +48 -15
  207. package/src/components/card.tsx +52 -17
  208. package/src/components/chart-empty.tsx +116 -0
  209. package/src/components/chart.tsx +43 -17
  210. package/src/components/chip.tsx +5 -3
  211. package/src/components/combobox.tsx +12 -10
  212. package/src/components/command.tsx +9 -10
  213. package/src/components/context-menu.tsx +6 -9
  214. package/src/components/data-table.tsx +72 -17
  215. package/src/components/description.tsx +1 -1
  216. package/src/components/dialog.tsx +2 -2
  217. package/src/components/drawer.tsx +2 -5
  218. package/src/components/dropdown-menu.tsx +8 -11
  219. package/src/components/field.tsx +8 -4
  220. package/src/components/global-layout.tsx +36 -3
  221. package/src/components/grid.tsx +130 -0
  222. package/src/components/header.tsx +13 -0
  223. package/src/components/hover-card.tsx +1 -1
  224. package/src/components/input-chip.tsx +1 -1
  225. package/src/components/input-group.tsx +1 -1
  226. package/src/components/input-otp.tsx +1 -1
  227. package/src/components/input-password.tsx +1 -1
  228. package/src/components/input.tsx +1 -1
  229. package/src/components/label.tsx +10 -13
  230. package/src/components/list.tsx +13 -9
  231. package/src/components/map.tsx +101 -5
  232. package/src/components/media-empty.tsx +156 -0
  233. package/src/components/menubar.tsx +7 -10
  234. package/src/components/navigation-menu.tsx +1 -1
  235. package/src/components/pagination.tsx +279 -1
  236. package/src/components/progress.tsx +35 -113
  237. package/src/components/select.tsx +5 -4
  238. package/src/components/separator.tsx +1 -1
  239. package/src/components/sheet.tsx +2 -2
  240. package/src/components/skeleton.tsx +78 -7
  241. package/src/components/sonner.tsx +2 -2
  242. package/src/components/stepper.tsx +3 -3
  243. package/src/components/table.tsx +6 -3
  244. package/src/components/tabs.tsx +1 -1
  245. package/src/components/text-reveal-motion.tsx +10 -0
  246. package/src/components/textarea.tsx +1 -1
  247. package/src/components/toggle.tsx +1 -1
  248. package/src/components/tooltip.tsx +1 -1
  249. package/src/components/typography-heading.tsx +229 -0
  250. package/src/components/typography-text.tsx +225 -0
  251. package/src/components/typography.tsx +13 -0
  252. package/src/hooks/use-delayed-pending.ts +60 -0
  253. package/src/index.ts +10 -1
  254. package/src/lib/block-illustration.tsx +88 -0
  255. package/src/lib/empty-canvas.tsx +128 -0
  256. package/src/lib/optical-center.tsx +45 -0
  257. package/src/lib/utils.ts +26 -0
  258. package/dist/blocks/progress-screen.cjs +0 -1
  259. package/dist/blocks/progress-screen.d.ts.map +0 -1
@@ -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 s=require("react/jsx-runtime"),B=require("react"),C=require("@radix-ui/react-progress"),G=require("framer-motion"),a=require("@brightlocal/ui-components/lib/utils"),H=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),Y=require("./lib/motion.cjs");function _(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const S=_(B),b=_(C),k={sm:{text:"text-sm",bar:"h-2"},md:{text:"text-base",bar:"h-3"}},R={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"}},D="40%";function M(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 o=e?` ${e}`:"";return t>0?`${r} / ${t}${o}`:`${r}${o}`}const L=S.forwardRef(({className:r,value:t,max:e=100,dataHook:o,trackingEl:m,trackingLabel:O,ariaLabel:$="Progress",label:h,labelWidth:x=D,color:q="green",size:E="sm",showValue:I=!1,unit:w="%",indicatorClassName:j,statusDescription:l,indeterminate:d=!1,disabled:u,...T},z)=>{const y=S.useId(),n=!!h,v=H.usePrefersReducedMotion(),g=R[q]??R.green,i=k[E]??k.sm,f=x==="auto",c=I&&!d,p=l!=null&&l!==!1,V=n||c,A=e>0?Math.min(100,Math.max(0,(t??0)/e*100)):0,P=s.jsx(b.Root,{ref:z,"aria-label":n?void 0:$,"aria-labelledby":n?y:void 0,className:a.cn("relative w-full overflow-hidden rounded-full",V&&"min-w-0 flex-1",i.bar,g.track,!n&&!c&&u&&"opacity-50",r),"data-hook":o,"data-slot":"progress","data-tracking-el":m,"data-tracking-label":O,max:e,value:d?null:t??0,...T,children:d?s.jsx(b.Indicator,{asChild:!0,children:s.jsx("div",{className:a.cn("h-full w-2/5 rounded-full",g.indicator,v?"translate-x-[75%]":"animate-ambient-sweep",j),"data-slot":"progress-indicator"})}):s.jsx(b.Indicator,{asChild:!0,children:s.jsx(G.motion.div,{animate:{transform:`translateX(-${100-A}%)`},className:a.cn("h-full w-full flex-1",g.indicator,j),"data-slot":"progress-indicator",initial:!1,transition:v?{duration:0}:Y.SPRING_GENTLE})})});if(!n&&!c&&!p)return P;const N=s.jsxs("div",{className:a.cn("flex w-full items-center gap-2",!p&&u&&"opacity-50"),"data-slot":"progress-wrapper",children:[n&&s.jsx("span",{className:a.cn("text-foreground shrink-0 font-medium break-words",f&&"max-w-2/5",i.text),"data-label-width":f?"auto":void 0,"data-slot":"progress-label",id:y,style:f?void 0:{width:x},children:h}),P,c&&s.jsxs("span",{className:a.cn("text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",i.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:M(e,e,w)}),s.jsx("span",{className:"col-start-1 row-start-1","data-slot":"progress-value-text",children:M(t,e,w)})]})]});return p?s.jsxs("div",{className:a.cn("flex w-full flex-col gap-2",u&&"opacity-50"),"data-slot":"progress-status-wrapper",children:[s.jsx("span",{"aria-live":"polite",className:a.cn("text-muted-foreground",i.text),"data-slot":"progress-status",children:l}),N]}):N});L.displayName="Progress";exports.Progress=L;
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;
@@ -10,8 +10,8 @@ import * as ProgressPrimitive from "@radix-ui/react-progress";
10
10
  type ProgressColor = "green" | "red" | "orange" | "yellow";
11
11
  /**
12
12
  * Text size of the label and value.
13
- * - `sm` — 14px (`text-sm`), the default for metric rows in cards
14
- * - `md` — 16px (`text-base`) for roomier layouts
13
+ * - `sm` — 14px (`text-body-sm`), the default for metric rows in cards
14
+ * - `md` — 16px (`text-body`) for roomier layouts
15
15
  */
16
16
  type ProgressSize = "sm" | "md";
17
17
  /**
@@ -84,30 +84,6 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
84
84
  * Use this to customize the color, e.g., "bg-chart-red"
85
85
  */
86
86
  indicatorClassName?: string;
87
- /**
88
- * A line describing what the run is doing right now — the step, not the
89
- * number. Renders on its own line above the bar's row, so `label` stays on
90
- * the left and the value on the right. It takes the row's `size`, so it reads
91
- * as a peer of the value rather than a second scale.
92
- *
93
- * It is a polite live region, and it never becomes the bar's accessible name
94
- * (`ariaLabel` still owns that) — which is what makes it the right slot for a
95
- * status that moves, where `label` is not.
96
- * @example "Scanning search results across your area"
97
- */
98
- statusDescription?: React.ReactNode;
99
- /**
100
- * Runs the bar as an indeterminate sweep: a short pill travelling the track
101
- * for "running, and we cannot say how far". Use when work is genuinely
102
- * underway but the backend reports no percentage — never as a stand-in for a
103
- * number you could have fetched.
104
- *
105
- * `value` is ignored while this is set, the numeric readout is suppressed
106
- * (there is nothing to report), and the bar drops `aria-valuenow` so assistive
107
- * technology announces it as indeterminate rather than as 0%.
108
- * @default false
109
- */
110
- indeterminate?: boolean;
111
87
  /**
112
88
  * Whether the progress is in a disabled state
113
89
  * When disabled, the component renders with 50% opacity
@@ -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;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;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,QAAQ,mGAiNb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,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"}