@brightlocal/ui-components 3.4.0 → 3.5.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 (196) hide show
  1. package/AI_USAGE.md +22 -3
  2. package/README.md +177 -109
  3. package/component-meta.json +1061 -102
  4. package/dist/alert-dialog.cjs +1 -1
  5. package/dist/alert-dialog.d.ts +13 -2
  6. package/dist/alert-dialog.d.ts.map +1 -1
  7. package/dist/alert-dialog.js +4 -3
  8. package/dist/banner.cjs +1 -1
  9. package/dist/banner.d.ts +47 -11
  10. package/dist/banner.d.ts.map +1 -1
  11. package/dist/banner.js +156 -79
  12. package/dist/blocks/empty-state.cjs +1 -1
  13. package/dist/blocks/empty-state.d.ts +40 -5
  14. package/dist/blocks/empty-state.d.ts.map +1 -1
  15. package/dist/blocks/empty-state.js +59 -52
  16. package/dist/blocks/input-list.d.ts +1 -0
  17. package/dist/blocks/input-list.d.ts.map +1 -1
  18. package/dist/blocks/sidebar.cjs +1 -1
  19. package/dist/blocks/sidebar.d.ts +12 -6
  20. package/dist/blocks/sidebar.d.ts.map +1 -1
  21. package/dist/blocks/sidebar.js +64 -63
  22. package/dist/button.cjs +1 -1
  23. package/dist/button.d.ts.map +1 -1
  24. package/dist/button.js +47 -43
  25. package/dist/card.cjs +1 -1
  26. package/dist/card.d.ts +12 -0
  27. package/dist/card.d.ts.map +1 -1
  28. package/dist/card.js +115 -97
  29. package/dist/chart.cjs +6 -6
  30. package/dist/chart.d.ts +6 -10
  31. package/dist/chart.d.ts.map +1 -1
  32. package/dist/chart.js +281 -296
  33. package/dist/combobox.cjs +3 -3
  34. package/dist/combobox.d.ts.map +1 -1
  35. package/dist/combobox.js +430 -343
  36. package/dist/command.cjs +1 -1
  37. package/dist/command.d.ts +23 -2
  38. package/dist/command.d.ts.map +1 -1
  39. package/dist/command.js +212 -207
  40. package/dist/count-indicator.cjs +1 -0
  41. package/dist/count-indicator.d.ts +85 -0
  42. package/dist/count-indicator.d.ts.map +1 -0
  43. package/dist/count-indicator.js +72 -0
  44. package/dist/data-table.cjs +1 -1
  45. package/dist/data-table.d.ts +101 -11
  46. package/dist/data-table.d.ts.map +1 -1
  47. package/dist/data-table.js +593 -523
  48. package/dist/dialog.cjs +1 -1
  49. package/dist/dialog.d.ts +26 -3
  50. package/dist/dialog.d.ts.map +1 -1
  51. package/dist/dialog.js +62 -47
  52. package/dist/drawer.cjs +1 -1
  53. package/dist/drawer.d.ts +8 -4
  54. package/dist/drawer.d.ts.map +1 -1
  55. package/dist/drawer.js +37 -38
  56. package/dist/file-upload.cjs +1 -0
  57. package/dist/file-upload.d.ts +546 -0
  58. package/dist/file-upload.d.ts.map +1 -0
  59. package/dist/file-upload.js +1103 -0
  60. package/dist/global-layout.cjs +1 -1
  61. package/dist/global-layout.d.ts +7 -2
  62. package/dist/global-layout.d.ts.map +1 -1
  63. package/dist/global-layout.js +52 -52
  64. package/dist/hooks/use-file-dropzone.cjs +1 -0
  65. package/dist/hooks/use-file-dropzone.d.ts +75 -0
  66. package/dist/hooks/use-file-dropzone.d.ts.map +1 -0
  67. package/dist/hooks/use-file-dropzone.js +133 -0
  68. package/dist/hover-card.cjs +1 -1
  69. package/dist/hover-card.d.ts +29 -16
  70. package/dist/hover-card.d.ts.map +1 -1
  71. package/dist/hover-card.js +153 -36
  72. package/dist/index.cjs +1 -1
  73. package/dist/index.d.ts +3 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +676 -640
  76. package/dist/input-chip.cjs +1 -1
  77. package/dist/input-chip.d.ts +30 -1
  78. package/dist/input-chip.d.ts.map +1 -1
  79. package/dist/input-chip.js +131 -115
  80. package/dist/input-group.cjs +1 -1
  81. package/dist/input-group.d.ts +37 -2
  82. package/dist/input-group.d.ts.map +1 -1
  83. package/dist/input-group.js +131 -114
  84. package/dist/input-password.cjs +1 -1
  85. package/dist/input-password.js +6 -6
  86. package/dist/lib/empty-canvas.cjs +1 -1
  87. package/dist/lib/empty-canvas.d.ts +27 -1
  88. package/dist/lib/empty-canvas.d.ts.map +1 -1
  89. package/dist/lib/empty-canvas.js +27 -23
  90. package/dist/lib/empty-chip.cjs +1 -1
  91. package/dist/lib/empty-chip.d.ts +19 -2
  92. package/dist/lib/empty-chip.d.ts.map +1 -1
  93. package/dist/lib/empty-chip.js +14 -9
  94. package/dist/lib/field-aria.cjs +1 -1
  95. package/dist/lib/field-aria.d.ts +4 -4
  96. package/dist/lib/field-aria.d.ts.map +1 -1
  97. package/dist/lib/field-aria.js +7 -5
  98. package/dist/lib/media-viewer-content.cjs +1 -1
  99. package/dist/lib/media-viewer-content.js +1 -1
  100. package/dist/lib/table-internal.cjs +1 -1
  101. package/dist/lib/table-internal.d.ts +19 -0
  102. package/dist/lib/table-internal.d.ts.map +1 -1
  103. package/dist/lib/table-internal.js +22 -7
  104. package/dist/list.cjs +1 -1
  105. package/dist/list.d.ts +13 -0
  106. package/dist/list.d.ts.map +1 -1
  107. package/dist/list.js +103 -82
  108. package/dist/logo-mark.cjs +1 -1
  109. package/dist/logo-mark.d.ts +18 -2
  110. package/dist/logo-mark.d.ts.map +1 -1
  111. package/dist/logo-mark.js +159 -79
  112. package/dist/media-empty.cjs +1 -1
  113. package/dist/media-empty.d.ts +50 -7
  114. package/dist/media-empty.d.ts.map +1 -1
  115. package/dist/media-empty.js +14 -13
  116. package/dist/media-viewer.cjs +1 -1
  117. package/dist/media-viewer.js +6 -6
  118. package/dist/multi-select-filter.cjs +1 -1
  119. package/dist/multi-select-filter.d.ts.map +1 -1
  120. package/dist/multi-select-filter.js +92 -101
  121. package/dist/pagination.cjs +1 -1
  122. package/dist/pagination.d.ts +11 -0
  123. package/dist/pagination.d.ts.map +1 -1
  124. package/dist/pagination.js +17 -17
  125. package/dist/relative-date.d.ts +6 -0
  126. package/dist/relative-date.d.ts.map +1 -1
  127. package/dist/resizable.d.ts +1 -1
  128. package/dist/result-count.cjs +1 -1
  129. package/dist/result-count.d.ts +13 -16
  130. package/dist/result-count.d.ts.map +1 -1
  131. package/dist/result-count.js +24 -33
  132. package/dist/sheet.cjs +1 -1
  133. package/dist/sheet.d.ts +22 -3
  134. package/dist/sheet.d.ts.map +1 -1
  135. package/dist/sheet.js +152 -125
  136. package/dist/single-select-filter.cjs +1 -1
  137. package/dist/single-select-filter.d.ts.map +1 -1
  138. package/dist/single-select-filter.js +67 -76
  139. package/dist/table.cjs +1 -1
  140. package/dist/table.d.ts.map +1 -1
  141. package/dist/table.js +77 -76
  142. package/dist/tabs.cjs +1 -1
  143. package/dist/tabs.d.ts +39 -3
  144. package/dist/tabs.d.ts.map +1 -1
  145. package/dist/tabs.js +127 -76
  146. package/dist/textarea.cjs +1 -1
  147. package/dist/textarea.d.ts +34 -0
  148. package/dist/textarea.d.ts.map +1 -1
  149. package/dist/textarea.js +115 -19
  150. package/dist/tooltip.cjs +1 -1
  151. package/dist/tooltip.d.ts.map +1 -1
  152. package/dist/tooltip.js +137 -131
  153. package/dist/typography-text.cjs +1 -1
  154. package/dist/typography-text.d.ts +6 -2
  155. package/dist/typography-text.d.ts.map +1 -1
  156. package/dist/typography-text.js +14 -13
  157. package/package.json +3 -4
  158. package/src/blocks/empty-state.tsx +108 -48
  159. package/src/blocks/input-list.tsx +1 -0
  160. package/src/blocks/sidebar.tsx +39 -16
  161. package/src/components/alert-dialog.tsx +18 -2
  162. package/src/components/banner.tsx +247 -68
  163. package/src/components/button.tsx +27 -10
  164. package/src/components/card.tsx +89 -7
  165. package/src/components/chart.tsx +47 -67
  166. package/src/components/combobox.tsx +221 -12
  167. package/src/components/command.tsx +83 -37
  168. package/src/components/count-indicator.tsx +188 -0
  169. package/src/components/data-table.tsx +506 -159
  170. package/src/components/dialog.tsx +74 -5
  171. package/src/components/drawer.tsx +52 -32
  172. package/src/components/file-upload.tsx +2574 -0
  173. package/src/components/global-layout.tsx +18 -5
  174. package/src/components/hover-card.tsx +395 -65
  175. package/src/components/input-chip.tsx +67 -2
  176. package/src/components/input-group.tsx +89 -6
  177. package/src/components/list.tsx +40 -3
  178. package/src/components/logo-mark.tsx +109 -25
  179. package/src/components/media-empty.tsx +62 -7
  180. package/src/components/multi-select-filter.tsx +9 -16
  181. package/src/components/pagination.tsx +15 -2
  182. package/src/components/relative-date.tsx +6 -0
  183. package/src/components/result-count.tsx +27 -54
  184. package/src/components/sheet.tsx +86 -8
  185. package/src/components/single-select-filter.tsx +9 -16
  186. package/src/components/table.tsx +16 -1
  187. package/src/components/tabs.tsx +223 -41
  188. package/src/components/textarea.tsx +271 -4
  189. package/src/components/tooltip.tsx +29 -2
  190. package/src/components/typography-text.tsx +7 -2
  191. package/src/hooks/use-file-dropzone.ts +325 -0
  192. package/src/index.ts +3 -0
  193. package/src/lib/empty-canvas.tsx +47 -20
  194. package/src/lib/empty-chip.tsx +38 -3
  195. package/src/lib/field-aria.tsx +11 -6
  196. package/src/lib/table-internal.ts +38 -0
