@okta/odyssey-react-mui 1.6.19 → 1.6.21

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 (80) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Button.js +2 -2
  3. package/dist/Button.js.map +1 -1
  4. package/dist/CssBaseline.js +3 -1
  5. package/dist/CssBaseline.js.map +1 -1
  6. package/dist/MenuButton.js +16 -2
  7. package/dist/MenuButton.js.map +1 -1
  8. package/dist/MenuContext.js +2 -1
  9. package/dist/MenuContext.js.map +1 -1
  10. package/dist/MenuItem.js +6 -3
  11. package/dist/MenuItem.js.map +1 -1
  12. package/dist/SearchField.js.map +1 -1
  13. package/dist/icons.generated/ArrowBottom.js +33 -0
  14. package/dist/icons.generated/ArrowBottom.js.map +1 -0
  15. package/dist/icons.generated/ArrowTop.js +33 -0
  16. package/dist/icons.generated/ArrowTop.js.map +1 -0
  17. package/dist/icons.generated/index.js +2 -0
  18. package/dist/icons.generated/index.js.map +1 -1
  19. package/dist/labs/DataFilters.js +366 -0
  20. package/dist/labs/DataFilters.js.map +1 -0
  21. package/dist/labs/DataTable.js +366 -0
  22. package/dist/labs/DataTable.js.map +1 -0
  23. package/dist/labs/DataTablePagination.js +74 -0
  24. package/dist/labs/DataTablePagination.js.map +1 -0
  25. package/dist/labs/PaginatedTable.js +9 -6
  26. package/dist/labs/PaginatedTable.js.map +1 -1
  27. package/dist/labs/StaticTable.js +8 -5
  28. package/dist/labs/StaticTable.js.map +1 -1
  29. package/dist/labs/index.js +4 -1
  30. package/dist/labs/index.js.map +1 -1
  31. package/dist/labs/materialReactTableTypes.js.map +1 -1
  32. package/dist/src/CssBaseline.d.ts +2 -1
  33. package/dist/src/CssBaseline.d.ts.map +1 -1
  34. package/dist/src/MenuButton.d.ts +12 -2
  35. package/dist/src/MenuButton.d.ts.map +1 -1
  36. package/dist/src/MenuContext.d.ts +1 -0
  37. package/dist/src/MenuContext.d.ts.map +1 -1
  38. package/dist/src/MenuItem.d.ts.map +1 -1
  39. package/dist/src/SearchField.d.ts +16 -0
  40. package/dist/src/SearchField.d.ts.map +1 -1
  41. package/dist/src/icons.generated/ArrowBottom.d.ts +16 -0
  42. package/dist/src/icons.generated/ArrowBottom.d.ts.map +1 -0
  43. package/dist/src/icons.generated/ArrowTop.d.ts +16 -0
  44. package/dist/src/icons.generated/ArrowTop.d.ts.map +1 -0
  45. package/dist/src/icons.generated/index.d.ts +2 -0
  46. package/dist/src/icons.generated/index.d.ts.map +1 -1
  47. package/dist/src/labs/DataFilters.d.ts +85 -0
  48. package/dist/src/labs/DataFilters.d.ts.map +1 -0
  49. package/dist/src/labs/DataTable.d.ts +193 -0
  50. package/dist/src/labs/DataTable.d.ts.map +1 -0
  51. package/dist/src/labs/DataTablePagination.d.ts +25 -0
  52. package/dist/src/labs/DataTablePagination.d.ts.map +1 -0
  53. package/dist/src/labs/PaginatedTable.d.ts.map +1 -1
  54. package/dist/src/labs/StaticTable.d.ts.map +1 -1
  55. package/dist/src/labs/index.d.ts +4 -2
  56. package/dist/src/labs/index.d.ts.map +1 -1
  57. package/dist/src/labs/materialReactTableTypes.d.ts +1 -1
  58. package/dist/src/labs/materialReactTableTypes.d.ts.map +1 -1
  59. package/dist/src/theme/components.d.ts.map +1 -1
  60. package/dist/theme/components.js +137 -64
  61. package/dist/theme/components.js.map +1 -1
  62. package/dist/tsconfig.production.tsbuildinfo +1 -1
  63. package/package.json +4 -4
  64. package/src/Button.tsx +2 -2
  65. package/src/CssBaseline.tsx +7 -2
  66. package/src/MenuButton.tsx +50 -8
  67. package/src/MenuContext.ts +2 -0
  68. package/src/MenuItem.tsx +5 -3
  69. package/src/SearchField.tsx +8 -0
  70. package/src/icons.generated/ArrowBottom.tsx +43 -0
  71. package/src/icons.generated/ArrowTop.tsx +43 -0
  72. package/src/icons.generated/index.ts +2 -0
  73. package/src/labs/DataFilters.tsx +601 -0
  74. package/src/labs/DataTable.tsx +681 -0
  75. package/src/labs/DataTablePagination.tsx +88 -0
  76. package/src/labs/PaginatedTable.tsx +35 -33
  77. package/src/labs/StaticTable.tsx +26 -29
  78. package/src/labs/index.ts +6 -3
  79. package/src/labs/{materialReactTableTypes.ts → materialReactTableTypes.tsx} +1 -1
  80. package/src/theme/components.tsx +154 -62
