@fanvue/ui 3.25.0 → 3.26.0

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.
Files changed (70) hide show
  1. package/dist/cjs/components/Accordion/AccordionTrigger.cjs +1 -1
  2. package/dist/cjs/components/Accordion/AccordionTrigger.cjs.map +1 -1
  3. package/dist/cjs/components/AiButton/AiButton.cjs +2 -2
  4. package/dist/cjs/components/AiButton/AiButton.cjs.map +1 -1
  5. package/dist/cjs/components/AiDisclosureBadge/AiDisclosureBadge.cjs +65 -0
  6. package/dist/cjs/components/AiDisclosureBadge/AiDisclosureBadge.cjs.map +1 -0
  7. package/dist/cjs/components/AiDisclosureLabel/AiDisclosureLabel.cjs +72 -0
  8. package/dist/cjs/components/AiDisclosureLabel/AiDisclosureLabel.cjs.map +1 -0
  9. package/dist/cjs/components/Alert/Alert.cjs +1 -1
  10. package/dist/cjs/components/Alert/Alert.cjs.map +1 -1
  11. package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs +1 -1
  12. package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs.map +1 -1
  13. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +4 -4
  14. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
  15. package/dist/cjs/components/EmptyState/EmptyState.cjs +2 -2
  16. package/dist/cjs/components/EmptyState/EmptyState.cjs.map +1 -1
  17. package/dist/cjs/components/Icons/AiSettingsIcon.cjs +92 -0
  18. package/dist/cjs/components/Icons/AiSettingsIcon.cjs.map +1 -0
  19. package/dist/cjs/components/Icons/ProgrammingArrowIcon.cjs +139 -0
  20. package/dist/cjs/components/Icons/ProgrammingArrowIcon.cjs.map +1 -0
  21. package/dist/cjs/components/Icons/RefreshArrowIcon.cjs +61 -0
  22. package/dist/cjs/components/Icons/RefreshArrowIcon.cjs.map +1 -0
  23. package/dist/cjs/components/Logo/Logo.cjs +1 -1
  24. package/dist/cjs/components/Logo/Logo.cjs.map +1 -1
  25. package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs +169 -32
  26. package/dist/cjs/components/SegmentedControl/SegmentedControl.cjs.map +1 -1
  27. package/dist/cjs/components/Slider/SliderLayout.cjs +1 -1
  28. package/dist/cjs/components/Slider/SliderLayout.cjs.map +1 -1
  29. package/dist/cjs/components/Table/Table.cjs +2 -2
  30. package/dist/cjs/components/Table/Table.cjs.map +1 -1
  31. package/dist/cjs/components/UserDisplayName/UserDisplayName.cjs +1 -1
  32. package/dist/cjs/components/UserDisplayName/UserDisplayName.cjs.map +1 -1
  33. package/dist/cjs/index.cjs +10 -0
  34. package/dist/cjs/index.cjs.map +1 -1
  35. package/dist/components/Accordion/AccordionTrigger.mjs +1 -1
  36. package/dist/components/Accordion/AccordionTrigger.mjs.map +1 -1
  37. package/dist/components/AiButton/AiButton.mjs +2 -2
  38. package/dist/components/AiButton/AiButton.mjs.map +1 -1
  39. package/dist/components/AiDisclosureBadge/AiDisclosureBadge.mjs +48 -0
  40. package/dist/components/AiDisclosureBadge/AiDisclosureBadge.mjs.map +1 -0
  41. package/dist/components/AiDisclosureLabel/AiDisclosureLabel.mjs +55 -0
  42. package/dist/components/AiDisclosureLabel/AiDisclosureLabel.mjs.map +1 -0
  43. package/dist/components/Alert/Alert.mjs +1 -1
  44. package/dist/components/Alert/Alert.mjs.map +1 -1
  45. package/dist/components/BottomNavigation/BottomNavigation.mjs +1 -1
  46. package/dist/components/BottomNavigation/BottomNavigation.mjs.map +1 -1
  47. package/dist/components/DropdownMenu/DropdownMenu.mjs +4 -4
  48. package/dist/components/DropdownMenu/DropdownMenu.mjs.map +1 -1
  49. package/dist/components/EmptyState/EmptyState.mjs +2 -2
  50. package/dist/components/EmptyState/EmptyState.mjs.map +1 -1
  51. package/dist/components/Icons/AiSettingsIcon.mjs +75 -0
  52. package/dist/components/Icons/AiSettingsIcon.mjs.map +1 -0
  53. package/dist/components/Icons/ProgrammingArrowIcon.mjs +122 -0
  54. package/dist/components/Icons/ProgrammingArrowIcon.mjs.map +1 -0
  55. package/dist/components/Icons/RefreshArrowIcon.mjs +44 -0
  56. package/dist/components/Icons/RefreshArrowIcon.mjs.map +1 -0
  57. package/dist/components/Logo/Logo.mjs +1 -1
  58. package/dist/components/Logo/Logo.mjs.map +1 -1
  59. package/dist/components/SegmentedControl/SegmentedControl.mjs +170 -33
  60. package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  61. package/dist/components/Slider/SliderLayout.mjs +1 -1
  62. package/dist/components/Slider/SliderLayout.mjs.map +1 -1
  63. package/dist/components/Table/Table.mjs +2 -2
  64. package/dist/components/Table/Table.mjs.map +1 -1
  65. package/dist/components/UserDisplayName/UserDisplayName.mjs +1 -1
  66. package/dist/components/UserDisplayName/UserDisplayName.mjs.map +1 -1
  67. package/dist/index.d.ts +127 -2
  68. package/dist/index.mjs +10 -0
  69. package/dist/index.mjs.map +1 -1
  70. package/package.json +7 -5
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { cn } from "../../utils/cn.mjs";
5
5
  const sizeClasses = {
@@ -27,6 +27,19 @@ function warnMissingOptionAccessibleName(options) {
27
27
  }
28
28
  }
29
29
  }
