@designa8/vibedesign-v6 2.2.1 → 2.2.2

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @plasma/vibedesign-v6
2
2
 
3
- Complete design system generated by Atoms Design, version **2.2.1**.
3
+ Complete design system generated by Atoms Design, version **2.2.2**.
4
4
  Tokens, atoms, molecules, organisms, and templates — import from the package root;
5
5
  never hardcode visual values in consumer code.
6
6
 
package/dist/index.cjs CHANGED
@@ -987,6 +987,7 @@ var Chip = import_react5.default.forwardRef(
987
987
  icon,
988
988
  imageSrc,
989
989
  imageAlt,
990
+ uploadProgress,
990
991
  onDismiss,
991
992
  disabled = false,
992
993
  className = "",
@@ -997,16 +998,41 @@ var Chip = import_react5.default.forwardRef(
997
998
  const [lightboxOpen, setLightboxOpen] = (0, import_react5.useState)(false);
998
999
  const disabledStyles = disabled ? "opacity-50 pointer-events-none select-none" : "";
999
1000
  const isLightboxTrigger = Boolean(imageSrc) && !disabled;
1001
+ const showProgressBar = imageSrc && typeof uploadProgress === "number" && uploadProgress < 100;
1000
1002
  const openLightbox = () => {
1001
1003
  if (isLightboxTrigger) setLightboxOpen(true);
1002
1004
  };
1003
- const handleBodyKeyDown = (e) => {
1004
- if (!isLightboxTrigger) return;
1005
- if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
1006
- e.preventDefault();
1007
- openLightbox();
1005
+ const renderThumbnail = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1006
+ "span",
1007
+ {
1008
+ className: `${sz.thumb} flex-shrink-0 rounded-xs overflow-hidden inline-block relative`,
1009
+ "aria-hidden": "true",
1010
+ children: [
1011
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1012
+ "img",
1013
+ {
1014
+ src: imageSrc,
1015
+ alt: imageAlt || label,
1016
+ className: "w-full h-full object-cover"
1017
+ }
1018
+ ),
1019
+ showProgressBar && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1020
+ "div",
1021
+ {
1022
+ className: "absolute bottom-0 left-0 right-0 h-0.5 bg-scrim",
1023
+ "aria-label": `Upload progress: ${uploadProgress}%`,
1024
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1025
+ "div",
1026
+ {
1027
+ className: "h-full bg-primary transition-all duration-200",
1028
+ style: { width: `${uploadProgress}%` }
1029
+ }
1030
+ )
1031
+ }
1032
+ )
1033
+ ]
1008
1034
  }
1009
- };
1035
+ );
1010
1036
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1011
1037
  "span",
1012
1038
  {
@@ -1022,43 +1048,30 @@ var Chip = import_react5.default.forwardRef(
1022
1048
  ].filter(Boolean).join(" "),
1023
1049
  ...props,
1024
1050
  children: [
1025
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1026
- "span",
1051
+ isLightboxTrigger ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1052
+ Button,
1027
1053
  {
1028
- className: "inline-flex items-center gap-xs",
1029
- onClick: isLightboxTrigger ? openLightbox : void 0,
1030
- onKeyDown: isLightboxTrigger ? handleBodyKeyDown : void 0,
1031
- role: isLightboxTrigger ? "button" : void 0,
1032
- tabIndex: isLightboxTrigger ? 0 : void 0,
1033
- "aria-label": isLightboxTrigger ? `View image for ${label}` : void 0,
1034
- style: isLightboxTrigger ? { cursor: "pointer" } : void 0,
1054
+ variant: "bare",
1055
+ size: "auto",
1056
+ onClick: openLightbox,
1057
+ "aria-label": `View image for ${label}`,
1058
+ className: "inline-flex items-center gap-xs cursor-pointer p-0 m-0 hover:opacity-80 transition-opacity",
1035
1059
  children: [
1036
- imageSrc ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1037
- "span",
1038
- {
1039
- className: `${sz.thumb} flex-shrink-0 rounded-xs overflow-hidden inline-block`,
1040
- "aria-hidden": "true",
1041
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1042
- "img",
1043
- {
1044
- src: imageSrc,
1045
- alt: imageAlt || label,
1046
- className: "w-full h-full object-cover"
1047
- }
1048
- )
1049
- }
1050
- ) : icon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1051
- "span",
1052
- {
1053
- className: `${sz.icon} flex-shrink-0 flex items-center justify-center`,
1054
- "aria-hidden": "true",
1055
- children: icon
1056
- }
1057
- ),
1060
+ renderThumbnail(),
1058
1061
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: sz.text, children: label })
1059
1062
  ]
1060
1063
  }
1061
- ),
1064
+ ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "inline-flex items-center gap-xs", children: [
1065
+ imageSrc ? renderThumbnail() : icon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1066
+ "span",
1067
+ {
1068
+ className: `${sz.icon} flex-shrink-0 flex items-center justify-center`,
1069
+ "aria-hidden": "true",
1070
+ children: icon
1071
+ }
1072
+ ),
1073
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: sz.text, children: label })
1074
+ ] }),
1062
1075
  onDismiss && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1063
1076
  Button,
1064
1077
  {
@@ -2778,11 +2791,17 @@ var TimelineBlock = ({ items }) => {
2778
2791
  ] });
2779
2792
  };
2780
2793
  var AgentConversationMark = ({ mark, align = "start" }) => {
2781
- const pillClasses = "inline-flex items-center gap-xs rounded-full bg-canvas px-sm py-xxs text-caption font-weight-heading-sm text-primary shadow-sm hover:bg-surface-soft transition-colors duration-150 whitespace-nowrap";
2782
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: ["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" "), children: mark.href ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("a", { href: mark.href, className: pillClasses, children: [
2783
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "two-people-users-group", size: 12 }),
2784
- mark.label
2785
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2794
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: ["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" "), children: mark.href ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2795
+ "a",
2796
+ {
2797
+ href: mark.href,
2798
+ className: "inline-flex items-center gap-xs rounded-full bg-canvas px-sm py-xxs text-caption font-weight-heading-sm text-primary shadow-sm whitespace-nowrap cursor-pointer transition duration-150 ease-out hover:bg-surface-soft active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
2799
+ children: [
2800
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { name: "two-people-users-group", size: 12 }),
2801
+ mark.label
2802
+ ]
2803
+ }
2804
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2786
2805
  Button,
