qbs-react-grid 2.1.0 → 2.2.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 (57) hide show
  1. package/dist/css/qbs-react-grid.css +1 -1
  2. package/dist/css/qbs-react-grid.min.css +1 -1
  3. package/dist/css/qbs-react-grid.min.css.map +1 -1
  4. package/es/Pagination.d.ts +3 -0
  5. package/es/Pagination.js +8 -3
  6. package/es/index.d.ts +1 -1
  7. package/es/less/qbs-table.less +95 -4
  8. package/es/qbsTable/QbsTable.js +50 -33
  9. package/es/qbsTable/TableCardList.js +47 -31
  10. package/es/qbsTable/Toolbar.js +15 -11
  11. package/es/qbsTable/commontypes.d.ts +4 -1
  12. package/es/qbsTable/labels.d.ts +48 -0
  13. package/es/qbsTable/labels.js +34 -0
  14. package/es/qbsTable/utilities/CardComponent.d.ts +2 -0
  15. package/es/qbsTable/utilities/CardComponent.js +7 -3
  16. package/es/qbsTable/utilities/CardMenuDropdown.d.ts +2 -0
  17. package/es/qbsTable/utilities/CardMenuDropdown.js +5 -2
  18. package/es/qbsTable/utilities/ColumShowHide.d.ts +2 -0
  19. package/es/qbsTable/utilities/ColumShowHide.js +9 -6
  20. package/es/qbsTable/utilities/SearchInput.d.ts +1 -0
  21. package/es/qbsTable/utilities/SearchInput.js +3 -1
  22. package/es/qbsTable/utilities/tablecalc.d.ts +1 -1
  23. package/es/qbsTable/utilities/tablecalc.js +7 -2
  24. package/lib/Pagination.d.ts +3 -0
  25. package/lib/Pagination.js +8 -3
  26. package/lib/index.d.ts +1 -1
  27. package/lib/less/qbs-table.less +95 -4
  28. package/lib/qbsTable/QbsTable.js +50 -33
  29. package/lib/qbsTable/TableCardList.js +47 -31
  30. package/lib/qbsTable/Toolbar.js +15 -11
  31. package/lib/qbsTable/commontypes.d.ts +4 -1
  32. package/lib/qbsTable/labels.d.ts +48 -0
  33. package/lib/qbsTable/labels.js +42 -0
  34. package/lib/qbsTable/utilities/CardComponent.d.ts +2 -0
  35. package/lib/qbsTable/utilities/CardComponent.js +7 -3
  36. package/lib/qbsTable/utilities/CardMenuDropdown.d.ts +2 -0
  37. package/lib/qbsTable/utilities/CardMenuDropdown.js +5 -2
  38. package/lib/qbsTable/utilities/ColumShowHide.d.ts +2 -0
  39. package/lib/qbsTable/utilities/ColumShowHide.js +9 -6
  40. package/lib/qbsTable/utilities/SearchInput.d.ts +1 -0
  41. package/lib/qbsTable/utilities/SearchInput.js +3 -1
  42. package/lib/qbsTable/utilities/tablecalc.d.ts +1 -1
  43. package/lib/qbsTable/utilities/tablecalc.js +7 -2
  44. package/package.json +1 -1
  45. package/src/Pagination.tsx +10 -3
  46. package/src/index.ts +1 -1
  47. package/src/less/qbs-table.less +95 -4
  48. package/src/qbsTable/QbsTable.tsx +33 -8
  49. package/src/qbsTable/TableCardList.tsx +31 -7
  50. package/src/qbsTable/Toolbar.tsx +17 -10
  51. package/src/qbsTable/commontypes.ts +6 -0
  52. package/src/qbsTable/labels.ts +58 -0
  53. package/src/qbsTable/utilities/CardComponent.tsx +7 -2
  54. package/src/qbsTable/utilities/CardMenuDropdown.tsx +10 -2
  55. package/src/qbsTable/utilities/ColumShowHide.tsx +10 -6
  56. package/src/qbsTable/utilities/SearchInput.tsx +3 -1
  57. package/src/qbsTable/utilities/tablecalc.ts +8 -2
