@react-fabric/data 1.0.0-beta.8 → 1.0.1

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 (141) hide show
  1. package/{src/histogram/Histogram.module.css → css/_histogram.css} +16 -13
  2. package/css/styles.css +24 -0
  3. package/dist/cjs/checklist/CheckList.js +59 -33
  4. package/dist/cjs/histogram/Histogram.js +41 -26
  5. package/dist/cjs/hooks/useFilteredList.js +100 -17
  6. package/dist/cjs/hooks/usePagination.js +29 -8
  7. package/dist/cjs/hooks/useSelectableList.js +30 -5
  8. package/dist/cjs/i18n/{ar.json.js → ar/data.json.js} +8 -1
  9. package/dist/cjs/i18n/{en.json.js → en/data.json.js} +8 -1
  10. package/dist/cjs/i18n/index.js +4 -4
  11. package/dist/cjs/index.js +30 -0
  12. package/dist/cjs/json/JsonViewer.js +80 -43
  13. package/dist/cjs/pagination/Pagination.js +24 -15
  14. package/dist/cjs/table/AddColumn.js +5 -5
  15. package/dist/cjs/table/BodyCell.js +20 -13
  16. package/dist/cjs/table/BodyRow.js +41 -28
  17. package/dist/cjs/table/CheckboxCell.js +10 -9
  18. package/dist/cjs/table/ColumnFilters.js +100 -0
  19. package/dist/cjs/table/EmptyCell.js +4 -4
  20. package/dist/cjs/table/HeaderCell.js +79 -53
  21. package/dist/cjs/table/HtmlTable.js +84 -0
  22. package/dist/cjs/table/{Context.js → Provider.js} +8 -10
  23. package/dist/cjs/table/Table.js +99 -33
  24. package/dist/cjs/{tree/types.js → table/context.js} +9 -5
  25. package/dist/cjs/table/types.js +29 -0
  26. package/dist/cjs/table/useResizer.js +10 -10
  27. package/dist/cjs/table/useTableColumns.js +4 -4
  28. package/dist/cjs/table/useVirtualTable.js +129 -22
  29. package/dist/cjs/tree/TreeNode.js +66 -46
  30. package/dist/cjs/tree/TreePanel.js +60 -24
  31. package/dist/cjs/tree/useTree.js +212 -47
  32. package/dist/cjs/tree/utils.js +63 -34
  33. package/dist/cjs/utils/getColor.js +58 -0
  34. package/dist/cjs/virtual/Gallery.js +119 -61
  35. package/dist/cjs/virtual/List.js +116 -55
  36. package/dist/cjs/virtual/Scroller.js +16 -8
  37. package/dist/esm/checklist/CheckList.js +61 -35
  38. package/dist/esm/histogram/Histogram.js +43 -28
  39. package/dist/esm/hooks/useFilteredList.js +101 -18
  40. package/dist/esm/hooks/usePagination.js +29 -8
  41. package/dist/esm/hooks/useSelectableList.js +30 -5
  42. package/dist/esm/i18n/{ar.json.js → ar/data.json.js} +8 -2
  43. package/dist/esm/i18n/{en.json.js → en/data.json.js} +8 -2
  44. package/dist/esm/i18n/index.js +2 -2
  45. package/dist/esm/index.js +31 -0
  46. package/dist/esm/json/JsonViewer.js +82 -45
  47. package/dist/esm/pagination/Pagination.js +25 -16
  48. package/dist/esm/table/AddColumn.js +6 -6
  49. package/dist/esm/table/BodyCell.js +21 -14
  50. package/dist/esm/table/BodyRow.js +41 -28
  51. package/dist/esm/table/CheckboxCell.js +11 -10
  52. package/dist/esm/table/ColumnFilters.js +100 -0
  53. package/dist/esm/table/EmptyCell.js +4 -4
  54. package/dist/esm/table/HeaderCell.js +80 -54
  55. package/dist/esm/table/HtmlTable.js +84 -0
  56. package/dist/esm/table/{Context.js → Provider.js} +11 -12
  57. package/dist/esm/table/Table.js +100 -34
  58. package/dist/esm/{tree/types.js → table/context.js} +8 -4
  59. package/dist/esm/table/types.js +29 -0
  60. package/dist/esm/table/useResizer.js +10 -10
  61. package/dist/esm/table/useTableColumns.js +4 -4
  62. package/dist/esm/table/useVirtualTable.js +131 -24
  63. package/dist/esm/tree/TreeNode.js +69 -49
  64. package/dist/esm/tree/TreePanel.js +62 -26
  65. package/dist/esm/tree/useTree.js +215 -50
  66. package/dist/esm/tree/utils.js +64 -35
  67. package/dist/esm/utils/getColor.js +58 -0
  68. package/dist/esm/virtual/Gallery.js +121 -63
  69. package/dist/esm/virtual/List.js +118 -57
  70. package/dist/esm/virtual/Scroller.js +17 -9
  71. package/dist/types/checklist/CheckList.d.ts +25 -6
  72. package/dist/types/histogram/Histogram.d.ts +28 -6
  73. package/dist/types/hooks/useFilteredList.d.ts +62 -5
  74. package/dist/types/hooks/usePagination.d.ts +18 -2
  75. package/dist/types/hooks/useSelectableList.d.ts +24 -1
  76. package/dist/types/index.d.ts +27 -0
  77. package/dist/types/json/JsonViewer.d.ts +23 -3
  78. package/dist/types/pagination/Pagination.d.ts +8 -2
  79. package/dist/types/table/AddColumn.d.ts +2 -2
  80. package/dist/types/table/BodyCell.d.ts +2 -2
  81. package/dist/types/table/BodyRow.d.ts +9 -9
  82. package/dist/types/table/CheckboxCell.d.ts +3 -3
  83. package/dist/types/table/ColumnFilters.d.ts +12 -0
  84. package/dist/types/table/EmptyCell.d.ts +1 -1
  85. package/dist/types/table/HeaderCell.d.ts +1 -1
  86. package/dist/types/table/HtmlTable.d.ts +21 -0
  87. package/dist/types/table/Provider.d.ts +2 -0
  88. package/dist/types/table/Table.d.ts +10 -1
  89. package/dist/types/table/context.d.ts +7 -0
  90. package/dist/types/table/types.d.ts +52 -10
  91. package/dist/types/table/useResizer.d.ts +1 -1
  92. package/dist/types/table/useTableColumns.d.ts +1 -1
  93. package/dist/types/table/useVirtualTable.d.ts +31 -12
  94. package/dist/types/tree/TreeNode.d.ts +1 -1
  95. package/dist/types/tree/TreePanel.d.ts +36 -1
  96. package/dist/types/tree/types.d.ts +75 -28
  97. package/dist/types/tree/useTree.d.ts +8 -12
  98. package/dist/types/tree/utils.d.ts +15 -8
  99. package/dist/types/utils/getColor.d.ts +43 -0
  100. package/dist/types/virtual/Gallery.d.ts +37 -6
  101. package/dist/types/virtual/List.d.ts +38 -6
  102. package/dist/types/virtual/Scroller.d.ts +1 -1
  103. package/package.json +17 -19
  104. package/src/checklist/CheckList.tsx +68 -71
  105. package/src/histogram/Histogram.tsx +47 -48
  106. package/src/hooks/useFilteredList.tsx +111 -28
  107. package/src/hooks/usePagination.tsx +39 -39
  108. package/src/hooks/useSelectableList.ts +45 -33
  109. package/src/i18n/{ar.json → ar/data.json} +5 -0
  110. package/src/i18n/{en.json → en/data.json} +5 -0
  111. package/src/i18n/index.ts +2 -2
  112. package/src/index.ts +23 -17
  113. package/src/json/JsonViewer.tsx +89 -120
  114. package/src/pagination/Pagination.tsx +104 -105
  115. package/src/table/AddColumn.tsx +6 -15
  116. package/src/table/BodyCell.tsx +27 -36
  117. package/src/table/BodyRow.tsx +36 -59
  118. package/src/table/CheckboxCell.tsx +12 -15
  119. package/src/table/ColumnFilters.tsx +93 -0
  120. package/src/table/EmptyCell.tsx +5 -18
  121. package/src/table/HeaderCell.tsx +72 -53
  122. package/src/table/HtmlTable.tsx +106 -0
  123. package/src/table/{Context.tsx → Provider.tsx} +11 -28
  124. package/src/table/Table.tsx +98 -83
  125. package/src/table/context.ts +33 -0
  126. package/src/table/types.ts +53 -27
  127. package/src/table/useResizer.ts +5 -9
  128. package/src/table/useTableColumns.ts +4 -6
  129. package/src/table/useVirtualTable.ts +136 -37
  130. package/src/tree/TreeNode.tsx +91 -86
  131. package/src/tree/TreePanel.tsx +87 -51
  132. package/src/tree/types.ts +85 -46
  133. package/src/tree/useTree.ts +210 -65
  134. package/src/tree/utils.ts +81 -62
  135. package/src/utils/getColor.ts +55 -0
  136. package/src/virtual/Gallery.tsx +129 -120
  137. package/src/virtual/List.tsx +124 -91
  138. package/src/virtual/Scroller.tsx +25 -9
  139. package/dist/cjs/histogram/Histogram.module.css +0 -1
  140. package/dist/esm/histogram/Histogram.module.css +0 -1
  141. package/dist/types/table/Context.d.ts +0 -8
