@brightlocal/ui-components 2.27.0 → 3.1.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 (289) hide show
  1. package/README.md +7 -1
  2. package/component-meta.json +568 -143
  3. package/deprecations.json +298 -1
  4. package/dist/accordion.cjs +1 -1
  5. package/dist/accordion.d.ts +36 -0
  6. package/dist/accordion.d.ts.map +1 -1
  7. package/dist/accordion.js +74 -61
  8. package/dist/alert-dialog.cjs +1 -1
  9. package/dist/alert-dialog.js +18 -18
  10. package/dist/alert.cjs +1 -1
  11. package/dist/alert.d.ts +11 -1
  12. package/dist/alert.d.ts.map +1 -1
  13. package/dist/alert.js +31 -28
  14. package/dist/avatar.cjs +1 -1
  15. package/dist/avatar.js +4 -4
  16. package/dist/badge.cjs +1 -1
  17. package/dist/badge.d.ts.map +1 -1
  18. package/dist/badge.js +15 -11
  19. package/dist/blocks/empty-state.cjs +1 -0
  20. package/dist/blocks/empty-state.d.ts +172 -0
  21. package/dist/blocks/empty-state.d.ts.map +1 -0
  22. package/dist/blocks/empty-state.js +147 -0
  23. package/dist/blocks/input-list.cjs +2 -2
  24. package/dist/blocks/input-list.d.ts.map +1 -1
  25. package/dist/blocks/input-list.js +124 -108
  26. package/dist/blocks/progress-state.cjs +1 -0
  27. package/dist/blocks/{progress-screen.d.ts → progress-state.d.ts} +30 -18
  28. package/dist/blocks/progress-state.d.ts.map +1 -0
  29. package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
  30. package/dist/blocks/sidebar.cjs +1 -1
  31. package/dist/blocks/sidebar.d.ts.map +1 -1
  32. package/dist/blocks/sidebar.js +160 -161
  33. package/dist/breadcrumb.cjs +1 -1
  34. package/dist/breadcrumb.js +1 -1
  35. package/dist/button-group.cjs +1 -0
  36. package/dist/button-group.d.ts +36 -0
  37. package/dist/button-group.d.ts.map +1 -0
  38. package/dist/button-group.js +47 -0
  39. package/dist/button.cjs +1 -1
  40. package/dist/button.js +12 -12
  41. package/dist/calendar.cjs +1 -1
  42. package/dist/calendar.d.ts.map +1 -1
  43. package/dist/calendar.js +37 -38
  44. package/dist/callout.cjs +1 -1
  45. package/dist/callout.d.ts +24 -2
  46. package/dist/callout.d.ts.map +1 -1
  47. package/dist/callout.js +57 -55
  48. package/dist/card.cjs +1 -1
  49. package/dist/card.d.ts +42 -3
  50. package/dist/card.d.ts.map +1 -1
  51. package/dist/card.js +102 -91
  52. package/dist/chart-empty.cjs +1 -0
  53. package/dist/chart-empty.d.ts +59 -0
  54. package/dist/chart-empty.d.ts.map +1 -0
  55. package/dist/chart-empty.js +29 -0
  56. package/dist/chart.cjs +6 -6
  57. package/dist/chart.d.ts +46 -13
  58. package/dist/chart.d.ts.map +1 -1
  59. package/dist/chart.js +172 -157
  60. package/dist/chip.cjs +1 -1
  61. package/dist/chip.d.ts +38 -4
  62. package/dist/chip.d.ts.map +1 -1
  63. package/dist/chip.js +100 -84
  64. package/dist/combobox.cjs +2 -2
  65. package/dist/combobox.d.ts.map +1 -1
  66. package/dist/combobox.js +81 -79
  67. package/dist/command.cjs +1 -1
  68. package/dist/command.d.ts +23 -1
  69. package/dist/command.d.ts.map +1 -1
  70. package/dist/command.js +248 -225
  71. package/dist/context-menu.cjs +1 -1
  72. package/dist/context-menu.d.ts.map +1 -1
  73. package/dist/context-menu.js +26 -29
  74. package/dist/data-table.cjs +1 -1
  75. package/dist/data-table.d.ts +75 -10
  76. package/dist/data-table.d.ts.map +1 -1
  77. package/dist/data-table.js +346 -334
  78. package/dist/date-picker.cjs +1 -1
  79. package/dist/date-picker.d.ts +13 -5
  80. package/dist/date-picker.d.ts.map +1 -1
  81. package/dist/date-picker.js +54 -53
  82. package/dist/description.cjs +1 -1
  83. package/dist/description.js +5 -5
  84. package/dist/dialog.cjs +1 -1
  85. package/dist/dialog.js +20 -20
  86. package/dist/drawer.cjs +1 -1
  87. package/dist/drawer.d.ts.map +1 -1
  88. package/dist/drawer.js +8 -11
  89. package/dist/dropdown-menu.cjs +1 -1
  90. package/dist/dropdown-menu.d.ts.map +1 -1
  91. package/dist/dropdown-menu.js +17 -20
  92. package/dist/field.cjs +1 -1
  93. package/dist/field.d.ts +8 -1
  94. package/dist/field.d.ts.map +1 -1
  95. package/dist/field.js +96 -65
  96. package/dist/global-layout.cjs +1 -1
  97. package/dist/global-layout.d.ts +130 -12
  98. package/dist/global-layout.d.ts.map +1 -1
  99. package/dist/global-layout.js +146 -127
  100. package/dist/grid.cjs +1 -0
  101. package/dist/grid.d.ts +56 -0
  102. package/dist/grid.d.ts.map +1 -0
  103. package/dist/grid.js +32 -0
  104. package/dist/header.d.ts +13 -0
  105. package/dist/header.d.ts.map +1 -1
  106. package/dist/hooks/use-delayed-pending.cjs +1 -0
  107. package/dist/hooks/use-delayed-pending.d.ts +34 -0
  108. package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
  109. package/dist/hooks/use-delayed-pending.js +17 -0
  110. package/dist/hooks/use-mobile.cjs +1 -0
  111. package/dist/hooks/use-mobile.js +8 -0
  112. package/dist/hover-card.cjs +1 -1
  113. package/dist/hover-card.js +13 -13
  114. package/dist/index.cjs +1 -1
  115. package/dist/index.d.ts +9 -1
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.js +554 -527
  118. package/dist/input-chip.cjs +1 -1
  119. package/dist/input-chip.js +25 -25
  120. package/dist/input-group.cjs +1 -1
  121. package/dist/input-group.js +9 -9
  122. package/dist/input-otp.cjs +1 -1
  123. package/dist/input-otp.js +9 -9
  124. package/dist/input-password.cjs +1 -1
  125. package/dist/input-password.d.ts +17 -9
  126. package/dist/input-password.d.ts.map +1 -1
  127. package/dist/input-password.js +73 -72
  128. package/dist/input.cjs +1 -1
  129. package/dist/input.js +9 -9
  130. package/dist/label.cjs +1 -1
  131. package/dist/label.d.ts.map +1 -1
  132. package/dist/label.js +25 -28
  133. package/dist/lib/block-illustration.cjs +1 -0
  134. package/dist/lib/block-illustration.d.ts +28 -0
  135. package/dist/lib/block-illustration.d.ts.map +1 -0
  136. package/dist/lib/block-illustration.js +21 -0
  137. package/dist/lib/empty-canvas.cjs +1 -0
  138. package/dist/lib/empty-canvas.d.ts +27 -0
  139. package/dist/lib/empty-canvas.d.ts.map +1 -0
  140. package/dist/lib/empty-canvas.js +62 -0
  141. package/dist/lib/empty-chip.cjs +1 -0
  142. package/dist/lib/empty-chip.d.ts +4 -0
  143. package/dist/lib/empty-chip.d.ts.map +1 -0
  144. package/dist/lib/empty-chip.js +13 -0
  145. package/dist/lib/optical-center.cjs +1 -0
  146. package/dist/lib/optical-center.d.ts +12 -0
  147. package/dist/lib/optical-center.d.ts.map +1 -0
  148. package/dist/lib/optical-center.js +11 -0
  149. package/dist/lib/utils.cjs +1 -1
  150. package/dist/lib/utils.d.ts.map +1 -1
  151. package/dist/lib/utils.js +28 -5
  152. package/dist/list.cjs +1 -1
  153. package/dist/list.d.ts.map +1 -1
  154. package/dist/list.js +62 -58
  155. package/dist/map.cjs +1 -1
  156. package/dist/map.d.ts +60 -2
  157. package/dist/map.d.ts.map +1 -1
  158. package/dist/map.js +187 -164
  159. package/dist/media-empty.cjs +1 -0
  160. package/dist/media-empty.d.ts +72 -0
  161. package/dist/media-empty.d.ts.map +1 -0
  162. package/dist/media-empty.js +45 -0
  163. package/dist/menubar.cjs +1 -1
  164. package/dist/menubar.d.ts.map +1 -1
  165. package/dist/menubar.js +17 -20
  166. package/dist/navigation-menu.cjs +1 -1
  167. package/dist/navigation-menu.js +7 -7
  168. package/dist/pagination.cjs +1 -1
  169. package/dist/pagination.d.ts +130 -1
  170. package/dist/pagination.d.ts.map +1 -1
  171. package/dist/pagination.js +193 -102
  172. package/dist/progress.cjs +1 -1
  173. package/dist/progress.d.ts +2 -26
  174. package/dist/progress.d.ts.map +1 -1
  175. package/dist/progress.js +79 -118
  176. package/dist/scroll-area.cjs +1 -1
  177. package/dist/scroll-area.d.ts +15 -6
  178. package/dist/scroll-area.d.ts.map +1 -1
  179. package/dist/scroll-area.js +38 -36
  180. package/dist/select.cjs +2 -2
  181. package/dist/select.d.ts +13 -2
  182. package/dist/select.d.ts.map +1 -1
  183. package/dist/select.js +92 -87
  184. package/dist/separator.cjs +1 -1
  185. package/dist/separator.js +8 -8
  186. package/dist/sheet.cjs +1 -1
  187. package/dist/sheet.js +2 -2
  188. package/dist/skeleton.cjs +1 -1
  189. package/dist/skeleton.d.ts +38 -3
  190. package/dist/skeleton.d.ts.map +1 -1
  191. package/dist/skeleton.js +43 -20
  192. package/dist/sonner.cjs +1 -1
  193. package/dist/sonner.js +26 -26
  194. package/dist/stepper.cjs +1 -1
  195. package/dist/stepper.js +40 -40
  196. package/dist/table.cjs +1 -1
  197. package/dist/table.d.ts.map +1 -1
  198. package/dist/table.js +31 -28
  199. package/dist/tabs.cjs +1 -1
  200. package/dist/tabs.js +1 -1
  201. package/dist/text-reveal-motion.d.ts +10 -0
  202. package/dist/text-reveal-motion.d.ts.map +1 -1
  203. package/dist/textarea.cjs +1 -1
  204. package/dist/textarea.js +11 -11
  205. package/dist/toggle.cjs +1 -1
  206. package/dist/toggle.js +8 -8
  207. package/dist/tooltip.cjs +1 -1
  208. package/dist/tooltip.js +8 -8
  209. package/dist/typography-heading.cjs +1 -0
  210. package/dist/typography-heading.d.ts +129 -0
  211. package/dist/typography-heading.d.ts.map +1 -0
  212. package/dist/typography-heading.js +95 -0
  213. package/dist/typography-text.cjs +1 -0
  214. package/dist/typography-text.d.ts +127 -0
  215. package/dist/typography-text.d.ts.map +1 -0
  216. package/dist/typography-text.js +92 -0
  217. package/dist/typography.d.ts +13 -0
  218. package/dist/typography.d.ts.map +1 -1
  219. package/package.json +35 -7
  220. package/src/blocks/empty-state.tsx +412 -0
  221. package/src/blocks/input-list.tsx +66 -36
  222. package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
  223. package/src/blocks/sidebar.tsx +25 -26
  224. package/src/components/accordion.tsx +82 -27
  225. package/src/components/alert-dialog.tsx +2 -2
  226. package/src/components/alert.tsx +27 -13
  227. package/src/components/avatar.tsx +1 -1
  228. package/src/components/badge.tsx +8 -4
  229. package/src/components/breadcrumb.tsx +1 -1
  230. package/src/components/button-group.tsx +112 -0
  231. package/src/components/button.tsx +4 -4
  232. package/src/components/calendar.tsx +5 -6
  233. package/src/components/callout.tsx +48 -15
  234. package/src/components/card.tsx +89 -19
  235. package/src/components/chart-empty.tsx +116 -0
  236. package/src/components/chart.tsx +103 -32
  237. package/src/components/chip.tsx +88 -13
  238. package/src/components/combobox.tsx +12 -10
  239. package/src/components/command.tsx +64 -13
  240. package/src/components/context-menu.tsx +6 -9
  241. package/src/components/data-table.tsx +135 -20
  242. package/src/components/date-picker.tsx +18 -7
  243. package/src/components/description.tsx +1 -1
  244. package/src/components/dialog.tsx +2 -2
  245. package/src/components/drawer.tsx +2 -5
  246. package/src/components/dropdown-menu.tsx +8 -11
  247. package/src/components/field.tsx +89 -16
  248. package/src/components/global-layout.tsx +210 -39
  249. package/src/components/grid.tsx +130 -0
  250. package/src/components/header.tsx +13 -0
  251. package/src/components/hover-card.tsx +1 -1
  252. package/src/components/input-chip.tsx +1 -1
  253. package/src/components/input-group.tsx +1 -1
  254. package/src/components/input-otp.tsx +1 -1
  255. package/src/components/input-password.tsx +24 -12
  256. package/src/components/input.tsx +1 -1
  257. package/src/components/label.tsx +10 -13
  258. package/src/components/list.tsx +13 -9
  259. package/src/components/map.tsx +101 -5
  260. package/src/components/media-empty.tsx +156 -0
  261. package/src/components/menubar.tsx +7 -10
  262. package/src/components/navigation-menu.tsx +1 -1
  263. package/src/components/pagination.tsx +286 -1
  264. package/src/components/progress.tsx +35 -113
  265. package/src/components/scroll-area.tsx +23 -10
  266. package/src/components/select.tsx +35 -10
  267. package/src/components/separator.tsx +1 -1
  268. package/src/components/sheet.tsx +2 -2
  269. package/src/components/skeleton.tsx +78 -7
  270. package/src/components/sonner.tsx +2 -2
  271. package/src/components/stepper.tsx +3 -3
  272. package/src/components/table.tsx +6 -3
  273. package/src/components/tabs.tsx +1 -1
  274. package/src/components/text-reveal-motion.tsx +10 -0
  275. package/src/components/textarea.tsx +1 -1
  276. package/src/components/toggle.tsx +1 -1
  277. package/src/components/tooltip.tsx +1 -1
  278. package/src/components/typography-heading.tsx +253 -0
  279. package/src/components/typography-text.tsx +250 -0
  280. package/src/components/typography.tsx +13 -0
  281. package/src/hooks/use-delayed-pending.ts +60 -0
  282. package/src/index.ts +11 -1
  283. package/src/lib/block-illustration.tsx +88 -0
  284. package/src/lib/empty-canvas.tsx +128 -0
  285. package/src/lib/empty-chip.ts +24 -0
  286. package/src/lib/optical-center.tsx +45 -0
  287. package/src/lib/utils.ts +26 -0
  288. package/dist/blocks/progress-screen.cjs +0 -1
  289. 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 H, ChevronRight as q, ChevronLeft as A } from "@brightlocal/icons";
