@cratis/components 4.54.0 → 4.55.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.
Files changed (81) hide show
  1. package/compat-manifest.json +13 -13
  2. package/dist/esm/Common/CratisComponentsProvider.d.ts +4 -0
  3. package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
  4. package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
  5. package/dist/esm/DataTables/DataTableCard.d.ts +4 -0
  6. package/dist/esm/DataTables/DataTableCard.d.ts.map +1 -0
  7. package/dist/esm/DataTables/DataTableCard.js +43 -0
  8. package/dist/esm/DataTables/DataTableCard.js.map +1 -0
  9. package/dist/esm/DataTables/DataTableCardControls.d.ts +6 -0
  10. package/dist/esm/DataTables/DataTableCardControls.d.ts.map +1 -0
  11. package/dist/esm/DataTables/DataTableCardControls.js +27 -0
  12. package/dist/esm/DataTables/DataTableCardControls.js.map +1 -0
  13. package/dist/esm/DataTables/DataTableCards.d.ts +16 -0
  14. package/dist/esm/DataTables/DataTableCards.d.ts.map +1 -0
  15. package/dist/esm/DataTables/DataTableCards.js +40 -0
  16. package/dist/esm/DataTables/DataTableCards.js.map +1 -0
  17. package/dist/esm/DataTables/DataTableCore.d.ts +3 -1
  18. package/dist/esm/DataTables/DataTableCore.d.ts.map +1 -1
  19. package/dist/esm/DataTables/DataTableCore.js +8 -2
  20. package/dist/esm/DataTables/DataTableCore.js.map +1 -1
  21. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts +2 -1
  22. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts.map +1 -1
  23. package/dist/esm/DataTables/DataTableForObservableQuery.js +1 -1
  24. package/dist/esm/DataTables/DataTableForObservableQuery.js.map +1 -1
  25. package/dist/esm/DataTables/DataTableForQuery.d.ts +2 -1
  26. package/dist/esm/DataTables/DataTableForQuery.d.ts.map +1 -1
  27. package/dist/esm/DataTables/DataTableForQuery.js +1 -1
  28. package/dist/esm/DataTables/DataTableForQuery.js.map +1 -1
  29. package/dist/esm/DataTables/DataTableHeaderCell.d.ts +2 -2
  30. package/dist/esm/DataTables/DataTableHeaderCell.d.ts.map +1 -1
  31. package/dist/esm/DataTables/DataTableHeaderCell.js +5 -19
  32. package/dist/esm/DataTables/DataTableHeaderCell.js.map +1 -1
  33. package/dist/esm/DataTables/DataTableHeaderContent.d.ts +11 -0
  34. package/dist/esm/DataTables/DataTableHeaderContent.d.ts.map +1 -0
  35. package/dist/esm/DataTables/DataTableHeaderContent.js +37 -0
  36. package/dist/esm/DataTables/DataTableHeaderContent.js.map +1 -0
  37. package/dist/esm/DataTables/DataTableMessages.d.ts +2 -0
  38. package/dist/esm/DataTables/DataTableMessages.d.ts.map +1 -1
  39. package/dist/esm/DataTables/DataTableMessages.js.map +1 -1
  40. package/dist/esm/DataTables/DataTableMobileLayoutProps.d.ts +8 -0
  41. package/dist/esm/DataTables/DataTableMobileLayoutProps.d.ts.map +1 -0
  42. package/dist/esm/DataTables/DataTableMobileLayoutProps.js +4 -0
  43. package/dist/esm/DataTables/DataTableMobileLayoutProps.js.map +1 -0
  44. package/dist/esm/DataTables/DataTableParts.d.ts +12 -0
  45. package/dist/esm/DataTables/DataTableParts.d.ts.map +1 -1
  46. package/dist/esm/DataTables/DataTableParts.js.map +1 -1
  47. package/dist/esm/DataTables/DataTableRow.d.ts +3 -1
  48. package/dist/esm/DataTables/DataTableRow.d.ts.map +1 -1
  49. package/dist/esm/DataTables/DataTableRow.js +3 -9
  50. package/dist/esm/DataTables/DataTableRow.js.map +1 -1
  51. package/dist/esm/DataTables/DataTableRows.d.ts.map +1 -1
  52. package/dist/esm/DataTables/DataTableRows.js +1 -1
  53. package/dist/esm/DataTables/DataTableRows.js.map +1 -1
  54. package/dist/esm/DataTables/dataTableCellContent.d.ts +5 -0
  55. package/dist/esm/DataTables/dataTableCellContent.d.ts.map +1 -0
  56. package/dist/esm/DataTables/dataTableCellContent.js +11 -0
  57. package/dist/esm/DataTables/dataTableCellContent.js.map +1 -0
  58. package/dist/esm/DataTables/useDataTableMessages.d.ts.map +1 -1
  59. package/dist/esm/DataTables/useDataTableMessages.js +2 -0
  60. package/dist/esm/DataTables/useDataTableMessages.js.map +1 -1
  61. package/dist/esm/DataTables/useDataTablePresentationFocus.d.ts +3 -0
  62. package/dist/esm/DataTables/useDataTablePresentationFocus.d.ts.map +1 -0
  63. package/dist/esm/DataTables/useDataTablePresentationFocus.js +45 -0
  64. package/dist/esm/DataTables/useDataTablePresentationFocus.js.map +1 -0
  65. package/dist/esm/DataTables/useMobileLayout.d.ts +4 -0
  66. package/dist/esm/DataTables/useMobileLayout.d.ts.map +1 -0
  67. package/dist/esm/DataTables/useMobileLayout.js +20 -0
  68. package/dist/esm/DataTables/useMobileLayout.js.map +1 -0
  69. package/dist/esm/DataTables/useRowSelection.d.ts.map +1 -1
  70. package/dist/esm/DataTables/useRowSelection.js +1 -1
  71. package/dist/esm/DataTables/useRowSelection.js.map +1 -1
  72. package/dist/esm/styles.DataPage.css +66 -0
  73. package/dist/esm/styles.DataTables.css +66 -0
  74. package/dist/esm/styles.SchemaEditor.css +66 -0
  75. package/dist/esm/styles.css +66 -0
  76. package/dist/esm/styles.renderer.builtin.css +66 -0
  77. package/dist/esm/types/parts.d.ts +21 -3
  78. package/dist/esm/types/parts.d.ts.map +1 -1
  79. package/dist/esm/types/parts.js +21 -3
  80. package/dist/esm/types/parts.js.map +1 -1
  81. package/package.json +1 -1