package/dist/esm/index.js CHANGED
@@ -5,9 +5,40 @@ export { CheckList } from './checklist/CheckList.js';
5
5
  export { Histogram } from './histogram/Histogram.js';
6
6
  export { JsonViewer } from './json/JsonViewer.js';
7
7
  export { Pagination } from './pagination/Pagination.js';
8
+ export { HtmlTable } from './table/HtmlTable.js';
8
9
  export { Table } from './table/Table.js';
9
10
  export { TreePanel } from './tree/TreePanel.js';
10
11
  export { VirtualGallery } from './virtual/Gallery.js';
11
12
  export { VirtualList } from './virtual/List.js';
12
13
  export { useFilteredList } from './hooks/useFilteredList.js';
13
14
  export { usePagination } from './hooks/usePagination.js';
15
+
16
+ /**
17
+ * React Fabric
18
+ * @version 1.0.0
19
+ * @license MIT
20
+ * @copyright 2024 Adarsh Pastakia
21
+ *
22
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
23
+ * of this software and associated documentation files (the "Software"), to deal
24
+ * in the Software without restriction, including without limitation the rights
25
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
+ * copies of the Software, and to permit persons to whom the Software is
27
+ * furnished to do so, subject to the following conditions:
28
+ *
29
+ * The above copyright notice and this permission notice shall be included in all
30
+ * copies or substantial portions of the Software.
31
+ *
32
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
+ * SOFTWARE.
39
+ */
40
+
41
+ var DATA_PACKAGE = "@react-fabric/data";
42
+ var DATA_VERSION = "1.0.0";
43
+
44
+ export { DATA_PACKAGE, DATA_VERSION };
@@ -4,17 +4,16 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
4
4
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
5
5
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
6
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
7
- import { EmptyContent, Text, Meter, ActionLabel, Button, CoreIcons, Icon, Copy } from '@react-fabric/core';
8
- import { isEmpty, isArray, isObject, isNil, Format, isBoolean, isTrue } from '@react-fabric/utilities';
9
- import classNames from 'classnames';
7
+ import { EmptyContent, Text, Meter, Button, Icon, Copy } from '@react-fabric/core';
8
+ import { isEmpty, cn, isArray, isObject, isNil, Format, isBoolean, isTrue } from '@react-fabric/utilities';
10
9
  import { useMemo, useState, Fragment } from 'react';
