@designa8/vibedesign-linear-internal-v1-b737 0.11.2 → 0.11.4

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
  # @designa8/vibedesign-linear-internal-v1-b737
2
2
 
3
- Complete design system generated by Atoms Design, version **0.11.2**.
3
+ Complete design system generated by Atoms Design, version **0.11.4**.
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
@@ -600,7 +600,7 @@ var React6 = __toESM(require("react"));
600
600
  var import_jsx_runtime6 = require("react/jsx-runtime");
601
601
  var cn4 = (...parts) => parts.filter(Boolean).join(" ");
602
602
  var base = "relative inline-flex shrink-0 select-none items-center justify-center whitespace-nowrap border font-weight-body-md cursor-pointer transition duration-150 ease-out active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100";
603
- var rowBase = "relative flex w-full min-w-0 select-none items-center justify-start whitespace-nowrap border text-left font-weight-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50";
603
+ var rowBase = "relative flex w-full min-w-0 select-none items-center border text-left font-weight-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50";
604
604
  var isRow = (v) => v === "field" || v === "item" || v === "media";
605
605
  var variants = {
606
606
  primary: "border-primary bg-primary text-on-primary shadow-sm enabled:hover:bg-primary-hover enabled:hover:border-primary-hover enabled:active:bg-primary-active",
@@ -617,6 +617,11 @@ var sizes = {
617
617
  md: "h-8 gap-sm rounded-md px-md text-body-md",
618
618
  lg: "h-9 gap-sm rounded-md px-base text-body-md"
619
619
  };
620
+ var wrapSizes = {
621
+ sm: "gap-xs rounded-sm px-sm py-xs text-body-sm",
622
+ md: "gap-sm rounded-md px-md py-xs text-body-md",
623
+ lg: "gap-sm rounded-md px-base py-sm text-body-md"
624
+ };
620
625
  var iconOnlySizes = {
621
626
  sm: "h-7 w-7 rounded-sm px-0",
622
627
  md: "h-8 w-8 rounded-md px-0",
@@ -633,6 +638,7 @@ var Button = React6.forwardRef(
633
638
  trailingIcon,
634
639
  fullWidth = false,
635
640
  iconOnly = false,
641
+ wrap = false,
636
642
  disabled,
637
643
  type = "button",
638
644
  className,
@@ -641,6 +647,8 @@ var Button = React6.forwardRef(
641
647
  ...rest
642
648
  }, ref) => {
643
649
  const media = variant === "media";
650
+ const row = isRow(variant);
651
+ const wrappedRow = row && wrap && !iconOnly;
644
652
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
645
653
  "button",
646
654
  {
@@ -651,9 +659,12 @@ var Button = React6.forwardRef(
651
659
  "aria-disabled": loading || void 0,
652
660
  onClick: loading ? (e) => e.preventDefault() : onClick,
653
661
  className: cn4(
654
- isRow(variant) ? rowBase : base,
662
+ row ? cn4(
663
+ rowBase,
664
+ wrappedRow ? "items-start whitespace-normal" : "items-center whitespace-nowrap"
665
+ ) : base,
655
666
  variants[variant],
656
- media ? "rounded-lg" : iconOnly ? iconOnlySizes[size] : sizes[size],
667
+ media ? "rounded-lg" : iconOnly ? iconOnlySizes[size] : wrappedRow ? wrapSizes[size] : sizes[size],
657
668
  fullWidth && "w-full",
658
669
  loading && "pointer-events-none",
659
670
  className
@@ -667,9 +678,35 @@ var Button = React6.forwardRef(
667
678
  size: iconSize[size],
668
679
  className: "shrink-0 animate-spin text-muted"
669
680
  }
670
- ) : leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "inline-flex shrink-0 items-center", "aria-hidden": "true", children: leadingIcon }),
671
- iconOnly ? !loading && children : media ? children : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: isRow(variant) ? "min-w-0 flex-1 truncate" : void 0, children: loading && loadingText ? loadingText : children }),
672
- !loading && trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "inline-flex shrink-0 items-center", "aria-hidden": "true", children: trailingIcon })
681
+ ) : leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
682
+ "span",
683
+ {
684
+ className: cn4(
685
+ "inline-flex shrink-0 items-center",
686
+ wrappedRow && "self-start"
687
+ ),
688
+ "aria-hidden": "true",
689
+ children: leadingIcon
690
+ }
691
+ ),
692
+ iconOnly ? !loading && children : media ? children : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
693
+ "span",
694
+ {
695
+ className: row ? cn4("min-w-0 flex-1", !wrappedRow && "truncate") : void 0,
696
+ children: loading && loadingText ? loadingText : children
697
+ }
698
+ ),
699
+ !loading && trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
700
+ "span",
701
+ {
702
+ className: cn4(
703
+ "inline-flex shrink-0 items-center",
704
+ wrappedRow && "self-start"
705
+ ),
706
+ "aria-hidden": "true",
707
+ children: trailingIcon
708
+ }
709
+ )
673
710
  ]