2787
2806
  {
2788
2807
  variant: "ghost",
@@ -2871,7 +2890,7 @@ var SuggestedImageWidget = ({
2871
2890
  setSelectedId(void 0);
2872
2891
  setIsOpen(true);
2873
2892
  };
2874
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mt-md", children: [
2893
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-md flex flex-col items-start self-start", children: [
2875
2894
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2876
2895
  Button,
2877
2896
  {
@@ -2879,7 +2898,7 @@ var SuggestedImageWidget = ({
2879
2898
  variant: "ghost",
2880
2899
  pushEffect: false,
2881
2900
  onClick: handleOpen,
2882
- className: "group relative block !p-0 max-w-full overflow-hidden rounded-lg bg-surface-strong border border-hairline",
2901
+ className: "group relative block self-start !p-0 max-w-full overflow-hidden rounded-lg bg-surface-strong border border-hairline",
2883
2902
  style: { maxHeight: "14rem", width: "20rem" },
2884
2903
  "aria-label": alt ?? "Open design suggestion",
2885
2904
  children: [
@@ -2888,7 +2907,7 @@ var SuggestedImageWidget = ({
2888
2907
  {
2889
2908
  src,
2890
2909
  alt: alt ?? "",
2891
- className: "w-full object-cover transition-transform duration-150 group-hover:scale-[1.02]",
2910
+ className: "block w-full object-cover object-top transition-transform duration-150 group-hover:scale-[1.02]",
2892
2911
  style: { maxHeight: "14rem" }
2893
2912
  }
2894
2913
  ),
@@ -2897,7 +2916,7 @@ var SuggestedImageWidget = ({
2897
2916
  {
2898
2917
  src: opt.src,
2899
2918
  alt: opt.label,
2900
- className: "h-10 w-10 flex-shrink-0 rounded-sm object-cover border border-hairline"
2919
+ className: "h-10 w-10 flex-shrink-0 rounded-sm object-cover object-top border border-hairline"
2901
2920
  },
2902
2921
  opt.id
2903
2922
  )) })
@@ -3021,13 +3040,16 @@ var CopyMessageButton = ({
3021
3040
  };
3022
3041
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center justify-end mb-xs", children: [
3023
3042
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3024
- "button",
3043
+ Button,
3025
3044
  {
3026
3045
  type: "button",
3046
+ variant: "bare",
3047
+ size: "auto",
3048
+ pushEffect: false,
3027
3049
  onClick: handleCopy,
3028
3050
  "aria-label": copied ? "Message copied" : "Copy message",
3029
3051
  "data-copied": copied ? "true" : "false",
3030
- className: "inline-flex items-center justify-center rounded-xs p-xxs text-muted-soft opacity-0 cursor-pointer transition duration-150 ease-out hover:text-ink active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 data-[copied=true]:opacity-100",
3052
+ className: "inline-flex items-center justify-center rounded-xs p-xxs text-muted-soft opacity-0 hover:text-ink active:scale-[0.98] focus-visible:ring-focus-blue group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 data-[copied=true]:opacity-100",
3031
3053
  children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3032
3054
  Icon,
3033
3055
  {
@@ -3080,7 +3102,8 @@ var ThinkingIndicator = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(imp
3080
3102
  ] });
3081
3103
  var AiMessage = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-start gap-md w-full", children: [
3082
3104
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AIAvatar, {}),
3083
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex-1 min-w-0", children: [
3105
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex-1 min-w-0 flex flex-col items-stretch justify-start", children: [
3106
+ message.suggestedImage && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SuggestedImageWidget, { suggestedImage: message.suggestedImage }),
3084
3107
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3085
3108
  ExpandableMessage,
3086
3109
  {
@@ -3092,7 +3115,6 @@ var AiMessage = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3092
3115
  ),
3093
3116
  message.inFlight && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ThinkingIndicator, {}),
3094
3117
  message.images && message.images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MessageImageGallery, { images: message.images, align: "start" }),
3095
- message.suggestedImage && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SuggestedImageWidget, { suggestedImage: message.suggestedImage }),
3096
3118
  message.timeline && message.timeline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TimelineBlock, { items: message.timeline }),
3097
3119
  message.agentMark && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AgentConversationMark, { mark: message.agentMark, align: "start" }),
3098
3120
  message.postContent && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
@@ -3143,11 +3165,14 @@ var UserMessage = ({ message }) => {
3143
3165
  hasText && failed && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mt-xs flex items-center gap-sm justify-end", children: [
3144
3166
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-caption text-semantic-error", children: "Not sent" }),
3145
3167
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3146
- "button",
3168
+ Button,
3147
3169
  {
3148
3170
  type: "button",
3171
+ variant: "bare",
3172
+ size: "auto",
3173
+ pushEffect: false,
3149
3174
  onClick: () => message.onRetry?.(message),
3150
- className: "rounded-xs text-caption text-primary-text underline underline-offset-2 cursor-pointer transition duration-150 ease-out hover:text-primary-active active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
3175
+ className: "rounded-xs text-caption text-primary-text underline underline-offset-2 hover:text-primary-active active:scale-[0.98] focus-visible:ring-focus-blue",
3151
3176
  children: "Retry"
3152
3177
  }
3153
3178
  )
@@ -3493,7 +3518,7 @@ var HistoryRow = ({ item, active = false, onClick }) => {
3493
3518
  "li",
3494
3519
  {
3495
3520
  className: [
3496
- "list-none flex items-center gap-xs rounded-md pr-xs",
3521
+ "list-none flex items-center gap-xs rounded-none pr-xs",
3497
3522
  "transition-colors duration-150 ease-out",
3498
3523
  active ? "bg-primary-disabled" : hovered ? "bg-surface-soft" : "bg-transparent"
3499
3524
  ].join(" "),
@@ -3501,16 +3526,16 @@ var HistoryRow = ({ item, active = false, onClick }) => {
3501
3526
  onMouseLeave: () => setHovered(false),
3502
3527
  children: [
3503
3528
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3504
- "button",
3529
+ Button,
3505
3530
  {
3506
3531
  type: "button",
3532
+ variant: "bare",
3533
+ size: "auto",
3507
3534
  "aria-current": active ? "page" : void 0,
3508
3535
  onClick,
3509
3536
  className: [
3510
- "flex flex-1 min-w-0 items-center gap-xs bg-transparent pl-sm py-xs pr-0 text-left",
3511
- "border-0 shadow-none cursor-pointer rounded-md",
3512
- "transition duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
3513
- active ? "text-primary" : "text-body hover:text-ink"
3537
+ "flex-1 min-w-0 !justify-start !gap-xs !rounded-none pl-sm py-xs pr-0 text-left whitespace-normal",
3538
+ active ? "!text-primary" : "!text-body hover:!text-ink"
3514
3539
  ].join(" "),
3515
3540
  children: [
3516
3541
  thinking && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -3534,18 +3559,19 @@ var HistoryRow = ({ item, active = false, onClick }) => {
3534
3559
  }
3535
3560
  ),
3536
3561
  item.onDelete && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3537
- "button",
3562
+ Button,
3538
3563
  {
3539
3564
  type: "button",
3565
+ variant: "bare",
3566
+ size: "auto",
3540
3567
  "aria-label": `Delete ${item.label}`,
3541
3568
  onClick: (e) => {
3542
3569
  e.stopPropagation();
3543
3570
  item.onDelete(item.id);
3544
3571
  },
3545
3572
  className: [
3546
- "p-xxs rounded-xs bg-transparent border-0 flex-shrink-0 text-muted",
3547
- "cursor-pointer transition duration-200 ease-out hover:text-semantic-error",
3548
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
3573
+ "!p-xxs !rounded-xs flex-shrink-0 !text-muted hover:!text-semantic-error",
3574
+ "transition duration-200 ease-out",
3549
3575
  hovered ? "opacity-100" : "opacity-0"
3550
3576
  ].join(" "),
3551
3577
  tabIndex: hovered ? 0 : -1,
@@ -3659,7 +3685,7 @@ var ChatHistorySidebar = import_react12.default.forwardRef(
3659
3685
  }
3660
3686
  )
3661
3687
  ] }) }),
3662
- !collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-sm pb-md", children: flatList.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "space-y-xxs", role: "list", children: flatList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3688
+ !collapsed && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden pb-md", children: flatList.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "space-y-xxs", role: "list", children: flatList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3663
3689
  HistoryRow,
