@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
@@ -20,3 +20,4 @@ export { SingleInputDatePicker } from './forms/date/inputDatePicker';
20
20
  export { InputDateRangePicker } from './forms/date/inputDateRangePicker';
21
21
  export { Modal } from './modal';
22
22
  export { Badge } from './badge';
23
+ export { Pagination } from './pagination';
@@ -0,0 +1,2 @@
1
+ import { PaginationProps } from './types';
2
+ export declare const Pagination: ({ totalPages, currentPage, onChange, className, ...rest }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Pagination } from './Pagination';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Pagination>;
6
+ export declare const Default: Story;
@@ -0,0 +1 @@
1
+ export { Pagination } from './Pagination';
@@ -0,0 +1,6 @@
1
+ export interface PaginationProps {
2
+ totalPages: number;
3
+ currentPage?: number;
4
+ className?: string;
5
+ onChange?: (value: number) => void;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ interface TablePaginationProps {
2
+ rowsPerPage: number;
3
+ rowCount: number;
4
+ onChangePage: (page: number, perPage: number) => void;
5
+ currentPage: number;
6
+ totalEntriesText?: string;
7
+ }
8
+ export declare const TablePagination: ({ rowsPerPage, rowCount, onChangePage, currentPage, totalEntriesText, }: TablePaginationProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -1,3 +1,4 @@
1
+ import { TableColumn } from './types';
1
2
  export interface SampleDataRow {
2
3
  name: string;
3
4
  class: string;
@@ -7,3 +8,4 @@ export interface SampleDataRow {
7
8
  favoriteMeal: string;
8
9
  }
9
10
  export declare const sampleData: SampleDataRow[];
11
+ export declare const columns: TableColumn<SampleDataRow>[];
@@ -1,11 +1,12 @@
1
- import { TableProps as RDTTableProps, Direction as RDTDirection, Alignment as RDTAlignment, TableColumn as RDTTableColumn } from 'react-data-table-component';
1
+ import { Direction as RDTDirection, Alignment as RDTAlignment, TableColumn as RDTTableColumn, IDataTableProps } from 'react-data-table-component';
2
2
  export type Direction = `${RDTDirection}`;
3
3
  export type Alignment = `${RDTAlignment}`;
4
4
  export type TableColumn<T> = RDTTableColumn<T>;
5
- export type TableProps<T> = Omit<RDTTableProps<T>, 'disabled' | 'progressPending' | 'direction' | 'subHeaderAlign'> & {
5
+ export interface TableProps<T> extends Omit<IDataTableProps<T>, 'paginationComponent' | 'direction' | 'subHeaderAlign'> {
6
6
  isDisabled?: boolean;
7
7
  isLoading?: boolean;
8
8
  direction?: Direction;
9
- subHeaderAlign?: Alignment;
9
+ subHeaderAlign?: 'left' | 'right' | 'center';
10
10
  isFullHeight?: boolean;
11
- };
11
+ totalEntriesText?: string;
12
+ }
package/lib/index.css CHANGED
@@ -169,12 +169,14 @@
169
169
  --pf-red-color-100: #fae9e9;
170
170
  --pf-red-color-200: #f4d7d8;
171
171
  --pf-red-color-300: #ebb6b8;
172
- --pf-red-color-400: #df8d91;
172
+ --pf-red-color-350: #f39bb9;
173
+ --pf-red-color-400: #ef76a0;
173
174
  --pf-red-color-500: #ce6068;
174
175
  --pf-red-color-600: #b94553;
175
176
  --pf-red-color-700: #9b3544;
176
177
  --pf-red-color-800: #822f3e;
177
- --pf-red-color-900: #702b39;
178
+ --pf-red-color-850: #702b39;
179
+ --pf-red-color-900: #510e2b;
178
180
  --pf-red-color-950: #3e131b;
179
181
  --pf-orange-color: #f46325;
180
182
  --pf-orange-color-50: #fff5ed;
@@ -223,7 +225,7 @@
223
225
  --pf-purple-color-700: #7a4eb3;
224
226
  --pf-purple-color-800: #664196;
225
227
  --pf-purple-color-900: #55377b;
226
- --pf-purple-color-950: #352253;
228
+ --pf-purple-color-950: #291a40;
227
229
  --pf-white-color: #ffffff;
228
230
  --pf-white-color-1: rgba(255, 255, 255, 0.01);
229
231
  --pf-white-color-3: rgba(255, 255, 255, 0.03);
@@ -245,6 +247,7 @@
245
247
  --pf-neutral-color: var(--pf-gray-color-100);
246
248
  --pf-info-color: var(--pf-secondary-color-200);
247
249
  --pf-brand-color: var(--pf-secondary-color-550);
250
+ --pf-pending-color: var(--pf-red-color-900);
248
251
  --pf-link-color: var(--pf-gray-color-300);
249
252
  --pf-link-hover-color: var(--pf-gray-color-100);
250
253
  }
@@ -800,6 +803,7 @@ a:hover,
800
803
  --pf-table-highlighted-color: var(--pf-primary-color);
801
804
  --pf-table-highlighted-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(0, 0, 0, 0.3);
802
805
  --pf-table-font-size: var(--pf-font-size-body2);
806
+ --pf-table-pagination-background-color: var(--pf-primary-color-700);
803
807
  }
804
808
 
805
809
  .table-loading {
@@ -814,7 +818,7 @@ a:hover,
814
818
 
815
819
  .table {
816
820
  border-radius: var(--pf-rounded);
817
- border: var(--pf-border-sm) solid var(--pf-table-border-color);
821
+ background-color: var(--pf-table-background-color);
818
822
  /* Striped: alternating background */
819
823
  /* Checked: Precedence over striped */
820
824
  /* Highlighted: Precedence over checked */
@@ -830,16 +834,33 @@ a:hover,
830
834
  color: var(--pf-table-font-color);
831
835
  border-radius: var(--pf-rounded) !important;
832
836
  border: var(--pf-border-sm) solid var(--pf-table-border-color);
837
+ height: 100%;
838
+ scrollbar-width: thin;
839
+ scrollbar-color: var(--pf-table-border-color) var(--pf-table-background-color);
840
+ }
841
+ .table-body::-webkit-scrollbar {
842
+ width: var(--pf-size-2);
843
+ height: var(--pf-size-2);
844
+ cursor: pointer;
845
+ }
846
+ .table-body::-webkit-scrollbar-track {
847
+ background: var(--pf-table-background-color);
848
+ border-radius: var(--pf-rounded);
849
+ cursor: pointer;
850
+ }
851
+ .table-body::-webkit-scrollbar-thumb {
852
+ background: var(--pf-table-border-color);
853
+ border-radius: var(--pf-rounded);
854
+ cursor: pointer;
855
+ }
856
+ .table-body::-webkit-scrollbar-thumb:hover {
857
+ background: var(--pf-primary-color);
833
858
  }
834
859
  .table > *:nth-child(3) {
835
860
  margin-top: auto;
836
861
  background-color: transparent;
837
862
  border: none;
838
863
  }
839
- .table > *:nth-child(3) .rdt_Pagination {
840
- background-color: transparent;
841
- border: none;
842
- }
843
864
  .table .rdt_Table,
844
865
  .table .rdt_TableRow,
845
866
  .table .rdt_TableCol,
@@ -850,8 +871,7 @@ a:hover,
850
871
  .table .rdt_TableHead,
851
872
  .table .rdt_TableHeadRow,
852
873
  .table .rdt_TableBody,
853
- .table .rdt_ExpanderRow,
854
- .table .rdt_Pagination {
874
+ .table .rdt_ExpanderRow {
855
875
  background-color: var(--pf-table-background-color);
856
876
  color: var(--pf-table-font-color);
857
877
  }
@@ -863,7 +883,8 @@ a:hover,
863
883
  }
864
884
  .table .rdt_TableHeader {
865
885
  border-radius: var(--pf-rounded) 0;
866
- border-bottom: var(--pf-border-sm) solid var(--pf-table-border-color);
886
+ border: var(--pf-border-sm) solid var(--pf-table-border-color);
887
+ border-bottom: none;
867
888
  }
868
889
  .table .rdt_TableHeadRow > :first-child,
869
890
  .table .rdt_TableRow > :first-child {
@@ -905,6 +926,13 @@ a:hover,
905
926
  background-color: var(--pf-table-highlighted-color) !important;
906
927
  }
907
928
 
929
+ .table__pagination {
930
+ padding-bottom: var(--pf-padding-4);
931
+ padding-top: var(--pf-padding-4);
932
+ background-color: var(--pf-table-pagination-background-color);
933
+ padding-left: var(--pf-padding-4);
934
+ }
935
+
908
936
  .input {
909
937
  padding: 10px;
910
938
  }
@@ -1898,6 +1926,23 @@ form {
1898
1926
  text-align: right;
1899
1927
  }
1900
1928
 
1929
+ .pagination .form-control {
1930
+ margin-bottom: 0;
1931
+ }
1932
+
1933
+ .pagination__current-page {
1934
+ max-width: 50px;
1935
+ }
1936
+
1937
+ .pagination__current-page-input {
1938
+ text-align: center;
1939
+ font-weight: var(--pf-font-weight-heavy);
1940
+ }
1941
+
1942
+ .pagination .pagination__current-page-input.has-error {
1943
+ border-color: var(--pf-error-color);
1944
+ }
1945
+
1901
1946
  :root [data-theme=light] {
1902
1947
  --pf-pill-primary-background-color: var(--pf-primary-color);
1903
1948
  --pf-pill-primary-font-color: var(--pf-white-color);
@@ -1945,6 +1990,9 @@ form {
1945
1990
  --pf-pill-neutral-background-color: var(--pf-gray-color-900);
1946
1991
  --pf-pill-neutral-font-color: var(--pf-gray-color-100);
1947
1992
  --pf-pill-neutral-border-color: var(--pf-gray-color-700);
1993
+ --pf-pill-pending-background-color: var(--pf-pending-color);
1994
+ --pf-pill-pending-font-color: var(--pf-white-color);
1995
+ --pf-pill-pending-border-color: var(--pf-red-color-350);
1948
1996
  }
1949
1997
 
1950
1998
  .pill {
@@ -2004,6 +2052,11 @@ form {
2004
2052
  color: var(--pf-pill-secondary-font-color);
2005
2053
  border-color: var(--pf-pill-secondary-border-color);
2006
2054
  }
2055
+ .pill--pending {
2056
+ background-color: var(--pf-pill-pending-background-color);
2057
+ color: var(--pf-pill-pending-font-color);
2058
+ border-color: var(--pf-pill-pending-border-color);
2059
+ }
2007
2060
 
2008
2061
  :root [data-theme=light] {
2009
2062
  --sheets-background-color: var(--pf-gray-color-100);
package/lib/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export * from '@floating-ui/react-dom';
4
4
  import React$1, { CSSProperties, MouseEventHandler, ReactElement } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { ContainerProps, RowProps, ColProps } from 'react-grid-system';
7
- import { TableProps as TableProps$1, Direction as Direction$1, Alignment as Alignment$1 } from 'react-data-table-component';
7
+ import { IDataTableProps, Direction as Direction$1 } from 'react-data-table-component';
8
8
  import { Props as Props$7 } from 'react-select';
9
9
  import { DateRange, OnSelectHandler, Mode, CustomComponents, Matcher, Formatters, MonthChangeEventHandler, DayEventHandler } from 'react-day-picker';
10
10
 
@@ -184,14 +184,14 @@ type SelectOption = {
184
184
  };
185
185
 
186
186
  type Direction = `${Direction$1}`;
187
- type Alignment = `${Alignment$1}`;
188
- type TableProps<T> = Omit<TableProps$1<T>, 'disabled' | 'progressPending' | 'direction' | 'subHeaderAlign'> & {
187
+ interface TableProps<T> extends Omit<IDataTableProps<T>, 'paginationComponent' | 'direction' | 'subHeaderAlign'> {
189
188
  isDisabled?: boolean;
190
189
  isLoading?: boolean;
191
190
  direction?: Direction;
192
- subHeaderAlign?: Alignment;
191
+ subHeaderAlign?: 'left' | 'right' | 'center';
193
192
  isFullHeight?: boolean;
194
- };
193
+ totalEntriesText?: string;
194
+ }
195
195
 
196
196
  type PillSize = 'sm' | 'md' | 'lg';
197
197
  type PillColor = SemanticColor | 'neutral';
@@ -209,7 +209,7 @@ type PermafrostComponent = {
209
209
  'data-testid'?: string;
210
210
  };
211
211
 
212
- type SemanticColor = 'primary' | 'secondary' | 'warning' | 'error' | 'success' | 'info';
212
+ type SemanticColor = 'primary' | 'secondary' | 'warning' | 'error' | 'success' | 'info' | 'pending';
213
213
 
214
214
  type Props$6 = PermafrostComponent & {
215
215
  ariaLabel?: string;
package/lib/index.esm.css CHANGED
@@ -169,12 +169,14 @@
169
169
  --pf-red-color-100: #fae9e9;
170
170
  --pf-red-color-200: #f4d7d8;
171
171
  --pf-red-color-300: #ebb6b8;
172
- --pf-red-color-400: #df8d91;
172
+ --pf-red-color-350: #f39bb9;
173
+ --pf-red-color-400: #ef76a0;
173
174
  --pf-red-color-500: #ce6068;
174
175
  --pf-red-color-600: #b94553;
175
176
  --pf-red-color-700: #9b3544;
176
177
  --pf-red-color-800: #822f3e;
177
- --pf-red-color-900: #702b39;
178
+ --pf-red-color-850: #702b39;
179
+ --pf-red-color-900: #510e2b;
178
180
  --pf-red-color-950: #3e131b;
179
181
  --pf-orange-color: #f46325;
180
182
  --pf-orange-color-50: #fff5ed;
@@ -223,7 +225,7 @@
223
225
  --pf-purple-color-700: #7a4eb3;
224
226
  --pf-purple-color-800: #664196;
225
227
  --pf-purple-color-900: #55377b;
226
- --pf-purple-color-950: #352253;
228
+ --pf-purple-color-950: #291a40;
227
229
  --pf-white-color: #ffffff;
228
230
  --pf-white-color-1: rgba(255, 255, 255, 0.01);
229
231
  --pf-white-color-3: rgba(255, 255, 255, 0.03);
@@ -245,6 +247,7 @@
245
247
  --pf-neutral-color: var(--pf-gray-color-100);
246
248
  --pf-info-color: var(--pf-secondary-color-200);
247
249
  --pf-brand-color: var(--pf-secondary-color-550);
250
+ --pf-pending-color: var(--pf-red-color-900);
248
251
  --pf-link-color: var(--pf-gray-color-300);
249
252
  --pf-link-hover-color: var(--pf-gray-color-100);
250
253
  }
@@ -800,6 +803,7 @@ a:hover,
800
803
  --pf-table-highlighted-color: var(--pf-primary-color);
801
804
  --pf-table-highlighted-box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 8px 16px rgba(0, 0, 0, 0.3);
802
805
  --pf-table-font-size: var(--pf-font-size-body2);
806
+ --pf-table-pagination-background-color: var(--pf-primary-color-700);
803
807
  }
804
808
 
805
809
  .table-loading {
@@ -814,7 +818,7 @@ a:hover,
814
818
 
815
819
  .table {
816
820
  border-radius: var(--pf-rounded);
817
- border: var(--pf-border-sm) solid var(--pf-table-border-color);
821
+ background-color: var(--pf-table-background-color);
818
822
  /* Striped: alternating background */
819
823
  /* Checked: Precedence over striped */
820
824
  /* Highlighted: Precedence over checked */
@@ -830,16 +834,33 @@ a:hover,
830
834
  color: var(--pf-table-font-color);
831
835
  border-radius: var(--pf-rounded) !important;
832
836
  border: var(--pf-border-sm) solid var(--pf-table-border-color);
837
+ height: 100%;
838
+ scrollbar-width: thin;
839
+ scrollbar-color: var(--pf-table-border-color) var(--pf-table-background-color);
840
+ }
841
+ .table-body::-webkit-scrollbar {
842
+ width: var(--pf-size-2);
843
+ height: var(--pf-size-2);
844
+ cursor: pointer;
845
+ }
846
+ .table-body::-webkit-scrollbar-track {
847
+ background: var(--pf-table-background-color);
848
+ border-radius: var(--pf-rounded);
849
+ cursor: pointer;
850
+ }
851
+ .table-body::-webkit-scrollbar-thumb {
852
+ background: var(--pf-table-border-color);
853
+ border-radius: var(--pf-rounded);
854
+ cursor: pointer;
855
+ }
856
+ .table-body::-webkit-scrollbar-thumb:hover {
857
+ background: var(--pf-primary-color);
833
858
  }
834
859
  .table > *:nth-child(3) {
835
860
  margin-top: auto;
836
861
  background-color: transparent;
837
862
  border: none;
838
863
  }
839
- .table > *:nth-child(3) .rdt_Pagination {
840
- background-color: transparent;
841
- border: none;
842
- }
843
864
  .table .rdt_Table,
844
865
  .table .rdt_TableRow,
845
866
  .table .rdt_TableCol,
@@ -850,8 +871,7 @@ a:hover,
850
871
  .table .rdt_TableHead,
851
872
  .table .rdt_TableHeadRow,
852
873
  .table .rdt_TableBody,
853
- .table .rdt_ExpanderRow,
854
- .table .rdt_Pagination {
874
+ .table .rdt_ExpanderRow {
855
875
  background-color: var(--pf-table-background-color);
856
876
  color: var(--pf-table-font-color);
857
877
  }
@@ -863,7 +883,8 @@ a:hover,
863
883
  }
864
884
  .table .rdt_TableHeader {
865
885
  border-radius: var(--pf-rounded) 0;
866
- border-bottom: var(--pf-border-sm) solid var(--pf-table-border-color);
886
+ border: var(--pf-border-sm) solid var(--pf-table-border-color);
887
+ border-bottom: none;
867
888
  }
868
889
  .table .rdt_TableHeadRow > :first-child,
869
890
  .table .rdt_TableRow > :first-child {
@@ -905,6 +926,13 @@ a:hover,
905
926
  background-color: var(--pf-table-highlighted-color) !important;
906
927
  }
907
928
 
929
+ .table__pagination {
930
+ padding-bottom: var(--pf-padding-4);
931
+ padding-top: var(--pf-padding-4);
932
+ background-color: var(--pf-table-pagination-background-color);
933
+ padding-left: var(--pf-padding-4);
934
+ }
935
+
908
936
  .input {
909
937
  padding: 10px;
910
938
  }
@@ -1898,6 +1926,23 @@ form {
1898
1926
  text-align: right;
1899
1927
  }
1900
1928
 
1929
+ .pagination .form-control {
1930
+ margin-bottom: 0;
1931
+ }
1932
+
1933
+ .pagination__current-page {
1934
+ max-width: 50px;
1935
+ }
1936
+
1937
+ .pagination__current-page-input {
1938
+ text-align: center;
1939
+ font-weight: var(--pf-font-weight-heavy);
1940
+ }
1941
+
1942
+ .pagination .pagination__current-page-input.has-error {
1943
+ border-color: var(--pf-error-color);
1944
+ }
1945
+
1901
1946
  :root [data-theme=light] {
1902
1947
  --pf-pill-primary-background-color: var(--pf-primary-color);
1903
1948
  --pf-pill-primary-font-color: var(--pf-white-color);
@@ -1945,6 +1990,9 @@ form {
1945
1990
  --pf-pill-neutral-background-color: var(--pf-gray-color-900);
1946
1991
  --pf-pill-neutral-font-color: var(--pf-gray-color-100);
1947
1992
  --pf-pill-neutral-border-color: var(--pf-gray-color-700);
1993
+ --pf-pill-pending-background-color: var(--pf-pending-color);
1994
+ --pf-pill-pending-font-color: var(--pf-white-color);
1995
+ --pf-pill-pending-border-color: var(--pf-red-color-350);
1948
1996
  }
1949
1997
 
1950
1998
  .pill {
@@ -2004,6 +2052,11 @@ form {
2004
2052
  color: var(--pf-pill-secondary-font-color);
2005
2053
  border-color: var(--pf-pill-secondary-border-color);
2006
2054
  }
2055
+ .pill--pending {
2056
+ background-color: var(--pf-pill-pending-background-color);
2057
+ color: var(--pf-pill-pending-font-color);
2058
+ border-color: var(--pf-pill-pending-border-color);
2059
+ }
2007
2060
 
2008
2061
  :root [data-theme=light] {
2009
2062
  --sheets-background-color: var(--pf-gray-color-100);
package/lib/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { library, findIconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import { faArrowDown, faArrowRight, faArrowLeft, faCalculator, faCheck, faCircleNotch, faMountainSun, faRocket, faWind, faEyeSlash, faEye, faCaretUp, faCaretDown, faTag, faPencilAlt, faSearch, faCog, faFileDownload, faQuestionCircle, faCopy, faXmark } from '@fortawesome/free-solid-svg-icons';
2
+ import { faArrowDown, faArrowRight, faArrowLeft, faCalculator, faCheck, faCircleNotch, faMountainSun, faRocket, faWind, faEyeSlash, faEye, faCaretUp, faCaretDown, faTag, faPencilAlt, faSearch, faCog, faFileDownload, faQuestionCircle, faCopy, faXmark, faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import React__default, { useLayoutEffect, useEffect, createContext, useState, useRef, useContext, useCallback, useImperativeHandle, forwardRef, useMemo, isValidElement, useId as useId$1 } from 'react';
@@ -205,7 +205,7 @@ const registerFontAwesomeIcons = (...icons) => {
205
205
  library.add(...icons);
206
206
  };
207
207
  // Register the icons used directly in design system components
208
- registerFontAwesomeIcons(faArrowDown, faArrowRight, faArrowLeft, faCalculator, faCheck, faCircleNotch, faMountainSun, faRocket, faWind, faEyeSlash, faEye, faCaretUp, faCaretDown, faTag, faPencilAlt, faSearch, faCog, faFileDownload, faQuestionCircle, faCopy, faXmark,
208
+ registerFontAwesomeIcons(faArrowDown, faArrowRight, faArrowLeft, faCalculator, faCheck, faCircleNotch, faMountainSun, faRocket, faWind, faEyeSlash, faEye, faCaretUp, faCaretDown, faTag, faPencilAlt, faSearch, faCog, faFileDownload, faQuestionCircle, faCopy, faXmark, faChevronLeft, faChevronRight,
209
209
  // backwards compat, don't require registration of custom indicons
210
210
  // might want to consider doing so in the future
211
211
  ...indiconDefinitions);
@@ -7168,18 +7168,6 @@ const LoadingComponent = () => {
7168
7168
  return jsx("div", { className: "table-loading", children: "Loading..." });
7169
7169
  };
7170
7170
 
7171
- const Table = (props) => {
7172
- const { responsive = true, direction = 'auto', keyField = 'id', striped = false, noDataComponent = 'built-in', isDisabled, isLoading, isFullHeight = false, subHeaderAlign = 'left', className } = props, rest = __rest(props, ["responsive", "direction", "keyField", "striped", "noDataComponent", "isDisabled", "isLoading", "isFullHeight", "subHeaderAlign", "className"]);
7173
- const combinedClassName = classNames(className, {
7174
- 'table--striped': striped,
7175
- 'table-body': true,
7176
- });
7177
- const tableWrapperClassName = classNames('table', {
7178
- 'table--full-height': isFullHeight,
7179
- });
7180
- return (jsx("div", { className: tableWrapperClassName, children: jsx(Xe, Object.assign({ responsive: responsive, direction: direction, subHeaderAlign: subHeaderAlign, keyField: keyField, striped: striped, className: combinedClassName, disabled: isDisabled, noDataComponent: noDataComponent, progressPending: isLoading, progressComponent: jsx(LoadingComponent, {}) }, rest)) }));
7181
- };
7182
-
7183
7171
  const Label = ({ label, name, isRequired }) => {
7184
7172
  return (jsx("div", { "data-testid": `${name}-testId`, className: `form-label`, children: jsxs("label", { htmlFor: `${name}`, children: [label, isRequired ? jsx("span", { className: "text-error", children: " *" }) : ''] }) }));
7185
7173
  };
@@ -7213,6 +7201,73 @@ const Input = React__default.forwardRef((_a, ref) => {
7213
7201
  });
7214
7202
  const LabeledInput = withLabel(Input);
7215
7203
 
7204
+ const Pagination = (_a) => {
7205
+ var { totalPages, currentPage = 1, onChange, className } = _a, rest = __rest(_a, ["totalPages", "currentPage", "onChange", "className"]);
7206
+ const [inputValue, setInputValue] = useState(currentPage.toString());
7207
+ const totalPagesText = `of ${totalPages}`;
7208
+ const classes = classNames('pagination', className);
7209
+ useEffect(() => {
7210
+ setInputValue(currentPage.toString());
7211
+ }, [currentPage]);
7212
+ const handleNextPage = () => {
7213
+ if (currentPage < totalPages) {
7214
+ onChange === null || onChange === void 0 ? void 0 : onChange(currentPage + 1);
7215
+ }
7216
+ };
7217
+ const handlePreviousPage = () => {
7218
+ if (currentPage > 1) {
7219
+ onChange === null || onChange === void 0 ? void 0 : onChange(currentPage - 1);
7220
+ }
7221
+ };
7222
+ const validateAndUpdatePage = (value) => {
7223
+ // If empty or invalid, reset to current page
7224
+ if (!value) {
7225
+ setInputValue(currentPage.toString());
7226
+ return;
7227
+ }
7228
+ const page = Number(value);
7229
+ if (!isNaN(page) && page > 0 && page <= totalPages) {
7230
+ onChange === null || onChange === void 0 ? void 0 : onChange(page);
7231
+ }
7232
+ else {
7233
+ setInputValue(currentPage.toString());
7234
+ }
7235
+ };
7236
+ const isNextButtonDisabled = currentPage === totalPages;
7237
+ const isPreviousButtonDisabled = currentPage === 1;
7238
+ const hasError = Number(inputValue) > totalPages || Number(inputValue) < 1;
7239
+ return (jsx("div", Object.assign({ className: classes }, rest, { children: jsx(Container, { children: jsxs(Row, { gutterWidth: 12, align: "center", children: [jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__previous", children: jsx(Button$1, { "data-testid": "pagination-previous-button", ariaLabel: "Previous Page", variant: "link", onClick: handlePreviousPage, iconLeft: "chevron-left", isDisabled: isPreviousButtonDisabled }) }) }), jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__current-page", children: jsx(LabeledInput, { "data-testid": "pagination-current-page-input", className: classNames('pagination__current-page-input', {
7240
+ 'has-error': hasError,
7241
+ }), value: inputValue, name: "currentPage", label: "Current Page", hasHiddenLabel: true, onKeyDown: (e) => {
7242
+ if (e.key === 'Enter') {
7243
+ validateAndUpdatePage(e.currentTarget.value);
7244
+ }
7245
+ }, onChange: (e) => {
7246
+ const value = e.currentTarget.value;
7247
+ // Allow empty value or numbers
7248
+ if (value === '' || /^\d*$/.test(value)) {
7249
+ setInputValue(value);
7250
+ }
7251
+ }, onBlur: (e) => validateAndUpdatePage(e.currentTarget.value) }) }) }), jsx(Col, { xs: "content", children: jsx("p", { className: "pagination__page-total", children: totalPagesText }) }), jsx(Col, { xs: "content", children: jsx("div", { className: "pagination__next", children: jsx(Button$1, { "data-testid": "pagination-next-button", ariaLabel: "Next Page", variant: "link", onClick: handleNextPage, iconLeft: "chevron-right", isDisabled: isNextButtonDisabled }) }) })] }) }) })));
7252
+ };
7253
+
7254
+ const TablePagination = ({ rowsPerPage, rowCount, onChangePage, currentPage, totalEntriesText, }) => {
7255
+ const totalPages = Math.ceil(rowCount / rowsPerPage);
7256
+ return (jsx("div", { className: "table__pagination", children: jsxs(Row, { align: "center", justify: "between", children: [jsx(Col, { xs: "content", children: totalEntriesText && (jsx("span", { "data-testid": "table-pagination-total-entries", className: "table__pagination-total-entries", children: totalEntriesText })) }), jsx(Col, { xs: "content", children: jsx(Pagination, { "data-testid": "table-pagination-component", totalPages: totalPages, currentPage: currentPage, onChange: (page) => onChangePage(page, rowsPerPage) }) })] }) }));
7257
+ };
7258
+
7259
+ const Table = (props) => {
7260
+ const { responsive = true, direction = 'auto', keyField = 'id', striped = false, noDataComponent = 'built-in', isDisabled, isLoading, isFullHeight = false, subHeaderAlign = 'left', className, paginationTotalRows, totalEntriesText } = props, rest = __rest(props, ["responsive", "direction", "keyField", "striped", "noDataComponent", "isDisabled", "isLoading", "isFullHeight", "subHeaderAlign", "className", "paginationTotalRows", "totalEntriesText"]);
7261
+ const combinedClassName = classNames(className, {
7262
+ 'table--striped': striped,
7263
+ 'table-body': true,
7264
+ });
7265
+ const tableWrapperClassName = classNames('table', {
7266
+ 'table--full-height': isFullHeight,
7267
+ });
7268
+ return (jsx("div", { className: tableWrapperClassName, "data-testid": "table", children: jsx(Xe, Object.assign({ responsive: responsive, direction: direction, subHeaderAlign: subHeaderAlign, keyField: keyField, striped: striped, className: combinedClassName, disabled: isDisabled, noDataComponent: noDataComponent, progressPending: isLoading, progressComponent: jsx(LoadingComponent, {}), pagination: true, paginationComponent: (props) => (jsx(TablePagination, Object.assign({}, props, { totalEntriesText: totalEntriesText }))), paginationTotalRows: paginationTotalRows }, rest)) }));
7269
+ };
7270
+
7216
7271
  const Radio = React__default.forwardRef((_a, ref) => {
7217
7272
  var { id, label, name, value, onChange, isDisabled } = _a, rest = __rest(_a, ["id", "label", "name", "value", "onChange", "isDisabled"]);
7218
7273
  return (jsx("div", { className: "form-control", children: jsxs("div", { className: "radio-wrapper", children: [jsx("input", Object.assign({ "data-testid": `form-radio-input-${name}`, className: "radio-input", type: "radio", id: id, name: name, value: value, disabled: isDisabled, ref: ref, onChange: onChange, tabIndex: 0, "aria-describedby": id, "aria-label": label }, rest)), jsx("label", { htmlFor: id, className: "radio-input-label", "data-testid": `label-radio-input-${name}`, children: label })] }) }));