@bsol-oss/react-datatable5 3.4.3 → 5.0.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 (32) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +12 -17
  3. package/dist/index.js +265 -117
  4. package/dist/index.mjs +217 -87
  5. package/dist/types/components/Controls/EditFilterButton.d.ts +1 -1
  6. package/dist/types/components/DataTable/DefaultTable.d.ts +2 -2
  7. package/dist/types/components/DataTable/Table.d.ts +4 -3
  8. package/dist/types/components/DataTable/TableComponent.d.ts +1 -1
  9. package/dist/types/components/DataTable/TableHeader.d.ts +2 -2
  10. package/dist/types/components/DataTable/TablePagination.d.ts +1 -3
  11. package/dist/types/components/DataTable/TextCell.d.ts +2 -3
  12. package/dist/types/components/Filter/GlobalFilter.d.ts +1 -3
  13. package/dist/types/components/ui/avatar.d.ts +17 -0
  14. package/dist/types/components/ui/button.d.ts +10 -0
  15. package/dist/types/components/ui/checkbox.d.ts +8 -0
  16. package/dist/types/components/ui/close-button.d.ts +4 -0
  17. package/dist/types/components/ui/color-mode.d.ts +17 -0
  18. package/dist/types/components/ui/dialog.d.ts +19 -0
  19. package/dist/types/components/ui/drawer.d.ts +19 -0
  20. package/dist/types/components/ui/empty-state.d.ts +8 -0
  21. package/dist/types/components/ui/field.d.ts +9 -0
  22. package/dist/types/components/ui/input-group.d.ts +12 -0
  23. package/dist/types/components/ui/menu.d.ts +24 -0
  24. package/dist/types/components/ui/popover.d.ts +17 -0
  25. package/dist/types/components/ui/provider.d.ts +2 -0
  26. package/dist/types/components/ui/radio.d.ts +8 -0
  27. package/dist/types/components/ui/select.d.ts +25 -0
  28. package/dist/types/components/ui/slider.d.ts +11 -0
  29. package/dist/types/components/ui/switch.d.ts +15 -0
  30. package/dist/types/components/ui/tag.d.ts +9 -0
  31. package/dist/types/components/ui/tooltip.d.ts +11 -0
  32. package/package.json +11 -10
package/dist/index.js CHANGED
@@ -4,19 +4,40 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var react = require('@chakra-ui/react');
5
5
  var ai = require('react-icons/ai');
6
6
  var md = require('react-icons/md');
7
+ var React = require('react');
8
+ var lu = require('react-icons/lu');
7
9
  var icons = require('@chakra-ui/icons');
8
- var react$1 = require('react');
9
10
  var io = require('react-icons/io');
10
11
  var reactTable = require('@tanstack/react-table');
11
12
  var matchSorterUtils = require('@tanstack/match-sorter-utils');
12
- var table = require('@chakra-ui/table');
13
13
  var bs = require('react-icons/bs');
14
14
  var gr = require('react-icons/gr');
15
15
  var io5 = require('react-icons/io5');
16
+ var hi = require('react-icons/hi');
17
+ var cg = require('react-icons/cg');
16
18
  var reactBeautifulDnd = require('react-beautiful-dnd');
17
19
  var fa = require('react-icons/fa');
18
20
  var axios = require('axios');
19
21
 
22
+ function _interopNamespaceDefault(e) {
23
+ var n = Object.create(null);
24
+ if (e) {
25
+ Object.keys(e).forEach(function (k) {
26
+ if (k !== 'default') {
27
+ var d = Object.getOwnPropertyDescriptor(e, k);
28
+ Object.defineProperty(n, k, d.get ? d : {
29
+ enumerable: true,
30
+ get: function () { return e[k]; }
31
+ });
32
+ }
33
+ });
34
+ }
35
+ n.default = e;
36
+ return Object.freeze(n);
37
+ }
38
+
39
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
40
+
20
41
  const DensityToggleButton = ({ text, icon = jsxRuntime.jsx(ai.AiOutlineColumnWidth, {}), }) => {
21
42
  const { table } = useDataTableContext();
22
43
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!!text === false && (jsxRuntime.jsx(react.IconButton, { variant: "ghost", "aria-label": "Toggle Density", icon: icon, onClick: () => {
@@ -26,17 +47,37 @@ const DensityToggleButton = ({ text, icon = jsxRuntime.jsx(ai.AiOutlineColumnWid
26
47
  }, children: text }))] }));
27
48
  };
28
49
 
29
- const EditFilterButton = ({ text, title = "Edit Filter", closeText = "Close", resetText = "Reset", icon = jsxRuntime.jsx(md.MdFilterAlt, {}), ...props }) => {
50
+ const CloseButton = React__namespace.forwardRef(function CloseButton(props, ref) {
51
+ return (jsxRuntime.jsx(react.IconButton, { variant: "ghost", "aria-label": "Close", ref: ref, ...props, children: props.children ?? jsxRuntime.jsx(lu.LuX, {}) }));
52
+ });
53
+
54
+ const DialogContent = React__namespace.forwardRef(function DialogContent(props, ref) {
55
+ const { children, portalled = true, portalRef, backdrop = true, ...rest } = props;
56
+ return (jsxRuntime.jsxs(react.Portal, { disabled: !portalled, container: portalRef, children: [backdrop && jsxRuntime.jsx(react.Dialog.Backdrop, {}), jsxRuntime.jsx(react.Dialog.Positioner, { children: jsxRuntime.jsx(react.Dialog.Content, { ref: ref, ...rest, asChild: false, children: children }) })] }));
57
+ });
58
+ const DialogCloseTrigger = React__namespace.forwardRef(function DialogCloseTrigger(props, ref) {
59
+ return (jsxRuntime.jsx(react.Dialog.CloseTrigger, { position: "absolute", top: "2", insetEnd: "2", ...props, asChild: true, children: jsxRuntime.jsx(CloseButton, { size: "sm", ref: ref, children: props.children }) }));
60
+ });
61
+ const DialogRoot = react.Dialog.Root;
62
+ const DialogFooter = react.Dialog.Footer;
63
+ const DialogHeader = react.Dialog.Header;
64
+ const DialogBody = react.Dialog.Body;
65
+ react.Dialog.Backdrop;
66
+ const DialogTitle = react.Dialog.Title;
67
+ react.Dialog.Description;
68
+ const DialogTrigger = react.Dialog.Trigger;
69
+ const DialogActionTrigger = react.Dialog.ActionTrigger;
70
+
71
+ const EditFilterButton = ({ text, title = "Edit Filter", closeText = "Close", resetText = "Reset", icon = jsxRuntime.jsx(md.MdFilterAlt, {}), }) => {
30
72
  const filterModal = react.useDisclosure();
31
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!!text === false && (jsxRuntime.jsx(react.IconButton, { icon: icon, variant: "ghost", onClick: filterModal.onOpen, "aria-label": "filter", ...props })), !!text !== false && (jsxRuntime.jsx(react.Button, { leftIcon: icon, variant: "ghost", onClick: filterModal.onOpen, ...props, children: text })), jsxRuntime.jsxs(react.Modal, { isOpen: filterModal.isOpen, onClose: filterModal.onClose, size: ["full", "full", "md", "md"], children: [jsxRuntime.jsx(react.ModalOverlay, {}), jsxRuntime.jsxs(react.ModalContent, { children: [jsxRuntime.jsx(react.ModalHeader, { children: title }), jsxRuntime.jsx(react.ModalCloseButton, {}), jsxRuntime.jsx(react.ModalBody, { children: jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "1rem", children: [jsxRuntime.jsx(TableFilter, {}), jsxRuntime.jsx(ResetFilteringButton, { text: resetText })] }) }), jsxRuntime.jsx(react.ModalFooter, { children: jsxRuntime.jsx(react.Button, { onClick: filterModal.onClose, children: closeText }) })] })] })] }));
73
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(DialogRoot, { size: ["full", "full", "md", "md"], children: jsxRuntime.jsxs(DialogRoot, { children: [jsxRuntime.jsx(DialogTrigger, { asChild: true, children: jsxRuntime.jsxs(react.Button, { variant: "outline", children: [icon, " ", text] }) }), jsxRuntime.jsxs(DialogContent, { children: [jsxRuntime.jsx(DialogHeader, { children: jsxRuntime.jsx(DialogTitle, { children: title }) }), jsxRuntime.jsx(DialogBody, { children: jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "1rem", children: [jsxRuntime.jsx(TableFilter, {}), jsxRuntime.jsx(ResetFilteringButton, { text: resetText })] }) }), jsxRuntime.jsxs(DialogFooter, { children: [jsxRuntime.jsx(DialogActionTrigger, { asChild: true, children: jsxRuntime.jsx(react.Button, { onClick: filterModal.onClose, children: closeText }) }), jsxRuntime.jsx(react.Button, { children: "Save" })] }), jsxRuntime.jsx(DialogCloseTrigger, {})] })] }) }) }));
32
74
  };
33
75
 
34
76
  const EditOrderButton = ({ text, icon = jsxRuntime.jsx(md.MdOutlineMoveDown, {}), title = "Change Order", }) => {
35
- const orderModal = react.useDisclosure();
36
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!!text === false && (jsxRuntime.jsx(react.IconButton, { icon: icon, variant: "ghost", onClick: orderModal.onOpen, "aria-label": "change order" })), !!text !== false && (jsxRuntime.jsx(react.Button, { leftIcon: icon, variant: "ghost", onClick: orderModal.onOpen, children: text })), jsxRuntime.jsxs(react.Modal, { isOpen: orderModal.isOpen, onClose: orderModal.onClose, size: ["full", "full", "md", "md"], children: [jsxRuntime.jsx(react.ModalOverlay, {}), jsxRuntime.jsxs(react.ModalContent, { padding: "0 0 1rem 0", children: [jsxRuntime.jsx(react.ModalHeader, { children: title }), jsxRuntime.jsx(react.ModalCloseButton, {}), jsxRuntime.jsx(react.ModalBody, { children: jsxRuntime.jsx(react.Flex, { flexFlow: "column", gap: "0.25rem", children: jsxRuntime.jsx(TableOrderer, {}) }) })] })] })] }));
77
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(react.DialogRoot, { size: "cover", children: [jsxRuntime.jsx(react.DialogBackdrop, {}), jsxRuntime.jsx(react.DialogTrigger, { asChild: true, children: jsxRuntime.jsxs(react.Button, { variant: "ghost", children: [icon, text] }) }), jsxRuntime.jsxs(react.DialogContent, { children: [jsxRuntime.jsx(react.DialogCloseTrigger, {}), jsxRuntime.jsxs(react.DialogHeader, { children: [jsxRuntime.jsx(react.DialogTitle, {}), title] }), jsxRuntime.jsx(react.DialogBody, { children: jsxRuntime.jsx(react.Flex, { flexFlow: "column", gap: "0.25rem", children: jsxRuntime.jsx(TableOrderer, {}) }) }), jsxRuntime.jsx(react.DialogFooter, {})] })] }) }));
37
78
  };
38
79
 
