@brightlocal/ui-components 3.0.0 → 3.2.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 (235) hide show
  1. package/README.md +7 -1
  2. package/component-meta.json +749 -53
  3. package/deprecations.json +114 -4
  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.d.ts +32 -3
  10. package/dist/alert-dialog.d.ts.map +1 -1
  11. package/dist/alert-dialog.js +61 -58
  12. package/dist/alert.cjs +1 -1
  13. package/dist/alert.d.ts.map +1 -1
  14. package/dist/alert.js +58 -57
  15. package/dist/badge.cjs +1 -1
  16. package/dist/badge.d.ts +9 -0
  17. package/dist/badge.d.ts.map +1 -1
  18. package/dist/badge.js +50 -30
  19. package/dist/banner.cjs +1 -0
  20. package/dist/banner.d.ts +81 -0
  21. package/dist/banner.d.ts.map +1 -0
  22. package/dist/banner.js +176 -0
  23. package/dist/blocks/empty-state.cjs +1 -1
  24. package/dist/blocks/empty-state.d.ts +4 -3
  25. package/dist/blocks/empty-state.d.ts.map +1 -1
  26. package/dist/blocks/empty-state.js +50 -57
  27. package/dist/blocks/progress-state.d.ts +2 -2
  28. package/dist/blocks/sidebar.cjs +1 -1
  29. package/dist/blocks/sidebar.d.ts +17 -0
  30. package/dist/blocks/sidebar.d.ts.map +1 -1
  31. package/dist/blocks/sidebar.js +8 -2
  32. package/dist/brand-illustration-motif.d.ts +1 -1
  33. package/dist/button-group.cjs +1 -0
  34. package/dist/button-group.d.ts +36 -0
  35. package/dist/button-group.d.ts.map +1 -0
  36. package/dist/button-group.js +47 -0
  37. package/dist/button.cjs +1 -1
  38. package/dist/button.js +1 -1
  39. package/dist/card.cjs +1 -1
  40. package/dist/card.d.ts +105 -7
  41. package/dist/card.d.ts.map +1 -1
  42. package/dist/card.js +198 -101
  43. package/dist/chart.cjs +3 -3
  44. package/dist/chart.d.ts +270 -24
  45. package/dist/chart.d.ts.map +1 -1
  46. package/dist/chart.js +497 -322
  47. package/dist/checkbox.cjs +1 -1
  48. package/dist/checkbox.d.ts +1 -1
  49. package/dist/checkbox.d.ts.map +1 -1
  50. package/dist/checkbox.js +2 -1
  51. package/dist/chip.cjs +1 -1
  52. package/dist/chip.d.ts +38 -4
  53. package/dist/chip.d.ts.map +1 -1
  54. package/dist/chip.js +95 -81
  55. package/dist/combobox.cjs +1 -1
  56. package/dist/combobox.js +2 -2
  57. package/dist/command.cjs +1 -1
  58. package/dist/command.d.ts +23 -1
  59. package/dist/command.d.ts.map +1 -1
  60. package/dist/command.js +251 -225
  61. package/dist/data-table.cjs +1 -1
  62. package/dist/data-table.d.ts +201 -23
  63. package/dist/data-table.d.ts.map +1 -1
  64. package/dist/data-table.js +712 -568
  65. package/dist/date-picker.cjs +1 -1
  66. package/dist/date-picker.d.ts +13 -5
  67. package/dist/date-picker.d.ts.map +1 -1
  68. package/dist/date-picker.js +54 -53
  69. package/dist/field.cjs +1 -1
  70. package/dist/field.d.ts +8 -1
  71. package/dist/field.d.ts.map +1 -1
  72. package/dist/field.js +79 -52
  73. package/dist/global-layout.cjs +1 -1
  74. package/dist/global-layout.d.ts +105 -13
  75. package/dist/global-layout.d.ts.map +1 -1
  76. package/dist/global-layout.js +146 -129
  77. package/dist/grid.d.ts +26 -3
  78. package/dist/grid.d.ts.map +1 -1
  79. package/dist/hooks/use-breakpoint.cjs +1 -1
  80. package/dist/hooks/use-breakpoint.d.ts +1 -1
  81. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  82. package/dist/hooks/use-breakpoint.js +1 -0
  83. package/dist/hooks/use-mobile.cjs +1 -0
  84. package/dist/hooks/use-mobile.js +8 -0
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.d.ts +6 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +594 -553
  89. package/dist/info-tooltip.cjs +1 -0
  90. package/dist/info-tooltip.d.ts +39 -0
  91. package/dist/info-tooltip.d.ts.map +1 -0
  92. package/dist/info-tooltip.js +41 -0
  93. package/dist/input-chip.cjs +1 -1
  94. package/dist/input-chip.js +1 -1
  95. package/dist/input-group.cjs +1 -1
  96. package/dist/input-group.d.ts +33 -2
  97. package/dist/input-group.d.ts.map +1 -1
  98. package/dist/input-group.js +167 -54
  99. package/dist/input-otp.cjs +1 -1
  100. package/dist/input-otp.js +9 -9
  101. package/dist/input-password.cjs +1 -1
  102. package/dist/input-password.d.ts +45 -15
  103. package/dist/input-password.d.ts.map +1 -1
  104. package/dist/input-password.js +31 -30
  105. package/dist/input.cjs +1 -1
  106. package/dist/input.js +10 -10
  107. package/dist/lib/block-illustration.cjs +1 -1
  108. package/dist/lib/block-illustration.d.ts +4 -1
  109. package/dist/lib/block-illustration.d.ts.map +1 -1
  110. package/dist/lib/block-illustration.js +12 -11
  111. package/dist/lib/empty-chip.cjs +1 -0
  112. package/dist/lib/empty-chip.d.ts +4 -0
  113. package/dist/lib/empty-chip.d.ts.map +1 -0
  114. package/dist/lib/empty-chip.js +13 -0
  115. package/dist/lib/utils.cjs +1 -1
  116. package/dist/lib/utils.d.ts.map +1 -1
  117. package/dist/lib/utils.js +4 -3
  118. package/dist/list.cjs +1 -1
  119. package/dist/list.js +1 -1
  120. package/dist/multi-select-filter.cjs +1 -0
  121. package/dist/multi-select-filter.d.ts +178 -0
  122. package/dist/multi-select-filter.d.ts.map +1 -0
  123. package/dist/multi-select-filter.js +463 -0
  124. package/dist/pagination.cjs +1 -1
  125. package/dist/pagination.d.ts +3 -0
  126. package/dist/pagination.d.ts.map +1 -1
  127. package/dist/pagination.js +57 -57
  128. package/dist/progress.cjs +1 -1
  129. package/dist/progress.d.ts +123 -16
  130. package/dist/progress.d.ts.map +1 -1
  131. package/dist/progress.js +89 -75
  132. package/dist/rating.cjs +1 -1
  133. package/dist/rating.js +18 -18
  134. package/dist/relative-date.cjs +1 -0
  135. package/dist/relative-date.d.ts +65 -0
  136. package/dist/relative-date.d.ts.map +1 -0
  137. package/dist/relative-date.js +128 -0
  138. package/dist/scroll-area.cjs +1 -1
  139. package/dist/scroll-area.d.ts +15 -6
  140. package/dist/scroll-area.d.ts.map +1 -1
  141. package/dist/scroll-area.js +38 -36
  142. package/dist/select.cjs +2 -2
  143. package/dist/select.d.ts +24 -3
  144. package/dist/select.d.ts.map +1 -1
  145. package/dist/select.js +130 -110
  146. package/dist/sheet.cjs +1 -1
  147. package/dist/sheet.d.ts +78 -2
  148. package/dist/sheet.d.ts.map +1 -1
  149. package/dist/sheet.js +192 -85
  150. package/dist/single-select-filter.cjs +1 -0
  151. package/dist/single-select-filter.d.ts +81 -0
  152. package/dist/single-select-filter.d.ts.map +1 -0
  153. package/dist/single-select-filter.js +226 -0
  154. package/dist/sonner.cjs +1 -1
  155. package/dist/sonner.d.ts.map +1 -1
  156. package/dist/sonner.js +22 -22
  157. package/dist/split-layout.cjs +1 -1
  158. package/dist/split-layout.d.ts +1 -1
  159. package/dist/split-layout.js +13 -13
  160. package/dist/table.cjs +1 -1
  161. package/dist/table.d.ts +45 -4
  162. package/dist/table.d.ts.map +1 -1
  163. package/dist/table.js +90 -73
  164. package/dist/tabs.cjs +1 -1
  165. package/dist/tabs.d.ts +12 -1
  166. package/dist/tabs.d.ts.map +1 -1
  167. package/dist/tabs.js +148 -126
  168. package/dist/textarea.cjs +1 -1
  169. package/dist/textarea.js +1 -1
  170. package/dist/tooltip.cjs +1 -1
  171. package/dist/tooltip.d.ts +38 -36
  172. package/dist/tooltip.d.ts.map +1 -1
  173. package/dist/tooltip.js +262 -73
  174. package/dist/typography-heading.cjs +1 -1
  175. package/dist/typography-heading.d.ts +13 -0
  176. package/dist/typography-heading.d.ts.map +1 -1
  177. package/dist/typography-heading.js +32 -21
  178. package/dist/typography-text.cjs +1 -1
  179. package/dist/typography-text.d.ts +15 -2
  180. package/dist/typography-text.d.ts.map +1 -1
  181. package/dist/typography-text.js +35 -24
  182. package/dist/typography.d.ts +1 -1
  183. package/package.json +5 -6
  184. package/src/blocks/empty-state.tsx +17 -24
  185. package/src/blocks/progress-state.tsx +2 -2
  186. package/src/blocks/sidebar.tsx +26 -2
  187. package/src/components/accordion.tsx +82 -27
  188. package/src/components/alert-dialog.tsx +50 -5
  189. package/src/components/alert.tsx +16 -8
  190. package/src/components/badge.tsx +40 -3
  191. package/src/components/banner.tsx +288 -0
  192. package/src/components/brand-illustration-motif.tsx +1 -1
  193. package/src/components/button-group.tsx +112 -0
  194. package/src/components/button.tsx +1 -1
  195. package/src/components/card.tsx +249 -27
  196. package/src/components/chart.tsx +586 -53
  197. package/src/components/checkbox.tsx +1 -1
  198. package/src/components/chip.tsx +83 -10
  199. package/src/components/combobox.tsx +2 -2
  200. package/src/components/command.tsx +56 -4
  201. package/src/components/data-table.tsx +842 -199
  202. package/src/components/date-picker.tsx +18 -7
  203. package/src/components/field.tsx +81 -12
  204. package/src/components/global-layout.tsx +176 -38
  205. package/src/components/grid.tsx +34 -3
  206. package/src/components/info-tooltip.tsx +94 -0
  207. package/src/components/input-chip.tsx +1 -1
  208. package/src/components/input-group.tsx +246 -11
  209. package/src/components/input-otp.tsx +1 -1
  210. package/src/components/input-password.tsx +56 -22
  211. package/src/components/input.tsx +1 -1
  212. package/src/components/list.tsx +1 -1
  213. package/src/components/multi-select-filter.tsx +912 -0
  214. package/src/components/pagination.tsx +10 -3
  215. package/src/components/progress.tsx +190 -31
  216. package/src/components/rating.tsx +1 -1
  217. package/src/components/relative-date.tsx +230 -0
  218. package/src/components/scroll-area.tsx +23 -10
  219. package/src/components/select.tsx +65 -11
  220. package/src/components/sheet.tsx +240 -4
  221. package/src/components/single-select-filter.tsx +443 -0
  222. package/src/components/sonner.tsx +16 -5
  223. package/src/components/split-layout.tsx +2 -2
  224. package/src/components/table.tsx +71 -11
  225. package/src/components/tabs.tsx +93 -46
  226. package/src/components/textarea.tsx +1 -1
  227. package/src/components/tooltip.tsx +440 -68
  228. package/src/components/typography-heading.tsx +24 -0
  229. package/src/components/typography-text.tsx +27 -3
  230. package/src/components/typography.tsx +1 -1
  231. package/src/hooks/use-breakpoint.ts +2 -1
  232. package/src/index.ts +6 -0
  233. package/src/lib/block-illustration.tsx +5 -1
  234. package/src/lib/empty-chip.ts +24 -0
  235. package/src/lib/utils.ts +1 -0
