@designa8/vibedesign-linear-internal-v1-b737 0.11.1 → 0.11.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
  # @designa8/vibedesign-linear-internal-v1-b737
2
2
 
3
- Complete design system generated by Atoms Design, version **0.11.1**.
3
+ Complete design system generated by Atoms Design, version **0.11.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
@@ -1858,7 +1858,8 @@ var TONE = {
1858
1858
  warning: "bg-semantic-warning-soft text-semantic-warning",
1859
1859
  error: "bg-semantic-error-soft text-semantic-error",
1860
1860
  info: "bg-semantic-info-soft text-semantic-info",
1861
- "on-primary": "bg-on-primary/20 text-on-primary"
1861
+ "on-primary": "bg-on-primary/20 text-on-primary",
1862
+ "on-primary-solid": "bg-on-primary text-primary"
1862
1863
  };
1863
1864
  var SIZE = {
1864
1865
  sm: "h-5 gap-xs rounded-sm px-xs text-caption",
@@ -9994,7 +9995,16 @@ var pillRadius = {
9994
9995
  md: "rounded-md"
9995
9996
  };
9996
9997
  var SegmentedControl = React83.forwardRef(
9997
- ({ items, value, onValueChange, size = "sm", bare = false, className, ...rest }, ref) => {
9998
+ ({
9999
+ items,
10000
+ value,
10001
+ onValueChange,
10002
+ size = "sm",
10003
+ bare = false,
10004
+ fullWidth = false,
10005
+ className,
10006
+ ...rest
10007
+ }, ref) => {
9998
10008
  const trackRef = React83.useRef(null);
9999
10009
  const itemRefs = React83.useRef({});
10000
10010
  const [pill, setPill] = React83.useState(null);
@@ -10029,80 +10039,91 @@ var SegmentedControl = React83.forwardRef(
10029
10039
  onValueChange(next.value);
10030
10040
  itemRefs.current[next.value]?.focus();
10031
10041
  };
10032
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { ref, className: cn62("w-full", className), ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
10042
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10033
10043
  "div",
10034
10044
  {
10035
- ref: trackRef,
10036
- role: "tablist",
10037
- "aria-orientation": "horizontal",
10038
- onKeyDown,
10039
- className: cn62(
10040
- "relative isolate inline-flex max-w-full items-center overflow-x-auto rounded-lg",
10041
- frame[size],
10042
- bare ? "bg-transparent" : "border border-hairline bg-canvas shadow-sm",
10043
- "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
10044
- ),
10045
- children: [
10046
- !bare ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10047
- "span",
10048
- {
10049
- "aria-hidden": "true",
10050
- className: cn62(
10051
- "pointer-events-none absolute top-xxs bottom-xxs left-0 -z-10 bg-primary shadow-sm transition-[transform,width] duration-200 ease-out",
10052
- pillRadius[size]
10053
- ),
10054
- style: pill ? { width: pill.width, transform: `translateX(${pill.offset}px)` } : { width: 0, opacity: 0 }
10055
- }
10056
- ) : null,
10057
- items.map((item) => {
10058
- const active = item.value === value;
10059
- const iconOnly = Boolean(item.icon) && item.label == null;
10060
- const glyphSize3 = size === "sm" ? 14 : 16;
10061
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10062
- Button,
10063
- {
10064
- ref: (el) => {
10065
- itemRefs.current[item.value] = el;
10066
- },
10067
- type: "button",
10068
- role: "tab",
10069
- "aria-selected": active,
10070
- "aria-label": iconOnly ? item["aria-label"] ?? item.value : void 0,
10071
- tabIndex: active || value === void 0 && item.value === firstEnabled ? 0 : -1,
10072
- variant: bare ? active ? "primary" : "ghost" : "bare",
10073
- size,
10074
- iconOnly,
10075
- disabled: item.disabled,
10076
- onClick: () => onValueChange(item.value),
10077
- className: segmentInteraction,
10078
- children: iconOnly ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Icon, { name: item.icon, size: glyphSize3 }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
10079
- item.dotClassName ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10080
- "span",
10081
- {
10082
- "aria-hidden": "true",
10083
- className: cn62("h-2 w-2 shrink-0 rounded-full", item.dotClassName)
10084
- }
10085
- ) : null,
10086
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Icon, { name: item.icon, size: glyphSize3 }) : null,
10087
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "truncate", children: item.label }),
10088
- item.count !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10089
- Badge,
10090
- {
10091
- size: "sm",
10092
- tone: active ? "on-primary" : "neutral",
10093
- "aria-label": `${item.count} items`,
10094
- className: "min-w-5 justify-center",
10095
- children: item.count
10096
- }
10097
- ) : null
10098
- ] })
10099
- },
10100
- item.value
10101
- );
10102
- })
10103
- ]
10045
+ ref,
10046
+ className: cn62("min-w-0", fullWidth ? "flex w-full" : "inline-flex max-w-full"),
10047
+ ...rest,
10048
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
10049
+ "div",
10050
+ {
10051
+ ref: trackRef,
10052
+ role: "tablist",
10053
+ "aria-orientation": "horizontal",
10054
+ onKeyDown,
10055
+ className: cn62(
10056
+ "relative isolate inline-flex max-w-full items-center overflow-x-auto rounded-lg",
10057
+ frame[size],
10058
+ bare ? "bg-transparent" : "border border-hairline bg-canvas shadow-sm",
10059
+ fullWidth && "flex w-full",
10060
+ "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
10061
+ className
10062
+ ),
10063
+ children: [
10064
+ !bare ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10065
+ "span",
10066
+ {
10067
+ "aria-hidden": "true",
10068
+ className: cn62(
10069
+ "pointer-events-none absolute top-xxs bottom-xxs left-0 -z-10 bg-primary shadow-sm transition-[transform,width] duration-200 ease-out",
10070
+ pillRadius[size]
10071
+ ),
10072
+ style: pill ? { width: pill.width, transform: `translateX(${pill.offset}px)` } : { width: 0, opacity: 0 }
10073
+ }
10074
+ ) : null,
10075
+ items.map((item) => {
10076
+ const active = item.value === value;
10077
+ const iconOnly = Boolean(item.icon) && item.label == null;
10078
+ const glyphSize3 = size === "sm" ? 14 : 16;
10079
+ const pillFallback = !bare && active && !pill ? "bg-primary" : false;
10080
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10081
+ Button,
10082
+ {
10083
+ ref: (el) => {
10084
+ itemRefs.current[item.value] = el;
10085
+ },
10086
+ type: "button",
10087
+ role: "tab",
10088
+ "aria-selected": active,
10089
+ "aria-label": iconOnly ? item["aria-label"] ?? item.value : void 0,
10090
+ tabIndex: active || value === void 0 && item.value === firstEnabled ? 0 : -1,
10091
+ variant: bare ? active ? "primary" : "ghost" : "bare",
10092
+ size,
10093
+ iconOnly,
10094
+ disabled: item.disabled,
10095
+ onClick: () => onValueChange(item.value),
10096
+ className: cn62(segmentInteraction, pillFallback, fullWidth && "flex-1"),
10097
+ children: iconOnly ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Icon, { name: item.icon, size: glyphSize3 }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
10098
+ item.dotClassName ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10099
+ "span",
10100
+ {
10101
+ "aria-hidden": "true",
10102
+ className: cn62("h-2 w-2 shrink-0 rounded-full", item.dotClassName)
10103
+ }
10104
+ ) : null,
10105
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Icon, { name: item.icon, size: glyphSize3 }) : null,
10106
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "truncate", children: item.label }),
10107
+ item.count !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
10108
+ Badge,
10109
+ {
10110
+ size: "sm",
10111
+ tone: active ? "on-primary-solid" : "neutral",
10112
+ "aria-label": `${item.count} items`,
10113
+ className: "min-w-5 justify-center",
10114
+ children: item.count
10115
+ }
10116
+ ) : null
10117
+ ] })
10118
+ },
10119
+ item.value
10120
+ );
10121
+ })
10122
+ ]
10123
+ }
10124
+ )
10104
10125
  }