39
- const TableContext = react$1.createContext({
80
+ const TableContext = React.createContext({
40
81
  table: {},
41
82
  refreshData: () => { },
42
83
  globalFilter: "",
@@ -46,7 +87,7 @@ const TableContext = react$1.createContext({
46
87
  });
47
88
 
48
89
  const useDataTableContext = () => {
49
- const { table, refreshData, globalFilter, setGlobalFilter, loading, hasError, } = react$1.useContext(TableContext);
90
+ const { table, refreshData, globalFilter, setGlobalFilter, loading, hasError, } = React.useContext(TableContext);
50
91
  return {
51
92
  table,
52
93
  refreshData,
@@ -73,19 +114,50 @@ const TableSorter = () => {
73
114
 
74
115
  const EditSortingButton = ({ text, icon = jsxRuntime.jsx(md.MdOutlineSort, {}), title = "Edit Sorting", }) => {
75
116
  const sortingModal = react.useDisclosure();
76
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!!text === false && (jsxRuntime.jsx(react.IconButton, { icon: icon, variant: "ghost", onClick: sortingModal.onOpen, "aria-label": "change sorting" })), !!text !== false && (jsxRuntime.jsx(react.Button, { leftIcon: icon, variant: "ghost", onClick: sortingModal.onOpen, children: text })), jsxRuntime.jsxs(react.Modal, { isOpen: sortingModal.isOpen, onClose: sortingModal.onClose, size: ["full", "full", "md", "md"], children: [jsxRuntime.jsx(react.ModalOverlay, {}), jsxRuntime.jsxs(react.ModalContent, { padding: "0 0 1rem 0", children: [jsxRuntime.jsx(react.ModalHeader, { children: title }), jsxRuntime.jsx(react.ModalCloseButton, {}), jsxRuntime.jsx(react.ModalBody, { children: jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(TableSorter, {}), jsxRuntime.jsx(ResetSortingButton, {})] }) })] })] })] }));
117
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(DialogRoot, { size: ["full", "full", "md", "md"], children: [jsxRuntime.jsx(react.DialogBackdrop, {}), jsxRuntime.jsx(DialogTrigger, { children: jsxRuntime.jsxs(react.Button, { variant: "ghost", onClick: sortingModal.onOpen, children: [icon, " ", text] }) }), jsxRuntime.jsxs(DialogContent, { children: [jsxRuntime.jsx(DialogCloseTrigger, {}), jsxRuntime.jsxs(DialogHeader, { children: [jsxRuntime.jsx(DialogTitle, {}), title] }), jsxRuntime.jsx(DialogBody, { children: jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(TableSorter, {}), jsxRuntime.jsx(ResetSortingButton, {})] }) }), jsxRuntime.jsx(DialogFooter, {})] })] }) }));
77
118
  };
78
119
 
79
120
  const EditViewButton = ({ text, icon = jsxRuntime.jsx(io.IoMdEye, {}), title = "Edit View", }) => {
80
121
  const viewModel = react.useDisclosure();
81
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!!text === false && (jsxRuntime.jsx(react.IconButton, { icon: icon, variant: "ghost", onClick: viewModel.onOpen, "aria-label": "change sorting" })), !!text !== false && (jsxRuntime.jsx(react.Button, { leftIcon: icon, variant: "ghost", onClick: viewModel.onOpen, children: text })), jsxRuntime.jsxs(react.Modal, { isOpen: viewModel.isOpen, onClose: viewModel.onClose, size: ["full", "full", "md", "md"], children: [jsxRuntime.jsx(react.ModalOverlay, {}), jsxRuntime.jsxs(react.ModalContent, { padding: "0 0 1rem 0", children: [jsxRuntime.jsx(react.ModalHeader, { children: title }), jsxRuntime.jsx(react.ModalCloseButton, {}), jsxRuntime.jsx(react.ModalBody, { children: jsxRuntime.jsx(TableViewer, {}) })] })] })] }));
122
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(DialogRoot, { children: [jsxRuntime.jsx(react.DialogBackdrop, {}), jsxRuntime.jsx(DialogTrigger, { children: jsxRuntime.jsxs(react.Button, { variant: "ghost", onClick: viewModel.onOpen, children: [icon, " ", text] }) }), jsxRuntime.jsxs(DialogContent, { children: [jsxRuntime.jsx(DialogCloseTrigger, {}), jsxRuntime.jsxs(DialogHeader, { children: [jsxRuntime.jsx(DialogTitle, {}), title] }), jsxRuntime.jsx(DialogBody, { children: jsxRuntime.jsx(TableViewer, {}) }), jsxRuntime.jsx(DialogFooter, {})] })] }) }));
82
123
  };
83
124
 
125
+ const MenuContent = React__namespace.forwardRef(function MenuContent(props, ref) {
126
+ const { portalled = true, portalRef, ...rest } = props;
127
+ return (jsxRuntime.jsx(react.Portal, { disabled: !portalled, container: portalRef, children: jsxRuntime.jsx(react.Menu.Positioner, { children: jsxRuntime.jsx(react.Menu.Content, { ref: ref, ...rest }) }) }));
128
+ });
129
+ React__namespace.forwardRef(function MenuArrow(props, ref) {
130
+ return (jsxRuntime.jsx(react.Menu.Arrow, { ref: ref, ...props, children: jsxRuntime.jsx(react.Menu.ArrowTip, {}) }));
131
+ });
132
+ React__namespace.forwardRef(function MenuCheckboxItem(props, ref) {
133
+ return (jsxRuntime.jsxs(react.Menu.CheckboxItem, { ref: ref, ...props, children: [jsxRuntime.jsx(react.Menu.ItemIndicator, { hidden: false, children: jsxRuntime.jsx(lu.LuCheck, {}) }), props.children] }));
134
+ });
135
+ React__namespace.forwardRef(function MenuRadioItem(props, ref) {
136
+ const { children, ...rest } = props;
137
+ return (jsxRuntime.jsxs(react.Menu.RadioItem, { ps: "8", ref: ref, ...rest, children: [jsxRuntime.jsx(react.AbsoluteCenter, { axis: "horizontal", left: "4", asChild: true, children: jsxRuntime.jsx(react.Menu.ItemIndicator, { children: jsxRuntime.jsx(lu.LuCheck, {}) }) }), jsxRuntime.jsx(react.Menu.ItemText, { children: children })] }));
138
+ });
139
+ React__namespace.forwardRef(function MenuItemGroup(props, ref) {
140
+ const { title, children, ...rest } = props;
141
+ return (jsxRuntime.jsxs(react.Menu.ItemGroup, { ref: ref, ...rest, children: [title && (jsxRuntime.jsx(react.Menu.ItemGroupLabel, { userSelect: "none", children: title })), children] }));
142
+ });
143
+ React__namespace.forwardRef(function MenuTriggerItem(props, ref) {
144
+ const { startIcon, children, ...rest } = props;
145
+ return (jsxRuntime.jsxs(react.Menu.TriggerItem, { ref: ref, ...rest, children: [startIcon, children, jsxRuntime.jsx(lu.LuChevronRight, {})] }));
146
+ });
147
+ react.Menu.RadioItemGroup;
148
+ react.Menu.ContextTrigger;
149
+ const MenuRoot = react.Menu.Root;
150
+ react.Menu.Separator;
151
+ const MenuItem = react.Menu.Item;
152
+ react.Menu.ItemText;
153
+ react.Menu.ItemCommand;
154
+ const MenuTrigger = react.Menu.Trigger;
155
+
84
156
  const PageSizeControl = ({ pageSizes = [10, 20, 30, 40, 50], }) => {
85
157
  const { table } = useDataTableContext();
86
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(react.Menu, { children: [jsxRuntime.jsx(react.MenuButton, { as: react.Button, variant: "ghost", rightIcon: jsxRuntime.jsx(icons.ChevronDownIcon, {}), gap: "0.5rem", children: table.getState().pagination.pageSize }), jsxRuntime.jsx(react.MenuList, { children: pageSizes.map((pageSize) => (jsxRuntime.jsx(react.MenuItem, { onClick: () => {
158
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(MenuRoot, { children: [jsxRuntime.jsx(MenuTrigger, { asChild: true, children: jsxRuntime.jsxs(react.Button, { variant: "ghost", gap: "0.5rem", children: [table.getState().pagination.pageSize, " ", jsxRuntime.jsx(icons.ChevronDownIcon, {})] }) }), jsxRuntime.jsx(MenuContent, { children: pageSizes.map((pageSize) => (jsxRuntime.jsx(MenuItem, { value: `chakra-table-pageSize-${pageSize}`, onClick: () => {
87
159
  table.setPageSize(Number(pageSize));
88
- }, children: pageSize }, `chakra-table-pageSize-${pageSize}`))) })] }) }));
160
+ }, children: pageSize }))) })] }) }));
89
161
  };
90
162
 
