@sereno-ds/ui 0.25.4 → 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.
- package/dist/forms/Select.d.ts +10 -1
- package/dist/forms/Select.js +5 -1
- package/dist/forms/Select.js.map +1 -1
- package/dist/navigation/Tabs.d.ts +1 -1
- package/dist/navigation/Tabs.js +53 -17
- package/dist/navigation/Tabs.js.map +1 -1
- package/dist/styles.css +12 -0
- package/package.json +1 -1
package/dist/forms/Select.d.ts
CHANGED
|
@@ -34,7 +34,16 @@ interface SelectProps {
|
|
|
34
34
|
name?: string;
|
|
35
35
|
id?: string;
|
|
36
36
|
containerStyle?: React.CSSProperties;
|
|
37
|
+
/**
|
|
38
|
+
* Accessible name for the trigger. Only needed when there's no visible
|
|
39
|
+
* `label` (e.g. a compact row where the context is already clear visually
|
|
40
|
+
* — a day name next to a "start time" / "end time" pair): `Field` only
|
|
41
|
+
* renders a `<label>` when `label` is set, so without either the trigger
|
|
42
|
+
* has no accessible name at all. Takes precedence over `label` if both are
|
|
43
|
+
* set — don't pass both.
|
|
44
|
+
*/
|
|
45
|
+
'aria-label'?: string;
|
|
37
46
|
}
|
|
38
|
-
declare function Select({ label, hint, error, required, options, placeholder, size, disabled, value: valueProp, defaultValue, onValueChange, name, id, containerStyle, }: SelectProps): React.JSX.Element;
|
|
47
|
+
declare function Select({ label, hint, error, required, options, placeholder, size, disabled, value: valueProp, defaultValue, onValueChange, name, id, containerStyle, 'aria-label': ariaLabel, }: SelectProps): React.JSX.Element;
|
|
39
48
|
|
|
40
49
|
export { Select, type SelectOption, type SelectProps };
|
package/dist/forms/Select.js
CHANGED
|
@@ -52,6 +52,7 @@ function fieldBoxStyle(size, error, open, disabled) {
|
|
|
52
52
|
function CustomSelect({
|
|
53
53
|
rid,
|
|
54
54
|
label,
|
|
55
|
+
ariaLabel,
|
|
55
56
|
options,
|
|
56
57
|
value,
|
|
57
58
|
placeholder,
|
|
@@ -299,6 +300,7 @@ function CustomSelect({
|
|
|
299
300
|
"aria-expanded": open,
|
|
300
301
|
"aria-controls": open ? listboxId : void 0,
|
|
301
302
|
"aria-activedescendant": open && activeIndex >= 0 ? `${rid}-opt-${activeIndex}` : void 0,
|
|
303
|
+
"aria-label": ariaLabel,
|
|
302
304
|
"aria-disabled": disabled || void 0,
|
|
303
305
|
disabled,
|
|
304
306
|
onPointerDown: () => {
|
|
@@ -484,7 +486,8 @@ function Select({
|
|
|
484
486
|
onValueChange,
|
|
485
487
|
name,
|
|
486
488
|
id,
|
|
487
|
-
containerStyle
|
|
489
|
+
containerStyle,
|
|
490
|
+
"aria-label": ariaLabel
|
|
488
491
|
}) {
|
|
489
492
|
const reactId = React.useId();
|
|
490
493
|
const rid = id || reactId;
|
|
@@ -505,6 +508,7 @@ function Select({
|
|
|
505
508
|
{
|
|
506
509
|
rid,
|
|
507
510
|
label,
|
|
511
|
+
ariaLabel,
|
|
508
512
|
options,
|
|
509
513
|
value,
|
|
510
514
|
placeholder,
|
package/dist/forms/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/forms/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { Check, ChevronDown } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { Field } from '../_internal/Field';\n\nexport interface SelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\n/**\n * Single-choice select — a hand-rolled listbox (token-styled, full keyboard\n * support) so it looks and behaves the same in every browser. On a mouse it's\n * an anchored dropdown; on touch it opens as a bottom sheet with finger-sized\n * rows.\n *\n * Value contract: `value` / `defaultValue` + `onValueChange(value)` — a plain\n * string, not a DOM event.\n */\nexport interface SelectProps {\n label?: string;\n hint?: string;\n /** Error message; also turns the control red. */\n error?: string;\n required?: boolean;\n options?: SelectOption[];\n /** Shown in muted text on the trigger when nothing is selected. */\n placeholder?: string;\n size?: 'sm' | 'md' | 'lg';\n disabled?: boolean;\n /** Controlled value. */\n value?: string;\n /** Uncontrolled initial value. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Form field name — mirrored to a hidden input so the value can be submitted. */\n name?: string;\n id?: string;\n containerStyle?: React.CSSProperties;\n}\n\nconst CONTROL_HEIGHT = {\n sm: 'var(--control-height-sm)',\n md: 'var(--control-height-md)',\n lg: 'var(--control-height-lg)',\n} as const;\n\nconst OPTION_PAD_Y = { sm: 6, md: 8, lg: 10 } as const;\n\nconst useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n\n/** True on touch / pen devices, where the native picker wins. SSR-safe. */\nfunction useCoarsePointer(): boolean {\n return React.useSyncExternalStore(\n (onChange) => {\n const mq = window.matchMedia('(pointer: coarse)');\n mq.addEventListener('change', onChange);\n return () => mq.removeEventListener('change', onChange);\n },\n () => window.matchMedia('(pointer: coarse)').matches,\n () => false,\n );\n}\n\nfunction fieldBoxStyle(size: NonNullable<SelectProps['size']>, error: boolean, open: boolean, disabled: boolean): React.CSSProperties {\n const active = open && !error;\n return sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-2)',\n width: '100%',\n height: CONTROL_HEIGHT[size],\n // Longhand (not the `padding` shorthand) so callers can override one side\n // — e.g. NativeSelect's right pad — without React leaving the others blank.\n paddingTop: 0,\n paddingRight: 'var(--space-3)',\n paddingBottom: 0,\n paddingLeft: 'var(--space-3)',\n borderRadius: 'var(--radius-control)',\n background: disabled ? 'var(--interactive-disabled-bg)' : 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid ' + (error ? 'var(--interactive-error)' : open ? 'var(--border-focus)' : 'var(--border-default)'),\n boxShadow: active ? 'var(--focus-ring)' : 'none',\n fontFamily: 'var(--font-body)',\n fontSize: size === 'sm' ? 'var(--text-sm)' : 'var(--text-base)',\n color: disabled ? 'var(--text-disabled)' : 'var(--text-primary)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n transition: 'var(--transition-control)',\n textAlign: 'left',\n });\n}\n\n// ── Custom listbox ──────────────────────────────────────────────────────────\nfunction CustomSelect({\n rid,\n label,\n options,\n value,\n placeholder,\n size,\n error,\n disabled,\n coarse,\n onCommit,\n}: {\n rid: string;\n /** The field label — shown as the sheet header on touch so the picker has context. */\n label?: string;\n options: SelectOption[];\n value: string;\n placeholder?: string;\n size: NonNullable<SelectProps['size']>;\n error: boolean;\n disabled?: boolean;\n /** Touch: open as a bottom sheet with finger-sized rows instead of a dropdown. */\n coarse: boolean;\n onCommit: (v: string) => void;\n}) {\n const listboxId = `${rid}-listbox`;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLUListElement>(null);\n const typeahead = React.useRef<{ str: string; timer: number }>({ str: '', timer: 0 });\n // A <label htmlFor> forwards a fully-trusted click to this button (detail:1),\n // indistinguishable from a direct one — but its *pointerdown* landed on the\n // label, not here. So only toggle when the press actually started on the box.\n const pressedAt = React.useRef(0);\n\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [mounted, setMounted] = React.useState(false);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- portal target is client-only\n React.useEffect(() => setMounted(true), []);\n // Two placement strategies, picked once per open:\n // • 'inline' — the common case. A plain `position: absolute` child of the\n // field wrapper. The browser glues it to the field through *any* scroll\n // (page or an inner overflow container) for free — zero JS, zero jitter,\n // never closes on scroll. Only re-flips the side if room runs out.\n // • 'fixed' — used when the field is inside a `position: fixed` container\n // (a Dialog), where an inline child would be clipped by the dialog's\n // overflow. Portalled to <body>, `position: fixed` at the trigger's\n // viewport rect. The dialog itself doesn't scroll, so it stays glued;\n // scrolling the dialog *body* detaches it, and we dismiss then.\n const [place, setPlace] = React.useState<\n | { strategy: 'inline'; above: boolean; maxH: number }\n | { strategy: 'fixed'; above: boolean; maxH: number; top: number; left: number; width: number }\n | null\n >(null);\n\n const selectedIndex = options.findIndex((o) => o.value === value);\n const selected = selectedIndex >= 0 ? options[selectedIndex] : undefined;\n\n const firstEnabled = () => options.findIndex((o) => !o.disabled);\n const lastEnabled = () => {\n for (let i = options.length - 1; i >= 0; i--) if (!options[i].disabled) return i;\n return -1;\n };\n const nextEnabled = (from: number, dir: 1 | -1) => {\n let i = from;\n for (let step = 0; step < options.length; step++) {\n i += dir;\n if (i < 0 || i >= options.length) return from;\n if (!options[i].disabled) return i;\n }\n return from;\n };\n\n useIsoLayoutEffect(() => {\n if (!open || coarse) return; // the touch sheet needs no anchoring\n const t = triggerRef.current;\n if (!t) return;\n\n const GAP = 6;\n // Non-zero fallback: if the viewport height is unreadable, assume room below\n // rather than flipping the menu up on a bad reading.\n const vh = window.innerHeight || document.documentElement.clientHeight || 900;\n const estH = Math.min(288, options.length * 36 + 8); // rough list height, no DOM\n const evalRoom = () => {\n const r = t.getBoundingClientRect();\n const roomBelow = vh - r.bottom - 8;\n const roomAbove = r.top - 8;\n const above = roomBelow < Math.min(estH, 200) && roomAbove > roomBelow;\n const maxH = Math.max(120, Math.min(288, Math.round((above ? roomAbove : roomBelow) - GAP)));\n return { r, above, maxH };\n };\n\n let fixed = false;\n for (let el: HTMLElement | null = t.parentElement; el && el !== document.body; el = el.parentElement) {\n if (getComputedStyle(el).position === 'fixed') {\n fixed = true;\n break;\n }\n }\n\n if (fixed) {\n const { r, above, maxH } = evalRoom();\n setPlace({ strategy: 'fixed', above, maxH, left: r.left, width: r.width, top: above ? r.top - GAP : r.bottom + GAP });\n const anchorTop = r.top;\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n if (Math.abs(t.getBoundingClientRect().top - anchorTop) > 1) setOpen(false);\n };\n const onResize = () => setOpen(false);\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', onResize);\n };\n }\n\n // Inline: the menu is a plain absolute child, glued for free. Never reposition\n // or close on scroll — only re-flip the side (rare) and re-cap height on\n // resize.\n const applyFull = () => {\n const { above, maxH } = evalRoom();\n setPlace((prev) =>\n prev?.strategy === 'inline' && prev.above === above && prev.maxH === maxH ? prev : { strategy: 'inline', above, maxH },\n );\n };\n applyFull();\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n const { above } = evalRoom();\n setPlace((prev) => (prev?.strategy === 'inline' && prev.above !== above ? { ...prev, above } : prev));\n };\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', applyFull);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', applyFull);\n };\n }, [open, coarse, options.length]);\n\n // Close on outside pointerdown (the touch sheet uses its own scrim instead).\n React.useEffect(() => {\n if (!open || coarse) return;\n const onDown = (e: PointerEvent) => {\n const target = e.target as Node;\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return;\n setOpen(false);\n };\n document.addEventListener('pointerdown', onDown, true);\n return () => document.removeEventListener('pointerdown', onDown, true);\n }, [open, coarse]);\n\n // The touch sheet is a modal surface — lock the page scroll behind it.\n React.useEffect(() => {\n if (!open || !coarse) return;\n const root = document.documentElement;\n const prev = { h: root.style.overflow, b: document.body.style.overflow };\n root.style.overflow = 'hidden';\n document.body.style.overflow = 'hidden';\n return () => {\n root.style.overflow = prev.h;\n document.body.style.overflow = prev.b;\n };\n }, [open, coarse]);\n\n // Keep the active option in view.\n React.useEffect(() => {\n if (!open || activeIndex < 0) return;\n document.getElementById(`${rid}-opt-${activeIndex}`)?.scrollIntoView({ block: 'nearest' });\n }, [open, activeIndex, rid]);\n\n const openMenu = () => {\n if (disabled) return;\n setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabled());\n setOpen(true);\n };\n const closeMenu = (refocus = true) => {\n setOpen(false);\n if (refocus) triggerRef.current?.focus({ preventScroll: true });\n };\n const choose = (i: number) => {\n const o = options[i];\n if (!o || o.disabled) return;\n onCommit(o.value);\n closeMenu();\n };\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? -1 : i, 1));\n return;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? options.length : i, -1));\n return;\n case 'Home':\n if (open) {\n e.preventDefault();\n setActiveIndex(firstEnabled());\n }\n return;\n case 'End':\n if (open) {\n e.preventDefault();\n setActiveIndex(lastEnabled());\n }\n return;\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!open) return openMenu();\n choose(activeIndex);\n return;\n case 'Escape':\n if (open) {\n e.preventDefault();\n closeMenu();\n }\n return;\n case 'Tab':\n if (open) setOpen(false);\n return;\n default:\n if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {\n const ta = typeahead.current;\n ta.str += e.key.toLowerCase();\n window.clearTimeout(ta.timer);\n ta.timer = window.setTimeout(() => (ta.str = ''), 500);\n const match = options.findIndex((o) => !o.disabled && o.label.toLowerCase().startsWith(ta.str));\n if (match >= 0) {\n if (!open) openMenu();\n setActiveIndex(match);\n }\n }\n }\n };\n\n const hasValue = !!selected;\n const rowPadY = coarse ? 12 : OPTION_PAD_Y[size];\n\n const listStyleBase: React.CSSProperties = {\n minWidth: 160,\n overflowY: 'auto',\n margin: 0,\n padding: 'var(--space-1)',\n listStyle: 'none',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-md)',\n boxShadow: 'var(--shadow-lg)',\n fontFamily: 'var(--font-body)',\n fontSize: size === 'sm' ? 'var(--text-sm)' : 'var(--text-base)',\n };\n const optionRows = options.map((o, i) => {\n const isSelected = o.value === value;\n const isActive = i === activeIndex;\n return (\n <li\n key={o.value}\n id={`${rid}-opt-${i}`}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={o.disabled || undefined}\n onPointerEnter={() => !o.disabled && setActiveIndex(i)}\n onClick={() => choose(i)}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 'var(--space-2)',\n minHeight: coarse ? 44 : undefined,\n padding: `${rowPadY}px var(--space-3)`,\n borderRadius: 'var(--radius-sm)',\n cursor: o.disabled ? 'not-allowed' : 'pointer',\n color: o.disabled ? 'var(--text-disabled)' : 'var(--text-primary)',\n background: isActive && !o.disabled ? 'var(--bg-subtle)' : 'transparent',\n fontWeight: isSelected ? 'var(--weight-semibold)' : 'var(--weight-regular)',\n fontSize: coarse ? 'var(--text-base)' : undefined,\n })}\n >\n <span style={sx({ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' })}>{o.label}</span>\n {isSelected && (\n <span style={sx({ display: 'flex', flex: '0 0 auto', color: 'var(--text-brand)' })}>\n <Check size={coarse ? 18 : 16} strokeWidth={2} />\n </span>\n )}\n </li>\n );\n });\n\n return (\n <div style={sx({ position: 'relative', width: '100%' })}>\n <button\n ref={triggerRef}\n type=\"button\"\n id={rid}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={open && activeIndex >= 0 ? `${rid}-opt-${activeIndex}` : undefined}\n aria-disabled={disabled || undefined}\n disabled={disabled}\n onPointerDown={() => {\n pressedAt.current = Date.now();\n }}\n onMouseDown={(e) => {\n // Take focus without the browser scrolling us into view.\n e.preventDefault();\n triggerRef.current?.focus({ preventScroll: true });\n }}\n onClick={() => {\n // Only toggle when the press started on this button — a click forwarded\n // from the field <label>, or synthesised by the keyboard, never set\n // pressedAt (keyboard is handled in onKeyDown).\n if (Date.now() - pressedAt.current > 500) return;\n pressedAt.current = 0;\n if (open) closeMenu(false);\n else openMenu();\n }}\n onKeyDown={onKeyDown}\n style={fieldBoxStyle(size, error, open, !!disabled)}\n >\n <span\n style={sx({\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n color: hasValue ? 'inherit' : 'var(--text-muted)',\n })}\n >\n {hasValue ? selected!.label : placeholder ?? 'Select…'}\n </span>\n <span\n aria-hidden=\"true\"\n style={sx({\n display: 'flex',\n flex: '0 0 auto',\n color: 'var(--text-muted)',\n transition: 'transform var(--duration-fast) var(--ease-standard)',\n transform: open ? 'rotate(180deg)' : 'none',\n })}\n >\n <ChevronDown size={16} strokeWidth={1.75} />\n </span>\n </button>\n\n {open && mounted && coarse &&\n createPortal(\n <div\n role=\"presentation\"\n onClick={() => closeMenu()}\n style={sx({\n position: 'fixed',\n inset: 0,\n zIndex: 1100,\n display: 'flex',\n alignItems: 'flex-end',\n background: 'var(--bg-overlay)',\n backdropFilter: 'blur(2px)',\n animation: 'sereno-fade-in var(--duration-fast) var(--ease-standard)',\n })}\n >\n <div\n onClick={(e) => e.stopPropagation()}\n style={sx({\n width: '100%',\n maxHeight: '70dvh',\n display: 'flex',\n flexDirection: 'column',\n background: 'var(--bg-surface)',\n borderRadius: 'var(--radius-sheet) var(--radius-sheet) 0 0',\n boxShadow: 'var(--shadow-sheet)',\n paddingBottom: 'env(safe-area-inset-bottom)',\n animation: 'sereno-slide-up var(--duration-sheet) var(--ease-gentle)',\n })}\n >\n {label && (\n <div\n style={sx({\n flex: '0 0 auto',\n padding: 'var(--space-3) var(--space-4)',\n borderBottom: 'var(--border-width-hairline) solid var(--border-subtle)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-snug)',\n color: 'var(--text-primary)',\n })}\n >\n {label}\n </div>\n )}\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n flex: '1 1 auto',\n minHeight: 0,\n border: 'none',\n borderRadius: 0,\n boxShadow: 'none',\n background: 'transparent',\n padding: 'var(--space-2)',\n overscrollBehavior: 'contain', // don't chain the list's scroll to the page\n })}\n >\n {optionRows}\n </ul>\n </div>\n </div>,\n document.body,\n )}\n {open && !coarse && place && place.strategy === 'inline' && (\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'absolute',\n left: 0,\n right: 0,\n ...(place.above ? { bottom: 'calc(100% + 6px)' } : { top: 'calc(100% + 6px)' }),\n maxHeight: place.maxH,\n zIndex: 100,\n })}\n >\n {optionRows}\n </ul>\n )}\n {open && !coarse && mounted && place && place.strategy === 'fixed' &&\n createPortal(\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'fixed',\n top: place.top,\n left: place.left,\n width: place.width,\n ...(place.above ? { transform: 'translateY(-100%)' } : null),\n maxHeight: place.maxH,\n zIndex: 1100,\n })}\n >\n {optionRows}\n </ul>,\n document.body,\n )}\n </div>\n );\n}\n\nexport function Select({\n label,\n hint,\n error,\n required,\n options = [],\n placeholder,\n size = 'md',\n disabled,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n id,\n containerStyle,\n}: SelectProps) {\n const reactId = React.useId();\n const rid = id || reactId;\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? '');\n const value = isControlled ? valueProp! : internalValue;\n const coarse = useCoarsePointer();\n\n const commit = React.useCallback(\n (v: string) => {\n if (!isControlled) setInternalValue(v);\n onValueChange?.(v);\n },\n [isControlled, onValueChange],\n );\n\n return (\n <Field label={label} hint={hint} error={error} required={required} htmlFor={rid} style={containerStyle}>\n <CustomSelect\n rid={rid}\n label={label}\n options={options}\n value={value}\n placeholder={placeholder}\n size={size}\n error={!!error}\n disabled={disabled}\n coarse={coarse}\n onCommit={commit}\n />\n {name && <input type=\"hidden\" name={name} value={value} />}\n </Field>\n );\n}\n"],"mappings":";AAsWM,SAuBE,KAvBF;AApWN,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,OAAO,mBAAmB;AACnC,SA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AA,IACA,CAAC,cAAc,aAAa;AAAA,EAC9B;AAEA,SACE,qBAAC,SAAM,OAAc,MAAY,OAAc,UAAoB,SAAS,KAAK,OAAO,gBACtF;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,CAAC,CAAC;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU;AAAA;AAAA,IACZ;AAAA,IACC,QAAQ,oBAAC,WAAM,MAAK,UAAS,MAAY,OAAc;AAAA,KAC1D;AAEJ;","names":["onScroll"]}
|
|
1
|
+
{"version":3,"sources":["../../src/forms/Select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport { Check, ChevronDown } from 'lucide-react';\nimport { sx } from '../_internal/style';\nimport { Field } from '../_internal/Field';\n\nexport interface SelectOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\n/**\n * Single-choice select — a hand-rolled listbox (token-styled, full keyboard\n * support) so it looks and behaves the same in every browser. On a mouse it's\n * an anchored dropdown; on touch it opens as a bottom sheet with finger-sized\n * rows.\n *\n * Value contract: `value` / `defaultValue` + `onValueChange(value)` — a plain\n * string, not a DOM event.\n */\nexport interface SelectProps {\n label?: string;\n hint?: string;\n /** Error message; also turns the control red. */\n error?: string;\n required?: boolean;\n options?: SelectOption[];\n /** Shown in muted text on the trigger when nothing is selected. */\n placeholder?: string;\n size?: 'sm' | 'md' | 'lg';\n disabled?: boolean;\n /** Controlled value. */\n value?: string;\n /** Uncontrolled initial value. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n /** Form field name — mirrored to a hidden input so the value can be submitted. */\n name?: string;\n id?: string;\n containerStyle?: React.CSSProperties;\n /**\n * Accessible name for the trigger. Only needed when there's no visible\n * `label` (e.g. a compact row where the context is already clear visually\n * — a day name next to a \"start time\" / \"end time\" pair): `Field` only\n * renders a `<label>` when `label` is set, so without either the trigger\n * has no accessible name at all. Takes precedence over `label` if both are\n * set — don't pass both.\n */\n 'aria-label'?: string;\n}\n\nconst CONTROL_HEIGHT = {\n sm: 'var(--control-height-sm)',\n md: 'var(--control-height-md)',\n lg: 'var(--control-height-lg)',\n} as const;\n\nconst OPTION_PAD_Y = { sm: 6, md: 8, lg: 10 } as const;\n\nconst useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n\n/** True on touch / pen devices, where the native picker wins. SSR-safe. */\nfunction useCoarsePointer(): boolean {\n return React.useSyncExternalStore(\n (onChange) => {\n const mq = window.matchMedia('(pointer: coarse)');\n mq.addEventListener('change', onChange);\n return () => mq.removeEventListener('change', onChange);\n },\n () => window.matchMedia('(pointer: coarse)').matches,\n () => false,\n );\n}\n\nfunction fieldBoxStyle(size: NonNullable<SelectProps['size']>, error: boolean, open: boolean, disabled: boolean): React.CSSProperties {\n const active = open && !error;\n return sx({\n display: 'flex',\n alignItems: 'center',\n gap: 'var(--space-2)',\n width: '100%',\n height: CONTROL_HEIGHT[size],\n // Longhand (not the `padding` shorthand) so callers can override one side\n // — e.g. NativeSelect's right pad — without React leaving the others blank.\n paddingTop: 0,\n paddingRight: 'var(--space-3)',\n paddingBottom: 0,\n paddingLeft: 'var(--space-3)',\n borderRadius: 'var(--radius-control)',\n background: disabled ? 'var(--interactive-disabled-bg)' : 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid ' + (error ? 'var(--interactive-error)' : open ? 'var(--border-focus)' : 'var(--border-default)'),\n boxShadow: active ? 'var(--focus-ring)' : 'none',\n fontFamily: 'var(--font-body)',\n fontSize: size === 'sm' ? 'var(--text-sm)' : 'var(--text-base)',\n color: disabled ? 'var(--text-disabled)' : 'var(--text-primary)',\n cursor: disabled ? 'not-allowed' : 'pointer',\n transition: 'var(--transition-control)',\n textAlign: 'left',\n });\n}\n\n// ── Custom listbox ──────────────────────────────────────────────────────────\nfunction CustomSelect({\n rid,\n label,\n ariaLabel,\n options,\n value,\n placeholder,\n size,\n error,\n disabled,\n coarse,\n onCommit,\n}: {\n rid: string;\n /** The field label — shown as the sheet header on touch so the picker has context. */\n label?: string;\n /** Falls back to `label` when there's no visible one at all. */\n ariaLabel?: string;\n options: SelectOption[];\n value: string;\n placeholder?: string;\n size: NonNullable<SelectProps['size']>;\n error: boolean;\n disabled?: boolean;\n /** Touch: open as a bottom sheet with finger-sized rows instead of a dropdown. */\n coarse: boolean;\n onCommit: (v: string) => void;\n}) {\n const listboxId = `${rid}-listbox`;\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLUListElement>(null);\n const typeahead = React.useRef<{ str: string; timer: number }>({ str: '', timer: 0 });\n // A <label htmlFor> forwards a fully-trusted click to this button (detail:1),\n // indistinguishable from a direct one — but its *pointerdown* landed on the\n // label, not here. So only toggle when the press actually started on the box.\n const pressedAt = React.useRef(0);\n\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(-1);\n const [mounted, setMounted] = React.useState(false);\n // eslint-disable-next-line react-hooks/set-state-in-effect -- portal target is client-only\n React.useEffect(() => setMounted(true), []);\n // Two placement strategies, picked once per open:\n // • 'inline' — the common case. A plain `position: absolute` child of the\n // field wrapper. The browser glues it to the field through *any* scroll\n // (page or an inner overflow container) for free — zero JS, zero jitter,\n // never closes on scroll. Only re-flips the side if room runs out.\n // • 'fixed' — used when the field is inside a `position: fixed` container\n // (a Dialog), where an inline child would be clipped by the dialog's\n // overflow. Portalled to <body>, `position: fixed` at the trigger's\n // viewport rect. The dialog itself doesn't scroll, so it stays glued;\n // scrolling the dialog *body* detaches it, and we dismiss then.\n const [place, setPlace] = React.useState<\n | { strategy: 'inline'; above: boolean; maxH: number }\n | { strategy: 'fixed'; above: boolean; maxH: number; top: number; left: number; width: number }\n | null\n >(null);\n\n const selectedIndex = options.findIndex((o) => o.value === value);\n const selected = selectedIndex >= 0 ? options[selectedIndex] : undefined;\n\n const firstEnabled = () => options.findIndex((o) => !o.disabled);\n const lastEnabled = () => {\n for (let i = options.length - 1; i >= 0; i--) if (!options[i].disabled) return i;\n return -1;\n };\n const nextEnabled = (from: number, dir: 1 | -1) => {\n let i = from;\n for (let step = 0; step < options.length; step++) {\n i += dir;\n if (i < 0 || i >= options.length) return from;\n if (!options[i].disabled) return i;\n }\n return from;\n };\n\n useIsoLayoutEffect(() => {\n if (!open || coarse) return; // the touch sheet needs no anchoring\n const t = triggerRef.current;\n if (!t) return;\n\n const GAP = 6;\n // Non-zero fallback: if the viewport height is unreadable, assume room below\n // rather than flipping the menu up on a bad reading.\n const vh = window.innerHeight || document.documentElement.clientHeight || 900;\n const estH = Math.min(288, options.length * 36 + 8); // rough list height, no DOM\n const evalRoom = () => {\n const r = t.getBoundingClientRect();\n const roomBelow = vh - r.bottom - 8;\n const roomAbove = r.top - 8;\n const above = roomBelow < Math.min(estH, 200) && roomAbove > roomBelow;\n const maxH = Math.max(120, Math.min(288, Math.round((above ? roomAbove : roomBelow) - GAP)));\n return { r, above, maxH };\n };\n\n let fixed = false;\n for (let el: HTMLElement | null = t.parentElement; el && el !== document.body; el = el.parentElement) {\n if (getComputedStyle(el).position === 'fixed') {\n fixed = true;\n break;\n }\n }\n\n if (fixed) {\n const { r, above, maxH } = evalRoom();\n setPlace({ strategy: 'fixed', above, maxH, left: r.left, width: r.width, top: above ? r.top - GAP : r.bottom + GAP });\n const anchorTop = r.top;\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n if (Math.abs(t.getBoundingClientRect().top - anchorTop) > 1) setOpen(false);\n };\n const onResize = () => setOpen(false);\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', onResize);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', onResize);\n };\n }\n\n // Inline: the menu is a plain absolute child, glued for free. Never reposition\n // or close on scroll — only re-flip the side (rare) and re-cap height on\n // resize.\n const applyFull = () => {\n const { above, maxH } = evalRoom();\n setPlace((prev) =>\n prev?.strategy === 'inline' && prev.above === above && prev.maxH === maxH ? prev : { strategy: 'inline', above, maxH },\n );\n };\n applyFull();\n const onScroll = (e: Event) => {\n if (e.target instanceof Node && panelRef.current?.contains(e.target)) return;\n const { above } = evalRoom();\n setPlace((prev) => (prev?.strategy === 'inline' && prev.above !== above ? { ...prev, above } : prev));\n };\n window.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', applyFull);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', applyFull);\n };\n }, [open, coarse, options.length]);\n\n // Close on outside pointerdown (the touch sheet uses its own scrim instead).\n React.useEffect(() => {\n if (!open || coarse) return;\n const onDown = (e: PointerEvent) => {\n const target = e.target as Node;\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return;\n setOpen(false);\n };\n document.addEventListener('pointerdown', onDown, true);\n return () => document.removeEventListener('pointerdown', onDown, true);\n }, [open, coarse]);\n\n // The touch sheet is a modal surface — lock the page scroll behind it.\n React.useEffect(() => {\n if (!open || !coarse) return;\n const root = document.documentElement;\n const prev = { h: root.style.overflow, b: document.body.style.overflow };\n root.style.overflow = 'hidden';\n document.body.style.overflow = 'hidden';\n return () => {\n root.style.overflow = prev.h;\n document.body.style.overflow = prev.b;\n };\n }, [open, coarse]);\n\n // Keep the active option in view.\n React.useEffect(() => {\n if (!open || activeIndex < 0) return;\n document.getElementById(`${rid}-opt-${activeIndex}`)?.scrollIntoView({ block: 'nearest' });\n }, [open, activeIndex, rid]);\n\n const openMenu = () => {\n if (disabled) return;\n setActiveIndex(selectedIndex >= 0 ? selectedIndex : firstEnabled());\n setOpen(true);\n };\n const closeMenu = (refocus = true) => {\n setOpen(false);\n if (refocus) triggerRef.current?.focus({ preventScroll: true });\n };\n const choose = (i: number) => {\n const o = options[i];\n if (!o || o.disabled) return;\n onCommit(o.value);\n closeMenu();\n };\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? -1 : i, 1));\n return;\n case 'ArrowUp':\n e.preventDefault();\n if (!open) return openMenu();\n setActiveIndex((i) => nextEnabled(i < 0 ? options.length : i, -1));\n return;\n case 'Home':\n if (open) {\n e.preventDefault();\n setActiveIndex(firstEnabled());\n }\n return;\n case 'End':\n if (open) {\n e.preventDefault();\n setActiveIndex(lastEnabled());\n }\n return;\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!open) return openMenu();\n choose(activeIndex);\n return;\n case 'Escape':\n if (open) {\n e.preventDefault();\n closeMenu();\n }\n return;\n case 'Tab':\n if (open) setOpen(false);\n return;\n default:\n if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {\n const ta = typeahead.current;\n ta.str += e.key.toLowerCase();\n window.clearTimeout(ta.timer);\n ta.timer = window.setTimeout(() => (ta.str = ''), 500);\n const match = options.findIndex((o) => !o.disabled && o.label.toLowerCase().startsWith(ta.str));\n if (match >= 0) {\n if (!open) openMenu();\n setActiveIndex(match);\n }\n }\n }\n };\n\n const hasValue = !!selected;\n const rowPadY = coarse ? 12 : OPTION_PAD_Y[size];\n\n const listStyleBase: React.CSSProperties = {\n minWidth: 160,\n overflowY: 'auto',\n margin: 0,\n padding: 'var(--space-1)',\n listStyle: 'none',\n background: 'var(--bg-surface)',\n border: 'var(--border-width-hairline) solid var(--border-default)',\n borderRadius: 'var(--radius-md)',\n boxShadow: 'var(--shadow-lg)',\n fontFamily: 'var(--font-body)',\n fontSize: size === 'sm' ? 'var(--text-sm)' : 'var(--text-base)',\n };\n const optionRows = options.map((o, i) => {\n const isSelected = o.value === value;\n const isActive = i === activeIndex;\n return (\n <li\n key={o.value}\n id={`${rid}-opt-${i}`}\n role=\"option\"\n aria-selected={isSelected}\n aria-disabled={o.disabled || undefined}\n onPointerEnter={() => !o.disabled && setActiveIndex(i)}\n onClick={() => choose(i)}\n style={sx({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 'var(--space-2)',\n minHeight: coarse ? 44 : undefined,\n padding: `${rowPadY}px var(--space-3)`,\n borderRadius: 'var(--radius-sm)',\n cursor: o.disabled ? 'not-allowed' : 'pointer',\n color: o.disabled ? 'var(--text-disabled)' : 'var(--text-primary)',\n background: isActive && !o.disabled ? 'var(--bg-subtle)' : 'transparent',\n fontWeight: isSelected ? 'var(--weight-semibold)' : 'var(--weight-regular)',\n fontSize: coarse ? 'var(--text-base)' : undefined,\n })}\n >\n <span style={sx({ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' })}>{o.label}</span>\n {isSelected && (\n <span style={sx({ display: 'flex', flex: '0 0 auto', color: 'var(--text-brand)' })}>\n <Check size={coarse ? 18 : 16} strokeWidth={2} />\n </span>\n )}\n </li>\n );\n });\n\n return (\n <div style={sx({ position: 'relative', width: '100%' })}>\n <button\n ref={triggerRef}\n type=\"button\"\n id={rid}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listboxId : undefined}\n aria-activedescendant={open && activeIndex >= 0 ? `${rid}-opt-${activeIndex}` : undefined}\n aria-label={ariaLabel}\n aria-disabled={disabled || undefined}\n disabled={disabled}\n onPointerDown={() => {\n pressedAt.current = Date.now();\n }}\n onMouseDown={(e) => {\n // Take focus without the browser scrolling us into view.\n e.preventDefault();\n triggerRef.current?.focus({ preventScroll: true });\n }}\n onClick={() => {\n // Only toggle when the press started on this button — a click forwarded\n // from the field <label>, or synthesised by the keyboard, never set\n // pressedAt (keyboard is handled in onKeyDown).\n if (Date.now() - pressedAt.current > 500) return;\n pressedAt.current = 0;\n if (open) closeMenu(false);\n else openMenu();\n }}\n onKeyDown={onKeyDown}\n style={fieldBoxStyle(size, error, open, !!disabled)}\n >\n <span\n style={sx({\n flex: 1,\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n color: hasValue ? 'inherit' : 'var(--text-muted)',\n })}\n >\n {hasValue ? selected!.label : placeholder ?? 'Select…'}\n </span>\n <span\n aria-hidden=\"true\"\n style={sx({\n display: 'flex',\n flex: '0 0 auto',\n color: 'var(--text-muted)',\n transition: 'transform var(--duration-fast) var(--ease-standard)',\n transform: open ? 'rotate(180deg)' : 'none',\n })}\n >\n <ChevronDown size={16} strokeWidth={1.75} />\n </span>\n </button>\n\n {open && mounted && coarse &&\n createPortal(\n <div\n role=\"presentation\"\n onClick={() => closeMenu()}\n style={sx({\n position: 'fixed',\n inset: 0,\n zIndex: 1100,\n display: 'flex',\n alignItems: 'flex-end',\n background: 'var(--bg-overlay)',\n backdropFilter: 'blur(2px)',\n animation: 'sereno-fade-in var(--duration-fast) var(--ease-standard)',\n })}\n >\n <div\n onClick={(e) => e.stopPropagation()}\n style={sx({\n width: '100%',\n maxHeight: '70dvh',\n display: 'flex',\n flexDirection: 'column',\n background: 'var(--bg-surface)',\n borderRadius: 'var(--radius-sheet) var(--radius-sheet) 0 0',\n boxShadow: 'var(--shadow-sheet)',\n paddingBottom: 'env(safe-area-inset-bottom)',\n animation: 'sereno-slide-up var(--duration-sheet) var(--ease-gentle)',\n })}\n >\n {label && (\n <div\n style={sx({\n flex: '0 0 auto',\n padding: 'var(--space-3) var(--space-4)',\n borderBottom: 'var(--border-width-hairline) solid var(--border-subtle)',\n fontFamily: 'var(--font-body)',\n fontSize: 'var(--text-base)',\n fontWeight: 'var(--weight-semibold)',\n letterSpacing: 'var(--tracking-snug)',\n color: 'var(--text-primary)',\n })}\n >\n {label}\n </div>\n )}\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n aria-label={label}\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n flex: '1 1 auto',\n minHeight: 0,\n border: 'none',\n borderRadius: 0,\n boxShadow: 'none',\n background: 'transparent',\n padding: 'var(--space-2)',\n overscrollBehavior: 'contain', // don't chain the list's scroll to the page\n })}\n >\n {optionRows}\n </ul>\n </div>\n </div>,\n document.body,\n )}\n {open && !coarse && place && place.strategy === 'inline' && (\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'absolute',\n left: 0,\n right: 0,\n ...(place.above ? { bottom: 'calc(100% + 6px)' } : { top: 'calc(100% + 6px)' }),\n maxHeight: place.maxH,\n zIndex: 100,\n })}\n >\n {optionRows}\n </ul>\n )}\n {open && !coarse && mounted && place && place.strategy === 'fixed' &&\n createPortal(\n <ul\n ref={panelRef}\n id={listboxId}\n role=\"listbox\"\n tabIndex={-1}\n style={sx({\n ...listStyleBase,\n position: 'fixed',\n top: place.top,\n left: place.left,\n width: place.width,\n ...(place.above ? { transform: 'translateY(-100%)' } : null),\n maxHeight: place.maxH,\n zIndex: 1100,\n })}\n >\n {optionRows}\n </ul>,\n document.body,\n )}\n </div>\n );\n}\n\nexport function Select({\n label,\n hint,\n error,\n required,\n options = [],\n placeholder,\n size = 'md',\n disabled,\n value: valueProp,\n defaultValue,\n onValueChange,\n name,\n id,\n containerStyle,\n 'aria-label': ariaLabel,\n}: SelectProps) {\n const reactId = React.useId();\n const rid = id || reactId;\n const isControlled = valueProp !== undefined;\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? '');\n const value = isControlled ? valueProp! : internalValue;\n const coarse = useCoarsePointer();\n\n const commit = React.useCallback(\n (v: string) => {\n if (!isControlled) setInternalValue(v);\n onValueChange?.(v);\n },\n [isControlled, onValueChange],\n );\n\n return (\n <Field label={label} hint={hint} error={error} required={required} htmlFor={rid} style={containerStyle}>\n <CustomSelect\n rid={rid}\n label={label}\n ariaLabel={ariaLabel}\n options={options}\n value={value}\n placeholder={placeholder}\n size={size}\n error={!!error}\n disabled={disabled}\n coarse={coarse}\n onCommit={commit}\n />\n {name && <input type=\"hidden\" name={name} value={value} />}\n </Field>\n );\n}\n"],"mappings":";AAkXM,SAuBE,KAvBF;AAhXN,YAAY,WAAW;AACvB,SAAS,oBAAoB;AAC7B,SAAS,OAAO,mBAAmB;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aAAc,kBAAiB,CAAC;AACrC,sBAAgB,CAAC;AAAA,IACnB;AAAA,IACA,CAAC,cAAc,aAAa;AAAA,EAC9B;AAEA,SACE,qBAAC,SAAM,OAAc,MAAY,OAAc,UAAoB,SAAS,KAAK,OAAO,gBACtF;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,CAAC,CAAC;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU;AAAA;AAAA,IACZ;AAAA,IACC,QAAQ,oBAAC,WAAM,MAAK,UAAS,MAAY,OAAc;AAAA,KAC1D;AAEJ;","names":["onScroll"]}
|
|
@@ -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 & {
|
package/dist/navigation/Tabs.js
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
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,IAAI;AAErE,SAAS,eAAe,WAAqC;AAC3D,QAAM,MAAM,MAAM,WAAW,WAAW;AACxC,MAAI,CAAC,IAAK,OAAM,I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AW;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,WAAW,YAAY,IAAI,MAAM,SAA8E,IAAI;AAE1H,QAAM,eAAe,MAAM,YAAY,MAAM;AAC3C,UAAM,KAAK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,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
|