@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.
package/dist/index.js CHANGED
@@ -8813,7 +8813,7 @@ var useLocalStorage = function useLocalStorage(key, initialValue) {
8813
8813
 
8814
8814
  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"};
8815
8815
 
8816
- var _excluded$h = ["header", "children", "mediaUrl", "onClose", "modalId", "primaryButton", "secondaryButton", "testId"];
8816
+ var _excluded$h = ["header", "children", "mediaUrl", "onClose", "modalId", "primaryButton", "secondaryButton", "testId", "onSetDoNotShowAgainStatus"];
8817
8817
  var HintModal = function HintModal(_ref) {
8818
8818
  var header = _ref.header,
8819
8819
  children = _ref.children,
@@ -8823,6 +8823,7 @@ var HintModal = function HintModal(_ref) {
8823
8823
  primaryButton = _ref.primaryButton,
8824
8824
  secondaryButton = _ref.secondaryButton,
8825
8825
  testId = _ref.testId,
8826
+ onSetDoNotShowAgainStatus = _ref.onSetDoNotShowAgainStatus,
8826
8827
  positionProps = _objectWithoutPropertiesLoose(_ref, _excluded$h);
8827
8828
  var __ = useTranslation('HintModal');
8828
8829
  var _useState = React.useState(false),
@@ -8831,20 +8832,26 @@ var HintModal = function HintModal(_ref) {
8831
8832
  var _useLocalStorage = useLocalStorage(modalId, false),
8832
8833
  persistedDoNotShow = _useLocalStorage[0],
8833
8834
  setPersistedDoNotShow = _useLocalStorage[1];
8835
+ var persistDoNotShowAgain = function persistDoNotShowAgain(value) {
8836
+ setPersistedDoNotShow(value);
8837
+ if (onSetDoNotShowAgainStatus) {
8838
+ onSetDoNotShowAgainStatus(value);
8839
+ }
8840
+ };
8834
8841
  var primaryButtonUpdated = updateButtonProps$1(primaryButton, {
8835
8842
  theme: primaryButton.props.theme || 'primary',
8836
8843
  size: BUTTON_SIZES.MIN_WIDTH_100,
8837
8844
  onClick: function onClick() {
8838
- setPersistedDoNotShow(doNotShowAgain);
8839
- primaryButton.props.onClick();
8845
+ persistDoNotShowAgain(doNotShowAgain);
8846
+ primaryButton.props.onClick(doNotShowAgain);
8840
8847
  }
8841
8848
  });
8842
8849
  var secondaryButtonUpdated = secondaryButton ? updateButtonProps$1(secondaryButton, {
8843
8850
  theme: secondaryButton.props.theme || 'default',
8844
8851
  size: BUTTON_SIZES.MIN_WIDTH_100,
8845
8852
  onClick: function onClick() {
8846
- setPersistedDoNotShow(doNotShowAgain);
8847
- secondaryButton.props.onClick();
8853
+ persistDoNotShowAgain(doNotShowAgain);
8854
+ secondaryButton.props.onClick(doNotShowAgain);
8848
8855
  }
8849
8856
  }) : undefined;
8850
8857
  var positionStyles = usePositionStyles(positionProps);
@@ -8854,7 +8861,7 @@ var HintModal = function HintModal(_ref) {
8854
8861
  })
8855
8862
  };
8856
8863
  var handleOnClose = function handleOnClose() {
8857
- setPersistedDoNotShow(doNotShowAgain);
8864
+ persistDoNotShowAgain(doNotShowAgain);
8858
8865
  onClose();
8859
8866
  };
8860
8867
  return React__default["default"].createElement(ReactModal__default["default"], {
@@ -14470,10 +14477,11 @@ var EMPTY_STATE_SIZE = {
14470
14477
  LARGE: 'large'
14471
14478
  };
14472
14479
 
14473
- 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"};
14480
+ 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"};
14474
14481
 
14482
+ var smallWidthPx = 320;
14475
14483
  var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
14476
- var _classNames, _classnames, _classnames2;
14484
+ var _ref$current2, _classNames, _classnames, _classnames2;
14477
14485
  var header = _ref.header,
14478
14486
  title = _ref.title,
14479
14487
  children = _ref.children,
@@ -14487,9 +14495,29 @@ var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
14487
14495
  testId = _ref.testId;
14488
14496
  var _useModalContext = useModalContext(),
14489
14497
  isInsideModal = _useModalContext.isModalMounted;
14498
+ var _useState = React.useState(false),
14499
+ isOnSmallContainer = _useState[0],
14500
+ setIsOnSmallContainer = _useState[1];
14501
+ var ref = React.useRef(null);
14502
+ React.useLayoutEffect(function () {
14503
+ if (isSmallParent(parentWidthFromRef(ref))) {
14504
+ setIsOnSmallContainer(true);
14505
+ }
14506
+ }, []);
14507
+ React.useLayoutEffect(function () {
14508
+ var _ref$current;
14509
+ var parentElement = (_ref$current = ref.current) == null ? void 0 : _ref$current.parentElement;
14510
+ if (parentElement) {
14511
+ var parentResize = new ResizeObserver(function (event) {
14512
+ setIsOnSmallContainer(isSmallParent(parentWidthFromResizeEvent(event)));
14513
+ });
14514
+ parentResize.observe(parentElement);
14515
+ }
14516
+ }, [(_ref$current2 = ref.current) == null ? void 0 : _ref$current2.parentElement]);
14490
14517
  return React__default["default"].createElement("div", {
14491
- className: classnames__default["default"](styles$2['empty-state-container-inline'], (_classNames = {}, _classNames[styles$2['empty-state-container-inline--inside-modal']] = isInsideModal, _classNames)),
14492
- "data-testid": testId
14518
+ className: classnames__default["default"](styles$2['empty-state-container-inline'], (_classNames = {}, _classNames[styles$2['empty-state-container-inline--inside-modal']] = isInsideModal, _classNames[styles$2['empty-state-container-inline--small-container']] = isOnSmallContainer, _classNames)),
14519
+ "data-testid": testId,
14520
+ ref: ref
14493
14521
  }, React__default["default"].createElement("div", {
14494
14522
  className: classnames__default["default"](styles$2['empty-state-container-inline__content'], (_classnames = {}, _classnames[styles$2['empty-state-container-inline__content--large']] = size === EMPTY_STATE_SIZE.LARGE, _classnames[styles$2['empty-state-container-inline__content--medium']] = size === EMPTY_STATE_SIZE.MEDIUM, _classnames))
14495
14523
  }, React__default["default"].createElement(Stack, {
@@ -14503,7 +14531,8 @@ var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
14503
14531
  className: styles$2['empty-state-container-inline__body']
14504
14532
  }, children), React__default["default"].createElement(Stack, {
14505
14533
  space: 8,
14506
- marginTop: 12
14534
+ marginTop: 12,
14535
+ alignItems: isOnSmallContainer ? 'center' : undefined
14507
14536
  }, actions && React__default["default"].createElement(EmptyStateContainerCTA, {
14508
14537
  actions: actions,
14509
14538
  isPaywall: isPaywall,
@@ -14517,6 +14546,22 @@ var EmptyStateContainerInline = function EmptyStateContainerInline(_ref) {
14517
14546
  alt: String(title)
14518
14547
  })));
14519
14548
  };
14549
+ function parentWidthFromRef(ref) {
14550
+ var _ref$current3;
14551
+ return (_ref$current3 = ref.current) == null || (_ref$current3 = _ref$current3.parentElement) == null || (_ref$current3 = _ref$current3.getBoundingClientRect()) == null ? void 0 : _ref$current3.width;
14552
+ }
14553
+ function parentWidthFromResizeEvent(event) {
14554
+ if (event.length > 0) {
14555
+ if (event[0].contentBoxSize.length > 0) {
14556
+ return event[0].contentBoxSize[0].inlineSize;
14557
+ }
14558
+ return event[0].contentRect.width;
14559
+ }
14560
+ return undefined;
14561
+ }
14562
+ function isSmallParent(width) {
14563
+ return width !== undefined && width <= smallWidthPx;
14564
+ }
14520
14565
 
14521
14566
  var EmptyStateContainer = function EmptyStateContainer(_ref) {
14522
14567
  var header = _ref.header,