@banyan_cloud/roots 1.0.39 → 1.0.40

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
@@ -1635,7 +1635,7 @@ BaseCell.propTypes = {
1635
1635
  size: propTypes$1.exports.oneOf(['sm', 'md', 'lg', 'auto']),
1636
1636
  flexible: propTypes$1.exports.bool,
1637
1637
  radius: propTypes$1.exports.oneOf(['none', 'default', 'round', 'ellipse']),
1638
- RootDOM: propTypes$1.exports.oneOf(['div', 'span', 'button']),
1638
+ RootDOM: propTypes$1.exports.oneOf(['div', 'span', 'button', 'td']),
1639
1639
  attrs: propTypes$1.exports.object
1640
1640
  };
1641
1641
  BaseCell.defaultProps = {
@@ -36723,11 +36723,12 @@ TableCell.propTypes = _objectSpread2(_objectSpread2({}, BaseCell.propTypes), {},
36723
36723
  });
36724
36724
  TableCell.defaultProps = _objectSpread2(_objectSpread2({}, BaseCell.defaultProps), {}, {
36725
36725
  cellContent: null,
36726
- cellTitle: null
36726
+ cellTitle: null,
36727
+ RootDOM: 'td'
36727
36728
  });
36728
36729
 
36729
- var css$l = ".TableRow_module_root__b76a6936 {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n}\n.TableRow_module_root__b76a6936.TableRow_module_headerRow__b76a6936 {\n background: var(--grey6);\n}\n.TableRow_module_root__b76a6936.TableRow_module_bodyRow__b76a6936 {\n background: var(--white);\n}\n.TableRow_module_root__b76a6936.TableRow_module_bodyRow__b76a6936:hover > [data-elem=base-cell] {\n background: var(--info-bg);\n}\n.TableRow_module_root__b76a6936.TableRow_module_bodyRow__b76a6936[data-active=true] > [data-elem=base-cell] {\n background: var(--background);\n}\n.TableRow_module_root__b76a6936 > [data-elem=base-cell]:first-child {\n padding-left: 1rem;\n}\n.TableRow_module_root__b76a6936 > [data-elem=base-cell]:last-child {\n padding-right: 1rem;\n}";
36730
- var modules_f6618a87 = {"root":"TableRow_module_root__b76a6936","header-row":"TableRow_module_headerRow__b76a6936","body-row":"TableRow_module_bodyRow__b76a6936"};
36730
+ var css$l = ".TableRow_module_root__a0ba90a7 {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n}\n.TableRow_module_root__a0ba90a7.TableRow_module_headerRow__a0ba90a7 {\n background: var(--grey6);\n}\n.TableRow_module_root__a0ba90a7.TableRow_module_headerRow__a0ba90a7.TableRow_module_expandable__a0ba90a7 > [data-elem=base-cell]:first-child {\n padding-left: 4.5rem;\n}\n.TableRow_module_root__a0ba90a7.TableRow_module_bodyRow__a0ba90a7 {\n background: var(--white);\n}\n.TableRow_module_root__a0ba90a7.TableRow_module_bodyRow__a0ba90a7:hover > [data-elem=base-cell] {\n background: var(--info-bg);\n}\n.TableRow_module_root__a0ba90a7.TableRow_module_bodyRow__a0ba90a7[data-active=true] > [data-elem=base-cell] {\n background: var(--background);\n}\n.TableRow_module_root__a0ba90a7 > [data-elem=base-cell]:first-child {\n padding-left: 1rem;\n}\n.TableRow_module_root__a0ba90a7 > [data-elem=base-cell]:last-child {\n padding-right: 1rem;\n}\n.TableRow_module_root__a0ba90a7 > [data-elem=base-cell].TableRow_module_expandableCell__a0ba90a7 {\n padding-left: 0.9rem;\n padding-right: 0.1rem;\n overflow: visible;\n}\n.TableRow_module_root__a0ba90a7 > [data-elem=base-cell].TableRow_module_expandableCell__a0ba90a7 > [data-elem=component2] {\n overflow: visible;\n}\n.TableRow_module_root__a0ba90a7 > [data-elem=base-cell].TableRow_module_expandableCell__a0ba90a7 > [data-elem=component2] > [data-elem=text] {\n overflow: visible;\n}\n.TableRow_module_root__a0ba90a7 .TableRow_module_button__a0ba90a7 .TableRow_module_icon__a0ba90a7 {\n width: 1.5rem;\n height: 1.5rem;\n}\n.TableRow_module_root__a0ba90a7 .TableRow_module_expanded__a0ba90a7 .TableRow_module_button__a0ba90a7 .TableRow_module_icon__a0ba90a7 {\n transform: rotate(180deg);\n}";
36731
+ var modules_f6618a87 = {"root":"TableRow_module_root__a0ba90a7","header-row":"TableRow_module_headerRow__a0ba90a7","expandable":"TableRow_module_expandable__a0ba90a7","body-row":"TableRow_module_bodyRow__a0ba90a7","expandable-cell":"TableRow_module_expandableCell__a0ba90a7","button":"TableRow_module_button__a0ba90a7","icon":"TableRow_module_icon__a0ba90a7","expanded":"TableRow_module_expanded__a0ba90a7"};
36731
36732
  n(css$l,{});
