gridsmith-ui 0.30.1 → 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/dist/chat.js +14 -8
- package/dist/chat.js.map +1 -1
- package/dist/{chunk-R5QXMNW7.js → chunk-4HJDOZ2M.js} +107 -17
- package/dist/chunk-4HJDOZ2M.js.map +1 -0
- package/dist/{chunk-SJZWEBHL.js → chunk-ACLKDE5W.js} +6 -5
- package/dist/chunk-ACLKDE5W.js.map +1 -0
- package/dist/{chunk-OVHBQT3Z.js → chunk-BZRZENBS.js} +4 -4
- package/dist/{chunk-OVHBQT3Z.js.map → chunk-BZRZENBS.js.map} +1 -1
- package/dist/{chunk-ISONVOA7.js → chunk-HVGHGBKV.js} +4 -5
- package/dist/chunk-HVGHGBKV.js.map +1 -0
- package/dist/{chunk-KMKBOTFR.js → chunk-K6IDOCGE.js} +7 -9
- package/dist/chunk-K6IDOCGE.js.map +1 -0
- package/dist/{chunk-ULCACQSA.js → chunk-MIUSSYVE.js} +3 -3
- package/dist/{chunk-ULCACQSA.js.map → chunk-MIUSSYVE.js.map} +1 -1
- package/dist/{chunk-T52LAFKG.js → chunk-SIWERRP2.js} +7 -8
- package/dist/chunk-SIWERRP2.js.map +1 -0
- package/dist/{chunk-OX3NNMWG.js → chunk-SQHKC4HA.js} +8 -5
- package/dist/chunk-SQHKC4HA.js.map +1 -0
- package/dist/{chunk-SLRTSBCJ.js → chunk-USHW523V.js} +31 -10
- package/dist/chunk-USHW523V.js.map +1 -0
- package/dist/{chunk-UDJOIVKQ.js → chunk-WWN6CQKI.js} +34 -4
- package/dist/chunk-WWN6CQKI.js.map +1 -0
- package/dist/{chunk-NEUWZUK6.js → chunk-ZASGFL5D.js} +3 -3
- package/dist/{chunk-NEUWZUK6.js.map → chunk-ZASGFL5D.js.map} +1 -1
- package/dist/{chunk-IELIF4PJ.js → chunk-ZCDA74RQ.js} +3 -3
- package/dist/{chunk-IELIF4PJ.js.map → chunk-ZCDA74RQ.js.map} +1 -1
- package/dist/data-grid.js +6 -8
- package/dist/data-grid.js.map +1 -1
- package/dist/editor-mentions.js +2 -3
- package/dist/editor-mentions.js.map +1 -1
- package/dist/editor.js +2 -4
- package/dist/editor.js.map +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +44 -38
- package/dist/index.js.map +1 -1
- package/dist/kanban.js +7 -9
- package/dist/kanban.js.map +1 -1
- package/dist/resizable.js +6 -8
- package/dist/resizable.js.map +1 -1
- package/dist/virtualized.js +6 -8
- package/dist/virtualized.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HTXP5BMM.js +0 -38
- package/dist/chunk-HTXP5BMM.js.map +0 -1
- package/dist/chunk-ISONVOA7.js.map +0 -1
- package/dist/chunk-KMKBOTFR.js.map +0 -1
- package/dist/chunk-OX3NNMWG.js.map +0 -1
- package/dist/chunk-R5QXMNW7.js.map +0 -1
- package/dist/chunk-SJZWEBHL.js.map +0 -1
- package/dist/chunk-SLRTSBCJ.js.map +0 -1
- package/dist/chunk-T52LAFKG.js.map +0 -1
- package/dist/chunk-UDJOIVKQ.js.map +0 -1
- package/dist/chunk-WIUGPZOH.js +0 -88
- package/dist/chunk-WIUGPZOH.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../showcase/src/lib/initials.ts","../../../showcase/src/components/Avatar.tsx","../../../showcase/src/lib/use-active-option.ts","../../../showcase/src/lib/search-text.ts","../../../showcase/src/components/MentionList.tsx"],"names":["useRef","jsxs","jsx"],"mappings":";;;;;;;;AAQO,SAAS,WAAW,IAAA,EAAsB;AAC/C,EAAA,OAAO,IAAA,CACJ,IAAA,EAAK,CACL,KAAA,CAAM,KAAK,CAAA,CACX,MAAA,CAAO,OAAO,CAAA,CACd,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,CACV,GAAA,CAAI,CAAC,IAAA,KAAS,KAAA,CAAM,IAAA,CAAK,IAAI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K,QAAA;AAAA,YAAO,IAAA,KAAS,IAAI,SAAA,GAAY,OAAA;AAAA,YAAQ;AAAA,WAAA,EAChD;AAAA;AAAA;AAAA,KAEJ;AAAA,IACA,QAAA,CAAS;AAAA,GACX;AACF","file":"chunk-NEUWZUK6.js","sourcesContent":["/**\n * Initials for an avatar. Round 21 (run 58): a builder passed each person's full name as `initials`, and the avatar\n * printed \"Amara Haddad\" across a 40 px circle on every row of the Team table. The avatar now reads what it is given:\n * up to three characters with no space are initials already and stay as they are (\"JB\", \"ABC\"); anything longer is a\n * name, and its first two words give the letters.\n */\n\n/** \"Sarah Chen\" → \"SC\"; \"Acme\" → \"A\"; \"Mary Jane Watson\" → \"MJ\". */\nexport function initialsOf(name: string): string {\n return name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((word) => Array.from(word)[0] ?? \"\")\n .join(\"\")\n .toUpperCase();\n}\n\n/** What an avatar shows for an `initials` value: initials as given, or the initials of a name. */\nexport function toInitials(value: string): string {\n const s = value.trim();\n if (!s) return \"\";\n if (!/\\s/.test(s) && Array.from(s).length <= 3) return s;\n return initialsOf(s);\n}\n","import { cn } from \"../lib/utils\";\nimport { toInitials } from \"../lib/initials\";\n\nexport type AvatarStatus = \"online\" | \"away\" | \"busy\" | \"offline\";\nexport type AvatarColor = \"auto\" | \"accent\" | \"neutral\" | 1 | 2 | 3 | 4 | 5;\n\ninterface AvatarProps {\n /** One to three letters (\"JB\"). A name passed here shows its initials (\"Amara Haddad\" → \"AH\"), never the whole name. */\n initials?: string;\n src?: string;\n alt?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n status?: AvatarStatus;\n /** Initials background. \"auto\" (default) derives a stable palette tint from alt/initials so groups vary; use \"accent\" sparingly. */\n color?: AvatarColor;\n className?: string;\n}\n\nconst sizeStyles = {\n sm: \"h-8 w-8 text-xs\",\n md: \"h-10 w-10 text-sm\",\n lg: \"h-12 w-12 text-base\",\n};\n\n// Fallbacks cover themes whose tokens CSS predates the decorative palette.\nconst paletteStyles = {\n 1: \"bg-[var(--ds-palette-1-bg,var(--ds-bg-muted))] text-[var(--ds-palette-1-text,var(--ds-text-secondary))]\",\n 2: \"bg-[var(--ds-palette-2-bg,var(--ds-bg-muted))] text-[var(--ds-palette-2-text,var(--ds-text-secondary))]\",\n 3: \"bg-[var(--ds-palette-3-bg,var(--ds-bg-muted))] text-[var(--ds-palette-3-text,var(--ds-text-secondary))]\",\n 4: \"bg-[var(--ds-palette-4-bg,var(--ds-bg-muted))] text-[var(--ds-palette-4-text,var(--ds-text-secondary))]\",\n 5: \"bg-[var(--ds-palette-5-bg,var(--ds-bg-muted))] text-[var(--ds-palette-5-text,var(--ds-text-secondary))]\",\n} as const;\n\nfunction paletteFor(seed: string): keyof typeof paletteStyles {\n let h = 0;\n for (const ch of seed) h = (h * 31 + ch.charCodeAt(0)) >>> 0;\n return ((h % 5) + 1) as keyof typeof paletteStyles;\n}\n\nfunction colorStyles(color: AvatarColor, seed: string): string {\n if (color === \"accent\") return \"bg-[var(--ds-accent-primary)] text-[var(--ds-text-on-primary)]\";\n if (color === \"neutral\") return \"bg-[var(--ds-bg-muted)] text-[var(--ds-text-secondary)]\";\n return paletteStyles[color === \"auto\" ? paletteFor(seed) : color];\n}\n\n/**\n * Presence as a shape as well as a colour (Sprint 25.12 A48, WCAG 1.4.1), as Fluent's presence badges do: online a filled\n * dot, away a ring, busy a dot with a bar, offline a ring with a slash. The words are in the avatar's name.\n */\nfunction PresenceMark({ status }: { status: AvatarStatus }) {\n return (\n <svg viewBox=\"0 0 10 10\" width=\"10\" height=\"10\" aria-hidden=\"true\" focusable=\"false\" data-presence={status} className=\"block\">\n {status === \"online\" && <circle cx=\"5\" cy=\"5\" r=\"5\" className=\"fill-[var(--ds-status-success)]\" />}\n {status === \"away\" && <circle cx=\"5\" cy=\"5\" r=\"4\" fill=\"none\" strokeWidth=\"2\" className=\"stroke-[var(--ds-status-warning)]\" />}\n {status === \"busy\" && (\n <>\n <circle cx=\"5\" cy=\"5\" r=\"5\" className=\"fill-[var(--ds-status-error)]\" />\n <rect x=\"2.5\" y=\"4.1\" width=\"5\" height=\"1.8\" rx=\"0.9\" className=\"fill-[var(--ds-bg-canvas)]\" />\n </>\n )}\n {status === \"offline\" && (\n <>\n <circle cx=\"5\" cy=\"5\" r=\"4\" fill=\"none\" strokeWidth=\"2\" className=\"stroke-[var(--ds-text-muted)]\" />\n <line x1=\"3.1\" y1=\"6.9\" x2=\"6.9\" y2=\"3.1\" strokeWidth=\"1.5\" strokeLinecap=\"round\" className=\"stroke-[var(--ds-text-muted)]\" />\n </>\n )}\n </svg>\n );\n}\n\nexport function Avatar({ initials, src, alt, size = \"md\", status, color = \"auto\", className }: AvatarProps) {\n // A48: presence can't show words beside a small avatar, so the avatar's own name carries it (\"Priya Nair, online\")\n const who = alt ?? initials ?? \"\";\n const named = status ? [who, status].filter(Boolean).join(\", \") : undefined;\n const base = cn(\n \"inline-flex items-center justify-center font-medium shrink-0\",\n \"rounded-[var(--ds-radius-full)]\",\n sizeStyles[size],\n className,\n );\n\n // data-avatar: the Table and DataGrid card mode stacks a cell that holds an avatar (Sprint 25.4 C-2).\n const avatarElement = src ? (\n <img\n data-avatar=\"\"\n src={src}\n alt={named ?? alt ?? initials ?? \"\"}\n className={cn(base, \"object-cover\")}\n />\n ) : (\n <div\n data-avatar=\"\"\n role={named ? \"img\" : undefined}\n aria-label={named}\n className={cn(\n base,\n colorStyles(color, alt ?? initials ?? \"\"),\n \"border-[length:var(--ds-border-width)] border-transparent\",\n )}\n >\n {/* round 21: a full name passed as initials shows its initials, not the name squeezed into the circle */}\n {initials != null ? toInitials(initials) : null}\n </div>\n );\n\n if (!status) return avatarElement;\n\n return (\n <div className=\"relative inline-flex\">\n {avatarElement}\n <span\n className={cn(\n \"absolute\",\n size === \"sm\" && \"bottom-[-2px] right-[-2px]\",\n size === \"md\" && \"bottom-[0px] right-[0px]\",\n size === \"lg\" && \"bottom-[2px] right-[2px]\",\n )}\n aria-hidden=\"true\"\n >\n {/* the canvas behind the mark fills a ring's middle and draws the 2px halo that separates it from the photo */}\n <span className=\"block rounded-[var(--ds-radius-full)] bg-[var(--ds-bg-canvas)] shadow-[0_0_0_2px_var(--ds-bg-canvas)]\">\n <PresenceMark status={status} />\n </span>\n </span>\n </div>\n );\n}\n","import { useLayoutEffect, useRef, type RefObject } from \"react\";\n\n/**\n * Keeps the active option of a list driven by aria-activedescendant in view (Sprint 25.17's review; WCAG 2.4.11): when\n * the list opens and when the active option changes, the list scrolls just enough to show it. Only the list's own box\n * scrolls, never the page: the list sits fixed over it. The option is found by its id, in the list's own document or\n * shadow root.\n *\n * Only a change brings it back into view (the second review): a render that leaves the same option active — the page\n * scrolling, the list scrolled by touch or by its scrollbar — leaves the list where the user put it.\n */\nexport function useActiveOptionInView(list: RefObject<HTMLElement | null>, activeId: string | undefined): void {\n // the option last brought into view, by its id and its text: a filtered list reuses an id for another option\n const shown = useRef<string | null>(null);\n useLayoutEffect(() => {\n const box = list.current;\n if (!box || !activeId) {\n shown.current = null;\n return;\n }\n const root = box.getRootNode() as Document | ShadowRoot;\n const option = typeof root.getElementById === \"function\" ? root.getElementById(activeId) : null;\n if (!option || !box.contains(option)) return;\n const seen = `${activeId}\\u0000${option.textContent ?? \"\"}`;\n if (seen === shown.current) return;\n shown.current = seen;\n const top = option.getBoundingClientRect().top - box.getBoundingClientRect().top + box.scrollTop;\n const bottom = top + option.offsetHeight;\n if (top < box.scrollTop) box.scrollTo({ top });\n else if (bottom > box.scrollTop + box.clientHeight) box.scrollTo({ top: bottom - box.clientHeight });\n });\n}\n","/**\n * Text as a search reads it, one way for every picker (Sprint 25.17's second review): no case, no accents, and \"_\" as a\n * space, so \"@toma\" finds Tomás, \"Sao Paulo\" and \"São Paulo\" find America/Sao_Paulo, and \"New_York\" finds New York.\n */\nexport function foldForSearch(text: string): string {\n return text.normalize(\"NFD\").replace(/\\p{M}/gu, \"\").replace(/_/g, \" \").toLowerCase();\n}\n","import { useMemo, useRef, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/utils\";\nimport { usePosition } from \"../lib/use-position\";\nimport { useLatest } from \"../lib/use-latest\";\nimport { useActiveOptionInView } from \"../lib/use-active-option\";\nimport { foldForSearch } from \"../lib/search-text\";\nimport { Avatar } from \"./Avatar\";\n\nexport interface MentionSuggestion {\n id: string;\n label: string;\n avatar?: string;\n description?: string;\n}\n\n/** Text as a search reads it: no case, no accents (\"@toma\" finds Tomás, \"@zoe\" Zoë), as every picker reads it. */\nconst fold = foldForSearch;\n\n/**\n * The suggestions a query matches, by name or by description, ignoring case and accents, best first: a name that starts with it\n * (\"@Mar\": Marcus Chen), then a name with a word that does (Tomás Martin), then a name holding it anywhere (Amara), then\n * a description that does; in their own order within each.\n */\nexport function matchMentions(items: MentionSuggestion[], query: string): MentionSuggestion[] {\n const q = fold(query);\n const rank = (s: MentionSuggestion): number => {\n const name = fold(s.label);\n if (name.startsWith(q)) return 0;\n if (name.split(/\\s+/).some((word) => word.startsWith(q))) return 1;\n if (name.includes(q)) return 2;\n return s.description && fold(s.description).includes(q) ? 3 : -1;\n };\n return items.map((s) => ({ s, r: rank(s) })).filter(({ r }) => r >= 0).sort((a, b) => a.r - b.r).map(({ s }) => s);\n}\n\n/** An option's id, for the field's aria-activedescendant. */\nexport const mentionOptionId = (listId: string, index: number) => `${listId}-option-${index}`;\n\n/**\n * The most people a list shows (Sprint 25.17's second review: two thousand drawn at once took a key a third of a second\n * to paint): the best matches, and a line saying how many more match, which typing narrows.\n */\nexport const MENTION_LIST_LIMIT = 10;\n\n/** The matches a list shows, best first, and how many more there are. */\nexport function shownMentions(found: MentionSuggestion[]): { items: MentionSuggestion[]; more: number } {\n return { items: found.slice(0, MENTION_LIST_LIMIT), more: Math.max(0, found.length - MENTION_LIST_LIMIT) };\n}\n\nexport interface MentionListProps {\n /** The listbox's id: the field's aria-controls, and the stem of its options' ids. */\n id: string;\n /** The listbox's name (\"People\", \"Suggestions\"). */\n label: string;\n /** The people shown, at most MENTION_LIST_LIMIT (shownMentions). */\n items: MentionSuggestion[];\n /** How many more match than are shown: the list says so under its people. */\n more?: number;\n activeIndex: number;\n onActiveIndexChange: (index: number) => void;\n onPick: (item: MentionSuggestion) => void;\n /** Where the mention being typed is, in the viewport: the list opens under it, above it when the screen runs out below. */\n anchorRect: () => DOMRect | null;\n /** The list's element, for the owner's checks (a click outside, focus moving into it). */\n listRef?: RefObject<HTMLDivElement | null>;\n}\n\n/**\n * The list of suggestions while a mention is typed (Sprint 25.17 A17): MentionInput's and the editor's, so a mention\n * looks and works the same in a comment box and a document. The field keeps focus and carries aria-activedescendant\n * (the field's owner wires the keys: arrows move, Enter or Tab inserts, Escape closes); the options are no Tab stops,\n * and a pointer picks one without taking focus from the field.\n */\nexport function MentionList({ id, label, items, more = 0, activeIndex, onActiveIndexChange, onPick, anchorRect, listRef }: MentionListProps) {\n const ownRef = useRef<HTMLDivElement | null>(null);\n const floatingRef = listRef ?? ownRef;\n const boxRef = useRef<HTMLDivElement | null>(null);\n const anchorRef = useLatest(anchorRect);\n // the caret as an element for usePosition, which reads only its rectangle\n const anchor = useMemo(() => ({ current: { getBoundingClientRect: () => anchorRef.current() ?? new DOMRect() } as HTMLElement }), [anchorRef]);\n const pos = usePosition(anchor, floatingRef, items.length > 0, { side: \"bottom\", align: \"start\", offset: 4 });\n // the arrows move through a list longer than its box: the active person stays in view\n useActiveOptionInView(boxRef, items.length > 0 ? mentionOptionId(id, activeIndex) : undefined);\n if (items.length === 0) return null;\n\n return createPortal(\n <div\n ref={floatingRef}\n className={cn(\n \"fixed z-[var(--ds-z-popover)] min-w-[200px] flex flex-col\",\n \"bg-[var(--ds-bg-surface-elevated)]\",\n \"[backdrop-filter:var(--ds-glass-filter)] [-webkit-backdrop-filter:var(--ds-glass-filter)]\",\n \"border-[length:var(--ds-border-width)] border-[var(--ds-border-default)]\",\n \"rounded-[var(--ds-radius-md)] shadow-[var(--ds-shadow-dropdown),var(--ds-glass-inset)]\",\n )}\n style={{ top: pos.top, left: pos.left }}\n >\n {/* rows inset in the list, rounded, as Combobox's and the menus' are (the second review: full-width square rows) */}\n <div ref={boxRef} id={id} role=\"listbox\" aria-label={label} className=\"max-h-[200px] overflow-y-auto p-ds-1\">\n {items.map((s, i) => (\n <button\n key={s.id}\n id={mentionOptionId(id, i)}\n type=\"button\"\n role=\"option\"\n tabIndex={-1}\n aria-selected={i === activeIndex}\n className={cn(\n \"flex items-center gap-ds-2.5 w-full px-ds-2 py-ds-1.5 text-left text-sm cursor-pointer rounded-[var(--ds-radius-sm)]\",\n \"transition-colors duration-[var(--ds-transition-speed)]\",\n i === activeIndex ? \"bg-[var(--ds-bg-muted)] text-[var(--ds-text-primary)]\" : \"text-[var(--ds-text-secondary)]\",\n )}\n // the field keeps focus, so the pick lands where the mention is being typed\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => onPick(s)}\n onMouseEnter={() => onActiveIndexChange(i)}\n >\n {/* the name follows as text, so the picture is decoration */}\n <span aria-hidden=\"true\" className=\"inline-flex shrink-0\">\n <Avatar src={s.avatar} initials={s.label} size=\"sm\" className=\"!h-6 !w-6 !text-2xs\" />\n </span>\n <span className=\"min-w-0\">\n <span className=\"block font-medium text-[var(--ds-text-primary)] truncate\">{s.label}</span>\n {s.description && <span className=\"block text-xs text-[var(--ds-text-muted)] truncate\">{s.description}</span>}\n </span>\n </button>\n ))}\n </div>\n {more > 0 && (\n <p className=\"px-ds-3 py-ds-1.5 text-xs text-[var(--ds-text-muted)] border-t-[length:var(--ds-divider-width)] border-[var(--ds-border-subtle)]\">\n {more} more {more === 1 ? \"matches\" : \"match\"}: keep typing to narrow\n </p>\n )}\n </div>,\n document.body,\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../showcase/src/lib/initials.ts","../../../showcase/src/components/Avatar.tsx","../../../showcase/src/lib/use-active-option.ts","../../../showcase/src/lib/search-text.ts","../../../showcase/src/components/MentionList.tsx"],"names":["useRef","jsx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UAAK,SAAA,EAAU,oDAAA,EAAsD,YAAE,WAAA,EAAY;AAAA,iBAAA,EACxG;AAAA;AAAA,aAAA;AAAA,YAvBK,CAAA,CAAE;AAAA,WAyBV,CAAA,EACD,CAAA;AAAA,UACC,OAAO,CAAA,oBACND,IAAAA,CAAC,GAAA,EAAA,EAAE,WAAU,kIAAA,EACV,QAAA,EAAA;AAAA,YAAA,IAAA;AAAA,YAAK,QAAA;AAAA,YAAO,IAAA,KAAS,IAAI,SAAA,GAAY,OAAA;AAAA,YAAQ;AAAA,WAAA,EAChD;AAAA;AAAA;AAAA,KAEJ;AAAA,IACA,QAAA,CAAS;AAAA,GACX;AACF","file":"chunk-ZASGFL5D.js","sourcesContent":["/**\n * Initials for an avatar. Round 21 (run 58): a builder passed each person's full name as `initials`, and the avatar\n * printed \"Amara Haddad\" across a 40 px circle on every row of the Team table. The avatar now reads what it is given:\n * up to three characters with no space are initials already and stay as they are (\"JB\", \"ABC\"); anything longer is a\n * name, and its first two words give the letters.\n */\n\n/** \"Sarah Chen\" → \"SC\"; \"Acme\" → \"A\"; \"Mary Jane Watson\" → \"MJ\". */\nexport function initialsOf(name: string): string {\n return name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((word) => Array.from(word)[0] ?? \"\")\n .join(\"\")\n .toUpperCase();\n}\n\n/** What an avatar shows for an `initials` value: initials as given, or the initials of a name. */\nexport function toInitials(value: string): string {\n const s = value.trim();\n if (!s) return \"\";\n if (!/\\s/.test(s) && Array.from(s).length <= 3) return s;\n return initialsOf(s);\n}\n","import { cn } from \"../lib/utils\";\nimport { toInitials } from \"../lib/initials\";\n\nexport type AvatarStatus = \"online\" | \"away\" | \"busy\" | \"offline\";\nexport type AvatarColor = \"auto\" | \"accent\" | \"neutral\" | 1 | 2 | 3 | 4 | 5;\n\ninterface AvatarProps {\n /** One to three letters (\"JB\"). A name passed here shows its initials (\"Amara Haddad\" → \"AH\"), never the whole name. */\n initials?: string;\n src?: string;\n alt?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n status?: AvatarStatus;\n /** Initials background. \"auto\" (default) derives a stable palette tint from alt/initials so groups vary; use \"accent\" sparingly. */\n color?: AvatarColor;\n className?: string;\n}\n\nconst sizeStyles = {\n sm: \"h-8 w-8 text-xs\",\n md: \"h-10 w-10 text-sm\",\n lg: \"h-12 w-12 text-base\",\n};\n\n// Fallbacks cover themes whose tokens CSS predates the decorative palette.\nconst paletteStyles = {\n 1: \"bg-[var(--ds-palette-1-bg,var(--ds-bg-muted))] text-[var(--ds-palette-1-text,var(--ds-text-secondary))]\",\n 2: \"bg-[var(--ds-palette-2-bg,var(--ds-bg-muted))] text-[var(--ds-palette-2-text,var(--ds-text-secondary))]\",\n 3: \"bg-[var(--ds-palette-3-bg,var(--ds-bg-muted))] text-[var(--ds-palette-3-text,var(--ds-text-secondary))]\",\n 4: \"bg-[var(--ds-palette-4-bg,var(--ds-bg-muted))] text-[var(--ds-palette-4-text,var(--ds-text-secondary))]\",\n 5: \"bg-[var(--ds-palette-5-bg,var(--ds-bg-muted))] text-[var(--ds-palette-5-text,var(--ds-text-secondary))]\",\n} as const;\n\nfunction paletteFor(seed: string): keyof typeof paletteStyles {\n let h = 0;\n for (const ch of seed) h = (h * 31 + ch.charCodeAt(0)) >>> 0;\n return ((h % 5) + 1) as keyof typeof paletteStyles;\n}\n\nfunction colorStyles(color: AvatarColor, seed: string): string {\n if (color === \"accent\") return \"bg-[var(--ds-accent-primary)] text-[var(--ds-text-on-primary)]\";\n if (color === \"neutral\") return \"bg-[var(--ds-bg-muted)] text-[var(--ds-text-secondary)]\";\n return paletteStyles[color === \"auto\" ? paletteFor(seed) : color];\n}\n\n/**\n * Presence as a shape as well as a colour (Sprint 25.12 A48, WCAG 1.4.1), as Fluent's presence badges do: online a filled\n * dot, away a ring, busy a dot with a bar, offline a ring with a slash. The words are in the avatar's name.\n */\nfunction PresenceMark({ status }: { status: AvatarStatus }) {\n return (\n <svg viewBox=\"0 0 10 10\" width=\"10\" height=\"10\" aria-hidden=\"true\" focusable=\"false\" data-presence={status} className=\"block\">\n {status === \"online\" && <circle cx=\"5\" cy=\"5\" r=\"5\" className=\"fill-[var(--ds-status-success)]\" />}\n {status === \"away\" && <circle cx=\"5\" cy=\"5\" r=\"4\" fill=\"none\" strokeWidth=\"2\" className=\"stroke-[var(--ds-status-warning)]\" />}\n {status === \"busy\" && (\n <>\n <circle cx=\"5\" cy=\"5\" r=\"5\" className=\"fill-[var(--ds-status-error)]\" />\n <rect x=\"2.5\" y=\"4.1\" width=\"5\" height=\"1.8\" rx=\"0.9\" className=\"fill-[var(--ds-bg-canvas)]\" />\n </>\n )}\n {status === \"offline\" && (\n <>\n <circle cx=\"5\" cy=\"5\" r=\"4\" fill=\"none\" strokeWidth=\"2\" className=\"stroke-[var(--ds-text-muted)]\" />\n <line x1=\"3.1\" y1=\"6.9\" x2=\"6.9\" y2=\"3.1\" strokeWidth=\"1.5\" strokeLinecap=\"round\" className=\"stroke-[var(--ds-text-muted)]\" />\n </>\n )}\n </svg>\n );\n}\n\nexport function Avatar({ initials, src, alt, size = \"md\", status, color = \"auto\", className }: AvatarProps) {\n // A48: presence can't show words beside a small avatar, so the avatar's own name carries it (\"Priya Nair, online\")\n const who = alt ?? initials ?? \"\";\n const named = status ? [who, status].filter(Boolean).join(\", \") : undefined;\n const base = cn(\n \"inline-flex items-center justify-center font-medium shrink-0\",\n \"rounded-[var(--ds-radius-full)]\",\n sizeStyles[size],\n className,\n );\n\n // data-avatar: the Table and DataGrid card mode stacks a cell that holds an avatar (Sprint 25.4 C-2).\n const avatarElement = src ? (\n <img\n data-avatar=\"\"\n src={src}\n alt={named ?? alt ?? initials ?? \"\"}\n className={cn(base, \"object-cover\")}\n />\n ) : (\n <div\n data-avatar=\"\"\n role={named ? \"img\" : undefined}\n aria-label={named}\n className={cn(\n base,\n colorStyles(color, alt ?? initials ?? \"\"),\n \"border-[length:var(--ds-border-width)] border-transparent\",\n )}\n >\n {/* round 21: a full name passed as initials shows its initials, not the name squeezed into the circle */}\n {initials != null ? toInitials(initials) : null}\n </div>\n );\n\n if (!status) return avatarElement;\n\n return (\n <div className=\"relative inline-flex\">\n {avatarElement}\n <span\n className={cn(\n \"absolute\",\n size === \"sm\" && \"bottom-[-2px] right-[-2px]\",\n size === \"md\" && \"bottom-[0px] right-[0px]\",\n size === \"lg\" && \"bottom-[2px] right-[2px]\",\n )}\n aria-hidden=\"true\"\n >\n {/* the canvas behind the mark fills a ring's middle and draws the 2px halo that separates it from the photo */}\n <span className=\"block rounded-[var(--ds-radius-full)] bg-[var(--ds-bg-canvas)] shadow-[0_0_0_2px_var(--ds-bg-canvas)]\">\n <PresenceMark status={status} />\n </span>\n </span>\n </div>\n );\n}\n","import { useLayoutEffect, useRef, type RefObject } from \"react\";\n\n/**\n * Keeps the active option of a list driven by aria-activedescendant in view (Sprint 25.17's review; WCAG 2.4.11): when\n * the list opens and when the active option changes, the list scrolls just enough to show it. Only the list's own box\n * scrolls, never the page: the list sits fixed over it. The option is found by its id, in the list's own document or\n * shadow root.\n *\n * Only a change brings it back into view (the second review): a render that leaves the same option active — the page\n * scrolling, the list scrolled by touch or by its scrollbar — leaves the list where the user put it.\n */\nexport function useActiveOptionInView(list: RefObject<HTMLElement | null>, activeId: string | undefined): void {\n // the option last brought into view, by its id and its text: a filtered list reuses an id for another option\n const shown = useRef<string | null>(null);\n useLayoutEffect(() => {\n const box = list.current;\n if (!box || !activeId) {\n shown.current = null;\n return;\n }\n const root = box.getRootNode() as Document | ShadowRoot;\n const option = typeof root.getElementById === \"function\" ? root.getElementById(activeId) : null;\n if (!option || !box.contains(option)) return;\n const seen = `${activeId}\\u0000${option.textContent ?? \"\"}`;\n if (seen === shown.current) return;\n shown.current = seen;\n const top = option.getBoundingClientRect().top - box.getBoundingClientRect().top + box.scrollTop;\n const bottom = top + option.offsetHeight;\n if (top < box.scrollTop) box.scrollTo({ top });\n else if (bottom > box.scrollTop + box.clientHeight) box.scrollTo({ top: bottom - box.clientHeight });\n });\n}\n","/**\n * Text as a search reads it, one way for every picker (Sprint 25.17's second review): no case, no accents, and \"_\" as a\n * space, so \"@toma\" finds Tomás, \"Sao Paulo\" and \"São Paulo\" find America/Sao_Paulo, and \"New_York\" finds New York.\n */\nexport function foldForSearch(text: string): string {\n return text.normalize(\"NFD\").replace(/\\p{M}/gu, \"\").replace(/_/g, \" \").toLowerCase();\n}\n","import { useMemo, useRef, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../lib/utils\";\nimport { usePosition } from \"../lib/use-position\";\nimport { useLatest } from \"../lib/use-latest\";\nimport { useActiveOptionInView } from \"../lib/use-active-option\";\nimport { foldForSearch } from \"../lib/search-text\";\nimport { Avatar } from \"./Avatar\";\n\nexport interface MentionSuggestion {\n id: string;\n label: string;\n avatar?: string;\n description?: string;\n}\n\n/** Text as a search reads it: no case, no accents (\"@toma\" finds Tomás, \"@zoe\" Zoë), as every picker reads it. */\nconst fold = foldForSearch;\n\n/**\n * The suggestions a query matches, by name or by description, ignoring case and accents, best first: a name that starts with it\n * (\"@Mar\": Marcus Chen), then a name with a word that does (Tomás Martin), then a name holding it anywhere (Amara), then\n * a description that does; in their own order within each.\n */\nexport function matchMentions(items: MentionSuggestion[], query: string): MentionSuggestion[] {\n const q = fold(query);\n const rank = (s: MentionSuggestion): number => {\n const name = fold(s.label);\n if (name.startsWith(q)) return 0;\n if (name.split(/\\s+/).some((word) => word.startsWith(q))) return 1;\n if (name.includes(q)) return 2;\n return s.description && fold(s.description).includes(q) ? 3 : -1;\n };\n return items.map((s) => ({ s, r: rank(s) })).filter(({ r }) => r >= 0).sort((a, b) => a.r - b.r).map(({ s }) => s);\n}\n\n/** An option's id, for the field's aria-activedescendant. */\nexport const mentionOptionId = (listId: string, index: number) => `${listId}-option-${index}`;\n\n/**\n * The most people a list shows (Sprint 25.17's second review: two thousand drawn at once took a key a third of a second\n * to paint): the best matches, and a line saying how many more match, which typing narrows.\n */\nexport const MENTION_LIST_LIMIT = 10;\n\n/** The matches a list shows, best first, and how many more there are. */\nexport function shownMentions(found: MentionSuggestion[]): { items: MentionSuggestion[]; more: number } {\n return { items: found.slice(0, MENTION_LIST_LIMIT), more: Math.max(0, found.length - MENTION_LIST_LIMIT) };\n}\n\nexport interface MentionListProps {\n /** The listbox's id: the field's aria-controls, and the stem of its options' ids. */\n id: string;\n /** The listbox's name (\"People\", \"Suggestions\"). */\n label: string;\n /** The people shown, at most MENTION_LIST_LIMIT (shownMentions). */\n items: MentionSuggestion[];\n /** How many more match than are shown: the list says so under its people. */\n more?: number;\n activeIndex: number;\n onActiveIndexChange: (index: number) => void;\n onPick: (item: MentionSuggestion) => void;\n /** Where the mention being typed is, in the viewport: the list opens under it, above it when the screen runs out below. */\n anchorRect: () => DOMRect | null;\n /** The list's element, for the owner's checks (a click outside, focus moving into it). */\n listRef?: RefObject<HTMLDivElement | null>;\n}\n\n/**\n * The list of suggestions while a mention is typed (Sprint 25.17 A17): MentionInput's and the editor's, so a mention\n * looks and works the same in a comment box and a document. The field keeps focus and carries aria-activedescendant\n * (the field's owner wires the keys: arrows move, Enter or Tab inserts, Escape closes); the options are no Tab stops,\n * and a pointer picks one without taking focus from the field.\n */\nexport function MentionList({ id, label, items, more = 0, activeIndex, onActiveIndexChange, onPick, anchorRect, listRef }: MentionListProps) {\n const ownRef = useRef<HTMLDivElement | null>(null);\n const floatingRef = listRef ?? ownRef;\n const boxRef = useRef<HTMLDivElement | null>(null);\n const anchorRef = useLatest(anchorRect);\n // the caret as an element for usePosition, which reads only its rectangle\n const anchor = useMemo(() => ({ current: { getBoundingClientRect: () => anchorRef.current() ?? new DOMRect() } as HTMLElement }), [anchorRef]);\n const pos = usePosition(anchor, floatingRef, items.length > 0, { side: \"bottom\", align: \"start\", offset: 4 });\n // the arrows move through a list longer than its box: the active person stays in view\n useActiveOptionInView(boxRef, items.length > 0 ? mentionOptionId(id, activeIndex) : undefined);\n if (items.length === 0) return null;\n\n return createPortal(\n <div\n ref={floatingRef}\n className={cn(\n \"fixed z-[var(--ds-z-popover)] min-w-[200px] flex flex-col\",\n \"bg-[var(--ds-bg-surface-elevated)]\",\n \"[backdrop-filter:var(--ds-glass-filter)] [-webkit-backdrop-filter:var(--ds-glass-filter)]\",\n \"border-[length:var(--ds-border-width)] border-[var(--ds-border-default)]\",\n \"rounded-[var(--ds-radius-md)] shadow-[var(--ds-shadow-dropdown),var(--ds-glass-inset)]\",\n )}\n style={{ top: pos.top, left: pos.left }}\n >\n {/* rows inset in the list, rounded, as Combobox's and the menus' are (the second review: full-width square rows) */}\n <div ref={boxRef} id={id} role=\"listbox\" aria-label={label} className=\"max-h-[200px] overflow-y-auto p-ds-1\">\n {items.map((s, i) => (\n <button\n key={s.id}\n id={mentionOptionId(id, i)}\n type=\"button\"\n role=\"option\"\n tabIndex={-1}\n aria-selected={i === activeIndex}\n className={cn(\n \"flex items-center gap-ds-2.5 w-full px-ds-2 py-ds-1.5 text-left text-sm cursor-pointer rounded-[var(--ds-radius-sm)]\",\n \"transition-colors duration-[var(--ds-transition-speed)]\",\n i === activeIndex ? \"bg-[var(--ds-bg-muted)] text-[var(--ds-text-primary)]\" : \"text-[var(--ds-text-secondary)]\",\n )}\n // the field keeps focus, so the pick lands where the mention is being typed\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => onPick(s)}\n onMouseEnter={() => onActiveIndexChange(i)}\n >\n {/* the name follows as text, so the picture is decoration */}\n <span aria-hidden=\"true\" className=\"inline-flex shrink-0\">\n <Avatar src={s.avatar} initials={s.label} size=\"sm\" className=\"!h-6 !w-6 !text-2xs\" />\n </span>\n <span className=\"min-w-0\">\n <span className=\"block font-medium text-[var(--ds-text-primary)] truncate\">{s.label}</span>\n {s.description && <span className=\"block text-xs text-[var(--ds-text-muted)] truncate\">{s.description}</span>}\n </span>\n </button>\n ))}\n </div>\n {more > 0 && (\n <p className=\"px-ds-3 py-ds-1.5 text-xs text-[var(--ds-text-muted)] border-t-[length:var(--ds-divider-width)] border-[var(--ds-border-subtle)]\">\n {more} more {more === 1 ? \"matches\" : \"match\"}: keep typing to narrow\n </p>\n )}\n </div>,\n document.body,\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useLatest } from './chunk-
|
|
2
|
+
import { useLatest } from './chunk-4HJDOZ2M.js';
|
|
3
3
|
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
var registry = /* @__PURE__ */ new WeakMap();
|
|
@@ -106,5 +106,5 @@ function useTextOverflow(options = {}) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export { useTextOverflow };
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
110
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-ZCDA74RQ.js.map
|
|
110
|
+
//# sourceMappingURL=chunk-ZCDA74RQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../showcase/src/lib/use-text-overflow.ts"],"names":[],"mappings":";;;;AASA,IAAM,QAAA,uBAAe,OAAA,EAAwC;AAC7D,IAAI,cAAA,GAAwC,IAAA;AAC5C,IAAI,KAAA,GAAuB,IAAA;AAC3B,IAAM,eAAA,uBAAsB,GAAA,EAAa;AAEzC,SAAS,iBAAA,GAAoC;AAC3C,EAAA,IAAI,gBAAgB,OAAO,cAAA;AAC3B,EAAA,cAAA,GAAiB,IAAI,cAAA,CAAe,CAAC,OAAA,KAAY;AAC/C,IAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,MAAA,eAAA,CAAgB,GAAA,CAAI,MAAM,MAAM,CAAA;AAAA,IAClC;AACA,IAAA,IAAI,UAAU,IAAA,EAAM;AAClB,MAAA,KAAA,GAAQ,sBAAsB,KAAK,CAAA;AAAA,IACrC;AAAA,EACF,CAAC,CAAA;AACD,EAAA,OAAO,cAAA;AACT;AAEA,SAAS,KAAA,GAAQ;AACf,EAAA,KAAA,GA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AA,CAAW,OAAA,EAAS,aAAA,CAAc,OAAO,CAAA;AAAA,MACrD;AAAA,IACF,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,KAAK,WAAA,EAAY;AAC5B","file":"chunk-ZCDA74RQ.js","sourcesContent":["import { useState, useCallback, useRef, useEffect } from \"react\";\nimport { useLatest } from \"./use-latest\";\n\n// ─── Shared ResizeObserver (singleton per document) ────────────────────────────\n// All useTextOverflow instances share a single ResizeObserver. This avoids the\n// performance cost of 80+ independent observers on pages with many truncated elements.\n\ntype OverflowCallback = () => void;\n\nconst registry = new WeakMap<Element, Set<OverflowCallback>>();\nlet sharedObserver: ResizeObserver | null = null;\nlet rafId: number | null = null;\nconst pendingElements = new Set<Element>();\n\nfunction getSharedObserver(): ResizeObserver {\n if (sharedObserver) return sharedObserver;\n sharedObserver = new ResizeObserver((entries) => {\n for (const entry of entries) {\n pendingElements.add(entry.target);\n }\n if (rafId === null) {\n rafId = requestAnimationFrame(flush);\n }\n });\n return sharedObserver;\n}\n\nfunction flush() {\n rafId = null;\n for (const el of pendingElements) {\n const callbacks = registry.get(el);\n if (callbacks) {\n for (const cb of callbacks) cb();\n }\n }\n pendingElements.clear();\n}\n\nfunction observe(el: Element, callback: OverflowCallback) {\n let set = registry.get(el);\n if (!set) {\n set = new Set();\n registry.set(el, set);\n }\n set.add(callback);\n if (set.size === 1) {\n getSharedObserver().observe(el);\n }\n}\n\nfunction unobserve(el: Element, callback: OverflowCallback) {\n const set = registry.get(el);\n if (!set) return;\n set.delete(callback);\n if (set.size === 0) {\n registry.delete(el);\n getSharedObserver().unobserve(el);\n }\n}\n\n// ─── Overflow detection ────────────────────────────────────────────────────────\n\nconst TOLERANCE = 1; // px — accounts for integer rounding in scrollWidth/clientWidth\n\nfunction checkOverflow(el: HTMLElement, lines: number): boolean {\n if (lines <= 1) {\n return el.scrollWidth - el.clientWidth > TOLERANCE;\n }\n return el.scrollHeight - el.clientHeight > TOLERANCE;\n}\n\n// ─── Hook ──────────────────────────────────────────────────────────────────────\n\nexport interface UseTextOverflowOptions {\n /** Number of visible lines before truncation. 1 = single-line ellipsis, >1 = line-clamp. */\n lines?: number;\n /** Disable overflow detection (e.g. when component is hidden) */\n disabled?: boolean;\n /** Content key — triggers re-check when this value changes (use for dynamic text content) */\n content?: unknown;\n}\n\nexport interface UseTextOverflowResult {\n /** Callback ref — attach to the element that has truncation CSS applied */\n ref: (node: HTMLElement | null) => void;\n /** True when the element's text is currently overflowing/truncated */\n isTruncated: boolean;\n}\n\n/**\n * Detects whether an element's text content is overflowing (truncated).\n * Uses a single shared ResizeObserver for all instances on the page.\n *\n * @example\n * const { ref, isTruncated } = useTextOverflow({ lines: 1 });\n * return (\n * <Tooltip content={fullText} disabled={!isTruncated}>\n * <span ref={ref} className=\"truncate\">{fullText}</span>\n * </Tooltip>\n * );\n */\nexport function useTextOverflow(options: UseTextOverflowOptions = {}): UseTextOverflowResult {\n const { lines = 1, disabled = false, content } = options;\n const [isTruncated, setIsTruncated] = useState(false);\n const elementRef = useRef<HTMLElement | null>(null);\n // The observer-registered wrapper delegates to the latest check logic via checkRef.\n const registeredRef = useRef<OverflowCallback | null>(null);\n\n const doCheck = useCallback(() => {\n if (!elementRef.current || disabled) {\n setIsTruncated(false);\n return;\n }\n const next = checkOverflow(elementRef.current, lines);\n setIsTruncated((prev) => (prev !== next ? next : prev));\n }, [lines, disabled]);\n\n // Latest check logic, updated in a layout effect so the stable wrapper never runs a stale closure.\n const checkRef = useLatest<OverflowCallback>(doCheck);\n\n // Re-check when content changes (handles dynamic text like Dropdown selection)\n // or when disabled state changes\n // Measures the committed DOM, so it must stay a post-layout effect.\n /* eslint-disable react-hooks/set-state-in-effect -- overflow is a layout measurement */\n useEffect(() => {\n if (disabled) {\n setIsTruncated(false);\n } else if (elementRef.current) {\n const next = checkOverflow(elementRef.current, lines);\n setIsTruncated((prev) => (prev !== next ? next : prev));\n }\n }, [content, lines, disabled]);\n /* eslint-enable react-hooks/set-state-in-effect */\n\n const ref = useCallback(\n (node: HTMLElement | null) => {\n const prev = elementRef.current;\n\n // Unregister previous element using the SAME function we registered with\n if (prev && registeredRef.current) {\n unobserve(prev, registeredRef.current);\n registeredRef.current = null;\n }\n\n elementRef.current = node;\n\n if (node && !disabled) {\n // Stable wrapper that delegates to the latest check logic\n const wrapper: OverflowCallback = () => checkRef.current?.();\n registeredRef.current = wrapper;\n observe(node, wrapper);\n // Initial check on mount\n const initial = checkOverflow(node, lines);\n setIsTruncated(initial);\n }\n },\n [lines, disabled, checkRef],\n );\n\n // Cleanup on unmount — uses the registered wrapper, not the check function\n useEffect(() => {\n return () => {\n if (elementRef.current && registeredRef.current) {\n unobserve(elementRef.current, registeredRef.current);\n }\n };\n }, []);\n\n return { ref, isTruncated };\n}\n"]}
|
package/dist/data-grid.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCardsSwitch, CARDS_BELOW, inferColumnKinds, CardValue, SortIndicator, CutCell, CutEmail, dayKey, DatePicker, Checkbox } from './chunk-
|
|
3
|
-
import { usePagination, useWholeListCheck, pagerPart, Pagination, Dropdown, Field, NumberInput, Input } from './chunk-
|
|
2
|
+
import { useCardsSwitch, CARDS_BELOW, inferColumnKinds, CardValue, SortIndicator, CutCell, CutEmail, dayKey, DatePicker, Checkbox } from './chunk-SIWERRP2.js';
|
|
3
|
+
import { usePagination, useWholeListCheck, pagerPart, Pagination, Dropdown, Field, NumberInput, Input } from './chunk-USHW523V.js';
|
|
4
4
|
import { useShellPreferences } from './chunk-TYNDXMBV.js';
|
|
5
5
|
import './chunk-LJYSVZMI.js';
|
|
6
6
|
import './chunk-7QLXYRPD.js';
|
|
7
7
|
import './chunk-7RKC5C7G.js';
|
|
8
8
|
import { FormChangeCtx } from './chunk-72SDAX54.js';
|
|
9
|
-
import { useFramesItself, TableCardCtx, RowsCtx } from './chunk-
|
|
9
|
+
import { useFramesItself, TableCardCtx, RowsCtx } from './chunk-MIUSSYVE.js';
|
|
10
10
|
import './chunk-NKUCS67T.js';
|
|
11
11
|
import { useBreakpoint } from './chunk-ZHUVLBCC.js';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import './chunk-IELIF4PJ.js';
|
|
15
|
-
import './chunk-UDJOIVKQ.js';
|
|
12
|
+
import './chunk-ZCDA74RQ.js';
|
|
13
|
+
import { useRevealFocus } from './chunk-WWN6CQKI.js';
|
|
16
14
|
import { Icon, warnOnce } from './chunk-L6HWACK7.js';
|
|
17
15
|
import './chunk-7Q46JXSK.js';
|
|
18
|
-
import './chunk-
|
|
16
|
+
import { useGridKeyboard, useFocusLeave, focusInitial } from './chunk-4HJDOZ2M.js';
|
|
19
17
|
import { cn, FOCUS_INSET, FOCUS_RING } from './chunk-YL5KD5RC.js';
|
|
20
18
|
import { useState, useMemo, useCallback, useRef, useEffect, useLayoutEffect } from 'react';
|
|
21
19
|
import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
package/dist/data-grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../showcase/src/components/DataGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwFA,IAAM,UAAU,CAAC,CAAA,KAAe,MAAM,IAAA,IAAQ,CAAA,KAAM,UAAa,CAAA,KAAM,EAAA;AACvE,IAAM,MAAA,GAAS,CAAC,CAAA,KAA0B,CAAA,YAAa,IAAA,IAAQ,CAAC,MAAA,CAAO,KAAA,CAAM,CAAA,CAAE,OAAA,EAAS,CAAA;AAExF,SAAS,OAAO,CAAA,EAAyB;AACvC,EAAA,MAAM,IAAI,OAAO,CAAA,KAAM,WAAW,2BAAA,CAA4B,IAAA,CAAK,CAAC,CAAA,GAAI,IAAA;AACxE,EAAA,IAAI,CAAC,GAAG,OAAO,IAAA;AACf,EAAA,MAAM,IAAI,IAAI,IAAA,CAAK,OAAO,CAAA,CAAE,CAAC,CAA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vJ,QAAA,EAAA;AAAA,4BAAA,KAAA;AAAA,4BACA,IAAA;AAAA,4BACA,KAAA,IAAS,CAAC,SAAA,IAAa;AAAA;AAAA,yBAAA;AAAA,wBAhBnB,IAAA,CAAK;AAAA,uBAiBZ;AAAA,oBAEJ,CAAC;AAAA,mBAAA;AAAA,kBApFI,GAAA,CAAI;AAAA,iBAsFZ,GACH,CAAA,EAAU;AAAA;AAAA;AAAA;AACZ;AAAA,OACF;AAAA,MAEC,4BAAY,GAAA,CAAC,KAAA,EAAA,EAAI,MAAK,QAAA,EAAS,SAAA,EAAU,WAAU,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAA0B,QAAA,EAAA,KAAA,GAAS,KAAA,CAAM,KAAK,OAAA,GAAU,WAAA,GAAe,MAA7D,KAAA,EAAO,CAAA,IAAK,CAAoD,CAAA,EAAO;AAAA,KAAA,EACxI;AAAA,GACF;AACF","file":"data-grid.js","sourcesContent":["import { useState, useCallback, useEffect, useLayoutEffect, useMemo, useRef, type ReactElement, type ReactNode, type SyntheticEvent, type KeyboardEvent as ReactKeyboardEvent } from \"react\";\nimport { useShellPreferences } from \"../lib/preferences\";\nimport {\n useReactTable,\n getCoreRowModel,\n getSortedRowModel,\n flexRender,\n type CellContext,\n type ColumnDef,\n type Header,\n type SortingState,\n} from \"@tanstack/react-table\";\nimport { cn, FOCUS_INSET, FOCUS_RING } from \"../lib/utils\";\nimport { Icon } from \"../lib/icons\";\nimport { CutCell, CutEmail } from \"./TextOverflow\";\nimport { Input } from \"./Input\";\nimport { NumberInput } from \"./NumberInput\";\nimport { DatePicker } from \"./DatePicker\";\nimport { Dropdown } from \"./Dropdown\";\nimport { Checkbox } from \"./Checkbox\";\nimport { Field } from \"./Field\";\nimport { Pagination } from \"./Pagination\";\nimport { useBreakpoint, type BreakpointKey } from \"../lib/use-breakpoint\";\nimport { useRevealFocus } from \"../lib/reveal-focus\";\nimport { inferColumnKinds, type ColumnKind } from \"../lib/table-utils\";\nimport { CardValue } from \"../lib/card-cell\";\nimport { TableCardCtx, RowsCtx, useFramesItself } from \"../lib/surface-context\";\nimport { FormChangeCtx } from \"../lib/form-context\";\nimport { focusInitial, useFocusLeave, useGridKeyboard } from \"../lib/focus\";\nimport { dayKey } from \"../lib/date-grid\";\nimport { SortIndicator } from \"../lib/sort-indicator\";\nimport { warnOnce } from \"../lib/dev-warn\";\nimport { usePagination, pagerPart, useWholeListCheck, type Pager } from \"../lib/use-pagination\";\nimport { CARDS_BELOW, useCardsSwitch } from \"../lib/use-cards-switch\";\n\n/** One of a choice column's options: the value its cells hold, and the words shown for it. */\nexport interface DataGridOption {\n value: string | number;\n label: string;\n}\n\n/** Column meta for opt-in truncation. Set on ColumnDef.meta. */\nexport interface DataGridColumnMeta {\n /** true = single-line, or { lines: N } for multi-line clamp. */\n truncate?: boolean | { lines: number };\n /** CSS max-width for the column. */\n maxWidth?: string;\n /** CSS width for the column — sibling grids that share a column set line up when their columns carry the same widths (round 14). */\n width?: string;\n /** CSS min-width for the column. */\n minWidth?: string;\n /**\n * Explicit column kind. When omitted the DataGrid infers it from data values (a yes or no too; never a choice). In an\n * editable grid it chooses the editor, where the control can hold the cell's value: \"number\" a NumberInput for a\n * number, \"date\" a DatePicker for a Date or an ISO date (\"2026-10-14\"), \"choice\" a Dropdown of `options`, \"boolean\" a\n * Checkbox; any other kind, and a number or a date written as text (\"18 KB\", \"12 Jan 2026\"), a text Input.\n */\n kind?: ColumnKind;\n /** Horizontal alignment of the header and the cells; a block element (a Checkbox, a Button) is laid out with flex so it follows too (round 14). Default: numbers right, everything else left. */\n align?: \"left\" | \"center\" | \"right\";\n /**\n * In an editable grid, whether this column's cells edit (default true); false for a column that shows (a status, a\n * calculated value, actions): its cells show no edit cue, and assistive tech hears them as read-only.\n */\n editable?: boolean;\n /**\n * A choice column's options (with `kind: \"choice\"`): its cells edit with a Dropdown of them, and a save gives the\n * option's `value`. Give the column a `cell` that shows the option's label.\n */\n options?: readonly DataGridOption[];\n /**\n * In an editable grid, the value onCellEdit gets from what was typed in a text cell, or in a number cell as its text\n * (default the text itself, or the number): a price written as text, `(text) => Number(text.replace(/[$,]/g, \"\"))`.\n * A date, a choice and a yes or no are given as their own values.\n */\n parse?: (text: string) => unknown;\n}\n\n/** The control a cell edits with (Sprint 25.8.7 item 19): its column's kind, where that control can hold the cell's value. */\ntype CellEditorKind = \"text\" | \"number\" | \"date\" | \"choice\" | \"boolean\";\n\n/** What an edit starts from: its control, the control's value, and how a saved value goes back in the cell's own form. */\ninterface EditorSetup {\n editor: CellEditorKind;\n value: unknown;\n out: (value: unknown) => unknown;\n}\n\nconst isEmpty = (v: unknown) => v === null || v === undefined || v === \"\";\nconst isDate = (v: unknown): v is Date => v instanceof Date && !Number.isNaN(v.getTime());\n/** An ISO date's text (\"2026-10-14\") as the local day it names, else null; the date grid's day key is the same text. */\nfunction isoDay(v: unknown): Date | null {\n const m = typeof v === \"string\" ? /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(v) : null;\n if (!m) return null;\n const d = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n return dayKey(d) === v ? d : null;\n}\n/** Two of an editor's values are one: a date by its time, anything else by itself. */\nconst sameValue = (a: unknown, b: unknown) => (isDate(a) && isDate(b) ? a.getTime() === b.getTime() : Object.is(a, b));\n\n/**\n * The editor for a cell. A control edits only a value it can hold: a NumberInput holds no empty cell and no \"18 KB\", a\n * DatePicker gives back no \"12 Jan 2026\", so those keep the text Input. A date goes back in the form it came: a Date,\n * keeping its time of day, or an ISO date's text; an empty cell's, as the column's first date is (a Date when it has\n * none).\n */\nfunction editorFor(kind: ColumnKind | undefined, raw: unknown, meta: DataGridColumnMeta | undefined, firstOfColumn: () => unknown): EditorSetup {\n const parse = meta?.parse;\n if (kind === \"choice\" && meta?.options?.length) return { editor: \"choice\", value: raw ?? null, out: (v) => v };\n if (kind === \"boolean\" && (typeof raw === \"boolean\" || isEmpty(raw))) return { editor: \"boolean\", value: raw === true, out: (v) => v };\n if (kind === \"number\" && typeof raw === \"number\" && Number.isFinite(raw)) return { editor: \"number\", value: raw, out: (v) => (parse ? parse(String(v)) : v) };\n if (kind === \"date\") {\n const was = isEmpty(raw) ? firstOfColumn() : raw;\n if (isDate(raw)) {\n return { editor: \"date\", value: raw, out: (v) => (isDate(v) ? new Date(v.getFullYear(), v.getMonth(), v.getDate(), raw.getHours(), raw.getMinutes(), raw.getSeconds(), raw.getMilliseconds()) : null) };\n }\n if (isoDay(was)) return { editor: \"date\", value: isoDay(raw), out: (v) => (isDate(v) ? dayKey(v) : null) };\n if (isEmpty(was) || isDate(was)) return { editor: \"date\", value: null, out: (v) => (isDate(v) ? v : null) };\n }\n return { editor: \"text\", value: String(raw ?? \"\"), out: (v) => (parse ? parse(v as string) : v) };\n}\n\n/**\n * A cell's editor (Sprint 25.8.7 item 19): the library's control for its column's kind, named for the column by a\n * hidden Field label. What is typed (text, a number, a date's parts) saves with Enter or by leaving the editor; a value\n * picked by a press (an option, a calendar's day, the box) is the edit, and saves at once; Escape, in the field or in\n * its popup, leaves the cell as it was. Leaving is the Field's own check (lib/focus.ts, useFocusLeave): focus moving\n * into the editor's popup, the Dropdown's list or the DatePicker's calendar, is not leaving it.\n */\nfunction CellEditor({ editor, value, name, options, onChange, onEnd }: {\n editor: CellEditorKind;\n value: unknown;\n name: string;\n options?: readonly DataGridOption[];\n onChange: (value: unknown) => void;\n onEnd: (save: boolean, focusBack: boolean, picked?: { value: unknown }) => void;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n // leaving the editor saves it and lets focus go where it went (the review of 30 September: it pulled focus back, and\n // the next keys were lost)\n const leave = useFocusLeave(() => onEnd(true, false));\n // a value chosen in a popup (the calendar's day, by a click or by Enter) is the edit itself. React passes the popup's\n // events up through its portal, so a key or a press from outside this editor's own box came from there. The flag is\n // where the latest one came from, never reset by a timer: Chrome runs a capture handler and the bubbling handler that\n // changes the value as separate listeners, with a microtask checkpoint between them\n const fromPopup = useRef(false);\n const markPopupEvent = (e: SyntheticEvent) => { fromPopup.current = !ref.current?.contains(e.target as Node); };\n const opened = useRef(false);\n useLayoutEffect(() => {\n const root = ref.current;\n if (!root) return;\n focusInitial(root);\n const el = document.activeElement;\n // the value opens selected: typing replaces it, an arrow key keeps it\n if (el instanceof HTMLInputElement && el.type === \"text\") el.select();\n // a choice opens on its list, the edit itself; once, though a development build runs this twice\n if (editor === \"choice\" && !opened.current && el instanceof HTMLButtonElement && root.contains(el)) {\n opened.current = true;\n el.click();\n }\n }, [editor]);\n // a choice and the box change only when picked, and a pick saves at once; what is typed or stepped (text, a number, a\n // date's parts) waits for Enter or for leaving the editor\n const picks = editor === \"choice\" || editor === \"boolean\";\n const change = (v: unknown) => (picks || fromPopup.current ? onEnd(true, true, { value: v }) : onChange(v));\n let control: ReactElement;\n if (editor === \"number\") control = <NumberInput size=\"sm\" value={value as number} allowDecimals onChange={change} />;\n else if (editor === \"date\") control = <DatePicker size=\"sm\" value={value as Date | null} onChange={change} />;\n else if (editor === \"boolean\") control = <Checkbox checked={value === true} onChange={(checked) => change(checked)} />;\n else if (editor === \"choice\" && options) {\n control = (\n <Dropdown\n size=\"sm\"\n options={options.map((o) => ({ id: String(o.value), label: o.label }))}\n value={value === null || value === undefined ? \"\" : String(value)}\n onChange={(id) => change(options.find((o) => String(o.value) === id)?.value ?? id)}\n />\n );\n } else control = <Input size=\"sm\" value={value as string} onChange={(e) => change(e.target.value)} />;\n return (\n <div\n ref={ref}\n data-cell-editor=\"\"\n {...leave}\n onClickCapture={markPopupEvent}\n onKeyDownCapture={markPopupEvent}\n onKeyDown={(e) => {\n // Escape, in the field or its popup, leaves the cell as it was, and goes no further: a Drawer round the grid stays\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n onEnd(false, true);\n return;\n }\n // Enter saves what was typed; on a button (the Dropdown's, the calendar's) it is the button's, which opens its\n // popup, and in the popup it picks\n if (e.key === \"Enter\" && e.currentTarget.contains(e.target as Node) && !(e.target instanceof HTMLButtonElement)) {\n e.preventDefault();\n onEnd(true, true);\n }\n }}\n >\n {/* a grid saves as you go, so its editor never marks a form around it; the cells' own controls still do (the\n review of 30 September: the whole grid opted out, and a Drawer closed on a changed checkbox unasked) */}\n <FormChangeCtx value={null}>\n <Field label={name} hideLabel>{control}</Field>\n </FormChangeCtx>\n </div>\n );\n}\n\n/**\n * Sprint 25.8.7 item 19 (collections-5): an editable cell says so before it is tried, a pencil shown while the cell is\n * hovered or focused (focused too: a touch screen has no hover); a calculated or locked cell shows none. It sits in room\n * an editable column keeps at its cells' end, header too, so a value never moves and a number stays under its header.\n */\nconst EDIT_CUE_ROOM = \"pr-[calc(var(--ds-space-4)+var(--ds-space-1)+12px)]\";\n\n/** How wide an editor sits over its cell: the cell's width inside its padding, and never less than its control needs. */\nconst EDITOR_WIDTH: Record<CellEditorKind, string> = {\n text: \"w-[max(calc(100%-var(--ds-space-4)),12rem)]\",\n number: \"w-[max(calc(100%-var(--ds-space-4)),8rem)]\",\n date: \"w-[max(calc(100%-var(--ds-space-4)),10.5rem)]\",\n choice: \"w-[max(calc(100%-var(--ds-space-4)),9rem)]\",\n boolean: \"w-auto\",\n};\n/**\n * The least an editable column of numbers, dates or choices is wide, at rest too: its editor's room and the cell's\n * padding, so the editor fits in its own cell and never covers the next one (a text column is wide by its words, and\n * a text editor may run over). A page's own width or min-width for the column wins.\n */\nconst EDITABLE_MIN_WIDTH: Partial<Record<CellEditorKind, string>> = { number: \"9rem\", date: \"11.5rem\", choice: \"10rem\" };\nfunction editableMinWidth(kind: ColumnKind | undefined, meta: DataGridColumnMeta | undefined): string | undefined {\n if (meta?.width || meta?.minWidth) return undefined;\n const editor: CellEditorKind | null = kind === \"number\" ? \"number\" : kind === \"date\" ? \"date\" : kind === \"choice\" && meta?.options?.length ? \"choice\" : null;\n return editor ? EDITABLE_MIN_WIDTH[editor] : undefined;\n}\nconst EDIT_CUE = (\n <span\n data-edit-cue=\"\"\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute top-1/2 -translate-y-1/2 right-ds-4 flex\",\n \"text-[var(--ds-text-muted)] opacity-0 transition-opacity duration-[var(--ds-transition-speed)]\",\n \"group-hover/cell:opacity-100 group-focus/cell:opacity-100\",\n )}\n >\n <Icon name=\"edit\" size={12} />\n </span>\n);\n\n\nexport interface DataGridProps<T> {\n data: T[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- public API: columns may carry any value type\n columns: ColumnDef<T, any>[];\n /**\n * Rows a page, over the project's (dataDisplay.itemsPerPage), for a grid the user asked to page differently. Leave it\n * out: the grid pages as the project says, with the project's control (Sprint 25.13 A5; it was 10).\n */\n pageSize?: number;\n /**\n * Cells edit in place, as the APG's grid (Sprint 25.13 A5): the grid is one Tab stop and the arrow keys move between\n * cells; Enter or F2 (or a double-click) opens a cell's editor, Enter or leaving it saves and Escape cancels, and a\n * brief tick, announced as \"Saved\", shows the save. A grid saves as you go, so it never marks a form around it.\n */\n editable?: boolean;\n /**\n * A saved edit: the row's index in `data`, the column's id and the new value (the text typed, or the column's\n * `meta.parse` of it). Called only when the value changed. Return a promise to have the tick and \"Saved\" wait for it:\n * a rejection is announced as \"Not saved\", and the page says why and keeps the old value.\n */\n onCellEdit?: (rowIndex: number, columnId: string, value: unknown) => void | Promise<unknown>;\n /** The screen width below which the grid shows cards: the project's responsive.tableToCardsBreakpoint, else \"md\". */\n mobileBreakpoint?: BreakpointKey;\n /**\n * The grid's own width below which it shows cards when it doesn't fit, in px (Sprint 25.13 A35): about a phone's; 0\n * never switches by width. An editable grid never shows cards: it stays the APG's grid, scrolling sideways.\n */\n cardsBelow?: number;\n /**\n * The list's pager (Sprint 25.13 A3), from `usePagination(data)` over the same rows: pass it when the page also shows\n * the count (TableToolbar). Without it the grid pages itself the same way.\n */\n pager?: Pager<unknown>;\n /** The grid's name for assistive tech. */\n \"aria-label\"?: string;\n className?: string;\n}\n\n/** A cell of an editable grid: its row among those drawn (-1 for the header) and its column. */\ninterface CellAt { r: number; c: number }\nconst cellKey = (p: CellAt) => (p.r < 0 ? `h:${p.c}` : `${p.r}:${p.c}`);\n/** A cell by its row's id (null for the header), which a sort or a save that re-sorts never moves to another row. */\ninterface CellId { row: string | null; c: number }\n/** How long the saved tick shows, in ms (A5). */\nconst SAVED_TICK_MS = 1500;\n\nexport function DataGrid<T>({\n data,\n columns,\n pageSize,\n editable = false,\n onCellEdit,\n mobileBreakpoint: mobileBreakpointProp,\n cardsBelow = CARDS_BELOW,\n pager: pagerProp,\n \"aria-label\": ariaLabel,\n className,\n}: DataGridProps<T>) {\n // Sprint 25.14 A44: a grid draws its own frame, so a SplitView's list pane draws none around it\n useFramesItself();\n // Sprint 25.6 (B9): responsive.tableToCardsBreakpoint reaches the table through the shell; a prop wins; md outside any shell.\n const preferences = useShellPreferences();\n const mobileBreakpoint: BreakpointKey = mobileBreakpointProp ?? preferences.tableToCardsBreakpoint ?? \"md\";\n const narrowScreen = useBreakpoint(mobileBreakpoint);\n // A35: cards only on a narrow screen or where the grid's own width is a phone's. An editable grid stays the APG's grid\n // at every width, scrolling sideways: its cards have no editor (the review of 30 September: in a default Drawer, whose\n // body is 359 px, the grid went to cards and could no longer be edited).\n const { cards: isMobile, rootRef } = useCardsSwitch(editable ? false : narrowScreen, editable ? 0 : cardsBelow);\n const [sorting, setSorting] = useState<SortingState>([]);\n // the scroll area: a header or a cell the keyboard reaches is scrolled in whole, with its outline (Sprint 30, P3)\n const [scrollArea, setScrollArea] = useState<HTMLDivElement | null>(null);\n useRevealFocus(scrollArea);\n // the open editor (Sprint 25.8.7 item 19): its control, its value as the control holds it, and how a save gives it back\n const [editing, setEditing] = useState<(CellId & { editor: CellEditorKind; value: unknown; was: unknown; out: (value: unknown) => unknown }) | null>(null);\n\n /* ── Column kind inference ─────────────────────────────────────────── */\n const columnKeys = useMemo(() => columns.map((c) => c.id ?? (\"accessorKey\" in c ? String(c.accessorKey) : \"\")).filter(Boolean), [columns]);\n const inferredKinds = useMemo(\n () => inferColumnKinds(data as Record<string, unknown>[], columnKeys),\n [data, columnKeys],\n );\n const kindOf = useCallback(\n (colId: string, meta: DataGridColumnMeta | undefined) => meta?.kind ?? inferredKinds.get(colId),\n [inferredKinds],\n );\n\n // TanStack Table returns functions the React Compiler cannot memoise; the\n // compiler would skip this component, which is fine — the project does not\n // use it. The note is informational, not a defect.\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table is not compiler-compatible\n const table = useReactTable({\n data,\n columns,\n state: { sorting },\n onSortingChange: (updater) => { setSorting(updater); pagerProp?.setPage(1); },\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n });\n\n // ── A5 / A3: the project's page size and list style, through the pager, over every row sorted ──\n const sortedRows = table.getRowModel().rows;\n const ownPager = usePagination(sortedRows, { pageSize, resetOn: sorting });\n const pager = pagerProp ?? ownPager;\n useWholeListCheck(\"DataGrid\", data.length, pagerProp);\n const rows = pagerPart(sortedRows, pager);\n const leafColumns = table.getVisibleLeafColumns();\n const headerText = (id: string) => {\n const header = leafColumns.find((c) => c.id === id)?.columnDef.header;\n return typeof header === \"string\" ? header : id;\n };\n // a column's kind chooses its editor: a choice needs its options, and options alone choose nothing (told in development)\n if (editable) {\n for (const column of leafColumns) {\n const meta = column.columnDef.meta as DataGridColumnMeta | undefined;\n if (meta?.kind === \"choice\" && !meta.options?.length) warnOnce(\"DataGrid\", `column \"${column.id}\" is a choice with no options, so it edits as text: give its meta the options its cells take.`);\n else if (meta?.options?.length && meta.kind !== \"choice\") warnOnce(\"DataGrid\", `column \"${column.id}\" has options but not the choice kind, so they go unused: give its meta kind \"choice\" to edit it with a Dropdown.`);\n }\n }\n\n // ── A5: the grid's keyboard (the APG's grid), when editable ──\n // The Tab stop, the editor and the saved tick are kept by the row's id, so a sort, or a save that re-sorts the rows,\n // keeps each on its row (the review of 30 September: the tick and the Tab stop went to the row now in the old place).\n const gridRef = useRef<HTMLTableElement>(null);\n const [activeId, setActiveId] = useState<CellId>({ row: null, c: 0 });\n const lastRow = rows.length - 1;\n const rowAt = (id: string | null) => (id === null ? -1 : rows.findIndex((row) => row.id === id));\n const idAt = (p: CellAt): CellId => ({ row: p.r < 0 ? null : rows[p.r]?.id ?? null, c: p.c });\n const current: CellAt = { r: Math.min(rowAt(activeId.row), lastRow), c: Math.min(activeId.c, Math.max(0, leafColumns.length - 1)) };\n const setActive = (p: CellAt) => setActiveId(idAt(p));\n const move = (p: CellAt, e: ReactKeyboardEvent): CellAt | null => {\n // Alt with an arrow is the browser's (Back, Forward), and Ctrl or ⌘ with one too; Ctrl or ⌘ with Home or End goes to\n // the grid's first or last cell (the APG's grid)\n if (e.altKey) return null;\n const toCorner = e.ctrlKey || e.metaKey;\n switch (e.key) {\n case \"ArrowRight\": return !toCorner && p.c < leafColumns.length - 1 ? { ...p, c: p.c + 1 } : null;\n case \"ArrowLeft\": return !toCorner && p.c > 0 ? { ...p, c: p.c - 1 } : null;\n case \"ArrowDown\": return !toCorner && p.r < lastRow ? { ...p, r: p.r + 1 } : null;\n case \"ArrowUp\": return !toCorner && p.r > -1 ? { ...p, r: p.r - 1 } : null;\n case \"Home\": return toCorner ? { r: -1, c: 0 } : { ...p, c: 0 };\n case \"End\": return toCorner ? { r: lastRow, c: leafColumns.length - 1 } : { ...p, c: leafColumns.length - 1 };\n default: return null;\n }\n };\n // an edit ends once: Enter saves and unmounts the editor, whose blur must not save it again\n const ended = useRef(false);\n const startEdit = (p: CellAt) => {\n const row = rows[p.r];\n const column = leafColumns[p.c];\n if (!row || !column || (column.columnDef.meta as DataGridColumnMeta | undefined)?.editable === false) return;\n // another cell's edit still open (its leave is told a moment after its blur) is left now, and saves\n if (editing && !(editing.row === row.id && editing.c === p.c)) finishEdit(true, false);\n ended.current = false;\n setActive(p);\n const meta = column.columnDef.meta as DataGridColumnMeta | undefined;\n // an empty date cell edits as the column's dates are held: the first of them, read only if it's needed\n const firstOfColumn = () => rows.map((x) => x.getValue(column.id)).find((v) => !isEmpty(v));\n const setup = editorFor(kindOf(column.id, meta), row.getValue(column.id), meta, firstOfColumn);\n setEditing({ row: row.id, c: p.c, editor: setup.editor, value: setup.value, was: setup.value, out: setup.out });\n };\n const grid = useGridKeyboard<CellAt>({\n container: gridRef,\n active: current,\n setActive,\n keyOf: cellKey,\n move,\n onActivate: (p, e) => {\n if (p.r < 0) { if (leafColumns[p.c]?.getCanSort()) leafColumns[p.c].toggleSorting(); }\n else if (e.key === \"Enter\") startEdit(p);\n },\n modifierKeys: true,\n });\n const onGridKeyDown = (e: ReactKeyboardEvent) => {\n // while a cell is edited its keys are its editor's, a button's arrows too: they never move to another cell (the\n // APG's grid, editing within a cell)\n if (e.target instanceof Element && e.target.closest(\"[data-cell-editor]\")) return;\n // F2 opens the cell's editor too (the APG's grid)\n if (e.key === \"F2\" && !editing && current.r >= 0 && e.target instanceof HTMLElement && e.target.getAttribute(\"data-grid-key\") === cellKey(current)) {\n e.preventDefault();\n startEdit(current);\n return;\n }\n grid.onKeyDown(e);\n };\n // the Tab stop follows focus, however it got there: a click, a screen reader's command, a double-click (the hook's\n // contract; the review of 30 September: a clicked cell took no Enter, and ArrowDown went from the header)\n const onGridFocus = (e: React.FocusEvent) => {\n const key = e.target instanceof HTMLElement ? e.target.getAttribute(\"data-grid-key\") : null;\n if (!key) return;\n const [r, c] = key.startsWith(\"h:\") ? [-1, Number(key.slice(2))] : key.split(\":\").map(Number);\n if (Number.isFinite(r) && Number.isFinite(c) && cellKey(current) !== key) setActive({ r, c });\n };\n\n // ── A5: the save, its tick and its announcement ──\n const [saved, setSaved] = useState<{ row: string; c: number; n: number; ok: boolean } | null>(null);\n useEffect(() => {\n if (!saved) return;\n const t = setTimeout(() => setSaved((s) => (s && s.n === saved.n ? null : s)), SAVED_TICK_MS);\n return () => clearTimeout(t);\n }, [saved]);\n const heard = useRef(0);\n // after Enter or Escape focus comes back to the cell, on its row wherever a save that re-sorts puts it: its page first\n const refocus = useRef<CellId | null>(null);\n useLayoutEffect(() => {\n const want = refocus.current;\n if (!want) return;\n const r = rowAt(want.row);\n if (r < 0) {\n const all = sortedRows.findIndex((row) => row.id === want.row);\n if (all >= 0 && pager.style === \"pagination\") { const page = Math.floor(all / pager.pageSize) + 1; if (page !== pager.page) { pager.setPage(page); return; } }\n refocus.current = null;\n return;\n }\n refocus.current = null;\n grid.focus({ r, c: want.c });\n });\n // `picked`: a value chosen by a press (an option, a day, the box), which is the edit itself and saves at once\n const finishEdit = (commit: boolean, focusBack: boolean, picked?: { value: unknown }) => {\n if (!editing || ended.current) return;\n ended.current = true;\n const r = rowAt(editing.row);\n const row = rows[r];\n const column = leafColumns[editing.c];\n const cell = { row: editing.row, c: editing.c };\n setEditing(null);\n // leaving the editor (a click elsewhere, Tab) saves and lets focus go where it went (the review of 30 September:\n // it pulled focus back, and the next keys were lost)\n if (focusBack) { setActiveId(cell); refocus.current = cell; }\n // a save that changes nothing isn't one\n const value = picked ? picked.value : editing.value;\n if (!commit || !row || !column || sameValue(value, editing.was)) return;\n const done = (ok: boolean) => { heard.current += 1; setSaved({ ...cell, row: editing.row!, n: heard.current, ok }); };\n const result = onCellEdit?.(row.index, column.id, editing.out(value));\n if (result && typeof (result as Promise<unknown>).then === \"function\") (result as Promise<unknown>).then(() => done(true), () => done(false));\n else done(true);\n };\n\n // A3: the grid and its control are one element, as in 0.21, which takes the className: in a grid or a flex row they\n // stay one item (the review of 30 September: the control became an item of its own beside the grid)\n const control = data.length > 0 ? <Pagination {...pager.props} /> : null;\n const setRoot = (node: HTMLDivElement | null) => { rootRef.current = node; };\n const withControl = (list: ReactNode) => <div ref={setRoot} data-gs-paged=\"\" className={cn(\"flex flex-col min-w-0\", className)}>{list}{control}</div>;\n\n if (isMobile) {\n return withControl(\n <div data-ds-list=\"\" className=\"space-y-ds-3\">\n <TableCardCtx value={true}><RowsCtx value={true}>\n <div className=\"flex flex-col gap-ds-3\">\n {rows.map((row) => (\n <div\n key={row.id}\n className={cn(\n \"border-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)]\",\n \"rounded-[var(--ds-radius-md)] bg-[var(--ds-bg-surface)]\",\n \"p-ds-4 space-y-ds-3\",\n )}\n >\n {row.getVisibleCells().map((cell) => (\n <div key={cell.id} className=\"flex justify-between gap-ds-2 text-sm\">\n <span className=\"shrink-0 text-[var(--ds-text-secondary)] font-medium text-xs uppercase tracking-wider\">\n {typeof cell.column.columnDef.header === \"string\"\n ? cell.column.columnDef.header\n : cell.column.id}\n </span>\n <CardValue value={flexRender(cell.column.columnDef.cell, cell.getContext())} />\n </div>\n ))}\n </div>\n ))}\n </div>\n </RowsCtx></TableCardCtx>\n </div>\n );\n }\n\n const headerCell = (header: Header<T, unknown>, c: number) => {\n const canSort = header.column.getCanSort();\n const sorted = header.column.getIsSorted();\n const meta = header.column.columnDef.meta as DataGridColumnMeta | undefined;\n const headerKind = kindOf(header.column.id, meta);\n const headerAlign = meta?.align ?? (headerKind === \"number\" ? \"right\" : \"left\");\n const shrink = (headerKind === \"number\" || headerKind === \"date\") && !meta?.maxWidth;\n const at = { r: -1, c };\n const label = flexRender(header.column.columnDef.header, header.getContext());\n // A47: a sortable header holds a button: a Tab stop in a read-only grid, a cell the arrows reach in an editable one\n const inside = canSort ? (\n <button\n type=\"button\"\n onClick={header.column.getToggleSortingHandler()}\n {...(editable ? { \"data-grid-key\": cellKey(at), tabIndex: grid.tabIndexOf(at) } : {})}\n className={cn(\n \"inline-flex items-center gap-ds-1 uppercase tracking-wider cursor-pointer select-none [font:inherit] text-inherit\",\n \"hover:text-[var(--ds-text-primary)] rounded-[var(--ds-radius-sm)]\",\n // in a right-aligned column the indicator goes before the label, so the label ends where the column's values\n // end; the sorted column's label in full colour (the owner's choice at the look check, 14 October)\n headerAlign === \"right\" && \"flex-row-reverse\",\n sorted && \"text-[var(--ds-text-primary)]\",\n FOCUS_RING,\n )}\n >\n {label}\n <SortIndicator sorted={sorted} />\n </button>\n ) : label;\n return (\n <th\n key={header.id}\n role={editable ? \"columnheader\" : undefined}\n aria-sort={sorted === \"asc\" ? \"ascending\" : sorted === \"desc\" ? \"descending\" : undefined}\n {...(editable && !canSort ? { \"data-grid-key\": cellKey(at), tabIndex: grid.tabIndexOf(at) } : {})}\n className={cn(\n \"px-ds-4 py-ds-3 text-xs font-[var(--ds-weight-heading)] uppercase tracking-wider\",\n headerAlign === \"right\" ? \"text-right\" : headerAlign === \"center\" ? \"text-center\" : \"text-left\",\n shrink && \"w-px whitespace-nowrap\",\n \"text-[var(--ds-text-secondary)]\",\n FOCUS_INSET,\n // an editable column's cells keep room for their cue at their end (item 19): its header keeps the same\n editable && meta?.editable !== false && EDIT_CUE_ROOM,\n )}\n style={meta?.maxWidth || meta?.width || meta?.minWidth ? { maxWidth: meta?.maxWidth, width: meta?.width, minWidth: meta?.minWidth } : undefined}\n >\n <span className={cn(\"flex items-center gap-ds-1\", headerAlign === \"right\" && \"justify-end\", headerAlign === \"center\" && \"justify-center\")}>\n {inside}\n </span>\n </th>\n );\n };\n\n return withControl(\n <div data-ds-list=\"\" className=\"min-w-0\">\n <div\n ref={setScrollArea}\n // the scroll area the width switch reads (A35), as the Table's\n data-table-scroll=\"\"\n className={cn(\n \"relative w-full overflow-auto scroll-p-[4px] rounded-[var(--ds-radius-md)]\",\n \"border-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)]\",\n \"shadow-[var(--ds-shadow-card)]\",\n \"bg-[var(--ds-bg-surface)]\",\n )}\n >\n <table\n ref={gridRef}\n role={editable ? \"grid\" : undefined}\n aria-label={ariaLabel}\n onKeyDown={editable ? onGridKeyDown : undefined}\n onFocus={editable ? onGridFocus : undefined}\n className=\"w-full text-sm\"\n >\n <thead className=\"bg-[var(--ds-bg-muted)]\">\n {table.getHeaderGroups().map((hg) => (\n <tr key={hg.id} role={editable ? \"row\" : undefined} className=\"border-b-[length:var(--ds-divider-width)] border-[var(--ds-border-subtle)]\">\n {hg.headers.map((header, c) => headerCell(header, c))}\n </tr>\n ))}\n </thead>\n <tbody><RowsCtx value={true}>\n {rows.map((row, r) => (\n <tr\n key={row.id}\n role={editable ? \"row\" : undefined}\n className={cn(\n \"border-b-[length:var(--ds-divider-width)] border-[var(--ds-border-subtle)] last:border-b-0\",\n \"hover:bg-[var(--ds-bg-muted)] transition-colors\",\n )}\n >\n {row.getVisibleCells().map((cell, c) => {\n const meta = cell.column.columnDef.meta as DataGridColumnMeta | undefined;\n const truncLines = meta?.truncate === true ? 1 : meta?.truncate ? meta.truncate.lines : 0;\n const kind = kindOf(cell.column.id, meta);\n const rendered = flexRender(cell.column.columnDef.cell, cell.getContext() as CellContext<T, unknown>);\n const at = { r, c };\n const isEditing = editable && editing?.row === row.id && editing.c === c;\n\n const shrink = (kind === \"number\" || kind === \"date\") && !meta?.maxWidth;\n // Round 14 (50.2): a centred or right-aligned column lays a block element out with flex — text-align moves inline content only.\n const align = meta?.align ?? (kind === \"number\" ? \"right\" : \"left\");\n let inner: ReactNode;\n if (isEditing) {\n // the library's control for the column's kind, named for its column (CellEditor). The cell keeps its\n // size while it is edited: its value holds the room, unseen, and the editor sits over it, from the\n // cell's start (its end, in a right-aligned column), as wide as its control needs. So no column moves\n // and the row keeps its height (the look check's second round: a number's field had no room in its\n // narrow column, and a date's widened every column)\n inner = (\n <>\n <span aria-hidden=\"true\" className=\"invisible\">{rendered}</span>\n <div className={cn(\n \"absolute inset-y-0 z-30 flex items-center\", EDITOR_WIDTH[editing.editor],\n // from the cell's end in a right-aligned column, and in the last column, where an editor wider\n // than its cell would run past the grid's edge; over the cell before, it stays in view\n align === \"right\" || c === row.getVisibleCells().length - 1 ? \"right-ds-2\" : \"left-ds-2\",\n )}>\n <CellEditor\n editor={editing.editor}\n value={editing.value}\n name={headerText(cell.column.id)}\n options={meta?.options}\n onChange={(v) => setEditing({ ...editing, value: v })}\n onEnd={finishEdit}\n />\n </div>\n </>\n );\n } else if (truncLines > 0) {\n inner = <CutCell lines={truncLines}>{rendered}</CutCell>;\n } else if (kind === \"email\") {\n inner = <CutEmail>{rendered}</CutEmail>;\n } else {\n inner = rendered;\n }\n const value = cell.getValue();\n if (!isEditing && align !== \"left\" && typeof value !== \"string\" && typeof value !== \"number\" && value !== null && value !== undefined) {\n inner = <div className={cn(\"flex items-center\", align === \"center\" ? \"justify-center\" : \"justify-end\")}>{inner}</div>;\n }\n const tick = editable && saved?.ok && saved.row === row.id && saved.c === c\n ? <Icon name=\"check\" size={14} className=\"ml-ds-1 inline-block align-middle text-[var(--ds-status-success)]\" />\n : null;\n\n // item 19: an editable cell says so before it is tried; a calculated or locked one is read-only\n const edits = editable && meta?.editable !== false;\n const least = edits ? editableMinWidth(kind, meta) : undefined;\n return (\n <td\n key={cell.id}\n // a double-click in the open editor selects a word, and never reopens it over what was typed\n {...(editable ? { role: \"gridcell\", \"data-grid-key\": cellKey(at), tabIndex: grid.tabIndexOf(at), onDoubleClick: () => { if (!isEditing) startEdit(at); } } : {})}\n aria-readonly={editable && !edits ? true : undefined}\n className={cn(\n \"px-ds-4 py-ds-3 text-[var(--ds-text-primary)]\",\n align === \"right\" && \"text-right\",\n align === \"center\" && \"text-center\",\n shrink && \"w-px whitespace-nowrap\",\n editable && FOCUS_INSET,\n edits && cn(\"group/cell relative\", EDIT_CUE_ROOM),\n )}\n style={meta?.maxWidth || meta?.width || meta?.minWidth || least ? { maxWidth: meta?.maxWidth, width: meta?.width, minWidth: meta?.minWidth ?? least } : undefined}\n >\n {inner}\n {tick}\n {edits && !isEditing && EDIT_CUE}\n </td>\n );\n })}\n </tr>\n ))}\n </RowsCtx></tbody>\n </table>\n </div>\n {/* A5: a save is heard, politely (WCAG 4.1.3); each one is a new line, so two saves are heard twice */}\n {editable && <div role=\"status\" className=\"sr-only\"><span key={saved?.n ?? 0}>{saved ? (saved.ok ? \"Saved\" : \"Not saved\") : \"\"}</span></div>}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../showcase/src/components/DataGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwFA,IAAM,UAAU,CAAC,CAAA,KAAe,MAAM,IAAA,IAAQ,CAAA,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IAAW,YAAA;AAAA,4BACrB,UAAU,QAAA,IAAY,aAAA;AAAA,4BACtB,MAAA,IAAU,wBAAA;AAAA,4BACV,QAAA,IAAY,WAAA;AAAA,4BACZ,KAAA,IAAS,EAAA,CAAG,qBAAA,EAAuB,aAAa;AAAA,2BAClD;AAAA,0BACA,OAAO,IAAA,EAAM,QAAA,IAAY,MAAM,KAAA,IAAS,IAAA,EAAM,YAAY,KAAA,GAAQ,EAAE,UAAU,IAAA,EAAM,QAAA,EAAU,OAAO,IAAA,EAAM,KAAA,EAAO,UAAU,IAAA,EAAM,QAAA,IAAY,OAAM,GAAI,MAAA;AAAA,0BAEvJ,QAAA,EAAA;AAAA,4BAAA,KAAA;AAAA,4BACA,IAAA;AAAA,4BACA,KAAA,IAAS,CAAC,SAAA,IAAa;AAAA;AAAA,yBAAA;AAAA,wBAhBnB,IAAA,CAAK;AAAA,uBAiBZ;AAAA,oBAEJ,CAAC;AAAA,mBAAA;AAAA,kBApFI,GAAA,CAAI;AAAA,iBAsFZ,GACH,CAAA,EAAU;AAAA;AAAA;AAAA;AACZ;AAAA,OACF;AAAA,MAEC,4BAAY,GAAA,CAAC,KAAA,EAAA,EAAI,MAAK,QAAA,EAAS,SAAA,EAAU,WAAU,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAA0B,QAAA,EAAA,KAAA,GAAS,KAAA,CAAM,KAAK,OAAA,GAAU,WAAA,GAAe,MAA7D,KAAA,EAAO,CAAA,IAAK,CAAoD,CAAA,EAAO;AAAA,KAAA,EACxI;AAAA,GACF;AACF","file":"data-grid.js","sourcesContent":["import { useState, useCallback, useEffect, useLayoutEffect, useMemo, useRef, type ReactElement, type ReactNode, type SyntheticEvent, type KeyboardEvent as ReactKeyboardEvent } from \"react\";\nimport { useShellPreferences } from \"../lib/preferences\";\nimport {\n useReactTable,\n getCoreRowModel,\n getSortedRowModel,\n flexRender,\n type CellContext,\n type ColumnDef,\n type Header,\n type SortingState,\n} from \"@tanstack/react-table\";\nimport { cn, FOCUS_INSET, FOCUS_RING } from \"../lib/utils\";\nimport { Icon } from \"../lib/icons\";\nimport { CutCell, CutEmail } from \"./TextOverflow\";\nimport { Input } from \"./Input\";\nimport { NumberInput } from \"./NumberInput\";\nimport { DatePicker } from \"./DatePicker\";\nimport { Dropdown } from \"./Dropdown\";\nimport { Checkbox } from \"./Checkbox\";\nimport { Field } from \"./Field\";\nimport { Pagination } from \"./Pagination\";\nimport { useBreakpoint, type BreakpointKey } from \"../lib/use-breakpoint\";\nimport { useRevealFocus } from \"../lib/reveal-focus\";\nimport { inferColumnKinds, type ColumnKind } from \"../lib/table-utils\";\nimport { CardValue } from \"../lib/card-cell\";\nimport { TableCardCtx, RowsCtx, useFramesItself } from \"../lib/surface-context\";\nimport { FormChangeCtx } from \"../lib/form-context\";\nimport { focusInitial, useFocusLeave, useGridKeyboard } from \"../lib/focus\";\nimport { dayKey } from \"../lib/date-grid\";\nimport { SortIndicator } from \"../lib/sort-indicator\";\nimport { warnOnce } from \"../lib/dev-warn\";\nimport { usePagination, pagerPart, useWholeListCheck, type Pager } from \"../lib/use-pagination\";\nimport { CARDS_BELOW, useCardsSwitch } from \"../lib/use-cards-switch\";\n\n/** One of a choice column's options: the value its cells hold, and the words shown for it. */\nexport interface DataGridOption {\n value: string | number;\n label: string;\n}\n\n/** Column meta for opt-in truncation. Set on ColumnDef.meta. */\nexport interface DataGridColumnMeta {\n /** true = single-line, or { lines: N } for multi-line clamp. */\n truncate?: boolean | { lines: number };\n /** CSS max-width for the column. */\n maxWidth?: string;\n /** CSS width for the column — sibling grids that share a column set line up when their columns carry the same widths (round 14). */\n width?: string;\n /** CSS min-width for the column. */\n minWidth?: string;\n /**\n * Explicit column kind. When omitted the DataGrid infers it from data values (a yes or no too; never a choice). In an\n * editable grid it chooses the editor, where the control can hold the cell's value: \"number\" a NumberInput for a\n * number, \"date\" a DatePicker for a Date or an ISO date (\"2026-10-14\"), \"choice\" a Dropdown of `options`, \"boolean\" a\n * Checkbox; any other kind, and a number or a date written as text (\"18 KB\", \"12 Jan 2026\"), a text Input.\n */\n kind?: ColumnKind;\n /** Horizontal alignment of the header and the cells; a block element (a Checkbox, a Button) is laid out with flex so it follows too (round 14). Default: numbers right, everything else left. */\n align?: \"left\" | \"center\" | \"right\";\n /**\n * In an editable grid, whether this column's cells edit (default true); false for a column that shows (a status, a\n * calculated value, actions): its cells show no edit cue, and assistive tech hears them as read-only.\n */\n editable?: boolean;\n /**\n * A choice column's options (with `kind: \"choice\"`): its cells edit with a Dropdown of them, and a save gives the\n * option's `value`. Give the column a `cell` that shows the option's label.\n */\n options?: readonly DataGridOption[];\n /**\n * In an editable grid, the value onCellEdit gets from what was typed in a text cell, or in a number cell as its text\n * (default the text itself, or the number): a price written as text, `(text) => Number(text.replace(/[$,]/g, \"\"))`.\n * A date, a choice and a yes or no are given as their own values.\n */\n parse?: (text: string) => unknown;\n}\n\n/** The control a cell edits with (Sprint 25.8.7 item 19): its column's kind, where that control can hold the cell's value. */\ntype CellEditorKind = \"text\" | \"number\" | \"date\" | \"choice\" | \"boolean\";\n\n/** What an edit starts from: its control, the control's value, and how a saved value goes back in the cell's own form. */\ninterface EditorSetup {\n editor: CellEditorKind;\n value: unknown;\n out: (value: unknown) => unknown;\n}\n\nconst isEmpty = (v: unknown) => v === null || v === undefined || v === \"\";\nconst isDate = (v: unknown): v is Date => v instanceof Date && !Number.isNaN(v.getTime());\n/** An ISO date's text (\"2026-10-14\") as the local day it names, else null; the date grid's day key is the same text. */\nfunction isoDay(v: unknown): Date | null {\n const m = typeof v === \"string\" ? /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(v) : null;\n if (!m) return null;\n const d = new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3]));\n return dayKey(d) === v ? d : null;\n}\n/** Two of an editor's values are one: a date by its time, anything else by itself. */\nconst sameValue = (a: unknown, b: unknown) => (isDate(a) && isDate(b) ? a.getTime() === b.getTime() : Object.is(a, b));\n\n/**\n * The editor for a cell. A control edits only a value it can hold: a NumberInput holds no empty cell and no \"18 KB\", a\n * DatePicker gives back no \"12 Jan 2026\", so those keep the text Input. A date goes back in the form it came: a Date,\n * keeping its time of day, or an ISO date's text; an empty cell's, as the column's first date is (a Date when it has\n * none).\n */\nfunction editorFor(kind: ColumnKind | undefined, raw: unknown, meta: DataGridColumnMeta | undefined, firstOfColumn: () => unknown): EditorSetup {\n const parse = meta?.parse;\n if (kind === \"choice\" && meta?.options?.length) return { editor: \"choice\", value: raw ?? null, out: (v) => v };\n if (kind === \"boolean\" && (typeof raw === \"boolean\" || isEmpty(raw))) return { editor: \"boolean\", value: raw === true, out: (v) => v };\n if (kind === \"number\" && typeof raw === \"number\" && Number.isFinite(raw)) return { editor: \"number\", value: raw, out: (v) => (parse ? parse(String(v)) : v) };\n if (kind === \"date\") {\n const was = isEmpty(raw) ? firstOfColumn() : raw;\n if (isDate(raw)) {\n return { editor: \"date\", value: raw, out: (v) => (isDate(v) ? new Date(v.getFullYear(), v.getMonth(), v.getDate(), raw.getHours(), raw.getMinutes(), raw.getSeconds(), raw.getMilliseconds()) : null) };\n }\n if (isoDay(was)) return { editor: \"date\", value: isoDay(raw), out: (v) => (isDate(v) ? dayKey(v) : null) };\n if (isEmpty(was) || isDate(was)) return { editor: \"date\", value: null, out: (v) => (isDate(v) ? v : null) };\n }\n return { editor: \"text\", value: String(raw ?? \"\"), out: (v) => (parse ? parse(v as string) : v) };\n}\n\n/**\n * A cell's editor (Sprint 25.8.7 item 19): the library's control for its column's kind, named for the column by a\n * hidden Field label. What is typed (text, a number, a date's parts) saves with Enter or by leaving the editor; a value\n * picked by a press (an option, a calendar's day, the box) is the edit, and saves at once; Escape, in the field or in\n * its popup, leaves the cell as it was. Leaving is the Field's own check (lib/focus.ts, useFocusLeave): focus moving\n * into the editor's popup, the Dropdown's list or the DatePicker's calendar, is not leaving it.\n */\nfunction CellEditor({ editor, value, name, options, onChange, onEnd }: {\n editor: CellEditorKind;\n value: unknown;\n name: string;\n options?: readonly DataGridOption[];\n onChange: (value: unknown) => void;\n onEnd: (save: boolean, focusBack: boolean, picked?: { value: unknown }) => void;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n // leaving the editor saves it and lets focus go where it went (the review of 30 September: it pulled focus back, and\n // the next keys were lost)\n const leave = useFocusLeave(() => onEnd(true, false));\n // a value chosen in a popup (the calendar's day, by a click or by Enter) is the edit itself. React passes the popup's\n // events up through its portal, so a key or a press from outside this editor's own box came from there. The flag is\n // where the latest one came from, never reset by a timer: Chrome runs a capture handler and the bubbling handler that\n // changes the value as separate listeners, with a microtask checkpoint between them\n const fromPopup = useRef(false);\n const markPopupEvent = (e: SyntheticEvent) => { fromPopup.current = !ref.current?.contains(e.target as Node); };\n const opened = useRef(false);\n useLayoutEffect(() => {\n const root = ref.current;\n if (!root) return;\n focusInitial(root);\n const el = document.activeElement;\n // the value opens selected: typing replaces it, an arrow key keeps it\n if (el instanceof HTMLInputElement && el.type === \"text\") el.select();\n // a choice opens on its list, the edit itself; once, though a development build runs this twice\n if (editor === \"choice\" && !opened.current && el instanceof HTMLButtonElement && root.contains(el)) {\n opened.current = true;\n el.click();\n }\n }, [editor]);\n // a choice and the box change only when picked, and a pick saves at once; what is typed or stepped (text, a number, a\n // date's parts) waits for Enter or for leaving the editor\n const picks = editor === \"choice\" || editor === \"boolean\";\n const change = (v: unknown) => (picks || fromPopup.current ? onEnd(true, true, { value: v }) : onChange(v));\n let control: ReactElement;\n if (editor === \"number\") control = <NumberInput size=\"sm\" value={value as number} allowDecimals onChange={change} />;\n else if (editor === \"date\") control = <DatePicker size=\"sm\" value={value as Date | null} onChange={change} />;\n else if (editor === \"boolean\") control = <Checkbox checked={value === true} onChange={(checked) => change(checked)} />;\n else if (editor === \"choice\" && options) {\n control = (\n <Dropdown\n size=\"sm\"\n options={options.map((o) => ({ id: String(o.value), label: o.label }))}\n value={value === null || value === undefined ? \"\" : String(value)}\n onChange={(id) => change(options.find((o) => String(o.value) === id)?.value ?? id)}\n />\n );\n } else control = <Input size=\"sm\" value={value as string} onChange={(e) => change(e.target.value)} />;\n return (\n <div\n ref={ref}\n data-cell-editor=\"\"\n {...leave}\n onClickCapture={markPopupEvent}\n onKeyDownCapture={markPopupEvent}\n onKeyDown={(e) => {\n // Escape, in the field or its popup, leaves the cell as it was, and goes no further: a Drawer round the grid stays\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n onEnd(false, true);\n return;\n }\n // Enter saves what was typed; on a button (the Dropdown's, the calendar's) it is the button's, which opens its\n // popup, and in the popup it picks\n if (e.key === \"Enter\" && e.currentTarget.contains(e.target as Node) && !(e.target instanceof HTMLButtonElement)) {\n e.preventDefault();\n onEnd(true, true);\n }\n }}\n >\n {/* a grid saves as you go, so its editor never marks a form around it; the cells' own controls still do (the\n review of 30 September: the whole grid opted out, and a Drawer closed on a changed checkbox unasked) */}\n <FormChangeCtx value={null}>\n <Field label={name} hideLabel>{control}</Field>\n </FormChangeCtx>\n </div>\n );\n}\n\n/**\n * Sprint 25.8.7 item 19 (collections-5): an editable cell says so before it is tried, a pencil shown while the cell is\n * hovered or focused (focused too: a touch screen has no hover); a calculated or locked cell shows none. It sits in room\n * an editable column keeps at its cells' end, header too, so a value never moves and a number stays under its header.\n */\nconst EDIT_CUE_ROOM = \"pr-[calc(var(--ds-space-4)+var(--ds-space-1)+12px)]\";\n\n/** How wide an editor sits over its cell: the cell's width inside its padding, and never less than its control needs. */\nconst EDITOR_WIDTH: Record<CellEditorKind, string> = {\n text: \"w-[max(calc(100%-var(--ds-space-4)),12rem)]\",\n number: \"w-[max(calc(100%-var(--ds-space-4)),8rem)]\",\n date: \"w-[max(calc(100%-var(--ds-space-4)),10.5rem)]\",\n choice: \"w-[max(calc(100%-var(--ds-space-4)),9rem)]\",\n boolean: \"w-auto\",\n};\n/**\n * The least an editable column of numbers, dates or choices is wide, at rest too: its editor's room and the cell's\n * padding, so the editor fits in its own cell and never covers the next one (a text column is wide by its words, and\n * a text editor may run over). A page's own width or min-width for the column wins.\n */\nconst EDITABLE_MIN_WIDTH: Partial<Record<CellEditorKind, string>> = { number: \"9rem\", date: \"11.5rem\", choice: \"10rem\" };\nfunction editableMinWidth(kind: ColumnKind | undefined, meta: DataGridColumnMeta | undefined): string | undefined {\n if (meta?.width || meta?.minWidth) return undefined;\n const editor: CellEditorKind | null = kind === \"number\" ? \"number\" : kind === \"date\" ? \"date\" : kind === \"choice\" && meta?.options?.length ? \"choice\" : null;\n return editor ? EDITABLE_MIN_WIDTH[editor] : undefined;\n}\nconst EDIT_CUE = (\n <span\n data-edit-cue=\"\"\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute top-1/2 -translate-y-1/2 right-ds-4 flex\",\n \"text-[var(--ds-text-muted)] opacity-0 transition-opacity duration-[var(--ds-transition-speed)]\",\n \"group-hover/cell:opacity-100 group-focus/cell:opacity-100\",\n )}\n >\n <Icon name=\"edit\" size={12} />\n </span>\n);\n\n\nexport interface DataGridProps<T> {\n data: T[];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- public API: columns may carry any value type\n columns: ColumnDef<T, any>[];\n /**\n * Rows a page, over the project's (dataDisplay.itemsPerPage), for a grid the user asked to page differently. Leave it\n * out: the grid pages as the project says, with the project's control (Sprint 25.13 A5; it was 10).\n */\n pageSize?: number;\n /**\n * Cells edit in place, as the APG's grid (Sprint 25.13 A5): the grid is one Tab stop and the arrow keys move between\n * cells; Enter or F2 (or a double-click) opens a cell's editor, Enter or leaving it saves and Escape cancels, and a\n * brief tick, announced as \"Saved\", shows the save. A grid saves as you go, so it never marks a form around it.\n */\n editable?: boolean;\n /**\n * A saved edit: the row's index in `data`, the column's id and the new value (the text typed, or the column's\n * `meta.parse` of it). Called only when the value changed. Return a promise to have the tick and \"Saved\" wait for it:\n * a rejection is announced as \"Not saved\", and the page says why and keeps the old value.\n */\n onCellEdit?: (rowIndex: number, columnId: string, value: unknown) => void | Promise<unknown>;\n /** The screen width below which the grid shows cards: the project's responsive.tableToCardsBreakpoint, else \"md\". */\n mobileBreakpoint?: BreakpointKey;\n /**\n * The grid's own width below which it shows cards when it doesn't fit, in px (Sprint 25.13 A35): about a phone's; 0\n * never switches by width. An editable grid never shows cards: it stays the APG's grid, scrolling sideways.\n */\n cardsBelow?: number;\n /**\n * The list's pager (Sprint 25.13 A3), from `usePagination(data)` over the same rows: pass it when the page also shows\n * the count (TableToolbar). Without it the grid pages itself the same way.\n */\n pager?: Pager<unknown>;\n /** The grid's name for assistive tech. */\n \"aria-label\"?: string;\n className?: string;\n}\n\n/** A cell of an editable grid: its row among those drawn (-1 for the header) and its column. */\ninterface CellAt { r: number; c: number }\nconst cellKey = (p: CellAt) => (p.r < 0 ? `h:${p.c}` : `${p.r}:${p.c}`);\n/** A cell by its row's id (null for the header), which a sort or a save that re-sorts never moves to another row. */\ninterface CellId { row: string | null; c: number }\n/** How long the saved tick shows, in ms (A5). */\nconst SAVED_TICK_MS = 1500;\n\nexport function DataGrid<T>({\n data,\n columns,\n pageSize,\n editable = false,\n onCellEdit,\n mobileBreakpoint: mobileBreakpointProp,\n cardsBelow = CARDS_BELOW,\n pager: pagerProp,\n \"aria-label\": ariaLabel,\n className,\n}: DataGridProps<T>) {\n // Sprint 25.14 A44: a grid draws its own frame, so a SplitView's list pane draws none around it\n useFramesItself();\n // Sprint 25.6 (B9): responsive.tableToCardsBreakpoint reaches the table through the shell; a prop wins; md outside any shell.\n const preferences = useShellPreferences();\n const mobileBreakpoint: BreakpointKey = mobileBreakpointProp ?? preferences.tableToCardsBreakpoint ?? \"md\";\n const narrowScreen = useBreakpoint(mobileBreakpoint);\n // A35: cards only on a narrow screen or where the grid's own width is a phone's. An editable grid stays the APG's grid\n // at every width, scrolling sideways: its cards have no editor (the review of 30 September: in a default Drawer, whose\n // body is 359 px, the grid went to cards and could no longer be edited).\n const { cards: isMobile, rootRef } = useCardsSwitch(editable ? false : narrowScreen, editable ? 0 : cardsBelow);\n const [sorting, setSorting] = useState<SortingState>([]);\n // the scroll area: a header or a cell the keyboard reaches is scrolled in whole, with its outline (Sprint 30, P3)\n const [scrollArea, setScrollArea] = useState<HTMLDivElement | null>(null);\n useRevealFocus(scrollArea);\n // the open editor (Sprint 25.8.7 item 19): its control, its value as the control holds it, and how a save gives it back\n const [editing, setEditing] = useState<(CellId & { editor: CellEditorKind; value: unknown; was: unknown; out: (value: unknown) => unknown }) | null>(null);\n\n /* ── Column kind inference ─────────────────────────────────────────── */\n const columnKeys = useMemo(() => columns.map((c) => c.id ?? (\"accessorKey\" in c ? String(c.accessorKey) : \"\")).filter(Boolean), [columns]);\n const inferredKinds = useMemo(\n () => inferColumnKinds(data as Record<string, unknown>[], columnKeys),\n [data, columnKeys],\n );\n const kindOf = useCallback(\n (colId: string, meta: DataGridColumnMeta | undefined) => meta?.kind ?? inferredKinds.get(colId),\n [inferredKinds],\n );\n\n // TanStack Table returns functions the React Compiler cannot memoise; the\n // compiler would skip this component, which is fine — the project does not\n // use it. The note is informational, not a defect.\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table is not compiler-compatible\n const table = useReactTable({\n data,\n columns,\n state: { sorting },\n onSortingChange: (updater) => { setSorting(updater); pagerProp?.setPage(1); },\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n });\n\n // ── A5 / A3: the project's page size and list style, through the pager, over every row sorted ──\n const sortedRows = table.getRowModel().rows;\n const ownPager = usePagination(sortedRows, { pageSize, resetOn: sorting });\n const pager = pagerProp ?? ownPager;\n useWholeListCheck(\"DataGrid\", data.length, pagerProp);\n const rows = pagerPart(sortedRows, pager);\n const leafColumns = table.getVisibleLeafColumns();\n const headerText = (id: string) => {\n const header = leafColumns.find((c) => c.id === id)?.columnDef.header;\n return typeof header === \"string\" ? header : id;\n };\n // a column's kind chooses its editor: a choice needs its options, and options alone choose nothing (told in development)\n if (editable) {\n for (const column of leafColumns) {\n const meta = column.columnDef.meta as DataGridColumnMeta | undefined;\n if (meta?.kind === \"choice\" && !meta.options?.length) warnOnce(\"DataGrid\", `column \"${column.id}\" is a choice with no options, so it edits as text: give its meta the options its cells take.`);\n else if (meta?.options?.length && meta.kind !== \"choice\") warnOnce(\"DataGrid\", `column \"${column.id}\" has options but not the choice kind, so they go unused: give its meta kind \"choice\" to edit it with a Dropdown.`);\n }\n }\n\n // ── A5: the grid's keyboard (the APG's grid), when editable ──\n // The Tab stop, the editor and the saved tick are kept by the row's id, so a sort, or a save that re-sorts the rows,\n // keeps each on its row (the review of 30 September: the tick and the Tab stop went to the row now in the old place).\n const gridRef = useRef<HTMLTableElement>(null);\n const [activeId, setActiveId] = useState<CellId>({ row: null, c: 0 });\n const lastRow = rows.length - 1;\n const rowAt = (id: string | null) => (id === null ? -1 : rows.findIndex((row) => row.id === id));\n const idAt = (p: CellAt): CellId => ({ row: p.r < 0 ? null : rows[p.r]?.id ?? null, c: p.c });\n const current: CellAt = { r: Math.min(rowAt(activeId.row), lastRow), c: Math.min(activeId.c, Math.max(0, leafColumns.length - 1)) };\n const setActive = (p: CellAt) => setActiveId(idAt(p));\n const move = (p: CellAt, e: ReactKeyboardEvent): CellAt | null => {\n // Alt with an arrow is the browser's (Back, Forward), and Ctrl or ⌘ with one too; Ctrl or ⌘ with Home or End goes to\n // the grid's first or last cell (the APG's grid)\n if (e.altKey) return null;\n const toCorner = e.ctrlKey || e.metaKey;\n switch (e.key) {\n case \"ArrowRight\": return !toCorner && p.c < leafColumns.length - 1 ? { ...p, c: p.c + 1 } : null;\n case \"ArrowLeft\": return !toCorner && p.c > 0 ? { ...p, c: p.c - 1 } : null;\n case \"ArrowDown\": return !toCorner && p.r < lastRow ? { ...p, r: p.r + 1 } : null;\n case \"ArrowUp\": return !toCorner && p.r > -1 ? { ...p, r: p.r - 1 } : null;\n case \"Home\": return toCorner ? { r: -1, c: 0 } : { ...p, c: 0 };\n case \"End\": return toCorner ? { r: lastRow, c: leafColumns.length - 1 } : { ...p, c: leafColumns.length - 1 };\n default: return null;\n }\n };\n // an edit ends once: Enter saves and unmounts the editor, whose blur must not save it again\n const ended = useRef(false);\n const startEdit = (p: CellAt) => {\n const row = rows[p.r];\n const column = leafColumns[p.c];\n if (!row || !column || (column.columnDef.meta as DataGridColumnMeta | undefined)?.editable === false) return;\n // another cell's edit still open (its leave is told a moment after its blur) is left now, and saves\n if (editing && !(editing.row === row.id && editing.c === p.c)) finishEdit(true, false);\n ended.current = false;\n setActive(p);\n const meta = column.columnDef.meta as DataGridColumnMeta | undefined;\n // an empty date cell edits as the column's dates are held: the first of them, read only if it's needed\n const firstOfColumn = () => rows.map((x) => x.getValue(column.id)).find((v) => !isEmpty(v));\n const setup = editorFor(kindOf(column.id, meta), row.getValue(column.id), meta, firstOfColumn);\n setEditing({ row: row.id, c: p.c, editor: setup.editor, value: setup.value, was: setup.value, out: setup.out });\n };\n const grid = useGridKeyboard<CellAt>({\n container: gridRef,\n active: current,\n setActive,\n keyOf: cellKey,\n move,\n onActivate: (p, e) => {\n if (p.r < 0) { if (leafColumns[p.c]?.getCanSort()) leafColumns[p.c].toggleSorting(); }\n else if (e.key === \"Enter\") startEdit(p);\n },\n modifierKeys: true,\n });\n const onGridKeyDown = (e: ReactKeyboardEvent) => {\n // while a cell is edited its keys are its editor's, a button's arrows too: they never move to another cell (the\n // APG's grid, editing within a cell)\n if (e.target instanceof Element && e.target.closest(\"[data-cell-editor]\")) return;\n // F2 opens the cell's editor too (the APG's grid)\n if (e.key === \"F2\" && !editing && current.r >= 0 && e.target instanceof HTMLElement && e.target.getAttribute(\"data-grid-key\") === cellKey(current)) {\n e.preventDefault();\n startEdit(current);\n return;\n }\n grid.onKeyDown(e);\n };\n // the Tab stop follows focus, however it got there: a click, a screen reader's command, a double-click (the hook's\n // contract; the review of 30 September: a clicked cell took no Enter, and ArrowDown went from the header)\n const onGridFocus = (e: React.FocusEvent) => {\n const key = e.target instanceof HTMLElement ? e.target.getAttribute(\"data-grid-key\") : null;\n if (!key) return;\n const [r, c] = key.startsWith(\"h:\") ? [-1, Number(key.slice(2))] : key.split(\":\").map(Number);\n if (Number.isFinite(r) && Number.isFinite(c) && cellKey(current) !== key) setActive({ r, c });\n };\n\n // ── A5: the save, its tick and its announcement ──\n const [saved, setSaved] = useState<{ row: string; c: number; n: number; ok: boolean } | null>(null);\n useEffect(() => {\n if (!saved) return;\n const t = setTimeout(() => setSaved((s) => (s && s.n === saved.n ? null : s)), SAVED_TICK_MS);\n return () => clearTimeout(t);\n }, [saved]);\n const heard = useRef(0);\n // after Enter or Escape focus comes back to the cell, on its row wherever a save that re-sorts puts it: its page first\n const refocus = useRef<CellId | null>(null);\n useLayoutEffect(() => {\n const want = refocus.current;\n if (!want) return;\n const r = rowAt(want.row);\n if (r < 0) {\n const all = sortedRows.findIndex((row) => row.id === want.row);\n if (all >= 0 && pager.style === \"pagination\") { const page = Math.floor(all / pager.pageSize) + 1; if (page !== pager.page) { pager.setPage(page); return; } }\n refocus.current = null;\n return;\n }\n refocus.current = null;\n grid.focus({ r, c: want.c });\n });\n // `picked`: a value chosen by a press (an option, a day, the box), which is the edit itself and saves at once\n const finishEdit = (commit: boolean, focusBack: boolean, picked?: { value: unknown }) => {\n if (!editing || ended.current) return;\n ended.current = true;\n const r = rowAt(editing.row);\n const row = rows[r];\n const column = leafColumns[editing.c];\n const cell = { row: editing.row, c: editing.c };\n setEditing(null);\n // leaving the editor (a click elsewhere, Tab) saves and lets focus go where it went (the review of 30 September:\n // it pulled focus back, and the next keys were lost)\n if (focusBack) { setActiveId(cell); refocus.current = cell; }\n // a save that changes nothing isn't one\n const value = picked ? picked.value : editing.value;\n if (!commit || !row || !column || sameValue(value, editing.was)) return;\n const done = (ok: boolean) => { heard.current += 1; setSaved({ ...cell, row: editing.row!, n: heard.current, ok }); };\n const result = onCellEdit?.(row.index, column.id, editing.out(value));\n if (result && typeof (result as Promise<unknown>).then === \"function\") (result as Promise<unknown>).then(() => done(true), () => done(false));\n else done(true);\n };\n\n // A3: the grid and its control are one element, as in 0.21, which takes the className: in a grid or a flex row they\n // stay one item (the review of 30 September: the control became an item of its own beside the grid)\n const control = data.length > 0 ? <Pagination {...pager.props} /> : null;\n const setRoot = (node: HTMLDivElement | null) => { rootRef.current = node; };\n const withControl = (list: ReactNode) => <div ref={setRoot} data-gs-paged=\"\" className={cn(\"flex flex-col min-w-0\", className)}>{list}{control}</div>;\n\n if (isMobile) {\n return withControl(\n <div data-ds-list=\"\" className=\"space-y-ds-3\">\n <TableCardCtx value={true}><RowsCtx value={true}>\n <div className=\"flex flex-col gap-ds-3\">\n {rows.map((row) => (\n <div\n key={row.id}\n className={cn(\n \"border-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)]\",\n \"rounded-[var(--ds-radius-md)] bg-[var(--ds-bg-surface)]\",\n \"p-ds-4 space-y-ds-3\",\n )}\n >\n {row.getVisibleCells().map((cell) => (\n <div key={cell.id} className=\"flex justify-between gap-ds-2 text-sm\">\n <span className=\"shrink-0 text-[var(--ds-text-secondary)] font-medium text-xs uppercase tracking-wider\">\n {typeof cell.column.columnDef.header === \"string\"\n ? cell.column.columnDef.header\n : cell.column.id}\n </span>\n <CardValue value={flexRender(cell.column.columnDef.cell, cell.getContext())} />\n </div>\n ))}\n </div>\n ))}\n </div>\n </RowsCtx></TableCardCtx>\n </div>\n );\n }\n\n const headerCell = (header: Header<T, unknown>, c: number) => {\n const canSort = header.column.getCanSort();\n const sorted = header.column.getIsSorted();\n const meta = header.column.columnDef.meta as DataGridColumnMeta | undefined;\n const headerKind = kindOf(header.column.id, meta);\n const headerAlign = meta?.align ?? (headerKind === \"number\" ? \"right\" : \"left\");\n const shrink = (headerKind === \"number\" || headerKind === \"date\") && !meta?.maxWidth;\n const at = { r: -1, c };\n const label = flexRender(header.column.columnDef.header, header.getContext());\n // A47: a sortable header holds a button: a Tab stop in a read-only grid, a cell the arrows reach in an editable one\n const inside = canSort ? (\n <button\n type=\"button\"\n onClick={header.column.getToggleSortingHandler()}\n {...(editable ? { \"data-grid-key\": cellKey(at), tabIndex: grid.tabIndexOf(at) } : {})}\n className={cn(\n \"inline-flex items-center gap-ds-1 uppercase tracking-wider cursor-pointer select-none [font:inherit] text-inherit\",\n \"hover:text-[var(--ds-text-primary)] rounded-[var(--ds-radius-sm)]\",\n // in a right-aligned column the indicator goes before the label, so the label ends where the column's values\n // end; the sorted column's label in full colour (the owner's choice at the look check, 14 October)\n headerAlign === \"right\" && \"flex-row-reverse\",\n sorted && \"text-[var(--ds-text-primary)]\",\n FOCUS_RING,\n )}\n >\n {label}\n <SortIndicator sorted={sorted} />\n </button>\n ) : label;\n return (\n <th\n key={header.id}\n role={editable ? \"columnheader\" : undefined}\n aria-sort={sorted === \"asc\" ? \"ascending\" : sorted === \"desc\" ? \"descending\" : undefined}\n {...(editable && !canSort ? { \"data-grid-key\": cellKey(at), tabIndex: grid.tabIndexOf(at) } : {})}\n className={cn(\n \"px-ds-4 py-ds-3 text-xs font-[var(--ds-weight-heading)] uppercase tracking-wider\",\n headerAlign === \"right\" ? \"text-right\" : headerAlign === \"center\" ? \"text-center\" : \"text-left\",\n shrink && \"w-px whitespace-nowrap\",\n \"text-[var(--ds-text-secondary)]\",\n FOCUS_INSET,\n // an editable column's cells keep room for their cue at their end (item 19): its header keeps the same\n editable && meta?.editable !== false && EDIT_CUE_ROOM,\n )}\n style={meta?.maxWidth || meta?.width || meta?.minWidth ? { maxWidth: meta?.maxWidth, width: meta?.width, minWidth: meta?.minWidth } : undefined}\n >\n <span className={cn(\"flex items-center gap-ds-1\", headerAlign === \"right\" && \"justify-end\", headerAlign === \"center\" && \"justify-center\")}>\n {inside}\n </span>\n </th>\n );\n };\n\n return withControl(\n <div data-ds-list=\"\" className=\"min-w-0\">\n <div\n ref={setScrollArea}\n // the scroll area the width switch reads (A35), as the Table's\n data-table-scroll=\"\"\n className={cn(\n \"relative w-full overflow-auto scroll-p-[4px] rounded-[var(--ds-radius-md)]\",\n \"border-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)]\",\n \"shadow-[var(--ds-shadow-card)]\",\n \"bg-[var(--ds-bg-surface)]\",\n )}\n >\n <table\n ref={gridRef}\n role={editable ? \"grid\" : undefined}\n aria-label={ariaLabel}\n onKeyDown={editable ? onGridKeyDown : undefined}\n onFocus={editable ? onGridFocus : undefined}\n className=\"w-full text-sm\"\n >\n <thead className=\"bg-[var(--ds-bg-muted)]\">\n {table.getHeaderGroups().map((hg) => (\n <tr key={hg.id} role={editable ? \"row\" : undefined} className=\"border-b-[length:var(--ds-divider-width)] border-[var(--ds-border-subtle)]\">\n {hg.headers.map((header, c) => headerCell(header, c))}\n </tr>\n ))}\n </thead>\n <tbody><RowsCtx value={true}>\n {rows.map((row, r) => (\n <tr\n key={row.id}\n role={editable ? \"row\" : undefined}\n className={cn(\n \"border-b-[length:var(--ds-divider-width)] border-[var(--ds-border-subtle)] last:border-b-0\",\n \"hover:bg-[var(--ds-bg-muted)] transition-colors\",\n )}\n >\n {row.getVisibleCells().map((cell, c) => {\n const meta = cell.column.columnDef.meta as DataGridColumnMeta | undefined;\n const truncLines = meta?.truncate === true ? 1 : meta?.truncate ? meta.truncate.lines : 0;\n const kind = kindOf(cell.column.id, meta);\n const rendered = flexRender(cell.column.columnDef.cell, cell.getContext() as CellContext<T, unknown>);\n const at = { r, c };\n const isEditing = editable && editing?.row === row.id && editing.c === c;\n\n const shrink = (kind === \"number\" || kind === \"date\") && !meta?.maxWidth;\n // Round 14 (50.2): a centred or right-aligned column lays a block element out with flex — text-align moves inline content only.\n const align = meta?.align ?? (kind === \"number\" ? \"right\" : \"left\");\n let inner: ReactNode;\n if (isEditing) {\n // the library's control for the column's kind, named for its column (CellEditor). The cell keeps its\n // size while it is edited: its value holds the room, unseen, and the editor sits over it, from the\n // cell's start (its end, in a right-aligned column), as wide as its control needs. So no column moves\n // and the row keeps its height (the look check's second round: a number's field had no room in its\n // narrow column, and a date's widened every column)\n inner = (\n <>\n <span aria-hidden=\"true\" className=\"invisible\">{rendered}</span>\n <div className={cn(\n \"absolute inset-y-0 z-30 flex items-center\", EDITOR_WIDTH[editing.editor],\n // from the cell's end in a right-aligned column, and in the last column, where an editor wider\n // than its cell would run past the grid's edge; over the cell before, it stays in view\n align === \"right\" || c === row.getVisibleCells().length - 1 ? \"right-ds-2\" : \"left-ds-2\",\n )}>\n <CellEditor\n editor={editing.editor}\n value={editing.value}\n name={headerText(cell.column.id)}\n options={meta?.options}\n onChange={(v) => setEditing({ ...editing, value: v })}\n onEnd={finishEdit}\n />\n </div>\n </>\n );\n } else if (truncLines > 0) {\n inner = <CutCell lines={truncLines}>{rendered}</CutCell>;\n } else if (kind === \"email\") {\n inner = <CutEmail>{rendered}</CutEmail>;\n } else {\n inner = rendered;\n }\n const value = cell.getValue();\n if (!isEditing && align !== \"left\" && typeof value !== \"string\" && typeof value !== \"number\" && value !== null && value !== undefined) {\n inner = <div className={cn(\"flex items-center\", align === \"center\" ? \"justify-center\" : \"justify-end\")}>{inner}</div>;\n }\n const tick = editable && saved?.ok && saved.row === row.id && saved.c === c\n ? <Icon name=\"check\" size={14} className=\"ml-ds-1 inline-block align-middle text-[var(--ds-status-success)]\" />\n : null;\n\n // item 19: an editable cell says so before it is tried; a calculated or locked one is read-only\n const edits = editable && meta?.editable !== false;\n const least = edits ? editableMinWidth(kind, meta) : undefined;\n return (\n <td\n key={cell.id}\n // a double-click in the open editor selects a word, and never reopens it over what was typed\n {...(editable ? { role: \"gridcell\", \"data-grid-key\": cellKey(at), tabIndex: grid.tabIndexOf(at), onDoubleClick: () => { if (!isEditing) startEdit(at); } } : {})}\n aria-readonly={editable && !edits ? true : undefined}\n className={cn(\n \"px-ds-4 py-ds-3 text-[var(--ds-text-primary)]\",\n align === \"right\" && \"text-right\",\n align === \"center\" && \"text-center\",\n shrink && \"w-px whitespace-nowrap\",\n editable && FOCUS_INSET,\n edits && cn(\"group/cell relative\", EDIT_CUE_ROOM),\n )}\n style={meta?.maxWidth || meta?.width || meta?.minWidth || least ? { maxWidth: meta?.maxWidth, width: meta?.width, minWidth: meta?.minWidth ?? least } : undefined}\n >\n {inner}\n {tick}\n {edits && !isEditing && EDIT_CUE}\n </td>\n );\n })}\n </tr>\n ))}\n </RowsCtx></tbody>\n </table>\n </div>\n {/* A5: a save is heard, politely (WCAG 4.1.3); each one is a new line, so two saves are heard twice */}\n {editable && <div role=\"status\" className=\"sr-only\"><span key={saved?.n ?? 0}>{saved ? (saved.ok ? \"Saved\" : \"Not saved\") : \"\"}</span></div>}\n </div>\n );\n}\n"]}
|
package/dist/editor-mentions.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { matchMentions, shownMentions, mentionOptionId, MentionList } from './chunk-
|
|
3
|
-
import { useOverlayLayer } from './chunk-
|
|
4
|
-
import { useLatest } from './chunk-WIUGPZOH.js';
|
|
2
|
+
import { matchMentions, shownMentions, mentionOptionId, MentionList } from './chunk-ZASGFL5D.js';
|
|
3
|
+
import { useLatest, useOverlayLayer } from './chunk-4HJDOZ2M.js';
|
|
5
4
|
import './chunk-YL5KD5RC.js';
|
|
6
5
|
import { useState, useSyncExternalStore, useId, useRef, useEffect } from 'react';
|
|
7
6
|
import Mention from '@tiptap/extension-mention';
|