11
10
  import { useTranslation } from 'react-i18next';
12
11
  import { jsx, jsxs } from 'react/jsx-runtime';
13
12
 
14
13
  var _excluded = ["className", "json", "copy", "propertyScheme", "filters", "inline", "labelWidth", "formatter", "labeler", "onFilter", "emptyMessage", "showPropertyTree"];
15
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
- var reduceObject = function reduceObject(json) {
15
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
+ function reduceObject(json) {
18
17
  var keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
19
18
  var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
20
19
  var ret = [];
@@ -37,8 +36,8 @@ var reduceObject = function reduceObject(json) {
37
36
  }
38
37
  });
39
38
  return ret.flat(99);
40
- };
41
- var JsonEntry = function JsonEntry(_ref3) {
39
+ }
40
+ function JsonEntry(_ref3) {
42
41
  var value = _ref3.value,
43
42
  path = _ref3.path,
44
43
  field = _ref3.field,
@@ -69,7 +68,7 @@ var JsonEntry = function JsonEntry(_ref3) {
69
68
  return (_ref4 = (_value$_label_ = value === null || value === void 0 ? void 0 : value._label_) !== null && _value$_label_ !== void 0 ? _value$_label_ : value) !== null && _ref4 !== void 0 ? _ref4 : "";
70
69
  }, [value]);
71
70
  var display = useMemo(function () {
72
- var _propertyScheme$date, _propertyScheme$time, _propertyScheme$numbe, _propertyScheme$bytes, _propertyScheme$perce, _propertyScheme$numbe2, _propertyScheme$boole, _ret;
71
+ var _propertyScheme$date, _propertyScheme$time, _propertyScheme$numbe, _Format$phone, _propertyScheme$bytes, _propertyScheme$perce, _propertyScheme$numbe2, _propertyScheme$boole, _ret;
73
72
  if (children) return null;
74
73
  if (isNil(value)) return /*#__PURE__*/jsx("span", {
75
74
  className: "text-muted",
@@ -89,7 +88,7 @@ var JsonEntry = function JsonEntry(_ref3) {
89
88
  }
90
89
  if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$date = propertyScheme.date) !== null && _propertyScheme$date !== void 0 && _propertyScheme$date.includes(path)) ;
91
90
  if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$time = propertyScheme.time) !== null && _propertyScheme$time !== void 0 && _propertyScheme$time.includes(path)) ret = Format.date(actualValue, "pp");
92
- if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$numbe = propertyScheme.number) !== null && _propertyScheme$numbe !== void 0 && _propertyScheme$numbe.phone(path)) ret = Format.phone(actualValue);
91
+ if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$numbe = propertyScheme.number) !== null && _propertyScheme$numbe !== void 0 && _propertyScheme$numbe.phone(path)) ret = (_Format$phone = Format.phone(actualValue)) !== null && _Format$phone !== void 0 ? _Format$phone : "";
93
92
  if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$bytes = propertyScheme.bytes) !== null && _propertyScheme$bytes !== void 0 && _propertyScheme$bytes.includes(path)) ret = Format.bytes(actualValue);
94
93
  if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$perce = propertyScheme.percent) !== null && _propertyScheme$perce !== void 0 && _propertyScheme$perce.includes(path)) ret = Format.percent(actualValue);
95
94
  if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$numbe2 = propertyScheme.number) !== null && _propertyScheme$numbe2 !== void 0 && _propertyScheme$numbe2.includes(path)) ret = Format.number(actualValue);
@@ -99,6 +98,11 @@ var JsonEntry = function JsonEntry(_ref3) {
99
98
  clamp: 3,
100
99
  children: ret
101
100
  });
101
+ } else {
102
+ ret = /*#__PURE__*/jsx("div", {
103
+ className: "break-words",
104
+ children: ret
105
+ });
102
106
  }
103
107
  return /*#__PURE__*/jsxs(Fragment, {
104
108
  children: [ret, isObject(value) && value._score_ > 0 && /*#__PURE__*/jsx(Meter, {
@@ -106,6 +110,7 @@ var JsonEntry = function JsonEntry(_ref3) {
106
110
  value: value._score_
107
111
  })]
108
112
  });
113
+ // eslint-disable-next-line @eslint-react/exhaustive-deps
109
114
  }, [value, path, formatter, propertyScheme, actualValue]);
