@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.cjs","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":["React","TooltipProvider","jsxs","Tooltip","jsx","TooltipTrigger","cn","TooltipContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiCO,MAAM,eAAeA,iBAAM;AAAA,EAChC,CAAC,EAAE,SAAS,UAAU,WAAW,SAAS,eAAe,QAAQ,GAAG,MAAA,GAAS,QAAQ;AAwBnF,UAAM,CAAC,MAAM,OAAO,IAAIA,iBAAM,SAAS,KAAK;AAC5C,UAAM,iBAAiBA,iBAAM,OAAe,EAAE;AAM9C,UAAM,oBAAoBA,iBAAM,OAAO,KAAK;AAE5C,UAAM,UAAU,MAAM,eAAe,YAAY;AAEjD,0CACGC,QAAAA,iBAAA,EACC,UAAAC,2BAAAA,KAACC,iBAAA,EAAQ,MAAY,cAAc,SACjC,UAAA;AAAA,MAAAC,2BAAAA,IAACC,QAAAA,gBAAA,EAAe,SAAO,MACrB,UAAAD,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA,MAAK;AAAA,UACL,WAAWE,GAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,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,UAAAF,2BAAAA,IAAC,QAAA,EAAK,WAAU,uIACb,SAAA,CACH;AAAA,QAAA;AAAA,MAAA,GAEJ;AAAA,MAQAA,2BAAAA,IAACG,QAAAA,kBAAe,OAAOH,2BAAAA,IAAC,UAAK,eAAW,MAAE,SAAA,CAAS,GAAU,UAAA,QAAA,CAAQ;AAAA,IAAA,EAAA,CACvE,EAAA,CACF;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;;"}
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ const MinusIcon = require("../Icons/MinusIcon.cjs");
7
+ const PlusIcon = require("../Icons/PlusIcon.cjs");
8
+ const Pill = require("../Pill/Pill.cjs");
9
+ function _interopNamespaceDefault(e) {
10
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
+ if (e) {
12
+ for (const k in e) {
13
+ if (k !== "default") {
14
+ const d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: () => e[k]
18
+ });
19
+ }
20
+ }
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
26
+ const TrendPill = React__namespace.forwardRef(
27
+ ({ label, trend, increaseLabel = "Increase", decreaseLabel = "Decrease", ...props }, ref) => {
28
+ const isPositive = trend === "positive";
29
+ return /* @__PURE__ */ jsxRuntime.jsxs(
30
+ Pill.Pill,
31
+ {
32
+ ref,
33
+ variant: isPositive ? "green" : "red",
34
+ leftIcon: isPositive ? /* @__PURE__ */ jsxRuntime.jsx(PlusIcon.PlusIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(MinusIcon.MinusIcon, {}),
35
+ ...props,
36
+ children: [
37
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: isPositive ? increaseLabel : decreaseLabel }),
38
+ label
39
+ ]
40
+ }
41
+ );
42
+ }
43
+ );
44
+ TrendPill.displayName = "TrendPill";
45
+ exports.TrendPill = TrendPill;
46
+ //# sourceMappingURL=TrendPill.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrendPill.cjs","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":["React","jsxs","Pill","jsx","PlusIcon","MinusIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqCO,MAAM,YAAYA,iBAAM;AAAA,EAC7B,CAAC,EAAE,OAAO,OAAO,gBAAgB,YAAY,gBAAgB,YAAY,GAAG,MAAA,GAAS,QAAQ;AAC3F,UAAM,aAAa,UAAU;AAE7B,WACEC,2BAAAA;AAAAA,MAACC,KAAAA;AAAAA,MAAA;AAAA,QACC;AAAA,QACA,SAAS,aAAa,UAAU;AAAA,QAChC,UAAU,aAAaC,2BAAAA,IAACC,SAAAA,UAAA,CAAA,CAAS,mCAAMC,UAAAA,WAAA,EAAU;AAAA,QAChD,GAAG;AAAA,QAQJ,UAAA;AAAA,UAAAF,+BAAC,QAAA,EAAK,WAAU,WAAW,UAAA,aAAa,gBAAgB,eAAc;AAAA,UACrE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,UAAU,cAAc;;"}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const jsxRuntime = require("react/jsx-runtime");
5
5
  const React = require("react");
6
6
  const cn = require("../../utils/cn.cjs");
7
+ const AIDisclosureIcon = require("../Icons/AIDisclosureIcon.cjs");
7
8
  const VerifiedIcon = require("../Icons/VerifiedIcon.cjs");
8
9
  const ProfileOnlineStatus = require("../ProfileOnlineStatus/ProfileOnlineStatus.cjs");
