{
  "name": "message-group",
  "type": "registry:ui",
  "framework": "react",
  "title": "Message Group",
  "description": "A grouped chat message with author, timestamp, reply preview, reactions and an ephemeral state.",
  "registryDependencies": [
    "@newtui/avatar",
    "@newtui/reaction",
    "@newtui/reply-preview",
    "@newtui/status-indicator"
  ],
  "files": [
    {
      "path": "ui/message-group.tsx",
      "content": "import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport interface MessageGroupProps extends React.HTMLAttributes<HTMLElement> {\n  /**\n   * The element to render. `div` by default; `article` when each message is a\n   * self-contained post, `li` inside a list of messages.\n   */\n  as?: React.ElementType\n  /**\n   * Lay the row out as a 2x2 grid so a `MessageGroupReply` can hook over the\n   * avatar, the way the client stacks a reply above the message it answers.\n   */\n  withReply?: boolean\n  /** Tint the row as an ephemeral (visible-to-you-only) response. */\n  ephemeral?: boolean\n}\n\nconst MessageGroup = React.forwardRef<HTMLElement, MessageGroupProps>(\n  (\n    {\n      as: Tag = \"div\",\n      className,\n      withReply = false,\n      ephemeral = false,\n      ...props\n    },\n    ref\n  ) => (\n    <Tag\n      ref={ref}\n      data-slot=\"message-row\"\n      data-ephemeral={ephemeral || undefined}\n      className={cn(\n        /*\n         * The size of the avatar and the gap beside it. A reply preview in the\n         * row reads both, so its spine starts above the centre of the avatar.\n         * Set them when the row holds an avatar of another size.\n         */\n        \"gap-x-[var(--newt-message-group-gap)] py-1 [--newt-message-group-avatar-size:40px] [--newt-message-group-gap:16px]\",\n        /*\n         * The colour of the message text is on the row and the content\n         * inherits it, so a colour class on the row reaches the content. The\n         * fallback keeps a project without `--newt-text-message` on the\n         * colour it had.\n         */\n        \"text-[color:var(--newt-text-message,var(--newt-text-secondary))]\",\n        withReply\n          ? \"grid grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_auto] items-start gap-y-0.5 [&>[data-slot=message-avatar]]:col-start-1 [&>[data-slot=message-avatar]]:row-start-2 [&>[data-slot=message-body]]:col-start-2 [&>[data-slot=message-body]]:row-start-2 [&>[data-slot=message-reply]]:col-start-2 [&>[data-slot=message-reply]]:row-start-1\"\n          : \"flex\",\n        ephemeral\n          ? \"border-s-2 border-[color-mix(in_srgb,var(--newt-text-link)_40%,transparent)] bg-[color-mix(in_srgb,var(--newt-text-link)_10%,transparent)] hover:bg-[color-mix(in_srgb,var(--newt-text-link)_15%,transparent)]\"\n          : \"hover:bg-newt-bg-message-hover\",\n        className\n      )}\n      {...props}\n    />\n  )\n)\nMessageGroup.displayName = \"MessageGroup\"\n\nconst MessageGroupAvatar = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    data-slot=\"message-avatar\"\n    className={cn(\"shrink-0\", className)}\n    {...props}\n  />\n))\nMessageGroupAvatar.displayName = \"MessageGroupAvatar\"\n\nconst MessageGroupReply = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    data-slot=\"message-reply\"\n    className={cn(\"min-w-0\", className)}\n    {...props}\n  />\n))\nMessageGroupReply.displayName = \"MessageGroupReply\"\n\nconst MessageGroupBody = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    data-slot=\"message-body\"\n    className={cn(\"min-w-0 flex-1\", className)}\n    {...props}\n  />\n))\nMessageGroupBody.displayName = \"MessageGroupBody\"\n\nconst MessageGroupHeader = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"mb-1 flex items-baseline gap-2\", className)}\n    {...props}\n  />\n))\nMessageGroupHeader.displayName = \"MessageGroupHeader\"\n\nconst MessageGroupAuthor = React.forwardRef<\n  HTMLSpanElement,\n  React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n  <span\n    ref={ref}\n    className={cn(\n      \"text-[15px] font-semibold text-newt-text-primary\",\n      className\n    )}\n    {...props}\n  />\n))\nMessageGroupAuthor.displayName = \"MessageGroupAuthor\"\n\nexport interface MessageGroupBotTagProps extends React.HTMLAttributes<HTMLSpanElement> {\n  /** Add the check Discord puts on verified applications. */\n  verified?: boolean\n  /** Accessible name of the tag. `aria-label` still wins. */\n  label?: string\n  /** Accessible name with `verified`. `aria-label` still wins. */\n  verifiedLabel?: string\n  /** Fixed accessible name. Wins over `label` and `verifiedLabel`. */\n  \"aria-label\"?: string\n}\n\nconst MessageGroupBotTag = React.forwardRef<\n  HTMLSpanElement,\n  MessageGroupBotTagProps\n>(\n  (\n    {\n      className,\n      verified = false,\n      label = \"Application\",\n      verifiedLabel = \"Verified application\",\n      children = \"BOT\",\n      \"aria-label\": ariaLabel,\n      ...props\n    },\n    ref\n  ) => (\n    <span\n      ref={ref}\n      role=\"img\"\n      aria-label={ariaLabel ?? (verified ? verifiedLabel : label)}\n      className={cn(\n        \"inline-flex items-center gap-0.5 rounded-[3px] bg-newt-brand px-1 py-px text-[10px] font-semibold uppercase tracking-[0.02em] text-newt-on-accent\",\n        className\n      )}\n      {...props}\n    >\n      {verified ? (\n        <svg\n          viewBox=\"0 0 24 24\"\n          aria-hidden=\"true\"\n          focusable=\"false\"\n          className=\"h-2.5 w-2.5\"\n        >\n          <path\n            fill=\"currentColor\"\n            d=\"M9.55 17.6 4.4 12.45l1.4-1.4 3.75 3.75 8.65-8.65 1.4 1.4z\"\n          />\n        </svg>\n      ) : null}\n      {children}\n    </span>\n  )\n)\nMessageGroupBotTag.displayName = \"MessageGroupBotTag\"\n\n/* A real `<time>`: the timestamp is machine-readable, not just small text. */\nconst MessageGroupTime = React.forwardRef<\n  HTMLTimeElement,\n  React.ComponentProps<\"time\">\n>(({ className, ...props }, ref) => (\n  <time\n    ref={ref}\n    className={cn(\"text-[11px] text-newt-text-muted\", className)}\n    {...props}\n  />\n))\nMessageGroupTime.displayName = \"MessageGroupTime\"\n\n/* No colour of its own: the content takes the colour of the row. */\nconst MessageGroupContent = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"text-[15px] leading-[1.5]\", className)}\n    {...props}\n  />\n))\nMessageGroupContent.displayName = \"MessageGroupContent\"\n\nconst MessageGroupReactions = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"mt-1.5 flex flex-wrap gap-1\", className)}\n    {...props}\n  />\n))\nMessageGroupReactions.displayName = \"MessageGroupReactions\"\n\n/*\n * The \"only you can see this\" footer Discord shows under an ephemeral reply.\n * Children replace the default copy; the dismiss control is the caller's.\n */\nconst MessageGroupEphemeralNotice = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    role=\"status\"\n    className={cn(\n      \"mt-1.5 flex items-center gap-1 text-[13px] text-newt-text-muted\",\n      className\n    )}\n    {...props}\n  />\n))\nMessageGroupEphemeralNotice.displayName = \"MessageGroupEphemeralNotice\"\n\nconst MessageGroupEphemeralAction = React.forwardRef<\n  HTMLButtonElement,\n  React.ComponentProps<\"button\">\n>(({ className, type = \"button\", ...props }, ref) => (\n  <button\n    ref={ref}\n    type={type}\n    className={cn(\n      \"cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-newt-text-link hover:underline\",\n      className\n    )}\n    {...props}\n  />\n))\nMessageGroupEphemeralAction.displayName = \"MessageGroupEphemeralAction\"\n\nexport {\n  MessageGroup,\n  MessageGroupAvatar,\n  MessageGroupReply,\n  MessageGroupBody,\n  MessageGroupHeader,\n  MessageGroupAuthor,\n  MessageGroupBotTag,\n  MessageGroupTime,\n  MessageGroupContent,\n  MessageGroupReactions,\n  MessageGroupEphemeralNotice,\n  MessageGroupEphemeralAction,\n}\n",
      "type": "registry:ui"
    }
  ]
}