@alaarab/ogrid-mcp 2.4.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 (52) hide show
  1. package/README.md +68 -0
  2. package/bundled-docs/api/README.md +94 -0
  3. package/bundled-docs/api/column-def.mdx +379 -0
  4. package/bundled-docs/api/components-column-chooser.mdx +310 -0
  5. package/bundled-docs/api/components-column-header-filter.mdx +363 -0
  6. package/bundled-docs/api/components-datagrid-table.mdx +316 -0
  7. package/bundled-docs/api/components-pagination-controls.mdx +344 -0
  8. package/bundled-docs/api/components-sidebar.mdx +427 -0
  9. package/bundled-docs/api/components-status-bar.mdx +309 -0
  10. package/bundled-docs/api/grid-api.mdx +299 -0
  11. package/bundled-docs/api/js-api.mdx +198 -0
  12. package/bundled-docs/api/ogrid-props.mdx +244 -0
  13. package/bundled-docs/api/types.mdx +640 -0
  14. package/bundled-docs/features/cell-references.mdx +225 -0
  15. package/bundled-docs/features/column-chooser.mdx +279 -0
  16. package/bundled-docs/features/column-groups.mdx +290 -0
  17. package/bundled-docs/features/column-pinning.mdx +282 -0
  18. package/bundled-docs/features/column-reordering.mdx +359 -0
  19. package/bundled-docs/features/column-types.mdx +181 -0
  20. package/bundled-docs/features/context-menu.mdx +216 -0
  21. package/bundled-docs/features/csv-export.mdx +227 -0
  22. package/bundled-docs/features/editing.mdx +377 -0
  23. package/bundled-docs/features/filtering.mdx +330 -0
  24. package/bundled-docs/features/formulas.mdx +381 -0
  25. package/bundled-docs/features/grid-api.mdx +311 -0
  26. package/bundled-docs/features/keyboard-navigation.mdx +236 -0
  27. package/bundled-docs/features/pagination.mdx +245 -0
  28. package/bundled-docs/features/performance.mdx +433 -0
  29. package/bundled-docs/features/row-selection.mdx +256 -0
  30. package/bundled-docs/features/server-side-data.mdx +291 -0
  31. package/bundled-docs/features/sidebar.mdx +234 -0
  32. package/bundled-docs/features/sorting.mdx +241 -0
  33. package/bundled-docs/features/spreadsheet-selection.mdx +201 -0
  34. package/bundled-docs/features/status-bar.mdx +205 -0
  35. package/bundled-docs/features/toolbar.mdx +284 -0
  36. package/bundled-docs/features/virtual-scrolling.mdx +624 -0
  37. package/bundled-docs/getting-started/installation.mdx +216 -0
  38. package/bundled-docs/getting-started/overview.mdx +151 -0
  39. package/bundled-docs/getting-started/quick-start.mdx +425 -0
  40. package/bundled-docs/getting-started/vanilla-js.mdx +191 -0
  41. package/bundled-docs/guides/accessibility.mdx +550 -0
  42. package/bundled-docs/guides/controlled-vs-uncontrolled.mdx +153 -0
  43. package/bundled-docs/guides/custom-cell-editors.mdx +201 -0
  44. package/bundled-docs/guides/framework-showcase.mdx +200 -0
  45. package/bundled-docs/guides/mcp-live-testing.mdx +291 -0
  46. package/bundled-docs/guides/mcp.mdx +172 -0
  47. package/bundled-docs/guides/migration-from-ag-grid.mdx +223 -0
  48. package/bundled-docs/guides/theming.mdx +211 -0
  49. package/dist/esm/bridge-client.d.ts +87 -0
  50. package/dist/esm/bridge-client.js +162 -0
  51. package/dist/esm/index.js +1060 -0
  52. package/package.json +43 -0