30
+ function warnUnsupportedCollapsible(appearance, options) {
31
+ if (process.env.NODE_ENV !== "production") {
32
+ if (appearance === "pill") {
33
+ console.warn(
34
+ 'SegmentedControl: `collapsible` is only supported for the "plain" and "brand" appearances; ignoring it.'
35
+ );
36
+ } else if (!options.every((option) => option.icon)) {
37
+ console.warn(
38
+ "SegmentedControl: `collapsible` requires every option to define an `icon`; ignoring it."
39
+ );
40
+ }
41
+ }
42
+ }
30
43
  function getSegmentClassName({
31
44
  appearance,
32
45
  size,
@@ -57,6 +70,56 @@ function getSegmentClassName({
57
70
  disabled && "pointer-events-none"
58
71
  );
59
72
  }
73
+ const collapsedPaddingClasses = {
74
+ "32": "p-1",
75
+ "40": "p-2",
76
+ "48": "p-3"
77
+ };
78
+ function getCollapsedButtonClassName({
79
+ appearance,
80
+ size,
81
+ disabled
82
+ }) {
83
+ return cn(
84
+ "relative inline-flex aspect-square shrink-0 cursor-pointer items-center justify-center rounded-full",
85
+ "motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out",
86
+ "focus-visible:shadow-focus-ring focus-visible:outline-none",
87
+ appearance === "plain" ? (
88
+ // Glyph-only: no pill, just the selected icon colour. The negative margin keeps the visual
89
+ // footprint icon-sized while the padding enlarges the hit target.
90
+ "-m-1 p-1 text-icons-primary"
91
+ ) : cn(
92
+ collapsedPaddingClasses[size],
93
+ "bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default"
94
+ ),
95
+ disabled && "pointer-events-none"
96
+ );
97
+ }
98
+ function useAutoCollapse(rootRef, measureRef, enabled) {
99
+ const [collapsed, setCollapsed] = React.useState(false);
100
+ React.useEffect(() => {
101
+ if (!enabled) {
102
+ setCollapsed(false);
103
+ return;
104
+ }
105
+ const root = rootRef.current;
106
+ const measure = measureRef.current;
107
+ const parent = root?.parentElement;
108
+ if (!root || !measure || !parent) return;
109
+ const evaluate = () => {
110
+ const available = parent.getBoundingClientRect().width;
111
+ const required = measure.getBoundingClientRect().width;
112
+ if (available <= 0 || required <= 0) return;
113
+ setCollapsed(required > available);
114
+ };
115
+ evaluate();
116
+ const observer = new ResizeObserver(evaluate);
117
+ observer.observe(parent);
118
+ observer.observe(measure);
119
+ return () => observer.disconnect();
120
+ }, [enabled, rootRef, measureRef]);
121
+ return enabled && collapsed;
122
+ }
60
123
  const SegmentedControl = React.forwardRef(
61
124
  ({
62
125
  className,
@@ -68,15 +131,29 @@ const SegmentedControl = React.forwardRef(
68
131
  defaultValue,
69
132
  onChange,
70
133
  disabled = false,
134
+ collapsible = false,
71
135
  ...props
72
136
  }, ref) => {
73
137
  warnMissingAccessibleName(props["aria-label"], props["aria-labelledby"]);
74
138
  warnMissingOptionAccessibleName(options);
139
+ if (collapsible) warnUnsupportedCollapsible(appearance, options);
75
140
  const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);
76
141
  const isControlled = controlledValue !== void 0;
77
142
  const currentValue = isControlled ? controlledValue : internalValue;
78
143
  const anySelected = options.some((o) => o.value === currentValue);
79
144
  const buttonRefs = React.useRef([]);
145
+ const canCollapse = collapsible && (appearance === "plain" || appearance === "brand") && options.every((option) => option.icon);
146
+ const rootRef = React.useRef(null);
147
+ const measureRef = React.useRef(null);
148
+ const setRootRef = React.useCallback(
149
+ (node) => {
150
+ rootRef.current = node;
151
+ if (typeof ref === "function") ref(node);
152
+ else if (ref) ref.current = node;
153
+ },
154
+ [ref]
155
+ );
156
+ const isCollapsed = useAutoCollapse(rootRef, measureRef, canCollapse);
80
157
  const handleSelect = (optionValue) => {
81
158
  if (disabled || optionValue === currentValue) return;
82
159
  if (!isControlled) {
@@ -92,11 +169,72 @@ const SegmentedControl = React.forwardRef(
92
169
  handleSelect(nextOption.value);
93
170
  buttonRefs.current[nextIndex]?.focus();
94
171
  };
95
- return /* @__PURE__ */ jsx(
172
+ const renderSegment = (option, index) => {
173
+ const isSelected = currentValue === option.value;
174
+ const showLabelText = appearance === "brand" || !option.icon;
175
+ return (
176
+ // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation
177
+ /* @__PURE__ */ jsxs(
178
+ "button",
179
+ {
180
+ ref: (el) => {
181
+ buttonRefs.current[index] = el;
182
+ },
183
+ type: "button",
184
+ role: "radio",
185
+ "aria-checked": isSelected,
186
+ tabIndex: isSelected || !anySelected && index === 0 ? 0 : -1,
187
+ disabled,
188
+ "aria-label": showLabelText ? void 0 : option.label,
189
+ onClick: () => handleSelect(option.value),
190
+ onKeyDown: (e) => handleKeyDown(e, index),
191
+ className: getSegmentClassName({ appearance, size, variant, isSelected, disabled }),
192
+ children: [
193
+ option.icon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center justify-center", "aria-hidden": "true", children: option.icon }),
194
+ showLabelText && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
195
+ ]
196
+ },
197
+ option.value
198
+ )
199
+ );
200
+ };
201
+ const renderMeasureSegment = (option) => {
202
+ const showLabelText = appearance === "brand" || !option.icon;
203
+ return /* @__PURE__ */ jsxs(
204
+ "button",
205
+ {
206
+ type: "button",
207
+ disabled: true,
208
+ "aria-hidden": "true",
209
+ tabIndex: -1,
210
+ className: getSegmentClassName({
211
+ appearance,
212
+ size,
213
+ variant: "hug",
214
+ isSelected: currentValue === option.value,
215
+ disabled
216
+ }),
217
+ children: [
218
+ option.icon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center justify-center", "aria-hidden": "true", children: option.icon }),
219
+ showLabelText && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
220
+ ]
221
+ },
222
+ option.value
223
+ );
224
+ };
225
+ const selectedIndex = options.findIndex((option) => option.value === currentValue);
226
+ const selectedOption = options[selectedIndex] ?? options[0];
227
+ const handleCycle = () => {
228
+ if (disabled || options.length === 0) return;
229
+ const from = selectedIndex < 0 ? 0 : selectedIndex;
230
+ const nextOption = options[(from + 1) % options.length];
231
+ handleSelect(nextOption.value);
232
+ };
233
+ return /* @__PURE__ */ jsxs(
96
234
  "div",
97
235
  {
98
- ref,
99
- role: "radiogroup",
236
+ ref: setRootRef,
237
+ role: isCollapsed ? "group" : "radiogroup",
100
238
  className: cn(
101
239
  "relative items-center rounded-full",
102
240
  variant === "fill" ? "flex w-full" : "inline-flex",
@@ -105,35 +243,34 @@ const SegmentedControl = React.forwardRef(
105
243
  className
106
244
  ),
107
245
  ...props,
108
- children: options.map((option, index) => {
109
- const isSelected = currentValue === option.value;
110
- const showLabelText = appearance === "brand" || !option.icon;
111
- return (
112
- // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation
113
- /* @__PURE__ */ jsxs(
114
- "button",
115
- {
116
- ref: (el) => {
117
- buttonRefs.current[index] = el;
118
- },
119
- type: "button",
120
- role: "radio",
121
- "aria-checked": isSelected,
122
- tabIndex: isSelected || !anySelected && index === 0 ? 0 : -1,
123
- disabled,
124
- "aria-label": showLabelText ? void 0 : option.label,
125
- onClick: () => handleSelect(option.value),
126
- onKeyDown: (e) => handleKeyDown(e, index),
127
- className: getSegmentClassName({ appearance, size, variant, isSelected, disabled }),
128
- children: [
129
- option.icon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center justify-center", "aria-hidden": "true", children: option.icon }),
130
- showLabelText && /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
131
- ]
132
- },
133
- option.value
134
- )
135
- );
136
- })
246
+ children: [
247
+ isCollapsed && selectedOption ? /* @__PURE__ */ jsx(
248
+ "button",
249
+ {
250
+ type: "button",
251
+ disabled,
252
+ "aria-label": selectedOption.label,
253
+ onClick: handleCycle,
254
+ className: getCollapsedButtonClassName({ appearance, size, disabled }),
255
+ children: selectedOption.icon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center justify-center", "aria-hidden": "true", children: selectedOption.icon })
256
+ }
257
+ ) : options.map((option, index) => renderSegment(option, index)),
258
+ canCollapse && // Off-screen replica of the fully expanded control. Kept in the DOM (out of flow, hidden
259
+ // from AT and tab order) so its natural width is always measurable, whether the visible
260
+ // control is currently expanded or collapsed.
261
+ /* @__PURE__ */ jsx(
262
+ "div",
263
+ {
264
+ ref: measureRef,
265
+ "aria-hidden": "true",
266
+ className: cn(
267
+ "pointer-events-none invisible absolute top-0 left-0 -z-10 flex items-center whitespace-nowrap rounded-full",
268
+ appearance === "plain" ? "gap-2" : "bg-surface-tertiary p-1"
269
+ ),
270
+ children: options.map((option) => renderMeasureSegment(option))
271
+ }
272
+ )
273
+ ]
137
274
  }
138
275
  );
139
276
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl.mjs","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the segmented control in pixels. */\nexport type SegmentedControlSize = \"32\" | \"40\" | \"48\";\n\n/**\n * Segment layout.\n * - `\"hug\"`: each segment is sized to its content.\n * - `\"fill\"`: the control spans the full width of its container and each segment grows equally.\n */\nexport type SegmentedControlVariant = \"hug\" | \"fill\";\n\n/**\n * Visual style of the control.\n * - `\"pill\"`: the container has a muted background and the selected segment shows a filled pill (default).\n * - `\"plain\"`: no container or selected-pill background; segments are bare content and selection is\n * communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).\n * - `\"brand\"`: like `\"pill\"`, but segments render their `icon` alongside the visible `label` and the\n * selected segment uses the brand-green pill. Designed for prominent toggles such as the\n * Home/Agent navigation switch.\n */\nexport type SegmentedControlAppearance = \"pill\" | \"plain\" | \"brand\";\n\n/** Describes one selectable segment. */\nexport interface SegmentedControlOption {\n /**\n * Display label for the segment. In `pill`/`plain` appearances, when `icon` is provided the\n * segment renders icon-only and this value becomes its accessible name (applied as `aria-label`)\n * instead of visible text. In the `brand` appearance the label is always rendered as visible text\n * (alongside the icon when present).\n */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n /**\n * Icon to render for the segment. In `pill`/`plain` appearances the segment renders icon-only and\n * `label` becomes required as its accessible name (applied as `aria-label`, no visible text). In\n * the `brand` appearance the icon renders alongside the visible `label`.\n */\n icon?: React.ReactNode;\n}\n\nexport interface SegmentedControlProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the control in pixels. @default \"32\" */\n size?: SegmentedControlSize;\n /** Segment layout. @default \"hug\" */\n variant?: SegmentedControlVariant;\n /** Visual style of the control. @default \"pill\" */\n appearance?: SegmentedControlAppearance;\n /** The selectable segments. Designed for two or three mutually exclusive options. */\n options: SegmentedControlOption[];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). Defaults to the first option. */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the control is disabled. @default false */\n disabled?: boolean;\n}\n\n/** Padding and typography per size. Combined with the container's `p-1` these hit the 32/40/48px heights. */\nconst sizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"px-2 py-1 typography-description-12px-semibold\",\n \"40\": \"px-3 py-1.75 typography-body-small-14px-semibold\",\n \"48\": \"px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SegmentedControl: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction warnMissingOptionAccessibleName(options: SegmentedControlOption[]) {\n if (process.env.NODE_ENV !== \"production\") {\n for (const option of options) {\n if (option.icon && !option.label?.trim()) {\n console.warn(\n `SegmentedControl: icon-only segment \"${option.value}\" is missing a non-empty \\`label\\` to use as its accessible name.`,\n );\n }\n }\n }\n}\n\nfunction getSegmentClassName({\n appearance,\n size,\n variant,\n isSelected,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n variant: SegmentedControlVariant;\n isSelected: boolean;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex min-w-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n variant === \"fill\" ? \"flex-1\" : \"shrink-0\",\n appearance === \"plain\"\n ? cn(\n // Padding + negative margin enlarge the hit target without changing the\n // visual footprint, which must stay glyph-only to match the design.\n \"-m-1 p-1\",\n isSelected ? \"text-icons-primary\" : \"text-icons-tertiary hover:text-icons-primary\",\n )\n : cn(\n sizeClasses[size],\n // brand renders icon + label together, so space them.\n appearance === \"brand\" && \"gap-1.5\",\n isSelected\n ? appearance === \"brand\"\n ? // Approximate brand-green pill using existing tokens; exact colours pending\n // dedicated navigation tokens (see ENG follow-up).\n \"bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default\"\n : \"bg-buttons-primary-default text-content-primary-inverted shadow-sm\"\n : \"text-content-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * A compact selector for choosing between two or three mutually exclusive\n * options where the choice affects the content immediately below it. Use\n * instead of tabs when the options are more like settings or filters than\n * navigation, such as toggling a list/grid view or a monthly/annual price.\n *\n * Rendered as a `radiogroup` with roving-tabindex keyboard navigation. Supports\n * both controlled and uncontrolled usage.\n *\n * @example\n * ```tsx\n * <SegmentedControl\n * options={[\n * { label: \"Net\", value: \"net\" },\n * { label: \"Gross\", value: \"gross\" },\n * ]}\n * value={amount}\n * onChange={setAmount}\n * aria-label=\"Amount type\"\n * />\n * ```\n *\n * @example Icon-only segments (e.g. a list/grid view toggle)\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example Icon + label with the brand-green pill (e.g. the Home/Agent nav switch)\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} /> },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n */\nexport const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n size = \"32\",\n variant = \"hug\",\n appearance = \"pill\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n warnMissingOptionAccessibleName(options);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n const handleSelect = (optionValue: string) => {\n if (disabled || optionValue === currentValue) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n const nextIndex =\n e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n ? (index + 1) % options.length\n : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n ? (index - 1 + options.length) % options.length\n : null;\n if (nextIndex === null) return;\n e.preventDefault();\n const nextOption = options[nextIndex] as SegmentedControlOption;\n handleSelect(nextOption.value);\n buttonRefs.current[nextIndex]?.focus();\n };\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n className={cn(\n \"relative items-center rounded-full\",\n variant === \"fill\" ? \"flex w-full\" : \"inline-flex\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n {options.map((option, index) => {\n const isSelected = currentValue === option.value;\n // `brand` shows the label as visible text (with the icon); `pill`/`plain` render\n // icon-only when an icon is given, falling back to the label otherwise.\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation\n <button\n key={option.value}\n ref={(el) => {\n buttonRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n tabIndex={isSelected || (!anySelected && index === 0) ? 0 : -1}\n disabled={disabled}\n aria-label={showLabelText ? undefined : option.label}\n onClick={() => handleSelect(option.value)}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={getSegmentClassName({ appearance, size, variant, isSelected, disabled })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n })}\n </div>\n );\n },\n);\n\nSegmentedControl.displayName = \"SegmentedControl\";\n"],"names":[],"mappings":";;;;AAgEA,MAAM,cAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,WAAoB,gBAAyB;AAC9E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,aAAa,CAAC,gBAAgB;AACjC,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,gCAAgC,SAAmC;AAC1E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,eAAW,UAAU,SAAS;AAC5B,UAAI,OAAO,QAAQ,CAAC,OAAO,OAAO,QAAQ;AACxC,gBAAQ;AAAA,UACN,wCAAwC,OAAO,KAAK;AAAA,QAAA;AAAA,MAExD;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,SAAS,WAAW;AAAA,IAChC,eAAe,UACX;AAAA;AAAA;AAAA,MAGE;AAAA,MACA,aAAa,uBAAuB;AAAA,IAAA,IAEtC;AAAA,MACE,YAAY,IAAI;AAAA;AAAA,MAEhB,eAAe,WAAW;AAAA,MAC1B,aACI,eAAe;AAAA;AAAA;AAAA,QAGb;AAAA,UACA,uEACF;AAAA,IAAA;AAAA,IAEV,YAAY;AAAA,EAAA;AAEhB;AAoDO,MAAM,mBAAmB,MAA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AEH,UAAA,QAAQ,IAAI,CAAC,QAAQ,UAAU;AAC9B,gBAAM,aAAa,iBAAiB,OAAO;AAG3C,gBAAM,gBAAgB,eAAe,WAAW,CAAC,OAAO;AACxD;AAAA;AAAA,YAEE;AAAA,cAAC;AAAA,cAAA;AAAA,gBAEC,KAAK,CAAC,OAAO;AACX,6BAAW,QAAQ,KAAK,IAAI;AAAA,gBAC9B;AAAA,gBACA,MAAK;AAAA,gBACL,MAAK;AAAA,gBACL,gBAAc;AAAA,gBACd,UAAU,cAAe,CAAC,eAAe,UAAU,IAAK,IAAI;AAAA,gBAC5D;AAAA,gBACA,cAAY,gBAAgB,SAAY,OAAO;AAAA,gBAC/C,SAAS,MAAM,aAAa,OAAO,KAAK;AAAA,gBACxC,WAAW,CAAC,MAAM,cAAc,GAAG,KAAK;AAAA,gBACxC,WAAW,oBAAoB,EAAE,YAAY,MAAM,SAAS,YAAY,UAAU;AAAA,gBAEjF,UAAA;AAAA,kBAAA,OAAO,4BACL,QAAA,EAAK,WAAU,6CAA4C,eAAY,QACrE,iBAAO,KAAA,CACV;AAAA,kBAED,iBAAiB,oBAAC,QAAA,EAAK,WAAU,oBAAoB,iBAAO,MAAA,CAAM;AAAA,gBAAA;AAAA,cAAA;AAAA,cAnB9D,OAAO;AAAA,YAAA;AAAA;AAAA,QAsBlB,CAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,iBAAiB,cAAc;"}
1
+ {"version":3,"file":"SegmentedControl.mjs","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the segmented control in pixels. */\nexport type SegmentedControlSize = \"32\" | \"40\" | \"48\";\n\n/**\n * Segment layout.\n * - `\"hug\"`: each segment is sized to its content.\n * - `\"fill\"`: the control spans the full width of its container and each segment grows equally.\n */\nexport type SegmentedControlVariant = \"hug\" | \"fill\";\n\n/**\n * Visual style of the control.\n * - `\"pill\"`: the container has a muted background and the selected segment shows a filled pill (default).\n * - `\"plain\"`: no container or selected-pill background; segments are bare content and selection is\n * communicated by color alone. Designed for icon-only toggles (e.g. a list/grid view switch).\n * - `\"brand\"`: like `\"pill\"`, but segments render their `icon` alongside the visible `label` and the\n * selected segment uses the brand-green pill. Designed for prominent toggles such as the\n * Home/Agent navigation switch.\n */\nexport type SegmentedControlAppearance = \"pill\" | \"plain\" | \"brand\";\n\n/** Describes one selectable segment. */\nexport interface SegmentedControlOption {\n /**\n * Display label for the segment. In `pill`/`plain` appearances, when `icon` is provided the\n * segment renders icon-only and this value becomes its accessible name (applied as `aria-label`)\n * instead of visible text. In the `brand` appearance the label is always rendered as visible text\n * (alongside the icon when present).\n */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n /**\n * Icon to render for the segment. In `pill`/`plain` appearances the segment renders icon-only and\n * `label` becomes required as its accessible name (applied as `aria-label`, no visible text). In\n * the `brand` appearance the icon renders alongside the visible `label`. Required for every option\n * when `collapsible` is set, since the collapsed control shows the selected option's icon alone.\n */\n icon?: React.ReactNode;\n}\n\nexport interface SegmentedControlProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the control in pixels. @default \"32\" */\n size?: SegmentedControlSize;\n /** Segment layout. @default \"hug\" */\n variant?: SegmentedControlVariant;\n /** Visual style of the control. @default \"pill\" */\n appearance?: SegmentedControlAppearance;\n /** The selectable segments. Designed for two or three mutually exclusive options. */\n options: SegmentedControlOption[];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). Defaults to the first option. */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the control is disabled. @default false */\n disabled?: boolean;\n /**\n * When `true`, the control automatically collapses to a single icon-only toggle whenever its\n * container is too narrow to show every segment side by side, and expands again when the space\n * returns. Collapsed, it shows the currently-selected option's `icon`; clicking it (or pressing\n * Enter/Space) advances to the next option, wrapping around from the last back to the first.\n *\n * Only supported for the icon-bearing `\"plain\"` and `\"brand\"` appearances, and every option must\n * define an `icon` (there is nothing to show otherwise). Ignored, with a dev-time warning, when\n * those conditions are not met. @default false\n */\n collapsible?: boolean;\n}\n\n/** Padding and typography per size. Combined with the container's `p-1` these hit the 32/40/48px heights. */\nconst sizeClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"px-2 py-1 typography-description-12px-semibold\",\n \"40\": \"px-3 py-1.75 typography-body-small-14px-semibold\",\n \"48\": \"px-4 py-2 typography-body-default-16px-semibold\",\n};\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SegmentedControl: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\nfunction warnMissingOptionAccessibleName(options: SegmentedControlOption[]) {\n if (process.env.NODE_ENV !== \"production\") {\n for (const option of options) {\n if (option.icon && !option.label?.trim()) {\n console.warn(\n `SegmentedControl: icon-only segment \"${option.value}\" is missing a non-empty \\`label\\` to use as its accessible name.`,\n );\n }\n }\n }\n}\n\nfunction warnUnsupportedCollapsible(\n appearance: SegmentedControlAppearance,\n options: SegmentedControlOption[],\n) {\n if (process.env.NODE_ENV !== \"production\") {\n if (appearance === \"pill\") {\n console.warn(\n 'SegmentedControl: `collapsible` is only supported for the \"plain\" and \"brand\" appearances; ignoring it.',\n );\n } else if (!options.every((option) => option.icon)) {\n console.warn(\n \"SegmentedControl: `collapsible` requires every option to define an `icon`; ignoring it.\",\n );\n }\n }\n}\n\nfunction getSegmentClassName({\n appearance,\n size,\n variant,\n isSelected,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n variant: SegmentedControlVariant;\n isSelected: boolean;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex min-w-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n variant === \"fill\" ? \"flex-1\" : \"shrink-0\",\n appearance === \"plain\"\n ? cn(\n // Padding + negative margin enlarge the hit target without changing the\n // visual footprint, which must stay glyph-only to match the design.\n \"-m-1 p-1\",\n isSelected ? \"text-icons-primary\" : \"text-icons-tertiary hover:text-icons-primary\",\n )\n : cn(\n sizeClasses[size],\n // brand renders icon + label together, so space them.\n appearance === \"brand\" && \"gap-1.5\",\n isSelected\n ? appearance === \"brand\"\n ? // Approximate brand-green pill using existing tokens; exact colours pending\n // dedicated navigation tokens (see ENG follow-up).\n \"bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default\"\n : \"bg-buttons-primary-default text-content-primary-inverted shadow-sm\"\n : \"text-content-primary hover:bg-buttons-switch-hover\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/** Symmetric padding per size so the collapsed toggle is a square (a circle once `rounded-full`). */\nconst collapsedPaddingClasses: Record<SegmentedControlSize, string> = {\n \"32\": \"p-1\",\n \"40\": \"p-2\",\n \"48\": \"p-3\",\n};\n\n/**\n * Classes for the single button shown while the control is collapsed. Unlike an expanded segment\n * (which carries asymmetric `px`/`py` padding and so reads slightly wider than tall), the collapsed\n * toggle is forced to an `aspect-square` circle via symmetric padding and `rounded-full`, so the\n * icon-only control reads as a round button.\n */\nfunction getCollapsedButtonClassName({\n appearance,\n size,\n disabled,\n}: {\n appearance: SegmentedControlAppearance;\n size: SegmentedControlSize;\n disabled: boolean;\n}) {\n return cn(\n \"relative inline-flex aspect-square shrink-0 cursor-pointer items-center justify-center rounded-full\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n appearance === \"plain\"\n ? // Glyph-only: no pill, just the selected icon colour. The negative margin keeps the visual\n // footprint icon-sized while the padding enlarges the hit target.\n \"-m-1 p-1 text-icons-primary\"\n : cn(\n collapsedPaddingClasses[size],\n \"bg-brand-primary-muted text-content-always-black shadow-sm ring-1 ring-brand-primary-default\",\n ),\n disabled && \"pointer-events-none\",\n );\n}\n\n/**\n * Watches `rootRef`'s available width against the natural width of the fully expanded control\n * (measured from `measureRef`, an off-screen replica) and returns whether the control should\n * collapse. Comparing available space to a stable off-screen measurement — rather than to the\n * live control, which shrinks when it collapses — avoids the expand/collapse oscillation that a\n * self-referential measurement would cause. Returns `false` until both widths are measurable\n * (SSR, jsdom, or a zero-width layout), so the control renders expanded by default.\n */\nfunction useAutoCollapse(\n rootRef: React.RefObject<HTMLDivElement | null>,\n measureRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n): boolean {\n const [collapsed, setCollapsed] = React.useState(false);\n\n React.useEffect(() => {\n if (!enabled) {\n setCollapsed(false);\n return;\n }\n const root = rootRef.current;\n const measure = measureRef.current;\n const parent = root?.parentElement;\n if (!root || !measure || !parent) return;\n\n const evaluate = () => {\n const available = parent.getBoundingClientRect().width;\n const required = measure.getBoundingClientRect().width;\n // Both unmeasured (SSR/jsdom/zero-width): leave the current state untouched.\n if (available <= 0 || required <= 0) return;\n setCollapsed(required > available);\n };\n\n evaluate();\n\n const observer = new ResizeObserver(evaluate);\n observer.observe(parent);\n observer.observe(measure);\n return () => observer.disconnect();\n }, [enabled, rootRef, measureRef]);\n\n return enabled && collapsed;\n}\n\n/**\n * A compact selector for choosing between two or three mutually exclusive\n * options where the choice affects the content immediately below it. Use\n * instead of tabs when the options are more like settings or filters than\n * navigation, such as toggling a list/grid view or a monthly/annual price.\n *\n * Rendered as a `radiogroup` with roving-tabindex keyboard navigation. Supports\n * both controlled and uncontrolled usage. With `collapsible`, the icon-bearing\n * `plain`/`brand` appearances shrink to a single cycling icon toggle when space\n * is tight (rendered as a `group` containing one button).\n *\n * @example\n * ```tsx\n * <SegmentedControl\n * options={[\n * { label: \"Net\", value: \"net\" },\n * { label: \"Gross\", value: \"gross\" },\n * ]}\n * value={amount}\n * onChange={setAmount}\n * aria-label=\"Amount type\"\n * />\n * ```\n *\n * @example Icon-only segments (e.g. a list/grid view toggle)\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n *\n * @example Icon + label with the brand-green pill (e.g. the Home/Agent nav switch)\n * ```tsx\n * <SegmentedControl\n * appearance=\"brand\"\n * options={[\n * { label: \"Home\", value: \"home\", icon: <HomeIcon size={16} /> },\n * { label: \"Agent\", value: \"agent\", icon: <AIIcon size={16} /> },\n * ]}\n * value={mode}\n * onChange={setMode}\n * aria-label=\"Navigation mode\"\n * />\n * ```\n *\n * @example Collapses to a cycling icon toggle when the container is too narrow\n * ```tsx\n * <SegmentedControl\n * appearance=\"plain\"\n * collapsible\n * options={[\n * { label: \"List view\", value: \"list\", icon: <ListViewIcon size={16} /> },\n * { label: \"Grid view\", value: \"grid\", icon: <GridViewIcon size={16} /> },\n * ]}\n * value={view}\n * onChange={setView}\n * aria-label=\"View\"\n * />\n * ```\n */\nexport const SegmentedControl = React.forwardRef<HTMLDivElement, SegmentedControlProps>(\n (\n {\n className,\n size = \"32\",\n variant = \"hug\",\n appearance = \"pill\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n collapsible = false,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n warnMissingOptionAccessibleName(options);\n if (collapsible) warnUnsupportedCollapsible(appearance, options);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0]?.value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n // Collapsing only makes sense for icon-bearing appearances where every option has an icon\n // to show. Anything else falls back to the normal expanded control (a dev warning fires above).\n const canCollapse =\n collapsible &&\n (appearance === \"plain\" || appearance === \"brand\") &&\n options.every((option) => option.icon);\n\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const measureRef = React.useRef<HTMLDivElement | null>(null);\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n rootRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n },\n [ref],\n );\n const isCollapsed = useAutoCollapse(rootRef, measureRef, canCollapse);\n\n const handleSelect = (optionValue: string) => {\n if (disabled || optionValue === currentValue) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n const nextIndex =\n e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n ? (index + 1) % options.length\n : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n ? (index - 1 + options.length) % options.length\n : null;\n if (nextIndex === null) return;\n e.preventDefault();\n const nextOption = options[nextIndex] as SegmentedControlOption;\n handleSelect(nextOption.value);\n buttonRefs.current[nextIndex]?.focus();\n };\n\n const renderSegment = (option: SegmentedControlOption, index: number) => {\n const isSelected = currentValue === option.value;\n // `brand` shows the label as visible text (with the icon); `pill`/`plain` render\n // icon-only when an icon is given, falling back to the label otherwise.\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation\n <button\n key={option.value}\n ref={(el) => {\n buttonRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n tabIndex={isSelected || (!anySelected && index === 0) ? 0 : -1}\n disabled={disabled}\n aria-label={showLabelText ? undefined : option.label}\n onClick={() => handleSelect(option.value)}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={getSegmentClassName({ appearance, size, variant, isSelected, disabled })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Off-screen replica of one segment used only to size the expanded control. Rendered as an\n // inert (disabled + `aria-hidden`) button with no `radio` semantics so it stays out of the\n // accessibility tree and tab order, and always with hug sizing so the replica reflects the\n // natural (uncompressed) width even under a `fill` layout.\n const renderMeasureSegment = (option: SegmentedControlOption) => {\n const showLabelText = appearance === \"brand\" || !option.icon;\n return (\n <button\n key={option.value}\n type=\"button\"\n disabled\n aria-hidden=\"true\"\n tabIndex={-1}\n className={getSegmentClassName({\n appearance,\n size,\n variant: \"hug\",\n isSelected: currentValue === option.value,\n disabled,\n })}\n >\n {option.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {option.icon}\n </span>\n )}\n {showLabelText && <span className=\"min-w-0 truncate\">{option.label}</span>}\n </button>\n );\n };\n\n // Collapsed: a single button showing the selected option's icon that cycles to the next\n // option on activation, wrapping from the last option back to the first.\n const selectedIndex = options.findIndex((option) => option.value === currentValue);\n const selectedOption = options[selectedIndex] ?? options[0];\n const handleCycle = () => {\n if (disabled || options.length === 0) return;\n const from = selectedIndex < 0 ? 0 : selectedIndex;\n const nextOption = options[(from + 1) % options.length] as SegmentedControlOption;\n handleSelect(nextOption.value);\n };\n\n return (\n <div\n ref={setRootRef}\n role={isCollapsed ? \"group\" : \"radiogroup\"}\n className={cn(\n \"relative items-center rounded-full\",\n variant === \"fill\" ? \"flex w-full\" : \"inline-flex\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n {isCollapsed && selectedOption ? (\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={selectedOption.label}\n onClick={handleCycle}\n className={getCollapsedButtonClassName({ appearance, size, disabled })}\n >\n {selectedOption.icon && (\n <span className=\"flex shrink-0 items-center justify-center\" aria-hidden=\"true\">\n {selectedOption.icon}\n </span>\n )}\n </button>\n ) : (\n options.map((option, index) => renderSegment(option, index))\n )}\n\n {canCollapse && (\n // Off-screen replica of the fully expanded control. Kept in the DOM (out of flow, hidden\n // from AT and tab order) so its natural width is always measurable, whether the visible\n // control is currently expanded or collapsed.\n <div\n ref={measureRef}\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none invisible absolute top-0 left-0 -z-10 flex items-center whitespace-nowrap rounded-full\",\n appearance === \"plain\" ? \"gap-2\" : \"bg-surface-tertiary p-1\",\n )}\n >\n {options.map((option) => renderMeasureSegment(option))}\n </div>\n )}\n </div>\n );\n },\n);\n\nSegmentedControl.displayName = \"SegmentedControl\";\n"],"names":[],"mappings":";;;;AA4EA,MAAM,cAAoD;AAAA,EACxD,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AACR;AAEA,SAAS,0BAA0B,WAAoB,gBAAyB;AAC9E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,aAAa,CAAC,gBAAgB;AACjC,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,SAAS,gCAAgC,SAAmC;AAC1E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,eAAW,UAAU,SAAS;AAC5B,UAAI,OAAO,QAAQ,CAAC,OAAO,OAAO,QAAQ;AACxC,gBAAQ;AAAA,UACN,wCAAwC,OAAO,KAAK;AAAA,QAAA;AAAA,MAExD;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,2BACP,YACA,SACA;AACA,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,eAAe,QAAQ;AACzB,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ,WAAW,CAAC,QAAQ,MAAM,CAAC,WAAW,OAAO,IAAI,GAAG;AAClD,cAAQ;AAAA,QACN;AAAA,MAAA;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AAA,cACA,cAAY,eAAe;AAAA,cAC3B,SAAS;AAAA,cACT,WAAW,4BAA4B,EAAE,YAAY,MAAM,UAAU;AAAA,cAEpE,UAAA,eAAe,QACd,oBAAC,QAAA,EAAK,WAAU,6CAA4C,eAAY,QACrE,UAAA,eAAe,KAAA,CAClB;AAAA,YAAA;AAAA,UAAA,IAIJ,QAAQ,IAAI,CAAC,QAAQ,UAAU,cAAc,QAAQ,KAAK,CAAC;AAAA,UAG5D;AAAA;AAAA;AAAA,UAIC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,eAAY;AAAA,cACZ,WAAW;AAAA,gBACT;AAAA,gBACA,eAAe,UAAU,UAAU;AAAA,cAAA;AAAA,cAGpC,kBAAQ,IAAI,CAAC,WAAW,qBAAqB,MAAM,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,QACvD;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,iBAAiB,cAAc;"}
@@ -25,7 +25,7 @@ function SliderLayout({
25
25
  }
26
26
  return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-3", children: [
27
27
  label && /* @__PURE__ */ jsx("span", { id: labelId, className: "typography-body-default-16px-semibold text-content-primary", children: label }),
28
- (minLabel || maxLabel) && /* @__PURE__ */ jsxs("div", { className: "flex w-full items-start justify-between typography-body-small-14px-regular text-content-secondary", children: [
28
+ (minLabel || maxLabel) && /* @__PURE__ */ jsxs("div", { className: "typography-body-small-14px-regular flex w-full items-start justify-between text-content-secondary", children: [
29
29
  minLabel && /* @__PURE__ */ jsx("span", { children: minLabel }),
30
30
  maxLabel && /* @__PURE__ */ jsx("span", { className: "ml-auto", children: maxLabel })
31
31
  ] }),
@@ -1 +1 @@
1
- {"version":3,"file":"SliderLayout.mjs","sources":["../../../src/components/Slider/SliderLayout.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport type { SliderLabelPosition } from \"./Slider\";\n\ninterface SliderLayoutProps {\n label?: string;\n labelId: string;\n labelPosition: SliderLabelPosition;\n minLabel?: string;\n maxLabel?: string;\n children: React.ReactNode;\n}\n\nexport function SliderLayout({\n label,\n labelId,\n labelPosition,\n minLabel,\n maxLabel,\n children,\n}: SliderLayoutProps) {\n if (labelPosition === \"left\") {\n return (\n <div className=\"flex items-center gap-3\">\n {label && (\n <span\n id={labelId}\n className=\"typography-body-default-16px-semibold shrink-0 text-content-primary\"\n >\n {label}\n </span>\n )}\n {minLabel && (\n <span className=\"typography-body-small-14px-regular shrink-0 text-content-secondary\">\n {minLabel}\n </span>\n )}\n {children}\n {maxLabel && (\n <span className=\"typography-body-small-14px-regular shrink-0 text-content-secondary\">\n {maxLabel}\n </span>\n )}\n </div>\n );\n }\n\n return (\n <div className=\"flex w-full flex-col gap-3\">\n {label && (\n <span id={labelId} className=\"typography-body-default-16px-semibold text-content-primary\">\n {label}\n </span>\n )}\n {(minLabel || maxLabel) && (\n <div className=\"flex w-full items-start justify-between typography-body-small-14px-regular text-content-secondary\">\n {minLabel && <span>{minLabel}</span>}\n {maxLabel && <span className=\"ml-auto\">{maxLabel}</span>}\n </div>\n )}\n {children}\n </div>\n );\n}\n"],"names":[],"mappings":";;AAYO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,MAAI,kBAAkB,QAAQ;AAC5B,WACE,qBAAC,OAAA,EAAI,WAAU,2BACZ,UAAA;AAAA,MAAA,SACC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAI;AAAA,UACJ,WAAU;AAAA,UAET,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGJ,YACC,oBAAC,QAAA,EAAK,WAAU,sEACb,UAAA,UACH;AAAA,MAED;AAAA,MACA,YACC,oBAAC,QAAA,EAAK,WAAU,sEACb,UAAA,SAAA,CACH;AAAA,IAAA,GAEJ;AAAA,EAEJ;AAEA,SACE,qBAAC,OAAA,EAAI,WAAU,8BACZ,UAAA;AAAA,IAAA,6BACE,QAAA,EAAK,IAAI,SAAS,WAAU,8DAC1B,UAAA,OACH;AAAA,KAEA,YAAY,aACZ,qBAAC,OAAA,EAAI,WAAU,qGACZ,UAAA;AAAA,MAAA,YAAY,oBAAC,UAAM,UAAA,SAAA,CAAS;AAAA,MAC5B,YAAY,oBAAC,QAAA,EAAK,WAAU,WAAW,UAAA,SAAA,CAAS;AAAA,IAAA,GACnD;AAAA,IAED;AAAA,EAAA,GACH;AAEJ;"}
1
+ {"version":3,"file":"SliderLayout.mjs","sources":["../../../src/components/Slider/SliderLayout.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport type { SliderLabelPosition } from \"./Slider\";\n\ninterface SliderLayoutProps {\n label?: string;\n labelId: string;\n labelPosition: SliderLabelPosition;\n minLabel?: string;\n maxLabel?: string;\n children: React.ReactNode;\n}\n\nexport function SliderLayout({\n label,\n labelId,\n labelPosition,\n minLabel,\n maxLabel,\n children,\n}: SliderLayoutProps) {\n if (labelPosition === \"left\") {\n return (\n <div className=\"flex items-center gap-3\">\n {label && (\n <span\n id={labelId}\n className=\"typography-body-default-16px-semibold shrink-0 text-content-primary\"\n >\n {label}\n </span>\n )}\n {minLabel && (\n <span className=\"typography-body-small-14px-regular shrink-0 text-content-secondary\">\n {minLabel}\n </span>\n )}\n {children}\n {maxLabel && (\n <span className=\"typography-body-small-14px-regular shrink-0 text-content-secondary\">\n {maxLabel}\n </span>\n )}\n </div>\n );\n }\n\n return (\n <div className=\"flex w-full flex-col gap-3\">\n {label && (\n <span id={labelId} className=\"typography-body-default-16px-semibold text-content-primary\">\n {label}\n </span>\n )}\n {(minLabel || maxLabel) && (\n <div className=\"typography-body-small-14px-regular flex w-full items-start justify-between text-content-secondary\">\n {minLabel && <span>{minLabel}</span>}\n {maxLabel && <span className=\"ml-auto\">{maxLabel}</span>}\n </div>\n )}\n {children}\n </div>\n );\n}\n"],"names":[],"mappings":";;AAYO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsB;AACpB,MAAI,kBAAkB,QAAQ;AAC5B,WACE,qBAAC,OAAA,EAAI,WAAU,2BACZ,UAAA;AAAA,MAAA,SACC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAI;AAAA,UACJ,WAAU;AAAA,UAET,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGJ,YACC,oBAAC,QAAA,EAAK,WAAU,sEACb,UAAA,UACH;AAAA,MAED;AAAA,MACA,YACC,oBAAC,QAAA,EAAK,WAAU,sEACb,UAAA,SAAA,CACH;AAAA,IAAA,GAEJ;AAAA,EAEJ;AAEA,SACE,qBAAC,OAAA,EAAI,WAAU,8BACZ,UAAA;AAAA,IAAA,6BACE,QAAA,EAAK,IAAI,SAAS,WAAU,8DAC1B,UAAA,OACH;AAAA,KAEA,YAAY,aACZ,qBAAC,OAAA,EAAI,WAAU,qGACZ,UAAA;AAAA,MAAA,YAAY,oBAAC,UAAM,UAAA,SAAA,CAAS;AAAA,MAC5B,YAAY,oBAAC,QAAA,EAAK,WAAU,WAAW,UAAA,SAAA,CAAS;AAAA,IAAA,GACnD;AAAA,IAED;AAAA,EAAA,GACH;AAEJ;"}
@@ -117,7 +117,7 @@ const TableHead = React.forwardRef(
117
117
  scope,
118
118
  className: cn(
119
119
  size === "condensed" ? "typography-body-small-14px-semibold" : "typography-body-default-16px-semibold",
120
- "box-border h-12 min-h-12 border-b border-border-primary px-4 py-3 align-middle text-content-tertiary",
120
+ "box-border h-12 min-h-12 border-border-primary border-b px-4 py-3 align-middle text-content-tertiary",
121
121
  HEAD_INTENT_CLASSES[intent],
122
122
  className
123
123
  ),
@@ -278,7 +278,7 @@ const TableSortLabel = React.forwardRef(
278
278
  className: cn("inline-flex items-center gap-1 text-content-primary", className),
279
279
  ...props,
280
280
  children: [
281
- /* @__PURE__ */ jsx("span", { className: cn(direction != null && "border-b border-content-primary pb-px"), children }),
281
+ /* @__PURE__ */ jsx("span", { className: cn(direction != null && "border-content-primary border-b pb-px"), children }),
282
282
  direction != null && /* @__PURE__ */ jsx(Icon, { className: "size-4 shrink-0", "aria-hidden": true })
283
283
  ]
284
284
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Table.mjs","sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { ArrowDownIcon } from \"../Icons/ArrowDownIcon\";\nimport { ArrowUpIcon } from \"../Icons/ArrowUpIcon\";\nimport { Select, SelectContent, SelectItem } from \"../Select/Select\";\n\n/**\n * Row density for body cells.\n *\n * - `\"md\"` (default) → 64px Figma `V2 Table Cell` Default.\n * - `\"condensed\"` → 48px Figma `V2 Table Cell` Condensed.\n * - `\"lg\"` → 80px rows; no longer in Figma, kept for back-compat.\n *\n * `\"default\"` is the v2 numeric-token equivalent of `\"md\"` and is preferred\n * for new code.\n */\nexport type TableSize = \"md\" | \"lg\" | \"condensed\" | \"default\";\n\nexport interface TableCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Row density applied to {@link TableCell} descendants. @default \"md\" */\n size?: TableSize;\n}\n\nconst TableSizeContext = React.createContext<TableSize>(\"md\");\n\nfunction useTableSize(): TableSize {\n return React.useContext(TableSizeContext);\n}\n\n/**\n * Surface wrapper for data tables: rounded 24px container with a strong\n * outer border, inner spacing, and size context for {@link TableCell}\n * descendants. Compose with {@link TableScrollArea}, {@link Table},\n * {@link TableHeader}, {@link TableBody}, {@link TableRow},\n * {@link TableHead}, and {@link TableCell}.\n *\n * @example\n * ```tsx\n * <TableCard>\n * <TableScrollArea>\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableHead>Name</TableHead>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * <TableRow>\n * <TableCell>Jane Doe</TableCell>\n * </TableRow>\n * </TableBody>\n * </Table>\n * </TableScrollArea>\n * </TableCard>\n * ```\n */\nexport const TableCard = React.forwardRef<HTMLDivElement, TableCardProps>(\n ({ className, size = \"md\", ...props }, ref) => {\n return (\n <TableSizeContext.Provider value={size}>\n <div\n ref={ref}\n className={cn(\n \"isolate flex flex-col gap-2 overflow-hidden rounded-3xl border border-border-strong px-3 py-1\",\n className,\n )}\n {...props}\n />\n </TableSizeContext.Provider>\n );\n },\n);\nTableCard.displayName = \"TableCard\";\n\nexport interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Optional toolbar row above the table (e.g. bulk selection actions).\n */\nexport const TableToolbar = React.forwardRef<HTMLDivElement, TableToolbarProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-wrap items-center gap-4 px-4 py-3\", className)}\n {...props}\n />\n );\n },\n);\nTableToolbar.displayName = \"TableToolbar\";\n\nexport interface TableScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * No longer needed in v2 — {@link TableCard} handles corner rounding via\n * its own `overflow-hidden rounded-3xl`. Accepted for back-compat.\n *\n * @deprecated v2 ignores this prop; safe to remove.\n */\n roundTop?: boolean;\n /**\n * Shows a slim horizontal scrollbar beneath the table when the content\n * overflows (Figma `V2 Scroll Bar`). @default false\n */\n showScrollbar?: boolean;\n}\n\n/**\n * Horizontal scroll container for wide tables. The inner scrollport keeps\n * `border-collapse` styles intact when the table wraps.\n */\nexport const TableScrollArea = React.forwardRef<HTMLDivElement, TableScrollAreaProps>(\n ({ className, children, roundTop: _roundTop, showScrollbar = false, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"relative w-full min-w-0 overflow-hidden\", className)}\n {...props}\n >\n <div\n className={cn(\n \"overflow-x-auto\",\n showScrollbar &&\n \"pb-3 [scrollbar-color:var(--color-border-strong)_transparent] [scrollbar-width:thin]\",\n )}\n >\n {children}\n </div>\n </div>\n );\n },\n);\nTableScrollArea.displayName = \"TableScrollArea\";\n\nexport interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {}\n\n/**\n * Semantic `<table>` element. Place inside {@link TableScrollArea}.\n */\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({ className, ...props }, ref) => {\n return (\n <table\n ref={ref}\n className={cn(\n \"w-full caption-bottom border-separate border-spacing-0 text-left\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTable.displayName = \"Table\";\n\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({ className, ...props }, ref) => {\n return <thead ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableHeader.displayName = \"TableHeader\";\n\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\n/**\n * `<tbody>` wrapper. Removes the bottom border on cells in the final row to\n * match the Figma `V2 Table Final Row` treatment.\n */\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({ className, ...props }, ref) => {\n return (\n <tbody ref={ref} className={cn(\"[&_tr:last-child_td]:border-b-0\", className)} {...props} />\n );\n },\n);\nTableBody.displayName = \"TableBody\";\n\nexport interface TableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableFooter = React.forwardRef<HTMLTableSectionElement, TableFooterProps>(\n ({ className, ...props }, ref) => {\n return <tfoot ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableFooter.displayName = \"TableFooter\";\n\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({ className, ...props }, ref) => {\n return <tr ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableRow.displayName = \"TableRow\";\n\n/** Column layout preset for {@link TableHead}. */\nexport type TableHeadIntent = \"default\" | \"checkbox\" | \"sort\" | \"leading\";\n\nconst HEAD_INTENT_CLASSES: Record<TableHeadIntent, string> = {\n default: \"text-left\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n sort: \"text-right\",\n leading: \"min-w-0 w-2/5 text-left\",\n};\n\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Layout preset for common column types. @default \"default\" */\n intent?: TableHeadIntent;\n}\n\n/**\n * Header cell. v2: transparent background, 48px min height, tertiary text,\n * `border-border-primary` bottom rule. Uses 16px semibold type, or 14px when\n * the parent {@link TableCard} is `size=\"condensed\"`.\n */\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({ className, intent = \"default\", scope = \"col\", ...props }, ref) => {\n const size = useTableSize();\n return (\n <th\n ref={ref}\n scope={scope}\n className={cn(\n size === \"condensed\"\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-default-16px-semibold\",\n \"box-border h-12 min-h-12 border-b border-border-primary px-4 py-3 align-middle text-content-tertiary\",\n HEAD_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableHead.displayName = \"TableHead\";\n\nconst CELL_MIN_HEIGHT: Record<TableSize, string> = {\n md: \"h-16 min-h-16\",\n default: \"h-16 min-h-16\",\n condensed: \"h-12 min-h-12 py-1\",\n lg: \"h-20 min-h-20\",\n};\n\n/** Bottom border and padding preset for body cells (Figma table cell component). */\nexport type TableCellVariant = \"default\" | \"chip\" | \"pillProgress\";\n\nconst CELL_VARIANT_CLASSES: Record<TableCellVariant, string> = {\n default: \"border-b border-border-primary px-4 py-3\",\n chip: \"border-b border-border-primary px-4 py-3\",\n pillProgress: \"border-b border-border-primary px-4 py-3\",\n};\n\n/** Layout / typography preset for {@link TableCell} (orthogonal to {@link TableCellVariant}). */\nexport type TableCellIntent = \"default\" | \"checkbox\" | \"stacked\" | \"multiline\" | \"sideLabel\";\n\nconst CELL_INTENT_CLASSES: Record<TableCellIntent, string> = {\n default: \"\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n stacked: \"align-top\",\n multiline: \"max-w-[240px]\",\n sideLabel: \"\",\n};\n\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Padding preset for the cell. v2 uses identical padding across variants; values are kept for back-compat. @default \"default\" */\n cellVariant?: TableCellVariant;\n /** Alignment and typography preset for common cell types. @default \"default\" */\n intent?: TableCellIntent;\n}\n\n/**\n * Body cell. v2: `h-16` (or `h-20` when the parent {@link TableCard} uses\n * `size=\"lg\"`), `px-4 py-3` padding, body-sm typography, and a single\n * `border-border-primary` rule that is zeroed by {@link TableBody} for the\n * final row.\n */\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({ className, cellVariant = \"default\", intent = \"default\", ...props }, ref) => {\n const size = useTableSize();\n const typo =\n intent === \"sideLabel\"\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-small-14px-regular\";\n return (\n <td\n ref={ref}\n className={cn(\n typo,\n \"align-middle text-content-primary\",\n CELL_VARIANT_CLASSES[cellVariant],\n CELL_MIN_HEIGHT[size],\n CELL_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableCell.displayName = \"TableCell\";\n\nexport interface TableCellGroupProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Horizontal group for icons, chips, and metadata inside a {@link TableCell}\n * (Figma `gap-[4px]`).\n */\nexport const TableCellGroup = React.forwardRef<HTMLDivElement, TableCellGroupProps>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-1\", className)} {...props} />;\n },\n);\nTableCellGroup.displayName = \"TableCellGroup\";\n\nexport interface TableCellContentProps {\n /** Primary line (semibold body-sm). */\n primary: React.ReactNode;\n /** Optional secondary line (regular body-sm, secondary color). */\n secondary?: React.ReactNode;\n /** Inline node rendered next to the primary line (icon, chip). */\n primaryAdornment?: React.ReactNode;\n /** Inline node rendered next to the secondary line. */\n secondaryAdornment?: React.ReactNode;\n /** Class for the outer wrapper. */\n className?: string;\n}\n\n/**\n * Two-line content slot matching Figma `V2 Table Content` — primary line\n * (semibold) over an optional secondary line (regular, muted) with a 2px\n * gap. Use inside {@link TableCell} for the common stacked-text pattern.\n */\nexport function TableCellContent({\n primary,\n secondary,\n primaryAdornment,\n secondaryAdornment,\n className,\n}: TableCellContentProps) {\n return (\n <div className={cn(\"flex flex-col gap-0.5\", className)}>\n <div className=\"flex items-center gap-1\">\n <span className=\"typography-body-small-14px-semibold text-content-primary\">{primary}</span>\n {primaryAdornment}\n </div>\n {(secondary != null || secondaryAdornment != null) && (\n <div className=\"flex items-center gap-1\">\n {secondary != null && (\n <span className=\"typography-body-small-14px-regular text-content-secondary\">\n {secondary}\n </span>\n )}\n {secondaryAdornment}\n </div>\n )}\n </div>\n );\n}\nTableCellContent.displayName = \"TableCellContent\";\n\n/** Pixel size of the square {@link TableMediaThumbnail}. */\nexport type TableMediaThumbnailSize = \"48\" | \"32\";\n\nexport interface TableMediaThumbnailProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Image URL. */\n src: string;\n /** Alt text for the image. @default \"\" */\n alt?: string;\n /** Applies the table's blurred-media treatment. @default false */\n blurred?: boolean;\n /** `center` uses the fixed media column width from the lg spec. @default \"start\" */\n align?: \"start\" | \"center\";\n /** Pixel size of the square thumbnail; `\"32\"` matches the current Figma `V2 Media Thumbnail Item`. @default \"48\" */\n size?: TableMediaThumbnailSize;\n}\n\n/**\n * Square thumbnail used inside {@link TableCell} for media columns\n * (Figma `V2 Media Thumbnail Item`).\n */\nexport const TableMediaThumbnail = React.forwardRef<HTMLDivElement, TableMediaThumbnailProps>(\n ({ className, src, alt = \"\", blurred, align = \"start\", size = \"48\", ...props }, ref) => {\n const frame = cn(\n \"overflow-hidden bg-neutral-alphas-200\",\n size === \"48\" && \"size-12 rounded-sm\",\n size === \"32\" && \"size-8 rounded-xs\",\n );\n return (\n <div\n ref={ref}\n className={cn(\n align === \"center\" && \"flex w-16 shrink-0 justify-center\",\n align === \"start\" && \"inline-flex shrink-0\",\n )}\n >\n <div className={cn(frame, blurred && \"blur-[2px]\", className)} {...props}>\n <img alt={alt} className=\"size-full object-cover\" src={src} />\n </div>\n </div>\n );\n },\n);\nTableMediaThumbnail.displayName = \"TableMediaThumbnail\";\n\nexport interface TableStatusDotProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Small status indicator dot for table cells (Figma status column).\n */\nexport const TableStatusDot = React.forwardRef<HTMLDivElement, TableStatusDotProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"size-2 shrink-0 rounded-full bg-info-content\", className)}\n {...props}\n />\n );\n },\n);\nTableStatusDot.displayName = \"TableStatusDot\";\n\nexport interface TableProgressTrackProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Fill width from 0–100. @default 0 */\n value?: number;\n}\n\n/**\n * Thin progress track used with badges in table cells (Figma pill + progress).\n * Renders with `role=\"progressbar\"` and a default `aria-label` of `\"Progress\"`.\n */\nexport const TableProgressTrack = React.forwardRef<HTMLDivElement, TableProgressTrackProps>(\n ({ className, value = 0, \"aria-label\": ariaLabel = \"Progress\", ...props }, ref) => {\n const width = Math.min(100, Math.max(0, value));\n const rounded = Math.round(width);\n return (\n <div\n ref={ref}\n role=\"progressbar\"\n aria-valuenow={rounded}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={ariaLabel}\n className={cn(\n \"relative h-1 w-full overflow-hidden rounded-full bg-neutral-alphas-200\",\n className,\n )}\n {...props}\n >\n <div\n className=\"absolute top-0 left-0 h-1 rounded-full bg-buttons-primary-default\"\n style={{ width: `${width}%` }}\n aria-hidden\n />\n </div>\n );\n },\n);\nTableProgressTrack.displayName = \"TableProgressTrack\";\n\nexport interface TablePillProgressLayoutProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Vertical layout for pill label + {@link TableProgressTrack} in a cell.\n */\nexport const TablePillProgressLayout = React.forwardRef<\n HTMLDivElement,\n TablePillProgressLayoutProps\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex min-w-[120px] flex-col items-start gap-2\", className)}\n {...props}\n />\n );\n});\nTablePillProgressLayout.displayName = \"TablePillProgressLayout\";\n\n/** Current sort direction of a {@link TableSortLabel}. `null` means unsorted. */\nexport type TableSortDirection = \"asc\" | \"desc\" | null;\n\nexport interface TableSortLabelProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode;\n /**\n * Visual indicator of the column's sort state. When set to `\"asc\"` or\n * `\"desc\"`, a 1px underline accent appears beneath the label and a small\n * directional arrow is shown next to it. @default null\n */\n direction?: TableSortDirection;\n}\n\n/**\n * Sortable column label. v2 expresses the sort state with a 1px underline\n * beneath the label plus a directional arrow when sorted.\n */\nexport const TableSortLabel = React.forwardRef<HTMLSpanElement, TableSortLabelProps>(\n ({ className, children, direction = null, ...props }, ref) => {\n const Icon = direction === \"desc\" ? ArrowDownIcon : ArrowUpIcon;\n return (\n <span\n ref={ref}\n className={cn(\"inline-flex items-center gap-1 text-content-primary\", className)}\n {...props}\n >\n <span className={cn(direction != null && \"border-b border-content-primary pb-px\")}>\n {children}\n </span>\n {direction != null && <Icon className=\"size-4 shrink-0\" aria-hidden />}\n </span>\n );\n },\n);\nTableSortLabel.displayName = \"TableSortLabel\";\n\nexport interface TableStackedTextProps {\n /** Primary line (semibold body). */\n title: React.ReactNode;\n /** Secondary line (caption, muted). */\n subtitle: React.ReactNode;\n}\n\n/**\n * Two-line primary + secondary text block for \"cell + info\" patterns.\n *\n * @deprecated Prefer {@link TableCellContent} which supports adornments and\n * matches the Figma `V2 Table Content` slot.\n */\nexport function TableStackedText({ title, subtitle }: TableStackedTextProps) {\n return <TableCellContent primary={title} secondary={subtitle} />;\n}\n\nTableStackedText.displayName = \"TableStackedText\";\n\nexport interface TableLineClampProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Number of lines before ellipsis. @default 2 */\n lines?: 1 | 2 | 3;\n}\n\n/**\n * Clamps child text to a fixed number of lines inside a {@link TableCell}.\n */\nexport const TableLineClamp = React.forwardRef<HTMLDivElement, TableLineClampProps>(\n ({ className, lines = 2, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n lines === 1 && \"line-clamp-1\",\n lines === 2 && \"line-clamp-2\",\n lines === 3 && \"line-clamp-3\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableLineClamp.displayName = \"TableLineClamp\";\n\nexport interface TableRowsPerPageSelectProps {\n /** Passed to the trigger for forms and labels. */\n id?: string;\n /** Accessible name for the trigger when no visible label. @default \"Rows per page\" */\n \"aria-label\"?: string;\n}\n\n/**\n * Rows-per-page {@link Select} styled for {@link TablePagination}. v2 uses a\n * subtle pill trigger with the table's secondary-surface background.\n */\nexport function TableRowsPerPageSelect(props: TableRowsPerPageSelectProps) {\n const { id, \"aria-label\": ariaLabel = \"Rows per page\" } = props;\n return (\n <Select\n defaultValue=\"10\"\n size=\"32\"\n aria-label={ariaLabel}\n className=\"w-[154px] [&_button]:rounded-sm [&_button]:border-transparent [&_button]:bg-inputs-inputs-primary\"\n id={id}\n >\n <SelectContent>\n <SelectItem value=\"10\">10 rows per page</SelectItem>\n <SelectItem value=\"25\">25 rows per page</SelectItem>\n <SelectItem value=\"50\">50 rows per page</SelectItem>\n </SelectContent>\n </Select>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,mBAAmB,MAAM,cAAyB,IAAI;AAE5D,SAAS,eAA0B;AACjC,SAAO,MAAM,WAAW,gBAAgB;AAC1C;AA6BO,MAAM,YAAY,MAAM;AAAA,EAC7B,CAAC,EAAE,WAAW,OAAO,MAAM,GAAG,MAAA,GAAS,QAAQ;AAC7C,WACE,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAChC,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAOjB,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAA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C,cAAa;AAAA,MACb,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,WAAU;AAAA,MACV;AAAA,MAEA,+BAAC,eAAA,EACC,UAAA;AAAA,QAAA,oBAAC,YAAA,EAAW,OAAM,MAAK,UAAA,oBAAgB;AAAA,QACvC,oBAAC,YAAA,EAAW,OAAM,MAAK,UAAA,oBAAgB;AAAA,QACvC,oBAAC,YAAA,EAAW,OAAM,MAAK,UAAA,mBAAA,CAAgB;AAAA,MAAA,EAAA,CACzC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"Table.mjs","sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { ArrowDownIcon } from \"../Icons/ArrowDownIcon\";\nimport { ArrowUpIcon } from \"../Icons/ArrowUpIcon\";\nimport { Select, SelectContent, SelectItem } from \"../Select/Select\";\n\n/**\n * Row density for body cells.\n *\n * - `\"md\"` (default) → 64px Figma `V2 Table Cell` Default.\n * - `\"condensed\"` → 48px Figma `V2 Table Cell` Condensed.\n * - `\"lg\"` → 80px rows; no longer in Figma, kept for back-compat.\n *\n * `\"default\"` is the v2 numeric-token equivalent of `\"md\"` and is preferred\n * for new code.\n */\nexport type TableSize = \"md\" | \"lg\" | \"condensed\" | \"default\";\n\nexport interface TableCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Row density applied to {@link TableCell} descendants. @default \"md\" */\n size?: TableSize;\n}\n\nconst TableSizeContext = React.createContext<TableSize>(\"md\");\n\nfunction useTableSize(): TableSize {\n return React.useContext(TableSizeContext);\n}\n\n/**\n * Surface wrapper for data tables: rounded 24px container with a strong\n * outer border, inner spacing, and size context for {@link TableCell}\n * descendants. Compose with {@link TableScrollArea}, {@link Table},\n * {@link TableHeader}, {@link TableBody}, {@link TableRow},\n * {@link TableHead}, and {@link TableCell}.\n *\n * @example\n * ```tsx\n * <TableCard>\n * <TableScrollArea>\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableHead>Name</TableHead>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * <TableRow>\n * <TableCell>Jane Doe</TableCell>\n * </TableRow>\n * </TableBody>\n * </Table>\n * </TableScrollArea>\n * </TableCard>\n * ```\n */\nexport const TableCard = React.forwardRef<HTMLDivElement, TableCardProps>(\n ({ className, size = \"md\", ...props }, ref) => {\n return (\n <TableSizeContext.Provider value={size}>\n <div\n ref={ref}\n className={cn(\n \"isolate flex flex-col gap-2 overflow-hidden rounded-3xl border border-border-strong px-3 py-1\",\n className,\n )}\n {...props}\n />\n </TableSizeContext.Provider>\n );\n },\n);\nTableCard.displayName = \"TableCard\";\n\nexport interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Optional toolbar row above the table (e.g. bulk selection actions).\n */\nexport const TableToolbar = React.forwardRef<HTMLDivElement, TableToolbarProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-wrap items-center gap-4 px-4 py-3\", className)}\n {...props}\n />\n );\n },\n);\nTableToolbar.displayName = \"TableToolbar\";\n\nexport interface TableScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * No longer needed in v2 — {@link TableCard} handles corner rounding via\n * its own `overflow-hidden rounded-3xl`. Accepted for back-compat.\n *\n * @deprecated v2 ignores this prop; safe to remove.\n */\n roundTop?: boolean;\n /**\n * Shows a slim horizontal scrollbar beneath the table when the content\n * overflows (Figma `V2 Scroll Bar`). @default false\n */\n showScrollbar?: boolean;\n}\n\n/**\n * Horizontal scroll container for wide tables. The inner scrollport keeps\n * `border-collapse` styles intact when the table wraps.\n */\nexport const TableScrollArea = React.forwardRef<HTMLDivElement, TableScrollAreaProps>(\n ({ className, children, roundTop: _roundTop, showScrollbar = false, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"relative w-full min-w-0 overflow-hidden\", className)}\n {...props}\n >\n <div\n className={cn(\n \"overflow-x-auto\",\n showScrollbar &&\n \"pb-3 [scrollbar-color:var(--color-border-strong)_transparent] [scrollbar-width:thin]\",\n )}\n >\n {children}\n </div>\n </div>\n );\n },\n);\nTableScrollArea.displayName = \"TableScrollArea\";\n\nexport interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {}\n\n/**\n * Semantic `<table>` element. Place inside {@link TableScrollArea}.\n */\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({ className, ...props }, ref) => {\n return (\n <table\n ref={ref}\n className={cn(\n \"w-full caption-bottom border-separate border-spacing-0 text-left\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTable.displayName = \"Table\";\n\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({ className, ...props }, ref) => {\n return <thead ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableHeader.displayName = \"TableHeader\";\n\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\n/**\n * `<tbody>` wrapper. Removes the bottom border on cells in the final row to\n * match the Figma `V2 Table Final Row` treatment.\n */\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({ className, ...props }, ref) => {\n return (\n <tbody ref={ref} className={cn(\"[&_tr:last-child_td]:border-b-0\", className)} {...props} />\n );\n },\n);\nTableBody.displayName = \"TableBody\";\n\nexport interface TableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableFooter = React.forwardRef<HTMLTableSectionElement, TableFooterProps>(\n ({ className, ...props }, ref) => {\n return <tfoot ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableFooter.displayName = \"TableFooter\";\n\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({ className, ...props }, ref) => {\n return <tr ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableRow.displayName = \"TableRow\";\n\n/** Column layout preset for {@link TableHead}. */\nexport type TableHeadIntent = \"default\" | \"checkbox\" | \"sort\" | \"leading\";\n\nconst HEAD_INTENT_CLASSES: Record<TableHeadIntent, string> = {\n default: \"text-left\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n sort: \"text-right\",\n leading: \"min-w-0 w-2/5 text-left\",\n};\n\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Layout preset for common column types. @default \"default\" */\n intent?: TableHeadIntent;\n}\n\n/**\n * Header cell. v2: transparent background, 48px min height, tertiary text,\n * `border-border-primary` bottom rule. Uses 16px semibold type, or 14px when\n * the parent {@link TableCard} is `size=\"condensed\"`.\n */\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({ className, intent = \"default\", scope = \"col\", ...props }, ref) => {\n const size = useTableSize();\n return (\n <th\n ref={ref}\n scope={scope}\n className={cn(\n size === \"condensed\"\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-default-16px-semibold\",\n \"box-border h-12 min-h-12 border-border-primary border-b px-4 py-3 align-middle text-content-tertiary\",\n HEAD_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableHead.displayName = \"TableHead\";\n\nconst CELL_MIN_HEIGHT: Record<TableSize, string> = {\n md: \"h-16 min-h-16\",\n default: \"h-16 min-h-16\",\n condensed: \"h-12 min-h-12 py-1\",\n lg: \"h-20 min-h-20\",\n};\n\n/** Bottom border and padding preset for body cells (Figma table cell component). */\nexport type TableCellVariant = \"default\" | \"chip\" | \"pillProgress\";\n\nconst CELL_VARIANT_CLASSES: Record<TableCellVariant, string> = {\n default: \"border-b border-border-primary px-4 py-3\",\n chip: \"border-b border-border-primary px-4 py-3\",\n pillProgress: \"border-b border-border-primary px-4 py-3\",\n};\n\n/** Layout / typography preset for {@link TableCell} (orthogonal to {@link TableCellVariant}). */\nexport type TableCellIntent = \"default\" | \"checkbox\" | \"stacked\" | \"multiline\" | \"sideLabel\";\n\nconst CELL_INTENT_CLASSES: Record<TableCellIntent, string> = {\n default: \"\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n stacked: \"align-top\",\n multiline: \"max-w-[240px]\",\n sideLabel: \"\",\n};\n\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Padding preset for the cell. v2 uses identical padding across variants; values are kept for back-compat. @default \"default\" */\n cellVariant?: TableCellVariant;\n /** Alignment and typography preset for common cell types. @default \"default\" */\n intent?: TableCellIntent;\n}\n\n/**\n * Body cell. v2: `h-16` (or `h-20` when the parent {@link TableCard} uses\n * `size=\"lg\"`), `px-4 py-3` padding, body-sm typography, and a single\n * `border-border-primary` rule that is zeroed by {@link TableBody} for the\n * final row.\n */\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({ className, cellVariant = \"default\", intent = \"default\", ...props }, ref) => {\n const size = useTableSize();\n const typo =\n intent === \"sideLabel\"\n ? \"typography-body-small-14px-semibold\"\n : \"typography-body-small-14px-regular\";\n return (\n <td\n ref={ref}\n className={cn(\n typo,\n \"align-middle text-content-primary\",\n CELL_VARIANT_CLASSES[cellVariant],\n CELL_MIN_HEIGHT[size],\n CELL_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableCell.displayName = \"TableCell\";\n\nexport interface TableCellGroupProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Horizontal group for icons, chips, and metadata inside a {@link TableCell}\n * (Figma `gap-[4px]`).\n */\nexport const TableCellGroup = React.forwardRef<HTMLDivElement, TableCellGroupProps>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-1\", className)} {...props} />;\n },\n);\nTableCellGroup.displayName = \"TableCellGroup\";\n\nexport interface TableCellContentProps {\n /** Primary line (semibold body-sm). */\n primary: React.ReactNode;\n /** Optional secondary line (regular body-sm, secondary color). */\n secondary?: React.ReactNode;\n /** Inline node rendered next to the primary line (icon, chip). */\n primaryAdornment?: React.ReactNode;\n /** Inline node rendered next to the secondary line. */\n secondaryAdornment?: React.ReactNode;\n /** Class for the outer wrapper. */\n className?: string;\n}\n\n/**\n * Two-line content slot matching Figma `V2 Table Content` — primary line\n * (semibold) over an optional secondary line (regular, muted) with a 2px\n * gap. Use inside {@link TableCell} for the common stacked-text pattern.\n */\nexport function TableCellContent({\n primary,\n secondary,\n primaryAdornment,\n secondaryAdornment,\n className,\n}: TableCellContentProps) {\n return (\n <div className={cn(\"flex flex-col gap-0.5\", className)}>\n <div className=\"flex items-center gap-1\">\n <span className=\"typography-body-small-14px-semibold text-content-primary\">{primary}</span>\n {primaryAdornment}\n </div>\n {(secondary != null || secondaryAdornment != null) && (\n <div className=\"flex items-center gap-1\">\n {secondary != null && (\n <span className=\"typography-body-small-14px-regular text-content-secondary\">\n {secondary}\n </span>\n )}\n {secondaryAdornment}\n </div>\n )}\n </div>\n );\n}\nTableCellContent.displayName = \"TableCellContent\";\n\n/** Pixel size of the square {@link TableMediaThumbnail}. */\nexport type TableMediaThumbnailSize = \"48\" | \"32\";\n\nexport interface TableMediaThumbnailProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Image URL. */\n src: string;\n /** Alt text for the image. @default \"\" */\n alt?: string;\n /** Applies the table's blurred-media treatment. @default false */\n blurred?: boolean;\n /** `center` uses the fixed media column width from the lg spec. @default \"start\" */\n align?: \"start\" | \"center\";\n /** Pixel size of the square thumbnail; `\"32\"` matches the current Figma `V2 Media Thumbnail Item`. @default \"48\" */\n size?: TableMediaThumbnailSize;\n}\n\n/**\n * Square thumbnail used inside {@link TableCell} for media columns\n * (Figma `V2 Media Thumbnail Item`).\n */\nexport const TableMediaThumbnail = React.forwardRef<HTMLDivElement, TableMediaThumbnailProps>(\n ({ className, src, alt = \"\", blurred, align = \"start\", size = \"48\", ...props }, ref) => {\n const frame = cn(\n \"overflow-hidden bg-neutral-alphas-200\",\n size === \"48\" && \"size-12 rounded-sm\",\n size === \"32\" && \"size-8 rounded-xs\",\n );\n return (\n <div\n ref={ref}\n className={cn(\n align === \"center\" && \"flex w-16 shrink-0 justify-center\",\n align === \"start\" && \"inline-flex shrink-0\",\n )}\n >\n <div className={cn(frame, blurred && \"blur-[2px]\", className)} {...props}>\n <img alt={alt} className=\"size-full object-cover\" src={src} />\n </div>\n </div>\n );\n },\n);\nTableMediaThumbnail.displayName = \"TableMediaThumbnail\";\n\nexport interface TableStatusDotProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Small status indicator dot for table cells (Figma status column).\n */\nexport const TableStatusDot = React.forwardRef<HTMLDivElement, TableStatusDotProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"size-2 shrink-0 rounded-full bg-info-content\", className)}\n {...props}\n />\n );\n },\n);\nTableStatusDot.displayName = \"TableStatusDot\";\n\nexport interface TableProgressTrackProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Fill width from 0–100. @default 0 */\n value?: number;\n}\n\n/**\n * Thin progress track used with badges in table cells (Figma pill + progress).\n * Renders with `role=\"progressbar\"` and a default `aria-label` of `\"Progress\"`.\n */\nexport const TableProgressTrack = React.forwardRef<HTMLDivElement, TableProgressTrackProps>(\n ({ className, value = 0, \"aria-label\": ariaLabel = \"Progress\", ...props }, ref) => {\n const width = Math.min(100, Math.max(0, value));\n const rounded = Math.round(width);\n return (\n <div\n ref={ref}\n role=\"progressbar\"\n aria-valuenow={rounded}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={ariaLabel}\n className={cn(\n \"relative h-1 w-full overflow-hidden rounded-full bg-neutral-alphas-200\",\n className,\n )}\n {...props}\n >\n <div\n className=\"absolute top-0 left-0 h-1 rounded-full bg-buttons-primary-default\"\n style={{ width: `${width}%` }}\n aria-hidden\n />\n </div>\n );\n },\n);\nTableProgressTrack.displayName = \"TableProgressTrack\";\n\nexport interface TablePillProgressLayoutProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Vertical layout for pill label + {@link TableProgressTrack} in a cell.\n */\nexport const TablePillProgressLayout = React.forwardRef<\n HTMLDivElement,\n TablePillProgressLayoutProps\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex min-w-[120px] flex-col items-start gap-2\", className)}\n {...props}\n />\n );\n});\nTablePillProgressLayout.displayName = \"TablePillProgressLayout\";\n\n/** Current sort direction of a {@link TableSortLabel}. `null` means unsorted. */\nexport type TableSortDirection = \"asc\" | \"desc\" | null;\n\nexport interface TableSortLabelProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode;\n /**\n * Visual indicator of the column's sort state. When set to `\"asc\"` or\n * `\"desc\"`, a 1px underline accent appears beneath the label and a small\n * directional arrow is shown next to it. @default null\n */\n direction?: TableSortDirection;\n}\n\n/**\n * Sortable column label. v2 expresses the sort state with a 1px underline\n * beneath the label plus a directional arrow when sorted.\n */\nexport const TableSortLabel = React.forwardRef<HTMLSpanElement, TableSortLabelProps>(\n ({ className, children, direction = null, ...props }, ref) => {\n const Icon = direction === \"desc\" ? ArrowDownIcon : ArrowUpIcon;\n return (\n <span\n ref={ref}\n className={cn(\"inline-flex items-center gap-1 text-content-primary\", className)}\n {...props}\n >\n <span className={cn(direction != null && \"border-content-primary border-b pb-px\")}>\n {children}\n </span>\n {direction != null && <Icon className=\"size-4 shrink-0\" aria-hidden />}\n </span>\n );\n },\n);\nTableSortLabel.displayName = \"TableSortLabel\";\n\nexport interface TableStackedTextProps {\n /** Primary line (semibold body). */\n title: React.ReactNode;\n /** Secondary line (caption, muted). */\n subtitle: React.ReactNode;\n}\n\n/**\n * Two-line primary + secondary text block for \"cell + info\" patterns.\n *\n * @deprecated Prefer {@link TableCellContent} which supports adornments and\n * matches the Figma `V2 Table Content` slot.\n */\nexport function TableStackedText({ title, subtitle }: TableStackedTextProps) {\n return <TableCellContent primary={title} secondary={subtitle} />;\n}\n\nTableStackedText.displayName = \"TableStackedText\";\n\nexport interface TableLineClampProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Number of lines before ellipsis. @default 2 */\n lines?: 1 | 2 | 3;\n}\n\n/**\n * Clamps child text to a fixed number of lines inside a {@link TableCell}.\n */\nexport const TableLineClamp = React.forwardRef<HTMLDivElement, TableLineClampProps>(\n ({ className, lines = 2, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n lines === 1 && \"line-clamp-1\",\n lines === 2 && \"line-clamp-2\",\n lines === 3 && \"line-clamp-3\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableLineClamp.displayName = \"TableLineClamp\";\n\nexport interface TableRowsPerPageSelectProps {\n /** Passed to the trigger for forms and labels. */\n id?: string;\n /** Accessible name for the trigger when no visible label. @default \"Rows per page\" */\n \"aria-label\"?: string;\n}\n\n/**\n * Rows-per-page {@link Select} styled for {@link TablePagination}. v2 uses a\n * subtle pill trigger with the table's secondary-surface background.\n */\nexport function TableRowsPerPageSelect(props: TableRowsPerPageSelectProps) {\n const { id, \"aria-label\": ariaLabel = \"Rows per page\" } = props;\n return (\n <Select\n defaultValue=\"10\"\n size=\"32\"\n aria-label={ariaLabel}\n className=\"w-[154px] [&_button]:rounded-sm [&_button]:border-transparent [&_button]:bg-inputs-inputs-primary\"\n id={id}\n >\n <SelectContent>\n <SelectItem value=\"10\">10 rows per page</SelectItem>\n <SelectItem value=\"25\">25 rows per page</SelectItem>\n <SelectItem value=\"50\">50 rows per page</SelectItem>\n </SelectContent>\n </Select>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,mBAAmB,MAAM,cAAyB,IAAI;AAE5D,SAAS,eAA0B;AACjC,SAAO,MAAM,WAAW,gBAAgB;AAC1C;AA6BO,MAAM,YAAY,MAAM;AAAA,EAC7B,CAAC,EAAE,WAAW,OAAO,MAAM,GAAG,MAAA,GAAS,QAAQ;AAC7C,WACE,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAChC,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,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QAAA;AAAA,QAED,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AACA,eAAe,cAAc;AAatB,SAAS,uBAAuB,OAAoC;AACzE,QAAM,EAAE,IAAI,cAAc,YAAY,oBAAoB;AAC1D,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAa;AAAA,MACb,MAAK;AAAA,MACL,cAAY;AAAA,MACZ,WAAU;AAAA,MACV;AAAA,MAEA,+BAAC,eAAA,EACC,UAAA;AAAA,QAAA,oBAAC,YAAA,EAAW,OAAM,MAAK,UAAA,oBAAgB;AAAA,QACvC,oBAAC,YAAA,EAAW,OAAM,MAAK,UAAA,oBAAgB;AAAA,QACvC,oBAAC,YAAA,EAAW,OAAM,MAAK,UAAA,mBAAA,CAAgB;AAAA,MAAA,EAAA,CACzC;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -49,7 +49,7 @@ const UserDisplayName = React.forwardRef(
49
49
  children: /* @__PURE__ */ jsx(AIDisclosureIcon, { size: 16 })
50
50
  }
51
51
  ),
52
- showOnlineStatus && /* @__PURE__ */ jsx(ProfileOnlineStatus, { label: onlineLabel, className: "shrink-0 ml-2" })
52
+ showOnlineStatus && /* @__PURE__ */ jsx(ProfileOnlineStatus, { label: onlineLabel, className: "ml-2 shrink-0" })
53
53
  ]
54
54
  }
55
55
  );
@@ -1 +1 @@
1
- {"version":3,"file":"UserDisplayName.mjs","sources":["../../../src/components/UserDisplayName/UserDisplayName.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIDisclosureIcon } from \"../Icons/AIDisclosureIcon\";\nimport { VerifiedIcon } from \"../Icons/VerifiedIcon\";\nimport { ProfileOnlineStatus } from \"../ProfileOnlineStatus/ProfileOnlineStatus\";\n\nexport interface UserDisplayNameProps extends React.HTMLAttributes<HTMLElement> {\n /** Render an AI-disclosure badge after the name, alongside any status badge. */\n aiDisclosure?: boolean;\n /** Accessible label for the AI-disclosure badge. @default \"AI creator\" */\n aiDisclosureLabel?: string;\n /** Render an ambassador badge after the name. */\n ambassador?: boolean;\n /** Accessible label for the ambassador badge. @default \"Ambassador\" */\n ambassadorLabel?: string;\n /** HTML element used for the root wrapper. @default \"span\" */\n component?: \"span\" | \"h1\" | \"h2\" | \"h3\" | \"p\" | \"div\";\n /** Truncate the display name on a single line. @default true */\n noWrap?: boolean;\n /** Accessible label for the online-status indicator. @default \"Online\" */\n onlineLabel?: string;\n /** Render the inline online-status indicator after the name. @default false */\n showOnlineStatus?: boolean;\n /** Render a verified badge after the name (ignored when `ambassador` is set). */\n verified?: boolean;\n /** Accessible label for the verified badge. @default \"Verified\" */\n verifiedLabel?: string;\n}\n\n/**\n * Renders a user's display name with optional ambassador/verified badges and an\n * online-status indicator. Only the name shrinks and truncates; trailing badges\n * and the online-status indicator stay visible on the same line.\n *\n * Typography is not baked in: pass a `typography-*` utility via `className` on\n * the root and the name inherits it. Use `typography-body-small-14px-semibold`\n * for the standard display-name scale.\n *\n * When both `ambassador` and `verified` are set, the ambassador badge takes\n * precedence. `aiDisclosure` is independent of both and renders after whichever\n * status badge is shown, since it discloses how the account is operated rather\n * than ranking it.\n *\n * The verified and AI-disclosure badges inherit the name's colour, so setting a\n * colour on the root tints them with it. That keeps them legible on surfaces\n * that fix their own text colour — over a cover image, for example, where a\n * theme-dependent tint would turn black against white text in light mode.\n *\n * The ambassador tint is deliberately not inherited: it uses `text-success-content`\n * (not `text-icons-brand-green`) so the green darkens in light mode and lightens\n * in dark mode, matching {@link ProfileOnlineStatus}; `text-icons-brand-green` is\n * fixed across modes.\n *\n * @example\n * ```tsx\n * <UserDisplayName className=\"typography-body-small-14px-semibold\">Jane Doe</UserDisplayName>\n * ```\n */\nexport const UserDisplayName = React.forwardRef<HTMLElement, UserDisplayNameProps>(\n (\n {\n aiDisclosure,\n aiDisclosureLabel = \"AI creator\",\n ambassador,\n ambassadorLabel = \"Ambassador\",\n children,\n className,\n component = \"span\",\n noWrap = true,\n onlineLabel = \"Online\",\n showOnlineStatus,\n verified,\n verifiedLabel = \"Verified\",\n ...props\n },\n ref,\n ) => {\n const Component = component as React.ElementType;\n\n const badge = ambassador\n ? { label: ambassadorLabel, tint: \"text-success-content\" }\n : verified\n ? { label: verifiedLabel, tint: \"text-current\" }\n : null;\n\n return (\n <Component\n ref={ref}\n className={cn(\"inline-flex max-w-full items-center\", className)}\n {...props}\n >\n <span className={cn(\"min-w-0\", noWrap && \"truncate\")}>{children}</span>\n {badge && (\n <span\n role=\"img\"\n aria-label={badge.label}\n className={cn(\"ml-2 inline-flex shrink-0 items-center\", badge.tint)}\n >\n <VerifiedIcon size={16} />\n </span>\n )}\n {aiDisclosure && (\n <span\n role=\"img\"\n aria-label={aiDisclosureLabel}\n className=\"ml-2 inline-flex shrink-0 items-center text-current\"\n >\n <AIDisclosureIcon size={16} />\n </span>\n )}\n {showOnlineStatus && <ProfileOnlineStatus label={onlineLabel} className=\"shrink-0 ml-2\" />}\n </Component>\n );\n },\n);\n\nUserDisplayName.displayName = \"UserDisplayName\";\n"],"names":[],"mappings":";;;;;;;AA0DO,MAAM,kBAAkB,MAAM;AAAA,EACnC,CACE;AAAA,IACE;AAAA,IACA,oBAAoB;AAAA,IACpB;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,YAAY;AAElB,UAAM,QAAQ,aACV,EAAE,OAAO,iBAAiB,MAAM,uBAAA,IAChC,WACE,EAAE,OAAO,eAAe,MAAM,mBAC9B;AAEN,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,uCAAuC,SAAS;AAAA,QAC7D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,oBAAC,UAAK,WAAW,GAAG,WAAW,UAAU,UAAU,GAAI,UAAS;AAAA,UAC/D,SACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY,MAAM;AAAA,cAClB,WAAW,GAAG,0CAA0C,MAAM,IAAI;AAAA,cAElE,UAAA,oBAAC,cAAA,EAAa,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG3B,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY;AAAA,cACZ,WAAU;AAAA,cAEV,UAAA,oBAAC,kBAAA,EAAiB,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG/B,oBAAoB,oBAAC,qBAAA,EAAoB,OAAO,aAAa,WAAU,gBAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG9F;AACF;AAEA,gBAAgB,cAAc;"}
1
+ {"version":3,"file":"UserDisplayName.mjs","sources":["../../../src/components/UserDisplayName/UserDisplayName.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { AIDisclosureIcon } from \"../Icons/AIDisclosureIcon\";\nimport { VerifiedIcon } from \"../Icons/VerifiedIcon\";\nimport { ProfileOnlineStatus } from \"../ProfileOnlineStatus/ProfileOnlineStatus\";\n\nexport interface UserDisplayNameProps extends React.HTMLAttributes<HTMLElement> {\n /** Render an AI-disclosure badge after the name, alongside any status badge. */\n aiDisclosure?: boolean;\n /** Accessible label for the AI-disclosure badge. @default \"AI creator\" */\n aiDisclosureLabel?: string;\n /** Render an ambassador badge after the name. */\n ambassador?: boolean;\n /** Accessible label for the ambassador badge. @default \"Ambassador\" */\n ambassadorLabel?: string;\n /** HTML element used for the root wrapper. @default \"span\" */\n component?: \"span\" | \"h1\" | \"h2\" | \"h3\" | \"p\" | \"div\";\n /** Truncate the display name on a single line. @default true */\n noWrap?: boolean;\n /** Accessible label for the online-status indicator. @default \"Online\" */\n onlineLabel?: string;\n /** Render the inline online-status indicator after the name. @default false */\n showOnlineStatus?: boolean;\n /** Render a verified badge after the name (ignored when `ambassador` is set). */\n verified?: boolean;\n /** Accessible label for the verified badge. @default \"Verified\" */\n verifiedLabel?: string;\n}\n\n/**\n * Renders a user's display name with optional ambassador/verified badges and an\n * online-status indicator. Only the name shrinks and truncates; trailing badges\n * and the online-status indicator stay visible on the same line.\n *\n * Typography is not baked in: pass a `typography-*` utility via `className` on\n * the root and the name inherits it. Use `typography-body-small-14px-semibold`\n * for the standard display-name scale.\n *\n * When both `ambassador` and `verified` are set, the ambassador badge takes\n * precedence. `aiDisclosure` is independent of both and renders after whichever\n * status badge is shown, since it discloses how the account is operated rather\n * than ranking it.\n *\n * The verified and AI-disclosure badges inherit the name's colour, so setting a\n * colour on the root tints them with it. That keeps them legible on surfaces\n * that fix their own text colour — over a cover image, for example, where a\n * theme-dependent tint would turn black against white text in light mode.\n *\n * The ambassador tint is deliberately not inherited: it uses `text-success-content`\n * (not `text-icons-brand-green`) so the green darkens in light mode and lightens\n * in dark mode, matching {@link ProfileOnlineStatus}; `text-icons-brand-green` is\n * fixed across modes.\n *\n * @example\n * ```tsx\n * <UserDisplayName className=\"typography-body-small-14px-semibold\">Jane Doe</UserDisplayName>\n * ```\n */\nexport const UserDisplayName = React.forwardRef<HTMLElement, UserDisplayNameProps>(\n (\n {\n aiDisclosure,\n aiDisclosureLabel = \"AI creator\",\n ambassador,\n ambassadorLabel = \"Ambassador\",\n children,\n className,\n component = \"span\",\n noWrap = true,\n onlineLabel = \"Online\",\n showOnlineStatus,\n verified,\n verifiedLabel = \"Verified\",\n ...props\n },\n ref,\n ) => {\n const Component = component as React.ElementType;\n\n const badge = ambassador\n ? { label: ambassadorLabel, tint: \"text-success-content\" }\n : verified\n ? { label: verifiedLabel, tint: \"text-current\" }\n : null;\n\n return (\n <Component\n ref={ref}\n className={cn(\"inline-flex max-w-full items-center\", className)}\n {...props}\n >\n <span className={cn(\"min-w-0\", noWrap && \"truncate\")}>{children}</span>\n {badge && (\n <span\n role=\"img\"\n aria-label={badge.label}\n className={cn(\"ml-2 inline-flex shrink-0 items-center\", badge.tint)}\n >\n <VerifiedIcon size={16} />\n </span>\n )}\n {aiDisclosure && (\n <span\n role=\"img\"\n aria-label={aiDisclosureLabel}\n className=\"ml-2 inline-flex shrink-0 items-center text-current\"\n >\n <AIDisclosureIcon size={16} />\n </span>\n )}\n {showOnlineStatus && <ProfileOnlineStatus label={onlineLabel} className=\"ml-2 shrink-0\" />}\n </Component>\n );\n },\n);\n\nUserDisplayName.displayName = \"UserDisplayName\";\n"],"names":[],"mappings":";;;;;;;AA0DO,MAAM,kBAAkB,MAAM;AAAA,EACnC,CACE;AAAA,IACE;AAAA,IACA,oBAAoB;AAAA,IACpB;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,YAAY;AAElB,UAAM,QAAQ,aACV,EAAE,OAAO,iBAAiB,MAAM,uBAAA,IAChC,WACE,EAAE,OAAO,eAAe,MAAM,mBAC9B;AAEN,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,uCAAuC,SAAS;AAAA,QAC7D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,oBAAC,UAAK,WAAW,GAAG,WAAW,UAAU,UAAU,GAAI,UAAS;AAAA,UAC/D,SACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY,MAAM;AAAA,cAClB,WAAW,GAAG,0CAA0C,MAAM,IAAI;AAAA,cAElE,UAAA,oBAAC,cAAA,EAAa,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG3B,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,cAAY;AAAA,cACZ,WAAU;AAAA,cAEV,UAAA,oBAAC,kBAAA,EAAiB,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,UAG/B,oBAAoB,oBAAC,qBAAA,EAAoB,OAAO,aAAa,WAAU,gBAAA,CAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAG9F;AACF;AAEA,gBAAgB,cAAc;"}