36732
36733
 
36733
36734
  var TableRow = /*#__PURE__*/React.forwardRef(function BaseTable(props, ref) {
@@ -36738,41 +36739,72 @@ var TableRow = /*#__PURE__*/React.forwardRef(function BaseTable(props, ref) {
36738
36739
  _index = props._index,
36739
36740
  customCells = props.customCells,
36740
36741
  className = props.className,
36741
- setActiveId = props.setActiveId;
36742
- return /*#__PURE__*/jsxRuntime.jsx("tr", {
36743
- ref: ref,
36744
- tabIndex: -1,
36745
- "data-elem": "table-row",
36746
- className: classes(className, modules_f6618a87.root, modules_f6618a87["".concat(type, "-row")]),
36747
- children: headerData === null || headerData === void 0 ? void 0 : (_headerData$map = headerData.map) === null || _headerData$map === void 0 ? void 0 : _headerData$map.call(headerData, function (item) {
36748
- var _getCustomCell;
36749
- var cellContent = null;
36750
- if (type === 'header') {
36751
- cellContent = item.title;
36752
- } else if (type === 'body') {
36753
- cellContent = datum === null || datum === void 0 ? void 0 : datum[item.id];
36754
- }
36755
- var cellProps = _objectSpread2(_objectSpread2(_objectSpread2({}, props), item), {}, {
36756
- _index: _index,
36757
- setActiveId: setActiveId,
36758
- key: item.id,
36742
+ setActiveId = props.setActiveId,
36743
+ Expandable = props.expandable;
36744
+ var _useState = React.useState(false),
36745
+ _useState2 = _slicedToArray(_useState, 2),
36746
+ expanded = _useState2[0],
36747
+ setExpanded = _useState2[1];
36748
+ var tableCells = headerData === null || headerData === void 0 ? void 0 : (_headerData$map = headerData.map) === null || _headerData$map === void 0 ? void 0 : _headerData$map.call(headerData, function (item) {
36749
+ var _getCustomCell;
36750
+ var cellContent = null;
36751
+ if (type === 'header') {
36752
+ cellContent = item.title;
36753
+ } else if (type === 'body') {
36754
+ cellContent = datum === null || datum === void 0 ? void 0 : datum[item.id];
36755
+ }
36756
+ var cellProps = _objectSpread2(_objectSpread2(_objectSpread2({}, props), item), {}, {
36757
+ _index: _index,
36758
+ setActiveId: setActiveId,
36759
+ key: item.id,
36760
+ datum: datum,
36761
+ cellContent: cellContent,
36762
+ cellTitle: cellContent,
36763
+ type: type
36764
+ });
36765
+ var getCustomCell = customCells === null || customCells === void 0 ? void 0 : customCells[type];
36766
+ var CustomCell = typeof getCustomCell === 'function' ? (_getCustomCell = getCustomCell()) === null || _getCustomCell === void 0 ? void 0 : _getCustomCell[item.id] : null;
36767
+ if (CustomCell != null) {
36768
+ // eslint-disable-next-line react/jsx-key
36769
+ return /*#__PURE__*/jsxRuntime.jsx(CustomCell, _objectSpread2({}, cellProps));
36770
+ }
36771
+ return (
36772
+ /*#__PURE__*/
36773
+ // eslint-disable-next-line react/jsx-key
36774
+ jsxRuntime.jsx(TableCell, _objectSpread2({}, cellProps))
36775
+ );
36776
+ });
36777
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
36778
+ children: [/*#__PURE__*/jsxRuntime.jsxs("tr", {
36779
+ ref: ref,
36780
+ tabIndex: -1,
36781
+ "data-elem": "table-row",
36782
+ className: classes(className, modules_f6618a87.root, modules_f6618a87["".concat(type, "-row")], Expandable ? modules_f6618a87.expandable : ''),
36783
+ children: [Expandable && type === 'body' && /*#__PURE__*/jsxRuntime.jsx(TableCell, {
36784
+ className: classes(modules_f6618a87['expandable-cell'], expanded ? modules_f6618a87.expanded : ''),
36785
+ size: "auto",
36786
+ cellContent: /*#__PURE__*/jsxRuntime.jsx(Button, {
36787
+ className: modules_f6618a87.button,
36788
+ size: "auto",
36789
+ variant: "text",
36790
+ onClick: function onClick() {
36791
+ setExpanded(function (prev) {
36792
+ return !prev;
36793
+ });
36794
+ },
36795
+ leftComponent: function leftComponent() {
36796
+ return /*#__PURE__*/jsxRuntime.jsx(Caret, {
36797
+ className: modules_f6618a87.icon
36798
+ });
36799
+ }
36800
+ })
36801
+ }), tableCells]
36802
+ }), Expandable && expanded && /*#__PURE__*/jsxRuntime.jsx("tr", {
36803
+ children: /*#__PURE__*/jsxRuntime.jsx(Expandable, {
36759
36804
  datum: datum,
36760
- cellContent: cellContent,
36761
- cellTitle: cellContent,
36762
- type: type
36763
- });
36764
- var getCustomCell = customCells === null || customCells === void 0 ? void 0 : customCells[type];
36765
- var CustomCell = typeof getCustomCell === 'function' ? (_getCustomCell = getCustomCell()) === null || _getCustomCell === void 0 ? void 0 : _getCustomCell[item.id] : null;
36766
- if (CustomCell != null) {
36767
- // eslint-disable-next-line react/jsx-key
36768
- return /*#__PURE__*/jsxRuntime.jsx(CustomCell, _objectSpread2({}, cellProps));
36769
- }
36770
- return (
36771
- /*#__PURE__*/
36772
- // eslint-disable-next-line react/jsx-key
36773
- jsxRuntime.jsx(TableCell, _objectSpread2({}, cellProps))
36774
- );
36775
- })
36805
+ index: _index
36806
+ })
36807
+ })]
36776
36808
  });
36777
36809
  });
36778
36810
  TableRow.propTypes = {
@@ -36792,8 +36824,11 @@ TableRow.propTypes = {
36792
36824
  style: propTypes$1.exports.object,
36793
36825
  multiLine: propTypes$1.exports.bool
36794
36826
  })),
36795
- setActiveId: propTypes$1.exports.func
36827
+ setActiveId: propTypes$1.exports.func,
36828
+ expandable: propTypes$1.exports.func
36829
+ // expandableComponent:
36796
36830
  };
