@fanvue/ui 3.22.0 → 3.24.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 (121) hide show
  1. package/dist/charts.d.ts +94 -4
  2. package/dist/charts.mjs +4 -0
  3. package/dist/charts.mjs.map +1 -1
  4. package/dist/cjs/charts.cjs +4 -0
  5. package/dist/cjs/charts.cjs.map +1 -1
  6. package/dist/cjs/components/AiButton/AiButton.cjs +170 -0
  7. package/dist/cjs/components/AiButton/AiButton.cjs.map +1 -0
  8. package/dist/cjs/components/AnimatedNumber/AnimatedNumber.cjs +170 -0
  9. package/dist/cjs/components/AnimatedNumber/AnimatedNumber.cjs.map +1 -0
  10. package/dist/cjs/components/ButtonIconGroup/ButtonIconGroup.cjs +58 -0
  11. package/dist/cjs/components/ButtonIconGroup/ButtonIconGroup.cjs.map +1 -0
  12. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs +24 -2
  13. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs.map +1 -1
  14. package/dist/cjs/components/Chart/ChartMetricTrend.cjs +71 -0
  15. package/dist/cjs/components/Chart/ChartMetricTrend.cjs.map +1 -0
  16. package/dist/cjs/components/Chart/ChartSkeleton.cjs +95 -0
  17. package/dist/cjs/components/Chart/ChartSkeleton.cjs.map +1 -0
  18. package/dist/cjs/components/Chip/Chip.cjs +40 -11
  19. package/dist/cjs/components/Chip/Chip.cjs.map +1 -1
  20. package/dist/cjs/components/CountryFlag/CountryFlag.cjs +91 -0
  21. package/dist/cjs/components/CountryFlag/CountryFlag.cjs.map +1 -0
  22. package/dist/cjs/components/CountryFlag/flagShapes.cjs +3358 -0
  23. package/dist/cjs/components/CountryFlag/flagShapes.cjs.map +1 -0
  24. package/dist/cjs/components/CreatorTile/CreatorTile.cjs +2 -1
  25. package/dist/cjs/components/CreatorTile/CreatorTile.cjs.map +1 -1
  26. package/dist/cjs/components/CyclingText/CyclingText.cjs +9 -26
  27. package/dist/cjs/components/CyclingText/CyclingText.cjs.map +1 -1
  28. package/dist/cjs/components/CyclingText/useCyclingMotion.cjs +53 -0
  29. package/dist/cjs/components/CyclingText/useCyclingMotion.cjs.map +1 -0
  30. package/dist/cjs/components/Demographics/Demographics.cjs +39 -0
  31. package/dist/cjs/components/Demographics/Demographics.cjs.map +1 -0
  32. package/dist/cjs/components/Drawer/Drawer.cjs +9 -1
  33. package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
  34. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +122 -16
  35. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
  36. package/dist/cjs/components/IconButton/IconButton.cjs +11 -1
  37. package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
  38. package/dist/cjs/components/ProgressBar/ProgressBar.cjs +9 -1
  39. package/dist/cjs/components/ProgressBar/ProgressBar.cjs.map +1 -1
  40. package/dist/cjs/components/Tabs/TabsList.cjs +123 -91
  41. package/dist/cjs/components/Tabs/TabsList.cjs.map +1 -1
  42. package/dist/cjs/components/Tooltip/Tooltip.cjs +36 -25
  43. package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
  44. package/dist/cjs/components/Tooltip/TooltipLabel.cjs +71 -0
  45. package/dist/cjs/components/Tooltip/TooltipLabel.cjs.map +1 -0
  46. package/dist/cjs/components/TrendPill/TrendPill.cjs +46 -0
  47. package/dist/cjs/components/TrendPill/TrendPill.cjs.map +1 -0
  48. package/dist/cjs/components/UserDisplayName/UserDisplayName.cjs +13 -1
  49. package/dist/cjs/components/UserDisplayName/UserDisplayName.cjs.map +1 -1
  50. package/dist/cjs/components/UserItem/UserItem.cjs +21 -2
  51. package/dist/cjs/components/UserItem/UserItem.cjs.map +1 -1
  52. package/dist/cjs/components/UserItem/UserItemTrailing.cjs +34 -0
  53. package/dist/cjs/components/UserItem/UserItemTrailing.cjs.map +1 -0
  54. package/dist/cjs/flags.cjs +6 -0
  55. package/dist/cjs/flags.cjs.map +1 -0
  56. package/dist/cjs/index.cjs +15 -0
  57. package/dist/cjs/index.cjs.map +1 -1
  58. package/dist/cjs/{components/CyclingText → utils}/usePrefersReducedMotion.cjs +14 -14
  59. package/dist/cjs/utils/usePrefersReducedMotion.cjs.map +1 -0
  60. package/dist/components/AiButton/AiButton.mjs +153 -0
  61. package/dist/components/AiButton/AiButton.mjs.map +1 -0
  62. package/dist/components/AnimatedNumber/AnimatedNumber.mjs +153 -0
  63. package/dist/components/AnimatedNumber/AnimatedNumber.mjs.map +1 -0
  64. package/dist/components/ButtonIconGroup/ButtonIconGroup.mjs +41 -0
  65. package/dist/components/ButtonIconGroup/ButtonIconGroup.mjs.map +1 -0
  66. package/dist/components/Chart/ChartLoadingOverlay.mjs +24 -2
  67. package/dist/components/Chart/ChartLoadingOverlay.mjs.map +1 -1
  68. package/dist/components/Chart/ChartMetricTrend.mjs +54 -0
  69. package/dist/components/Chart/ChartMetricTrend.mjs.map +1 -0
  70. package/dist/components/Chart/ChartSkeleton.mjs +78 -0
  71. package/dist/components/Chart/ChartSkeleton.mjs.map +1 -0
  72. package/dist/components/Chip/Chip.mjs +40 -11
  73. package/dist/components/Chip/Chip.mjs.map +1 -1
  74. package/dist/components/CountryFlag/CountryFlag.mjs +74 -0
  75. package/dist/components/CountryFlag/CountryFlag.mjs.map +1 -0
  76. package/dist/components/CountryFlag/flagShapes.mjs +3358 -0
  77. package/dist/components/CountryFlag/flagShapes.mjs.map +1 -0
  78. package/dist/components/CreatorTile/CreatorTile.mjs +2 -1
  79. package/dist/components/CreatorTile/CreatorTile.mjs.map +1 -1
  80. package/dist/components/CyclingText/CyclingText.mjs +9 -26
  81. package/dist/components/CyclingText/CyclingText.mjs.map +1 -1
  82. package/dist/components/CyclingText/useCyclingMotion.mjs +36 -0
  83. package/dist/components/CyclingText/useCyclingMotion.mjs.map +1 -0
  84. package/dist/components/Demographics/Demographics.mjs +22 -0
  85. package/dist/components/Demographics/Demographics.mjs.map +1 -0
  86. package/dist/components/Drawer/Drawer.mjs +9 -1
  87. package/dist/components/Drawer/Drawer.mjs.map +1 -1
  88. package/dist/components/DropdownMenu/DropdownMenu.mjs +122 -16
  89. package/dist/components/DropdownMenu/DropdownMenu.mjs.map +1 -1
  90. package/dist/components/IconButton/IconButton.mjs +11 -1
  91. package/dist/components/IconButton/IconButton.mjs.map +1 -1
  92. package/dist/components/ProgressBar/ProgressBar.mjs +9 -1
  93. package/dist/components/ProgressBar/ProgressBar.mjs.map +1 -1
  94. package/dist/components/Tabs/TabsList.mjs +123 -91
  95. package/dist/components/Tabs/TabsList.mjs.map +1 -1
  96. package/dist/components/Tooltip/Tooltip.mjs +37 -26
  97. package/dist/components/Tooltip/Tooltip.mjs.map +1 -1
  98. package/dist/components/Tooltip/TooltipLabel.mjs +54 -0
  99. package/dist/components/Tooltip/TooltipLabel.mjs.map +1 -0
  100. package/dist/components/TrendPill/TrendPill.mjs +29 -0
  101. package/dist/components/TrendPill/TrendPill.mjs.map +1 -0
  102. package/dist/components/UserDisplayName/UserDisplayName.mjs +13 -1
  103. package/dist/components/UserDisplayName/UserDisplayName.mjs.map +1 -1
  104. package/dist/components/UserItem/UserItem.mjs +21 -2
  105. package/dist/components/UserItem/UserItem.mjs.map +1 -1
  106. package/dist/components/UserItem/UserItemTrailing.mjs +17 -0
  107. package/dist/components/UserItem/UserItemTrailing.mjs.map +1 -0
  108. package/dist/flags.d.ts +59 -0
  109. package/dist/flags.mjs +6 -0
  110. package/dist/flags.mjs.map +1 -0
  111. package/dist/index.d.ts +458 -19
  112. package/dist/index.mjs +16 -1
  113. package/dist/index.mjs.map +1 -1
  114. package/dist/styles/base.css +166 -0
  115. package/dist/styles/theme.css +12 -0
  116. package/dist/utils/usePrefersReducedMotion.mjs +22 -0
  117. package/dist/utils/usePrefersReducedMotion.mjs.map +1 -0
  118. package/package.json +13 -2
  119. package/dist/cjs/components/CyclingText/usePrefersReducedMotion.cjs.map +0 -1
  120. package/dist/components/CyclingText/usePrefersReducedMotion.mjs +0 -22
  121. package/dist/components/CyclingText/usePrefersReducedMotion.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipLabel.mjs","sources":["../../../src/components/Tooltip/TooltipLabel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"./Tooltip\";\n\n/** Props for {@link TooltipLabel}. */\nexport interface TooltipLabelProps\n // `title` is omitted so a native browser tooltip cannot appear alongside the\n // Radix one on the same element. `TooltipContentProps` omits it too.\n extends Omit<React.ComponentPropsWithoutRef<\"button\">, \"title\"> {\n /** Tooltip content. Pass a translated string for i18n. */\n tooltip: React.ReactNode;\n /** The label text, which doubles as the trigger. */\n children: React.ReactNode;\n}\n\n/**\n * A text label that is itself the tooltip trigger, marked by a dashed\n * underline. Use this instead of pairing a label with a separate info glyph:\n * the visible text becomes the trigger's accessible name, and the row stays at\n * text height rather than being stretched by an icon button.\n *\n * The label is repeated as the tooltip's heading, so the tooltip reads as the\n * two-row block the design specifies — the term, then what it means.\n *\n * Tapping the label toggles the tooltip on touch devices, where there is no\n * hover to trigger it. Tapping elsewhere, scrolling, or opening another tooltip\n * dismisses it.\n *\n * @example\n * ```tsx\n * <TooltipLabel tooltip=\"Total earnings for the selected period.\">Total Earnings</TooltipLabel>\n * ```\n */\nexport const TooltipLabel = React.forwardRef<HTMLButtonElement, TooltipLabelProps>(\n ({ tooltip, children, className, onClick, onPointerDown, onBlur, ...props }, ref) => {\n /*\n * Touch has to drive the tooltip from the tap itself, not from focus.\n *\n * Radix's trigger ignores pointer events whose `pointerType` is \"touch\", so\n * hover never opens the tooltip on a phone; focus is the only thing that\n * does. That is not enough on its own for two reasons, and both need the\n * open state controlled here:\n *\n * - The trigger closes on click. Since the tap that focuses the label is\n * also a click, focus opens the tooltip and the click immediately shuts\n * it, so it only flashes.\n * - After the first tap the label keeps focus. Dismissing the tooltip by\n * tapping elsewhere leaves it focused, so a second tap fires no focus\n * event and nothing would reopen it.\n *\n * Radix composes trigger handlers with `checkForDefaultPrevented`, so\n * calling `preventDefault` makes it skip its own open/close and leaves the\n * toggle below in charge. Dismissal still comes from Radix: `TooltipContent`\n * closes on outside pointerdown, Escape, scroll, and when another tooltip\n * opens.\n *\n * All of this is scoped to touch, so mouse and keyboard behave as before.\n */\n const [open, setOpen] = React.useState(false);\n const pointerTypeRef = React.useRef<string>(\"\");\n /**\n * The open state as it was when the tap began. The trigger's own pointerdown\n * close lands between pointerdown and click, so toggling against the live\n * state would read the value Radix just reset and reopen on every tap.\n */\n const openAtTapStartRef = React.useRef(false);\n\n const isTouch = () => pointerTypeRef.current === \"touch\";\n\n return (\n <TooltipProvider>\n <Tooltip open={open} onOpenChange={setOpen}>\n <TooltipTrigger asChild>\n <button\n ref={ref}\n type=\"button\"\n className={cn(\n // `w-fit` keeps the trigger the size of its label. The button is\n // block-level, so a column flex or grid cell would otherwise stretch it\n // and the whole row would answer to hover with a help cursor, opening\n // this label's tooltip from a long way away from the label.\n \"typography-body-small-14px-regular w-fit cursor-help rounded-2xs text-left text-content-secondary outline-none\",\n \"hover:text-content-primary focus-visible:shadow-focus-ring\",\n className,\n )}\n onPointerDown={(event) => {\n pointerTypeRef.current = event.pointerType;\n openAtTapStartRef.current = open;\n onPointerDown?.(event);\n }}\n onClick={(event) => {\n onClick?.(event);\n if (!isTouch()) return;\n event.preventDefault();\n setOpen(!openAtTapStartRef.current);\n }}\n onBlur={(event) => {\n // Forget the pointer type once the label loses focus, so a later\n // keyboard focus still opens the tooltip on a device that has\n // both a touchscreen and a keyboard.\n pointerTypeRef.current = \"\";\n onBlur?.(event);\n }}\n {...props}\n >\n {/*\n * The dash lives on this inline span, not the button. The button is a\n * block-level trigger and stretches to whatever its container gives it —\n * a column flex or grid cell makes it full width — which dragged the\n * underline across the whole row instead of the label.\n *\n * Anchor the 4-on/4-off tile to the left edge. A centred position (the\n * `bg-bottom` default) lays the pattern out from the middle outward and\n * clips mid-dash at the start of the label as well as the end.\n *\n * No bottom padding: the dash sits in the descender space the 18px\n * line-height already leaves under the 14px text. Padding it out made\n * the label 20px, and since this label is the entire header of a\n * title-only insight card, that put the card over its designed height.\n */}\n <span className=\"bg-[length:8px_1px] bg-[linear-gradient(to_right,var(--color-icons-tertiary)_0_4px,transparent_4px_8px)] bg-bottom-left bg-repeat-x\">\n {children}\n </span>\n </button>\n </TooltipTrigger>\n {/*\n * The heading is hidden from assistive tech. Radix wires the whole content\n * as the trigger's `aria-describedby`, and the trigger's name is already\n * this same label, so leaving it exposed described the button as\n * \"Total EarningsTotal earnings for the selected period.\" It stays visible,\n * since the two-row block is the point of the design.\n */}\n <TooltipContent title={<span aria-hidden>{children}</span>}>{tooltip}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n },\n);\n\nTooltipLabel.displayName = \"TooltipLabel\";\n"],"names":[],"mappings":";;;;;AAiCO,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,SAAS,UAAU,WAAW,SAAS,eAAe,QAAQ,GAAG,MAAA,GAAS,QAAQ;AAwBnF,UAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,KAAK;AAC5C,UAAM,iBAAiB,MAAM,OAAe,EAAE;AAM9C,UAAM,oBAAoB,MAAM,OAAO,KAAK;AAE5C,UAAM,UAAU,MAAM,eAAe,YAAY;AAEjD,+BACG,iBAAA,EACC,UAAA,qBAAC,SAAA,EAAQ,MAAY,cAAc,SACjC,UAAA;AAAA,MAAA,oBAAC,gBAAA,EAAe,SAAO,MACrB,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA,MAAK;AAAA,UACL,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA,YAKT;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,UAEF,eAAe,CAAC,UAAU;AACxB,2BAAe,UAAU,MAAM;AAC/B,8BAAkB,UAAU;AAC5B,4BAAgB,KAAK;AAAA,UACvB;AAAA,UACA,SAAS,CAAC,UAAU;AAClB,sBAAU,KAAK;AACf,gBAAI,CAAC,UAAW;AAChB,kBAAM,eAAA;AACN,oBAAQ,CAAC,kBAAkB,OAAO;AAAA,UACpC;AAAA,UACA,QAAQ,CAAC,UAAU;AAIjB,2BAAe,UAAU;AACzB,qBAAS,KAAK;AAAA,UAChB;AAAA,UACC,GAAG;AAAA,UAiBJ,UAAA,oBAAC,QAAA,EAAK,WAAU,uIACb,SAAA,CACH;AAAA,QAAA;AAAA,MAAA,GAEJ;AAAA,MAQA,oBAAC,kBAAe,OAAO,oBAAC,UAAK,eAAW,MAAE,SAAA,CAAS,GAAU,UAAA,QAAA,CAAQ;AAAA,IAAA,EAAA,CACvE,EAAA,CACF;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;"}
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { MinusIcon } from "../Icons/MinusIcon.mjs";
5
+ import { PlusIcon } from "../Icons/PlusIcon.mjs";
6
+ import { Pill } from "../Pill/Pill.mjs";
7
+ const TrendPill = React.forwardRef(
8
+ ({ label, trend, increaseLabel = "Increase", decreaseLabel = "Decrease", ...props }, ref) => {
9
+ const isPositive = trend === "positive";
10
+ return /* @__PURE__ */ jsxs(
11
+ Pill,
12
+ {
13
+ ref,
14
+ variant: isPositive ? "green" : "red",
15
+ leftIcon: isPositive ? /* @__PURE__ */ jsx(PlusIcon, {}) : /* @__PURE__ */ jsx(MinusIcon, {}),
16
+ ...props,
17
+ children: [
18
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: isPositive ? increaseLabel : decreaseLabel }),
19
+ label
20
+ ]
21
+ }
22
+ );
23
+ }
24
+ );
25
+ TrendPill.displayName = "TrendPill";
26
+ export {
27
+ TrendPill
28
+ };
29
+ //# sourceMappingURL=TrendPill.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrendPill.mjs","sources":["../../../src/components/TrendPill/TrendPill.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { MinusIcon } from \"../Icons/MinusIcon\";\nimport { PlusIcon } from \"../Icons/PlusIcon\";\nimport { Pill } from \"../Pill/Pill\";\n\n/** Whether a change is an improvement or a decline. */\nexport type TrendDirection = \"positive\" | \"negative\";\n\n/** Props for {@link TrendPill}. */\nexport interface TrendPillProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"children\"> {\n /** The change itself, already formatted (e.g. \"$240 vs Jun\"). */\n label: React.ReactNode;\n /** Drives the colour and the leading glyph. */\n trend: TrendDirection;\n /**\n * Announced before {@link label} when `trend` is `\"positive\"`. Overridable\n * because the component cannot translate it. @default \"Increase\"\n */\n increaseLabel?: string;\n /** As {@link increaseLabel}, for `\"negative\"`. @default \"Decrease\" */\n decreaseLabel?: string;\n}\n\n/**\n * A filled pill stating a change, green for positive and red for negative\n * (Figma `V2 Trend Pill`).\n *\n * Distinct from {@link ChartCard}'s `trendChip`, which is Figma's `V2 Trend`: an\n * unfilled arrow and label sitting beside a headline. Use this one where the\n * change needs to hold its own against surrounding content rather than trail a\n * number, such as inside a list row.\n *\n * @example\n * ```tsx\n * <TrendPill label=\"$240 vs Jun\" trend=\"positive\" />\n * ```\n */\nexport const TrendPill = React.forwardRef<HTMLSpanElement, TrendPillProps>(\n ({ label, trend, increaseLabel = \"Increase\", decreaseLabel = \"Decrease\", ...props }, ref) => {\n const isPositive = trend === \"positive\";\n\n return (\n <Pill\n ref={ref}\n variant={isPositive ? \"green\" : \"red\"}\n leftIcon={isPositive ? <PlusIcon /> : <MinusIcon />}\n {...props}\n >\n {/*\n * `Pill` renders `leftIcon` inside `aria-hidden`, so without this the only\n * channel carrying the direction is the green/red fill and the label itself\n * says nothing about which way it went — WCAG 1.4.1, and the direction is\n * the point of a trend.\n */}\n <span className=\"sr-only\">{isPositive ? increaseLabel : decreaseLabel}</span>\n {label}\n </Pill>\n );\n },\n);\n\nTrendPill.displayName = \"TrendPill\";\n"],"names":[],"mappings":";;;;;;AAqCO,MAAM,YAAY,MAAM;AAAA,EAC7B,CAAC,EAAE,OAAO,OAAO,gBAAgB,YAAY,gBAAgB,YAAY,GAAG,MAAA,GAAS,QAAQ;AAC3F,UAAM,aAAa,UAAU;AAE7B,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,SAAS,aAAa,UAAU;AAAA,QAChC,UAAU,aAAa,oBAAC,UAAA,CAAA,CAAS,wBAAM,WAAA,EAAU;AAAA,QAChD,GAAG;AAAA,QAQJ,UAAA;AAAA,UAAA,oBAAC,QAAA,EAAK,WAAU,WAAW,UAAA,aAAa,gBAAgB,eAAc;AAAA,UACrE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,UAAU,cAAc;"}
@@ -2,10 +2,13 @@
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { cn } from "../../utils/cn.mjs";
5
+ import { AIDisclosureIcon } from "../Icons/AIDisclosureIcon.mjs";
5
6
  import { VerifiedIcon } from "../Icons/VerifiedIcon.mjs";
