@nova-design-system/nova-react 3.21.1-beta.0 → 3.22.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 (66) hide show
  1. package/dist/cjs/generated/components.server.js +0 -92
  2. package/dist/cjs/{index-CEKdYnmK.js → index-WPRkQD3O.js} +619 -1364
  3. package/dist/cjs/index.js +1 -11
  4. package/dist/cjs/{nv-accordion-item.entry-zvp8yDql.js → nv-accordion-item.entry-BuTvA6w9.js} +1 -1
  5. package/dist/cjs/{nv-accordion.entry-D6gckOF4.js → nv-accordion.entry-Dtsfw6He.js} +1 -1
  6. package/dist/cjs/{nv-alert.entry-Df8-nQ-R.js → nv-alert.entry-TIdfdU7Y.js} +1 -1
  7. package/dist/cjs/{nv-avatar.entry-ZOnVWP9L.js → nv-avatar.entry-CaxrhPuw.js} +1 -1
  8. package/dist/cjs/{nv-badge_2.entry-DgiVv_Yf.js → nv-badge_2.entry-CfYvTZxX.js} +1 -1
  9. package/dist/cjs/{nv-breadcrumb.entry-IqtE1JL0.js → nv-breadcrumb.entry-BCZ4MmfD.js} +1 -1
  10. package/dist/cjs/{nv-breadcrumbs.entry-Be6dz7zI.js → nv-breadcrumbs.entry-DwzCE7F6.js} +1 -1
  11. package/dist/cjs/{nv-button.entry-CmswF3Si.js → nv-button.entry-Cr_86bcZ.js} +1 -1
  12. package/dist/cjs/{nv-buttongroup.entry-Cfe6rFSs.js → nv-buttongroup.entry-CWjRoHY1.js} +1 -1
  13. package/dist/cjs/{nv-calendar.entry-q83sS_dN.js → nv-calendar.entry-CXfwNt6G.js} +1 -1
  14. package/dist/cjs/{nv-col.entry-Cu-Qi1bi.js → nv-col.entry-CJLDS3LY.js} +1 -1
  15. package/dist/cjs/{nv-datagrid.entry-Cx7SvD5S.js → nv-datagrid.entry-Cns8XSud.js} +1 -1
  16. package/dist/cjs/{nv-datagridcolumn.entry-B_uXKFLg.js → nv-datagridcolumn.entry-CFFAipHF.js} +1 -1
  17. package/dist/cjs/{nv-dialog.entry-J6Xwi6z1.js → nv-dialog.entry-CDSK9pUH.js} +1 -1
  18. package/dist/cjs/{nv-dialogfooter_2.entry-DOlhqDTh.js → nv-dialogfooter_2.entry-To_dGUn4.js} +1 -1
  19. package/dist/cjs/{nv-fieldcheckbox.entry-C23dGGX7.js → nv-fieldcheckbox.entry-fdonR07Z.js} +1 -1
  20. package/dist/cjs/{nv-fielddate.entry-xWi3GpLl.js → nv-fielddate.entry-C3pXtMHL.js} +1 -1
  21. package/dist/cjs/{nv-fielddaterange.entry-BwFtpw9X.js → nv-fielddaterange.entry-CjVVPEK_.js} +1 -1
  22. package/dist/cjs/{nv-fielddropdown.entry-mnl7mSaK.js → nv-fielddropdown.entry-C9mXuNNj.js} +1 -1
  23. package/dist/cjs/{nv-fielddropdownitem.entry-DjyFlVXw.js → nv-fielddropdownitem.entry-Dah-PaE8.js} +1 -1
  24. package/dist/cjs/{nv-fieldmultiselect.entry-BtLTG7nM.js → nv-fieldmultiselect.entry-BMLjhqoJ.js} +1 -1
  25. package/dist/cjs/{nv-fieldnumber.entry-C00Hg70B.js → nv-fieldnumber.entry-DBdJviXu.js} +1 -1
  26. package/dist/cjs/{nv-fieldpassword.entry-BLg8tCN0.js → nv-fieldpassword.entry-Cim_usSM.js} +1 -1
  27. package/dist/cjs/{nv-fieldradio.entry-2hb1Ur40.js → nv-fieldradio.entry-X_2VT1Dj.js} +1 -1
  28. package/dist/cjs/{nv-fieldselect.entry-D-eYQpAv.js → nv-fieldselect.entry-pSp-2rNn.js} +1 -1
  29. package/dist/cjs/{nv-fieldslider.entry-BGle1RZR.js → nv-fieldslider.entry-pZf7zzLU.js} +1 -1
  30. package/dist/cjs/{nv-fieldtext.entry-Djg8cqOa.js → nv-fieldtext.entry-DlI_ExaV.js} +1 -1
  31. package/dist/cjs/{nv-fieldtextarea.entry-Z32-s901.js → nv-fieldtextarea.entry-t3Ixxi23.js} +1 -1
  32. package/dist/cjs/{nv-fieldtime.entry-CDFGdfFL.js → nv-fieldtime.entry-DY7D5_6K.js} +1 -1
  33. package/dist/cjs/{nv-icon.entry-BDq7DKRt.js → nv-icon.entry-6oYPSf4c.js} +1 -1
  34. package/dist/cjs/{nv-iconbutton_2.entry-DdgEkFLK.js → nv-iconbutton_2.entry-ChULGovr.js} +1 -1
  35. package/dist/cjs/{nv-menu.entry-iob0Kve8.js → nv-menu.entry-sd0tatWq.js} +1 -1
  36. package/dist/cjs/{nv-menuitem.entry-C989Ui60.js → nv-menuitem.entry-CCOqR7UF.js} +1 -1
  37. package/dist/cjs/{nv-notification.entry-BxvJMKxH.js → nv-notification.entry-Cc3zE3yY.js} +1 -1
  38. package/dist/cjs/{nv-notificationcontainer.entry-CxGCIb96.js → nv-notificationcontainer.entry-DV4D6oOH.js} +1 -1
  39. package/dist/cjs/{nv-popover.entry-1KsO_KQm.js → nv-popover.entry-DQSwI2jT.js} +1 -1
  40. package/dist/cjs/{nv-row.entry-PBLq_BzJ.js → nv-row.entry-UUuMSAY5.js} +1 -1
  41. package/dist/cjs/{nv-split.entry-y66NBf88.js → nv-split.entry-CYP2bTTM.js} +2 -2
  42. package/dist/cjs/{nv-stack.entry-CXjpkpbW.js → nv-stack.entry-D35-75Vw.js} +2 -2
  43. package/dist/cjs/{nv-table.entry-quaVnLru.js → nv-table.entry-DevWJBnL.js} +2 -2
  44. package/dist/cjs/{nv-tableheader.entry-DTBE2XQO.js → nv-tableheader.entry-Hs7nUSOC.js} +2 -2
  45. package/dist/cjs/{nv-toggle.entry-CxUwF0pb.js → nv-toggle.entry-Eje9d--6.js} +3 -3
  46. package/dist/cjs/{nv-togglebutton.entry-w-WEAmE6.js → nv-togglebutton.entry-LGI7pIeK.js} +2 -2
  47. package/dist/cjs/{nv-togglebuttongroup.entry-UbrE8y7a.js → nv-togglebuttongroup.entry-CWN_Ucry.js} +2 -2
  48. package/dist/cjs/{nv-tooltip.entry-Dq2bkV33.js → nv-tooltip.entry-BGkKDEFg.js} +2 -2
  49. package/dist/components/NvDatatable/NvDatatable.js +77 -4
  50. package/dist/generated/components.js +0 -80
  51. package/dist/generated/components.server.js +0 -82
  52. package/dist/types/components/NvDatatable/NvDatatable.d.ts +1 -1
  53. package/dist/types/components/NvDatatable/types.d.ts +17 -1
  54. package/dist/types/generated/components.d.ts +0 -32
  55. package/dist/types/generated/components.server.d.ts +0 -32
  56. package/package.json +1 -1
  57. package/dist/cjs/nv-notification-bullet.entry-J8OkAZtU.js +0 -77
  58. package/dist/cjs/nv-sidebar.entry-CjLbvLqw.js +0 -177
  59. package/dist/cjs/nv-sidebarcontent.entry-Cv76IH4W.js +0 -22
  60. package/dist/cjs/nv-sidebardivider.entry-DYPJ_k73.js +0 -22
  61. package/dist/cjs/nv-sidebarfooter.entry-mGcMBRmv.js +0 -22
  62. package/dist/cjs/nv-sidebargroup.entry-DtwFliHZ.js +0 -23
  63. package/dist/cjs/nv-sidebarheader.entry-BdOYIXCA.js +0 -22
  64. package/dist/cjs/nv-sidebarlogo.entry-Da0kGsfw.js +0 -32
  65. package/dist/cjs/nv-sidebarnavitem.entry-D5xLfpwn.js +0 -297
  66. package/dist/cjs/nv-sidebarnavsubitem.entry-CkeJfHH4.js +0 -35