9
10
  function _interopNamespaceDefault(e) {
@@ -25,6 +26,8 @@ function _interopNamespaceDefault(e) {
25
26
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
26
27
  const UserDisplayName = React__namespace.forwardRef(
27
28
  ({
29
+ aiDisclosure,
30
+ aiDisclosureLabel = "AI creator",
28
31
  ambassador,
29
32
  ambassadorLabel = "Ambassador",
30
33
  children,
@@ -38,7 +41,7 @@ const UserDisplayName = React__namespace.forwardRef(
38
41
  ...props
39
42
  }, ref) => {
40
43
  const Component = component;
41
- const badge = ambassador ? { label: ambassadorLabel, tint: "text-success-content" } : verified ? { label: verifiedLabel, tint: "text-content-primary" } : null;
44
+ const badge = ambassador ? { label: ambassadorLabel, tint: "text-success-content" } : verified ? { label: verifiedLabel, tint: "text-current" } : null;
42
45
  return /* @__PURE__ */ jsxRuntime.jsxs(
43
46
  Component,
44
47
  {
@@ -56,6 +59,15 @@ const UserDisplayName = React__namespace.forwardRef(
56
59
  children: /* @__PURE__ */ jsxRuntime.jsx(VerifiedIcon.VerifiedIcon, { size: 16 })
57
60
  }
58
61
  ),
62
+ aiDisclosure && /* @__PURE__ */ jsxRuntime.jsx(
63
+ "span",
64
+ {
65
+ role: "img",
66
+ "aria-label": aiDisclosureLabel,
67
+ className: "ml-2 inline-flex shrink-0 items-center text-current",
68
+ children: /* @__PURE__ */ jsxRuntime.jsx(AIDisclosureIcon.AIDisclosureIcon, { size: 16 })
69
+ }
70
+ ),
59
71
  showOnlineStatus && /* @__PURE__ */ jsxRuntime.jsx(ProfileOnlineStatus.ProfileOnlineStatus, { label: onlineLabel, className: "shrink-0 ml-2" })
60
72
  ]
61
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UserDisplayName.cjs","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":["React","jsxs","cn","jsx","VerifiedIcon","ProfileOnlineStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,kBAAkBA,iBAAM;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,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA,GAAG,uCAAuC,SAAS;AAAA,QAC7D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAAC,+BAAC,UAAK,WAAWD,GAAAA,GAAG,WAAW,UAAU,UAAU,GAAI,UAAS;AAAA,UAC/D,SACCC,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY,MAAM;AAAA,cAClB,WAAWD,GAAAA,GAAG,0CAA0C,MAAM,IAAI;AAAA,cAElE,UAAAC,2BAAAA,IAACC,aAAAA,cAAA,EAAa,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG3B,oBAAoBD,2BAAAA,IAACE,yCAAA,EAAoB,OAAO,aAAa,WAAU,gBAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG9F;AACF;AAEA,gBAAgB,cAAc;;"}
1
+ {"version":3,"file":"UserDisplayName.cjs","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":["React","jsxs","cn","jsx","VerifiedIcon","AIDisclosureIcon","ProfileOnlineStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0DO,MAAM,kBAAkBA,iBAAM;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,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA,GAAG,uCAAuC,SAAS;AAAA,QAC7D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAAC,+BAAC,UAAK,WAAWD,GAAAA,GAAG,WAAW,UAAU,UAAU,GAAI,UAAS;AAAA,UAC/D,SACCC,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY,MAAM;AAAA,cAClB,WAAWD,GAAAA,GAAG,0CAA0C,MAAM,IAAI;AAAA,cAElE,UAAAC,2BAAAA,IAACC,aAAAA,cAAA,EAAa,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG3B,gBACCD,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY;AAAA,cACZ,WAAU;AAAA,cAEV,UAAAA,2BAAAA,IAACE,iBAAAA,kBAAA,EAAiB,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG/B,oBAAoBF,2BAAAA,IAACG,yCAAA,EAAoB,OAAO,aAAa,WAAU,gBAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG9F;AACF;AAEA,gBAAgB,cAAc;;"}
@@ -39,6 +39,13 @@ const UserItem = React__namespace.forwardRef(
39
39
  showOnlineStatus,
40
40
  showHandle = true,
41
41
  showAvatar = true,
42
+ aiDisclosure = false,
43
+ aiDisclosureLabel,
44
+ verified = false,
45
+ verifiedLabel,
46
+ trailing,
47
+ primary,
48
+ secondary,
42
49
  className,
43
50
  ...props
44
51
  }, ref) => {
@@ -61,9 +68,21 @@ const UserItem = React__namespace.forwardRef(
61
68
  }
62
69
  ),
63
70
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-hidden pl-2", children: [
64
- /* @__PURE__ */ jsxRuntime.jsx(UserDisplayName.UserDisplayName, { className: "typography-body-small-14px-semibold", children: user.nickname || user.displayName }),
71
+ primary ?? /* @__PURE__ */ jsxRuntime.jsx(
72
+ UserDisplayName.UserDisplayName,
73
+ {
74
+ aiDisclosure,
75
+ aiDisclosureLabel,
76
+ verified,
77
+ verifiedLabel,
78
+ className: "typography-body-small-14px-semibold",
79
+ children: user.nickname || user.displayName
80
+ }
81
+ ),
82
+ secondary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "typography-description-12px-regular truncate text-content-secondary", children: secondary }),
65
83
  showHandle && /* @__PURE__ */ jsxRuntime.jsx(UserHandle.UserHandle, { children: user.handle })
66
- ] })
84
+ ] }),
85
+ trailing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 pl-2", children: trailing })
67
86
  ]
68
87
  }
69
88
  );
