@plexui/ui 0.46.0 → 0.47.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.
@@ -20,7 +20,7 @@ export const Tabs = ({ overflow = "scroll", overflowLabel = "More", ...props })
20
20
  }
21
21
  return _jsx(TabsRoot, { ...props });
22
22
  };
23
- const TabsRoot = ({ value, onChange, children, variant = "segmented", orientation = "horizontal", block, pill = true, flush, size = "md", gutterSize, mobileMaterial, className, onClick, ...restProps }) => {
23
+ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientation = "horizontal", block, pill = true, flush, size = "md", gutterSize, mobileMaterial, mobileSegmentWidth, className, onClick, ...restProps }) => {
24
24
  const rootRef = useRef(null);
25
25
  const thumbRef = useRef(null);
26
26
  const prevSizeRef = useRef(size);
@@ -190,7 +190,8 @@ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientatio
190
190
  });
191
191
  });
192
192
  }
193
- }, [applyThumbSizing, value, size, gutterSize, pill, flush, transitionProperty]);
193
+ // mobileSegmentWidth moves the segments with nothing else changing: the thumb follows them
194
+ }, [applyThumbSizing, value, size, gutterSize, pill, flush, mobileSegmentWidth, transitionProperty]);
194
195
  const handleValueChange = (nextValue) => {
195
196
  // Only trigger onChange when a value exists
196
197
  // Disallow toggling off enabled items
@@ -201,7 +202,7 @@ const TabsRoot = ({ value, onChange, children, variant = "segmented", orientatio
201
202
  const isPill = variant === "segmented" && pill;
202
203
  // Only apply flush for underline variant
203
204
  const isFlush = variant === "underline" && flush;
204
- return (_jsxs(ToggleGroup.Root, { ref: rootRef, className: clsx(s.Tabs, className), type: "single", value: value, loop: false, onValueChange: handleValueChange, onClick: onClick, "data-variant": variant, "data-orientation": orientation, "data-block": block ? "" : undefined, "data-pill": isPill ? "" : undefined, "data-flush": isFlush ? "" : undefined, "data-size": size, "data-gutter-size": gutterSize, "data-mobile-material": mobileMaterial, "data-disabled": restProps.disabled ? "" : undefined, ...restProps, children: [_jsx("div", { className: s.TabsThumb, ref: thumbRef }), _jsx(TabsVerticalContext.Provider, { value: isVertical, children: children })] }));
205
+ return (_jsxs(ToggleGroup.Root, { ref: rootRef, className: clsx(s.Tabs, className), type: "single", value: value, loop: false, onValueChange: handleValueChange, onClick: onClick, "data-variant": variant, "data-orientation": orientation, "data-block": block ? "" : undefined, "data-pill": isPill ? "" : undefined, "data-flush": isFlush ? "" : undefined, "data-size": size, "data-gutter-size": gutterSize, "data-mobile-material": mobileMaterial, "data-mobile-segment-width": mobileSegmentWidth, "data-disabled": restProps.disabled ? "" : undefined, ...restProps, children: [_jsx("div", { className: s.TabsThumb, ref: thumbRef }), _jsx(TabsVerticalContext.Provider, { value: isVertical, children: children })] }));
205
206
  };
206
207
  // Type guard for badge object form
207
208
  const isBadgeObject = (badge) => {
@@ -441,8 +442,8 @@ const MoreTab = (props) => {
441
442
  const OverflowTabs = ({ children, value, onChange, overflowLabel, ...restProps }) => {
442
443
  const items = tabElements(children);
443
444
  // The strip's own props size the tabs and the menu button too
444
- const { size, variant, gutterSize, pill, flush, mobileMaterial } = restProps;
445
- const signature = [overflowLabel, size, variant, gutterSize, pill, flush, mobileMaterial, tabsSignature(items)].join("\u0002");
445
+ const { size, variant, gutterSize, pill, flush, mobileMaterial, mobileSegmentWidth } = restProps;
446
+ const signature = [overflowLabel, size, variant, gutterSize, pill, flush, mobileMaterial, mobileSegmentWidth, tabsSignature(items)].join("\u0002");
446
447
  const activeIndex = items.findIndex((item) => item.props.value === value);
447
448
  // null while the measuring pass renders every tab and the menu button
448
449
  const [visibleCount, setVisibleCount] = useState(null);
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb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AAE,CAAC,IAAS,CAAC,YAC7E,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;4BACnB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;4BACzC,OAAO,CACL,MAAC,IAAI,CAAC,SAAS,IAEb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,QAAQ,EAAE,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,aAElD,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAEnE,KAAK,KAAK,EAAE,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,aAAa,YAAG,KAAK,GAAQ,KAP5D,IAAI,CAAC,KAAK,CAAC,KAAK,CAQN,CAClB,CAAA;wBACH,CAAC,CAAC,GACc,GACL,IACV,GACH,CACP,CAAA;AACH,CAAC,CAAA;AAED,wBAAwB;AACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;AACd,wBAAwB;AACxB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { ToggleGroup } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { useResizeObserver } from \"usehooks-ts\"\nimport { handlePressableMouseEnter, prefersReducedMotion, waitForAnimationFrame } from \"../../lib/helpers\"\nimport { type ControlSize, type SemanticColors, type Sizes, type Variants } from \"../../types\"\nimport { CheckMd, ChevronDownMd } from \"../Icon\"\nimport { LoadingIndicator } from \"../Indicator\"\nimport { Menu } from \"../Menu\"\nimport { visibleTabCount } from \"./overflow\"\nimport { equalizeSegments, watchSegments } from \"./segments\"\nimport s from \"@plexui/styles/components/Tabs/Tabs.module.css\"\n\nexport type SizeVariant = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nexport type TabsVariant = \"segmented\" | \"underline\"\nexport type TabsOrientation = \"horizontal\" | \"vertical\"\n\nexport type TabsProps<T extends string> = {\n /**\n * Controlled value for the group\n */\n \"value\": T\n /** Callback for when a new value is selected */\n \"onChange\"?: (nextValue: T) => void\n /** Callback any time the control is clicked (even if a new value was not selected) */\n \"onClick\"?: () => void\n /**\n * Text read aloud to screen readers when the control is focused\n */\n \"aria-label\": string\n /**\n * Visual variant of the tab group\n * - `\"segmented\"` — background container with sliding highlight (default)\n * - `\"underline\"` — no background, animated line indicator under active tab\n * @default \"segmented\"\n */\n \"variant\"?: TabsVariant\n /**\n * Orientation of the tab layout\n * @default \"horizontal\"\n */\n \"orientation\"?: TabsOrientation\n /**\n * Controls the size of the tabs\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n *\n * On a phone horizontal tabs take the two sizes of the iOS 27 segmented control: `sm` and smaller the small 32px\n * one, `md` and larger the large 48px one (49px with `mobileMaterial=\"flat\"`).\n *\n * @default md\n */\n \"size\"?: ControlSize\n /**\n * Controls gutter on the edges of the button, defaults to value from `size`.\n *\n * | 2xs | xs | sm | md | lg | xl |\n * | ------ | ------ | ------ | ------ | ------ | ------ |\n * | `6px` | `8px` | `10px` | `12px` | `14px` | `16px` |\n */\n \"gutterSize\"?: Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">\n /** Disable the entire group */\n \"disabled\"?: boolean\n /**\n * Display the control as a block element with equal width segments\n * @default false\n */\n \"block\"?: boolean\n /**\n * Determines if the tabs should be a fully rounded pill shape.\n * Only applies to the `\"segmented\"` variant.\n * @default true\n */\n \"pill\"?: boolean\n /**\n * Flush underline style — removes tab padding so the indicator\n * matches the text width exactly, uses gap for spacing, and\n * removes the bottom border.\n * Only applies to the `\"underline\"` variant.\n * @default false\n */\n \"flush\"?: boolean\n /**\n * What happens to tabs that do not fit in one row: the strip scrolls\n * sideways (`scroll`), or the tabs that do not fit move into a menu at the\n * end of the strip (`menu`). The menu button shows the active tab's name\n * when it is one of the hidden ones. Horizontal tabs without `block` only.\n * @default \"scroll\"\n */\n \"overflow\"?: \"scroll\" | \"menu\"\n /**\n * Text of the menu button with `overflow=\"menu\"`\n * @default \"More\"\n */\n \"overflowLabel\"?: string\n /**\n * Phone surface of horizontal tabs. On a phone the large control (`md` and larger) is the glass capsule of iOS 27\n * apps and the small one (`sm` and smaller) the plain capsule of SwiftUI's segmented Picker; `flat` gives the large\n * one the plain look of SwiftUI's `.controlSize(.large)`, and `glass` gives the small one `.glassEffect()`, as the\n * Button prop of the same name does for a button. Inside a phone Toolbar the control is the large glass one\n * anyway. Desktop keeps the chosen variant.\n * @default \"glass\" at md and larger, \"flat\" at sm and smaller\n */\n \"mobileMaterial\"?: \"glass\" | \"flat\"\n \"className\"?: string\n \"children\": React.ReactNode\n}\n\n/** Vertical tabs are a list on a phone, where the selected row shows a checkmark */\nconst TabsVerticalContext = createContext(false)\n\nexport const Tabs = <T extends string>({ overflow = \"scroll\", overflowLabel = \"More\", ...props }: TabsProps<T>) => {\n if (overflow === \"menu\" && !props.block && props.orientation !== \"vertical\") {\n return <OverflowTabs {...props} overflowLabel={overflowLabel} />\n }\n return <TabsRoot {...props} />\n}\n\nconst TabsRoot = <T extends string>({\n value,\n onChange,\n children,\n variant = \"segmented\",\n orientation = \"horizontal\",\n block,\n pill = true,\n flush,\n size = \"md\",\n gutterSize,\n mobileMaterial,\n className,\n onClick,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\" | \"overflowLabel\">) => {\n const rootRef = useRef<HTMLDivElement>(null)\n const thumbRef = useRef<HTMLDivElement>(null)\n const prevSizeRef = useRef(size)\n const prevValueRef = useRef(value)\n const isVertical = orientation === \"vertical\"\n\n const applyThumbSizing = useCallback(\n (attemptScroll: boolean) => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n // Get selected node\n const activeNode = root?.querySelector<HTMLDivElement>('[data-state=\"on\"]')\n\n // Impossible\n if (!activeNode) {\n return\n }\n\n if (isVertical) {\n const rootHeight = root.clientHeight\n let targetHeight = Math.floor(activeNode.clientHeight)\n const targetOffset = activeNode.offsetTop\n\n // Detect subpixel edge case\n if (rootHeight - (targetHeight + targetOffset) < 2) {\n targetHeight = targetHeight - 1\n }\n\n thumb.style.height = `${Math.floor(targetHeight)}px`\n thumb.style.width = \"\"\n thumb.style.transform = `translateY(${targetOffset}px)`\n\n // Scroll into view if needed\n if (root.scrollHeight > rootHeight) {\n const buffer = rootHeight * 0.15\n const scrollTop = root.scrollTop\n const top = activeNode.offsetTop\n const bottom = top + targetHeight\n if (top < scrollTop + buffer || bottom > scrollTop + rootHeight - buffer) {\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ top: top - (rootHeight - targetHeight) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n } else {\n const rootWidth = root.clientWidth\n let targetWidth = Math.floor(activeNode.clientWidth)\n const targetOffset = activeNode.offsetLeft\n\n // Detect if the thumb is moving too far to the edge of the container.\n // This would most commonly be due to subpixel widths adding up to excessive distance.\n if (rootWidth - (targetWidth + targetOffset) < 2) {\n targetWidth = targetWidth - 1\n }\n\n thumb.style.width = `${Math.floor(targetWidth)}px`\n thumb.style.height = \"\"\n thumb.style.transform = `translateX(${targetOffset}px)`\n\n // If the control is scrollable, ensure the active option is visible\n if (root.scrollWidth > rootWidth) {\n // Only scroll items near the edge, but not the inner 2/3.\n const buffer = rootWidth * 0.15\n const scrollLeft = root.scrollLeft\n const left = activeNode.offsetLeft\n const right = left + targetWidth\n if (left < scrollLeft + buffer || right > scrollLeft + rootWidth - buffer) {\n // Cheap trick to avoid unintentional scroll on mount - transition is set after mounting\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ left: left - (rootWidth - targetWidth) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n }\n },\n [isVertical],\n )\n\n useResizeObserver({\n // @ts-expect-error(2322) -- bug in types: https://github.com/juliencrn/usehooks-ts/issues/663\n ref: rootRef,\n onResize: () => {\n const thumb = thumbRef.current\n\n if (!thumb) {\n return\n }\n\n // Perform the size update instantly\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n },\n })\n\n // Tabs added, removed, reordered or relabelled move the active tab without\n // resizing the group: measure again, instantly, like a resize\n useEffect(() => {\n const root = rootRef.current\n if (!root || typeof MutationObserver === \"undefined\") return\n const observer = new MutationObserver(() => {\n const thumb = thumbRef.current\n if (!thumb) return\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n })\n observer.observe(root, { childList: true, characterData: true, subtree: true })\n return () => observer.disconnect()\n }, [applyThumbSizing])\n\n // A phone's segmented control at its own width gives every segment the widest one's width, as UISegmentedControl\n // does in iOS 27.2; where that does not fit, each segment takes its label and the same air around it, as\n // apportionsSegmentWidthsByContent does (ref-app segmented-hug, 13.11). A grid that hugs its content cannot take the\n // widest track for each by itself, so this measures it. Runs before the thumb measures (declared first).\n useLayoutEffect(() => {\n equalizeSegments(rootRef.current, thumbRef.current)\n })\n\n useEffect(() => {\n const root = rootRef.current\n if (!root) return\n // The room, the breakpoint or the font changes. The segments can change without the control changing size, so the\n // thumb follows them here, instantly, like a resize.\n return watchSegments(root, () => thumbRef.current, () => {\n const thumb = thumbRef.current\n if (!thumb) return\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n })\n }, [applyThumbSizing])\n\n const transitionProperty = isVertical\n ? \"height var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))\"\n : \"width var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))\"\n\n useLayoutEffect(() => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n const sizeChanged = prevSizeRef.current !== size\n prevSizeRef.current = size\n const valueChanged = prevValueRef.current !== value\n prevValueRef.current = value\n\n if (sizeChanged) {\n // Size changed - disable transition, wait for CSS, then apply sizing\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = currentTransition\n })\n })\n } else if (thumb.style.transition) {\n // Normal update (value change, etc.): the thumb leaves with the label's colour\n const from = valueChanged ? thumbBox(thumb) : null\n applyThumbSizing(true)\n if (valueChanged) playThumbLens(thumb, from)\n } else {\n // First measure: apply transition after initial calculation is set\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = transitionProperty\n })\n })\n }\n }, [applyThumbSizing, value, size, gutterSize, pill, flush, transitionProperty])\n\n const handleValueChange = (nextValue: T) => {\n // Only trigger onChange when a value exists\n // Disallow toggling off enabled items\n if (nextValue && onChange) onChange(nextValue)\n }\n\n // Only apply pill for segmented variant\n const isPill = variant === \"segmented\" && pill\n // Only apply flush for underline variant\n const isFlush = variant === \"underline\" && flush\n\n return (\n <ToggleGroup.Root\n ref={rootRef}\n className={clsx(s.Tabs, className)}\n type=\"single\"\n value={value}\n loop={false}\n onValueChange={handleValueChange}\n onClick={onClick}\n data-variant={variant}\n data-orientation={orientation}\n data-block={block ? \"\" : undefined}\n data-pill={isPill ? \"\" : undefined}\n data-flush={isFlush ? \"\" : undefined}\n data-size={size}\n data-gutter-size={gutterSize}\n data-mobile-material={mobileMaterial}\n data-disabled={restProps.disabled ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.TabsThumb} ref={thumbRef} />\n <TabsVerticalContext.Provider value={isVertical}>{children}</TabsVerticalContext.Provider>\n </ToggleGroup.Root>\n )\n}\n\n/**\n * Badge configuration for Tabs.Tab\n */\nexport type TabsBadgeProp =\n | React.ReactNode\n | {\n content: React.ReactNode\n color?: SemanticColors<\n \"secondary\" | \"success\" | \"danger\" | \"warning\" | \"info\" | \"discovery\" | \"caution\"\n >\n variant?: Variants<\"soft\" | \"solid\">\n pill?: boolean\n loading?: boolean\n }\n\nexport type TabProps = {\n /**\n * Tab value\n */\n \"value\": string\n /**\n * Text read aloud to screen readers when the tab is focused\n */\n \"aria-label\"?: string\n /**\n * Text content to render in the tab\n */\n \"children\"?: React.ReactNode\n /**\n * Icon to render before the text content\n */\n \"icon\"?: React.ReactNode\n /**\n * Badge to render after the text content.\n * Can be a simple value or an object with content, color, variant, and loading options.\n * @example badge={5}\n * @example badge={{ content: 5, color: \"danger\" }}\n */\n \"badge\"?: TabsBadgeProp\n /**\n * Disable the individual tab\n */\n \"disabled\"?: boolean\n}\n\n// Type guard for badge object form\nconst isBadgeObject = (\n badge: TabsBadgeProp,\n): badge is Exclude<TabsBadgeProp, React.ReactNode> & { content: React.ReactNode } => {\n return badge != null && typeof badge === \"object\" && \"content\" in badge\n}\n\n/** True when an icon draws text of its own: a string, a number, or a fragment or array holding one */\n\n/** A text icon (\"☀\") stands in an element, as an icon component does, so a phone can hide it beside a label: each\n * text in a fragment or array gets its own span and the elements beside it stay in place. An empty one draws\n * nothing. */\n// Arrays and fragments always go through Children.map, with or without text, so their children keep the same keys\n// when a text child comes or goes; a fragment keeps its element and key, so a new key still remounts its icons.\n/** On a phone the large control's selection travels as a lens of glass, as iOS 27.2 draws it. Recorded frame by frame\n * 11.11 (ref-app segmented-bar-text4, a toolbar Picker of Day, Week, Month and Year switched Day to Year and back,\n * after the owner's «анимация не правильная и стиль» and «day<->year пробуй переключать»; segmented-bar-symbols, a\n * segment away, before it): the gray selection clears into a lens within 45ms, taller than the capsule (11pt) and\n * wider the faster it goes (36pt at 200ms), and carries across; it lands as the gray selection again by 300ms,\n * pressed against its segment's far side (7pt narrower, 6pt taller and its centre 2.5% of the way past at 430ms), and\n * springs back by 750ms while the label under it dims to 76% and comes back. The centre's path is a share of the\n * distance and the growth is in points, as both recordings show: as much growth a segment away as three. touch.css\n * names the lens's growth on the large control only, so everywhere else the selection just slides with its\n * transition. CSS has no refraction, so the lens is its rim, its tint and the capsule's edge seen through it. */\nlet lensRun = 0\nconst LENS_ID = \"segmented-control-lens\"\nconst LENS_DURATION = 750\n// At each measured frame: [ms, the centre's share of the distance, share of the growth's width, share of its height]\nconst LENS_PATH = [\n [0, 0, 0, 0],\n [10, 0.014, 0.036, 0.065],\n [32, 0.077, 0.13, 0.19],\n [47, 0.169, 0.22, 0.44],\n [70, 0.378, 0.44, 0.87],\n [92, 0.478, 0.52, 1],\n [125, 0.647, 0.7, 0.93],\n [150, 0.773, 0.85, 0.87],\n [182, 0.856, 0.96, 0.93],\n [205, 0.9, 1, 1],\n [227, 0.932, 0.96, 0.93],\n [245, 0.951, 0.8, 0.44],\n [262, 0.964, 0.67, 0.31],\n [295, 0.989, 0.37, 0.31],\n [330, 1.005, 0.13, 0.31],\n [363, 1.016, -0.02, 0.37],\n [395, 1.023, -0.13, 0.5],\n [430, 1.025, -0.19, 0.56],\n [497, 1.022, -0.19, 0.56],\n [545, 1.018, -0.17, 0.37],\n [597, 1.014, -0.11, 0.25],\n [647, 1.007, -0.075, 0.12],\n [697, 1.004, -0.036, 0],\n [750, 1, 0, 0],\n] as const\n// The selected label's opacity as the lens lands: [ms, opacity]\nconst LENS_LABEL = [\n [0, 1],\n [380, 1],\n [428, 0.77],\n [460, 0.76],\n [515, 0.85],\n [580, 0.93],\n [650, 0.98],\n [713, 1],\n [750, 1],\n] as const\ntype ThumbBox = { x: number; width: number }\ntype LensRun = { from: ThumbBox; to: ThumbBox; move: Animation; label?: Animation }\nconst lensRuns = new WeakMap<HTMLElement, LensRun>()\nconst round = (value: number) => Math.round(value * 100) / 100\n// The box the lens draws at a time of its run\nconst lensBox = ({ from, to }: LensRun, ms: number, growth: number): ThumbBox => {\n const next = LENS_PATH.findIndex(([time]) => time >= ms)\n const at = next < 0 ? LENS_PATH.length - 1 : Math.max(1, next)\n const [t0, share0, wide0] = LENS_PATH[at - 1]\n const [t1, share1, wide1] = LENS_PATH[Math.min(at, LENS_PATH.length - 1)]\n const k = t1 > t0 ? Math.min(1, Math.max(0, (ms - t0) / (t1 - t0))) : 1\n const share = share0 + (share1 - share0) * k\n const width = from.width + (to.width - from.width) * Math.min(share, 1) + growth * (wide0 + (wide1 - wide0) * k)\n return { x: from.x + from.width / 2 + (to.x + to.width / 2 - from.x - from.width / 2) * share - width / 2, width }\n}\n/** Where a horizontal thumb is drawn, from its control's left edge: where the script set it, or where a lens still\n * on its way has it, so a switch mid-flight sets off from there */\nconst thumbBox = (thumb: HTMLElement): ThumbBox | null => {\n const offset = /^translateX\\((-?[\\d.]+)px\\)$/.exec(thumb.style.transform)\n const width = parseFloat(thumb.style.width)\n if (!offset || !(width > 0)) return null\n const run = lensRuns.get(thumb)\n const ms = Number(run?.move.currentTime)\n if (run && (run.move.playState === \"running\" || run.move.playState === \"paused\") && ms >= 0) {\n const growth = lensGrowth(getComputedStyle(thumb))\n if (growth) return lensBox(run, ms, growth[0])\n }\n return { x: parseFloat(offset[1]), width }\n}\n// The lens's growth at its widest and tallest, which touch.css names on the large control only\nconst lensGrowth = (style: CSSStyleDeclaration) => {\n const [wide = Number.NaN, tall = wide] = style.getPropertyValue(\"--segmented-control-thumb-lens-outset\").trim().split(/\\s+/).map(parseFloat)\n return wide >= 0 && tall >= 0 ? ([wide, tall] as const) : null\n}\nconst playThumbLens = (thumb: HTMLElement, from: ThumbBox | null) => {\n if (typeof thumb.animate !== \"function\") return\n // A lens still on its way ends first, so the thumb's own fill and edge are read below (and none outlives a switch\n // to reduced motion)\n thumb.getAnimations().forEach((animation) => {\n if (animation.id === LENS_ID) animation.cancel()\n })\n lensRuns.get(thumb)?.label?.cancel()\n lensRuns.delete(thumb)\n if (!from || prefersReducedMotion()) return\n const style = getComputedStyle(thumb)\n const growth = lensGrowth(style)\n const to = thumbBox(thumb)\n const top = parseFloat(style.top)\n const bottom = parseFloat(style.bottom)\n if (!growth || !to || !Number.isFinite(top) || !Number.isFinite(bottom)) return\n const [wide, tall] = growth\n const timing = { id: LENS_ID, duration: LENS_DURATION }\n const run: LensRun = { from, to, move: undefined as unknown as Animation }\n // The thumb's box at each frame replaces its own while the lens runs (its transition is overridden); the height\n // grows about the middle\n run.move = thumb.animate(\n LENS_PATH.map(([ms, , , high]) => {\n const box = lensBox(run, ms, wide)\n const grown = (tall * high) / 2\n return {\n offset: ms / LENS_DURATION,\n transform: `translateX(${round(box.x)}px)`,\n width: `${round(Math.max(1, box.width))}px`,\n top: `${round(top - grown)}px`,\n bottom: `${round(bottom - grown)}px`,\n }\n }),\n timing,\n )\n const lens = {\n backgroundColor: style.getPropertyValue(\"--segmented-control-thumb-lens-background\").trim(),\n boxShadow: style.getPropertyValue(\"--segmented-control-thumb-lens-shadow\").trim(),\n }\n const rest = { backgroundColor: style.backgroundColor, boxShadow: style.boxShadow }\n // The gray clears as the lens lifts (45ms) and comes back as it lands (250 to 300ms)\n const fill = thumb.animate(\n [\n { offset: 0, ...rest },\n { offset: 45 / LENS_DURATION, ...lens },\n { offset: 250 / LENS_DURATION, ...lens },\n { offset: 300 / LENS_DURATION, ...rest },\n { offset: 1, ...rest },\n ],\n timing,\n )\n const root = thumb.parentElement\n const selected = root?.querySelector<HTMLElement>('[data-state=\"on\"]')\n if (selected && typeof selected.animate === \"function\") {\n run.label = selected.animate(\n LENS_LABEL.map(([ms, opacity]) => ({ offset: ms / LENS_DURATION, opacity })),\n timing,\n )\n }\n lensRuns.set(thumb, run)\n // The frame a switch is drawn in also lays out whatever the switch changes around the control, which can take a\n // few frames' time; the lens holds its first frame until then and sets off from the next, so none of its way is\n // skipped (a tap's first 45ms were, recorded in Safari 11.11)\n if (typeof requestAnimationFrame === \"function\") {\n const held = [run.move, fill, run.label].filter((animation): animation is Animation => typeof animation?.pause === \"function\")\n held.forEach((animation) => animation.pause())\n requestAnimationFrame(() => {\n held.forEach((animation) => {\n if (animation.playState === \"paused\") animation.play()\n })\n })\n }\n // The lens reaches past the capsule, which clips what scrolls in it: a control whose segments all fit lets it out\n // for the switch\n if (!root || root.scrollWidth > root.clientWidth + 1) return\n const id = String(++lensRun)\n root.setAttribute(\"data-lens\", id)\n const done = () => {\n if (root.getAttribute(\"data-lens\") === id) root.removeAttribute(\"data-lens\")\n }\n if (run.move?.finished) run.move.finished.then(done, done)\n else done()\n}\n\nconst renderTabIcon = (icon: React.ReactNode): React.ReactNode => {\n if (icon === \"\") return null\n if (typeof icon === \"string\" || typeof icon === \"number\") return <span>{icon}</span>\n if (Array.isArray(icon)) return Children.map(icon, renderTabIcon)\n if (isValidElement<{ children?: React.ReactNode }>(icon) && icon.type === Fragment) {\n return cloneElement(icon, undefined, Children.map(icon.props.children, renderTabIcon))\n }\n return icon\n}\n\nconst Tab = ({ children, icon, badge, ...restProps }: TabProps) => {\n // Normalize badge prop\n const badgeProps = badge != null ? (isBadgeObject(badge) ? badge : { content: badge }) : null\n const vertical = useContext(TabsVerticalContext)\n\n return (\n <ToggleGroup.Item\n className={s.Tab}\n {...restProps}\n onPointerEnter={handlePressableMouseEnter}\n >\n <span className={s.TabContent}>\n {renderTabIcon(icon)}\n {children && <span className={s.TabLabel}>{children}</span>}\n {badgeProps && (\n <span\n className={s.TabBadge}\n data-color={badgeProps.color ?? \"secondary\"}\n data-variant={badgeProps.variant ?? \"soft\"}\n data-pill={badgeProps.pill ? \"\" : undefined}\n >\n {badgeProps.loading ? <LoadingIndicator /> : badgeProps.content}\n </span>\n )}\n </span>\n {vertical && <CheckMd className={s.TabCheckmark} aria-hidden=\"true\" />}\n </ToggleGroup.Item>\n )\n}\n\n// =============================================\n// overflow=\"menu\"\n// =============================================\n\n/** Value of the menu button; no real tab has it */\nconst MORE_VALUE = \"__plexui_tabs_more__\"\n\ntype TabElement = ReactElement<TabProps>\n\n/** The tabs among the children, through fragments */\nconst tabElements = (children: ReactNode): TabElement[] =>\n Children.toArray(children).flatMap((child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) return []\n return child.type === Fragment ? tabElements(child.props.children) : [child as TabElement]\n })\n\nconst plainText = (node: unknown): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node)\n if (Array.isArray(node)) return node.map(plainText).join(\"\")\n if (isValidElement<{ children?: ReactNode }>(node)) return plainText(node.props.children)\n return \"\"\n}\n\nconst badgeText = (badge: TabsBadgeProp | undefined) =>\n badge != null && isBadgeObject(badge) ? plainText(badge.content) : plainText(badge)\n\n/** A tab's name: its text, else its accessible name, else its value */\nconst tabLabel = (item: TabElement) => plainText(item.props.children) || item.props[\"aria-label\"] || item.props.value\n\n/** What a tab's width depends on: the strip measures again when it changes */\nconst tabsSignature = (items: TabElement[]) =>\n items\n .map((item) =>\n [item.props.value, plainText(item.props.children), badgeText(item.props.badge), item.props.icon != null].join(\"\\u0000\"),\n )\n .join(\"\\u0001\")\n\n/**\n * `Menu.Trigger` sets `data-state` (open or closed) on its child, while a tab\n * keeps `on` or `off` in the same attribute and the thumb finds the active tab\n * by it. The menu's value does not reach the tab; its handlers and\n * `aria-haspopup` / `aria-expanded` do.\n */\nconst MoreTab = (props: TabProps & { \"data-state\"?: string }) => {\n const restProps = { ...props }\n delete restProps[\"data-state\"]\n return <Tab {...restProps} />\n}\n\nconst OverflowTabs = <T extends string>({\n children,\n value,\n onChange,\n overflowLabel,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\"> & { overflowLabel: string }) => {\n const items = tabElements(children)\n // The strip's own props size the tabs and the menu button too\n const { size, variant, gutterSize, pill, flush, mobileMaterial } = restProps\n const signature = [overflowLabel, size, variant, gutterSize, pill, flush, mobileMaterial, tabsSignature(items)].join(\"\\u0002\")\n const activeIndex = items.findIndex((item) => item.props.value === value)\n\n // null while the measuring pass renders every tab and the menu button\n const [visibleCount, setVisibleCount] = useState<number | null>(null)\n const [known, setKnown] = useState({ signature, activeIndex })\n const hostRef = useRef<HTMLDivElement>(null)\n const measuringRef = useRef(true)\n const boxWidthRef = useRef(-1)\n\n // New tabs measure again. A new active tab measures again when it moves\n // under the menu button or back out: the button carries the hidden one's name\n if (known.signature !== signature || known.activeIndex !== activeIndex) {\n const crossed =\n visibleCount !== null && (known.activeIndex >= visibleCount || activeIndex >= visibleCount)\n setKnown({ signature, activeIndex })\n if (visibleCount !== null && (known.signature !== signature || crossed)) setVisibleCount(null)\n }\n\n useLayoutEffect(() => {\n measuringRef.current = visibleCount === null\n }, [visibleCount])\n\n useLayoutEffect(() => {\n if (visibleCount !== null) return\n const root = hostRef.current?.firstElementChild\n if (!(root instanceof HTMLElement)) return\n\n // The measuring pass renders every tab, then the menu button\n const buttons = Array.from(root.querySelectorAll<HTMLElement>(\":scope > button\"))\n if (buttons.length !== items.length + 1) return\n\n const widths = buttons.map((button) => button.getBoundingClientRect().width)\n const moreButton = buttons[buttons.length - 1]\n const moreWidth = widths.pop() ?? 0\n const style = getComputedStyle(root)\n const available =\n root.getBoundingClientRect().width -\n (Number.parseFloat(style.paddingLeft) || 0) -\n (Number.parseFloat(style.paddingRight) || 0)\n const gap = Number.parseFloat(style.columnGap) || 0\n boxWidthRef.current = hostRef.current?.parentElement?.clientWidth ?? -1\n\n // A hidden strip has no width to decide by: show every tab, and measure\n // when it appears (the observer sees the width change)\n if (available <= 0) {\n // Resolve the zero-width measuring pass before paint; the resize observer\n // restarts measurement when this hidden strip becomes visible.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setVisibleCount(items.length)\n return\n }\n\n // The button with the active tab's name: that tab's width plus the chevron\n const chevron = moreButton?.querySelector(\"svg\")\n const chevronWidth = chevron?.getBoundingClientRect().width ?? 0\n const labelGap = chevron?.parentElement ? Number.parseFloat(getComputedStyle(chevron.parentElement).columnGap) || 0 : 0\n const activeWidth = activeIndex < 0 ? 0 : (widths[activeIndex] ?? 0) + chevronWidth + labelGap\n\n // This result depends on committed DOM widths. Apply it before first paint\n // so the temporary full strip never flashes before overflowing tabs move.\n setVisibleCount(visibleTabCount(widths, moreWidth, activeWidth, activeIndex, gap, available))\n }, [visibleCount, items.length, activeIndex])\n\n // The width to fit is the container's, not the strip's: the strip shrinks\n // to its content. Reports during a measuring pass are skipped, since the\n // full strip may be pushing its container wider\n useEffect(() => {\n const box = hostRef.current?.parentElement\n if (!box || typeof ResizeObserver === \"undefined\") return\n const observer = new ResizeObserver(() => {\n if (measuringRef.current) return\n const width = box.clientWidth\n if (width === boxWidthRef.current) return\n boxWidthRef.current = width\n setVisibleCount(null)\n })\n observer.observe(box)\n return () => observer.disconnect()\n }, [])\n\n const measuring = visibleCount === null\n const shown = measuring ? items : items.slice(0, visibleCount)\n const hidden = measuring ? [] : items.slice(visibleCount)\n const hiddenActive = hidden.find((item) => item.props.value === value) ?? null\n\n return (\n <div ref={hostRef} className={s.OverflowHost}>\n <Menu>\n <TabsRoot<string>\n {...restProps}\n data-overflow=\"menu\"\n value={hiddenActive ? MORE_VALUE : value}\n onChange={(next) => {\n // Pressing the menu button opens the menu; it is not a tab\n if (next !== MORE_VALUE) onChange?.(next as T)\n }}\n >\n {/* Keyed by value: tabs from different fragments may share a key */}\n {shown.map((item) => cloneElement(item, { key: item.props.value }))}\n {(measuring || hidden.length > 0) && (\n <Menu.Trigger>\n <MoreTab value={MORE_VALUE}>\n <span className={s.OverflowLabel}>\n {hiddenActive ? tabLabel(hiddenActive) : overflowLabel}\n <ChevronDownMd />\n </span>\n </MoreTab>\n </Menu.Trigger>\n )}\n </TabsRoot>\n <Menu.Content align=\"end\" minWidth=\"auto\">\n <Menu.RadioGroup<string> value={value} onChange={(next) => onChange?.(next as T)}>\n {hidden.map((item) => {\n const count = badgeText(item.props.badge)\n return (\n <Menu.RadioItem<string>\n key={item.props.value}\n value={item.props.value}\n disabled={restProps.disabled || item.props.disabled}\n >\n {item.props.icon}\n {item.props.children ?? item.props[\"aria-label\"] ?? item.props.value}\n {/* A tab's count moves into the menu with it */}\n {count !== \"\" && <span className={s.OverflowBadge}>{count}</span>}\n </Menu.RadioItem>\n )\n })}\n </Menu.RadioGroup>\n </Menu.Content>\n </Menu>\n </div>\n )\n}\n\n// Attach sub-components\nTabs.Tab = Tab\n// Backward-compat alias\nTabs.Option = Tab\n"]}
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC1G,OAAO,EAAoE,MAAM,aAAa,CAAA;AAC9F,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,IAAI,EAA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I,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAEnE,KAAK,KAAK,EAAE,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,aAAa,YAAG,KAAK,GAAQ,KAP5D,IAAI,CAAC,KAAK,CAAC,KAAK,CAQN,CAClB,CAAA;wBACH,CAAC,CAAC,GACc,GACL,IACV,GACH,CACP,CAAA;AACH,CAAC,CAAA;AAED,wBAAwB;AACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;AACd,wBAAwB;AACxB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { ToggleGroup } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { useResizeObserver } from \"usehooks-ts\"\nimport { handlePressableMouseEnter, prefersReducedMotion, waitForAnimationFrame } from \"../../lib/helpers\"\nimport { type ControlSize, type SemanticColors, type Sizes, type Variants } from \"../../types\"\nimport { CheckMd, ChevronDownMd } from \"../Icon\"\nimport { LoadingIndicator } from \"../Indicator\"\nimport { Menu } from \"../Menu\"\nimport { visibleTabCount } from \"./overflow\"\nimport { equalizeSegments, watchSegments } from \"./segments\"\nimport s from \"@plexui/styles/components/Tabs/Tabs.module.css\"\n\nexport type SizeVariant = \"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nexport type TabsVariant = \"segmented\" | \"underline\"\nexport type TabsOrientation = \"horizontal\" | \"vertical\"\n\nexport type TabsProps<T extends string> = {\n /**\n * Controlled value for the group\n */\n \"value\": T\n /** Callback for when a new value is selected */\n \"onChange\"?: (nextValue: T) => void\n /** Callback any time the control is clicked (even if a new value was not selected) */\n \"onClick\"?: () => void\n /**\n * Text read aloud to screen readers when the control is focused\n */\n \"aria-label\": string\n /**\n * Visual variant of the tab group\n * - `\"segmented\"` — background container with sliding highlight (default)\n * - `\"underline\"` — no background, animated line indicator under active tab\n * @default \"segmented\"\n */\n \"variant\"?: TabsVariant\n /**\n * Orientation of the tab layout\n * @default \"horizontal\"\n */\n \"orientation\"?: TabsOrientation\n /**\n * Controls the size of the tabs\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n *\n * On a phone horizontal tabs take the two sizes of the iOS 27 segmented control: `sm` and smaller the small 32px\n * one, `md` and larger the large 48px one (49px with `mobileMaterial=\"flat\"`).\n *\n * @default md\n */\n \"size\"?: ControlSize\n /**\n * Controls gutter on the edges of the button, defaults to value from `size`.\n *\n * | 2xs | xs | sm | md | lg | xl |\n * | ------ | ------ | ------ | ------ | ------ | ------ |\n * | `6px` | `8px` | `10px` | `12px` | `14px` | `16px` |\n */\n \"gutterSize\"?: Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">\n /** Disable the entire group */\n \"disabled\"?: boolean\n /**\n * Display the control as a block element with equal width segments\n * @default false\n */\n \"block\"?: boolean\n /**\n * Determines if the tabs should be a fully rounded pill shape.\n * Only applies to the `\"segmented\"` variant.\n * @default true\n */\n \"pill\"?: boolean\n /**\n * Flush underline style — removes tab padding so the indicator\n * matches the text width exactly, uses gap for spacing, and\n * removes the bottom border.\n * Only applies to the `\"underline\"` variant.\n * @default false\n */\n \"flush\"?: boolean\n /**\n * What happens to tabs that do not fit in one row: the strip scrolls\n * sideways (`scroll`), or the tabs that do not fit move into a menu at the\n * end of the strip (`menu`). The menu button shows the active tab's name\n * when it is one of the hidden ones. Horizontal tabs without `block` only.\n * @default \"scroll\"\n */\n \"overflow\"?: \"scroll\" | \"menu\"\n /**\n * Text of the menu button with `overflow=\"menu\"`\n * @default \"More\"\n */\n \"overflowLabel\"?: string\n /**\n * Phone surface of horizontal tabs. On a phone the large control (`md` and larger) is the glass capsule of iOS 27\n * apps and the small one (`sm` and smaller) the plain capsule of SwiftUI's segmented Picker; `flat` gives the large\n * one the plain look of SwiftUI's `.controlSize(.large)`, and `glass` gives the small one `.glassEffect()`, as the\n * Button prop of the same name does for a button. Inside a phone Toolbar the control is the large glass one\n * anyway. Desktop keeps the chosen variant.\n * @default \"glass\" at md and larger, \"flat\" at sm and smaller\n */\n \"mobileMaterial\"?: \"glass\" | \"flat\"\n /**\n * Widths of the segments of horizontal tabs on a phone, as UISegmentedControl sets them. `equal` gives every\n * segment the widest one's width, its default; `content` gives each its label and the same air around it, as\n * `apportionsSegmentWidthsByContent` does, for a compact control. Equal segments that do not fit take their labels'\n * widths anyway; where those still do not fit, the air beside each label narrows, to 4px, and what still does not\n * fit scrolls. A `block` control fills its row either way. Desktop tabs always take their labels' widths.\n * @default \"equal\"\n */\n \"mobileSegmentWidth\"?: \"equal\" | \"content\"\n \"className\"?: string\n \"children\": React.ReactNode\n}\n\n/** Vertical tabs are a list on a phone, where the selected row shows a checkmark */\nconst TabsVerticalContext = createContext(false)\n\nexport const Tabs = <T extends string>({ overflow = \"scroll\", overflowLabel = \"More\", ...props }: TabsProps<T>) => {\n if (overflow === \"menu\" && !props.block && props.orientation !== \"vertical\") {\n return <OverflowTabs {...props} overflowLabel={overflowLabel} />\n }\n return <TabsRoot {...props} />\n}\n\nconst TabsRoot = <T extends string>({\n value,\n onChange,\n children,\n variant = \"segmented\",\n orientation = \"horizontal\",\n block,\n pill = true,\n flush,\n size = \"md\",\n gutterSize,\n mobileMaterial,\n mobileSegmentWidth,\n className,\n onClick,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\" | \"overflowLabel\">) => {\n const rootRef = useRef<HTMLDivElement>(null)\n const thumbRef = useRef<HTMLDivElement>(null)\n const prevSizeRef = useRef(size)\n const prevValueRef = useRef(value)\n const isVertical = orientation === \"vertical\"\n\n const applyThumbSizing = useCallback(\n (attemptScroll: boolean) => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n // Get selected node\n const activeNode = root?.querySelector<HTMLDivElement>('[data-state=\"on\"]')\n\n // Impossible\n if (!activeNode) {\n return\n }\n\n if (isVertical) {\n const rootHeight = root.clientHeight\n let targetHeight = Math.floor(activeNode.clientHeight)\n const targetOffset = activeNode.offsetTop\n\n // Detect subpixel edge case\n if (rootHeight - (targetHeight + targetOffset) < 2) {\n targetHeight = targetHeight - 1\n }\n\n thumb.style.height = `${Math.floor(targetHeight)}px`\n thumb.style.width = \"\"\n thumb.style.transform = `translateY(${targetOffset}px)`\n\n // Scroll into view if needed\n if (root.scrollHeight > rootHeight) {\n const buffer = rootHeight * 0.15\n const scrollTop = root.scrollTop\n const top = activeNode.offsetTop\n const bottom = top + targetHeight\n if (top < scrollTop + buffer || bottom > scrollTop + rootHeight - buffer) {\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ top: top - (rootHeight - targetHeight) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n } else {\n const rootWidth = root.clientWidth\n let targetWidth = Math.floor(activeNode.clientWidth)\n const targetOffset = activeNode.offsetLeft\n\n // Detect if the thumb is moving too far to the edge of the container.\n // This would most commonly be due to subpixel widths adding up to excessive distance.\n if (rootWidth - (targetWidth + targetOffset) < 2) {\n targetWidth = targetWidth - 1\n }\n\n thumb.style.width = `${Math.floor(targetWidth)}px`\n thumb.style.height = \"\"\n thumb.style.transform = `translateX(${targetOffset}px)`\n\n // If the control is scrollable, ensure the active option is visible\n if (root.scrollWidth > rootWidth) {\n // Only scroll items near the edge, but not the inner 2/3.\n const buffer = rootWidth * 0.15\n const scrollLeft = root.scrollLeft\n const left = activeNode.offsetLeft\n const right = left + targetWidth\n if (left < scrollLeft + buffer || right > scrollLeft + rootWidth - buffer) {\n // Cheap trick to avoid unintentional scroll on mount - transition is set after mounting\n if (attemptScroll) {\n // Scroll the control only: scrollIntoView also scrolls the page to it (a switch to Phone\n // re-rendered a control far down the page and slid the page to it, owner 08.11)\n root.scrollTo({ left: left - (rootWidth - targetWidth) / 2, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n }\n }\n }\n }\n },\n [isVertical],\n )\n\n useResizeObserver({\n // @ts-expect-error(2322) -- bug in types: https://github.com/juliencrn/usehooks-ts/issues/663\n ref: rootRef,\n onResize: () => {\n const thumb = thumbRef.current\n\n if (!thumb) {\n return\n }\n\n // Perform the size update instantly\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n },\n })\n\n // Tabs added, removed, reordered or relabelled move the active tab without\n // resizing the group: measure again, instantly, like a resize\n useEffect(() => {\n const root = rootRef.current\n if (!root || typeof MutationObserver === \"undefined\") return\n const observer = new MutationObserver(() => {\n const thumb = thumbRef.current\n if (!thumb) return\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n })\n observer.observe(root, { childList: true, characterData: true, subtree: true })\n return () => observer.disconnect()\n }, [applyThumbSizing])\n\n // A phone's segmented control at its own width gives every segment the widest one's width, as UISegmentedControl\n // does in iOS 27.2; where that does not fit, each segment takes its label and the same air around it, as\n // apportionsSegmentWidthsByContent does (ref-app segmented-hug, 13.11). A grid that hugs its content cannot take the\n // widest track for each by itself, so this measures it. Runs before the thumb measures (declared first).\n useLayoutEffect(() => {\n equalizeSegments(rootRef.current, thumbRef.current)\n })\n\n useEffect(() => {\n const root = rootRef.current\n if (!root) return\n // The room, the breakpoint or the font changes. The segments can change without the control changing size, so the\n // thumb follows them here, instantly, like a resize.\n return watchSegments(root, () => thumbRef.current, () => {\n const thumb = thumbRef.current\n if (!thumb) return\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n applyThumbSizing(false)\n thumb.style.transition = currentTransition\n })\n }, [applyThumbSizing])\n\n const transitionProperty = isVertical\n ? \"height var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))\"\n : \"width var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter)), transform var(--tabs-thumb-transition-duration, 200ms) var(--tabs-thumb-transition-easing, var(--cubic-enter))\"\n\n useLayoutEffect(() => {\n const root = rootRef.current\n const thumb = thumbRef.current\n\n if (!root || !thumb) {\n return\n }\n\n const sizeChanged = prevSizeRef.current !== size\n prevSizeRef.current = size\n const valueChanged = prevValueRef.current !== value\n prevValueRef.current = value\n\n if (sizeChanged) {\n // Size changed - disable transition, wait for CSS, then apply sizing\n const currentTransition = thumb.style.transition\n thumb.style.transition = \"\"\n\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = currentTransition\n })\n })\n } else if (thumb.style.transition) {\n // Normal update (value change, etc.): the thumb leaves with the label's colour\n const from = valueChanged ? thumbBox(thumb) : null\n applyThumbSizing(true)\n if (valueChanged) playThumbLens(thumb, from)\n } else {\n // First measure: apply transition after initial calculation is set\n waitForAnimationFrame(() => {\n applyThumbSizing(false)\n waitForAnimationFrame(() => {\n thumb.style.transition = transitionProperty\n })\n })\n }\n // mobileSegmentWidth moves the segments with nothing else changing: the thumb follows them\n }, [applyThumbSizing, value, size, gutterSize, pill, flush, mobileSegmentWidth, transitionProperty])\n\n const handleValueChange = (nextValue: T) => {\n // Only trigger onChange when a value exists\n // Disallow toggling off enabled items\n if (nextValue && onChange) onChange(nextValue)\n }\n\n // Only apply pill for segmented variant\n const isPill = variant === \"segmented\" && pill\n // Only apply flush for underline variant\n const isFlush = variant === \"underline\" && flush\n\n return (\n <ToggleGroup.Root\n ref={rootRef}\n className={clsx(s.Tabs, className)}\n type=\"single\"\n value={value}\n loop={false}\n onValueChange={handleValueChange}\n onClick={onClick}\n data-variant={variant}\n data-orientation={orientation}\n data-block={block ? \"\" : undefined}\n data-pill={isPill ? \"\" : undefined}\n data-flush={isFlush ? \"\" : undefined}\n data-size={size}\n data-gutter-size={gutterSize}\n data-mobile-material={mobileMaterial}\n data-mobile-segment-width={mobileSegmentWidth}\n data-disabled={restProps.disabled ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.TabsThumb} ref={thumbRef} />\n <TabsVerticalContext.Provider value={isVertical}>{children}</TabsVerticalContext.Provider>\n </ToggleGroup.Root>\n )\n}\n\n/**\n * Badge configuration for Tabs.Tab\n */\nexport type TabsBadgeProp =\n | React.ReactNode\n | {\n content: React.ReactNode\n color?: SemanticColors<\n \"secondary\" | \"success\" | \"danger\" | \"warning\" | \"info\" | \"discovery\" | \"caution\"\n >\n variant?: Variants<\"soft\" | \"solid\">\n pill?: boolean\n loading?: boolean\n }\n\nexport type TabProps = {\n /**\n * Tab value\n */\n \"value\": string\n /**\n * Text read aloud to screen readers when the tab is focused\n */\n \"aria-label\"?: string\n /**\n * Text content to render in the tab\n */\n \"children\"?: React.ReactNode\n /**\n * Icon to render before the text content\n */\n \"icon\"?: React.ReactNode\n /**\n * Badge to render after the text content.\n * Can be a simple value or an object with content, color, variant, and loading options.\n * @example badge={5}\n * @example badge={{ content: 5, color: \"danger\" }}\n */\n \"badge\"?: TabsBadgeProp\n /**\n * Disable the individual tab\n */\n \"disabled\"?: boolean\n}\n\n// Type guard for badge object form\nconst isBadgeObject = (\n badge: TabsBadgeProp,\n): badge is Exclude<TabsBadgeProp, React.ReactNode> & { content: React.ReactNode } => {\n return badge != null && typeof badge === \"object\" && \"content\" in badge\n}\n\n/** True when an icon draws text of its own: a string, a number, or a fragment or array holding one */\n\n/** A text icon (\"☀\") stands in an element, as an icon component does, so a phone can hide it beside a label: each\n * text in a fragment or array gets its own span and the elements beside it stay in place. An empty one draws\n * nothing. */\n// Arrays and fragments always go through Children.map, with or without text, so their children keep the same keys\n// when a text child comes or goes; a fragment keeps its element and key, so a new key still remounts its icons.\n/** On a phone the large control's selection travels as a lens of glass, as iOS 27.2 draws it. Recorded frame by frame\n * 11.11 (ref-app segmented-bar-text4, a toolbar Picker of Day, Week, Month and Year switched Day to Year and back,\n * after the owner's «анимация не правильная и стиль» and «day<->year пробуй переключать»; segmented-bar-symbols, a\n * segment away, before it): the gray selection clears into a lens within 45ms, taller than the capsule (11pt) and\n * wider the faster it goes (36pt at 200ms), and carries across; it lands as the gray selection again by 300ms,\n * pressed against its segment's far side (7pt narrower, 6pt taller and its centre 2.5% of the way past at 430ms), and\n * springs back by 750ms while the label under it dims to 76% and comes back. The centre's path is a share of the\n * distance and the growth is in points, as both recordings show: as much growth a segment away as three. touch.css\n * names the lens's growth on the large control only, so everywhere else the selection just slides with its\n * transition. CSS has no refraction, so the lens is its rim, its tint and the capsule's edge seen through it. */\nlet lensRun = 0\nconst LENS_ID = \"segmented-control-lens\"\nconst LENS_DURATION = 750\n// At each measured frame: [ms, the centre's share of the distance, share of the growth's width, share of its height]\nconst LENS_PATH = [\n [0, 0, 0, 0],\n [10, 0.014, 0.036, 0.065],\n [32, 0.077, 0.13, 0.19],\n [47, 0.169, 0.22, 0.44],\n [70, 0.378, 0.44, 0.87],\n [92, 0.478, 0.52, 1],\n [125, 0.647, 0.7, 0.93],\n [150, 0.773, 0.85, 0.87],\n [182, 0.856, 0.96, 0.93],\n [205, 0.9, 1, 1],\n [227, 0.932, 0.96, 0.93],\n [245, 0.951, 0.8, 0.44],\n [262, 0.964, 0.67, 0.31],\n [295, 0.989, 0.37, 0.31],\n [330, 1.005, 0.13, 0.31],\n [363, 1.016, -0.02, 0.37],\n [395, 1.023, -0.13, 0.5],\n [430, 1.025, -0.19, 0.56],\n [497, 1.022, -0.19, 0.56],\n [545, 1.018, -0.17, 0.37],\n [597, 1.014, -0.11, 0.25],\n [647, 1.007, -0.075, 0.12],\n [697, 1.004, -0.036, 0],\n [750, 1, 0, 0],\n] as const\n// The selected label's opacity as the lens lands: [ms, opacity]\nconst LENS_LABEL = [\n [0, 1],\n [380, 1],\n [428, 0.77],\n [460, 0.76],\n [515, 0.85],\n [580, 0.93],\n [650, 0.98],\n [713, 1],\n [750, 1],\n] as const\ntype ThumbBox = { x: number; width: number }\ntype LensRun = { from: ThumbBox; to: ThumbBox; move: Animation; label?: Animation }\nconst lensRuns = new WeakMap<HTMLElement, LensRun>()\nconst round = (value: number) => Math.round(value * 100) / 100\n// The box the lens draws at a time of its run\nconst lensBox = ({ from, to }: LensRun, ms: number, growth: number): ThumbBox => {\n const next = LENS_PATH.findIndex(([time]) => time >= ms)\n const at = next < 0 ? LENS_PATH.length - 1 : Math.max(1, next)\n const [t0, share0, wide0] = LENS_PATH[at - 1]\n const [t1, share1, wide1] = LENS_PATH[Math.min(at, LENS_PATH.length - 1)]\n const k = t1 > t0 ? Math.min(1, Math.max(0, (ms - t0) / (t1 - t0))) : 1\n const share = share0 + (share1 - share0) * k\n const width = from.width + (to.width - from.width) * Math.min(share, 1) + growth * (wide0 + (wide1 - wide0) * k)\n return { x: from.x + from.width / 2 + (to.x + to.width / 2 - from.x - from.width / 2) * share - width / 2, width }\n}\n/** Where a horizontal thumb is drawn, from its control's left edge: where the script set it, or where a lens still\n * on its way has it, so a switch mid-flight sets off from there */\nconst thumbBox = (thumb: HTMLElement): ThumbBox | null => {\n const offset = /^translateX\\((-?[\\d.]+)px\\)$/.exec(thumb.style.transform)\n const width = parseFloat(thumb.style.width)\n if (!offset || !(width > 0)) return null\n const run = lensRuns.get(thumb)\n const ms = Number(run?.move.currentTime)\n if (run && (run.move.playState === \"running\" || run.move.playState === \"paused\") && ms >= 0) {\n const growth = lensGrowth(getComputedStyle(thumb))\n if (growth) return lensBox(run, ms, growth[0])\n }\n return { x: parseFloat(offset[1]), width }\n}\n// The lens's growth at its widest and tallest, which touch.css names on the large control only\nconst lensGrowth = (style: CSSStyleDeclaration) => {\n const [wide = Number.NaN, tall = wide] = style.getPropertyValue(\"--segmented-control-thumb-lens-outset\").trim().split(/\\s+/).map(parseFloat)\n return wide >= 0 && tall >= 0 ? ([wide, tall] as const) : null\n}\nconst playThumbLens = (thumb: HTMLElement, from: ThumbBox | null) => {\n if (typeof thumb.animate !== \"function\") return\n // A lens still on its way ends first, so the thumb's own fill and edge are read below (and none outlives a switch\n // to reduced motion)\n thumb.getAnimations().forEach((animation) => {\n if (animation.id === LENS_ID) animation.cancel()\n })\n lensRuns.get(thumb)?.label?.cancel()\n lensRuns.delete(thumb)\n if (!from || prefersReducedMotion()) return\n const style = getComputedStyle(thumb)\n const growth = lensGrowth(style)\n const to = thumbBox(thumb)\n const top = parseFloat(style.top)\n const bottom = parseFloat(style.bottom)\n if (!growth || !to || !Number.isFinite(top) || !Number.isFinite(bottom)) return\n const [wide, tall] = growth\n const timing = { id: LENS_ID, duration: LENS_DURATION }\n const run: LensRun = { from, to, move: undefined as unknown as Animation }\n // The thumb's box at each frame replaces its own while the lens runs (its transition is overridden); the height\n // grows about the middle\n run.move = thumb.animate(\n LENS_PATH.map(([ms, , , high]) => {\n const box = lensBox(run, ms, wide)\n const grown = (tall * high) / 2\n return {\n offset: ms / LENS_DURATION,\n transform: `translateX(${round(box.x)}px)`,\n width: `${round(Math.max(1, box.width))}px`,\n top: `${round(top - grown)}px`,\n bottom: `${round(bottom - grown)}px`,\n }\n }),\n timing,\n )\n const lens = {\n backgroundColor: style.getPropertyValue(\"--segmented-control-thumb-lens-background\").trim(),\n boxShadow: style.getPropertyValue(\"--segmented-control-thumb-lens-shadow\").trim(),\n }\n const rest = { backgroundColor: style.backgroundColor, boxShadow: style.boxShadow }\n // The gray clears as the lens lifts (45ms) and comes back as it lands (250 to 300ms)\n const fill = thumb.animate(\n [\n { offset: 0, ...rest },\n { offset: 45 / LENS_DURATION, ...lens },\n { offset: 250 / LENS_DURATION, ...lens },\n { offset: 300 / LENS_DURATION, ...rest },\n { offset: 1, ...rest },\n ],\n timing,\n )\n const root = thumb.parentElement\n const selected = root?.querySelector<HTMLElement>('[data-state=\"on\"]')\n if (selected && typeof selected.animate === \"function\") {\n run.label = selected.animate(\n LENS_LABEL.map(([ms, opacity]) => ({ offset: ms / LENS_DURATION, opacity })),\n timing,\n )\n }\n lensRuns.set(thumb, run)\n // The frame a switch is drawn in also lays out whatever the switch changes around the control, which can take a\n // few frames' time; the lens holds its first frame until then and sets off from the next, so none of its way is\n // skipped (a tap's first 45ms were, recorded in Safari 11.11)\n if (typeof requestAnimationFrame === \"function\") {\n const held = [run.move, fill, run.label].filter((animation): animation is Animation => typeof animation?.pause === \"function\")\n held.forEach((animation) => animation.pause())\n requestAnimationFrame(() => {\n held.forEach((animation) => {\n if (animation.playState === \"paused\") animation.play()\n })\n })\n }\n // The lens reaches past the capsule, which clips what scrolls in it: a control whose segments all fit lets it out\n // for the switch\n if (!root || root.scrollWidth > root.clientWidth + 1) return\n const id = String(++lensRun)\n root.setAttribute(\"data-lens\", id)\n const done = () => {\n if (root.getAttribute(\"data-lens\") === id) root.removeAttribute(\"data-lens\")\n }\n if (run.move?.finished) run.move.finished.then(done, done)\n else done()\n}\n\nconst renderTabIcon = (icon: React.ReactNode): React.ReactNode => {\n if (icon === \"\") return null\n if (typeof icon === \"string\" || typeof icon === \"number\") return <span>{icon}</span>\n if (Array.isArray(icon)) return Children.map(icon, renderTabIcon)\n if (isValidElement<{ children?: React.ReactNode }>(icon) && icon.type === Fragment) {\n return cloneElement(icon, undefined, Children.map(icon.props.children, renderTabIcon))\n }\n return icon\n}\n\nconst Tab = ({ children, icon, badge, ...restProps }: TabProps) => {\n // Normalize badge prop\n const badgeProps = badge != null ? (isBadgeObject(badge) ? badge : { content: badge }) : null\n const vertical = useContext(TabsVerticalContext)\n\n return (\n <ToggleGroup.Item\n className={s.Tab}\n {...restProps}\n onPointerEnter={handlePressableMouseEnter}\n >\n <span className={s.TabContent}>\n {renderTabIcon(icon)}\n {children && <span className={s.TabLabel}>{children}</span>}\n {badgeProps && (\n <span\n className={s.TabBadge}\n data-color={badgeProps.color ?? \"secondary\"}\n data-variant={badgeProps.variant ?? \"soft\"}\n data-pill={badgeProps.pill ? \"\" : undefined}\n >\n {badgeProps.loading ? <LoadingIndicator /> : badgeProps.content}\n </span>\n )}\n </span>\n {vertical && <CheckMd className={s.TabCheckmark} aria-hidden=\"true\" />}\n </ToggleGroup.Item>\n )\n}\n\n// =============================================\n// overflow=\"menu\"\n// =============================================\n\n/** Value of the menu button; no real tab has it */\nconst MORE_VALUE = \"__plexui_tabs_more__\"\n\ntype TabElement = ReactElement<TabProps>\n\n/** The tabs among the children, through fragments */\nconst tabElements = (children: ReactNode): TabElement[] =>\n Children.toArray(children).flatMap((child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) return []\n return child.type === Fragment ? tabElements(child.props.children) : [child as TabElement]\n })\n\nconst plainText = (node: unknown): string => {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node)\n if (Array.isArray(node)) return node.map(plainText).join(\"\")\n if (isValidElement<{ children?: ReactNode }>(node)) return plainText(node.props.children)\n return \"\"\n}\n\nconst badgeText = (badge: TabsBadgeProp | undefined) =>\n badge != null && isBadgeObject(badge) ? plainText(badge.content) : plainText(badge)\n\n/** A tab's name: its text, else its accessible name, else its value */\nconst tabLabel = (item: TabElement) => plainText(item.props.children) || item.props[\"aria-label\"] || item.props.value\n\n/** What a tab's width depends on: the strip measures again when it changes */\nconst tabsSignature = (items: TabElement[]) =>\n items\n .map((item) =>\n [item.props.value, plainText(item.props.children), badgeText(item.props.badge), item.props.icon != null].join(\"\\u0000\"),\n )\n .join(\"\\u0001\")\n\n/**\n * `Menu.Trigger` sets `data-state` (open or closed) on its child, while a tab\n * keeps `on` or `off` in the same attribute and the thumb finds the active tab\n * by it. The menu's value does not reach the tab; its handlers and\n * `aria-haspopup` / `aria-expanded` do.\n */\nconst MoreTab = (props: TabProps & { \"data-state\"?: string }) => {\n const restProps = { ...props }\n delete restProps[\"data-state\"]\n return <Tab {...restProps} />\n}\n\nconst OverflowTabs = <T extends string>({\n children,\n value,\n onChange,\n overflowLabel,\n ...restProps\n}: Omit<TabsProps<T>, \"overflow\"> & { overflowLabel: string }) => {\n const items = tabElements(children)\n // The strip's own props size the tabs and the menu button too\n const { size, variant, gutterSize, pill, flush, mobileMaterial, mobileSegmentWidth } = restProps\n const signature = [overflowLabel, size, variant, gutterSize, pill, flush, mobileMaterial, mobileSegmentWidth, tabsSignature(items)].join(\"\\u0002\")\n const activeIndex = items.findIndex((item) => item.props.value === value)\n\n // null while the measuring pass renders every tab and the menu button\n const [visibleCount, setVisibleCount] = useState<number | null>(null)\n const [known, setKnown] = useState({ signature, activeIndex })\n const hostRef = useRef<HTMLDivElement>(null)\n const measuringRef = useRef(true)\n const boxWidthRef = useRef(-1)\n\n // New tabs measure again. A new active tab measures again when it moves\n // under the menu button or back out: the button carries the hidden one's name\n if (known.signature !== signature || known.activeIndex !== activeIndex) {\n const crossed =\n visibleCount !== null && (known.activeIndex >= visibleCount || activeIndex >= visibleCount)\n setKnown({ signature, activeIndex })\n if (visibleCount !== null && (known.signature !== signature || crossed)) setVisibleCount(null)\n }\n\n useLayoutEffect(() => {\n measuringRef.current = visibleCount === null\n }, [visibleCount])\n\n useLayoutEffect(() => {\n if (visibleCount !== null) return\n const root = hostRef.current?.firstElementChild\n if (!(root instanceof HTMLElement)) return\n\n // The measuring pass renders every tab, then the menu button\n const buttons = Array.from(root.querySelectorAll<HTMLElement>(\":scope > button\"))\n if (buttons.length !== items.length + 1) return\n\n const widths = buttons.map((button) => button.getBoundingClientRect().width)\n const moreButton = buttons[buttons.length - 1]\n const moreWidth = widths.pop() ?? 0\n const style = getComputedStyle(root)\n const available =\n root.getBoundingClientRect().width -\n (Number.parseFloat(style.paddingLeft) || 0) -\n (Number.parseFloat(style.paddingRight) || 0)\n const gap = Number.parseFloat(style.columnGap) || 0\n boxWidthRef.current = hostRef.current?.parentElement?.clientWidth ?? -1\n\n // A hidden strip has no width to decide by: show every tab, and measure\n // when it appears (the observer sees the width change)\n if (available <= 0) {\n // Resolve the zero-width measuring pass before paint; the resize observer\n // restarts measurement when this hidden strip becomes visible.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setVisibleCount(items.length)\n return\n }\n\n // The button with the active tab's name: that tab's width plus the chevron\n const chevron = moreButton?.querySelector(\"svg\")\n const chevronWidth = chevron?.getBoundingClientRect().width ?? 0\n const labelGap = chevron?.parentElement ? Number.parseFloat(getComputedStyle(chevron.parentElement).columnGap) || 0 : 0\n const activeWidth = activeIndex < 0 ? 0 : (widths[activeIndex] ?? 0) + chevronWidth + labelGap\n\n // This result depends on committed DOM widths. Apply it before first paint\n // so the temporary full strip never flashes before overflowing tabs move.\n setVisibleCount(visibleTabCount(widths, moreWidth, activeWidth, activeIndex, gap, available))\n }, [visibleCount, items.length, activeIndex])\n\n // The width to fit is the container's, not the strip's: the strip shrinks\n // to its content. Reports during a measuring pass are skipped, since the\n // full strip may be pushing its container wider\n useEffect(() => {\n const box = hostRef.current?.parentElement\n if (!box || typeof ResizeObserver === \"undefined\") return\n const observer = new ResizeObserver(() => {\n if (measuringRef.current) return\n const width = box.clientWidth\n if (width === boxWidthRef.current) return\n boxWidthRef.current = width\n setVisibleCount(null)\n })\n observer.observe(box)\n return () => observer.disconnect()\n }, [])\n\n const measuring = visibleCount === null\n const shown = measuring ? items : items.slice(0, visibleCount)\n const hidden = measuring ? [] : items.slice(visibleCount)\n const hiddenActive = hidden.find((item) => item.props.value === value) ?? null\n\n return (\n <div ref={hostRef} className={s.OverflowHost}>\n <Menu>\n <TabsRoot<string>\n {...restProps}\n data-overflow=\"menu\"\n value={hiddenActive ? MORE_VALUE : value}\n onChange={(next) => {\n // Pressing the menu button opens the menu; it is not a tab\n if (next !== MORE_VALUE) onChange?.(next as T)\n }}\n >\n {/* Keyed by value: tabs from different fragments may share a key */}\n {shown.map((item) => cloneElement(item, { key: item.props.value }))}\n {(measuring || hidden.length > 0) && (\n <Menu.Trigger>\n <MoreTab value={MORE_VALUE}>\n <span className={s.OverflowLabel}>\n {hiddenActive ? tabLabel(hiddenActive) : overflowLabel}\n <ChevronDownMd />\n </span>\n </MoreTab>\n </Menu.Trigger>\n )}\n </TabsRoot>\n <Menu.Content align=\"end\" minWidth=\"auto\">\n <Menu.RadioGroup<string> value={value} onChange={(next) => onChange?.(next as T)}>\n {hidden.map((item) => {\n const count = badgeText(item.props.badge)\n return (\n <Menu.RadioItem<string>\n key={item.props.value}\n value={item.props.value}\n disabled={restProps.disabled || item.props.disabled}\n >\n {item.props.icon}\n {item.props.children ?? item.props[\"aria-label\"] ?? item.props.value}\n {/* A tab's count moves into the menu with it */}\n {count !== \"\" && <span className={s.OverflowBadge}>{count}</span>}\n </Menu.RadioItem>\n )\n })}\n </Menu.RadioGroup>\n </Menu.Content>\n </Menu>\n </div>\n )\n}\n\n// Attach sub-components\nTabs.Tab = Tab\n// Backward-compat alias\nTabs.Option = Tab\n"]}
@@ -1,14 +1,19 @@
1
1
  /**
2
- * One width for the segments of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must
3
- * match).
2
+ * The widths of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must match).
4
3
  *
5
4
  * UISegmentedControl at its own width gives every segment the widest one's width (iOS 27.2); where that does not fit,
6
5
  * each segment takes its label and the same air around it, as apportionsSegmentWidthsByContent does (ref-app
7
- * segmented-hug, 13.11). A grid that hugs its content cannot size its tracks to the widest one by itself (the browser
8
- * sizes it by the sum of its labels), so the widest is measured here and set as the track. Tabs.module.css asks for it
9
- * with `--tabs-equal-segments: 1` on a phone's horizontal control that is not `block`; elsewhere nothing is set.
6
+ * segmented-hug, 13.11), and where even that does not fit, the air beside each label narrows, to 4px, before the
7
+ * segments scroll, as UIKit narrows a squeezed control's (Calendar's Напоминание stands 4pt inside its segment). A grid
8
+ * that hugs its content cannot size its tracks to the widest one by itself (the browser sizes it by the sum of its
9
+ * labels), so the widest is measured here and set as the track. Tabs.module.css asks for one width with
10
+ * `--tabs-equal-segments: 1` and for the narrowing with `--tabs-fit-segments: 1`, on a phone's horizontal control that
11
+ * is not `block`; elsewhere nothing is set.
10
12
  */
11
13
  const TRACK = "--tabs-segment-track";
14
+ const GUTTER = "--tabs-segment-gutter";
15
+ /** The least air beside a label of a squeezed control: the large control's widest label, 4pt in Calendar */
16
+ const MIN_GUTTER_PX = 4;
12
17
  /** The phone block of Tabs.module.css, where a control starts or stops asking for one width */
13
18
  const PHONE_QUERY = "(max-width: 767px)";
14
19
  /** Slack for the rounding of clientWidth */
@@ -24,33 +29,69 @@ const laidOutWidth = (root, style) => {
24
29
  const sides = ["padding-left", "padding-right", "border-left-width", "border-right-width"];
25
30
  return sides.reduce((sum, side) => sum + px(style, side), width);
26
31
  };
27
- /** Sets the track and says whether it changed, so a thumb on a segment that moved can follow. */
32
+ const sizing = (root) => `${root.style.getPropertyValue(TRACK)}|${root.style.getPropertyValue(GUTTER)}`;
33
+ /** Sets the track and the air of the segments and says whether they changed, so a thumb on a segment that moved can
34
+ * follow. */
28
35
  export function equalizeSegments(root, thumb) {
29
36
  if (!root)
30
37
  return false;
31
- const before = root.style.getPropertyValue(TRACK);
38
+ const before = sizing(root);
32
39
  const style = getComputedStyle(root);
33
- const asked = style.getPropertyValue("--tabs-equal-segments").trim() === "1";
40
+ const equal = style.getPropertyValue("--tabs-equal-segments").trim() === "1";
41
+ const fit = style.getPropertyValue("--tabs-fit-segments").trim() === "1";
34
42
  // The segments of the row: a tab that is not drawn takes no track
35
43
  const segments = Array.from(root.children).filter((child) => child instanceof HTMLElement && child !== thumb && getComputedStyle(child).getPropertyValue("display") !== "none");
36
- if (!asked || root.getAttribute("data-orientation") !== "horizontal" || segments.length < 2 || !root.offsetWidth) {
44
+ root.style.removeProperty(GUTTER);
45
+ if ((!equal && !fit) || root.getAttribute("data-orientation") !== "horizontal" || segments.length < 2 || !root.offsetWidth) {
37
46
  root.style.removeProperty(TRACK);
47
+ return sizing(root) !== before;
38
48
  }
39
- else {
40
- // Each segment at its label's width, unscaled while the control is held (it grows under the finger)
41
- root.style.setProperty(TRACK, "max-content");
42
- const width = laidOutWidth(root, style);
43
- const scale = width / (root.getBoundingClientRect().width || width);
44
- const widest = Math.max(...segments.map((segment) => segment.getBoundingClientRect().width * scale));
45
- root.style.setProperty(TRACK, `minmax(${widest}px, 1fr)`);
46
- // The row of equal segments against the room the control has, counted: scrollWidth would take in a thumb still
47
- // standing where its segment was
48
- const row = widest * segments.length + px(style, "column-gap") * (segments.length - 1);
49
- const room = root.clientWidth - px(style, "padding-left") - px(style, "padding-right");
50
- if (row > room + FIT_TOLERANCE_PX)
51
- root.style.removeProperty(TRACK);
49
+ // Each segment at its label's width and full air, unscaled while the control is held (it grows under the finger)
50
+ root.style.setProperty(TRACK, "max-content");
51
+ const width = laidOutWidth(root, style);
52
+ const scale = width / (root.getBoundingClientRect().width || width);
53
+ const widths = segments.map((segment) => segment.getBoundingClientRect().width * scale);
54
+ const widest = Math.max(...widths);
55
+ const gaps = px(style, "column-gap") * (segments.length - 1);
56
+ // Equal segments as wide as the control may grow: they fit, or the control stops at its room. Counted, not read
57
+ // from scrollWidth, which a thumb still standing where its segment was would widen.
58
+ root.style.setProperty(TRACK, `minmax(${widest}px, 1fr)`);
59
+ const room = root.clientWidth - px(style, "padding-left") - px(style, "padding-right");
60
+ const fitsEqual = widest * segments.length + gaps <= room + FIT_TOLERANCE_PX;
61
+ if (equal && fitsEqual)
62
+ return sizing(root) !== before;
63
+ root.style.removeProperty(TRACK);
64
+ const over = widths.reduce((sum, segment) => sum + segment, gaps) - room;
65
+ if (fit && !fitsEqual && over > FIT_TOLERANCE_PX) {
66
+ // Labels by their widths still overflow: the air beside each narrows by its share, to the least. The air is read
67
+ // laid out, in pixels: the token may be set in rem (0.75rem without touch.css)
68
+ const gutter = px(getComputedStyle(segments[0]), "padding-left");
69
+ const floors = segments.map((segment) => px(getComputedStyle(segment), "min-width"));
70
+ const narrowed = Math.max(MIN_GUTTER_PX, airThatFits(widths, floors, gutter, room - gaps));
71
+ if (narrowed < gutter)
72
+ root.style.setProperty(GUTTER, `${narrowed}px`);
73
+ }
74
+ return sizing(root) !== before;
75
+ }
76
+ /**
77
+ * The air beside each label that brings the segments into the room: each narrows by the same amount on both sides,
78
+ * except a segment held at its least width (a short label in a pill segment), which gives up no more, so the others
79
+ * narrow further. -Infinity where nothing can narrow.
80
+ */
81
+ function airThatFits(widths, floors, gutter, room) {
82
+ const held = new Set();
83
+ for (;;) {
84
+ const free = widths.filter((_, index) => !held.has(index));
85
+ if (!free.length)
86
+ return Number.NEGATIVE_INFINITY;
87
+ const fixed = [...held].reduce((sum, index) => sum + floors[index], 0);
88
+ const air = gutter - (free.reduce((sum, width) => sum + width, fixed) - room) / (2 * free.length);
89
+ const reached = widths.map((_, index) => index).filter((index) => !held.has(index) && widths[index] - 2 * (gutter - air) < floors[index]);
90
+ if (!reached.length)
91
+ return air;
92
+ for (const index of reached)
93
+ held.add(index);
52
94
  }
53
- return root.style.getPropertyValue(TRACK) !== before;
54
95
  }
55
96
  /**
56
97
  * Measures again when the room changes (the segments may fit one width now), when the screen crosses into or out of
@@ -1 +1 @@
1
- {"version":3,"file":"segments.js","sourceRoot":"","sources":["../../../../src/components/Tabs/segments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,KAAK,GAAG,sBAAsB,CAAA;AAEpC,+FAA+F;AAC/F,MAAM,WAAW,GAAG,oBAAoB,CAAA;AAExC,4CAA4C;AAC5C,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAE1B,MAAM,EAAE,GAAG,CAAC,KAA0B,EAAE,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAA;AAE7G,wGAAwG;AACxG,MAAM,YAAY,GAAG,CAAC,IAAiB,EAAE,KAA0B,EA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ent":["/**\n * One width for the segments of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must\n * match).\n *\n * UISegmentedControl at its own width gives every segment the widest one's width (iOS 27.2); where that does not fit,\n * each segment takes its label and the same air around it, as apportionsSegmentWidthsByContent does (ref-app\n * segmented-hug, 13.11). A grid that hugs its content cannot size its tracks to the widest one by itself (the browser\n * sizes it by the sum of its labels), so the widest is measured here and set as the track. Tabs.module.css asks for it\n * with `--tabs-equal-segments: 1` on a phone's horizontal control that is not `block`; elsewhere nothing is set.\n */\n\nconst TRACK = \"--tabs-segment-track\"\n\n/** The phone block of Tabs.module.css, where a control starts or stops asking for one width */\nconst PHONE_QUERY = \"(max-width: 767px)\"\n\n/** Slack for the rounding of clientWidth */\nconst FIT_TOLERANCE_PX = 1\n\nconst px = (style: CSSStyleDeclaration, name: string) => Number.parseFloat(style.getPropertyValue(name)) || 0\n\n/** The control's border box as laid out, unscaled and unrounded (offsetWidth rounds to whole pixels) */\nconst laidOutWidth = (root: HTMLElement, style: CSSStyleDeclaration) => {\n const width = px(style, \"width\")\n if (!width) return root.offsetWidth\n if (style.getPropertyValue(\"box-sizing\") === \"border-box\") return width\n const sides = [\"padding-left\", \"padding-right\", \"border-left-width\", \"border-right-width\"]\n return sides.reduce((sum, side) => sum + px(style, side), width)\n}\n\n/** Sets the track and says whether it changed, so a thumb on a segment that moved can follow. */\nexport function equalizeSegments(root: HTMLElement | null, thumb: HTMLElement | null): boolean {\n if (!root) return false\n const before = root.style.getPropertyValue(TRACK)\n const style = getComputedStyle(root)\n const asked = style.getPropertyValue(\"--tabs-equal-segments\").trim() === \"1\"\n // The segments of the row: a tab that is not drawn takes no track\n const segments = Array.from(root.children).filter(\n (child): child is HTMLElement =>\n child instanceof HTMLElement && child !== thumb && getComputedStyle(child).getPropertyValue(\"display\") !== \"none\",\n )\n if (!asked || root.getAttribute(\"data-orientation\") !== \"horizontal\" || segments.length < 2 || !root.offsetWidth) {\n root.style.removeProperty(TRACK)\n } else {\n // Each segment at its label's width, unscaled while the control is held (it grows under the finger)\n root.style.setProperty(TRACK, \"max-content\")\n const width = laidOutWidth(root, style)\n const scale = width / (root.getBoundingClientRect().width || width)\n const widest = Math.max(...segments.map((segment) => segment.getBoundingClientRect().width * scale))\n root.style.setProperty(TRACK, `minmax(${widest}px, 1fr)`)\n // The row of equal segments against the room the control has, counted: scrollWidth would take in a thumb still\n // standing where its segment was\n const row = widest * segments.length + px(style, \"column-gap\") * (segments.length - 1)\n const room = root.clientWidth - px(style, \"padding-left\") - px(style, \"padding-right\")\n if (row > room + FIT_TOLERANCE_PX) root.style.removeProperty(TRACK)\n }\n return root.style.getPropertyValue(TRACK) !== before\n}\n\n/**\n * Measures again when the room changes (the segments may fit one width now), when the screen crosses into or out of\n * the phone block (the control starts or stops asking, its room unchanged) and when the font loads and the labels\n * widen. `moved` runs when the track changed, so the thumb can follow its segment, and always once the font has\n * loaded: segments sized by their labels move then with no track and no size changing. Returns the cleanup.\n */\nexport function watchSegments(root: HTMLElement, thumb: () => HTMLElement | null, moved: () => void): () => void {\n const refit = () => {\n if (equalizeSegments(root, thumb())) moved()\n }\n const box = root.parentElement\n const observer = box && typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(refit) : undefined\n if (box) observer?.observe(box)\n const phone = typeof window.matchMedia === \"function\" ? window.matchMedia(PHONE_QUERY) : undefined\n // Browsers before 2020 offer only addListener\n if (phone?.addEventListener) phone.addEventListener(\"change\", refit)\n else phone?.addListener?.(refit)\n let live = true\n document.fonts?.ready.then(() => {\n if (!live) return\n equalizeSegments(root, thumb())\n moved()\n })\n return () => {\n live = false\n observer?.disconnect()\n if (phone?.removeEventListener) phone.removeEventListener(\"change\", refit)\n else phone?.removeListener?.(refit)\n }\n}\n"]}
1
+ {"version":3,"file":"segments.js","sourceRoot":"","sources":["../../../../src/components/Tabs/segments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,KAAK,GAAG,sBAAsB,CAAA;AACpC,MAAM,MAAM,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,IAAI,CAAC,GAAG,EAAE;QAC9B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;QAC/B,KAAK,EAAE,CAAA;IACT,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,EAAE;QACV,IAAI,GAAG,KAAK,CAAA;QACZ,QAAQ,EAAE,UAAU,EAAE,CAAA;QACtB,IAAI,KAAK,EAAE,mBAAmB;YAAE,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;;YACrE,KAAK,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,CAAA;IACrC,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * The widths of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must match).\n *\n * UISegmentedControl at its own width gives every segment the widest one's width (iOS 27.2); where that does not fit,\n * each segment takes its label and the same air around it, as apportionsSegmentWidthsByContent does (ref-app\n * segmented-hug, 13.11), and where even that does not fit, the air beside each label narrows, to 4px, before the\n * segments scroll, as UIKit narrows a squeezed control's (Calendar's Напоминание stands 4pt inside its segment). A grid\n * that hugs its content cannot size its tracks to the widest one by itself (the browser sizes it by the sum of its\n * labels), so the widest is measured here and set as the track. Tabs.module.css asks for one width with\n * `--tabs-equal-segments: 1` and for the narrowing with `--tabs-fit-segments: 1`, on a phone's horizontal control that\n * is not `block`; elsewhere nothing is set.\n */\n\nconst TRACK = \"--tabs-segment-track\"\nconst GUTTER = \"--tabs-segment-gutter\"\n\n/** The least air beside a label of a squeezed control: the large control's widest label, 4pt in Calendar */\nconst MIN_GUTTER_PX = 4\n\n/** The phone block of Tabs.module.css, where a control starts or stops asking for one width */\nconst PHONE_QUERY = \"(max-width: 767px)\"\n\n/** Slack for the rounding of clientWidth */\nconst FIT_TOLERANCE_PX = 1\n\nconst px = (style: CSSStyleDeclaration, name: string) => Number.parseFloat(style.getPropertyValue(name)) || 0\n\n/** The control's border box as laid out, unscaled and unrounded (offsetWidth rounds to whole pixels) */\nconst laidOutWidth = (root: HTMLElement, style: CSSStyleDeclaration) => {\n const width = px(style, \"width\")\n if (!width) return root.offsetWidth\n if (style.getPropertyValue(\"box-sizing\") === \"border-box\") return width\n const sides = [\"padding-left\", \"padding-right\", \"border-left-width\", \"border-right-width\"]\n return sides.reduce((sum, side) => sum + px(style, side), width)\n}\n\nconst sizing = (root: HTMLElement) => `${root.style.getPropertyValue(TRACK)}|${root.style.getPropertyValue(GUTTER)}`\n\n/** Sets the track and the air of the segments and says whether they changed, so a thumb on a segment that moved can\n * follow. */\nexport function equalizeSegments(root: HTMLElement | null, thumb: HTMLElement | null): boolean {\n if (!root) return false\n const before = sizing(root)\n const style = getComputedStyle(root)\n const equal = style.getPropertyValue(\"--tabs-equal-segments\").trim() === \"1\"\n const fit = style.getPropertyValue(\"--tabs-fit-segments\").trim() === \"1\"\n // The segments of the row: a tab that is not drawn takes no track\n const segments = Array.from(root.children).filter(\n (child): child is HTMLElement =>\n child instanceof HTMLElement && child !== thumb && getComputedStyle(child).getPropertyValue(\"display\") !== \"none\",\n )\n root.style.removeProperty(GUTTER)\n if ((!equal && !fit) || root.getAttribute(\"data-orientation\") !== \"horizontal\" || segments.length < 2 || !root.offsetWidth) {\n root.style.removeProperty(TRACK)\n return sizing(root) !== before\n }\n // Each segment at its label's width and full air, unscaled while the control is held (it grows under the finger)\n root.style.setProperty(TRACK, \"max-content\")\n const width = laidOutWidth(root, style)\n const scale = width / (root.getBoundingClientRect().width || width)\n const widths = segments.map((segment) => segment.getBoundingClientRect().width * scale)\n const widest = Math.max(...widths)\n const gaps = px(style, \"column-gap\") * (segments.length - 1)\n // Equal segments as wide as the control may grow: they fit, or the control stops at its room. Counted, not read\n // from scrollWidth, which a thumb still standing where its segment was would widen.\n root.style.setProperty(TRACK, `minmax(${widest}px, 1fr)`)\n const room = root.clientWidth - px(style, \"padding-left\") - px(style, \"padding-right\")\n const fitsEqual = widest * segments.length + gaps <= room + FIT_TOLERANCE_PX\n if (equal && fitsEqual) return sizing(root) !== before\n root.style.removeProperty(TRACK)\n const over = widths.reduce((sum, segment) => sum + segment, gaps) - room\n if (fit && !fitsEqual && over > FIT_TOLERANCE_PX) {\n // Labels by their widths still overflow: the air beside each narrows by its share, to the least. The air is read\n // laid out, in pixels: the token may be set in rem (0.75rem without touch.css)\n const gutter = px(getComputedStyle(segments[0]), \"padding-left\")\n const floors = segments.map((segment) => px(getComputedStyle(segment), \"min-width\"))\n const narrowed = Math.max(MIN_GUTTER_PX, airThatFits(widths, floors, gutter, room - gaps))\n if (narrowed < gutter) root.style.setProperty(GUTTER, `${narrowed}px`)\n }\n return sizing(root) !== before\n}\n\n/**\n * The air beside each label that brings the segments into the room: each narrows by the same amount on both sides,\n * except a segment held at its least width (a short label in a pill segment), which gives up no more, so the others\n * narrow further. -Infinity where nothing can narrow.\n */\nfunction airThatFits(widths: number[], floors: number[], gutter: number, room: number): number {\n const held = new Set<number>()\n for (;;) {\n const free = widths.filter((_, index) => !held.has(index))\n if (!free.length) return Number.NEGATIVE_INFINITY\n const fixed = [...held].reduce((sum, index) => sum + floors[index], 0)\n const air = gutter - (free.reduce((sum, width) => sum + width, fixed) - room) / (2 * free.length)\n const reached = widths.map((_, index) => index).filter(\n (index) => !held.has(index) && widths[index] - 2 * (gutter - air) < floors[index],\n )\n if (!reached.length) return air\n for (const index of reached) held.add(index)\n }\n}\n\n/**\n * Measures again when the room changes (the segments may fit one width now), when the screen crosses into or out of\n * the phone block (the control starts or stops asking, its room unchanged) and when the font loads and the labels\n * widen. `moved` runs when the track changed, so the thumb can follow its segment, and always once the font has\n * loaded: segments sized by their labels move then with no track and no size changing. Returns the cleanup.\n */\nexport function watchSegments(root: HTMLElement, thumb: () => HTMLElement | null, moved: () => void): () => void {\n const refit = () => {\n if (equalizeSegments(root, thumb())) moved()\n }\n const box = root.parentElement\n const observer = box && typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(refit) : undefined\n if (box) observer?.observe(box)\n const phone = typeof window.matchMedia === \"function\" ? window.matchMedia(PHONE_QUERY) : undefined\n // Browsers before 2020 offer only addListener\n if (phone?.addEventListener) phone.addEventListener(\"change\", refit)\n else phone?.addListener?.(refit)\n let live = true\n document.fonts?.ready.then(() => {\n if (!live) return\n equalizeSegments(root, thumb())\n moved()\n })\n return () => {\n live = false\n observer?.disconnect()\n if (phone?.removeEventListener) phone.removeEventListener(\"change\", refit)\n else phone?.removeListener?.(refit)\n }\n}\n"]}
@@ -91,6 +91,15 @@ export type TabsProps<T extends string> = {
91
91
  * @default "glass" at md and larger, "flat" at sm and smaller
92
92
  */
93
93
  "mobileMaterial"?: "glass" | "flat";
94
+ /**
95
+ * Widths of the segments of horizontal tabs on a phone, as UISegmentedControl sets them. `equal` gives every
96
+ * segment the widest one's width, its default; `content` gives each its label and the same air around it, as
97
+ * `apportionsSegmentWidthsByContent` does, for a compact control. Equal segments that do not fit take their labels'
98
+ * widths anyway; where those still do not fit, the air beside each label narrows, to 4px, and what still does not
99
+ * fit scrolls. A `block` control fills its row either way. Desktop tabs always take their labels' widths.
100
+ * @default "equal"
101
+ */
102
+ "mobileSegmentWidth"?: "equal" | "content";
94
103
  "className"?: string;
95
104
  "children": React.ReactNode;
96
105
  };
@@ -1,14 +1,17 @@
1
1
  /**
2
- * One width for the segments of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must
3
- * match).
2
+ * The widths of a phone's segmented control. Shared by the React and Vue packages (the Vue copy must match).
4
3
  *
5
4
  * UISegmentedControl at its own width gives every segment the widest one's width (iOS 27.2); where that does not fit,
6
5
  * each segment takes its label and the same air around it, as apportionsSegmentWidthsByContent does (ref-app
7
- * segmented-hug, 13.11). A grid that hugs its content cannot size its tracks to the widest one by itself (the browser
8
- * sizes it by the sum of its labels), so the widest is measured here and set as the track. Tabs.module.css asks for it
9
- * with `--tabs-equal-segments: 1` on a phone's horizontal control that is not `block`; elsewhere nothing is set.
6
+ * segmented-hug, 13.11), and where even that does not fit, the air beside each label narrows, to 4px, before the
7
+ * segments scroll, as UIKit narrows a squeezed control's (Calendar's Напоминание stands 4pt inside its segment). A grid
8
+ * that hugs its content cannot size its tracks to the widest one by itself (the browser sizes it by the sum of its
9
+ * labels), so the widest is measured here and set as the track. Tabs.module.css asks for one width with
10
+ * `--tabs-equal-segments: 1` and for the narrowing with `--tabs-fit-segments: 1`, on a phone's horizontal control that
11
+ * is not `block`; elsewhere nothing is set.
10
12
  */
11
- /** Sets the track and says whether it changed, so a thumb on a segment that moved can follow. */
13
+ /** Sets the track and the air of the segments and says whether they changed, so a thumb on a segment that moved can
14
+ * follow. */
12
15
  export declare function equalizeSegments(root: HTMLElement | null, thumb: HTMLElement | null): boolean;
13
16
  /**
14
17
  * Measures again when the room changes (the segments may fit one width now), when the screen crosses into or out of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/ui",
3
- "version": "0.46.0",
3
+ "version": "0.47.0",
4
4
  "description": "Modern design system for building high-quality applications",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -99,7 +99,7 @@
99
99
  "@maskito/core": "^5.2.2",
100
100
  "@maskito/kit": "^5.2.2",
101
101
  "@maskito/react": "^5.2.2",
102
- "@plexui/styles": "^0.5.0",
102
+ "@plexui/styles": "^0.6.0",
103
103
  "@radix-ui/react-dismissable-layer": "1.2.1",
104
104
  "@radix-ui/react-focus-guards": "1.2.0",
105
105
  "@radix-ui/react-focus-scope": "1.3.1",