@7shifts/sous-chef 3.78.0 → 3.78.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.
@@ -14573,8 +14573,9 @@ const EMPTY_STATE_SIZE = {
14573
14573
  LARGE: 'large'
14574
14574
  };
14575
14575
 
14576
- var styles$2 = {"empty-state-container-inline":"_mhyqH","empty-state-container-inline--inside-modal":"_Kiu3T","empty-state-container-inline__content":"_Px6C0","empty-state-container-inline__content--large":"_voA-r","empty-state-container-inline__content--medium":"_Q9cut","empty-state-container-inline__body":"_xMUQ6","empty-state-container-inline__image":"_79QnQ","empty-state-container-inline__image--large":"_HxPhH","empty-state-container-inline__image--medium":"_TeUmg"};
14576
+ var styles$2 = {"empty-state-container-inline":"_mhyqH","empty-state-container-inline--inside-modal":"_Kiu3T","empty-state-container-inline__content":"_Px6C0","empty-state-container-inline__content--large":"_voA-r","empty-state-container-inline__content--medium":"_Q9cut","empty-state-container-inline__body":"_xMUQ6","empty-state-container-inline__image":"_79QnQ","empty-state-container-inline__image--large":"_HxPhH","empty-state-container-inline__image--medium":"_TeUmg","empty-state-container-inline--small-container":"_VWrGi"};
14577
14577
 
14578
+ const smallWidthPx = 320;
14578
14579
  const EmptyStateContainerInline = ({
14579
14580
  header,
14580
14581
  title,
@@ -14586,14 +14587,34 @@ const EmptyStateContainerInline = ({
14586
14587
  isPaywall: _isPaywall = false,
14587
14588
  testId
14588
14589
  }) => {
14590
+ var _ref$current2;
14589
14591
  const {
14590
14592
  isModalMounted: isInsideModal
14591
14593
  } = useModalContext();
14594
+ const [isOnSmallContainer, setIsOnSmallContainer] = useState(false);
14595
+ const ref = useRef(null);
14596
+ useLayoutEffect(() => {
14597
+ if (isSmallParent(parentWidthFromRef(ref))) {
14598
+ setIsOnSmallContainer(true);
14599
+ }
14600
+ }, []);
14601
+ useLayoutEffect(() => {
14602
+ var _ref$current;
14603
+ const parentElement = (_ref$current = ref.current) == null ? void 0 : _ref$current.parentElement;
14604
+ if (parentElement) {
14605
+ const parentResize = new ResizeObserver(event => {
14606
+ setIsOnSmallContainer(isSmallParent(parentWidthFromResizeEvent(event)));
14607
+ });
14608
+ parentResize.observe(parentElement);
14609
+ }
14610
+ }, [(_ref$current2 = ref.current) == null ? void 0 : _ref$current2.parentElement]);
14592
14611
  return React__default.createElement("div", {
14593
14612
  className: classnames(styles$2['empty-state-container-inline'], {
14594
- [styles$2['empty-state-container-inline--inside-modal']]: isInsideModal
14613
+ [styles$2['empty-state-container-inline--inside-modal']]: isInsideModal,
14614
+ [styles$2['empty-state-container-inline--small-container']]: isOnSmallContainer
14595
14615
  }),
14596
- "data-testid": testId
14616
+ "data-testid": testId,
14617
+ ref: ref
14597
14618
  }, React__default.createElement("div", {
14598
14619
  className: classnames(styles$2['empty-state-container-inline__content'], {
14599
14620
  [styles$2['empty-state-container-inline__content--large']]: _size === EMPTY_STATE_SIZE.LARGE,
@@ -14610,7 +14631,8 @@ const EmptyStateContainerInline = ({
14610
14631
  className: styles$2['empty-state-container-inline__body']
14611
14632
  }, children), React__default.createElement(Stack, {
14612
14633
  space: 8,
14613
- marginTop: 12
14634
+ marginTop: 12,
14635
+ alignItems: isOnSmallContainer ? 'center' : undefined
14614
14636
  }, actions && React__default.createElement(EmptyStateContainerCTA, {
14615
14637
  actions: actions,
14616
14638
  isPaywall: _isPaywall,
@@ -14627,6 +14649,22 @@ const EmptyStateContainerInline = ({
14627
14649
  alt: String(title)
14628
14650
  })));
14629
14651
  };
14652
+ function parentWidthFromRef(ref) {
14653
+ var _ref$current3;
14654
+ return (_ref$current3 = ref.current) == null || (_ref$current3 = _ref$current3.parentElement) == null || (_ref$current3 = _ref$current3.getBoundingClientRect()) == null ? void 0 : _ref$current3.width;
14655
+ }
14656
+ function parentWidthFromResizeEvent(event) {
14657
+ if (event.length > 0) {
14658
+ if (event[0].contentBoxSize.length > 0) {
14659
+ return event[0].contentBoxSize[0].inlineSize;
14660
+ }
14661
+ return event[0].contentRect.width;
14662
+ }
14663
+ return undefined;
14664
+ }
14665
+ function isSmallParent(width) {
14666
+ return width !== undefined && width <= smallWidthPx;
14667
+ }
14630
14668
 
14631
14669
  const EmptyStateContainer = ({
14632
14670
  header,