@cratis/scene.primereact 4.17.0 → 4.18.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.
@@ -2,7 +2,7 @@
2
2
  // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
 
4
4
  import { ReactElement, ReactNode, isValidElement } from 'react';
5
- import { DataTable, type DataTableFilterInstance, type DataTablePaginationInstance, type DataTableTBodyItemOptions } from 'primereact/datatable';
5
+ import { DataTable, useDataTableContext, type DataTableFilterInstance, type DataTablePaginationInstance, type DataTableTBodyItemOptions } from 'primereact/datatable';
6
6
  import { RegisteredComponentProps } from '@cratis/scene.react';
7
7
  import { booleanProperty, numberProperty, recordArrayProperty, stringProperty } from '../properties';
8
8
  import { Column, ColumnProps } from './Column';
@@ -52,9 +52,9 @@ export function PrimeDataTable({ element, slots }: RegisteredComponentProps) {
52
52
  <DataTable.THead>
53
53
  <DataTable.THeadRow>
54
54
  {columns.map((column, index) => (
55
- <DataTable.THeadCell key={column.field ?? index}>
55
+ <SortAwareHeadCell key={column.field ?? index} sortField={column.sortable ? column.field : undefined}>
56
56
  {column.sortable && column.field ? (
57
- <DataTable.Sort field={column.field}>
57
+ <DataTable.Sort field={column.field} aria-sort={undefined} aria-label={`Sort by ${headerOf(column)}`}>
58
58
  {headerOf(column)}
59
59
  <DataTable.SortIndicator match='asc'> ▲</DataTable.SortIndicator>
60
60
  <DataTable.SortIndicator match='desc'> ▼</DataTable.SortIndicator>
@@ -74,7 +74,7 @@ export function PrimeDataTable({ element, slots }: RegisteredComponentProps) {
74
74
  )}
75
75
  </DataTable.Filter>
76
76
  )}
77
- </DataTable.THeadCell>
77
+ </SortAwareHeadCell>
78
78
  ))}
79
79
  </DataTable.THeadRow>
80
80
  </DataTable.THead>
@@ -140,3 +140,17 @@ function cellOf(column: ColumnProps, row: Record<string, unknown>): ReactNode {
140
140
  if (column.field === undefined) return '';
141
141
  return String(row[column.field] ?? '');
142
142
  }
