@indico-data/design-system 2.47.3 → 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 (54) hide show
  1. package/lib/components/index.d.ts +1 -0
  2. package/lib/components/pagination/Pagination.d.ts +2 -0
  3. package/lib/components/pagination/Pagination.stories.d.ts +6 -0
  4. package/lib/components/pagination/__tests__/Pagination.test.d.ts +1 -0
  5. package/lib/components/pagination/index.d.ts +1 -0
  6. package/lib/components/pagination/types.d.ts +6 -0
  7. package/lib/components/table/Table.stories.d.ts +1 -0
  8. package/lib/components/table/__tests__/Table.test.d.ts +1 -0
  9. package/lib/components/table/components/HorizontalStickyHeader.d.ts +10 -0
  10. package/lib/components/table/components/TablePagination.d.ts +9 -0
  11. package/lib/components/table/components/__tests__/HorizontalStickyHeader.test.d.ts +1 -0
  12. package/lib/components/table/components/__tests__/TablePagination.test.d.ts +1 -0
  13. package/lib/components/table/components/helpers.d.ts +6 -0
  14. package/lib/components/table/hooks/usePinnedColumnsManager.d.ts +8 -0
  15. package/lib/components/table/sampleData.d.ts +6 -0
  16. package/lib/components/table/types.d.ts +16 -5
  17. package/lib/components/table/utils/processColumns.d.ts +2 -0
  18. package/lib/index.css +78 -17
  19. package/lib/index.d.ts +16 -5
  20. package/lib/index.esm.css +78 -17
  21. package/lib/index.esm.js +305 -14
  22. package/lib/index.esm.js.map +1 -1
  23. package/lib/index.js +304 -13
  24. package/lib/index.js.map +1 -1
  25. package/lib/utils/getPreviousHeadersWidth.d.ts +1 -0
  26. package/package.json +1 -1
  27. package/src/components/index.ts +1 -0
  28. package/src/components/pagination/Pagination.mdx +31 -0
  29. package/src/components/pagination/Pagination.stories.tsx +80 -0
  30. package/src/components/pagination/Pagination.tsx +117 -0
  31. package/src/components/pagination/__tests__/Pagination.test.tsx +91 -0
  32. package/src/components/pagination/index.ts +1 -0
  33. package/src/components/pagination/styles/Pagination.scss +22 -0
  34. package/src/components/pagination/types.ts +6 -0
  35. package/src/components/table/Table.mdx +136 -0
  36. package/src/components/table/Table.stories.tsx +91 -30
  37. package/src/components/table/Table.tsx +25 -2
  38. package/src/components/table/__tests__/Table.test.tsx +10 -0
  39. package/src/components/table/components/HorizontalStickyHeader.tsx +57 -0
  40. package/src/components/table/components/TablePagination.tsx +44 -0
  41. package/src/components/table/components/__tests__/HorizontalStickyHeader.test.tsx +104 -0
  42. package/src/components/table/components/__tests__/TablePagination.test.tsx +17 -0
  43. package/src/components/table/components/helpers.ts +90 -0
  44. package/src/components/table/hooks/usePinnedColumnsManager.ts +146 -0
  45. package/src/components/table/sampleData.tsx +436 -0
  46. package/src/components/table/styles/Table.scss +72 -24
  47. package/src/components/table/styles/_variables.scss +3 -0
  48. package/src/components/table/types.ts +19 -7
  49. package/src/components/table/utils/processColumns.tsx +35 -0
  50. package/src/setup/setupIcons.ts +4 -0
  51. package/src/setup/setupTests.ts +8 -0
  52. package/src/styles/index.scss +1 -0
  53. package/src/utils/getPreviousHeadersWidth.ts +12 -0
  54. package/src/components/table/sampleData.ts +0 -171