@@ -1 +1 @@
1
- {"version":3,"file":"UserItem.cjs","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":["React","jsxs","cn","jsx","BellOffIcon","Avatar","getInitials","UserDisplayName","UserHandle"],"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,WAAWA,iBAAM;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,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA,GAAG,6DAA6D,SAAS;AAAA,QACnF,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,WACCC,2BAAAA,IAAC,SAAI,WAAU,uEACb,yCAACC,YAAAA,aAAA,EAAY,MAAM,IAAI,EAAA,CACzB;AAAA,UAED,cACCD,2BAAAA;AAAAA,YAACE,OAAAA;AAAAA,YAAA;AAAA,cACC,MAAM,qBAAqB,cAAc,EAAE;AAAA,cAC3C,KAAK,KAAK,WAAW;AAAA,cACrB,KAAK,KAAK;AAAA,cACV,UAAUC,YAAAA,YAAY,KAAK,WAAW;AAAA,cACtC,iBAAiB,QAAQ,oBAAoB,QAAQ;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzDL,2BAAAA,KAAC,OAAA,EAAI,WAAU,+BACb,UAAA;AAAA,YAAAE,+BAACI,gBAAAA,mBAAgB,WAAU,uCACxB,UAAA,KAAK,YAAY,KAAK,aACzB;AAAA,YACC,cAAcJ,2BAAAA,IAACK,WAAAA,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.cjs","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":["React","jsxs","cn","jsx","BellOffIcon","Avatar","getInitials","UserDisplayName","UserHandle"],"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,WAAWA,iBAAM;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,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA,GAAG,6DAA6D,SAAS;AAAA,QACnF,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,WACCC,2BAAAA,IAAC,SAAI,WAAU,uEACb,yCAACC,YAAAA,aAAA,EAAY,MAAM,IAAI,EAAA,CACzB;AAAA,UAED,cACCD,2BAAAA;AAAAA,YAACE,OAAAA;AAAAA,YAAA;AAAA,cACC,MAAM,qBAAqB,cAAc,EAAE;AAAA,cAC3C,KAAK,KAAK,WAAW;AAAA,cACrB,KAAK,KAAK;AAAA,cACV,UAAUC,YAAAA,YAAY,KAAK,WAAW;AAAA,cACtC,iBAAiB,QAAQ,oBAAoB,QAAQ;AAAA,YAAA;AAAA,UAAA;AAAA,UAGzDL,2BAAAA,KAAC,OAAA,EAAI,WAAU,+BACZ,UAAA;AAAA,YAAA,WACCE,2BAAAA;AAAAA,cAACI,gBAAAA;AAAAA,cAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,WAAU;AAAA,gBAET,UAAA,KAAK,YAAY,KAAK;AAAA,cAAA;AAAA,YAAA;AAAA,YAG1B,aACCJ,2BAAAA,IAAC,KAAA,EAAE,WAAU,uEACV,UAAA,WACH;AAAA,YAED,cAAcA,2BAAAA,IAACK,WAAAA,YAAA,EAAY,UAAA,KAAK,OAAA,CAAO;AAAA,UAAA,GAC1C;AAAA,UACC,YAAYL,2BAAAA,IAAC,OAAA,EAAI,WAAU,iBAAiB,UAAA,SAAA,CAAS;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG5D;AACF;AAEA,SAAS,cAAc;;"}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ const cn = require("../../utils/cn.cjs");
7
+ function _interopNamespaceDefault(e) {
8
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
+ if (e) {
10
+ for (const k in e) {
11
+ if (k !== "default") {
12
+ const d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: () => e[k]
16
+ });
17
+ }
18
+ }
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
24
+ const UserItemTrailing = React__namespace.forwardRef(
25
+ ({ value, meta, className, ...props }, ref) => {
26
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: cn.cn("flex flex-col items-end", className), ...props, children: [
27
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-body-small-14px-semibold text-content-primary", children: value }),
28
+ meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-description-12px-regular text-content-secondary", children: meta })
29
+ ] });
30
+ }
31
+ );
32
+ UserItemTrailing.displayName = "UserItemTrailing";
33
+ exports.UserItemTrailing = UserItemTrailing;
34
+ //# sourceMappingURL=UserItemTrailing.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserItemTrailing.cjs","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":["React","jsxs","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,mBAAmBA,iBAAM;AAAA,EACpC,CAAC,EAAE,OAAO,MAAM,WAAW,GAAG,MAAA,GAAS,QAAQ;AAC7C,WACEC,gCAAC,SAAI,KAAU,WAAWC,MAAG,2BAA2B,SAAS,GAAI,GAAG,OACtE,UAAA;AAAA,MAAAC,2BAAAA,IAAC,QAAA,EAAK,WAAU,4DAA4D,UAAA,OAAM;AAAA,MACjF,QACCA,2BAAAA,IAAC,QAAA,EAAK,WAAU,8DAA8D,UAAA,KAAA,CAAK;AAAA,IAAA,GAEvF;AAAA,EAEJ;AACF;AAEA,iBAAiB,cAAc;;"}
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const CountryFlag = require("./components/CountryFlag/CountryFlag.cjs");
5
+ exports.CountryFlag = CountryFlag.CountryFlag;
6
+ //# sourceMappingURL=flags.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -6,7 +6,9 @@ const Accordion = require("./components/Accordion/Accordion.cjs");
6
6
  const AccordionContent = require("./components/Accordion/AccordionContent.cjs");
7
7
  const AccordionItem = require("./components/Accordion/AccordionItem.cjs");
8
8
  const AccordionTrigger = require("./components/Accordion/AccordionTrigger.cjs");
9
+ const AiButton = require("./components/AiButton/AiButton.cjs");
9
10
  const Alert = require("./components/Alert/Alert.cjs");
11
+ const AnimatedNumber = require("./components/AnimatedNumber/AnimatedNumber.cjs");
10
12
  const AudioPlayer = require("./components/AudioPlayer/AudioPlayer.cjs");
11
13
  const AudioRecordButton = require("./components/AudioRecordButton/AudioRecordButton.cjs");
12
14
  const AudioUpload = require("./components/AudioUpload/AudioUpload.cjs");
