@bcgov-sso/common-react-components 1.31.0 → 1.31.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.
package/dist/cjs/index.js CHANGED
@@ -16020,29 +16020,6 @@ function useReactTable(options) {
16020
16020
  return tableRef.current;
16021
16021
  }
16022
16022
 
16023
- const Wrapper = styled.div `
16024
- width: 100%;
16025
- position: relative;
16026
- `;
16027
- const Icon$2 = styled.i `
16028
- position: absolute;
16029
- right: 0.5em;
16030
- top: 0.5em;
16031
- color: grey;
16032
- `;
16033
- const Input$2 = styled.input `
16034
- width: 100%;
16035
- border: 2px solid #606060;
16036
- padding: 0.3em 0.5em;
16037
- border-radius: 0.25em;
16038
- `;
16039
- function SearchBar(props) {
16040
- return (React__default["default"].createElement(Wrapper, null,
16041
- React__default["default"].createElement(Input$2, Object.assign({ type: "text", maxLength: 100 }, props)),
16042
- React__default["default"].createElement(Icon$2, null,
16043
- React__default["default"].createElement(FontAwesomeIcon, { icon: faMagnifyingGlass }))));
16044
- }
16045
-
16046
16023
  function _typeof$2(o) {
16047
16024
  "@babel/helpers - typeof";
16048
16025
 
@@ -20879,7 +20856,7 @@ var inputStyle = function inputStyle(isHidden) {
20879
20856
  width: '100%'
20880
20857
  }, spacingStyle);
20881
20858
  };
20882
- var Input = function Input(props) {
20859
+ var Input$1 = function Input(props) {
20883
20860
  var cx = props.cx,
20884
20861
  value = props.value;
20885
20862
  var _cleanCommonProps = cleanCommonProps(props),
@@ -20901,7 +20878,7 @@ var Input = function Input(props) {
20901
20878
  disabled: isDisabled
20902
20879
  }, innerProps)));
20903
20880
  };
20904
- var Input$1 = Input;
20881
+ var Input$1$1 = Input$1;
20905
20882
 
20906
20883
  var multiValueCSS = function multiValueCSS(_ref, unstyled) {
20907
20884
  var _ref$theme = _ref.theme,
@@ -21112,7 +21089,7 @@ var components = {
21112
21089
  GroupHeading: GroupHeading,
21113
21090
  IndicatorsContainer: IndicatorsContainer,
21114
21091
  IndicatorSeparator: IndicatorSeparator,
21115
- Input: Input$1,
21092
+ Input: Input$1$1,
21116
21093
  LoadingIndicator: LoadingIndicator,
21117
21094
  Menu: Menu$1$1,
21118
21095
  MenuList: MenuList,
@@ -23818,6 +23795,29 @@ var StateManagedSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
23818
23795
  });
23819
23796
  var StateManagedSelect$1 = StateManagedSelect;
23820
23797
 
23798
+ const Wrapper = styled.div `
23799
+ width: 100%;
23800
+ position: relative;
23801
+ `;
23802
+ const Icon$2 = styled.i `
23803
+ position: absolute;
23804
+ right: -0.5em;
23805
+ top: 0.5em;
23806
+ color: grey;
23807
+ `;
23808
+ const Input = styled.input `
23809
+ width: 100%;
23810
+ border: 2px solid #606060;
23811
+ padding: 0.3em 0.5em;
23812
+ border-radius: 0.25em;
23813
+ `;
23814
+ function SearchBar(props) {
23815
+ return (React__default["default"].createElement(Wrapper, null,
23816
+ React__default["default"].createElement(Input, Object.assign({ type: "text", maxLength: 100 }, props)),
23817
+ React__default["default"].createElement(Icon$2, null,
23818
+ React__default["default"].createElement(FontAwesomeIcon, { icon: faMagnifyingGlass }))));
23819
+ }
23820
+
23821
23821
  const TABLE_BACKGROUND_COLOR = '#ededed';
23822
23822
  const TABLE_ROW_ACTIVE_COLOR = '#4950FA';
23823
23823
  const TABLE_ROW_HOVER_COLOR = '#fdb913';
@@ -23829,12 +23829,13 @@ const StyledTable = styled.table `
23829
23829
  width: 100%;
23830
23830
  -webkit-box-shadow: none;
23831
23831
  background-color: ${TABLE_BACKGROUND_COLOR};
23832
- padding: 0.1em 0.6em;
23832
+ padding: 0 0.6em;
23833
23833
  box-shadow: none;
23834
23834
  text-align: left;
23835
23835
  border-collapse: separate;
23836
23836
  border-spacing: 0 ${TABLE_ROW_SPACING}px;
23837
23837
  color: black;
23838
+ margin-bottom: 0.5em;
23838
23839
 
23839
23840
  & thead {
23840
23841
  font-size: 16px;
@@ -23892,7 +23893,7 @@ const StyledTable = styled.table `
23892
23893
  overflow: hidden;
23893
23894
  }
