@brightlocal/ui-components 2.20.0 → 2.22.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 (66) hide show
  1. package/AI_USAGE.md +2 -0
  2. package/README.md +26 -13
  3. package/component-meta.json +41 -14
  4. package/dist/blocks/data-table.cjs +1 -1
  5. package/dist/blocks/data-table.d.ts +35 -3
  6. package/dist/blocks/data-table.d.ts.map +1 -1
  7. package/dist/blocks/data-table.js +178 -154
  8. package/dist/blocks/sidebar.cjs +1 -1
  9. package/dist/blocks/sidebar.d.ts +2 -2
  10. package/dist/blocks/sidebar.js +18 -18
  11. package/dist/breadcrumb.cjs +1 -1
  12. package/dist/breadcrumb.d.ts +1 -1
  13. package/dist/breadcrumb.d.ts.map +1 -1
  14. package/dist/breadcrumb.js +9 -6
  15. package/dist/button.cjs +1 -1
  16. package/dist/button.d.ts.map +1 -1
  17. package/dist/button.js +12 -12
  18. package/dist/hover-card.cjs +1 -1
  19. package/dist/hover-card.d.ts.map +1 -1
  20. package/dist/hover-card.js +45 -45
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +69 -68
  23. package/dist/lib/utils.cjs +1 -1
  24. package/dist/lib/utils.d.ts +1 -0
  25. package/dist/lib/utils.d.ts.map +1 -1
  26. package/dist/lib/utils.js +7 -5
  27. package/dist/logo.cjs +1 -1
  28. package/dist/logo.d.ts +1 -1
  29. package/dist/logo.js +2 -2
  30. package/dist/navigation-menu.cjs +1 -1
  31. package/dist/navigation-menu.d.ts +17 -0
  32. package/dist/navigation-menu.d.ts.map +1 -1
  33. package/dist/navigation-menu.js +120 -90
  34. package/dist/pagination.cjs +1 -1
  35. package/dist/pagination.d.ts +12 -8
  36. package/dist/pagination.d.ts.map +1 -1
  37. package/dist/pagination.js +117 -113
  38. package/dist/progress.cjs +1 -1
  39. package/dist/progress.d.ts +28 -2
  40. package/dist/progress.d.ts.map +1 -1
  41. package/dist/progress.js +90 -49
  42. package/dist/skeleton.cjs +1 -1
  43. package/dist/skeleton.js +1 -1
  44. package/dist/sonner.d.ts +1 -1
  45. package/dist/table.cjs +1 -1
  46. package/dist/table.d.ts +22 -2
  47. package/dist/table.d.ts.map +1 -1
  48. package/dist/table.js +57 -43
  49. package/dist/tooltip.cjs +1 -1
  50. package/dist/tooltip.d.ts.map +1 -1
  51. package/dist/tooltip.js +36 -36
  52. package/package.json +7 -3
  53. package/src/blocks/data-table.tsx +56 -4
  54. package/src/blocks/sidebar.tsx +5 -5
  55. package/src/components/breadcrumb.tsx +6 -3
  56. package/src/components/button.tsx +7 -1
  57. package/src/components/hover-card.tsx +6 -3
  58. package/src/components/logo.tsx +3 -3
  59. package/src/components/navigation-menu.tsx +113 -32
  60. package/src/components/pagination.tsx +47 -67
  61. package/src/components/progress.tsx +118 -14
  62. package/src/components/skeleton.tsx +1 -1
  63. package/src/components/sonner.tsx +1 -1
  64. package/src/components/table.tsx +44 -7
  65. package/src/components/tooltip.tsx +8 -5
  66. package/src/lib/utils.ts +3 -0
@@ -1,48 +1,47 @@
1
- import { jsx as o, jsxs as h } from "react/jsx-runtime";
2
- import * as l from "react";
3
- import { MoreHorizontal as v, ChevronRight as x, ChevronLeft as b } from "@brightlocal/icons";
4
- import { cva as N } from "class-variance-authority";
5
- import { cn as f } from "@brightlocal/ui-components/lib/utils";
6
- function G({
7
- page: t,
8
- totalPages: i,
9
- siblingCount: n = 1,
10
- boundaryCount: a = 1
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";
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({
8
+ page: i,
9
+ totalPages: a
11
10
  }) {
12
- return l.useMemo(() => {
13
- const r = [];
14
- r.push("previous");
15
- const c = Math.max(t - n, a + 1), p = Math.min(
16
- t + n,
17
- i - a
18
- ), g = c > a + 2, m = p < i - a - 1;
19
- for (let e = 1; e <= Math.min(a, i); e++)
20
- r.push(e);
21
- if (g)
22
- r.push("ellipsis");
23
- else if (a + 1 < c)
24
- for (let e = a + 1; e < c; e++)
25
- r.push(e);
26
- for (let e = c; e <= p; e++)
27
- e > a && e <= i - a && r.push(e);
28
- if (m)
29
- r.push("ellipsis");
30
- else if (p < i - a)
31
- for (let e = p + 1; e < i - a + 1; e++)
32
- r.push(e);
33
- for (let e = Math.max(i - a + 1, a + 1); e <= i; e++)
34
- e > a && r.push(e);
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);
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);
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);
32
+ }
33
+ }
35
34
  return r.push("next"), r;