6
7
  import { ProfileOnlineStatus } from "../ProfileOnlineStatus/ProfileOnlineStatus.mjs";
7
8
  const UserDisplayName = React.forwardRef(
8
9
  ({
10
+ aiDisclosure,
11
+ aiDisclosureLabel = "AI creator",
9
12
  ambassador,
10
13
  ambassadorLabel = "Ambassador",
11
14
  children,
@@ -19,7 +22,7 @@ const UserDisplayName = React.forwardRef(
19
22
  ...props
20
23
  }, ref) => {
21
24
  const Component = component;
22
- const badge = ambassador ? { label: ambassadorLabel, tint: "text-success-content" } : verified ? { label: verifiedLabel, tint: "text-content-primary" } : null;
25
+ const badge = ambassador ? { label: ambassadorLabel, tint: "text-success-content" } : verified ? { label: verifiedLabel, tint: "text-current" } : null;
23
26
  return /* @__PURE__ */ jsxs(
24
27
  Component,
25
28
  {
@@ -37,6 +40,15 @@ const UserDisplayName = React.forwardRef(
37
40
  children: /* @__PURE__ */ jsx(VerifiedIcon, { size: 16 })
38
41
  }
39
42
  ),
43
+ aiDisclosure && /* @__PURE__ */ jsx(
44
+ "span",
45
+ {
46
+ role: "img",
47
+ "aria-label": aiDisclosureLabel,
48
+ className: "ml-2 inline-flex shrink-0 items-center text-current",
49
+ children: /* @__PURE__ */ jsx(AIDisclosureIcon, { size: 16 })
50
+ }
51
+ ),
40
52
  showOnlineStatus && /* @__PURE__ */ jsx(ProfileOnlineStatus, { label: onlineLabel, className: "shrink-0 ml-2" })
41
53
  ]
42
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UserDisplayName.mjs","sources":["../../../src/components/UserDisplayName/UserDisplayName.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { VerifiedIcon } from \"../Icons/VerifiedIcon\";\nimport { ProfileOnlineStatus } from \"../ProfileOnlineStatus/ProfileOnlineStatus\";\n\nexport interface UserDisplayNameProps extends React.HTMLAttributes<HTMLElement> {\n /** Render an ambassador badge after the name. */\n ambassador?: boolean;\n /** Accessible label for the ambassador badge. @default \"Ambassador\" */\n ambassadorLabel?: string;\n /** HTML element used for the root wrapper. @default \"span\" */\n component?: \"span\" | \"h1\" | \"h2\" | \"h3\" | \"p\" | \"div\";\n /** Truncate the display name on a single line. @default true */\n noWrap?: boolean;\n /** Accessible label for the online-status indicator. @default \"Online\" */\n onlineLabel?: string;\n /** Render the inline online-status indicator after the name. @default false */\n showOnlineStatus?: boolean;\n /** Render a verified badge after the name (ignored when `ambassador` is set). */\n verified?: boolean;\n /** Accessible label for the verified badge. @default \"Verified\" */\n verifiedLabel?: string;\n}\n\n/**\n * Renders a user's display name with optional ambassador/verified badges and an\n * online-status indicator. Only the name shrinks and truncates; trailing badges\n * and the online-status indicator stay visible on the same line.\n *\n * Typography is not baked in: pass a `typography-*` utility via `className` on\n * the root and the name inherits it. Use `typography-body-small-14px-semibold`\n * for the standard display-name scale.\n *\n * When both `ambassador` and `verified` are set, the ambassador badge takes\n * precedence. Its tint uses `text-success-content` (not `text-icons-brand-green`)\n * so the green darkens in light mode and lightens in dark mode, matching\n * {@link ProfileOnlineStatus}; `text-icons-brand-green` is fixed across modes.\n *\n * @example\n * ```tsx\n * <UserDisplayName className=\"typography-body-small-14px-semibold\">Jane Doe</UserDisplayName>\n * ```\n */\nexport const UserDisplayName = React.forwardRef<HTMLElement, UserDisplayNameProps>(\n (\n {\n ambassador,\n ambassadorLabel = \"Ambassador\",\n children,\n className,\n component = \"span\",\n noWrap = true,\n onlineLabel = \"Online\",\n showOnlineStatus,\n verified,\n verifiedLabel = \"Verified\",\n ...props\n },\n ref,\n ) => {\n const Component = component as React.ElementType;\n\n const badge = ambassador\n ? { label: ambassadorLabel, tint: \"text-success-content\" }\n : verified\n ? { label: verifiedLabel, tint: \"text-content-primary\" }\n : null;\n\n return (\n <Component\n ref={ref}\n className={cn(\"inline-flex max-w-full items-center\", className)}\n {...props}\n >\n <span className={cn(\"min-w-0\", noWrap && \"truncate\")}>{children}</span>\n {badge && (\n <span\n role=\"img\"\n aria-label={badge.label}\n className={cn(\"ml-2 inline-flex shrink-0 items-center\", badge.tint)}\n >\n <VerifiedIcon size={16} />\n </span>\n )}\n {showOnlineStatus && <ProfileOnlineStatus label={onlineLabel} className=\"shrink-0 ml-2\" />}\n </Component>\n );\n },\n);\n\nUserDisplayName.displayName = \"UserDisplayName\";\n"],"names":[],"mappings":";;;;;;AA2CO,MAAM,kBAAkB,MAAM;AAAA,EACnC,CACE;AAAA,IACE;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,YAAY;AAElB,UAAM,QAAQ,aACV,EAAE,OAAO,iBAAiB,MAAM,uBAAA,IAChC,WACE,EAAE,OAAO,eAAe,MAAM,2BAC9B;AAEN,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,uCAAuC,SAAS;AAAA,QAC7D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,oBAAC,UAAK,WAAW,GAAG,WAAW,UAAU,UAAU,GAAI,UAAS;AAAA,UAC/D,SACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY,MAAM;AAAA,cAClB,WAAW,GAAG,0CAA0C,MAAM,IAAI;AAAA,cAElE,UAAA,oBAAC,cAAA,EAAa,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG3B,oBAAoB,oBAAC,qBAAA,EAAoB,OAAO,aAAa,WAAU,gBAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG9F;AACF;AAEA,gBAAgB,cAAc;"}
1
+ {"version":3,"file":"UserDisplayName.mjs","sources":["../../../src/components/UserDisplayName/UserDisplayName.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIDisclosureIcon } from \"../Icons/AIDisclosureIcon\";\nimport { VerifiedIcon } from \"../Icons/VerifiedIcon\";\nimport { ProfileOnlineStatus } from \"../ProfileOnlineStatus/ProfileOnlineStatus\";\n\nexport interface UserDisplayNameProps extends React.HTMLAttributes<HTMLElement> {\n /** Render an AI-disclosure badge after the name, alongside any status badge. */\n aiDisclosure?: boolean;\n /** Accessible label for the AI-disclosure badge. @default \"AI creator\" */\n aiDisclosureLabel?: string;\n /** Render an ambassador badge after the name. */\n ambassador?: boolean;\n /** Accessible label for the ambassador badge. @default \"Ambassador\" */\n ambassadorLabel?: string;\n /** HTML element used for the root wrapper. @default \"span\" */\n component?: \"span\" | \"h1\" | \"h2\" | \"h3\" | \"p\" | \"div\";\n /** Truncate the display name on a single line. @default true */\n noWrap?: boolean;\n /** Accessible label for the online-status indicator. @default \"Online\" */\n onlineLabel?: string;\n /** Render the inline online-status indicator after the name. @default false */\n showOnlineStatus?: boolean;\n /** Render a verified badge after the name (ignored when `ambassador` is set). */\n verified?: boolean;\n /** Accessible label for the verified badge. @default \"Verified\" */\n verifiedLabel?: string;\n}\n\n/**\n * Renders a user's display name with optional ambassador/verified badges and an\n * online-status indicator. Only the name shrinks and truncates; trailing badges\n * and the online-status indicator stay visible on the same line.\n *\n * Typography is not baked in: pass a `typography-*` utility via `className` on\n * the root and the name inherits it. Use `typography-body-small-14px-semibold`\n * for the standard display-name scale.\n *\n * When both `ambassador` and `verified` are set, the ambassador badge takes\n * precedence. `aiDisclosure` is independent of both and renders after whichever\n * status badge is shown, since it discloses how the account is operated rather\n * than ranking it.\n *\n * The verified and AI-disclosure badges inherit the name's colour, so setting a\n * colour on the root tints them with it. That keeps them legible on surfaces\n * that fix their own text colour — over a cover image, for example, where a\n * theme-dependent tint would turn black against white text in light mode.\n *\n * The ambassador tint is deliberately not inherited: it uses `text-success-content`\n * (not `text-icons-brand-green`) so the green darkens in light mode and lightens\n * in dark mode, matching {@link ProfileOnlineStatus}; `text-icons-brand-green` is\n * fixed across modes.\n *\n * @example\n * ```tsx\n * <UserDisplayName className=\"typography-body-small-14px-semibold\">Jane Doe</UserDisplayName>\n * ```\n */\nexport const UserDisplayName = React.forwardRef<HTMLElement, UserDisplayNameProps>(\n (\n {\n aiDisclosure,\n aiDisclosureLabel = \"AI creator\",\n ambassador,\n ambassadorLabel = \"Ambassador\",\n children,\n className,\n component = \"span\",\n noWrap = true,\n onlineLabel = \"Online\",\n showOnlineStatus,\n verified,\n verifiedLabel = \"Verified\",\n ...props\n },\n ref,\n ) => {\n const Component = component as React.ElementType;\n\n const badge = ambassador\n ? { label: ambassadorLabel, tint: \"text-success-content\" }\n : verified\n ? { label: verifiedLabel, tint: \"text-current\" }\n : null;\n\n return (\n <Component\n ref={ref}\n className={cn(\"inline-flex max-w-full items-center\", className)}\n {...props}\n >\n <span className={cn(\"min-w-0\", noWrap && \"truncate\")}>{children}</span>\n {badge && (\n <span\n role=\"img\"\n aria-label={badge.label}\n className={cn(\"ml-2 inline-flex shrink-0 items-center\", badge.tint)}\n >\n <VerifiedIcon size={16} />\n </span>\n )}\n {aiDisclosure && (\n <span\n role=\"img\"\n aria-label={aiDisclosureLabel}\n className=\"ml-2 inline-flex shrink-0 items-center text-current\"\n >\n <AIDisclosureIcon size={16} />\n </span>\n )}\n {showOnlineStatus && <ProfileOnlineStatus label={onlineLabel} className=\"shrink-0 ml-2\" />}\n </Component>\n );\n },\n);\n\nUserDisplayName.displayName = \"UserDisplayName\";\n"],"names":[],"mappings":";;;;;;;AA0DO,MAAM,kBAAkB,MAAM;AAAA,EACnC,CACE;AAAA,IACE;AAAA,IACA,oBAAoB;AAAA,IACpB;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,YAAY;AAElB,UAAM,QAAQ,aACV,EAAE,OAAO,iBAAiB,MAAM,uBAAA,IAChC,WACE,EAAE,OAAO,eAAe,MAAM,mBAC9B;AAEN,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,uCAAuC,SAAS;AAAA,QAC7D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,oBAAC,UAAK,WAAW,GAAG,WAAW,UAAU,UAAU,GAAI,UAAS;AAAA,UAC/D,SACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY,MAAM;AAAA,cAClB,WAAW,GAAG,0CAA0C,MAAM,IAAI;AAAA,cAElE,UAAA,oBAAC,cAAA,EAAa,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG3B,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY;AAAA,cACZ,WAAU;AAAA,cAEV,UAAA,oBAAC,kBAAA,EAAiB,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG/B,oBAAoB,oBAAC,qBAAA,EAAoB,OAAO,aAAa,WAAU,gBAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG9F;AACF;AAEA,gBAAgB,cAAc;"}
@@ -20,6 +20,13 @@ const UserItem = React.forwardRef(
20
20
  showOnlineStatus,
21
21
  showHandle = true,
22
22
  showAvatar = true,
23
+ aiDisclosure = false,
24
+ aiDisclosureLabel,
25
+ verified = false,
26
+ verifiedLabel,
27
+ trailing,
28
+ primary,
29
+ secondary,
23
30
  className,
24
31
  ...props
25
32
  }, ref) => {
@@ -42,9 +49,21 @@ const UserItem = React.forwardRef(
42
49
  }
43
50
  ),