110
115
  var pathWithoutOrdinal = useMemo(function () {
111
116
  return path.replace(/\.\d*\./, ".");
@@ -120,39 +125,43 @@ var JsonEntry = function JsonEntry(_ref3) {
120
125
  }, [filters, path, pathWithoutOrdinal]);
121
126
  var labelDisplay = useMemo(function () {
122
127
  var _labeler;
123
- return /*#__PURE__*/jsx(ActionLabel, {
124
- className: "text-dimmed text-sm px-2 flex-1 truncate",
125
- actions: !canExpand && canFilter ? [/*#__PURE__*/jsx(Button, {
126
- color: "danger",
127
- size: "sm",
128
- variant: "link",
129
- icon: CoreIcons.funnelMinus,
130
- "aria-label": "Filter Negative",
131
- onClick: function onClick() {
132
- return onFilter === null || onFilter === void 0 ? void 0 : onFilter(pathWithoutOrdinal, actualValue, true);
133
- }
134
- }, "negative"), /*#__PURE__*/jsx(Button, {
135
- color: "primary",
136
- size: "sm",
137
- variant: "link",
138
- icon: CoreIcons.funnelPlus,
139
- "aria-label": "Filter",
140
- onClick: function onClick() {
141
- return onFilter === null || onFilter === void 0 ? void 0 : onFilter(pathWithoutOrdinal, actualValue);
142
- }
143
- }, "positive")] : [],
144
- children: (_labeler = labeler === null || labeler === void 0 ? void 0 : labeler(path)) !== null && _labeler !== void 0 ? _labeler : field
128
+ return /*#__PURE__*/jsxs("div", {
129
+ className: cn("text-dimmed text-sm px-2 flex-1 group", inline ? "truncate" : "break-words"),
130
+ children: [!canExpand && canFilter && /*#__PURE__*/jsxs("div", {
131
+ className: "hidden pe-1 group-hover:inline-block align-middle",
132
+ children: [/*#__PURE__*/jsx(Button, {
133
+ color: "primary",
134
+ size: "xs",
135
+ variant: "link",
136
+ icon: "icon-[mdi--filter-plus]",
137
+ "aria-label": "Filter",
138
+ onClick: function onClick() {
139
+ return onFilter === null || onFilter === void 0 ? void 0 : onFilter(pathWithoutOrdinal, actualValue);
140
+ }
141
+ }, "positive"), /*#__PURE__*/jsx(Button, {
142
+ color: "danger",
143
+ size: "xs",
144
+ variant: "link",
145
+ icon: "icon-[mdi--filter-minus]",
146
+ "aria-label": "Filter Negative",
147
+ onClick: function onClick() {
148
+ return onFilter === null || onFilter === void 0 ? void 0 : onFilter(pathWithoutOrdinal, actualValue, true);
149
+ }
150
+ }, "negative")]
151
+ }), (_labeler = labeler === null || labeler === void 0 ? void 0 : labeler(path)) !== null && _labeler !== void 0 ? _labeler : field]
145
152
  });
146
- }, [field, labeler, pathWithoutOrdinal, actualValue, canExpand, canFilter]);
153
+ },
154
+ // eslint-disable-next-line @eslint-react/exhaustive-deps
155
+ [field, labeler, pathWithoutOrdinal, actualValue, canExpand, canFilter]);
147
156
  return /*#__PURE__*/jsxs(Fragment, {
148
157
  children: [showPropertyTree && /*#__PURE__*/jsxs("div", {
149
- className: classNames("py-2", inline && "flex flex-nowrap items-center"),
158
+ className: cn("py-2", inline && "flex flex-nowrap items-center"),
150
159
  style: {
151
160
  paddingInlineStart: level * 8
152
161
  },
153
162
  children: [/*#__PURE__*/jsxs("div", {
154
163
  role: "none",
155
- className: classNames("flex overflow-hidden items-center", inline && "flex-content"),
164
+ className: cn("flex overflow-hidden items-center", inline && "flex-content"),
156
165
  style: {
157
166
  flexBasis: labelWidth
158
167
  },
@@ -161,30 +170,36 @@ var JsonEntry = function JsonEntry(_ref3) {
161
170
  },
162
171
  children: [canExpand && /*#__PURE__*/jsx(Icon, {
163
172
  rtlFlip: true,
164
- icon: expanded ? CoreIcons.chevronDown : CoreIcons.chevronRight
173
+ icon: expanded ? "icon-[mdi--chevron-down]" : "icon-[mdi--chevron-right]"
165
174
  }), labelDisplay]
166
175
  }), display && /*#__PURE__*/jsxs("div", {
167
- className: classNames("px-2", inline && "flex-1"),
176
+ className: cn("px-2 flex flex-nowrap overflow-hidden", inline && "flex-1"),
168
177
  children: [canCopy && /*#__PURE__*/jsx(Copy, {
169
178
  size: "xs",
170
179
  text: actualValue
171
- }), display]
180
+ }), /*#__PURE__*/jsx("div", {
181
+ className: "flex-1",
182
+ children: display
183
+ })]
172
184
  })]
173
185
  }), !showPropertyTree && !children && /*#__PURE__*/jsxs("div", {
174
- className: classNames("py-2", inline && "flex flex-nowrap items-center"),
186
+ className: cn("py-2", inline && "flex flex-nowrap items-center"),
175
187
  children: [/*#__PURE__*/jsx("div", {
176
188
  role: "none",
177
- className: classNames("flex overflow-hidden items-center", inline && "flex-content"),
189
+ className: cn("flex overflow-hidden items-center", inline && "flex-content"),
178
190
  style: {
179
191
  flexBasis: labelWidth
180
192
  },
181
193
  children: labelDisplay
182
194
  }), /*#__PURE__*/jsxs("div", {
183
- className: classNames("px-2", inline && "flex-1"),
195
+ className: cn("px-2 flex flex-nowrap overflow-hidden", inline && "flex-1"),
184
196
  children: [canCopy && /*#__PURE__*/jsx(Copy, {
185
197
  size: "xs",
186
198
  text: value
187
- }), display]
199
+ }), /*#__PURE__*/jsx("div", {
200
+ className: "flex-1",
201
+ children: display
202
+ })]
188
203
  })]