143
+
144
+ /**
145
+ * A header cell that carries the table's sort state for assistive technology.
146
+ *
147
+ * `aria-sort` is a property of a column header, not of the button inside it - PrimeReact's sort trigger puts it
148
+ * on the button, where WAI-ARIA does not allow it and a screen reader never reads it as the column's order. So
149
+ * the trigger is rendered without it and the cell, which owns the `columnheader` role, states the order here.
150
+ */
151
+ function SortAwareHeadCell({ sortField, children }: { sortField?: string; children: ReactNode }) {
152
+ const table = useDataTableContext() as { getSortOrder?: (field: string) => number } | undefined;
153
+ const order = sortField === undefined ? undefined : table?.getSortOrder?.(sortField) ?? 0;
154
+ const ariaSort = order === undefined ? undefined : order > 0 ? 'ascending' : order < 0 ? 'descending' : 'none';
155
+ return <DataTable.THeadCell aria-sort={ariaSort}>{children}</DataTable.THeadCell>;
156
+ }
@@ -49,10 +49,13 @@ var columnDefinitions = require('./columnDefinitions.js');
49
49
  children: [
50
50
  /*#__PURE__*/ jsxRuntime.jsx(datatable.DataTable.THead, {
51
51
  children: /*#__PURE__*/ jsxRuntime.jsx(datatable.DataTable.THeadRow, {
52
- children: columns.map((column, index)=>/*#__PURE__*/ jsxRuntime.jsxs(datatable.DataTable.THeadCell, {
52
+ children: columns.map((column, index)=>/*#__PURE__*/ jsxRuntime.jsxs(SortAwareHeadCell, {
53
+ sortField: column.sortable ? column.field : undefined,
53
54
  children: [
54
55
  column.sortable && column.field ? /*#__PURE__*/ jsxRuntime.jsxs(datatable.DataTable.Sort, {
55
56
  field: column.field,
57
+ "aria-sort": undefined,
58
+ "aria-label": `Sort by ${headerOf(column)}`,
56
59
  children: [
57
60
  headerOf(column),
58
61
  /*#__PURE__*/ jsxRuntime.jsx(datatable.DataTable.SortIndicator, {
@@ -150,6 +153,21 @@ function cellOf(column, row) {
150
153
  if (column.field === undefined) return '';
151
154
  return String(row[column.field] ?? '');
152
155
  }
156
+ /**
157
+ * A header cell that carries the table's sort state for assistive technology.
158
+ *
159
+ * `aria-sort` is a property of a column header, not of the button inside it - PrimeReact's sort trigger puts it
160
+ * on the button, where WAI-ARIA does not allow it and a screen reader never reads it as the column's order. So
161
+ * the trigger is rendered without it and the cell, which owns the `columnheader` role, states the order here.
162
+ */ function SortAwareHeadCell({ sortField, children }) {
163
+ const table = datatable.useDataTableContext();
164
+ const order = sortField === undefined ? undefined : table?.getSortOrder?.(sortField) ?? 0;
165
+ const ariaSort = order === undefined ? undefined : order > 0 ? 'ascending' : order < 0 ? 'descending' : 'none';
166
+ return /*#__PURE__*/ jsxRuntime.jsx(datatable.DataTable.THeadCell, {
167
+ "aria-sort": ariaSort,
168
+ children: children
169
+ });
170
+ }
153
171
 
154
172
  exports.PrimeDataTable = PrimeDataTable;
155
173
  //# sourceMappingURL=PrimeDataTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrimeDataTable.js","sources":["../../../data/PrimeDataTable.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ReactElement, ReactNode, isValidElement } from 'react';\nimport { DataTable, type DataTableFilterInstance, type DataTablePaginationInstance, type DataTableTBodyItemOptions } from 'primereact/datatable';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty, stringProperty } from '../properties';\nimport { Column, ColumnProps } from './Column';\nimport { columnDefinitions } from './columnDefinitions';\n\n/**\n * The `PrimeReact:dataTable` component, also registered under Screenplay's `table` name so a screen\n * compiled from a `.play` file renders through this package without a translation step.\n *\n * PrimeReact 11 turned the table inside out. Where PrimeReact 10 took `value` and a set of `Column`\n * children and produced the whole table, PrimeReact 11 gives back a root that owns sorting, filtering and\n * paging and a set of parts - container, table, head, rows, cells - that the caller arranges. So this\n * adapter now writes out the table's structure itself, and the column concept it renders from is\n * {@link Column}, which is Cratis-owned because PrimeReact 11 removed `primereact/column` entirely.\n *\n * Columns are taken from `Column` declarations when a React caller composed some into a slot, and\n * otherwise from the element's model - nested `column` children, a `columns` property, or the shape of\n * the first row; see `columnDefinitions`. The model is the path a screen takes, and it is checked second\n * only because an explicitly composed declaration is the more specific statement of the two.\n *\n * A host that is still loading the rows sets `loading`, and one whose query failed sets `error` to the\n * message to show. Both replace the rows with one announced row - a status while loading, an alert on\n * error - and keep the column headers, so the table keeps its shape and the reader knows why it is empty.\n */\nexport function PrimeDataTable({ element, slots }: RegisteredComponentProps) {\n const loading = booleanProperty(element, 'loading', false);\n const error = stringProperty(element, 'error');\n const rows = loading || error !== undefined ? [] : recordArrayProperty(element, 'rows');\n const declared = declaredColumns(slots);\n const columns: ColumnProps[] = declared.length > 0 ? declared : columnDefinitions(element, rows);\n const pageSize = numberProperty(element, 'pageSize');\n const size = stringProperty(element, 'size');\n\n return (\n <DataTable.Root\n data-scene-id={element.id}\n aria-busy={loading}\n data={rows}\n removableSort\n paginator={pageSize !== undefined}\n rows={pageSize}\n stripedRows={booleanProperty(element, 'stripedRows', false)}\n showGridlines={booleanProperty(element, 'showGridlines', false)}\n size={size === 'small' || size === 'large' ? size : undefined}>\n <DataTable.TableContainer>\n <DataTable.Table>\n <DataTable.THead>\n <DataTable.THeadRow>\n {columns.map((column, index) => (\n <DataTable.THeadCell key={column.field ?? index}>\n {column.sortable && column.field ? (\n <DataTable.Sort field={column.field}>\n {headerOf(column)}\n <DataTable.SortIndicator match='asc'> ▲</DataTable.SortIndicator>\n <DataTable.SortIndicator match='desc'> ▼</DataTable.SortIndicator>\n </DataTable.Sort>\n ) : (\n <span>{headerOf(column)}</span>\n )}\n {column.filter && column.field && (\n <DataTable.Filter field={column.field} display='row'>\n {(filter: DataTableFilterInstance) => (\n <input\n className='w-full'\n aria-label={`Filter by ${headerOf(column)}`}\n value={typeof filter.value === 'string' ? filter.value : ''}\n onChange={(event) => filter.onChange(event, event.target.value)}\n />\n )}\n </DataTable.Filter>\n )}\n </DataTable.THeadCell>\n ))}\n </DataTable.THeadRow>\n </DataTable.THead>\n <DataTable.TBody>\n {({ item, index }: DataTableTBodyItemOptions) => (\n <DataTable.Row index={index}>\n {columns.map((column, columnIndex) => (\n <DataTable.Cell key={column.field ?? columnIndex}>{cellOf(column, item)}</DataTable.Cell>\n ))}\n </DataTable.Row>\n )}\n </DataTable.TBody>\n <DataTable.EmptyTBody>\n <DataTable.Row>\n <DataTable.Cell colSpan={Math.max(columns.length, 1)}>\n {error !== undefined\n ? <span role='alert'>{error}</span>\n : loading\n ? <span role='status'>{stringProperty(element, 'loadingMessage', 'Loading…')}</span>\n : stringProperty(element, 'emptyMessage', 'No records found')}\n </DataTable.Cell>\n </DataTable.Row>\n </DataTable.EmptyTBody>\n </DataTable.Table>\n </DataTable.TableContainer>\n <DataTable.Pagination>\n {(pagination: DataTablePaginationInstance) => (\n <div className='flex items-center gap-2 p-2'>\n <button\n type='button'\n disabled={!pagination.canPrev}\n onClick={(event) => pagination.onPageChange(event, pagination.page - 1)}>\n ‹\n </button>\n <span className='text-sm opacity-75'>\n {pagination.page + 1} / {Math.max(pagination.pageCount, 1)}\n </span>\n <button\n type='button'\n disabled={!pagination.canNext}\n onClick={(event) => pagination.onPageChange(event, pagination.page + 1)}>\n ›\n </button>\n </div>\n )}\n </DataTable.Pagination>\n </DataTable.Root>\n );\n}\n\nfunction declaredColumns(slots: Record<string, ReactNode[]>): ColumnProps[] {\n return [...(slots.columns ?? []), ...(slots.content ?? [])]\n .filter((node): node is ReactElement<ColumnProps> => isValidElement(node) && node.type === Column)\n .map((node) => node.props);\n}\n\nfunction headerOf(column: ColumnProps): string {\n return column.header ?? column.field ?? '';\n}\n\nfunction cellOf(column: ColumnProps, row: Record<string, unknown>): ReactNode {\n if (column.body !== undefined) return column.body(row);\n if (column.field === undefined) return '';\n return String(row[column.field] ?? '');\n}\n"],"names":["PrimeDataTable","element","slots","loading","booleanProperty","error","stringProperty","rows","undefined","recordArrayProperty","declared","declaredColumns","columns","length","columnDefinitions","pageSize","numberProperty","size","_jsxs","DataTable","Root","data-scene-id","id","aria-busy","data","removableSort","paginator","stripedRows","showGridlines","_jsx","TableContainer","Table","THead","THeadRow","map","column","index","THeadCell","sortable","field","Sort","headerOf","SortIndicator","match","span","filter","Filter","display","input","className","aria-label","value","onChange","event","target","TBody","item","Row","columnIndex","Cell","cellOf","EmptyTBody","colSpan","Math","max","role","Pagination","pagination","div","button","type","disabled","canPrev","onClick","onPageChange","page","pageCount","canNext","content","node","isValidElement","Column","props","header","row","body","String"],"mappings":";;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;AAkBC,IACM,SAASA,cAAAA,CAAe,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IACvE,MAAMC,OAAAA,GAAUC,0BAAAA,CAAgBH,OAAAA,EAAS,SAAA,EAAW,KAAA,CAAA;IACpD,MAAMI,KAAAA,GAAQC,0BAAeL,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,MAAMM,OAAOJ,OAAAA,IAAWE,KAAAA,KAAUG,YAAY,EAAE,GAAGC,+BAAoBR,OAAAA,EAAS,MAAA,CAAA;AAChF,IAAA,MAAMS,WAAWC,eAAAA,CAAgBT,KAAAA,CAAAA;AACjC,IAAA,MAAMU,UAAyBF,QAAAA,CAASG,MAAM,GAAG,CAAA,GAAIH,QAAAA,GAAWI,oCAAkBb,OAAAA,EAASM,IAAAA,CAAAA;IAC3F,MAAMQ,QAAAA,GAAWC,0BAAef,OAAAA,EAAS,UAAA,CAAA;IACzC,MAAMgB,IAAAA,GAAOX,0BAAeL,OAAAA,EAAS,MAAA,CAAA;IAErC,qBACIiB,eAAA,CAACC,oBAAUC,IAAI,EAAA;AACXC,QAAAA,eAAAA,EAAepB,QAAQqB,EAAE;QACzBC,WAAAA,EAAWpB,OAAAA;QACXqB,IAAAA,EAAMjB,IAAAA;QACNkB,aAAa,EAAA,IAAA;AACbC,QAAAA,SAAAA,EAAWX,QAAAA,KAAaP,SAAAA;QACxBD,IAAAA,EAAMQ,QAAAA;QACNY,WAAAA,EAAavB,0BAAAA,CAAgBH,SAAS,aAAA,EAAe,KAAA,CAAA;QACrD2B,aAAAA,EAAexB,0BAAAA,CAAg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AA,IAASA,IAAAA,CAAKT,IAAI,KAAKW,eAC1F/C,GAAG,CAAC,CAAC6C,IAAAA,GAASA,KAAKG,KAAK,CAAA;AACjC;AAEA,SAASzC,SAASN,MAAmB,EAAA;AACjC,IAAA,OAAOA,MAAAA,CAAOgD,MAAM,IAAIhD,MAAAA,CAAOI,KAAK,IAAI,EAAA;AAC5C;AAEA,SAASqB,MAAAA,CAAOzB,MAAmB,EAAEiD,GAA4B,EAAA;AAC7D,IAAA,IAAIjD,OAAOkD,IAAI,KAAK7E,WAAW,OAAO2B,MAAAA,CAAOkD,IAAI,CAACD,GAAAA,CAAAA;AAClD,IAAA,IAAIjD,MAAAA,CAAOI,KAAK,KAAK/B,SAAAA,EAAW,OAAO,EAAA;AACvC,IAAA,OAAO8E,OAAOF,GAAG,CAACjD,MAAAA,CAAOI,KAAK,CAAC,IAAI,EAAA,CAAA;AACvC;;"}
1
+ {"version":3,"file":"PrimeDataTable.js","sources":["../../../data/PrimeDataTable.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ReactElement, ReactNode, isValidElement } from 'react';\nimport { DataTable, useDataTableContext, type DataTableFilterInstance, type DataTablePaginationInstance, type DataTableTBodyItemOptions } from 'primereact/datatable';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty, stringProperty } from '../properties';\nimport { Column, ColumnProps } from './Column';\nimport { columnDefinitions } from './columnDefinitions';\n\n/**\n * The `PrimeReact:dataTable` component, also registered under Screenplay's `table` name so a screen\n * compiled from a `.play` file renders through this package without a translation step.\n *\n * PrimeReact 11 turned the table inside out. Where PrimeReact 10 took `value` and a set of `Column`\n * children and produced the whole table, PrimeReact 11 gives back a root that owns sorting, filtering and\n * paging and a set of parts - container, table, head, rows, cells - that the caller arranges. So this\n * adapter now writes out the table's structure itself, and the column concept it renders from is\n * {@link Column}, which is Cratis-owned because PrimeReact 11 removed `primereact/column` entirely.\n *\n * Columns are taken from `Column` declarations when a React caller composed some into a slot, and\n * otherwise from the element's model - nested `column` children, a `columns` property, or the shape of\n * the first row; see `columnDefinitions`. The model is the path a screen takes, and it is checked second\n * only because an explicitly composed declaration is the more specific statement of the two.\n *\n * A host that is still loading the rows sets `loading`, and one whose query failed sets `error` to the\n * message to show. Both replace the rows with one announced row - a status while loading, an alert on\n * error - and keep the column headers, so the table keeps its shape and the reader knows why it is empty.\n */\nexport function PrimeDataTable({ element, slots }: RegisteredComponentProps) {\n const loading = booleanProperty(element, 'loading', false);\n const error = stringProperty(element, 'error');\n const rows = loading || error !== undefined ? [] : recordArrayProperty(element, 'rows');\n const declared = declaredColumns(slots);\n const columns: ColumnProps[] = declared.length > 0 ? declared : columnDefinitions(element, rows);\n const pageSize = numberProperty(element, 'pageSize');\n const size = stringProperty(element, 'size');\n\n return (\n <DataTable.Root\n data-scene-id={element.id}\n aria-busy={loading}\n data={rows}\n removableSort\n paginator={pageSize !== undefined}\n rows={pageSize}\n stripedRows={booleanProperty(element, 'stripedRows', false)}\n showGridlines={booleanProperty(element, 'showGridlines', false)}\n size={size === 'small' || size === 'large' ? size : undefined}>\n <DataTable.TableContainer>\n <DataTable.Table>\n <DataTable.THead>\n <DataTable.THeadRow>\n {columns.map((column, index) => (\n <SortAwareHeadCell key={column.field ?? index} sortField={column.sortable ? column.field : undefined}>\n {column.sortable && column.field ? (\n <DataTable.Sort field={column.field} aria-sort={undefined} aria-label={`Sort by ${headerOf(column)}`}>\n {headerOf(column)}\n <DataTable.SortIndicator match='asc'> ▲</DataTable.SortIndicator>\n <DataTable.SortIndicator match='desc'> ▼</DataTable.SortIndicator>\n </DataTable.Sort>\n ) : (\n <span>{headerOf(column)}</span>\n )}\n {column.filter && column.field && (\n <DataTable.Filter field={column.field} display='row'>\n {(filter: DataTableFilterInstance) => (\n <input\n className='w-full'\n aria-label={`Filter by ${headerOf(column)}`}\n value={typeof filter.value === 'string' ? filter.value : ''}\n onChange={(event) => filter.onChange(event, event.target.value)}\n />\n )}\n </DataTable.Filter>\n )}\n </SortAwareHeadCell>\n ))}\n </DataTable.THeadRow>\n </DataTable.THead>\n <DataTable.TBody>\n {({ item, index }: DataTableTBodyItemOptions) => (\n <DataTable.Row index={index}>\n {columns.map((column, columnIndex) => (\n <DataTable.Cell key={column.field ?? columnIndex}>{cellOf(column, item)}</DataTable.Cell>\n ))}\n </DataTable.Row>\n )}\n </DataTable.TBody>\n <DataTable.EmptyTBody>\n <DataTable.Row>\n <DataTable.Cell colSpan={Math.max(columns.length, 1)}>\n {error !== undefined\n ? <span role='alert'>{error}</span>\n : loading\n ? <span role='status'>{stringProperty(element, 'loadingMessage', 'Loading…')}</span>\n : stringProperty(element, 'emptyMessage', 'No records found')}\n </DataTable.Cell>\n </DataTable.Row>\n </DataTable.EmptyTBody>\n </DataTable.Table>\n </DataTable.TableContainer>\n <DataTable.Pagination>\n {(pagination: DataTablePaginationInstance) => (\n <div className='flex items-center gap-2 p-2'>\n <button\n type='button'\n disabled={!pagination.canPrev}\n onClick={(event) => pagination.onPageChange(event, pagination.page - 1)}>\n ‹\n </button>\n <span className='text-sm opacity-75'>\n {pagination.page + 1} / {Math.max(pagination.pageCount, 1)}\n </span>\n <button\n type='button'\n disabled={!pagination.canNext}\n onClick={(event) => pagination.onPageChange(event, pagination.page + 1)}>\n ›\n </button>\n </div>\n )}\n </DataTable.Pagination>\n </DataTable.Root>\n );\n}\n\nfunction declaredColumns(slots: Record<string, ReactNode[]>): ColumnProps[] {\n return [...(slots.columns ?? []), ...(slots.content ?? [])]\n .filter((node): node is ReactElement<ColumnProps> => isValidElement(node) && node.type === Column)\n .map((node) => node.props);\n}\n\nfunction headerOf(column: ColumnProps): string {\n return column.header ?? column.field ?? '';\n}\n\nfunction cellOf(column: ColumnProps, row: Record<string, unknown>): ReactNode {\n if (column.body !== undefined) return column.body(row);\n if (column.field === undefined) return '';\n return String(row[column.field] ?? '');\n}\n\n/**\n * A header cell that carries the table's sort state for assistive technology.\n *\n * `aria-sort` is a property of a column header, not of the button inside it - PrimeReact's sort trigger puts it\n * on the button, where WAI-ARIA does not allow it and a screen reader never reads it as the column's order. So\n * the trigger is rendered without it and the cell, which owns the `columnheader` role, states the order here.\n */\nfunction SortAwareHeadCell({ sortField, children }: { sortField?: string; children: ReactNode }) {\n const table = useDataTableContext() as { getSortOrder?: (field: string) => number } | undefined;\n const order = sortField === undefined ? undefined : table?.getSortOrder?.(sortField) ?? 0;\n const ariaSort = order === undefined ? undefined : order > 0 ? 'ascending' : order < 0 ? 'descending' : 'none';\n return <DataTable.THeadCell aria-sort={ariaSort}>{children}</DataTable.THeadCell>;\n}\n"],"names":["PrimeDataTable","element","slots","loading","booleanProperty","error","stringProperty","rows","undefined","recordArrayProperty","declared","declaredColumns","columns","length","columnDefinitions","pageSize","numberProperty","size","_jsxs","DataTable","Root","data-scene-id","id","aria-busy","data","removableSort","paginator","stripedRows","showGridlines","_jsx","TableContainer","Table","THead","THeadRow","map","column","index","SortAwareHeadCell","sortField","sortable","field","Sort","aria-sort","aria-label","headerOf","SortIndicator","match","span","filter","Filter","display","input","className","value","onChange","event","target","TBody","item","Row","columnIndex","Cell","cellOf","EmptyTBody","colSpan","Math","max","role","Pagination","pagination","div","button","type","disabled","canPrev","onClick","onPageChange","page","pageCount","canNext","content","node","isValidElement","Column","props","header","row","body","String","children","table","useDataTableContext","order","getSortOrder","ariaSort","THeadCell"],"mappings":";;;;;;;;;AAUA;;;;;;;;;;;;;;;;;;AAkBC,IACM,SAASA,cAAAA,CAAe,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IACvE,MAAMC,OAAAA,GAAUC,0BAAAA,CAAgBH,OAAAA,EAAS,SAAA,EAAW,KAAA,CAAA;IACpD,MAAMI,KAAAA,GAAQC,0BAAeL,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,MAAMM,OAAOJ,OAAAA,IAAWE,KAAAA,KAAUG,YAAY,EAAE,GAAGC,+BAAoBR,OAA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/E,WAAW,OAAO2B,MAAAA,CAAOoD,IAAI,CAACD,GAAAA,CAAAA;AAClD,IAAA,IAAInD,MAAAA,CAAOK,KAAK,KAAKhC,SAAAA,EAAW,OAAO,EAAA;AACvC,IAAA,OAAOgF,OAAOF,GAAG,CAACnD,MAAAA,CAAOK,KAAK,CAAC,IAAI,EAAA,CAAA;AACvC;AAEA;;;;;;AAMC,IACD,SAASH,iBAAAA,CAAkB,EAAEC,SAAS,EAAEmD,QAAQ,EAA+C,EAAA;AAC3F,IAAA,MAAMC,KAAAA,GAAQC,6BAAAA,EAAAA;AACd,IAAA,MAAMC,QAAQtD,SAAAA,KAAc9B,SAAAA,GAAYA,SAAAA,GAAYkF,KAAAA,EAAOG,eAAevD,SAAAA,CAAAA,IAAc,CAAA;IACxF,MAAMwD,QAAAA,GAAWF,UAAUpF,SAAAA,GAAYA,SAAAA,GAAYoF,QAAQ,CAAA,GAAI,WAAA,GAAcA,KAAAA,GAAQ,CAAA,GAAI,YAAA,GAAe,MAAA;IACxG,qBAAO/D,cAAA,CAACV,oBAAU4E,SAAS,EAAA;QAACrD,WAAAA,EAAWoD,QAAAA;AAAWL,QAAAA,QAAAA,EAAAA;;AACtD;;"}
@@ -15,6 +15,9 @@ var properties = require('../properties.js');
15
15
  * height belong there rather than on `Root`. `Indicator` renders its children only in determinate mode,
16
16
  * which is why the value label can be handed to it unconditionally: an indeterminate bar has no
17
17
  * percentage to print and drops it on its own.
18
+ *
19
+ * A progress bar with no accessible name is announced as just "progress bar", so the element's `label` names
20
+ * what is progressing (`Progress` when it says nothing), and screen readers read it with the value.
18
21
  */ function PrimeProgressBar({ element }) {
19
22
  const value = properties.numberProperty(element, 'value');
20
23
  return /*#__PURE__*/ jsxRuntime.jsx(progressbar.ProgressBar.Root, {
@@ -22,6 +25,7 @@ var properties = require('../properties.js');
22
25
  mode: value === undefined ? 'indeterminate' : 'determinate',
23
26
  children: /*#__PURE__*/ jsxRuntime.jsx(progressbar.ProgressBar.Track, {
24
27
  "data-scene-id": element.id,
28
+ "aria-label": properties.stringProperty(element, 'label', 'Progress'),
25
29
  style: {
26
30
  height: '1rem'
27
31
  },
@@ -1 +1 @@
1
- {"version":3,"file":"PrimeProgressBar.js","sources":["../../../misc/PrimeProgressBar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ProgressBar } from 'primereact/progressbar';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty } from '../properties';\n\n/**\n * The `PrimeReact:progressBar` component - determinate or indeterminate progress.\n *\n * The mode follows whether a `value` was given at all: progress you cannot measure is exactly what\n * indeterminate mode is for, so an element with no value animates rather than sitting at zero.\n *\n * In PrimeReact 11 the root is a headless wrapper that renders no element of its own - `Track` is the\n * first real DOM node and the one carrying the ARIA `progressbar` role - so `data-scene-id` and the bar's\n * height belong there rather than on `Root`. `Indicator` renders its children only in determinate mode,\n * which is why the value label can be handed to it unconditionally: an indeterminate bar has no\n * percentage to print and drops it on its own.\n */\nexport function PrimeProgressBar({ element }: RegisteredComponentProps) {\n const value = numberProperty(element, 'value');\n return (\n <ProgressBar.Root value={value} mode={value === undefined ? 'indeterminate' : 'determinate'}>\n <ProgressBar.Track data-scene-id={element.id} style={{ height: '1rem' }}>\n <ProgressBar.Indicator>{booleanProperty(element, 'showValue', true) && <ProgressBar.Value />}</ProgressBar.Indicator>\n </ProgressBar.Track>\n </ProgressBar.Root>\n );\n}\n"],"names":["PrimeProgressBar","element","value","numberProperty","_jsx","ProgressBar","Root","mode","undefined","Track","data-scene-id","id","style","height","Indicator","booleanProperty","Value"],"mappings":";;;;;;AAOA;;;;;;;;;;;AAWC,IACM,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;IAClE,MAAMC,KAAAA,GAAQC,0BAAeF,OAAAA,EAAS,OAAA,CAAA;IACtC,qBACIG,cAAA,CAACC,wBAAYC,IAAI,EAAA;QAACJ,KAAAA,EAAOA,KAAAA;QAAOK,IAAAA,EAAML,KAAAA,KAAUM,YAAY,eAAA,GAAkB,aAAA;gCAC1EJ,cAAA,CAACC,wBAAYI,KAAK,EAAA;AAACC,YAAAA,eAAAA,EAAeT,QAAQU,EAAE;YAAEC,KAAAA,EAAO;gBAAEC,MAAAA,EAAQ;AAAO,aAAA;oCAClET,cAAA,CAACC,wBAAYS,SAAS,EAAA;AAAEC,gBAAAA,QAAAA,EAAAA,0BAAAA,CAAgBd,OAAAA,EAAS,WAAA,EAAa,IAAA,CAAA,kBAASG,cAAA,CAACC,wBAAYW,KAAK,EAAA,EAAA;;;;AAIzG;;"}
1
+ {"version":3,"file":"PrimeProgressBar.js","sources":["../../../misc/PrimeProgressBar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ProgressBar } from 'primereact/progressbar';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:progressBar` component - determinate or indeterminate progress.\n *\n * The mode follows whether a `value` was given at all: progress you cannot measure is exactly what\n * indeterminate mode is for, so an element with no value animates rather than sitting at zero.\n *\n * In PrimeReact 11 the root is a headless wrapper that renders no element of its own - `Track` is the\n * first real DOM node and the one carrying the ARIA `progressbar` role - so `data-scene-id` and the bar's\n * height belong there rather than on `Root`. `Indicator` renders its children only in determinate mode,\n * which is why the value label can be handed to it unconditionally: an indeterminate bar has no\n * percentage to print and drops it on its own.\n *\n * A progress bar with no accessible name is announced as just \"progress bar\", so the element's `label` names\n * what is progressing (`Progress` when it says nothing), and screen readers read it with the value.\n */\nexport function PrimeProgressBar({ element }: RegisteredComponentProps) {\n const value = numberProperty(element, 'value');\n return (\n <ProgressBar.Root value={value} mode={value === undefined ? 'indeterminate' : 'determinate'}>\n <ProgressBar.Track data-scene-id={element.id} aria-label={stringProperty(element, 'label', 'Progress')} style={{ height: '1rem' }}>\n <ProgressBar.Indicator>{booleanProperty(element, 'showValue', true) && <ProgressBar.Value />}</ProgressBar.Indicator>\n </ProgressBar.Track>\n </ProgressBar.Root>\n );\n}\n"],"names":["PrimeProgressBar","element","value","numberProperty","_jsx","ProgressBar","Root","mode","undefined","Track","data-scene-id","id","aria-label","stringProperty","style","height","Indicator","booleanProperty","Value"],"mappings":";;;;;;AAOA;;;;;;;;;;;;;;AAcC,IACM,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;IAClE,MAAMC,KAAAA,GAAQC,0BAAeF,OAAAA,EAAS,OAAA,CAAA;IACtC,qBACIG,cAAA,CAACC,wBAAYC,IAAI,EAAA;QAACJ,KAAAA,EAAOA,KAAAA;QAAOK,IAAAA,EAAML,KAAAA,KAAUM,YAAY,eAAA,GAAkB,aAAA;gCAC1EJ,cAAA,CAACC,wBAAYI,KAAK,EAAA;AAACC,YAAAA,eAAAA,EAAeT,QAAQU,EAAE;YAAEC,YAAAA,EAAYC,yBAAAA,CAAeZ,SAAS,OAAA,EAAS,UAAA,CAAA;YAAaa,KAAAA,EAAO;gBAAEC,MAAAA,EAAQ;AAAO,aAAA;oCAC5HX,cAAA,CAACC,wBAAYW,SAAS,EAAA;AAAEC,gBAAAA,QAAAA,EAAAA,0BAAAA,CAAgBhB,OAAAA,EAAS,WAAA,EAAa,IAAA,CAAA,kBAASG,cAAA,CAACC,wBAAYa,KAAK,EAAA,EAAA;;;;AAIzG;;"}
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { isValidElement } from 'react';
3
- import { DataTable } from 'primereact/datatable';
3
+ import { DataTable, useDataTableContext } from 'primereact/datatable';
4
4
  import { booleanProperty, stringProperty, recordArrayProperty, numberProperty } from '../properties.js';
5
5
  import { Column } from './Column.js';
6
6
  import { columnDefinitions } from './columnDefinitions.js';
@@ -47,10 +47,13 @@ import { columnDefinitions } from './columnDefinitions.js';
47
47
  children: [
48
48
  /*#__PURE__*/ jsx(DataTable.THead, {
49
49
  children: /*#__PURE__*/ jsx(DataTable.THeadRow, {
50
- children: columns.map((column, index)=>/*#__PURE__*/ jsxs(DataTable.THeadCell, {
50
+ children: columns.map((column, index)=>/*#__PURE__*/ jsxs(SortAwareHeadCell, {
51
+ sortField: column.sortable ? column.field : undefined,
51
52
  children: [
52
53
  column.sortable && column.field ? /*#__PURE__*/ jsxs(DataTable.Sort, {
53
54
  field: column.field,
55
+ "aria-sort": undefined,
56
+ "aria-label": `Sort by ${headerOf(column)}`,
54
57
  children: [
55
58
  headerOf(column),
56
59
  /*#__PURE__*/ jsx(DataTable.SortIndicator, {
@@ -148,6 +151,21 @@ function cellOf(column, row) {
148
151
  if (column.field === undefined) return '';
149
152
  return String(row[column.field] ?? '');
150
153
  }
154
+ /**
155
+ * A header cell that carries the table's sort state for assistive technology.
156
+ *
157
+ * `aria-sort` is a property of a column header, not of the button inside it - PrimeReact's sort trigger puts it
158
+ * on the button, where WAI-ARIA does not allow it and a screen reader never reads it as the column's order. So
159
+ * the trigger is rendered without it and the cell, which owns the `columnheader` role, states the order here.
160
+ */ function SortAwareHeadCell({ sortField, children }) {
161
+ const table = useDataTableContext();
162
+ const order = sortField === undefined ? undefined : table?.getSortOrder?.(sortField) ?? 0;
163
+ const ariaSort = order === undefined ? undefined : order > 0 ? 'ascending' : order < 0 ? 'descending' : 'none';
164
+ return /*#__PURE__*/ jsx(DataTable.THeadCell, {
165
+ "aria-sort": ariaSort,
166
+ children: children
167
+ });
168
+ }
151
169
 
152
170
  export { PrimeDataTable };
153
171
  //# sourceMappingURL=PrimeDataTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrimeDataTable.js","sources":["../../../data/PrimeDataTable.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ReactElement, ReactNode, isValidElement } from 'react';\nimport { DataTable, type DataTableFilterInstance, type DataTablePaginationInstance, type DataTableTBodyItemOptions } from 'primereact/datatable';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty, stringProperty } from '../properties';\nimport { Column, ColumnProps } from './Column';\nimport { columnDefinitions } from './columnDefinitions';\n\n/**\n * The `PrimeReact:dataTable` component, also registered under Screenplay's `table` name so a screen\n * compiled from a `.play` file renders through this package without a translation step.\n *\n * PrimeReact 11 turned the table inside out. Where PrimeReact 10 took `value` and a set of `Column`\n * children and produced the whole table, PrimeReact 11 gives back a root that owns sorting, filtering and\n * paging and a set of parts - container, table, head, rows, cells - that the caller arranges. So this\n * adapter now writes out the table's structure itself, and the column concept it renders from is\n * {@link Column}, which is Cratis-owned because PrimeReact 11 removed `primereact/column` entirely.\n *\n * Columns are taken from `Column` declarations when a React caller composed some into a slot, and\n * otherwise from the element's model - nested `column` children, a `columns` property, or the shape of\n * the first row; see `columnDefinitions`. The model is the path a screen takes, and it is checked second\n * only because an explicitly composed declaration is the more specific statement of the two.\n *\n * A host that is still loading the rows sets `loading`, and one whose query failed sets `error` to the\n * message to show. Both replace the rows with one announced row - a status while loading, an alert on\n * error - and keep the column headers, so the table keeps its shape and the reader knows why it is empty.\n */\nexport function PrimeDataTable({ element, slots }: RegisteredComponentProps) {\n const loading = booleanProperty(element, 'loading', false);\n const error = stringProperty(element, 'error');\n const rows = loading || error !== undefined ? [] : recordArrayProperty(element, 'rows');\n const declared = declaredColumns(slots);\n const columns: ColumnProps[] = declared.length > 0 ? declared : columnDefinitions(element, rows);\n const pageSize = numberProperty(element, 'pageSize');\n const size = stringProperty(element, 'size');\n\n return (\n <DataTable.Root\n data-scene-id={element.id}\n aria-busy={loading}\n data={rows}\n removableSort\n paginator={pageSize !== undefined}\n rows={pageSize}\n stripedRows={booleanProperty(element, 'stripedRows', false)}\n showGridlines={booleanProperty(element, 'showGridlines', false)}\n size={size === 'small' || size === 'large' ? size : undefined}>\n <DataTable.TableContainer>\n <DataTable.Table>\n <DataTable.THead>\n <DataTable.THeadRow>\n {columns.map((column, index) => (\n <DataTable.THeadCell key={column.field ?? index}>\n {column.sortable && column.field ? (\n <DataTable.Sort field={column.field}>\n {headerOf(column)}\n <DataTable.SortIndicator match='asc'> ▲</DataTable.SortIndicator>\n <DataTable.SortIndicator match='desc'> ▼</DataTable.SortIndicator>\n </DataTable.Sort>\n ) : (\n <span>{headerOf(column)}</span>\n )}\n {column.filter && column.field && (\n <DataTable.Filter field={column.field} display='row'>\n {(filter: DataTableFilterInstance) => (\n <input\n className='w-full'\n aria-label={`Filter by ${headerOf(column)}`}\n value={typeof filter.value === 'string' ? filter.value : ''}\n onChange={(event) => filter.onChange(event, event.target.value)}\n />\n )}\n </DataTable.Filter>\n )}\n </DataTable.THeadCell>\n ))}\n </DataTable.THeadRow>\n </DataTable.THead>\n <DataTable.TBody>\n {({ item, index }: DataTableTBodyItemOptions) => (\n <DataTable.Row index={index}>\n {columns.map((column, columnIndex) => (\n <DataTable.Cell key={column.field ?? columnIndex}>{cellOf(column, item)}</DataTable.Cell>\n ))}\n </DataTable.Row>\n )}\n </DataTable.TBody>\n <DataTable.EmptyTBody>\n <DataTable.Row>\n <DataTable.Cell colSpan={Math.max(columns.length, 1)}>\n {error !== undefined\n ? <span role='alert'>{error}</span>\n : loading\n ? <span role='status'>{stringProperty(element, 'loadingMessage', 'Loading…')}</span>\n : stringProperty(element, 'emptyMessage', 'No records found')}\n </DataTable.Cell>\n </DataTable.Row>\n </DataTable.EmptyTBody>\n </DataTable.Table>\n </DataTable.TableContainer>\n <DataTable.Pagination>\n {(pagination: DataTablePaginationInstance) => (\n <div className='flex items-center gap-2 p-2'>\n <button\n type='button'\n disabled={!pagination.canPrev}\n onClick={(event) => pagination.onPageChange(event, pagination.page - 1)}>\n ‹\n </button>\n <span className='text-sm opacity-75'>\n {pagination.page + 1} / {Math.max(pagination.pageCount, 1)}\n </span>\n <button\n type='button'\n disabled={!pagination.canNext}\n onClick={(event) => pagination.onPageChange(event, pagination.page + 1)}>\n ›\n </button>\n </div>\n )}\n </DataTable.Pagination>\n </DataTable.Root>\n );\n}\n\nfunction declaredColumns(slots: Record<string, ReactNode[]>): ColumnProps[] {\n return [...(slots.columns ?? []), ...(slots.content ?? [])]\n .filter((node): node is ReactElement<ColumnProps> => isValidElement(node) && node.type === Column)\n .map((node) => node.props);\n}\n\nfunction headerOf(column: ColumnProps): string {\n return column.header ?? column.field ?? '';\n}\n\nfunction cellOf(column: ColumnProps, row: Record<string, unknown>): ReactNode {\n if (column.body !== undefined) return column.body(row);\n if (column.field === undefined) return '';\n return String(row[column.field] ?? '');\n}\n"],"names":["PrimeDataTable","element","slots","loading","booleanProperty","error","stringProperty","rows","undefined","recordArrayProperty","declared","declaredColumns","columns","length","columnDefinitions","pageSize","numberProperty","size","_jsxs","DataTable","Root","data-scene-id","id","aria-busy","data","removableSort","paginator","stripedRows","showGridlines","_jsx","TableContainer","Table","THead","THeadRow","map","column","index","THeadCell","sortable","field","Sort","headerOf","SortIndicator","match","span","filter","Filter","display","input","className","aria-label","value","onChange","event","target","TBody","item","Row","columnIndex","Cell","cellOf","EmptyTBody","colSpan","Math","max","role","Pagination","pagination","div","button","type","disabled","canPrev","onClick","onPageChange","page","pageCount","canNext","content","node","isValidElement","Column","props","header","row","body","String"],"mappings":";;;;;;;AAUA;;;;;;;;;;;;;;;;;;AAkBC,IACM,SAASA,cAAAA,CAAe,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IACvE,MAAMC,OAAAA,GAAUC,eAAAA,CAAgBH,OAAAA,EAAS,SAAA,EAAW,KAAA,CAAA;IACpD,MAAMI,KAAAA,GAAQC,eAAeL,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,MAAMM,OAAOJ,OAAAA,IAAWE,KAAAA,KAAUG,YAAY,EAAE,GAAGC,oBAAoBR,OAAAA,EAAS,MAAA,CAAA;AAChF,IAAA,MAAMS,WAAWC,eAAAA,CAAgBT,KAAAA,CAAAA;AACjC,IAAA,MAAMU,UAAyBF,QAAAA,C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,oCAAAA,IAAAA,CAAKC,GAAG,CAACG,UAAAA,CAAWS,SAAS,EAAE,CAAA;;;0CAE5D/C,GAAA,CAACwC,QAAAA,EAAAA;gCACGC,IAAAA,EAAK,QAAA;gCACLC,QAAAA,EAAU,CAACJ,WAAWU,OAAO;gCAC7BJ,OAAAA,EAAS,CAACpB,QAAUc,UAAAA,CAAWO,YAAY,CAACrB,KAAAA,EAAOc,UAAAA,CAAWQ,IAAI,GAAG,CAAA,CAAA;AAAI,gCAAA,QAAA,EAAA;;;;;;;AAQrG;AAEA,SAAShE,gBAAgBT,KAAkC,EAAA;IACvD,OAAO;WAAKA,KAAAA,CAAMU,OAAO,IAAI,EAAE;WAAOV,KAAAA,CAAM4E,OAAO,IAAI;AAAI,KAAA,CACtDjC,MAAM,CAAC,CAACkC,IAAAA,iBAA4CC,eAAeD,IAAAA,CAAAA,IAASA,IAAAA,CAAKT,IAAI,KAAKW,QAC1F/C,GAAG,CAAC,CAAC6C,IAAAA,GAASA,KAAKG,KAAK,CAAA;AACjC;AAEA,SAASzC,SAASN,MAAmB,EAAA;AACjC,IAAA,OAAOA,MAAAA,CAAOgD,MAAM,IAAIhD,MAAAA,CAAOI,KAAK,IAAI,EAAA;AAC5C;AAEA,SAASqB,MAAAA,CAAOzB,MAAmB,EAAEiD,GAA4B,EAAA;AAC7D,IAAA,IAAIjD,OAAOkD,IAAI,KAAK7E,WAAW,OAAO2B,MAAAA,CAAOkD,IAAI,CAACD,GAAAA,CAAAA;AAClD,IAAA,IAAIjD,MAAAA,CAAOI,KAAK,KAAK/B,SAAAA,EAAW,OAAO,EAAA;AACvC,IAAA,OAAO8E,OAAOF,GAAG,CAACjD,MAAAA,CAAOI,KAAK,CAAC,IAAI,EAAA,CAAA;AACvC;;"}
1
+ {"version":3,"file":"PrimeDataTable.js","sources":["../../../data/PrimeDataTable.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ReactElement, ReactNode, isValidElement } from 'react';\nimport { DataTable, useDataTableContext, type DataTableFilterInstance, type DataTablePaginationInstance, type DataTableTBodyItemOptions } from 'primereact/datatable';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, recordArrayProperty, stringProperty } from '../properties';\nimport { Column, ColumnProps } from './Column';\nimport { columnDefinitions } from './columnDefinitions';\n\n/**\n * The `PrimeReact:dataTable` component, also registered under Screenplay's `table` name so a screen\n * compiled from a `.play` file renders through this package without a translation step.\n *\n * PrimeReact 11 turned the table inside out. Where PrimeReact 10 took `value` and a set of `Column`\n * children and produced the whole table, PrimeReact 11 gives back a root that owns sorting, filtering and\n * paging and a set of parts - container, table, head, rows, cells - that the caller arranges. So this\n * adapter now writes out the table's structure itself, and the column concept it renders from is\n * {@link Column}, which is Cratis-owned because PrimeReact 11 removed `primereact/column` entirely.\n *\n * Columns are taken from `Column` declarations when a React caller composed some into a slot, and\n * otherwise from the element's model - nested `column` children, a `columns` property, or the shape of\n * the first row; see `columnDefinitions`. The model is the path a screen takes, and it is checked second\n * only because an explicitly composed declaration is the more specific statement of the two.\n *\n * A host that is still loading the rows sets `loading`, and one whose query failed sets `error` to the\n * message to show. Both replace the rows with one announced row - a status while loading, an alert on\n * error - and keep the column headers, so the table keeps its shape and the reader knows why it is empty.\n */\nexport function PrimeDataTable({ element, slots }: RegisteredComponentProps) {\n const loading = booleanProperty(element, 'loading', false);\n const error = stringProperty(element, 'error');\n const rows = loading || error !== undefined ? [] : recordArrayProperty(element, 'rows');\n const declared = declaredColumns(slots);\n const columns: ColumnProps[] = declared.length > 0 ? declared : columnDefinitions(element, rows);\n const pageSize = numberProperty(element, 'pageSize');\n const size = stringProperty(element, 'size');\n\n return (\n <DataTable.Root\n data-scene-id={element.id}\n aria-busy={loading}\n data={rows}\n removableSort\n paginator={pageSize !== undefined}\n rows={pageSize}\n stripedRows={booleanProperty(element, 'stripedRows', false)}\n showGridlines={booleanProperty(element, 'showGridlines', false)}\n size={size === 'small' || size === 'large' ? size : undefined}>\n <DataTable.TableContainer>\n <DataTable.Table>\n <DataTable.THead>\n <DataTable.THeadRow>\n {columns.map((column, index) => (\n <SortAwareHeadCell key={column.field ?? index} sortField={column.sortable ? column.field : undefined}>\n {column.sortable && column.field ? (\n <DataTable.Sort field={column.field} aria-sort={undefined} aria-label={`Sort by ${headerOf(column)}`}>\n {headerOf(column)}\n <DataTable.SortIndicator match='asc'> ▲</DataTable.SortIndicator>\n <DataTable.SortIndicator match='desc'> ▼</DataTable.SortIndicator>\n </DataTable.Sort>\n ) : (\n <span>{headerOf(column)}</span>\n )}\n {column.filter && column.field && (\n <DataTable.Filter field={column.field} display='row'>\n {(filter: DataTableFilterInstance) => (\n <input\n className='w-full'\n aria-label={`Filter by ${headerOf(column)}`}\n value={typeof filter.value === 'string' ? filter.value : ''}\n onChange={(event) => filter.onChange(event, event.target.value)}\n />\n )}\n </DataTable.Filter>\n )}\n </SortAwareHeadCell>\n ))}\n </DataTable.THeadRow>\n </DataTable.THead>\n <DataTable.TBody>\n {({ item, index }: DataTableTBodyItemOptions) => (\n <DataTable.Row index={index}>\n {columns.map((column, columnIndex) => (\n <DataTable.Cell key={column.field ?? columnIndex}>{cellOf(column, item)}</DataTable.Cell>\n ))}\n </DataTable.Row>\n )}\n </DataTable.TBody>\n <DataTable.EmptyTBody>\n <DataTable.Row>\n <DataTable.Cell colSpan={Math.max(columns.length, 1)}>\n {error !== undefined\n ? <span role='alert'>{error}</span>\n : loading\n ? <span role='status'>{stringProperty(element, 'loadingMessage', 'Loading…')}</span>\n : stringProperty(element, 'emptyMessage', 'No records found')}\n </DataTable.Cell>\n </DataTable.Row>\n </DataTable.EmptyTBody>\n </DataTable.Table>\n </DataTable.TableContainer>\n <DataTable.Pagination>\n {(pagination: DataTablePaginationInstance) => (\n <div className='flex items-center gap-2 p-2'>\n <button\n type='button'\n disabled={!pagination.canPrev}\n onClick={(event) => pagination.onPageChange(event, pagination.page - 1)}>\n ‹\n </button>\n <span className='text-sm opacity-75'>\n {pagination.page + 1} / {Math.max(pagination.pageCount, 1)}\n </span>\n <button\n type='button'\n disabled={!pagination.canNext}\n onClick={(event) => pagination.onPageChange(event, pagination.page + 1)}>\n ›\n </button>\n </div>\n )}\n </DataTable.Pagination>\n </DataTable.Root>\n );\n}\n\nfunction declaredColumns(slots: Record<string, ReactNode[]>): ColumnProps[] {\n return [...(slots.columns ?? []), ...(slots.content ?? [])]\n .filter((node): node is ReactElement<ColumnProps> => isValidElement(node) && node.type === Column)\n .map((node) => node.props);\n}\n\nfunction headerOf(column: ColumnProps): string {\n return column.header ?? column.field ?? '';\n}\n\nfunction cellOf(column: ColumnProps, row: Record<string, unknown>): ReactNode {\n if (column.body !== undefined) return column.body(row);\n if (column.field === undefined) return '';\n return String(row[column.field] ?? '');\n}\n\n/**\n * A header cell that carries the table's sort state for assistive technology.\n *\n * `aria-sort` is a property of a column header, not of the button inside it - PrimeReact's sort trigger puts it\n * on the button, where WAI-ARIA does not allow it and a screen reader never reads it as the column's order. So\n * the trigger is rendered without it and the cell, which owns the `columnheader` role, states the order here.\n */\nfunction SortAwareHeadCell({ sortField, children }: { sortField?: string; children: ReactNode }) {\n const table = useDataTableContext() as { getSortOrder?: (field: string) => number } | undefined;\n const order = sortField === undefined ? undefined : table?.getSortOrder?.(sortField) ?? 0;\n const ariaSort = order === undefined ? undefined : order > 0 ? 'ascending' : order < 0 ? 'descending' : 'none';\n return <DataTable.THeadCell aria-sort={ariaSort}>{children}</DataTable.THeadCell>;\n}\n"],"names":["PrimeDataTable","element","slots","loading","booleanProperty","error","stringProperty","rows","undefined","recordArrayProperty","declared","declaredColumns","columns","length","columnDefinitions","pageSize","numberProperty","size","_jsxs","DataTable","Root","data-scene-id","id","aria-busy","data","removableSort","paginator","stripedRows","showGridlines","_jsx","TableContainer","Table","THead","THeadRow","map","column","index","SortAwareHeadCell","sortField","sortable","field","Sort","aria-sort","aria-label","headerOf","SortIndicator","match","span","filter","Filter","display","input","className","value","onChange","event","target","TBody","item","Row","columnIndex","Cell","cellOf","EmptyTBody","colSpan","Math","max","role","Pagination","pagination","div","button","type","disabled","canPrev","onClick","onPageChange","page","pageCount","canNext","content","node","isValidElement","Column","props","header","row","body","String","children","table","useDataTableContext","order","getSortOrder","ariaSort","THeadCell"],"mappings":";;;;;;;AAUA;;;;;;;;;;;;;;;;;;AAkBC,IACM,SAASA,cAAAA,CAAe,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IACvE,MAAMC,OAAAA,GAAUC,eAAAA,CAAgBH,OAAAA,EAAS,SAAA,EAAW,KAAA,CAAA;IACpD,MAAMI,KAAAA,GAAQC,eAAeL,OAAAA,EAAS,OAAA,CAAA;AACtC,IAAA,MAAMM,OAAOJ,OAAAA,IAAWE,KAAAA,KAAUG,YAAY,EAAE,GAAGC,oBAAoBR,OAAAA,EAAS,MAAA,CAAA;AAChF,IAAA,MAAMS,WAAWC,eAAAA,CAAgBT,KAAAA,CAAAA;AACjC,IAAA,MAAMU,UAAyBF,QAAAA,CAASG,MAAM,GAAG,CAAA,GAAIH,QAAAA,GAAWI,kBAAkBb,OAAAA,EAASM,IAAAA,CAAAA;IAC3F,MAAMQ,QAAAA,GAAWC,eAAef,OAAAA,EAAS,UAAA,CAAA;IACzC,MAAMgB,IAAAA,GAAOX,eAAeL,OAAAA,EAAS,MAAA,CAAA;IAErC,qBACIiB,IAAA,CAACC,UAAUC,IAAI,EAAA;AACXC,QAAAA,eAAAA,EAAepB,QAAQqB,EAAE;QACzBC,WAAAA,EAAWpB,OAAAA;QACXqB,IAAAA,EAAMjB,IAAAA;QACNkB,aAAa,EAAA,IAAA;AACbC,QAAAA,SAAAA,EAAWX,QAAAA,KAAaP,SAAAA;QACxBD,IAAAA,EAAMQ,QAAAA;QACNY,WAAAA,EAAavB,eAAAA,CAAgBH,SAAS,aAAA,EAAe,KAAA,CAAA;QACrD2B,aAAAA,EAAexB,eAAAA,CAAgBH,SAAS,eAAA,EAAiB,KAAA,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AAA;;AACtD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrimeProgressBar.d.ts","sourceRoot":"","sources":["../../../misc/PrimeProgressBar.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAe/D,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BASrE"}
1
+ {"version":3,"file":"PrimeProgressBar.d.ts","sourceRoot":"","sources":["../../../misc/PrimeProgressBar.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAkB/D,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,wBAAwB,+BASrE"}
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { ProgressBar } from 'primereact/progressbar';
3
- import { numberProperty, booleanProperty } from '../properties.js';
3
+ import { numberProperty, booleanProperty, stringProperty } from '../properties.js';
4
4
 
5
5
  /**
6
6
  * The `PrimeReact:progressBar` component - determinate or indeterminate progress.
@@ -13,6 +13,9 @@ import { numberProperty, booleanProperty } from '../properties.js';
13
13
  * height belong there rather than on `Root`. `Indicator` renders its children only in determinate mode,
14
14
  * which is why the value label can be handed to it unconditionally: an indeterminate bar has no
15
15
  * percentage to print and drops it on its own.
16
+ *
17
+ * A progress bar with no accessible name is announced as just "progress bar", so the element's `label` names
18
+ * what is progressing (`Progress` when it says nothing), and screen readers read it with the value.
16
19
  */ function PrimeProgressBar({ element }) {
17
20
  const value = numberProperty(element, 'value');
18
21
  return /*#__PURE__*/ jsx(ProgressBar.Root, {
@@ -20,6 +23,7 @@ import { numberProperty, booleanProperty } from '../properties.js';
20
23
  mode: value === undefined ? 'indeterminate' : 'determinate',
21
24
  children: /*#__PURE__*/ jsx(ProgressBar.Track, {
22
25
  "data-scene-id": element.id,
26
+ "aria-label": stringProperty(element, 'label', 'Progress'),
23
27
  style: {
24
28
  height: '1rem'
25
29
  },
@@ -1 +1 @@
1
- {"version":3,"file":"PrimeProgressBar.js","sources":["../../../misc/PrimeProgressBar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ProgressBar } from 'primereact/progressbar';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty } from '../properties';\n\n/**\n * The `PrimeReact:progressBar` component - determinate or indeterminate progress.\n *\n * The mode follows whether a `value` was given at all: progress you cannot measure is exactly what\n * indeterminate mode is for, so an element with no value animates rather than sitting at zero.\n *\n * In PrimeReact 11 the root is a headless wrapper that renders no element of its own - `Track` is the\n * first real DOM node and the one carrying the ARIA `progressbar` role - so `data-scene-id` and the bar's\n * height belong there rather than on `Root`. `Indicator` renders its children only in determinate mode,\n * which is why the value label can be handed to it unconditionally: an indeterminate bar has no\n * percentage to print and drops it on its own.\n */\nexport function PrimeProgressBar({ element }: RegisteredComponentProps) {\n const value = numberProperty(element, 'value');\n return (\n <ProgressBar.Root value={value} mode={value === undefined ? 'indeterminate' : 'determinate'}>\n <ProgressBar.Track data-scene-id={element.id} style={{ height: '1rem' }}>\n <ProgressBar.Indicator>{booleanProperty(element, 'showValue', true) && <ProgressBar.Value />}</ProgressBar.Indicator>\n </ProgressBar.Track>\n </ProgressBar.Root>\n );\n}\n"],"names":["PrimeProgressBar","element","value","numberProperty","_jsx","ProgressBar","Root","mode","undefined","Track","data-scene-id","id","style","height","Indicator","booleanProperty","Value"],"mappings":";;;;AAOA;;;;;;;;;;;AAWC,IACM,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;IAClE,MAAMC,KAAAA,GAAQC,eAAeF,OAAAA,EAAS,OAAA,CAAA;IACtC,qBACIG,GAAA,CAACC,YAAYC,IAAI,EAAA;QAACJ,KAAAA,EAAOA,KAAAA;QAAOK,IAAAA,EAAML,KAAAA,KAAUM,YAAY,eAAA,GAAkB,aAAA;gCAC1EJ,GAAA,CAACC,YAAYI,KAAK,EAAA;AAACC,YAAAA,eAAAA,EAAeT,QAAQU,EAAE;YAAEC,KAAAA,EAAO;gBAAEC,MAAAA,EAAQ;AAAO,aAAA;oCAClET,GAAA,CAACC,YAAYS,SAAS,EAAA;AAAEC,gBAAAA,QAAAA,EAAAA,eAAAA,CAAgBd,OAAAA,EAAS,WAAA,EAAa,IAAA,CAAA,kBAASG,GAAA,CAACC,YAAYW,KAAK,EAAA,EAAA;;;;AAIzG;;"}
1
+ {"version":3,"file":"PrimeProgressBar.js","sources":["../../../misc/PrimeProgressBar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ProgressBar } from 'primereact/progressbar';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { booleanProperty, numberProperty, stringProperty } from '../properties';\n\n/**\n * The `PrimeReact:progressBar` component - determinate or indeterminate progress.\n *\n * The mode follows whether a `value` was given at all: progress you cannot measure is exactly what\n * indeterminate mode is for, so an element with no value animates rather than sitting at zero.\n *\n * In PrimeReact 11 the root is a headless wrapper that renders no element of its own - `Track` is the\n * first real DOM node and the one carrying the ARIA `progressbar` role - so `data-scene-id` and the bar's\n * height belong there rather than on `Root`. `Indicator` renders its children only in determinate mode,\n * which is why the value label can be handed to it unconditionally: an indeterminate bar has no\n * percentage to print and drops it on its own.\n *\n * A progress bar with no accessible name is announced as just \"progress bar\", so the element's `label` names\n * what is progressing (`Progress` when it says nothing), and screen readers read it with the value.\n */\nexport function PrimeProgressBar({ element }: RegisteredComponentProps) {\n const value = numberProperty(element, 'value');\n return (\n <ProgressBar.Root value={value} mode={value === undefined ? 'indeterminate' : 'determinate'}>\n <ProgressBar.Track data-scene-id={element.id} aria-label={stringProperty(element, 'label', 'Progress')} style={{ height: '1rem' }}>\n <ProgressBar.Indicator>{booleanProperty(element, 'showValue', true) && <ProgressBar.Value />}</ProgressBar.Indicator>\n </ProgressBar.Track>\n </ProgressBar.Root>\n );\n}\n"],"names":["PrimeProgressBar","element","value","numberProperty","_jsx","ProgressBar","Root","mode","undefined","Track","data-scene-id","id","aria-label","stringProperty","style","height","Indicator","booleanProperty","Value"],"mappings":";;;;AAOA;;;;;;;;;;;;;;AAcC,IACM,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAA4B,EAAA;IAClE,MAAMC,KAAAA,GAAQC,eAAeF,OAAAA,EAAS,OAAA,CAAA;IACtC,qBACIG,GAAA,CAACC,YAAYC,IAAI,EAAA;QAACJ,KAAAA,EAAOA,KAAAA;QAAOK,IAAAA,EAAML,KAAAA,KAAUM,YAAY,eAAA,GAAkB,aAAA;gCAC1EJ,GAAA,CAACC,YAAYI,KAAK,EAAA;AAACC,YAAAA,eAAAA,EAAeT,QAAQU,EAAE;YAAEC,YAAAA,EAAYC,cAAAA,CAAeZ,SAAS,OAAA,EAAS,UAAA,CAAA;YAAaa,KAAAA,EAAO;gBAAEC,MAAAA,EAAQ;AAAO,aAAA;oCAC5HX,GAAA,CAACC,YAAYW,SAAS,EAAA;AAAEC,gBAAAA,QAAAA,EAAAA,eAAAA,CAAgBhB,OAAAA,EAAS,WAAA,EAAa,IAAA,CAAA,kBAASG,GAAA,CAACC,YAAYa,KAAK,EAAA,EAAA;;;;AAIzG;;"}