@7shifts/sous-chef 3.77.1 → 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.
@@ -8983,7 +8983,7 @@ const useLocalStorage = (key, initialValue) => {
8983
8983
 
8984
8984
  var styles$L = {"hint-modal":"_NwD6V","hint-modal--after-open":"_4ofZb","hint-modal--before-close":"_hGoMD","hint-modal__overlay":"_iK5zl","hint-modal__image":"_V9hLa","hint-modal__body":"_oOqUg","hint-modal__close-button":"_5zcBK"};
8985
8985
 
8986
- const _excluded$h = ["header", "children", "mediaUrl", "onClose", "modalId", "primaryButton", "secondaryButton", "testId"];
8986
+ const _excluded$h = ["header", "children", "mediaUrl", "onClose", "modalId", "primaryButton", "secondaryButton", "testId", "onSetDoNotShowAgainStatus"];
8987
8987
  const HintModal = _ref => {
8988
8988
  let {
8989
8989
  header,
@@ -8993,26 +8993,33 @@ const HintModal = _ref => {
8993
8993
  modalId,
8994
8994
  primaryButton,
8995
8995
  secondaryButton,
8996
- testId
8996
+ testId,
8997
+ onSetDoNotShowAgainStatus
8997
8998
  } = _ref,
8998
8999
  positionProps = _objectWithoutPropertiesLoose(_ref, _excluded$h);
8999
9000
  const __ = useTranslation('HintModal');
9000
9001
  const [doNotShowAgain, setDoNotShowAgain] = useState(false);
9001
9002
  const [persistedDoNotShow, setPersistedDoNotShow] = useLocalStorage(modalId, false);
9003
+ const persistDoNotShowAgain = value => {
9004
+ setPersistedDoNotShow(value);
9005
+ if (onSetDoNotShowAgainStatus) {
9006
+ onSetDoNotShowAgainStatus(value);
9007
+ }
9008
+ };
9002
9009
  const primaryButtonUpdated = updateButtonProps$1(primaryButton, {
9003
9010
  theme: primaryButton.props.theme || 'primary',
9004
9011
  size: BUTTON_SIZES.MIN_WIDTH_100,
9005
9012
  onClick: () => {
9006
- setPersistedDoNotShow(doNotShowAgain);
9007
- primaryButton.props.onClick();
9013
+ persistDoNotShowAgain(doNotShowAgain);
9014
+ primaryButton.props.onClick(doNotShowAgain);
9008
9015
  }
9009
9016
  });
9010
9017
  const secondaryButtonUpdated = secondaryButton ? updateButtonProps$1(secondaryButton, {
9011
9018
  theme: secondaryButton.props.theme || 'default',
9012
9019
  size: BUTTON_SIZES.MIN_WIDTH_100,
9013
9020
  onClick: () => {
9014
- setPersistedDoNotShow(doNotShowAgain);
9015
- secondaryButton.props.onClick();
9021
+ persistDoNotShowAgain(doNotShowAgain);
9022
+ secondaryButton.props.onClick(doNotShowAgain);
9016
9023
  }
9017
9024
  }) : undefined;
9018
9025
  const positionStyles = usePositionStyles(positionProps);
@@ -9022,7 +9029,7 @@ const HintModal = _ref => {
9022
9029
  })
9023
9030
  };
9024
9031
  const handleOnClose = () => {
9025
- setPersistedDoNotShow(doNotShowAgain);
9032
+ persistDoNotShowAgain(doNotShowAgain);
9026
9033
  onClose();
9027
9034
  };
9028
9035
  return React__default.createElement(ReactModal, {
@@ -14566,8 +14573,9 @@ const EMPTY_STATE_SIZE = {
14566
14573
  LARGE: 'large'
14567
14574
  };
14568
14575
 
14569
- 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"};
14570
14577
 
14578
+ const smallWidthPx = 320;
14571
14579
  const EmptyStateContainerInline = ({
14572
14580
  header,
14573
14581
  title,
@@ -14579,14 +14587,34 @@ const EmptyStateContainerInline = ({
14579
14587
  isPaywall: _isPaywall = false,
14580
14588
  testId
14581
14589
  }) => {
14590
+ var _ref$current2;
14582
14591
  const {
14583
14592
  isModalMounted: isInsideModal
14584
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]);
14585
14611
  return React__default.createElement("div", {
14586
14612
  className: classnames(styles$2['empty-state-container-inline'], {
14587
- [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
14588
14615
  }),
14589
- "data-testid": testId
14616
+ "data-testid": testId,
14617
+ ref: ref
14590
14618
  }, React__default.createElement("div", {
14591
14619
  className: classnames(styles$2['empty-state-container-inline__content'], {
14592
14620
  [styles$2['empty-state-container-inline__content--large']]: _size === EMPTY_STATE_SIZE.LARGE,
@@ -14603,7 +14631,8 @@ const EmptyStateContainerInline = ({
14603
14631
  className: styles$2['empty-state-container-inline__body']
14604
14632
  }, children), React__default.createElement(Stack, {
14605
14633
  space: 8,
14606
- marginTop: 12
14634
+ marginTop: 12,
14635
+ alignItems: isOnSmallContainer ? 'center' : undefined
14607
14636
  }, actions && React__default.createElement(EmptyStateContainerCTA, {
14608
14637
  actions: actions,
14609
14638
  isPaywall: _isPaywall,
@@ -14620,6 +14649,22 @@ const EmptyStateContainerInline = ({
14620
14649
  alt: String(title)
14621
14650
  })));
14622
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
+ }
14623
14668
 
14624
14669
  const EmptyStateContainer = ({
14625
14670
  header,