@indico-data/design-system 2.48.0 → 2.49.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 (31) hide show
  1. package/lib/components/table/Table.stories.d.ts +1 -0
  2. package/lib/components/table/components/HorizontalStickyHeader.d.ts +10 -0
  3. package/lib/components/table/components/__tests__/HorizontalStickyHeader.test.d.ts +1 -0
  4. package/lib/components/table/components/helpers.d.ts +6 -0
  5. package/lib/components/table/hooks/usePinnedColumnsManager.d.ts +8 -0
  6. package/lib/components/table/sampleData.d.ts +4 -0
  7. package/lib/components/table/types.d.ts +11 -1
  8. package/lib/components/table/utils/processColumns.d.ts +2 -0
  9. package/lib/index.css +28 -9
  10. package/lib/index.d.ts +12 -1
  11. package/lib/index.esm.css +28 -9
  12. package/lib/index.esm.js +238 -2
  13. package/lib/index.esm.js.map +1 -1
  14. package/lib/index.js +238 -2
  15. package/lib/index.js.map +1 -1
  16. package/lib/utils/getPreviousHeadersWidth.d.ts +1 -0
  17. package/package.json +1 -1
  18. package/src/components/table/Table.mdx +134 -0
  19. package/src/components/table/Table.stories.tsx +71 -2
  20. package/src/components/table/Table.tsx +16 -1
  21. package/src/components/table/components/HorizontalStickyHeader.tsx +57 -0
  22. package/src/components/table/components/__tests__/HorizontalStickyHeader.test.tsx +104 -0
  23. package/src/components/table/components/helpers.ts +90 -0
  24. package/src/components/table/hooks/usePinnedColumnsManager.ts +146 -0
  25. package/src/components/table/{sampleData.ts → sampleData.tsx} +156 -1
  26. package/src/components/table/styles/Table.scss +32 -15
  27. package/src/components/table/styles/_variables.scss +2 -0
  28. package/src/components/table/types.ts +13 -1
  29. package/src/components/table/utils/processColumns.tsx +35 -0
  30. package/src/setup/setupTests.ts +8 -0
  31. package/src/utils/getPreviousHeadersWidth.ts +12 -0
@@ -3,3 +3,11 @@ import { configure } from '@testing-library/react';
3
3
  import './setupIcons';
4
4
 
5
5
  configure({ testIdAttribute: 'data-testid' });
6
+
7
+ class ResizeObserverMock {
8
+ observe() {}
9
+ unobserve() {}
10
+ disconnect() {}
11
+ }
12
+
13
+ global.ResizeObserver = ResizeObserverMock;
@@ -0,0 +1,12 @@
1
+ export const getPreviousHeadersWidth = (position: number): number => {
2
+ // Get headers with positions less than current position
3
+ const previousHeaders = Array.from({ length: position }, (_, i) =>
4
+ document.querySelector(`[data-column-id="sticky-column-${i}"]`),
5
+ ).filter((header): header is HTMLElement => header !== null);
6
+
7
+ // Sum up widths of previous headers
8
+ return previousHeaders.reduce((acc, header) => {
9
+ const width = header.offsetWidth;
10
+ return acc + width;
11
+ }, 0);
12
+ };