@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/esm/index.js CHANGED
@@ -1615,7 +1615,7 @@ BaseCell.propTypes = {
1615
1615
  size: propTypes$1.exports.oneOf(['sm', 'md', 'lg', 'auto']),
1616
1616
  flexible: propTypes$1.exports.bool,
1617
1617
  radius: propTypes$1.exports.oneOf(['none', 'default', 'round', 'ellipse']),
1618
- RootDOM: propTypes$1.exports.oneOf(['div', 'span', 'button']),
1618
+ RootDOM: propTypes$1.exports.oneOf(['div', 'span', 'button', 'td']),
1619
1619
  attrs: propTypes$1.exports.object
1620
1620
  };
1621
1621
  BaseCell.defaultProps = {
@@ -36703,11 +36703,12 @@ TableCell.propTypes = _objectSpread2(_objectSpread2({}, BaseCell.propTypes), {},
36703
36703
  });
36704
36704
  TableCell.defaultProps = _objectSpread2(_objectSpread2({}, BaseCell.defaultProps), {}, {
36705
36705
  cellContent: null,
36706
- cellTitle: null
36706
+ cellTitle: null,
36707
+ RootDOM: 'td'
36707
36708
  });
36708
36709
 
36709
- 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}";
36710
- var modules_f6618a87 = {"root":"TableRow_module_root__b76a6936","header-row":"TableRow_module_headerRow__b76a6936","body-row":"TableRow_module_bodyRow__b76a6936"};
36710
+ 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}";
36711
+ 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"};
36711
36712
  n(css$l,{});
36712
36713
 
36713
36714
  var TableRow = /*#__PURE__*/forwardRef(function BaseTable(props, ref) {
@@ -36718,41 +36719,72 @@ var TableRow = /*#__PURE__*/forwardRef(function BaseTable(props, ref) {
36718
36719
  _index = props._index,
36719
36720
  customCells = props.customCells,
36720
36721
  className = props.className,
36721
- setActiveId = props.setActiveId;
36722
- return /*#__PURE__*/jsx$1("tr", {
36723
- ref: ref,
36724
- tabIndex: -1,
36725
- "data-elem": "table-row",
36726
- className: classes(className, modules_f6618a87.root, modules_f6618a87["".concat(type, "-row")]),
36727
- 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) {
36728
- var _getCustomCell;
36729
- var cellContent = null;
36730
- if (type === 'header') {
36731
- cellContent = item.title;
36732
- } else if (type === 'body') {
36733
- cellContent = datum === null || datum === void 0 ? void 0 : datum[item.id];
36734
- }
36735
- var cellProps = _objectSpread2(_objectSpread2(_objectSpread2({}, props), item), {}, {
36736
- _index: _index,
36737
- setActiveId: setActiveId,
36738
- key: item.id,
36722
+ setActiveId = props.setActiveId,
36723
+ Expandable = props.expandable;
36724
+ var _useState = useState(false),
36725
+ _useState2 = _slicedToArray(_useState, 2),
36726
+ expanded = _useState2[0],
36727
+ setExpanded = _useState2[1];
36728
+ 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) {
36729
+ var _getCustomCell;
36730
+ var cellContent = null;
36731
+ if (type === 'header') {
36732
+ cellContent = item.title;
36733
+ } else if (type === 'body') {
36734
+ cellContent = datum === null || datum === void 0 ? void 0 : datum[item.id];
36735
+ }
36736
+ var cellProps = _objectSpread2(_objectSpread2(_objectSpread2({}, props), item), {}, {
36737
+ _index: _index,
36738
+ setActiveId: setActiveId,
36739
+ key: item.id,
36740
+ datum: datum,
36741
+ cellContent: cellContent,
36742
+ cellTitle: cellContent,
36743
+ type: type
36744
+ });
36745
+ var getCustomCell = customCells === null || customCells === void 0 ? void 0 : customCells[type];
36746
+ var CustomCell = typeof getCustomCell === 'function' ? (_getCustomCell = getCustomCell()) === null || _getCustomCell === void 0 ? void 0 : _getCustomCell[item.id] : null;
36747
+ if (CustomCell != null) {
36748
+ // eslint-disable-next-line react/jsx-key
36749
+ return /*#__PURE__*/jsx$1(CustomCell, _objectSpread2({}, cellProps));
36750
+ }
36751
+ return (
36752
+ /*#__PURE__*/
36753
+ // eslint-disable-next-line react/jsx-key
36754
+ jsx$1(TableCell, _objectSpread2({}, cellProps))
36755
+ );
36756
+ });
36757
+ return /*#__PURE__*/jsxs(Fragment, {
36758
+ children: [/*#__PURE__*/jsxs("tr", {
36759
+ ref: ref,
36760
+ tabIndex: -1,
36761
+ "data-elem": "table-row",
36762
+ className: classes(className, modules_f6618a87.root, modules_f6618a87["".concat(type, "-row")], Expandable ? modules_f6618a87.expandable : ''),
36763
+ children: [Expandable && type === 'body' && /*#__PURE__*/jsx$1(TableCell, {
36764
+ className: classes(modules_f6618a87['expandable-cell'], expanded ? modules_f6618a87.expanded : ''),
36765
+ size: "auto",
36766
+ cellContent: /*#__PURE__*/jsx$1(Button, {
36767
+ className: modules_f6618a87.button,
36768
+ size: "auto",
36769
+ variant: "text",
36770
+ onClick: function onClick() {
36771
+ setExpanded(function (prev) {
36772
+ return !prev;
36773
+ });
36774
+ },
36775
+ leftComponent: function leftComponent() {
36776
+ return /*#__PURE__*/jsx$1(Caret, {
36777
+ className: modules_f6618a87.icon
36778
+ });
36779
+ }
36780
+ })
36781
+ }), tableCells]
36782
+ }), Expandable && expanded && /*#__PURE__*/jsx$1("tr", {
36783
+ children: /*#__PURE__*/jsx$1(Expandable, {
36739
36784
  datum: datum,
36740
- cellContent: cellContent,
36741
- cellTitle: cellContent,
36742
- type: type
36743
- });
36744
- var getCustomCell = customCells === null || customCells === void 0 ? void 0 : customCells[type];
36745
- var CustomCell = typeof getCustomCell === 'function' ? (_getCustomCell = getCustomCell()) === null || _getCustomCell === void 0 ? void 0 : _getCustomCell[item.id] : null;
36746
- if (CustomCell != null) {
36747
- // eslint-disable-next-line react/jsx-key
36748
- return /*#__PURE__*/jsx$1(CustomCell, _objectSpread2({}, cellProps));
36749
- }
36750
- return (
36751
- /*#__PURE__*/
36752
- // eslint-disable-next-line react/jsx-key
36753
- jsx$1(TableCell, _objectSpread2({}, cellProps))
36754
- );
36755
- })
36785
+ index: _index
36786
+ })
36787
+ })]
36756
36788
  });
36757
36789
  });
