@gemologic/sheen-table 0.1.0-rc.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 (106) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +19 -0
  3. package/dist/DataTable.d.ts +159 -0
  4. package/dist/DataTable.js +2724 -0
  5. package/dist/DataTableToolbar.d.ts +28 -0
  6. package/dist/DataTableToolbar.js +132 -0
  7. package/dist/FilterBar.d.ts +24 -0
  8. package/dist/FilterBar.js +681 -0
  9. package/dist/QueryBuilder.d.ts +11 -0
  10. package/dist/QueryBuilder.js +693 -0
  11. package/dist/cell-edit.d.ts +50 -0
  12. package/dist/cell-edit.js +178 -0
  13. package/dist/client-state.d.ts +28 -0
  14. package/dist/client-state.js +57 -0
  15. package/dist/client-view.d.ts +31 -0
  16. package/dist/client-view.js +30 -0
  17. package/dist/column-layout.d.ts +10 -0
  18. package/dist/column-layout.js +34 -0
  19. package/dist/columns.d.ts +108 -0
  20. package/dist/columns.js +217 -0
  21. package/dist/core.d.ts +54 -0
  22. package/dist/core.js +28 -0
  23. package/dist/export.d.ts +14 -0
  24. package/dist/export.js +27 -0
  25. package/dist/facets.d.ts +15 -0
  26. package/dist/facets.js +41 -0
  27. package/dist/filter-bar-state.d.ts +22 -0
  28. package/dist/filter-bar-state.js +128 -0
  29. package/dist/filter-client.d.ts +9 -0
  30. package/dist/filter-client.js +69 -0
  31. package/dist/filter.d.ts +64 -0
  32. package/dist/filter.js +132 -0
  33. package/dist/grouping.d.ts +37 -0
  34. package/dist/grouping.js +126 -0
  35. package/dist/index.d.ts +7 -0
  36. package/dist/index.js +31 -0
  37. package/dist/messages.d.ts +115 -0
  38. package/dist/messages.js +121 -0
  39. package/dist/pagination.d.ts +36 -0
  40. package/dist/pagination.js +102 -0
  41. package/dist/query-builder-state.d.ts +28 -0
  42. package/dist/query-builder-state.js +128 -0
  43. package/dist/requests.d.ts +26 -0
  44. package/dist/requests.js +106 -0
  45. package/dist/row-hierarchy.d.ts +32 -0
  46. package/dist/row-hierarchy.js +170 -0
  47. package/dist/row-identity.d.ts +11 -0
  48. package/dist/row-identity.js +36 -0
  49. package/dist/saved-views.d.ts +52 -0
  50. package/dist/saved-views.js +153 -0
  51. package/dist/search-controller.d.ts +22 -0
  52. package/dist/search-controller.js +75 -0
  53. package/dist/search.d.ts +28 -0
  54. package/dist/search.js +111 -0
  55. package/dist/selection-client.d.ts +9 -0
  56. package/dist/selection-client.js +14 -0
  57. package/dist/selection.d.ts +25 -0
  58. package/dist/selection.js +60 -0
  59. package/dist/server-export.d.ts +27 -0
  60. package/dist/server-export.js +105 -0
  61. package/dist/sorting.d.ts +17 -0
  62. package/dist/sorting.js +58 -0
  63. package/dist/table-state-changes.d.ts +27 -0
  64. package/dist/table-state-changes.js +67 -0
  65. package/dist/table-state.d.ts +20 -0
  66. package/dist/table-state.js +77 -0
  67. package/dist/text-normalization.d.ts +2 -0
  68. package/dist/text-normalization.js +12 -0
  69. package/dist/url-state.d.ts +39 -0
  70. package/dist/url-state.js +75 -0
  71. package/package.json +66 -0
  72. package/src/DataTable.tsx +2322 -0
  73. package/src/DataTableToolbar.tsx +69 -0
  74. package/src/FilterBar.tsx +396 -0
  75. package/src/QueryBuilder.tsx +274 -0
  76. package/src/cell-edit.ts +187 -0
  77. package/src/client-state.ts +52 -0
  78. package/src/client-view.ts +61 -0
  79. package/src/column-layout.ts +47 -0
  80. package/src/columns.ts +271 -0
  81. package/src/core.ts +54 -0
  82. package/src/export.ts +39 -0
  83. package/src/facets.ts +46 -0
  84. package/src/filter-bar-state.ts +118 -0
  85. package/src/filter-client.ts +79 -0
  86. package/src/filter.ts +113 -0
  87. package/src/grouping.ts +185 -0
  88. package/src/index.ts +7 -0
  89. package/src/messages.ts +29 -0
  90. package/src/pagination.ts +81 -0
  91. package/src/query-builder-state.ts +105 -0
  92. package/src/requests.ts +85 -0
  93. package/src/row-hierarchy.ts +280 -0
  94. package/src/row-identity.ts +39 -0
  95. package/src/saved-views.ts +143 -0
  96. package/src/search-controller.ts +61 -0
  97. package/src/search.ts +137 -0
  98. package/src/selection-client.ts +23 -0
  99. package/src/selection.ts +62 -0
  100. package/src/server-export.ts +89 -0
  101. package/src/sorting.ts +63 -0
  102. package/src/styles.css +197 -0
  103. package/src/table-state-changes.ts +51 -0
  104. package/src/table-state.ts +72 -0
  105. package/src/text-normalization.ts +14 -0
  106. package/src/url-state.ts +62 -0
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Gemologic
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @gemologic/sheen-table
2
+
3
+ Compact, accessible DataTable and QueryBuilder components for Sheen SolidJS applications. Numbered pagination, bounded continuous data, virtualization, search, filtering, sorting, selection, export adapters, and conflict-safe edits share one engine.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm add @gemologic/sheen-table @gemologic/sheen @gemologic/sheen-tokens solid-js
9
+ ```
10
+
11
+ Load `@gemologic/sheen-table/styles.css` after the token and base UI styles.
12
+
13
+ ## Use
14
+
15
+ Import `DataTable` and `FilterBar` from the package root, `QueryBuilder` from `./query-builder`, or framework-independent state and serialization helpers from `./core`. Define columns through Sheen's typed column contract; TanStack types are not part of the public API.
16
+
17
+ Numbered pagination and virtualization solve different problems. Use continuous client mode only for complete bounded data. Large or expensive remote queries should use numbered server pagination. Server export and select-all-matching remain application-owned and never cause the table to walk every page.
18
+
19
+ See the [DataTable guide](https://github.com/gemologic/sheen/blob/main/docs/data-table-page.md), [search syntax](https://github.com/gemologic/sheen/blob/main/docs/table-search.md), [pagination policy](https://github.com/gemologic/sheen/blob/main/docs/table-pagination.md), and [request contract](https://github.com/gemologic/sheen/blob/main/docs/table-requests.md).
@@ -0,0 +1,159 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { ColumnValue, SheenColumns } from "./columns.ts";
3
+ import type { PageResult, TablePagination } from "./pagination.ts";
4
+ import type { ServerRowGroup } from "./grouping.ts";
5
+ import type { BulkSelection } from "./selection.ts";
6
+ import type { ColumnState, TableState } from "./table-state.ts";
7
+ import type { FilterNode } from "./filter.ts";
8
+ import type { FilterDateEditor } from "./FilterBar.tsx";
9
+ import type { TableExportRequest } from "./server-export.ts";
10
+ import type { CellCommitRequest, CellCommitResult } from "./cell-edit.ts";
11
+ export interface DataTableResult<Row extends object> extends PageResult<Row> {
12
+ readonly facets?: Readonly<Record<string, Readonly<Record<string, number>>>>;
13
+ /** Required for delegated server grouping; describes the accepted page with full-group totals. */
14
+ readonly groups?: readonly ServerRowGroup[];
15
+ }
16
+ export interface DataTableInitialState {
17
+ readonly search?: string;
18
+ readonly filter?: TableState["filter"];
19
+ readonly sorting?: TableState["sorting"];
20
+ readonly columns?: readonly ColumnState[];
21
+ }
22
+ export interface DataTableSelectionOptions<Row extends object> {
23
+ readonly mode: "multiple";
24
+ /** Receives a fresh immutable ID or query/exclusion payload after each user change. */
25
+ readonly onChange: (selection: BulkSelection) => void;
26
+ /** Overrides the localized stable-ID label used by each row checkbox. */
27
+ readonly getRowLabel?: (row: Row) => string;
28
+ /** Clear selection and loaded-row eligibility when an account or permission boundary changes. */
29
+ readonly resetKey?: string | number;
30
+ }
31
+ export interface DataTableGroupingOptions {
32
+ /** Accessor column whose scalar values define first-seen groups. */
33
+ readonly by: string;
34
+ readonly collapsible?: boolean;
35
+ readonly defaultExpanded?: boolean;
36
+ readonly getLabel?: (value: ColumnValue) => string;
37
+ }
38
+ export interface DataTableHierarchyOptions<Row extends object> {
39
+ /** Return known child rows synchronously. Undefined represents an unloaded subtree. */
40
+ readonly getChildren?: (row: Row) => readonly Row[] | undefined;
41
+ /** Required with onLoadChildren so known leaves are not presented as expandable. */
42
+ readonly hasChildren?: (row: Row) => boolean;
43
+ readonly onLoadChildren?: (row: Row, signal: AbortSignal) => Promise<readonly Row[]>;
44
+ readonly defaultExpanded?: boolean | readonly string[];
45
+ /** Clear expansion and loaded subtrees when an account or permission boundary changes. */
46
+ readonly resetKey?: string | number;
47
+ }
48
+ export type DataTableExportFormat = "csv" | "json";
49
+ export interface DataTableExportOptions {
50
+ /** Formats shown in the export menu. Defaults to CSV and JSON. */
51
+ readonly formats?: readonly DataTableExportFormat[];
52
+ /** Download filename without an extension. Defaults to a slug derived from the caption. */
53
+ readonly filename?: string;
54
+ /** Aborts work and revokes the retained artifact when an account or permission boundary changes. */
55
+ readonly resetKey?: string | number;
56
+ }
57
+ export interface DataTableCellCommitRequest<Row extends object> extends CellCommitRequest<ColumnValue> {
58
+ readonly rowId: string;
59
+ readonly row: Row;
60
+ readonly column: string;
61
+ }
62
+ export interface DataTableActionContext<Row extends object> {
63
+ /** Immutable explicit-ID or all-matching selection passed to the application action. */
64
+ readonly selection: BulkSelection;
65
+ /** Selected rows that are present in the accepted page/view. Never implies complete query materialization. */
66
+ readonly loadedRows: readonly Row[];
67
+ /** Row that opened a context menu. Omitted for the selection action bar. */
68
+ readonly anchor?: Row;
69
+ }
70
+ export interface DataTableAction<Row extends object> {
71
+ readonly id: string;
72
+ readonly label: string;
73
+ readonly shortcut?: string;
74
+ readonly tone?: "neutral" | "accent" | "danger" | "success";
75
+ readonly disabled?: boolean | ((context: DataTableActionContext<Row>) => boolean);
76
+ readonly onSelect: (context: DataTableActionContext<Row>) => void;
77
+ }
78
+ export interface DataTableMobileLayoutOptions {
79
+ /** Number of cards per local page in continuous mode. Numbered tables keep their configured page size. */
80
+ readonly pageSize?: number;
81
+ /** Visible column used as the card heading. Falls back to the first visible column when omitted or hidden. */
82
+ readonly titleColumn?: string;
83
+ }
84
+ export type DataTableVariant = "integrated" | "framed";
85
+ export type DataTableDensity = "compact" | "comfortable" | "spacious";
86
+ export interface DataTableSearchOptions {
87
+ /** Visible-to-assistive-technology input label. Defaults to a localized caption-specific label. */
88
+ readonly label?: string;
89
+ /** Input placeholder. Defaults to the resolved label. */
90
+ readonly placeholder?: string;
91
+ /** Trailing delay in milliseconds. Defaults to 120. */
92
+ readonly debounce?: number;
93
+ /** Optional application shortcut, for example mod+f. */
94
+ readonly shortcut?: string;
95
+ /** Enables a visible Smart/Exact control whose Exact mode matches one literal phrase within a searchable column. */
96
+ readonly exactMatch?: boolean;
97
+ }
98
+ export interface DataTableFilterBarOptions {
99
+ /** Optional date package adapter. Omission keeps the native date-input fallback and table bundle boundary. */
100
+ readonly dateEditor?: FilterDateEditor;
101
+ }
102
+ interface DataTableBaseProps<Row extends object> {
103
+ readonly columns: SheenColumns<Row>;
104
+ readonly getRowId: (row: Row) => string;
105
+ readonly caption: string;
106
+ /** Framed is a standalone surface. Integrated joins application-pane chrome. DataTablePage supplies integrated context when omitted. */
107
+ readonly variant?: DataTableVariant;
108
+ /** Optional local density for table chrome and rows. Omission inherits the surrounding application density. */
109
+ readonly density?: DataTableDensity;
110
+ readonly pagination?: TablePagination;
111
+ readonly initialState?: DataTableInitialState;
112
+ /** Reactively applies an app-owned accepted filter. Use onAcceptedStateChange to keep table-authored changes synchronized. */
113
+ readonly filter?: FilterNode;
114
+ readonly rowHeight?: string;
115
+ readonly variableRowHeight?: boolean;
116
+ readonly estimatedRowHeight?: number;
117
+ readonly initialViewportHeight?: number;
118
+ readonly class?: string;
119
+ readonly onAcceptedStateChange?: (state: TableState) => void;
120
+ readonly onRowActivate?: (row: Row) => void;
121
+ readonly selection?: DataTableSelectionOptions<Row>;
122
+ /** One action model rendered in both the selection bar and each row context menu. */
123
+ readonly actions?: readonly DataTableAction<Row>[];
124
+ /** Opt into a card presentation below 768px. Continuous results receive bounded local paging. */
125
+ readonly mobileLayout?: boolean | DataTableMobileLayoutOptions;
126
+ readonly grouping?: DataTableGroupingOptions;
127
+ readonly hierarchy?: DataTableHierarchyOptions<Row>;
128
+ /** Configure global search declared by columns. False hides and disables table search. */
129
+ readonly search?: false | DataTableSearchOptions;
130
+ /** Show filters configured by column definitions in the table toolbar. */
131
+ readonly filterBar?: boolean | DataTableFilterBarOptions;
132
+ /** Show the keyboard-accessible visibility, order, pin, and sizing menu. */
133
+ readonly columnControls?: boolean;
134
+ /** Client exports are enabled by default. False hides them; options customize format and filename. */
135
+ readonly export?: false | DataTableExportOptions;
136
+ /** Commits values from columns that declare an editor. Required when any editor is present. */
137
+ readonly onCellCommit?: (request: DataTableCellCommitRequest<Row>, signal: AbortSignal) => Promise<CellCommitResult<ColumnValue, string>>;
138
+ /** Discards drafts and aborts commits when an account or permission boundary changes. */
139
+ readonly editResetKey?: string | number;
140
+ }
141
+ export interface ClientDataTableProps<Row extends object> extends DataTableBaseProps<Row> {
142
+ readonly mode?: "client";
143
+ readonly data: readonly Row[];
144
+ readonly initialResult?: never;
145
+ readonly onStateChange?: never;
146
+ readonly onExport?: never;
147
+ }
148
+ export interface ServerDataTableProps<Row extends object> extends DataTableBaseProps<Row> {
149
+ readonly mode: "server";
150
+ readonly pagination: TablePagination;
151
+ readonly data?: never;
152
+ readonly initialResult?: DataTableResult<Row>;
153
+ readonly onStateChange: (state: TableState, signal: AbortSignal) => Promise<DataTableResult<Row>>;
154
+ /** Creates a complete server-side export for the captured accepted query and selection. Without this adapter, export UI is hidden. */
155
+ readonly onExport?: (request: TableExportRequest, signal: AbortSignal) => Promise<Blob>;
156
+ }
157
+ export type DataTableProps<Row extends object> = ClientDataTableProps<Row> | ServerDataTableProps<Row>;
158
+ export declare function DataTable<Row extends object>(props: DataTableProps<Row>): JSX.Element;
159
+ export {};