@sereno-ds/ui 0.25.5 → 0.25.6

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.
@@ -42,7 +42,7 @@ interface TabsPanelProps extends React.HTMLAttributes<HTMLDivElement> {
42
42
  children: React.ReactNode;
43
43
  }
44
44
  declare function TabsRoot({ value, onChange, variant, fullWidth, children }: TabsProps): React.JSX.Element;
45
- declare function List({ children, style, ...rest }: TabsListProps): React.JSX.Element;
45
+ declare function List({ children, style, onKeyDown, ...rest }: TabsListProps): React.JSX.Element;
46
46
  declare function Tab({ value, icon, count, children, style, ...rest }: TabsTabProps): React.JSX.Element;
47
47
  declare function Panel({ value, children, ...rest }: TabsPanelProps): React.JSX.Element | null;
48
48
  declare const Tabs: typeof TabsRoot & {
@@ -14,8 +14,8 @@ function TabsRoot({ value, onChange, variant = "underline", fullWidth = false, c
14
14
  const ctx = React.useMemo(() => ({ value, onChange, variant, fullWidth }), [value, onChange, variant, fullWidth]);
15
15
  return /* @__PURE__ */ jsx(TabsContext.Provider, { value: ctx, children });
16
16
  }
17
- function List({ children, style, ...rest }) {
18
- const { value: activeValue, variant, fullWidth } = useTabsContext("List");
17
+ function List({ children, style, onKeyDown, ...rest }) {
18
+ const { value: activeValue, onChange, variant, fullWidth } = useTabsContext("List");
19
19
  const pill = variant === "pill";
20
20
  const scrollRef = React.useRef(null);
21
21
  const [edge, setEdge] = React.useState({ left: false, right: false });
@@ -63,6 +63,25 @@ function List({ children, style, ...rest }) {
63
63
  const nudge = (dir) => {
64
64
  scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: "smooth" });
65
65
  };
66
+ const onListKeyDown = (e) => {
67
+ if (e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End") return;
68
+ const el = scrollRef.current;
69
+ if (!el) return;
70
+ const tabs = Array.from(el.querySelectorAll("[data-tab-value]"));
71
+ if (tabs.length === 0) return;
72
+ const current = tabs.findIndex((t) => t.dataset.tabValue === activeValue);
73
+ let next = current;
74
+ if (e.key === "ArrowRight") next = current < 0 ? 0 : (current + 1) % tabs.length;
75
+ else if (e.key === "ArrowLeft") next = current < 0 ? tabs.length - 1 : (current - 1 + tabs.length) % tabs.length;
76
+ else if (e.key === "Home") next = 0;
77
+ else if (e.key === "End") next = tabs.length - 1;
78
+ e.preventDefault();
79
+ const nextTab = tabs[next];
80
+ const nextValue = nextTab.dataset.tabValue;
81
+ if (nextValue !== void 0) onChange?.(nextValue);
82
+ nextTab.focus();
83
+ nextTab.scrollIntoView({ inline: "nearest", block: "nearest" });
84
+ };
66
85
  const fade = pill ? "var(--bg-subtle)" : "var(--bg-surface)";
67
86
  return /* @__PURE__ */ jsxs(
68
87
  "div",
@@ -85,6 +104,10 @@ function List({ children, style, ...rest }) {
85
104
  ref: scrollRef,
86
105
  role: "tablist",
87
106
  ...rest,
107
+ onKeyDown: (e) => {
108
+ onListKeyDown(e);
109
+ onKeyDown?.(e);
110
+ },
88
111
  className: "sereno-tab-scroll" + (rest.className ? " " + rest.className : ""),
89
112
  style: sx({
90
113
  position: "relative",
@@ -144,7 +167,9 @@ function Tab({ value, icon, count, children, style, ...rest }) {
144
167
  role: "tab",
145
168
  "aria-selected": active,
146
169
  "data-tab-value": value,
170
+ tabIndex: active ? 0 : -1,
147
171
  ...rest,
172
+ className: "sereno-tab" + (rest.className ? " " + rest.className : ""),
148
173
  onClick: (e) => {
149
174
  onChange?.(value);
150
175
  e.currentTarget.scrollIntoView({ inline: "nearest", block: "nearest" });
@@ -167,10 +192,18 @@ function Tab({ value, icon, count, children, style, ...rest }) {
167
192
  gap: "var(--space-2)",
168
193
  border: "none",
169
194
  cursor: "pointer",
170
- outline: "none",
195
+ // Not inline outline:none — see the .sereno-tab rule in styles.css
196
+ // for why that would permanently beat :focus-visible.
171
197
  background: "transparent",
172
198
  borderRadius: pill ? "var(--radius-pill)" : 0,
173
- padding: pill ? "8px var(--space-4)" : "0 0 var(--space-3)",
199
+ // Symmetric top/bottom (SS-228 follow-up): this used to be `0 0
200
+ // var(--space-3)` — no top padding, all the reserved space for the
201
+ // underline bar's gap on the bottom — which left the label sitting
202
+ // visibly above the button's own box center (and by extension above
203
+ // center of the focus-ring outline, which traces that box). Equal
204
+ // padding centers the label; ScrollChevron no longer needs its old
205
+ // -6px compensation for this (see its own comment).
206
+ padding: pill ? "8px var(--space-4)" : "var(--space-3) 0",
174
207
  fontFamily: "var(--font-body)",
175
208
  fontSize: "var(--text-base)",
176
209
  fontWeight: active ? "var(--weight-semibold)" : "var(--weight-medium)",
@@ -190,7 +223,10 @@ function Tab({ value, icon, count, children, style, ...rest }) {
190
223
  padding: "1px 6px",
191
224
  borderRadius: "999px",
192
225
  background: active ? "var(--bg-brand-soft)" : pill ? "var(--bg-surface)" : "var(--bg-subtle)",
193
- color: active ? "var(--text-brand)" : "var(--text-muted)"
226
+ // text-muted here was < 4.5:1 on bg-subtle (SS-230) — text-secondary
227
+ // both fixes that and matches the inactive tab label's own color
228
+ // (line ~253), which was already text-secondary, not text-muted.
229
+ color: active ? "var(--text-brand)" : "var(--text-secondary)"
194
230
  }),
195
231
  children: count
196
232
  }
@@ -202,7 +238,14 @@ function Tab({ value, icon, count, children, style, ...rest }) {
202
238
  function Panel({ value, children, ...rest }) {
203
239
  const { value: activeValue } = useTabsContext("Panel");
204
240
  if (activeValue !== value) return null;
205
- return /* @__PURE__ */ jsx("div", { role: "tabpanel", ...rest, children });
241
+ return (
242
+ // tabIndex=0 (WAI-ARIA APG Tabs pattern): the panel itself is the next
243
+ // Tab stop after the tablist, so keyboard users land in the tab's own
244
+ // content next — not in whatever unrelated element happens to follow it
245
+ // in the DOM (e.g. this docs site's own "Show Code" toggle). A consumer
246
+ // rendering focusable content of its own can override via `rest`.
247
+ /* @__PURE__ */ jsx("div", { role: "tabpanel", tabIndex: 0, ...rest, children })
248
+ );
206
249
  }
207
250
  function ScrollChevron({ side, fade, pill, onClick }) {
208
251
  return /* @__PURE__ */ jsx(
@@ -246,17 +289,10 @@ function ScrollChevron({ side, fade, pill, onClick }) {
246
289
  background: "var(--bg-surface)",
247
290
  boxShadow: "var(--shadow-md)",
248
291
  color: "var(--text-secondary)",
249
- cursor: "pointer",
250
- // `underline`-only correction, measured against the actual glyph
251
- // box (Range.getBoundingClientRect on the label's text node, not
252
- // the row's own padded box): that variant's label sits ~6px above
253
- // the row's geometric center, since the row reserves padding-bottom
254
- // for the underline bar that the text itself doesn't use. `pill`
255
- // pads top and bottom equally, so its label is already centered —
256
- // applying this there overshoots (confirmed live on the Dashboard's
257
- // pill filter: the same -6px landed 6px too high once the row
258
- // wasn't underline's asymmetric one).
259
- transform: pill ? void 0 : "translateY(-6px)"
292
+ cursor: "pointer"
293
+ // No vertical correction needed here anymore — Tab's own padding
294
+ // is symmetric top/bottom for both variants now, so the row's
295
+ // geometric center already matches the label's center.
260
296
  }),
261
297
  children: side === "left" ? /* @__PURE__ */ jsx(ChevronLeft, { size: 16, strokeWidth: 2 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 16, strokeWidth: 2 })
262
298
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/navigation/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\n/**\n * Horizontal section switcher — a **compound component**. `underline` for\n * page-level sections, `pill` for filters inside a panel. When the tabs\n * overflow their width the strip scrolls horizontally, with a chevron on\n * whichever side has more; picking a tab scrolls it into view.\n *\n * ```tsx\n * <Tabs value={tab} onChange={setTab} variant=\"pill\">\n * <Tabs.List>\n * <Tabs.Tab value=\"today\" count={5}>Today</Tabs.Tab>\n * <Tabs.Tab value=\"week\" count={23}>Week</Tabs.Tab>\n * </Tabs.List>\n * <Tabs.Panel value=\"today\">…</Tabs.Panel>\n * <Tabs.Panel value=\"week\">…</Tabs.Panel>\n * </Tabs>\n * ```\n *\n * `Tabs.Panel` is optional — nothing requires it. Render your own content\n * next to `Tabs.List`, keyed off the controlled `value`, if that reads\n * better for the screen.\n */\nexport interface TabsProps {\n value?: string;\n onChange?: (value: string) => void;\n variant?: 'underline' | 'pill';\n fullWidth?: boolean;\n children: React.ReactNode;\n}\n\nexport interface TabsListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n children: React.ReactNode;\n}\n\nexport interface TabsTabProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onClick'> {\n value: string;\n icon?: React.ReactNode;\n count?: number;\n children: React.ReactNode;\n}\n\nexport interface TabsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n value: string;\n children: React.ReactNode;\n}\n\ninterface TabsContextValue {\n value?: string;\n onChange?: (value: string) => void;\n variant: 'underline' | 'pill';\n fullWidth: boolean;\n}\n\n/** Width of the overflow chevron's fade-out + hit area, and how much\n * scroll-padding the strip keeps on that side so scrollIntoView doesn't land\n * a tab half-hidden behind it. The chevron overlays this edge rather than\n * reserving space for itself — reserving space fit fewer tabs on screen at\n * once, for no benefit once the chevron reliably paints above the tab under\n * it (see Tab's z-index comment). */\nconst CHEVRON_W = 56;\n\nconst TabsContext = React.createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(component: string): TabsContextValue {\n const ctx = React.useContext(TabsContext);\n if (!ctx) throw new Error(`<Tabs.${component}> must be rendered inside <Tabs>.`);\n return ctx;\n}\n\nfunction TabsRoot({ value, onChange, variant = 'underline', fullWidth = false, children }: TabsProps) {\n const ctx = React.useMemo<TabsContextValue>(() => ({ value, onChange, variant, fullWidth }), [value, onChange, variant, fullWidth]);\n return <TabsContext.Provider value={ctx}>{children}</TabsContext.Provider>;\n}\n\nfunction List({ children, style, ...rest }: TabsListProps) {\n const { value: activeValue, variant, fullWidth } = useTabsContext('List');\n const pill = variant === 'pill';\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const [edge, setEdge] = React.useState({ left: false, right: false });\n const [indicator, setIndicator] = React.useState<{ left: number; width: number; top: number; height: number } | null>(null);\n\n const measureEdges = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n setEdge({\n left: el.scrollLeft > 1,\n right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1,\n });\n }, []);\n\n // Finds the active <Tabs.Tab> by its data-tab-value (no ref registry needed\n // — children render into this same scroll container) and measures it in the\n // container's own coordinate space, so `indicator.left` lines up with the\n // absolutely-positioned bar/pill below.\n const measureIndicator = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el || activeValue == null) {\n setIndicator(null);\n return;\n }\n let active: HTMLElement | null = null;\n el.querySelectorAll<HTMLElement>('[data-tab-value]').forEach((tab) => {\n if (tab.dataset.tabValue === activeValue) active = tab;\n });\n setIndicator(\n active\n ? { left: (active as HTMLElement).offsetLeft, width: (active as HTMLElement).offsetWidth, top: (active as HTMLElement).offsetTop, height: (active as HTMLElement).offsetHeight }\n : null,\n );\n }, [activeValue]);\n\n // Layout effect so the indicator lands in the right spot before paint —\n // no visible jump from a stale position on the very first render after a\n // value change.\n React.useLayoutEffect(() => {\n measureIndicator();\n }, [measureIndicator, children]);\n\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n measureEdges();\n el.addEventListener('scroll', measureEdges, { passive: true });\n const ro = new ResizeObserver(() => {\n measureEdges();\n measureIndicator();\n });\n ro.observe(el);\n return () => {\n el.removeEventListener('scroll', measureEdges);\n ro.disconnect();\n };\n }, [measureEdges, measureIndicator, children]);\n\n const nudge = (dir: 1 | -1) => {\n scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: 'smooth' });\n };\n\n const fade = pill ? 'var(--bg-subtle)' : 'var(--bg-surface)';\n\n return (\n <div\n style={sx({\n position: 'relative',\n display: pill && !fullWidth ? 'inline-flex' : 'flex',\n alignSelf: pill && !fullWidth ? 'flex-start' : undefined,\n width: !pill && fullWidth ? '100%' : undefined,\n maxWidth: '100%',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n background: pill ? 'var(--bg-subtle)' : 'transparent',\n borderBottom: pill ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n <div\n ref={scrollRef}\n role=\"tablist\"\n {...rest}\n className={'sereno-tab-scroll' + (rest.className ? ' ' + rest.className : '')}\n style={sx({\n position: 'relative',\n display: 'flex',\n flex: 1,\n minWidth: 0,\n overflowX: 'auto',\n gap: pill ? 'var(--space-1)' : 'var(--space-5)',\n padding: pill ? 'var(--space-1)' : 0,\n // The chevron overlays this edge (see ScrollChevron) rather than\n // reserving permanent space for itself — reserving space fit fewer\n // tabs on screen at once for no real benefit once the chevron\n // paints correctly above whatever tab is underneath it (the actual\n // bug, fixed below on Tab). scroll-padding keeps scrollIntoView\n // from landing a tab half-behind the chevron's fade.\n scrollPaddingLeft: CHEVRON_W,\n scrollPaddingRight: CHEVRON_W,\n })}\n >\n {indicator && (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n left: indicator.left,\n width: indicator.width,\n zIndex: 0,\n pointerEvents: 'none',\n transition: 'left 200ms ease, width 200ms ease, top 200ms ease, height 200ms ease',\n // Match the active Tab's own box exactly (offsetTop/offsetHeight,\n // not top:0/bottom:0) — the latter is relative to the scroll\n // container's *padding edge*, which for `pill` ignores the\n // container's own padding and over-fills it top-to-bottom.\n ...(pill\n ? { top: indicator.top, height: indicator.height, borderRadius: 'var(--radius-pill)', background: 'var(--bg-surface)', boxShadow: 'var(--shadow-xs)' }\n : { top: 'auto', bottom: 0, height: 2, background: 'var(--interactive-primary)' }),\n })}\n />\n )}\n {children}\n </div>\n\n {edge.left && <ScrollChevron side=\"left\" fade={fade} pill={pill} onClick={() => nudge(-1)} />}\n {edge.right && <ScrollChevron side=\"right\" fade={fade} pill={pill} onClick={() => nudge(1)} />}\n </div>\n );\n}\n\nfunction Tab({ value, icon, count, children, style, ...rest }: TabsTabProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('Tab');\n const pill = variant === 'pill';\n const active = activeValue === value;\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n data-tab-value={value}\n {...rest}\n onClick={(e) => {\n onChange?.(value);\n e.currentTarget.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n }}\n style={sx({\n // position:relative (no explicit z-index) is enough to paint above\n // the indicator — both sit in the DOM-order-decided stacking layer,\n // and this comes later. An explicit z-index would promote this into\n // its own stacking context ranked ahead of *everything* z-index:auto,\n // including the unrelated ScrollChevron sibling outside this row —\n // which is exactly the bug that shipped: the chevron ended up\n // painted underneath every tab, visible only through the gaps\n // between glyphs of whichever tab it overlapped.\n position: 'relative',\n flex: fullWidth ? 1 : '0 0 auto',\n whiteSpace: 'nowrap',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 'var(--space-2)',\n border: 'none',\n cursor: 'pointer',\n outline: 'none',\n background: 'transparent',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n padding: pill ? '8px var(--space-4)' : '0 0 var(--space-3)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: active ? 'var(--weight-semibold)' : 'var(--weight-medium)',\n color: active ? (pill ? 'var(--text-primary)' : 'var(--text-brand)') : 'var(--text-secondary)',\n transition: 'var(--transition-control)',\n ...style,\n })}\n >\n {icon}\n {children}\n {count !== undefined && (\n <span\n style={sx({\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n padding: '1px 6px',\n borderRadius: '999px',\n background: active ? 'var(--bg-brand-soft)' : pill ? 'var(--bg-surface)' : 'var(--bg-subtle)',\n color: active ? 'var(--text-brand)' : 'var(--text-muted)',\n })}\n >\n {count}\n </span>\n )}\n </button>\n );\n}\n\nfunction Panel({ value, children, ...rest }: TabsPanelProps) {\n const { value: activeValue } = useTabsContext('Panel');\n if (activeValue !== value) return null;\n return (\n <div role=\"tabpanel\" {...rest}>\n {children}\n </div>\n );\n}\n\nfunction ScrollChevron({ side, fade, pill, onClick }: { side: 'left' | 'right'; fade: string; pill: boolean; onClick: () => void }) {\n return (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n top: 0,\n bottom: 0,\n [side]: 0,\n width: CHEVRON_W,\n display: 'flex',\n alignItems: 'center',\n justifyContent: side === 'left' ? 'flex-start' : 'flex-end',\n pointerEvents: 'none',\n // Fades the tab it overlays out towards this edge — the button\n // itself paints above every tab (Tab has no explicit z-index, so\n // it can't outrank this), so it's never actually hidden by one;\n // this is purely about not hard-cutting the text right at the\n // button's boundary.\n background: `linear-gradient(to ${side === 'left' ? 'right' : 'left'}, ${fade} 55%, transparent)`,\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n })}\n >\n <button\n type=\"button\"\n tabIndex={-1}\n onClick={onClick}\n style={sx({\n pointerEvents: 'auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 26,\n height: 26,\n borderRadius: '999px',\n border: '1px solid var(--border-strong)',\n // White, matching the DS's other floating circular controls.\n background: 'var(--bg-surface)',\n boxShadow: 'var(--shadow-md)',\n color: 'var(--text-secondary)',\n cursor: 'pointer',\n // `underline`-only correction, measured against the actual glyph\n // box (Range.getBoundingClientRect on the label's text node, not\n // the row's own padded box): that variant's label sits ~6px above\n // the row's geometric center, since the row reserves padding-bottom\n // for the underline bar that the text itself doesn't use. `pill`\n // pads top and bottom equally, so its label is already centered —\n // applying this there overshoots (confirmed live on the Dashboard's\n // pill filter: the same -6px landed 6px too high once the row\n // wasn't underline's asymmetric one).\n transform: pill ? undefined : 'translateY(-6px)',\n })}\n >\n {side === 'left' ? <ChevronLeft size={16} strokeWidth={2} /> : <ChevronRight size={16} strokeWidth={2} />}\n </button>\n </span>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, { List, Tab, Panel });\n"],"mappings":";AA4ES,cAmFH,YAnFG;AA1ET,YAAY,WAAW;AACvB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AA4DnB,MAAM,YAAY;AAElB,MAAM,cAAc,MAAM,cAAuC,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;AAEA,SAAS,cAAc,EAAE,MAAM,MAAM,MAAM,QAAQ,GAAiF;AAClI,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,MACX,OAAO,GAAG;AAAA,QACR,UAAU;AAAA,QACV,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,CAAC,IAAI,GAAG;AAAA,QACR,OAAO;AAAA,QACP,SAAS;AAAA,QACT,YAAY;AAAA,QACZ,gBAAgB,SAAS,SAAS,eAAe;AAAA,QACjD,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMf,YAAY,sBAAsB,SAAS,SAAS,UAAU,MAAM,KAAK,IAAI;AAAA,QAC7E,cAAc,OAAO,uBAAuB;AAAA,MAC9C,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,UAAU;AAAA,UACV;AAAA,UACA,OAAO,GAAG;AAAA,YACR,eAAe;AAAA,YACf,SAAS;AAAA,YACT,YAAY;AAAA,YACZ,gBAAgB;AAAA,YAChB,OAAO;AAAA,YACP,QAAQ;AAAA,YACR,cAAc;AAAA,YACd,QAAQ;AAAA;AAAA,YAER,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,OAAO;AAAA,YACP,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAUR,WAAW,OAAO,SAAY;AAAA,UAChC,CAAC;AAAA,UAEA,mBAAS,SAAS,oBAAC,eAAY,MAAM,IAAI,aAAa,GAAG,IAAK,oBAAC,gBAAa,MAAM,IAAI,aAAa,GAAG;AAAA;AAAA,MACzG;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,OAAO,OAAO,OAAO,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/navigation/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { sx } from '../_internal/style';\n\n/**\n * Horizontal section switcher — a **compound component**. `underline` for\n * page-level sections, `pill` for filters inside a panel. When the tabs\n * overflow their width the strip scrolls horizontally, with a chevron on\n * whichever side has more; picking a tab scrolls it into view.\n *\n * ```tsx\n * <Tabs value={tab} onChange={setTab} variant=\"pill\">\n * <Tabs.List>\n * <Tabs.Tab value=\"today\" count={5}>Today</Tabs.Tab>\n * <Tabs.Tab value=\"week\" count={23}>Week</Tabs.Tab>\n * </Tabs.List>\n * <Tabs.Panel value=\"today\">…</Tabs.Panel>\n * <Tabs.Panel value=\"week\">…</Tabs.Panel>\n * </Tabs>\n * ```\n *\n * `Tabs.Panel` is optional — nothing requires it. Render your own content\n * next to `Tabs.List`, keyed off the controlled `value`, if that reads\n * better for the screen.\n */\nexport interface TabsProps {\n value?: string;\n onChange?: (value: string) => void;\n variant?: 'underline' | 'pill';\n fullWidth?: boolean;\n children: React.ReactNode;\n}\n\nexport interface TabsListProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n children: React.ReactNode;\n}\n\nexport interface TabsTabProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onClick'> {\n value: string;\n icon?: React.ReactNode;\n count?: number;\n children: React.ReactNode;\n}\n\nexport interface TabsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n value: string;\n children: React.ReactNode;\n}\n\ninterface TabsContextValue {\n value?: string;\n onChange?: (value: string) => void;\n variant: 'underline' | 'pill';\n fullWidth: boolean;\n}\n\n/** Width of the overflow chevron's fade-out + hit area, and how much\n * scroll-padding the strip keeps on that side so scrollIntoView doesn't land\n * a tab half-hidden behind it. The chevron overlays this edge rather than\n * reserving space for itself — reserving space fit fewer tabs on screen at\n * once, for no benefit once the chevron reliably paints above the tab under\n * it (see Tab's z-index comment). */\nconst CHEVRON_W = 56;\n\nconst TabsContext = React.createContext<TabsContextValue | null>(null);\n\nfunction useTabsContext(component: string): TabsContextValue {\n const ctx = React.useContext(TabsContext);\n if (!ctx) throw new Error(`<Tabs.${component}> must be rendered inside <Tabs>.`);\n return ctx;\n}\n\nfunction TabsRoot({ value, onChange, variant = 'underline', fullWidth = false, children }: TabsProps) {\n const ctx = React.useMemo<TabsContextValue>(() => ({ value, onChange, variant, fullWidth }), [value, onChange, variant, fullWidth]);\n return <TabsContext.Provider value={ctx}>{children}</TabsContext.Provider>;\n}\n\nfunction List({ children, style, onKeyDown, ...rest }: TabsListProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('List');\n const pill = variant === 'pill';\n const scrollRef = React.useRef<HTMLDivElement>(null);\n const [edge, setEdge] = React.useState({ left: false, right: false });\n const [indicator, setIndicator] = React.useState<{ left: number; width: number; top: number; height: number } | null>(null);\n\n const measureEdges = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el) return;\n setEdge({\n left: el.scrollLeft > 1,\n right: el.scrollLeft + el.clientWidth < el.scrollWidth - 1,\n });\n }, []);\n\n // Finds the active <Tabs.Tab> by its data-tab-value (no ref registry needed\n // — children render into this same scroll container) and measures it in the\n // container's own coordinate space, so `indicator.left` lines up with the\n // absolutely-positioned bar/pill below.\n const measureIndicator = React.useCallback(() => {\n const el = scrollRef.current;\n if (!el || activeValue == null) {\n setIndicator(null);\n return;\n }\n let active: HTMLElement | null = null;\n el.querySelectorAll<HTMLElement>('[data-tab-value]').forEach((tab) => {\n if (tab.dataset.tabValue === activeValue) active = tab;\n });\n setIndicator(\n active\n ? { left: (active as HTMLElement).offsetLeft, width: (active as HTMLElement).offsetWidth, top: (active as HTMLElement).offsetTop, height: (active as HTMLElement).offsetHeight }\n : null,\n );\n }, [activeValue]);\n\n // Layout effect so the indicator lands in the right spot before paint —\n // no visible jump from a stale position on the very first render after a\n // value change.\n React.useLayoutEffect(() => {\n measureIndicator();\n }, [measureIndicator, children]);\n\n React.useEffect(() => {\n const el = scrollRef.current;\n if (!el) return;\n measureEdges();\n el.addEventListener('scroll', measureEdges, { passive: true });\n const ro = new ResizeObserver(() => {\n measureEdges();\n measureIndicator();\n });\n ro.observe(el);\n return () => {\n el.removeEventListener('scroll', measureEdges);\n ro.disconnect();\n };\n }, [measureEdges, measureIndicator, children]);\n\n const nudge = (dir: 1 | -1) => {\n scrollRef.current?.scrollBy({ left: dir * scrollRef.current.clientWidth * 0.72, behavior: 'smooth' });\n };\n\n // Roving tabindex (SS-228): only the active Tab is ever tabIndex=0 (below),\n // so Tab enters/leaves the whole strip in one stop. Left/Right move — and,\n // matching this component's own \"click selects immediately\" contract\n // (automatic activation, not a separate confirm step), also *select* — the\n // adjacent tab, wrapping at the ends; Home/End jump to the first/last.\n // Reuses the same data-tab-value DOM query as measureIndicator above rather\n // than cloning children, for the same reason: List doesn't otherwise need\n // to know each Tab's position.\n const onListKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== 'ArrowLeft' && e.key !== 'ArrowRight' && e.key !== 'Home' && e.key !== 'End') return;\n const el = scrollRef.current;\n if (!el) return;\n const tabs = Array.from(el.querySelectorAll<HTMLElement>('[data-tab-value]'));\n if (tabs.length === 0) return;\n const current = tabs.findIndex((t) => t.dataset.tabValue === activeValue);\n let next = current;\n if (e.key === 'ArrowRight') next = current < 0 ? 0 : (current + 1) % tabs.length;\n else if (e.key === 'ArrowLeft') next = current < 0 ? tabs.length - 1 : (current - 1 + tabs.length) % tabs.length;\n else if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = tabs.length - 1;\n e.preventDefault();\n const nextTab = tabs[next];\n const nextValue = nextTab.dataset.tabValue;\n if (nextValue !== undefined) onChange?.(nextValue);\n nextTab.focus();\n nextTab.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n };\n\n const fade = pill ? 'var(--bg-subtle)' : 'var(--bg-surface)';\n\n return (\n <div\n style={sx({\n position: 'relative',\n display: pill && !fullWidth ? 'inline-flex' : 'flex',\n alignSelf: pill && !fullWidth ? 'flex-start' : undefined,\n width: !pill && fullWidth ? '100%' : undefined,\n maxWidth: '100%',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n background: pill ? 'var(--bg-subtle)' : 'transparent',\n borderBottom: pill ? 'none' : 'var(--border-width-hairline) solid var(--border-default)',\n ...style,\n })}\n >\n <div\n ref={scrollRef}\n role=\"tablist\"\n {...rest}\n onKeyDown={(e) => {\n onListKeyDown(e);\n onKeyDown?.(e);\n }}\n className={'sereno-tab-scroll' + (rest.className ? ' ' + rest.className : '')}\n style={sx({\n position: 'relative',\n display: 'flex',\n flex: 1,\n minWidth: 0,\n overflowX: 'auto',\n gap: pill ? 'var(--space-1)' : 'var(--space-5)',\n padding: pill ? 'var(--space-1)' : 0,\n // The chevron overlays this edge (see ScrollChevron) rather than\n // reserving permanent space for itself — reserving space fit fewer\n // tabs on screen at once for no real benefit once the chevron\n // paints correctly above whatever tab is underneath it (the actual\n // bug, fixed below on Tab). scroll-padding keeps scrollIntoView\n // from landing a tab half-behind the chevron's fade.\n scrollPaddingLeft: CHEVRON_W,\n scrollPaddingRight: CHEVRON_W,\n })}\n >\n {indicator && (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n left: indicator.left,\n width: indicator.width,\n zIndex: 0,\n pointerEvents: 'none',\n transition: 'left 200ms ease, width 200ms ease, top 200ms ease, height 200ms ease',\n // Match the active Tab's own box exactly (offsetTop/offsetHeight,\n // not top:0/bottom:0) — the latter is relative to the scroll\n // container's *padding edge*, which for `pill` ignores the\n // container's own padding and over-fills it top-to-bottom.\n ...(pill\n ? { top: indicator.top, height: indicator.height, borderRadius: 'var(--radius-pill)', background: 'var(--bg-surface)', boxShadow: 'var(--shadow-xs)' }\n : { top: 'auto', bottom: 0, height: 2, background: 'var(--interactive-primary)' }),\n })}\n />\n )}\n {children}\n </div>\n\n {edge.left && <ScrollChevron side=\"left\" fade={fade} pill={pill} onClick={() => nudge(-1)} />}\n {edge.right && <ScrollChevron side=\"right\" fade={fade} pill={pill} onClick={() => nudge(1)} />}\n </div>\n );\n}\n\nfunction Tab({ value, icon, count, children, style, ...rest }: TabsTabProps) {\n const { value: activeValue, onChange, variant, fullWidth } = useTabsContext('Tab');\n const pill = variant === 'pill';\n const active = activeValue === value;\n\n return (\n <button\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n data-tab-value={value}\n // Roving tabindex (SS-228): only the active tab is a Tab stop — List's\n // onKeyDown moves *and* focuses between tabs with the arrow keys, so\n // Tab itself only needs to enter/leave the strip once.\n tabIndex={active ? 0 : -1}\n {...rest}\n className={'sereno-tab' + (rest.className ? ' ' + rest.className : '')}\n onClick={(e) => {\n onChange?.(value);\n e.currentTarget.scrollIntoView({ inline: 'nearest', block: 'nearest' });\n }}\n style={sx({\n // position:relative (no explicit z-index) is enough to paint above\n // the indicator — both sit in the DOM-order-decided stacking layer,\n // and this comes later. An explicit z-index would promote this into\n // its own stacking context ranked ahead of *everything* z-index:auto,\n // including the unrelated ScrollChevron sibling outside this row —\n // which is exactly the bug that shipped: the chevron ended up\n // painted underneath every tab, visible only through the gaps\n // between glyphs of whichever tab it overlapped.\n position: 'relative',\n flex: fullWidth ? 1 : '0 0 auto',\n whiteSpace: 'nowrap',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 'var(--space-2)',\n border: 'none',\n cursor: 'pointer',\n // Not inline outline:none — see the .sereno-tab rule in styles.css\n // for why that would permanently beat :focus-visible.\n background: 'transparent',\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n // Symmetric top/bottom (SS-228 follow-up): this used to be `0 0\n // var(--space-3)` — no top padding, all the reserved space for the\n // underline bar's gap on the bottom — which left the label sitting\n // visibly above the button's own box center (and by extension above\n // center of the focus-ring outline, which traces that box). Equal\n // padding centers the label; ScrollChevron no longer needs its old\n // -6px compensation for this (see its own comment).\n padding: pill ? '8px var(--space-4)' : 'var(--space-3) 0',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: active ? 'var(--weight-semibold)' : 'var(--weight-medium)',\n color: active ? (pill ? 'var(--text-primary)' : 'var(--text-brand)') : 'var(--text-secondary)',\n transition: 'var(--transition-control)',\n ...style,\n })}\n >\n {icon}\n {children}\n {count !== undefined && (\n <span\n style={sx({\n fontSize: 'var(--text-2xs)',\n fontWeight: 'var(--weight-bold)',\n padding: '1px 6px',\n borderRadius: '999px',\n background: active ? 'var(--bg-brand-soft)' : pill ? 'var(--bg-surface)' : 'var(--bg-subtle)',\n // text-muted here was < 4.5:1 on bg-subtle (SS-230) — text-secondary\n // both fixes that and matches the inactive tab label's own color\n // (line ~253), which was already text-secondary, not text-muted.\n color: active ? 'var(--text-brand)' : 'var(--text-secondary)',\n })}\n >\n {count}\n </span>\n )}\n </button>\n );\n}\n\nfunction Panel({ value, children, ...rest }: TabsPanelProps) {\n const { value: activeValue } = useTabsContext('Panel');\n if (activeValue !== value) return null;\n return (\n // tabIndex=0 (WAI-ARIA APG Tabs pattern): the panel itself is the next\n // Tab stop after the tablist, so keyboard users land in the tab's own\n // content next — not in whatever unrelated element happens to follow it\n // in the DOM (e.g. this docs site's own \"Show Code\" toggle). A consumer\n // rendering focusable content of its own can override via `rest`.\n <div role=\"tabpanel\" tabIndex={0} {...rest}>\n {children}\n </div>\n );\n}\n\nfunction ScrollChevron({ side, fade, pill, onClick }: { side: 'left' | 'right'; fade: string; pill: boolean; onClick: () => void }) {\n return (\n <span\n aria-hidden\n style={sx({\n position: 'absolute',\n top: 0,\n bottom: 0,\n [side]: 0,\n width: CHEVRON_W,\n display: 'flex',\n alignItems: 'center',\n justifyContent: side === 'left' ? 'flex-start' : 'flex-end',\n pointerEvents: 'none',\n // Fades the tab it overlays out towards this edge — the button\n // itself paints above every tab (Tab has no explicit z-index, so\n // it can't outrank this), so it's never actually hidden by one;\n // this is purely about not hard-cutting the text right at the\n // button's boundary.\n background: `linear-gradient(to ${side === 'left' ? 'right' : 'left'}, ${fade} 55%, transparent)`,\n borderRadius: pill ? 'var(--radius-pill)' : 0,\n })}\n >\n <button\n type=\"button\"\n tabIndex={-1}\n onClick={onClick}\n style={sx({\n pointerEvents: 'auto',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: 26,\n height: 26,\n borderRadius: '999px',\n border: '1px solid var(--border-strong)',\n // White, matching the DS's other floating circular controls.\n background: 'var(--bg-surface)',\n boxShadow: 'var(--shadow-md)',\n color: 'var(--text-secondary)',\n cursor: 'pointer',\n // No vertical correction needed here anymore — Tab's own padding\n // is symmetric top/bottom for both variants now, so the row's\n // geometric center already matches the label's center.\n })}\n >\n {side === 'left' ? <ChevronLeft size={16} strokeWidth={2} /> : <ChevronRight size={16} strokeWidth={2} />}\n </button>\n </span>\n );\n}\n\nexport const Tabs = Object.assign(TabsRoot, { List, Tab, Panel });\n"],"mappings":";AA4ES,cA+GH,YA/GG;AA1ET,YAAY,WAAW;AACvB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AA4DnB,MAAM,YAAY;AAElB,MAAM,cAAc,MAAM,cAAuC,IAAI;AAErE,SAAS,eAAe,WAAqC;AAC3D,QAAM,MAAM,MAAM,WAAW,WAAW;AACxC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,SAAS,SAAS,mCAAmC;AAC/E,SAAO;AACT;AAEA,SAAS,SAAS,EAAE,OAAO,UAAU,UAAU,aAAa,YAAY,OAAO,SAAS,GAAc;AACpG,QAAM,MAAM,MAAM,QAA0B,OAAO,EAAE,OAAO,UAAU,SAAS,UAAU,IAAI,CAAC,OAAO,UAAU,SAAS,SAAS,CAAC;AAClI,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,KAAM,UAAS;AACrD;AAEA,SAAS,KAAK,EAAE,UAAU,OAAO,WAAW,GAAG,KAAK,GAAkB;AACpE,QAAM,EAAE,OAAO,aAAa,UAAU,SAAS,UAAU,IAAI,eAAe,MAAM;AAClF,QAAM,OAAO,YAAY;AACzB,QAAM,YAAY,MAAM,OAAuB,IAAI;AACnD,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,EAAE,MAAM,OAAO,OAAO,MAAM,CAAC;AACpE,QAAM,CAAC,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AEA,mBAAS,SAAS,oBAAC,eAAY,MAAM,IAAI,aAAa,GAAG,IAAK,oBAAC,gBAAa,MAAM,IAAI,aAAa,GAAG;AAAA;AAAA,MACzG;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,OAAO,OAAO,OAAO,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;","names":[]}
package/dist/styles.css CHANGED
@@ -77,6 +77,18 @@
77
77
  .sereno-tab-scroll::-webkit-scrollbar {
78
78
  display: none;
79
79
  }
80
+ /* Tab's own focus ring (SS-228) — it used to set outline:none inline with
81
+ nothing to replace it, which (as with DateTimePicker's day grid) always
82
+ beats a class selector's :focus-visible rule no matter what, roving
83
+ tabindex or not. Suppressed here instead, same specificity as the
84
+ override below, so source order decides and the override actually wins. */
85
+ .sereno-tab {
86
+ outline: none;
87
+ }
88
+ .sereno-tab:focus-visible {
89
+ outline: 2px solid var(--border-focus);
90
+ outline-offset: -2px;
91
+ }
80
92
 
81
93
  /* ── SidebarNav ──────────────────────────────────────────────────────────────
82
94
  Thin scroll area, a keyboard ring on its plain <button> rows, and — when
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sereno-ds/ui",
3
- "version": "0.25.5",
3
+ "version": "0.25.6",
4
4
  "description": "Sereno Design System — React primitives (token-driven, inline styles, no UI base lib).",
5
5
  "license": "MIT",
6
6
  "author": "Sereno",