@opencorestack/opengridx 0.1.6 → 0.1.8

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 (130) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.md +9 -0
  3. package/dist/index.d.ts +12 -1
  4. package/dist/opengridx.css +1 -1
  5. package/dist/opengridx.es.js +2505 -2450
  6. package/dist/opengridx.es.js.map +1 -1
  7. package/dist/opengridx.umd.js +12 -12
  8. package/dist/opengridx.umd.js.map +1 -1
  9. package/docs/API_REFERENCE.md +177 -0
  10. package/docs/README.md +60 -0
  11. package/docs/components/cell.md +44 -0
  12. package/docs/components/column-group-header.md +57 -0
  13. package/docs/components/column-resize.md +63 -0
  14. package/docs/components/column-visibility.md +61 -0
  15. package/docs/components/datagrid.md +70 -0
  16. package/docs/components/filter-panel.md +26 -0
  17. package/docs/components/header.md +39 -0
  18. package/docs/components/pagination.md +34 -0
  19. package/docs/components/row.md +31 -0
  20. package/docs/components/toolbar.md +40 -0
  21. package/docs/components/tooltip.md +68 -0
  22. package/docs/customization/slots-api.md +227 -0
  23. package/docs/customization/theming.md +293 -0
  24. package/docs/features/aggregation-pivot.md +79 -0
  25. package/docs/features/cell-spanning.md +520 -0
  26. package/docs/features/clipboard.md +76 -0
  27. package/docs/features/custom-pagination.md +143 -0
  28. package/docs/features/data-source.md +72 -0
  29. package/docs/features/editing-reordering.md +99 -0
  30. package/docs/features/export-guide.md +434 -0
  31. package/docs/features/filtering.md +83 -0
  32. package/docs/features/infinite-scroll.md +87 -0
  33. package/docs/features/list-view.md +65 -0
  34. package/docs/features/loading-states.md +68 -0
  35. package/docs/features/master-detail.md +46 -0
  36. package/docs/features/pinning.md +67 -0
  37. package/docs/features/selection.md +70 -0
  38. package/docs/features/sorting-pagination.md +66 -0
  39. package/docs/features/state-persistence.md +67 -0
  40. package/docs/features/tree-data-grouping.md +67 -0
  41. package/docs/features/virtualization.md +188 -0
  42. package/docs/roadmap.md +71 -0
  43. package/lib/components/Cell/Cell.css +119 -0
  44. package/lib/components/Cell/Cell.tsx +264 -0
  45. package/lib/components/Cell/GridEditInputCell.css +62 -0
  46. package/lib/components/Cell/GridEditInputCell.tsx +152 -0
  47. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.css +67 -0
  48. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.tsx +220 -0
  49. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.css +31 -0
  50. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.tsx +85 -0
  51. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +137 -0
  52. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.tsx +190 -0
  53. package/lib/components/DataGrid/DataGrid.css +224 -0
  54. package/lib/components/DataGrid/DataGrid.tsx +2269 -0
  55. package/lib/components/DetailPanel/DetailPanel.css +36 -0
  56. package/lib/components/DetailPanel/DetailPanel.tsx +34 -0
  57. package/lib/components/FilterPanel/FilterPanel.css +196 -0
  58. package/lib/components/FilterPanel/FilterPanel.tsx +214 -0
  59. package/lib/components/FilterPanel/index.ts +1 -0
  60. package/lib/components/Header/ColumnMenu.css +68 -0
  61. package/lib/components/Header/ColumnMenu.tsx +249 -0
  62. package/lib/components/Header/Header.css +224 -0
  63. package/lib/components/Header/Header.tsx +516 -0
  64. package/lib/components/ListView/ListView.css +112 -0
  65. package/lib/components/ListView/ListViewRow.tsx +63 -0
  66. package/lib/components/Pagination/Pagination.css +91 -0
  67. package/lib/components/Pagination/Pagination.tsx +151 -0
  68. package/lib/components/QuickFilter/QuickFilter.css +23 -0
  69. package/lib/components/QuickFilter/QuickFilter.tsx +79 -0
  70. package/lib/components/Row/Row.css +126 -0
  71. package/lib/components/Row/Row.tsx +377 -0
  72. package/lib/components/Skeleton/Skeleton.css +55 -0
  73. package/lib/components/Skeleton/Skeleton.tsx +22 -0
  74. package/lib/components/SkeletonRow/SkeletonRow.css +32 -0
  75. package/lib/components/SkeletonRow/SkeletonRow.tsx +89 -0
  76. package/lib/components/SkeletonRow/index.ts +1 -0
  77. package/lib/components/Toolbar/GlobalSearch.css +110 -0
  78. package/lib/components/Toolbar/GlobalSearch.tsx +167 -0
  79. package/lib/components/Toolbar/GridToolbar.css +221 -0
  80. package/lib/components/Toolbar/GridToolbar.tsx +658 -0
  81. package/lib/components/Toolbar/PivotPanel.css +212 -0
  82. package/lib/components/Toolbar/PivotPanel.tsx +239 -0
  83. package/lib/components/Tooltip/Tooltip.css +59 -0
  84. package/lib/components/Tooltip/Tooltip.tsx +106 -0
  85. package/lib/components/ui/Button.css +89 -0
  86. package/lib/components/ui/Button.tsx +39 -0
  87. package/lib/components/ui/Checkbox.css +71 -0
  88. package/lib/components/ui/Checkbox.tsx +66 -0
  89. package/lib/components/ui/DragHandleIcon.css +19 -0
  90. package/lib/components/ui/DragHandleIcon.tsx +18 -0
  91. package/lib/components/ui/ExpandIcon.css +38 -0
  92. package/lib/components/ui/ExpandIcon.tsx +75 -0
  93. package/lib/components/ui/Input.css +59 -0
  94. package/lib/components/ui/Input.tsx +45 -0
  95. package/lib/components/ui/index.ts +15 -0
  96. package/lib/hooks/core/useDataGrid.ts +392 -0
  97. package/lib/hooks/core/useGridApiRef.ts +10 -0
  98. package/lib/hooks/features/useAggregation.ts +143 -0
  99. package/lib/hooks/features/useGridClipboard.ts +133 -0
  100. package/lib/hooks/features/useGridDataSource.ts +190 -0
  101. package/lib/hooks/features/useGridEditing.ts +100 -0
  102. package/lib/hooks/features/useGridSpanning.ts +349 -0
  103. package/lib/hooks/features/usePivot.ts +174 -0
  104. package/lib/hooks/useColumnReorder.ts +114 -0
  105. package/lib/hooks/useRowGrouping.ts +302 -0
  106. package/lib/hooks/useRowReorder.ts +83 -0
  107. package/lib/hooks/useTreeData.ts +323 -0
  108. package/lib/index.ts +106 -0
  109. package/lib/state/index.ts +17 -0
  110. package/lib/state/types.ts +48 -0
  111. package/lib/state/useGridStateStorage.ts +113 -0
  112. package/lib/styles/base/reset.css +21 -0
  113. package/lib/styles/base/variables.css +161 -0
  114. package/lib/styles/opengridx.css +27 -0
  115. package/lib/styles/opengridx.css.d.ts +4 -0
  116. package/lib/theme/DataGridThemeProvider.tsx +276 -0
  117. package/lib/theme/defaultStyles.ts +0 -0
  118. package/lib/theme/index.ts +21 -0
  119. package/lib/theme/presets.ts +148 -0
  120. package/lib/theme/types.ts +155 -0
  121. package/lib/types/index.ts +764 -0
  122. package/lib/utils/export/exportToExcelAdvanced.ts +516 -0
  123. package/lib/utils/export/index.ts +550 -0
  124. package/lib/utils/filtering/index.ts +240 -0
  125. package/lib/utils/pinning/index.ts +282 -0
  126. package/lib/utils/sorting/index.ts +55 -0
  127. package/lib/utils/virtualization/index.ts +106 -0
  128. package/lib/vite-env.d.ts +1 -0
  129. package/llms.txt +2 -1
  130. package/package.json +12 -4