674
711
  }
675
712
  );
@@ -1225,6 +1262,7 @@ var AgentQuestionCard = React11.forwardRef(
1225
1262
  variant: "item",
1226
1263
  size: "md",
1227
1264
  fullWidth: true,
1265
+ wrap: true,
1228
1266
  role: "radio",
1229
1267
  "aria-checked": isSelected,
1230
1268
  "aria-label": option.label,
@@ -1278,6 +1316,7 @@ var AgentQuestionCard = React11.forwardRef(
1278
1316
  variant: "item",
1279
1317
  size: "md",
1280
1318
  fullWidth: true,
1319
+ wrap: true,
1281
1320
  role: "radio",
1282
1321
  "aria-checked": false,
1283
1322
  "aria-label": freeTextLabel ?? void 0,
@@ -6127,13 +6166,21 @@ var clampStyle = (lines) => ({
6127
6166
  WebkitBoxOrient: "vertical",
6128
6167
  overflow: "hidden"
6129
6168
  });
6130
- var CHUNK_TEXT_CLASS = "whitespace-pre-wrap text-body-md leading-body-lg text-body";
6169
+ var TONE_CLASS = {
6170
+ ink: "text-ink",
6171
+ body: "text-body"
6172
+ };
6173
+ var SIZE_CLASS = {
6174
+ sm: "text-body-sm leading-body-sm",
6175
+ md: "text-body-md leading-body-lg"
6176
+ };
6131
6177
  function MessageParagraph({
6132
6178
  index,
6133
6179
  text,
6134
6180
  maxLines,
6135
6181
  clamp: clamp2,
6136
6182
  showFade,
6183
+ textClassName,
6137
6184
  onOverflowChange
6138
6185
  }) {
6139
6186
  const measureRef = React49.useRef(null);
@@ -6151,7 +6198,7 @@ function MessageParagraph({
6151
6198
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
6152
6199
  "p",
6153
6200
  {
6154
- className: CHUNK_TEXT_CLASS,
6201
+ className: textClassName,
6155
6202
  style: clamp2 ? clampStyle(maxLines) : void 0,
6156
6203
  children: text
6157
6204
  }
@@ -6173,7 +6220,7 @@ function MessageParagraph({
6173
6220
  "aria-hidden": "true",
6174
6221
  className: cn38(
6175
6222
  "invisible absolute inset-x-0 top-0 -z-10",
6176
- CHUNK_TEXT_CLASS
6223
+ textClassName
6177
6224
  ),
6178
6225
  style: clampStyle(maxLines),
6179
6226
  children: text
@@ -6190,6 +6237,9 @@ var ExpandableMessage = React49.forwardRef(
6190
6237
  onExpandedChange,
6191
6238
  disabled = false,
6192
6239
  variant = "card",
6240
+ tone = "body",
6241
+ size = "md",
6242
+ toggleTone = "default",
6193
6243
  toggleClassName,
6194
6244
  className,
6195
6245
  ...rest
@@ -6226,7 +6276,13 @@ var ExpandableMessage = React49.forwardRef(
6226
6276
  const canExpand = paragraphs.some(
6227
6277
  (_, index) => overflowing[index] === true
6228
6278
  );
6229
- const toggleTone = toggleClassName ?? "text-primary hover:text-primary-hover";
6279
+ const textClassName = cn38(
6280
+ "whitespace-pre-wrap",
6281
+ SIZE_CLASS[size],
6282
+ TONE_CLASS[tone]
6283
+ );
6284
+ const isQuietToggle = toggleTone === "inherit";
6285
+ const resolvedToggleClassName = toggleClassName ?? (isQuietToggle ? "text-inherit hover:underline decoration-1 underline-offset-4" : "text-primary hover:bg-surface-soft hover:text-primary-hover");
6230
6286
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
6231
6287
  "div",
6232
6288
  {
@@ -6248,6 +6304,7 @@ var ExpandableMessage = React49.forwardRef(
6248
6304
  maxLines,
6249
6305
  clamp: clamp2,
6250
6306
  showFade: !isFlush && clamp2,
6307
+ textClassName,
6251
6308
  onOverflowChange: handleOverflowChange
6252
6309
  },
6253
6310
  index
@@ -6262,8 +6319,8 @@ var ExpandableMessage = React49.forwardRef(
6262
6319
  "aria-expanded": expanded,
6263
6320
  "aria-controls": textId,
6264
6321
  className: cn38(
6265
- "mt-xs flex w-full cursor-pointer items-center justify-start gap-xs rounded-none border-0 bg-transparent px-0 py-0 text-left text-body-sm font-weight-label transition-colors duration-150 ease-out hover:bg-surface-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
6266
- toggleTone
6322
+ "mt-xs flex w-full cursor-pointer items-center justify-start gap-xs rounded-none border-0 bg-transparent px-0 py-0 text-left text-body-sm font-weight-label transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
6323
+ resolvedToggleClassName
6267
6324
  ),
6268
6325
  children: [
6269
6326
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: expanded ? "Show less" : "Show more" }),
package/dist/index.js CHANGED
@@ -456,7 +456,7 @@ import * as React6 from "react";
456
456
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
457
457
  var cn4 = (...parts) => parts.filter(Boolean).join(" ");
458
458
  var base = "relative inline-flex shrink-0 select-none items-center justify-center whitespace-nowrap border font-weight-body-md cursor-pointer transition duration-150 ease-out active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50 disabled:active:scale-100";
459
- var rowBase = "relative flex w-full min-w-0 select-none items-center justify-start whitespace-nowrap border text-left font-weight-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50";
459
+ var rowBase = "relative flex w-full min-w-0 select-none items-center border text-left font-weight-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50";
460
460
  var isRow = (v) => v === "field" || v === "item" || v === "media";
461
461
  var variants = {
462
462
  primary: "border-primary bg-primary text-on-primary shadow-sm enabled:hover:bg-primary-hover enabled:hover:border-primary-hover enabled:active:bg-primary-active",
@@ -473,6 +473,11 @@ var sizes = {
473
473
  md: "h-8 gap-sm rounded-md px-md text-body-md",
474
474
  lg: "h-9 gap-sm rounded-md px-base text-body-md"
475
475
  };
476
+ var wrapSizes = {
477
+ sm: "gap-xs rounded-sm px-sm py-xs text-body-sm",
478
+ md: "gap-sm rounded-md px-md py-xs text-body-md",
479
+ lg: "gap-sm rounded-md px-base py-sm text-body-md"
480
+ };
476
481
  var iconOnlySizes = {
477
482
  sm: "h-7 w-7 rounded-sm px-0",
478
483
  md: "h-8 w-8 rounded-md px-0",
@@ -489,6 +494,7 @@ var Button = React6.forwardRef(
489
494
  trailingIcon,
490
495
  fullWidth = false,
491
496
  iconOnly = false,
497
+ wrap = false,
492
498
  disabled,
493
499
  type = "button",
494
500
  className,
@@ -497,6 +503,8 @@ var Button = React6.forwardRef(
497
503
  ...rest
498
504
  }, ref) => {
499
505
  const media = variant === "media";
506
+ const row = isRow(variant);
507
+ const wrappedRow = row && wrap && !iconOnly;
500
508
  return /* @__PURE__ */ jsxs4(
501
509
  "button",
502
510
  {
@@ -507,9 +515,12 @@ var Button = React6.forwardRef(
507
515
  "aria-disabled": loading || void 0,
508
516
  onClick: loading ? (e) => e.preventDefault() : onClick,
509
517
  className: cn4(
510
- isRow(variant) ? rowBase : base,
518
+ row ? cn4(
519
+ rowBase,
520
+ wrappedRow ? "items-start whitespace-normal" : "items-center whitespace-nowrap"
521
+ ) : base,
511
522
  variants[variant],
512
- media ? "rounded-lg" : iconOnly ? iconOnlySizes[size] : sizes[size],
523
+ media ? "rounded-lg" : iconOnly ? iconOnlySizes[size] : wrappedRow ? wrapSizes[size] : sizes[size],
513
524
  fullWidth && "w-full",
514
525
  loading && "pointer-events-none",
515
526
  className
@@ -523,9 +534,35 @@ var Button = React6.forwardRef(
523
534
  size: iconSize[size],
524
535
  className: "shrink-0 animate-spin text-muted"
525
536
  }
526
- ) : leadingIcon && /* @__PURE__ */ jsx6("span", { className: "inline-flex shrink-0 items-center", "aria-hidden": "true", children: leadingIcon }),
527
- iconOnly ? !loading && children : media ? children : /* @__PURE__ */ jsx6("span", { className: isRow(variant) ? "min-w-0 flex-1 truncate" : void 0, children: loading && loadingText ? loadingText : children }),
528
- !loading && trailingIcon && /* @__PURE__ */ jsx6("span", { className: "inline-flex shrink-0 items-center", "aria-hidden": "true", children: trailingIcon })
537
+ ) : leadingIcon && /* @__PURE__ */ jsx6(
538
+ "span",
539
+ {
540
+ className: cn4(
541
+ "inline-flex shrink-0 items-center",
542
+ wrappedRow && "self-start"
543
+ ),
544
+ "aria-hidden": "true",
545
+ children: leadingIcon
546
+ }
547
+ ),
548
+ iconOnly ? !loading && children : media ? children : /* @__PURE__ */ jsx6(
549
+ "span",
550
+ {
551
+ className: row ? cn4("min-w-0 flex-1", !wrappedRow && "truncate") : void 0,
552
+ children: loading && loadingText ? loadingText : children
553
+ }
554
+ ),
555
+ !loading && trailingIcon && /* @__PURE__ */ jsx6(
556
+ "span",
557
+ {
558
+ className: cn4(
559
+ "inline-flex shrink-0 items-center",
560
+ wrappedRow && "self-start"
561
+ ),
562
+ "aria-hidden": "true",
563
+ children: trailingIcon
564
+ }
565
+ )
529
566
  ]
530
567
  }
531
568
  );
@@ -1081,6 +1118,7 @@ var AgentQuestionCard = React11.forwardRef(
1081
1118
  variant: "item",
1082
1119
  size: "md",
1083
1120
  fullWidth: true,
1121
+ wrap: true,
1084
1122
  role: "radio",
1085
1123
  "aria-checked": isSelected,
1086
1124
  "aria-label": option.label,
@@ -1134,6 +1172,7 @@ var AgentQuestionCard = React11.forwardRef(
1134
1172
  variant: "item",
1135
1173
  size: "md",
1136
1174
  fullWidth: true,
1175
+ wrap: true,
1137
1176
  role: "radio",
1138
1177
  "aria-checked": false,
1139
1178
  "aria-label": freeTextLabel ?? void 0,
@@ -5983,13 +6022,21 @@ var clampStyle = (lines) => ({
5983
6022
  WebkitBoxOrient: "vertical",
5984
6023
  overflow: "hidden"
5985
6024
  });
5986
- var CHUNK_TEXT_CLASS = "whitespace-pre-wrap text-body-md leading-body-lg text-body";
6025
+ var TONE_CLASS = {
6026
+ ink: "text-ink",
6027
+ body: "text-body"
6028
+ };
6029
+ var SIZE_CLASS = {
6030
+ sm: "text-body-sm leading-body-sm",
6031
+ md: "text-body-md leading-body-lg"
6032
+ };
5987
6033
  function MessageParagraph({
5988
6034
  index,
5989
6035
  text,
5990
6036
  maxLines,
5991
6037
  clamp: clamp2,
5992
6038
  showFade,
6039
+ textClassName,
5993
6040
  onOverflowChange
5994
6041
  }) {
5995
6042
  const measureRef = React49.useRef(null);
@@ -6007,7 +6054,7 @@ function MessageParagraph({
6007
6054
  /* @__PURE__ */ jsx49(
6008
6055
  "p",
6009
6056
  {
6010
- className: CHUNK_TEXT_CLASS,
6057
+ className: textClassName,
6011
6058
  style: clamp2 ? clampStyle(maxLines) : void 0,
6012
6059
  children: text
6013
6060
  }
@@ -6029,7 +6076,7 @@ function MessageParagraph({
6029
6076
  "aria-hidden": "true",
6030
6077
  className: cn38(
6031
6078
  "invisible absolute inset-x-0 top-0 -z-10",
6032
- CHUNK_TEXT_CLASS
6079
+ textClassName
6033
6080
  ),
6034
6081
  style: clampStyle(maxLines),
6035
6082
  children: text
@@ -6046,6 +6093,9 @@ var ExpandableMessage = React49.forwardRef(
6046
6093
  onExpandedChange,
6047
6094
  disabled = false,
6048
6095
  variant = "card",
6096
+ tone = "body",
6097
+ size = "md",
6098
+ toggleTone = "default",
6049
6099
  toggleClassName,
6050
6100
  className,
6051
6101
  ...rest
@@ -6082,7 +6132,13 @@ var ExpandableMessage = React49.forwardRef(
6082
6132
  const canExpand = paragraphs.some(
6083
6133
  (_, index) => overflowing[index] === true
6084
6134
  );
6085
- const toggleTone = toggleClassName ?? "text-primary hover:text-primary-hover";
6135
+ const textClassName = cn38(
6136
+ "whitespace-pre-wrap",
6137
+ SIZE_CLASS[size],
6138
+ TONE_CLASS[tone]
6139
+ );
6140
+ const isQuietToggle = toggleTone === "inherit";
6141
+ const resolvedToggleClassName = toggleClassName ?? (isQuietToggle ? "text-inherit hover:underline decoration-1 underline-offset-4" : "text-primary hover:bg-surface-soft hover:text-primary-hover");
6086
6142
  return /* @__PURE__ */ jsxs43(
6087
6143
  "div",
6088
6144
  {
@@ -6104,6 +6160,7 @@ var ExpandableMessage = React49.forwardRef(
6104
6160
  maxLines,
6105
6161
  clamp: clamp2,
6106
6162
  showFade: !isFlush && clamp2,
6163
+ textClassName,
6107
6164
  onOverflowChange: handleOverflowChange
6108
6165
  },
6109
6166
  index
@@ -6118,8 +6175,8 @@ var ExpandableMessage = React49.forwardRef(
6118
6175
  "aria-expanded": expanded,
6119
6176
  "aria-controls": textId,
6120
6177
  className: cn38(
6121
- "mt-xs flex w-full cursor-pointer items-center justify-start gap-xs rounded-none border-0 bg-transparent px-0 py-0 text-left text-body-sm font-weight-label transition-colors duration-150 ease-out hover:bg-surface-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
6122
- toggleTone
6178
+ "mt-xs flex w-full cursor-pointer items-center justify-start gap-xs rounded-none border-0 bg-transparent px-0 py-0 text-left text-body-sm font-weight-label transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
6179
+ resolvedToggleClassName
6123
6180
  ),
6124
6181
  children: [
6125
6182
  /* @__PURE__ */ jsx49("span", { children: expanded ? "Show less" : "Show more" }),
package/dist/styles.css CHANGED
@@ -89,6 +89,7 @@
89
89
  --text-body-md--letter-spacing: -0.1px;
90
90
  --text-body-sm: 13px;
91
91
  --text-body-sm--font-weight: 400;
92
+ --leading-body-sm: 1.45;
92
93
  --text-body-sm--line-height: 1.45;
93
94
  --text-body-sm--letter-spacing: 0;
94
95
  --text-caption: 12px;
@@ -1804,6 +1805,10 @@
1804
1805
  --tw-leading: var(--leading-body-lg);
1805
1806
  line-height: var(--leading-body-lg);
1806
1807
  }
1808
+ .leading-body-sm {
1809
+ --tw-leading: var(--leading-body-sm);
1810
+ line-height: var(--leading-body-sm);
1811
+ }
1807
1812
  .tracking-overline {
1808
1813
  --tw-tracking: var(--tracking-overline);
1809
1814
  letter-spacing: var(--tracking-overline);
@@ -1811,6 +1816,9 @@
1811
1816
  .break-words {
1812
1817
  overflow-wrap: break-word;
1813
1818
  }
1819
+ .whitespace-normal {
1820
+ white-space: normal;
1821
+ }
1814
1822
  .whitespace-nowrap {
1815
1823
  white-space: nowrap;
1816
1824
  }
@@ -1826,6 +1834,9 @@
1826
1834
  .text-hairline-strong {
1827
1835
  color: var(--color-hairline-strong);
1828
1836
  }
1837
+ .text-inherit {
1838
+ color: inherit;
1839
+ }
1829
1840
  .text-ink {
1830
1841
  color: var(--color-ink);
1831
1842
  }
@@ -2313,6 +2324,13 @@
2313
2324
  }
2314
2325
  }
2315
2326
  }
2327
+ .hover\:underline {
2328
+ &:hover {
2329
+ @media (hover: hover) {
2330
+ text-decoration-line: underline;
2331
+ }
2332
+ }
2333
+ }
2316
2334
  .hover\:decoration-transparent {
2317
2335
  &:hover {
2318
2336
  @media (hover: hover) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designa8/vibedesign-linear-internal-v1-b737",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "Complete design system \"My Project linear-internal-v1\" generated by Atoms Design.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -83,6 +83,8 @@ const PANEL =
83
83
  * The card that replaces the chat prompt while an agent waits on a choice.
84
84
  * Options are a radiogroup (arrow keys move and select), the trailing row turns
85
85
  * into an inline text field, and closing folds the card into a slim restore bar.
86
+ * Option labels wrap onto multiple lines — agent options are often full
87
+ * sentences — with the letter badge pinned to the first line.
86
88
  */
87
89
  export const AgentQuestionCard = React.forwardRef<
88
90
  HTMLDivElement,
@@ -289,6 +291,7 @@ export const AgentQuestionCard = React.forwardRef<
289
291
  variant="item"
290
292
  size="md"
291
293
  fullWidth
294
+ wrap
292
295
  role="radio"
293
296
  aria-checked={isSelected}
294
297
  aria-label={option.label}
@@ -355,6 +358,7 @@ export const AgentQuestionCard = React.forwardRef<
355
358
  variant="item"
356
359
  size="md"
357
360
  fullWidth
361
+ wrap
358
362
  role="radio"
359
363
  aria-checked={false}
360
364
  aria-label={freeTextLabel ?? undefined}
@@ -3,7 +3,11 @@ import { AgentQuestionCard } from "./AgentQuestionCard";
3
3
  import type { AgentQuestionAnswer, AgentQuestionOption } from "./AgentQuestionCard";
4
4
 
5
5
  const OPTIONS: AgentQuestionOption[] = [
6
- { id: "keep", label: "Keep the current layout and tighten spacing" },
6
+ {
7
+ id: "keep",
8
+ label:
9
+ "Keep the current layout and tighten spacing — I'll adjust the gutters and paddings only, no structural change",
10
+ },
7
11
  { id: "rebuild", label: "Rebuild the canvas grid from scratch" },
8
12
  { id: "defer", label: "Leave it as is for now" },
9
13
  ];
@@ -30,7 +34,7 @@ export default function Preview() {
30
34
 
31
35
  return (
32
36
  <div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
33
- <Section title="Live card — pick an option, choose Other…, or close it">
37
+ <Section title="Live card — long sentences wrap, pick an option or close it">
34
38
  <AgentQuestionCard
35
39
  questionId="q-layout"
36
40
  questionNumber={1}
@@ -63,7 +67,11 @@ export default function Preview() {
63
67
  questionNumber={2}
64
68
  question="Which token should the selected row use?"
65
69
  options={[
66
- { id: "primary-soft", label: "primary-soft tint with a trailing check" },
70
+ {
71
+ id: "primary-soft",
72
+ label:
73
+ "primary-soft tint with a trailing check so the chosen row stays readable across the whole card",
74
+ },
67
75
  { id: "surface-soft", label: "surface-soft tint with no marker" },
68
76
  ]}
69
77
  selectedOptionId={errorSelected}
@@ -84,7 +92,11 @@ export default function Preview() {
84
92
  questionNumber={3}
85
93
  question="Should I apply the change to every breakpoint?"
86
94
  options={[
87
- { id: "all", label: "Yes, every breakpoint" },
95
+ {
96
+ id: "all",
97
+ label:
98
+ "Yes, every breakpoint — mobile, tablet and desktop all get the new spacing",
99
+ },
88
100
  { id: "desktop", label: "Desktop only for now" },
89
101
  ]}
90
102
  defaultSelectedOptionId="all"
@@ -38,6 +38,12 @@ export interface ButtonProps extends React.ComponentPropsWithoutRef<"button"> {
38
38
  fullWidth?: boolean;
39
39
  /** Square, icon-only shape (no horizontal padding). Pass the glyph as children and set aria-label. */
40
40
  iconOnly?: boolean;
41
+ /**
42
+ * Row variants only: lets the label wrap onto multiple lines instead of
43
+ * truncating, with the row growing to fit and leading / trailing icons
44
+ * aligned to the first line.
45
+ */
46
+ wrap?: boolean;
41
47
  }
42
48
 
43
49
  const cn = (...parts: Array<string | false | null | undefined>) =>
@@ -48,7 +54,7 @@ const base =
48
54
 
49
55
  /** Full-width rows: no press scale, left-aligned, background-only press. */
50
56
  const rowBase =
51
- "relative flex w-full min-w-0 select-none items-center justify-start whitespace-nowrap border text-left font-weight-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50";
57
+ "relative flex w-full min-w-0 select-none items-center border text-left font-weight-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50";
52
58
 
53
59
  const isRow = (v: ButtonVariant) => v === "field" || v === "item" || v === "media";
54
60
 
@@ -77,6 +83,13 @@ const sizes: Record<ButtonSize, string> = {
77
83
  lg: "h-9 gap-sm rounded-md px-base text-body-md",
78
84
  };
79
85
 
86
+ /** Same rhythm as `sizes`, but auto height so a wrapped label can grow. */
87
+ const wrapSizes: Record<ButtonSize, string> = {
88
+ sm: "gap-xs rounded-sm px-sm py-xs text-body-sm",
89
+ md: "gap-sm rounded-md px-md py-xs text-body-md",
90
+ lg: "gap-sm rounded-md px-base py-sm text-body-md",
91
+ };
92
+
80
93
  const iconOnlySizes: Record<ButtonSize, string> = {
81
94
  sm: "h-7 w-7 rounded-sm px-0",
82
95
  md: "h-8 w-8 rounded-md px-0",
@@ -96,6 +109,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
96
109
  trailingIcon,
97
110
  fullWidth = false,
98
111
  iconOnly = false,
112
+ wrap = false,
99
113
  disabled,
100
114
  type = "button",
101
115
  className,
@@ -106,6 +120,8 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
106
120
  ref,
107
121
  ) => {
108
122
  const media = variant === "media";
123
+ const row = isRow(variant);
124
+ const wrappedRow = row && wrap && !iconOnly;
109
125
  return (
110
126
  <button
111
127
  ref={ref}
@@ -115,13 +131,22 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
115
131
  aria-disabled={loading || undefined}
116
132
  onClick={loading ? (e) => e.preventDefault() : onClick}
117
133
  className={cn(
118
- isRow(variant) ? rowBase : base,
134
+ row
135
+ ? cn(
136
+ rowBase,
137
+ wrappedRow
138
+ ? "items-start whitespace-normal"
139
+ : "items-center whitespace-nowrap",
140
+ )
141
+ : base,
119
142
  variants[variant],
120
143
  media
121
144
  ? "rounded-lg"
122
145
  : iconOnly
123
146
  ? iconOnlySizes[size]
124
- : sizes[size],
147
+ : wrappedRow
148
+ ? wrapSizes[size]
149
+ : sizes[size],
125
150
  fullWidth && "w-full",
126
151
  loading && "pointer-events-none",
127
152
  className,
@@ -136,7 +161,13 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
136
161
  />
137
162
  ) : (
138
163
  leadingIcon && (
139
- <span className="inline-flex shrink-0 items-center" aria-hidden="true">
164
+ <span
165
+ className={cn(
166
+ "inline-flex shrink-0 items-center",
167
+ wrappedRow && "self-start",
168
+ )}
169
+ aria-hidden="true"
170
+ >
140
171
  {leadingIcon}
141
172
  </span>
142
173
  )
@@ -146,12 +177,24 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
146
177
  ) : media ? (
147
178
  children
148
179
  ) : (
149
- <span className={isRow(variant) ? "min-w-0 flex-1 truncate" : undefined}>
180
+ <span
181
+ className={
182
+ row
183
+ ? cn("min-w-0 flex-1", !wrappedRow && "truncate")
184
+ : undefined
185
+ }
186
+ >
150
187
  {loading && loadingText ? loadingText : children}
151
188
  </span>
152
189
  )}
153
190
  {!loading && trailingIcon && (
154
- <span className="inline-flex shrink-0 items-center" aria-hidden="true">
191
+ <span
192
+ className={cn(
193
+ "inline-flex shrink-0 items-center",
194
+ wrappedRow && "self-start",
195
+ )}
196
+ aria-hidden="true"
197
+ >
155
198
  {trailingIcon}
156
199
  </span>
157
200
  )}
@@ -3,6 +3,19 @@ import { Icon } from "../Icon";
3
3
 
4
4
  export type ExpandableMessageVariant = "card" | "flush";
5
5
 
6
+ /** Paragraph text colour. `body` is the default reading colour, `ink` is stronger. */
7
+ export type ExpandableMessageTone = "ink" | "body";
8
+
9
+ /** Paragraph text scale: `sm` for compact bubbles, `md` for the default body size. */
10
+ export type ExpandableMessageSize = "sm" | "md";
11
+
12
+ /**
13
+ * Toggle treatment. `default` is the primary link with a soft hover patch;
14
+ * `inherit` drops the hover patch and inherits the surrounding colour, for use
15
+ * inside a tinted or inverted bubble.
16
+ */
17
+ export type ExpandableMessageToggleTone = "default" | "inherit";
18
+
6
19
  export interface ExpandableMessageProps
7
20
  extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
8
21
  /** Raw message text. Newlines split it into paragraphs; blank lines are dropped. */
@@ -21,7 +34,13 @@ export interface ExpandableMessageProps
21
34
  * clamped paragraph. `flush` — bare text only, for use inside a chat bubble.
22
35
  */
23
36
  variant?: ExpandableMessageVariant;
24
- /** Recolors the toggle, e.g. on a tinted or inverted chat bubble. */
37
+ /** Paragraph text colour. Default `body`. */
38
+ tone?: ExpandableMessageTone;
39
+ /** Paragraph text scale — `sm` uses the body-sm role, `md` the body-md role. Default `md`. */
40
+ size?: ExpandableMessageSize;
41
+ /** Toggle treatment. Default `default`. */
42
+ toggleTone?: ExpandableMessageToggleTone;
43
+ /** Recolors the toggle, e.g. on a tinted or inverted chat bubble. Overrides `toggleTone`. */
25
44
  toggleClassName?: string;
26
45
  }
27
46
 
@@ -35,8 +54,15 @@ const clampStyle = (lines: number): React.CSSProperties => ({
35
54
  overflow: "hidden",
36
55
  });
37
56
 
38
- const CHUNK_TEXT_CLASS =
39
- "whitespace-pre-wrap text-body-md leading-body-lg text-body";
57
+ const TONE_CLASS: Record<ExpandableMessageTone, string> = {
58
+ ink: "text-ink",
59
+ body: "text-body",
60
+ };
61
+
62
+ const SIZE_CLASS: Record<ExpandableMessageSize, string> = {
63
+ sm: "text-body-sm leading-body-sm",
64
+ md: "text-body-md leading-body-lg",
65
+ };
40
66
 
41
67
  interface MessageParagraphProps {
42
68
  index: number;
@@ -44,6 +70,7 @@ interface MessageParagraphProps {
44
70
  maxLines: number;
45
71
  clamp: boolean;
46
72
  showFade: boolean;
73
+ textClassName: string;
47
74
  onOverflowChange: (index: number, overflowing: boolean) => void;
48
75
  }
49
76
 
@@ -58,6 +85,7 @@ function MessageParagraph({
58
85
  maxLines,
59
86
  clamp,
60
87
  showFade,
88
+ textClassName,
61
89
  onOverflowChange,
62
90
  }: MessageParagraphProps) {
63
91
  const measureRef = React.useRef<HTMLParagraphElement>(null);
@@ -77,7 +105,7 @@ function MessageParagraph({
77
105
  return (
78
106
  <div className="relative">
79
107
  <p
80
- className={CHUNK_TEXT_CLASS}
108
+ className={textClassName}
81
109
  style={clamp ? clampStyle(maxLines) : undefined}
82
110
  >
83
111
  {text}
@@ -97,7 +125,7 @@ function MessageParagraph({
97
125
  aria-hidden="true"
98
126
  className={cn(
99
127
  "invisible absolute inset-x-0 top-0 -z-10",
100
- CHUNK_TEXT_CLASS,
128
+ textClassName,
101
129
  )}
102
130
  style={clampStyle(maxLines)}
103
131
  >
@@ -120,6 +148,9 @@ export const ExpandableMessage = React.forwardRef<
120
148
  onExpandedChange,
121
149
  disabled = false,
122
150
  variant = "card",
151
+ tone = "body",
152
+ size = "md",
153
+ toggleTone = "default",
123
154
  toggleClassName,
124
155
  className,
125
156
  ...rest
@@ -164,8 +195,19 @@ export const ExpandableMessage = React.forwardRef<
164
195
  const canExpand = paragraphs.some(
165
196
  (_, index) => overflowing[index] === true,
166
197
  );
167
- const toggleTone =
168
- toggleClassName ?? "text-primary hover:text-primary-hover";
198
+
199
+ const textClassName = cn(
200
+ "whitespace-pre-wrap",
201
+ SIZE_CLASS[size],
202
+ TONE_CLASS[tone],
203
+ );
204
+
205
+ const isQuietToggle = toggleTone === "inherit";
206
+ const resolvedToggleClassName =
207
+ toggleClassName ??
208
+ (isQuietToggle
209
+ ? "text-inherit hover:underline decoration-1 underline-offset-4"
210
+ : "text-primary hover:bg-surface-soft hover:text-primary-hover");
169
211
 
170
212
  return (
171
213
  <div
@@ -188,6 +230,7 @@ export const ExpandableMessage = React.forwardRef<
188
230
  maxLines={maxLines}
189
231
  clamp={clamp}
190
232
  showFade={!isFlush && clamp}
233
+ textClassName={textClassName}
191
234
  onOverflowChange={handleOverflowChange}
192
235
  />
193
236
  );
@@ -202,8 +245,8 @@ export const ExpandableMessage = React.forwardRef<
202
245
  aria-expanded={expanded}
203
246
  aria-controls={textId}
204
247
  className={cn(
205
- "mt-xs flex w-full cursor-pointer items-center justify-start gap-xs rounded-none border-0 bg-transparent px-0 py-0 text-left text-body-sm font-weight-label transition-colors duration-150 ease-out hover:bg-surface-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
206
- toggleTone,
248
+ "mt-xs flex w-full cursor-pointer items-center justify-start gap-xs rounded-none border-0 bg-transparent px-0 py-0 text-left text-body-sm font-weight-label transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
249
+ resolvedToggleClassName,
207
250
  )}
208
251
  >
209
252
  <span>{expanded ? "Show less" : "Show more"}</span>
@@ -20,13 +20,14 @@ const SHORT =
20
20
  export default function ExpandableMessagePreview() {
21
21
  const [expandedCard, setExpandedCard] = React.useState(false);
22
22
  const [expandedFlush, setExpandedFlush] = React.useState(false);
23
+ const [expandedInk, setExpandedInk] = React.useState(false);
23
24
  const [maxLines, setMaxLines] = React.useState(3);
24
25
 
25
26
  return (
26
27
  <div className="w-full max-w-3xl mx-auto space-y-lg p-lg">
27
28
  <div className="space-y-xs">
28
29
  <p className="text-caption text-muted">
29
- Card · clamped at {maxLines} lines
30
+ Card · clamped at {maxLines} lines · tone body · size md
30
31
  </p>
31
32
  <ExpandableMessage
32
33
  content={LONG}
@@ -72,16 +73,34 @@ export default function ExpandableMessagePreview() {
72
73
 
73
74
  <div className="space-y-xs">
74
75
  <p className="text-caption text-muted">
75
- Flush · inside a tinted chat bubble
76
+ Flush · inside a tinted bubble · tone ink · size sm · toggle inherit
76
77
  </p>
77
78
  <div className="w-full rounded-lg bg-primary-soft p-md">
78
79
  <ExpandableMessage
79
80
  variant="flush"
80
81
  content={MULTI}
81
82
  maxLines={2}
83
+ tone="ink"
84
+ size="sm"
85
+ toggleTone="inherit"
82
86
  expanded={expandedFlush}
83
87
  onExpandedChange={setExpandedFlush}
84
- toggleClassName="text-primary hover:text-primary-hover"
88
+ />
89
+ </div>
90
+ </div>
91
+
92
+ <div className="space-y-xs">
93
+ <p className="text-caption text-muted">
94
+ Flush · tone ink · size md · toggle default
95
+ </p>
96
+ <div className="w-full rounded-lg border border-hairline bg-surface p-md">
97
+ <ExpandableMessage
98
+ variant="flush"
99
+ content={MULTI}
100
+ maxLines={2}
101
+ tone="ink"
102
+ expanded={expandedInk}
103
+ onExpandedChange={setExpandedInk}
85
104
  />
86
105
  </div>
87
106
  </div>