10105
- ) });
10126
+ );
10106
10127
  }
10107
10128
  );
10108
10129
  SegmentedControl.displayName = "SegmentedControl";
package/dist/index.js CHANGED
@@ -1714,7 +1714,8 @@ var TONE = {
1714
1714
  warning: "bg-semantic-warning-soft text-semantic-warning",
1715
1715
  error: "bg-semantic-error-soft text-semantic-error",
1716
1716
  info: "bg-semantic-info-soft text-semantic-info",
1717
- "on-primary": "bg-on-primary/20 text-on-primary"
1717
+ "on-primary": "bg-on-primary/20 text-on-primary",
1718
+ "on-primary-solid": "bg-on-primary text-primary"
1718
1719
  };
1719
1720
  var SIZE = {
1720
1721
  sm: "h-5 gap-xs rounded-sm px-xs text-caption",
@@ -9850,7 +9851,16 @@ var pillRadius = {
9850
9851
  md: "rounded-md"
9851
9852
  };
9852
9853
  var SegmentedControl = React83.forwardRef(
9853
- ({ items, value, onValueChange, size = "sm", bare = false, className, ...rest }, ref) => {
9854
+ ({
9855
+ items,
9856
+ value,
9857
+ onValueChange,
9858
+ size = "sm",
9859
+ bare = false,
9860
+ fullWidth = false,
9861
+ className,
9862
+ ...rest
9863
+ }, ref) => {
9854
9864
  const trackRef = React83.useRef(null);
9855
9865
  const itemRefs = React83.useRef({});
9856
9866
  const [pill, setPill] = React83.useState(null);
@@ -9885,80 +9895,91 @@ var SegmentedControl = React83.forwardRef(
9885
9895
  onValueChange(next.value);
9886
9896
  itemRefs.current[next.value]?.focus();
9887
9897
  };
9888
- return /* @__PURE__ */ jsx83("div", { ref, className: cn62("w-full", className), ...rest, children: /* @__PURE__ */ jsxs77(
9898
+ return /* @__PURE__ */ jsx83(
9889
9899
  "div",
9890
9900
  {
9891
- ref: trackRef,
9892
- role: "tablist",
9893
- "aria-orientation": "horizontal",
9894
- onKeyDown,
9895
- className: cn62(
9896
- "relative isolate inline-flex max-w-full items-center overflow-x-auto rounded-lg",
9897
- frame[size],
9898
- bare ? "bg-transparent" : "border border-hairline bg-canvas shadow-sm",
9899
- "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
9900
- ),
9901
- children: [
9902
- !bare ? /* @__PURE__ */ jsx83(
9903
- "span",
9904
- {
9905
- "aria-hidden": "true",
9906
- className: cn62(
9907
- "pointer-events-none absolute top-xxs bottom-xxs left-0 -z-10 bg-primary shadow-sm transition-[transform,width] duration-200 ease-out",
9908
- pillRadius[size]
9909
- ),
9910
- style: pill ? { width: pill.width, transform: `translateX(${pill.offset}px)` } : { width: 0, opacity: 0 }
9911
- }
9912
- ) : null,
9913
- items.map((item) => {
9914
- const active = item.value === value;
9915
- const iconOnly = Boolean(item.icon) && item.label == null;
9916
- const glyphSize3 = size === "sm" ? 14 : 16;
9917
- return /* @__PURE__ */ jsx83(
9918
- Button,
9919
- {
9920
- ref: (el) => {
9921
- itemRefs.current[item.value] = el;
9922
- },
9923
- type: "button",
9924
- role: "tab",
9925
- "aria-selected": active,
9926
- "aria-label": iconOnly ? item["aria-label"] ?? item.value : void 0,
9927
- tabIndex: active || value === void 0 && item.value === firstEnabled ? 0 : -1,
9928
- variant: bare ? active ? "primary" : "ghost" : "bare",
9929
- size,
9930
- iconOnly,
9931
- disabled: item.disabled,
9932
- onClick: () => onValueChange(item.value),
9933
- className: segmentInteraction,
9934
- children: iconOnly ? /* @__PURE__ */ jsx83(Icon, { name: item.icon, size: glyphSize3 }) : /* @__PURE__ */ jsxs77("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
9935
- item.dotClassName ? /* @__PURE__ */ jsx83(
9936
- "span",
9937
- {
9938
- "aria-hidden": "true",
9939
- className: cn62("h-2 w-2 shrink-0 rounded-full", item.dotClassName)
9940
- }
9941
- ) : null,
9942
- item.icon ? /* @__PURE__ */ jsx83(Icon, { name: item.icon, size: glyphSize3 }) : null,
9943
- /* @__PURE__ */ jsx83("span", { className: "truncate", children: item.label }),
9944
- item.count !== void 0 ? /* @__PURE__ */ jsx83(
9945
- Badge,
9946
- {
9947
- size: "sm",
9948
- tone: active ? "on-primary" : "neutral",
9949
- "aria-label": `${item.count} items`,
9950
- className: "min-w-5 justify-center",
9951
- children: item.count
9952
- }
9953
- ) : null
9954
- ] })
9955
- },
9956
- item.value
9957
- );
9958
- })
9959
- ]
9901
+ ref,
9902
+ className: cn62("min-w-0", fullWidth ? "flex w-full" : "inline-flex max-w-full"),
9903
+ ...rest,
9904
+ children: /* @__PURE__ */ jsxs77(
9905
+ "div",
9906
+ {
9907
+ ref: trackRef,
9908
+ role: "tablist",
9909
+ "aria-orientation": "horizontal",
9910
+ onKeyDown,
9911
+ className: cn62(
9912
+ "relative isolate inline-flex max-w-full items-center overflow-x-auto rounded-lg",
9913
+ frame[size],
9914
+ bare ? "bg-transparent" : "border border-hairline bg-canvas shadow-sm",
9915
+ fullWidth && "flex w-full",
9916
+ "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
9917
+ className
9918
+ ),
9919
+ children: [
9920
+ !bare ? /* @__PURE__ */ jsx83(
9921
+ "span",
9922
+ {
9923
+ "aria-hidden": "true",
9924
+ className: cn62(
9925
+ "pointer-events-none absolute top-xxs bottom-xxs left-0 -z-10 bg-primary shadow-sm transition-[transform,width] duration-200 ease-out",
9926
+ pillRadius[size]
9927
+ ),
9928
+ style: pill ? { width: pill.width, transform: `translateX(${pill.offset}px)` } : { width: 0, opacity: 0 }
9929
+ }
9930
+ ) : null,
9931
+ items.map((item) => {
9932
+ const active = item.value === value;
9933
+ const iconOnly = Boolean(item.icon) && item.label == null;
9934
+ const glyphSize3 = size === "sm" ? 14 : 16;
9935
+ const pillFallback = !bare && active && !pill ? "bg-primary" : false;
9936
+ return /* @__PURE__ */ jsx83(
9937
+ Button,
9938
+ {
9939
+ ref: (el) => {
9940
+ itemRefs.current[item.value] = el;
9941
+ },
9942
+ type: "button",
9943
+ role: "tab",
9944
+ "aria-selected": active,
9945
+ "aria-label": iconOnly ? item["aria-label"] ?? item.value : void 0,
9946
+ tabIndex: active || value === void 0 && item.value === firstEnabled ? 0 : -1,
9947
+ variant: bare ? active ? "primary" : "ghost" : "bare",
9948
+ size,
9949
+ iconOnly,
9950
+ disabled: item.disabled,
9951
+ onClick: () => onValueChange(item.value),
9952
+ className: cn62(segmentInteraction, pillFallback, fullWidth && "flex-1"),
9953
+ children: iconOnly ? /* @__PURE__ */ jsx83(Icon, { name: item.icon, size: glyphSize3 }) : /* @__PURE__ */ jsxs77("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
9954
+ item.dotClassName ? /* @__PURE__ */ jsx83(
9955
+ "span",
9956
+ {
9957
+ "aria-hidden": "true",
9958
+ className: cn62("h-2 w-2 shrink-0 rounded-full", item.dotClassName)
9959
+ }
9960
+ ) : null,
9961
+ item.icon ? /* @__PURE__ */ jsx83(Icon, { name: item.icon, size: glyphSize3 }) : null,
9962
+ /* @__PURE__ */ jsx83("span", { className: "truncate", children: item.label }),
9963
+ item.count !== void 0 ? /* @__PURE__ */ jsx83(
9964
+ Badge,
9965
+ {
9966
+ size: "sm",
9967
+ tone: active ? "on-primary-solid" : "neutral",
9968
+ "aria-label": `${item.count} items`,
9969
+ className: "min-w-5 justify-center",
9970
+ children: item.count
9971
+ }
9972
+ ) : null
9973
+ ] })
9974
+ },
9975
+ item.value
9976
+ );
9977
+ })
9978
+ ]
9979
+ }
9980
+ )
9960
9981
  }
9961
- ) });
9982
+ );
9962
9983
  }