189
204
  }), expanded && (children === null || children === void 0 ? void 0 : children.map(function (item) {
190
205
  return /*#__PURE__*/jsx(JsonEntry, _objectSpread(_objectSpread({}, item), {}, {
@@ -201,8 +216,30 @@ var JsonEntry = function JsonEntry(_ref3) {
201
216
  }), item.path);
202
217
  }))]
203
218
  });
204
- };
205
- var JsonViewer = function JsonViewer(_ref5) {
219
+ }
220
+
221
+ /**
222
+ * JsonViewer component to display JSON data in a structured format.
223
+ * It supports inline display, property filtering, and custom formatting.
224
+ * The component can handle nested objects and arrays, displaying them in a tree-like structure.
225
+ * It also provides options for copying values and filtering properties.
226
+ *
227
+ * @example
228
+ * ```jsx
229
+ * <JsonViewer
230
+ * json={{ name: "John", age: 30, address: { city: "New York", zip: "10001" } }}
231
+ * copy={true}
232
+ * filters={true}
233
+ * propertyScheme={{ date: ["createdAt"], phone: ["contact"] }}
234
+ * inline={true}
235
+ * labelWidth="25%"
236
+ * formatter={(path, value) => (path === "age" ? `${value} years` : value)}
237
+ * labeler={(path) => path.replace(/_/g, " ").toUpperCase()}
238
+ * onFilter={(path, value, negate) => console.log(`Filter ${negate ? "negate" : ""} on ${path}:`, value)}
239
+ * />
240
+ * ```
241
+ */
242
+ function JsonViewer(_ref5) {
206
243
  var className = _ref5.className,
207
244
  json = _ref5.json,
208
245
  copy = _ref5.copy,
@@ -223,7 +260,7 @@ var JsonViewer = function JsonViewer(_ref5) {
223
260
  return reduceObject(json);
224
261
  }, [json]);
225
262
  return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, rest), {}, {
226
- className: classNames(className, "p-4 bg-alternate"),
263
+ className: cn(className, "bg-alternate"),
227
264
  children: !isEmpty(json) ? list.map(function (item) {
228
265
  return /*#__PURE__*/jsx(JsonEntry, _objectSpread(_objectSpread({}, item), {}, {
229
266
  copy: copy,
@@ -241,6 +278,6 @@ var JsonViewer = function JsonViewer(_ref5) {
241
278
  message: emptyMessage !== null && emptyMessage !== void 0 ? emptyMessage : t("json.empty")
242
279
  })
243
280
  }));
244
- };
281
+ }
245
282
 
246
283
  export { JsonViewer };
@@ -1,12 +1,12 @@
1
1
  'use client';
2
2
 
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
- import { Icon, CoreIcons } from '@react-fabric/core';
5
- import classNames from 'classnames';
4
+ import { Icon } from '@react-fabric/core';
5
+ import { cn } from '@react-fabric/utilities';
6
6
  import { memo, useMemo, Fragment } from 'react';
7
7
  import { jsxs, jsx } from 'react/jsx-runtime';
8
8
 
9
- var Pagination = /*#__PURE__*/memo(function (_ref) {
9
+ var PaginationComponent = function PaginationComponent(_ref) {
10
10
  var page = _ref.page,
11
11
  ranges = _ref.ranges,
12
12
  totalPages = _ref.totalPages,
@@ -23,7 +23,7 @@ var Pagination = /*#__PURE__*/memo(function (_ref) {
23
23
  onClick: function onClick() {
24
24
  return onPageChange(pg);
25
25
  },
26
- className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === pg && "bg-primary-500 text-white pointer-events-none"),
26
+ className: cn("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer", page === pg && "bg-primary-500 text-white pointer-events-none"),
27
27
  children: pg + 1
28
28
  }, pg);
29
29
  }), mid && /*#__PURE__*/jsx("span", {
@@ -34,7 +34,7 @@ var Pagination = /*#__PURE__*/memo(function (_ref) {
34
34
  onClick: function onClick() {
35
35
  return onPageChange(pg);
36
36
  },
37
- className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === pg && "bg-primary-500 text-white pointer-events-none"),
37
+ className: cn("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer", page === pg && "bg-primary-500 text-white pointer-events-none"),
38
38
  children: pg + 1
39
39
  }, pg);
40
40
  }), last && /*#__PURE__*/jsx("span", {
@@ -45,30 +45,30 @@ var Pagination = /*#__PURE__*/memo(function (_ref) {
45
45
  onClick: function onClick() {
46
46
  return onPageChange(pg);
47
47
  },
48
- className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === pg && "bg-primary-500 text-white pointer-events-none"),
48
+ className: cn("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer", page === pg && "bg-primary-500 text-white pointer-events-none"),
49
49
  children: pg + 1
50
50
  }, pg);
51
51
  })]