23894
23895
  `;
23895
- const Table = ({ variant = 'default', columns = [], data = [], readOnly = false, onRowSelect = (rowData) => { }, defaultPageSize = 5, enableGlobalSearch = true, globalSearchPlaceholder = 'Search all columns...', enablePagination = true, pageSizeOptions = [5, 10, 20, 30, 40, 50], }) => {
23896
+ const Table = ({ variant = 'default', columns = [], data = [], readOnly = false, onRowSelect = (rowData) => { }, defaultPageSize = 5, enableGlobalSearch = true, globalSearchPlaceholder = 'Search all columns...', globalSearchStyle = {}, enablePagination = true, pageSizeOptions = [5, 10, 20, 30, 40, 50], noDataFoundText = 'No data found', }) => {
23896
23897
  const [selectedRow, setSelectedRow] = React.useState();
23897
23898
  const [pagination, setPagination] = React__default["default"].useState({
23898
23899
  pageIndex: 0,
@@ -23927,9 +23928,9 @@ const Table = ({ variant = 'default', columns = [], data = [], readOnly = false,
23927
23928
  }
23928
23929
  };
23929
23930
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
23930
- React__default["default"].createElement("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
23931
- enableGlobalSearch && (React__default["default"].createElement("div", { style: { width: '20%', marginTop: '1em' } },
23932
- React__default["default"].createElement(SearchBar, { value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : '', onChange: (e) => setGlobalFilter(String(e.target.value)), placeholder: globalSearchPlaceholder, style: { height: '30px' } }))),
23931
+ React__default["default"].createElement("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' } },
23932
+ enableGlobalSearch && (React__default["default"].createElement("div", { style: { padding: '0.5em 0' } },
23933
+ React__default["default"].createElement(SearchBar, { value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : '', onChange: (e) => setGlobalFilter(String(e.target.value)), placeholder: globalSearchPlaceholder, style: globalSearchStyle }))),
23933
23934
  React__default["default"].createElement("div", { style: { display: 'flex', justifyContent: 'flex-end', flexWrap: 'wrap', padding: '0.5em 0', gap: '0.5em' } }, table.getHeaderGroups().map((headerGroup) => headerGroup.headers.map((header) => {
23934
23935
  var _a, _b, _c, _d, _e, _f, _g, _h;
23935
23936
  return header.column.getCanFilter() && (React__default["default"].createElement("div", { key: header.id },
@@ -23960,21 +23961,22 @@ const Table = ({ variant = 'default', columns = [], data = [], readOnly = false,
23960
23961
  desc: React__default["default"].createElement(FontAwesomeIcon, { icon: faSortUp }),
23961
23962
  }[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : React__default["default"].createElement(FontAwesomeIcon, { icon: faSort })))));
23962
23963
  }))))),
23963
- React__default["default"].createElement("tbody", null, table.getRowModel().rows.map((row) => (React__default["default"].createElement("tr", { key: row.id, onClick: () => {
23964
+ React__default["default"].createElement("tbody", null, table.getRowModel().rows.length === 0 ? (React__default["default"].createElement("tr", { key: "no-data" },
23965
+ React__default["default"].createElement("td", { style: { textAlign: 'center' }, colSpan: columns.length }, noDataFoundText))) : (table.getRowModel().rows.map((row) => (React__default["default"].createElement("tr", { key: row.id, onClick: () => {
23964
23966
  onRowClick(row);
23965
- }, className: row.id === (selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.id) ? 'active' : '' }, row.getVisibleCells().map((cell) => (React__default["default"].createElement("td", { key: cell.id }, flexRender(cell.column.columnDef.cell, cell.getContext())))))))),
23967
+ }, className: row.id === (selectedRow === null || selectedRow === void 0 ? void 0 : selectedRow.id) ? 'active' : '' }, row.getVisibleCells().map((cell) => (React__default["default"].createElement("td", { key: cell.id }, flexRender(cell.column.columnDef.cell, cell.getContext()))))))))),
23966
23968
  React__default["default"].createElement("tfoot", null, table.getFooterGroups().map((footerGroup) => (React__default["default"].createElement("tr", { key: footerGroup.id }, footerGroup.headers.map((header) => (React__default["default"].createElement("th", { key: header.id }, header.isPlaceholder ? null : flexRender(header.column.columnDef.footer, header.getContext()))))))))),
23967
- enablePagination && (React__default["default"].createElement("div", { style: { display: 'flex', justifyContent: 'space-between', padding: '0.5em 0' } },
23969
+ enablePagination && (React__default["default"].createElement("div", { style: { display: 'flex', justifyContent: 'space-between' } },
23968
23970
  React__default["default"].createElement("div", { style: { display: 'flex', gap: '0.5em' } },
23969
23971
  React__default["default"].createElement(Button, { onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage() }, "Prev"),
23970
23972
  React__default["default"].createElement(Button, { onClick: () => table.nextPage(), disabled: !table.getCanNextPage() }, "Next")),
23971
- React__default["default"].createElement("div", null,
23973
+ React__default["default"].createElement("div", { style: { position: 'relative', zIndex: 999 } },
23972
23974
  React__default["default"].createElement(StateManagedSelect$1, { defaultValue: {
23973
23975
  label: `${table.getState().pagination.pageSize} per page`,
23974
23976
  value: table.getState().pagination.pageSize,
23975
23977
  }, options: pageSizeOptions.map((value) => ({ value, label: `${value} per page` })), onChange: (e) => {
23976
23978
  table.setPageSize(Number(e.value));
23977
- } }))))));
23979
+ }, menuPosition: "fixed" }))))));
23978
23980
  };
23979
23981
 
23980
23982
  function _typeof$1(obj) {