@@ -0,0 +1,36 @@
1
+ .ogx__detail-panel {
2
+ display: flex;
3
+ background: var(--ogx-color-gray-50);
4
+ border-top: 1px solid var(--ogx-border-color);
5
+ border-bottom: 1px solid var(--ogx-border-color);
6
+ transition: height 0.2s ease-in-out;
7
+ position: relative;
8
+ min-width: fit-content;
9
+ width: 100%;
10
+ box-sizing: border-box;
11
+ }
12
+ .ogx__detail-panel-content {
13
+ padding: var(--ogx-spacing-md);
14
+ width: 100%;
15
+ min-width: 100%;
16
+ box-sizing: border-box;
17
+ }
18
+ @keyframes detailPanelExpand {
19
+ from {
20
+ opacity: 0;
21
+ transform: translateY(-10px);
22
+ }
23
+ to {
24
+ opacity: 1;
25
+ transform: translateY(0);
26
+ }
27
+ }
28
+ .ogx__detail-panel {
29
+ animation: detailPanelExpand 0.2s ease-out;
30
+ }
31
+ @media (prefers-color-scheme: dark) {
32
+ .ogx__detail-panel {
33
+ background: var(--ogx-color-gray-800);
34
+ border-color: var(--ogx-color-gray-700);
35
+ }
36
+ }
@@ -0,0 +1,34 @@
1
+
2
+ import React from 'react';
3
+ import type { GridRowModel, GridRowId, GridDetailPanelHeight } from '../../types';
4
+
5
+
6
+ export interface DetailPanelProps<R extends GridRowModel = GridRowModel> {
7
+ row: R;
8
+ rowId: GridRowId;
9
+ rowIndex: number;
10
+ content: React.ReactNode;
11
+ height: GridDetailPanelHeight;
12
+ isExpanded: boolean;
13
+ }
14
+
15
+ export function DetailPanel<R extends GridRowModel = GridRowModel>(props: DetailPanelProps<R>) {
16
+ const { content, height, isExpanded } = props;
17
+
18
+ if (!isExpanded) {
19
+ return null;
20
+ }
21
+
22
+ const style: React.CSSProperties = {
23
+ height: height === 'auto' ? 'auto' : `${height}px`,
24
+ overflow: height === 'auto' ? 'visible' : 'auto'
25
+ };
26
+
27
+ return (
28
+ <div className="ogx__detail-panel" style={style}>
29
+ <div className="ogx__detail-panel-content">
30
+ {content}
31
+ </div>
32
+ </div>
33
+ );
34
+ }
@@ -0,0 +1,196 @@
1
+ .ogx-filter__logic-bar {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 6px;
5
+ padding: 8px var(--ogx-spacing-md);
6
+ border-bottom: var(--ogx-border-width-thin) solid var(--ogx-grid-border-color);
7
+ background: var(--ogx-grid-header-background);
8
+ }
9
+ .ogx-filter__logic-label {
10
+ font-family: var(--ogx-font-family);
11
+ font-size: var(--ogx-font-size-xs);
12
+ font-weight: 500;
13
+ color: var(--ogx-grid-header-text);
14
+ margin-right: 2px;
15
+ }
16
+ .ogx-filter__logic-pill {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ padding: 3px 8px;
20
+ border: var(--ogx-border-width-thin) solid var(--ogx-border-color);
21
+ border-radius: 999px;
22
+ background: transparent;
23
+ color: var(--ogx-grid-row-text);
24
+ font-family: var(--ogx-font-family-mono, monospace);
25
+ font-size: 10px;
26
+ font-weight: 500;
27
+ letter-spacing: 0.04em;
28
+ text-transform: uppercase;
29
+ cursor: pointer;
30
+ transition: background 0.15s, border-color 0.15s, color 0.15s;
31
+ line-height: 1;
32
+ }
33
+ .ogx-filter__logic-pill:hover {
34
+ border-color: var(--ogx-color-primary);
35
+ color: var(--ogx-color-primary);
36
+ }
37
+ .ogx-filter__logic-pill--active {
38
+ background: var(--ogx-toolbar-chip-active-bg, var(--ogx-color-primary));
39
+ border-color: var(--ogx-toolbar-chip-active-bg, var(--ogx-color-primary));
40
+ color: var(--ogx-toolbar-chip-active-text, #fff);
41
+ font-weight: 700;
42
+ }
43
+ .ogx-filter__row {
44
+ display: flex;
45
+ align-items: center;
46
+ gap: var(--ogx-spacing-sm);
47
+ padding: 8px var(--ogx-spacing-md);
48
+ border-bottom: var(--ogx-border-width-thin) solid var(--ogx-grid-border-color);
49
+ transition: background 0.1s;
50
+ min-height: 44px;
51
+ }
52
+ .ogx-filter__row:last-child {
53
+ border-bottom: none;
54
+ }
55
+ .ogx-filter__row:hover {
56
+ background: var(--ogx-grid-row-hover-background);
57
+ }
58
+ .ogx-filter__row--active {
59
+ background: var(--ogx-overlay-item-selected-bg, rgba(25, 118, 210, 0.04));
60
+ }
61
+ .ogx-filter__row--active:hover {
62
+ background: var(--ogx-overlay-item-selected-bg, rgba(25, 118, 210, 0.07));
63
+ opacity: 0.9;
64
+ }
65
+ .ogx-filter__col-label {
66
+ flex: 0 0 140px;
67
+ font-family: var(--ogx-font-family);
68
+ font-size: var(--ogx-font-size-xs);
69
+ font-weight: 500;
70
+ color: var(--ogx-grid-row-text);
71
+ overflow: hidden;
72
+ text-overflow: ellipsis;
73
+ white-space: nowrap;
74
+ }
75
+ .ogx-filter__controls {
76
+ display: flex;
77
+ align-items: center;
78
+ gap: 6px;
79
+ flex: 1;
80
+ }
81
+ .ogx-filter__op-select {
82
+ padding: 5px 24px 5px 8px;
83
+ border: var(--ogx-border-width-thin) solid var(--ogx-border-color);
84
+ border-radius: var(--ogx-border-radius-sm);
85
+ font-family: var(--ogx-font-family-mono, monospace);
86
+ font-size: 11px;
87
+ font-weight: 600;
88
+ text-transform: uppercase;
89
+ letter-spacing: 0.04em;
90
+ background: var(--ogx-grid-background);
91
+ color: var(--ogx-grid-row-text);
92
+ cursor: pointer;
93
+ outline: none;
94
+ transition: border-color 0.15s;
95
+ appearance: none;
96
+ -webkit-appearance: none;
97
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
98
+ background-repeat: no-repeat;
99
+ background-position: right 6px center;
100
+ min-width: 130px;
101
+ }
102
+ .ogx-filter__op-select:focus-visible {
103
+ border-color: var(--ogx-color-primary);
104
+ }
105
+ .ogx-filter__op-select--active {
106
+ border-color: var(--ogx-toolbar-input-focus-border, var(--ogx-color-primary));
107
+ color: var(--ogx-color-primary);
108
+ font-weight: 700;
109
+ }
110
+ .ogx-filter__value-input {
111
+ flex: 1;
112
+ min-width: 60px;
113
+ padding: 4px 8px;
114
+ border: var(--ogx-border-width-thin) solid var(--ogx-border-color);
115
+ border-radius: var(--ogx-border-radius-sm);
116
+ font-family: var(--ogx-font-family);
117
+ font-size: var(--ogx-font-size-xs);
118
+ background: var(--ogx-grid-background);
119
+ color: var(--ogx-grid-row-text);
120
+ outline: none;
121
+ transition: border-color 0.15s, box-shadow 0.15s;
122
+ }
123
+ .ogx-filter__value-input::placeholder {
124
+ color: var(--ogx-overlay-text, var(--ogx-color-gray-400));
125
+ opacity: 0.6;
126
+ }
127
+ .ogx-filter__value-input:focus {
128
+ border-color: var(--ogx-toolbar-input-focus-border, var(--ogx-color-primary));
129
+ box-shadow: var(--ogx-toolbar-input-focus-shadow, 0 0 0 2px rgba(25, 118, 210, 0.15));
130
+ }
131
+ .ogx-filter__value-input--active {
132
+ border-color: var(--ogx-color-primary);
133
+ }
134
+ .ogx-filter__value-select {
135
+ flex: 1;
136
+ appearance: none;
137
+ -webkit-appearance: none;
138
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
139
+ background-repeat: no-repeat;
140
+ background-position: right 10px center;
141
+ padding-right: 28px;
142
+ cursor: pointer;
143
+ }
144
+ .ogx-filter__row-clear {
145
+ display: inline-flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ width: 22px;
149
+ height: 22px;
150
+ padding: 0;
151
+ border: none;
152
+ border-radius: 50%;
153
+ background: transparent;
154
+ color: var(--ogx-overlay-text, var(--ogx-color-gray-400));
155
+ font-size: 16px;
156
+ line-height: 1;
157
+ cursor: pointer;
158
+ flex-shrink: 0;
159
+ transition: background 0.15s, color 0.15s;
160
+ }
161
+ .ogx-filter__row-clear:hover {
162
+ background: var(--ogx-toolbar-btn-danger-bg, rgba(239, 68, 68, 0.08));
163
+ color: var(--ogx-toolbar-btn-danger-text, #ef4444);
164
+ }
165
+ .ogx-filter__empty {
166
+ padding: var(--ogx-spacing-md);
167
+ font-family: var(--ogx-font-family);
168
+ font-size: var(--ogx-font-size-sm);
169
+ color: var(--ogx-overlay-text, var(--ogx-color-gray-400));
170
+ opacity: 0.7;
171
+ text-align: center;
172
+ }
173
+ .ogx-toolbar__panel--filter {
174
+ width: 640px;
175
+ max-width: calc(100vw - 24px);
176
+ }
177
+ .ogx-toolbar__panel-body--filter {
178
+ max-height: 420px;
179
+ overflow-y: auto;
180
+ padding: 0;
181
+ }
182
+ .ogx-toolbar__panel-count {
183
+ display: inline-flex;
184
+ align-items: center;
185
+ justify-content: center;
186
+ min-width: 18px;
187
+ height: 18px;
188
+ padding: 0 5px;
189
+ border-radius: 999px;
190
+ background: var(--ogx-toolbar-btn-primary-bg, var(--ogx-color-primary));
191
+ color: var(--ogx-toolbar-btn-primary-text, #fff);
192
+ font-size: 10px;
193
+ font-weight: 700;
194
+ line-height: 1;
195
+ margin-left: 4px;
196
+ }
@@ -0,0 +1,214 @@
1
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
+ import type {
3
+ GridFilterModel,
4
+ GridFilterItem,
5
+ GridColDef,
6
+ GridFilterOperator
7
+ } from '../../types';
8
+ import { getOperatorsForType } from '../../utils/filtering';
9
+
10
+
11
+ interface FilterPanelProps {
12
+ filterModel: GridFilterModel;
13
+ columns: GridColDef[];
14
+ onFilterModelChange: (model: GridFilterModel) => void;
15
+ }
16
+
17
+ const NO_VALUE_OPERATORS = new Set(['isEmpty', 'isNotEmpty']);
18
+
19
+ function getActiveFilter(items: GridFilterItem[], field: string): GridFilterItem | undefined {
20
+ return items.find(item => 'field' in item && item.field === field) as GridFilterItem | undefined;
21
+ }
22
+
23
+ const FilterRow: React.FC<{
24
+ col: GridColDef;
25
+ item: GridFilterItem | undefined;
26
+ onChange: (item: GridFilterItem | null) => void;
27
+ }> = ({ col, item, onChange }) => {
28
+ const operators = getOperatorsForType(col.type);
29
+ const isActive = !!item;
30
+ const currentOperator = item?.operator ?? operators[0];
31
+
32
+ // Local input state to prevent full filter-panel re-render on every keystroke
33
+ const [localValue, setLocalValue] = useState(item?.value ?? '');
34
+ const onChangeRef = useRef(onChange);
35
+ onChangeRef.current = onChange;
36
+
37
+ // Sync when the external item changes (e.g. operator change, clear)
38
+ const prevItemValue = useRef(item?.value);
39
+ useEffect(() => {
40
+ if (item?.value !== prevItemValue.current) {
41
+ prevItemValue.current = item?.value;
42
+ setLocalValue(item?.value ?? '');
43
+ }
44
+ }, [item?.value]);
45
+
46
+ // Debounce propagating the value upward (300ms)
47
+ useEffect(() => {
48
+ const handler = setTimeout(() => {
49
+ const currentValue = item?.value ?? '';
50
+ if (localValue !== currentValue) {
51
+ onChangeRef.current({
52
+ id: item?.id ?? `${col.field}-${Date.now()}`,
53
+ field: col.field,
54
+ operator: currentOperator as GridFilterOperator,
55
+ value: localValue,
56
+ });
57
+ }
58
+ }, 300);
59
+ return () => clearTimeout(handler);
60
+ // eslint-disable-next-line react-hooks/exhaustive-deps
61
+ }, [localValue]);
62
+
63
+ const handleOperatorChange = (op: string) => {
64
+ const noValue = NO_VALUE_OPERATORS.has(op);
65
+ const newItem: GridFilterItem = {
66
+ id: item?.id ?? `${col.field}-${Date.now()}`,
67
+ field: col.field,
68
+ operator: op as GridFilterOperator,
69
+ value: noValue ? undefined : (item?.value ?? (col.type === 'boolean' ? 'true' : '')),
70
+ };
71
+ onChange(newItem);
72
+ };
73
+
74
+ const handleClear = () => {
75
+ setLocalValue('');
76
+ onChange(null);
77
+ };
78
+
79
+ const isNoValue = NO_VALUE_OPERATORS.has(String(currentOperator));
80
+ const isBoolean = col.type === 'boolean';
81
+ const showValue = !isNoValue;
82
+
83
+ return (
84
+ <div className={`ogx-filter__row${isActive ? ' ogx-filter__row--active' : ''}`}>
85
+ { }
86
+ <span className="ogx-filter__col-label" title={col.field}>
87
+ {col.headerName || col.field}
88
+ </span>
89
+
90
+ { }
91
+ <div className="ogx-filter__controls">
92
+ { }
93
+ <select
94
+ id={`ogx-filter-op-${col.field}`}
95
+ name={`filter-op-${col.field}`}
96
+ className={`ogx-filter__op-select${isActive ? ' ogx-filter__op-select--active' : ''}`}
97
+ value={String(currentOperator)}
98
+ onChange={(e) => handleOperatorChange(e.target.value)}
99
+ aria-label={`Filter operator for ${col.headerName || col.field}`}
100
+ >
101
+ {operators.map(op => (
102
+ <option key={op} value={op}>{op}</option>
103
+ ))}
104
+ </select>
105
+
106
+ { }
107
+ {showValue && isBoolean && (
108
+ <select
109
+ id={`ogx-filter-val-${col.field}`}
110
+ name={`filter-val-${col.field}`}
111
+ className={`ogx-filter__value-input ogx-filter__value-select${isActive ? ' ogx-filter__value-input--active' : ''}`}
112
+ value={String(item?.value ?? 'true')}
113
+ onChange={(e) => {
114
+ setLocalValue(e.target.value);
115
+ onChange({
116
+ id: item?.id ?? `${col.field}-${Date.now()}`,
117
+ field: col.field,
118
+ operator: currentOperator as GridFilterOperator,
119
+ value: e.target.value,
120
+ });
121
+ }}
122
+ aria-label={`Filter value for ${col.headerName || col.field}`}
123
+ >
124
+ <option value="true">true</option>
125
+ <option value="false">false</option>
126
+ </select>
127
+ )}
128
+
129
+ {showValue && !isBoolean && (
130
+ <input
131
+ id={`ogx-filter-val-${col.field}`}
132
+ name={`filter-val-${col.field}`}
133
+ className={`ogx-filter__value-input${isActive ? ' ogx-filter__value-input--active' : ''}`}
134
+ type="text"
135
+ value={localValue}
136
+ onChange={(e) => setLocalValue(e.target.value)}
137
+ placeholder={col.type === 'number' ? 'Number…' : 'Value…'}
138
+ aria-label={`Filter value for ${col.headerName || col.field}`}
139
+ />
140
+ )}
141
+
142
+ {/* Clear button — only when active */}
143
+ {isActive && (
144
+ <button
145
+ className="ogx-filter__row-clear"
146
+ onClick={handleClear}
147
+ aria-label={`Clear filter for ${col.headerName || col.field}`}
148
+ title="Clear"
149
+ >
150
+ ×
151
+ </button>
152
+ )}
153
+ </div>
154
+ </div>
155
+ );
156
+ };
157
+
158
+ // ── Root panel ────────────────────────────────────────────────────────────────
159
+
160
+ export const FilterPanel: React.FC<FilterPanelProps> = ({ filterModel, columns, onFilterModelChange }) => {
161
+ const items: GridFilterItem[] = (filterModel.items ?? []) as GridFilterItem[];
162
+ const logicOperator = filterModel.logicOperator ?? 'and';
163
+
164
+ const handleItemChange = useCallback((field: string, newItem: GridFilterItem | null) => {
165
+ const rest = items.filter(i => 'field' in i && (i as GridFilterItem).field !== field);
166
+ const next: GridFilterItem[] = newItem ? [...rest, newItem] : rest;
167
+ onFilterModelChange({ ...filterModel, items: next });
168
+ }, [items, filterModel, onFilterModelChange]);
169
+
170
+ const handleLogicChange = useCallback((op: 'and' | 'or') => {
171
+ onFilterModelChange({ ...filterModel, logicOperator: op });
172
+ }, [filterModel, onFilterModelChange]);
173
+
174
+ const filterableColumns = columns.filter(col => col.filterable !== false);
175
+
176
+ return (
177
+ <>
178
+ { }
179
+ {items.length > 1 && (
180
+ <div className="ogx-filter__logic-bar">
181
+ <span className="ogx-filter__logic-label">Match:</span>
182
+ <button
183
+ className={`ogx-filter__logic-pill${logicOperator === 'and' ? ' ogx-filter__logic-pill--active' : ''}`}
184
+ onClick={() => handleLogicChange('and')}
185
+ aria-pressed={logicOperator === 'and'}
186
+ >
187
+ ALL (AND)
188
+ </button>
189
+ <button
190
+ className={`ogx-filter__logic-pill${logicOperator === 'or' ? ' ogx-filter__logic-pill--active' : ''}`}
191
+ onClick={() => handleLogicChange('or')}
192
+ aria-pressed={logicOperator === 'or'}
193
+ >
194
+ ANY (OR)
195
+ </button>
196
+ </div>
197
+ )}
198
+
199
+ { }
200
+ {filterableColumns.length === 0 ? (
201
+ <div className="ogx-filter__empty">No filterable columns.</div>
202
+ ) : (
203
+ filterableColumns.map(col => (
204
+ <FilterRow
205
+ key={col.field}
206
+ col={col}
207
+ item={getActiveFilter(items, col.field)}
208
+ onChange={(item) => handleItemChange(col.field, item)}
209
+ />
210
+ ))
211
+ )}
212
+ </>
213
+ );
214
+ };
@@ -0,0 +1 @@
1
+ export * from './FilterPanel';
@@ -0,0 +1,68 @@
1
+ .ogx-column-menu {
2
+ position: fixed;
3
+ background: var(--ogx-overlay-background, #fff);
4
+ box-shadow: var(--ogx-overlay-shadow, 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.06));
5
+ border-radius: var(--ogx-border-radius-md, 8px);
6
+ padding: 4px 0;
7
+ min-width: 190px;
8
+ z-index: 1300;
9
+ }
10
+ .ogx-menu-section-label {
11
+ padding: 6px 14px 2px;
12
+ font-family: var(--ogx-font-family, system-ui, sans-serif);
13
+ font-size: 11px;
14
+ font-weight: 600;
15
+ text-transform: uppercase;
16
+ letter-spacing: 0.06em;
17
+ color: var(--ogx-color-gray-400, #94a3b8);
18
+ user-select: none;
19
+ }
20
+ .ogx-menu-item {
21
+ display: flex;
22
+ align-items: center;
23
+ width: 100%;
24
+ padding: 7px 14px;
25
+ border: none;
26
+ background: transparent;
27
+ cursor: pointer;
28
+ font-family: var(--ogx-font-family, system-ui, sans-serif);
29
+ font-size: var(--ogx-font-size-xs);
30
+ color: var(--ogx-overlay-text, #334155);
31
+ text-align: left;
32
+ gap: 6px;
33
+ transition: background 0.1s;
34
+ }
35
+ .ogx-menu-item:hover {
36
+ background: var(--ogx-overlay-item-hover-bg, #f8fafc);
37
+ color: var(--ogx-overlay-item-hover-text, #0f172a);
38
+ }
39
+ .ogx-menu-item--active {
40
+ color: var(--ogx-overlay-item-selected-text, #1976d2);
41
+ font-weight: 600;
42
+ }
43
+ .ogx-menu-item--active:hover {
44
+ background: var(--ogx-overlay-item-selected-bg, rgba(25, 118, 210, 0.05));
45
+ }
46
+ .ogx-menu-item__indicator {
47
+ flex: 0 0 14px;
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ color: var(--ogx-overlay-item-selected-text, #1976d2);
52
+ }
53
+ .ogx-menu-item__icon {
54
+ flex: 0 0 16px;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ color: var(--ogx-color-gray-400, #94a3b8);
59
+ transition: color 0.1s;
60
+ }
61
+ .ogx-menu-item--active .ogx-menu-item__icon {
62
+ color: var(--ogx-color-primary, #1976d2);
63
+ }
64
+ .ogx-menu-divider {
65
+ height: 1px;
66
+ background: var(--ogx-overlay-border, #e2e8f0);
67
+ margin: 4px 0;
68
+ }