44
51
  /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-hidden pl-2", children: [
45
- /* @__PURE__ */ jsx(UserDisplayName, { className: "typography-body-small-14px-semibold", children: user.nickname || user.displayName }),
52
+ primary ?? /* @__PURE__ */ jsx(
53
+ UserDisplayName,
54
+ {
55
+ aiDisclosure,
56
+ aiDisclosureLabel,
57
+ verified,
58
+ verifiedLabel,
59
+ className: "typography-body-small-14px-semibold",
60
+ children: user.nickname || user.displayName
61
+ }
62
+ ),
63
+ secondary && /* @__PURE__ */ jsx("p", { className: "typography-description-12px-regular truncate text-content-secondary", children: secondary }),
46
64
  showHandle && /* @__PURE__ */ jsx(UserHandle, { children: user.handle })
47
- ] })
65
+ ] }),
66
+ trailing && /* @__PURE__ */ jsx("div", { className: "shrink-0 pl-2", children: trailing })
48
67
  ]
49
68
  }
50
69
  );
@@ -1 +1 @@
1
- {"version":3,"file":"UserItem.mjs","sources":["../../../src/components/UserItem/UserItem.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { getInitials } from \"../../utils/getInitials\";\nimport { Avatar } from \"../Avatar/Avatar\";\nimport { BellOffIcon } from \"../Icons/BellOffIcon\";\nimport { UserDisplayName } from \"../UserDisplayName/UserDisplayName\";\nimport { UserHandle } from \"../UserHandle/UserHandle\";\n\nconst AVATAR_SIZES = [16, 24, 32, 40, 48, 64, 88, 148] as const;\ntype AvatarSizeToken = (typeof AVATAR_SIZES)[number];\n\n/** Snap an arbitrary pixel size to the nearest supported {@link Avatar} size token. */\nconst getNearestAvatarSize = (size: number): AvatarSizeToken =>\n AVATAR_SIZES.reduce((prev, curr) =>\n Math.abs(curr - size) < Math.abs(prev - size) ? curr : prev,\n );\n\n/** Minimal user shape consumed by {@link UserItem}. */\nexport type UserItemUser = {\n avatarUri?: { url: string; url2x?: string };\n displayName: string;\n handle: string;\n nickname?: string;\n};\n\nexport interface UserItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The user to display. */\n user: UserItemUser;\n /** Desired avatar size in px; snapped to the nearest supported token. @default 48 */\n avatarSize?: number;\n /** Show the muted indicator in the bottom-left corner. @default false */\n isMuted?: boolean;\n /** Whether the user is online (only shown when `showOnlineStatus` is also set). @default false */\n isOnline?: boolean;\n /** Render the avatar. @default true */\n showAvatar?: boolean;\n /** Render the handle line under the display name. @default true */\n showHandle?: boolean;\n /** Enable the avatar online indicator (combined with `isOnline`). */\n showOnlineStatus?: boolean;\n}\n\n/**\n * A compact user row showing an avatar, display name (or nickname) and handle,\n * with optional online and muted indicators.\n *\n * @example\n * ```tsx\n * <UserItem user={{ displayName: \"Jane Doe\", handle: \"jane_doe\" }} />\n * ```\n */\nexport const UserItem = React.forwardRef<HTMLDivElement, UserItemProps>(\n (\n {\n user,\n avatarSize,\n isOnline = false,\n isMuted = false,\n showOnlineStatus,\n showHandle = true,\n showAvatar = true,\n className,\n ...props\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n className={cn(\"relative flex w-full items-center justify-start px-2 py-1\", className)}\n {...props}\n >\n {isMuted && (\n <div className=\"absolute bottom-0 left-0 z-1 flex rounded-xs bg-surface-primary p-1\">\n <BellOffIcon size={16} />\n </div>\n )}\n {showAvatar && (\n <Avatar\n size={getNearestAvatarSize(avatarSize || 48)}\n src={user.avatarUri?.url}\n alt={user.displayName}\n fallback={getInitials(user.displayName)}\n onlineIndicator={Boolean(showOnlineStatus && isOnline)}\n />\n )}\n <div className=\"flex-1 overflow-hidden pl-2\">\n <UserDisplayName className=\"typography-body-small-14px-semibold\">\n {user.nickname || user.displayName}\n </UserDisplayName>\n {showHandle && <UserHandle>{user.handle}</UserHandle>}\n </div>\n </div>\n );\n },\n);\n\nUserItem.displayName = \"UserItem\";\n"],"names":[],"mappings":";;;;;;;;;AAQA,MAAM,eAAe,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;AAIrD,MAAM,uBAAuB,CAAC,SAC5B,aAAa;AAAA,EAAO,CAAC,MAAM,SACzB,KAAK,IAAI,OAAO,IAAI,IAAI,KAAK,IAAI,OAAO,IAAI,IAAI,OAAO;AACzD;AAoCK,MAAM,WAAW,MAAM;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,IACV;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,IACb;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,6DAA6D,SAAS;AAAA,QACnF,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,WACC,oBAAC,SAAI,WAAU,uEACb,8BAAC,aAAA,EAAY,MAAM,IAAI,EAAA,CACzB;AAAA,UAED,cACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAM,qBAAqB,cAAc,EAAE;AAAA,cAC3C,KAAK,KAAK,WAAW;AAAA,cACrB,KAAK,KAAK;AAAA,cACV,UAAU,YAAY,KAAK,WAAW;AAAA,cACtC,iBAAiB,QAAQ,oBAAoB,QAAQ;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzD,qBAAC,OAAA,EAAI,WAAU,+BACb,UAAA;AAAA,YAAA,oBAAC,mBAAgB,WAAU,uCACxB,UAAA,KAAK,YAAY,KAAK,aACzB;AAAA,YACC,cAAc,oBAAC,YAAA,EAAY,UAAA,KAAK,OAAA,CAAO;AAAA,UAAA,EAAA,CAC1C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAAS,cAAc;"}
1
+ {"version":3,"file":"UserItem.mjs","sources":["../../../src/components/UserItem/UserItem.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { getInitials } from \"../../utils/getInitials\";\nimport { Avatar } from \"../Avatar/Avatar\";\nimport { BellOffIcon } from \"../Icons/BellOffIcon\";\nimport { UserDisplayName } from \"../UserDisplayName/UserDisplayName\";\nimport { UserHandle } from \"../UserHandle/UserHandle\";\n\nconst AVATAR_SIZES = [16, 24, 32, 40, 48, 64, 88, 148] as const;\ntype AvatarSizeToken = (typeof AVATAR_SIZES)[number];\n\n/** Snap an arbitrary pixel size to the nearest supported {@link Avatar} size token. */\nconst getNearestAvatarSize = (size: number): AvatarSizeToken =>\n AVATAR_SIZES.reduce((prev, curr) =>\n Math.abs(curr - size) < Math.abs(prev - size) ? curr : prev,\n );\n\n/** Minimal user shape consumed by {@link UserItem}. */\nexport type UserItemUser = {\n avatarUri?: { url: string; url2x?: string };\n displayName: string;\n handle: string;\n nickname?: string;\n};\n\nexport interface UserItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The user to display. */\n user: UserItemUser;\n /** Desired avatar size in px; snapped to the nearest supported token. @default 48 */\n avatarSize?: number;\n /** Show the muted indicator in the bottom-left corner. @default false */\n isMuted?: boolean;\n /** Whether the user is online (only shown when `showOnlineStatus` is also set). @default false */\n isOnline?: boolean;\n /** Render the avatar. @default true */\n showAvatar?: boolean;\n /** Render the handle line under the display name. @default true */\n showHandle?: boolean;\n /** Enable the avatar online indicator (combined with `isOnline`). */\n showOnlineStatus?: boolean;\n /** Render an AI-disclosure badge after the display name. @default false */\n aiDisclosure?: boolean;\n /** Accessible label for the AI-disclosure badge. @default \"AI creator\" */\n aiDisclosureLabel?: string;\n /** Render a verified badge after the display name. @default false */\n verified?: boolean;\n /** Accessible label for the verified badge. @default \"Verified\" */\n verifiedLabel?: string;\n /**\n * Content pinned to the end of the row — a value, count, timestamp or action.\n * It keeps its intrinsic width while the name block absorbs the remaining\n * space, so trailing content stays aligned down the rows of a list.\n *\n * Prefer {@link UserItemTrailing} over composing the lines yourself.\n */\n trailing?: React.ReactNode;\n /**\n * Replace the display-name line with arbitrary content, for rows that read as\n * a sentence about the user rather than their name — an activity feed entry,\n * for instance. Badges do not apply to custom content.\n */\n primary?: React.ReactNode;\n /**\n * A supporting line under the name, mirroring {@link UserItemTrailing}'s `meta`.\n * Both are block lines on the same 18px advance, so a row using `secondary` on\n * the left and `meta` on the right reads as two aligned tiers. Prefer it over\n * letting a long primary wrap, which mixes line heights and drifts out of step.\n */\n secondary?: React.ReactNode;\n}\n\n/**\n * A compact user row showing an avatar, display name (or nickname) and handle,\n * with optional verified and AI-disclosure badges and online and muted indicators.\n *\n * Pass {@link UserItemProps.trailing} to pin a value to the end of the row, the\n * shape most list rows need — top spenders, most active fans, a recent-activity\n * feed.\n *\n * @example\n * ```tsx\n * <UserItem user={{ displayName: \"Jane Doe\", handle: \"jane_doe\" }} />\n * ```\n *\n * @example A list row with a trailing value\n * ```tsx\n * <UserItem\n * user={user}\n * avatarSize={32}\n * showHandle={false}\n * trailing={<span className=\"typography-body-small-14px-semibold\">$14,523.59</span>}\n * />\n * ```\n */\nexport const UserItem = React.forwardRef<HTMLDivElement, UserItemProps>(\n (\n {\n user,\n avatarSize,\n isOnline = false,\n isMuted = false,\n showOnlineStatus,\n showHandle = true,\n showAvatar = true,\n aiDisclosure = false,\n aiDisclosureLabel,\n verified = false,\n verifiedLabel,\n trailing,\n primary,\n secondary,\n className,\n ...props\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n className={cn(\"relative flex w-full items-center justify-start px-2 py-1\", className)}\n {...props}\n >\n {isMuted && (\n <div className=\"absolute bottom-0 left-0 z-1 flex rounded-xs bg-surface-primary p-1\">\n <BellOffIcon size={16} />\n </div>\n )}\n {showAvatar && (\n <Avatar\n size={getNearestAvatarSize(avatarSize || 48)}\n src={user.avatarUri?.url}\n alt={user.displayName}\n fallback={getInitials(user.displayName)}\n onlineIndicator={Boolean(showOnlineStatus && isOnline)}\n />\n )}\n <div className=\"flex-1 overflow-hidden pl-2\">\n {primary ?? (\n <UserDisplayName\n aiDisclosure={aiDisclosure}\n aiDisclosureLabel={aiDisclosureLabel}\n verified={verified}\n verifiedLabel={verifiedLabel}\n className=\"typography-body-small-14px-semibold\"\n >\n {user.nickname || user.displayName}\n </UserDisplayName>\n )}\n {secondary && (\n <p className=\"typography-description-12px-regular truncate text-content-secondary\">\n {secondary}\n </p>\n )}\n {showHandle && <UserHandle>{user.handle}</UserHandle>}\n </div>\n {trailing && <div className=\"shrink-0 pl-2\">{trailing}</div>}\n </div>\n );\n },\n);\n\nUserItem.displayName = \"UserItem\";\n"],"names":[],"mappings":";;;;;;;;;AAQA,MAAM,eAAe,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;AAIrD,MAAM,uBAAuB,CAAC,SAC5B,aAAa;AAAA,EAAO,CAAC,MAAM,SACzB,KAAK,IAAI,OAAO,IAAI,IAAI,KAAK,IAAI,OAAO,IAAI,IAAI,OAAO;AACzD;AA+EK,MAAM,WAAW,MAAM;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,IACV;AAAA,IACA,aAAa;AAAA,IACb,aAAa;AAAA,IACb,eAAe;AAAA,IACf;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,6DAA6D,SAAS;AAAA,QACnF,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,WACC,oBAAC,SAAI,WAAU,uEACb,8BAAC,aAAA,EAAY,MAAM,IAAI,EAAA,CACzB;AAAA,UAED,cACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAM,qBAAqB,cAAc,EAAE;AAAA,cAC3C,KAAK,KAAK,WAAW;AAAA,cACrB,KAAK,KAAK;AAAA,cACV,UAAU,YAAY,KAAK,WAAW;AAAA,cACtC,iBAAiB,QAAQ,oBAAoB,QAAQ;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzD,qBAAC,OAAA,EAAI,WAAU,+BACZ,UAAA;AAAA,YAAA,WACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,WAAU;AAAA,gBAET,UAAA,KAAK,YAAY,KAAK;AAAA,cAAA;AAAA,YAAA;AAAA,YAG1B,aACC,oBAAC,KAAA,EAAE,WAAU,uEACV,UAAA,WACH;AAAA,YAED,cAAc,oBAAC,YAAA,EAAY,UAAA,KAAK,OAAA,CAAO;AAAA,UAAA,GAC1C;AAAA,UACC,YAAY,oBAAC,OAAA,EAAI,WAAU,iBAAiB,UAAA,SAAA,CAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG5D;AACF;AAEA,SAAS,cAAc;"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../../utils/cn.mjs";
5
+ const UserItemTrailing = React.forwardRef(
6
+ ({ value, meta, className, ...props }, ref) => {
7
+ return /* @__PURE__ */ jsxs("div", { ref, className: cn("flex flex-col items-end", className), ...props, children: [
8
+ /* @__PURE__ */ jsx("span", { className: "typography-body-small-14px-semibold text-content-primary", children: value }),
9
+ meta && /* @__PURE__ */ jsx("span", { className: "typography-description-12px-regular text-content-secondary", children: meta })
10
+ ] });
11
+ }
12
+ );
13
+ UserItemTrailing.displayName = "UserItemTrailing";
14
+ export {
15
+ UserItemTrailing
16
+ };
17
+ //# sourceMappingURL=UserItemTrailing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserItemTrailing.mjs","sources":["../../../src/components/UserItem/UserItemTrailing.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Props for {@link UserItemTrailing}. */\nexport interface UserItemTrailingProps extends React.HTMLAttributes<HTMLDivElement> {\n /** The headline figure — an amount, a count, a percentage. */\n value: React.ReactNode;\n /** Optional supporting line under the value, such as a timestamp. */\n meta?: React.ReactNode;\n}\n\n/**\n * The end-of-row block for a {@link UserItem}: a value with an optional\n * supporting line beneath it, both aligned to the right edge so figures line up\n * down a list.\n *\n * Pass it to {@link UserItem}'s `trailing` slot rather than composing the two\n * lines at each call site, so value and meta typography stay consistent\n * wherever a list row carries a figure.\n *\n * @example\n * ```tsx\n * <UserItem\n * user={user}\n * showHandle={false}\n * trailing={<UserItemTrailing value=\"$421.32\" meta=\"7 hours ago\" />}\n * />\n * ```\n */\nexport const UserItemTrailing = React.forwardRef<HTMLDivElement, UserItemTrailingProps>(\n ({ value, meta, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn(\"flex flex-col items-end\", className)} {...props}>\n <span className=\"typography-body-small-14px-semibold text-content-primary\">{value}</span>\n {meta && (\n <span className=\"typography-description-12px-regular text-content-secondary\">{meta}</span>\n )}\n </div>\n );\n },\n);\n\nUserItemTrailing.displayName = \"UserItemTrailing\";\n"],"names":[],"mappings":";;;;AA6BO,MAAM,mBAAmB,MAAM;AAAA,EACpC,CAAC,EAAE,OAAO,MAAM,WAAW,GAAG,MAAA,GAAS,QAAQ;AAC7C,WACE,qBAAC,SAAI,KAAU,WAAW,GAAG,2BAA2B,SAAS,GAAI,GAAG,OACtE,UAAA;AAAA,MAAA,oBAAC,QAAA,EAAK,WAAU,4DAA4D,UAAA,OAAM;AAAA,MACjF,QACC,oBAAC,QAAA,EAAK,WAAU,8DAA8D,UAAA,KAAA,CAAK;AAAA,IAAA,GAEvF;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;"}
@@ -0,0 +1,59 @@
1
+ import * as React_2 from 'react';
2
+
3
+ /**
4
+ * A country's flag, drawn as a circle. Use it wherever a row is keyed by
5
+ * country — a demographics breakdown, a country picker, the country selector on
6
+ * `PhoneField`.
7
+ *
8
+ * Prefer this to a flag emoji: emoji flags fall back to bare letter pairs on
9
+ * Windows, where the fonts carry no flag glyphs.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <CountryFlag country="US" label="United States" />
14
+ * ```
15
+ */
16
+ export declare const CountryFlag: React_2.ForwardRefExoticComponent<Omit<CountryFlagProps, "ref"> & React_2.RefAttributes<SVGSVGElement>>;
17
+
18
+ /**
19
+ * Every code {@link FLAG_SHAPES} has artwork for. Mostly ISO 3166-1 alpha-2,
20
+ * plus the codes the source ships alongside them (`eu`, `un`, `xk`, `xx`, ...).
21
+ */
22
+ export declare type CountryFlagCode = "ac" | "ad" | "ae" | "af" | "ag" | "ai" | "al" | "am" | "an" | "ao" | "aq" | "ar" | "as" | "at" | "au" | "aw" | "ax" | "az" | "ba" | "bb" | "bd" | "be" | "bf" | "bg" | "bh" | "bi" | "bj" | "bl" | "bm" | "bn" | "bo" | "bq" | "br" | "bs" | "bt" | "bv" | "bw" | "by" | "bz" | "ca" | "cc" | "cd" | "cf" | "cg" | "ch" | "ci" | "ck" | "cl" | "cm" | "cn" | "co" | "cp" | "cq" | "cr" | "cu" | "cv" | "cw" | "cx" | "cy" | "cz" | "de" | "dg" | "dj" | "dk" | "dm" | "do" | "dz" | "ea" | "ec" | "ee" | "eg" | "eh" | "er" | "es" | "et" | "eu" | "fi" | "fj" | "fk" | "fm" | "fo" | "fr" | "fx" | "ga" | "gb" | "gd" | "ge" | "gf" | "gg" | "gh" | "gi" | "gl" | "gm" | "gn" | "gp" | "gq" | "gr" | "gs" | "gt" | "gu" | "gw" | "gy" | "hk" | "hm" | "hn" | "hr" | "ht" | "hu" | "ic" | "id" | "ie" | "il" | "im" | "in" | "io" | "iq" | "ir" | "is" | "it" | "je" | "jm" | "jo" | "jp" | "ke" | "kg" | "kh" | "ki" | "km" | "kn" | "kp" | "kr" | "kw" | "ky" | "kz" | "la" | "lb" | "lc" | "li" | "lk" | "lr" | "ls" | "lt" | "lu" | "lv" | "ly" | "ma" | "mc" | "md" | "me" | "mf" | "mg" | "mh" | "mk" | "ml" | "mm" | "mn" | "mo" | "mp" | "mq" | "mr" | "ms" | "mt" | "mu" | "mv" | "mw" | "mx" | "my" | "mz" | "na" | "nc" | "ne" | "nf" | "ng" | "ni" | "nl" | "no" | "np" | "nr" | "nu" | "nz" | "om" | "pa" | "pe" | "pf" | "pg" | "ph" | "pk" | "pl" | "pm" | "pn" | "pr" | "ps" | "pt" | "pw" | "py" | "qa" | "re" | "ro" | "rs" | "ru" | "rw" | "sa" | "sb" | "sc" | "sd" | "se" | "sg" | "sh" | "si" | "sj" | "sk" | "sl" | "sm" | "sn" | "so" | "sr" | "ss" | "st" | "su" | "sv" | "sx" | "sy" | "sz" | "ta" | "tc" | "td" | "tf" | "tg" | "th" | "tj" | "tk" | "tl" | "tm" | "tn" | "to" | "tr" | "tt" | "tv" | "tw" | "tz" | "ua" | "ug" | "uk" | "um" | "un" | "us" | "uy" | "uz" | "va" | "vc" | "ve" | "vg" | "vi" | "vn" | "vu" | "wf" | "ws" | "xk" | "xx" | "ye" | "yt" | "yu" | "za" | "zm" | "zw";
23
+
24
+ /** Props for {@link CountryFlag}. */
25
+ export declare interface CountryFlagProps extends Omit<React_2.SVGProps<SVGSVGElement>, "children"> {
26
+ /**
27
+ * Two-letter country code, case-insensitive (e.g. `"US"`, `"nl"`). Codes we
28
+ * hold no artwork for render a grey placeholder disc, so a live feed of
29
+ * country codes can be passed straight through.
30
+ */
31
+ country: string;
32
+ /** Rendered edge length in px. Defaults to 20, the size the designs use. */
33
+ size?: CountryFlagSize;
34
+ /**
35
+ * Accessible name, e.g. the country's translated name. Leave unset when the
36
+ * flag sits next to that name anyway — it is then hidden from assistive tech
37
+ * rather than read out twice.
38
+ */
39
+ label?: string;
40
+ }
41
+
42
+ /** Rendered edge length in px. */
43
+ export declare type CountryFlagSize = keyof typeof SIZE_CLASS;
44
+
45
+ declare const SIZE_CLASS: {
46
+ readonly 16: "size-4";
47
+ readonly 20: "size-5";
48
+ readonly 24: "size-6";
49
+ readonly 32: "size-8";
50
+ };
51
+
52
+ export { }
53
+
54
+
55
+ declare module "vitest" {
56
+ interface Assertion<T> {
57
+ toHaveNoViolations(): T;
58
+ }
59
+ }
package/dist/flags.mjs ADDED
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { CountryFlag } from "./components/CountryFlag/CountryFlag.mjs";
3
+ export {
4
+ CountryFlag
5
+ };
6
+ //# sourceMappingURL=flags.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}