36758
36790
  TableRow.propTypes = {
@@ -36772,8 +36804,11 @@ TableRow.propTypes = {
36772
36804
  style: propTypes$1.exports.object,
36773
36805
  multiLine: propTypes$1.exports.bool
36774
36806
  })),
36775
- setActiveId: propTypes$1.exports.func
36807
+ setActiveId: propTypes$1.exports.func,
36808
+ expandable: propTypes$1.exports.func
36809
+ // expandableComponent:
36776
36810
  };
36811
+
36777
36812
  TableRow.defaultProps = {
36778
36813
  className: '',
36779
36814
  type: 'body',
@@ -36783,7 +36818,8 @@ TableRow.defaultProps = {
36783
36818
  body: null
36784
36819
  },
36785
36820
  headerData: [],
36786
- setActiveId: function setActiveId() {}
36821
+ setActiveId: function setActiveId() {},
36822
+ expandable: null
36787
36823
  };
36788
36824
 
36789
36825
  var css$k = ".TableBody_module_root__77e2990d {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n}";
@@ -36795,7 +36831,8 @@ var TableBody = function TableBody(props) {
36795
36831
  var tableData = props.tableData,
36796
36832
  headerData = props.headerData,
36797
36833
  customCells = props.customCells,
36798
- className = props.className;
36834
+ className = props.className,
36835
+ expandable = props.expandable;
36799
36836
  var listRef = useRef([]);
36800
36837
  return /*#__PURE__*/jsx$1("tbody", {
36801
36838
  "data-elem": "table-body",
@@ -36822,7 +36859,8 @@ var TableBody = function TableBody(props) {
36822
36859
  headerData: headerData,
36823
36860
  customCells: customCells,
36824
36861
  _index: _index,
36825
- setActiveId: setActiveId
36862
+ setActiveId: setActiveId,
36863
+ expandable: expandable
36826
36864
  }, key);
36827
36865
  })
36828
36866
  });
