@hjmds/react 1.47.0 → 1.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced-display.d.ts +3 -1
- package/dist/advanced-display.d.ts.map +1 -1
- package/dist/advanced-display.js +23 -15
- package/dist/advanced-display.js.map +1 -1
- package/dist/display.d.ts +4 -0
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js +3 -3
- package/dist/display.js.map +1 -1
- package/dist/drawing-editor.d.ts +7 -0
- package/dist/drawing-editor.d.ts.map +1 -0
- package/dist/drawing-editor.js +123 -0
- package/dist/drawing-editor.js.map +1 -0
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +1 -1
- package/dist/evidence.js.map +1 -1
- package/dist/image-choice.js +2 -1
- package/dist/image-choice.js.map +1 -1
- package/dist/overlays.d.ts.map +1 -1
- package/dist/overlays.js +81 -2
- package/dist/overlays.js.map +1 -1
- package/dist/public-exports.generated.d.ts +2 -0
- package/dist/public-exports.generated.d.ts.map +1 -1
- package/dist/public-exports.generated.js +6 -0
- package/dist/public-exports.generated.js.map +1 -1
- package/dist/share-sheet.d.ts +65 -0
- package/dist/share-sheet.d.ts.map +1 -0
- package/dist/share-sheet.js +145 -0
- package/dist/share-sheet.js.map +1 -0
- package/dist/styles.css +37 -3
- package/dist/styles.layered.css +37 -3
- package/dist/table-family.js +1 -1
- package/dist/table-family.js.map +1 -1
- package/package.json +13 -3
package/dist/table-family.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-family.js","sourceRoot":"","sources":["../src/table-family.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,EAAsC,MAAM,OAAO,CAAC;AAEpF,OAAO,EACL,qBAAqB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,GAElG,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,UAA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Q,EACxH,eAAK,SAAS,EAAC,8BAA8B,iBAAa,MAAM,aAC9D,2BAAgB,MAAM,KAAK,CAAC,IAAI,SAAS,YAAG,KAAK,CAAC,CAAC,CAAC,GAAQ,EAC5D,eAAM,SAAS,EAAC,6BAA6B,YAAE,GAAG,CAAC,KAAK,GAAQ,EAChE,2BAAgB,MAAM,KAAK,CAAC,IAAI,SAAS,YAAG,KAAK,CAAC,CAAC,CAAC,GAAQ,IACxD,EACN,cAAK,SAAS,EAAC,4BAA4B,iBAAa,MAAM,YAC1D,CAAC,CAAC,EAAE,CAAC,CAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAChC,eAAkB,SAAS,EAAC,6BAA6B,eAAY,KAAK,YACxE,eACE,SAAS,EAAC,2BAA2B,EACrC,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAC1J,IAJO,KAAK,CAKT,CACR,CAAC,GACE,KAjBC,GAAG,CAAC,EAAE,CAkBV,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,IACG,CACX,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { useLayoutEffect, useRef, type CSSProperties, type ReactNode } from \"react\";\nimport type { ColorReference } from \"@hjmds/design-contracts/color-references\";\nimport {\n dataTableFamilyRecipe, formatLineScoreCell, resolveComparisonRow, resolveLineScore, resolveMatrix,\n type ComparisonRow, type DataTableCellHeat, type DataTableCellTone, type LineScoreTeam, type MatrixCell,\n} from \"@hjmds/design-contracts/components/data-table\";\nimport { classNames } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\n/*\n * Table family companions (2026-10-14): layouts products kept hand-building next to DataTable.\n * LineScore follows MLB/ESPN game headers, MatrixTable a head-to-head cross table, ComparisonTable\n * the ESPN matchup rows. Geometry and rules live in the data-table contract; these only draw.\n */\n\nfunction kebab(value: string): string {\n return value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\n/** Recipe colors resolve through the provider's CSS variables so a theme switch repaints without re-rendering (same as Chart). */\nexport function tableCssColor(reference: ColorReference): string {\n const name = reference.source === \"theme\"\n ? `--hjm-color-${kebab(reference.key)}`\n : reference.source === \"accent\" ? `--hjm-accent-${kebab(reference.key)}` : `--hjm-accent-fill-${kebab(reference.key)}`;\n return reference.alpha === undefined || reference.alpha === 1\n ? `var(${name})`\n : `color-mix(in srgb, var(${name}) ${Math.round(reference.alpha * 100)}%, transparent)`;\n}\n\n/** Live period and \"my team\" row share the family highlight tint. */\nconst familyStyle = { \"--hjm-table-family-selected\": tableCssColor(dataTableFamilyRecipe.highlight.background) } as CSSProperties;\nconst withFamilyStyle = (layoutStyle: HjmCompositionStyleProp | undefined) => ({ ...familyStyle, ...layoutStyle }) as CSSProperties;\n\nexport type TableHeatColors = Readonly<{ high: string; low: string }>;\n\n/**\n * Cell emphasis as inline style. Heat paints a background *image* so pinned cells keep their opaque\n * canvas color underneath and scrolled content never shows through the translucent tint.\n */\nexport function tableCellEmphasis(\n decoration: Readonly<{ tone?: DataTableCellTone | null; heat?: DataTableCellHeat | null }> | null | undefined,\n heatColors?: TableHeatColors,\n): Readonly<{ style: CSSProperties; tone?: DataTableCellTone; heat?: string }> {\n if (!decoration) return { style: {} };\n const style: Record<string, string | number> = {};\n const tone = decoration.tone ?? undefined, heat = decoration.heat ?? null;\n if (tone) {\n style.color = tableCssColor(dataTableFamilyRecipe.tone[tone].color);\n style.fontWeight = dataTableFamilyRecipe.tone[tone].fontWeight;\n }\n if (heat) {\n const base = heatColors?.[heat.side] ?? tableCssColor(dataTableFamilyRecipe.heat[heat.side]);\n style[\"--hjm-data-table-heat\"] = `color-mix(in srgb, ${base} ${Math.round(dataTableFamilyRecipe.heatAlpha[heat.strength] * 100)}%, transparent)`;\n }\n return { style: style as CSSProperties, ...(tone ? { tone } : {}), ...(heat ? { heat: `${heat.side}-${heat.strength}` } : {}) };\n}\n\n/* ---------------------------------------------- Line score ------------------------------------- */\n\n/**\n * Team and total columns stay pinned while only the periods scroll, as on Native: at 402px the totals — the result —\n * scrolled off with the extra innings (2026-10-17 review E17). Totals have a fixed width so each can pin at its offset.\n */\nconst totalOffset = (count: number, index: number): CSSProperties => ({ insetInlineEnd: `calc(var(--hjm-line-score-total-width) * ${count - 1 - index})` });\n\nexport type LineScoreProps = Readonly<{\n teams: readonly LineScoreTeam[];\n /** Total column headers in order, e.g. [\"R\", \"H\", \"E\", \"B\"]. The first one decides the leader. */\n totals: readonly string[];\n /** Live period (1-based) to highlight. */\n currentPeriod?: number | null;\n minPeriods?: number;\n /** Optional leading content per team (logo/badge). */\n renderTeam?: (team: LineScoreTeam) => ReactNode;\n /** Accessible name of the table (prop name kept for Native parity). */\n accessibilityLabel: string;\n className?: string;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport function LineScore({ teams, totals, currentPeriod = null, minPeriods, renderTeam, accessibilityLabel, className, layoutStyle }: LineScoreProps) {\n const score = resolveLineScore(teams, { totals, currentPeriod, ...(minPeriods !== undefined ? { minPeriods } : {}) });\n const periods = score.columns.filter((column) => column.kind === \"period\");\n const totalColumns = score.columns.filter((column) => column.kind === \"total\");\n // Open the period strip at the live (or latest) period, as Native: starting at inning 1 hid extra innings behind the\n // pinned totals and read as a shorter game (2026-10-17 review N4). scroll-padding keeps it clear of the totals.\n const host = useRef<HTMLDivElement>(null);\n const focusPeriod = score.currentPeriod ?? periods.length;\n useLayoutEffect(() => {\n const container = host.current;\n if (!container || container.scrollWidth <= container.clientWidth) return;\n container.querySelector<HTMLElement>(`thead [data-period=\"${focusPeriod}\"]`)?.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }, [focusPeriod, periods.length]);\n return (\n <div ref={host} className={classNames(\"hjm-table-family\", \"hjm-line-score\", className)} style={{ ...withFamilyStyle(layoutStyle), \"--hjm-line-score-total-count\": totalColumns.length } as CSSProperties}>\n <table className=\"hjm-line-score__table\" aria-label={accessibilityLabel}>\n <thead>\n <tr>\n <td className=\"hjm-line-score__team\" />\n {periods.map((column, index) => {\n const live = score.currentPeriod === index + 1;\n return <th key={column.id} scope=\"col\" className=\"hjm-line-score__period\" data-period={index + 1} aria-current={live ? \"true\" : undefined} data-current={live || undefined}>{column.header}</th>;\n })}\n {totalColumns.map((column, index) => (\n <th key={column.id} scope=\"col\" className={classNames(\"hjm-line-score__total\", index === 0 && \"hjm-line-score__total-edge\")} style={totalOffset(totalColumns.length, index)}>{column.header}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {teams.map((team) => (\n <tr key={team.id} data-leader={score.leaderId === team.id || undefined}>\n <th scope=\"row\" className=\"hjm-line-score__team\">\n <span className=\"hjm-line-score__team-content\">{renderTeam?.(team)}<span>{team.name}</span></span>\n </th>\n {periods.map((column, index) => {\n const value = team.periods[index];\n return <td key={column.id} className=\"hjm-line-score__period\" data-current={score.currentPeriod === index + 1 || undefined} data-scored={typeof value === \"number\" && value > 0 || undefined}>{formatLineScoreCell(value)}</td>;\n })}\n {totalColumns.map((column, index) => (\n <td key={column.id} className={classNames(\"hjm-line-score__total\", index === 0 && \"hjm-line-score__total-edge\")} style={totalOffset(totalColumns.length, index)}>{team.totals[column.header] ?? \"—\"}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\n/* ---------------------------------------------- Matrix table ----------------------------------- */\n\nexport type MatrixTableProps<Key extends string = string> = Readonly<{\n ids: readonly Key[];\n /** Short header per id (team short name). */\n labelOf: (id: Key) => string;\n getCell: (row: Key, column: Key) => MatrixCell | null;\n /** Row id to highlight (my team). */\n highlightId?: Key | null;\n heatColors?: TableHeatColors;\n accessibilityLabel: string;\n className?: string;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport function MatrixTable<Key extends string = string>({ ids, labelOf, getCell, highlightId = null, heatColors, accessibilityLabel, className, layoutStyle }: MatrixTableProps<Key>) {\n const matrix = resolveMatrix(ids, getCell);\n return (\n <div className={classNames(\"hjm-table-family\", \"hjm-matrix-table\", className)} style={withFamilyStyle(layoutStyle)}>\n <table className=\"hjm-matrix-table__table\" aria-label={accessibilityLabel}>\n <thead>\n <tr>\n <td className=\"hjm-matrix-table__corner\" />\n {ids.map((id) => <th key={id} scope=\"col\">{labelOf(id)}</th>)}\n </tr>\n </thead>\n <tbody>\n {matrix.map((cells, rowIndex) => {\n const rowId = ids[rowIndex]!;\n return (\n <tr key={rowId} data-highlighted={rowId === highlightId || undefined}>\n <th scope=\"row\">{labelOf(rowId)}</th>\n {cells.map((cell, columnIndex) => {\n // The diagonal is a team against itself: blank and hidden, not \"no record\".\n if (cell === \"self\") return <td key={ids[columnIndex]} className=\"hjm-matrix-table__self\" aria-hidden=\"true\" />;\n const emphasis = tableCellEmphasis(cell, heatColors);\n return <td key={ids[columnIndex]} className={emphasis.heat ? \"hjm-table-family__heat\" : undefined} style={emphasis.style} data-tone={emphasis.tone} data-heat={emphasis.heat}>{cell?.label ?? \"—\"}</td>;\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\n/* ---------------------------------------------- Comparison table ------------------------------- */\n\nexport type ComparisonTableProps = Readonly<{\n rows: readonly ComparisonRow[];\n /** Side names and accent colors (team colors). */\n sides: readonly [Readonly<{ name: string; color: string }>, Readonly<{ name: string; color: string }>];\n /** Hide duplicate visual names when the two sides are already identified above; spoken row labels retain them. */\n showSideNames?: boolean;\n accessibilityLabel: string;\n className?: string;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport function ComparisonTable({ rows, sides, showSideNames = true, accessibilityLabel, className, layoutStyle }: ComparisonTableProps) {\n return (\n <section className={classNames(\"hjm-table-family\", \"hjm-comparison-table\", className)} style={withFamilyStyle(layoutStyle)} aria-label={accessibilityLabel}>\n {showSideNames && <div className=\"hjm-comparison-table__sides\" aria-hidden=\"true\">\n {sides.map((side, index) => <span key={index} style={{ color: side.color }}>{side.name}</span>)}\n </div>}\n <ul className=\"hjm-comparison-table__rows\" role=\"list\">\n {rows.map((row) => {\n const { winner, shares } = resolveComparisonRow(row);\n const shown = row.display ?? [row.values[0] === null ? \"—\" : String(row.values[0]), row.values[1] === null ? \"—\" : String(row.values[1])];\n return (\n <li key={row.id} className=\"hjm-comparison-table__row\" data-winner={winner ?? undefined}>\n {/* One sentence for assistive tech; the visual grid and bars are decoration. */}\n <span className=\"hjm-visually-hidden\">{`${row.label} ${sides[0].name} ${shown[0]}, ${sides[1].name} ${shown[1]}`}</span>\n <div className=\"hjm-comparison-table__values\" aria-hidden=\"true\">\n <span data-win={winner === 0 || undefined}>{shown[0]}</span>\n <span className=\"hjm-comparison-table__label\">{row.label}</span>\n <span data-win={winner === 1 || undefined}>{shown[1]}</span>\n </div>\n <div className=\"hjm-comparison-table__bars\" aria-hidden=\"true\">\n {([0, 1] as const).map((index) => (\n <span key={index} className=\"hjm-comparison-table__track\" data-side={index}>\n <span\n className=\"hjm-comparison-table__bar\"\n style={{ inlineSize: `${Math.round(shares[index] * 1000) / 10}%`, background: sides[index].color, opacity: winner === null || winner === index ? 1 : 0.6 }}\n />\n </span>\n ))}\n </div>\n </li>\n );\n })}\n </ul>\n </section>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"table-family.js","sourceRoot":"","sources":["../src/table-family.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,EAAsC,MAAM,OAAO,CAAC;AAEpF,OAAO,EACL,qBAAqB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,GAElG,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,e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C,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,GAAQ,EACxH,eAAK,SAAS,EAAC,8BAA8B,iBAAa,MAAM,aAC9D,2BAAgB,MAAM,KAAK,CAAC,IAAI,SAAS,YAAG,KAAK,CAAC,CAAC,CAAC,GAAQ,EAC5D,eAAM,SAAS,EAAC,6BAA6B,YAAE,GAAG,CAAC,KAAK,GAAQ,EAChE,2BAAgB,MAAM,KAAK,CAAC,IAAI,SAAS,YAAG,KAAK,CAAC,CAAC,CAAC,GAAQ,IACxD,EACN,cAAK,SAAS,EAAC,4BAA4B,iBAAa,MAAM,YAC1D,CAAC,CAAC,EAAE,CAAC,CAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAChC,eAAkB,SAAS,EAAC,6BAA6B,eAAY,KAAK,YACxE,eACE,SAAS,EAAC,2BAA2B,EACrC,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAC1J,IAJO,KAAK,CAKT,CACR,CAAC,GACE,KAjBC,GAAG,CAAC,EAAE,CAkBV,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,IACG,CACX,CAAC;AACJ,CAAC","sourcesContent":["\"use client\";\n\nimport { useLayoutEffect, useRef, type CSSProperties, type ReactNode } from \"react\";\nimport type { ColorReference } from \"@hjmds/design-contracts/color-references\";\nimport {\n dataTableFamilyRecipe, formatLineScoreCell, resolveComparisonRow, resolveLineScore, resolveMatrix,\n type ComparisonRow, type DataTableCellHeat, type DataTableCellTone, type LineScoreTeam, type MatrixCell,\n} from \"@hjmds/design-contracts/components/data-table\";\nimport { classNames } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\n/*\n * Table family companions (2026-10-14): layouts products kept hand-building next to DataTable.\n * LineScore follows MLB/ESPN game headers, MatrixTable a head-to-head cross table, ComparisonTable\n * the ESPN matchup rows. Geometry and rules live in the data-table contract; these only draw.\n */\n\nfunction kebab(value: string): string {\n return value.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\n/** Recipe colors resolve through the provider's CSS variables so a theme switch repaints without re-rendering (same as Chart). */\nexport function tableCssColor(reference: ColorReference): string {\n const name = reference.source === \"theme\"\n ? `--hjm-color-${kebab(reference.key)}`\n : reference.source === \"accent\" ? `--hjm-accent-${kebab(reference.key)}` : `--hjm-accent-fill-${kebab(reference.key)}`;\n return reference.alpha === undefined || reference.alpha === 1\n ? `var(${name})`\n : `color-mix(in srgb, var(${name}) ${Math.round(reference.alpha * 100)}%, transparent)`;\n}\n\n/** Live period and \"my team\" row share the family highlight tint. */\nconst familyStyle = { \"--hjm-table-family-selected\": tableCssColor(dataTableFamilyRecipe.highlight.background) } as CSSProperties;\nconst withFamilyStyle = (layoutStyle: HjmCompositionStyleProp | undefined) => ({ ...familyStyle, ...layoutStyle }) as CSSProperties;\n\nexport type TableHeatColors = Readonly<{ high: string; low: string }>;\n\n/**\n * Cell emphasis as inline style. Heat paints a background *image* so pinned cells keep their opaque\n * canvas color underneath and scrolled content never shows through the translucent tint.\n */\nexport function tableCellEmphasis(\n decoration: Readonly<{ tone?: DataTableCellTone | null; heat?: DataTableCellHeat | null }> | null | undefined,\n heatColors?: TableHeatColors,\n): Readonly<{ style: CSSProperties; tone?: DataTableCellTone; heat?: string }> {\n if (!decoration) return { style: {} };\n const style: Record<string, string | number> = {};\n const tone = decoration.tone ?? undefined, heat = decoration.heat ?? null;\n if (tone) {\n style.color = tableCssColor(dataTableFamilyRecipe.tone[tone].color);\n style.fontWeight = dataTableFamilyRecipe.tone[tone].fontWeight;\n }\n if (heat) {\n const base = heatColors?.[heat.side] ?? tableCssColor(dataTableFamilyRecipe.heat[heat.side]);\n style[\"--hjm-data-table-heat\"] = `color-mix(in srgb, ${base} ${Math.round(dataTableFamilyRecipe.heatAlpha[heat.strength] * 100)}%, transparent)`;\n }\n return { style: style as CSSProperties, ...(tone ? { tone } : {}), ...(heat ? { heat: `${heat.side}-${heat.strength}` } : {}) };\n}\n\n/* ---------------------------------------------- Line score ------------------------------------- */\n\n/**\n * Team and total columns stay pinned while only the periods scroll, as on Native: at 402px the totals — the result —\n * scrolled off with the extra innings (2026-10-17 review E17). Totals have a fixed width so each can pin at its offset.\n */\nconst totalOffset = (count: number, index: number): CSSProperties => ({ insetInlineEnd: `calc(var(--hjm-line-score-total-width) * ${count - 1 - index})` });\n\nexport type LineScoreProps = Readonly<{\n teams: readonly LineScoreTeam[];\n /** Total column headers in order, e.g. [\"R\", \"H\", \"E\", \"B\"]. The first one decides the leader. */\n totals: readonly string[];\n /** Live period (1-based) to highlight. */\n currentPeriod?: number | null;\n minPeriods?: number;\n /** Optional leading content per team (logo/badge). */\n renderTeam?: (team: LineScoreTeam) => ReactNode;\n /** Accessible name of the table (prop name kept for Native parity). */\n accessibilityLabel: string;\n className?: string;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport function LineScore({ teams, totals, currentPeriod = null, minPeriods, renderTeam, accessibilityLabel, className, layoutStyle }: LineScoreProps) {\n const score = resolveLineScore(teams, { totals, currentPeriod, ...(minPeriods !== undefined ? { minPeriods } : {}) });\n const periods = score.columns.filter((column) => column.kind === \"period\");\n const totalColumns = score.columns.filter((column) => column.kind === \"total\");\n // Open the period strip at the live (or latest) period, as Native: starting at inning 1 hid extra innings behind the\n // pinned totals and read as a shorter game (2026-10-17 review N4). scroll-padding keeps it clear of the totals.\n const host = useRef<HTMLDivElement>(null);\n const focusPeriod = score.currentPeriod ?? periods.length;\n useLayoutEffect(() => {\n const container = host.current;\n if (!container || container.scrollWidth <= container.clientWidth) return;\n container.querySelector<HTMLElement>(`thead [data-period=\"${focusPeriod}\"]`)?.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n }, [focusPeriod, periods.length]);\n return (\n <div ref={host} className={classNames(\"hjm-table-family\", \"hjm-line-score\", className)} style={{ ...withFamilyStyle(layoutStyle), \"--hjm-line-score-current-background\": tableCssColor(dataTableFamilyRecipe.currentPeriod.background), \"--hjm-line-score-current-color\": tableCssColor(dataTableFamilyRecipe.currentPeriod.color), \"--hjm-line-score-total-count\": totalColumns.length } as CSSProperties}>\n <table className=\"hjm-line-score__table\" aria-label={accessibilityLabel}>\n <thead>\n <tr>\n <td className=\"hjm-line-score__team\" />\n {periods.map((column, index) => {\n const live = score.currentPeriod === index + 1;\n return <th key={column.id} scope=\"col\" className=\"hjm-line-score__period\" data-period={index + 1} aria-current={live ? \"true\" : undefined} data-current={live || undefined}>{column.header}</th>;\n })}\n {totalColumns.map((column, index) => (\n <th key={column.id} scope=\"col\" className={classNames(\"hjm-line-score__total\", index === 0 && \"hjm-line-score__total-edge\")} style={totalOffset(totalColumns.length, index)}>{column.header}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {teams.map((team) => (\n <tr key={team.id} data-leader={score.leaderId === team.id || undefined}>\n <th scope=\"row\" className=\"hjm-line-score__team\">\n <span className=\"hjm-line-score__team-content\">{renderTeam?.(team)}<span>{team.name}</span></span>\n </th>\n {periods.map((column, index) => {\n const value = team.periods[index];\n return <td key={column.id} className=\"hjm-line-score__period\" data-current={score.currentPeriod === index + 1 || undefined} data-scored={typeof value === \"number\" && value > 0 || undefined}>{formatLineScoreCell(value)}</td>;\n })}\n {totalColumns.map((column, index) => (\n <td key={column.id} className={classNames(\"hjm-line-score__total\", index === 0 && \"hjm-line-score__total-edge\")} style={totalOffset(totalColumns.length, index)}>{team.totals[column.header] ?? \"—\"}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\n/* ---------------------------------------------- Matrix table ----------------------------------- */\n\nexport type MatrixTableProps<Key extends string = string> = Readonly<{\n ids: readonly Key[];\n /** Short header per id (team short name). */\n labelOf: (id: Key) => string;\n getCell: (row: Key, column: Key) => MatrixCell | null;\n /** Row id to highlight (my team). */\n highlightId?: Key | null;\n heatColors?: TableHeatColors;\n accessibilityLabel: string;\n className?: string;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport function MatrixTable<Key extends string = string>({ ids, labelOf, getCell, highlightId = null, heatColors, accessibilityLabel, className, layoutStyle }: MatrixTableProps<Key>) {\n const matrix = resolveMatrix(ids, getCell);\n return (\n <div className={classNames(\"hjm-table-family\", \"hjm-matrix-table\", className)} style={withFamilyStyle(layoutStyle)}>\n <table className=\"hjm-matrix-table__table\" aria-label={accessibilityLabel}>\n <thead>\n <tr>\n <td className=\"hjm-matrix-table__corner\" />\n {ids.map((id) => <th key={id} scope=\"col\">{labelOf(id)}</th>)}\n </tr>\n </thead>\n <tbody>\n {matrix.map((cells, rowIndex) => {\n const rowId = ids[rowIndex]!;\n return (\n <tr key={rowId} data-highlighted={rowId === highlightId || undefined}>\n <th scope=\"row\">{labelOf(rowId)}</th>\n {cells.map((cell, columnIndex) => {\n // The diagonal is a team against itself: blank and hidden, not \"no record\".\n if (cell === \"self\") return <td key={ids[columnIndex]} className=\"hjm-matrix-table__self\" aria-hidden=\"true\" />;\n const emphasis = tableCellEmphasis(cell, heatColors);\n return <td key={ids[columnIndex]} className={emphasis.heat ? \"hjm-table-family__heat\" : undefined} style={emphasis.style} data-tone={emphasis.tone} data-heat={emphasis.heat}>{cell?.label ?? \"—\"}</td>;\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\n/* ---------------------------------------------- Comparison table ------------------------------- */\n\nexport type ComparisonTableProps = Readonly<{\n rows: readonly ComparisonRow[];\n /** Side names and accent colors (team colors). */\n sides: readonly [Readonly<{ name: string; color: string }>, Readonly<{ name: string; color: string }>];\n /** Hide duplicate visual names when the two sides are already identified above; spoken row labels retain them. */\n showSideNames?: boolean;\n accessibilityLabel: string;\n className?: string;\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport function ComparisonTable({ rows, sides, showSideNames = true, accessibilityLabel, className, layoutStyle }: ComparisonTableProps) {\n return (\n <section className={classNames(\"hjm-table-family\", \"hjm-comparison-table\", className)} style={withFamilyStyle(layoutStyle)} aria-label={accessibilityLabel}>\n {showSideNames && <div className=\"hjm-comparison-table__sides\" aria-hidden=\"true\">\n {sides.map((side, index) => <span key={index} style={{ color: side.color }}>{side.name}</span>)}\n </div>}\n <ul className=\"hjm-comparison-table__rows\" role=\"list\">\n {rows.map((row) => {\n const { winner, shares } = resolveComparisonRow(row);\n const shown = row.display ?? [row.values[0] === null ? \"—\" : String(row.values[0]), row.values[1] === null ? \"—\" : String(row.values[1])];\n return (\n <li key={row.id} className=\"hjm-comparison-table__row\" data-winner={winner ?? undefined}>\n {/* One sentence for assistive tech; the visual grid and bars are decoration. */}\n <span className=\"hjm-visually-hidden\">{`${row.label} ${sides[0].name} ${shown[0]}, ${sides[1].name} ${shown[1]}`}</span>\n <div className=\"hjm-comparison-table__values\" aria-hidden=\"true\">\n <span data-win={winner === 0 || undefined}>{shown[0]}</span>\n <span className=\"hjm-comparison-table__label\">{row.label}</span>\n <span data-win={winner === 1 || undefined}>{shown[1]}</span>\n </div>\n <div className=\"hjm-comparison-table__bars\" aria-hidden=\"true\">\n {([0, 1] as const).map((index) => (\n <span key={index} className=\"hjm-comparison-table__track\" data-side={index}>\n <span\n className=\"hjm-comparison-table__bar\"\n style={{ inlineSize: `${Math.round(shares[index] * 1000) / 10}%`, background: sides[index].color, opacity: winner === null || winner === index ? 1 : 0.6 }}\n />\n </span>\n ))}\n </div>\n </li>\n );\n })}\n </ul>\n </section>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hjmds/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.49.0",
|
|
4
4
|
"description": "Accessible React 19 renderers for HJM design contracts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -604,6 +604,11 @@
|
|
|
604
604
|
"import": "./dist/shortcut-rail.js",
|
|
605
605
|
"default": "./dist/shortcut-rail.js"
|
|
606
606
|
},
|
|
607
|
+
"./share-sheet": {
|
|
608
|
+
"types": "./dist/share-sheet.d.ts",
|
|
609
|
+
"import": "./dist/share-sheet.js",
|
|
610
|
+
"default": "./dist/share-sheet.js"
|
|
611
|
+
},
|
|
607
612
|
"./time-picker": {
|
|
608
613
|
"types": "./dist/time-picker.d.ts",
|
|
609
614
|
"import": "./dist/time-picker.js",
|
|
@@ -618,6 +623,11 @@
|
|
|
618
623
|
"types": "./dist/follow-list.d.ts",
|
|
619
624
|
"import": "./dist/follow-list.js",
|
|
620
625
|
"default": "./dist/follow-list.js"
|
|
626
|
+
},
|
|
627
|
+
"./drawing-editor": {
|
|
628
|
+
"types": "./dist/drawing-editor.d.ts",
|
|
629
|
+
"import": "./dist/drawing-editor.js",
|
|
630
|
+
"default": "./dist/drawing-editor.js"
|
|
621
631
|
}
|
|
622
632
|
},
|
|
623
633
|
"files": [
|
|
@@ -628,7 +638,7 @@
|
|
|
628
638
|
"THIRD_PARTY_NOTICES.md"
|
|
629
639
|
],
|
|
630
640
|
"peerDependencies": {
|
|
631
|
-
"@hjmds/design-contracts": ">=1.
|
|
641
|
+
"@hjmds/design-contracts": ">=1.49.0 <1.50.0",
|
|
632
642
|
"react": ">=19.0.0",
|
|
633
643
|
"react-dom": ">=19.0.0",
|
|
634
644
|
"@number-flow/react": "0.6.2",
|
|
@@ -666,7 +676,7 @@
|
|
|
666
676
|
"@blobatar/react": "2.7.0",
|
|
667
677
|
"lucide-react": "1.59.0",
|
|
668
678
|
"vite": "8.3.4",
|
|
669
|
-
"@hjmds/design-contracts": "1.
|
|
679
|
+
"@hjmds/design-contracts": "1.49.0"
|
|
670
680
|
},
|
|
671
681
|
"peerDependenciesMeta": {
|
|
672
682
|
"@number-flow/react": {
|