@@ -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
+ };
@@ -1,171 +0,0 @@
1
- export interface SampleDataRow {
2
- name: string;
3
- class: string;
4
- age: number;
5
- weapon: string;
6
- backstory: string;
7
- favoriteMeal: string;
8
- }
9
-
10
- export const sampleData: SampleDataRow[] = [
11
- {
12
- name: 'Thalion',
13
- class: 'Ranger',
14
- age: 120,
15
- weapon: 'Longbow',
16
- backstory: 'Raised by wolves in the deep forests.',
17
- favoriteMeal: 'Venison stew',
18
- },
19
- {
20
- name: 'Brom',
21
- class: 'Fighter',
22
- age: 35,
23
- weapon: 'Greatsword',
24
- backstory: 'A former soldier seeking redemption.',
25
- favoriteMeal: 'Roasted boar',
26
- },
27
- {
28
- name: 'Elysia',
29
- class: 'Cleric',
30
- age: 60,
31
- weapon: 'Mace',
32
- backstory: 'A devoted follower of the goddess of life.',
33
- favoriteMeal: 'Vegetable soup',
34
- },
35
- {
36
- name: 'Faelar',
37
- class: 'Rogue',
38
- age: 80,
39
- weapon: 'Dagger',
40
- backstory: 'Grew up on the streets of a bustling city.',
41
- favoriteMeal: 'Bread and cheese',
42
- },
43
- {
44
- name: 'Maelis',
45
- class: 'Wizard',
46
- age: 200,
47
- weapon: 'Staff',
48
- backstory: 'A scholar obsessed with ancient magic.',
49
- favoriteMeal: 'Mushroom stew',
50
- },
51
- {
52
- name: 'Grimm',
53
- class: 'Barbarian',
54
- age: 40,
55
- weapon: 'Battleaxe',
56
- backstory: 'Hails from a tribe in the frozen north.',
57
- favoriteMeal: 'Grilled salmon',
58
- },
59
- {
60
- name: 'Seraphina',
61
- class: 'Bard',
62
- age: 25,
63
- weapon: 'Rapier',
64
- backstory: 'A wandering minstrel with a mysterious past.',
65
- favoriteMeal: 'Apple pie',
66
- },
67
- {
68
- name: 'Kael',
69
- class: 'Druid',
70
- age: 75,
71
- weapon: 'Scimitar',
72
- backstory: 'A guardian of the natural world.',
73
- favoriteMeal: 'Berry tart',
74
- },
75
- {
76
- name: 'Aria',
77
- class: 'Paladin',
78
- age: 30,
79
- weapon: 'Longsword',
80
- backstory: 'A knight on a divine mission.',
81
- favoriteMeal: 'Roasted chicken',
82
- },
83
- {
84
- name: 'Xan',
85
- class: 'Warlock',
86
- age: 45,
87
- weapon: 'Pact Blade',
88
- backstory: 'Made a pact with a powerful entity for magic.',
89
- favoriteMeal: 'Stuffed peppers',
90
- },
91
- {
92
- name: 'Lyra',
93
- class: 'Sorcerer',
94
- age: 28,
95
- weapon: 'Dagger',
96
- backstory: 'Born with innate magical abilities.',
97
- favoriteMeal: 'Pancakes with syrup',
98
- },
99
- {
100
- name: 'Thorn',
101
- class: 'Monk',
102
- age: 50,
103
- weapon: 'Quarterstaff',
104
- backstory: 'A hermit who seeks enlightenment.',
105
- favoriteMeal: 'Rice and vegetables',
106
- },
107
- {
108
- name: 'Cassia',
109
- class: 'Ranger',
110
- age: 32,
111
- weapon: 'Shortbow',
112
- backstory: 'A hunter with a keen eye.',
113
- favoriteMeal: 'Roasted pheasant',
114
- },
115
- {
116
- name: 'Darius',
117
- class: 'Fighter',
118
- age: 36,
119
- weapon: 'Longsword',
120
- backstory: 'A mercenary with a heart of gold.',
121
- favoriteMeal: 'Beef stew',
122
- },
123
- {
124
- name: 'Iris',
125
- class: 'Cleric',
126
- age: 60,
127
- weapon: 'Warhammer',
128
- backstory: 'A healer devoted to the god of light.',
129
- favoriteMeal: 'Fresh bread and soup',
130
- },
131
- {
132
- name: 'Fenrir',
133
- class: 'Barbarian',
134
- age: 42,
135
- weapon: 'Greataxe',
136
- backstory: 'A warrior from a distant land.',
137
- favoriteMeal: 'Grilled steak',
138
- },
139
- {
140
- name: 'Luna',
141
- class: 'Druid',
142
- age: 70,
143
- weapon: 'Sickle',
144
- backstory: 'A protector of the natural world.',
145
- favoriteMeal: 'Fruit salad',
146
- },
147
- {
148
- name: 'Orion',
149
- class: 'Paladin',
150
- age: 33,
151
- weapon: 'Halberd',
152
- backstory: 'A knight on a holy quest.',
153
- favoriteMeal: 'Roasted lamb',
154
- },
155
- {
156
- name: 'Astra',
157
- class: 'Bard',
158
- age: 26,
159
- weapon: 'Lute',
160
- backstory: 'A musician with a magical voice.',
161
- favoriteMeal: 'Honey cake',
162
- },
163
- {
164
- name: 'Zephyr',
165
- class: 'Rogue',
166
- age: 29,
167
- weapon: 'Shortsword',
168
- backstory: 'A thief with a quick hand.',
169
- favoriteMeal: 'Fish and chips',
170
- },
171
- ];