@@ -36842,7 +36880,8 @@ TableBody.propTypes = {
36842
36880
  customCells: propTypes$1.exports.shape({
36843
36881
  header: propTypes$1.exports.object,
36844
36882
  body: propTypes$1.exports.object
36845
- })
36883
+ }),
36884
+ expandable: propTypes$1.exports.func
36846
36885
  };
36847
36886
  TableBody.defaultProps = {
36848
36887
  className: '',
@@ -36851,7 +36890,8 @@ TableBody.defaultProps = {
36851
36890
  customCells: {
36852
36891
  header: null,
36853
36892
  body: null
36854
- }
36893
+ },
36894
+ expandable: null
36855
36895
  };
36856
36896
 
36857
36897
  var css$j = ".TableHeader_module_root__daf69a14 {\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: stretch;\n}";
@@ -36861,14 +36901,16 @@ n(css$j,{});
36861
36901
  /* eslint-disable react/forbid-prop-types */
36862
36902
  var TableHeader = function TableHeader(props) {
36863
36903
  var headerData = props.headerData,
36864
- customCells = props.customCells;
36904
+ customCells = props.customCells,
36905
+ expandable = props.expandable;
36865
36906
  return /*#__PURE__*/jsx$1("thead", {
36866
36907
  "data-elem": "table-header",
36867
36908
  className: modules_3be98c28.root,
36868
36909
  children: /*#__PURE__*/jsx$1(TableRow, {
36869
36910
  type: "header",
36870
36911
  headerData: headerData,
36871
- customCells: customCells
36912
+ customCells: customCells,
36913
+ expandable: expandable
36872
36914
  })
36873
36915
  });
36874
36916
  };
@@ -36885,14 +36927,16 @@ TableHeader.propTypes = {
36885
36927
  customCells: propTypes$1.exports.shape({
36886
36928
  header: propTypes$1.exports.func,
36887
36929
  body: propTypes$1.exports.func
36888
- })
36930
+ }),
36931
+ expandable: propTypes$1.exports.func
36889
36932
  };
36890
36933
  TableHeader.defaultProps = {
36891
36934
  headerData: [],
36892
36935
  customCells: {
36893
36936
  header: null,
36894
36937
  body: null
36895
- }
36938
+ },
36939
+ expandable: null
36896
36940
  };
36897
36941
 
36898
36942
  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}";
@@ -36962,7 +37006,8 @@ var BaseTable = /*#__PURE__*/forwardRef(function BaseTable(props, ref) {
36962
37006
  customCells = props.customCells,
36963
37007
  tableData = props.tableData,
36964
37008
  className = props.className,
36965
- loading = props.loading;
37009
+ loading = props.loading,
37010
+ expandable = props.expandable;
36966
37011
  if (loading) {
36967
37012
  return /*#__PURE__*/jsx$1(BaseTableSkeleton, {});
36968
37013
  }
@@ -36975,12 +37020,14 @@ var BaseTable = /*#__PURE__*/forwardRef(function BaseTable(props, ref) {
36975
37020
  className: classes(className, modules_f1817c60.root),
36976
37021
  children: [/*#__PURE__*/jsx$1(TableHeader, {
36977
37022
  headerData: transformedHeaderData,
36978
- customCells: customCells
37023
+ customCells: customCells,
37024
+ expandable: expandable
36979
37025
  }), /*#__PURE__*/jsx$1(TableBody, {
36980
37026
  ref: ref,
36981
37027
  headerData: transformedHeaderData,
36982
37028
  customCells: customCells,
36983
- tableData: tableData
37029
+ tableData: tableData,
37030
+ expandable: expandable
36984
37031
  })]
36985
37032
  });
36986
37033
  });
@@ -37000,7 +37047,8 @@ BaseTable.propTypes = {
37000
37047
  header: propTypes$1.exports.func,
37001
37048
  body: propTypes$1.exports.func
37002
37049
  }),
37003
- loading: propTypes$1.exports.bool
37050
+ loading: propTypes$1.exports.bool,
37051
+ expandable: propTypes$1.exports.func
37004
37052
  };
37005
37053
  BaseTable.defaultProps = {
37006
37054
  className: '',
@@ -37010,7 +37058,8 @@ BaseTable.defaultProps = {
37010
37058
  header: null,
37011
37059
  body: null
37012
37060
  },
37013
- loading: null
37061
+ loading: null,
37062
+ expandable: null
37014
37063
  };
37015
37064
 
37016
37065
  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}";