@indico-data/design-system 2.47.2 → 2.48.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 (44) 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/__tests__/Table.test.d.ts +1 -0
  8. package/lib/components/table/components/TablePagination.d.ts +9 -0
  9. package/lib/components/table/components/__tests__/TablePagination.test.d.ts +1 -0
  10. package/lib/components/table/sampleData.d.ts +2 -0
  11. package/lib/components/table/types.d.ts +5 -4
  12. package/lib/index.css +64 -11
  13. package/lib/index.d.ts +6 -6
  14. package/lib/index.esm.css +64 -11
  15. package/lib/index.esm.js +69 -14
  16. package/lib/index.esm.js.map +1 -1
  17. package/lib/index.js +68 -13
  18. package/lib/index.js.map +1 -1
  19. package/lib/types.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/components/index.ts +1 -0
  22. package/src/components/pagination/Pagination.mdx +31 -0
  23. package/src/components/pagination/Pagination.stories.tsx +80 -0
  24. package/src/components/pagination/Pagination.tsx +117 -0
  25. package/src/components/pagination/__tests__/Pagination.test.tsx +91 -0
  26. package/src/components/pagination/index.ts +1 -0
  27. package/src/components/pagination/styles/Pagination.scss +22 -0
  28. package/src/components/pagination/types.ts +6 -0
  29. package/src/components/pill/Pill.stories.tsx +5 -0
  30. package/src/components/pill/styles/Pill.scss +9 -0
  31. package/src/components/table/Table.mdx +2 -0
  32. package/src/components/table/Table.stories.tsx +20 -28
  33. package/src/components/table/Table.tsx +9 -1
  34. package/src/components/table/__tests__/Table.test.tsx +10 -0
  35. package/src/components/table/components/TablePagination.tsx +44 -0
  36. package/src/components/table/components/__tests__/TablePagination.test.tsx +17 -0
  37. package/src/components/table/sampleData.ts +110 -0
  38. package/src/components/table/styles/Table.scss +40 -9
  39. package/src/components/table/styles/_variables.scss +1 -0
  40. package/src/components/table/types.ts +6 -6
  41. package/src/setup/setupIcons.ts +4 -0
  42. package/src/styles/index.scss +1 -0
  43. package/src/styles/variables/themes/dark.scss +6 -3
  44. package/src/types.ts +8 -1
@@ -1,3 +1,5 @@
1
+ import { TableColumn } from './types';
2
+
1
3
  export interface SampleDataRow {
2
4
  name: string;
3
5
  class: string;
@@ -168,4 +170,112 @@ export const sampleData: SampleDataRow[] = [
168
170
  backstory: 'A thief with a quick hand.',
169
171
  favoriteMeal: 'Fish and chips',
170
172
  },
173
+ {
174
+ name: 'Thalia',
175
+ class: 'Wizard',
176
+ age: 150,
177
+ weapon: 'Crystal Staff',
178
+ backstory: 'An archivist of forbidden knowledge.',
179
+ favoriteMeal: 'Spiced wine and cheese',
180
+ },
181
+ {
182
+ name: 'Ragnar',
183
+ class: 'Fighter',
184
+ age: 45,
185
+ weapon: 'War Hammer',
186
+ backstory: 'A dwarven smith turned adventurer.',
187
+ favoriteMeal: 'Mead and roasted mutton',
188
+ },
189
+ {
190
+ name: 'Sylvana',
191
+ class: 'Ranger',
192
+ age: 95,
193
+ weapon: 'Elven Bow',
194
+ backstory: 'Guardian of the enchanted forest.',
195
+ favoriteMeal: 'Elvish waybread',
196
+ },
197
+ {
198
+ name: 'Magnus',
199
+ class: 'Warlock',
200
+ age: 38,
201
+ weapon: 'Cursed Dagger',
202
+ backstory: 'Made a deal with a demon for revenge.',
203
+ favoriteMeal: 'Blood oranges',
204
+ },
205
+ {
206
+ name: 'Echo',
207
+ class: 'Bard',
208
+ age: 23,
209
+ weapon: 'Enchanted Violin',
210
+ backstory: 'Can mimic any sound perfectly.',
211
+ favoriteMeal: 'Sweet rolls',
212
+ },
213
+ {
214
+ name: 'Korg',
215
+ class: 'Barbarian',
216
+ age: 32,
217
+ weapon: 'Stone Maul',
218
+ backstory: 'Last survivor of a petrified tribe.',
219
+ favoriteMeal: 'Raw meat',
220
+ },
221
+ {
222
+ name: 'Celeste',
223
+ class: 'Sorcerer',
224
+ age: 19,
225
+ weapon: 'Starlight Wand',
226
+ backstory: 'Born during a celestial convergence.',
227
+ favoriteMeal: 'Moon cakes',
228
+ },
229
+ {
230
+ name: 'Raven',
231
+ class: 'Rogue',
232
+ age: 27,
233
+ weapon: 'Shadow Blade',
234
+ backstory: 'Professional assassin seeking redemption.',
235
+ favoriteMeal: 'Whatever their mark is having',
236
+ },
237
+ {
238
+ name: 'Terra',
239
+ class: 'Druid',
240
+ age: 156,
241
+ weapon: 'Living Wood Staff',
242
+ backstory: 'Speaks with ancient trees.',
243
+ favoriteMeal: 'Wild mushrooms',
244
+ },
245
+ {
246
+ name: 'Ash',
247
+ class: 'Monk',
248
+ age: 29,
249
+ weapon: 'Flame Fists',
250
+ backstory: 'Raised by phoenix monks in a volcano.',
251
+ favoriteMeal: 'Spicy noodles',
252
+ },
253
+ ];
254
+
255
+ export const columns: TableColumn<SampleDataRow>[] = [
256
+ {
257
+ name: 'Name',
258
+ selector: (row: SampleDataRow) => row.name,
259
+ },
260
+ {
261
+ name: 'Class',
262
+ selector: (row) => row.class,
263
+ },
264
+ {
265
+ name: 'Age',
266
+ selector: (row) => row.age,
267
+ sortable: true,
268
+ },
269
+ {
270
+ name: 'Weapon',
271
+ selector: (row) => row.weapon,
272
+ },
273
+ {
274
+ name: 'Backstory',
275
+ selector: (row) => row.backstory,
276
+ },
277
+ {
278
+ name: 'Favorite Meal',
279
+ selector: (row) => row.favoriteMeal,
280
+ },
171
281
  ];
