@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
@@ -14,8 +14,7 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
14
14
  * proportional; add `tabular` where metrics sit in a column or the value
15
15
  * updates in place.
16
16
  * - `code` — Geist Mono 400 · 16/24. IDs, keys, coordinates a user copies verbatim.
17
- * Inside a sentence use the `text-code-inline` utility on a `code` element instead
18
- * (0.9em, inherits the line's height).
17
+ * Inside a sentence use `text-code-inline` on a `code` element instead (deprecated alias — 0.9em, inherits the line's height).
19
18
  *
20
19
  * There are no standalone label variants on purpose: the `text-label` /
21
20
  * `text-label-sm` tokens are reserved for control-owning components
@@ -67,6 +66,16 @@ const typographyTextVariants = cva("", {
67
66
  center: "text-center",
68
67
  right: "text-right",
69
68
  },
69
+ // Boolean on purpose (no `false` class): unlike tabular there is no
70
+ // inherited context to undo — either the element clips or it doesn't.
71
+ // `block` is load-bearing: an inline box (the default `span` for metric,
72
+ // `code` for code, or an inline asChild child) cannot clip — overflow
73
+ // does not apply to non-replaced inlines — so the variant forces a block
74
+ // container. A no-op on the body variants (`p` is already block) and on
75
+ // flex/grid items (blockified by the layout).
76
+ truncate: {
77
+ true: "block truncate",
78
+ },
70
79
  },
71
80
  defaultVariants: {
72
81
  variant: "body",
@@ -125,6 +134,20 @@ interface TypographyTextProps extends React.HTMLAttributes<HTMLElement> {
125
134
  * @example "center"
126
135
  */
127
136
  align?: TypographyTextAlign;
137
+ /**
138
+ * Clip overflowing text to a single line with an ellipsis — table cells,
139
+ * list rows, dropdown options; anywhere text can outgrow its container.
140
+ * The surrounding layout must still allow the element to shrink: inside a
141
+ * flex row the element (or its wrapper) needs `min-w-0`, and in a grid
142
+ * column `minmax(0, …)` — otherwise the box grows instead of clipping.
143
+ * Forces `display: block` (an inline box cannot clip), so an inline
144
+ * default element (`metric`'s span, `code`'s code) or an inline `asChild`
145
+ * child becomes a block while truncating.
146
+ * Single-line only by design; a multi-line clamp can follow if demand
147
+ * appears.
148
+ * @default false
149
+ */
150
+ truncate?: boolean;
128
151
  /**
129
152
  * Render as a different element using Radix Slot pattern.
130
153
  * When true, merges props onto the child element.
@@ -176,6 +199,7 @@ const TypographyText = React.forwardRef<HTMLElement, TypographyTextProps>(
176
199
  color = "default",
177
200
  tabular,
178
201
  align,
202
+ truncate = false,
179
203
  asChild = false,
180
204
  dataHook,
181
205
  trackingEl,
@@ -202,7 +226,7 @@ const TypographyText = React.forwardRef<HTMLElement, TypographyTextProps>(
202
226
  <Comp
203
227
  ref={ref}
204
228
  className={cn(
205
- typographyTextVariants({ variant, color, tabular, align }),
229
+ typographyTextVariants({ variant, color, tabular, align, truncate }),
206
230
  className
207
231
  )}
208
232
  data-hook={dataHook}
@@ -431,7 +431,7 @@ interface TypographyInlineCodeProps
431
431
  /**
432
432
  * Inline code component for code snippets within text.
433
433
  * Displays with monospace font and muted background.
434
- * @deprecated Use `<code className="text-code-inline">` inside a sentence (0.9em, inherits the line's height — semantic type scale, DS-714).
434
+ * @deprecated Use `<code className="text-code-inline">` inside a sentence (semantic type scale, DS-714).
435
435
  */
436
436
  const TypographyInlineCode = React.forwardRef<
437
437
  HTMLElement,
@@ -3,10 +3,11 @@ import * as React from "react";
3
3
  /**
4
4
  * Breakpoint name matching design token keys from `@brightlocal/tokens/breakpoints`.
5
5
  */
6
- type Breakpoint = "sm" | "md" | "lg" | "xl" | "2xl";
6
+ type Breakpoint = "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
7
7
 
8
8
  /** Fallback values when CSS variables are not available (e.g. SSR) */
9
9
  const BREAKPOINT_FALLBACKS: Record<Breakpoint, number> = {
10
+ xs: 480,
10
11
  sm: 640,
11
12
  md: 768,
12
13
  lg: 1024,
package/src/index.ts CHANGED
@@ -5,9 +5,11 @@ export * from "./components/alert-dialog";
5
5
  export * from "./components/aspect-ratio";
6
6
  export * from "./components/avatar";
7
7
  export * from "./components/badge";
8
+ export * from "./components/banner";
8
9
  export * from "./components/brand-illustration-motif";
9
10
  export * from "./components/breadcrumb";
10
11
  export * from "./components/button";
12
+ export * from "./components/button-group";
11
13
  export * from "./components/calendar";
12
14
  export * from "./components/callout";
13
15
  export * from "./components/card";
@@ -35,6 +37,7 @@ export * from "./components/grid";
35
37
  export * from "./components/header";
36
38
  export * from "./components/height-transition";
37
39
  export * from "./components/hover-card";
40
+ export * from "./components/info-tooltip";
38
41
  export * from "./components/input";
39
42
  export * from "./components/input-chip";
40
43
  export * from "./components/input-group";
@@ -47,6 +50,7 @@ export * from "./components/logo";
47
50
  export * from "./components/map";
48
51
  export * from "./components/media-empty";
49
52
  export * from "./components/menubar";
53
+ export * from "./components/multi-select-filter";
50
54
  export * from "./components/navigation-menu";
51
55
  export * from "./components/pagination";
52
56
  export * from "./components/input-password";
@@ -54,12 +58,14 @@ export * from "./components/popover";
54
58
  export * from "./components/progress";
55
59
  export * from "./components/radio-group";
56
60
  export * from "./components/rating";
61
+ export * from "./components/relative-date";
57
62
  export * from "./components/resizable";
58
63
  export * from "./components/route-progress";
59
64
  export * from "./components/scroll-area";
60
65
  export * from "./components/select";
61
66
  export * from "./components/separator";
62
67
  export * from "./components/sheet";
68
+ export * from "./components/single-select-filter";
63
69
  export * from "./components/skeleton";
64
70
  export * from "./components/slider";
65
71
  export * from "./components/sonner";
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { ILLUSTRATION_SIZES } from "@brightlocal/illustrations";
2
3
 
3
4
  /* -------------------------------------------------------------------------------------------------
4
5
  * BlockIllustration (internal)
@@ -38,8 +39,11 @@ import * as React from "react";
38
39
  * The artwork is the title's companion, not the subject of the screen: much
39
40
  * larger and it outweighs the 24px heading under it, and the eye lands on the
40
41
  * drawing instead of the words that say what to do next.
42
+ *
43
+ * This is the `md` step of the shared illustration scale, so a consumer who
44
+ * places the same artwork by hand with `size="md"` gets the identical size.
41
45
  */
42
- const BLOCK_ILLUSTRATION_SIZE = 130;
46
+ const BLOCK_ILLUSTRATION_SIZE = ILLUSTRATION_SIZES.md;
43
47
 
44
48
  /**
45
49
  * Props for the internal BlockIllustration wrapper.
@@ -0,0 +1,24 @@
1
+ import { cva } from "class-variance-authority";
2
+
3
+ /* -------------------------------------------------------------------------------------------------
4
+ * Empty chip (internal)
5
+ *
6
+ * The icon chip every "nothing here" moment shares — EmptyState at card
7
+ * scope, and CommandEmpty / ComboboxEmpty at popover scope. 40px of
8
+ * `bg-muted` around a 16px glyph. It lives once so the two cannot drift: the
9
+ * popover form used to be hand-rolled in consumer code with these classes
10
+ * copied in.
11
+ *
12
+ * A canvas drops the chip — but a canvas is a different component, so there
13
+ * is no variant for that here.
14
+ * -----------------------------------------------------------------------------------------------*/
15
+
16
+ export const emptyChipStyles = cva(
17
+ "bg-muted text-muted-foreground flex size-10 items-center justify-center rounded-full",
18
+ {
19
+ variants: {
20
+ align: { center: "", left: "shrink-0" },
21
+ },
22
+ defaultVariants: { align: "center" },
23
+ }
24
+ );
package/src/lib/utils.ts CHANGED
@@ -29,6 +29,7 @@ const twMerge = extendTailwindMerge({
29
29
  "body-xs",
30
30
  "label",
31
31
  "label-sm",
32
+ "field",
32
33
  "metric",
33
34
  "code",
34
35
  "code-inline",