36831
+
36797
36832
  TableRow.defaultProps = {
36798
36833
  className: '',
36799
36834
  type: 'body',
@@ -36803,7 +36838,8 @@ TableRow.defaultProps = {
36803
36838
  body: null
36804
36839
  },
36805
36840
  headerData: [],
36806
- setActiveId: function setActiveId() {}
36841
+ setActiveId: function setActiveId() {},
36842
+ expandable: null
36807
36843
  };
36808
36844
 
36809
36845
  var css$k = ".TableBody_module_root__77e2990d {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n}";
@@ -36815,7 +36851,8 @@ var TableBody = function TableBody(props) {
36815
36851
  var tableData = props.tableData,
36816
36852
  headerData = props.headerData,
36817
36853
  customCells = props.customCells,
36818
- className = props.className;
36854
+ className = props.className,
36855
+ expandable = props.expandable;
36819
36856
  var listRef = React.useRef([]);
36820
36857
  return /*#__PURE__*/jsxRuntime.jsx("tbody", {
36821
36858
  "data-elem": "table-body",
@@ -36842,7 +36879,8 @@ var TableBody = function TableBody(props) {
36842
36879
  headerData: headerData,
36843
36880
  customCells: customCells,
36844
36881
  _index: _index,
36845
- setActiveId: setActiveId
36882
+ setActiveId: setActiveId,
36883
+ expandable: expandable
36846
36884
  }, key);
36847
36885
  })
36848
36886
  });
@@ -36862,7 +36900,8 @@ TableBody.propTypes = {
36862
36900
  customCells: propTypes$1.exports.shape({
36863
36901
  header: propTypes$1.exports.object,
36864
36902
  body: propTypes$1.exports.object
36865
- })
36903
+ }),
36904
+ expandable: propTypes$1.exports.func
36866
36905
  };
36867
36906
  TableBody.defaultProps = {
36868
36907
  className: '',
@@ -36871,7 +36910,8 @@ TableBody.defaultProps = {
36871
36910
  customCells: {
36872
36911
  header: null,
36873
36912
  body: null
36874
- }
36913
+ },
36914
+ expandable: null
36875
36915
  };
36876
36916
 
36877
36917
  var css$j = ".TableHeader_module_root__daf69a14 {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n}";
