@react-fabric/data 1.0.0-beta.60 → 1.0.0-beta.62

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 (64) hide show
  1. package/dist/cjs/checklist/CheckList.js +4 -4
  2. package/dist/cjs/histogram/Histogram.js +2 -2
  3. package/dist/cjs/i18n/index.js +4 -4
  4. package/dist/cjs/index.js +2 -0
  5. package/dist/cjs/json/JsonViewer.js +3 -3
  6. package/dist/cjs/pagination/Pagination.js +11 -11
  7. package/dist/cjs/table/AddColumn.js +2 -2
  8. package/dist/cjs/table/BodyCell.js +11 -4
  9. package/dist/cjs/table/BodyRow.js +2 -2
  10. package/dist/cjs/table/CheckboxCell.js +1 -1
  11. package/dist/cjs/table/HeaderCell.js +4 -4
  12. package/dist/cjs/table/HtmlTable.js +78 -0
  13. package/dist/cjs/table/Table.js +17 -14
  14. package/dist/cjs/tree/TreeNode.js +4 -4
  15. package/dist/cjs/tree/TreePanel.js +7 -8
  16. package/dist/cjs/virtual/Scroller.js +4 -4
  17. package/dist/esm/checklist/CheckList.js +5 -5
  18. package/dist/esm/histogram/Histogram.js +3 -3
  19. package/dist/esm/i18n/index.js +2 -2
  20. package/dist/esm/index.js +1 -0
  21. package/dist/esm/json/JsonViewer.js +4 -4
  22. package/dist/esm/pagination/Pagination.js +12 -12
  23. package/dist/esm/table/AddColumn.js +3 -3
  24. package/dist/esm/table/BodyCell.js +12 -5
  25. package/dist/esm/table/BodyRow.js +2 -2
  26. package/dist/esm/table/CheckboxCell.js +2 -2
  27. package/dist/esm/table/HeaderCell.js +5 -5
  28. package/dist/esm/table/HtmlTable.js +78 -0
  29. package/dist/esm/table/Table.js +18 -15
  30. package/dist/esm/tree/TreeNode.js +6 -6
  31. package/dist/esm/tree/TreePanel.js +8 -9
  32. package/dist/esm/virtual/Scroller.js +5 -5
  33. package/dist/types/index.d.ts +1 -0
  34. package/dist/types/table/HtmlTable.d.ts +21 -0
  35. package/dist/types/table/types.d.ts +5 -5
  36. package/dist/types/tree/TreePanel.d.ts +2 -2
  37. package/dist/types/tree/types.d.ts +0 -2
  38. package/package.json +6 -6
  39. package/src/checklist/CheckList.tsx +17 -7
  40. package/src/histogram/Histogram.tsx +3 -9
  41. package/src/i18n/index.ts +2 -2
  42. package/src/index.ts +1 -0
  43. package/src/json/JsonViewer.tsx +7 -4
  44. package/src/pagination/Pagination.tsx +12 -12
  45. package/src/table/AddColumn.tsx +3 -3
  46. package/src/table/BodyCell.tsx +18 -3
  47. package/src/table/BodyRow.tsx +4 -2
  48. package/src/table/CheckboxCell.tsx +4 -4
  49. package/src/table/HeaderCell.tsx +4 -5
  50. package/src/table/HtmlTable.tsx +128 -0
  51. package/src/table/Table.tsx +24 -17
  52. package/src/table/types.ts +5 -4
  53. package/src/tree/TreeNode.tsx +7 -13
  54. package/src/tree/TreePanel.tsx +13 -18
  55. package/src/tree/types.ts +0 -5
  56. package/src/virtual/Scroller.tsx +13 -5
  57. package/dist/cjs/tree/types.js +0 -30
  58. package/dist/esm/tree/types.js +0 -29
  59. /package/dist/cjs/i18n/{ar.json.js → ar/data.json.js} +0 -0
  60. /package/dist/cjs/i18n/{en.json.js → en/data.json.js} +0 -0
  61. /package/dist/esm/i18n/{ar.json.js → ar/data.json.js} +0 -0
  62. /package/dist/esm/i18n/{en.json.js → en/data.json.js} +0 -0
  63. /package/src/i18n/{ar.json → ar/data.json} +0 -0
  64. /package/src/i18n/{en.json → en/data.json} +0 -0