9963
9984
  );
9964
9985
  SegmentedControl.displayName = "SegmentedControl";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designa8/vibedesign-linear-internal-v1-b737",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
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",
@@ -6,6 +6,8 @@ import type { IconProps } from "../Icon";
6
6
  * `on-primary` keeps a count legible when the badge sits on a solid primary
7
7
  * fill (e.g. the active segment of a segmented control): it inverts to
8
8
  * `on-primary` text over a translucent `on-primary` tint.
9
+ * `on-primary-solid` is the high-contrast companion for small caption text on
10
+ * that same fill: a solid `on-primary` chip with `primary` text.
9
11
  */
10
12
  export type BadgeTone =
11
13
  | "neutral"
@@ -14,7 +16,8 @@ export type BadgeTone =
14
16
  | "warning"
15
17
  | "error"
16
18
  | "info"
17
- | "on-primary";
19
+ | "on-primary"
20
+ | "on-primary-solid";
18
21
  export type BadgeSize = "sm" | "md" | "lg";
19
22
 
20
23
  export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
@@ -32,6 +35,7 @@ const TONE: Record<BadgeTone, string> = {
32
35
  error: "bg-semantic-error-soft text-semantic-error",
33
36
  info: "bg-semantic-info-soft text-semantic-info",
34
37
  "on-primary": "bg-on-primary/20 text-on-primary",
38
+ "on-primary-solid": "bg-on-primary text-primary",
35
39
  };