@@ -5,6 +5,8 @@ import { cva, type VariantProps } from "class-variance-authority";
5
5
 
6
6
  import { cn } from "@brightlocal/ui-components/lib/utils";
7
7
  import { Chip } from "@brightlocal/ui-components/chip";
8
+ import { useFieldDescribedBy } from "../lib/field-aria";
9
+ import { CountIndicator, type CountIndicatorProps } from "./count-indicator";
8
10
 
9
11
  /* -------------------------------------------------------------------------------------------------
10
12
  * InputChip Context
@@ -79,6 +81,7 @@ function useInputChipInput() {
79
81
  return context;
80
82
  }
81
83
 
84
+ /** Returns the combined InputChip context (value, dispatch, and input state). */
82
85
  function useInputChipContext(): InputChipContextValue {
83
86
  const dispatch = useInputChipDispatch();
84
87
  const { value, disabled } = useInputChipValue();
@@ -259,6 +262,10 @@ const inputChipInputVariants = cva(
259
262
  // Focus-within state (when input inside is focused)
260
263
  "has-[:focus-visible]:border-ring has-[:focus-visible]:bg-background",
261
264
  "has-[:focus-visible]:shadow-default",
265
+ // Over the count limit: error border (the message stays with the consumer)
266
+ "has-[[data-slot=count-indicator][data-state=over]]:border-destructive-40",
267
+ "has-[[data-slot=count-indicator][data-state=over]]:has-[:focus-visible]:border-destructive-40",
268
+ "has-[[data-slot=count-indicator][data-state=over]]:has-[:focus-visible]:shadow-destructive",
262
269
  // Disabled state
263
270
  "has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50",
264
271
  // Transition
@@ -389,6 +396,9 @@ const InputChipInput = React.forwardRef<HTMLInputElement, InputChipInputProps>(
389
396
  useInputChipDispatch();
390
397
  const { value, disabled } = useInputChipValue();
391
398
  const { inputValue } = useInputChipInput();
399
+ // Inside a Field the textbox also reads the FieldError, the hint and the
400
+ // count (InputChipCount); explicit ids from the consumer are kept.
401
+ const describedBy = useFieldDescribedBy(ariaDescribedby);
392
402
 
393
403
  // Expose the inner text input through the consumer's ref
394
404
  React.useImperativeHandle(ref, () => inputRef.current!, [inputRef]);
@@ -435,7 +445,7 @@ const InputChipInput = React.forwardRef<HTMLInputElement, InputChipInputProps>(
435
445
  {children}
436
446
  <input
437
447
  ref={inputRef as React.RefObject<HTMLInputElement>}
438
- aria-describedby={ariaDescribedby || undefined}
448
+ aria-describedby={describedBy || undefined}
439
449
  aria-invalid={hasError ? "true" : undefined}
440
450
  aria-label={ariaLabel}
441
451
  aria-labelledby={ariaLabelledby}
@@ -634,4 +644,59 @@ function InputChipItems({
634
644
  * Exports
635
645
  * -----------------------------------------------------------------------------------------------*/
636
646
 
637
- export { InputChip, InputChipInput, InputChipItems, useInputChipContext };
647
+ /* -------------------------------------------------------------------------------------------------
648
+ * InputChip Count (Items against a limit)
649
+ * -----------------------------------------------------------------------------------------------*/
650
+
651
+ /**
652
+ * Props for InputChipCount. `count` is optional: by default the chip field
653
+ * counts its items.
654
+ */
655
+ export interface InputChipCountProps extends Omit<
656
+ CountIndicatorProps,
657
+ "count"
658
+ > {
659
+ /**
660
+ * Count to show. Omit it to count the items in the chip field.
661
+ */
662
+ count?: number;
663
+ }
664
+
665
+ /**
666
+ * Count of items against a limit at the end of the last row of the chip field,
667
+ * such as `3 / 5`. Place it inside `InputChipInput`, next to `InputChipItems`.
668
+ *
669
+ * It never blocks adding. Over the limit the count turns red and the field
670
+ * takes the error border; show the error message and reject the save yourself
671
+ * (`onBeforeAdd` on `InputChip` can stop the add itself).
672
+ *
673
+ * @example
674
+ * ```tsx
675
+ * <InputChipInput dataHook="emails-input">
676
+ * <InputChipItems />
677
+ * <InputChipCount dataHook="emails-count" limit={5} />
678
+ * </InputChipInput>
679
+ * ```
680
+ */
681
+ const InputChipCount = React.forwardRef<HTMLSpanElement, InputChipCountProps>(
682
+ ({ className, count, ...props }, ref) => {
683
+ const { value } = useInputChipValue();
684
+ return (
685
+ <CountIndicator
686
+ ref={ref}
687
+ className={cn("order-last ml-auto pl-3", className)}
688
+ count={count ?? value.length}
689
+ {...props}
690
+ />
691
+ );
692
+ }
693
+ );
694
+ InputChipCount.displayName = "InputChipCount";
695
+
696
+ export {
697
+ InputChip,
698
+ InputChipCount,
699
+ InputChipInput,
700
+ InputChipItems,
701
+ useInputChipContext,
702
+ };
@@ -6,11 +6,18 @@ import { cva, type VariantProps } from "class-variance-authority";
6
6
  import { X } from "@brightlocal/icons";
7
7
 
8
8
  import { cn } from "@brightlocal/ui-components/lib/utils";
9
+ import { CountIndicator, type CountIndicatorProps } from "./count-indicator";
9
10
  import { Input, type InputProps } from "./input";
10
11
 
11
12
  interface InputGroupContextValue {
12
13
  /** Snapshot of the composed input's DOM state, kept fresh by InputGroupInput. */
13
- inputState: { hasValue: boolean; disabled: boolean };
14
+ inputState: {
15
+ hasValue: boolean;
16
+ length: number;
17
+ disabled: boolean;
18
+ /** False until the composed input has been read once. */
19
+ ready: boolean;
20
+ };
14
21
  /** Re-reads the composed input into `inputState`; cheap and safe to call often. */
15
22
  syncInputState: () => void;
16
23
  /**
@@ -36,7 +43,7 @@ const InputGroupContext = React.createContext<InputGroupContextValue | null>(
36
43
  );
37
44
 
38
45
  const inputGroupVariants = cva(
39
- "relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50",
46
+ "relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50 has-[[data-slot=count-indicator][data-state=over]]:border-destructive-40 has-[[data-slot=count-indicator][data-state=over]]:has-[input:focus-visible]:border-destructive-40 has-[[data-slot=count-indicator][data-state=over]]:has-[input:focus-visible]:shadow-destructive",
40
47
  {
41
48
  variants: {
42
49
  size: {
@@ -88,7 +95,9 @@ const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
88
95
  ) => {
89
96
  const [inputState, setInputState] = React.useState({
90
97
  hasValue: false,
98
+ length: 0,
91
99
  disabled: false,
100
+ ready: false,
92
101
  });
93
102
  const inputRef = React.useRef<HTMLInputElement | null>(null);
94
103
  const syncInputState = React.useCallback(() => {
@@ -97,10 +106,15 @@ const InputGroup = React.forwardRef<HTMLDivElement, InputGroupProps>(
97
106
  // not offer a clear affordance either.
98
107
  const next = {
99
108
  hasValue: !!input && input.value.length > 0,
109
+ length: input ? input.value.length : 0,
100
110
  disabled: !!input && (input.disabled || input.readOnly),
111
+ ready: true,
101
112
  };
102
113
  setInputState((prev) =>
103
- prev.hasValue === next.hasValue && prev.disabled === next.disabled
114
+ prev.hasValue === next.hasValue &&
115
+ prev.length === next.length &&
116
+ prev.disabled === next.disabled &&
117
+ prev.ready === next.ready
104
118
  ? prev
105
119
  : next
106
120
  );
@@ -248,9 +262,23 @@ const inputGroupAddonVariants = cva(
248
262
  "flex shrink-0 items-center text-muted-foreground",
249
263
  {
250
264
  variants: {
265
+ // The inner side (next to the group's border) is inset 12px so an icon
266
+ // or prefix never sits on the border. An addon holding a button keeps
267
+ // 4px: the button's own box centres its icon, which lands it on the
268
+ // same 12px line as a bare icon (icon-sm: 4px + 8px). The button case
269
+ // matches InputGroupButton by data-slot too, so an `asChild` link
270
+ // counts. The inset is a variable read by a plain padding utility, so
271
+ // a consumer's pl-*/pr-* replaces it through twMerge instead of losing
272
+ // to the more specific :has() selector.
251
273
  align: {
252
- "inline-start": "",
253
- "inline-end": "ml-auto",
274
+ "inline-start": [
275
+ "pl-(--input-group-addon-inset) [--input-group-addon-inset:--spacing(3)]",
276
+ "has-[>button,>[data-slot=input-group-button]]:[--input-group-addon-inset:--spacing(1)]",
277
+ ],
278
+ "inline-end": [
279
+ "ml-auto pr-(--input-group-addon-inset) [--input-group-addon-inset:--spacing(3)]",
280
+ "has-[>button,>[data-slot=input-group-button]]:[--input-group-addon-inset:--spacing(1)]",
281
+ ],
254
282
  "block-start": "self-start",
255
283
  "block-end": "self-end",
256
284
  },
@@ -264,7 +292,15 @@ const inputGroupAddonVariants = cva(
264
292
  interface InputGroupAddonProps
265
293
  extends
266
294
  React.HTMLAttributes<HTMLDivElement>,
267
- VariantProps<typeof inputGroupAddonVariants> {}
295
+ VariantProps<typeof inputGroupAddonVariants> {
296
+ /**
297
+ * Which side of the input the addon sits on. Inline addons are inset 12px
298
+ * on their inner side (4px when the addon holds an `InputGroupButton`, so
299
+ * the button's icon lands on the same line), so no padding is needed.
300
+ * @default "inline-start"
301
+ */
302
+ align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null;
303
+ }
268
304
 
269
305
  const InputGroupAddon = React.forwardRef<HTMLDivElement, InputGroupAddonProps>(
270
306
  ({ className, align, ...props }, ref) => {
@@ -280,6 +316,51 @@ const InputGroupAddon = React.forwardRef<HTMLDivElement, InputGroupAddonProps>(
280
316
  );
281
317
  InputGroupAddon.displayName = "InputGroupAddon";
282
318
 
319
+ /**
320
+ * Props for InputGroupCount. `count` is optional: by default the group counts
321
+ * the characters in its input.
322
+ */
323
+ interface InputGroupCountProps extends Omit<CountIndicatorProps, "count"> {
324
+ /**
325
+ * Count to show. Omit it to count the characters in the group's input; pass
326
+ * it when the group counts something else.
327
+ */
328
+ count?: number;
329
+ }
330
+
331
+ /**
332
+ * Count against a limit at the end of the group, such as `12 / 125`. Place it
333
+ * last, after the input (and before a clear button, if there is one).
334
+ *
335
+ * It never blocks typing. Over the limit the count turns red and the group
336
+ * takes the error border; show the error message and stop the save yourself.
337
+ *
338
+ * @example
339
+ * ```tsx
340
+ * <InputGroup dataHook="alt-group">
341
+ * <InputGroupInput value={alt} onChange={...} />
342
+ * <InputGroupCount dataHook="alt-count" limit={125} />
343
+ * </InputGroup>
344
+ * ```
345
+ */
346
+ const InputGroupCount = React.forwardRef<HTMLSpanElement, InputGroupCountProps>(
347
+ ({ className, count, ...props }, ref) => {
348
+ const context = React.useContext(InputGroupContext);
349
+ return (
350
+ <CountIndicator
351
+ ref={ref}
352
+ className={cn("pr-3", className)}
353
+ count={count ?? context?.inputState.length ?? 0}
354
+ // A saved value already over the limit is read on mount; that first
355
+ // read is not a crossing, so it stays silent.
356
+ ready={count !== undefined || (context?.inputState.ready ?? true)}
357
+ {...props}
358
+ />
359
+ );
360
+ }
361
+ );
362
+ InputGroupCount.displayName = "InputGroupCount";
363
+
283
364
  const inputGroupButtonVariants = cva(
284
365
  [
285
366
  "inline-flex items-center justify-center gap-2",
@@ -434,6 +515,7 @@ export {
434
515
  InputGroupAddon,
435
516
  InputGroupButton,
436
517
  InputGroupClear,
518
+ InputGroupCount,
437
519
  inputGroupVariants,
438
520
  inputGroupButtonVariants,
439
521
  };
@@ -443,4 +525,5 @@ export type {
443
525
  InputGroupAddonProps,
444
526
  InputGroupButtonProps,
445
527
  InputGroupClearProps,
528
+ InputGroupCountProps,
446
529
  };
@@ -80,6 +80,18 @@ export type ListProps = React.ComponentProps<"ul"> & {
80
80
  * @default false
81
81
  */
82
82
  divided?: boolean;
83
+ /**
84
+ * Wraps the whole group in one rounded border, for a list that sits on its
85
+ * own as a box (e.g. inside a sheet or dialog). The rows inside stay plain:
86
+ * no gap, no row radius and no row border, so `ListItem variant="outline"`
87
+ * renders as a plain row here instead of doubling the border. Rows get
88
+ * balanced padding inside the box, 16px at the sides and 12px top and
89
+ * bottom (on the ListItemButton / ListItemLink for a pressable row). Pair it with
90
+ * `divided` for a 1px line between rows. For separate bordered rows, use
91
+ * `ListItem variant="outline"` on a list without `bordered`.
92
+ * @default false
93
+ */
94
+ bordered?: boolean;
83
95
  /**
84
96
  * Tracking element identifier for analytics.
85
97
  */
@@ -122,8 +134,31 @@ const listVariants = cva(["flex", "flex-col"], {
122
134
  ],
123
135
  false: ["gap-2"],
124
136
  },
137
+ bordered: {
138
+ // One box round the group; the rows inside lose their own radius and
139
+ // border (the divided hairline is more specific, so it survives).
140
+ true: [
141
+ "gap-0",
142
+ "overflow-hidden",
143
+ "rounded-lg",
144
+ "border",
145
+ "border-border",
146
+ "[&>[data-slot=item]]:rounded-none",
147
+ "[&>[data-slot=item]]:border-0",
148
+ // Balanced padding inside the box (16px sides, 12px top and bottom)
149
+ // instead of the compact row's 8/8/16. A pressable row hands its
150
+ // padding to its ListItemButton / ListItemLink, so they get it there.
151
+ "[&>[data-slot=item]:not(:has(>[data-slot=item-button])):not(:has(>[data-slot=item-link]))]:px-4",
152
+ "[&>[data-slot=item]:not(:has(>[data-slot=item-button])):not(:has(>[data-slot=item-link]))]:py-3",
153
+ "[&>[data-slot=item]>[data-slot=item-button]]:px-4",
154
+ "[&>[data-slot=item]>[data-slot=item-button]]:py-3",
155
+ "[&>[data-slot=item]>[data-slot=item-link]]:px-4",
156
+ "[&>[data-slot=item]>[data-slot=item-link]]:py-3",
157
+ ],
158
+ false: [],
159
+ },
125
160
  },
126
- defaultVariants: { inset: false, divided: false },
161
+ defaultVariants: { inset: false, divided: false, bordered: false },
127
162
  });
128
163
 
129
164
  const List = React.forwardRef<HTMLUListElement, ListProps>(
@@ -135,13 +170,15 @@ const List = React.forwardRef<HTMLUListElement, ListProps>(
135
170
  trackingLabel,
136
171
  inset,
137
172
  divided,
173
+ bordered,
138
174
  ...props
139
175
  },
140
176
  ref
141
177
  ) => (
142
178
  <ul
143
179
  ref={ref}
144
- className={cn(listVariants({ inset, divided }), className)}
180
+ className={cn(listVariants({ inset, divided, bordered }), className)}
181
+ data-bordered={bordered ? "" : undefined}
145
182
  data-divided={divided ? "" : undefined}
146
183
  data-hook={dataHook}
147
184
  data-slot="list"
@@ -250,7 +287,7 @@ ListItem.displayName = "ListItem";
250
287
  const listItemMediaVariants = cva(["shrink-0"], {
251
288
  variants: {
252
289
  variant: {
253
- default: [],
290
+ default: ["group-data-[align=start]/item:mt-1"],
254
291
  icon: [
255
292
  "inline-flex",
256
293
  "size-10",
@@ -17,6 +17,15 @@ const SOURCE_ICON_ALIASES: Record<string, string> = {
17
17
  "google-ai-mode": "gemini",
18
18
  googleaio: "gemini",
19
19
  "google-ai-overviews": "gemini",
20
+ gbp: "google",
21
+ googlebusinessprofile: "google",
22
+ "google-business-profile": "google",
23
+ gmb: "google",
24
+ googlemybusiness: "google",
25
+ "google-my-business": "google",
26
+ applemaps: "apple-maps",
27
+ ga4: "google-analytics",
28
+ googleanalytics: "google-analytics",
20
29
  ypnetwork: "yellowpages",
21
30
  superpagesaus: "superpages",
22
31
  "192": "oneninetwo",
@@ -81,25 +90,75 @@ const logoMarkStyles = cva(
81
90
  transparent: "",
82
91
  filled: "overflow-hidden bg-muted",
83
92
  border: "border border-border",
93
+ success: "overflow-hidden bg-score-strong/15 text-score-strong-ink",
94
+ destructive: "overflow-hidden bg-score-poor/15 text-score-poor-ink",
95
+ },
96
+ shape: {
97
+ square: "",
98
+ circle: "",
84
99
  },
85
100
  },
86
101
  compoundVariants: [
87
- { variant: "filled", size: "xs", className: "size-5 rounded-md" },
88
- { variant: "filled", size: "sm", className: "size-6 rounded-md" },
89
- { variant: "filled", size: "md", className: "size-8 rounded-lg" },
90
- { variant: "filled", size: "lg", className: "size-10 rounded-lg" },
102
+ // contained (filled / success / destructive / border) — square
103
+ {
104
+ variant: ["filled", "success", "destructive", "border"],
105
+ size: "xs",
106
+ shape: "square",
107
+ className: "size-5 rounded-md",
108
+ },
109
+ {
110
+ variant: ["filled", "success", "destructive", "border"],
111
+ size: "sm",
112
+ shape: "square",
113
+ className: "size-6 rounded-md",
114
+ },
115
+ {
116
+ variant: ["filled", "success", "destructive", "border"],
117
+ size: "md",
118
+ shape: "square",
119
+ className: "size-8 rounded-lg",
120
+ },
121
+ {
122
+ variant: ["filled", "success", "destructive", "border"],
123
+ size: "lg",
124
+ shape: "square",
125
+ className: "size-10 rounded-lg",
126
+ },
127
+ // contained — circle
128
+ {
129
+ variant: ["filled", "success", "destructive", "border"],
130
+ size: "xs",
131
+ shape: "circle",
132
+ className: "size-5 rounded-full",
133
+ },
134
+ {
135
+ variant: ["filled", "success", "destructive", "border"],
136
+ size: "sm",
137
+ shape: "circle",
138
+ className: "size-6 rounded-full",
139
+ },
140
+ {
141
+ variant: ["filled", "success", "destructive", "border"],
142
+ size: "md",
143
+ shape: "circle",
144
+ className: "size-8 rounded-full",
145
+ },
146
+ {
147
+ variant: ["filled", "success", "destructive", "border"],
148
+ size: "lg",
149
+ shape: "circle",
150
+ className: "size-10 rounded-full",
151
+ },
152
+ // transparent (shape has no effect — no container to round)
91
153
  { variant: "transparent", size: "xs", className: "size-4" },
92
154
  { variant: "transparent", size: "sm", className: "size-5" },
93
155
  { variant: "transparent", size: "md", className: "size-6" },
94
156
  { variant: "transparent", size: "lg", className: "size-8" },
95
- { variant: "border", size: "xs", className: "size-5 rounded-md" },
96
- { variant: "border", size: "sm", className: "size-6 rounded-md" },
97
- { variant: "border", size: "md", className: "size-8 rounded-lg" },
98
- { variant: "border", size: "lg", className: "size-10 rounded-lg" },
99
157
  ],
100
158
  defaultVariants: {
101
159
  size: "md",
102
160
  variant: "filled",
161
+ shape: "square",
103
162
  },
104
163
  }
105
164
  );
@@ -111,26 +170,33 @@ const iconSizeMap = {
111
170
  lg: { contained: 22, bare: 32 },
112
171
  } as const;
113
172
 
114
- const fallbackTextStyles = cva(
115
- "select-none font-semibold text-muted-foreground",
116
- {
117
- variants: {
118
- size: {
119
- xs: "text-label-sm leading-none",
120
- sm: "text-label-sm leading-none",
121
- md: "text-label-sm leading-none",
122
- lg: "text-body-sm",
123
- },
173
+ const fallbackTextStyles = cva("select-none font-semibold", {
174
+ variants: {
175
+ size: {
176
+ xs: "text-label-sm leading-none",
177
+ sm: "text-label-sm leading-none",
178
+ md: "text-label-sm leading-none",
179
+ lg: "text-body-sm",
124
180
  },
125
- defaultVariants: {
126
- size: "md",
181
+ variant: {
182
+ transparent: "text-muted-foreground",
183
+ filled: "text-muted-foreground",
184
+ border: "text-muted-foreground",
185
+ success: "",
186
+ destructive: "",
127
187
  },
128
- }
129
- );
188
+ },
189
+ defaultVariants: {
190
+ size: "md",
191
+ variant: "filled",
192
+ },
193
+ });
130
194
 
131
195
  export type LogoMarkSize = "xs" | "sm" | "md" | "lg";
132
- export type LogoMarkVariant = "transparent" | "filled" | "border";
196
+ export type LogoMarkVariant =
197
+ "transparent" | "filled" | "border" | "success" | "destructive";
133
198
  export type LogoMarkColorScheme = "original" | "neutral";
199
+ export type LogoMarkShape = "square" | "circle";
134
200
 
135
201
  export interface LogoMarkProps
136
202
  extends
@@ -166,6 +232,10 @@ export interface LogoMarkProps
166
232
  * - `filled` — bg-muted rounded surface (default, safe for brand-colour icons)
167
233
  * - `border` — border ring with transparent background
168
234
  * - `transparent` — bare icon with no container
235
+ * - `success` — `bg-score-strong/15` with `text-score-strong-ink`, the Delta
236
+ * pill's tint and ink for a good outcome
237
+ * - `destructive` — `bg-score-poor/15` with `text-score-poor-ink`, the Delta
238
+ * pill's tint and ink for a bad outcome
169
239
  * @default "filled"
170
240
  */
171
241
  variant?: LogoMarkVariant;
@@ -176,6 +246,16 @@ export interface LogoMarkProps
176
246
  * @default "original"
177
247
  */
178
248
  colorScheme?: LogoMarkColorScheme;
249
+ /**
250
+ * Container shape.
251
+ * - `square` — rounded square (default); radius steps with size
252
+ * - `circle` — fully round (`rounded-full`); used for empty-state chips
253
+ * and file-upload dropzone feedback
254
+ *
255
+ * Ignored on `transparent`, which has no container to round.
256
+ * @default "square"
257
+ */
258
+ shape?: LogoMarkShape;
179
259
  /**
180
260
  * Override the fallback initial letter shown when no icon resolves.
181
261
  * Defaults to the first character of `name`.
@@ -211,6 +291,7 @@ const LogoMark = React.forwardRef<HTMLSpanElement, LogoMarkProps>(
211
291
  size = "md",
212
292
  variant = "filled",
213
293
  colorScheme = "original",
294
+ shape = "square",
214
295
  fallback,
215
296
  trackingEl,
216
297
  trackingLabel,
@@ -307,7 +388,7 @@ const LogoMark = React.forwardRef<HTMLSpanElement, LogoMarkProps>(
307
388
  ref={ref}
308
389
  aria-hidden={isDecorative ? "true" : undefined}
309
390
  aria-label={ariaLabel}
310
- className={cn(logoMarkStyles({ size, variant }), className)}
391
+ className={cn(logoMarkStyles({ size, variant, shape }), className)}
311
392
  data-hook={dataHook}
312
393
  data-slot="logo-mark"
313
394
  data-tracking-el={trackingEl ?? "logo-mark"}
@@ -329,7 +410,10 @@ const LogoMark = React.forwardRef<HTMLSpanElement, LogoMarkProps>(
329
410
  ) : (
330
411
  <span
331
412
  aria-hidden="true"
332
- className={fallbackTextStyles({ size })}
413
+ className={fallbackTextStyles({
414
+ size,
415
+ variant,
416
+ })}
333
417
  data-slot="logo-mark-fallback"
334
418
  >
335
419
  {initial}
@@ -32,6 +32,12 @@ import { EmptyCanvas } from "../lib/empty-canvas";
32
32
  * The frame is the consumer's and it stays put, so the layout never shifts when
33
33
  * the media arrives — and anything overlaid on the frame (a status Badge in a
34
34
  * corner) keeps working, because this fills the frame rather than replacing it.
35
+ *
36
+ * `size="sm"` is for slots under 48px — table thumbnails, list avatars
37
+ * (DS-1257). A 32px glyph and a line cannot centre in a 40px tile, so the
38
+ * compact canvas drops the line and draws a 20px glyph, keeping the surface and
39
+ * the glyph colour. `message` does not exist at sm: a thumbnail sits next to
40
+ * the row that names it, so it is decorative.
35
41
  * -----------------------------------------------------------------------------------------------*/
36
42
 
37
43
  /**
@@ -50,9 +56,16 @@ const VARIANT_DEFAULTS: Record<
50
56
  };
51
57
 
52
58
  /**
53
- * Props for the MediaEmpty component.
59
+ * How big the slot is. `md` is a real content box — a card's media, a photo
60
+ * well — and draws the 32px glyph with its line. `sm` is a slot under 48px — a
61
+ * table thumbnail, a list avatar — and draws a 20px glyph alone, centred.
54
62
  */
55
- export interface MediaEmptyProps extends Omit<
63
+ type MediaEmptySize = "md" | "sm";
64
+
65
+ /**
66
+ * Props shared by both sizes.
67
+ */
68
+ interface MediaEmptyBaseProps extends Omit<
56
69
  React.ComponentPropsWithoutRef<"div">,
57
70
  "children" | "title"
58
71
  > {
@@ -72,21 +85,52 @@ export interface MediaEmptyProps extends Omit<
72
85
  * @default the variant's glyph
73
86
  */
74
87
  icon?: React.ReactNode;
88
+ /**
89
+ * Tracking element identifier for analytics.
90
+ */
91
+ trackingEl?: string;
92
+ /**
93
+ * Tracking label for analytics context.
94
+ */
95
+ trackingLabel?: string;
96
+ }
97
+
98
+ /**
99
+ * MediaEmpty at md: a content-sized slot, glyph and line.
100
+ */
101
+ interface MediaEmptyMdProps extends MediaEmptyBaseProps {
102
+ /**
103
+ * The slot size — `md` for a content box, `sm` for a slot under 48px.
104
+ * @default "md"
105
+ */
106
+ size?: "md";
75
107
  /**
76
108
  * The one line under the glyph. No trailing period.
77
109
  * @default "No photo available" at variant image, "No video available" at variant video
78
110
  */
79
111
  message?: string;
112
+ }
113
+
114
+ /**
115
+ * MediaEmpty at sm: a slot under 48px, glyph only.
116
+ */
117
+ interface MediaEmptySmProps extends MediaEmptyBaseProps {
80
118
  /**
81
- * Tracking element identifier for analytics.
119
+ * The slot size — `md` for a content box, `sm` for a slot under 48px.
82
120
  */
83
- trackingEl?: string;
121
+ size: "sm";
84
122
  /**
85
- * Tracking label for analytics context.
123
+ * Not available at sm: a sub-48px slot has no room for a line, and a
124
+ * thumbnail is decorative next to the row that names it.
86
125
  */
87
- trackingLabel?: string;
126
+ message?: never;
88
127
  }
89
128
 
129
+ /**
130
+ * Props for the MediaEmpty component. `size` discriminates the two shapes.
131
+ */
132
+ export type MediaEmptyProps = MediaEmptyMdProps | MediaEmptySmProps;
133
+
90
134
  /**
91
135
  * A media slot with nothing in it — the reserved frame, filled with a muted
92
136
  * surface, a bare icon, and one quiet line.
@@ -113,6 +157,15 @@ export interface MediaEmptyProps extends Omit<
113
157
  * <AspectRatio dataHook="tour-video" ratio={16 / 9}>
114
158
  * <MediaEmpty dataHook="tour-video-empty" variant="video" />
115
159
  * </AspectRatio>
160
+ *
161
+ * // A 40px table thumbnail: the glyph alone, centred.
162
+ * <div className="size-10 shrink-0 overflow-hidden rounded-sm">
163
+ * {photoUrl ? (
164
+ * <img alt="" className="size-full object-cover" src={photoUrl} />
165
+ * ) : (
166
+ * <MediaEmpty dataHook="post-thumbnail-empty" size="sm" />
167
+ * )}
168
+ * </div>
116
169
  * ```
117
170
  */
118
171
  const MediaEmpty = React.forwardRef<HTMLDivElement, MediaEmptyProps>(
@@ -123,6 +176,7 @@ const MediaEmpty = React.forwardRef<HTMLDivElement, MediaEmptyProps>(
123
176
  variant = "image",
124
177
  icon,
125
178
  message,
179
+ size = "md",
126
180
  trackingEl,
127
181
  trackingLabel,
128
182
  ...props
@@ -141,6 +195,7 @@ const MediaEmpty = React.forwardRef<HTMLDivElement, MediaEmptyProps>(
141
195
  dataHook={dataHook}
142
196
  icon={icon ?? VARIANT_DEFAULTS[variant].icon}
143
197
  message={message ?? VARIANT_DEFAULTS[variant].message}
198
+ size={size}
144
199
  slot="media-empty"
145
200
  trackingEl={trackingEl}
146
201
  trackingLabel={trackingLabel}
@@ -153,4 +208,4 @@ MediaEmpty.displayName = "MediaEmpty";
153
208
 
154
209
  export { MediaEmpty };
155
210
 
156
- export type { MediaEmptyVariant };
211
+ export type { MediaEmptySize, MediaEmptyVariant };