91
163
  const ResetFilteringButton = ({ text = "Reset Filtering", }) => {
@@ -245,10 +317,10 @@ const DataTable = ({ columns, data, enableRowSelection = true, enableMultiRowSel
245
317
  onDensityChange: setDensity,
246
318
  onColumnVisibilityChange: setColumnVisibility,
247
319
  });
248
- react$1.useEffect(() => {
320
+ React.useEffect(() => {
249
321
  setColumnOrder(table.getAllLeafColumns().map((column) => column.id));
250
322
  }, []);
251
- react$1.useEffect(() => {
323
+ React.useEffect(() => {
252
324
  onRowSelect(table.getState().rowSelection, data);
253
325
  }, [table.getState().rowSelection]);
254
326
  return (jsxRuntime.jsx(TableContext.Provider, { value: {
@@ -311,13 +383,13 @@ const DataTableServer = ({ columns, enableRowSelection = true, enableMultiRowSel
311
383
  },
312
384
  // for tanstack-table ts bug end
313
385
  });
314
- react$1.useEffect(() => {
386
+ React.useEffect(() => {
315
387
  setColumnOrder(table.getAllLeafColumns().map((column) => column.id));
316
388
  }, []);
317
- react$1.useEffect(() => {
389
+ React.useEffect(() => {
318
390
  onRowSelect(table.getState().rowSelection, data.results);
319
391
  }, [table.getState().rowSelection]);
320
- react$1.useEffect(() => {
392
+ React.useEffect(() => {
321
393
  table.resetPagination();
322
394
  }, [sorting, columnFilters, globalFilter]);
323
395
  return (jsxRuntime.jsx(TableContext.Provider, { value: {
@@ -330,6 +402,11 @@ const DataTableServer = ({ columns, enableRowSelection = true, enableMultiRowSel
330
402
  }, children: children }));
331
403
  };
332
404
 
405
+ const Tag = React__namespace.forwardRef(function Tag(props, ref) {
406
+ const { startElement, endElement, onClose, closable = !!onClose, children, ...rest } = props;
407
+ return (jsxRuntime.jsxs(react.Tag.Root, { ref: ref, ...rest, children: [startElement && (jsxRuntime.jsx(react.Tag.StartElement, { children: startElement })), jsxRuntime.jsx(react.Tag.Label, { children: children }), endElement && (jsxRuntime.jsx(react.Tag.EndElement, { children: endElement })), closable && (jsxRuntime.jsx(react.Tag.EndElement, { children: jsxRuntime.jsx(react.Tag.CloseTrigger, { onClick: onClose }) }))] }));
408
+ });
409
+
333
410
  const DefaultCard = ({ row, imageColumnId = undefined, titleColumnId = undefined, tagColumnId = undefined, tagIcon = undefined, showTag = true, }) => {
334
411
  if (!!row.original === false) {
335
412
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
@@ -343,13 +420,18 @@ const DefaultCard = ({ row, imageColumnId = undefined, titleColumnId = undefined
343
420
  // const tagIdExists = Object.keys(row.original).some((key) => {
344
421
  // return key === tagColumnId;
345
422
  // });
346
- return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto auto", gap: "1rem", children: [jsxRuntime.jsx(react.Flex, { justifyContent: "center", alignItems: "center", children: jsxRuntime.jsx(react.Image, { src: row.original[imageColumnId] }) }), jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", flexFlow: "wrap", children: [jsxRuntime.jsx(react.Text, { fontWeight: "bold", fontSize: "large", children: row.original[titleColumnId] }), showTag && (jsxRuntime.jsxs(react.Tag, { fontSize: "large", children: [jsxRuntime.jsx(react.TagLeftIcon, { as: tagIcon }), row.original[tagColumnId]] }))] })] }));
423
+ return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto auto", gap: "1rem", children: [jsxRuntime.jsx(react.Flex, { justifyContent: "center", alignItems: "center", children: jsxRuntime.jsx(react.Image, { src: row.original[imageColumnId] }) }), jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", flexFlow: "wrap", children: [jsxRuntime.jsx(react.Text, { fontWeight: "bold", fontSize: "large", children: row.original[titleColumnId] }), showTag && (jsxRuntime.jsx(Tag, { fontSize: "large", startElement: tagIcon && tagIcon({}), children: row.original[tagColumnId] }))] })] }));
347
424
  };
348
425
 
426
+ const Checkbox = React__namespace.forwardRef(function Checkbox(props, ref) {
427
+ const { icon, children, inputProps, rootRef, ...rest } = props;
428
+ return (jsxRuntime.jsxs(react.Checkbox.Root, { ref: rootRef, ...rest, children: [jsxRuntime.jsx(react.Checkbox.HiddenInput, { ref: ref, ...inputProps }), jsxRuntime.jsx(react.Checkbox.Control, { children: icon || jsxRuntime.jsx(react.Checkbox.Indicator, {}) }), children != null && (jsxRuntime.jsx(react.Checkbox.Label, { children: children }))] }));
429
+ });
430
+
349
431
  const TableBody = ({ pinnedBgColor = { light: "gray.50", dark: "gray.700" }, showSelector = false, alwaysShowSelector = true, }) => {
350
- const { table: table$1 } = react$1.useContext(TableContext);
432
+ const { table } = React.useContext(TableContext);
351
433
  const SELECTION_BOX_WIDTH = 20;
352
- const [hoveredRow, setHoveredRow] = react$1.useState(-1);
434
+ const [hoveredRow, setHoveredRow] = React.useState(-1);
353
435
  const handleRowHover = (index) => {
354
436
  setHoveredRow(index);
355
437
  };
@@ -357,11 +439,11 @@ const TableBody = ({ pinnedBgColor = { light: "gray.50", dark: "gray.700" }, sho
357
439
  const tdProps = cell.column.getIsPinned()
358
440
  ? {
359
441
  left: showSelector
360
- ? `${cell.column.getStart("left") + SELECTION_BOX_WIDTH + table$1.getDensityValue() * 2}px`
361
- : `${cell.column.getStart("left") + table$1.getDensityValue() * 2}px`,
442
+ ? `${cell.column.getStart("left") + SELECTION_BOX_WIDTH + table.getDensityValue() * 2}px`
443
+ : `${cell.column.getStart("left")}px`,
362
444
  background: pinnedBgColor.light,
363
445
  position: "sticky",
364
- zIndex: 1,
446
+ zIndex: -1,
365
447
  _dark: {
366
448
  backgroundColor: pinnedBgColor.dark,
367
449
  },
@@ -369,16 +451,16 @@ const TableBody = ({ pinnedBgColor = { light: "gray.50", dark: "gray.700" }, sho
369
451
  : {};
370
452
  return tdProps;
371
453
  };
372
- return (jsxRuntime.jsx(table.Tbody, { children: table$1.getRowModel().rows.map((row, index) => {
373
- return (jsxRuntime.jsxs(table.Tr, { display: "flex", _hover: { backgroundColor: "rgba(178,178,178,0.1)" }, zIndex: 1, onMouseEnter: () => handleRowHover(index), onMouseLeave: () => handleRowHover(-1), children: [showSelector && (jsxRuntime.jsx(TableRowSelector, { index: index, row: row, hoveredRow: hoveredRow, alwaysShowSelector: alwaysShowSelector })), row.getVisibleCells().map((cell, index) => {
374
- return (jsxRuntime.jsx(table.Td, { padding: `${table$1.getDensityValue()}px`,
454
+ return (jsxRuntime.jsx(react.Table.Body, { children: table.getRowModel().rows.map((row, index) => {
455
+ return (jsxRuntime.jsxs(react.Table.Row, { display: "flex", _hover: { backgroundColor: "rgba(178,178,178,0.1)" }, zIndex: 1, onMouseEnter: () => handleRowHover(index), onMouseLeave: () => handleRowHover(-1), children: [showSelector && (jsxRuntime.jsx(TableRowSelector, { index: index, row: row, hoveredRow: hoveredRow, alwaysShowSelector: alwaysShowSelector })), row.getVisibleCells().map((cell, index) => {
456
+ return (jsxRuntime.jsx(react.Table.Cell, { padding: `${table.getDensityValue()}px`,
375
457
  // styling resize and pinning start
376
458
  maxWidth: `${cell.column.getSize()}px`, width: `${cell.column.getSize()}px`, ...getTdProps(cell), children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) }, `chakra-table-rowcell-${cell.id}-${index}`));
377
459
  })] }, `chakra-table-row-${row.id}`));
378
460
  }) }));
379
461
  };
380
462
  const TableRowSelector = ({ index, row, hoveredRow, pinnedBgColor = { light: "gray.50", dark: "gray.700" }, alwaysShowSelector = true, }) => {
381
- const { table: table$1 } = react$1.useContext(TableContext);
463
+ const { table } = React.useContext(TableContext);
382
464
  const SELECTION_BOX_WIDTH = 20;
383
465
  const isCheckBoxVisible = (current_index, current_row) => {
384
466
  if (alwaysShowSelector) {
@@ -392,7 +474,7 @@ const TableRowSelector = ({ index, row, hoveredRow, pinnedBgColor = { light: "gr
392
474
  }
393
475
  return false;
394
476
  };
395
- return (jsxRuntime.jsxs(table.Td, { padding: `${table$1.getDensityValue()}px`, ...(table$1.getIsSomeColumnsPinned("left")
477
+ return (jsxRuntime.jsxs(react.Table.Cell, { padding: `${table.getDensityValue()}px`, ...(table.getIsSomeColumnsPinned("left")
396
478
  ? {
397
479
  left: `0px`,
398
480
  backgroundColor: pinnedBgColor.light,
@@ -402,15 +484,22 @@ const TableRowSelector = ({ index, row, hoveredRow, pinnedBgColor = { light: "gr
402
484
  }
403
485
  : {}),
404
486
  // styling resize and pinning end
405
- display: "grid", children: [!isCheckBoxVisible(index, row) && (jsxRuntime.jsx(react.Box, { as: "span", margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px` })), isCheckBoxVisible(index, row) && (jsxRuntime.jsx(react.FormLabel, { margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", children: jsxRuntime.jsx(react.Checkbox, { width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px`, isChecked: row.getIsSelected(),
487
+ display: "grid", children: [!isCheckBoxVisible(index, row) && (jsxRuntime.jsx(react.Box, { as: "span", margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px` })), isCheckBoxVisible(index, row) && (jsxRuntime.jsx(react.Box, { margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", children: jsxRuntime.jsx(Checkbox, { width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px`, isChecked: row.getIsSelected(),
406
488
  disabled: !row.getCanSelect(),
407
489
  // indeterminate: row.getIsSomeSelected(),
408
490
  onChange: row.getToggleSelectedHandler() }) }))] }));
409
491
  };
410
492
 
493
+ const Tooltip = React__namespace.forwardRef(function Tooltip(props, ref) {
494
+ const { showArrow, children, disabled, portalled, content, contentProps, portalRef, ...rest } = props;
495
+ if (disabled)
496
+ return children;
497
+ return (jsxRuntime.jsxs(react.Tooltip.Root, { ...rest, children: [jsxRuntime.jsx(react.Tooltip.Trigger, { asChild: true, children: children }), jsxRuntime.jsx(react.Portal, { disabled: !portalled, container: portalRef, children: jsxRuntime.jsx(react.Tooltip.Positioner, { children: jsxRuntime.jsxs(react.Tooltip.Content, { ref: ref, ...contentProps, children: [showArrow && (jsxRuntime.jsx(react.Tooltip.Arrow, { children: jsxRuntime.jsx(react.Tooltip.ArrowTip, {}) })), content] }) }) })] }));
498
+ });
499
+
411
500
  const TableControls = ({ totalText = "Total:", showFilter = false, fitTableWidth = false, fitTableHeight = false, isMobile = false, children = jsxRuntime.jsx(jsxRuntime.Fragment, {}), showFilterName = false, showFilterTags = false, showReload = false, filterOptions = [], extraItems = jsxRuntime.jsx(jsxRuntime.Fragment, {}), }) => {
412
501
  const { loading, hasError } = useDataTableContext();
413
- return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto auto auto 1fr auto", templateColumns: "1fr 1fr", width: fitTableWidth ? "fit-content" : "100%", height: fitTableHeight ? "fit-content" : "100%", justifySelf: "center", alignSelf: "center", gap: "0.5rem", children: [jsxRuntime.jsxs(react.Flex, { justifyContent: "space-between", gridColumn: "1 / span 2", children: [jsxRuntime.jsx(react.Box, { children: jsxRuntime.jsx(EditViewButton, { text: isMobile ? undefined : "View", icon: jsxRuntime.jsx(md.MdOutlineViewColumn, {}) }) }), jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", justifySelf: "end", children: [loading && jsxRuntime.jsx(react.Spinner, { size: "sm" }), hasError && (jsxRuntime.jsx(react.Tooltip, { label: "An error occurred while fetching data", children: jsxRuntime.jsx(react.Box, { children: jsxRuntime.jsx(react.Icon, { as: bs.BsExclamationCircleFill, color: "red.400" }) }) })), showFilter && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(GlobalFilter, {}), jsxRuntime.jsx(EditFilterButton, { text: isMobile ? undefined : "Advanced Filter" })] })), showReload && jsxRuntime.jsx(ReloadButton, {}), extraItems] })] }), jsxRuntime.jsx(react.Flex, { gridColumn: "1 / span 2", flexFlow: "column", gap: "0.5rem", children: filterOptions.map((column) => {
502
+ return (jsxRuntime.jsxs(react.Grid, { templateRows: "auto auto auto 1fr auto", templateColumns: "1fr 1fr", width: fitTableWidth ? "fit-content" : "100%", height: fitTableHeight ? "fit-content" : "100%", justifySelf: "center", alignSelf: "center", gap: "0.5rem", children: [jsxRuntime.jsxs(react.Flex, { justifyContent: "space-between", gridColumn: "1 / span 2", children: [jsxRuntime.jsx(react.Box, { children: jsxRuntime.jsx(EditViewButton, { text: isMobile ? undefined : "View", icon: jsxRuntime.jsx(md.MdOutlineViewColumn, {}) }) }), jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", justifySelf: "end", children: [loading && jsxRuntime.jsx(react.Spinner, { size: "sm" }), hasError && (jsxRuntime.jsx(Tooltip, { content: "An error occurred while fetching data", children: jsxRuntime.jsx(react.Icon, { as: bs.BsExclamationCircleFill, color: "red.400" }) })), showFilter && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(GlobalFilter, {}), jsxRuntime.jsx(EditFilterButton, { text: isMobile ? undefined : "Advanced Filter" })] })), showReload && jsxRuntime.jsx(ReloadButton, {}), extraItems] })] }), jsxRuntime.jsx(react.Flex, { gridColumn: "1 / span 2", flexFlow: "column", gap: "0.5rem", children: filterOptions.map((column) => {
414
503
  return (jsxRuntime.jsxs(react.Flex, { alignItems: "center", flexFlow: "wrap", gap: "0.5rem", children: [showFilterName && jsxRuntime.jsxs(react.Text, { children: [column, ":"] }), jsxRuntime.jsx(FilterOptions, { column: column })] }, column));
415
504
  }) }), jsxRuntime.jsx(react.Flex, { gridColumn: "1 / span 2", children: showFilterTags && jsxRuntime.jsx(TableFilterTags, {}) }), jsxRuntime.jsx(react.Box, { overflow: "auto", gridColumn: "1 / span 2", width: "100%", height: "100%", children: children }), jsxRuntime.jsxs(react.Flex, { gap: "1rem", alignItems: "center", children: [jsxRuntime.jsx(PageSizeControl, {}), jsxRuntime.jsxs(react.Flex, { children: [jsxRuntime.jsx(react.Text, { paddingRight: "0.5rem", children: totalText }), jsxRuntime.jsx(RowCountText, {})] })] }), jsxRuntime.jsx(react.Box, { justifySelf: "end", children: jsxRuntime.jsx(TablePagination, {}) })] }));
416
505
  };
@@ -418,7 +507,7 @@ const TableControls = ({ totalText = "Total:", showFilter = false, fitTableWidth
418
507
  const TableFooter = ({ pinnedBgColor = { light: "gray.50", dark: "gray.700" }, showSelector = false, alwaysShowSelector = true, }) => {
419
508
  const table = useDataTableContext().table;
420
509
  const SELECTION_BOX_WIDTH = 20;
421
- const [hoveredCheckBox, setHoveredCheckBox] = react$1.useState(false);
510
+ const [hoveredCheckBox, setHoveredCheckBox] = React.useState(false);
422
511
  const handleRowHover = (isHovered) => {
423
512
  setHoveredCheckBox(isHovered);
424
513
  };
@@ -450,7 +539,7 @@ const TableFooter = ({ pinnedBgColor = { light: "gray.50", dark: "gray.700" }, s
450
539
  : {};
451
540
  return thProps;
452
541
  };
453
- return (jsxRuntime.jsx(react.Tfoot, { children: table.getFooterGroups().map((footerGroup) => (jsxRuntime.jsxs(react.Tr, { display: "flex", children: [showSelector && (jsxRuntime.jsxs(react.Th
542
+ return (jsxRuntime.jsx(react.Table.Footer, { children: table.getFooterGroups().map((footerGroup) => (jsxRuntime.jsxs(react.Table.Row, { display: "flex", children: [showSelector && (jsxRuntime.jsxs(react.Table.Header
454
543
  // styling resize and pinning start
455
544
  , {
456
545
  // styling resize and pinning start
@@ -464,21 +553,26 @@ const TableFooter = ({ pinnedBgColor = { light: "gray.50", dark: "gray.700" }, s
464
553
  }
465
554
  : {}),
466
555
  // styling resize and pinning end
467
- onMouseEnter: () => handleRowHover(true), onMouseLeave: () => handleRowHover(false), display: "grid", children: [isCheckBoxVisible() && (jsxRuntime.jsx(react.FormLabel, { margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", children: jsxRuntime.jsx(react.Checkbox, { width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px`, isChecked: table.getIsAllRowsSelected(),
556
+ onMouseEnter: () => handleRowHover(true), onMouseLeave: () => handleRowHover(false), display: "grid", children: [isCheckBoxVisible() && (jsxRuntime.jsx(react.Box, { margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", children: jsxRuntime.jsx(Checkbox, { width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px`, isChecked: table.getIsAllRowsSelected(),
468
557
  // indeterminate: table.getIsSomeRowsSelected(),
469
- onChange: table.getToggleAllRowsSelectedHandler() }) })), !isCheckBoxVisible() && (jsxRuntime.jsx(react.Box, { as: "span", margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px` }))] })), footerGroup.headers.map((header) => (jsxRuntime.jsx(react.Th, { padding: "0", colSpan: header.colSpan,
558
+ onChange: table.getToggleAllRowsSelectedHandler() }) })), !isCheckBoxVisible() && (jsxRuntime.jsx(react.Box, { as: "span", margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px` }))] })), footerGroup.headers.map((header) => (jsxRuntime.jsx(react.Table.Header, { padding: "0", columnSpan: `${header.colSpan}`,
470
559
  // styling resize and pinning start
471
- maxWidth: `${header.getSize()}px`, width: `${header.getSize()}px`, display: "grid", ...getThProps(header), children: jsxRuntime.jsx(react.Menu, { children: jsxRuntime.jsx(react.MenuButton, { as: react.Box, padding: `${table.getDensityValue()}px`, display: "flex", alignItems: "center", justifyContent: "start", borderRadius: "0rem", _hover: { backgroundColor: "gray.100" }, children: jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", children: [header.isPlaceholder
472
- ? null
473
- : reactTable.flexRender(header.column.columnDef.footer, header.getContext()), jsxRuntime.jsx(react.Box, { children: header.column.getCanSort() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [header.column.getIsSorted() === false && (
474
- // <UpDownIcon />
475
- jsxRuntime.jsx(jsxRuntime.Fragment, {})), header.column.getIsSorted() === "asc" && (jsxRuntime.jsx(icons.ChevronUpIcon, {})), header.column.getIsSorted() === "desc" && (jsxRuntime.jsx(icons.ChevronDownIcon, {}))] })) })] }) }) }) }, `chakra-table-footer-${footerGroup.id}`)))] }, `chakra-table-footergroup-${footerGroup.id}`))) }));
560
+ maxWidth: `${header.getSize()}px`, width: `${header.getSize()}px`, display: "grid", ...getThProps(header), children: jsxRuntime.jsx(react.MenuRoot, { children: jsxRuntime.jsx(react.MenuTrigger, { asChild: true, children: jsxRuntime.jsx(react.Box, { padding: `${table.getDensityValue()}px`, display: "flex", alignItems: "center", justifyContent: "start", borderRadius: "0rem", _hover: { backgroundColor: "gray.100" }, children: jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", children: [header.isPlaceholder
561
+ ? null
562
+ : reactTable.flexRender(header.column.columnDef.footer, header.getContext()), jsxRuntime.jsx(react.Box, { children: header.column.getCanSort() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [header.column.getIsSorted() === false && (
563
+ // <UpDownIcon />
564
+ jsxRuntime.jsx(jsxRuntime.Fragment, {})), header.column.getIsSorted() === "asc" && (jsxRuntime.jsx(icons.ChevronUpIcon, {})), header.column.getIsSorted() === "desc" && (jsxRuntime.jsx(icons.ChevronDownIcon, {}))] })) })] }) }) }) }) }, `chakra-table-footer-${footerGroup.id}`)))] }, `chakra-table-footergroup-${footerGroup.id}`))) }));
476
565
  };
477
566
 
567
+ const Button = React__namespace.forwardRef(function Button(props, ref) {
568
+ const { loading, disabled, loadingText, children, ...rest } = props;
569
+ return (jsxRuntime.jsx(react.Button, { disabled: loading || disabled, ref: ref, ...rest, children: loading && !loadingText ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.AbsoluteCenter, { display: "inline-flex", children: jsxRuntime.jsx(react.Spinner, { size: "inherit", color: "inherit" }) }), jsxRuntime.jsx(react.Span, { opacity: 0, children: children })] })) : loading && loadingText ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.Spinner, { size: "inherit", color: "inherit" }), loadingText] })) : (children) }));
570
+ });
571
+
478
572
  const TableHeader = ({ canResize, pinnedBgColor = { light: "gray.50", dark: "gray.700" }, showSelector = false, isSticky = true, alwaysShowSelector = true, tHeadProps = {}, }) => {
479
573
  const { table } = useDataTableContext();
480
574
  const SELECTION_BOX_WIDTH = 20;
481
- const [hoveredCheckBox, setHoveredCheckBox] = react$1.useState(false);
575
+ const [hoveredCheckBox, setHoveredCheckBox] = React.useState(false);
482
576
  const handleRowHover = (isHovered) => {
483
577
  setHoveredCheckBox(isHovered);
484
578
  };
@@ -499,7 +593,7 @@ const TableHeader = ({ canResize, pinnedBgColor = { light: "gray.50", dark: "gra
499
593
  ? {
500
594
  left: showSelector
501
595
  ? `${header.getStart("left") + SELECTION_BOX_WIDTH + table.getDensityValue() * 2}px`
502
- : `${header.getStart("left") + table.getDensityValue() * 2}px`,
596
+ : `${header.getStart("left")}px`,
503
597
  background: pinnedBgColor.light,
504
598
  position: "sticky",
505
599
  zIndex: 1,
@@ -510,10 +604,11 @@ const TableHeader = ({ canResize, pinnedBgColor = { light: "gray.50", dark: "gra
510
604
  : {};
511
605
  return thProps;
512
606
  };
513
- const stickyCssAttributes = {
607
+ const stickyProps = {
514
608
  position: "sticky",
609
+ top: 0,
515
610
  };
516
- return (jsxRuntime.jsx(react.Thead, { top: "0px", boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.1),0 1px 2px 0 rgba(0, 0, 0, 0.06)", ...(isSticky ? stickyCssAttributes : {}), ...tHeadProps, children: table.getHeaderGroups().map((headerGroup) => (jsxRuntime.jsxs(react.Tr, { display: "flex", children: [showSelector && (jsxRuntime.jsxs(react.Th
611
+ return (jsxRuntime.jsx(react.Table.Header, { ...(isSticky ? stickyProps : {}), ...tHeadProps, children: table.getHeaderGroups().map((headerGroup) => (jsxRuntime.jsxs(react.Table.Row, { display: "flex", children: [showSelector && (jsxRuntime.jsxs(react.Table.ColumnHeader
517
612
  // styling resize and pinning start
518
613
  , { ...(table.getIsSomeColumnsPinned("left")
519
614
  ? {
@@ -525,7 +620,7 @@ const TableHeader = ({ canResize, pinnedBgColor = { light: "gray.50", dark: "gra
525
620
  }
526
621
  : {}),
527
622
  // styling resize and pinning end
528
- padding: `${table.getDensityValue()}px`, onMouseEnter: () => handleRowHover(true), onMouseLeave: () => handleRowHover(false), display: "grid", children: [isCheckBoxVisible() && (jsxRuntime.jsx(react.FormLabel, { margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", children: jsxRuntime.jsx(react.Checkbox, { width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px`, isChecked: table.getIsAllRowsSelected(),
623
+ padding: `${table.getDensityValue()}px`, onMouseEnter: () => handleRowHover(true), onMouseLeave: () => handleRowHover(false), display: "grid", children: [isCheckBoxVisible() && (jsxRuntime.jsx(react.Box, { margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", children: jsxRuntime.jsx(Checkbox, { width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px`, isChecked: table.getIsAllRowsSelected(),
529
624
  // indeterminate: table.getIsSomeRowsSelected(),
530
625
  onChange: table.getToggleAllRowsSelectedHandler() }) })), !isCheckBoxVisible() && (jsxRuntime.jsx(react.Box, { as: "span", margin: "0rem", display: "grid", justifyItems: "center", alignItems: "center", width: `${SELECTION_BOX_WIDTH}px`, height: `${SELECTION_BOX_WIDTH}px` }))] })), headerGroup.headers.map((header) => {
531
626
  const resizeProps = {
@@ -533,15 +628,15 @@ const TableHeader = ({ canResize, pinnedBgColor = { light: "gray.50", dark: "gra
533
628
  onTouchStart: header.getResizeHandler(),
534
629
  cursor: "col-resize",
535
630
  };
536
- return (jsxRuntime.jsxs(react.Th, { padding: "0rem", colSpan: header.colSpan,
631
+ return (jsxRuntime.jsxs(react.Table.ColumnHeader, { padding: "0rem", columnSpan: `${header.colSpan}`,
537
632
  // styling resize and pinning start
538
- width: `${header.getSize()}px`, display: "grid", gridTemplateColumns: "1fr auto", zIndex: header.index, ...getThProps(header), children: [jsxRuntime.jsxs(react.Menu, { children: [jsxRuntime.jsx(react.MenuButton, { as: react.Grid, padding: `${table.getDensityValue()}px`, display: "flex", alignItems: "center", justifyContent: "start", borderRadius: "0rem", overflow: "auto", _hover: { backgroundColor: "gray.100" }, children: jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", children: [header.isPlaceholder
539
- ? null
540
- : reactTable.flexRender(header.column.columnDef.header, header.getContext()), jsxRuntime.jsx(react.Box, { children: header.column.getCanSort() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [header.column.getIsSorted() === false && jsxRuntime.jsx(jsxRuntime.Fragment, {}), header.column.getIsSorted() === "asc" && (jsxRuntime.jsx(icons.ChevronUpIcon, {})), header.column.getIsSorted() === "desc" && (jsxRuntime.jsx(icons.ChevronDownIcon, {}))] })) }), jsxRuntime.jsx(react.Box, { children: header.column.getIsFiltered() && jsxRuntime.jsx(md.MdFilterListAlt, {}) })] }) }), jsxRuntime.jsx(react.Portal, { children: jsxRuntime.jsxs(react.MenuList, { children: [!header.column.getIsPinned() && (jsxRuntime.jsx(react.MenuItem, { icon: jsxRuntime.jsx(md.MdPushPin, {}), onClick: () => {
633
+ width: `${header.getSize()}px`, display: "grid", gridTemplateColumns: "1fr auto", zIndex: header.index, ...getThProps(header), children: [jsxRuntime.jsxs(MenuRoot, { children: [jsxRuntime.jsx(MenuTrigger, { asChild: true, children: jsxRuntime.jsx(react.Grid, { padding: `${table.getDensityValue()}px`, display: "flex", alignItems: "center", justifyContent: "start", borderRadius: "0rem", overflow: "auto", _hover: { backgroundColor: "gray.100" }, children: jsxRuntime.jsxs(react.Flex, { gap: "0.5rem", alignItems: "center", children: [header.isPlaceholder
634
+ ? null
635
+ : reactTable.flexRender(header.column.columnDef.header, header.getContext()), jsxRuntime.jsx(react.Box, { children: header.column.getCanSort() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [header.column.getIsSorted() === false && jsxRuntime.jsx(jsxRuntime.Fragment, {}), header.column.getIsSorted() === "asc" && (jsxRuntime.jsx(icons.ChevronUpIcon, {})), header.column.getIsSorted() === "desc" && (jsxRuntime.jsx(icons.ChevronDownIcon, {}))] })) }), jsxRuntime.jsx(react.Box, { children: header.column.getIsFiltered() && jsxRuntime.jsx(md.MdFilterListAlt, {}) })] }) }) }), jsxRuntime.jsxs(MenuContent, { children: [!header.column.getIsPinned() && (jsxRuntime.jsx(MenuItem, { asChild: true, value: "pin-column", children: jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => {
541
636
  header.column.pin("left");
542
- }, children: "Pin Column" })), header.column.getIsPinned() && (jsxRuntime.jsx(react.MenuItem, { icon: jsxRuntime.jsx(md.MdCancel, {}), onClick: () => {
637
+ }, children: [jsxRuntime.jsx(md.MdPushPin, {}), "Pin Column"] }) })), header.column.getIsPinned() && (jsxRuntime.jsx(MenuItem, { asChild: true, value: "cancel-pin", children: jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => {
543
638
  header.column.pin(false);
544
- }, children: "Cancel Pin" })), header.column.getCanSort() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(react.MenuItem, { icon: jsxRuntime.jsx(gr.GrAscend, {}), onClick: () => {
639
+ }, children: [jsxRuntime.jsx(md.MdCancel, {}), "Cancel Pin"] }) })), header.column.getCanSort() && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MenuItem, { asChild: true, value: "sort-ascend", children: jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => {
545
640
  table.setSorting((state) => {
546
641
  return [
547
642
  ...state.filter((column) => {
@@ -550,7 +645,7 @@ const TableHeader = ({ canResize, pinnedBgColor = { light: "gray.50", dark: "gra
550
645
  { id: header.id, desc: false },
551
646
  ];
552
647
  });
553
- }, children: "Sort Ascending" }), jsxRuntime.jsx(react.MenuItem, { icon: jsxRuntime.jsx(gr.GrDescend, {}), onClick: () => {
648
+ }, children: [jsxRuntime.jsx(gr.GrAscend, {}), "Sort Ascending"] }) }), jsxRuntime.jsx(MenuItem, { asChild: true, value: "sort-descend", children: jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => {
554
649
  table.setSorting((state) => {
555
650
  return [
556
651
  ...state.filter((column) => {
@@ -559,9 +654,9 @@ const TableHeader = ({ canResize, pinnedBgColor = { light: "gray.50", dark: "gra
559
654
  { id: header.id, desc: true },
560
655
  ];
561
656
  });
562
- }, children: "Sort Descending" }), header.column.getIsSorted() && (jsxRuntime.jsx(react.MenuItem, { icon: jsxRuntime.jsx(md.MdClear, {}), onClick: () => {
657
+ }, children: [jsxRuntime.jsx(gr.GrDescend, {}), "Sort Descending"] }) }), header.column.getIsSorted() && (jsxRuntime.jsx(MenuItem, { asChild: true, value: "sort-descend", children: jsxRuntime.jsxs(Button, { variant: "ghost", onClick: () => {
563
658
  header.column.clearSorting();
564
- }, children: "Clear Sorting" }))] }))] }) })] }), canResize && (jsxRuntime.jsx(react.Box, { borderRight: "0.2rem solid", borderRightColor: header.column.getIsResizing() ? "gray.700" : "transparent", position: "relative", right: "0.1rem", width: "2px", height: "100%", userSelect: "none", style: { touchAction: "none" }, _hover: {
659
+ }, children: [jsxRuntime.jsx(md.MdClear, {}), "Clear Sorting"] }) }))] }))] })] }), canResize && (jsxRuntime.jsx(react.Box, { borderRight: "0.2rem solid", borderRightColor: header.column.getIsResizing() ? "gray.700" : "transparent", position: "relative", right: "0.1rem", width: "2px", height: "100%", userSelect: "none", style: { touchAction: "none" }, _hover: {
565
660
  borderRightColor: header.column.getIsResizing()
566
661
  ? "gray.700"
567
662
  : "gray.400",
@@ -576,21 +671,27 @@ const DefaultTable = ({ totalText = "Total:", showFilter = false, showFooter = f
576
671
  const ReloadButton = ({ text = "Reload", variant = "icon", }) => {
577
672
  const { refreshData } = useDataTableContext();
578
673
  if (variant === "icon") {
579
- return (jsxRuntime.jsx(react.Tooltip, { label: "refresh", children: jsxRuntime.jsx(react.IconButton, { variant: "ghost", icon: jsxRuntime.jsx(io5.IoReload, {}), onClick: () => {
674
+ return (jsxRuntime.jsx(Tooltip, { showArrow: true, content: "This is the tooltip content", children: jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => {
580
675
  refreshData();
581
- }, "aria-label": "refresh" }) }));
676
+ }, "aria-label": "refresh", children: jsxRuntime.jsx(io5.IoReload, {}) }) }));
582
677
  }
583
- return (jsxRuntime.jsx(react.Button, { variant: "ghost", leftIcon: jsxRuntime.jsx(io5.IoReload, {}), onClick: () => {
678
+ return (jsxRuntime.jsx(Button, { variant: "ghost", leftIcon: jsxRuntime.jsx(io5.IoReload, {}), onClick: () => {
584
679
  refreshData();
585
680
  }, children: text }));
586
681
  };
587
682
 
588
- const Table = ({ children, showLoading = false, loadingComponent = jsxRuntime.jsx(jsxRuntime.Fragment, { children: "Loading..." }), ...props }) => {
589
- const { table, loading } = useDataTableContext();
590
- if (showLoading) {
591
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [loading && loadingComponent, !loading && (jsxRuntime.jsx(react.Table, { width: table.getCenterTotalSize(), overflow: "auto", ...props, children: children }))] }));
683
+ const EmptyState = React__namespace.forwardRef(function EmptyState(props, ref) {
684
+ const { title, description, icon, children, ...rest } = props;
685
+ return (jsxRuntime.jsx(react.EmptyState.Root, { ref: ref, ...rest, children: jsxRuntime.jsxs(react.EmptyState.Content, { children: [icon && (jsxRuntime.jsx(react.EmptyState.Indicator, { children: icon })), description ? (jsxRuntime.jsxs(react.VStack, { textAlign: "center", children: [jsxRuntime.jsx(react.EmptyState.Title, { children: title }), jsxRuntime.jsx(react.EmptyState.Description, { children: description })] })) : (jsxRuntime.jsx(react.EmptyState.Title, { children: title })), children] }) }));
686
+ });
687
+
688
+ const EmptyResult = (jsxRuntime.jsx(EmptyState, { icon: jsxRuntime.jsx(hi.HiColorSwatch, {}), title: "No results found", description: "Try adjusting your search", children: jsxRuntime.jsxs(react.List.Root, { variant: "marker", children: [jsxRuntime.jsx(react.List.Item, { children: "Try removing filters" }), jsxRuntime.jsx(react.List.Item, { children: "Try different keywords" })] }) }));
689
+ const Table = ({ children, emptyComponent = EmptyResult, ...props }) => {
690
+ const { table } = useDataTableContext();
691
+ if (table.getRowModel().rows.length <= 0) {
692
+ return emptyComponent;
592
693
  }
593
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(react.Table, { width: table.getCenterTotalSize(), overflowX: "auto", ...props, children: children }) }));
694
+ return (jsxRuntime.jsx(react.Table.Root, { stickyHeader: true, variant: "outline", width: table.getCenterTotalSize(), ...props, children: children }));
594
695
  };
595
696
 
596
697
  const TableCardContainer = ({ children, ...props }) => {
@@ -601,13 +702,12 @@ const DefaultCardTitle = () => {
601
702
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
602
703
  };
603
704
  const TableCards = ({ isSelectable = false, showDisplayNameOnly = false, renderTitle = DefaultCardTitle, cardBodyProps = {} }) => {
604
- const { table } = react$1.useContext(TableContext);
705
+ const { table } = React.useContext(TableContext);
605
706
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getRowModel().rows.map((row) => {
606
- return (jsxRuntime.jsx(react.Card, { children: jsxRuntime.jsxs(react.CardBody, { display: "flex", flexFlow: "column", gap: "0.5rem", ...cardBodyProps, children: [isSelectable && (jsxRuntime.jsx(react.Checkbox, { isChecked: row.getIsSelected(),
707
+ return (jsxRuntime.jsx(react.Card.Root, { children: jsxRuntime.jsxs(react.Card.Body, { display: "flex", flexFlow: "column", gap: "0.5rem", ...cardBodyProps, children: [isSelectable && (jsxRuntime.jsx(Checkbox, { isChecked: row.getIsSelected(),
607
708
  disabled: !row.getCanSelect(),
608
709
  // indeterminate: row.getIsSomeSelected(),
609
710
  onChange: row.getToggleSelectedHandler() })), renderTitle(row), jsxRuntime.jsx(react.Grid, { templateColumns: "auto 1fr", gap: "1rem", children: row.getVisibleCells().map((cell) => {
610
- console.log(table.getColumn(cell.column.id), "dko");
611
711
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(react.Box, { children: [showDisplayNameOnly && (jsxRuntime.jsx(react.Text, { fontWeight: "bold", children: cell.column.columnDef.meta?.displayName ??
612
712
  cell.column.id })), !showDisplayNameOnly && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: reactTable.flexRender(cell.column.columnDef.header,
613
713
  // @ts-expect-error Assuming the CellContext interface is the same as HeaderContext
@@ -625,11 +725,39 @@ const TableComponent = ({ render = () => {
625
725
 
626
726
  const DateRangeFilter = ({ startDate, endDate, setStartDate, setEndDate, }) => {
627
727
  console.log(startDate, endDate, "dflp");
628
- return (jsxRuntime.jsx(react.Box, { p: '1rem', children: jsxRuntime.jsxs(react.VStack, { spacing: 4, children: [jsxRuntime.jsxs(react.FormControl, { children: [jsxRuntime.jsx(react.FormLabel, { htmlFor: "start-date", children: "Start Date" }), jsxRuntime.jsx(react.Input, { id: "start-date", type: "date", value: startDate, onChange: (e) => setStartDate(e.target.value) })] }), jsxRuntime.jsxs(react.FormControl, { children: [jsxRuntime.jsx(react.FormLabel, { htmlFor: "end-date", children: "End Date" }), jsxRuntime.jsx(react.Input, { id: "end-date", type: "date", value: endDate, onChange: (e) => setEndDate(e.target.value) })] })] }) }));
728
+ return (jsxRuntime.jsx(react.Box, { p: "1rem", children: jsxRuntime.jsxs(react.VStack, { children: [jsxRuntime.jsxs(react.Box, { children: [jsxRuntime.jsx(react.Box, { children: "Start Date" }), jsxRuntime.jsx(react.Input, { id: "start-date", type: "date", value: startDate, onChange: (e) => setStartDate(e.target.value) })] }), jsxRuntime.jsxs(react.Box, { children: [jsxRuntime.jsx(react.Box, { children: "End Date" }), jsxRuntime.jsx(react.Input, { id: "end-date", type: "date", value: endDate, onChange: (e) => setEndDate(e.target.value) })] })] }) }));
629
729
  };
630
730
 
731
+ const Slider = React__namespace.forwardRef(function Slider(props, ref) {
732
+ const { marks: marksProp, label, showValue, ...rest } = props;
733
+ const value = props.defaultValue ?? props.value;
734
+ const marks = marksProp?.map((mark) => {
735
+ if (typeof mark === "number")
736
+ return { value: mark, label: undefined };
737
+ return mark;
738
+ });
739
+ const hasMarkLabel = !!marks?.some((mark) => mark.label);
740
+ return (jsxRuntime.jsxs(react.Slider.Root, { ref: ref, thumbAlignment: "center", ...rest, children: [label && !showValue && (jsxRuntime.jsx(react.Slider.Label, { children: label })), label && showValue && (jsxRuntime.jsxs(react.HStack, { justify: "space-between", children: [jsxRuntime.jsx(react.Slider.Label, { children: label }), jsxRuntime.jsx(react.Slider.ValueText, {})] })), jsxRuntime.jsxs(react.Slider.Control, { "data-has-mark-label": hasMarkLabel || undefined, children: [jsxRuntime.jsx(react.Slider.Track, { children: jsxRuntime.jsx(react.Slider.Range, {}) }), jsxRuntime.jsx(SliderThumbs, { value: value }), jsxRuntime.jsx(SliderMarks, { marks: marks })] })] }));
741
+ });
742
+ function SliderThumbs(props) {
743
+ const { value } = props;
744
+ return (jsxRuntime.jsx(react.For, { each: value, children: (_, index) => (jsxRuntime.jsx(react.Slider.Thumb, { index: index, children: jsxRuntime.jsx(react.Slider.HiddenInput, {}) }, index)) }));
745
+ }
746
+ const SliderMarks = React__namespace.forwardRef(function SliderMarks(props, ref) {
747
+ const { marks } = props;
748
+ if (!marks?.length)
749
+ return null;
750
+ return (jsxRuntime.jsx(react.Slider.MarkerGroup, { ref: ref, children: marks.map((mark, index) => {
751
+ const value = typeof mark === "number" ? mark : mark.value;
752
+ const label = typeof mark === "number" ? undefined : mark.label;
753
+ return (jsxRuntime.jsxs(react.Slider.Marker, { value: value, children: [jsxRuntime.jsx(react.Slider.MarkerIndicator, {}), label] }, index));
754
+ }) }));
755
+ });
756
+
631
757
  const RangeFilter = ({ range, setRange, defaultValue, min, max, step, }) => {
632
- return (jsxRuntime.jsx(react.Box, { p: 8, children: jsxRuntime.jsxs(react.VStack, { spacing: 4, children: [jsxRuntime.jsxs(react.Text, { children: ["Selected Range: ", range[0], " - ", range[1]] }), jsxRuntime.jsxs(react.RangeSlider, { "aria-label": ["min", "max"], defaultValue: defaultValue, min: min, max: max, step: step, onChangeEnd: (val) => setRange(val), children: [jsxRuntime.jsx(react.RangeSliderTrack, { children: jsxRuntime.jsx(react.RangeSliderFilledTrack, {}) }), jsxRuntime.jsx(react.RangeSliderThumb, { index: 0 }), jsxRuntime.jsx(react.RangeSliderThumb, { index: 1 })] })] }) }));
758
+ return (jsxRuntime.jsx(react.Box, { p: 8, children: jsxRuntime.jsx(Slider, { width: "full", min: min, max: max, defaultValue: defaultValue, step: step, name: `Selected Range: ${range[0]} - ${range[1]}`,
759
+ // value={field.value}
760
+ onValueChange: (val) => setRange(val.value) }) }));
633
761
  };
634
762
 
635
763
  const TagFilter = ({ availableTags, selectedTags, onTagChange, }) => {
@@ -641,13 +769,22 @@ const TagFilter = ({ availableTags, selectedTags, onTagChange, }) => {
641
769
  onTagChange([...selectedTags, tag]);
642
770
  }
643
771
  };
644
- return (jsxRuntime.jsx(react.Flex, { flexFlow: "wrap", p: "0.5rem", gap: "0.5rem", children: availableTags.map((tag) => (jsxRuntime.jsx(react.WrapItem, { children: jsxRuntime.jsxs(react.Tag, { size: "lg", variant: selectedTags.includes(tag) ? "solid" : "outline", cursor: "pointer", onClick: () => toggleTag(tag), children: [jsxRuntime.jsx(react.TagLabel, { children: tag }), selectedTags.includes(tag) && jsxRuntime.jsx(react.TagCloseButton, {})] }) }, tag))) }));
772
+ return (jsxRuntime.jsx(react.Flex, { flexFlow: "wrap", p: "0.5rem", gap: "0.5rem", children: availableTags.map((tag) => (jsxRuntime.jsx(Tag, { variant: selectedTags.includes(tag) ? "solid" : "outline", cursor: "pointer", closable: selectedTags.includes(tag) ? true : undefined, onClick: () => toggleTag(tag), children: tag }))) }));
645
773
  };
646
774
 
647
- function Filter({ column }) {
775
+ const Radio = React__namespace.forwardRef(function Radio(props, ref) {
776
+ const { children, inputProps, rootRef, ...rest } = props;
777
+ return (jsxRuntime.jsxs(react.RadioGroup.Item, { ref: rootRef, ...rest, children: [jsxRuntime.jsx(react.RadioGroup.ItemHiddenInput, { ref: ref, ...inputProps }), jsxRuntime.jsx(react.RadioGroup.ItemIndicator, {}), children && (jsxRuntime.jsx(react.RadioGroup.ItemText, { children: children }))] }));
778
+ });
779
+ const RadioGroup = react.RadioGroup.Root;
780
+
781
+ const Filter = ({ column }) => {
648
782
  const { filterVariant } = column.columnDef.meta ?? {};
649
783
  const displayName = column.columnDef.meta?.displayName ?? column.id;
650
784
  const filterOptions = column.columnDef.meta?.filterOptions ?? [];
785
+ // const collection = createListCollection({
786
+ // items: filterOptions,
787
+ // });
651
788
  if (column.columns.length > 0) {
652
789
  return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(react.Text, { children: displayName }), column.columns.map((column) => {
653
790
  return jsxRuntime.jsx(Filter, { column: column }, column.id);
@@ -657,11 +794,9 @@ function Filter({ column }) {
657
794
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
658
795
  }
659
796
  if (filterVariant === "select") {
660
- return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(react.Text, { children: displayName }), jsxRuntime.jsx(react.Select, { value: column.getFilterValue() ? String(column.getFilterValue()) : "", placeholder: "Select option", onChange: (e) => {
661
- column.setFilterValue(e.target.value);
662
- }, children: filterOptions.map((option) => {
663
- return (jsxRuntime.jsx("option", { value: option, children: option }, `${option}`));
664
- }) })] }, column.id));
797
+ return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(react.Text, { children: displayName }), jsxRuntime.jsx(RadioGroup, { value: column.getFilterValue() ? String(column.getFilterValue()) : "", onValueChange: (details) => {
798
+ column.setFilterValue(details.value);
799
+ }, children: jsxRuntime.jsx(react.Flex, { flexFlow: 'wrap', gap: '0.5rem', children: filterOptions.map((item) => (jsxRuntime.jsx(Radio, { value: item, children: item }, item))) }) })] }, column.id));
665
800
  }
666
801
  if (filterVariant === "tag") {
667
802
  return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(react.Text, { children: displayName }), jsxRuntime.jsx(TagFilter, { availableTags: filterOptions, selectedTags: (column.getFilterValue() ?? []), onTagChange: (tags) => {
@@ -721,7 +856,7 @@ function Filter({ column }) {
721
856
  return (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.25rem", children: [jsxRuntime.jsx(react.Text, { children: displayName }), jsxRuntime.jsx(react.Input, { value: column.getFilterValue() ? String(column.getFilterValue()) : "", onChange: (e) => {
722
857
  column.setFilterValue(e.target.value);
723
858
  } })] }, column.id));
724
- }
859
+ };
725
860
  const TableFilter = () => {
726
861
  const { table } = useDataTableContext();
727
862
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: table.getAllColumns().map((column) => {
@@ -732,11 +867,11 @@ const TableFilter = () => {
732
867
  const TableFilterTags = () => {
733
868
  const { table } = useDataTableContext();
734
869
  return (jsxRuntime.jsx(react.Flex, { gap: "0.5rem", flexFlow: "wrap", children: table.getState().columnFilters.map(({ id, value }) => {
735
- return (jsxRuntime.jsxs(react.Tag, { display: "flex", gap: "0.5rem", alignItems: "center", children: [jsxRuntime.jsx(react.Text, { children: `${id}: ${value}` }), jsxRuntime.jsx(react.IconButton, { size: "xs", variant: "ghost", icon: jsxRuntime.jsx(icons.CloseIcon, {}), onClick: () => {
870
+ return (jsxRuntime.jsxs(Tag, { gap: "0.5rem", children: [`${id}: ${value}`, jsxRuntime.jsx(react.IconButton, { variant: "ghost", "aria-label": "remove filter", onClick: () => {
736
871
  table.setColumnFilters(table.getState().columnFilters.filter((filter) => {
737
872
  return filter.value != value;
738
873
  }));
739
- }, "aria-label": "remove filter" })] }, `${id}-${value}`));
874
+ }, children: jsxRuntime.jsx(cg.CgClose, {}) })] }, `${id}-${value}`));
740
875
  }) }));
741
876
  };
742
877
 
@@ -746,8 +881,8 @@ const TableLoadingComponent = ({ render, }) => {
746
881
  };
747
882
 
748
883
  const ColumnOrderChanger = ({ columns }) => {
749
- const [order, setOrder] = react$1.useState([]);
750
- const [originalOrder, setOriginalOrder] = react$1.useState([]);
884
+ const [order, setOrder] = React.useState([]);
885
+ const [originalOrder, setOriginalOrder] = React.useState([]);
751
886
  const { table } = useDataTableContext();
752
887
  const handleChangeOrder = (startIndex, endIndex) => {
753
888
  const newOrder = Array.from(order);
@@ -755,10 +890,10 @@ const ColumnOrderChanger = ({ columns }) => {
755
890
  newOrder.splice(endIndex, 0, removed);
756
891
  setOrder(newOrder);
757
892
  };
758
- react$1.useEffect(() => {
893
+ React.useEffect(() => {
759
894
  setOrder(columns);
760
895
  }, [columns]);
761
- react$1.useEffect(() => {
896
+ React.useEffect(() => {
762
897
  if (originalOrder.length > 0) {
763
898
  return;
764
899
  }
@@ -798,9 +933,9 @@ const TableOrderer = () => {
798
933
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(ColumnOrderChanger, { columns: table.getState().columnOrder }) }));
799
934
  };
800
935
 
801
- const TablePagination = ({}) => {
936
+ const TablePagination = () => {
802
937
  const { firstPage, getCanPreviousPage, previousPage, getState, nextPage, getCanNextPage, lastPage, } = useDataTableContext().table;
803
- return (jsxRuntime.jsxs(react.ButtonGroup, { isAttached: true, children: [jsxRuntime.jsx(react.IconButton, { icon: jsxRuntime.jsx(md.MdFirstPage, {}), onClick: () => firstPage(), isDisabled: !getCanPreviousPage(), "aria-label": "first-page", variant: "ghost" }), jsxRuntime.jsx(react.IconButton, { icon: jsxRuntime.jsx(md.MdArrowBack, {}), onClick: () => previousPage(), isDisabled: !getCanPreviousPage(), "aria-label": "previous-page", variant: "ghost" }), jsxRuntime.jsx(react.Button, { variant: "ghost", onClick: () => { }, disabled: !getCanPreviousPage(), children: getState().pagination.pageIndex + 1 }), jsxRuntime.jsx(react.IconButton, { onClick: () => nextPage(), isDisabled: !getCanNextPage(), "aria-label": "next-page", variant: "ghost", children: jsxRuntime.jsx(md.MdArrowForward, {}) }), jsxRuntime.jsx(react.IconButton, { onClick: () => lastPage(), isDisabled: !getCanNextPage(), "aria-label": "last-page", variant: "ghost", children: jsxRuntime.jsx(md.MdLastPage, {}) })] }));
938
+ return (jsxRuntime.jsxs(react.Group, { attached: true, children: [jsxRuntime.jsx(react.IconButton, { onClick: () => firstPage(), disabled: !getCanPreviousPage(), "aria-label": "first-page", variant: "ghost", children: jsxRuntime.jsx(md.MdFirstPage, {}) }), jsxRuntime.jsx(react.IconButton, { onClick: () => previousPage(), disabled: !getCanPreviousPage(), "aria-label": "previous-page", variant: "ghost", children: jsxRuntime.jsx(md.MdArrowBack, {}) }), jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => { }, disabled: !getCanPreviousPage(), children: getState().pagination.pageIndex + 1 }), jsxRuntime.jsx(react.IconButton, { onClick: () => nextPage(), disabled: !getCanNextPage(), "aria-label": "next-page", variant: "ghost", children: jsxRuntime.jsx(md.MdArrowForward, {}) }), jsxRuntime.jsx(react.IconButton, { onClick: () => lastPage(), disabled: !getCanNextPage(), "aria-label": "last-page", variant: "ghost", children: jsxRuntime.jsx(md.MdLastPage, {}) })] }));
804
939
  };
805
940
 
806
941
  const SelectAllRowsToggle = ({ selectAllIcon = jsxRuntime.jsx(md.MdOutlineChecklist, {}), clearAllIcon = jsxRuntime.jsx(md.MdClear, {}), selectAllText = "", clearAllText = "", }) => {
@@ -813,16 +948,21 @@ const SelectAllRowsToggle = ({ selectAllIcon = jsxRuntime.jsx(md.MdOutlineCheckl
813
948
  };
814
949
 
815
950
  const TableSelector = () => {
816
- const { table } = react$1.useContext(TableContext);
951
+ const { table } = React.useContext(TableContext);
817
952
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [table.getSelectedRowModel().rows.length > 0 && (jsxRuntime.jsxs(react.Button, { onClick: () => { }, variant: "ghost", display: "flex", gap: "0.25rem", children: [jsxRuntime.jsx(react.Box, { fontSize: "sm", children: `${table.getSelectedRowModel().rows.length}` }), jsxRuntime.jsx(react.Icon, { as: io.IoMdCheckbox })] })), !table.getIsAllPageRowsSelected() && jsxRuntime.jsx(SelectAllRowsToggle, {}), table.getSelectedRowModel().rows.length > 0 && (jsxRuntime.jsx(react.IconButton, { variant: "ghost", icon: jsxRuntime.jsx(react.Icon, { as: md.MdClear }), onClick: () => {
818
953
  table.resetRowSelection();
819
954
  }, "aria-label": "reset selection" }))] }));
820
955
  };
821
956
 
957
+ const Switch = React__namespace.forwardRef(function Switch(props, ref) {
958
+ const { inputProps, children, rootRef, trackLabel, thumbLabel, ...rest } = props;
959
+ return (jsxRuntime.jsxs(react.Switch.Root, { ref: rootRef, ...rest, children: [jsxRuntime.jsx(react.Switch.HiddenInput, { ref: ref, ...inputProps }), jsxRuntime.jsxs(react.Switch.Control, { children: [jsxRuntime.jsx(react.Switch.Thumb, { children: thumbLabel && (jsxRuntime.jsx(react.Switch.ThumbIndicator, { fallback: thumbLabel?.off, children: thumbLabel?.on })) }), trackLabel && (jsxRuntime.jsx(react.Switch.Indicator, { fallback: trackLabel.off, children: trackLabel.on }))] }), children != null && (jsxRuntime.jsx(react.Switch.Label, { children: children }))] }));
960
+ });
961
+
822
962
  const TableViewer = () => {
823
963
  const { table } = useDataTableContext();
824
964
  const columns = table.getAllLeafColumns();
825
- const [columnOrder, setColumnOrder] = react$1.useState(columns.map(column => column.id));
965
+ const [columnOrder, setColumnOrder] = React.useState(columns.map((column) => column.id));
826
966
  const handleDragEnd = (result) => {
827
967
  if (!result.destination)
828
968
  return;
@@ -834,22 +974,22 @@ const TableViewer = () => {
834
974
  };
835
975
  return (jsxRuntime.jsx(reactBeautifulDnd.DragDropContext, { onDragEnd: handleDragEnd, children: jsxRuntime.jsx(reactBeautifulDnd.Droppable, { droppableId: "columns", children: (provided) => (jsxRuntime.jsxs(react.Flex, { flexFlow: "column", gap: "0.5rem", ref: provided.innerRef, ...provided.droppableProps, children: [columns.map((column, index) => {
836
976
  const displayName = column.columnDef.meta?.displayName || column.id;
837
- return (jsxRuntime.jsx(reactBeautifulDnd.Draggable, { draggableId: column.id, index: index, children: (provided) => (jsxRuntime.jsxs(react.Grid, { ref: provided.innerRef, ...provided.draggableProps, templateColumns: "auto 1fr", gap: "0.5rem", alignItems: "center", children: [jsxRuntime.jsx(react.Flex, { ...provided.dragHandleProps, alignItems: "center", padding: "0", children: jsxRuntime.jsx(react.Icon, { as: fa.FaGripLinesVertical, color: "gray.400" }) }), jsxRuntime.jsxs(react.Flex, { justifyContent: "space-between", alignItems: "center", children: [jsxRuntime.jsx(react.Box, { children: displayName }), jsxRuntime.jsx(react.Switch, { isChecked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler() })] })] })) }, column.id));
977
+ return (jsxRuntime.jsx(reactBeautifulDnd.Draggable, { draggableId: column.id, index: index, children: (provided) => (jsxRuntime.jsxs(react.Grid, { ref: provided.innerRef, ...provided.draggableProps, templateColumns: "auto 1fr", gap: "0.5rem", alignItems: "center", children: [jsxRuntime.jsx(react.Flex, { ...provided.dragHandleProps, alignItems: "center", padding: "0", children: jsxRuntime.jsx(fa.FaGripLinesVertical, { color: "gray.400" }) }), jsxRuntime.jsxs(react.Flex, { justifyContent: "space-between", alignItems: "center", children: [jsxRuntime.jsx(react.Box, { children: displayName }), jsxRuntime.jsx(Switch, { checked: column.getIsVisible(), onChange: column.getToggleVisibilityHandler() })] })] })) }, column.id));
838
978
  }), provided.placeholder] })) }) }));
839
979
  };
840
980
 
841
- const TextCell = ({ label, noOfLines = [1], padding = "0rem", children, tooltipProps, ...props }) => {
981
+ const TextCell = ({ label, padding = "0rem", children, ...props }) => {
842
982
  if (label) {
843
- return (jsxRuntime.jsx(react.Flex, { alignItems: "center", height: "100%", padding: padding, children: jsxRuntime.jsx(react.Tooltip, { label: jsxRuntime.jsx(react.Text, { as: "span", overflow: "hidden", textOverflow: "ellipsis", noOfLines: [5], children: label }), placement: "auto", ...tooltipProps, children: jsxRuntime.jsx(react.Text, { as: "span", overflow: "hidden", textOverflow: "ellipsis", wordBreak: "break-all", noOfLines: noOfLines, ...props, children: children }) }) }));
983
+ return (jsxRuntime.jsx(react.Flex, { alignItems: "center", height: "100%", padding: padding, children: jsxRuntime.jsx(Tooltip, { content: jsxRuntime.jsx(react.Text, { as: "span", overflow: "hidden", textOverflow: "ellipsis", children: label }), children: jsxRuntime.jsx(react.Text, { as: "span", overflow: "hidden", textOverflow: "ellipsis", wordBreak: "break-all", ...props, children: children }) }) }));
844
984
  }
845
- return (jsxRuntime.jsx(react.Flex, { alignItems: "center", height: "100%", padding: padding, children: jsxRuntime.jsx(react.Text, { as: "span", overflow: "hidden", textOverflow: "ellipsis", wordBreak: "break-all", noOfLines: noOfLines, ...props, children: children }) }));
985
+ return (jsxRuntime.jsx(react.Flex, { alignItems: "center", height: "100%", padding: padding, children: jsxRuntime.jsx(react.Text, { as: "span", overflow: "hidden", textOverflow: "ellipsis", wordBreak: "break-all", ...props, children: children }) }));
846
986
  };
847
987
 
848
988
  const useDataFromUrl = ({ url, params = {}, disableFirstFetch = false, onFetchSuccess = () => { }, defaultData, }) => {
849
- const [loading, setLoading] = react$1.useState(true);
850
- const [hasError, setHasError] = react$1.useState(false);
851
- const [data, setData] = react$1.useState(defaultData);
852
- const [timer, setTimer] = react$1.useState();
989
+ const [loading, setLoading] = React.useState(true);
990
+ const [hasError, setHasError] = React.useState(false);
991
+ const [data, setData] = React.useState(defaultData);
992
+ const [timer, setTimer] = React.useState();
853
993
  const refreshData = async ({ debounce, delay } = { debounce: false, delay: 1000 }) => {
854
994
  if (debounce) {
855
995
  await debouncedGetData(delay);
@@ -881,7 +1021,7 @@ const useDataFromUrl = ({ url, params = {}, disableFirstFetch = false, onFetchSu
881
1021
  await getData();
882
1022
  }, delay));
883
1023
  };
884
- react$1.useEffect(() => {
1024
+ React.useEffect(() => {
885
1025
  if (disableFirstFetch) {
886
1026
  return;
887
1027
  }
@@ -922,14 +1062,14 @@ const useDataTable = ({ default: { sorting: defaultSorting = [], pagination: def
922
1062
  density: "sm",
923
1063
  },
924
1064
  }) => {
925
- const [sorting, setSorting] = react$1.useState(defaultSorting);
926
- const [columnFilters, setColumnFilters] = react$1.useState(defaultColumnFilters); // can set initial column filter state here
927
- const [pagination, setPagination] = react$1.useState(defaultPagination);
928
- const [rowSelection, setRowSelection] = react$1.useState(defaultRowSelection);
929
- const [columnOrder, setColumnOrder] = react$1.useState(defaultColumnOrder);
930
- const [globalFilter, setGlobalFilter] = react$1.useState(defaultGlobalFilter);
931
- const [density, setDensity] = react$1.useState(defaultDensity);
932
- const [columnVisibility, setColumnVisibility] = react$1.useState(defaultColumnVisibility);
1065
+ const [sorting, setSorting] = React.useState(defaultSorting);
1066
+ const [columnFilters, setColumnFilters] = React.useState(defaultColumnFilters); // can set initial column filter state here
1067
+ const [pagination, setPagination] = React.useState(defaultPagination);
1068
+ const [rowSelection, setRowSelection] = React.useState(defaultRowSelection);
1069
+ const [columnOrder, setColumnOrder] = React.useState(defaultColumnOrder);
1070
+ const [globalFilter, setGlobalFilter] = React.useState(defaultGlobalFilter);
1071
+ const [density, setDensity] = React.useState(defaultDensity);
1072
+ const [columnVisibility, setColumnVisibility] = React.useState(defaultColumnVisibility);
933
1073
  return {
934
1074
  sorting,
935
1075
  setSorting,
@@ -966,14 +1106,14 @@ const useDataTableServer = ({ url, onFetchSuccess = () => { }, default: { sortin
966
1106
  globalFilter: "",
967
1107
  density: "sm",
968
1108
  }, debounce = true, debounceDelay = 1000, }) => {
969
- const [sorting, setSorting] = react$1.useState(defaultSorting);
970
- const [columnFilters, setColumnFilters] = react$1.useState(defaultColumnFilters); // can set initial column filter state here
971
- const [pagination, setPagination] = react$1.useState(defaultPagination);
972
- const [rowSelection, setRowSelection] = react$1.useState(defaultRowSelection);
973
- const [columnOrder, setColumnOrder] = react$1.useState(defaultColumnOrder);
974
- const [globalFilter, setGlobalFilter] = react$1.useState(defaultGlobalFilter);
975
- const [density, setDensity] = react$1.useState(defaultDensity);
976
- const [columnVisibility, setColumnVisibility] = react$1.useState(defaultColumnVisibility);
1109
+ const [sorting, setSorting] = React.useState(defaultSorting);
1110
+ const [columnFilters, setColumnFilters] = React.useState(defaultColumnFilters); // can set initial column filter state here
1111
+ const [pagination, setPagination] = React.useState(defaultPagination);
1112
+ const [rowSelection, setRowSelection] = React.useState(defaultRowSelection);
1113
+ const [columnOrder, setColumnOrder] = React.useState(defaultColumnOrder);
1114
+ const [globalFilter, setGlobalFilter] = React.useState(defaultGlobalFilter);
1115
+ const [density, setDensity] = React.useState(defaultDensity);
1116
+ const [columnVisibility, setColumnVisibility] = React.useState(defaultColumnVisibility);
977
1117
  const { data, loading, hasError, refreshData } = useDataFromUrl({
978
1118
  url: url,
979
1119
  defaultData: {
@@ -999,7 +1139,7 @@ const useDataTableServer = ({ url, onFetchSuccess = () => { }, default: { sortin
999
1139
  disableFirstFetch: true,
1000
1140
  onFetchSuccess: onFetchSuccess,
1001
1141
  });
1002
- react$1.useEffect(() => {
1142
+ React.useEffect(() => {
1003
1143
  refreshData({ debounce, debounceDelay });
1004
1144
  }, [pagination, sorting, columnFilters, globalFilter, url]);
1005
1145
  return {
@@ -1046,14 +1186,22 @@ const FilterOptions = ({ column }) => {
1046
1186
  }) }));
1047
1187
  };
1048
1188
 
1049
- const GlobalFilter = ({ icon = md.MdSearch }) => {
1189
+ const InputGroup = React__namespace.forwardRef(function InputGroup(props, ref) {
1190
+ const { startElement, startElementProps, endElement, endElementProps, children, startOffset = "6px", endOffset = "6px", ...rest } = props;
1191
+ return (jsxRuntime.jsxs(react.Group, { ref: ref, ...rest, children: [startElement && (jsxRuntime.jsx(react.InputElement, { pointerEvents: "none", ...startElementProps, children: startElement })), React__namespace.cloneElement(children, {
1192
+ ...(startElement && {
1193
+ ps: `calc(var(--input-height) - ${startOffset})`,
1194
+ }),
1195
+ ...(endElement && { pe: `calc(var(--input-height) - ${endOffset})` }),
1196
+ ...children.props,
1197
+ }), endElement && (jsxRuntime.jsx(react.InputElement, { placement: "end", ...endElementProps, children: endElement }))] }));
1198
+ });
1199
+
1200
+ const GlobalFilter = () => {
1050
1201
  const { table } = useDataTableContext();
1051
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(react.Box, { children: jsxRuntime.jsxs(react.InputGroup, { children: [jsxRuntime.jsx(react.InputLeftElement, { pointerEvents: "none", children: jsxRuntime.jsx(react.Icon, { as: icon, color: "gray.300" }) }), jsxRuntime.jsx(react.Input, { value: table.getState().globalFilter.globalFilter, onChange: (e) => {
1052
- if (!!e.target.value) {
1053
- table.setGlobalFilter(undefined);
1054
- }
1055
- table.setGlobalFilter(e.target.value);
1056
- } })] }) }) }));
1202
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(InputGroup, { flex: "1", startElement: jsxRuntime.jsx(md.MdSearch, {}), children: jsxRuntime.jsx(react.Input, { placeholder: "Outline", variant: "outline", onChange: (e) => {
1203
+ table.setGlobalFilter(e.target.value);
1204
+ } }) }) }));
1057
1205
  };
1058
1206
 
1059
1207
  exports.DataTable = DataTable;