@@ -0,0 +1,601 @@
1
+ /*!
2
+ * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
+ *
5
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
+ * Unless required by applicable law or agreed to in writing, software
7
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
+ *
10
+ * See the License for the specific language governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {
14
+ MutableRefObject,
15
+ ReactNode,
16
+ memo,
17
+ useCallback,
18
+ useEffect,
19
+ useMemo,
20
+ useRef,
21
+ useState,
22
+ } from "react";
23
+ import { Autocomplete } from "../Autocomplete";
24
+ import { Box } from "../Box";
25
+ import { TagList } from "../TagList";
26
+ import { Tag } from "../Tag";
27
+ import { SearchField } from "../SearchField";
28
+ import { Button } from "../Button";
29
+ import {
30
+ IconButton as MuiIconButton,
31
+ Menu as MuiMenu,
32
+ Popover as MuiPopover,
33
+ } from "@mui/material";
34
+ import {
35
+ CheckIcon,
36
+ ChevronRightIcon,
37
+ CloseCircleFilledIcon,
38
+ FilterIcon,
39
+ } from "../icons.generated";
40
+ import { MenuItem } from "../MenuItem";
41
+ import { Paragraph, Subordinate } from "../Typography";
42
+ import { TextField } from "../TextField";
43
+ import { CheckboxGroup } from "../CheckboxGroup";
44
+ import { Checkbox } from "../Checkbox";
45
+ import { RadioGroup } from "../RadioGroup";
46
+ import { Radio } from "../Radio";
47
+ import { MRT_ColumnDef, MRT_RowData } from "material-react-table";
48
+
49
+ export type DataFilterValue = string | string[] | undefined;
50
+
51
+ // This is the shape of each individual filter
52
+ export type DataFilter = {
53
+ /**
54
+ * A unique ID for the filter, typically the same id
55
+ * as the column it'll be applied to.
56
+ */
57
+ id: string;
58
+ /**
59
+ * The human-friendly name of the filter.
60
+ */
61
+ label: string;
62
+ /**
63
+ * The type of filter, which determines which filtering control
64
+ * is shown.
65
+ */
66
+ variant?: MRT_ColumnDef<MRT_RowData>["filterVariant"];
67
+ /**
68
+ * The current value of the filter. Typically a string, but
69
+ * filters that allow for multiple selections (such as multi-select)
70
+ * can accept an array.
71
+ */
72
+ value?: DataFilterValue;
73
+ /**
74
+ * If the filter control has preset options (such as a select or multi-select),
75
+ * these are the options provided.
76
+ */
77
+ options?: Array<{ label: string; value: string }>;
78
+ };
79
+
80
+ // This is the type of the DataFilters component itself
81
+ export type DataFiltersProps = {
82
+ /**
83
+ * The callback that's fired when the search input changes
84
+ * (either on change or on submit, based on the value of `hasSearchSubmitButton`).
85
+ * If this is undefined, the search input will not be shown.
86
+ */
87
+ onChangeSearch?: (value: string) => void;
88
+ /**
89
+ * The callback that's fired when filter values change.
90
+ */
91
+ onChangeFilters?: (filters: Array<DataFilter>) => void;
92
+ /**
93
+ * If true, a Search button will be provided alongside the search input
94
+ * and `onChangeSearch` will fire when the button is clicked, rather than
95
+ * whenever the input value changes.
96
+ */
97
+ hasSearchSubmitButton?: boolean;
98
+ /**
99
+ * The debounce time, in milliseconds, for the search input firing
100
+ * `onChangeSearch` when changed. If `hasSearchSubmitButton` is true,
101
+ * this doesn't do anything.
102
+ */
103
+ searchDelayTime?: number;
104
+ /**
105
+ * The starting value of the search input
106
+ */
107
+ defaultSearchTerm?: string;
108
+ /**
109
+ * A slot for optional additional actions, like buttons, to be displayed
110
+ * on the opposite side of the top row from the search and filter controls.
111
+ */
112
+ additionalActions?: ReactNode;
113
+ /**
114
+ * The filters available in the filter menu. If undefined,
115
+ * the filter menu won't be shown.
116
+ */
117
+ filters?: Array<DataFilter>;
118
+ };
119
+
120
+ const DataFilters = ({
121
+ onChangeSearch,
122
+ onChangeFilters,
123
+ hasSearchSubmitButton = false,
124
+ searchDelayTime = 200,
125
+ defaultSearchTerm = "",
126
+ additionalActions,
127
+ filters: filtersProp = [],
128
+ }: DataFiltersProps) => {
129
+ const [filters, setFilters] = useState<DataFilter[]>(filtersProp);
130
+
131
+ const initialInputValues = useMemo(() => {
132
+ return filtersProp.reduce((accumulator, filter) => {
133
+ accumulator[filter.id] = filter.value;
134
+ return accumulator;
135
+ }, {} as Record<string, DataFilterValue>);
136
+ }, [filtersProp]);
137
+
138
+ const [inputValues, setInputValues] = useState(initialInputValues);
139
+
140
+ const [searchValue, setSearchValue] = useState<string>(defaultSearchTerm);
141
+ const activeFilters = useMemo(() => {
142
+ return filters.filter(
143
+ (filter) => typeof filter.value === "string" && filter.value
144
+ );
145
+ }, [filters]);
146
+ const [isFiltersMenuOpen, setIsFiltersMenuOpen] = useState<boolean>(false);
147
+ const [filtersMenuAnchorElement, setFiltersMenuAnchorElement] = useState<
148
+ HTMLElement | undefined
149
+ >();
150
+ const [isFilterPopoverOpen, setIsFilterPopoverOpen] =
151
+ useState<boolean>(false);
152
+ const [filterPopoverAnchorElement, setFilterPopoverAnchorElement] = useState<
153
+ HTMLElement | undefined
154
+ >();
155
+ const [filterPopoverCurrentFilter, setFilterPopoverCurrentFilter] = useState<
156
+ DataFilter | undefined
157
+ >();
158
+
159
+ const menuRef = useRef<HTMLDivElement>();
160
+
161
+ useEffect(() => {
162
+ onChangeFilters?.(filters);
163
+ }, [filters, onChangeFilters]);
164
+
165
+ const debouncer = useRef<NodeJS.Timeout | undefined>(undefined);
166
+ useEffect(() => {
167
+ if (!hasSearchSubmitButton) {
168
+ if (debouncer.current) {
169
+ clearTimeout(debouncer.current);
170
+ }
171
+
172
+ debouncer.current = setTimeout(() => {
173
+ onChangeSearch?.(searchValue ?? "");
174
+ }, searchDelayTime);
175
+ }
176
+ }, [onChangeSearch, searchValue, searchDelayTime, hasSearchSubmitButton]);
177
+
178
+ const handleInputChange = useCallback(
179
+ (filterId: string, value: DataFilterValue, submit: boolean = false) => {
180
+ setInputValues({ ...inputValues, [filterId]: value });
181
+
182
+ if (submit) {
183
+ const updatedFilters = filtersProp.map((filter) => ({
184
+ ...filter,
185
+ value: filter.id === filterId ? value : inputValues[filter.id],
186
+ }));
187
+
188
+ setFilters(updatedFilters);
189
+ }
190
+ },
191
+ [inputValues, filtersProp]
192
+ );
193
+
194
+ const handleMultiSelectChange = useCallback(
195
+ (filterId: string, value: string, submit: boolean = false) => {
196
+ const startingValues = filtersProp
197
+ .find((filter) => filter.id === filterId)
198
+ ?.options?.map((option) => option.value);
199
+ const currentValues = (inputValues[filterId] ??
200
+ startingValues) as string[];
201
+ const updatedValues = currentValues.includes(value)
202
+ ? currentValues.filter((item: string) => item !== value)
203
+ : [...currentValues, value];
204
+ const valuesToSave =
205
+ updatedValues.sort().join() === startingValues?.sort().join()
206
+ ? undefined
207
+ : updatedValues;
208
+
209
+ setInputValues({ ...inputValues, [filterId]: valuesToSave });
210
+
211
+ if (submit) {
212
+ const updatedFilters = filtersProp.map((filter) => ({
213
+ ...filter,
214
+ value: filter.id === filterId ? valuesToSave : inputValues[filter.id],
215
+ }));
216
+
217
+ setFilters(updatedFilters);
218
+ }
219
+ },
220
+ [inputValues, filtersProp]
221
+ );
222
+
223
+ const clearAllFilters = useCallback(() => {
224
+ const updatedInputValues = filtersProp.reduce((accumulator, filter) => {
225
+ accumulator[filter.id] = undefined;
226
+ return accumulator;
227
+ }, {} as Record<string, DataFilterValue>);
228
+
229
+ setInputValues(updatedInputValues);
230
+
231
+ const updatedFilters = filtersProp.map((filter) => ({
232
+ ...filter,
233
+ value: undefined,
234
+ }));
235
+
236
+ setFilters(updatedFilters);
237
+ }, [filtersProp]);
238
+
239
+ const handleFilterSubmit = useCallback(() => {
240
+ const updatedFilters = filtersProp.map((filter) => ({
241
+ ...filter,
242
+ value: inputValues[filter.id],
243
+ }));
244
+
245
+ setFilters(updatedFilters);
246
+ }, [inputValues, filtersProp]);
247
+
248
+ const filterMenu = useMemo(
249
+ () => (
250
+ <>
251
+ <Box>
252
+ <Button
253
+ aria-controls={isFiltersMenuOpen ? "filters-menu" : undefined}
254
+ aria-expanded={isFiltersMenuOpen ? "true" : undefined}
255
+ aria-haspopup="true"
256
+ ariaLabel="Filters"
257
+ endIcon={<FilterIcon />}
258
+ onClick={(event) => {
259
+ setFiltersMenuAnchorElement(event.currentTarget);
260
+ setIsFiltersMenuOpen(true);
261
+ }}
262
+ variant="secondary"
263
+ />
264
+ </Box>
265
+
266
+ <MuiMenu
267
+ anchorOrigin={{ horizontal: "left", vertical: "bottom" }}
268
+ transformOrigin={{ horizontal: "left", vertical: "top" }}
269
+ id="filters-menu"
270
+ anchorEl={filtersMenuAnchorElement}
271
+ onClose={() => setIsFiltersMenuOpen(false)}
272
+ open={isFiltersMenuOpen}
273
+ PaperProps={{
274
+ ref: menuRef as MutableRefObject<HTMLDivElement>,
275
+ }}
276
+ >
277
+ {filtersProp.map((filter) => {
278
+ // Unintuitively, we can't just use filter.value to grab the filter value.
279
+ // `filter` is the initial set of filters provided to the comoponent, so its
280
+ // value prop may not reflect the current value of the filter.
281
+ const latestFilterValue = filters.find(
282
+ (f) => f.id === filter.id
283
+ )?.value;
284
+
285
+ return (
286
+ <MenuItem
287
+ key={filter.id}
288
+ onClick={(event) => {
289
+ setIsFilterPopoverOpen(true);
290
+ setFilterPopoverAnchorElement(event.currentTarget);
291
+ setFilterPopoverCurrentFilter(filter);
292
+ }}
293
+ >
294
+ <Box
295
+ sx={{
296
+ display: "flex",
297
+ alignItems: "center",
298
+ justifyContent: "space-between",
299
+ width: "100%",
300
+ minWidth: 180,
301
+ }}
302
+ >
303
+ <Box sx={{ marginRight: 2 }}>
304
+ <Paragraph component="div">{filter.label}</Paragraph>
305
+ <Subordinate component="div">
306
+ {!latestFilterValue ||
307
+ (Array.isArray(latestFilterValue) &&
308
+ latestFilterValue.length === 0)
309
+ ? `Any ${filter.label.toLowerCase()}`
310
+ : Array.isArray(latestFilterValue)
311
+ ? `${latestFilterValue.length} selected`
312
+ : latestFilterValue}
313
+ </Subordinate>
314
+ </Box>
315
+ <ChevronRightIcon />
316
+ </Box>
317
+ </MenuItem>
318
+ );
319
+ })}
320
+ </MuiMenu>
321
+ </>
322
+ ),
323
+ [isFiltersMenuOpen, filtersMenuAnchorElement, filtersProp, filters]
324
+ );
325
+
326
+ return (
327
+ <Box>
328
+ {/* Upper section */}
329
+ <Box sx={{ display: "flex", justifyContent: "space-between" }}>
330
+ {/* Upper section left (filters and search) */}
331
+ <Box sx={{ display: "flex", gap: 2, width: "50%", maxWidth: 480 }}>
332
+ {/* Filter menu */}
333
+ {filters.length > 0 && (
334
+ <>
335
+ {filterMenu}
336
+ {/* Filter popover */}
337
+ <MuiPopover
338
+ anchorEl={filterPopoverAnchorElement}
339
+ open={isFilterPopoverOpen}
340
+ anchorOrigin={{ vertical: "top", horizontal: "right" }}
341
+ onClose={(ev: MouseEvent) => {
342
+ if (menuRef.current) {
343
+ const menuRect = menuRef.current.getBoundingClientRect();
344
+ const clickInsideMenu =
345
+ ev.clientX >= menuRect.left &&
346
+ ev.clientX <= menuRect.right &&
347
+ ev.clientY >= menuRect.top &&
348
+ ev.clientY <= menuRect.bottom;
349
+
350
+ if (!clickInsideMenu) {
351
+ setIsFiltersMenuOpen(false);
352
+ }
353
+ }
354
+
355
+ setIsFilterPopoverOpen(false);
356
+ }}
357
+ >
358
+ <Box sx={{ padding: 4, minWidth: 320 }}>
359
+ <form
360
+ onSubmit={(ev) => {
361
+ ev.preventDefault();
362
+ handleFilterSubmit();
363
+ setIsFilterPopoverOpen(false);
364
+ setIsFiltersMenuOpen(false);
365
+ }}
366
+ >
367
+ {/* Autocomplete */}
368
+ {filterPopoverCurrentFilter?.variant === "autocomplete" &&
369
+ filterPopoverCurrentFilter?.options && (
370
+ <Autocomplete
371
+ label={filterPopoverCurrentFilter.label}
372
+ value={
373
+ (inputValues[
374
+ filterPopoverCurrentFilter.id
375
+ ] as string) ?? ""
376
+ }
377
+ onBlur={function ro() {}}
378
+ onChange={function ro() {}}
379
+ onFocus={function ro() {}}
380
+ onInputChange={function ro() {}}
381
+ options={filterPopoverCurrentFilter.options.map(
382
+ (option: { label: string }) => ({
383
+ label: option.label,
384
+ })
385
+ )}
386
+ />
387
+ )}
388
+ {/* Text or Number */}
389
+ {(filterPopoverCurrentFilter?.variant === "text" ||
390
+ filterPopoverCurrentFilter?.variant === "range") && (
391
+ <Box
392
+ sx={{
393
+ display: "flex",
394
+ gap: 2,
395
+ alignItems: "flex-end",
396
+ }}
397
+ >
398
+ <Box sx={{ width: "100%" }}>
399
+ <TextField
400
+ hasInitialFocus
401
+ label={filterPopoverCurrentFilter.label}
402
+ type={
403
+ filterPopoverCurrentFilter.variant === "range"
404
+ ? "number"
405
+ : "text"
406
+ }
407
+ value={
408
+ (inputValues[
409
+ filterPopoverCurrentFilter.id
410
+ ] as string) ?? ""
411
+ }
412
+ onChange={(ev) =>
413
+ handleInputChange(
414
+ filterPopoverCurrentFilter.id,
415
+ ev.currentTarget.value
416
+ )
417
+ }
418
+ endAdornment={
419
+ inputValues[filterPopoverCurrentFilter.id] && (
420
+ <MuiIconButton
421
+ size="small"
422
+ aria-label="Clear filter"
423
+ onClick={() => {
424
+ handleInputChange(
425
+ filterPopoverCurrentFilter.id,
426
+ undefined,
427
+ true
428
+ );
429
+ }}
430
+ >
431
+ <CloseCircleFilledIcon />
432
+ </MuiIconButton>
433
+ )
434
+ }
435
+ />
436
+ </Box>
437
+ <Button
438
+ variant="primary"
439
+ endIcon={<CheckIcon />}
440
+ type="submit"
441
+ />
442
+ </Box>
443
+ )}
444
+
445
+ {/* Checkbox */}
446
+ {filterPopoverCurrentFilter?.variant === "multi-select" &&
447
+ filterPopoverCurrentFilter?.options && (
448
+ <CheckboxGroup
449
+ label={filterPopoverCurrentFilter.label}
450
+ isRequired
451
+ >
452
+ {filterPopoverCurrentFilter.options.map(
453
+ (option: { label: string; value: string }) => (
454
+ <Checkbox
455
+ key={option.value}
456
+ label={option.label}
457
+ value={option.value}
458
+ isDefaultChecked={
459
+ inputValues[
460
+ filterPopoverCurrentFilter.id
461
+ ]?.includes(option.value) ||
462
+ inputValues[filterPopoverCurrentFilter.id] ===
463
+ undefined
464
+ }
465
+ onChange={() =>
466
+ handleMultiSelectChange(
467
+ filterPopoverCurrentFilter.id,
468
+ option.value,
469
+ true
470
+ )
471
+ }
472
+ />
473
+ )
474
+ )}
475
+ </CheckboxGroup>
476
+ )}
477
+
478
+ {/* Radio */}
479
+ {filterPopoverCurrentFilter?.variant === "select" &&
480
+ filterPopoverCurrentFilter?.options && (
481
+ <RadioGroup
482
+ label={filterPopoverCurrentFilter.label}
483
+ onChange={(_, value) =>
484
+ handleInputChange(
485
+ filterPopoverCurrentFilter.id,
486
+ value,
487
+ true
488
+ )
489
+ }
490
+ >
491
+ <Radio
492
+ label="Any"
493
+ value={""}
494
+ isChecked={
495
+ !inputValues[filterPopoverCurrentFilter.id]
496
+ }
497
+ />
498
+ <>
499
+ {filterPopoverCurrentFilter.options.map(
500
+ (option: { label: string; value: string }) => (
501
+ <Radio
502
+ key={option.value}
503
+ label={option.label}
504
+ value={option.value}
505
+ isChecked={
506
+ inputValues[
507
+ filterPopoverCurrentFilter.id
508
+ ] === option.value
509
+ }
510
+ />
511
+ )
512
+ )}
513
+ </>
514
+ </RadioGroup>
515
+ )}
516
+ </form>
517
+ </Box>
518
+ </MuiPopover>
519
+ </>
520
+ )}
521
+
522
+ {/* Search */}
523
+ {onChangeSearch && (
524
+ <form
525
+ style={{ width: "100%" }}
526
+ onSubmit={(event) => {
527
+ event.preventDefault();
528
+ if (hasSearchSubmitButton) {
529
+ onChangeSearch(searchValue);
530
+ }
531
+ }}
532
+ >
533
+ <Box sx={{ display: "flex", gap: 2, width: "100%" }}>
534
+ <SearchField
535
+ value={searchValue}
536
+ label="Search"
537
+ onClear={() => {
538
+ setSearchValue("");
539
+ onChangeSearch("");
540
+ }}
541
+ onChange={(ev) => setSearchValue(ev.target.value)}
542
+ />
543
+ {hasSearchSubmitButton && (
544
+ <Box>
545
+ <Button
546
+ variant="primary"
547
+ label="Search"
548
+ onClick={() => onChangeSearch(searchValue)}
549
+ />
550
+ </Box>
551
+ )}
552
+ </Box>
553
+ </form>
554
+ )}
555
+ </Box>
556
+
557
+ {/* Upper section right (clear filters & additional actions) */}
558
+ <Box sx={{ display: "flex", gap: 2 }}>
559
+ {activeFilters.length > 0 && (
560
+ <Box>
561
+ <Button
562
+ variant="secondary"
563
+ label="Clear filters"
564
+ onClick={() => clearAllFilters()}
565
+ />
566
+ </Box>
567
+ )}
568
+ {additionalActions}
569
+ </Box>
570
+ </Box>
571
+
572
+ {/* Lower section */}
573
+ {activeFilters.length > 0 && (
574
+ <Box
575
+ sx={{
576
+ borderTopWidth: 1,
577
+ borderTopColor: "#eeeeee",
578
+ borderTopStyle: "solid",
579
+ paddingTop: 4,
580
+ marginTop: 4,
581
+ }}
582
+ >
583
+ <TagList>
584
+ {activeFilters.map((filter) => (
585
+ <Tag
586
+ key={filter.label}
587
+ label={`${filter.label}: ${filter.value}`}
588
+ onRemove={() => handleInputChange(filter.id, undefined, true)}
589
+ />
590
+ ))}
591
+ </TagList>
592
+ </Box>
593
+ )}
594
+ </Box>
595
+ );
596
+ };
597
+
598
+ const MemoizedDataFilters = memo(DataFilters);
599
+ MemoizedDataFilters.displayName = "DataFilters";
600
+
601
+ export { MemoizedDataFilters as DataFilters };