@@ -1,13 +1,39 @@
1
- import React, { useMemo, useState, useEffect, useRef } from 'react';
2
- import { flexRender, getCoreRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from '@tanstack/react-table';
1
+ import React, { useMemo, useState, useEffect, useRef, useCallback, } from 'react';
2
+ import { flexRender, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, useReactTable, } from '@tanstack/react-table';
3
3
  import { NvTable, NvTableheader } from '../../generated/components';
4
- function NvDatatable({ columns, rows, pagination, sorting, renderPagination, stickyHeader, ...htmlProps }) {
4
+ function NvDatatable({ columns, rows, pagination, sorting, filtering, renderPagination, renderFiltering, stickyHeader, ...htmlProps }) {
5
5
  const [paginationState, setPaginationState] = useState({
6
6
  pageIndex: 0,
7
7
  pageSize: pagination?.initialPageSize || 10,
8
8
  });
9
9
  const [sortingState, setSortingState] = useState(sorting?.sortState || []);
10
+ const [globalFilterState, setGlobalFilterState] = useState(filtering?.filterState);
10
11
  const lastRowRef = useRef(null);
12
+ const debouncedSetFilter = useRef(null);
13
+ const setGlobalFilterDebounced = useCallback((value) => {
14
+ const debounceMs = filtering?.debounceMs ?? 300;
15
+ if (debouncedSetFilter.current) {
16
+ clearTimeout(debouncedSetFilter.current);
17
+ }
18
+ debouncedSetFilter.current = setTimeout(() => {
19
+ setGlobalFilterState(value);
20
+ if (filtering?.mode === 'server' && filtering.onFilterChange) {
21
+ filtering.onFilterChange(value);
22
+ }
23
+ }, debounceMs);
24
+ }, [filtering]);
25
+ useEffect(() => {
26
+ return () => {
27
+ if (debouncedSetFilter.current) {
28
+ clearTimeout(debouncedSetFilter.current);
29
+ }
30
+ };
31
+ }, []);
32
+ useEffect(() => {
33
+ if (filtering?.filterState !== undefined) {
34
+ setGlobalFilterState(filtering.filterState);
35
+ }
36
+ }, [filtering?.filterState]);
11
37
  const tableColumns = useMemo(() => columns
12
38
  .filter((col) => !col.hidden)
13
39
  .map((col) => {
@@ -64,6 +90,7 @@ function NvDatatable({ columns, rows, pagination, sorting, renderPagination, sti
64
90
  ...(sorting && {
65
91
  state: {
66
92
  sorting: sorting.sortState || sortingState,
93
+ ...(filtering && { globalFilter: globalFilterState }),
67
94
  },
68
95
  onSortingChange: sorting.mode === 'server'
69
96
  ? (updater) => {
@@ -83,6 +110,23 @@ function NvDatatable({ columns, rows, pagination, sorting, renderPagination, sti
83
110
  isMultiSortEvent: sorting.enableMultiSort ? () => true : undefined,
84
111
  getSortedRowModel: sorting.mode === 'client' ? getSortedRowModel() : undefined,
85
112
  }),
113
+ ...(filtering && {
114
+ state: {
115
+ ...(sorting && { sorting: sorting.sortState || sortingState }),
116
+ globalFilter: globalFilterState,
117
+ },
118
+ onGlobalFilterChange: (updater) => {
119
+ const newFilter = typeof updater === 'function'
120
+ ? updater(globalFilterState)
121
+ : updater;
122
+ setGlobalFilterState(newFilter);
123
+ if (filtering.mode === 'server' && filtering.onFilterChange) {
124
+ filtering.onFilterChange(newFilter);
125
+ }
126
+ },
127
+ globalFilterFn: filtering.globalFilterFn,
128
+ getFilteredRowModel: filtering.mode === 'client' ? getFilteredRowModel() : undefined,
129
+ }),
86
130
  };
87
131
  if (!pagination) {
88
132
  return baseConfig;
@@ -120,7 +164,16 @@ function NvDatatable({ columns, rows, pagination, sorting, renderPagination, sti
120
164
  };
121
165
  }
122
166
  return baseConfig;
123
- }, [rows, tableColumns, pagination, paginationState, sorting, sortingState]);
167
+ }, [
168
+ rows,
169
+ tableColumns,
170
+ pagination,
171
+ paginationState,
172
+ sorting,
173
+ sortingState,
174
+ filtering,
175
+ globalFilterState,
176
+ ]);
124
177
  const table = useReactTable(tableConfig);
125
178
  useEffect(() => {
126
179
  if (pagination?.mode === 'server' && pagination.onPaginationChange) {
@@ -180,7 +233,27 @@ function NvDatatable({ columns, rows, pagination, sorting, renderPagination, sti
180
233
  }, [pagination, table, rows.length, tablePaginationState]);
181
234
  const tableRows = table.getRowModel().rows;
182
235
  const isInfiniteScroll = pagination?.mode === 'infinite';
236
+ const filteringAPI = useMemo(() => {
237
+ if (!filtering) {
238
+ return null;
239
+ }
240
+ const preFilteredRowModel = table.getPreFilteredRowModel();
241
+ const filteredRowModel = table.getFilteredRowModel();
242
+ return {
243
+ filterState: globalFilterState,
244
+ setGlobalFilter: setGlobalFilterDebounced,
245
+ resetFilters: () => {
246
+ setGlobalFilterState(undefined);
247
+ if (filtering.onFilterChange) {
248
+ filtering.onFilterChange(undefined);
249
+ }
250
+ },
251
+ totalRows: preFilteredRowModel.rows.length,
252
+ filteredRows: filteredRowModel.rows.length,
253
+ };
254
+ }, [filtering, globalFilterState, table, setGlobalFilterDebounced]);
183
255
  return (React.createElement(React.Fragment, null,
256
+ filteringAPI && renderFiltering && renderFiltering(filteringAPI),
184
257
  React.createElement(NvTable, { ...htmlProps },
185
258
  React.createElement("table", null,
186
259
  React.createElement("thead", { "data-sticky-top": stickyHeader ? 'true' : undefined }, table.getHeaderGroups().map((headerGroup) => (React.createElement("tr", { key: headerGroup.id }, headerGroup.headers.map((header) => {
@@ -35,20 +35,10 @@ import { NvIconbutton as NvIconbuttonElement, defineCustomElement as defineNvIco
35
35
  import { NvLoader as NvLoaderElement, defineCustomElement as defineNvLoader } from "@nova-design-system/nova-webcomponents/dist/components/nv-loader.js";
36
36
  import { NvMenu as NvMenuElement, defineCustomElement as defineNvMenu } from "@nova-design-system/nova-webcomponents/dist/components/nv-menu.js";
37
37
  import { NvMenuitem as NvMenuitemElement, defineCustomElement as defineNvMenuitem } from "@nova-design-system/nova-webcomponents/dist/components/nv-menuitem.js";
38
- import { NvNotificationBullet as NvNotificationBulletElement, defineCustomElement as defineNvNotificationBullet } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification-bullet.js";
39
38
  import { NvNotification as NvNotificationElement, defineCustomElement as defineNvNotification } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification.js";
40
39
  import { NvNotificationcontainer as NvNotificationcontainerElement, defineCustomElement as defineNvNotificationcontainer } from "@nova-design-system/nova-webcomponents/dist/components/nv-notificationcontainer.js";
41
40
  import { NvPopover as NvPopoverElement, defineCustomElement as defineNvPopover } from "@nova-design-system/nova-webcomponents/dist/components/nv-popover.js";
42
41
  import { NvRow as NvRowElement, defineCustomElement as defineNvRow } from "@nova-design-system/nova-webcomponents/dist/components/nv-row.js";
43
- import { NvSidebar as NvSidebarElement, defineCustomElement as defineNvSidebar } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebar.js";
44
- import { NvSidebarcontent as NvSidebarcontentElement, defineCustomElement as defineNvSidebarcontent } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarcontent.js";
45
- import { NvSidebardivider as NvSidebardividerElement, defineCustomElement as defineNvSidebardivider } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebardivider.js";
46
- import { NvSidebarfooter as NvSidebarfooterElement, defineCustomElement as defineNvSidebarfooter } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarfooter.js";
47
- import { NvSidebargroup as NvSidebargroupElement, defineCustomElement as defineNvSidebargroup } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebargroup.js";
48
- import { NvSidebarheader as NvSidebarheaderElement, defineCustomElement as defineNvSidebarheader } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarheader.js";
49
- import { NvSidebarlogo as NvSidebarlogoElement, defineCustomElement as defineNvSidebarlogo } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarlogo.js";
50
- import { NvSidebarnavitem as NvSidebarnavitemElement, defineCustomElement as defineNvSidebarnavitem } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarnavitem.js";
51
- import { NvSidebarnavsubitem as NvSidebarnavsubitemElement, defineCustomElement as defineNvSidebarnavsubitem } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarnavsubitem.js";
52
42
  import { NvSplit as NvSplitElement, defineCustomElement as defineNvSplit } from "@nova-design-system/nova-webcomponents/dist/components/nv-split.js";
53
43
  import { NvStack as NvStackElement, defineCustomElement as defineNvStack } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
54
44
  import { NvTable as NvTableElement, defineCustomElement as defineNvTable } from "@nova-design-system/nova-webcomponents/dist/components/nv-table.js";
@@ -348,13 +338,6 @@ export const NvNotification = createComponent({
348
338
  events: { onHiddenChanged: 'hiddenChanged' },
349
339
  defineCustomElement: defineNvNotification
350
340
  });
351
- export const NvNotificationBullet = createComponent({
352
- tagName: 'nv-notification-bullet',
353
- elementClass: NvNotificationBulletElement,
354
- react: React,
355
- events: {},
356
- defineCustomElement: defineNvNotificationBullet
357
- });
358
341
  export const NvNotificationcontainer = createComponent({
359
342
  tagName: 'nv-notificationcontainer',
360
343
  elementClass: NvNotificationcontainerElement,
@@ -376,69 +359,6 @@ export const NvRow = createComponent({
376
359
  events: {},
377
360
  defineCustomElement: defineNvRow
378
361
  });
379
- export const NvSidebar = createComponent({
380
- tagName: 'nv-sidebar',
381
- elementClass: NvSidebarElement,
382
- react: React,
383
- events: { onOpenChanged: 'openChanged' },
384
- defineCustomElement: defineNvSidebar
385
- });
386
- export const NvSidebarcontent = createComponent({
387
- tagName: 'nv-sidebarcontent',
388
- elementClass: NvSidebarcontentElement,
389
- react: React,
390
- events: {},
391
- defineCustomElement: defineNvSidebarcontent
392
- });
393
- export const NvSidebardivider = createComponent({
394
- tagName: 'nv-sidebardivider',
395
- elementClass: NvSidebardividerElement,
396
- react: React,
397
- events: {},
398
- defineCustomElement: defineNvSidebardivider
399
- });
400
- export const NvSidebarfooter = createComponent({
401
- tagName: 'nv-sidebarfooter',
402
- elementClass: NvSidebarfooterElement,
403
- react: React,
404
- events: {},
405
- defineCustomElement: defineNvSidebarfooter
406
- });
407
- export const NvSidebargroup = createComponent({
408
- tagName: 'nv-sidebargroup',
409
- elementClass: NvSidebargroupElement,
410
- react: React,
411
- events: {},
412
- defineCustomElement: defineNvSidebargroup
413
- });
414
- export const NvSidebarheader = createComponent({
415
- tagName: 'nv-sidebarheader',
416
- elementClass: NvSidebarheaderElement,
417
- react: React,
418
- events: {},
419
- defineCustomElement: defineNvSidebarheader
420
- });
421
- export const NvSidebarlogo = createComponent({
422
- tagName: 'nv-sidebarlogo',
423
- elementClass: NvSidebarlogoElement,
424
- react: React,
425
- events: {},
426
- defineCustomElement: defineNvSidebarlogo
427
- });
428
- export const NvSidebarnavitem = createComponent({
429
- tagName: 'nv-sidebarnavitem',
430
- elementClass: NvSidebarnavitemElement,
431
- react: React,
432
- events: {},
433
- defineCustomElement: defineNvSidebarnavitem
434
- });
435
- export const NvSidebarnavsubitem = createComponent({
436
- tagName: 'nv-sidebarnavsubitem',
437
- elementClass: NvSidebarnavsubitemElement,
438
- react: React,
439
- events: {},
440
- defineCustomElement: defineNvSidebarnavsubitem
441
- });
442
362
  export const NvSplit = createComponent({
443
363
  tagName: 'nv-split',
444
364
  elementClass: NvSplitElement,
@@ -668,18 +668,6 @@ export const NvNotification = createComponent({
668
668
  hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
669
669
  serializeShadowRoot
670
670
  });
671
- export const NvNotificationBullet = createComponent({
672
- tagName: 'nv-notification-bullet',
673
- properties: {
674
- count: 'count',
675
- intention: 'intention',
676
- emphasis: 'emphasis',
677
- size: 'size',
678
- contrastingBorder: 'contrasting-border'
679
- },
680
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
681
- serializeShadowRoot
682
- });
683
671
  export const NvNotificationcontainer = createComponent({
684
672
  tagName: 'nv-notificationcontainer',
685
673
  properties: { position: 'position' },
@@ -710,76 +698,6 @@ export const NvRow = createComponent({
710
698
  hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
711
699
  serializeShadowRoot
712
700
  });
713
- export const NvSidebar = createComponent({
714
- tagName: 'nv-sidebar',
715
- properties: {
716
- type: 'type',
717
- open: 'open',
718
- activePath: 'active-path',
719
- notificationIntention: 'notification-intention',
720
- notificationEmphasis: 'notification-emphasis'
721
- },
722
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
723
- serializeShadowRoot
724
- });
725
- export const NvSidebarcontent = createComponent({
726
- tagName: 'nv-sidebarcontent',
727
- properties: {},
728
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
729
- serializeShadowRoot
730
- });
731
- export const NvSidebardivider = createComponent({
732
- tagName: 'nv-sidebardivider',
733
- properties: {},
734
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
735
- serializeShadowRoot
736
- });
737
- export const NvSidebarfooter = createComponent({
738
- tagName: 'nv-sidebarfooter',
739
- properties: {},
740
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
741
- serializeShadowRoot
742
- });
743
- export const NvSidebargroup = createComponent({
744
- tagName: 'nv-sidebargroup',
745
- properties: { label: 'label' },
746
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
747
- serializeShadowRoot
748
- });
749
- export const NvSidebarheader = createComponent({
750
- tagName: 'nv-sidebarheader',
751
- properties: {},
752
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
753
- serializeShadowRoot
754
- });
755
- export const NvSidebarlogo = createComponent({
756
- tagName: 'nv-sidebarlogo',
757
- properties: {
758
- label: 'label',
759
- logo: 'logo',
760
- collapsedLogo: 'collapsed-logo'
761
- },
762
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
763
- serializeShadowRoot
764
- });
765
- export const NvSidebarnavitem = createComponent({
766
- tagName: 'nv-sidebarnavitem',
767
- properties: {
768
- icon: 'icon',
769
- active: 'active',
770
- collapsible: 'collapsible',
771
- open: 'open',
772
- notificationCount: 'notification-count'
773
- },
774
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
775
- serializeShadowRoot
776
- });
777
- export const NvSidebarnavsubitem = createComponent({
778
- tagName: 'nv-sidebarnavsubitem',
779
- properties: { active: 'active' },
780
- hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
781
- serializeShadowRoot
782
- });
783
701
  export const NvSplit = createComponent({
784
702
  tagName: 'nv-split',
785
703
  properties: {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { NvDatatableProps } from './types';
3
- declare function NvDatatable<T>({ columns, rows, pagination, sorting, renderPagination, stickyHeader, ...htmlProps }: NvDatatableProps<T>): React.JSX.Element;
3
+ declare function NvDatatable<T>({ columns, rows, pagination, sorting, filtering, renderPagination, renderFiltering, stickyHeader, ...htmlProps }: NvDatatableProps<T>): React.JSX.Element;
4
4
  declare namespace NvDatatable {
5
5
  var displayName: string;
6
6
  }
@@ -1,11 +1,13 @@
1
1
  import type { ComponentProps } from 'react';
2
- import type { SortingFn, NoInfer, SortingState } from '@tanstack/react-table';
2
+ import type { SortingFn, NoInfer, SortingState, Row } from '@tanstack/react-table';
3
3
  export type NvDatatableProps<T> = {
4
4
  columns: Array<NvDatatableColumn<T>>;
5
5
  rows: Array<T>;
6
6
  pagination?: NvDatatablePaginationConfig;
7
7
  sorting?: NvDatatableSortingConfig;
8
+ filtering?: NvDatatableFilteringConfig<T>;
8
9
  renderPagination?: (api: NvDatatableRenderPaginationAPI) => React.ReactNode;
10
+ renderFiltering?: (api: NvDatatableRenderFilteringAPI) => React.ReactNode;
9
11
  stickyHeader?: boolean;
10
12
  } & Pick<ComponentProps<'div'>, 'className' | 'style'>;
11
13
  export interface NvDatatableColumn<Row, K extends keyof Row = keyof Row, F = Row[K]> {
@@ -74,3 +76,17 @@ export interface NvDatatableSortingConfig {
74
76
  sortState?: NvDataTableSortingState;
75
77
  onSortingChange?: (sorting: SortingState) => void;
76
78
  }
79
+ export interface NvDatatableFilteringConfig<T> {
80
+ mode: 'client' | 'server';
81
+ filterState?: unknown;
82
+ onFilterChange?: (filterState: unknown) => void;
83
+ globalFilterFn?: (row: Row<T>, columnId: string, filterValue: unknown) => boolean;
84
+ debounceMs?: number;
85
+ }
86
+ export interface NvDatatableRenderFilteringAPI {
87
+ filterState: unknown;
88
+ setGlobalFilter: (value: unknown) => void;
89
+ resetFilters: () => void;
90
+ totalRows: number;
91
+ filteredRows: number;
92
+ }
@@ -35,20 +35,10 @@ import { NvIconbutton as NvIconbuttonElement } from "@nova-design-system/nova-we
35
35
  import { NvLoader as NvLoaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-loader.js";
36
36
  import { NvMenu as NvMenuElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menu.js";
37
37
  import { NvMenuitem as NvMenuitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menuitem.js";
38
- import { NvNotificationBullet as NvNotificationBulletElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification-bullet.js";
39
38
  import { NvNotification as NvNotificationElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification.js";
40
39
  import { NvNotificationcontainer as NvNotificationcontainerElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notificationcontainer.js";
41
40
  import { NvPopover as NvPopoverElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-popover.js";
42
41
  import { NvRow as NvRowElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-row.js";
43
- import { NvSidebar as NvSidebarElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebar.js";
44
- import { NvSidebarcontent as NvSidebarcontentElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarcontent.js";
45
- import { NvSidebardivider as NvSidebardividerElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebardivider.js";
46
- import { NvSidebarfooter as NvSidebarfooterElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarfooter.js";
47
- import { NvSidebargroup as NvSidebargroupElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebargroup.js";
48
- import { NvSidebarheader as NvSidebarheaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarheader.js";
49
- import { NvSidebarlogo as NvSidebarlogoElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarlogo.js";
50
- import { NvSidebarnavitem as NvSidebarnavitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarnavitem.js";
51
- import { NvSidebarnavsubitem as NvSidebarnavsubitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarnavsubitem.js";
52
42
  import { NvSplit as NvSplitElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-split.js";
53
43
  import { NvStack as NvStackElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
54
44
  import { NvTable as NvTableElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-table.js";
@@ -223,8 +213,6 @@ export type NvNotificationEvents = {
223
213
  onHiddenChanged: EventName<CustomEvent<boolean>>;
224
214
  };
225
215
  export declare const NvNotification: StencilReactComponent<NvNotificationElement, NvNotificationEvents>;
226
- export type NvNotificationBulletEvents = NonNullable<unknown>;
227
- export declare const NvNotificationBullet: StencilReactComponent<NvNotificationBulletElement, NvNotificationBulletEvents>;
228
216
  export type NvNotificationcontainerEvents = NonNullable<unknown>;
229
217
  export declare const NvNotificationcontainer: StencilReactComponent<NvNotificationcontainerElement, NvNotificationcontainerEvents>;
230
218
  export type NvPopoverEvents = {
@@ -233,26 +221,6 @@ export type NvPopoverEvents = {
233
221
  export declare const NvPopover: StencilReactComponent<NvPopoverElement, NvPopoverEvents>;
234
222
  export type NvRowEvents = NonNullable<unknown>;
235
223
  export declare const NvRow: StencilReactComponent<NvRowElement, NvRowEvents>;
236
- export type NvSidebarEvents = {
237
- onOpenChanged: EventName<CustomEvent<boolean>>;
238
- };
239
- export declare const NvSidebar: StencilReactComponent<NvSidebarElement, NvSidebarEvents>;
240
- export type NvSidebarcontentEvents = NonNullable<unknown>;
241
- export declare const NvSidebarcontent: StencilReactComponent<NvSidebarcontentElement, NvSidebarcontentEvents>;
242
- export type NvSidebardividerEvents = NonNullable<unknown>;
243
- export declare const NvSidebardivider: StencilReactComponent<NvSidebardividerElement, NvSidebardividerEvents>;
244
- export type NvSidebarfooterEvents = NonNullable<unknown>;
245
- export declare const NvSidebarfooter: StencilReactComponent<NvSidebarfooterElement, NvSidebarfooterEvents>;
246
- export type NvSidebargroupEvents = NonNullable<unknown>;
247
- export declare const NvSidebargroup: StencilReactComponent<NvSidebargroupElement, NvSidebargroupEvents>;
248
- export type NvSidebarheaderEvents = NonNullable<unknown>;
249
- export declare const NvSidebarheader: StencilReactComponent<NvSidebarheaderElement, NvSidebarheaderEvents>;
250
- export type NvSidebarlogoEvents = NonNullable<unknown>;
251
- export declare const NvSidebarlogo: StencilReactComponent<NvSidebarlogoElement, NvSidebarlogoEvents>;
252
- export type NvSidebarnavitemEvents = NonNullable<unknown>;
253
- export declare const NvSidebarnavitem: StencilReactComponent<NvSidebarnavitemElement, NvSidebarnavitemEvents>;
254
- export type NvSidebarnavsubitemEvents = NonNullable<unknown>;
255
- export declare const NvSidebarnavsubitem: StencilReactComponent<NvSidebarnavsubitemElement, NvSidebarnavsubitemEvents>;
256
224
  export type NvSplitEvents = {
257
225
  onSizesChanged: EventName<CustomEvent<number[]>>;
258
226
  };
@@ -35,20 +35,10 @@ import { NvIconbutton as NvIconbuttonElement } from "@nova-design-system/nova-we
35
35
  import { NvLoader as NvLoaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-loader.js";
36
36
  import { NvMenu as NvMenuElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menu.js";
37
37
  import { NvMenuitem as NvMenuitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menuitem.js";
38
- import { NvNotificationBullet as NvNotificationBulletElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification-bullet.js";
39
38
  import { NvNotification as NvNotificationElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification.js";
40
39
  import { NvNotificationcontainer as NvNotificationcontainerElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notificationcontainer.js";
41
40
  import { NvPopover as NvPopoverElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-popover.js";
42
41
  import { NvRow as NvRowElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-row.js";
43
- import { NvSidebar as NvSidebarElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebar.js";
44
- import { NvSidebarcontent as NvSidebarcontentElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarcontent.js";
45
- import { NvSidebardivider as NvSidebardividerElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebardivider.js";
46
- import { NvSidebarfooter as NvSidebarfooterElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarfooter.js";
47
- import { NvSidebargroup as NvSidebargroupElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebargroup.js";
48
- import { NvSidebarheader as NvSidebarheaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarheader.js";
49
- import { NvSidebarlogo as NvSidebarlogoElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarlogo.js";
50
- import { NvSidebarnavitem as NvSidebarnavitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarnavitem.js";
51
- import { NvSidebarnavsubitem as NvSidebarnavsubitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-sidebarnavsubitem.js";
52
42
  import { NvSplit as NvSplitElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-split.js";
53
43
  import { NvStack as NvStackElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
54
44
  import { NvTable as NvTableElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-table.js";
@@ -225,8 +215,6 @@ export type NvNotificationEvents = {
225
215
  onHiddenChanged: EventName<CustomEvent<boolean>>;
226
216
  };
227
217
  export declare const NvNotification: StencilReactComponent<NvNotificationElement, NvNotificationEvents>;
228
- export type NvNotificationBulletEvents = NonNullable<unknown>;
229
- export declare const NvNotificationBullet: StencilReactComponent<NvNotificationBulletElement, NvNotificationBulletEvents>;
230
218
  export type NvNotificationcontainerEvents = NonNullable<unknown>;
231
219
  export declare const NvNotificationcontainer: StencilReactComponent<NvNotificationcontainerElement, NvNotificationcontainerEvents>;
232
220
  export type NvPopoverEvents = {
@@ -235,26 +223,6 @@ export type NvPopoverEvents = {
235
223
  export declare const NvPopover: StencilReactComponent<NvPopoverElement, NvPopoverEvents>;
236
224
  export type NvRowEvents = NonNullable<unknown>;
237
225
  export declare const NvRow: StencilReactComponent<NvRowElement, NvRowEvents>;
238
- export type NvSidebarEvents = {
239
- onOpenChanged: EventName<CustomEvent<boolean>>;
240
- };
241
- export declare const NvSidebar: StencilReactComponent<NvSidebarElement, NvSidebarEvents>;
242
- export type NvSidebarcontentEvents = NonNullable<unknown>;
243
- export declare const NvSidebarcontent: StencilReactComponent<NvSidebarcontentElement, NvSidebarcontentEvents>;
244
- export type NvSidebardividerEvents = NonNullable<unknown>;
245
- export declare const NvSidebardivider: StencilReactComponent<NvSidebardividerElement, NvSidebardividerEvents>;
246
- export type NvSidebarfooterEvents = NonNullable<unknown>;
247
- export declare const NvSidebarfooter: StencilReactComponent<NvSidebarfooterElement, NvSidebarfooterEvents>;
248
- export type NvSidebargroupEvents = NonNullable<unknown>;
249
- export declare const NvSidebargroup: StencilReactComponent<NvSidebargroupElement, NvSidebargroupEvents>;
250
- export type NvSidebarheaderEvents = NonNullable<unknown>;
251
- export declare const NvSidebarheader: StencilReactComponent<NvSidebarheaderElement, NvSidebarheaderEvents>;
252
- export type NvSidebarlogoEvents = NonNullable<unknown>;
253
- export declare const NvSidebarlogo: StencilReactComponent<NvSidebarlogoElement, NvSidebarlogoEvents>;
254
- export type NvSidebarnavitemEvents = NonNullable<unknown>;
255
- export declare const NvSidebarnavitem: StencilReactComponent<NvSidebarnavitemElement, NvSidebarnavitemEvents>;
256
- export type NvSidebarnavsubitemEvents = NonNullable<unknown>;
257
- export declare const NvSidebarnavsubitem: StencilReactComponent<NvSidebarnavsubitemElement, NvSidebarnavsubitemEvents>;
258
226
  export type NvSplitEvents = {
259
227
  onSizesChanged: EventName<CustomEvent<number[]>>;
260
228
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nova-design-system/nova-react",
3
- "version": "3.21.1-beta.0",
3
+ "version": "3.22.0",
4
4
  "description": "Nova is a design system created by Elia Group to empower creators to efficiently build solutions that people love to use.",
5
5
  "author": "Elia Group",
6
6
  "homepage": "https://nova.eliagroup.io",
@@ -1,77 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('./index-CEKdYnmK.js');
4
- require('react');
5
- require('react-dom');
6
-
7
- const nvNotificationBulletCss = "nv-notification-bullet{display:inline-flex;align-items:center;position:relative;}nv-notification-bullet .nv-notification-bullet{display:inline-flex;align-items:center;justify-content:center;min-width:var(--sidebar-primary-notification-bullet-size);max-width:var(--sidebar-primary-notification-bullet-size);min-height:var(--sidebar-primary-notification-bullet-size);max-height:var(--sidebar-primary-notification-bullet-size);padding:0 var(--spacing-1);border-radius:var(--radius-rounded-full);font-size:var(--sidebar-primary-notification-bullet-font-size);font-weight:var(--sidebar-primary-notification-bullet-font-weight);white-space:nowrap;flex-shrink:0}nv-notification-bullet.nv-notification-bullet-brand .nv-notification-bullet.nv-notification-bullet-high{background-color:var(--color-brand-500);color:var(--color-feedback-error-high-contrast-title)}nv-notification-bullet.nv-notification-bullet-brand .nv-notification-bullet.nv-notification-bullet-low{background-color:var(--color-brand-50);color:var(--color-brand-600);border:1px solid var(--color-brand-600)}nv-notification-bullet.nv-notification-bullet-neutral .nv-notification-bullet.nv-notification-bullet-high{background-color:var(--color-interaction-container-neutral-background);color:var(--color-interaction-container-neutral-text)}nv-notification-bullet.nv-notification-bullet-neutral .nv-notification-bullet.nv-notification-bullet-low{background-color:var(--color-interaction-container-neutral-background);color:var(--color-interaction-container-neutral-text)}nv-notification-bullet.nv-notification-bullet-with-cross-border::before{content:\"\";position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:calc(var(--sidebar-primary-notification-bullet-size) * 1.5);height:calc(var(--sidebar-primary-notification-bullet-size) * 1.5);border-radius:var(--radius-rounded-full);background-color:var(--nv-component-background, var(--nv-sidebarnavitem-background, var(--color-interaction-container-neutral-background)));z-index:-1;pointer-events:none}nv-sidebar[collapsed] nv-notification-bullet.nv-notification-bullet-with-cross-border::before{width:calc(var(--sidebar-primary-notification-bullet-size-reduced) * 1.5);height:calc(var(--sidebar-primary-notification-bullet-size-reduced) * 1.5)}nv-notification-bullet .nv-notification-bullet.nv-notification-bullet-with-border{}nv-notification-bullet .nv-notification-bullet.nv-notification-bullet-reduced,nv-sidebar[collapsed] nv-notification-bullet .nv-notification-bullet{min-width:var(--sidebar-primary-notification-bullet-size-reduced);max-width:var(--sidebar-primary-notification-bullet-size-reduced);min-height:var(--sidebar-primary-notification-bullet-size-reduced);max-height:var(--sidebar-primary-notification-bullet-size-reduced);padding:0;font-size:0;}nv-notification-bullet .nv-notification-bullet.nv-notification-bullet-reduced.nv-notification-bullet-with-border,nv-sidebar[collapsed] nv-notification-bullet .nv-notification-bullet.nv-notification-bullet-with-border{}";
8
- const NvNotificationBulletStyle0 = nvNotificationBulletCss;
9
-
10
- const NvNotificationBullet = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- /**
14
- * Determines the size of the notification bullet.
15
- * - default: Normal size with text visible
16
- * - reduced: Smaller size, text hidden (just a dot)
17
- */
18
- this.size = 'default';
19
- /**
20
- * Allows to add a border to add contrast on background.
21
- */
22
- this.contrastingBorder = false;
23
- }
24
- //#endregion PROPERTIES
25
- /****************************************************************************/
26
- //#region METHODS
27
- getIntention() {
28
- if (this.intention) {
29
- return this.intention;
30
- }
31
- // Inherit from parent nv-sidebar
32
- const sidebar = this.el.closest('nv-sidebar');
33
- if (sidebar) {
34
- const sidebarIntention = sidebar.getAttribute('notification-intention');
35
- if (sidebarIntention === 'neutral' || sidebarIntention === 'brand') {
36
- return sidebarIntention;
37
- }
38
- }
39
- return 'brand'; // Default fallback
40
- }
41
- getEmphasis() {
42
- if (this.emphasis) {
43
- return this.emphasis;
44
- }
45
- // Inherit from parent nv-sidebar
46
- const sidebar = this.el.closest('nv-sidebar');
47
- if (sidebar) {
48
- const sidebarEmphasis = sidebar.getAttribute('notification-emphasis');
49
- if (sidebarEmphasis === 'high' || sidebarEmphasis === 'low') {
50
- return sidebarEmphasis;
51
- }
52
- }
53
- return 'high'; // Default fallback
54
- }
55
- //#region RENDER
56
- render() {
57
- var _a;
58
- const displayCount = (_a = this.count) !== null && _a !== void 0 ? _a : 0;
59
- const displayText = displayCount > 99 ? '99+' : String(displayCount);
60
- if (displayCount <= 0) {
61
- return null;
62
- }
63
- const sizeClass = this.size === 'reduced' ? 'nv-notification-bullet-reduced' : '';
64
- const intention = this.getIntention();
65
- const emphasis = this.getEmphasis();
66
- const intentionClass = `nv-notification-bullet-${intention}`;
67
- const emphasisClass = `nv-notification-bullet-${emphasis}`;
68
- const borderClass = this.contrastingBorder
69
- ? 'nv-notification-bullet-with-border'
70
- : '';
71
- return (index.h(index.Host, { class: `${intentionClass} ${borderClass ? 'nv-notification-bullet-with-cross-border' : ''}` }, index.h("span", { class: `nv-notification-bullet ${emphasisClass} ${sizeClass} ${borderClass}`, "aria-label": `${displayCount} notifications` }, displayText)));
72
- }
73
- get el() { return index.getElement(this); }
74
- };
75
- NvNotificationBullet.style = NvNotificationBulletStyle0;
76
-
77
- exports.nv_notification_bullet = NvNotificationBullet;