@@ -36881,14 +36921,16 @@ n(css$j,{});
36881
36921
  /* eslint-disable react/forbid-prop-types */
36882
36922
  var TableHeader = function TableHeader(props) {
36883
36923
  var headerData = props.headerData,
36884
- customCells = props.customCells;
36924
+ customCells = props.customCells,
36925
+ expandable = props.expandable;
36885
36926
  return /*#__PURE__*/jsxRuntime.jsx("thead", {
36886
36927
  "data-elem": "table-header",
36887
36928
  className: modules_3be98c28.root,
36888
36929
  children: /*#__PURE__*/jsxRuntime.jsx(TableRow, {
36889
36930
  type: "header",
36890
36931
  headerData: headerData,
36891
- customCells: customCells
36932
+ customCells: customCells,
36933
+ expandable: expandable
36892
36934
  })
36893
36935
  });
36894
36936
  };
@@ -36905,14 +36947,16 @@ TableHeader.propTypes = {
36905
36947
  customCells: propTypes$1.exports.shape({
36906
36948
  header: propTypes$1.exports.func,
36907
36949
  body: propTypes$1.exports.func
36908
- })
36950
+ }),
36951
+ expandable: propTypes$1.exports.func
36909
36952
  };
36910
36953
  TableHeader.defaultProps = {
36911
36954
  headerData: [],
36912
36955
  customCells: {
36913
36956
  header: null,
36914
36957
  body: null
36915
- }
36958
+ },
36959
+ expandable: null
36916
36960
  };
36917
36961
 
36918
36962
  var css$i = ".BaseTable_module_root__7a8d241c {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n background: var(--white);\n overflow: auto;\n}";
@@ -36982,7 +37026,8 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function BaseTable(props, ref) {
36982
37026
  customCells = props.customCells,
36983
37027
  tableData = props.tableData,
36984
37028
  className = props.className,
36985
- loading = props.loading;
37029
+ loading = props.loading,
37030
+ expandable = props.expandable;
36986
37031
  if (loading) {
36987
37032
  return /*#__PURE__*/jsxRuntime.jsx(BaseTableSkeleton, {});
36988
37033
  }
@@ -36995,12 +37040,14 @@ var BaseTable = /*#__PURE__*/React.forwardRef(function BaseTable(props, ref) {
36995
37040
  className: classes(className, modules_f1817c60.root),
36996
37041
  children: [/*#__PURE__*/jsxRuntime.jsx(TableHeader, {
36997
37042
  headerData: transformedHeaderData,
36998
- customCells: customCells
37043
+ customCells: customCells,
37044
+ expandable: expandable
36999
37045
  }), /*#__PURE__*/jsxRuntime.jsx(TableBody, {
37000
37046
  ref: ref,
37001
37047
  headerData: transformedHeaderData,
37002
37048
  customCells: customCells,
37003
- tableData: tableData
37049
+ tableData: tableData,
37050
+ expandable: expandable
37004
37051
  })]
37005
37052
  });
37006
37053
  });
@@ -37020,7 +37067,8 @@ BaseTable.propTypes = {
37020
37067
  header: propTypes$1.exports.func,
37021
37068
  body: propTypes$1.exports.func
37022
37069
  }),
37023
- loading: propTypes$1.exports.bool
37070
+ loading: propTypes$1.exports.bool,
37071
+ expandable: propTypes$1.exports.func
37024
37072
  };
37025
37073
  BaseTable.defaultProps = {
37026
37074
  className: '',
@@ -37030,7 +37078,8 @@ BaseTable.defaultProps = {
37030
37078
  header: null,
37031
37079
  body: null
37032
37080
  },
37033
- loading: null
37081
+ loading: null,
37082
+ expandable: null
37034
37083
  };
37035
37084
 
37036
37085
  var css$f = ".Skeleton_module_root__15c10a9b[data-elem=base-cell] {\n align-items: flex-start;\n width: 100%;\n}\n.Skeleton_module_root__15c10a9b[data-elem=base-cell] > [data-elem=component1] {\n width: auto;\n}\n.Skeleton_module_root__15c10a9b[data-elem=base-cell] > [data-elem=component1] > [data-elem=skeleton] {\n height: 1.5rem;\n width: 1.5rem !important;\n}\n.Skeleton_module_root__15c10a9b[data-elem=base-cell] > [data-elem=component2] {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: center;\n gap: 1rem;\n flex: 8;\n}\n.Skeleton_module_root__15c10a9b[data-elem=base-cell] > [data-elem=component2] > [data-elem=skeleton] {\n max-width: 9rem;\n height: 1.5rem;\n}";