@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
@@ -9,8 +9,7 @@ import * as React from "react";
9
9
  * proportional; add `tabular` where metrics sit in a column or the value
10
10
  * updates in place.
11
11
  * - `code` — Geist Mono 400 · 16/24. IDs, keys, coordinates a user copies verbatim.
12
- * Inside a sentence use the `text-code-inline` utility on a `code` element instead
13
- * (0.9em, inherits the line's height).
12
+ * Inside a sentence use `text-code-inline` on a `code` element instead (deprecated alias — 0.9em, inherits the line's height).
14
13
  *
15
14
  * There are no standalone label variants on purpose: the `text-label` /
16
15
  * `text-label-sm` tokens are reserved for control-owning components
@@ -65,6 +64,20 @@ interface TypographyTextProps extends React.HTMLAttributes<HTMLElement> {
65
64
  * @example "center"
66
65
  */
67
66
  align?: TypographyTextAlign;
67
+ /**
68
+ * Clip overflowing text to a single line with an ellipsis — table cells,
69
+ * list rows, dropdown options; anywhere text can outgrow its container.
70
+ * The surrounding layout must still allow the element to shrink: inside a
71
+ * flex row the element (or its wrapper) needs `min-w-0`, and in a grid
72
+ * column `minmax(0, …)` — otherwise the box grows instead of clipping.
73
+ * Forces `display: block` (an inline box cannot clip), so an inline
74
+ * default element (`metric`'s span, `code`'s code) or an inline `asChild`
75
+ * child becomes a block while truncating.
76
+ * Single-line only by design; a multi-line clamp can follow if demand
77
+ * appears.
78
+ * @default false
79
+ */
80
+ truncate?: boolean;
68
81
  /**
69
82
  * Render as a different element using Radix Slot pattern.
70
83
  * When true, merges props onto the child element.
@@ -1 +1 @@
1
- {"version":3,"file":"typography-text.d.ts","sourceRoot":"","sources":["../../src/components/typography-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhF;;GAEG;AACH,KAAK,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;;;;;GAMG;AACH,KAAK,mBAAmB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAsD/D;;;GAGG;AACH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACrE;;;;OAIG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,cAAc,yFA6CnB,CAAC;AAGF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
1
+ {"version":3,"file":"typography-text.d.ts","sourceRoot":"","sources":["../../src/components/typography-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;;;;;;;;;;;;;GAeG;AACH,KAAK,qBAAqB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhF;;GAEG;AACH,KAAK,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;;;;;GAMG;AACH,KAAK,mBAAmB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAgE/D;;;GAGG;AACH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACrE;;;;OAIG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,cAAc,yFA8CnB,CAAC;AAGF,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
@@ -1,9 +1,9 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- import * as i from "react";
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import * as u from "react";
3
3
  import { Slot as x } from "@radix-ui/react-slot";
4
4
  import { cva as f } from "class-variance-authority";
5
- import { cn as u } from "@brightlocal/ui-components/lib/utils";
6
- const b = f("", {
5
+ import { cn as b } from "@brightlocal/ui-components/lib/utils";
6
+ const g = f("", {
7
7
  variants: {
8
8
  variant: {
9
9
  body: "text-body",
@@ -32,50 +32,61 @@ const b = f("", {
32
32
  left: "text-left",
33
33
  center: "text-center",
34
34
  right: "text-right"
35
+ },
36
+ // Boolean on purpose (no `false` class): unlike tabular there is no
37
+ // inherited context to undo — either the element clips or it doesn't.
38
+ // `block` is load-bearing: an inline box (the default `span` for metric,
39
+ // `code` for code, or an inline asChild child) cannot clip — overflow
40
+ // does not apply to non-replaced inlines — so the variant forces a block
41
+ // container. A no-op on the body variants (`p` is already block) and on
42
+ // flex/grid items (blockified by the layout).
43
+ truncate: {
44
+ true: "block truncate"
35
45
  }
36
46
  },
37
47
  defaultVariants: {
38
48
  variant: "body",
39
49
  color: "default"
40
50
  }
41
- }), g = {
51
+ }), h = {
42
52
  body: "p",
43
53
  "body-sm": "p",
44
54
  "body-xs": "p",
45
55
  metric: "span",
46
56
  code: "code"
47
- }, h = i.forwardRef(
57
+ }, T = u.forwardRef(
48
58
  ({
49
59
  className: e,
50
60
  variant: t = "body",
51
61
  color: o = "default",
52
62
  tabular: r,
53
63
  align: a,
54
- asChild: d = !1,
55
- dataHook: s,
56
- trackingEl: m,
57
- trackingLabel: p,
58
- ...c
59
- }, l) => {
60
- const n = d ? x : g[t];
61
- return /* @__PURE__ */ y(
62
- n,
64
+ truncate: d = !1,
65
+ asChild: s = !1,
66
+ dataHook: c,
67
+ trackingEl: l,
68
+ trackingLabel: n,
69
+ ...m
70
+ }, p) => {
71
+ const y = s ? x : h[t];
72
+ return /* @__PURE__ */ i(
73
+ y,
63
74
  {
64
- ref: l,
65
- className: u(
66
- b({ variant: t, color: o, tabular: r, align: a }),
75
+ ref: p,
76
+ className: b(
77
+ g({ variant: t, color: o, tabular: r, align: a, truncate: d }),
67
78
  e
68
79
  ),
69
- "data-hook": s,
80
+ "data-hook": c,
70
81
  "data-slot": "typography-text",
71
- "data-tracking-el": m || `typography-text-${t}`,
72
- "data-tracking-label": p,
73
- ...c
82
+ "data-tracking-el": l || `typography-text-${t}`,
83
+ "data-tracking-label": n,
84
+ ...m
74
85
  }
75
86
  );
76
87
  }
77
88
  );
78
- h.displayName = "TypographyText";
89
+ T.displayName = "TypographyText";
79
90
  export {
80
- h as TypographyText
91
+ T as TypographyText
81
92
  };
@@ -136,7 +136,7 @@ interface TypographyInlineCodeProps extends React.ComponentProps<"code">, Omit<T
136
136
  /**
137
137
  * Inline code component for code snippets within text.
138
138
  * Displays with monospace font and muted background.
139
- * @deprecated Use `<code className="text-code-inline">` inside a sentence (0.9em, inherits the line's height — semantic type scale, DS-714).
139
+ * @deprecated Use `<code className="text-code-inline">` inside a sentence (semantic type scale, DS-714).
140
140
  */
141
141
  declare const TypographyInlineCode: React.ForwardRefExoticComponent<Omit<TypographyInlineCodeProps, "ref"> & React.RefAttributes<HTMLElement>>;
142
142
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -173,8 +173,8 @@
173
173
  "vite-bundle-visualizer": "^1.2.1",
174
174
  "vite-plugin-dts": "^4.5.4",
175
175
  "vite-plugin-lib-inject-css": "^2.2.2",
176
- "@workspace/eslint-config": "0.0.0",
177
- "@workspace/typescript-config": "0.0.0"
176
+ "@workspace/typescript-config": "0.0.0",
177
+ "@workspace/eslint-config": "0.0.0"
178
178
  },
179
179
  "publishConfig": {
180
180
  "access": "public",
@@ -210,7 +210,6 @@
210
210
  "@radix-ui/react-tabs": "^1.1.13",
211
211
  "@radix-ui/react-toggle": "^1.1.10",
212
212
  "@radix-ui/react-toggle-group": "^1.1.11",
213
- "@radix-ui/react-tooltip": "^1.2.8",
214
213
  "@tanstack/react-table": "^8.21.3",
215
214
  "@tanstack/react-virtual": "^3.13.23",
216
215
  "class-variance-authority": "^0.7.1",
@@ -228,8 +227,8 @@
228
227
  "sonner": "^2.0.7",
229
228
  "tailwind-merge": "^3.4.0",
230
229
  "vaul": "^1.1.2",
231
- "@brightlocal/icons": "2.4.0",
232
- "@brightlocal/illustrations": "0.6.0"
230
+ "@brightlocal/icons": "2.4.1",
231
+ "@brightlocal/illustrations": "0.7.0"
233
232
  },
234
233
  "size-limit": [
235
234
  {
@@ -1,5 +1,4 @@
1
1
  import * as React from "react";
2
- import { cva } from "class-variance-authority";
3
2
 
4
3
  import { cn } from "@brightlocal/ui-components/lib/utils";
5
4
  import {
@@ -11,6 +10,7 @@ import {
11
10
  BLOCK_ILLUSTRATION_SIZE,
12
11
  BlockIllustration,
13
12
  } from "../lib/block-illustration";
13
+ import { emptyChipStyles } from "../lib/empty-chip";
14
14
 
15
15
  /* -------------------------------------------------------------------------------------------------
16
16
  * EmptyState
@@ -26,9 +26,9 @@ import {
26
26
  * for a section):
27
27
  *
28
28
  * md (default) — for the box a working page gives it: a card, a panel, a
29
- * zero-row table. An icon in a muted chip, and a 20/28 title.
29
+ * zero-row table. An icon in a muted chip, and a 16/24 title.
30
30
  * lg — for the moment the whole page has nothing to show: a full
31
- * illustration at 130 and a 24/32 title. Sits at the page
31
+ * illustration at 130 and a 20/28 title. Sits at the page
32
32
  * body's optical centre via `<Grid variant="centered">`.
33
33
  *
34
34
  * (`sm` is reserved: a compact row-level tier is not designed yet, and until
@@ -68,10 +68,12 @@ type EmptyStateSize = "md" | "lg";
68
68
  */
69
69
  type EmptyStateAlign = "center" | "left";
70
70
 
71
- /** The title's type role per size — Inter 20/28, or Poppins 24/32. */
71
+ /** The title's type role per size — Inter 16/24, or Inter 20/28. One step
72
+ * under the heading of the page or card the block sits inside, so the empty
73
+ * message never competes with it (DS-997). */
72
74
  const SIZE_HEADING_VARIANT = {
73
- md: "section",
74
- lg: "page",
75
+ md: "subsection",
76
+ lg: "section",
75
77
  } as const;
76
78
 
77
79
  /** The outline level each size defaults to, if the consumer names none. */
@@ -82,20 +84,6 @@ const SIZE_TITLE_LEVEL: Record<EmptyStateSize, TypographyHeadingLevel> = {
82
84
  md: 3,
83
85
  };
84
86
 
85
- /**
86
- * The visual's chip: 40px of `bg-muted` around a 16px glyph. A canvas drops it
87
- * — but a canvas is a different component, so there is no variant for that here.
88
- */
89
- const chipStyles = cva(
90
- "bg-muted text-muted-foreground flex size-10 items-center justify-center rounded-full",
91
- {
92
- variants: {
93
- align: { center: "", left: "shrink-0" },
94
- },
95
- defaultVariants: { align: "center" },
96
- }
97
- );
98
-
99
87
  /**
100
88
  * The parts every empty state has, at either size.
101
89
  */
@@ -111,7 +99,8 @@ interface EmptyStateBaseProps extends Omit<
111
99
  dataHook: string;
112
100
  /**
113
101
  * What is missing, as a real heading. Name the thing, not the condition:
114
- * "No locations yet", never "Empty".
102
+ * "No locations yet", never "Empty". Keep it short — at size lg it wraps
103
+ * at 32rem; the explanation belongs in `description`.
115
104
  */
116
105
  title: React.ReactNode;
117
106
  /**
@@ -183,7 +172,7 @@ interface EmptyStateLgProps extends EmptyStateBaseProps {
183
172
  * Pass the illustration itself and do NOT set a size: the block renders it at
184
173
  * the size the design specifies, whatever the element carries, so there is no
185
174
  * number to get wrong per call site.
186
- * @example <BusinessLocation aria-hidden />
175
+ * @example <SmallBusiness aria-hidden />
187
176
  */
188
177
  illustration?: React.ReactNode;
189
178
  /**
@@ -242,7 +231,7 @@ export type EmptyStateProps = EmptyStateMdProps | EmptyStateLgProps;
242
231
  * <EmptyState
243
232
  * dataHook="locations-empty-page"
244
233
  * description={t("locations.empty.description")}
245
- * illustration={<BusinessLocation aria-hidden />}
234
+ * illustration={<SmallBusiness aria-hidden />}
246
235
  * size="lg"
247
236
  * title={t("locations.empty.title")}
248
237
  * >
@@ -313,7 +302,7 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
313
302
  <span
314
303
  aria-hidden="true"
315
304
  className={cn(
316
- chipStyles({ align }),
305
+ emptyChipStyles({ align }),
317
306
  /* The chip's 4px of extra breathing room belongs to the title
318
307
  under it — the lg column sets its own 16px rhythm instead. */
319
308
  size === "md" && align === "center" && "mb-1"
@@ -337,6 +326,10 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
337
326
  >
338
327
  <TypographyHeading
339
328
  align={align === "center" ? "center" : "left"}
329
+ /* lg caps the title at 32rem, one step wider than the description
330
+ below it, so a long title wraps into the column instead of running
331
+ the full width of the page body. md is bounded by its frame. */
332
+ className={size === "lg" ? "max-w-lg" : undefined}
340
333
  data-slot="empty-state-title"
341
334
  dataHook={`${dataHook}-title`}
342
335
  level={titleLevel ?? SIZE_TITLE_LEVEL[size]}
@@ -313,7 +313,7 @@ export interface ProgressStateProps extends Omit<
313
313
  * title's companion, not the subject of the screen: much larger and it
314
314
  * outweighs the 24px heading under it, and the eye lands on the artwork
315
315
  * instead of the words that say what is happening.
316
- * @example <MapMagnifyingGlassSearchLocation aria-hidden />
316
+ * @example <MapMagnifyingGlass aria-hidden />
317
317
  */
318
318
  illustration?: React.ReactNode;
319
319
  /**
@@ -378,7 +378,7 @@ export interface ProgressStateProps extends Omit<
378
378
  * // The backend reports real progress.
379
379
  * <ProgressState
380
380
  * dataHook="lsg-generating"
381
- * illustration={<MapMagnifyingGlassSearchLocation aria-hidden />}
381
+ * illustration={<MapMagnifyingGlass aria-hidden />}
382
382
  * title={t("reports.building.title")}
383
383
  * description={t("reports.building.description")}
384
384
  * value={run.percent}
@@ -1419,7 +1419,14 @@ const sidebarMenuSubVariants = cva(
1419
1419
  variants: {
1420
1420
  variant: {
1421
1421
  default: "px-10",
1422
- border: "border-l border-sidebar-border ml-10 pl-1 pr-10",
1422
+ // Figma SidebarMenuSub / Type=Border (DS-1029): rule 24px in, items
1423
+ // 20px right of it, 8px right inset — labels keep ≥190px at the
1424
+ // 288px sidebar width. The rule is a pseudo-element so it stops at
1425
+ // the list's vertical padding (Figma draws it 4px short at both
1426
+ // ends); the transparent border keeps its 1px in the box so `pl-5`
1427
+ // still lands items 21px from the rule's left edge.
1428
+ border:
1429
+ "relative ml-6 border-l border-transparent pl-5 pr-2 before:absolute before:inset-y-1 before:-left-px before:w-px before:bg-sidebar-border",
1423
1430
  indent: "px-10",
1424
1431
  },
1425
1432
  },
@@ -1524,7 +1531,7 @@ const SidebarMenuSubButton = React.forwardRef<
1524
1531
  <Comp
1525
1532
  ref={ref}
1526
1533
  className={cn(
1527
- "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground text-label duration-fast flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] ease-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:not([data-slot])]:truncate [&>svg]:shrink-0",
1534
+ "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground text-label duration-fast flex h-8 min-w-0 items-center gap-2 overflow-hidden rounded-md px-3 transition-[color,background-color,box-shadow,opacity] ease-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:not([data-slot])]:truncate [&>svg]:shrink-0",
1528
1535
  SIDEBAR_FOCUS_RING,
1529
1536
  "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
1530
1537
  size === SidebarMenuSubButtonSize.SM && "text-label-sm",
@@ -1638,6 +1645,23 @@ SidebarMenuCollapsibleTrigger.displayName = "SidebarMenuCollapsibleTrigger";
1638
1645
  */
1639
1646
  type SidebarMenuCollapsibleContentProps = SidebarMenuSubProps;
1640
1647
 
1648
+ /**
1649
+ * Expandable body of a `SidebarMenuCollapsible`. It **is** the sub-menu list:
1650
+ * it renders a `SidebarMenuSub` (so it takes `variant` and the other
1651
+ * `SidebarMenuSub` props), so place `SidebarMenuSubItem`s directly inside it.
1652
+ * Do not nest another `SidebarMenuSub` in here — the two indents stack and
1653
+ * leave ~100px for labels at the default sidebar width (DS-1029).
1654
+ *
1655
+ * @example
1656
+ * <SidebarMenuCollapsible>
1657
+ * <SidebarMenuCollapsibleTrigger>Reviews</SidebarMenuCollapsibleTrigger>
1658
+ * <SidebarMenuCollapsibleContent>
1659
+ * <SidebarMenuSubItem>
1660
+ * <SidebarMenuSubButton>Review Tracker</SidebarMenuSubButton>
1661
+ * </SidebarMenuSubItem>
1662
+ * </SidebarMenuCollapsibleContent>
1663
+ * </SidebarMenuCollapsible>
1664
+ */
1641
1665
  const SidebarMenuCollapsibleContent = React.forwardRef<
1642
1666
  HTMLUListElement,
1643
1667
  SidebarMenuCollapsibleContentProps
@@ -125,6 +125,18 @@ export interface AccordionItemProps extends React.ComponentProps<
125
125
  * A unique value for the item (REQUIRED)
126
126
  */
127
127
  value: string;
128
+ /**
129
+ * Data hook for automated testing
130
+ */
131
+ dataHook?: string;
132
+ /**
133
+ * Tracking element identifier for analytics
134
+ */
135
+ trackingEl?: string;
136
+ /**
137
+ * Tracking label for analytics context
138
+ */
139
+ trackingLabel?: string;
128
140
  /**
129
141
  * Whether the accordion item is disabled
130
142
  */
@@ -142,11 +154,14 @@ export interface AccordionItemProps extends React.ComponentProps<
142
154
  const AccordionItem = React.forwardRef<
143
155
  React.ComponentRef<typeof AccordionPrimitive.Item>,
144
156
  AccordionItemProps
145
- >(({ className, ...props }, ref) => (
157
+ >(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => (
146
158
  <AccordionPrimitive.Item
147
159
  ref={ref}
148
160
  className={cn("border-b last:border-b-0", className)}
161
+ data-hook={dataHook}
149
162
  data-slot="accordion-item"
163
+ data-tracking-el={trackingEl}
164
+ data-tracking-label={trackingLabel}
150
165
  {...props}
151
166
  />
152
167
  ));
@@ -168,27 +183,47 @@ export interface AccordionTriggerProps extends React.ComponentProps<
168
183
  * Whether the trigger is disabled
169
184
  */
170
185
  disabled?: boolean;
186
+ /**
187
+ * Data hook for automated testing
188
+ */
189
+ dataHook?: string;
190
+ /**
191
+ * Tracking element identifier for analytics
192
+ */
193
+ trackingEl?: string;
194
+ /**
195
+ * Tracking label for analytics context
196
+ */
197
+ trackingLabel?: string;
171
198
  }
172
199
 
173
200
  const AccordionTrigger = React.forwardRef<
174
201
  React.ComponentRef<typeof AccordionPrimitive.Trigger>,
175
202
  AccordionTriggerProps
176
- >(({ className, children, ...props }, ref) => (
177
- <AccordionPrimitive.Header className="flex">
178
- <AccordionPrimitive.Trigger
179
- ref={ref}
180
- className={cn(
181
- "focus-visible:border-ring focus-visible:shadow-default duration-fast text-label flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left transition-shadow ease-out outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
182
- className
183
- )}
184
- data-slot="accordion-trigger"
185
- {...props}
186
- >
187
- {children}
188
- <ChevronDown className="text-muted-foreground duration-base pointer-events-none shrink-0 translate-y-0.5 transition-transform ease-in-out" />
189
- </AccordionPrimitive.Trigger>
190
- </AccordionPrimitive.Header>
191
- ));
203
+ >(
204
+ (
205
+ { className, children, dataHook, trackingEl, trackingLabel, ...props },
206
+ ref
207
+ ) => (
208
+ <AccordionPrimitive.Header className="flex">
209
+ <AccordionPrimitive.Trigger
210
+ ref={ref}
211
+ className={cn(
212
+ "focus-visible:border-ring focus-visible:shadow-default duration-fast text-label flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left transition-shadow ease-out outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
213
+ className
214
+ )}
215
+ data-hook={dataHook}
216
+ data-slot="accordion-trigger"
217
+ data-tracking-el={trackingEl}
218
+ data-tracking-label={trackingLabel}
219
+ {...props}
220
+ >
221
+ {children}
222
+ <ChevronDown className="text-muted-foreground duration-base pointer-events-none shrink-0 translate-y-0.5 transition-transform ease-in-out" />
223
+ </AccordionPrimitive.Trigger>
224
+ </AccordionPrimitive.Header>
225
+ )
226
+ );
192
227
 
193
228
  AccordionTrigger.displayName = "AccordionTrigger";
194
229
 
@@ -207,21 +242,41 @@ export interface AccordionContentProps extends React.ComponentProps<
207
242
  * Force mounting of the content when true
208
243
  */
209
244
  forceMount?: true;
245
+ /**
246
+ * Data hook for automated testing
247
+ */
248
+ dataHook?: string;
249
+ /**
250
+ * Tracking element identifier for analytics
251
+ */
252
+ trackingEl?: string;
253
+ /**
254
+ * Tracking label for analytics context
255
+ */
256
+ trackingLabel?: string;
210
257
  }
211
258
 
212
259
  const AccordionContent = React.forwardRef<
213
260
  React.ComponentRef<typeof AccordionPrimitive.Content>,
214
261
  AccordionContentProps
215
- >(({ className, children, ...props }, ref) => (
216
- <AccordionPrimitive.Content
217
- ref={ref}
218
- className="text-body-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden"
219
- data-slot="accordion-content"
220
- {...props}
221
- >
222
- <div className={cn("pt-0 pb-4", className)}>{children}</div>
223
- </AccordionPrimitive.Content>
224
- ));
262
+ >(
263
+ (
264
+ { className, children, dataHook, trackingEl, trackingLabel, ...props },
265
+ ref
266
+ ) => (
267
+ <AccordionPrimitive.Content
268
+ ref={ref}
269
+ className="text-body-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden"
270
+ data-hook={dataHook}
271
+ data-slot="accordion-content"
272
+ data-tracking-el={trackingEl}
273
+ data-tracking-label={trackingLabel}
274
+ {...props}
275
+ >
276
+ <div className={cn("pt-0 pb-4", className)}>{children}</div>
277
+ </AccordionPrimitive.Content>
278
+ )
279
+ );
225
280
 
226
281
  AccordionContent.displayName = "AccordionContent";
227
282
 
@@ -6,6 +6,7 @@ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
  import { useOverlayPointerLock } from "@brightlocal/ui-components/hooks/use-overlay-pointer-lock";
8
8
  import { ButtonVariants } from "@brightlocal/ui-components/button";
9
+ import type { ButtonVariant } from "@brightlocal/ui-components/button";
9
10
 
10
11
  interface AlertDialogProps extends React.ComponentProps<
11
12
  typeof AlertDialogPrimitive.Root
@@ -193,27 +194,68 @@ const AlertDialogDescription = React.forwardRef<
193
194
 
194
195
  AlertDialogDescription.displayName = "AlertDialogDescription";
195
196
 
197
+ /** Visual style variants for the AlertDialogAction confirm button. */
198
+ type AlertDialogActionVariant = Extract<
199
+ ButtonVariant,
200
+ "primary" | "destructive"
201
+ >;
202
+
203
+ /**
204
+ * Props for the AlertDialogAction component
205
+ */
206
+ interface AlertDialogActionProps extends React.ComponentProps<
207
+ typeof AlertDialogPrimitive.Action
208
+ > {
209
+ /**
210
+ * Visual style of the confirm button. Use `"destructive"` when confirming
211
+ * an irreversible action such as a delete.
212
+ * @default "primary"
213
+ */
214
+ variant?: AlertDialogActionVariant;
215
+ /**
216
+ * Data hook for automated testing
217
+ * @example "delete-location-confirm"
218
+ */
219
+ dataHook?: string;
220
+ }
221
+
196
222
  const AlertDialogAction = React.forwardRef<
197
223
  React.ComponentRef<typeof AlertDialogPrimitive.Action>,
198
- React.ComponentProps<typeof AlertDialogPrimitive.Action>
199
- >(({ className, ...props }, ref) => (
224
+ AlertDialogActionProps
225
+ >(({ className, variant = "primary", dataHook, ...props }, ref) => (
200
226
  <AlertDialogPrimitive.Action
201
227
  ref={ref}
202
- className={cn(ButtonVariants(), className)}
228
+ className={cn(ButtonVariants({ variant }), className)}
229
+ data-hook={dataHook}
203
230
  data-slot="alert-dialog-action"
231
+ data-variant={variant}
204
232
  {...props}
205
233
  />
206
234
  ));
207
235
 
208
236
  AlertDialogAction.displayName = "AlertDialogAction";
209
237
 
238
+ /**
239
+ * Props for the AlertDialogCancel component
240
+ */
241
+ interface AlertDialogCancelProps extends React.ComponentProps<
242
+ typeof AlertDialogPrimitive.Cancel
243
+ > {
244
+ /**
245
+ * Data hook for automated testing
246
+ * @example "delete-location-cancel"
247
+ */
248
+ dataHook?: string;
249
+ }
250
+
210
251
  const AlertDialogCancel = React.forwardRef<
211
252
  React.ComponentRef<typeof AlertDialogPrimitive.Cancel>,
212
- React.ComponentProps<typeof AlertDialogPrimitive.Cancel>
213
- >(({ className, ...props }, ref) => (
253
+ AlertDialogCancelProps
254
+ >(({ className, dataHook, ...props }, ref) => (
214
255
  <AlertDialogPrimitive.Cancel
215
256
  ref={ref}
216
257
  className={cn(ButtonVariants({ variant: "outline" }), className)}
258
+ data-hook={dataHook}
217
259
  data-slot="alert-dialog-cancel"
218
260
  {...props}
219
261
  />
@@ -236,6 +278,9 @@ export {
236
278
  };
237
279
 
238
280
  export type {
281
+ AlertDialogActionProps,
282
+ AlertDialogActionVariant,
283
+ AlertDialogCancelProps,
239
284
  AlertDialogDescriptionProps,
240
285
  AlertDialogProps,
241
286
  AlertDialogTitleProps,