@@ -190,6 +190,9 @@ interface PaginationControlsProps extends Omit<React.ComponentProps<"div">, "chi
190
190
  * Controlled: the consumer holds `page` and updates it from `onPageChange`.
191
191
  * Pass `totalItems` + `pageSize` to get the results caption; the caption sits
192
192
  * on the left with the nav pushed right, and without one the nav centres.
193
+ * Below the `sm` viewport breakpoint the caption is removed and the nav
194
+ * centres, and from `sm` up the bar wraps inside narrow containers instead of
195
+ * overflowing — the same responsive rules as `DataTablePagination` (DS-998).
193
196
  *
194
197
  * There is nothing to navigate on a single page, so the nav hides itself at
195
198
  * `totalPages <= 1` and the component renders nothing at all when the caption
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/components/pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,KAAK,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,UAAU,GACX,EAAE,mBAAmB,GAAG,kBAAkB,EAAE,CA4C5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CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC1E;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,QAAA,MAAM,kBAAkB,6GAiJvB,CAAC;AAIF,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAEnC,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC7B,CAAC"}
@@ -1,14 +1,14 @@
1
1
  import { jsx as a, jsxs as y } from "react/jsx-runtime";
2
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";
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 A } from "@brightlocal/ui-components/hooks/use-breakpoint";
7
- function D({
6
+ import { useIsBelowBreakpoint as k } from "@brightlocal/ui-components/hooks/use-breakpoint";
7
+ function J({
8
8
  page: i,
9
9
  totalPages: n
10
10
  }) {
11
- const o = A("sm") ? 5 : 7;
11
+ const o = k("sm") ? 5 : 7;
12
12
  return f.useMemo(() => {
13
13
  const r = Math.max(5, o), e = [];
14
14
  if (e.push("previous"), n <= r)
@@ -34,7 +34,7 @@ function D({
34
34
  return e.push("next"), e;
35
35
  }, [i, n, o]);
36
36
  }
37
- const w = q(
37
+ const M = D(
38
38
  [
39
39
  // Base styles - circular button
40
40
  "inline-flex items-center justify-center",
@@ -83,7 +83,7 @@ const w = q(
83
83
  }
84
84
  }
85
85
  );
86
- function M({
86
+ function P({
87
87
  className: i,
88
88
  dataHook: n,
89
89
  trackingEl: t,
@@ -105,8 +105,8 @@ function M({
105
105
  }
106
106
  );
107
107
  }
108
- M.displayName = "Pagination";
109
- function J({
108
+ P.displayName = "Pagination";
109
+ function K({
110
110
  className: i,
111
111
  ...n
112
112
  }) {
@@ -127,7 +127,7 @@ const v = f.forwardRef(({ className: i, variant: n, isActive: t, children: o, ..
127
127
  {
128
128
  ref: r,
129
129
  "aria-current": t ? "page" : void 0,
130
- className: d(w({ variant: n }), i),
130
+ className: d(M({ variant: n }), i),
131
131
  "data-active": t,
132
132
  "data-slot": "pagination-button",
133
133
  type: "button",
@@ -136,7 +136,7 @@ const v = f.forwardRef(({ className: i, variant: n, isActive: t, children: o, ..
136
136
  }
137
137
  ));
138
138
  v.displayName = "PaginationButton";
139
- const P = f.forwardRef(({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
139
+ const j = f.forwardRef(({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
140
140
  v,
141
141
  {
142
142
  ref: s,
@@ -146,11 +146,11 @@ const P = f.forwardRef(({ className: i, disabled: n, ariaLabel: t, ...o }, s) =>
146
146
  disabled: n,
147
147
  variant: "previous",
148
148
  ...o,
149
- children: /* @__PURE__ */ a(H, {})
149
+ children: /* @__PURE__ */ a(A, {})
150
150
  }
151
151
  ));
152
- P.displayName = "PaginationPrevious";
153
- const j = f.forwardRef(
152
+ j.displayName = "PaginationPrevious";
153
+ const R = f.forwardRef(
154
154
  ({ className: i, disabled: n, ariaLabel: t, ...o }, s) => /* @__PURE__ */ a(
155
155
  v,
156
156
  {
@@ -161,12 +161,12 @@ const j = f.forwardRef(
161
161
  disabled: n,
162
162
  variant: "next",
163
163
  ...o,
164
- children: /* @__PURE__ */ a(E, {})
164
+ children: /* @__PURE__ */ a(q, {})
165
165
  }
166
166
  )
167
167
  );
168
- j.displayName = "PaginationNext";
169
- const R = f.forwardRef(
168
+ R.displayName = "PaginationNext";
169
+ const C = f.forwardRef(
170
170
  ({ className: i, page: n, isActive: t, ariaLabel: o, ...s }, r) => /* @__PURE__ */ a(
171
171
  v,
172
172
  {
@@ -180,8 +180,8 @@ const R = f.forwardRef(
180
180
  }
181
181
  )
182
182
  );
183
- R.displayName = "PaginationLink";
184
- function K({
183
+ C.displayName = "PaginationLink";
184
+ function O({
185
185
  className: i,
186
186
  srLabel: n = "More pages",
187
187
  ...t
@@ -190,17 +190,17 @@ function K({
190
190
  "span",
191
191
  {
192
192
  "aria-hidden": "true",
193
- className: d(w({ variant: "ellipsis" }), i),
193
+ className: d(M({ variant: "ellipsis" }), i),
194
194
  "data-slot": "pagination-ellipsis",
195
195
  ...t,
196
196
  children: [
197
- /* @__PURE__ */ a(T, {}),
197
+ /* @__PURE__ */ a(H, {}),
198
198
  /* @__PURE__ */ a("span", { className: "sr-only", children: n })
199
199
  ]
200
200
  }
201
201
  );
202
202
  }
203
- const O = f.forwardRef(
203
+ const Q = f.forwardRef(
204
204
  ({
205
205
  className: i,
206
206
  page: n,
@@ -213,70 +213,70 @@ const O = f.forwardRef(
213
213
  ariaLabel: b,
214
214
  prevAriaLabel: g,
215
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);
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
225
  return u ? u({
226
226
  page: h,
227
227
  totalPages: t,
228
- from: N,
229
- to: k,
228
+ from: w,
229
+ to: N,
230
230
  total: r
231
- }) : r === 0 ? null : `Showing ${N} to ${k} of ${r} results`;
231
+ }) : r === 0 ? null : `Showing ${w} to ${N} of ${r} results`;
232
232
  })(), x = t > 1;
233
233
  return p == null && !x ? null : /* @__PURE__ */ y(
234
234
  "div",
235
235
  {
236
- ref: V,
236
+ ref: F,
237
237
  className: d(
238
- "flex min-h-9 w-full items-center gap-4",
238
+ "flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",
239
239
  p == null ? "justify-center" : "justify-between",
240
240
  i
241
241
  ),
242
242
  "data-hook": s,
243
243
  "data-slot": "pagination-controls",
244
- "data-tracking-el": $ || "pagination-controls",
245
- "data-tracking-label": B,
246
- ...G,
244
+ "data-tracking-el": B || "pagination-controls",
245
+ "data-tracking-label": G,
246
+ ...V,
247
247
  children: [
248
248
  p != null && /* @__PURE__ */ a(
249
249
  "span",
250
250
  {
251
- className: "text-body-sm text-muted-foreground",
251
+ className: "text-body-sm text-muted-foreground whitespace-nowrap",
252
252
  "data-slot": "pagination-caption",
253
253
  children: p
254
254
  }
255
255
  ),
256
256
  x && /* @__PURE__ */ a(
257
- M,
257
+ P,
258
258
  {
259
259
  ariaLabel: b,
260
- className: d(p != null && "mx-0 w-auto justify-end"),
260
+ className: d(p != null && "mx-0 w-auto grow justify-end"),
261
261
  dataHook: `${s}-nav`,
262
- children: /* @__PURE__ */ a(J, { children: F.map((c, h) => c === "previous" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
263
- P,
262
+ children: /* @__PURE__ */ a(K, { children: T.map((c, h) => c === "previous" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
263
+ j,
264
264
  {
265
265
  ariaLabel: g,
266
266
  disabled: n <= 1,
267
267
  onClick: () => o(n - 1)
268
268
  }
269
269
  ) }, "previous") : c === "next" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
270
- j,
270
+ R,
271
271
  {
272
272
  ariaLabel: l,
273
273
  disabled: n >= t,
274
274
  onClick: () => o(n + 1)
275
275
  }
276
- ) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(K, { srLabel: L }) }, `ellipsis-${h}`) : /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
277
- R,
276
+ ) }, "next") : c === "ellipsis" ? /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(O, { srLabel: $ }) }, `ellipsis-${h}`) : /* @__PURE__ */ a(m, { children: /* @__PURE__ */ a(
277
+ C,
278
278
  {
279
- ariaLabel: C,
279
+ ariaLabel: L,
280
280
  isActive: c === n,
281
281
  page: c,
282
282
  onClick: () => o(c)
@@ -289,16 +289,16 @@ const O = f.forwardRef(
289
289
  );
290
290
  }
291
291
  );
292
- O.displayName = "PaginationControls";
292
+ Q.displayName = "PaginationControls";
293
293
  export {
294
- M as Pagination,
294
+ P as Pagination,
295
295
  v as PaginationButton,
296
- J as PaginationContent,
297
- O as PaginationControls,
298
- K as PaginationEllipsis,
296
+ K as PaginationContent,
297
+ Q as PaginationControls,
298
+ O as PaginationEllipsis,
299
299
  m as PaginationItem,
300
- R as PaginationLink,
301
- j as PaginationNext,
302
- P as PaginationPrevious,
303
- D as usePagination
300
+ C as PaginationLink,
301
+ R as PaginationNext,
302
+ j as PaginationPrevious,
303
+ J as usePagination
304
304
  };
package/dist/progress.cjs CHANGED
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),G=require("react"),H=require("@radix-ui/react-progress"),V=require("framer-motion"),i=require("@brightlocal/ui-components/lib/utils"),Y=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion"),F=require("./lib/motion.cjs");function N(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const a=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,a.get?a:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const j=N(G),P=N(H),R={sm:{text:"text-body-sm",bar:"h-2"},md:{text:"text-body",bar:"h-3"}},k={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"}},U="40%";function X(t,r,e){if(t==null)return"–";if(e==="%")return`${r>0?Math.min(100,Math.max(0,Math.round(t/r*100))):0}%`;const a=e?` ${e}`:"";return r>0?`${t} / ${r}${a}`:`${t}${a}`}const S=j.forwardRef(({className:t,value:r,max:e=100,dataHook:a,trackingEl:g,trackingLabel:M,ariaLabel:T="Progress",label:n,labelWidth:f=U,color:_="green",size:L="sm",showValue:c=!1,unit:O="%",valueFormatter:$,indicatorClassName:q,disabled:b,...E},I)=>{const m=j.useId(),o=n!=null&&n!=="",p=typeof n=="string"||typeof n=="number",h=o&&p,l=$??((A,C)=>X(A,C,O)),x=l(r,e),z=Y.usePrefersReducedMotion(),y=k[_]??k.green,d=R[L]??R.sm,u=f==="auto",D=o||c,w=Math.min(e,Math.max(0,r??0)),B=e>0?w/e*100:0,v=s.jsx(P.Root,{ref:I,"aria-label":h?void 0:T,"aria-labelledby":h?m:void 0,className:i.cn("relative w-full overflow-hidden rounded-full",D&&"min-w-0 flex-1",d.bar,y.track,!o&&!c&&b&&"opacity-50",t),"data-hook":a,"data-slot":"progress","data-tracking-el":g,"data-tracking-label":M,getValueLabel:()=>x,max:e,value:w,...E,children:s.jsx(P.Indicator,{asChild:!0,children:s.jsx(V.motion.div,{animate:{transform:`translateX(-${100-B}%)`},className:i.cn("h-full w-full flex-1",y.indicator,q),"data-slot":"progress-indicator",initial:!1,transition:z?{duration:0}:F.SPRING_GENTLE})})});return!o&&!c?v:s.jsxs("div",{className:i.cn("flex w-full items-center gap-2",b&&"opacity-50"),"data-slot":"progress-wrapper",children:[o&&s.jsx("div",{className:i.cn("text-foreground shrink-0 break-words",u&&"max-w-2/5",!p&&"flex items-center",d.text),"data-label-width":u?"auto":void 0,"data-slot":"progress-label",id:m,style:u?void 0:{width:f},children:n}),v,c&&s.jsxs("span",{className:i.cn("text-muted-foreground grid min-w-10 shrink-0 text-right tabular-nums",d.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:l(e,e)}),s.jsx("span",{"aria-hidden":"true",className:"invisible col-start-1 row-start-1","data-slot":"progress-value-sizer-min",children:l(0,e)}),s.jsx("span",{className:"col-start-1 row-start-1","data-slot":"progress-value-text",children:x})]})]})});S.displayName="Progress";exports.Progress=S;
@@ -20,32 +20,52 @@ type ProgressSize = "sm" | "md";
20
20
  */
21
21
  type ProgressLabelWidth = "auto" | "20%" | "30%" | "40%" | "50%";
22
22
  /**
23
- * Props for the Progress component.
23
+ * Formats the value shown beside the bar — and, through Radix's
24
+ * `getValueLabel`, the `aria-valuetext` screen readers announce — from the raw
25
+ * `value` and `max`. Receives `null` / `undefined` when the row has no value
26
+ * yet, so it picks its own placeholder (the built-in forms use `–`).
27
+ * @param value - Current value, or none.
28
+ * @param max - Maximum value (denominator).
29
+ * @example (value) => value?.toLocaleString() ?? "–"
24
30
  */
25
- interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Root> {
31
+ type ProgressValueFormatter = (value: number | null | undefined, max: number) => string;
32
+ /**
33
+ * A `label` that is rendered but cannot name the bar — an element such as a
34
+ * `Rating` or an icon (wrap several in a fragment). Always paired with
35
+ * `ariaLabel`. Text and numbers are not node labels: they name the bar
36
+ * themselves.
37
+ */
38
+ type ProgressNodeLabel = React.ReactElement;
39
+ /**
40
+ * Props shared by every Progress, whatever its label is.
41
+ */
42
+ interface ProgressBaseProps extends React.ComponentProps<typeof ProgressPrimitive.Root> {
26
43
  /**
27
44
  * Required data-hook attribute for testing and component identification
28
45
  */
29
46
  dataHook: string;
30
47
  /**
31
- * Optional tracking element identifier for analytics
48
+ * Current value, measured against `max`. Drives the fill, the value column
49
+ * and `aria-valuenow`; out-of-range values are clamped to `0–max` for the
50
+ * bar while the column prints the raw figure. Omit it (or pass `null`) for a
51
+ * placeholder row — the bar stays empty and the column shows `–`.
32
52
  */
33
- trackingEl?: string;
53
+ value?: number | null;
34
54
  /**
35
- * Optional tracking label for analytics
55
+ * Maximum value — the denominator for the fill and the displayed value. For
56
+ * a set of rows that share one scale (a review breakdown), pass the same
57
+ * `max` to every row.
58
+ * @default 100
36
59
  */
37
- trackingLabel?: string;
60
+ max?: number;
38
61
  /**
39
- * Accessible label for the progress bar for screen readers
40
- * @default "Progress"
62
+ * Optional tracking element identifier for analytics
41
63
  */
42
- ariaLabel?: string;
64
+ trackingEl?: string;
43
65
  /**
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.
66
+ * Optional tracking label for analytics
47
67
  */
48
- label?: string;
68
+ trackingLabel?: string;
49
69
  /**
50
70
  * Width of the label column: `"20%"` … `"50%"` of the row in 10% steps, or
51
71
  * `"auto"`. Every row that uses the same percentage starts its bar at the
@@ -79,6 +99,21 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
79
99
  * @default "%"
80
100
  */
81
101
  unit?: string;
102
+ /**
103
+ * Replaces the built-in `unit` forms with your own text for the value column,
104
+ * e.g. a raw count (`1,234`) or a remaining amount (`15 min left`). The same
105
+ * text is announced as the bar's `aria-valuetext` (unless you pass Radix's
106
+ * own `getValueLabel`). The column is sized to the wider of
107
+ * `valueFormatter(0, max)` and `valueFormatter(max, max)` so rows still end
108
+ * at the same x-position — the formatter's widest output must be at one of
109
+ * the two extremes, which holds for counts, percentages and remaining
110
+ * amounts. Pair
111
+ * it with a `value` / `max` that describe the real measurement — a count out
112
+ * of the largest count — rather than a precomputed percentage, so
113
+ * `aria-valuenow` stays honest.
114
+ * @example (value) => value?.toLocaleString() ?? "–"
115
+ */
116
+ valueFormatter?: ProgressValueFormatter;
82
117
  /**
83
118
  * Custom class name for the indicator (progress fill)
84
119
  * Use this to customize the color, e.g., "bg-chart-red"
@@ -90,6 +125,76 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
90
125
  */
91
126
  disabled?: boolean;
92
127
  }
128
+ /**
129
+ * The label column and the bar's accessible name, as a pair.
130
+ *
131
+ * A text `label` names the bar by itself (`aria-labelledby` points at it). Any
132
+ * other node — a Rating, an icon — is visible but cannot name anything, so it
133
+ * must come with an explicit `ariaLabel`; the union makes TypeScript insist on
134
+ * that pairing instead of letting a bar ship with an empty accessible name.
135
+ */
136
+ /**
137
+ * Text label: names the bar on its own, so `ariaLabel` is optional.
138
+ */
139
+ interface ProgressTextLabelProps {
140
+ /**
141
+ * Optional visible label text displayed to the left of the progress bar.
142
+ * Rendered inside a fixed-width column (see `labelWidth`); longer labels
143
+ * wrap onto further lines while the bar and value stay in their columns.
144
+ */
145
+ label?: string | number;
146
+ /**
147
+ * Accessible label for the progress bar for screen readers. Only used when
148
+ * there is no visible text `label`.
149
+ * @default "Progress"
150
+ */
151
+ ariaLabel?: string;
152
+ }
153
+ /**
154
+ * Element label: cannot name the bar, so `ariaLabel` is required.
155
+ */
156
+ interface ProgressNodeLabelProps {
157
+ /**
158
+ * Visible label rendered as an element — a `Rating`, an icon — in the same
159
+ * fixed-width column a text label uses (see `labelWidth`), vertically
160
+ * centred against the bar. Mark decorative icons `aria-hidden`.
161
+ */
162
+ label: ProgressNodeLabel;
163
+ /**
164
+ * Accessible name for the bar — required with a node label, because the
165
+ * node cannot name it: `aria-labelledby` would resolve to nothing.
166
+ * @example "4 star reviews"
167
+ */
168
+ ariaLabel: string;
169
+ }
170
+ /**
171
+ * What the component's JSX signature accepts: the label pair is a union, so an
172
+ * element `label` cannot be passed without its `ariaLabel`. Use this type when
173
+ * a wrapper should carry the same guarantee; `Omit`/`Pick` over the union would
174
+ * collapse it.
175
+ */
176
+ type ProgressStrictProps = ProgressBaseProps & (ProgressTextLabelProps | ProgressNodeLabelProps);
177
+ /**
178
+ * Props for the Progress component — the extendable, loose form (`interface X
179
+ * extends ProgressProps` keeps working). `label` is text, a number or an
180
+ * element; the element ⇒ `ariaLabel` pairing is enforced where it matters, on
181
+ * the component's own signature (`ProgressStrictProps`), so a value typed as
182
+ * `ProgressProps` with an element label must be narrowed before it is spread
183
+ * into `<Progress>`.
184
+ */
185
+ interface ProgressProps extends ProgressBaseProps {
186
+ /**
187
+ * Visible label: text (wraps inside the label column), a number, or an
188
+ * element such as a `Rating` or an icon — an element requires `ariaLabel`.
189
+ */
190
+ label?: string | number | ProgressNodeLabel;
191
+ /**
192
+ * Accessible label for the progress bar. Optional with a text label (the
193
+ * text names the bar); required with an element label.
194
+ * @default "Progress"
195
+ */
196
+ ariaLabel?: string;
197
+ }
93
198
  /**
94
199
  * Progress component for displaying loading states and task completion.
95
200
  * Built on Radix UI Progress primitive with Framer Motion animation.
@@ -98,9 +203,11 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
98
203
  * a fixed-width label column, the bar filling the remaining space, and a
99
204
  * right-aligned value column sized to the widest value it can show — so rows
100
205
  * stacked in a card share the same bar start position and width, even when
101
- * a label wraps onto two lines.
206
+ * a label wraps onto two lines. The label may be text or any node (a Rating,
207
+ * an icon — then `ariaLabel` is required), and `valueFormatter` replaces the
208
+ * built-in percentage / fraction forms with any text.
102
209
  */
103
- declare const Progress: React.ForwardRefExoticComponent<Omit<ProgressProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
210
+ declare const Progress: React.ForwardRefExoticComponent<(Omit<ProgressBaseProps & ProgressTextLabelProps, "ref"> | Omit<ProgressBaseProps & ProgressNodeLabelProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
104
211
  export { Progress };
105
- export type { ProgressProps, ProgressColor, ProgressSize, ProgressLabelWidth };
212
+ export type { ProgressProps, ProgressStrictProps, ProgressBaseProps, ProgressColor, ProgressSize, ProgressLabelWidth, ProgressValueFormatter, ProgressNodeLabel, };
106
213
  //# 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;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,IAA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