@@ -70,7 +70,7 @@
70
70
  {
71
71
  "name": "@cratis/components",
72
72
  "role": "core",
73
- "version": "4.54.0",
73
+ "version": "4.55.0",
74
74
  "releaseMajorRange": ">=4 <5",
75
75
  "independentRelease": false,
76
76
  "private": false,
@@ -94,7 +94,7 @@
94
94
  {
95
95
  "name": "@cratis/eslint-plugin-components",
96
96
  "role": "eslint",
97
- "version": "4.54.0",
97
+ "version": "4.55.0",
98
98
  "releaseMajorRange": ">=4 <5",
99
99
  "independentRelease": false,
100
100
  "private": false,
@@ -107,7 +107,7 @@
107
107
  {
108
108
  "name": "@cratis/components.migrator",
109
109
  "role": "migrator",
110
- "version": "4.54.0",
110
+ "version": "4.55.0",
111
111
  "releaseMajorRange": ">=4 <5",
112
112
  "independentRelease": false,
113
113
  "private": false,
@@ -118,13 +118,13 @@
118
118
  {
119
119
  "name": "@cratis/components.conformance",
120
120
  "role": "conformance",
121
- "version": "4.54.0",
121
+ "version": "4.55.0",
122
122
  "releaseMajorRange": ">=4 <5",
123
123
  "independentRelease": false,
124
124
  "private": false,
125
125
  "packageAccess": "public",
126
126
  "peerDependencies": {
127
- "@cratis/components": "4.54.0",
127
+ "@cratis/components": "4.55.0",
128
128
  "react": "^19.0.0",
129
129
  "react-dom": "^19.0.0"
130
130
  },
@@ -134,13 +134,13 @@
134
134
  {
135
135
  "name": "@cratis/components.mui",
136
136
  "role": "renderer-adapter",
137
- "version": "4.54.0",
137
+ "version": "4.55.0",
138
138
  "releaseMajorRange": ">=4 <5",
139
139
  "independentRelease": false,
140
140
  "private": false,
141
141
  "packageAccess": "public",
142
142
  "peerDependencies": {
143
- "@cratis/components": "4.54.0",
143
+ "@cratis/components": "4.55.0",
144
144
  "@emotion/react": ">=11.5 <12",
145
145
  "@emotion/styled": ">=11.11 <12",
146
146
  "@mui/material": ">=9 <10",
@@ -190,13 +190,13 @@
190
190
  {
191
191
  "name": "@cratis/components.primereact",
192
192
  "role": "renderer-adapter",
193
- "version": "4.54.0",
193
+ "version": "4.55.0",
194
194
  "releaseMajorRange": ">=4 <5",
195
195
  "independentRelease": false,
196
196
  "private": false,
197
197
  "packageAccess": "public",
198
198
  "peerDependencies": {
199
- "@cratis/components": "4.54.0",
199
+ "@cratis/components": "4.55.0",
200
200
  "@primereact/core": ">=11 <12",
201
201
  "@primereact/ui": ">=11 <12",
202
202
  "@primeuix/themes": ">=3 <4",
@@ -258,13 +258,13 @@
258
258
  {
259
259
  "name": "@cratis/components.primereact10",
260
260
  "role": "renderer-adapter",
261
- "version": "4.54.0",
261
+ "version": "4.55.0",
262
262
  "releaseMajorRange": ">=4 <5",
263
263
  "independentRelease": false,
264
264
  "private": false,
265
265
  "packageAccess": "public",
266
266
  "peerDependencies": {
267
- "@cratis/components": "4.54.0",
267
+ "@cratis/components": "4.55.0",
268
268
  "primereact": ">=10.9.9 <11",
269
269
  "react": "^19.0.0",
270
270
  "react-dom": "^19.0.0"
@@ -306,13 +306,13 @@
306
306
  {
307
307
  "name": "@cratis/components.designsystemet",
308
308
  "role": "renderer-adapter",
309
- "version": "4.54.0",
309
+ "version": "4.55.0",
310
310
  "releaseMajorRange": ">=4 <5",
311
311
  "independentRelease": false,
312
312
  "private": false,
313
313
  "packageAccess": "public",
314
314
  "peerDependencies": {
315
- "@cratis/components": "4.54.0",
315
+ "@cratis/components": "4.55.0",
316
316
  "@digdir/designsystemet-css": ">=1.24 <2",
317
317
  "@digdir/designsystemet-react": ">=1.24 <2",
318
318
  "react": "^19.0.0",
@@ -94,6 +94,10 @@ export interface CratisDataTableMessages {
94
94
  selectRow?: string;
95
95
  /** Accessible name for the select-all control in a multiple-selection header. */
96
96
  selectAllRows?: string;
97
+ /** Audible ascending sort direction in card controls. Defaults to 'Ascending'. */
98
+ sortAscending?: string;
99
+ /** Audible descending sort direction in card controls. Defaults to 'Descending'. */
100
+ sortDescending?: string;
97
101
  /** Placeholder for the loaded-page search input. */
98
102
  search?: string;
99
103
  /** Accessible name for the loaded-page search input. */
@@ -1 +1 @@
1
- {"version":3,"file":"CratisComponentsProvider.d.ts","sourceRoot":"","sources":["../../../Common/CratisComponentsProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIhD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,6BAA0B,CAAC;AAEtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAgC,CAAC;AAG/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BAAmB,CAAC;IACpC,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,UAC7B,sBAAsB,GAAG,SAAS,KAC1C,sBAIF,CAAC;AAWF,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,kIAUlC,6BAA6B,gCA+B/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CratisComponentsProvider.js","sources":["../../../Common/CratisComponentsProvider.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 { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { RouterProvider } from 'react-aria-components';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nimport type { DialogHeaderActionsRenderer } from '../configuration/DialogHeaderActionsRenderer';\nimport { withLegacyLocaleMessages } from './legacyLocaleMessages';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n /** Builds the visible range text from the one-based start, the clamped end and the total. Defaults to `start–end of total`. */\n range?: (start: number, end: number, total: number) => string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n /**\n * Polite announcement made when a confirm is refused and the dialog stays open\n * (validation failure or business rule). Defaults to\n * 'The action was not completed. Review the dialog and try again.'\n */\n refused?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n /** Message shown when a search or filter leaves no rows on the loaded page. */\n filteredEmpty?: string;\n /** Message shown when a search or filter leaves no rows in server mode. */\n filteredEmptyServer?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Application routing callbacks used by Components links. */\nexport interface CratisComponentsRouter {\n /** Navigate to the original link destination for an ordinary same-origin activation. */\n navigate: (href: string) => void;\n /** Resolve a destination to the rendered href, for example to include a router basename. */\n useHref?: (href: string) => string;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** Optional client-side router. Omit to retain native or inherited routing behavior. */\n router?: CratisComponentsRouter;\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * App-wide dialog header actions, set through the provider's `dialogHeaderActions` prop. Read by\n * `Dialog`, `CommandDialog` and `StepperCommandDialog`.\n */\n dialogHeaderActions?: DialogHeaderActionsRenderer;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /**\n * Registers header actions once for every dialog. The renderer receives each dialog's\n * `DialogHeaderContext`, and may return `null` to hide itself for that dialog. The result\n * renders before the close button, next to any per-dialog `headerActions`; a dialog opts out\n * with `hideGlobalHeaderActions`.\n */\n dialogHeaderActions?: DialogHeaderActionsRenderer;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n dialogHeaderActions,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(() => {\n const config = withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages);\n const headerActions = dialogHeaderActions ?? value?.dialogHeaderActions;\n return headerActions ? { ...config, dialogHeaderActions: headerActions } : config;\n }, [value, dialogHeaderActions]);\n\n const content = (\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && <Toaster {...(typeof toaster === 'object' ? toaster : {})} />}\n </I18nProvider>\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n {resolved.router ? (\n <RouterProvider navigate={resolved.router.navigate} useHref={resolved.router.useHref}>\n {content}\n </RouterProvider>\n ) : content}\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,YAAY,GAAG,qBAAqB;AAuSnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,IAAI,CAA2B;IACpE,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAAM;AACvF;AAEA,MAAM,WAAW,GAAG,CAAC,MAA0B,KAAI;AAC/C,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,OAAO;AAC3B,IAAA,IAAI;QACA,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAC7C;AAAE,IAAA,MAAM;AACJ,QAAA,OAAO,OAAO;IAClB;AACJ,CAAC;AAGM,MAAM,wBAAwB,GAAG,CAAC,EACrC,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EAC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["// 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 { useMemo, type ReactNode } from 'react';\nimport { I18nProvider } from 'react-aria-components/I18nProvider';\nimport { RouterProvider } from 'react-aria-components';\nimport { merge } from 'ts-deepmerge';\nimport { Toaster, type ToasterProps } from '../Notifications/Toaster';\nimport { unstable_RendererRoot } from '../renderer/RendererContext';\nimport type { CratisRendererSetup, unstable_UiLibrary } from '../renderer/manifest';\nimport type { CratisOverlayEnvironment } from '../renderer/overlayEnvironment';\nimport { CratisComponentsContext } from '../configuration/CratisComponentsContext';\nimport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nimport type { DialogHeaderActionsRenderer } from '../configuration/DialogHeaderActionsRenderer';\nimport { withLegacyLocaleMessages } from './legacyLocaleMessages';\n\nconst RendererRoot = unstable_RendererRoot;\n\nexport { cratisDefaults } from '../configuration/CratisComponentsDefaults';\nexport { useCratisComponentsConfig } from '../configuration/CratisComponentsContext';\n\n/** Localizable labels owned by the Cratis paginator. */\nexport interface CratisPaginatorMessages {\n /** Pagination navigation-region name. */\n navigation?: string;\n /** First-page action label. */\n first?: string;\n /** Previous-page action label. */\n previous?: string;\n /** Next-page action label. */\n next?: string;\n /** Last-page action label. */\n last?: string;\n /** Builds a numbered page button's accessible name from its one-based page number. */\n page?: (page: number) => string;\n /** Accessible name for the numbered-page group. */\n pages?: string;\n /** Builds the visible range text from the one-based start, the clamped end and the total. Defaults to `start–end of total`. */\n range?: (start: number, end: number, total: number) => string;\n}\n\n/** Localizable labels owned by the Cratis date picker composition. */\nexport interface CratisDatePickerMessages {\n /** Today action label. */\n today?: string;\n /** Clear action label. */\n clear?: string;\n /** Calendar-trigger label. */\n openCalendar?: string;\n /** Previous-month action label. */\n previousMonth?: string;\n /** Next-month action label. */\n nextMonth?: string;\n /**\n * Accessible name for the segmented date input when neither an explicit\n * `aria-label` nor a `placeholder` is supplied. Previously an orphaned\n * `'Date'` literal with no override path.\n */\n label?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Dropdown} composition. */\nexport interface CratisDropdownMessages {\n /** Accessible name for the options-popover trigger. */\n showOptions?: string;\n /** Accessible name for the clear-selection action. */\n clearSelection?: string;\n}\n\n/**\n * Localizable action and dismissal labels shared by every Cratis-owned dialog\n * surface — {@link Dialog}, {@link CommandDialog}, and {@link StepperCommandDialog}.\n */\nexport interface CratisDialogMessages {\n /** Primary confirmation label (the `Ok` action in `DialogButtons.Ok*`). */\n ok?: string;\n /** Cancellation label (the `Cancel` action, and the Stepper footer Cancel). */\n cancel?: string;\n /** Affirmative label (the `Yes` action in `DialogButtons.YesNo*`). */\n yes?: string;\n /** Negative label (the `No` action in `DialogButtons.YesNo*`). */\n no?: string;\n /** Accessible name for the header close (×) action. */\n close?: string;\n /**\n * Polite announcement made when a confirm is refused and the dialog stays open\n * (validation failure or business rule). Defaults to\n * 'The action was not completed. Review the dialog and try again.'\n */\n refused?: string;\n}\n\n/** Localizable navigation labels owned by {@link CommandStepper} / {@link StepperCommandDialog}. */\nexport interface CratisStepperMessages {\n /** Advance-to-next-step action label. */\n next?: string;\n /** Return-to-previous-step action label. */\n previous?: string;\n /** Final-step submit action label. */\n submit?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toaster}. */\nexport interface CratisNotificationsMessages {\n /** Accessible name for a toast's dismiss action. */\n dismiss?: string;\n /** Accessible name for the toast region landmark. */\n region?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link DataTableCore} composition. */\nexport interface CratisDataTableMessages {\n /** Accessible name for a single-selection row control. */\n selectRow?: string;\n /** Accessible name for the select-all control in a multiple-selection header. */\n selectAllRows?: string;\n /** Audible ascending sort direction in card controls. Defaults to 'Ascending'. */\n sortAscending?: string;\n /** Audible descending sort direction in card controls. Defaults to 'Descending'. */\n sortDescending?: string;\n /** Placeholder for the loaded-page search input. */\n search?: string;\n /** Accessible name for the loaded-page search input. */\n searchAriaLabel?: string;\n /** Message shown while loading an empty table. */\n loading?: string;\n /** Message shown when a query fails. */\n failed?: string;\n /** Message shown when a query denies access. */\n unauthorized?: string;\n /** Message shown when a search or filter leaves no rows on the loaded page. */\n filteredEmpty?: string;\n /** Message shown when a search or filter leaves no rows in server mode. */\n filteredEmptyServer?: string;\n}\n\n/** Localizable accessible names for the Cratis filter panel and its searches. */\nexport interface CratisFilterMessages {\n /** FilterPanel dialog name. Defaults to 'Filters'. */\n label?: string;\n /**\n * Search-input name for FilterPanel, its option groups, and standalone CheckboxListFilter.\n * Unset by default so an effective search placeholder retains precedence over 'Search'.\n * PivotViewer supplies group-specific names instead of using this shared name for its groups.\n */\n searchAriaLabel?: string;\n}\n\n/** Localizable labels owned by the Cratis column-filter popup. */\nexport interface CratisColumnFilterMessages {\n /** Builds the filter-trigger accessible name from the effective field. */\n filterTriggerAriaLabel?: (field: string) => string;\n /** Builds the value-control accessible name from the effective field. */\n valueAriaLabel?: (field: string) => string;\n /** Accessible name for the match-mode selector. */\n matchModeAriaLabel?: string;\n /** Localizes a match mode while retaining its default label as fallback input. */\n matchModeLabel?: (mode: string, defaultLabel: string) => string;\n /** Clear action label. */\n clear?: string;\n /** Apply action label. */\n apply?: string;\n /** Boolean true option label. */\n true?: string;\n /** Boolean false option label. */\n false?: string;\n}\n\n/** Localizable labels owned by the Cratis {@link Toolbar} composition. */\nexport interface CratisToolbarMessages {\n /** Accessible toolbar name used when neither `aria-label` nor `aria-labelledby` is supplied. */\n label?: string;\n /** Accessible name of the close button in a drawer {@link ToolbarFolder}. Defaults to 'Close'. */\n closeDrawer?: string;\n}\n\n/** Components-owned message groups. */\nexport interface CratisComponentsMessages {\n /** Paginator labels. */\n paginator?: CratisPaginatorMessages;\n /** Date-picker labels. */\n datePicker?: CratisDatePickerMessages;\n /** Dropdown labels. */\n dropdown?: CratisDropdownMessages;\n /** Dialog action/dismissal labels shared by Dialog, CommandDialog, and StepperCommandDialog. */\n dialog?: CratisDialogMessages;\n /** Stepper navigation labels shared by CommandStepper and StepperCommandDialog. */\n stepper?: CratisStepperMessages;\n /** Toaster labels. */\n notifications?: CratisNotificationsMessages;\n /** DataTable search, selection, and query-state messages. */\n dataTable?: CratisDataTableMessages;\n /** FilterPanel dialog and search-input accessible names. */\n filter?: CratisFilterMessages;\n /** Column-filter popup labels and match-mode copy. */\n columnFilter?: CratisColumnFilterMessages;\n /** Toolbar accessible-name fallback. */\n toolbar?: CratisToolbarMessages;\n}\n\n/**\n * Components-owned icon vocabulary. Every name is a concept the library draws in more than one\n * place; registering one replaces that concept's built-in glyph everywhere it is drawn, without\n * touching the surrounding element, its part, or its accessible name.\n *\n * Resolution per site is `per-component prop → provider icon → built-in glyph`: a named prop such\n * as `Dialog`'s `closeIcon` means \"this one call site\" and keeps winning, while the provider\n * replaces the built-in default for the whole product. Registering nothing renders exactly what the\n * library renders today, because the built-in glyph stays at its call site and is never part of\n * {@link cratisDefaults}.\n *\n * A name registered as `null` draws no glyph while the button, its part, and its accessible name\n * remain — the same meaning `closeIcon={null}` already has.\n */\nexport interface CratisComponentsIcons {\n /** Dismissal mark. Drawn by `Dialog`'s header close, `Toaster`'s dismiss, `ChatSidebar`, the `Chat` panel, and the PivotViewer detail panel. Defaults to `×`. */\n close?: ReactNode;\n /** Remove-this-value mark. Drawn by `TagGroup`'s tag remove, `Chip`'s remove control, and `CommandForm`'s chips field. Defaults to `×`. */\n remove?: ReactNode;\n /** Expand/collapse chevron on a closed-by-default surface. Drawn by `Dropdown`'s trigger and `ComboBox`'s trigger. Defaults to `⌄` (`▾` in `ComboBox`). */\n expand?: ReactNode;\n /** Ascending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▲`. */\n sortAscending?: ReactNode;\n /** Descending sort indicator. Drawn by `DataTableCore`'s sortable column header. Defaults to `▼`. */\n sortDescending?: ReactNode;\n /** Step-backwards mark. Drawn by `TablePaginator`'s previous page and the date picker's previous month. Defaults to `‹`. */\n previous?: ReactNode;\n /** Step-forwards mark. Drawn by `TablePaginator`'s next page and the date picker's next month. Defaults to `›`. */\n next?: ReactNode;\n /** Clear-the-current-value mark. Drawn by `Dropdown`'s clear-selection action and the PivotViewer filter panel's clear action. Defaults to `×`. */\n clear?: ReactNode;\n}\n\ninterface LegacyLocaleMessages {\n today?: string;\n clear?: string;\n aria?: {\n navigation?: string;\n firstPageLabel?: string;\n prevPageLabel?: string;\n nextPageLabel?: string;\n lastPageLabel?: string;\n };\n [message: string]: unknown;\n}\n\n/** Application routing callbacks used by Components links. */\nexport interface CratisComponentsRouter {\n /** Navigate to the original link destination for an ordinary same-origin activation. */\n navigate: (href: string) => void;\n /** Resolve a destination to the rendered href, for example to include a router basename. */\n useHref?: (href: string) => string;\n}\n\n/** Renderer-independent application configuration for Components. */\nexport interface CratisComponentsConfig {\n /** Optional client-side router. Omit to retain native or inherited routing behavior. */\n router?: CratisComponentsRouter;\n /** BCP 47 locale used by React Aria for dates, numbers, and interaction announcements. */\n locale?: string;\n /** Cratis-owned labels not supplied by the platform's internationalization APIs. */\n messages?: CratisComponentsMessages;\n /** Cratis-owned icon vocabulary replacing the built-in glyphs the library draws. */\n icons?: CratisComponentsIcons;\n /**\n * App-wide dialog header actions, set through the provider's `dialogHeaderActions` prop. Read by\n * `Dialog`, `CommandDialog` and `StepperCommandDialog`.\n */\n dialogHeaderActions?: DialogHeaderActionsRenderer;\n /**\n * @deprecated Use {@link messages}; React Aria supplies its own locale data.\n */\n locales?: Record<string, LegacyLocaleMessages>;\n}\n\n/** Props for the application-root Components provider. */\nexport interface CratisComponentsProviderProps {\n /** Locale and Components-owned messages. */\n value?: CratisComponentsConfig;\n /**\n * Registers header actions once for every dialog. The renderer receives each dialog's\n * `DialogHeaderContext`, and may return `null` to hide itself for that dialog. The result\n * renders before the close button, next to any per-dialog `headerActions`; a dialog opts out\n * with `hideGlobalHeaderActions`.\n */\n dialogHeaderActions?: DialogHeaderActionsRenderer;\n /** Mounts the global toaster with defaults or explicit options. */\n toaster?: boolean | ToasterProps;\n /**\n * Selects one stable presentation library. The broader generic manifest and ordered,\n * last-wins composition form remain experimental.\n */\n library?: unstable_UiLibrary | readonly unstable_UiLibrary[];\n /** Experimental profile-promise behavior. Defaults to strict. */\n libraryMode?: 'strict' | 'degrade';\n /** Terminal slot fallback behavior. Defaults to the built-in Core implementation. */\n rendererFallback?: 'core' | 'throw';\n /** Host environment for overlay portal containers. */\n overlayEnvironment?: CratisOverlayEnvironment;\n /**\n * Non-secret renderer setup attestations. Values are booleans so credentials and license\n * tokens never cross the Components provider boundary.\n */\n rendererSetup?: CratisRendererSetup;\n /** Application content. */\n children: ReactNode;\n}\n\n/**\n * Deep-merges consumer configuration over {@link cratisDefaults}.\n *\n * `icons` merges by name only. An icon value is an opaque node — often a React element — so it is\n * carried over by identity instead of being deep-merged into, while a partial map still leaves every\n * unregistered name to its built-in glyph.\n */\nexport const mergeCratisComponentsConfig = (\n value: CratisComponentsConfig | undefined,\n): CratisComponentsConfig => {\n const { icons, ...rest } = value ?? {};\n const merged = merge(cratisDefaults, rest) as CratisComponentsConfig;\n return icons ? { ...merged, icons: { ...cratisDefaults.icons, ...icons } } : merged;\n};\n\nconst validLocale = (locale: string | undefined) => {\n if (!locale) return 'en-US';\n try {\n return new Intl.Locale(locale).toString();\n } catch {\n return 'en-US';\n }\n};\n\n/** Application root for locale, labels, and the optional app-wide toaster. */\nexport const CratisComponentsProvider = ({\n value,\n dialogHeaderActions,\n toaster,\n library,\n libraryMode,\n rendererFallback,\n overlayEnvironment,\n rendererSetup,\n children,\n}: CratisComponentsProviderProps) => {\n const resolved = useMemo(() => {\n const config = withLegacyLocaleMessages(mergeCratisComponentsConfig(value), value?.messages);\n const headerActions = dialogHeaderActions ?? value?.dialogHeaderActions;\n return headerActions ? { ...config, dialogHeaderActions: headerActions } : config;\n }, [value, dialogHeaderActions]);\n\n const content = (\n <I18nProvider locale={validLocale(resolved.locale)}>\n {children}\n {toaster && <Toaster {...(typeof toaster === 'object' ? toaster : {})} />}\n </I18nProvider>\n );\n\n return (\n <RendererRoot\n library={library}\n libraryMode={libraryMode}\n rendererFallback={rendererFallback}\n overlayEnvironment={overlayEnvironment}\n rendererSetup={rendererSetup}\n >\n <CratisComponentsContext.Provider value={resolved}>\n {resolved.router ? (\n <RouterProvider navigate={resolved.router.navigate} useHref={resolved.router.useHref}>\n {content}\n </RouterProvider>\n ) : content}\n </CratisComponentsContext.Provider>\n </RendererRoot>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,YAAY,GAAG,qBAAqB;AA2SnC,MAAM,2BAA2B,GAAG,CACvC,KAAyC,KACjB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE,IAAI,CAA2B;IACpE,OAAO,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MAAM;AACvF;AAEA,MAAM,WAAW,GAAG,CAAC,MAA0B,KAAI;AAC/C,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,OAAO;AAC3B,IAAA,IAAI;QACA,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IAC7C;AAAE,IAAA,MAAM;AACJ,QAAA,OAAO,OAAO;IAClB;AACJ,CAAC;AAGM,MAAM,wBAAwB,GAAG,CAAC,EACrC,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,QAAQ,GACoB,KAAI;AAChC,IAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAK;AAC1B,QAAA,MAAM,MAAM,GAAG,wBAAwB,CAAC,2BAA2B,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC;AAC5F,QAAA,MAAM,aAAa,GAAG,mBAAmB,IAAI,KAAK,EAAE,mBAAmB;AACvE,QAAA,OAAO,aAAa,GAAG,EAAE,GAAG,MAAM,EAAE,mBAAmB,EAAE,aAAa,EAAE,GAAG,MAAM;AACrF,IAAA,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;AAEhC,IAAA,MAAM,OAAO,IACTA,IAAA,CAAC,YAAY,IAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAA,QAAA,EAAA,CAC7C,QAAQ,EACR,OAAO,IAAIC,GAAA,CAAC,OAAO,QAAM,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,EAAE,CAAC,EAAA,CAAI,CAAA,EAAA,CAC9D,CAClB;AAED,IAAA,QACIA,GAAA,CAAC,YAAY,EAAA,EACT,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAAA,QAAA,EAE5BA,GAAA,CAAC,uBAAuB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,QAAQ,EAAA,QAAA,EAC5C,QAAQ,CAAC,MAAM,IACZA,IAAC,cAAc,EAAA,EAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,YAC/E,OAAO,EAAA,CACK,IACjB,OAAO,EAAA,CACoB,EAAA,CACxB;AAEvB;;"}
@@ -0,0 +1,4 @@
1
+ import type { DataTableRowProps } from './DataTableRow.js';
2
+ /** One semantic card for the same processed row and activation callbacks as the table. */
3
+ export declare const DataTableCard: <TData extends object>(props: DataTableRowProps<TData>) => import("react").JSX.Element;
4
+ //# sourceMappingURL=DataTableCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableCard.d.ts","sourceRoot":"","sources":["../../../DataTables/DataTableCard.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAgB,CAAC;AAsDxD,0FAA0F;AAC1F,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,MAAM,SAAS,iBAAiB,CAAC,KAAK,CAAC,gCAalF,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { classNames } from '../ClassNames/classNames.js';
3
+ import { dataTableCellContent } from './dataTableCellContent.js';
4
+
5
+ const interactiveDescendant = 'a, button, input, select, textarea, label, summary, [contenteditable]:not([contenteditable="false"]), [role="button"], [role="link"], [tabindex]';
6
+ const hasInteractiveTarget = (event) => {
7
+ const target = event.target;
8
+ if (!(target instanceof Element))
9
+ return false;
10
+ if (target.hasAttribute('data-cratis-card-selection'))
11
+ return false;
12
+ const interactive = target.closest(interactiveDescendant);
13
+ return !!interactive && interactive !== event.currentTarget;
14
+ };
15
+ const activateOnClick = (event, props) => {
16
+ props.parts?.card?.onClick?.(event);
17
+ if (!event.defaultPrevented && !hasInteractiveTarget(event))
18
+ props.onActivate(event);
19
+ };
20
+ const activateOnKey = (event, props) => {
21
+ props.parts?.card?.onKeyDown?.(event);
22
+ if (event.defaultPrevented || event.target !== event.currentTarget)
23
+ return;
24
+ if (event.key !== 'Enter' && event.key !== ' ')
25
+ return;
26
+ event.preventDefault();
27
+ props.onActivate(event);
28
+ };
29
+ const CardSelection = (props) => {
30
+ const { selectionMode, selectionGroupName, resolvedSelectionAriaLabel, isSelected, isRowSelected, onToggleSelection } = props;
31
+ if (!selectionMode)
32
+ return null;
33
+ const multiple = selectionMode === 'multiple';
34
+ return jsx("input", { type: multiple ? 'checkbox' : 'radio', name: multiple ? undefined : selectionGroupName, "aria-label": resolvedSelectionAriaLabel, checked: multiple ? isRowSelected : isSelected, readOnly: !multiple, tabIndex: multiple ? undefined : -1, "data-cratis-card-selection": multiple ? undefined : 'single', onChange: multiple ? onToggleSelection : undefined });
35
+ };
36
+ const CardFields = ({ columns, row, parts: pt }) => (jsx("dl", { children: columns.filter(column => !column.props.selectionMode).map((column, index) => (jsxs("div", { className: 'cratis-datatable__card-field', children: [jsx("dt", { ...pt?.cardLabel, className: classNames('cratis-datatable__card-label', pt?.cardLabel?.className), "data-cratis-component": 'DataTableCore', "data-cratis-part": 'card-label', children: column.props.header ?? column.props.field ?? '' }), jsx("dd", { ...pt?.cardValue, style: { ...pt?.cardValue?.style, ...column.props.style, ...column.props.bodyStyle }, className: classNames('cratis-datatable__card-value', pt?.cardValue?.className, column.props.bodyClassName ?? column.props.className), "data-cratis-component": 'DataTableCore', "data-cratis-part": 'card-value', children: dataTableCellContent(column.props, row) })] }, index))) }));
37
+ const DataTableCard = (props) => {
38
+ const { row, rowKey, parts: pt, isSelected, isInteractive, isRowSelected, rowClassName } = props;
39
+ return (jsxs("li", { ...pt?.card, tabIndex: isInteractive ? 0 : pt?.card?.tabIndex, className: classNames('cratis-datatable__card', pt?.card?.className, rowClassName?.(row)), "data-cratis-component": 'DataTableCore', "data-cratis-part": 'card', "data-datatable-row-key": rowKey, "data-selected": isSelected || isRowSelected || undefined, "data-interactive": isInteractive || undefined, onClick: event => activateOnClick(event, props), onKeyDown: event => activateOnKey(event, props), children: [jsx(CardSelection, { ...props }), jsx(CardFields, { ...props })] }));
40
+ };
41
+
42
+ export { DataTableCard };
43
+ //# sourceMappingURL=DataTableCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableCard.js","sources":["../../../DataTables/DataTableCard.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 type { KeyboardEvent, MouseEvent } from 'react';\nimport { classNames } from '../ClassNames/classNames';\nimport type { DataTableRowProps } from './DataTableRow';\nimport { dataTableCellContent } from './dataTableCellContent';\n\nconst interactiveDescendant = 'a, button, input, select, textarea, label, summary, [contenteditable]:not([contenteditable=\"false\"]), [role=\"button\"], [role=\"link\"], [tabindex]';\n\nconst hasInteractiveTarget = (event: MouseEvent<HTMLLIElement>) => {\n const target = event.target;\n if (!(target instanceof Element)) return false;\n if (target.hasAttribute('data-cratis-card-selection')) return false;\n const interactive = target.closest(interactiveDescendant);\n return !!interactive && interactive !== event.currentTarget;\n};\n\nconst activateOnClick = <TData extends object>(event: MouseEvent<HTMLLIElement>, props: DataTableRowProps<TData>) => {\n props.parts?.card?.onClick?.(event);\n if (!event.defaultPrevented && !hasInteractiveTarget(event)) props.onActivate(event);\n};\n\nconst activateOnKey = <TData extends object>(event: KeyboardEvent<HTMLLIElement>, props: DataTableRowProps<TData>) => {\n props.parts?.card?.onKeyDown?.(event);\n if (event.defaultPrevented || event.target !== event.currentTarget) return;\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n props.onActivate(event);\n};\n\nconst CardSelection = <TData extends object>(props: DataTableRowProps<TData>) => {\n const { selectionMode, selectionGroupName, resolvedSelectionAriaLabel, isSelected, isRowSelected, onToggleSelection } = props;\n if (!selectionMode) return null;\n const multiple = selectionMode === 'multiple';\n return <input type={multiple ? 'checkbox' : 'radio'} name={multiple ? undefined : selectionGroupName}\n aria-label={resolvedSelectionAriaLabel} checked={multiple ? isRowSelected : isSelected}\n readOnly={!multiple} tabIndex={multiple ? undefined : -1}\n data-cratis-card-selection={multiple ? undefined : 'single'}\n onChange={multiple ? onToggleSelection : undefined} />;\n};\n\nconst CardFields = <TData extends object>({ columns, row, parts: pt }: DataTableRowProps<TData>) => (\n <dl>\n {columns.filter(column => !column.props.selectionMode).map((column, index) => (\n <div key={index} className='cratis-datatable__card-field'>\n <dt {...pt?.cardLabel} className={classNames('cratis-datatable__card-label', pt?.cardLabel?.className)} data-cratis-component='DataTableCore' data-cratis-part='card-label'>\n {column.props.header ?? column.props.field ?? ''}\n </dt>\n <dd {...pt?.cardValue} style={{ ...pt?.cardValue?.style, ...column.props.style, ...column.props.bodyStyle }}\n className={classNames('cratis-datatable__card-value', pt?.cardValue?.className, column.props.bodyClassName ?? column.props.className)}\n data-cratis-component='DataTableCore' data-cratis-part='card-value'>\n {dataTableCellContent(column.props, row)}\n </dd>\n </div>\n ))}\n </dl>\n);\n\n/** One semantic card for the same processed row and activation callbacks as the table. */\nexport const DataTableCard = <TData extends object>(props: DataTableRowProps<TData>) => {\n const { row, rowKey, parts: pt, isSelected, isInteractive, isRowSelected, rowClassName } = props;\n return (\n <li {...pt?.card}\n tabIndex={isInteractive ? 0 : pt?.card?.tabIndex}\n className={classNames('cratis-datatable__card', pt?.card?.className, rowClassName?.(row))}\n data-cratis-component='DataTableCore' data-cratis-part='card' data-datatable-row-key={rowKey}\n data-selected={isSelected || isRowSelected || undefined} data-interactive={isInteractive || undefined}\n onClick={event => activateOnClick(event, props)} onKeyDown={event => activateOnKey(event, props)}>\n <CardSelection {...props} />\n <CardFields {...props} />\n </li>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;AAQA,MAAM,qBAAqB,GAAG,kJAAkJ;AAEhL,MAAM,oBAAoB,GAAG,CAAC,KAAgC,KAAI;AAC9D,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;AAC3B,IAAA,IAAI,EAAE,MAAM,YAAY,OAAO,CAAC;AAAE,QAAA,OAAO,KAAK;AAC9C,IAAA,IAAI,MAAM,CAAC,YAAY,CAAC,4BAA4B,CAAC;AAAE,QAAA,OAAO,KAAK;IACnE,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC;IACzD,OAAO,CAAC,CAAC,WAAW,IAAI,WAAW,KAAK,KAAK,CAAC,aAAa;AAC/D,CAAC;AAED,MAAM,eAAe,GAAG,CAAuB,KAAgC,EAAE,KAA+B,KAAI;IAChH,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACnC,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;AAAE,QAAA,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC;AACxF,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aAAa,GAAG,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAChD,SAAS,EAAE,UAAU,CAAC,wBAAwB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,GAAG,GAAG,CAAC,CAAC,EAAA,uBAAA,EACnE,eAAe,EAAA,kBAAA,EAAkB,MAAM,EAAA,wBAAA,EAAyB,MAAM,EAAA,eAAA,EAC7E,UAAU,IAAI,aAAa,IAAI,SAAS,EAAA,kBAAA,EAAoB,aAAa,IAAI,SAAS,EACrG,OAAO,EAAE,KAAK,IAAI,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,IAAI,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,aAChGD,GAAA,CAAC,aAAa,OAAK,KAAK,EAAA,CAAI,EAC5BA,GAAA,CAAC,UAAU,OAAK,KAAK,EAAA,CAAI,CAAA,EAAA,CACxB;AAEb;;"}
@@ -0,0 +1,6 @@
1
+ import type { DataTableHeadProps } from './DataTableHead.js';
2
+ /** The one reachable set of column and select-all controls while the table is unmounted. */
3
+ export declare const DataTableCardControls: ({ columns, parts: pt, messages, selection, selectionMode, ...controls }: DataTableHeadProps & {
4
+ selectionMode?: 'single' | 'multiple';
5
+ }) => import("react").JSX.Element;
6
+ //# sourceMappingURL=DataTableCardControls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableCardControls.d.ts","sourceRoot":"","sources":["../../../DataTables/DataTableCardControls.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAiB,CAAC;AAO1D,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,4EAA6E,kBAAkB,GAAG;IAAE,aAAa,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;CAAE,gCAyB5K,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { cloneElement } from 'react';
3
+ import { classNames } from '../ClassNames/classNames.js';
4
+ import { useComponentPresentation } from '../configuration/identity/useComponentPresentation.js';
5
+ import { useCratisIcon } from '../configuration/useCratisIcon.js';
6
+ import { columnDescriptor } from './columnDescriptor.js';
7
+ import { DataTableSelectAll, DataTableHeaderContent } from './DataTableHeaderContent.js';
8
+
9
+ const CardColumnControl = (props) => {
10
+ const [columnProps, marker] = useComponentPresentation(columnDescriptor, props.column.props, props.column.props.field);
11
+ return jsx("div", { ...marker, children: jsx(DataTableHeaderContent, { ...props, cardMode: true, column: cloneElement(props.column, columnProps) }) });
12
+ };
13
+ const DataTableCardControls = ({ columns, parts: pt, messages, selection, selectionMode, ...controls }) => {
14
+ const icon = useCratisIcon();
15
+ const selectionProps = {
16
+ resolvedSelectAllAriaLabel: messages.resolvedSelectAllAriaLabel,
17
+ allFilteredRowsSelected: selection.allFilteredRowsSelected,
18
+ selectAllRef: selection.selectAllRef,
19
+ toggleSelectAll: selection.toggleSelectAll,
20
+ };
21
+ return (jsxs("div", { ...pt?.cardControls, className: classNames('cratis-datatable__card-controls', pt?.cardControls?.className), "data-cratis-component": 'DataTableCore', "data-cratis-part": 'card-controls', children: [selectionMode === 'multiple' && jsx(DataTableSelectAll, { ...selectionProps }), columns.filter(column => !column.props.selectionMode && (column.props.sortable || column.props.filter)).map((column, index) => (jsx(CardColumnControl, { ...controls, ...selectionProps, column: column, parts: pt, resolvedSelectionAriaLabel: messages.resolvedSelectionAriaLabel, sortAscendingIcon: icon('sortAscending', '▲'), sortDescendingIcon: icon('sortDescending', '▼'), cardSortDirection: controls.sort?.field === column.props.field
22
+ ? controls.sort?.direction === 'ascending' ? messages.resolvedSortAscending : messages.resolvedSortDescending
23
+ : undefined }, index)))] }));
24
+ };
25
+
26
+ export { DataTableCardControls };
27
+ //# sourceMappingURL=DataTableCardControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableCardControls.js","sources":["../../../DataTables/DataTableCardControls.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 { cloneElement } from 'react';\nimport { classNames } from '../ClassNames/classNames';\nimport { useComponentPresentation } from '../configuration/identity/useComponentPresentation';\nimport { useCratisIcon } from '../configuration/useCratisIcon';\nimport { columnDescriptor } from './columnDescriptor';\nimport { DataTableHeaderContent, DataTableSelectAll } from './DataTableHeaderContent';\nimport type { DataTableHeaderCellProps } from './DataTableHeaderCell';\nimport type { DataTableHeadProps } from './DataTableHead';\n\nconst CardColumnControl = (props: DataTableHeaderCellProps & { cardSortDirection?: string }) => {\n const [columnProps, marker] = useComponentPresentation(columnDescriptor, props.column.props, props.column.props.field);\n return <div {...marker}><DataTableHeaderContent {...props} cardMode column={cloneElement(props.column, columnProps)} /></div>;\n};\n\n/** The one reachable set of column and select-all controls while the table is unmounted. */\nexport const DataTableCardControls = ({ columns, parts: pt, messages, selection, selectionMode, ...controls }: DataTableHeadProps & { selectionMode?: 'single' | 'multiple' }) => {\n const icon = useCratisIcon();\n const selectionProps = {\n resolvedSelectAllAriaLabel: messages.resolvedSelectAllAriaLabel,\n allFilteredRowsSelected: selection.allFilteredRowsSelected,\n selectAllRef: selection.selectAllRef,\n toggleSelectAll: selection.toggleSelectAll,\n };\n return (\n <div {...pt?.cardControls} className={classNames('cratis-datatable__card-controls', pt?.cardControls?.className)} data-cratis-component='DataTableCore' data-cratis-part='card-controls'>\n {selectionMode === 'multiple' && <DataTableSelectAll {...selectionProps} />}\n {columns.filter(column => !column.props.selectionMode && (column.props.sortable || column.props.filter)).map((column, index) => (\n <CardColumnControl key={index} {...controls} {...selectionProps}\n column={column}\n parts={pt}\n resolvedSelectionAriaLabel={messages.resolvedSelectionAriaLabel}\n sortAscendingIcon={icon('sortAscending', '▲')}\n sortDescendingIcon={icon('sortDescending', '▼')}\n cardSortDirection={controls.sort?.field === column.props.field\n ? controls.sort?.direction === 'ascending' ? messages.resolvedSortAscending : messages.resolvedSortDescending\n : undefined}\n />\n ))}\n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AC,MAAM,CAAC,KAAK,CAAC,aAAa,KAAK,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,MACvHA,GAAA,CAAC,iBAAiB,EAAA,EAAA,GAAiB,QAAQ,EAAA,GAAM,cAAc,EAC3D,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,EAAE,EACT,0BAA0B,EAAE,QAAQ,CAAC,0BAA0B,EAC/D,iBAAiB,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,EAC7C,kBAAkB,EAAE,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAC/C,iBAAiB,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC;AACrD,sBAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,KAAK,WAAW,GAAG,QAAQ,CAAC,qBAAqB,GAAG,QAAQ,CAAC;sBACrF,SAAS,EAAA,EARK,KAAK,CAS3B,CACL,CAAC,CAAA,EAAA,CACA;AAEd;;"}
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { DataTableRowsProps } from './DataTableRows.js';
3
+ import type { DataTableHeadProps } from './DataTableHead.js';
4
+ import { DataTableStatus } from './DataTableStatus.js';
5
+ interface DataTableCardsProps<TData extends object> extends Omit<DataTableRowsProps<TData>, 'resolvedSelectionAriaLabel'>, Omit<DataTableHeadProps, 'selection'> {
6
+ data: TData[];
7
+ status: DataTableStatus;
8
+ isBusy: boolean;
9
+ emptyMessage: ReactNode;
10
+ scrollable?: boolean;
11
+ scrollHeight?: string;
12
+ }
13
+ /** Non-table presentation of the already processed loaded-page rows. */
14
+ export declare const DataTableCards: <TData extends object>(props: DataTableCardsProps<TData>) => import("react").JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=DataTableCards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableCards.d.ts","sourceRoot":"","sources":["../../../DataTables/DataTableCards.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAiB,CAAC;AAG1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAEpD,UAAU,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,4BAA4B,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC;IAC5J,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,SAAS,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAuCD,wEAAwE;AACxE,eAAO,MAAM,cAAc,GAAI,KAAK,SAAS,MAAM,SAAS,mBAAmB,CAAC,KAAK,CAAC,gCAUrF,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { classNames } from '../ClassNames/classNames.js';
3
+ import { DataTableCard } from './DataTableCard.js';
4
+ import { DataTableCardControls } from './DataTableCardControls.js';
5
+ import { DataTableStatus } from './DataTableStatus.js';
6
+
7
+ const isFailure = (status) => status === DataTableStatus.Failed || status === DataTableStatus.Unauthorized;
8
+ const statusMessage = ({ status, data, state, messages, emptyMessage }) => {
9
+ if (status === DataTableStatus.Failed)
10
+ return messages.resolvedFailureMessage;
11
+ if (status === DataTableStatus.Unauthorized)
12
+ return messages.resolvedUnauthorizedMessage;
13
+ if (status === DataTableStatus.Loading && !data.length)
14
+ return messages.resolvedLoadingMessage;
15
+ if (state.filteredRows.length)
16
+ return undefined;
17
+ return state.isFiltered ? messages.resolvedFilteredEmptyMessage : emptyMessage;
18
+ };
19
+ const CardStatus = (props) => {
20
+ const { parts: pt, status } = props;
21
+ const message = statusMessage(props);
22
+ if (message === undefined)
23
+ return null;
24
+ return jsx("div", { ...pt?.cardStatus, className: classNames('cratis-datatable__card-status', pt?.cardStatus?.className), "data-cratis-component": 'DataTableCore', "data-cratis-part": 'card-status', "data-reason": status, role: isFailure(status) ? 'alert' : 'status', children: message });
25
+ };
26
+ const CardList = ({ state, columns, parts: pt, messages, selectionMode, selectionGroupName, rowClassName, isBusy }) => (jsx("ul", { ...pt?.cards, role: 'list', className: classNames('cratis-datatable__cards', pt?.cards?.className), "data-cratis-component": 'DataTableCore', "data-cratis-part": 'cards', "data-busy": isBusy || undefined, "aria-busy": isBusy || undefined, children: state.filteredRows.map(({ row, loadedIndex }) => (jsx(DataTableCard, { rowKey: state.rowKeys[loadedIndex], row: row, columns: columns, parts: pt, selectionMode: selectionMode, isSelected: selectionMode === 'single' && state.isSelectedRow(row, loadedIndex), isInteractive: state.isInteractive, isRowSelected: state.isRowSelected(row), rowClassName: rowClassName, resolvedSelectionAriaLabel: messages.resolvedSelectionAriaLabel, selectionGroupName: selectionGroupName, onActivate: event => state.activateRow(row, loadedIndex, event), onToggleSelection: () => state.toggleRowSelection(row) }, state.rowKeys[loadedIndex]))) }));
27
+ const canShowRows = ({ status, data, state }) => {
28
+ if (isFailure(status))
29
+ return false;
30
+ if (status === DataTableStatus.Loading && !data.length)
31
+ return false;
32
+ return state.filteredRows.length > 0;
33
+ };
34
+ const DataTableCards = (props) => {
35
+ const { state, parts: pt, scrollable, scrollHeight } = props;
36
+ return (jsxs("div", { ...pt?.tableContainer, className: classNames('cratis-datatable__container', pt?.tableContainer?.className), style: { ...pt?.tableContainer?.style, ...(scrollable ? { maxHeight: scrollHeight ?? '100%', overflow: 'auto' } : {}) }, "data-cratis-part": 'table-container', children: [jsx(DataTableCardControls, { ...props, selection: state }), jsx(CardStatus, { ...props }), canShowRows(props) && jsx(CardList, { ...props })] }));
37
+ };
38
+
39
+ export { DataTableCards };
40
+ //# sourceMappingURL=DataTableCards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableCards.js","sources":["../../../DataTables/DataTableCards.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 type { ReactNode } from 'react';\nimport { classNames } from '../ClassNames/classNames';\nimport type { DataTableRowsProps } from './DataTableRows';\nimport type { DataTableHeadProps } from './DataTableHead';\nimport { DataTableCard } from './DataTableCard';\nimport { DataTableCardControls } from './DataTableCardControls';\nimport { DataTableStatus } from './DataTableStatus';\n\ninterface DataTableCardsProps<TData extends object> extends Omit<DataTableRowsProps<TData>, 'resolvedSelectionAriaLabel'>, Omit<DataTableHeadProps, 'selection'> {\n data: TData[];\n status: DataTableStatus;\n isBusy: boolean;\n emptyMessage: ReactNode;\n scrollable?: boolean;\n scrollHeight?: string;\n}\n\nconst isFailure = (status: DataTableStatus) => status === DataTableStatus.Failed || status === DataTableStatus.Unauthorized;\nconst statusMessage = <TData extends object>({ status, data, state, messages, emptyMessage }: DataTableCardsProps<TData>): ReactNode => {\n if (status === DataTableStatus.Failed) return messages.resolvedFailureMessage;\n if (status === DataTableStatus.Unauthorized) return messages.resolvedUnauthorizedMessage;\n if (status === DataTableStatus.Loading && !data.length) return messages.resolvedLoadingMessage;\n if (state.filteredRows.length) return undefined;\n return state.isFiltered ? messages.resolvedFilteredEmptyMessage : emptyMessage;\n};\nconst CardStatus = <TData extends object>(props: DataTableCardsProps<TData>) => {\n const { parts: pt, status } = props;\n const message = statusMessage(props);\n if (message === undefined) return null;\n return <div {...pt?.cardStatus} className={classNames('cratis-datatable__card-status', pt?.cardStatus?.className)} data-cratis-component='DataTableCore' data-cratis-part='card-status' data-reason={status} role={isFailure(status) ? 'alert' : 'status'}>{message}</div>;\n};\nconst CardList = <TData extends object>({ state, columns, parts: pt, messages, selectionMode, selectionGroupName, rowClassName, isBusy }: DataTableCardsProps<TData>) => (\n <ul {...pt?.cards} role='list' className={classNames('cratis-datatable__cards', pt?.cards?.className)} data-cratis-component='DataTableCore' data-cratis-part='cards' data-busy={isBusy || undefined} aria-busy={isBusy || undefined}>\n {state.filteredRows.map(({ row, loadedIndex }) => (\n <DataTableCard key={state.rowKeys[loadedIndex]} rowKey={state.rowKeys[loadedIndex]} row={row} columns={columns} parts={pt}\n selectionMode={selectionMode}\n isSelected={selectionMode === 'single' && state.isSelectedRow(row, loadedIndex)}\n isInteractive={state.isInteractive}\n isRowSelected={state.isRowSelected(row)}\n rowClassName={rowClassName}\n resolvedSelectionAriaLabel={messages.resolvedSelectionAriaLabel}\n selectionGroupName={selectionGroupName}\n onActivate={event => state.activateRow(row, loadedIndex, event)}\n onToggleSelection={() => state.toggleRowSelection(row)}\n />\n ))}\n </ul>\n);\nconst canShowRows = <TData extends object>({ status, data, state }: DataTableCardsProps<TData>) => {\n if (isFailure(status)) return false;\n if (status === DataTableStatus.Loading && !data.length) return false;\n return state.filteredRows.length > 0;\n};\n\n/** Non-table presentation of the already processed loaded-page rows. */\nexport const DataTableCards = <TData extends object>(props: DataTableCardsProps<TData>) => {\n const { state, parts: pt, scrollable, scrollHeight } = props;\n return (\n <div {...pt?.tableContainer} className={classNames('cratis-datatable__container', pt?.tableContainer?.className)}\n style={{ ...pt?.tableContainer?.style, ...(scrollable ? { maxHeight: scrollHeight ?? '100%', overflow: 'auto' } : {}) }} data-cratis-part='table-container'>\n <DataTableCardControls {...props} selection={state} />\n <CardStatus {...props} />\n {canShowRows(props) && <CardList {...props} />}\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAoBA,MAAM,SAAS,GAAG,CAAC,MAAuB,KAAK,MAAM,KAAK,eAAe,CAAC,MAAM,IAAI,MAAM,KAAK,eAAe,CAAC,YAAY;AAC3H,MAAM,aAAa,GAAG,CAAuB,EAAE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AK;AACpE,IAAA,OAAO,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;AACxC,CAAC;AAGM,MAAM,cAAc,GAAG,CAAuB,KAAiC,KAAI;AACtF,IAAA,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,KAAK;AAC5D,IAAA,QACIC,IAAA,CAAA,KAAA,EAAA,EAAA,GAAS,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,CAAC,6BAA6B,EAAE,EAAE,EAAE,cAAc,EAAE,SAAS,CAAC,EAC5G,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,UAAU,GAAG,EAAE,SAAS,EAAE,YAAY,IAAI,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,EAAA,kBAAA,EAAmB,iBAAiB,aAC3JD,GAAA,CAAC,qBAAqB,OAAK,KAAK,EAAE,SAAS,EAAE,KAAK,EAAA,CAAI,EACtDA,IAAC,UAAU,EAAA,EAAA,GAAK,KAAK,EAAA,CAAI,EACxB,WAAW,CAAC,KAAK,CAAC,IAAIA,IAAC,QAAQ,EAAA,EAAA,GAAK,KAAK,EAAA,CAAI,CAAA,EAAA,CAC5C;AAEd;;"}
@@ -6,10 +6,12 @@ import { DataTableRowProcessing } from './DataTableRowProcessing.js';
6
6
  import type { DataTableSelectionChangeEvent } from './DataTableSelectionChangeEvent.js';
7
7
  import type { DataTableSort } from './DataTableSort.js';
8
8
  import { DataTableStatus } from './DataTableStatus.js';
9
+ import type { DataTableMobileLayoutProps } from './DataTableMobileLayoutProps.js';
9
10
  export type { DataTableParts } from './DataTableParts.js';
11
+ export type { DataTableMobileLayoutProps } from './DataTableMobileLayoutProps.js';
10
12
  export type { DataTableRowClickEvent } from './DataTableRowClickEvent.js';
11
13
  /** Props for the semantic loaded-page DataTable renderer. */
12
- export interface DataTableCoreProps<TData extends object> {
14
+ export interface DataTableCoreProps<TData extends object> extends DataTableMobileLayoutProps {
13
15
  /** Loaded page rows. */
14
16
  data: TData[];
15
17
  /** Declarative {@link Column} markers. */
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableCore.d.ts","sourceRoot":"","sources":["../../../DataTables/DataTableCore.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAkB,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA0B,CAAC;AAIvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oCAAiC,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAiB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAMpD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAkB,CAAC;AACvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA0B,CAAC;AAavE,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB,CAAC,KAAK,SAAS,MAAM;IACpD,wBAAwB;IACxB,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yGAAyG;IACzG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,YAAY,EAAE,SAAS,CAAC;IACxB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,gDAAgD;IAChD,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,wCAAwC;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;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AA2BD,gFAAgF;AAChF,eAAO,MAAM,aAAa,GAAI,KAAK,SAAS,MAAM,SAAS,kBAAkB,CAAC,KAAK,CAAC,sBA6FnF,CAAC"}
@@ -11,14 +11,20 @@ import { DataTableTable } from './DataTableTable.js';
11
11
  import { useDataTableMessages } from './useDataTableMessages.js';
12
12
  import { useDataTableRows } from './useDataTableRows.js';
13
13
  import { useDataTableState } from './useDataTableState.js';
14
+ import { useMobileLayout } from './useMobileLayout.js';
15
+ import { DataTableCards } from './DataTableCards.js';
16
+ import { useDataTablePresentationFocus } from './useDataTablePresentationFocus.js';
14
17
 
15
18
  const useColumns = (children) => useMemo(() => React.Children.toArray(children).filter(React.isValidElement), [children]);
19
+ const DataTableRoot = ({ children, scrollable, className, style, pt, mobileLayout, elementRef, isBusy }) => (jsx("div", { ...pt?.root, ref: elementRef, tabIndex: pt?.root?.tabIndex ?? (mobileLayout === 'cards' ? -1 : undefined), className: classNames('cratis-datatable', scrollable ? 'cratis-datatable--scrollable' : undefined, pt?.root?.className, className), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-cratis-component": 'DataTableCore', "data-busy": isBusy || undefined, children: children }));
16
20
  const DataTableCore = (props) => {
17
- const { data, status = DataTableStatus.Ready, rowProcessing = DataTableRowProcessing.Loaded, globalFilterFields, scrollable, className, style, pt, } = props;
21
+ const { data, status = DataTableStatus.Ready, rowProcessing = DataTableRowProcessing.Loaded, globalFilterFields, scrollable, pt, } = props;
18
22
  const messages = useDataTableMessages(props, rowProcessing === DataTableRowProcessing.None);
19
23
  const isBusy = status === DataTableStatus.Loading && data.length > 0;
20
24
  const columns = useColumns(props.children);
21
25
  const selectionGroupName = useId();
26
+ const useCards = useMobileLayout(props);
27
+ const presentationRoot = useDataTablePresentationFocus(useCards);
22
28
  const { filters, updateFilter, globalFilter, setGlobalFilter, sort, setSort } = useDataTableState(props);
23
29
  const rows = useDataTableRows({
24
30
  ...props,
@@ -27,7 +33,7 @@ const DataTableCore = (props) => {
27
33
  sort,
28
34
  rowProcessing,
29
35
  });
30
- return (jsxs("div", { ...pt?.root, className: classNames('cratis-datatable', scrollable ? 'cratis-datatable--scrollable' : undefined, pt?.root?.className, className), style: { ...pt?.root?.style, ...style }, "data-cratis-part": 'root', "data-cratis-component": 'DataTableCore', "data-busy": isBusy || undefined, children: [!!globalFilterFields?.length && (jsx(DataTableSearch, { parts: pt, value: globalFilter, placeholder: messages.resolvedGlobalSearchPlaceholder, ariaLabel: messages.resolvedGlobalSearchAriaLabel, onChange: setGlobalFilter })), jsx(DataTableTable, { parts: pt, isBusy: isBusy, scrollable: scrollable, scrollHeight: props.scrollHeight, head: jsx(DataTableHead, { columns: columns, parts: pt, sort: sort, onSort: setSort, filters: filters, updateFilter: updateFilter, messages: messages, selection: rows }), children: jsx(DataTableBody, { status: status, hasLoadedRows: data.length > 0, rowCount: rows.filteredRows.length, columnCount: columns.length, parts: pt, messages: messages, emptyMessage: props.emptyMessage, isFiltered: rows.isFiltered, renderRows: () => (jsx(DataTableRows, { state: rows, columns: columns, parts: pt, selectionMode: props.selectionMode, rowClassName: props.rowClassName, resolvedSelectionAriaLabel: messages.resolvedSelectionAriaLabel, selectionGroupName: selectionGroupName })) }) })] }));
36
+ return (jsxs(DataTableRoot, { ...props, elementRef: presentationRoot, isBusy: isBusy, children: [!!globalFilterFields?.length && (jsx(DataTableSearch, { parts: pt, value: globalFilter, placeholder: messages.resolvedGlobalSearchPlaceholder, ariaLabel: messages.resolvedGlobalSearchAriaLabel, onChange: setGlobalFilter })), useCards ? (jsx(DataTableCards, { ...props, state: rows, columns: columns, parts: pt, messages: messages, status: status, isBusy: isBusy, sort: sort, onSort: setSort, filters: filters, updateFilter: updateFilter, selectionGroupName: selectionGroupName })) : jsx(DataTableTable, { parts: pt, isBusy: isBusy, scrollable: scrollable, scrollHeight: props.scrollHeight, head: jsx(DataTableHead, { columns: columns, parts: pt, sort: sort, onSort: setSort, filters: filters, updateFilter: updateFilter, messages: messages, selection: rows }), children: jsx(DataTableBody, { status: status, hasLoadedRows: data.length > 0, rowCount: rows.filteredRows.length, columnCount: columns.length, parts: pt, messages: messages, emptyMessage: props.emptyMessage, isFiltered: rows.isFiltered, renderRows: () => (jsx(DataTableRows, { state: rows, columns: columns, parts: pt, selectionMode: props.selectionMode, rowClassName: props.rowClassName, resolvedSelectionAriaLabel: messages.resolvedSelectionAriaLabel, selectionGroupName: selectionGroupName })) }) })] }));
31
37
  };
32
38
 
33
39
  export { DataTableCore };
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableCore.js","sources":["../../../DataTables/DataTableCore.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 React, { useId, useMemo, type CSSProperties, type ReactNode } from 'react';\nimport type { ColumnProps } from './Column';\nimport { classNames } from '../ClassNames/classNames';\nimport type { DataTableFilterMeta } from './DataTableFilterMeta';\nimport { DataTableHead } from './DataTableHead';\nimport type { DataTableParts } from './DataTableParts';\nimport type { DataTableRowClickEvent } from './DataTableRowClickEvent';\nimport { DataTableBody } from './DataTableBody';\nimport { DataTableRows } from './DataTableRows';\nimport { DataTableSearch } from './DataTableSearch';\nimport { DataTableRowProcessing } from './DataTableRowProcessing';\nimport type { DataTableSelectionChangeEvent } from './DataTableSelectionChangeEvent';\nimport type { DataTableSort } from './DataTableSort';\nimport { DataTableStatus } from './DataTableStatus';\nimport { DataTableTable } from './DataTableTable';\nimport { useDataTableMessages } from './useDataTableMessages';\nimport { useDataTableRows } from './useDataTableRows';\nimport { useDataTableState } from './useDataTableState';\n\nexport type { DataTableParts } from './DataTableParts';\nexport type { DataTableRowClickEvent } from './DataTableRowClickEvent';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nconst useColumns = (children: React.ReactNode): React.ReactElement<ColumnProps<any>>[] =>\n useMemo(\n () =>\n React.Children.toArray(children).filter(\n React.isValidElement,\n ) as React.ReactElement<ColumnProps<any>>[],\n [children],\n );\n\n/** Props for the semantic loaded-page DataTable renderer. */\nexport interface DataTableCoreProps<TData extends object> {\n /** Loaded page rows. */\n data: TData[];\n /** Declarative {@link Column} markers. */\n children?: ReactNode;\n /** Row property used as stable identity. Required to preserve selection across refreshed row objects. */\n dataKey?: string;\n /** Content shown when the loaded page has no matching rows. */\n emptyMessage: ReactNode;\n /**\n * Content shown instead of {@link emptyMessage} when a search or column filter is active and no\n * rows are shown. Defaults to a localizable message that names the loaded page, or a neutral\n * one when the server applies the search.\n */\n filteredEmptyMessage?: ReactNode;\n /** Table display state. Defaults to ready. */\n status?: DataTableStatus;\n /** Message shown while loading without rows. */\n loadingMessage?: ReactNode;\n /** Message shown for a failed query. */\n failureMessage?: ReactNode;\n /** Message shown for an unauthorized query. */\n unauthorizedMessage?: ReactNode;\n /**\n * Enables row selection. `'single'` selects one row at a time through row activation;\n * `'multiple'` adds per-row checkboxes and a select-all header checkbox, and reports through\n * {@link onSelectedItemsChange} rather than {@link onSelectionChange}.\n */\n selectionMode?: 'single' | 'multiple';\n /** Accessible name for row selection controls. Falls back to the provider's `dataTable.selectRow` message, then `'Select row'`. */\n selectionAriaLabel?: string;\n /** Accessible name for the select-all control. Falls back to the provider's `dataTable.selectAllRows` message, then `'Select all rows'`. */\n selectAllAriaLabel?: string;\n /** Controlled selected row. Applies to `selectionMode='single'`. */\n selection?: TData | null;\n /** Invoked when the single-row selection changes. */\n onSelectionChange?: (event: DataTableSelectionChangeEvent<TData>) => void;\n /** Controlled selected rows. Applies to `selectionMode='multiple'`. */\n selectedItems?: TData[];\n /** Invoked with the full set of selected rows when a multiple selection changes. */\n onSelectedItemsChange?: (items: TData[]) => void;\n /** Invoked when a row is clicked or keyboard activated. */\n onRowClick?: (event: DataTableRowClickEvent<TData>) => void;\n /** Builds an extra class name for one row. */\n rowClassName?: (rowData: TData) => string;\n /** Row fields searched on the loaded page. */\n globalFilterFields?: string[];\n /** Placeholder for the loaded-page search input. Falls back to the provider's `dataTable.search` message, then `'Search…'`. */\n globalSearchPlaceholder?: string;\n /** Accessible name for the loaded-page search input. Falls back to the provider's `dataTable.searchAriaLabel` message, then `'Search table'`. */\n globalSearchAriaLabel?: string;\n /** Initial per-field filter constraints. */\n defaultFilters?: DataTableFilterMeta;\n /** Controlled per-field filter constraints. Leave undefined to let the table keep its own. */\n filters?: DataTableFilterMeta;\n /** Invoked when applied field filters change. */\n onFilter?: (filters: DataTableFilterMeta) => void;\n /** Controlled search text. Leave undefined to let the table keep its own. */\n globalFilter?: string;\n /** Invoked when the search text changes. */\n onGlobalFilterChange?: (globalFilter: string) => void;\n /** Controlled sort; null means not sorted. Leave undefined to let the table keep its own. */\n sort?: DataTableSort | null;\n /** Invoked when a sortable column header changes the sort. */\n onSortChange?: (sort: DataTableSort | null) => void;\n /**\n * Whether the table filters and sorts the rows it is given (default:\n * {@link DataTableRowProcessing.Loaded}). Use {@link DataTableRowProcessing.None} when the\n * source already applied the controlled filter and sort state.\n */\n rowProcessing?: DataTableRowProcessing;\n /** Enables the bounded scroll container. */\n scrollable?: boolean;\n /** Scroll-container maximum height. */\n scrollHeight?: string;\n /** Extra class name for the table composition. */\n className?: string;\n /** Inline style for the table composition. */\n style?: CSSProperties;\n /** Cratis-owned per-part attributes. */\n pt?: DataTableParts;\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n}\n\n/** A semantic, renderer-independent data table over one already-loaded page. */\nexport const DataTableCore = <TData extends object>(props: DataTableCoreProps<TData>) => {\n const {\n data,\n status = DataTableStatus.Ready,\n rowProcessing = DataTableRowProcessing.Loaded,\n globalFilterFields,\n scrollable,\n className,\n style,\n pt,\n } = props;\n const messages = useDataTableMessages(props, rowProcessing === DataTableRowProcessing.None);\n const isBusy = status === DataTableStatus.Loading && data.length > 0;\n const columns = useColumns(props.children);\n const selectionGroupName = useId();\n const { filters, updateFilter, globalFilter, setGlobalFilter, sort, setSort } =\n useDataTableState(props);\n const rows = useDataTableRows<TData>({\n ...props,\n filters,\n globalFilter,\n sort,\n rowProcessing,\n });\n\n return (\n <div\n {...pt?.root}\n className={classNames(\n 'cratis-datatable',\n scrollable ? 'cratis-datatable--scrollable' : undefined,\n pt?.root?.className,\n className,\n )}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-cratis-component='DataTableCore'\n data-busy={isBusy || undefined}\n >\n {!!globalFilterFields?.length && (\n <DataTableSearch\n parts={pt}\n value={globalFilter}\n placeholder={messages.resolvedGlobalSearchPlaceholder}\n ariaLabel={messages.resolvedGlobalSearchAriaLabel}\n onChange={setGlobalFilter}\n />\n )}\n <DataTableTable\n parts={pt}\n isBusy={isBusy}\n scrollable={scrollable}\n scrollHeight={props.scrollHeight}\n head={\n <DataTableHead\n columns={columns}\n parts={pt}\n sort={sort}\n onSort={setSort}\n filters={filters}\n updateFilter={updateFilter}\n messages={messages}\n selection={rows}\n />\n }\n >\n <DataTableBody\n status={status}\n hasLoadedRows={data.length > 0}\n rowCount={rows.filteredRows.length}\n columnCount={columns.length}\n parts={pt}\n messages={messages}\n emptyMessage={props.emptyMessage}\n isFiltered={rows.isFiltered}\n renderRows={() => (\n <DataTableRows<TData>\n state={rows}\n columns={columns}\n parts={pt}\n selectionMode={props.selectionMode}\n rowClassName={props.rowClassName}\n resolvedSelectionAriaLabel={messages.resolvedSelectionAriaLabel}\n selectionGroupName={selectionGroupName}\n />\n )}\n />\n </DataTableTable>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;AA2BA,MAAM,UAAU,GAAG,CAAC,QAAyB,KACzC,OAAO,CACH,MACI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CACnC,KAAK,CAAC,cAAc,CAC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"version":3,"file":"DataTableCore.js","sources":["../../../DataTables/DataTableCore.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 React, { useId, useMemo, type CSSProperties, type ReactNode } from 'react';\nimport type { ColumnProps } from './Column';\nimport { classNames } from '../ClassNames/classNames';\nimport type { DataTableFilterMeta } from './DataTableFilterMeta';\nimport { DataTableHead } from './DataTableHead';\nimport type { DataTableParts } from './DataTableParts';\nimport type { DataTableRowClickEvent } from './DataTableRowClickEvent';\nimport { DataTableBody } from './DataTableBody';\nimport { DataTableRows } from './DataTableRows';\nimport { DataTableSearch } from './DataTableSearch';\nimport { DataTableRowProcessing } from './DataTableRowProcessing';\nimport type { DataTableSelectionChangeEvent } from './DataTableSelectionChangeEvent';\nimport type { DataTableSort } from './DataTableSort';\nimport { DataTableStatus } from './DataTableStatus';\nimport { DataTableTable } from './DataTableTable';\nimport { useDataTableMessages } from './useDataTableMessages';\nimport { useDataTableRows } from './useDataTableRows';\nimport { useDataTableState } from './useDataTableState';\nimport type { DataTableMobileLayoutProps } from './DataTableMobileLayoutProps';\nimport { useMobileLayout } from './useMobileLayout';\nimport { DataTableCards } from './DataTableCards';\nimport { useDataTablePresentationFocus } from './useDataTablePresentationFocus';\n\nexport type { DataTableParts } from './DataTableParts';\nexport type { DataTableMobileLayoutProps } from './DataTableMobileLayoutProps';\nexport type { DataTableRowClickEvent } from './DataTableRowClickEvent';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nconst useColumns = (children: React.ReactNode): React.ReactElement<ColumnProps<any>>[] =>\n useMemo(\n () =>\n React.Children.toArray(children).filter(\n React.isValidElement,\n ) as React.ReactElement<ColumnProps<any>>[],\n [children],\n );\n\n/** Props for the semantic loaded-page DataTable renderer. */\nexport interface DataTableCoreProps<TData extends object> extends DataTableMobileLayoutProps {\n /** Loaded page rows. */\n data: TData[];\n /** Declarative {@link Column} markers. */\n children?: ReactNode;\n /** Row property used as stable identity. Required to preserve selection across refreshed row objects. */\n dataKey?: string;\n /** Content shown when the loaded page has no matching rows. */\n emptyMessage: ReactNode;\n /**\n * Content shown instead of {@link emptyMessage} when a search or column filter is active and no\n * rows are shown. Defaults to a localizable message that names the loaded page, or a neutral\n * one when the server applies the search.\n */\n filteredEmptyMessage?: ReactNode;\n /** Table display state. Defaults to ready. */\n status?: DataTableStatus;\n /** Message shown while loading without rows. */\n loadingMessage?: ReactNode;\n /** Message shown for a failed query. */\n failureMessage?: ReactNode;\n /** Message shown for an unauthorized query. */\n unauthorizedMessage?: ReactNode;\n /**\n * Enables row selection. `'single'` selects one row at a time through row activation;\n * `'multiple'` adds per-row checkboxes and a select-all header checkbox, and reports through\n * {@link onSelectedItemsChange} rather than {@link onSelectionChange}.\n */\n selectionMode?: 'single' | 'multiple';\n /** Accessible name for row selection controls. Falls back to the provider's `dataTable.selectRow` message, then `'Select row'`. */\n selectionAriaLabel?: string;\n /** Accessible name for the select-all control. Falls back to the provider's `dataTable.selectAllRows` message, then `'Select all rows'`. */\n selectAllAriaLabel?: string;\n /** Controlled selected row. Applies to `selectionMode='single'`. */\n selection?: TData | null;\n /** Invoked when the single-row selection changes. */\n onSelectionChange?: (event: DataTableSelectionChangeEvent<TData>) => void;\n /** Controlled selected rows. Applies to `selectionMode='multiple'`. */\n selectedItems?: TData[];\n /** Invoked with the full set of selected rows when a multiple selection changes. */\n onSelectedItemsChange?: (items: TData[]) => void;\n /** Invoked when a row is clicked or keyboard activated. */\n onRowClick?: (event: DataTableRowClickEvent<TData>) => void;\n /** Builds an extra class name for one row. */\n rowClassName?: (rowData: TData) => string;\n /** Row fields searched on the loaded page. */\n globalFilterFields?: string[];\n /** Placeholder for the loaded-page search input. Falls back to the provider's `dataTable.search` message, then `'Search…'`. */\n globalSearchPlaceholder?: string;\n /** Accessible name for the loaded-page search input. Falls back to the provider's `dataTable.searchAriaLabel` message, then `'Search table'`. */\n globalSearchAriaLabel?: string;\n /** Initial per-field filter constraints. */\n defaultFilters?: DataTableFilterMeta;\n /** Controlled per-field filter constraints. Leave undefined to let the table keep its own. */\n filters?: DataTableFilterMeta;\n /** Invoked when applied field filters change. */\n onFilter?: (filters: DataTableFilterMeta) => void;\n /** Controlled search text. Leave undefined to let the table keep its own. */\n globalFilter?: string;\n /** Invoked when the search text changes. */\n onGlobalFilterChange?: (globalFilter: string) => void;\n /** Controlled sort; null means not sorted. Leave undefined to let the table keep its own. */\n sort?: DataTableSort | null;\n /** Invoked when a sortable column header changes the sort. */\n onSortChange?: (sort: DataTableSort | null) => void;\n /**\n * Whether the table filters and sorts the rows it is given (default:\n * {@link DataTableRowProcessing.Loaded}). Use {@link DataTableRowProcessing.None} when the\n * source already applied the controlled filter and sort state.\n */\n rowProcessing?: DataTableRowProcessing;\n /** Enables the bounded scroll container. */\n scrollable?: boolean;\n /** Scroll-container maximum height. */\n scrollHeight?: string;\n /** Extra class name for the table composition. */\n className?: string;\n /** Inline style for the table composition. */\n style?: CSSProperties;\n /** Cratis-owned per-part attributes. */\n pt?: DataTableParts;\n /**\n * @deprecated Cratis parts always merge. Remove this renderer-era option.\n */\n ptOptions?: object;\n /**\n * @deprecated Components always uses consumer-owned CSS. Customize through `pt` and CSS instead.\n */\n unstyled?: boolean;\n}\n\ntype DataTableRootProps = Pick<DataTableCoreProps<object>, 'children' | 'scrollable' | 'className' | 'style' | 'pt' | 'mobileLayout'> & {\n elementRef: React.Ref<HTMLDivElement>;\n isBusy: boolean;\n};\n\nconst DataTableRoot = ({ children, scrollable, className, style, pt, mobileLayout, elementRef, isBusy }: DataTableRootProps) => (\n <div\n {...pt?.root}\n ref={elementRef}\n tabIndex={pt?.root?.tabIndex ?? (mobileLayout === 'cards' ? -1 : undefined)}\n className={classNames(\n 'cratis-datatable',\n scrollable ? 'cratis-datatable--scrollable' : undefined,\n pt?.root?.className,\n className,\n )}\n style={{ ...pt?.root?.style, ...style }}\n data-cratis-part='root'\n data-cratis-component='DataTableCore'\n data-busy={isBusy || undefined}\n >\n {children}\n </div>\n);\n\n/** A semantic, renderer-independent data table over one already-loaded page. */\nexport const DataTableCore = <TData extends object>(props: DataTableCoreProps<TData>) => {\n const {\n data,\n status = DataTableStatus.Ready,\n rowProcessing = DataTableRowProcessing.Loaded,\n globalFilterFields,\n scrollable,\n pt,\n } = props;\n const messages = useDataTableMessages(props, rowProcessing === DataTableRowProcessing.None);\n const isBusy = status === DataTableStatus.Loading && data.length > 0;\n const columns = useColumns(props.children);\n const selectionGroupName = useId();\n const useCards = useMobileLayout(props);\n const presentationRoot = useDataTablePresentationFocus(useCards);\n const { filters, updateFilter, globalFilter, setGlobalFilter, sort, setSort } =\n useDataTableState(props);\n const rows = useDataTableRows<TData>({\n ...props,\n filters,\n globalFilter,\n sort,\n rowProcessing,\n });\n\n return (\n <DataTableRoot {...props} elementRef={presentationRoot} isBusy={isBusy}>\n {!!globalFilterFields?.length && (\n <DataTableSearch\n parts={pt}\n value={globalFilter}\n placeholder={messages.resolvedGlobalSearchPlaceholder}\n ariaLabel={messages.resolvedGlobalSearchAriaLabel}\n onChange={setGlobalFilter}\n />\n )}\n {useCards ? (\n <DataTableCards\n {...props}\n state={rows}\n columns={columns}\n parts={pt}\n messages={messages}\n status={status}\n isBusy={isBusy}\n sort={sort}\n onSort={setSort}\n filters={filters}\n updateFilter={updateFilter}\n selectionGroupName={selectionGroupName}\n />\n ) : <DataTableTable\n parts={pt}\n isBusy={isBusy}\n scrollable={scrollable}\n scrollHeight={props.scrollHeight}\n head={\n <DataTableHead\n columns={columns}\n parts={pt}\n sort={sort}\n onSort={setSort}\n filters={filters}\n updateFilter={updateFilter}\n messages={messages}\n selection={rows}\n />\n }\n >\n <DataTableBody\n status={status}\n hasLoadedRows={data.length > 0}\n rowCount={rows.filteredRows.length}\n columnCount={columns.length}\n parts={pt}\n messages={messages}\n emptyMessage={props.emptyMessage}\n isFiltered={rows.isFiltered}\n renderRows={() => (\n <DataTableRows<TData>\n state={rows}\n columns={columns}\n parts={pt}\n selectionMode={props.selectionMode}\n rowClassName={props.rowClassName}\n resolvedSelectionAriaLabel={messages.resolvedSelectionAriaLabel}\n selectionGroupName={selectionGroupName}\n />\n )}\n />\n </DataTableTable>}\n </DataTableRoot>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,UAAU,GAAG,CAAC,QAAyB,KACzC,OAAO,CACH,MACI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CACnC,KAAK,CAAC,cAAc,CACmB,EAC/C,CAAC,QAAQ,CAAC,CACb;AAmGL,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAsB,MACvHA,GAAA,CAAA,KAAA,EAAA,EAAA,GACQ,EAAE,EAAE,IAAI,EACZ,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,KAAK,YAAY,KAAK,OAAO,GAAG,EAAE,GAAG,SAAS,CAAC,EAC3E,SAAS,EAAE,UAAU,CACjB,kBAAkB,EAClB,UAAU,GAAG,8BAA8B,GAAG,SAAS,EACvD,EAAE,EAAE,IAAI,EAAE,SAAS,EACnB,SAAS,CACZ,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,sBACtB,MAAM,EAAA,uBAAA,EACD,eAAe,EAAA,WAAA,EAC1B,MAAM,IAAI,SAAS,EAAA,QAAA,EAE7B,QAAQ,EAAA,CACP,CACT;AAGM,MAAM,aAAa,GAAG,CAAuB,KAAgC,KAAI;IACpF,MAAM,EACF,IAAI,EACJ,MAAM,GAAG,eAAe,CAAC,KAAK,EAC9B,aAAa,GAAG,sBAAsB,CAAC,MAAM,EAC7C,kBAAkB,EAClB,UAAU,EACV,EAAE,GACL,GAAG,KAAK;AACT,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