@7shifts/sous-chef 3.40.2 → 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
@@ -8701,7 +8701,8 @@ var EmptyStateContainerStack = function EmptyStateContainerStack(_ref) {
8701
8701
  color: isPaywall ? 'eggplant-500' : 'tangerine-400'
8702
8702
  }, header), React__default.createElement(Text, {
8703
8703
  emphasis: "bold",
8704
- as: "body"
8704
+ as: "body",
8705
+ alignment: "center"
8705
8706
  }, title), React__default.createElement("div", {
8706
8707
  className: styles$N['empty-state-container-stack__body']
8707
8708
  }, children)), React__default.createElement(Stack, {
@@ -8860,6 +8861,7 @@ var DataTable$1 = function DataTable(_ref) {
8860
8861
  };
8861
8862
  var state = getDataTableState(isLoading, content.length);
8862
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;
8863
8865
  return React__default.createElement(Context.Provider, {
8864
8866
  value: {
8865
8867
  columns: columns,
@@ -8887,11 +8889,11 @@ var DataTable$1 = function DataTable(_ref) {
8887
8889
  }, dataProps), columns && isShowingColumns && React__default.createElement(DataTableHeader, {
8888
8890
  columns: columns,
8889
8891
  onSort: onSort,
8890
- showActionMenu: showActionMenu
8892
+ showActionMenu: isShowingContent && showActionMenu
8891
8893
  }), React__default.createElement("tbody", {
8892
- 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)),
8893
8895
  "data-testid": testId
8894
- }, (state === DATA_TABLE_STATES.CONTENT || state === DATA_TABLE_STATES.BACKGROUND_LOADING) && content.map(function (item, index) {
8896
+ }, isShowingContent && content.map(function (item, index) {
8895
8897
  return React__default.createElement(RowItem, {
8896
8898
  item: item,
8897
8899
  columns: columns,
@@ -8906,7 +8908,7 @@ var DataTable$1 = function DataTable(_ref) {
8906
8908
  return React__default.createElement(SkeletonRow, {
8907
8909
  key: index
8908
8910
  });
8909
- }))), isShowingFooter && React__default.createElement("tfoot", {
8911
+ }))), isShowingFooter && isShowingContent && React__default.createElement("tfoot", {
8910
8912
  className: styles$b['data-table__footer'],
8911
8913
  "data-testid": testId && testId + "-footer"
8912
8914
  }, footerComponent)))), !isShowingFooter && isScrollableTable && React__default.createElement(DataTableScrollFakeBorder, {
@@ -9640,17 +9642,21 @@ var FormSection = function FormSection(_ref) {
9640
9642
  subtitle = _ref.subtitle,
9641
9643
  _ref$noMargin = _ref.noMargin,
9642
9644
  noMargin = _ref$noMargin === void 0 ? false : _ref$noMargin,
9643
- testId = _ref.testId;
9644
- return React__default.createElement("div", {
9645
- className: classnames(styles$W['form-section'], (_classnames = {}, _classnames[styles$W['form-section--no-margin']] = noMargin, _classnames)),
9646
- "data-testid": testId
9647
- }, 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, {
9648
9648
  space: 8
9649
9649
  }, title && React__default.createElement("h2", {
9650
9650
  className: classnames(styles$W['form-section__title'])
9651
9651
  }, title), subtitle && React__default.createElement("h3", {
9652
9652
  className: classnames(styles$W['form-section__subtitle'])
9653
- }, 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);
9654
9660
  };
9655
9661
 
9656
9662
  var updateButtonProps$1 = function updateButtonProps(child, newProps) {