52
52
  });
53
- }, [start, mid, last, page]);
53
+ }, [start, mid, last, page, onPageChange]);
54
54
  return /*#__PURE__*/jsxs("div", {
55
55
  className: "inline-flex items-center",
56
56
  children: [/*#__PURE__*/jsx("button", {
57
57
  onClick: function onClick() {
58
58
  return onPageChange(0);
59
59
  },
60
- className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === 0 && "pointer-events-none text-tint-300"),
60
+ className: cn("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer", page === 0 && "pointer-events-none text-tint-300"),
61
61
  children: /*#__PURE__*/jsx(Icon, {
62
- icon: CoreIcons.chevronsLeft,
62
+ icon: "icon-[mdi--chevron-double-left]",
63
63
  rtlFlip: true
64
64
  })
65
65
  }), /*#__PURE__*/jsx("button", {
66
66
  onClick: function onClick() {
67
67
  return onPageChange(page - 1);
68
68
  },
69
- className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === 0 && "pointer-events-none text-tint-300"),
69
+ className: cn("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer", page === 0 && "pointer-events-none text-tint-300"),
70
70
  children: /*#__PURE__*/jsx(Icon, {
71
- icon: CoreIcons.chevronLeft,
71
+ icon: "icon-[mdi--chevron-left]",
72
72
  rtlFlip: true
73
73
  })
74
74
  }), !minimal && pageBody, minimal && /*#__PURE__*/jsxs("label", {
@@ -78,23 +78,32 @@ var Pagination = /*#__PURE__*/memo(function (_ref) {
78
78
  onClick: function onClick() {
79
79
  return onPageChange(page + 1);
80
80
  },
81
- className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page + 1 >= totalPages && "pointer-events-none text-tint-300"),
81
+ className: cn("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer", page + 1 >= totalPages && "pointer-events-none text-tint-300"),
82
82
  children: /*#__PURE__*/jsx(Icon, {
83
- icon: CoreIcons.chevronRight,
83
+ icon: "icon-[mdi--chevron-right]",
84
84
  rtlFlip: true
85
85
  })
86
86
  }), /*#__PURE__*/jsx("button", {
87
87
  onClick: function onClick() {
88
88
  return onPageChange(totalPages - 1);
89
89
  },
90
- className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page + 1 >= totalPages && "pointer-events-none text-tint-300"),
90
+ className: cn("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer", page + 1 >= totalPages && "pointer-events-none text-tint-300"),
91
91
  children: /*#__PURE__*/jsx(Icon, {
92
- icon: CoreIcons.chevronsRight,
92
+ icon: "icon-[mdi--chevron-double-right]",
93
93
  rtlFlip: true
94
94
  })
95
95
  })]
96
96
  });
97
- });
97
+ };
98
+
99
+ /**
100
+ * Pagination component to navigate through pages of data.
101
+ * It displays buttons for navigating to the first, previous, next, and last pages,
102
+ * as well as buttons for specific page numbers based on the provided ranges.
103
+ * The component supports a minimal view that shows the current page and total pages.
104
+ * It uses memoization to optimize rendering performance.
105
+ */
106
+ var Pagination = /*#__PURE__*/memo(PaginationComponent);
98
107
  Pagination.displayName = "Pagination";
99
108
 
100
109
  export { Pagination };
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { Dropdown, Icon, CoreIcons, Menu, MenuItem } from '@react-fabric/core';
3
+ import { Dropdown, Icon, Menu, MenuItem } from '@react-fabric/core';
4
4
  import { jsx, jsxs } from 'react/jsx-runtime';
5
5
 
6
6
  /*
@@ -26,15 +26,15 @@ import { jsx, jsxs } from 'react/jsx-runtime';
26
26
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
27
  */
28
28
 
29
- var AddColumn = function AddColumn(_ref) {
29
+ function AddColumn(_ref) {
30
30
  var columns = _ref.columns,
31
31
  onClick = _ref.onClick;
32
32
  return /*#__PURE__*/jsx("div", {
33
- className: "group font-medium w-6 flex flex-nowrap text-start items-end",
33
+ className: "group font-medium w-6 flex flex-nowrap text-start items-center",
34
34
  children: /*#__PURE__*/jsxs(Dropdown, {
35
35
  placement: "bottom-end",
36
36
  children: [/*#__PURE__*/jsx(Icon, {
37
- icon: CoreIcons.insert,
37
+ icon: "icon-[mdi--plus-circle-outline]",
38
38
  className: "p-1 rounded-t rounded-b-none hover:outline"
39
39
  }), /*#__PURE__*/jsx(Menu, {
40
40
  className: "text-sm",
@@ -45,12 +45,12 @@ var AddColumn = function AddColumn(_ref) {
45
45
  id: String(col.id),
46
46
  "data-dropdown-dismiss": "false",
47
47
  label: "".concat((_col$label = col.label) !== null && _col$label !== void 0 ? _col$label : String(col.id)),
48
- icon: !col.hidden ? CoreIcons.tick : ""
48
+ icon: !col.hidden ? "icon-[mdi--check]" : ""
49
49
  }, String(col.id));
50
50
  })
51
51
  })]
52
52
  })
53
53
  });