@@ -1,6 +1,7 @@
1
1
  import React, { FC, useEffect, useState } from 'react';
2
2
 
3
3
  import CustomSelect from './customSelect';
4
+ import { mergeLabels, type QbsTableLabels } from './qbsTable/labels';
4
5
  import { getRowDisplayRange } from './qbsTable/utilities/tablecalc';
5
6
 
6
7
  // Import the custom select component
@@ -15,6 +16,8 @@ type PageProps = {
15
16
  onRowsPerPage?: (row: number, page: number) => void;
16
17
  onPagination?: (row: number, page: number) => void;
17
18
  };
19
+ labels?: QbsTableLabels;
20
+ dataTheme?: string;
18
21
  };
19
22
 
20
23
  const PageIndex = ({ currentPage, handleFirst, pageCount }) => {
@@ -52,7 +55,8 @@ const PageIndex = ({ currentPage, handleFirst, pageCount }) => {
52
55
  return <>{renderPageNumbers()}</>;
53
56
  };
54
57
 
55
- const Pagination: FC<PageProps> = ({ paginationProps }) => {
58
+ const Pagination: FC<PageProps> = ({ paginationProps, labels: labelsProp, dataTheme }) => {
59
+ const labels = mergeLabels(labelsProp);
56
60
  const {
57
61
  dropOptions = [10, 20, 50, 100, 200],
58
62
  currentPage = 1,
@@ -96,9 +100,12 @@ const Pagination: FC<PageProps> = ({ paginationProps }) => {
96
100
  return (
97
101
  <div
98
102
  className="qbs-table-custom-pagination"
103
+ data-theme={dataTheme}
99
104
  style={{ display: 'flex', justifyContent: 'space-between' }}
100
105
  >
101
- <div className="rows-count">{getRowDisplayRange(total, rowsPerPageState, currentPage)}</div>
106
+ <div className="rows-count">
107
+ {getRowDisplayRange(total, rowsPerPageState, currentPage, labels.showingRange)}
108
+ </div>
102
109
  <div className="qbs-table-pagination-right-block">
103
110
  <button
104
111
  className="qbs-table-icon-container"
@@ -194,7 +201,7 @@ const Pagination: FC<PageProps> = ({ paginationProps }) => {
194
201
  </button>
195
202
  </div>
196
203
  <div className="qbs-table-pagination-flexBox">
197
- <span className="qbs-table-pagination-text">Items per page</span>
204
+ <span className="qbs-table-pagination-text">{labels.itemsPerPage}</span>
198
205
  <CustomSelect
199
206
  options={dropData}
200
207
  selectedValue={rowsPerPageState}
package/src/index.ts CHANGED
@@ -11,7 +11,7 @@ export type { ColumnProps } from './Column';
11
11
  export type { CellProps } from './Cell';
12
12
  export type { HeaderCellProps } from './HeaderCell';
13
13
  export type { ColumnGroupProps } from './ColumnGroup';
14
- export type { QbsTableProps } from './qbsTable/commontypes';
14
+ export type { QbsTableProps, QbsTableLabels } from './qbsTable/commontypes';
15
15
  export type {
16
16
  StandardProps,
17
17
  SortType,
@@ -104,12 +104,103 @@
104
104
  }
105
105
  }
106
106
  .qbs-table[data-theme='dark'] {
107
- background-color: #333333;
108
- color: #ffffff;
107
+ background-color: #1f1f1f;
108
+ color: #f5f5f5;
109
+
110
+ .qbs-table-border-wrap {
111
+ border-color: #3d3d3d;
112
+ background: #262626;
113
+ }
114
+
115
+ .qbs-table-toolbar-container,
116
+ .qbs-table-toolbar,
117
+ .qbs-table-toolbar-sub-container,
118
+ .sub-qbs-table-toolbar {
119
+ color: #f5f5f5;
120
+ }
121
+
122
+ .qbs-table-search-container {
123
+ .input {
124
+ border-color: #4a4a4a;
125
+ background: #2d2d2d;
126
+ color: #f5f5f5;
127
+
128
+ &:hover,
129
+ &:focus {
130
+ border-color: #6b6b6b;
131
+ background: #2d2d2d;
132
+ }
133
+ }
134
+
135
+ .search-button,
136
+ .close-button {
137
+ color: #d1d1d1;
138
+ background-color: transparent;
139
+ }
140
+ }
141
+
142
+ .qbs-table-column-popup,
143
+ .qbs-table-popup-container {
144
+ background: #2d2d2d;
145
+ color: #f5f5f5;
146
+ border-color: #4a4a4a;
147
+ }
148
+
149
+ .qbs-table-popup-label,
150
+ .qbs-table-popup-value,
151
+ .qbs-table-reset-link {
152
+ color: #f5f5f5;
153
+ }
154
+
155
+ .qbs-table-custom-pagination,
156
+ .qbs-table-pagination-text,
157
+ .rows-count {
158
+ color: #f5f5f5;
159
+ }
160
+
161
+ .qbs-table-icon-container svg path {
162
+ stroke: #e5e5e5;
163
+ }
164
+
165
+ .custom-select-trigger,
166
+ .custom-select-options {
167
+ background: #2d2d2d;
168
+ color: #f5f5f5;
169
+ border-color: #4a4a4a;
170
+ }
171
+
172
+ .qbs-card-container {
173
+ border-color: #4a4a4a;
174
+ background: #262626;
175
+ color: #f5f5f5;
176
+ }
177
+
178
+ .nodata-title {
179
+ color: #f5f5f5;
180
+ }
181
+
182
+ .tooltiptext {
183
+ background-color: #3d3d3d;
184
+ color: #fff;
185
+ }
186
+ }
187
+
188
+ .qbs-table-custom-pagination[data-theme='dark'] {
189
+ color: #f5f5f5;
190
+
191
+ .rows-count,
192
+ .qbs-table-pagination-text {
193
+ color: #f5f5f5;
194
+ }
195
+
196
+ .qbs-table-icon-container svg path {
197
+ stroke: #e5e5e5;
198
+ }
109
199
  }
200
+
110
201
  .rs-table-cell-content[data-theme='dark'] {
111
- background-color: #333333;
112
- color: #ffffff;
202
+ background-color: #262626;
203
+ color: #f5f5f5;
113
204
  }
114
205
  /* Dropdown container */
115
206
  .qbs-table-menu-dropdown {
@@ -8,6 +8,7 @@ import Pagination from '../Pagination';
8
8
  import Table from '../Table';
9
9
  import useResponsiveStore from '../utils/useResponsiveStore';
10
10
  import { QbsColumnProps, QbsTableProps } from './commontypes';
11
+ import { mergeLabels } from './labels';
11
12
  import {
12
13
  ActionCell,
13
14
  CheckCell,
@@ -106,12 +107,17 @@ const QbsTable: React.FC<QbsTableProps> = ({
106
107
  dropType = 'horizondal',
107
108
  rowHeight,
108
109
  isFullScreen,
109
- showHeader = true
110
+ showHeader = true,
111
+ labels: labelsProp
110
112
  }) => {
113
+ const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
111
114
  const [loading, setLoading] = useState(false);
112
115
  const [columns, setColumns] = useState(propColumn);
113
116
  const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
114
- const dataTheme = useMemo(() => localStorage.getItem('theme') ?? theme, [theme]);
117
+ const dataTheme = useMemo(
118
+ () => theme ?? (typeof localStorage !== 'undefined' ? localStorage.getItem('theme') : null) ?? 'light',
119
+ [theme]
120
+ );
115
121
  const [isOpen, setIsOpen] = useState(false);
116
122
  const prevColumns = useRef<any | null>(null);
117
123
  const [tableViewToggle, setTableViewToggle] = useState(tableView);
@@ -273,11 +279,25 @@ const QbsTable: React.FC<QbsTableProps> = ({
273
279
  fullWidthView: fullWidthView,
274
280
  setTableFullView: setTableFullView,
275
281
  setRowViewToggle: setRowViewToggle,
276
- isFullScreen: isFullScreen
282
+ isFullScreen: isFullScreen,
283
+ labels
277
284
  };
278
- const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
279
285
 
280
286
  useEffect(() => {
287
+ if (!dataTheme || typeof document === 'undefined') return;
288
+
289
+ document.body.setAttribute('data-theme', dataTheme === 'dark' ? 'dark' : 'light');
290
+ document.documentElement.dataset.theme = dataTheme;
291
+ }, [dataTheme]);
292
+
293
+ const themeToggle = useMemo(
294
+ () => (typeof document !== 'undefined' ? document.getElementById('themeToggle') : null),
295
+ []
296
+ ) as HTMLInputElement | null;
297
+
298
+ useEffect(() => {
299
+ if (theme || typeof document === 'undefined') return;
300
+
281
301
  const handleThemeToggle = () => {
282
302
  if (themeToggle?.checked) {
283
303
  document.body.setAttribute('data-theme', 'dark');
@@ -302,7 +322,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
302
322
  themeToggle?.removeEventListener('change', handleThemeToggle);
303
323
  document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
304
324
  };
305
- }, [themeToggle]);
325
+ }, [theme, themeToggle]);
306
326
 
307
327
  const handleExpanded = useCallback(
308
328
  (rowData: any) => {
@@ -638,7 +658,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
638
658
  renderEmpty ? (
639
659
  renderEmpty(info)
640
660
  ) : (
641
- <NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
661
+ <NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
642
662
  )
643
663
  }
644
664
  columns={columns}
@@ -760,6 +780,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
760
780
  setIsOpen={setIsOpen}
761
781
  handleResetColumns={handleResetColumns}
762
782
  handleColumnToggle={handleColumnToggle}
783
+ labels={labels}
763
784
  />
764
785
  </HeaderCell>
765
786
  <Cell />
@@ -787,6 +808,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
787
808
  setIsOpen={setIsOpen}
788
809
  handleResetColumns={handleResetColumns}
789
810
  handleColumnToggle={handleColumnToggle}
811
+ labels={labels}
790
812
  />
791
813
  )}
792
814
  </HeaderCell>
@@ -819,7 +841,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
819
841
  >
820
842
  {(data?.length === 0 || !data) && !isLoading && (
821
843
  <div className="flex flex-col gap-2 p-2 mt-6 card-empty-container">
822
- <NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
844
+ <NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
823
845
  </div>
824
846
  )}
825
847
  {isLoading ? (
@@ -846,6 +868,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
846
868
  columns={columns}
847
869
  tableBodyRef={tableBodyRef}
848
870
  actionProps={actionProps}
871
+ labels={labels}
849
872
  />
850
873
  )}
851
874
  </div>
@@ -854,7 +877,9 @@ const QbsTable: React.FC<QbsTableProps> = ({
854
877
  </div>
855
878
  )}
856
879
  <div>
857
- {pagination && data?.length > 0 && <Pagination paginationProps={paginationProps} />}
880
+ {pagination && data?.length > 0 && (
881
+ <Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
882
+ )}
858
883
  </div>
859
884
  </div>
860
885
  </div>
@@ -7,6 +7,7 @@ import HeaderCell from '../HeaderCell';
7
7
  import Pagination from '../Pagination';
8
8
  import Table from '../Table';
9
9
  import { QbsColumnProps, QbsTableProps } from './commontypes';
10
+ import { mergeLabels } from './labels';
10
11
  import {
11
12
  ActionCell,
12
13
  CheckCell,
@@ -82,12 +83,17 @@ const QbsTable: React.FC<QbsTableProps> = ({
82
83
  autoHeight,
83
84
  emptySubTitle,
84
85
  emptyTitle,
85
- dropType = 'horizontal'
86
+ dropType = 'horizontal',
87
+ labels: labelsProp
86
88
  }) => {
89
+ const labels = useMemo(() => mergeLabels(labelsProp), [labelsProp]);
87
90
  const [loading, setLoading] = useState(false);
88
91
  const [columns, setColumns] = useState(propColumn);
89
92
  const [checkedKeys, setCheckedKeys] = useState<(number | string)[]>([]);
90
- const dataTheme = useMemo(() => localStorage.getItem('theme') ?? theme, [theme]);
93
+ const dataTheme = useMemo(
94
+ () => theme ?? (typeof localStorage !== 'undefined' ? localStorage.getItem('theme') : null) ?? 'light',
95
+ [theme]
96
+ );
91
97
  const [isOpen, setIsOpen] = useState(false);
92
98
  const prevColumns = useRef<any | null>(null);
93
99
  const tableBodyRef = useRef<HTMLDivElement>(null);
@@ -228,11 +234,25 @@ const QbsTable: React.FC<QbsTableProps> = ({
228
234
  onSelect: handleClear,
229
235
  handleColumnToggle: handleColumnToggle,
230
236
  dataLength: data?.length,
231
- searchPlaceholder: searchPlaceholder
237
+ searchPlaceholder: searchPlaceholder,
238
+ labels
232
239
  };
233
- const themeToggle = useMemo(() => document.getElementById('themeToggle') as HTMLInputElement, []);
234
240
 
235
241
  useEffect(() => {
242
+ if (!dataTheme || typeof document === 'undefined') return;
243
+
244
+ document.body.setAttribute('data-theme', dataTheme === 'dark' ? 'dark' : 'light');
245
+ document.documentElement.dataset.theme = dataTheme;
246
+ }, [dataTheme]);
247
+
248
+ const themeToggle = useMemo(
249
+ () => (typeof document !== 'undefined' ? document.getElementById('themeToggle') : null),
250
+ []
251
+ ) as HTMLInputElement | null;
252
+
253
+ useEffect(() => {
254
+ if (theme || typeof document === 'undefined') return;
255
+
236
256
  const handleThemeToggle = () => {
237
257
  if (themeToggle?.checked) {
238
258
  document.body.setAttribute('data-theme', 'dark');
@@ -257,7 +277,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
257
277
  themeToggle?.removeEventListener('change', handleThemeToggle);
258
278
  document.removeEventListener('DOMContentLoaded', handleDOMContentLoaded);
259
279
  };
260
- }, [themeToggle]);
280
+ }, [theme, themeToggle]);
261
281
 
262
282
  const handleExpanded = useCallback(
263
283
  (rowData: any) => {
@@ -463,7 +483,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
463
483
  renderEmpty ? (
464
484
  renderEmpty(info)
465
485
  ) : (
466
- <NoData title={emptyTitle ?? 'No Data Found'} subtitle={emptySubTitle} />
486
+ <NoData title={emptyTitle ?? labels.noDataFound} subtitle={emptySubTitle} />
467
487
  )
468
488
  }
469
489
  columns={columns}
@@ -581,6 +601,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
581
601
  setIsOpen={setIsOpen}
582
602
  handleResetColumns={handleResetColumns}
583
603
  handleColumnToggle={handleColumnToggle}
604
+ labels={labels}
584
605
  />
585
606
  </HeaderCell>
586
607
  <Cell />
@@ -606,6 +627,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
606
627
  setIsOpen={setIsOpen}
607
628
  handleResetColumns={handleResetColumns}
608
629
  handleColumnToggle={handleColumnToggle}
630
+ labels={labels}
609
631
  />
610
632
  )}
611
633
  </HeaderCell>
@@ -622,7 +644,9 @@ const QbsTable: React.FC<QbsTableProps> = ({
622
644
  </Table>
623
645
 
624
646
  <div>
625
- {pagination && data?.length > 0 && <Pagination paginationProps={paginationProps} />}
647
+ {pagination && data?.length > 0 && (
648
+ <Pagination paginationProps={paginationProps} labels={labels} dataTheme={dataTheme} />
649
+ )}
626
650
  </div>
627
651
  </div>
628
652
  </div>
@@ -5,6 +5,7 @@ import { QbsTableToolbarProps } from './commontypes';
5
5
  import debounce from './utilities/debounce';
6
6
  import { CardView, ContentView, DefaultView, ExpandIcon, TableView } from './utilities/icons';
7
7
  import SearchInput from './utilities/SearchInput';
8
+ import { formatSelectedItems, mergeLabels } from './labels';
8
9
  import { getRowDisplayRange } from './utilities/tablecalc';
9
10
  import TooltipComponent from './utilities/ToolTip';
10
11
 
@@ -33,8 +34,10 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
33
34
  fullWidthView = false,
34
35
  setTableFullView,
35
36
  setRowViewToggle,
36
- isFullScreen = false
37
+ isFullScreen = false,
38
+ labels: labelsProp
37
39
  }) => {
40
+ const labels = mergeLabels(labelsProp);
38
41
  const debouncedOnSearch = useCallback(debounce(onSearch ?? (() => {}), 1000), [onSearch]);
39
42
  const [searchParam, setSearchParam] = useState<string | undefined>(searchValue);
40
43
  const toolbarRef = useRef<HTMLDivElement>(null);
@@ -79,7 +82,8 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
79
82
  <div className="qbs-table-primary-filter">
80
83
  {search && (
81
84
  <SearchInput
82
- placeholder={searchPlaceholder ?? 'Search'}
85
+ placeholder={searchPlaceholder ?? labels.search}
86
+ searchAriaLabel={labels.searchAriaLabel}
83
87
  handleChange={handleChange}
84
88
  handleSearch={handleSearch}
85
89
  searchValue={searchParam}
@@ -114,12 +118,12 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
114
118
  <div className="flex gap-2 qbs-row-switch-cntainer">
115
119
  {rowViewToggle && (
116
120
  <div className="flex gap-2 table_cell_style">
117
- <TooltipComponent tableBodyRef={toolbarRef} title={'Switch to Default View'}>
121
+ <TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToDefaultView}>
118
122
  <div onClick={() => setRowViewToggle?.(true)}>
119
123
  <DefaultView className={`${defaultRowView ? 'active' : ''}`} />
120
124
  </div>
121
125
  </TooltipComponent>
122
- <TooltipComponent tableBodyRef={toolbarRef} title={'Switch to Relaxed View'}>
126
+ <TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToRelaxedView}>
123
127
  <div onClick={() => setRowViewToggle?.(false)}>
124
128
  <ContentView className={`${!defaultRowView ? 'active' : ''}`} />
125
129
  </div>
@@ -128,7 +132,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
128
132
  )}
129
133
  {isFullScreen && (
130
134
  <div className=" table_full_width">
131
- <TooltipComponent tableBodyRef={toolbarRef} title={'Switch to Full Screen'}>
135
+ <TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToFullScreen}>
132
136
  <div onClick={() => setTableFullView?.(!fullWidthView)}>
133
137
  <ExpandIcon className={`${fullWidthView ? 'active' : ''}`} />
134
138
  </div>
@@ -140,7 +144,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
140
144
 
141
145
  {enableTableToggle && !isMobile && (
142
146
  <div className="qbs-table-top-icons flex gap-2">
143
- <TooltipComponent tableBodyRef={toolbarRef} title={'Switch to Table View'}>
147
+ <TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToTableView}>
144
148
  <div onClick={() => setTableViewToggle?.(true)}>
145
149
  <TableView className={`${tableViewToggle ? 'active' : ''}`} />
146
150
  </div>
@@ -149,7 +153,7 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
149
153
  <div className="border-r h-4 w-1"></div>
150
154
 
151
155
  <div onClick={() => setTableViewToggle?.(false)}>
152
- <TooltipComponent tableBodyRef={toolbarRef} title={'Switch to Card View'}>
156
+ <TooltipComponent tableBodyRef={toolbarRef} title={labels.switchToCardView}>
153
157
  <CardView className={`${!tableViewToggle ? 'active' : ''}`} />
154
158
  </TooltipComponent>
155
159
  </div>
@@ -175,10 +179,12 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
175
179
  >
176
180
  {checkedKeys && checkedKeys?.length > 0 ? (
177
181
  <div className="qbs-table-toolbar-sub-container-start">
178
- <div className="selected-row">{`Selected Items(${checkedKeys?.length}) `}</div>
182
+ <div className="selected-row">
183
+ {formatSelectedItems(labels.selectedItems, checkedKeys?.length ?? 0)}
184
+ </div>
179
185
  <div className="selected-row-action">
180
186
  <button className="btn" onClick={() => onSelect?.([])}>
181
- Clear
187
+ {labels.clear}
182
188
  </button>
183
189
  {selectedRowActions?.map((actions, index: number) => (
184
190
  <>
@@ -204,7 +210,8 @@ const ToolBar: React.FC<QbsTableToolbarProps> = ({
204
210
  {getRowDisplayRange(
205
211
  paginationProps.total ?? 0,
206
212
  paginationProps.rowsPerPage ?? 0,
207
- paginationProps.currentPage ?? 0
213
+ paginationProps.currentPage ?? 0,
214
+ labels.showingRange
208
215
  )}
209
216
  </div>
210
217
  )}
@@ -1,5 +1,9 @@
1
1
  import React, { ReactElement, ReactNode } from 'react';
2
2
 
3
+ import type { QbsTableLabels } from './labels';
4
+
5
+ export type { QbsTableLabels };
6
+
3
7
  interface Content {
4
8
  cell: ReactNode | string;
5
9
  toolTip?: string;
@@ -94,6 +98,7 @@ export interface QbsTableProps {
94
98
  advancefilter?: ReactElement | ReactNode;
95
99
  tableHeaderActions?: ReactElement | ReactNode;
96
100
  searchPlaceholder?: string;
101
+ labels?: QbsTableLabels;
97
102
  selectedRowActions?: {
98
103
  actionTitle?: string;
99
104
  action: (checked: (number | string)[]) => void;
@@ -171,6 +176,7 @@ export interface QbsTableToolbarProps {
171
176
  dataLength: number;
172
177
  headerHeight?: number;
173
178
  searchPlaceholder?: string;
179
+ labels?: QbsTableLabels;
174
180
  tableView?: boolean;
175
181
  enableTableToggle?: boolean;
176
182
  tableViewToggle?: boolean;
@@ -0,0 +1,58 @@
1
+ export interface QbsTableLabels {
2
+ search?: string;
3
+ searchAriaLabel?: string;
4
+ clear?: string;
5
+ selectedItems?: string;
6
+ switchToDefaultView?: string;
7
+ switchToRelaxedView?: string;
8
+ switchToFullScreen?: string;
9
+ switchToTableView?: string;
10
+ switchToCardView?: string;
11
+ noDataFound?: string;
12
+ showingRange?: (start: number, end: number, total: number) => string;
13
+ itemsPerPage?: string;
14
+ fixedColumns?: string;
15
+ visibleColumns?: string;
16
+ availableColumns?: string;
17
+ resetToDefault?: string;
18
+ save?: string;
19
+ viewMore?: string;
20
+ viewLess?: string;
21
+ actions?: string;
22
+ }
23
+
24
+ export const DEFAULT_QBS_TABLE_LABELS: Required<
25
+ Omit<QbsTableLabels, 'showingRange'>
26
+ > & {
27
+ showingRange: (start: number, end: number, total: number) => string;
28
+ } = {
29
+ search: 'Search',
30
+ searchAriaLabel: 'Search',
31
+ clear: 'Clear',
32
+ selectedItems: 'Selected Items',
33
+ switchToDefaultView: 'Switch to Default View',
34
+ switchToRelaxedView: 'Switch to Relaxed View',
35
+ switchToFullScreen: 'Switch to Full Screen',
36
+ switchToTableView: 'Switch to Table View',
37
+ switchToCardView: 'Switch to Card View',
38
+ noDataFound: 'No Data Found',
39
+ showingRange: (start, end, total) => `Showing ${start} to ${end} of ${total}`,
40
+ itemsPerPage: 'Items per page',
41
+ fixedColumns: 'FIXED COLUMNS',
42
+ visibleColumns: 'VISIBLE COLUMNS',
43
+ availableColumns: 'AVAILABLE COLUMNS',
44
+ resetToDefault: 'Reset to default',
45
+ save: 'Save',
46
+ viewMore: 'View More',
47
+ viewLess: 'View Less',
48
+ actions: 'Actions'
49
+ };
50
+
51
+ export const mergeLabels = (labels?: QbsTableLabels) => ({
52
+ ...DEFAULT_QBS_TABLE_LABELS,
53
+ ...labels,
54
+ showingRange: labels?.showingRange ?? DEFAULT_QBS_TABLE_LABELS.showingRange
55
+ });
56
+
57
+ export const formatSelectedItems = (selectedItemsLabel: string, count: number) =>
58
+ `${selectedItemsLabel}(${count}) `;
@@ -1,6 +1,7 @@
1
1
  import React, { useRef, useState } from 'react';
2
2
 
3
3
  import { QbsColumnProps } from '../commontypes';
4
+ import { mergeLabels, type QbsTableLabels } from '../labels';
4
5
  import CardMenuDropdown from './CardMenuDropdown';
5
6
  import { handleCellFormat } from './handleFormatCell';
6
7
  import { ArrowUpIcon } from './icons';
@@ -17,6 +18,7 @@ type Props = {
17
18
  handleMenuActions?: () => void;
18
19
  cardColumLimit?: number;
19
20
  childDetailHeading?: string;
21
+ labels?: QbsTableLabels;
20
22
  };
21
23
 
22
24
  const CardComponent: React.FC<Props> = ({
@@ -27,8 +29,10 @@ const CardComponent: React.FC<Props> = ({
27
29
  index,
28
30
  cardColumLimit = 5,
29
31
  handleMenuActions,
30
- childDetailHeading = ''
32
+ childDetailHeading = '',
33
+ labels: labelsProp
31
34
  }) => {
35
+ const labels = mergeLabels(labelsProp);
32
36
  const [viewMore, setViewMore] = useState(false);
33
37
  const initialDisplayCount = cardColumLimit;
34
38
 
@@ -102,13 +106,14 @@ const CardComponent: React.FC<Props> = ({
102
106
  iconName="more"
103
107
  rowIndex={index}
104
108
  handleMenuActions={handleMenuActions}
109
+ labels={labels}
105
110
  />
106
111
  </div>
107
112
 
108
113
  {columns.length > initialDisplayCount && (
109
114
  <TooltipComponent
110
115
  tableBodyRef={useCardRef}
111
- title={viewMore ? ' View Less' : 'View More'}
116
+ title={viewMore ? labels.viewLess : labels.viewMore}
112
117
  enabled={false}
113
118
  >
114
119
  <button
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
2
  import { ActionProps } from '../commontypes';
3
+ import { mergeLabels, type QbsTableLabels } from '../labels';
3
4
  import { ThreeDotIcon } from './icons';
4
5
  import TooltipComponent from './ToolTip';
5
6
 
@@ -11,9 +12,16 @@ type Props = {
11
12
  dataTheme?: string;
12
13
  tableBodyRef: React.RefObject<HTMLDivElement>;
13
14
  rowIndex?: number;
15
+ labels?: QbsTableLabels;
14
16
  };
15
17
 
16
- const CardMenuDropdown: React.FC<Props> = ({ actionDropDown, handleMenuActions, rowData }) => {
18
+ const CardMenuDropdown: React.FC<Props> = ({
19
+ actionDropDown,
20
+ handleMenuActions,
21
+ rowData,
22
+ labels: labelsProp
23
+ }) => {
24
+ const labels = mergeLabels(labelsProp);
17
25
  const [openMenu, setOpenMenu] = useState(false);
18
26
  const [menuPositionStyles, setMenuPositionStyles] = useState<{
19
27
  top?: string;
@@ -73,7 +81,7 @@ const CardMenuDropdown: React.FC<Props> = ({ actionDropDown, handleMenuActions,
73
81
  return (
74
82
  <div className="dropdown text-black dark:text-white dark:bg-[#424242] bg-white" ref={menuRef}>
75
83
  <button className="dropdown-toggle" onClick={toggleMenu} ref={menuButtonRef}>
76
- <TooltipComponent title="Actions" enabled={false} ref={menuButtonRef}>
84
+ <TooltipComponent title={labels.actions} enabled={false} ref={menuButtonRef}>
77
85
  <ThreeDotIcon />
78
86
  </TooltipComponent>
79
87
  </button>