@sckyzo/cosmos-charts 0.3.1 → 0.4.1

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.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/HeatGrid.tsx"],"names":["useRef","useState","useLayoutEffect","cell","jsxs","TEXT_SIZE","MUTED","jsx","PANEL","textOn","TEXT","TooltipCard"],"mappings":";;;;;;;;;;AAqEA,IAAM,GAAA,GAAM,CAAA;AACZ,IAAM,MAAA,GAAS,CAAA;AAEf,IAAM,SAAA,GAAY,CAAA;AAElB,IAAM,OAAA,GAAU,CAAA;AAEhB,IAAM,MAAM,CAAC,GAAA,EAAa,WAAmB,CAAA,EAAG,GAAG,IAAI,MAAM,CAAA,CAAA;AAO7D,IAAM,cAAA,GAAiB,CAAC,KAAA,EAAe,GAAA,KAAgB;AACrD,EAAA,MAAM,OAAA,GAAUA,aAAuB,IAAI,CAAA;AAC3C,EAAA,MAAM,QAAA,GAAWA,aAAwB,IAAI,CAAA;AAC7C,EAAA,MAAM,SAAA,GAAYA,aAAuB,IAAI,CAAA;AAC7C,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAIC,eAAS,CAAC,CAAA;AACtC,EAAAC,qBAAA,CAAgB,MAAM;AACpB,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,OAAA,EAAS,WAAA,IAAe,CAAA;AAC/C,MAAA,MAAM,MAAA,GAAS,SAAA,CAAU,OAAA,EAAS,WAAA,IAAe,CAAA;AACjD,MAAA,SAAA,CAAU,MAAA,GAAS,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,IAAA,CAAK,IAAA,CAAA,CAAM,KAAA,GAAQ,SAAA,KAAc,MAAA,GAAS,GAAA,CAAI,CAAC,IAAI,CAAC,CAAA;AAAA,IACzF,CAAA;AACA,IAAA,IAAA,EAAK;AACL,IAAA,MAAM,QAAA,G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AEzE,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAGF,EAAA,uBACEH,eAAA,CAAC,KAAA,EAAA,EAAI,GAAA,EAAK,KAAA,EAAO,OAAO,EAAE,QAAA,EAAU,UAAA,EAAY,KAAA,EAAO,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,QAAA,EAAU,GAAE,EACxF,QAAA,EAAA;AAAA,IAAA,WAAA;AAAA;AAAA;AAAA,sBAGCG,cAAA,CAAC,KAAA,EAAA,EAAI,kBAAA,EAAiB,EAAA,EAAG,KAAA,EAAO,EAAE,SAAA,EAAW,MAAA,EAAQ,OAAA,EAAS,CAAA,EAAE,EAC7D,QAAA,EAAA,IAAA,EACH;AAAA,QAEA,IAAA;AAAA,IAED,GAAA,IAAO,4BACNA,cAAA,CAAC,KAAA,EAAA,EAAI,qBAAkB,EAAA,EAAG,aAAA,EAAW,IAAA,EAAC,KAAA,EAAO,QAAA,EAC3C,QAAA,kBAAAA,cAAA;AAAA,MAACI,6BAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,IAAI,IAAA,CAAK,KAAA;AAAA,QAChB,IAAA,EAAM,CAAC,EAAE,IAAA,EAAM,IAAI,IAAA,CAAK,KAAA,EAAO,KAAA,EAAO,GAAA,CAAI,KAAK,KAAA,EAAO,KAAA,EAAO,GAAA,CAAI,IAAA,CAAK,OAAO;AAAA;AAAA,KAC/E,EACF;AAAA,GAAA,EAEJ,CAAA;AAEJ","file":"chunk-ZWHCUYIN.cjs","sourcesContent":["import {\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent,\n} from 'react';\nimport { TEXT_SIZE } from './axes';\nimport { TooltipCard } from './ChartTooltip';\nimport { MUTED, PANEL, TEXT } from './colors';\nimport { textOn } from './readable';\n\n/** One cell of a `HeatGrid`. A slot with no cell stays empty. */\nexport type HeatCell = {\n /** Zero-based position: the index in `rows` and in `columns`. */\n row: number;\n column: number;\n /** Any CSS color. The text printed in the cell reads on it. */\n color: string;\n /** Heads the tooltip, such as the column's category. */\n title: string;\n /** Names the cell in the tooltip, such as the row. May be empty when the value says it all. */\n label: string;\n /** The value, formatted: the tooltip's value, and the end of the cell's accessible name. */\n value: string;\n /** Printed inside the cell. */\n text?: string;\n};\n\ntype HeatGridProps = {\n /** The label of each row, top to bottom. An empty string leaves the row unlabelled. */\n rows: readonly string[];\n /** The label of each column, left to right. Too many for the width: every n-th one is drawn. */\n columns: readonly string[];\n cells: readonly HeatCell[];\n /**\n * Height of a row in px. Without it the rows share the height of the\n * parent, which must then have one.\n */\n cellHeight?: number;\n /** Names the grid for screen readers. */\n ariaLabel: string;\n /** Title under the columns. Drawn as plain text. */\n xTitle?: string;\n /** Title beside the rows. Drawn as plain text. */\n yTitle?: string;\n /** Space between two cells in px. Default 3. */\n gap?: number;\n /** Corner radius of a cell in px. Default 5. */\n cellRadius?: number;\n /**\n * Width of a column in px. Without it the columns share the width of the\n * parent; with it they keep this width, and the grid scrolls sideways inside\n * its own box when it is wider than the parent. The row labels stay in view.\n */\n columnWidth?: number;\n /** Draw the column labels above the rows instead of under them. */\n labelsAbove?: boolean;\n /**\n * Draw every column label, as given. By default the labels are centered on\n * their column and every n-th one is drawn so that none touches the next.\n * Off, each starts at the left of its column and may run over the columns\n * after it, which an empty label leaves free: for labels such as the months\n * of a calendar, where the caller decides which columns carry one.\n */\n thinLabels?: boolean;\n};\n\nconst GAP = 3;\nconst RADIUS = 5;\n// Clear space kept between two column labels.\nconst LABEL_GAP = 6;\n// Room the tooltip card leaves the pointer or the cell.\nconst TIP_GAP = 6;\n\nconst key = (row: number, column: number) => `${row}:${column}`;\n\n/**\n * How many columns apart the labels are drawn so that none touches the next:\n * 1 when they all fit. Measured on the page, since the text size, the font and\n * the width all change it.\n */\nconst useLabelStride = (probe: string, gap: number) => {\n const gridRef = useRef<HTMLDivElement>(null);\n const probeRef = useRef<HTMLSpanElement>(null);\n const columnRef = useRef<HTMLDivElement>(null);\n const [stride, setStride] = useState(1);\n useLayoutEffect(() => {\n const read = () => {\n const label = probeRef.current?.offsetWidth ?? 0;\n const column = columnRef.current?.offsetWidth ?? 0;\n setStride(column > 0 ? Math.max(1, Math.ceil((label + LABEL_GAP) / (column + gap))) : 1);\n };\n read();\n const observer = new ResizeObserver(read);\n for (const el of [gridRef.current, probeRef.current]) if (el) observer.observe(el);\n return () => observer.disconnect();\n }, [probe, gap]);\n return { gridRef, probeRef, columnRef, stride };\n};\n\ntype Tip = {\n cell: HeatCell;\n /** Where the card is anchored, in px from the grid's corner, and on which side of the cell. */\n x: number;\n top: number;\n bottom: number;\n align: 'start' | 'center' | 'end';\n below: boolean;\n};\n\n/**\n * A grid of colored cells with row and column labels: the drawing of\n * `HeatmapChart`, and of any chart laid out as rows and columns. Recharts has\n * no such chart, so it is plain HTML in a CSS grid, which sizes the label\n * column to the text (it follows the text size) and the cells to the width.\n *\n * Keyboard: the grid is one tab stop (a roving tabindex), and the arrow keys\n * move between cells, skipping empty slots; Home and End go to the ends of the\n * row, Ctrl+Home and Ctrl+End to the first and last cell. The cell under the\n * pointer or the keyboard shows its tooltip. Each cell is named\n * `label, title: value`, so a screen reader reads what the tooltip says.\n */\nexport const HeatGrid = ({\n rows,\n columns,\n cells,\n cellHeight,\n ariaLabel,\n xTitle,\n yTitle,\n gap = GAP,\n cellRadius = RADIUS,\n columnWidth,\n labelsAbove = false,\n thinLabels = true,\n}: HeatGridProps) => {\n const frame = useRef<HTMLDivElement>(null);\n const longest = columns.reduce((a, b) => (b.length > a.length ? b : a), '');\n const { gridRef, probeRef, columnRef, stride: measured } = useLabelStride(longest, gap);\n const stride = thinLabels ? measured : 1;\n const byPosition = new Map(cells.map((cell) => [key(cell.row, cell.column), cell]));\n const cellsByRow = new Map<number, HeatCell[]>();\n for (const cell of cells) cellsByRow.set(cell.row, [...(cellsByRow.get(cell.row) ?? []), cell]);\n const inReadingOrder = [...cells].sort((a, b) => a.row - b.row || a.column - b.column);\n const [roving, setRoving] = useState<string>();\n // The cell that takes Tab: the last one focused, while it is still there.\n const first = inReadingOrder[0];\n const tabbable =\n roving && byPosition.has(roving) ? roving : first && key(first.row, first.column);\n const [hover, setHover] = useState<Tip>();\n const [focus, setFocus] = useState<Tip>();\n const tip = hover ?? focus;\n\n const tipFor = (cell: HeatCell, element: HTMLElement): Tip => {\n const host = (frame.current as HTMLElement).getBoundingClientRect();\n const box = element.getBoundingClientRect();\n const middle = box.left - host.left + box.width / 2;\n // The card hangs from the side of the cell nearest the middle of the grid,\n // so it never leaves the grid.\n const align =\n middle < host.width / 3 ? 'start' : middle > (2 * host.width) / 3 ? 'end' : 'center';\n return {\n cell,\n x: { start: box.left - host.left, center: middle, end: box.right - host.left }[align],\n top: box.top - host.top,\n bottom: box.bottom - host.top,\n align,\n // Not enough room above the cell for the card: it goes under.\n below: box.top - host.top < 90,\n };\n };\n\n const move = (event: KeyboardEvent<HTMLDivElement>) => {\n const origin = (event.target as HTMLElement).closest<HTMLElement>('[data-heat-cell]');\n if (!origin) return;\n const row = Number(origin.dataset.row);\n const column = Number(origin.dataset.column);\n // The next cell in a direction: empty slots are skipped, the edge stops.\n const step = (dRow: number, dColumn: number) => {\n for (\n let r = row + dRow, c = column + dColumn;\n r >= 0 && r < rows.length && c >= 0 && c < columns.length;\n r += dRow, c += dColumn\n ) {\n if (byPosition.has(key(r, c))) return key(r, c);\n }\n };\n const edge = (last: boolean) => {\n const pool = event.ctrlKey\n ? inReadingOrder\n : inReadingOrder.filter((cell) => cell.row === row);\n const cell = last ? pool.at(-1) : pool[0];\n return cell && key(cell.row, cell.column);\n };\n const targets: Record<string, () => string | undefined> = {\n ArrowRight: () => step(0, 1),\n ArrowLeft: () => step(0, -1),\n ArrowDown: () => step(1, 0),\n ArrowUp: () => step(-1, 0),\n Home: () => edge(false),\n End: () => edge(true),\n };\n const target = targets[event.key];\n if (!target) return;\n event.preventDefault();\n const next = target();\n if (next) gridRef.current?.querySelector<HTMLElement>(`[data-position=\"${next}\"]`)?.focus();\n };\n\n const focusIn = (cell: HeatCell, event: FocusEvent<HTMLElement>) => {\n setRoving(key(cell.row, cell.column));\n // A click focuses a cell too, and would leave its tooltip up: only the keyboard shows it.\n if (event.currentTarget.matches(':focus-visible')) {\n setFocus(tipFor(cell, event.currentTarget));\n }\n };\n const focusOut = (event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget)) setFocus(undefined);\n };\n\n const rowOffset = yTitle ? 2 : 1;\n // The rows start under the labels when these sit above them.\n const top = labelsAbove ? 1 : 0;\n const labelsRow = labelsAbove ? 1 : rows.length + 1;\n const tipStyle: CSSProperties | undefined = tip && {\n position: 'absolute',\n left: tip.x,\n top: tip.below ? tip.bottom + TIP_GAP : tip.top - TIP_GAP,\n transform: `translate(${{ start: '0', center: '-50%', end: '-100%' }[tip.align]}, ${tip.below ? '0' : '-100%'})`,\n zIndex: 10,\n pointerEvents: 'none',\n };\n\n const grid = (\n <div\n ref={gridRef}\n role=\"grid\"\n aria-label={ariaLabel}\n onKeyDown={move}\n onBlur={focusOut}\n style={{\n display: 'grid',\n gridTemplateColumns: `${yTitle ? 'auto ' : ''}${columnWidth ? 'auto' : 'fit-content(40%)'} repeat(${columns.length}, ${columnWidth ? `${columnWidth}px` : 'minmax(0, 1fr)'})`,\n gridTemplateRows: `${labelsAbove ? 'auto ' : ''}repeat(${rows.length}, ${cellHeight ? `${cellHeight}px` : 'minmax(0, 1fr)'})${labelsAbove ? '' : ' auto'}${xTitle ? ' auto' : ''}`,\n gap,\n width: columnWidth ? 'max-content' : '100%',\n height: cellHeight ? undefined : '100%',\n fontSize: TEXT_SIZE,\n color: MUTED,\n }}\n >\n {yTitle && (\n <div\n aria-hidden\n style={{\n gridRow: `${1 + top} / ${rows.length + 1 + top}`,\n gridColumn: 1,\n writingMode: 'vertical-rl',\n transform: 'rotate(180deg)',\n textAlign: 'center',\n alignSelf: 'center',\n }}\n >\n {yTitle}\n </div>\n )}\n {rows.map((name, r) => (\n <div key={r} role=\"row\" style={{ display: 'contents' }}>\n <div\n aria-hidden\n data-heat-row=\"\"\n style={{\n gridRow: r + 1 + top,\n gridColumn: rowOffset,\n alignSelf: 'center',\n paddingRight: '0.5rem',\n // Stays in view when the grid scrolls sideways under it.\n ...(columnWidth ? { position: 'sticky', left: 0, zIndex: 2, background: PANEL } : {}),\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n }}\n >\n {name}\n </div>\n {(cellsByRow.get(r) ?? []).map((cell) => {\n const position = key(cell.row, cell.column);\n const active = tip?.cell === cell;\n return (\n <div\n key={position}\n role=\"gridcell\"\n data-heat-cell=\"\"\n data-position={position}\n data-row={cell.row}\n data-column={cell.column}\n tabIndex={position === tabbable ? 0 : -1}\n aria-label={`${cell.label ? `${cell.label}, ` : ''}${cell.title}: ${cell.value}`}\n onFocus={(event) => focusIn(cell, event)}\n onMouseEnter={(event) => setHover(tipFor(cell, event.currentTarget))}\n onMouseLeave={() => setHover(undefined)}\n style={{\n gridRow: r + 1 + top,\n gridColumn: cell.column + rowOffset + 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: 0,\n overflow: 'hidden',\n borderRadius: cellRadius,\n background: cell.color,\n color: textOn(cell.color),\n fontSize: 'var(--text-2xs, 0.6875rem)',\n fontWeight: 500,\n lineHeight: 1,\n whiteSpace: 'nowrap',\n // The same ring for the pointer and the keyboard, in the text color\n // since an accent ring would vanish on the cells that are the accent.\n outline: active ? `2px solid ${TEXT}` : 'none',\n zIndex: active ? 1 : undefined,\n }}\n >\n {cell.text}\n </div>\n );\n })}\n </div>\n ))}\n {columns.map((name, c) => (\n <div\n key={c}\n ref={c === 0 ? columnRef : undefined}\n aria-hidden\n data-heat-column=\"\"\n style={{\n gridRow: labelsRow,\n gridColumn: c + rowOffset + 1,\n display: 'flex',\n justifyContent: thinLabels ? 'center' : 'flex-start',\n whiteSpace: 'nowrap',\n minWidth: 0,\n }}\n >\n {c % stride === 0 ? name : null}\n </div>\n ))}\n {xTitle && (\n <div\n aria-hidden\n style={{\n gridRow: (labelsAbove ? rows.length + 1 : labelsRow) + 1,\n gridColumn: `${rowOffset + 1} / -1`,\n textAlign: 'center',\n }}\n >\n {xTitle}\n </div>\n )}\n <span\n ref={probeRef}\n aria-hidden\n style={{ position: 'absolute', visibility: 'hidden', whiteSpace: 'nowrap' }}\n >\n {longest}\n </span>\n </div>\n );\n\n return (\n <div ref={frame} style={{ position: 'relative', width: '100%', height: '100%', minWidth: 0 }}>\n {columnWidth ? (\n // The padding leaves room for the focus outline of the cells at the edges,\n // which the scrolling box would cut.\n <div data-heat-scroll=\"\" style={{ overflowX: 'auto', padding: 3 }}>\n {grid}\n </div>\n ) : (\n grid\n )}\n {tip && tipStyle && (\n <div data-heat-tooltip=\"\" aria-hidden style={tipStyle}>\n <TooltipCard\n title={tip.cell.title}\n rows={[{ name: tip.cell.label, value: tip.cell.value, color: tip.cell.color }]}\n />\n </div>\n )}\n </div>\n );\n};\n"]}