3664
3690
  {
3665
3691
  item,
package/dist/index.js CHANGED
@@ -893,6 +893,7 @@ var Chip = React6.forwardRef(
893
893
  icon,
894
894
  imageSrc,
895
895
  imageAlt,
896
+ uploadProgress,
896
897
  onDismiss,
897
898
  disabled = false,
898
899
  className = "",
@@ -903,16 +904,41 @@ var Chip = React6.forwardRef(
903
904
  const [lightboxOpen, setLightboxOpen] = useState2(false);
904
905
  const disabledStyles = disabled ? "opacity-50 pointer-events-none select-none" : "";
905
906
  const isLightboxTrigger = Boolean(imageSrc) && !disabled;
907
+ const showProgressBar = imageSrc && typeof uploadProgress === "number" && uploadProgress < 100;
906
908
  const openLightbox = () => {
907
909
  if (isLightboxTrigger) setLightboxOpen(true);
908
910
  };
909
- const handleBodyKeyDown = (e) => {
910
- if (!isLightboxTrigger) return;
911
- if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
912
- e.preventDefault();
913
- openLightbox();
911
+ const renderThumbnail = () => /* @__PURE__ */ jsxs5(
912
+ "span",
913
+ {
914
+ className: `${sz.thumb} flex-shrink-0 rounded-xs overflow-hidden inline-block relative`,
915
+ "aria-hidden": "true",
916
+ children: [
917
+ /* @__PURE__ */ jsx6(
918
+ "img",
919
+ {
920
+ src: imageSrc,
921
+ alt: imageAlt || label,
922
+ className: "w-full h-full object-cover"
923
+ }
924
+ ),
925
+ showProgressBar && /* @__PURE__ */ jsx6(
926
+ "div",
927
+ {
928
+ className: "absolute bottom-0 left-0 right-0 h-0.5 bg-scrim",
929
+ "aria-label": `Upload progress: ${uploadProgress}%`,
930
+ children: /* @__PURE__ */ jsx6(
931
+ "div",
932
+ {
933
+ className: "h-full bg-primary transition-all duration-200",
934
+ style: { width: `${uploadProgress}%` }
935
+ }
936
+ )
937
+ }
938
+ )
939
+ ]
914
940
  }
915
- };
941
+ );
916
942
  return /* @__PURE__ */ jsxs5(
917
943
  "span",
918
944
  {
@@ -928,43 +954,30 @@ var Chip = React6.forwardRef(
928
954
  ].filter(Boolean).join(" "),
929
955
  ...props,
930
956
  children: [
931
- /* @__PURE__ */ jsxs5(
932
- "span",
957
+ isLightboxTrigger ? /* @__PURE__ */ jsxs5(
958
+ Button,
933
959
  {
934
- className: "inline-flex items-center gap-xs",
935
- onClick: isLightboxTrigger ? openLightbox : void 0,
936
- onKeyDown: isLightboxTrigger ? handleBodyKeyDown : void 0,
937
- role: isLightboxTrigger ? "button" : void 0,
938
- tabIndex: isLightboxTrigger ? 0 : void 0,
939
- "aria-label": isLightboxTrigger ? `View image for ${label}` : void 0,
940
- style: isLightboxTrigger ? { cursor: "pointer" } : void 0,
960
+ variant: "bare",
961
+ size: "auto",
962
+ onClick: openLightbox,
963
+ "aria-label": `View image for ${label}`,
964
+ className: "inline-flex items-center gap-xs cursor-pointer p-0 m-0 hover:opacity-80 transition-opacity",
941
965
  children: [
942
- imageSrc ? /* @__PURE__ */ jsx6(
943
- "span",
944
- {
945
- className: `${sz.thumb} flex-shrink-0 rounded-xs overflow-hidden inline-block`,
946
- "aria-hidden": "true",
947
- children: /* @__PURE__ */ jsx6(
948
- "img",
949
- {
950
- src: imageSrc,
951
- alt: imageAlt || label,
952
- className: "w-full h-full object-cover"
953
- }
954
- )
955
- }
956
- ) : icon && /* @__PURE__ */ jsx6(
957
- "span",
958
- {
959
- className: `${sz.icon} flex-shrink-0 flex items-center justify-center`,
960
- "aria-hidden": "true",
961
- children: icon
962
- }
963
- ),
966
+ renderThumbnail(),
964
967
  /* @__PURE__ */ jsx6("span", { className: sz.text, children: label })
965
968
  ]
966
969
  }
967
- ),
970
+ ) : /* @__PURE__ */ jsxs5("span", { className: "inline-flex items-center gap-xs", children: [
971
+ imageSrc ? renderThumbnail() : icon && /* @__PURE__ */ jsx6(
972
+ "span",
973
+ {
974
+ className: `${sz.icon} flex-shrink-0 flex items-center justify-center`,
975
+ "aria-hidden": "true",
976
+ children: icon
977
+ }
978
+ ),
979
+ /* @__PURE__ */ jsx6("span", { className: sz.text, children: label })
980
+ ] }),
968
981
  onDismiss && /* @__PURE__ */ jsx6(
969
982
  Button,
970
983
  {
@@ -2684,11 +2697,17 @@ var TimelineBlock = ({ items }) => {
2684
2697
  ] });
2685
2698
  };
2686
2699
  var AgentConversationMark = ({ mark, align = "start" }) => {
2687
- const pillClasses = "inline-flex items-center gap-xs rounded-full bg-canvas px-sm py-xxs text-caption font-weight-heading-sm text-primary shadow-sm hover:bg-surface-soft transition-colors duration-150 whitespace-nowrap";
2688
- return /* @__PURE__ */ jsx11("div", { className: ["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" "), children: mark.href ? /* @__PURE__ */ jsxs10("a", { href: mark.href, className: pillClasses, children: [
2689
- /* @__PURE__ */ jsx11(Icon, { name: "two-people-users-group", size: 12 }),
2690
- mark.label
2691
- ] }) : /* @__PURE__ */ jsxs10(
2700
+ return /* @__PURE__ */ jsx11("div", { className: ["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" "), children: mark.href ? /* @__PURE__ */ jsxs10(
2701
+ "a",
2702
+ {
2703
+ href: mark.href,
2704
+ className: "inline-flex items-center gap-xs rounded-full bg-canvas px-sm py-xxs text-caption font-weight-heading-sm text-primary shadow-sm whitespace-nowrap cursor-pointer transition duration-150 ease-out hover:bg-surface-soft active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
2705
+ children: [
2706
+ /* @__PURE__ */ jsx11(Icon, { name: "two-people-users-group", size: 12 }),
2707
+ mark.label
2708
+ ]
2709
+ }
2710
+ ) : /* @__PURE__ */ jsxs10(
2692
2711
  Button,
2693
2712
  {
2694
2713
  variant: "ghost",
@@ -2777,7 +2796,7 @@ var SuggestedImageWidget = ({
2777
2796
  setSelectedId(void 0);
2778
2797
  setIsOpen(true);
2779
2798
  };
2780
- return /* @__PURE__ */ jsxs10("div", { className: "mt-md", children: [
2799
+ return /* @__PURE__ */ jsxs10("div", { className: "mb-md flex flex-col items-start self-start", children: [
2781
2800
  /* @__PURE__ */ jsxs10(
2782
2801
  Button,
2783
2802
  {
@@ -2785,7 +2804,7 @@ var SuggestedImageWidget = ({
2785
2804
  variant: "ghost",
2786
2805
  pushEffect: false,
2787
2806
  onClick: handleOpen,
2788
- className: "group relative block !p-0 max-w-full overflow-hidden rounded-lg bg-surface-strong border border-hairline",
2807
+ className: "group relative block self-start !p-0 max-w-full overflow-hidden rounded-lg bg-surface-strong border border-hairline",
2789
2808
  style: { maxHeight: "14rem", width: "20rem" },
2790
2809
  "aria-label": alt ?? "Open design suggestion",
2791
2810
  children: [
@@ -2794,7 +2813,7 @@ var SuggestedImageWidget = ({
2794
2813
  {
2795
2814
  src,
2796
2815
  alt: alt ?? "",
2797
- className: "w-full object-cover transition-transform duration-150 group-hover:scale-[1.02]",
2816
+ className: "block w-full object-cover object-top transition-transform duration-150 group-hover:scale-[1.02]",
2798
2817
  style: { maxHeight: "14rem" }
2799
2818
  }
2800
2819
  ),
@@ -2803,7 +2822,7 @@ var SuggestedImageWidget = ({
2803
2822
  {
2804
2823
  src: opt.src,
2805
2824
  alt: opt.label,
2806
- className: "h-10 w-10 flex-shrink-0 rounded-sm object-cover border border-hairline"
2825
+ className: "h-10 w-10 flex-shrink-0 rounded-sm object-cover object-top border border-hairline"
2807
2826
  },
2808
2827
  opt.id
2809
2828
  )) })
@@ -2927,13 +2946,16 @@ var CopyMessageButton = ({
2927
2946
  };
2928
2947
  return /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-end mb-xs", children: [
2929
2948
  /* @__PURE__ */ jsx11(
2930
- "button",
2949
+ Button,
2931
2950
  {
2932
2951
  type: "button",
2952
+ variant: "bare",
2953
+ size: "auto",
2954
+ pushEffect: false,
2933
2955
  onClick: handleCopy,
2934
2956
  "aria-label": copied ? "Message copied" : "Copy message",
2935
2957
  "data-copied": copied ? "true" : "false",
2936
- className: "inline-flex items-center justify-center rounded-xs p-xxs text-muted-soft opacity-0 cursor-pointer transition duration-150 ease-out hover:text-ink active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 data-[copied=true]:opacity-100",
2958
+ className: "inline-flex items-center justify-center rounded-xs p-xxs text-muted-soft opacity-0 hover:text-ink active:scale-[0.98] focus-visible:ring-focus-blue group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 data-[copied=true]:opacity-100",
2937
2959
  children: /* @__PURE__ */ jsx11(
2938
2960
  Icon,
2939
2961
  {
@@ -2986,7 +3008,8 @@ var ThinkingIndicator = () => /* @__PURE__ */ jsxs10(Fragment4, { children: [
2986
3008
  ] });
2987
3009
  var AiMessage = ({ message }) => /* @__PURE__ */ jsxs10("div", { className: "flex items-start gap-md w-full", children: [
2988
3010
  /* @__PURE__ */ jsx11(AIAvatar, {}),
2989
- /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
3011
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0 flex flex-col items-stretch justify-start", children: [
3012
+ message.suggestedImage && /* @__PURE__ */ jsx11(SuggestedImageWidget, { suggestedImage: message.suggestedImage }),
2990
3013
  /* @__PURE__ */ jsx11(
2991
3014
  ExpandableMessage,
2992
3015
  {
@@ -2998,7 +3021,6 @@ var AiMessage = ({ message }) => /* @__PURE__ */ jsxs10("div", { className: "fle
2998
3021
  ),
2999
3022
  message.inFlight && /* @__PURE__ */ jsx11(ThinkingIndicator, {}),
3000
3023
  message.images && message.images.length > 0 && /* @__PURE__ */ jsx11(MessageImageGallery, { images: message.images, align: "start" }),
3001
- message.suggestedImage && /* @__PURE__ */ jsx11(SuggestedImageWidget, { suggestedImage: message.suggestedImage }),
3002
3024
  message.timeline && message.timeline.length > 0 && /* @__PURE__ */ jsx11(TimelineBlock, { items: message.timeline }),
3003
3025
  message.agentMark && /* @__PURE__ */ jsx11(AgentConversationMark, { mark: message.agentMark, align: "start" }),
3004
3026
  message.postContent && /* @__PURE__ */ jsx11(
@@ -3049,11 +3071,14 @@ var UserMessage = ({ message }) => {
3049
3071
  hasText && failed && /* @__PURE__ */ jsxs10("div", { className: "mt-xs flex items-center gap-sm justify-end", children: [
3050
3072
  /* @__PURE__ */ jsx11("span", { className: "text-caption text-semantic-error", children: "Not sent" }),
3051
3073
  /* @__PURE__ */ jsx11(
3052
- "button",
3074
+ Button,
3053
3075
  {
3054
3076
  type: "button",
3077
+ variant: "bare",
3078
+ size: "auto",
3079
+ pushEffect: false,
3055
3080
  onClick: () => message.onRetry?.(message),
3056
- className: "rounded-xs text-caption text-primary-text underline underline-offset-2 cursor-pointer transition duration-150 ease-out hover:text-primary-active active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
3081
+ className: "rounded-xs text-caption text-primary-text underline underline-offset-2 hover:text-primary-active active:scale-[0.98] focus-visible:ring-focus-blue",
3057
3082
  children: "Retry"
3058
3083
  }
3059
3084
  )
@@ -3399,7 +3424,7 @@ var HistoryRow = ({ item, active = false, onClick }) => {
3399
3424
  "li",
3400
3425
  {
3401
3426
  className: [
3402
- "list-none flex items-center gap-xs rounded-md pr-xs",
3427
+ "list-none flex items-center gap-xs rounded-none pr-xs",
3403
3428
  "transition-colors duration-150 ease-out",
3404
3429
  active ? "bg-primary-disabled" : hovered ? "bg-surface-soft" : "bg-transparent"
3405
3430
  ].join(" "),
@@ -3407,16 +3432,16 @@ var HistoryRow = ({ item, active = false, onClick }) => {
3407
3432
  onMouseLeave: () => setHovered(false),
3408
3433
  children: [
3409
3434
  /* @__PURE__ */ jsxs12(
3410
- "button",
3435
+ Button,
3411
3436
  {
3412
3437
  type: "button",
3438
+ variant: "bare",
3439
+ size: "auto",
3413
3440
  "aria-current": active ? "page" : void 0,
3414
3441
  onClick,
3415
3442
  className: [
3416
- "flex flex-1 min-w-0 items-center gap-xs bg-transparent pl-sm py-xs pr-0 text-left",
3417
- "border-0 shadow-none cursor-pointer rounded-md",
3418
- "transition duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
3419
- active ? "text-primary" : "text-body hover:text-ink"
3443
+ "flex-1 min-w-0 !justify-start !gap-xs !rounded-none pl-sm py-xs pr-0 text-left whitespace-normal",
3444
+ active ? "!text-primary" : "!text-body hover:!text-ink"
3420
3445
  ].join(" "),
3421
3446
  children: [
3422
3447
  thinking && /* @__PURE__ */ jsx13(
@@ -3440,18 +3465,19 @@ var HistoryRow = ({ item, active = false, onClick }) => {
3440
3465
  }
3441
3466
  ),
3442
3467
  item.onDelete && /* @__PURE__ */ jsx13(
3443
- "button",
3468
+ Button,
3444
3469
  {
3445
3470
  type: "button",
3471
+ variant: "bare",
3472
+ size: "auto",
3446
3473
  "aria-label": `Delete ${item.label}`,
3447
3474
  onClick: (e) => {
3448
3475
  e.stopPropagation();
3449
3476
  item.onDelete(item.id);
3450
3477
  },
3451
3478
  className: [
3452
- "p-xxs rounded-xs bg-transparent border-0 flex-shrink-0 text-muted",
3453
- "cursor-pointer transition duration-200 ease-out hover:text-semantic-error",
3454
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
3479
+ "!p-xxs !rounded-xs flex-shrink-0 !text-muted hover:!text-semantic-error",
3480
+ "transition duration-200 ease-out",
3455
3481
  hovered ? "opacity-100" : "opacity-0"
3456
3482
  ].join(" "),
3457
3483
  tabIndex: hovered ? 0 : -1,
@@ -3565,7 +3591,7 @@ var ChatHistorySidebar = React13.forwardRef(
3565
3591
  }
3566
3592
  )
3567
3593
  ] }) }),
3568
- !collapsed && /* @__PURE__ */ jsx13("div", { className: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-sm pb-md", children: flatList.length > 0 ? /* @__PURE__ */ jsx13("ul", { className: "space-y-xxs", role: "list", children: flatList.map((item) => /* @__PURE__ */ jsx13(
3594
+ !collapsed && /* @__PURE__ */ jsx13("div", { className: "flex-1 min-h-0 overflow-y-auto overflow-x-hidden pb-md", children: flatList.length > 0 ? /* @__PURE__ */ jsx13("ul", { className: "space-y-xxs", role: "list", children: flatList.map((item) => /* @__PURE__ */ jsx13(
3569
3595
  HistoryRow,
3570
3596
  {
3571
3597
  item,
package/dist/styles.css CHANGED
@@ -1827,6 +1827,9 @@
1827
1827
  .object-center {
1828
1828
  object-position: center;
1829
1829
  }
1830
+ .object-top {
1831
+ object-position: top;
1832
+ }
1830
1833
  .\!p-0 {
1831
1834
  padding: 0 !important;
1832
1835
  }
@@ -2139,6 +2142,9 @@
2139
2142
  .break-words {
2140
2143
  overflow-wrap: break-word;
2141
2144
  }
2145
+ .whitespace-normal {
2146
+ white-space: normal;
2147
+ }
2142
2148
  .whitespace-nowrap {
2143
2149
  white-space: nowrap;
2144
2150
  }
@@ -2693,24 +2699,24 @@
2693
2699
  }
2694
2700
  }
2695
2701
  }
2696
- .hover\:text-semantic-error {
2702
+ .hover\:no-underline {
2697
2703
  &:hover {
2698
2704
  @media (hover: hover) {
2699
- color: var(--color-semantic-error);
2705
+ text-decoration-line: none;
2700
2706
  }
2701
2707
  }
2702
2708
  }
2703
- .hover\:no-underline {
2709
+ .hover\:underline {
2704
2710
  &:hover {
2705
2711
  @media (hover: hover) {
2706
- text-decoration-line: none;
2712
+ text-decoration-line: underline;
2707
2713
  }
2708
2714
  }
2709
2715
  }
2710
- .hover\:underline {
2716
+ .hover\:opacity-80 {
2711
2717
  &:hover {
2712
2718
  @media (hover: hover) {
2713
- text-decoration-line: underline;
2719
+ opacity: 80%;
2714
2720
  }
2715
2721
  }
2716
2722
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designa8/vibedesign-v6",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "Complete design system \"Plasma Design System\" generated by Atoms Design.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -205,11 +205,14 @@ interface HistoryRowProps {
205
205
  }
206
206
 
207
207
  /**
208
- * One row = one rounded surface. The `<li>` owns the only fill (the selected
209
- * `bg-primary-disabled`). The label hit target is a transparent native button
210
- * with no border, no hover fill and no radius of its own, so nothing paints a
211
- * second rectangle over the chip. Title and chip are vertically centred with
212
- * the source chip inset from the title and from the rounded edge.
208
+ * One row = one square, full-bleed surface. The row owns the only fill (the
209
+ * selected `bg-primary-disabled` / hovered `bg-surface-soft`) and it runs from
210
+ * the sidebar's left edge to its right edge — no corner radius, no horizontal
211
+ * inset. The label hit target is a bare Button (no fill, no border, no radius
212
+ * of its own) so nothing paints a second rectangle over the chip. The row keeps
213
+ * its own inner padding (`pl-sm … pr-xs`) so the label and the origin chip
214
+ * never sit flush against the panel edge, and the thinking dot stays
215
+ * immediately left of the label.
213
216
  */
214
217
  const HistoryRow: React.FC<HistoryRowProps> = ({ item, active = false, onClick }) => {
215
218
  const [hovered, setHovered] = React.useState(false);
@@ -219,22 +222,22 @@ const HistoryRow: React.FC<HistoryRowProps> = ({ item, active = false, onClick }
219
222
  return (
220
223
  <li
221
224
  className={[
222
- "list-none flex items-center gap-xs rounded-md pr-xs",
225
+ "list-none flex items-center gap-xs rounded-none pr-xs",
223
226
  "transition-colors duration-150 ease-out",
224
227
  active ? "bg-primary-disabled" : hovered ? "bg-surface-soft" : "bg-transparent",
225
228
  ].join(" ")}
226
229
  onMouseEnter={() => setHovered(true)}
227
230
  onMouseLeave={() => setHovered(false)}
228
231
  >
229
- <button
232
+ <Button
230
233
  type="button"
234
+ variant="bare"
235
+ size="auto"
231
236
  aria-current={active ? "page" : undefined}
232
237
  onClick={onClick}
233
238
  className={[
234
- "flex flex-1 min-w-0 items-center gap-xs bg-transparent pl-sm py-xs pr-0 text-left",
235
- "border-0 shadow-none cursor-pointer rounded-md",
236
- "transition duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
237
- active ? "text-primary" : "text-body hover:text-ink",
239
+ "flex-1 min-w-0 !justify-start !gap-xs !rounded-none pl-sm py-xs pr-0 text-left whitespace-normal",
240
+ active ? "!text-primary" : "!text-body hover:!text-ink",
238
241
  ].join(" ")}
239
242
  >
240
243
  {thinking && (
@@ -246,7 +249,7 @@ const HistoryRow: React.FC<HistoryRowProps> = ({ item, active = false, onClick }
246
249
  <span dir="auto" className="block min-w-0 truncate text-body-sm">
247
250
  {item.label}
248
251
  </span>
249
- </button>
252
+ </Button>
250
253
  <Chip
251
254
  label={isAgent ? "Agent" : "Manual"}
252
255
  variant={isAgent ? "primary" : "default"}
@@ -254,23 +257,24 @@ const HistoryRow: React.FC<HistoryRowProps> = ({ item, active = false, onClick }
254
257
  className="flex-shrink-0"
255
258
  />
256
259
  {item.onDelete && (
257
- <button
260
+ <Button
258
261
  type="button"
262
+ variant="bare"
263
+ size="auto"
259
264
  aria-label={`Delete ${item.label}`}
260
265
  onClick={(e) => {
261
266
  e.stopPropagation();
262
267
  item.onDelete!(item.id);
263
268
  }}
264
269
  className={[
265
- "p-xxs rounded-xs bg-transparent border-0 flex-shrink-0 text-muted",
266
- "cursor-pointer transition duration-200 ease-out hover:text-semantic-error",
267
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue",
270
+ "!p-xxs !rounded-xs flex-shrink-0 !text-muted hover:!text-semantic-error",
271
+ "transition duration-200 ease-out",
268
272
  hovered ? "opacity-100" : "opacity-0",
269
273
  ].join(" ")}
270
274
  tabIndex={hovered ? 0 : -1}
271
275
  >
272
276
  <Icon name="trash-delete" style={{ width: "14px", height: "14px" }} />
273
- </button>
277
+ </Button>
274
278
  )}
275
279
  </li>
276
280
  );
@@ -419,9 +423,10 @@ export const ChatHistorySidebar = React.forwardRef<HTMLElement, ChatHistorySideb
419
423
  )}
420
424
  </div>
421
425
 
422
- {/* Flat chat history list — only meaningful when expanded, no section headings */}
426
+ {/* Flat chat history list — full-bleed rows (no horizontal list padding),
427
+ only inner row padding so labels and chips stay off the panel edge. */}
423
428
  {!collapsed && (
424
- <div className="flex-1 min-h-0 overflow-y-auto overflow-x-hidden px-sm pb-md">
429
+ <div className="flex-1 min-h-0 overflow-y-auto overflow-x-hidden pb-md">
425
430
  {flatList.length > 0 ? (
426
431
  <ul className="space-y-xxs" role="list">
427
432
  {flatList.map((item) => (
@@ -49,6 +49,7 @@ const chats: ChatHistoryItem[] = [
49
49
  export default function ChatHistorySidebarPreview() {
50
50
  const [collapsed, setCollapsed] = React.useState(false);
51
51
  const [activeId, setActiveId] = React.useState("c1");
52
+ const [place, setPlace] = React.useState("Acme");
52
53
 
53
54
  const items = React.useMemo(
54
55
  () =>
@@ -63,13 +64,12 @@ export default function ChatHistorySidebarPreview() {
63
64
  <div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
64
65
  <div>
65
66
  <p className="text-body-sm text-muted mb-sm">
66
- Select any row — the title hit target is transparent, the row owns the single selected fill,
67
- and the Manual / Agent chip sits inset inside that surface. The first and fourth rows are
68
- thinking, so their dot pulses.
67
+ Select any row — the fill is square and runs edge to edge, with the label and chip inset by
68
+ the row's own padding. The first and fourth rows are thinking, so their dot pulses.
69
69
  </p>
70
70
  <div className="flex gap-lg items-stretch" style={{ height: 460 }}>
71
71
  <ChatHistorySidebar
72
- brandName="Acme"
72
+ brandName={place}
73
73
  avatarInitials="JD"
74
74
  collapsed={collapsed}
75
75
  onCollapsedChange={setCollapsed}
@@ -78,9 +78,17 @@ export default function ChatHistorySidebarPreview() {
78
78
  onSelectHistoryItem={setActiveId}
79
79
  onNewChat={() => setActiveId("")}
80
80
  onProjectSettings={() => setActiveId("")}
81
+ onBackToProjects={() => {
82
+ setPlace("Projects");
83
+ setActiveId("d1");
84
+ }}
85
+ onHome={() => {
86
+ setPlace("Home");
87
+ setActiveId("r1");
88
+ }}
81
89
  />
82
90
  <div className="flex-1 flex items-center justify-center rounded-lg border border-hairline-soft text-body-sm text-muted-soft">
83
- Main content area
91
+ {place}
84
92
  </div>
85
93
  </div>
86
94
  </div>
@@ -90,7 +98,7 @@ export default function ChatHistorySidebarPreview() {
90
98
  <div className="flex gap-lg items-stretch" style={{ height: 260 }}>
91
99
  <ChatHistorySidebar brandName="Acme" avatarInitials="JD" defaultCollapsed={false} />
92
100
  <div className="flex-1 flex items-center justify-center rounded-lg border border-hairline-soft text-body-sm text-muted-soft">
93
- Collapsed rail on the left
101
+ Empty history
94
102
  </div>
95
103
  </div>
96
104
  </div>
@@ -81,7 +81,7 @@ export interface ChatMessage {
81
81
  postContent?: string;
82
82
  /** Optional attached images — renders as a row of small thumbnails with a click-to-open lightbox */
83
83
  images?: ChatMessageImage[];
84
- /** Optional design-suggestion widget — a larger thumbnail (or option strip) that opens a fullscreen lightbox */
84
+ /** Optional design-suggestion widget — a larger thumbnail (or option strip) rendered at the TOP of the AI message, before its text, that opens a fullscreen lightbox */
85
85
  suggestedImage?: ChatMessageSuggestedImage;
86
86
  }
87
87
 
@@ -359,13 +359,13 @@ const AgentConversationMark: React.FC<{
359
359
  mark: AgentConversationMarkData;
360
360
  align?: "start" | "end";
361
361
  }> = ({ mark, align = "start" }) => {
362
- const pillClasses =
363
- "inline-flex items-center gap-xs rounded-full bg-canvas px-sm py-xxs text-caption font-weight-heading-sm text-primary shadow-sm hover:bg-surface-soft transition-colors duration-150 whitespace-nowrap";
364
-
365
362
  return (
366
363
  <div className={["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" ")}>
367
364
  {mark.href ? (
368
- <a href={mark.href} className={pillClasses}>
365
+ <a
366
+ href={mark.href}
367
+ className="inline-flex items-center gap-xs rounded-full bg-canvas px-sm py-xxs text-caption font-weight-heading-sm text-primary shadow-sm whitespace-nowrap cursor-pointer transition duration-150 ease-out hover:bg-surface-soft active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue"
368
+ >
369
369
  <Icon name="two-people-users-group" size={12} />
370
370
  {mark.label}
371
371
  </a>
@@ -445,9 +445,11 @@ const MessageImageGallery: React.FC<{ images: ChatMessageImage[]; align?: "start
445
445
  // ─── Suggested-design widget (larger thumbnail → fullscreen lightbox) ─────────
446
446
 
447
447
  /**
448
- * Renders a design-suggestion widget in an AI bubble: a larger thumbnail
449
- * (single mockup or a compact option strip when 2+ options are supplied)
450
- * that opens a full-viewport Modal lightbox.
448
+ * Renders a design-suggestion widget at the TOP of an AI message, before the
449
+ * message text: a larger thumbnail (single mockup or a compact option strip
450
+ * when 2+ options are supplied) that opens a full-viewport Modal lightbox.
451
+ * The thumbnail is anchored to the top of the message column (self-start,
452
+ * object-top) so a generated design never sinks to the bottom of the row.
451
453
  *
452
454
  * Single-mockup case (0–1 options): full image + primary CTA under the
453
455
  * thumbnail and again in the modal footer (existing ctaLabel/onCta).
@@ -488,7 +490,7 @@ const SuggestedImageWidget: React.FC<{ suggestedImage: ChatMessageSuggestedImage
488
490
  };
489
491
 
490
492
  return (
491
- <div className="mt-md">
493
+ <div className="mb-md flex flex-col items-start self-start">
492
494
  {/* Trigger thumbnail — a small chat-bubble attachment, capped so it
493
495
  doesn't overtake the whole message column. This wrapper sits nested
494
496
  well inside the always-w-full ChatScreen root, so it is not the
@@ -498,14 +500,14 @@ const SuggestedImageWidget: React.FC<{ suggestedImage: ChatMessageSuggestedImage
498
500
  variant="ghost"
499
501
  pushEffect={false}
500
502
  onClick={handleOpen}
501
- className="group relative block !p-0 max-w-full overflow-hidden rounded-lg bg-surface-strong border border-hairline"
503
+ className="group relative block self-start !p-0 max-w-full overflow-hidden rounded-lg bg-surface-strong border border-hairline"
502
504
  style={{ maxHeight: "14rem", width: "20rem" }}
503
505
  aria-label={alt ?? "Open design suggestion"}
504
506
  >
505
507
  <img
506
508
  src={src}
507
509
  alt={alt ?? ""}
508
- className="w-full object-cover transition-transform duration-150 group-hover:scale-[1.02]"
510
+ className="block w-full object-cover object-top transition-transform duration-150 group-hover:scale-[1.02]"
509
511
  style={{ maxHeight: "14rem" }}
510
512
  />
511
513
  {hasOptions && (
@@ -515,7 +517,7 @@ const SuggestedImageWidget: React.FC<{ suggestedImage: ChatMessageSuggestedImage
515
517
  key={opt.id}
516
518
  src={opt.src}
517
519
  alt={opt.label}
518
- className="h-10 w-10 flex-shrink-0 rounded-sm object-cover border border-hairline"
520
+ className="h-10 w-10 flex-shrink-0 rounded-sm object-cover object-top border border-hairline"
519
521
  />
520
522
  ))}
521
523
  </div>
@@ -670,19 +672,22 @@ const CopyMessageButton: React.FC<{ text: string; onCopy?: (content: string) =>
670
672
 
671
673
  return (
672
674
  <div className="flex items-center justify-end mb-xs">
673
- <button
675
+ <Button
674
676
  type="button"
677
+ variant="bare"
678
+ size="auto"
679
+ pushEffect={false}
675
680
  onClick={handleCopy}
676
681
  aria-label={copied ? "Message copied" : "Copy message"}
677
682
  data-copied={copied ? "true" : "false"}
678
- className="inline-flex items-center justify-center rounded-xs p-xxs text-muted-soft opacity-0 cursor-pointer transition duration-150 ease-out hover:text-ink active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 data-[copied=true]:opacity-100"
683
+ className="inline-flex items-center justify-center rounded-xs p-xxs text-muted-soft opacity-0 hover:text-ink active:scale-[0.98] focus-visible:ring-focus-blue group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 data-[copied=true]:opacity-100"
679
684
  >
680
685
  <Icon
681
686
  name={copied ? "check-checkmark" : "copy-clipboard"}
682
687
  size={14}
683
688
  className={copied ? "text-semantic-success" : undefined}
684
689
  />
685
- </button>
690
+ </Button>
686
691
  <span role="status" aria-live="polite" className="sr-only">
687
692
  {copied ? "Message copied to clipboard" : ""}
688
693
  </span>
@@ -737,11 +742,18 @@ const ThinkingIndicator: React.FC = () => (
737
742
 
738
743
  // ─── AI message ───────────────────────────────────────────────────────────────
739
744
 
740
- /** AI message — plain prose column (no bubble) so long answers stay readable */
745
+ /**
746
+ * AI message — plain prose column (no bubble) so long answers stay readable.
747
+ * A suggested design renders FIRST, at the top of the column, before the
748
+ * message text.
749
+ */
741
750
  const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
742
751
  <div className="flex items-start gap-md w-full">
743
752
  <AIAvatar />
744
- <div className="flex-1 min-w-0">
753
+ <div className="flex-1 min-w-0 flex flex-col items-stretch justify-start">
754
+ {message.suggestedImage && (
755
+ <SuggestedImageWidget suggestedImage={message.suggestedImage} />
756
+ )}
745
757
  <ExpandableMessage
746
758
  variant="flush"
747
759
  maxLines={6}
@@ -752,9 +764,6 @@ const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
752
764
  {message.images && message.images.length > 0 && (
753
765
  <MessageImageGallery images={message.images} align="start" />
754
766
  )}
755
- {message.suggestedImage && (
756
- <SuggestedImageWidget suggestedImage={message.suggestedImage} />
757
- )}
758
767
  {message.timeline && message.timeline.length > 0 && (
759
768
  <TimelineBlock items={message.timeline} />
760
769
  )}
@@ -826,13 +835,16 @@ const UserMessage: React.FC<{ message: ChatMessage }> = ({ message }) => {
826
835
  {hasText && failed && (
827
836
  <div className="mt-xs flex items-center gap-sm justify-end">
828
837
  <span className="text-caption text-semantic-error">Not sent</span>
829
- <button
838
+ <Button
830
839
  type="button"
840
+ variant="bare"
841
+ size="auto"
842
+ pushEffect={false}
831
843
  onClick={() => message.onRetry?.(message)}
832
- className="rounded-xs text-caption text-primary-text underline underline-offset-2 cursor-pointer transition duration-150 ease-out hover:text-primary-active active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue"
844
+ className="rounded-xs text-caption text-primary-text underline underline-offset-2 hover:text-primary-active active:scale-[0.98] focus-visible:ring-focus-blue"
833
845
  >
834
846
  Retry
835
- </button>
847
+ </Button>
836
848
  </div>
837
849
  )}
838
850
 
@@ -22,7 +22,7 @@ Step two should support pasting a comma-separated list of emails and show inline
22
22
  Step three should show a grid of starter templates with a live preview thumbnail for each.
23
23
  On the last step, show a summary of every choice made so far with an edit link back to that step.`;
24
24
 
25
- const mainConversation: ChatMessage[] = [
25
+ const demoConversation: ChatMessage[] = [
26
26
  {
27
27
  id: "1",
28
28
  role: "ai",
@@ -39,6 +39,12 @@ const mainConversation: ChatMessage[] = [
39
39
  id: "3",
40
40
  role: "ai",
41
41
  content: "I can help you create a new atom. What type of atom would you like to create?",
42
+ suggestedImage: {
43
+ src: "https://picsum.photos/seed/designmock1/600/900",
44
+ alt: "Generated pricing page design",
45
+ ctaLabel: "Create this design",
46
+ onCta: () => console.log("create design"),
47
+ },
42
48
  },
43
49
  {
44
50
  id: "4",
@@ -71,23 +77,32 @@ const mainConversation: ChatMessage[] = [
71
77
  { src: "https://picsum.photos/seed/mosaic3/600/400", alt: "Screenshot 3" },
72
78
  ],
73
79
  },
74
- ];
75
-
76
- const statesConversation: ChatMessage[] = [
77
80
  {
78
- id: "1",
81
+ id: "7",
79
82
  role: "user",
80
83
  content: LONG_USER_MESSAGE,
81
84
  userInitials: "ME",
82
85
  sentAt: "12:12",
83
86
  },
84
87
  {
85
- id: "2",
88
+ id: "8",
86
89
  role: "ai",
87
90
  content: "Understood — I'll start with the wizard shell and come back with the step-by-step plan.",
91
+ suggestedImage: {
92
+ src: "https://picsum.photos/seed/designmock2/600/900",
93
+ alt: "Generated onboarding wizard design",
94
+ ctaLabel: "Create this design",
95
+ onCta: () => console.log("create wizard design"),
96
+ options: [
97
+ { id: "a", src: "https://picsum.photos/seed/designA/600/900", label: "Design A" },
98
+ { id: "b", src: "https://picsum.photos/seed/designB/600/900", label: "Design B" },
99
+ { id: "c", src: "https://picsum.photos/seed/designC/600/900", label: "Design C" },
100
+ ],
101
+ onSelectOption: (id) => console.log("select design", id),
102
+ },
88
103
  },
89
104
  {
90
- id: "3",
105
+ id: "9",
91
106
  role: "user",
92
107
  content: "Can you suggest a design for our new pricing page?",
93
108
  userInitials: "ME",
@@ -95,7 +110,7 @@ const statesConversation: ChatMessage[] = [
95
110
  onRetry: (message) => console.log("retry message", message.id),
96
111
  },
97
112
  {
98
- id: "4",
113
+ id: "10",
99
114
  role: "user",
100
115
  content: "",
101
116
  userInitials: "ME",
@@ -109,30 +124,20 @@ const statesConversation: ChatMessage[] = [
109
124
  ];
110
125
 
111
126
  export default function Preview() {
112
- const [suggestDesigns1, setSuggestDesigns1] = React.useState(false);
113
- const [suggestDesigns2, setSuggestDesigns2] = React.useState(true);
127
+ const [suggestDesigns, setSuggestDesigns] = React.useState(true);
128
+ const [selectedModelId, setSelectedModelId] = React.useState("fast");
114
129
 
115
130
  return (
116
- <div className="w-full max-w-3xl mx-auto space-y-xl">
117
- <div style={{ height: 720 }}>
118
- <ChatScreen
119
- messages={mainConversation}
120
- placeholder="Ask anything…"
121
- models={DEMO_MODELS}
122
- selectedModelId="fast"
123
- suggestDesigns={suggestDesigns1}
124
- onSuggestDesignsChange={setSuggestDesigns1}
125
- onSend={(value) => console.log("send", value)}
126
- />
127
- </div>
131
+ <div className="w-full max-w-3xl mx-auto">
128
132
  <div style={{ height: 720 }}>
129
133
  <ChatScreen
130
- messages={statesConversation}
134
+ messages={demoConversation}
131
135
  placeholder="Ask anything…"
132
136
  models={DEMO_MODELS}
133
- selectedModelId="pro"
134
- suggestDesigns={suggestDesigns2}
135
- onSuggestDesignsChange={setSuggestDesigns2}
137
+ selectedModelId={selectedModelId}
138
+ onModelChange={setSelectedModelId}
139
+ suggestDesigns={suggestDesigns}
140
+ onSuggestDesignsChange={setSuggestDesigns}
136
141
  onSend={(value) => console.log("send", value)}
137
142
  />
138
143
  </div>
@@ -20,6 +20,10 @@ export interface ChipProps extends React.HTMLAttributes<HTMLSpanElement> {
20
20
  imageSrc?: string;
21
21
  /** Alt text for the thumbnail. Falls back to `label`. */
22
22
  imageAlt?: string;
23
+ /** Upload progress as a number from 0 to 100. When set and below 100, overlays
24
+ * a thin progress bar filled to that percent with the primary color on a scrim.
25
+ * At 100 or when omitted, shows the thumbnail with no bar. */
26
+ uploadProgress?: number;
23
27
  /** If provided, renders a dismiss (×) button and calls this handler on click */
24
28
  onDismiss?: () => void;
25
29
  /** Disabled state — mutes colors and prevents interactions */
@@ -55,6 +59,7 @@ export const Chip = React.forwardRef<HTMLSpanElement, ChipProps>(
55
59
  icon,
56
60
  imageSrc,
57
61
  imageAlt,
62
+ uploadProgress,
58
63
  onDismiss,
59
64
  disabled = false,
60
65
  className = "",
@@ -68,18 +73,35 @@ export const Chip = React.forwardRef<HTMLSpanElement, ChipProps>(
68
73
 
69
74
  const disabledStyles = disabled ? "opacity-50 pointer-events-none select-none" : "";
70
75
  const isLightboxTrigger = Boolean(imageSrc) && !disabled;
76
+ const showProgressBar = imageSrc && typeof uploadProgress === "number" && uploadProgress < 100;
71
77
 
72
78
  const openLightbox = () => {
73
79
  if (isLightboxTrigger) setLightboxOpen(true);
74
80
  };
75
81
 
76
- const handleBodyKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>) => {
77
- if (!isLightboxTrigger) return;
78
- if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
79
- e.preventDefault();
80
- openLightbox();
81
- }
82
- };
82
+ const renderThumbnail = () => (
83
+ <span
84
+ className={`${sz.thumb} flex-shrink-0 rounded-xs overflow-hidden inline-block relative`}
85
+ aria-hidden="true"
86
+ >
87
+ <img
88
+ src={imageSrc}
89
+ alt={imageAlt || label}
90
+ className="w-full h-full object-cover"
91
+ />
92
+ {showProgressBar && (
93
+ <div
94
+ className="absolute bottom-0 left-0 right-0 h-0.5 bg-scrim"
95
+ aria-label={`Upload progress: ${uploadProgress}%`}
96
+ >
97
+ <div
98
+ className="h-full bg-primary transition-all duration-200"
99
+ style={{ width: `${uploadProgress}%` }}
100
+ />
101
+ </div>
102
+ )}
103
+ </span>
104
+ );
83
105
 
84
106
  return (
85
107
  <span
@@ -97,39 +119,34 @@ export const Chip = React.forwardRef<HTMLSpanElement, ChipProps>(
97
119
  .join(" ")}
98
120
  {...props}
99
121
  >
100
- <span
101
- className="inline-flex items-center gap-xs"
102
- onClick={isLightboxTrigger ? openLightbox : undefined}
103
- onKeyDown={isLightboxTrigger ? handleBodyKeyDown : undefined}
104
- role={isLightboxTrigger ? "button" : undefined}
105
- tabIndex={isLightboxTrigger ? 0 : undefined}
106
- aria-label={isLightboxTrigger ? `View image for ${label}` : undefined}
107
- style={isLightboxTrigger ? { cursor: "pointer" } : undefined}
108
- >
109
- {imageSrc ? (
110
- <span
111
- className={`${sz.thumb} flex-shrink-0 rounded-xs overflow-hidden inline-block`}
112
- aria-hidden="true"
113
- >
114
- <img
115
- src={imageSrc}
116
- alt={imageAlt || label}
117
- className="w-full h-full object-cover"
118
- />
119
- </span>
120
- ) : (
121
- icon && (
122
- <span
123
- className={`${sz.icon} flex-shrink-0 flex items-center justify-center`}
124
- aria-hidden="true"
125
- >
126
- {icon}
127
- </span>
128
- )
129
- )}
130
-
131
- <span className={sz.text}>{label}</span>
132
- </span>
122
+ {isLightboxTrigger ? (
123
+ <Button
124
+ variant="bare"
125
+ size="auto"
126
+ onClick={openLightbox}
127
+ aria-label={`View image for ${label}`}
128
+ className="inline-flex items-center gap-xs cursor-pointer p-0 m-0 hover:opacity-80 transition-opacity"
129
+ >
130
+ {renderThumbnail()}
131
+ <span className={sz.text}>{label}</span>
132
+ </Button>
133
+ ) : (
134
+ <span className="inline-flex items-center gap-xs">
135
+ {imageSrc ? (
136
+ renderThumbnail()
137
+ ) : (
138
+ icon && (
139
+ <span
140
+ className={`${sz.icon} flex-shrink-0 flex items-center justify-center`}
141
+ aria-hidden="true"
142
+ >
143
+ {icon}
144
+ </span>
145
+ )
146
+ )}
147
+ <span className={sz.text}>{label}</span>
148
+ </span>
149
+ )}
133
150
 
134
151
  {onDismiss && (
135
152
  <Button
@@ -1,10 +1,12 @@
1
1
  import React, { useState } from "react";
2
2
  import { Chip } from "./Chip";
3
3
  import { Icon } from "../Icon";
4
+ import { Button } from "../Button";
4
5
 
5
6
  export default function ChipPreview() {
6
7
  const [tags, setTags] = useState(["Design", "React", "TypeScript", "Figma"]);
7
8
  const [photoTags, setPhotoTags] = useState(["Sunset"]);
9
+ const [uploadProgress, setUploadProgress] = useState(35);
8
10
 
9
11
  const removeTag = (tag: string) => setTags((prev) => prev.filter((t) => t !== tag));
10
12
  const removePhotoTag = (tag: string) => setPhotoTags((prev) => prev.filter((t) => t !== tag));
@@ -101,6 +103,65 @@ export default function ChipPreview() {
101
103
  <p className="text-caption text-muted">Click a chip's thumbnail or label to open it fullscreen.</p>
102
104
  </section>
103
105
 
106
+ {/* Upload Progress */}
107
+ <section className="space-y-sm">
108
+ <p className="text-caption text-muted uppercase tracking-wide">Upload Progress (adjust below to test)</p>
109
+ <div className="space-y-md">
110
+ <div className="w-full space-y-sm">
111
+ <label htmlFor="progress-display" className="text-body-sm text-muted">
112
+ Progress: {uploadProgress}%
113
+ </label>
114
+ <div id="progress-display" className="w-full bg-surface-soft rounded-md h-2 overflow-hidden border border-hairline">
115
+ <div
116
+ className="h-full bg-primary transition-all duration-200"
117
+ style={{ width: `${uploadProgress}%` }}
118
+ />
119
+ </div>
120
+ </div>
121
+ <div className="flex flex-wrap gap-sm items-center">
122
+ <Chip
123
+ label="Uploading..."
124
+ variant="default"
125
+ imageSrc={placeholderImgA}
126
+ imageAlt="Upload progress"
127
+ uploadProgress={uploadProgress}
128
+ />
129
+ <Chip
130
+ label="With dismiss"
131
+ variant="primary"
132
+ imageSrc={placeholderImgB}
133
+ imageAlt="Upload progress"
134
+ uploadProgress={uploadProgress}
135
+ onDismiss={() => {}}
136
+ />
137
+ </div>
138
+ <p className="text-caption text-muted">Use the controls below to simulate upload progress. At 100%, the progress bar hides.</p>
139
+ <div className="flex flex-wrap gap-sm">
140
+ <Button
141
+ variant="secondary"
142
+ size="sm"
143
+ onClick={() => setUploadProgress(Math.max(0, uploadProgress - 10))}
144
+ >
145
+ -10%
146
+ </Button>
147
+ <Button
148
+ variant="secondary"
149
+ size="sm"
150
+ onClick={() => setUploadProgress(Math.min(100, uploadProgress + 10))}
151
+ >
152
+ +10%
153
+ </Button>
154
+ <Button
155
+ variant="primary"
156
+ size="sm"
157
+ onClick={() => setUploadProgress(100)}
158
+ >
159
+ Complete
160
+ </Button>
161
+ </div>
162
+ </div>
163
+ </section>
164
+
104
165
  {/* Disabled */}
105
166
  <section className="space-y-sm">
106
167
  <p className="text-caption text-muted uppercase tracking-wide">Disabled State</p>