@designa8/vibedesign-flowtide-ds-v1-176b 0.2.2 → 0.2.3

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/dist/index.js CHANGED
@@ -451,6 +451,13 @@ var SIZE2 = {
451
451
  sm: "h-8 px-md text-label-sm",
452
452
  /* Compact form action: 36px tall, 14px medium label, tighter inset. */
453
453
  control: "h-9 px-base text-label-sm",
454
+ /*
455
+ * Compact field: the Input atom's "sm" field inset (px-md) at the control
456
+ * height (36px), so a compact select trigger and a compact text field stack
457
+ * on one left edge and one baseline. A "control" action keeps its roomier
458
+ * px-base inset; this size exists for field-shaped controls.
459
+ */
460
+ "field-sm": "h-9 px-md text-label-sm",
454
461
  /*
455
462
  * Control height: matches the Input atom's "md" field (h-10) and its
456
463
  * horizontal inset (px-md), so a select trigger and a text field line up in
@@ -464,6 +471,7 @@ var SIZE_WRAP = {
464
471
  xs: "min-h-6 px-sm py-xxs text-caption",
465
472
  sm: "min-h-8 px-md py-xxs text-label-sm",
466
473
  control: "min-h-9 px-base py-xxs text-label-sm",
474
+ "field-sm": "min-h-9 px-md py-xxs text-label-sm",
467
475
  field: "min-h-10 px-md py-xs text-body-md",
468
476
  md: "min-h-11 px-lg py-xs text-label-lg",
469
477
  lg: "min-h-12 px-xl py-sm text-label-xl"
@@ -472,6 +480,7 @@ var ICON_ONLY_SIZE = {
472
480
  xs: "size-6 p-0",
473
481
  sm: "size-8 p-0",
474
482
  control: "size-9 p-0",
483
+ "field-sm": "size-9 p-0",
475
484
  field: "size-10 p-0",
476
485
  md: "size-10 p-0",
477
486
  lg: "size-12 p-0"
@@ -751,6 +760,7 @@ var Checkbox = React6.forwardRef(
751
760
  }, [indeterminate]);
752
761
  const filled = isOn || indeterminate;
753
762
  const showCheck = isOn && !indeterminate;
763
+ const hasLabel = Boolean(label);
754
764
  const accessibleName = rest["aria-label"] || rest["aria-labelledby"] || (typeof label === "string" ? label : "Checkbox");
755
765
  const boxClasses = [
756
766
  "relative flex shrink-0 items-center justify-center border",
@@ -770,56 +780,66 @@ var Checkbox = React6.forwardRef(
770
780
  wrapperClassName || ""
771
781
  ].filter(Boolean).join(" "),
772
782
  children: [
773
- /* @__PURE__ */ jsxs5("span", { className: "relative inline-flex shrink-0", children: [
774
- /* @__PURE__ */ jsx6(
775
- "input",
776
- {
777
- ...rest,
778
- ref: setRefs,
779
- id: boxId,
780
- type: "checkbox",
781
- disabled,
782
- checked: isControlled ? isOn : void 0,
783
- defaultChecked: isControlled ? void 0 : defaultChecked,
784
- "aria-invalid": error ? true : void 0,
785
- "aria-label": accessibleName,
786
- onChange: (event) => {
787
- if (!isControlled) setUncontrolled(event.currentTarget.checked);
788
- if (onChange) onChange(event);
789
- },
790
- className: "peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none rounded-sm border-0 bg-transparent p-0 opacity-0 outline-none disabled:cursor-not-allowed"
791
- }
792
- ),
793
- /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", className: boxClasses }),
794
- /* @__PURE__ */ jsx6(
795
- "span",
796
- {
797
- "aria-hidden": "true",
798
- className: "pointer-events-none absolute inset-0 flex items-center justify-center",
799
- children: indeterminate ? /* @__PURE__ */ jsx6(
800
- Icon,
783
+ /* @__PURE__ */ jsxs5(
784
+ "span",
785
+ {
786
+ className: [
787
+ "relative inline-flex shrink-0 justify-center",
788
+ hasLabel ? "items-center text-label-lg" : ""
789
+ ].filter(Boolean).join(" "),
790
+ style: hasLabel ? { height: "1lh" } : void 0,
791
+ children: [
792
+ /* @__PURE__ */ jsx6(
793
+ "input",
801
794
  {
802
- name: "minus",
803
- size: GLYPH_SIZE2[size],
804
- strokeWidth: 3,
805
- className: disabled ? "text-muted-soft" : "text-on-primary"
795
+ ...rest,
796
+ ref: setRefs,
797
+ id: boxId,
798
+ type: "checkbox",
799
+ disabled,
800
+ checked: isControlled ? isOn : void 0,
801
+ defaultChecked: isControlled ? void 0 : defaultChecked,
802
+ "aria-invalid": error ? true : void 0,
803
+ "aria-label": accessibleName,
804
+ onChange: (event) => {
805
+ if (!isControlled) setUncontrolled(event.currentTarget.checked);
806
+ if (onChange) onChange(event);
807
+ },
808
+ className: "peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none rounded-sm border-0 bg-transparent p-0 opacity-0 outline-none disabled:cursor-not-allowed"
806
809
  }
807
- ) : /* @__PURE__ */ jsx6(
808
- Icon,
810
+ ),
811
+ /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", className: boxClasses }),
812
+ /* @__PURE__ */ jsx6(
813
+ "span",
809
814
  {
810
- name: "check",
811
- size: GLYPH_SIZE2[size],
812
- strokeWidth: 3,
813
- className: [
814
- "transition duration-150 ease-out",
815
- showCheck ? "scale-100 opacity-100" : "scale-75 opacity-0",
816
- disabled ? "text-muted" : "text-on-primary"
817
- ].join(" ")
815
+ "aria-hidden": "true",
816
+ className: "pointer-events-none absolute inset-0 flex items-center justify-center",
817
+ children: indeterminate ? /* @__PURE__ */ jsx6(
818
+ Icon,
819
+ {
820
+ name: "minus",
821
+ size: GLYPH_SIZE2[size],
822
+ strokeWidth: 3,
823
+ className: disabled ? "text-muted-soft" : "text-on-primary"
824
+ }
825
+ ) : /* @__PURE__ */ jsx6(
826
+ Icon,
827
+ {
828
+ name: "check",
829
+ size: GLYPH_SIZE2[size],
830
+ strokeWidth: 3,
831
+ className: [
832
+ "transition duration-150 ease-out",
833
+ showCheck ? "scale-100 opacity-100" : "scale-75 opacity-0",
834
+ disabled ? "text-muted" : "text-on-primary"
835
+ ].join(" ")
836
+ }
837
+ )
818
838
  }
819
839
  )
820
- }
821
- )
822
- ] }),
840
+ ]
841
+ }
842
+ ),
823
843
  label || description || errorMessage ? /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-col gap-xxs", children: [
824
844
  label ? /* @__PURE__ */ jsx6(
825
845
  Label,
@@ -1050,6 +1070,7 @@ var RADIUS3 = {
1050
1070
  xs: "rounded-sm",
1051
1071
  sm: "rounded-md",
1052
1072
  control: "rounded-md",
1073
+ "field-sm": "rounded-md",
1053
1074
  field: "rounded-md",
1054
1075
  md: "rounded-lg",
1055
1076
  lg: "rounded-lg"
@@ -1058,6 +1079,7 @@ var ICON_SIZE2 = {
1058
1079
  xs: 14,
1059
1080
  sm: 16,
1060
1081
  control: 16,
1082
+ "field-sm": 16,
1061
1083
  field: 18,
1062
1084
  md: 18,
1063
1085
  lg: 20
@@ -3657,6 +3679,7 @@ var ButtonGroup = React30.forwardRef(
3657
3679
  const [hovered, setHovered] = React30.useState(null);
3658
3680
  const selectedIndex = options.findIndex((option) => option.value === selected);
3659
3681
  const hasSelection = selectedIndex >= 0;
3682
+ const compact = size === "sm";
3660
3683
  const trackRef = React30.useRef(null);
3661
3684
  const segmentRefs = React30.useRef([]);
3662
3685
  const [boxes, setBoxes] = React30.useState([]);
@@ -3738,6 +3761,7 @@ var ButtonGroup = React30.forwardRef(
3738
3761
  "relative rounded-md border border-hairline bg-surface",
3739
3762
  "transition-colors duration-150 ease-out",
3740
3763
  "has-[button:focus-visible]:border-primary",
3764
+ compact && "h-9",
3741
3765
  stretch ? "flex w-full" : "inline-flex max-w-full"
3742
3766
  ),
3743
3767
  style: { overflow: "hidden" },
@@ -3745,7 +3769,12 @@ var ButtonGroup = React30.forwardRef(
3745
3769
  "div",
3746
3770
  {
3747
3771
  ref: trackRef,
3748
- className: cn4("relative", stretch ? "flex w-full" : "inline-flex"),
3772
+ className: cn4(
3773
+ "relative",
3774
+ stretch ? "flex w-full" : "inline-flex",
3775
+ /* Fill the bordered track so the segments run edge to edge. */
3776
+ compact && "h-full"
3777
+ ),
3749
3778
  children: [
3750
3779
  /* @__PURE__ */ jsx30(
3751
3780
  "span",
@@ -3794,6 +3823,10 @@ var ButtonGroup = React30.forwardRef(
3794
3823
  onMouseEnter: () => setHovered(index),
3795
3824
  onMouseLeave: () => setHovered((current) => current === index ? null : current),
3796
3825
  style: {
3826
+ /* Stretch to the group's content box (Button's own size
3827
+ sets a fixed height, so the inline height is what lets
3828
+ the segment fill the 36px track). */
3829
+ ...compact ? { height: "100%" } : null,
3797
3830
  backgroundColor: option.disabled || isHovered ? "var(--color-surface-soft)" : void 0,
3798
3831
  color: option.disabled ? "var(--color-muted-soft)" : isSelected ? selectedColor : "var(--color-ink)"
3799
3832
  },
@@ -3916,6 +3949,7 @@ var CardHeader = React32.forwardRef(
3916
3949
  className,
3917
3950
  ...rest
3918
3951
  } = props;
3952
+ const hasContent = React32.Children.toArray(children).length > 0;
3919
3953
  return /* @__PURE__ */ jsxs30(
3920
3954
  "div",
3921
3955
  {
@@ -3932,7 +3966,7 @@ var CardHeader = React32.forwardRef(
3932
3966
  /* @__PURE__ */ jsx32("span", { className: cx5(TITLE2[size], "min-w-0 break-words"), children: title }),
3933
3967
  description ? /* @__PURE__ */ jsx32("span", { className: "text-caption text-muted min-w-0 break-words", children: description }) : null
3934
3968
  ] }),
3935
- /* @__PURE__ */ jsx32("div", { className: "flex min-w-0 shrink-0 basis-full items-center gap-md sm:shrink sm:basis-0 sm:grow", children }),
3969
+ hasContent ? /* @__PURE__ */ jsx32("div", { className: "flex min-w-0 shrink-0 basis-full items-center gap-md sm:shrink sm:basis-0 sm:grow", children }) : null,
3936
3970
  /* @__PURE__ */ jsx32("div", { className: "ml-auto flex shrink-0 items-start gap-md self-start", children: actions ? /* @__PURE__ */ jsxs30(Fragment2, { children: [
3937
3971
  showDivider ? /* @__PURE__ */ jsx32(Divider, { orientation: "vertical", className: "self-stretch" }) : null,
3938
3972
  /* @__PURE__ */ jsx32(
@@ -4875,7 +4909,7 @@ var Dropdown = React35.forwardRef(
4875
4909
  };
4876
4910
  const fieldAppearance = appearance === "field";
4877
4911
  const compact = size === "sm";
4878
- const triggerSize = compact ? "sm" : fieldAppearance ? "field" : "md";
4912
+ const triggerSize = compact ? "field-sm" : fieldAppearance ? "field" : "md";
4879
4913
  const panel = /* @__PURE__ */ jsx35(
4880
4914
  "div",
4881
4915
  {
@@ -4917,6 +4951,7 @@ var Dropdown = React35.forwardRef(
4917
4951
  fullWidth: true,
4918
4952
  disabled: option.disabled,
4919
4953
  tabIndex: open ? 0 : -1,
4954
+ title: typeof option.label === "string" ? option.label : void 0,
4920
4955
  onClick: () => selectOption(option),
4921
4956
  onKeyDown: (event) => handleOptionKeyDown(index, event),
4922
4957
  style: {
@@ -4928,6 +4963,7 @@ var Dropdown = React35.forwardRef(
4928
4963
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue focus-visible:ring-inset",
4929
4964
  "disabled:cursor-not-allowed disabled:opacity-50"
4930
4965
  ),
4966
+ labelClassName: "min-w-0 flex-1",
4931
4967
  children: [
4932
4968
  /* @__PURE__ */ jsx35(
4933
4969
  "span",
@@ -4940,9 +4976,9 @@ var Dropdown = React35.forwardRef(
4940
4976
  )
4941
4977
  }
4942
4978
  ),
4943
- /* @__PURE__ */ jsxs33("span", { className: "relative flex w-full items-center gap-sm", children: [
4979
+ /* @__PURE__ */ jsxs33("span", { className: "relative flex w-full min-w-0 items-center gap-sm", children: [
4944
4980
  showLeadingBox ? /* @__PURE__ */ jsx35("span", { className: "flex size-4 shrink-0 items-center justify-center", children: option.leadingSlot ?? null }) : null,
4945
- /* @__PURE__ */ jsx35("span", { className: "truncate", children: option.label }),
4981
+ /* @__PURE__ */ jsx35("span", { className: "min-w-0 truncate", children: option.label }),
4946
4982
  isSelected ? /* @__PURE__ */ jsx35(
4947
4983
  Icon,
4948
4984
  {
@@ -14038,6 +14074,7 @@ var ROW_ACTIVE2 = "bg-primary-soft text-ink hover:bg-primary-soft active:bg-prim
14038
14074
  var NESTED_INSET = "pl-10";
14039
14075
  var LABEL2 = "truncate text-left text-body-md transition-opacity duration-150 ease-out";
14040
14076
  var LABEL_HIDDEN = "w-0 overflow-hidden opacity-0 pointer-events-none";
14077
+ var LABEL_OFF_FLOW = "sr-only";
14041
14078
  var SURFACE_CARD = "rounded-xl border border-solid border-hairline bg-surface shadow-sm";
14042
14079
  var SURFACE_FLAT = "rounded-none border-x-0 border-t-0 border-r border-solid border-hairline bg-surface shadow-none";
14043
14080
  function cx29(...parts) {
@@ -14105,7 +14142,9 @@ var SidebarDesktop = React79.forwardRef(function SidebarDesktop2({
14105
14142
  isActive ? "text-ink" : "text-muted group-hover:text-ink"
14106
14143
  );
14107
14144
  const rowBox = (nested) => folded ? "mx-auto h-10 w-10 justify-center" : cx29("w-full h-10 gap-md px-sm", nested && NESTED_INSET);
14145
+ const rowSlot = (content) => /* @__PURE__ */ jsx79("div", { className: folded ? "flex justify-center" : "flex w-full", children: content });
14108
14146
  const labelClass = (extra) => cx29(LABEL2, extra, folded ? LABEL_HIDDEN : "opacity-100");
14147
+ const buttonLabelClass = (extra) => cx29(LABEL2, extra, folded ? LABEL_OFF_FLOW : "opacity-100");
14109
14148
  const renderRowTrailing = (node) => {
14110
14149
  if (folded) return null;
14111
14150
  if (node.count === void 0 && node.trailing === void 0) return null;
@@ -14151,42 +14190,44 @@ var SidebarDesktop = React79.forwardRef(function SidebarDesktop2({
14151
14190
  const panelId = groupPanelId(section.id);
14152
14191
  const open = collapsedGroups[section.id] !== true;
14153
14192
  return /* @__PURE__ */ jsxs77("li", { children: [
14154
- /* @__PURE__ */ jsxs77(
14155
- Button,
14156
- {
14157
- type: "button",
14158
- chrome: "none",
14159
- "aria-expanded": open,
14160
- "aria-controls": panelId,
14161
- title: folded ? section.label : void 0,
14162
- onClick: () => toggleGroup(section.id),
14163
- className: cx29(ROW6, rowBox(), ROW_IDLE2),
14164
- children: [
14165
- /* @__PURE__ */ jsx79(
14166
- Icon,
14167
- {
14168
- name: section.icon,
14169
- size: 20,
14170
- strokeWidth: 1.8,
14171
- className: iconTone2(false)
14172
- }
14173
- ),
14174
- /* @__PURE__ */ jsx79("span", { className: labelClass(), children: section.label }),
14175
- /* @__PURE__ */ jsx79(
14176
- Icon,
14177
- {
14178
- name: "chevron-down",
14179
- size: 18,
14180
- strokeWidth: 2,
14181
- className: cx29(
14182
- "ml-auto shrink-0 text-muted transition duration-200 ease-out",
14183
- open && "rotate-180",
14184
- folded && "hidden"
14185
- )
14186
- }
14187
- )
14188
- ]
14189
- }
14193
+ rowSlot(
14194
+ /* @__PURE__ */ jsxs77(
14195
+ Button,
14196
+ {
14197
+ type: "button",
14198
+ chrome: "none",
14199
+ "aria-expanded": open,
14200
+ "aria-controls": panelId,
14201
+ title: folded ? section.label : void 0,
14202
+ onClick: () => toggleGroup(section.id),
14203
+ className: cx29(ROW6, rowBox(), ROW_IDLE2),
14204
+ children: [
14205
+ /* @__PURE__ */ jsx79(
14206
+ Icon,
14207
+ {
14208
+ name: section.icon,
14209
+ size: 20,
14210
+ strokeWidth: 1.8,
14211
+ className: iconTone2(false)
14212
+ }
14213
+ ),
14214
+ /* @__PURE__ */ jsx79("span", { className: labelClass(), children: section.label }),
14215
+ /* @__PURE__ */ jsx79(
14216
+ Icon,
14217
+ {
14218
+ name: "chevron-down",
14219
+ size: 18,
14220
+ strokeWidth: 2,
14221
+ className: cx29(
14222
+ "ml-auto shrink-0 text-muted transition duration-200 ease-out",
14223
+ open && "rotate-180",
14224
+ folded && "hidden"
14225
+ )
14226
+ }
14227
+ )
14228
+ ]
14229
+ }
14230
+ )
14190
14231
  ),
14191
14232
  /* @__PURE__ */ jsx79(
14192
14233
  "div",
@@ -14292,69 +14333,73 @@ var SidebarDesktop = React79.forwardRef(function SidebarDesktop2({
14292
14333
  (section) => section.children?.length ? renderGroup(section) : renderRow(section)
14293
14334
  ) }) }),
14294
14335
  (hasCreate || hasStarred) && /* @__PURE__ */ jsx79(Divider, { className: "my-md" }),
14295
- hasCreate ? /* @__PURE__ */ jsxs77(
14296
- Button,
14297
- {
14298
- type: "button",
14299
- chrome: "none",
14300
- onClick: onCreateClick,
14301
- title: folded ? createLabel : void 0,
14302
- className: cx29(
14303
- ROW6,
14304
- rowBox(),
14305
- "bg-accent-violet-soft text-accent-violet",
14306
- "hover:brightness-[0.98] active:brightness-[0.96]"
14307
- ),
14308
- children: [
14309
- /* @__PURE__ */ jsx79(
14310
- "span",
14311
- {
14312
- "aria-hidden": "true",
14313
- className: "flex size-5 shrink-0 items-center justify-center rounded-full border border-current",
14314
- children: /* @__PURE__ */ jsx79(Icon, { name: "plus", size: 12, strokeWidth: 2.2 })
14315
- }
14316
- ),
14317
- /* @__PURE__ */ jsx79("span", { className: labelClass(), children: createLabel })
14318
- ]
14319
- }
14320
- ) : null,
14321
- hasStarred ? /* @__PURE__ */ jsxs77("div", { className: hasCreate ? "pt-md" : void 0, children: [
14336
+ hasCreate ? rowSlot(
14322
14337
  /* @__PURE__ */ jsxs77(
14323
14338
  Button,
14324
14339
  {
14325
14340
  type: "button",
14326
14341
  chrome: "none",
14327
- "aria-expanded": starredOpen,
14328
- "aria-controls": groupPanelId("starred"),
14329
- title: folded ? starredLabel : void 0,
14330
- onClick: () => toggleGroup("starred"),
14331
- className: cx29(ROW6, rowBox(), ROW_IDLE2),
14342
+ onClick: onCreateClick,
14343
+ title: folded ? createLabel : void 0,
14344
+ className: cx29(
14345
+ ROW6,
14346
+ rowBox(),
14347
+ "bg-accent-violet-soft text-accent-violet",
14348
+ "hover:brightness-[0.98] active:brightness-[0.96]"
14349
+ ),
14332
14350
  children: [
14333
14351
  /* @__PURE__ */ jsx79(
14334
- Icon,
14352
+ "span",
14335
14353
  {
14336
- name: "star",
14337
- size: 20,
14338
- strokeWidth: 1.8,
14339
- className: iconTone2(false)
14354
+ "aria-hidden": "true",
14355
+ className: "flex size-5 shrink-0 items-center justify-center rounded-full border border-current",
14356
+ children: /* @__PURE__ */ jsx79(Icon, { name: "plus", size: 12, strokeWidth: 2.2 })
14340
14357
  }
14341
14358
  ),
14342
- /* @__PURE__ */ jsx79("span", { className: labelClass("text-label-sm"), children: starredLabel }),
14343
- /* @__PURE__ */ jsx79(
14344
- Icon,
14345
- {
14346
- name: "chevron-down",
14347
- size: 18,
14348
- strokeWidth: 2,
14349
- className: cx29(
14350
- "ml-auto shrink-0 text-muted transition duration-200 ease-out",
14351
- starredOpen && "rotate-180",
14352
- folded && "hidden"
14353
- )
14354
- }
14355
- )
14359
+ /* @__PURE__ */ jsx79("span", { className: buttonLabelClass(), children: createLabel })
14356
14360
  ]
14357
14361
  }
14362
+ )
14363
+ ) : null,
14364
+ hasStarred ? /* @__PURE__ */ jsxs77("div", { className: hasCreate ? "pt-md" : void 0, children: [
14365
+ rowSlot(
14366
+ /* @__PURE__ */ jsxs77(
14367
+ Button,
14368
+ {
14369
+ type: "button",
14370
+ chrome: "none",
14371
+ "aria-expanded": starredOpen,
14372
+ "aria-controls": groupPanelId("starred"),
14373
+ title: folded ? starredLabel : void 0,
14374
+ onClick: () => toggleGroup("starred"),
14375
+ className: cx29(ROW6, rowBox(), ROW_IDLE2),
14376
+ children: [
14377
+ /* @__PURE__ */ jsx79(
14378
+ Icon,
14379
+ {
14380
+ name: "star",
14381
+ size: 20,
14382
+ strokeWidth: 1.8,
14383
+ className: iconTone2(false)
14384
+ }
14385
+ ),
14386
+ /* @__PURE__ */ jsx79("span", { className: buttonLabelClass("text-label-sm"), children: starredLabel }),
14387
+ /* @__PURE__ */ jsx79(
14388
+ Icon,
14389
+ {
14390
+ name: "chevron-down",
14391
+ size: 18,
14392
+ strokeWidth: 2,
14393
+ className: cx29(
14394
+ "ml-auto shrink-0 text-muted transition duration-200 ease-out",
14395
+ starredOpen && "rotate-180",
14396
+ folded && "hidden"
14397
+ )
14398
+ }
14399
+ )
14400
+ ]
14401
+ }
14402
+ )
14358
14403
  ),
14359
14404
  /* @__PURE__ */ jsx79(
14360
14405
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designa8/vibedesign-flowtide-ds-v1-176b",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Calm, precise design system for workflow automation tools: canvases, run history, connections and usage.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -10,7 +10,14 @@ export type ButtonVariant =
10
10
  | "inverse"
11
11
  | "danger"
12
12
  | "ghost";
13
- export type ButtonSize = "xs" | "sm" | "control" | "field" | "md" | "lg";
13
+ export type ButtonSize =
14
+ | "xs"
15
+ | "sm"
16
+ | "control"
17
+ | "field-sm"
18
+ | "field"
19
+ | "md"
20
+ | "lg";
14
21
  /**
15
22
  * Corner treatment: the default soft rectangle, a full pill, or "flat" for a
16
23
  * control that sits inside a parent which already owns the radius (a segment of
@@ -134,6 +141,13 @@ const SIZE: Record<ButtonSize, string> = {
134
141
  sm: "h-8 px-md text-label-sm",
135
142
  /* Compact form action: 36px tall, 14px medium label, tighter inset. */
136
143
  control: "h-9 px-base text-label-sm",
144
+ /*
145
+ * Compact field: the Input atom's "sm" field inset (px-md) at the control
146
+ * height (36px), so a compact select trigger and a compact text field stack
147
+ * on one left edge and one baseline. A "control" action keeps its roomier
148
+ * px-base inset; this size exists for field-shaped controls.
149
+ */
150
+ "field-sm": "h-9 px-md text-label-sm",
137
151
  /*
138
152
  * Control height: matches the Input atom's "md" field (h-10) and its
139
153
  * horizontal inset (px-md), so a select trigger and a text field line up in
@@ -153,6 +167,7 @@ const SIZE_WRAP: Record<ButtonSize, string> = {
153
167
  xs: "min-h-6 px-sm py-xxs text-caption",
154
168
  sm: "min-h-8 px-md py-xxs text-label-sm",
155
169
  control: "min-h-9 px-base py-xxs text-label-sm",
170
+ "field-sm": "min-h-9 px-md py-xxs text-label-sm",
156
171
  field: "min-h-10 px-md py-xs text-body-md",
157
172
  md: "min-h-11 px-lg py-xs text-label-lg",
158
173
  lg: "min-h-12 px-xl py-sm text-label-xl",
@@ -162,6 +177,7 @@ const ICON_ONLY_SIZE: Record<ButtonSize, string> = {
162
177
  xs: "size-6 p-0",
163
178
  sm: "size-8 p-0",
164
179
  control: "size-9 p-0",
180
+ "field-sm": "size-9 p-0",
165
181
  field: "size-10 p-0",
166
182
  md: "size-10 p-0",
167
183
  lg: "size-12 p-0",
@@ -90,6 +90,17 @@ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
90
90
  const filled = isOn || indeterminate;
91
91
  const showCheck = isOn && !indeterminate;
92
92
 
93
+ /**
94
+ * The label renders at the label-lg type role (16px / 1.4 ≈ 22.4px line
95
+ * box), which is taller than the box at every size, so an items-start row
96
+ * pinned the box to the top of the line instead of its centre. When there
97
+ * is a label, the box wrapper is given exactly one line of that role —
98
+ * `1lh`, so it follows the token's line height — and centres the box
99
+ * inside it. Multi-line labels, the description and the error message keep
100
+ * flowing below. With no label the wrapper sizes to the box, as before.
101
+ */
102
+ const hasLabel = Boolean(label);
103
+
93
104
  const accessibleName =
94
105
  rest["aria-label"] ||
95
106
  rest["aria-labelledby"] ||
@@ -133,7 +144,15 @@ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
133
144
  .filter(Boolean)
134
145
  .join(" ")}
135
146
  >
136
- <span className="relative inline-flex shrink-0">
147
+ <span
148
+ className={[
149
+ "relative inline-flex shrink-0 justify-center",
150
+ hasLabel ? "items-center text-label-lg" : "",
151
+ ]
152
+ .filter(Boolean)
153
+ .join(" ")}
154
+ style={hasLabel ? { height: "1lh" } : undefined}
155
+ >
137
156
  <input
138
157
  {...rest}
139
158
  ref={setRefs}
@@ -47,6 +47,7 @@ const RADIUS: Record<IconButtonSize, string> = {
47
47
  xs: "rounded-sm",
48
48
  sm: "rounded-md",
49
49
  control: "rounded-md",
50
+ "field-sm": "rounded-md",
50
51
  field: "rounded-md",
51
52
  md: "rounded-lg",
52
53
  lg: "rounded-lg",
@@ -61,6 +62,7 @@ const ICON_SIZE: Record<IconButtonSize, number> = {
61
62
  xs: 14,
62
63
  sm: 16,
63
64
  control: 16,
65
+ "field-sm": 16,
64
66
  field: 18,
65
67
  md: 18,
66
68
  lg: 20,
@@ -87,6 +87,17 @@ export const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(
87
87
  const selectedIndex = options.findIndex((option) => option.value === selected);
88
88
  const hasSelection = selectedIndex >= 0;
89
89
 
90
+ /*
91
+ * Compact groups share the 36px control height used by a `size="sm"` text
92
+ * field and the compact dropdown trigger, so the segments in a filter
93
+ * toolbar sit on the same top and bottom lines as the field and the select
94
+ * beside them. The bordered track owns that outer box and the segments
95
+ * stretch to its content height (36px minus the 1px stroke on each edge),
96
+ * which keeps the group a hair taller than its own segments rather than
97
+ * floating a 32px segment block inside a taller frame.
98
+ */
99
+ const compact = size === "sm";
100
+
90
101
  /* Measured so the sliding indicator and the dividers track segments of any
91
102
  width — intrinsic or equal-share. */
92
103
  const trackRef = React.useRef<HTMLDivElement>(null);
@@ -184,13 +195,19 @@ export const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(
184
195
  "relative rounded-md border border-hairline bg-surface",
185
196
  "transition-colors duration-150 ease-out",
186
197
  "has-[button:focus-visible]:border-primary",
198
+ compact && "h-9",
187
199
  stretch ? "flex w-full" : "inline-flex max-w-full",
188
200
  )}
189
201
  style={{ overflow: "hidden" }}
190
202
  >
191
203
  <div
192
204
  ref={trackRef}
193
- className={cn("relative", stretch ? "flex w-full" : "inline-flex")}
205
+ className={cn(
206
+ "relative",
207
+ stretch ? "flex w-full" : "inline-flex",
208
+ /* Fill the bordered track so the segments run edge to edge. */
209
+ compact && "h-full",
210
+ )}
194
211
  >
195
212
  {/* One shared indicator that slides between segments. */}
196
213
  <span
@@ -242,6 +259,10 @@ export const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(
242
259
  setHovered((current) => (current === index ? null : current))
243
260
  }
244
261
  style={{
262
+ /* Stretch to the group's content box (Button's own size
263
+ sets a fixed height, so the inline height is what lets
264
+ the segment fill the 36px track). */
265
+ ...(compact ? { height: "100%" } : null),
245
266
  backgroundColor:
246
267
  option.disabled || isHovered
247
268
  ? "var(--color-surface-soft)"