@schemavaults/ui 0.121.0 → 0.121.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.
|
@@ -12,6 +12,15 @@ export interface ChartDataTableProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* The table view of a chart, visually hidden: every value a chart draws is
|
|
14
14
|
* reachable without the chart, so hover is never the only way to read it.
|
|
15
|
+
*
|
|
16
|
+
* `sr-only` goes on a wrapping `<div>`, not on the `<table>`: a table never
|
|
17
|
+
* renders narrower than its content, so it ignores `width: 1px`, and with
|
|
18
|
+
* `white-space: nowrap` its content is the longest unwrapped caption or row.
|
|
19
|
+
* On the table itself that box still counts toward the page's scrollable
|
|
20
|
+
* width and can make a phone-width page scroll sideways. The `<div>` does
|
|
21
|
+
* honour `width: 1px` and `overflow: hidden`, so it clips the table out of the
|
|
22
|
+
* layout while leaving it in the accessibility tree. (Never `display: none`,
|
|
23
|
+
* `hidden` or `aria-hidden`: those would hide it from screen readers too.)
|
|
15
24
|
*/
|
|
16
25
|
declare function ChartDataTable({ caption, columns, rows, }: ChartDataTableProps): ReactElement;
|
|
17
26
|
declare namespace ChartDataTable {
|
|
@@ -2,9 +2,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
/**
|
|
3
3
|
* The table view of a chart, visually hidden: every value a chart draws is
|
|
4
4
|
* reachable without the chart, so hover is never the only way to read it.
|
|
5
|
+
*
|
|
6
|
+
* `sr-only` goes on a wrapping `<div>`, not on the `<table>`: a table never
|
|
7
|
+
* renders narrower than its content, so it ignores `width: 1px`, and with
|
|
8
|
+
* `white-space: nowrap` its content is the longest unwrapped caption or row.
|
|
9
|
+
* On the table itself that box still counts toward the page's scrollable
|
|
10
|
+
* width and can make a phone-width page scroll sideways. The `<div>` does
|
|
11
|
+
* honour `width: 1px` and `overflow: hidden`, so it clips the table out of the
|
|
12
|
+
* layout while leaving it in the accessibility tree. (Never `display: none`,
|
|
13
|
+
* `hidden` or `aria-hidden`: those would hide it from screen readers too.)
|
|
5
14
|
*/
|
|
6
15
|
function ChartDataTable({ caption, columns, rows, }) {
|
|
7
|
-
return (_jsxs("table", { "data-slot": "chart-data-table",
|
|
16
|
+
return (_jsx("div", { className: "sr-only", children: _jsxs("table", { "data-slot": "chart-data-table", children: [_jsx("caption", { children: caption }), _jsx("thead", { children: _jsx("tr", { children: columns.map((column, index) => (_jsx("th", { scope: "col", children: column }, index))) }) }), _jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: row.cells.map((cell, index) => index === 0 ? (_jsx("th", { scope: "row", children: cell }, index)) : (_jsx("td", { children: cell }, index))) }, row.key))) })] }) }));
|
|
8
17
|
}
|
|
9
18
|
ChartDataTable.displayName = "ChartDataTable";
|
|
10
19
|
export { ChartDataTable };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-data-table.js","sourceRoot":"","sources":["../../../../src/components/ui/chart-primitives/chart-data-table.tsx"],"names":[],"mappings":";AAcA
|
|
1
|
+
{"version":3,"file":"chart-data-table.js","sourceRoot":"","sources":["../../../../src/components/ui/chart-primitives/chart-data-table.tsx"],"names":[],"mappings":";AAcA;;;;;;;;;;;;GAYG;AACH,SAAS,cAAc,CAAC,EACtB,OAAO,EACP,OAAO,EACP,IAAI,GACgB;IACpB,OAAO,CACL,cAAK,SAAS,EAAC,SAAS,YACtB,8BAAiB,kBAAkB,aACjC,4BAAU,OAAO,GAAW,EAC5B,0BACE,uBACG,OAAO,CAAC,GAAG,CACV,CAAC,MAAiB,EAAE,KAAa,EAAgB,EAAE,CAAC,CAClD,aAAgB,KAAK,EAAC,KAAK,YACxB,MAAM,IADA,KAAK,CAET,CACN,CACF,GACE,GACC,EACR,0BACG,IAAI,CAAC,GAAG,CACP,CAAC,GAAsB,EAAgB,EAAE,CAAC,CACxC,uBACG,GAAG,CAAC,KAAK,CAAC,GAAG,CACZ,CAAC,IAAe,EAAE,KAAa,EAAgB,EAAE,CAC/C,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CACZ,aAAgB,KAAK,EAAC,KAAK,YACxB,IAAI,IADE,KAAK,CAET,CACN,CAAC,CAAC,CAAC,CACF,uBAAiB,IAAI,IAAZ,KAAK,CAAa,CAC5B,CACJ,IAVM,GAAG,CAAC,GAAG,CAWX,CACN,CACF,GACK,IACF,GACJ,CACP,CAAC;AACJ,CAAC;AACD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,CAAC"}
|