54
- };
54
+ }
55
55
 
56
56
  export { AddColumn };
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { DateDisplay } from '@react-fabric/date';
4
- import { getByPath, isTrue, Format } from '@react-fabric/utilities';
5
- import classNames from 'classnames';
4
+ import { getByPath, isTrue, Format, isObject, isArray, cn } from '@react-fabric/utilities';
6
5
  import { useMemo } from 'react';
7
- import { useTableContext } from './Context.js';
8
- import { COL_DEFAULT_WIDTH, COL_MIN_WIDTH, COL_MAX_WIDTH } from './types.js';
6
+ import { useTableContext } from './context.js';
7
+ import { COL_MAX_WIDTH, COL_MIN_WIDTH, COL_DEFAULT_WIDTH } from './types.js';
9
8
  import { jsx } from 'react/jsx-runtime';
10
9
 
11
10
  /*
@@ -31,7 +30,7 @@ import { jsx } from 'react/jsx-runtime';
31
30
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
31
  */
33
32
 
34
- var BodyCell = function BodyCell(_ref) {
33
+ function BodyCell(_ref) {
35
34
  var _column$minWidth, _column$maxWidth;
36
35
  var column = _ref.column,
37
36
  item = _ref.item,
@@ -43,24 +42,26 @@ var BodyCell = function BodyCell(_ref) {
43
42
  return (_widths$get = widths.get(column.id.toString())) !== null && _widths$get !== void 0 ? _widths$get : column.width;
44
43
  }, [widths, column]);
45
44
  var content = useMemo(function () {
45
+ var _column$dataType2, _ref2;
46
46
  var value = getByPath(item, column.id.toString());
47
47
  if (column.renderer != null) {
48
- return column.renderer(item[column.id], item, index);
48
+ return column.renderer(value, item, index);
49
49
  }
50
50
  if (column.dataType === "boolean") {
51
51
  var _column$valueMap;
52
52
  var map = (_column$valueMap = column.valueMap) !== null && _column$valueMap !== void 0 ? _column$valueMap : {
53
53
  "true": "Yes",
54
- "false": "no"
54
+ "false": "No"
55
55
  };
56
56
  return map["".concat(isTrue(value) ? "true" : "false")];
57
57
  }
58
58
  if (column.valueMap != null) {
59
- if (column.dataType === "string" && value in column.valueMap) {
59
+ var _column$dataType;
60
+ if (["number", "string"].includes((_column$dataType = column.dataType) !== null && _column$dataType !== void 0 ? _column$dataType : "string") && value in column.valueMap) {
60
61
  return column.valueMap[value];
61
62
  }
62
63
  }
63
- if (column.dataType === "date") {
64
+ if (["date", "time", "datetime"].includes((_column$dataType2 = column.dataType) !== null && _column$dataType2 !== void 0 ? _column$dataType2 : "")) {
64
65
  return /*#__PURE__*/jsx(DateDisplay, {
65
66
  date: value,
66
67
  format: column.format
@@ -69,20 +70,26 @@ var BodyCell = function BodyCell(_ref) {
69
70
  if (column.dataType === "number") {
70
71
  return Format.number(value, column.format);
71
72
  }
72
- return value !== null && value !== void 0 ? value : "";
73
- }, [item, column]);
73
+ if (isObject(value)) {
74
+ return JSON.stringify(value);
75
+ }
76
+ if (isArray(value)) {
77
+ return value.join(", ");
78
+ }
79
+ return (_ref2 = value) !== null && _ref2 !== void 0 ? _ref2 : "";
80
+ }, [item, column, index]);
74
81
  return /*#__PURE__*/jsx("div", {
75
- className: "overflow-hidden bg-inherit start-0",
82
+ className: "overflow-hidden bg-inherit inset-s-0 border-e group/table-col",
76
83
  style: {
77
84
  width: width !== null && width !== void 0 ? width : COL_DEFAULT_WIDTH,
78
85
  minWidth: (_column$minWidth = column.minWidth) !== null && _column$minWidth !== void 0 ? _column$minWidth : COL_MIN_WIDTH,
79
86
  maxWidth: (_column$maxWidth = column.maxWidth) !== null && _column$maxWidth !== void 0 ? _column$maxWidth : COL_MAX_WIDTH
80
87
  },
81
88
  children: /*#__PURE__*/jsx("div", {
82
- className: classNames("px-2 py-1 border-e truncate", column.align === "center" && "text-center", column.align === "end" && "text-end"),
89
+ className: cn("px-2 py-1", column.className, column.truncate && "truncate", column.align === "center" && "text-center", column.align === "end" && "text-end"),
83
90
  children: content
84
91
  })
85
92
  });
86
- };
93
+ }
87
94
 
88
95
  export { BodyCell };
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
- import classNames from 'classnames';
3
+ import { Icon } from '@react-fabric/core';
4
+ import { cn } from '@react-fabric/utilities';
4
5
  import { BodyCell } from './BodyCell.js';
5
6
  import { CheckboxCell } from './CheckboxCell.js';
6
- import { Icon, CoreIcons } from '@react-fabric/core';
7
7
  import { jsxs, jsx } from 'react/jsx-runtime';
8
8
 
9
9
  /*
@@ -29,7 +29,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
29
29
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
30
  */
31
31
 
32
- var BodyRow = function BodyRow(_ref) {
32
+ function BodyRow(_ref) {
33
33
  var _state$start, _state$cols, _state$end;
34
34
  var rowKey = _ref.rowKey,
35
35
  index = _ref.index,
@@ -55,20 +55,21 @@ var BodyRow = function BodyRow(_ref) {
55
55
  children: [/*#__PURE__*/jsxs("div", {
56
56
  role: "none",
57
57
  "data-row": index,
58
- className: classNames("flex flex-nowrap datatable-row data-[hilight]:outline-1 -outline-offset-1 outline-primary-500", onRowClick && "hover:bg-primary-50 active:bg-primary-100"),
58
+ className: cn("flex flex-nowrap datatable-row data-hilight:outline-1 -outline-offset-1 outline-primary-500 group/table-row", !!onRowClick && "hover:bg-primary-50 active:bg-primary-100", index % 2 ? "bg-even" : "bg-odd"),
59
59
  onClick: function onClick() {
60
- return checkableRows && keyProperty && !onRowClick ? toggleChecked(data[keyProperty]) : onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data);
60
+ if (checkableRows && keyProperty && !onRowClick) toggleChecked(data[keyProperty]);else onRowClick === null || onRowClick === void 0 || onRowClick(data);
61
61
  },
62
62
  children: [/*#__PURE__*/jsxs("div", {
63
63
  className: wrapperStart,
64
- children: [!!canExpand && /*#__PURE__*/jsx("div", {
65
- className: classNames("group font-medium w-6 flex flex-nowrap text-start items-center", !canExpand(data) && "pointer-events-none opacity-35"),
64
+ children: [!!canExpand && /*#__PURE__*/jsx("button", {
65
+ type: "button",
66
+ className: cn("group font-medium w-6 flex flex-nowrap text-start py-1", !canExpand(data) && "pointer-events-none opacity-35"),
67
+ onClick: function onClick(e) {
68
+ return [keyProperty && toggleExpand(data[keyProperty]), e.stopPropagation()];
69
+ },
66
70
  children: /*#__PURE__*/jsx(Icon, {
67
71
  className: "p-1 text-tint-700 hover:text-primary-600",
68
- icon: expanded ? CoreIcons.collapse : CoreIcons.expand,
69
- onClick: function onClick(e) {
70
- return [keyProperty && toggleExpand(data[keyProperty]), e.stopPropagation()];
71
- }
72
+ icon: expanded ? "icon-[mdi--minus-box]" : "icon-[mdi--plus-box]"
72
73
  })
73
74
  }), checkableRows && keyProperty && /*#__PURE__*/jsx(CheckboxCell, {
74
75
  onClick: function onClick() {
@@ -76,32 +77,44 @@ var BodyRow = function BodyRow(_ref) {
76
77
  },
77
78
  state: checked
78
79
  }), (_state$start = state.start) === null || _state$start === void 0 ? void 0 : _state$start.map(function (col, ids) {
79
- return /*#__PURE__*/jsx(BodyCell, {
80
- column: col,
81
- item: data,
82
- index: ids
83
- }, "".concat(String(rowKey), ":").concat(ids));
80
+ return (
81
+ /*#__PURE__*/
82
+ // eslint-disable-next-line @eslint-react/no-array-index-key
83
+ jsx(BodyCell, {
84
+ column: col,
85
+ item: data,
86
+ index: ids
87
+ }, "".concat(String(rowKey), ":").concat(ids))
88
+ );
84
89
  })]
85
90
  }), (_state$cols = state.cols) === null || _state$cols === void 0 ? void 0 : _state$cols.map(function (col, idc) {
86
- return /*#__PURE__*/jsx(BodyCell, {
87
- column: col,
88
- item: data,
89
- index: idc
90
- }, "".concat(String(rowKey), ":").concat(idc));
91
+ return (
92
+ /*#__PURE__*/
93
+ // eslint-disable-next-line @eslint-react/no-array-index-key
94
+ jsx(BodyCell, {
95
+ column: col,
96
+ item: data,
97
+ index: idc
98
+ }, "".concat(String(rowKey), ":").concat(idc))
99
+ );
91
100
  }), /*#__PURE__*/jsxs("div", {
92
101
  className: wrapperEnd,
93
102
  children: [(_state$end = state.end) === null || _state$end === void 0 ? void 0 : _state$end.map(function (col, ide) {
94
- return /*#__PURE__*/jsx(BodyCell, {
95
- column: col,
96
- item: data,
97
- index: ide
98
- }, "".concat(String(rowKey), ":").concat(ide));
103
+ return (
104
+ /*#__PURE__*/
105
+ // eslint-disable-next-line @eslint-react/no-array-index-key
106
+ jsx(BodyCell, {
107
+ column: col,
108
+ item: data,
109
+ index: ide
110
+ }, "".concat(String(rowKey), ":").concat(ide))
111
+ );
99
112
  }), hideableColumns && /*#__PURE__*/jsx("div", {
100
113
  className: "w-6"
101
114
  })]
102
115
  })]
103
- }), expanded && expandRow(data)]
116
+ }), expanded && (expandRow === null || expandRow === void 0 ? void 0 : expandRow(data))]
104
117
  });
105
- };
118
+ }
106
119
 
107
120
  export { BodyRow };