4
+ import { cva as D } 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 k } from "@brightlocal/ui-components/hooks/use-breakpoint";
7
+ function J({
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 = k("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 M = D(
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 P({
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
+ P.displayName = "Pagination";
109
+ function K({
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(M({ 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 j = 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(A, {})
150
150
  }
151
151
  ));
152
- P.displayName = "PaginationPrevious";
153
- const w = c.forwardRef(
154
- ({ className: i, disabled: a, ariaLabel: e, ...n }, l) => /* @__PURE__ */ s(
155
- p,
152
+ j.displayName = "PaginationPrevious";
153
+ const R = 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(q, {})
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
+ R.displayName = "PaginationNext";
169
+ const C = 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
- R.displayName = "PaginationLink";
184
- function T({
183
+ C.displayName = "PaginationLink";
184
+ function O({
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(M({ 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(H, {}),
198
+ /* @__PURE__ */ a("span", { className: "sr-only", children: n })
199
199
  ]
200
200
  }
201
201
  );
202
202
  }
203
+ const Q = 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: L,
217
+ ellipsisSrLabel: $,
218
+ trackingEl: B,
219
+ trackingLabel: G,
220
+ ...V
221
+ }, F) => {
222
+ const T = J({ page: n, totalPages: t }), E = k("sm"), p = (() => {
223
+ if (E || 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), w = r === 0 ? 0 : (h - 1) * e + 1, N = Math.min(h * e, r);
225
+ return u ? u({
226
+ page: h,
227
+ totalPages: t,
228
+ from: w,
229
+ to: N,
230
+ total: r
231
+ }) : r === 0 ? null : `Showing ${w} to ${N} of ${r} results`;
232
+ })(), x = t > 1;
233
+ return p == null && !x ? null : /* @__PURE__ */ y(
234
+ "div",
235
+ {
236
+ ref: F,
237
+ className: d(
238
+ "flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",
239
+ p == null ? "justify-center" : "justify-between",
240
+ i
241
+ ),
242
+ "data-hook": s,
243
+ "data-slot": "pagination-controls",
244
+ "data-tracking-el": B || "pagination-controls",
245
+ "data-tracking-label": G,
246
+ ...V,
247
+ children: [
248
+ p != null && /* @__PURE__ */ a(
249
+ "span",
250
+ {
251
+ className: "text-body-sm text-muted-foreground whitespace-nowrap",
252
+ "data-slot": "pagination-caption",
253
+ children: p
254
+ }
255
+ ),
256
+ x && /* @__PURE__ */ a(
257
+ P,
258
+ {
259
+ ariaLabel: b,
260
+ className: d(p != null && "mx-0 w-auto grow justify-end"),
261
+ dataHook: `${s}-nav`,
262
+ children: /* @__PURE__ */ a(K, { children: T.map((c, h) => c === "previous" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
263
+ j,
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
+ R,
271
+ {
272
+ ariaLabel: l,
273
+ disabled: n >= t,
274
+ onClick: () => o(n + 1)
275
+ }
276
+ ) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(O, { srLabel: $ }) }, `ellipsis-${h}`) : /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
277
+ C,
278
+ {
279
+ ariaLabel: L,
280
+ isActive: c === n,
281
+ page: c,
282
+ onClick: () => o(c)
283
+ }
284
+ ) }, c)) })
285
+ }
286
+ )
287
+ ]
288
+ }
289
+ );
290
+ }
291
+ );
292
+ Q.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,
209
- R as PaginationLink,
210
- w as PaginationNext,
211
- P as PaginationPrevious,
212
- I as usePagination
294
+ P as Pagination,
295
+ v as PaginationButton,
296
+ K as PaginationContent,
297
+ Q as PaginationControls,
298
+ O as PaginationEllipsis,
299
+ m as PaginationItem,
300
+ C as PaginationLink,
301
+ R as PaginationNext,
302
+ j as PaginationPrevious,
303
+ J 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"}