chordia-ui 3.7.2 → 3.7.4
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.
- package/dist/CustomFilterChips.cjs.js +1 -1
- package/dist/CustomFilterChips.cjs.js.map +1 -1
- package/dist/CustomFilterChips.es.js +239 -125
- package/dist/CustomFilterChips.es.js.map +1 -1
- package/dist/DataTable2.cjs.js +2 -0
- package/dist/DataTable2.cjs.js.map +1 -0
- package/dist/DataTable2.es.js +1863 -0
- package/dist/DataTable2.es.js.map +1 -0
- package/dist/components/UpdatedInteractionDetails.cjs.js +2 -2
- package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.es.js +14 -13
- package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
- package/dist/components/data.cjs.js +1 -1
- package/dist/components/data.cjs.js.map +1 -1
- package/dist/components/data.es.js +157 -153
- package/dist/components/data.es.js.map +1 -1
- package/dist/components/performance.cjs.js +1 -1
- package/dist/components/performance.cjs.js.map +1 -1
- package/dist/components/performance.es.js +1900 -480
- package/dist/components/performance.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +94 -89
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UpdatedInteractionDetails/UpdatedInteractionDetails.jsx +13 -13
- package/src/components/UpdatedInteractionDetails/UpdatedThreads.jsx +1 -0
- package/src/components/common/CustomFilterChips.jsx +5 -1
- package/src/components/common/Pagination.jsx +152 -39
- package/src/components/data/DataTable2.jsx +2449 -0
- package/src/components/data/DataTableFilters2.jsx +186 -0
- package/src/components/data/index.js +2 -0
- package/src/components/index.js +2 -2
- package/src/components/performance/PerformanceDetailsPage.jsx +940 -0
- package/src/components/performance/PerformancePanel.jsx +423 -297
- package/src/components/performance/SupervisorSelect.jsx +386 -0
- package/src/components/performance/index.js +3 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect, useRef, Suspense } from "react";
|
|
4
|
+
import { Download, ChevronDown, CalendarClock, CalendarDays } from "lucide-react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { CustomFilterChips } from "../common";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* DataTableFilters Component
|
|
10
|
+
* Displays filter buttons (Week to Date, Select Date Range, Export) and filter chips
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props
|
|
13
|
+
* @param {React.ReactNode} props.dateRangePicker - DateRangePicker component (wrapped in Suspense)
|
|
14
|
+
* @param {Function} props.onWeekToDate - Handler for "Week to Date" button
|
|
15
|
+
* @param {Object} props.exportConfig - Export configuration
|
|
16
|
+
* @param {boolean} props.exportConfig.isExporting - Whether export is in progress
|
|
17
|
+
* @param {Function} props.exportConfig.onExport - Export handler (type) => void
|
|
18
|
+
* @param {Array} props.exportConfig.types - Export types array (default: ['csv'])
|
|
19
|
+
* @param {Object} props.filterChipsConfig - Filter chips configuration
|
|
20
|
+
* @param {Object} props.filterChipsConfig.filters - Current filter values
|
|
21
|
+
* @param {Function} props.filterChipsConfig.onChange - Filter chips change handler
|
|
22
|
+
* @param {Function} props.filterChipsConfig.onClear - Clear all filters handler
|
|
23
|
+
* @param {Array} props.filterChipsConfig.customFilters - Custom filter chips (e.g., date range)
|
|
24
|
+
*/
|
|
25
|
+
export default function DataTableFilters2({
|
|
26
|
+
dateRangePicker,
|
|
27
|
+
onWeekToDate,
|
|
28
|
+
exportConfig,
|
|
29
|
+
filterChipsConfig,
|
|
30
|
+
trailingActions, // Optional extra actions rendered after Export (e.g., Add Users button)
|
|
31
|
+
}) {
|
|
32
|
+
const [showExportMenu, setShowExportMenu] = useState(false);
|
|
33
|
+
const exportButtonRef = useRef(null);
|
|
34
|
+
const exportMenuRef = useRef(null);
|
|
35
|
+
|
|
36
|
+
// Handle click outside to close export menu
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const handleClickOutside = (event) => {
|
|
39
|
+
if (
|
|
40
|
+
exportMenuRef.current &&
|
|
41
|
+
!exportMenuRef.current.contains(event.target) &&
|
|
42
|
+
exportButtonRef.current &&
|
|
43
|
+
!exportButtonRef.current.contains(event.target)
|
|
44
|
+
) {
|
|
45
|
+
setShowExportMenu(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (showExportMenu) {
|
|
50
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
51
|
+
return () => {
|
|
52
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}, [showExportMenu]);
|
|
56
|
+
|
|
57
|
+
const openExportMenu = () => {
|
|
58
|
+
setShowExportMenu((prev) => !prev);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleExport = (type) => {
|
|
62
|
+
setShowExportMenu(false);
|
|
63
|
+
if (exportConfig?.onExport) {
|
|
64
|
+
exportConfig.onExport(type);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Check if there are any filter chips to display
|
|
69
|
+
const hasFilterChips = () => {
|
|
70
|
+
if (!filterChipsConfig?.filters) return false;
|
|
71
|
+
|
|
72
|
+
const filters = filterChipsConfig.filters;
|
|
73
|
+
const customFilters = filterChipsConfig.customFilters || [];
|
|
74
|
+
|
|
75
|
+
// Check if any regular filters have values
|
|
76
|
+
const hasRegularFilters = Object.entries(filters).some(([key, value]) => {
|
|
77
|
+
if (Array.isArray(value) && value.length) return true;
|
|
78
|
+
if (typeof value === "string" && value.trim() !== "") return true;
|
|
79
|
+
if (value && typeof value === "object" && (value.min != null || value.max != null)) return true;
|
|
80
|
+
return false;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Check if any custom filters are active
|
|
84
|
+
const hasCustomFilters = customFilters.some(filterObj => filterObj.active);
|
|
85
|
+
|
|
86
|
+
return hasRegularFilters || hasCustomFilters;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const shouldShowChips = hasFilterChips();
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div className="flex items-center gap-3 flex-wrap">
|
|
93
|
+
{/* Week to Date Button */}
|
|
94
|
+
{onWeekToDate && (
|
|
95
|
+
<button
|
|
96
|
+
onClick={onWeekToDate}
|
|
97
|
+
className="inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900"
|
|
98
|
+
style={{ fontFamily: 'var(--font-sans)' }}
|
|
99
|
+
>
|
|
100
|
+
<CalendarClock size={16} />
|
|
101
|
+
<span>Week to Date</span>
|
|
102
|
+
</button>
|
|
103
|
+
)}
|
|
104
|
+
|
|
105
|
+
{/* Select Date Range */}
|
|
106
|
+
{dateRangePicker && (
|
|
107
|
+
<Suspense
|
|
108
|
+
fallback={
|
|
109
|
+
<div className="inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 text-sm font-medium text-gray-400">
|
|
110
|
+
<CalendarClock size={16} />
|
|
111
|
+
<span>Loading...</span>
|
|
112
|
+
</div>
|
|
113
|
+
}
|
|
114
|
+
>
|
|
115
|
+
{dateRangePicker}
|
|
116
|
+
</Suspense>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{/* Export Button */}
|
|
120
|
+
{exportConfig && (
|
|
121
|
+
<div className="relative">
|
|
122
|
+
<button
|
|
123
|
+
ref={exportButtonRef}
|
|
124
|
+
onClick={openExportMenu}
|
|
125
|
+
disabled={exportConfig.isExporting}
|
|
126
|
+
className="inline-flex items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed min-w-[120px]"
|
|
127
|
+
style={{ fontFamily: 'var(--font-sans)' }}
|
|
128
|
+
>
|
|
129
|
+
<div className="flex items-center gap-2">
|
|
130
|
+
<Download size={16} />
|
|
131
|
+
<span>{exportConfig.isExporting ? "Exporting..." : "Export"}</span>
|
|
132
|
+
</div>
|
|
133
|
+
<ChevronDown size={16} />
|
|
134
|
+
</button>
|
|
135
|
+
{showExportMenu && (
|
|
136
|
+
<div
|
|
137
|
+
ref={exportMenuRef}
|
|
138
|
+
className="absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[120px]"
|
|
139
|
+
>
|
|
140
|
+
{(exportConfig.types || ["csv"]).map((type) => (
|
|
141
|
+
<button
|
|
142
|
+
key={type}
|
|
143
|
+
onClick={() => handleExport(type)}
|
|
144
|
+
className="w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors"
|
|
145
|
+
style={{ fontFamily: 'var(--font-sans)' }}
|
|
146
|
+
>
|
|
147
|
+
Export {type.toUpperCase()}
|
|
148
|
+
</button>
|
|
149
|
+
))}
|
|
150
|
+
</div>
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
{/* Filter chips + optional trailing actions (e.g., Add Users / Add Agent) */}
|
|
156
|
+
{(shouldShowChips || trailingActions) && (
|
|
157
|
+
<>
|
|
158
|
+
{/* Vertical line only when there are actual chips; this avoids double lines
|
|
159
|
+
when we only show trailingActions (like Add Agent) with no chips. */}
|
|
160
|
+
{shouldShowChips && (
|
|
161
|
+
<div className="h-9 mt-1 w-px bg-gray-300 flex-shrink-0"></div>
|
|
162
|
+
)}
|
|
163
|
+
|
|
164
|
+
{/* Filter Chips + trailing actions */}
|
|
165
|
+
<div className="flex items-center gap-3 justify-end">
|
|
166
|
+
{shouldShowChips && filterChipsConfig && (
|
|
167
|
+
<CustomFilterChips
|
|
168
|
+
filters={filterChipsConfig.filters}
|
|
169
|
+
onChange={filterChipsConfig.onChange}
|
|
170
|
+
onClear={filterChipsConfig.onClear}
|
|
171
|
+
customFilters={filterChipsConfig.customFilters || []}
|
|
172
|
+
fieldOptions={filterChipsConfig.fieldOptions || {}}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
{trailingActions && (
|
|
176
|
+
<div className="flex-shrink-0">
|
|
177
|
+
{trailingActions}
|
|
178
|
+
</div>
|
|
179
|
+
)}
|
|
180
|
+
</div>
|
|
181
|
+
</>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as DataTable } from './DataTable';
|
|
2
|
+
export { default as DataTable2 } from './DataTable2';
|
|
2
3
|
export { default as DataTableFilters } from './DataTableFilters';
|
|
4
|
+
export { default as DataTableFilters2 } from './DataTableFilters2';
|
|
3
5
|
export { default as SummaryStatsPanel } from './SummaryStatsPanel';
|
package/src/components/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export {
|
|
|
23
23
|
} from './primitives';
|
|
24
24
|
|
|
25
25
|
// Data display
|
|
26
|
-
export { DataTable, DataTableFilters, SummaryStatsPanel } from './data';
|
|
26
|
+
export { DataTable, DataTable2, DataTableFilters, DataTableFilters2, SummaryStatsPanel } from './data';
|
|
27
27
|
|
|
28
28
|
// Compass evaluation
|
|
29
29
|
export { AskCompass, SignalCard, ObservationCard, SmallObservationCard, ScoreDriverCard, ScoreDriverCardVariant, ConditionCard, ModelScoreCard, SummarySection, AutoSearch, SideDrawer, DrawerButton, DrawerLabel, DrawerInput, FileUploadingState, FileUploadSuccessState, TourGuideTooltip, Toast, ToastContainer } from './common';
|
|
@@ -46,7 +46,7 @@ export { FirstCallScreen, OnboardingChecklist, DemoProjectBanner, IntegrationCar
|
|
|
46
46
|
export { NotificationPanel, NotificationItem } from './notifications';
|
|
47
47
|
|
|
48
48
|
// Performance
|
|
49
|
-
export { PerformancePanel } from './performance';
|
|
49
|
+
export { PerformancePanel, PerformanceDetailsPage, SupervisorSelect } from './performance';
|
|
50
50
|
|
|
51
51
|
export { OverlayPanel } from './models';
|
|
52
52
|
|