@@ -12,7 +12,7 @@
12
12
 
13
13
  .table {
14
14
  border-radius: var(--pf-rounded);
15
- border: var(--pf-border-sm) solid var(--pf-table-border-color);
15
+ background-color: var(--pf-table-background-color);
16
16
 
17
17
  &--full-height {
18
18
  height: 100%;
@@ -26,17 +26,39 @@
26
26
  color: var(--pf-table-font-color);
27
27
  border-radius: var(--pf-rounded) !important;
28
28
  border: var(--pf-border-sm) solid var(--pf-table-border-color);
29
+ height: 100%;
30
+
31
+ // Webkit scrollbar styles
32
+ &::-webkit-scrollbar {
33
+ width: var(--pf-size-2);
34
+ height: var(--pf-size-2);
35
+ cursor: pointer;
36
+ }
37
+
38
+ &::-webkit-scrollbar-track {
39
+ background: var(--pf-table-background-color);
40
+ border-radius: var(--pf-rounded);
41
+ cursor: pointer;
42
+ }
43
+
44
+ &::-webkit-scrollbar-thumb {
45
+ background: var(--pf-table-border-color);
46
+ border-radius: var(--pf-rounded);
47
+ cursor: pointer;
48
+ &:hover {
49
+ background: var(--pf-primary-color);
50
+ }
51
+ }
52
+
53
+ // Firefox scrollbar styles
54
+ scrollbar-width: thin;
55
+ scrollbar-color: var(--pf-table-border-color) var(--pf-table-background-color);
29
56
  }
30
57
 
31
58
  & > *:nth-child(3) {
32
59
  margin-top: auto;
33
60
  background-color: transparent;
34
61
  border: none;
35
-
36
- .rdt_Pagination {
37
- background-color: transparent;
38
- border: none;
39
- }
40
62
  }
41
63
  .rdt_Table,
42
64
  .rdt_TableRow,
@@ -48,8 +70,7 @@
48
70
  .rdt_TableHead,
49
71
  .rdt_TableHeadRow,
50
72
  .rdt_TableBody,
51
- .rdt_ExpanderRow,
52
- .rdt_Pagination {
73
+ .rdt_ExpanderRow {
53
74
  background-color: var(--pf-table-background-color);
54
75
  color: var(--pf-table-font-color);
55
76
  }
@@ -68,7 +89,8 @@
68
89
 
69
90
  .rdt_TableHeader {
70
91
  border-radius: var(--pf-rounded) 0;
71
- border-bottom: var(--pf-border-sm) solid var(--pf-table-border-color);
92
+ border: var(--pf-border-sm) solid var(--pf-table-border-color);
93
+ border-bottom: none;
72
94
  }
73
95
 
74
96
  .rdt_TableHeadRow,
@@ -127,3 +149,12 @@
127
149
  }
128
150
  }
129
151
  }
152
+
153
+ .table__pagination {
154
+ padding-bottom: var(--pf-padding-4);
155
+ padding-top: var(--pf-padding-4);
156
+ background-color: var(--pf-table-pagination-background-color);
157
+ padding-left: var(
158
+ --pf-padding-4
159
+ ); // buttons have a visual illusion of having a gap, so we add padding to adjust the left side when the total results exist
160
+ }
@@ -27,4 +27,5 @@
27
27
  --pf-table-highlighted-color: var(--pf-primary-color);
28
28
  --pf-table-highlighted-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(0, 0, 0, 0.3);
