@buerokratt-ria/common-gui-components 0.0.52 → 0.0.54

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/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All changes to this project will be documented in this file.
4
4
 
5
5
  ## Template [MajorVersion.MediterraneanVersion.MinorVersion] - DD-MM-YYYY
6
6
 
7
+ ## [0.0.54] - 07.05.2026
8
+
9
+ - Remove authenticated person fields for filtering
10
+
11
+ ## [0.0.53] - 06.05.2026
12
+
13
+ - Removed the Chosen CSA filter from chat history.
14
+ - Added Clear filters action for chat history filters.
15
+ - Added Choose all / Vali kõik option to the chosen columns filter.
16
+ - Persisted selected chat history columns in user preferences.
17
+
7
18
  ## [0.0.52] - 05.05.2026
8
19
 
9
20
  - Updated loading logic
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/common-gui-components",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "description": "Common GUI components and pre defined templates.",
5
5
  "main": "index.ts",
6
6
  "author": "ExiRai",
@@ -3,10 +3,6 @@
3
3
  @import 'src/styles/settings/variables/other';
4
4
  @import 'src/styles/settings/variables/typography';
5
5
 
6
- .input-wrapper {
7
- width: 40%;
8
- }
9
-
10
6
  .header-container {
11
7
  align-items: center;
12
8
  display: flex;
@@ -1,16 +1,17 @@
1
- import React, {FC, PropsWithChildren, useEffect, useMemo, useRef, useState} from 'react';
1
+ import {FC, PropsWithChildren, useEffect, useMemo, useRef, useState} from 'react';
2
2
  import {useTranslation} from 'react-i18next';
3
3
  import {useMutation} from '@tanstack/react-query';
4
4
  import {ColumnPinningState, createColumnHelper, PaginationState, SortingState,} from '@tanstack/react-table';
5
5
  import {endOfDay, format, formatISO, startOfDay} from "date-fns";
6
6
  import {AxiosError} from 'axios';
7
7
  import './History.scss';
8
- import {MdOutlineRemoveRedEye} from 'react-icons/md';
8
+ import {MdOutlineRemoveRedEye } from 'react-icons/md';
9
9
  import {CgSpinner} from 'react-icons/cg';
10
10
 
11
11
  import {
12
12
  Button,
13
13
  Card,
14
+ ClearFiltersButton,
14
15
  DataTable,
15
16
  Dialog,
16
17
  Drawer,
@@ -61,6 +62,8 @@ type ExportResult = {
61
62
  chatIds: string[];
62
63
  };
63
64
 
65
+ const ALL_COLUMNS_VALUE = '__all__';
66
+
64
67
  const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
65
68
  user,
66
69
  userDomains,
@@ -86,8 +89,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
86
89
  const passedStartDate = delegatedStartDate ?? params.get("start");
87
90
  const passedEndDate = delegatedEndDate ?? params.get("end");
88
91
  const skipNextSelectedColumnsEffect = useRef(false);
89
- const passedCustomerSupportIds = params.getAll('customerSupportIds');
90
- const [search, setSearch] = useState('');
91
92
  const [selectedChat, setSelectedChat] = useState<ChatType | null>(null);
92
93
  const [searchParams, setSearchParams] = useSearchParams();
93
94
  const [statusChangeModal, setStatusChangeModal] = useState<string | null>(
@@ -114,7 +115,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
114
115
 
115
116
  const [messagesTrigger, setMessagesTrigger] = useState(false);
116
117
  const [selectedColumns, setSelectedColumns] = useState<string[]>([]);
117
- const [customerSupportAgents, setCustomerSupportAgents] = useState<any[]>([]);
118
118
  const [counterKey, setCounterKey] = useState<number>(0)
119
119
 
120
120
  const useStore = userDomains;
@@ -137,13 +137,16 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
137
137
  const { control, setValue, watch } = useForm<{
138
138
  startDate: Date | string;
139
139
  endDate: Date | string;
140
+ search: string;
140
141
  }>({
141
142
  defaultValues: {
142
143
  startDate: passedStartDate ? parseDateParam(passedStartDate) : startOfDay(new Date()),
143
144
  endDate: passedEndDate ? parseDateParam(passedEndDate) : endOfDay(new Date()),
145
+ search: '',
144
146
  },
145
147
  });
146
148
 
149
+ const search = watch('search');
147
150
  const startDate = watch('startDate');
148
151
  const endDate = watch('endDate');
149
152
 
@@ -151,7 +154,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
151
154
  getAllEndedChats.mutate({
152
155
  startDate: formatISO(startOfDay(new Date(startDate))),
153
156
  endDate: formatISO(endOfDay(new Date(endDate))),
154
- customerSupportIds: passedCustomerSupportIds,
155
157
  pagination,
156
158
  sorting,
157
159
  search,
@@ -198,7 +200,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
198
200
  getAllEndedChats.mutate({
199
201
  startDate: hasStart ? unifyDateFromat(delegatedStartDate) : formatISO(startOfDay(new Date(startDate))),
200
202
  endDate: hasEnd ? unifyDateFromat(delegatedEndDate) : formatISO(endOfDay(new Date(endDate))),
201
- customerSupportIds: passedCustomerSupportIds,
202
203
  pagination,
203
204
  sorting,
204
205
  search,
@@ -229,13 +230,12 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
229
230
  }
230
231
 
231
232
  skipNextSelectedColumnsEffect.current = true;
232
- setSelectedColumns(newSelectedColumns);
233
+ setSelectedColumns(getUiSelectedColumns(newSelectedColumns));
233
234
  setCounterKey(prev => prev + 1);
234
235
 
235
236
  getAllEndedChats.mutate({
236
237
  startDate: formatISO(startOfDay(new Date(startDate))),
237
238
  endDate: formatISO(endOfDay(new Date(endDate))),
238
- customerSupportIds: passedCustomerSupportIds,
239
239
  pagination: updatedPagination,
240
240
  sorting,
241
241
  search,
@@ -264,7 +264,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
264
264
  getAllEndedChats.mutate({
265
265
  startDate: formatISO(startOfDay(new Date(startDate))),
266
266
  endDate: formatISO(endOfDay(new Date(endDate))),
267
- customerSupportIds: passedCustomerSupportIds,
268
267
  pagination,
269
268
  sorting,
270
269
  search,
@@ -272,10 +271,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
272
271
  }
273
272
  }, [selectedColumns, currentDomains]);
274
273
 
275
- useEffect(() => {
276
- listCustomerSupportAgents.mutate();
277
- }, []);
278
-
279
274
  const updatePagePreferences = useMutation({
280
275
  mutationFn: (data: {
281
276
  page_results: number;
@@ -294,7 +289,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
294
289
  mutationFn: (data: {
295
290
  startDate: string;
296
291
  endDate: string;
297
- customerSupportIds: string[];
298
292
  pagination: PaginationState;
299
293
  sorting: SortingState;
300
294
  search: string;
@@ -309,7 +303,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
309
303
  }
310
304
 
311
305
  return apiDevEnded.post('agents/chats/ended', {
312
- customerSupportIds: data.customerSupportIds,
313
306
  startDate: formatISO(startOfDay(new Date(data.startDate))),
314
307
  endDate: formatISO(endOfDay(new Date(data.endDate))),
315
308
  urls: getDomainsArray(currentDomains),
@@ -373,34 +366,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
373
366
  },
374
367
  });
375
368
 
376
- const listCustomerSupportAgents = useMutation({
377
- mutationFn: () =>
378
- apiDev.post('accounts/customer-support-agents', {
379
- page: 0,
380
- page_size: 99999,
381
- sorting: 'name asc',
382
- show_active_only: false,
383
- roles: ['ROLE_CUSTOMER_SUPPORT_AGENT'],
384
- }),
385
- onSuccess: (res: any) => {
386
- setCustomerSupportAgents([
387
- {label: 'Bürokratt', value: 'chatbot'},
388
- ...res.data.response.map((item) => ({
389
- label: [item.firstName, item.lastName].join(' ').trim(),
390
- value: item.idCode,
391
- })),
392
- ]);
393
- },
394
- });
395
-
396
- const visibleColumnOptions = useMemo(() => {
369
+ const realColumnOptions: {readonly label: string; readonly value: string}[] = useMemo(() => {
397
370
  const columns = [
398
371
  {label: t('chat.history.startTime'), value: 'created'},
399
372
  {label: t('chat.history.endTime'), value: 'ended'},
400
373
  {label: t('chat.history.csaName'), value: 'customerSupportFullName'},
401
- {label: t('global.name'), value: 'endUserName'},
402
- {label: t('global.idCode'), value: 'endUserId'},
403
- {label: t('chat.history.contact'), value: 'contactsMessage'},
404
374
  {label: t('chat.history.comment'), value: 'comment'},
405
375
  {label: t('chat.history.rating'), value: 'feedbackRating'},
406
376
  {label: t('chat.history.feedback'), value: 'feedbackText'},
@@ -422,6 +392,49 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
422
392
  return columns;
423
393
  }, [t, showEmail, testMessageEnabled])
424
394
 
395
+ const visibleColumnOptions = useMemo(() => [
396
+ {label: t('chat.history.chooseAll'), value: ALL_COLUMNS_VALUE},
397
+ ...realColumnOptions,
398
+ ], [t, realColumnOptions]);
399
+
400
+ const getRealSelectedColumns = (columns: string[]) =>
401
+ columns.filter((column) => column !== ALL_COLUMNS_VALUE);
402
+
403
+ const getAllColumnValues = () => realColumnOptions.map((option) => option.value);
404
+
405
+ const areAllColumnsSelected = (columns: string[]) => {
406
+ const realSelectedColumns = getRealSelectedColumns(columns);
407
+ const allColumnValues = getAllColumnValues();
408
+
409
+ return allColumnValues.length > 0 &&
410
+ allColumnValues.every((column) => realSelectedColumns.includes(column));
411
+ };
412
+
413
+ const getUiSelectedColumns = (columns: string[]) => {
414
+ const realSelectedColumns = getRealSelectedColumns(columns);
415
+
416
+ if (areAllColumnsSelected(realSelectedColumns)) {
417
+ return [ALL_COLUMNS_VALUE, ...getAllColumnValues()];
418
+ }
419
+
420
+ return realSelectedColumns;
421
+ };
422
+
423
+ const normalizeSelectedColumns = (selection: string[]) => {
424
+ const currentAllSelected = selectedColumns.includes(ALL_COLUMNS_VALUE) || areAllColumnsSelected(selectedColumns);
425
+ const nextAllSelected = selection.includes(ALL_COLUMNS_VALUE);
426
+
427
+ if (nextAllSelected && !currentAllSelected) {
428
+ return [ALL_COLUMNS_VALUE, ...getAllColumnValues()];
429
+ }
430
+
431
+ if (!nextAllSelected && currentAllSelected) {
432
+ return [];
433
+ }
434
+
435
+ return getUiSelectedColumns(selection);
436
+ };
437
+
425
438
  const chatStatusChangeMutation = useMutation({
426
439
  mutationFn: async (data: { chatId: string | number; event: string }) => {
427
440
  const changeableTo = [
@@ -456,7 +469,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
456
469
  getAllEndedChats.mutate({
457
470
  startDate: formatISO(startOfDay(new Date(startDate))),
458
471
  endDate: formatISO(endOfDay(new Date(endDate))),
459
- customerSupportIds: passedCustomerSupportIds,
460
472
  pagination,
461
473
  sorting,
462
474
  search,
@@ -924,9 +936,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
924
936
  };
925
937
 
926
938
  const getFilteredColumns = () => {
927
- if (selectedColumns.length === 0) return endedChatsColumns;
939
+ const realSelectedColumns = getRealSelectedColumns(selectedColumns);
940
+
941
+ if (realSelectedColumns.length === 0) return endedChatsColumns;
928
942
  return endedChatsColumns.filter((c) =>
929
- ['detail', 'forward', ...selectedColumns].includes(c.id ?? '')
943
+ ['detail', 'forward', ...realSelectedColumns].includes(c.id ?? '')
930
944
  );
931
945
  };
932
946
 
@@ -953,10 +967,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
953
967
  selectedColumns: string[],
954
968
  t: (key: string) => string
955
969
  ): ExportResult => {
970
+ const realSelectedColumns = getRealSelectedColumns(selectedColumns);
956
971
  const activeColumns =
957
- selectedColumns.length > 0
972
+ realSelectedColumns.length > 0
958
973
  ? allColumns.filter(
959
- (col) => col.id && col.id !== 'detail' && selectedColumns.includes(col.id)
974
+ (col) => col.id && col.id !== 'detail' && realSelectedColumns.includes(col.id)
960
975
  )
961
976
  : allColumns.filter((col) => col.id && col.id !== 'detail');
962
977
 
@@ -1026,9 +1041,10 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1026
1041
  sortBy = `${sorting[0].id} ${sortType}`;
1027
1042
  }
1028
1043
 
1029
- const { headers } = mapChatsToExportRows([], endedChatsColumns, selectedColumns, t);
1030
- const activeColumns = selectedColumns.length > 0
1031
- ? endedChatsColumns.filter((col) => col.id && col.id !== 'detail' && selectedColumns.includes(col.id))
1044
+ const realSelectedColumns = getRealSelectedColumns(selectedColumns);
1045
+ const { headers } = mapChatsToExportRows([], endedChatsColumns, realSelectedColumns, t);
1046
+ const activeColumns = realSelectedColumns.length > 0
1047
+ ? endedChatsColumns.filter((col) => col.id && col.id !== 'detail' && realSelectedColumns.includes(col.id))
1032
1048
  : endedChatsColumns.filter((col) => col.id && col.id !== 'detail');
1033
1049
  const columnIds = activeColumns.map((col) => col.id!);
1034
1050
 
@@ -1041,7 +1057,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1041
1057
  urls: getDomainsArray(currentDomains),
1042
1058
  sorting: sortBy,
1043
1059
  search,
1044
- customerSupportIds: passedCustomerSupportIds,
1045
1060
  });
1046
1061
 
1047
1062
  const downloadData = response.data.data ?? response.data;
@@ -1060,6 +1075,21 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1060
1075
 
1061
1076
  const endUserFullName = getUserName();
1062
1077
 
1078
+ const isClearFiltersVisible = useMemo(()=> {
1079
+ return search.length > 0 || selectedColumns.length > 0;
1080
+ }, [search, selectedColumns]);
1081
+
1082
+ const onClearFilersClick = () => {
1083
+ const clearedColumns: string[] = [];
1084
+ setSelectedColumns(clearedColumns);
1085
+ setCounterKey(0);
1086
+ setValue('search', '');
1087
+ updatePagePreferences.mutate({
1088
+ page_results: pagination.pageSize,
1089
+ selected_columns: clearedColumns
1090
+ });
1091
+ };
1092
+
1063
1093
  if (!filteredEndedChatsList) return <>Loading... {{filteredEndedChatsList}} something is wrong </>;
1064
1094
 
1065
1095
  return (
@@ -1086,27 +1116,29 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1086
1116
  </div>
1087
1117
 
1088
1118
  <div className={`history-content${getAllEndedChats.isPending ? ' history-content--loading' : ''}`}>
1089
- <Card>
1119
+ <Card style={{marginBottom: '16px'}}>
1090
1120
  <Track gap={16}>
1091
1121
  {displaySearchBar && (
1092
- <FormInput
1093
- className="input-wrapper"
1094
- label={t('chat.history.searchChats')}
1095
- hideLabel
1096
- name="searchChats"
1097
- placeholder={t('chat.history.searchChats') + '...'}
1098
- onChange={(e) => {
1099
- setPagination({ pageIndex: 0, pageSize: pagination.pageSize });
1100
- setSearchParams((params) => {
1101
- params.set("page", "1");
1102
- return params;
1103
- });
1104
- setSearch(e.target.value);
1105
- debouncedGetAllEnded(e.target.value);
1106
- }}
1107
- />)}
1108
-
1109
- <Track style={{width: '100%'}} gap={16}>
1122
+ <Controller name="search" control={control} render={({ field }) => {
1123
+ return <FormInput
1124
+ label={t('chat.history.searchChats')}
1125
+ hideLabel
1126
+ name="searchChats"
1127
+ value={field.value}
1128
+ placeholder={t('chat.history.searchChats') + '...'}
1129
+ onChange={(e) => {
1130
+ setPagination({ pageIndex: 0, pageSize: pagination.pageSize });
1131
+ setSearchParams((params) => {
1132
+ params.set("page", "1");
1133
+ return params;
1134
+ });
1135
+ field.onChange(e.target.value);
1136
+ debouncedGetAllEnded(e.target.value);
1137
+ }}
1138
+ />
1139
+ }} />
1140
+ )}
1141
+ <Track gap={16}>
1110
1142
  {displayDateFilter && (
1111
1143
  <>
1112
1144
  <Track gap={10}>
@@ -1133,7 +1165,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1133
1165
  getAllEndedChats.mutate({
1134
1166
  startDate: start,
1135
1167
  endDate: formatISO(endOfDay(new Date(endDate))),
1136
- customerSupportIds: passedCustomerSupportIds,
1137
1168
  pagination: resetPagination,
1138
1169
  sorting,
1139
1170
  search,
@@ -1168,7 +1199,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1168
1199
  getAllEndedChats.mutate({
1169
1200
  startDate: formatISO(startOfDay(new Date(startDate))),
1170
1201
  endDate: end,
1171
- customerSupportIds: passedCustomerSupportIds,
1172
1202
  pagination: resetPagination,
1173
1203
  sorting,
1174
1204
  search,
@@ -1181,6 +1211,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1181
1211
  </Track>
1182
1212
  </>
1183
1213
  )}
1214
+ <Track style={{width: '240px'}}>
1184
1215
  <FormMultiselect
1185
1216
  key={counterKey}
1186
1217
  name="visibleColumns"
@@ -1190,54 +1221,18 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1190
1221
  selectedOptions={visibleColumnOptions.filter((o) =>
1191
1222
  selectedColumns.includes(o.value)
1192
1223
  )}
1224
+ selectedOptionsCount={getRealSelectedColumns(selectedColumns).length}
1193
1225
  onSelectionChange={(selection) => {
1194
- const columns = selection?.map((s) => s.value) ?? [];
1226
+ const columns = normalizeSelectedColumns(selection?.map((s) => s.value) ?? []);
1195
1227
  setSelectedColumns(columns);
1228
+ setCounterKey(prev => prev + 1);
1196
1229
  updatePagePreferences.mutate({
1197
1230
  page_results: pagination.pageSize,
1198
- selected_columns: columns
1231
+ selected_columns: getRealSelectedColumns(columns)
1199
1232
  })
1200
1233
  }}
1201
- />
1202
- <FormMultiselect
1203
- name="agent"
1204
- label={t('')}
1205
- placeholder={t('chat.history.chosenCsa')}
1206
- options={customerSupportAgents}
1207
- selectedOptions={customerSupportAgents.filter((item) =>
1208
- passedCustomerSupportIds.includes(item.value)
1209
- )}
1210
- onSelectionChange={(selection) => {
1211
- setSearchParams((params) => {
1212
- params.delete('customerSupportIds');
1213
- params.set('page', '1');
1214
- selection?.forEach((s) => {
1215
- params.append("customerSupportIds", s.value);
1216
- if (s.value === "chatbot") params.append("customerSupportIds", "-");
1217
- return params;
1218
- });
1219
- return params;
1220
- });
1221
-
1222
- setPagination({pageIndex: 0, pageSize: pagination.pageSize});
1223
-
1224
- const customerSupportIds =
1225
- selection?.reduce((acc, s) => {
1226
- acc.push(s.value);
1227
- if (s.value === "chatbot") acc.push("-");
1228
- return acc;
1229
- }, []) || [];
1230
-
1231
- getAllEndedChats.mutate({
1232
- startDate,
1233
- endDate,
1234
- customerSupportIds: customerSupportIds,
1235
- pagination: {pageIndex: 0, pageSize: pagination.pageSize},
1236
- sorting,
1237
- search,
1238
- });
1239
- }}
1240
- />
1234
+ />
1235
+ </Track>
1241
1236
  </Track>
1242
1237
  </Track>
1243
1238
  </Card>
@@ -1249,6 +1244,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1249
1244
  </Button>
1250
1245
  </div>)
1251
1246
  }
1247
+ {isClearFiltersVisible && (
1248
+ <Track justify="between" style={{ marginBottom: '16px' }}>
1249
+ <ClearFiltersButton style={{ marginLeft: 'auto' }} onClick={onClearFilersClick} />
1250
+ </Track>
1251
+ )}
1252
1252
  <div className="card-drawer-container" style={{height: '100%', overflow: 'auto'}}>
1253
1253
  <div className="card-wrapper">
1254
1254
  <Card>
@@ -1269,12 +1269,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1269
1269
  setPagination(state);
1270
1270
  updatePagePreferences.mutate({
1271
1271
  page_results: state.pageSize,
1272
- selected_columns: selectedColumns
1272
+ selected_columns: getRealSelectedColumns(selectedColumns)
1273
1273
  });
1274
1274
  getAllEndedChats.mutate({
1275
1275
  startDate: formatISO(startOfDay(new Date(startDate))),
1276
1276
  endDate: formatISO(endOfDay(new Date(endDate))),
1277
- customerSupportIds: passedCustomerSupportIds,
1278
1277
  pagination: state,
1279
1278
  sorting,
1280
1279
  search,
@@ -1285,7 +1284,6 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
1285
1284
  getAllEndedChats.mutate({
1286
1285
  startDate: formatISO(startOfDay(new Date(startDate))),
1287
1286
  endDate: formatISO(endOfDay(new Date(endDate))),
1288
- customerSupportIds: passedCustomerSupportIds,
1289
1287
  pagination,
1290
1288
  sorting: state,
1291
1289
  search,
@@ -45,7 +45,8 @@
45
45
  "today": "Today",
46
46
  "forward": "Forward",
47
47
  "chosen": "Chosen",
48
- "read": "Read"
48
+ "read": "Read",
49
+ "clearFilters": "Clear filters"
49
50
  },
50
51
  "sorting": {
51
52
  "des": "descending",
@@ -175,7 +176,8 @@
175
176
  "statusAdder": "Status adder",
176
177
  "statusAddedDate": "Status added date",
177
178
  "chosenCsa": "Chosen csa(s)",
178
- "chosenColumn": "Chosen column(s)"
179
+ "chosenColumn": "Chosen column(s)",
180
+ "chooseAll": "Choose all"
179
181
  },
180
182
  "plainEvents": {
181
183
  "answered": "Answered",
@@ -45,7 +45,8 @@
45
45
  "today": "Täna",
46
46
  "forward": "Suuna",
47
47
  "chosen": "Valitud",
48
- "read": "Loetud"
48
+ "read": "Loetud",
49
+ "clearFilters": "Tühjenda filtrid"
49
50
  },
50
51
  "sorting": {
51
52
  "des": "kahanevalt",
@@ -175,7 +176,8 @@
175
176
  "statusAdder": "Staatuse lisaja",
176
177
  "statusAddedDate": "Staatuse lisamise kuupäev",
177
178
  "chosenCsa": "Valitud nõustaja(d)",
178
- "chosenColumn": "Valitud tulba(d)"
179
+ "chosenColumn": "Valitud tulba(d)",
180
+ "chooseAll": "Vali kõik"
179
181
  },
180
182
  "plainEvents": {
181
183
  "answered": "Vastatud",
@@ -10,6 +10,7 @@ type CardProps = {
10
10
  isHeaderLight?: boolean;
11
11
  isBodyDivided?: boolean;
12
12
  isScrollable?: boolean;
13
+ style?: React.CSSProperties;
13
14
  };
14
15
 
15
16
  const Card: FC<PropsWithChildren<CardProps>> = ({
@@ -19,10 +20,11 @@ const Card: FC<PropsWithChildren<CardProps>> = ({
19
20
  isHeaderLight,
20
21
  isBodyDivided,
21
22
  isScrollable = false,
23
+ style,
22
24
  children,
23
25
  }) => {
24
26
  return (
25
- <div className={clsx('card', { 'card--borderless': borderless, 'card--scrollable': isScrollable })}>
27
+ <div className={clsx('card', { 'card--borderless': borderless, 'card--scrollable': isScrollable })} style={style}>
26
28
  {header && (
27
29
  <div className={`card__header ${isHeaderLight ? 'white' : ''}`}>
28
30
  {header}
@@ -0,0 +1,24 @@
1
+ import { Button } from "@buerokratt-ria/header/src/components";
2
+ import { ComponentProps, FC } from "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { MdFilterListOff } from "react-icons/md";
5
+
6
+ type ClearFiltersButtonProps = {
7
+ readonly onClick: () => void;
8
+ readonly style?: Pick<ComponentProps<typeof Button>, 'style'>['style'];
9
+ }
10
+
11
+ const ClearFiltersButton: FC<ClearFiltersButtonProps> = ({ onClick, style }) => {
12
+ const { t } = useTranslation();
13
+
14
+ return <Button
15
+ appearance="primary"
16
+ size="s"
17
+ style={style}
18
+ onClick={onClick}>
19
+ {t('global.clearFilters')}
20
+ <MdFilterListOff style={{ height: '24px', width: '24px' }} />
21
+ </Button>
22
+ };
23
+
24
+ export default ClearFiltersButton;
@@ -16,6 +16,7 @@ type FormMultiselectProps = SelectHTMLAttributes<HTMLSelectElement> & {
16
16
  hideLabel?: boolean;
17
17
  options: SelectOption[];
18
18
  selectedOptions?: SelectOption[];
19
+ selectedOptionsCount?: number;
19
20
  onSelectionChange?: (selection: SelectOption[] | null) => void;
20
21
  };
21
22
 
@@ -28,6 +29,7 @@ const FormMultiselect: FC<FormMultiselectProps> = (
28
29
  placeholder,
29
30
  defaultValue,
30
31
  selectedOptions,
32
+ selectedOptionsCount,
31
33
  onSelectionChange,
32
34
  ...rest
33
35
  },
@@ -84,13 +86,14 @@ const FormMultiselect: FC<FormMultiselectProps> = (
84
86
  );
85
87
 
86
88
  const placeholderValue = placeholder || t('global.choose');
89
+ const displaySelectedCount = selectedOptionsCount ?? selectedItems.length;
87
90
 
88
91
  return (
89
92
  <div className={selectClasses} style={rest.style}>
90
93
  {label && !hideLabel && <label htmlFor={id} className='select__label' {...getLabelProps()}>{label}</label>}
91
94
  <div className='select__wrapper'>
92
95
  <div className='select__trigger' {...getToggleButtonProps()}>
93
- {selectedItems.length > 0 ? `${placeholder ?? t('global.chosen')} (${selectedItems.length})` : placeholderValue}
96
+ {selectedItems.length > 0 ? `${placeholder ?? t('global.chosen')} (${displaySelectedCount})` : placeholderValue}
94
97
  <Icon label='Dropdown icon' size='medium' icon={<MdArrowDropDown color='#5D6071' />} />
95
98
  </div>
96
99
 
@@ -24,6 +24,7 @@ import Drawer from './Drawer';
24
24
  import HistoricalChat from './HistoricalChat';
25
25
  import Dialog from './Dialog';
26
26
  import Label from './Label';
27
+ import ClearFiltersButton from './ClearFiltersButton';
27
28
 
28
29
  export {
29
30
  Button,
@@ -49,5 +50,6 @@ export {
49
50
  HistoricalChat,
50
51
  Dialog,
51
52
  Toast,
52
- Label
53
+ Label,
54
+ ClearFiltersButton,
53
55
  };