@7shifts/sous-chef 3.40.3 → 3.41.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.
@@ -5,6 +5,8 @@ type Props = {
5
5
  subtitle?: React.ReactNode;
6
6
  noMargin?: boolean;
7
7
  testId?: string;
8
+ /** When set `as="card"` it will render the form section in a card */
9
+ as?: 'card';
8
10
  };
9
- declare const FormSection: ({ children, title, subtitle, noMargin, testId }: Props) => React.JSX.Element;
11
+ declare const FormSection: ({ children, title, subtitle, noMargin, testId, as }: Props) => React.JSX.Element;
10
12
  export default FormSection;
package/dist/index.js CHANGED
@@ -8861,6 +8861,7 @@ var DataTable$1 = function DataTable(_ref) {
8861
8861
  };
8862
8862
  var state = getDataTableState(isLoading, content.length);
8863
8863
  var skeletonRows = Array.from(Array(AMOUNT_OF_SKELETON_ROWS).keys());
8864
+ var isShowingContent = state === DATA_TABLE_STATES.CONTENT || state === DATA_TABLE_STATES.BACKGROUND_LOADING;
8864
8865
  return React__default.createElement(Context.Provider, {
8865
8866
  value: {
8866
8867
  columns: columns,
@@ -8888,11 +8889,11 @@ var DataTable$1 = function DataTable(_ref) {
8888
8889
  }, dataProps), columns && isShowingColumns && React__default.createElement(DataTableHeader, {
8889
8890
  columns: columns,
8890
8891
  onSort: onSort,
8891
- showActionMenu: showActionMenu
8892
+ showActionMenu: isShowingContent && showActionMenu
8892
8893
  }), React__default.createElement("tbody", {
8893
- className: classnames(styles$b['data-table__body'], (_classNames3 = {}, _classNames3[styles$b['data-table__body--no-bottom-radius']] = isShowingFooter, _classNames3)),
8894
+ className: classnames(styles$b['data-table__body'], (_classNames3 = {}, _classNames3[styles$b['data-table__body--no-bottom-radius']] = isShowingFooter && isShowingContent, _classNames3)),
8894
8895
  "data-testid": testId
8895
- }, (state === DATA_TABLE_STATES.CONTENT || state === DATA_TABLE_STATES.BACKGROUND_LOADING) && content.map(function (item, index) {
8896
+ }, isShowingContent && content.map(function (item, index) {
8896
8897
  return React__default.createElement(RowItem, {
8897
8898
  item: item,
8898
8899
  columns: columns,
@@ -8907,7 +8908,7 @@ var DataTable$1 = function DataTable(_ref) {
8907
8908
  return React__default.createElement(SkeletonRow, {
8908
8909
  key: index
8909
8910
  });
8910
- }))), isShowingFooter && (state === DATA_TABLE_STATES.CONTENT || state === DATA_TABLE_STATES.BACKGROUND_LOADING) && React__default.createElement("tfoot", {
8911
+ }))), isShowingFooter && isShowingContent && React__default.createElement("tfoot", {
8911
8912
  className: styles$b['data-table__footer'],
8912
8913
  "data-testid": testId && testId + "-footer"
8913
8914
  }, footerComponent)))), !isShowingFooter && isScrollableTable && React__default.createElement(DataTableScrollFakeBorder, {
@@ -9641,17 +9642,21 @@ var FormSection = function FormSection(_ref) {
9641
9642
  subtitle = _ref.subtitle,
9642
9643
  _ref$noMargin = _ref.noMargin,
9643
9644
  noMargin = _ref$noMargin === void 0 ? false : _ref$noMargin,
9644
- testId = _ref.testId;
9645
- return React__default.createElement("div", {
9646
- className: classnames(styles$W['form-section'], (_classnames = {}, _classnames[styles$W['form-section--no-margin']] = noMargin, _classnames)),
9647
- "data-testid": testId
9648
- }, React__default.createElement(Stack, null, React__default.createElement(Stack, {
9645
+ testId = _ref.testId,
9646
+ as = _ref.as;
9647
+ var content = React__default.createElement(Stack, null, React__default.createElement(Stack, {
9649
9648
  space: 8
9650
9649
  }, title && React__default.createElement("h2", {
9651
9650
  className: classnames(styles$W['form-section__title'])
9652
9651
  }, title), subtitle && React__default.createElement("h3", {
9653
9652
  className: classnames(styles$W['form-section__subtitle'])
9654
- }, subtitle)), children));
9653
+ }, subtitle)), children);
9654
+ return React__default.createElement("div", {
9655
+ className: classnames(styles$W['form-section'], (_classnames = {}, _classnames[styles$W['form-section--no-margin']] = noMargin || as === 'card', _classnames)),
9656
+ "data-testid": testId
9657
+ }, as === 'card' ? React__default.createElement(Card$1, {
9658
+ testId: testId && testId + "-card"
9659
+ }, content) : content);
9655
9660
  };
9656
9661
 
9657
9662
  var updateButtonProps$1 = function updateButtonProps(child, newProps) {