29
29
  --pf-table-font-size: var(--pf-font-size-body2);
30
+ --pf-table-pagination-background-color: var(--pf-primary-color-700);
30
31
  }
@@ -3,19 +3,19 @@ import {
3
3
  Direction as RDTDirection,
4
4
  Alignment as RDTAlignment,
5
5
  TableColumn as RDTTableColumn,
6
+ IDataTableProps,
6
7
  } from 'react-data-table-component';
7
8
 
8
9
  export type Direction = `${RDTDirection}`;
9
10
  export type Alignment = `${RDTAlignment}`;
10
11
  export type TableColumn<T> = RDTTableColumn<T>;
11
12
 
12
- export type TableProps<T> = Omit<
13
- RDTTableProps<T>,
14
- 'disabled' | 'progressPending' | 'direction' | 'subHeaderAlign'
15
- > & {
13
+ export interface TableProps<T>
14
+ extends Omit<IDataTableProps<T>, 'paginationComponent' | 'direction' | 'subHeaderAlign'> {
16
15
  isDisabled?: boolean;
17
16
  isLoading?: boolean;
18
17
  direction?: Direction;
19
- subHeaderAlign?: Alignment;
18
+ subHeaderAlign?: 'left' | 'right' | 'center';
20
19
  isFullHeight?: boolean;
21
- };
20
+ totalEntriesText?: string;
21
+ }
@@ -23,6 +23,8 @@ import {
23
23
  faQuestionCircle,
24
24
  faCopy,
25
25
  faXmark,
26
+ faChevronLeft,
27
+ faChevronRight,
26
28
  } from '@fortawesome/free-solid-svg-icons';
27
29
  import { indiconDefinitions } from '@/components/icons/indicons';
28
30
 
@@ -54,6 +56,8 @@ registerFontAwesomeIcons(
54
56
  faQuestionCircle,
55
57
  faCopy,
56
58
  faXmark,
59
+ faChevronLeft,
60
+ faChevronRight,
57
61
  // backwards compat, don't require registration of custom indicons
58
62
  // might want to consider doing so in the future
59
63
  ...indiconDefinitions,
@@ -23,6 +23,7 @@
23
23
  @import '../components/forms/date/datePicker/styles/DatePicker.scss';
24
24
  @import '../components/badge/styles/Badge.scss';
25
25
  @import '../components/modal/styles/Modal.scss';
26
+ @import '../components/pagination/styles/Pagination.scss';
26
27
 
27
28
  @import '../components/pill/styles/Pill.scss';
28
29
  @import 'sheets'; // Port to an sheets component when we build it
@@ -69,12 +69,14 @@
69
69
  --pf-red-color-100: #fae9e9;
70
70
  --pf-red-color-200: #f4d7d8;
71
71
  --pf-red-color-300: #ebb6b8;
72
- --pf-red-color-400: #df8d91;
72
+ --pf-red-color-350: #f39bb9;
73
+ --pf-red-color-400: #ef76a0;
73
74
  --pf-red-color-500: #ce6068;
74
75
  --pf-red-color-600: #b94553;
75
76
  --pf-red-color-700: #9b3544;
76
77
  --pf-red-color-800: #822f3e;
77
- --pf-red-color-900: #702b39;
78
+ --pf-red-color-850: #702b39;
79
+ --pf-red-color-900: #510e2b;
78
80
  --pf-red-color-950: #3e131b;
79
81
 
80
82
  //Orange color
@@ -135,7 +137,7 @@
135
137
  --pf-purple-color-700: #7a4eb3;
136
138
  --pf-purple-color-800: #664196;
137
139
  --pf-purple-color-900: #55377b;
138
- --pf-purple-color-950: #352253;
140
+ --pf-purple-color-950: #291a40;
139
141
 
140
142
  // White color
141
143
  --pf-white-color: #ffffff;
@@ -161,6 +163,7 @@
161
163
  --pf-neutral-color: var(--pf-gray-color-100);
162
164
  --pf-info-color: var(--pf-secondary-color-200);
163
165
  --pf-brand-color: var(--pf-secondary-color-550);
166
+ --pf-pending-color: var(--pf-red-color-900);
164
167
 
165
168
  --pf-link-color: var(--pf-gray-color-300);
166
169
  --pf-link-hover-color: var(--pf-gray-color-100);
package/src/types.ts CHANGED
@@ -7,7 +7,14 @@ export type PermafrostComponent = {
7
7
 
8
8
  import { IconSizes, IconName } from './components/icons/types';
9
9
  export type { IconSizes, IconName };
10
- export type SemanticColor = 'primary' | 'secondary' | 'warning' | 'error' | 'success' | 'info';
10
+ export type SemanticColor =
11
+ | 'primary'
12
+ | 'secondary'
13
+ | 'warning'
14
+ | 'error'
15
+ | 'success'
16
+ | 'info'
17
+ | 'pending';
11
18
  import { SelectOption } from './components/forms/select/types';
12
19
  export type { SelectOption };
13
20