@brightlocal/ui-components 2.25.0 → 2.27.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 (98) hide show
  1. package/README.md +4 -2
  2. package/component-meta.json +3809 -182
  3. package/dist/alert.cjs +1 -1
  4. package/dist/alert.d.ts +23 -9
  5. package/dist/alert.d.ts.map +1 -1
  6. package/dist/alert.js +95 -87
  7. package/dist/blocks/progress-screen.cjs +1 -0
  8. package/dist/blocks/progress-screen.d.ts +109 -0
  9. package/dist/blocks/progress-screen.d.ts.map +1 -0
  10. package/dist/blocks/progress-screen.js +339 -0
  11. package/dist/blocks/sidebar.cjs +1 -1
  12. package/dist/blocks/sidebar.d.ts.map +1 -1
  13. package/dist/blocks/sidebar.js +155 -153
  14. package/dist/brand-illustration-motif.d.ts +1 -1
  15. package/dist/breadcrumb.cjs +1 -1
  16. package/dist/breadcrumb.d.ts.map +1 -1
  17. package/dist/breadcrumb.js +44 -40
  18. package/dist/button.cjs +1 -1
  19. package/dist/button.d.ts.map +1 -1
  20. package/dist/button.js +28 -28
  21. package/dist/chip.cjs +1 -1
  22. package/dist/chip.d.ts +1 -1
  23. package/dist/chip.d.ts.map +1 -1
  24. package/dist/chip.js +42 -41
  25. package/dist/combobox.cjs +3 -3
  26. package/dist/combobox.d.ts +4 -2
  27. package/dist/combobox.d.ts.map +1 -1
  28. package/dist/combobox.js +161 -161
  29. package/dist/data-table.cjs +1 -1
  30. package/dist/data-table.d.ts +155 -4
  31. package/dist/data-table.d.ts.map +1 -1
  32. package/dist/data-table.js +462 -309
  33. package/dist/global-layout.cjs +1 -1
  34. package/dist/global-layout.d.ts +31 -5
  35. package/dist/global-layout.d.ts.map +1 -1
  36. package/dist/global-layout.js +276 -194
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.d.ts +3 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +462 -451
  41. package/dist/lib/motion.cjs +1 -1
  42. package/dist/lib/motion.js +10 -8
  43. package/dist/link.cjs +1 -1
  44. package/dist/link.d.ts +5 -2
  45. package/dist/link.d.ts.map +1 -1
  46. package/dist/link.js +97 -91
  47. package/dist/list.cjs +1 -1
  48. package/dist/list.js +65 -63
  49. package/dist/progress.cjs +1 -1
  50. package/dist/progress.d.ts +61 -3
  51. package/dist/progress.d.ts.map +1 -1
  52. package/dist/progress.js +142 -65
  53. package/dist/route-progress.cjs +1 -0
  54. package/dist/route-progress.d.ts +103 -0
  55. package/dist/route-progress.d.ts.map +1 -0
  56. package/dist/route-progress.js +106 -0
  57. package/dist/sheet.cjs +1 -1
  58. package/dist/sheet.d.ts +35 -2
  59. package/dist/sheet.d.ts.map +1 -1
  60. package/dist/sheet.js +102 -65
  61. package/dist/sonner.cjs +1 -1
  62. package/dist/sonner.d.ts.map +1 -1
  63. package/dist/sonner.js +11 -15
  64. package/dist/spinner.cjs +1 -0
  65. package/dist/spinner.d.ts +57 -0
  66. package/dist/spinner.d.ts.map +1 -0
  67. package/dist/spinner.js +35 -0
  68. package/dist/stepper.cjs +1 -1
  69. package/dist/stepper.d.ts.map +1 -1
  70. package/dist/stepper.js +26 -25
  71. package/dist/table.cjs +1 -1
  72. package/dist/table.d.ts +1 -1
  73. package/dist/table.d.ts.map +1 -1
  74. package/dist/table.js +6 -2
  75. package/package.json +15 -6
  76. package/src/blocks/progress-screen.tsx +481 -0
  77. package/src/blocks/sidebar.tsx +22 -15
  78. package/src/components/alert.tsx +68 -33
  79. package/src/components/breadcrumb.tsx +9 -4
  80. package/src/components/button.tsx +2 -5
  81. package/src/components/chip.tsx +4 -3
  82. package/src/components/combobox.tsx +15 -8
  83. package/src/components/data-table.tsx +358 -16
  84. package/src/components/global-layout.tsx +228 -62
  85. package/src/components/link.tsx +88 -63
  86. package/src/components/list.tsx +5 -5
  87. package/src/components/progress.tsx +217 -30
  88. package/src/components/route-progress.tsx +354 -0
  89. package/src/components/sheet.tsx +87 -5
  90. package/src/components/sonner.tsx +3 -12
  91. package/src/components/spinner.tsx +94 -0
  92. package/src/components/stepper.tsx +3 -4
  93. package/src/components/table.tsx +6 -2
  94. package/src/index.ts +3 -0
  95. package/dist/browser-entry.d.ts +0 -19
  96. package/dist/browser-entry.d.ts.map +0 -1
  97. package/src/browser-entry.ts +0 -99
  98. package/src/browser-tokens.css +0 -1
