@bluemarble/bm-components 0.0.43 → 0.0.45

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.
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { memo, useState, useRef, useMemo, useEffect, useCallback } from 'react';
3
- import { TableHead, TableRow, TableCell, TableSortLabel, Chip, Tooltip, IconButton, Paper, LinearProgress, TableContainer, Table, TableBody, TablePagination, Popover, Box as Box$2, Typography, Autocomplete as Autocomplete$1, TextField, Button, FormControl, Select as Select$1, InputLabel, FormControlLabel, Checkbox as Checkbox$1, Switch as Switch$1, FormLabel, RadioGroup, Radio as Radio$1, CircularProgress, Stack, MenuItem } from '@mui/material';
3
+ import { TableHead, TableRow, TableCell, TableSortLabel, Chip, Tooltip, IconButton, Paper, LinearProgress, TableContainer, Table, TableBody, TablePagination, Popover, Box as Box$2, Typography, Autocomplete as Autocomplete$1, TextField, Button, FormControl, Select as Select$1, InputLabel, FormControlLabel, Checkbox as Checkbox$1, Switch as Switch$1, FormLabel, RadioGroup, Radio as Radio$1, CircularProgress, Stack, MenuItem, Modal as Modal$1 } from '@mui/material';
4
4
  import emStyled from '@emotion/styled';
5
5
  import '@emotion/react';
6
6
  import { Field, useField } from 'formik';
@@ -3866,7 +3866,7 @@ const AutoCreatedRows = ({ tableData, columns, primaryKey, }) => {
3866
3866
  }))))));
3867
3867
  };
3868
3868
 
3869
- const Grid$1 = (props) => {
3869
+ const Grid = (props) => {
3870
3870
  const { columnTitles, isLoading, footer, noFilterButtons = false, selectedFilters, customButtons, setSelectedFilters, defaultData, setTableData, updateFilters, tableData, rowOptions = [60, 100, 150], noPagination, primaryKey, noFilters, } = props;
3871
3871
  const [order, setOrder] = useState(undefined);
3872
3872
  const [orderBy, setOrderBy] = useState("");
@@ -15012,7 +15012,7 @@ function useEvent(event, handler, passive = false) {
15012
15012
  });
15013
15013
  }
15014
15014
 
15015
- function Grid({ columns: columnsData, children, fixedColumns, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense = true, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions, }) {
15015
+ function BaseGrid({ columns: columnsData, children, fixedColumns, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense = true, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions, }) {
15016
15016
  const [columns, setColumns] = useState([]);
15017
15017
  const [startResize, setStartResize] = useState(0);
15018
15018
  const columnsRef = useRef(null);
@@ -15066,17 +15066,17 @@ function Grid({ columns: columnsData, children, fixedColumns, paperProps, tableB
15066
15066
  useEvent("mouseup", () => {
15067
15067
  setDraggingColumn(-1);
15068
15068
  });
15069
- return (React__default.createElement(Paper, Object.assign({}, paperProps, { sx: Object.assign({ "tbody tr td": {
15069
+ return (React__default.createElement(Paper, Object.assign({}, paperProps, { sx: Object.assign({ "tr td": {
15070
15070
  py: dense ? 0.23 : 0.7,
15071
15071
  border: bordered ? "1px solid" : "",
15072
15072
  borderColor: "divider",
15073
- }, "tbody tr:nth-of-type(even)": {
15073
+ }, "tr:nth-of-type(even)": {
15074
15074
  transition: "background-color ease 200ms",
15075
15075
  bgcolor: striped ? "divider" : "initial",
15076
- }, width: fixedColumns ? "fit-content" : "100%" }, paperProps === null || paperProps === void 0 ? void 0 : paperProps.sx) }),
15076
+ }, width: fixedColumns ? "fit-content" : "100" }, paperProps === null || paperProps === void 0 ? void 0 : paperProps.sx) }),
15077
15077
  React__default.createElement(Table, Object.assign({ size: "small", stickyHeader: true }, tableProps, { sx: Object.assign(Object.assign({}, getTableWidth()), tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) }),
15078
15078
  React__default.createElement(TableHead, Object.assign({}, tableHeadProps),
15079
- React__default.createElement(TableRow, { ref: columnsRef }, columns.map((column, index) => (React__default.createElement(TableCell, { key: column.name, padding: dense ? "none" : "normal", sx: Object.assign(Object.assign({ border: "1px solid", borderColor: "divider", width: column.width || 100, minWidth: getColWidth((column === null || column === void 0 ? void 0 : column.width) || 100), maxWidth: getColWidth((column === null || column === void 0 ? void 0 : column.width) || 100), pl: 2, zIndex: columns.length - index }, column === null || column === void 0 ? void 0 : column.sx), { position: tableProps.stickyHeader ? "sticky" : "relative" }) },
15079
+ React__default.createElement(TableRow, { ref: columnsRef }, columns.map((column, index) => (React__default.createElement(TableCell, { key: column.name, padding: dense ? "none" : "normal", sx: Object.assign({ border: "1px solid", borderColor: "divider", width: column.width || 100, minWidth: getColWidth((column === null || column === void 0 ? void 0 : column.width) || 100), maxWidth: getColWidth((column === null || column === void 0 ? void 0 : column.width) || 100), pl: 2, zIndex: columns.length - index }, column === null || column === void 0 ? void 0 : column.sx) },
15080
15080
  React__default.createElement(TableSortLabel, { active: sortedBy === column.name, direction: sortedDirection, onClick: () => onSortBy(column.name), disabled: column.canSort === false, sx: { position: "relative", right: "-9px" } }, column.label),
15081
15081
  index < columns.length && (React__default.createElement(Box$2, { id: `resize-col-${index}`, sx: {
15082
15082
  width: "4px",
@@ -15257,5 +15257,32 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100], })
15257
15257
  };
15258
15258
  }
15259
15259
 
15260
- export { Autocomplete, Grid as BaseGrid, Checkbox, EditableTableCell, Grid$1 as Grid, Input, InputMask, LargeButton, Radio, Select, Switch, TabPanel, Td, Tr, createFilter, filterData, getTabProps, useEvent, useFilter, useGrid };
15260
+ function useLoading() {
15261
+ const [state, setState] = useState([]);
15262
+ const isLoading = (prop) => state.includes(prop);
15263
+ const setLoading = (prop, remove) => {
15264
+ if (remove)
15265
+ setState((prevState) => prevState.filter((state) => state !== prop));
15266
+ else
15267
+ setState((prevState) => [...prevState, prop]);
15268
+ };
15269
+ return { isLoading, setLoading };
15270
+ }
15271
+
15272
+ const Modal = (_a) => {
15273
+ var { open, onClose } = _a, rest = __rest(_a, ["open", "onClose"]);
15274
+ return (React__default.createElement(Modal$1, Object.assign({ open: open, onClose: onClose, disableEnforceFocus: true }, rest),
15275
+ React__default.createElement(Box$2, { sx: {
15276
+ outline: "none",
15277
+ backgroundColor: "white",
15278
+ position: "absolute",
15279
+ top: "50%",
15280
+ left: "50%",
15281
+ transform: "translate(-50%, -50%)",
15282
+ borderRadius: 1,
15283
+ } },
15284
+ React__default.createElement(React__default.Fragment, null, rest.children))));
15285
+ };
15286
+
15287
+ export { Autocomplete, BaseGrid, Checkbox, EditableTableCell, Grid, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, Td, Tr, createFilter, filterData, getTabProps, useEvent, useFilter, useGrid, useLoading };
15261
15288
  //# sourceMappingURL=index.js.map