@@ -0,0 +1,427 @@
1
+ ---
2
+ sidebar_position: 15
3
+ title: SideBar
4
+ ---
5
+
6
+ # SideBar
7
+
8
+ A collapsible sidebar panel that provides quick access to column visibility controls and filter inputs. The sidebar has a tab strip with panel toggles and a content area that displays the active panel.
9
+
10
+ ## Import
11
+
12
+
13
+ <Tabs groupId="framework">
14
+ <TabItem value="react" label="React">
15
+
16
+ ```typescript
17
+ // SideBar is a headless component in @alaarab/ogrid-react
18
+ ```
19
+
20
+ :::tip
21
+ The `SideBar` component is framework-agnostic and uses inline styles. All React UI packages (Radix, Fluent, Material) use the same `SideBar` from `@alaarab/ogrid-react`.
22
+ :::
23
+
24
+ </TabItem>
25
+ <TabItem value="angular" label="Angular">
26
+
27
+ ```typescript
28
+ // SideBar is rendered internally by OGridLayout in Angular packages
29
+ ```
30
+
31
+ </TabItem>
32
+ <TabItem value="vue" label="Vue">
33
+
34
+ ```typescript
35
+ // SideBar is rendered internally by OGridLayout in Vue packages
36
+ ```
37
+
38
+ </TabItem>
39
+ <TabItem value="js" label="Vanilla JS">
40
+
41
+ ```typescript
42
+ // SideBar is an internal component in vanilla JS
43
+ ```
44
+
45
+ </TabItem>
46
+ </Tabs>
47
+
48
+ ## Props (React)
49
+
50
+ | Prop | Type | Default | Description |
51
+ |------|------|---------|-------------|
52
+ | `activePanel` | `SideBarPanelId \| null` | **Required** | Currently open panel (`'columns'`, `'filters'`, or `null` for closed). |
53
+ | `onPanelChange` | `(panel: SideBarPanelId \| null) => void` | **Required** | Callback when user toggles a panel. |
54
+ | `panels` | `SideBarPanelId[]` | **Required** | Available panels (`['columns']`, `['filters']`, or `['columns', 'filters']`). |
55
+ | `position` | `'left' \| 'right'` | **Required** | Sidebar position relative to the grid. |
56
+ | `columns` | `IColumnDefinition[]` | **Required** | All columns (for the columns panel). |
57
+ | `visibleColumns` | `Set<string>` | **Required** | Currently visible column IDs. |
58
+ | `onVisibilityChange` | `(columnKey: string, visible: boolean) => void` | **Required** | Callback when a column's visibility is toggled. |
59
+ | `onSetVisibleColumns` | `(columns: Set<string>) => void` | **Required** | Bulk-set all visible columns (used by Select All / Clear All). |
60
+ | `filterableColumns` | `SideBarFilterColumn[]` | **Required** | Filterable columns (for the filters panel). |
61
+ | `filters` | `IFilters` | **Required** | Active filter values. |
62
+ | `onFilterChange` | `(key: string, value: FilterValue \| undefined) => void` | **Required** | Callback when a filter value changes. |
63
+ | `filterOptions` | `Record<string, string[]>` | **Required** | Available options for multi-select filters (column ID → options array). |
64
+
65
+ ## SideBarFilterColumn
66
+
67
+ Describes a filterable column for the sidebar filters panel:
68
+
69
+ ```typescript
70
+ interface SideBarFilterColumn {
71
+ columnId: string;
72
+ name: string;
73
+ filterField: string;
74
+ filterType: 'text' | 'multiSelect' | 'people' | 'date';
75
+ }
76
+ ```
77
+
78
+ | Field | Type | Description |
79
+ |-------|------|-------------|
80
+ | `columnId` | `string` | Unique column identifier. |
81
+ | `name` | `string` | Display name shown in the filters panel. |
82
+ | `filterField` | `string` | Field name used in the `IFilters` object. |
83
+ | `filterType` | `'text' \| 'multiSelect' \| 'people' \| 'date'` | Filter input type. |
84
+
85
+ ## Panels
86
+
87
+ ### Columns Panel (`'columns'`)
88
+
89
+ Shows a list of all columns with checkboxes. Users can:
90
+ - Check/uncheck individual columns to show/hide them
91
+ - Click "Select All" to show all columns
92
+ - Click "Clear All" to hide all optional columns (required columns remain visible)
93
+
94
+ This panel provides the same functionality as the `ColumnChooser` dropdown but in a persistent sidebar format.
95
+
96
+ ### Filters Panel (`'filters'`)
97
+
98
+ Shows filter inputs for all filterable columns. Users can:
99
+ - Enter text queries for text filters
100
+ - Select multiple values for multi-select filters
101
+ - Search and select users for people filters
102
+ - Enter date ranges for date filters
103
+
104
+ All filters are applied immediately as the user types or selects values (no "Apply" button required).
105
+
106
+ ## Enabling in OGrid
107
+
108
+ The top-level `OGrid` component accepts a `sideBar` prop:
109
+
110
+ ```tsx
111
+
112
+ // Boolean mode: show default panels (columns + filters)
113
+ <OGrid sideBar={true} {...props} />
114
+
115
+ // Custom configuration
116
+ <OGrid
117
+ sideBar={{
118
+ panels: ['columns', 'filters'],
119
+ defaultPanel: 'columns',
120
+ position: 'right',
121
+ }}
122
+ {...props}
123
+ />
124
+ ```
125
+
126
+ ## ISideBarDef
127
+
128
+ Configuration options for the sidebar:
129
+
130
+ ```typescript
131
+ interface ISideBarDef {
132
+ panels?: SideBarPanelId[];
133
+ defaultPanel?: SideBarPanelId;
134
+ position?: 'left' | 'right';
135
+ }
136
+ ```
137
+
138
+ | Field | Type | Default | Description |
139
+ |-------|------|---------|-------------|
140
+ | `panels` | `SideBarPanelId[]` | `['columns', 'filters']` | Which panels to show. |
141
+ | `defaultPanel` | `SideBarPanelId` | `undefined` | Panel to open on mount. Omit to start closed. |
142
+ | `position` | `'left' \| 'right'` | `'right'` | Sidebar position relative to the grid. |
143
+
144
+ ## Usage
145
+
146
+ ### Basic Example (React)
147
+
148
+ ```tsx
149
+
150
+ function MyGrid() {
151
+ const [activePanel, setActivePanel] = useState<'columns' | 'filters' | null>('columns');
152
+ const [visibleColumns, setVisibleColumns] = useState<Set<string>>(new Set(['id', 'name', 'price']));
153
+ const [filters, setFilters] = useState<IFilters>({});
154
+
155
+ const columns = [
156
+ { columnId: 'id', name: 'ID', required: true },
157
+ { columnId: 'name', name: 'Product Name' },
158
+ { columnId: 'price', name: 'Price' },
159
+ ];
160
+
161
+ const filterableColumns: SideBarFilterColumn[] = [
162
+ { columnId: 'name', name: 'Product Name', filterField: 'name', filterType: 'text' },
163
+ { columnId: 'category', name: 'Category', filterField: 'category', filterType: 'multiSelect' },
164
+ ];
165
+
166
+ const handleVisibilityChange = (columnKey: string, visible: boolean) => {
167
+ const newSet = new Set(visibleColumns);
168
+ if (visible) {
169
+ newSet.add(columnKey);
170
+ } else {
171
+ newSet.delete(columnKey);
172
+ }
173
+ setVisibleColumns(newSet);
174
+ };
175
+
176
+ const handleFilterChange = (key: string, value: FilterValue | undefined) => {
177
+ setFilters({ ...filters, [key]: value });
178
+ };
179
+
180
+ return (
181
+ <SideBar
182
+ activePanel={activePanel}
183
+ onPanelChange={setActivePanel}
184
+ panels={['columns', 'filters']}
185
+ position="right"
186
+ columns={columns}
187
+ visibleColumns={visibleColumns}
188
+ onVisibilityChange={handleVisibilityChange}
189
+ onSetVisibleColumns={setVisibleColumns}
190
+ filterableColumns={filterableColumns}
191
+ filters={filters}
192
+ onFilterChange={handleFilterChange}
193
+ filterOptions={{ category: ['Electronics', 'Clothing', 'Books'] }}
194
+ />
195
+ );
196
+ }
197
+ ```
198
+
199
+ ### Columns Panel Only (React)
200
+
201
+ ```tsx
202
+
203
+ <OGrid
204
+ sideBar={{
205
+ panels: ['columns'],
206
+ defaultPanel: 'columns',
207
+ position: 'left',
208
+ }}
209
+ {...props}
210
+ />
211
+ ```
212
+
213
+ ### Filters Panel Only (React)
214
+
215
+ ```tsx
216
+
217
+ <OGrid
218
+ sideBar={{
219
+ panels: ['filters'],
220
+ defaultPanel: 'filters',
221
+ position: 'right',
222
+ }}
223
+ {...props}
224
+ />
225
+ ```
226
+
227
+ ## Angular Usage
228
+
229
+ In Angular packages, the sidebar is rendered internally by `OGridLayoutComponent` when `sideBar` is enabled:
230
+
231
+ ```typescript
232
+
233
+ @Component({
234
+ selector: 'app-my-grid',
235
+ template: `
236
+ <ogrid [propsInput]="gridProps" />
237
+ `
238
+ })
239
+ export class MyGridComponent {
240
+ ogridService = new OGridService<Product>();
241
+
242
+ constructor() {
243
+ // Enable sidebar via props
244
+ this.ogridService.setProps({
245
+ sideBar: {
246
+ panels: ['columns', 'filters'],
247
+ defaultPanel: 'columns',
248
+ position: 'right',
249
+ },
250
+ });
251
+ }
252
+
253
+ gridProps = this.ogridService.getDataGridProps();
254
+ }
255
+ ```
256
+
257
+ ## Vue Usage
258
+
259
+ In Vue packages, the sidebar is rendered internally by `OGridLayout` when `sideBar` is enabled:
260
+
261
+ ```vue
262
+ <template>
263
+ <OGrid
264
+ :data="products"
265
+ :columns="columns"
266
+ :get-row-id="(item) => item.id"
267
+ :side-bar="{
268
+ panels: ['columns', 'filters'],
269
+ defaultPanel: 'columns',
270
+ position: 'right',
271
+ }"
272
+ />
273
+ </template>
274
+
275
+ <script setup lang="ts">
276
+
277
+ const products = [...];
278
+ const columns = [...];
279
+ </script>
280
+ ```
281
+
282
+ ## Behavior
283
+
284
+ ### Tab Strip
285
+
286
+ The sidebar has a vertical tab strip with one button per panel:
287
+ - **C** — Columns panel button
288
+ - **F** — Filters panel button
289
+
290
+ Clicking a tab toggles the panel:
291
+ - If the panel is closed → open it
292
+ - If the panel is open → close it
293
+ - If another panel is open → close it and open the clicked panel
294
+
295
+ ### Panel Content
296
+
297
+ The panel content area has a fixed width (240px) and scrollable content. The panel is rendered next to the grid with a border (left border when `position: 'right'`, right border when `position: 'left'`).
298
+
299
+ ### Keyboard Navigation
300
+
301
+ - `Tab` / `Shift+Tab` — Move focus between interactive elements
302
+ - `Enter` / `Space` — Toggle panel buttons, checkboxes, and other controls
303
+
304
+ ## Accessibility
305
+
306
+ `SideBar` implements WCAG 2.1 AA standards with full keyboard and screen reader support.
307
+
308
+ ### ARIA Attributes
309
+
310
+ ```html
311
+ <div>
312
+ <!-- Tab strip -->
313
+ <button
314
+ role="tab"
315
+ aria-label="Columns panel"
316
+ aria-expanded="true"
317
+ aria-controls="panel-columns"
318
+ >
319
+ C
320
+ </button>
321
+ <button
322
+ role="tab"
323
+ aria-label="Filters panel"
324
+ aria-expanded="false"
325
+ aria-controls="panel-filters"
326
+ >
327
+ F
328
+ </button>
329
+
330
+ <!-- Panel content -->
331
+ <div
332
+ role="region"
333
+ id="panel-columns"
334
+ aria-labelledby="tab-columns"
335
+ >
336
+ <h3>Columns</h3>
337
+ <!-- Column checkboxes -->
338
+ </div>
339
+ </div>
340
+ ```
341
+
342
+ | Attribute | Element | Purpose |
343
+ |-----------|---------|---------|
344
+ | `role="tab"` | Tab buttons | Identifies buttons as tabs in a tab interface |
345
+ | `aria-label` | Tab buttons | Descriptive label: "Columns panel", "Filters panel" |
346
+ | `aria-expanded` | Tab buttons | Indicates whether panel is open (`"true"`) or closed (`"false"`) |
347
+ | `aria-controls` | Tab buttons | References the controlled panel's `id` |
348
+ | `role="region"` | Panel content | Identifies the panel as a landmark region |
349
+ | `id` | Panel content | Unique identifier referenced by tab button's `aria-controls` |
350
+ | `aria-labelledby` | Panel content | References the tab button's `id` for accessible name |
351
+
352
+ ### Keyboard Navigation
353
+
354
+ **Tab Strip:**
355
+ - `Tab` / `Shift+Tab` — Navigate between tab buttons
356
+ - `Enter` / `Space` — Toggle focused panel (open/close)
357
+ - `←` `→` — Navigate between tab buttons (alternative to Tab)
358
+
359
+ **Columns Panel:**
360
+ - `Tab` / `Shift+Tab` — Navigate between checkboxes and action buttons
361
+ - `Space` — Toggle focused checkbox
362
+ - `Enter` (on action buttons) — Execute "Select All" or "Clear All"
363
+
364
+ **Filters Panel:**
365
+ - `Tab` / `Shift+Tab` — Navigate between filter inputs
366
+ - Type to enter filter values
367
+ - `Enter` — Apply filter (for text filters)
368
+ - `Space` — Toggle checkboxes (for multi-select filters)
369
+
370
+ ### Focus Management
371
+
372
+ - **Focus visible:** `:focus-visible` styles show 2px solid outline (`--ogrid-accent`) on keyboard navigation
373
+ - **Focus order:** Tab buttons → panel content (top to bottom)
374
+ - **Panel closure:** Closing a panel does not move focus; it remains on the tab button
375
+
376
+ ### Screen Reader Support
377
+
378
+ Screen readers announce:
379
+ - **Tab button:** "Columns panel button, expanded/collapsed"
380
+ - **Panel open:** "Columns panel region, contains 5 column checkboxes"
381
+ - **Checkbox state:** "Product Name checkbox, checked/unchecked"
382
+ - **Filter input:** "Filter by Product Name, edit text"
383
+ - **Action buttons:** "Select All button", "Clear All button"
384
+
385
+ Tested with NVDA, JAWS, VoiceOver, and Narrator.
386
+
387
+ ### High Contrast Mode
388
+
389
+ - Tab buttons and panel content remain visible in high contrast mode
390
+ - Focus indicators use system `Highlight` color
391
+ - Borders use system `ButtonText` color
392
+ - Panel background uses system `Window` color
393
+
394
+ See the [Accessibility Guide](/docs/guides/accessibility) for complete documentation.
395
+
396
+ ## Styling
397
+
398
+ The `SideBar` component uses **inline styles** (no external CSS) to remain framework-agnostic. All styles use CSS custom properties for theming:
399
+
400
+ **CSS custom properties:**
401
+ - `--ogrid-header-bg` — Tab strip and panel header background color
402
+ - `--ogrid-bg` — Panel content background color
403
+ - `--ogrid-border` — Border color
404
+ - `--ogrid-fg` — Foreground text color
405
+
406
+ ## Layout Integration
407
+
408
+ The sidebar is rendered inside `OGridLayout` alongside the grid. The layout structure is:
409
+
410
+ ```
411
+ [Toolbar strip]
412
+ [Sidebar]? [DataGridTable + StatusBar]
413
+ [Footer strip]
414
+ ```
415
+
416
+ When `position: 'left'`, the sidebar is on the left. When `position: 'right'`, it's on the right.
417
+
418
+ ## Related Components
419
+
420
+ - [OGrid](./ogrid-props.mdx) — Top-level wrapper with `sideBar` prop
421
+ - [ColumnChooser](./components-column-chooser.mdx) — Alternative column visibility UI (toolbar dropdown)
422
+ - [ColumnHeaderFilter](./components-column-header-filter.mdx) — Alternative filter UI (column header popovers)
423
+
424
+ ## See Also
425
+
426
+ - [Types: ISideBarDef](./types.mdx#isidebardef) — Sidebar configuration reference
427
+ - [Sidebar Feature Guide](/docs/features/sidebar) — Complete sidebar documentation