@@ -63,15 +63,7 @@ const AlertDescription = React.forwardRef<
63
63
  ));
64
64
  AlertDescription.displayName = "AlertDescription";
65
65
 
66
- interface AlertContentProps {
67
- /**
68
- * Optional title for the alert
69
- */
70
- title?: string;
71
- /**
72
- * Description text for the alert (REQUIRED)
73
- */
74
- description: React.ReactNode;
66
+ interface AlertContentBaseProps {
75
67
  /**
76
68
  * Additional CSS classes
77
69
  */
@@ -94,6 +86,33 @@ interface AlertContentProps {
94
86
  trackingLabel?: string;
95
87
  }
96
88
 
89
+ /**
90
+ * At least one of `title` or `description` must be provided.
91
+ */
92
+ type AlertContentProps = AlertContentBaseProps &
93
+ (
94
+ | {
95
+ /**
96
+ * Title for the alert
97
+ */
98
+ title: string;
99
+ /**
100
+ * Optional description text for the alert
101
+ */
102
+ description?: React.ReactNode;
103
+ }
104
+ | {
105
+ /**
106
+ * Optional title for the alert
107
+ */
108
+ title?: string;
109
+ /**
110
+ * Description text for the alert
111
+ */
112
+ description: React.ReactNode;
113
+ }
114
+ );
115
+
97
116
  function AlertSuccess({
98
117
  title,
99
118
  description,
@@ -105,18 +124,22 @@ function AlertSuccess({
105
124
  }: AlertContentProps) {
106
125
  return (
107
126
  <Alert
108
- className={className}
127
+ className={cn("items-center", className)}
109
128
  data-hook={dataHook}
110
129
  data-tracking-el={trackingEl}
111
130
  data-tracking-label={trackingLabel}
112
131
  variant="success"
113
132
  >
114
- <CircleCheck className="text-success-foreground shrink-0 translate-y-0.5" />
115
- <div className="flex min-w-0 flex-1 flex-col gap-1">
116
- {title && <AlertTitle>{title}</AlertTitle>}
117
- <AlertDescription>{description}</AlertDescription>
133
+ <div className="flex min-w-0 flex-1 items-start gap-3">
134
+ <CircleCheck className="text-success-foreground shrink-0 translate-y-0.5" />
135
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
136
+ {title && <AlertTitle>{title}</AlertTitle>}
137
+ {description != null && (
138
+ <AlertDescription>{description}</AlertDescription>
139
+ )}
140
+ </div>
118
141
  </div>
119
- {action && <div className="self-center">{action}</div>}
142
+ {action && <div className="shrink-0 self-center">{action}</div>}
120
143
  </Alert>
121
144
  );
122
145
  }
@@ -132,18 +155,22 @@ function AlertInfo({
132
155
  }: AlertContentProps) {
133
156
  return (
134
157
  <Alert
135
- className={className}
158
+ className={cn("items-center", className)}
136
159
  data-hook={dataHook}
137
160
  data-tracking-el={trackingEl}
138
161
  data-tracking-label={trackingLabel}
139
162
  variant="info"
140
163
  >
141
- <Info className="text-info-foreground shrink-0 translate-y-0.5" />
142
- <div className="flex min-w-0 flex-1 flex-col gap-1">
143
- {title && <AlertTitle>{title}</AlertTitle>}
144
- <AlertDescription>{description}</AlertDescription>
164
+ <div className="flex min-w-0 flex-1 items-start gap-3">
165
+ <Info className="text-info-foreground shrink-0 translate-y-0.5" />
166
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
167
+ {title && <AlertTitle>{title}</AlertTitle>}
168
+ {description != null && (
169
+ <AlertDescription>{description}</AlertDescription>
170
+ )}
171
+ </div>
145
172
  </div>
146
- {action && <div className="self-center">{action}</div>}
173
+ {action && <div className="shrink-0 self-center">{action}</div>}
147
174
  </Alert>
148
175
  );
149
176
  }
@@ -159,18 +186,22 @@ function AlertDestructive({
159
186
  }: AlertContentProps) {
160
187
  return (
161
188
  <Alert
162
- className={className}
189
+ className={cn("items-center", className)}
163
190
  data-hook={dataHook}
164
191
  data-tracking-el={trackingEl}
165
192
  data-tracking-label={trackingLabel}
166
193
  variant="destructive"
167
194
  >
168
- <CircleX className="text-destructive-foreground shrink-0 translate-y-0.5" />
169
- <div className="flex min-w-0 flex-1 flex-col gap-1">
170
- {title && <AlertTitle>{title}</AlertTitle>}
171
- <AlertDescription>{description}</AlertDescription>
195
+ <div className="flex min-w-0 flex-1 items-start gap-3">
196
+ <CircleX className="text-destructive-foreground shrink-0 translate-y-0.5" />
197
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
198
+ {title && <AlertTitle>{title}</AlertTitle>}
199
+ {description != null && (
200
+ <AlertDescription>{description}</AlertDescription>
201
+ )}
202
+ </div>
172
203
  </div>
173
- {action && <div className="self-center">{action}</div>}
204
+ {action && <div className="shrink-0 self-center">{action}</div>}
174
205
  </Alert>
175
206
  );
176
207
  }
@@ -186,18 +217,22 @@ function AlertWarning({
186
217
  }: AlertContentProps) {
187
218
  return (
188
219
  <Alert
189
- className={className}
220
+ className={cn("items-center", className)}
190
221
  data-hook={dataHook}
191
222
  data-tracking-el={trackingEl}
192
223
  data-tracking-label={trackingLabel}
193
224
  variant="warning"
194
225
  >
195
- <TriangleAlert className="text-warning-foreground shrink-0 translate-y-0.5" />
196
- <div className="flex min-w-0 flex-1 flex-col gap-1">
197
- {title && <AlertTitle>{title}</AlertTitle>}
198
- <AlertDescription>{description}</AlertDescription>
226
+ <div className="flex min-w-0 flex-1 items-start gap-3">
227
+ <TriangleAlert className="text-warning-foreground shrink-0 translate-y-0.5" />
228
+ <div className="flex min-w-0 flex-1 flex-col gap-1">
229
+ {title && <AlertTitle>{title}</AlertTitle>}
230
+ {description != null && (
231
+ <AlertDescription>{description}</AlertDescription>
232
+ )}
233
+ </div>
199
234
  </div>
200
- {action && <div className="self-center">{action}</div>}
235
+ {action && <div className="shrink-0 self-center">{action}</div>}
201
236
  </Alert>
202
237
  );
203
238
  }
@@ -57,8 +57,11 @@ const BreadcrumbList = React.forwardRef<
57
57
  >(({ className, ...props }, ref) => (
58
58
  <ol
59
59
  ref={ref}
60
+ // Trails never wrap (NP breadcrumb spec) — a wrapped trail reads as two
61
+ // trails. Overflow is handled by collapsing the middle behind an
62
+ // ellipsis and truncating the location crumb, not by wrapping.
60
63
  className={cn(
61
- "text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",
64
+ "text-muted-foreground flex min-w-0 flex-nowrap items-center gap-1.5 text-sm whitespace-nowrap sm:gap-2.5",
62
65
  className
63
66
  )}
64
67
  data-slot="breadcrumb-list"
@@ -178,18 +181,20 @@ const BreadcrumbEllipsis = React.forwardRef<
178
181
  BreadcrumbEllipsisProps
179
182
  >(({ className, srLabel = "More", ...props }, ref) => {
180
183
  return (
184
+ // aria-hidden sits on the icon, not the wrapper — hiding the wrapper
185
+ // would also silence the sr-only label, and the ellipsis must stay
186
+ // announceable when wrapped in a DropdownMenuTrigger to reveal the
187
+ // collapsed pages.
181
188
  <span
182
189
  ref={ref}
183
- aria-hidden="true"
184
190
  className={cn(
185
191
  "relative flex size-9 items-center justify-center",
186
192
  className
187
193
  )}
188
194
  data-slot="breadcrumb-ellipsis"
189
- role="presentation"
190
195
  {...props}
191
196
  >
192
- <MoreHorizontal />
197
+ <MoreHorizontal aria-hidden="true" />
193
198
  <span className="sr-only">{srLabel}</span>
194
199
  </span>
195
200
  );
@@ -1,12 +1,9 @@
1
1
  import * as React from "react";
2
2
  import { Slot } from "@radix-ui/react-slot";
3
3
  import { cva } from "class-variance-authority";
4
- import { Loader2 } from "@brightlocal/icons";
5
4
 
6
5
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
-
8
- // Shared constants
9
- const BUTTON_SPINNER_SIZE = 16;
6
+ import { Spinner } from "@brightlocal/ui-components/spinner";
10
7
 
11
8
  /**
12
9
  * Variant props for CVA button styling
@@ -269,7 +266,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
269
266
  className="pointer-events-none flex items-center justify-center"
270
267
  data-slot="button-loading-icon"
271
268
  >
272
- <Loader2 className="animate-spin" size={BUTTON_SPINNER_SIZE} />
269
+ <Spinner size="md" />
273
270
  </div>
274
271
  )}
275
272
  {children}
@@ -2,9 +2,10 @@
2
2
 
3
3
  import * as React from "react";
4
4
  import { cva } from "class-variance-authority";
5
- import { X, LoaderCircle } from "@brightlocal/icons";
5
+ import { X } from "@brightlocal/icons";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
+ import { Spinner } from "@brightlocal/ui-components/spinner";
8
9
  import {
9
10
  Tooltip,
10
11
  TooltipContent,
@@ -173,7 +174,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
173
174
  ref
174
175
  ) => {
175
176
  const isDisabled = disabled || loading;
176
- const iconSize = size === "lg" ? 16 : 16;
177
+ const iconSize = size === "lg" ? 16 : 14;
177
178
  const labelRef = React.useRef<HTMLSpanElement>(null);
178
179
  const [isTruncated, setIsTruncated] = React.useState(false);
179
180
 
@@ -232,7 +233,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
232
233
  data-slot="chip-loading"
233
234
  role="status"
234
235
  >
235
- <LoaderCircle className="animate-spin" size={iconSize} />
236
+ <Spinner size={size === "lg" ? "md" : "sm"} />
236
237
  </span>
237
238
  ) : (
238
239
  <button
@@ -22,6 +22,7 @@ import {
22
22
  CommandList,
23
23
  CommandSeparator,
24
24
  } from "@brightlocal/ui-components/command";
25
+ import { Spinner } from "@brightlocal/ui-components/spinner";
25
26
 
26
27
  /* -------------------------------------------------------------------------------------------------
27
28
  * Combobox Context
@@ -1579,8 +1580,10 @@ export interface ComboboxLoadingProps {
1579
1580
  /** Children - custom loading content */
1580
1581
  children?: React.ReactNode;
1581
1582
  /**
1582
- * Loading text displayed next to the spinner.
1583
- * @default "Loading..."
1583
+ * Loading announcement for assistive technologies (visually hidden).
1584
+ * The default loading state is a spinner only — the surrounding combobox
1585
+ * makes the context unambiguous, so visible text would be noise.
1586
+ * @default "Loading suggestions"
1584
1587
  */
1585
1588
  loadingText?: string;
1586
1589
  }
@@ -1594,7 +1597,12 @@ function ComboboxLoading({
1594
1597
  <div
1595
1598
  aria-live="polite"
1596
1599
  className={cn(
1597
- "text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",
1600
+ // The entrance fade doubles as a ~150ms appearance delay (`both`
1601
+ // holds the hidden start): a fetch that resolves faster than the
1602
+ // delay never flashes a spinner, which would read slower than no
1603
+ // indicator at all.
1604
+ "text-muted-foreground relative flex items-center justify-center gap-2 py-6 text-sm",
1605
+ "animate-entrance-fade entrance-delay-1",
1598
1606
  className
1599
1607
  )}
1600
1608
  data-slot="combobox-loading"
@@ -1602,11 +1610,10 @@ function ComboboxLoading({
1602
1610
  >
1603
1611
  {children || (
1604
1612
  <>
1605
- <div
1606
- aria-hidden="true"
1607
- className="size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"
1608
- />
1609
- {loadingText ?? "Loading..."}
1613
+ <Spinner size="md" />
1614
+ <span className="sr-only">
1615
+ {loadingText ?? "Loading suggestions"}
1616
+ </span>
1610
1617
  </>
1611
1618
  )}
1612
1619
  </div>