@@ -19,6 +21,7 @@ const BottomNavigation = require("./components/BottomNavigation/BottomNavigation
19
21
  const BottomNavigationAction = require("./components/BottomNavigation/BottomNavigationAction.cjs");
20
22
  const Breadcrumb = require("./components/Breadcrumb/Breadcrumb.cjs");
21
23
  const Button = require("./components/Button/Button.cjs");
24
+ const ButtonIconGroup = require("./components/ButtonIconGroup/ButtonIconGroup.cjs");
22
25
  const ButtonStack = require("./components/ButtonStack/ButtonStack.cjs");
23
26
  const Card = require("./components/Card/Card.cjs");
24
27
  const ChatInput = require("./components/ChatInput/ChatInput.cjs");
@@ -31,6 +34,7 @@ const CreatorCover = require("./components/CreatorCover/CreatorCover.cjs");
31
34
  const CreatorTile = require("./components/CreatorTile/CreatorTile.cjs");
32
35
  const CriticalBanner = require("./components/CriticalBanner/CriticalBanner.cjs");
33
36
  const CyclingText = require("./components/CyclingText/CyclingText.cjs");
37
+ const Demographics = require("./components/Demographics/Demographics.cjs");
34
38
  const Dialog = require("./components/Dialog/Dialog.cjs");
35
39
  const Divider = require("./components/Divider/Divider.cjs");
36
40
  const Drawer = require("./components/Drawer/Drawer.cjs");
@@ -251,9 +255,12 @@ const TextArea = require("./components/TextArea/TextArea.cjs");
251
255
  const TextField = require("./components/TextField/TextField.cjs");
252
256
  const Toast = require("./components/Toast/Toast.cjs");
253
257
  const Tooltip = require("./components/Tooltip/Tooltip.cjs");
258
+ const TooltipLabel = require("./components/Tooltip/TooltipLabel.cjs");
259
+ const TrendPill = require("./components/TrendPill/TrendPill.cjs");
254
260
  const UserDisplayName = require("./components/UserDisplayName/UserDisplayName.cjs");
255
261
  const UserHandle = require("./components/UserHandle/UserHandle.cjs");
256
262
  const UserItem = require("./components/UserItem/UserItem.cjs");
263
+ const UserItemTrailing = require("./components/UserItem/UserItemTrailing.cjs");
257
264
  const VoiceNote = require("./components/VoiceNote/VoiceNote.cjs");
258
265
  const cn = require("./utils/cn.cjs");
259
266
  const getInitials = require("./utils/getInitials.cjs");
@@ -270,7 +277,9 @@ exports.Accordion = Accordion.Accordion;
270
277
  exports.AccordionContent = AccordionContent.AccordionContent;
271
278
  exports.AccordionItem = AccordionItem.AccordionItem;
272
279
  exports.AccordionTrigger = AccordionTrigger.AccordionTrigger;
280
+ exports.AiButton = AiButton.AiButton;
273
281
  exports.Alert = Alert.Alert;
282
+ exports.AnimatedNumber = AnimatedNumber.AnimatedNumber;
274
283
  exports.AudioPlayer = AudioPlayer.AudioPlayer;
275
284
  exports.AudioRecordButton = AudioRecordButton.AudioRecordButton;
276
285
  exports.AudioUpload = AudioUpload.AudioUpload;
@@ -291,6 +300,7 @@ exports.BreadcrumbList = Breadcrumb.BreadcrumbList;
291
300
  exports.BreadcrumbPage = Breadcrumb.BreadcrumbPage;
292
301
  exports.BreadcrumbSeparator = Breadcrumb.BreadcrumbSeparator;
293
302
  exports.Button = Button.Button;
303
+ exports.ButtonIconGroup = ButtonIconGroup.ButtonIconGroup;
294
304
  exports.ButtonStack = ButtonStack.ButtonStack;
295
305
  exports.Card = Card.Card;
296
306
  exports.CardContent = Card.CardContent;
@@ -308,6 +318,7 @@ exports.CreatorCover = CreatorCover.CreatorCover;
308
318
  exports.CreatorTile = CreatorTile.CreatorTile;
309
319
  exports.CriticalBanner = CriticalBanner.CriticalBanner;
310
320
  exports.CyclingText = CyclingText.CyclingText;
321
+ exports.Demographics = Demographics.Demographics;
311
322
  exports.Dialog = Dialog.Dialog;
312
323
  exports.DialogBody = Dialog.DialogBody;
313
324
  exports.DialogClose = Dialog.DialogClose;
@@ -329,6 +340,7 @@ exports.DrawerOverlay = Drawer.DrawerOverlay;
329
340
  exports.DrawerTitle = Drawer.DrawerTitle;
330
341
  exports.DrawerTrigger = Drawer.DrawerTrigger;
331
342
  exports.DropdownMenu = DropdownMenu.DropdownMenu;
343
+ exports.DropdownMenuCheckboxItem = DropdownMenu.DropdownMenuCheckboxItem;
332
344
  exports.DropdownMenuContent = DropdownMenu.DropdownMenuContent;
333
345
  exports.DropdownMenuGroup = DropdownMenu.DropdownMenuGroup;
334
346
  exports.DropdownMenuHeader = DropdownMenu.DropdownMenuHeader;
@@ -585,9 +597,12 @@ exports.Tooltip = Tooltip.Tooltip;
585
597
  exports.TooltipContent = Tooltip.TooltipContent;
586
598
  exports.TooltipProvider = Tooltip.TooltipProvider;
587
599
  exports.TooltipTrigger = Tooltip.TooltipTrigger;
600
+ exports.TooltipLabel = TooltipLabel.TooltipLabel;
601
+ exports.TrendPill = TrendPill.TrendPill;
588
602
  exports.UserDisplayName = UserDisplayName.UserDisplayName;
589
603
  exports.UserHandle = UserHandle.UserHandle;
590
604
  exports.UserItem = UserItem.UserItem;
605
+ exports.UserItemTrailing = UserItemTrailing.UserItemTrailing;
591
606
  exports.VoiceNote = VoiceNote.VoiceNote;
592
607
  exports.cn = cn.cn;
593
608
  exports.getInitials = getInitials.getInitials;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -19,21 +19,21 @@ function _interopNamespaceDefault(e) {
19
19
  return Object.freeze(n);
20
20
  }
21
21
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
22
- function usePrefersReducedMotion() {
23
- const [reduced, setReduced] = React__namespace.useState(false);
24
- React__namespace.useEffect(() => {
25
- if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
26
- return;
27
- }
28
- const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
29
- const sync = () => {
30
- setReduced(mq.matches);
22
+ const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
23
+ const isSupported = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
24
+ const subscribe = (onStoreChange) => {
25
+ if (!isSupported()) {
26
+ return () => {
31
27
  };
32
- sync();
33
- mq.addEventListener("change", sync);
34
- return () => mq.removeEventListener("change", sync);
35
- }, []);
36
- return reduced;
28
+ }
29
+ const mq = window.matchMedia(REDUCED_MOTION_QUERY);
30
+ mq.addEventListener("change", onStoreChange);
31
+ return () => mq.removeEventListener("change", onStoreChange);
32
+ };
33
+ const getSnapshot = () => isSupported() ? window.matchMedia(REDUCED_MOTION_QUERY).matches : false;
34
+ const getServerSnapshot = () => false;
35
+ function usePrefersReducedMotion() {
36
+ return React__namespace.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
37
37
  }
38
38
  exports.usePrefersReducedMotion = usePrefersReducedMotion;
39
39
  //# sourceMappingURL=usePrefersReducedMotion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrefersReducedMotion.cjs","sources":["../../../src/utils/usePrefersReducedMotion.ts"],"sourcesContent":["import * as React from \"react\";\n\nconst REDUCED_MOTION_QUERY = \"(prefers-reduced-motion: reduce)\";\n\n// jsdom has no `matchMedia`, and `getSnapshot` runs during render, so an\n// unguarded call throws rather than degrades.\nconst isSupported = () => typeof window !== \"undefined\" && typeof window.matchMedia === \"function\";\n\nconst subscribe = (onStoreChange: () => void) => {\n if (!isSupported()) {\n return () => {};\n }\n const mq = window.matchMedia(REDUCED_MOTION_QUERY);\n mq.addEventListener(\"change\", onStoreChange);\n return () => mq.removeEventListener(\"change\", onStoreChange);\n};\n\nconst getSnapshot = () => (isSupported() ? window.matchMedia(REDUCED_MOTION_QUERY).matches : false);\n\nconst getServerSnapshot = () => false;\n\n/**\n * Whether the user has asked for reduced motion.\n *\n * Read during render rather than synced into state from an effect: an effect\n * returns `false` on the first render, which lets a reduced-motion user catch one\n * animated frame, and can read a stale value under concurrent rendering.\n */\nexport function usePrefersReducedMotion(): boolean {\n return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,uBAAuB;AAI7B,MAAM,cAAc,MAAM,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe;AAExF,MAAM,YAAY,CAAC,kBAA8B;AAC/C,MAAI,CAAC,eAAe;AAClB,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,QAAM,KAAK,OAAO,WAAW,oBAAoB;AACjD,KAAG,iBAAiB,UAAU,aAAa;AAC3C,SAAO,MAAM,GAAG,oBAAoB,UAAU,aAAa;AAC7D;AAEA,MAAM,cAAc,MAAO,gBAAgB,OAAO,WAAW,oBAAoB,EAAE,UAAU;AAE7F,MAAM,oBAAoB,MAAM;AASzB,SAAS,0BAAmC;AACjD,SAAOA,iBAAM,qBAAqB,WAAW,aAAa,iBAAiB;AAC7E;;"}
@@ -0,0 +1,153 @@
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
+ import { AIIcon } from "../Icons/AIIcon.mjs";
6
+ const sizeVariants = {
7
+ // At 24 the label steps down to the 12px description scale: the 14px label
8
+ // Button uses at this height leaves the glyph and text crowding a 24px box,
9
+ // since 16px is the smallest authored icon geometry and cannot step down with it.
10
+ "24": "h-6 gap-1 px-2 py-1 typography-description-12px-semibold",
11
+ "32": "h-8 gap-2 px-3 py-[7px] typography-body-small-14px-semibold",
12
+ "40": "h-10 gap-2 px-4 py-2 typography-body-default-16px-semibold"
13
+ };
14
+ const iconSizeVariants = {
15
+ "24": 16,
16
+ "32": 16,
17
+ "40": 24
18
+ };
19
+ const iconScaleVariants = {
20
+ "24": "[&_svg]:size-3.5",
21
+ "32": "",
22
+ "40": ""
23
+ };
24
+ const LETTER_STAGGER = 0.08;
25
+ const trackPointer = (event) => {
26
+ const { left, width } = event.currentTarget.getBoundingClientRect();
27
+ event.currentTarget.style.setProperty("--fv-ai-x", `${(event.clientX - left) / width * 100}%`);
28
+ };
29
+ const ShimmerLabel = ({ text, disabled }) => /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: Array.from(text).map((character, index) => /* @__PURE__ */ jsx(
30
+ "span",
31
+ {
32
+ className: cn(
33
+ "inline-block whitespace-pre text-content-secondary",
34
+ // Gated in JS rather than with a `group-disabled/ai:` override, because
35
+ // that would rely on the generated rule ordering to beat `group-hover`.
36
+ // A faded control that still shimmers and still lights up green under the
37
+ // cursor reads as busy rather than unavailable.
38
+ !disabled && [
39
+ "[animation:fv-ai-letter_2s_ease-in-out_infinite]",
40
+ "group-hover/ai:text-content-primary group-hover/ai:[animation:none]",
41
+ // On focus each letter blows up and settles, then the idle shimmer
42
+ // resumes underneath it — the two animations are sequenced by delay.
43
+ "group-focus-visible/ai:[animation:fv-ai-letter-focus_1s_ease-in-out,fv-ai-letter_1.2s_ease-in-out_infinite_1s]",
44
+ "group-active/ai:text-content-primary group-active/ai:[animation:none]",
45
+ "group-active/ai:[text-shadow:0_0_4px_var(--color-content-primary)]"
46
+ ],
47
+ "motion-reduce:[animation:none]"
48
+ ),
49
+ style: { animationDelay: `${index * LETTER_STAGGER}s` },
50
+ children: character
51
+ },
52
+ `${character}-${index}`
53
+ )) });
54
+ const AiButton = React.forwardRef(
55
+ ({
56
+ label,
57
+ activeLabel,
58
+ active = false,
59
+ size = "32",
60
+ icon,
61
+ type = "button",
62
+ className,
63
+ disabled,
64
+ onPointerMove,
65
+ onPointerLeave,
66
+ ...props
67
+ }, ref) => {
68
+ const resolvedActiveLabel = activeLabel ?? label;
69
+ return /* @__PURE__ */ jsxs(
70
+ "button",
71
+ {
72
+ ref,
73
+ type,
74
+ disabled,
75
+ "aria-label": props["aria-label"] ?? (active ? resolvedActiveLabel : label),
76
+ "aria-busy": active || void 0,
77
+ onPointerMove: (event) => {
78
+ trackPointer(event);
79
+ onPointerMove?.(event);
80
+ },
81
+ onPointerLeave: (event) => {
82
+ event.currentTarget.style.removeProperty("--fv-ai-x");
83
+ onPointerLeave?.(event);
84
+ },
85
+ className: cn(
86
+ "fv-ai-button",
87
+ "group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full",
88
+ "border border-border-primary bg-background-primary",
89
+ // Matched to the rim and sheen so the whole treatment arrives as one
90
+ // movement — at the old 300ms the outline landed ahead of the glow.
91
+ "transition-[background-color,border-color] duration-[400ms] ease-out",
92
+ "hover:border-brand-primary-default",
93
+ "focus-visible:outline-none",
94
+ "active:border-brand-primary-hover active:bg-brand-primary-muted",
95
+ "disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-border-primary",
96
+ sizeVariants[size],
97
+ className
98
+ ),
99
+ ...props,
100
+ children: [
101
+ /* @__PURE__ */ jsx(
102
+ "span",
103
+ {
104
+ className: cn(
105
+ "flex shrink-0 items-center text-content-primary",
106
+ iconScaleVariants[size],
107
+ "[filter:drop-shadow(0_0_2px_color-mix(in_srgb,var(--color-content-primary)_60%,transparent))]",
108
+ // Same reasoning as the letters: no flicker and no green lift once the
109
+ // button is unavailable.
110
+ !disabled && [
111
+ "[animation:fv-ai-flicker_2s_linear_infinite] [animation-delay:0.5s]",
112
+ // Settles solid on hover, lit green from below like the sheen.
113
+ "group-hover/ai:[animation:none]",
114
+ "group-hover/ai:[filter:drop-shadow(0_0_3px_var(--color-brand-primary-default))_drop-shadow(0_-4px_6px_color-mix(in_srgb,var(--color-content-always-black)_60%,transparent))]",
115
+ "group-focus-visible/ai:[animation-duration:1.2s] group-focus-visible/ai:[animation-delay:0.2s]"
116
+ ],
117
+ "motion-reduce:[animation:none]"
118
+ ),
119
+ children: icon ?? /* @__PURE__ */ jsx(AIIcon, { size: iconSizeVariants[size], filled: true })
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsxs("span", { className: "grid", children: [
123
+ /* @__PURE__ */ jsx(
124
+ "span",
125
+ {
126
+ className: cn(
127
+ "col-start-1 row-start-1 transition-opacity duration-300",
128
+ active ? "opacity-0" : "opacity-100"
129
+ ),
130
+ children: /* @__PURE__ */ jsx(ShimmerLabel, { text: label, disabled })
131
+ }
132
+ ),
133
+ /* @__PURE__ */ jsx(
134
+ "span",
135
+ {
136
+ className: cn(
137
+ "col-start-1 row-start-1 transition-opacity duration-300",
138
+ active ? "opacity-100" : "opacity-0"
139
+ ),
140
+ children: /* @__PURE__ */ jsx(ShimmerLabel, { text: resolvedActiveLabel, disabled })
141
+ }
142
+ )
143
+ ] })
144
+ ]
145
+ }
146
+ );
147
+ }
148
+ );
149
+ AiButton.displayName = "AiButton";
150
+ export {
151
+ AiButton
152
+ };
153
+ //# sourceMappingURL=AiButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiButton.mjs","sources":["../../../src/components/AiButton/AiButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIIcon } from \"../Icons/AIIcon\";\nimport type { IconSize } from \"../Icons/types\";\n\n/** Height, padding and label typography, matching {@link Button}'s scale. */\nexport type AiButtonSize = \"24\" | \"32\" | \"40\";\n\nconst sizeVariants: Record<AiButtonSize, string> = {\n // At 24 the label steps down to the 12px description scale: the 14px label\n // Button uses at this height leaves the glyph and text crowding a 24px box,\n // since 16px is the smallest authored icon geometry and cannot step down with it.\n \"24\": \"h-6 gap-1 px-2 py-1 typography-description-12px-semibold\",\n \"32\": \"h-8 gap-2 px-3 py-[7px] typography-body-small-14px-semibold\",\n \"40\": \"h-10 gap-2 px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nconst iconSizeVariants: Record<AiButtonSize, IconSize> = {\n \"24\": 16,\n \"32\": 16,\n \"40\": 24,\n};\n\n/**\n * Optical size, applied on top of the authored geometry. Only 16, 24 and 32 have\n * dedicated paths, so the 24 button renders the 16px glyph down at 14 to sit with\n * its 12px label rather than towering over it.\n */\nconst iconScaleVariants: Record<AiButtonSize, string> = {\n \"24\": \"[&_svg]:size-3.5\",\n \"32\": \"\",\n \"40\": \"\",\n};\n\n/** Delay between adjacent letters, in seconds. */\nconst LETTER_STAGGER = 0.08;\n\n/**\n * Points the bottom sheen at the cursor by writing its x offset, as a percentage\n * of the button's width, straight to the DOM node. Deliberately not React state:\n * this fires every pointer-move frame, and a re-render per frame would both cost\n * more than the paint and leave the glow trailing the cursor.\n */\nconst trackPointer = (event: React.PointerEvent<HTMLButtonElement>) => {\n const { left, width } = event.currentTarget.getBoundingClientRect();\n event.currentTarget.style.setProperty(\"--fv-ai-x\", `${((event.clientX - left) / width) * 100}%`);\n};\n\n/** Props for {@link AiButton}. */\nexport interface AiButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"type\"> {\n /** Resting label. Also the accessible name unless `aria-label` is given. */\n label: string;\n /** Label shown while `active`. Falls back to {@link label}. */\n activeLabel?: string;\n /** Swap to {@link activeLabel} and keep the shimmer running. @default false */\n active?: boolean;\n /** @default \"32\" */\n size?: AiButtonSize;\n /** Replace the leading AI glyph. */\n icon?: React.ReactNode;\n /** @default \"button\" */\n type?: \"button\" | \"submit\" | \"reset\";\n}\n\n/**\n * Renders one `<span>` per character so each can carry its own animation delay.\n * The run is hidden from assistive tech — the button's accessible name comes from\n * its `aria-label`, so a screen reader says \"Analyse\" rather than spelling it out.\n */\nconst ShimmerLabel: React.FC<{ text: string; disabled?: boolean }> = ({ text, disabled }) => (\n <span aria-hidden=\"true\">\n {Array.from(text).map((character, index) => (\n <span\n key={`${character}-${index}`}\n className={cn(\n \"inline-block whitespace-pre text-content-secondary\",\n // Gated in JS rather than with a `group-disabled/ai:` override, because\n // that would rely on the generated rule ordering to beat `group-hover`.\n // A faded control that still shimmers and still lights up green under the\n // cursor reads as busy rather than unavailable.\n !disabled && [\n \"[animation:fv-ai-letter_2s_ease-in-out_infinite]\",\n \"group-hover/ai:text-content-primary group-hover/ai:[animation:none]\",\n // On focus each letter blows up and settles, then the idle shimmer\n // resumes underneath it — the two animations are sequenced by delay.\n \"group-focus-visible/ai:[animation:fv-ai-letter-focus_1s_ease-in-out,fv-ai-letter_1.2s_ease-in-out_infinite_1s]\",\n \"group-active/ai:text-content-primary group-active/ai:[animation:none]\",\n \"group-active/ai:[text-shadow:0_0_4px_var(--color-content-primary)]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n style={{ animationDelay: `${index * LETTER_STAGGER}s` }}\n >\n {character}\n </span>\n ))}\n </span>\n);\n\n/**\n * A pill button for AI actions. The label shimmers letter by letter and the glyph\n * flickers at rest; on hover both settle and the green treatment eases in together\n * — outline, rim and a sheen pooling along the bottom edge under the cursor, which\n * follows it across the button. On focus each letter blooms once before the shimmer\n * resumes. The lit rim and sheen come from the `fv-ai-button` utility in `base.css`.\n *\n * It shares {@link Button}'s geometry — `rounded-full`, the same heights and label\n * typography — so it sits alongside one without looking foreign. Both labels are\n * rendered stacked in a single grid cell, so swapping to `active` crossfades\n * without the button changing width.\n *\n * Honours `prefers-reduced-motion`: the shimmer and flicker are dropped and the\n * label renders in its settled state.\n *\n * @example\n * ```tsx\n * <AiButton label=\"Analyse\" activeLabel=\"Analysing\" active={isPending} onClick={run} />\n * ```\n */\nexport const AiButton = React.forwardRef<HTMLButtonElement, AiButtonProps>(\n (\n {\n label,\n activeLabel,\n active = false,\n size = \"32\",\n icon,\n type = \"button\",\n className,\n disabled,\n onPointerMove,\n onPointerLeave,\n ...props\n },\n ref,\n ) => {\n const resolvedActiveLabel = activeLabel ?? label;\n\n return (\n <button\n ref={ref}\n type={type}\n disabled={disabled}\n aria-label={props[\"aria-label\"] ?? (active ? resolvedActiveLabel : label)}\n aria-busy={active || undefined}\n onPointerMove={(event) => {\n trackPointer(event);\n onPointerMove?.(event);\n }}\n // Drop back to the utility's centred default, so a keyboard focus after\n // the pointer has left does not light up wherever the cursor last was.\n onPointerLeave={(event) => {\n event.currentTarget.style.removeProperty(\"--fv-ai-x\");\n onPointerLeave?.(event);\n }}\n className={cn(\n \"fv-ai-button\",\n \"group/ai inline-flex cursor-pointer items-center justify-center whitespace-nowrap rounded-full\",\n \"border border-border-primary bg-background-primary\",\n // Matched to the rim and sheen so the whole treatment arrives as one\n // movement — at the old 300ms the outline landed ahead of the glow.\n \"transition-[background-color,border-color] duration-[400ms] ease-out\",\n \"hover:border-brand-primary-default\",\n \"focus-visible:outline-none\",\n \"active:border-brand-primary-hover active:bg-brand-primary-muted\",\n \"disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-border-primary\",\n sizeVariants[size],\n className,\n )}\n {...props}\n >\n <span\n className={cn(\n \"flex shrink-0 items-center text-content-primary\",\n iconScaleVariants[size],\n \"[filter:drop-shadow(0_0_2px_color-mix(in_srgb,var(--color-content-primary)_60%,transparent))]\",\n // Same reasoning as the letters: no flicker and no green lift once the\n // button is unavailable.\n !disabled && [\n \"[animation:fv-ai-flicker_2s_linear_infinite] [animation-delay:0.5s]\",\n // Settles solid on hover, lit green from below like the sheen.\n \"group-hover/ai:[animation:none]\",\n \"group-hover/ai:[filter:drop-shadow(0_0_3px_var(--color-brand-primary-default))_drop-shadow(0_-4px_6px_color-mix(in_srgb,var(--color-content-always-black)_60%,transparent))]\",\n \"group-focus-visible/ai:[animation-duration:1.2s] group-focus-visible/ai:[animation-delay:0.2s]\",\n ],\n \"motion-reduce:[animation:none]\",\n )}\n >\n {icon ?? <AIIcon size={iconSizeVariants[size]} filled />}\n </span>\n {/* Both labels occupy one grid cell so the button keeps the width of the\n longer of the two and the swap never reflows the row around it. */}\n <span className=\"grid\">\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-0\" : \"opacity-100\",\n )}\n >\n <ShimmerLabel text={label} disabled={disabled} />\n </span>\n <span\n className={cn(\n \"col-start-1 row-start-1 transition-opacity duration-300\",\n active ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n <ShimmerLabel text={resolvedActiveLabel} disabled={disabled} />\n </span>\n </span>\n </button>\n );\n },\n);\n\nAiButton.displayName = \"AiButton\";\n"],"names":[],"mappings":";;;;;AAQA,MAAM,eAA6C;AAAA;AAAA;AAAA;AAAA,EAIjD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,mBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAOA,MAAM,oBAAkD;AAAA,EACtD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAGA,MAAM,iBAAiB;AAQvB,MAAM,eAAe,CAAC,UAAiD;AACrE,QAAM,EAAE,MAAM,MAAA,IAAU,MAAM,cAAc,sBAAA;AAC5C,QAAM,cAAc,MAAM,YAAY,aAAa,IAAK,MAAM,UAAU,QAAQ,QAAS,GAAG,GAAG;AACjG;AAuBA,MAAM,eAA+D,CAAC,EAAE,MAAM,SAAA,MAC5E,oBAAC,QAAA,EAAK,eAAY,QACf,gBAAM,KAAK,IAAI,EAAE,IAAI,CAAC,WAAW,UAChC;AAAA,EAAC;AAAA,EAAA;AAAA,IAEC,WAAW;AAAA,MACT;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,CAAC,YAAY;AAAA,QACX;AAAA,QACA;AAAA;AAAA;AAAA,QAGA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAEF;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,gBAAgB,GAAG,QAAQ,cAAc,IAAA;AAAA,IAEjD,UAAA;AAAA,EAAA;AAAA,EApBI,GAAG,SAAS,IAAI,KAAK;AAqB5B,CACD,GACH;AAuBK,MAAM,WAAW,MAAM;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,sBAAsB,eAAe;AAE3C,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAY,MAAM,YAAY,MAAM,SAAS,sBAAsB;AAAA,QACnE,aAAW,UAAU;AAAA,QACrB,eAAe,CAAC,UAAU;AACxB,uBAAa,KAAK;AAClB,0BAAgB,KAAK;AAAA,QACvB;AAAA,QAGA,gBAAgB,CAAC,UAAU;AACzB,gBAAM,cAAc,MAAM,eAAe,WAAW;AACpD,2BAAiB,KAAK;AAAA,QACxB;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA;AAAA;AAAA,UAGA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,aAAa,IAAI;AAAA,UACjB;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA,kBAAkB,IAAI;AAAA,gBACtB;AAAA;AAAA;AAAA,gBAGA,CAAC,YAAY;AAAA,kBACX;AAAA;AAAA,kBAEA;AAAA,kBACA;AAAA,kBACA;AAAA,gBAAA;AAAA,gBAEF;AAAA,cAAA;AAAA,cAGD,UAAA,4BAAS,QAAA,EAAO,MAAM,iBAAiB,IAAI,GAAG,QAAM,KAAA,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,UAIxD,qBAAC,QAAA,EAAK,WAAU,QACd,UAAA;AAAA,YAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,SAAS,cAAc;AAAA,gBAAA;AAAA,gBAGzB,UAAA,oBAAC,cAAA,EAAa,MAAM,OAAO,SAAA,CAAoB;AAAA,cAAA;AAAA,YAAA;AAAA,YAEjD;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,SAAS,gBAAgB;AAAA,gBAAA;AAAA,gBAG3B,UAAA,oBAAC,cAAA,EAAa,MAAM,qBAAqB,SAAA,CAAoB;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/D,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAAS,cAAc;"}