@@ -20,8 +20,8 @@ import { type TreePanelProps } from "./types";
20
20
  * selectable={true}
21
21
  * matcher={(item, query) => item.name.toLowerCase().includes(query.toLowerCase())}
22
22
  * filterPlaceholder="Search..."
23
- * defaultLeafIcon={<Icon icon={CoreIcons.file} />}
24
- * defaultNodeIcon={<Icon icon={CoreIcons.folder} />}
23
+ * defaultLeafIcon={<Icon icon="icon-[mdi--file]" />}
24
+ * defaultNodeIcon={<Icon icon="icon-[mdi--folder]" />}
25
25
  * expander="caret"
26
26
  * onChecked={(checkedItems) => console.log(checkedItems)}
27
27
  * onLoad={(id) => console.log(`Load children for ${id}`)}
@@ -183,6 +183,4 @@ interface BaseTreePanelProps<T extends KeyValue = KeyValue> extends TestProps, R
183
183
  leafClassName?: string;
184
184
  nodeClassName?: string;
185
185
  }
186
- export declare const iconExpandAll = "M12.984 9v6h3l-3.984 3.984-3.984-3.984h3v-6h-3l3.984-3.984 3.984 3.984h-3zM3.984 2.016h16.031v1.969h-16.031v-1.969zM3.984 20.016h16.031v1.969h-16.031v-1.969z";
187
- export declare const iconCollapseAll = "M3.984 11.016h16.031v1.969h-16.031v-1.969zM15.984 5.016l-3.984 3.984-3.984-3.984h3v-4.031h1.969v4.031h3zM8.016 18.984l3.984-3.984 3.984 3.984h-3v4.031h-1.969v-4.031h-3z";
188
186
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/data",
3
- "version": "1.0.0-beta.60",
3
+ "version": "1.0.0-beta.62",
4
4
  "description": "RUF: Data package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -35,10 +35,10 @@
35
35
  "watch": "npm-run-all -p watch:rollup watch:dts"
36
36
  },
37
37
  "dependencies": {
38
- "@react-fabric/core": "^1.0.0-beta.60",
39
- "@react-fabric/date": "^1.0.0-beta.60",
40
- "@react-fabric/form": "^1.0.0-beta.60",
41
- "@react-fabric/utilities": "^1.0.0-beta.60",
38
+ "@react-fabric/core": "^1.0.0-beta.62",
39
+ "@react-fabric/date": "^1.0.0-beta.62",
40
+ "@react-fabric/form": "^1.0.0-beta.62",
41
+ "@react-fabric/utilities": "^1.0.0-beta.62",
42
42
  "@tanstack/react-virtual": "~3.13.12",
43
43
  "classnames": "~2.5.1",
44
44
  "color": "~5.0.2",
@@ -54,5 +54,5 @@
54
54
  "node": ">=18.12.0",
55
55
  "npm": ">=8.19.0"
56
56
  },
57
- "gitHead": "a79f053ee7e13422c06d7d9c35d4f0c2610cdf5d"
57
+ "gitHead": "9dce2fd9bb753d67e3f8adbf50be257b4bc64242"
58
58
  }
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { Badge, CoreIcons, EmptyContent, Icon } from "@react-fabric/core";
24
+ import { Badge, EmptyContent, Icon } from "@react-fabric/core";
25
25
  import {
26
26
  type BadgeType,
27
27
  type TestProps,
@@ -106,7 +106,11 @@ const CheckItem: FC<
106
106
  data-type="checkbox"
107
107
  className="ax-checkList__checkbox"
108
108
  data-selected={selected === 1}
109
- icon={selected ? CoreIcons.checkboxInt : CoreIcons.checkboxOff}
109
+ icon={
110
+ selected
111
+ ? "icon-[mdi--checkbox-marked]"
112
+ : "icon-[mdi--checkbox-blank-outline]"
113
+ }
110
114
  />
111
115
  )}