36
- }, [t, i, n, a]);
35
+ }, [i, a, n]);
37
36
  }
38
- const u = N(
37
+ const g = y(
39
38
  [
40
39
  // Base styles - circular button
41
40
  "inline-flex items-center justify-center",
42
41
  "h-9 w-9",
43
42
  "rounded-full",
44
43
  "text-sm font-medium",
45
- "transition-colors",
44
+ "transition-colors duration-200 ease-out",
46
45
  "focus-visible:outline-none focus-visible:shadow-default"
47
46
  ],
48
47
  {
@@ -71,7 +70,12 @@ const u = N(
71
70
  // Disabled state
72
71
  "aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"
73
72
  ],
74
- ellipsis: ["cursor-default", "text-foreground", "pointer-events-none"]
73
+ ellipsis: [
74
+ "relative",
75
+ "cursor-default",
76
+ "text-foreground",
77
+ "pointer-events-none"
78
+ ]
75
79
  }
76
80
  },
77
81
  defaultVariants: {
@@ -80,130 +84,130 @@ const u = N(
80
84
  }
81
85
  );
82
86
  function k({
83
- className: t,
84
- dataHook: i,
85
- trackingEl: n,
86
- trackingLabel: a,
87
- ariaLabel: s,
88
- ...r
87
+ className: i,
88
+ dataHook: a,
89
+ trackingEl: e,
90
+ trackingLabel: n,
91
+ ariaLabel: l,
92
+ ...t
89
93
  }) {
90
- return /* @__PURE__ */ o(
94
+ return /* @__PURE__ */ s(
91
95
  "nav",
92
96
  {
93
- "aria-label": s ?? "Pagination",
94
- className: f("mx-auto flex w-full justify-center", t),
95
- "data-hook": i,
97
+ "aria-label": l ?? "Pagination",
98
+ className: d("mx-auto flex w-full justify-center", i),
99
+ "data-hook": a,
96
100
  "data-slot": "pagination",
97
- "data-tracking-el": n || "pagination",
98
- "data-tracking-label": a,
101
+ "data-tracking-el": e || "pagination",
102
+ "data-tracking-label": n,
99
103
  role: "navigation",
100
- ...r
104
+ ...t
101
105
  }
102
106
  );
103
107
  }
104
108
  k.displayName = "Pagination";
105
- function L({
106
- className: t,
107
- ...i
109
+ function V({
110
+ className: i,
111
+ ...a
108
112
  }) {
109
- return /* @__PURE__ */ o(
113
+ return /* @__PURE__ */ s(
110
114
  "ul",
111
115
  {
112
- className: f("flex flex-row items-center gap-2", t),
116
+ className: d("flex flex-row items-center gap-2", i),
113
117
  "data-slot": "pagination-content",
114
- ...i
118
+ ...a
115
119
  }
116
120
  );
117
121
  }
118
- function S(t) {
119
- return /* @__PURE__ */ o("li", { "data-slot": "pagination-item", ...t });
122
+ function L(i) {
123
+ return /* @__PURE__ */ s("li", { "data-slot": "pagination-item", ...i });
120
124
  }
121
- const d = l.forwardRef(({ className: t, variant: i, isActive: n, children: a, ...s }, r) => /* @__PURE__ */ o(
125
+ const p = c.forwardRef(({ className: i, variant: a, isActive: e, children: n, ...l }, t) => /* @__PURE__ */ s(
122
126
  "button",
123
127
  {
124
- ref: r,
125
- "aria-current": n ? "page" : void 0,
126
- className: f(u({ variant: i }), t),
127
- "data-active": n,
128
+ ref: t,
129
+ "aria-current": e ? "page" : void 0,
130
+ className: d(g({ variant: a }), i),
131
+ "data-active": e,
128
132
  "data-slot": "pagination-button",
129
133
  type: "button",
130
- ...s,
131
- children: a
134
+ ...l,
135
+ children: n
132
136
  }
133
137
  ));
134
- d.displayName = "PaginationButton";
135
- const w = l.forwardRef(({ className: t, disabled: i, ariaLabel: n, ...a }, s) => /* @__PURE__ */ o(
136
- d,
138
+ p.displayName = "PaginationButton";
139
+ const P = c.forwardRef(({ className: i, disabled: a, ariaLabel: e, ...n }, l) => /* @__PURE__ */ s(
140
+ p,
137
141
  {
138
- ref: s,
139
- "aria-disabled": i,
140
- "aria-label": n ?? "Go to previous page",
141
- className: t,
142
- disabled: i,
142
+ ref: l,
143
+ "aria-disabled": a,
144
+ "aria-label": e ?? "Go to previous page",
145
+ className: i,
146
+ disabled: a,
143
147
  variant: "previous",
144
- ...a,
145
- children: /* @__PURE__ */ o(b, {})
148
+ ...n,
149
+ children: /* @__PURE__ */ s(x, {})
146
150
  }
147
151
  ));
148
- w.displayName = "PaginationPrevious";
149
- const P = l.forwardRef(
150
- ({ className: t, disabled: i, ariaLabel: n, ...a }, s) => /* @__PURE__ */ o(
151
- d,
152
+ P.displayName = "PaginationPrevious";
153
+ const w = c.forwardRef(
154
+ ({ className: i, disabled: a, ariaLabel: e, ...n }, l) => /* @__PURE__ */ s(
155
+ p,
152
156
  {
153
- ref: s,
154
- "aria-disabled": i,
155
- "aria-label": n ?? "Go to next page",
156
- className: t,
157
- disabled: i,
157
+ ref: l,
158
+ "aria-disabled": a,
159
+ "aria-label": e ?? "Go to next page",
160
+ className: i,
161
+ disabled: a,
158
162
  variant: "next",
159
- ...a,
160
- children: /* @__PURE__ */ o(x, {})
163
+ ...n,
164
+ children: /* @__PURE__ */ s(b, {})
161
165
  }
162
166
  )
163
167
  );
164
- P.displayName = "PaginationNext";
165
- const M = l.forwardRef(
166
- ({ className: t, page: i, isActive: n, ariaLabel: a, ...s }, r) => /* @__PURE__ */ o(
167
- d,
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
172
  {
169
- ref: r,
170
- "aria-label": a ? a.replace("{page}", String(i)) : `Go to page ${i}`,
171
- className: t,
172
- isActive: n,
173
+ ref: t,
174
+ "aria-label": n ? n.replace("{page}", String(a)) : `Go to page ${a}`,
175
+ className: i,
176
+ isActive: e,
173
177
  variant: "link",
174
- ...s,
175
- children: i
178
+ ...l,
179
+ children: a
176
180
  }
177
181
  )
178
182
  );
179
- M.displayName = "PaginationLink";
180
- function B({
181
- className: t,
182
- srLabel: i = "More pages",
183
- ...n
183
+ R.displayName = "PaginationLink";
184
+ function T({
185
+ className: i,
186
+ srLabel: a = "More pages",
187
+ ...e
184
188
  }) {
185
189
  return /* @__PURE__ */ h(
186
190
  "span",
187
191
  {
188
192
  "aria-hidden": "true",
189
- className: f(u({ variant: "ellipsis" }), t),
193
+ className: d(g({ variant: "ellipsis" }), i),
190
194
  "data-slot": "pagination-ellipsis",
191
- ...n,
195
+ ...e,
192
196
  children: [
193
- /* @__PURE__ */ o(v, {}),
194
- /* @__PURE__ */ o("span", { className: "sr-only", children: i })
197
+ /* @__PURE__ */ s(v, {}),
198
+ /* @__PURE__ */ s("span", { className: "sr-only", children: a })
195
199
  ]
196
200
  }
197
201
  );
198
202
  }
199
203
  export {
200
204
  k as Pagination,
201
- d as PaginationButton,
202
- L as PaginationContent,
203
- B as PaginationEllipsis,
204
- S as PaginationItem,
205
- M as PaginationLink,
206
- P as PaginationNext,
207
- w as PaginationPrevious,
208
- G as usePagination
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
209
213
  };
package/dist/progress.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),v=require("react"),x=require("@radix-ui/react-progress"),R=require("framer-motion"),i=require("@brightlocal/ui-components/lib/utils"),w=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion");function g(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=g(v),f=g(x),m=u.forwardRef(({className:e,value:t,dataHook:r,trackingEl:a,trackingLabel:p,ariaLabel:b="Progress",label:o,indicatorClassName:P,disabled:l,...j},y)=>{const c=u.useId(),n=!!o,h=w.usePrefersReducedMotion(),d=s.jsx(f.Root,{ref:y,"aria-label":n?void 0:b,"aria-labelledby":n?c:void 0,className:i.cn("relative h-2 w-full overflow-hidden rounded-full","bg-primary/20",!n&&l&&"opacity-50",e),"data-hook":r,"data-slot":"progress","data-tracking-el":a,"data-tracking-label":p,...j,children:s.jsx(f.Indicator,{asChild:!0,children:s.jsx(R.motion.div,{animate:{transform:`translateX(-${100-(t||0)}%)`},className:i.cn("h-full w-full flex-1 bg-green-400",P),"data-slot":"progress-indicator",initial:!1,transition:h?{duration:0}:{type:"spring",stiffness:80,damping:20,mass:1}})})});return o?s.jsxs("div",{className:i.cn("flex w-full items-center gap-2",l&&"opacity-50"),"data-slot":"progress-wrapper",children:[s.jsx("span",{className:"text-foreground text-sm leading-normal font-medium","data-slot":"progress-label",id:c,children:o}),d]}):d});m.displayName="Progress";exports.Progress=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),N=require("react"),S=require("@radix-ui/react-progress"),q=require("framer-motion"),i=require("@brightlocal/ui-components/lib/utils"),v=require("@brightlocal/ui-components/hooks/use-prefers-reduced-motion");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const b=h(N),p=h(S),m={green:{track:"bg-brand-primary-foreground/20",indicator:"bg-green-400"},red:{track:"bg-brand-red/20",indicator:"bg-brand-red"},orange:{track:"bg-brand-orange/20",indicator:"bg-brand-orange"},yellow:{track:"bg-brand-yellow/20",indicator:"bg-brand-yellow"}};function _(e,t,r){if(e==null)return"–";if(r==="%")return`${t>0?Math.min(100,Math.max(0,Math.round(e/t*100))):0}%`;const n=r?` ${r}`:"";return t>0?`${e} / ${t}${n}`:`${e}${n}`}const y=b.forwardRef(({className:e,value:t,max:r=100,dataHook:n,trackingEl:c,trackingLabel:P,ariaLabel:j="Progress",label:d,color:x="green",showValue:o=!1,unit:M="%",indicatorClassName:k,disabled:l,...R},w)=>{const g=b.useId(),s=!!d,O=v.usePrefersReducedMotion(),u=m[x]??m.green,$=r>0?Math.min(100,Math.max(0,(t??0)/r*100)):0,f=a.jsx(p.Root,{ref:w,"aria-label":s?void 0:j,"aria-labelledby":s?g:void 0,className:i.cn("relative h-2 w-full overflow-hidden rounded-full",u.track,!s&&!o&&l&&"opacity-50",e),"data-hook":n,"data-slot":"progress","data-tracking-el":c,"data-tracking-label":P,max:r,value:t,...R,children:a.jsx(p.Indicator,{asChild:!0,children:a.jsx(q.motion.div,{animate:{transform:`translateX(-${100-$}%)`},className:i.cn("h-full w-full flex-1",u.indicator,k),"data-slot":"progress-indicator",initial:!1,transition:O?{duration:0}:{type:"spring",stiffness:80,damping:20,mass:1}})})});return!s&&!o?f:a.jsxs("div",{className:i.cn("flex w-full items-center gap-2",l&&"opacity-50"),"data-slot":"progress-wrapper",children:[s&&a.jsx("span",{className:"text-foreground text-xs leading-none font-medium","data-slot":"progress-label",id:g,children:d}),f,o&&a.jsx("span",{className:"text-muted-foreground shrink-0 text-xs leading-none tabular-nums","data-slot":"progress-value",children:_(t,r,M)})]})});y.displayName="Progress";exports.Progress=y;
@@ -1,5 +1,13 @@
1
1
  import * as React from "react";
2
2
  import * as ProgressPrimitive from "@radix-ui/react-progress";
3
+ /**
4
+ * Brand color for the progress indicator, drawn from the shared brand palette.
5
+ * - `green` — strong / healthy / complete
6
+ * - `yellow` — moderate / acceptable
7
+ * - `orange` — weak / needs attention
8
+ * - `red` — critical / urgent
9
+ */
10
+ type ProgressColor = "green" | "red" | "orange" | "yellow";
3
11
  /**
4
12
  * Props for the Progress component.
5
13
  */
@@ -22,9 +30,27 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
22
30
  */
23
31
  ariaLabel?: string;
24
32
  /**
25
- * Optional visible label text displayed above the progress bar
33
+ * Optional visible label text displayed to the left of the progress bar
26
34
  */
27
35
  label?: string;
36
+ /**
37
+ * Brand color for the indicator.
38
+ * @default "green"
39
+ */
40
+ color?: ProgressColor;
41
+ /**
42
+ * Whether to render the numeric value to the right of the progress bar.
43
+ * Falls back to `–` when no value is provided so the layout stays consistent.
44
+ * @default false
45
+ */
46
+ showValue?: boolean;
47
+ /**
48
+ * Unit/suffix appended to the displayed value. Use `"%"` for percentage form
49
+ * (value as a percentage of `max`, e.g. `90%`); any other unit renders
50
+ * fraction form (`3 / 5 steps`).
51
+ * @default "%"
52
+ */
53
+ unit?: string;
28
54
  /**
29
55
  * Custom class name for the indicator (progress fill)
30
56
  * Use this to customize the color, e.g., "bg-red-500"
@@ -42,5 +68,5 @@ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Ro
42
68
  */
43
69
  declare const Progress: React.ForwardRefExoticComponent<Omit<ProgressProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
44
70
  export { Progress };
45
- export type { ProgressProps };
71
+ export type { ProgressProps, ProgressColor };
46
72
  //# 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;AAM9D;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,QAAQ,mGAyFb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/components/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAM9D;;;;;;GAMG;AACH,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA0D3D;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,iBAAiB,CAAC,IAAI,CAC9B;IACC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,QAAQ,mGA8Gb,CAAC;AAIF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC"}
package/dist/progress.js CHANGED
@@ -1,52 +1,85 @@
1
- import { jsx as r, jsxs as x } from "react/jsx-runtime";
2
- import * as l from "react";
3
- import * as n from "@radix-ui/react-progress";
4
- import { motion as w } from "framer-motion";
5
- import { cn as s } from "@brightlocal/ui-components/lib/utils";
6
- import { usePrefersReducedMotion as y } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
7
- const P = l.forwardRef(
1
+ import { jsx as o, jsxs as R } from "react/jsx-runtime";
2
+ import * as p from "react";
3
+ import * as b from "@radix-ui/react-progress";
4
+ import { motion as v } from "framer-motion";
5
+ import { cn as i } from "@brightlocal/ui-components/lib/utils";
6
+ import { usePrefersReducedMotion as I } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
7
+ const u = {
8
+ green: {
9
+ track: "bg-brand-primary-foreground/20",
10
+ indicator: "bg-green-400"
11
+ },
12
+ red: {
13
+ track: "bg-brand-red/20",
14
+ indicator: "bg-brand-red"
15
+ },
16
+ orange: {
17
+ track: "bg-brand-orange/20",
18
+ indicator: "bg-brand-orange"
19
+ },
20
+ yellow: {
21
+ track: "bg-brand-yellow/20",
22
+ indicator: "bg-brand-yellow"
23
+ }
24
+ };
25
+ function L(t, r, e) {
26
+ if (t == null)
27
+ return "–";
28
+ if (e === "%")
29
+ return `${r > 0 ? Math.min(100, Math.max(0, Math.round(t / r * 100))) : 0}%`;
30
+ const n = e ? ` ${e}` : "";
31
+ return r > 0 ? `${t} / ${r}${n}` : `${t}${n}`;
32
+ }
33
+ const S = p.forwardRef(
8
34
  ({
9
- className: d,
10
- value: m,
11
- dataHook: f,
12
- trackingEl: c,
13
- trackingLabel: p,
14
- ariaLabel: g = "Progress",
15
- label: e,
16
- indicatorClassName: u,
17
- disabled: o,
18
- ...h
19
- }, b) => {
20
- const t = l.useId(), a = !!e, v = y(), i = /* @__PURE__ */ r(
21
- n.Root,
35
+ className: t,
36
+ value: r,
37
+ max: e = 100,
38
+ dataHook: n,
39
+ trackingEl: d,
40
+ trackingLabel: h,
41
+ ariaLabel: y = "Progress",
42
+ label: l,
43
+ color: k = "green",
44
+ showValue: s = !1,
45
+ unit: x = "%",
46
+ indicatorClassName: $,
47
+ disabled: c,
48
+ ...w
49
+ }, M) => {
50
+ const g = p.useId(), a = !!l, P = I(), f = u[k] ?? u.green, N = e > 0 ? Math.min(100, Math.max(0, (r ?? 0) / e * 100)) : 0, m = /* @__PURE__ */ o(
51
+ b.Root,
22
52
  {
23
- ref: b,
24
- "aria-label": a ? void 0 : g,
25
- "aria-labelledby": a ? t : void 0,
26
- className: s(
53
+ ref: M,
54
+ "aria-label": a ? void 0 : y,
55
+ "aria-labelledby": a ? g : void 0,
56
+ className: i(
27
57
  "relative h-2 w-full overflow-hidden rounded-full",
28
- "bg-primary/20",
29
- !a && o && "opacity-50",
30
- d
58
+ f.track,
59
+ !a && !s && c && "opacity-50",
60
+ t
31
61
  ),
32
- "data-hook": f,
62
+ "data-hook": n,
33
63
  "data-slot": "progress",
34
- "data-tracking-el": c,
35
- "data-tracking-label": p,
36
- ...h,
37
- children: /* @__PURE__ */ r(n.Indicator, { asChild: !0, children: /* @__PURE__ */ r(
38
- w.div,
64
+ "data-tracking-el": d,
65
+ "data-tracking-label": h,
66
+ max: e,
67
+ value: r,
68
+ ...w,
69
+ children: /* @__PURE__ */ o(b.Indicator, { asChild: !0, children: /* @__PURE__ */ o(
70
+ v.div,
39
71
  {
40
72
  animate: {
41
- transform: `translateX(-${100 - (m || 0)}%)`
73
+ transform: `translateX(-${100 - N}%)`
42
74
  },
43
- className: s(
44
- "h-full w-full flex-1 bg-green-400",
45
- u
75
+ className: i(
76
+ "h-full w-full flex-1",
77
+ f.indicator,
78
+ $
46
79
  ),
47
80
  "data-slot": "progress-indicator",
48
81
  initial: !1,
49
- transition: v ? { duration: 0 } : {
82
+ transition: P ? { duration: 0 } : {
50
83
  type: "spring",
51
84
  stiffness: 80,
52
85
  damping: 20,
@@ -56,31 +89,39 @@ const P = l.forwardRef(
56
89
  ) })
57
90
  }
58
91
  );
59
- return e ? /* @__PURE__ */ x(
92
+ return !a && !s ? m : /* @__PURE__ */ R(
60
93
  "div",
61
94
  {
62
- className: s(
95
+ className: i(
63
96
  "flex w-full items-center gap-2",
64
- o && "opacity-50"
97
+ c && "opacity-50"
65
98
  ),
66
99
  "data-slot": "progress-wrapper",
67
100
  children: [
68
- /* @__PURE__ */ r(
101
+ a && /* @__PURE__ */ o(
69
102
  "span",
70
103
  {
71
- className: "text-foreground text-sm leading-normal font-medium",
104
+ className: "text-foreground text-xs leading-none font-medium",
72
105
  "data-slot": "progress-label",
73
- id: t,
74
- children: e
106
+ id: g,
107
+ children: l
75
108
  }
76
109
  ),
77
- i
110
+ m,
111
+ s && /* @__PURE__ */ o(
112
+ "span",
113
+ {
114
+ className: "text-muted-foreground shrink-0 text-xs leading-none tabular-nums",
115
+ "data-slot": "progress-value",
116
+ children: L(r, e, x)
117
+ }
118
+ )
78
119
  ]
79
120
  }
80
- ) : i;
121
+ );
81
122
  }
82
123
  );
83
- P.displayName = "Progress";
124
+ S.displayName = "Progress";
84
125
  export {
85
- P as Progress
126
+ S as Progress
86
127
  };
package/dist/skeleton.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("react"),u=require("@brightlocal/ui-components/lib/utils");function d(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const f=d(i),o=f.forwardRef(({className:e,dataHook:a,trackingEl:t,trackingLabel:n,loadingLabel:c,...l},s)=>r.jsx("div",{ref:s,"aria-busy":"true",className:u.cn("bg-accent animate-pulse rounded-md",e),"data-hook":a,"data-slot":"skeleton","data-tracking-el":t,"data-tracking-label":n,...l,children:r.jsx("span",{className:"sr-only",children:c??"Loading"})}));o.displayName="Skeleton";exports.Skeleton=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("react"),u=require("@brightlocal/ui-components/lib/utils");function d(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const f=d(i),o=f.forwardRef(({className:e,dataHook:a,trackingEl:t,trackingLabel:n,loadingLabel:c,...l},s)=>r.jsx("div",{ref:s,"aria-busy":"true",className:u.cn("bg-accent relative animate-pulse rounded-md",e),"data-hook":a,"data-slot":"skeleton","data-tracking-el":t,"data-tracking-label":n,...l,children:r.jsx("span",{className:"sr-only",children:c??"Loading"})}));o.displayName="Skeleton";exports.Skeleton=o;
package/dist/skeleton.js CHANGED
@@ -7,7 +7,7 @@ const c = d.forwardRef(
7
7
  {
8
8
  ref: s,
9
9
  "aria-busy": "true",
10
- className: i("bg-accent animate-pulse rounded-md", e),
10
+ className: i("bg-accent relative animate-pulse rounded-md", e),
11
11
  "data-hook": t,
12
12
  "data-slot": "skeleton",
13
13
  "data-tracking-el": r,
package/dist/sonner.d.ts CHANGED
@@ -171,7 +171,7 @@ declare namespace Sonner {
171
171
  * // Show loading toast
172
172
  * sonner({
173
173
  * title: "Uploading...",
174
- * description: "Please wait while we upload your file.",
174
+ * description: "Uploading your file.",
175
175
  * icon: "loading",
176
176
  * id: loadingToastId
177
177
  * });
package/dist/table.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),w=require("react"),b=require("class-variance-authority"),r=require("@brightlocal/ui-components/lib/utils");function N(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,l.get?l:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const s=N(w),j=b.cva("align-middle bg-transparent text-foreground text-sm font-normal leading-normal break-words",{variants:{size:{default:"h-12 p-2",md:"h-16 p-2",lg:"h-24 p-2"},align:{left:"text-left",right:"text-right",center:"text-center"}},defaultVariants:{size:"default",align:"left"}}),k=b.cva("h-10 p-2 align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-150 ease-in-out",{variants:{align:{left:"text-left",right:"text-right",center:"text-center"}},defaultVariants:{align:"left"}}),f=s.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:l,minWidth:n,scrollRegionLabel:d,style:i,...c},y)=>o.jsx("div",{className:r.cn("relative w-full overflow-x-auto",n&&"focus-visible:shadow-default rounded-md outline-none"),"data-slot":"table-container",...n?{role:"region","aria-label":d??"Scrollable table",tabIndex:0}:void 0,children:o.jsx("table",{ref:y,className:r.cn("w-full caption-bottom text-sm",a),"data-hook":t,"data-slot":"table","data-tracking-el":e,"data-tracking-label":l,style:{minWidth:n,...i},...c})}));f.displayName="Table";const u=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("thead",{ref:l,className:r.cn(a),"data-hook":t,"data-slot":"table-header",...e}));u.displayName="TableHeader";const m=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("tbody",{ref:l,className:r.cn(a),"data-hook":t,"data-slot":"table-body",...e}));m.displayName="TableBody";const g=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("tfoot",{ref:l,className:r.cn("bg-muted/50",a),"data-hook":t,"data-slot":"table-footer",...e}));g.displayName="TableFooter";const p=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("tr",{ref:l,className:r.cn("data-[state=selected]:bg-muted transition-colors duration-150 ease-in-out",a),"data-hook":t,"data-slot":"table-row",...e}));p.displayName="TableRow";const T=s.forwardRef(({className:a,dataHook:t,align:e,minWidth:l,style:n,scope:d="col",...i},c)=>o.jsx("th",{ref:c,className:r.cn(k({align:e}),a),"data-hook":t,"data-slot":"table-head",scope:d,style:{minWidth:l,...n},...i}));T.displayName="TableHead";const h=s.forwardRef(({className:a,dataHook:t,size:e,align:l,minWidth:n,style:d,...i},c)=>o.jsx("td",{ref:c,className:r.cn(j({size:e,align:l}),a),"data-hook":t,"data-slot":"table-cell",style:{minWidth:n,...d},...i}));h.displayName="TableCell";const x=s.forwardRef(({className:a,dataHook:t,...e},l)=>o.jsx("caption",{ref:l,className:r.cn("caption-bottom py-4",a),"data-hook":t,"data-slot":"table-caption",...e}));x.displayName="TableCaption";exports.Table=f;exports.TableBody=m;exports.TableCaption=x;exports.TableCell=h;exports.TableFooter=g;exports.TableHead=T;exports.TableHeader=u;exports.TableRow=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),N=require("react"),f=require("class-variance-authority"),r=require("@brightlocal/ui-components/lib/utils");function j(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const l=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,l.get?l:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const s=j(N),k=f.cva("align-middle bg-transparent text-foreground text-sm font-normal leading-normal break-words",{variants:{size:{default:"h-12 p-2",md:"h-16 p-2",lg:"h-24 p-2"},align:{left:"text-left",right:"text-right",center:"text-center"}},defaultVariants:{size:"default",align:"left"}}),R=f.cva("h-10 p-2 align-middle text-muted-foreground text-sm font-medium leading-normal hover:bg-muted break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-150 ease-in-out",{variants:{align:{left:"text-left",right:"text-right",center:"text-center"}},defaultVariants:{align:"left"}}),u=s.forwardRef(({className:e,dataHook:t,trackingEl:a,trackingLabel:l,layout:d="auto",minWidth:n,scrollRegionLabel:i,style:c,...b},w)=>o.jsx("div",{className:r.cn("relative w-full overflow-x-auto",n&&"focus-visible:shadow-default rounded-md outline-none"),"data-slot":"table-container",...n?{role:"region","aria-label":i??"Scrollable table",tabIndex:0}:void 0,children:o.jsx("table",{ref:w,className:r.cn("w-full caption-bottom text-sm",d==="fixed"&&"table-fixed",e),"data-hook":t,"data-slot":"table","data-tracking-el":a,"data-tracking-label":l,style:{minWidth:n,...c},...b})}));u.displayName="Table";const m=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("thead",{ref:l,className:r.cn(e),"data-hook":t,"data-slot":"table-header",...a}));m.displayName="TableHeader";const g=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tbody",{ref:l,className:r.cn(e),"data-hook":t,"data-slot":"table-body",...a}));g.displayName="TableBody";const p=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tfoot",{ref:l,className:r.cn("bg-muted/50",e),"data-hook":t,"data-slot":"table-footer",...a}));p.displayName="TableFooter";const x=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("tr",{ref:l,className:r.cn("data-[state=selected]:bg-muted transition-colors duration-150 ease-in-out",e),"data-hook":t,"data-slot":"table-row",...a}));x.displayName="TableRow";const T=s.forwardRef(({className:e,dataHook:t,align:a,width:l,minWidth:d,style:n,scope:i="col",...c},b)=>o.jsx("th",{ref:b,className:r.cn(R({align:a}),e),"data-hook":t,"data-slot":"table-head",scope:i,style:{width:l,minWidth:d,...n},...c}));T.displayName="TableHead";const h=s.forwardRef(({className:e,dataHook:t,size:a,align:l,width:d,minWidth:n,style:i,...c},b)=>o.jsx("td",{ref:b,className:r.cn(k({size:a,align:l}),e),"data-hook":t,"data-slot":"table-cell",style:{width:d,minWidth:n,...i},...c}));h.displayName="TableCell";const y=s.forwardRef(({className:e,dataHook:t,...a},l)=>o.jsx("caption",{ref:l,className:r.cn("caption-bottom py-4",e),"data-hook":t,"data-slot":"table-caption",...a}));y.displayName="TableCaption";exports.Table=u;exports.TableBody=g;exports.TableCaption=y;exports.TableCell=h;exports.TableFooter=p;exports.TableHead=T;exports.TableHeader=m;exports.TableRow=x;
package/dist/table.d.ts CHANGED
@@ -20,6 +20,17 @@ interface TableProps extends React.ComponentProps<"table"> {
20
20
  * Tracking label for analytics context
21
21
  */
22
22
  trackingLabel?: string;
23
+ /**
24
+ * Table layout algorithm.
25
+ * - `"auto"` (default) — browser sizes columns based on content.
26
+ * - `"fixed"` — columns respect explicit `width` values on `TableHead`/`TableCell`
27
+ * and split remaining space equally. Use when you set `width` on headers.
28
+ *
29
+ * **Migration note:** `"fixed"` will become the default in the next major release.
30
+ * Consumers should start setting explicit `width` on `TableHead` columns now.
31
+ * @default "auto"
32
+ */
33
+ layout?: "auto" | "fixed";
23
34
  /**
24
35
  * Minimum width for the table (e.g., "600px", "40rem").
25
36
  * Prevents columns from compressing on narrow viewports and enables
@@ -70,7 +81,11 @@ interface TableHeadProps extends Omit<React.ComponentProps<"th">, "align">, Vari
70
81
  */
71
82
  dataHook?: string;
72
83
  /**
73
- * Minimum width for the column (e.g., "100px", "8rem")
84
+ * Explicit width for the column (e.g., "200px", "50%", "10rem").
85
+ */
86
+ width?: string;
87
+ /**
88
+ * Minimum width for the column (e.g., "100px", "8rem").
74
89
  */
75
90
  minWidth?: string;
76
91
  /**
@@ -86,7 +101,12 @@ interface TableCellProps extends Omit<React.ComponentProps<"td">, "align">, Vari
86
101
  */
87
102
  dataHook?: string;
88
103
  /**
89
- * Minimum width for the cell (e.g., "100px", "8rem")
104
+ * Width for the cell (e.g., "200px", "50%", "10rem").
105
+ * Set `layout="fixed"` on the parent `Table` for this value to be respected as an exact constraint.
106
+ */
107
+ width?: string;
108
+ /**
109
+ * Minimum width for the cell (e.g., "100px", "8rem").
90
110
  */
91
111
  minWidth?: string;
92
112
  /**