36
40
 
37
41
  const SIZE: Record<BadgeSize, string> = {
@@ -19,7 +19,7 @@ export interface SegmentedControlItem {
19
19
  }
20
20
 
21
21
  export interface SegmentedControlProps
22
- extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
22
+ extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "className"> {
23
23
  items: SegmentedControlItem[];
24
24
  /** Selected value. Pass `undefined` for "no segment selected". */
25
25
  value: string | undefined;
@@ -27,6 +27,13 @@ export interface SegmentedControlProps
27
27
  size?: "sm" | "md";
28
28
  /** Drop the frame (border, surface, shadow), e.g. when nested in a toolbar. */
29
29
  bare?: boolean;
30
+ /**
31
+ * Stretch the control to the full width of its container and share the space
32
+ * between segments. Defaults to `false`, which sizes the control to content.
33
+ */
34
+ fullWidth?: boolean;
35
+ /** Lands on the tablist itself, so consumers can shape it without a wrapper. */
36
+ className?: string;
30
37
  }
31
38
 
32
39
  const cn = (...parts: Array<string | false | null | undefined>) =>
@@ -54,9 +61,25 @@ const pillRadius: Record<"sm" | "md", string> = {
54
61
  * A compact segmented control: one framed surface, a single primary indicator
55
62
  * that slides between segments, and segments that only report the chosen value
56
63
  * (`onValueChange`) — no panels, unlike Tabs.
64
+ *
65
+ * The active segment carries a `bg-primary` fallback that the sliding pill
66
+ * replaces once it is measured, so the on-primary label never renders
67
+ * invisible on first paint.
57
68
  */
58
69
  export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(
59
- ({ items, value, onValueChange, size = "sm", bare = false, className, ...rest }, ref) => {
70
+ (
71
+ {
72
+ items,
73
+ value,
74
+ onValueChange,
75
+ size = "sm",
76
+ bare = false,
77
+ fullWidth = false,
78
+ className,
79
+ ...rest
80
+ },
81
+ ref,
82
+ ) => {
60
83
  const trackRef = React.useRef<HTMLDivElement | null>(null);
61
84
  const itemRefs = React.useRef<Record<string, HTMLButtonElement | null>>({});
62
85
  const [pill, setPill] = React.useState<{ offset: number; width: number } | null>(null);
@@ -96,7 +119,11 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
96
119
  };
97
120
 
98
121
  return (
99
- <div ref={ref} className={cn("w-full", className)} {...rest}>
122
+ <div
123
+ ref={ref}
124
+ className={cn("min-w-0", fullWidth ? "flex w-full" : "inline-flex max-w-full")}
125
+ {...rest}
126
+ >
100
127
  <div
101
128
  ref={trackRef}
102
129
  role="tablist"
@@ -106,7 +133,9 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
106
133
  "relative isolate inline-flex max-w-full items-center overflow-x-auto rounded-lg",
107
134
  frame[size],
108
135
  bare ? "bg-transparent" : "border border-hairline bg-canvas shadow-sm",
136
+ fullWidth && "flex w-full",
109
137
  "[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
138
+ className,
110
139
  )}
111
140
  >
112
141
  {!bare ? (
@@ -128,6 +157,12 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
128
157
  const active = item.value === value;
129
158
  const iconOnly = Boolean(item.icon) && item.label == null;
130
159
  const glyphSize = size === "sm" ? 14 : 16;
160
+ /**
161
+ * Until the sliding pill is measured (first paint, before the
162
+ * layout effect runs) the active segment paints its own primary
163
+ * fill, so `on-primary` text is never invisible on `canvas`.
164
+ */
165
+ const pillFallback = !bare && active && !pill ? "bg-primary" : false;
131
166
  return (
132
167
  <Button
133
168
  key={item.value}
@@ -144,7 +179,7 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
144
179
  iconOnly={iconOnly}
145
180
  disabled={item.disabled}
146
181
  onClick={() => onValueChange(item.value)}
147
- className={segmentInteraction}
182
+ className={cn(segmentInteraction, pillFallback, fullWidth && "flex-1")}
148
183
  >
149
184
  {iconOnly ? (
150
185
  <Icon name={item.icon!} size={glyphSize} />
@@ -161,7 +196,7 @@ export const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedContro
161
196
  {item.count !== undefined ? (
162
197
  <Badge
163
198
  size="sm"
164
- tone={active ? "on-primary" : "neutral"}
199
+ tone={active ? "on-primary-solid" : "neutral"}
165
200
  aria-label={`${item.count} items`}
166
201
  className="min-w-5 justify-center"
167
202
  >
@@ -21,11 +21,18 @@ const STATE_ITEMS: SegmentedControlItem[] = [
21
21
  { value: "archived", label: "Archived", disabled: true },
22
22
  ];
23
23
 
24
+ const RANGE_ITEMS: SegmentedControlItem[] = [
25
+ { value: "day", label: "Day" },
26
+ { value: "week", label: "Week" },
27
+ { value: "month", label: "Month" },
28
+ ];
29
+
24
30
  export default function SegmentedControlPreview() {
25
31
  const [kind, setKind] = React.useState("all");
26
32
  const [viewport, setViewport] = React.useState("desktop");
27
33
  const [state, setState] = React.useState("review");
28
34
  const [toolbarView, setToolbarView] = React.useState("grid");
35
+ const [range, setRange] = React.useState("week");
29
36
 
30
37
  return (
31
38
  <div className="w-full max-w-3xl mx-auto space-y-xl p-lg">
@@ -64,6 +71,20 @@ export default function SegmentedControlPreview() {
64
71
  />
65
72
  </section>
66
73
 
74
+ <section className="space-y-sm">
75
+ <p className="text-caption text-muted">
76
+ Full width — segments share the available space
77
+ </p>
78
+ <SegmentedControl
79
+ items={RANGE_ITEMS}
80
+ value={range}
81
+ onValueChange={setRange}
82
+ size="md"
83
+ fullWidth
84
+ aria-label="Range"
85
+ />
86
+ </section>
87
+
67
88
  <section className="space-y-sm">
68
89
  <p className="text-caption text-muted">Bare — nested inside a toolbar row</p>
69
90
  <div className="space-y-xs rounded-lg border border-hairline bg-surface-soft p-sm">