112
116
  {allowNegative && (
@@ -116,10 +120,10 @@ const CheckItem: FC<
116
120
  className="ax-checkList__checkbox"
117
121
  icon={
118
122
  selected === 1
119
- ? CoreIcons.expand
123
+ ? "icon-[mdi--plus-box-outline]"
120
124
  : selected === -1
121
- ? CoreIcons.collapse
122
- : CoreIcons.checkboxOff
125
+ ? "icon-[mdi--minus-box-outline]"
126
+ : "icon-[mdi--checkbox-blank-outline]"
123
127
  }
124
128
  data-selected={selected}
125
129
  />
@@ -127,14 +131,20 @@ const CheckItem: FC<
127
131
  <Icon
128
132
  data-type="positive"
129
133
  onClick={(e) => [(onClick(id, false), e.stopPropagation())]}
130
- icon={selected === 1 ? CoreIcons.expandActive : CoreIcons.expand}
134
+ icon={
135
+ selected === 1
136
+ ? "icon-[mdi--plus-box]"
137
+ : "icon-[mdi--plus-box-outline]"
138
+ }
131
139
  data-selected={selected === 1}
132
140
  />
133
141
  <Icon
134
142
  data-type="negative"
135
143
  onClick={(e) => [(onClick(id, true), e.stopPropagation())]}
136
144
  icon={
137
- selected === -1 ? CoreIcons.collapseActive : CoreIcons.collapse
145
+ selected === -1
146
+ ? "icon-[mdi--minus-box]"
147
+ : "icon-[mdi--minus-box-outline]"
138
148
  }
139
149
  data-selected={selected === -1}
140
150
  />
@@ -21,13 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import {
25
- ActionLabel,
26
- Button,
27
- CoreIcons,
28
- EmptyContent,
29
- Icon,
30
- } from "@react-fabric/core";
24
+ import { ActionLabel, Button, EmptyContent, Icon } from "@react-fabric/core";
31
25
  import {
32
26
  type ColorType,
33
27
  type PaletteType,
@@ -178,7 +172,7 @@ export const Histogram = ({
178
172
  color="danger"
179
173
  size="sm"
180
174
  stopPropagation
181
- icon={CoreIcons.funnelMinus}
175
+ icon="icon-[mdi--filter-minus]"
182
176
  aria-label="Filter Negative"
183
177
  onClick={() => onClick?.(item.id, true)}
184
178
  />,
@@ -187,7 +181,7 @@ export const Histogram = ({
187
181
  color="primary"
188
182
  size="sm"
189
183
  stopPropagation
190
- icon={CoreIcons.funnelPlus}
184
+ icon="icon-[mdi--filter-plus]"
191
185
  aria-label="Filter"
192
186
  onClick={() => onClick?.(item.id)}
193
187
  />,
package/src/i18n/index.ts CHANGED
@@ -22,7 +22,7 @@
22
22
  */
23
23
 
24
24
  import { addTranslationBundle } from "@react-fabric/core";
25
- import ar from "./ar.json";
26
- import en from "./en.json";
25
+ import ar from "./ar/data.json";
26
+ import en from "./en/data.json";
27
27
 
28
28
  addTranslationBundle("data", { en, ar });
package/src/index.ts CHANGED
@@ -27,6 +27,7 @@ export { CheckList } from "./checklist/CheckList";
27
27
  export { Histogram } from "./histogram/Histogram";
28
28
  export { JsonViewer } from "./json/JsonViewer";
29
29
  export { Pagination } from "./pagination/Pagination";
30
+ export { HtmlTable } from "./table/HtmlTable";
30
31
  export { Table } from "./table/Table";
31
32
  export { type TableColumn, type TableRef } from "./table/types";
32
33
  export { TreePanel } from "./tree/TreePanel";
@@ -24,7 +24,6 @@
24
24
  import {
25
25
  Button,
26
26
  Copy,
27
- CoreIcons,
28
27
  EmptyContent,
29
28
  Icon,
30
29
  Meter,
@@ -230,7 +229,7 @@ const JsonEntry = ({
230
229
  color="danger"
231
230
  size="xs"
232
231
  variant="link"
233
- icon={CoreIcons.funnelMinus}
232
+ icon="icon-[mdi--filter-minus]"
234
233
  aria-label="Filter Negative"
235
234
  onClick={() => onFilter?.(pathWithoutOrdinal, actualValue, true)}
236
235
  />
@@ -239,7 +238,7 @@ const JsonEntry = ({
239
238
  color="primary"
240
239
  size="xs"
241
240
  variant="link"
242
- icon={CoreIcons.funnelPlus}
241
+ icon="icon-[mdi--filter-plus]"
243
242
  aria-label="Filter"
244
243
  onClick={() => onFilter?.(pathWithoutOrdinal, actualValue)}
245
244
  />
@@ -277,7 +276,11 @@ const JsonEntry = ({
277
276
  {canExpand && (
278
277
  <Icon
279
278
  rtlFlip
280
- icon={expanded ? CoreIcons.chevronDown : CoreIcons.chevronRight}
279
+ icon={
280
+ expanded
281
+ ? "icon-[mdi--chevron-down]"
282
+ : "icon-[mdi--chevron-right]"
283
+ }
281
284
  />
282
285
  )}
283
286
  {labelDisplay}
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { CoreIcons, Icon } from "@react-fabric/core";
24
+ import { Icon } from "@react-fabric/core";
25
25
  import classNames from "classnames";
26
26
  import { Fragment, memo, useMemo } from "react";
27
27
 
@@ -70,7 +70,7 @@ export const Pagination = memo(
70
70
  key={pg}
71
71
  onClick={() => onPageChange(pg)}
72
72
  className={classNames(
73
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
73
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
74
74
  page === pg && "bg-primary-500 text-white pointer-events-none",
75
75
  )}
76
76
  >
@@ -87,7 +87,7 @@ export const Pagination = memo(
87
87
  key={pg}
88
88
  onClick={() => onPageChange(pg)}
89
89
  className={classNames(
90
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
90
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
91
91
  page === pg && "bg-primary-500 text-white pointer-events-none",
92
92
  )}
93
93
  >
@@ -104,7 +104,7 @@ export const Pagination = memo(
104
104
  key={pg}
105
105
  onClick={() => onPageChange(pg)}
106
106
  className={classNames(
107
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
107
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
108
108
  page === pg && "bg-primary-500 text-white pointer-events-none",
109
109
  )}
110
110
  >
@@ -121,20 +121,20 @@ export const Pagination = memo(
121
121
  <button
122
122
  onClick={() => onPageChange(0)}
123
123
  className={classNames(
124
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
124
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
125
125
  page === 0 && "pointer-events-none text-tint-300",
126
126
  )}
127
127
  >
128
- <Icon icon={CoreIcons.chevronsLeft} rtlFlip />
128
+ <Icon icon="icon-[mdi--chevron-double-left]" rtlFlip />
129
129
  </button>
130
130
  <button
131
131
  onClick={() => onPageChange(page - 1)}
132
132
  className={classNames(
133
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
133
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
134
134
  page === 0 && "pointer-events-none text-tint-300",
135
135
  )}
136
136
  >
137
- <Icon icon={CoreIcons.chevronLeft} rtlFlip />
137
+ <Icon icon="icon-[mdi--chevron-left]" rtlFlip />
138
138
  </button>
139
139
  {!minimal && pageBody}
140
140
  {minimal && (
@@ -145,20 +145,20 @@ export const Pagination = memo(
145
145
  <button
146
146
  onClick={() => onPageChange(page + 1)}
147
147
  className={classNames(
148
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
148
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
149
149
  page + 1 >= totalPages && "pointer-events-none text-tint-300",
150
150
  )}
151
151
  >
152
- <Icon icon={CoreIcons.chevronRight} rtlFlip />
152
+ <Icon icon="icon-[mdi--chevron-right]" rtlFlip />
153
153
  </button>
154
154
  <button
155
155
  onClick={() => onPageChange(totalPages - 1)}
156
156
  className={classNames(
157
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
157
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
158
158
  page + 1 >= totalPages && "pointer-events-none text-tint-300",
159
159
  )}
160
160
  >
161
- <Icon icon={CoreIcons.chevronsRight} rtlFlip />
161
+ <Icon icon="icon-[mdi--chevron-double-right]" rtlFlip />
162
162
  </button>
163
163
  </div>
164
164
  );
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { CoreIcons, Dropdown, Icon, Menu, MenuItem } from "@react-fabric/core";
24
+ import { Dropdown, Icon, Menu, MenuItem } from "@react-fabric/core";
25
25
  import { type TableColumn } from "./types";
26
26
 
27
27
  export const AddColumn = ({
@@ -35,7 +35,7 @@ export const AddColumn = ({
35
35
  <div className="group font-medium w-6 flex flex-nowrap text-start items-center">
36
36
  <Dropdown placement="bottom-end">
37
37
  <Icon
38
- icon={CoreIcons.insert}
38
+ icon="icon-[mdi--plus-circle-outline]"
39
39
  className="p-1 rounded-t rounded-b-none hover:outline"
40
40
  />
41
41
  <Menu className="text-sm" onClick={onClick}>
@@ -45,7 +45,7 @@ export const AddColumn = ({
45
45
  id={String(col.id)}
46
46
  data-dropdown-dismiss="false"
47
47
  label={`${col.label ?? String(col.id)}`}
48
- icon={!col.hidden ? CoreIcons.tick : ""}
48
+ icon={!col.hidden ? "icon-[mdi--check]" : ""}
49
49
  />
50
50
  ))}
51
51
  </Menu>
@@ -22,7 +22,13 @@
22
22
  */
23
23
 
24
24
  import { DateDisplay } from "@react-fabric/date";
25
- import { Format, getByPath, isTrue } from "@react-fabric/utilities";
25
+ import {
26
+ Format,
27
+ getByPath,
28
+ isArray,
29
+ isObject,
30
+ isTrue,
31
+ } from "@react-fabric/utilities";
26
32
  import classNames from "classnames";
27
33
  import { useMemo } from "react";
28
34
  import { useTableContext } from "./Context";
@@ -55,11 +61,14 @@ export const BodyCell = ({
55
61
  return column.renderer(value, item, index);
56
62
  }
57
63
  if (column.dataType === "boolean") {
58
- const map = column.valueMap ?? { true: "Yes", false: "no" };
64
+ const map = column.valueMap ?? { true: "Yes", false: "No" };
59
65
  return map[`${isTrue(value) ? "true" : "false"}`];
60
66
  }
61
67
  if (column.valueMap != null) {
62
- if (column.dataType === "string" && value in column.valueMap) {
68
+ if (
69
+ ["number", "string"].includes(column.dataType ?? "string") &&
70
+ value in column.valueMap
71
+ ) {
63
72
  return column.valueMap[value];
64
73
  }
65
74
  }
@@ -69,6 +78,12 @@ export const BodyCell = ({
69
78
  if (column.dataType === "number") {
70
79
  return Format.number(value, column.format);
71
80
  }
81
+ if (isObject(value)) {
82
+ return JSON.stringify(value);
83
+ }
84
+ if (isArray(value)) {
85
+ return value.join(", ");
86
+ }
72
87
  return value ?? "";
73
88
  }, [item, column]);
74
89
 
@@ -21,11 +21,11 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
+ import { Icon } from "@react-fabric/core";
24
25
  import classNames from "classnames";
25
26
  import { BodyCell } from "./BodyCell";
26
27
  import { CheckboxCell } from "./CheckboxCell";
27
28
  import { type TableColumn } from "./types";
28
- import { CoreIcons, Icon } from "@react-fabric/core";
29
29
 
30
30
  export const BodyRow = ({
31
31
  rowKey,
@@ -94,7 +94,9 @@ export const BodyRow = ({
94
94
  >
95
95
  <Icon
96
96
  className="p-1 text-tint-700 hover:text-primary-600"
97
- icon={expanded ? CoreIcons.collapse : CoreIcons.expand}
97
+ icon={
98
+ expanded ? "icon-[mdi--minus-box]" : "icon-[mdi--plus-box]"
99
+ }
98
100
  onClick={(e) => [
99
101
  keyProperty && toggleExpand(data[keyProperty]),
100
102
  e.stopPropagation(),
@@ -21,7 +21,7 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import { CoreIcons, Icon } from "@react-fabric/core";
24
+ import { Icon } from "@react-fabric/core";
25
25
 
26
26
  export const CheckboxCell = ({
27
27
  state,
@@ -35,10 +35,10 @@ export const CheckboxCell = ({
35
35
  <Icon
36
36
  icon={
37
37
  state === 2
38
- ? CoreIcons.checkboxInt
38
+ ? "icon-[mdi--checkbox-intermediate]"
39
39
  : state === 1
40
- ? CoreIcons.checkboxOn
41
- : CoreIcons.checkboxOff
40
+ ? "icon-[mdi--checkbox-marked]"
41
+ : "icon-[mdi--checkbox-blank-outline]"
42
42
  }
43
43
  className="p-1 text-tint-700 hover:text-primary-600"
44
44
  onClick={(e) => [onClick?.(), e.stopPropagation()]}
@@ -23,7 +23,6 @@
23
23
 
24
24
  import {
25
25
  Button,
26
- CoreIcons,
27
26
  Divider,
28
27
  DropdownTool,
29
28
  getIconProps,
@@ -91,7 +90,7 @@ export const HeaderCell = ({
91
90
  <Menu
92
91
  key="filters"
93
92
  label="Filter"
94
- icon={filter ? CoreIcons.tick : ""}
93
+ icon={filter ? "icon-[mdi--check]" : ""}
95
94
  trigger="click"
96
95
  >
97
96
  <ColumnFilters
@@ -108,13 +107,13 @@ export const HeaderCell = ({
108
107
  <MenuItem
109
108
  key="sort-asc"
110
109
  label="Sort ascending"
111
- icon={CoreIcons.sortAsc}
110
+ icon="icon-[mdi--sort-ascending]"
112
111
  onClick={() => handleSort("asc")}
113
112
  />,
114
113
  <MenuItem
115
114
  key="sort-desc"
116
115
  label="Sort descending"
117
- icon={CoreIcons.sortDesc}
116
+ icon="icon-[mdi--sort-descending]"
118
117
  onClick={() => handleSort("desc")}
119
118
  />,
120
119
  );
@@ -173,7 +172,7 @@ export const HeaderCell = ({
173
172
  variant="link"
174
173
  aria-label="clear filter"
175
174
  stopPropagation
176
- icon={CoreIcons.funnelRemove}
175
+ icon="icon-[mdi--filter-remove]"
177
176
  onClick={() => onFilter?.(id)}
178
177
  />
179
178
  )}
@@ -0,0 +1,128 @@
1
+ /*
2
+ * React Fabric
3
+ * @version: 1.0.0
4
+ *
5
+ *
6
+ * The MIT License (MIT)
7
+ * Copyright (c) 2026 Adarsh Pastakia
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
10
+ * and associated documentation files (the "Software"), to deal in the Software without restriction,
11
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
12
+ * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
13
+ * subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all copies or substantial
16
+ * portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ import { Footer } from "@react-fabric/core";
25
+ import { getByPath } from "@react-fabric/utilities";
26
+ import classNames from "classnames";
27
+ import { useMemo } from "react";
28
+ import { usePagination } from "../hooks/usePagination";
29
+ import { Pagination } from "../pagination/Pagination";
30
+
31
+ interface Props<T = KeyValue> {
32
+ data: T[];
33
+ columns: Array<{
34
+ id: keyof T;
35
+ label?: string;
36
+ width?: number | string;
37
+ maxWidth?: number | string;
38
+ align?: "start" | "center" | "end";
39
+ className?: string;
40
+ headRenderer?: React.ReactNode;
41
+ renderer?: (value: any, row: T, index: number) => React.ReactNode;
42
+ }>;
43
+ /**
44
+ * Number of pagination buttons to show, default is 25
45
+ * If set to 0, pagination will be hidden
46
+ */
47
+ paginationSize?: number;
48
+
49
+ className?: string;
50
+ }
51
+
52
+ export const HtmlTable = <T extends KeyValue = KeyValue>({
53
+ data,
54
+ columns,
55
+ paginationSize = 25,
56
+ className,
57
+ }: Props<T>) => {
58
+ const paginator = usePagination({
59
+ totalRecords: data.length,
60
+ perPage: paginationSize,
61
+ });
62
+
63
+ const startIndex = useMemo(
64
+ () => paginator.page * paginationSize,
65
+ [paginator.page, paginationSize],
66
+ );
67
+
68
+ const dataPage = useMemo(
69
+ () =>
70
+ paginationSize > 0
71
+ ? data.slice(startIndex, startIndex + paginationSize)
72
+ : data,
73
+ [data, paginationSize, startIndex],
74
+ );
75
+
76
+ return (
77
+ <div className={className}>
78
+ <table className="table-fixed border-spacing-1 border-separate w-full text-sm">
79
+ <thead className="sticky top-0 z-1">
80
+ <tr>
81
+ {columns.map((col, idx) => (
82
+ <th
83
+ key={idx}
84
+ className="text-start truncate bg-accent-100 px-2 py-1 font-medium text-accent-800"
85
+ style={{ width: col.width, maxWidth: col.maxWidth }}
86
+ >
87
+ {col.headRenderer ?? col.label ?? " "}
88
+ </th>
89
+ ))}
90
+ </tr>
91
+ </thead>
92
+ <tbody className="bg-alternate">
93
+ {dataPage.map((row, idx) => (
94
+ <tr key={idx}>
95
+ {columns.map((col, cidx) => (
96
+ <td
97
+ key={`${idx}-${cidx}`}
98
+ className={classNames(
99
+ "px-2 py-1 truncate",
100
+ col.align === "center" && "text-center",
101
+ col.align === "end" && "text-end",
102
+ col.className,
103
+ )}
104
+ style={{ width: col.width, maxWidth: col.maxWidth }}
105
+ >
106
+ {col.renderer?.(
107
+ getByPath(row, col.id.toString()),
108
+ row,
109
+ startIndex + idx,
110
+ ) ?? getByPath(row, col.id.toString())}
111
+ </td>
112
+ ))}
113
+ </tr>
114
+ ))}
115
+ </tbody>
116
+ </table>
117
+ {paginationSize > 0 && (
118
+ <Footer
119
+ flex
120
+ justify="end"
121
+ className="px-2 py-1 sticky bottom-0 bg-tint-50"
122
+ >
123
+ <Pagination minimal {...paginator} />
124
+ </Footer>
125
+ )}
126
+ </div>
127
+ );
128
+ };
@@ -22,10 +22,9 @@
22
22
  */
23
23
 
24
24
  import {
25
- CoreIcons,
26
25
  EmptyContent,
27
26
  Icon,
28
- Loading,
27
+ LoadingLine,
29
28
  useDebounce,
30
29
  } from "@react-fabric/core";
31
30
  import { debounce } from "@react-fabric/utilities";
@@ -65,7 +64,7 @@ export const Table = <T extends KeyValue = KeyValue>({
65
64
  ref,
66
65
  data,
67
66
  columns,
68
- keyProperty = "id",
67
+ keyProperty = "id" as any,
69
68
  groupProperty,
70
69
  checkableRows,
71
70
  initialScroll,
@@ -232,7 +231,7 @@ export const Table = <T extends KeyValue = KeyValue>({
232
231
  )}
233
232
  </div>
234
233
  </div>
235
- {loading && <Loading />}
234
+ {loading && <LoadingLine />}
236
235
  {data.length > 0 && (
237
236
  <div
238
237
  className="area-content flex flex-col flex-nowrap min-h-full"
@@ -252,24 +251,32 @@ export const Table = <T extends KeyValue = KeyValue>({
252
251
  ref={measureElement}
253
252
  data-index={index}
254
253
  className={classNames(
255
- "px-2 py-1 text-md bg-base border-y border-tint-100 cursor-pointer flex items-center gap-1 z-2",
254
+ "text-md bg-base border-y border-tint-100 border-t-0 cursor-pointer flex items-center justify-start gap-1 z-2",
256
255
  isActiveSticky(index) && "sticky top-8",
257
256
  )}
258
257
  role="none"
259
258
  onClick={() => toggleGroupExpand(data.key)}
260
259
  >
261
- <Icon
262
- rtlFlip
263
- icon={
264
- data.open ? CoreIcons.chevronDown : CoreIcons.chevronRight
265
- }
266
- />
267
- {groupRenderer?.(data) ?? (
268
- <div className="flex gap-1 items-center">
269
- <span>{data.key}</span>
270
- <span className="text-sm">({data.itemCount})</span>
271
- </div>
272
- )}
260
+ <div
261
+ className={classNames(
262
+ "px-2 py-1 flex items-center gap-1 z-2 sticky start-0",
263
+ )}
264
+ >
265
+ <Icon
266
+ rtlFlip
267
+ icon={
268
+ data.open
269
+ ? "icon-[mdi--chevron-down]"
270
+ : "icon-[mdi--chevron-right]"
271
+ }
272
+ />
273
+ {groupRenderer?.(data) ?? (
274
+ <div className="flex gap-1 items-center">
275
+ <span>{data.key}</span>
276
+ <span className="text-sm">({data.itemCount})</span>
277
+ </div>
278
+ )}
279
+ </div>
273
280
  </div>
274
281
  ) : (
275
282
  <BodyRow